mirror of
https://github.com/libretro/Mu.git
synced 2026-04-29 09:48:32 +00:00
Allow frontend to define its own debug print handler
Also remove unneeded EMU_DEBUG checks.
This commit is contained in:
@@ -31,7 +31,8 @@ macx {
|
||||
}
|
||||
|
||||
CONFIG(debug, debug|release){
|
||||
DEFINES += FRONTEND_DEBUG EMU_DEBUG EMU_OPCODE_LEVEL_DEBUG EMU_LOG_REGISTER_ACCESS_UNKNOWN EMU_LOG_APIS
|
||||
DEFINES += FRONTEND_DEBUG EMU_DEBUG EMU_LOG_REGISTER_ACCESS_ALL
|
||||
# EMU_OPCODE_LEVEL_DEBUG EMU_LOG_APIS EMU_LOG_REGISTER_ACCESS_UNKNOWN
|
||||
}
|
||||
|
||||
QMAKE_CFLAGS += -std=c99
|
||||
|
||||
@@ -61,7 +61,7 @@ uint32_t setFileBuffer(QString filePath, uint8_t* data, size_t size){
|
||||
}
|
||||
|
||||
bool validFilePath(QString path){
|
||||
#ifdef Q_OS_WIN
|
||||
#if defined(Q_OS_WIN)
|
||||
if(path.length() < 3 || !path[0].isLetter() || path[1] != ':' || (path[2] != '/' && path[2] != '\\'))
|
||||
return false;
|
||||
#else
|
||||
|
||||
@@ -61,6 +61,7 @@ static inline bool allSdCardCallbacksPresent(){
|
||||
static bool invalidBehaviorAbort;
|
||||
static char disassemblyBuffer[LOGGED_OPCODES][100];//store the opcode and program counter for the last 10 opcodes
|
||||
|
||||
|
||||
#if defined(EMU_LOG_APIS)
|
||||
const char* lookupTrap(uint16_t trap);
|
||||
#endif
|
||||
@@ -154,24 +155,14 @@ static void invalidBehaviorCheck(){
|
||||
}
|
||||
|
||||
#if defined(EMU_LOG_APIS)
|
||||
/*
|
||||
static uint32_t trapDumpWait = 300;
|
||||
static bool trapsNotDumped = true;
|
||||
|
||||
if(trapsNotDumped && trapDumpWait == 0){
|
||||
debugLog("Trap dispatch controller is at:0x%08X, table addr:0x%08X\n", programCounter, m68k_read_memory_32(0x00000122));
|
||||
for(uint32_t count = 0xA000; count < 0xA475; count++)
|
||||
printTrapInfo(count);
|
||||
trapsNotDumped = false;
|
||||
}
|
||||
*/
|
||||
|
||||
if(instruction == 0x4E4F){
|
||||
//Trap F/api call
|
||||
uint16_t trap = m68k_read_memory_16(lastProgramCounter + 2);
|
||||
if(!spammingTrap(trap)){
|
||||
debugLog("Trap F API:%s, API number:0x%04X, PC:0x%08X\n", lookupTrap(trap), trap, lastProgramCounter);
|
||||
}
|
||||
|
||||
//custom debug operations
|
||||
switch(trap){
|
||||
case 0xA09A://sysTrapSysTimerWrite
|
||||
printTrapInfo(trap);
|
||||
@@ -180,7 +171,6 @@ static void invalidBehaviorCheck(){
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//trapDumpWait--;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -21,7 +21,14 @@ extern "C" {
|
||||
|
||||
//debug
|
||||
#if defined(EMU_DEBUG)
|
||||
#if defined(EMU_CUSTOM_DEBUG_LOG_HANDLER)
|
||||
extern uint32_t frontendDebugStringSize;
|
||||
extern char* frontendDebugString;
|
||||
void frontendHandleDebugPrint();
|
||||
#define debugLog(...) {snprintf(frontendDebugString, frontendDebugStringSize, __VA_ARGS__);frontendHandleDebugPrint();}
|
||||
#else
|
||||
#define debugLog(...) printf(__VA_ARGS__)
|
||||
#endif
|
||||
#else
|
||||
#define debugLog(...)
|
||||
#endif
|
||||
|
||||
@@ -54,6 +54,17 @@ void refreshInputState(){
|
||||
if(!(registerArrayRead8(PFSEL) & 0x02) && penIrqPin == (bool)(icr & 0x0080))
|
||||
setIprIsrBit(INT_IRQ5);
|
||||
|
||||
/*
|
||||
//IRQ set as pin function and triggered, the pen IRQ triggers when going low to high or high to low
|
||||
if(!(registerArrayRead8(PFSEL) & 0x02) && (penIrqPin == (bool)(icr & 0x0080)) != (bool)(edgeTriggeredInterruptLastValue & INT_IRQ5))
|
||||
setIprIsrBit(INT_IRQ5);
|
||||
|
||||
if(penIrqPin == (bool)(icr & 0x0080))
|
||||
edgeTriggeredInterruptLastValue |= INT_IRQ5;
|
||||
else
|
||||
edgeTriggeredInterruptLastValue &= ~INT_IRQ5;
|
||||
*/
|
||||
|
||||
checkPortDInterrupts();//this calls checkInterrupts() so it doesnt need to be called above
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
/* If ON, CPU will call the instruction hook callback before every
|
||||
* instruction.
|
||||
*/
|
||||
#ifdef EMU_OPCODE_LEVEL_DEBUG
|
||||
#if defined(EMU_DEBUG) && defined(EMU_OPCODE_LEVEL_DEBUG)
|
||||
#define M68K_INSTRUCTION_HOOK OPT_ON
|
||||
#else
|
||||
#define M68K_INSTRUCTION_HOOK OPT_OFF
|
||||
|
||||
@@ -132,11 +132,10 @@ unsigned int m68k_read_memory_8(unsigned int address){
|
||||
case CHIP_NONE:
|
||||
setBusErrorTimeOut();
|
||||
return 0x00;
|
||||
#ifdef EMU_DEBUG
|
||||
|
||||
default:
|
||||
debugLog("Unknown bank type:%d\n", bankType[START_BANK(address)]);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0x00;
|
||||
@@ -168,11 +167,10 @@ unsigned int m68k_read_memory_16(unsigned int address){
|
||||
case CHIP_NONE:
|
||||
setBusErrorTimeOut();
|
||||
return 0x0000;
|
||||
#ifdef EMU_DEBUG
|
||||
|
||||
default:
|
||||
debugLog("Unknown bank type:%d\n", bankType[START_BANK(address)]);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0x0000;
|
||||
@@ -204,11 +202,10 @@ unsigned int m68k_read_memory_32(unsigned int address){
|
||||
case CHIP_NONE:
|
||||
setBusErrorTimeOut();
|
||||
return 0x00000000;
|
||||
#ifdef EMU_DEBUG
|
||||
|
||||
default:
|
||||
debugLog("Unknown bank type:%d\n", bankType[START_BANK(address)]);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0x00000000;
|
||||
@@ -244,11 +241,10 @@ void m68k_write_memory_8(unsigned int address, unsigned int value){
|
||||
case CHIP_NONE:
|
||||
setBusErrorTimeOut();
|
||||
break;
|
||||
#ifdef EMU_DEBUG
|
||||
|
||||
default:
|
||||
debugLog("Unknown bank type:%d\n", bankType[START_BANK(address)]);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -283,11 +279,10 @@ void m68k_write_memory_16(unsigned int address, unsigned int value){
|
||||
case CHIP_NONE:
|
||||
setBusErrorTimeOut();
|
||||
break;
|
||||
#ifdef EMU_DEBUG
|
||||
|
||||
default:
|
||||
debugLog("Unknown bank type:%d\n", bankType[START_BANK(address)]);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -322,11 +317,10 @@ void m68k_write_memory_32(unsigned int address, unsigned int value){
|
||||
case CHIP_NONE:
|
||||
setBusErrorTimeOut();
|
||||
break;
|
||||
#ifdef EMU_DEBUG
|
||||
|
||||
default:
|
||||
debugLog("Unknown bank type:%d\n", bankType[START_BANK(address)]);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user