diff --git a/src/1AC760.c b/src/1AC760.c index abbc5c1762..460d131bfa 100644 --- a/src/1AC760.c +++ b/src/1AC760.c @@ -824,6 +824,7 @@ s32 dispatch_damage_event_partner(s32 damageAmount, s32 event, s32 stopMotion) { battleStatus->lastAttackDamage += oldHP; partner->currentHP = 0; } + battleStatus->lastAttackDamage += hpChange; partner->lastDamageTaken = battleStatus->lastAttackDamage; battleStatus->unk_19A = 0; diff --git a/src/3169f0.c b/src/3169f0.c index 3f7e9ac3e2..72b69dc093 100644 --- a/src/3169f0.c +++ b/src/3169f0.c @@ -2,6 +2,11 @@ extern u8 obfuscated_create_audio_system[]; +#ifdef SHIFT +void func_80200000(void) { + create_audio_system(); +} +#else void func_80200000(void) { u32 t0 = 0xAC29007B; u32 t1 = 0xB00006A8; @@ -13,3 +18,4 @@ void func_80200000(void) { create_audio_system += t0; create_audio_system(); } +#endif diff --git a/src/316C00.c b/src/316C00.c index e368dd1a6a..35915d0c05 100644 --- a/src/316C00.c +++ b/src/316C00.c @@ -5,10 +5,15 @@ extern u8 obfuscated_general_heap_create[]; +#ifdef SHIFT +void func_802AE000_316C00(void) { + general_heap_create(); +} +#else void func_802AE000_316C00(void) { s32(*readFunc)(OSPiHandle*, u32, u32*) = osEPiReadIo; s32 seed = 0x3C016C07 + 0xFEFEFEF; - HeapNode*(*generalHeapCreate)(void) = (HeapNode* (*)(void)) obfuscated_general_heap_create; // general_heap_create - 0xFEFEFEF + HeapNode*(*general_heap_create)(void) = (HeapNode* (*)(void)) obfuscated_general_heap_create; // general_heap_create - 0xFEFEFEF u32 hash = 0; u32 thisInsn; u32* it; @@ -38,11 +43,12 @@ void func_802AE000_316C00(void) { } // 0x2499BF - hash == 0, so we add back 0xFEFEFEF (seed) and we end up with the address of general_heap_create! - generalHeapCreate += seed + 0x2499BF - hash; + general_heap_create += seed + 0x2499BF - hash; // If the function's address is 0x8XXXXXXX - if (((u32)generalHeapCreate >> 0x1C) == 8) { + if (((u32)general_heap_create >> 0x1C) == 8) { // Call the function that ends up being general_heap_create - (generalHeapCreate)(); + general_heap_create(); } } +#endif diff --git a/src/316a70.c b/src/316a70.c index 806714257c..d0a30b8a53 100644 --- a/src/316a70.c +++ b/src/316a70.c @@ -4,10 +4,15 @@ extern u8 obfuscated_load_engine_data[]; +#ifdef SHIFT +void func_80200080(void) { + load_engine_data(); +} +#else void func_80200080(void) { s32 seed = 0x3C01A775; u32 thisInsn = 0xB0018FFC; - HeapNode*(*load_engine_data)(s32) = (HeapNode* (*)(s32)) obfuscated_load_engine_data; // load_engine_data - ???????? + HeapNode*(*load_engine_data)(void) = (HeapNode* (*)(void)) obfuscated_load_engine_data; // load_engine_data - ???????? s32 hash = 0; u32 prevInsn; u32* it; @@ -40,5 +45,6 @@ void func_80200080(void) { } load_engine_data += seed + 0xDDD20 - hash; - load_engine_data(thisInsn); + load_engine_data(); } +#endif diff --git a/src/316d90.c b/src/316d90.c index 448791e456..095233ec04 100644 --- a/src/316d90.c +++ b/src/316d90.c @@ -5,6 +5,11 @@ extern s32 obfuscated_battle_heap_create[]; +#ifdef SHIFT +void func_802AE000(void) { + battle_heap_create(); +} +#else void func_802AE000(void) { s32(*readFunc)(OSPiHandle*, u32, u32*) = osEPiReadIo; s32 seed = 0x33F50000; @@ -41,8 +46,9 @@ void func_802AE000(void) { // If the function's address is 0x8XXXXXXX if (((u32)battle_heap_create >> 0x1C) == 8) { - (battle_heap_create)(); + battle_heap_create(); } else { _heap_create(&heap_battleHead, 0x10000); } } +#endif diff --git a/src/8560.c b/src/8560.c index d65d71c974..b0aaff3e47 100644 --- a/src/8560.c +++ b/src/8560.c @@ -3,14 +3,19 @@ #include "ld_addrs.h" #include "mips.h" -extern s8 D_F79DDD0F[]; -extern s8 D_7599F6D8[]; +extern s8 obfuscated__316F30_ROM_START[]; +extern s8 obfuscated__316F30_VRAM[]; +#ifdef SHIFT +void func_8002D160(void) { + dma_copy(_316F30_ROM_START, _316F30_ROM_END, _316F30_VRAM); +} +#else void func_8002D160(void) { s32 (*readFunc)(OSPiHandle*, u32, u32*); s32 (*readFunc2)(OSPiHandle*, u32, u32*); - s8* vramDest = D_7599F6D8; - s8* romStart = D_F79DDD0F; + s8* vramDest = obfuscated__316F30_VRAM; + s8* romStart = obfuscated__316F30_ROM_START; s32 seed; u32 hash; u32 thisInsn; @@ -73,3 +78,4 @@ void func_8002D160(void) { dma_copy(romStart, _316F30_ROM_END, vramDest); } +#endif diff --git a/src/effects/gfx/flame.c b/src/effects/gfx/flame.c index 17c3be8a81..67c300855b 100644 --- a/src/effects/gfx/flame.c +++ b/src/effects/gfx/flame.c @@ -3,8 +3,8 @@ #include "effects/gfx/D_09000400_353FB0.png.inc.c" #include "effects/gfx/D_09000600_3541B0.png.inc.c" -extern unsigned char D_000B32E0[]; // TODO look into segmented address weirdnes -extern unsigned char D_000B3AE0[]; // TODO look into segmented address weirdnes +extern unsigned char D_800B32E0[]; +extern unsigned char D_800B3AE0[]; //#include "effects/gfx/D_09000800_3543B0.gfx.inc.c" #include "common.h" @@ -21,7 +21,7 @@ Gfx D_09000800_3543B0[] = { gsDPSetAlphaDither(G_AD_PATTERN), gsDPSetTextureLUT(G_TT_NONE), gsDPSetRenderMode(G_RM_PASS, G_RM_ZB_CLD_SURF2), - gsDPLoadTextureTile(D_000B32E0, G_IM_FMT_I, G_IM_SIZ_8b, 32, 0, 0, 0, 31, 63, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 5, 6, G_TX_NOLOD, G_TX_NOLOD), + gsDPLoadTextureTile(OS_K0_TO_PHYSICAL(&D_800B32E0), G_IM_FMT_I, G_IM_SIZ_8b, 32, 0, 0, 0, 31, 63, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 5, 6, G_TX_NOLOD, G_TX_NOLOD), gsDPSetCombineLERP(TEXEL0, CENTER, SCALE, ENVIRONMENT, 0, 0, 0, TEXEL0, 0, PRIMITIVE, COMBINED, ENVIRONMENT, 0, 0, 0, COMBINED), gsSPClearGeometryMode(G_CULL_BOTH | G_LIGHTING), gsSPSetGeometryMode(G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH), @@ -32,9 +32,8 @@ Gfx D_09000800_3543B0[] = { #include "effects/gfx/D_090008F8_3544A8.gfx.inc.c" #include "effects/gfx/D_09000918_3544C8.gfx.inc.c" -//#include "effects/gfx/D_090009E0_354590.gfx.inc.c" Gfx D_090009E0_354590[] = { - gsDPSetColorImage(G_IM_FMT_I, G_IM_SIZ_8b, 32, D_000B3AE0), + gsDPSetColorImage(G_IM_FMT_I, G_IM_SIZ_8b, 32, OS_K0_TO_PHYSICAL(&D_800B3AE0)), gsDPSetScissor(G_SC_NON_INTERLACE, 0, 0, 32, 64), gsDPSetTexturePersp(G_TP_NONE), gsDPSetTextureFilter(G_TF_BILERP), @@ -45,23 +44,23 @@ Gfx D_090009E0_354590[] = { gsDPSetCombineLERP(TEXEL0, TEXEL1, TEXEL0, TEXEL1, 1, TEXEL0, TEXEL1, 1, 0, 0, 0, COMBINED, COMBINED, TEXEL1, TEXEL1, TEXEL1), gsSPTextureRectangle(0, 0, 0x0080, 0x0100, G_TX_RENDERTILE, 0, 0, 0x0400, 0x0400), gsDPPipeSync(), - gsDPLoadTextureTile(D_000B3AE0, G_IM_FMT_I, G_IM_SIZ_8b, 32, 0, 0, 0, 31, 63, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 5, 6, G_TX_NOLOD, G_TX_NOLOD), - gsDPSetColorImage(G_IM_FMT_I, G_IM_SIZ_8b, 32, D_000B32E0), + gsDPLoadTextureTile(OS_K0_TO_PHYSICAL(&D_800B3AE0), G_IM_FMT_I, G_IM_SIZ_8b, 32, 0, 0, 0, 31, 63, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 5, 6, G_TX_NOLOD, G_TX_NOLOD), + gsDPSetColorImage(G_IM_FMT_I, G_IM_SIZ_8b, 32, OS_K0_TO_PHYSICAL(&D_800B32E0)), gsDPSetRenderMode(G_RM_OPA_SURF, G_RM_OPA_SURF2), gsDPSetTextureFilter(G_TF_POINT), gsDPSetCombineLERP(TEXEL1, K4, PRIMITIVE_ALPHA, TEXEL0, TEXEL0, TEXEL1, ENVIRONMENT, ENVIRONMENT, TEXEL1, K4, COMBINED_ALPHA, COMBINED, 0, 0, 0, 1), gsDPSetConvert(0, 0, 0, 0, 92, 0), gsDPSetPrimColor(0, 0, 0x00, 0x00, 0x00, 0x78), gsDPSetEnvColor(0x00, 0x00, 0x00, 0xA4), - gsDPLoadMultiTile(D_000B32E0, 0x0100, 1, G_IM_FMT_I, G_IM_SIZ_8b, 32, 0, 0, 0, 31, 63, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_CLAMP, 5, 6, G_TX_NOLOD, G_TX_NOLOD), + gsDPLoadMultiTile(OS_K0_TO_PHYSICAL(&D_800B32E0), 0x0100, 1, G_IM_FMT_I, G_IM_SIZ_8b, 32, 0, 0, 0, 31, 63, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_CLAMP, 5, 6, G_TX_NOLOD, G_TX_NOLOD), gsDPSetTileSize(1, 0x0004, 0, 0x007C, 0x00FC), gsSPTextureRectangle(0, 0, 0x0080, 0x0100, G_TX_RENDERTILE, 0, 0, 0x0400, 0x0400), gsDPPipeSync(), - gsDPLoadMultiTile(D_000B32E0, 0x0100, 1, G_IM_FMT_I, G_IM_SIZ_8b, 32, 0, 0, 0, 31, 63, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_CLAMP, 5, 6, G_TX_NOLOD, G_TX_NOLOD), + gsDPLoadMultiTile(OS_K0_TO_PHYSICAL(&D_800B32E0), 0x0100, 1, G_IM_FMT_I, G_IM_SIZ_8b, 32, 0, 0, 0, 31, 63, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_CLAMP, 5, 6, G_TX_NOLOD, G_TX_NOLOD), gsDPSetTileSize(1, 0x007C, 0, 0x007C, 0x00FC), gsSPTextureRectangle(0, 0, 0x0080, 0x0100, G_TX_RENDERTILE, 0, 0, 0x0400, 0x0400), gsDPPipeSync(), - gsDPLoadMultiTile(D_000B32E0, 0x0100, 1, G_IM_FMT_I, G_IM_SIZ_8b, 32, 0, 0, 0, 31, 63, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_CLAMP, 5, 6, G_TX_NOLOD, G_TX_NOLOD), + gsDPLoadMultiTile(OS_K0_TO_PHYSICAL(&D_800B32E0), 0x0100, 1, G_IM_FMT_I, G_IM_SIZ_8b, 32, 0, 0, 0, 31, 63, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_CLAMP, 5, 6, G_TX_NOLOD, G_TX_NOLOD), gsDPSetTileSize(1, 0, 0x0004, 0x007C, 0x00FC), gsSPTextureRectangle(0, 0, 0x0080, 0x0100, G_TX_RENDERTILE, 0, 0, 0x0400, 0x0400), gsDPPipeSync(), diff --git a/src/world/area_hos/hos_05/A2AAC0.c b/src/world/area_hos/hos_05/A2AAC0.c index 9aeccfc399..2d1755d58e 100644 --- a/src/world/area_hos/hos_05/A2AAC0.c +++ b/src/world/area_hos/hos_05/A2AAC0.c @@ -1062,6 +1062,7 @@ void func_80243ED0_A2E110(s32 arg0, s32 idx) { #ifdef SHIFT #define TAPE_OFFSET title_tape_ROM_START - title_bg_1_ROM_START +#define TAPE_OFFSET 0x2A440 // TODO remove this line once the map is split #else #define TAPE_OFFSET 0x2A440 #endif diff --git a/tools/old/codescan.py b/tools/old/codescan.py old mode 100644 new mode 100755 diff --git a/ver/us/asm/bss.s b/ver/us/asm/bss.s index de9adffc2a..d6b06a0181 100644 --- a/ver/us/asm/bss.s +++ b/ver/us/asm/bss.s @@ -860,7 +860,13 @@ dlabel nuContData .space 0x00000018 dlabel gCameras -.space 0x00002560 +.space 0x00001560 + +dlabel D_800B32E0 +.space 0x800 + +dlabel D_800B3AE0 +.space 0x800 dlabel gCollisionData .space 4 diff --git a/ver/us/asm/os/parameters.s b/ver/us/asm/os/parameters.s index 7fcde66ccb..73d6bcc454 100644 --- a/ver/us/asm/os/parameters.s +++ b/ver/us/asm/os/parameters.s @@ -7,27 +7,31 @@ .section .text, "ax" -/* 459D0 8006A5D0 00000000 */ nop -/* 459D4 8006A5D4 00000000 */ nop -/* 459D8 8006A5D8 00000000 */ nop -/* 459DC 8006A5DC 00000000 */ nop -/* 459E0 8006A5E0 00000000 */ nop -/* 459E4 8006A5E4 00000000 */ nop -/* 459E8 8006A5E8 00000000 */ nop -/* 459EC 8006A5EC 00000000 */ nop -/* 459F0 8006A5F0 00000000 */ nop -/* 459F4 8006A5F4 00000000 */ nop -/* 459F8 8006A5F8 00000000 */ nop -/* 459FC 8006A5FC 00000000 */ nop -/* 45A00 8006A600 00000000 */ nop -/* 45A04 8006A604 00000000 */ nop -/* 45A08 8006A608 00000000 */ nop -/* 45A0C 8006A60C 00000000 */ nop -/* 45A10 8006A610 00000000 */ nop -/* 45A14 8006A614 00000000 */ nop -/* 45A18 8006A618 00000000 */ nop -/* 45A1C 8006A61C 00000000 */ nop -/* 45A20 8006A620 00000000 */ nop -/* 45A24 8006A624 00000000 */ nop -/* 45A28 8006A628 00000000 */ nop -/* 45A2C 8006A62C 00000000 */ nop +.globl leoBootID +leoBootID = 0x800001a0 + +.globl osTvType +osTvType = 0x80000300 + +.globl osRomType +osRomType = 0x80000304 + +.globl osRomBase +osRomBase = 0x80000308 + +.globl osResetType +osResetType = 0x8000030C + +.globl osCicId +osCicId = 0x80000310 + +.globl osVersion +osVersion = 0x80000314 + +.globl osMemSize +osMemSize = 0x80000318 + +.globl osAppNMIBuffer +osAppNMIBuffer = 0x8000031C + +.fill 0x60 diff --git a/ver/us/splat.yaml b/ver/us/splat.yaml index 217d04b909..bad8c80c4e 100644 --- a/ver/us/splat.yaml +++ b/ver/us/splat.yaml @@ -234,7 +234,7 @@ segments: - [0x44B40, c, os/contpfs, gcc_272 -O3] - [0x455D0, c, os/contramread, gcc_272 -O3] - [0x457C0, c, os/contramwrite, gcc_272 -O3] - - [0x459D0, hasm, os/parameters] # Needs actual symbols added + - [0x459D0, hasm, os/parameters] - [0x45A30, c, os/afterprenmi, gcc_272 -O3] - [0x45A50, c, os/initialize, gcc_272 -O3] - [0x45DF0, hasm, os/exceptasm] @@ -3495,7 +3495,7 @@ segments: - [0x354468, vtx, D_090008B8_354468] - [0x3544A8, gfx, D_090008F8_3544A8] - [0x3544C8, gfx, D_09000918_3544C8] - - [0x354590, gfx, D_090009E0_354590] + - [0x354590] - name: effect_stars_burst dir: effects type: code diff --git a/ver/us/symbol_addrs.txt b/ver/us/symbol_addrs.txt index 9b714b43a7..6b1445cf5d 100644 --- a/ver/us/symbol_addrs.txt +++ b/ver/us/symbol_addrs.txt @@ -25851,7 +25851,7 @@ battle_item_insecticide_herb_temp2 = 0x28003D0; // type:data battle_item_mystery_tempStc = 0x2800410; // type:data obfuscated_battle_heap_create = 0x7012ACA1; // type:data obfuscated_general_heap_create = 0x7012BC11; // type:data -D_7599F6D8 = 0x7599F6D8; // type:data +obfuscated__316F30_VRAM = 0x7599F6D8; // type:data osTvType = 0x80000300; // osRomBase = 0x80000308; // type:data osResetType = 0x8000030C; // type:data diff --git a/ver/us/undefined_syms.txt b/ver/us/undefined_syms.txt index e3d7346a28..101d252ff2 100644 --- a/ver/us/undefined_syms.txt +++ b/ver/us/undefined_syms.txt @@ -3,12 +3,8 @@ obfuscated_battle_heap_create = battle_heap_create - 0xFEFFFFF; obfuscated_general_heap_create = general_heap_create - 0xFEFEFEF; obfuscated_load_engine_data = load_engine_data - 0x315; obfuscated_create_audio_system = create_audio_system - 0x7B; -D_7599F6D8 = _316F30_VRAM - 0xA912928; -D_F79DDD0F = _316F30_ROM_START - 0x8939221; - -// effect_flame -D_000B32E0 = 0x000B32E0; // todo look into -D_000B3AE0 = 0x000B3AE0; // todo look into +obfuscated__316F30_VRAM = _316F30_VRAM - 0xA912928; +obfuscated__316F30_ROM_START = _316F30_ROM_START - 0x8939221; // hacks for various things fx_sun_undeclared = fx_sun; @@ -77,13 +73,6 @@ nok_02_Quizmo_StageEffect = 0x802549C0; nok_02_Quizmo_AudienceEffect = 0x802549C4; nok_02_Quizmo_VannaTEffect = 0x802549C8; -// os stuff -osTvType = 0x80000300; -osRomBase = 0x80000308; -osMemSize = 0x80000318; -osResetType = 0x8000030C; -osAppNMIBuffer = 0x8000031C; - // boot D_A0000000 = 0xA0000000; D_A4000000 = 0xA4000000;