Skip to content

Commit

Permalink
Various improvements (#61)
Browse files Browse the repository at this point in the history
* various improvements

* other improvements
  • Loading branch information
Yanis002 authored Oct 14, 2024
1 parent 1a090ef commit 107fc0c
Show file tree
Hide file tree
Showing 26 changed files with 180 additions and 175 deletions.
4 changes: 2 additions & 2 deletions config/oot-e/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ flashGet64 = .text:0x80045150; // type:function size:0x8 scope:local
flashGetBlock = .text:0x80045158; // type:function size:0x108 scope:local
fn_80045260 = .text:0x80045260; // type:function size:0x50
fn_800452B0 = .text:0x800452B0; // type:function size:0x50
fn_80045300 = .text:0x80045300; // type:function size:0x10
flashGetSize = .text:0x80045300; // type:function size:0x10
flashEvent = .text:0x80045310; // type:function size:0x1DC
SetTableTevStages = .text:0x800454EC; // type:function size:0x3B4
SetNumTexGensChans = .text:0x800458A0; // type:function size:0x164
Expand Down Expand Up @@ -1018,7 +1018,7 @@ xlHeapCopy = .text:0x800814EC; // type:function size:0x6C8
xlHeapFill8 = .text:0x80081BB4; // type:function size:0x160
xlHeapFill32 = .text:0x80081D14; // type:function size:0x164
__xlHeapGetFree = .text:0x80081E78; // type:function size:0xB0 scope:local
xlHeapGetFree = .text:0x80081F28; // type:function size:0xC
xlHeapGetHeap1Free = .text:0x80081F28; // type:function size:0xC
xlHeapSetup = .text:0x80081F34; // type:function size:0x13C
xlHeapReset = .text:0x80082070; // type:function size:0x34
xlFileGetSize = .text:0x800820A4; // type:function size:0x78
Expand Down
4 changes: 2 additions & 2 deletions config/oot-j/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ flashGet64 = .text:0x80045150; // type:function size:0x8 scope:local
flashGetBlock = .text:0x80045158; // type:function size:0x108 scope:local
fn_80045260 = .text:0x80045260; // type:function size:0x50
fn_800452B0 = .text:0x800452B0; // type:function size:0x50
fn_80045300 = .text:0x80045300; // type:function size:0x10
flashGetSize = .text:0x80045300; // type:function size:0x10
flashEvent = .text:0x80045310; // type:function size:0x1DC
SetTableTevStages = .text:0x800454EC; // type:function size:0x3B4
SetNumTexGensChans = .text:0x800458A0; // type:function size:0x164
Expand Down Expand Up @@ -1018,7 +1018,7 @@ xlHeapCopy = .text:0x800814BC; // type:function size:0x6C8
xlHeapFill8 = .text:0x80081B84; // type:function size:0x160
xlHeapFill32 = .text:0x80081CE4; // type:function size:0x164
__xlHeapGetFree = .text:0x80081E48; // type:function size:0xB0 scope:local
xlHeapGetFree = .text:0x80081EF8; // type:function size:0xC
xlHeapGetHeap1Free = .text:0x80081EF8; // type:function size:0xC
xlHeapSetup = .text:0x80081F04; // type:function size:0x13C
xlHeapReset = .text:0x80082040; // type:function size:0x34
xlFileGetSize = .text:0x80082074; // type:function size:0x78
Expand Down
4 changes: 2 additions & 2 deletions config/oot-u/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ flashGet64 = .text:0x8004516C; // type:function size:0x8 scope:local
flashGetBlock = .text:0x80045174; // type:function size:0x108 scope:local
fn_80045260 = .text:0x8004527C; // type:function size:0x50
fn_800452B0 = .text:0x800452CC; // type:function size:0x50
fn_80045300 = .text:0x8004531C; // type:function size:0x10
flashGetSize = .text:0x8004531C; // type:function size:0x10
flashEvent = .text:0x8004532C; // type:function size:0x1DC
SetTableTevStages = .text:0x80045508; // type:function size:0x3B4
SetNumTexGensChans = .text:0x800458BC; // type:function size:0x164
Expand Down Expand Up @@ -1018,7 +1018,7 @@ xlHeapCopy = .text:0x800814C8; // type:function size:0x6C8
xlHeapFill8 = .text:0x80081B90; // type:function size:0x160
xlHeapFill32 = .text:0x80081CF0; // type:function size:0x164
__xlHeapGetFree = .text:0x80081E54; // type:function size:0xB0 scope:local
xlHeapGetFree = .text:0x80081F04; // type:function size:0xC
xlHeapGetHeap1Free = .text:0x80081F04; // type:function size:0xC
xlHeapSetup = .text:0x80081F10; // type:function size:0x13C
xlHeapReset = .text:0x8008204C; // type:function size:0x34
xlFileGetSize = .text:0x80082080; // type:function size:0x78
Expand Down
6 changes: 5 additions & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@
def EmulatorLib(lib_name: str, objects: List[Object]) -> Dict[str, Any]:
return {
"lib": lib_name,
"mw_version": "GC/3.0a5",
"mw_versions": {
"oot-j": "GC/3.0a5",
"oot-u": "GC/3.0a5",
"oot-e": "GC/3.0a5",
},
"cflags": [*cflags_base, "-Cpp_exceptions off", "-O4,p", "-enc SJIS"],
"host": False,
"objects": objects,
Expand Down
5 changes: 2 additions & 3 deletions include/emulator/controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ typedef struct Controller {
/* 0x0BC */ s32 unk_BC[PAD_MAX_CONTROLLERS];
/* 0x0CC */ s32 unk_CC[PAD_MAX_CONTROLLERS];
/* 0x0DC */ u32 controllerConfiguration[PAD_MAX_CONTROLLERS][GCN_BTN_COUNT];
/* 0x21C */ s32 unk_21C;
/* 0x21C */ ErrorIndex iString;
/* 0x220 */ s32 unk_220;
/* 0x224 */ s32 unk_224;
/* 0x228 */ u32 unk_228[PAD_MAX_CONTROLLERS];
/* 0x238 */ u32 unk_238[PAD_MAX_CONTROLLERS];
/* 0x248 */ s32 unk_248;
/* 0x24C */ s32 unk_24C;
/* 0x248 */ s64 unk_248;
/* 0x250 */ u8 unk_250[0x20];
/* 0x270 */ u32 unk_270[PAD_MAX_CONTROLLERS];
/* 0x280 */ u32 unk_280[PAD_MAX_CONTROLLERS];
Expand Down
9 changes: 5 additions & 4 deletions include/emulator/errordisplay.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _CODE_800633F8_H
#define _CODE_800633F8_H
#ifndef _ERRORDISPLAY_H
#define _ERRORDISPLAY_H

#include "emulator/banner.h"
#include "emulator/stringtable.h"
Expand Down Expand Up @@ -49,6 +49,7 @@ typedef enum ErrorIndex {
ERROR_BLANK = 11,
// (nothing)
ERROR_NULL = 12,
ERROR_MAX = 12
} ErrorIndex;

typedef struct DisplayFiles {
Expand All @@ -58,7 +59,7 @@ typedef struct DisplayFiles {
} DisplayFiles; // size = 0xC

typedef struct EDString {
/* 0x00 */ struct ErrorDisplay* apStringDraw[ERROR_NULL];
/* 0x00 */ struct ErrorDisplay* apStringDraw[ERROR_MAX];
/* 0x30 */ ErrorIndex iString;
/* 0x34 */ s32 iAction;
} EDString; // size = 0x38
Expand Down Expand Up @@ -107,7 +108,7 @@ void OSFreeToHeap(s32 handle, void* p);
void errorDisplayInit(void);
bool errorDisplayShow(ErrorIndex iString);

extern ErrorDisplay sStringDraw[12];
extern ErrorDisplay sStringDraw[];
extern struct_80174988 lbl_80174988[17];
extern bool lbl_8025D130;
extern s32 lbl_8025D12C;
Expand Down
5 changes: 3 additions & 2 deletions include/emulator/flash.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
#define _FLASH_H

#include "emulator/xlObject.h"
#include "macros.h"
#include "revolution/types.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct Flash {
/* 0x00 */ u32 unk_00;
/* 0x00 */ u32 nFlashSize;
/* 0x04 */ struct Store* pStore;
/* 0x08 */ s32 flashStatus;
/* 0x0C */ s32 flashCommand;
Expand All @@ -20,7 +21,7 @@ typedef struct Flash {

bool fn_80045260(Flash* pFLASH, s32 arg1, void* arg2);
bool fn_800452B0(Flash* pFLASH, s32 arg1, void* arg2);
bool fn_80045300(Flash* pFLASH, u32* arg1);
bool flashGetSize(Flash* pFLASH, u32* pnFlashSize);
bool flashEvent(Flash* pFLASH, s32 nEvent, void* pArgument);

extern _XL_OBJECTTYPE gClassFlash;
Expand Down
2 changes: 1 addition & 1 deletion include/emulator/rom.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ typedef struct Rom {
/* 0x19A74 */ u8 acHeader[64];
/* 0x19AB4 */ u32* anOffsetBlock;
/* 0x19AB8 */ s32 nCountOffsetBlocks;
/* 0x19ABC */ s32 unk_19ABC; // game's segment `boot` checksum?
/* 0x19ABC */ s32 nChecksum;
/* 0x19AC0 */ DVDFileInfo fileInfo;
/* 0x19AFC */ s32 offsetToRom;
} Rom; // size = 0x19B00
Expand Down
13 changes: 8 additions & 5 deletions include/emulator/store.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,26 @@ extern "C" {
#endif

typedef struct Store {
/* 0x00 */ u32 unk_00;
/* 0x08 */ char szFileName[9];
/* 0x00 */ u32 nFileSize;
/* 0x04 */ char szFileName[12];
/* 0x10 */ NANDFileInfo nandFileInfo;
/* 0x9C */ u8* unk_9C;
/* 0xA0 */ SystemRomType eTypeROM;
/* 0xA4 */ s32 unk_A4;
/* 0xA8 */ u32 unk_A8;
/* 0xA8 */ void* unk_A8;
/* 0xAC */ void* unk_AC;
/* 0xB0 */ u32 unk_B0;
/* 0xB4 */ u32 unk_B4;
/* 0xB8 */ u8 unk_B8;
/* 0xB9 */ u8 unk_B9;
/* 0xBA */ u8 unk_BA;
/* 0xBB */ u8 unk_BB;
/* 0xBC */ u32 unk_BC;
/* 0xBC */ union {
NANDResult eResult;
u32 nSize2;
};
/* 0xC0 */ NANDCommandBlock nandCmdBlock;
} Store; // size = 0x178
} Store; // size = 0x188

bool fn_80061770(void** pObject, char* szName, SystemRomType eTypeROM, void* pArgument);
bool storeFreeObject(void** ppObject);
Expand Down
30 changes: 18 additions & 12 deletions include/emulator/stringtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,36 @@ typedef enum StringID {
SID_ERROR_CHOICE_OK = 0xF6C5198F,
SID_ERROR_CHOICE_PRESS_A_TO_RETURN_TO_MENU = 0xBB628DD1,
SID_ERROR_DATA_CORRUPT = 0x14A5B6E2,
SID_ERROR_DVD_STATE_FATAL_ERROR = 0xEBB077F2, // Brawl Demo only
SID_ERROR_DVD_STATE_NO_DISK = 0x3A1F93A8, // Brawl Demo only
SID_ERROR_DVD_STATE_RETRY = 0x25D38BC6, // Brawl Demo only
SID_ERROR_DVD_STATE_WRONG_DISK = 0x7527596C, // Brawl Demo only
SID_ERROR_DVD_STATE_FATAL_ERROR = 0xEBB077F2,
SID_ERROR_DVD_STATE_NO_DISK = 0x3A1F93A8,
SID_ERROR_DVD_STATE_RETRY = 0x25D38BC6,
SID_ERROR_DVD_STATE_WRONG_DISK = 0x7527596C,
SID_ERROR_FATAL = 0x27A3CCC2,
SID_ERROR_GAMECUBE_CONTROLLER_CONNECTED = 0xD6E8882D,
SID_ERROR_INS_INNODE = 0xE136B8C3,
SID_ERROR_INS_SPACE = 0xFBB27B1C,
SID_ERROR_INS_SPACE_PLURAL = 0x92FBDC3E, // Brawl Demo only
SID_ERROR_INS_SPACE_PLURAL = 0x92FBDC3E,
SID_ERROR_MAX_BLOCKS = 0xC0192EA3,
SID_ERROR_MAX_FILES = 0x5D3A795B,
SID_ERROR_NEED_CLASSIC = 0x2F8DCDD7,
SID_ERROR_NO_CONTROLLER = 0x1786067E,
SID_ERROR_NWC24_CORRUPTED_FILE = 0x19C2F27E, // Brawl Demo only
SID_ERROR_NWC24_ERROR_BUFFER = 0xB958D7EE, // Brawl Demo only
SID_ERROR_NWC24_FATAL_ERROR = 0xECC5F9D8, // Brawl Demo only
SID_ERROR_NWC24_SYSTEM_MENU_UPDATE_REQUIRED = 0x0522BEC0, // Brawl Demo only
SID_ERROR_NWC24_UNAVAILABLE = 0xE1347C92, // Brawl Demo only
SID_ERROR_NWC24_CORRUPTED_FILE = 0x19C2F27E,
SID_ERROR_NWC24_ERROR_BUFFER = 0xB958D7EE,
SID_ERROR_NWC24_FATAL_ERROR = 0xECC5F9D8,
SID_ERROR_NWC24_SYSTEM_MENU_UPDATE_REQUIRED = 0x0522BEC0,
SID_ERROR_NWC24_UNAVAILABLE = 0xE1347C92,
SID_ERROR_REMOTE_BATTERY = 0x80E449BF,
SID_ERROR_REMOTE_COMMUNICATION = 0xB35ABA8B,
SID_ERROR_SYS_CORRUPT = 0x57D16861,
SID_ERROR_TIME_UP_OF_THE_TRIAL_VER = 0xA2B7EF38, // Brawl Demo only
SID_ERROR_TIME_UP_OF_THE_TRIAL_VER = 0xA2B7EF38,
SID_COMMENT_GAME_NAME = 0x30690AFB,
SID_COMMENT_EMPTY = 0x30690AFD
SID_COMMENT_EMPTY = 0x30690AFD,
SID_ERROR_PHOTO_ALREADY_POSTED = 0x4016043D,
SID_ERROR_PHOTO_CANT_POST = 0xB93DC9EA,
SID_ERROR_PHOTO_POSTED = 0x24B1085E,
SID_ERROR_SYS_CORRUPT_REDOWNLOAD = 0x3D24B5C1,
SID_ERROR_SYS_MEM_CANT_ACCESS = 0xE46954BD,
SID_ERROR_SYS_MEM_CANT_ACCESS_2 = 0xEE30A5E0,
} StringID;

typedef struct STEntry {
Expand Down
9 changes: 4 additions & 5 deletions include/emulator/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ typedef struct SystemException {
/* 0x00 */ char* szType;
/* 0x04 */ u32 nMask;
/* 0x08 */ CpuExceptionCode eCode;
/* 0x10 */ MIInterruptType eTypeMips;
/* 0x0C */ SystemInterruptType eType;
/* 0x0C */ MIInterruptType eTypeMips;
/* 0x10 */ SystemInterruptType eType;
} SystemException; // size = 0x14

typedef struct System {
Expand All @@ -270,10 +270,9 @@ typedef struct System {
/* 0x08 */ SystemObjectType storageDevice;
/* 0x0C */ SystemRomType eTypeROM;
/* 0x10 */ void* apObject[SOT_COUNT];
/* 0x6C */ s32 unk_6C;
/* 0x6C */ struct Store* unk_6C;
/* 0x70 */ u64 nAddressBreak;
/* 0x78 */ s32 unk_78[19];
/* 0xC4 */ void* pSound;
/* 0x78 */ CpuBlock aBlock[4];
/* 0xC8 */ u8 anException[16];
} System; // size = 0xD8

Expand Down
2 changes: 1 addition & 1 deletion include/emulator/xlHeap.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ bool xlHeapFree(void** ppHeap);
bool xlHeapCopy(void* pHeapTarget, void* pHeapSource, s32 nByteCount);
bool xlHeapFill8(void* pHeap, s32 nByteCount, u32 nData);
bool xlHeapFill32(void* pHeap, s32 nByteCount, u32 nData);
bool xlHeapGetFree(s32* pnFreeBytes);
bool xlHeapGetHeap1Free(s32* pnFreeBytes);
bool xlHeapSetup(void);
bool xlHeapReset(void);

Expand Down
4 changes: 4 additions & 0 deletions include/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ extern "C" {
#define ROUND_DOWN_PTR(x, align) ((void*)(((u32)(x)) & (~((align) - 1))))
#define MEMCLR(x) __memclr((x), sizeof(*(x)))

#ifndef __INTELLISENSE__
#define NO_INLINE __attribute__((never_inline))
#else
#define NO_INLINE
#endif

#define __CONCAT(x, y) x##y
#define CONCAT(x, y) __CONCAT(x, y)
Expand Down
28 changes: 14 additions & 14 deletions include/revolution/nand/nand.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,27 @@ typedef enum {
typedef void (*NANDAsyncCallback)(s32 result, struct NANDCommandBlock* block);

typedef struct NANDStatus {
/* 0x0 */ u32 ownerId;
/* 0x4 */ u16 groupId;
/* 0x6 */ u8 attr;
/* 0x7 */ u8 perm;
} NANDStatus;
/* 0x00 */ u32 ownerId;
/* 0x04 */ u16 groupId;
/* 0x06 */ u8 attr;
/* 0x07 */ u8 perm;
} NANDStatus; // size = 0x8

typedef struct NANDFileInfo {
/* 0x0 */ s32 fd;
/* 0x4 */ s32 tempFd;
/* 0x8 */ char openPath[FS_MAX_PATH];
/* 0x00 */ s32 fd;
/* 0x04 */ s32 tempFd;
/* 0x08 */ char openPath[FS_MAX_PATH];
/* 0x48 */ char tempPath[FS_MAX_PATH];
/* 0x88 */ u8 access;
/* 0x89 */ u8 stage;
/* 0x8A */ u8 mark;
} NANDFileInfo;
} NANDFileInfo; // size = 0x8C

typedef struct NANDCommandBlock {
/* 0x0 */ void* userData;
/* 0x4 */ NANDAsyncCallback callback;
/* 0x8 */ NANDFileInfo* info;
/* 0xC */ void* bytes;
/* 0x00 */ void* userData;
/* 0x04 */ NANDAsyncCallback callback;
/* 0x08 */ NANDFileInfo* info;
/* 0x0C */ void* bytes;
/* 0x10 */ void* inodes;
/* 0x14 */ NANDStatus* status;
/* 0x18 */ u32 ownerId;
Expand Down Expand Up @@ -126,7 +126,7 @@ typedef struct NANDCommandBlock {
/* 0xAC */ u32 workBlocks;
/* 0xB0 */ u32 workInodes;
/* 0xB4 */ const char** dir;
} NANDCommandBlock;
} NANDCommandBlock; // size = 0xB8

typedef struct NANDBanner {
/* 0x0 */ u32 magic;
Expand Down
Loading

0 comments on commit 107fc0c

Please sign in to comment.