From 8aa8fb893a2258a27e77b2872c189a93dc427a2e Mon Sep 17 00:00:00 2001 From: Prakxo <87568477+Prakxo@users.noreply.github.com> Date: Sat, 12 Aug 2023 17:55:42 +0100 Subject: m_pause OK (#47) * m_pause OK * yeah now it's OK lol * refactor * refactor 2 --- src/code/m_pause.c | 22 ++++++++++++++++++++++ src/code/zurumode.c | 3 ++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/code/m_pause.c (limited to 'src/code') diff --git a/src/code/m_pause.c b/src/code/m_pause.c new file mode 100644 index 0000000..0b59856 --- /dev/null +++ b/src/code/m_pause.c @@ -0,0 +1,22 @@ +#include "m_pause.h" +#include "m_controller.h" +#include "libc/stdbool.h" + +void Pause_ct(Pause* pause) { + pause->timer = 0; + pause->enabled = 0; +} + +s32 Pause_proc(Pause* pause, Input* input) { + if (CHECK_BTN_ALL(input->cur.button, R_TRIG) && CHECK_BTN_ALL(input->press.button, D_JPAD)) { + pause->enabled = !pause->enabled; + } + + if ((!pause->enabled) || (CHECK_BTN_ALL(input->cur.button, Z_TRIG) && + (CHECK_BTN_ALL(input->press.button, R_TRIG) || + (CHECK_BTN_ALL(input->cur.button, R_TRIG) && (++pause->timer >= 9))))) { + pause->timer = 0; + return true; + } + return false; +} diff --git a/src/code/zurumode.c b/src/code/zurumode.c index 8c90d93..a67ea81 100644 --- a/src/code/zurumode.c +++ b/src/code/zurumode.c @@ -1,6 +1,7 @@ #include "zurumode.h" #include "m_nmi_buf.h" #include "padmgr.h" +#include "m_controller.h" zuruKeycheck zuruKeyCheck; @@ -185,7 +186,7 @@ void zurumode_callback(void* p) { zerucheck_init(&zuruKeyCheck); APPNMI_ZURUMODE_FLP(); zurumode_update(); - if ((mgr->pads[0].button) & 0x80) { + if (mgr->pads[0].button & RESET_BUTTON) { APPNMI_ZURUMODE3_FLP(); } } -- cgit v1.2.3