From 6d315fa2aea31b56edeebc7f754211ffefc0d44e Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Sun, 12 May 2024 10:08:52 -0700 Subject: Use Romfile in place of vromStart and vromEnd in structs (#1618) * DmaEntry * KaleidoMgrOverlay * ActorOverlay * EffectSsOverlay * GameStateOverlay * TransitionOverlay --- include/romfile.h | 19 +++++++++++++++++++ include/segment_symbols.h | 9 ++------- include/z64actor_dlftbls.h | 3 +-- include/z64dma.h | 10 +++------- include/z64effect_ss.h | 4 ++-- include/z64game.h | 4 ++-- include/z64pause_menu.h | 4 ++-- include/z64transition.h | 5 +++-- 8 files changed, 34 insertions(+), 24 deletions(-) create mode 100644 include/romfile.h (limited to 'include') diff --git a/include/romfile.h b/include/romfile.h new file mode 100644 index 000000000..0ae0fcc68 --- /dev/null +++ b/include/romfile.h @@ -0,0 +1,19 @@ +#ifndef ROMFILE_H +#define ROMFILE_H + +#include "ultra64.h" +#include "libc/stdint.h" + +typedef struct { + /* 0x00 */ uintptr_t vromStart; + /* 0x04 */ uintptr_t vromEnd; +} RomFile; // size = 0x8 + +#define ROM_FILE(name) \ + { (uintptr_t)_##name##SegmentRomStart, (uintptr_t)_##name##SegmentRomEnd } +#define ROM_FILE_EMPTY(name) \ + { (uintptr_t)_##name##SegmentRomStart, (uintptr_t)_##name##SegmentRomStart } +#define ROM_FILE_UNSET \ + { 0, 0 } + +#endif diff --git a/include/segment_symbols.h b/include/segment_symbols.h index 74d56d031..2c53511b9 100644 --- a/include/segment_symbols.h +++ b/include/segment_symbols.h @@ -4,6 +4,8 @@ #include "libc/stddef.h" #include "PR/ultratypes.h" +#include "romfile.h" + #define DECLARE_SEGMENT(name) \ extern u8 _##name##SegmentStart[]; \ extern u8 _##name##SegmentEnd[]; @@ -34,13 +36,6 @@ #define SEGMENT_BSS_END(segment) (_ ## segment ## SegmentBssEnd) #define SEGMENT_BSS_SIZE(segment) ((uintptr_t)SEGMENT_BSS_END(segment) - (uintptr_t)SEGMENT_BSS_START(segment)) -#define ROM_FILE(name) \ - { SEGMENT_ROM_START(name), SEGMENT_ROM_END(name) } -#define ROM_FILE_EMPTY(name) \ - { SEGMENT_ROM_START(name), SEGMENT_ROM_START(name) } -#define ROM_FILE_UNSET \ - { 0, 0 } - DECLARE_SEGMENT(framebuffer_lo) DECLARE_SEGMENT(boot) diff --git a/include/z64actor_dlftbls.h b/include/z64actor_dlftbls.h index 2a1472d4e..942732576 100644 --- a/include/z64actor_dlftbls.h +++ b/include/z64actor_dlftbls.h @@ -31,8 +31,7 @@ typedef enum AllocType { } AllocType; typedef struct ActorOverlay { - /* 0x00 */ uintptr_t vromStart; - /* 0x04 */ uintptr_t vromEnd; + /* 0x00 */ RomFile file; /* 0x08 */ void* vramStart; /* 0x0C */ void* vramEnd; /* 0x10 */ void* loadedRamAddr; // original name: "allocp" diff --git a/include/z64dma.h b/include/z64dma.h index ff02441c3..b6003823f 100644 --- a/include/z64dma.h +++ b/include/z64dma.h @@ -4,6 +4,8 @@ #include "ultra64.h" #include "unk.h" +#include "romfile.h" + typedef struct { /* 0x00 */ uintptr_t vromAddr; // VROM address (source) /* 0x04 */ void* dramAddr; // DRAM address (destination) @@ -15,14 +17,8 @@ typedef struct { /* 0x1C */ OSMesg notifyMsg; // Completion notification message } DmaRequest; // size = 0x20 -typedef struct RomFile { - /* 0x0 */ uintptr_t vromStart; - /* 0x4 */ uintptr_t vromEnd; -} RomFile; // size = 0x8 - typedef struct { - /* 0x0 */ uintptr_t vromStart; - /* 0x4 */ uintptr_t vromEnd; + /* 0x0 */ RomFile file; /* 0x8 */ uintptr_t romStart; /* 0xC */ uintptr_t romEnd; } DmaEntry; // size = 0x10 diff --git a/include/z64effect_ss.h b/include/z64effect_ss.h index aab6ff7ef..3bf63cfdf 100644 --- a/include/z64effect_ss.h +++ b/include/z64effect_ss.h @@ -6,6 +6,7 @@ #include "color.h" #include "z64math.h" +#include "z64dma.h" #include "z64eff_ss_dead.h" struct Actor; @@ -37,8 +38,7 @@ typedef struct EffectSsInit { } EffectSsInit; // size = 0x8 typedef struct EffectSsOverlay { - /* 0x00 */ uintptr_t vromStart; - /* 0x04 */ uintptr_t vromEnd; + /* 0x00 */ RomFile file; /* 0x08 */ void* vramStart; /* 0x0C */ void* vramEnd; /* 0x10 */ void* loadedRamAddr; diff --git a/include/z64game.h b/include/z64game.h index 462922bd7..42105de75 100644 --- a/include/z64game.h +++ b/include/z64game.h @@ -8,6 +8,7 @@ #include "gamealloc.h" #include "padmgr.h" #include "padutils.h" +#include "romfile.h" #include "tha.h" #include "unk.h" @@ -31,8 +32,7 @@ typedef void (*GameStateFunc)(struct GameState* gameState); typedef struct GameStateOverlay { /* 0x00 */ void* loadedRamAddr; - /* 0x04 */ uintptr_t vromStart; // if applicable - /* 0x08 */ uintptr_t vromEnd; // if applicable + /* 0x04 */ RomFile file; // if applicable /* 0x0C */ void* vramStart; // if applicable /* 0x10 */ void* vramEnd; // if applicable /* 0x14 */ UNK_PTR unk_14; diff --git a/include/z64pause_menu.h b/include/z64pause_menu.h index ec69f1734..fdb63ea10 100644 --- a/include/z64pause_menu.h +++ b/include/z64pause_menu.h @@ -2,6 +2,7 @@ #define Z64PAUSE_MENU_H #include "ultra64.h" +#include "romfile.h" #include "z64math.h" #include "z64view.h" #include "unk.h" @@ -197,8 +198,7 @@ typedef enum KaleidoMgrOverlayType { typedef struct KaleidoMgrOverlay { /* 0x00 */ void* loadedRamAddr; - /* 0x04 */ uintptr_t vromStart; - /* 0x08 */ uintptr_t vromEnd; + /* 0x04 */ RomFile file; /* 0x0C */ void* vramStart; /* 0x10 */ void* vramEnd; /* 0x14 */ uintptr_t offset; // loadedRamAddr - vramStart diff --git a/include/z64transition.h b/include/z64transition.h index 24b15555c..45e92255a 100644 --- a/include/z64transition.h +++ b/include/z64transition.h @@ -6,6 +6,8 @@ #include "libc/stdint.h" #include "unk.h" +#include "romfile.h" + #include "overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h" #include "overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.h" #include "overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.h" @@ -71,8 +73,7 @@ typedef struct TransitionOverlay { } loadInfo; /* 0x04 */ void* vramStart; /* 0x08 */ void* vramEnd; - /* 0x0C */ uintptr_t vromStart; - /* 0x10 */ uintptr_t vromEnd; + /* 0x0C */ RomFile file; /* 0x14 */ TransitionInit* initInfo; /* 0x18 */ size_t size; } TransitionOverlay; -- cgit v1.2.3