···
14
+
#define ID_TOGGLE_CONSOLE 1003
#define ID_TUNING_DIAL 2001
···
70
+
// Global console state
71
+
int g_consoleVisible = 0;
72
+
HWND g_consoleWindow = NULL;
RadioState g_radio = {14.230f, 0.8f, 0, 0, 0, 0}; // Increase default volume to 0.8
AudioState g_audio = {0};
···
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow) {
107
-
// Allocate console for debugging
109
-
freopen("CONOUT$", "w", stdout);
110
-
freopen("CONOUT$", "w", stderr);
111
-
printf("Shortwave Radio Debug Console\n");
112
-
printf("=============================\n");
112
+
// Don't allocate console by default - will be toggled via menu
const char* CLASS_NAME = "ShortwaveRadio";
···
HMENU hRadioMenu = CreatePopupMenu();
153
+
AppendMenu(hRadioMenu, MF_STRING, ID_TOGGLE_CONSOLE, "&Debug Console");
154
+
AppendMenu(hRadioMenu, MF_SEPARATOR, 0, NULL);
AppendMenu(hRadioMenu, MF_STRING, ID_ABOUT, "&About");
AppendMenu(hRadioMenu, MF_SEPARATOR, 0, NULL);
AppendMenu(hRadioMenu, MF_STRING, ID_EXIT, "E&xit");
···
178
+
// Cleanup console if it exists
179
+
if (g_consoleWindow) {
···
switch (LOWORD(wParam)) {
394
+
case ID_TOGGLE_CONSOLE: {
395
+
if (g_consoleVisible) {
397
+
if (g_consoleWindow) {
398
+
ShowWindow(g_consoleWindow, SW_HIDE);
400
+
g_consoleVisible = 0;
403
+
if (!g_consoleWindow) {
404
+
// First time - allocate console
406
+
freopen("CONOUT$", "w", stdout);
407
+
freopen("CONOUT$", "w", stderr);
408
+
g_consoleWindow = GetConsoleWindow();
409
+
printf("Shortwave Radio Debug Console\n");
410
+
printf("=============================\n");
412
+
// Console exists, just show it
413
+
ShowWindow(g_consoleWindow, SW_SHOW);
415
+
g_consoleVisible = 1;
const char* aboutText = "Shortwave Radio Tuner\n\n"