Small fixes and improvements

This commit is contained in:
SimoneN64
2024-05-26 22:11:14 +02:00
parent 2efb4c02d3
commit f32957c93f
4 changed files with 14 additions and 9 deletions

View File

@@ -59,15 +59,15 @@ void Core::Run(float volumeL, float volumeR) {
for(; cycles < mem.mmio.vi.cyclesPerHalfline; cycles++, frameCycles++) {
u32 taken = cpu->Step();
taken += regs.PopStalledCycles();
static u32 cpuSteps = 0;
cpuSteps += taken;
regs.steps += taken;
if(mmio.rsp.spStatus.halt) {
cpuSteps = 0;
regs.steps = 0;
mmio.rsp.steps = 0;
} else {
while(cpuSteps > 2) {
while(regs.steps > 2) {
mmio.rsp.steps += 2;
cpuSteps -= 3;
regs.steps -= 3;
}
while(mmio.rsp.steps > 0) {

View File

@@ -271,7 +271,7 @@ template <> void PI::BusWrite<u32, false>(u32 addr, u32 val) {
if (val < CART_ISVIEWER_SIZE) {
std::string message(val + 1, 0);
std::copy(mem.isviewer.begin(), mem.isviewer.begin() + val, message.begin());
Util::print("{}", message);
Util::always("{}", message);
} else {
Util::panic("ISViewer buffer size is emulated at {} bytes, but received a flush command for {} bytes!", CART_ISVIEWER_SIZE, val);
}

View File

@@ -26,7 +26,7 @@ struct Registers {
s64 oldPC{}, pc{}, nextPC{};
s64 hi{}, lo{};
bool prevDelaySlot{}, delaySlot{};
int steps = 0;
u32 steps = 0;
u32 extraCycles = 0;
void CpuStall(u32 cycles) {

View File

@@ -9,7 +9,7 @@
namespace Util {
enum LogLevel : u8 {
Trace, Debug, Info, Warn, Error
Trace, Debug, Info, Warn, Error, Always
};
#ifndef NDEBUG
@@ -26,7 +26,7 @@ constexpr void print(const std::string& fmt, Args... args) {
fmt::print(fmt::emphasis::bold | fg(fmt::color::red), fmt, args...);
} else if constexpr(messageType == Warn) {
fmt::print(fg(fmt::color::yellow), fmt, args...);
} else if constexpr(messageType == Info || messageType == Trace) {
} else if constexpr(messageType == Info || messageType == Trace || messageType == Always) {
fmt::print(fmt, args...);
} else if constexpr(messageType == Debug) {
#ifndef NDEBUG
@@ -76,6 +76,11 @@ constexpr void trace(const std::string& fmt, Args... args) {
print<Trace>("[TRACE] " + fmt + "\n", args...);
}
template <typename ...Args>
constexpr void always(const std::string& fmt, Args... args) {
print<Always>(fmt + "\n", args...);
}
template <typename ...Args>
constexpr void panic_trace(const std::string& fmt, Args... args) {
#if !defined(NDEBUG) && !defined(_WIN32)