added set time debug ui
This commit is contained in:
parent
50536bf737
commit
65ced0c594
|
@ -42,6 +42,63 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-debug-option">
|
||||
<label
|
||||
class="config-debug-option__label"
|
||||
>
|
||||
<div>Set time</div>
|
||||
</label>
|
||||
<div class="config-debug__option-split">
|
||||
<div class="config-debug__option-controls">
|
||||
<div class="config-option__range-wrapper config-debug__select-wrapper config-option__list">
|
||||
<div class="config-debug__select-label"><div>Day: {{debug_time_day}}</div></div>
|
||||
<input
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(1)"
|
||||
class="nav-vert"
|
||||
id="debug_time_set_day"
|
||||
type="range"
|
||||
data-value="debug_time_day"
|
||||
min="0"
|
||||
max="7"
|
||||
/>
|
||||
</div>
|
||||
<div class="config-option__range-wrapper config-debug__select-wrapper config-option__list">
|
||||
<div class="config-debug__select-label"><div>Hour: {{debug_time_hour}}</div></div>
|
||||
<input
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(1)"
|
||||
class="nav-vert"
|
||||
id="debug_time_set_hour"
|
||||
type="range"
|
||||
data-value="debug_time_hour"
|
||||
min="0"
|
||||
max="23"
|
||||
/>
|
||||
</div>
|
||||
<div class="config-option__range-wrapper config-debug__select-wrapper config-option__list">
|
||||
<div class="config-debug__select-label"><div>Minute: {{debug_time_minute}}</div></div>
|
||||
<input
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(1)"
|
||||
class="nav-vert"
|
||||
id="debug_time_set_minute"
|
||||
type="range"
|
||||
data-value="debug_time_minute"
|
||||
min="0"
|
||||
max="59"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-debug__option-trigger">
|
||||
<button
|
||||
class="icon-button icon-button--success" onclick="set_time"
|
||||
>
|
||||
<svg src="icons/Arrow.svg" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -101,6 +101,19 @@
|
|||
}
|
||||
}
|
||||
|
||||
input {
|
||||
@extend %body;
|
||||
@extend %nav-all;
|
||||
display: block;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
flex: 1 1 100%;
|
||||
width: auto;
|
||||
height: space(20);
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
select {
|
||||
@extend %body;
|
||||
@extend %nav-all;
|
||||
|
@ -117,6 +130,10 @@
|
|||
background-color: $color-white-a5;
|
||||
cursor: pointer;
|
||||
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
padding: space(14);
|
||||
|
||||
&:hover, &:focus {
|
||||
@include border($color-white-a80);
|
||||
background-color: $color-white-a20;
|
||||
|
@ -124,9 +141,6 @@
|
|||
|
||||
selectvalue {
|
||||
display: inline;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
padding: space(14);
|
||||
margin: auto 0;
|
||||
height: auto;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace recomp {
|
|||
extern std::vector<AreaWarps> game_warps;
|
||||
|
||||
void do_warp(int area, int scene, int entrance);
|
||||
void set_time(uint8_t hour, uint8_t minute);
|
||||
void set_time(uint8_t day, uint8_t hour, uint8_t minute);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -54,11 +54,13 @@ void debug_play_update(PlayState* play) {
|
|||
do_warp(play, pending_warp);
|
||||
}
|
||||
|
||||
u16 pending_set_time = recomp_get_pending_set_time();
|
||||
u32 pending_set_time = recomp_get_pending_set_time();
|
||||
if (pending_set_time != 0xFFFF) {
|
||||
u8 hour = (pending_set_time >> 8) & 0xFF;
|
||||
u8 minute = (pending_set_time >> 0) & 0xFF;
|
||||
u8 day = (pending_set_time >> 16) & 0xFF;
|
||||
u8 hour = (pending_set_time >> 8) & 0xFF;
|
||||
u8 minute = (pending_set_time >> 0) & 0xFF;
|
||||
|
||||
gSaveContext.save.time = CLOCK_TIME(hour, minute);
|
||||
gSaveContext.save.day = day;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,6 @@ DECLARE_FUNC(void, recomp_exit);
|
|||
DECLARE_FUNC(void, recomp_handle_quicksave_actions, OSMesgQueue* enter_mq, OSMesgQueue* exit_mq);
|
||||
DECLARE_FUNC(void, recomp_handle_quicksave_actions_main, OSMesgQueue* enter_mq, OSMesgQueue* exit_mq);
|
||||
DECLARE_FUNC(u16, recomp_get_pending_warp);
|
||||
DECLARE_FUNC(u16, recomp_get_pending_set_time);
|
||||
DECLARE_FUNC(u32, recomp_get_pending_set_time);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "../patches/input.h"
|
||||
|
||||
std::atomic<uint16_t> pending_warp = 0xFFFF;
|
||||
std::atomic<uint16_t> pending_set_time = 0xFFFF;
|
||||
std::atomic<uint32_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];
|
||||
|
@ -17,8 +17,8 @@ extern "C" void recomp_get_pending_warp(uint8_t* rdram, recomp_context* ctx) {
|
|||
_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);
|
||||
void recomp::set_time(uint8_t day, uint8_t hour, uint8_t minute) {
|
||||
pending_set_time.store((day << 16) | (uint16_t(hour) << 8) | minute);
|
||||
}
|
||||
|
||||
extern "C" void recomp_get_pending_set_time(uint8_t* rdram, recomp_context* ctx) {
|
||||
|
|
|
@ -199,8 +199,9 @@ 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;
|
||||
int set_time_day = 1;
|
||||
int set_time_hour = 12;
|
||||
int set_time_minute = 0;
|
||||
bool debug_enabled = false;
|
||||
|
||||
DebugContext() {
|
||||
|
@ -296,7 +297,7 @@ public:
|
|||
|
||||
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);
|
||||
recomp::set_time(debug_context.set_time_day, debug_context.set_time_hour, debug_context.set_time_minute);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -627,6 +628,10 @@ public:
|
|||
constructor.Bind("scene_names", &debug_context.scene_names);
|
||||
constructor.Bind("entrance_names", &debug_context.entrance_names);
|
||||
|
||||
constructor.Bind("debug_time_day", &debug_context.set_time_day);
|
||||
constructor.Bind("debug_time_hour", &debug_context.set_time_hour);
|
||||
constructor.Bind("debug_time_minute", &debug_context.set_time_minute);
|
||||
|
||||
debug_context.model_handle = constructor.GetModelHandle();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue