diff --git a/Makefile b/Makefile index 5fa6d4a7..ef6a832d 100644 --- a/Makefile +++ b/Makefile @@ -130,7 +130,7 @@ $(METROTRK_FILES): MWCC_VERSION := 1.2.5 $(METROTRK_FILES): CFLAGS := $(CFLAGS_BASE) $(BASE_FILES): MWCC_VERSION := 1.2.5 $(BASE_FILES): CFLAGS := $(CFLAGS_BASE) -$(AI_FILES): MWCC_VERSION := 1.2.5 +$(AI_FILES): MWCC_VERSION := 1.2.5e $(AI_FILES): CFLAGS := $(CFLAGS_BASE) $(OS_FILES): MWCC_VERSION := 1.2.5 $(OS_FILES): CFLAGS := $(CFLAGS_BASE) diff --git a/asm/Dolphin/ai.s b/asm/Dolphin/ai.s index ff0c5f6a..244e802f 100644 --- a/asm/Dolphin/ai.s +++ b/asm/Dolphin/ai.s @@ -10,8 +10,8 @@ AIVersion: .section .sdata .balign 8 -.global lbl_805A8A68 -lbl_805A8A68: +.global __AIVersion +__AIVersion: .4byte AIVersion .4byte 0 @@ -405,7 +405,7 @@ AIInit: /* 8036D3EC 0036A34C 80 0D AB 08 */ lwz r0, __AI_init_flag@sda21(r13) /* 8036D3F0 0036A350 2C 00 00 01 */ cmpwi r0, 1 /* 8036D3F4 0036A354 41 82 01 34 */ beq lbl_8036D528 -/* 8036D3F8 0036A358 80 6D 9E A8 */ lwz r3, lbl_805A8A68@sda21(r13) +/* 8036D3F8 0036A358 80 6D 9E A8 */ lwz r3, __AIVersion@sda21(r13) /* 8036D3FC 0036A35C 48 01 0C 3D */ bl OSRegisterVersion /* 8036D400 0036A360 3C 60 80 00 */ lis r3, 0x800000F8@ha /* 8036D404 0036A364 80 03 00 F8 */ lwz r0, 0x800000F8@l(r3) diff --git a/asm/Kyoto/Audio/CSfxHandle.s b/asm/Kyoto/Audio/CSfxHandle.s index a162af22..ce2d460f 100644 --- a/asm/Kyoto/Audio/CSfxHandle.s +++ b/asm/Kyoto/Audio/CSfxHandle.s @@ -3,36 +3,19 @@ .section .sbss, "wa" .balign 8 -.global lbl_805A92B8 -lbl_805A92B8: +.global mRefCount__10CSfxHandle +mRefCount__10CSfxHandle: .skip 0x8 .section .text, "ax" .global __ct__10CSfxHandleFUi __ct__10CSfxHandleFUi: -/* 802E786C 002E47CC 80 AD A6 F8 */ lwz r5, lbl_805A92B8@sda21(r13) +/* 802E786C 002E47CC 80 AD A6 F8 */ lwz r5, mRefCount__10CSfxHandle@sda21(r13) /* 802E7870 002E47D0 54 80 05 3E */ clrlwi r0, r4, 0x14 /* 802E7874 002E47D4 38 85 00 01 */ addi r4, r5, 1 -/* 802E7878 002E47D8 90 8D A6 F8 */ stw r4, lbl_805A92B8@sda21(r13) +/* 802E7878 002E47D8 90 8D A6 F8 */ stw r4, mRefCount__10CSfxHandle@sda21(r13) /* 802E787C 002E47DC 50 80 70 22 */ rlwimi r0, r4, 0xe, 0, 0x11 /* 802E7880 002E47E0 90 03 00 00 */ stw r0, 0(r3) /* 802E7884 002E47E4 4E 80 00 20 */ blr -.section .sdata2, "a" -.balign 8 -.global lbl_805AE318 -lbl_805AE318: - # ROM: 0x3FABB8 - .2byte 0x000000FF - -.global lbl_805AE31A -lbl_805AE31A: - # ROM: 0x3FABBA - .2byte 0x0000007F - -.global lbl_805AE31C -lbl_805AE31C: - # ROM: 0x3FABBC - .4byte 0xFFFF0000 - diff --git a/asm/Kyoto/Audio/CSfxManager.s b/asm/Kyoto/Audio/CSfxManager.s index f1975b1c..d76a793d 100644 --- a/asm/Kyoto/Audio/CSfxManager.s +++ b/asm/Kyoto/Audio/CSfxManager.s @@ -4601,6 +4601,24 @@ __ct__Q211CSfxManager11CSfxChannelFv: .section .sdata2, "a" .balign 8 + +.section .sdata2, "a" +.balign 8 +.global lbl_805AE318 +lbl_805AE318: + # ROM: 0x3FABB8 + .2byte 0x000000FF + +.global lbl_805AE31A +lbl_805AE31A: + # ROM: 0x3FABBA + .2byte 0x0000007F + +.global lbl_805AE31C +lbl_805AE31C: + # ROM: 0x3FABBC + .4byte 0xFFFF0000 + .global lbl_805AE320 lbl_805AE320: # ROM: 0x3FABC0 diff --git a/include/Kyoto/Audio/CSfxHandle.hpp b/include/Kyoto/Audio/CSfxHandle.hpp index 4b3c0497..363b9322 100644 --- a/include/Kyoto/Audio/CSfxHandle.hpp +++ b/include/Kyoto/Audio/CSfxHandle.hpp @@ -5,19 +5,20 @@ class CSfxHandle { public: - CSfxHandle() : value(0) {} - CSfxHandle(uint value) : value(value) {} + CSfxHandle() : mID(~0) {} + CSfxHandle(uint value); - // GetIndex__10CSfxHandleCFv - // NullHandle__10CSfxHandleFv - // mRefCount__10CSfxHandle ?? - - bool operator==(const CSfxHandle& other) { return value == other.value; } - operator bool() const { return value != 0; } + uint GetIndex() const { return mID & 0xFFF; } + static NullHandle() { return CSfxHandle(); } + bool operator=(const CSfxHandle& other) { mID = other.mID; } + bool operator==(const CSfxHandle& other) { return mID == other.mID; } + bool operator!=(const CSfxHandle& other) { return mID != other.mID; } + operator bool() const { return mID != 0; } private: - uint value; + uint mID; + static uint mRefCount; }; CHECK_SIZEOF(CSfxHandle, 0x4) -#endif \ No newline at end of file +#endif diff --git a/obj_files.mk b/obj_files.mk index c638a28d..46a246b1 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -455,7 +455,7 @@ KYOTO_1 :=\ $(BUILD_DIR)/asm/Kyoto/Animation/CTransitionManager.o\ $(BUILD_DIR)/asm/Kyoto/Animation/CTreeUtils.o\ $(BUILD_DIR)/asm/Kyoto/Animation/IMetaAnim.o\ - $(BUILD_DIR)/asm/Kyoto/Audio/CSfxHandle.o\ + $(BUILD_DIR)/src/Kyoto/Audio/CSfxHandle.o\ $(BUILD_DIR)/asm/Kyoto/Audio/CSfxManager.o\ $(BUILD_DIR)/asm/Kyoto/Animation/CAdvancementDeltas.o\ $(BUILD_DIR)/asm/Kyoto/Animation/CAnimMathUtils.o\ diff --git a/src/Kyoto/Audio/CSfxHandle.cpp b/src/Kyoto/Audio/CSfxHandle.cpp new file mode 100644 index 00000000..d6947357 --- /dev/null +++ b/src/Kyoto/Audio/CSfxHandle.cpp @@ -0,0 +1,5 @@ +#include + +uint CSfxHandle::mRefCount = 0; +CSfxHandle::CSfxHandle(uint value) : mID((++mRefCount << 14) | (value & 0xFFF)) { +}