OSDN Git Service

3e336ca9b643b7ab1539a9390eb784694f4dfb49
[csp-qt/common_source_project-fm7.git] / source / src / qt / osd.h
1 /*
2         Skelton for retropc emulator
3
4         Author : K.Ohta <whatisthis.sowhat _at_ gmail.com>
5         Date   : 2015.11.30-
6
7         [ Qt dependent ]
8 */
9
10 #ifndef _QT_OSD_H_
11 #define _QT_OSD_H_
12
13 #include "osd_base.h"
14 #include "gui/qt_input.h" // Key code table (VK_foo).
15
16 class GLDrawClass;
17 class EmuThreadClass;
18 class DrawThreadClass;
19 class Ui_MainWindow;
20 class EMU;
21 class VM;
22 class FIFO;
23 class USING_FLAGS;
24 class CSP_KeyTables;
25 class MOVIE_LOADER;
26 class SOUND_LOADER;
27 class QTcpSocket2;
28 class QUdpSocket2;
29
30 QT_BEGIN_NAMESPACE      
31 class CSP_Logger;
32 class OSD : public OSD_BASE
33 {
34         Q_OBJECT
35 private:
36         void set_features_machine(void);
37         void set_features_cpu(void);
38         void set_features_vm(void);
39         void set_features_misc(void);
40         void set_features_debug(void);
41 protected:
42         void vm_draw_screen(void);
43         Sint16* create_sound(int *extra_frames);
44         bool get_use_socket(void);
45         bool get_support_variable_timing(void);
46         bool get_notify_key_down(void);
47         bool get_notify_key_down_lr_shift(void);
48         bool get_notify_key_down_lr_control(void);
49         bool get_notify_key_down_lr_menu(void);
50         bool get_use_shift_numpad_key(void);
51         bool get_use_auto_key(void);
52         bool get_dont_keeep_key_pressed(void);
53         bool get_one_board_micro_computer(void);
54         bool get_use_screen_rotate(void);
55         bool get_use_movie_player(void);
56         bool get_use_video_capture(void);
57         void vm_key_down(int code, bool flag);
58         void vm_key_up(int code);
59         void vm_reset(void);
60         void update_buttons(bool press_flag, bool release_flag);
61         int get_screen_width(void);
62         int get_screen_height(void);
63         int get_vm_buttons_code(int num);
64
65         void set_features(void);
66         void set_device_name(int id, char *name);
67         MOVIE_LOADER *movie_loader;
68
69         QTcpSocket2 *tcp_socket[SOCKET_MAX];
70         QUdpSocket2 *udp_socket[SOCKET_MAX];
71
72 #ifdef USE_SOUND_FILES
73         SOUND_LOADER *tail_sound_file;
74         SOUND_LOADER *sound_file_obj[USE_SOUND_FILES];
75         
76         void init_sound_files();
77         void release_sound_files();
78 #endif
79 public:
80         OSD(USING_FLAGS *p, CSP_Logger *logger);
81         ~OSD();
82         void initialize(int rate, int samples);
83         void release();
84         void power_off();
85
86         // Wrapper
87         // Locker
88         void lock_vm(void);
89         void unlock_vm(void);
90         void force_unlock_vm(void);
91         bool is_vm_locked(void);
92
93         // Screen
94         void set_draw_thread(DrawThreadClass *handler);
95         void initialize_screen();
96         void release_screen();
97         int get_window_mode_width(int mode);
98         int get_window_mode_height(int mode);
99         QString get_vm_config_name(void);
100         double vm_frame_rate(void);
101
102         // Movie/Video
103         void get_video_buffer();
104         void initialize_video();
105         void release_video();
106         bool open_movie_file(const _TCHAR* file_path);
107         void close_movie_file();
108         uint32_t get_cur_movie_frame();
109         int get_movie_sound_rate();
110
111         // Misc
112         void reset_vm_node(void);
113
114         // Socket
115         void initialize_socket();
116         void release_socket();
117         void notify_socket_connected(int ch);
118         void notify_socket_disconnected(int ch);
119         void update_socket();
120         bool initialize_socket_tcp(int ch);
121         bool initialize_socket_udp(int ch);
122         bool connect_socket(int ch, uint32_t ipaddr, int port);
123         void disconnect_socket(int ch);
124         bool listen_socket(int ch);
125         void send_socket_data_tcp(int ch);
126         void send_socket_data_udp(int ch, uint32_t ipaddr, int port);
127         void send_socket_data(int ch);
128         void recv_socket_data(int ch);
129         int get_socket(int ch);
130
131         // Sound
132 #ifdef USE_SOUND_FILES
133         void load_sound_file(int id, const _TCHAR *name, int16_t **data, int *dst_size);
134         void free_sound_file(int id, int16_t **data);
135 #endif
136         void debug_log(int level, int domain_num, char *strbuf);
137 public slots:
138         void do_decode_movie(int frames);
139         void do_run_movie_audio_callback(uint8_t *data, long len);
140         void do_notify_socket_connected(int ch);
141         void do_notify_socket_disconnected(int ch);
142
143 };
144 QT_END_NAMESPACE
145
146 #endif