X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=source%2Fsrc%2Femu.h;h=3d8bc3be22e39e04aa1fb0d03058605e4fc18c32;hb=ef7e2d55278936e3e2a6fea6440dd46a783137b6;hp=80ac4fd5887225b4d25a1e6fb7434f8b3cf89e41;hpb=c3f76a4598a522d08778a54891d58b6adc665345;p=csp-qt%2Fcommon_source_project-fm7.git diff --git a/source/src/emu.h b/source/src/emu.h index 80ac4fd58..3d8bc3be2 100644 --- a/source/src/emu.h +++ b/source/src/emu.h @@ -21,11 +21,6 @@ #if defined(_USE_QT) # include -//# include "menuclasses.h" -//# include "mainwidget.h" -//# include "qt_gldraw.h" -//# include "emu_utils.h" -//# include "qt_main.h" # include "simd_types.h" // Wrapper of WIN32->*nix @@ -45,28 +40,28 @@ #include "vm/disk.h" #endif -#if defined(_USE_QT) -#include -#include -#include -# if !defined(Q_OS_WIN32) -#include "qt_input.h" -# endif -#endif #if defined(_USE_QT) #define OSD_QT -#elif defined(_MSC_VER) +#elif defined(_USE_SDL) +#define OSD_SDL +#elif defined(_WIN32) #define OSD_WIN32 +#else +// oops! #endif -#if defined(OSD_WIN32) -#include "win32/osd.h" -#elif defined(OSD_QT) + +// OS dependent header files should be included in each osd.h +// Please do not include them in emu.h + +#if defined(OSD_QT) #include "qt/osd.h" #elif defined(OSD_SDL) #include "sdl/osd.h" - #endif +#elif defined(OSD_WIN32) +#include "win32/osd.h" +#endif #ifdef USE_FD1 #define MAX_D88_BANKS 64 @@ -79,9 +74,9 @@ class EMU; -class OSD; class FIFO; class FILEIO; +class OSD; #ifdef USE_DEBUGGER typedef struct { @@ -94,15 +89,18 @@ typedef struct { class CSP_Debugger; #endif +#if defined(OSD_QT) +class GLDrawClass; +class EmuThreadClass; +class DrawThreadClass; +#endif + #ifdef __cplusplus class EMU { protected: VM* vm; OSD* osd; -#if defined(_USE_QT) - int host_cpus; -#endif private: _TCHAR app_path[_MAX_PATH]; // ---------------------------------------- @@ -126,10 +124,10 @@ private: media_status_t cart_status[MAX_CART]; #endif #ifdef USE_FD1 - media_status_t disk_status[MAX_FD]; + media_status_t floppy_disk_status[MAX_FD]; #endif #ifdef USE_QD1 - media_status_t quickdisk_status[MAX_QD]; + media_status_t quick_disk_status[MAX_QD]; #endif #ifdef USE_TAPE media_status_t tape_status; @@ -172,10 +170,12 @@ public: // ---------------------------------------- // initialize // ---------------------------------------- -#if defined(_USE_QT) - EMU(class Ui_MainWindow *, GLDrawClass *); +#if defined(OSD_QT) + EMU(class Ui_MainWindow *hwnd, GLDrawClass *hinst); +#elif defined(OSD_WIN32) + EMU(HWND hwnd, HINSTANCE hinst); #else - EMU(HWND hwnd, HINSTANCE hinst); + EMU(); #endif ~EMU(); @@ -183,46 +183,39 @@ public: // for windows // ---------------------------------------- #if defined(_USE_QT) - class Ui_MainWindow *main_window_handle; - GLDrawClass *instance_handle; - EmuThreadClass *get_parent_handler(void); - void set_parent_handler(EmuThreadClass *p, DrawThreadClass *q) { - osd->set_parent_thread(p); - osd->set_draw_thread(q); +#ifdef OSD_QT + // qt dependent + EmuThreadClass *get_parent_handler(); + void set_parent_handler(EmuThreadClass *p, DrawThreadClass *q); + VM *get_vm() + { + return vm; + } + OSD *get_osd() + { + return osd; } + void set_host_cpus(int v); + int get_host_cpus(); +#endif #ifdef USE_DEBUGGER - debugger_thread_t debugger_thread_param; + debugger_thread_t debugger_thread_param; + SDL_Thread *debugger_thread_id; CSP_Debugger *hDebugger; #endif - VM *getVM(void) { - return vm; - } - void setMousePointer(int x, int y) { - osd->setMousePointer(x, y); - } - void setMouseButton(int button) { - osd->setMouseButton(button); - } - int getMouseButton() { - return osd->getMouseButton(); - } - void SetHostCpus(int v) { - if(v <= 0) v = 1; - host_cpus = v; - } - int GetHostCpus() { - return host_cpus; - } - //QThread *hDebuggerThread; + void set_mouse_pointer(int x, int y); + void set_mouse_button(int button); + int get_mouse_button(); #else HWND main_window_handle; HINSTANCE instance_handle; bool vista_or_later; #endif // drive machine - int frame_interval(); + int get_frame_interval(); + bool is_frame_skippable(); int run(); - bool now_skip(); + void reset(); #ifdef USE_SPECIAL_RESET void special_reset(); @@ -232,7 +225,15 @@ public: #endif void power_off(); void suspend(); + void lock_vm(); + void unlock_vm(); + void force_unlock_vm(); + bool is_vm_locked(); + // input +#ifdef OSD_QT + void key_modifiers(uint32 mod); +#endif void key_down(int code, bool repeat); void key_up(int code); void key_lost_focus(); @@ -243,23 +244,38 @@ public: void disenable_mouse(); void toggle_mouse(); bool get_mouse_enabled(); + bool is_mouse_enabled(); #ifdef USE_AUTO_KEY void start_auto_key(); void stop_auto_key(); - bool now_auto_key(); + bool is_auto_key_running() + { + return (auto_key_phase != 0); + } + FIFO* get_auto_key_buffer() + { + return auto_key_buffer; + } #endif - uint8* key_buffer(); - uint32* joy_buffer(); - int* mouse_buffer(); + const uint8* get_key_buffer(); + const uint32* get_joy_buffer(); + const int* get_mouse_buffer(); // screen int get_window_width(int mode); int get_window_height(int mode); - void set_window_size(int width, int height, bool window_mode); - void set_vm_screen_size(int sw, int sh, int swa, int sha, int ww, int wh); + void set_host_window_size(int window_width, int window_height, bool window_mode); + 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); + int get_vm_window_width(); + int get_vm_window_height(); + int get_vm_window_width_aspect(); + int get_vm_window_height_aspect(); +#if defined(USE_MINIMUM_RENDERING) + bool is_screen_changed(); +#endif int draw_screen(); - scrntype* screen_buffer(int y); + scrntype* get_screen_buffer(int y); #ifdef USE_CRT_FILTER void screen_skip_line(bool skip_line); #endif @@ -270,15 +286,15 @@ public: void update_screen(HDC hdc); #endif void capture_screen(); - bool start_rec_video(int fps); - void stop_rec_video(); - bool now_rec_video(); + bool start_record_video(int fps); + void stop_record_video(); + bool is_video_recording(); // sound void mute_sound(); - void start_rec_sound(); - void stop_rec_sound(); - bool now_rec_sound(); + void start_recording_sound(); + void stop_recording_sound(); + bool is_sound_recording(); // video device #if defined(USE_MOVIE_PLAYER) || defined(USE_VIDEO_CAPTURE) @@ -308,29 +324,44 @@ public: void set_capture_dev_channel(int ch); #endif - // printer - void printer_out(uint8 value); - void printer_strobe(bool value); +#ifdef USE_PRINTER + void create_bitmap(bitmap_t *bitmap, int width, int height); + void release_bitmap(bitmap_t *bitmap); + void create_font(font_t *font, const _TCHAR *family, int width, int height, int rotate, bool bold, bool italic); + void release_font(font_t *font); + void create_pen(pen_t *pen, int width, uint8 r, uint8 g, uint8 b); + void release_pen(pen_t *pen); + void clear_bitmap(bitmap_t *bitmap, uint8 r, uint8 g, uint8 b); + int get_text_width(bitmap_t *bitmap, font_t *font, const char *text); + void draw_text_to_bitmap(bitmap_t *bitmap, font_t *font, int x, int y, const char *text, uint8 r, uint8 g, uint8 b); + void draw_line_to_bitmap(bitmap_t *bitmap, pen_t *pen, int sx, int sy, int ex, int ey); + void draw_rectangle_to_bitmap(bitmap_t *bitmap, int x, int y, int width, int height, uint8 r, uint8 g, uint8 b); + void draw_point_to_bitmap(bitmap_t *bitmap, int x, int y, uint8 r, uint8 g, uint8 b); + 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); + void write_bitmap_to_file(bitmap_t *bitmap, const _TCHAR *file_path); +#endif // socket #ifdef USE_SOCKET int get_socket(int ch); - void socket_connected(int ch); - void socket_disconnected(int ch); - bool init_socket_tcp(int ch); - bool init_socket_udp(int ch); + void notify_socket_connected(int ch); + void notify_socket_disconnected(int ch); + bool initialize_socket_tcp(int ch); + bool initialize_socket_udp(int ch); bool connect_socket(int ch, uint32 ipaddr, int port); void disconnect_socket(int ch); bool listen_socket(int ch); - void send_data_tcp(int ch); - void send_data_udp(int ch, uint32 ipaddr, int port); - void send_data(int ch); - void recv_data(int ch); + void send_socket_data_tcp(int ch); + void send_socket_data_udp(int ch, uint32 ipaddr, int port); + void send_socket_data(int ch); + void recv_socket_data(int ch); #endif // debugger #ifdef USE_DEBUGGER void open_debugger(int cpu_index); void close_debugger(); - bool debugger_enabled(int cpu_index); + bool is_debugger_enabled(int cpu_index); + void initialize_debugger(); + void release_debugger(); bool now_debugging; #endif // debug log @@ -340,16 +371,8 @@ public: _TCHAR message[1024]; // misc - _TCHAR* application_path(); - _TCHAR* bios_path(const _TCHAR* file_name); void sleep(uint32 ms); - void get_host_time(cur_time_t* time); -#if defined(USE_MINIMUM_RENDERING) - bool screen_changed() { - return vm->screen_changed(); - } -#endif - + // debug log #ifdef _DEBUG_LOG void initialize_debug_log(); @@ -365,8 +388,22 @@ public: #ifdef USE_SOUND_DEVICE_TYPE int sound_device_type; #endif +#ifdef USE_PRINTER + int printer_device_type; +#endif bool now_suspended; + // input +#ifdef USE_AUTO_KEY + FIFO* auto_key_buffer; + int auto_key_phase, auto_key_shift; + void initialize_auto_key(); + void release_auto_key(); + void update_auto_key(); +#endif + uint32 joy_status[4]; + void update_joystick(); + // media #ifdef USE_FD1 struct { @@ -377,38 +414,33 @@ public: } d88_file[MAX_FD]; #endif int get_access_lamp(void); -#if defined(_USE_QT) - void key_mod(uint32 mod) { - osd->key_mod(mod); - } -#endif // user interface #ifdef USE_CART1 void open_cart(int drv, const _TCHAR* file_path); void close_cart(int drv); - bool cart_inserted(int drv); + bool is_cart_inserted(int drv); #endif #ifdef USE_FD1 - void open_disk(int drv, const _TCHAR* file_path, int bank); - void close_disk(int drv); - bool disk_inserted(int drv); - void set_disk_protected(int drv, bool value); - bool get_disk_protected(int drv); + void open_floppy_disk(int drv, const _TCHAR* file_path, int bank); + void close_floppy_disk(int drv); + bool is_floppy_disk_inserted(int drv); + void is_floppy_disk_protected(int drv, bool value); + bool is_floppy_disk_protected(int drv); #endif #ifdef USE_QD1 - void open_quickdisk(int drv, const _TCHAR* file_path); - void close_quickdisk(int drv); - bool quickdisk_inserted(int drv); + void open_quick_disk(int drv, const _TCHAR* file_path); + void close_quick_disk(int drv); + bool is_quick_disk_inserted(int drv); #endif #ifdef USE_TAPE void play_tape(const _TCHAR* file_path); void rec_tape(const _TCHAR* file_path); void close_tape(); - bool tape_inserted(); + bool is_tape_inserted(); # ifndef TAPE_BINARY_ONLY - bool tape_playing(); - bool tape_recording(); - int tape_position(); + bool is_tape_playing(); + bool is_tape_recording(); + int get_tape_position(); # endif # ifdef USE_TAPE_BUTTON void push_play(); @@ -422,7 +454,7 @@ public: #ifdef USE_LASER_DISC void open_laser_disc(const _TCHAR* file_path); void close_laser_disc(); - bool laser_disc_inserted(); + bool is_laser_disc_inserted(); #endif #ifdef USE_BINARY_FILE1 void load_binary(int drv, const _TCHAR* file_path); @@ -431,17 +463,9 @@ public: #ifdef SUPPORT_DUMMY_DEVICE_LED uint32 get_led_status(void); #endif -#if defined(USE_DIG_RESOLUTION) - void get_screen_resolution(int *w, int *h); -#endif - void lock_vm(void); - void unlock_vm(void); - //{ - // osd->lock_vm(); - //} - //void unlock_vm(void) { - // osd->unlock_vm(); - //} +#ifdef USE_SOUND_VOLUME + void set_sound_device_volume(int ch, int decibel_l, int decibel_r); +#endif void update_config(); // state #ifdef USE_STATE