mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-29 11:06:07 +00:00
initial sceKernelWaitEqueue implementation (WIP)
This commit is contained in:
parent
5b6bbfc327
commit
98090ae42f
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
constexpr int SCE_OK = 0;
|
constexpr int SCE_OK = 0;
|
||||||
|
|
||||||
|
constexpr int SCE_KERNEL_ERROR_EBADF = 0x80020009;
|
||||||
constexpr int SCE_KERNEL_ERROR_ENOMEM = 0x8002000c; // Insufficient memory
|
constexpr int SCE_KERNEL_ERROR_ENOMEM = 0x8002000c; // Insufficient memory
|
||||||
constexpr int SCE_KERNEL_ERROR_EFAULT = 0x8002000e; // Invalid address pointer
|
constexpr int SCE_KERNEL_ERROR_EFAULT = 0x8002000e; // Invalid address pointer
|
||||||
constexpr int SCE_KERNEL_ERROR_EINVAL = 0x80020016; // null or invalid states
|
constexpr int SCE_KERNEL_ERROR_EINVAL = 0x80020016; // null or invalid states
|
||||||
|
|
|
@ -38,7 +38,7 @@ using TriggerFunc = void (*)(EqueueEvent* event, void* trigger_data);
|
||||||
using ResetFunc = void (*)(EqueueEvent* event);
|
using ResetFunc = void (*)(EqueueEvent* event);
|
||||||
using DeleteFunc = void (*)(SceKernelEqueue eq, EqueueEvent* event);
|
using DeleteFunc = void (*)(SceKernelEqueue eq, EqueueEvent* event);
|
||||||
|
|
||||||
struct Event {
|
struct SceKernelEvent {
|
||||||
u64 ident = 0; /* identifier for this event */
|
u64 ident = 0; /* identifier for this event */
|
||||||
s16 filter = 0; /* filter for event */
|
s16 filter = 0; /* filter for event */
|
||||||
u16 flags = 0;
|
u16 flags = 0;
|
||||||
|
@ -56,7 +56,7 @@ struct Filter {
|
||||||
|
|
||||||
struct EqueueEvent {
|
struct EqueueEvent {
|
||||||
bool isTriggered = false;
|
bool isTriggered = false;
|
||||||
Event event;
|
SceKernelEvent event;
|
||||||
Filter filter;
|
Filter filter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <Core/PS4/HLE/ErrorCodes.h>
|
#include <Core/PS4/HLE/ErrorCodes.h>
|
||||||
#include <Core/PS4/HLE/Libs.h>
|
#include <Core/PS4/HLE/Libs.h>
|
||||||
#include <Util/log.h>
|
#include <Util/log.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
namespace HLE::Libs::LibKernel::EventQueues {
|
namespace HLE::Libs::LibKernel::EventQueues {
|
||||||
constexpr bool log_file_equeues = true; // disable it to disable logging
|
constexpr bool log_file_equeues = true; // disable it to disable logging
|
||||||
|
@ -34,4 +35,32 @@ int PS4_SYSV_ABI sceKernelCreateEqueue(SceKernelEqueue* eq, const char* name) {
|
||||||
LOG_INFO_IF(log_file_equeues, "sceKernelCreateEqueue created with name \"{}\"\n", name);
|
LOG_INFO_IF(log_file_equeues, "sceKernelCreateEqueue created with name \"{}\"\n", name);
|
||||||
return SCE_OK;
|
return SCE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceKernelWaitEqueue(SceKernelEqueue eq, HLE::Kernel::Objects::SceKernelEvent* ev, int num, int* out, SceKernelUseconds* timo) {
|
||||||
|
PRINT_FUNCTION_NAME();
|
||||||
|
|
||||||
|
if (eq == nullptr) {
|
||||||
|
return SCE_KERNEL_ERROR_EBADF;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ev == nullptr) {
|
||||||
|
return SCE_KERNEL_ERROR_EFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (num < 1) {
|
||||||
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
|
}
|
||||||
|
if (timo == nullptr) { // wait until an event arrives without timing out
|
||||||
|
// BREAKPOINT();//NOT supported yet TODO
|
||||||
|
}
|
||||||
|
if (timo != nullptr) {
|
||||||
|
if (*timo == 0) {//only events that have already arrived at the time of this function call can be received
|
||||||
|
BREAKPOINT();
|
||||||
|
} else { // wait until an event arrives with timing out
|
||||||
|
BREAKPOINT();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return SCE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
}; // namespace HLE::Libs::LibKernel::EventQueues
|
}; // namespace HLE::Libs::LibKernel::EventQueues
|
|
@ -1,10 +1,14 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
#include "Objects/event_queue.h"
|
#include "Objects/event_queue.h"
|
||||||
|
|
||||||
namespace HLE::Libs::LibKernel::EventQueues {
|
namespace HLE::Libs::LibKernel::EventQueues {
|
||||||
|
using SceKernelUseconds = u32;
|
||||||
using SceKernelEqueue = Kernel::Objects::EqueueInternal*;
|
using SceKernelEqueue = Kernel::Objects::EqueueInternal*;
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceKernelCreateEqueue(SceKernelEqueue* eq, const char* name);
|
int PS4_SYSV_ABI sceKernelCreateEqueue(SceKernelEqueue* eq, const char* name);
|
||||||
|
int PS4_SYSV_ABI sceKernelWaitEqueue(SceKernelEqueue eq, HLE::Kernel::Objects::SceKernelEvent* ev, int num, int* out, SceKernelUseconds *timo);
|
||||||
|
|
||||||
}; // namespace HLE::Libs::LibKernel::EventQueues
|
}; // namespace HLE::Libs::LibKernel::EventQueues
|
|
@ -18,11 +18,6 @@ namespace HLE::Libs::LibKernel {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceKernelWaitEqueue(/*SceKernelEqueue eq, SceKernelEvent* ev,*/ int num, int* out /*, SceKernelUseconds* timo*/)
|
|
||||||
{
|
|
||||||
PRINT_DUMMY_FUNCTION_NAME();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PS4_SYSV_ABI void stack_chk_fail() { BREAKPOINT();
|
static PS4_SYSV_ABI void stack_chk_fail() { BREAKPOINT();
|
||||||
}
|
}
|
||||||
|
@ -36,7 +31,7 @@ namespace HLE::Libs::LibKernel {
|
||||||
LIB_FUNCTION("MBuItvba6z8", "libkernel", 1, "libkernel", 1, 1, sceKernelReleaseDirectMemory);
|
LIB_FUNCTION("MBuItvba6z8", "libkernel", 1, "libkernel", 1, 1, sceKernelReleaseDirectMemory);
|
||||||
//equeue
|
//equeue
|
||||||
LIB_FUNCTION("D0OdFMjp46I", "libkernel", 1, "libkernel", 1, 1, EventQueues::sceKernelCreateEqueue);
|
LIB_FUNCTION("D0OdFMjp46I", "libkernel", 1, "libkernel", 1, 1, EventQueues::sceKernelCreateEqueue);
|
||||||
LIB_FUNCTION("fzyMKs9kim0", "libkernel", 1, "libkernel", 1, 1, sceKernelWaitEqueue);
|
LIB_FUNCTION("fzyMKs9kim0", "libkernel", 1, "libkernel", 1, 1, EventQueues::sceKernelWaitEqueue);
|
||||||
//misc
|
//misc
|
||||||
LIB_FUNCTION("WslcK1FQcGI", "libkernel", 1, "libkernel", 1, 1, CPUManagement::sceKernelIsNeoMode);
|
LIB_FUNCTION("WslcK1FQcGI", "libkernel", 1, "libkernel", 1, 1, CPUManagement::sceKernelIsNeoMode);
|
||||||
LIB_FUNCTION("Ou3iL1abvng", "libkernel", 1, "libkernel", 1, 1, stack_chk_fail);
|
LIB_FUNCTION("Ou3iL1abvng", "libkernel", 1, "libkernel", 1, 1, stack_chk_fail);
|
||||||
|
|
|
@ -8,6 +8,4 @@ void LibKernel_Register(SymbolsResolver* sym);
|
||||||
|
|
||||||
|
|
||||||
int32_t PS4_SYSV_ABI sceKernelReleaseDirectMemory(off_t start, size_t len);
|
int32_t PS4_SYSV_ABI sceKernelReleaseDirectMemory(off_t start, size_t len);
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceKernelWaitEqueue(/*SceKernelEqueue eq, SceKernelEvent* ev,*/ int num, int* out /*, SceKernelUseconds* timo*/);
|
|
||||||
}; // namespace HLE::Libs::LibKernel
|
}; // namespace HLE::Libs::LibKernel
|
Loading…
Reference in a new issue