summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakaRikka <38417346+TakaRikka@users.noreply.github.com>2021-06-06 13:31:01 -0700
committerGitHub <noreply@github.com>2021-06-06 16:31:01 -0400
commitf0d805228dd32d0f55b3049b8260e1c59c56cab6 (patch)
tree3ccb7edc9a51eccc71c2548877ea1c35190f7dab
parent94c51dd196f4653364365904a18c80421cf2d222 (diff)
update for decomp overhaul (#49)
* update for libtp decomp overhaul * Update gcn_c * format * few fixes * clang-format Co-authored-by: Pheenoh <pheenoh@gmail.com>
m---------external/gcn_c0
m---------external/libtp_c0
-rw-r--r--include/controller.h2
-rw-r--r--include/corotdcheck.h5
-rw-r--r--include/flaglog.h6
-rw-r--r--include/font.h2
-rw-r--r--include/gz_flags.h5
-rw-r--r--include/lib.h1
-rw-r--r--include/menu.h4
-rw-r--r--include/menus/flags_menu.h2
-rw-r--r--include/menus/item_wheel_menu.h92
-rw-r--r--include/menus/memfiles_menu.h4
-rw-r--r--include/menus/tools_menu.h5
-rw-r--r--include/save_manager.h13
-rw-r--r--include/spawning.h10
-rw-r--r--include/utils/card.h2
-rw-r--r--include/utils/draw.h2
-rw-r--r--include/utils/hook.h6
-rw-r--r--include/utils/link.h14
-rw-r--r--src/actor.cpp13
-rw-r--r--src/bit.cpp21
-rw-r--r--src/commands.cpp47
-rw-r--r--src/controller.cpp21
-rw-r--r--src/corotdcheck.cpp65
-rw-r--r--src/fifo_queue.cpp2
-rw-r--r--src/flaglog.cpp58
-rw-r--r--src/font.cpp2
-rw-r--r--src/free_cam.cpp15
-rw-r--r--src/fs.cpp2
-rw-r--r--src/gorge.cpp55
-rw-r--r--src/gz_flags.cpp48
-rw-r--r--src/input_viewer.cpp10
-rw-r--r--src/lib.cpp22
-rw-r--r--src/menus/ad_saves_menu.cpp36
-rw-r--r--src/menus/amounts_menu.cpp40
-rw-r--r--src/menus/any_saves_menu.cpp43
-rw-r--r--src/menus/cheat_menu.cpp79
-rw-r--r--src/menus/dungeon_flags_menu.cpp126
-rw-r--r--src/menus/flag_log_menu.cpp2
-rw-r--r--src/menus/flag_records_menu.cpp20
-rw-r--r--src/menus/flags_menu.cpp2
-rw-r--r--src/menus/general_flags_menu.cpp69
-rw-r--r--src/menus/hundo_saves_menu.cpp91
-rw-r--r--src/menus/item_wheel_menu.cpp363
-rw-r--r--src/menus/main_menu.cpp3
-rw-r--r--src/menus/memfiles_menu.cpp22
-rw-r--r--src/menus/memory_editor_menu.cpp5
-rw-r--r--src/menus/memory_menu.cpp1
-rw-r--r--src/menus/pause_menu.cpp137
-rw-r--r--src/menus/portal_flags_menu.cpp78
-rw-r--r--src/menus/position_settings_menu.cpp4
-rw-r--r--src/menus/practice_menu.cpp2
-rw-r--r--src/menus/scene_menu.cpp26
-rw-r--r--src/menus/settings_menu.cpp3
-rw-r--r--src/menus/tools_menu.cpp21
-rw-r--r--src/menus/warping_menu.cpp30
-rw-r--r--src/menus/watches_menu.cpp4
-rw-r--r--src/movelink.cpp172
-rw-r--r--src/rollcheck.cpp21
-rw-r--r--src/save_manager.cpp82
-rw-r--r--src/system.cpp12
-rw-r--r--src/time.cpp4
-rw-r--r--src/timer.cpp7
-rw-r--r--src/utils/audio.cpp2
-rw-r--r--src/utils/card.cpp38
-rw-r--r--src/utils/disc.cpp4
-rw-r--r--src/utils/draw.cpp3
-rw-r--r--src/utils/hook.cpp72
-rw-r--r--src/utils/lines.cpp4
-rw-r--r--src/utils/link.cpp42
-rw-r--r--src/utils/loading.cpp21
-rw-r--r--src/utils/memory.cpp2
-rw-r--r--src/utils/texture.cpp4
73 files changed, 1097 insertions, 1156 deletions
diff --git a/external/gcn_c b/external/gcn_c
-Subproject 65dae72e1ee0ad38bdef3186e3e5991f9166436
+Subproject ef13ceee12818a2b7a052068d5936ae3e3a32d2
diff --git a/external/libtp_c b/external/libtp_c
-Subproject 85090d8aa47a6f9a4e2c32b873153080f7cd401
+Subproject 809551857b58bd3ed6af472fdca53b90778945f
diff --git a/include/controller.h b/include/controller.h
index 5586bfd..fdc5314 100644
--- a/include/controller.h
+++ b/include/controller.h
@@ -40,7 +40,7 @@ enum Button {
bool button_is_pressed(int idx);
bool button_is_pressed(int idx, uint16_t repeat_time);
bool button_is_down(int idx);
-bool button_is_held(int idx);
+bool button_is_held(int idx, int phase = 0);
uint16_t get_current_inputs();
void read_controller();
} // namespace Controller \ No newline at end of file
diff --git a/include/corotdcheck.h b/include/corotdcheck.h
new file mode 100644
index 0000000..a57124f
--- /dev/null
+++ b/include/corotdcheck.h
@@ -0,0 +1,5 @@
+#pragma once
+
+namespace CoroTDChecker {
+void run();
+} // namespace CoroTDChecker \ No newline at end of file
diff --git a/include/flaglog.h b/include/flaglog.h
index c60a24c..dd25f53 100644
--- a/include/flaglog.h
+++ b/include/flaglog.h
@@ -1,9 +1,3 @@
#pragma once
extern bool g_flag_log_active;
-
-namespace FlagLog {
-void run();
-void display_log(const char* name, uint8_t* record, uint8_t saved_record[], int record_size);
-void save_record(uint8_t* record, uint8_t saved_record[], int record_size);
-} // namespace FlagLog \ No newline at end of file
diff --git a/include/font.h b/include/font.h
index 5973b7f..14c3b52 100644
--- a/include/font.h
+++ b/include/font.h
@@ -1,6 +1,6 @@
#pragma once
-#include "libtp_c/include/utils.h"
+#include "libtp_c/include/dolphin/mtx/vec.h"
#include "libtp_c/include/addrs.h"
#include "utils/texture.h"
#include "gcn_c/include/gfx.h"
diff --git a/include/gz_flags.h b/include/gz_flags.h
index 410994e..9464c93 100644
--- a/include/gz_flags.h
+++ b/include/gz_flags.h
@@ -9,10 +9,13 @@
struct GZFlag {
bool* activation_flag;
+ int required_phase;
void (*flag_active_function)();
void (*flag_deactive_function)();
};
+enum LoopPhase { GAME_LOOP, POST_GAME_LOOP };
+
namespace GZFlags {
-void apply_active_flags();
+void apply_active_flags(int loop_phase);
} \ No newline at end of file
diff --git a/include/lib.h b/include/lib.h
index cbfe9ff..f6816aa 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -4,5 +4,6 @@ extern "C" {
void init();
void game_loop();
+void post_game_loop();
void draw();
}
diff --git a/include/menu.h b/include/menu.h
index 314ac49..4972c7e 100644
--- a/include/menu.h
+++ b/include/menu.h
@@ -3,8 +3,8 @@
#include "commands.h"
#include "font.h"
#include "input_viewer.h"
-#include "libtp_c/include/controller.h"
-#include "libtp_c/include/utils.h"
+#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
+#include "libtp_c/include/dolphin/mtx/vec.h"
#include "timer.h"
#define MAX_LIST_MEMBER_LENGTH 40
diff --git a/include/menus/flags_menu.h b/include/menus/flags_menu.h
index f5e9aac..2072717 100644
--- a/include/menus/flags_menu.h
+++ b/include/menus/flags_menu.h
@@ -22,10 +22,10 @@ enum GeneralFlagsIndex {
enum DungeonFlagsIndex {
SELECT_DUNGEON_INDEX,
+ SMALL_KEY_FLAG_INDEX,
MAP_FLAG_INDEX,
COMPASS_FLAG_INDEX,
BOSS_KEY_FLAG_INDEX,
- SMALL_KEY_FLAG_INDEX,
DEFEAT_MINIBOSS_FLAG_INDEX,
DEFEAT_BOSS_FLAG_INDEX,
CLEAR_DUNGEON_FLAGS_INDEX
diff --git a/include/menus/item_wheel_menu.h b/include/menus/item_wheel_menu.h
index 91aee8f..ccab098 100644
--- a/include/menus/item_wheel_menu.h
+++ b/include/menus/item_wheel_menu.h
@@ -1,96 +1,8 @@
#include "menu.h"
-
-enum ItemID {
- OOCCOO_SR = 37,
- OOCCOO_JR = 39,
- OOCCOOS_NOTE = 45,
- HAWKEYE = 62,
- GALE_BOOMERANG = 64,
- SPINNER,
- BALL_AND_CHAIN,
- HEROS_BOW,
- CLAWSHOT,
- IRON_BOOTS,
- DOMINION_ROD,
- DOUBLE_CLAWSHOT,
- LANTERN,
- MASTER_SWORD,
- FISHING_ROD,
- SLINGSHOT,
- EMPTY_BOMBBAG = 80,
- ROD_BEE_LARVA = 91,
- ROD_CORAL_EARRING,
- ROD_WORM,
- ROD_CORAL_EARRING_BEE_LARVA,
- ROD_CORAL_EARRING_WORM,
- EMPTY_BOTTLE,
- RED_POTION,
- MAGIC_POTION,
- BLUE_POTION,
- MILK,
- HALF_MILK,
- LANTERN_OIL,
- WATER,
- NASTY_SOUP = 106,
- HOT_SPRING_WATER,
- FAIRY,
- REGULAR_BOMBS = 112,
- WATER_BOMBS,
- BOMBLINGS,
- FAIRY_TEARS,
- WORM,
- BEE_LARVA = 118,
- RARE_CHU,
- RED_CHU,
- BLUE_CHU,
- GREEN_CHU,
- YELLOW_CHU,
- PURPLE_CHU,
- SIMPLE_SOUP,
- GOOD_SOUP,
- SUPERB_SOUP,
- RENADOS_LETTER,
- INVOICE,
- WOODEN_STATUE,
- ILIAS_CHARM,
- HORSE_CALL,
- AURUS_MEMO = 144,
- ASHEIS_SKETCH,
- ANCIENT_SKY_BOOK_EMPTY = 233,
- ANCIENT_SKY_BOOK_PARTIAL,
- ANCIENT_SKY_BOOK_FILLED,
- NO_ITEM = 255
-};
-
-enum Slot {
- SLOT_0,
- SLOT_1,
- SLOT_2,
- SLOT_3,
- SLOT_4,
- SLOT_5,
- SLOT_6,
- SLOT_7,
- SLOT_8,
- SLOT_9,
- SLOT_10,
- SLOT_11,
- SLOT_12,
- SLOT_13,
- SLOT_14,
- SLOT_15,
- SLOT_16,
- SLOT_17,
- SLOT_18,
- SLOT_19,
- SLOT_20,
- SLOT_21,
- SLOT_22,
- SLOT_23
-};
+#include "libtp_c/include/d/save/d_save.h"
struct ItemLookup {
- enum ItemID item_id;
+ enum ItemTable item_id;
char item_description[40];
};
diff --git a/include/menus/memfiles_menu.h b/include/menus/memfiles_menu.h
index 7f3162a..a2c08e5 100644
--- a/include/menus/memfiles_menu.h
+++ b/include/menus/memfiles_menu.h
@@ -1,4 +1,6 @@
#include "menu.h"
+#include "libtp_c/include/dolphin/mtx/vec.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
#define MEMFILE_SLOT_INDEX 0
#define MEMFILE_SAVE_INDEX 1
@@ -6,7 +8,7 @@
#define MEMFILE_DELETE_INDEX 3
struct PositionData {
- Vec3 link;
+ cXyz link;
CameraMatrix cam;
uint16_t angle;
};
diff --git a/include/menus/tools_menu.h b/include/menus/tools_menu.h
index c32756c..e5e3c8e 100644
--- a/include/menus/tools_menu.h
+++ b/include/menus/tools_menu.h
@@ -3,10 +3,10 @@
#include "menu.h"
#ifdef WII_PLATFORM
-#define TOOL_AMNT 17
+#define TOOL_AMNT 18
#endif
#ifdef GCN_PLATFORM
-#define TOOL_AMNT 16
+#define TOOL_AMNT 17
#endif
namespace Tools {
enum ToolsIndex {
@@ -17,6 +17,7 @@ enum ToolsIndex {
#ifdef WII_PLATFORM
BIT_INDEX,
#endif
+ COROTD_INDEX,
INPUT_VIEWER_INDEX,
LINK_DEBUG_INDEX,
SAND_INDEX,
diff --git a/include/save_manager.h b/include/save_manager.h
index 2e1ab91..48b5232 100644
--- a/include/save_manager.h
+++ b/include/save_manager.h
@@ -1,6 +1,5 @@
#pragma once
-#include "menu.h"
#include "menus/cheats_menu.h"
#include "menus/memory_menu.h"
#include "menus/position_settings_menu.h"
@@ -8,7 +7,8 @@
#include "menus/settings_menu.h"
#include "menus/tools_menu.h"
#include "menus/hundo_saves_menu.h"
-#include "libtp_c/include/system.h"
+#include "libtp_c/include/msl_c/string.h"
+#include "libtp_c/include/dolphin/mtx/vec.h"
#define GZ_SAVE_VERSION_NUMBER 0
#define GZ_SAVE_ENTRIES_AMNT 10
@@ -36,7 +36,7 @@
struct AreaReload {
uint8_t temp_flags[0x20];
- uint16_t tears;
+ uint8_t tears[4];
};
typedef void (*LoadingCallback)(void);
@@ -67,9 +67,9 @@ struct PracticeSaveInfo {
uint8_t requirements;
uint8_t _p0[1];
uint16_t angle;
- Vec3 position;
- Vec3 cam_pos;
- Vec3 cam_target;
+ Vec position;
+ Vec cam_pos;
+ Vec cam_target;
uint32_t counter;
char filename[32];
uint8_t _p1[4];
@@ -88,6 +88,7 @@ public:
static void inject_memfile(void* buffer);
static void inject_default_before();
static void inject_default_during();
+ static void inject_memfile_during();
static void inject_default_after();
static void load_save(uint32_t id, char* category, special* i_specials = nullptr, int size = 0);
static void load_save_file(const char* fileName);
diff --git a/include/spawning.h b/include/spawning.h
index acb5629..7c32c49 100644
--- a/include/spawning.h
+++ b/include/spawning.h
@@ -2,11 +2,11 @@
#include <stdint.h>
#include <string.h>
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
struct ActorMemory {
uint32_t params;
- Vec3 coord;
+ Vec coord;
uint16_t rotation[2];
uint16_t flag;
uint16_t enemyId;
@@ -18,7 +18,7 @@ struct ActorMemory {
struct ActorTemplate {
uint8_t name[8];
uint32_t params;
- Vec3 coord;
+ Vec coord;
uint16_t rotation[2];
uint16_t flag;
uint16_t enemyId;
@@ -31,7 +31,7 @@ struct ActorInfo {
uint8_t param2;
};
-#define fopAcM_CreateAppend_addr 0x80019AA8
+/* #define fopAcM_CreateAppend_addr 0x80019AA8
#define dStage_ActorCreate_addr 0x80024EFC
typedef ActorMemory* (*fopAcM_CreateAppend_t)(void);
@@ -71,4 +71,4 @@ void spawn(const char* name) {
if (link) {
createActor(name, link->position, link->facing);
}
-} \ No newline at end of file
+} */ \ No newline at end of file
diff --git a/include/utils/card.h b/include/utils/card.h
index 22205f4..74540fb 100644
--- a/include/utils/card.h
+++ b/include/utils/card.h
@@ -2,6 +2,8 @@
#include "gcn_c/include/card.h"
#include "menu.h"
+extern bool inject_memfile_flag;
+
namespace Utilities {
int32_t card_write(CardInfo* card_info, void* data, int32_t size, int32_t offset,
int32_t sector_size);
diff --git a/include/utils/draw.h b/include/utils/draw.h
index 42088be..6bbdf53 100644
--- a/include/utils/draw.h
+++ b/include/utils/draw.h
@@ -2,7 +2,7 @@
#include "libtp_c/include/addrs.h"
#include "gcn_c/include/gfx.h"
-#include "libtp_c/include/utils.h"
+#include "libtp_c/include/dolphin/mtx/vec.h"
#include "utils/texture.h"
extern Texture blankTex;
diff --git a/include/utils/hook.h b/include/utils/hook.h
index efaf7d2..88ecddb 100644
--- a/include/utils/hook.h
+++ b/include/utils/hook.h
@@ -1,5 +1,5 @@
-#define HOOK_AMNT 9
+#define HOOK_AMNT 13
enum HookIndex {
HK_LIB_INIT_INDEX = 0,
HK_LIB_GAME_LOOP_INDEX = 1,
@@ -10,6 +10,10 @@ enum HookIndex {
HK_UNRESTRICTED_ITEMS_INDEX = 6,
HK_TRANSFORM_ANYWHERE_INDEX = 7,
HK_INVINCIBLE_ENEMIES_INDEX = 8,
+ HK_ONEVENTBIT_INDEX = 9,
+ HK_OFFEVENTBIT_INDEX = 10,
+ HK_ONSWITCH_INDEX = 11,
+ HK_PUTSAVE_INDEX = 12,
};
namespace Hook {
diff --git a/include/utils/link.h b/include/utils/link.h
index 5d8573f..b165de4 100644
--- a/include/utils/link.h
+++ b/include/utils/link.h
@@ -1,6 +1,6 @@
#pragma once
#include "font.h"
-#include "libtp_c/include/gc/OSCache.h"
+#include "libtp_c/include/dolphin/os/OSCache.h"
namespace Utilities {
void show_link_debug_info();
@@ -18,14 +18,14 @@ inline void setup_link_color() {
#define SWORD_UP_BLUE_ADDR 0x80117d94
#endif
*reinterpret_cast<uint32_t*>(SWORD_UP_RED_ADDR) = 0x60000000; // nop
- gc::os_cache::DCFlushRange((void*)(SWORD_UP_RED_ADDR), sizeof(uint32_t));
- gc::os_cache::ICInvalidateRange((void*)(SWORD_UP_RED_ADDR), sizeof(uint32_t));
+ DCFlushRange((void*)(SWORD_UP_RED_ADDR), sizeof(uint32_t));
+ ICInvalidateRange((void*)(SWORD_UP_RED_ADDR), sizeof(uint32_t));
*reinterpret_cast<uint32_t*>(SWORD_UP_GREEN_ADDR) = 0x60000000; // nop
- gc::os_cache::DCFlushRange((void*)(SWORD_UP_GREEN_ADDR), sizeof(uint32_t));
- gc::os_cache::ICInvalidateRange((void*)(SWORD_UP_GREEN_ADDR), sizeof(uint32_t));
+ DCFlushRange((void*)(SWORD_UP_GREEN_ADDR), sizeof(uint32_t));
+ ICInvalidateRange((void*)(SWORD_UP_GREEN_ADDR), sizeof(uint32_t));
*reinterpret_cast<uint32_t*>(SWORD_UP_BLUE_ADDR) = 0x60000000; // nop
- gc::os_cache::DCFlushRange((void*)(SWORD_UP_BLUE_ADDR), sizeof(uint32_t));
- gc::os_cache::ICInvalidateRange((void*)(SWORD_UP_BLUE_ADDR), sizeof(uint32_t));
+ DCFlushRange((void*)(SWORD_UP_BLUE_ADDR), sizeof(uint32_t));
+ ICInvalidateRange((void*)(SWORD_UP_BLUE_ADDR), sizeof(uint32_t));
#endif // WII_PLATFORM
}
} // namespace Utilities \ No newline at end of file
diff --git a/src/actor.cpp b/src/actor.cpp
index 988b2ea..5bc61d2 100644
--- a/src/actor.cpp
+++ b/src/actor.cpp
@@ -1,7 +1,6 @@
#include "actor.h"
-#include "libtp_c/include/actor.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/msl_c/string.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
namespace Actor {
bool freeze_run_once;
@@ -9,24 +8,24 @@ bool hide_run_once;
void freeze_actors() {
freeze_run_once = true;
- tp_actor.freeze = true;
+ g_dComIfAc_gameInfo.freeze = true;
}
void unfreeze_actors() {
if (freeze_run_once) {
- tp_actor.freeze = false;
+ g_dComIfAc_gameInfo.freeze = false;
freeze_run_once = false;
}
}
void hide_actors() {
hide_run_once = true;
- tp_stopstatus.hide_actors = true;
+ fopAc_ac_c__stopStatus |= 0x100;
}
void show_actors() {
if (hide_run_once) {
- tp_stopstatus.hide_actors = false;
+ fopAc_ac_c__stopStatus &= ~0x100;
hide_run_once = false;
}
}
diff --git a/src/bit.cpp b/src/bit.cpp
index 4ee1a28..48ffb08 100644
--- a/src/bit.cpp
+++ b/src/bit.cpp
@@ -1,9 +1,8 @@
#ifdef WII_PLATFORM
#include "bit.h"
-#include "libtp_c/include/tp.h"
-#include "libtp_c/include/math.h"
-#include "libtp_c/include/controller.h"
-#include "libtp_c/include/system.h"
+#include "libtp_c/include/msl_c/math.h.h"
+#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
+#include "libtp_c/include/msl_c/string.h"
#include "fifo_queue.h"
#include "controller.h"
#include "fifo_queue.h"
@@ -26,8 +25,8 @@ using namespace Controller;
static char buf[30];
void set_camera_angle_position() {
- tp_zelAudio.link_debug_ptr->position = {466.622467f, 319.770752f, -11651.3867f};
- tp_zelAudio.link_debug_ptr->facing = 32000;
+ dComIfGp_getPlayer()->mCurrent.mPosition = {466.622467f, 319.770752f, -11651.3867f};
+ dComIfGp_getPlayer()->mCollisionRot.mY = 32000;
tp_matrixInfo.matrix_info->target = {465.674622f, 421.052704f, -11651.0684f};
tp_matrixInfo.matrix_info->pos = {735.525391f, 524.418701f, -11576.4746f};
}
@@ -35,13 +34,13 @@ void set_camera_angle_position() {
void run() {
double dt = 0;
- if (tp_zelAudio.link_debug_ptr != NULL && tp_gameInfo.momentum_ptr != NULL) {
- const bool has_boots = (tp_zelAudio.link_debug_ptr->current_boots & 0x02) != 0;
+ if (dComIfGp_getPlayer()) {
+ const bool has_boots = (dComIfGp_getPlayer()->mNoResetFlg0 & 0x02) != 0;
const double term_vel = has_boots ? BOOTS_TERM_VEL : NORMAL_TERM_VEL;
const double acc = has_boots ? BOOTS_ACC : NORMAL_ACC;
- const double v_y1 = tp_gameInfo.momentum_ptr->link_momentum.y;
- const double dist_from_last_ground = (tp_zelAudio.link_debug_ptr->position.y -
- tp_zelAudio.link_debug_ptr->last_ground_y_pos_void);
+ const double v_y1 = dComIfGp_getPlayer()->mSpeed.y;
+ const double dist_from_last_ground =
+ (dComIfGp_getPlayer()->mCurrent.mPosition.y - dComIfGp_getPlayer()->field_0x33c8);
// Calculate how many frames before reaching terminal velocity
double dt_1 = (term_vel - v_y1) / acc;
diff --git a/src/commands.cpp b/src/commands.cpp
index f85c6ac..ec64895 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -7,14 +7,14 @@
#include "bit.h"
#endif
#include "lib.h"
-#include "libtp_c/include/controller.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
+#include "libtp_c/include/msl_c/string.h"
#include "menus/practice_menu.h"
#include "menus/settings_menu.h"
#include "menus/hundo_saves_menu.h"
#include "movelink.h"
-
+#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "libtp_c/include/f_op/f_op_draw_tag.h"
#include "timer.h"
#include "utils/loading.h"
@@ -27,21 +27,18 @@ bool reset_timer = false;
bool commands_states[COMMANDS_AMNT];
namespace Commands {
-static float saved_x = 0.0f;
-static float saved_y = 0.0f;
-static float saved_z = 0.0f;
+static cXyz saved_player_pos(0.0f, 0.0f, 0.0f);
static uint16_t saved_angle = 0;
-static Vec3 saved_pos = {0.0f, 0.0f, 0.0f};
-static Vec3 saved_target = {0.0f, 0.0f, 0.0f};
+
+static Vec saved_pos = {0.0f, 0.0f, 0.0f};
+static Vec saved_target = {0.0f, 0.0f, 0.0f};
static int button_last_frame;
static int button_this_frame;
void store_position() {
- if (tp_zelAudio.link_debug_ptr) {
- saved_x = tp_zelAudio.link_debug_ptr->position.x;
- saved_y = tp_zelAudio.link_debug_ptr->position.y;
- saved_z = tp_zelAudio.link_debug_ptr->position.z;
- saved_angle = tp_zelAudio.link_debug_ptr->facing;
+ if (dComIfGp_getPlayer()) {
+ saved_player_pos = dComIfGp_getPlayer()->mCurrent.mPosition;
+ saved_angle = dComIfGp_getPlayer()->mCollisionRot.mY;
}
if (tp_matrixInfo.matrix_info) {
@@ -51,11 +48,9 @@ void store_position() {
}
void load_position() {
- if (tp_zelAudio.link_debug_ptr) {
- tp_zelAudio.link_debug_ptr->position.x = saved_x;
- tp_zelAudio.link_debug_ptr->position.y = saved_y;
- tp_zelAudio.link_debug_ptr->position.z = saved_z;
- tp_zelAudio.link_debug_ptr->facing = saved_angle;
+ if (dComIfGp_getPlayer()) {
+ dComIfGp_getPlayer()->mCurrent.mPosition = saved_player_pos;
+ dComIfGp_getPlayer()->mCollisionRot.mY = saved_angle;
}
if (tp_matrixInfo.matrix_info) {
@@ -65,8 +60,8 @@ void load_position() {
}
void moon_jump() {
- if (tp_gameInfo.momentum_ptr) {
- tp_gameInfo.momentum_ptr->link_momentum.y = 56.0f;
+ if (dComIfGp_getPlayer()) {
+ dComIfGp_getPlayer()->mSpeed.y = 56.0f;
};
};
@@ -84,11 +79,15 @@ void reload_area() {
inject_save_flag = true;
if (g_area_reload_behavior == LOAD_AREA) {
tp_memcpy(
- tp_gameInfo.temp_flags.flags, gSaveManager.mAreaReloadOpts.temp_flags,
+ &g_dComIfG_gameInfo.mInfo.mMemory, gSaveManager.mAreaReloadOpts.temp_flags,
sizeof(
gSaveManager.mAreaReloadOpts.temp_flags)); // restore last set of saved temp flags
- tp_gameInfo.inventory.tears =
- gSaveManager.mAreaReloadOpts.tears; // restore last tear count
+
+ // restore last tear count
+ for (int i = 0; i < 4; i++) {
+ dComIfGs_setLightDropNum(i, gSaveManager.mAreaReloadOpts.tears[i]);
+ }
+
gSaveManager.mPracticeFileOpts.inject_options_before_load =
SaveManager::inject_default_before;
gSaveManager.mPracticeFileOpts.inject_options_during_load = nullptr;
diff --git a/src/controller.cpp b/src/controller.cpp
index 56225e8..f7bcb5a 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -1,9 +1,10 @@
-#include "libtp_c/include/controller.h"
+#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
#include "cheats.h"
#include "commands.h"
+#include "gz_flags.h"
#include "controller.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/msl_c/string.h"
+#include "libtp_c/include/SSystem/SComponent/c_counter.h"
#include "menu.h"
#ifdef GCN_PLATFORM
@@ -85,7 +86,7 @@ void read_controller() {
for (; idx < BUTTON_STATES; idx++) {
buttonStates[idx].is_down = (buttonStates[idx].button & sButtons_down) != 0;
if ((buttonStates[idx].button & sButtons_pressed) != 0) {
- buttonStates[idx].pressed_frame = TP::get_frame_count() + 1;
+ buttonStates[idx].pressed_frame = cCt_getFrameCount() + 1;
}
}
@@ -134,7 +135,7 @@ bool button_is_down(int idx) {
}
bool button_is_pressed(int idx, uint16_t repeat_time) {
- auto delta = TP::get_frame_count() - buttonStates[idx].pressed_frame;
+ auto delta = cCt_getFrameCount() - buttonStates[idx].pressed_frame;
auto just_clicked = delta == 0;
auto held_down_long_enough = delta > REPEAT_DELAY;
auto is_repeat_frame = held_down_long_enough && delta % repeat_time == 0;
@@ -150,8 +151,14 @@ uint16_t get_current_inputs() {
return buttons_down;
}
-bool button_is_held(int idx) {
- auto delta = TP::get_frame_count() - buttonStates[idx].pressed_frame + 1;
+bool button_is_held(int idx, int phase) {
+ uint32_t delta;
+ if (phase == POST_GAME_LOOP) {
+ delta = cCt_getFrameCount() - buttonStates[idx].pressed_frame;
+ } else {
+ delta = cCt_getFrameCount() - buttonStates[idx].pressed_frame + 1;
+ }
+
if (delta != 0) {
return true;
} else {
diff --git a/src/corotdcheck.cpp b/src/corotdcheck.cpp
new file mode 100644
index 0000000..f1e03f0
--- /dev/null
+++ b/src/corotdcheck.cpp
@@ -0,0 +1,65 @@
+#include "corotdcheck.h"
+#include "controller.h"
+#include "fifo_queue.h"
+#include "fs.h"
+#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
+#include "libtp_c/include/msl_c/string.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "libtp_c/include/SSystem/SComponent/c_counter.h"
+#include "libtp_c/include/f_op/f_op_scene_req.h"
+
+namespace CoroTDChecker {
+using namespace Controller;
+
+static bool start_timer = false;
+uint32_t current_counter = 0;
+static bool got_it = false;
+static char buf[20];
+
+void run() {
+ // reset counters on load
+ if (tp_fopScnRq.isLoading == 1) {
+ current_counter = 0;
+ got_it = false;
+ start_timer = false;
+ }
+
+ if (start_timer == false && button_is_down(A) &&
+ tp_strcmp((const char*)g_dComIfG_gameInfo.play.mStartStage.mStage, "F_SP108") == 0) {
+ start_timer = true;
+ }
+
+ if (start_timer == true) {
+ current_counter++;
+
+ if (current_counter < 20) {
+ // went early
+ if (!got_it && (!button_is_held(Y) || !button_is_held(X)) && (current_counter < 10) &&
+ (button_is_down(Y) || button_is_down(X))) {
+ int final_val = 10 - current_counter;
+ tp_sprintf(buf, "%df early", final_val);
+ FIFOQueue::push(buf, Queue, 0x0000FF00);
+ }
+
+ // got it
+ else if (!got_it && (!button_is_held(Y) || !button_is_held(X)) &&
+ (current_counter == 10) && (button_is_down(Y) || button_is_down(X))) {
+ FIFOQueue::push("got it", Queue, 0x00CC0000);
+ got_it = true;
+ }
+
+ // went late
+ else if (!got_it && (!button_is_held(Y) || !button_is_held(X)) &&
+ current_counter > 10 && (button_is_down(Y) || button_is_down(X))) {
+ int final_val = current_counter - 10;
+ tp_sprintf(buf, "%df late", final_val);
+ FIFOQueue::push(buf, Queue, 0x99000000);
+ }
+ } else {
+ current_counter = 0;
+ got_it = false;
+ start_timer = false;
+ }
+ }
+}
+} // namespace CoroTDChecker \ No newline at end of file
diff --git a/src/fifo_queue.cpp b/src/fifo_queue.cpp
index 952ee29..c447465 100644
--- a/src/fifo_queue.cpp
+++ b/src/fifo_queue.cpp
@@ -1,6 +1,6 @@
#include "fifo_queue.h"
#include "font.h"
-#include "libtp_c/include/system.h"
+#include "libtp_c/include/msl_c/string.h"
#include "menus/position_settings_menu.h"
bool fifo_visible;
diff --git a/src/flaglog.cpp b/src/flaglog.cpp
deleted file mode 100644
index b025641..0000000
--- a/src/flaglog.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-#include "controller.h"
-#include "fifo_queue.h"
-#include "libtp_c/include/controller.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
-#include "flaglog.h"
-
-namespace FlagLog {
-
-static char buf[25];
-
-uint8_t s_areatemp_record[0x20];
-uint8_t s_event_record[0x100];
-uint8_t s_minigame_record[0x18];
-uint8_t s_danbit_record[0x18];
-// uint8_t s_onetime_event_record[0x100];
-
-bool init_save_record = false;
-
-void save_record(uint8_t* record, uint8_t saved_record[], int record_size) {
- for (int i = 0; i < record_size; i++) {
- saved_record[i] = *(record + i);
- }
-}
-
-void display_log(const char* name, uint8_t* record, uint8_t saved_record[], int record_size) {
- for (int i = 0; i < record_size; i++) {
- if (*(record + i) != saved_record[i]) {
- for (uint8_t bit = 0; bit < 8; bit++) {
- if ((*(record + i) & (1 << bit)) != (saved_record[i] & (1 << bit))) {
- tp_sprintf(buf, "%s [0x%02X: %d]", name, i, bit);
- FIFOQueue::push(buf, Queue, 0xFFFFFF00);
- }
- }
- saved_record[i] = *(record + i);
- }
- }
-}
-
-void run() {
- if (!init_save_record) {
- save_record(tp_gameInfo.temp_flags.flags, s_areatemp_record, 0x20);
- save_record(tp_gameInfo.event_flags.flags, s_event_record, 0x100);
- save_record(tp_gameInfo.minigame_flags, s_minigame_record, 0x18);
- // save_record(tp_gameInfo.one_time_events, s_onetime_event_record, 0x100);
- save_record((uint8_t*)tp_gameInfo.dungeon_temp_flags.switch_bitfield, s_danbit_record,
- 0x18);
- init_save_record = true;
- }
-
- display_log("area temp", tp_gameInfo.temp_flags.flags, s_areatemp_record, 0x20);
- display_log("event", tp_gameInfo.event_flags.flags, s_event_record, 0x100);
- display_log("minigame", tp_gameInfo.minigame_flags, s_minigame_record, 0x18);
- display_log("dungeon", (uint8_t*)tp_gameInfo.dungeon_temp_flags.switch_bitfield,
- s_danbit_record, 0x18);
- // display_log("OT event", tp_gameInfo.one_time_events, s_onetime_event_record, 0x100);
-}
-} // namespace FlagLog \ No newline at end of file
diff --git a/src/font.cpp b/src/font.cpp
index e57ce34..a1d46e1 100644
--- a/src/font.cpp
+++ b/src/font.cpp
@@ -1,5 +1,5 @@
#include "font.h"
-#include "libtp_c/include/system.h"
+#include "libtp_c/include/msl_c/string.h"
#include "utils/disc.h"
#include "utils/draw.h"
diff --git a/src/free_cam.cpp b/src/free_cam.cpp
index f3ab630..ed846ba 100644
--- a/src/free_cam.cpp
+++ b/src/free_cam.cpp
@@ -1,8 +1,9 @@
#include "free_cam.h"
-#include "libtp_c/include/controller.h"
-#include "libtp_c/include/math.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
+#include "libtp_c/include/msl_c/math.h"
#include "menu.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "libtp_c/include/f_op/f_op_draw_tag.h"
#define ROTATION_SPEED (0.002)
#define FREECAM_FAST_SPEED (2.0)
@@ -39,9 +40,9 @@ void handle_free_cam() {
auto& cam_target = tp_matrixInfo.matrix_info->target;
auto& cam_pos = tp_matrixInfo.matrix_info->pos;
// Freeze the game to prevent control stick inputs to move link
- tp_gameInfo.freeze_game = true;
+ dComIfGp_getEvent().mHalt = true;
// Lock the camera to allow for its movement
- tp_gameInfo.lock_camera = true;
+ dComIfGp_getEventManager().mCameraPlay = 1;
if (!init_once) {
// Initialize the pitch and yaw to the current angle of the camera
@@ -74,8 +75,8 @@ void handle_free_cam() {
pitch = MIN(MAX((pitch + PITCH_CONTROL * ROTATION_SPEED), -M_PI / 2 + 0.1), M_PI / 2 - 0.1);
} else {
if (init_once) {
- tp_gameInfo.freeze_game = false;
- tp_gameInfo.lock_camera = false;
+ dComIfGp_getEvent().mHalt = false;
+ dComIfGp_getEventManager().mCameraPlay = 0;
init_once = false;
}
}
diff --git a/src/fs.cpp b/src/fs.cpp
index 06de68f..1482d57 100644
--- a/src/fs.cpp
+++ b/src/fs.cpp
@@ -1,7 +1,7 @@
#include "fs.h"
#include "font.h"
#include "gcn_c/include/dvd.h"
-#include "libtp_c/include/system.h"
+#include "libtp_c/include/m_Do/m_Do_printf.h"
void loadFile(const char* filePath, void* buffer, signed long length, signed long offset) {
DVDFileInfo fileInfo;
diff --git a/src/gorge.cpp b/src/gorge.cpp
index 0ccc091..e1b3efb 100644
--- a/src/gorge.cpp
+++ b/src/gorge.cpp
@@ -2,9 +2,12 @@
#include "controller.h"
#include "fifo_queue.h"
#include "fs.h"
-#include "libtp_c/include/controller.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
+#include "libtp_c/include/msl_c/string.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "libtp_c/include/SSystem/SComponent/c_counter.h"
+#include "libtp_c/include/f_op/f_op_scene_req.h"
+
#define WARP_CS_FRAMES 132
#ifdef WII_PLATFORM
#define TARGET_BUTTON Z
@@ -27,39 +30,38 @@ static bool got_it = false;
static char buf[20];
void prep_rupee_roll() {
- tp_gameInfo.temp_flags.flags[9] = 0x20;
- tp_gameInfo.cs_val = 0x900;
+ dComIfGs_onSwitch(21, dComIfGp_getPlayer()->mOrig.mRoomNo);
+ dComIfGp_getEvent().event_order.field_0x10 = 9;
inject_gorge_flag = false;
}
void warp_to_gorge() {
// set gorge map info
- tp_gameInfo.overworld_flags.hyrule_field_flags.flags[9] = 0;
- tp_gameInfo.temp_flags.flags[8] = 0;
- tp_gameInfo.temp_flags.flags[9] = 0;
- tp_gameInfo.overworld_flags.hyrule_field_flags.flags[8] = 0;
+ g_dComIfG_gameInfo.mInfo.mMemory.mMemBit.mSwitch[0] = 0; // optimize later
+ dComIfGs_putSave(g_dComIfG_gameInfo.mInfo.mDan.mStageNo);
// change form to wolf
- tp_gameInfo.link.is_wolf = true;
+ dComIfGs_setTransformStatus(STATUS_WOLF);
// set loading info
- tp_gameInfo.warp.entrance.void_flag = 0;
- tp_gameInfo.event_to_play = 0;
- tp_gameInfo.respawn_animation = 0;
- tp_gameInfo.warp.entrance.spawn = 2;
- tp_gameInfo.warp.entrance.room = 3;
- tp_gameInfo.warp.entrance.state = 0xE;
- tp_strcpy((char*)tp_gameInfo.warp.entrance.stage, "F_SP121");
+ g_dComIfG_gameInfo.play.mNextStage.wipe = 13;
+ g_dComIfG_gameInfo.play.mNextStage.mPoint = 0;
+ g_dComIfG_gameInfo.mInfo.mRestart.mRoomParam = 0;
+ g_dComIfG_gameInfo.mInfo.mRestart.mLastMode = 0;
+ g_dComIfG_gameInfo.play.mNextStage.mPoint = 2;
+ g_dComIfG_gameInfo.play.mNextStage.mRoomNo = 3;
+ g_dComIfG_gameInfo.play.mNextStage.mLayer = 0xE;
+ tp_strcpy((char*)g_dComIfG_gameInfo.play.mNextStage.mStage, "F_SP121");
// reset health, item
- tp_gameInfo.respawn_item_id = 40;
- tp_gameInfo.link.heart_quarters = 12; // 3 hearts
+ g_dComIfG_gameInfo.mInfo.mRestart.mLastMode |= 0x28000000;
+ dComIfGs_setLife(12); // 3 hearts
// trigger loading, convert some of these to const later
- tp_gameInfo.special_spawn_id = 2;
- tp_gameInfo.respawn_position = {-11856.857f, -5700.0f, 56661.5};
- tp_gameInfo.respawn_angle = 24169;
- Inventory::clear_rupee_flags();
+ g_dComIfG_gameInfo.mInfo.mRestart.mStartPoint = 2;
+ cXyz pos(-11856.857f, -5700.0f, 56661.5);
+ g_dComIfG_gameInfo.mInfo.mRestart.mRoomPos = pos;
+ g_dComIfG_gameInfo.mInfo.mRestart.mRoomAngleY = 24169;
}
void run() {
// reset counters on load
@@ -70,11 +72,12 @@ void run() {
start_timer = false;
}
- current_counter = TP::get_frame_count();
+ current_counter = cCt_getFrameCount();
// situation specific frame counters
- if (start_timer == false && tp_gameInfo.freeze_game == 1 && tp_gameInfo.cs_val == 0x128 &&
- tp_strcmp((const char*)tp_gameInfo.current_stage, "F_SP121") == 0) {
+ if (start_timer == false && dComIfGp_getEvent().mHalt == 1 &&
+ dComIfGp_getEvent().event_order.field_0x10 == 0x1 &&
+ tp_strcmp((const char*)g_dComIfG_gameInfo.play.mStartStage.mStage, "F_SP121") == 0) {
start_timer = true;
previous_counter = current_counter;
counter_difference = 0;
diff --git a/src/gz_flags.cpp b/src/gz_flags.cpp
index c4b23a0..b843cf3 100644
--- a/src/gz_flags.cpp
+++ b/src/gz_flags.cpp
@@ -16,36 +16,44 @@
#include "flaglog.h"
#include "save_manager.h"
#include "menus/memfiles_menu.h"
+#include "corotdcheck.h"
bool inject_save_flag = false;
GZFlag GZ_Flags[MAX_GZ_FLAGS] = {
- {&ToolItems[Tools::GORGE_INDEX].active, GorgeVoidIndicator::run},
+ {&ToolItems[Tools::GORGE_INDEX].active, GAME_LOOP, GorgeVoidIndicator::run},
#ifdef WII_PLATFORM
- {&ToolItems[Tools::BIT_INDEX].active, BiTIndicator::run},
+ {&ToolItems[Tools::BIT_INDEX].active, GAME_LOOP, BiTIndicator::run},
#endif
- {&ToolItems[Tools::ROLL_INDEX].active, RollIndicator::run},
- {&g_flag_log_active, FlagLog::run},
- {&inject_save_flag, SaveManager::trigger_load},
- {&SceneItems[Scene::FREEZE_ACTOR_INDEX].active, Actor::freeze_actors, Actor::unfreeze_actors},
- {&SceneItems[Scene::HIDE_ACTOR_INDEX].active, Actor::hide_actors, Actor::show_actors},
- {&SceneItems[Scene::FREEZE_CAMERA_INDEX].active, System::lock_camera, System::unlock_camera},
- {&SceneItems[Scene::HIDE_HUD_INDEX].active, System::hide_hud, System::show_hud},
- {&SceneItems[Scene::FREEZE_TIME_INDEX].active, Utilities::freeze_time},
- {&g_tunic_color_flag, Utilities::change_tunic_color, Utilities::change_tunic_color},
- {&g_cursor_color_flag, Utilities::change_cursor_color, Utilities::change_cursor_color},
- {&SceneItems[Scene::DISABLE_BG_INDEX].active, Utilities::disable_bg_music,
+ {&ToolItems[Tools::ROLL_INDEX].active, GAME_LOOP, RollIndicator::run},
+ {&ToolItems[Tools::COROTD_INDEX].active, GAME_LOOP, CoroTDChecker::run},
+ {&inject_save_flag, GAME_LOOP, SaveManager::trigger_load},
+ {&SceneItems[Scene::FREEZE_ACTOR_INDEX].active, GAME_LOOP, Actor::freeze_actors,
+ Actor::unfreeze_actors},
+ {&SceneItems[Scene::HIDE_ACTOR_INDEX].active, GAME_LOOP, Actor::hide_actors,
+ Actor::show_actors},
+ {&SceneItems[Scene::FREEZE_CAMERA_INDEX].active, GAME_LOOP, System::lock_camera,
+ System::unlock_camera},
+ {&SceneItems[Scene::HIDE_HUD_INDEX].active, GAME_LOOP, System::hide_hud, System::show_hud},
+ {&SceneItems[Scene::FREEZE_TIME_INDEX].active, GAME_LOOP, Utilities::freeze_time},
+ {&g_tunic_color_flag, GAME_LOOP, Utilities::change_tunic_color, Utilities::change_tunic_color},
+ {&g_cursor_color_flag, GAME_LOOP, Utilities::change_cursor_color,
+ Utilities::change_cursor_color},
+ {&SceneItems[Scene::DISABLE_BG_INDEX].active, GAME_LOOP, Utilities::disable_bg_music,
Utilities::enable_bg_music},
- {&SceneItems[Scene::DISABLE_SFX_INDEX].active, Utilities::disable_sfx, Utilities::enable_sfx},
- {&set_position_data, set_memfile_position}};
+ {&SceneItems[Scene::DISABLE_SFX_INDEX].active, GAME_LOOP, Utilities::disable_sfx,
+ Utilities::enable_sfx},
+ {&set_position_data, GAME_LOOP, set_memfile_position}};
namespace GZFlags {
-void apply_active_flags() {
+void apply_active_flags(int loop_phase) {
for (int i = 0; i < MAX_GZ_FLAGS; i++) {
- if (*GZ_Flags[i].activation_flag) {
- GZ_Flags[i].flag_active_function();
- } else if (GZ_Flags[i].flag_deactive_function) {
- GZ_Flags[i].flag_deactive_function();
+ if (loop_phase == GZ_Flags[i].required_phase) {
+ if (*GZ_Flags[i].activation_flag) {
+ GZ_Flags[i].flag_active_function();
+ } else if (GZ_Flags[i].flag_deactive_function) {
+ GZ_Flags[i].flag_deactive_function();
+ }
}
}
}
diff --git a/src/input_viewer.cpp b/src/input_viewer.cpp
index aa01281..2aac3b9 100644
--- a/src/input_viewer.cpp
+++ b/src/input_viewer.cpp
@@ -1,12 +1,10 @@
-#include "libtp_c/include/utils.h"
+#include "libtp_c/include/dolphin/mtx/vec.h"
#include "input_viewer.h"
#include "controller.h"
#include "font.h"
-#include "libtp_c/include/controller.h"
-#include "libtp_c/include/flag.h"
-#include "libtp_c/include/math.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
+#include "libtp_c/include/msl_c/math.h"
+#include "libtp_c/include/msl_c/string.h"
#include "menus/position_settings_menu.h"
#include "menus/settings_menu.h"
#include "utils/draw.h"
diff --git a/src/lib.cpp b/src/lib.cpp
index bb1f40a..9695b72 100644
--- a/src/lib.cpp
+++ b/src/lib.cpp
@@ -4,9 +4,9 @@
#include "free_cam.h"
#include "gz_flags.h"
#include "input_viewer.h"
-#include "libtp_c/include/controller.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+// #include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
+#include "libtp_c/include/msl_c/string.h"
+#include "libtp_c/include/m_Do/m_Do_printf.h"
#include "menu.h"
#include "menus/main_menu.h"
#include "menus/position_settings_menu.h"
@@ -21,6 +21,8 @@
#include "utils/loading.h"
#include "utils/memory.h"
#include "utils/texture.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "libtp_c/include/f_op/f_op_scene_req.h"
_FIFOQueue Queue;
bool card_load = true;
@@ -106,13 +108,15 @@ void game_loop() {
// save temp flags and tears after every loading zone
if (last_frame_was_loading && !tp_fopScnRq.isLoading) {
- tp_memcpy(gSaveManager.mAreaReloadOpts.temp_flags, tp_gameInfo.temp_flags.flags,
- sizeof(tp_gameInfo.temp_flags.flags));
- gSaveManager.mAreaReloadOpts.tears = tp_gameInfo.inventory.tears;
+ tp_memcpy(gSaveManager.mAreaReloadOpts.temp_flags, &g_dComIfG_gameInfo.mInfo.mMemory,
+ sizeof(g_dComIfG_gameInfo.mInfo.mMemory));
+ for (int i = 0; i < 4; i++) {
+ gSaveManager.mAreaReloadOpts.tears[i] = dComIfGs_getLightDropNum(i);
+ }
last_frame_was_loading = false;
}
- GZFlags::apply_active_flags();
+ GZFlags::apply_active_flags(GAME_LOOP);
FreeCam::handle_free_cam();
MoveLink::move_link();
@@ -121,6 +125,10 @@ void game_loop() {
}
}
+void post_game_loop() {
+ GZFlags::apply_active_flags(POST_GAME_LOOP);
+}
+
void draw() {
setupRendering();
// Consolas.setupRendering();
diff --git a/src/menus/ad_saves_menu.cpp b/src/menus/ad_saves_menu.cpp
index 16b2f0f..db4051e 100644
--- a/src/menus/ad_saves_menu.cpp
+++ b/src/menus/ad_saves_menu.cpp
@@ -2,12 +2,11 @@
#include "controller.h"
#include "fifo_queue.h"
#include "gorge.h"
-#include "libtp_c/include/controller.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
+#include "libtp_c/include/msl_c/string.h"
#include "menus/practice_menu.h"
#include "rollcheck.h"
-
+#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "utils/cursor.h"
#include "utils/lines.h"
#include "utils/loading.h"
@@ -83,51 +82,52 @@ void default_load() {
void hugo() {
gSaveManager.inject_default_during();
- tp_gameInfo.temp_flags.flags[14] = 128; // midna trigger off
- tp_gameInfo.temp_flags.flags[12] = 0; // hugo alive
+ dComIfGs_onSwitch(47, 0); // midna trigger off
+ dComIfGs_offSwitch(63, 0); // hugo alive
}
void karg_oob() {
gSaveManager.mPracticeFileOpts.inject_options_before_load = nullptr;
gSaveManager.inject_default_during();
- tp_gameInfo.respawn_animation = 0xA; // spawn on kargorok
- tp_gameInfo.link.is_wolf = false;
+ g_dComIfG_gameInfo.mInfo.mRestart.mLastMode = 0xA; // spawn on kargorok
+ dComIfGs_setTransformStatus(STATUS_HUMAN);
}
void morpheel() {
- tp_zelAudio.link_debug_ptr->current_item = 68; // clawshot
- tp_zelAudio.link_debug_ptr->current_boots = 2; // ib
+ dComIfGp_getPlayer()->field_0x2fdc = 68; // clawshot
+ dComIfGp_getPlayer()->onNoResetFlg0(daPy_py_c::EquipHeavyBoots); // ib
}
void stallord() {
gSaveManager.inject_default_during();
- tp_gameInfo.boss_room_event_flags = 48; // turn off intro cs, start fight
- tp_gameInfo.warp.entrance.spawn = 0x01; // spawn at in front of stally
+ g_dComIfG_gameInfo.mInfo.mZone[0].mBit.mSwitch[0] |=
+ 0x300000; // turn off intro cs, start fight
+ g_dComIfG_gameInfo.play.mNextStage.mPoint = 0x01; // spawn at in front of stally
}
void argorok() {
gSaveManager.inject_default_during();
- tp_gameInfo.boss_room_event_flags = 1;
+ g_dComIfG_gameInfo.mInfo.mZone[0].mBit.mSwitch[0] |= 0x10000;
}
void palace1() {
gSaveManager.inject_default_during();
- tp_gameInfo.dungeon_temp_flags.switch_bitfield[0] = 0; // reset palace switches
+ g_dComIfG_gameInfo.mInfo.mDan.mSwitch[0] = 0; // reset palace switches
}
void palace2() {
- tp_zelAudio.link_debug_ptr->current_item = 3; // master sword
+ dComIfGp_getPlayer()->field_0x2fdc = 3; // master sword
}
void lakebed_bk_skip_during() {
gSaveManager.inject_default_during();
- tp_gameInfo.temp_flags.flags[11] = 18; // bridge turned
- tp_gameInfo.temp_flags.flags[20] = 223; // dungeon intro cs off
+ dComIfGs_onSwitch(2, 0); // bridge turned
+ dComIfGs_onSwitch(122, 0); // dungeon intro cs off
}
void bossflags() {
gSaveManager.inject_default_during();
- TP::set_boss_flags();
+ tp_bossFlags = 0xFF;
}
void ADSavesMenu::render() {
diff --git a/src/menus/amounts_menu.cpp b/src/menus/amounts_menu.cpp
index 56f37f9..5b38b57 100644
--- a/src/menus/amounts_menu.cpp
+++ b/src/menus/amounts_menu.cpp
@@ -1,13 +1,11 @@
#include "menus/amounts_menu.h"
#include "controller.h"
#include "font.h"
-#include "libtp_c/include/flag.h"
-#include "libtp_c/include/inventory.h"
-#include "libtp_c/include/math.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/msl_c/math.h"
+#include "libtp_c/include/msl_c/string.h"
#include "utils/cursor.h"
#include "utils/lines.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
#define LINES 8
@@ -34,14 +32,14 @@ Line lines[LINES] = {{"arrow ammo:", ARROW_AMMO_INDEX, "Amount of arrows held"},
void AmountsMenu::render() {
// update amounts
- arrow_ammo = tp_gameInfo.inventory.arrow_count;
- bomb_bag_1_ammo = tp_gameInfo.inventory.bomb_bag_1_amnt;
- bomb_bag_2_ammo = tp_gameInfo.inventory.bomb_bag_2_amnt;
- bomb_bag_3_ammo = tp_gameInfo.inventory.bomb_bag_3_amnt;
- slingshot_ammo = tp_gameInfo.inventory.slingshot_count;
- poe_count = tp_gameInfo.inventory.poe_count;
- hp_count = tp_gameInfo.link.heart_pieces;
- rupee_count = tp_gameInfo.link.rupees;
+ arrow_ammo = dComIfGs_getArrowNum();
+ bomb_bag_1_ammo = dComIfGs_getBombNum(BOMB_BAG_1);
+ bomb_bag_2_ammo = dComIfGs_getBombNum(BOMB_BAG_2);
+ bomb_bag_3_ammo = dComIfGs_getBombNum(BOMB_BAG_3);
+ slingshot_ammo = dComIfGs_getPachinkoNum();
+ poe_count = dComIfGs_getPohSpiritNum();
+ hp_count = dComIfGs_getMaxLife();
+ rupee_count = dComIfGs_getRupee();
if (button_is_pressed(BACK_BUTTON)) {
init_once = false;
@@ -61,7 +59,7 @@ void AmountsMenu::render() {
} else if (button_is_pressed(Controller::DPAD_RIGHT)) {
arrow_ammo++;
}
- tp_gameInfo.inventory.arrow_count = arrow_ammo;
+ dComIfGs_setArrowNum(arrow_ammo);
break;
}
case BOMB_BAG_1_AMMO_INDEX: {
@@ -70,7 +68,7 @@ void AmountsMenu::render() {
} else if (button_is_pressed(Controller::DPAD_RIGHT)) {
bomb_bag_1_ammo++;
}
- tp_gameInfo.inventory.bomb_bag_1_amnt = bomb_bag_1_ammo;
+ dComIfGs_setBombNum(BOMB_BAG_1, bomb_bag_1_ammo);
break;
}
case BOMB_BAG_2_AMMO_INDEX: {
@@ -79,7 +77,7 @@ void AmountsMenu::render() {
} else if (button_is_pressed(Controller::DPAD_RIGHT)) {
bomb_bag_2_ammo++;
}
- tp_gameInfo.inventory.bomb_bag_2_amnt = bomb_bag_2_ammo;
+ dComIfGs_setBombNum(BOMB_BAG_2, bomb_bag_2_ammo);
break;
}
case BOMB_BAG_3_AMMO_INDEX: {
@@ -88,7 +86,7 @@ void AmountsMenu::render() {
} else if (button_is_pressed(Controller::DPAD_RIGHT)) {
bomb_bag_3_ammo++;
}
- tp_gameInfo.inventory.bomb_bag_3_amnt = bomb_bag_3_ammo;
+ dComIfGs_setBombNum(BOMB_BAG_3, bomb_bag_3_ammo);
break;
}
case SLINGSHOT_AMMO_INDEX: {
@@ -97,7 +95,7 @@ void AmountsMenu::render() {
} else if (button_is_pressed(Controller::DPAD_RIGHT)) {
slingshot_ammo++;
}
- tp_gameInfo.inventory.slingshot_count = slingshot_ammo;
+ dComIfGs_setPachinkoNum(slingshot_ammo);
break;
}
case HEART_PIECE_COUNT_INDEX: {
@@ -106,7 +104,7 @@ void AmountsMenu::render() {
} else if (button_is_pressed(Controller::DPAD_RIGHT)) {
hp_count++;
}
- tp_gameInfo.link.heart_pieces = hp_count;
+ dComIfGs_setMaxLife(hp_count);
break;
}
case POE_COUNT_INDEX: {
@@ -115,7 +113,7 @@ void AmountsMenu::render() {
} else if (button_is_pressed(Controller::DPAD_RIGHT)) {
poe_count++;
}
- tp_gameInfo.inventory.poe_count = poe_count;
+ dComIfGs_setPohSpiritNum(poe_count);
break;
}
case RUPEE_COUNT_INDEX: {
@@ -124,7 +122,7 @@ void AmountsMenu::render() {
} else if (button_is_pressed(Controller::DPAD_RIGHT)) {
rupee_count++;
}
- tp_gameInfo.link.rupees = rupee_count;
+ dComIfGs_setRupee(rupee_count);
break;
}
}
diff --git a/src/menus/any_saves_menu.cpp b/src/menus/any_saves_menu.cpp
index 2e97ba3..f1125e8 100644
--- a/src/menus/any_saves_menu.cpp
+++ b/src/menus/any_saves_menu.cpp
@@ -2,12 +2,11 @@
#include "controller.h"
#include "fifo_queue.h"
#include "gorge.h"
-#include "libtp_c/include/controller.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
+#include "libtp_c/include/msl_c/string.h"
#include "menus/practice_menu.h"
#include "rollcheck.h"
-
+#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "utils/cursor.h"
#include "utils/lines.h"
#include "utils/loading.h"
@@ -72,65 +71,67 @@ Line lines[LINES] = {
void hugo() {
gSaveManager.inject_default_during();
- tp_gameInfo.temp_flags.flags[14] = 128; // midna trigger off
- tp_gameInfo.temp_flags.flags[12] = 0; // hugo alive
+ dComIfGs_onSwitch(47, 0); // midna trigger off
+ dComIfGs_offSwitch(63, 0); // hugo alive
}
void karg_oob() {
gSaveManager.mPracticeFileOpts.inject_options_before_load = nullptr;
gSaveManager.inject_default_during();
- tp_gameInfo.respawn_animation = 0xA; // spawn on kargorok
- tp_gameInfo.link.is_wolf = false;
+ g_dComIfG_gameInfo.mInfo.mRestart.mLastMode = 0xA; // spawn on kargorok
+ dComIfGs_setTransformStatus(STATUS_HUMAN);
}
void morpheel() {
- tp_zelAudio.link_debug_ptr->current_item = 68; // clawshot
- tp_zelAudio.link_debug_ptr->current_boots = 2; // ib
+ dComIfGp_getPlayer()->field_0x2fdc = 68; // clawshot
+ dComIfGp_getPlayer()->onNoResetFlg0(daPy_py_c::EquipHeavyBoots); // ib
}
void stallord() {
gSaveManager.inject_default_during();
- tp_gameInfo.boss_room_event_flags = 48; // turn off intro cs, start fight
- tp_gameInfo.warp.entrance.spawn = 0x01; // spawn at in front of stally
+ g_dComIfG_gameInfo.mInfo.mZone[0].mBit.mSwitch[0] |=
+ 0x300000; // turn off intro cs, start fight
+ g_dComIfG_gameInfo.play.mNextStage.mPoint = 0x01; // spawn at in front of stally
}
void fan_tower() {
gSaveManager.inject_default_during();
- tp_gameInfo.dungeon_temp_flags.switch_bitfield[0] = 0; // reset city switches
+ g_dComIfG_gameInfo.mInfo.mDan.mSwitch[0] = 0; // reset city switches
}
void argorok() {
gSaveManager.inject_default_during();
- tp_gameInfo.boss_room_event_flags = 1;
+ g_dComIfG_gameInfo.mInfo.mZone[0].mBit.mSwitch[0] |= 0x10000;
}
void palace1() {
gSaveManager.inject_default_during();
- tp_gameInfo.dungeon_temp_flags.switch_bitfield[0] = 0; // reset palace switches
+ g_dComIfG_gameInfo.mInfo.mDan.mSwitch[0] = 0; // reset palace switches
}
void palace2() {
- tp_zelAudio.link_debug_ptr->current_item = 3; // master sword
+ dComIfGp_getPlayer()->field_0x2fdc = 3; // master sword
}
void lakebed_bk_skip_during() {
gSaveManager.inject_default_during();
- tp_gameInfo.temp_flags.flags[11] = 18; // bridge turned
- tp_gameInfo.temp_flags.flags[20] = 223; // dungeon intro cs off
+ dComIfGs_onSwitch(2, 0); // bridge turned
+ dComIfGs_onSwitch(122, 0); // dungeon intro cs off
}
void bossflags() {
gSaveManager.inject_default_during();
- TP::set_boss_flags();
+ tp_bossFlags = 0xFF;
}
void darkhammer() {
- tp_gameInfo.event_flags.flags[11] = 134; // iza bomb bag stolen
+ dComIfGs_onEventBit(0x0B02);
+ dComIfGs_onEventBit(0x0B04); // iza bomb bag stolen
}
void waterfall_sidehop() {
gSaveManager.inject_default_during();
- tp_gameInfo.spawn_speed = 10.0f; // link spawns swimming forward
+ g_dComIfG_gameInfo.mInfo.mRestart.mLastSpeedF = 10.0f; // link spawns swimming forward
}
void AnySavesMenu::render() {
diff --git a/src/menus/cheat_menu.cpp b/src/menus/cheat_menu.cpp
index 09bde37..104f7cd 100644
--- a/src/menus/cheat_menu.cpp
+++ b/src/menus/cheat_menu.cpp
@@ -2,13 +2,10 @@
#include "commands.h"
#include "controller.h"
#include "libtp_c/include/addrs.h"
-#include "libtp_c/include/controller.h"
-#include "libtp_c/include/inventory.h"
-#include "libtp_c/include/items.h"
-#include "libtp_c/include/link.h"
+#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "libtp_c/include/patch.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/msl_c/string.h"
#include "menus/cheats_menu.h"
#include "utils/cursor.h"
#include "utils/lines.h"
@@ -24,7 +21,7 @@
static Cursor cursor = {0, 0};
bool init_once = false;
-bool chest_collision = false;
+bool door_collision = false;
using namespace Cheats;
Cheat CheatItems[CHEAT_AMNT] = {
@@ -58,7 +55,8 @@ Line lines[LINES] = {
&CheatItems[InvincibleEnemies].active},
{"moon jump", MoonJump, "Hold " MOON_JUMP_TEXT " to moon jump", true,
&CheatItems[MoonJump].active},
- {"door storage", DoorStorage, "Disable most collision", true, &CheatItems[DoorStorage].active},
+ {"disable walls", DoorStorage, "Disables most wall collision", true,
+ &CheatItems[DoorStorage].active},
{"super clawshot", SuperClawshot, "Super Clawshot", true, &CheatItems[SuperClawshot].active},
{"unrestricted items", UnrestrictedItems, "Disable item restrictions", true,
&CheatItems[UnrestrictedItems].active},
@@ -73,8 +71,6 @@ namespace Cheats {
using namespace Controller;
void apply_cheats() {
- Link::Link* link = Link::get_link();
- Inventory::Inventory* inventory = Inventory::get_inventory();
for (auto cheat : CheatItems) {
if (cheat.active) {
switch (cheat.id) {
@@ -85,46 +81,48 @@ void apply_cheats() {
case InvincibleEnemies: {
*reinterpret_cast<uint32_t*>(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET) =
0x60000000; // nop
- gc::os_cache::DCFlushRange((void*)(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET),
- sizeof(uint32_t));
- gc::os_cache::ICInvalidateRange(
- (void*)(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET), sizeof(uint32_t));
+ DCFlushRange((void*)(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET),
+ sizeof(uint32_t));
+ ICInvalidateRange((void*)(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET),
+ sizeof(uint32_t));
break;
}
case Invincible: {
- if (tp_gameInfo.link_collision_ptr != nullptr) {
- tp_gameInfo.link_collision_ptr->invincibility_timer = 5;
+ if (dComIfGp_getPlayer()) {
+ dComIfGp_getPlayer()->field_0x56b[2] = 5;
}
break;
}
case InfiniteHearts: {
- link->heart_quarters = (link->heart_pieces / 5) * 4;
+ uint16_t max_life = dComIfGs_getMaxLife();
+ dComIfGs_setLife((max_life / 5) * 4);
break;
}
case InfiniteAir: {
- *(Link::get_air()) = 600;
+ dComIfGs_setOxygen(600);
break;
}
case InfiniteOil: {
- link->current_lantern_oil = 0x5460;
+ dComIfGs_setOil(21600);
break;
}
case InfiniteBombs: {
- inventory->bomb_bag_1_amnt = 99;
- inventory->bomb_bag_2_amnt = 99;
- inventory->bomb_bag_3_amnt = 99;
+ dComIfGs_setBombNum(BOMB_BAG_1, 99);
+ dComIfGs_setBombNum(BOMB_BAG_2, 99);
+ dComIfGs_setBombNum(BOMB_BAG_3, 99);
break;
}
case InfiniteRupees: {
- link->rupees = 1000;
+ dComIfGs_setRupee(1000);
break;
}
case InfiniteArrows: {
- inventory->arrow_count = 99;
+ dComIfGs_setArrowNum(99);
break;
}
case InfiniteSlingshot: {
- inventory->slingshot_count = 99;
+ dComIfGs_setPachinkoNum(99);
+ break;
}
case SuperClawshot: {
tp_clawshot.speed = 2870.0f;
@@ -134,19 +132,18 @@ void apply_cheats() {
break;
}
case DoorStorage: {
- if (tp_gameInfo.link_collision_ptr != nullptr) {
- tp_gameInfo.link_collision_ptr->chest_collision = 0xE4;
- tp_gameInfo.link_collision_ptr->door_collision = 0x40;
- chest_collision = true;
+ if (dComIfGp_getPlayer()) {
+ dComIfGp_getPlayer()->mLinkAcch.SetWallNone();
+ dComIfGp_getPlayer()->mLinkAcch.OnLineCheckNone();
+ door_collision = true;
}
break;
}
#ifdef WII_PLATFORM
case GaleLJA: {
- if (tp_zelAudio.link_debug_ptr != nullptr &&
- tp_zelAudio.link_debug_ptr->current_action_id == 0x60 &&
- tp_zelAudio.link_debug_ptr->current_item == 0xFF) {
- tp_zelAudio.link_debug_ptr->current_item = 0x0103;
+ if (dComIfGp_getPlayer() && dComIfGp_getPlayer()->mActionID == 0x60 &&
+ dComIfGp_getPlayer()->field_0x2fdc == 0xFF) {
+ dComIfGp_getPlayer()->field_0x2fdc = 0x0103;
}
}
#endif
@@ -162,10 +159,10 @@ void apply_cheats() {
case InvincibleEnemies: {
*reinterpret_cast<uint32_t*>(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET) =
0x7C030050; // sub r0, r0, r3
- gc::os_cache::DCFlushRange((void*)(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET),
- sizeof(uint32_t));
- gc::os_cache::ICInvalidateRange(
- (void*)(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET), sizeof(uint32_t));
+ DCFlushRange((void*)(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET),
+ sizeof(uint32_t));
+ ICInvalidateRange((void*)(tp_cc_at_check_addr + INVINCIBLE_ENEMIES_OFFSET),
+ sizeof(uint32_t));
break;
}
case SuperClawshot: {
@@ -176,10 +173,10 @@ void apply_cheats() {
break;
}
case DoorStorage: {
- if (tp_gameInfo.link_collision_ptr != nullptr && chest_collision == true) {
- tp_gameInfo.link_collision_ptr->chest_collision = 0xE0;
- tp_gameInfo.link_collision_ptr->door_collision = 0x20;
- chest_collision = false;
+ if (dComIfGp_getPlayer() && door_collision == true) {
+ dComIfGp_getPlayer()->mLinkAcch.OffWallNone();
+ dComIfGp_getPlayer()->mLinkAcch.OffLineCheckNone();
+ door_collision = false;
}
break;
}
diff --git a/src/menus/dungeon_flags_menu.cpp b/src/menus/dungeon_flags_menu.cpp
index 8ba1544..082b075 100644
--- a/src/menus/dungeon_flags_menu.cpp
+++ b/src/menus/dungeon_flags_menu.cpp
@@ -1,8 +1,7 @@
#include "controller.h"
#include "font.h"
-#include "libtp_c/include/flag.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/msl_c/string.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "menus/flags_menu.h"
#include "utils/cursor.h"
#include "utils/lines.h"
@@ -18,35 +17,50 @@ bool init_once = false;
bool map_flag;
bool compass_flag;
bool boss_key_flag;
-bool small_keys_flag;
bool miniboss_flag;
bool boss_flag;
int select_dungeon_index = 0;
+uint8_t key_num = 0;
uint8_t area_id;
-Flags::GlobalFlags* dungeon_node;
Line lines[LINES] = {
{"dungeon:", SELECT_DUNGEON_INDEX, "Selected dungeon flags", false, nullptr,
MAX_DUNGEON_OPTIONS},
+ {"small keys", SMALL_KEY_FLAG_INDEX, "Selected dungeon small keys", false, nullptr, 5},
{"have map", MAP_FLAG_INDEX, "Give selected dungeon map", true, &map_flag},
{"have compass", COMPASS_FLAG_INDEX, "Give selected dungeon compass", true, &compass_flag},
{"have boss key", BOSS_KEY_FLAG_INDEX, "Give selected dungeon boss key", true, &boss_key_flag},
- {"have small keys", SMALL_KEY_FLAG_INDEX, "Give selected dungeon small keys", true,
- &small_keys_flag},
{"miniboss dead", DEFEAT_MINIBOSS_FLAG_INDEX, "Selected dungeon miniboss is defeated", true,
&miniboss_flag},
{"boss dead", DEFEAT_BOSS_FLAG_INDEX, "Selected dungeon boss is defeated", true, &boss_flag},
{"clear flags", CLEAR_DUNGEON_FLAGS_INDEX, "Clear all selected dungeon flags"}};
-void copyGlobalFlags(uint8_t id) {
- if (tp_gameInfo.dungeon_temp_flags.mStageNum == id) {
- for (uint8_t j = 0; j < 0x20; j++) {
- tp_gameInfo.temp_flags.flags[j] = dungeon_node->flags[j];
- }
+ListMember dungeon_options[MAX_DUNGEON_OPTIONS] = {
+ "Forest Temple", "Goron Mines", "Lakebed Temple",
+ "Arbiter's Grounds", "Snowpeak Ruins", "Temple of Time",
+ "City in the Sky", "Palace of Twilight", "Hyrule Castle"};
+
+bool getSaveDungeonItem(int32_t stage, int32_t flag) {
+ return dSv_memBit_c__isDungeonItem(&dComIfGs_getSavedata().mSave[stage].mMemBit, flag);
+}
+
+void setSaveDungeonItem(int32_t stage, int32_t flag) {
+ if (getSaveDungeonItem(stage, flag)) {
+ dComIfGs_getSavedata().mSave[stage].mMemBit.offDungeonItem(flag);
+ } else {
+ dSv_memBit_c__onDungeonItem(&dComIfGs_getSavedata().mSave[stage].mMemBit, flag);
}
}
+uint8_t getSaveDungeonKeys(int32_t stage) {
+ return dComIfGs_getSavedata().mSave[stage].mMemBit.getKeyNum();
+}
+
+void setSaveDungeonKeys(int32_t stage, uint8_t num) {
+ dComIfGs_getSavedata().mSave[stage].mMemBit.setKeyNum(num);
+}
+
void DungeonFlagsMenu::render() {
if (button_is_pressed(BACK_BUTTON)) {
init_once = false;
@@ -57,125 +71,107 @@ void DungeonFlagsMenu::render() {
if (!init_once) {
current_input = 0;
init_once = true;
+ key_num = getSaveDungeonKeys(area_id);
}
- ListMember dungeon_options[MAX_DUNGEON_OPTIONS] = {
- "Forest Temple", "Goron Mines", "Lakebed Temple",
- "Arbiter's Grounds", "Snowpeak Ruins", "Temple of Time",
- "City in the Sky", "Palace of Twilight", "Hyrule Castle"};
-
if (cursor.y == SELECT_DUNGEON_INDEX) {
cursor.x = select_dungeon_index;
Utilities::move_cursor(cursor, LINES, MAX_DUNGEON_OPTIONS, false, false, false, true);
if (cursor.y == SELECT_DUNGEON_INDEX) {
select_dungeon_index = cursor.x;
}
+ key_num = getSaveDungeonKeys(area_id);
+ } else if (cursor.y == SMALL_KEY_FLAG_INDEX) {
+ cursor.x = key_num;
+ Utilities::move_cursor(cursor, LINES, 6, false, false, false, true);
+ if (cursor.y == SMALL_KEY_FLAG_INDEX) {
+ key_num = cursor.x;
+ setSaveDungeonKeys(area_id, key_num);
+ dComIfGs_getSave(g_dComIfG_gameInfo.mInfo.mDan.mStageNo);
+ }
} else {
- Utilities::move_cursor(cursor, LINES);
+ Utilities::move_cursor(cursor, LINES, 2);
}
switch (select_dungeon_index) {
case 0: {
- dungeon_node = &tp_gameInfo.dungeon_flags.forest_temple_flags;
- area_id = 0x10;
+ area_id = dSv_memory_c::FOREST_TEMPLE;
break;
}
case 1: {
- dungeon_node = &tp_gameInfo.dungeon_flags.goron_mines_flags;
- area_id = 0x11;
+ area_id = dSv_memory_c::GORON_MINES;
break;
}
case 2: {
- dungeon_node = &tp_gameInfo.dungeon_flags.lakebed_flags;
- area_id = 0x12;
+ area_id = dSv_memory_c::LAKEBED;
break;
}
case 3: {
- dungeon_node = &tp_gameInfo.dungeon_flags.arbiters_flags;
- area_id = 0x13;
+ area_id = dSv_memory_c::ARBITERS;
break;
}
case 4: {
- dungeon_node = &tp_gameInfo.dungeon_flags.snowpeak_ruins_flags;
- area_id = 0x14;
+ area_id = dSv_memory_c::SNOWPEAK_RUINS;
break;
}
case 5: {
- dungeon_node = &tp_gameInfo.dungeon_flags.temple_of_time_flags;
- area_id = 0x15;
+ area_id = dSv_memory_c::TEMPLE_OF_TIME;
break;
}
case 6: {
- dungeon_node = &tp_gameInfo.dungeon_flags.cits_flags;
- area_id = 0x16;
+ area_id = dSv_memory_c::CITY;
break;
}
case 7: {
- dungeon_node = &tp_gameInfo.dungeon_flags.palace_flags;
- area_id = 0x17;
+ area_id = dSv_memory_c::PALACE;
break;
}
case 8: {
- dungeon_node = &tp_gameInfo.dungeon_flags.hyrule_castle_flags;
- area_id = 0x18;
+ area_id = dSv_memory_c::HYRULE_CASTLE;
break;
}
}
// update flags
- map_flag = (dungeon_node->flags[29] & (1 << 0));
- compass_flag = (dungeon_node->flags[29] & (1 << 1));
- boss_key_flag = (dungeon_node->flags[29] & (1 << 2));
- small_keys_flag = dungeon_node->flags[28];
- miniboss_flag = (dungeon_node->flags[29] & (1 << 7));
- boss_flag = (dungeon_node->flags[29] & (1 << 3));
+ map_flag = getSaveDungeonItem(area_id, dSv_memBit_c::MAP_FLAG);
+ compass_flag = getSaveDungeonItem(area_id, dSv_memBit_c::COMPASS_FLAG);
+ boss_key_flag = getSaveDungeonItem(area_id, dSv_memBit_c::BOSS_KEY_FLAG);
+ miniboss_flag = getSaveDungeonItem(area_id, dSv_memBit_c::STAGE_BOSS_ENEMY_2);
+ boss_flag = getSaveDungeonItem(area_id, dSv_memBit_c::STAGE_BOSS_ENEMY);
if (current_input == SELECTION_BUTTON && a_held == false) {
switch (cursor.y) {
case MAP_FLAG_INDEX: {
- dungeon_node->flags[29] ^= 1 << 0;
- copyGlobalFlags(area_id);
+ setSaveDungeonItem(area_id, dSv_memBit_c::MAP_FLAG);
break;
}
case COMPASS_FLAG_INDEX: {
- dungeon_node->flags[29] ^= 1 << 1;
- copyGlobalFlags(area_id);
+ setSaveDungeonItem(area_id, dSv_memBit_c::COMPASS_FLAG);
break;
}
case BOSS_KEY_FLAG_INDEX: {
- dungeon_node->flags[29] ^= 1 << 2;
- copyGlobalFlags(area_id);
- break;
- }
- case SMALL_KEY_FLAG_INDEX: {
- if (small_keys_flag) {
- dungeon_node->flags[28] = 0x00;
- } else {
- dungeon_node->flags[28] = 0x05;
- }
- copyGlobalFlags(area_id);
+ setSaveDungeonItem(area_id, dSv_memBit_c::BOSS_KEY_FLAG);
break;
}
case DEFEAT_MINIBOSS_FLAG_INDEX: {
- dungeon_node->flags[29] ^= 1 << 7;
- copyGlobalFlags(area_id);
+ setSaveDungeonItem(area_id, dSv_memBit_c::STAGE_BOSS_ENEMY_2);
break;
}
case DEFEAT_BOSS_FLAG_INDEX: {
- dungeon_node->flags[29] ^= 1 << 3;
- copyGlobalFlags(area_id);
+ setSaveDungeonItem(area_id, dSv_memBit_c::STAGE_BOSS_ENEMY);
break;
}
case CLEAR_DUNGEON_FLAGS_INDEX: {
- for (int i = 0; i < 0x20; i++) {
- dungeon_node->flags[i] = 0;
- }
- copyGlobalFlags(area_id);
+ tp_memset(&dComIfGs_getSavedata().mSave[area_id].mMemBit, 0, sizeof(dSv_memBit_c));
+ key_num = 0;
break;
}
}
+ // copy current stage save flags over temp flags
+ dComIfGs_getSave(g_dComIfG_gameInfo.mInfo.mDan.mStageNo);
}
+ tp_sprintf(lines[SMALL_KEY_FLAG_INDEX].value, " <%d>", key_num);
tp_sprintf(lines[SELECT_DUNGEON_INDEX].value, " <%s>",
dungeon_options[select_dungeon_index].member);
diff --git a/src/menus/flag_log_menu.cpp b/src/menus/flag_log_menu.cpp
index a7557e0..aff61a5 100644
--- a/src/menus/flag_log_menu.cpp
+++ b/src/menus/flag_log_menu.cpp
@@ -1,8 +1,6 @@
#include "menus/flags_menu.h"
#include "controller.h"
#include "font.h"
-#include "libtp_c/include/flag.h"
-#include "libtp_c/include/tp.h"
#include "utils/cursor.h"
#include "utils/lines.h"
#include "flaglog.h"
diff --git a/src/menus/flag_records_menu.cpp b/src/menus/flag_records_menu.cpp
index 4937af7..aff9e26 100644
--- a/src/menus/flag_records_menu.cpp
+++ b/src/menus/flag_records_menu.cpp
@@ -1,15 +1,16 @@
#include "menus/flag_records_menu.h"
#include "controller.h"
#include "font.h"
-#include "libtp_c/include/controller.h"
-#include "libtp_c/include/math.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
+#include "libtp_c/include/msl_c/math.h"
+#include "libtp_c/include/m_Do/m_Do_printf.h"
#include "menus/settings_menu.h"
#include "utils/cursor.h"
#include "utils/draw.h"
#include "utils/lines.h"
#include "utils/texture.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "libtp_c/include/msl_c/string.h"
#define MAX_DISPLAY_LINES 8
#define WHITE_RGBA 0xFFFFFFFF
@@ -138,8 +139,7 @@ void FlagRecordsMenu::render() {
init_once = true;
}
- ListMember flag_record_options[MAX_RECORD_OPTIONS] = {"area temp", "event", "minigame",
- "dungeon"};
+ ListMember flag_record_options[MAX_RECORD_OPTIONS] = {"membit", "event", "minigame", "danbit"};
if (cursor.y == FLAG_RECORD_INDEX) {
cursor.x = record_index;
Utilities::move_cursor(cursor, max_flags + 1, MAX_RECORD_OPTIONS, false, false, false,
@@ -162,22 +162,22 @@ void FlagRecordsMenu::render() {
switch (record_index) {
case 0: {
max_flags = 0x20;
- render_flag_records(tp_gameInfo.temp_flags.flags);
+ render_flag_records((uint8_t*)&g_dComIfG_gameInfo.mInfo.mMemory.mMemBit.mTbox);
break;
}
case 1: {
max_flags = 0x100;
- render_flag_records(tp_gameInfo.event_flags.flags);
+ render_flag_records((uint8_t*)&g_dComIfG_gameInfo.mInfo.mSavedata.mEvent.mEvent);
break;
}
case 2: {
max_flags = 0x18;
- render_flag_records(tp_gameInfo.minigame_flags);
+ render_flag_records((uint8_t*)&g_dComIfG_gameInfo.mInfo.mSavedata.mMiniGame);
break;
}
case 3: {
max_flags = 0x18;
- render_flag_records((uint8_t*)tp_gameInfo.dungeon_temp_flags.switch_bitfield);
+ render_flag_records((uint8_t*)&g_dComIfG_gameInfo.mInfo.mDan.mSwitch);
break;
}
}
diff --git a/src/menus/flags_menu.cpp b/src/menus/flags_menu.cpp
index 7521ca3..3c77ca6 100644
--- a/src/menus/flags_menu.cpp
+++ b/src/menus/flags_menu.cpp
@@ -1,8 +1,6 @@
#include "menus/flags_menu.h"
#include "controller.h"
#include "font.h"
-#include "libtp_c/include/flag.h"
-#include "libtp_c/include/tp.h"
#include "utils/cursor.h"
#include "utils/lines.h"
diff --git a/src/menus/general_flags_menu.cpp b/src/menus/general_flags_menu.cpp
index dd380c0..6b0e551 100644
--- a/src/menus/general_flags_menu.cpp
+++ b/src/menus/general_flags_menu.cpp
@@ -1,10 +1,10 @@
#include "controller.h"
#include "font.h"
-#include "libtp_c/include/flag.h"
-#include "libtp_c/include/tp.h"
#include "menus/flags_menu.h"
#include "utils/cursor.h"
#include "utils/lines.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "libtp_c/include/utils.h"
#define LINES 11
@@ -12,7 +12,7 @@ static Cursor cursor = {0, 0};
bool init_once = false;
bool boss_flag;
-bool rupee_flag;
+bool rupee_flag = false;
bool midna_charge;
bool transform_warp;
bool midna_on_z;
@@ -43,17 +43,23 @@ Line lines[LINES] = {
void GeneralFlagsMenu::render() {
// update flags
- boss_flag = (TP::get_boss_flags() > 0x00);
- rupee_flag = tp_gameInfo.inventory.rupee_cs_flags;
- midna_charge = (tp_gameInfo.event_flags.flags[0x05] & (1 << 0));
- transform_warp = (tp_gameInfo.event_flags.flags[0x0D] & (1 << 2));
- midna_on_z = (tp_gameInfo.event_flags.flags[0x0C] & (1 << 4));
- epona_stolen = (tp_gameInfo.event_flags.flags[0x05] & (1 << 7));
- epona_tamed = (tp_gameInfo.event_flags.flags[0x06] & (1 << 0));
- map_warping = (tp_gameInfo.event_flags.flags[0x06] & (1 << 2));
- midna_healthy = (tp_gameInfo.event_flags.flags[0x1E] & (1 << 3));
- midna_on_back = (tp_gameInfo.midna_on_back_flag & (1 << 3));
- wolf_sense = (tp_gameInfo.event_flags.flags[0x43] & (1 << 3));
+ boss_flag = tp_bossFlags > 0;
+ midna_charge = dComIfGs_isEventBit(0x0501);
+ transform_warp = dComIfGs_isEventBit(0x0D04);
+ midna_on_z = dComIfGs_isEventBit(0x0C10);
+ epona_stolen = dComIfGs_isEventBit(0x0580);
+ epona_tamed = dComIfGs_isEventBit(0x0601);
+ map_warping = dComIfGs_isEventBit(0x0604);
+ midna_healthy = dComIfGs_isEventBit(0x1E08);
+ midna_on_back = dComIfGs_isTransformLV(3);
+ wolf_sense = dComIfGs_isEventBit(0x4308);
+
+ for (int i = BLUE_RUPEE; i <= SILVER_RUPEE; i++) {
+ if (dComIfGs_isItemFirstBit(i)) {
+ rupee_flag = true;
+ break;
+ }
+ }
if (button_is_pressed(BACK_BUTTON)) {
init_once = false;
@@ -70,55 +76,62 @@ void GeneralFlagsMenu::render() {
switch (cursor.y) {
case BOSS_FLAG_INDEX: {
if (boss_flag) {
- tp_bossFlags = 0x00;
+ tp_bossFlags = 0;
} else {
- tp_bossFlags = 0xFF;
+ tp_bossFlags = 255;
}
break;
}
case RUPEE_CS_FLAG_INDEX: {
if (rupee_flag) {
- tp_gameInfo.inventory.rupee_cs_flags = 0x00;
+ for (int i = BLUE_RUPEE; i <= SILVER_RUPEE; i++) {
+ dComIfGs_offItemFirstBit(i);
+ }
} else {
- tp_gameInfo.inventory.rupee_cs_flags = 0xFF;
+ for (int i = BLUE_RUPEE; i <= SILVER_RUPEE; i++) {
+ dComIfGs_onItemFirstBit(i);
+ }
}
break;
}
case EPONA_STOLEN_INDEX: {
- tp_gameInfo.event_flags.flags[0x05] ^= 0x80;
+ setEventFlag(0x0580);
break;
}
case EPONA_TAMED_INDEX: {
- tp_gameInfo.event_flags.flags[0x06] ^= 0x01;
+ setEventFlag(0x0601);
break;
}
case MAP_WARPING_INDEX: {
- tp_gameInfo.event_flags.flags[0x06] ^= 0x04;
+ setEventFlag(0x0604);
break;
}
case MIDNA_HEALTHY: {
- tp_gameInfo.event_flags.flags[0x1E] ^= 0x08;
+ setEventFlag(0x1E08);
break;
}
case MIDNA_ON_BACK: {
- tp_gameInfo.midna_on_back_flag ^= 0x08;
+ if (dComIfGs_isTransformLV(3)) {
+ dComIfGs_offTransformLV(3);
+ } else {
+ dComIfGs_onTransformLV(3);
+ }
break;
}
case MIDNA_Z_INDEX: {
- tp_gameInfo.event_flags.flags[0x0C] ^= 0x10;
+ setEventFlag(0x0C10);
break;
}
case TRANSFORM_WARP_INDEX: {
- tp_gameInfo.event_flags.flags[0x0D] ^= 0x04;
+ setEventFlag(0x0D04);
break;
}
case WOLF_SENSE_INDEX: {
- tp_gameInfo.event_flags.flags[0x43] ^= 0x08;
+ setEventFlag(0x4308);
break;
}
-
case MIDNA_CHARGE_INDEX: {
- tp_gameInfo.event_flags.flags[0x05] ^= 0x01;
+ setEventFlag(0x0501);
break;
}
}
diff --git a/src/menus/hundo_saves_menu.cpp b/src/menus/hundo_saves_menu.cpp
index cc97c9d..2d07b1c 100644
--- a/src/menus/hundo_saves_menu.cpp
+++ b/src/menus/hundo_saves_menu.cpp
@@ -1,15 +1,15 @@
#include "controller.h"
#include "fifo_queue.h"
#include "gorge.h"
-#include "libtp_c/include/controller.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
+#include "libtp_c/include/msl_c/string.h"
#include "menus/practice_menu.h"
#include "rollcheck.h"
-
+#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "utils/cursor.h"
#include "utils/lines.h"
#include "utils/loading.h"
+#include "libtp_c/include/f_op/f_op_draw_tag.h"
#include "fs.h"
#define LINES 82
@@ -117,51 +117,55 @@ void default_load() {
void set_camera_angle_position() {
tp_matrixInfo.matrix_info->target = gSaveManager.mPracticeSaveInfo.cam_target;
tp_matrixInfo.matrix_info->pos = gSaveManager.mPracticeSaveInfo.cam_pos;
- tp_zelAudio.link_debug_ptr->facing = gSaveManager.mPracticeSaveInfo.angle;
- tp_zelAudio.link_debug_ptr->position = gSaveManager.mPracticeSaveInfo.position;
+ dComIfGp_getPlayer()->mCollisionRot.mY = gSaveManager.mPracticeSaveInfo.angle;
+ cXyz tmp(gSaveManager.mPracticeSaveInfo.position.x, gSaveManager.mPracticeSaveInfo.position.y,
+ gSaveManager.mPracticeSaveInfo.position.z);
+ dComIfGp_getPlayer()->mCurrent.mPosition = tmp;
}
void set_angle_position() {
- tp_zelAudio.link_debug_ptr->facing = gSaveManager.mPracticeSaveInfo.angle;
- tp_zelAudio.link_debug_ptr->position = gSaveManager.mPracticeSaveInfo.position;
+ dComIfGp_getPlayer()->mCollisionRot.mY = gSaveManager.mPracticeSaveInfo.angle;
+ cXyz tmp(gSaveManager.mPracticeSaveInfo.position.x, gSaveManager.mPracticeSaveInfo.position.y,
+ gSaveManager.mPracticeSaveInfo.position.z);
+ dComIfGp_getPlayer()->mCurrent.mPosition = tmp;
}
void goats_1() {
gSaveManager.inject_default_during();
- tp_gameInfo.warp.entrance.state = 0x5;
+ g_dComIfG_gameInfo.play.mNextStage.mLayer = 0x5;
}
void goats_2() {
gSaveManager.inject_default_during();
- tp_gameInfo.warp.entrance.state = 0x4;
+ g_dComIfG_gameInfo.play.mNextStage.mLayer = 0x4;
}
void purple_mist() {
gSaveManager.inject_default_during();
- tp_gameInfo.link.is_wolf = false;
+ dComIfGs_setTransformStatus(STATUS_HUMAN);
}
void kb2_skip() {
gSaveManager.inject_default_during();
- tp_gameInfo.warp.entrance.state = 0x3;
+ g_dComIfG_gameInfo.play.mNextStage.mLayer = 0x3;
}
void escort() {
gSaveManager.inject_default_during();
- tp_gameInfo.warp.entrance.room = 0xD;
- tp_gameInfo.warp.entrance.spawn = 0x62;
- tp_gameInfo.warp.entrance.state = 0x2;
- tp_gameInfo.temp_flags.flags[28] = 2; // give 2 keys for field gates
+ g_dComIfG_gameInfo.play.mNextStage.mRoomNo = 0xD;
+ g_dComIfG_gameInfo.play.mNextStage.mPoint = 0x62;
+ g_dComIfG_gameInfo.play.mNextStage.mLayer = 0x2;
+ dComIfGs_setKeyNum(2); // give 2 keys for field gates
}
void dangoro() {
- gSaveManager.inject_default_during();
- tp_gameInfo.boss_room_event_flags = 32; // turn off intro cs, start fight
+ g_dComIfG_gameInfo.mInfo.mZone[0].mBit.mSwitch[0] |=
+ 0x200000; // turn off intro cs, start fight
}
void morpheel() {
- tp_zelAudio.link_debug_ptr->current_item = 68; // clawshot
- tp_zelAudio.link_debug_ptr->current_boots = 2; // ib
+ dComIfGp_getPlayer()->field_0x2fdc = 68; // clawshot
+ dComIfGp_getPlayer()->onNoResetFlg0(daPy_py_c::EquipHeavyBoots); // ib
gSaveManager.mPracticeSaveInfo.angle = 10754;
gSaveManager.mPracticeSaveInfo.position = {-1193.0f, -23999.0f, -770.0f};
set_angle_position();
@@ -169,29 +173,29 @@ void morpheel() {
void karg_oob() {
gSaveManager.inject_default_during();
- tp_gameInfo.respawn_animation = 0xA; // spawn on kargorok
- tp_gameInfo.link.is_wolf = false;
+ g_dComIfG_gameInfo.mInfo.mRestart.mLastMode = 0xA; // spawn on kargorok
+ dComIfGs_setTransformStatus(STATUS_HUMAN);
}
void iza_1_skip() {
gSaveManager.inject_default_during();
- tp_gameInfo.respawn_animation = 0xA; // spawn on kargorok
- tp_strcpy((char*)tp_gameInfo.warp.entrance.stage, "F_SP112"); // set stage to river
- tp_gameInfo.warp.entrance.room = 0x1;
- tp_gameInfo.warp.entrance.spawn = 0x0;
- tp_gameInfo.warp.entrance.state = 0x4;
+ g_dComIfG_gameInfo.mInfo.mRestart.mLastMode = 0xA; // spawn on kargorok
+ tp_strcpy((char*)g_dComIfG_gameInfo.play.mNextStage.mStage, "F_SP112"); // set stage to river
+ g_dComIfG_gameInfo.play.mNextStage.mRoomNo = 0x1;
+ g_dComIfG_gameInfo.play.mNextStage.mPoint = 0x0;
+ g_dComIfG_gameInfo.play.mNextStage.mLayer = 0x4;
}
void stallord() {
- gSaveManager.inject_default_during();
- tp_gameInfo.boss_room_event_flags = 48; // turn off intro cs, start fight
- tp_gameInfo.warp.entrance.spawn = 0x01; // spawn at in front of stally
+ g_dComIfG_gameInfo.mInfo.mZone[0].mBit.mSwitch[0] |=
+ 0x300000; // turn off intro cs, start fight
+ g_dComIfG_gameInfo.play.mNextStage.mPoint = 0x01; // spawn at in front of stally
}
void spr_bosskey() {
gSaveManager.inject_default_during();
- tp_gameInfo.warp.entrance.room = 0xB; // boss key room
- tp_gameInfo.warp.entrance.spawn = 0x00; // default spawn
+ g_dComIfG_gameInfo.play.mNextStage.mRoomNo = 0xB; // boss key room
+ g_dComIfG_gameInfo.play.mNextStage.mPoint = 0x00; // default spawn
}
void tot_early_poe() {
@@ -215,7 +219,7 @@ void hugo_archery() {
void cits_poe_cycle() {
gSaveManager.inject_default_during();
- tp_gameInfo.warp.entrance.spawn = 0x0;
+ g_dComIfG_gameInfo.play.mNextStage.mPoint = 0x0;
gSaveManager.mPracticeSaveInfo.angle = 71;
gSaveManager.mPracticeSaveInfo.position = {-14005.31f, 3000.0f, -15854.05f};
set_angle_position();
@@ -223,21 +227,20 @@ void cits_poe_cycle() {
void fan_tower() {
gSaveManager.inject_default_during();
- tp_gameInfo.dungeon_temp_flags.switch_bitfield[0] = 0; // reset city switches
+ g_dComIfG_gameInfo.mInfo.mDan.mSwitch[0] = 0;
}
void argorok() {
- gSaveManager.inject_default_during();
- tp_gameInfo.boss_room_event_flags = 1;
+ g_dComIfG_gameInfo.mInfo.mZone[0].mBit.mSwitch[0] |= 0x10000;
}
void palace1() {
gSaveManager.inject_default_during();
- tp_gameInfo.dungeon_temp_flags.switch_bitfield[0] = 0; // reset palace switches
+ g_dComIfG_gameInfo.mInfo.mDan.mSwitch[0] = 0;
}
void palace2() {
- tp_zelAudio.link_debug_ptr->current_item = 3; // master sword
+ dComIfGp_getPlayer()->field_0x2fdc = 3; // master sword
gSaveManager.inject_default_during();
gSaveManager.mPracticeSaveInfo.angle = 32731;
gSaveManager.mPracticeSaveInfo.position = {251.83f, -200.0f, 10993.50f};
@@ -246,17 +249,17 @@ void palace2() {
void lakebed_bk_skip_during() {
gSaveManager.inject_default_during();
- tp_gameInfo.temp_flags.flags[20] = 223; // dungeon intro cs off
+ dComIfGs_onSwitch(122, dComIfGp_getPlayer()->mOrig.mRoomNo); // dungeon intro cs off
}
void bossflags() {
gSaveManager.inject_default_during();
- TP::set_boss_flags();
+ tp_bossFlags = 0xFF;
}
void cave_of_ordeals() {
gSaveManager.inject_default_during();
- tp_gameInfo.dungeon_temp_flags.switch_bitfield[0] = 0; // reset all CoO doors
+ g_dComIfG_gameInfo.mInfo.mDan.mSwitch[0] = 0;
}
void HundoSavesMenu::render() {
@@ -267,11 +270,11 @@ void HundoSavesMenu::render() {
special(HND_KARG_INDEX, karg_oob, nullptr),
special(HND_KB_2_INDEX, kb2_skip, nullptr),
special(HND_ESCORT_INDEX, escort, nullptr),
- special(HND_DANGORO_INDEX, dangoro, nullptr),
+ special(HND_DANGORO_INDEX, nullptr, dangoro),
special(HND_LAKEBED_BK_SKIP_INDEX, lakebed_bk_skip_during, nullptr),
special(HND_MORPHEEL_INDEX, nullptr, morpheel),
special(HND_IZA_1_SKIP_INDEX, iza_1_skip, nullptr),
- special(HND_STALLORD_INDEX, stallord, nullptr),
+ special(HND_STALLORD_INDEX, nullptr, stallord),
special(HND_DARK_HAMMER_INDEX, bossflags, nullptr),
special(HND_DARK_HAMMER_INDEX, bossflags, nullptr),
special(HND_LAKEBED_1_INDEX, bossflags, nullptr),
@@ -281,7 +284,7 @@ void HundoSavesMenu::render() {
special(HND_CITY_EARLY_INDEX, hugo_archery, nullptr),
special(HND_POE_CYCLE_INDEX, cits_poe_cycle, nullptr),
special(HND_FAN_TOWER_INDEX, fan_tower, nullptr),
- special(HND_ARGOROK_INDEX, argorok, nullptr),
+ special(HND_ARGOROK_INDEX, nullptr, argorok),
special(HND_PALACE_1_INDEX, palace1, nullptr),
special(HND_PALACE_2_INDEX, nullptr, palace2),
special(HND_COO_INDEX, cave_of_ordeals, nullptr),
diff --git a/src/menus/item_wheel_menu.cpp b/src/menus/item_wheel_menu.cpp
index d8e9d5d..3c61b90 100644
--- a/src/menus/item_wheel_menu.cpp
+++ b/src/menus/item_wheel_menu.cpp
@@ -2,7 +2,8 @@
#include "menus/item_wheel_menu.h"
#include "controller.h"
#include "font.h"
-#include "libtp_c/include/system.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "libtp_c/include/msl_c/string.h"
#include "utils/cursor.h"
#include "utils/lines.h"
@@ -15,159 +16,102 @@ int listIdx = 0;
int new_int_item_id;
bool init_once = false;
-const uint8_t valid_items[] = {OOCCOO_SR,
- OOCCOO_JR,
- OOCCOOS_NOTE,
- HAWKEYE,
- GALE_BOOMERANG,
- SPINNER,
- BALL_AND_CHAIN,
- HEROS_BOW,
- CLAWSHOT,
- IRON_BOOTS,
- DOMINION_ROD,
- DOUBLE_CLAWSHOT,
- LANTERN,
- MASTER_SWORD,
- FISHING_ROD,
- SLINGSHOT,
- EMPTY_BOMBBAG,
- ROD_BEE_LARVA,
- ROD_CORAL_EARRING,
- ROD_WORM,
- ROD_CORAL_EARRING_BEE_LARVA,
- ROD_CORAL_EARRING_WORM,
- EMPTY_BOTTLE,
- RED_POTION,
- MAGIC_POTION,
- BLUE_POTION,
- MILK,
- HALF_MILK,
- LANTERN_OIL,
- WATER,
- NASTY_SOUP,
- HOT_SPRING_WATER,
- FAIRY,
- REGULAR_BOMBS,
- WATER_BOMBS,
- BOMBLINGS,
- FAIRY_TEARS,
- WORM,
- BEE_LARVA,
- RARE_CHU,
- RED_CHU,
- BLUE_CHU,
- GREEN_CHU,
- YELLOW_CHU,
- PURPLE_CHU,
- SIMPLE_SOUP,
- GOOD_SOUP,
- SUPERB_SOUP,
- RENADOS_LETTER,
- INVOICE,
- WOODEN_STATUE,
- ILIAS_CHARM,
- HORSE_CALL,
- AURUS_MEMO,
- ASHEIS_SKETCH,
- ANCIENT_SKY_BOOK_EMPTY,
- ANCIENT_SKY_BOOK_PARTIAL,
- ANCIENT_SKY_BOOK_FILLED,
+const uint8_t valid_items[] = {DUNGEON_EXIT, DUNGEON_BACK,
+ TKS_LETTER, HAWK_EYE,
+ BOOMERANG, SPINNER,
+ IRONBALL, BOW,
+ HOOKSHOT, HVY_BOOTS,
+ COPY_ROD, W_HOOKSHOT,
+ KANTERA, MASTER_SWORD,
+ FISHING_ROD_1, PACHINKO,
+ BOMB_BAG_LV1, BEE_ROD,
+ JEWEL_ROD, WORM_ROD,
+ JEWEL_BEE_ROD, JEWEL_WORM_ROD,
+ EMPTY_BOTTLE, RED_BOTTLE,
+ GREEN_BOTTLE, BLUE_BOTTLE,
+ MILK_BOTTLE, HALF_MILK_BOTTLE,
+ OIL_BOTTLE, WATER_BOTTLE,
+ UGLY_SOUP, HOT_SPRING,
+ FAIRY, NORMAL_BOMB,
+ WATER_BOMB, POKE_BOMB,
+ FAIRY_DROP, WORM,
+ BEE_CHILD, CHUCHU_RARE,
+ CHUCHU_RED, CHUCHU_BLUE,
+ CHUCHU_GREEN, CHUCHU_YELLOW,
+ CHUCHU_PURPLE, LV1_SOUP,
+ LV2_SOUP, LV3_SOUP,
+ LETTER, BILL,
+ WOOD_STATUE, IRIAS_PENDANT,
+ HORSE_FLUTE, RAFRELS_MEMO,
+ ASHS_SCRIBBLING, ANCIENT_DOCUMENT,
+ AIR_LETTER, ANCIENT_DOCUMENT2,
NO_ITEM};
-// probably a better way to do this
-bool IsInItemIDEnum(int val) {
- for (size_t i = 0; i < sizeof(valid_items); ++i) {
- if (valid_items[i] == val) {
- return true;
- }
- }
- return false;
-}
-
-const uint8_t default_items[ITEM_WHEEL_SLOTS] = {GALE_BOOMERANG,
- LANTERN,
- SPINNER,
- IRON_BOOTS,
- HEROS_BOW,
- HAWKEYE,
- BALL_AND_CHAIN,
- NO_ITEM,
- DOMINION_ROD,
- CLAWSHOT,
- DOUBLE_CLAWSHOT,
- EMPTY_BOTTLE,
- EMPTY_BOTTLE,
- EMPTY_BOTTLE,
- EMPTY_BOTTLE,
- EMPTY_BOMBBAG,
- EMPTY_BOMBBAG,
- EMPTY_BOMBBAG,
- OOCCOO_SR,
- AURUS_MEMO,
- FISHING_ROD,
- HORSE_CALL,
- ANCIENT_SKY_BOOK_EMPTY,
- SLINGSHOT};
+const uint8_t default_items[ITEM_WHEEL_SLOTS] = {
+ BOOMERANG, KANTERA, SPINNER, HVY_BOOTS, BOW,
+ HAWK_EYE, IRONBALL, NO_ITEM, COPY_ROD, HOOKSHOT,
+ W_HOOKSHOT, EMPTY_BOTTLE, EMPTY_BOTTLE, EMPTY_BOTTLE, EMPTY_BOTTLE,
+ BOMB_BAG_LV1, BOMB_BAG_LV1, BOMB_BAG_LV1, DUNGEON_EXIT, RAFRELS_MEMO,
+ FISHING_ROD_1, HORSE_FLUTE, ANCIENT_DOCUMENT, PACHINKO};
const ItemLookup lookup_table[TOTAL_ITEMS] = {
- {OOCCOO_SR, "ooccoo sr."},
- {OOCCOO_JR, "ooccoo jr."},
- {OOCCOOS_NOTE, "ooccoo's note"},
- {HAWKEYE, "hawkeye"},
- {GALE_BOOMERANG, "gale boomerang"},
+ {DUNGEON_EXIT, "ooccoo sr."},
+ {DUNGEON_BACK, "ooccoo jr."},
+ {TKS_LETTER, "ooccoo's note"},
+ {HAWK_EYE, "hawkeye"},
+ {BOOMERANG, "gale boomerang"},
{SPINNER, "spinner"},
- {BALL_AND_CHAIN, "ball and chain"},
- {HEROS_BOW, "hero's bow"},
- {CLAWSHOT, "clawshot"},
- {IRON_BOOTS, "iron boots"},
- {DOMINION_ROD, "dominion rod"},
- {DOUBLE_CLAWSHOT, "double clawshot"},
- {LANTERN, "lantern"},
- {SLINGSHOT, "slingshot"},
- {FISHING_ROD, "fishing rod"},
- {EMPTY_BOMBBAG, "empty bomb bag"},
- {ROD_BEE_LARVA, "fishing rod (bee larva)"},
- {ROD_CORAL_EARRING, "fishing rod (coral earring)"},
- {ROD_WORM, "fishing rod (worm)"},
- {ROD_CORAL_EARRING_BEE_LARVA, "fishing rod (coral earring/bee larva)"},
- {ROD_CORAL_EARRING_WORM, "fishing rod (coral earring/worm)"},
+ {IRONBALL, "ball and chain"},
+ {BOW, "hero's bow"},
+ {HOOKSHOT, "clawshot"},
+ {HVY_BOOTS, "iron boots"},
+ {COPY_ROD, "dominion rod"},
+ {W_HOOKSHOT, "double clawshot"},
+ {KANTERA, "lantern"},
+ {PACHINKO, "slingshot"},
+ {FISHING_ROD_1, "fishing rod"},
+ {BOMB_BAG_LV1, "empty bomb bag"},
+ {BEE_ROD, "fishing rod (bee larva)"},
+ {JEWEL_ROD, "fishing rod (coral earring)"},
+ {WORM_ROD, "fishing rod (worm)"},
+ {JEWEL_BEE_ROD, "fishing rod (coral earring/bee larva)"},
+ {JEWEL_WORM_ROD, "fishing rod (coral earring/worm)"},
{EMPTY_BOTTLE, "empty bottle"},
- {RED_POTION, "red potion"},
- {MAGIC_POTION, "magic potion"},
- {BLUE_POTION, "blue potion"},
- {MILK, "milk"},
- {HALF_MILK, "half milk"},
- {LANTERN_OIL, "lantern oil"},
- {WATER, "water"},
- {NASTY_SOUP, "nasty soup"},
- {HOT_SPRING_WATER, "hot spring water"},
+ {RED_BOTTLE, "red potion"},
+ {GREEN_BOTTLE, "magic potion"},
+ {BLUE_BOTTLE, "blue potion"},
+ {MILK_BOTTLE, "milk"},
+ {HALF_MILK_BOTTLE, "half milk"},
+ {OIL_BOTTLE, "lantern oil"},
+ {WATER_BOTTLE, "water"},
+ {UGLY_SOUP, "nasty soup"},
+ {HOT_SPRING, "hot spring water"},
{FAIRY, "fairy"},
- {REGULAR_BOMBS, "regular bombs"},
- {WATER_BOMBS, "water bombs"},
- {BOMBLINGS, "bomblings"},
- {FAIRY_TEARS, "fairy tears"},
+ {NORMAL_BOMB, "regular bombs"},
+ {WATER_BOMB, "water bombs"},
+ {POKE_BOMB, "bomblings"},
+ {FAIRY_DROP, "fairy tears"},
{WORM, "worm"},
- {BEE_LARVA, "bee larva"},
- {RARE_CHU, "rare chu"},
- {RED_CHU, "red chu"},
- {BLUE_CHU, "blue chu"},
- {GREEN_CHU, "green chu"},
- {YELLOW_CHU, "yellow chu"},
- {PURPLE_CHU, "purple chu"},
- {SIMPLE_SOUP, "simple soup"},
- {GOOD_SOUP, "good soup"},
- {SUPERB_SOUP, "superb soup"},
- {RENADOS_LETTER, "renados letter"},
- {INVOICE, "invoice"},
- {WOODEN_STATUE, "wooden statue"},
- {ILIAS_CHARM, "ilia's charm"},
- {HORSE_CALL, "horse call"},
- {AURUS_MEMO, "auru's memo"},
- {ASHEIS_SKETCH, "ashei's sketch"},
- {ANCIENT_SKY_BOOK_EMPTY, "ancient sky book (empty)"},
- {ANCIENT_SKY_BOOK_PARTIAL, "ancient sky book (partial)"},
- {ANCIENT_SKY_BOOK_FILLED, "ancient sky book (filled)"},
+ {BEE_CHILD, "bee larva"},
+ {CHUCHU_RARE, "rare chu"},
+ {CHUCHU_RED, "red chu"},
+ {CHUCHU_BLUE, "blue chu"},
+ {CHUCHU_GREEN, "green chu"},
+ {CHUCHU_YELLOW, "yellow chu"},
+ {CHUCHU_PURPLE, "purple chu"},
+ {LV1_SOUP, "simple soup"},
+ {LV2_SOUP, "good soup"},
+ {LV3_SOUP, "superb soup"},
+ {LETTER, "renados letter"},
+ {BILL, "invoice"},
+ {WOOD_STATUE, "wooden statue"},
+ {IRIAS_PENDANT, "ilia's charm"},
+ {HORSE_FLUTE, "horse call"},
+ {RAFRELS_MEMO, "auru's memo"},
+ {ASHS_SCRIBBLING, "ashei's sketch"},
+ {ANCIENT_DOCUMENT, "ancient sky book (empty)"},
+ {AIR_LETTER, "ancient sky book (partial)"},
+ {ANCIENT_DOCUMENT2, "ancient sky book (filled)"},
{NO_ITEM, "no item"}};
Line lines[LINES] = {{"Slot 0:", SLOT_0, "", false, nullptr, false},
@@ -195,75 +139,13 @@ Line lines[LINES] = {{"Slot 0:", SLOT_0, "", false, nullptr, false},
{"Slot 22:", SLOT_22, "", false, nullptr, false},
{"Slot 23:", SLOT_23, "", false, nullptr, false}};
-void increment_slot_item(int slot_id) {
- uint8_t current_internal_item_id = tp_gameInfo.inventory.item_values.value[slot_id];
- do {
- current_internal_item_id++;
- } while (IsInItemIDEnum(current_internal_item_id) == false);
- tp_gameInfo.inventory.item_values.value[slot_id] = current_internal_item_id;
-}
-
-void decrement_slot_item(int slot_id) {
- uint8_t current_internal_item_id = tp_gameInfo.inventory.item_values.value[slot_id];
- do {
- --current_internal_item_id;
- } while (IsInItemIDEnum(current_internal_item_id) == false);
- tp_gameInfo.inventory.item_values.value[slot_id] = current_internal_item_id;
-}
-
-uint8_t find_next_empty_slot() {
- for (size_t i = 0; i < ITEM_WHEEL_SLOTS; ++i) {
- if (tp_gameInfo.inventory.item_wheel.slot[i] == 0xFF) {
- return i;
+void updateListIdx() {
+ uint8_t item_id = dComIfGs_getSavedata().getPlayerItem().mItems[cursor.y];
+ for (int i = 0; i < TOTAL_ITEMS; i++) {
+ if (item_id == valid_items[i]) {
+ listIdx = i;
}
}
- return 0xFF;
-}
-
-void try_add_item(uint8_t inventory_slot) {
- auto item_wheel = tp_gameInfo.inventory.item_wheel.slot;
- uint8_t slot = 0xFF;
- bool item_already_in_wheel = false;
- if (inventory_slot >= ITEM_WHEEL_SLOTS) {
- return;
- }
- for (size_t i = 0; i < ITEM_WHEEL_SLOTS; ++i) {
- if (slot == 0xFF && item_wheel[i] == 0xFF) {
- slot = i;
- }
- if (item_wheel[i] == inventory_slot) {
- item_already_in_wheel = true;
- break;
- }
- }
- if (!item_already_in_wheel && slot != 0xFF) {
- item_wheel[slot] = inventory_slot;
- }
-}
-
-void try_remove_item(uint8_t inventory_slot) {
- auto item_wheel = tp_gameInfo.inventory.item_wheel.slot;
- uint8_t slot = 0xFF;
- if (inventory_slot >= ITEM_WHEEL_SLOTS) {
- return;
- }
- for (size_t i = 0; i < ITEM_WHEEL_SLOTS; ++i) {
- if (item_wheel[i] == inventory_slot) {
- slot = i;
- break;
- }
- }
- if (slot != 0xFF) {
- uint8_t last_slot = find_next_empty_slot();
- if (last_slot > ITEM_WHEEL_SLOTS) {
- last_slot = ITEM_WHEEL_SLOTS;
- }
- if (last_slot > 0) {
- last_slot--;
- }
- item_wheel[slot] = item_wheel[last_slot];
- item_wheel[last_slot] = 0xFF;
- }
}
void ItemWheelMenu::render() {
@@ -271,16 +153,18 @@ void ItemWheelMenu::render() {
MenuRendering::set_menu(MN_INVENTORY_INDEX);
init_once = false;
return;
- };
+ }
if (!init_once) {
current_input = 0;
init_once = true;
}
- // populate the default line name and description
+ updateListIdx();
+
for (int i = 0; i < LINES; i++) {
- new_int_item_id = tp_gameInfo.inventory.item_values.value[i];
+ new_int_item_id = dComIfGs_getItem(i, false);
+
for (int j = 0; j < TOTAL_ITEMS; j++) {
if (lookup_table[j].item_id == new_int_item_id) {
tp_sprintf(lines[i].value, " <%s>",
@@ -295,39 +179,26 @@ void ItemWheelMenu::render() {
}
}
- Utilities::move_cursor(cursor, LINES, 0, false, false, false, true);
- Utilities::render_lines(lines, cursor.y, LINES);
-
- // check selected slot
- uint8_t current_item_slot = ITEM_WHEEL_SLOTS;
- if (cursor.y >= 0 && cursor.y < ITEM_WHEEL_SLOTS) {
- current_item_slot = cursor.y;
+ if (button_is_pressed(Controller::DPAD_RIGHT)) {
+ listIdx++;
+ if (listIdx > TOTAL_ITEMS) {
+ listIdx = 0;
+ }
+ dComIfGs_setItem(cursor.y, valid_items[listIdx]);
}
- if (Controller::button_is_pressed(Controller::DPAD_RIGHT) ||
- Controller::button_is_pressed(Controller::DPAD_LEFT)) {
- auto change_slot_item = Controller::button_is_pressed(Controller::DPAD_RIGHT) ?
- increment_slot_item :
- decrement_slot_item;
- if (current_item_slot < ITEM_WHEEL_SLOTS) {
- change_slot_item(current_item_slot);
- if (tp_gameInfo.inventory.item_values.value[current_item_slot] != 0xFF) {
- try_add_item(current_item_slot);
- } else {
- try_remove_item(current_item_slot);
- }
+ if (button_is_pressed(Controller::DPAD_LEFT)) {
+ listIdx--;
+ if (listIdx < 0) {
+ listIdx = 58;
}
+ dComIfGs_setItem(cursor.y, valid_items[listIdx]);
}
- if (Controller::button_is_down(Controller::Z) && !Controller::button_is_held(Controller::Z)) {
- if (current_item_slot < ITEM_WHEEL_SLOTS) {
- tp_gameInfo.inventory.item_values.value[current_item_slot] =
- default_items[current_item_slot];
- if (default_items[current_item_slot] != 0xFF) {
- try_add_item(current_item_slot);
- } else {
- try_remove_item(current_item_slot);
- }
- }
+ if (button_is_pressed(Controller::Z)) {
+ dComIfGs_setItem(cursor.y, default_items[cursor.y]);
}
-};
+
+ Utilities::move_cursor(cursor, LINES, 0, false, false, false, true);
+ Utilities::render_lines(lines, cursor.y, LINES);
+}
diff --git a/src/menus/main_menu.cpp b/src/menus/main_menu.cpp
index 7a1ae1d..0092fd1 100644
--- a/src/menus/main_menu.cpp
+++ b/src/menus/main_menu.cpp
@@ -1,8 +1,7 @@
#include "menus/main_menu.h"
#include "controller.h"
#include "fifo_queue.h"
-#include "libtp_c/include/controller.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
#include "utils/cursor.h"
#include "utils/lines.h"
diff --git a/src/menus/memfiles_menu.cpp b/src/menus/memfiles_menu.cpp
index 7d18dbc..dd6e94c 100644
--- a/src/menus/memfiles_menu.cpp
+++ b/src/menus/memfiles_menu.cpp
@@ -3,10 +3,12 @@
#include "gcn_c/include/card.h"
#include "font.h"
#include "utils/card.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/msl_c/string.h"
#include "utils/cursor.h"
#include "utils/lines.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "libtp_c/include/f_op/f_op_draw_tag.h"
+#include "libtp_c/include/f_op/f_op_scene_req.h"
#define LINES 4
#define MAX_SAVE_SLOTS 9
@@ -21,8 +23,8 @@ bool copy_respawn_data = false;
char fileBuf[9];
PositionData memfile_posdata;
-Vec3 tmpPos = tp_gameInfo.respawn_position;
-uint16_t tmpAngle = tp_gameInfo.respawn_angle;
+cXyz tmpPos = g_dComIfG_gameInfo.mInfo.mRestart.mRoomPos;
+uint16_t tmpAngle = g_dComIfG_gameInfo.mInfo.mRestart.mRoomAngleY;
Line lines[LINES] = {{"file slot:", MEMFILE_SLOT_INDEX, "Select memfile slot"},
{"save", MEMFILE_SAVE_INDEX, "Save memfile to slot", false},
@@ -32,8 +34,8 @@ Line lines[LINES] = {{"file slot:", MEMFILE_SLOT_INDEX, "Select memfile slot"},
void set_memfile_position() {
// respawn pos gets overwritten by default spawn, so reinject respawn info
if (!copy_respawn_data) {
- tmpPos = tp_gameInfo.respawn_position;
- tmpAngle = tp_gameInfo.respawn_angle;
+ tmpPos = g_dComIfG_gameInfo.mInfo.mRestart.mRoomPos;
+ tmpAngle = g_dComIfG_gameInfo.mInfo.mRestart.mRoomAngleY;
copy_respawn_data = true;
}
@@ -42,12 +44,12 @@ void set_memfile_position() {
}
if (memfile_load_delay == 0) {
- tp_zelAudio.link_debug_ptr->position = memfile_posdata.link;
+ dComIfGp_getPlayer()->mCurrent.mPosition = memfile_posdata.link;
tp_matrixInfo.matrix_info->target = memfile_posdata.cam.target;
tp_matrixInfo.matrix_info->pos = memfile_posdata.cam.pos;
- tp_zelAudio.link_debug_ptr->facing = memfile_posdata.angle;
- tp_gameInfo.respawn_position = tmpPos;
- tp_gameInfo.respawn_angle = tmpAngle;
+ dComIfGp_getPlayer()->mCollisionRot.mY = memfile_posdata.angle;
+ g_dComIfG_gameInfo.mInfo.mRestart.mRoomPos = tmpPos;
+ g_dComIfG_gameInfo.mInfo.mRestart.mRoomAngleY = tmpAngle;
set_position_data = false;
copy_respawn_data = false;
memfile_load_delay = 10;
diff --git a/src/menus/memory_editor_menu.cpp b/src/menus/memory_editor_menu.cpp
index 3bcbf40..efb5cfd 100644
--- a/src/menus/memory_editor_menu.cpp
+++ b/src/menus/memory_editor_menu.cpp
@@ -1,9 +1,8 @@
#include "menus/memory_editor_menu.h"
#include "controller.h"
#include "font.h"
-#include "libtp_c/include/controller.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
+#include "libtp_c/include/msl_c/string.h"
#include "menus/settings_menu.h"
#include "utils/cursor.h"
#include "utils/lines.h"
diff --git a/src/menus/memory_menu.cpp b/src/menus/memory_menu.cpp
index 51d993f..18242a3 100644
--- a/src/menus/memory_menu.cpp
+++ b/src/menus/memory_menu.cpp
@@ -1,7 +1,6 @@
#include "menus/memory_menu.h"
#include "controller.h"
#include "font.h"
-#include "libtp_c/include/tp.h"
#include "utils/cursor.h"
#include "utils/lines.h"
diff --git a/src/menus/pause_menu.cpp b/src/menus/pause_menu.cpp
index f9c8acb..fb21604 100644
--- a/src/menus/pause_menu.cpp
+++ b/src/menus/pause_menu.cpp
@@ -1,10 +1,9 @@
#include "menus/pause_menu.h"
#include "controller.h"
#include "font.h"
-#include "libtp_c/include/flag.h"
-#include "libtp_c/include/inventory.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/msl_c/string.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "libtp_c/include/utils.h"
#include "utils/cursor.h"
#include "utils/lines.h"
@@ -70,7 +69,7 @@ Line lines[LINES] = {
{"jump strike:", JUMP_STRIKE_INDEX, "Jump Strike", true, &jump_strike},
{"greatspin:", GREAT_SPIN_INDEX, "Greatspin", true, &great_spin}};
-void reset_index() {
+void resetIndex() {
ordon_sword_index = 0;
master_sword_index = 0;
wood_shield_index = 0;
@@ -83,46 +82,46 @@ void reset_index() {
arrow_capacity_index = 0;
}
-void get_equipment() {
- if (tp_gameInfo.inventory.equipment_flags_1 & (1UL << 0)) {
+void getEquipment() {
+ if (dComIfGs_isItemFirstBit(SWORD)) {
ordon_sword_index = 2;
- } else if (tp_gameInfo.inventory.wood_sword_flag & (1UL << 7)) {
+ } else if (dComIfGs_isItemFirstBit(WOOD_STICK)) {
ordon_sword_index = 1;
}
- if (tp_gameInfo.inventory.light_sword_flag & (1UL << 2)) {
+ if (dComIfGs_isItemFirstBit(LIGHT_SWORD)) {
master_sword_index = 2;
- } else if (tp_gameInfo.inventory.equipment_flags_1 & (1UL << 1)) {
+ } else if (dComIfGs_isItemFirstBit(MASTER_SWORD)) {
master_sword_index = 1;
}
- if (tp_gameInfo.inventory.equipment_flags_1 & (1UL << 3)) {
+ if (dComIfGs_isItemFirstBit(SHIELD)) {
wood_shield_index = 2;
- } else if (tp_gameInfo.inventory.equipment_flags_1 & (1UL << 2)) {
+ } else if (dComIfGs_isItemFirstBit(WOOD_SHIELD)) {
wood_shield_index = 1;
}
- if (tp_gameInfo.inventory.equipment_flags_1 & (1UL << 4)) {
+ if (dComIfGs_isItemFirstBit(HYLIA_SHIELD)) {
hylian_shield_index = 1;
}
- if (tp_gameInfo.inventory.equipment_flags_1 & (1UL << 7)) {
+ if (dComIfGs_isItemFirstBit(WEAR_KOKIRI)) {
hero_tunic_index = 1;
}
- if (tp_gameInfo.inventory.equipment_flags_0 & (1UL << 1)) {
+ if (dComIfGs_isItemFirstBit(WEAR_ZORA)) {
zora_armor_index = 1;
}
- if (tp_gameInfo.inventory.equipment_flags_0 & (1UL << 0)) {
+ if (dComIfGs_isItemFirstBit(ARMOR)) {
magic_armor_index = 1;
}
- if (tp_gameInfo.inventory.light_sword_flag & (1UL << 7)) {
+ if (dComIfGs_isItemFirstBit(BOMB_BAG_LV2)) {
bomb_capacity_index = 1;
}
- switch (tp_gameInfo.link.wallet_upgrade) {
+ switch (dComIfGs_getWalletSize()) {
case 1: {
wallet_index = 1;
break;
@@ -133,146 +132,146 @@ void get_equipment() {
}
}
- if (tp_gameInfo.inventory.arrow_capacity == 100) {
+ if (dComIfGs_getArrowMax() == 100) {
arrow_capacity_index = 2;
- } else if (tp_gameInfo.inventory.arrow_capacity == 60) {
+ } else if (dComIfGs_getArrowMax() == 60) {
arrow_capacity_index = 1;
}
}
-void set_equipment() {
+void setEquipment() {
switch (ordon_sword_index) {
case 0: {
- tp_gameInfo.inventory.equipment_flags_1 &= ~(1UL << 0);
- tp_gameInfo.inventory.wood_sword_flag &= ~(1UL << 7);
+ dComIfGs_offItemFirstBit(WOOD_STICK);
+ dComIfGs_offItemFirstBit(SWORD);
break;
}
case 1: {
- tp_gameInfo.inventory.wood_sword_flag |= 1UL << 7;
- tp_gameInfo.inventory.equipment_flags_1 &= ~(1UL << 0);
+ dComIfGs_onItemFirstBit(WOOD_STICK);
+ dComIfGs_offItemFirstBit(SWORD);
break;
}
case 2: {
- tp_gameInfo.inventory.equipment_flags_1 |= 1UL << 0;
- tp_gameInfo.inventory.wood_sword_flag &= ~(1UL << 7);
+ dComIfGs_onItemFirstBit(SWORD);
+ dComIfGs_offItemFirstBit(WOOD_STICK);
break;
}
}
switch (master_sword_index) {
case 0: {
- tp_gameInfo.inventory.equipment_flags_1 &= ~(1UL << 1);
- tp_gameInfo.inventory.light_sword_flag &= ~(1UL << 2);
+ dComIfGs_offItemFirstBit(MASTER_SWORD);
+ dComIfGs_offItemFirstBit(LIGHT_SWORD);
break;
}
case 1: {
- tp_gameInfo.inventory.equipment_flags_1 |= 1UL << 1;
- tp_gameInfo.inventory.light_sword_flag &= ~(1UL << 2);
+ dComIfGs_onItemFirstBit(MASTER_SWORD);
+ dComIfGs_offItemFirstBit(LIGHT_SWORD);
break;
}
case 2: {
- tp_gameInfo.inventory.light_sword_flag |= 1UL << 2;
+ dComIfGs_onItemFirstBit(LIGHT_SWORD);
break;
}
}
switch (wood_shield_index) {
case 0: {
- tp_gameInfo.inventory.equipment_flags_1 &= ~(1UL << 2);
- tp_gameInfo.inventory.equipment_flags_1 &= ~(1UL << 3);
+ dComIfGs_offItemFirstBit(SHIELD);
+ dComIfGs_offItemFirstBit(WOOD_SHIELD);
break;
}
case 1: {
- tp_gameInfo.inventory.equipment_flags_1 |= 1UL << 2;
+ dComIfGs_onItemFirstBit(WOOD_SHIELD);
break;
}
case 2: {
- tp_gameInfo.inventory.equipment_flags_1 |= 1UL << 3;
+ dComIfGs_onItemFirstBit(SHIELD);
break;
}
}
switch (hylian_shield_index) {
case 0: {
- tp_gameInfo.inventory.equipment_flags_1 &= ~(1UL << 4);
+ dComIfGs_offItemFirstBit(HYLIA_SHIELD);
break;
}
case 1: {
- tp_gameInfo.inventory.equipment_flags_1 |= 1UL << 4;
+ dComIfGs_onItemFirstBit(HYLIA_SHIELD);
break;
}
}
switch (hero_tunic_index) {
case 0: {
- tp_gameInfo.inventory.equipment_flags_1 &= ~(1UL << 7);
+ dComIfGs_offItemFirstBit(WEAR_KOKIRI);
break;
}
case 1: {
- tp_gameInfo.inventory.equipment_flags_1 |= 1UL << 7;
+ dComIfGs_onItemFirstBit(WEAR_KOKIRI);
break;
}
}
switch (zora_armor_index) {
case 0: {
- tp_gameInfo.inventory.equipment_flags_0 &= ~(1UL << 1);
+ dComIfGs_offItemFirstBit(WEAR_ZORA);
break;
}
case 1: {
- tp_gameInfo.inventory.equipment_flags_0 |= 1UL << 1;
+ dComIfGs_onItemFirstBit(WEAR_ZORA);
break;
}
}
switch (magic_armor_index) {
case 0: {
- tp_gameInfo.inventory.equipment_flags_0 &= ~(1UL << 0);
+ dComIfGs_offItemFirstBit(ARMOR);
break;
}
case 1: {
- tp_gameInfo.inventory.equipment_flags_0 |= 1UL << 0;
+ dComIfGs_onItemFirstBit(ARMOR);
break;
}
}
switch (bomb_capacity_index) {
case 0: {
- tp_gameInfo.inventory.light_sword_flag &= ~(1UL << 7);
+ dComIfGs_offItemFirstBit(BOMB_BAG_LV2);
break;
}
case 1: {
- tp_gameInfo.inventory.light_sword_flag |= 1UL << 7;
+ dComIfGs_onItemFirstBit(BOMB_BAG_LV2);
break;
}
}
switch (wallet_index) {
case 0: {
- tp_gameInfo.link.wallet_upgrade = 0;
+ dComIfGs_setWalletSize(WALLET);
break;
}
case 1: {
- tp_gameInfo.link.wallet_upgrade = 1;
+ dComIfGs_setWalletSize(BIG_WALLET);
break;
}
case 2: {
- tp_gameInfo.link.wallet_upgrade = 2;
+ dComIfGs_setWalletSize(GIANT_WALLET);
break;
}
}
switch (arrow_capacity_index) {
case 0: {
- tp_gameInfo.inventory.arrow_capacity = 30;
+ dComIfGs_setArrowMax(30);
break;
}
case 1: {
- tp_gameInfo.inventory.arrow_capacity = 60;
+ dComIfGs_setArrowMax(60);
break;
}
case 2: {
- tp_gameInfo.inventory.arrow_capacity = 100;
+ dComIfGs_setArrowMax(100);
break;
}
}
@@ -280,23 +279,23 @@ void set_equipment() {
void PauseMenu::render() {
// update hidden skill flags
- ending_blow = (tp_gameInfo.event_flags.flags[0x29] & (1 << 2));
- shield_bash = (tp_gameInfo.event_flags.flags[0x29] & (1 << 3));
- backslice = (tp_gameInfo.event_flags.flags[0x29] & (1 << 1));
- helm_splitter = (tp_gameInfo.event_flags.flags[0x29] & (1 << 0));
- mortal_draw = (tp_gameInfo.event_flags.flags[0x2A] & (1 << 7));
- jump_strike = (tp_gameInfo.event_flags.flags[0x2A] & (1 << 6));
- great_spin = (tp_gameInfo.event_flags.flags[0x2A] & (1 << 5));
+ ending_blow = dComIfGs_isEventBit(0x2904);
+ shield_bash = dComIfGs_isEventBit(0x2908);
+ backslice = dComIfGs_isEventBit(0x2902);
+ helm_splitter = dComIfGs_isEventBit(0x2901);
+ mortal_draw = dComIfGs_isEventBit(0x2A80);
+ jump_strike = dComIfGs_isEventBit(0x2A40);
+ great_spin = dComIfGs_isEventBit(0x2A20);
if (button_is_pressed(BACK_BUTTON)) {
init_once = false;
MenuRendering::set_menu(MN_INVENTORY_INDEX);
- reset_index();
+ resetIndex();
return;
};
if (!init_once) {
- get_equipment();
+ getEquipment();
current_input = 0;
init_once = true;
}
@@ -426,37 +425,37 @@ void PauseMenu::render() {
if (current_input == SELECTION_BUTTON && a_held == false) {
switch (cursor.y) {
case ENDING_BLOW_INDEX: {
- tp_gameInfo.event_flags.flags[0x29] ^= 1 << 2;
+ setEventFlag(0x2904);
break;
}
case SHIELD_BASH_INDEX: {
- tp_gameInfo.event_flags.flags[0x29] ^= 1 << 3;
+ setEventFlag(0x2908);
break;
}
case BACKSLICE_INDEX: {
- tp_gameInfo.event_flags.flags[0x29] ^= 1 << 1;
+ setEventFlag(0x2902);
break;
}
case HELM_SPLITTER_INDEX: {
- tp_gameInfo.event_flags.flags[0x29] ^= 1 << 0;
+ setEventFlag(0x2901);
break;
}
case MORTAL_DRAW_INDEX: {
- tp_gameInfo.event_flags.flags[0x2A] ^= 1 << 7;
+ setEventFlag(0x2A80);
break;
}
case JUMP_STRIKE_INDEX: {
- tp_gameInfo.event_flags.flags[0x2A] ^= 1 << 6;
+ setEventFlag(0x2A40);
break;
}
case GREAT_SPIN_INDEX: {
- tp_gameInfo.event_flags.flags[0x2A] ^= 1 << 5;
+ setEventFlag(0x2A20);
break;
}
}
}
- set_equipment();
+ setEquipment();
tp_sprintf(lines[ORDON_SWORD_INDEX].value, " <%s>",
ordon_sword_options[ordon_sword_index].member);
diff --git a/src/menus/portal_flags_menu.cpp b/src/menus/portal_flags_menu.cpp
index 4037df5..aea4903 100644
--- a/src/menus/portal_flags_menu.cpp
+++ b/src/menus/portal_flags_menu.cpp
@@ -1,10 +1,9 @@
#include "controller.h"
#include "font.h"
-#include "libtp_c/include/flag.h"
-#include "libtp_c/include/tp.h"
#include "menus/flags_menu.h"
#include "utils/cursor.h"
#include "utils/lines.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
#define LINES 15
@@ -45,23 +44,34 @@ Line lines[LINES] = {
{"mirror chamber", MIRROR_WARP_INDEX, "Mirror Chamber warp portal", true, &mirror_warp},
};
+bool getSaveSwitch(int32_t stage, int32_t flag) {
+ return dSv_memBit_c__isSwitch(&dComIfGs_getSavedata().mSave[stage].mMemBit, flag);
+}
+
+void setSaveSwitch(int32_t stage, int32_t flag) {
+ if (getSaveSwitch(stage, flag)) {
+ dSv_memBit_c__offSwitch(&dComIfGs_getSavedata().mSave[stage].mMemBit, flag);
+ } else {
+ dSv_memBit_c__onSwitch(&dComIfGs_getSavedata().mSave[stage].mMemBit, flag);
+ }
+}
+
void PortalFlagsMenu::render() {
- // update flags
- spring_warp = (tp_gameInfo.overworld_flags.ordon_flags.flags[13] & (1 << 4));
- south_faron_warp = (tp_gameInfo.overworld_flags.faron_flags.flags[19] & (1 << 7));
- north_faron_warp = (tp_gameInfo.overworld_flags.faron_flags.flags[11] & (1 << 2));
- grove_warp = (tp_gameInfo.overworld_flags.grove_flags.flags[23] & (1 << 4));
- gorge_warp = (tp_gameInfo.overworld_flags.hyrule_field_flags.flags[9] & (1 << 5));
- kakariko_warp = (tp_gameInfo.overworld_flags.eldin_flags.flags[8] & (1 << 7));
- mountain_warp = (tp_gameInfo.overworld_flags.eldin_flags.flags[9] & (1 << 5));
- bridge_warp = (tp_gameInfo.overworld_flags.hyrule_field_flags.flags[23] & (1 << 3));
- castle_town_warp = (tp_gameInfo.overworld_flags.hyrule_field_flags.flags[11] & (1 << 3));
- lake_hylia_warp = (tp_gameInfo.overworld_flags.lanayru_flags.flags[10] & (1 << 2));
- domain_warp = (tp_gameInfo.overworld_flags.lanayru_flags.flags[11] & (1 << 2));
- uzr_warp = (tp_gameInfo.overworld_flags.lanayru_flags.flags[9] & (1 << 5));
- snowpeak_warp = (tp_gameInfo.overworld_flags.snowpeak_flags.flags[9] & (1 << 5));
- mesa_warp = (tp_gameInfo.overworld_flags.desert_flags.flags[9] & (1 << 5));
- mirror_warp = (tp_gameInfo.overworld_flags.desert_flags.flags[14] & (1 << 0));
+ spring_warp = getSaveSwitch(dSv_memory_c::ORDON, 52);
+ south_faron_warp = getSaveSwitch(dSv_memory_c::FARON, 71);
+ north_faron_warp = getSaveSwitch(dSv_memory_c::FARON, 2);
+ grove_warp = getSaveSwitch(dSv_memory_c::GROVE, 100);
+ gorge_warp = getSaveSwitch(dSv_memory_c::FIELD, 21);
+ kakariko_warp = getSaveSwitch(dSv_memory_c::ELDIN, 31);
+ mountain_warp = getSaveSwitch(dSv_memory_c::ELDIN, 21);
+ bridge_warp = getSaveSwitch(dSv_memory_c::FIELD, 99);
+ castle_town_warp = getSaveSwitch(dSv_memory_c::FIELD, 3);
+ lake_hylia_warp = getSaveSwitch(dSv_memory_c::LANAYRU, 10);
+ domain_warp = getSaveSwitch(dSv_memory_c::LANAYRU, 2);
+ uzr_warp = getSaveSwitch(dSv_memory_c::LANAYRU, 21);
+ snowpeak_warp = getSaveSwitch(dSv_memory_c::SNOWPEAK, 21);
+ mesa_warp = getSaveSwitch(dSv_memory_c::DESERT, 21);
+ mirror_warp = getSaveSwitch(dSv_memory_c::DESERT, 40);
if (button_is_pressed(BACK_BUTTON)) {
init_once = false;
@@ -77,66 +87,68 @@ void PortalFlagsMenu::render() {
if (current_input == SELECTION_BUTTON && a_held == false) {
switch (cursor.y) {
case SPRING_WARP_INDEX: {
- tp_gameInfo.overworld_flags.ordon_flags.flags[13] ^= 1 << 4;
+ setSaveSwitch(dSv_memory_c::ORDON, 52);
break;
}
case S_FARON_WARP_INDEX: {
- tp_gameInfo.overworld_flags.faron_flags.flags[19] ^= 1 << 7;
+ setSaveSwitch(dSv_memory_c::FARON, 71);
break;
}
case N_FARON_WARP_INDEX: {
- tp_gameInfo.overworld_flags.faron_flags.flags[11] ^= 1 << 2;
+ setSaveSwitch(dSv_memory_c::FARON, 2);
break;
}
case GROVE_WARP_INDEX: {
- tp_gameInfo.overworld_flags.grove_flags.flags[23] ^= 1 << 4;
+ setSaveSwitch(dSv_memory_c::GROVE, 100);
break;
}
case GORGE_WARP_INDEX: {
- tp_gameInfo.overworld_flags.hyrule_field_flags.flags[9] ^= 1 << 5;
+ setSaveSwitch(dSv_memory_c::FIELD, 21);
break;
}
case KAKARIKO_WARP_INDEX: {
- tp_gameInfo.overworld_flags.eldin_flags.flags[8] ^= 1 << 7;
+ setSaveSwitch(dSv_memory_c::ELDIN, 31);
break;
}
case MOUNTAIN_WARP_INDEX: {
- tp_gameInfo.overworld_flags.eldin_flags.flags[9] ^= 1 << 5;
+ setSaveSwitch(dSv_memory_c::ELDIN, 21);
break;
}
case BRIDGE_WARP_INDEX: {
- tp_gameInfo.overworld_flags.hyrule_field_flags.flags[23] ^= 1 << 3;
+ setSaveSwitch(dSv_memory_c::FIELD, 99);
break;
}
case TOWN_WARP_INDEX: {
- tp_gameInfo.overworld_flags.hyrule_field_flags.flags[11] ^= 1 << 3;
+ setSaveSwitch(dSv_memory_c::FIELD, 3);
break;
}
case LAKE_WARP_INDEX: {
- tp_gameInfo.overworld_flags.lanayru_flags.flags[10] ^= 1 << 2;
+ setSaveSwitch(dSv_memory_c::LANAYRU, 10);
break;
}
case DOMAIN_WARP_INDEX: {
- tp_gameInfo.overworld_flags.lanayru_flags.flags[11] ^= 1 << 2;
+ setSaveSwitch(dSv_memory_c::LANAYRU, 2);
break;
}
case UZR_WARP_INDEX: {
- tp_gameInfo.overworld_flags.lanayru_flags.flags[9] ^= 1 << 5;
+ setSaveSwitch(dSv_memory_c::LANAYRU, 21);
break;
}
case SNOWPEAK_WARP_INDEX: {
- tp_gameInfo.overworld_flags.snowpeak_flags.flags[9] ^= 1 << 5;
+ setSaveSwitch(dSv_memory_c::SNOWPEAK, 21);
break;
}
case MESA_WARP_INDEX: {
- tp_gameInfo.overworld_flags.desert_flags.flags[9] ^= 1 << 5;
+ setSaveSwitch(dSv_memory_c::DESERT, 21);
break;
}
case MIRROR_WARP_INDEX: {
- tp_gameInfo.overworld_flags.desert_flags.flags[14] ^= 1 << 0;
+ setSaveSwitch(dSv_memory_c::DESERT, 40);
break;
}
}
+ // copy stage save flags to temp flags
+ dComIfGs_getSave(g_dComIfG_gameInfo.mInfo.mDan.mStageNo);
}
Utilities::move_cursor(cursor, LINES);
diff --git a/src/menus/position_settings_menu.cpp b/src/menus/position_settings_menu.cpp
index df2b7cd..05901af 100644
--- a/src/menus/position_settings_menu.cpp
+++ b/src/menus/position_settings_menu.cpp
@@ -3,11 +3,11 @@
#include "controller.h"
#include "fifo_queue.h"
#include "font.h"
-#include "libtp_c/include/tp.h"
#include "menus/settings_menu.h"
#include "utils/cursor.h"
#include "utils/draw.h"
#include "utils/lines.h"
+#include "libtp_c/include/SSystem/SComponent/c_counter.h"
#define LINES SPRITES_AMNT
#define NO_SELECTION ((uint8_t)-1)
@@ -36,7 +36,7 @@ Line lines[LINES] = {
{"fifo queue", SpritesIndex::FIFO_SPR_INDEX, "Change fifo queue position", false}};
void draw_cursor(Vec2 pos) {
- bool cycle = (TP::get_frame_count() / 8) % 2;
+ bool cycle = (cCt_getFrameCount() / 8) % 2;
if (g_drop_shadows) {
Draw::draw_rect_outline(DROP_SHADOWS_RGBA, {pos.x - 10 + 1, pos.y + 1}, {20, 0}, 0xA);
Draw::draw_rect_outline(DROP_SHADOWS_RGBA, {pos.x + 1, pos.y - 10 + 1}, {0, 20}, 0xA);
diff --git a/src/menus/practice_menu.cpp b/src/menus/practice_menu.cpp
index f052582..8aa4478 100644
--- a/src/menus/practice_menu.cpp
+++ b/src/menus/practice_menu.cpp
@@ -1,8 +1,6 @@
#include "menus/practice_menu.h"
#include "controller.h"
#include "font.h"
-#include "libtp_c/include/tp.h"
-
#include "utils/cursor.h"
#include "utils/lines.h"
diff --git a/src/menus/scene_menu.cpp b/src/menus/scene_menu.cpp
index da178f9..481c81f 100644
--- a/src/menus/scene_menu.cpp
+++ b/src/menus/scene_menu.cpp
@@ -3,8 +3,8 @@
#include "utils/cursor.h"
#include "utils/lines.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/msl_c/string.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
#define LINES SCENE_AMNT
static Cursor cursor = {0, 0};
@@ -45,11 +45,13 @@ void SceneMenu::render() {
init_once = true;
}
- int current_hour = (int)tp_gameInfo.raw_game_time / 15;
+ float current_time = dComIfGs_getTime();
+
+ int current_hour = (int)current_time / 15;
if (current_hour > 23) {
current_hour = 0;
}
- int current_minute = (int)((4.0f * tp_gameInfo.raw_game_time) - current_hour * 60);
+ int current_minute = (int)((4.0f * current_time) - current_hour * 60);
tp_sprintf(lines[TIME_HOURS_INDEX].value, " <%d>", current_hour);
tp_sprintf(lines[TIME_MINUTES_INDEX].value, " <%d>", current_minute);
@@ -63,25 +65,25 @@ void SceneMenu::render() {
switch (cursor.y) {
case TIME_HOURS_INDEX: {
if (button_is_pressed(Controller::DPAD_RIGHT)) {
- tp_gameInfo.raw_game_time += 15.0f;
+ dComIfGs_setTime(current_time + 15.0f);
} else if (button_is_pressed(Controller::DPAD_LEFT)) {
- tp_gameInfo.raw_game_time -= 15.0f;
+ dComIfGs_setTime(current_time - 15.0f);
}
break;
}
case TIME_MINUTES_INDEX: {
if (button_is_pressed(Controller::DPAD_RIGHT)) {
- tp_gameInfo.raw_game_time += 0.25f;
+ dComIfGs_setTime(current_time + 0.25f);
} else if (button_is_pressed(Controller::DPAD_LEFT)) {
- tp_gameInfo.raw_game_time -= 0.25f;
+ dComIfGs_setTime(current_time - 0.25f);
}
break;
}
}
- if (tp_gameInfo.raw_game_time >= 360.0f) {
- tp_gameInfo.raw_game_time -= 360.0f;
+ if (current_time >= 360.0f) {
+ dComIfGs_setTime(current_time - 360.0f);
}
- if (tp_gameInfo.raw_game_time < 0) {
- tp_gameInfo.raw_game_time += 360.0f;
+ if (current_time < 0) {
+ dComIfGs_setTime(current_time + 360.0f);
}
}
diff --git a/src/menus/settings_menu.cpp b/src/menus/settings_menu.cpp
index 717d2f9..038cca2 100644
--- a/src/menus/settings_menu.cpp
+++ b/src/menus/settings_menu.cpp
@@ -1,8 +1,7 @@
#include "menus/settings_menu.h"
#include "controller.h"
#include "gcn_c/include/card.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/msl_c/string.h"
#include "utils/card.h"
#include "utils/cursor.h"
#include "utils/lines.h"
diff --git a/src/menus/tools_menu.cpp b/src/menus/tools_menu.cpp
index fd374df..b35fcc0 100644
--- a/src/menus/tools_menu.cpp
+++ b/src/menus/tools_menu.cpp
@@ -7,14 +7,13 @@
#include "bit.h"
#endif
#include "input_viewer.h"
-#include "libtp_c/include/actor.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/msl_c/string.h"
#include "movelink.h"
#include "rollcheck.h"
#include "timer.h"
#include "utils/cursor.h"
#include "utils/lines.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
#define LINES TOOL_AMNT
#define MAX_TUNIC_COLORS 7
using namespace Tools;
@@ -26,15 +25,15 @@ bool init_once = false;
bool g_tunic_color_flag;
Tool ToolItems[TOOL_AMNT] = {
- {RELOAD_AREA_INDEX, false}, {FAST_BONK_INDEX, false}, {FAST_MOVEMENT_INDEX, false},
+ {RELOAD_AREA_INDEX, false}, {FAST_BONK_INDEX, false}, {FAST_MOVEMENT_INDEX, false},
{GORGE_INDEX, false},
#ifdef WII_PLATFORM
{BIT_INDEX, false},
#endif
- {INPUT_VIEWER_INDEX, false}, {LINK_DEBUG_INDEX, false}, {SAND_INDEX, false},
- {ROLL_INDEX, false}, {TELEPORT_INDEX, false}, {TURBO_MODE_INDEX, false},
- {TIMER_INDEX, false}, {LOAD_TIMER_INDEX, false}, {IGT_TIMER_INDEX, false},
- {FREE_CAM_INDEX, false}, {MOVE_LINK_INDEX, false}};
+ {COROTD_INDEX, false}, {INPUT_VIEWER_INDEX, false}, {LINK_DEBUG_INDEX, false},
+ {SAND_INDEX, false}, {ROLL_INDEX, false}, {TELEPORT_INDEX, false},
+ {TURBO_MODE_INDEX, false}, {TIMER_INDEX, false}, {LOAD_TIMER_INDEX, false},
+ {IGT_TIMER_INDEX, false}, {FREE_CAM_INDEX, false}, {MOVE_LINK_INDEX, false}};
Line lines[LINES] = {
{"area reload", RELOAD_AREA_INDEX, "Use " RELOAD_AREA_TEXT " to reload current area", true,
@@ -49,6 +48,8 @@ Line lines[LINES] = {
{"bit checker", BIT_INDEX, "Use " BACK_IN_TIME_TEXT " to warp to Ordon Bridge", true,
&ToolItems[BIT_INDEX].active},
#endif
+ {"coro td checker", COROTD_INDEX, "Show frame info when doing coro td", true,
+ &ToolItems[COROTD_INDEX].active},
{"input viewer", INPUT_VIEWER_INDEX, "Show current inputs", true,
&ToolItems[INPUT_VIEWER_INDEX].active},
{"link debug info", LINK_DEBUG_INDEX, "Show Link's position, angle, and speed", true,
@@ -170,8 +171,8 @@ void ToolsMenu::render() {
break;
}
case SAND_INDEX: {
- if (tp_zelAudio.link_debug_ptr != nullptr) {
- tp_zelAudio.link_debug_ptr->sand_height_lost = 0;
+ if (g_dComIfG_gameInfo.play.mPlayer != nullptr) {
+ dComIfGp_getPlayer()->field_0x2ba8 = 0;
}
break;
}
diff --git a/src/menus/warping_menu.cpp b/src/menus/warping_menu.cpp
index a9468fc..62791ce 100644
--- a/src/menus/warping_menu.cpp
+++ b/src/menus/warping_menu.cpp
@@ -4,11 +4,10 @@
#include "controller.h"
#include "font.h"
#include "fs.h"
-#include "libtp_c/include/tp.h"
#include "utils/cursor.h"
#include "utils/lines.h"
-
-#include "libtp_c/include/system.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "libtp_c/include/msl_c/string.h"
#define LINES 7
#define SPAWN_OFFSET 4
@@ -249,23 +248,26 @@ void WarpingMenu::render() {
if (current_input == SELECTION_BUTTON && a_held == false) {
switch (cursor.y) {
case WARP_BUTTON_INDEX: {
- tp_memcpy(&tp_gameInfo.warp.entrance.stage, &warp_info.stage_info.stage_id, 8);
- tp_gameInfo.warp.entrance.room = warp_info.room_info.room_id[0];
- tp_gameInfo.warp.entrance.spawn = warp_info.spawn_info.spawn_id[0];
- tp_gameInfo.warp.entrance.state = layer;
+ tp_memcpy(&g_dComIfG_gameInfo.play.mNextStage.mStage, &warp_info.stage_info.stage_id,
+ 8);
+ g_dComIfG_gameInfo.play.mNextStage.mRoomNo = warp_info.room_info.room_id[0];
+ g_dComIfG_gameInfo.play.mNextStage.mPoint = warp_info.spawn_info.spawn_id[0];
+ g_dComIfG_gameInfo.play.mNextStage.mLayer = layer;
init_once = false;
fifo_visible = true;
MenuRendering::set_menu(MN_NONE_INDEX);
- tp_gameInfo.loading_animation = 13; // instant load
- tp_gameInfo.respawn_animation = 0;
- tp_gameInfo.warp.entrance.void_flag = 0;
- tp_gameInfo.warp.enabled = true;
+ g_dComIfG_gameInfo.play.mNextStage.wipe = 13; // instant load
+ g_dComIfG_gameInfo.mInfo.mRestart.mLastMode = 0;
+ g_dComIfG_gameInfo.play.mNextStage.enabled = true;
break;
}
case SAVE_LOCATION_INDEX: {
- tp_memcpy(&tp_gameInfo.player.player_stage, &warp_info.stage_info.stage_id, 8);
- tp_gameInfo.player.player_room_id = warp_info.room_info.room_id[0];
- tp_gameInfo.player.player_spawn_id = warp_info.spawn_info.spawn_id[0];
+ tp_memcpy(&g_dComIfG_gameInfo.mInfo.getPlayer().player_return.mCurrentStage,
+ &warp_info.stage_info.stage_id, 8);
+ g_dComIfG_gameInfo.mInfo.getPlayer().player_return.mRoomId =
+ warp_info.room_info.room_id[0];
+ g_dComIfG_gameInfo.mInfo.getPlayer().player_return.mSpawnId =
+ warp_info.spawn_info.spawn_id[0];
break;
}
}
diff --git a/src/menus/watches_menu.cpp b/src/menus/watches_menu.cpp
index 59f8366..8636cf4 100644
--- a/src/menus/watches_menu.cpp
+++ b/src/menus/watches_menu.cpp
@@ -1,7 +1,7 @@
#include "controller.h"
#include "font.h"
-#include "libtp_c/include/math.h"
-#include "libtp_c/include/system.h"
+#include "libtp_c/include/msl_c/math.h"
+#include "libtp_c/include/msl_c/string.h"
#include "menus/memory_editor_menu.h"
#include "menus/memory_menu.h"
#include "menus/settings_menu.h"
diff --git a/src/movelink.cpp b/src/movelink.cpp
index aa47a21..6f648b6 100644
--- a/src/movelink.cpp
+++ b/src/movelink.cpp
@@ -1,14 +1,15 @@
#include "movelink.h"
#include "controller.h"
#include "font.h"
-#include "libtp_c/include/controller.h"
-#include "libtp_c/include/math.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
+#include "libtp_c/include/msl_c/math.h"
+#include "libtp_c/include/msl_c/string.h"
#include "menu.h"
#include "menus/settings_menu.h"
#include "utils/cursor.h"
#include "utils/lines.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "libtp_c/include/f_op/f_op_draw_tag.h"
#define ROTATION_SPEED (10)
#define CAM_FAST_SPEED (2.0)
@@ -57,15 +58,16 @@ void move_link() {
auto& cam_target = tp_matrixInfo.matrix_info->target;
auto& cam_pos = tp_matrixInfo.matrix_info->pos;
- auto& link_pos = tp_zelAudio.link_debug_ptr->position;
- auto& link_angle = tp_zelAudio.link_debug_ptr->facing;
+ cXyz& link_pos = dComIfGp_getPlayer()->mCurrent.mPosition;
+ int16_t& link_angle = dComIfGp_getPlayer()->mCollisionRot.mY;
// Freeze the game to prevent control stick inputs to move link
- tp_gameInfo.freeze_game = true;
+ dComIfGp_getEvent().mHalt = true;
// Lock the camera to allow for its movement
- tp_gameInfo.lock_camera = true;
+ dComIfGp_getEventManager().mCameraPlay = 1;
// Set Link momentum to 0
- tp_gameInfo.momentum_ptr->link_momentum = {0.0f, 0.0f, 0.0f};
+ cXyz tmp(0.0f, 0.0f, 0.0f);
+ dComIfGp_getPlayer()->mSpeed = tmp;
// Disable Link collision (causes console crash dont use)
// tp_gameInfo.link_collision_ptr->no_collision = 0x7F;
@@ -106,8 +108,8 @@ void move_link() {
} else {
if (init_once) {
- tp_gameInfo.freeze_game = false;
- tp_gameInfo.lock_camera = false;
+ dComIfGp_getEvent().mHalt = false;
+ dComIfGp_getEventManager().mCameraPlay = 0;
// tp_gameInfo.link_collision_ptr->no_collision = 0x80;
init_once = false;
}
@@ -121,33 +123,33 @@ void render_info_input() {
char link_z[20];
uint8_t cursor_x_max = 1;
- tp_sprintf(link_angle, "angle: %05d", tp_zelAudio.link_debug_ptr->facing);
- tp_sprintf(link_x, "x-pos: % 010.2f", tp_zelAudio.link_debug_ptr->position.x);
- tp_sprintf(link_y, "y-pos: % 010.2f", tp_zelAudio.link_debug_ptr->position.y);
- tp_sprintf(link_z, "z-pos: % 010.2f", tp_zelAudio.link_debug_ptr->position.z);
+ tp_sprintf(link_angle, "angle: %05d", (uint16_t)dComIfGp_getPlayer()->mCollisionRot.mY);
+ tp_sprintf(link_x, "x-pos: % 010.2f", dComIfGp_getPlayer()->mCurrent.mPosition.x);
+ tp_sprintf(link_y, "y-pos: % 010.2f", dComIfGp_getPlayer()->mCurrent.mPosition.y);
+ tp_sprintf(link_z, "z-pos: % 010.2f", dComIfGp_getPlayer()->mCurrent.mPosition.z);
if (link_angle_selected) {
cursor_x_max = 5;
if (button_is_pressed(Controller::DPAD_UP)) {
switch (cursor.x) {
case 0: {
- tp_zelAudio.link_debug_ptr->facing += 10000;
+ dComIfGp_getPlayer()->mCollisionRot.mY += 10000;
break;
}
case 1: {
- tp_zelAudio.link_debug_ptr->facing += 1000;
+ dComIfGp_getPlayer()->mCollisionRot.mY += 1000;
break;
}
case 2: {
- tp_zelAudio.link_debug_ptr->facing += 100;
+ dComIfGp_getPlayer()->mCollisionRot.mY += 100;
break;
}
case 3: {
- tp_zelAudio.link_debug_ptr->facing += 10;
+ dComIfGp_getPlayer()->mCollisionRot.mY += 10;
break;
}
case 4: {
- tp_zelAudio.link_debug_ptr->facing += 1;
+ dComIfGp_getPlayer()->mCollisionRot.mY += 1;
break;
}
}
@@ -155,23 +157,23 @@ void render_info_input() {
if (button_is_pressed(Controller::DPAD_DOWN)) {
switch (cursor.x) {
case 0: {
- tp_zelAudio.link_debug_ptr->facing -= 10000;
+ dComIfGp_getPlayer()->mCollisionRot.mY -= 10000;
break;
}
case 1: {
- tp_zelAudio.link_debug_ptr->facing -= 1000;
+ dComIfGp_getPlayer()->mCollisionRot.mY -= 1000;
break;
}
case 2: {
- tp_zelAudio.link_debug_ptr->facing -= 100;
+ dComIfGp_getPlayer()->mCollisionRot.mY -= 100;
break;
}
case 3: {
- tp_zelAudio.link_debug_ptr->facing -= 10;
+ dComIfGp_getPlayer()->mCollisionRot.mY -= 10;
break;
}
case 4: {
- tp_zelAudio.link_debug_ptr->facing -= 1;
+ dComIfGp_getPlayer()->mCollisionRot.mY -= 1;
break;
}
}
@@ -206,44 +208,44 @@ void render_info_input() {
}
if (link_x_selected) {
- if (tp_zelAudio.link_debug_ptr->position.x <= -999998.99f) {
- tp_zelAudio.link_debug_ptr->position.x = -999998.99f;
- } else if (tp_zelAudio.link_debug_ptr->position.x >= 999998.99f) {
- tp_zelAudio.link_debug_ptr->position.x = 999998.99f;
+ if (dComIfGp_getPlayer()->mCurrent.mPosition.x <= -999998.99f) {
+ dComIfGp_getPlayer()->mCurrent.mPosition.x = -999998.99f;
+ } else if (dComIfGp_getPlayer()->mCurrent.mPosition.x >= 999998.99f) {
+ dComIfGp_getPlayer()->mCurrent.mPosition.x = 999998.99f;
}
cursor_x_max = 9;
if (button_is_pressed(Controller::DPAD_UP)) {
switch (cursor.x) {
case 0: {
- tp_zelAudio.link_debug_ptr->position.x += 100000.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.x += 100000.0f;
break;
}
case 1: {
- tp_zelAudio.link_debug_ptr->position.x += 10000.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.x += 10000.0f;
break;
}
case 2: {
- tp_zelAudio.link_debug_ptr->position.x += 1000.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.x += 1000.0f;
break;
}
case 3: {
- tp_zelAudio.link_debug_ptr->position.x += 100.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.x += 100.0f;
break;
}
case 4: {
- tp_zelAudio.link_debug_ptr->position.x += 10.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.x += 10.0f;
break;
}
case 5: {
- tp_zelAudio.link_debug_ptr->position.x += 1.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.x += 1.0f;
break;
}
case 7: {
- tp_zelAudio.link_debug_ptr->position.x += 0.10f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.x += 0.10f;
break;
}
case 8: {
- tp_zelAudio.link_debug_ptr->position.x += 0.01f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.x += 0.01f;
break;
}
}
@@ -251,35 +253,35 @@ void render_info_input() {
if (button_is_pressed(Controller::DPAD_DOWN)) {
switch (cursor.x) {
case 0: {
- tp_zelAudio.link_debug_ptr->position.x -= 100000.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.x -= 100000.0f;
break;
}
case 1: {
- tp_zelAudio.link_debug_ptr->position.x -= 10000.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.x -= 10000.0f;
break;
}
case 2: {
- tp_zelAudio.link_debug_ptr->position.x -= 1000.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.x -= 1000.0f;
break;
}
case 3: {
- tp_zelAudio.link_debug_ptr->position.x -= 100.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.x -= 100.0f;
break;
}
case 4: {
- tp_zelAudio.link_debug_ptr->position.x -= 10.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.x -= 10.0f;
break;
}
case 5: {
- tp_zelAudio.link_debug_ptr->position.x -= 1.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.x -= 1.0f;
break;
}
case 7: {
- tp_zelAudio.link_debug_ptr->position.x -= 0.10f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.x -= 0.10f;
break;
}
case 8: {
- tp_zelAudio.link_debug_ptr->position.x -= 0.01f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.x -= 0.01f;
break;
}
}
@@ -318,44 +320,44 @@ void render_info_input() {
}
if (link_y_selected) {
- if (tp_zelAudio.link_debug_ptr->position.y <= -999998.99f) {
- tp_zelAudio.link_debug_ptr->position.y = -999998.99f;
- } else if (tp_zelAudio.link_debug_ptr->position.y >= 999998.99f) {
- tp_zelAudio.link_debug_ptr->position.y = 999998.99f;
+ if (dComIfGp_getPlayer()->mCurrent.mPosition.y <= -999998.99f) {
+ dComIfGp_getPlayer()->mCurrent.mPosition.y = -999998.99f;
+ } else if (dComIfGp_getPlayer()->mCurrent.mPosition.y >= 999998.99f) {
+ dComIfGp_getPlayer()->mCurrent.mPosition.y = 999998.99f;
}
cursor_x_max = 9;
if (button_is_pressed(Controller::DPAD_UP)) {
switch (cursor.x) {
case 0: {
- tp_zelAudio.link_debug_ptr->position.y += 100000.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.y += 100000.0f;
break;
}
case 1: {
- tp_zelAudio.link_debug_ptr->position.y += 10000.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.y += 10000.0f;
break;
}
case 2: {
- tp_zelAudio.link_debug_ptr->position.y += 1000.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.y += 1000.0f;
break;
}
case 3: {
- tp_zelAudio.link_debug_ptr->position.y += 100.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.y += 100.0f;
break;
}
case 4: {
- tp_zelAudio.link_debug_ptr->position.y += 10.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.y += 10.0f;
break;
}
case 5: {
- tp_zelAudio.link_debug_ptr->position.y += 1.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.y += 1.0f;
break;
}
case 7: {
- tp_zelAudio.link_debug_ptr->position.y += 0.10f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.y += 0.10f;
break;
}
case 8: {
- tp_zelAudio.link_debug_ptr->position.y += 0.01f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.y += 0.01f;
break;
}
}
@@ -363,35 +365,35 @@ void render_info_input() {
if (button_is_pressed(Controller::DPAD_DOWN)) {
switch (cursor.x) {
case 0: {
- tp_zelAudio.link_debug_ptr->position.y -= 100000.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.y -= 100000.0f;
break;
}
case 1: {
- tp_zelAudio.link_debug_ptr->position.y -= 10000.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.y -= 10000.0f;
break;
}
case 2: {
- tp_zelAudio.link_debug_ptr->position.y -= 1000.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.y -= 1000.0f;
break;
}
case 3: {
- tp_zelAudio.link_debug_ptr->position.y -= 100.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.y -= 100.0f;
break;
}
case 4: {
- tp_zelAudio.link_debug_ptr->position.y -= 10.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.y -= 10.0f;
break;
}
case 5: {
- tp_zelAudio.link_debug_ptr->position.y -= 1.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.y -= 1.0f;
break;
}
case 7: {
- tp_zelAudio.link_debug_ptr->position.y -= 0.10f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.y -= 0.10f;
break;
}
case 8: {
- tp_zelAudio.link_debug_ptr->position.y -= 0.01f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.y -= 0.01f;
break;
}
}
@@ -430,44 +432,44 @@ void render_info_input() {
}
if (link_z_selected) {
- if (tp_zelAudio.link_debug_ptr->position.z <= -999998.99f) {
- tp_zelAudio.link_debug_ptr->position.z = -999998.99f;
- } else if (tp_zelAudio.link_debug_ptr->position.z >= 999998.99f) {
- tp_zelAudio.link_debug_ptr->position.z = 999998.99f;
+ if (dComIfGp_getPlayer()->mCurrent.mPosition.z <= -999998.99f) {
+ dComIfGp_getPlayer()->mCurrent.mPosition.z = -999998.99f;
+ } else if (dComIfGp_getPlayer()->mCurrent.mPosition.z >= 999998.99f) {
+ dComIfGp_getPlayer()->mCurrent.mPosition.z = 999998.99f;
}
cursor_x_max = 9;
if (button_is_pressed(Controller::DPAD_UP)) {
switch (cursor.x) {
case 0: {
- tp_zelAudio.link_debug_ptr->position.z += 100000.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.z += 100000.0f;
break;
}
case 1: {
- tp_zelAudio.link_debug_ptr->position.z += 10000.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.z += 10000.0f;
break;
}
case 2: {
- tp_zelAudio.link_debug_ptr->position.z += 1000.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.z += 1000.0f;
break;
}
case 3: {
- tp_zelAudio.link_debug_ptr->position.z += 100.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.z += 100.0f;
break;
}
case 4: {
- tp_zelAudio.link_debug_ptr->position.z += 10.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.z += 10.0f;
break;
}
case 5: {
- tp_zelAudio.link_debug_ptr->position.z += 1.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.z += 1.0f;
break;
}
case 7: {
- tp_zelAudio.link_debug_ptr->position.z += 0.10f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.z += 0.10f;
break;
}
case 8: {
- tp_zelAudio.link_debug_ptr->position.z += 0.01f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.z += 0.01f;
break;
}
}
@@ -475,35 +477,35 @@ void render_info_input() {
if (button_is_pressed(Controller::DPAD_DOWN)) {
switch (cursor.x) {
case 0: {
- tp_zelAudio.link_debug_ptr->position.z -= 100000.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.z -= 100000.0f;
break;
}
case 1: {
- tp_zelAudio.link_debug_ptr->position.z -= 10000.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.z -= 10000.0f;
break;
}
case 2: {
- tp_zelAudio.link_debug_ptr->position.z -= 1000.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.z -= 1000.0f;
break;
}
case 3: {
- tp_zelAudio.link_debug_ptr->position.z -= 100.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.z -= 100.0f;
break;
}
case 4: {
- tp_zelAudio.link_debug_ptr->position.z -= 10.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.z -= 10.0f;
break;
}
case 5: {
- tp_zelAudio.link_debug_ptr->position.z -= 1.0f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.z -= 1.0f;
break;
}
case 7: {
- tp_zelAudio.link_debug_ptr->position.z -= 0.10f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.z -= 0.10f;
break;
}
case 8: {
- tp_zelAudio.link_debug_ptr->position.z -= 0.01f;
+ dComIfGp_getPlayer()->mCurrent.mPosition.z -= 0.01f;
break;
}
}
diff --git a/src/rollcheck.cpp b/src/rollcheck.cpp
index 494ece6..85ae228 100644
--- a/src/rollcheck.cpp
+++ b/src/rollcheck.cpp
@@ -1,9 +1,10 @@
#include "rollcheck.h"
#include "controller.h"
#include "fifo_queue.h"
-#include "libtp_c/include/controller.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
+#include "libtp_c/include/msl_c/string.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "libtp_c/include/SSystem/SComponent/c_counter.h"
#define ROLL_FRAMES 19
@@ -20,23 +21,23 @@ uint16_t action_id = 0x0000;
void run() {
// if normal human link gameplay
- if (tp_gameInfo.freeze_game == 0 && tp_gameInfo.link.is_wolf == false) {
- current_counter = TP::get_frame_count();
- if (tp_zelAudio.link_debug_ptr) {
- action_id = tp_zelAudio.link_debug_ptr->current_action_id;
+ if (dComIfGp_getEvent().mHalt == false && dComIfGs_getTransformStatus() == STATUS_HUMAN) {
+ current_counter = cCt_getFrameCount();
+ if (dComIfGp_getPlayer()) {
+ action_id = dComIfGp_getPlayer()->mActionID;
}
if (start_counter) {
counter_difference += current_counter - previous_counter;
previous_counter = current_counter;
- if (counter_difference > 24 && action_id != 14) {
+ if (counter_difference > 24 && action_id != daAlink_c::FRONT_ROLL) {
counter_difference = 0;
previous_counter = 0;
current_counter = 0;
missed_counter = 0;
start_counter = false;
- } else if (counter_difference > 19 && action_id != 14) {
+ } else if (counter_difference > 19 && action_id != daAlink_c::FRONT_ROLL) {
missed_pressed_a = false;
missed_counter = counter_difference - 19;
}
@@ -47,7 +48,7 @@ void run() {
tp_sprintf(buf, "inputs: %d", Controller::get_current_inputs());
tp_sprintf(buf, "action: %d", action_id);
- if (action_id == 14) {
+ if (action_id == daAlink_c::FRONT_ROLL) {
if (counter_difference > 20) {
counter_difference = 1;
}
diff --git a/src/save_manager.cpp b/src/save_manager.cpp
index 87fb0c1..9123394 100644
--- a/src/save_manager.cpp
+++ b/src/save_manager.cpp
@@ -1,14 +1,16 @@
#include "fs.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
-#include "libtp_c/include/gc/OSCache.h"
+#include "libtp_c/include/msl_c/string.h"
+#include "libtp_c/include/dolphin/os/OSCache.h"
#include "menus/settings_menu.h"
#include "menus/practice_menu.h"
#include "save_manager.h"
#include "menu.h"
#include "utils/loading.h"
#include "fifo_queue.h"
+#include "utils/card.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "libtp_c/include/f_op/f_op_scene_req.h"
int apply_after_counter = 0;
int injection_counter = 0;
@@ -16,51 +18,60 @@ char currentFileName[80];
SaveManager gSaveManager;
void SaveManager::inject_save(void* buffer) {
- tp_memcpy((void*)&tp_gameInfo, buffer, 2392);
- tp_getSave(&tp_gameInfo, tp_gameInfo.dungeon_temp_flags.mStageNum);
+ tp_memcpy((void*)&g_dComIfG_gameInfo, buffer, 2392);
+ dComIfGs_getSave(g_dComIfG_gameInfo.mInfo.mDan.mStageNo);
};
void SaveManager::inject_memfile(void* buffer) {
- tp_memcpy((void*)&tp_gameInfo, buffer, 3818);
- tp_getSave(&tp_gameInfo, tp_gameInfo.dungeon_temp_flags.mStageNum);
+ tp_memcpy((void*)&g_dComIfG_gameInfo, buffer, 3818);
+ dComIfGs_getSave(g_dComIfG_gameInfo.mInfo.mDan.mStageNo);
};
void SaveManager::inject_default_before() {
- tp_gameInfo.spawn_speed = 0.0f;
- tp_gameInfo.loading_animation = 13; // instant load
- tp_gameInfo.respawn_animation = 0;
- tp_gameInfo.warp.entrance.void_flag = 0;
+ g_dComIfG_gameInfo.mInfo.mRestart.mLastSpeedF = 0.0f;
+ g_dComIfG_gameInfo.play.mNextStage.wipe = 13; // instant load
+ g_dComIfG_gameInfo.mInfo.mRestart.mLastMode = 0;
+ g_dComIfG_gameInfo.play.mNextStage.mPoint = 0;
}
void SaveManager::inject_default_during() {
// Load the save file over game info
- SaveManager::load_save_file(currentFileName);
+ if (!inject_memfile_flag) {
+ SaveManager::load_save_file(currentFileName);
+ } else {
+ SaveManager::inject_memfile((void*)sTmpBuf);
+ }
// Get default state based on file info
- int state = tp_getLayerNo((char*)tp_gameInfo.player.player_stage,
- tp_gameInfo.player.player_room_id, 0xFF);
+ int state =
+ tp_getLayerNo((char*)g_dComIfG_gameInfo.mInfo.getPlayer().player_return.mCurrentStage,
+ g_dComIfG_gameInfo.mInfo.getPlayer().player_return.mRoomId, 0xFF);
// Next stage info
- tp_gameInfo.special_spawn_id = tp_gameInfo.player.player_spawn_id;
- tp_gameInfo.warp.entrance.room = tp_gameInfo.player.player_room_id;
- tp_gameInfo.warp.entrance.spawn = tp_gameInfo.player.player_spawn_id;
- tp_strcpy((char*)tp_gameInfo.warp.entrance.stage, (char*)tp_gameInfo.player.player_stage);
- tp_gameInfo.warp.entrance.state = state;
+ g_dComIfG_gameInfo.mInfo.mRestart.mStartPoint =
+ g_dComIfG_gameInfo.mInfo.getPlayer().player_return.mSpawnId;
+ g_dComIfG_gameInfo.play.mNextStage.mRoomNo =
+ g_dComIfG_gameInfo.mInfo.getPlayer().player_return.mRoomId;
+ g_dComIfG_gameInfo.play.mNextStage.mPoint =
+ g_dComIfG_gameInfo.mInfo.getPlayer().player_return.mSpawnId;
+ tp_strcpy((char*)g_dComIfG_gameInfo.play.mNextStage.mStage,
+ (char*)g_dComIfG_gameInfo.mInfo.getPlayer().player_return.mCurrentStage);
+ g_dComIfG_gameInfo.play.mNextStage.mLayer = state;
// fixes some bug causing link to auto drown, figure out later
- tp_gameInfo.link_air_meter = 600;
- tp_gameInfo.link_air_meter_2 = 600;
- tp_gameInfo.link_max_air_meter = 600;
+ dComIfGs_setOxygen(600);
+ dComIfGs_setNowOxygen(600);
+ dComIfGs_setMaxOxygen(600);
#ifdef GCN_PLATFORM
if (g_swap_equips_flag) {
- uint8_t tmp = tp_gameInfo.link.item_on_x;
- uint8_t tmp_mix = tp_gameInfo.link.slot_x_combo_item;
+ uint8_t tmp = dComIfGs_getSelectItemIndex(SELECT_ITEM_X);
+ uint8_t tmp_mix = dComIfGs_getMixItemIndex(MIX_ITEM_X);
- tp_gameInfo.link.item_on_x = tp_gameInfo.link.item_on_y;
- tp_gameInfo.link.item_on_y = tmp;
- tp_gameInfo.link.slot_x_combo_item = tp_gameInfo.link.slot_y_combo_item;
- tp_gameInfo.link.slot_y_combo_item = tmp_mix;
+ dComIfGs_setSelectItemIndex(SELECT_ITEM_X, dComIfGs_getSelectItemIndex(SELECT_ITEM_Y));
+ dComIfGs_setSelectItemIndex(SELECT_ITEM_Y, tmp);
+ dComIfGs_setMixItemIndex(MIX_ITEM_X, dComIfGs_getMixItemIndex(MIX_ITEM_Y));
+ dComIfGs_setMixItemIndex(MIX_ITEM_Y, tmp_mix);
}
#endif
// add wii swap equip logic here later
@@ -137,20 +148,20 @@ void SaveManager::trigger_load() {
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
- gc::os_cache::DCFlushRange((void*)(0x800CCE08), sizeof(uint32_t));
- gc::os_cache::ICInvalidateRange((void*)(0x800CCE08), sizeof(uint32_t));
+ DCFlushRange((void*)(0x800CCE08), sizeof(uint32_t));
+ ICInvalidateRange((void*)(0x800CCE08), sizeof(uint32_t));
// Trigger loading
- tp_gameInfo.warp.enabled = true;
+ g_dComIfG_gameInfo.play.mNextStage.enabled = true;
}
// Loading has started, run the during load function
- if (tp_fopScnRq.isLoading && tp_gameInfo.warp.enabled) {
+ if (tp_fopScnRq.isLoading && g_dComIfG_gameInfo.play.mNextStage.enabled) {
if (gSaveManager.mPracticeFileOpts.inject_options_during_load) {
gSaveManager.mPracticeFileOpts.inject_options_during_load();
}
gSaveManager.loading_initiated = true;
- tp_gameInfo.warp.enabled = false;
+ g_dComIfG_gameInfo.play.mNextStage.enabled = false;
}
if (gSaveManager.loading_initiated) {
@@ -159,8 +170,8 @@ void SaveManager::trigger_load() {
// Patch back in setWaterDropColor call
*reinterpret_cast<uint32_t*>(0x800CCE08) =
0x4BFFF55D; // bl daAlink_c::setWaterDropColor
- gc::os_cache::DCFlushRange((void*)(0x800CCE08), sizeof(uint32_t));
- gc::os_cache::ICInvalidateRange((void*)(0x800CCE08), sizeof(uint32_t));
+ DCFlushRange((void*)(0x800CCE08), sizeof(uint32_t));
+ ICInvalidateRange((void*)(0x800CCE08), sizeof(uint32_t));
if (gSaveManager.mPracticeFileOpts.inject_options_after_load) {
gSaveManager.mPracticeFileOpts.inject_options_after_load();
@@ -174,6 +185,7 @@ void SaveManager::trigger_load() {
gSaveManager.loading_initiated = false;
inject_save_flag = false;
+ inject_memfile_flag = false;
} else {
apply_after_counter++;
}
diff --git a/src/system.cpp b/src/system.cpp
index c1cbbc0..e51393d 100644
--- a/src/system.cpp
+++ b/src/system.cpp
@@ -1,6 +1,6 @@
+#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "system.h"
-#include "libtp_c/include/draw.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/d/meter/d_meter_HIO.h"
namespace System {
bool camera_run_once;
@@ -8,24 +8,24 @@ bool hud_run_once;
void lock_camera() {
camera_run_once = true;
- tp_gameInfo.lock_camera = true;
+ dComIfGp_getEventManager().mCameraPlay = 1;
}
void unlock_camera() {
if (camera_run_once) {
- tp_gameInfo.lock_camera = false;
+ dComIfGp_getEventManager().mCameraPlay = 0;
camera_run_once = false;
}
}
void hide_hud() {
- tp_draw.hud = 0xFFFF;
+ g_drawHIO.hud = 0xFFFF;
hud_run_once = true;
}
void show_hud() {
if (hud_run_once) {
- tp_draw.hud = 0x3F80;
+ g_drawHIO.hud = 0x3F80;
hud_run_once = false;
}
}
diff --git a/src/time.cpp b/src/time.cpp
index ac6cfd7..2fa9998 100644
--- a/src/time.cpp
+++ b/src/time.cpp
@@ -1,11 +1,11 @@
#include "time.h"
-#include "libtp_c/include/time.h"
+#include "libtp_c/include/d/d_stage.h"
#include "menus/scene_menu.h"
namespace Utilities {
void freeze_time() {
if (&SceneItems[Scene::FREEZE_TIME_INDEX].active) {
- tp_setTimePass(0);
+ dStage_roomControl_c__setTimePass(TIME_STOP);
} else {
return;
}
diff --git a/src/timer.cpp b/src/timer.cpp
index 32008be..3cb1fa4 100644
--- a/src/timer.cpp
+++ b/src/timer.cpp
@@ -1,10 +1,11 @@
#include "timer.h"
#include "font.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/msl_c/string.h"
#include "menus/position_settings_menu.h"
#include "menus/settings_menu.h"
#include "menus/tools_menu.h"
+#include "libtp_c/include/SSystem/SComponent/c_counter.h"
+#include "libtp_c/include/f_op/f_op_scene_req.h"
#define FRAME_RATE 29.97
@@ -33,7 +34,7 @@ static double igt_timer_seconds = 0.0f;
static char igt_timer[16];
void render() {
- current_frame = TP::get_frame_count();
+ current_frame = cCt_getFrameCount();
if (ToolItems[Tools::TIMER_INDEX].active) {
if (timer_started) {
diff --git a/src/utils/audio.cpp b/src/utils/audio.cpp
index b77a304..0571a9b 100644
--- a/src/utils/audio.cpp
+++ b/src/utils/audio.cpp
@@ -1,5 +1,5 @@
#include "utils/audio.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/m_Do/m_Do_audio.h"
namespace Utilities {
void enable_bg_music() {
diff --git a/src/utils/card.cpp b/src/utils/card.cpp
index a0e8554..cf1c0f0 100644
--- a/src/utils/card.cpp
+++ b/src/utils/card.cpp
@@ -2,14 +2,18 @@
#include "commands.h"
#include "fifo_queue.h"
#include "utils/loading.h"
-#include "libtp_c/include/math.h"
-#include "libtp_c/include/system.h"
+#include "libtp_c/include/msl_c/math.h"
+#include "libtp_c/include/msl_c/string.h"
+#include "libtp_c/include/m_Do/m_Do_printf.h"
#include "menus/practice_menu.h"
-
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "libtp_c/include/f_op/f_op_draw_tag.h"
+#include "libtp_c/include/SSystem/SComponent/c_counter.h"
#include "menus/memfiles_menu.h"
#include "save_manager.h"
+bool inject_memfile_flag = false;
+
namespace Utilities {
/**
* @brief Like CARDWrite, but allows for arbitrary sizes and offsets.
@@ -212,10 +216,10 @@ void store_mem_card(Card& card) {
void store_memfile(Card& card) {
#ifndef WII_PLATFORM
PositionData posData;
- posData.link = tp_zelAudio.link_debug_ptr->position;
+ posData.link = dComIfGp_getPlayer()->mCurrent.mPosition;
posData.cam.target = tp_matrixInfo.matrix_info->target;
posData.cam.pos = tp_matrixInfo.matrix_info->pos;
- posData.angle = tp_zelAudio.link_debug_ptr->facing;
+ posData.angle = dComIfGp_getPlayer()->mCollisionRot.mY;
uint32_t file_size =
(uint32_t)(tp_ceil((double)3818 / (double)card.sector_size) * card.sector_size);
card.card_result = CARDDelete(0, card.file_name_buffer);
@@ -223,16 +227,15 @@ void store_memfile(Card& card) {
if (card.card_result == Ready || card.card_result == Exist) {
card.card_result = CARDOpen(0, card.file_name_buffer, &card.card_info);
if (card.card_result == Ready) {
- for (uint8_t i = 0; i < 0x20; i++) {
- *((tp_gameInfo.overworld_flags.ordon_flags.flags +
- (tp_gameInfo.dungeon_temp_flags.mStageNum * 0x20)) +
- i) = tp_gameInfo.temp_flags.flags[i];
- }
- tp_gameInfo.player.player_spawn_id = 0;
- tp_gameInfo.player.player_room_id = tp_gameInfo.last_room_id;
- tp_strcpy((char*)tp_gameInfo.player.player_stage, (char*)tp_gameInfo.current_stage);
- card.card_result =
- Utilities::card_write(&card.card_info, &tp_gameInfo, 3818, 0, card.sector_size);
+ dComIfGs_putSave(g_dComIfG_gameInfo.mInfo.mDan.mStageNo);
+
+ g_dComIfG_gameInfo.mInfo.getPlayer().player_return.mSpawnId = 0;
+ g_dComIfG_gameInfo.mInfo.getPlayer().player_return.mRoomId =
+ g_dComIfG_gameInfo.play.mEvtManager.field_0x1b0 & 0xFF;
+ tp_strcpy((char*)g_dComIfG_gameInfo.mInfo.getPlayer().player_return.mCurrentStage,
+ (char*)g_dComIfG_gameInfo.play.mStartStage.mStage);
+ card.card_result = Utilities::card_write(&card.card_info, &g_dComIfG_gameInfo, 3818, 0,
+ card.sector_size);
card.card_result = Utilities::card_write(&card.card_info, &posData, sizeof(posData),
3819, card.sector_size);
@@ -313,6 +316,7 @@ void load_memfile(Card& card) {
if (card.card_result == Ready) {
tp_osReport("loaded memfile!");
FIFOQueue::push("loaded memfile!", Queue);
+ inject_memfile_flag = true;
SaveManager::inject_default_before();
SaveManager::inject_memfile((void*)sTmpBuf);
SaveManager::inject_default_during();
@@ -334,7 +338,7 @@ void load_memfile(Card& card) {
}
void load_gz_card(bool& card_load) {
- uint8_t frame_count = TP::get_frame_count();
+ uint8_t frame_count = cCt_getFrameCount();
if (card_load && frame_count > 200) {
static Card card;
card.file_name = "tpgz01";
diff --git a/src/utils/disc.cpp b/src/utils/disc.cpp
index f9ddac9..b795cb8 100644
--- a/src/utils/disc.cpp
+++ b/src/utils/disc.cpp
@@ -1,6 +1,6 @@
#include "utils/disc.h"
-#include "libtp_c/include/math.h"
-#include "libtp_c/include/system.h"
+#include "libtp_c/include/msl_c/math.h"
+#include "libtp_c/include/msl_c/string.h"
#ifdef __cplusplus
extern "C" {
diff --git a/src/utils/draw.cpp b/src/utils/draw.cpp
index ef40823..ebe3e0e 100644
--- a/src/utils/draw.cpp
+++ b/src/utils/draw.cpp
@@ -1,6 +1,7 @@
#include "utils/draw.h"
#include "libtp_c/include/addrs.h"
-#include "libtp_c/include/system.h"
+#include "libtp_c/include/msl_c/string.h"
+#include "libtp_c/include/m_Do/m_Do_printf.h"
#include "gcn_c/include/gfx.h"
#include "utils/texture.h"
diff --git a/src/utils/hook.cpp b/src/utils/hook.cpp
index d07d4cd..38f46c3 100644
--- a/src/utils/hook.cpp
+++ b/src/utils/hook.cpp
@@ -4,6 +4,11 @@
#include "lib.h"
#include "libtp_c/include/addrs.h"
#include "libtp_c/include/patch.h"
+#include "flaglog.h"
+#include "fifo_queue.h"
+#include "libtp_c/include/msl_c/string.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "utils/card.h"
#include "movelink.h"
#define HOOK_DEF(rettype, name, params) \
@@ -32,6 +37,11 @@ HOOK_DEF(uint32_t, checkCastleTownUseItem, (uint16_t));
HOOK_DEF(uint32_t, query042, (void*, void*, int));
HOOK_DEF(void*, cc_at_check, (void*, int*));
+HOOK_DEF(void, onEventBit, (void*, uint16_t));
+HOOK_DEF(void, offEventBit, (void*, uint16_t));
+HOOK_DEF(void, onSwitch, (void*, int, int));
+HOOK_DEF(void, putSave, (void*, int));
+
struct {
uint32_t a[2];
} trampolines[HOOK_AMNT];
@@ -92,6 +102,62 @@ uint32_t transformAnywhereHook(void* p1, void* p2, int p3) {
}
}
+static char buf[40];
+void onEventBitHook(void* addr, uint16_t pFlag) {
+ if (g_flag_log_active) {
+ if (addr == &g_dComIfG_gameInfo.mInfo.mTmp) {
+ tp_sprintf(buf, "%s[0x%X] : %X | ON", "Event Tmp", pFlag >> 8, pFlag & 0xFF);
+ } else {
+ tp_sprintf(buf, "%s[0x%X] : %X | ON", "Event", pFlag >> 8, pFlag & 0xFF);
+ }
+ FIFOQueue::push(buf, Queue, 0xFFFFFF00);
+ }
+
+ return onEventBitTrampoline(addr, pFlag);
+}
+
+void offEventBitHook(void* addr, uint16_t pFlag) {
+ if (g_flag_log_active) {
+ if (addr == &g_dComIfG_gameInfo.mInfo.mTmp) {
+ tp_sprintf(buf, "%s[0x%X] : %X | OFF", "Event Tmp", pFlag >> 8, pFlag & 0xFF);
+ } else {
+ tp_sprintf(buf, "%s[0x%X] : %X | OFF", "Event", pFlag >> 8, pFlag & 0xFF);
+ }
+ FIFOQueue::push(buf, Queue, 0xFFFFFF00);
+ }
+
+ return offEventBitTrampoline(addr, pFlag);
+}
+
+void onSwitchHook(void* addr, int pFlag, int i_roomNo) {
+ int tmp = pFlag;
+ if (g_flag_log_active) {
+ if (pFlag < 0x80) {
+ tp_sprintf(buf, "%s[%d] : %d | ON", "Memory Switch", tmp >> 5, tmp & 0x1F);
+ } else if (pFlag < 0xC0) {
+ tmp -= 0x80;
+ tp_sprintf(buf, "%s[%d] : %d | ON", "Dan Switch", tmp >> 5, tmp & 0x1F);
+ } else if (pFlag < 0xE0) {
+ tmp -= 0xC0;
+ tp_sprintf(buf, "%s[%d] : %d | ON", "Zone Switch", tmp >> 5, tmp & 0x1F);
+ } else {
+ tmp -= 0xE0;
+ tp_sprintf(buf, "%s[%d] : %d | ON", "Zone OneSwitch", tmp >> 5, tmp & 0x1F);
+ }
+ FIFOQueue::push(buf, Queue, 0xFFFFFF00);
+ }
+ return onSwitchTrampoline(addr, pFlag, i_roomNo);
+}
+
+// Stops temp flags from being stored to save when loading memfile
+void putSaveHook(void* addr, int stageNo) {
+ if (inject_memfile_flag) {
+ return;
+ } else {
+ return putSaveTrampoline(addr, stageNo);
+ }
+}
+
void apply_hooks() {
#define APPLY_HOOK(name, addr, idx, func) \
name##Trampoline = hookFunction((tp_##name##_t)addr, trampolines[idx].a, func)
@@ -106,6 +172,12 @@ void apply_hooks() {
APPLY_HOOK(checkCastleTownUseItem, tp_checkCastleTownUseItem_addr, HK_UNRESTRICTED_ITEMS_INDEX,
unrestrictedItemsHook);
APPLY_HOOK(query042, tp_query042_addr, HK_TRANSFORM_ANYWHERE_INDEX, transformAnywhereHook);
+
+ APPLY_HOOK(onSwitch, dSv_info_c__onSwitch_addr, HK_ONSWITCH_INDEX, onSwitchHook);
+ APPLY_HOOK(onEventBit, dSv_event_c__onEventBit_addr, HK_ONEVENTBIT_INDEX, onEventBitHook);
+ APPLY_HOOK(offEventBit, dSv_event_c__offEventBit_addr, HK_OFFEVENTBIT_INDEX, offEventBitHook);
+ APPLY_HOOK(putSave, tp_putSave_addr, HK_PUTSAVE_INDEX, putSaveHook);
+
#undef APPLY_HOOK
}
} // namespace Hook \ No newline at end of file
diff --git a/src/utils/lines.cpp b/src/utils/lines.cpp
index e0e158f..0ff9fb0 100644
--- a/src/utils/lines.cpp
+++ b/src/utils/lines.cpp
@@ -1,6 +1,6 @@
#include "utils/lines.h"
-#include "libtp_c/include/math.h"
-#include "libtp_c/include/system.h"
+#include "libtp_c/include/msl_c/math.h"
+#include "libtp_c/include/msl_c/string.h"
#include "menus/position_settings_menu.h"
#include "menus/settings_menu.h"
#include "utils/draw.h"
diff --git a/src/utils/link.cpp b/src/utils/link.cpp
index 015121b..db55918 100644
--- a/src/utils/link.cpp
+++ b/src/utils/link.cpp
@@ -1,9 +1,9 @@
#include "utils/link.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/msl_c/string.h"
#include "menus/position_settings_menu.h"
#include "menus/settings_menu.h"
#include "menus/tools_menu.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
uint8_t red;
uint8_t green;
@@ -11,7 +11,7 @@ uint8_t blue;
namespace Utilities {
void show_link_debug_info() {
- if (tp_zelAudio.link_debug_ptr) {
+ if (dComIfGp_getPlayer()) {
char link_angle[20];
// char vspeed[4];
char link_speed[20];
@@ -19,11 +19,11 @@ void show_link_debug_info() {
char link_y[20];
char link_z[20];
- tp_sprintf(link_angle, "angle: %d", tp_zelAudio.link_debug_ptr->facing);
- tp_sprintf(link_speed, "speed: %.4f", tp_zelAudio.link_debug_ptr->speed);
- tp_sprintf(link_x, "x-pos: %.4f", tp_zelAudio.link_debug_ptr->position.x);
- tp_sprintf(link_y, "y-pos: %.4f", tp_zelAudio.link_debug_ptr->position.y);
- tp_sprintf(link_z, "z-pos: %.4f", tp_zelAudio.link_debug_ptr->position.z);
+ tp_sprintf(link_angle, "angle: %d", (uint16_t)dComIfGp_getPlayer()->mCollisionRot.mY);
+ tp_sprintf(link_speed, "speed: %.4f", dComIfGp_getPlayer()->mSpeedF);
+ tp_sprintf(link_x, "x-pos: %.4f", dComIfGp_getPlayer()->mCurrent.mPosition.x);
+ tp_sprintf(link_y, "y-pos: %.4f", dComIfGp_getPlayer()->mCurrent.mPosition.y);
+ tp_sprintf(link_z, "z-pos: %.4f", dComIfGp_getPlayer()->mCurrent.mPosition.z);
Font::gz_renderChars(link_angle, sprite_offsets[DEBUG_INFO_INDEX].x,
sprite_offsets[DEBUG_INFO_INDEX].y, 0xFFFFFFFF, g_drop_shadows);
@@ -57,7 +57,7 @@ void show_link_debug_info() {
}
}
void change_tunic_color() {
- if (tp_gameInfo.link_tunic_ptr) {
+ if (dComIfGp_getPlayer()) {
int16_t red_ = 0;
int16_t green_ = 0;
int16_t blue_ = 0;
@@ -120,20 +120,20 @@ void change_tunic_color() {
}
}
#ifdef GCN_PLATFORM
- tp_gameInfo.link_tunic_ptr->tunic_top_red = red_ - 0x10;
- tp_gameInfo.link_tunic_ptr->tunic_top_green = green_ - 0x10;
- tp_gameInfo.link_tunic_ptr->tunic_top_blue = blue_ - 0x10;
- tp_gameInfo.link_tunic_ptr->tunic_bottom_red = red_ - 0x10;
- tp_gameInfo.link_tunic_ptr->tunic_bottom_green = green_ - 0x10;
- tp_gameInfo.link_tunic_ptr->tunic_bottom_blue = blue_ - 0x10;
+ dComIfGp_getPlayer()->field_0x32a0[0].mColor.r = red_ - 0x10;
+ dComIfGp_getPlayer()->field_0x32a0[0].mColor.g = green_ - 0x10;
+ dComIfGp_getPlayer()->field_0x32a0[0].mColor.b = blue_ - 0x10;
+ dComIfGp_getPlayer()->field_0x32a0[1].mColor.r = red_ - 0x10;
+ dComIfGp_getPlayer()->field_0x32a0[1].mColor.g = green_ - 0x10;
+ dComIfGp_getPlayer()->field_0x32a0[1].mColor.b = blue_ - 0x10;
#endif
#ifdef WII_PLATFORM
- tp_gameInfo.link_tunic_ptr->tunic_top_red = red_ - 0x10;
- tp_gameInfo.link_tunic_ptr->tunic_top_green = green_ - 0x10;
- tp_gameInfo.link_tunic_ptr->tunic_top_blue = blue_ - 0x10;
- tp_gameInfo.link_tunic_ptr->tunic_bottom_red = red_ - 0x10;
- tp_gameInfo.link_tunic_ptr->tunic_bottom_green = green_ - 0x10;
- tp_gameInfo.link_tunic_ptr->tunic_bottom_blue = blue_ - 0x10;
+ dComIfGp_getPlayer()->field_0x32a0[0].mColor.r = red_ - 0x10;
+ dComIfGp_getPlayer()->field_0x32a0[0].mColor.g = green_ - 0x10;
+ dComIfGp_getPlayer()->field_0x32a0[0].mColor.b = blue_ - 0x10;
+ dComIfGp_getPlayer()->field_0x32a0[1].mColor.r = red_ - 0x10;
+ dComIfGp_getPlayer()->field_0x32a0[1].mColor.g = green_ - 0x10;
+ dComIfGp_getPlayer()->field_0x32a0[1].mColor.b = blue_ - 0x10;
// tp_gameInfo.link_tunic_ptr->not_tunic_red = 1;
// tp_gameInfo.link_tunic_ptr->tunic_red = red_ - 0x10;
// tp_gameInfo.link_tunic_ptr->tunic_green = green_ - 0x10;
diff --git a/src/utils/loading.cpp b/src/utils/loading.cpp
index 6da3fb8..9500fab 100644
--- a/src/utils/loading.cpp
+++ b/src/utils/loading.cpp
@@ -1,10 +1,12 @@
#include "utils/loading.h"
#include "fifo_queue.h"
#include "fs.h"
-#include "libtp_c/include/system.h"
-#include "libtp_c/include/tp.h"
+#include "libtp_c/include/msl_c/string.h"
#include "menus/practice_menu.h"
-
+#include "libtp_c/include/f_op/f_op_draw_tag.h"
+#include "libtp_c/include/m_Do/m_Do_audio.h"
+#include "libtp_c/include/d/com/d_com_inf_game.h"
+#include "libtp_c/include/m_Do/m_Do_printf.h"
#include "menus/any_saves_menu.h"
#include "save_manager.h"
@@ -13,15 +15,20 @@ namespace Utilities {
void set_camera_angle_position() {
tp_matrixInfo.matrix_info->target = gSaveManager.mPracticeSaveInfo.cam_target;
tp_matrixInfo.matrix_info->pos = gSaveManager.mPracticeSaveInfo.cam_pos;
- tp_zelAudio.link_debug_ptr->facing = gSaveManager.mPracticeSaveInfo.angle;
- tp_zelAudio.link_debug_ptr->position = gSaveManager.mPracticeSaveInfo.position;
+ dComIfGp_getPlayer()->mCollisionRot.mY = gSaveManager.mPracticeSaveInfo.angle;
+ cXyz tmp(gSaveManager.mPracticeSaveInfo.position.x, gSaveManager.mPracticeSaveInfo.position.y,
+ gSaveManager.mPracticeSaveInfo.position.z);
+ dComIfGp_getPlayer()->mCurrent.mPosition = tmp;
tp_osReport("%d", gSaveManager.mPracticeSaveInfo.angle);
tp_osReport("0x%08X", &gSaveManager.mPracticeSaveInfo.angle);
}
void set_angle_position() {
- tp_zelAudio.link_debug_ptr->facing = gSaveManager.mPracticeSaveInfo.angle;
- tp_zelAudio.link_debug_ptr->position = gSaveManager.mPracticeSaveInfo.position;
+ dComIfGp_getPlayer()->mCollisionRot.mY = gSaveManager.mPracticeSaveInfo.angle;
+
+ cXyz tmp(gSaveManager.mPracticeSaveInfo.position.x, gSaveManager.mPracticeSaveInfo.position.y,
+ gSaveManager.mPracticeSaveInfo.position.z);
+ dComIfGp_getPlayer()->mCurrent.mPosition = tmp;
}
} // namespace Utilities \ No newline at end of file
diff --git a/src/utils/memory.cpp b/src/utils/memory.cpp
index 6ca719e..f107355 100644
--- a/src/utils/memory.cpp
+++ b/src/utils/memory.cpp
@@ -1,5 +1,5 @@
#include "utils/memory.h"
-#include "libtp_c/include/system.h"
+#include "libtp_c/include/msl_c/string.h"
#include "menus/memory_menu.h"
#include "menus/settings_menu.h"
diff --git a/src/utils/texture.cpp b/src/utils/texture.cpp
index 45c6859..ff5c019 100644
--- a/src/utils/texture.cpp
+++ b/src/utils/texture.cpp
@@ -1,7 +1,7 @@
#include "utils/texture.h"
#include "libtp_c/include/addrs.h"
-#include "libtp_c/include/math.h"
-#include "libtp_c/include/system.h"
+#include "libtp_c/include/msl_c/math.h"
+#include "libtp_c/include/msl_c/string.h"
#include "utils/disc.h"
#include "gcn_c/include/dvd.h"
#include "gcn_c/include/gfx.h"