|
|
@ -64,13 +64,12 @@ using namespace DFHack;
|
|
|
|
|
|
|
|
|
|
|
|
namespace DFHack
|
|
|
|
namespace DFHack
|
|
|
|
{
|
|
|
|
{
|
|
|
|
class Private
|
|
|
|
class Private : public std::stringbuf
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
Private()
|
|
|
|
Private() : basic_stringbuf<char>::basic_stringbuf()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dfout_C = 0;
|
|
|
|
dfout_C = 0;
|
|
|
|
stream_o = 0;
|
|
|
|
|
|
|
|
rawmode = 0;
|
|
|
|
rawmode = 0;
|
|
|
|
console_in = 0;
|
|
|
|
console_in = 0;
|
|
|
|
console_out = 0;
|
|
|
|
console_out = 0;
|
|
|
@ -79,6 +78,19 @@ namespace DFHack
|
|
|
|
state = con_unclaimed;
|
|
|
|
state = con_unclaimed;
|
|
|
|
raw_cursor = 0;
|
|
|
|
raw_cursor = 0;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
virtual ~Private()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//sync();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
int sync()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
print (str().c_str());
|
|
|
|
|
|
|
|
// Clear the string buffer
|
|
|
|
|
|
|
|
str(std::string());
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
/// Print a formatted string, like printf
|
|
|
|
/// Print a formatted string, like printf
|
|
|
|
int print(const char * format, ...)
|
|
|
|
int print(const char * format, ...)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -371,7 +383,6 @@ namespace DFHack
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FILE * dfout_C;
|
|
|
|
FILE * dfout_C;
|
|
|
|
duthomhas::stdiobuf * stream_o;
|
|
|
|
|
|
|
|
int rawmode; /* for atexit() function to check if restore is needed*/
|
|
|
|
int rawmode; /* for atexit() function to check if restore is needed*/
|
|
|
|
std::deque <std::string> history;
|
|
|
|
std::deque <std::string> history;
|
|
|
|
|
|
|
|
|
|
|
@ -415,6 +426,7 @@ bool Console::init(void)
|
|
|
|
// Allocate a console!
|
|
|
|
// Allocate a console!
|
|
|
|
AllocConsole();
|
|
|
|
AllocConsole();
|
|
|
|
d->ConsoleWindow = GetConsoleWindow();
|
|
|
|
d->ConsoleWindow = GetConsoleWindow();
|
|
|
|
|
|
|
|
d->wlock = SDL_CreateMutex();
|
|
|
|
HMENU hm = GetSystemMenu(d->ConsoleWindow,false);
|
|
|
|
HMENU hm = GetSystemMenu(d->ConsoleWindow,false);
|
|
|
|
DeleteMenu(hm, SC_CLOSE, MF_BYCOMMAND);
|
|
|
|
DeleteMenu(hm, SC_CLOSE, MF_BYCOMMAND);
|
|
|
|
|
|
|
|
|
|
|
@ -444,10 +456,8 @@ bool Console::init(void)
|
|
|
|
std::ios::sync_with_stdio();
|
|
|
|
std::ios::sync_with_stdio();
|
|
|
|
|
|
|
|
|
|
|
|
// make our own weird streams so our IO isn't redirected
|
|
|
|
// make our own weird streams so our IO isn't redirected
|
|
|
|
d->stream_o = new duthomhas::stdiobuf(d->dfout_C);
|
|
|
|
rdbuf(d);
|
|
|
|
rdbuf(d->stream_o);
|
|
|
|
|
|
|
|
std::cin.tie(this);
|
|
|
|
std::cin.tie(this);
|
|
|
|
d->wlock = SDL_CreateMutex();
|
|
|
|
|
|
|
|
clear();
|
|
|
|
clear();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|