mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-03-04 09:27:15 +00:00
Add frontend_driver_attach_console/frontend_driver_detach_console
This commit is contained in:
parent
940fbcd4fa
commit
2a139b7d72
@ -80,5 +80,7 @@ frontend_ctx_driver_t frontend_ctx_bsd = {
|
||||
frontend_bsd_get_signal_handler_state,
|
||||
frontend_bsd_set_signal_handler_state,
|
||||
frontend_bsd_destroy_signal_handler_state,
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
"bsd",
|
||||
};
|
||||
|
@ -422,5 +422,7 @@ frontend_ctx_driver_t frontend_ctx_ctr = {
|
||||
NULL, /* get_signal_handler_state */
|
||||
NULL, /* set_signal_handler_state */
|
||||
NULL, /* destroy_signal_handler_state */
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
"ctr",
|
||||
};
|
||||
|
@ -714,5 +714,7 @@ frontend_ctx_driver_t frontend_ctx_darwin = {
|
||||
NULL, /* get_sighandler_state */
|
||||
NULL, /* set_sighandler_state */
|
||||
NULL, /* destroy_signal_handler_state */
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
"darwin",
|
||||
};
|
||||
|
@ -206,5 +206,7 @@ frontend_ctx_driver_t frontend_ctx_emscripten = {
|
||||
NULL, /* get_signal_handler_state */
|
||||
NULL, /* set_signal_handler_state */
|
||||
NULL, /* destroy_signal_handler_state */
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
"emscripten"
|
||||
};
|
||||
|
@ -536,5 +536,7 @@ frontend_ctx_driver_t frontend_ctx_gx = {
|
||||
NULL, /* get_sighandler_state */
|
||||
NULL, /* set_sighandler_state */
|
||||
NULL, /* destroy_signal_handler_state */
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
"gx",
|
||||
};
|
||||
|
@ -2089,6 +2089,8 @@ frontend_ctx_driver_t frontend_ctx_linux = {
|
||||
frontend_linux_get_signal_handler_state,
|
||||
frontend_linux_set_signal_handler_state,
|
||||
frontend_linux_destroy_signal_handler_state,
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
#ifdef ANDROID
|
||||
"android"
|
||||
#else
|
||||
|
@ -40,5 +40,7 @@ frontend_ctx_driver_t frontend_ctx_null = {
|
||||
NULL, /* get_sighandler_state */
|
||||
NULL, /* set_sighandler_state */
|
||||
NULL, /* destroy_sighandler_state */
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
"null",
|
||||
};
|
||||
|
@ -568,5 +568,7 @@ frontend_ctx_driver_t frontend_ctx_ps3 = {
|
||||
NULL, /* get_sighandler_state */
|
||||
NULL, /* set_sighandler_state */
|
||||
NULL, /* destroy_sighandler_state */
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
"ps3",
|
||||
};
|
||||
|
@ -506,6 +506,8 @@ frontend_ctx_driver_t frontend_ctx_psp = {
|
||||
NULL, /* get_sighandler_state */
|
||||
NULL, /* set_sighandler_state */
|
||||
NULL, /* destroy_sighandler_state */
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
#ifdef VITA
|
||||
"vita",
|
||||
#else
|
||||
|
@ -90,5 +90,7 @@ frontend_ctx_driver_t frontend_ctx_qnx = {
|
||||
NULL, /* get_sighandler_state */
|
||||
NULL, /* set_sighandler_state */
|
||||
NULL, /* destroy_sighandler_state */
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
"qnx",
|
||||
};
|
||||
|
@ -320,6 +320,25 @@ static uint64_t frontend_win32_get_mem_used(void)
|
||||
return ((frontend_win32_get_mem_total() - mem_info.ullAvailPhys));
|
||||
}
|
||||
|
||||
static void frontend_win32_attach_console(void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
AllocConsole();
|
||||
AttachConsole( GetCurrentProcessId()) ;
|
||||
freopen( "CON", "w", stdout );
|
||||
freopen( "CON", "w", stderr );
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_win32_detach_console(void)
|
||||
{
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
HWND wnd = GetConsoleWindow();
|
||||
FreeConsole();
|
||||
PostMessage(wnd, WM_CLOSE, 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
frontend_ctx_driver_t frontend_ctx_win32 = {
|
||||
frontend_win32_environment_get,
|
||||
frontend_win32_init,
|
||||
@ -342,5 +361,7 @@ frontend_ctx_driver_t frontend_ctx_win32 = {
|
||||
NULL, /* get_sighandler_state */
|
||||
NULL, /* set_sighandler_state */
|
||||
NULL, /* destroy_sighandler_state */
|
||||
frontend_win32_attach_console, /* attach_console */
|
||||
frontend_win32_detach_console, /* detach_console */
|
||||
"win32"
|
||||
};
|
||||
|
@ -1413,5 +1413,7 @@ frontend_ctx_driver_t frontend_ctx_xdk = {
|
||||
NULL, /* get_sighandler_state */
|
||||
NULL, /* set_sighandler_state */
|
||||
NULL, /* destroy_sighandler_state */
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
"xdk",
|
||||
};
|
||||
|
@ -89,5 +89,7 @@ frontend_ctx_driver_t frontend_ctx_qnx = {
|
||||
NULL, /* get_sighandler_state */
|
||||
NULL, /* set_sighandler_state */
|
||||
NULL, /* destroy_sighandler_state */
|
||||
NULL, /* attach_console */
|
||||
NULL, /* detach_console */
|
||||
"xenon",
|
||||
};
|
||||
|
@ -361,6 +361,22 @@ void frontend_driver_set_signal_handler_state(int value)
|
||||
frontend->set_signal_handler_state(value);
|
||||
}
|
||||
|
||||
void frontend_driver_attach_console(void)
|
||||
{
|
||||
frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
||||
if (!frontend || !frontend->attach_console)
|
||||
return;
|
||||
frontend->attach_console();
|
||||
}
|
||||
|
||||
void frontend_driver_detach_console(void)
|
||||
{
|
||||
frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
||||
if (!frontend || !frontend->detach_console)
|
||||
return;
|
||||
frontend->detach_console();
|
||||
}
|
||||
|
||||
void frontend_driver_destroy_signal_handler_state(void)
|
||||
{
|
||||
frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
||||
|
@ -82,6 +82,8 @@ typedef struct frontend_ctx_driver
|
||||
int (*get_signal_handler_state)(void);
|
||||
void (*set_signal_handler_state)(int value);
|
||||
void (*destroy_signal_handler_state)(void);
|
||||
void (*attach_console)(void);
|
||||
void (*detach_console)(void);
|
||||
|
||||
const char *ident;
|
||||
|
||||
@ -169,6 +171,10 @@ void frontend_driver_set_signal_handler_state(int value);
|
||||
|
||||
void frontend_driver_destroy_signal_handler_state(void);
|
||||
|
||||
void frontend_driver_attach_console(void);
|
||||
|
||||
void frontend_driver_detach_console(void);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -766,9 +766,7 @@ static void retroarch_parse_input(int argc, char *argv[])
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
FreeConsole();
|
||||
#endif
|
||||
frontend_driver_detach_console();
|
||||
break;
|
||||
|
||||
case RA_OPT_MENU:
|
||||
|
17
verbosity.c
17
verbosity.c
@ -43,6 +43,10 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#include "frontend/frontend_driver.h"
|
||||
#endif
|
||||
|
||||
#include "file_path_special.h"
|
||||
#include "verbosity.h"
|
||||
|
||||
@ -54,21 +58,16 @@ static bool main_verbosity = false;
|
||||
void verbosity_enable(void)
|
||||
{
|
||||
main_verbosity = true;
|
||||
#ifdef _WIN32
|
||||
AllocConsole();
|
||||
AttachConsole( GetCurrentProcessId()) ;
|
||||
freopen( "CON", "w", stdout );
|
||||
freopen( "CON", "w", stderr );
|
||||
#ifdef RARCH_INTERNAL
|
||||
frontend_driver_attach_console();
|
||||
#endif
|
||||
}
|
||||
|
||||
void verbosity_disable(void)
|
||||
{
|
||||
main_verbosity = false;
|
||||
#ifdef _WIN32
|
||||
HWND wnd = GetConsoleWindow();
|
||||
FreeConsole();
|
||||
PostMessage(wnd, WM_CLOSE, 0, 0);
|
||||
#ifdef RARCH_INTERNAL
|
||||
frontend_driver_detach_console();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user