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 scsi debug log
19 // #define _SCSI_DEBUG_LOG
20 // output i/o debug log
21 // #define _IO_DEBUG_LOG
33 #elif defined(_USE_SDL)
43 // OS dependent header files should be included in each osd.h
44 // Please do not include them in emu.h
48 #elif defined(OSD_SDL)
50 #elif defined(OSD_WIN32)
51 #include "win32/osd.h"
54 #ifdef USE_FLOPPY_DISK
55 #define MAX_D88_BANKS 64
58 #define MAX_B77_BANKS 16
68 class CSP_DebuggerThread;
75 bool request_terminate;
84 class DrawThreadClass;
93 _TCHAR app_path[_MAX_PATH];
96 void initialize_debugger();
97 void release_debugger();
102 int sound_frequency, sound_latency;
103 int sound_rate, sound_samples;
107 #ifdef USE_SOUND_TYPE
110 #ifdef USE_PRINTER_TYPE
116 FIFO* auto_key_buffer;
117 int auto_key_phase, auto_key_shift;
119 void initialize_auto_key();
120 void release_auto_key();
121 int get_auto_key_code(int code);
122 void set_auto_key_code(int code);
123 void update_auto_key();
126 uint32_t joy_status[4];
127 void update_joystick();
132 _TCHAR path[_MAX_PATH];
139 media_status_t cart_status[USE_CART];
141 #ifdef USE_FLOPPY_DISK
142 media_status_t floppy_disk_status[USE_FLOPPY_DISK];
144 #ifdef USE_QUICK_DISK
145 media_status_t quick_disk_status[USE_QUICK_DISK];
148 media_status_t hard_disk_status[USE_HARD_DISK];
151 media_status_t tape_status[USE_TAPE];
153 #ifdef USE_COMPACT_DISC
154 media_status_t compact_disc_status[USE_COMPACT_DISC];
156 #ifdef USE_LASER_DISC
157 media_status_t laser_disc_status[USE_LASER_DISC];
160 media_status_t bubble_casette_status[USE_BUBBLE];
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 bool load_state_tmp(const _TCHAR* file_path);
179 // ----------------------------------------
181 // ----------------------------------------
183 EMU(class Ui_MainWindow *hwnd, GLDrawClass *hinst, USING_FLAGS *p);
184 #elif defined(OSD_WIN32)
185 EMU(HWND hwnd, HINSTANCE hinst);
191 // ----------------------------------------
193 // ----------------------------------------
196 EmuThreadClass *get_parent_handler();
197 void set_parent_handler(EmuThreadClass *p, DrawThreadClass *q);
206 void set_host_cpus(int v);
211 double get_frame_rate();
212 int get_frame_interval();
213 bool is_frame_skippable();
217 #ifdef USE_SPECIAL_RESET
218 void special_reset();
220 #ifdef USE_NOTIFY_POWER_OFF
221 void notify_power_off();
227 void force_unlock_vm();
232 void key_modifiers(uint32_t mod);
234 void key_down(int code, bool extended, bool repeat);
235 void key_up(int code, bool extended);
236 void key_char(char code);
237 #ifdef USE_KEY_LOCKED
238 bool get_caps_locked();
239 bool get_kana_locked();
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 set_auto_key_list(char *buf, int size);
253 void set_auto_key_char(char code);
254 void start_auto_key();
255 void stop_auto_key();
256 bool is_auto_key_running()
258 return (auto_key_phase != 0);
260 FIFO* get_auto_key_buffer()
262 return auto_key_buffer;
266 const uint8_t* get_key_buffer();
268 const uint32_t* get_joy_buffer();
271 const int* get_mouse_buffer();
274 int get_window_mode_width(int mode);
275 int get_window_mode_height(int mode);
276 void set_host_window_size(int window_width, int window_height, bool window_mode);
277 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);
278 void set_vm_screen_lines(int lines);
280 int get_vm_window_width();
281 int get_vm_window_height();
282 int get_vm_window_width_aspect();
283 int get_vm_window_height_aspect();
284 #if defined(USE_MINIMUM_RENDERING)
285 bool is_screen_changed();
288 scrntype_t* get_screen_buffer(int y);
289 #ifdef USE_SCREEN_FILTER
290 void screen_skip_line(bool skip_line);
292 #ifdef ONE_BOARD_MICRO_COMPUTER
293 void get_invalidated_rect(int *left, int *top, int *right, int *bottom);
294 void reload_bitmap();
297 void invalidate_screen();
298 void update_screen(HDC hdc);
300 void capture_screen();
301 bool start_record_video(int fps);
302 void stop_record_video();
303 bool is_video_recording();
310 void start_record_sound();
311 void stop_record_sound();
312 bool is_sound_recording();
315 #if defined(USE_MOVIE_PLAYER) || defined(USE_VIDEO_CAPTURE)
316 void get_video_buffer();
317 void mute_video_dev(bool l, bool r);
319 #ifdef USE_MOVIE_PLAYER
320 bool open_movie_file(const _TCHAR* file_path);
321 void close_movie_file();
325 double get_movie_frame_rate();
326 int get_movie_sound_rate();
327 void set_cur_movie_frame(int frame, bool relative);
328 uint32_t get_cur_movie_frame();
330 #ifdef USE_VIDEO_CAPTURE
331 int get_cur_capture_dev_index();
332 int get_num_capture_devs();
333 _TCHAR* get_capture_dev_name(int index);
334 void open_capture_dev(int index, bool pin);
335 void close_capture_dev();
336 void show_capture_dev_filter();
337 void show_capture_dev_pin();
338 void show_capture_dev_source();
339 void set_capture_dev_channel(int ch);
343 void create_bitmap(bitmap_t *bitmap, int width, int height);
344 void release_bitmap(bitmap_t *bitmap);
345 void create_font(font_t *font, const _TCHAR *family, int width, int height, int rotate, bool bold, bool italic);
346 void release_font(font_t *font);
347 void create_pen(pen_t *pen, int width, uint8_t r, uint8_t g, uint8_t b);
348 void release_pen(pen_t *pen);
349 void clear_bitmap(bitmap_t *bitmap, uint8_t r, uint8_t g, uint8_t b);
350 int get_text_width(bitmap_t *bitmap, font_t *font, const char *text);
351 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);
352 void draw_line_to_bitmap(bitmap_t *bitmap, pen_t *pen, int sx, int sy, int ex, int ey);
353 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);
354 void draw_point_to_bitmap(bitmap_t *bitmap, int x, int y, uint8_t r, uint8_t g, uint8_t b);
355 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);
356 void write_bitmap_to_file(bitmap_t *bitmap, const _TCHAR *file_path);
360 int get_socket(int ch);
361 void notify_socket_connected(int ch);
362 void notify_socket_disconnected(int ch);
363 bool initialize_socket_tcp(int ch);
364 bool initialize_socket_udp(int ch);
365 bool connect_socket(int ch, uint32_t ipaddr, int port);
366 void disconnect_socket(int ch);
367 bool listen_socket(int ch);
368 void send_socket_data_tcp(int ch);
369 void send_socket_data_udp(int ch, uint32_t ipaddr, int port);
370 void send_socket_data(int ch);
371 void recv_socket_data(int ch);
376 void open_debugger(int cpu_index);
377 void close_debugger();
378 bool is_debugger_enabled(int cpu_index);
380 debugger_thread_t debugger_thread_param;
382 pthread_t debugger_thread_id;
383 CSP_Debugger *hDebugger;
384 #elif defined(OSD_WIN32)
385 HANDLE hDebuggerThread;
387 int debugger_thread_id;
392 void out_debug_log(const _TCHAR* format, ...);
393 void force_out_debug_log(const _TCHAR* format, ...);
395 void out_message(const _TCHAR* format, ...);
397 _TCHAR message[1024];
400 void sleep(uint32_t ms);
404 void initialize_debug_log();
405 void release_debug_log();
410 #ifdef USE_FLOPPY_DISK
412 _TCHAR path[_MAX_PATH];
413 _TCHAR disk_name[MAX_D88_BANKS][128]; // Convert to UTF8
416 } d88_file[USE_FLOPPY_DISK];
421 void open_cart(int drv, const _TCHAR* file_path);
422 void close_cart(int drv);
423 bool is_cart_inserted(int drv);
425 #ifdef USE_FLOPPY_DISK
426 void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
427 void close_floppy_disk(int drv);
428 bool is_floppy_disk_inserted(int drv);
429 void is_floppy_disk_protected(int drv, bool value);
430 bool is_floppy_disk_protected(int drv);
431 uint32_t is_floppy_disk_accessed();
433 #ifdef USE_QUICK_DISK
434 void open_quick_disk(int drv, const _TCHAR* file_path);
435 void close_quick_disk(int drv);
436 bool is_quick_disk_inserted(int drv);
437 uint32_t is_quick_disk_accessed();
440 void open_hard_disk(int drv, const _TCHAR* file_path);
441 void close_hard_disk(int drv);
442 bool is_hard_disk_inserted(int drv);
443 uint32_t is_hard_disk_accessed();
446 void play_tape(int drv, const _TCHAR* file_path);
447 void rec_tape(int drv, const _TCHAR* file_path);
448 void close_tape(int drv);
449 bool is_tape_inserted(int drv);
450 bool is_tape_playing(int drv);
451 bool is_tape_recording(int drv);
452 int get_tape_position(int drv);
453 const _TCHAR* get_tape_message(int drv);
454 void push_play(int drv);
455 void push_stop(int drv);
456 void push_fast_forward(int drv);
457 void push_fast_rewind(int drv);
458 void push_apss_forward(int drv);
459 void push_apss_rewind(int drv);
461 #ifdef USE_COMPACT_DISC
462 void open_compact_disc(int drv, const _TCHAR* file_path);
463 void close_compact_disc(int drv);
464 bool is_compact_disc_inserted(int drv);
465 uint32_t is_compact_disc_accessed();
467 #ifdef USE_LASER_DISC
468 void open_laser_disc(int drv, const _TCHAR* file_path);
469 void close_laser_disc(int drv);
470 bool is_laser_disc_inserted(int drv);
471 uint32_t is_laser_disc_accessed();
473 #ifdef USE_BINARY_FILE
474 void load_binary(int drv, const _TCHAR* file_path);
475 void save_binary(int drv, const _TCHAR* file_path);
479 _TCHAR path[_MAX_PATH];
480 _TCHAR bubble_name[MAX_B77_BANKS][128]; // Convert to UTF8
483 } b77_file[USE_BUBBLE];
484 void open_bubble_casette(int drv, const _TCHAR* file_path, int bank);
485 void close_bubble_casette(int drv);
486 bool is_bubble_casette_inserted(int drv);
487 bool is_bubble_casette_protected(int drv);
488 void is_bubble_casette_protected(int drv, bool value);
490 #ifdef USE_LED_DEVICE
491 uint32_t get_led_status();
493 #ifdef USE_SOUND_VOLUME
494 void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
496 void update_config();
499 void save_state(const _TCHAR* file_path);
500 void load_state(const _TCHAR* file_path);
504 void load_sound_file(int id, const _TCHAR *name, int16_t **data, int *dst_size);
505 void free_sound_file(int id, int16_t **data);