mirror of
https://github.com/n64dev/cen64.git
synced 2024-06-22 14:02:41 -04:00
Show Windows console when isviewer is present.
This commit is contained in:
parent
95f8dd1f02
commit
87ed667c38
|
@ -307,6 +307,7 @@ set(OS_POSIX_SOURCES
|
||||||
|
|
||||||
set(OS_WINAPI_SOURCES
|
set(OS_WINAPI_SOURCES
|
||||||
${PROJECT_SOURCE_DIR}/os/winapi/alloc.c
|
${PROJECT_SOURCE_DIR}/os/winapi/alloc.c
|
||||||
|
${PROJECT_SOURCE_DIR}/os/winapi/console.c
|
||||||
${PROJECT_SOURCE_DIR}/os/winapi/cpuid.c
|
${PROJECT_SOURCE_DIR}/os/winapi/cpuid.c
|
||||||
${PROJECT_SOURCE_DIR}/os/winapi/gl_config.c
|
${PROJECT_SOURCE_DIR}/os/winapi/gl_config.c
|
||||||
${PROJECT_SOURCE_DIR}/os/winapi/gl_window.c
|
${PROJECT_SOURCE_DIR}/os/winapi/gl_window.c
|
||||||
|
|
6
cen64.c
6
cen64.c
|
@ -21,6 +21,9 @@
|
||||||
#include "os/common/rom_file.h"
|
#include "os/common/rom_file.h"
|
||||||
#include "os/common/save_file.h"
|
#include "os/common/save_file.h"
|
||||||
#include "os/cpuid.h"
|
#include "os/cpuid.h"
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include "os/winapi/console.h"
|
||||||
|
#endif
|
||||||
#include "pi/is_viewer.h"
|
#include "pi/is_viewer.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -177,6 +180,9 @@ int cen64_main(int argc, const char **argv) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
} else {
|
} else {
|
||||||
is_in = &is;
|
is_in = &is;
|
||||||
|
#ifdef _WIN32
|
||||||
|
show_console();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
31
os/winapi/console.c
Normal file
31
os/winapi/console.c
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
//
|
||||||
|
// os/winapi/console.c
|
||||||
|
//
|
||||||
|
// Functions for manipulating the console.
|
||||||
|
//
|
||||||
|
// CEN64: Cycle-Accurate Nintendo 64 Emulator.
|
||||||
|
// Copyright (C) 2015, Tyler J. Stachecki.
|
||||||
|
//
|
||||||
|
// This file is subject to the terms and conditions defined in
|
||||||
|
// 'LICENSE', which is part of this source code package.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "cen64.h"
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
// "Hides" the console window (after waiting for input).
|
||||||
|
void hide_console(void) {
|
||||||
|
printf("\n");
|
||||||
|
system("PAUSE");
|
||||||
|
|
||||||
|
FreeConsole();
|
||||||
|
}
|
||||||
|
|
||||||
|
// "Unhides" the console window.
|
||||||
|
void show_console(void) {
|
||||||
|
if (AttachConsole(ATTACH_PARENT_PROCESS) == 0)
|
||||||
|
AllocConsole();
|
||||||
|
|
||||||
|
freopen("CONOUT$", "wb", stdout);
|
||||||
|
freopen("CONOUT$", "wb", stderr);
|
||||||
|
}
|
16
os/winapi/console.h
Normal file
16
os/winapi/console.h
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
//
|
||||||
|
// os/winapi/console.h: Console manipulation functions
|
||||||
|
//
|
||||||
|
// CEN64: Cycle-Accurate Nintendo 64 Emulator.
|
||||||
|
// Copyright (C) 2015, Tyler J. Stachecki.
|
||||||
|
//
|
||||||
|
// This file is subject to the terms and conditions defined in
|
||||||
|
// 'LICENSE', which is part of this source code package.
|
||||||
|
//
|
||||||
|
#ifndef CEN64_OS_WINAPI_CONSOLE
|
||||||
|
#define CEN64_OS_WINAPI_CONSOLE
|
||||||
|
|
||||||
|
void show_console(void);
|
||||||
|
void hide_console(void);
|
||||||
|
|
||||||
|
#endif
|
|
@ -30,20 +30,3 @@ int WINAPI WinMain(HINSTANCE hInstance,
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
// "Hides" the console window (after waiting for input).
|
|
||||||
void hide_console(void) {
|
|
||||||
printf("\n");
|
|
||||||
system("PAUSE");
|
|
||||||
|
|
||||||
FreeConsole();
|
|
||||||
}
|
|
||||||
|
|
||||||
// "Unhides" the console window.
|
|
||||||
void show_console(void) {
|
|
||||||
AllocConsole();
|
|
||||||
|
|
||||||
freopen("CONOUT$", "wb", stdout);
|
|
||||||
freopen("CONOUT$", "wb", stderr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue