extend IPC functionalities (#3545)

* extend IPC

* clang

* clang
This commit is contained in:
Fire Cube
2025-09-09 23:57:42 +02:00
committed by GitHub
parent e885d52ad0
commit c05695fde5
2 changed files with 27 additions and 9 deletions

View File

@@ -123,7 +123,6 @@ std::string convertValueToHex(const std::string type, const std::string valueStr
void ApplyPendingPatches();
void OnGameLoaded() {
if (!patchFile.empty()) {
std::filesystem::path patchDir = Common::FS::GetUserPath(Common::FS::PathType::PatchesDir);
@@ -201,16 +200,11 @@ void OnGameLoaded() {
}
}
}
ApplyPendingPatches();
return;
} else {
LOG_ERROR(Loader, "couldnt patch parse xml : {}", result.description());
}
ApplyPendingPatches();
return;
}
ApplyPendingPatches();
#ifdef ENABLE_QT_GUI
// We use the QT headers for the xml and json parsing, this define is only true on QT builds

View File

@@ -6,9 +6,14 @@
#include <iostream>
#include <string>
#include <SDL3/SDL.h>
#include "common/memory_patcher.h"
#include "common/thread.h"
#include "common/types.h"
#include "core/debug_state.h"
#include "input/input_handler.h"
#include "sdl_window.h"
/**
* Protocol summary:
@@ -28,7 +33,7 @@
* and ended by
* #IPC_END
* In between, it will send the current capabilities and commands before the emulator start
* - The IPC client(e.g., launcher) will send RUN then START to conintue the execution
* - The IPC client(e.g., launcher) will send RUN then START to continue the execution
**/
/**
@@ -43,6 +48,10 @@
* target: str, size: str, isOffset: number, littleEndian: number,
* patchMask: number, maskOffset: number
* ): add a memory patch, check @ref MemoryPatcher::PatchMemory for details
* - PAUSE: pause the game execution
* - RESUME: resume the game execution
* - STOP: stop and quit the emulator
* - TOGGLE_FULLSCREEN: enable / disable fullscreen
* - OUTPUT CMD:
* - N/A
**/
@@ -61,6 +70,7 @@ void IPC::Init() {
std::cerr << ";#IPC_ENABLED\n";
std::cerr << ";ENABLE_MEMORY_PATCH\n";
std::cerr << ";ENABLE_EMU_CONTROL\n";
std::cerr << ";#IPC_END\n";
std::cerr.flush();
@@ -106,8 +116,22 @@ void IPC::InputLoop() {
entry.patchMask = static_cast<MemoryPatcher::PatchMask>(next_u64());
entry.maskOffset = static_cast<int>(next_u64());
MemoryPatcher::AddPatchToQueue(entry);
} else if (cmd == "PAUSE") {
DebugState.PauseGuestThreads();
} else if (cmd == "RESUME") {
DebugState.ResumeGuestThreads();
} else if (cmd == "STOP") {
SDL_Event event;
SDL_memset(&event, 0, sizeof(event));
event.type = SDL_EVENT_QUIT;
SDL_PushEvent(&event);
} else if (cmd == "TOGGLE_FULLSCREEN") {
SDL_Event event;
SDL_memset(&event, 0, sizeof(event));
event.type = SDL_EVENT_TOGGLE_FULLSCREEN;
SDL_PushEvent(&event);
} else {
std::cerr << "UNKNOWN CMD: " << cmd << std::endl;
std::cerr << ";UNKNOWN CMD: " << cmd << std::endl;
}
}
}