Rename a couple of types to avoid clashes with a Mac header, sigh.

This commit is contained in:
Henrik Rydgård 2023-04-28 13:38:16 +02:00
parent f87bfda8d3
commit ab37b8dea9
3 changed files with 28 additions and 28 deletions

View File

@ -68,7 +68,7 @@ static double lastKeepAwake = 0.0;
static GraphicsContext *graphicsContext;
static bool powerSaving = false;
static ExceptionInfo g_exceptionInfo;
static MIPSExceptionInfo g_exceptionInfo;
void Core_SetGraphicsContext(GraphicsContext *ctx) {
graphicsContext = ctx;
@ -403,11 +403,11 @@ SteppingReason Core_GetSteppingReason() {
return r;
}
const char *ExceptionTypeAsString(ExceptionType type) {
const char *ExceptionTypeAsString(MIPSExceptionType type) {
switch (type) {
case ExceptionType::MEMORY: return "Invalid Memory Access";
case ExceptionType::BREAK: return "Break";
case ExceptionType::BAD_EXEC_ADDR: return "Bad Execution Address";
case MIPSExceptionType::MEMORY: return "Invalid Memory Access";
case MIPSExceptionType::BREAK: return "Break";
case MIPSExceptionType::BAD_EXEC_ADDR: return "Bad Execution Address";
default: return "N/A";
}
}
@ -449,9 +449,9 @@ void Core_MemoryException(u32 address, u32 accessSize, u32 pc, MemoryExceptionTy
std::string stackTrace = FormatStackTrace(stackFrames);
WARN_LOG(MEMMAP, "\n%s", stackTrace.c_str());
ExceptionInfo &e = g_exceptionInfo;
MIPSExceptionInfo &e = g_exceptionInfo;
e = {};
e.type = ExceptionType::MEMORY;
e.type = MIPSExceptionType::MEMORY;
e.info.clear();
e.memory_type = type;
e.address = address;
@ -477,9 +477,9 @@ void Core_MemoryExceptionInfo(u32 address, u32 accessSize, u32 pc, MemoryExcepti
std::string stackTrace = FormatStackTrace(stackFrames);
WARN_LOG(MEMMAP, "\n%s", stackTrace.c_str());
ExceptionInfo &e = g_exceptionInfo;
MIPSExceptionInfo &e = g_exceptionInfo;
e = {};
e.type = ExceptionType::MEMORY;
e.type = MIPSExceptionType::MEMORY;
e.info = additionalInfo;
e.memory_type = type;
e.address = address;
@ -495,9 +495,9 @@ void Core_ExecException(u32 address, u32 pc, ExecExceptionType type) {
const char *desc = ExecExceptionTypeAsString(type);
WARN_LOG(MEMMAP, "%s: Invalid exec address %08x PC %08x LR %08x", desc, address, pc, currentMIPS->r[MIPS_REG_RA]);
ExceptionInfo &e = g_exceptionInfo;
MIPSExceptionInfo &e = g_exceptionInfo;
e = {};
e.type = ExceptionType::BAD_EXEC_ADDR;
e.type = MIPSExceptionType::BAD_EXEC_ADDR;
e.info.clear();
e.exec_type = type;
e.address = address;
@ -511,9 +511,9 @@ void Core_ExecException(u32 address, u32 pc, ExecExceptionType type) {
void Core_Break(u32 pc) {
ERROR_LOG(CPU, "BREAK!");
ExceptionInfo &e = g_exceptionInfo;
MIPSExceptionInfo &e = g_exceptionInfo;
e = {};
e.type = ExceptionType::BREAK;
e.type = MIPSExceptionType::BREAK;
e.info.clear();
e.pc = pc;
@ -523,9 +523,9 @@ void Core_Break(u32 pc) {
}
void Core_ResetException() {
g_exceptionInfo.type = ExceptionType::NONE;
g_exceptionInfo.type = MIPSExceptionType::NONE;
}
const ExceptionInfo &Core_GetExceptionInfo() {
const MIPSExceptionInfo &Core_GetExceptionInfo() {
return g_exceptionInfo;
}

View File

@ -112,15 +112,15 @@ void Core_Break(u32 pc);
// Call when loading save states, etc.
void Core_ResetException();
enum class ExceptionType {
enum class MIPSExceptionType {
NONE,
MEMORY,
BREAK,
BAD_EXEC_ADDR,
};
struct ExceptionInfo {
ExceptionType type;
struct MIPSExceptionInfo {
MIPSExceptionType type;
std::string info;
std::string stackTrace; // if available.
@ -135,8 +135,8 @@ struct ExceptionInfo {
ExecExceptionType exec_type;
};
const ExceptionInfo &Core_GetExceptionInfo();
const MIPSExceptionInfo &Core_GetExceptionInfo();
const char *ExceptionTypeAsString(ExceptionType type);
const char *ExceptionTypeAsString(MIPSExceptionType type);
const char *MemoryExceptionTypeAsString(MemoryExceptionType type);
const char *ExecExceptionTypeAsString(ExecExceptionType type);

View File

@ -1173,7 +1173,7 @@ static const char *CPUCoreAsString(int core) {
}
static void DrawCrashDump(UIContext *ctx, const Path &gamePath) {
const ExceptionInfo &info = Core_GetExceptionInfo();
const MIPSExceptionInfo &info = Core_GetExceptionInfo();
auto sy = GetI18NCategory(I18NCat::SYSTEM);
FontID ubuntu24("UBUNTU24");
@ -1239,7 +1239,7 @@ static void DrawCrashDump(UIContext *ctx, const Path &gamePath) {
ctx->Draw()->DrawTextShadow(ubuntu24, statbuf, x, y, 0xFFFFFFFF);
y += 160;
if (info.type == ExceptionType::MEMORY) {
if (info.type == MIPSExceptionType::MEMORY) {
snprintf(statbuf, sizeof(statbuf), R"(
Access: %s at %08x (sz: %d)
PC: %08x
@ -1251,7 +1251,7 @@ PC: %08x
info.info.c_str());
ctx->Draw()->DrawTextShadow(ubuntu24, statbuf, x, y, 0xFFFFFFFF);
y += 180;
} else if (info.type == ExceptionType::BAD_EXEC_ADDR) {
} else if (info.type == MIPSExceptionType::BAD_EXEC_ADDR) {
snprintf(statbuf, sizeof(statbuf), R"(
Destination: %s to %08x
PC: %08x
@ -1262,7 +1262,7 @@ RA: %08x)",
info.ra);
ctx->Draw()->DrawTextShadow(ubuntu24, statbuf, x, y, 0xFFFFFFFF);
y += 180;
} else if (info.type == ExceptionType::BREAK) {
} else if (info.type == MIPSExceptionType::BREAK) {
snprintf(statbuf, sizeof(statbuf), R"(
BREAK
PC: %08x
@ -1495,8 +1495,8 @@ void EmuScreen::render() {
case CORE_RUNTIME_ERROR:
{
// If there's an exception, display information.
const ExceptionInfo &info = Core_GetExceptionInfo();
if (info.type != ExceptionType::NONE) {
const MIPSExceptionInfo &info = Core_GetExceptionInfo();
if (info.type != MIPSExceptionType::NONE) {
// Clear to blue background screen
bool dangerousSettings = !Reporting::IsSupported();
uint32_t color = dangerousSettings ? 0xFF900050 : 0xFF900000;
@ -1627,8 +1627,8 @@ void EmuScreen::renderUI() {
#endif
if (coreState == CORE_RUNTIME_ERROR || coreState == CORE_STEPPING) {
const ExceptionInfo &info = Core_GetExceptionInfo();
if (info.type != ExceptionType::NONE) {
const MIPSExceptionInfo &info = Core_GetExceptionInfo();
if (info.type != MIPSExceptionType::NONE) {
DrawCrashDump(ctx, gamePath_);
} else {
// We're somehow in ERROR or STEPPING without a crash dump. This case is what lead