/* * VARCem Virtual ARchaeological Computer EMulator. * An emulator of (mostly) x86-based PC systems and devices, * using the ISA,EISA,VLB,MCA and PCI system buses, roughly * spanning the era between 1981 and 1995. * * This file is part of the VARCem Project. * * Implementation of the Settings dialog. * * Version: @(#)win_settings.c 1.0.24 2018/04/26 * * Authors: Fred N. van Kempen, * Miran Grca, * * Copyright 2017,2018 Fred N. van Kempen. * Copyright 2016-2018 Miran Grca. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the: * * Free Software Foundation, Inc. * 59 Temple Place - Suite 330 * Boston, MA 02111-1307 * USA. */ #define UNICODE #define WIN32_LEAN_AND_MEAN #include #include #include #include #include #include #include #include #include "../emu.h" #include "../config.h" #include "../cpu/cpu.h" #include "../mem.h" #include "../rom.h" #include "../device.h" #include "../nvr.h" #include "../machine/machine.h" #include "../ports/game_dev.h" #include "../ports/parallel.h" #include "../ports/parallel_dev.h" #include "../ports/serial.h" #include "../input/mouse.h" #include "../input/game/joystick.h" #include "../floppy/fdd.h" #include "../disk/hdd.h" #include "../disk/hdc.h" #include "../disk/hdc_ide.h" #include "../disk/zip.h" #include "../cdrom/cdrom.h" #include "../scsi/scsi.h" #include "../network/network.h" #include "../sound/sound.h" #include "../sound/midi.h" #include "../sound/snd_mpu401.h" #include "../video/video.h" #include "../plat.h" #include "../ui.h" #include "win.h" /* Defined in the Video module. */ extern const device_t voodoo_device; /* Machine category. */ static int temp_machine, temp_cpu_m, temp_cpu, temp_wait_states, temp_mem_size, temp_fpu, temp_sync; #ifdef USE_DYNAREC static int temp_dynarec; #endif /* Video category. */ static int temp_video_card, temp_video_speed, temp_voodoo; /* Input devices category. */ static int temp_mouse, temp_joystick; /* Sound category. */ static int temp_sound_card, temp_midi_device, temp_mpu401, temp_opl3_type, temp_float; /* Network category. */ static int temp_net_type, temp_net_card; static char temp_host_dev[128]; /* Ports category. */ static int temp_game, temp_serial[SERIAL_MAX], temp_parallel[PARALLEL_MAX], temp_parallel_device[PARALLEL_MAX]; /* Other peripherals category. */ static int temp_hdc_type, temp_scsi_card, temp_ide_ter, temp_ide_ter_irq, temp_ide_qua, temp_ide_qua_irq; static int temp_bugger; /* Floppy drives category. */ static int temp_fdd_types[FDD_NUM], temp_fdd_turbo[FDD_NUM], temp_fdd_check_bpb[FDD_NUM]; /* Hard disks category. */ static hard_disk_t temp_hdd[HDD_NUM]; /* Other removable devices category. */ static cdrom_drive_t temp_cdrom_drives[CDROM_NUM]; static zip_drive_t temp_zip_drives[ZIP_NUM]; static HWND hwndParentDialog, hwndChildDialog; static int displayed_category = 0; static int ask_sure = 0; static uint8_t temp_deviceconfig; /* Show a MessageBox dialog. This is nasty, I know. --FvK */ static int settings_msgbox(int type, void *arg) { HWND h; int i; h = hwndMain; hwndMain = hwndParentDialog; i = ui_msgbox(type, arg); hwndMain = h; return(i); } /* Load the per-page dialogs. */ #include "win_settings_machine.h" /* Machine dialog */ #include "win_settings_video.h" /* Video dialog */ #include "win_settings_input.h" /* Input dialog */ #include "win_settings_sound.h" /* Sound dialog */ #include "win_settings_ports.h" /* Ports dialog */ #include "win_settings_periph.h" /* Other Peripherals dialog */ #include "win_settings_network.h" /* Network dialog */ #include "win_settings_floppy.h" /* Floppy dialog */ #include "win_settings_disk.h" /* (Hard) Disk dialog */ #include "win_settings_remov.h" /* Removable Devices dialog */ /* This does the initial read of global variables into the temporary ones. */ static void settings_init(void) { int i = 0; /* Machine category */ temp_machine = machine; temp_cpu_m = cpu_manufacturer; temp_wait_states = cpu_waitstates; temp_cpu = cpu; temp_mem_size = mem_size; #ifdef USE_DYNAREC temp_dynarec = cpu_use_dynarec; #endif temp_fpu = enable_external_fpu; temp_sync = enable_sync; /* Video category */ temp_video_card = video_card; temp_video_speed = video_speed; temp_voodoo = voodoo_enabled; /* Input devices category */ temp_mouse = mouse_type; temp_joystick = joystick_type; /* Sound category */ temp_sound_card = sound_card; temp_midi_device = midi_device; temp_mpu401 = mpu401_standalone_enable; temp_opl3_type = opl3_type; temp_float = sound_is_float; /* Network category */ temp_net_type = network_type; memset(temp_host_dev, 0, sizeof(temp_host_dev)); strcpy(temp_host_dev, network_host); temp_net_card = network_card; /* Ports category */ temp_game = game_enabled; for (i = 0; i < SERIAL_MAX; i++) temp_serial[i] = serial_enabled[i]; for (i = 0; i < PARALLEL_MAX; i++) { temp_parallel[i] = parallel_enabled[i]; temp_parallel_device[i] = parallel_device[i]; } /* Other peripherals category */ temp_scsi_card = scsi_card; temp_hdc_type = hdc_type; temp_ide_ter = ide_enable[2]; temp_ide_ter_irq = ide_irq[2]; temp_ide_qua = ide_enable[3]; temp_ide_qua_irq = ide_irq[3]; temp_bugger = bugger_enabled; /* Floppy drives category */ for (i=0; icode == LVN_ITEMCHANGED) && (((LPNMHDR)lParam)->idFrom == IDC_SETTINGSCATLIST)) { category = -1; for (i=0; i<10; i++) { h = GetDlgItem(hdlg, IDC_SETTINGSCATLIST); j = ListView_GetItemState(h, i, LVIS_SELECTED); if (j) category = i; } if (category != -1) show_child(hdlg, category); } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: SendMessage(hwndChildDialog, WM_SAVESETTINGS, 0, 0); if (ask_sure) { i = msgbox_reset(); if (i == 0) { /* CANCEL, just kidding! */ return(FALSE); } } else { i = 2; } if (i == 2) { /* YES, reset system. */ settings_save(); } DestroyWindow(hwndChildDialog); EndDialog(hdlg, i); return(TRUE); case IDCANCEL: DestroyWindow(hwndChildDialog); EndDialog(hdlg, 0); return(TRUE); } break; default: return(FALSE); } return(FALSE); } int win_settings_open(HWND hwnd, int ask) { int i, m, v; /* Enumerate the available machines. */ m = machine_detect(); /* Enumerate the available video cards. */ v = video_detect(); if (m == 0 || v == 0) { ui_msgbox(MBX_ERROR|MBX_FATAL, (wchar_t *)IDS_2056); return(0); } ask_sure = ask; i = DialogBox(hinstance, (LPCWSTR)DLG_CONFIG, hwnd, settings_proc); return(i); }