mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-30 17:02:19 +00:00
Merge pull request #5149 from unknownbrackets/ui-tweaks
Load games asynchronously (instead of stalling), fix keyboard
This commit is contained in:
commit
6c90f4bcf7
@ -143,7 +143,7 @@ static inline void UpdateRunLoop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Core_RunLoop() {
|
void Core_RunLoop() {
|
||||||
while (globalUIState != UISTATE_INGAME && globalUIState != UISTATE_EXIT) {
|
while ((globalUIState != UISTATE_INGAME || !PSP_IsInited()) && globalUIState != UISTATE_EXIT) {
|
||||||
time_update();
|
time_update();
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(USING_QT_UI)
|
#if defined(_WIN32) && !defined(USING_QT_UI)
|
||||||
|
@ -301,8 +301,13 @@ void System_Wake() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool pspIsInited = false;
|
static bool pspIsInited = false;
|
||||||
|
static bool pspIsIniting = false;
|
||||||
|
|
||||||
|
bool PSP_InitStart(const CoreParameter &coreParam, std::string *error_string) {
|
||||||
|
if (pspIsIniting) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool PSP_Init(const CoreParameter &coreParam, std::string *error_string) {
|
|
||||||
#if defined(_WIN32) && defined(_M_X64)
|
#if defined(_WIN32) && defined(_M_X64)
|
||||||
INFO_LOG(BOOT, "PPSSPP %s Windows 64 bit", PPSSPP_GIT_VERSION);
|
INFO_LOG(BOOT, "PPSSPP %s Windows 64 bit", PPSSPP_GIT_VERSION);
|
||||||
#elif defined(_WIN32) && !defined(_M_X64)
|
#elif defined(_WIN32) && !defined(_M_X64)
|
||||||
@ -312,17 +317,30 @@ bool PSP_Init(const CoreParameter &coreParam, std::string *error_string) {
|
|||||||
#endif
|
#endif
|
||||||
coreParameter = coreParam;
|
coreParameter = coreParam;
|
||||||
coreParameter.errorString = "";
|
coreParameter.errorString = "";
|
||||||
|
pspIsIniting = true;
|
||||||
|
|
||||||
if (g_Config.bSeparateCPUThread) {
|
if (g_Config.bSeparateCPUThread) {
|
||||||
Core_ListenShutdown(System_Wake);
|
Core_ListenShutdown(System_Wake);
|
||||||
CPU_SetState(CPU_THREAD_PENDING);
|
CPU_SetState(CPU_THREAD_PENDING);
|
||||||
cpuThread = new std::thread(&CPU_RunLoop);
|
cpuThread = new std::thread(&CPU_RunLoop);
|
||||||
cpuThread->detach();
|
cpuThread->detach();
|
||||||
CPU_WaitStatus(cpuThreadReplyCond, &CPU_IsReady);
|
|
||||||
} else {
|
} else {
|
||||||
CPU_Init();
|
CPU_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*error_string = coreParameter.errorString;
|
||||||
|
return coreParameter.fileToStart != "";
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PSP_InitUpdate(std::string *error_string) {
|
||||||
|
if (pspIsInited || !pspIsIniting) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_Config.bSeparateCPUThread && !CPU_IsReady()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool success = coreParameter.fileToStart != "";
|
bool success = coreParameter.fileToStart != "";
|
||||||
*error_string = coreParameter.errorString;
|
*error_string = coreParameter.errorString;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -333,7 +351,22 @@ bool PSP_Init(const CoreParameter &coreParam, std::string *error_string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
pspIsInited = success;
|
pspIsInited = success;
|
||||||
return success;
|
pspIsIniting = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PSP_Init(const CoreParameter &coreParam, std::string *error_string) {
|
||||||
|
PSP_InitStart(coreParam, error_string);
|
||||||
|
|
||||||
|
if (g_Config.bSeparateCPUThread) {
|
||||||
|
CPU_WaitStatus(cpuThreadReplyCond, &CPU_IsReady);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PSP_InitUpdate(error_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PSP_IsIniting() {
|
||||||
|
return pspIsIniting;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PSP_IsInited() {
|
bool PSP_IsInited() {
|
||||||
@ -362,6 +395,7 @@ void PSP_Shutdown() {
|
|||||||
host->SetWindowTitle(0);
|
host->SetWindowTitle(0);
|
||||||
currentMIPS = 0;
|
currentMIPS = 0;
|
||||||
pspIsInited = false;
|
pspIsInited = false;
|
||||||
|
pspIsIniting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PSP_RunLoopUntil(u64 globalticks) {
|
void PSP_RunLoopUntil(u64 globalticks) {
|
||||||
|
@ -49,6 +49,9 @@ extern GlobalUIState globalUIState;
|
|||||||
void UpdateUIState(GlobalUIState newState);
|
void UpdateUIState(GlobalUIState newState);
|
||||||
|
|
||||||
bool PSP_Init(const CoreParameter &coreParam, std::string *error_string);
|
bool PSP_Init(const CoreParameter &coreParam, std::string *error_string);
|
||||||
|
bool PSP_InitStart(const CoreParameter &coreParam, std::string *error_string);
|
||||||
|
bool PSP_InitUpdate(std::string *error_string);
|
||||||
|
bool PSP_IsIniting();
|
||||||
bool PSP_IsInited();
|
bool PSP_IsInited();
|
||||||
void PSP_Shutdown();
|
void PSP_Shutdown();
|
||||||
void PSP_RunLoopUntil(u64 globalticks);
|
void PSP_RunLoopUntil(u64 globalticks);
|
||||||
|
@ -63,14 +63,29 @@ EmuScreen::EmuScreen(const std::string &filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EmuScreen::bootGame(const std::string &filename) {
|
void EmuScreen::bootGame(const std::string &filename) {
|
||||||
booted_ = true;
|
if (PSP_IsIniting()) {
|
||||||
std::string fileToStart = filename;
|
std::string error_string;
|
||||||
|
booted_ = PSP_InitUpdate(&error_string);
|
||||||
|
if (booted_) {
|
||||||
|
invalid_ = !PSP_IsInited();
|
||||||
|
if (invalid_) {
|
||||||
|
errorMessage_ = error_string;
|
||||||
|
ERROR_LOG(BOOT, "%s", errorMessage_.c_str());
|
||||||
|
System_SendMessage("event", "failstartgame");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bootComplete();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
invalid_ = true;
|
||||||
|
|
||||||
CoreParameter coreParam;
|
CoreParameter coreParam;
|
||||||
coreParam.cpuCore = g_Config.bJit ? CPU_JIT : CPU_INTERPRETER;
|
coreParam.cpuCore = g_Config.bJit ? CPU_JIT : CPU_INTERPRETER;
|
||||||
coreParam.gpuCore = g_Config.bSoftwareRendering ? GPU_SOFTWARE : GPU_GLES;
|
coreParam.gpuCore = g_Config.bSoftwareRendering ? GPU_SOFTWARE : GPU_GLES;
|
||||||
coreParam.enableSound = g_Config.bEnableSound;
|
coreParam.enableSound = g_Config.bEnableSound;
|
||||||
coreParam.fileToStart = fileToStart;
|
coreParam.fileToStart = filename;
|
||||||
coreParam.mountIso = "";
|
coreParam.mountIso = "";
|
||||||
coreParam.startPaused = false;
|
coreParam.startPaused = false;
|
||||||
coreParam.printfEmuLog = false;
|
coreParam.printfEmuLog = false;
|
||||||
@ -92,23 +107,24 @@ void EmuScreen::bootGame(const std::string &filename) {
|
|||||||
coreParam.pixelHeight = pixel_yres;
|
coreParam.pixelHeight = pixel_yres;
|
||||||
|
|
||||||
std::string error_string;
|
std::string error_string;
|
||||||
if (PSP_Init(coreParam, &error_string)) {
|
if (!PSP_InitStart(coreParam, &error_string)) {
|
||||||
invalid_ = false;
|
booted_ = true;
|
||||||
} else {
|
|
||||||
invalid_ = true;
|
invalid_ = true;
|
||||||
errorMessage_ = error_string;
|
errorMessage_ = error_string;
|
||||||
ERROR_LOG(BOOT, "%s", errorMessage_.c_str());
|
ERROR_LOG(BOOT, "%s", errorMessage_.c_str());
|
||||||
System_SendMessage("event", "failstartgame");
|
System_SendMessage("event", "failstartgame");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EmuScreen::bootComplete() {
|
||||||
globalUIState = UISTATE_INGAME;
|
globalUIState = UISTATE_INGAME;
|
||||||
host->BootDone();
|
host->BootDone();
|
||||||
host->UpdateDisassembly();
|
host->UpdateDisassembly();
|
||||||
|
|
||||||
g_gameInfoCache.FlushBGs();
|
g_gameInfoCache.FlushBGs();
|
||||||
|
|
||||||
NOTICE_LOG(BOOT, "Loading %s...", fileToStart.c_str());
|
NOTICE_LOG(BOOT, "Loading %s...", PSP_CoreParameter().fileToStart.c_str());
|
||||||
autoLoad();
|
autoLoad();
|
||||||
|
|
||||||
I18NCategory *s = GetI18NCategory("Screen");
|
I18NCategory *s = GetI18NCategory("Screen");
|
||||||
|
@ -48,6 +48,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void bootGame(const std::string &filename);
|
void bootGame(const std::string &filename);
|
||||||
|
void bootComplete();
|
||||||
void processAxis(const AxisInput &axis, int direction);
|
void processAxis(const AxisInput &axis, int direction);
|
||||||
|
|
||||||
void pspKey(int pspKeyCode, int flags);
|
void pspKey(int pspKeyCode, int flags);
|
||||||
|
@ -98,7 +98,7 @@ LRESULT CALLBACK FuncListProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
CDisasm::CDisasm(HINSTANCE _hInstance, HWND _hParent, DebugInterface *_cpu) : Dialog((LPCSTR)IDD_DISASM, _hInstance, _hParent)
|
CDisasm::CDisasm(HINSTANCE _hInstance, HWND _hParent, DebugInterface *_cpu) : Dialog((LPCSTR)IDD_DISASM, _hInstance, _hParent)
|
||||||
{
|
{
|
||||||
cpu = _cpu;
|
cpu = _cpu;
|
||||||
lastTicks = CoreTiming::GetTicks();
|
lastTicks = PSP_IsInited() ? CoreTiming::GetTicks() : 0;
|
||||||
keepStatusBarText = false;
|
keepStatusBarText = false;
|
||||||
hideBottomTabs = false;
|
hideBottomTabs = false;
|
||||||
|
|
||||||
@ -187,7 +187,9 @@ CDisasm::~CDisasm()
|
|||||||
|
|
||||||
void CDisasm::stepInto()
|
void CDisasm::stepInto()
|
||||||
{
|
{
|
||||||
if (!Core_IsStepping()) return;
|
if (!PSP_IsInited() || !Core_IsStepping()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
|
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
|
||||||
lastTicks = CoreTiming::GetTicks();
|
lastTicks = CoreTiming::GetTicks();
|
||||||
@ -235,7 +237,9 @@ void CDisasm::stepInto()
|
|||||||
|
|
||||||
void CDisasm::stepOver()
|
void CDisasm::stepOver()
|
||||||
{
|
{
|
||||||
if (Core_IsActive()) return;
|
if (!PSP_IsInited() || Core_IsActive()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
|
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
|
||||||
lastTicks = CoreTiming::GetTicks();
|
lastTicks = CoreTiming::GetTicks();
|
||||||
@ -283,6 +287,10 @@ void CDisasm::stepOver()
|
|||||||
|
|
||||||
void CDisasm::stepOut()
|
void CDisasm::stepOut()
|
||||||
{
|
{
|
||||||
|
if (!PSP_IsInited()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto threads = GetThreadsInfo();
|
auto threads = GetThreadsInfo();
|
||||||
|
|
||||||
u32 entry, stackTop;
|
u32 entry, stackTop;
|
||||||
@ -318,6 +326,10 @@ void CDisasm::stepOut()
|
|||||||
|
|
||||||
void CDisasm::runToLine()
|
void CDisasm::runToLine()
|
||||||
{
|
{
|
||||||
|
if (!PSP_IsInited()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
|
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
|
||||||
u32 pos = ptr->getSelection();
|
u32 pos = ptr->getSelection();
|
||||||
|
|
||||||
@ -488,6 +500,9 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
case IDC_STOPGO:
|
case IDC_STOPGO:
|
||||||
{
|
{
|
||||||
|
if (!PSP_IsInited()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (!Core_IsStepping()) // stop
|
if (!Core_IsStepping()) // stop
|
||||||
{
|
{
|
||||||
ptr->setDontRedraw(false);
|
ptr->setDontRedraw(false);
|
||||||
@ -753,7 +768,7 @@ void CDisasm::SetDebugMode(bool _bDebug, bool switchPC)
|
|||||||
HWND hDlg = m_hDlg;
|
HWND hDlg = m_hDlg;
|
||||||
|
|
||||||
// Update Dialog Windows
|
// Update Dialog Windows
|
||||||
if (_bDebug && globalUIState == UISTATE_INGAME)
|
if (_bDebug && globalUIState == UISTATE_INGAME && PSP_IsInited())
|
||||||
{
|
{
|
||||||
Core_WaitInactive(TEMP_BREAKPOINT_WAIT_MS);
|
Core_WaitInactive(TEMP_BREAKPOINT_WAIT_MS);
|
||||||
CBreakPoints::ClearTemporaryBreakPoints();
|
CBreakPoints::ClearTemporaryBreakPoints();
|
||||||
@ -785,7 +800,7 @@ void CDisasm::SetDebugMode(bool _bDebug, bool switchPC)
|
|||||||
{
|
{
|
||||||
updateThreadLabel(true);
|
updateThreadLabel(true);
|
||||||
|
|
||||||
if (globalUIState == UISTATE_INGAME)
|
if (globalUIState == UISTATE_INGAME && PSP_IsInited())
|
||||||
{
|
{
|
||||||
SetDlgItemText(m_hDlg, IDC_STOPGO, L"Stop");
|
SetDlgItemText(m_hDlg, IDC_STOPGO, L"Stop");
|
||||||
EnableWindow( GetDlgItem(hDlg, IDC_STOPGO), TRUE);
|
EnableWindow( GetDlgItem(hDlg, IDC_STOPGO), TRUE);
|
||||||
|
Loading…
Reference in New Issue
Block a user