OSDN Git Service

[Qt][OSD][KEYBOARD] Apply upstream's update.
[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_use_auto_key(void);
47         bool get_dont_keeep_key_pressed(void);
48         bool get_one_board_micro_computer(void);
49         bool get_use_screen_rotate(void);
50         bool get_use_movie_player(void);
51         bool get_use_video_capture(void);
52         void vm_key_down(int code, bool flag);
53         void vm_key_up(int code);
54         void vm_reset(void);
55         void update_buttons(bool press_flag, bool release_flag);
56         int get_screen_width(void);
57         int get_screen_height(void);
58         int get_vm_buttons_code(int num);
59
60         void set_features(void);
61         void set_device_name(int id, char *name);
62         MOVIE_LOADER *movie_loader;
63
64         QTcpSocket2 *tcp_socket[SOCKET_MAX];
65         QUdpSocket2 *udp_socket[SOCKET_MAX];
66
67 #ifdef USE_SOUND_FILES
68         SOUND_LOADER *tail_sound_file;
69         SOUND_LOADER *sound_file_obj[USE_SOUND_FILES];
70         
71         void init_sound_files();
72         void release_sound_files();
73 #endif
74 public:
75         OSD(USING_FLAGS *p, CSP_Logger *logger);
76         ~OSD();
77         void initialize(int rate, int samples);
78         void release();
79         void power_off();
80
81         // Wrapper
82         // Locker
83         void lock_vm(void);
84         void unlock_vm(void);
85         void force_unlock_vm(void);
86         bool is_vm_locked(void);
87
88         // Screen
89         void set_draw_thread(DrawThreadClass *handler);
90         void initialize_screen();
91         void release_screen();
92         int get_window_mode_width(int mode);
93         int get_window_mode_height(int mode);
94         QString get_vm_config_name(void);
95         double vm_frame_rate(void);
96
97         // Movie/Video
98         void get_video_buffer();
99         void initialize_video();
100         void release_video();
101         bool open_movie_file(const _TCHAR* file_path);
102         void close_movie_file();
103         uint32_t get_cur_movie_frame();
104         int get_movie_sound_rate();
105
106         // Misc
107         void reset_vm_node(void);
108         const _TCHAR *get_lib_common_vm_version();
109         const _TCHAR *get_lib_common_vm_git_version();
110         const _TCHAR *get_lib_osd_version();
111         
112         // Socket
113         void initialize_socket();
114         void release_socket();
115         void notify_socket_connected(int ch);
116         void notify_socket_disconnected(int ch);
117         void update_socket();
118         bool initialize_socket_tcp(int ch);
119         bool initialize_socket_udp(int ch);
120         bool connect_socket(int ch, uint32_t ipaddr, int port);
121         void disconnect_socket(int ch);
122         bool listen_socket(int ch);
123         void send_socket_data_tcp(int ch);
124         void send_socket_data_udp(int ch, uint32_t ipaddr, int port);
125         void send_socket_data(int ch);
126         void recv_socket_data(int ch);
127         int get_socket(int ch);
128
129         // Sound
130 #ifdef USE_SOUND_FILES
131         void load_sound_file(int id, const _TCHAR *name, int16_t **data, int *dst_size);
132         void free_sound_file(int id, int16_t **data);
133 #endif
134         void debug_log(int level, int domain_num, char *strbuf);
135 public slots:
136         void do_decode_movie(int frames);
137         void do_run_movie_audio_callback(uint8_t *data, long len);
138         void do_notify_socket_connected(int ch);
139         void do_notify_socket_disconnected(int ch);
140
141 };
142 QT_END_NAMESPACE
143
144 #endif