diff --git a/Cocoa/GBApp.m b/Cocoa/GBApp.m index 8c85c52..20efd63 100644 --- a/Cocoa/GBApp.m +++ b/Cocoa/GBApp.m @@ -634,6 +634,16 @@ static uint32_t color_to_int(NSColor *color) return ret; } +- (IBAction)openDebuggerHelp:(id)sender +{ + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://sameboy.github.io/debugger/"]]; +} + +- (IBAction)openSponsor:(id)sender +{ + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://github.com/sponsors/LIJI32"]]; +} + - (void)dealloc { if (_downloadDirectory) { diff --git a/Cocoa/MainMenu.xib b/Cocoa/MainMenu.xib index 386d2e2..66920d8 100644 --- a/Cocoa/MainMenu.xib +++ b/Cocoa/MainMenu.xib @@ -29,6 +29,12 @@ + + + + + + @@ -523,9 +529,10 @@ - + + - + diff --git a/SDL/font.c b/SDL/font.c index ea2c590..e3db34e 100644 --- a/SDL/font.c +++ b/SDL/font.c @@ -1119,6 +1119,16 @@ uint8_t font[] = { _, _, X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, + + /* Copyright symbol*/ + _, X, X, X, X, _, + X, _, _, _, _, X, + X, _, X, X, _, X, + X, _, X, _, _, X, + X, _, X, _, _, X, + X, _, X, X, _, X, + X, _, _, _, _, X, + _, X, X, X, X, _, }; const uint8_t font_max = sizeof(font) / GLYPH_HEIGHT / GLYPH_WIDTH + ' '; diff --git a/SDL/font.h b/SDL/font.h index e7f8e2a..a6d331e 100644 --- a/SDL/font.h +++ b/SDL/font.h @@ -16,5 +16,6 @@ extern const uint8_t font_max; #define MOJIBAKE_STRING "\x88" #define SLIDER_STRING "\x89\x8A\x8A\x8A\x8A\x8A\x8A\x8A\x8A\x8A\x8F\x8A\x8A\x8A\x8A\x8A\x8A\x8A\x8A\x8A\x8B" #define SELECTED_SLIDER_STRING "\x8C\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8E" +#define COPYRIGHT_STRING "\x90" #endif /* font_h */ diff --git a/SDL/gui.c b/SDL/gui.c index befea12..25aea2e 100644 --- a/SDL/gui.c +++ b/SDL/gui.c @@ -91,7 +91,15 @@ static const char *help[] = { #else " Mute/Unmute: " MODIFIER_NAME "+M\n" #endif -" Break Debugger: " CTRL_STRING "+C" +" Break Debugger: " CTRL_STRING "+C", +"\n" +"SameBoy\n" +"Version " GB_VERSION "\n\n" +"Copyright " COPYRIGHT_STRING " 2015-2022\n" +"Lior Halphon\n\n" +"Licensed under the MIT\n" +"license, see LICENSE for\n" +"more details." }; void update_viewport(void) @@ -271,12 +279,19 @@ static void item_help(unsigned index) gui_state = SHOWING_HELP; } +static void about(unsigned index) +{ + current_help_page = 1; + gui_state = SHOWING_HELP; +} + static void enter_emulation_menu(unsigned index); static void enter_graphics_menu(unsigned index); static void enter_keyboard_menu(unsigned index); static void enter_joypad_menu(unsigned index); static void enter_audio_menu(unsigned index); static void enter_controls_menu(unsigned index); +static void enter_help_menu(unsigned index); static void toggle_audio_recording(unsigned index); extern void set_filename(const char *new_filename, typeof(free) *new_free_function); @@ -308,6 +323,15 @@ static void recalculate_menu_height(void) static char audio_recording_menu_item[] = "Start Audio Recording"; +static void sponsor(unsigned index) +{ + SDL_OpenURL("https://github.com/sponsors/LIJI32"); +} + +static void debugger_help(unsigned index) +{ + SDL_OpenURL("https://sameboy.github.io/debugger/"); +} static const struct menu_item paused_menu[] = { {"Resume", NULL}, {"Open ROM", open_rom}, @@ -316,7 +340,8 @@ static const struct menu_item paused_menu[] = { {"Audio Options", enter_audio_menu}, {"Control Options", enter_controls_menu}, {audio_recording_menu_item, toggle_audio_recording}, - {"Help", item_help}, + {"Help & About", enter_help_menu}, + {"Sponsor SameBoy", sponsor}, {"Quit SameBoy", item_exit}, {NULL,} }; @@ -331,6 +356,23 @@ static void return_to_root_menu(unsigned index) recalculate_menu_height(); } +static const struct menu_item help_menu[] = { + {"Shortcuts", item_help}, + {"Debugger Help", debugger_help}, + {"About SameBoy", about}, + {"Back", return_to_root_menu}, + {NULL,} +}; + +static void enter_help_menu(unsigned index) +{ + current_menu = help_menu; + current_selection = 0; + scroll = 0; + recalculate_menu_height(); +} + + static void cycle_model(unsigned index) { @@ -1983,10 +2025,7 @@ void run_gui(bool is_running) } } else if (gui_state == SHOWING_HELP) { - current_help_page++; - if (current_help_page == sizeof(help) / sizeof(help[0])) { - gui_state = SHOWING_MENU; - } + gui_state = SHOWING_MENU; should_render = true; } break;