mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-23 20:05:01 +00:00
commit
bf74888be4
14 changed files with 48 additions and 44 deletions
|
@ -840,6 +840,31 @@ int PS4_SYSV_ABI posix_pthread_mutexattr_setprotocol(ScePthreadMutexattr* attr,
|
|||
return result;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadMutexTimedlock(ScePthreadMutex* mutex, u64 usec) {
|
||||
mutex = createMutex(mutex);
|
||||
if (mutex == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
timespec time{};
|
||||
time.tv_sec = usec / 1000000;
|
||||
time.tv_nsec = ((usec % 1000000) * 1000);
|
||||
int result = pthread_mutex_timedlock(&(*mutex)->pth_mutex, &time);
|
||||
|
||||
switch (result) {
|
||||
case 0:
|
||||
return SCE_OK;
|
||||
case ETIMEDOUT:
|
||||
return SCE_KERNEL_ERROR_ETIMEDOUT;
|
||||
case EINTR:
|
||||
return SCE_KERNEL_ERROR_EINTR;
|
||||
case EAGAIN:
|
||||
return SCE_KERNEL_ERROR_EAGAIN;
|
||||
default:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
static int pthread_copy_attributes(ScePthreadAttr* dst, const ScePthreadAttr* src) {
|
||||
if (dst == nullptr || *dst == nullptr || src == nullptr || *src == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
|
@ -1362,6 +1387,8 @@ void pthreadSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
|
|||
LIB_FUNCTION("9UK1vLZQft4", "libkernel", 1, "libkernel", 1, 1, scePthreadMutexLock);
|
||||
LIB_FUNCTION("tn3VlD0hG60", "libkernel", 1, "libkernel", 1, 1, scePthreadMutexUnlock);
|
||||
LIB_FUNCTION("upoVrzMHFeE", "libkernel", 1, "libkernel", 1, 1, scePthreadMutexTrylock);
|
||||
LIB_FUNCTION("IafI2PxcPnQ", "libkernel", 1, "libkernel", 1, 1, scePthreadMutexTimedlock);
|
||||
|
||||
// cond calls
|
||||
LIB_FUNCTION("2Tb92quprl0", "libkernel", 1, "libkernel", 1, 1, scePthreadCondInit);
|
||||
LIB_FUNCTION("m5-2bsNfv7s", "libkernel", 1, "libkernel", 1, 1, scePthreadCondattrInit);
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "core/linker.h"
|
||||
#include "core/memory.h"
|
||||
#include "emulator.h"
|
||||
#include "hwinfo/hwinfo.h"
|
||||
|
||||
Frontend::WindowSDL* g_window = nullptr;
|
||||
|
||||
|
@ -43,7 +42,6 @@ Emulator::Emulator()
|
|||
Common::Log::Initialize();
|
||||
Common::Log::Start();
|
||||
LOG_INFO(Loader, "Starting shadps4 emulator v{} ", Common::VERSION);
|
||||
PrintSystemInfo();
|
||||
}
|
||||
|
||||
Emulator::~Emulator() {
|
||||
|
@ -181,17 +179,4 @@ void Emulator::LoadSystemModules(const std::filesystem::path& file) {
|
|||
}
|
||||
}
|
||||
|
||||
void Emulator::PrintSystemInfo() {
|
||||
auto cpus = hwinfo::getAllCPUs();
|
||||
for (const auto& cpu : cpus) {
|
||||
LOG_INFO(Loader, "CPU #{} {}", cpu.id(), cpu.modelName());
|
||||
}
|
||||
hwinfo::OS os;
|
||||
LOG_INFO(Loader, "{}", os.name());
|
||||
auto gpus = hwinfo::getAllGPUs();
|
||||
for (auto& gpu : gpus) {
|
||||
LOG_INFO(Loader, "GPU #{} {}", gpu.id(), gpu.name());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
|
|
|
@ -29,7 +29,6 @@ public:
|
|||
|
||||
private:
|
||||
void LoadSystemModules(const std::filesystem::path& file);
|
||||
void PrintSystemInfo();
|
||||
|
||||
Core::MemoryManager* memory;
|
||||
Input::GameController* controller = Common::Singleton<Input::GameController>::Instance();
|
||||
|
|
|
@ -130,7 +130,7 @@ void WindowSDL::onKeyPress(const SDL_Event* event) {
|
|||
case SDLK_RETURN:
|
||||
button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_OPTIONS;
|
||||
break;
|
||||
case SDLK_a:
|
||||
case SDLK_A:
|
||||
axis = Input::Axis::LeftX;
|
||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||
axisvalue += -127;
|
||||
|
@ -139,7 +139,7 @@ void WindowSDL::onKeyPress(const SDL_Event* event) {
|
|||
}
|
||||
ax = Input::GetAxis(-0x80, 0x80, axisvalue);
|
||||
break;
|
||||
case SDLK_d:
|
||||
case SDLK_D:
|
||||
axis = Input::Axis::LeftX;
|
||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||
axisvalue += 127;
|
||||
|
@ -148,7 +148,7 @@ void WindowSDL::onKeyPress(const SDL_Event* event) {
|
|||
}
|
||||
ax = Input::GetAxis(-0x80, 0x80, axisvalue);
|
||||
break;
|
||||
case SDLK_w:
|
||||
case SDLK_W:
|
||||
axis = Input::Axis::LeftY;
|
||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||
axisvalue += -127;
|
||||
|
@ -157,7 +157,7 @@ void WindowSDL::onKeyPress(const SDL_Event* event) {
|
|||
}
|
||||
ax = Input::GetAxis(-0x80, 0x80, axisvalue);
|
||||
break;
|
||||
case SDLK_s:
|
||||
case SDLK_S:
|
||||
axis = Input::Axis::LeftY;
|
||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||
axisvalue += 127;
|
||||
|
@ -166,7 +166,7 @@ void WindowSDL::onKeyPress(const SDL_Event* event) {
|
|||
}
|
||||
ax = Input::GetAxis(-0x80, 0x80, axisvalue);
|
||||
break;
|
||||
case SDLK_j:
|
||||
case SDLK_J:
|
||||
axis = Input::Axis::RightX;
|
||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||
axisvalue += -127;
|
||||
|
@ -175,7 +175,7 @@ void WindowSDL::onKeyPress(const SDL_Event* event) {
|
|||
}
|
||||
ax = Input::GetAxis(-0x80, 0x80, axisvalue);
|
||||
break;
|
||||
case SDLK_l:
|
||||
case SDLK_L:
|
||||
axis = Input::Axis::RightX;
|
||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||
axisvalue += 127;
|
||||
|
@ -184,7 +184,7 @@ void WindowSDL::onKeyPress(const SDL_Event* event) {
|
|||
}
|
||||
ax = Input::GetAxis(-0x80, 0x80, axisvalue);
|
||||
break;
|
||||
case SDLK_i:
|
||||
case SDLK_I:
|
||||
axis = Input::Axis::RightY;
|
||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||
axisvalue += -127;
|
||||
|
@ -193,7 +193,7 @@ void WindowSDL::onKeyPress(const SDL_Event* event) {
|
|||
}
|
||||
ax = Input::GetAxis(-0x80, 0x80, axisvalue);
|
||||
break;
|
||||
case SDLK_k:
|
||||
case SDLK_K:
|
||||
axis = Input::Axis::RightY;
|
||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||
axisvalue += 127;
|
||||
|
@ -202,19 +202,19 @@ void WindowSDL::onKeyPress(const SDL_Event* event) {
|
|||
}
|
||||
ax = Input::GetAxis(-0x80, 0x80, axisvalue);
|
||||
break;
|
||||
case SDLK_x:
|
||||
case SDLK_X:
|
||||
button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_L3;
|
||||
break;
|
||||
case SDLK_m:
|
||||
case SDLK_M:
|
||||
button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_R3;
|
||||
break;
|
||||
case SDLK_q:
|
||||
case SDLK_Q:
|
||||
button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_L1;
|
||||
break;
|
||||
case SDLK_u:
|
||||
case SDLK_U:
|
||||
button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_R1;
|
||||
break;
|
||||
case SDLK_e:
|
||||
case SDLK_E:
|
||||
button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_L2;
|
||||
axis = Input::Axis::TriggerLeft;
|
||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||
|
@ -224,7 +224,7 @@ void WindowSDL::onKeyPress(const SDL_Event* event) {
|
|||
}
|
||||
ax = Input::GetAxis(0, 0x80, axisvalue);
|
||||
break;
|
||||
case SDLK_o:
|
||||
case SDLK_O:
|
||||
button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_R2;
|
||||
axis = Input::Axis::TriggerRight;
|
||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue