mirror of
https://github.com/zeldaret/oot
synced 2026-07-12 07:29:05 -04:00
Decompile z_jpeg.c (#70)
* Decompile z_jpeg.c - Decompile z_jpeg.c - Move .bss variables from fault.c and fault_drawer.c into .s files to avoid bss reordering * Rename JPEGWork to JpegWork and minor fix in Jpeg_GetU16
This commit is contained in:
+12
-12
@@ -813,11 +813,11 @@ s32 func_8006C4A4(GlobalContext*, s32);
|
||||
// ? func_8006D0EC(?);
|
||||
// ? func_8006D684(?);
|
||||
// ? func_8006DC68(?);
|
||||
// ? func_8006DE30(?);
|
||||
// ? func_8006DF68(?);
|
||||
// ? func_8006E0A0(?);
|
||||
// ? func_8006E0EC(?);
|
||||
// ? func_8006E418(?);
|
||||
u32 Jpeg_SendTask(JpegContext* ctx);
|
||||
void Jpeg_CopyToZbuffer(u16* src, u16* zbuffer, s32 x, s32 y);
|
||||
u16 Jpeg_GetU16(u8* ptr);
|
||||
void Jpeg_ParseMarkers(u8* ptr, JpegContext* ctx);
|
||||
s32 Jpeg_Decode(void* data, u16* zbuffer, JpegWork* workBuff, u32 workSize);
|
||||
// ? func_8006EA30(?);
|
||||
// ? func_8006ECF4(?);
|
||||
void func_8006EE48(UNK_TYPE);
|
||||
@@ -1710,10 +1710,10 @@ void func_800D2264(MtxF* mf, Vec3s* vec, s32 flag);
|
||||
void func_800D23FC(f32 f, Vec3f* vec, u8 mode);
|
||||
MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line);
|
||||
void func_800D2CEC(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6);
|
||||
// ? SysUcode_GetUCodeBoot(?);
|
||||
// ? SysUcode_GetUcodeBootSize(?);
|
||||
// ? SysUcode_GetUcode(?);
|
||||
// ? SysUcode_GetUcodeData(?);
|
||||
u32 SysUcode_GetUCodeBoot();
|
||||
u32 SysUcode_GetUCodeBootSize();
|
||||
u32 SysUcode_GetUCode();
|
||||
u32 SysUcode_GetUCodeData();
|
||||
// ? func_800D2E30(?);
|
||||
// ? func_800D3140(?);
|
||||
// ? func_800D3140(?);
|
||||
@@ -2316,14 +2316,14 @@ void Sleep_Nsec(u32 nsec);
|
||||
void Sleep_Usec(u32 usec);
|
||||
void Sleep_Msec(u32 ms);
|
||||
void Sleep_Sec(u32 sec);
|
||||
// ? func_800FF540(?);
|
||||
void func_800FF540(u8* dqt, JpegQuantizationTable* qtPtr, u8 count);
|
||||
// ? func_800FF5A8(?);
|
||||
// ? func_800FF62C(?);
|
||||
// ? func_800FF698(?);
|
||||
// ? func_800FF740(?);
|
||||
// ? func_800FF7FC(?);
|
||||
u32 func_800FF7FC(u8* data, JpegHuffmanTable* htPtr, void*, void*, u8 count);
|
||||
// ? func_800FF8D4(?);
|
||||
// ? func_800FFA50(?);
|
||||
u32 func_800FFA50(JpegDecoder* decoder, u16*, u32, u8, u32*);
|
||||
// ? func_800FFC78(?);
|
||||
// ? func_800FFE14(?);
|
||||
// ? func_800FFF50(?);
|
||||
|
||||
+4
-11
@@ -138,6 +138,8 @@ extern OSPiHandle __CartRomHandle;
|
||||
extern DmaEntry gDmaDataTable[0x60C];
|
||||
//extern ? D_800D7288;
|
||||
extern u8 D_801120C0[];
|
||||
extern u8 D_80113070[];
|
||||
extern u8 D_80114930[];
|
||||
//extern ? D_80115440;
|
||||
//extern ? D_80115760;
|
||||
//extern ? D_80115770;
|
||||
@@ -265,12 +267,6 @@ extern s16 D_8011E0B0;
|
||||
extern Color_RGBA8 D_8011E0B4[];
|
||||
//extern ? D_8011E0D4;
|
||||
extern GameStateOverlay gGameStateOverlayTable[6];
|
||||
//extern ? D_8011FA60;
|
||||
//extern ? D_8011FA64;
|
||||
//extern ? D_8011FA68;
|
||||
//extern ? D_8011FA6C;
|
||||
//extern ? D_8011FA90;
|
||||
//extern ? D_8011FA98;
|
||||
//extern ? D_8011FAF0;
|
||||
extern u8 D_8011FB30;
|
||||
//extern ? D_8011FB34;
|
||||
@@ -3299,6 +3295,8 @@ extern char D_80146238[];
|
||||
//extern ? D_80155BF0;
|
||||
//extern ? D_80155C70;
|
||||
extern u8 D_80155F50[];
|
||||
extern u8 D_80157580[];
|
||||
extern u8 D_80157D30[];
|
||||
extern GlobalContext* D_80157DA0;
|
||||
//extern ? D_80157DA4;
|
||||
//extern ? D_80157DA8;
|
||||
@@ -3576,12 +3574,7 @@ extern volatile OSTime D_8016A580;
|
||||
//extern ? D_8016A750;
|
||||
//extern ? D_8016A794;
|
||||
//extern ? D_8016A7AC;
|
||||
extern FaultThreadStruct* sFaultStructPtr;
|
||||
extern u8 sFaultIsWaitingForInput;
|
||||
extern char sFaultStack[0x600];
|
||||
extern char sFaultThreadInfo[0x20];
|
||||
extern FaultThreadStruct gFaultStruct;
|
||||
extern u32 D_8016B5F5;
|
||||
//extern ? D_8016B5F6;
|
||||
//extern ? D_8016B684;
|
||||
//extern ? D_8016B690;
|
||||
|
||||
+122
-71
@@ -1143,71 +1143,71 @@ typedef enum {
|
||||
} MatrixMode;
|
||||
|
||||
typedef struct FaultClient {
|
||||
struct FaultClient* next;
|
||||
u32 callback;
|
||||
u32 param1;
|
||||
u32 param2;
|
||||
} FaultClient;
|
||||
/* 0x00 */ struct FaultClient* next;
|
||||
/* 0x04 */ u32 callback;
|
||||
/* 0x08 */ u32 param1;
|
||||
/* 0x0C */ u32 param2;
|
||||
} FaultClient; // size = 0x10
|
||||
|
||||
typedef struct FaultAddrConvClient {
|
||||
struct FaultAddrConvClient* next;
|
||||
u32 callback;
|
||||
u32 param;
|
||||
} FaultAddrConvClient;
|
||||
/* 0x00 */ struct FaultAddrConvClient* next;
|
||||
/* 0x04 */ u32 callback;
|
||||
/* 0x08 */ u32 param;
|
||||
} FaultAddrConvClient; // size = 0xC
|
||||
|
||||
|
||||
typedef struct {
|
||||
u32 (*callback)(u32, u32);
|
||||
u32 param0;
|
||||
u32 param1;
|
||||
u32 ret;
|
||||
OSMesgQueue* queue;
|
||||
OSMesg msg;
|
||||
} FaultClientContext;
|
||||
/* 0x00 */ u32 (*callback)(u32, u32);
|
||||
/* 0x04 */ u32 param0;
|
||||
/* 0x08 */ u32 param1;
|
||||
/* 0x0C */ u32 ret;
|
||||
/* 0x10 */ OSMesgQueue* queue;
|
||||
/* 0x14 */ OSMesg msg;
|
||||
} FaultClientContext; // size = 0x18
|
||||
|
||||
typedef struct FaultThreadStruct {
|
||||
OSThread thread;
|
||||
u8 unk_1B0[0x600];
|
||||
OSMesgQueue queue;
|
||||
OSMesg msg;
|
||||
u8 exitDebugger;
|
||||
u8 msgId;
|
||||
u8 faultHandlerEnabled;
|
||||
u8 faultActive;
|
||||
OSThread* faultedThread;
|
||||
void(*padCallback)(Input*);
|
||||
FaultClient* clients;
|
||||
FaultAddrConvClient* addrConvClients;
|
||||
u8 unk_7E0[4];
|
||||
Input padInput;
|
||||
u16 colors[36];
|
||||
void* fb;
|
||||
u32 currClientThreadSp;
|
||||
u8 unk_84C[4];
|
||||
} FaultThreadStruct;
|
||||
/* 0x000 */ OSThread thread;
|
||||
/* 0x1B0 */ u8 unk_1B0[0x600];
|
||||
/* 0x7B0 */ OSMesgQueue queue;
|
||||
/* 0x7C8 */ OSMesg msg;
|
||||
/* 0x7CC */ u8 exitDebugger;
|
||||
/* 0x7CD */ u8 msgId;
|
||||
/* 0x7CE */ u8 faultHandlerEnabled;
|
||||
/* 0x7CF */ u8 faultActive;
|
||||
/* 0x7D0 */ OSThread* faultedThread;
|
||||
/* 0x7D4 */ void(*padCallback)(Input*);
|
||||
/* 0x7D8 */ FaultClient* clients;
|
||||
/* 0x7DC */ FaultAddrConvClient* addrConvClients;
|
||||
/* 0x7E0 */ u8 unk_7E0[4];
|
||||
/* 0x7E4 */ Input padInput;
|
||||
/* 0x7FC */ u16 colors[36];
|
||||
/* 0x844 */ void* fb;
|
||||
/* 0x848 */ u32 currClientThreadSp;
|
||||
/* 0x84C */ u8 unk_84C[4];
|
||||
} FaultThreadStruct; // size = 0x850
|
||||
|
||||
typedef struct {
|
||||
u16* fb;
|
||||
u16 w;
|
||||
u16 h;
|
||||
u16 yStart;
|
||||
u16 yEnd;
|
||||
u16 xStart;
|
||||
u16 xEnd;
|
||||
u16 foreColor;
|
||||
u16 backColor;
|
||||
u16 cursorX;
|
||||
u16 cursorY;
|
||||
u32* fontData;
|
||||
u8 charW;
|
||||
u8 charH;
|
||||
s8 charWPad;
|
||||
s8 charHPad;
|
||||
u16 printColors[10];
|
||||
u8 escCode; // bool
|
||||
u8 osSyncPrintfEnabled;
|
||||
void(*inputCallback)();
|
||||
} FaultDrawer;
|
||||
/* 0x00 */ u16* fb;
|
||||
/* 0x04 */ u16 w;
|
||||
/* 0x08 */ u16 h;
|
||||
/* 0x0A */ u16 yStart;
|
||||
/* 0x0C */ u16 yEnd;
|
||||
/* 0x0E */ u16 xStart;
|
||||
/* 0x10 */ u16 xEnd;
|
||||
/* 0x12 */ u16 foreColor;
|
||||
/* 0x14 */ u16 backColor;
|
||||
/* 0x14 */ u16 cursorX;
|
||||
/* 0x16 */ u16 cursorY;
|
||||
/* 0x18 */ u32* fontData;
|
||||
/* 0x1C */ u8 charW;
|
||||
/* 0x1D */ u8 charH;
|
||||
/* 0x1E */ s8 charWPad;
|
||||
/* 0x1F */ s8 charHPad;
|
||||
/* 0x20 */ u16 printColors[10];
|
||||
/* 0x34 */ u8 escCode; // bool
|
||||
/* 0x35 */ u8 osSyncPrintfEnabled;
|
||||
/* 0x38 */ void(*inputCallback)();
|
||||
} FaultDrawer; // size = 0x3C
|
||||
|
||||
typedef struct GfxPrint {
|
||||
/* 0x00 */ struct GfxPrint*(*callback)(struct GfxPrint*, const char*, size_t);
|
||||
@@ -1255,9 +1255,9 @@ typedef struct {
|
||||
} ISVDbg;
|
||||
|
||||
typedef struct {
|
||||
char name[0x18];
|
||||
u32 mediaFormat;
|
||||
union {
|
||||
/* 0x00 */ char name[0x18];
|
||||
/* 0x18 */ u32 mediaFormat;
|
||||
/* 0x1C */ union {
|
||||
struct {
|
||||
u16 cartId;
|
||||
u8 countryCode;
|
||||
@@ -1265,15 +1265,15 @@ typedef struct {
|
||||
};
|
||||
u32 regionInfo;
|
||||
};
|
||||
} LocaleCartInfo;
|
||||
} LocaleCartInfo; // size = 0x20
|
||||
|
||||
typedef struct {
|
||||
char magic[4]; // Yaz0
|
||||
u32 decSize;
|
||||
u32 compInfoOffset; // only used in yaz0_old.c
|
||||
u32 uncompDataOffset; // only used in yaz0_old.c
|
||||
u32 data[1];
|
||||
} Yaz0Header;
|
||||
/* 0x00 */ char magic[4]; // Yaz0
|
||||
/* 0x04 */ u32 decSize;
|
||||
/* 0x08 */ u32 compInfoOffset; // only used in yaz0_old.c
|
||||
/* 0x0C */ u32 uncompDataOffset; // only used in yaz0_old.c
|
||||
/* 0x10 */ u32 data[1];
|
||||
} Yaz0Header; // size = 0x10 ("data" is not part of the header)
|
||||
|
||||
#define OS_SC_RETRACE_MSG 1
|
||||
#define OS_SC_DONE_MSG 2
|
||||
@@ -1281,13 +1281,13 @@ typedef struct {
|
||||
#define OS_SC_PRE_NMI_MSG 4
|
||||
|
||||
typedef struct {
|
||||
short type;
|
||||
char misc[30];
|
||||
} OSScMsg;
|
||||
/* 0x00 */ s16 type;
|
||||
/* 0x02 */ char misc[0x1E];
|
||||
} OSScMsg; // size = 0x20
|
||||
|
||||
typedef struct IrqMgrClient {
|
||||
struct IrqMgrClient* prev;
|
||||
OSMesgQueue* queue;
|
||||
/* 0x00 */ struct IrqMgrClient* prev;
|
||||
/* 0x04 */ OSMesgQueue* queue;
|
||||
} IrqMgrClient;
|
||||
|
||||
typedef struct {
|
||||
@@ -1446,4 +1446,55 @@ typedef struct {
|
||||
/* 0x18 */ f32 yScale;
|
||||
} CfbInfo; // size = 0x1C
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u16 table[8*8];
|
||||
} JpegQuantizationTable; // size = 0x80
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 codeOffs[16];
|
||||
/* 0x10 */ u16 codesA[16];
|
||||
/* 0x30 */ u16 codesB[16];
|
||||
/* 0x50 */ u8* symbols;
|
||||
} JpegHuffmanTable; // size = 0x54
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 unk_00;
|
||||
/* 0x04 */ u32 unk_04;
|
||||
/* 0x08 */ u32 unk_08;
|
||||
/* 0x0C */ u32 qTablePtrs[3];
|
||||
/* 0x18 */ char unk_18[0x8];
|
||||
} JpegTaskData; // size = 0x20
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ JpegTaskData taskData;
|
||||
/* 0x020 */ char yieldData[0x200];
|
||||
/* 0x220 */ JpegQuantizationTable qTables[3];
|
||||
/* 0x3A0 */ u8 codesLenghts[0x110];
|
||||
/* 0x4B0 */ u16 codes[0x108];
|
||||
/* 0x6C0 */ u16 unk_6C0[4][0x180];
|
||||
} JpegWork; // size = 0x12C0
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ void* imageData;
|
||||
/* 0x04 */ u8 unk_04;
|
||||
/* 0x05 */ u8 unk_05;
|
||||
/* 0x08 */ JpegHuffmanTable* hTablePtrs[4];
|
||||
/* 0x18 */ u8 unk_18;
|
||||
} JpegDecoder; // size = 0x1C
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 dqtCount;
|
||||
/* 0x04 */ u8* dqtPtr[3];
|
||||
/* 0x10 */ u8 dhtCount;
|
||||
/* 0x14 */ u8* dhtPtr[4];
|
||||
/* 0x24 */ void* imageData;
|
||||
/* 0x28 */ u32 unk_28; // 0 if Y V0 is 0 and 2 if Y V0 is 2
|
||||
/* 0x2C */ char unk_2C[4];
|
||||
/* 0x30 */ OSScTask scTask;
|
||||
/* 0x88 */ char unk_88[0x10];
|
||||
/* 0x98 */ OSMesgQueue mq;
|
||||
/* 0xB0 */ OSMesg msg;
|
||||
/* 0xB4 */ JpegWork* workBuf;
|
||||
} JpegContext; // size = 0xB8
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user