OSDN Git Service

[DOC] Update ToDo (Still updated only Japanese doc.).
[csp-qt/common_source_project-fm7.git] / source / src / qt / common / menu_flags.cpp
1 #include "common.h"
2 #include "vm.h"
3 #include "emu.h"
4 #include "osd.h"
5 #include "menu_flags_ext.h"
6
7 #ifndef USE_SOUND_VOLUME
8 static const _TCHAR *sound_device_caption[] = {""};
9 #endif
10 #ifndef USE_JOY_BUTTON_CAPTIONS
11 static const _TCHAR *joy_button_captions[] = {""};
12 #endif
13
14 const int s_freq_table[8] = {
15                 2000, 4000, 8000, 11025, 22050, 44100,
16 #ifdef OVERRIDE_SOUND_FREQ_48000HZ
17                 OVERRIDE_SOUND_FREQ_48000HZ,
18 #else
19                 48000,
20 #endif
21                 96000,
22 };
23
24 USING_FLAGS_EXT::USING_FLAGS_EXT(config_t *cfg) : USING_FLAGS(cfg)
25 {
26         p_osd = NULL;
27         use_alt_f10_key = false;
28         use_auto_key = use_auto_key_us = use_auto_key_caps = false;
29         use_auto_key_no_caps = use_auto_key_release =
30         use_auto_key_shift = use_binary_file = false;
31         
32         max_binary = 0;
33         base_binary_num = 0;
34         
35         use_bitmap = false;
36         use_boot_mode = 0;
37
38         use_bubble = false;
39         max_bubble =  max_b77_banks = 0;
40
41         use_cart = false;
42         max_cart = 0;
43         
44         base_cart_num = 0;
45         base_fd_num = 1;
46         base_qd_num = 1;
47         base_hd_num = 1;
48         base_cd_num = 1;
49         base_ld_num = 1;
50         base_binary_num = 1;
51         base_bubble_num = 1;
52
53         use_cpu_type = 0;
54
55         use_compact_disc = use_debugger = false;
56         max_compact_disc = 0;
57         base_cd_num = 0;
58         
59         use_device_type = 0;
60         use_dipswitch = false;
61
62         use_drive_type = 0;
63
64         use_fd = false;
65         base_fd_num = 1;
66         max_drive = max_d88_banks = 0;
67
68         max_draw_ranges = 0;
69         
70         use_hd = false;
71         max_hd = 0;
72         base_hd_num = 1;
73         
74         use_joystick = use_joy_button_captions = false;
75         num_joy_button_captions = 0;
76
77         use_laser_disc = false;
78         max_laser_disc = 0;
79         base_ld_num = 0;
80
81         max_memcard = 0;
82         use_minimum_rendering = use_dig_resolution = false;
83         use_monitor_type = 0;
84         use_mouse = false;
85         use_movie_player = false;
86         use_notify_power_off = false;
87
88         use_one_board_computer = false;
89         use_printer = false;
90         use_printer_type = 0;
91
92         use_qd = false;
93         max_qd = 0;
94         base_qd_num = 1;
95         
96         use_scanline = use_screen_rotate = false;
97         use_shift_numpad_key = false;
98         screen_mode_num = 1;
99
100
101         use_sound_device_type = 0;
102         use_sound_volume = 0;
103         without_sound = false;
104         use_sound_files_fdd = false;
105         use_sound_files_relay = false;
106         
107         use_special_reset = false;
108
109         use_state = false;
110
111         use_tape = use_tape_baud = use_tape_button = use_tape_ptr = false;
112         use_vm_auto_key_table = false;
113         support_tv_render = false;
114         
115         real_screen_width  = SCREEN_WIDTH;
116         real_screen_height = SCREEN_HEIGHT;
117         
118 #if defined(SCREEN_FAKE_WIDTH)
119         screen_width = SCREEN_FAKE_WIDTH;
120 #else
121         screen_width = SCREEN_WIDTH;
122 #endif
123 #if defined(SCREEN_FAKE_HEIGHT)
124         screen_height = SCREEN_FAKE_HEIGHT;
125 #else
126         screen_height = SCREEN_HEIGHT;
127 #endif
128 #if defined(SCREEN_X_ZOOM)
129         screen_x_zoom = SCREEN_X_ZOOM;
130 #endif
131 #if defined(SCREEN_Y_ZOOM)
132         screen_y_zoom = SCREEN_Y_ZOOM;
133 #endif
134         screen_width_aspect = WINDOW_WIDTH_ASPECT;
135         screen_height_aspect = WINDOW_HEIGHT_ASPECT;
136         max_button = 0;
137         vm_buttons_d = NULL;
138
139         use_vertical_pixel_lines = false;
140         notify_key_down_lr_shift = false;
141         tape_binary_only = false;
142 #if defined(DEVICE_NAME)
143         device_name = QString::fromUtf8(DEVICE_NAME);
144 #else
145         device_name = QString::fromUtf8("");
146 #endif
147 #if defined(CONFIG_NAME)
148         config_name = QString::fromUtf8(CONFIG_NAME);
149 #else
150         config_name = QString::fromUtf8("");
151 #endif
152         
153         machine_pasopia_variants = false;
154 #if defined(_PASOPIA7) || defined(_PASOPIA)
155         machine_pasopia_variants = true;
156 #endif
157         machine_tk80_series = false;
158 #if defined(_TK80BS) || defined(_TK80)
159         machine_tk80_series = true;
160 #endif  
161         machine_cmt_mz_series = false;
162 #if defined(_MZ80A) || defined(_MZ80K)  || \
163         defined(_MZ1200) || defined(_MZ700) || \
164         defined(_MZ800) || defined(_MZ1500) || \
165         defined(_MZ80B) || defined(_MZ2000) || \
166         defined(_MZ2200) || defined(_MZ2500)
167         machine_cmt_mz_series = true;
168 #endif
169         machine_pc6001 = false;
170         machine_pc8001_variants = false;
171         machine_mz80a_variants = false;
172         machine_mz80b_variants = false;
173         machine_x1_series = false;
174         machine_fm7_series = false;
175         machine_gamegear = false;
176         machine_mastersystem = false;
177         machine_has_pcengine = false;
178         machine_sc3000 = false;
179         machine_z80tvgame = false;
180         
181 #if defined(_PC6001) || defined(_PC6001MK2) || \
182         defined(_PC6001MK2SR) || \
183         defined(_PC6601) || defined(_PC6601SR)
184         machine_pc6001 = true;
185 #endif
186 #if defined(_PC8001) || defined(PC8001MK2) || \
187         defined(_PC8001SR) || \
188         defined(_PC8801) || defined(_PC8801MK2) || \
189         defined(_PC8801SR) || defined(_PC8801MA)
190         machine_pc8001_variants = true;
191 #endif
192 #if defined(_MZ80A) || defined(_MZ80K)  || \
193         defined(_MZ1200) || defined(_MZ700) || \
194         defined(_MZ800) || defined(_MZ1500)
195         machine_mz80a_variants = true;
196 #endif
197 #if     defined(_MZ80B) || defined(_MZ2000) || \
198         defined(_MZ2200) || defined(_MZ2500)
199         machine_mz80b_variants = true;
200 #endif
201 #if defined(_X1) || defined(_X1TURBO) || \
202         defined(_X1TURBOZ) || defined(_X1TWIN)
203         machine_x1_series = true;
204 #endif
205 #if defined(_FM8) || defined(_FM7) || \
206         defined(_FMNEW7) || defined(_FM77) || \
207         defined(_FM77L2) || defined(_FM77L4) || \
208         defined(_FM77AV) || \
209         defined(_FM77AV20) || defined(_FM77AV20EX) || \
210         defined(_FM77AV40) || defined(_FM77AV40EX) || \
211         defined(_FM77AV40SX)
212         machine_fm7_series = true;
213 #endif  
214 #if defined(_GAMEGEAR)
215         machine_gamegear = true;
216 #endif
217 #if defined(_MASTERSYSTEM)
218         machine_mastersystem = true;
219 #endif
220 #if defined(_PCENGINE) || defined(_X1TWIN)
221         machine_has_pcengine = true;
222 #endif
223 #if defined(_SC3000)
224         machine_sc3000 = true;
225 #endif
226 #if defined(_Z80TVGAME)
227         machine_z80tvgame = true;
228 #endif
229 #if defined(_BMJR)
230         machine_basicmaster_variants = true;
231 #endif
232
233 #if defined(USE_ALT_F10_KEY)    
234         use_alt_f10_key = true;
235 #endif
236 #if defined(USE_AUTO_KEY)
237         use_auto_key = true;
238         #if defined(USE_AUTO_KEY_US)
239                 use_auto_key_us = true;
240         #endif
241         #if defined(USE_AUTO_KEY_CAPS)
242                 use_auto_key_caps = true;
243         #endif
244         #if defined(USE_AUTO_KEY_NO_CAPS)
245                 use_auto_key_no_caps = true;
246         #endif
247         #if defined(USE_AUTO_KEY_RELEASE)
248                 use_auto_key_release = true;
249         #endif
250         #if defined(USE_AUTO_KEY_SHIFT)
251                 use_auto_key_shift = true;
252         #endif
253 #endif
254 #if defined(USE_CART)
255         use_cart = true;
256         max_cart = USE_CART;
257         base_cart_num = BASE_CART_NUM;
258 #endif
259 #if defined(USE_FLOPPY_DISK)
260         use_fd = true;
261         max_drive = USE_FLOPPY_DISK;
262         #if defined(MAX_D88_BANKS)
263                 max_d88_banks = MAX_D88_BANKS;
264         #else
265                 max_d88_banks = 64;
266         #endif
267         base_fd_num = BASE_FLOPPY_DISK_NUM;
268 #endif
269 #if defined(USE_QUICK_DISK)
270         use_qd = true;
271         max_qd = USE_QUICK_DISK;
272         base_qd_num = BASE_QUICK_DISK_NUM;
273 #endif
274 #if defined(USE_HARD_DISK)
275         use_hd = true;
276         max_hd = USE_HARD_DISK;
277         base_hd_num = BASE_HARD_DISK_NUM;
278 #endif
279 #if defined(USE_TAPE)
280         use_tape = true;
281         #if defined(USE_TAPE_BAUD)
282                 use_tape_baud = true;
283         #endif
284         #if defined(USE_TAPE_BUTTON)
285                 use_tape_button = true;
286         #endif
287         #if defined(USE_TAPE_PTR)
288                 use_tape_ptr = true;
289         #endif
290         max_tape = USE_TAPE;
291         base_tape_num = BASE_TAPE_NUM;
292 #endif
293 #if defined(USE_COMPACT_DISC)
294         use_compact_disc = true;
295         max_compact_disc = USE_COMPACT_DISC;
296         base_cd_num = BASE_COMPACT_DISC_NUM;
297 #endif
298 #if defined(USE_LASER_DISC)
299         use_laser_disc = true;
300         max_laser_disc = USE_LASER_DISC;
301         base_ld_num = BASE_LASER_DISC_NUM;
302 #endif
303 #if defined(USE_BINARY_FILE)
304         use_binary_file = true;
305         max_binary = USE_BINARY;
306         base_binary_num = BASE_BINARY_NUM;
307 #endif
308 #if defined(USE_BUBBLE)
309         use_bubble = true;
310         max_bubble = USE_BUBBLE;
311         base_bubble_num = BASE_BUBBLE_NUM;
312         #if defined(MAX_B77_BANKS)
313                 max_b77_banks = MAX_B77_BANKS;
314         #else
315                 max_b77_banks = 16;
316         #endif
317 #endif
318 #if defined(USE_BITMAP)
319         use_bitmap = true;
320 #endif
321 #if defined(USE_BOOT_MODE)
322         use_boot_mode = USE_BOOT_MODE;
323 #endif
324 #if defined(USE_CPU_TYPE)
325         use_cpu_type = USE_CPU_TYPE;
326 #endif
327 #if defined(SUPPORT_TV_RENDER)
328         support_tv_render = true;
329 #endif
330 #if defined(USE_DEBUGGER)
331         use_debugger = true;
332 #endif
333 #if defined(USE_DEVICE_TYPE)
334         use_device_type = USE_DEVICE_TYPE;
335 #endif
336 #if defined(USE_MOUSE_TYPE)
337         use_mouse_type = USE_MOUSE_TYPE;
338 #endif
339 #if defined(USE_JOYSTICK_TYPE)
340         use_joystick_type = USE_JOYSTICK_TYPE;
341 #endif
342 #if defined(USE_KEYBOARD_TYPE)
343         use_keyboard_type = USE_KEYBOARD_TYPE;
344 #endif
345 #if defined(USE_DIPSWITCH)
346         use_dipswitch = true;
347 #endif
348 #if defined(USE_DRIVE_TYPE)
349         use_drive_type = USE_DRIVE_TYPE;
350 #endif
351 #if defined(MAX_DRAW_RANGES)
352         max_draw_ranges = MAX_DRAW_RANGES;
353 #endif
354 #if defined(USE_JOYSTICK)
355         use_joystick = true;
356         #if defined(USE_JOY_BUTTON_CAPTIONS)
357                 use_joy_button_captions = true;
358                 num_joy_button_captions = sizeof(joy_button_captions) / sizeof(_TCHAR *);
359         #endif  
360 #endif
361 #if defined(USE_KEY_LOCKED)
362         use_key_locked = true;
363 #endif
364 #if defined(USE_LED_DEVICE)
365         use_led_devices = USE_LED_DEVICE;
366 #endif
367 #if defined(INDEPENDENT_CAPS_KANA_LED)
368         independent_caps_kana_led = true;
369 #endif
370 #if defined(USE_MEMCARD)
371         use_memcard = USE_MEMCARD;
372 #endif
373 #if defined(USE_MINIMUM_RENDERING)
374         use_minimum_rendering = true;
375 #endif
376 #if defined(USE_DIG_RESOLUTION)
377         use_dig_resolution = true;
378 #endif
379 #if defined(USE_MONITOR_TYPE)
380         use_monitor_type = USE_MONITOR_TYPE;
381 #endif
382
383 #if defined(USE_MOUSE)
384         use_mouse = true;
385 #endif
386 #if defined(USE_MOVIE_PLAYER)
387         use_movie_player = true;
388 #endif
389 #if defined(USE_NOTIFY_POWER_OFF)
390         use_notify_power_off = true;
391 #endif
392 #if defined(ONE_BOARD_MICRO_COMPUTER)
393         use_one_board_computer = true;
394 #endif          
395 #if defined(USE_PRINTER)
396         use_printer = true;
397         #if defined(USE_PRINTER_TYPE)
398                 use_printer_type = USE_PRINTER_TYPE;
399         #endif  
400 #endif
401 #if defined(USE_SCANLINE)
402         use_scanline = true;
403 #endif
404 #if defined(USE_SCREEN_ROTATE)
405         use_screen_rotate = true;
406 #endif
407 #if defined(USE_SHIFT_NUMPAD_KEY)
408         use_shift_numpad_key = true;
409 #endif
410 #if defined(MAX_SCSI)
411         max_scsi = MAX_SCSI;
412 #endif
413 #if defined(USE_SOUND_TYPE)
414         use_sound_device_type = USE_SOUND_TYPE;
415 #endif  
416 #if defined(USE_SOUND_VOLUME)
417         use_sound_volume = USE_SOUND_VOLUME;
418 #endif
419 #if defined(WITHOUT_SOUND)
420         without_sound = true;
421 #endif
422 #if defined(USE_FLOPPY_DISK)
423         use_sound_files_fdd = true;
424 #endif
425 #if defined(USE_TAPE)
426         use_sound_files_relay = true;
427 #endif
428 #if defined(USE_SPECIAL_RESET)
429         use_special_reset = true;
430 #endif  
431 #if defined(USE_VM_AUTO_KEY_TABLE)
432         use_vm_auto_key_table = true;
433 #endif
434 #if defined(MAX_BUTTONS)
435         max_button = sizeof(vm_buttons) / sizeof(button_desc_t);
436         vm_buttons_d = (button_desc_t *)vm_buttons;
437 #endif
438 #if defined(MAX_DRAW_RANGES)
439         max_ranges = sizeof(vm_ranges) / sizeof(vm_ranges_t);
440         vm_ranges_d = (vm_ranges_t *)vm_ranges;
441 #endif
442         
443 #if defined(USE_VERTICAL_PIXEL_LINES)
444         use_vertical_pixel_lines = true;
445 #endif
446 #if defined(NOTIFY_KEY_DOWN_LR_SHIFT)
447         notify_key_down_lr_shift = true;
448 #endif
449 #if defined(TAPE_BINARY_ONLY)
450         tape_binary_only = true;
451 #endif  
452 #if defined(_SCREEN_MODE_NUM)
453         screen_mode_num = _SCREEN_MODE_NUM;
454 #endif
455 #if defined(USE_STATE)
456         use_state = true;
457 #endif   
458         p_config = cfg;
459 }
460
461 USING_FLAGS_EXT::~USING_FLAGS_EXT()
462 {
463 }
464
465 const _TCHAR *USING_FLAGS_EXT::get_joy_button_captions(int num)
466 {
467 #ifdef USE_JOY_BUTTON_CAPTIONS
468         if((num < 0) || (num >= num_joy_button_captions)) {
469                 return "";
470         } else  {
471                 return joy_button_captions[num];
472         }
473 #else
474         return "";
475 #endif  
476 }
477
478 const _TCHAR *USING_FLAGS_EXT::get_sound_device_caption(int num)
479 {
480 #ifdef USE_SOUND_VOLUME
481         if((num < 0) || (num >= USE_SOUND_VOLUME)) {
482                 return "";
483         } else  {
484                 return sound_device_caption[num];
485         }
486 #else
487         return "";
488 #endif  
489 }
490
491
492 int USING_FLAGS_EXT::get_s_freq_table(int num)
493 {
494         if(num < 0) return s_freq_table[0];
495         if(num >= (int)(sizeof(s_freq_table) / sizeof(int))) return s_freq_table[sizeof(s_freq_table) / sizeof(int) - 1];
496         return s_freq_table[num];
497 }
498                                                                                                                                                 
499 int USING_FLAGS_EXT::get_vm_node_size(void)
500 {
501         if(p_emu == NULL) return 0;
502         return p_emu->get_osd()->get_vm_node_size();
503 }
504
505 void USING_FLAGS_EXT::set_vm_node_name(int id, const _TCHAR *name)
506 {
507         if(p_emu == NULL) return;
508         p_emu->get_osd()->set_vm_node(id, name);
509 }
510
511 _TCHAR *USING_FLAGS_EXT::get_vm_node_name(int id)
512 {
513         if(p_emu == NULL) return NULL;
514         return (_TCHAR *)p_emu->get_osd()->get_vm_node_name(id);
515 }