From ce2c7a7d018d4bcd8496a764d6d3df695fb484f5 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Sun, 29 Oct 2023 23:46:18 +0200 Subject: [PATCH 01/14] restored previous timer class --- CMakeLists.txt | 2 + .../PS4/HLE/Kernel/Objects/event_queue.cpp | 13 ++- src/Lib/Timer.cpp | 103 ++++++++++++++++++ src/Lib/Timer.h | 34 ++++++ 4 files changed, 146 insertions(+), 6 deletions(-) create mode 100644 src/Lib/Timer.cpp create mode 100644 src/Lib/Timer.h diff --git a/CMakeLists.txt b/CMakeLists.txt index a81530a3..9b7465f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,8 @@ add_executable(shadps4 ${FILESYSTEM_SOURCES} ${HOST_SOURCES} ${UTIL_SOURCES} + src/Lib/Timer.cpp + src/Lib/Timer.h src/main.cpp src/types.h src/Core/FsFile.cpp diff --git a/src/Core/PS4/HLE/Kernel/Objects/event_queue.cpp b/src/Core/PS4/HLE/Kernel/Objects/event_queue.cpp index d1a68cc1..521cd432 100644 --- a/src/Core/PS4/HLE/Kernel/Objects/event_queue.cpp +++ b/src/Core/PS4/HLE/Kernel/Objects/event_queue.cpp @@ -1,7 +1,8 @@ #include "event_queue.h" -#include "debug.h" -#include +#include + +#include "debug.h" namespace HLE::Kernel::Objects { EqueueInternal::~EqueueInternal() {} @@ -25,8 +26,9 @@ int EqueueInternal::addEvent(const EqueueEvent& event) { int EqueueInternal::waitForEvents(SceKernelEvent* ev, int num, u32 micros) { std::unique_lock lock{m_mutex}; - u64 timeElapsed = 0; - const auto start = std::chrono::high_resolution_clock::now(); + u32 timeElapsed = 0; + Lib::Timer t; + t.Start(); for (;;) { int ret = getTriggeredEvents(ev, num); @@ -41,8 +43,7 @@ int EqueueInternal::waitForEvents(SceKernelEvent* ev, int num, u32 micros) { m_cond.wait_for(lock, std::chrono::microseconds(micros - timeElapsed)); } - const auto end = std::chrono::high_resolution_clock::now(); - timeElapsed = std::chrono::duration_cast(end - start).count(); + timeElapsed = static_cast(t.GetTimeSec() * 1000000.0); } return 0; diff --git a/src/Lib/Timer.cpp b/src/Lib/Timer.cpp new file mode 100644 index 00000000..3dd1d251 --- /dev/null +++ b/src/Lib/Timer.cpp @@ -0,0 +1,103 @@ +#include "Timer.h" + +#ifdef _WIN64 +#include +#endif + +Lib::Timer::Timer() { +#ifdef _WIN64 + LARGE_INTEGER f; + QueryPerformanceFrequency(&f); + m_Frequency = f.QuadPart; +#else +#error Unimplemented Timer constructor +#endif +} + +void Lib::Timer::Start() { +#ifdef _WIN64 + LARGE_INTEGER c; + QueryPerformanceCounter(&c); + m_StartTime = c.QuadPart; +#else +#error Unimplemented Timer::Start() +#endif + m_is_timer_paused = false; +} + +void Lib::Timer::Pause() { +#ifdef _WIN64 + LARGE_INTEGER c; + QueryPerformanceCounter(&c); + m_PauseTime = c.QuadPart; +#else +#error Unimplemented Timer::Pause() +#endif + m_is_timer_paused = true; +} + +void Lib::Timer::Resume() { + u64 current_time = 0; +#ifdef _WIN64 + LARGE_INTEGER c; + QueryPerformanceCounter(&c); + current_time = c.QuadPart; +#else +#error Unimplemented Timer::Resume() +#endif + m_StartTime += current_time - m_PauseTime; + m_is_timer_paused = false; +} + +bool Lib::Timer::IsPaused() const { return m_is_timer_paused; } + +double Lib::Timer::GetTimeMsec() const { + if (m_is_timer_paused) { + return 1000.0 * (static_cast(m_PauseTime - m_StartTime)) / static_cast(m_Frequency); + } + + u64 current_time = 0; +#ifdef _WIN64 + LARGE_INTEGER c; + QueryPerformanceCounter(&c); + current_time = c.QuadPart; +#else +#error Unimplemented Timer::GetTimeMsec() +#endif + return 1000.0 * (static_cast(current_time - m_StartTime)) / static_cast(m_Frequency); +} + +double Lib::Timer::GetTimeSec() const { + if (m_is_timer_paused) { + return (static_cast(m_PauseTime - m_StartTime)) / static_cast(m_Frequency); + } + + u64 current_time = 0; +#ifdef _WIN64 + LARGE_INTEGER c; + QueryPerformanceCounter(&c); + current_time = c.QuadPart; +#else +#error Unimplemented Timer::GetTimeSec() +#endif + return (static_cast(current_time - m_StartTime)) / static_cast(m_Frequency); +} + +u64 Lib::Timer::GetTicks() const { + if (m_is_timer_paused) { + return (m_PauseTime - m_StartTime); + } + + u64 current_time = 0; +#ifdef _WIN64 + LARGE_INTEGER c; + QueryPerformanceCounter(&c); + current_time = c.QuadPart; +#else +#error Unimplemented Timer::GetTicks() +#endif + return (current_time - m_StartTime); +} + +u64 Lib::Timer::GetFrequency() const { return m_Frequency; } + diff --git a/src/Lib/Timer.h b/src/Lib/Timer.h new file mode 100644 index 00000000..cdb0cc42 --- /dev/null +++ b/src/Lib/Timer.h @@ -0,0 +1,34 @@ +#pragma once + +#include "../types.h" + +namespace Lib { + class Timer final + { + public: + Timer(); + ~Timer() = default; + + void Start(); + void Pause(); + void Resume(); + bool IsPaused() const; + + double GetTimeMsec() const;// return time in milliseconds + double GetTimeSec() const;// return time in seconds + u64 GetTicks() const;// return time in ticks + u64 GetFrequency() const;// return ticks frequency + + public: + Timer(const Timer&) = delete; + Timer& operator=(const Timer&) = delete; + Timer(Timer&&) = delete; + Timer& operator=(Timer&&) = delete; + + private: + bool m_is_timer_paused = true; + u64 m_Frequency = 0; + u64 m_StartTime = 0; + u64 m_PauseTime = 0; + }; +} \ No newline at end of file From f732704b83572c6993ec3ba9bcbefcf75a4ca59b Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Sun, 29 Oct 2023 23:46:34 +0200 Subject: [PATCH 02/14] implemented fps counter --- src/emulator.cpp | 64 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 4 deletions(-) diff --git a/src/emulator.cpp b/src/emulator.cpp index 44e69683..4bc747be 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -1,17 +1,29 @@ #include "emulator.h" -#include + #include #include -#include "Emulator/Util/singleton.h" +#include +#include #include #include "Core/PS4/HLE/Graphics/video_out.h" #include "Emulator/HLE/Libraries/LibPad/pad.h" +#include "Emulator/Util/singleton.h" #include "version.h" namespace Emu { bool m_emu_needs_exit = false; +double m_current_time_seconds = {0.0}; +double m_previous_time_seconds = {0.0}; +int m_update_num = {0}; +int m_frame_num = {0}; +double m_update_time_seconds = {0.0}; +double m_current_fps = {0.0}; +int m_max_updates_per_frame = {4}; +double m_update_fixed_time = 1.0 / 60.0; +int m_fps_frames_num = {0}; +double m_fps_start_time = {0}; void emuInit(u32 width, u32 height) { auto* window_ctx = singleton::instance(); @@ -49,7 +61,39 @@ static void CreateSdlWindow(WindowCtx* ctx) { SDL_SetWindowResizable(ctx->m_window, SDL_FALSE); // we don't support resizable atm } +static void update() { + static double lag = 0.0; + + lag += m_current_time_seconds - m_previous_time_seconds; + + int num = 0; + + while (lag >= m_update_fixed_time) { + if (num < m_max_updates_per_frame) { + m_update_num++; + num++; + m_update_time_seconds = m_update_num * m_update_fixed_time; + } + + lag -= m_update_fixed_time; + } +} +static void calculateFps(double game_time_s) { + m_previous_time_seconds = m_current_time_seconds; + m_current_time_seconds = game_time_s; + + m_frame_num++; + + m_fps_frames_num++; + if (m_current_time_seconds - m_fps_start_time > 0.25f) { + m_current_fps = static_cast(m_fps_frames_num) / (m_current_time_seconds - m_fps_start_time); + m_fps_frames_num = 0; + m_fps_start_time = m_current_time_seconds; + } +} void emuRun() { + Lib::Timer timer; + timer.Start(); auto* window_ctx = singleton::instance(); { // init window and wait until init finishes @@ -58,6 +102,7 @@ void emuRun() { Graphics::Vulkan::vulkanCreate(window_ctx); window_ctx->m_is_graphic_initialized = true; window_ctx->m_graphic_initialized_cond.notify_one(); + calculateFps(timer.GetTimeSec()); } bool exit_loop = false; @@ -88,9 +133,13 @@ void emuRun() { continue; } exit_loop = m_emu_needs_exit; - if (!exit_loop) { - HLE::Libs::Graphics::VideoOut::videoOutFlip(100000); // flip every 0.1 sec + update(); + } + if (!exit_loop) { + if (HLE::Libs::Graphics::VideoOut::videoOutFlip(100000)) { // flip every 0.1 sec + calculateFps(timer.GetTimeSec()); + } } } std::exit(0); @@ -102,6 +151,12 @@ HLE::Libs::Graphics::GraphicCtx* getGraphicCtx() { return &window_ctx->m_graphic_ctx; } +void updateSDLTitle() { + char title[256]; + sprintf(title, "shadps4 v %s FPS: %f", Emulator::VERSION, m_current_fps); + auto* window_ctx = singleton::instance(); + SDL_SetWindowTitle(window_ctx->m_window, title); +} void DrawBuffer(HLE::Libs::Graphics::VideoOutVulkanImage* image) { auto* window_ctx = singleton::instance(); if (window_ctx->is_window_hidden) { @@ -192,6 +247,7 @@ void DrawBuffer(HLE::Libs::Graphics::VideoOutVulkanImage* image) { fmt::print("vkQueuePresentKHR failed\n"); std::exit(0); } + updateSDLTitle(); } void keyboardEvent(SDL_Event* event) { From 758ef332f265b3159915d6bc0cd536f5a8e68a2f Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Mon, 30 Oct 2023 08:48:52 +0200 Subject: [PATCH 03/14] implemented sceKernelGetProcessTime --- CMakeLists.txt | 2 +- .../PS4/HLE/Graphics/Objects/video_out_ctx.cpp | 3 ++- .../hle/libraries/libkernel/time_management.cpp | 14 ++++++++++++++ src/Core/hle/libraries/libkernel/time_management.h | 10 ++++++++++ src/emuTimer.cpp | 10 ++++++++++ src/emuTimer.h | 7 +++++++ src/main.cpp | 2 ++ 7 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 src/Core/hle/libraries/libkernel/time_management.cpp create mode 100644 src/Core/hle/libraries/libkernel/time_management.h create mode 100644 src/emuTimer.cpp create mode 100644 src/emuTimer.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b7465f5..f84b6c84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,7 +98,7 @@ add_executable(shadps4 src/Core/PS4/HLE/Kernel/cpu_management.cpp src/Core/PS4/HLE/Kernel/cpu_management.h - "src/Util/Disassembler.cpp" "src/Util/Disassembler.h" "src/Core/PS4/Util/aerolib.h" "src/Core/PS4/Loader/SymbolsResolver.h" "src/Core/PS4/Loader/SymbolsResolver.cpp" "src/Core/PS4/HLE/Libs.cpp" "src/Core/PS4/HLE/Libs.h" "src/Core/PS4/HLE/LibC.cpp" "src/Core/PS4/HLE/LibC.h" "src/Core/PS4/HLE/LibKernel.cpp" "src/Core/PS4/HLE/LibKernel.h" "src/Core/PS4/HLE/LibSceGnmDriver.cpp" "src/Core/PS4/HLE/LibSceGnmDriver.h" "src/Core/PS4/HLE/Kernel/ThreadManagement.cpp" "src/Core/PS4/HLE/Kernel/ThreadManagement.h" "src/Core/PS4/HLE/ErrorCodes.h" "src/debug.h" "src/Core/PS4/HLE/Kernel/memory_management.cpp" "src/Core/PS4/HLE/Kernel/memory_management.h" "src/Core/PS4/GPU/gpu_memory.cpp" "src/Core/PS4/GPU/gpu_memory.h" "src/emulator.cpp" "src/emulator.h" "src/Core/PS4/HLE/Kernel/Objects/event_queue.h" "src/Core/PS4/HLE/Kernel/Objects/event_queue.cpp" "src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp" "src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.h" "src/Core/PS4/HLE/Graphics/graphics_ctx.h" "src/vulkan_util.cpp" "src/vulkan_util.h" "src/Core/PS4/GPU/video_out_buffer.cpp" "src/Core/PS4/GPU/video_out_buffer.h" "src/Core/PS4/HLE/Graphics/graphics_render.cpp" "src/Core/PS4/HLE/Graphics/graphics_render.h" "src/Core/PS4/GPU/tile_manager.cpp" "src/Core/PS4/GPU/tile_manager.h" "src/version.h" "src/Emulator/HLE/Libraries/LibSystemService/system_service.cpp" "src/Emulator/HLE/Libraries/LibSystemService/system_service.h" ) + "src/Util/Disassembler.cpp" "src/Util/Disassembler.h" "src/Core/PS4/Util/aerolib.h" "src/Core/PS4/Loader/SymbolsResolver.h" "src/Core/PS4/Loader/SymbolsResolver.cpp" "src/Core/PS4/HLE/Libs.cpp" "src/Core/PS4/HLE/Libs.h" "src/Core/PS4/HLE/LibC.cpp" "src/Core/PS4/HLE/LibC.h" "src/Core/PS4/HLE/LibKernel.cpp" "src/Core/PS4/HLE/LibKernel.h" "src/Core/PS4/HLE/LibSceGnmDriver.cpp" "src/Core/PS4/HLE/LibSceGnmDriver.h" "src/Core/PS4/HLE/Kernel/ThreadManagement.cpp" "src/Core/PS4/HLE/Kernel/ThreadManagement.h" "src/Core/PS4/HLE/ErrorCodes.h" "src/debug.h" "src/Core/PS4/HLE/Kernel/memory_management.cpp" "src/Core/PS4/HLE/Kernel/memory_management.h" "src/Core/PS4/GPU/gpu_memory.cpp" "src/Core/PS4/GPU/gpu_memory.h" "src/emulator.cpp" "src/emulator.h" "src/Core/PS4/HLE/Kernel/Objects/event_queue.h" "src/Core/PS4/HLE/Kernel/Objects/event_queue.cpp" "src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp" "src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.h" "src/Core/PS4/HLE/Graphics/graphics_ctx.h" "src/vulkan_util.cpp" "src/vulkan_util.h" "src/Core/PS4/GPU/video_out_buffer.cpp" "src/Core/PS4/GPU/video_out_buffer.h" "src/Core/PS4/HLE/Graphics/graphics_render.cpp" "src/Core/PS4/HLE/Graphics/graphics_render.h" "src/Core/PS4/GPU/tile_manager.cpp" "src/Core/PS4/GPU/tile_manager.h" "src/version.h" "src/Emulator/HLE/Libraries/LibSystemService/system_service.cpp" "src/Emulator/HLE/Libraries/LibSystemService/system_service.h" "src/emuTimer.cpp" "src/emuTimer.h" "src/Core/hle/libraries/libkernel/time_management.cpp" "src/Core/hle/libraries/libkernel/time_management.h") find_package(OpenGL REQUIRED) target_link_libraries(shadps4 PUBLIC fmt mincore spdlog IMGUI SDL3-shared ${OPENGL_LIBRARY} vulkan-1 spirv-tools-opt spirv-tools) diff --git a/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp b/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp index 4ebd7e6d..4df60c7e 100644 --- a/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp +++ b/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp @@ -2,6 +2,7 @@ #include #include +#include namespace HLE::Graphics::Objects { @@ -120,7 +121,7 @@ bool FlipQueue::flip(u32 micros) { m_done_cond.notify_one(); request->cfg->m_flip_status.count++; - // TODO request.cfg->m_flip_status.processTime = LibKernel::KernelGetProcessTime(); + request->cfg->m_flip_status.processTime = Core::Libraries::sceKernelGetProcessTime(); request->cfg->m_flip_status.tsc = HLE::Libs::LibKernel::sceKernelReadTsc(); request->cfg->m_flip_status.submitTsc = request->submit_tsc; request->cfg->m_flip_status.flipArg = request->flip_arg; diff --git a/src/Core/hle/libraries/libkernel/time_management.cpp b/src/Core/hle/libraries/libkernel/time_management.cpp new file mode 100644 index 00000000..a49b2a24 --- /dev/null +++ b/src/Core/hle/libraries/libkernel/time_management.cpp @@ -0,0 +1,14 @@ +#include "time_management.h" + +#include + +#include "emuTimer.h" + +namespace Core::Libraries { +u64 sceKernelGetProcessTime() { + return static_cast(Emulator::emuTimer::getTimeMsec() * 1000.0); // return time in microseconds +} + +void timeSymbolsRegister(SymbolsResolver* sym) { LIB_FUNCTION("4J2sUJmuHZQ", "libkernel", 1, "libkernel", 1, 1, sceKernelGetProcessTime); } + +} // namespace Core::Libraries diff --git a/src/Core/hle/libraries/libkernel/time_management.h b/src/Core/hle/libraries/libkernel/time_management.h new file mode 100644 index 00000000..12d87ca8 --- /dev/null +++ b/src/Core/hle/libraries/libkernel/time_management.h @@ -0,0 +1,10 @@ +#pragma once + +#include "types.h" +#include "Core/PS4/Loader/SymbolsResolver.h" + +namespace Core::Libraries { +u64 sceKernelGetProcessTime(); + +void timeSymbolsRegister(SymbolsResolver* sym); +} \ No newline at end of file diff --git a/src/emuTimer.cpp b/src/emuTimer.cpp new file mode 100644 index 00000000..c4fecfa8 --- /dev/null +++ b/src/emuTimer.cpp @@ -0,0 +1,10 @@ +#include "Lib/Timer.h" + +namespace Emulator::emuTimer { +static Lib::Timer timer; + +void start() { timer.Start(); } + +double getTimeMsec() { return timer.GetTimeMsec(); } + +} \ No newline at end of file diff --git a/src/emuTimer.h b/src/emuTimer.h new file mode 100644 index 00000000..2fdef406 --- /dev/null +++ b/src/emuTimer.h @@ -0,0 +1,7 @@ +#pragma once + +namespace Emulator::emuTimer { +void start(); +double getTimeMsec(); + +} // namespace Emulator::emuTimer \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 97cfc909..0c10cbd1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -13,6 +13,7 @@ #include "Core/PS4/Linker.h" #include "Emulator/Util\singleton.h" #include "discord.h" +#include "emuTimer.h" // Main code int main(int argc, char* argv[]) { @@ -26,6 +27,7 @@ int main(int argc, char* argv[]) { auto height = Config::getScreenHeight(); Emu::emuInit(width, height); HLE::Libs::Graphics::VideoOut::videoOutInit(width, height); + Emulator::emuTimer::start(); const char* const path = argv[1]; // argument 1 is the path of self file to boot From 36028645235229ee4c318cbb30cde96f6c57fdbb Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Mon, 30 Oct 2023 08:57:43 +0200 Subject: [PATCH 04/14] added timestamp in buttons state --- src/Emulator/HLE/Libraries/LibPad/pad.cpp | 2 +- src/Emulator/Host/controller.cpp | 2 ++ src/Emulator/Host/controller.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Emulator/HLE/Libraries/LibPad/pad.cpp b/src/Emulator/HLE/Libraries/LibPad/pad.cpp index d09944c4..1fe2798d 100644 --- a/src/Emulator/HLE/Libraries/LibPad/pad.cpp +++ b/src/Emulator/HLE/Libraries/LibPad/pad.cpp @@ -38,7 +38,7 @@ int PS4_SYSV_ABI scePadReadState(int32_t handle, ScePadData* pData) { pData->orientation.y = 0; pData->orientation.z = 0; pData->orientation.w = 0; - + pData->timestamp = state.time; pData->connected = true; // isConnected; //TODO fix me proper pData->connectedCount = 1;//connectedCount; pData->deviceUniqueDataLen = 0; diff --git a/src/Emulator/Host/controller.cpp b/src/Emulator/Host/controller.cpp index 6930c969..f0e00885 100644 --- a/src/Emulator/Host/controller.cpp +++ b/src/Emulator/Host/controller.cpp @@ -1,4 +1,5 @@ #include "controller.h" +#include namespace Emulator::Host::Controller { GameController::GameController() { m_states_num = 0; @@ -39,6 +40,7 @@ void GameController::addState(const State& state) { void GameController::checKButton(int id, u32 button, bool isPressed) { std::scoped_lock lock{m_mutex}; auto state = getLastState(); + state.time = Core::Libraries::sceKernelGetProcessTime(); if (isPressed) { state.buttonsState |= button; } else { diff --git a/src/Emulator/Host/controller.h b/src/Emulator/Host/controller.h index f2c1db8f..f534ed7a 100644 --- a/src/Emulator/Host/controller.h +++ b/src/Emulator/Host/controller.h @@ -5,6 +5,7 @@ namespace Emulator::Host::Controller { struct State { u32 buttonsState =0; + u64 time = 0; }; constexpr u32 MAX_STATES = 64; From 51dda8e8a5e3c0b43ca0c08d3afb852a2e24a26c Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Mon, 30 Oct 2023 12:43:39 +0200 Subject: [PATCH 05/14] namespace update --- src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp | 2 +- src/Core/hle/libraries/libkernel/time_management.cpp | 2 +- src/Core/hle/libraries/libkernel/time_management.h | 2 +- src/Emulator/Host/controller.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp b/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp index 4df60c7e..035bb5bd 100644 --- a/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp +++ b/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp @@ -121,7 +121,7 @@ bool FlipQueue::flip(u32 micros) { m_done_cond.notify_one(); request->cfg->m_flip_status.count++; - request->cfg->m_flip_status.processTime = Core::Libraries::sceKernelGetProcessTime(); + request->cfg->m_flip_status.processTime = Core::Libraries::LibKernel::sceKernelGetProcessTime(); request->cfg->m_flip_status.tsc = HLE::Libs::LibKernel::sceKernelReadTsc(); request->cfg->m_flip_status.submitTsc = request->submit_tsc; request->cfg->m_flip_status.flipArg = request->flip_arg; diff --git a/src/Core/hle/libraries/libkernel/time_management.cpp b/src/Core/hle/libraries/libkernel/time_management.cpp index a49b2a24..fa71e557 100644 --- a/src/Core/hle/libraries/libkernel/time_management.cpp +++ b/src/Core/hle/libraries/libkernel/time_management.cpp @@ -4,7 +4,7 @@ #include "emuTimer.h" -namespace Core::Libraries { +namespace Core::Libraries::LibKernel { u64 sceKernelGetProcessTime() { return static_cast(Emulator::emuTimer::getTimeMsec() * 1000.0); // return time in microseconds } diff --git a/src/Core/hle/libraries/libkernel/time_management.h b/src/Core/hle/libraries/libkernel/time_management.h index 12d87ca8..35d997fb 100644 --- a/src/Core/hle/libraries/libkernel/time_management.h +++ b/src/Core/hle/libraries/libkernel/time_management.h @@ -3,7 +3,7 @@ #include "types.h" #include "Core/PS4/Loader/SymbolsResolver.h" -namespace Core::Libraries { +namespace Core::Libraries::LibKernel { u64 sceKernelGetProcessTime(); void timeSymbolsRegister(SymbolsResolver* sym); diff --git a/src/Emulator/Host/controller.cpp b/src/Emulator/Host/controller.cpp index f0e00885..55373f14 100644 --- a/src/Emulator/Host/controller.cpp +++ b/src/Emulator/Host/controller.cpp @@ -40,7 +40,7 @@ void GameController::addState(const State& state) { void GameController::checKButton(int id, u32 button, bool isPressed) { std::scoped_lock lock{m_mutex}; auto state = getLastState(); - state.time = Core::Libraries::sceKernelGetProcessTime(); + state.time = Core::Libraries::LibKernel::sceKernelGetProcessTime(); if (isPressed) { state.buttonsState |= button; } else { From 0ad40cff1b48934867b3dbcec186e6a2d1f76ca4 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Mon, 30 Oct 2023 12:53:52 +0200 Subject: [PATCH 06/14] implemented sceKernelGetProcessTimeCounter , sceKernelGetProcessTimeCounterFrequency --- src/Core/PS4/HLE/LibKernel.cpp | 3 +++ src/Core/hle/libraries/libkernel/time_management.cpp | 11 +++++++++-- src/emuTimer.cpp | 6 +++++- src/emuTimer.h | 4 +++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/Core/PS4/HLE/LibKernel.cpp b/src/Core/PS4/HLE/LibKernel.cpp index a9646091..7d246f69 100644 --- a/src/Core/PS4/HLE/LibKernel.cpp +++ b/src/Core/PS4/HLE/LibKernel.cpp @@ -13,6 +13,7 @@ #include "Libs.h" #include "Emulator/HLE/Libraries/LibKernel/FileSystem/file_system.h" #include "Emulator/HLE/Libraries/LibKernel/FileSystem/posix_file_system.h" +#include "Core/hle/libraries/libkernel/time_management.h" namespace HLE::Libs::LibKernel { @@ -50,6 +51,8 @@ void LibKernel_Register(SymbolsResolver* sym) { // fs LIB_FUNCTION("1G3lF1Gg1k8", "libkernel", 1, "libkernel", 1, 1, Emulator::HLE::Libraries::LibKernel::FileSystem::sceKernelOpen); LIB_FUNCTION("wuCroIGjt2g", "libScePosix", 1, "libkernel", 1, 1, Emulator::HLE::Libraries::LibKernel::FileSystem::POSIX::open); + + Core::Libraries::LibKernel::timeSymbolsRegister(sym); } }; // namespace HLE::Libs::LibKernel \ No newline at end of file diff --git a/src/Core/hle/libraries/libkernel/time_management.cpp b/src/Core/hle/libraries/libkernel/time_management.cpp index fa71e557..f7ca9841 100644 --- a/src/Core/hle/libraries/libkernel/time_management.cpp +++ b/src/Core/hle/libraries/libkernel/time_management.cpp @@ -8,7 +8,14 @@ namespace Core::Libraries::LibKernel { u64 sceKernelGetProcessTime() { return static_cast(Emulator::emuTimer::getTimeMsec() * 1000.0); // return time in microseconds } +u64 sceKernelGetProcessTimeCounter() { return Emulator::emuTimer::getTimeCounter(); } -void timeSymbolsRegister(SymbolsResolver* sym) { LIB_FUNCTION("4J2sUJmuHZQ", "libkernel", 1, "libkernel", 1, 1, sceKernelGetProcessTime); } +u64 sceKernelGetProcessTimeCounterFrequency() { return Emulator::emuTimer::getTimeFrequency(); } -} // namespace Core::Libraries +void timeSymbolsRegister(SymbolsResolver* sym) { + LIB_FUNCTION("4J2sUJmuHZQ", "libkernel", 1, "libkernel", 1, 1, sceKernelGetProcessTime); + LIB_FUNCTION("fgxnMeTNUtY", "libkernel", 1, "libkernel", 1, 1, sceKernelGetProcessTimeCounter); + LIB_FUNCTION("BNowx2l588E", "libkernel", 1, "libkernel", 1, 1, sceKernelGetProcessTimeCounterFrequency); +} + +} // namespace Core::Libraries::LibKernel diff --git a/src/emuTimer.cpp b/src/emuTimer.cpp index c4fecfa8..c5d2700c 100644 --- a/src/emuTimer.cpp +++ b/src/emuTimer.cpp @@ -7,4 +7,8 @@ void start() { timer.Start(); } double getTimeMsec() { return timer.GetTimeMsec(); } -} \ No newline at end of file +u64 getTimeCounter() { return timer.GetTicks(); } + +u64 getTimeFrequency() { return timer.GetFrequency(); } + +} // namespace Emulator::emuTimer \ No newline at end of file diff --git a/src/emuTimer.h b/src/emuTimer.h index 2fdef406..bb53f71b 100644 --- a/src/emuTimer.h +++ b/src/emuTimer.h @@ -1,7 +1,9 @@ #pragma once +#include "types.h" namespace Emulator::emuTimer { void start(); double getTimeMsec(); - +u64 getTimeCounter(); +u64 getTimeFrequency(); } // namespace Emulator::emuTimer \ No newline at end of file From 61e8919cf1274e09cf38a347aee67d0b135c903b Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Mon, 30 Oct 2023 14:52:01 +0200 Subject: [PATCH 07/14] pause emu with p button --- src/emulator.cpp | 65 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 58 insertions(+), 7 deletions(-) diff --git a/src/emulator.cpp b/src/emulator.cpp index 4bc747be..b96ffeca 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -14,6 +14,7 @@ namespace Emu { bool m_emu_needs_exit = false; +bool m_game_is_paused = {false}; double m_current_time_seconds = {0.0}; double m_previous_time_seconds = {0.0}; int m_update_num = {0}; @@ -128,17 +129,67 @@ void emuRun() { case SDL_EVENT_DID_ENTER_FOREGROUND: break; case SDL_EVENT_KEY_DOWN: - case SDL_EVENT_KEY_UP: keyboardEvent(&event); break; + case SDL_EVENT_KEY_UP: + if (event.type == SDL_EVENT_KEY_DOWN){ + if (event.key.keysym.sym == SDLK_p) { + m_game_is_paused = !m_game_is_paused; + } + } + keyboardEvent(&event); + break; } continue; } - exit_loop = m_emu_needs_exit; - if (!exit_loop) { - update(); + if (m_game_is_paused) { + if (!timer.IsPaused()) { + timer.Pause(); + } + + SDL_WaitEvent(&event); + + switch (event.type) { + case SDL_EVENT_QUIT: m_emu_needs_exit = true; break; + + case SDL_EVENT_TERMINATING: m_emu_needs_exit = true; break; + + case SDL_EVENT_WILL_ENTER_BACKGROUND: break; + + case SDL_EVENT_DID_ENTER_BACKGROUND: break; + + case SDL_EVENT_WILL_ENTER_FOREGROUND: break; + + case SDL_EVENT_DID_ENTER_FOREGROUND: break; + + case SDL_EVENT_KEY_DOWN: + case SDL_EVENT_KEY_UP: + if (event.type == SDL_EVENT_KEY_DOWN) { + if (event.key.keysym.sym == SDLK_p) { + m_game_is_paused = !m_game_is_paused; + } + } + keyboardEvent(&event); + break; + } + exit_loop = m_emu_needs_exit; + continue; } - if (!exit_loop) { - if (HLE::Libs::Graphics::VideoOut::videoOutFlip(100000)) { // flip every 0.1 sec - calculateFps(timer.GetTimeSec()); + exit_loop = m_emu_needs_exit; + if (m_game_is_paused) { + if (!timer.IsPaused()) { + timer.Pause(); + } + } else { + if (timer.IsPaused()) { + timer.Resume(); + } + + if (!exit_loop) { + update(); + } + if (!exit_loop) { + if (HLE::Libs::Graphics::VideoOut::videoOutFlip(100000)) { // flip every 0.1 sec + calculateFps(timer.GetTimeSec()); + } } } } From 6f941c277adac08589e31cd0ef1d4f2f92820209 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Mon, 30 Oct 2023 20:22:25 +0200 Subject: [PATCH 08/14] reimplemented sceKernelReadTsc in proper package and some abi fixes --- src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp | 4 ++-- src/Core/PS4/HLE/LibKernel.cpp | 8 +------- src/Core/PS4/HLE/LibKernel.h | 1 - src/Core/hle/libraries/libkernel/time_management.cpp | 11 +++++++---- src/Core/hle/libraries/libkernel/time_management.h | 5 ++++- src/Lib/Timer.cpp | 6 ++++++ src/Lib/Timer.h | 2 +- 7 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp b/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp index 035bb5bd..74af085c 100644 --- a/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp +++ b/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp @@ -77,7 +77,7 @@ bool FlipQueue::submitFlip(VideoConfigInternal* cfg, s32 index, s64 flip_arg) { r.cfg = cfg; r.index = index; r.flip_arg = flip_arg; - r.submit_tsc = HLE::Libs::LibKernel::sceKernelReadTsc(); + r.submit_tsc = Core::Libraries::LibKernel::sceKernelReadTsc(); m_requests.push_back(r); @@ -122,7 +122,7 @@ bool FlipQueue::flip(u32 micros) { request->cfg->m_flip_status.count++; request->cfg->m_flip_status.processTime = Core::Libraries::LibKernel::sceKernelGetProcessTime(); - request->cfg->m_flip_status.tsc = HLE::Libs::LibKernel::sceKernelReadTsc(); + request->cfg->m_flip_status.tsc = Core::Libraries::LibKernel::sceKernelReadTsc(); request->cfg->m_flip_status.submitTsc = request->submit_tsc; request->cfg->m_flip_status.flipArg = request->flip_arg; request->cfg->m_flip_status.currentBuffer = request->index; diff --git a/src/Core/PS4/HLE/LibKernel.cpp b/src/Core/PS4/HLE/LibKernel.cpp index 7d246f69..bbd1f148 100644 --- a/src/Core/PS4/HLE/LibKernel.cpp +++ b/src/Core/PS4/HLE/LibKernel.cpp @@ -25,11 +25,7 @@ int32_t PS4_SYSV_ABI sceKernelReleaseDirectMemory(off_t start, size_t len) { } static PS4_SYSV_ABI void stack_chk_fail() { BREAKPOINT(); } -u64 PS4_SYSV_ABI sceKernelReadTsc() { - LARGE_INTEGER c; - QueryPerformanceCounter(&c); - return c.QuadPart; -} + int PS4_SYSV_ABI sceKernelMunmap(void* addr, size_t len) { BREAKPOINT(); } void LibKernel_Register(SymbolsResolver* sym) { // obj @@ -46,8 +42,6 @@ void LibKernel_Register(SymbolsResolver* sym) { // misc LIB_FUNCTION("WslcK1FQcGI", "libkernel", 1, "libkernel", 1, 1, CPUManagement::sceKernelIsNeoMode); LIB_FUNCTION("Ou3iL1abvng", "libkernel", 1, "libkernel", 1, 1, stack_chk_fail); - // time - LIB_FUNCTION("-2IRUCO--PM", "libkernel", 1, "libkernel", 1, 1, sceKernelReadTsc); // fs LIB_FUNCTION("1G3lF1Gg1k8", "libkernel", 1, "libkernel", 1, 1, Emulator::HLE::Libraries::LibKernel::FileSystem::sceKernelOpen); LIB_FUNCTION("wuCroIGjt2g", "libScePosix", 1, "libkernel", 1, 1, Emulator::HLE::Libraries::LibKernel::FileSystem::POSIX::open); diff --git a/src/Core/PS4/HLE/LibKernel.h b/src/Core/PS4/HLE/LibKernel.h index 903aef84..ee5fc613 100644 --- a/src/Core/PS4/HLE/LibKernel.h +++ b/src/Core/PS4/HLE/LibKernel.h @@ -6,6 +6,5 @@ void LibKernel_Register(SymbolsResolver* sym); // functions -u64 PS4_SYSV_ABI sceKernelReadTsc(); int32_t PS4_SYSV_ABI sceKernelReleaseDirectMemory(off_t start, size_t len); }; // namespace HLE::Libs::LibKernel \ No newline at end of file diff --git a/src/Core/hle/libraries/libkernel/time_management.cpp b/src/Core/hle/libraries/libkernel/time_management.cpp index f7ca9841..ab5d94d4 100644 --- a/src/Core/hle/libraries/libkernel/time_management.cpp +++ b/src/Core/hle/libraries/libkernel/time_management.cpp @@ -1,21 +1,24 @@ #include "time_management.h" #include - +#include "Lib/Timer.h" #include "emuTimer.h" namespace Core::Libraries::LibKernel { -u64 sceKernelGetProcessTime() { +u64 PS4_SYSV_ABI sceKernelGetProcessTime() { return static_cast(Emulator::emuTimer::getTimeMsec() * 1000.0); // return time in microseconds } -u64 sceKernelGetProcessTimeCounter() { return Emulator::emuTimer::getTimeCounter(); } +u64 PS4_SYSV_ABI sceKernelGetProcessTimeCounter() { return Emulator::emuTimer::getTimeCounter(); } -u64 sceKernelGetProcessTimeCounterFrequency() { return Emulator::emuTimer::getTimeFrequency(); } +u64 PS4_SYSV_ABI sceKernelGetProcessTimeCounterFrequency() { return Emulator::emuTimer::getTimeFrequency(); } + +u64 PS4_SYSV_ABI sceKernelReadTsc() { return Lib::Timer::getQueryPerformanceCounter(); } void timeSymbolsRegister(SymbolsResolver* sym) { LIB_FUNCTION("4J2sUJmuHZQ", "libkernel", 1, "libkernel", 1, 1, sceKernelGetProcessTime); LIB_FUNCTION("fgxnMeTNUtY", "libkernel", 1, "libkernel", 1, 1, sceKernelGetProcessTimeCounter); LIB_FUNCTION("BNowx2l588E", "libkernel", 1, "libkernel", 1, 1, sceKernelGetProcessTimeCounterFrequency); + LIB_FUNCTION("-2IRUCO--PM", "libkernel", 1, "libkernel", 1, 1, sceKernelReadTsc); } } // namespace Core::Libraries::LibKernel diff --git a/src/Core/hle/libraries/libkernel/time_management.h b/src/Core/hle/libraries/libkernel/time_management.h index 35d997fb..faa4ed85 100644 --- a/src/Core/hle/libraries/libkernel/time_management.h +++ b/src/Core/hle/libraries/libkernel/time_management.h @@ -4,7 +4,10 @@ #include "Core/PS4/Loader/SymbolsResolver.h" namespace Core::Libraries::LibKernel { -u64 sceKernelGetProcessTime(); +u64 PS4_SYSV_ABI sceKernelGetProcessTime(); +u64 PS4_SYSV_ABI sceKernelGetProcessTimeCounter(); +u64 PS4_SYSV_ABI sceKernelGetProcessTimeCounterFrequency(); +u64 PS4_SYSV_ABI sceKernelReadTsc(); void timeSymbolsRegister(SymbolsResolver* sym); } \ No newline at end of file diff --git a/src/Lib/Timer.cpp b/src/Lib/Timer.cpp index 3dd1d251..74392fb5 100644 --- a/src/Lib/Timer.cpp +++ b/src/Lib/Timer.cpp @@ -101,3 +101,9 @@ u64 Lib::Timer::GetTicks() const { u64 Lib::Timer::GetFrequency() const { return m_Frequency; } +u64 Lib::Timer::getQueryPerformanceCounter() { + LARGE_INTEGER c; + QueryPerformanceCounter(&c); + return c.QuadPart; +} + diff --git a/src/Lib/Timer.h b/src/Lib/Timer.h index cdb0cc42..8dcc8593 100644 --- a/src/Lib/Timer.h +++ b/src/Lib/Timer.h @@ -18,7 +18,7 @@ namespace Lib { double GetTimeSec() const;// return time in seconds u64 GetTicks() const;// return time in ticks u64 GetFrequency() const;// return ticks frequency - + [[nodiscard]] static u64 getQueryPerformanceCounter(); public: Timer(const Timer&) = delete; Timer& operator=(const Timer&) = delete; From cfdc45dfcb10e3a741b3ab7cf4b5a3b191fef4c0 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Mon, 30 Oct 2023 23:04:57 +0200 Subject: [PATCH 09/14] file_system reorganized (dummy) --- CMakeLists.txt | 8 ++--- src/Core/PS4/HLE/LibKernel.cpp | 9 ++---- .../hle/libraries/libkernel/file_system.cpp | 29 +++++++++++++++++++ .../hle/libraries/libkernel/file_system.h | 13 +++++++++ .../LibKernel/FileSystem/file_system.cpp | 13 --------- .../LibKernel/FileSystem/file_system.h | 7 ----- .../FileSystem/posix_file_system.cpp | 15 ---------- .../LibKernel/FileSystem/posix_file_system.h | 6 ---- 8 files changed, 49 insertions(+), 51 deletions(-) create mode 100644 src/Core/hle/libraries/libkernel/file_system.cpp create mode 100644 src/Core/hle/libraries/libkernel/file_system.h delete mode 100644 src/Emulator/HLE/Libraries/LibKernel/FileSystem/file_system.cpp delete mode 100644 src/Emulator/HLE/Libraries/LibKernel/FileSystem/file_system.h delete mode 100644 src/Emulator/HLE/Libraries/LibKernel/FileSystem/posix_file_system.cpp delete mode 100644 src/Emulator/HLE/Libraries/LibKernel/FileSystem/posix_file_system.h diff --git a/CMakeLists.txt b/CMakeLists.txt index f84b6c84..068bc808 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,10 +43,10 @@ set(SYSTEMSERVICE_SOURCES src/Emulator/HLE/Libraries/LibSystemService/system_ser src/Emulator/HLE/Libraries/LibSystemService/system_service.h ) -set(FILESYSTEM_SOURCES src/Emulator/HLE/Libraries/LibKernel/FileSystem/file_system.cpp - src/Emulator/HLE/Libraries/LibKernel/FileSystem/file_system.h - src/Emulator/HLE/Libraries/LibKernel/FileSystem/posix_file_system.cpp - src/Emulator/HLE/Libraries/LibKernel/FileSystem/posix_file_system.h +set(FILESYSTEM_SOURCES "src/Core/hle/libraries/libkernel/file_system.cpp" + "src/Core/hle/libraries/libkernel/file_system.h" + + ) set(HOST_SOURCES src/Emulator/Host/controller.cpp diff --git a/src/Core/PS4/HLE/LibKernel.cpp b/src/Core/PS4/HLE/LibKernel.cpp index bbd1f148..7a752c65 100644 --- a/src/Core/PS4/HLE/LibKernel.cpp +++ b/src/Core/PS4/HLE/LibKernel.cpp @@ -11,8 +11,7 @@ #include "Kernel/event_queues.h" #include "Kernel/memory_management.h" #include "Libs.h" -#include "Emulator/HLE/Libraries/LibKernel/FileSystem/file_system.h" -#include "Emulator/HLE/Libraries/LibKernel/FileSystem/posix_file_system.h" +#include "Core/hle/libraries/libkernel/file_system.h" #include "Core/hle/libraries/libkernel/time_management.h" namespace HLE::Libs::LibKernel { @@ -42,10 +41,8 @@ void LibKernel_Register(SymbolsResolver* sym) { // misc LIB_FUNCTION("WslcK1FQcGI", "libkernel", 1, "libkernel", 1, 1, CPUManagement::sceKernelIsNeoMode); LIB_FUNCTION("Ou3iL1abvng", "libkernel", 1, "libkernel", 1, 1, stack_chk_fail); - // fs - LIB_FUNCTION("1G3lF1Gg1k8", "libkernel", 1, "libkernel", 1, 1, Emulator::HLE::Libraries::LibKernel::FileSystem::sceKernelOpen); - LIB_FUNCTION("wuCroIGjt2g", "libScePosix", 1, "libkernel", 1, 1, Emulator::HLE::Libraries::LibKernel::FileSystem::POSIX::open); - + + Core::Libraries::LibKernel::fileSystemSymbolsRegister(sym); Core::Libraries::LibKernel::timeSymbolsRegister(sym); } diff --git a/src/Core/hle/libraries/libkernel/file_system.cpp b/src/Core/hle/libraries/libkernel/file_system.cpp new file mode 100644 index 00000000..c6679b1d --- /dev/null +++ b/src/Core/hle/libraries/libkernel/file_system.cpp @@ -0,0 +1,29 @@ +#include "file_system.h" + +#include +#include +#include + +namespace Core::Libraries::LibKernel { +constexpr bool log_file_fs = true; // disable it to disable logging + +int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, u16 mode) { + LOG_INFO_IF(log_file_fs, "sceKernelOpen path = {} flags = {:#x} mode = {:#x}\n", path, flags, mode); + return 0; +} + +int PS4_SYSV_ABI open(const char* path, int flags, /* SceKernelMode*/ u16 mode) { + LOG_INFO_IF(log_file_fs, "posix open redirect to sceKernelOpen\n"); + int result = sceKernelOpen(path, flags, mode); + if (result < 0) { + BREAKPOINT(); // posix calls different only for their return values + } + return result; +} + +void fileSystemSymbolsRegister(SymbolsResolver* sym) { + LIB_FUNCTION("1G3lF1Gg1k8", "libkernel", 1, "libkernel", 1, 1, sceKernelOpen); + LIB_FUNCTION("wuCroIGjt2g", "libScePosix", 1, "libkernel", 1, 1, open); +} + +} // namespace Core::Libraries::LibKernel \ No newline at end of file diff --git a/src/Core/hle/libraries/libkernel/file_system.h b/src/Core/hle/libraries/libkernel/file_system.h new file mode 100644 index 00000000..549d2bd4 --- /dev/null +++ b/src/Core/hle/libraries/libkernel/file_system.h @@ -0,0 +1,13 @@ +#pragma once +#include +#include "Core/PS4/Loader/SymbolsResolver.h" + +namespace Core::Libraries::LibKernel { +int PS4_SYSV_ABI sceKernelOpen(const char *path, int flags, /* SceKernelMode*/ u16 mode); + +// posix file system +int PS4_SYSV_ABI open(const char *path, int flags, /* SceKernelMode*/ u16 mode); + + +void fileSystemSymbolsRegister(SymbolsResolver *sym); +} // namespace Core::Libraries::LibKernel \ No newline at end of file diff --git a/src/Emulator/HLE/Libraries/LibKernel/FileSystem/file_system.cpp b/src/Emulator/HLE/Libraries/LibKernel/FileSystem/file_system.cpp deleted file mode 100644 index cdf35595..00000000 --- a/src/Emulator/HLE/Libraries/LibKernel/FileSystem/file_system.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "file_system.h" -#include -#include - -namespace Emulator::HLE::Libraries::LibKernel::FileSystem { -constexpr bool log_file_fs = true; // disable it to disable logging - -int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, u16 mode) { - LOG_INFO_IF(log_file_fs, "sceKernelOpen path = {} flags = {} mode = {}\n", path, log_hex_full(flags), log_hex_full(mode)); - return 0; -} - -} // namespace Emulator::HLE::Libraries::LibKernel::FileSystem \ No newline at end of file diff --git a/src/Emulator/HLE/Libraries/LibKernel/FileSystem/file_system.h b/src/Emulator/HLE/Libraries/LibKernel/FileSystem/file_system.h deleted file mode 100644 index 98f090f0..00000000 --- a/src/Emulator/HLE/Libraries/LibKernel/FileSystem/file_system.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once -#include - -namespace Emulator::HLE::Libraries::LibKernel::FileSystem { -int PS4_SYSV_ABI sceKernelOpen(const char *path, int flags, /* SceKernelMode*/ u16 mode); - -} \ No newline at end of file diff --git a/src/Emulator/HLE/Libraries/LibKernel/FileSystem/posix_file_system.cpp b/src/Emulator/HLE/Libraries/LibKernel/FileSystem/posix_file_system.cpp deleted file mode 100644 index caa6fb43..00000000 --- a/src/Emulator/HLE/Libraries/LibKernel/FileSystem/posix_file_system.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "posix_file_system.h" - -#include - -#include "file_system.h" - -namespace Emulator::HLE::Libraries::LibKernel::FileSystem::POSIX { -int PS4_SYSV_ABI open(const char* path, int flags, /* SceKernelMode*/ u16 mode) { - int result = sceKernelOpen(path, flags, mode); - if (result < 0) { - BREAKPOINT(); // posix calls different only for their return values - } - return result; -} -} // namespace Emulator::HLE::Libraries::LibKernel::FileSystem::POSIX diff --git a/src/Emulator/HLE/Libraries/LibKernel/FileSystem/posix_file_system.h b/src/Emulator/HLE/Libraries/LibKernel/FileSystem/posix_file_system.h deleted file mode 100644 index cce1c6c0..00000000 --- a/src/Emulator/HLE/Libraries/LibKernel/FileSystem/posix_file_system.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once -#include "types.h" - -namespace Emulator::HLE::Libraries::LibKernel::FileSystem::POSIX { -int PS4_SYSV_ABI open(const char *path, int flags, /* SceKernelMode*/ u16 mode); -} \ No newline at end of file From 93e75481c7bf268cfacf48352383bc3e8dfd6fe8 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Tue, 31 Oct 2023 08:47:58 +0200 Subject: [PATCH 10/14] refactoring Core folder to core --- CMakeLists.txt | 44 +++++++++---------- src/Core/PS4/GPU/gpu_memory.h | 2 +- .../HLE/Graphics/Objects/video_out_ctx.cpp | 4 +- .../PS4/HLE/Graphics/Objects/video_out_ctx.h | 4 +- src/Core/PS4/HLE/Graphics/video_out.cpp | 12 ++--- src/Core/PS4/HLE/Graphics/video_out.h | 4 +- .../PS4/HLE/Kernel/Objects/physical_memory.h | 4 +- src/Core/PS4/HLE/Kernel/cpu_management.cpp | 2 +- src/Core/PS4/HLE/Kernel/event_queues.cpp | 4 +- src/Core/PS4/HLE/Kernel/memory_management.cpp | 4 +- src/Core/PS4/HLE/LibKernel.cpp | 4 +- src/Core/PS4/HLE/LibSceGnmDriver.cpp | 2 +- src/Core/PS4/HLE/Libs.cpp | 2 +- src/Core/PS4/HLE/Libs.h | 2 +- .../hle/libraries/libkernel/file_system.cpp | 2 +- .../hle/libraries/libkernel/file_system.h | 2 +- .../libraries/libkernel/time_management.cpp | 2 +- .../hle/libraries/libkernel/time_management.h | 2 +- src/Core/virtual_memory.cpp | 2 +- src/Emulator/HLE/Libraries/LibPad/pad.cpp | 4 +- src/Emulator/HLE/Libraries/LibPad/pad.h | 2 +- .../LibSystemService/system_service.cpp | 4 +- .../LibSystemService/system_service.h | 2 +- .../Libraries/LibUserService/user_service.cpp | 4 +- .../Libraries/LibUserService/user_service.h | 2 +- src/Emulator/Host/controller.cpp | 2 +- src/GUI/ElfViewer.h | 2 +- src/emulator.cpp | 4 +- src/emulator.h | 2 +- src/main.cpp | 6 +-- src/vulkan_util.cpp | 2 +- src/vulkan_util.h | 2 +- 32 files changed, 71 insertions(+), 71 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 068bc808..33e3332b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,8 +43,8 @@ set(SYSTEMSERVICE_SOURCES src/Emulator/HLE/Libraries/LibSystemService/system_ser src/Emulator/HLE/Libraries/LibSystemService/system_service.h ) -set(FILESYSTEM_SOURCES "src/Core/hle/libraries/libkernel/file_system.cpp" - "src/Core/hle/libraries/libkernel/file_system.h" +set(FILESYSTEM_SOURCES "src/core/hle/libraries/libkernel/file_system.cpp" + "src/core/hle/libraries/libkernel/file_system.h" ) @@ -68,37 +68,37 @@ add_executable(shadps4 src/Lib/Timer.h src/main.cpp src/types.h - src/Core/FsFile.cpp - src/Core/FsFile.h - src/Core/PS4/Loader/Elf.cpp - src/Core/PS4/Loader/Elf.h + src/core/FsFile.cpp + src/core/FsFile.h + src/core/PS4/Loader/Elf.cpp + src/core/PS4/Loader/Elf.h src/GUI/ElfViewer.cpp src/GUI/ElfViewer.h src/Util/log.h src/Util/log.cpp src/Util/config.cpp src/Util/config.h - src/Core/virtual_memory.cpp - src/Core/virtual_memory.h - src/Core/PS4/Linker.cpp - src/Core/PS4/Linker.h - src/Core/PS4/Stubs.cpp - src/Core/PS4/Stubs.h - src/Core/PS4/Util/aerolib.cpp - src/Core/PS4/HLE/Kernel/Objects/physical_memory.h - src/Core/PS4/HLE/Kernel/Objects/physical_memory.cpp + src/core/virtual_memory.cpp + src/core/virtual_memory.h + src/core/PS4/Linker.cpp + src/core/PS4/Linker.h + src/core/PS4/Stubs.cpp + src/core/PS4/Stubs.h + src/core/PS4/Util/aerolib.cpp + src/core/PS4/HLE/Kernel/Objects/physical_memory.h + src/core/PS4/HLE/Kernel/Objects/physical_memory.cpp src/Util/string_util.cpp src/Util/string_util.cpp - src/Core/PS4/HLE/Graphics/video_out.cpp - src/Core/PS4/HLE/Graphics/video_out.h + src/core/PS4/HLE/Graphics/video_out.cpp + src/core/PS4/HLE/Graphics/video_out.h src/discord.h src/discord.cpp - src/Core/PS4/HLE/Kernel/event_queues.cpp - src/Core/PS4/HLE/Kernel/event_queues.h - src/Core/PS4/HLE/Kernel/cpu_management.cpp - src/Core/PS4/HLE/Kernel/cpu_management.h + src/core/PS4/HLE/Kernel/event_queues.cpp + src/core/PS4/HLE/Kernel/event_queues.h + src/core/PS4/HLE/Kernel/cpu_management.cpp + src/core/PS4/HLE/Kernel/cpu_management.h - "src/Util/Disassembler.cpp" "src/Util/Disassembler.h" "src/Core/PS4/Util/aerolib.h" "src/Core/PS4/Loader/SymbolsResolver.h" "src/Core/PS4/Loader/SymbolsResolver.cpp" "src/Core/PS4/HLE/Libs.cpp" "src/Core/PS4/HLE/Libs.h" "src/Core/PS4/HLE/LibC.cpp" "src/Core/PS4/HLE/LibC.h" "src/Core/PS4/HLE/LibKernel.cpp" "src/Core/PS4/HLE/LibKernel.h" "src/Core/PS4/HLE/LibSceGnmDriver.cpp" "src/Core/PS4/HLE/LibSceGnmDriver.h" "src/Core/PS4/HLE/Kernel/ThreadManagement.cpp" "src/Core/PS4/HLE/Kernel/ThreadManagement.h" "src/Core/PS4/HLE/ErrorCodes.h" "src/debug.h" "src/Core/PS4/HLE/Kernel/memory_management.cpp" "src/Core/PS4/HLE/Kernel/memory_management.h" "src/Core/PS4/GPU/gpu_memory.cpp" "src/Core/PS4/GPU/gpu_memory.h" "src/emulator.cpp" "src/emulator.h" "src/Core/PS4/HLE/Kernel/Objects/event_queue.h" "src/Core/PS4/HLE/Kernel/Objects/event_queue.cpp" "src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp" "src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.h" "src/Core/PS4/HLE/Graphics/graphics_ctx.h" "src/vulkan_util.cpp" "src/vulkan_util.h" "src/Core/PS4/GPU/video_out_buffer.cpp" "src/Core/PS4/GPU/video_out_buffer.h" "src/Core/PS4/HLE/Graphics/graphics_render.cpp" "src/Core/PS4/HLE/Graphics/graphics_render.h" "src/Core/PS4/GPU/tile_manager.cpp" "src/Core/PS4/GPU/tile_manager.h" "src/version.h" "src/Emulator/HLE/Libraries/LibSystemService/system_service.cpp" "src/Emulator/HLE/Libraries/LibSystemService/system_service.h" "src/emuTimer.cpp" "src/emuTimer.h" "src/Core/hle/libraries/libkernel/time_management.cpp" "src/Core/hle/libraries/libkernel/time_management.h") + "src/Util/Disassembler.cpp" "src/Util/Disassembler.h" "src/core/PS4/Util/aerolib.h" "src/core/PS4/Loader/SymbolsResolver.h" "src/core/PS4/Loader/SymbolsResolver.cpp" "src/core/PS4/HLE/Libs.cpp" "src/core/PS4/HLE/Libs.h" "src/core/PS4/HLE/LibC.cpp" "src/core/PS4/HLE/LibC.h" "src/core/PS4/HLE/LibKernel.cpp" "src/core/PS4/HLE/LibKernel.h" "src/core/PS4/HLE/LibSceGnmDriver.cpp" "src/core/PS4/HLE/LibSceGnmDriver.h" "src/core/PS4/HLE/Kernel/ThreadManagement.cpp" "src/core/PS4/HLE/Kernel/ThreadManagement.h" "src/core/PS4/HLE/ErrorCodes.h" "src/debug.h" "src/core/PS4/HLE/Kernel/memory_management.cpp" "src/core/PS4/HLE/Kernel/memory_management.h" "src/core/PS4/GPU/gpu_memory.cpp" "src/core/PS4/GPU/gpu_memory.h" "src/emulator.cpp" "src/emulator.h" "src/core/PS4/HLE/Kernel/Objects/event_queue.h" "src/core/PS4/HLE/Kernel/Objects/event_queue.cpp" "src/core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp" "src/core/PS4/HLE/Graphics/Objects/video_out_ctx.h" "src/core/PS4/HLE/Graphics/graphics_ctx.h" "src/vulkan_util.cpp" "src/vulkan_util.h" "src/core/PS4/GPU/video_out_buffer.cpp" "src/core/PS4/GPU/video_out_buffer.h" "src/core/PS4/HLE/Graphics/graphics_render.cpp" "src/core/PS4/HLE/Graphics/graphics_render.h" "src/core/PS4/GPU/tile_manager.cpp" "src/core/PS4/GPU/tile_manager.h" "src/version.h" "src/Emulator/HLE/Libraries/LibSystemService/system_service.cpp" "src/Emulator/HLE/Libraries/LibSystemService/system_service.h" "src/emuTimer.cpp" "src/emuTimer.h" "src/core/hle/libraries/libkernel/time_management.cpp" "src/core/hle/libraries/libkernel/time_management.h") find_package(OpenGL REQUIRED) target_link_libraries(shadps4 PUBLIC fmt mincore spdlog IMGUI SDL3-shared ${OPENGL_LIBRARY} vulkan-1 spirv-tools-opt spirv-tools) diff --git a/src/Core/PS4/GPU/gpu_memory.h b/src/Core/PS4/GPU/gpu_memory.h index 90151259..f4398085 100644 --- a/src/Core/PS4/GPU/gpu_memory.h +++ b/src/Core/PS4/GPU/gpu_memory.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include #include diff --git a/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp b/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp index 74af085c..c7586151 100644 --- a/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp +++ b/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp @@ -1,8 +1,8 @@ #include "video_out_ctx.h" -#include +#include #include -#include +#include namespace HLE::Graphics::Objects { diff --git a/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.h b/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.h index 07f301ac..0a60c1cf 100644 --- a/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.h +++ b/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.h @@ -2,8 +2,8 @@ #include #include -#include -#include +#include +#include #include using namespace HLE::Libs::Graphics::VideoOut; diff --git a/src/Core/PS4/HLE/Graphics/video_out.cpp b/src/Core/PS4/HLE/Graphics/video_out.cpp index f8503edd..ac0c67d3 100644 --- a/src/Core/PS4/HLE/Graphics/video_out.cpp +++ b/src/Core/PS4/HLE/Graphics/video_out.cpp @@ -1,11 +1,11 @@ #include "video_out.h" -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include diff --git a/src/Core/PS4/HLE/Graphics/video_out.h b/src/Core/PS4/HLE/Graphics/video_out.h index 9db9299d..be1fd514 100644 --- a/src/Core/PS4/HLE/Graphics/video_out.h +++ b/src/Core/PS4/HLE/Graphics/video_out.h @@ -1,6 +1,6 @@ #pragma once -#include -#include +#include +#include #include #include diff --git a/src/Core/PS4/HLE/Kernel/Objects/physical_memory.h b/src/Core/PS4/HLE/Kernel/Objects/physical_memory.h index 7e509bf3..e5ea7e5e 100644 --- a/src/Core/PS4/HLE/Kernel/Objects/physical_memory.h +++ b/src/Core/PS4/HLE/Kernel/Objects/physical_memory.h @@ -1,7 +1,7 @@ #pragma once #include -#include -#include +#include +#include #include #include diff --git a/src/Core/PS4/HLE/Kernel/cpu_management.cpp b/src/Core/PS4/HLE/Kernel/cpu_management.cpp index 210d4caa..2a605452 100644 --- a/src/Core/PS4/HLE/Kernel/cpu_management.cpp +++ b/src/Core/PS4/HLE/Kernel/cpu_management.cpp @@ -1,7 +1,7 @@ #include "cpu_management.h" #include "Util/config.h" #include -#include +#include namespace HLE::Libs::LibKernel::CPUManagement { int PS4_SYSV_ABI sceKernelIsNeoMode() { diff --git a/src/Core/PS4/HLE/Kernel/event_queues.cpp b/src/Core/PS4/HLE/Kernel/event_queues.cpp index dc26f820..c7ea7adc 100644 --- a/src/Core/PS4/HLE/Kernel/event_queues.cpp +++ b/src/Core/PS4/HLE/Kernel/event_queues.cpp @@ -1,7 +1,7 @@ #include "event_queues.h" -#include -#include +#include +#include #include #include diff --git a/src/Core/PS4/HLE/Kernel/memory_management.cpp b/src/Core/PS4/HLE/Kernel/memory_management.cpp index bea58c25..d891f6b9 100644 --- a/src/Core/PS4/HLE/Kernel/memory_management.cpp +++ b/src/Core/PS4/HLE/Kernel/memory_management.cpp @@ -1,7 +1,7 @@ #include "memory_management.h" -#include -#include +#include +#include #include #include diff --git a/src/Core/PS4/HLE/LibKernel.cpp b/src/Core/PS4/HLE/LibKernel.cpp index 7a752c65..a7599afa 100644 --- a/src/Core/PS4/HLE/LibKernel.cpp +++ b/src/Core/PS4/HLE/LibKernel.cpp @@ -11,8 +11,8 @@ #include "Kernel/event_queues.h" #include "Kernel/memory_management.h" #include "Libs.h" -#include "Core/hle/libraries/libkernel/file_system.h" -#include "Core/hle/libraries/libkernel/time_management.h" +#include "core/hle/libraries/libkernel/file_system.h" +#include "core/hle/libraries/libkernel/time_management.h" namespace HLE::Libs::LibKernel { diff --git a/src/Core/PS4/HLE/LibSceGnmDriver.cpp b/src/Core/PS4/HLE/LibSceGnmDriver.cpp index 8b6a07af..14d1f43e 100644 --- a/src/Core/PS4/HLE/LibSceGnmDriver.cpp +++ b/src/Core/PS4/HLE/LibSceGnmDriver.cpp @@ -3,7 +3,7 @@ #include "../Loader/Elf.h" #include #include -#include +#include #include namespace HLE::Libs::LibSceGnmDriver { diff --git a/src/Core/PS4/HLE/Libs.cpp b/src/Core/PS4/HLE/Libs.cpp index f4230db2..8b0216fb 100644 --- a/src/Core/PS4/HLE/Libs.cpp +++ b/src/Core/PS4/HLE/Libs.cpp @@ -3,7 +3,7 @@ #include "LibC.h" #include "LibKernel.h" #include "LibSceGnmDriver.h" -#include +#include #include "Emulator/HLE/Libraries/LibUserService/user_service.h" #include "Emulator/HLE/Libraries/LibPad/pad.h" #include diff --git a/src/Core/PS4/HLE/Libs.h b/src/Core/PS4/HLE/Libs.h index 39c15d47..be663939 100644 --- a/src/Core/PS4/HLE/Libs.h +++ b/src/Core/PS4/HLE/Libs.h @@ -1,6 +1,6 @@ #pragma once #include "../Loader/SymbolsResolver.h" -#include +#include #define LIB_FUNCTION(nid, lib, libversion, mod, moduleVersionMajor, moduleVersionMinor, function) \ {\ diff --git a/src/Core/hle/libraries/libkernel/file_system.cpp b/src/Core/hle/libraries/libkernel/file_system.cpp index c6679b1d..bc3ba4d7 100644 --- a/src/Core/hle/libraries/libkernel/file_system.cpp +++ b/src/Core/hle/libraries/libkernel/file_system.cpp @@ -1,6 +1,6 @@ #include "file_system.h" -#include +#include #include #include diff --git a/src/Core/hle/libraries/libkernel/file_system.h b/src/Core/hle/libraries/libkernel/file_system.h index 549d2bd4..36c973aa 100644 --- a/src/Core/hle/libraries/libkernel/file_system.h +++ b/src/Core/hle/libraries/libkernel/file_system.h @@ -1,6 +1,6 @@ #pragma once #include -#include "Core/PS4/Loader/SymbolsResolver.h" +#include "core/PS4/Loader/SymbolsResolver.h" namespace Core::Libraries::LibKernel { int PS4_SYSV_ABI sceKernelOpen(const char *path, int flags, /* SceKernelMode*/ u16 mode); diff --git a/src/Core/hle/libraries/libkernel/time_management.cpp b/src/Core/hle/libraries/libkernel/time_management.cpp index ab5d94d4..77665812 100644 --- a/src/Core/hle/libraries/libkernel/time_management.cpp +++ b/src/Core/hle/libraries/libkernel/time_management.cpp @@ -1,6 +1,6 @@ #include "time_management.h" -#include +#include #include "Lib/Timer.h" #include "emuTimer.h" diff --git a/src/Core/hle/libraries/libkernel/time_management.h b/src/Core/hle/libraries/libkernel/time_management.h index faa4ed85..7ea068a9 100644 --- a/src/Core/hle/libraries/libkernel/time_management.h +++ b/src/Core/hle/libraries/libkernel/time_management.h @@ -1,7 +1,7 @@ #pragma once #include "types.h" -#include "Core/PS4/Loader/SymbolsResolver.h" +#include "core/PS4/Loader/SymbolsResolver.h" namespace Core::Libraries::LibKernel { u64 PS4_SYSV_ABI sceKernelGetProcessTime(); diff --git a/src/Core/virtual_memory.cpp b/src/Core/virtual_memory.cpp index d96f7c75..4f0c3c39 100644 --- a/src/Core/virtual_memory.cpp +++ b/src/Core/virtual_memory.cpp @@ -1,6 +1,6 @@ #include "virtual_memory.h" -#include "Core/PS4/Loader/Elf.h" +#include "core/PS4/Loader/Elf.h" #ifdef _WIN64 #include diff --git a/src/Emulator/HLE/Libraries/LibPad/pad.cpp b/src/Emulator/HLE/Libraries/LibPad/pad.cpp index 1fe2798d..dbcf5d4b 100644 --- a/src/Emulator/HLE/Libraries/LibPad/pad.cpp +++ b/src/Emulator/HLE/Libraries/LibPad/pad.cpp @@ -1,7 +1,7 @@ #include "pad.h" -#include -#include +#include +#include #include "Emulator/Util/singleton.h" #include "Emulator/Host/controller.h" diff --git a/src/Emulator/HLE/Libraries/LibPad/pad.h b/src/Emulator/HLE/Libraries/LibPad/pad.h index 72d09726..b47b1607 100644 --- a/src/Emulator/HLE/Libraries/LibPad/pad.h +++ b/src/Emulator/HLE/Libraries/LibPad/pad.h @@ -2,7 +2,7 @@ #include #include -#include "Core/PS4/Loader/SymbolsResolver.h" +#include "core/PS4/Loader/SymbolsResolver.h" namespace Emulator::HLE::Libraries::LibPad { diff --git a/src/Emulator/HLE/Libraries/LibSystemService/system_service.cpp b/src/Emulator/HLE/Libraries/LibSystemService/system_service.cpp index 4786b5fd..354241ce 100644 --- a/src/Emulator/HLE/Libraries/LibSystemService/system_service.cpp +++ b/src/Emulator/HLE/Libraries/LibSystemService/system_service.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include "system_service.h" diff --git a/src/Emulator/HLE/Libraries/LibSystemService/system_service.h b/src/Emulator/HLE/Libraries/LibSystemService/system_service.h index 4c098606..bb4e98a0 100644 --- a/src/Emulator/HLE/Libraries/LibSystemService/system_service.h +++ b/src/Emulator/HLE/Libraries/LibSystemService/system_service.h @@ -1,5 +1,5 @@ #pragma once -#include "Core/PS4/Loader/SymbolsResolver.h" +#include "core/PS4/Loader/SymbolsResolver.h" namespace Emulator::HLE::Libraries::LibSystemService { diff --git a/src/Emulator/HLE/Libraries/LibUserService/user_service.cpp b/src/Emulator/HLE/Libraries/LibUserService/user_service.cpp index 2f58b956..0b2f4ae7 100644 --- a/src/Emulator/HLE/Libraries/LibUserService/user_service.cpp +++ b/src/Emulator/HLE/Libraries/LibUserService/user_service.cpp @@ -1,7 +1,7 @@ #include "user_service.h" -#include -#include +#include +#include namespace Emulator::HLE::Libraries::LibUserService { diff --git a/src/Emulator/HLE/Libraries/LibUserService/user_service.h b/src/Emulator/HLE/Libraries/LibUserService/user_service.h index 6c22c217..7371950b 100644 --- a/src/Emulator/HLE/Libraries/LibUserService/user_service.h +++ b/src/Emulator/HLE/Libraries/LibUserService/user_service.h @@ -1,5 +1,5 @@ #pragma once -#include "Core/PS4/Loader/SymbolsResolver.h" +#include "core/PS4/Loader/SymbolsResolver.h" namespace Emulator::HLE::Libraries::LibUserService { diff --git a/src/Emulator/Host/controller.cpp b/src/Emulator/Host/controller.cpp index 55373f14..599fb46f 100644 --- a/src/Emulator/Host/controller.cpp +++ b/src/Emulator/Host/controller.cpp @@ -1,5 +1,5 @@ #include "controller.h" -#include +#include namespace Emulator::Host::Controller { GameController::GameController() { m_states_num = 0; diff --git a/src/GUI/ElfViewer.h b/src/GUI/ElfViewer.h index ee5cea92..13a24d8c 100644 --- a/src/GUI/ElfViewer.h +++ b/src/GUI/ElfViewer.h @@ -1,5 +1,5 @@ #pragma once -#include "../Core/PS4/Loader/Elf.h" +#include "../core/PS4/Loader/Elf.h" class ElfViewer { private: diff --git a/src/emulator.cpp b/src/emulator.cpp index b96ffeca..c997bfd5 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -1,12 +1,12 @@ #include "emulator.h" -#include +#include #include #include #include #include -#include "Core/PS4/HLE/Graphics/video_out.h" +#include "core/PS4/HLE/Graphics/video_out.h" #include "Emulator/HLE/Libraries/LibPad/pad.h" #include "Emulator/Util/singleton.h" #include "version.h" diff --git a/src/emulator.h b/src/emulator.h index 0e9f938d..6f0fe528 100644 --- a/src/emulator.h +++ b/src/emulator.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include diff --git a/src/main.cpp b/src/main.cpp index 0c10cbd1..b3fa7dcc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,14 +3,14 @@ #include #include "types.h" #include "Util/log.h" -#include +#include #include #include #include #include #include -#include "Core/PS4/HLE/Libs.h" -#include "Core/PS4/Linker.h" +#include "core/PS4/HLE/Libs.h" +#include "core/PS4/Linker.h" #include "Emulator/Util\singleton.h" #include "discord.h" #include "emuTimer.h" diff --git a/src/vulkan_util.cpp b/src/vulkan_util.cpp index 5821944d..2dedcd83 100644 --- a/src/vulkan_util.cpp +++ b/src/vulkan_util.cpp @@ -1,6 +1,6 @@ #include "vulkan_util.h" #include -#include +#include #include #include #include diff --git a/src/vulkan_util.h b/src/vulkan_util.h index bd1fdda8..e4eda911 100644 --- a/src/vulkan_util.h +++ b/src/vulkan_util.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include #include From c488b7132db0341b98e113307c64e61c548e1785 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Tue, 31 Oct 2023 09:01:20 +0200 Subject: [PATCH 11/14] refactored libpad to new package --- CMakeLists.txt | 4 ++-- src/Core/PS4/HLE/Libs.cpp | 4 ++-- .../Libraries/LibPad => core/hle/libraries/libpad}/pad.cpp | 2 +- .../HLE/Libraries/LibPad => core/hle/libraries/libpad}/pad.h | 2 +- src/emulator.cpp | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) rename src/{Emulator/HLE/Libraries/LibPad => core/hle/libraries/libpad}/pad.cpp (97%) rename src/{Emulator/HLE/Libraries/LibPad => core/hle/libraries/libpad}/pad.h (96%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33e3332b..564e8e22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,8 +35,8 @@ set(USERSERVICE_SOURCES src/Emulator/HLE/Libraries/LibUserService/user_service.c src/Emulator/HLE/Libraries/LibUserService/user_service.h ) -set(PAD_SOURCES src/Emulator/HLE/Libraries/LibPad/pad.cpp - src/Emulator/HLE/Libraries/LibPad/pad.h +set(PAD_SOURCES "src/core/hle/libraries/libpad/pad.cpp" + "src/core/hle/libraries/libpad/pad.h" ) set(SYSTEMSERVICE_SOURCES src/Emulator/HLE/Libraries/LibSystemService/system_service.cpp diff --git a/src/Core/PS4/HLE/Libs.cpp b/src/Core/PS4/HLE/Libs.cpp index 8b0216fb..73e12e40 100644 --- a/src/Core/PS4/HLE/Libs.cpp +++ b/src/Core/PS4/HLE/Libs.cpp @@ -5,7 +5,7 @@ #include "LibSceGnmDriver.h" #include #include "Emulator/HLE/Libraries/LibUserService/user_service.h" -#include "Emulator/HLE/Libraries/LibPad/pad.h" +#include "core/hle/libraries/libpad/pad.h" #include namespace HLE::Libs { @@ -16,7 +16,7 @@ void Init_HLE_Libs(SymbolsResolver *sym) { Graphics::VideoOut::videoOutRegisterLib(sym); LibSceGnmDriver::LibSceGnmDriver_Register(sym); Emulator::HLE::Libraries::LibUserService::libUserService_Register(sym); - Emulator::HLE::Libraries::LibPad::libPad_Register(sym); + Core::Libraries::LibPad::libPad_Register(sym); Emulator::HLE::Libraries::LibSystemService::libSystemService_Register(sym); } } // namespace HLE::Libs \ No newline at end of file diff --git a/src/Emulator/HLE/Libraries/LibPad/pad.cpp b/src/core/hle/libraries/libpad/pad.cpp similarity index 97% rename from src/Emulator/HLE/Libraries/LibPad/pad.cpp rename to src/core/hle/libraries/libpad/pad.cpp index dbcf5d4b..3899498c 100644 --- a/src/Emulator/HLE/Libraries/LibPad/pad.cpp +++ b/src/core/hle/libraries/libpad/pad.cpp @@ -8,7 +8,7 @@ #include #include -namespace Emulator::HLE::Libraries::LibPad { +namespace Core::Libraries::LibPad { constexpr bool log_file_pad = true; // disable it to disable logging diff --git a/src/Emulator/HLE/Libraries/LibPad/pad.h b/src/core/hle/libraries/libpad/pad.h similarity index 96% rename from src/Emulator/HLE/Libraries/LibPad/pad.h rename to src/core/hle/libraries/libpad/pad.h index b47b1607..133c2036 100644 --- a/src/Emulator/HLE/Libraries/LibPad/pad.h +++ b/src/core/hle/libraries/libpad/pad.h @@ -4,7 +4,7 @@ #include "core/PS4/Loader/SymbolsResolver.h" -namespace Emulator::HLE::Libraries::LibPad { +namespace Core::Libraries::LibPad { typedef enum : u32 { SCE_PAD_BUTTON_L3 = 0x00000002, diff --git a/src/emulator.cpp b/src/emulator.cpp index c997bfd5..94c6f67f 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -7,7 +7,7 @@ #include #include "core/PS4/HLE/Graphics/video_out.h" -#include "Emulator/HLE/Libraries/LibPad/pad.h" +#include "core/hle/libraries/libpad/pad.h" #include "Emulator/Util/singleton.h" #include "version.h" @@ -302,7 +302,7 @@ void DrawBuffer(HLE::Libs::Graphics::VideoOutVulkanImage* image) { } void keyboardEvent(SDL_Event* event) { - using Emulator::HLE::Libraries::LibPad::ScePadButton; + using Core::Libraries::LibPad::ScePadButton; if (event->type == SDL_EVENT_KEY_DOWN || event->type == SDL_EVENT_KEY_UP) { u32 button = 0; From bdd756a0905e1d497db2d6fd31daf4f8635d405d Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Tue, 31 Oct 2023 09:04:08 +0200 Subject: [PATCH 12/14] log scePadOpen --- src/core/hle/libraries/libpad/pad.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/hle/libraries/libpad/pad.cpp b/src/core/hle/libraries/libpad/pad.cpp index 3899498c..1721413a 100644 --- a/src/core/hle/libraries/libpad/pad.cpp +++ b/src/core/hle/libraries/libpad/pad.cpp @@ -16,6 +16,7 @@ int PS4_SYSV_ABI scePadInit() { return SCE_OK; } int PS4_SYSV_ABI scePadOpen(Emulator::HLE::Libraries::LibUserService::SceUserServiceUserId userId, s32 type, s32 index, const ScePadOpenParam* pParam) { + LOG_INFO_IF(log_file_pad, "scePadOpen userid = {} type = {} index = {}\n", userId, type, index); return 1; // dummy } From 7391f7708abc9478d9efadaded08dc8ab6d67b5a Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Tue, 31 Oct 2023 13:35:52 +0200 Subject: [PATCH 13/14] user service refactoring --- CMakeLists.txt | 12 ++++++------ src/Core/PS4/HLE/Libs.cpp | 6 +++--- src/core/hle/libraries/libpad/pad.cpp | 4 ++-- src/core/hle/libraries/libpad/pad.h | 8 ++++---- .../hle/libraries/libuserservice}/user_service.cpp | 13 ++++++++----- .../hle/libraries/libuserservice}/user_service.h | 4 ++-- 6 files changed, 25 insertions(+), 22 deletions(-) rename src/{Emulator/HLE/Libraries/LibUserService => core/hle/libraries/libuserservice}/user_service.cpp (74%) rename src/{Emulator/HLE/Libraries/LibUserService => core/hle/libraries/libuserservice}/user_service.h (71%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 564e8e22..1f1dc3ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,20 +31,20 @@ set(LIBC_SOURCES src/Emulator/HLE/Libraries/LibC/Libc.cpp src/Emulator/HLE/Libraries/LibC/libc_cxa.cpp src/Emulator/HLE/Libraries/LibC/libc_cxa.h ) -set(USERSERVICE_SOURCES src/Emulator/HLE/Libraries/LibUserService/user_service.cpp - src/Emulator/HLE/Libraries/LibUserService/user_service.h +set(USERSERVICE_SOURCES src/core/hle/libraries/libuserservice/user_service.cpp + src/core/hle/libraries/libuserservice/user_service.h ) -set(PAD_SOURCES "src/core/hle/libraries/libpad/pad.cpp" - "src/core/hle/libraries/libpad/pad.h" +set(PAD_SOURCES src/core/hle/libraries/libpad/pad.cpp + src/core/hle/libraries/libpad/pad.h ) set(SYSTEMSERVICE_SOURCES src/Emulator/HLE/Libraries/LibSystemService/system_service.cpp src/Emulator/HLE/Libraries/LibSystemService/system_service.h ) -set(FILESYSTEM_SOURCES "src/core/hle/libraries/libkernel/file_system.cpp" - "src/core/hle/libraries/libkernel/file_system.h" +set(FILESYSTEM_SOURCES src/core/hle/libraries/libkernel/file_system.cpp + src/core/hle/libraries/libkernel/file_system.h ) diff --git a/src/Core/PS4/HLE/Libs.cpp b/src/Core/PS4/HLE/Libs.cpp index 73e12e40..74a80786 100644 --- a/src/Core/PS4/HLE/Libs.cpp +++ b/src/Core/PS4/HLE/Libs.cpp @@ -4,7 +4,7 @@ #include "LibKernel.h" #include "LibSceGnmDriver.h" #include -#include "Emulator/HLE/Libraries/LibUserService/user_service.h" +#include "core/hle/libraries/libuserservice/user_service.h" #include "core/hle/libraries/libpad/pad.h" #include @@ -15,8 +15,8 @@ void Init_HLE_Libs(SymbolsResolver *sym) { LibKernel::LibKernel_Register(sym); Graphics::VideoOut::videoOutRegisterLib(sym); LibSceGnmDriver::LibSceGnmDriver_Register(sym); - Emulator::HLE::Libraries::LibUserService::libUserService_Register(sym); - Core::Libraries::LibPad::libPad_Register(sym); + Core::Libraries::LibUserService::userServiceSymbolsRegister(sym); + Core::Libraries::LibPad::padSymbolsRegister(sym); Emulator::HLE::Libraries::LibSystemService::libSystemService_Register(sym); } } // namespace HLE::Libs \ No newline at end of file diff --git a/src/core/hle/libraries/libpad/pad.cpp b/src/core/hle/libraries/libpad/pad.cpp index 1721413a..fea4992c 100644 --- a/src/core/hle/libraries/libpad/pad.cpp +++ b/src/core/hle/libraries/libpad/pad.cpp @@ -14,7 +14,7 @@ constexpr bool log_file_pad = true; // disable it to disable logging int PS4_SYSV_ABI scePadInit() { return SCE_OK; } -int PS4_SYSV_ABI scePadOpen(Emulator::HLE::Libraries::LibUserService::SceUserServiceUserId userId, s32 type, s32 index, +int PS4_SYSV_ABI scePadOpen(Core::Libraries::LibUserService::SceUserServiceUserId userId, s32 type, s32 index, const ScePadOpenParam* pParam) { LOG_INFO_IF(log_file_pad, "scePadOpen userid = {} type = {} index = {}\n", userId, type, index); return 1; // dummy @@ -47,7 +47,7 @@ int PS4_SYSV_ABI scePadReadState(int32_t handle, ScePadData* pData) { return SCE_OK; } -void libPad_Register(SymbolsResolver* sym) { +void padSymbolsRegister(SymbolsResolver* sym) { LIB_FUNCTION("hv1luiJrqQM", "libScePad", 1, "libScePad", 1, 1, scePadInit); LIB_FUNCTION("xk0AcarP3V4", "libScePad", 1, "libScePad", 1, 1, scePadOpen); LIB_FUNCTION("YndgXqQVV7c", "libScePad", 1, "libScePad", 1, 1, scePadReadState); diff --git a/src/core/hle/libraries/libpad/pad.h b/src/core/hle/libraries/libpad/pad.h index 133c2036..af925bdd 100644 --- a/src/core/hle/libraries/libpad/pad.h +++ b/src/core/hle/libraries/libpad/pad.h @@ -1,8 +1,8 @@ #pragma once -#include #include #include "core/PS4/Loader/SymbolsResolver.h" +#include "core/hle/libraries/libuserservice/user_service.h" namespace Core::Libraries::LibPad { @@ -90,9 +90,9 @@ struct ScePadData { }; // hle functions int PS4_SYSV_ABI scePadInit(); -int PS4_SYSV_ABI scePadOpen(Emulator::HLE::Libraries::LibUserService::SceUserServiceUserId userId, s32 type, s32 index, +int PS4_SYSV_ABI scePadOpen(Core::Libraries::LibUserService::SceUserServiceUserId userId, s32 type, s32 index, const ScePadOpenParam* pParam); int PS4_SYSV_ABI scePadReadState(int32_t handle, ScePadData* pData); -void libPad_Register(SymbolsResolver* sym); -}; // namespace Emulator::HLE::Libraries::LibPad \ No newline at end of file +void padSymbolsRegister(SymbolsResolver* sym); +}; // namespace Core::Libraries::LibPad \ No newline at end of file diff --git a/src/Emulator/HLE/Libraries/LibUserService/user_service.cpp b/src/core/hle/libraries/libuserservice/user_service.cpp similarity index 74% rename from src/Emulator/HLE/Libraries/LibUserService/user_service.cpp rename to src/core/hle/libraries/libuserservice/user_service.cpp index 0b2f4ae7..a887f506 100644 --- a/src/Emulator/HLE/Libraries/LibUserService/user_service.cpp +++ b/src/core/hle/libraries/libuserservice/user_service.cpp @@ -3,15 +3,17 @@ #include #include -namespace Emulator::HLE::Libraries::LibUserService { +#include "Util/log.h" + +namespace Core::Libraries::LibUserService { s32 PS4_SYSV_ABI sceUserServiceInitialize(const SceUserServiceInitializeParams* initParams) { - // dummy + PRINT_DUMMY_FUNCTION_NAME(); return SCE_OK; } s32 PS4_SYSV_ABI sceUserServiceGetLoginUserIdList(SceUserServiceLoginUserIdList* userIdList) { - // dummy + PRINT_DUMMY_FUNCTION_NAME(); userIdList->user_id[0] = 1; userIdList->user_id[1] = -1; userIdList->user_id[2] = -1; @@ -19,8 +21,9 @@ s32 PS4_SYSV_ABI sceUserServiceGetLoginUserIdList(SceUserServiceLoginUserIdList* return SCE_OK; } -void libUserService_Register(SymbolsResolver* sym) { +void userServiceSymbolsRegister(SymbolsResolver* sym) { LIB_FUNCTION("j3YMu1MVNNo", "libSceUserService", 1, "libSceUserService", 1, 1, sceUserServiceInitialize); LIB_FUNCTION("fPhymKNvK-A", "libSceUserService", 1, "libSceUserService", 1, 1, sceUserServiceGetLoginUserIdList); } -}; // namespace Emulator::HLE::Libraries::LibUserService + +} // namespace Core::Libraries::LibUserService diff --git a/src/Emulator/HLE/Libraries/LibUserService/user_service.h b/src/core/hle/libraries/libuserservice/user_service.h similarity index 71% rename from src/Emulator/HLE/Libraries/LibUserService/user_service.h rename to src/core/hle/libraries/libuserservice/user_service.h index 7371950b..4a386946 100644 --- a/src/Emulator/HLE/Libraries/LibUserService/user_service.h +++ b/src/core/hle/libraries/libuserservice/user_service.h @@ -1,7 +1,7 @@ #pragma once #include "core/PS4/Loader/SymbolsResolver.h" -namespace Emulator::HLE::Libraries::LibUserService { +namespace Core::Libraries::LibUserService { using SceUserServiceUserId = s32; @@ -16,5 +16,5 @@ struct SceUserServiceLoginUserIdList { s32 PS4_SYSV_ABI sceUserServiceInitialize(const SceUserServiceInitializeParams* initParams); s32 PS4_SYSV_ABI sceUserServiceGetLoginUserIdList(SceUserServiceLoginUserIdList* userIdList); -void libUserService_Register(SymbolsResolver* sym); +void userServiceSymbolsRegister(SymbolsResolver* sym); }; // namespace Emulator::HLE::Libraries::LibUserService \ No newline at end of file From 11c0d79045caac4588bc716f1a6eb9498ce09aa7 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Tue, 31 Oct 2023 14:04:35 +0200 Subject: [PATCH 14/14] refactoring system service --- CMakeLists.txt | 6 +++--- src/Core/PS4/HLE/Libs.cpp | 4 ++-- .../HLE/Libraries/LibSystemService/system_service.h | 11 ----------- .../libraries/libsystemservice}/system_service.cpp | 8 ++++---- .../hle/libraries/libsystemservice/system_service.h | 11 +++++++++++ 5 files changed, 20 insertions(+), 20 deletions(-) delete mode 100644 src/Emulator/HLE/Libraries/LibSystemService/system_service.h rename src/{Emulator/HLE/Libraries/LibSystemService => core/hle/libraries/libsystemservice}/system_service.cpp (57%) create mode 100644 src/core/hle/libraries/libsystemservice/system_service.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f1dc3ba..31cbdc72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,8 +39,8 @@ set(PAD_SOURCES src/core/hle/libraries/libpad/pad.cpp src/core/hle/libraries/libpad/pad.h ) -set(SYSTEMSERVICE_SOURCES src/Emulator/HLE/Libraries/LibSystemService/system_service.cpp - src/Emulator/HLE/Libraries/LibSystemService/system_service.h +set(SYSTEMSERVICE_SOURCES src/core/hle/libraries/libsystemservice/system_service.cpp + src/core/hle/libraries/libsystemservice/system_service.h ) set(FILESYSTEM_SOURCES src/core/hle/libraries/libkernel/file_system.cpp @@ -98,7 +98,7 @@ add_executable(shadps4 src/core/PS4/HLE/Kernel/cpu_management.cpp src/core/PS4/HLE/Kernel/cpu_management.h - "src/Util/Disassembler.cpp" "src/Util/Disassembler.h" "src/core/PS4/Util/aerolib.h" "src/core/PS4/Loader/SymbolsResolver.h" "src/core/PS4/Loader/SymbolsResolver.cpp" "src/core/PS4/HLE/Libs.cpp" "src/core/PS4/HLE/Libs.h" "src/core/PS4/HLE/LibC.cpp" "src/core/PS4/HLE/LibC.h" "src/core/PS4/HLE/LibKernel.cpp" "src/core/PS4/HLE/LibKernel.h" "src/core/PS4/HLE/LibSceGnmDriver.cpp" "src/core/PS4/HLE/LibSceGnmDriver.h" "src/core/PS4/HLE/Kernel/ThreadManagement.cpp" "src/core/PS4/HLE/Kernel/ThreadManagement.h" "src/core/PS4/HLE/ErrorCodes.h" "src/debug.h" "src/core/PS4/HLE/Kernel/memory_management.cpp" "src/core/PS4/HLE/Kernel/memory_management.h" "src/core/PS4/GPU/gpu_memory.cpp" "src/core/PS4/GPU/gpu_memory.h" "src/emulator.cpp" "src/emulator.h" "src/core/PS4/HLE/Kernel/Objects/event_queue.h" "src/core/PS4/HLE/Kernel/Objects/event_queue.cpp" "src/core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp" "src/core/PS4/HLE/Graphics/Objects/video_out_ctx.h" "src/core/PS4/HLE/Graphics/graphics_ctx.h" "src/vulkan_util.cpp" "src/vulkan_util.h" "src/core/PS4/GPU/video_out_buffer.cpp" "src/core/PS4/GPU/video_out_buffer.h" "src/core/PS4/HLE/Graphics/graphics_render.cpp" "src/core/PS4/HLE/Graphics/graphics_render.h" "src/core/PS4/GPU/tile_manager.cpp" "src/core/PS4/GPU/tile_manager.h" "src/version.h" "src/Emulator/HLE/Libraries/LibSystemService/system_service.cpp" "src/Emulator/HLE/Libraries/LibSystemService/system_service.h" "src/emuTimer.cpp" "src/emuTimer.h" "src/core/hle/libraries/libkernel/time_management.cpp" "src/core/hle/libraries/libkernel/time_management.h") + "src/Util/Disassembler.cpp" "src/Util/Disassembler.h" "src/core/PS4/Util/aerolib.h" "src/core/PS4/Loader/SymbolsResolver.h" "src/core/PS4/Loader/SymbolsResolver.cpp" "src/core/PS4/HLE/Libs.cpp" "src/core/PS4/HLE/Libs.h" "src/core/PS4/HLE/LibC.cpp" "src/core/PS4/HLE/LibC.h" "src/core/PS4/HLE/LibKernel.cpp" "src/core/PS4/HLE/LibKernel.h" "src/core/PS4/HLE/LibSceGnmDriver.cpp" "src/core/PS4/HLE/LibSceGnmDriver.h" "src/core/PS4/HLE/Kernel/ThreadManagement.cpp" "src/core/PS4/HLE/Kernel/ThreadManagement.h" "src/core/PS4/HLE/ErrorCodes.h" "src/debug.h" "src/core/PS4/HLE/Kernel/memory_management.cpp" "src/core/PS4/HLE/Kernel/memory_management.h" "src/core/PS4/GPU/gpu_memory.cpp" "src/core/PS4/GPU/gpu_memory.h" "src/emulator.cpp" "src/emulator.h" "src/core/PS4/HLE/Kernel/Objects/event_queue.h" "src/core/PS4/HLE/Kernel/Objects/event_queue.cpp" "src/core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp" "src/core/PS4/HLE/Graphics/Objects/video_out_ctx.h" "src/core/PS4/HLE/Graphics/graphics_ctx.h" "src/vulkan_util.cpp" "src/vulkan_util.h" "src/core/PS4/GPU/video_out_buffer.cpp" "src/core/PS4/GPU/video_out_buffer.h" "src/core/PS4/HLE/Graphics/graphics_render.cpp" "src/core/PS4/HLE/Graphics/graphics_render.h" "src/core/PS4/GPU/tile_manager.cpp" "src/core/PS4/GPU/tile_manager.h" "src/version.h" "src/emuTimer.cpp" "src/emuTimer.h" "src/core/hle/libraries/libkernel/time_management.cpp" "src/core/hle/libraries/libkernel/time_management.h") find_package(OpenGL REQUIRED) target_link_libraries(shadps4 PUBLIC fmt mincore spdlog IMGUI SDL3-shared ${OPENGL_LIBRARY} vulkan-1 spirv-tools-opt spirv-tools) diff --git a/src/Core/PS4/HLE/Libs.cpp b/src/Core/PS4/HLE/Libs.cpp index 74a80786..18bc52ec 100644 --- a/src/Core/PS4/HLE/Libs.cpp +++ b/src/Core/PS4/HLE/Libs.cpp @@ -6,7 +6,7 @@ #include #include "core/hle/libraries/libuserservice/user_service.h" #include "core/hle/libraries/libpad/pad.h" -#include +#include namespace HLE::Libs { @@ -17,6 +17,6 @@ void Init_HLE_Libs(SymbolsResolver *sym) { LibSceGnmDriver::LibSceGnmDriver_Register(sym); Core::Libraries::LibUserService::userServiceSymbolsRegister(sym); Core::Libraries::LibPad::padSymbolsRegister(sym); - Emulator::HLE::Libraries::LibSystemService::libSystemService_Register(sym); + Core::Libraries::LibSystemService::systemServiceSymbolsRegister(sym); } } // namespace HLE::Libs \ No newline at end of file diff --git a/src/Emulator/HLE/Libraries/LibSystemService/system_service.h b/src/Emulator/HLE/Libraries/LibSystemService/system_service.h deleted file mode 100644 index bb4e98a0..00000000 --- a/src/Emulator/HLE/Libraries/LibSystemService/system_service.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once -#include "core/PS4/Loader/SymbolsResolver.h" - -namespace Emulator::HLE::Libraries::LibSystemService { - -//HLE functions -s32 PS4_SYSV_ABI sceSystemServiceHideSplashScreen(); - -void libSystemService_Register(SymbolsResolver* sym); - -}; // namespace Emulator::HLE::Libraries::LibUserService \ No newline at end of file diff --git a/src/Emulator/HLE/Libraries/LibSystemService/system_service.cpp b/src/core/hle/libraries/libsystemservice/system_service.cpp similarity index 57% rename from src/Emulator/HLE/Libraries/LibSystemService/system_service.cpp rename to src/core/hle/libraries/libsystemservice/system_service.cpp index 354241ce..42b2b5e2 100644 --- a/src/Emulator/HLE/Libraries/LibSystemService/system_service.cpp +++ b/src/core/hle/libraries/libsystemservice/system_service.cpp @@ -1,16 +1,16 @@ #include #include - +#include #include "system_service.h" -namespace Emulator::HLE::Libraries::LibSystemService { +namespace Core::Libraries::LibSystemService { s32 PS4_SYSV_ABI sceSystemServiceHideSplashScreen() { - // dummy + PRINT_DUMMY_FUNCTION_NAME(); return SCE_OK; } -void libSystemService_Register(SymbolsResolver* sym) { +void systemServiceSymbolsRegister(SymbolsResolver* sym) { LIB_FUNCTION("Vo5V8KAwCmk", "libSceSystemService", 1, "libSceSystemService", 1, 1, sceSystemServiceHideSplashScreen); } }; // namespace Emulator::HLE::Libraries::LibUserService \ No newline at end of file diff --git a/src/core/hle/libraries/libsystemservice/system_service.h b/src/core/hle/libraries/libsystemservice/system_service.h new file mode 100644 index 00000000..c786a848 --- /dev/null +++ b/src/core/hle/libraries/libsystemservice/system_service.h @@ -0,0 +1,11 @@ +#pragma once +#include "core/PS4/Loader/SymbolsResolver.h" + +namespace Core::Libraries::LibSystemService { + +//HLE functions +s32 PS4_SYSV_ABI sceSystemServiceHideSplashScreen(); + +void systemServiceSymbolsRegister(SymbolsResolver* sym); + +}; // namespace Emulator::HLE::Libraries::LibUserService \ No newline at end of file