From 1974f6fc22d5a801490d729f6b5166f4e2428ea6 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Mon, 11 Apr 2022 21:53:51 -0700 Subject: [PATCH] Split mslsupp.c rename TRK functions --- Makefile | 12 ++++++------ asm/Kyoto_CWD/main.s | 20 +------------------- asm/Runtime/uart_console_io.s | 2 +- include/MetroTRK/TrkInit.h | 14 ++++++++++++++ ldscript.lcf | 1 + obj_files.mk | 3 +++ src/Kyoto_CWD/main.cpp | 6 +++--- src/MetroTRK/mslsupp.c | 21 +++++++++++++++++++++ 8 files changed, 50 insertions(+), 29 deletions(-) create mode 100644 include/MetroTRK/TrkInit.h create mode 100644 src/MetroTRK/mslsupp.c diff --git a/Makefile b/Makefile index 4e429ff2..2378b0b3 100644 --- a/Makefile +++ b/Makefile @@ -52,12 +52,12 @@ ifeq ($(EPILOGUE_PROCESS),1) include e_files.mk endif -O_FILES := $(INIT_O_FILES) $(EXTAB_O_FILES) $(EXTABINDEX_O_FILES) $(KYOTO_CWD) \ - $(CTORS_O_FILES) $(DTORS_O_FILES) $(RODATA_O_FILES) $(DATA_O_FILES) \ - $(BSS_O_FILES) $(SDATA_O_FILES) $(SBSS_O_FILES) $(SDATA2_O_FILES) \ - $(SBSS2_O_FILES) $(TEXT_O_FILES) $(AI_FILES) $(AR_FILES) $(BASE_FILES) \ - $(DB_FILES) $(DSP_FILES) $(DVD_FILES) $(GX_FILES) $(MTX_FILES) $(OS_FILES) \ - $(PAD_FILES) $(VI_FILES) $(MSL_PPCEABI_BARE_H) $(MUSYX_FILES) \ +O_FILES := $(INIT_O_FILES) $(EXTAB_O_FILES) $(EXTABINDEX_O_FILES) $(METROTRK_FILES) \ + $(KYOTO_CWD) $(CTORS_O_FILES) $(DTORS_O_FILES) $(RODATA_O_FILES) \ + $(DATA_O_FILES) $(BSS_O_FILES) $(SDATA_O_FILES) $(SBSS_O_FILES) \ + $(SDATA2_O_FILES) $(SBSS2_O_FILES) $(TEXT_O_FILES) $(AI_FILES) $(AR_FILES) \ + $(BASE_FILES) $(DB_FILES) $(DSP_FILES) $(DVD_FILES) $(GX_FILES) $(MTX_FILES) \ + $(OS_FILES) $(PAD_FILES) $(VI_FILES) $(MSL_PPCEABI_BARE_H) $(MUSYX_FILES) \ $(DTK_FILES) $(CARD_FILES) $(SI_FILES) $(EXI_FILES) $(THP_FILES) \ $(GBA_FILES) $(BSS_SINIT_O_FILES) diff --git a/asm/Kyoto_CWD/main.s b/asm/Kyoto_CWD/main.s index 57ff2554..702537bc 100644 --- a/asm/Kyoto_CWD/main.s +++ b/asm/Kyoto_CWD/main.s @@ -963,25 +963,7 @@ lbl_805A9D78: # ROM: 0x3F6618 .4byte 0x41200000 - .section .text, "ax" -.global EnableMetroTRKInterrupts -EnableMetroTRKInterrupts: -/* 80003640 000005A0 4E 80 00 20 */ blr - -.global InitMetroTRK -InitMetroTRK: -/* 80003644 000005A4 4E 80 00 20 */ blr - -.global sub_80003648 -sub_80003648: -/* 80003648 000005A8 38 60 00 00 */ li r3, 0 -/* 8000364C 000005AC 4E 80 00 20 */ blr - -.global sub_80003650 -sub_80003650: -/* 80003650 000005B0 38 60 00 00 */ li r3, 0 -/* 80003654 000005B4 4E 80 00 20 */ blr .global UpdateStreamedAudio__5CMainFv UpdateStreamedAudio__5CMainFv: @@ -3365,7 +3347,7 @@ lbl_8000570C: /* 80005718 00002678 90 1D 01 2C */ stw r0, 0x12c(r29) /* 8000571C 0000267C 48 36 01 89 */ bl StopAll__19CStreamAudioManagerFv /* 80005720 00002680 3C 60 F0 00 */ lis r3, 0xf000 -/* 80005724 00002684 48 38 0D 39 */ bl sub_8038645c +/* 80005724 00002684 48 38 0D 39 */ bl PADRecalibrate /* 80005728 00002688 38 60 00 01 */ li r3, 1 /* 8000572C 0000268C 48 30 3D 7D */ bl SetIsBeginSceneClearFb__9CGraphicsFb /* 80005730 00002690 48 30 67 75 */ bl BeginScene__9CGraphicsFv diff --git a/asm/Runtime/uart_console_io.s b/asm/Runtime/uart_console_io.s index b46da915..57764873 100644 --- a/asm/Runtime/uart_console_io.s +++ b/asm/Runtime/uart_console_io.s @@ -57,7 +57,7 @@ lbl_80391308: /* 8039130C 0038E26C 7F A4 EB 78 */ mr r4, r29 /* 80391310 0038E270 7F C5 F3 78 */ mr r5, r30 /* 80391314 0038E274 7F E6 FB 78 */ mr r6, r31 -/* 80391318 0038E278 4B C7 23 39 */ bl sub_80003650 +/* 80391318 0038E278 4B C7 23 39 */ bl __TRK_write_console /* 8039131C 0038E27C 38 60 00 00 */ li r3, 0 lbl_80391320: /* 80391320 0038E280 80 01 00 24 */ lwz r0, 0x24(r1) diff --git a/include/MetroTRK/TrkInit.h b/include/MetroTRK/TrkInit.h new file mode 100644 index 00000000..7719c4bc --- /dev/null +++ b/include/MetroTRK/TrkInit.h @@ -0,0 +1,14 @@ +#ifndef __TRKINIT_H__ +#define __TRKINIT_H__ + +#ifdef __cplusplus +extern "C" { +#endif +void InitMetroTRK(void); +void EnableMetroTRKInterrupts(void); +#ifdef __cplusplus +} +#endif + + +#endif /* #ifndef __TRKINIT_H__ */ diff --git a/ldscript.lcf b/ldscript.lcf index c89d2032..9c2c84cd 100644 --- a/ldscript.lcf +++ b/ldscript.lcf @@ -39,4 +39,5 @@ FORCEFILES extab.o extabindex.o uart_console_io.o + mslsupp.o } diff --git a/obj_files.mk b/obj_files.mk index 468c8ad4..48eb3f2a 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -3,6 +3,9 @@ INIT_O_FILES :=\ $(BUILD_DIR)/src/os/__ppc_eabi_init.o\ $(BUILD_DIR)/asm/Runtime/__mem.o +METROTRK_FILES :=\ + $(BUILD_DIR)/src/MetroTRK/mslsupp.o + KYOTO_CWD :=\ $(BUILD_DIR)/asm/Kyoto_CWD/main.o\ $(BUILD_DIR)/asm/Kyoto_CWD/text_80008894_80009144.o\ diff --git a/src/Kyoto_CWD/main.cpp b/src/Kyoto_CWD/main.cpp index f188217e..3d3b56e4 100644 --- a/src/Kyoto_CWD/main.cpp +++ b/src/Kyoto_CWD/main.cpp @@ -56,16 +56,16 @@ u32 sARAMMemArray[2]; bool lbl_805A6BC0; // 80003640 -void nullsub_1() {} +void EnableMetroTRKInterrupts() {} // 80003644 void InitMetroTRK() {} // 80003648 -int sub_80003648() { return 0; } +int __read_console() { return 0; } // 80003650 -int sub_80003650() { return 0; } +int __TRK_write_console() { return 0; } // 80003658 void CMain::UpdateStreamedAudio() { CStreamAudioManager::Update(1.f / 60.f); } diff --git a/src/MetroTRK/mslsupp.c b/src/MetroTRK/mslsupp.c new file mode 100644 index 00000000..2d89a7c8 --- /dev/null +++ b/src/MetroTRK/mslsupp.c @@ -0,0 +1,21 @@ +#include "MetroTRK/TrkInit.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// 80003640 +void EnableMetroTRKInterrupts() {} + +// 80003644 +void InitMetroTRK() {} + +// 80003648 +int __read_console() { return 0; } + +// 80003650 +int __TRK_write_console() { return 0; } + +#ifdef __cplusplus +} +#endif