diff options
Diffstat (limited to 'src/d')
| -rw-r--r-- | src/d/d_com_inf_game.cpp | 2 | ||||
| -rw-r--r-- | src/d/d_cursor_mng.cpp | 61 | ||||
| -rw-r--r-- | src/d/d_rvl_fb_copy.cpp | 20 | ||||
| -rw-r--r-- | src/d/d_s_logo.cpp | 5 | ||||
| -rw-r--r-- | src/d/d_s_play.cpp | 5 | ||||
| -rw-r--r-- | src/d/d_save.cpp | 7 |
6 files changed, 63 insertions, 37 deletions
diff --git a/src/d/d_com_inf_game.cpp b/src/d/d_com_inf_game.cpp index 8dd0118685..c6085579d2 100644 --- a/src/d/d_com_inf_game.cpp +++ b/src/d/d_com_inf_game.cpp @@ -134,7 +134,7 @@ void dComIfG_play_c::setNowVibration(u8 i_vibration) { mItemInfo.mNowVibration = i_vibration; } -u32 dComIfG_play_c::getNowVibration() { +u8 dComIfG_play_c::getNowVibration() { return mItemInfo.mNowVibration; } diff --git a/src/d/d_cursor_mng.cpp b/src/d/d_cursor_mng.cpp index d5586091d1..a97a3d52a7 100644 --- a/src/d/d_cursor_mng.cpp +++ b/src/d/d_cursor_mng.cpp @@ -6,9 +6,6 @@ dCsr_mng_c* dCsr_mng_c::m_myObj; -// TODO: putting this here until a more appropriate place is found -u8 data_8053a730; - void dCsr_mng_c::update_(void) { BOOL is_valid = FALSE; @@ -21,10 +18,10 @@ void dCsr_mng_c::update_(void) { if (is_csr_on == 0) { mDoGph_gInf_c::entryCsr(NULL); - node_c* cur_node = m_csr_list.m_root; + csr_c* cur_node = static_cast<csr_c*>(m_csr_list.m_root); while (cur_node != NULL) { - cur_node->m_pointed_obj = 0; - cur_node = cur_node->m_next; + cur_node->m_pointed_obj = NULL; + cur_node = static_cast<csr_c*>(cur_node->m_next); } return; @@ -35,36 +32,36 @@ void dCsr_mng_c::update_(void) { int x = pos->x; int y = pos->y; - node_c* cur_node = m_csr_list.m_root; + csr_c* csr_node = static_cast<csr_c*>(m_csr_list.m_root); mDoGph_gInf_c::csr_c* csr = NULL; - u16 last_mask = 1; - while (cur_node != NULL) { - cur_node->m_pointed_obj = NULL; + u16 last_mask = 0x1; + while (csr_node != NULL) { + csr_node->m_pointed_obj = NULL; - u16 cur_mask = cur_node->m_mask; - if (!g_dComIfG_gameInfo.play.mItemInfo.mPauseFlag || (cur_node->m_mask & 0x200) == 0) { + u16 cur_mask = csr_node->m_mask; + if (!g_dComIfG_gameInfo.play.mItemInfo.mPauseFlag || (cur_mask & 0x200) == 0) { if (csr == NULL) { - csr = cur_node->m_csr; + csr = csr_node->m_csr; } if (is_valid && last_mask != 0) { last_mask = cur_mask; - if (last_mask != 0) { - node_c* cur_node_2 = m_obj_list.m_root; - while (cur_node_2 != NULL) { - if ((cur_mask & cur_node_2->m_mask) != 0 && - ((bloObj_c*)cur_node_2)->isInside(x, y)) - { - cur_node->m_pointed_obj = cur_node_2; + if (cur_mask != 0) { + node_c* obj_node = m_obj_list.m_root; + u32 mask_temp = (s16)cur_mask; + while (obj_node != NULL) { + if (((u16)mask_temp & obj_node->m_mask) != 0 && + static_cast<bloObj_c*>(obj_node)->isInside(x, y)) { + csr_node->m_pointed_obj = obj_node; } - cur_node_2 = cur_node_2->m_next; + obj_node = obj_node->m_next; } } } } - cur_node = cur_node->m_next; + csr_node = static_cast<csr_c*>(csr_node->m_next); } if (!dComIfGs_getOptPointer()) { @@ -82,7 +79,7 @@ void dCsr_mng_c::update_(void) { void dCsr_mng_c::releaseCsr_(csr_c* i_csr) { mDoGph_gInf_c::csr_c* temp_r5 = i_csr->m_csr; - i_csr->m_pointed_obj = 0; + i_csr->m_pointed_obj = NULL; if (temp_r5 != NULL && temp_r5 == mDoGph_gInf_c::m_csr) { mDoGph_gInf_c::entryCsr(NULL); } @@ -90,12 +87,12 @@ void dCsr_mng_c::releaseCsr_(csr_c* i_csr) { } void dCsr_mng_c::insideObjReleaseCheck_(void) { - node_c* cur_node = m_csr_list.m_root; + csr_c* cur_node = (csr_c*)m_csr_list.m_root; while (cur_node != NULL) { if (!m_obj_list.isEntry(cur_node->m_pointed_obj)) { cur_node->m_pointed_obj = NULL; } - cur_node = cur_node->m_next; + cur_node = (csr_c*)cur_node->m_next; } } @@ -219,14 +216,17 @@ dCsr_mng_c::node_c* dCsr_mng_c::list_c::release(node_c* i_node) { } dCsr_mng_c::node_c* dCsr_mng_c::list_c::release(u16 i_mask) { + node_c* new_root; node_c* cur_node = m_root; while (cur_node != NULL) { if (cur_node->m_mask & i_mask) { - cur_node = release(cur_node); + new_root = release(cur_node); } else { - cur_node = cur_node->m_next; + new_root = cur_node->m_next; } + cur_node = new_root; } + return new_root; } BOOL dCsr_mng_c::list_c::isEntry(const node_c* i_node) const { @@ -268,7 +268,7 @@ BOOL dCsr_mng_c::bloObj_c::isInside(s16 i_x, s16 i_y) { } BOOL dCsr_mng_c::bloObj_c::create(J2DScreen* i_screen, u16 i_mask, u8 i_priority, u8 param_3) { - if (!((node_c*)this)->set(i_priority, param_3, i_mask)) { + if (!set(i_priority, param_3, i_mask)) { return FALSE; } m_screen = i_screen; @@ -325,9 +325,8 @@ void dCsr_mng_c::bloObj_c::createPaneObj(paneObj_c** i_panes, J2DPane* i_pane) { u64 info_tag = i_pane->mInfoTag; char* info_start = nullSkip((char*)&info_tag); if (info_start[0] == 0x4E && info_start[1] == 0x5F) { - paneObj_c* pane = *i_panes; *i_panes -= 1; - pane->m_handle = i_pane; + (*i_panes)->m_handle = i_pane; } JSUTreeIterator<J2DPane> iter = i_pane->getPaneTree()->getFirstChild(); @@ -342,6 +341,8 @@ BOOL dCsr_mng_c::ccObj_c::isInside(s16 param_0, s16 param_1) { return 0; } + f64 temp = 4503601774854144.0f; + f32 x = (param_0 - mDoGph_gInf_c::getMinXF()) / mDoGph_gInf_c::getWidthF() * 2.0f - 1.0f; f32 y = (param_1 - mDoGph_gInf_c::getMinYF()) / mDoGph_gInf_c::getHeightF() * 2.0f - 1.0f; cXyz sp18; diff --git a/src/d/d_rvl_fb_copy.cpp b/src/d/d_rvl_fb_copy.cpp new file mode 100644 index 0000000000..2948559dbe --- /dev/null +++ b/src/d/d_rvl_fb_copy.cpp @@ -0,0 +1,20 @@ +#include "d/d_rvl_fb_copy.h" + +// This TU's existence is inferred from the following facts: +// - In most versions the below flag symbol is located in .sbss between symbols in d_cursor_mng +// and m_Do_main on most versions +// - The symbol is not used in either of those TUs +// - In DZDE01 an extra TU (d_E3Stage_select06) exists between those two TUs, and the flag symbol +// is located before its .sbss symbols meaning it cannot be in m_Do_main +// - In Wii versions there is a 7-byte gap between the last known symbol in d_cursor_mng and the +// flag symbol, which can only be caused by: +// a) An extra unused 4-byte-aligned symbol in d_cursor_mng (unlikely, the symbol map only +// tends to exclude 1-byte symbols) +// b) 4 extra unused 1-byte symbols in d_cursor_mng prior to the flag symbol (generally seems +// implausible to have that many extra unused vars) +// c) The symbol is contained by the demo-specific TU (seems implausible, doesn't really belong +// there and everything else would need to be guarded for other versions rather than just +// excluding the TU) +// d) An extra TU which forces the flag symbol to be aligned to 8 bytes (most likely reason) + +bool g_rvlEnableExtraFramebufferCopy; diff --git a/src/d/d_s_logo.cpp b/src/d/d_s_logo.cpp index dc89b3c40f..8c2c604c40 100644 --- a/src/d/d_s_logo.cpp +++ b/src/d/d_s_logo.cpp @@ -13,6 +13,7 @@ #include "d/d_com_inf_game.h" #include "d/d_item.h" #include "d/d_map_path_dmap.h" +#include "d/d_rvl_fb_copy.h" #include "m_Do/m_Do_Reset.h" #include "m_Do/m_Do_controller_pad.h" #include "m_Do/m_Do_graphic.h" @@ -936,7 +937,7 @@ dScnLogo_c::~dScnLogo_c() { OS_REPORT("\x1b[31m%d gameHeap->getFreeSize %08x(%d)\n\x1b[m", 1479, mDoExt_getGameHeap()->getFreeSize(), mDoExt_getGameHeap()->getFreeSize()); #if PLATFORM_WII - data_8053a730 = 0; + g_rvlEnableExtraFramebufferCopy = false; #endif } @@ -1077,7 +1078,7 @@ int dScnLogo_c::create() { } #if PLATFORM_WII - data_8053a730 = 1; + g_rvlEnableExtraFramebufferCopy = true; #endif mpHeap = mDoExt_setCurrentHeap(mLogo01Heap); diff --git a/src/d/d_s_play.cpp b/src/d/d_s_play.cpp index b916590d08..7c28afed96 100644 --- a/src/d/d_s_play.cpp +++ b/src/d/d_s_play.cpp @@ -18,6 +18,7 @@ #include "d/d_map_path_dmap.h" #include "d/d_meter2_info.h" #include "d/d_msg_object.h" +#include "d/d_rvl_fb_copy.h" #include "d/d_save_HIO.h" #include "f_op/f_op_draw_iter.h" #include "f_op/f_op_msg_mng.h" @@ -895,7 +896,7 @@ static int dScnPly_Delete(dScnPly_c* i_this) { dComIfGp_init(); #if PLATFORM_WII - data_8053a730 = 0; + g_rvlEnableExtraFramebufferCopy = false; #endif JUTAssertion::setMessageCount(0); @@ -1060,7 +1061,7 @@ static int phase_00(dScnPly_c* i_this) { } #if PLATFORM_WII - data_8053a730 = 1; + g_rvlEnableExtraFramebufferCopy = true; #endif #if DEBUG diff --git a/src/d/d_save.cpp b/src/d/d_save.cpp index aaa59edcf1..f52fd4398d 100644 --- a/src/d/d_save.cpp +++ b/src/d/d_save.cpp @@ -1009,9 +1009,12 @@ void dSv_player_config_c::init() { mPointer = 1; } -u32 dSv_player_config_c::checkVibration() const { +u8 dSv_player_config_c::checkVibration() const { #if PLATFORM_GCN - return JUTGamePad::sRumbleSupported & 0x80000000 ? dComIfGp_getNowVibration() : 0; + if (JUTGamePad::sRumbleSupported & 0x80000000) + return dComIfGp_getNowVibration(); + else + return 0; #else return dComIfGp_getNowVibration(); #endif |
