mirror of
https://github.com/Vita3K/Vita3K.git
synced 2026-07-11 01:34:23 +02:00
stubs: return unique UIDs from stub allocators
ksceKernelAllocRemoteProcessHeap returned 0 (invalid UID on Vita) and ksceKernelRegisterProcEventHandler returned the same hardcoded 0x40001 on every call. Use atomic counters to return distinct UIDs so callers that pass them back to the corresponding Free/Unregister don't collide.
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <atomic>
|
||||
|
||||
static std::atomic<int> pls_key_counter{ 1 };
|
||||
static std::atomic<int> stub_uid_counter{ 0x40001 };
|
||||
|
||||
EXPORT(int, ksceKernelCreateProcessLocalStorage, const char *name, SceSize size) {
|
||||
// Return a unique key for this PLS entry.
|
||||
@@ -70,7 +71,7 @@ EXPORT(int, ksceKernelIsGameBudget) {
|
||||
// kubridge-required stubs
|
||||
EXPORT(SceUID, ksceKernelAllocRemoteProcessHeap, SceUID pid, uint32_t size, Ptr<void> opt) {
|
||||
STUBBED("ksceKernelAllocRemoteProcessHeap");
|
||||
return 0;
|
||||
return stub_uid_counter.fetch_add(1);
|
||||
}
|
||||
|
||||
EXPORT(int, ksceKernelFreeRemoteProcessHeap, SceUID pid, Ptr<void> ptr) {
|
||||
|
||||
@@ -17,14 +17,18 @@
|
||||
|
||||
#include <module/module.h>
|
||||
|
||||
#include <atomic>
|
||||
|
||||
static std::atomic<int> proc_event_uid_counter{ 0x40001 };
|
||||
|
||||
EXPORT(int, ksceKernelInvokeProcEventHandler) {
|
||||
return UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
EXPORT(SceUID, ksceKernelRegisterProcEventHandler, const char *name, Ptr<void> handler, int priority) {
|
||||
// Stub: return a fake UID. kubridge registers a process event handler
|
||||
// for cleanup on process exit, but in the emulator we don't need it.
|
||||
return 0x40001;
|
||||
// Stub: return a unique UID per registration. kubridge registers a process
|
||||
// event handler for cleanup on exit, but in the emulator we don't need it.
|
||||
return proc_event_uid_counter.fetch_add(1);
|
||||
}
|
||||
|
||||
EXPORT(int, ksceKernelUnregisterProcEventHandler) {
|
||||
|
||||
Reference in New Issue
Block a user