OSDN Git Service

[Qt][DEBUGGER] Temporally revert changes around debugger, will use src/debugger.cpp .
[csp-qt/common_source_project-fm7.git] / source / src / qt / osd_console.cpp
1 /*
2         Skelton for retropc emulator
3
4         Author : Takeda.Toshiya
5         Date   : 2015.11.20-
6
7         [ win32 console ]
8 */
9
10 #include "emu.h"
11 #include "fifo.h"
12 #include "emu_thread.h"
13 #include "emu.h"
14 #include <QString>
15
16 extern EMU *emu;
17 //BOOL WINAPI ctrl_c_handler(DWORD type)
18 //{
19 //      return TRUE;
20 //}
21
22 void OSD::do_write_inputdata(QString s)
23 {
24         int i;
25         emit sig_console_input_string(s);
26 }
27
28 void OSD::do_set_input_string(QString s)
29 {
30         memset(console_string, 0x00, sizeof(console_string));
31         strncpy(console_string, s.toLocal8Bit().constData(), sizeof(console_string) - 1);
32 }
33
34 _TCHAR *OSD::console_input_string(void)
35 {
36         if(strlen(console_string) <= 0) return NULL;
37         return console_string;
38 }
39
40 void OSD::clear_console_input_string(void)
41 {
42         memset(console_string, 0x00, sizeof(console_string));
43 }
44
45 void OSD::open_console(_TCHAR* title)
46 {
47         if(osd_console_opened) return;
48         memset(console_string, 0x00, sizeof(console_string));
49         osd_console_opened = true;
50         
51 }
52
53 void OSD::close_console()
54 {
55         memset(console_string, 0x00, sizeof(console_string));
56         osd_console_opened = false;
57 }
58
59 unsigned int OSD::get_console_code_page()
60 {
61         //return GetConsoleCP();
62         return 0;
63 }
64
65 bool OSD::is_console_active()
66 {
67         return  osd_console_opened;
68 }
69
70 void OSD::set_console_text_attribute(unsigned short attr)
71 {
72         //SetConsoleTextAttribute(hStdOut, attr);
73 }
74
75 void OSD::write_console(_TCHAR* buffer, unsigned int length)
76 {
77         QString s = QString::fromLocal8Bit(buffer, length);
78         emit sig_put_string_debugger(s);
79 }
80
81 int OSD::read_console_input(_TCHAR* buffer)
82 {
83         int i;
84         int count = 0;
85         return count;
86 }
87
88 void OSD::do_close_debugger_console()
89 {
90         emit sig_debugger_finished(); // It's dirty...
91 }
92
93 void OSD::do_close_debugger_thread()
94 {
95 #if defined(USE_DEBUGGER)
96         //if(emu->debugger_thread_param.request_terminate == true) {
97                 emit sig_debugger_finished();
98                 //}
99         //emu->close_debugger();
100 #endif  
101 }