OSDN Git Service

[VM][STATE] Use namespace {VMNAME} to separate per VMs.
[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
80 namespace PCEDEV {
81         class PCE;
82 }
83 class VM : public VM_TEMPLATE
84 {
85 protected:
86         //EMU* emu;
87         //csp_state_utils* state_entry;
88         
89         // devices
90         EVENT* pceevent;
91         
92         HUC6280* pcecpu;
93         MSM5205* adpcm;
94         SCSI_HOST* scsi_host;
95         SCSI_CDROM* scsi_cdrom;
96         PCEDEV::PCE* pce;
97         
98 public:
99         // ----------------------------------------
100         // initialize
101         // ----------------------------------------
102         
103         VM(EMU* parent_emu);
104         ~VM();
105         
106         // ----------------------------------------
107         // for emulation class
108         // ----------------------------------------
109         
110         // drive virtual machine
111         void reset();
112         void run();
113         double get_frame_rate();
114         
115 #ifdef USE_DEBUGGER
116         // debugger
117         DEVICE *get_cpu(int index);
118 #endif
119         
120         // draw screen
121         void draw_screen();
122         
123         // sound generation
124         void initialize_sound(int rate, int samples);
125         uint16_t* create_sound(int* extra_frames);
126         int get_sound_buffer_ptr();
127 #ifdef USE_SOUND_VOLUME
128         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
129 #endif
130         
131         // user interface
132         void open_cart(int drv, const _TCHAR* file_path);
133         void close_cart(int drv);
134         bool is_cart_inserted(int drv);
135         void open_compact_disc(int drv, const _TCHAR* file_path);
136         void close_compact_disc(int drv);
137         bool is_compact_disc_inserted(int drv);
138         uint32_t is_compact_disc_accessed();
139         bool is_frame_skippable()
140         {
141                 return false;
142         }
143         void update_config();
144         bool process_state(FILEIO* state_fio, bool loading);
145         
146         // ----------------------------------------
147         // for each device
148         // ----------------------------------------
149         
150         // devices
151         DEVICE* get_device(int id);
152         //DEVICE* dummy;
153         //DEVICE* first_device;
154         //DEVICE* last_device;
155 };
156
157 #endif