Merge pull request #239 from shadps4-emu/miscFixes3

Misc fixes 3
This commit is contained in:
georgemoralis 2024-07-06 11:16:53 +03:00 committed by GitHub
commit bf74888be4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 48 additions and 44 deletions

3
.gitmodules vendored
View file

@ -58,6 +58,3 @@
[submodule "externals/tracy"]
path = externals/tracy
url = https://github.com/shadps4-emu/tracy.git
[submodule "externals/hwinfo"]
path = externals/hwinfo
url = https://github.com/lfreist/hwinfo.git

View file

@ -525,7 +525,7 @@ endif()
create_target_directory_groups(shadps4)
target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt toml11::toml11 tsl::robin_map xbyak::xbyak Tracy::TracyClient hwinfo::HWinfo)
target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt toml11::toml11 tsl::robin_map xbyak::xbyak Tracy::TracyClient)
target_link_libraries(shadps4 PRIVATE Boost::headers GPUOpen::VulkanMemoryAllocator sirit Vulkan::Headers xxHash::xxhash Zydis::Zydis glslang::SPIRV glslang::glslang SDL3::SDL3)
if (NOT ENABLE_QT_GUI)

View file

@ -140,6 +140,3 @@ option(TRACY_ON_DEMAND "" ON)
option(TRACY_NO_FRAME_IMAGE "" ON)
option(TRACY_FIBERS "" ON) # For AmdGpu frontend profiling
add_subdirectory(tracy)
# hwinfo
add_subdirectory(hwinfo)

2
externals/fmt vendored

@ -1 +1 @@
Subproject commit bbf44cc000531dc7737d5321ccfa9f2f11b20127
Subproject commit a96259701e1d16e2f8c8299c668e863ec0ac0119

2
externals/glslang vendored

@ -1 +1 @@
Subproject commit 33c7e30860928bab3819c3abae8297b109a02f73
Subproject commit 5939e32b87487fa9c72ab336ebfcc5ae26d9ab6d

1
externals/hwinfo vendored

@ -1 +0,0 @@
Subproject commit 81ea6332fd4839890b1904f9668865145450f8da

@ -1 +1 @@
Subproject commit dd6a39d0ba1852cf06907e0f0573a2a10d23c2ad
Subproject commit ec1adc5763f684e0f32888b157bfc0b86021b8e9

2
externals/sdl3 vendored

@ -1 +1 @@
Subproject commit b72c22340e9a3c680011e245c28492bf60f5be66
Subproject commit f9a06c20ed85fb1d6754fc2280d6183382217910

2
externals/vma vendored

@ -1 +1 @@
Subproject commit feb11e172715011ef2a7b3b6c7c8737337b34181
Subproject commit 257138b8f5686ae84491a3df9f90a77d5660c3bd

2
externals/zlib-ng vendored

@ -1 +1 @@
Subproject commit 80514c17b384df68fbe83cca69ece0521b85f708
Subproject commit d54e3769be0c522015b784eca2af258b1c026107

View file

@ -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);

View file

@ -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

View file

@ -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();

View file

@ -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) {