From 481b675e1abf432e0fccb69f253237fb97c4bcf9 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Sat, 3 Sep 2022 14:31:30 +0100 Subject: [PATCH 1/7] Try to fix building on SDL 1.2 --- BasiliskII/src/SDL/audio_sdl.cpp | 4 +++ BasiliskII/src/SDL/video_sdl.cpp | 39 ++++++++++++++++++++------ BasiliskII/src/SDL/video_sdl2.cpp | 12 ++++---- BasiliskII/src/include/user_strings.h | 2 -- BasiliskII/src/user_strings.cpp | 16 ++++++----- SheepShaver/src/include/user_strings.h | 5 ++-- SheepShaver/src/user_strings.cpp | 21 ++++++++------ 7 files changed, 65 insertions(+), 34 deletions(-) diff --git a/BasiliskII/src/SDL/audio_sdl.cpp b/BasiliskII/src/SDL/audio_sdl.cpp index 7d126a0d..0afa4859 100644 --- a/BasiliskII/src/SDL/audio_sdl.cpp +++ b/BasiliskII/src/SDL/audio_sdl.cpp @@ -362,6 +362,7 @@ void audio_set_speaker_volume(uint32 vol) } static int play_startup(void *arg) { +#if SDL_VERSION_ATLEAST(2,0,0) SDL_AudioSpec wav_spec; Uint8 *wav_buffer; Uint32 wav_length; @@ -378,9 +379,12 @@ static int play_startup(void *arg) { else printf("play_startup: Audio driver failed to initialize\n"); SDL_FreeWAV(wav_buffer); } +#endif return 0; } void PlayStartupSound() { +#if SDL_VERSION_ATLEAST(2,0,0) SDL_CreateThread(play_startup, "", NULL); +#endif } diff --git a/BasiliskII/src/SDL/video_sdl.cpp b/BasiliskII/src/SDL/video_sdl.cpp index 395778a0..a2b39c77 100644 --- a/BasiliskII/src/SDL/video_sdl.cpp +++ b/BasiliskII/src/SDL/video_sdl.cpp @@ -520,12 +520,28 @@ static void set_mac_frame_buffer(SDL_monitor_desc &monitor, int depth) } // Set window name and class -static void set_window_name(int name) +static void set_window_name(bool mouse_grabbed) { + int grabbed = 0; + if (mouse_grabbed) + { + int hotkey = PrefsFindInt32("hotkey"); + if (hotkey & 2) + grabbed = STR_WINDOW_TITLE_GRABBED2; + else if (hotkey & 4) + grabbed = STR_WINDOW_TITLE_GRABBED3; + else + grabbed = STR_WINDOW_TITLE_GRABBED1; + } const SDL_VideoInfo *vi = SDL_GetVideoInfo(); - if (vi && vi->wm_available) { - const char *str = GetString(name); - SDL_WM_SetCaption(str, str); + if (vi && vi->wm_available) + { + const char *title = PrefsFindString("title"); + char *str = (char *)(title ? title : GetString(STR_WINDOW_TITLE)); + if(grabbed) + strcat(str, GetString(grabbed)); + //The icon name should stay the same + SDL_WM_SetCaption(str, GetString(STR_WINDOW_TITLE)); } } @@ -736,7 +752,7 @@ void driver_base::adapt_to_video_mode() { SDL_ShowCursor(hardware_cursor); // Set window name/class - set_window_name(STR_WINDOW_TITLE); + set_window_name(false); // Everything went well init_ok = true; @@ -1304,8 +1320,8 @@ void VideoVBL(void) // Setting the window name must happen on the main thread, else it doesn't work on // some platforms - e.g. macOS Sierra. if (mouse_grabbed_window_name_status != mouse_grabbed) { - set_window_name(mouse_grabbed ? STR_WINDOW_TITLE_GRABBED : STR_WINDOW_TITLE); - mouse_grabbed_window_name_status = mouse_grabbed; + set_window_name(mouse_grabbed); + mouse_grabbed_window_name_status = mouse_grabbed; } // Temporarily give up frame buffer lock (this is the point where @@ -1333,7 +1349,7 @@ void VideoInterrupt(void) // Setting the window name must happen on the main thread, else it doesn't work on // some platforms - e.g. macOS Sierra. if (mouse_grabbed_window_name_status != mouse_grabbed) { - set_window_name(mouse_grabbed ? STR_WINDOW_TITLE_GRABBED : STR_WINDOW_TITLE); + set_window_name(mouse_grabbed); mouse_grabbed_window_name_status = mouse_grabbed; } @@ -2337,4 +2353,11 @@ void video_set_dirty_area(int x, int y, int w, int h) } #endif +#ifdef SHEEPSHAVER +void video_set_gamma(int n_colors) +{ + // Not supported in SDL 1.2 +} +#endif + #endif // ends: SDL version check diff --git a/BasiliskII/src/SDL/video_sdl2.cpp b/BasiliskII/src/SDL/video_sdl2.cpp index e7f43a1e..1ee0c5c5 100644 --- a/BasiliskII/src/SDL/video_sdl2.cpp +++ b/BasiliskII/src/SDL/video_sdl2.cpp @@ -555,14 +555,12 @@ static void set_window_name() { if (!sdl_window) return; const char *title = PrefsFindString("title"); std::string s = title ? title : GetString(STR_WINDOW_TITLE); - if (mouse_grabbed) { - s += GetString(STR_WINDOW_TITLE_GRABBED0); + if (mouse_grabbed) + { int hotkey = PrefsFindInt32("hotkey"); - if (!hotkey) hotkey = 1; - if (hotkey & 1) s += GetString(STR_WINDOW_TITLE_GRABBED1); - if (hotkey & 2) s += GetString(STR_WINDOW_TITLE_GRABBED2); - if (hotkey & 4) s += GetString(STR_WINDOW_TITLE_GRABBED3); - s += GetString(STR_WINDOW_TITLE_GRABBED4); + if (hotkey & 2) s += GetString(STR_WINDOW_TITLE_GRABBED2); + else if (hotkey & 4) s += GetString(STR_WINDOW_TITLE_GRABBED3); + else s += GetString(STR_WINDOW_TITLE_GRABBED1); } SDL_SetWindowTitle(sdl_window, s.c_str()); } diff --git a/BasiliskII/src/include/user_strings.h b/BasiliskII/src/include/user_strings.h index f75a738e..9de07918 100644 --- a/BasiliskII/src/include/user_strings.h +++ b/BasiliskII/src/include/user_strings.h @@ -218,11 +218,9 @@ enum { // Mac window STR_WINDOW_TITLE = 4000, - STR_WINDOW_TITLE_GRABBED0, STR_WINDOW_TITLE_GRABBED1, STR_WINDOW_TITLE_GRABBED2, STR_WINDOW_TITLE_GRABBED3, - STR_WINDOW_TITLE_GRABBED4, STR_WINDOW_MENU = 4050, STR_WINDOW_ITEM_ABOUT, STR_WINDOW_ITEM_REFRESH, diff --git a/BasiliskII/src/user_strings.cpp b/BasiliskII/src/user_strings.cpp index 1e608b27..47bce211 100644 --- a/BasiliskII/src/user_strings.cpp +++ b/BasiliskII/src/user_strings.cpp @@ -231,16 +231,18 @@ user_string_def common_strings[] = { {STR_JIT_FOLLOW_CONST_JUMPS, "Translate through constant jumps (inline blocks)"}, {STR_WINDOW_TITLE, "Basilisk II"}, - {STR_WINDOW_TITLE_GRABBED0, " (mouse grabbed, press "}, - {STR_WINDOW_TITLE_GRABBED1, "Ctrl-"}, + {STR_WINDOW_TITLE_GRABBED1, " (mouse grabbed, press Ctrl+F5 to release)"}, #ifdef __APPLE__ - {STR_WINDOW_TITLE_GRABBED2, "Opt-"}, - {STR_WINDOW_TITLE_GRABBED3, "Cmd-"}, + {STR_WINDOW_TITLE_GRABBED2, " (mouse grabbed, press Opt+F5 to release)"}, + {STR_WINDOW_TITLE_GRABBED3, " (mouse grabbed, press Cmd+F5 to release)"}, #else - {STR_WINDOW_TITLE_GRABBED2, "Alt-"}, - {STR_WINDOW_TITLE_GRABBED3, "Win-"}, + {STR_WINDOW_TITLE_GRABBED2, " (mouse grabbed, press Alt+F5 to release)"}, +#endif +#ifdef __WIN32__ + {STR_WINDOW_TITLE_GRABBED3, " (mouse grabbed, press Win+F5 to release)"}, +#elif !defined(__APPLE__) + {STR_WINDOW_TITLE_GRABBED3, " (mouse grabbed, press Super+F5 to release)"}, #endif - {STR_WINDOW_TITLE_GRABBED4, "F5 to release)"}, {STR_WINDOW_MENU, "Basilisk II"}, {STR_WINDOW_ITEM_ABOUT, "About Basilisk II" ELLIPSIS}, {STR_WINDOW_ITEM_REFRESH, "Refresh Rate"}, diff --git a/SheepShaver/src/include/user_strings.h b/SheepShaver/src/include/user_strings.h index 5a4f4048..41d47d54 100644 --- a/SheepShaver/src/include/user_strings.h +++ b/SheepShaver/src/include/user_strings.h @@ -163,6 +163,9 @@ enum { STR_IGNORESEGV_CTRL, STR_IDLEWAIT_CTRL, STR_ROM_FILE_CTRL, + STR_NOGUI_CTRL, + STR_NOGUI_TIP, + STR_NOGUI_TIP2, // JIT Compiler pane STR_JIT_PANE_TITLE = 3700, @@ -171,11 +174,9 @@ enum { // Mac window STR_WINDOW_TITLE = 4000, - STR_WINDOW_TITLE_GRABBED0, STR_WINDOW_TITLE_GRABBED1, STR_WINDOW_TITLE_GRABBED2, STR_WINDOW_TITLE_GRABBED3, - STR_WINDOW_TITLE_GRABBED4, STR_WINDOW_MENU = 4050, STR_WINDOW_ITEM_ABOUT, STR_WINDOW_ITEM_REFRESH, diff --git a/SheepShaver/src/user_strings.cpp b/SheepShaver/src/user_strings.cpp index c29f7cff..165d6253 100644 --- a/SheepShaver/src/user_strings.cpp +++ b/SheepShaver/src/user_strings.cpp @@ -102,7 +102,7 @@ user_string_def common_strings[] = { {STR_NOCDROM_CTRL, "Disable CD-ROM Driver"}, {STR_ADD_VOLUME_TITLE, "Add Volume"}, {STR_CREATE_VOLUME_TITLE, "Create Hardfile"}, - {STR_HARDFILE_SIZE_CTRL, "Size (MB)"}, + {STR_HARDFILE_SIZE_CTRL, "Size (MiB)"}, {STR_GRAPHICS_SOUND_PANE_TITLE, "Graphics/Sound"}, {STR_FRAMESKIP_CTRL, "Window Refresh Rate"}, @@ -171,22 +171,27 @@ user_string_def common_strings[] = { {STR_IGNORESEGV_CTRL, "Ignore Illegal Memory Accesses"}, {STR_IDLEWAIT_CTRL, "Don't Use CPU When Idle"}, {STR_ROM_FILE_CTRL, "ROM File"}, + {STR_NOGUI_CTRL, "Don't show settings window on launch"}, + {STR_NOGUI_TIP, "Tip: You can access the settings by right-clicking on the launcher icon." }, + {STR_NOGUI_TIP2, "Tip: You can access the settings with the command: SheepShaver --nogui false" }, {STR_JIT_PANE_TITLE, "JIT Compiler"}, {STR_JIT_CTRL, "Enable JIT Compiler"}, {STR_JIT_68K_CTRL, "Enable built-in 68k DR Emulator (EXPERIMENTAL)"}, {STR_WINDOW_TITLE, "SheepShaver"}, - {STR_WINDOW_TITLE_GRABBED0, " (mouse grabbed, press "}, - {STR_WINDOW_TITLE_GRABBED1, "Ctrl-"}, + {STR_WINDOW_TITLE_GRABBED1, " (mouse grabbed, press Ctrl+F5 to release)"}, #ifdef __APPLE__ - {STR_WINDOW_TITLE_GRABBED2, "Opt-"}, - {STR_WINDOW_TITLE_GRABBED3, "Cmd-"}, + {STR_WINDOW_TITLE_GRABBED2, " (mouse grabbed, press Opt+F5 to release)"}, + {STR_WINDOW_TITLE_GRABBED3, " (mouse grabbed, press Cmd+F5 to release)"}, #else - {STR_WINDOW_TITLE_GRABBED2, "Alt-"}, - {STR_WINDOW_TITLE_GRABBED3, "Win-"}, + {STR_WINDOW_TITLE_GRABBED2, " (mouse grabbed, press Alt+F5 to release)"}, +#endif +#ifdef __WIN32__ + {STR_WINDOW_TITLE_GRABBED3, " (mouse grabbed, press Win+F5 to release)"}, +#elif !defined(__APPLE__) + {STR_WINDOW_TITLE_GRABBED3, " (mouse grabbed, press Super+F5 to release)"}, #endif - {STR_WINDOW_TITLE_GRABBED4, "F5 to release)"}, {STR_WINDOW_MENU, "SheepShaver"}, {STR_WINDOW_ITEM_ABOUT, "About SheepShaver" ELLIPSIS}, {STR_WINDOW_ITEM_REFRESH, "Refresh Rate"}, From ed86a184979b4367d7ea0fc051a6a0c7939e9e43 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Sat, 3 Sep 2022 15:05:56 +0100 Subject: [PATCH 2/7] Used std::string to fix crash on grabbing mouse with Ctrl+F5 --- BasiliskII/src/SDL/video_sdl.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/BasiliskII/src/SDL/video_sdl.cpp b/BasiliskII/src/SDL/video_sdl.cpp index a2b39c77..7fd3a832 100644 --- a/BasiliskII/src/SDL/video_sdl.cpp +++ b/BasiliskII/src/SDL/video_sdl.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #ifdef WIN32 #include /* alloca() */ @@ -537,11 +538,11 @@ static void set_window_name(bool mouse_grabbed) if (vi && vi->wm_available) { const char *title = PrefsFindString("title"); - char *str = (char *)(title ? title : GetString(STR_WINDOW_TITLE)); + std::string s = title ? title : GetString(STR_WINDOW_TITLE); if(grabbed) - strcat(str, GetString(grabbed)); + s += GetString(grabbed); //The icon name should stay the same - SDL_WM_SetCaption(str, GetString(STR_WINDOW_TITLE)); + SDL_WM_SetCaption(s.c_str(), GetString(STR_WINDOW_TITLE)); } } From 4ac4cbba45f57710955379628482412ccc923d29 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Sun, 4 Sep 2022 19:02:28 +0100 Subject: [PATCH 3/7] Re-enabled SDL 1.2 configure flag --- BasiliskII/src/Unix/configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BasiliskII/src/Unix/configure.ac b/BasiliskII/src/Unix/configure.ac index 60a5c307..513f0f4b 100755 --- a/BasiliskII/src/Unix/configure.ac +++ b/BasiliskII/src/Unix/configure.ac @@ -36,7 +36,7 @@ AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphi AC_ARG_ENABLE(sdl-audio, [ --enable-sdl-audio use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=yes]) AC_ARG_ENABLE(sdl-framework, [ --enable-sdl-framework use SDL framework [default=no]], [WANT_SDL_FRAMEWORK=$enableval], [WANT_SDL_FRAMEWORK=no]) AC_ARG_ENABLE(sdl-framework-prefix, [ --enable-sdl-framework-prefix=PFX default=/Library/Frameworks], [SDL_FRAMEWORK="$enableval"], [SDL_FRAMEWORK=/Library/Frameworks]) -#AC_ARG_WITH(sdl1, [ --with-sdl1 use SDL 1.x, rather than SDL 2.x [default=no]], [WANT_SDL_VERSION_MAJOR=1], []) +AC_ARG_WITH(sdl1, [ --with-sdl1 use SDL 1.x, rather than SDL 2.x [default=no]], [WANT_SDL_VERSION_MAJOR=1], []) dnl JIT compiler options. AC_ARG_ENABLE(jit-compiler, [ --enable-jit-compiler enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=yes]) From b1ab353085ad756f160c2fadd8840772c6a24dd9 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Mon, 5 Sep 2022 23:32:05 +0100 Subject: [PATCH 4/7] Fixed building BasiliskII with SDL 1.2 --- BasiliskII/src/SDL/video_sdl.cpp | 5 +++++ SheepShaver/src/Unix/configure.ac | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/BasiliskII/src/SDL/video_sdl.cpp b/BasiliskII/src/SDL/video_sdl.cpp index 7fd3a832..5d142618 100644 --- a/BasiliskII/src/SDL/video_sdl.cpp +++ b/BasiliskII/src/SDL/video_sdl.cpp @@ -366,6 +366,7 @@ public: virtual void switch_to_current_mode(void); virtual void set_palette(uint8 *pal, int num); + virtual void set_gamma(uint8 *gamma, int num); bool video_open(void); void video_close(void); @@ -1469,6 +1470,10 @@ void SDL_monitor_desc::set_palette(uint8 *pal, int num_in) UNLOCK_PALETTE; } +void SDL_monitor_desc::set_gamma(uint8 *gamma, int num_in) +{ + // Not implemented +} /* * Switch video mode diff --git a/SheepShaver/src/Unix/configure.ac b/SheepShaver/src/Unix/configure.ac index 8f22fe81..06d6b65e 100755 --- a/SheepShaver/src/Unix/configure.ac +++ b/SheepShaver/src/Unix/configure.ac @@ -72,7 +72,7 @@ AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphic AC_ARG_ENABLE(sdl-audio, [ --enable-sdl-audio use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=yes]) AC_ARG_ENABLE(sdl-framework, [ --enable-sdl-framework use SDL framework [default=no]], [WANT_SDL_FRAMEWORK=$enableval], [WANT_SDL_FRAMEWORK=no]) AC_ARG_ENABLE(sdl-framework-prefix, [ --enable-sdl-framework-prefix=PFX default=/Library/Frameworks], [SDL_FRAMEWORK="$enableval"], [SDL_FRAMEWORK=/Library/Frameworks]) -#AC_ARG_WITH(sdl1, [ --with-sdl1 use SDL 1.x, rather than SDL 2.x [default=no]], [WANT_SDL_VERSION_MAJOR=1], []) +AC_ARG_WITH(sdl1, [ --with-sdl1 use SDL 1.x, rather than SDL 2.x [default=no]], [WANT_SDL_VERSION_MAJOR=1], []) dnl Checks for programs. AC_PROG_CC From 177a297527fe630e890316f956744dae0a328110 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Tue, 6 Sep 2022 23:23:33 +0100 Subject: [PATCH 5/7] Fixed string building for mouse grab hotkey message --- BasiliskII/src/SDL/audio_sdl.cpp | 6 +++--- BasiliskII/src/SDL/video_sdl.cpp | 12 ++++++------ BasiliskII/src/SDL/video_sdl2.cpp | 11 +++++------ BasiliskII/src/emul_op.cpp | 5 ++++- BasiliskII/src/include/user_strings.h | 4 +++- BasiliskII/src/user_strings.cpp | 14 ++++++++------ SheepShaver/src/include/user_strings.h | 4 +++- SheepShaver/src/user_strings.cpp | 14 ++++++++------ 8 files changed, 40 insertions(+), 30 deletions(-) diff --git a/BasiliskII/src/SDL/audio_sdl.cpp b/BasiliskII/src/SDL/audio_sdl.cpp index 0afa4859..f0386471 100644 --- a/BasiliskII/src/SDL/audio_sdl.cpp +++ b/BasiliskII/src/SDL/audio_sdl.cpp @@ -361,8 +361,8 @@ void audio_set_speaker_volume(uint32 vol) { } -static int play_startup(void *arg) { #if SDL_VERSION_ATLEAST(2,0,0) +static int play_startup(void *arg) { SDL_AudioSpec wav_spec; Uint8 *wav_buffer; Uint32 wav_length; @@ -384,7 +384,7 @@ static int play_startup(void *arg) { } void PlayStartupSound() { -#if SDL_VERSION_ATLEAST(2,0,0) SDL_CreateThread(play_startup, "", NULL); -#endif } + +#if SDL_VERSION_ATLEAST(2,0,0) diff --git a/BasiliskII/src/SDL/video_sdl.cpp b/BasiliskII/src/SDL/video_sdl.cpp index 5d142618..cd02ec02 100644 --- a/BasiliskII/src/SDL/video_sdl.cpp +++ b/BasiliskII/src/SDL/video_sdl.cpp @@ -527,13 +527,13 @@ static void set_window_name(bool mouse_grabbed) int grabbed = 0; if (mouse_grabbed) { + s += GetString(STR_WINDOW_TITLE_GRABBED_PRE); int hotkey = PrefsFindInt32("hotkey"); - if (hotkey & 2) - grabbed = STR_WINDOW_TITLE_GRABBED2; - else if (hotkey & 4) - grabbed = STR_WINDOW_TITLE_GRABBED3; - else - grabbed = STR_WINDOW_TITLE_GRABBED1; + hotkey = hotkey ? hotkey : 1; + if (hotkey & 1) s += GetString(STR_WINDOW_TITLE_GRABBED1); + if (hotkey & 2) s += GetString(STR_WINDOW_TITLE_GRABBED2); + if (hotkey & 4) s += GetString(STR_WINDOW_TITLE_GRABBED4); + s += GetString(STR_WINDOW_TITLE_GRABBED_POST); } const SDL_VideoInfo *vi = SDL_GetVideoInfo(); if (vi && vi->wm_available) diff --git a/BasiliskII/src/SDL/video_sdl2.cpp b/BasiliskII/src/SDL/video_sdl2.cpp index 1ee0c5c5..e3720674 100644 --- a/BasiliskII/src/SDL/video_sdl2.cpp +++ b/BasiliskII/src/SDL/video_sdl2.cpp @@ -557,10 +557,13 @@ static void set_window_name() { std::string s = title ? title : GetString(STR_WINDOW_TITLE); if (mouse_grabbed) { + s += GetString(STR_WINDOW_TITLE_GRABBED_PRE); int hotkey = PrefsFindInt32("hotkey"); + hotkey = hotkey ? hotkey : 1; + if (hotkey & 1) s += GetString(STR_WINDOW_TITLE_GRABBED1); if (hotkey & 2) s += GetString(STR_WINDOW_TITLE_GRABBED2); - else if (hotkey & 4) s += GetString(STR_WINDOW_TITLE_GRABBED3); - else s += GetString(STR_WINDOW_TITLE_GRABBED1); + if (hotkey & 4) s += GetString(STR_WINDOW_TITLE_GRABBED4); + s += GetString(STR_WINDOW_TITLE_GRABBED_POST); } SDL_SetWindowTitle(sdl_window, s.c_str()); } @@ -1671,11 +1674,7 @@ static void do_toggle_fullscreen(void) SDL_SetWindowGrab(sdl_window, SDL_FALSE); } else { display_type = DISPLAY_SCREEN; -#ifdef __MACOSX__ SDL_SetWindowFullscreen(sdl_window, SDL_WINDOW_FULLSCREEN_DESKTOP); -#else - SDL_SetWindowFullscreen(sdl_window, SDL_WINDOW_FULLSCREEN); -#endif SDL_SetWindowGrab(sdl_window, SDL_TRUE); } } diff --git a/BasiliskII/src/emul_op.cpp b/BasiliskII/src/emul_op.cpp index 126b90a4..594817a6 100644 --- a/BasiliskII/src/emul_op.cpp +++ b/BasiliskII/src/emul_op.cpp @@ -93,8 +93,11 @@ void EmulOp(uint16 opcode, M68kRegisters *r) TimerReset(); EtherReset(); AudioReset(); +#ifdef ENABLE_SDL +#if SDL_VERSION_ATLEAST(2,0,0) PlayStartupSound(); - +#endif +#endif // Create BootGlobs at top of memory Mac_memset(RAMBaseMac + RAMSize - 4096, 0, 4096); uint32 boot_globs = RAMBaseMac + RAMSize - 0x1c; diff --git a/BasiliskII/src/include/user_strings.h b/BasiliskII/src/include/user_strings.h index 9de07918..fc00d3e2 100644 --- a/BasiliskII/src/include/user_strings.h +++ b/BasiliskII/src/include/user_strings.h @@ -218,9 +218,11 @@ enum { // Mac window STR_WINDOW_TITLE = 4000, + STR_WINDOW_TITLE_GRABBED_PRE, STR_WINDOW_TITLE_GRABBED1, STR_WINDOW_TITLE_GRABBED2, - STR_WINDOW_TITLE_GRABBED3, + STR_WINDOW_TITLE_GRABBED4, + STR_WINDOW_TITLE_GRABBED_POST, STR_WINDOW_MENU = 4050, STR_WINDOW_ITEM_ABOUT, STR_WINDOW_ITEM_REFRESH, diff --git a/BasiliskII/src/user_strings.cpp b/BasiliskII/src/user_strings.cpp index 47bce211..5279cb21 100644 --- a/BasiliskII/src/user_strings.cpp +++ b/BasiliskII/src/user_strings.cpp @@ -231,18 +231,20 @@ user_string_def common_strings[] = { {STR_JIT_FOLLOW_CONST_JUMPS, "Translate through constant jumps (inline blocks)"}, {STR_WINDOW_TITLE, "Basilisk II"}, - {STR_WINDOW_TITLE_GRABBED1, " (mouse grabbed, press Ctrl+F5 to release)"}, + {STR_WINDOW_TITLE_GRABBED_PRE, " (mouse grabbed, press "}, + {STR_WINDOW_TITLE_GRABBED1, "Ctrl+"}, #ifdef __APPLE__ - {STR_WINDOW_TITLE_GRABBED2, " (mouse grabbed, press Opt+F5 to release)"}, - {STR_WINDOW_TITLE_GRABBED3, " (mouse grabbed, press Cmd+F5 to release)"}, + {STR_WINDOW_TITLE_GRABBED2, "Opt+"}, + {STR_WINDOW_TITLE_GRABBED4, "Cmd+F5"}, #else - {STR_WINDOW_TITLE_GRABBED2, " (mouse grabbed, press Alt+F5 to release)"}, + {STR_WINDOW_TITLE_GRABBED2, "Alt+"}, #endif #ifdef __WIN32__ - {STR_WINDOW_TITLE_GRABBED3, " (mouse grabbed, press Win+F5 to release)"}, + {STR_WINDOW_TITLE_GRABBED4, "Win+"}, #elif !defined(__APPLE__) - {STR_WINDOW_TITLE_GRABBED3, " (mouse grabbed, press Super+F5 to release)"}, + {STR_WINDOW_TITLE_GRABBED4, "Super+"}, #endif + {STR_WINDOW_TITLE_GRABBED_POST, "F5 to release)"}, {STR_WINDOW_MENU, "Basilisk II"}, {STR_WINDOW_ITEM_ABOUT, "About Basilisk II" ELLIPSIS}, {STR_WINDOW_ITEM_REFRESH, "Refresh Rate"}, diff --git a/SheepShaver/src/include/user_strings.h b/SheepShaver/src/include/user_strings.h index 41d47d54..78e24041 100644 --- a/SheepShaver/src/include/user_strings.h +++ b/SheepShaver/src/include/user_strings.h @@ -174,9 +174,11 @@ enum { // Mac window STR_WINDOW_TITLE = 4000, + STR_WINDOW_TITLE_GRABBED_PRE, STR_WINDOW_TITLE_GRABBED1, STR_WINDOW_TITLE_GRABBED2, - STR_WINDOW_TITLE_GRABBED3, + STR_WINDOW_TITLE_GRABBED4, + STR_WINDOW_TITLE_GRABBED_POST, STR_WINDOW_MENU = 4050, STR_WINDOW_ITEM_ABOUT, STR_WINDOW_ITEM_REFRESH, diff --git a/SheepShaver/src/user_strings.cpp b/SheepShaver/src/user_strings.cpp index 165d6253..99f76946 100644 --- a/SheepShaver/src/user_strings.cpp +++ b/SheepShaver/src/user_strings.cpp @@ -180,18 +180,20 @@ user_string_def common_strings[] = { {STR_JIT_68K_CTRL, "Enable built-in 68k DR Emulator (EXPERIMENTAL)"}, {STR_WINDOW_TITLE, "SheepShaver"}, - {STR_WINDOW_TITLE_GRABBED1, " (mouse grabbed, press Ctrl+F5 to release)"}, + {STR_WINDOW_TITLE_GRABBED_PRE, " (mouse grabbed, press "}, + {STR_WINDOW_TITLE_GRABBED1, "Ctrl+"}, #ifdef __APPLE__ - {STR_WINDOW_TITLE_GRABBED2, " (mouse grabbed, press Opt+F5 to release)"}, - {STR_WINDOW_TITLE_GRABBED3, " (mouse grabbed, press Cmd+F5 to release)"}, + {STR_WINDOW_TITLE_GRABBED2, "Opt+"}, + {STR_WINDOW_TITLE_GRABBED4, "Cmd+F5"}, #else - {STR_WINDOW_TITLE_GRABBED2, " (mouse grabbed, press Alt+F5 to release)"}, + {STR_WINDOW_TITLE_GRABBED2, "Alt+"}, #endif #ifdef __WIN32__ - {STR_WINDOW_TITLE_GRABBED3, " (mouse grabbed, press Win+F5 to release)"}, + {STR_WINDOW_TITLE_GRABBED4, "Win+"}, #elif !defined(__APPLE__) - {STR_WINDOW_TITLE_GRABBED3, " (mouse grabbed, press Super+F5 to release)"}, + {STR_WINDOW_TITLE_GRABBED4, "Super+"}, #endif + {STR_WINDOW_TITLE_GRABBED_POST, "F5 to release)"}, {STR_WINDOW_MENU, "SheepShaver"}, {STR_WINDOW_ITEM_ABOUT, "About SheepShaver" ELLIPSIS}, {STR_WINDOW_ITEM_REFRESH, "Refresh Rate"}, From dae2be8c48e57ab22a6f110e5a113439dfb27291 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Wed, 7 Sep 2022 00:03:14 +0100 Subject: [PATCH 6/7] ifdefs weren't placed correctly --- BasiliskII/src/SDL/audio_sdl.cpp | 8 +++++--- BasiliskII/src/SDL/video_sdl.cpp | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/BasiliskII/src/SDL/audio_sdl.cpp b/BasiliskII/src/SDL/audio_sdl.cpp index f0386471..84cb4d9d 100644 --- a/BasiliskII/src/SDL/audio_sdl.cpp +++ b/BasiliskII/src/SDL/audio_sdl.cpp @@ -379,12 +379,14 @@ static int play_startup(void *arg) { else printf("play_startup: Audio driver failed to initialize\n"); SDL_FreeWAV(wav_buffer); } -#endif return 0; } void PlayStartupSound() { SDL_CreateThread(play_startup, "", NULL); } - -#if SDL_VERSION_ATLEAST(2,0,0) +#else +void PlayStartupSound() { + // Not implemented +} +#endif diff --git a/BasiliskII/src/SDL/video_sdl.cpp b/BasiliskII/src/SDL/video_sdl.cpp index cd02ec02..3771db0c 100644 --- a/BasiliskII/src/SDL/video_sdl.cpp +++ b/BasiliskII/src/SDL/video_sdl.cpp @@ -524,6 +524,8 @@ static void set_mac_frame_buffer(SDL_monitor_desc &monitor, int depth) // Set window name and class static void set_window_name(bool mouse_grabbed) { + const char *title = PrefsFindString("title"); + std::string s = title ? title : GetString(STR_WINDOW_TITLE); int grabbed = 0; if (mouse_grabbed) { From bfad0d3bba0154953d36d32ed6e785f989f538e1 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Wed, 7 Sep 2022 10:23:54 +0100 Subject: [PATCH 7/7] Removed redundant code --- BasiliskII/src/SDL/video_sdl.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/BasiliskII/src/SDL/video_sdl.cpp b/BasiliskII/src/SDL/video_sdl.cpp index 3771db0c..83ed73f3 100644 --- a/BasiliskII/src/SDL/video_sdl.cpp +++ b/BasiliskII/src/SDL/video_sdl.cpp @@ -540,10 +540,6 @@ static void set_window_name(bool mouse_grabbed) const SDL_VideoInfo *vi = SDL_GetVideoInfo(); if (vi && vi->wm_available) { - const char *title = PrefsFindString("title"); - std::string s = title ? title : GetString(STR_WINDOW_TITLE); - if(grabbed) - s += GetString(grabbed); //The icon name should stay the same SDL_WM_SetCaption(s.c_str(), GetString(STR_WINDOW_TITLE)); }