Small fixes and improvements
This commit is contained in:
@@ -59,15 +59,15 @@ void Core::Run(float volumeL, float volumeR) {
|
|||||||
for(; cycles < mem.mmio.vi.cyclesPerHalfline; cycles++, frameCycles++) {
|
for(; cycles < mem.mmio.vi.cyclesPerHalfline; cycles++, frameCycles++) {
|
||||||
u32 taken = cpu->Step();
|
u32 taken = cpu->Step();
|
||||||
taken += regs.PopStalledCycles();
|
taken += regs.PopStalledCycles();
|
||||||
static u32 cpuSteps = 0;
|
|
||||||
cpuSteps += taken;
|
regs.steps += taken;
|
||||||
if(mmio.rsp.spStatus.halt) {
|
if(mmio.rsp.spStatus.halt) {
|
||||||
cpuSteps = 0;
|
regs.steps = 0;
|
||||||
mmio.rsp.steps = 0;
|
mmio.rsp.steps = 0;
|
||||||
} else {
|
} else {
|
||||||
while(cpuSteps > 2) {
|
while(regs.steps > 2) {
|
||||||
mmio.rsp.steps += 2;
|
mmio.rsp.steps += 2;
|
||||||
cpuSteps -= 3;
|
regs.steps -= 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(mmio.rsp.steps > 0) {
|
while(mmio.rsp.steps > 0) {
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ template <> void PI::BusWrite<u32, false>(u32 addr, u32 val) {
|
|||||||
if (val < CART_ISVIEWER_SIZE) {
|
if (val < CART_ISVIEWER_SIZE) {
|
||||||
std::string message(val + 1, 0);
|
std::string message(val + 1, 0);
|
||||||
std::copy(mem.isviewer.begin(), mem.isviewer.begin() + val, message.begin());
|
std::copy(mem.isviewer.begin(), mem.isviewer.begin() + val, message.begin());
|
||||||
Util::print("{}", message);
|
Util::always("{}", message);
|
||||||
} else {
|
} else {
|
||||||
Util::panic("ISViewer buffer size is emulated at {} bytes, but received a flush command for {} bytes!", CART_ISVIEWER_SIZE, val);
|
Util::panic("ISViewer buffer size is emulated at {} bytes, but received a flush command for {} bytes!", CART_ISVIEWER_SIZE, val);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ struct Registers {
|
|||||||
s64 oldPC{}, pc{}, nextPC{};
|
s64 oldPC{}, pc{}, nextPC{};
|
||||||
s64 hi{}, lo{};
|
s64 hi{}, lo{};
|
||||||
bool prevDelaySlot{}, delaySlot{};
|
bool prevDelaySlot{}, delaySlot{};
|
||||||
int steps = 0;
|
u32 steps = 0;
|
||||||
u32 extraCycles = 0;
|
u32 extraCycles = 0;
|
||||||
|
|
||||||
void CpuStall(u32 cycles) {
|
void CpuStall(u32 cycles) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
namespace Util {
|
namespace Util {
|
||||||
enum LogLevel : u8 {
|
enum LogLevel : u8 {
|
||||||
Trace, Debug, Info, Warn, Error
|
Trace, Debug, Info, Warn, Error, Always
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#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...);
|
fmt::print(fmt::emphasis::bold | fg(fmt::color::red), fmt, args...);
|
||||||
} else if constexpr(messageType == Warn) {
|
} else if constexpr(messageType == Warn) {
|
||||||
fmt::print(fg(fmt::color::yellow), fmt, args...);
|
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...);
|
fmt::print(fmt, args...);
|
||||||
} else if constexpr(messageType == Debug) {
|
} else if constexpr(messageType == Debug) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
@@ -76,6 +76,11 @@ constexpr void trace(const std::string& fmt, Args... args) {
|
|||||||
print<Trace>("[TRACE] " + fmt + "\n", 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>
|
template <typename ...Args>
|
||||||
constexpr void panic_trace(const std::string& fmt, Args... args) {
|
constexpr void panic_trace(const std::string& fmt, Args... args) {
|
||||||
#if !defined(NDEBUG) && !defined(_WIN32)
|
#if !defined(NDEBUG) && !defined(_WIN32)
|
||||||
|
|||||||
Reference in New Issue
Block a user