mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-10-02 11:58:01 +03:00
Fix debugger on Windows
This commit is contained in:
@@ -10,6 +10,10 @@
|
||||
#include "nact.h"
|
||||
#include "ags.h"
|
||||
#include "debugger/debugger.h"
|
||||
#ifdef _WIN32
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#endif
|
||||
using Json = nlohmann::json;
|
||||
|
||||
namespace debugger {
|
||||
@@ -58,6 +62,10 @@ int read_command_thread(void*) {
|
||||
class DapFrontend : public Frontend {
|
||||
public:
|
||||
DapFrontend(Debugger* backend, const DebugInfo& symbols) : Frontend(backend, symbols) {
|
||||
#ifdef _WIN32
|
||||
_setmode(_fileno(stdin), _O_BINARY);
|
||||
_setmode(_fileno(stdout), _O_BINARY);
|
||||
#endif
|
||||
SDL_CreateThread(read_command_thread, "Debugger", NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,13 +41,13 @@ void init_menu(bool mouse_move_enabled, const Config& config)
|
||||
|
||||
void init_console(int sys_ver)
|
||||
{
|
||||
#if defined(_DEBUG_CONSOLE)
|
||||
AllocConsole();
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
char title[] = "SYSTEM1 NACT Tracer";
|
||||
freopen("CONOUT$", "w", stderr);
|
||||
freopen("CONIN$", "r", stdin);
|
||||
char title[] = "SYSTEM1 Debug Console";
|
||||
title[6] = '0' + sys_ver;
|
||||
SetConsoleTitle(title);
|
||||
#endif
|
||||
}
|
||||
|
||||
void save_screenshot(AGS* ags)
|
||||
@@ -138,7 +138,10 @@ void NACT::text_dialog()
|
||||
void NACT::platform_initialize()
|
||||
{
|
||||
init_menu(mouse_move_enabled, config);
|
||||
init_console(game_id.sys_ver);
|
||||
#ifndef _DEBUG_CONSOLE
|
||||
if (config.debugger_mode == DebuggerMode::CLI)
|
||||
#endif
|
||||
init_console(game_id.sys_ver);
|
||||
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user