void PopupDebugWindow() { #ifdef _WIN32_WCE if (debug_window.IsOpen()) debug_window.Popup(); else OpenDebugWindow(); #else HWND debugWindow = GetDebugWindowHandle(); if (debugWindow) SetForegroundWindow(debugWindow); else OpenDebugWindow(); #endif // if/else _WIN32_WCE }
bool OpenDebugLog(const char *path) { PLOG(PL_INFO,"ProtoDebug>OpenDebugLog: debug log is being set to \"%s\"\n",path); #ifdef OPNET // JPH 4/26/06 if ('\0' == *path) return false; #endif // OPNET CloseDebugLog(); FILE* ptr = fopen(path, "w+"); if (ptr) { #if defined(WIN32) && !defined(SIMULATE) FILE* debugLog = DebugLog(); if ((0 != DebugLevel()) && ((debugLog == stdout) || (debugLog == stderr))) CloseDebugWindow(); #endif // WIN32 && !SIMULATE DebugLog(true, ptr); return true; } else { #if defined(WIN32) && !defined(SIMULATE) FILE* debugLog = DebugLog(); if ((0 != DebugLevel()) && (debugLog != stdout) && (debugLog != stderr)) OpenDebugWindow(); #endif // WIN32 && !SIMULATE DebugLog(true, stderr); PLOG(PL_ERROR, "OpenDebugLog: Error opening debug log file: %s\n", path); return false; } } // end OpenLogFile()
SDL_Surface *LoadImage( std::string filename ) { OpenDebugWindow(filename); SDL_Surface* LoadedImage = NULL; SDL_Surface* OptimizedImage = NULL; LoadedImage = IMG_Load( filename.c_str() ); if( LoadedImage != NULL ) { OptimizedImage = SDL_DisplayFormatAlpha( LoadedImage ); SDL_FreeSurface( LoadedImage ); } else { OpenDebugWindow("Failed to load last file"); OpenDebugWindow("Open"); } return OptimizedImage; }
void CloseDebugLog() { FILE* debugLog = DebugLog(); if (debugLog && (debugLog != stderr) && (debugLog != stdout)) { fclose(debugLog); #if defined(WIN32) && !defined(SIMULATE) if (0 != DebugLevel()) OpenDebugWindow(); #endif // WIN32 && !SIMULATE } #ifndef SIMULATE if (debug_pipe.IsOpen()) debug_pipe.Close(); #endif // !SIMULATE DebugLog(true, stderr); } // end CloseDebugLog()
bool SetClips() { SpareStream.str(""); SpareStream << "CursorSheets width is " << CursorSheet->w; OpenDebugWindow(SpareStream.str()); for(int x = 0; x < 16; x++) { CursorClips[x].x = (x * 38); CursorClips[x].y = 0; CursorClips[x].w = 38; CursorClips[x].h = 38; if (x == 15) CursorClips[x].w = 34; } for(int x = 0; x < 8; x++) { EnemyDownClipRect[x].x = (x * 49); EnemyDownClipRect[x].y = 0; EnemyDownClipRect[x].w = 49; EnemyDownClipRect[x].h = 36; } for(int x = 0; x < 9; x++) { IndicatorClips[x].x = (x * 50); IndicatorClips[x].y = 0; IndicatorClips[x].w = 50; IndicatorClips[x].h = 50; } ProjectileClips[0].h = 11; ProjectileClips[0].w = 11; ProjectileClips[0].x = 0; ProjectileClips[0].y = 0; ProjectileClips[1].h = 11; ProjectileClips[1].w = 11; ProjectileClips[1].x = 12; ProjectileClips[1].y = 0; if (CursorClips[2].w == 0) return false; return true; }
void SetDebugLevel(unsigned int level) { unsigned int debugLevel = DebugLevel(); #if defined(WIN32) && !defined(SIMULATE) FILE* debugLog = DebugLog(); if (0 != level) { if (!debugLevel && ((stderr == debugLog) || (stdout == debugLog))) OpenDebugWindow(); } else { if (debugLevel && ((stderr == debugLog) || (debugLog == stdout))) CloseDebugWindow(); } #endif // WIN32 DebugLevel(true, level); // this sets the underlying static "debug_level" state variable if (level != debugLevel) PLOG(PL_INFO,"ProtoDebug>SetDebugLevel: debug level changed from %d to %d\n", debugLevel, level); } // end SetDebugLevel()
bool CheckFiles() { WasItInit = TTF_WasInit(); if (Background == NULL) { OpenDebugWindow("Background failed to load!"); return false; } else if (MenuBackground == NULL) { OpenDebugWindow("MenuBackground failed to load!"); return false; } else if (EightBitLimit == NULL) { OpenDebugWindow("Bens font failed to load!"); return false; } else if (CursorSheet == NULL) { OpenDebugWindow("CursorSheet failed to load!"); return false; } else if (KarmaFuture == NULL) { OpenDebugWindow("KarmaFuture failed to load!"); return false; } else if (EightBitLimitSmall == NULL) { OpenDebugWindow("Bens font small failed to load!"); return false; } else if (PausedScreen == NULL) { OpenDebugWindow("Pause screen failed to load!"); return false; } else if (FrontDed == NULL) { OpenDebugWindow("Frontded failed to load!"); return false; } else if (HighscoresNormal == NULL) { OpenDebugWindow("High Scores Normal failed to load!"); return false; } else if (HighscoresMouseover == NULL) { OpenDebugWindow("High Scores Mouseover failed to load!"); return false; } else if (U1 == NULL) { OpenDebugWindow("U1 failed to load!"); return false; } else if (R1 == NULL) { OpenDebugWindow("R1 failed to load!"); return false; } else if (D1 == NULL) { OpenDebugWindow("D1 failed to load!"); return false; } else if (L1 == NULL) { OpenDebugWindow("L1 failed to load!"); return false; } else if (StartNormal == NULL) { OpenDebugWindow("StartNormal failed to load!"); return false; } else if (StartMouseOver == NULL) { OpenDebugWindow("StartMouseOver failed to load!"); return false; } else if (HighscoresNormal == NULL) { OpenDebugWindow("StartNormal failed to load!"); return false; } else if (HighscoresMouseover == NULL) { OpenDebugWindow("StartMouseOver failed to load!"); return false; } else if (KillsImg == NULL) { OpenDebugWindow("KillsImg failed to load!"); return false; } else if (YouDied == NULL) { OpenDebugWindow("YouDied failed to load!"); return false; } else if (LivesIcon == NULL) { OpenDebugWindow("LivesIcon failed to load!"); return false; } else if (YouAreShit == NULL) { OpenDebugWindow("You'reShit failed to load!"); return false; } else if (Projectile == NULL) { OpenDebugWindow("Projectile failed to load!"); return false; } else if (BigGrid == NULL) { OpenDebugWindow("BigGrid failed to load!"); return false; } else if (SmallGrid == NULL) { OpenDebugWindow("SmallGrid failed to load!"); return false; } else if (SniperFlipped == NULL) { OpenDebugWindow("Flipped sniper failed to load!"); return false; } else if (Sniper == NULL) { OpenDebugWindow("Sniper failed to load!"); return false; } else if (EnemyDownClips == NULL) { OpenDebugWindow("EnemyDownClips failed to load!"); return false; } else if (EnemyUpClips == NULL) { OpenDebugWindow("EnemyUpClips failed to load!"); return false; } else if (EnemuIndicator == NULL) { OpenDebugWindow("Enemy indicator failed to load!"); return false; } else if (HighscoresBackground == NULL) { OpenDebugWindow("Highscores Background indicator failed to load!"); return false; } else if (Background2 == NULL) { OpenDebugWindow("Background2 failed to load!"); return false; } OpenDebugWindow("All files loaded successfully"); return true; }
INT_PTR CALLBACK DlgFunction( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) { char szFuncName[128]; HWND hFuncName; ADDR addr; static DWORD HelpArray[]= { ID_FUNCTION_FUNCNAME, IDH_ADDR, 0, 0 }; Unreferenced( lParam ); switch (message) { case WM_INITDIALOG: /* ** Initialize the edit item for the address field */ Dbg((hFuncName = GetDlgItem(hDlg, ID_FUNCTION_FUNCNAME))!=NULL); Dbg(SendMessage(hFuncName, EM_LIMITTEXT, sizeof(szFuncName)-1, 0L)); /* ** Initialise entry field with current selection */ *szFuncName = '\0'; if (Views[curView].Doc > -1) { if ((hwndActiveEdit != NULL) && (Docs[Views[curView].Doc].docType == DOC_WIN)) { BOOL lookAround = TRUE; GetCurrentText(curView, &lookAround, (LPSTR)szFuncName, min(MAX_USER_LINE, sizeof(szFuncName)-1), NULL, NULL); } } /* ** Send the text and select it */ SendMessage(hFuncName, WM_SETTEXT, 0, (LPARAM)(LPSTR)szFuncName); #ifdef WIN32 SendMessage(hFuncName, EM_SETSEL, 0, (LPARAM) -1); #else SendMessage(hFuncName, EM_SETSEL, 0, MAKELONG(0, 0x7FFF)); #endif SetFocus(hFuncName); return (FALSE); case WM_HELP: WinHelp((HWND)((LPHELPINFO) lParam)->hItemHandle, "windbg.hlp", HELP_WM_HELP, (DWORD_PTR)(LPVOID) HelpArray ); return TRUE; case WM_CONTEXTMENU: WinHelp ((HWND) wParam, "windbg.hlp", HELP_CONTEXTMENU, (DWORD_PTR)(LPVOID) HelpArray ); return TRUE; case WM_COMMAND: switch (wParam) { /* ** Get the address string and attempt to change to the ** desired address */ case IDOK : Dbg((hFuncName = GetDlgItem(hDlg, ID_FUNCTION_FUNCNAME))!=NULL); GetDlgItemText(hDlg, ID_FUNCTION_FUNCNAME, (LPSTR)szFuncName, sizeof(szFuncName)); if (!LocateFunction(szFuncName, &addr)) { ErrorBox2(hDlg, MB_TASKMODAL, ERR_Function_Locate); SendMessage(hFuncName, EM_SETSEL, 0, (DWORD) -1); SetFocus(hFuncName); } else { if (!MoveEditorToAddr(&addr, TRUE)) { if (disasmView == -1) { OpenDebugWindow(DISASM_WIN, TRUE); // User activated } } if (disasmView != -1) { OpenDebugWindow(DISASM_WIN, TRUE); // User activated ViewDisasm(&addr, disasmForce); } EndDialog(hDlg, TRUE); } return TRUE; case IDCANCEL : EndDialog(hDlg, FALSE); return (TRUE); } break; } return (FALSE); } /* DlgFunction() */