summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakaRikka <38417346+TakaRikka@users.noreply.github.com>2021-06-06 17:45:21 -0700
committerGitHub <noreply@github.com>2021-06-06 17:45:21 -0700
commit5ed16457ab46d0439c431f830f8bf9956d290b8a (patch)
tree07f7f6fa1ddd6627c6eaff27c6c491b5c897799e
parentf0d805228dd32d0f55b3049b8260e1c59c56cab6 (diff)
parent38d3b8ee68f32df4332482b0fbf284ce763ad920 (diff)
Merge pull request #50 from zsrtp/macro_fix
Add setWaterDropFix macros
-rw-r--r--src/save_manager.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/save_manager.cpp b/src/save_manager.cpp
index 9123394..bb9fc67 100644
--- a/src/save_manager.cpp
+++ b/src/save_manager.cpp
@@ -143,13 +143,29 @@ void SaveManager::load_save_file(const char* fileName) {
SaveManager::inject_save((void*)sTmpBuf);
}
+#if (GCN_NTSCU)
+#define SET_WATER_DROP_COLOR_BL ((uint32_t*)0x800CCE08)
+#endif
+#if (GCN_PAL)
+#define SET_WATER_DROP_COLOR_BL ((uint32_t*)0x800CD014)
+#endif
+#if (GCN_NTSCJ)
+#define SET_WATER_DROP_COLOR_BL ((uint32_t*)0x800CCE40)
+#endif
+#if (WII_NTSCU_10)
+#define SET_WATER_DROP_COLOR_BL ((uint32_t*)0x800C38BC)
+#endif
+#if (WII_PAL)
+#define SET_WATER_DROP_COLOR_BL ((uint32_t*)0x800C3DD4)
+#endif
+
void SaveManager::trigger_load() {
// Loading hasn't started yet, run the before load function and initiate loading
if (!tp_fopScnRq.isLoading && !gSaveManager.loading_initiated) {
// Patch out setWaterDropColor call temporarily (prevents a crash in some scenarios)
- *reinterpret_cast<uint32_t*>(0x800CCE08) = 0x60000000; // nop
- DCFlushRange((void*)(0x800CCE08), sizeof(uint32_t));
- ICInvalidateRange((void*)(0x800CCE08), sizeof(uint32_t));
+ *reinterpret_cast<uint32_t*>(SET_WATER_DROP_COLOR_BL) = 0x60000000; // nop
+ DCFlushRange((void*)(SET_WATER_DROP_COLOR_BL), sizeof(uint32_t));
+ ICInvalidateRange((void*)(SET_WATER_DROP_COLOR_BL), sizeof(uint32_t));
// Trigger loading
g_dComIfG_gameInfo.play.mNextStage.enabled = true;
@@ -168,10 +184,10 @@ void SaveManager::trigger_load() {
// Loading has completed, run the after load function
if (!tp_fopScnRq.isLoading) {
// Patch back in setWaterDropColor call
- *reinterpret_cast<uint32_t*>(0x800CCE08) =
+ *reinterpret_cast<uint32_t*>(SET_WATER_DROP_COLOR_BL) =
0x4BFFF55D; // bl daAlink_c::setWaterDropColor
- DCFlushRange((void*)(0x800CCE08), sizeof(uint32_t));
- ICInvalidateRange((void*)(0x800CCE08), sizeof(uint32_t));
+ DCFlushRange((void*)(SET_WATER_DROP_COLOR_BL), sizeof(uint32_t));
+ ICInvalidateRange((void*)(SET_WATER_DROP_COLOR_BL), sizeof(uint32_t));
if (gSaveManager.mPracticeFileOpts.inject_options_after_load) {
gSaveManager.mPracticeFileOpts.inject_options_after_load();