mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-29 11:06:07 +00:00
reimplemented sceKernelReadTsc in proper package and some abi fixes
This commit is contained in:
parent
61e8919cf1
commit
6f941c277a
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
|
@ -1,21 +1,24 @@
|
|||
#include "time_management.h"
|
||||
|
||||
#include <Core/PS4/HLE/Libs.h>
|
||||
|
||||
#include "Lib/Timer.h"
|
||||
#include "emuTimer.h"
|
||||
|
||||
namespace Core::Libraries::LibKernel {
|
||||
u64 sceKernelGetProcessTime() {
|
||||
u64 PS4_SYSV_ABI sceKernelGetProcessTime() {
|
||||
return static_cast<u64>(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
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue