Link to debugger help and sponsor pages

This commit is contained in:
Lior Halphon 2022-08-14 18:44:40 +03:00
parent 9bf7e0b4df
commit 6ecc2f15b5
5 changed files with 75 additions and 8 deletions

View File

@ -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) {

View File

@ -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>

View File

@ -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 + ' ';

View File

@ -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 */

View File

@ -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;