mirror of https://github.com/decompals/wibo.git
Improve logging
This commit is contained in:
parent
e0017ac105
commit
81e85504de
2
common.h
2
common.h
|
@ -6,12 +6,12 @@
|
|||
#include <assert.h>
|
||||
|
||||
#define WIN_FUNC __attribute__((stdcall))
|
||||
// inline void DEBUG_LOG(const char *fmt, ...) {}
|
||||
#define DEBUG_LOG(...) wibo::debug_log(__VA_ARGS__)
|
||||
|
||||
namespace wibo {
|
||||
extern uint32_t lastError;
|
||||
extern char *commandLine;
|
||||
extern bool debugEnabled;
|
||||
|
||||
void debug_log(const char *fmt, ...);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace kernel32 {
|
|||
void *lpStartupInfo,
|
||||
void *lpProcessInformation
|
||||
) {
|
||||
DEBUG_LOG("CreateProcessA %s \"%s\" %p %p %d 0x%x %p %s %p %p\n",
|
||||
printf("CreateProcessA %s \"%s\" %p %p %d 0x%x %p %s %p %p\n",
|
||||
lpApplicationName,
|
||||
lpCommandLine,
|
||||
lpProcessAttributes,
|
||||
|
|
10
main.cpp
10
main.cpp
|
@ -9,10 +9,12 @@
|
|||
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);
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue