mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-15 18:49:51 +01:00
Merge pull request #1144 from unknownbrackets/ui-tweaks
Minor tweaks for the new UI on Windows
This commit is contained in:
commit
67c7a47c25
9 files changed
+62
-53
No files matched your search
@@ -89,6 +89,13 @@ void Core_WaitInactive(int milliseconds)
|
||||
void UpdateScreenScale() {
|
||||
dp_xres = PSP_CoreParameter().pixelWidth;
|
||||
dp_yres = PSP_CoreParameter().pixelHeight;
|
||||
#ifdef _WIN32
|
||||
if (g_Config.iWindowZoom == 1)
|
||||
{
|
||||
dp_xres *= 2;
|
||||
dp_yres *= 2;
|
||||
}
|
||||
#endif
|
||||
pixel_xres = PSP_CoreParameter().pixelWidth;
|
||||
pixel_yres = PSP_CoreParameter().pixelHeight;
|
||||
g_dpi = 72;
|
||||
|
||||
+2
-1
@@ -78,7 +78,8 @@ EmuScreen::EmuScreen(const std::string &filename) : invalid_(true) {
|
||||
ERROR_LOG(BOOT, "%s", errorMessage_.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
globalUIState = UISTATE_INGAME;
|
||||
host->BootDone();
|
||||
host->UpdateDisassembly();
|
||||
|
||||
|
||||
@@ -112,6 +112,9 @@ again:
|
||||
// A game can be either an UMD or a directory under ms0:/PSP/GAME .
|
||||
if (startsWith(gamePath, "ms0:/PSP/GAME")) {
|
||||
return 0;
|
||||
// TODO: The case of these extensions is not perfect.
|
||||
} else if (endsWith(gamePath, ".PBP") || endsWith(gamePath, ".elf")) {
|
||||
return 0;
|
||||
} else {
|
||||
SequentialHandleAllocator handles;
|
||||
// Let's assume it's an ISO.
|
||||
|
||||
@@ -134,6 +134,12 @@ void LogoScreen::update(InputState &input_state) {
|
||||
}
|
||||
}
|
||||
|
||||
void LogoScreen::sendMessage(const char *message, const char *value) {
|
||||
if (!strcmp(message, "boot")) {
|
||||
screenManager()->switchScreen(new EmuScreen(value));
|
||||
}
|
||||
}
|
||||
|
||||
void LogoScreen::render() {
|
||||
float t = (float)frames_ / 60.0f;
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ public:
|
||||
: bootFilename_(bootFilename), frames_(0) {}
|
||||
void update(InputState &input);
|
||||
void render();
|
||||
void sendMessage(const char *message, const char *value);
|
||||
|
||||
private:
|
||||
std::string bootFilename_;
|
||||
|
||||
+9
-3
@@ -45,6 +45,7 @@
|
||||
#include "../../Core/Config.h"
|
||||
#include "../../Core/HLE/sceCtrl.h"
|
||||
#include "../../Core/Host.h"
|
||||
#include "../../Core/SaveState.h"
|
||||
#include "../../Common/MemArena.h"
|
||||
|
||||
#include "ui_atlas.h"
|
||||
@@ -200,9 +201,10 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co
|
||||
|
||||
config_filename = user_data_path + "/ppsspp.ini";
|
||||
g_Config.Load(config_filename.c_str());
|
||||
|
||||
#endif
|
||||
|
||||
const char *fileToLog = 0;
|
||||
const char *stateToLoad = 0;
|
||||
|
||||
bool gfxLog = false;
|
||||
// Parse command line
|
||||
@@ -229,6 +231,8 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co
|
||||
case '-':
|
||||
if (!strncmp(argv[i], "--log=", strlen("--log=")) && strlen(argv[i]) > strlen("--log="))
|
||||
fileToLog = argv[i] + strlen("--log=");
|
||||
if (!strncmp(__argv[i], "--state=", strlen("--state=")) && strlen(__argv[i]) > strlen("--state="))
|
||||
stateToLoad = __argv[i] + strlen("--state=");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -249,6 +253,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co
|
||||
if (fileToLog != NULL)
|
||||
LogManager::GetInstance()->ChangeFileLog(fileToLog);
|
||||
|
||||
#ifndef _WIN32
|
||||
if (g_Config.currentDirectory == "") {
|
||||
#if defined(ANDROID)
|
||||
g_Config.currentDirectory = external_directory;
|
||||
@@ -258,7 +263,6 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co
|
||||
g_Config.currentDirectory = getenv("HOME");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(ANDROID)
|
||||
// Maybe there should be an option to use internal memory instead, but I think
|
||||
@@ -280,7 +284,6 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co
|
||||
g_Config.flashDirectory = g_Config.memCardDirectory+"/flash/";
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
|
||||
{
|
||||
LogTypes::LOG_TYPE type = (LogTypes::LOG_TYPE)i;
|
||||
@@ -299,6 +302,9 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co
|
||||
logman->SetLogLevel(LogTypes::G3D, LogTypes::LERROR);
|
||||
INFO_LOG(BOOT, "Logger inited.");
|
||||
#endif
|
||||
|
||||
if (!boot_filename.empty() && stateToLoad != NULL)
|
||||
SaveState::Load(stateToLoad);
|
||||
}
|
||||
|
||||
void NativeInitGraphics()
|
||||
|
||||
@@ -55,7 +55,7 @@ DWORD TheThread(LPVOID x) {
|
||||
Host *oldHost = host;
|
||||
UpdateScreenScale();
|
||||
|
||||
NativeInit(0, 0, memstick.c_str(), memstick.c_str(), "1234");
|
||||
NativeInit(__argc, (const char **)__argv, memstick.c_str(), memstick.c_str(), "1234");
|
||||
Host *nativeHost = host;
|
||||
host = oldHost;
|
||||
|
||||
|
||||
@@ -267,6 +267,12 @@ namespace MainWindow
|
||||
input_state.pointer_down[0] = true;
|
||||
input_state.pointer_x[0] = GET_X_LPARAM(lParam);
|
||||
input_state.pointer_y[0] = GET_Y_LPARAM(lParam);
|
||||
|
||||
if (g_Config.iWindowZoom == 1)
|
||||
{
|
||||
input_state.pointer_x[0] *= 2;
|
||||
input_state.pointer_y[0] *= 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -275,6 +281,12 @@ namespace MainWindow
|
||||
lock_guard guard(input_state.lock);
|
||||
input_state.pointer_x[0] = GET_X_LPARAM(lParam);
|
||||
input_state.pointer_y[0] = GET_Y_LPARAM(lParam);
|
||||
|
||||
if (g_Config.iWindowZoom == 1)
|
||||
{
|
||||
input_state.pointer_x[0] *= 2;
|
||||
input_state.pointer_y[0] *= 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -284,6 +296,12 @@ namespace MainWindow
|
||||
input_state.pointer_down[0] = false;
|
||||
input_state.pointer_x[0] = GET_X_LPARAM(lParam);
|
||||
input_state.pointer_y[0] = GET_Y_LPARAM(lParam);
|
||||
|
||||
if (g_Config.iWindowZoom == 1)
|
||||
{
|
||||
input_state.pointer_x[0] *= 2;
|
||||
input_state.pointer_y[0] *= 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -623,6 +641,11 @@ namespace MainWindow
|
||||
break;
|
||||
|
||||
case WM_USER+1:
|
||||
if (disasmWindow[0])
|
||||
SendMessage(disasmWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0);
|
||||
if (memoryWindow[0])
|
||||
SendMessage(memoryWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0);
|
||||
|
||||
disasmWindow[0] = new CDisasm(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS);
|
||||
DialogManager::AddDlg(disasmWindow[0]);
|
||||
disasmWindow[0]->Show(g_Config.bShowDebuggerOnLoad);
|
||||
@@ -636,6 +659,13 @@ namespace MainWindow
|
||||
|
||||
if (nextState == CORE_RUNNING)
|
||||
PostMessage(hwndMain, WM_COMMAND, ID_EMULATION_RUN, 0);
|
||||
else if (globalUIState == UISTATE_INGAME)
|
||||
{
|
||||
if (disasmWindow[0])
|
||||
SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_GO, 0);
|
||||
}
|
||||
|
||||
SetForegroundWindow(hwndMain);
|
||||
break;
|
||||
|
||||
|
||||
|
||||
+3
-48
@@ -51,16 +51,13 @@ void LaunchBrowser(const char *url)
|
||||
#include "Windows/WindowsHost.h"
|
||||
#include "Windows/main.h"
|
||||
|
||||
CDisasm *disasmWindow[MAX_CPUCOUNT];
|
||||
CMemoryDlg *memoryWindow[MAX_CPUCOUNT];
|
||||
CDisasm *disasmWindow[MAX_CPUCOUNT] = {0};
|
||||
CMemoryDlg *memoryWindow[MAX_CPUCOUNT] = {0};
|
||||
|
||||
int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int iCmdShow)
|
||||
{
|
||||
Common::EnableCrashingOnCrashes();
|
||||
|
||||
const char *fileToStart = NULL;
|
||||
const char *fileToLog = NULL;
|
||||
const char *stateToLoad = NULL;
|
||||
bool hideLog = true;
|
||||
|
||||
#ifdef _DEBUG
|
||||
@@ -71,6 +68,7 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
|
||||
VFSRegister("", new DirectoryAssetReader("assets/"));
|
||||
VFSRegister("", new DirectoryAssetReader(""));
|
||||
|
||||
// The rest is handled in NativeInit().
|
||||
for (int i = 1; i < __argc; ++i)
|
||||
{
|
||||
if (__argv[i][0] == '\0')
|
||||
@@ -80,14 +78,6 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
|
||||
{
|
||||
switch (__argv[i][1])
|
||||
{
|
||||
case 'j':
|
||||
g_Config.bJit = true;
|
||||
g_Config.bSaveSettings = false;
|
||||
break;
|
||||
case 'i':
|
||||
g_Config.bJit = false;
|
||||
g_Config.bSaveSettings = false;
|
||||
break;
|
||||
case 'l':
|
||||
hideLog = false;
|
||||
break;
|
||||
@@ -95,32 +85,8 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
|
||||
g_Config.bAutoRun = false;
|
||||
g_Config.bSaveSettings = false;
|
||||
break;
|
||||
case '-':
|
||||
if (!strcmp(__argv[i], "--log") && i < __argc - 1)
|
||||
fileToLog = __argv[++i];
|
||||
if (!strncmp(__argv[i], "--log=", strlen("--log=")) && strlen(__argv[i]) > strlen("--log="))
|
||||
fileToLog = __argv[i] + strlen("--log=");
|
||||
if (!strcmp(__argv[i], "--state") && i < __argc - 1)
|
||||
stateToLoad = __argv[++i];
|
||||
if (!strncmp(__argv[i], "--state=", strlen("--state=")) && strlen(__argv[i]) > strlen("--state="))
|
||||
stateToLoad = __argv[i] + strlen("--state=");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (fileToStart == NULL)
|
||||
{
|
||||
fileToStart = __argv[i];
|
||||
if (!File::Exists(fileToStart))
|
||||
{
|
||||
fprintf(stderr, "File not found: %s\n", fileToStart);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Can only boot one file");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
//Windows, API init stuff
|
||||
@@ -152,16 +118,8 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
|
||||
MainWindow::UpdateMenus();
|
||||
|
||||
LogManager::Init();
|
||||
if (fileToLog != NULL)
|
||||
LogManager::GetInstance()->ChangeFileLog(fileToLog);
|
||||
LogManager::GetInstance()->GetConsoleListener()->Open(hideLog, 150, 120, "PPSSPP Debug Console");
|
||||
LogManager::GetInstance()->SetLogLevel(LogTypes::G3D, LogTypes::LERROR);
|
||||
if (fileToStart != NULL)
|
||||
{
|
||||
MainWindow::SetPlaying(fileToStart);
|
||||
MainWindow::Update();
|
||||
MainWindow::UpdateMenus();
|
||||
}
|
||||
|
||||
// Emu thread is always running!
|
||||
EmuThread_Start();
|
||||
@@ -172,9 +130,6 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
|
||||
if (!hideLog)
|
||||
SetForegroundWindow(hwndMain);
|
||||
|
||||
if (fileToStart != NULL && stateToLoad != NULL)
|
||||
SaveState::Load(stateToLoad);
|
||||
|
||||
//so.. we're at the message pump of the GUI thread
|
||||
MSG msg;
|
||||
while (GetMessage(&msg, NULL, 0, 0)) //while no quit
|
||||
|
||||
Reference in new issue
Block a user