Skip to content

Commit

Permalink
add option to disable console debug window on debug builds. update wh…
Browse files Browse the repository at this point in the history
…atsnew
  • Loading branch information
dinkc64 committed May 20, 2019
1 parent ff54ab6 commit 3cc3198
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 19 deletions.
3 changes: 3 additions & 0 deletions src/burner/win32/app.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,9 @@ BEGIN
MENUITEM "Low", MENU_PRIORITY_LOW
END
MENUITEM "Enable high resolution system timer", MENU_HIGHRESTIMER
#ifdef FBNEO_DEBUG
MENUITEM "Show Debug console (requires restart)", MENU_DEBUGCONSOLE
#endif
MENUITEM SEPARATOR
#ifdef BUILD_A68K
MENUITEM "Use assembly MC68000 core (this session only)", MENU_ASSEMBLYCORE
Expand Down
3 changes: 3 additions & 0 deletions src/burner/win32/burner_win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ INT32 Dx9Core_Init();
// ---------------------------------------------------------------------------

// main.cpp
#if defined (FBNEO_DEBUG)
extern bool bDisableDebugConsole; // Disable debug console?
#endif
extern HINSTANCE hAppInst; // Application Instance
extern HANDLE hMainThread; // Handle to the main thread
extern long int nMainThreadID; // ID of the main thread
Expand Down
9 changes: 9 additions & 0 deletions src/burner/win32/cona.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ int ConfigAppLoad()

VAR(nSplashTime);

#if defined (FBNEO_DEBUG)
VAR(bDisableDebugConsole);
#endif

VAR(bDrvSaveAll);
VAR(nAppThreadPriority);
VAR(bAlwaysProcessKeyboardInput);
Expand Down Expand Up @@ -536,6 +540,11 @@ int ConfigAppSave()
_ftprintf(h, _T("\n// Minimum length of time to display the splash screen (in milliseconds)\n"));
VAR(nSplashTime);

#if defined (FBNEO_DEBUG)
_ftprintf(h, _T("\n// Disable the text-debug console (hint: needed for debugging with gdb!)\n"));
VAR(bDisableDebugConsole);
#endif

_ftprintf(h, _T("\n// If non-zero, load and save all ram (the state)\n"));
VAR(bDrvSaveAll);
_ftprintf(h, _T("\n// The thread priority for the application. Do *NOT* edit this manually\n"));
Expand Down
35 changes: 23 additions & 12 deletions src/burner/win32/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#endif
#endif

#if defined (FBNEO_DEBUG)
bool bDisableDebugConsole = true;
#endif

#include "version.h"

HINSTANCE hAppInst = NULL; // Application Instance
Expand Down Expand Up @@ -279,7 +283,7 @@ static int __cdecl AppDebugPrintf(int nStatus, TCHAR* pszFormat, ...)
fflush(DebugLog);
}

if (!DebugLog || bEchoLog) {
if (!bDisableDebugConsole && (!DebugLog || bEchoLog)) {
_vsntprintf(szConsoleBuffer, 1024, pszFormat, vaFormat);

if (nStatus != nPrevConsoleStatus) {
Expand Down Expand Up @@ -332,7 +336,9 @@ int dprintf(TCHAR* pszFormat, ...)
if (DebugLog) {
_ftprintf(DebugLog, _T("</div><div class=\"ui\">"));
}
SetConsoleTextAttribute(DebugBuffer, FOREGROUND_INTENSITY);
if (!bDisableDebugConsole) {
SetConsoleTextAttribute(DebugBuffer, FOREGROUND_INTENSITY);
}
nPrevConsoleStatus = PRINT_UI;
}

Expand All @@ -342,7 +348,9 @@ int dprintf(TCHAR* pszFormat, ...)
}

tcharstrreplace(szConsoleBuffer, _T(SEPERATOR_1), _T(" * "));
WriteConsole(DebugBuffer, szConsoleBuffer, _tcslen(szConsoleBuffer), NULL, NULL);
if (!bDisableDebugConsole) {
WriteConsole(DebugBuffer, szConsoleBuffer, _tcslen(szConsoleBuffer), NULL, NULL);
}
va_end(vaFormat);
#else
(void)pszFormat;
Expand All @@ -362,12 +370,14 @@ void CloseDebugLog()
DebugLog = NULL;
}

if (DebugBuffer) {
CloseHandle(DebugBuffer);
DebugBuffer = NULL;
}
if (!bDisableDebugConsole) {
if (DebugBuffer) {
CloseHandle(DebugBuffer);
DebugBuffer = NULL;
}

FreeConsole();
FreeConsole();
}
#endif
}

Expand Down Expand Up @@ -426,6 +436,7 @@ int OpenDebugLog()
}
#endif

if (!bDisableDebugConsole)
{
// Initialise the debug console

Expand Down Expand Up @@ -607,10 +618,6 @@ static int AppInit()
_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF); //
#endif

#if defined (FBNEO_DEBUG)
OpenDebugLog();
#endif

// Create a handle to the main thread of execution
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hMainThread, 0, false, DUPLICATE_SAME_ACCESS);

Expand All @@ -620,6 +627,10 @@ static int AppInit()
// Load config for the application
ConfigAppLoad();

#if defined (FBNEO_DEBUG)
OpenDebugLog();
#endif

FBALocaliseInit(szLocalisationTemplate);
BurnerDoGameListLocalisation();

Expand Down
3 changes: 3 additions & 0 deletions src/burner/win32/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,9 @@ void MenuUpdate()
CheckMenuItem(hMenu, MENU_MODELESS, bModelessMenu ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu, MENU_NOCHANGENUMLOCK, bNoChangeNumLock ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu, MENU_HIGHRESTIMER, bEnableHighResTimer ? MF_CHECKED : MF_UNCHECKED);
#if defined (FBNEO_DEBUG)
CheckMenuItem(hMenu, MENU_DEBUGCONSOLE, bDisableDebugConsole ? MF_UNCHECKED : MF_CHECKED);
#endif
CheckMenuItem(hMenu, MENU_CREATEDIRS, bAlwaysCreateSupportFolders ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu, MENU_AUTOLOADGAMELIST, bAutoLoadGameList ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu, MENU_SAVEHISCORES, EnableHiscores ? MF_CHECKED : MF_UNCHECKED);
Expand Down
1 change: 1 addition & 0 deletions src/burner/win32/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@
#define MENU_SNAPFACT 10317
#define MENU_SAVESNAP 10318
#define MENU_HIGHRESTIMER 10319
#define MENU_DEBUGCONSOLE 10320
#define MENU_ASSOCIATE 10330
#define MENU_DISASSOCIATE 10331
#define MENU_SAVEGAMEINPUTNOW 10332
Expand Down
6 changes: 6 additions & 0 deletions src/burner/win32/scrn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1983,6 +1983,12 @@ static void OnCommand(HWND /*hDlg*/, int id, HWND /*hwndCtl*/, UINT codeNotify)
EnableHighResolutionTiming(); // use new setting.
break;

#if defined (FBNEO_DEBUG)
case MENU_DEBUGCONSOLE:
bDisableDebugConsole = !bDisableDebugConsole;
break;
#endif

case MENU_CREATEDIRS:
bAlwaysCreateSupportFolders = !bAlwaysCreateSupportFolders;
break;
Expand Down
14 changes: 7 additions & 7 deletions whatsnew.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html lang="en">

<head>
<title>FB Alpha - What's New</title>
<title>FinalBurn Neo - What's New</title>
<meta charset="UTF-8" />
<style>
body {
Expand Down Expand Up @@ -111,9 +111,8 @@

<body>
<div class="outer">
<h2>FB Alpha - What's New</h2>
<p><a href="https://www.fbalpha.com">https://www.fbalpha.com</a><br />
<a href="http://neosource.1emu.net/forums">http://neosource.1emu.net/forums</a></p>
<h2>FinalBurn Neo - What's New</h2>
<p><a href="http://neo-source.com">http://neo-source.com - official site and forums</a></p>

<h3>v0.2.97.44</h3>
<!-- fixes and features -->
Expand Down Expand Up @@ -350,9 +349,9 @@ <h4>Fixes and new features</h4>
<li>Update LibPNG [Kev]</li>
<li>Fix race condition with make -j# on MingW build [superctr]</li>
<li>Added accurate QSound emulation [superctr]</li>
<li> []</li>
<li> []</li>
<li> []</li>
<li>Fixed regional/DIP issue with Lethal Enforcers [dink]</li>
<li>Rewrote the Galaga HW driver &amp; added Xevious [CupcakeFan]</li>
<li>Added option to show/hide Debug Console in Debug builds (Misc -> Options -> Show Debug Console) [dink]</li>
<li> []</li>
</ul>
<!-- new drivers -->
Expand Down Expand Up @@ -471,6 +470,7 @@ <h4>New additions / updates to existing drivers</h4>
<li>Add Streets of Rage 3 - The Bare Knuckle 3 Project (Hack, July 1, 2017) [Ryvius86]</li>
<li>Add Bare Knuckle 3 Project (World) (Hack by Gsaurus, April 25, 2019) [Ryvius86]</li>
<li>Add Bare Knuckle III (English Hack By Twilight Translations) [Ryuvius86]</li>
<li>Add Xevious to the Galaga driver [CupcakeFan]</li>
</ul>
<!-- clones and updated romsets in drivers -->
<h4>Clones and updated romsets in existing drivers</h4>
Expand Down

0 comments on commit 3cc3198

Please sign in to comment.