From b21ebe75d412c72441be8a63c202641cc5ff4dfa Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Wed, 22 Nov 2017 11:18:36 -0800 Subject: Pause menu now triggered on ui.exit event --HG-- branch : nuklear_ui --- io.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'io.c') diff --git a/io.c b/io.c index 7b5d404..22881c1 100644 --- a/io.c +++ b/io.c @@ -23,6 +23,9 @@ #include "render.h" #include "util.h" #include "menu.h" +#ifndef DISABLE_NUKLEAR +#include "nuklear_ui/blastem_nuklear.h" +#endif #define CYCLE_NEVER 0xFFFFFFFF #define MIN_POLL_INTERVAL 6840 @@ -532,6 +535,11 @@ void handle_binding_up(keybinding * binding) break; } case UI_EXIT: +#ifndef DISABLE_NUKLEAR + if (is_nuklear_active) { + show_pause_menu(); + } else { +#endif current_system->request_exit(current_system); if (current_system->type == SYSTEM_GENESIS) { genesis_context *gen = (genesis_context *)current_system; @@ -541,6 +549,9 @@ void handle_binding_up(keybinding * binding) menu->external_game_load = 1; } } +#ifndef DISABLE_NUKLEAR + } +#endif break; } break; -- cgit v1.2.3 From 27b829ffc447758832cbd7ab2f9b7e427928d687 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Fri, 24 Nov 2017 12:04:02 -0800 Subject: Refactored save slot related logic to reduce duplication and allow reuse in new UI. Get state loading/saving mostly working in new UI --HG-- branch : nuklear_ui --- io.c | 1 + 1 file changed, 1 insertion(+) (limited to 'io.c') diff --git a/io.c b/io.c index 22881c1..8cdb249 100644 --- a/io.c +++ b/io.c @@ -23,6 +23,7 @@ #include "render.h" #include "util.h" #include "menu.h" +#include "saves.h" #ifndef DISABLE_NUKLEAR #include "nuklear_ui/blastem_nuklear.h" #endif -- cgit v1.2.3 From f4767bb05392fa4a04d72969fa35aa91b688c8cb Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sat, 25 Nov 2017 20:43:20 -0800 Subject: Skip loading menu ROM if Nuklear UI is enabled. Allow disabling Nuklear UI in favor of old menu ROM both at compile time and in config. Fall back to ROM UI if GL is unavailable --HG-- branch : nuklear_ui --- io.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'io.c') diff --git a/io.c b/io.c index 8cdb249..9207093 100644 --- a/io.c +++ b/io.c @@ -381,6 +381,9 @@ void handle_joydown(int joystick, int button) void handle_mousedown(int mouse, int button) { + if (!current_io) { + return; + } if (current_io->mouse_mode == MOUSE_CAPTURE && !current_io->mouse_captured) { current_io->mouse_captured = 1; render_relative_mouse(1); @@ -537,7 +540,7 @@ void handle_binding_up(keybinding * binding) } case UI_EXIT: #ifndef DISABLE_NUKLEAR - if (is_nuklear_active) { + if (is_nuklear_active()) { show_pause_menu(); } else { #endif -- cgit v1.2.3 From d064c9a6c6ea4aff356b5cde90f5afc92cb705f4 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sun, 26 Nov 2017 20:19:36 -0800 Subject: Don't crash when keys are pressed before ROM is loaded --HG-- branch : nuklear_ui --- io.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'io.c') diff --git a/io.c b/io.c index 9207093..24568d9 100644 --- a/io.c +++ b/io.c @@ -360,6 +360,9 @@ void store_key_event(uint16_t code) void handle_keydown(int keycode, uint8_t scancode) { + if (!current_io) { + return; + } int bucket = keycode >> 15 & 0xFFFF; int idx = keycode & 0x7FFF; keybinding * binding = bindings[bucket] ? bindings[bucket] + idx : NULL; @@ -564,6 +567,9 @@ void handle_binding_up(keybinding * binding) void handle_keyup(int keycode, uint8_t scancode) { + if (!current_io) { + return; + } int bucket = keycode >> 15 & 0xFFFF; int idx = keycode & 0x7FFF; keybinding * binding = bindings[bucket] ? bindings[bucket] + idx : NULL; -- cgit v1.2.3