summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTakaRikka <38417346+TakaRikka@users.noreply.github.com>2025-06-27 03:14:58 -0700
committerGitHub <noreply@github.com>2025-06-27 13:14:58 +0300
commit79c56b254885b006f0fdec184b0ba06fbd3746a3 (patch)
tree3b10ab9144abba0e644d026bcc12c0cf5d3efcb3 /src
parent028c07d47d41b10ba8fbef0ef4240751db74776f (diff)
add wii usa rev0 support (#2505)
* wii usa rev0 dol building ok * wii dol cleanup * some wii tests * most rels building
Diffstat (limited to 'src')
-rw-r--r--src/JSystem/JKernel/JKRHeap.cpp2
-rw-r--r--src/d/d_home_button.cpp55
-rw-r--r--src/d/d_s_room.cpp12
-rw-r--r--src/d/d_save.cpp6
-rw-r--r--src/d/d_stage.cpp9
-rw-r--r--src/m_Do/m_Do_controller_pad.cpp12
-rw-r--r--src/m_Do/m_Re_controller_pad.cpp0
7 files changed, 91 insertions, 5 deletions
diff --git a/src/JSystem/JKernel/JKRHeap.cpp b/src/JSystem/JKernel/JKRHeap.cpp
index 5cbcf59626..7da2689cee 100644
--- a/src/JSystem/JKernel/JKRHeap.cpp
+++ b/src/JSystem/JKernel/JKRHeap.cpp
@@ -24,7 +24,7 @@ JKRHeap* JKRHeap::sCurrentHeap;
/* 80451378-8045137C 000878 0004+00 3/3 10/10 0/0 .sbss sRootHeap__7JKRHeap */
JKRHeap* JKRHeap::sRootHeap;
-#ifdef DEBUG
+#if PLATFORM_WII || PLATFORM_SHIELD
JKRHeap* JKRHeap::sRootHeap2;
#endif
diff --git a/src/d/d_home_button.cpp b/src/d/d_home_button.cpp
new file mode 100644
index 0000000000..f5604d5624
--- /dev/null
+++ b/src/d/d_home_button.cpp
@@ -0,0 +1,55 @@
+#include "d/d_home_button.h"
+#include "Z2AudioLib/Z2AudioMgr.h"
+
+int SECallback(int param_0, int param_1) {
+ if (param_0 == 5) {
+ Z2AudioMgr::getInterface()->homeMenuSeCallback(param_1);
+ return 1;
+ } else {
+ OSReport("SECallback: %d, %d\n", param_0, param_1);
+ return 0;
+ }
+}
+
+void dHomeButton_c::create_(int param_0, void* param_1) {
+ initCursorPos();
+ initHomeButtonInfo(param_0, param_1);
+
+ m_info.mem = JKRGetRootHeap2()->alloc(0x80000, 0);
+ m_info.memSize = 0x80000;
+ m_info.pAllocator = 0;
+
+ HBMCreate(&m_info);
+}
+
+int dHomeButton_c::execute_() {
+ // NONMATCHING
+}
+
+void dHomeButton_c::initHomeButtonInfo(int param_0, void* param_1) {
+ // NONMATCHING
+}
+
+void dHomeButton_c::initCursorPos() {
+ // NONMATCHING
+}
+
+void dHomeButton_c::calcCursorPos() {
+ // NONMATCHING
+}
+
+void dHomeButton_c::onReset() {
+ // NONMATCHING
+}
+
+void dHomeButton_c::create(int param_0, void* param_1) {
+ // NONMATCHING
+}
+
+int dHomeButton_c::execute() {
+ // NONMATCHING
+}
+
+void dHomeButton_c::drawCapture(u8 param_0, void (*param_1)(J2DOrthoGraph&, void*), void* param_2) {
+ // NONMATCHING
+}
diff --git a/src/d/d_s_room.cpp b/src/d/d_s_room.cpp
index d5ed6d27cd..f043cdc88f 100644
--- a/src/d/d_s_room.cpp
+++ b/src/d/d_s_room.cpp
@@ -193,7 +193,11 @@ static bool objectSetCheck(room_of_scene_class* i_this) {
if (*dStage_roomControl_c::getDemoArcName() != '\0') {
int phase = dComIfG_syncObjectRes(dStage_roomControl_c::getDemoArcName());
- if (phase >= 0 && phase > 0) {
+ if (phase < 0) {
+ #if VERSION == VERSION_WII_USA_R0
+ dStage_escapeRestart();
+ #endif
+ } else if (phase > 0) {
return 0;
}
}
@@ -342,6 +346,9 @@ static int phase_1(room_of_scene_class* i_this) {
}
if (!dComIfG_setStageRes(arcName, heap)) {
+ #if VERSION == VERSION_WII_USA_R0
+ dStage_escapeRestart();
+ #endif
return cPhs_ERROR_e;
}
}
@@ -355,6 +362,9 @@ static int phase_2(room_of_scene_class* i_this) {
int phase = dComIfG_syncStageRes(arcName);
if (phase < 0) {
+ #if VERSION == VERSION_WII_USA_R0
+ dStage_escapeRestart();
+ #endif
return cPhs_ERROR_e;
}
diff --git a/src/d/d_save.cpp b/src/d/d_save.cpp
index a76a698202..6e7ea02027 100644
--- a/src/d/d_save.cpp
+++ b/src/d/d_save.cpp
@@ -1079,7 +1079,7 @@ void dSv_player_config_c::init() {
unk0 = 1;
#endif
-#if VERSION != VERSION_SHIELD_DEBUG
+#if PLATFORM_GCN
if (OSGetSoundMode() == OS_SOUND_MODE_MONO) {
mSoundMode = OS_SOUND_MODE_MONO;
Z2AudioMgr::mAudioMgrPtr->setOutputMode(OS_SOUND_MODE_MONO);
@@ -1110,7 +1110,7 @@ void dSv_player_config_c::init() {
/* 80034644-80034684 02EF84 0040+00 0/0 4/4 0/0 .text checkVibration__19dSv_player_config_cCFv */
u32 dSv_player_config_c::checkVibration() const {
-#if VERSION != VERSION_SHIELD_DEBUG
+#if PLATFORM_GCN
return JUTGamePad::sRumbleSupported & 0x80000000 ? dComIfGp_getNowVibration() : 0;
#else
return dComIfGp_getNowVibration();
@@ -1979,7 +1979,7 @@ int dSv_info_c::card_to_memory(char* i_cardPtr, int i_dataNum) {
memcpy(dComIfGs_getSaveData(), i_cardPtr, sizeof(dSv_save_c));
i_cardPtr += sizeof(dSv_save_c);
-#if VERSION != VERSION_SHIELD_DEBUG
+#if PLATFORM_GCN
if (OSGetSoundMode() == OS_SOUND_MODE_MONO) {
g_dComIfG_gameInfo.info.getPlayer().getConfig().setSound(OS_SOUND_MODE_MONO);
Z2AudioMgr::mAudioMgrPtr->setOutputMode(OS_SOUND_MODE_MONO);
diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp
index 8204664d57..28a71382a3 100644
--- a/src/d/d_stage.cpp
+++ b/src/d/d_stage.cpp
@@ -10,6 +10,7 @@
#include "stdio.h"
#include "SSystem/SComponent/c_malloc.h"
#include "d/d_com_inf_game.h"
+#include "d/actor/d_a_alink.h"
#include "d/d_lib.h"
#include "d/d_map_path_dmap.h"
#include "d/d_map_path_fmap.h"
@@ -2793,3 +2794,11 @@ void dStage_restartRoom(u32 roomParam, u32 mode, int param_2) {
mode, 0, 0, 0, param_2, 0);
dComIfGs_setRestartRoomParam(roomParam);
}
+
+#if VERSION == VERSION_WII_USA_R0
+void dStage_escapeRestart() {
+ daAlink_c* player_p = daAlink_getAlinkActorClass();
+ dComIfGs_setTurnRestart(player_p->current.pos, player_p->shape_angle.y, fopAcM_GetRoomNo(player_p), fopAcM_GetParam(player_p));
+ dComIfGp_setNextStage(dComIfGp_getStartStageName(), -2, dComIfGs_getTurnRestartRoomNo(), -1, 0.0f, 0, 0, 9, 0, 1, 0);
+}
+#endif
diff --git a/src/m_Do/m_Do_controller_pad.cpp b/src/m_Do/m_Do_controller_pad.cpp
index c179a25f29..5821edc511 100644
--- a/src/m_Do/m_Do_controller_pad.cpp
+++ b/src/m_Do/m_Do_controller_pad.cpp
@@ -17,23 +17,35 @@ interface_of_controller_pad mDoCPd_c::m_cpadInfo[4];
/* 80007954-80007A94 002294 0140+00 0/0 1/1 0/0 .text create__8mDoCPd_cFv */
void mDoCPd_c::create() {
+ #if PLATFORM_GCN || PLATFORM_SHIELD
JUTGamePad* pad = new JUTGamePad(JUTGamePad::EPort1);
m_gamePad[0] = pad;
+ #endif
if (mDoMain::developmentMode != 0) {
+ #if PLATFORM_WII
+ m_gamePad[0] = new JUTGamePad(JUTGamePad::EPort1);
+ #endif
+
m_gamePad[1] = new JUTGamePad(JUTGamePad::EPort2);
m_gamePad[2] = new JUTGamePad(JUTGamePad::EPort3);
m_gamePad[3] = new JUTGamePad(JUTGamePad::EPort4);
} else {
+ #if PLATFORM_WII
+ m_gamePad[0] = NULL;
+ #endif
+
m_gamePad[1] = NULL;
m_gamePad[2] = NULL;
m_gamePad[3] = NULL;
}
+ #if PLATFORM_GCN || PLATFORM_SHIELD
if (!mDoRst::isReset()) {
JUTGamePad::clearResetOccurred();
JUTGamePad::setResetCallback(mDoRst_resetCallBack, NULL);
}
+ #endif
JUTGamePad::setAnalogMode(3);
interface_of_controller_pad* cpad = &m_cpadInfo[0];
diff --git a/src/m_Do/m_Re_controller_pad.cpp b/src/m_Do/m_Re_controller_pad.cpp
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/src/m_Do/m_Re_controller_pad.cpp