From 9fb97add3f63e77cea66a92667d4df05e840e19b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 26 Jul 2024 14:22:31 +0200 Subject: [PATCH] Bugfixes --- Common/LogReporting.h | 2 +- Common/TimeUtil.cpp | 12 ++++++------ Core/HLE/proAdhoc.h | 1 + Core/HLE/sceMt19937.cpp | 3 +++ Core/MIPS/IR/IRInterpreter.cpp | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Common/LogReporting.h b/Common/LogReporting.h index f4b0ea7903..bccc750ec2 100644 --- a/Common/LogReporting.h +++ b/Common/LogReporting.h @@ -62,4 +62,4 @@ void ReportMessage(const char *message, ...); // The same, but with a preformatted version (message is still the key.) void ReportMessageFormatted(const char *message, const char *formatted); -} +} // namespace Reporting diff --git a/Common/TimeUtil.cpp b/Common/TimeUtil.cpp index 10f29e061a..5c8bf6dbd8 100644 --- a/Common/TimeUtil.cpp +++ b/Common/TimeUtil.cpp @@ -160,14 +160,14 @@ void yield() { #endif } -TimeSpan::TimeSpan() { +Instant::Instant() { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); nativeStart_ = ts.tv_sec; nsecs_ = ts.tv_nsec; } -int64_t TimeSpan::ElapsedNanos() const { +int64_t Instant::ElapsedNanos() const { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); int64_t secs = ts.tv_sec - nativeStart_; @@ -179,7 +179,7 @@ int64_t TimeSpan::ElapsedNanos() const { return secs * 1000000000ULL + nsecs; } -double TimeSpan::ElapsedSeconds() const { +double Instant::ElapsedSeconds() const { return (double)ElapsedNanos() * (1.0 / nanos); } @@ -223,14 +223,14 @@ double time_now_unix_utc() { return time_now_raw(); } -TimeSpan::TimeSpan() { +Instant::Instant() { struct timeval tv; gettimeofday(&tv, nullptr); nativeStart_ = tv.tv_sec; nsecs_ = tv.tv_usec; } -int64_t TimeSpan::ElapsedNanos() const { +int64_t Instant::ElapsedNanos() const { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); @@ -243,7 +243,7 @@ int64_t TimeSpan::ElapsedNanos() const { return secs * 1000000000 + usecs * 1000; } -double TimeSpan::ElapsedSeconds() const { +double Instant::ElapsedSeconds() const { return (double)ElapsedNanos() * (1.0 / 1000000000.0); } diff --git a/Core/HLE/proAdhoc.h b/Core/HLE/proAdhoc.h index 170e64e5a6..8d9f451b15 100644 --- a/Core/HLE/proAdhoc.h +++ b/Core/HLE/proAdhoc.h @@ -40,6 +40,7 @@ #include #include +#include #include "Common/Net/Resolve.h" #include "Common/Serialize/Serializer.h" diff --git a/Core/HLE/sceMt19937.cpp b/Core/HLE/sceMt19937.cpp index 511b00c9da..e29996fc37 100644 --- a/Core/HLE/sceMt19937.cpp +++ b/Core/HLE/sceMt19937.cpp @@ -15,7 +15,10 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include // for some reason required for the 'new'. + #include "Common/Data/Random/Rng.h" +#include "Common/CommonTypes.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceMt19937.h" diff --git a/Core/MIPS/IR/IRInterpreter.cpp b/Core/MIPS/IR/IRInterpreter.cpp index 6b9221dee6..5af7b98dd6 100644 --- a/Core/MIPS/IR/IRInterpreter.cpp +++ b/Core/MIPS/IR/IRInterpreter.cpp @@ -200,7 +200,7 @@ u32 IRInterpret(MIPSState *mips, const IRInst *inst) { mips->r[inst->dest] = mips->r[inst->src1] ^ inst->constant; break; case IROp::Neg: - mips->r[inst->dest] = -(s32)mips->r[inst->src1]; + mips->r[inst->dest] = (u32)(-(s32)mips->r[inst->src1]); break; case IROp::Not: mips->r[inst->dest] = ~mips->r[inst->src1];