2013-08-29 20:13:22 +00:00
|
|
|
|
// Copyright (c) 2012- PPSSPP Project.
|
2013-07-29 09:23:27 +00:00
|
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation, version 2.0 or later versions.
|
|
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
|
|
// Official git repository and contact information can be found at
|
|
|
|
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
|
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
|
// NOTE: Apologies for the quality of this code, this is really from pre-opensource Dolphin - that is, 2003.
|
2013-07-29 09:23:27 +00:00
|
|
|
|
// It's improving slowly, though. :)
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-07-29 04:01:49 +00:00
|
|
|
|
#include "Common/CommonWindows.h"
|
2013-03-29 17:50:08 +00:00
|
|
|
|
|
2013-07-06 19:49:28 +00:00
|
|
|
|
#include <map>
|
|
|
|
|
|
2013-03-29 17:50:08 +00:00
|
|
|
|
#include "base/NativeApp.h"
|
2013-03-11 21:55:29 +00:00
|
|
|
|
#include "Globals.h"
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
|
|
|
|
#include "shellapi.h"
|
|
|
|
|
#include "commctrl.h"
|
|
|
|
|
|
2013-08-26 17:00:16 +00:00
|
|
|
|
#include "i18n/i18n.h"
|
2013-03-29 17:50:08 +00:00
|
|
|
|
#include "input/input_state.h"
|
2013-07-08 10:35:08 +00:00
|
|
|
|
#include "input/keycodes.h"
|
2013-08-26 17:00:16 +00:00
|
|
|
|
#include "util/text/utf8.h"
|
|
|
|
|
|
2013-03-11 21:55:29 +00:00
|
|
|
|
#include "Core/Debugger/SymbolMap.h"
|
|
|
|
|
#include "Windows/OpenGLBase.h"
|
|
|
|
|
#include "Windows/Debugger/Debugger_Disasm.h"
|
|
|
|
|
#include "Windows/Debugger/Debugger_MemoryDlg.h"
|
2012-11-01 15:19:01 +00:00
|
|
|
|
#include "main.h"
|
|
|
|
|
|
2013-03-11 21:55:29 +00:00
|
|
|
|
#include "Core/Core.h"
|
|
|
|
|
#include "Core/MemMap.h"
|
|
|
|
|
#include "Core/SaveState.h"
|
|
|
|
|
#include "Core/System.h"
|
|
|
|
|
#include "Core/Config.h"
|
2013-08-14 18:36:54 +00:00
|
|
|
|
#include "Core/HW/atrac3plus.h"
|
2013-03-11 21:55:29 +00:00
|
|
|
|
#include "Windows/EmuThread.h"
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
|
|
|
|
#include "resource.h"
|
|
|
|
|
|
2013-03-11 21:55:29 +00:00
|
|
|
|
#include "Windows/WndMainWindow.h"
|
2013-07-06 17:08:59 +00:00
|
|
|
|
#include "Windows/WindowsHost.h"
|
2013-03-11 21:55:29 +00:00
|
|
|
|
#include "Common/LogManager.h"
|
|
|
|
|
#include "Common/ConsoleListener.h"
|
|
|
|
|
#include "Windows/W32Util/DialogManager.h"
|
|
|
|
|
#include "Windows/W32Util/ShellUtil.h"
|
|
|
|
|
#include "Windows/W32Util/Misc.h"
|
|
|
|
|
#include "GPU/GPUInterface.h"
|
|
|
|
|
#include "GPU/GPUState.h"
|
2013-05-01 21:55:34 +00:00
|
|
|
|
#include "GPU/GLES/TextureScaler.h"
|
2013-07-29 08:46:40 +00:00
|
|
|
|
#include "GPU/GLES/TextureCache.h"
|
|
|
|
|
#include "GPU/GLES/Framebuffer.h"
|
2013-05-17 10:31:06 +00:00
|
|
|
|
#include "ControlMapping.h"
|
2013-05-22 16:00:06 +00:00
|
|
|
|
#include "UI/OnScreenDisplay.h"
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
|
|
|
|
#ifdef THEMES
|
|
|
|
|
#include "XPTheme.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-04-16 19:12:55 +00:00
|
|
|
|
#define ENABLE_TOUCH 0
|
|
|
|
|
|
2013-07-06 19:49:28 +00:00
|
|
|
|
extern std::map<int, int> windowsTransTable;
|
2013-05-04 21:21:06 +00:00
|
|
|
|
BOOL g_bFullScreen = FALSE;
|
2013-03-29 20:21:27 +00:00
|
|
|
|
static RECT g_normalRC = {0};
|
2013-06-22 20:27:59 +00:00
|
|
|
|
extern bool g_TakeScreenshot;
|
2013-03-29 17:50:08 +00:00
|
|
|
|
extern InputState input_state;
|
2013-07-07 08:42:39 +00:00
|
|
|
|
|
2013-05-04 21:21:06 +00:00
|
|
|
|
#define TIMER_CURSORUPDATE 1
|
2013-06-11 18:14:53 +00:00
|
|
|
|
#define TIMER_CURSORMOVEUPDATE 2
|
2013-05-04 21:54:22 +00:00
|
|
|
|
#define CURSORUPDATE_INTERVAL_MS 50
|
2013-06-11 18:14:53 +00:00
|
|
|
|
#define CURSORUPDATE_MOVE_TIMESPAN_MS 500
|
2013-04-18 09:13:00 +00:00
|
|
|
|
|
2013-08-12 21:26:01 +00:00
|
|
|
|
#ifndef HID_USAGE_PAGE_GENERIC
|
|
|
|
|
#define HID_USAGE_PAGE_GENERIC ((USHORT) 0x01)
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef HID_USAGE_GENERIC_MOUSE
|
|
|
|
|
#define HID_USAGE_GENERIC_MOUSE ((USHORT) 0x02)
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
|
namespace MainWindow
|
|
|
|
|
{
|
|
|
|
|
HWND hwndMain;
|
|
|
|
|
HWND hwndDisplay;
|
|
|
|
|
HWND hwndGameList;
|
2013-03-29 20:21:27 +00:00
|
|
|
|
static HMENU menu;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-03-29 20:21:27 +00:00
|
|
|
|
static HINSTANCE hInst;
|
2013-05-26 21:55:23 +00:00
|
|
|
|
static int cursorCounter = 0;
|
2013-06-11 18:14:53 +00:00
|
|
|
|
static int prevCursorX = -1;
|
|
|
|
|
static int prevCursorY = -1;
|
|
|
|
|
static bool mouseButtonDown = false;
|
|
|
|
|
static bool hideCursor = false;
|
2013-07-07 08:42:39 +00:00
|
|
|
|
static void *rawInputBuffer;
|
|
|
|
|
static size_t rawInputBufferSize;
|
2013-07-09 20:25:29 +00:00
|
|
|
|
static int currentSavestateSlot = 0;
|
2013-08-29 20:13:22 +00:00
|
|
|
|
static bool menusAreTranslated = false;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
|
|
|
|
#define MAX_LOADSTRING 100
|
2013-03-29 20:21:27 +00:00
|
|
|
|
const TCHAR *szTitle = TEXT("PPSSPP");
|
|
|
|
|
const TCHAR *szWindowClass = TEXT("PPSSPPWnd");
|
|
|
|
|
const TCHAR *szDisplayClass = TEXT("PPSSPPDisplay");
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-03-17 13:46:39 +00:00
|
|
|
|
// Forward declarations of functions included in this code module:
|
2012-11-01 15:19:01 +00:00
|
|
|
|
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
|
|
|
|
LRESULT CALLBACK DisplayProc(HWND, UINT, WPARAM, LPARAM);
|
|
|
|
|
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
|
|
|
|
|
|
2013-07-07 02:12:06 +00:00
|
|
|
|
HWND GetHWND() {
|
2012-11-01 15:19:01 +00:00
|
|
|
|
return hwndMain;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-07 02:12:06 +00:00
|
|
|
|
HWND GetDisplayHWND() {
|
2012-11-01 15:19:01 +00:00
|
|
|
|
return hwndDisplay;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-07 02:12:06 +00:00
|
|
|
|
void Init(HINSTANCE hInstance) {
|
2013-02-19 00:28:13 +00:00
|
|
|
|
#ifdef THEMES
|
|
|
|
|
WTL::CTheme::IsThemingSupported();
|
2012-11-01 15:19:01 +00:00
|
|
|
|
#endif
|
|
|
|
|
//Register classes
|
|
|
|
|
WNDCLASSEX wcex;
|
|
|
|
|
wcex.cbSize = sizeof(WNDCLASSEX);
|
|
|
|
|
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
|
|
|
|
wcex.lpfnWndProc = (WNDPROC)WndProc;
|
|
|
|
|
wcex.cbClsExtra = 0;
|
|
|
|
|
wcex.cbWndExtra = 0;
|
|
|
|
|
wcex.hInstance = hInstance;
|
|
|
|
|
wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_PPSSPP);
|
|
|
|
|
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
2012-12-05 06:31:41 +00:00
|
|
|
|
wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
|
2013-08-26 17:00:16 +00:00
|
|
|
|
wcex.lpszMenuName = (LPCWSTR)IDR_MENU1;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
wcex.lpszClassName = szWindowClass;
|
|
|
|
|
wcex.hIconSm = (HICON)LoadImage(hInstance, (LPCTSTR)IDI_PPSSPP, IMAGE_ICON, 16,16,LR_SHARED);
|
|
|
|
|
RegisterClassEx(&wcex);
|
|
|
|
|
|
|
|
|
|
wcex.style = CS_HREDRAW | CS_VREDRAW;;
|
|
|
|
|
wcex.lpfnWndProc = (WNDPROC)DisplayProc;
|
|
|
|
|
wcex.hIcon = 0;
|
|
|
|
|
wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
|
|
|
|
|
wcex.lpszMenuName = 0;
|
|
|
|
|
wcex.lpszClassName = szDisplayClass;
|
|
|
|
|
wcex.hIconSm = 0;
|
|
|
|
|
RegisterClassEx(&wcex);
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-17 16:46:05 +00:00
|
|
|
|
void GetWindowRectAtZoom(int zoom, RECT &rcInner, RECT &rcOuter) {
|
2013-03-30 23:25:10 +00:00
|
|
|
|
rcInner.left = 0;
|
|
|
|
|
rcInner.top = 0;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
rcInner.right=480*zoom;
|
|
|
|
|
rcInner.bottom=272*zoom;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2012-11-17 16:46:05 +00:00
|
|
|
|
rcOuter=rcInner;
|
|
|
|
|
AdjustWindowRect(&rcOuter, WS_OVERLAPPEDWINDOW, TRUE);
|
2013-03-30 23:25:10 +00:00
|
|
|
|
rcOuter.right += g_Config.iWindowX - rcOuter.left;
|
|
|
|
|
rcOuter.bottom += g_Config.iWindowY - rcOuter.top;
|
|
|
|
|
rcOuter.left = g_Config.iWindowX;
|
|
|
|
|
rcOuter.top = g_Config.iWindowY;
|
2012-11-17 16:46:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-03-30 16:49:02 +00:00
|
|
|
|
void SavePosition() {
|
|
|
|
|
WINDOWPLACEMENT placement;
|
|
|
|
|
GetWindowPlacement(hwndMain, &placement);
|
|
|
|
|
if (placement.showCmd == SW_SHOWNORMAL) {
|
|
|
|
|
RECT rc;
|
|
|
|
|
GetWindowRect(hwndMain, &rc);
|
|
|
|
|
g_Config.iWindowX = rc.left;
|
|
|
|
|
g_Config.iWindowY = rc.top;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-11 18:02:38 +00:00
|
|
|
|
void ResizeDisplay(bool noWindowMovement = false) {
|
2013-01-26 22:46:02 +00:00
|
|
|
|
RECT rc;
|
|
|
|
|
GetClientRect(hwndMain, &rc);
|
2013-02-11 18:02:38 +00:00
|
|
|
|
if (!noWindowMovement) {
|
|
|
|
|
|
|
|
|
|
if ((rc.right - rc.left) == PSP_CoreParameter().pixelWidth &&
|
|
|
|
|
(rc.bottom - rc.top) == PSP_CoreParameter().pixelHeight)
|
|
|
|
|
return;
|
|
|
|
|
PSP_CoreParameter().pixelWidth = rc.right - rc.left;
|
|
|
|
|
PSP_CoreParameter().pixelHeight = rc.bottom - rc.top;
|
|
|
|
|
MoveWindow(hwndDisplay, 0, 0, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight, TRUE);
|
|
|
|
|
}
|
2013-01-26 23:15:39 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
// Round up to a zoom factor for the render size.
|
2013-01-26 23:15:39 +00:00
|
|
|
|
int zoom = (rc.right - rc.left + 479) / 480;
|
2013-07-30 13:18:49 +00:00
|
|
|
|
if (g_Config.bAntiAliasing) zoom *= 2;
|
2013-01-26 23:15:39 +00:00
|
|
|
|
PSP_CoreParameter().renderWidth = 480 * zoom;
|
|
|
|
|
PSP_CoreParameter().renderHeight = 272 * zoom;
|
|
|
|
|
PSP_CoreParameter().outputWidth = 480 * zoom;
|
|
|
|
|
PSP_CoreParameter().outputHeight = 272 * zoom;
|
|
|
|
|
|
|
|
|
|
if (gpu)
|
|
|
|
|
gpu->Resized();
|
2013-01-26 22:46:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-07-26 12:25:11 +00:00
|
|
|
|
void setZoom(float zoom) {
|
2012-12-21 15:49:02 +00:00
|
|
|
|
if (zoom < 5)
|
2012-12-21 23:41:09 +00:00
|
|
|
|
g_Config.iWindowZoom = (int) zoom;
|
2013-07-29 22:05:08 +00:00
|
|
|
|
|
|
|
|
|
I18NCategory *g = GetI18NCategory("Graphics");
|
|
|
|
|
|
|
|
|
|
char message[256];
|
|
|
|
|
sprintf(message, "%dx Rendering Resolution", g_Config.iWindowZoom);
|
|
|
|
|
osm.Show(g->T(message));
|
|
|
|
|
|
2012-11-17 16:46:05 +00:00
|
|
|
|
RECT rc, rcOuter;
|
2012-12-21 23:41:09 +00:00
|
|
|
|
GetWindowRectAtZoom((int) zoom, rc, rcOuter);
|
2012-11-17 16:46:05 +00:00
|
|
|
|
MoveWindow(hwndMain, rcOuter.left, rcOuter.top, rcOuter.right - rcOuter.left, rcOuter.bottom - rcOuter.top, TRUE);
|
2013-01-26 22:46:02 +00:00
|
|
|
|
ResizeDisplay();
|
2012-11-01 15:19:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-26 21:55:23 +00:00
|
|
|
|
void CorrectCursor() {
|
2013-06-11 18:14:53 +00:00
|
|
|
|
bool autoHide = g_bFullScreen && !mouseButtonDown && globalUIState == UISTATE_INGAME;
|
|
|
|
|
if (autoHide && hideCursor) {
|
2013-05-26 21:55:23 +00:00
|
|
|
|
while (cursorCounter >= 0) {
|
|
|
|
|
cursorCounter = ShowCursor(FALSE);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2013-06-11 18:14:53 +00:00
|
|
|
|
hideCursor = !autoHide;
|
2013-05-26 21:55:23 +00:00
|
|
|
|
if (cursorCounter < 0) {
|
|
|
|
|
cursorCounter = ShowCursor(TRUE);
|
|
|
|
|
SetCursor(LoadCursor(NULL, IDC_ARROW));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-29 20:13:22 +00:00
|
|
|
|
std::string GetMenuItemText(int menuID) {
|
|
|
|
|
MENUITEMINFO menuInfo;
|
2013-08-30 13:27:16 +00:00
|
|
|
|
memset(&menuInfo, 0, sizeof(menuInfo));
|
2013-08-29 20:13:22 +00:00
|
|
|
|
menuInfo.cbSize = sizeof(MENUITEMINFO);
|
|
|
|
|
menuInfo.fMask = MIIM_STRING;
|
|
|
|
|
menuInfo.dwTypeData = 0;
|
|
|
|
|
|
|
|
|
|
GetMenuItemInfo(menu, menuID, MF_BYCOMMAND, &menuInfo);
|
|
|
|
|
wchar_t *buffer = new wchar_t[++menuInfo.cch];
|
|
|
|
|
menuInfo.dwTypeData = buffer;
|
|
|
|
|
GetMenuItemInfo(menu, menuID, MF_BYCOMMAND, &menuInfo);
|
|
|
|
|
std::string retVal(ConvertWStringToUTF8(menuInfo.dwTypeData));
|
|
|
|
|
delete [] buffer;
|
|
|
|
|
|
|
|
|
|
return retVal;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-29 22:27:11 +00:00
|
|
|
|
// These are used as an offset
|
|
|
|
|
// to determine which menu item to change.
|
2013-08-30 14:39:30 +00:00
|
|
|
|
// Make sure to count(from 0) the separators too, when dealing with submenus!!
|
2013-08-29 22:27:11 +00:00
|
|
|
|
enum MenuID{
|
2013-08-30 14:39:30 +00:00
|
|
|
|
// Main menus
|
2013-08-29 20:13:22 +00:00
|
|
|
|
MENU_FILE = 0,
|
|
|
|
|
MENU_EMULATION = 1,
|
|
|
|
|
MENU_DEBUG = 2,
|
|
|
|
|
MENU_OPTIONS = 3,
|
2013-08-29 21:11:08 +00:00
|
|
|
|
MENU_HELP = 4,
|
|
|
|
|
|
2013-08-30 14:39:30 +00:00
|
|
|
|
// Emulation submenus
|
2013-08-30 13:39:34 +00:00
|
|
|
|
SUBMENU_RENDERING_BACKEND = 11,
|
2013-08-29 21:11:08 +00:00
|
|
|
|
|
2013-08-30 14:39:30 +00:00
|
|
|
|
// Game Settings submenus
|
2013-08-29 21:11:08 +00:00
|
|
|
|
SUBMENU_RENDERING_RESOLUTION = 4,
|
|
|
|
|
SUBMENU_RENDERING_MODE = 5,
|
|
|
|
|
SUBMENU_FRAME_SKIPPING = 6,
|
|
|
|
|
SUBMENU_TEXTURE_FILTERING = 7,
|
|
|
|
|
SUBMENU_TEXTURE_SCALING = 8,
|
2013-08-29 20:13:22 +00:00
|
|
|
|
};
|
|
|
|
|
|
2013-08-30 21:29:22 +00:00
|
|
|
|
void TranslateMenuItembyText(const int menuID, const char *menuText, const char *category="", const bool enabled = true, const bool checked = false, const std::wstring& accelerator = L"") {
|
|
|
|
|
I18NCategory *c = GetI18NCategory(category);
|
|
|
|
|
std::string key = c->T(menuText);
|
|
|
|
|
std::wstring translated = ConvertUTF8ToWString(key);
|
|
|
|
|
translated.append(accelerator);
|
2013-08-31 05:16:41 +00:00
|
|
|
|
ModifyMenu(menu, menuID, MF_STRING
|
|
|
|
|
| (enabled? MF_ENABLED : MF_GRAYED)
|
|
|
|
|
| (checked? MF_CHECKED : MF_UNCHECKED),
|
2013-08-30 21:29:22 +00:00
|
|
|
|
menuID, translated.c_str());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-29 22:27:11 +00:00
|
|
|
|
void TranslateMenuHeader(HMENU menu, const char *category, const char *key, const MenuID id, const std::wstring& accelerator = L"") {
|
|
|
|
|
I18NCategory *c = GetI18NCategory(category);
|
|
|
|
|
std::string s_key = c->T(key);
|
|
|
|
|
std::wstring translated = ConvertUTF8ToWString(s_key);
|
|
|
|
|
translated.append(accelerator);
|
|
|
|
|
ModifyMenu(menu, id, MF_BYPOSITION | MF_STRING, 0, translated.c_str());
|
|
|
|
|
}
|
2013-08-29 21:11:08 +00:00
|
|
|
|
|
2013-08-29 22:27:11 +00:00
|
|
|
|
void TranslateSubMenuHeader(HMENU menu, const char *category, const char *key, MenuID mainMenuID, MenuID subMenuID, const std::wstring& accelerator = L"") {
|
2013-08-29 21:11:08 +00:00
|
|
|
|
HMENU subMenu;
|
2013-08-29 22:27:11 +00:00
|
|
|
|
subMenu = GetSubMenu(menu, mainMenuID);
|
|
|
|
|
I18NCategory *c = GetI18NCategory(category);
|
|
|
|
|
std::string s_key = c->T(key);
|
|
|
|
|
std::wstring translated = ConvertUTF8ToWString(s_key);
|
|
|
|
|
translated.append(accelerator);
|
|
|
|
|
ModifyMenu(subMenu, subMenuID, MF_BYPOSITION | MF_STRING, 0, translated.c_str());
|
2013-08-29 20:13:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TranslateMenuItem(const int menuID, const char *category, const bool enabled = true, const bool checked = false, const std::wstring& accelerator = L"") {
|
|
|
|
|
I18NCategory *c = GetI18NCategory(category);
|
|
|
|
|
std::string key = c->T(GetMenuItemText(menuID).c_str());
|
|
|
|
|
std::wstring translated = ConvertUTF8ToWString(key);
|
|
|
|
|
translated.append(accelerator);
|
|
|
|
|
ModifyMenu(menu, menuID, MF_STRING
|
2013-08-31 05:16:41 +00:00
|
|
|
|
| (enabled? MF_ENABLED : MF_GRAYED)
|
|
|
|
|
| (checked? MF_CHECKED : MF_UNCHECKED),
|
2013-08-29 20:13:22 +00:00
|
|
|
|
menuID, translated.c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TranslateMenus() {
|
|
|
|
|
if(menusAreTranslated) return;
|
2013-08-30 18:19:03 +00:00
|
|
|
|
menusAreTranslated = true;
|
|
|
|
|
|
2013-08-29 20:13:22 +00:00
|
|
|
|
const char *desktopUI = "DesktopUI";
|
|
|
|
|
const char *mainMenu = "MainMenu";
|
|
|
|
|
const char *graphics = "Graphics";
|
|
|
|
|
const char *system = "System";
|
|
|
|
|
const char *audio = "Audio";
|
|
|
|
|
const char *general = "General";
|
|
|
|
|
const char *pause = "Pause";
|
2013-08-30 21:29:22 +00:00
|
|
|
|
const char *credits = "PSPCredits";
|
2013-08-29 20:13:22 +00:00
|
|
|
|
|
|
|
|
|
// File menu
|
|
|
|
|
TranslateMenuItem(ID_FILE_LOAD, mainMenu);
|
|
|
|
|
TranslateMenuItem(ID_FILE_LOAD_DIR, desktopUI);
|
|
|
|
|
TranslateMenuItem(ID_FILE_LOAD_MEMSTICK, desktopUI);
|
|
|
|
|
TranslateMenuItem(ID_FILE_MEMSTICK, desktopUI);
|
|
|
|
|
TranslateMenuItem(ID_FILE_QUICKLOADSTATE, pause, false, false, L"\tF4");
|
|
|
|
|
TranslateMenuItem(ID_FILE_QUICKSAVESTATE, pause, false, false, L"\tF2");
|
|
|
|
|
TranslateMenuItem(ID_FILE_LOADSTATEFILE, desktopUI, false, false);
|
|
|
|
|
TranslateMenuItem(ID_FILE_SAVESTATEFILE, desktopUI, false, false);
|
|
|
|
|
TranslateMenuItem(ID_FILE_EXIT, mainMenu);
|
|
|
|
|
|
|
|
|
|
// Emulation menu
|
|
|
|
|
TranslateMenuItem(ID_TOGGLE_PAUSE, desktopUI, false, false, L"\tF8");
|
|
|
|
|
TranslateMenuItem(ID_EMULATION_STOP, desktopUI, false, false, L"\tCtrl+W");
|
|
|
|
|
TranslateMenuItem(ID_EMULATION_RESET, desktopUI, false, false, L"\tCtrl+B");
|
|
|
|
|
TranslateMenuItem(ID_EMULATION_RUNONLOAD, desktopUI);
|
|
|
|
|
TranslateMenuItem(ID_EMULATION_SOUND, audio, true, true);
|
2013-08-29 21:11:08 +00:00
|
|
|
|
TranslateMenuItem(ID_EMULATION_ATRAC3_SOUND, audio, true, false);
|
2013-08-29 20:13:22 +00:00
|
|
|
|
TranslateMenuItem(ID_EMULATION_CHEATS, system);
|
|
|
|
|
TranslateMenuItem(ID_EMULATION_RENDER_MODE_OGL, graphics, true, true);
|
|
|
|
|
TranslateMenuItem(ID_EMULATION_RENDER_MODE_SOFT, graphics);
|
|
|
|
|
TranslateMenuItem(ID_CPU_INTERPRETER, desktopUI);
|
|
|
|
|
TranslateMenuItem(ID_CPU_DYNAREC, system);
|
|
|
|
|
TranslateMenuItem(ID_CPU_MULTITHREADED, system);
|
|
|
|
|
TranslateMenuItem(ID_IO_MULTITHREADED, system);
|
|
|
|
|
|
|
|
|
|
// Debug menu
|
|
|
|
|
TranslateMenuItem(ID_DEBUG_LOADMAPFILE, desktopUI);
|
|
|
|
|
TranslateMenuItem(ID_DEBUG_SAVEMAPFILE, desktopUI);
|
|
|
|
|
TranslateMenuItem(ID_DEBUG_RESETSYMBOLTABLE, desktopUI);
|
|
|
|
|
TranslateMenuItem(ID_DEBUG_DUMPNEXTFRAME, graphics);
|
2013-08-29 21:11:08 +00:00
|
|
|
|
TranslateMenuItem(ID_DEBUG_TAKESCREENSHOT, desktopUI, true, false, L"\tF12");
|
|
|
|
|
TranslateMenuItem(ID_DEBUG_DISASSEMBLY, desktopUI, true, false, L"\tCtrl+D");
|
|
|
|
|
TranslateMenuItem(ID_DEBUG_LOG, desktopUI, true, false, L"\tCtrl+L");
|
|
|
|
|
TranslateMenuItem(ID_DEBUG_MEMORYVIEW, desktopUI, L"\tCtrl+M");
|
2013-08-29 20:13:22 +00:00
|
|
|
|
|
|
|
|
|
// Options menu
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_FULLSCREEN, graphics, true, false, L"\tAlt+Return, F11");
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_TOPMOST, desktopUI);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_STRETCHDISPLAY, graphics);
|
2013-08-29 21:11:08 +00:00
|
|
|
|
TranslateMenuItem(ID_OPTIONS_SCREEN1X, desktopUI, true, false);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_SCREEN2X, desktopUI, true, true);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_SCREEN3X, desktopUI, true, false);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_SCREEN4X, desktopUI, true, false);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_NONBUFFEREDRENDERING, graphics, true, false);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_BUFFEREDRENDERING, graphics, true, true);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_READFBOTOMEMORYCPU, graphics, true, false);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_READFBOTOMEMORYGPU, graphics, true, false);
|
2013-08-29 20:13:22 +00:00
|
|
|
|
TranslateMenuItem(ID_OPTIONS_FRAMESKIP_0, graphics);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_FRAMESKIP_AUTO, graphics);
|
|
|
|
|
// Skip frameskipping 2-8..
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_TEXTUREFILTERING_AUTO, graphics);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_NEARESTFILTERING, graphics);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_LINEARFILTERING, graphics);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_LINEARFILTERING_CG, graphics);
|
|
|
|
|
TranslateMenuItem(ID_TEXTURESCALING_OFF, graphics);
|
2013-08-29 21:35:01 +00:00
|
|
|
|
// Skip texture scaling 2x-5x...
|
2013-08-29 20:13:22 +00:00
|
|
|
|
TranslateMenuItem(ID_TEXTURESCALING_XBRZ, graphics);
|
|
|
|
|
TranslateMenuItem(ID_TEXTURESCALING_HYBRID, graphics);
|
|
|
|
|
TranslateMenuItem(ID_TEXTURESCALING_BICUBIC, graphics);
|
|
|
|
|
TranslateMenuItem(ID_TEXTURESCALING_HYBRID_BICUBIC, graphics);
|
|
|
|
|
TranslateMenuItem(ID_TEXTURESCALING_DEPOSTERIZE, graphics);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_HARDWARETRANSFORM, graphics, true, true, L"\tF6");
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_VERTEXCACHE, graphics);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_MIPMAP, graphics);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_ANTIALIASING, graphics);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_VSYNC, graphics);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_SHOWFPS, graphics);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_SHOWDEBUGSTATISTICS, graphics);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_FASTMEMORY, system);
|
|
|
|
|
TranslateMenuItem(ID_OPTIONS_IGNOREILLEGALREADS, desktopUI);
|
|
|
|
|
|
|
|
|
|
// Help menu
|
|
|
|
|
TranslateMenuItem(ID_HELP_OPENWEBSITE, desktopUI);
|
2013-08-30 21:29:22 +00:00
|
|
|
|
TranslateMenuItem(ID_HELP_OPENFORUM, credits);
|
|
|
|
|
TranslateMenuItem(ID_HELP_BUYGOLD, credits);
|
2013-08-29 20:13:22 +00:00
|
|
|
|
TranslateMenuItem(ID_HELP_ABOUT, desktopUI);
|
|
|
|
|
|
2013-08-29 22:27:11 +00:00
|
|
|
|
// Now do the menu headers and a few submenus...
|
|
|
|
|
TranslateMenuHeader(menu, desktopUI, "File", MENU_FILE);
|
2013-08-30 21:29:22 +00:00
|
|
|
|
TranslateMenuHeader(menu, system, "Emulation", MENU_EMULATION);
|
2013-08-29 22:27:11 +00:00
|
|
|
|
TranslateMenuHeader(menu, graphics, "Debugging", MENU_DEBUG);
|
2013-08-30 21:29:22 +00:00
|
|
|
|
TranslateMenuHeader(menu, mainMenu, "Game Settings", MENU_OPTIONS);
|
2013-08-29 22:27:11 +00:00
|
|
|
|
TranslateMenuHeader(menu, desktopUI, "Help", MENU_HELP);
|
|
|
|
|
|
2013-08-30 13:39:34 +00:00
|
|
|
|
TranslateSubMenuHeader(menu, desktopUI, "Rendering Backend", MENU_EMULATION, SUBMENU_RENDERING_BACKEND);
|
2013-08-30 13:52:45 +00:00
|
|
|
|
TranslateSubMenuHeader(menu, desktopUI, "Rendering Resolution", MENU_OPTIONS, SUBMENU_RENDERING_RESOLUTION, L"\tCtrl+1");
|
2013-08-30 13:39:34 +00:00
|
|
|
|
TranslateSubMenuHeader(menu, graphics, "Rendering Mode", MENU_OPTIONS, SUBMENU_RENDERING_MODE, L"\tF5");
|
2013-08-29 22:57:11 +00:00
|
|
|
|
TranslateSubMenuHeader(menu, graphics, "Frame Skipping", MENU_OPTIONS, SUBMENU_FRAME_SKIPPING, L"\tF7");
|
2013-08-30 13:39:34 +00:00
|
|
|
|
TranslateSubMenuHeader(menu, graphics, "Texture Filtering", MENU_OPTIONS, SUBMENU_TEXTURE_FILTERING);
|
2013-08-29 22:57:11 +00:00
|
|
|
|
TranslateSubMenuHeader(menu, graphics, "Texture Scaling", MENU_OPTIONS, SUBMENU_TEXTURE_SCALING);
|
2013-08-29 22:27:11 +00:00
|
|
|
|
|
2013-08-29 20:13:22 +00:00
|
|
|
|
DrawMenuBar(hwndMain);
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
void setTexScalingMultiplier(int level) {
|
2013-07-26 12:25:11 +00:00
|
|
|
|
g_Config.iTexScalingLevel = level;
|
2013-05-01 21:55:34 +00:00
|
|
|
|
if(gpu) gpu->ClearCacheNextFrame();
|
|
|
|
|
}
|
2013-06-30 06:48:50 +00:00
|
|
|
|
|
2013-07-26 12:25:11 +00:00
|
|
|
|
void setTexFiltering(int type) {
|
|
|
|
|
g_Config.iTexFiltering = type;
|
2013-06-30 06:48:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-07-26 12:25:11 +00:00
|
|
|
|
void setTexScalingType(int type) {
|
|
|
|
|
g_Config.iTexScalingType = type;
|
2013-04-30 15:20:28 +00:00
|
|
|
|
if(gpu) gpu->ClearCacheNextFrame();
|
2013-04-30 01:47:33 +00:00
|
|
|
|
}
|
2013-06-30 06:48:50 +00:00
|
|
|
|
|
2013-07-26 12:25:11 +00:00
|
|
|
|
void setRenderingMode(int mode) {
|
|
|
|
|
g_Config.iRenderingMode = mode;
|
2013-07-29 22:05:08 +00:00
|
|
|
|
|
|
|
|
|
I18NCategory *g = GetI18NCategory("Graphics");
|
|
|
|
|
|
|
|
|
|
switch(g_Config.iRenderingMode) {
|
|
|
|
|
case FB_NON_BUFFERED_MODE:
|
|
|
|
|
osm.Show(g->T("Non-Buffered Rendering"));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FB_BUFFERED_MODE:
|
|
|
|
|
osm.Show(g->T("Buffered Rendering"));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FB_READFBOMEMORY_CPU:
|
|
|
|
|
osm.Show(g->T("Read Framebuffer to Memory (CPU)"));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FB_READFBOMEMORY_GPU:
|
|
|
|
|
osm.Show(g->T("Read Framebuffer to Memory (GPU)"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-21 23:33:18 +00:00
|
|
|
|
if (gpu) gpu->Resized();
|
2013-07-21 15:17:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-10 00:36:23 +00:00
|
|
|
|
void setFpsLimit(int fps) {
|
|
|
|
|
g_Config.iFpsLimit = fps;
|
|
|
|
|
}
|
2013-06-30 06:48:50 +00:00
|
|
|
|
|
2013-07-29 09:00:57 +00:00
|
|
|
|
void setFrameSkipping(int framesToSkip) {
|
|
|
|
|
g_Config.iFrameSkip = framesToSkip;
|
2013-08-21 11:44:08 +00:00
|
|
|
|
|
|
|
|
|
I18NCategory *g = GetI18NCategory("Graphics");
|
2013-08-21 17:47:21 +00:00
|
|
|
|
const char *frameskipStr = g->T("Frame Skipping");
|
2013-08-21 12:31:10 +00:00
|
|
|
|
const char *offStr = g->T("Off");
|
|
|
|
|
const char *autoStr = g->T("Auto");
|
2013-08-21 17:22:13 +00:00
|
|
|
|
|
2013-08-21 17:35:26 +00:00
|
|
|
|
char message[256];
|
|
|
|
|
memset(message, 0, sizeof(message));
|
2013-08-21 17:22:13 +00:00
|
|
|
|
|
2013-08-21 11:44:08 +00:00
|
|
|
|
switch(g_Config.iFrameSkip) {
|
|
|
|
|
case 0:
|
2013-08-21 17:35:26 +00:00
|
|
|
|
sprintf(message, "%s: %s", frameskipStr, offStr);
|
2013-08-21 11:44:08 +00:00
|
|
|
|
break;
|
2013-08-21 17:35:26 +00:00
|
|
|
|
case 1:
|
|
|
|
|
sprintf(message, "%s: %s", frameskipStr, autoStr);
|
2013-08-21 11:44:08 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
2013-08-21 17:35:26 +00:00
|
|
|
|
sprintf(message, "%s: %d", frameskipStr, g_Config.iFrameSkip);
|
2013-08-21 11:44:08 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2013-08-21 17:35:26 +00:00
|
|
|
|
|
2013-08-21 12:31:10 +00:00
|
|
|
|
osm.Show(message);
|
2013-08-21 17:35:26 +00:00
|
|
|
|
}
|
2013-07-26 12:25:11 +00:00
|
|
|
|
|
2013-07-29 19:34:30 +00:00
|
|
|
|
void enableCheats(bool cheats) {
|
2013-05-23 11:10:39 +00:00
|
|
|
|
g_Config.bEnableCheats = cheats;
|
2013-05-18 22:04:01 +00:00
|
|
|
|
}
|
2013-04-30 01:47:33 +00:00
|
|
|
|
|
2013-07-29 19:34:30 +00:00
|
|
|
|
BOOL Show(HINSTANCE hInstance, int nCmdShow) {
|
2013-07-29 08:46:40 +00:00
|
|
|
|
hInst = hInstance; // Store instance handle in our global variable.
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2012-11-17 16:46:05 +00:00
|
|
|
|
int zoom = g_Config.iWindowZoom;
|
|
|
|
|
if (zoom < 1) zoom = 1;
|
|
|
|
|
if (zoom > 4) zoom = 4;
|
|
|
|
|
|
2013-06-08 00:32:07 +00:00
|
|
|
|
RECT rc, rcOrig;
|
2012-11-17 16:46:05 +00:00
|
|
|
|
GetWindowRectAtZoom(zoom, rcOrig, rc);
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-03-29 20:21:27 +00:00
|
|
|
|
u32 style = WS_OVERLAPPEDWINDOW;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-08-26 17:00:16 +00:00
|
|
|
|
hwndMain = CreateWindowEx(0,szWindowClass, L"", style,
|
2013-06-08 00:32:07 +00:00
|
|
|
|
rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, NULL, NULL, hInstance, NULL);
|
2012-11-01 15:19:01 +00:00
|
|
|
|
if (!hwndMain)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2013-08-26 17:00:16 +00:00
|
|
|
|
hwndDisplay = CreateWindowEx(0, szDisplayClass, L"", WS_CHILD | WS_VISIBLE,
|
2013-06-08 00:32:07 +00:00
|
|
|
|
rcOrig.left, rcOrig.top, rcOrig.right - rcOrig.left, rcOrig.bottom - rcOrig.top, hwndMain, 0, hInstance, 0);
|
|
|
|
|
if (!hwndDisplay)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
|
menu = GetMenu(hwndMain);
|
2013-08-29 22:27:11 +00:00
|
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
|
#ifdef FINAL
|
|
|
|
|
RemoveMenu(menu,2,MF_BYPOSITION);
|
|
|
|
|
RemoveMenu(menu,2,MF_BYPOSITION);
|
|
|
|
|
#endif
|
|
|
|
|
MENUINFO info;
|
|
|
|
|
ZeroMemory(&info,sizeof(MENUINFO));
|
|
|
|
|
info.cbSize = sizeof(MENUINFO);
|
|
|
|
|
info.cyMax = 0;
|
|
|
|
|
info.dwStyle = MNS_CHECKORBMP;
|
|
|
|
|
info.fMask = MIM_STYLE;
|
2013-07-29 19:34:30 +00:00
|
|
|
|
for (int i = 0; i < GetMenuItemCount(menu); i++) {
|
2012-11-01 15:19:01 +00:00
|
|
|
|
SetMenuInfo(GetSubMenu(menu,i),&info);
|
|
|
|
|
}
|
2013-06-08 00:32:07 +00:00
|
|
|
|
UpdateMenus();
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
// Accept dragged files.
|
2012-11-01 15:19:01 +00:00
|
|
|
|
DragAcceptFiles(hwndMain, TRUE);
|
|
|
|
|
|
2013-06-11 18:14:53 +00:00
|
|
|
|
hideCursor = true;
|
2013-06-08 00:32:07 +00:00
|
|
|
|
SetTimer(hwndMain, TIMER_CURSORUPDATE, CURSORUPDATE_INTERVAL_MS, 0);
|
2013-08-29 21:27:46 +00:00
|
|
|
|
|
2013-06-08 00:32:07 +00:00
|
|
|
|
Update();
|
2013-07-10 18:22:22 +00:00
|
|
|
|
|
|
|
|
|
if(g_Config.bFullScreenOnLaunch)
|
|
|
|
|
_ViewFullScreen(hwndMain);
|
2013-06-08 00:32:07 +00:00
|
|
|
|
|
|
|
|
|
ShowWindow(hwndMain, nCmdShow);
|
|
|
|
|
|
2013-07-06 17:47:37 +00:00
|
|
|
|
W32Util::MakeTopMost(hwndMain, g_Config.bTopMost);
|
|
|
|
|
|
2013-04-16 19:12:55 +00:00
|
|
|
|
#if ENABLE_TOUCH
|
|
|
|
|
RegisterTouchWindow(hwndDisplay, TWF_WANTPALM);
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-08-12 21:26:01 +00:00
|
|
|
|
RAWINPUTDEVICE dev[2];
|
|
|
|
|
memset(dev, 0, sizeof(dev));
|
|
|
|
|
|
|
|
|
|
dev[0].usUsagePage = 1;
|
|
|
|
|
dev[0].usUsage = 6;
|
|
|
|
|
dev[0].dwFlags = 0;
|
|
|
|
|
|
|
|
|
|
dev[1].usUsagePage = HID_USAGE_PAGE_GENERIC;
|
|
|
|
|
dev[1].usUsage = HID_USAGE_GENERIC_MOUSE;
|
|
|
|
|
dev[1].dwFlags = 0;
|
|
|
|
|
RegisterRawInputDevices(dev, 2, sizeof(RAWINPUTDEVICE));
|
2013-07-07 08:42:39 +00:00
|
|
|
|
|
2013-05-04 21:21:06 +00:00
|
|
|
|
SetFocus(hwndDisplay);
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-26 12:19:46 +00:00
|
|
|
|
void CreateDebugWindows() {
|
|
|
|
|
disasmWindow[0] = new CDisasm(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS);
|
|
|
|
|
DialogManager::AddDlg(disasmWindow[0]);
|
2013-08-26 15:41:31 +00:00
|
|
|
|
EnableWindow(disasmWindow[0]->GetDlgHandle(),FALSE);
|
2013-08-26 12:19:46 +00:00
|
|
|
|
disasmWindow[0]->Show(g_Config.bShowDebuggerOnLoad);
|
|
|
|
|
|
|
|
|
|
memoryWindow[0] = new CMemoryDlg(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS);
|
|
|
|
|
DialogManager::AddDlg(memoryWindow[0]);
|
2013-08-26 15:41:31 +00:00
|
|
|
|
EnableWindow(memoryWindow[0]->GetDlgHandle(),FALSE);
|
2013-08-26 12:19:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-07-29 19:34:30 +00:00
|
|
|
|
void BrowseAndBoot(std::string defaultPath, bool browseDirectory) {
|
2013-03-28 21:31:51 +00:00
|
|
|
|
std::string fn;
|
2013-05-25 05:45:28 +00:00
|
|
|
|
std::string filter = "PSP ROMs (*.iso *.cso *.pbp *.elf)|*.pbp;*.elf;*.iso;*.cso;*.prx|All files (*.*)|*.*||";
|
2013-05-24 16:46:20 +00:00
|
|
|
|
|
2013-07-29 19:34:30 +00:00
|
|
|
|
for (int i=0; i<(int)filter.length(); i++) {
|
2012-11-01 15:19:01 +00:00
|
|
|
|
if (filter[i] == '|')
|
|
|
|
|
filter[i] = '\0';
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
// Pause if a game is being played.
|
2013-07-17 05:33:26 +00:00
|
|
|
|
bool isPaused = false;
|
2013-07-29 19:34:30 +00:00
|
|
|
|
if (globalUIState == UISTATE_INGAME) {
|
2013-07-17 05:33:26 +00:00
|
|
|
|
isPaused = Core_IsStepping();
|
|
|
|
|
if (!isPaused)
|
|
|
|
|
Core_EnableStepping(true);
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-29 19:34:30 +00:00
|
|
|
|
if (browseDirectory) {
|
2013-07-23 15:24:33 +00:00
|
|
|
|
std::string dir = W32Util::BrowseForFolder(GetHWND(),"Choose directory");
|
2013-07-29 19:34:30 +00:00
|
|
|
|
if (dir == "") {
|
2013-07-23 16:16:21 +00:00
|
|
|
|
if (!isPaused)
|
|
|
|
|
Core_EnableStepping(false);
|
2013-07-23 15:24:33 +00:00
|
|
|
|
}
|
2013-07-29 19:34:30 +00:00
|
|
|
|
else {
|
|
|
|
|
if (globalUIState == UISTATE_INGAME || globalUIState == UISTATE_PAUSEMENU) {
|
2013-07-23 15:24:33 +00:00
|
|
|
|
Core_EnableStepping(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NativeMessageReceived("boot", dir.c_str());
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-08-26 19:32:05 +00:00
|
|
|
|
else if (W32Util::BrowseForFileName(true, GetHWND(), L"Load File", defaultPath.size() ? ConvertUTF8ToWString(defaultPath).c_str() : 0, ConvertUTF8ToWString(filter).c_str(), L"*.pbp;*.elf;*.iso;*.cso;",fn))
|
2012-11-01 15:19:01 +00:00
|
|
|
|
{
|
2013-07-29 19:34:30 +00:00
|
|
|
|
if (globalUIState == UISTATE_INGAME || globalUIState == UISTATE_PAUSEMENU) {
|
2013-07-17 05:33:26 +00:00
|
|
|
|
Core_EnableStepping(false);
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
// Decode the filename with fullpath.
|
2012-11-01 15:19:01 +00:00
|
|
|
|
std::string fullpath = fn;
|
|
|
|
|
char drive[MAX_PATH];
|
|
|
|
|
char dir[MAX_PATH];
|
|
|
|
|
char fname[MAX_PATH];
|
|
|
|
|
char ext[MAX_PATH];
|
|
|
|
|
_splitpath(fullpath.c_str(), drive, dir, fname, ext);
|
|
|
|
|
|
|
|
|
|
std::string executable = std::string(drive) + std::string(dir) + std::string(fname) + std::string(ext);
|
2013-03-29 18:32:20 +00:00
|
|
|
|
NativeMessageReceived("boot", executable.c_str());
|
2012-11-01 15:19:01 +00:00
|
|
|
|
}
|
2013-07-29 19:34:30 +00:00
|
|
|
|
else {
|
2013-07-17 05:33:26 +00:00
|
|
|
|
if (!isPaused)
|
|
|
|
|
Core_EnableStepping(false);
|
|
|
|
|
}
|
2012-11-01 15:19:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-07-29 19:34:30 +00:00
|
|
|
|
LRESULT CALLBACK DisplayProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
|
|
|
|
|
switch (message) {
|
2012-11-01 15:19:01 +00:00
|
|
|
|
case WM_ACTIVATE:
|
|
|
|
|
break;
|
2013-07-29 19:34:30 +00:00
|
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
|
case WM_SETFOCUS:
|
|
|
|
|
break;
|
2013-07-29 19:34:30 +00:00
|
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
|
case WM_SIZE:
|
|
|
|
|
break;
|
2013-03-29 18:32:20 +00:00
|
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
|
case WM_ERASEBKGND:
|
2013-07-29 19:34:30 +00:00
|
|
|
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
2013-03-29 18:32:20 +00:00
|
|
|
|
|
2013-06-01 21:34:50 +00:00
|
|
|
|
// Poor man's touch - mouse input. We send the data both as an input_state pointer,
|
|
|
|
|
// and as asynchronous touch events for minimal latency.
|
|
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
|
case WM_LBUTTONDOWN:
|
2013-03-29 17:50:08 +00:00
|
|
|
|
{
|
2013-07-09 20:51:02 +00:00
|
|
|
|
// Hack: Take the opportunity to show the cursor.
|
|
|
|
|
mouseButtonDown = true;
|
|
|
|
|
{
|
|
|
|
|
lock_guard guard(input_state.lock);
|
|
|
|
|
input_state.mouse_valid = true;
|
|
|
|
|
input_state.pointer_down[0] = true;
|
2013-04-01 02:15:59 +00:00
|
|
|
|
|
2013-07-09 20:51:02 +00:00
|
|
|
|
int factor = g_Config.iWindowZoom == 1 ? 2 : 1;
|
|
|
|
|
input_state.pointer_x[0] = GET_X_LPARAM(lParam) * factor;
|
|
|
|
|
input_state.pointer_y[0] = GET_Y_LPARAM(lParam) * factor;
|
|
|
|
|
}
|
2013-06-01 21:34:50 +00:00
|
|
|
|
|
|
|
|
|
TouchInput touch;
|
|
|
|
|
touch.id = 0;
|
|
|
|
|
touch.flags = TOUCH_DOWN;
|
2013-07-09 12:46:15 +00:00
|
|
|
|
touch.x = input_state.pointer_x[0];
|
|
|
|
|
touch.y = input_state.pointer_y[0];
|
2013-06-01 21:34:50 +00:00
|
|
|
|
NativeTouch(touch);
|
2013-07-09 20:51:02 +00:00
|
|
|
|
SetCapture(hWnd);
|
2013-07-29 19:34:30 +00:00
|
|
|
|
|
2013-03-29 17:50:08 +00:00
|
|
|
|
}
|
2013-07-29 19:34:30 +00:00
|
|
|
|
break;
|
2013-03-29 17:50:08 +00:00
|
|
|
|
|
|
|
|
|
case WM_MOUSEMOVE:
|
|
|
|
|
{
|
2013-06-11 18:14:53 +00:00
|
|
|
|
// Hack: Take the opportunity to show the cursor.
|
|
|
|
|
mouseButtonDown = (wParam & MK_LBUTTON) != 0;
|
|
|
|
|
int cursorX = GET_X_LPARAM(lParam);
|
|
|
|
|
int cursorY = GET_Y_LPARAM(lParam);
|
|
|
|
|
if (abs(cursorX - prevCursorX) > 1 || abs(cursorY - prevCursorY) > 1) {
|
|
|
|
|
hideCursor = false;
|
|
|
|
|
SetTimer(hwndMain, TIMER_CURSORMOVEUPDATE, CURSORUPDATE_MOVE_TIMESPAN_MS, 0);
|
|
|
|
|
}
|
|
|
|
|
prevCursorX = cursorX;
|
|
|
|
|
prevCursorY = cursorY;
|
|
|
|
|
|
2013-07-09 20:51:02 +00:00
|
|
|
|
{
|
|
|
|
|
lock_guard guard(input_state.lock);
|
|
|
|
|
int factor = g_Config.iWindowZoom == 1 ? 2 : 1;
|
|
|
|
|
input_state.pointer_x[0] = GET_X_LPARAM(lParam) * factor;
|
|
|
|
|
input_state.pointer_y[0] = GET_Y_LPARAM(lParam) * factor;
|
|
|
|
|
}
|
2013-06-01 21:34:50 +00:00
|
|
|
|
|
|
|
|
|
if (wParam & MK_LBUTTON) {
|
|
|
|
|
TouchInput touch;
|
|
|
|
|
touch.id = 0;
|
|
|
|
|
touch.flags = TOUCH_MOVE;
|
2013-07-09 12:46:15 +00:00
|
|
|
|
touch.x = input_state.pointer_x[0];
|
|
|
|
|
touch.y = input_state.pointer_y[0];
|
2013-06-01 21:34:50 +00:00
|
|
|
|
NativeTouch(touch);
|
2013-04-01 02:15:59 +00:00
|
|
|
|
}
|
2013-03-29 17:50:08 +00:00
|
|
|
|
}
|
2012-11-01 15:19:01 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2013-03-29 17:50:08 +00:00
|
|
|
|
case WM_LBUTTONUP:
|
|
|
|
|
{
|
2013-07-09 20:51:02 +00:00
|
|
|
|
// Hack: Take the opportunity to hide the cursor.
|
|
|
|
|
mouseButtonDown = false;
|
|
|
|
|
{
|
|
|
|
|
lock_guard guard(input_state.lock);
|
|
|
|
|
input_state.pointer_down[0] = false;
|
|
|
|
|
int factor = g_Config.iWindowZoom == 1 ? 2 : 1;
|
|
|
|
|
input_state.pointer_x[0] = GET_X_LPARAM(lParam) * factor;
|
|
|
|
|
input_state.pointer_y[0] = GET_Y_LPARAM(lParam) * factor;
|
|
|
|
|
}
|
2013-06-01 21:34:50 +00:00
|
|
|
|
TouchInput touch;
|
|
|
|
|
touch.id = 0;
|
|
|
|
|
touch.flags = TOUCH_UP;
|
2013-07-09 12:46:15 +00:00
|
|
|
|
touch.x = input_state.pointer_x[0];
|
|
|
|
|
touch.y = input_state.pointer_y[0];
|
2013-06-01 21:34:50 +00:00
|
|
|
|
NativeTouch(touch);
|
2013-07-09 20:51:02 +00:00
|
|
|
|
ReleaseCapture();
|
2013-03-29 17:50:08 +00:00
|
|
|
|
}
|
2013-07-29 19:34:30 +00:00
|
|
|
|
break;
|
2013-03-29 17:50:08 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
// Actual touch! Unfinished...
|
2013-06-01 21:34:50 +00:00
|
|
|
|
|
2013-04-16 19:12:55 +00:00
|
|
|
|
case WM_TOUCH:
|
|
|
|
|
{
|
|
|
|
|
// TODO: Enabling this section will probably break things on Windows XP.
|
|
|
|
|
// We probably need to manually fetch pointers to GetTouchInputInfo and CloseTouchInputHandle.
|
|
|
|
|
#if ENABLE_TOUCH
|
|
|
|
|
UINT inputCount = LOWORD(wParam);
|
|
|
|
|
TOUCHINPUT *inputs = new TOUCHINPUT[inputCount];
|
|
|
|
|
if (GetTouchInputInfo((HTOUCHINPUT)lParam,
|
|
|
|
|
inputCount,
|
|
|
|
|
inputs,
|
|
|
|
|
sizeof(TOUCHINPUT)))
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < inputCount; i++) {
|
|
|
|
|
// TODO: process inputs here!
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!CloseTouchInputHandle((HTOUCHINPUT)lParam))
|
|
|
|
|
{
|
2013-07-29 08:46:40 +00:00
|
|
|
|
// Error handling.
|
2013-04-16 19:12:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-07-29 08:46:40 +00:00
|
|
|
|
// GetLastError() and error handling.
|
2013-04-16 19:12:55 +00:00
|
|
|
|
}
|
|
|
|
|
delete [] inputs;
|
|
|
|
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
|
case WM_PAINT:
|
|
|
|
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
2013-07-29 19:34:30 +00:00
|
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
|
default:
|
|
|
|
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-07 08:42:39 +00:00
|
|
|
|
static int GetTrueVKey(const RAWKEYBOARD &kb) {
|
|
|
|
|
switch (kb.VKey) {
|
|
|
|
|
case VK_SHIFT:
|
2013-07-07 16:27:53 +00:00
|
|
|
|
return MapVirtualKey(kb.MakeCode, MAPVK_VSC_TO_VK_EX);
|
2013-07-29 19:34:30 +00:00
|
|
|
|
|
2013-07-07 08:42:39 +00:00
|
|
|
|
case VK_CONTROL:
|
2013-07-07 16:27:53 +00:00
|
|
|
|
if (kb.Flags & RI_KEY_E0)
|
2013-07-07 08:42:39 +00:00
|
|
|
|
return VK_RCONTROL;
|
|
|
|
|
else
|
|
|
|
|
return VK_LCONTROL;
|
|
|
|
|
|
|
|
|
|
case VK_MENU:
|
2013-07-07 16:27:53 +00:00
|
|
|
|
if (kb.Flags & RI_KEY_E0)
|
2013-07-07 08:42:39 +00:00
|
|
|
|
return VK_RMENU; // Right Alt / AltGr
|
|
|
|
|
else
|
|
|
|
|
return VK_LMENU; // Left Alt
|
2013-07-29 19:34:30 +00:00
|
|
|
|
|
2013-07-07 08:42:39 +00:00
|
|
|
|
default:
|
|
|
|
|
return kb.VKey;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
|
2012-11-01 15:19:01 +00:00
|
|
|
|
int wmId, wmEvent;
|
|
|
|
|
std::string fn;
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
switch (message) {
|
2012-11-01 15:19:01 +00:00
|
|
|
|
case WM_CREATE:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WM_MOVE:
|
2013-03-30 16:49:02 +00:00
|
|
|
|
SavePosition();
|
2013-01-26 23:15:39 +00:00
|
|
|
|
ResizeDisplay();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WM_SIZE:
|
2013-03-30 16:49:02 +00:00
|
|
|
|
SavePosition();
|
2013-01-26 23:15:39 +00:00
|
|
|
|
ResizeDisplay();
|
2012-11-01 15:19:01 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2013-05-04 21:21:06 +00:00
|
|
|
|
case WM_TIMER:
|
|
|
|
|
// Hack: Take the opportunity to also show/hide the mouse cursor in fullscreen mode.
|
2013-07-29 08:46:40 +00:00
|
|
|
|
switch (wParam) {
|
2013-06-11 18:14:53 +00:00
|
|
|
|
case TIMER_CURSORUPDATE:
|
|
|
|
|
CorrectCursor();
|
|
|
|
|
return 0;
|
2013-07-29 19:34:30 +00:00
|
|
|
|
|
2013-06-11 18:14:53 +00:00
|
|
|
|
case TIMER_CURSORMOVEUPDATE:
|
|
|
|
|
hideCursor = true;
|
|
|
|
|
KillTimer(hWnd, TIMER_CURSORMOVEUPDATE);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2013-05-04 21:21:06 +00:00
|
|
|
|
|
2013-07-08 10:35:08 +00:00
|
|
|
|
// For some reason, need to catch this here rather than in DisplayProc.
|
|
|
|
|
case WM_MOUSEWHEEL:
|
|
|
|
|
{
|
|
|
|
|
int wheelDelta = (short)(wParam >> 16);
|
|
|
|
|
KeyInput key;
|
|
|
|
|
key.deviceId = DEVICE_ID_MOUSE;
|
|
|
|
|
|
|
|
|
|
if (wheelDelta < 0) {
|
2013-08-04 17:31:40 +00:00
|
|
|
|
key.keyCode = NKCODE_EXT_MOUSEWHEEL_DOWN;
|
2013-07-08 10:35:08 +00:00
|
|
|
|
wheelDelta = -wheelDelta;
|
|
|
|
|
} else {
|
2013-08-04 17:31:40 +00:00
|
|
|
|
key.keyCode = NKCODE_EXT_MOUSEWHEEL_UP;
|
2013-07-08 10:35:08 +00:00
|
|
|
|
}
|
|
|
|
|
// There's no separate keyup event for mousewheel events, let's pass them both together.
|
|
|
|
|
// This also means it really won't work great for key mapping :( Need to build a 1 frame delay or something.
|
|
|
|
|
key.flags = KEY_DOWN | KEY_UP | KEY_HASWHEELDELTA | (wheelDelta << 16);
|
|
|
|
|
NativeKey(key);
|
|
|
|
|
}
|
2013-07-29 19:34:30 +00:00
|
|
|
|
break;
|
2013-07-08 10:35:08 +00:00
|
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
|
case WM_COMMAND:
|
2013-06-03 12:30:12 +00:00
|
|
|
|
{
|
2013-07-29 08:46:40 +00:00
|
|
|
|
if (!EmuThread_Ready())
|
|
|
|
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
|
|
|
|
I18NCategory *g = GetI18NCategory("Graphics");
|
|
|
|
|
|
|
|
|
|
wmId = LOWORD(wParam);
|
|
|
|
|
wmEvent = HIWORD(wParam);
|
|
|
|
|
// Parse the menu selections:
|
|
|
|
|
switch (wmId) {
|
|
|
|
|
case ID_FILE_LOAD:
|
|
|
|
|
BrowseAndBoot("");
|
|
|
|
|
break;
|
2013-03-28 19:26:24 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_FILE_LOAD_DIR:
|
|
|
|
|
BrowseAndBoot("",true);
|
|
|
|
|
break;
|
2013-07-23 15:24:33 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_FILE_LOAD_MEMSTICK:
|
|
|
|
|
{
|
|
|
|
|
std::string memStickDir, flash0dir;
|
|
|
|
|
GetSysDirectories(memStickDir, flash0dir);
|
|
|
|
|
memStickDir += "PSP\\GAME\\";
|
|
|
|
|
BrowseAndBoot(memStickDir);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_FILE_MEMSTICK:
|
|
|
|
|
{
|
|
|
|
|
std::string memStickDir, flash0dir;
|
|
|
|
|
GetSysDirectories(memStickDir, flash0dir);
|
|
|
|
|
ShellExecuteA(NULL, "open", memStickDir.c_str(), 0, 0, SW_SHOW);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_TOGGLE_PAUSE:
|
|
|
|
|
if (globalUIState == UISTATE_PAUSEMENU) {
|
2013-08-20 15:07:01 +00:00
|
|
|
|
// Causes hang
|
|
|
|
|
//NativeMessageReceived("run", "");
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
if (disasmWindow[0])
|
2013-08-17 08:57:29 +00:00
|
|
|
|
SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_STOPGO, 0);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
}
|
|
|
|
|
else if (Core_IsStepping()) { // It is paused, then continue to run.
|
|
|
|
|
if (disasmWindow[0])
|
2013-08-17 08:57:29 +00:00
|
|
|
|
SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_STOPGO, 0);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
else
|
|
|
|
|
Core_EnableStepping(false);
|
|
|
|
|
} else {
|
|
|
|
|
if (disasmWindow[0])
|
2013-08-17 08:57:29 +00:00
|
|
|
|
SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_STOPGO, 0);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
else
|
|
|
|
|
Core_EnableStepping(true);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2013-03-28 19:17:45 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_EMULATION_STOP:
|
2013-08-26 12:19:46 +00:00
|
|
|
|
EnableWindow(disasmWindow[0]->GetDlgHandle(),FALSE);
|
|
|
|
|
EnableWindow(memoryWindow[0]->GetDlgHandle(),FALSE);
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
if (Core_IsStepping()) {
|
2013-07-09 20:25:29 +00:00
|
|
|
|
Core_EnableStepping(false);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
}
|
|
|
|
|
NativeMessageReceived("stop", "");
|
|
|
|
|
Update();
|
|
|
|
|
break;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_EMULATION_RESET:
|
2013-08-26 12:19:46 +00:00
|
|
|
|
if (Core_IsStepping()) {
|
|
|
|
|
Core_EnableStepping(false);
|
|
|
|
|
}
|
|
|
|
|
EnableWindow(disasmWindow[0]->GetDlgHandle(),FALSE);
|
|
|
|
|
EnableWindow(memoryWindow[0]->GetDlgHandle(),FALSE);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
NativeMessageReceived("reset", "");
|
|
|
|
|
break;
|
2013-08-24 09:43:14 +00:00
|
|
|
|
case ID_EMULATION_CHEATS:
|
2013-08-24 03:28:21 +00:00
|
|
|
|
NativeMessageReceived("reset", "");
|
|
|
|
|
break;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-08-17 11:01:25 +00:00
|
|
|
|
case ID_EMULATION_RENDER_MODE_OGL:
|
|
|
|
|
g_Config.bSoftwareRendering = false;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_EMULATION_RENDER_MODE_SOFT:
|
|
|
|
|
g_Config.bSoftwareRendering = true;
|
|
|
|
|
break;
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_FILE_LOADSTATEFILE:
|
2013-08-26 19:32:05 +00:00
|
|
|
|
if (W32Util::BrowseForFileName(true, hWnd, L"Load state",0,L"Save States (*.ppst)\0*.ppst\0All files\0*.*\0\0",L"ppst",fn)) {
|
2013-07-29 08:46:40 +00:00
|
|
|
|
SetCursor(LoadCursor(0, IDC_WAIT));
|
|
|
|
|
SaveState::Load(fn, SaveStateActionFinished);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_FILE_SAVESTATEFILE:
|
2013-08-26 19:32:05 +00:00
|
|
|
|
if (W32Util::BrowseForFileName(false, hWnd, L"Save state",0,L"Save States (*.ppst)\0*.ppst\0All files\0*.*\0\0",L"ppst",fn)) {
|
2013-07-29 08:46:40 +00:00
|
|
|
|
SetCursor(LoadCursor(0, IDC_WAIT));
|
|
|
|
|
SaveState::Save(fn, SaveStateActionFinished);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
// TODO: Improve UI for multiple slots
|
|
|
|
|
case ID_FILE_SAVESTATE_NEXT_SLOT:
|
2012-11-01 15:19:01 +00:00
|
|
|
|
{
|
2013-07-29 08:46:40 +00:00
|
|
|
|
currentSavestateSlot = (currentSavestateSlot + 1)%SaveState::SAVESTATESLOTS;
|
|
|
|
|
char msg[30];
|
|
|
|
|
sprintf(msg, "Using save state slot %d.", currentSavestateSlot + 1);
|
|
|
|
|
osm.Show(msg);
|
|
|
|
|
break;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_FILE_QUICKLOADSTATE:
|
2013-07-09 20:25:29 +00:00
|
|
|
|
SetCursor(LoadCursor(0, IDC_WAIT));
|
2013-07-29 08:46:40 +00:00
|
|
|
|
SaveState::LoadSlot(currentSavestateSlot, SaveStateActionFinished);
|
|
|
|
|
break;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_FILE_QUICKSAVESTATE:
|
|
|
|
|
SetCursor(LoadCursor(0, IDC_WAIT));
|
|
|
|
|
SaveState::SaveSlot(currentSavestateSlot, SaveStateActionFinished);
|
|
|
|
|
break;
|
2013-01-02 20:00:10 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_SCREEN1X:
|
2013-07-30 07:36:32 +00:00
|
|
|
|
setZoom(ZOOM_NATIVE);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2013-01-02 20:00:10 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_SCREEN2X:
|
2013-07-30 07:36:32 +00:00
|
|
|
|
setZoom(ZOOM_2X);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2013-01-02 20:00:10 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_SCREEN3X:
|
2013-07-30 07:36:32 +00:00
|
|
|
|
setZoom(ZOOM_3X);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_OPTIONS_SCREEN4X:
|
2013-07-30 07:36:32 +00:00
|
|
|
|
setZoom(ZOOM_MAX);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_OPTIONS_SCREENDUMMY:
|
2013-07-30 07:45:12 +00:00
|
|
|
|
g_Config.iWindowZoom = ++g_Config.iWindowZoom > ZOOM_MAX ? ZOOM_NATIVE : g_Config.iWindowZoom;
|
2013-07-29 08:46:40 +00:00
|
|
|
|
|
|
|
|
|
setZoom(g_Config.iWindowZoom);
|
2013-07-26 12:25:11 +00:00
|
|
|
|
break;
|
2013-07-29 08:46:40 +00:00
|
|
|
|
|
|
|
|
|
case ID_OPTIONS_MIPMAP:
|
|
|
|
|
g_Config.bMipMap = !g_Config.bMipMap;
|
2013-07-26 12:25:11 +00:00
|
|
|
|
break;
|
2013-07-29 08:46:40 +00:00
|
|
|
|
|
|
|
|
|
case ID_OPTIONS_VSYNC:
|
|
|
|
|
g_Config.bVSync = !g_Config.bVSync;
|
2013-07-26 12:25:11 +00:00
|
|
|
|
break;
|
2013-07-29 08:46:40 +00:00
|
|
|
|
|
|
|
|
|
case ID_TEXTURESCALING_OFF:
|
2013-07-30 07:36:32 +00:00
|
|
|
|
setTexScalingMultiplier(TEXSCALING_OFF);
|
2013-07-26 12:25:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_TEXTURESCALING_2X:
|
2013-07-30 07:36:32 +00:00
|
|
|
|
setTexScalingMultiplier(TEXSCALING_2X);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2013-07-26 12:25:11 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_TEXTURESCALING_3X:
|
2013-07-30 07:36:32 +00:00
|
|
|
|
setTexScalingMultiplier(TEXSCALING_3X);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2013-04-17 19:07:41 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_TEXTURESCALING_4X:
|
2013-07-30 07:36:32 +00:00
|
|
|
|
setTexScalingMultiplier(TEXSCALING_4X);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2013-06-16 21:45:06 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_TEXTURESCALING_5X:
|
2013-07-30 07:36:32 +00:00
|
|
|
|
setTexScalingMultiplier(TEXSCALING_MAX);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2013-05-01 21:55:34 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_TEXTURESCALING_XBRZ:
|
|
|
|
|
setTexScalingType(TextureScaler::XBRZ);
|
|
|
|
|
break;
|
2013-04-30 01:47:33 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_TEXTURESCALING_HYBRID:
|
|
|
|
|
setTexScalingType(TextureScaler::HYBRID);
|
|
|
|
|
break;
|
2013-05-03 14:21:46 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_TEXTURESCALING_BICUBIC:
|
|
|
|
|
setTexScalingType(TextureScaler::BICUBIC);
|
|
|
|
|
break;
|
2013-07-21 15:17:42 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_TEXTURESCALING_HYBRID_BICUBIC:
|
|
|
|
|
setTexScalingType(TextureScaler::HYBRID_BICUBIC);
|
|
|
|
|
break;
|
2012-11-20 10:35:48 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_TEXTURESCALING_DEPOSTERIZE:
|
|
|
|
|
g_Config.bTexDeposterize = !g_Config.bTexDeposterize;
|
|
|
|
|
if(gpu) gpu->ClearCacheNextFrame();
|
|
|
|
|
break;
|
2013-07-09 20:25:29 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_NONBUFFEREDRENDERING:
|
2013-07-29 09:00:57 +00:00
|
|
|
|
setRenderingMode(FB_NON_BUFFERED_MODE);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2013-07-19 23:23:17 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_BUFFEREDRENDERING:
|
2013-07-29 09:00:57 +00:00
|
|
|
|
setRenderingMode(FB_BUFFERED_MODE);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2013-07-23 21:05:58 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_READFBOTOMEMORYCPU:
|
2013-07-29 09:00:57 +00:00
|
|
|
|
setRenderingMode(FB_READFBOMEMORY_CPU);
|
2013-07-23 21:05:58 +00:00
|
|
|
|
break;
|
2013-07-29 08:46:40 +00:00
|
|
|
|
|
|
|
|
|
case ID_OPTIONS_READFBOTOMEMORYGPU:
|
2013-07-29 09:00:57 +00:00
|
|
|
|
setRenderingMode(FB_READFBOMEMORY_GPU);
|
2013-07-23 21:05:58 +00:00
|
|
|
|
break;
|
2013-07-29 08:46:40 +00:00
|
|
|
|
|
|
|
|
|
// Dummy option to let the buffered rendering hotkey cycle through all the options.
|
|
|
|
|
case ID_OPTIONS_BUFFEREDRENDERINGDUMMY:
|
2013-07-30 07:45:12 +00:00
|
|
|
|
g_Config.iRenderingMode = ++g_Config.iRenderingMode > FB_READFBOMEMORY_GPU ? FB_NON_BUFFERED_MODE : g_Config.iRenderingMode;
|
2013-07-29 08:46:40 +00:00
|
|
|
|
|
|
|
|
|
setRenderingMode(g_Config.iRenderingMode);
|
2013-07-23 21:05:58 +00:00
|
|
|
|
break;
|
2013-07-29 08:46:40 +00:00
|
|
|
|
|
|
|
|
|
case ID_OPTIONS_SHOWDEBUGSTATISTICS:
|
|
|
|
|
g_Config.bShowDebugStats = !g_Config.bShowDebugStats;
|
2013-07-23 21:05:58 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_HARDWARETRANSFORM:
|
|
|
|
|
g_Config.bHardwareTransform = !g_Config.bHardwareTransform;
|
|
|
|
|
osm.ShowOnOff(g->T("Hardware Transform"), g_Config.bHardwareTransform);
|
|
|
|
|
break;
|
2013-07-23 21:05:58 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_STRETCHDISPLAY:
|
|
|
|
|
g_Config.bStretchToDisplay = !g_Config.bStretchToDisplay;
|
|
|
|
|
if (gpu)
|
|
|
|
|
gpu->Resized(); // Easy way to force a clear...
|
|
|
|
|
break;
|
2013-07-23 21:05:58 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_FRAMESKIP_0:
|
2013-07-30 07:36:32 +00:00
|
|
|
|
setFrameSkipping(FRAMESKIP_OFF);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2012-11-26 16:35:08 +00:00
|
|
|
|
|
2013-08-21 12:31:10 +00:00
|
|
|
|
case ID_OPTIONS_FRAMESKIP_AUTO:
|
|
|
|
|
setFrameSkipping(FRAMESKIP_AUTO);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2012-12-21 10:08:54 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_FRAMESKIP_2:
|
2013-07-30 07:36:32 +00:00
|
|
|
|
setFrameSkipping(FRAMESKIP_2);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2013-02-13 17:21:21 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_FRAMESKIP_3:
|
2013-07-30 07:36:32 +00:00
|
|
|
|
setFrameSkipping(FRAMESKIP_3);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_OPTIONS_FRAMESKIP_4:
|
2013-07-30 07:36:32 +00:00
|
|
|
|
setFrameSkipping(FRAMESKIP_4);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2013-07-26 12:25:11 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_FRAMESKIP_5:
|
2013-07-30 07:36:32 +00:00
|
|
|
|
setFrameSkipping(FRAMESKIP_5);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2013-07-26 12:25:11 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_FRAMESKIP_6:
|
2013-07-30 07:36:32 +00:00
|
|
|
|
setFrameSkipping(FRAMESKIP_6);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2013-07-26 12:25:11 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_FRAMESKIP_7:
|
2013-07-30 07:36:32 +00:00
|
|
|
|
setFrameSkipping(FRAMESKIP_7);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2013-07-26 12:25:11 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_FRAMESKIP_8:
|
2013-07-30 07:36:32 +00:00
|
|
|
|
setFrameSkipping(FRAMESKIP_MAX);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2013-07-26 12:25:11 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_FRAMESKIPDUMMY:
|
2013-07-30 07:45:12 +00:00
|
|
|
|
g_Config.iFrameSkip = ++g_Config.iFrameSkip > FRAMESKIP_MAX ? FRAMESKIP_OFF : g_Config.iFrameSkip;
|
2013-07-26 12:25:11 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
setFrameSkipping(g_Config.iFrameSkip);
|
2013-07-26 12:25:11 +00:00
|
|
|
|
break;
|
2013-07-29 08:46:40 +00:00
|
|
|
|
|
|
|
|
|
case ID_FILE_EXIT:
|
|
|
|
|
DestroyWindow(hWnd);
|
2013-07-26 12:25:11 +00:00
|
|
|
|
break;
|
2013-07-29 08:46:40 +00:00
|
|
|
|
|
|
|
|
|
case ID_CPU_DYNAREC:
|
2013-08-29 22:27:11 +00:00
|
|
|
|
g_Config.bJit = !g_Config.bJit;
|
2013-07-26 12:25:11 +00:00
|
|
|
|
break;
|
2013-07-29 08:46:40 +00:00
|
|
|
|
|
2013-08-08 15:05:01 +00:00
|
|
|
|
case ID_CPU_MULTITHREADED:
|
|
|
|
|
g_Config.bSeparateCPUThread = !g_Config.bSeparateCPUThread;
|
|
|
|
|
break;
|
|
|
|
|
|
2013-08-17 11:01:25 +00:00
|
|
|
|
case ID_IO_MULTITHREADED:
|
|
|
|
|
g_Config.bSeparateIOThread = !g_Config.bSeparateIOThread;
|
|
|
|
|
break;
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_EMULATION_RUNONLOAD:
|
|
|
|
|
g_Config.bAutoRun = !g_Config.bAutoRun;
|
2013-07-26 12:25:11 +00:00
|
|
|
|
break;
|
2013-07-29 08:46:40 +00:00
|
|
|
|
|
|
|
|
|
case ID_DEBUG_DUMPNEXTFRAME:
|
|
|
|
|
if (gpu)
|
|
|
|
|
gpu->DumpNextFrame();
|
2013-07-26 12:25:11 +00:00
|
|
|
|
break;
|
2013-07-29 08:46:40 +00:00
|
|
|
|
|
|
|
|
|
case ID_DEBUG_LOADMAPFILE:
|
2013-08-26 19:32:05 +00:00
|
|
|
|
if (W32Util::BrowseForFileName(true, hWnd, L"Load .MAP",0,L"Maps\0*.map\0All files\0*.*\0\0",L"map",fn)) {
|
2013-07-29 08:46:40 +00:00
|
|
|
|
symbolMap.LoadSymbolMap(fn.c_str());
|
|
|
|
|
|
|
|
|
|
if (disasmWindow[0])
|
|
|
|
|
disasmWindow[0]->NotifyMapLoaded();
|
|
|
|
|
|
|
|
|
|
if (memoryWindow[0])
|
|
|
|
|
memoryWindow[0]->NotifyMapLoaded();
|
|
|
|
|
}
|
2013-07-26 12:25:11 +00:00
|
|
|
|
break;
|
2013-07-29 08:46:40 +00:00
|
|
|
|
|
|
|
|
|
case ID_DEBUG_SAVEMAPFILE:
|
2013-08-26 19:32:05 +00:00
|
|
|
|
if (W32Util::BrowseForFileName(false, hWnd, L"Save .MAP",0,L"Maps\0*.map\0All files\0*.*\0\0",L"map",fn))
|
2013-07-29 08:46:40 +00:00
|
|
|
|
symbolMap.SaveSymbolMap(fn.c_str());
|
2013-07-26 12:25:11 +00:00
|
|
|
|
break;
|
2013-07-29 08:46:40 +00:00
|
|
|
|
|
|
|
|
|
case ID_DEBUG_RESETSYMBOLTABLE:
|
|
|
|
|
symbolMap.ResetSymbolMap();
|
|
|
|
|
|
|
|
|
|
for (int i=0; i<numCPUs; i++)
|
|
|
|
|
if (disasmWindow[i])
|
|
|
|
|
disasmWindow[i]->NotifyMapLoaded();
|
|
|
|
|
|
|
|
|
|
for (int i=0; i<numCPUs; i++)
|
|
|
|
|
if (memoryWindow[i])
|
|
|
|
|
memoryWindow[i]->NotifyMapLoaded();
|
2013-07-26 12:25:11 +00:00
|
|
|
|
break;
|
2013-07-29 08:46:40 +00:00
|
|
|
|
|
|
|
|
|
case ID_DEBUG_DISASSEMBLY:
|
2013-08-26 12:19:46 +00:00
|
|
|
|
disasmWindow[0]->Show(true);
|
2013-07-26 12:25:11 +00:00
|
|
|
|
break;
|
2013-07-29 08:46:40 +00:00
|
|
|
|
|
|
|
|
|
case ID_DEBUG_MEMORYVIEW:
|
2013-08-26 12:19:46 +00:00
|
|
|
|
memoryWindow[0]->Show(true);
|
2013-07-26 12:25:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_DEBUG_LOG:
|
|
|
|
|
LogManager::GetInstance()->GetConsoleListener()->Show(LogManager::GetInstance()->GetConsoleListener()->Hidden());
|
|
|
|
|
break;
|
2013-07-26 12:25:11 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_IGNOREILLEGALREADS:
|
|
|
|
|
g_Config.bIgnoreBadMemAccess = !g_Config.bIgnoreBadMemAccess;
|
|
|
|
|
break;
|
2013-02-18 23:44:22 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_FULLSCREEN:
|
|
|
|
|
g_Config.bFullScreen = !g_Config.bFullScreen ;
|
|
|
|
|
if(g_bFullScreen) {
|
|
|
|
|
_ViewNormal(hWnd);
|
|
|
|
|
} else {
|
|
|
|
|
_ViewFullScreen(hWnd);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_VERTEXCACHE:
|
|
|
|
|
g_Config.bVertexCache = !g_Config.bVertexCache;
|
|
|
|
|
break;
|
2013-03-29 20:21:27 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_SHOWFPS:
|
|
|
|
|
g_Config.iShowFPSCounter = !g_Config.iShowFPSCounter;
|
|
|
|
|
break;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_FASTMEMORY:
|
|
|
|
|
g_Config.bFastMemory = !g_Config.bFastMemory;
|
|
|
|
|
break;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_TEXTUREFILTERING_AUTO:
|
2013-07-29 09:00:57 +00:00
|
|
|
|
setTexFiltering(AUTO);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_NEARESTFILTERING:
|
2013-07-29 09:00:57 +00:00
|
|
|
|
setTexFiltering(NEAREST);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2013-01-05 18:57:06 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_LINEARFILTERING:
|
2013-07-29 09:00:57 +00:00
|
|
|
|
setTexFiltering(LINEAR);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2013-01-05 18:57:06 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_LINEARFILTERING_CG:
|
2013-07-29 09:00:57 +00:00
|
|
|
|
setTexFiltering(LINEARFMV);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2013-06-10 21:45:12 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_TOPMOST:
|
|
|
|
|
g_Config.bTopMost = !g_Config.bTopMost;
|
|
|
|
|
W32Util::MakeTopMost(hWnd, g_Config.bTopMost);
|
|
|
|
|
break;
|
2013-07-06 17:08:59 +00:00
|
|
|
|
|
2013-08-04 11:02:06 +00:00
|
|
|
|
case ID_OPTIONS_ANTIALIASING:
|
2013-07-30 13:18:49 +00:00
|
|
|
|
g_Config.bAntiAliasing = !g_Config.bAntiAliasing;
|
2013-07-29 08:46:40 +00:00
|
|
|
|
ResizeDisplay(true);
|
|
|
|
|
break;
|
2013-06-15 09:40:31 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_OPTIONS_CONTROLS:
|
2013-08-26 17:00:16 +00:00
|
|
|
|
MessageBox(hWnd, L"Control mapping has been moved to the in-window Settings menu.\n", L"Sorry", 0);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2013-06-15 09:40:31 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_EMULATION_SOUND:
|
|
|
|
|
g_Config.bEnableSound = !g_Config.bEnableSound;
|
2013-08-14 18:36:54 +00:00
|
|
|
|
if(!g_Config.bEnableSound) {
|
|
|
|
|
EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_GRAYED);
|
|
|
|
|
if(!IsAudioInitialised())
|
|
|
|
|
Audio_Init();
|
2013-08-17 11:01:25 +00:00
|
|
|
|
} else {
|
|
|
|
|
if(Atrac3plus_Decoder::IsInstalled())
|
|
|
|
|
EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_ENABLED);
|
2013-08-14 18:36:54 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_EMULATION_ATRAC3_SOUND:
|
|
|
|
|
g_Config.bEnableAtrac3plus = !g_Config.bEnableAtrac3plus;
|
|
|
|
|
|
|
|
|
|
if(Atrac3plus_Decoder::IsInstalled()) {
|
|
|
|
|
if(g_Config.bEnableAtrac3plus)
|
|
|
|
|
Atrac3plus_Decoder::Init();
|
|
|
|
|
else Atrac3plus_Decoder::Shutdown();
|
2013-08-17 11:01:25 +00:00
|
|
|
|
} else {
|
|
|
|
|
EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_GRAYED);
|
2013-08-14 18:36:54 +00:00
|
|
|
|
}
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_HELP_OPENWEBSITE:
|
2013-08-26 17:00:16 +00:00
|
|
|
|
ShellExecute(NULL, L"open", L"http://www.ppsspp.org/", NULL, NULL, SW_SHOWNORMAL);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_HELP_BUYGOLD:
|
|
|
|
|
ShellExecute(NULL, L"open", L"http://central.ppsspp.org/buygold", NULL, NULL, SW_SHOWNORMAL);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
case ID_HELP_OPENFORUM:
|
2013-08-26 17:00:16 +00:00
|
|
|
|
ShellExecute(NULL, L"open", L"http://forums.ppsspp.org/", NULL, NULL, SW_SHOWNORMAL);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_HELP_ABOUT:
|
|
|
|
|
DialogManager::EnableAll(FALSE);
|
|
|
|
|
DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
|
|
|
|
|
DialogManager::EnableAll(TRUE);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_DEBUG_TAKESCREENSHOT:
|
|
|
|
|
g_TakeScreenshot = true;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
2013-08-26 17:00:16 +00:00
|
|
|
|
MessageBox(hwndMain, L"Unimplemented", L"Sorry",0);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2013-06-03 12:30:12 +00:00
|
|
|
|
}
|
2012-11-01 15:19:01 +00:00
|
|
|
|
break;
|
2013-07-06 17:08:59 +00:00
|
|
|
|
|
2013-07-07 08:42:39 +00:00
|
|
|
|
case WM_INPUT:
|
2013-07-06 17:08:59 +00:00
|
|
|
|
{
|
2013-07-07 08:42:39 +00:00
|
|
|
|
UINT dwSize;
|
|
|
|
|
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER));
|
|
|
|
|
if (!rawInputBuffer) {
|
|
|
|
|
rawInputBuffer = malloc(dwSize);
|
|
|
|
|
rawInputBufferSize = dwSize;
|
2013-07-07 02:12:06 +00:00
|
|
|
|
}
|
2013-07-07 08:42:39 +00:00
|
|
|
|
if (dwSize > rawInputBufferSize) {
|
|
|
|
|
rawInputBuffer = realloc(rawInputBuffer, dwSize);
|
|
|
|
|
}
|
|
|
|
|
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, rawInputBuffer, &dwSize, sizeof(RAWINPUTHEADER));
|
|
|
|
|
RAWINPUT* raw = (RAWINPUT*)rawInputBuffer;
|
2013-07-07 16:27:53 +00:00
|
|
|
|
if (raw->header.dwType == RIM_TYPEKEYBOARD) {
|
2013-07-07 08:42:39 +00:00
|
|
|
|
KeyInput key;
|
|
|
|
|
key.deviceId = DEVICE_ID_KEYBOARD;
|
2013-07-07 16:27:53 +00:00
|
|
|
|
if (raw->data.keyboard.Message == WM_KEYDOWN || raw->data.keyboard.Message == WM_SYSKEYDOWN) {
|
2013-07-07 08:42:39 +00:00
|
|
|
|
key.flags = KEY_DOWN;
|
|
|
|
|
key.keyCode = windowsTransTable[GetTrueVKey(raw->data.keyboard)];
|
2013-07-15 15:41:24 +00:00
|
|
|
|
if (key.keyCode) {
|
2013-07-07 08:42:39 +00:00
|
|
|
|
NativeKey(key);
|
2013-07-15 15:41:24 +00:00
|
|
|
|
}
|
2013-07-07 08:42:39 +00:00
|
|
|
|
} else if (raw->data.keyboard.Message == WM_KEYUP) {
|
|
|
|
|
key.flags = KEY_UP;
|
|
|
|
|
key.keyCode = windowsTransTable[GetTrueVKey(raw->data.keyboard)];
|
2013-07-15 15:41:24 +00:00
|
|
|
|
if (key.keyCode) {
|
2013-07-07 08:42:39 +00:00
|
|
|
|
NativeKey(key);
|
2013-07-15 15:41:24 +00:00
|
|
|
|
}
|
2013-07-07 08:42:39 +00:00
|
|
|
|
}
|
2013-08-12 21:26:01 +00:00
|
|
|
|
} else if (raw->header.dwType == RIM_TYPEMOUSE) {
|
|
|
|
|
mouseDeltaX += raw->data.mouse.lLastX;
|
|
|
|
|
mouseDeltaY += raw->data.mouse.lLastY;
|
|
|
|
|
|
2013-08-19 11:05:32 +00:00
|
|
|
|
KeyInput key;
|
|
|
|
|
key.deviceId = DEVICE_ID_MOUSE;
|
|
|
|
|
|
2013-08-19 11:37:49 +00:00
|
|
|
|
int mouseRightBtnPressed = raw->data.mouse.usButtonFlags & RI_MOUSE_RIGHT_BUTTON_DOWN;
|
|
|
|
|
int mouseRightBtnReleased = raw->data.mouse.usButtonFlags & RI_MOUSE_RIGHT_BUTTON_UP;
|
2013-08-19 11:05:32 +00:00
|
|
|
|
|
|
|
|
|
if(mouseRightBtnPressed) {
|
|
|
|
|
key.flags = KEY_DOWN;
|
|
|
|
|
key.keyCode = windowsTransTable[VK_RBUTTON];
|
|
|
|
|
NativeKey(key);
|
|
|
|
|
}
|
2013-08-19 11:28:31 +00:00
|
|
|
|
else if(mouseRightBtnReleased) {
|
2013-08-19 11:05:32 +00:00
|
|
|
|
key.flags = KEY_UP;
|
|
|
|
|
key.keyCode = windowsTransTable[VK_RBUTTON];
|
|
|
|
|
NativeKey(key);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-12 21:26:01 +00:00
|
|
|
|
// TODO : Smooth and translate to an axis every frame.
|
|
|
|
|
// NativeAxis()
|
2013-07-07 02:12:06 +00:00
|
|
|
|
}
|
2013-07-06 17:08:59 +00:00
|
|
|
|
}
|
2013-03-29 22:12:37 +00:00
|
|
|
|
return 0;
|
2013-05-13 09:13:49 +00:00
|
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
|
case WM_DROPFILES:
|
|
|
|
|
{
|
2013-06-08 00:32:07 +00:00
|
|
|
|
if (!EmuThread_Ready())
|
|
|
|
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
|
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
|
HDROP hdrop = (HDROP)wParam;
|
|
|
|
|
int count = DragQueryFile(hdrop,0xFFFFFFFF,0,0);
|
2013-07-29 08:46:40 +00:00
|
|
|
|
if (count != 1) {
|
2013-08-26 17:00:16 +00:00
|
|
|
|
MessageBox(hwndMain,L"You can only load one file at a time",L"Error",MB_ICONINFORMATION);
|
2012-11-01 15:19:01 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TCHAR filename[512];
|
|
|
|
|
DragQueryFile(hdrop,0,filename,512);
|
|
|
|
|
TCHAR *type = filename+_tcslen(filename)-3;
|
|
|
|
|
|
2013-03-29 17:50:08 +00:00
|
|
|
|
SendMessage(hWnd, WM_COMMAND, ID_EMULATION_STOP, 0);
|
2013-04-07 03:09:29 +00:00
|
|
|
|
// Ugly, need to wait for the stop message to process in the EmuThread.
|
|
|
|
|
Sleep(20);
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-08-20 15:21:25 +00:00
|
|
|
|
Update();
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-08-26 17:00:16 +00:00
|
|
|
|
NativeMessageReceived("boot", ConvertWStringToUTF8(filename).c_str());
|
2012-11-01 15:19:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WM_CLOSE:
|
|
|
|
|
EmuThread_Stop();
|
|
|
|
|
|
2013-01-02 21:57:57 +00:00
|
|
|
|
return DefWindowProc(hWnd,message,wParam,lParam);
|
2013-01-05 18:57:06 +00:00
|
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
|
case WM_DESTROY:
|
2013-06-11 18:14:53 +00:00
|
|
|
|
KillTimer(hWnd, TIMER_CURSORUPDATE);
|
|
|
|
|
KillTimer(hWnd, TIMER_CURSORMOVEUPDATE);
|
2012-11-01 15:19:01 +00:00
|
|
|
|
PostQuitMessage(0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WM_USER+1:
|
2013-05-04 21:54:22 +00:00
|
|
|
|
if (g_Config.bFullScreen)
|
|
|
|
|
_ViewFullScreen(hWnd);
|
2013-08-26 12:19:46 +00:00
|
|
|
|
|
|
|
|
|
EnableWindow (disasmWindow[0]->GetDlgHandle(),TRUE);
|
|
|
|
|
EnableWindow (memoryWindow[0]->GetDlgHandle(),TRUE);
|
|
|
|
|
|
|
|
|
|
disasmWindow[0]->NotifyMapLoaded();
|
|
|
|
|
memoryWindow[0]->NotifyMapLoaded();
|
|
|
|
|
|
|
|
|
|
disasmWindow[0]->UpdateDialog();
|
2012-12-22 17:21:23 +00:00
|
|
|
|
|
2013-04-01 01:28:13 +00:00
|
|
|
|
SetForegroundWindow(hwndMain);
|
2012-11-01 15:19:01 +00:00
|
|
|
|
break;
|
2013-03-29 18:52:32 +00:00
|
|
|
|
|
2013-07-21 09:21:50 +00:00
|
|
|
|
case WM_USER_SAVESTATE_FINISH:
|
|
|
|
|
SetCursor(LoadCursor(0, IDC_ARROW));
|
|
|
|
|
break;
|
2013-03-29 18:52:32 +00:00
|
|
|
|
|
2013-07-28 00:47:06 +00:00
|
|
|
|
case WM_USER_LOG_STATUS_CHANGED:
|
|
|
|
|
if(!g_Config.bEnableLogging) {
|
|
|
|
|
LogManager::GetInstance()->GetConsoleListener()->Show(false);
|
|
|
|
|
EnableMenuItem(menu, ID_DEBUG_LOG, MF_GRAYED);
|
2013-08-04 07:39:49 +00:00
|
|
|
|
} else {
|
|
|
|
|
LogManager::GetInstance()->GetConsoleListener()->Show(true);
|
2013-07-28 00:47:06 +00:00
|
|
|
|
EnableMenuItem(menu, ID_DEBUG_LOG, MF_ENABLED);
|
2013-08-04 07:39:49 +00:00
|
|
|
|
}
|
2013-07-28 00:47:06 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2013-08-17 11:37:34 +00:00
|
|
|
|
case WM_USER_ATRAC_STATUS_CHANGED:
|
|
|
|
|
if(g_Config.bEnableAtrac3plus && Atrac3plus_Decoder::IsInstalled())
|
|
|
|
|
EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_ENABLED);
|
|
|
|
|
else
|
|
|
|
|
EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_GRAYED);
|
|
|
|
|
break;
|
|
|
|
|
|
2013-03-29 18:32:20 +00:00
|
|
|
|
case WM_MENUSELECT:
|
2013-05-13 08:08:10 +00:00
|
|
|
|
// Unfortunately, accelerate keys (hotkeys) shares the same enabled/disabled states
|
|
|
|
|
// with corresponding menu items.
|
2013-03-29 18:32:20 +00:00
|
|
|
|
UpdateMenus();
|
|
|
|
|
break;
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-05-02 18:58:10 +00:00
|
|
|
|
// Turn off the screensaver.
|
|
|
|
|
// Note that if there's a screensaver password, this simple method
|
|
|
|
|
// doesn't work on Vista or higher.
|
|
|
|
|
case WM_SYSCOMMAND:
|
|
|
|
|
{
|
2013-07-29 08:46:40 +00:00
|
|
|
|
switch (wParam) {
|
2013-05-02 18:58:10 +00:00
|
|
|
|
case SC_SCREENSAVE:
|
|
|
|
|
return 0;
|
|
|
|
|
case SC_MONITORPOWER:
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
|
default:
|
|
|
|
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
void UpdateMenus() {
|
2012-11-01 15:19:01 +00:00
|
|
|
|
HMENU menu = GetMenu(GetHWND());
|
|
|
|
|
#define CHECKITEM(item,value) CheckMenuItem(menu,item,MF_BYCOMMAND | ((value) ? MF_CHECKED : MF_UNCHECKED));
|
|
|
|
|
CHECKITEM(ID_OPTIONS_IGNOREILLEGALREADS,g_Config.bIgnoreBadMemAccess);
|
2013-02-16 13:24:02 +00:00
|
|
|
|
CHECKITEM(ID_CPU_INTERPRETER,g_Config.bJit == false);
|
|
|
|
|
CHECKITEM(ID_CPU_DYNAREC,g_Config.bJit == true);
|
2013-08-08 15:05:01 +00:00
|
|
|
|
CHECKITEM(ID_CPU_MULTITHREADED, g_Config.bSeparateCPUThread);
|
2013-08-17 22:45:10 +00:00
|
|
|
|
CHECKITEM(ID_IO_MULTITHREADED, g_Config.bSeparateIOThread);
|
2012-11-26 16:35:08 +00:00
|
|
|
|
CHECKITEM(ID_OPTIONS_SHOWDEBUGSTATISTICS, g_Config.bShowDebugStats);
|
2012-12-21 10:08:54 +00:00
|
|
|
|
CHECKITEM(ID_OPTIONS_HARDWARETRANSFORM, g_Config.bHardwareTransform);
|
2012-12-21 15:49:02 +00:00
|
|
|
|
CHECKITEM(ID_OPTIONS_FASTMEMORY, g_Config.bFastMemory);
|
2013-08-04 11:02:06 +00:00
|
|
|
|
CHECKITEM(ID_OPTIONS_ANTIALIASING, g_Config.bAntiAliasing);
|
2013-02-13 17:21:21 +00:00
|
|
|
|
CHECKITEM(ID_OPTIONS_STRETCHDISPLAY, g_Config.bStretchToDisplay);
|
2013-01-04 09:26:14 +00:00
|
|
|
|
CHECKITEM(ID_EMULATION_RUNONLOAD, g_Config.bAutoRun);
|
2013-01-19 16:05:08 +00:00
|
|
|
|
CHECKITEM(ID_OPTIONS_VERTEXCACHE, g_Config.bVertexCache);
|
2013-06-19 05:08:29 +00:00
|
|
|
|
CHECKITEM(ID_OPTIONS_SHOWFPS, g_Config.iShowFPSCounter);
|
2013-05-02 14:48:28 +00:00
|
|
|
|
CHECKITEM(ID_OPTIONS_FRAMESKIP, g_Config.iFrameSkip != 0);
|
2013-04-17 19:07:41 +00:00
|
|
|
|
CHECKITEM(ID_OPTIONS_MIPMAP, g_Config.bMipMap);
|
2013-07-20 14:03:52 +00:00
|
|
|
|
CHECKITEM(ID_OPTIONS_VSYNC, g_Config.bVSync);
|
2013-06-10 21:45:12 +00:00
|
|
|
|
CHECKITEM(ID_OPTIONS_TOPMOST, g_Config.bTopMost);
|
2013-05-13 08:08:10 +00:00
|
|
|
|
CHECKITEM(ID_EMULATION_SOUND, g_Config.bEnableSound);
|
|
|
|
|
CHECKITEM(ID_TEXTURESCALING_DEPOSTERIZE, g_Config.bTexDeposterize);
|
2013-08-14 18:36:54 +00:00
|
|
|
|
CHECKITEM(ID_EMULATION_ATRAC3_SOUND, g_Config.bEnableAtrac3plus);
|
2013-08-17 11:01:25 +00:00
|
|
|
|
CHECKITEM(ID_EMULATION_RENDER_MODE_OGL, g_Config.bSoftwareRendering == false);
|
|
|
|
|
CHECKITEM(ID_EMULATION_RENDER_MODE_SOFT, g_Config.bSoftwareRendering == true);
|
2013-07-28 00:47:06 +00:00
|
|
|
|
|
2013-03-29 19:03:11 +00:00
|
|
|
|
static const int zoomitems[4] = {
|
2012-11-17 16:46:05 +00:00
|
|
|
|
ID_OPTIONS_SCREEN1X,
|
|
|
|
|
ID_OPTIONS_SCREEN2X,
|
|
|
|
|
ID_OPTIONS_SCREEN3X,
|
|
|
|
|
ID_OPTIONS_SCREEN4X,
|
|
|
|
|
};
|
2013-07-30 07:36:32 +00:00
|
|
|
|
if(g_Config.iWindowZoom < ZOOM_NATIVE)
|
|
|
|
|
g_Config.iWindowZoom = ZOOM_NATIVE;
|
|
|
|
|
|
|
|
|
|
else if(g_Config.iWindowZoom > ZOOM_MAX)
|
|
|
|
|
g_Config.iWindowZoom = ZOOM_MAX;
|
|
|
|
|
|
2013-07-26 23:36:16 +00:00
|
|
|
|
for (int i = 0; i < ARRAY_SIZE(zoomitems); i++) {
|
2013-07-26 23:08:24 +00:00
|
|
|
|
CheckMenuItem(menu, zoomitems[i], MF_BYCOMMAND | ((i == g_Config.iWindowZoom - 1) ? MF_CHECKED : MF_UNCHECKED));
|
2012-11-17 16:46:05 +00:00
|
|
|
|
}
|
2013-04-30 01:47:33 +00:00
|
|
|
|
|
2013-04-30 10:14:34 +00:00
|
|
|
|
static const int texscalingitems[] = {
|
|
|
|
|
ID_TEXTURESCALING_OFF,
|
2013-05-01 21:55:34 +00:00
|
|
|
|
ID_TEXTURESCALING_2X,
|
|
|
|
|
ID_TEXTURESCALING_3X,
|
|
|
|
|
ID_TEXTURESCALING_4X,
|
|
|
|
|
ID_TEXTURESCALING_5X,
|
2013-04-30 01:47:33 +00:00
|
|
|
|
};
|
2013-07-30 07:36:32 +00:00
|
|
|
|
if(g_Config.iTexScalingLevel < TEXSCALING_OFF)
|
|
|
|
|
g_Config.iTexScalingLevel = TEXSCALING_OFF;
|
|
|
|
|
|
|
|
|
|
else if(g_Config.iTexScalingLevel > TEXSCALING_MAX)
|
|
|
|
|
g_Config.iTexScalingLevel = TEXSCALING_MAX;
|
|
|
|
|
|
2013-07-26 23:36:16 +00:00
|
|
|
|
for (int i = 0; i < ARRAY_SIZE(texscalingitems); i++) {
|
2013-07-26 23:29:47 +00:00
|
|
|
|
CheckMenuItem(menu, texscalingitems[i], MF_BYCOMMAND | ((i == g_Config.iTexScalingLevel - 1) ? MF_CHECKED : MF_UNCHECKED));
|
2013-05-01 21:55:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const int texscalingtypeitems[] = {
|
|
|
|
|
ID_TEXTURESCALING_XBRZ,
|
|
|
|
|
ID_TEXTURESCALING_HYBRID,
|
2013-05-04 23:27:15 +00:00
|
|
|
|
ID_TEXTURESCALING_BICUBIC,
|
|
|
|
|
ID_TEXTURESCALING_HYBRID_BICUBIC,
|
2013-05-01 21:55:34 +00:00
|
|
|
|
};
|
2013-08-03 22:16:46 +00:00
|
|
|
|
if(g_Config.iTexScalingType < TextureScaler::XBRZ)
|
2013-07-30 07:36:32 +00:00
|
|
|
|
g_Config.iTexScalingType = TextureScaler::XBRZ;
|
|
|
|
|
|
2013-08-03 22:16:46 +00:00
|
|
|
|
else if(g_Config.iTexScalingType > TextureScaler::HYBRID_BICUBIC)
|
|
|
|
|
g_Config.iTexScalingType = TextureScaler::HYBRID_BICUBIC;
|
|
|
|
|
|
2013-07-26 23:36:16 +00:00
|
|
|
|
for (int i = 0; i < ARRAY_SIZE(texscalingtypeitems); i++) {
|
2013-05-01 21:55:34 +00:00
|
|
|
|
CheckMenuItem(menu, texscalingtypeitems[i], MF_BYCOMMAND | ((i == g_Config.iTexScalingType) ? MF_CHECKED : MF_UNCHECKED));
|
2013-04-30 01:47:33 +00:00
|
|
|
|
}
|
2013-05-13 08:08:10 +00:00
|
|
|
|
|
2013-06-30 06:48:50 +00:00
|
|
|
|
static const int texfilteringitems[] = {
|
2013-07-01 19:42:45 +00:00
|
|
|
|
ID_OPTIONS_TEXTUREFILTERING_AUTO,
|
2013-06-30 06:48:50 +00:00
|
|
|
|
ID_OPTIONS_NEARESTFILTERING,
|
|
|
|
|
ID_OPTIONS_LINEARFILTERING,
|
|
|
|
|
ID_OPTIONS_LINEARFILTERING_CG,
|
|
|
|
|
};
|
2013-07-30 07:36:32 +00:00
|
|
|
|
if(g_Config.iTexFiltering < AUTO)
|
|
|
|
|
g_Config.iTexFiltering = AUTO;
|
|
|
|
|
|
|
|
|
|
else if(g_Config.iTexFiltering > LINEARFMV)
|
|
|
|
|
g_Config.iTexFiltering = LINEARFMV;
|
|
|
|
|
|
2013-07-26 23:36:16 +00:00
|
|
|
|
for (int i = 0; i < ARRAY_SIZE(texfilteringitems); i++) {
|
2013-07-20 12:50:50 +00:00
|
|
|
|
CheckMenuItem(menu, texfilteringitems[i], MF_BYCOMMAND | ( (i + 1) == g_Config.iTexFiltering )? MF_CHECKED : MF_UNCHECKED);
|
2013-06-30 06:48:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-07-21 15:17:42 +00:00
|
|
|
|
static const int renderingmode[] = {
|
|
|
|
|
ID_OPTIONS_NONBUFFEREDRENDERING,
|
|
|
|
|
ID_OPTIONS_BUFFEREDRENDERING,
|
|
|
|
|
ID_OPTIONS_READFBOTOMEMORYCPU,
|
2013-07-21 23:33:18 +00:00
|
|
|
|
ID_OPTIONS_READFBOTOMEMORYGPU,
|
2013-07-21 15:17:42 +00:00
|
|
|
|
};
|
2013-08-03 22:16:46 +00:00
|
|
|
|
if(g_Config.iRenderingMode < FB_NON_BUFFERED_MODE)
|
2013-07-30 07:36:32 +00:00
|
|
|
|
g_Config.iRenderingMode = FB_NON_BUFFERED_MODE;
|
|
|
|
|
|
2013-08-03 22:16:46 +00:00
|
|
|
|
else if(g_Config.iRenderingMode > FB_READFBOMEMORY_GPU)
|
|
|
|
|
g_Config.iRenderingMode = FB_READFBOMEMORY_GPU;
|
|
|
|
|
|
2013-07-26 23:36:16 +00:00
|
|
|
|
for (int i = 0; i < ARRAY_SIZE(renderingmode); i++) {
|
2013-07-21 15:17:42 +00:00
|
|
|
|
CheckMenuItem(menu, renderingmode[i], MF_BYCOMMAND | ( i == g_Config.iRenderingMode )? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-26 12:25:11 +00:00
|
|
|
|
static const int frameskipping[] = {
|
|
|
|
|
ID_OPTIONS_FRAMESKIP_0,
|
2013-08-21 11:44:08 +00:00
|
|
|
|
ID_OPTIONS_FRAMESKIP_AUTO,
|
2013-07-26 12:25:11 +00:00
|
|
|
|
ID_OPTIONS_FRAMESKIP_2,
|
|
|
|
|
ID_OPTIONS_FRAMESKIP_3,
|
|
|
|
|
ID_OPTIONS_FRAMESKIP_4,
|
|
|
|
|
ID_OPTIONS_FRAMESKIP_5,
|
|
|
|
|
ID_OPTIONS_FRAMESKIP_6,
|
|
|
|
|
ID_OPTIONS_FRAMESKIP_7,
|
|
|
|
|
ID_OPTIONS_FRAMESKIP_8,
|
|
|
|
|
};
|
2013-08-03 22:16:46 +00:00
|
|
|
|
if(g_Config.iFrameSkip < FRAMESKIP_OFF)
|
2013-07-30 07:36:32 +00:00
|
|
|
|
g_Config.iFrameSkip = FRAMESKIP_OFF;
|
2013-07-30 07:38:11 +00:00
|
|
|
|
|
2013-08-03 22:16:46 +00:00
|
|
|
|
else if(g_Config.iFrameSkip > FRAMESKIP_MAX)
|
|
|
|
|
g_Config.iFrameSkip = FRAMESKIP_MAX;
|
|
|
|
|
|
2013-07-26 23:36:16 +00:00
|
|
|
|
for (int i = 0; i < ARRAY_SIZE(frameskipping); i++) {
|
2013-07-26 12:25:11 +00:00
|
|
|
|
CheckMenuItem(menu, frameskipping[i], MF_BYCOMMAND | ( i == g_Config.iFrameSkip )? MF_CHECKED : MF_UNCHECKED);
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-13 08:08:10 +00:00
|
|
|
|
UpdateCommands();
|
|
|
|
|
}
|
2013-08-30 18:15:13 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
void UpdateCommands() {
|
2013-05-13 08:08:10 +00:00
|
|
|
|
static GlobalUIState lastGlobalUIState = UISTATE_PAUSEMENU;
|
|
|
|
|
static CoreState lastCoreState = CORE_ERROR;
|
|
|
|
|
|
|
|
|
|
if (lastGlobalUIState == globalUIState && lastCoreState == coreState)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
lastCoreState = coreState;
|
|
|
|
|
lastGlobalUIState = globalUIState;
|
|
|
|
|
|
|
|
|
|
HMENU menu = GetMenu(GetHWND());
|
|
|
|
|
|
2013-08-30 18:15:13 +00:00
|
|
|
|
(Core_IsStepping() || globalUIState != UISTATE_INGAME) ?
|
|
|
|
|
TranslateMenuItembyText(ID_TOGGLE_PAUSE, "Run", "DesktopUI", false, false, L"\tF8") : TranslateMenuItembyText(ID_TOGGLE_PAUSE, "Pause", "DesktopUI", false, false, L"\tF8");
|
2013-05-13 08:08:10 +00:00
|
|
|
|
|
|
|
|
|
UINT ingameEnable = globalUIState == UISTATE_INGAME ? MF_ENABLED : MF_GRAYED;
|
2013-08-08 15:05:01 +00:00
|
|
|
|
EnableMenuItem(menu, ID_TOGGLE_PAUSE, ingameEnable);
|
|
|
|
|
EnableMenuItem(menu, ID_EMULATION_STOP, ingameEnable);
|
|
|
|
|
EnableMenuItem(menu, ID_EMULATION_RESET, ingameEnable);
|
2013-08-24 09:43:14 +00:00
|
|
|
|
EnableMenuItem(menu, ID_EMULATION_CHEATS, ingameEnable);
|
2013-05-13 08:08:10 +00:00
|
|
|
|
|
|
|
|
|
UINT menuEnable = globalUIState == UISTATE_MENU ? MF_ENABLED : MF_GRAYED;
|
2013-08-08 15:05:01 +00:00
|
|
|
|
EnableMenuItem(menu, ID_FILE_SAVESTATEFILE, !menuEnable);
|
|
|
|
|
EnableMenuItem(menu, ID_FILE_LOADSTATEFILE, !menuEnable);
|
|
|
|
|
EnableMenuItem(menu, ID_FILE_QUICKSAVESTATE, !menuEnable);
|
|
|
|
|
EnableMenuItem(menu, ID_FILE_QUICKLOADSTATE, !menuEnable);
|
2013-08-24 09:43:14 +00:00
|
|
|
|
EnableMenuItem(menu, ID_EMULATION_CHEATS, !menuEnable);
|
2013-08-08 15:05:01 +00:00
|
|
|
|
EnableMenuItem(menu, ID_CPU_DYNAREC, menuEnable);
|
|
|
|
|
EnableMenuItem(menu, ID_CPU_INTERPRETER, menuEnable);
|
|
|
|
|
EnableMenuItem(menu, ID_CPU_MULTITHREADED, menuEnable);
|
2013-08-17 11:01:25 +00:00
|
|
|
|
EnableMenuItem(menu, ID_IO_MULTITHREADED, menuEnable);
|
2013-08-08 15:05:01 +00:00
|
|
|
|
EnableMenuItem(menu, ID_DEBUG_LOG, !g_Config.bEnableLogging);
|
2013-08-17 11:01:25 +00:00
|
|
|
|
EnableMenuItem(menu, ID_EMULATION_RENDER_MODE_OGL, menuEnable);
|
|
|
|
|
EnableMenuItem(menu, ID_EMULATION_RENDER_MODE_SOFT, menuEnable);
|
|
|
|
|
EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, !Atrac3plus_Decoder::IsInstalled());
|
2012-11-01 15:19:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Message handler for about box.
|
2013-07-29 08:46:40 +00:00
|
|
|
|
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
|
|
|
|
|
switch (message) {
|
2012-11-01 15:19:01 +00:00
|
|
|
|
case WM_INITDIALOG:
|
2013-03-11 21:55:29 +00:00
|
|
|
|
{
|
2013-07-29 08:46:40 +00:00
|
|
|
|
W32Util::CenterWindow(hDlg);
|
2013-03-11 21:55:29 +00:00
|
|
|
|
HWND versionBox = GetDlgItem(hDlg, IDC_VERSION);
|
|
|
|
|
char temp[256];
|
|
|
|
|
sprintf(temp, "PPSSPP %s", PPSSPP_GIT_VERSION);
|
2013-08-26 17:00:16 +00:00
|
|
|
|
SetWindowTextA(versionBox, temp);
|
2013-03-11 21:55:29 +00:00
|
|
|
|
}
|
2012-11-01 15:19:01 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
case WM_COMMAND:
|
|
|
|
|
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
|
|
|
|
|
{
|
|
|
|
|
EndDialog(hDlg, LOWORD(wParam));
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
void Update() {
|
2012-11-01 15:19:01 +00:00
|
|
|
|
InvalidateRect(hwndDisplay,0,0);
|
|
|
|
|
UpdateWindow(hwndDisplay);
|
|
|
|
|
SendMessage(hwndMain,WM_SIZE,0,0);
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
void Redraw() {
|
2012-11-01 15:19:01 +00:00
|
|
|
|
InvalidateRect(hwndDisplay,0,0);
|
|
|
|
|
}
|
2013-03-29 20:21:27 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
void _ViewNormal(HWND hWnd) {
|
|
|
|
|
// Put caption and border styles back.
|
2012-12-22 00:57:44 +00:00
|
|
|
|
DWORD dwOldStyle = ::GetWindowLong(hWnd, GWL_STYLE);
|
|
|
|
|
DWORD dwNewStyle = dwOldStyle | WS_CAPTION | WS_THICKFRAME;
|
|
|
|
|
::SetWindowLong(hWnd, GWL_STYLE, dwNewStyle);
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
// Put back the menu bar.
|
2012-12-22 00:57:44 +00:00
|
|
|
|
::SetMenu(hWnd, menu);
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
// Resize to normal view.
|
|
|
|
|
// NOTE: Use SWP_FRAMECHANGED to force redraw non-client.
|
2012-12-22 00:57:44 +00:00
|
|
|
|
const int x = g_normalRC.left;
|
|
|
|
|
const int y = g_normalRC.top;
|
|
|
|
|
const int cx = g_normalRC.right - g_normalRC.left;
|
|
|
|
|
const int cy = g_normalRC.bottom - g_normalRC.top;
|
|
|
|
|
::SetWindowPos(hWnd, HWND_NOTOPMOST, x, y, cx, cy, SWP_FRAMECHANGED);
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
// Reset full screen indicator.
|
2012-12-22 00:57:44 +00:00
|
|
|
|
g_bFullScreen = FALSE;
|
2013-05-26 21:55:23 +00:00
|
|
|
|
CorrectCursor();
|
2013-01-26 22:46:02 +00:00
|
|
|
|
ResizeDisplay();
|
2013-05-26 21:56:05 +00:00
|
|
|
|
ShowOwnedPopups(hwndMain, TRUE);
|
2012-12-05 06:31:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
void _ViewFullScreen(HWND hWnd) {
|
|
|
|
|
// Keep in mind normal window rectangle.
|
2012-12-22 00:57:44 +00:00
|
|
|
|
::GetWindowRect(hWnd, &g_normalRC);
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
// Remove caption and border styles.
|
2012-12-22 00:57:44 +00:00
|
|
|
|
DWORD dwOldStyle = ::GetWindowLong(hWnd, GWL_STYLE);
|
|
|
|
|
DWORD dwNewStyle = dwOldStyle & ~(WS_CAPTION | WS_THICKFRAME);
|
|
|
|
|
::SetWindowLong(hWnd, GWL_STYLE, dwNewStyle);
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
// Remove the menu bar.
|
2012-12-22 00:57:44 +00:00
|
|
|
|
::SetMenu(hWnd, NULL);
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
// Resize to full screen view.
|
|
|
|
|
// NOTE: Use SWP_FRAMECHANGED to force redraw non-client.
|
2012-12-22 00:57:44 +00:00
|
|
|
|
const int x = 0;
|
|
|
|
|
const int y = 0;
|
|
|
|
|
const int cx = ::GetSystemMetrics(SM_CXSCREEN);
|
|
|
|
|
const int cy = ::GetSystemMetrics(SM_CYSCREEN);
|
|
|
|
|
::SetWindowPos(hWnd, HWND_TOPMOST, x, y, cx, cy, SWP_FRAMECHANGED);
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
// Set full screen indicator.
|
2012-12-22 00:57:44 +00:00
|
|
|
|
g_bFullScreen = TRUE;
|
2013-05-26 21:55:23 +00:00
|
|
|
|
CorrectCursor();
|
2013-01-26 22:46:02 +00:00
|
|
|
|
ResizeDisplay();
|
2013-05-26 21:56:05 +00:00
|
|
|
|
ShowOwnedPopups(hwndMain, FALSE);
|
2013-08-03 18:46:14 +00:00
|
|
|
|
UpdateScreenScale();
|
2012-12-22 00:57:44 +00:00
|
|
|
|
}
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
void SaveStateActionFinished(bool result, void *userdata) {
|
2013-07-21 09:21:50 +00:00
|
|
|
|
PostMessage(hwndMain, WM_USER_SAVESTATE_FINISH, 0, 0);
|
2012-12-28 21:50:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-07-29 08:46:40 +00:00
|
|
|
|
HINSTANCE GetHInstance() {
|
2012-11-01 15:19:01 +00:00
|
|
|
|
return hInst;
|
|
|
|
|
}
|
|
|
|
|
}
|