start Pal WIP

This commit is contained in:
Banjo Kazooie 2024-09-04 01:30:42 -05:00
parent 98e97f4e95
commit 06e1330e71
17 changed files with 2936 additions and 188 deletions

View File

@ -166,7 +166,7 @@ OPT_FLAGS := -O2
MIPSBIT := -mips2
ASFLAGS := -EB -mtune=vr4300 -march=vr4300 -mabi=32 -I include
GCC_ASFLAGS := -c -x assembler-with-cpp -mabi=32 -ffreestanding -mtune=vr4300 -march=vr4300 -mfix4300 -G 0 -O -mno-shared -fno-PIC -mno-abicalls
LDFLAGS := -T $(LD_SCRIPT) -Map $(ELF:.elf=.map) --no-check-sections --accept-unknown-input-arch -T manual_syms.txt
LDFLAGS := -T $(LD_SCRIPT) -Map $(ELF:.elf=.map) --no-check-sections --accept-unknown-input-arch -T manual_syms.$(VERSION).txt
BINOFLAGS := -I binary -O elf32-tradbigmips
### Rules ###
@ -186,10 +186,17 @@ $(addprefix progress-,$(OVERLAYS)) : progress-% : progress/progress.%.csv
@$(PROGRESS_READ) $< $(VERSION) $*
# Verify that the roms match, also sets up diff_settings
ifeq ($(VERSION), us.v10)
verify: $(BASEROM) $(FINAL_Z64)
@$(DIFF) $(BASEROM) $(FINAL_Z64) > /dev/null && \
$(PRINT) "$(YELLOW) _\n _( )_\n [ ]_\n ) _ _)\n [_( )_]\n$(BLUE)$(BASENAME).$(VERSION).z64$(NO_COL): $(GREEN)OK$(NO_COL)\n" || \
$(PRINT) "$(BLUE)$(BASEROM) $(RED)differs$(NO_COL)\n"
else
verify: $(DECOMPRESSED_BASEROM) $(PRELIM_Z64)
@$(DIFF) $^ > /dev/null && \
$(PRINT) "$(YELLOW) _\n _( )_\n [ ]_\n ) _ _)\n [_( )_]\n$(BLUE)$(BASENAME).$(VERSION).z64$(NO_COL): $(GREEN)OK$(NO_COL)\n" || \
$(PRINT) "$(BLUE)$(BASEROM) $(RED)differs$(NO_COL)\n"
endif
$(OVERLAY_PROG_SVGS) : progress/progress_%.svg: progress/progress.%.csv
$(call print1,Creating progress svg for:,$*)
@ -293,8 +300,12 @@ $(ASSET_ROOT)/assets.yaml : $(BIN_ROOT)/assets.bin $(BK_ASSET_TOOL)
$(call print1,Extracting Assets:,$@)
$(BK_ASSET_TOOL) -e $< $(ASSET_ROOT)
# .yaml -> .bin
ifneq (,$(shell which cargo))
# .yaml -> .
ifeq ($(VERSION),pal)
$(ASSET_BIN): $(BIN_ROOT)/assets.bin
$(call print2,Copying Asset Binary (install cargo to construct instead):,$<,$@)
@$(CP) $< $@
else ifneq (,$(shell which cargo))
$(ASSET_BIN): $(ASSET_ROOT)/assets.yaml $(BK_ASSET_TOOL) $(ALL_ASSET_FILES)
$(call print2,Constructing Asset Binary:,$<,$@)
$(BK_ASSET_TOOL) -c $< $@
@ -316,7 +327,7 @@ $(DECOMPRESSED_BASEROM): $(BASEROM) $(BK_ROM_DECOMPRESS)
# .o -> .elf (dummy symbols)
$(PRELIM_ELF): $(ALL_OBJS) $(LD_SCRIPT) $(ASSET_OBJS)
$(call print1,Linking elf:,$@)
@$(LD) $(LDFLAGS) -T rzip_dummy_addrs.txt -o $@
@$(LD) $(LDFLAGS) -T rzip_dummy_addrs.$(VERSION).txt -o $@
# .elf -> .z64 (dummy symbols)
$(PRELIM_Z64) : $(PRELIM_ELF)

View File

@ -1,57 +0,0 @@
.include "macro.inc"
/* assembler directives */
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
.set gp=64 /* allow use of 64-bit general purpose registers */
.section .text, "ax"
glabel func_8025C240
/* F37A70 8025C240 3C048027 */ lui $a0, %hi(D_80276E70)
/* F37A74 8025C244 DC846E70 */ ld $a0, %lo(D_80276E70)($a0)
/* F37A78 8025C248 3C018027 */ lui $at, %hi(D_80276E70)
/* F37A7C 8025C24C 000437FC */ dsll32 $a2, $a0, 31
/* F37A80 8025C250 00042FF8 */ dsll $a1, $a0, 31
/* F37A84 8025C254 000637FA */ dsrl $a2, $a2, 31
/* F37A88 8025C258 0005283E */ dsrl32 $a1, $a1, 0
/* F37A8C 8025C25C 0004233C */ dsll32 $a0, $a0, 12
/* F37A90 8025C260 00C53025 */ or $a2, $a2, $a1
/* F37A94 8025C264 0004203E */ dsrl32 $a0, $a0, 0
/* F37A98 8025C268 00C43026 */ xor $a2, $a2, $a0
/* F37A9C 8025C26C 0006253A */ dsrl $a0, $a2, 20
/* F37AA0 8025C270 30840FFF */ andi $a0, $a0, 0xFFF
/* F37AA4 8025C274 00862026 */ xor $a0, $a0, $a2
/* F37AA8 8025C278 0004103C */ dsll32 $v0, $a0, 0
/* F37AAC 8025C27C FC246E70 */ sd $a0, %lo(D_80276E70)($at)
/* F37AB0 8025C280 03E00008 */ jr $ra
/* F37AB4 8025C284 0002103F */ dsra32 $v0, $v0, 0
endlabel func_8025C240
glabel func_8025C288
/* F37AB8 8025C288 64840001 */ daddiu $a0, $a0, 0x1
/* F37ABC 8025C28C 3C018027 */ lui $at, %hi(D_80276E70)
/* F37AC0 8025C290 FC246E70 */ sd $a0, %lo(D_80276E70)($at)
/* F37AC4 8025C294 03E00008 */ jr $ra
/* F37AC8 8025C298 24040000 */ addiu $a0, $zero, 0x0
endlabel func_8025C288
glabel func_8025C29C
/* F37ACC 8025C29C DC870000 */ ld $a3, 0x0($a0)
/* F37AD0 8025C2A0 000737FC */ dsll32 $a2, $a3, 31
/* F37AD4 8025C2A4 00072FF8 */ dsll $a1, $a3, 31
/* F37AD8 8025C2A8 000637FA */ dsrl $a2, $a2, 31
/* F37ADC 8025C2AC 0005283E */ dsrl32 $a1, $a1, 0
/* F37AE0 8025C2B0 00073B3C */ dsll32 $a3, $a3, 12
/* F37AE4 8025C2B4 00C53025 */ or $a2, $a2, $a1
/* F37AE8 8025C2B8 0007383E */ dsrl32 $a3, $a3, 0
/* F37AEC 8025C2BC 00C73026 */ xor $a2, $a2, $a3
/* F37AF0 8025C2C0 00063D3A */ dsrl $a3, $a2, 20
/* F37AF4 8025C2C4 30E70FFF */ andi $a3, $a3, 0xFFF
/* F37AF8 8025C2C8 00E63826 */ xor $a3, $a3, $a2
/* F37AFC 8025C2CC 0007103C */ dsll32 $v0, $a3, 0
/* F37B00 8025C2D0 FC870000 */ sd $a3, 0x0($a0)
/* F37B04 8025C2D4 03E00008 */ jr $ra
/* F37B08 8025C2D8 0002103F */ dsra32 $v0, $v0, 0
/* F37B0C 8025C2DC 00000000 */ nop
endlabel func_8025C29C

2375
decompressed.pal.yaml Normal file

File diff suppressed because it is too large Load Diff

50
include/version.h Normal file
View File

@ -0,0 +1,50 @@
#ifndef __BANJO_KAZOOIE_VERSION_H__
#define __BANJO_KAZOOIE_VERSION_H__
//These values of `VERSION` match the values defined via the Makefile
#define VERSION_USA_1_0 0
#define VERSION_PAL 1
#define VERSION_USA_1_1 2
#define VERSION_JP 3
#if VERSION == VERSION_USA_1_0
#define USA10_EXCLUSIVE(body) body
#else
#define USA10_EXCLUSIVE(body)
#endif
#if VERSION == VERSION_PAL
#define PAL_EXCLUSIVE(body) body
#else
#define PAL_EXCLUSIVE(body)
#endif
#if VERSION == VERSION_USA_1_1
#define USA11_EXCLUSIVE(body) body
#else
#define USA11_EXCLUSIVE(body)
#endif
#if VERSION == VERSION_JP
#define JP_EXCLUSIVE(body) body
#else
#define JP_EXCLUSIVE(body)
#endif
#if VERSION == VERSION_USA_1_0
#define VER_SELECT(usa0, pal, usa1, jp) usa0
#elif VERSION == VERSION_PAL
#define VER_SELECT(usa0, pal, usa1, jp) pal
#elif VERSION == VERSION_USA_1_1
#define VER_SELECT(usa0, pal, usa1, jp) usa1
#elif VERSION == VERSION_JP
#define VER_SELECT(usa0, pal, usa1, jp) jp
#endif
#if VERSION == VERSION_PAL
#define FRAMERATE 50
#else
#define FRAMERATE 60
#endif
#endif // __BANJO_KAZOOIE_VERSION_H__

177
manual_syms.pal.txt Normal file
View File

@ -0,0 +1,177 @@
/* Microcode renames to match ucode.h names */
/*
n_aspMainTextStart = _binary_bin_core1_n_aspMain_text_bin_start;
n_aspMainTextEnd = _binary_bin_core1_n_aspMain_text_bin_end;
gSPF3DEX_fifoTextStart = _binary_bin_core1_gSPF3DEX_fifo_text_bin_start;
gSPF3DEX_fifoTextEnd = _binary_bin_core1_gSPF3DEX_fifo_text_bin_end;
gSPL3DEX_fifoTextStart = _binary_bin_core1_gSPL3DEX_fifo_text_bin_start;
gSPL3DEX_fifoTextEnd = _binary_bin_core1_gSPL3DEX_fifo_text_bin_end;
n_aspMainDataStart = _binary_bin_core1_n_aspMain_data_bin_start;
n_aspMainDataEnd = _binary_bin_core1_n_aspMain_data_bin_end;
gSPF3DEX_fifoDataStart = _binary_bin_core1_gSPF3DEX_fifo_data_bin_start;
gSPF3DEX_fifoDataEnd = _binary_bin_core1_gSPF3DEX_fifo_data_bin_end;
gSPL3DEX_fifoDataStart = _binary_bin_core1_gSPL3DEX_fifo_data_bin_start;
gSPL3DEX_fifoDataEnd = _binary_bin_core1_gSPL3DEX_fifo_data_bin_end;
*/
/* Fixed-address buffers */
D_8000E800 = 0x8000E800;
D_8002D500 = 0x8002D500;
D_8023DA00 = 0x8023DA00; /* confirm */
func_8023DA20 = 0x8023E620;
D_803FBE00 = 0x803FBE00;
D_803FFE00 = 0x803FFE00;
D_803FFE10 = 0x803FFE10;
gOverlayTable = 0x803FFE10;
D_803A5D00 = 0x803A5D00; /* framebuffers */
/* Renames for the boot segment */
boot_D_8002D500 = D_8002D500;
boot_core1_VRAM = core1_VRAM;
boot_D_803FBE00 = D_803FBE00;
boot_D_803FFE00 = D_803FFE00;
boot_gOverlayTable = gOverlayTable;
boot_func_8023DA20 = func_8023DA20;
/* Temporary Correct*/
D_80000300 = 0x80000300;
func_8024BE30 = 0x8024BAC0;
func_8024C428 = 0x8024C078;
viewport_get_position_vec3f = 0x8024c21c;
veiwport_get_position_vec3w = 0x8024c240;
viewport_get_rotation_vec3f = 0x8024c3b4;
func_8024E71C = 0x8024e36c;
pfsManager_update = 0x8024e418;
pfsManager_init = 0x8024ecac;
musicInstruments_init = 0x8024f130;
func_80250650 = 0x802502a0;
rumbleManager_80250C08 = 0x80250858;
rumbleManager_init = 0x802508d4;
overlayManagerloadCore2 = 0x80250f58;
func_802535A8 = 0x802531f8;
func_80254008 = 0x80253c58;
func_80254028 = 0x80253c78;
func_8025425C = 0x80253eac;
heap_init = 0x80254360;
malloc = 0x802548f8;
free = 0x80254d40;
func_80255198 = 0x80254de8;
func_80255524 = 0x80255174;
func_80255ACC = 0x8025571c;
write_file_blocks = 0x80255780;
func_80255C30 = 0x80255880;
func_80255CD8 = 0x80255928;
func_80255D44 = 0x80255994;
ml_dotProduct_vec3f = 0x80255c84;
ml_distance_vec3f = 0x80255cb4;
ml_vec3f_normalize_copy = 0x80256008;
ml_vec3f_normalize = 0x802560a0;
ml_vec3f_set_length_copy = 0x80256230;
ml_vec3f_yaw_rotate_copy = 0x80256550;
ml_init = 0x80257074;
ml_sin_deg = 0x8025840c;
ml_cos_deg = 0x8025843c;
ml_vec3f_copy = 0x802587f4;
ml_vec3f_diff_copy = 0x80258810;
ml_vec3f_diff = 0x80258844;
ml_vec3f_add = 0x80258898;
func_8025AFB0 = 0x8025AC00;
sns_find_and_parse_payload = 0x8025ae30;
sns_write_payload_over_heap = 0x8025b350;
DEBUG_use_special_bootmap = 0x8025b460;
n_alInit = 0x8025bf70;
n_alAudioFrame = 0x8025c118;
alEvtqPostEvent = 0x8025ca4c;
alEvtqNextEvent = 0x8025cb70;
alEvtqNew = 0x8025cbfc;
n_alSynAddSndPlayer = 0x8025cd80;
n_alSynAllocVoice = 0x8025ce58;
n_alSynSetVol = 0x8025d050;
n_alSynStartVoice = 0x8025d0f0;
n_alSynSetPan = 0x8025d170;
n_alSynSetPitch = 0x8025d1f0;
n_alSynSetFXMix = 0x8025d270;
n_alSynStopVoice = 0x8025d300;
n_alSynFreeVoice = 0x8025d370;
bzero = 0x80263790;
osWriteBackDCacheAll = 0x80263830;
__osInitialize_common = 0x80263860;
osCreateThread = 0x80263b50;
sinf = 0x80263ca0;
guMtxIdentF = 0x80264e30;
alCents2Ratio = 0x80263e60;
alHeapInit = 0x80263eb0;
osCreateMesgQueue = 0x80263ef0;
osAiSetFrequency = 0x80263f20;
alUnlink = 0x80264080;
alLink = 0x802640b0;
alHeapDBAlloc = 0x80264140;
osRecvMesg = 0x802641a0;
osAiGetLength = 0x802642e0;
osVirtualToPhysical = 0x802642f0;
osAiSetNextBuffer = 0x80264370;
osPiStartDma = 0x80264420;
osStopThread = 0x80264530;
osStartThread = 0x802645f0;
osWritebackDCache = 0x80264740;
osInvalDCache = 0x802647C0;
osCreatePiManager = 0x80264870;
osDestroyThread = 0x80264a00;
osSendMesg = 0x80264b00;
osSetThreadPri = 0x80264c50;
guMtxF2L = 0x80264d30;
gu_sqrtf = 0x80264fa0;
cosf = 0x80264fb0;
osSetIntMask = 0x80265120;
framebuffer_width = 0x802762d8;
framebuffer_height = 0x802762dc;
n_syn = 0x80276bd4;
osViClock = 0x80276e78;
core2_TEXT_START = 0x80286db0;
spawnQueue_func_802C3A18 = 0x802C3898;
spawnQueue_flush = 0x802c38b8;
mapSpecificFlags_validateCRC1 = 0x802cb1cc;
func_802E3580 = 0x802E3770;
func_802E35D0 = 0x802E37C0;
func_802E35D8 = 0x802E37c8;
func_802E3F8C = 0x802E417c;
func_802E4170 = 0x802E4360;
func_802E4214 = 0x802E4404;
func_802E4424 = 0x802E4614;
game_defrag = 0x802e4ac8;
getGameMode = 0x802e4bec;
func_80309B48 = 0x80309ce8;
gctransition_reset = 0x8030c07c;
func_8030D90C = 0x8030daac;
func_8030DA44 = 0x8030dbe4;
sfxsource_setSfxId = 0x8030dc20;
sfxsource_setSampleRate = 0x8030dc5c;
func_8030DBB4 = 0x8030dd54;
func_8030E2C4 = 0x8030e464;
func_8030E6A4 = 0x8030e844;
func_8030ED70 = 0x8030ef10;
func_8030E394 = 0x8030e534;
func_8031C44C = 0x8031c82c;
func_8031C5AC = 0x8031c98c;
func_8031C5D4 = 0x8031c9b4;
func_8031C618 = 0x8031c9f8;
func_8031C638 = 0x8031ca18;
func_80320240 = 0x80320630;
func_8032056C = 0x8032095C;
func_80320B98 = 0x80320f88;
func_80320C94 = 0x80321084;
func_80320DB0 = 0x803211a0;
levelSpecificFlags_validateCRC1 = 0x8032243c;
func_80323240 = 0x80323690;
marker_getActor = 0x80329db0;
sfxInstruments_init = 0x80335670;
assetCache_init = 0x8033bfd4;
func_8033BD6C = 0x8033C1BC;
time_getDelta = 0x8033e1ec;
func_8033EF58 = 0x8033f3a8;
func_8034C630 = 0x8034ca90;
func_8034E698 = 0x8034eaf8;
/* Temporary */

View File

@ -29,3 +29,4 @@ boot_D_803FBE00 = D_803FBE00;
boot_D_803FFE00 = D_803FFE00;
boot_gOverlayTable = gOverlayTable;
boot_func_8023DA20 = func_8023DA20;

32
rzip_dummy_addrs.pal.txt Normal file
View File

@ -0,0 +1,32 @@
boot_core1_rzip_ROM_START = 0xF3D980;
boot_core1_rzip_ROM_END = 0xF5BEC0;
boot_core2_rzip_ROM_START = 0xF5BEC0;
boot_core2_rzip_ROM_END = 0xFC8460;
boot_CC_rzip_ROM_START = 0xFC8460;
boot_CC_rzip_ROM_END = 0xFCA3C0;
boot_MMM_rzip_ROM_START = 0xFCA3C0;
boot_MMM_rzip_ROM_END = 0xFCD5C0;
boot_GV_rzip_ROM_START = 0xFCD5C0;
boot_GV_rzip_ROM_END = 0xFD2CC0;
boot_TTC_rzip_ROM_START = 0xFD2CC0;
boot_TTC_rzip_ROM_END = 0xFD6900;
boot_MM_rzip_ROM_START = 0xFD6900;
boot_MM_rzip_ROM_END = 0xFD8930;
boot_BGS_rzip_ROM_START = 0xFD8930;
boot_BGS_rzip_ROM_END = 0xFDDE80;
boot_RBB_rzip_ROM_START = 0xFDDE80;
boot_RBB_rzip_ROM_END = 0xFE3060;
boot_FP_rzip_ROM_START = 0xFE3060;
boot_FP_rzip_ROM_END = 0xFE8CA0;
boot_CCW_rzip_ROM_START = 0xFFA830;
boot_CCW_rzip_ROM_END = 0xFFF090;
boot_SM_rzip_ROM_START = 0xFE8CA0;
boot_SM_rzip_ROM_END = 0xFEB540;
boot_cutscenes_rzip_ROM_START = 0xFEB540;
boot_cutscenes_rzip_ROM_END = 0xFED780;
boot_lair_rzip_ROM_START = 0xFED780;
boot_lair_rzip_ROM_END = 0xFF4A50;
boot_fight_rzip_ROM_START = 0xFF4A50;
boot_fight_rzip_ROM_END = 0xFFA830;
boot_emptyLvl_rzip_ROM_START = 0xFFF090;
boot_emptyLvl_rzip_ROM_END = 0xFFF0B0;

View File

@ -1,32 +0,0 @@
boot_core1_us_v10_rzip_ROM_START = 0xF19250;
boot_core1_us_v10_rzip_ROM_END = 0xF37F90;
boot_core2_us_v10_rzip_ROM_START = 0xF37F90;
boot_core2_us_v10_rzip_ROM_END = 0xFA3FD0;
boot_CC_us_v10_rzip_ROM_START = 0xFA3FD0;
boot_CC_us_v10_rzip_ROM_END = 0xFA5F50;
boot_MMM_us_v10_rzip_ROM_START = 0xFA5F50;
boot_MMM_us_v10_rzip_ROM_END = 0xFA9150;
boot_GV_us_v10_rzip_ROM_START = 0xFA9150;
boot_GV_us_v10_rzip_ROM_END = 0xFAE860;
boot_TTC_us_v10_rzip_ROM_START = 0xFAE860;
boot_TTC_us_v10_rzip_ROM_END = 0xFB24A0;
boot_MM_us_v10_rzip_ROM_START = 0xFB24A0;
boot_MM_us_v10_rzip_ROM_END = 0xFB44E0;
boot_BGS_us_v10_rzip_ROM_START = 0xFB44E0;
boot_BGS_us_v10_rzip_ROM_END = 0xFB9A30;
boot_RBB_us_v10_rzip_ROM_START = 0xFB9A30;
boot_RBB_us_v10_rzip_ROM_END = 0xFBEBE0;
boot_FP_us_v10_rzip_ROM_START = 0xFBEBE0;
boot_FP_us_v10_rzip_ROM_END = 0xFC4810;
boot_CCW_us_v10_rzip_ROM_START = 0xFD6190;
boot_CCW_us_v10_rzip_ROM_END = 0xFDAA10;
boot_SM_us_v10_rzip_ROM_START = 0xFC4810;
boot_SM_us_v10_rzip_ROM_END = 0xFC6F20;
boot_cutscenes_us_v10_rzip_ROM_START = 0xFC6F20;
boot_cutscenes_us_v10_rzip_ROM_END = 0xFC9150;
boot_lair_us_v10_rzip_ROM_START = 0xFC9150;
boot_lair_us_v10_rzip_ROM_END = 0xFD0420;
boot_fight_us_v10_rzip_ROM_START = 0xFD0420;
boot_fight_us_v10_rzip_ROM_END = 0xFD6190;
boot_emptyLvl_us_v10_rzip_ROM_START = 0xFDAA10;
boot_emptyLvl_us_v10_rzip_ROM_END = 0xFDAA30;

View File

@ -0,0 +1,32 @@
boot_core1_rzip_ROM_START = 0xF19250;
boot_core1_rzip_ROM_END = 0xF37F90;
boot_core2_rzip_ROM_START = 0xF37F90;
boot_core2_rzip_ROM_END = 0xFA3FD0;
boot_CC_rzip_ROM_START =0xFA3FD0;
boot_CC_rzip_ROM_END = 0xFA5F50;
boot_MMM_rzip_ROM_START = 0xFA5F50;
boot_MMM_rzip_ROM_END = 0xFA9150;
boot_GV_rzip_ROM_START = 0xFA9150;
boot_GV_rzip_ROM_END = 0xFAE860;
boot_TTC_rzip_ROM_START = 0xFAE860;
boot_TTC_rzip_ROM_END = 0xFB24A0;
boot_MM_rzip_ROM_START = 0xFB24A0;
boot_MM_rzip_ROM_END = 0xFB44E0;
boot_BGS_rzip_ROM_START = 0xFB44E0;
boot_BGS_rzip_ROM_END = 0xFB9A30;
boot_RBB_rzip_ROM_START = 0xFB9A30;
boot_RBB_rzip_ROM_END = 0xFBEBE0;
boot_FP_rzip_ROM_START = 0xFBEBE0;
boot_FP_rzip_ROM_END = 0xFC4810;
boot_CCW_rzip_ROM_START = 0xFD6190;
boot_CCW_rzip_ROM_END = 0xFDAA10;
boot_SM_rzip_ROM_START = 0xFC4810;
boot_SM_rzip_ROM_END = 0xFC6F20;
boot_cutscenes_rzip_ROM_START = 0xFC6F20;
boot_cutscenes_rzip_ROM_END = 0xFC9150;
boot_lair_rzip_ROM_START = 0xFC9150;
boot_lair_rzip_ROM_END = 0xFD0420;
boot_fight_rzip_ROM_START = 0xFD0420;
boot_fight_rzip_ROM_END = 0xFD6190;
boot_emptyLvl_rzip_ROM_START = 0xFDAA10;
boot_emptyLvl_rzip_ROM_END = 0xFDAA30;

View File

@ -12,44 +12,44 @@ u8 D_8038BFC2;
int func_8038AAB0(void){return 0;}
#elif VERSION == PAL
void func_8038AAB0(s32 arg0, s32 arg1){
if(arg1 < 0){
func_8031A844();
}
else{
D_8038BFC2 = arg1;
func_8038B4D0(3);
}
}
// void func_8038AAB0(s32 arg0, s32 arg1){
// if(arg1 < 0){
// func_8031A844();
// }
// else{
// D_8038BFC2 = arg1;
// func_8038B4D0(3);
// }
// }
// #pragma GLOBAL_ASM("asm/nonmatchings/SM/code_46C0/func_8038A8F0.s")
void func_8038A8F0(s32 arg0) {
u8 temp_v0;
// void func_8038A8F0(s32 arg0) {
// u8 temp_v0;
switch (arg0) { /* irregular */
case 1:
D_8038BFC1 = 1;
func_80319400();
break;
case 2:
D_8038BFC8->unk0 = (s32) D_8038BD38;
D_8038BFC8->unk4 = (s32) D_8038BD3C;
D_8038BFC8->unk10 = (s32) D_8038BD40;
D_8038BFC8->unk20 = (s32) D_8038BD44;
D_8038BFC8->unk30 = (s32) D_8038BD48;
func_8031A5E4(&D_8038BD30, &D_8038BD34, (void *)0x8038BFC8, 0xA, &D_8038B490);
break;
case 3:
temp_v0 = *(u8 *)0x8038BFC2;
if (temp_v0 != 0) {
func_8031B9A4(temp_v0 - 1, 0x80390000);
}
func_802FAF44(0);
D_8038BFC1 = 0;
break;
}
D_8038BFC0 = (s8) arg0;
}
// switch (arg0) { /* irregular */
// case 1:
// D_8038BFC1 = 1;
// func_80319400();
// break;
// case 2:
// D_8038BFC8->unk0 = (s32) D_8038BD38;
// D_8038BFC8->unk4 = (s32) D_8038BD3C;
// D_8038BFC8->unk10 = (s32) D_8038BD40;
// D_8038BFC8->unk20 = (s32) D_8038BD44;
// D_8038BFC8->unk30 = (s32) D_8038BD48;
// func_8031A5E4(&D_8038BD30, &D_8038BD34, (void *)0x8038BFC8, 0xA, &D_8038B490);
// break;
// case 3:
// temp_v0 = *(u8 *)0x8038BFC2;
// if (temp_v0 != 0) {
// func_8031B9A4(temp_v0 - 1, 0x80390000);
// }
// func_802FAF44(0);
// D_8038BFC1 = 0;
// break;
// }
// D_8038BFC0 = (s8) arg0;
// }
// #pragma GLOBAL_ASM("asm/nonmatchings/SM/code_46C0/func_8038A9E4.s")

View File

@ -1,13 +1,16 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "version.h"
#include "gc/gctransition.h"
void func_8023E00C(enum map_e);
void func_8023DFF0(s32);
#if VERSION == VERSION_PAL
extern s32 D_80000300;
#endif
s32 D_80275610 = 0;
s32 D_80275614 = 0;
@ -16,10 +19,9 @@ u32 D_8027561C[] = {
0x9, 0x4, 0xA, 0x3, 0xB, 0x2, 0xC, 0x5, 0x0,
0x1, 0x6, 0xD, -1
};
u32 D_80275650 = 0xAD019D3C; //SM_DATA_CRC_1
u32 D_80275654 = 0xD381B72F; //SM_DATA_CRC_2
char D_80275658[] = "HjunkDire:218755";
u32 D_80275650 = VER_SELECT(0xAD019D3C, 0xA371A8F3, 0, 0); //SM_DATA_CRC_1
u32 D_80275654 = VER_SELECT(0xD381B72F, 0xD0709154, 0, 0); //SM_DATA_CRC_2
char D_80275658[] = VER_SELECT("HjunkDire:218755", "HjunkDire:300875", "HjunkDire:", "HjunkDire:");
/* .bss */
u32 D_8027A130;
@ -99,6 +101,9 @@ void func_8023DBDC(void){
}
void core1_init(void){
#if VERSION == VERSION_PAL
D_80000300 = 0;
#endif
func_80255C30();
func_8023E00C(func_8023DBA4());
rarezip_init(); //initialize decompressor's huft table

View File

@ -1,9 +1,12 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "version.h"
#include "2.0L/PR/sched.h"
#include "n_libaudio.h"
#define AUDIO_HEAP_SIZE VER_SELECT(0x21000, 0x23A00, 0x21000, 0x21000)
extern void n_alInit(N_ALGlobals *, ALSynConfig *);
typedef struct AudioInfo_s {
@ -144,12 +147,12 @@ struct {
} audioManager;
u8 pad_8027C178[0xE78];
ALHeap D_8027CFF0;
u8 * D_8027D000;
u8 * D_8027D000;
s32 D_8027D004;
OSMesgQueue D_8027D008;
OSMesg D_8027D020[50];
OSMesg D_8027D020[3000/FRAMERATE];
OSIoMesg D_8027D0E8;
Struct_core1_1D00_4 D_8027D100[50];
Struct_core1_1D00_4 D_8027D100[3000/FRAMERATE];
struct {
u8 unk0;
Struct_1D00_3 *unk4;
@ -282,11 +285,16 @@ void func_8023FA64(ALSeqpConfig *arg0) {
}
void audioManager_init(void){
D_8027D000 = (u8 *) malloc(0x21000);
bzero(D_8027D000, 0x21000);
alHeapInit(&D_8027CFF0, D_8027D000, 0x21000);
D_8027D000 = (u8 *) malloc(AUDIO_HEAP_SIZE);
bzero(D_8027D000, AUDIO_HEAP_SIZE);
alHeapInit(&D_8027CFF0, D_8027D000, AUDIO_HEAP_SIZE);
#if VERSION == VERSION_USA_1_0
if(osTvType != OS_TV_NTSC)
osViClock = 0x2e6025c;
#elif VERSION == VERSION_PAL
PAL_EXCLUSIVE(
osViClock = 0x2f5b2d2;
)
audioManager_create();
sfxInstruments_init();
musicInstruments_init();
@ -297,10 +305,10 @@ void audioManager_create(void) {
int i;
f32 var_f0;
osCreateMesgQueue(&D_8027D008, D_8027D020, 50);
osCreateMesgQueue(&D_8027D008, D_8027D020, 3000/FRAMERATE);
osCreateMesgQueue(&audioManager.audioReplyMsgQ, audioManager.audioReplyMsgBuf, 8); //audioReplyMesgQueue
osCreateMesgQueue(&audioManager.audioFrameMsgQ, audioManager.audioFrameMsgBuf, 8);
var_f0 = 733.333313f;
var_f0 = 44000.0f/FRAMERATE;
D_8027DD74 = (s32)var_f0;
if ((f32) D_8027DD74 < var_f0) {
D_8027DD74++;
@ -321,14 +329,14 @@ void audioManager_create(void) {
D_8027D5C0[0].unk0.next = NULL;
for(i = 0; i < 89; i++){
alLink((ALLink *)&D_8027D5C0[i+1], (ALLink *)&D_8027D5C0[i]);
D_8027D5C0[i].unk10 = alHeapDBAlloc(0, 0, D_8027DD50.heap, 1, 0x200);
D_8027D5C0[i].unk10 = alHeapDBAlloc(0, 0, D_8027DD50.heap, 1, VER_SELECT(0x200, 0x270, 0x200, 0x200));
}
D_8027D5C0[i].unk10 = alHeapDBAlloc(0, 0, D_8027DD50.heap, 1, 0x200);
D_8027D5C0[i].unk10 = alHeapDBAlloc(0, 0, D_8027DD50.heap, 1, VER_SELECT(0x200, 0x270, 0x200, 0x200));
for(i = 0; i < 2; i++){
audioManager.ACMDList[i] = malloc(20000);
audioManager.ACMDList[i] = malloc(1200000/FRAMERATE);
}
D_8027DD80 = 2500;
D_8027DD80 = 150000/FRAMERATE;
for(i = 0; i < 3; i++){
audioManager.audioInfo[i] = alHeapDBAlloc(0, 0, D_8027DD50.heap, 1, 0x10);
audioManager.audioInfo[i]->unk8 = 0;
@ -368,7 +376,11 @@ bool audioManager_handleFrameMsg(AudioInfo *info, AudioInfo *prev_info){
s16 *outbuffer;
Acmd *sp38;
s32 sp34;
#if VERSION == VERSION_USA_1_0
s32 sp30 = 0;
#else
s32 sp30;
#endif
f32 pad;
outbuffer = (s16 *)osVirtualToPhysical(info->data);
@ -377,13 +389,15 @@ bool audioManager_handleFrameMsg(AudioInfo *info, AudioInfo *prev_info){
if(prev_info){
sp30 = osAiSetNextBuffer(prev_info->data, prev_info->frameSamples*4);
}//L8024003C
#if VERSION == VERSION_USA_1_0
if(sp30 == -1){
func_80247F24(2, 0x7d2);
func_80247F9C(prev_info->frameSamples);
func_80247F9C(info->frameSamples);
func_802483D8();
}
}
#endif
if((D_80275770 >= 0x139) & !D_80275778){
info->frameSamples = D_8027DD78;
@ -401,12 +415,14 @@ bool audioManager_handleFrameMsg(AudioInfo *info, AudioInfo *prev_info){
sp38 = n_alAudioFrame(audioManager.ACMDList[D_8027DCD0], &sp34, outbuffer, info->frameSamples);
#if VERSION == VERSION_USA_1_0
if(D_8027DD80 < sp34){
func_80247F24(2, 2000);
func_80247F9C(sp34);
func_80247F9C(D_8027DD80);
func_802483D8();
}
#endif
if(sp34 == 0){
return 0;
@ -426,6 +442,7 @@ void audioManager_handleDoneMsg(AudioInfo *info)
}
}
#if VERSION == VERSION_USA_1_0
s32 func_80240204(s32 addr, s32 len, void *state){
void *sp44;
s32 sp40;
@ -479,6 +496,63 @@ s32 func_80240204(s32 addr, s32 len, void *state){
osPiStartDma(&D_8027D100[D_8027DCCC++], 1, 0, addr, sp44, 0x200U, &D_8027D008);
return osVirtualToPhysical(sp44) + sp40;
}
#elif VERSION == VERSION_PAL
#ifndef NONMATCHING
s32 func_80240204(s32 addr, s32 len, void *state);
#pragma GLOBAL_ASM("asm/nonmatchings/core1/code_1D00/func_80240204.s")
#else
s32 func_80240204(s32 addr, s32 len, void *state){
void *sp44;
s32 sp40;
Struct_1D00_3 *phi_s0;
Struct_1D00_3 *phi_v0;
s32 new_var;
Struct_1D00_3 *sp30;
phi_v0 = D_8027D5B0.unk4;
sp30 = NULL;
for(phi_s0 = phi_v0; phi_s0 != NULL; phi_s0 = phi_s0->unk0.next) {
sp40 = (phi_s0->unk8 + 0x270);
if ((phi_s0->unk8 > addr)) break;
sp30 = phi_s0;
if ((addr + len) <= sp40) {
phi_s0->unkC = (s32) D_8027DCC8;
return osVirtualToPhysical(phi_s0->unk10 + (addr - phi_s0->unk8));
}
}
phi_s0 = D_8027D5B0.unk8;
if (phi_s0 == NULL) {
return osVirtualToPhysical(phi_v0);
}
D_8027D5B0.unk8 = phi_s0->unk0.next;
alUnlink(phi_s0);
if (sp30 != NULL) {
alLink(phi_s0, sp30);
} else {
phi_v0 = D_8027D5B0.unk4;
if (phi_v0 != NULL) {
D_8027D5B0.unk4 = phi_s0;
phi_s0->unk0.next = (ALLink *)phi_v0;
phi_s0->unk0.prev = NULL;
phi_v0->unk0.prev = (ALLink *)phi_s0;
} else {
D_8027D5B0.unk4 = phi_s0;
phi_s0->unk0.next = NULL;
phi_s0->unk0.prev = NULL;
}
}
new_var = addr & 1;
addr = addr - new_var;
phi_s0->unk8 = addr;
phi_s0->unkC = (s32) D_8027DCC8;
sp44 = phi_s0->unk10;
osPiStartDma(&D_8027D100[D_8027DCCC++], 1, 0, phi_s0->unk8, phi_s0->unk10, 0x270U, &D_8027D008);
return osVirtualToPhysical(sp44) + new_var;
}
#endif
#endif
void *func_802403B8(void *state) {
if (D_8027D5B0.unk0 == 0) {
@ -498,12 +572,17 @@ void func_802403F0(void) {
sp40 = NULL;
for(phi_s0 = 0; phi_s0 < D_8027DCCC; phi_s0++){
#if VERSION == VERSION_USA_1_0
if (osRecvMesg(&D_8027D008, &sp40, 0) == -1) {
func_80247F24(2, 0x7D5);
func_80247F9C(D_8027DCCC);
func_80247F9C(phi_s0);
func_802483D8();
}
#else
osRecvMesg(&D_8027D008, &sp40, 0);
#endif
}
phi_s0_2 = D_8027D5B0.unk4;
while(phi_s0_2 != NULL){
@ -527,6 +606,11 @@ void func_802403F0(void) {
D_8027DCC8 += 1;
}
#if VERSION == VERSION_PAL
void *audioManager_getThread_PAL(void){
return &audioManager.thread;
}
void audioManager_stopThread(void){
if(D_80275774){
D_80275774 = 0;

View File

@ -1,6 +1,8 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "version.h"
OSIoMesg D_8027E090;
struct {
@ -13,7 +15,7 @@ OSMesgQueue D_8027E108; //g_PimgrMesgQueue
void func_802405F0(u32 * arg0, s32 arg1, s32 size){
s32 block_cnt;
s32 block_remainder;
s32 block_size = 0x20000;
s32 block_size = VER_SELECT(0x20000, 0x8000, 0, 0);
int i;
osWritebackDCache(arg0, size);
@ -21,10 +23,10 @@ void func_802405F0(u32 * arg0, s32 arg1, s32 size){
block_remainder = size % block_size;
for(i = 0; i < block_cnt; i++){
osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, 0x20000, &D_8027E0A8.queue);
osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, VER_SELECT(0x20000, 0x8000, 0, 0), &D_8027E0A8.queue);
osRecvMesg(&D_8027E0A8.queue, NULL, 1);
arg1 += 0x20000;
arg0 += 0x8000;
arg1 += VER_SELECT(0x20000, 0x8000, 0, 0);
arg0 += VER_SELECT(0x8000, 0x2000, 0, 0);
}
osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, block_remainder, &D_8027E0A8.queue);

View File

@ -1,10 +1,16 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "version.h"
static void _guMtxIdentF(float mf[4][4]);
u8 D_80275900[] = {0xCF, 0xAD, 0xA2, 0x90, 0x93, 0x4A, 0x83, 0xF1};
#if VERSION == VERSION_USA_1_0
u8 D_80275900[8] = {0xCF, 0xAD, 0xA2, 0x90, 0x93, 0x4A, 0x83, 0xF1};
#elif VERSION == VERSION_PAL
u8 D_80275900[8] = {0xD3, 0x9E, 0xA6, 0x20, 0xC7, 0x7E, 0xD5, 0xC6};
#endif
f32 D_80275908 = BAD_DTOR;
static s32 guFToFix32(f32 arg0){

View File

@ -9,8 +9,8 @@
u64 gEntryStack[ENTRY_STACK_LEN_U64];
extern u8 core1_us_v10_rzip_ROM_START[];
extern u8 core1_us_v10_rzip_ROM_END[];
extern u8 core1_rzip_ROM_START[];
extern u8 core1_rzip_ROM_END[];
extern u8 D_8002D500;
extern u8 core1_VRAM;
extern u32 D_803FFE00[4];
@ -25,7 +25,7 @@ void func_80000450(s32 arg0){
tmp = &D_8002D500;
dst = &core1_VRAM;
osInitialize();
osPiRawStartDma(OS_READ, core1_us_v10_rzip_ROM_START, tmp, core1_us_v10_rzip_ROM_END - core1_us_v10_rzip_ROM_START);
osPiRawStartDma(OS_READ, core1_rzip_ROM_START, tmp, core1_rzip_ROM_END - core1_rzip_ROM_START);
while(osPiGetStatus() & PI_STATUS_DMA_BUSY);
func_8000055C();
func_80000594(&tmp, &dst);

View File

@ -3,42 +3,42 @@
#include "variables.h"
#define OVERLAY(ovl, _) \
extern u8 ovl##_us_v10_rzip_ROM_START[]; \
extern u8 ovl##_us_v10_rzip_ROM_END[];
extern u8 ovl##_rzip_ROM_START[]; \
extern u8 ovl##_rzip_ROM_END[];
#include <overlays.h>
#undef OVERLAY
// This doesn't match as macros, even if two macros are used per overlay.
// Look into autogenerating this table in the long run for a cleaner solution.
void overlay_table_init(void) {
gOverlayTable[ 0].start = core2_us_v10_rzip_ROM_START;
gOverlayTable[ 0].end = core2_us_v10_rzip_ROM_END;
gOverlayTable[ 1].start = emptyLvl_us_v10_rzip_ROM_START;
gOverlayTable[ 1].end = emptyLvl_us_v10_rzip_ROM_END;
gOverlayTable[ 2].start = CC_us_v10_rzip_ROM_START;
gOverlayTable[ 2].end = CC_us_v10_rzip_ROM_END;
gOverlayTable[ 3].start = MMM_us_v10_rzip_ROM_START;
gOverlayTable[ 3].end = MMM_us_v10_rzip_ROM_END;
gOverlayTable[ 4].start = GV_us_v10_rzip_ROM_START;
gOverlayTable[ 4].end = GV_us_v10_rzip_ROM_END;
gOverlayTable[ 5].start = TTC_us_v10_rzip_ROM_START;
gOverlayTable[ 5].end = TTC_us_v10_rzip_ROM_END;
gOverlayTable[ 6].start = MM_us_v10_rzip_ROM_START;
gOverlayTable[ 6].end = MM_us_v10_rzip_ROM_END;
gOverlayTable[ 7].start = BGS_us_v10_rzip_ROM_START;
gOverlayTable[ 7].end = BGS_us_v10_rzip_ROM_END;
gOverlayTable[ 8].start = RBB_us_v10_rzip_ROM_START;
gOverlayTable[ 8].end = RBB_us_v10_rzip_ROM_END;
gOverlayTable[ 9].start = FP_us_v10_rzip_ROM_START;
gOverlayTable[ 9].end = FP_us_v10_rzip_ROM_END;
gOverlayTable[10].start = CCW_us_v10_rzip_ROM_START;
gOverlayTable[10].end = CCW_us_v10_rzip_ROM_END;
gOverlayTable[11].start = SM_us_v10_rzip_ROM_START;
gOverlayTable[11].end = SM_us_v10_rzip_ROM_END;
gOverlayTable[12].start = cutscenes_us_v10_rzip_ROM_START;
gOverlayTable[12].end = cutscenes_us_v10_rzip_ROM_END;
gOverlayTable[13].start = lair_us_v10_rzip_ROM_START;
gOverlayTable[13].end = lair_us_v10_rzip_ROM_END;
gOverlayTable[14].start = fight_us_v10_rzip_ROM_START;
gOverlayTable[14].end = fight_us_v10_rzip_ROM_END;
gOverlayTable[ 0].start = core2_rzip_ROM_START;
gOverlayTable[ 0].end = core2_rzip_ROM_END;
gOverlayTable[ 1].start = emptyLvl_rzip_ROM_START;
gOverlayTable[ 1].end = emptyLvl_rzip_ROM_END;
gOverlayTable[ 2].start = CC_rzip_ROM_START;
gOverlayTable[ 2].end = CC_rzip_ROM_END;
gOverlayTable[ 3].start = MMM_rzip_ROM_START;
gOverlayTable[ 3].end = MMM_rzip_ROM_END;
gOverlayTable[ 4].start = GV_rzip_ROM_START;
gOverlayTable[ 4].end = GV_rzip_ROM_END;
gOverlayTable[ 5].start = TTC_rzip_ROM_START;
gOverlayTable[ 5].end = TTC_rzip_ROM_END;
gOverlayTable[ 6].start = MM_rzip_ROM_START;
gOverlayTable[ 6].end = MM_rzip_ROM_END;
gOverlayTable[ 7].start = BGS_rzip_ROM_START;
gOverlayTable[ 7].end = BGS_rzip_ROM_END;
gOverlayTable[ 8].start = RBB_rzip_ROM_START;
gOverlayTable[ 8].end = RBB_rzip_ROM_END;
gOverlayTable[ 9].start = FP_rzip_ROM_START;
gOverlayTable[ 9].end = FP_rzip_ROM_END;
gOverlayTable[10].start = CCW_rzip_ROM_START;
gOverlayTable[10].end = CCW_rzip_ROM_END;
gOverlayTable[11].start = SM_rzip_ROM_START;
gOverlayTable[11].end = SM_rzip_ROM_END;
gOverlayTable[12].start = cutscenes_rzip_ROM_START;
gOverlayTable[12].end = cutscenes_rzip_ROM_END;
gOverlayTable[13].start = lair_rzip_ROM_START;
gOverlayTable[13].end = lair_rzip_ROM_END;
gOverlayTable[14].start = fight_rzip_ROM_START;
gOverlayTable[14].end = fight_rzip_ROM_END;
}

62
symbol_addrs.pal.txt Normal file
View File

@ -0,0 +1,62 @@
D_5E90 = 0x5E90;
D_D846C0 = 0xD846C0;
D_D954B0 = 0xD954B0;
D_EA3EB0 = 0xEA3EB0;
D_EADE60 = 0xEADE60;
osRomBase = 0x80000308;
bzero = 0x800020F0;
__osSetSR = 0x80002190;
__osGetSR = 0x800021A0;
__osSetFpcCsr = 0x800021B0;
osWritebackDCache = 0x80002B70;
osInvalICache = 0x80002BF0;
osMapTLBRdb = 0x80002C70;
__osProbeTLB = 0x80003BD0;
__osDisableInt = 0x80003FC0;
__osRestoreInt = 0x80003FE0;
bk_boot_BSS_START = 0x80005270;
___osGetSR = 0x8025AFE0;
bzero = 0x80263B40;
osWriteBackDCacheAll = 0x80263BE0;
osVirtualToPhysical = 0x802646A0;
osRecvMesg = 0x80264550;
osPiStartDma = 0x802647D0;
osWritebackDCache = 0x80264AF0;
osInvalDCache = 0x80264B70;
osDestroyThread = 0x80264DB0;
osSetThreadPri = 0x80265000;
osSetIntMask = 0x802654D0;
osInvalICache = 0x802684C0;
__osSetSR = 0x8026A210;
__osGetSR = 0x8026A220;
__osSetFpcCsr = 0x8026A230;
__osEnqueueAndYield = 0x8026A90C;
__osEnqueueThread = 0x8026AA0C;
__osPopThread = 0x8026AA54;
__osDispatchThread = 0x8026AA64;
__osCleanupThread = 0x8026ABE0;
osMapTLBRdb = 0x8026ABF0;
__osDisableInt = 0x8026ACB0;
__osRestoreInt = 0x8026ACD0;
__osProbeTLB = 0x8026B420;
bcopy = 0x8026C110;
__osSetCompare = 0x8026CA70;
osGetCount = 0x8026CE00;
__osShutdown = 0x8027712C;
__OSGlobalIntMask = 0x80277130;
__osRunQueue = 0x80277378;
__osRunningThread = 0x80277380;
__osFaultedThread = 0x80277384;
__osRcpImTable = 0x80278C60;
__libm_qnan_f = 0x80278DB0;
func_80240204 = 0x80240D80;
alUnlink = 0x80264080;
alLink = 0x802640b0;
osVirtualToPhysical = 0x802642f0;
osPiStartDma = 0x80264420;
D_8027D008 = 0x8027cd48;
D_8027D5B0 = 0x8027D408;
D_8027DCC8 = 0x8027DB20;
D_8027DCCC = 0x8027DB24;
D_8027D100 = 0x8027CE68;