OSDN Git Service

8b11fd959834d92e0be1387ba70bae359a4046af
[csp-qt/common_source_project-fm7.git] / source / src / vm / pcengine / pcengine.h
1 /*
2         NEC-HE PC Engine Emulator 'ePCEngine'
3
4         Author : Takeda.Toshiya
5         Date   : 2012.10.31-
6
7         [ virtual machine ]
8 */
9
10 #ifndef _PCENGINE_H_
11 #define _PCENGINE_H_
12
13 #define DEVICE_NAME             "NEC-HE PC Engine"
14 #define CONFIG_NAME             "pcengine"
15
16 #define FRAMES_PER_SEC          60
17 #define LINES_PER_FRAME         262
18 #define CPU_CLOCKS              7159090
19 #define SCREEN_WIDTH            352
20 #define SCREEN_HEIGHT           240
21 // pixel aspect should be 8:7
22 #define WINDOW_HEIGHT_ASPECT    210
23
24 #define SUPPORT_SUPER_GFX
25 #define SUPPORT_BACKUP_RAM
26 #define SUPPORT_CDROM
27 //#define SCSI_HOST_AUTO_ACK
28 #define SCSI_DEV_IMMEDIATE_SELECT
29
30 // device informations for win32
31 #define SOUND_RATE_DEFAULT      5       // 44100Hz
32 #define SUPPORT_TV_RENDER
33 #define USE_CART                1
34 #define USE_COMPACT_DISC        1
35 #define USE_SOUND_VOLUME        3
36 #define USE_JOYSTICK
37 #define USE_JOYSTICK_TYPE       4
38 #define JOYSTICK_TYPE_DEFAULT   0
39 #define USE_JOY_BUTTON_CAPTIONS
40 #define USE_DEBUGGER
41 #define USE_STATE
42
43 #include "../../common.h"
44 #include "../../fileio.h"
45 #include "../vm_template.h"
46
47 #ifdef USE_SOUND_VOLUME
48 static const _TCHAR *sound_device_caption[] = {
49         _T("PSG"), _T("CD-DA"), _T("ADPCM")
50 };
51 #endif
52
53 #ifdef USE_JOY_BUTTON_CAPTIONS
54 static const _TCHAR *joy_button_captions[] = {
55         _T("Up"),
56         _T("Down"),
57         _T("Left"),
58         _T("Right"),
59         _T("Button #1"),
60         _T("Button #2"),
61         _T("Select"),
62         _T("Run"),
63         _T("Button #3"),
64         _T("Button #4"),
65         _T("Button #5"),
66         _T("Button #6"),
67 };
68 #endif
69
70 class csp_state_utils;
71 class EMU;
72 class DEVICE;
73 class EVENT;
74
75 class HUC6280;
76 class MSM5205;
77 class SCSI_HOST;
78 class SCSI_CDROM;
79 class PCE;
80
81 class VM : public VM_TEMPLATE
82 {
83 protected:
84         //EMU* emu;
85         //csp_state_utils* state_entry;
86         
87         // devices
88         EVENT* pceevent;
89         
90         HUC6280* pcecpu;
91         MSM5205* adpcm;
92         SCSI_HOST* scsi_host;
93         SCSI_CDROM* scsi_cdrom;
94         PCE* pce;
95         
96 public:
97         // ----------------------------------------
98         // initialize
99         // ----------------------------------------
100         
101         VM(EMU* parent_emu);
102         ~VM();
103         
104         // ----------------------------------------
105         // for emulation class
106         // ----------------------------------------
107         
108         // drive virtual machine
109         void reset();
110         void run();
111         double get_frame_rate();
112         
113 #ifdef USE_DEBUGGER
114         // debugger
115         DEVICE *get_cpu(int index);
116 #endif
117         
118         // draw screen
119         void draw_screen();
120         
121         // sound generation
122         void initialize_sound(int rate, int samples);
123         uint16_t* create_sound(int* extra_frames);
124         int get_sound_buffer_ptr();
125 #ifdef USE_SOUND_VOLUME
126         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
127 #endif
128         
129         // user interface
130         void open_cart(int drv, const _TCHAR* file_path);
131         void close_cart(int drv);
132         bool is_cart_inserted(int drv);
133         void open_compact_disc(int drv, const _TCHAR* file_path);
134         void close_compact_disc(int drv);
135         bool is_compact_disc_inserted(int drv);
136         uint32_t is_compact_disc_accessed();
137         bool is_frame_skippable()
138         {
139                 return false;
140         }
141         void update_config();
142         bool process_state(FILEIO* state_fio, bool loading);
143         
144         // ----------------------------------------
145         // for each device
146         // ----------------------------------------
147         
148         // devices
149         DEVICE* get_device(int id);
150         //DEVICE* dummy;
151         //DEVICE* first_device;
152         //DEVICE* last_device;
153 };
154
155 #endif