1 /***********************************************************************
2 * ��˥塼�С�����
3 ************************************************************************/
4
5 #include "quasi88.h"
6 #include "device.h"
7 #include "event.h"
8
9 #include "initval.h"
10 #include "pc88main.h" /* boot_basic, ... */
11 #include "memory.h" /* use_pcg */
12 #include "soundbd.h" /* sound_board */
13 #include "intr.h" /* cpu_clock_mhz */
14 #include "keyboard.h" /* mouse_mode */
15 #include "fdc.h" /* fdc_wait */
16 #include "getconf.h" /* config_save */
17 #include "screen.h" /* SCREEN_INTERLACE_NO ... */
18 #include "emu.h" /* cpu_timing, emu_reset() */
19 #include "menu.h" /* menu_sound_restart() */
20 #include "drive.h"
21 #include "snddrv.h"
22
23 #include "resource.h"
24
25
26 static int menubar_active = TRUE;
27
28 static T_RESET_CFG menubar_reset_cfg;
29
30 static int menubar_images[NR_DRIVE];
31
32
33 /****************************************************************************
34 * �⡼���ڤ��ؤ����Ρ���˥塼�С��ν���������
35 * ���ߥ�⡼�ɤȥ�˥塼�⡼�ɤǡ���˥塼�С������Ƥ��ѹ�����
36 *****************************************************************************/
37 static void menubar_item_setup(void);
38 static void menubar_item_sensitive(int sensitive);
39
menubar_setup(int active)40 void menubar_setup(int active)
41 {
42 if (active) {
43
44 /* ��˥塼�С������Ƥ����� */
45 menubar_item_setup();
46
47 /* �Ȥ��ʤ��������ܤ�Ȥ���褦�ˤ��� (���ߥ�⡼�ɳ��ϻ�) */
48 menubar_item_sensitive(TRUE);
49
50 menubar_active = TRUE;
51
52 } else {
53
54 /* �ۤȤ�ɤι��ܤ�Ȥ��ʤ����� (��˥塼�⡼�ɳ��ϻ�) */
55 menubar_item_sensitive(FALSE);
56
57 menubar_active = FALSE;
58 }
59 }
60
61
62
63
64
65
66 /* ��˥塼�����ƥ��ʸ������ѹ� */
change_menuitem_label(UINT uItem,char * s)67 static void change_menuitem_label(UINT uItem, char *s)
68 {
69 MENUITEMINFO menuInfo;
70
71 memset(&menuInfo, 0, sizeof(menuInfo));
72 menuInfo.cbSize = sizeof(menuInfo);
73
74 menuInfo.fMask = MIIM_TYPE;
75 menuInfo.fType = MFT_STRING;
76 menuInfo.dwTypeData = s;
77 /*
78 menuInfo.cch = strlen(s);
79 */
80
81 SetMenuItemInfo(g_hMenu, uItem, FALSE, &menuInfo);
82 }
83
84
85 /* ��˥塼�����ƥ��ʸ������ѹ� �� ���Σ� �� */
change_menuitem_label2(UINT uItem,char * s)86 static void change_menuitem_label2(UINT uItem, char *s)
87 {
88 MENUITEMINFO menuInfo;
89
90 memset(&menuInfo, 0, sizeof(menuInfo));
91 menuInfo.cbSize = sizeof(menuInfo);
92
93 menuInfo.fMask = MIIM_TYPE;
94 menuInfo.fType = MFT_STRING;
95 menuInfo.dwTypeData = s;
96 /*
97 menuInfo.cch = strlen(s);
98 */
99
100 SetMenuItemInfo(GetSubMenu(g_hMenu, 2), uItem, TRUE, &menuInfo);
101 }
102
103
104 /* �ե������������������ɽ��������������� */
select_file(int for_read,const char * title,const char * filter,const char * def_ext,int flag,char fullname[],int n_fullname)105 static int select_file(int for_read,
106 const char *title,
107 const char *filter,
108 const char *def_ext,
109 int flag,
110 char fullname[],
111 int n_fullname)
112 {
113 OPENFILENAME ofn;
114 char name[QUASI88_MAX_FILENAME]; /* �ѥ��ʤ��ե�����̾ */
115 int result;
116
117 memset(fullname, 0, n_fullname); /* �ѥ�����ե�����̾ */
118 memset(name, 0, sizeof(name));
119 memset(&ofn, 0, sizeof(ofn));
120
121 ofn.lStructSize = sizeof(ofn); /* ��¤�Υ����� */
122 ofn.hwndOwner = g_hWnd; /* ������ɥ��ϥ�ɥ� */
123 ofn.lpstrFilter = filter; /* �ե��륿�� */
124 ofn.lpstrFile = fullname; /* �ե�ѥ�̾�Хåե� */
125 ofn.nMaxFile = n_fullname; /* �������� */
126 ofn.lpstrFileTitle = name; /* �ե�����̾�Хåե� */
127 ofn.nMaxFileTitle = sizeof(name); /* �������� */
128 ofn.lpstrTitle = title; /* ������ɥ������ȥ� */
129 ofn.Flags = flag; /* �Ƽ�ե饰 */
130 ofn.lpstrDefExt = def_ext; /* ���ϻ��˼�ư�ɲä�����ĥ�� */
131
132 if (for_read) {
133 result = GetOpenFileName(&ofn);
134 } else {
135 result = GetSaveFileName(&ofn);
136 }
137 if (result) {
138 if (ofn.Flags & OFN_READONLY) { return -1; } /* ReadOnly ������ */
139 else { return 1; } /* ReadWrite ������ */
140 }
141 return 0; /* �ե��������� */
142 }
143
144
145
146
147
148
149 /* Reset ��˥塼�����ƥ�Υ�٥������ */
update_sys_reset(void)150 static void update_sys_reset(void)
151 {
152 char buf[32];
153
154 strcpy(buf, "Reset [");
155
156 switch (menubar_reset_cfg.boot_basic) {
157 case BASIC_V2: strcat(buf, "V2"); break;
158 case BASIC_V1H: strcat(buf, "V1H"); break;
159 case BASIC_V1S: strcat(buf, "V1S"); break;
160 case BASIC_N: strcat(buf, "N"); break;
161 }
162
163 strcat(buf, " : ");
164
165 switch (menubar_reset_cfg.boot_clock_4mhz) {
166 case CLOCK_4MHZ: strcat(buf, "4MHz"); break;
167 case CLOCK_8MHZ: strcat(buf, "8MHz"); break;
168 }
169
170 strcat(buf, "]");
171
172 change_menuitem_label(M_SYS_RESET, buf);
173 }
174
175
176
177 /* Drive ��˥塼�����ƥ��������������� */
update_drive(void)178 static void update_drive(void)
179 {
180 UINT uItem;
181 char buf[64];
182 int i;
183 int drv, base, tag;
184 int has_image = FALSE;
185
186 /* ����������˥塼�����ƥ�������롣*/
187
188 for (drv = 0; drv < NR_DRIVE; drv ++) {
189 base = (drv == DRIVE_1) ? M_DRV_DRV1_1 : M_DRV_DRV2_1;
190
191 for (i = 0; i< menubar_images[drv]; i++) {
192 uItem = i + base;
193
194 DeleteMenu(g_hMenu, uItem, MF_BYCOMMAND);
195 }
196 menubar_images[drv] = 0;
197 }
198
199 /* �ɥ饤�֤Υ�����˱����ơ���˥塼�����ƥ���������� */
200
201 for (drv = 0; drv < NR_DRIVE; drv ++) {
202 base = (drv == DRIVE_1) ? M_DRV_DRV1_1 : M_DRV_DRV2_1;
203 tag = (drv == DRIVE_1) ? M_DRV_DRV1_NO : M_DRV_DRV2_NO;
204
205 if (disk_image_exist(drv)) {
206
207 /* ������ο���ʬ���������롣*/
208 for (i = 0; i < MIN(disk_image_num(drv), 9); i++) {
209 uItem = i + base;
210
211 sprintf(buf, "%d ", i + 1);
212 my_strncat(buf, drive[drv].image[i].name, sizeof(buf));
213
214 InsertMenu(g_hMenu, tag, MF_BYCOMMAND | MFT_STRING,
215 uItem, buf);
216 }
217 menubar_images[drv] = i;
218 has_image = TRUE;
219
220 } else {
221
222 menubar_images[drv] = 0;
223 }
224
225 /* �����楤����Ρ��饸���ܥ��������å����� */
226
227 if (disk_image_exist(drv) == FALSE || /* �ե�����ʤ� or */
228 drive_check_empty(drv)) { /* �������� */
229
230 uItem = tag; /* �� NO Disk */
231
232 } else {
233 i = disk_image_selected(drv);
234 if (0 <= i && i <= 9) { /* 1��9�������� */
235 uItem = i + base; /* �� ����� */
236 } else { /* 10���ܡ� */
237 uItem = 0; /* �� �ʤ� */
238 }
239 }
240 CheckMenuRadioItem(g_hMenu,
241 base,
242 tag,
243 uItem,
244 MF_BYCOMMAND);
245 }
246
247 /* ��˥塼��̾�����Ѥ����ꡢ̵���ˤ����� */
248
249 for (drv = 0; drv < NR_DRIVE; drv ++) {
250 const char *s;
251 s = filename_get_disk_name(drv);
252
253 if (s) {
254 sprintf(buf, "Drive %d: ", drv + 1);
255 my_strncat(buf, s, sizeof(buf));
256 } else {
257 sprintf(buf, "Drive %d:", drv + 1);
258 }
259 change_menuitem_label2(drv, buf);
260 }
261
262 change_menuitem_label(M_DRV_CHG, (has_image) ? "Change ..." : "Set ...");
263 EnableMenuItem(g_hMenu, M_DRV_UNSET,
264 MF_BYCOMMAND | ((has_image) ? MFS_ENABLED : MFS_GRAYED));
265
266 DrawMenuBar(g_hWnd);
267 }
268
269 /* Tape Load ��˥塼�����ƥ�Υ�٥���Ѥ���������ԲĤˤ����� */
update_misc_cload(void)270 static void update_misc_cload(void)
271 {
272 UINT uItem;
273 const char *s;
274 char buf[64];
275
276 s = filename_get_tape_name(CLOAD);
277
278 /* �ơ��פ���ʤ�ե�����̾�ʤ��ʤ�ǥե���ȤΥ�٥��ɽ�� */
279 uItem = M_MISC_CLOAD_S;
280 {
281 if (s) { my_strncpy(buf, s, sizeof(buf)); }
282 else { strcpy(buf, "Set ..."); }
283 change_menuitem_label(uItem, buf);
284 }
285
286 /* �ơ��פ���ʤ顢�饸����˥塼���ƥ��֤� */
287 uItem = M_MISC_CLOAD_S;
288 CheckMenuItem(g_hMenu, uItem,
289 MF_BYCOMMAND | ((s) ? MFS_CHECKED : MFS_UNCHECKED));
290
291 /* �ơ��פ���ʤ� unset ��ɽ�����ʤ��ʤ鱣�� */
292 uItem = M_MISC_CLOAD_U;
293 EnableMenuItem(g_hMenu, uItem,
294 MF_BYCOMMAND | ((s) ? MFS_ENABLED : MFS_GRAYED));
295
296 DrawMenuBar(g_hWnd);
297 }
298
299 /* Tape Save ��˥塼�����ƥ�Υ�٥���Ѥ���������ԲĤˤ����� */
update_misc_csave(void)300 static void update_misc_csave(void)
301 {
302 UINT uItem;
303 const char *s;
304 char buf[64];
305
306 s = filename_get_tape_name(CSAVE);
307
308 /* �ơ��פ���ʤ�ե�����̾�ʤ��ʤ�ǥե���ȤΥ�٥��ɽ�� */
309 uItem = M_MISC_CSAVE_S;
310 {
311 if (s) { my_strncpy(buf, s, sizeof(buf)); }
312 else { strcpy(buf, "Set ..."); }
313 change_menuitem_label(uItem, buf);
314 }
315
316 /* �ơ��פ���ʤ顢�饸����˥塼���ƥ��֤� */
317 uItem = M_MISC_CSAVE_S;
318 CheckMenuItem(g_hMenu, uItem,
319 MF_BYCOMMAND | ((s) ? MFS_CHECKED : MFS_UNCHECKED));
320
321 /* �ơ��פ���ʤ� unset ��ɽ�����ʤ��ʤ鱣�� */
322 uItem = M_MISC_CSAVE_U;
323 EnableMenuItem(g_hMenu, uItem,
324 MF_BYCOMMAND | ((s) ? MFS_ENABLED : MFS_GRAYED));
325
326 DrawMenuBar(g_hWnd);
327 }
328
329 /* Sound Record ��˥塼�����ƥ�Υ����å����ѹ����� */
update_misc_record(void)330 static void update_misc_record(void)
331 {
332 UINT uItem;
333 int i;
334
335 i = xmame_wavout_opened();
336 uItem = M_MISC_RECORD;
337 CheckMenuItem(g_hMenu, uItem,
338 MF_BYCOMMAND | (i ? MFS_CHECKED : MFS_UNCHECKED));
339 }
340
341
342
343
344 /*======================================================================
345 * ��˥塼�С������Ƥ�ƽ����
346 *======================================================================*/
menubar_item_setup(void)347 static void menubar_item_setup(void)
348 {
349 UINT uItem;
350 int i;
351 MENUITEMINFO menuInfo;
352
353 memset(&menuInfo, 0, sizeof(menuInfo));
354 menuInfo.cbSize = sizeof(menuInfo);
355 menuInfo.fMask = MIIM_STATE;
356 menuInfo.fState = MFS_GRAYED;
357
358 /* System -----------------------------------------------------------*/
359
360 quasi88_get_reset_cfg(&menubar_reset_cfg);
361
362 switch (menubar_reset_cfg.boot_basic) {
363 case BASIC_V2: uItem = M_SYS_MODE_V2; break;
364 case BASIC_V1H: uItem = M_SYS_MODE_V1H; break;
365 case BASIC_V1S: uItem = M_SYS_MODE_V1S; break;
366 case BASIC_N: uItem = M_SYS_MODE_N; break;
367 }
368 CheckMenuRadioItem(g_hMenu, M_SYS_MODE_V2, M_SYS_MODE_N, uItem,
369 MF_BYCOMMAND);
370
371 switch (menubar_reset_cfg.boot_clock_4mhz) {
372 case CLOCK_4MHZ: uItem = M_SYS_MODE_4MH; break;
373 case CLOCK_8MHZ: uItem = M_SYS_MODE_8MH; break;
374 }
375 CheckMenuRadioItem(g_hMenu, M_SYS_MODE_4MH, M_SYS_MODE_8MH, uItem,
376 MF_BYCOMMAND);
377
378 switch (menubar_reset_cfg.sound_board) {
379 case SOUND_I: uItem = M_SYS_MODE_SB; break;
380 case SOUND_II: uItem = M_SYS_MODE_SB2; break;
381 }
382 CheckMenuRadioItem(g_hMenu, M_SYS_MODE_SB, M_SYS_MODE_SB2, uItem,
383 MF_BYCOMMAND);
384
385 update_sys_reset();
386
387 /* Setting ----------------------------------------------------------*/
388
389 i = quasi88_cfg_now_wait_rate(); /* �������� */
390 switch (i) {
391 case 25: uItem = M_SET_SPD_25; break;
392 case 50: uItem = M_SET_SPD_50; break;
393 case 100: uItem = M_SET_SPD_100; break;
394 case 200: uItem = M_SET_SPD_200; break;
395 case 400: uItem = M_SET_SPD_400; break;
396 default: uItem = 0; break;
397 }
398 CheckMenuRadioItem(g_hMenu, M_SET_SPD_25, M_SET_SPD_400, uItem,
399 MF_BYCOMMAND);
400 /* uItem == 0 �λ��� CheckMenuRadioItem() �ϥ��顼�ˤʤ롣
401 ��̡����٤ƥ����å�������롣�� ����ʤ�Ǥ����Τ��� */
402
403 i = quasi88_cfg_now_no_wait(); /* �������� */
404 uItem = M_SET_SPD_MAX;
405 CheckMenuItem(g_hMenu, uItem,
406 MF_BYCOMMAND | (i ? MFS_CHECKED : MFS_UNCHECKED));
407
408 i = cpu_timing; /* �������� */
409 switch (i) {
410 case 0: uItem = M_SET_SUB_SOME; break;
411 case 1: uItem = M_SET_SUB_OFT; break;
412 case 2: uItem = M_SET_SUB_ALL; break;
413 default: uItem = 0; break;
414 }
415 CheckMenuRadioItem(g_hMenu, M_SET_SUB_SOME, M_SET_SUB_ALL, uItem,
416 MF_BYCOMMAND);
417
418 i = fdc_wait; /* �������� */
419 uItem = M_SET_FDCWAIT;
420 CheckMenuItem(g_hMenu, uItem,
421 MF_BYCOMMAND | (i ? MFS_CHECKED : MFS_UNCHECKED));
422
423 i = quasi88_cfg_now_frameskip_rate(); /* �������� */
424 switch (i) {
425 case 1: uItem = M_SET_REF_60; break;
426 case 2: uItem = M_SET_REF_30; break;
427 case 3: uItem = M_SET_REF_20; break;
428 case 4: uItem = M_SET_REF_15; break;
429 default: uItem = 0; break;
430 }
431 CheckMenuRadioItem(g_hMenu, M_SET_REF_60, M_SET_REF_15, uItem,
432 MF_BYCOMMAND);
433
434 i = quasi88_cfg_now_interlace(); /* �������� */
435 switch (i) {
436 case SCREEN_INTERLACE_NO: uItem = M_SET_INT_NO; break;
437 case SCREEN_INTERLACE_SKIP: uItem = M_SET_INT_SKIP; break;
438 case SCREEN_INTERLACE_YES: uItem = M_SET_INT_YES; break;
439 default: uItem = 0; break;
440 }
441 CheckMenuRadioItem(g_hMenu, M_SET_INT_NO, M_SET_INT_YES, uItem,
442 MF_BYCOMMAND);
443
444 i = quasi88_cfg_now_size(); /* �������� */
445 switch (i) {
446 case SCREEN_SIZE_FULL: uItem = M_SET_SIZ_FULL; break;
447 case SCREEN_SIZE_HALF: uItem = M_SET_SIZ_HALF; break;
448 default: uItem = 0; break;
449 }
450 CheckMenuRadioItem(g_hMenu, M_SET_SIZ_FULL, M_SET_SIZ_HALF, uItem,
451 MF_BYCOMMAND);
452
453 i = use_pcg; /* �������� */
454 uItem = M_SET_PCG;
455 CheckMenuItem(g_hMenu, uItem,
456 MF_BYCOMMAND | (i ? MFS_CHECKED : MFS_UNCHECKED));
457
458 i = mouse_mode; /* �������� */
459 switch (i) {
460 case MOUSE_NONE: uItem = M_SET_MO_NO; break;
461 case MOUSE_MOUSE: uItem = M_SET_MO_MOUSE; break;
462 case MOUSE_JOYMOUSE: uItem = M_SET_MO_JOYMO; break;
463 case MOUSE_JOYSTICK: uItem = M_SET_MO_JOY; break;
464 default: uItem = 0; break;
465 }
466 CheckMenuRadioItem(g_hMenu, M_SET_MO_NO, M_SET_MO_JOY, uItem,
467 MF_BYCOMMAND);
468
469 i = cursor_key_mode; /* �������� */
470 switch (i) {
471 case 0: uItem = M_SET_CUR_DEF; break;
472 case 1: uItem = M_SET_CUR_TEN; break;
473 default: uItem = 0; break;
474 }
475 CheckMenuRadioItem(g_hMenu, M_SET_CUR_DEF, M_SET_CUR_TEN, uItem,
476 MF_BYCOMMAND);
477
478 i = numlock_emu; /* �������� */
479 uItem = M_SET_NUMLOCK;
480 CheckMenuItem(g_hMenu, uItem,
481 MF_BYCOMMAND | (i ? MFS_CHECKED : MFS_UNCHECKED));
482
483 i = romaji_input_mode; /* �������� */
484 uItem = M_SET_ROMAJI;
485 CheckMenuItem(g_hMenu, uItem,
486 MF_BYCOMMAND | (i ? MFS_CHECKED : MFS_UNCHECKED));
487
488 #ifdef USE_SOUND
489 if (xmame_has_sound()) {
490 #ifdef USE_FMGEN
491 i = xmame_cfg_get_use_fmgen(); /* �������� */
492 switch (i) {
493 case 0: uItem = M_SET_FM_MAME; break;
494 case 1: uItem = M_SET_FM_FMGEN; break;
495 default: uItem = 0; break;
496 }
497 CheckMenuRadioItem(g_hMenu, M_SET_FM_MAME, M_SET_FM_FMGEN, uItem,
498 MF_BYCOMMAND);
499 #endif
500
501 i = xmame_cfg_get_sample_freq(); /* �������� */
502 switch (i) {
503 case 48000: uItem = M_SET_FRQ_48; break;
504 case 44100: uItem = M_SET_FRQ_44; break;
505 case 22050: uItem = M_SET_FRQ_22; break;
506 case 11025: uItem = M_SET_FRQ_11; break;
507 default: uItem = 0; break;
508 }
509 CheckMenuRadioItem(g_hMenu, M_SET_FRQ_48, M_SET_FRQ_11, uItem,
510 MF_BYCOMMAND);
511
512 if (xmame_has_audiodevice()) {
513 i = g_pcm_bufsize; /* �������� */
514 switch (i) {
515 case 800: uItem = M_SET_BUF_800; break;
516 case 400: uItem = M_SET_BUF_400; break;
517 case 200: uItem = M_SET_BUF_200; break;
518 case 100: uItem = M_SET_BUF_100; break;
519 default: uItem = 0; break;
520 }
521 CheckMenuRadioItem(g_hMenu, M_SET_BUF_800, M_SET_BUF_100, uItem,
522 MF_BYCOMMAND);
523 } else {
524 #ifdef USE_FMGEN
525 SetMenuItemInfo(GetSubMenu(g_hMenu, 1), 16, TRUE, &menuInfo);
526 #else
527 SetMenuItemInfo(GetSubMenu(g_hMenu, 1), 15, TRUE, &menuInfo);
528 #endif
529 }
530 } else {
531 #ifdef USE_FMGEN
532 SetMenuItemInfo(GetSubMenu(g_hMenu, 1), 14, TRUE, &menuInfo);
533 SetMenuItemInfo(GetSubMenu(g_hMenu, 1), 15, TRUE, &menuInfo);
534 SetMenuItemInfo(GetSubMenu(g_hMenu, 1), 16, TRUE, &menuInfo);
535 #else
536 /* ��˥塼���֤�����롦���� */
537 SetMenuItemInfo(GetSubMenu(g_hMenu, 1), 14, TRUE, &menuInfo);
538 SetMenuItemInfo(GetSubMenu(g_hMenu, 1), 15, TRUE, &menuInfo);
539 #endif
540 }
541 #endif
542
543 /* Drive ------------------------------------------------------------*/
544
545 update_drive();
546
547 /* Misc -------------------------------------------------------------*/
548
549 if (xmame_has_sound()) {
550 i = xmame_wavout_opened();
551 uItem = M_MISC_RECORD;
552 CheckMenuItem(g_hMenu, uItem,
553 MF_BYCOMMAND | (i ? MFS_CHECKED : MFS_UNCHECKED));
554 } else {
555 SetMenuItemInfo(GetSubMenu(g_hMenu, 3), 1, TRUE, &menuInfo);
556 }
557
558 update_misc_cload();
559
560 update_misc_csave();
561
562 i = quasi88_cfg_now_showstatus();
563 uItem = M_MISC_STATUS;
564 CheckMenuItem(g_hMenu, uItem,
565 MF_BYCOMMAND | (i ? MFS_CHECKED : MFS_UNCHECKED));
566 }
567
568 /*======================================================================
569 * ��˥塼�С����Ѳ�ǽ���ܤ�����
570 *
571 * [System] [Setting] [Drive] [Misc] [Help]
572 * 0 1 2 3 4
573 * * * *
574 *
575 * * �����ԲĤˤ����о�
576 *
577 * [System]
578 * Reset 0 *
579 * [Mode] 1 *
580 * ------ 2
581 * V2 3 *
582 * V1H 4 *
583 * V1S 5 *
584 * ------ 6
585 * Menu 7 *
586 * ------ 8
587 * Save 9 *
588 * Exit 10
589 *
590 * * �����ԲĤˤ����о�
591 *
592 * ��Τ��� Reset �ʤɤΤ褦�˥�˥塼ID�������Τϡ�ľ������Ǥ��뤬
593 * �ݥåץ��åץ�˥塼�ϥ�˥塼ID��̵���Τǡ����֤����椷�ʤ��Ȥ��ᡣ
594 * ����Ϥ��٤ư��֤����椷�褦�� (�ʤˤ���ˡ������ΤǤϡ�)
595 *======================================================================*/
menubar_item_sensitive(int sensitive)596 static void menubar_item_sensitive(int sensitive)
597 {
598 MENUITEMINFO menuInfo;
599
600 memset(&menuInfo, 0, sizeof(menuInfo));
601 menuInfo.cbSize = sizeof(menuInfo);
602
603 menuInfo.fMask = MIIM_STATE;
604 menuInfo.fState = (sensitive) ? MFS_ENABLED : MFS_GRAYED;
605
606 SetMenuItemInfo(g_hMenu, 1, TRUE, &menuInfo);
607 SetMenuItemInfo(g_hMenu, 2, TRUE, &menuInfo);
608 SetMenuItemInfo(g_hMenu, 3, TRUE, &menuInfo);
609
610 SetMenuItemInfo(GetSubMenu(g_hMenu, 0), 0, TRUE, &menuInfo);
611 SetMenuItemInfo(GetSubMenu(g_hMenu, 0), 1, TRUE, &menuInfo);
612 SetMenuItemInfo(GetSubMenu(g_hMenu, 0), 3, TRUE, &menuInfo);
613 SetMenuItemInfo(GetSubMenu(g_hMenu, 0), 4, TRUE, &menuInfo);
614 SetMenuItemInfo(GetSubMenu(g_hMenu, 0), 5, TRUE, &menuInfo);
615 SetMenuItemInfo(GetSubMenu(g_hMenu, 0), 7, TRUE, &menuInfo);
616 SetMenuItemInfo(GetSubMenu(g_hMenu, 0), 9, TRUE, &menuInfo);
617
618 DrawMenuBar(g_hWnd);
619 }
620
621
622 /***********************************************************************
623 * ��˥塼�С�������Хå��ؿ�
624 ************************************************************************/
625
626 static void f_sys_reset (void);
627 static void f_sys_basic (UINT uItem, int data);
628 static void f_sys_clock (UINT uItem, int data);
629 static void f_sys_sb (UINT uItem, int data);
630 static void f_sys_menu (void);
631 static void f_sys_save (void);
632 static void f_sys_exit (void);
633 static void f_set_speed (UINT uItem, int data);
634 static void f_set_nowait (UINT uItem);
635 static void f_set_subcpu (UINT uItem, int data);
636 static void f_set_fdcwait (UINT uItem);
637 static void f_set_refresh (UINT uItem, int data);
638 static void f_set_interlace (UINT uItem, int data);
639 static void f_set_size (UINT uItem, int data);
640 static void f_set_pcg (UINT uItem);
641 static void f_set_mouse (UINT uItem, int data);
642 static void f_set_cursor (UINT uItem, int data);
643 static void f_set_numlock (UINT uItem);
644 static void f_set_romaji (UINT uItem);
645 static void f_set_fm (UINT uItem, int data);
646 static void f_set_frq (UINT uItem, int data);
647 static void f_set_buf (UINT uItem, int data);
648 static void f_drv_chg (int data);
649 static void f_drv_drv1 (UINT uItem, int data);
650 static void f_drv_drv2 (UINT uItem, int data);
651 static void f_drv_unset (void);
652 static void f_misc_capture (void);
653 static void f_misc_record (UINT uItem);
654 static void f_misc_cload_s (void);
655 static void f_misc_cload_u (void);
656 static void f_misc_csave_s (void);
657 static void f_misc_csave_u (void);
658 static void f_misc_sload (int data);
659 static void f_misc_ssave (int data);
660 static void f_misc_status (UINT uItem);
661 static void f_help_about (void);
662
663
664
menubar_event(int id)665 int menubar_event(int id)
666 {
667 switch (id) {
668 case M_SYS_RESET: f_sys_reset(); break;
669 case M_SYS_MENU: f_sys_menu(); break;
670 case M_SYS_SAVE: f_sys_save(); break;
671 case M_SYS_EXIT: f_sys_exit(); break;
672
673 case M_SYS_RESET_V2: f_sys_basic(M_SYS_MODE_V2, BASIC_V2);
674 f_sys_reset(); break;
675 case M_SYS_RESET_V1H: f_sys_basic(M_SYS_MODE_V1H, BASIC_V1H);
676 f_sys_reset(); break;
677 case M_SYS_RESET_V1S: f_sys_basic(M_SYS_MODE_V1S, BASIC_V1S);
678 f_sys_reset(); break;
679
680 case M_SYS_MODE_V2: f_sys_basic(id, BASIC_V2); break;
681 case M_SYS_MODE_V1H: f_sys_basic(id, BASIC_V1H); break;
682 case M_SYS_MODE_V1S: f_sys_basic(id, BASIC_V1S); break;
683 case M_SYS_MODE_N: f_sys_basic(id, BASIC_N); break;
684
685 case M_SYS_MODE_4MH: f_sys_clock(id, CLOCK_4MHZ); break;
686 case M_SYS_MODE_8MH: f_sys_clock(id, CLOCK_8MHZ); break;
687
688 case M_SYS_MODE_SB: f_sys_sb(id, SOUND_I); break;
689 case M_SYS_MODE_SB2: f_sys_sb(id, SOUND_II); break;
690
691
692
693 case M_SET_SPD_25: f_set_speed(id, 25); break;
694 case M_SET_SPD_50: f_set_speed(id, 50); break;
695 case M_SET_SPD_100: f_set_speed(id, 100); break;
696 case M_SET_SPD_200: f_set_speed(id, 200); break;
697 case M_SET_SPD_400: f_set_speed(id, 400); break;
698
699 case M_SET_SPD_MAX: f_set_nowait(id); break;
700
701 case M_SET_SUB_SOME: f_set_subcpu(id, 0); break;
702 case M_SET_SUB_OFT: f_set_subcpu(id, 1); break;
703 case M_SET_SUB_ALL: f_set_subcpu(id, 2); break;
704
705 case M_SET_FDCWAIT: f_set_fdcwait(id); break;
706
707 case M_SET_REF_60: f_set_refresh(id, 1); break;
708 case M_SET_REF_30: f_set_refresh(id, 2); break;
709 case M_SET_REF_20: f_set_refresh(id, 3); break;
710 case M_SET_REF_15: f_set_refresh(id, 4); break;
711
712 case M_SET_INT_NO: f_set_interlace(id, SCREEN_INTERLACE_NO); break;
713 case M_SET_INT_SKIP: f_set_interlace(id, SCREEN_INTERLACE_SKIP); break;
714 case M_SET_INT_YES: f_set_interlace(id, SCREEN_INTERLACE_YES); break;
715
716 case M_SET_SIZ_FULL: f_set_size(id, SCREEN_SIZE_FULL); break;
717 case M_SET_SIZ_HALF: f_set_size(id, SCREEN_SIZE_HALF); break;
718
719 case M_SET_PCG: f_set_pcg(id); break;
720
721 case M_SET_MO_NO: f_set_mouse(id, MOUSE_NONE); break;
722 case M_SET_MO_MOUSE: f_set_mouse(id, MOUSE_MOUSE); break;
723 case M_SET_MO_JOYMO: f_set_mouse(id, MOUSE_JOYMOUSE); break;
724 case M_SET_MO_JOY: f_set_mouse(id, MOUSE_JOYSTICK); break;
725
726 case M_SET_CUR_DEF: f_set_cursor(id, 0); break;
727 case M_SET_CUR_TEN: f_set_cursor(id, 1); break;
728
729 case M_SET_NUMLOCK: f_set_numlock(id); break;
730 case M_SET_ROMAJI: f_set_romaji(id); break;
731
732 #ifdef USE_SOUND
733 #ifdef USE_FMGEN
734 case M_SET_FM_MAME: f_set_fm(id, 0); break;
735 case M_SET_FM_FMGEN: f_set_fm(id, 1); break;
736 #endif
737 case M_SET_FRQ_48: f_set_frq(id, 48000); break;
738 case M_SET_FRQ_44: f_set_frq(id, 44100); break;
739 case M_SET_FRQ_22: f_set_frq(id, 22050); break;
740 case M_SET_FRQ_11: f_set_frq(id, 11025); break;
741
742 case M_SET_BUF_800: f_set_buf(id, 800); break;
743 case M_SET_BUF_400: f_set_buf(id, 400); break;
744 case M_SET_BUF_200: f_set_buf(id, 200); break;
745 case M_SET_BUF_100: f_set_buf(id, 100); break;
746 #endif
747
748 case M_DRV_DRV1_1: f_drv_drv1(id, 0); break;
749 case M_DRV_DRV1_2: f_drv_drv1(id, 1); break;
750 case M_DRV_DRV1_3: f_drv_drv1(id, 2); break;
751 case M_DRV_DRV1_4: f_drv_drv1(id, 3); break;
752 case M_DRV_DRV1_5: f_drv_drv1(id, 4); break;
753 case M_DRV_DRV1_6: f_drv_drv1(id, 5); break;
754 case M_DRV_DRV1_7: f_drv_drv1(id, 6); break;
755 case M_DRV_DRV1_8: f_drv_drv1(id, 7); break;
756 case M_DRV_DRV1_9: f_drv_drv1(id, 8); break;
757 case M_DRV_DRV1_NO: f_drv_drv1(id, -1); break;
758 case M_DRV_DRV1_CHG: f_drv_chg(DRIVE_1); break;
759
760 case M_DRV_DRV2_1: f_drv_drv2(id, 0); break;
761 case M_DRV_DRV2_2: f_drv_drv2(id, 1); break;
762 case M_DRV_DRV2_3: f_drv_drv2(id, 2); break;
763 case M_DRV_DRV2_4: f_drv_drv2(id, 3); break;
764 case M_DRV_DRV2_5: f_drv_drv2(id, 4); break;
765 case M_DRV_DRV2_6: f_drv_drv2(id, 5); break;
766 case M_DRV_DRV2_7: f_drv_drv2(id, 6); break;
767 case M_DRV_DRV2_8: f_drv_drv2(id, 7); break;
768 case M_DRV_DRV2_9: f_drv_drv2(id, 8); break;
769 case M_DRV_DRV2_NO: f_drv_drv2(id, -1); break;
770 case M_DRV_DRV2_CHG: f_drv_chg(DRIVE_2); break;
771
772 case M_DRV_CHG: f_drv_chg(-1); break;
773 case M_DRV_UNSET: f_drv_unset(); break;
774
775 case M_MISC_CAPTURE: f_misc_capture(); break;
776 case M_MISC_RECORD: f_misc_record(id); break;
777
778 case M_MISC_CLOAD_S: f_misc_cload_s(); break;
779 case M_MISC_CLOAD_U: f_misc_cload_u(); break;
780
781 case M_MISC_CSAVE_S: f_misc_csave_s(); break;
782 case M_MISC_CSAVE_U: f_misc_csave_u(); break;
783
784 case M_MISC_SLOAD_1: f_misc_sload('1'); break;
785 case M_MISC_SLOAD_2: f_misc_sload('2'); break;
786 case M_MISC_SLOAD_3: f_misc_sload('3'); break;
787 case M_MISC_SLOAD_4: f_misc_sload('4'); break;
788 case M_MISC_SLOAD_5: f_misc_sload('5'); break;
789 case M_MISC_SLOAD_6: f_misc_sload('6'); break;
790 case M_MISC_SLOAD_7: f_misc_sload('7'); break;
791 case M_MISC_SLOAD_8: f_misc_sload('8'); break;
792 case M_MISC_SLOAD_9: f_misc_sload('9'); break;
793
794 case M_MISC_SSAVE_1: f_misc_ssave('1'); break;
795 case M_MISC_SSAVE_2: f_misc_ssave('2'); break;
796 case M_MISC_SSAVE_3: f_misc_ssave('3'); break;
797 case M_MISC_SSAVE_4: f_misc_ssave('4'); break;
798 case M_MISC_SSAVE_5: f_misc_ssave('5'); break;
799 case M_MISC_SSAVE_6: f_misc_ssave('6'); break;
800 case M_MISC_SSAVE_7: f_misc_ssave('7'); break;
801 case M_MISC_SSAVE_8: f_misc_ssave('8'); break;
802 case M_MISC_SSAVE_9: f_misc_ssave('9'); break;
803
804 case M_MISC_STATUS: f_misc_status(id); break;
805
806 case M_HELP_ABOUT: f_help_about(); break;
807
808 default:
809 /* ̤�ΤΥ��٥�Ȥ� FALSE ���֤� */
810 return FALSE;
811 }
812
813 return TRUE;
814 }
815
816 /*======================================================================
817 * ��˥塼�С����ִؿ�
818 *======================================================================*/
819
820 /*----------------------------------------------------------------------
821 * System ��˥塼
822 *----------------------------------------------------------------------*/
823
f_sys_reset(void)824 static void f_sys_reset(void)
825 {
826 if (menubar_reset_cfg.boot_clock_4mhz) {
827 cpu_clock_mhz = CONST_4MHZ_CLOCK;
828 } else {
829 cpu_clock_mhz = CONST_8MHZ_CLOCK;
830 }
831
832 if (drive_check_empty(DRIVE_1)) {
833 menubar_reset_cfg.boot_from_rom = TRUE;
834 } else {
835 menubar_reset_cfg.boot_from_rom = FALSE;
836 }
837
838 quasi88_reset(&menubar_reset_cfg);
839 }
840
f_sys_basic(UINT uItem,int data)841 static void f_sys_basic(UINT uItem, int data)
842 {
843 if (menubar_active == FALSE) { return; }
844
845 CheckMenuRadioItem(g_hMenu, M_SYS_MODE_V2, M_SYS_MODE_N, uItem,
846 MF_BYCOMMAND);
847 {
848 menubar_reset_cfg.boot_basic = (int)data;
849 update_sys_reset();
850 }
851 }
852
f_sys_clock(UINT uItem,int data)853 static void f_sys_clock(UINT uItem, int data)
854 {
855 if (menubar_active == FALSE) { return; }
856
857 CheckMenuRadioItem(g_hMenu, M_SYS_MODE_4MH, M_SYS_MODE_8MH, uItem,
858 MF_BYCOMMAND);
859 {
860 menubar_reset_cfg.boot_clock_4mhz = (int)data;
861 update_sys_reset();
862 }
863 }
864
f_sys_sb(UINT uItem,int data)865 static void f_sys_sb(UINT uItem, int data)
866 {
867 if (menubar_active == FALSE) { return; }
868
869 CheckMenuRadioItem(g_hMenu, M_SYS_MODE_SB, M_SYS_MODE_SB2, uItem,
870 MF_BYCOMMAND);
871 {
872 menubar_reset_cfg.sound_board = (int)data;
873 update_sys_reset();
874 }
875 }
876
f_sys_menu(void)877 static void f_sys_menu(void)
878 {
879 quasi88_menu();
880 }
881
f_sys_save(void)882 static void f_sys_save(void)
883 {
884 config_save(NULL);
885 }
886
f_sys_exit(void)887 static void f_sys_exit(void)
888 {
889 quasi88_quit();
890 }
891
892 /*----------------------------------------------------------------------
893 * Setting ��˥塼
894 *----------------------------------------------------------------------*/
895
f_set_speed(UINT uItem,int data)896 static void f_set_speed(UINT uItem, int data)
897 {
898 if (menubar_active == FALSE) { return; }
899
900 CheckMenuRadioItem(g_hMenu, M_SET_SPD_25, M_SET_SPD_400, uItem,
901 MF_BYCOMMAND);
902 {
903 quasi88_cfg_set_wait_rate((int)data);
904 }
905 }
906
f_set_nowait(UINT uItem)907 static void f_set_nowait(UINT uItem)
908 {
909 int active;
910 UINT res;
911
912 if (menubar_active == FALSE) { return; }
913
914 res = GetMenuState(g_hMenu, uItem, MF_BYCOMMAND);
915 active = (res & MFS_CHECKED) ? FALSE : TRUE; /* �դˤ��� */
916 CheckMenuItem(g_hMenu, uItem,
917 MF_BYCOMMAND | (active ? MFS_CHECKED : MFS_UNCHECKED));
918
919 quasi88_cfg_set_no_wait(active);
920 }
921
f_set_subcpu(UINT uItem,int data)922 static void f_set_subcpu(UINT uItem, int data)
923 {
924 if (menubar_active == FALSE) { return; }
925
926 CheckMenuRadioItem(g_hMenu, M_SET_SUB_SOME, M_SET_SUB_ALL, uItem,
927 MF_BYCOMMAND);
928 {
929 if (cpu_timing != (int)data) {
930 cpu_timing = (int)data;
931 emu_reset();
932 /* ¾�˺ƽ�������٤���ΤϤʤ��Τ��� */
933 }
934 }
935 }
936
f_set_fdcwait(UINT uItem)937 static void f_set_fdcwait(UINT uItem)
938 {
939 int active;
940 UINT res;
941
942 if (menubar_active == FALSE) { return; }
943
944 res = GetMenuState(g_hMenu, uItem, MF_BYCOMMAND);
945 active = (res & MFS_CHECKED) ? FALSE : TRUE; /* �դˤ��� */
946 CheckMenuItem(g_hMenu, uItem,
947 MF_BYCOMMAND | (active ? MFS_CHECKED : MFS_UNCHECKED));
948
949 fdc_wait = active;
950 }
951
f_set_refresh(UINT uItem,int data)952 static void f_set_refresh(UINT uItem, int data)
953 {
954 if (menubar_active == FALSE) { return; }
955
956 CheckMenuRadioItem(g_hMenu, M_SET_REF_60, M_SET_REF_15, uItem,
957 MF_BYCOMMAND);
958 {
959 quasi88_cfg_set_frameskip_rate((int)data);
960 }
961 }
962
f_set_interlace(UINT uItem,int data)963 static void f_set_interlace(UINT uItem, int data)
964 {
965 if (menubar_active == FALSE) { return; }
966
967 CheckMenuRadioItem(g_hMenu, M_SET_INT_NO, M_SET_INT_YES, uItem,
968 MF_BYCOMMAND);
969 {
970 quasi88_cfg_set_interlace((int)data);
971 }
972 }
973
f_set_size(UINT uItem,int data)974 static void f_set_size(UINT uItem, int data)
975 {
976 if (menubar_active == FALSE) { return; }
977
978 CheckMenuRadioItem(g_hMenu, M_SET_SIZ_FULL, M_SET_SIZ_HALF, uItem,
979 MF_BYCOMMAND);
980 {
981 quasi88_cfg_set_size((int)data);
982 }
983 }
984
f_set_pcg(UINT uItem)985 static void f_set_pcg(UINT uItem)
986 {
987 int active;
988 UINT res;
989
990 if (menubar_active == FALSE) { return; }
991
992 res = GetMenuState(g_hMenu, uItem, MF_BYCOMMAND);
993 active = (res & MFS_CHECKED) ? FALSE : TRUE; /* �դˤ��� */
994 CheckMenuItem(g_hMenu, uItem,
995 MF_BYCOMMAND | (active ? MFS_CHECKED : MFS_UNCHECKED));
996
997 use_pcg = active;
998 }
999
f_set_mouse(UINT uItem,int data)1000 static void f_set_mouse(UINT uItem, int data)
1001 {
1002 if (menubar_active == FALSE) { return; }
1003
1004 CheckMenuRadioItem(g_hMenu, M_SET_MO_NO, M_SET_MO_JOY, uItem,
1005 MF_BYCOMMAND);
1006 {
1007 mouse_mode = (int)data;
1008 keyboard_switch();
1009 }
1010 }
1011
f_set_cursor(UINT uItem,int data)1012 static void f_set_cursor(UINT uItem, int data)
1013 {
1014 if (menubar_active == FALSE) { return; }
1015
1016 CheckMenuRadioItem(g_hMenu, M_SET_CUR_DEF, M_SET_CUR_TEN, uItem,
1017 MF_BYCOMMAND);
1018 {
1019 if ((int)data) {
1020 cursor_key_mode = 1;
1021 } else {
1022 cursor_key_mode = 0;
1023 }
1024 keyboard_switch();
1025 }
1026 }
1027
f_set_numlock(UINT uItem)1028 static void f_set_numlock(UINT uItem)
1029 {
1030 int active;
1031 UINT res;
1032
1033 if (menubar_active == FALSE) { return; }
1034
1035 res = GetMenuState(g_hMenu, uItem, MF_BYCOMMAND);
1036 active = (res & MFS_CHECKED) ? FALSE : TRUE; /* �դˤ��� */
1037 CheckMenuItem(g_hMenu, uItem,
1038 MF_BYCOMMAND | (active ? MFS_CHECKED : MFS_UNCHECKED));
1039
1040 quasi88_cfg_key_numlock(active);
1041 }
1042
f_set_romaji(UINT uItem)1043 static void f_set_romaji(UINT uItem)
1044 {
1045 int active;
1046 UINT res;
1047
1048 if (menubar_active == FALSE) { return; }
1049
1050 res = GetMenuState(g_hMenu, uItem, MF_BYCOMMAND);
1051 active = (res & MFS_CHECKED) ? FALSE : TRUE; /* �դˤ��� */
1052 CheckMenuItem(g_hMenu, uItem,
1053 MF_BYCOMMAND | (active ? MFS_CHECKED : MFS_UNCHECKED));
1054
1055 quasi88_cfg_key_romaji(active);
1056 }
1057
1058 #ifdef USE_SOUND
1059 #ifdef USE_FMGEN
f_set_fm(UINT uItem,int data)1060 static void f_set_fm(UINT uItem, int data)
1061 {
1062 if (menubar_active == FALSE) { return; }
1063
1064 CheckMenuRadioItem(g_hMenu, M_SET_FM_MAME, M_SET_FM_FMGEN, uItem,
1065 MF_BYCOMMAND);
1066 {
1067 /* ���� */
1068 if (((xmame_cfg_get_use_fmgen()) && ((int)data == FALSE)) ||
1069 ((xmame_cfg_get_use_fmgen() == FALSE) && ((int)data))) {
1070
1071 xmame_cfg_set_use_fmgen((int)data);
1072
1073 menu_sound_restart(TRUE);
1074 update_misc_record();
1075 }
1076 }
1077 }
1078 #endif
1079
f_set_frq(UINT uItem,int data)1080 static void f_set_frq(UINT uItem, int data)
1081 {
1082 if (menubar_active == FALSE) { return; }
1083
1084 CheckMenuRadioItem(g_hMenu, M_SET_FRQ_48, M_SET_FRQ_11, uItem,
1085 MF_BYCOMMAND);
1086 {
1087 /* ���� */
1088 if (xmame_cfg_get_sample_freq() != (int)data) {
1089 if (8000 <= (int)data && (int)data <= 48000) {
1090 xmame_cfg_set_sample_freq((int)data);
1091
1092 menu_sound_restart(TRUE);
1093 update_misc_record();
1094 }
1095 }
1096 }
1097 }
1098
f_set_buf(UINT uItem,int data)1099 static void f_set_buf(UINT uItem, int data)
1100 {
1101 if (menubar_active == FALSE) { return; }
1102
1103 CheckMenuRadioItem(g_hMenu, M_SET_BUF_800, M_SET_BUF_100, uItem,
1104 MF_BYCOMMAND);
1105 {
1106 /* ���� */
1107 if (g_pcm_bufsize != (int)data) {
1108 if (10 <= (int)data && (int)data <= 1000) {
1109 g_pcm_bufsize = (int)data;
1110
1111 menu_sound_restart(TRUE);
1112 update_misc_record();
1113 }
1114 }
1115 }
1116 }
1117 #endif
1118
1119 /*----------------------------------------------------------------------
1120 * Drive ��˥塼
1121 *----------------------------------------------------------------------*/
1122
f_drv_chg(int data)1123 static void f_drv_chg(int data)
1124 {
1125 char filename[QUASI88_MAX_FILENAME]; /* �ե�ѥ��ե�����̾ */
1126 const char *headline;
1127 int result;
1128
1129 if (menubar_active == FALSE) { return; }
1130
1131 switch ((int)data) {
1132 case DRIVE_1: headline = "Open Disk-Image-File (Drive 1:)"; break;
1133 case DRIVE_2: headline = "Open Disk-Image-File (Drive 2:)"; break;
1134 default: headline = "Open Disk-Image-File"; break;
1135 }
1136
1137 result = select_file(TRUE,
1138 headline,
1139 "d88(*.d88)\0*.d88\0All files(*.*)\0*.*\0\0",
1140 "d88",
1141 OFN_FILEMUSTEXIST, /* ��¸�ե�������� */
1142 filename,
1143 sizeof(filename));
1144 if (result) {
1145 int ok = FALSE;
1146 int ro = (result < 0) ? TRUE : FALSE;
1147
1148 if ((data == DRIVE_1) || (data == DRIVE_2)) {
1149
1150 ok = quasi88_disk_insert(data, filename, 0, ro);
1151
1152 } else if (data < 0) {
1153
1154 ok = quasi88_disk_insert_all(filename, ro);
1155
1156 }
1157
1158 /* ���Ǥ˥ե�������Ĥ��Ƥ���Τǡ����Ԥ��Ƥ��˥塼�С����� */
1159 update_drive();
1160 }
1161 }
1162
f_drv_drv1(UINT uItem,int data)1163 static void f_drv_drv1(UINT uItem, int data)
1164 {
1165 if (menubar_active == FALSE) { return; }
1166
1167 CheckMenuRadioItem(g_hMenu, M_DRV_DRV1_1, M_DRV_DRV1_NO, uItem,
1168 MF_BYCOMMAND);
1169 {
1170 if ((int)data < 0) {
1171 quasi88_disk_image_empty(DRIVE_1);
1172 } else {
1173 quasi88_disk_image_select(DRIVE_1, (int)data);
1174 }
1175 }
1176 }
1177
f_drv_drv2(UINT uItem,int data)1178 static void f_drv_drv2(UINT uItem, int data)
1179 {
1180 if (menubar_active == FALSE) { return; }
1181
1182 CheckMenuRadioItem(g_hMenu, M_DRV_DRV2_1, M_DRV_DRV2_NO, uItem,
1183 MF_BYCOMMAND);
1184 {
1185 if ((int)data < 0) {
1186 quasi88_disk_image_empty(DRIVE_2);
1187 } else {
1188 quasi88_disk_image_select(DRIVE_2, (int)data);
1189 }
1190 }
1191 }
1192
f_drv_unset(void)1193 static void f_drv_unset(void)
1194 {
1195 if (menubar_active == FALSE) { return; }
1196
1197 quasi88_disk_eject_all();
1198
1199 update_drive();
1200 }
1201
1202 /*----------------------------------------------------------------------
1203 * Misc ��˥塼
1204 *----------------------------------------------------------------------*/
1205
f_misc_capture(void)1206 static void f_misc_capture(void)
1207 {
1208 if (menubar_active == FALSE) { return; }
1209
1210 quasi88_screen_snapshot();
1211 }
1212
f_misc_record(UINT uItem)1213 static void f_misc_record(UINT uItem)
1214 {
1215 int active;
1216
1217 if (menubar_active == FALSE) { return; }
1218
1219 active = xmame_wavout_opened() ? FALSE : TRUE; /* �դˤ��� */
1220
1221 if (active == FALSE) {
1222 if (xmame_wavout_opened()) {
1223 quasi88_waveout(FALSE);
1224 }
1225 } else {
1226 if (xmame_wavout_opened() == FALSE) {
1227 if (quasi88_waveout(TRUE) == FALSE) {
1228 active = FALSE;
1229 }
1230 }
1231 }
1232
1233 CheckMenuItem(g_hMenu, uItem,
1234 MF_BYCOMMAND | (active ? MFS_CHECKED : MFS_UNCHECKED));
1235 }
1236
f_misc_cload_s(void)1237 static void f_misc_cload_s(void)
1238 {
1239 char filename[QUASI88_MAX_FILENAME]; /* �ե�ѥ��ե�����̾ */
1240 int result;
1241
1242 if (menubar_active == FALSE) { return; }
1243
1244 if (filename_get_tape(CLOAD)) { return; } /* �ơ��פ���ʤ���� */
1245
1246 result = select_file(TRUE,
1247 "Open Tape-Image-File for LOAD",
1248 "*.t88;*.cmt\0*.t88;*.cmt\0All files(*.*)\0*.*\0\0",
1249 "cmt",
1250 OFN_FILEMUSTEXIST | /* ��¸�ե�������� */
1251 OFN_HIDEREADONLY, /* �ɼ����Ѥϱ��� */
1252 filename,
1253 sizeof(filename));
1254
1255 if (result) {
1256
1257 int ok = quasi88_load_tape_insert(filename);
1258
1259 /* ���Ǥ˥ե�������Ĥ��Ƥ���Τǡ����Ԥ��Ƥ��˥塼�С����� */
1260 update_misc_cload();
1261 }
1262 }
1263
f_misc_cload_u(void)1264 static void f_misc_cload_u(void)
1265 {
1266 if (menubar_active == FALSE) { return; }
1267
1268 quasi88_load_tape_eject();
1269
1270 update_misc_cload();
1271 }
1272
f_misc_csave_s(void)1273 static void f_misc_csave_s(void)
1274 {
1275 char filename[QUASI88_MAX_FILENAME]; /* �ե�ѥ��ե�����̾ */
1276 int result;
1277
1278 if (menubar_active == FALSE) { return; }
1279
1280 if (filename_get_tape(CSAVE)) { return; } /* �ơ��פ���ʤ���� */
1281
1282 result = select_file(FALSE,
1283 "Open Tape-Image-File for SAVE (append)",
1284 "*.cmt\0*.cmt\0All files(*.*)\0*.*\0\0",
1285 "cmt",
1286 OFN_OVERWRITEPROMPT | /* ����ϳ�ǧ */
1287 OFN_HIDEREADONLY, /* �ɼ����Ѥϱ��� */
1288 filename,
1289 sizeof(filename));
1290
1291 if (result) {
1292
1293 int ok = quasi88_save_tape_insert(filename);
1294
1295 /* ���Ǥ˥ե�������Ĥ��Ƥ���Τǡ����Ԥ��Ƥ��˥塼�С����� */
1296 update_misc_csave();
1297 }
1298 }
1299
f_misc_csave_u(void)1300 static void f_misc_csave_u(void)
1301 {
1302 if (menubar_active == FALSE) { return; }
1303
1304 quasi88_save_tape_eject();
1305
1306 update_misc_csave();
1307 }
1308
f_misc_sload(int data)1309 static void f_misc_sload(int data)
1310 {
1311 if (menubar_active == FALSE) { return; }
1312
1313 quasi88_stateload((int) data);
1314
1315 /* �����ե�����̾���ѹ����줿�Ϥ��ʤΤǡ���˥塼�С������ƹ��� */
1316 menubar_setup(TRUE);
1317 }
1318
f_misc_ssave(int data)1319 static void f_misc_ssave(int data)
1320 {
1321 if (menubar_active == FALSE) { return; }
1322
1323 quasi88_statesave((int) data);
1324 }
1325
f_misc_status(UINT uItem)1326 static void f_misc_status(UINT uItem)
1327 {
1328 int active;
1329 UINT res;
1330
1331 if (menubar_active == FALSE) { return; }
1332
1333 res = GetMenuState(g_hMenu, uItem, MF_BYCOMMAND);
1334 active = (res & MFS_CHECKED) ? FALSE : TRUE; /* �դˤ��� */
1335 CheckMenuItem(g_hMenu, uItem,
1336 MF_BYCOMMAND | (active ? MFS_CHECKED : MFS_UNCHECKED));
1337
1338 quasi88_cfg_set_showstatus(active);
1339 }
1340
1341 /*----------------------------------------------------------------------
1342 * Help ��˥塼
1343 *----------------------------------------------------------------------*/
1344
f_help_about(void)1345 static void f_help_about (void)
1346 {
1347 MessageBox(g_hWnd,
1348 "QUASI88 ver. " Q_VERSION " <" Q_COMMENT ">"
1349 "\n " Q_COPYRIGHT
1350 #ifdef USE_SOUND
1351 "\n"
1352 "\nMAME Sound-Engine included"
1353 "\n " Q_MAME_COPYRIGHT
1354 #ifdef USE_FMGEN
1355 "\nFM Sound Generator (fmgen) included"
1356 "\n " Q_FMGEN_COPYRIGHT
1357 #endif
1358 #endif
1359 ,
1360 "About QUASI88", MB_OK);
1361 }
1362