From 9ca1335c558582236a5692625fb2eea3e09add0b Mon Sep 17 00:00:00 2001 From: Cuyler36 Date: Mon, 24 Apr 2023 04:14:34 -0400 Subject: [PATCH] Implement last function 'DebugHaniwaTempo' in m_debug_mode.c --- include/m_home.h | 2 +- rel/m_debug_mode.c | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/include/m_home.h b/include/m_home.h index 9d9e2821..fcde6133 100644 --- a/include/m_home.h +++ b/include/m_home.h @@ -86,7 +86,7 @@ typedef struct home_floor_s { typedef struct home_s { /* 0x0000 */ PersonalID_c ownerID; /* owner player's ID */ /* 0x0014 */ u8 unk_14[6]; - /* 0x001A */ u8 haniwa_tempo[2]; /* unsure about this */ + /* 0x001A */ TempoBeat_c haniwa_tempo; /* unsure about this */ /* 0x001C */ lbRTC_ymd_t hra_mark_time; /* last HRA judge date */ /* 0x0020 */ u32 hra_mark_info; /* bitfield of HRA info pulled when HRA mails letter */ /* 0x0024 */ struct { diff --git a/rel/m_debug_mode.c b/rel/m_debug_mode.c index 96671632..4ac4fbf2 100644 --- a/rel/m_debug_mode.c +++ b/rel/m_debug_mode.c @@ -26,6 +26,7 @@ #include "dolphin/dvd.h" #include "libjsys/jsyswrapper.h" #include "boot.h" +#include "m_common_data.h" #define DEBUG_MODE_PRINT_BUF_COUNT 6 #define DEBUG_MODE_PRINT_OUTPUT_X 26 @@ -589,8 +590,38 @@ static void Debug_mode_zelda_malloc_info_output(gfxprint_t* gfxprint) { } #pragma pool_data reset +/* sizeof(haniwa_tempo_data) == 6 */ +typedef struct { + /* 0x00 */ TempoBeat_c Gt; + /* 0x02 */ TempoBeat_c BS; + /* 0x04 */ TempoBeat_c AS; +} haniwa_tempo_data; + +static haniwa_tempo_data tempo_data[PLAYER_NUM] = { + { {0, 0}, {0, 0}, {0, 0} }, /* House 0 */ + { {0, 0}, {0, 0}, {0, 0} }, /* House 1 */ + { {0, 0}, {0, 0}, {0, 0} }, /* House 2 */ + { {0, 0}, {0, 0}, {0, 0} } /* House 3 */ +}; + static void DebugHaniwaTempo(gfxprint_t* gfxprint) { - /* TODO: this requires implementing m_home & m_house */ + int i; + for (i = 0; i < PLAYER_NUM; i++) { + gfxprint_color(gfxprint, 250, 200, 200, 255); + gfxprint_locate8x8(gfxprint, 3, 23 + i); + gfxprint_printf( + gfxprint, + "S%d,%dGt%d,%dBS%d,%dAS%d,%d", + Save_Get(homes[i].haniwa_tempo.tempo), + Save_Get(homes[i].haniwa_tempo.beat), + tempo_data[i].Gt.tempo, + tempo_data[i].Gt.beat, + tempo_data[i].BS.tempo, + tempo_data[i].BS.beat, + tempo_data[i].AS.tempo, + tempo_data[i].AS.beat + ); + } } #define GFXLIST_RESERVED_SIZE (int)(512 * sizeof(Gfx)) /* requires 0x1000 bytes, or 512 free Gfx */