2 Skelton for retropc emulator
4 Author : Takeda.Toshiya
7 [ win32 emulation i/f ]
16 # include "simd_types.h"
22 // output fdc debug log
23 // #define _FDC_DEBUG_LOG
24 // output scsi debug log
25 // #define _SCSI_DEBUG_LOG
26 // output i/o debug log
27 // #define _IO_DEBUG_LOG
42 #elif defined(_USE_SDL)
51 // OS dependent header files should be included in each osd.h
52 // Please do not include them in emu.h
56 #elif defined(OSD_SDL)
58 #elif defined(OSD_WIN32)
59 #include "win32/osd.h"
63 #define MAX_D88_BANKS 64
68 #define SOCKET_BUFFER_MAX 0x100000
83 bool request_terminate;
91 class DrawThreadClass;
100 _TCHAR app_path[_MAX_PATH];
103 void initialize_debugger();
104 void release_debugger();
109 void initialize_debug_log();
110 void release_debug_log();
115 int sound_rate, sound_samples;
119 #ifdef USE_SOUND_DEVICE_TYPE
120 int sound_device_type;
123 int printer_device_type;
128 FIFO* auto_key_buffer;
129 int auto_key_phase, auto_key_shift;
130 void initialize_auto_key();
131 void release_auto_key();
132 void update_auto_key();
135 uint32_t joy_status[4];
136 void update_joystick();
141 _TCHAR path[_MAX_PATH];
148 media_status_t cart_status[MAX_CART];
151 media_status_t floppy_disk_status[MAX_FD];
154 media_status_t quick_disk_status[MAX_QD];
157 media_status_t tape_status;
159 #ifdef USE_LASER_DISC
160 media_status_t laser_disc_status;
163 void initialize_media();
165 void restore_media();
167 void clear_media_status(media_status_t *status)
169 status->path[0] = _T('\0');
170 status->wait_count = 0;
175 void save_state_tmp(const _TCHAR* file_path);
176 bool load_state_tmp(const _TCHAR* file_path);
180 // ----------------------------------------
182 // ----------------------------------------
184 EMU(class Ui_MainWindow *hwnd, GLDrawClass *hinst);
185 #elif defined(OSD_WIN32)
186 EMU(HWND hwnd, HINSTANCE hinst);
192 // ----------------------------------------
194 // ----------------------------------------
197 EmuThreadClass *get_parent_handler();
198 void set_parent_handler(EmuThreadClass *p, DrawThreadClass *q);
207 void set_host_cpus(int v);
210 void set_mouse_pointer(int x, int y);
211 void set_mouse_button(int button);
212 int get_mouse_button();
217 int get_frame_interval();
218 bool is_frame_skippable();
222 #ifdef USE_SPECIAL_RESET
223 void special_reset();
225 #ifdef USE_NOTIFY_POWER_OFF
226 void notify_power_off();
232 void force_unlock_vm();
237 void key_modifiers(uint32_t mod);
239 void key_down(int code, bool repeat);
240 void key_up(int code);
241 void key_lost_focus();
242 #ifdef ONE_BOARD_MICRO_COMPUTER
243 void press_button(int num);
247 void disable_mouse();
249 bool is_mouse_enabled();
252 void start_auto_key();
253 void stop_auto_key();
254 bool is_auto_key_running()
256 return (auto_key_phase != 0);
258 FIFO* get_auto_key_buffer()
260 return auto_key_buffer;
264 const uint8_t* get_key_buffer();
266 const uint32_t* get_joy_buffer();
269 const int* get_mouse_buffer();
272 int get_window_width(int mode);
273 int get_window_height(int mode);
274 void set_host_window_size(int window_width, int window_height, bool window_mode);
275 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);
276 int get_vm_window_width();
277 int get_vm_window_height();
278 int get_vm_window_width_aspect();
279 int get_vm_window_height_aspect();
280 #if defined(USE_MINIMUM_RENDERING)
281 bool is_screen_changed();
284 scrntype_t* get_screen_buffer(int y);
285 #ifdef USE_CRT_FILTER
286 void screen_skip_line(bool skip_line);
288 #ifdef ONE_BOARD_MICRO_COMPUTER
289 void reload_bitmap();
292 void update_screen(HDC hdc);
294 void capture_screen();
295 bool start_record_video(int fps);
296 void stop_record_video();
297 bool is_video_recording();
301 void start_record_sound();
302 void stop_record_sound();
303 bool is_sound_recording();
306 #if defined(USE_MOVIE_PLAYER) || defined(USE_VIDEO_CAPTURE)
307 void get_video_buffer();
308 void mute_video_dev(bool l, bool r);
310 #ifdef USE_MOVIE_PLAYER
311 bool open_movie_file(const _TCHAR* file_path);
312 void close_movie_file();
316 double get_movie_frame_rate();
317 int get_movie_sound_rate();
318 void set_cur_movie_frame(int frame, bool relative);
319 uint32_t get_cur_movie_frame();
321 #ifdef USE_VIDEO_CAPTURE
322 int get_cur_capture_dev_index();
323 int get_num_capture_devs();
324 _TCHAR* get_capture_dev_name(int index);
325 void open_capture_dev(int index, bool pin);
326 void close_capture_dev();
327 void show_capture_dev_filter();
328 void show_capture_dev_pin();
329 void show_capture_dev_source();
330 void set_capture_dev_channel(int ch);
334 void create_bitmap(bitmap_t *bitmap, int width, int height);
335 void release_bitmap(bitmap_t *bitmap);
336 void create_font(font_t *font, const _TCHAR *family, int width, int height, int rotate, bool bold, bool italic);
337 void release_font(font_t *font);
338 void create_pen(pen_t *pen, int width, uint8_t r, uint8_t g, uint8_t b);
339 void release_pen(pen_t *pen);
340 void clear_bitmap(bitmap_t *bitmap, uint8_t r, uint8_t g, uint8_t b);
341 int get_text_width(bitmap_t *bitmap, font_t *font, const char *text);
342 void draw_text_to_bitmap(bitmap_t *bitmap, font_t *font, int x, int y, const char *text, uint8_t r, uint8_t g, uint8_t b);
343 void draw_line_to_bitmap(bitmap_t *bitmap, pen_t *pen, int sx, int sy, int ex, int ey);
344 void draw_rectangle_to_bitmap(bitmap_t *bitmap, int x, int y, int width, int height, uint8_t r, uint8_t g, uint8_t b);
345 void draw_point_to_bitmap(bitmap_t *bitmap, int x, int y, uint8_t r, uint8_t g, uint8_t b);
346 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);
347 void write_bitmap_to_file(bitmap_t *bitmap, const _TCHAR *file_path);
351 int get_socket(int ch);
352 void notify_socket_connected(int ch);
353 void notify_socket_disconnected(int ch);
354 bool initialize_socket_tcp(int ch);
355 bool initialize_socket_udp(int ch);
356 bool connect_socket(int ch, uint32_t ipaddr, int port);
357 void disconnect_socket(int ch);
358 bool listen_socket(int ch);
359 void send_socket_data_tcp(int ch);
360 void send_socket_data_udp(int ch, uint32_t ipaddr, int port);
361 void send_socket_data(int ch);
362 void recv_socket_data(int ch);
367 void open_debugger(int cpu_index);
368 void close_debugger();
369 bool is_debugger_enabled(int cpu_index);
371 debugger_thread_t debugger_thread_param;
373 SDL_Thread *debugger_thread_id;
374 CSP_Debugger *hDebugger;
375 #elif defined(OSD_WIN32)
376 HANDLE hDebuggerThread;
378 int debugger_thread_id;
383 void out_debug_log(const _TCHAR* format, ...);
384 void force_out_debug_log(const _TCHAR* format, ...);
386 void out_message(const _TCHAR* format, ...);
388 _TCHAR message[1024];
391 void sleep(uint32_t ms);
395 void initialize_debug_log();
396 void release_debug_log();
403 _TCHAR path[_MAX_PATH];
404 _TCHAR disk_name[MAX_D88_BANKS][128]; // Convert to UTF8
412 void open_cart(int drv, const _TCHAR* file_path);
413 void close_cart(int drv);
414 bool is_cart_inserted(int drv);
417 void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
418 void close_floppy_disk(int drv);
419 bool is_floppy_disk_inserted(int drv);
420 void is_floppy_disk_protected(int drv, bool value);
421 bool is_floppy_disk_protected(int drv);
424 void open_quick_disk(int drv, const _TCHAR* file_path);
425 void close_quick_disk(int drv);
426 bool is_quick_disk_inserted(int drv);
429 void play_tape(const _TCHAR* file_path);
430 void rec_tape(const _TCHAR* file_path);
432 bool is_tape_inserted();
433 # ifndef TAPE_BINARY_ONLY
434 bool is_tape_playing();
435 bool is_tape_recording();
436 int get_tape_position();
438 # ifdef USE_TAPE_BUTTON
441 void push_fast_forward();
442 void push_fast_rewind();
443 void push_apss_forward();
444 void push_apss_rewind();
447 #ifdef USE_LASER_DISC
448 void open_laser_disc(const _TCHAR* file_path);
449 void close_laser_disc();
450 bool is_laser_disc_inserted();
452 #ifdef USE_BINARY_FILE1
453 void load_binary(int drv, const _TCHAR* file_path);
454 void save_binary(int drv, const _TCHAR* file_path);
456 #ifdef USE_ACCESS_LAMP
457 uint32_t get_access_lamp_status(void);
459 #ifdef USE_LED_DEVICE
460 uint32_t get_led_status(void);
462 #ifdef USE_SOUND_VOLUME
463 void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
465 void update_config();