mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Add System_Notify
This commit is contained in:
parent
ac5855cdf8
commit
06fcc9ccd7
@ -134,12 +134,24 @@ enum SystemProperty {
|
||||
SYSPROP_KEYBOARD_LAYOUT,
|
||||
};
|
||||
|
||||
enum class SystemNotification {
|
||||
UI,
|
||||
MEM_VIEW,
|
||||
DISASSEMBLY,
|
||||
DEBUG_MODE,
|
||||
BOOT_DONE, // this is sent from EMU thread! Make sure that Host handles it properly!
|
||||
SYMBOL_MAP_UPDATED,
|
||||
SWITCH_UMD_UPDATED,
|
||||
};
|
||||
|
||||
std::string System_GetProperty(SystemProperty prop);
|
||||
std::vector<std::string> System_GetPropertyStringVec(SystemProperty prop);
|
||||
int System_GetPropertyInt(SystemProperty prop);
|
||||
float System_GetPropertyFloat(SystemProperty prop);
|
||||
bool System_GetPropertyBool(SystemProperty prop);
|
||||
|
||||
void System_Notify(SystemNotification notification);
|
||||
|
||||
std::vector<std::string> System_GetCameraDeviceList();
|
||||
bool System_AudioRecordingIsAvailable();
|
||||
bool System_AudioRecordingState();
|
||||
|
@ -15,6 +15,7 @@
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "Common/System/System.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Debugger/WebSocket/GameSubscriber.h"
|
||||
#include "Core/Debugger/WebSocket/WebSocketUtils.h"
|
||||
@ -54,7 +55,7 @@ void WebSocketGameReset(DebuggerRequest &req) {
|
||||
ERROR_LOG(BOOT, "Error resetting: %s", resetError.c_str());
|
||||
return req.Fail("Could not reset");
|
||||
}
|
||||
host->BootDone();
|
||||
System_Notify(SystemNotification::BOOT_DONE);
|
||||
host->UpdateDisassembly();
|
||||
|
||||
req.Respond();
|
||||
|
11
Core/Host.h
11
Core/Host.h
@ -26,12 +26,13 @@ class GraphicsContext;
|
||||
class Host {
|
||||
public:
|
||||
virtual ~Host() {}
|
||||
virtual void UpdateUI() {}
|
||||
|
||||
virtual void UpdateUI() {}
|
||||
virtual void UpdateMemView() {}
|
||||
virtual void UpdateDisassembly() {}
|
||||
|
||||
virtual void NotifySymbolMapUpdated() {}
|
||||
virtual void SetDebugMode(bool mode) { }
|
||||
virtual void NotifySwitchUMDUpdated() {}
|
||||
|
||||
virtual bool InitGraphics(std::string *error_string, GraphicsContext **ctx) = 0;
|
||||
virtual void ShutdownGraphics() = 0;
|
||||
@ -42,12 +43,8 @@ public:
|
||||
virtual void PollControllers() {}
|
||||
virtual void ToggleDebugConsoleVisibility() {}
|
||||
|
||||
//this is sent from EMU thread! Make sure that Host handles it properly!
|
||||
virtual void BootDone() {}
|
||||
|
||||
virtual bool AttemptLoadSymbolMap();
|
||||
virtual void SaveSymbolMap() {}
|
||||
virtual void NotifySymbolMapUpdated() {}
|
||||
virtual void SetWindowTitle(const char *message) {}
|
||||
|
||||
virtual bool CreateDesktopShortcut(std::string argumentPath, std::string title) {return false;}
|
||||
@ -55,8 +52,6 @@ public:
|
||||
virtual void NotifyUserMessage(const std::string &message, float duration = 1.0f, u32 color = 0x00FFFFFF, const char *id = nullptr) {}
|
||||
virtual void SendUIMessage(const std::string &message, const std::string &value) {}
|
||||
|
||||
virtual void NotifySwitchUMDUpdated() {}
|
||||
|
||||
// Used for headless.
|
||||
virtual bool ShouldSkipUI() { return false; }
|
||||
virtual void SendDebugOutput(const std::string &output) {}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "Common/Data/Text/I18n.h"
|
||||
#include "Common/Thread/ThreadUtil.h"
|
||||
#include "Common/Data/Text/Parsers.h"
|
||||
#include "Common/System/System.h"
|
||||
|
||||
#include "Common/File/FileUtil.h"
|
||||
#include "Common/Serialize/Serializer.h"
|
||||
@ -1078,7 +1079,7 @@ namespace SaveState
|
||||
Core_Stop();
|
||||
return;
|
||||
}
|
||||
host->BootDone();
|
||||
System_Notify(SystemNotification::BOOT_DONE);
|
||||
host->UpdateDisassembly();
|
||||
needsRestart = false;
|
||||
}
|
||||
|
@ -40,8 +40,7 @@ public:
|
||||
mainWindow->updateMenus();
|
||||
}
|
||||
|
||||
void SetDebugMode(bool mode) override {
|
||||
}
|
||||
void SetDebugMode(bool mode) override {}
|
||||
|
||||
bool InitGraphics(std::string *error_message, GraphicsContext **ctx) override { return true; }
|
||||
void ShutdownGraphics() override {}
|
||||
@ -50,12 +49,6 @@ public:
|
||||
void UpdateSound() override {}
|
||||
void ShutdownSound() override;
|
||||
|
||||
// this is sent from EMU thread! Make sure that Host handles it properly!
|
||||
void BootDone() override {
|
||||
g_symbolMap->SortSymbols();
|
||||
mainWindow->Notify(MainWindowMsg::BOOT_DONE);
|
||||
}
|
||||
|
||||
bool AttemptLoadSymbolMap() override {
|
||||
auto fn = SymbolMapFilename(PSP_CoreParameter().fileToStart);
|
||||
return g_symbolMap->LoadSymbolMap(fn);
|
||||
|
@ -254,6 +254,17 @@ bool System_GetPropertyBool(SystemProperty prop) {
|
||||
}
|
||||
}
|
||||
|
||||
void System_Notify(SystemNotification notification) {
|
||||
switch (notification) {
|
||||
case SystemNotification::BOOT_DONE:
|
||||
g_symbolMap->SortSymbols();
|
||||
mainWindow->Notify(MainWindowMsg::BOOT_DONE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void System_SendMessage(const char *command, const char *parameter) {
|
||||
if (!strcmp(command, "finish")) {
|
||||
qApp->exit(0);
|
||||
|
@ -436,6 +436,13 @@ bool System_GetPropertyBool(SystemProperty prop) {
|
||||
}
|
||||
}
|
||||
|
||||
void System_Notify(SystemNotification notification) {
|
||||
switch (notification) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// returns -1 on failure
|
||||
static int parseInt(const char *str) {
|
||||
int val;
|
||||
|
@ -354,7 +354,8 @@ void EmuScreen::bootGame(const Path &filename) {
|
||||
|
||||
void EmuScreen::bootComplete() {
|
||||
UpdateUIState(UISTATE_INGAME);
|
||||
host->BootDone();
|
||||
System_Notify(SystemNotification::BOOT_DONE);
|
||||
|
||||
host->UpdateDisassembly();
|
||||
|
||||
NOTICE_LOG(BOOT, "Loading %s...", PSP_CoreParameter().fileToStart.c_str());
|
||||
|
@ -38,9 +38,6 @@ public:
|
||||
void UpdateSound() override {}
|
||||
void ShutdownSound() override;
|
||||
|
||||
// this is sent from EMU thread! Make sure that Host handles it properly!
|
||||
void BootDone() override {}
|
||||
|
||||
bool AttemptLoadSymbolMap() override {return false;}
|
||||
void NotifySymbolMapUpdated() override {}
|
||||
void SetWindowTitle(const char *message) override {}
|
||||
|
@ -436,6 +436,20 @@ bool System_GetPropertyBool(SystemProperty prop) {
|
||||
}
|
||||
}
|
||||
|
||||
void System_Notify(SystemNotification notification) {
|
||||
switch (notification) {
|
||||
case SystemNotification::BOOT_DONE:
|
||||
g_symbolMap->SortSymbols();
|
||||
|
||||
SetDebugMode(false);
|
||||
Core_EnableStepping(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void System_SendMessage(const char *command, const char *parameter) {
|
||||
using namespace concurrency;
|
||||
|
||||
|
@ -85,8 +85,7 @@ void UWPHost::UpdateMemView() {
|
||||
void UWPHost::UpdateDisassembly() {
|
||||
}
|
||||
|
||||
void UWPHost::SetDebugMode(bool mode) {
|
||||
}
|
||||
void UWPHost::SetDebugMode(bool mode) {}
|
||||
|
||||
void UWPHost::PollControllers() {
|
||||
for (const auto& device : this->input)
|
||||
@ -114,13 +113,6 @@ void UWPHost::PollControllers() {
|
||||
*/
|
||||
}
|
||||
|
||||
void UWPHost::BootDone() {
|
||||
g_symbolMap->SortSymbols();
|
||||
|
||||
SetDebugMode(false);
|
||||
Core_EnableStepping(false);
|
||||
}
|
||||
|
||||
static Path SymbolMapFilename(const Path ¤tFilename, const char *ext) {
|
||||
File::FileInfo info;
|
||||
// can't fail, definitely exists if it gets this far
|
||||
|
@ -26,7 +26,6 @@ public:
|
||||
void UpdateSound() override;
|
||||
void ShutdownSound() override;
|
||||
|
||||
void BootDone() override;
|
||||
bool AttemptLoadSymbolMap() override;
|
||||
void SaveSymbolMap() override;
|
||||
void NotifySymbolMapUpdated() override;
|
||||
|
@ -264,14 +264,6 @@ void WindowsHost::PollControllers() {
|
||||
HLEPlugins::PluginDataAxis[JOYSTICK_AXIS_MOUSE_REL_Y] = g_mouseDeltaY;
|
||||
}
|
||||
|
||||
void WindowsHost::BootDone() {
|
||||
if (g_symbolMap)
|
||||
g_symbolMap->SortSymbols();
|
||||
PostMessage(mainWindow_, WM_USER + 1, 0, 0);
|
||||
|
||||
SetDebugMode(!g_Config.bAutoRun);
|
||||
}
|
||||
|
||||
static Path SymbolMapFilename(const Path ¤tFilename, const char *ext) {
|
||||
File::FileInfo info{};
|
||||
// can't fail, definitely exists if it gets this far
|
||||
|
@ -48,7 +48,6 @@ public:
|
||||
void UpdateSound() override;
|
||||
void ShutdownSound() override;
|
||||
|
||||
void BootDone() override;
|
||||
bool AttemptLoadSymbolMap() override;
|
||||
void SaveSymbolMap() override;
|
||||
void NotifySymbolMapUpdated() override;
|
||||
|
@ -74,6 +74,7 @@
|
||||
#include "Windows/Debugger/CtrlDisAsmView.h"
|
||||
#include "Windows/Debugger/CtrlMemView.h"
|
||||
#include "Windows/Debugger/CtrlRegisterList.h"
|
||||
#include "Windows/Debugger/DebuggerShared.h"
|
||||
#include "Windows/InputBox.h"
|
||||
|
||||
#include "Windows/WindowsHost.h"
|
||||
@ -369,6 +370,24 @@ bool System_GetPropertyBool(SystemProperty prop) {
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL PostDialogMessage(Dialog *dialog, UINT message, WPARAM wParam = 0, LPARAM lParam = 0) {
|
||||
return PostMessage(dialog->GetDlgHandle(), message, wParam, lParam);
|
||||
}
|
||||
|
||||
void System_Notify(SystemNotification notification) {
|
||||
switch (notification) {
|
||||
case SystemNotification::BOOT_DONE:
|
||||
if (g_symbolMap)
|
||||
g_symbolMap->SortSymbols();
|
||||
PostMessage(MainWindow::GetHWND(), WM_USER + 1, 0, 0);
|
||||
|
||||
bool mode = !g_Config.bAutoRun;
|
||||
if (disasmWindow)
|
||||
PostDialogMessage(disasmWindow, WM_DEB_SETDEBUGLPARAM, 0, (LPARAM)mode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void System_SendMessage(const char *command, const char *parameter) {
|
||||
if (!strcmp(command, "finish")) {
|
||||
if (!NativeIsRestarting()) {
|
||||
|
@ -540,6 +540,11 @@ bool System_GetPropertyBool(SystemProperty prop) {
|
||||
}
|
||||
}
|
||||
|
||||
void System_Notify(SystemNotification notification) {
|
||||
switch (notification) {
|
||||
}
|
||||
}
|
||||
|
||||
std::string Android_GetInputDeviceDebugString() {
|
||||
if (!nativeActivity) {
|
||||
return "(N/A)";
|
||||
|
@ -112,7 +112,7 @@ bool System_GetPropertyBool(SystemProperty prop) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void System_Notify(SystemNotification notification) {}
|
||||
void System_SendMessage(const char *command, const char *parameter) {}
|
||||
void System_InputBoxGetString(const std::string &title, const std::string &defaultValue, std::function<void(bool, const std::string &)> cb) { cb(false, ""); }
|
||||
void System_AskForPermission(SystemPermission permission) {}
|
||||
@ -201,7 +201,7 @@ bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, const
|
||||
return false;
|
||||
}
|
||||
|
||||
host->BootDone();
|
||||
System_Notify(SystemNotification::BOOT_DONE);
|
||||
|
||||
Core_UpdateDebugStats(g_Config.bShowDebugStats || g_Config.bLogFrameDrops);
|
||||
|
||||
|
@ -41,9 +41,6 @@ public:
|
||||
void UpdateSound() override {}
|
||||
void ShutdownSound() override {}
|
||||
|
||||
// this is sent from EMU thread! Make sure that Host handles it properly
|
||||
void BootDone() override {}
|
||||
|
||||
bool AttemptLoadSymbolMap() override { g_symbolMap->Clear(); return false; }
|
||||
void NotifySymbolMapUpdated() override {}
|
||||
|
||||
|
@ -170,6 +170,11 @@ bool System_GetPropertyBool(SystemProperty prop) {
|
||||
}
|
||||
}
|
||||
|
||||
void System_Notify(SystemNotification notification) {
|
||||
switch (notification) {
|
||||
}
|
||||
}
|
||||
|
||||
void System_SendMessage(const char *command, const char *parameter) {
|
||||
if (!strcmp(command, "finish")) {
|
||||
exit(0);
|
||||
|
@ -1872,6 +1872,13 @@ bool System_GetPropertyBool(SystemProperty prop)
|
||||
std::string System_GetProperty(SystemProperty prop) { return ""; }
|
||||
std::vector<std::string> System_GetPropertyStringVec(SystemProperty prop) { return std::vector<std::string>(); }
|
||||
|
||||
void System_Notify(SystemNotification notification) {
|
||||
switch (notification) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void System_SendMessage(const char *command, const char *parameter) {}
|
||||
void NativeUpdate() {}
|
||||
void NativeRender(GraphicsContext *graphicsContext) {}
|
||||
|
@ -87,6 +87,7 @@ bool System_GetPropertyBool(SystemProperty prop) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
void System_Notify(SystemNotification notification) {}
|
||||
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
JNIEnv *getEnv() {
|
||||
|
Loading…
Reference in New Issue
Block a user