Skip to content

Commit c0a8c36

Browse files
committed
Bitmap_Z work, fill ResourceObject_Z with actual information
1 parent 4f5e30a commit c0a8c36

File tree

4 files changed

+45
-32
lines changed

4 files changed

+45
-32
lines changed

configure.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -218,22 +218,6 @@
218218
"-rostr"
219219
]
220220

221-
cflags_rat_base_libgc = [
222-
*cflags_base,
223-
"-pool on",
224-
"-schedule on",
225-
"-fp fmadd",
226-
"-use_lmw_stmw on",
227-
'-pragma "cpp_extensions on"',
228-
"-sym on",
229-
"-inline off",
230-
"-i src/Engine/includes",
231-
"-i src/LibGC/includes",
232-
"-i src/Rat/includes",
233-
"-i src/sdk/includes",
234-
"-O4,p",
235-
"-rostr"
236-
]
237221

238222
cflags_rat_base_libgc = [
239223
*cflags_base,

src/Engine/Bitmap_Z.cpp

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "Assert_Z.h"
33
extern void Z_FreeContiguous(void* ptr);
44

5+
#pragma dont_inline on
56
Bitmap_Z::Bitmap_Z()
67
{
78
Init();
@@ -18,7 +19,6 @@ Bitmap_Z::~Bitmap_Z()
1819
Reset();
1920
}
2021

21-
#pragma dont_inline on
2222
void Bitmap_Z::Init() {
2323
m_Flag = 0;
2424
Bitmap_Z::EnableFlag(0x14);
@@ -54,7 +54,7 @@ void Bitmap_Z::Reset() {
5454
}
5555

5656
// far from complete
57-
void Bitmap_Z::InitBmap(S32 i_SizeX, S32 i_SizeY, U8 i_Format, U8* i_Palette, U8 i_UnkBool)
57+
void Bitmap_Z::InitBmap(S32 i_SizeX, S32 i_SizeY, U8 i_Format, U8* i_Palette, U8* i_Datas)
5858
{
5959
int l_PaletteSize;
6060
int l_BytePalleteSize;
@@ -121,20 +121,36 @@ S32 Bitmap_Z::GetDataSize()
121121
return l_MipSize;
122122
}
123123

124-
// not matching. too lazy to fix for now
125124
S32 Bitmap_Z::GetPalSize()
126125
{
127-
U8 l_PalFormat = m_PalFormat;
128-
if ((l_PalFormat >= PAL_ALPHA|PAL_565) && (l_PalFormat != 9 && l_PalFormat < 0x10))
129-
return 0;
130-
else
126+
switch (GetFormat())
131127
{
132-
if (l_PalFormat == PAL_565)
133-
return 256;
134-
else if (l_PalFormat == PAL_3444)
128+
case BM_4:
135129
return 16;
130+
case BM_8:
131+
return 256;
132+
case BM_5551:
133+
case BM_565:
134+
case BM_4444:
135+
case BM_1555:
136+
case BM_8888:
137+
case BM_888:
138+
case BM_CMPR:
139+
case BM_I4A4:
140+
return 0;
141+
default:
142+
ExceptionFonc_Z("FALSE", __FILE__, __LINE__, "Bitmap_Z::GetPalSize", 0, 0, 0, 0, 0, 0);
143+
return 0;
144+
136145
}
137-
ExceptionFonc_Z("FALSE", __FILE__, __LINE__, "Bitmap_Z::GetPalSize", 0, 0, 0, 0, 0, 0);
138-
return 0;
146+
}
147+
148+
S32 Bitmap_Z::GetNbEntries()
149+
{
150+
U8 l_Format = m_Format;
151+
if (l_Format == BM_4)
152+
return 16;
153+
else
154+
return l_Format != BM_8 ? 256 : 0;
139155
}
140156
#pragma dont_inline off

src/Engine/includes/Bitmap_Z.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,16 @@ class Bitmap_Z : public ResourceObject_Z
5050
virtual ~Bitmap_Z();
5151
virtual void Load(void* a1);
5252
virtual void Clean();
53-
void InitBmap(S32 l_SizeX, S32 l_SizeY, U8 l_Format, U8* l_Palette, U8 l_UnkBool);
53+
void InitBmap(S32 l_SizeX, S32 l_SizeY, U8 l_Format, U8* l_Palette, U8* i_Datas);
5454
void EnableFlag(U16 i_Flag) {m_Flag|=i_Flag;}
55-
S32 GetFormat() {return m_Format;}
55+
U8 GetFormat() {return m_Format;}
5656
void* GetDatas() {return m_Datas;}
5757
void Reset();
5858
void Invalidate();
5959
Float GetBytePerPixel();
6060
S32 GetPalSize();
6161
S32 GetDataSize();
62+
S32 GetNbEntries();
6263
private:
6364
void* m_Datas;
6465
void* m_Palette;
Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
11
#ifndef _RESOURCE_OBJECT_Z_H_
22
#define _RESOURCE_OBJECT_Z_H_
33
#include "BaseObject_Z.h"
4+
#include "DynArray_Z.h"
5+
class ResourceObjectLink_Z
6+
{
7+
public:
8+
ResourceObjectLink_Z();
9+
~ResourceObjectLink_Z();
10+
void Load(void* a1);
11+
void EndLoad();
12+
void EndLoadLinks();
13+
void MarkHandles();
14+
DynArray_Z<BaseObject_ZHdl, 32> m_LinkedResourceDA;
15+
};
416

517
class ResourceObject_Z : public BaseObject_Z
618
{
719
public:
8-
ResourceObject_Z() {};
20+
ResourceObject_Z();
921
~ResourceObject_Z();
1022
virtual void Load(void* a1);
1123
virtual void EndLoad();
1224
virtual void LoadLinks(void* a1);
1325
virtual void EndLoadLinks();
1426
virtual void MarkHandles();
15-
char pad_000C[8];
27+
ResourceObjectLink_Z m_ResObjLink;
1628
};
1729

1830
#endif

0 commit comments

Comments
 (0)