git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit 6ecc2f15b53144098c436c2b6a12b1f069204f2d
parent 9bf7e0b4dffc20941e4dfadffc6899ae19463844
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Sun, 14 Aug 2022 18:44:40 +0300

Link to debugger help and sponsor pages

Diffstat:
MCocoa/GBApp.m10++++++++++
MCocoa/MainMenu.xib11+++++++++--
MSDL/font.c10++++++++++
MSDL/font.h1+
MSDL/gui.c51+++++++++++++++++++++++++++++++++++++++++++++------
5 files changed, 75 insertions(+), 8 deletions(-)

diff --git 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 @@ -29,6 +29,12 @@ <action selector="orderFrontAboutPanel:" target="-1" id="Exp-CZ-Vem"/> </connections> </menuItem> + <menuItem title="Sponsor SameBoy" id="nJ0-7j-VJu"> + <modifierMask key="keyEquivalentModifierMask"/> + <connections> + <action selector="openSponsor:" target="-3" id="HSd-eg-8JL"/> + </connections> + </menuItem> <menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/> <menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"> <connections> @@ -523,9 +529,10 @@ <modifierMask key="keyEquivalentModifierMask"/> <menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ"> <items> - <menuItem title="SameBoy Help" keyEquivalent="?" id="FKE-Sm-Kum"> + <menuItem title="Debugger Help" id="FKE-Sm-Kum"> + <modifierMask key="keyEquivalentModifierMask"/> <connections> - <action selector="showHelp:" target="-1" id="y7X-2Q-9no"/> + <action selector="openDebuggerHelp:" target="-3" id="8tf-lJ-Tbk"/> </connections> </menuItem> </items> diff --git 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 @@ -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 @@ -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;

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.