Fix menu commands, add predefined window sizes

This commit is contained in:
OV2 2010-12-02 20:09:49 +01:00
parent 8774ddb4e3
commit 8218618c6c
4 changed files with 70 additions and 73 deletions

View File

@ -397,6 +397,7 @@
#define ID_OPTIONS_EMULATION 40069 #define ID_OPTIONS_EMULATION 40069
#define ID_OPTIONS_SETTINGS 40070 #define ID_OPTIONS_SETTINGS 40070
#define ID_DEBUG_TRACE 40071 #define ID_DEBUG_TRACE 40071
#define ID_FRAME_ADVANCE 40074
#define ID_DEBUG_FRAME_ADVANCE 40075 #define ID_DEBUG_FRAME_ADVANCE 40075
#define ID_DEBUG_SNES_STATUS 40076 #define ID_DEBUG_SNES_STATUS 40076
#define ID_NETPLAY_SERVER 40077 #define ID_NETPLAY_SERVER 40077
@ -437,7 +438,7 @@
#define ID_FILE_STOP_AVI 40117 #define ID_FILE_STOP_AVI 40117
#define ID_OPTIONS_KEYCUSTOM 40118 #define ID_OPTIONS_KEYCUSTOM 40118
#define ID_WINDOW_ 40119 #define ID_WINDOW_ 40119
#define ID_WINDOW_VIDMEM 40122 #define ID_WINDOW_BILINEAR 40122
#define ID_WINDOW_ASPECTRATIO 40123 #define ID_WINDOW_ASPECTRATIO 40123
#define ID_TURBO_LEFT 40124 #define ID_TURBO_LEFT 40124
#define ID_TURBO_UP 40125 #define ID_TURBO_UP 40125
@ -476,13 +477,17 @@
#define ID_SOUND_210MS 40166 #define ID_SOUND_210MS 40166
#define ID_EMULATION_PAUSEWHENINACTIVE 40167 #define ID_EMULATION_PAUSEWHENINACTIVE 40167
#define ID_VIDEO_SHOWFRAMERATE 40168 #define ID_VIDEO_SHOWFRAMERATE 40168
#define ID_WINDOW_SIZE_1X 40169
#define ID_WINDOW_SIZE_2X 40170
#define ID_WINDOW_SIZE_3X 40171
#define ID_WINDOW_SIZE_4X 40172
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 151 #define _APS_NEXT_RESOURCE_VALUE 151
#define _APS_NEXT_COMMAND_VALUE 40169 #define _APS_NEXT_COMMAND_VALUE 40173
#define _APS_NEXT_CONTROL_VALUE 3018 #define _APS_NEXT_CONTROL_VALUE 3018
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif

View File

@ -701,18 +701,6 @@ IDB_HIDDENFOLDER BITMAP "hiddir.bmp"
// Icon with lowest ID value placed first to ensure application icon // Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems. // remains consistent on all systems.
IDI_ICON1 ICON "icon1.ico" IDI_ICON1 ICON "icon1.ico"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Dutch (Netherlands) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NLD)
#ifdef _WIN32
LANGUAGE LANG_DUTCH, SUBLANG_DUTCH
#pragma code_page(1252)
#endif //_WIN32
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
@ -777,19 +765,6 @@ END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
#endif // Dutch (Netherlands) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Dialog // Dialog
@ -871,7 +846,8 @@ BEGIN
BEGIN BEGIN
MENUITEM "&Pause", ID_FILE_PAUSE MENUITEM "&Pause", ID_FILE_PAUSE
MENUITEM "Pause &When Inactive", ID_EMULATION_PAUSEWHENINACTIVE MENUITEM "Pause &When Inactive", ID_EMULATION_PAUSEWHENINACTIVE
MENUITEM SEPARATOR MENUITEM "&Frame Advance", ID_FRAME_ADVANCE
MENUITEM SEPARATOR
MENUITEM "&Settings...\tAlt+F8", ID_OPTIONS_SETTINGS MENUITEM "&Settings...\tAlt+F8", ID_OPTIONS_SETTINGS
END END
POPUP "&Input" POPUP "&Input"
@ -943,10 +919,17 @@ BEGIN
BEGIN BEGIN
MENUITEM "&Hide menubar\tEsc", ID_WINDOW_HIDEMENUBAR MENUITEM "&Hide menubar\tEsc", ID_WINDOW_HIDEMENUBAR
MENUITEM "&Full Screen\tAlt+Enter", ID_WINDOW_FULLSCREEN MENUITEM "&Full Screen\tAlt+Enter", ID_WINDOW_FULLSCREEN
POPUP "&Window Size"
BEGIN
MENUITEM "&1x" ID_WINDOW_SIZE_1X
MENUITEM "&2x" ID_WINDOW_SIZE_2X
MENUITEM "&3x" ID_WINDOW_SIZE_3X
MENUITEM "&4x" ID_WINDOW_SIZE_4X
END
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Stretch Image\tAlt+Backspace", 40032 MENUITEM "&Stretch Image\tAlt+Backspace", ID_WINDOW_STRETCH
MENUITEM "&Maintain Aspect Ratio", 40123 MENUITEM "&Maintain Aspect Ratio", ID_WINDOW_ASPECTRATIO
MENUITEM "&Bilinear Filtering", ID_WINDOW_VIDMEM MENUITEM "&Bilinear Filtering", ID_WINDOW_BILINEAR
MENUITEM "Show Frame &Rate", ID_VIDEO_SHOWFRAMERATE MENUITEM "Show Frame &Rate", ID_VIDEO_SHOWFRAMERATE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Display Configuration...\tAlt+F5", ID_OPTIONS_DISPLAY MENUITEM "&Display Configuration...\tAlt+F5", ID_OPTIONS_DISPLAY
@ -977,7 +960,7 @@ BEGIN
END END
END END
#endif // English (U.K.) resources #endif // English (U.S.) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@ -78,7 +78,7 @@
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG" PreprocessorDefinitions="NDEBUG"
Culture="2057" Culture="1033"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
@ -180,7 +180,7 @@
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG" PreprocessorDefinitions="NDEBUG"
Culture="2057" Culture="1033"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
@ -277,7 +277,7 @@
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG" PreprocessorDefinitions="NDEBUG"
Culture="1043" Culture="1033"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
@ -376,7 +376,7 @@
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG" PreprocessorDefinitions="NDEBUG"
Culture="1043" Culture="1033"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
@ -473,7 +473,7 @@
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG" PreprocessorDefinitions="NDEBUG"
Culture="1043" Culture="1033"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
@ -569,7 +569,7 @@
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG" PreprocessorDefinitions="NDEBUG"
Culture="1043" Culture="1033"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
@ -669,7 +669,7 @@
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG" PreprocessorDefinitions="NDEBUG"
Culture="2057" Culture="1033"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
@ -768,7 +768,7 @@
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG" PreprocessorDefinitions="NDEBUG"
Culture="2057" Culture="1033"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
@ -865,7 +865,7 @@
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG" PreprocessorDefinitions="NDEBUG"
Culture="1043" Culture="1033"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
@ -965,7 +965,7 @@
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG" PreprocessorDefinitions="NDEBUG"
Culture="1043" Culture="1033"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
@ -1071,7 +1071,7 @@
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG" PreprocessorDefinitions="NDEBUG"
Culture="2057" Culture="1033"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
@ -1175,7 +1175,7 @@
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG" PreprocessorDefinitions="NDEBUG"
Culture="2057" Culture="1033"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"

View File

@ -2054,29 +2054,35 @@ LRESULT CALLBACK WinProc(
case ID_WINDOW_FULLSCREEN: case ID_WINDOW_FULLSCREEN:
ToggleFullScreen (); ToggleFullScreen ();
break; break;
case ID_WINDOW_STRETCH: { case ID_WINDOW_SIZE_1X:
case ID_WINDOW_SIZE_2X:
case ID_WINDOW_SIZE_3X:
case ID_WINDOW_SIZE_4X:
UINT factor,newWidth,newHeight;
factor = (wParam & 0xffff) - ID_WINDOW_SIZE_1X + 1;
newWidth = GUI.AspectWidth * factor;
newHeight = (GUI.HeightExtend ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT) * factor;
newWidth += 2*(GetSystemMetrics(SM_CXBORDER) + GetSystemMetrics(SM_CXDLGFRAME));
newHeight += 2*(GetSystemMetrics(SM_CYBORDER) + GetSystemMetrics(SM_CYDLGFRAME)) +
GetSystemMetrics(SM_CYCAPTION) + (GUI.HideMenu ? 0 : (GetSystemMetrics(SM_CYMENU) +
(factor<2 ? GetSystemMetrics(SM_CYMENU) : 0)));
SetWindowPos(GUI.hWnd,0,0,0,newWidth,newHeight,SWP_NOMOVE);
break;
case ID_WINDOW_STRETCH:
GUI.Stretch = !GUI.Stretch; GUI.Stretch = !GUI.Stretch;
if(!GUI.Stretch != !GUI.BilinearFilter) { WinDisplayApplyChanges();
GUI.BilinearFilter = !GUI.BilinearFilter; WinRefreshDisplay();
RestoreSNESDisplay (); break;
} case ID_WINDOW_ASPECTRATIO:
RECT rect;
GetClientRect (GUI.hWnd, &rect);
InvalidateRect (GUI.hWnd, &rect, true);
} break;
case ID_WINDOW_ASPECTRATIO: {
GUI.AspectRatio = !GUI.AspectRatio; GUI.AspectRatio = !GUI.AspectRatio;
RECT rect; WinDisplayApplyChanges();
GetClientRect (GUI.hWnd, &rect); WinRefreshDisplay();
InvalidateRect (GUI.hWnd, &rect, true); break;
} break; case ID_WINDOW_BILINEAR:
case ID_WINDOW_VIDMEM: {
GUI.BilinearFilter = !GUI.BilinearFilter; GUI.BilinearFilter = !GUI.BilinearFilter;
RestoreSNESDisplay (); WinDisplayApplyChanges();
RECT rect; WinRefreshDisplay();
GetClientRect (GUI.hWnd, &rect); break;
InvalidateRect (GUI.hWnd, &rect, true);
} break;
case ID_VIDEO_SHOWFRAMERATE: case ID_VIDEO_SHOWFRAMERATE:
Settings.DisplayFrameRate = !Settings.DisplayFrameRate; Settings.DisplayFrameRate = !Settings.DisplayFrameRate;
break; break;
@ -2226,6 +2232,10 @@ LRESULT CALLBACK WinProc(
DialogBox(g_hInst, MAKEINTRESOURCE(IDD_ABOUT), hWnd, DlgAboutProc); DialogBox(g_hInst, MAKEINTRESOURCE(IDD_ABOUT), hWnd, DlgAboutProc);
RestoreSNESDisplay (); RestoreSNESDisplay ();
break; break;
case ID_FRAME_ADVANCE:
Settings.Paused = true;
Settings.FrameAdvance = true;
break;
#ifdef DEBUGGER #ifdef DEBUGGER
case ID_DEBUG_TRACE: case ID_DEBUG_TRACE:
CPU.Flags ^= TRACE_FLAG; CPU.Flags ^= TRACE_FLAG;
@ -2236,10 +2246,6 @@ LRESULT CALLBACK WinProc(
ICPU.FrameAdvanceCount = 1; ICPU.FrameAdvanceCount = 1;
Settings.Paused = FALSE; Settings.Paused = FALSE;
break; break;
case ID_DEBUG_SNES_STATUS:
MessageBox(GUI.hWnd, TEXT("Sorry, but this function is not implemented yet."), NULL, MB_OK | MB_ICONINFORMATION);
break;
#endif #endif
case IDM_ROM_INFO: case IDM_ROM_INFO:
RestoreGUIDisplay (); RestoreGUIDisplay ();
@ -2583,6 +2589,13 @@ BOOL WinInit( HINSTANCE hInstance)
MessageBox (NULL, TEXT("Failed to initialize the menu.\nThis could indicate a failure of your operating system;\ntry closing some other windows or programs, or restart your computer, before opening Snes9x again.\nOr, if you compiled this program yourself, ensure that Snes9x was built with the proper resource files."), TEXT("Snes9X - Menu Initialization Failure"), MB_OK | MB_ICONSTOP); MessageBox (NULL, TEXT("Failed to initialize the menu.\nThis could indicate a failure of your operating system;\ntry closing some other windows or programs, or restart your computer, before opening Snes9x again.\nOr, if you compiled this program yourself, ensure that Snes9x was built with the proper resource files."), TEXT("Snes9X - Menu Initialization Failure"), MB_OK | MB_ICONSTOP);
// return FALSE; // disabled: try to function without the menu // return FALSE; // disabled: try to function without the menu
} }
#ifdef DEBUGGER
if(GUI.hMenu) {
InsertMenu(GUI.hMenu,ID_OPTIONS_SETTINGS,MF_BYCOMMAND | MF_STRING | MF_ENABLED,ID_DEBUG_FRAME_ADVANCE,TEXT("&Debug Frame Advance"));
InsertMenu(GUI.hMenu,ID_OPTIONS_SETTINGS,MF_BYCOMMAND | MF_STRING | MF_ENABLED,ID_DEBUG_TRACE,TEXT("&Trace"));
InsertMenu(GUI.hMenu,ID_OPTIONS_SETTINGS,MF_BYCOMMAND | MF_SEPARATOR | MF_ENABLED,NULL,NULL);
}
#endif
TCHAR buf [100]; TCHAR buf [100];
_stprintf (buf, WINDOW_TITLE, TEXT(VERSION)); _stprintf (buf, WINDOW_TITLE, TEXT(VERSION));
@ -3597,7 +3610,7 @@ static void CheckMenuStates ()
mii.fState = GUI.BilinearFilter ? MFS_CHECKED : MFS_UNCHECKED; mii.fState = GUI.BilinearFilter ? MFS_CHECKED : MFS_UNCHECKED;
if(!GUI.Stretch) if(!GUI.Stretch)
mii.fState |= MFS_DISABLED; mii.fState |= MFS_DISABLED;
SetMenuItemInfo (GUI.hMenu, ID_WINDOW_VIDMEM, FALSE, &mii); SetMenuItemInfo (GUI.hMenu, ID_WINDOW_BILINEAR, FALSE, &mii);
mii.fState = Settings.DisplayFrameRate ? MFS_CHECKED : MFS_UNCHECKED; mii.fState = Settings.DisplayFrameRate ? MFS_CHECKED : MFS_UNCHECKED;
SetMenuItemInfo (GUI.hMenu, ID_VIDEO_SHOWFRAMERATE, FALSE, &mii); SetMenuItemInfo (GUI.hMenu, ID_VIDEO_SHOWFRAMERATE, FALSE, &mii);
@ -3759,10 +3772,6 @@ static void CheckMenuStates ()
#ifdef DEBUGGER #ifdef DEBUGGER
mii.fState = (CPU.Flags & TRACE_FLAG) ? MFS_CHECKED : MFS_UNCHECKED; mii.fState = (CPU.Flags & TRACE_FLAG) ? MFS_CHECKED : MFS_UNCHECKED;
SetMenuItemInfo (GUI.hMenu, ID_DEBUG_TRACE, FALSE, &mii); SetMenuItemInfo (GUI.hMenu, ID_DEBUG_TRACE, FALSE, &mii);
mii.fState = MFS_UNCHECKED;
SetMenuItemInfo (GUI.hMenu, ID_DEBUG_FRAME_ADVANCE, FALSE, &mii);
mii.fState = MFS_DISABLED;
SetMenuItemInfo (GUI.hMenu, ID_DEBUG_SNES_STATUS, FALSE, &mii);
#endif #endif
mii.fState = (!Settings.StopEmulation) ? MFS_ENABLED : MFS_DISABLED; mii.fState = (!Settings.StopEmulation) ? MFS_ENABLED : MFS_DISABLED;