mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-30 19:24:23 +01:00
Merge pull request #21188 from hrydgard/windows-cleanup
Windows code cleanup
This commit is contained in:
32 files changed
+215
-287
No files matched your search
@@ -47,6 +47,7 @@ enum class LaunchUrlType {
|
||||
BROWSER_URL,
|
||||
MARKET_URL,
|
||||
EMAIL_ADDRESS,
|
||||
LOCAL_FILE,
|
||||
};
|
||||
|
||||
void System_Vibrate(int length_ms);
|
||||
|
||||
@@ -1381,6 +1381,10 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
|
||||
INFO_LOG(Log::Loader, "Config loaded: '%s' (%0.1f ms)", iniFilename_.c_str(), (time_now_d() - startTime) * 1000.0);
|
||||
}
|
||||
|
||||
bool Config::ShouldSaveSetting(const void *ptr) const {
|
||||
return std::find(settingsNotToSave_.begin(), settingsNotToSave_.end(), ptr) == settingsNotToSave_.end();
|
||||
}
|
||||
|
||||
// If we're in game specific mode, we need to:
|
||||
// * Save the game-specific settings to the game-specific ini file.
|
||||
// * Then, save the NON-game-specific settings ONLY to the regular ini file!
|
||||
@@ -1420,6 +1424,11 @@ bool Config::Save(const char *saveReason) {
|
||||
// Skip per-game settings in non-game-specific ini.
|
||||
continue;
|
||||
}
|
||||
if (!ShouldSaveSetting(meta.settings[j].GetVoidPtr(configBlock))) {
|
||||
// Skip settings marked as "don't save".
|
||||
INFO_LOG(Log::System, "Not saving setting '%.*s' as marked as don't save.", STR_VIEW(meta.settings[j].IniKey()));
|
||||
continue;
|
||||
}
|
||||
meta.settings[j].WriteToIniSection(configBlock, section);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -306,7 +306,6 @@ public:
|
||||
int iAppSwitchMode;
|
||||
bool bFullScreen;
|
||||
bool bFullScreenMulti;
|
||||
int iForceFullScreen = -1; // -1 = nope, 0 = force off, 1 = force on (not saved.)
|
||||
int iInternalResolution; // 0 = Auto (native), 1 = 1x (480x272), 2 = 2x, 3 = 3x, 4 = 4x and so on.
|
||||
int iAnisotropyLevel; // 0 - 5, powers of 2: 0 = 1x = no aniso
|
||||
int iMultiSampleLevel;
|
||||
@@ -690,12 +689,6 @@ public:
|
||||
int NextValidBackend();
|
||||
bool IsBackendEnabled(GPUBackend backend);
|
||||
|
||||
bool UseFullScreen() const {
|
||||
if (iForceFullScreen != -1)
|
||||
return iForceFullScreen == 1;
|
||||
return bFullScreen;
|
||||
}
|
||||
|
||||
bool LoadAppendedConfig();
|
||||
void SetAppendedConfigIni(const Path &path) { appendedConfigFileName_ = path; }
|
||||
void UpdateAfterSettingAutoFrameSkip();
|
||||
@@ -718,6 +711,10 @@ public:
|
||||
|
||||
static int GetDefaultValueInt(int *configSetting);
|
||||
|
||||
void DoNotSaveSetting(void *configSetting) {
|
||||
settingsNotToSave_.push_back(configSetting);
|
||||
}
|
||||
|
||||
private:
|
||||
void LoadStandardControllerIni();
|
||||
|
||||
@@ -747,6 +744,9 @@ private:
|
||||
Path appendedConfigFileName_;
|
||||
// A set make more sense, but won't have many entry, and I dont want to include the whole std::set header here
|
||||
std::vector<std::string> appendedConfigUpdatedGames_;
|
||||
std::vector<void *> settingsNotToSave_;
|
||||
|
||||
bool ShouldSaveSetting(const void *configSetting) const;
|
||||
};
|
||||
|
||||
std::string CreateRandMAC();
|
||||
|
||||
@@ -212,7 +212,10 @@ struct ConfigSetting {
|
||||
return defaultCallback_.i ? defaultCallback_.i() : default_.i;
|
||||
}
|
||||
|
||||
std::string_view iniKey_;
|
||||
std::string_view IniKey() const {
|
||||
return iniKey_;
|
||||
}
|
||||
|
||||
const char *ini2_ = nullptr;
|
||||
const char *ini3_ = nullptr;
|
||||
const char *ini4_ = nullptr;
|
||||
@@ -229,6 +232,7 @@ struct ConfigSetting {
|
||||
}
|
||||
|
||||
private:
|
||||
std::string_view iniKey_;
|
||||
CfgFlag flags_;
|
||||
DefaultValue default_{};
|
||||
DefaultCallback defaultCallback_{};
|
||||
|
||||
@@ -891,7 +891,7 @@ int PSPOskDialog::Update(int animSpeed) {
|
||||
// Windows: Fall back to the OSK/continue normally if we're in fullscreen.
|
||||
// The dialog box doesn't work right if in fullscreen.
|
||||
if (System_GetPropertyBool(SYSPROP_HAS_KEYBOARD)) {
|
||||
if (g_Config.bBypassOSKWithKeyboard && !g_Config.UseFullScreen())
|
||||
if (g_Config.bBypassOSKWithKeyboard && !g_Config.bFullScreen)
|
||||
return NativeKeyboard();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/GPU/thin3d.h"
|
||||
|
||||
struct ShaderInfo {
|
||||
Path iniFile; // which ini file was this definition in? So we can write settings back later
|
||||
std::string section; // ini file section. This is saved.
|
||||
|
||||
+1
-1
@@ -873,7 +873,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
NativeInit(argc, (const char **)argv, savegame_dir.c_str(), external_dir.c_str(), nullptr);
|
||||
|
||||
g_mainWindow = new MainWindow(nullptr, g_Config.UseFullScreen());
|
||||
g_mainWindow = new MainWindow(nullptr, g_Config.bFullScreen);
|
||||
g_mainWindow->show();
|
||||
|
||||
// TODO: Support other backends than GL, like Vulkan, in the Qt backend.
|
||||
|
||||
+4
-5
@@ -60,16 +60,16 @@ void MainWindow::newFrame()
|
||||
{
|
||||
if (lastUIState != GetUIState()) {
|
||||
lastUIState = GetUIState();
|
||||
if (lastUIState == UISTATE_INGAME && g_Config.UseFullScreen() && !QApplication::overrideCursor() && !g_Config.bShowTouchControls)
|
||||
if (lastUIState == UISTATE_INGAME && g_Config.bFullScreen && !QApplication::overrideCursor() && !g_Config.bShowTouchControls)
|
||||
QApplication::setOverrideCursor(QCursor(Qt::BlankCursor));
|
||||
if (lastUIState != UISTATE_INGAME && g_Config.UseFullScreen() && QApplication::overrideCursor())
|
||||
if (lastUIState != UISTATE_INGAME && g_Config.bFullScreen && QApplication::overrideCursor())
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
updateMenus();
|
||||
}
|
||||
|
||||
if (g_Config.UseFullScreen() != isFullScreen())
|
||||
SetFullScreen(g_Config.UseFullScreen());
|
||||
if (g_Config.bFullScreen != isFullScreen())
|
||||
SetFullScreen(g_Config.bFullScreen);
|
||||
|
||||
std::unique_lock<std::mutex> lock(msgMutex_);
|
||||
while (!msgQueue_.empty()) {
|
||||
@@ -407,7 +407,6 @@ void MainWindow::fullscrAct()
|
||||
{
|
||||
// Toggle the current state.
|
||||
g_Config.bFullScreen = !isFullScreen();
|
||||
g_Config.iForceFullScreen = -1;
|
||||
SetFullScreen(g_Config.bFullScreen);
|
||||
|
||||
QTimer::singleShot(1000, this, SLOT(raiseTopMost()));
|
||||
|
||||
@@ -549,7 +549,7 @@ TOGGLE_METHOD_INVERSE(BreakOnLoad, g_Config.bAutoRun)
|
||||
TOGGLE_METHOD(IgnoreIllegalRWs, g_Config.bIgnoreBadMemAccess)
|
||||
TOGGLE_METHOD(AutoFrameSkip, g_Config.bAutoFrameSkip, g_Config.UpdateAfterSettingAutoFrameSkip())
|
||||
TOGGLE_METHOD(SoftwareRendering, g_Config.bSoftwareRendering)
|
||||
TOGGLE_METHOD(FullScreen, g_Config.bFullScreen, System_MakeRequest(SystemRequestType::TOGGLE_FULLSCREEN_STATE, 0, g_Config.UseFullScreen() ? "1" : "0", "", 3, 0))
|
||||
TOGGLE_METHOD(FullScreen, g_Config.bFullScreen, System_MakeRequest(SystemRequestType::TOGGLE_FULLSCREEN_STATE, 0, g_Config.bFullScreen ? "1" : "0", "", 3, 0))
|
||||
// TOGGLE_METHOD(VSync, g_Config.bVSync)
|
||||
#undef TOGGLE_METHOD
|
||||
|
||||
|
||||
+7
-10
@@ -965,9 +965,8 @@ static void ProcessSDLEvent(SDL_Window *window, const SDL_Event &event, InputSta
|
||||
Native_UpdateScreenScale(new_width_px, new_height_px, UIScaleFactorToMultiplier(g_Config.iUIScaleFactor));
|
||||
|
||||
// Set variable here in case fullscreen was toggled by hotkey
|
||||
if (g_Config.UseFullScreen() != fullscreen) {
|
||||
if (g_Config.bFullScreen != fullscreen) {
|
||||
g_Config.bFullScreen = fullscreen;
|
||||
g_Config.iForceFullScreen = -1;
|
||||
} else {
|
||||
// It is possible for the monitor to change DPI, so recalculate
|
||||
// DPI on each resize event.
|
||||
@@ -1341,9 +1340,9 @@ void UpdateSDLCursor() {
|
||||
#if !defined(MOBILE_DEVICE)
|
||||
if (lastUIState != GetUIState()) {
|
||||
lastUIState = GetUIState();
|
||||
if (lastUIState == UISTATE_INGAME && g_Config.UseFullScreen() && !g_Config.bShowTouchControls)
|
||||
if (lastUIState == UISTATE_INGAME && g_Config.bFullScreen && !g_Config.bShowTouchControls)
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
if (lastUIState != UISTATE_INGAME || !g_Config.UseFullScreen())
|
||||
if (lastUIState != UISTATE_INGAME || !g_Config.bFullScreen)
|
||||
SDL_ShowCursor(SDL_ENABLE);
|
||||
}
|
||||
#endif
|
||||
@@ -1471,7 +1470,7 @@ int main(int argc, char *argv[]) {
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (!strcmp(argv[i], "--fullscreen")) {
|
||||
mode |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
g_Config.iForceFullScreen = 1;
|
||||
g_Config.DoNotSaveSetting(&g_Config.bFullScreen);
|
||||
} else if (set_xres == -2)
|
||||
set_xres = parseInt(argv[i]);
|
||||
else if (set_yres == -2)
|
||||
@@ -1578,8 +1577,7 @@ int main(int argc, char *argv[]) {
|
||||
if (mode & SDL_WINDOW_FULLSCREEN_DESKTOP) {
|
||||
g_display.pixel_xres = g_DesktopWidth;
|
||||
g_display.pixel_yres = g_DesktopHeight;
|
||||
if (g_Config.iForceFullScreen == -1)
|
||||
g_Config.bFullScreen = true;
|
||||
g_Config.bFullScreen = true;
|
||||
} else {
|
||||
// set a sensible default resolution (2x)
|
||||
g_display.pixel_xres = 480 * 2 * set_scale;
|
||||
@@ -1587,8 +1585,7 @@ int main(int argc, char *argv[]) {
|
||||
if (portrait) {
|
||||
std::swap(g_display.pixel_xres, g_display.pixel_yres);
|
||||
}
|
||||
if (g_Config.iForceFullScreen == -1)
|
||||
g_Config.bFullScreen = false;
|
||||
g_Config.bFullScreen = false;
|
||||
}
|
||||
|
||||
if (set_ipad) {
|
||||
@@ -1639,7 +1636,7 @@ int main(int argc, char *argv[]) {
|
||||
NativeInit(remain_argc, (const char **)remain_argv, path, external_dir, nullptr);
|
||||
|
||||
// Use the setting from the config when initing the window.
|
||||
if (g_Config.UseFullScreen())
|
||||
if (g_Config.bFullScreen)
|
||||
mode |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
|
||||
int x = SDL_WINDOWPOS_UNDEFINED_DISPLAY(getDisplayNumber());
|
||||
|
||||
+1
-1
@@ -178,7 +178,7 @@ void ChatMenu::Update() {
|
||||
#if defined(USING_WIN_UI)
|
||||
// Could remove the fullscreen check here, it works now.
|
||||
auto n = GetI18NCategory(I18NCat::NETWORKING);
|
||||
if (promptInput_ && g_Config.bBypassOSKWithKeyboard && !g_Config.UseFullScreen()) {
|
||||
if (promptInput_ && g_Config.bBypassOSKWithKeyboard && !g_Config.bFullScreen) {
|
||||
System_InputBoxGetString(token_, n->T("Chat"), n->T("Chat Here"), false, [](const std::string &value, int) {
|
||||
sendChat(value);
|
||||
});
|
||||
|
||||
@@ -417,7 +417,7 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
|
||||
if (System_GetPropertyInt(SYSPROP_DISPLAY_COUNT) > 1) {
|
||||
CheckBox *fullscreenMulti = new CheckBox(&g_Config.bFullScreenMulti, gr->T("Use all displays"));
|
||||
fullscreenMulti->SetEnabledFunc([] {
|
||||
return g_Config.UseFullScreen();
|
||||
return g_Config.bFullScreen;
|
||||
});
|
||||
graphicsSettings->Add(fullscreenMulti)->OnClick.Handle(this, &GameSettingsScreen::OnFullscreenMultiChange);
|
||||
}
|
||||
@@ -1622,12 +1622,11 @@ void GameSettingsScreen::OnChangeBackground(UI::EventParams &e) {
|
||||
}
|
||||
|
||||
void GameSettingsScreen::OnFullscreenChange(UI::EventParams &e) {
|
||||
g_Config.iForceFullScreen = -1;
|
||||
System_ToggleFullscreenState(g_Config.UseFullScreen() ? "1" : "0");
|
||||
System_ToggleFullscreenState(g_Config.bFullScreen ? "1" : "0");
|
||||
}
|
||||
|
||||
void GameSettingsScreen::OnFullscreenMultiChange(UI::EventParams &e) {
|
||||
System_ToggleFullscreenState(g_Config.UseFullScreen() ? "1" : "0");
|
||||
System_ToggleFullscreenState(g_Config.bFullScreen ? "1" : "0");
|
||||
}
|
||||
|
||||
void GameSettingsScreen::dialogFinished(const Screen *dialog, DialogResult result) {
|
||||
|
||||
+2
-4
@@ -1428,7 +1428,7 @@ void MainScreen::CreateViews() {
|
||||
ViewGroup *logo = new LogoView(false, new LinearLayoutParams(FILL_PARENT, 80.0f));
|
||||
#if !defined(MOBILE_DEVICE)
|
||||
auto gr = GetI18NCategory(I18NCat::GRAPHICS);
|
||||
ImageID icon(g_Config.UseFullScreen() ? "I_RESTORE" : "I_FULLSCREEN");
|
||||
ImageID icon(g_Config.bFullScreen ? "I_RESTORE" : "I_FULLSCREEN");
|
||||
fullscreenButton_ = logo->Add(new Button(gr->T("FullScreen", "Full Screen"), icon, new AnchorLayoutParams(48, 48, NONE, 0, 0, NONE, Centering::None)));
|
||||
fullscreenButton_->SetIgnoreText(true);
|
||||
fullscreenButton_->OnClick.Handle(this, &MainScreen::OnFullScreenToggle);
|
||||
@@ -1511,10 +1511,8 @@ void MainScreen::OnLoadFile(UI::EventParams &e) {
|
||||
}
|
||||
|
||||
void MainScreen::OnFullScreenToggle(UI::EventParams &e) {
|
||||
if (g_Config.iForceFullScreen != -1)
|
||||
g_Config.bFullScreen = g_Config.UseFullScreen();
|
||||
if (fullscreenButton_) {
|
||||
fullscreenButton_->SetImageID(ImageID(!g_Config.UseFullScreen() ? "I_RESTORE" : "I_FULLSCREEN"));
|
||||
fullscreenButton_->SetImageID(ImageID(!g_Config.bFullScreen ? "I_RESTORE" : "I_FULLSCREEN"));
|
||||
}
|
||||
#if !defined(MOBILE_DEVICE)
|
||||
g_Config.bFullScreen = !g_Config.bFullScreen;
|
||||
|
||||
+4
-2
@@ -580,14 +580,16 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
if (!strncmp(argv[i], "--pause-menu-exit", strlen("--pause-menu-exit")))
|
||||
g_Config.bPauseMenuExitsEmulator = true;
|
||||
if (!strcmp(argv[i], "--fullscreen")) {
|
||||
g_Config.iForceFullScreen = 1;
|
||||
g_Config.DoNotSaveSetting(&g_Config.bFullScreen);
|
||||
g_Config.bFullScreen = true;
|
||||
System_ToggleFullscreenState("1");
|
||||
}
|
||||
if (!strncmp(argv[i], "--root=", strlen("--root=")) && strlen(argv[i]) > strlen("--root=")) {
|
||||
g_Config.mountRoot = Path(argv[i] + strlen("--root="));
|
||||
}
|
||||
if (!strcmp(argv[i], "--windowed")) {
|
||||
g_Config.iForceFullScreen = 0;
|
||||
g_Config.DoNotSaveSetting(&g_Config.bFullScreen);
|
||||
g_Config.bFullScreen = false;
|
||||
System_ToggleFullscreenState("0");
|
||||
}
|
||||
if (!strcmp(argv[i], "--touchscreentest"))
|
||||
|
||||
+2
-3
@@ -264,9 +264,9 @@ void App::OnActivated(const CoreApplicationView& applicationView, const IActivat
|
||||
CoreWindow::GetForCurrentThread().Activate();
|
||||
// On mobile, we force-enter fullscreen mode.
|
||||
if (m_isPhone)
|
||||
g_Config.iForceFullScreen = 1;
|
||||
g_Config.bFullScreen = true;
|
||||
|
||||
if (g_Config.UseFullScreen())
|
||||
if (g_Config.bFullScreen)
|
||||
winrt::Windows::UI::ViewManagement::ApplicationView::GetForCurrentView().TryEnterFullScreenMode();
|
||||
|
||||
//Detect if app started or activated by launch item (file, uri)
|
||||
@@ -300,7 +300,6 @@ void App::OnResuming(const IInspectable& sender, const IInspectable& args) {
|
||||
void App::OnWindowSizeChanged(const CoreWindow& sender, const WindowSizeChangedEventArgs& args) {
|
||||
auto view = winrt::Windows::UI::ViewManagement::ApplicationView::GetForCurrentView();
|
||||
g_Config.bFullScreen = view.IsFullScreenMode();
|
||||
g_Config.iForceFullScreen = -1;
|
||||
|
||||
float width = sender.Bounds().Width;
|
||||
float height = sender.Bounds().Height;
|
||||
|
||||
@@ -24,10 +24,9 @@
|
||||
#include "Common/Data/Encoding/Utf8.h"
|
||||
#include "Common/System/Display.h"
|
||||
|
||||
#include <tchar.h>
|
||||
#include <set>
|
||||
|
||||
TCHAR CtrlDisAsmView::szClassName[] = _T("CtrlDisAsmView");
|
||||
constexpr wchar_t *szClassName = L"CtrlDisAsmView";
|
||||
|
||||
static constexpr UINT_PTR IDT_REDRAW = 0xC0DE0001;
|
||||
static constexpr UINT REDRAW_DELAY = 1000 / 60;
|
||||
|
||||
@@ -25,8 +25,7 @@
|
||||
#include "Core/MIPS/MIPSDebugInterface.h"
|
||||
#include "Core/Debugger/DisassemblyManager.h"
|
||||
|
||||
class CtrlDisAsmView
|
||||
{
|
||||
class CtrlDisAsmView {
|
||||
HWND wnd;
|
||||
HFONT font;
|
||||
HFONT boldfont;
|
||||
@@ -41,7 +40,6 @@ class CtrlDisAsmView
|
||||
bool hasFocus;
|
||||
bool showHex;
|
||||
MIPSDebugInterface *debugger;
|
||||
static TCHAR szClassName[];
|
||||
|
||||
u32 windowStart;
|
||||
int visibleRows;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include <cmath>
|
||||
#include <tchar.h>
|
||||
|
||||
#include "Common/System/Display.h"
|
||||
#include "Common/Data/Encoding/Utf8.h"
|
||||
@@ -21,7 +20,7 @@
|
||||
|
||||
enum { REGISTER_PC = 32, REGISTER_HI, REGISTER_LO, REGISTERS_END };
|
||||
|
||||
TCHAR CtrlRegisterList::szClassName[] = _T("CtrlRegisterList");
|
||||
constexpr wchar_t *szClassName = L"CtrlRegisterList";
|
||||
|
||||
static constexpr UINT_PTR IDT_REDRAW = 0xC0DE0001;
|
||||
static constexpr UINT REDRAW_DELAY = 1000 / 60;
|
||||
|
||||
@@ -18,8 +18,7 @@
|
||||
|
||||
#include "Core/MIPS/MIPSDebugInterface.h"
|
||||
|
||||
class CtrlRegisterList
|
||||
{
|
||||
class CtrlRegisterList {
|
||||
HWND wnd;
|
||||
HFONT font;
|
||||
RECT rect;
|
||||
@@ -33,7 +32,6 @@ class CtrlRegisterList
|
||||
bool selecting = false;
|
||||
bool hasFocus = false;
|
||||
MIPSDebugInterface *cpu = nullptr;
|
||||
static TCHAR szClassName[];
|
||||
|
||||
u32 lastPC = 0;
|
||||
u32 *lastCat0Values = nullptr;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include <algorithm>
|
||||
#include <tchar.h>
|
||||
#include "Common/Data/Encoding/Utf8.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/System/Display.h"
|
||||
@@ -13,14 +12,14 @@
|
||||
#include "GPU/Debugger/Breakpoints.h"
|
||||
#include "GPU/GPUState.h"
|
||||
|
||||
LPCTSTR CtrlDisplayListView::windowClass = _T("CtrlDisplayListView");
|
||||
constexpr wchar_t *szWindowClass = L"CtrlDisplayListView";
|
||||
|
||||
void CtrlDisplayListView::registerClass()
|
||||
{
|
||||
WNDCLASSEX wndClass;
|
||||
|
||||
wndClass.cbSize = sizeof(wndClass);
|
||||
wndClass.lpszClassName = windowClass;
|
||||
wndClass.lpszClassName = szWindowClass;
|
||||
wndClass.hInstance = GetModuleHandle(0);
|
||||
wndClass.lpfnWndProc = wndProc;
|
||||
wndClass.hCursor = LoadCursor (NULL, IDC_ARROW);
|
||||
|
||||
@@ -4,11 +4,9 @@
|
||||
#include "Common/CommonWindows.h"
|
||||
#include "GPU/GPUDefinitions.h"
|
||||
|
||||
class CtrlDisplayListView
|
||||
{
|
||||
class CtrlDisplayListView {
|
||||
HWND wnd;
|
||||
RECT rect;
|
||||
static LPCTSTR windowClass;
|
||||
DisplayList list;
|
||||
|
||||
HFONT font;
|
||||
|
||||
@@ -437,7 +437,7 @@ void CGEDebugger::DescribeSecondPreview(const GPUgstate &state, char desc[256])
|
||||
}
|
||||
|
||||
void CGEDebugger::PreviewExport(const GPUDebugBuffer *dbgBuffer) {
|
||||
const TCHAR *filter = L"PNG Image (*.png)\0*.png\0JPEG Image (*.jpg)\0*.jpg\0All files\0*.*\0\0";
|
||||
constexpr wchar_t *filter = L"PNG Image (*.png)\0*.png\0JPEG Image (*.jpg)\0*.jpg\0All files\0*.*\0\0";
|
||||
std::string fn;
|
||||
if (W32Util::BrowseForFileName(false, GetDlgHandle(), L"Save Preview Image...", nullptr, filter, L"png", fn)) {
|
||||
ScreenshotFormat fmt = fn.find(".jpg") != fn.npos ? ScreenshotFormat::JPG : ScreenshotFormat::PNG;
|
||||
|
||||
@@ -544,10 +544,11 @@ void CtrlMatrixList::OnRightClick(int row, int column, const POINT &point) {
|
||||
|
||||
case ID_DISASM_COPYINSTRUCTIONDISASM:
|
||||
{
|
||||
// Not really copy instruction, more like copy a float.
|
||||
float val;
|
||||
if (GetValue(gpuDebug->GetGState(), row, column, val)) {
|
||||
wchar_t dest[512];
|
||||
swprintf(dest, 511, L"%f", val);
|
||||
char dest[128];
|
||||
snprintf(dest, sizeof(dest), "%f", val);
|
||||
W32Util::CopyTextToClipboard(GetHandle(), dest);
|
||||
}
|
||||
break;
|
||||
|
||||
+80
-153
@@ -26,8 +26,7 @@
|
||||
#include "Common/OSVersion.h"
|
||||
|
||||
#include <Windowsx.h>
|
||||
#include <shellapi.h>
|
||||
#include <commctrl.h>
|
||||
#include <shellapi.h> // For drag/drop functionality
|
||||
#include <string>
|
||||
#include <dwmapi.h>
|
||||
|
||||
@@ -37,7 +36,6 @@
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/Data/Text/I18n.h"
|
||||
#include "Common/Data/Text/Parsers.h"
|
||||
#include "Common/Input/InputState.h"
|
||||
#include "Common/Input/KeyCodes.h"
|
||||
#include "Common/Thread/ThreadUtil.h"
|
||||
@@ -51,12 +49,9 @@
|
||||
#include "Core/Instance.h"
|
||||
#include "Core/KeyMap.h"
|
||||
#include "Core/MIPS/JitCommon/JitCommon.h"
|
||||
#include "Core/MIPS/JitCommon/JitBlockCache.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Windows/InputBox.h"
|
||||
#include "Windows/InputDevice.h"
|
||||
#if PPSSPP_API(ANY_GL)
|
||||
#include "Windows/GPU/WindowsGLContext.h"
|
||||
#include "Windows/GEDebugger/GEDebugger.h"
|
||||
#endif
|
||||
#include "Windows/W32Util/DarkMode.h"
|
||||
@@ -77,17 +72,13 @@
|
||||
#include "Common/Log/LogManager.h"
|
||||
#include "Common/Log/ConsoleListener.h"
|
||||
#include "Windows/W32Util/DialogManager.h"
|
||||
#include "Windows/W32Util/ShellUtil.h"
|
||||
#include "Windows/W32Util/Misc.h"
|
||||
#include "Windows/RawInput.h"
|
||||
#include "Windows/CaptureDevice.h"
|
||||
#include "Windows/TouchInputHandler.h"
|
||||
#include "Windows/MainWindowMenu.h"
|
||||
#include "GPU/GPUCommon.h"
|
||||
#include "UI/OnScreenDisplay.h"
|
||||
#include "UI/GameSettingsScreen.h"
|
||||
#include "UI/PauseScreen.h"
|
||||
#include "Core/SaveState.h"
|
||||
|
||||
#define MOUSEEVENTF_FROMTOUCH_NOPEN 0xFF515780 //http://msdn.microsoft.com/en-us/library/windows/desktop/ms703320(v=vs.85).aspx
|
||||
#define MOUSEEVENTF_MASK_PLUS_PENTOUCH 0xFFFFFF80
|
||||
@@ -123,11 +114,32 @@ static std::wstring g_windowTitle;
|
||||
#define CURSORUPDATE_INTERVAL_MS 1000
|
||||
#define CURSORUPDATE_MOVE_TIMESPAN_MS 500
|
||||
|
||||
namespace MainWindow
|
||||
{
|
||||
HWND hwndMain;
|
||||
HWND hwndGameList;
|
||||
TouchInputHandler touchHandler;
|
||||
inline WindowSizeState ShowCmdToWindowSizeState(const int showCmd) {
|
||||
switch (showCmd) {
|
||||
case SW_SHOWMAXIMIZED:
|
||||
return WindowSizeState::Maximized;
|
||||
case SW_SHOWMINIMIZED:
|
||||
return WindowSizeState::Minimized;
|
||||
case SW_SHOWNORMAL:
|
||||
default:
|
||||
return WindowSizeState::Normal;
|
||||
}
|
||||
}
|
||||
|
||||
inline int WindowSizeStateToShowCmd(const WindowSizeState windowSizeState) {
|
||||
switch (windowSizeState) {
|
||||
case WindowSizeState::Maximized:
|
||||
return SW_SHOWMAXIMIZED;
|
||||
case WindowSizeState::Minimized:
|
||||
return SW_SHOWMINIMIZED;
|
||||
default:
|
||||
return SW_SHOWNORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
namespace MainWindow {
|
||||
static HWND hwndMain;
|
||||
static TouchInputHandler touchHandler;
|
||||
|
||||
static HMENU g_hMenu;
|
||||
|
||||
@@ -143,23 +155,22 @@ namespace MainWindow
|
||||
static bool inFullscreenResize = false;
|
||||
static bool inResizeMove = false;
|
||||
static bool hasFocus = true;
|
||||
static bool g_isFullscreen = false;
|
||||
static bool g_keepScreenBright = false;
|
||||
|
||||
static bool disasmMapLoadPending = false;
|
||||
static bool memoryMapLoadPending = false;
|
||||
static bool wasMinimized = false;
|
||||
|
||||
// gross hack
|
||||
bool noFocusPause = false; // TOGGLE_PAUSE state to override pause on lost focus
|
||||
bool trapMouse = true; // Handles some special cases(alt+tab, win menu) when game is running and mouse is confined
|
||||
static bool trapMouse = true; // Handles some special cases(alt+tab, win menu) when game is running and mouse is confined
|
||||
|
||||
static const TCHAR szWindowClass[] = L"PPSSPPWnd";
|
||||
static constexpr wchar_t *szWindowClass = L"PPSSPPWnd";
|
||||
|
||||
static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
HWND GetHWND() {
|
||||
return hwndMain;
|
||||
}
|
||||
HWND GetHWND() { return hwndMain; }
|
||||
HINSTANCE GetHInstance() { return hInst; }
|
||||
|
||||
void SetKeepScreenBright(bool keepBright) {
|
||||
g_keepScreenBright = keepBright;
|
||||
@@ -167,14 +178,13 @@ namespace MainWindow
|
||||
|
||||
void Init(HINSTANCE hInstance) {
|
||||
// Register classes - Main Window
|
||||
WNDCLASSEX wcex;
|
||||
memset(&wcex, 0, sizeof(wcex));
|
||||
WNDCLASSEX wcex{};
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
wcex.style = 0; // Show in taskbar
|
||||
wcex.lpfnWndProc = (WNDPROC)WndProc;
|
||||
wcex.hInstance = hInstance;
|
||||
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
|
||||
wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); // or NULL?
|
||||
wcex.lpszMenuName = (LPCWSTR)IDR_MENU1;
|
||||
wcex.lpszClassName = szWindowClass;
|
||||
wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_PPSSPP);
|
||||
@@ -183,23 +193,12 @@ namespace MainWindow
|
||||
}
|
||||
|
||||
void SavePosition() {
|
||||
if (g_Config.UseFullScreen() || inFullscreenResize)
|
||||
if (g_Config.bFullScreen || inFullscreenResize)
|
||||
return;
|
||||
|
||||
WINDOWPLACEMENT placement{};
|
||||
GetWindowPlacement(hwndMain, &placement);
|
||||
switch (placement.showCmd) {
|
||||
case SW_SHOWMAXIMIZED:
|
||||
g_Config.iWindowSizeState = (int)WindowSizeState::Maximized;
|
||||
break;
|
||||
case SW_SHOWMINIMIZED:
|
||||
g_Config.iWindowSizeState = (int)WindowSizeState::Minimized;
|
||||
break;
|
||||
case SW_SHOWNORMAL:
|
||||
g_Config.iWindowSizeState = (int)WindowSizeState::Normal;
|
||||
break;
|
||||
}
|
||||
|
||||
g_Config.iWindowSizeState = (int)ShowCmdToWindowSizeState(placement.showCmd);
|
||||
g_Config.iWindowX = placement.rcNormalPosition.left;
|
||||
g_Config.iWindowY = placement.rcNormalPosition.top;
|
||||
g_Config.iWindowWidth = placement.rcNormalPosition.right - placement.rcNormalPosition.left;
|
||||
@@ -242,7 +241,7 @@ namespace MainWindow
|
||||
}
|
||||
|
||||
void CorrectCursor() {
|
||||
bool autoHide = ((g_Config.UseFullScreen() && !mouseButtonDown) || (g_Config.bMouseControl && trapMouse)) && GetUIState() == UISTATE_INGAME;
|
||||
bool autoHide = ((g_Config.bFullScreen && !mouseButtonDown) || (g_Config.bMouseControl && trapMouse)) && GetUIState() == UISTATE_INGAME;
|
||||
if (autoHide && (hideCursor || g_Config.bMouseControl)) {
|
||||
while (cursorCounter >= 0) {
|
||||
cursorCounter = ShowCursor(FALSE);
|
||||
@@ -290,7 +289,7 @@ namespace MainWindow
|
||||
}
|
||||
|
||||
// Don't save the window state if fullscreen.
|
||||
if (!g_Config.UseFullScreen()) {
|
||||
if (!g_Config.bFullScreen) {
|
||||
g_WindowState = newSizingType;
|
||||
}
|
||||
}
|
||||
@@ -337,11 +336,7 @@ namespace MainWindow
|
||||
// Remove the menu bar if going fullscreen. This can trigger WM_SIZE because the contents change size.
|
||||
::SetMenu(hWnd, goingFullscreen || !g_Config.bShowMenuBar ? NULL : g_hMenu);
|
||||
|
||||
if (g_Config.UseFullScreen() != goingFullscreen) {
|
||||
g_Config.bFullScreen = goingFullscreen;
|
||||
g_Config.iForceFullScreen = -1;
|
||||
}
|
||||
g_isFullscreen = goingFullscreen;
|
||||
g_Config.bFullScreen = goingFullscreen;
|
||||
|
||||
g_IgnoreWM_SIZE = false;
|
||||
|
||||
@@ -402,7 +397,7 @@ namespace MainWindow
|
||||
bool resetPositionX = true;
|
||||
bool resetPositionY = true;
|
||||
|
||||
if (g_Config.iWindowWidth > 0 && g_Config.iWindowHeight > 0 && !g_Config.UseFullScreen()) {
|
||||
if (g_Config.iWindowWidth > 0 && g_Config.iWindowHeight > 0 && !g_Config.bFullScreen) {
|
||||
bool visibleHorizontally = ((g_Config.iWindowX + g_Config.iWindowWidth) >= virtualScreenX) &&
|
||||
((g_Config.iWindowX + g_Config.iWindowWidth) < (virtualScreenWidth + g_Config.iWindowWidth));
|
||||
|
||||
@@ -477,41 +472,28 @@ namespace MainWindow
|
||||
|
||||
BOOL Show(HINSTANCE hInstance) {
|
||||
hInst = hInstance; // Store instance handle in our global variable.
|
||||
RECT rc = DetermineWindowRectangle();
|
||||
|
||||
u32 style = WS_OVERLAPPEDWINDOW;
|
||||
hwndMain = CreateWindowEx(0, szWindowClass, L"", WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
|
||||
|
||||
hwndMain = CreateWindowEx(0, szWindowClass, L"", style,
|
||||
rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, NULL, NULL, hInstance, NULL);
|
||||
if (!hwndMain)
|
||||
return FALSE;
|
||||
|
||||
g_hMenu = GetMenu(hwndMain);
|
||||
|
||||
WINDOWPLACEMENT placement = {sizeof(WINDOWPLACEMENT)};
|
||||
placement.showCmd = SW_SHOWNORMAL;
|
||||
switch ((WindowSizeState)g_Config.iWindowSizeState) {
|
||||
case WindowSizeState::Maximized:
|
||||
placement.showCmd = SW_SHOWMAXIMIZED;
|
||||
break;
|
||||
case WindowSizeState::Minimized:
|
||||
placement.showCmd = SW_SHOWMINIMIZED;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
placement.showCmd = WindowSizeStateToShowCmd((WindowSizeState)g_Config.iWindowSizeState);
|
||||
placement.rcNormalPosition.left = g_Config.iWindowX;
|
||||
placement.rcNormalPosition.top = g_Config.iWindowY;
|
||||
placement.rcNormalPosition.right = g_Config.iWindowX + g_Config.iWindowWidth;
|
||||
placement.rcNormalPosition.bottom = g_Config.iWindowY + g_Config.iWindowHeight;
|
||||
SetWindowPlacement(hwndMain, &placement);
|
||||
|
||||
if (!hwndMain)
|
||||
return FALSE;
|
||||
|
||||
SetWindowLong(hwndMain, GWL_EXSTYLE, WS_EX_APPWINDOW);
|
||||
// SetWindowLong(hwndMain, GWL_EXSTYLE, WS_EX_APPWINDOW);
|
||||
|
||||
const DWM_WINDOW_CORNER_PREFERENCE pref = DWMWCP_DONOTROUND;
|
||||
DwmSetWindowAttribute(hwndMain, DWMWA_WINDOW_CORNER_PREFERENCE, &pref, sizeof(pref));
|
||||
|
||||
g_hMenu = GetMenu(hwndMain);
|
||||
|
||||
MainMenuInit(hwndMain, g_hMenu);
|
||||
|
||||
// Accept dragged files.
|
||||
@@ -520,7 +502,7 @@ namespace MainWindow
|
||||
hideCursor = true;
|
||||
SetTimer(hwndMain, TIMER_CURSORUPDATE, CURSORUPDATE_INTERVAL_MS, 0);
|
||||
|
||||
ToggleFullscreen(hwndMain, g_Config.UseFullScreen());
|
||||
ToggleFullscreen(hwndMain, g_Config.bFullScreen);
|
||||
|
||||
W32Util::MakeTopMost(hwndMain, g_Config.bTopMost);
|
||||
|
||||
@@ -539,9 +521,10 @@ namespace MainWindow
|
||||
disasmWindow = new CDisasm(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS);
|
||||
DialogManager::AddDlg(disasmWindow);
|
||||
}
|
||||
if (disasmMapLoadPending)
|
||||
if (disasmMapLoadPending) {
|
||||
disasmWindow->NotifyMapLoaded();
|
||||
disasmMapLoadPending = false;
|
||||
disasmMapLoadPending = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CreateGeDebuggerWindow() {
|
||||
@@ -558,9 +541,10 @@ namespace MainWindow
|
||||
memoryWindow = new CMemoryDlg(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS);
|
||||
DialogManager::AddDlg(memoryWindow);
|
||||
}
|
||||
if (memoryMapLoadPending)
|
||||
if (memoryMapLoadPending) {
|
||||
memoryWindow->NotifyMapLoaded();
|
||||
memoryMapLoadPending = false;
|
||||
memoryMapLoadPending = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CreateVFPUWindow() {
|
||||
@@ -599,37 +583,6 @@ namespace MainWindow
|
||||
vfpudlg = nullptr;
|
||||
}
|
||||
|
||||
RECT MapRectFromClientToWndCoords(HWND hwnd, const RECT & r)
|
||||
{
|
||||
RECT wnd_coords = r;
|
||||
|
||||
// map to screen
|
||||
MapWindowPoints(hwnd, NULL, reinterpret_cast<POINT *>(&wnd_coords), 2);
|
||||
|
||||
RECT scr_coords;
|
||||
GetWindowRect(hwnd, &scr_coords);
|
||||
|
||||
// map to window coords by substracting the window coord origin in
|
||||
// screen coords.
|
||||
OffsetRect(&wnd_coords, -scr_coords.left, -scr_coords.top);
|
||||
|
||||
return wnd_coords;
|
||||
}
|
||||
|
||||
RECT GetNonclientMenuBorderRect(HWND hwnd)
|
||||
{
|
||||
RECT r;
|
||||
GetClientRect(hwnd, &r);
|
||||
r = MapRectFromClientToWndCoords(hwnd, r);
|
||||
int y = r.top - 1;
|
||||
return {
|
||||
r.left,
|
||||
y,
|
||||
r.right,
|
||||
y + 1
|
||||
};
|
||||
}
|
||||
|
||||
bool ConfirmAction(HWND hWnd, bool actionIsReset) {
|
||||
const GlobalUIState state = GetUIState();
|
||||
if (state == UISTATE_MENU || state == UISTATE_EXIT) {
|
||||
@@ -659,8 +612,6 @@ namespace MainWindow
|
||||
}
|
||||
|
||||
static bool first = true;
|
||||
static bool wasMinimized = false;
|
||||
|
||||
switch (message) {
|
||||
case WM_CREATE:
|
||||
first = true;
|
||||
@@ -701,28 +652,23 @@ namespace MainWindow
|
||||
// Return game ID as four u32 values
|
||||
// wParam: 0-3 = which u32 to return (chars 0-3, 4-7, 8-11, 12-15)
|
||||
// Returns: packed u32 with 4 bytes of game ID
|
||||
if (!PSP_IsInited())
|
||||
{
|
||||
if (!PSP_IsInited()) {
|
||||
return 0;
|
||||
}
|
||||
const std::string gameID = Reporting::CurrentGameID();
|
||||
if (gameID.empty())
|
||||
{
|
||||
if (gameID.empty()) {
|
||||
return 0;
|
||||
}
|
||||
const size_t offset = (wParam & 0x3) * 4; // 0, 4, 8, 12
|
||||
u32 packed = 0;
|
||||
for (size_t i = 0; i < 4; ++i)
|
||||
{
|
||||
if (offset + i < gameID.length())
|
||||
{
|
||||
for (size_t i = 0; i < 4; ++i) {
|
||||
if (offset + i < gameID.length()) {
|
||||
const u8 c = static_cast<u8>(gameID[offset + i]);
|
||||
packed |= ((u32)c << (i * 8));
|
||||
}
|
||||
}
|
||||
return packed;
|
||||
}
|
||||
break;
|
||||
case WM_USER_GET_MODULE_INFO:
|
||||
{
|
||||
// Get module information by name
|
||||
@@ -766,7 +712,6 @@ namespace MainWindow
|
||||
// Module not found
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
// Hack to kill the white line underneath the menubar.
|
||||
// From https://stackoverflow.com/questions/57177310/how-to-paint-over-white-line-between-menu-bar-and-client-area-of-window
|
||||
@@ -780,7 +725,7 @@ namespace MainWindow
|
||||
auto result = DefWindowProc(hWnd, message, wParam, lParam);
|
||||
// Paint over the line with pure black. Could also try to figure out the dark theme color.
|
||||
HDC hdc = GetWindowDC(hWnd);
|
||||
RECT r = GetNonclientMenuBorderRect(hWnd);
|
||||
RECT r = W32Util::GetNonclientMenuBorderRect(hWnd);
|
||||
HBRUSH red = CreateSolidBrush(RGB(0, 0, 0));
|
||||
FillRect(hdc, &r, red);
|
||||
DeleteObject(red);
|
||||
@@ -799,8 +744,8 @@ namespace MainWindow
|
||||
AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, TRUE);
|
||||
minmax->ptMinTrackSize.x = rc.right - rc.left;
|
||||
minmax->ptMinTrackSize.y = rc.bottom - rc.top;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
|
||||
case WM_ACTIVATE:
|
||||
{
|
||||
@@ -999,9 +944,9 @@ namespace MainWindow
|
||||
|
||||
case WM_DROPFILES:
|
||||
{
|
||||
if (!MainThread_Ready())
|
||||
if (!MainThread_Ready()) {
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
|
||||
}
|
||||
const HDROP hdrop = (HDROP)wParam;
|
||||
const int count = DragQueryFile(hdrop, 0xFFFFFFFF, 0, 0);
|
||||
if (count != 1) {
|
||||
@@ -1114,16 +1059,14 @@ namespace MainWindow
|
||||
}
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
case WM_SETTINGCHANGE:
|
||||
{
|
||||
if (g_darkModeSupported && IsColorSchemeChangeMessage(lParam))
|
||||
SendMessageW(hWnd, WM_THEMECHANGED, 0, 0);
|
||||
if (g_darkModeSupported && IsColorSchemeChangeMessage(lParam)) {
|
||||
SendMessageW(hWnd, WM_THEMECHANGED, 0, 0);
|
||||
}
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
|
||||
case WM_THEMECHANGED:
|
||||
{
|
||||
if (g_darkModeSupported)
|
||||
{
|
||||
if (g_darkModeSupported) {
|
||||
_AllowDarkModeForWindow(hWnd, g_darkModeEnabled);
|
||||
RefreshTitleBarThemeColor(hWnd);
|
||||
}
|
||||
@@ -1144,13 +1087,10 @@ namespace MainWindow
|
||||
case ImGuiMouseCursor_ResizeNWSE: win32_cursor = IDC_SIZENWSE; break;
|
||||
case ImGuiMouseCursor_Hand: win32_cursor = IDC_HAND; break;
|
||||
case ImGuiMouseCursor_NotAllowed: win32_cursor = IDC_NO; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
if (win32_cursor) {
|
||||
SetCursor(::LoadCursor(nullptr, win32_cursor));
|
||||
} else {
|
||||
SetCursor(nullptr);
|
||||
}
|
||||
SetCursor(win32_cursor ? ::LoadCursor(nullptr, win32_cursor) : nullptr);
|
||||
return TRUE;
|
||||
} else {
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
@@ -1165,8 +1105,8 @@ namespace MainWindow
|
||||
// Hack: Take the opportunity to show the cursor.
|
||||
mouseButtonDown = true;
|
||||
|
||||
float x = GET_X_LPARAM(lParam) * g_display.dpi_scale_x;
|
||||
float y = GET_Y_LPARAM(lParam) * g_display.dpi_scale_y;
|
||||
const float x = GET_X_LPARAM(lParam) * g_display.dpi_scale_x;
|
||||
const float y = GET_Y_LPARAM(lParam) * g_display.dpi_scale_y;
|
||||
WindowsRawInput::SetMousePos(x, y);
|
||||
|
||||
TouchInput touch{};
|
||||
@@ -1187,7 +1127,7 @@ namespace MainWindow
|
||||
const float dy = lastMouseDownY - y;
|
||||
const float distSq = dx * dx + dy * dy;
|
||||
if (distSq < 3.0f*3.0f && !g_Config.bShowTouchControls && !g_Config.bShowImDebugger && !g_Config.bMouseControl && GetUIState() == UISTATE_INGAME && g_Config.bFullscreenOnDoubleclick) {
|
||||
SendToggleFullscreen(!g_Config.UseFullScreen());
|
||||
SendToggleFullscreen(!g_Config.bFullScreen);
|
||||
}
|
||||
lastMouseDownTime = 0.0;
|
||||
} else {
|
||||
@@ -1206,6 +1146,7 @@ namespace MainWindow
|
||||
mouseButtonDown = (wParam & MK_LBUTTON) != 0;
|
||||
int cursorX = GET_X_LPARAM(lParam);
|
||||
int cursorY = GET_Y_LPARAM(lParam);
|
||||
// Require at least 2 pixels of movement to reset the hide timer.
|
||||
if (abs(cursorX - prevCursorX) > 1 || abs(cursorY - prevCursorY) > 1) {
|
||||
hideCursor = false;
|
||||
SetTimer(hwndMain, TIMER_CURSORMOVEUPDATE, CURSORUPDATE_MOVE_TIMESPAN_MS, 0);
|
||||
@@ -1213,8 +1154,8 @@ namespace MainWindow
|
||||
prevCursorX = cursorX;
|
||||
prevCursorY = cursorY;
|
||||
|
||||
float x = (float)cursorX * g_display.dpi_scale_x;
|
||||
float y = (float)cursorY * g_display.dpi_scale_y;
|
||||
const float x = (float)cursorX * g_display.dpi_scale_x;
|
||||
const float y = (float)cursorY * g_display.dpi_scale_y;
|
||||
WindowsRawInput::SetMousePos(x, y);
|
||||
|
||||
// Mouse moves now happen also when no button is pressed.
|
||||
@@ -1239,8 +1180,8 @@ namespace MainWindow
|
||||
// Hack: Take the opportunity to hide the cursor.
|
||||
mouseButtonDown = false;
|
||||
|
||||
float x = (float)GET_X_LPARAM(lParam) * g_display.dpi_scale_x;
|
||||
float y = (float)GET_Y_LPARAM(lParam) * g_display.dpi_scale_y;
|
||||
const float x = (float)GET_X_LPARAM(lParam) * g_display.dpi_scale_x;
|
||||
const float y = (float)GET_Y_LPARAM(lParam) * g_display.dpi_scale_y;
|
||||
WindowsRawInput::SetMousePos(x, y);
|
||||
|
||||
TouchInput touch{};
|
||||
@@ -1259,28 +1200,22 @@ namespace MainWindow
|
||||
|
||||
case WM_RBUTTONDOWN:
|
||||
{
|
||||
float x = GET_X_LPARAM(lParam) * g_display.dpi_scale_x;
|
||||
float y = GET_Y_LPARAM(lParam) * g_display.dpi_scale_y;
|
||||
|
||||
TouchInput touch{};
|
||||
touch.buttons = 2;
|
||||
touch.flags = TouchInputFlags::DOWN | TouchInputFlags::MOUSE;
|
||||
touch.x = x;
|
||||
touch.y = y;
|
||||
touch.x = GET_X_LPARAM(lParam) * g_display.dpi_scale_x;
|
||||
touch.y = GET_Y_LPARAM(lParam) * g_display.dpi_scale_y;
|
||||
NativeTouch(touch);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_RBUTTONUP:
|
||||
{
|
||||
float x = GET_X_LPARAM(lParam) * g_display.dpi_scale_x;
|
||||
float y = GET_Y_LPARAM(lParam) * g_display.dpi_scale_y;
|
||||
|
||||
TouchInput touch{};
|
||||
touch.buttons = 2;
|
||||
touch.flags = TouchInputFlags::UP | TouchInputFlags::MOUSE;
|
||||
touch.x = x;
|
||||
touch.y = y;
|
||||
touch.x = GET_X_LPARAM(lParam) * g_display.dpi_scale_x;
|
||||
touch.y = GET_Y_LPARAM(lParam) * g_display.dpi_scale_y;
|
||||
NativeTouch(touch);
|
||||
break;
|
||||
}
|
||||
@@ -1291,10 +1226,6 @@ namespace MainWindow
|
||||
return 0;
|
||||
}
|
||||
|
||||
HINSTANCE GetHInstance() {
|
||||
return hInst;
|
||||
}
|
||||
|
||||
void ToggleDebugConsoleVisibility() {
|
||||
if (!g_Config.bEnableLogging) {
|
||||
g_logManager.GetConsoleListener()->Show(false);
|
||||
@@ -1310,10 +1241,6 @@ namespace MainWindow
|
||||
PostMessage(hwndMain, WM_USER_TOGGLE_FULLSCREEN, fullscreen, 0);
|
||||
}
|
||||
|
||||
bool IsFullscreen() {
|
||||
return g_isFullscreen;
|
||||
}
|
||||
|
||||
void RunCallbackInWndProc(void (*callback)(void *, void *), void *userdata) {
|
||||
PostMessage(hwndMain, WM_USER_RUN_CALLBACK, reinterpret_cast<WPARAM>(callback), reinterpret_cast<LPARAM>(userdata));
|
||||
}
|
||||
|
||||
@@ -75,7 +75,6 @@ namespace MainWindow
|
||||
void ToggleFullscreen(HWND hWnd, bool goingFullscreen);
|
||||
void Minimize();
|
||||
void SendToggleFullscreen(bool fullscreen); // To be used off-thread
|
||||
bool IsFullscreen();
|
||||
void ToggleDebugConsoleVisibility();
|
||||
void SetInternalResolution(int res = -1);
|
||||
void SetWindowSize(int zoom);
|
||||
|
||||
+15
-26
@@ -4,9 +4,6 @@
|
||||
#include <sstream>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "CommonWindows.h"
|
||||
#include <shellapi.h>
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#include "Common/GPU/OpenGL/GLFeatures.h"
|
||||
@@ -15,31 +12,24 @@
|
||||
#include "Common/Data/Encoding/Utf8.h"
|
||||
#include "Common/System/System.h"
|
||||
#include "Common/System/OSD.h"
|
||||
#include "Common/System/NativeApp.h"
|
||||
#include "Common/System/Request.h"
|
||||
#include "Common/System/Display.h"
|
||||
#include "Common/File/FileUtil.h"
|
||||
#include "Common/Log.h"
|
||||
#include "Common/Log/LogManager.h"
|
||||
#include "Common/Log/ConsoleListener.h"
|
||||
#include "Common/OSVersion.h"
|
||||
#include "Common/GPU/Vulkan/VulkanLoader.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#if PPSSPP_API(ANY_GL)
|
||||
#include "GPU/GLES/TextureCacheGLES.h"
|
||||
#include "GPU/GLES/FramebufferManagerGLES.h"
|
||||
#endif
|
||||
#include "UI/OnScreenDisplay.h"
|
||||
#include "GPU/Common/PostShader.h"
|
||||
#include "GPU/Common/FramebufferManagerCommon.h"
|
||||
#include "GPU/Common/TextureDecoder.h"
|
||||
#include "GPU/Common/TextureScalerCommon.h"
|
||||
|
||||
#include "Core/Config.h"
|
||||
#include "Core/ConfigValues.h"
|
||||
#include "Core/FileSystems/MetaFileSystem.h"
|
||||
#include "Core/KeyMap.h"
|
||||
#include "UI/OnScreenDisplay.h"
|
||||
#include "Windows/MainWindowMenu.h"
|
||||
#include "Windows/MainWindow.h"
|
||||
#include "Windows/W32Util/DialogManager.h"
|
||||
@@ -62,7 +52,6 @@
|
||||
extern bool g_TakeScreenshot;
|
||||
|
||||
namespace MainWindow {
|
||||
extern HINSTANCE hInst;
|
||||
extern bool noFocusPause;
|
||||
std::vector<HMENU> g_topLevelMenus;
|
||||
HMENU g_hMenuBackend;
|
||||
@@ -470,7 +459,7 @@ namespace MainWindow {
|
||||
|
||||
auto gr = GetI18NCategory(I18NCat::GRAPHICS);
|
||||
|
||||
int wmId = LOWORD(wParam);
|
||||
const int wmId = LOWORD(wParam);
|
||||
// Parse the menu selections:
|
||||
switch (wmId) {
|
||||
case ID_FILE_LOAD:
|
||||
@@ -490,7 +479,7 @@ namespace MainWindow {
|
||||
break;
|
||||
|
||||
case ID_FILE_MEMSTICK:
|
||||
ShellExecute(NULL, L"open", g_Config.memStickDirectory.ToWString().c_str(), 0, 0, SW_SHOWNORMAL);
|
||||
System_LaunchUrl(LaunchUrlType::LOCAL_FILE, g_Config.memStickDirectory.ToString());
|
||||
break;
|
||||
|
||||
case ID_TOGGLE_BREAK:
|
||||
@@ -842,7 +831,7 @@ namespace MainWindow {
|
||||
case ID_DEBUG_EXTRACTFILE:
|
||||
{
|
||||
std::string filename;
|
||||
if (!InputBox_GetString(hInst, hWnd, L"Disc filename", filename, filename)) {
|
||||
if (!InputBox_GetString(MainWindow::GetHInstance(), hWnd, L"Disc filename", filename, filename)) {
|
||||
break;
|
||||
}
|
||||
const char *lastSlash = strrchr(filename.c_str(), '/');
|
||||
@@ -858,10 +847,10 @@ namespace MainWindow {
|
||||
} else if (info.type == FILETYPE_DIRECTORY) {
|
||||
MessageBox(hWnd, L"Cannot extract directories.", L"Sorry", 0);
|
||||
} else if (W32Util::BrowseForFileName(false, hWnd, L"Save file as...", 0, L"All files\0*.*\0\0", L"", fn)) {
|
||||
u32 handle = pspFileSystem.OpenFile(filename, FILEACCESS_READ, "");
|
||||
const u32 handle = pspFileSystem.OpenFile(filename, FILEACCESS_READ, "");
|
||||
// Note: len may be in blocks.
|
||||
size_t len = pspFileSystem.SeekFile(handle, 0, FILEMOVE_END);
|
||||
bool isBlockMode = pspFileSystem.DevType(handle) & PSPDevType::BLOCK;
|
||||
const bool isBlockMode = pspFileSystem.DevType(handle) & PSPDevType::BLOCK;
|
||||
|
||||
FILE *fp = File::OpenCFile(Path(fn), "wb");
|
||||
pspFileSystem.SeekFile(handle, 0, FILEMOVE_BEGIN);
|
||||
@@ -869,11 +858,11 @@ namespace MainWindow {
|
||||
size_t bufferSize = isBlockMode ? sizeof(buffer) / 2048 : sizeof(buffer);
|
||||
while (len > 0) {
|
||||
// This is all in blocks, not bytes, if isBlockMode.
|
||||
size_t remain = std::min(len, bufferSize);
|
||||
size_t readSize = pspFileSystem.ReadFile(handle, buffer, remain);
|
||||
const size_t remain = std::min(len, bufferSize);
|
||||
const size_t readSize = pspFileSystem.ReadFile(handle, buffer, remain);
|
||||
if (readSize == 0)
|
||||
break;
|
||||
size_t bytes = isBlockMode ? readSize * 2048 : readSize;
|
||||
const size_t bytes = isBlockMode ? readSize * 2048 : readSize;
|
||||
fwrite(buffer, 1, bytes, fp);
|
||||
len -= readSize;
|
||||
}
|
||||
@@ -893,7 +882,7 @@ namespace MainWindow {
|
||||
|
||||
case ID_OPTIONS_FULLSCREEN:
|
||||
if (!g_Config.bShowImDebugger) {
|
||||
SendToggleFullscreen(!g_Config.UseFullScreen());
|
||||
SendToggleFullscreen(!g_Config.bFullScreen);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -939,28 +928,28 @@ namespace MainWindow {
|
||||
break;
|
||||
|
||||
case ID_HELP_OPENWEBSITE:
|
||||
ShellExecute(NULL, L"open", L"https://www.ppsspp.org/", NULL, NULL, SW_SHOWNORMAL);
|
||||
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/");
|
||||
break;
|
||||
|
||||
case ID_HELP_BUYGOLD:
|
||||
ShellExecute(NULL, L"open", L"https://www.ppsspp.org/buygold", NULL, NULL, SW_SHOWNORMAL);
|
||||
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/buygold");
|
||||
break;
|
||||
|
||||
case ID_HELP_OPENFORUM:
|
||||
ShellExecute(NULL, L"open", L"https://forums.ppsspp.org/", NULL, NULL, SW_SHOWNORMAL);
|
||||
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://forums.ppsspp.org/");
|
||||
break;
|
||||
|
||||
case ID_HELP_GITHUB:
|
||||
ShellExecute(NULL, L"open", L"https://github.com/hrydgard/ppsspp/", NULL, NULL, SW_SHOWNORMAL);
|
||||
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://github.com/hrydgard/ppsspp/");
|
||||
break;
|
||||
|
||||
case ID_HELP_DISCORD:
|
||||
ShellExecute(NULL, L"open", L"https://discord.gg/5NJB6dD", NULL, NULL, SW_SHOWNORMAL);
|
||||
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://discord.gg/5NJB6dD");
|
||||
break;
|
||||
|
||||
case ID_HELP_ABOUT:
|
||||
DialogManager::EnableAll(FALSE);
|
||||
DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)AboutDlgProc);
|
||||
DialogBox(MainWindow::GetHInstance(), (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)AboutDlgProc);
|
||||
DialogManager::EnableAll(TRUE);
|
||||
break;
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ void TouchInputHandler::handleTouchEvent(HWND hWnd, UINT message, WPARAM wParam,
|
||||
// disable the press and hold gesture for the given window
|
||||
void TouchInputHandler::disablePressAndHold(HWND hWnd) {
|
||||
// The atom identifier and Tablet PC atom
|
||||
LPCTSTR tabletAtom = _T("MicrosoftTabletPenServiceProperty");
|
||||
wchar_t *tabletAtom = L"MicrosoftTabletPenServiceProperty";
|
||||
ATOM atomID = GlobalAddAtom(tabletAtom);
|
||||
|
||||
// If getting the ID failed, return false
|
||||
|
||||
+44
-32
@@ -22,8 +22,31 @@ bool KeyDownAsync(int vkey) {
|
||||
|
||||
namespace W32Util
|
||||
{
|
||||
void CenterWindow(HWND hwnd)
|
||||
{
|
||||
static RECT MapRectFromClientToWndCoords(HWND hwnd, const RECT &r) {
|
||||
RECT wnd_coords = r;
|
||||
// map to screen
|
||||
MapWindowPoints(hwnd, NULL, reinterpret_cast<POINT *>(&wnd_coords), 2);
|
||||
RECT scr_coords;
|
||||
GetWindowRect(hwnd, &scr_coords);
|
||||
// map to window coords by substracting the window coord origin in screen coords.
|
||||
OffsetRect(&wnd_coords, -scr_coords.left, -scr_coords.top);
|
||||
return wnd_coords;
|
||||
}
|
||||
|
||||
RECT GetNonclientMenuBorderRect(HWND hwnd) {
|
||||
RECT r;
|
||||
GetClientRect(hwnd, &r);
|
||||
r = MapRectFromClientToWndCoords(hwnd, r);
|
||||
const int y = r.top - 1;
|
||||
return {
|
||||
r.left,
|
||||
y,
|
||||
r.right,
|
||||
y + 1
|
||||
};
|
||||
}
|
||||
|
||||
void CenterWindow(HWND hwnd) {
|
||||
HWND hwndParent;
|
||||
RECT rect, rectP;
|
||||
int width, height;
|
||||
@@ -57,19 +80,17 @@ namespace W32Util
|
||||
MoveWindow(hwnd, x, y, width, height, FALSE);
|
||||
}
|
||||
|
||||
BOOL CopyTextToClipboard(HWND hwnd, const char *text) {
|
||||
bool CopyTextToClipboard(HWND hWnd, std::string_view text) {
|
||||
std::wstring wtext = ConvertUTF8ToWString(text);
|
||||
return CopyTextToClipboard(hwnd, wtext);
|
||||
}
|
||||
if (!OpenClipboard(hWnd)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL CopyTextToClipboard(HWND hwnd, const std::wstring &wtext) {
|
||||
if (!OpenClipboard(hwnd))
|
||||
return FALSE;
|
||||
EmptyClipboard();
|
||||
HANDLE hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (wtext.size() + 1) * sizeof(wchar_t));
|
||||
if (hglbCopy == NULL) {
|
||||
if (!hglbCopy) {
|
||||
CloseClipboard();
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Lock the handle and copy the text to the buffer.
|
||||
@@ -82,13 +103,11 @@ namespace W32Util
|
||||
SetClipboardData(CF_UNICODETEXT, hglbCopy);
|
||||
}
|
||||
CloseClipboard();
|
||||
return lptstrCopy ? TRUE : FALSE;
|
||||
return lptstrCopy != nullptr;
|
||||
}
|
||||
|
||||
void MakeTopMost(HWND hwnd, bool topMost) {
|
||||
HWND style = HWND_NOTOPMOST;
|
||||
if (topMost) style = HWND_TOPMOST;
|
||||
SetWindowPos(hwnd, style, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
SetWindowPos(hwnd, topMost ? HWND_TOPMOST : HWND_NOTOPMOST, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
}
|
||||
|
||||
void GetWindowRes(HWND hWnd, int *xres, int *yres) {
|
||||
@@ -98,7 +117,7 @@ namespace W32Util
|
||||
*yres = rc.bottom - rc.top;
|
||||
}
|
||||
|
||||
void ShowFileInFolder(const std::string &path) {
|
||||
void ShowFileInFolder(std::string_view path) {
|
||||
// SHParseDisplayName can't handle relative paths, so normalize first.
|
||||
std::string resolved = ReplaceAll(File::ResolvePath(path), "/", "\\");
|
||||
|
||||
@@ -557,8 +576,7 @@ LRESULT CALLBACK GenericListControl::wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
return (LRESULT)CallWindowProc((WNDPROC)list->oldProc,hwnd,msg,wParam,lParam);
|
||||
}
|
||||
|
||||
void GenericListControl::ProcessCopy()
|
||||
{
|
||||
void GenericListControl::ProcessCopy() {
|
||||
int start = GetSelectedIndex();
|
||||
int size;
|
||||
if (start == -1)
|
||||
@@ -569,15 +587,12 @@ void GenericListControl::ProcessCopy()
|
||||
CopyRows(start, size);
|
||||
}
|
||||
|
||||
void GenericListControl::CopyRows(int start, int size)
|
||||
{
|
||||
void GenericListControl::CopyRows(int start, int size) {
|
||||
std::wstring data;
|
||||
|
||||
if (start == 0 && size == GetRowCount())
|
||||
{
|
||||
if (start == 0 && size == GetRowCount()) {
|
||||
// Let's also copy the header if everything is selected.
|
||||
for (int c = 0; c < columnCount; ++c)
|
||||
{
|
||||
for (int c = 0; c < columnCount; ++c) {
|
||||
data.append(columns[c].name);
|
||||
if (c < columnCount - 1)
|
||||
data.append(L"\t");
|
||||
@@ -586,10 +601,8 @@ void GenericListControl::CopyRows(int start, int size)
|
||||
}
|
||||
}
|
||||
|
||||
for (int r = start; r < start + size; ++r)
|
||||
{
|
||||
for (int c = 0; c < columnCount; ++c)
|
||||
{
|
||||
for (int r = start; r < start + size; ++r) {
|
||||
for (int c = 0; c < columnCount; ++c) {
|
||||
stringBuffer[0] = 0;
|
||||
GetColumnText(stringBuffer, ARRAY_SIZE(stringBuffer), r, c);
|
||||
data.append(stringBuffer);
|
||||
@@ -599,15 +612,14 @@ void GenericListControl::CopyRows(int start, int size)
|
||||
data.append(L"\r\n");
|
||||
}
|
||||
}
|
||||
W32Util::CopyTextToClipboard(handle, data);
|
||||
|
||||
W32Util::CopyTextToClipboard(handle, ConvertWStringToUTF8(data));
|
||||
}
|
||||
|
||||
void GenericListControl::SelectAll()
|
||||
{
|
||||
void GenericListControl::SelectAll() {
|
||||
ListView_SetItemState(handle, -1, LVIS_SELECTED, LVIS_SELECTED);
|
||||
}
|
||||
|
||||
int GenericListControl::GetSelectedIndex()
|
||||
{
|
||||
int GenericListControl::GetSelectedIndex() {
|
||||
return ListView_GetNextItem(handle, -1, LVNI_SELECTED);
|
||||
}
|
||||
@@ -6,11 +6,9 @@
|
||||
|
||||
#include "Common/CommonWindows.h"
|
||||
|
||||
namespace W32Util
|
||||
{
|
||||
namespace W32Util {
|
||||
void CenterWindow(HWND hwnd);
|
||||
BOOL CopyTextToClipboard(HWND hwnd, const char *text);
|
||||
BOOL CopyTextToClipboard(HWND hwnd, const std::wstring &wtext);
|
||||
bool CopyTextToClipboard(HWND hwnd, std::string_view text);
|
||||
void MakeTopMost(HWND hwnd, bool topMost);
|
||||
void ExitAndRestart(bool overrideArgs = false, const std::string &args = "");
|
||||
void SpawnNewInstance(bool overrideArgs = false, const std::string &args = "");
|
||||
@@ -18,7 +16,8 @@ namespace W32Util
|
||||
void GetSelfExecuteParams(std::wstring &workingDirectory, std::wstring &moduleFilename);
|
||||
|
||||
void GetWindowRes(HWND hWnd, int *xres, int *yres);
|
||||
void ShowFileInFolder(const std::string &path);
|
||||
void ShowFileInFolder(std::string_view path);
|
||||
RECT GetNonclientMenuBorderRect(HWND hwnd);
|
||||
|
||||
struct ClipboardData {
|
||||
ClipboardData(const char *format, size_t sz);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
#include <thread>
|
||||
|
||||
class Path;
|
||||
|
||||
|
||||
+7
-5
@@ -132,6 +132,7 @@ static double g_lastKeepAwake = 0.0;
|
||||
static constexpr double ACTIVITY_IDLE_TIMEOUT = 2.0 * 3600.0;
|
||||
|
||||
void System_LaunchUrl(LaunchUrlType urlType, std::string_view url) {
|
||||
// We don't even check urlType.
|
||||
std::string u(url);
|
||||
std::thread t = std::thread([u]() {
|
||||
ShellExecute(NULL, L"open", ConvertUTF8ToWString(u).c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
@@ -141,7 +142,8 @@ void System_LaunchUrl(LaunchUrlType urlType, std::string_view url) {
|
||||
}
|
||||
|
||||
void System_Vibrate(int length_ms) {
|
||||
// Ignore on PC
|
||||
// Ignore on PC. TODO: Actually, we could vibrate a controller if we wanted to, but we should only do that
|
||||
// if it was used within the last few seconds.
|
||||
}
|
||||
|
||||
static void AddDebugRestartArgs() {
|
||||
@@ -618,8 +620,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
|
||||
}
|
||||
case SystemRequestType::COPY_TO_CLIPBOARD:
|
||||
{
|
||||
std::wstring data = ConvertUTF8ToWString(param1);
|
||||
W32Util::CopyTextToClipboard(MainWindow::GetHWND(), data);
|
||||
W32Util::CopyTextToClipboard(MainWindow::GetHWND(), param1);
|
||||
return true;
|
||||
}
|
||||
case SystemRequestType::SET_WINDOW_TITLE:
|
||||
@@ -725,7 +726,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
|
||||
|
||||
case SystemRequestType::TOGGLE_FULLSCREEN_STATE:
|
||||
{
|
||||
bool flag = !MainWindow::IsFullscreen();
|
||||
bool flag = !g_Config.bFullScreen;
|
||||
if (param1 == "0") {
|
||||
flag = false;
|
||||
} else if (param1 == "1") {
|
||||
@@ -1121,7 +1122,8 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
|
||||
|
||||
if (iCmdShow == SW_MAXIMIZE) {
|
||||
// Consider this to mean --fullscreen.
|
||||
g_Config.iForceFullScreen = 1;
|
||||
g_Config.bFullScreen = true;
|
||||
g_Config.DoNotSaveSetting(&g_Config.bFullScreen);
|
||||
}
|
||||
|
||||
// Consider at least the following cases before changing this code:
|
||||
|
||||
+3
-4
@@ -41,12 +41,11 @@
|
||||
|
||||
#include <windowsx.h>
|
||||
#include <process.h>
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
#include <cstdio>
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include <cmath>
|
||||
#include <ctime>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
Reference in new issue
Block a user