From 936f63b05dfb7bcf06013f045f87513c06702470 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Fri, 15 Apr 2022 15:24:52 -0400 Subject: [PATCH] Updates to rstl; rename some symbols; update CFLAGS Former-commit-id: b8c0242ea76a59d28b110b56b4764fd31ca32acf --- Makefile | 2 +- asm/Kyoto_CWD/CGameArea.s | 4 +- asm/Kyoto_CWD/CMemoryCardDriver.s | 2 +- asm/Kyoto_CWD/Factories/CSaveWorldFactory.s | 6 +- asm/Kyoto_CWD/Player/CGameOptions.s | 10 +- asm/Kyoto_CWD/Player/CSaveWorld.s | 4 +- asm/Kyoto_CWD/main.s | 215 +++++++++++++++++++- asm/Kyoto_CWD/text_80008894_80009144.s | 204 ------------------- asm/text.s | 4 +- include/Dolphin/__start.h | 2 - include/Kyoto_CWD/CGameGlobalObjects.hpp | 7 +- include/Kyoto_CWD/CGameOptions.hpp | 6 +- include/Kyoto_CWD/CGameState.hpp | 3 - include/Kyoto_CWD/CMain.hpp | 2 +- include/Kyoto_CWD/CSystemOptions.hpp | 3 - include/Kyoto_CWD/TGameTypes.hpp | 2 +- include/rstl/construct.hpp | 39 +++- include/rstl/reserved_vector.hpp | 21 +- include/rstl/vector.hpp | 52 ++++- include/types.h | 4 +- src/Kyoto_CWD/main.cpp | 21 +- 21 files changed, 342 insertions(+), 271 deletions(-) diff --git a/Makefile b/Makefile index 06611c62..5d6e7821 100644 --- a/Makefile +++ b/Makefile @@ -115,7 +115,7 @@ ifeq ($(VERBOSE),0) # this set of LDFLAGS generates no warnings. LDFLAGS := $(MAPGEN) -fp hard -nodefaults -w off endif -CFLAGS_1.2 = -Cpp_exceptions off -enum int -inline auto -proc gekko -RTTI off -fp hard -fp_contract on -str pool -rostr -O4,p -use_lmw_stmw on -sdata 8 -sdata2 8 -nodefaults -MMD $(INCLUDES) +CFLAGS_1.2 = -proc gekko -nodefaults -Cpp_exceptions off -RTTI off -fp hard -fp_contract on -str reuse,pool,readonly -rostr -O4,p -maxerrors 1 -use_lmw_stmw on -enum int -inline auto -MMD $(INCLUDES) CFLAGS = $(CFLAGS_1.2) -gccinc ifeq ($(VERBOSE),0) diff --git a/asm/Kyoto_CWD/CGameArea.s b/asm/Kyoto_CWD/CGameArea.s index 09bd60ed..16f28b87 100644 --- a/asm/Kyoto_CWD/CGameArea.s +++ b/asm/Kyoto_CWD/CGameArea.s @@ -972,7 +972,7 @@ ReadDependencyList__9CGameArea: /* 8005E964 0005B8C4 7C 7D 1B 78 */ mr r29, r3 /* 8005E968 0005B8C8 7F 43 D3 78 */ mr r3, r26 /* 8005E96C 0005B8CC 7F A4 EB 78 */ mr r4, r29 -/* 8005E970 0005B8D0 4B FA A0 DD */ bl "reserve__Q24rstl47vector<10SScanState,Q24rstl17rmemory_allocator>Fi" +/* 8005E970 0005B8D0 4B FA A0 DD */ bl "reserve__Q24rstl55vector,Q24rstl17rmemory_allocator>Fi" /* 8005E974 0005B8D4 3B 80 00 00 */ li r28, 0 /* 8005E978 0005B8D8 48 00 00 70 */ b lbl_8005E9E8 lbl_8005E97C: @@ -992,7 +992,7 @@ lbl_8005E97C: /* 8005E9B0 0005B910 41 82 00 08 */ beq lbl_8005E9B8 /* 8005E9B4 0005B914 54 A4 08 3C */ slwi r4, r5, 1 lbl_8005E9B8: -/* 8005E9B8 0005B918 4B FA A0 95 */ bl "reserve__Q24rstl47vector<10SScanState,Q24rstl17rmemory_allocator>Fi" +/* 8005E9B8 0005B918 4B FA A0 95 */ bl "reserve__Q24rstl55vector,Q24rstl17rmemory_allocator>Fi" lbl_8005E9BC: /* 8005E9BC 0005B91C 80 1A 00 04 */ lwz r0, 4(r26) /* 8005E9C0 0005B920 80 7A 00 0C */ lwz r3, 0xc(r26) diff --git a/asm/Kyoto_CWD/CMemoryCardDriver.s b/asm/Kyoto_CWD/CMemoryCardDriver.s index 3daf2529..8b3c3b83 100644 --- a/asm/Kyoto_CWD/CMemoryCardDriver.s +++ b/asm/Kyoto_CWD/CMemoryCardDriver.s @@ -56,7 +56,7 @@ LoadGameState__13SGameFileSlotFi: /* 8024C330 00249290 80 6D A0 78 */ lwz r3, gpMain@sda21(r13) /* 8024C334 00249294 7F E5 FB 78 */ mr r5, r31 /* 8024C338 00249298 38 81 00 08 */ addi r4, r1, 8 -/* 8024C33C 0024929C 4B DB 81 69 */ bl StreamNewGameState__5CMainFR12CInputStream +/* 8024C33C 0024929C 4B DB 81 69 */ bl StreamNewGameState__5CMainFR12CInputStreami /* 8024C340 002492A0 3C 80 80 3F */ lis r4, __vt__15CMemoryInStream@ha /* 8024C344 002492A4 38 61 00 08 */ addi r3, r1, 8 /* 8024C348 002492A8 38 04 E3 98 */ addi r0, r4, __vt__15CMemoryInStream@l diff --git a/asm/Kyoto_CWD/Factories/CSaveWorldFactory.s b/asm/Kyoto_CWD/Factories/CSaveWorldFactory.s index 4ae4e367..163b0c44 100644 --- a/asm/Kyoto_CWD/Factories/CSaveWorldFactory.s +++ b/asm/Kyoto_CWD/Factories/CSaveWorldFactory.s @@ -887,7 +887,7 @@ lbl_8026B930: /* 8026B950 002688B0 7C 79 1B 78 */ mr r25, r3 /* 8026B954 002688B4 38 61 00 B4 */ addi r3, r1, 0xb4 /* 8026B958 002688B8 7F 24 CB 78 */ mr r4, r25 -/* 8026B95C 002688BC 4B D9 D0 F1 */ bl "reserve__Q24rstl47vector<10SScanState,Q24rstl17rmemory_allocator>Fi" +/* 8026B95C 002688BC 4B D9 D0 F1 */ bl "reserve__Q24rstl55vector,Q24rstl17rmemory_allocator>Fi" /* 8026B960 002688C0 3B 40 00 00 */ li r26, 0 /* 8026B964 002688C4 48 00 00 70 */ b lbl_8026B9D4 lbl_8026B968: @@ -907,7 +907,7 @@ lbl_8026B968: /* 8026B99C 002688FC 41 82 00 08 */ beq lbl_8026B9A4 /* 8026B9A0 00268900 54 A4 08 3C */ slwi r4, r5, 1 lbl_8026B9A4: -/* 8026B9A4 00268904 4B D9 D0 A9 */ bl "reserve__Q24rstl47vector<10SScanState,Q24rstl17rmemory_allocator>Fi" +/* 8026B9A4 00268904 4B D9 D0 A9 */ bl "reserve__Q24rstl55vector,Q24rstl17rmemory_allocator>Fi" lbl_8026B9A8: /* 8026B9A8 00268908 80 01 00 B8 */ lwz r0, 0xb8(r1) /* 8026B9AC 0026890C 80 61 00 C0 */ lwz r3, 0xc0(r1) @@ -959,7 +959,7 @@ lbl_8026BA40: /* 8026BA50 002689B0 48 00 00 54 */ b lbl_8026BAA4 lbl_8026BA54: /* 8026BA54 002689B4 38 7F 00 44 */ addi r3, r31, 0x44 -/* 8026BA58 002689B8 4B D9 CF F5 */ bl "reserve__Q24rstl47vector<10SScanState,Q24rstl17rmemory_allocator>Fi" +/* 8026BA58 002689B8 4B D9 CF F5 */ bl "reserve__Q24rstl55vector,Q24rstl17rmemory_allocator>Fi" /* 8026BA5C 002689BC 80 01 00 B8 */ lwz r0, 0xb8(r1) /* 8026BA60 002689C0 80 A1 00 C0 */ lwz r5, 0xc0(r1) /* 8026BA64 002689C4 54 00 18 38 */ slwi r0, r0, 3 diff --git a/asm/Kyoto_CWD/Player/CGameOptions.s b/asm/Kyoto_CWD/Player/CGameOptions.s index cd505c78..bd10ec98 100644 --- a/asm/Kyoto_CWD/Player/CGameOptions.s +++ b/asm/Kyoto_CWD/Player/CGameOptions.s @@ -47,7 +47,7 @@ lbl_8020EA10: /* 8020EA1C 0020B97C 38 81 00 34 */ addi r4, r1, 0x34 /* 8020EA20 0020B980 90 01 00 3C */ stw r0, 0x3c(r1) /* 8020EA24 0020B984 90 01 00 40 */ stw r0, 0x40(r1) -/* 8020EA28 0020B988 4B DF 4E A9 */ bl sub_800038d0 +/* 8020EA28 0020B988 4B DF 4E A9 */ bl "__as__Q24rstl55vector,Q24rstl17rmemory_allocator>FRCQ24rstl55vector,Q24rstl17rmemory_allocator>" /* 8020EA2C 0020B98C 80 01 00 38 */ lwz r0, 0x38(r1) /* 8020EA30 0020B990 80 61 00 40 */ lwz r3, 0x40(r1) /* 8020EA34 0020B994 54 00 18 38 */ slwi r0, r0, 3 @@ -113,7 +113,7 @@ lbl_8020EA70: /* 8020EB18 0020BA78 90 C1 00 60 */ stw r6, 0x60(r1) /* 8020EB1C 0020BA7C 90 A1 00 64 */ stw r5, 0x64(r1) /* 8020EB20 0020BA80 90 01 00 68 */ stw r0, 0x68(r1) -/* 8020EB24 0020BA84 4B DF 9F 29 */ bl "reserve__Q24rstl47vector<10SScanState,Q24rstl17rmemory_allocator>Fi" +/* 8020EB24 0020BA84 4B DF 9F 29 */ bl "reserve__Q24rstl55vector,Q24rstl17rmemory_allocator>Fi" /* 8020EB28 0020BA88 3B C0 00 00 */ li r30, 0 /* 8020EB2C 0020BA8C 3B E1 00 6C */ addi r31, r1, 0x6c lbl_8020EB30: @@ -129,7 +129,7 @@ lbl_8020EB30: /* 8020EB54 0020BAB4 41 82 00 08 */ beq lbl_8020EB5C /* 8020EB58 0020BAB8 54 A4 08 3C */ slwi r4, r5, 1 lbl_8020EB5C: -/* 8020EB5C 0020BABC 4B DF 9E F1 */ bl "reserve__Q24rstl47vector<10SScanState,Q24rstl17rmemory_allocator>Fi" +/* 8020EB5C 0020BABC 4B DF 9E F1 */ bl "reserve__Q24rstl55vector,Q24rstl17rmemory_allocator>Fi" lbl_8020EB60: /* 8020EB60 0020BAC0 80 1D 00 70 */ lwz r0, 0x70(r29) /* 8020EB64 0020BAC4 80 7D 00 78 */ lwz r3, 0x78(r29) @@ -154,7 +154,7 @@ lbl_8020EB7C: /* 8020EBAC 0020BB0C 41 82 00 08 */ beq lbl_8020EBB4 /* 8020EBB0 0020BB10 54 A4 08 3C */ slwi r4, r5, 1 lbl_8020EBB4: -/* 8020EBB4 0020BB14 4B DF 9E 99 */ bl "reserve__Q24rstl47vector<10SScanState,Q24rstl17rmemory_allocator>Fi" +/* 8020EBB4 0020BB14 4B DF 9E 99 */ bl "reserve__Q24rstl55vector,Q24rstl17rmemory_allocator>Fi" lbl_8020EBB8: /* 8020EBB8 0020BB18 80 1D 00 70 */ lwz r0, 0x70(r29) /* 8020EBBC 0020BB1C 80 7D 00 78 */ lwz r3, 0x78(r29) @@ -186,7 +186,7 @@ lbl_8020EBF8: /* 8020EC1C 0020BB7C 41 82 00 08 */ beq lbl_8020EC24 /* 8020EC20 0020BB80 54 A4 08 3C */ slwi r4, r5, 1 lbl_8020EC24: -/* 8020EC24 0020BB84 4B DF 9E 29 */ bl "reserve__Q24rstl47vector<10SScanState,Q24rstl17rmemory_allocator>Fi" +/* 8020EC24 0020BB84 4B DF 9E 29 */ bl "reserve__Q24rstl55vector,Q24rstl17rmemory_allocator>Fi" lbl_8020EC28: /* 8020EC28 0020BB88 80 1D 00 70 */ lwz r0, 0x70(r29) /* 8020EC2C 0020BB8C 80 7D 00 78 */ lwz r3, 0x78(r29) diff --git a/asm/Kyoto_CWD/Player/CSaveWorld.s b/asm/Kyoto_CWD/Player/CSaveWorld.s index 857fe344..64750d4a 100644 --- a/asm/Kyoto_CWD/Player/CSaveWorld.s +++ b/asm/Kyoto_CWD/Player/CSaveWorld.s @@ -318,7 +318,7 @@ lbl_802491F8: /* 80249224 00246184 80 98 00 24 */ lwz r4, 0x24(r24) /* 80249228 00246188 80 1E 00 48 */ lwz r0, 0x48(r30) /* 8024922C 0024618C 7C 84 02 14 */ add r4, r4, r0 -/* 80249230 00246190 4B DB F8 1D */ bl "reserve__Q24rstl47vector<10SScanState,Q24rstl17rmemory_allocator>Fi" +/* 80249230 00246190 4B DB F8 1D */ bl "reserve__Q24rstl55vector,Q24rstl17rmemory_allocator>Fi" /* 80249234 00246194 83 9E 00 50 */ lwz r28, 0x50(r30) /* 80249238 00246198 48 00 00 F0 */ b lbl_80249328 lbl_8024923C: @@ -367,7 +367,7 @@ lbl_802492AC: /* 802492D4 00246234 41 82 00 08 */ beq lbl_802492DC /* 802492D8 00246238 54 04 08 3C */ slwi r4, r0, 1 lbl_802492DC: -/* 802492DC 0024623C 4B DB F7 71 */ bl "reserve__Q24rstl47vector<10SScanState,Q24rstl17rmemory_allocator>Fi" +/* 802492DC 0024623C 4B DB F7 71 */ bl "reserve__Q24rstl55vector,Q24rstl17rmemory_allocator>Fi" lbl_802492E0: /* 802492E0 00246240 80 18 00 24 */ lwz r0, 0x24(r24) /* 802492E4 00246244 80 78 00 2C */ lwz r3, 0x2c(r24) diff --git a/asm/Kyoto_CWD/main.s b/asm/Kyoto_CWD/main.s index 2d67cb0c..6a5fdfb9 100644 --- a/asm/Kyoto_CWD/main.s +++ b/asm/Kyoto_CWD/main.s @@ -1153,7 +1153,7 @@ lbl_8000385C: /* 800038A8 00000808 90 1F 00 64 */ stw r0, 0x64(r31) /* 800038AC 0000080C 88 06 00 68 */ lbz r0, 0x68(r6) /* 800038B0 00000810 98 1F 00 68 */ stb r0, 0x68(r31) -/* 800038B4 00000814 48 00 00 1D */ bl sub_800038d0 +/* 800038B4 00000814 48 00 00 1D */ bl "__as__Q24rstl55vector,Q24rstl17rmemory_allocator>FRCQ24rstl55vector,Q24rstl17rmemory_allocator>" /* 800038B8 00000818 80 01 00 14 */ lwz r0, 0x14(r1) /* 800038BC 0000081C 7F E3 FB 78 */ mr r3, r31 /* 800038C0 00000820 83 E1 00 0C */ lwz r31, 0xc(r1) @@ -1161,8 +1161,8 @@ lbl_8000385C: /* 800038C8 00000828 38 21 00 10 */ addi r1, r1, 0x10 /* 800038CC 0000082C 4E 80 00 20 */ blr -.global sub_800038d0 # vector -sub_800038d0: +.global "__as__Q24rstl55vector,Q24rstl17rmemory_allocator>FRCQ24rstl55vector,Q24rstl17rmemory_allocator>" # vector +"__as__Q24rstl55vector,Q24rstl17rmemory_allocator>FRCQ24rstl55vector,Q24rstl17rmemory_allocator>": /* 800038D0 00000830 94 21 FF E0 */ stwu r1, -0x20(r1) /* 800038D4 00000834 7C 08 02 A6 */ mflr r0 /* 800038D8 00000838 90 01 00 24 */ stw r0, 0x24(r1) @@ -1205,7 +1205,7 @@ lbl_8000394C: /* 8000395C 000008BC 48 00 00 54 */ b lbl_800039B0 lbl_80003960: /* 80003960 000008C0 7F E3 FB 78 */ mr r3, r31 -/* 80003964 000008C4 48 00 50 E9 */ bl "reserve__Q24rstl47vector<10SScanState,Q24rstl17rmemory_allocator>Fi" +/* 80003964 000008C4 48 00 50 E9 */ bl "reserve__Q24rstl55vector,Q24rstl17rmemory_allocator>Fi" /* 80003968 000008C8 80 1E 00 04 */ lwz r0, 4(r30) /* 8000396C 000008CC 80 BE 00 0C */ lwz r5, 0xc(r30) /* 80003970 000008D0 54 00 18 38 */ slwi r0, r0, 3 @@ -2052,8 +2052,8 @@ lbl_80004458: /* 8000449C 000013FC 38 21 00 10 */ addi r1, r1, 0x10 /* 800044A0 00001400 4E 80 00 20 */ blr -.global StreamNewGameState__5CMainFR12CInputStream -StreamNewGameState__5CMainFR12CInputStream: +.global StreamNewGameState__5CMainFR12CInputStreami +StreamNewGameState__5CMainFR12CInputStreami: /* 800044A4 00001404 94 21 FF E0 */ stwu r1, -0x20(r1) /* 800044A8 00001408 7C 08 02 A6 */ mflr r0 /* 800044AC 0000140C 90 01 00 24 */ stw r0, 0x24(r1) @@ -6904,3 +6904,206 @@ lbl_80008800: lbl_8000888C: /* 8000888C 000057EC 38 6D A0 B0 */ addi r3, r13, lbl_805A8C70@sda21 /* 80008890 000057F0 4E 80 00 20 */ blr + +.global "GetAverageValue__FPCfi" +"GetAverageValue__FPCfi": +/* 80008894 000057F4 94 21 FF F0 */ stwu r1, -0x10(r1) +/* 80008898 000057F8 54 80 10 3A */ slwi r0, r4, 2 +/* 8000889C 000057FC 38 C3 00 04 */ addi r6, r3, 4 +/* 800088A0 00005800 7C A3 02 14 */ add r5, r3, r0 +/* 800088A4 00005804 C0 63 00 00 */ lfs f3, 0(r3) +/* 800088A8 00005808 38 65 00 03 */ addi r3, r5, 3 +/* 800088AC 0000580C 7C 66 18 50 */ subf r3, r6, r3 +/* 800088B0 00005810 7C 06 28 40 */ cmplw r6, r5 +/* 800088B4 00005814 54 63 F0 BE */ srwi r3, r3, 2 +/* 800088B8 00005818 40 80 00 74 */ bge lbl_8000892C +/* 800088BC 0000581C 54 60 E8 FF */ rlwinm. r0, r3, 0x1d, 3, 0x1f +/* 800088C0 00005820 7C 09 03 A6 */ mtctr r0 +/* 800088C4 00005824 41 82 00 54 */ beq lbl_80008918 +lbl_800088C8: +/* 800088C8 00005828 C0 06 00 00 */ lfs f0, 0(r6) +/* 800088CC 0000582C EC 63 00 2A */ fadds f3, f3, f0 +/* 800088D0 00005830 C0 06 00 04 */ lfs f0, 4(r6) +/* 800088D4 00005834 EC 63 00 2A */ fadds f3, f3, f0 +/* 800088D8 00005838 C0 06 00 08 */ lfs f0, 8(r6) +/* 800088DC 0000583C EC 63 00 2A */ fadds f3, f3, f0 +/* 800088E0 00005840 C0 06 00 0C */ lfs f0, 0xc(r6) +/* 800088E4 00005844 EC 63 00 2A */ fadds f3, f3, f0 +/* 800088E8 00005848 C0 06 00 10 */ lfs f0, 0x10(r6) +/* 800088EC 0000584C EC 63 00 2A */ fadds f3, f3, f0 +/* 800088F0 00005850 C0 06 00 14 */ lfs f0, 0x14(r6) +/* 800088F4 00005854 EC 63 00 2A */ fadds f3, f3, f0 +/* 800088F8 00005858 C0 06 00 18 */ lfs f0, 0x18(r6) +/* 800088FC 0000585C EC 63 00 2A */ fadds f3, f3, f0 +/* 80008900 00005860 C0 06 00 1C */ lfs f0, 0x1c(r6) +/* 80008904 00005864 38 C6 00 20 */ addi r6, r6, 0x20 +/* 80008908 00005868 EC 63 00 2A */ fadds f3, f3, f0 +/* 8000890C 0000586C 42 00 FF BC */ bdnz lbl_800088C8 +/* 80008910 00005870 70 63 00 07 */ andi. r3, r3, 7 +/* 80008914 00005874 41 82 00 18 */ beq lbl_8000892C +lbl_80008918: +/* 80008918 00005878 7C 69 03 A6 */ mtctr r3 +lbl_8000891C: +/* 8000891C 0000587C C0 06 00 00 */ lfs f0, 0(r6) +/* 80008920 00005880 38 C6 00 04 */ addi r6, r6, 4 +/* 80008924 00005884 EC 63 00 2A */ fadds f3, f3, f0 +/* 80008928 00005888 42 00 FF F4 */ bdnz lbl_8000891C +lbl_8000892C: +/* 8000892C 0000588C 6C 83 80 00 */ xoris r3, r4, 0x8000 +/* 80008930 00005890 3C 00 43 30 */ lis r0, 0x4330 +/* 80008934 00005894 90 61 00 0C */ stw r3, 0xc(r1) +/* 80008938 00005898 C8 22 80 60 */ lfd f1, lbl_805A9D80@sda21(r2) +/* 8000893C 0000589C 90 01 00 08 */ stw r0, 8(r1) +/* 80008940 000058A0 C0 42 80 5C */ lfs f2, lbl_805A9D7C@sda21(r2) +/* 80008944 000058A4 C8 01 00 08 */ lfd f0, 8(r1) +/* 80008948 000058A8 EC 00 08 28 */ fsubs f0, f0, f1 +/* 8000894C 000058AC EC 02 00 24 */ fdivs f0, f2, f0 +/* 80008950 000058B0 EC 23 00 32 */ fmuls f1, f3, f0 +/* 80008954 000058B4 38 21 00 10 */ addi r1, r1, 0x10 +/* 80008958 000058B8 4E 80 00 20 */ blr + +.global "reserve__Q24rstl42vector<6CToken,Q24rstl17rmemory_allocator>Fi" +"reserve__Q24rstl42vector<6CToken,Q24rstl17rmemory_allocator>Fi": +/* 8000895C 000058BC 94 21 FF D0 */ stwu r1, -0x30(r1) +/* 80008960 000058C0 7C 08 02 A6 */ mflr r0 +/* 80008964 000058C4 90 01 00 34 */ stw r0, 0x34(r1) +/* 80008968 000058C8 BF 41 00 18 */ stmw r26, 0x18(r1) +/* 8000896C 000058CC 7C 9F 23 78 */ mr r31, r4 +/* 80008970 000058D0 7C 7E 1B 78 */ mr r30, r3 +/* 80008974 000058D4 80 03 00 08 */ lwz r0, 8(r3) +/* 80008978 000058D8 7C 1F 00 00 */ cmpw r31, r0 +/* 8000897C 000058DC 40 81 00 BC */ ble lbl_80008A38 +/* 80008980 000058E0 57 E3 18 39 */ rlwinm. r3, r31, 3, 0, 0x1c +/* 80008984 000058E4 40 82 00 0C */ bne lbl_80008990 +/* 80008988 000058E8 3B 80 00 00 */ li r28, 0 +/* 8000898C 000058EC 48 00 00 1C */ b lbl_800089A8 +lbl_80008990: +/* 80008990 000058F0 3C 80 80 3D */ lis r4, lbl_803CBE74@ha +/* 80008994 000058F4 38 A0 00 00 */ li r5, 0 +/* 80008998 000058F8 38 84 BE 74 */ addi r4, r4, lbl_803CBE74@l +/* 8000899C 000058FC 38 84 00 37 */ addi r4, r4, 0x37 +/* 800089A0 00005900 48 30 CE 79 */ bl __nwa__FUlPCcPCc +/* 800089A4 00005904 7C 7C 1B 78 */ mr r28, r3 +lbl_800089A8: +/* 800089A8 00005908 80 1E 00 04 */ lwz r0, 4(r30) +/* 800089AC 0000590C 7F 9B E3 78 */ mr r27, r28 +/* 800089B0 00005910 83 5E 00 0C */ lwz r26, 0xc(r30) +/* 800089B4 00005914 54 00 18 38 */ slwi r0, r0, 3 +/* 800089B8 00005918 7F BA 02 14 */ add r29, r26, r0 +/* 800089BC 0000591C 93 41 00 10 */ stw r26, 0x10(r1) +/* 800089C0 00005920 93 A1 00 08 */ stw r29, 8(r1) +/* 800089C4 00005924 93 A1 00 0C */ stw r29, 0xc(r1) +/* 800089C8 00005928 93 41 00 14 */ stw r26, 0x14(r1) +/* 800089CC 0000592C 48 00 00 20 */ b lbl_800089EC +lbl_800089D0: +/* 800089D0 00005930 28 1B 00 00 */ cmplwi r27, 0 +/* 800089D4 00005934 41 82 00 10 */ beq lbl_800089E4 +/* 800089D8 00005938 7F 63 DB 78 */ mr r3, r27 +/* 800089DC 0000593C 7F 44 D3 78 */ mr r4, r26 +/* 800089E0 00005940 48 33 84 C9 */ bl __ct__6CTokenFRC6CToken +lbl_800089E4: +/* 800089E4 00005944 3B 7B 00 08 */ addi r27, r27, 8 +/* 800089E8 00005948 3B 5A 00 08 */ addi r26, r26, 8 +lbl_800089EC: +/* 800089EC 0000594C 7C 1A E8 40 */ cmplw r26, r29 +/* 800089F0 00005950 40 82 FF E0 */ bne lbl_800089D0 +/* 800089F4 00005954 80 1E 00 04 */ lwz r0, 4(r30) +/* 800089F8 00005958 83 5E 00 0C */ lwz r26, 0xc(r30) +/* 800089FC 0000595C 54 00 18 38 */ slwi r0, r0, 3 +/* 80008A00 00005960 7F 7A 02 14 */ add r27, r26, r0 +/* 80008A04 00005964 48 00 00 14 */ b lbl_80008A18 +lbl_80008A08: +/* 80008A08 00005968 7F 43 D3 78 */ mr r3, r26 +/* 80008A0C 0000596C 38 80 FF FF */ li r4, -1 +/* 80008A10 00005970 48 33 84 31 */ bl __dt__6CTokenFv +/* 80008A14 00005974 3B 5A 00 08 */ addi r26, r26, 8 +lbl_80008A18: +/* 80008A18 00005978 7C 1A D8 40 */ cmplw r26, r27 +/* 80008A1C 0000597C 40 82 FF EC */ bne lbl_80008A08 +/* 80008A20 00005980 80 7E 00 0C */ lwz r3, 0xc(r30) +/* 80008A24 00005984 28 03 00 00 */ cmplwi r3, 0 +/* 80008A28 00005988 41 82 00 08 */ beq lbl_80008A30 +/* 80008A2C 0000598C 48 30 CF 05 */ bl Free__7CMemoryFPCv +lbl_80008A30: +/* 80008A30 00005990 93 9E 00 0C */ stw r28, 0xc(r30) +/* 80008A34 00005994 93 FE 00 08 */ stw r31, 8(r30) +lbl_80008A38: +/* 80008A38 00005998 BB 41 00 18 */ lmw r26, 0x18(r1) +/* 80008A3C 0000599C 80 01 00 34 */ lwz r0, 0x34(r1) +/* 80008A40 000059A0 7C 08 03 A6 */ mtlr r0 +/* 80008A44 000059A4 38 21 00 30 */ addi r1, r1, 0x30 +/* 80008A48 000059A8 4E 80 00 20 */ blr + +.global "reserve__Q24rstl55vector,Q24rstl17rmemory_allocator>Fi" +"reserve__Q24rstl55vector,Q24rstl17rmemory_allocator>Fi": +/* 80008A4C 000059AC 94 21 FF D0 */ stwu r1, -0x30(r1) +/* 80008A50 000059B0 7C 08 02 A6 */ mflr r0 +/* 80008A54 000059B4 90 01 00 34 */ stw r0, 0x34(r1) +/* 80008A58 000059B8 93 E1 00 2C */ stw r31, 0x2c(r1) +/* 80008A5C 000059BC 7C 9F 23 78 */ mr r31, r4 +/* 80008A60 000059C0 93 C1 00 28 */ stw r30, 0x28(r1) +/* 80008A64 000059C4 7C 7E 1B 78 */ mr r30, r3 +/* 80008A68 000059C8 93 A1 00 24 */ stw r29, 0x24(r1) +/* 80008A6C 000059CC 80 03 00 08 */ lwz r0, 8(r3) +/* 80008A70 000059D0 7C 1F 00 00 */ cmpw r31, r0 +/* 80008A74 000059D4 40 81 00 B4 */ ble lbl_80008B28 +/* 80008A78 000059D8 57 E3 18 39 */ rlwinm. r3, r31, 3, 0, 0x1c +/* 80008A7C 000059DC 40 82 00 0C */ bne lbl_80008A88 +/* 80008A80 000059E0 3B A0 00 00 */ li r29, 0 +/* 80008A84 000059E4 48 00 00 1C */ b lbl_80008AA0 +lbl_80008A88: +/* 80008A88 000059E8 3C 80 80 3D */ lis r4, lbl_803CBE74@ha +/* 80008A8C 000059EC 38 A0 00 00 */ li r5, 0 +/* 80008A90 000059F0 38 84 BE 74 */ addi r4, r4, lbl_803CBE74@l +/* 80008A94 000059F4 38 84 00 37 */ addi r4, r4, 0x37 +/* 80008A98 000059F8 48 30 CD 81 */ bl __nwa__FUlPCcPCc +/* 80008A9C 000059FC 7C 7D 1B 78 */ mr r29, r3 +lbl_80008AA0: +/* 80008AA0 00005A00 80 1E 00 04 */ lwz r0, 4(r30) +/* 80008AA4 00005A04 7F A4 EB 78 */ mr r4, r29 +/* 80008AA8 00005A08 80 BE 00 0C */ lwz r5, 0xc(r30) +/* 80008AAC 00005A0C 54 00 18 38 */ slwi r0, r0, 3 +/* 80008AB0 00005A10 7C 65 02 14 */ add r3, r5, r0 +/* 80008AB4 00005A14 90 A1 00 10 */ stw r5, 0x10(r1) +/* 80008AB8 00005A18 90 61 00 08 */ stw r3, 8(r1) +/* 80008ABC 00005A1C 90 61 00 0C */ stw r3, 0xc(r1) +/* 80008AC0 00005A20 90 A1 00 14 */ stw r5, 0x14(r1) +/* 80008AC4 00005A24 48 00 00 24 */ b lbl_80008AE8 +lbl_80008AC8: +/* 80008AC8 00005A28 28 04 00 00 */ cmplwi r4, 0 +/* 80008ACC 00005A2C 41 82 00 14 */ beq lbl_80008AE0 +/* 80008AD0 00005A30 80 05 00 00 */ lwz r0, 0(r5) +/* 80008AD4 00005A34 90 04 00 00 */ stw r0, 0(r4) +/* 80008AD8 00005A38 80 05 00 04 */ lwz r0, 4(r5) +/* 80008ADC 00005A3C 90 04 00 04 */ stw r0, 4(r4) +lbl_80008AE0: +/* 80008AE0 00005A40 38 84 00 08 */ addi r4, r4, 8 +/* 80008AE4 00005A44 38 A5 00 08 */ addi r5, r5, 8 +lbl_80008AE8: +/* 80008AE8 00005A48 7C 05 18 40 */ cmplw r5, r3 +/* 80008AEC 00005A4C 40 82 FF DC */ bne lbl_80008AC8 +/* 80008AF0 00005A50 80 1E 00 04 */ lwz r0, 4(r30) +/* 80008AF4 00005A54 80 7E 00 0C */ lwz r3, 0xc(r30) +/* 80008AF8 00005A58 54 00 18 38 */ slwi r0, r0, 3 +/* 80008AFC 00005A5C 7C 64 1B 78 */ mr r4, r3 +/* 80008B00 00005A60 7C 03 02 14 */ add r0, r3, r0 +/* 80008B04 00005A64 48 00 00 08 */ b lbl_80008B0C +lbl_80008B08: +/* 80008B08 00005A68 38 84 00 08 */ addi r4, r4, 8 +lbl_80008B0C: +/* 80008B0C 00005A6C 7C 04 00 40 */ cmplw r4, r0 +/* 80008B10 00005A70 40 82 FF F8 */ bne lbl_80008B08 +/* 80008B14 00005A74 28 03 00 00 */ cmplwi r3, 0 +/* 80008B18 00005A78 41 82 00 08 */ beq lbl_80008B20 +/* 80008B1C 00005A7C 48 30 CE 15 */ bl Free__7CMemoryFPCv +lbl_80008B20: +/* 80008B20 00005A80 93 BE 00 0C */ stw r29, 0xc(r30) +/* 80008B24 00005A84 93 FE 00 08 */ stw r31, 8(r30) +lbl_80008B28: +/* 80008B28 00005A88 80 01 00 34 */ lwz r0, 0x34(r1) +/* 80008B2C 00005A8C 83 E1 00 2C */ lwz r31, 0x2c(r1) +/* 80008B30 00005A90 83 C1 00 28 */ lwz r30, 0x28(r1) +/* 80008B34 00005A94 83 A1 00 24 */ lwz r29, 0x24(r1) +/* 80008B38 00005A98 7C 08 03 A6 */ mtlr r0 +/* 80008B3C 00005A9C 38 21 00 30 */ addi r1, r1, 0x30 +/* 80008B40 00005AA0 4E 80 00 20 */ blr diff --git a/asm/Kyoto_CWD/text_80008894_80009144.s b/asm/Kyoto_CWD/text_80008894_80009144.s index bfb9f119..8a4f4a42 100644 --- a/asm/Kyoto_CWD/text_80008894_80009144.s +++ b/asm/Kyoto_CWD/text_80008894_80009144.s @@ -17,210 +17,6 @@ lbl_805A9D80: # CPlayer? - -.global "GetAverageValue__FPCfi" -"GetAverageValue__FPCfi": -/* 80008894 000057F4 94 21 FF F0 */ stwu r1, -0x10(r1) -/* 80008898 000057F8 54 80 10 3A */ slwi r0, r4, 2 -/* 8000889C 000057FC 38 C3 00 04 */ addi r6, r3, 4 -/* 800088A0 00005800 7C A3 02 14 */ add r5, r3, r0 -/* 800088A4 00005804 C0 63 00 00 */ lfs f3, 0(r3) -/* 800088A8 00005808 38 65 00 03 */ addi r3, r5, 3 -/* 800088AC 0000580C 7C 66 18 50 */ subf r3, r6, r3 -/* 800088B0 00005810 7C 06 28 40 */ cmplw r6, r5 -/* 800088B4 00005814 54 63 F0 BE */ srwi r3, r3, 2 -/* 800088B8 00005818 40 80 00 74 */ bge lbl_8000892C -/* 800088BC 0000581C 54 60 E8 FF */ rlwinm. r0, r3, 0x1d, 3, 0x1f -/* 800088C0 00005820 7C 09 03 A6 */ mtctr r0 -/* 800088C4 00005824 41 82 00 54 */ beq lbl_80008918 -lbl_800088C8: -/* 800088C8 00005828 C0 06 00 00 */ lfs f0, 0(r6) -/* 800088CC 0000582C EC 63 00 2A */ fadds f3, f3, f0 -/* 800088D0 00005830 C0 06 00 04 */ lfs f0, 4(r6) -/* 800088D4 00005834 EC 63 00 2A */ fadds f3, f3, f0 -/* 800088D8 00005838 C0 06 00 08 */ lfs f0, 8(r6) -/* 800088DC 0000583C EC 63 00 2A */ fadds f3, f3, f0 -/* 800088E0 00005840 C0 06 00 0C */ lfs f0, 0xc(r6) -/* 800088E4 00005844 EC 63 00 2A */ fadds f3, f3, f0 -/* 800088E8 00005848 C0 06 00 10 */ lfs f0, 0x10(r6) -/* 800088EC 0000584C EC 63 00 2A */ fadds f3, f3, f0 -/* 800088F0 00005850 C0 06 00 14 */ lfs f0, 0x14(r6) -/* 800088F4 00005854 EC 63 00 2A */ fadds f3, f3, f0 -/* 800088F8 00005858 C0 06 00 18 */ lfs f0, 0x18(r6) -/* 800088FC 0000585C EC 63 00 2A */ fadds f3, f3, f0 -/* 80008900 00005860 C0 06 00 1C */ lfs f0, 0x1c(r6) -/* 80008904 00005864 38 C6 00 20 */ addi r6, r6, 0x20 -/* 80008908 00005868 EC 63 00 2A */ fadds f3, f3, f0 -/* 8000890C 0000586C 42 00 FF BC */ bdnz lbl_800088C8 -/* 80008910 00005870 70 63 00 07 */ andi. r3, r3, 7 -/* 80008914 00005874 41 82 00 18 */ beq lbl_8000892C -lbl_80008918: -/* 80008918 00005878 7C 69 03 A6 */ mtctr r3 -lbl_8000891C: -/* 8000891C 0000587C C0 06 00 00 */ lfs f0, 0(r6) -/* 80008920 00005880 38 C6 00 04 */ addi r6, r6, 4 -/* 80008924 00005884 EC 63 00 2A */ fadds f3, f3, f0 -/* 80008928 00005888 42 00 FF F4 */ bdnz lbl_8000891C -lbl_8000892C: -/* 8000892C 0000588C 6C 83 80 00 */ xoris r3, r4, 0x8000 -/* 80008930 00005890 3C 00 43 30 */ lis r0, 0x4330 -/* 80008934 00005894 90 61 00 0C */ stw r3, 0xc(r1) -/* 80008938 00005898 C8 22 80 60 */ lfd f1, lbl_805A9D80@sda21(r2) -/* 8000893C 0000589C 90 01 00 08 */ stw r0, 8(r1) -/* 80008940 000058A0 C0 42 80 5C */ lfs f2, lbl_805A9D7C@sda21(r2) -/* 80008944 000058A4 C8 01 00 08 */ lfd f0, 8(r1) -/* 80008948 000058A8 EC 00 08 28 */ fsubs f0, f0, f1 -/* 8000894C 000058AC EC 02 00 24 */ fdivs f0, f2, f0 -/* 80008950 000058B0 EC 23 00 32 */ fmuls f1, f3, f0 -/* 80008954 000058B4 38 21 00 10 */ addi r1, r1, 0x10 -/* 80008958 000058B8 4E 80 00 20 */ blr - -.global "reserve__Q24rstl42vector<6CToken,Q24rstl17rmemory_allocator>Fi" -"reserve__Q24rstl42vector<6CToken,Q24rstl17rmemory_allocator>Fi": -/* 8000895C 000058BC 94 21 FF D0 */ stwu r1, -0x30(r1) -/* 80008960 000058C0 7C 08 02 A6 */ mflr r0 -/* 80008964 000058C4 90 01 00 34 */ stw r0, 0x34(r1) -/* 80008968 000058C8 BF 41 00 18 */ stmw r26, 0x18(r1) -/* 8000896C 000058CC 7C 9F 23 78 */ mr r31, r4 -/* 80008970 000058D0 7C 7E 1B 78 */ mr r30, r3 -/* 80008974 000058D4 80 03 00 08 */ lwz r0, 8(r3) -/* 80008978 000058D8 7C 1F 00 00 */ cmpw r31, r0 -/* 8000897C 000058DC 40 81 00 BC */ ble lbl_80008A38 -/* 80008980 000058E0 57 E3 18 39 */ rlwinm. r3, r31, 3, 0, 0x1c -/* 80008984 000058E4 40 82 00 0C */ bne lbl_80008990 -/* 80008988 000058E8 3B 80 00 00 */ li r28, 0 -/* 8000898C 000058EC 48 00 00 1C */ b lbl_800089A8 -lbl_80008990: -/* 80008990 000058F0 3C 80 80 3D */ lis r4, lbl_803CBE74@ha -/* 80008994 000058F4 38 A0 00 00 */ li r5, 0 -/* 80008998 000058F8 38 84 BE 74 */ addi r4, r4, lbl_803CBE74@l -/* 8000899C 000058FC 38 84 00 37 */ addi r4, r4, 0x37 -/* 800089A0 00005900 48 30 CE 79 */ bl __nwa__FUlPCcPCc -/* 800089A4 00005904 7C 7C 1B 78 */ mr r28, r3 -lbl_800089A8: -/* 800089A8 00005908 80 1E 00 04 */ lwz r0, 4(r30) -/* 800089AC 0000590C 7F 9B E3 78 */ mr r27, r28 -/* 800089B0 00005910 83 5E 00 0C */ lwz r26, 0xc(r30) -/* 800089B4 00005914 54 00 18 38 */ slwi r0, r0, 3 -/* 800089B8 00005918 7F BA 02 14 */ add r29, r26, r0 -/* 800089BC 0000591C 93 41 00 10 */ stw r26, 0x10(r1) -/* 800089C0 00005920 93 A1 00 08 */ stw r29, 8(r1) -/* 800089C4 00005924 93 A1 00 0C */ stw r29, 0xc(r1) -/* 800089C8 00005928 93 41 00 14 */ stw r26, 0x14(r1) -/* 800089CC 0000592C 48 00 00 20 */ b lbl_800089EC -lbl_800089D0: -/* 800089D0 00005930 28 1B 00 00 */ cmplwi r27, 0 -/* 800089D4 00005934 41 82 00 10 */ beq lbl_800089E4 -/* 800089D8 00005938 7F 63 DB 78 */ mr r3, r27 -/* 800089DC 0000593C 7F 44 D3 78 */ mr r4, r26 -/* 800089E0 00005940 48 33 84 C9 */ bl __ct__6CTokenFRC6CToken -lbl_800089E4: -/* 800089E4 00005944 3B 7B 00 08 */ addi r27, r27, 8 -/* 800089E8 00005948 3B 5A 00 08 */ addi r26, r26, 8 -lbl_800089EC: -/* 800089EC 0000594C 7C 1A E8 40 */ cmplw r26, r29 -/* 800089F0 00005950 40 82 FF E0 */ bne lbl_800089D0 -/* 800089F4 00005954 80 1E 00 04 */ lwz r0, 4(r30) -/* 800089F8 00005958 83 5E 00 0C */ lwz r26, 0xc(r30) -/* 800089FC 0000595C 54 00 18 38 */ slwi r0, r0, 3 -/* 80008A00 00005960 7F 7A 02 14 */ add r27, r26, r0 -/* 80008A04 00005964 48 00 00 14 */ b lbl_80008A18 -lbl_80008A08: -/* 80008A08 00005968 7F 43 D3 78 */ mr r3, r26 -/* 80008A0C 0000596C 38 80 FF FF */ li r4, -1 -/* 80008A10 00005970 48 33 84 31 */ bl __dt__6CTokenFv -/* 80008A14 00005974 3B 5A 00 08 */ addi r26, r26, 8 -lbl_80008A18: -/* 80008A18 00005978 7C 1A D8 40 */ cmplw r26, r27 -/* 80008A1C 0000597C 40 82 FF EC */ bne lbl_80008A08 -/* 80008A20 00005980 80 7E 00 0C */ lwz r3, 0xc(r30) -/* 80008A24 00005984 28 03 00 00 */ cmplwi r3, 0 -/* 80008A28 00005988 41 82 00 08 */ beq lbl_80008A30 -/* 80008A2C 0000598C 48 30 CF 05 */ bl Free__7CMemoryFPCv -lbl_80008A30: -/* 80008A30 00005990 93 9E 00 0C */ stw r28, 0xc(r30) -/* 80008A34 00005994 93 FE 00 08 */ stw r31, 8(r30) -lbl_80008A38: -/* 80008A38 00005998 BB 41 00 18 */ lmw r26, 0x18(r1) -/* 80008A3C 0000599C 80 01 00 34 */ lwz r0, 0x34(r1) -/* 80008A40 000059A0 7C 08 03 A6 */ mtlr r0 -/* 80008A44 000059A4 38 21 00 30 */ addi r1, r1, 0x30 -/* 80008A48 000059A8 4E 80 00 20 */ blr - -.global "reserve__Q24rstl47vector<10SScanState,Q24rstl17rmemory_allocator>Fi" -"reserve__Q24rstl47vector<10SScanState,Q24rstl17rmemory_allocator>Fi": -/* 80008A4C 000059AC 94 21 FF D0 */ stwu r1, -0x30(r1) -/* 80008A50 000059B0 7C 08 02 A6 */ mflr r0 -/* 80008A54 000059B4 90 01 00 34 */ stw r0, 0x34(r1) -/* 80008A58 000059B8 93 E1 00 2C */ stw r31, 0x2c(r1) -/* 80008A5C 000059BC 7C 9F 23 78 */ mr r31, r4 -/* 80008A60 000059C0 93 C1 00 28 */ stw r30, 0x28(r1) -/* 80008A64 000059C4 7C 7E 1B 78 */ mr r30, r3 -/* 80008A68 000059C8 93 A1 00 24 */ stw r29, 0x24(r1) -/* 80008A6C 000059CC 80 03 00 08 */ lwz r0, 8(r3) -/* 80008A70 000059D0 7C 1F 00 00 */ cmpw r31, r0 -/* 80008A74 000059D4 40 81 00 B4 */ ble lbl_80008B28 -/* 80008A78 000059D8 57 E3 18 39 */ rlwinm. r3, r31, 3, 0, 0x1c -/* 80008A7C 000059DC 40 82 00 0C */ bne lbl_80008A88 -/* 80008A80 000059E0 3B A0 00 00 */ li r29, 0 -/* 80008A84 000059E4 48 00 00 1C */ b lbl_80008AA0 -lbl_80008A88: -/* 80008A88 000059E8 3C 80 80 3D */ lis r4, lbl_803CBE74@ha -/* 80008A8C 000059EC 38 A0 00 00 */ li r5, 0 -/* 80008A90 000059F0 38 84 BE 74 */ addi r4, r4, lbl_803CBE74@l -/* 80008A94 000059F4 38 84 00 37 */ addi r4, r4, 0x37 -/* 80008A98 000059F8 48 30 CD 81 */ bl __nwa__FUlPCcPCc -/* 80008A9C 000059FC 7C 7D 1B 78 */ mr r29, r3 -lbl_80008AA0: -/* 80008AA0 00005A00 80 1E 00 04 */ lwz r0, 4(r30) -/* 80008AA4 00005A04 7F A4 EB 78 */ mr r4, r29 -/* 80008AA8 00005A08 80 BE 00 0C */ lwz r5, 0xc(r30) -/* 80008AAC 00005A0C 54 00 18 38 */ slwi r0, r0, 3 -/* 80008AB0 00005A10 7C 65 02 14 */ add r3, r5, r0 -/* 80008AB4 00005A14 90 A1 00 10 */ stw r5, 0x10(r1) -/* 80008AB8 00005A18 90 61 00 08 */ stw r3, 8(r1) -/* 80008ABC 00005A1C 90 61 00 0C */ stw r3, 0xc(r1) -/* 80008AC0 00005A20 90 A1 00 14 */ stw r5, 0x14(r1) -/* 80008AC4 00005A24 48 00 00 24 */ b lbl_80008AE8 -lbl_80008AC8: -/* 80008AC8 00005A28 28 04 00 00 */ cmplwi r4, 0 -/* 80008ACC 00005A2C 41 82 00 14 */ beq lbl_80008AE0 -/* 80008AD0 00005A30 80 05 00 00 */ lwz r0, 0(r5) -/* 80008AD4 00005A34 90 04 00 00 */ stw r0, 0(r4) -/* 80008AD8 00005A38 80 05 00 04 */ lwz r0, 4(r5) -/* 80008ADC 00005A3C 90 04 00 04 */ stw r0, 4(r4) -lbl_80008AE0: -/* 80008AE0 00005A40 38 84 00 08 */ addi r4, r4, 8 -/* 80008AE4 00005A44 38 A5 00 08 */ addi r5, r5, 8 -lbl_80008AE8: -/* 80008AE8 00005A48 7C 05 18 40 */ cmplw r5, r3 -/* 80008AEC 00005A4C 40 82 FF DC */ bne lbl_80008AC8 -/* 80008AF0 00005A50 80 1E 00 04 */ lwz r0, 4(r30) -/* 80008AF4 00005A54 80 7E 00 0C */ lwz r3, 0xc(r30) -/* 80008AF8 00005A58 54 00 18 38 */ slwi r0, r0, 3 -/* 80008AFC 00005A5C 7C 64 1B 78 */ mr r4, r3 -/* 80008B00 00005A60 7C 03 02 14 */ add r0, r3, r0 -/* 80008B04 00005A64 48 00 00 08 */ b lbl_80008B0C -lbl_80008B08: -/* 80008B08 00005A68 38 84 00 08 */ addi r4, r4, 8 -lbl_80008B0C: -/* 80008B0C 00005A6C 7C 04 00 40 */ cmplw r4, r0 -/* 80008B10 00005A70 40 82 FF F8 */ bne lbl_80008B08 -/* 80008B14 00005A74 28 03 00 00 */ cmplwi r3, 0 -/* 80008B18 00005A78 41 82 00 08 */ beq lbl_80008B20 -/* 80008B1C 00005A7C 48 30 CE 15 */ bl Free__7CMemoryFPCv -lbl_80008B20: -/* 80008B20 00005A80 93 BE 00 0C */ stw r29, 0xc(r30) -/* 80008B24 00005A84 93 FE 00 08 */ stw r31, 8(r30) -lbl_80008B28: -/* 80008B28 00005A88 80 01 00 34 */ lwz r0, 0x34(r1) -/* 80008B2C 00005A8C 83 E1 00 2C */ lwz r31, 0x2c(r1) -/* 80008B30 00005A90 83 C1 00 28 */ lwz r30, 0x28(r1) -/* 80008B34 00005A94 83 A1 00 24 */ lwz r29, 0x24(r1) -/* 80008B38 00005A98 7C 08 03 A6 */ mtlr r0 -/* 80008B3C 00005A9C 38 21 00 30 */ addi r1, r1, 0x30 -/* 80008B40 00005AA0 4E 80 00 20 */ blr - .global sub_80008b44 sub_80008b44: /* 80008B44 00005AA4 94 21 FF D0 */ stwu r1, -0x30(r1) diff --git a/asm/text.s b/asm/text.s index 42eda321..51440f5b 100644 --- a/asm/text.s +++ b/asm/text.s @@ -143040,7 +143040,7 @@ __ct__12CStringTableFR12CInputStream: /* 80356788 003536E8 90 01 00 1C */ stw r0, 0x1c(r1) /* 8035678C 003536EC 90 01 00 20 */ stw r0, 0x20(r1) /* 80356790 003536F0 90 01 00 24 */ stw r0, 0x24(r1) -/* 80356794 003536F4 4B CB 22 B9 */ bl "reserve__Q24rstl47vector<10SScanState,Q24rstl17rmemory_allocator>Fi" +/* 80356794 003536F4 4B CB 22 B9 */ bl "reserve__Q24rstl55vector,Q24rstl17rmemory_allocator>Fi" /* 80356798 003536F8 3B 40 00 00 */ li r26, 0 /* 8035679C 003536FC 48 00 00 70 */ b lbl_8035680C lbl_803567A0: @@ -143060,7 +143060,7 @@ lbl_803567A0: /* 803567D4 00353734 41 82 00 08 */ beq lbl_803567DC /* 803567D8 00353738 54 A4 08 3C */ slwi r4, r5, 1 lbl_803567DC: -/* 803567DC 0035373C 4B CB 22 71 */ bl "reserve__Q24rstl47vector<10SScanState,Q24rstl17rmemory_allocator>Fi" +/* 803567DC 0035373C 4B CB 22 71 */ bl "reserve__Q24rstl55vector,Q24rstl17rmemory_allocator>Fi" lbl_803567E0: /* 803567E0 00353740 80 01 00 1C */ lwz r0, 0x1c(r1) /* 803567E4 00353744 80 61 00 24 */ lwz r3, 0x24(r1) diff --git a/include/Dolphin/__start.h b/include/Dolphin/__start.h index 21413d58..9fa47a84 100644 --- a/include/Dolphin/__start.h +++ b/include/Dolphin/__start.h @@ -3,8 +3,6 @@ #define PAD3_BUTTON_ADDR 0x800030E4 #define OS_RESET_RESTART 0 -#define FALSE 0 -#define TRUE 1 #define EXCEPTIONMASK_ADDR 0x80000044 #define BOOTINFO2_ADDR 0x800000F4 #define OS_BI2_DEBUGFLAG_OFFSET 0xC diff --git a/include/Kyoto_CWD/CGameGlobalObjects.hpp b/include/Kyoto_CWD/CGameGlobalObjects.hpp index b412648f..ef7b537a 100644 --- a/include/Kyoto_CWD/CGameGlobalObjects.hpp +++ b/include/Kyoto_CWD/CGameGlobalObjects.hpp @@ -26,12 +26,7 @@ public: void PostInitialize(COsContext&, CMemorySys&); - CGameState* GameState() { return x134_gameState.get(); } - - void SetGameState(CGameState* gameState) { - x134_gameState = gameState; - gpGameState = x134_gameState.get(); - } + rstl::single_ptr< CGameState >& GameState() { return x134_gameState; } private: rstl::single_ptr< CMemoryCardSys > x0_memoryCardSys; diff --git a/include/Kyoto_CWD/CGameOptions.hpp b/include/Kyoto_CWD/CGameOptions.hpp index da8f1fc2..bd3eecdb 100644 --- a/include/Kyoto_CWD/CGameOptions.hpp +++ b/include/Kyoto_CWD/CGameOptions.hpp @@ -8,14 +8,12 @@ #include "rstl/vector.hpp" #include "CInputStream.hpp" +#include "TGameTypes.hpp" class CGameOptions { public: CGameOptions(); - CGameOptions(const CGameOptions&); CGameOptions(CInputStream& in); - ~CGameOptions(); - CGameOptions& operator=(const CGameOptions&); void EnsureOptions(); @@ -35,7 +33,7 @@ private: bool x68_26_rumble : 1; bool x68_27_swapBeamsControls : 1; bool x68_28_hintSystem : 1; - rstl::vector< rstl::pair< int, int > > x6c_; + rstl::vector< rstl::pair< CAssetId, CAssetId > > x6c_controlTxtrMap; }; #endif diff --git a/include/Kyoto_CWD/CGameState.hpp b/include/Kyoto_CWD/CGameState.hpp index 65f15361..d68461f7 100644 --- a/include/Kyoto_CWD/CGameState.hpp +++ b/include/Kyoto_CWD/CGameState.hpp @@ -20,9 +20,6 @@ class CGameState { public: CGameState(); CGameState(CInputStream& in, int saveIdx); - CGameState(const CGameState&); - ~CGameState(); - CGameState& operator=(const CGameState&); rstl::rc_ptr< CPlayerState >& PlayerState(); CAssetId CurrentWorldAssetId(); diff --git a/include/Kyoto_CWD/CMain.hpp b/include/Kyoto_CWD/CMain.hpp index 377aa60a..87a9505d 100644 --- a/include/Kyoto_CWD/CMain.hpp +++ b/include/Kyoto_CWD/CMain.hpp @@ -24,7 +24,7 @@ public: void RefreshGameState(); void AddWorldPaks(); void AsyncIdle(u32 time); - int RsMain(int argc, char** argv); + int RsMain(int argc, const char* const* argv); void InitializeSubsystems(); void FillInAssetIDs(); void ShutdownSubsystems(); diff --git a/include/Kyoto_CWD/CSystemOptions.hpp b/include/Kyoto_CWD/CSystemOptions.hpp index ec6af654..eeae256d 100644 --- a/include/Kyoto_CWD/CSystemOptions.hpp +++ b/include/Kyoto_CWD/CSystemOptions.hpp @@ -11,9 +11,6 @@ class CSystemOptions { public: CSystemOptions(); - CSystemOptions(const CSystemOptions&); - ~CSystemOptions(); - CSystemOptions& operator=(const CSystemOptions&); void SetHasFusion(bool v); bool GetHasFusion() const { return xd0_27_fusionBeat; } diff --git a/include/Kyoto_CWD/TGameTypes.hpp b/include/Kyoto_CWD/TGameTypes.hpp index 947a96cc..8171d329 100644 --- a/include/Kyoto_CWD/TGameTypes.hpp +++ b/include/Kyoto_CWD/TGameTypes.hpp @@ -4,7 +4,7 @@ #include "types.h" typedef s32 TAreaId; -typedef u32 TEditorId; +typedef s32 TEditorId; typedef u16 TUniqueId; extern TAreaId kInvalidAreaId; diff --git a/include/rstl/construct.hpp b/include/rstl/construct.hpp index 27f372a0..72ef98b2 100644 --- a/include/rstl/construct.hpp +++ b/include/rstl/construct.hpp @@ -6,13 +6,15 @@ namespace rstl { template < typename T > inline void construct(void* dest, const T& src) { - new(dest) T(src); + new (dest) T(src); } template < typename T > inline void destroy(T* in) { in->~T(); } +// template < typename T > +// inline void destroy(const T* in) {} template < typename Iter > inline void destroy(Iter begin, Iter end) { @@ -22,16 +24,47 @@ inline void destroy(Iter begin, Iter end) { ++current; } } +template < typename S > +inline void destroy(S* begin, S* end) { + S* current = begin; + while (current != end) { + destroy(current); + ++current; + } +} template < typename Iter, typename T > -inline void uninitialized_copy(Iter begin, Iter end, T* in) { +inline void uninitialized_copy(Iter begin, Iter end, T* out) { Iter current = begin; while (current != end) { - current = *in; + construct(out, *current); + current.destroy(); + ++out; ++current; } } +template < typename S, typename D > +inline void uninitialized_copy(D* out, S* begin, S* end) { + while (begin != end) { + construct(out, *begin); + ++out; + ++begin; + } + // rstl::destroy(begin, end); +} + +// FIXME this is a hack around regalloc +// need to figure out the proper types/positions for all of these funcs +template < typename S, typename D > +inline void uninitialized_copy_2(S* begin, D* out, S* end) { + while (begin != end) { + construct(out, *begin); + ++out; + ++begin; + } +} + template < typename S, typename D > inline void uninitialized_copy_n(D* dest, S* src, size_t count) { for (size_t i = 0; i < count; ++dest, ++i, ++src) { diff --git a/include/rstl/reserved_vector.hpp b/include/rstl/reserved_vector.hpp index 4a71140e..46fe0564 100644 --- a/include/rstl/reserved_vector.hpp +++ b/include/rstl/reserved_vector.hpp @@ -21,10 +21,27 @@ public: inline iterator end() { return iterator(x4_items + x0_count); } inline const_iterator end() const { return const_iterator(x4_items + x0_count); } - ~reserved_vector() { - for (u32 i = x0_count; i > 0; --i) { + reserved_vector(const reserved_vector& other) { + x0_count = other.size(); + rstl::uninitialized_copy_n(data(), other.data(), size()); + } + reserved_vector& operator=(const reserved_vector& other) { + if (this != &other) { + clear(); + rstl::uninitialized_copy_2(other.data(), data(), other.data() + other.size()); + x0_count = other.x0_count; + } + return *this; + } + void clear() { + for (size_t i = 0; i < x0_count; ++i) { rstl::destroy(&x4_items[i]); } + x0_count = 0; + } + + ~reserved_vector() { + clear(); } void push_back(const T& in) { diff --git a/include/rstl/vector.hpp b/include/rstl/vector.hpp index 0ef9e01b..518a4b4a 100644 --- a/include/rstl/vector.hpp +++ b/include/rstl/vector.hpp @@ -44,16 +44,8 @@ public: x0_allocator.deallocate(xc_items); } - void reserve(size_t size); /* { - if (x8_capacity >= size) return; - T* newData; - Alloc::allocate(newData, size); - uninitialized_copy_n(newData, x4_count, xc_items); - rstl::destroy(begin(), end()); - Alloc::deallocate(xc_items); - xc_items = newData; - x8_capacity = size; - }*/ + void reserve(size_t size); + void push_back(const T& in) { if (x4_count >= x8_capacity) { reserve(x8_capacity != 0 ? x8_capacity * 2 : 4); @@ -63,6 +55,28 @@ public: ++x4_count; } + vector& operator=(const vector& other) { + if (this == &other) + return *this; + clear(); + if (other.size() == 0) { + x0_allocator.deallocate(xc_items); + x4_count = 0; + x8_capacity = 0; + xc_items = nullptr; + } else { + reserve(other.size()); + rstl::uninitialized_copy(data(), other.data(), other.data() + other.size()); + x4_count = other.x4_count; + } + return *this; + } + + void clear() { + rstl::destroy(begin(), end()); + x4_count = 0; + } + inline T* data() { return xc_items; } inline const T* data() const { return xc_items; } inline size_t size() const { return x4_count; } @@ -74,6 +88,24 @@ public: inline T& operator[](size_t idx) { return xc_items[idx]; } inline const T& operator[](size_t idx) const { return xc_items[idx]; } }; + +template < typename T, typename Alloc > +void vector< T, Alloc >::reserve(size_t size) { + if (size <= x8_capacity) + return; + size_t sz = size * sizeof(T); + T* newData; + if (sz == 0) { + newData = nullptr; + } else { + x0_allocator.allocate(newData, sz); + } + rstl::uninitialized_copy(begin(), end(), newData); + rstl::destroy(xc_items, xc_items + x4_count); + x0_allocator.deallocate(xc_items); + xc_items = newData; + x8_capacity = size; +} } // namespace rstl #endif diff --git a/include/types.h b/include/types.h index 1b7fa693..388426d7 100644 --- a/include/types.h +++ b/include/types.h @@ -7,12 +7,12 @@ extern "C" { typedef unsigned char u8; typedef unsigned short u16; -typedef unsigned long u32; +typedef unsigned int u32; typedef unsigned long long u64; typedef char s8; typedef short s16; -typedef long s32; +typedef int s32; typedef long long s64; typedef volatile u8 vu8; diff --git a/src/Kyoto_CWD/main.cpp b/src/Kyoto_CWD/main.cpp index d647e1a3..b2e9389c 100644 --- a/src/Kyoto_CWD/main.cpp +++ b/src/Kyoto_CWD/main.cpp @@ -65,8 +65,10 @@ void CMain::RegisterResourceTweaks() { x70_tweaks.RegisterResourceTweaks(); } void CMain::ResetGameState() { CSystemOptions persistentOptions = gpGameState->SystemOptions(); CGameOptions gameOptions = gpGameState->GameOptions(); - x128_gameGlobalObjects->SetGameState(nullptr); - x128_gameGlobalObjects->SetGameState(new CGameState()); + x128_gameGlobalObjects->GameState() = nullptr; + gpGameState = nullptr; + x128_gameGlobalObjects->GameState() = new CGameState(); + gpGameState = x128_gameGlobalObjects->GameState().get(); gpGameState->SystemOptions() = persistentOptions; gpGameState->GameOptions() = gameOptions; gpGameState->GameOptions().EnsureOptions(); @@ -76,8 +78,10 @@ void CMain::ResetGameState() { // 800044A4 void CMain::StreamNewGameState(CInputStream& in, int saveIdx) { bool hasFusion = gpGameState->SystemOptions().GetHasFusion(); - x128_gameGlobalObjects->SetGameState(nullptr); - x128_gameGlobalObjects->SetGameState(new CGameState(in, saveIdx)); + x128_gameGlobalObjects->GameState() = nullptr; + gpGameState = nullptr; + x128_gameGlobalObjects->GameState() = new CGameState(in, saveIdx); + gpGameState = x128_gameGlobalObjects->GameState().get(); gpGameState->SystemOptions().SetHasFusion(hasFusion); gpGameState->PlayerState()->SetIsFusionEnabled(gpGameState->SystemOptions().GetHasFusion()); gpGameState->HintOptions().SetHintNextTime(); @@ -90,12 +94,13 @@ void CMain::RefreshGameState() { u64 cardSerial = gpGameState->CardSerial(); rstl::vector< u8 > backupBuf = gpGameState->BackupBuf(); CGameOptions gameOptions = gpGameState->GameOptions(); - x128_gameGlobalObjects->SetGameState(nullptr); + x128_gameGlobalObjects->GameState() = nullptr; + gpGameState = nullptr; { CMemoryInStream stream(backupBuf.data(), backupBuf.size(), CMemoryInStream::Owned); - x128_gameGlobalObjects->SetGameState(new CGameState(stream, saveIdx)); + x128_gameGlobalObjects->GameState() = new CGameState(stream, saveIdx); } - // gpGameState = x128_gameGlobalObjects->x134_gameState.get(); + gpGameState = x128_gameGlobalObjects->GameState().get(); gpGameState->SystemOptions() = systemOptions; gpGameState->GameOptions() = gameOptions; gpGameState->GameOptions().EnsureOptions(); @@ -150,7 +155,7 @@ void CMain::AsyncIdle(u32 time) { } // 80004DC8 -int CMain::RsMain(int argc, char** argv) { +int CMain::RsMain(int argc, const char* const* argv) { PPCSetFpIEEEMode(); CStopwatch timer; LCEnable();