About SheepShaver, a PPC Mac emulator for Windows, MacOS X, and Linux that can run System 7.5.3 to MacOS 9.0.4.
Moderators: Cat_7 , Ronald P. Regensburg , ClockWise
yksoft1
Master Emulator
Posts: 394 Joined: Tue Aug 14, 2007 4:32 pm
Location: People's Republic of China
Post
by yksoft1 » Fri Jun 22, 2012 6:31 am
I know this hack is dirty and this will only work when emulated system instead of the whole Sheepshaver program hangs..
Code: Select all
--- /d/sss/BasiliskII/src/sdl/video_sdl.cpp Sat Jan 14 23:45:18 2012
+++ video_sdl.cpp Fri Jun 22 14:09:57 2012
@@ -88,6 +88,7 @@ static int display_type = DISPLAY_WINDOW
// Constants
#ifdef WIN32
const char KEYCODE_FILE_NAME[] = "BasiliskII_keycodes";
+const unsigned int fquit = 432;
#else
const char KEYCODE_FILE_NAME[] = DATADIR "/keycodes";
#endif
@@ -244,7 +245,19 @@ static LRESULT CALLBACK windows_message_
SysMediaArrived();
}
return 0;
-
+ break;
+ case WM_SYSCOMMAND:
+ if(wParam == fquit)
+ {
+ int rt;
+ rt = MessageBox(hwnd, "Do you really want to Force Quit Sheepshaver?",
+ "Sheepshaver", MB_ICONWARNING|MB_OKCANCEL);
+ if(rt == IDOK)
+ {
+ printf("Force quitting...\n");
+ QuitEmulator();
+ }
+ }
default:
if (sdl_window_proc)
return CallWindowProc(sdl_window_proc, hwnd, msg, wParam, lParam);
@@ -1089,6 +1102,12 @@ bool SDL_monitor_desc::video_open(void)
HWND the_window = GetMainWindowHandle();
sdl_window_proc = (WNDPROC)GetWindowLongPtr(the_window, GWLP_WNDPROC);
SetWindowLongPtr(the_window, GWLP_WNDPROC, (LONG_PTR)windows_message_handler);
+
+ HMENU smenu = GetSystemMenu(the_window, 0);
+ unsigned int fp=fquit;
+ if (smenu)
+ AppendMenu(smenu, MF_STRING, (UINT_PTR)fp, "&Force Quit");
+
#endif
// Initialize VideoRefresh function
ClockWise
Site Admin
Posts: 4399 Joined: Mon May 20, 2002 4:37 am
Location: Uiwang
Post
by ClockWise » Fri Jun 22, 2012 12:26 pm
Nice addition. Did you know that there is actually a hotkey that forces SheepShaver to quit:
[Control + Alt]hold + Escape[tap a few times]
UberFoX discovered that when he was working on his mouse-grab hotkey.
yksoft1
Master Emulator
Posts: 394 Joined: Tue Aug 14, 2007 4:32 pm
Location: People's Republic of China
Post
by yksoft1 » Fri Jun 22, 2012 12:47 pm
I didn't look at the keyboard code...
Now the confirmation when "emergency quit" hotkey (It's in fact Ctrl+Esc, however Windows itself use it as a substitute to the Windows key so only Ctrl+Alt+Esc will work) down is also added.
Code: Select all
--- /d/video_sdl.cpp Sat Jan 14 23:45:18 2012
+++ video_sdl.cpp Fri Jun 22 20:52:05 2012
@@ -88,6 +88,7 @@ static int display_type = DISPLAY_WINDOW
// Constants
#ifdef WIN32
const char KEYCODE_FILE_NAME[] = "BasiliskII_keycodes";
+const unsigned int fquit = 432;
#else
const char KEYCODE_FILE_NAME[] = DATADIR "/keycodes";
#endif
@@ -244,7 +245,19 @@ static LRESULT CALLBACK windows_message_
SysMediaArrived();
}
return 0;
-
+ break;
+ case WM_SYSCOMMAND:
+ if(wParam == fquit)
+ {
+ int rt;
+ rt = MessageBox(hwnd, "Do you really want to Force Quit Sheepshaver?",
+ "Sheepshaver", MB_ICONWARNING|MB_OKCANCEL);
+ if(rt == IDOK)
+ {
+ printf("Force quitting...\n");
+ quit_full_screen = true; emerg_quit = true;
+ }
+ }
default:
if (sdl_window_proc)
return CallWindowProc(sdl_window_proc, hwnd, msg, wParam, lParam);
@@ -1089,6 +1102,12 @@ bool SDL_monitor_desc::video_open(void)
HWND the_window = GetMainWindowHandle();
sdl_window_proc = (WNDPROC)GetWindowLongPtr(the_window, GWLP_WNDPROC);
SetWindowLongPtr(the_window, GWLP_WNDPROC, (LONG_PTR)windows_message_handler);
+
+ HMENU smenu = GetSystemMenu(the_window, 0);
+ unsigned int fp=fquit;
+ if (smenu)
+ AppendMenu(smenu, MF_STRING, (UINT_PTR)fp, "&Force Quit");
+
#endif
// Initialize VideoRefresh function
@@ -1701,7 +1720,23 @@ static int kc_decode(SDL_keysym const &
case SDLK_LEFT: return 0x3b;
case SDLK_RIGHT: return 0x3c;
- case SDLK_ESCAPE: if (is_ctrl_down(ks)) {if (!key_down) { quit_full_screen = true; emerg_quit = true; } return -2;} else return 0x35;
+ case SDLK_ESCAPE: if (is_ctrl_down(ks))
+ {
+ if (!key_down)
+ {
+#ifdef WIN32
+ HWND the_window = GetMainWindowHandle();
+ if ( MessageBox(the_window, "Do you really want to Force Quit Sheepshaver?",
+ "Sheepshaver", MB_ICONWARNING|MB_OKCANCEL) == IDOK )
+#endif
+ {
+ printf ("Force quitting on hotkey down...\n");
+ quit_full_screen = true; emerg_quit = true;
+ }
+ }
+ return -2;
+ }
+ else return 0x35;
case SDLK_F1: if (is_ctrl_down(ks)) {if (!key_down) SysMountFirstFloppy(); return -2;} else return 0x7a;
case SDLK_F2: return 0x78;
Last edited by
yksoft1 on Fri Jun 22, 2012 12:56 pm, edited 1 time in total.
ClockWise
Site Admin
Posts: 4399 Joined: Mon May 20, 2002 4:37 am
Location: Uiwang
Post
by ClockWise » Fri Jun 22, 2012 12:53 pm
You could post a build with that feature and I'll try it out... or maybe you could send it in? There's a lot of activity going on with SheepShaver development this month.
Meanwhile, since you didn't know about the hotkey, maybe you didn't see UberFoX's thread where it was first mentioned:
http://emaculation.com/forum/viewtopic.php?f=20&t=7604
Check it out... a nice improvement for SheepShaver for Windows!
yksoft1
Master Emulator
Posts: 394 Joined: Tue Aug 14, 2007 4:32 pm
Location: People's Republic of China
Post
by yksoft1 » Fri Jun 22, 2012 1:01 pm
My patch is still based on the CVS code and not the git code.. I don't know will this patch work under the newest git code.
Sheepshaver for Windows with window menu Force Quit item and Force Quit hotkey confirmation, based on the latest and last CVS snapshot:
http://www.mediafire.com/file/2eydxr124wr1stb/ssn2.zip
offtopic: How did Uberfox's patch fix the busy mouse grab bug? This sort of bugfix need to be merged into the main source tree for its severity.
adespoton
Forum All-Star
Posts: 4277 Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:
Post
by adespoton » Thu Dec 04, 2014 5:29 pm
This sort of bugfix need to be merged into the main source tree for its severity.
At this point, the github code is the main source tree, which is why ClockWise was encouraging you to check your code into it.