mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-04 11:45:18 +02:00
GL UI in Win32: Some basics work.
This commit is contained in:
+21
-54
@@ -1,6 +1,9 @@
|
||||
// NOTE: Apologies for the quality of this code, this is really from pre-opensource Dolphin - that is, 2003.
|
||||
|
||||
#include "base/display.h"
|
||||
#include "base/timeutil.h"
|
||||
#include "base/threadutil.h"
|
||||
#include "base/NativeApp.h"
|
||||
#include "Log.h"
|
||||
#include "StringUtil.h"
|
||||
#include "../Globals.h"
|
||||
@@ -15,25 +18,17 @@
|
||||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
|
||||
char fileToStart[MAX_PATH];
|
||||
|
||||
static HANDLE emuThread;
|
||||
|
||||
|
||||
HANDLE EmuThread_GetThreadHandle()
|
||||
{
|
||||
return emuThread;
|
||||
}
|
||||
|
||||
|
||||
DWORD TheThread(LPVOID x);
|
||||
|
||||
void EmuThread_Start(const char *filename)
|
||||
void EmuThread_Start()
|
||||
{
|
||||
// _dbg_clear_();
|
||||
_tcsncpy(fileToStart, filename, sizeof(fileToStart) - 1);
|
||||
fileToStart[sizeof(fileToStart) - 1] = 0;
|
||||
|
||||
unsigned int i;
|
||||
emuThread = (HANDLE)_beginthreadex(0,0,(unsigned int (__stdcall *)(void *))TheThread,(LPVOID)0,0,&i);
|
||||
}
|
||||
@@ -49,16 +44,20 @@ void EmuThread_Stop()
|
||||
host->UpdateUI();
|
||||
}
|
||||
|
||||
|
||||
char *GetCurrentFilename()
|
||||
{
|
||||
return fileToStart;
|
||||
}
|
||||
|
||||
DWORD TheThread(LPVOID x) {
|
||||
setCurrentThreadName("EmuThread");
|
||||
|
||||
g_State.bEmuThreadStarted = true;
|
||||
std::string memstick, flash0;
|
||||
GetSysDirectories(memstick, flash0);
|
||||
|
||||
// Native overwrites host. Can't allow that.
|
||||
|
||||
Host *oldHost = host;
|
||||
UpdateScreenScale();
|
||||
|
||||
NativeInit(0, 0, memstick.c_str(), "C:\\", "1234");
|
||||
Host *nativeHost = host;
|
||||
host = oldHost;
|
||||
|
||||
CoreParameter coreParameter;
|
||||
|
||||
@@ -73,57 +72,25 @@ DWORD TheThread(LPVOID x) {
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
INFO_LOG(BOOT, "Starting up hardware.");
|
||||
|
||||
coreParameter.fileToStart = fileToStart;
|
||||
coreParameter.enableSound = true;
|
||||
coreParameter.gpuCore = GPU_GLES;
|
||||
coreParameter.cpuCore = g_Config.bJit ? CPU_JIT : CPU_INTERPRETER;
|
||||
coreParameter.enableDebugging = true;
|
||||
coreParameter.printfEmuLog = false;
|
||||
coreParameter.headLess = false;
|
||||
coreParameter.renderWidth = (480 * g_Config.iWindowZoom) * (g_Config.SSAntiAliasing + 1);
|
||||
coreParameter.renderHeight = (272 * g_Config.iWindowZoom) * (g_Config.SSAntiAliasing + 1);
|
||||
coreParameter.outputWidth = 480 * g_Config.iWindowZoom;
|
||||
coreParameter.outputHeight = 272 * g_Config.iWindowZoom;
|
||||
coreParameter.pixelWidth = 480 * g_Config.iWindowZoom;
|
||||
coreParameter.pixelHeight = 272 * g_Config.iWindowZoom;
|
||||
coreParameter.startPaused = !g_Config.bAutoRun;
|
||||
coreParameter.useMediaEngine = false;
|
||||
|
||||
error_string = "";
|
||||
if (!PSP_Init(coreParameter, &error_string))
|
||||
{
|
||||
ERROR_LOG(BOOT, "Error loading: %s", error_string.c_str());
|
||||
goto shutdown;
|
||||
}
|
||||
NativeInitGraphics();
|
||||
|
||||
INFO_LOG(BOOT, "Done.");
|
||||
_dbg_update_();
|
||||
|
||||
host->UpdateDisassembly();
|
||||
Core_EnableStepping(coreParameter.startPaused ? TRUE : FALSE);
|
||||
Core_EnableStepping(FALSE);
|
||||
|
||||
g_State.bBooted = true;
|
||||
#ifdef _DEBUG
|
||||
host->UpdateMemView();
|
||||
#endif
|
||||
|
||||
host->BootDone();
|
||||
Core_Run();
|
||||
|
||||
host->PrepareShutdown();
|
||||
|
||||
|
||||
PSP_Shutdown();
|
||||
|
||||
shutdown:
|
||||
host = nativeHost;
|
||||
NativeShutdownGraphics();
|
||||
NativeShutdown();
|
||||
host = oldHost;
|
||||
|
||||
host->ShutdownGL();
|
||||
|
||||
//The CPU should return when a game is stopped and cleanup should be done here,
|
||||
//so we can restart the plugins (or load new ones) for the next game
|
||||
g_State.bEmuThreadStarted = false;
|
||||
_endthreadex(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user