mirror of
https://github.com/Zelda64Recomp/Zelda64Recomp
synced 2026-07-01 12:19:12 -04:00
Add debug set time hook
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "../patches/input.h"
|
||||
|
||||
std::atomic<uint16_t> pending_warp = 0xFFFF;
|
||||
std::atomic<uint16_t> pending_set_time = 0xFFFF;
|
||||
|
||||
void recomp::do_warp(int area, int scene, int entrance) {
|
||||
const recomp::SceneWarps game_scene = recomp::game_warps[area].scenes[scene];
|
||||
@@ -15,3 +16,12 @@ extern "C" void recomp_get_pending_warp(uint8_t* rdram, recomp_context* ctx) {
|
||||
// Return the current warp value and reset it.
|
||||
_return(ctx, pending_warp.exchange(0xFFFF));
|
||||
}
|
||||
|
||||
void recomp::set_time(uint8_t hour, uint8_t minute) {
|
||||
pending_set_time.store((uint16_t(hour) << 8) | minute);
|
||||
}
|
||||
|
||||
extern "C" void recomp_get_pending_set_time(uint8_t* rdram, recomp_context* ctx) {
|
||||
// Return the current set time value and reset it.
|
||||
_return(ctx, pending_set_time.exchange(0xFFFF));
|
||||
}
|
||||
@@ -199,6 +199,8 @@ struct DebugContext {
|
||||
int area_index = 0;
|
||||
int scene_index = 0;
|
||||
int entrance_index = 0;
|
||||
uint8_t set_time_hour = 0;
|
||||
uint8_t set_time_minute = 0;
|
||||
bool debug_enabled = false;
|
||||
|
||||
DebugContext() {
|
||||
@@ -291,6 +293,11 @@ public:
|
||||
[](const std::string& param, Rml::Event& event) {
|
||||
recomp::do_warp(debug_context.area_index, debug_context.scene_index, debug_context.entrance_index);
|
||||
});
|
||||
|
||||
recomp::register_event(listener, "set_time",
|
||||
[](const std::string& param, Rml::Event& event) {
|
||||
recomp::set_time(debug_context.set_time_hour, debug_context.set_time_minute);
|
||||
});
|
||||
}
|
||||
|
||||
void bind_config_list_events(Rml::DataModelConstructor &constructor) {
|
||||
|
||||
Reference in New Issue
Block a user