diff --git a/desmume/src/windows/main.c b/desmume/src/windows/main.c index 580d1a372..75ce42438 100644 --- a/desmume/src/windows/main.c +++ b/desmume/src/windows/main.c @@ -80,6 +80,8 @@ BOOL romloaded = FALSE; BOOL ForceRatio = FALSE; float aspectratio; +int DefaultWidth; +int DefaultHeight; HMENU menu; HANDLE runthread=INVALID_HANDLE_VALUE; @@ -201,14 +203,16 @@ void SetWindowClientSize(HWND hwnd, int cx, int cy) //found at: http://blogs.msd void ScaleScreen(float factor) { - RECT fullSize,clientSize ; +/* RECT fullSize,clientSize ; factor -= 1 ; GetWindowRect(hwnd,&fullSize) ; GetClientRect(hwnd,&clientSize) ; fullSize.right += (clientSize.right - clientSize.left) * factor ; - fullSize.bottom += (clientSize.bottom - clientSize.top) * factor ; - SetWindowPos(hwnd, NULL, 0, 0, fullSize.right - fullSize.left, - fullSize.bottom - fullSize.top, SWP_NOMOVE | SWP_NOZORDER); + fullSize.bottom += (clientSize.bottom - clientSize.top) * factor ; */ + //SetWindowPos(hwnd, NULL, 0, 0, fullSize.right - fullSize.left, + // fullSize.bottom - fullSize.top, SWP_NOMOVE | SWP_NOZORDER); + SetWindowPos(hwnd, NULL, 0, 0, DefaultWidth * factor, + DefaultHeight * factor, SWP_NOMOVE | SWP_NOZORDER); } void translateXY(s32 *x, s32*y) @@ -551,13 +555,15 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM switch (message) // handle the messages { case WM_CREATE: - { - RECT fullSize; - ReadConfig(); - GetWindowRect(hwnd, &fullSize); - aspectratio = ((fullSize.right - fullSize.left) * 1.0) / ((fullSize.bottom - fullSize.top) * 1.0); - return 0; - } + { + RECT fullSize; + ReadConfig(); + GetWindowRect(hwnd, &fullSize); + DefaultWidth = fullSize.right - fullSize.left; + DefaultHeight = fullSize.bottom - fullSize.top; + aspectratio = ((fullSize.right - fullSize.left) * 1.0) / ((fullSize.bottom - fullSize.top) * 1.0); + return 0; + } case WM_DESTROY: NDS_Pause(); finished = TRUE; @@ -1350,12 +1356,24 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM CheckMenuItem(menu, IDC_ROTATE180, MF_BYCOMMAND | MF_UNCHECKED); CheckMenuItem(menu, IDC_ROTATE270, MF_BYCOMMAND | MF_CHECKED); return 0; - case IDC_MAGNIFY: - ScaleScreen(1.25f) ; /* 100 -> 125% */ + /*case IDC_MAGNIFY: + ScaleScreen(1.25f) ; //100 -> 125% break ; case IDC_DEMAGNIFY: - ScaleScreen(0.8f) ; /* 125 -> 100% (== 100 -> 80%) */ - break ; + ScaleScreen(0.8f) ; //125 -> 100% (== 100 -> 80%) + break ; */ + case IDC_WINDOW1X: + ScaleScreen(1); + break; + case IDC_WINDOW2X: + ScaleScreen(2); + break; + case IDC_WINDOW3X: + ScaleScreen(3); + break; + case IDC_WINDOW4X: + ScaleScreen(4); + break; case IDC_FORCERATIO: if (ForceRatio) { CheckMenuItem(menu, IDC_FORCERATIO, MF_BYCOMMAND | MF_UNCHECKED); diff --git a/desmume/src/windows/resource.h b/desmume/src/windows/resource.h index 3e4d96684..141c15fbf 100644 --- a/desmume/src/windows/resource.h +++ b/desmume/src/windows/resource.h @@ -224,8 +224,12 @@ void refreshAll(); #define IDC_ROTATE90 1004 #define IDC_ROTATE180 1005 #define IDC_ROTATE270 1006 -#define IDC_MAGNIFY 1007 -#define IDC_DEMAGNIFY 1008 +//#define IDC_MAGNIFY 1007 +//#define IDC_DEMAGNIFY 1008 #define IDC_FORCERATIO 1009 +#define IDC_WINDOW1X 1010 +#define IDC_WINDOW2X 1011 +#define IDC_WINDOW3X 1012 +#define IDC_WINDOW4X 1013 #endif diff --git a/desmume/src/windows/resources.rc b/desmume/src/windows/resources.rc index 1b73fc2c1..53b92b340 100644 --- a/desmume/src/windows/resources.rc +++ b/desmume/src/windows/resources.rc @@ -57,8 +57,15 @@ MENU_PRINCIPAL MENU MENUITEM "180", IDC_ROTATE180 MENUITEM "270", IDC_ROTATE270 } - MENUITEM "&Magnify", IDC_MAGNIFY - MENUITEM "&DeMagnify", IDC_DEMAGNIFY + POPUP "Window &Size" + { + MENUITEM "1x", IDC_WINDOW1X + MENUITEM "2x", IDC_WINDOW2X + MENUITEM "3x", IDC_WINDOW3X + MENUITEM "4x", IDC_WINDOW4X + } + //MENUITEM "&Magnify", IDC_MAGNIFY + //MENUITEM "&DeMagnify", IDC_DEMAGNIFY MENUITEM "&Force Maintain Ratio", IDC_FORCERATIO } POPUP "&Outils" @@ -357,8 +364,15 @@ MENU_PRINCIPAL MENU MENUITEM "180", IDC_ROTATE180 MENUITEM "270", IDC_ROTATE270 } - MENUITEM "&Magnify", IDC_MAGNIFY - MENUITEM "&DeMagnify", IDC_DEMAGNIFY + POPUP "Window &Size" + { + MENUITEM "1x", IDC_WINDOW1X + MENUITEM "2x", IDC_WINDOW2X + MENUITEM "3x", IDC_WINDOW3X + MENUITEM "4x", IDC_WINDOW4X + } + //MENUITEM "&Magnify", IDC_MAGNIFY + //MENUITEM "&DeMagnify", IDC_DEMAGNIFY MENUITEM "&Force Maintain Ratio", IDC_FORCERATIO } POPUP "&Config"