2 Skelton for retropc emulator
4 Author : Takeda.Toshiya
7 [ win32 emulation i/f ]
16 // output fdc debug log
17 // #define _FDC_DEBUG_LOG
18 // output i/o debug log
19 // #define _IO_DEBUG_LOG
24 # include "simd_types.h"
39 #elif defined(_USE_SDL)
48 // OS dependent header files should be included in each osd.h
49 // Please do not include them in emu.h
53 #elif defined(OSD_SDL)
55 #elif defined(OSD_WIN32)
56 #include "win32/osd.h"
60 #define MAX_D88_BANKS 64
65 #define SOCKET_BUFFER_MAX 0x100000
80 bool request_terminate;
88 class DrawThreadClass;
98 _TCHAR app_path[_MAX_PATH];
99 // ----------------------------------------
101 // ----------------------------------------
102 void initialize_sound();
103 void release_sound();
104 void update_sound(int* extra_frames);
106 // ----------------------------------------
108 // ----------------------------------------
110 _TCHAR path[_MAX_PATH];
117 media_status_t cart_status[MAX_CART];
120 media_status_t floppy_disk_status[MAX_FD];
123 media_status_t quick_disk_status[MAX_QD];
126 media_status_t tape_status;
129 #ifdef USE_LASER_DISC
130 media_status_t laser_disc_status;
135 bool is_tcp[SOCKET_MAX];
136 #if !defined(_USE_QT)
137 struct sockaddr_in udpaddr[SOCKET_MAX];
139 int socket_delay[SOCKET_MAX];
140 char recv_buffer[SOCKET_MAX][SOCKET_BUFFER_MAX];
141 int recv_r_ptr[SOCKET_MAX], recv_w_ptr[SOCKET_MAX];
143 void initialize_media();
145 void restore_media();
147 void clear_media_status(media_status_t *status)
149 status->path[0] = _T('\0');
150 status->wait_count = 0;
154 // ----------------------------------------
156 // ----------------------------------------
158 void save_state_tmp(const _TCHAR* file_path);
159 bool load_state_tmp(const _TCHAR* file_path);
163 // ----------------------------------------
165 // ----------------------------------------
167 EMU(class Ui_MainWindow *hwnd, GLDrawClass *hinst);
168 #elif defined(OSD_WIN32)
169 EMU(HWND hwnd, HINSTANCE hinst);
175 // ----------------------------------------
177 // ----------------------------------------
180 EmuThreadClass *get_parent_handler();
181 void set_parent_handler(EmuThreadClass *p, DrawThreadClass *q);
190 void set_host_cpus(int v);
192 void set_mouse_pointer(int x, int y);
193 void set_mouse_button(int button);
194 int get_mouse_button();
198 int get_frame_interval();
199 bool is_frame_skippable();
203 #ifdef USE_SPECIAL_RESET
204 void special_reset();
206 #ifdef USE_NOTIFY_POWER_OFF
207 void notify_power_off();
213 void force_unlock_vm();
218 void key_modifiers(uint32 mod);
220 void key_down(int code, bool repeat);
221 void key_up(int code);
222 void key_lost_focus();
223 #ifdef ONE_BOARD_MICRO_COMPUTER
224 void press_button(int num);
227 void disable_mouse();
229 bool is_mouse_enabled();
231 void start_auto_key();
232 void stop_auto_key();
233 bool is_auto_key_running()
235 return (auto_key_phase != 0);
237 FIFO* get_auto_key_buffer()
239 return auto_key_buffer;
243 const uint8* get_key_buffer();
244 const uint32* get_joy_buffer();
245 const int* get_mouse_buffer();
248 int get_window_width(int mode);
249 int get_window_height(int mode);
250 void set_host_window_size(int window_width, int window_height, bool window_mode);
251 void set_vm_screen_size(int screen_width, int screen_height, int window_width, int window_height, int window_width_aspect, int window_height_aspect);
252 int get_vm_window_width();
253 int get_vm_window_height();
254 int get_vm_window_width_aspect();
255 int get_vm_window_height_aspect();
256 #if defined(USE_MINIMUM_RENDERING)
257 bool is_screen_changed();
260 scrntype* get_screen_buffer(int y);
261 #ifdef USE_CRT_FILTER
262 void screen_skip_line(bool skip_line);
264 #ifdef ONE_BOARD_MICRO_COMPUTER
265 void reload_bitmap();
268 void update_screen(HDC hdc);
270 void capture_screen();
271 bool start_record_video(int fps);
272 void stop_record_video();
273 bool is_video_recording();
277 void start_record_sound();
278 void stop_record_sound();
279 bool is_sound_recording();
282 #if defined(USE_MOVIE_PLAYER) || defined(USE_VIDEO_CAPTURE)
283 void get_video_buffer();
284 void mute_video_dev(bool l, bool r);
286 #ifdef USE_MOVIE_PLAYER
287 bool open_movie_file(const _TCHAR* file_path);
288 void close_movie_file();
292 double get_movie_frame_rate();
293 int get_movie_sound_rate();
294 void set_cur_movie_frame(int frame, bool relative);
295 uint32 get_cur_movie_frame();
297 #ifdef USE_VIDEO_CAPTURE
298 int get_cur_capture_dev_index();
299 int get_num_capture_devs();
300 _TCHAR* get_capture_dev_name(int index);
301 void open_capture_dev(int index, bool pin);
302 void close_capture_dev();
303 void show_capture_dev_filter();
304 void show_capture_dev_pin();
305 void show_capture_dev_source();
306 void set_capture_dev_channel(int ch);
310 void create_bitmap(bitmap_t *bitmap, int width, int height);
311 void release_bitmap(bitmap_t *bitmap);
312 void create_font(font_t *font, const _TCHAR *family, int width, int height, int rotate, bool bold, bool italic);
313 void release_font(font_t *font);
314 void create_pen(pen_t *pen, int width, uint8 r, uint8 g, uint8 b);
315 void release_pen(pen_t *pen);
316 void clear_bitmap(bitmap_t *bitmap, uint8 r, uint8 g, uint8 b);
317 int get_text_width(bitmap_t *bitmap, font_t *font, const char *text);
318 void draw_text_to_bitmap(bitmap_t *bitmap, font_t *font, int x, int y, const char *text, uint8 r, uint8 g, uint8 b);
319 void draw_line_to_bitmap(bitmap_t *bitmap, pen_t *pen, int sx, int sy, int ex, int ey);
320 void draw_rectangle_to_bitmap(bitmap_t *bitmap, int x, int y, int width, int height, uint8 r, uint8 g, uint8 b);
321 void draw_point_to_bitmap(bitmap_t *bitmap, int x, int y, uint8 r, uint8 g, uint8 b);
322 void stretch_bitmap(bitmap_t *dest, int dest_x, int dest_y, int dest_width, int dest_height, bitmap_t *source, int source_x, int source_y, int source_width, int source_height);
323 void write_bitmap_to_file(bitmap_t *bitmap, const _TCHAR *file_path);
327 int get_socket(int ch);
328 void notify_socket_connected(int ch);
329 void notify_socket_disconnected(int ch);
330 bool initialize_socket_tcp(int ch);
331 bool initialize_socket_udp(int ch);
332 bool connect_socket(int ch, uint32 ipaddr, int port);
333 void disconnect_socket(int ch);
334 bool listen_socket(int ch);
335 void send_socket_data_tcp(int ch);
336 void send_socket_data_udp(int ch, uint32 ipaddr, int port);
337 void send_socket_data(int ch);
338 void recv_socket_data(int ch);
343 void open_debugger(int cpu_index);
344 void close_debugger();
345 bool is_debugger_enabled(int cpu_index);
347 debugger_thread_t debugger_thread_param;
349 SDL_Thread *debugger_thread_id;
350 CSP_Debugger *hDebugger;
351 #elif defined(OSD_WIN32)
352 HANDLE hDebuggerThread;
354 int debugger_thread_id;
359 void out_debug_log(const _TCHAR* format, ...);
360 void out_message(const _TCHAR* format, ...);
362 _TCHAR message[1024];
365 void sleep(uint32 ms);
369 void initialize_debug_log();
370 void release_debug_log();
375 int sound_rate, sound_samples;
379 #ifdef USE_SOUND_DEVICE_TYPE
380 int sound_device_type;
383 int printer_device_type;
389 FIFO* auto_key_buffer;
390 int auto_key_phase, auto_key_shift;
391 void initialize_auto_key();
392 void release_auto_key();
393 void update_auto_key();
396 uint32_t joy_status[4];
397 void update_joystick();
402 _TCHAR path[_MAX_PATH];
403 _TCHAR disk_name[MAX_D88_BANKS][128]; // Convert to UTF8
408 int get_access_lamp(void);
411 void open_cart(int drv, const _TCHAR* file_path);
412 void close_cart(int drv);
413 bool is_cart_inserted(int drv);
416 void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
417 void close_floppy_disk(int drv);
418 bool is_floppy_disk_inserted(int drv);
419 void is_floppy_disk_protected(int drv, bool value);
420 bool is_floppy_disk_protected(int drv);
423 void open_quick_disk(int drv, const _TCHAR* file_path);
424 void close_quick_disk(int drv);
425 bool is_quick_disk_inserted(int drv);
428 void play_tape(const _TCHAR* file_path);
429 void rec_tape(const _TCHAR* file_path);
431 bool is_tape_inserted();
432 # ifndef TAPE_BINARY_ONLY
433 bool is_tape_playing();
434 bool is_tape_recording();
435 int get_tape_position();
437 # ifdef USE_TAPE_BUTTON
440 void push_fast_forward();
441 void push_fast_rewind();
442 void push_apss_forward();
443 void push_apss_rewind();
446 #ifdef USE_LASER_DISC
447 void open_laser_disc(const _TCHAR* file_path);
448 void close_laser_disc();
449 bool is_laser_disc_inserted();
451 #ifdef USE_BINARY_FILE1
452 void load_binary(int drv, const _TCHAR* file_path);
453 void save_binary(int drv, const _TCHAR* file_path);
455 #ifdef SUPPORT_DUMMY_DEVICE_LED
456 uint32 get_led_status(void);
458 #ifdef USE_SOUND_VOLUME
459 void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
461 void update_config();