Improve logging

This commit is contained in:
Simon Lindholm
2022-06-29 15:24:58 +02:00
parent e0017ac105
commit 81e85504de
3 changed files with 11 additions and 5 deletions

View File

@@ -9,11 +9,13 @@
uint32_t wibo::lastError = 0;
char *wibo::commandLine;
wibo::Executable *wibo::mainModule = 0;
bool wibo::debugEnabled = false;
void wibo::debug_log(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
vprintf(fmt, args);
if (wibo::debugEnabled)
vprintf(fmt, args);
va_end(args);
}
@@ -24,8 +26,8 @@ static char stubFuncNames[0x100][0x100];
static void stubBase(int index) {
// should go through all the functions imported by mwcceppc.exe
// and create template stubs for them, at least...
DEBUG_LOG("Unhandled function %s (%s)\n", stubFuncNames[index], stubDlls[index]);
exit(0);
printf("Unhandled function %s (%s)\n", stubFuncNames[index], stubDlls[index]);
exit(1);
}
void (*stubFuncs[0x100])(void) = {
@@ -112,6 +114,10 @@ int main(int argc, char **argv) {
return 1;
}
if (getenv("WIBO_DEBUG")) {
wibo::debugEnabled = true;
}
// Create TIB
TIB tib;
tib.tib = &tib;