From 6a471a6abe54d8e987304dc498a48b06bc014563 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Mon, 18 Jul 2022 13:53:58 -0400 Subject: [PATCH] Link CInputStream.cpp Former-commit-id: 69ddd71fc89fa327ec446b2fd0a2d5e693969940 --- Makefile | 2 +- asm/Kyoto/Streams/CInputStream.s | 4 +- asm/MetroidPrime/CMapWorldInfo.s | 8 +- asm/MetroidPrime/CScriptMailbox.s | 2 +- asm/MetroidPrime/Player/CGameHintInfo.s | 4 +- asm/MetroidPrime/Player/CGameOptions.s | 30 +++---- asm/MetroidPrime/Player/CGameState.s | 58 ++++++------ asm/MetroidPrime/Player/CPlayerState.s | 18 ++-- asm/MetroidPrime/Player/CWorldLayerState.s | 4 +- asm/MetroidPrime/main.s | 6 +- include/Kyoto_CWD/CInputStream.hpp | 16 ++-- obj_files.mk | 2 +- src/Kyoto/Streams/CInputStream.cpp | 100 ++++++++++++--------- 13 files changed, 137 insertions(+), 117 deletions(-) diff --git a/Makefile b/Makefile index b4878587..52d1139e 100644 --- a/Makefile +++ b/Makefile @@ -101,7 +101,7 @@ ifeq ($(VERBOSE),0) # this set of LDFLAGS generates no warnings. LDFLAGS := $(MAPGEN) -fp fmadd -nodefaults -w off endif -CFLAGS_1.2 = -proc gekko -nodefaults -Cpp_exceptions off -RTTI off -fp fmadd -str reuse,pool,readonly -rostr -O4,p -maxerrors 1 -use_lmw_stmw on -enum int -inline auto -MMD $(INCLUDES) +CFLAGS_1.2 = -proc gekko -nodefaults -Cpp_exceptions off -RTTI off -fp fmadd -str reuse,pool,readonly -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/Streams/CInputStream.s b/asm/Kyoto/Streams/CInputStream.s index 2401831d..c605f3f8 100644 --- a/asm/Kyoto/Streams/CInputStream.s +++ b/asm/Kyoto/Streams/CInputStream.s @@ -119,8 +119,8 @@ ReadChar__12CInputStreamFv: /* 8033ED30 0033BC90 38 21 00 10 */ addi r1, r1, 0x10 /* 8033ED34 0033BC94 4E 80 00 20 */ blr -.global ReadBits__12CInputStreamFi -ReadBits__12CInputStreamFi: +.global ReadBits__12CInputStreamFUi +ReadBits__12CInputStreamFUi: /* 8033ED38 0033BC98 94 21 FF E0 */ stwu r1, -0x20(r1) /* 8033ED3C 0033BC9C 7C 08 02 A6 */ mflr r0 /* 8033ED40 0033BCA0 90 01 00 24 */ stw r0, 0x24(r1) diff --git a/asm/MetroidPrime/CMapWorldInfo.s b/asm/MetroidPrime/CMapWorldInfo.s index 4453b343..018d8eeb 100644 --- a/asm/MetroidPrime/CMapWorldInfo.s +++ b/asm/MetroidPrime/CMapWorldInfo.s @@ -1413,7 +1413,7 @@ __ct__13CMapWorldInfoFR16CBitStreamReaderRC10CSaveWorldUi: lbl_80168FE0: /* 80168FE0 00165F40 7F 23 CB 78 */ mr r3, r25 /* 80168FE4 00165F44 38 80 00 01 */ li r4, 1 -/* 80168FE8 00165F48 48 1D 5D 51 */ bl ReadBits__12CInputStreamFi +/* 80168FE8 00165F48 48 1D 5D 51 */ bl ReadBits__12CInputStreamFUi /* 80168FEC 00165F4C 80 98 00 00 */ lwz r4, 0(r24) /* 80168FF0 00165F50 7C 03 00 D0 */ neg r0, r3 /* 80168FF4 00165F54 7C 05 1B 78 */ or r5, r0, r3 @@ -1499,7 +1499,7 @@ lbl_801690F0: lbl_80169118: /* 80169118 00166078 7F 23 CB 78 */ mr r3, r25 /* 8016911C 0016607C 38 80 00 01 */ li r4, 1 -/* 80169120 00166080 48 1D 5C 19 */ bl ReadBits__12CInputStreamFi +/* 80169120 00166080 48 1D 5C 19 */ bl ReadBits__12CInputStreamFUi /* 80169124 00166084 80 98 00 14 */ lwz r4, 0x14(r24) /* 80169128 00166088 7C 03 00 D0 */ neg r0, r3 /* 8016912C 0016608C 7C 05 1B 78 */ or r5, r0, r3 @@ -1583,7 +1583,7 @@ lbl_80169228: lbl_80169248: /* 80169248 001661A8 7F 23 CB 78 */ mr r3, r25 /* 8016924C 001661AC 38 80 00 01 */ li r4, 1 -/* 80169250 001661B0 48 1D 5A E9 */ bl ReadBits__12CInputStreamFi +/* 80169250 001661B0 48 1D 5A E9 */ bl ReadBits__12CInputStreamFUi /* 80169254 001661B4 57 60 D8 08 */ slwi r0, r27, 0x1b /* 80169258 001661B8 57 64 0F FE */ srwi r4, r27, 0x1f /* 8016925C 001661BC 7F 65 2E 70 */ srawi r5, r27, 5 @@ -1620,7 +1620,7 @@ lbl_801692C4: /* 801692CC 0016622C 41 80 FF 7C */ blt lbl_80169248 /* 801692D0 00166230 7F 23 CB 78 */ mr r3, r25 /* 801692D4 00166234 38 80 00 01 */ li r4, 1 -/* 801692D8 00166238 48 1D 5A 61 */ bl ReadBits__12CInputStreamFi +/* 801692D8 00166238 48 1D 5A 61 */ bl ReadBits__12CInputStreamFUi /* 801692DC 0016623C 7C 83 00 D0 */ neg r4, r3 /* 801692E0 00166240 88 01 00 10 */ lbz r0, 0x10(r1) /* 801692E4 00166244 7C 84 1B 78 */ or r4, r4, r3 diff --git a/asm/MetroidPrime/CScriptMailbox.s b/asm/MetroidPrime/CScriptMailbox.s index ad8b7050..dceba8cf 100644 --- a/asm/MetroidPrime/CScriptMailbox.s +++ b/asm/MetroidPrime/CScriptMailbox.s @@ -403,7 +403,7 @@ lbl_800E1F38: lbl_800E1F48: /* 800E1F48 000DEEA8 7F 43 D3 78 */ mr r3, r26 /* 800E1F4C 000DEEAC 38 80 00 01 */ li r4, 1 -/* 800E1F50 000DEEB0 48 25 CD E9 */ bl ReadBits__12CInputStreamFi +/* 800E1F50 000DEEB0 48 25 CD E9 */ bl ReadBits__12CInputStreamFUi /* 800E1F54 000DEEB4 7C 03 00 D0 */ neg r0, r3 /* 800E1F58 000DEEB8 3B 7B 00 01 */ addi r27, r27, 1 /* 800E1F5C 000DEEBC 7C 00 1B 78 */ or r0, r0, r3 diff --git a/asm/MetroidPrime/Player/CGameHintInfo.s b/asm/MetroidPrime/Player/CGameHintInfo.s index 842c9d5f..f3c090eb 100644 --- a/asm/MetroidPrime/Player/CGameHintInfo.s +++ b/asm/MetroidPrime/Player/CGameHintInfo.s @@ -907,12 +907,12 @@ lbl_80267D14: /* 80267D18 00264C78 48 00 05 AD */ bl GetBitCount__16CGameHintManagerFi /* 80267D1C 00264C7C 7C 64 1B 78 */ mr r4, r3 /* 80267D20 00264C80 7F A3 EB 78 */ mr r3, r29 -/* 80267D24 00264C84 48 0D 70 15 */ bl ReadBits__12CInputStreamFi +/* 80267D24 00264C84 48 0D 70 15 */ bl ReadBits__12CInputStreamFUi /* 80267D28 00264C88 7C 60 1B 78 */ mr r0, r3 /* 80267D2C 00264C8C 7F A3 EB 78 */ mr r3, r29 /* 80267D30 00264C90 7C 1E 03 78 */ mr r30, r0 /* 80267D34 00264C94 38 80 00 20 */ li r4, 0x20 -/* 80267D38 00264C98 48 0D 70 01 */ bl ReadBits__12CInputStreamFi +/* 80267D38 00264C98 48 0D 70 01 */ bl ReadBits__12CInputStreamFUi /* 80267D3C 00264C9C 38 9E FF FF */ addi r4, r30, -1 /* 80267D40 00264CA0 90 61 00 08 */ stw r3, 8(r1) /* 80267D44 00264CA4 38 A0 00 01 */ li r5, 1 diff --git a/asm/MetroidPrime/Player/CGameOptions.s b/asm/MetroidPrime/Player/CGameOptions.s index 1a278db5..a7f2df48 100644 --- a/asm/MetroidPrime/Player/CGameOptions.s +++ b/asm/MetroidPrime/Player/CGameOptions.s @@ -1082,7 +1082,7 @@ lbl_8020F55C: lbl_8020F5F0: /* 8020F5F0 0020C550 7F E3 FB 78 */ mr r3, r31 /* 8020F5F4 0020C554 38 80 00 08 */ li r4, 8 -/* 8020F5F8 0020C558 48 12 F7 41 */ bl ReadBits__12CInputStreamFi +/* 8020F5F8 0020C558 48 12 F7 41 */ bl ReadBits__12CInputStreamFUi /* 8020F5FC 0020C55C 7C 9E EA 14 */ add r4, r30, r29 /* 8020F600 0020C560 3B BD 00 01 */ addi r29, r29, 1 /* 8020F604 0020C564 98 64 00 04 */ stb r3, 4(r4) @@ -1094,62 +1094,62 @@ lbl_8020F608: /* 8020F618 0020C578 48 00 03 69 */ bl CalculateBits__Fi /* 8020F61C 0020C57C 7C 64 1B 78 */ mr r4, r3 /* 8020F620 0020C580 7F E3 FB 78 */ mr r3, r31 -/* 8020F624 0020C584 48 12 F7 15 */ bl ReadBits__12CInputStreamFi +/* 8020F624 0020C584 48 12 F7 15 */ bl ReadBits__12CInputStreamFUi /* 8020F628 0020C588 90 7E 00 44 */ stw r3, 0x44(r30) /* 8020F62C 0020C58C 38 60 00 08 */ li r3, 8 /* 8020F630 0020C590 48 00 03 51 */ bl CalculateBits__Fi /* 8020F634 0020C594 7C 64 1B 78 */ mr r4, r3 /* 8020F638 0020C598 7F E3 FB 78 */ mr r3, r31 -/* 8020F63C 0020C59C 48 12 F6 FD */ bl ReadBits__12CInputStreamFi +/* 8020F63C 0020C59C 48 12 F6 FD */ bl ReadBits__12CInputStreamFUi /* 8020F640 0020C5A0 90 7E 00 48 */ stw r3, 0x48(r30) /* 8020F644 0020C5A4 38 60 00 3C */ li r3, 0x3c /* 8020F648 0020C5A8 48 00 03 39 */ bl CalculateBits__Fi /* 8020F64C 0020C5AC 7C 64 1B 78 */ mr r4, r3 /* 8020F650 0020C5B0 7F E3 FB 78 */ mr r3, r31 -/* 8020F654 0020C5B4 48 12 F6 E5 */ bl ReadBits__12CInputStreamFi +/* 8020F654 0020C5B4 48 12 F6 E5 */ bl ReadBits__12CInputStreamFUi /* 8020F658 0020C5B8 38 03 FF E2 */ addi r0, r3, -30 /* 8020F65C 0020C5BC 38 60 00 3C */ li r3, 0x3c /* 8020F660 0020C5C0 90 1E 00 4C */ stw r0, 0x4c(r30) /* 8020F664 0020C5C4 48 00 03 1D */ bl CalculateBits__Fi /* 8020F668 0020C5C8 7C 64 1B 78 */ mr r4, r3 /* 8020F66C 0020C5CC 7F E3 FB 78 */ mr r3, r31 -/* 8020F670 0020C5D0 48 12 F6 C9 */ bl ReadBits__12CInputStreamFi +/* 8020F670 0020C5D0 48 12 F6 C9 */ bl ReadBits__12CInputStreamFUi /* 8020F674 0020C5D4 38 03 FF E2 */ addi r0, r3, -30 /* 8020F678 0020C5D8 38 60 00 14 */ li r3, 0x14 /* 8020F67C 0020C5DC 90 1E 00 50 */ stw r0, 0x50(r30) /* 8020F680 0020C5E0 48 00 03 01 */ bl CalculateBits__Fi /* 8020F684 0020C5E4 7C 64 1B 78 */ mr r4, r3 /* 8020F688 0020C5E8 7F E3 FB 78 */ mr r3, r31 -/* 8020F68C 0020C5EC 48 12 F6 AD */ bl ReadBits__12CInputStreamFi +/* 8020F68C 0020C5EC 48 12 F6 AD */ bl ReadBits__12CInputStreamFUi /* 8020F690 0020C5F0 38 03 FF F6 */ addi r0, r3, -10 /* 8020F694 0020C5F4 38 60 00 7F */ li r3, 0x7f /* 8020F698 0020C5F8 90 1E 00 54 */ stw r0, 0x54(r30) /* 8020F69C 0020C5FC 48 00 02 E5 */ bl CalculateBits__Fi /* 8020F6A0 0020C600 7C 64 1B 78 */ mr r4, r3 /* 8020F6A4 0020C604 7F E3 FB 78 */ mr r3, r31 -/* 8020F6A8 0020C608 48 12 F6 91 */ bl ReadBits__12CInputStreamFi +/* 8020F6A8 0020C608 48 12 F6 91 */ bl ReadBits__12CInputStreamFUi /* 8020F6AC 0020C60C 90 7E 00 58 */ stw r3, 0x58(r30) /* 8020F6B0 0020C610 38 60 00 7F */ li r3, 0x7f /* 8020F6B4 0020C614 48 00 02 CD */ bl CalculateBits__Fi /* 8020F6B8 0020C618 7C 64 1B 78 */ mr r4, r3 /* 8020F6BC 0020C61C 7F E3 FB 78 */ mr r3, r31 -/* 8020F6C0 0020C620 48 12 F6 79 */ bl ReadBits__12CInputStreamFi +/* 8020F6C0 0020C620 48 12 F6 79 */ bl ReadBits__12CInputStreamFUi /* 8020F6C4 0020C624 90 7E 00 5C */ stw r3, 0x5c(r30) /* 8020F6C8 0020C628 38 60 00 FF */ li r3, 0xff /* 8020F6CC 0020C62C 48 00 02 B5 */ bl CalculateBits__Fi /* 8020F6D0 0020C630 7C 64 1B 78 */ mr r4, r3 /* 8020F6D4 0020C634 7F E3 FB 78 */ mr r3, r31 -/* 8020F6D8 0020C638 48 12 F6 61 */ bl ReadBits__12CInputStreamFi +/* 8020F6D8 0020C638 48 12 F6 61 */ bl ReadBits__12CInputStreamFUi /* 8020F6DC 0020C63C 90 7E 00 60 */ stw r3, 0x60(r30) /* 8020F6E0 0020C640 38 60 00 FF */ li r3, 0xff /* 8020F6E4 0020C644 48 00 02 9D */ bl CalculateBits__Fi /* 8020F6E8 0020C648 7C 64 1B 78 */ mr r4, r3 /* 8020F6EC 0020C64C 7F E3 FB 78 */ mr r3, r31 -/* 8020F6F0 0020C650 48 12 F6 49 */ bl ReadBits__12CInputStreamFi +/* 8020F6F0 0020C650 48 12 F6 49 */ bl ReadBits__12CInputStreamFUi /* 8020F6F4 0020C654 90 7E 00 64 */ stw r3, 0x64(r30) /* 8020F6F8 0020C658 7F E3 FB 78 */ mr r3, r31 /* 8020F6FC 0020C65C 38 80 00 01 */ li r4, 1 -/* 8020F700 0020C660 48 12 F6 39 */ bl ReadBits__12CInputStreamFi +/* 8020F700 0020C660 48 12 F6 39 */ bl ReadBits__12CInputStreamFUi /* 8020F704 0020C664 7C 83 00 D0 */ neg r4, r3 /* 8020F708 0020C668 88 1E 00 68 */ lbz r0, 0x68(r30) /* 8020F70C 0020C66C 7C 84 1B 78 */ or r4, r4, r3 @@ -1158,7 +1158,7 @@ lbl_8020F608: /* 8020F718 0020C678 38 80 00 01 */ li r4, 1 /* 8020F71C 0020C67C 50 A0 3E 30 */ rlwimi r0, r5, 7, 0x18, 0x18 /* 8020F720 0020C680 98 1E 00 68 */ stb r0, 0x68(r30) -/* 8020F724 0020C684 48 12 F6 15 */ bl ReadBits__12CInputStreamFi +/* 8020F724 0020C684 48 12 F6 15 */ bl ReadBits__12CInputStreamFUi /* 8020F728 0020C688 7C 83 00 D0 */ neg r4, r3 /* 8020F72C 0020C68C 88 1E 00 68 */ lbz r0, 0x68(r30) /* 8020F730 0020C690 7C 84 1B 78 */ or r4, r4, r3 @@ -1167,7 +1167,7 @@ lbl_8020F608: /* 8020F73C 0020C69C 38 80 00 01 */ li r4, 1 /* 8020F740 0020C6A0 50 A0 1F 38 */ rlwimi r0, r5, 3, 0x1c, 0x1c /* 8020F744 0020C6A4 98 1E 00 68 */ stb r0, 0x68(r30) -/* 8020F748 0020C6A8 48 12 F5 F1 */ bl ReadBits__12CInputStreamFi +/* 8020F748 0020C6A8 48 12 F5 F1 */ bl ReadBits__12CInputStreamFUi /* 8020F74C 0020C6AC 7C 83 00 D0 */ neg r4, r3 /* 8020F750 0020C6B0 88 1E 00 68 */ lbz r0, 0x68(r30) /* 8020F754 0020C6B4 7C 84 1B 78 */ or r4, r4, r3 @@ -1176,7 +1176,7 @@ lbl_8020F608: /* 8020F760 0020C6C0 38 80 00 01 */ li r4, 1 /* 8020F764 0020C6C4 50 A0 36 72 */ rlwimi r0, r5, 6, 0x19, 0x19 /* 8020F768 0020C6C8 98 1E 00 68 */ stb r0, 0x68(r30) -/* 8020F76C 0020C6CC 48 12 F5 CD */ bl ReadBits__12CInputStreamFi +/* 8020F76C 0020C6CC 48 12 F5 CD */ bl ReadBits__12CInputStreamFUi /* 8020F770 0020C6D0 7C 83 00 D0 */ neg r4, r3 /* 8020F774 0020C6D4 88 1E 00 68 */ lbz r0, 0x68(r30) /* 8020F778 0020C6D8 7C 84 1B 78 */ or r4, r4, r3 @@ -1185,7 +1185,7 @@ lbl_8020F608: /* 8020F784 0020C6E4 38 80 00 01 */ li r4, 1 /* 8020F788 0020C6E8 50 A0 2E B4 */ rlwimi r0, r5, 5, 0x1a, 0x1a /* 8020F78C 0020C6EC 98 1E 00 68 */ stb r0, 0x68(r30) -/* 8020F790 0020C6F0 48 12 F5 A9 */ bl ReadBits__12CInputStreamFi +/* 8020F790 0020C6F0 48 12 F5 A9 */ bl ReadBits__12CInputStreamFUi /* 8020F794 0020C6F4 7C 83 00 D0 */ neg r4, r3 /* 8020F798 0020C6F8 88 1E 00 68 */ lbz r0, 0x68(r30) /* 8020F79C 0020C6FC 7C 84 1B 78 */ or r4, r4, r3 diff --git a/asm/MetroidPrime/Player/CGameState.s b/asm/MetroidPrime/Player/CGameState.s index 2b68c03c..4cbd0df7 100644 --- a/asm/MetroidPrime/Player/CGameState.s +++ b/asm/MetroidPrime/Player/CGameState.s @@ -816,35 +816,35 @@ LoadGameFileState__10CGameStateFPCv: lbl_801D4280: /* 801D4280 001D11E0 38 61 00 10 */ addi r3, r1, 0x10 /* 801D4284 001D11E4 38 80 00 08 */ li r4, 8 -/* 801D4288 001D11E8 48 16 AA B1 */ bl ReadBits__12CInputStreamFi +/* 801D4288 001D11E8 48 16 AA B1 */ bl ReadBits__12CInputStreamFUi /* 801D428C 001D11EC 3B BD 00 01 */ addi r29, r29, 1 /* 801D4290 001D11F0 2C 1D 00 80 */ cmpwi r29, 0x80 /* 801D4294 001D11F4 41 80 FF EC */ blt lbl_801D4280 /* 801D4298 001D11F8 38 61 00 10 */ addi r3, r1, 0x10 /* 801D429C 001D11FC 38 80 00 20 */ li r4, 0x20 -/* 801D42A0 001D1200 48 16 AA 99 */ bl ReadBits__12CInputStreamFi +/* 801D42A0 001D1200 48 16 AA 99 */ bl ReadBits__12CInputStreamFUi /* 801D42A4 001D1204 7C 7D 1B 78 */ mr r29, r3 /* 801D42A8 001D1208 38 61 00 10 */ addi r3, r1, 0x10 /* 801D42AC 001D120C 38 80 00 01 */ li r4, 1 -/* 801D42B0 001D1210 48 16 AA 89 */ bl ReadBits__12CInputStreamFi +/* 801D42B0 001D1210 48 16 AA 89 */ bl ReadBits__12CInputStreamFUi /* 801D42B4 001D1214 7C 03 00 D0 */ neg r0, r3 /* 801D42B8 001D1218 38 80 00 01 */ li r4, 1 /* 801D42BC 001D121C 7C 00 1B 78 */ or r0, r0, r3 /* 801D42C0 001D1220 38 61 00 10 */ addi r3, r1, 0x10 /* 801D42C4 001D1224 54 00 0F FE */ srwi r0, r0, 0x1f /* 801D42C8 001D1228 98 01 00 58 */ stb r0, 0x58(r1) -/* 801D42CC 001D122C 48 16 AA 6D */ bl ReadBits__12CInputStreamFi +/* 801D42CC 001D122C 48 16 AA 6D */ bl ReadBits__12CInputStreamFUi /* 801D42D0 001D1230 38 61 00 10 */ addi r3, r1, 0x10 /* 801D42D4 001D1234 38 80 00 20 */ li r4, 0x20 -/* 801D42D8 001D1238 48 16 AA 61 */ bl ReadBits__12CInputStreamFi +/* 801D42D8 001D1238 48 16 AA 61 */ bl ReadBits__12CInputStreamFUi /* 801D42DC 001D123C 90 61 00 40 */ stw r3, 0x40(r1) /* 801D42E0 001D1240 38 61 00 10 */ addi r3, r1, 0x10 /* 801D42E4 001D1244 38 80 00 20 */ li r4, 0x20 -/* 801D42E8 001D1248 48 16 AA 51 */ bl ReadBits__12CInputStreamFi +/* 801D42E8 001D1248 48 16 AA 51 */ bl ReadBits__12CInputStreamFUi /* 801D42EC 001D124C 7C 7E 1B 78 */ mr r30, r3 /* 801D42F0 001D1250 38 61 00 10 */ addi r3, r1, 0x10 /* 801D42F4 001D1254 38 80 00 20 */ li r4, 0x20 -/* 801D42F8 001D1258 48 16 AA 41 */ bl ReadBits__12CInputStreamFi +/* 801D42F8 001D1258 48 16 AA 41 */ bl ReadBits__12CInputStreamFUi /* 801D42FC 001D125C 38 00 00 00 */ li r0, 0 /* 801D4300 001D1260 93 C1 00 0C */ stw r30, 0xc(r1) /* 801D4304 001D1264 38 81 00 10 */ addi r4, r1, 0x10 @@ -1138,7 +1138,7 @@ lbl_801D46B8: lbl_801D4718: /* 801D4718 001D1678 7F C3 F3 78 */ mr r3, r30 /* 801D471C 001D167C 38 80 00 08 */ li r4, 8 -/* 801D4720 001D1680 48 16 A6 19 */ bl ReadBits__12CInputStreamFi +/* 801D4720 001D1680 48 16 A6 19 */ bl ReadBits__12CInputStreamFUi /* 801D4724 001D1684 7C 9D C2 14 */ add r4, r29, r24 /* 801D4728 001D1688 3B 18 00 01 */ addi r24, r24, 1 /* 801D472C 001D168C 98 64 00 04 */ stb r3, 4(r4) @@ -1148,10 +1148,10 @@ lbl_801D4730: /* 801D4738 001D1698 41 80 FF E0 */ blt lbl_801D4718 /* 801D473C 001D169C 7F C3 F3 78 */ mr r3, r30 /* 801D4740 001D16A0 38 80 00 20 */ li r4, 0x20 -/* 801D4744 001D16A4 48 16 A5 F5 */ bl ReadBits__12CInputStreamFi +/* 801D4744 001D16A4 48 16 A5 F5 */ bl ReadBits__12CInputStreamFUi /* 801D4748 001D16A8 7F C3 F3 78 */ mr r3, r30 /* 801D474C 001D16AC 38 80 00 01 */ li r4, 1 -/* 801D4750 001D16B0 48 16 A5 E9 */ bl ReadBits__12CInputStreamFi +/* 801D4750 001D16B0 48 16 A5 E9 */ bl ReadBits__12CInputStreamFUi /* 801D4754 001D16B4 7C 83 00 D0 */ neg r4, r3 /* 801D4758 001D16B8 88 1D 02 28 */ lbz r0, 0x228(r29) /* 801D475C 001D16BC 7C 84 1B 78 */ or r4, r4, r3 @@ -1160,7 +1160,7 @@ lbl_801D4730: /* 801D4768 001D16C8 38 80 00 01 */ li r4, 1 /* 801D476C 001D16CC 50 A0 3E 30 */ rlwimi r0, r5, 7, 0x18, 0x18 /* 801D4770 001D16D0 98 1D 02 28 */ stb r0, 0x228(r29) -/* 801D4774 001D16D4 48 16 A5 C5 */ bl ReadBits__12CInputStreamFi +/* 801D4774 001D16D4 48 16 A5 C5 */ bl ReadBits__12CInputStreamFUi /* 801D4778 001D16D8 7C 83 00 D0 */ neg r4, r3 /* 801D477C 001D16DC 88 1D 02 28 */ lbz r0, 0x228(r29) /* 801D4780 001D16E0 7C 84 1B 78 */ or r4, r4, r3 @@ -1169,17 +1169,17 @@ lbl_801D4730: /* 801D478C 001D16EC 38 80 00 20 */ li r4, 0x20 /* 801D4790 001D16F0 50 A0 36 72 */ rlwimi r0, r5, 6, 0x19, 0x19 /* 801D4794 001D16F4 98 1D 02 28 */ stb r0, 0x228(r29) -/* 801D4798 001D16F8 48 16 A5 A1 */ bl ReadBits__12CInputStreamFi +/* 801D4798 001D16F8 48 16 A5 A1 */ bl ReadBits__12CInputStreamFUi /* 801D479C 001D16FC 90 7D 00 84 */ stw r3, 0x84(r29) /* 801D47A0 001D1700 80 7D 00 84 */ lwz r3, 0x84(r29) /* 801D47A4 001D1704 4B E3 00 D9 */ bl EnsureWorldPakReady__5CMainFUi /* 801D47A8 001D1708 7F C3 F3 78 */ mr r3, r30 /* 801D47AC 001D170C 38 80 00 20 */ li r4, 0x20 -/* 801D47B0 001D1710 48 16 A5 89 */ bl ReadBits__12CInputStreamFi +/* 801D47B0 001D1710 48 16 A5 89 */ bl ReadBits__12CInputStreamFUi /* 801D47B4 001D1714 7C 7C 1B 78 */ mr r28, r3 /* 801D47B8 001D1718 7F C3 F3 78 */ mr r3, r30 /* 801D47BC 001D171C 38 80 00 20 */ li r4, 0x20 -/* 801D47C0 001D1720 48 16 A5 79 */ bl ReadBits__12CInputStreamFi +/* 801D47C0 001D1720 48 16 A5 79 */ bl ReadBits__12CInputStreamFUi /* 801D47C4 001D1724 38 00 00 00 */ li r0, 0 /* 801D47C8 001D1728 93 81 00 2C */ stw r28, 0x2c(r1) /* 801D47CC 001D172C 3C 80 80 3D */ lis r4, lbl_803D1B88@ha @@ -1726,11 +1726,11 @@ lbl_801D4F04: /* 801D4F04 001D1E64 90 7D 00 14 */ stw r3, 0x14(r29) /* 801D4F08 001D1E68 7F C3 F3 78 */ mr r3, r30 /* 801D4F0C 001D1E6C 38 80 00 20 */ li r4, 0x20 -/* 801D4F10 001D1E70 48 16 9E 29 */ bl ReadBits__12CInputStreamFi +/* 801D4F10 001D1E70 48 16 9E 29 */ bl ReadBits__12CInputStreamFUi /* 801D4F14 001D1E74 90 7D 00 04 */ stw r3, 4(r29) /* 801D4F18 001D1E78 7F C3 F3 78 */ mr r3, r30 /* 801D4F1C 001D1E7C 38 80 00 20 */ li r4, 0x20 -/* 801D4F20 001D1E80 48 16 9E 19 */ bl ReadBits__12CInputStreamFi +/* 801D4F20 001D1E80 48 16 9E 19 */ bl ReadBits__12CInputStreamFUi /* 801D4F24 001D1E84 3C 80 80 3D */ lis r4, lbl_803D1B88@ha /* 801D4F28 001D1E88 90 7D 00 10 */ stw r3, 0x10(r29) /* 801D4F2C 001D1E8C 38 84 1B 88 */ addi r4, r4, lbl_803D1B88@l @@ -2635,7 +2635,7 @@ lbl_801D5B28: /* 801D5B28 001D2A88 7F A3 EB 78 */ mr r3, r29 /* 801D5B2C 001D2A8C 7F 7C C2 14 */ add r27, r28, r24 /* 801D5B30 001D2A90 38 80 00 08 */ li r4, 8 -/* 801D5B34 001D2A94 48 16 92 05 */ bl ReadBits__12CInputStreamFi +/* 801D5B34 001D2A94 48 16 92 05 */ bl ReadBits__12CInputStreamFUi /* 801D5B38 001D2A98 3B 18 00 01 */ addi r24, r24, 1 /* 801D5B3C 001D2A9C 98 7B 00 04 */ stb r3, 4(r27) /* 801D5B40 001D2AA0 2C 18 00 62 */ cmpwi r24, 0x62 @@ -2645,7 +2645,7 @@ lbl_801D5B4C: /* 801D5B4C 001D2AAC 7F A3 EB 78 */ mr r3, r29 /* 801D5B50 001D2AB0 7F 7C C2 14 */ add r27, r28, r24 /* 801D5B54 001D2AB4 38 80 00 08 */ li r4, 8 -/* 801D5B58 001D2AB8 48 16 91 E1 */ bl ReadBits__12CInputStreamFi +/* 801D5B58 001D2AB8 48 16 91 E1 */ bl ReadBits__12CInputStreamFUi /* 801D5B5C 001D2ABC 3B 18 00 01 */ addi r24, r24, 1 /* 801D5B60 001D2AC0 98 7B 00 6C */ stb r3, 0x6c(r27) /* 801D5B64 001D2AC4 2C 18 00 40 */ cmpwi r24, 0x40 @@ -2654,29 +2654,29 @@ lbl_801D5B4C: /* 801D5B70 001D2AD0 48 00 05 41 */ bl sub_801d60b0 /* 801D5B74 001D2AD4 7C 64 1B 78 */ mr r4, r3 /* 801D5B78 001D2AD8 7F A3 EB 78 */ mr r3, r29 -/* 801D5B7C 001D2ADC 48 16 91 BD */ bl ReadBits__12CInputStreamFi +/* 801D5B7C 001D2ADC 48 16 91 BD */ bl ReadBits__12CInputStreamFUi /* 801D5B80 001D2AE0 90 7C 00 C0 */ stw r3, 0xc0(r28) /* 801D5B84 001D2AE4 38 60 00 03 */ li r3, 3 /* 801D5B88 001D2AE8 48 00 05 29 */ bl sub_801d60b0 /* 801D5B8C 001D2AEC 7C 64 1B 78 */ mr r4, r3 /* 801D5B90 001D2AF0 7F A3 EB 78 */ mr r3, r29 -/* 801D5B94 001D2AF4 48 16 91 A5 */ bl ReadBits__12CInputStreamFi +/* 801D5B94 001D2AF4 48 16 91 A5 */ bl ReadBits__12CInputStreamFUi /* 801D5B98 001D2AF8 90 7C 00 C4 */ stw r3, 0xc4(r28) /* 801D5B9C 001D2AFC 38 60 00 01 */ li r3, 1 /* 801D5BA0 001D2B00 48 00 05 11 */ bl sub_801d60b0 /* 801D5BA4 001D2B04 7C 64 1B 78 */ mr r4, r3 /* 801D5BA8 001D2B08 7F A3 EB 78 */ mr r3, r29 -/* 801D5BAC 001D2B0C 48 16 91 8D */ bl ReadBits__12CInputStreamFi +/* 801D5BAC 001D2B0C 48 16 91 8D */ bl ReadBits__12CInputStreamFUi /* 801D5BB0 001D2B10 90 7C 00 C8 */ stw r3, 0xc8(r28) /* 801D5BB4 001D2B14 38 60 00 64 */ li r3, 0x64 /* 801D5BB8 001D2B18 48 00 04 F9 */ bl sub_801d60b0 /* 801D5BBC 001D2B1C 7C 64 1B 78 */ mr r4, r3 /* 801D5BC0 001D2B20 7F A3 EB 78 */ mr r3, r29 -/* 801D5BC4 001D2B24 48 16 91 75 */ bl ReadBits__12CInputStreamFi +/* 801D5BC4 001D2B24 48 16 91 75 */ bl ReadBits__12CInputStreamFUi /* 801D5BC8 001D2B28 90 7C 00 CC */ stw r3, 0xcc(r28) /* 801D5BCC 001D2B2C 7F A3 EB 78 */ mr r3, r29 /* 801D5BD0 001D2B30 38 80 00 01 */ li r4, 1 -/* 801D5BD4 001D2B34 48 16 91 65 */ bl ReadBits__12CInputStreamFi +/* 801D5BD4 001D2B34 48 16 91 65 */ bl ReadBits__12CInputStreamFUi /* 801D5BD8 001D2B38 7C 83 00 D0 */ neg r4, r3 /* 801D5BDC 001D2B3C 88 1C 00 D0 */ lbz r0, 0xd0(r28) /* 801D5BE0 001D2B40 7C 84 1B 78 */ or r4, r4, r3 @@ -2685,7 +2685,7 @@ lbl_801D5B4C: /* 801D5BEC 001D2B4C 38 80 00 01 */ li r4, 1 /* 801D5BF0 001D2B50 50 A0 3E 30 */ rlwimi r0, r5, 7, 0x18, 0x18 /* 801D5BF4 001D2B54 98 1C 00 D0 */ stb r0, 0xd0(r28) -/* 801D5BF8 001D2B58 48 16 91 41 */ bl ReadBits__12CInputStreamFi +/* 801D5BF8 001D2B58 48 16 91 41 */ bl ReadBits__12CInputStreamFUi /* 801D5BFC 001D2B5C 7C 83 00 D0 */ neg r4, r3 /* 801D5C00 001D2B60 88 1C 00 D0 */ lbz r0, 0xd0(r28) /* 801D5C04 001D2B64 7C 84 1B 78 */ or r4, r4, r3 @@ -2694,7 +2694,7 @@ lbl_801D5B4C: /* 801D5C10 001D2B70 38 80 00 01 */ li r4, 1 /* 801D5C14 001D2B74 50 A0 36 72 */ rlwimi r0, r5, 6, 0x19, 0x19 /* 801D5C18 001D2B78 98 1C 00 D0 */ stb r0, 0xd0(r28) -/* 801D5C1C 001D2B7C 48 16 91 1D */ bl ReadBits__12CInputStreamFi +/* 801D5C1C 001D2B7C 48 16 91 1D */ bl ReadBits__12CInputStreamFUi /* 801D5C20 001D2B80 7C 83 00 D0 */ neg r4, r3 /* 801D5C24 001D2B84 88 1C 00 D0 */ lbz r0, 0xd0(r28) /* 801D5C28 001D2B88 7C 84 1B 78 */ or r4, r4, r3 @@ -2703,7 +2703,7 @@ lbl_801D5B4C: /* 801D5C34 001D2B94 38 80 00 01 */ li r4, 1 /* 801D5C38 001D2B98 50 A0 2E B4 */ rlwimi r0, r5, 5, 0x1a, 0x1a /* 801D5C3C 001D2B9C 98 1C 00 D0 */ stb r0, 0xd0(r28) -/* 801D5C40 001D2BA0 48 16 90 F9 */ bl ReadBits__12CInputStreamFi +/* 801D5C40 001D2BA0 48 16 90 F9 */ bl ReadBits__12CInputStreamFUi /* 801D5C44 001D2BA4 7C 83 00 D0 */ neg r4, r3 /* 801D5C48 001D2BA8 88 1C 00 D0 */ lbz r0, 0xd0(r28) /* 801D5C4C 001D2BAC 7C 84 1B 78 */ or r4, r4, r3 @@ -2712,7 +2712,7 @@ lbl_801D5B4C: /* 801D5C58 001D2BB8 38 80 00 01 */ li r4, 1 /* 801D5C5C 001D2BBC 50 A0 26 F6 */ rlwimi r0, r5, 4, 0x1b, 0x1b /* 801D5C60 001D2BC0 98 1C 00 D0 */ stb r0, 0xd0(r28) -/* 801D5C64 001D2BC4 48 16 90 D5 */ bl ReadBits__12CInputStreamFi +/* 801D5C64 001D2BC4 48 16 90 D5 */ bl ReadBits__12CInputStreamFUi /* 801D5C68 001D2BC8 7C 83 00 D0 */ neg r4, r3 /* 801D5C6C 001D2BCC 88 1C 00 D0 */ lbz r0, 0xd0(r28) /* 801D5C70 001D2BD0 7C 84 1B 78 */ or r4, r4, r3 @@ -2721,7 +2721,7 @@ lbl_801D5B4C: /* 801D5C7C 001D2BDC 38 80 00 02 */ li r4, 2 /* 801D5C80 001D2BE0 50 A0 17 7A */ rlwimi r0, r5, 2, 0x1d, 0x1d /* 801D5C84 001D2BE4 98 1C 00 D0 */ stb r0, 0xd0(r28) -/* 801D5C88 001D2BE8 48 16 90 B1 */ bl ReadBits__12CInputStreamFi +/* 801D5C88 001D2BE8 48 16 90 B1 */ bl ReadBits__12CInputStreamFUi /* 801D5C8C 001D2BEC 90 7C 00 BC */ stw r3, 0xbc(r28) /* 801D5C90 001D2BF0 3C 60 53 41 */ lis r3, 0x53415657@ha /* 801D5C94 001D2BF4 3B 63 56 57 */ addi r27, r3, 0x53415657@l @@ -2799,7 +2799,7 @@ lbl_801D5D8C: lbl_801D5D98: /* 801D5D98 001D2CF8 7F A3 EB 78 */ mr r3, r29 /* 801D5D9C 001D2CFC 38 80 00 01 */ li r4, 1 -/* 801D5DA0 001D2D00 48 16 8F 99 */ bl ReadBits__12CInputStreamFi +/* 801D5DA0 001D2D00 48 16 8F 99 */ bl ReadBits__12CInputStreamFUi /* 801D5DA4 001D2D04 7C 03 00 D0 */ neg r0, r3 /* 801D5DA8 001D2D08 3B 18 00 01 */ addi r24, r24, 1 /* 801D5DAC 001D2D0C 7C 00 1B 78 */ or r0, r0, r3 diff --git a/asm/MetroidPrime/Player/CPlayerState.s b/asm/MetroidPrime/Player/CPlayerState.s index e2e32f02..9f0d8017 100644 --- a/asm/MetroidPrime/Player/CPlayerState.s +++ b/asm/MetroidPrime/Player/CPlayerState.s @@ -1240,11 +1240,11 @@ __ct__12CPlayerStateFR12CInputStream: /* 800920C4 0008F024 48 12 EB 89 */ bl __ct__19CStaticInterferenceFi /* 800920C8 0008F028 7F E3 FB 78 */ mr r3, r31 /* 800920CC 0008F02C 38 80 00 20 */ li r4, 0x20 -/* 800920D0 0008F030 48 2A CC 69 */ bl ReadBits__12CInputStreamFi +/* 800920D0 0008F030 48 2A CC 69 */ bl ReadBits__12CInputStreamFUi /* 800920D4 0008F034 90 7E 00 04 */ stw r3, 4(r30) /* 800920D8 0008F038 7F E3 FB 78 */ mr r3, r31 /* 800920DC 0008F03C 38 80 00 20 */ li r4, 0x20 -/* 800920E0 0008F040 48 2A CC 59 */ bl ReadBits__12CInputStreamFi +/* 800920E0 0008F040 48 2A CC 59 */ bl ReadBits__12CInputStreamFUi /* 800920E4 0008F044 90 61 00 08 */ stw r3, 8(r1) /* 800920E8 0008F048 38 60 00 05 */ li r3, 5 /* 800920EC 0008F04C C0 02 8B 2C */ lfs f0, lbl_805AA84C@sda21(r2) @@ -1254,13 +1254,13 @@ __ct__12CPlayerStateFR12CInputStream: /* 800920FC 0008F05C 48 00 02 C5 */ bl GetBitCount__12CPlayerStateFUi /* 80092100 0008F060 7C 64 1B 78 */ mr r4, r3 /* 80092104 0008F064 7F E3 FB 78 */ mr r3, r31 -/* 80092108 0008F068 48 2A CC 31 */ bl ReadBits__12CInputStreamFi +/* 80092108 0008F068 48 2A CC 31 */ bl ReadBits__12CInputStreamFUi /* 8009210C 0008F06C 90 7E 00 08 */ stw r3, 8(r30) /* 80092110 0008F070 38 60 00 04 */ li r3, 4 /* 80092114 0008F074 48 00 02 AD */ bl GetBitCount__12CPlayerStateFUi /* 80092118 0008F078 7C 64 1B 78 */ mr r4, r3 /* 8009211C 0008F07C 7F E3 FB 78 */ mr r3, r31 -/* 80092120 0008F080 48 2A CC 19 */ bl ReadBits__12CInputStreamFi +/* 80092120 0008F080 48 2A CC 19 */ bl ReadBits__12CInputStreamFUi /* 80092124 0008F084 3C 80 80 3D */ lis r4, lbl_803CD6C0@ha /* 80092128 0008F088 90 7E 00 20 */ stw r3, 0x20(r30) /* 8009212C 0008F08C 3B 64 D6 C0 */ addi r27, r4, lbl_803CD6C0@l @@ -1277,12 +1277,12 @@ lbl_80092138: /* 80092154 0008F0B4 7F E3 FB 78 */ mr r3, r31 /* 80092158 0008F0B8 7C 19 03 78 */ mr r25, r0 /* 8009215C 0008F0BC 7F 24 CB 78 */ mr r4, r25 -/* 80092160 0008F0C0 48 2A CB D9 */ bl ReadBits__12CInputStreamFi +/* 80092160 0008F0C0 48 2A CB D9 */ bl ReadBits__12CInputStreamFUi /* 80092164 0008F0C4 7C 60 1B 78 */ mr r0, r3 /* 80092168 0008F0C8 7F E3 FB 78 */ mr r3, r31 /* 8009216C 0008F0CC 7C 1A 03 78 */ mr r26, r0 /* 80092170 0008F0D0 7F 24 CB 78 */ mr r4, r25 -/* 80092174 0008F0D4 48 2A CB C5 */ bl ReadBits__12CInputStreamFi +/* 80092174 0008F0D4 48 2A CB C5 */ bl ReadBits__12CInputStreamFUi /* 80092178 0008F0D8 7C 65 1B 78 */ mr r5, r3 lbl_8009217C: /* 8009217C 0008F0DC 7F 44 D3 78 */ mr r4, r26 @@ -1314,7 +1314,7 @@ lbl_800921AC: lbl_800921E0: /* 800921E0 0008F140 7F E3 FB 78 */ mr r3, r31 /* 800921E4 0008F144 38 80 00 01 */ li r4, 1 -/* 800921E8 0008F148 48 2A CB 51 */ bl ReadBits__12CInputStreamFi +/* 800921E8 0008F148 48 2A CB 51 */ bl ReadBits__12CInputStreamFUi /* 800921EC 0008F14C 7C 03 00 D0 */ neg r0, r3 /* 800921F0 0008F150 7C 00 1B 78 */ or r0, r0, r3 /* 800921F4 0008F154 54 00 0F FF */ rlwinm. r0, r0, 1, 0x1f, 0x1f @@ -1360,13 +1360,13 @@ lbl_80092260: /* 8009227C 0008F1DC 48 00 01 45 */ bl GetBitCount__12CPlayerStateFUi /* 80092280 0008F1E0 7C 64 1B 78 */ mr r4, r3 /* 80092284 0008F1E4 7F E3 FB 78 */ mr r3, r31 -/* 80092288 0008F1E8 48 2A CA B1 */ bl ReadBits__12CInputStreamFi +/* 80092288 0008F1E8 48 2A CA B1 */ bl ReadBits__12CInputStreamFUi /* 8009228C 0008F1EC 90 7E 01 80 */ stw r3, 0x180(r30) /* 80092290 0008F1F0 38 60 01 00 */ li r3, 0x100 /* 80092294 0008F1F4 48 00 01 2D */ bl GetBitCount__12CPlayerStateFUi /* 80092298 0008F1F8 7C 64 1B 78 */ mr r4, r3 /* 8009229C 0008F1FC 7F E3 FB 78 */ mr r3, r31 -/* 800922A0 0008F200 48 2A CA 99 */ bl ReadBits__12CInputStreamFi +/* 800922A0 0008F200 48 2A CA 99 */ bl ReadBits__12CInputStreamFUi /* 800922A4 0008F204 90 7E 01 84 */ stw r3, 0x184(r30) /* 800922A8 0008F208 7F C3 F3 78 */ mr r3, r30 /* 800922AC 0008F20C E3 E1 00 48 */ psq_l f31, 72(r1), 0, qr0 diff --git a/asm/MetroidPrime/Player/CWorldLayerState.s b/asm/MetroidPrime/Player/CWorldLayerState.s index dbe8758b..e302d80a 100644 --- a/asm/MetroidPrime/Player/CWorldLayerState.s +++ b/asm/MetroidPrime/Player/CWorldLayerState.s @@ -372,7 +372,7 @@ __ct__16CWorldLayerStateFR16CBitStreamReaderRC10CSaveWorld: /* 80234454 002313B4 90 1C 00 18 */ stw r0, 0x18(r28) /* 80234458 002313B8 90 1C 00 1C */ stw r0, 0x1c(r28) /* 8023445C 002313BC 90 1C 00 20 */ stw r0, 0x20(r28) -/* 80234460 002313C0 48 10 A8 D9 */ bl ReadBits__12CInputStreamFi +/* 80234460 002313C0 48 10 A8 D9 */ bl ReadBits__12CInputStreamFUi /* 80234464 002313C4 7C 7F 1B 78 */ mr r31, r3 /* 80234468 002313C8 38 7C 00 14 */ addi r3, r28, 0x14 /* 8023446C 002313CC 57 E4 D8 08 */ slwi r4, r31, 0x1b @@ -392,7 +392,7 @@ __ct__16CWorldLayerStateFR16CBitStreamReaderRC10CSaveWorld: lbl_802344A4: /* 802344A4 00231404 7F A3 EB 78 */ mr r3, r29 /* 802344A8 00231408 38 80 00 01 */ li r4, 1 -/* 802344AC 0023140C 48 10 A8 8D */ bl ReadBits__12CInputStreamFi +/* 802344AC 0023140C 48 10 A8 8D */ bl ReadBits__12CInputStreamFUi /* 802344B0 00231410 80 9C 00 10 */ lwz r4, 0x10(r28) /* 802344B4 00231414 7C 03 00 D0 */ neg r0, r3 /* 802344B8 00231418 7C 05 1B 78 */ or r5, r0, r3 diff --git a/asm/MetroidPrime/main.s b/asm/MetroidPrime/main.s index 8b14f6d2..ae788c86 100644 --- a/asm/MetroidPrime/main.s +++ b/asm/MetroidPrime/main.s @@ -3000,7 +3000,7 @@ lbl_80005180: /* 800051CC 0000212C 48 33 A0 01 */ bl __ct__15CMemoryInStreamFPCvUl /* 800051D0 00002130 38 61 00 60 */ addi r3, r1, 0x60 /* 800051D4 00002134 38 80 00 01 */ li r4, 1 -/* 800051D8 00002138 48 33 9B 61 */ bl ReadBits__12CInputStreamFi +/* 800051D8 00002138 48 33 9B 61 */ bl ReadBits__12CInputStreamFUi /* 800051DC 0000213C 38 61 00 84 */ addi r3, r1, 0x84 /* 800051E0 00002140 38 81 00 60 */ addi r4, r1, 0x60 /* 800051E4 00002144 48 20 A2 C1 */ bl __ct__12CGameOptionsFR12CInputStream @@ -3016,7 +3016,7 @@ lbl_80005180: /* 8000520C 0000216C 48 20 9E F1 */ bl EnsureOptions__12CGameOptionsFv /* 80005210 00002170 38 61 00 60 */ addi r3, r1, 0x60 /* 80005214 00002174 38 80 00 01 */ li r4, 1 -/* 80005218 00002178 48 33 9B 21 */ bl ReadBits__12CInputStreamFi +/* 80005218 00002178 48 33 9B 21 */ bl ReadBits__12CInputStreamFUi /* 8000521C 0000217C 7C 03 00 D0 */ neg r0, r3 /* 80005220 00002180 3C 80 80 3F */ lis r4, __vt__15CMemoryInStream@ha /* 80005224 00002184 7C 00 1B 78 */ or r0, r0, r3 @@ -6563,7 +6563,7 @@ sub_800083e4: /* 8000840C 0000536C 48 33 6D C1 */ bl __ct__15CMemoryInStreamFPCvUl /* 80008410 00005370 38 61 00 08 */ addi r3, r1, 8 /* 80008414 00005374 38 80 00 01 */ li r4, 1 -/* 80008418 00005378 48 33 69 21 */ bl ReadBits__12CInputStreamFi +/* 80008418 00005378 48 33 69 21 */ bl ReadBits__12CInputStreamFUi /* 8000841C 0000537C 7C 03 00 D0 */ neg r0, r3 /* 80008420 00005380 3C 80 80 3F */ lis r4, __vt__15CMemoryInStream@ha /* 80008424 00005384 7C 00 1B 78 */ or r0, r0, r3 diff --git a/include/Kyoto_CWD/CInputStream.hpp b/include/Kyoto_CWD/CInputStream.hpp index 2510f4d8..4508fac9 100644 --- a/include/Kyoto_CWD/CInputStream.hpp +++ b/include/Kyoto_CWD/CInputStream.hpp @@ -14,18 +14,18 @@ public: CInputStream(size_t len); CInputStream(const void* ptr, size_t len, bool owned); virtual ~CInputStream(); - virtual u32 Read(void* dest, u32 len); + virtual u32 Read(void* dest, u32 len) = 0; - s32 ReadLong(); - u8 ReadChar(); - u32 ReadBytes(void* dest, unsigned long len); - u32 ReadBits(s32 len); f32 ReadFloat(); - s64 ReadLongLong(); - s16 ReadShort(); + u64 ReadLongLong(); + u32 ReadLong(); + u16 ReadShort(); bool ReadBool(); - + u8 ReadChar(); + u32 ReadBits(u32 len); + u32 ReadBytes(void* dest, unsigned long len); void Get(void* dest, unsigned long len); + template < typename T > inline T Get() { return cinput_stream_helper(TType< T >(), *this); diff --git a/obj_files.mk b/obj_files.mk index 90bb0400..04385967 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -560,7 +560,7 @@ KYOTO :=\ $(BUILD_DIR)/asm/Kyoto/rstl/rstl_map.o\ $(BUILD_DIR)/asm/Kyoto/rstl/rstl_strings.o\ $(BUILD_DIR)/asm/Kyoto/rstl/RstlExtras.o\ - $(BUILD_DIR)/asm/Kyoto/Streams/CInputStream.o\ + $(BUILD_DIR)/src/Kyoto/Streams/CInputStream.o\ $(BUILD_DIR)/asm/Kyoto/Streams/CMemoryInStream.o\ $(BUILD_DIR)/asm/Kyoto/Streams/CMemoryStreamOut.o\ $(BUILD_DIR)/asm/Kyoto/Streams/COutputStream.o\ diff --git a/src/Kyoto/Streams/CInputStream.cpp b/src/Kyoto/Streams/CInputStream.cpp index a2f880ae..66eb1913 100644 --- a/src/Kyoto/Streams/CInputStream.cpp +++ b/src/Kyoto/Streams/CInputStream.cpp @@ -4,63 +4,83 @@ #include "Kyoto_CWD/CMemory.hpp" -// TODO move into functions -static u8 lbl_805A94F0; -static s16 lbl_805A94F2; -static s32 lbl_805A94F4; -static s64 lbl_805A94F8; -static f32 lbl_805A9500; +static u8 c; +static u16 s; +static u32 l; +static u64 ll; +static f32 f; f32 CInputStream::ReadFloat() { - Get(&lbl_805A9500, sizeof(f32)); - return lbl_805A9500; + Get(&f, sizeof(f32)); + return f; } -s64 CInputStream::ReadLongLong() { - Get(&lbl_805A94F8, sizeof(s64)); - return lbl_805A94F8; +u64 CInputStream::ReadLongLong() { + Get(&ll, sizeof(u64)); + return ll; } -s32 CInputStream::ReadLong() { - Get(&lbl_805A94F4, sizeof(s32)); - return lbl_805A94F4; +u32 CInputStream::ReadLong() { + Get(&l, sizeof(u32)); + return l; } -s16 CInputStream::ReadShort() { - Get(&lbl_805A94F2, sizeof(s16)); - return lbl_805A94F2; +u16 CInputStream::ReadShort() { + Get(&s, sizeof(u16)); + return s; } bool CInputStream::ReadBool() { return static_cast< bool >(ReadChar()); } u8 CInputStream::ReadChar() { - Get(&lbl_805A94F0, sizeof(u8)); - return lbl_805A94F0; + Get(&c, sizeof(u8)); + return c; } -// TODO https://decomp.me/scratch/nzMPg -u32 CInputStream::ReadBits(s32 bitCount) { - u32 ret = 0; - u32 bitOffset = x20_bitOffset; - if (bitOffset < bitCount) { - u32 shiftAmt = bitCount - bitOffset; - const u32 mask = bitOffset == 32 ? 0xffffffff : (1 << bitOffset) - 1; - const u32 bitWord = x1c_bitWord; - x20_bitOffset = 0; - const u32 len = (shiftAmt / 8) + static_cast< unsigned int >((shiftAmt % 8) != 0); - Get(&x1c_bitWord, len); - const u32 mask2 = shiftAmt == 32 ? 0xffffffff : (1 << shiftAmt) - 1; - u32 tmp = x20_bitOffset; - x20_bitOffset = len * 8; - ret = ((mask & (bitWord >> (32 - bitOffset))) << shiftAmt) | ((mask2 & (x1c_bitWord >> (32 - shiftAmt))) << tmp); - x20_bitOffset -= shiftAmt; - x1c_bitWord <<= u64(shiftAmt); - } else { - u32 baseVal2 = (bitCount == 0x20 ? 0xffffffff : (1 << bitCount) - 1); +static inline u32 BitsToBytes(u32 bits) { return (bits / 8) + ((bits % 8) ? 1 : 0); } + +u32 CInputStream::ReadBits(u32 bitCount) { + if (x20_bitOffset >= bitCount) { + u32 mask = 0xffffffff; + u32 bwShift = 32 - bitCount; + if (bitCount != 0x20) { + mask = (1 << bitCount) - 1; + } + u32 ret = mask & (x1c_bitWord >> bwShift); + x20_bitOffset -= bitCount; - ret = baseVal2 & (x1c_bitWord >> (32 - bitCount)); - x1c_bitWord <<= u64(bitCount); + x1c_bitWord <<= bitCount; + return ret; } + + u32 shiftAmt = bitCount - x20_bitOffset; + + u32 ret = 0; + { + u32 mask = 0xffffffff; + u32 bwShift = 32 - x20_bitOffset; + if (x20_bitOffset != 0x20) { + mask = (1 << x20_bitOffset) - 1; + } + ret = (mask & (x1c_bitWord >> bwShift)) << shiftAmt; + } + + u32 len = BitsToBytes(shiftAmt); + x20_bitOffset = 0; + Get(&x1c_bitWord, len); + + { + u32 mask = 0xffffffff; + u32 bwShift = 32 - shiftAmt; + if (shiftAmt != 0x20) { + mask = (1 << shiftAmt) - 1; + } + ret |= ((mask & (x1c_bitWord >> bwShift)) << x20_bitOffset); + } + + x20_bitOffset = len * 8; + x20_bitOffset -= shiftAmt; + x1c_bitWord <<= shiftAmt; return ret; }