--- previous/src/shortcut.c 2018/04/24 19:25:32 1.1.1.2 +++ previous/src/shortcut.c 2018/04/24 19:31:16 1.1.1.4 @@ -14,17 +14,16 @@ const char ShortCut_fileid[] = "Hatari s #include "dialog.h" #include "file.h" #include "m68000.h" -#include "memorySnapShot.h" +#include "dimension.h" #include "reset.h" #include "screen.h" -#include "screenSnapShot.h" #include "configuration.h" #include "shortcut.h" #include "debugui.h" #include "sdlgui.h" #include "video.h" -#include "avi_record.h" -#include "clocks_timings.h" +#include "snd.h" +#include "statusbar.h" static SHORTCUTKEYIDX ShortCutKey = SHORTCUT_NONE; /* current shortcut key */ @@ -59,11 +58,15 @@ static void ShortCut_MouseGrab(void) { if (bGrabMouse) { - SDL_WM_GrabInput(SDL_GRAB_ON); + SDL_SetRelativeMouseMode(SDL_TRUE); + SDL_SetWindowGrab(sdlWindow, SDL_TRUE); + Main_SetTitle(MOUSE_LOCK_MSG); } else { - SDL_WM_GrabInput(SDL_GRAB_OFF); + SDL_SetRelativeMouseMode(SDL_FALSE); + SDL_SetWindowGrab(sdlWindow, SDL_FALSE); + Main_SetTitle(NULL); } } } @@ -71,78 +74,58 @@ static void ShortCut_MouseGrab(void) /*-----------------------------------------------------------------------*/ /** - * Shortcut to toggle YM/WAV sound recording - */ -static void ShortCut_RecordSound(void) -{ -} - - -/*-----------------------------------------------------------------------*/ -/** - * Shortcut to toggle screen animation recording - */ -static void ShortCut_RecordAnimation(void) -{ -} - - -/*-----------------------------------------------------------------------*/ -/** * Shortcut to sound on/off */ static void ShortCut_SoundOnOff(void) { + ConfigureParams.Sound.bEnableSound = !ConfigureParams.Sound.bEnableSound; + + Sound_Reset(); } - /*-----------------------------------------------------------------------*/ /** - * Shortcut to fast forward + * Shorcut to M68K debug interface */ -static void ShortCut_FastForward(void) -{ - /* Set maximum speed */ - ConfigureParams.System.bFastForward = true; -} - - -/*-----------------------------------------------------------------------*/ -/** - * Shortcut to 'Boss' key, ie minmize Window and switch to another application - */ -static void ShortCut_BossKey(void) -{ - /* If we are in full-screen, then return to a window */ - Screen_ReturnFromFullScreen(); - - if (bGrabMouse) - { - SDL_WM_GrabInput(SDL_GRAB_OFF); - bGrabMouse = false; - } - Main_PauseEmulation(true); - - /* Minimize Window and give up processing to next one! */ - SDL_WM_IconifyWindow(); -} - - -/*-----------------------------------------------------------------------*/ -/** - * Shorcut to debug interface - */ -static void ShortCut_Debug(void) +void ShortCut_Debug_M68K(void) { int running; - /* Call the debugger */ running = Main_PauseEmulation(true); + /* Call the debugger */ DebugUI(); if (running) Main_UnPauseEmulation(); } +/*-----------------------------------------------------------------------*/ +/** + * Shorcut to I860 debug interface + */ +void ShortCut_Debug_I860(void) { + int running; + + if (bInFullScreen) + Screen_ReturnFromFullScreen(); + + running = Main_PauseEmulation(true); + + /* override paused message so that user knows to look into console + * on how to continue in case he invoked the debugger by accident. + */ + Statusbar_AddMessage("I860 Console Debugger", 100); + Statusbar_Update(sdlscrn); + + /* disable normal GUI alerts while on console */ + int alertLevel = Log_SetAlertLevel(LOG_FATAL); + + /* Call the debugger */ + nd_start_debugger(); + Log_SetAlertLevel(alertLevel); + + if (running) + Main_UnPauseEmulation(); +} /*-----------------------------------------------------------------------*/ /** @@ -155,10 +138,22 @@ static void ShortCut_Pause(void) } /** - * Shorcut to load a disk image + * Shorcut to switch monochrome and dimension screen */ -static void ShortCut_InsertDisk(int drive) +static void ShortCut_Dimension(void) { + if (ConfigureParams.System.nMachineType==NEXT_STATION || !ConfigureParams.Dimension.bEnabled) { + return; + } + + if (ConfigureParams.Screen.nMonitorType != MONITOR_TYPE_DUAL) { + if (ConfigureParams.Screen.nMonitorType==MONITOR_TYPE_DIMENSION) { + ConfigureParams.Screen.nMonitorType=MONITOR_TYPE_CPU; + } else { + ConfigureParams.Screen.nMonitorType=MONITOR_TYPE_DIMENSION; + } + } + Statusbar_UpdateInfo(); } @@ -186,33 +181,14 @@ void ShortCut_ActKey(void) Main_UnPauseEmulation(); Reset_Cold(); /* Reset emulator with 'cold' (clear all) */ break; - case SHORTCUT_WARMRESET: - Main_UnPauseEmulation(); - Reset_Warm(); /* Emulator 'warm' reset */ - break; - case SHORTCUT_SCREENSHOT: - ScreenSnapShot_SaveScreen(); /* Grab screenshot */ - break; - case SHORTCUT_BOSSKEY: - ShortCut_BossKey(); /* Boss key */ - break; - case SHORTCUT_CURSOREMU: /* Toggle joystick emu on/off */ -// Joy_ToggleCursorEmulation(); - break; - case SHORTCUT_FASTFORWARD: - ShortCut_FastForward(); /* Toggle Min/Max speed */ - break; - case SHORTCUT_RECANIM: - ShortCut_RecordAnimation(); /* Record animation */ - break; - case SHORTCUT_RECSOUND: -// ShortCut_RecordSound(); /* Toggle sound recording */ - break; case SHORTCUT_SOUND: ShortCut_SoundOnOff(); /* Enable/disable sound */ break; - case SHORTCUT_DEBUG: - ShortCut_Debug(); /* Invoke the Debug UI */ + case SHORTCUT_DEBUG_M68K: + ShortCut_Debug_M68K(); /* Invoke the Debug UI */ + break; + case SHORTCUT_DEBUG_I860: + ShortCut_Debug_I860(); /* Invoke the M68K UI */ break; case SHORTCUT_PAUSE: ShortCut_Pause(); /* Invoke Pause */ @@ -220,18 +196,13 @@ void ShortCut_ActKey(void) case SHORTCUT_QUIT: Main_RequestQuit(); break; - case SHORTCUT_LOADMEM: - MemorySnapShot_Restore(ConfigureParams.Memory.szMemoryCaptureFileName, true); - break; - case SHORTCUT_SAVEMEM: - MemorySnapShot_Capture(ConfigureParams.Memory.szMemoryCaptureFileName, true); - break; - case SHORTCUT_INSERTDISKA: -// ShortCut_InsertDisk(0); + case SHORTCUT_DIMENSION: + ShortCut_Dimension(); break; case SHORTCUT_KEYS: case SHORTCUT_NONE: /* ERROR: cannot happen, just make compiler happy */ + default: break; } ShortCutKey = SHORTCUT_NONE; @@ -253,11 +224,6 @@ bool Shortcut_Invoke(const char *shortcu { SHORTCUT_MOUSEGRAB, "mousegrab" }, { SHORTCUT_COLDRESET, "coldreset" }, { SHORTCUT_WARMRESET, "warmreset" }, - { SHORTCUT_SCREENSHOT, "screenshot" }, - { SHORTCUT_BOSSKEY, "bosskey" }, - { SHORTCUT_RECANIM, "recanim" }, - { SHORTCUT_RECSOUND, "recsound" }, - { SHORTCUT_SAVEMEM, "savemem" }, { SHORTCUT_QUIT, "quit" }, { SHORTCUT_NONE, NULL } }; @@ -314,7 +280,11 @@ int ShortCut_CheckKeys(int modkey, int s { SHORTCUTKEYIDX key; - if (modkey & (KMOD_RALT|KMOD_LMETA|KMOD_RMETA|KMOD_MODE)) +#if defined(__APPLE__) + if ((modkey&(KMOD_RCTRL|KMOD_LCTRL)) && (modkey&(KMOD_RALT|KMOD_LALT))) +#else + if (modkey & (KMOD_RALT|KMOD_LGUI|KMOD_RGUI|KMOD_MODE)) +#endif key = ShortCut_CheckKey(symkey, ConfigureParams.Shortcut.withModifier); else key = ShortCut_CheckKey(symkey, ConfigureParams.Shortcut.withoutModifier);