Simple IPC for external control (#3345)

* add simple IPC protocol

to allow communication via stdin/stdout

* ipc: add PATCH_MEMORY command

enables patches & cheates
This commit is contained in:
Vinicius Rangel
2025-08-04 20:32:50 -03:00
committed by GitHub
parent 77410fd228
commit 0044a27c1f
7 changed files with 179 additions and 11 deletions

39
src/core/ipc/ipc.h Normal file
View File

@@ -0,0 +1,39 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/singleton.h"
#include <semaphore>
#include <thread>
class IPC {
bool enabled{false};
std::jthread input_thread{};
std::binary_semaphore run_semaphore{0};
std::binary_semaphore start_semaphore{0};
public:
static IPC& Instance() {
return *Common::Singleton<IPC>::Instance();
}
void Init();
operator bool() const {
return enabled;
}
[[nodiscard]] bool IsEnabled() const {
return enabled;
}
void WaitForStart() {
start_semaphore.acquire();
}
private:
[[noreturn]] void InputLoop();
};