implemented sceKernelGetProcessTime

This commit is contained in:
georgemoralis 2023-10-30 08:48:52 +02:00
parent f732704b83
commit 758ef332f2
7 changed files with 46 additions and 2 deletions

View File

@ -98,7 +98,7 @@ add_executable(shadps4
src/Core/PS4/HLE/Kernel/cpu_management.cpp src/Core/PS4/HLE/Kernel/cpu_management.cpp
src/Core/PS4/HLE/Kernel/cpu_management.h 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) find_package(OpenGL REQUIRED)
target_link_libraries(shadps4 PUBLIC fmt mincore spdlog IMGUI SDL3-shared ${OPENGL_LIBRARY} vulkan-1 spirv-tools-opt spirv-tools) target_link_libraries(shadps4 PUBLIC fmt mincore spdlog IMGUI SDL3-shared ${OPENGL_LIBRARY} vulkan-1 spirv-tools-opt spirv-tools)

View File

@ -2,6 +2,7 @@
#include <Core/PS4/HLE/LibKernel.h> #include <Core/PS4/HLE/LibKernel.h>
#include <debug.h> #include <debug.h>
#include <Core/hle/libraries/libkernel/time_management.h>
namespace HLE::Graphics::Objects { namespace HLE::Graphics::Objects {
@ -120,7 +121,7 @@ bool FlipQueue::flip(u32 micros) {
m_done_cond.notify_one(); m_done_cond.notify_one();
request->cfg->m_flip_status.count++; 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.tsc = HLE::Libs::LibKernel::sceKernelReadTsc();
request->cfg->m_flip_status.submitTsc = request->submit_tsc; request->cfg->m_flip_status.submitTsc = request->submit_tsc;
request->cfg->m_flip_status.flipArg = request->flip_arg; request->cfg->m_flip_status.flipArg = request->flip_arg;

View File

@ -0,0 +1,14 @@
#include "time_management.h"
#include <Core/PS4/HLE/Libs.h>
#include "emuTimer.h"
namespace Core::Libraries {
u64 sceKernelGetProcessTime() {
return static_cast<u64>(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

View File

@ -0,0 +1,10 @@
#pragma once
#include "types.h"
#include "Core/PS4/Loader/SymbolsResolver.h"
namespace Core::Libraries {
u64 sceKernelGetProcessTime();
void timeSymbolsRegister(SymbolsResolver* sym);
}

10
src/emuTimer.cpp Normal file
View File

@ -0,0 +1,10 @@
#include "Lib/Timer.h"
namespace Emulator::emuTimer {
static Lib::Timer timer;
void start() { timer.Start(); }
double getTimeMsec() { return timer.GetTimeMsec(); }
}

7
src/emuTimer.h Normal file
View File

@ -0,0 +1,7 @@
#pragma once
namespace Emulator::emuTimer {
void start();
double getTimeMsec();
} // namespace Emulator::emuTimer

View File

@ -13,6 +13,7 @@
#include "Core/PS4/Linker.h" #include "Core/PS4/Linker.h"
#include "Emulator/Util\singleton.h" #include "Emulator/Util\singleton.h"
#include "discord.h" #include "discord.h"
#include "emuTimer.h"
// Main code // Main code
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
@ -26,6 +27,7 @@ int main(int argc, char* argv[]) {
auto height = Config::getScreenHeight(); auto height = Config::getScreenHeight();
Emu::emuInit(width, height); Emu::emuInit(width, height);
HLE::Libs::Graphics::VideoOut::videoOutInit(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 const char* const path = argv[1]; // argument 1 is the path of self file to boot