2018-09-03 14:25:10 +02:00
/*
2017-05-30 03:38:38 +02:00
* 86 Box A hypervisor and IBM PC system emulator that specializes in
* running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent
* system designs based on the PCI bus .
*
* This file is part of the 86 Box distribution .
*
* Windows 86 Box Settings dialog handler .
*
2020-03-25 00:46:02 +02:00
*
2017-05-30 03:38:38 +02:00
*
2018-08-04 01:36:49 +02:00
* Authors : Miran Grca , < mgrca8 @ gmail . com >
* David Hrdlička , < hrdlickadavid @ outlook . com >
2017-10-08 19:14:46 -04:00
*
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
* Copyright 2016 - 2019 Miran Grca .
* Copyright 2018 , 2019 David Hrdlička .
2017-05-30 03:38:38 +02:00
*/
2017-05-18 14:03:43 -04:00
# define UNICODE
# define BITMAP WINDOWS_BITMAP
# include <windows.h>
# include <windowsx.h>
# undef BITMAP
2019-02-06 03:34:39 +01:00
# ifdef ENABLE_SETTINGS_LOG
# include <assert.h>
# endif
2017-05-18 14:03:43 -04:00
# include <commctrl.h>
# include <inttypes.h>
2017-09-25 04:31:20 -04:00
# include <stdint.h>
2018-05-21 19:04:05 +02:00
# include <stdio.h>
2017-09-25 04:31:20 -04:00
# include <string.h>
# include <wchar.h>
2020-03-29 14:24:42 +02:00
# include <86box/86box.h>
# include <86box/config.h>
2020-02-29 19:12:23 +01:00
# include "cpu.h"
2020-03-29 14:24:42 +02:00
# include <86box/mem.h>
# include <86box/rom.h>
# include <86box/device.h>
# include <86box/timer.h>
# include <86box/nvr.h>
# include <86box/machine.h>
# include <86box/gameport.h>
# include <86box/isamem.h>
# include <86box/isartc.h>
# include <86box/lpt.h>
# include <86box/mouse.h>
# include <86box/scsi.h>
# include <86box/scsi_device.h>
# include <86box/cdrom.h>
# include <86box/hdd.h>
# include <86box/hdc.h>
# include <86box/hdc_ide.h>
# include <86box/zip.h>
2020-07-15 09:03:30 +08:00
# include <86box/mo.h>
2020-06-16 16:50:16 +02:00
# include <86box/fdd.h>
2020-06-16 16:25:23 +02:00
# include <86box/fdc.h>
2020-06-16 16:41:35 +02:00
# include <86box/fdc_ext.h>
2020-03-29 14:24:42 +02:00
# include <86box/network.h>
# include <86box/sound.h>
# include <86box/midi.h>
# include <86box/snd_mpu401.h>
# include <86box/video.h>
# include <86box/plat.h>
# include <86box/plat_midi.h>
# include <86box/ui.h>
# include <86box/win.h>
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
/* Icon, Bus, File, C, H, S, Size */
# define C_COLUMNS_HARD_DISKS 6
2019-02-11 01:54:00 +01:00
static int first_cat = 0 ;
2020-09-03 12:14:22 +08:00
static int dpi = 96 ;
2019-02-11 01:54:00 +01:00
2017-05-18 14:03:43 -04:00
/* Machine category */
2020-06-16 01:58:07 +02:00
static int temp_machine_type , temp_machine , temp_cpu_m , temp_cpu , temp_wait_states , temp_fpu , temp_sync ;
2018-04-25 23:51:13 +02:00
static uint32_t temp_mem_size ;
2017-10-15 02:43:13 +02:00
# ifdef USE_DYNAREC
static int temp_dynarec ;
# endif
2017-05-18 14:03:43 -04:00
/* Video category */
2018-07-15 01:41:53 +02:00
static int temp_gfxcard , temp_voodoo ;
2017-05-18 14:03:43 -04:00
/* Input devices category */
2017-05-18 21:22:15 +02:00
static int temp_mouse , temp_joystick ;
2017-05-18 14:03:43 -04:00
/* Sound category */
2020-01-01 20:20:16 +01:00
static int temp_sound_card , temp_midi_device , temp_midi_input_device , temp_mpu401 , temp_SSI2001 , temp_GAMEBLASTER , temp_GUS ;
2017-06-14 07:21:01 +02:00
static int temp_float ;
2017-05-18 14:03:43 -04:00
/* Network category */
2017-05-18 21:22:15 +02:00
static int temp_net_type , temp_net_card ;
2019-02-06 03:34:39 +01:00
static char temp_pcap_dev [ 522 ] ;
2017-05-18 14:03:43 -04:00
2017-09-02 23:39:26 +02:00
/* Ports category */
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
static int temp_lpt_devices [ 3 ] ;
2020-07-08 04:24:25 +02:00
static int temp_serial [ 4 ] , temp_lpt [ 3 ] ;
2017-09-02 23:39:26 +02:00
2018-01-26 22:17:09 +01:00
/* Other peripherals category */
2020-06-17 14:29:24 +02:00
static int temp_fdc_card , temp_hdc , temp_scsi_card , temp_ide_ter , temp_ide_qua ;
2017-10-01 16:29:15 -04:00
static int temp_bugger ;
2020-03-23 17:03:28 -03:00
static int temp_postcard ;
2018-09-03 13:55:09 +02:00
static int temp_isartc ;
static int temp_isamem [ ISAMEM_MAX ] ;
2017-05-18 14:03:43 -04:00
2017-10-19 23:55:51 +02:00
static uint8_t temp_deviceconfig ;
2017-05-18 14:03:43 -04:00
/* Hard disks category */
2017-09-30 16:56:38 -04:00
static hard_disk_t temp_hdd [ HDD_NUM ] ;
2017-05-18 14:03:43 -04:00
2018-01-26 22:17:09 +01:00
/* Floppy drives category */
2017-05-18 21:22:15 +02:00
static int temp_fdd_types [ FDD_NUM ] ;
2017-06-04 02:14:27 +02:00
static int temp_fdd_turbo [ FDD_NUM ] ;
2017-07-27 17:14:52 +02:00
static int temp_fdd_check_bpb [ FDD_NUM ] ;
2018-01-26 22:17:09 +01:00
/* Other removable devices category */
2018-10-17 05:29:48 +02:00
static cdrom_t temp_cdrom [ CDROM_NUM ] ;
2018-01-26 22:17:09 +01:00
static zip_drive_t temp_zip_drives [ ZIP_NUM ] ;
2020-07-15 09:03:30 +08:00
static mo_drive_t temp_mo_drives [ MO_NUM ] ;
2017-05-18 14:03:43 -04:00
static HWND hwndParentDialog , hwndChildDialog ;
2018-04-25 23:51:13 +02:00
static uint32_t displayed_category = 0 ;
2017-05-18 14:03:43 -04:00
extern int is486 ;
2020-06-16 01:58:07 +02:00
static int listtomachinetype [ 256 ] , machinetypetolist [ 256 ] ;
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
static int listtomachine [ 256 ] , machinetolist [ 256 ] ;
2018-09-06 14:41:06 +02:00
static int settings_device_to_list [ 2 ] [ 20 ] , settings_list_to_device [ 2 ] [ 20 ] ;
2020-06-17 14:29:24 +02:00
static int settings_fdc_to_list [ 2 ] [ 20 ] , settings_list_to_fdc [ 2 ] [ 20 ] ;
2017-06-19 06:46:08 +02:00
static int settings_midi_to_list [ 20 ] , settings_list_to_midi [ 20 ] ;
2020-01-01 20:20:16 +01:00
static int settings_midi_in_to_list [ 20 ] , settings_list_to_midi_in [ 20 ] ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
static int max_spt = 63 , max_hpc = 255 , max_tracks = 266305 ;
static uint64_t mfm_tracking , esdi_tracking , xta_tracking , ide_tracking , scsi_tracking [ 2 ] ;
static uint64_t size ;
static int hd_listview_items , hdc_id_to_listview_index [ HDD_NUM ] ;
static int no_update = 0 , existing = 0 , chs_enabled = 0 ;
static int lv1_current_sel , lv2_current_sel ;
static int hard_disk_added = 0 , next_free_id = 0 , selection = 127 ;
static int spt , hpc , tracks , ignore_change = 0 ;
static hard_disk_t new_hdd , * hdd_ptr ;
static wchar_t hd_file_name [ 512 ] ;
static BOOL
image_list_init ( HWND hwndList , const uint8_t * icon_ids )
{
HICON hiconItem ;
HIMAGELIST hSmall ;
int i = 0 ;
2020-09-03 12:14:22 +08:00
hSmall = ListView_GetImageList ( hwndList , LVSIL_SMALL ) ;
if ( hSmall ! = 0 ) ImageList_Destroy ( hSmall ) ;
hSmall = ImageList_Create ( win_get_system_metrics ( SM_CXSMICON , dpi ) ,
win_get_system_metrics ( SM_CYSMICON , dpi ) ,
2018-07-15 01:41:53 +02:00
ILC_MASK | ILC_COLOR32 , 1 , 1 ) ;
while ( 1 ) {
if ( icon_ids [ i ] = = 0 )
break ;
2019-03-20 02:42:55 +08:00
# if defined(__amd64__) || defined(__aarch64__)
2018-10-24 16:01:20 +02:00
hiconItem = LoadIcon ( hinstance , ( LPCWSTR ) ( ( uint64_t ) icon_ids [ i ] ) ) ;
# else
2018-07-15 01:41:53 +02:00
hiconItem = LoadIcon ( hinstance , ( LPCWSTR ) ( ( uint32_t ) icon_ids [ i ] ) ) ;
2018-10-24 16:01:20 +02:00
# endif
2018-07-15 01:41:53 +02:00
ImageList_AddIcon ( hSmall , hiconItem ) ;
DestroyIcon ( hiconItem ) ;
i + + ;
}
ListView_SetImageList ( hwndList , hSmall , LVSIL_SMALL ) ;
2018-01-19 15:39:13 +01:00
2018-07-15 01:41:53 +02:00
return TRUE ;
}
2017-05-18 14:03:43 -04:00
2017-10-10 03:07:29 -04:00
/* Show a MessageBox dialog. This is nasty, I know. --FvK */
static int
2020-06-19 00:16:05 -03:00
settings_msgbox_header ( int flags , void * header , void * message )
2017-10-10 03:07:29 -04:00
{
HWND h ;
int i ;
h = hwndMain ;
hwndMain = hwndParentDialog ;
2020-06-19 00:16:05 -03:00
i = ui_msgbox_header ( flags , header , message ) ;
2017-10-10 03:07:29 -04:00
hwndMain = h ;
return ( i ) ;
}
2020-06-19 00:21:40 -03:00
static int
settings_msgbox_ex ( int flags , void * header , void * message , void * btn1 , void * btn2 , void * btn3 )
{
HWND h ;
int i ;
h = hwndMain ;
hwndMain = hwndParentDialog ;
i = ui_msgbox_ex ( flags , header , message , btn1 , btn2 , btn3 ) ;
hwndMain = h ;
return ( i ) ;
}
2017-05-18 14:03:43 -04:00
/* This does the initial read of global variables into the temporary ones. */
2018-07-15 01:41:53 +02:00
static void
win_settings_init ( void )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
int i = 0 ;
/* Machine category */
2020-06-16 01:58:07 +02:00
temp_machine_type = machines [ machine ] . type ;
2018-07-15 01:41:53 +02:00
temp_machine = machine ;
temp_cpu_m = cpu_manufacturer ;
temp_wait_states = cpu_waitstates ;
temp_cpu = cpu ;
temp_mem_size = mem_size ;
2017-10-15 02:43:13 +02:00
# ifdef USE_DYNAREC
2018-07-15 01:41:53 +02:00
temp_dynarec = cpu_use_dynarec ;
2017-10-15 02:43:13 +02:00
# endif
2020-06-15 21:21:26 +02:00
temp_fpu = fpu_type ;
2018-08-04 00:48:54 +02:00
temp_sync = time_sync ;
2018-07-15 01:41:53 +02:00
/* Video category */
temp_gfxcard = gfxcard ;
temp_voodoo = voodoo_enabled ;
/* Input devices category */
temp_mouse = mouse_type ;
temp_joystick = joystick_type ;
/* Sound category */
temp_sound_card = sound_card_current ;
temp_midi_device = midi_device_current ;
2020-01-01 20:20:16 +01:00
temp_midi_input_device = midi_input_device_current ;
2018-07-15 01:41:53 +02:00
temp_mpu401 = mpu401_standalone_enable ;
temp_SSI2001 = SSI2001 ;
temp_GAMEBLASTER = GAMEBLASTER ;
temp_GUS = GUS ;
temp_float = sound_is_float ;
/* Network category */
temp_net_type = network_type ;
memset ( temp_pcap_dev , 0 , sizeof ( temp_pcap_dev ) ) ;
2019-02-06 03:34:39 +01:00
# ifdef ENABLE_SETTINGS_LOG
assert ( sizeof ( temp_pcap_dev ) = = sizeof ( network_host ) ) ;
# endif
memcpy ( temp_pcap_dev , network_host , sizeof ( network_host ) ) ;
2018-07-15 01:41:53 +02:00
temp_net_card = network_card ;
/* Ports category */
2019-02-06 03:34:39 +01:00
for ( i = 0 ; i < 3 ; i + + ) {
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
temp_lpt_devices [ i ] = lpt_ports [ i ] . device ;
temp_lpt [ i ] = lpt_ports [ i ] . enabled ;
2019-02-06 03:34:39 +01:00
}
2020-07-08 04:24:25 +02:00
for ( i = 0 ; i < 4 ; i + + )
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
temp_serial [ i ] = serial_enabled [ i ] ;
2018-07-15 01:41:53 +02:00
/* Other peripherals category */
temp_scsi_card = scsi_card_current ;
2020-06-17 14:29:24 +02:00
temp_fdc_card = fdc_type ;
2019-02-06 03:34:39 +01:00
temp_hdc = hdc_current ;
2018-07-15 01:41:53 +02:00
temp_ide_ter = ide_ter_enabled ;
temp_ide_qua = ide_qua_enabled ;
temp_bugger = bugger_enabled ;
2020-03-23 17:03:28 -03:00
temp_postcard = postcard_enabled ;
2018-09-03 14:42:09 +02:00
temp_isartc = isartc_type ;
2018-09-03 13:55:09 +02:00
/* ISA memory boards. */
2018-09-03 14:42:09 +02:00
for ( i = 0 ; i < ISAMEM_MAX ; i + + )
2018-09-03 13:55:09 +02:00
temp_isamem [ i ] = isamem_type [ i ] ;
2018-07-15 01:41:53 +02:00
mfm_tracking = xta_tracking = esdi_tracking = ide_tracking = 0 ;
for ( i = 0 ; i < 2 ; i + + )
scsi_tracking [ i ] = 0 ;
/* Hard disks category */
memcpy ( temp_hdd , hdd , HDD_NUM * sizeof ( hard_disk_t ) ) ;
for ( i = 0 ; i < HDD_NUM ; i + + ) {
if ( hdd [ i ] . bus = = HDD_BUS_MFM )
mfm_tracking | = ( 1 < < ( hdd [ i ] . mfm_channel < < 3 ) ) ;
else if ( hdd [ i ] . bus = = HDD_BUS_XTA )
xta_tracking | = ( 1 < < ( hdd [ i ] . xta_channel < < 3 ) ) ;
else if ( hdd [ i ] . bus = = HDD_BUS_ESDI )
esdi_tracking | = ( 1 < < ( hdd [ i ] . esdi_channel < < 3 ) ) ;
else if ( hdd [ i ] . bus = = HDD_BUS_IDE )
ide_tracking | = ( 1 < < ( hdd [ i ] . ide_channel < < 3 ) ) ;
else if ( hdd [ i ] . bus = = HDD_BUS_SCSI )
scsi_tracking [ hdd [ i ] . scsi_id > > 3 ] | = ( 1 < < ( ( hdd [ i ] . scsi_id & 0x07 ) < < 3 ) ) ;
2018-09-03 13:55:09 +02:00
}
2018-07-15 01:41:53 +02:00
/* Floppy drives category */
for ( i = 0 ; i < FDD_NUM ; i + + ) {
temp_fdd_types [ i ] = fdd_get_type ( i ) ;
temp_fdd_turbo [ i ] = fdd_get_turbo ( i ) ;
temp_fdd_check_bpb [ i ] = fdd_get_check_bpb ( i ) ;
}
/* Other removable devices category */
2018-10-17 05:29:48 +02:00
memcpy ( temp_cdrom , cdrom , CDROM_NUM * sizeof ( cdrom_t ) ) ;
2018-07-15 01:41:53 +02:00
for ( i = 0 ; i < CDROM_NUM ; i + + ) {
2018-10-17 05:29:48 +02:00
if ( cdrom [ i ] . bus_type = = CDROM_BUS_ATAPI )
ide_tracking | = ( 2 < < ( cdrom [ i ] . ide_channel < < 3 ) ) ;
2019-09-26 10:02:43 +02:00
else if ( cdrom [ i ] . bus_type = = CDROM_BUS_SCSI )
2018-10-17 05:29:48 +02:00
scsi_tracking [ cdrom [ i ] . scsi_device_id > > 3 ] | = ( 1 < < ( ( cdrom [ i ] . scsi_device_id & 0x07 ) < < 3 ) ) ;
2018-07-15 01:41:53 +02:00
}
memcpy ( temp_zip_drives , zip_drives , ZIP_NUM * sizeof ( zip_drive_t ) ) ;
for ( i = 0 ; i < ZIP_NUM ; i + + ) {
if ( zip_drives [ i ] . bus_type = = ZIP_BUS_ATAPI )
ide_tracking | = ( 4 < < ( zip_drives [ i ] . ide_channel < < 3 ) ) ;
else if ( zip_drives [ i ] . bus_type = = ZIP_BUS_SCSI )
scsi_tracking [ zip_drives [ i ] . scsi_device_id > > 3 ] | = ( 1 < < ( ( zip_drives [ i ] . scsi_device_id & 0x07 ) < < 3 ) ) ;
}
2020-07-19 06:07:58 +02:00
memcpy ( temp_mo_drives , mo_drives , MO_NUM * sizeof ( mo_drive_t ) ) ;
for ( i = 0 ; i < MO_NUM ; i + + ) {
if ( mo_drives [ i ] . bus_type = = MO_BUS_ATAPI )
ide_tracking | = ( 1 < < ( mo_drives [ i ] . ide_channel < < 3 ) ) ;
else if ( mo_drives [ i ] . bus_type = = MO_BUS_SCSI )
scsi_tracking [ mo_drives [ i ] . scsi_device_id > > 3 ] | = ( 1 < < ( ( mo_drives [ i ] . scsi_device_id & 0x07 ) < < 3 ) ) ;
}
2018-07-15 01:41:53 +02:00
temp_deviceconfig = 0 ;
2017-05-18 14:03:43 -04:00
}
/* This returns 1 if any variable has changed, 0 if not. */
2018-07-15 01:41:53 +02:00
static int
win_settings_changed ( void )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
int i = 0 ;
int j = 0 ;
/* Machine category */
i = i | | ( machine ! = temp_machine ) ;
i = i | | ( cpu_manufacturer ! = temp_cpu_m ) ;
i = i | | ( cpu_waitstates ! = temp_wait_states ) ;
i = i | | ( cpu ! = temp_cpu ) ;
i = i | | ( mem_size ! = temp_mem_size ) ;
2017-10-15 02:43:13 +02:00
# ifdef USE_DYNAREC
2018-07-15 01:41:53 +02:00
i = i | | ( temp_dynarec ! = cpu_use_dynarec ) ;
2017-10-15 02:43:13 +02:00
# endif
2020-06-15 21:21:26 +02:00
i = i | | ( temp_fpu ! = fpu_type ) ;
2018-08-04 00:48:54 +02:00
i = i | | ( temp_sync ! = time_sync ) ;
2018-07-15 01:41:53 +02:00
/* Video category */
i = i | | ( gfxcard ! = temp_gfxcard ) ;
i = i | | ( voodoo_enabled ! = temp_voodoo ) ;
/* Input devices category */
i = i | | ( mouse_type ! = temp_mouse ) ;
i = i | | ( joystick_type ! = temp_joystick ) ;
/* Sound category */
i = i | | ( sound_card_current ! = temp_sound_card ) ;
i = i | | ( midi_device_current ! = temp_midi_device ) ;
2020-01-01 20:20:16 +01:00
i = i | | ( midi_input_device_current ! = temp_midi_input_device ) ;
2018-07-15 01:41:53 +02:00
i = i | | ( mpu401_standalone_enable ! = temp_mpu401 ) ;
i = i | | ( SSI2001 ! = temp_SSI2001 ) ;
i = i | | ( GAMEBLASTER ! = temp_GAMEBLASTER ) ;
i = i | | ( GUS ! = temp_GUS ) ;
i = i | | ( sound_is_float ! = temp_float ) ;
/* Network category */
i = i | | ( network_type ! = temp_net_type ) ;
i = i | | strcmp ( temp_pcap_dev , network_host ) ;
i = i | | ( network_card ! = temp_net_card ) ;
/* Ports category */
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
for ( j = 0 ; j < 3 ; j + + ) {
i = i | | ( temp_lpt_devices [ j ] ! = lpt_ports [ j ] . device ) ;
i = i | | ( temp_lpt [ j ] ! = lpt_ports [ j ] . enabled ) ;
}
2020-07-08 04:24:25 +02:00
for ( j = 0 ; j < 4 ; j + + )
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
i = i | | ( temp_serial [ j ] ! = serial_enabled [ j ] ) ;
2018-07-15 01:41:53 +02:00
/* Peripherals category */
i = i | | ( scsi_card_current ! = temp_scsi_card ) ;
2020-06-17 14:29:24 +02:00
i = i | | ( fdc_type ! = temp_fdc_card ) ;
2019-02-06 03:34:39 +01:00
i = i | | ( hdc_current ! = temp_hdc ) ;
2018-07-15 01:41:53 +02:00
i = i | | ( temp_ide_ter ! = ide_ter_enabled ) ;
i = i | | ( temp_ide_qua ! = ide_qua_enabled ) ;
i = i | | ( temp_bugger ! = bugger_enabled ) ;
2020-03-23 17:03:28 -03:00
i = i | | ( temp_postcard ! = postcard_enabled ) ;
2018-09-03 14:42:09 +02:00
i = i | | ( temp_isartc ! = isartc_type ) ;
2018-07-15 01:41:53 +02:00
2018-09-03 13:55:09 +02:00
/* ISA memory boards. */
for ( j = 0 ; j < ISAMEM_MAX ; j + + )
i = i | | ( temp_isamem [ j ] ! = isamem_type [ j ] ) ;
2018-07-15 01:41:53 +02:00
/* Hard disks category */
i = i | | memcmp ( hdd , temp_hdd , HDD_NUM * sizeof ( hard_disk_t ) ) ;
/* Floppy drives category */
for ( j = 0 ; j < FDD_NUM ; j + + ) {
i = i | | ( temp_fdd_types [ j ] ! = fdd_get_type ( j ) ) ;
i = i | | ( temp_fdd_turbo [ j ] ! = fdd_get_turbo ( j ) ) ;
i = i | | ( temp_fdd_check_bpb [ j ] ! = fdd_get_check_bpb ( j ) ) ;
}
/* Other removable devices category */
2018-10-17 05:29:48 +02:00
i = i | | memcmp ( cdrom , temp_cdrom , CDROM_NUM * sizeof ( cdrom_t ) ) ;
2018-07-15 01:41:53 +02:00
i = i | | memcmp ( zip_drives , temp_zip_drives , ZIP_NUM * sizeof ( zip_drive_t ) ) ;
2020-07-19 06:07:58 +02:00
i = i | | memcmp ( mo_drives , temp_mo_drives , MO_NUM * sizeof ( mo_drive_t ) ) ;
2018-07-15 01:41:53 +02:00
i = i | | ! ! temp_deviceconfig ;
return i ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
static int
settings_msgbox_reset ( void )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
int changed , i = 0 ;
2020-06-19 00:16:05 -03:00
HWND h ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
changed = win_settings_changed ( ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( changed ) {
2020-06-19 00:16:05 -03:00
h = hwndMain ;
hwndMain = hwndParentDialog ;
i = ui_msgbox_ex ( MBX_QUESTION | MBX_LINKS , ( wchar_t * ) IDS_2051 , NULL , ( wchar_t * ) IDS_2121 , ( wchar_t * ) IDS_2122 , ( wchar_t * ) IDS_2123 ) ;
hwndMain = h ;
2017-05-18 14:03:43 -04:00
2020-06-19 00:16:05 -03:00
if ( i = = 1 ) return ( 1 ) ; /* no */
2017-10-10 03:07:29 -04:00
2020-06-19 00:16:05 -03:00
if ( i = = - 1 ) return ( 0 ) ; /* cancel */
2017-10-10 03:07:29 -04:00
2020-06-19 00:16:05 -03:00
return ( 2 ) ; /* yes */
2018-07-15 01:41:53 +02:00
} else
return ( 1 ) ;
2017-05-18 14:03:43 -04:00
}
/* This saves the settings back to the global variables. */
2018-07-15 01:41:53 +02:00
static void
win_settings_save ( void )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
int i = 0 ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
pc_reset_hard_close ( ) ;
2017-06-19 06:46:08 +02:00
2018-07-15 01:41:53 +02:00
/* Machine category */
machine = temp_machine ;
cpu_manufacturer = temp_cpu_m ;
cpu_waitstates = temp_wait_states ;
cpu = temp_cpu ;
mem_size = temp_mem_size ;
2017-10-15 02:43:13 +02:00
# ifdef USE_DYNAREC
2018-07-15 01:41:53 +02:00
cpu_use_dynarec = temp_dynarec ;
2017-10-15 02:43:13 +02:00
# endif
2020-06-15 21:21:26 +02:00
fpu_type = temp_fpu ;
2018-08-01 18:07:52 +02:00
time_sync = temp_sync ;
2018-07-15 01:41:53 +02:00
/* Video category */
gfxcard = temp_gfxcard ;
voodoo_enabled = temp_voodoo ;
/* Input devices category */
mouse_type = temp_mouse ;
joystick_type = temp_joystick ;
/* Sound category */
sound_card_current = temp_sound_card ;
midi_device_current = temp_midi_device ;
2020-01-01 20:20:16 +01:00
midi_input_device_current = temp_midi_input_device ;
2018-07-15 01:41:53 +02:00
mpu401_standalone_enable = temp_mpu401 ;
SSI2001 = temp_SSI2001 ;
GAMEBLASTER = temp_GAMEBLASTER ;
GUS = temp_GUS ;
sound_is_float = temp_float ;
/* Network category */
network_type = temp_net_type ;
memset ( network_host , ' \0 ' , sizeof ( network_host ) ) ;
strcpy ( network_host , temp_pcap_dev ) ;
network_card = temp_net_card ;
/* Ports category */
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
for ( i = 0 ; i < 3 ; i + + ) {
lpt_ports [ i ] . device = temp_lpt_devices [ i ] ;
lpt_ports [ i ] . enabled = temp_lpt [ i ] ;
}
2020-07-08 04:24:25 +02:00
for ( i = 0 ; i < 4 ; i + + )
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
serial_enabled [ i ] = temp_serial [ i ] ;
2018-07-15 01:41:53 +02:00
/* Peripherals category */
scsi_card_current = temp_scsi_card ;
2019-02-06 03:34:39 +01:00
hdc_current = temp_hdc ;
2020-06-17 14:29:24 +02:00
fdc_type = temp_fdc_card ;
2018-07-15 01:41:53 +02:00
ide_ter_enabled = temp_ide_ter ;
ide_qua_enabled = temp_ide_qua ;
bugger_enabled = temp_bugger ;
2020-03-23 17:03:28 -03:00
postcard_enabled = temp_postcard ;
2018-09-03 14:42:09 +02:00
isartc_type = temp_isartc ;
2018-07-15 01:41:53 +02:00
2018-09-03 13:55:09 +02:00
/* ISA memory boards. */
for ( i = 0 ; i < ISAMEM_MAX ; i + + )
isamem_type [ i ] = temp_isamem [ i ] ;
2018-07-15 01:41:53 +02:00
/* Hard disks category */
memcpy ( hdd , temp_hdd , HDD_NUM * sizeof ( hard_disk_t ) ) ;
2018-11-08 19:21:55 +01:00
for ( i = 0 ; i < HDD_NUM ; i + + )
2018-10-30 13:32:25 +01:00
hdd [ i ] . priv = NULL ;
2018-07-15 01:41:53 +02:00
/* Floppy drives category */
for ( i = 0 ; i < FDD_NUM ; i + + ) {
fdd_set_type ( i , temp_fdd_types [ i ] ) ;
fdd_set_turbo ( i , temp_fdd_turbo [ i ] ) ;
fdd_set_check_bpb ( i , temp_fdd_check_bpb [ i ] ) ;
}
/* Removable devices category */
2018-10-17 05:29:48 +02:00
memcpy ( cdrom , temp_cdrom , CDROM_NUM * sizeof ( cdrom_t ) ) ;
2018-10-30 13:32:25 +01:00
for ( i = 0 ; i < CDROM_NUM ; i + + ) {
cdrom [ i ] . img_fp = NULL ;
cdrom [ i ] . priv = NULL ;
cdrom [ i ] . ops = NULL ;
cdrom [ i ] . image = NULL ;
cdrom [ i ] . insert = NULL ;
cdrom [ i ] . close = NULL ;
cdrom [ i ] . get_volume = NULL ;
cdrom [ i ] . get_channel = NULL ;
}
2018-07-15 01:41:53 +02:00
memcpy ( zip_drives , temp_zip_drives , ZIP_NUM * sizeof ( zip_drive_t ) ) ;
2018-10-30 13:32:25 +01:00
for ( i = 0 ; i < ZIP_NUM ; i + + ) {
zip_drives [ i ] . f = NULL ;
zip_drives [ i ] . priv = NULL ;
}
2020-07-19 06:07:58 +02:00
memcpy ( mo_drives , temp_mo_drives , MO_NUM * sizeof ( mo_drive_t ) ) ;
2020-07-15 09:03:30 +08:00
for ( i = 0 ; i < MO_NUM ; i + + ) {
mo_drives [ i ] . f = NULL ;
mo_drives [ i ] . priv = NULL ;
}
2018-07-15 01:41:53 +02:00
/* Mark configuration as changed. */
config_changed = 1 ;
pc_reset_hard_init ( ) ;
2017-05-18 14:03:43 -04:00
}
2020-06-15 21:21:26 +02:00
static void
win_settings_machine_recalc_fpu ( HWND hdlg )
{
HWND h ;
int c , type ;
LPTSTR lptsTemp ;
const char * stransi ;
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_FPU ) ;
SendMessage ( h , CB_RESETCONTENT , 0 , 0 ) ;
c = 0 ;
while ( 1 ) {
stransi = ( char * ) fpu_get_name_from_index ( temp_machine , temp_cpu_m , temp_cpu , c ) ;
type = fpu_get_type_from_index ( temp_machine , temp_cpu_m , temp_cpu , c ) ;
if ( ! stransi )
break ;
mbstowcs ( lptsTemp , stransi , strlen ( stransi ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) ( LPCSTR ) lptsTemp ) ;
if ( ! c | | ( type = = temp_fpu ) )
SendMessage ( h , CB_SETCURSEL , c , 0 ) ;
c + + ;
}
if ( c > 1 )
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
2020-07-22 16:39:57 +02:00
temp_fpu = fpu_get_type_from_index ( temp_machine , temp_cpu_m , temp_cpu , SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ) ;
2020-06-15 21:21:26 +02:00
}
2018-07-15 01:41:53 +02:00
static void
win_settings_machine_recalc_cpu ( HWND hdlg )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
HWND h ;
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
int cpu_type ;
2017-10-15 02:43:13 +02:00
# ifdef USE_DYNAREC
2018-07-15 01:41:53 +02:00
int cpu_flags ;
2017-10-15 02:43:13 +02:00
# endif
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_WS ) ;
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
cpu_type = machines [ temp_machine ] . cpu [ temp_cpu_m ] . cpus [ temp_cpu ] . cpu_type ;
2018-07-15 01:41:53 +02:00
if ( ( cpu_type > = CPU_286 ) & & ( cpu_type < = CPU_386DX ) )
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
2017-05-18 14:03:43 -04:00
2017-10-15 02:43:13 +02:00
# ifdef USE_DYNAREC
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_DYNAREC ) ;
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
cpu_flags = machines [ temp_machine ] . cpu [ temp_cpu_m ] . cpus [ temp_cpu ] . cpu_flags ;
2018-07-15 01:41:53 +02:00
if ( ! ( cpu_flags & CPU_SUPPORTS_DYNAREC ) & & ( cpu_flags & CPU_REQUIRES_DYNAREC ) )
fatal ( " Attempting to select a CPU that requires the recompiler and does not support it at the same time \n " ) ;
if ( ! ( cpu_flags & CPU_SUPPORTS_DYNAREC ) | | ( cpu_flags & CPU_REQUIRES_DYNAREC ) ) {
if ( ! ( cpu_flags & CPU_SUPPORTS_DYNAREC ) )
temp_dynarec = 0 ;
if ( cpu_flags & CPU_REQUIRES_DYNAREC )
temp_dynarec = 1 ;
SendMessage ( h , BM_SETCHECK , temp_dynarec , 0 ) ;
EnableWindow ( h , FALSE ) ;
} else
EnableWindow ( h , TRUE ) ;
2017-10-15 02:43:13 +02:00
# endif
2017-05-18 14:03:43 -04:00
2020-06-15 21:21:26 +02:00
win_settings_machine_recalc_fpu ( hdlg ) ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
static void
win_settings_machine_recalc_cpu_m ( HWND hdlg )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
HWND h ;
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
int c ;
2018-07-15 01:41:53 +02:00
LPTSTR lptsTemp ;
char * stransi ;
2019-02-06 03:34:39 +01:00
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_CPU ) ;
SendMessage ( h , CB_RESETCONTENT , 0 , 0 ) ;
c = 0 ;
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
while ( machines [ temp_machine ] . cpu [ temp_cpu_m ] . cpus [ c ] . cpu_type ! = - 1 ) {
stransi = ( char * ) machines [ temp_machine ] . cpu [ temp_cpu_m ] . cpus [ c ] . name ;
2018-07-15 01:41:53 +02:00
mbstowcs ( lptsTemp , stransi , strlen ( stransi ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) ( LPCSTR ) lptsTemp ) ;
c + + ;
}
2020-07-07 16:21:45 -03:00
EnableWindow ( h , ( c = = 1 ) ? FALSE : TRUE ) ;
2018-07-15 01:41:53 +02:00
if ( temp_cpu > = c )
temp_cpu = ( c - 1 ) ;
SendMessage ( h , CB_SETCURSEL , temp_cpu , 0 ) ;
win_settings_machine_recalc_cpu ( hdlg ) ;
free ( lptsTemp ) ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
static void
win_settings_machine_recalc_machine ( HWND hdlg )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
HWND h ;
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
int c , is_at ;
2018-07-15 01:41:53 +02:00
LPTSTR lptsTemp ;
const char * stransi ;
UDACCEL accel ;
2018-10-08 16:34:03 +02:00
device_t * d ;
2017-05-18 14:03:43 -04:00
2019-02-06 03:34:39 +01:00
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_MACHINE ) ;
2018-10-08 16:34:03 +02:00
d = ( device_t * ) machine_getdevice ( temp_machine ) ;
if ( d & & d - > config )
2018-07-15 01:41:53 +02:00
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_CPU_TYPE ) ;
SendMessage ( h , CB_RESETCONTENT , 0 , 0 ) ;
c = 0 ;
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
while ( machines [ temp_machine ] . cpu [ c ] . cpus ! = NULL & & c < 4 ) {
stransi = machines [ temp_machine ] . cpu [ c ] . name ;
2018-07-15 01:41:53 +02:00
mbstowcs ( lptsTemp , stransi , strlen ( stransi ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) ( LPCSTR ) lptsTemp ) ;
c + + ;
}
EnableWindow ( h , TRUE ) ;
if ( temp_cpu_m > = c )
temp_cpu_m = ( c - 1 ) ;
SendMessage ( h , CB_SETCURSEL , temp_cpu_m , 0 ) ;
EnableWindow ( h , ( c = = 1 ) ? FALSE : TRUE ) ;
win_settings_machine_recalc_cpu_m ( hdlg ) ;
h = GetDlgItem ( hdlg , IDC_MEMSPIN ) ;
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
SendMessage ( h , UDM_SETRANGE , 0 , ( machines [ temp_machine ] . min_ram < < 16 ) | machines [ temp_machine ] . max_ram ) ;
2018-07-15 01:41:53 +02:00
accel . nSec = 0 ;
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
accel . nInc = machines [ temp_machine ] . ram_granularity ;
2018-07-15 01:41:53 +02:00
SendMessage ( h , UDM_SETACCEL , 1 , ( LPARAM ) & accel ) ;
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
is_at = IS_ARCH ( temp_machine , ( MACHINE_BUS_ISA16 | MACHINE_BUS_MCA | MACHINE_BUS_PCMCIA ) ) ;
if ( ! is_at | | ( machines [ temp_machine ] . ram_granularity > = 128 ) ) {
2018-07-15 01:41:53 +02:00
SendMessage ( h , UDM_SETPOS , 0 , temp_mem_size ) ;
h = GetDlgItem ( hdlg , IDC_TEXT_MB ) ;
2020-04-26 19:22:13 +02:00
SendMessage ( h , WM_SETTEXT , 0 , win_get_string ( IDS_2088 ) ) ;
2018-07-15 01:41:53 +02:00
} else {
SendMessage ( h , UDM_SETPOS , 0 , temp_mem_size / 1024 ) ;
h = GetDlgItem ( hdlg , IDC_TEXT_MB ) ;
2020-04-26 19:22:13 +02:00
SendMessage ( h , WM_SETTEXT , 0 , win_get_string ( IDS_2086 ) ) ;
2018-07-15 01:41:53 +02:00
}
free ( lptsTemp ) ;
2017-05-18 14:03:43 -04:00
}
2019-03-20 02:42:55 +08:00
# if defined(__amd64__) || defined(__aarch64__)
2017-12-13 22:39:41 +01:00
static LRESULT CALLBACK
# else
static BOOL CALLBACK
# endif
win_settings_machine_proc ( HWND hdlg , UINT message , WPARAM wParam , LPARAM lParam )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
HWND h , h2 ;
2020-06-16 01:58:07 +02:00
int c , d , e , f ;
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
int old_machine_type , is_at ;
2018-07-15 01:41:53 +02:00
LPTSTR lptsTemp ;
char * stransi ;
switch ( message ) {
case WM_INITDIALOG :
2019-02-06 03:34:39 +01:00
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
2018-07-15 01:41:53 +02:00
2020-06-16 01:58:07 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_MACHINE_TYPE ) ;
f = 0 ;
memset ( machinetypetolist , 0x00 , sizeof ( machinetypetolist ) ) ;
memset ( listtomachinetype , 0x00 , sizeof ( listtomachinetype ) ) ;
for ( c = 1 ; c < MACHINE_TYPE_MAX ; c + + ) {
d = e = 0 ;
while ( machine_get_internal_name_ex ( d ) ! = NULL ) {
if ( machine_available ( d ) & & ( machines [ d ] . type = = c ) )
e + + ;
d + + ;
}
if ( e > 0 ) {
stransi = ( char * ) machine_types [ c ] . name ;
mbstowcs ( lptsTemp , stransi , strlen ( stransi ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
machinetypetolist [ c ] = f ;
listtomachinetype [ f ] = c ;
f + + ;
}
}
SendMessage ( h , CB_SETCURSEL , machinetypetolist [ temp_machine_type ] , 0 ) ;
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_MACHINE ) ;
c = d = 0 ;
2020-06-16 01:58:07 +02:00
memset ( machinetolist , 0x00 , sizeof ( machinetolist ) ) ;
memset ( listtomachine , 0x00 , sizeof ( listtomachine ) ) ;
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
while ( machine_get_internal_name_ex ( c ) ! = NULL ) {
2020-06-16 01:58:07 +02:00
if ( machine_available ( c ) & & ( machines [ c ] . type = = temp_machine_type ) ) {
2018-07-15 01:41:53 +02:00
stransi = ( char * ) machines [ c ] . name ;
mbstowcs ( lptsTemp , stransi , strlen ( stransi ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
machinetolist [ c ] = d ;
listtomachine [ d ] = c ;
d + + ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
c + + ;
}
SendMessage ( h , CB_SETCURSEL , machinetolist [ temp_machine ] , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_WS ) ;
2020-04-26 19:22:13 +02:00
SendMessage ( h , CB_ADDSTRING , 0 , win_get_string ( IDS_2090 ) ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
for ( c = 0 ; c < 8 ; c + + ) {
2020-04-26 21:59:22 +02:00
wsprintf ( lptsTemp , plat_get_string ( IDS_2091 ) , c ) ;
2018-07-15 01:41:53 +02:00
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
SendMessage ( h , CB_SETCURSEL , temp_wait_states , 0 ) ;
2017-05-18 14:03:43 -04:00
2017-10-15 02:43:13 +02:00
# ifdef USE_DYNAREC
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_DYNAREC ) ;
SendMessage ( h , BM_SETCHECK , temp_dynarec , 0 ) ;
2017-10-15 02:43:13 +02:00
# endif
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_MEMSPIN ) ;
h2 = GetDlgItem ( hdlg , IDC_MEMTEXT ) ;
SendMessage ( h , UDM_SETBUDDY , ( WPARAM ) h2 , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-08-04 00:48:54 +02:00
if ( temp_sync & TIME_SYNC_ENABLED )
{
if ( temp_sync & TIME_SYNC_UTC )
{
h = GetDlgItem ( hdlg , IDC_RADIO_TS_UTC ) ;
SendMessage ( h , BM_SETCHECK , BST_CHECKED , 0 ) ;
}
else
{
h = GetDlgItem ( hdlg , IDC_RADIO_TS_LOCAL ) ;
SendMessage ( h , BM_SETCHECK , BST_CHECKED , 0 ) ;
}
}
else
{
h = GetDlgItem ( hdlg , IDC_RADIO_TS_DISABLED ) ;
SendMessage ( h , BM_SETCHECK , BST_CHECKED , 0 ) ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
win_settings_machine_recalc_machine ( hdlg ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
free ( lptsTemp ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
return TRUE ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case WM_COMMAND :
switch ( LOWORD ( wParam ) ) {
2020-06-16 01:58:07 +02:00
case IDC_COMBO_MACHINE_TYPE :
if ( HIWORD ( wParam ) = = CBN_SELCHANGE ) {
h = GetDlgItem ( hdlg , IDC_COMBO_MACHINE_TYPE ) ;
old_machine_type = temp_machine_type ;
temp_machine_type = listtomachinetype [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_MACHINE ) ;
SendMessage ( h , CB_RESETCONTENT , 0 , 0 ) ;
c = d = 0 ;
memset ( machinetolist , 0x00 , sizeof ( machinetolist ) ) ;
memset ( listtomachine , 0x00 , sizeof ( listtomachine ) ) ;
while ( machine_get_internal_name_ex ( c ) ! = NULL ) {
if ( machine_available ( c ) & & ( machines [ c ] . type = = temp_machine_type ) ) {
stransi = ( char * ) machines [ c ] . name ;
mbstowcs ( lptsTemp , stransi , strlen ( stransi ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
machinetolist [ c ] = d ;
listtomachine [ d ] = c ;
d + + ;
}
c + + ;
}
if ( old_machine_type = = temp_machine_type )
SendMessage ( h , CB_SETCURSEL , machinetolist [ temp_machine ] , 0 ) ;
else {
SendMessage ( h , CB_SETCURSEL , 0 , 0 ) ;
temp_machine = listtomachine [ 0 ] ;
win_settings_machine_recalc_machine ( hdlg ) ;
}
}
break ;
2018-07-15 01:41:53 +02:00
case IDC_COMBO_MACHINE :
if ( HIWORD ( wParam ) = = CBN_SELCHANGE ) {
h = GetDlgItem ( hdlg , IDC_COMBO_MACHINE ) ;
temp_machine = listtomachine [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
win_settings_machine_recalc_machine ( hdlg ) ;
}
break ;
case IDC_COMBO_CPU_TYPE :
if ( HIWORD ( wParam ) = = CBN_SELCHANGE ) {
h = GetDlgItem ( hdlg , IDC_COMBO_CPU_TYPE ) ;
temp_cpu_m = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
temp_cpu = 0 ;
win_settings_machine_recalc_cpu_m ( hdlg ) ;
}
break ;
case IDC_COMBO_CPU :
if ( HIWORD ( wParam ) = = CBN_SELCHANGE ) {
h = GetDlgItem ( hdlg , IDC_COMBO_CPU ) ;
temp_cpu = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
win_settings_machine_recalc_cpu ( hdlg ) ;
}
break ;
2020-06-15 21:21:26 +02:00
case IDC_COMBO_FPU :
if ( HIWORD ( wParam ) = = CBN_SELCHANGE ) {
h = GetDlgItem ( hdlg , IDC_COMBO_FPU ) ;
temp_fpu = fpu_get_type_from_index ( temp_machine , temp_cpu_m , temp_cpu , SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ) ;
}
break ;
2018-07-15 01:41:53 +02:00
case IDC_CONFIGURE_MACHINE :
h = GetDlgItem ( hdlg , IDC_COMBO_MACHINE ) ;
temp_machine = listtomachine [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
temp_deviceconfig | = deviceconfig_open ( hdlg , ( void * ) machine_getdevice ( temp_machine ) ) ;
break ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
return FALSE ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case WM_SAVESETTINGS :
2019-02-06 03:34:39 +01:00
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
2018-07-15 01:41:53 +02:00
stransi = ( char * ) malloc ( 512 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
# ifdef USE_DYNAREC
h = GetDlgItem ( hdlg , IDC_CHECK_DYNAREC ) ;
temp_dynarec = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
# endif
2017-05-18 14:03:43 -04:00
2018-08-04 00:48:54 +02:00
h = GetDlgItem ( hdlg , IDC_RADIO_TS_DISABLED ) ;
if ( SendMessage ( h , BM_GETCHECK , 0 , 0 ) )
temp_sync = TIME_SYNC_DISABLED ;
h = GetDlgItem ( hdlg , IDC_RADIO_TS_LOCAL ) ;
if ( SendMessage ( h , BM_GETCHECK , 0 , 0 ) )
temp_sync = TIME_SYNC_ENABLED ;
h = GetDlgItem ( hdlg , IDC_RADIO_TS_UTC ) ;
if ( SendMessage ( h , BM_GETCHECK , 0 , 0 ) )
temp_sync = TIME_SYNC_ENABLED | TIME_SYNC_UTC ;
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_WS ) ;
temp_wait_states = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
h = GetDlgItem ( hdlg , IDC_MEMTEXT ) ;
SendMessage ( h , WM_GETTEXT , 255 , ( LPARAM ) lptsTemp ) ;
wcstombs ( stransi , lptsTemp , 512 ) ;
sscanf ( stransi , " %u " , & temp_mem_size ) ;
temp_mem_size & = ~ ( machines [ temp_machine ] . ram_granularity - 1 ) ;
if ( temp_mem_size < machines [ temp_machine ] . min_ram )
temp_mem_size = machines [ temp_machine ] . min_ram ;
else if ( temp_mem_size > machines [ temp_machine ] . max_ram )
temp_mem_size = machines [ temp_machine ] . max_ram ;
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
is_at = IS_ARCH ( temp_machine , ( MACHINE_BUS_ISA16 | MACHINE_BUS_MCA | MACHINE_BUS_PCMCIA ) ) ;
if ( is_at & & ( machines [ temp_machine ] . ram_granularity < 128 ) )
2018-07-15 01:41:53 +02:00
temp_mem_size * = 1024 ;
free ( stransi ) ;
free ( lptsTemp ) ;
default :
return FALSE ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
return FALSE ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
static void
recalc_vid_list ( HWND hdlg )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
HWND h = GetDlgItem ( hdlg , IDC_COMBO_VIDEO ) ;
int c = 0 , d = 0 ;
int found_card = 0 ;
WCHAR szText [ 512 ] ;
2017-11-05 01:57:04 -05:00
2018-07-15 01:41:53 +02:00
SendMessage ( h , CB_RESETCONTENT , 0 , 0 ) ;
SendMessage ( h , CB_SETCURSEL , 0 , 0 ) ;
while ( 1 ) {
/* Skip "internal" if machine doesn't have it. */
if ( ( c = = 1 ) & & ! ( machines [ temp_machine ] . flags & MACHINE_VIDEO ) ) {
c + + ;
continue ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
char * s = video_card_getname ( c ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( ! s [ 0 ] )
break ;
2017-05-18 14:03:43 -04:00
2018-09-19 20:46:42 +02:00
if ( video_card_available ( c ) & &
2018-07-15 01:41:53 +02:00
device_is_valid ( video_card_getdevice ( c ) , machines [ temp_machine ] . flags ) ) {
mbstowcs ( szText , s , strlen ( s ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) szText ) ;
2018-09-19 20:46:42 +02:00
if ( c = = temp_gfxcard ) {
2018-07-15 01:41:53 +02:00
SendMessage ( h , CB_SETCURSEL , d , 0 ) ;
found_card = 1 ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
d + + ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
c + + ;
}
if ( ! found_card )
SendMessage ( h , CB_SETCURSEL , 0 , 0 ) ;
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
EnableWindow ( h , ( machines [ temp_machine ] . flags & MACHINE_VIDEO_ONLY ) ? FALSE : TRUE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_VOODOO ) ;
EnableWindow ( h , ( machines [ temp_machine ] . flags & MACHINE_PCI ) ? TRUE : FALSE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_BUTTON_VOODOO ) ;
EnableWindow ( h , ( ( machines [ temp_machine ] . flags & MACHINE_PCI ) & & temp_voodoo ) ? TRUE : FALSE ) ;
2017-05-18 14:03:43 -04:00
}
2019-03-20 02:42:55 +08:00
# if defined(__amd64__) || defined(__aarch64__)
2017-12-13 22:39:41 +01:00
static LRESULT CALLBACK
# else
static BOOL CALLBACK
# endif
win_settings_video_proc ( HWND hdlg , UINT message , WPARAM wParam , LPARAM lParam )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
HWND h ;
LPTSTR lptsTemp ;
char * stransi ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
switch ( message ) {
case WM_INITDIALOG :
2019-02-06 03:34:39 +01:00
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
2018-07-15 01:41:53 +02:00
stransi = ( char * ) malloc ( 512 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
recalc_vid_list ( hdlg ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_VOODOO ) ;
SendMessage ( h , BM_SETCHECK , temp_voodoo , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_VIDEO ) ;
SendMessage ( h , CB_GETLBTEXT , SendMessage ( h , CB_GETCURSEL , 0 , 0 ) , ( LPARAM ) lptsTemp ) ;
wcstombs ( stransi , lptsTemp , 512 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_VID ) ;
2019-02-06 03:34:39 +01:00
if ( video_card_has_config ( temp_gfxcard ) )
2018-07-15 01:41:53 +02:00
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
free ( stransi ) ;
free ( lptsTemp ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
return TRUE ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case WM_COMMAND :
switch ( LOWORD ( wParam ) ) {
case IDC_COMBO_VIDEO :
2019-02-06 03:34:39 +01:00
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
2018-07-15 01:41:53 +02:00
stransi = ( char * ) malloc ( 512 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_VIDEO ) ;
SendMessage ( h , CB_GETLBTEXT , SendMessage ( h , CB_GETCURSEL , 0 , 0 ) , ( LPARAM ) lptsTemp ) ;
wcstombs ( stransi , lptsTemp , 512 ) ;
2019-02-06 03:34:39 +01:00
temp_gfxcard = video_card_getid ( stransi ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_VID ) ;
2019-02-06 03:34:39 +01:00
if ( video_card_has_config ( temp_gfxcard ) )
2018-07-15 01:41:53 +02:00
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
free ( stransi ) ;
free ( lptsTemp ) ;
break ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case IDC_CHECK_VOODOO :
h = GetDlgItem ( hdlg , IDC_CHECK_VOODOO ) ;
temp_voodoo = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_BUTTON_VOODOO ) ;
EnableWindow ( h , temp_voodoo ? TRUE : FALSE ) ;
break ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case IDC_BUTTON_VOODOO :
temp_deviceconfig | = deviceconfig_open ( hdlg , ( void * ) & voodoo_device ) ;
break ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case IDC_CONFIGURE_VID :
2019-02-06 03:34:39 +01:00
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
2018-07-15 01:41:53 +02:00
stransi = ( char * ) malloc ( 512 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_VIDEO ) ;
SendMessage ( h , CB_GETLBTEXT , SendMessage ( h , CB_GETCURSEL , 0 , 0 ) , ( LPARAM ) lptsTemp ) ;
wcstombs ( stransi , lptsTemp , 512 ) ;
temp_deviceconfig | = deviceconfig_open ( hdlg , ( void * ) video_card_getdevice ( video_card_getid ( stransi ) ) ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
free ( stransi ) ;
free ( lptsTemp ) ;
break ;
}
return FALSE ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case WM_SAVESETTINGS :
2019-02-06 03:34:39 +01:00
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
2018-07-15 01:41:53 +02:00
stransi = ( char * ) malloc ( 512 ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_VIDEO ) ;
SendMessage ( h , CB_GETLBTEXT , SendMessage ( h , CB_GETCURSEL , 0 , 0 ) , ( LPARAM ) lptsTemp ) ;
wcstombs ( stransi , lptsTemp , 512 ) ;
2018-09-19 20:46:42 +02:00
temp_gfxcard = video_card_getid ( stransi ) ;
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_VOODOO ) ;
temp_voodoo = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
free ( stransi ) ;
free ( lptsTemp ) ;
default :
return FALSE ;
}
return FALSE ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
static int
mouse_valid ( int num , int m )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
const device_t * dev ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( ( num = = MOUSE_TYPE_INTERNAL ) & &
! ( machines [ m ] . flags & MACHINE_MOUSE ) ) return ( 0 ) ;
2017-11-05 01:57:04 -05:00
2018-07-15 01:41:53 +02:00
dev = mouse_get_device ( num ) ;
return ( device_is_valid ( dev , machines [ m ] . flags ) ) ;
2017-05-18 14:03:43 -04:00
}
2019-03-20 02:42:55 +08:00
# if defined(__amd64__) || defined(__aarch64__)
2017-12-13 22:39:41 +01:00
static LRESULT CALLBACK
# else
static BOOL CALLBACK
# endif
win_settings_input_proc ( HWND hdlg , UINT message , WPARAM wParam , LPARAM lParam )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
wchar_t str [ 128 ] ;
2020-01-16 19:23:54 -05:00
char * joy_name ;
2018-07-15 01:41:53 +02:00
HWND h ;
int c , d ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
switch ( message ) {
case WM_INITDIALOG :
h = GetDlgItem ( hdlg , IDC_COMBO_MOUSE ) ;
c = d = 0 ;
for ( c = 0 ; c < mouse_get_ndev ( ) ; c + + ) {
2018-09-03 14:42:09 +02:00
settings_device_to_list [ 0 ] [ c ] = d ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( mouse_valid ( c , temp_machine ) ) {
mbstowcs ( str , mouse_get_name ( c ) , sizeof_w ( str ) ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) str ) ;
2018-01-26 13:35:50 +01:00
2018-09-03 14:42:09 +02:00
settings_list_to_device [ 0 ] [ d ] = c ;
2018-07-15 01:41:53 +02:00
d + + ;
2018-01-26 13:35:50 +01:00
}
2018-07-15 01:41:53 +02:00
}
2017-05-18 14:03:43 -04:00
2018-09-03 14:42:09 +02:00
SendMessage ( h , CB_SETCURSEL , settings_device_to_list [ 0 ] [ temp_mouse ] , 0 ) ;
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_MOUSE ) ;
if ( mouse_has_config ( temp_mouse ) )
2017-05-18 14:03:43 -04:00
EnableWindow ( h , TRUE ) ;
2018-07-15 01:41:53 +02:00
else
EnableWindow ( h , FALSE ) ;
2018-01-26 13:35:50 +01:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_JOYSTICK ) ;
c = 0 ;
2020-01-16 19:23:54 -05:00
joy_name = joystick_get_name ( c ) ;
while ( joy_name )
{
mbstowcs ( str , joy_name , strlen ( joy_name ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) str ) ;
2020-04-26 21:59:22 +02:00
// SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2096 + c));
2018-07-15 01:41:53 +02:00
c + + ;
2020-01-16 19:23:54 -05:00
joy_name = joystick_get_name ( c ) ;
2018-07-15 01:41:53 +02:00
}
EnableWindow ( h , TRUE ) ;
SendMessage ( h , CB_SETCURSEL , temp_joystick , 0 ) ;
h = GetDlgItem ( hdlg , IDC_JOY1 ) ;
EnableWindow ( h , ( joystick_get_max_joysticks ( temp_joystick ) > = 1 ) ? TRUE : FALSE ) ;
h = GetDlgItem ( hdlg , IDC_JOY2 ) ;
EnableWindow ( h , ( joystick_get_max_joysticks ( temp_joystick ) > = 2 ) ? TRUE : FALSE ) ;
h = GetDlgItem ( hdlg , IDC_JOY3 ) ;
EnableWindow ( h , ( joystick_get_max_joysticks ( temp_joystick ) > = 3 ) ? TRUE : FALSE ) ;
h = GetDlgItem ( hdlg , IDC_JOY4 ) ;
EnableWindow ( h , ( joystick_get_max_joysticks ( temp_joystick ) > = 4 ) ? TRUE : FALSE ) ;
return TRUE ;
case WM_COMMAND :
switch ( LOWORD ( wParam ) ) {
case IDC_COMBO_MOUSE :
h = GetDlgItem ( hdlg , IDC_COMBO_MOUSE ) ;
2018-09-03 14:42:09 +02:00
temp_mouse = settings_list_to_device [ 0 ] [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_MOUSE ) ;
if ( mouse_has_config ( temp_mouse ) )
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
break ;
2017-12-10 02:08:37 -05:00
2018-07-15 01:41:53 +02:00
case IDC_CONFIGURE_MOUSE :
h = GetDlgItem ( hdlg , IDC_COMBO_MOUSE ) ;
2018-09-03 14:42:09 +02:00
temp_mouse = settings_list_to_device [ 0 ] [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2018-07-15 01:41:53 +02:00
temp_deviceconfig | = deviceconfig_open ( hdlg , ( void * ) mouse_get_device ( temp_mouse ) ) ;
break ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case IDC_COMBO_JOYSTICK :
h = GetDlgItem ( hdlg , IDC_COMBO_JOYSTICK ) ;
temp_joystick = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
h = GetDlgItem ( hdlg , IDC_JOY1 ) ;
EnableWindow ( h , ( joystick_get_max_joysticks ( temp_joystick ) > = 1 ) ? TRUE : FALSE ) ;
h = GetDlgItem ( hdlg , IDC_JOY2 ) ;
EnableWindow ( h , ( joystick_get_max_joysticks ( temp_joystick ) > = 2 ) ? TRUE : FALSE ) ;
h = GetDlgItem ( hdlg , IDC_JOY3 ) ;
EnableWindow ( h , ( joystick_get_max_joysticks ( temp_joystick ) > = 3 ) ? TRUE : FALSE ) ;
h = GetDlgItem ( hdlg , IDC_JOY4 ) ;
EnableWindow ( h , ( joystick_get_max_joysticks ( temp_joystick ) > = 4 ) ? TRUE : FALSE ) ;
break ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case IDC_JOY1 :
h = GetDlgItem ( hdlg , IDC_COMBO_JOYSTICK ) ;
temp_joystick = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
temp_deviceconfig | = joystickconfig_open ( hdlg , 0 , temp_joystick ) ;
break ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case IDC_JOY2 :
h = GetDlgItem ( hdlg , IDC_COMBO_JOYSTICK ) ;
temp_joystick = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
temp_deviceconfig | = joystickconfig_open ( hdlg , 1 , temp_joystick ) ;
break ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case IDC_JOY3 :
h = GetDlgItem ( hdlg , IDC_COMBO_JOYSTICK ) ;
temp_joystick = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
temp_deviceconfig | = joystickconfig_open ( hdlg , 2 , temp_joystick ) ;
break ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case IDC_JOY4 :
h = GetDlgItem ( hdlg , IDC_COMBO_JOYSTICK ) ;
temp_joystick = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
temp_deviceconfig | = joystickconfig_open ( hdlg , 3 , temp_joystick ) ;
break ;
}
return FALSE ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case WM_SAVESETTINGS :
h = GetDlgItem ( hdlg , IDC_COMBO_MOUSE ) ;
2018-09-03 14:42:09 +02:00
temp_mouse = settings_list_to_device [ 0 ] [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_JOYSTICK ) ;
temp_joystick = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
default :
return FALSE ;
}
return FALSE ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
static int
mpu401_present ( void )
2017-06-03 20:32:58 +02:00
{
2018-07-15 01:41:53 +02:00
return temp_mpu401 ? 1 : 0 ;
2017-06-03 20:32:58 +02:00
}
2018-07-15 01:41:53 +02:00
int
mpu401_standalone_allow ( void )
2017-06-03 20:32:58 +02:00
{
2020-01-01 20:20:16 +01:00
char * md , * mdin ;
2017-06-03 20:32:58 +02:00
2018-07-15 01:41:53 +02:00
md = midi_device_get_internal_name ( temp_midi_device ) ;
2020-01-01 20:20:16 +01:00
mdin = midi_in_device_get_internal_name ( temp_midi_input_device ) ;
2018-07-15 01:41:53 +02:00
if ( md ! = NULL ) {
2020-01-01 20:20:16 +01:00
if ( ! strcmp ( md , " none " ) & & ! strcmp ( mdin , " none " ) )
2018-07-15 01:41:53 +02:00
return 0 ;
}
2017-06-19 06:46:08 +02:00
2018-07-15 01:41:53 +02:00
return 1 ;
2017-06-03 20:32:58 +02:00
}
2019-03-20 02:42:55 +08:00
# if defined(__amd64__) || defined(__aarch64__)
2017-12-13 22:39:41 +01:00
static LRESULT CALLBACK
# else
static BOOL CALLBACK
# endif
win_settings_sound_proc ( HWND hdlg , UINT message , WPARAM wParam , LPARAM lParam )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
HWND h ;
int c , d ;
LPTSTR lptsTemp ;
const device_t * sound_dev ;
char * s ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
switch ( message ) {
case WM_INITDIALOG :
2019-02-06 03:34:39 +01:00
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_SOUND ) ;
c = d = 0 ;
while ( 1 ) {
2020-07-27 12:25:06 -03:00
/* Skip "internal" if machine doesn't have it. */
if ( ( c = = 1 ) & & ! ( machines [ temp_machine ] . flags & MACHINE_SOUND ) ) {
c + + ;
continue ;
}
2018-07-15 01:41:53 +02:00
s = sound_card_getname ( c ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( ! s [ 0 ] )
break ;
2017-05-18 14:03:43 -04:00
2018-09-03 14:42:09 +02:00
settings_device_to_list [ 0 ] [ c ] = d ;
2018-07-15 01:41:53 +02:00
if ( sound_card_available ( c ) ) {
sound_dev = sound_card_getdevice ( c ) ;
if ( device_is_valid ( sound_dev , machines [ temp_machine ] . flags ) ) {
if ( c = = 0 )
2020-04-26 19:22:13 +02:00
SendMessage ( h , CB_ADDSTRING , 0 , win_get_string ( IDS_2103 ) ) ;
2018-07-15 01:41:53 +02:00
else {
mbstowcs ( lptsTemp , s , strlen ( s ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
2017-05-18 14:03:43 -04:00
}
2018-09-03 14:42:09 +02:00
settings_list_to_device [ 0 ] [ d ] = c ;
2018-07-15 01:41:53 +02:00
d + + ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
c + + ;
}
2018-09-03 14:42:09 +02:00
SendMessage ( h , CB_SETCURSEL , settings_device_to_list [ 0 ] [ temp_sound_card ] , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
EnableWindow ( h , d ? TRUE : FALSE ) ;
2017-10-10 00:14:15 +02:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_SND ) ;
EnableWindow ( h , sound_card_has_config ( temp_sound_card ) ? TRUE : FALSE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_MIDI ) ;
c = d = 0 ;
while ( 1 ) {
s = midi_device_getname ( c ) ;
2017-06-19 06:46:08 +02:00
2018-07-15 01:41:53 +02:00
if ( ! s [ 0 ] )
break ;
2017-06-19 06:46:08 +02:00
2018-07-15 01:41:53 +02:00
settings_midi_to_list [ c ] = d ;
2017-06-19 06:46:08 +02:00
2018-07-15 01:41:53 +02:00
if ( midi_device_available ( c ) ) {
if ( c = = 0 )
2020-04-26 19:22:13 +02:00
SendMessage ( h , CB_ADDSTRING , 0 , win_get_string ( IDS_2103 ) ) ;
2018-07-15 01:41:53 +02:00
else {
mbstowcs ( lptsTemp , s , strlen ( s ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
2017-06-19 06:46:08 +02:00
}
2018-07-15 01:41:53 +02:00
settings_list_to_midi [ d ] = c ;
d + + ;
2017-06-19 06:46:08 +02:00
}
2018-07-15 01:41:53 +02:00
c + + ;
}
SendMessage ( h , CB_SETCURSEL , settings_midi_to_list [ temp_midi_device ] , 0 ) ;
2017-06-03 20:32:58 +02:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_MIDI ) ;
if ( midi_device_has_config ( temp_midi_device ) )
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
2017-06-03 20:32:58 +02:00
2020-01-01 20:20:16 +01:00
h = GetDlgItem ( hdlg , IDC_COMBO_MIDI_IN ) ;
c = d = 0 ;
while ( 1 ) {
s = midi_in_device_getname ( c ) ;
if ( ! s [ 0 ] )
break ;
settings_midi_in_to_list [ c ] = d ;
if ( midi_in_device_available ( c ) ) {
if ( c = = 0 )
2020-04-26 19:22:13 +02:00
SendMessage ( h , CB_ADDSTRING , 0 , win_get_string ( IDS_2103 ) ) ;
2020-01-01 20:20:16 +01:00
else {
mbstowcs ( lptsTemp , s , strlen ( s ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
}
settings_list_to_midi_in [ d ] = c ;
d + + ;
}
c + + ;
}
SendMessage ( h , CB_SETCURSEL , settings_midi_in_to_list [ temp_midi_input_device ] , 0 ) ;
h = GetDlgItem ( hdlg , IDC_CONFIGURE_MIDI_IN ) ;
if ( midi_in_device_has_config ( temp_midi_input_device ) )
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_MPU401 ) ;
SendMessage ( h , BM_SETCHECK , temp_mpu401 , 0 ) ;
EnableWindow ( h , mpu401_standalone_allow ( ) ? TRUE : FALSE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_MPU401 ) ;
EnableWindow ( h , ( mpu401_standalone_allow ( ) & & temp_mpu401 ) ? TRUE : FALSE ) ;
2020-01-01 20:20:16 +01:00
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_CMS ) ;
SendMessage ( h , BM_SETCHECK , temp_GAMEBLASTER , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_GUS ) ;
SendMessage ( h , BM_SETCHECK , temp_GUS , 0 ) ;
2020-01-08 17:49:06 +01:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_GUS ) ;
EnableWindow ( h , ( temp_GUS ) ? TRUE : FALSE ) ;
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_SSI ) ;
SendMessage ( h , BM_SETCHECK , temp_SSI2001 , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_FLOAT ) ;
SendMessage ( h , BM_SETCHECK , temp_float , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
free ( lptsTemp ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
return TRUE ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case WM_COMMAND :
switch ( LOWORD ( wParam ) ) {
case IDC_COMBO_SOUND :
h = GetDlgItem ( hdlg , IDC_COMBO_SOUND ) ;
2018-09-03 14:42:09 +02:00
temp_sound_card = settings_list_to_device [ 0 ] [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2017-06-19 06:46:08 +02:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_SND ) ;
if ( sound_card_has_config ( temp_sound_card ) )
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
2017-06-20 23:19:00 +02:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_MPU401 ) ;
SendMessage ( h , BM_SETCHECK , temp_mpu401 , 0 ) ;
EnableWindow ( h , mpu401_standalone_allow ( ) ? TRUE : FALSE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_MPU401 ) ;
EnableWindow ( h , ( mpu401_standalone_allow ( ) & & temp_mpu401 ) ? TRUE : FALSE ) ;
break ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case IDC_CONFIGURE_SND :
h = GetDlgItem ( hdlg , IDC_COMBO_SOUND ) ;
2018-09-03 14:42:09 +02:00
temp_sound_card = settings_list_to_device [ 0 ] [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2017-06-19 06:46:08 +02:00
2018-07-15 01:41:53 +02:00
temp_deviceconfig | = deviceconfig_open ( hdlg , ( void * ) sound_card_getdevice ( temp_sound_card ) ) ;
break ;
2017-06-19 06:46:08 +02:00
2018-07-15 01:41:53 +02:00
case IDC_COMBO_MIDI :
h = GetDlgItem ( hdlg , IDC_COMBO_MIDI ) ;
temp_midi_device = settings_list_to_midi [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2017-06-03 20:32:58 +02:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_MIDI ) ;
if ( midi_device_has_config ( temp_midi_device ) )
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
2017-06-20 23:19:00 +02:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_MPU401 ) ;
SendMessage ( h , BM_SETCHECK , temp_mpu401 , 0 ) ;
EnableWindow ( h , mpu401_standalone_allow ( ) ? TRUE : FALSE ) ;
2017-06-03 20:32:58 +02:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_MPU401 ) ;
EnableWindow ( h , ( mpu401_standalone_allow ( ) & & temp_mpu401 ) ? TRUE : FALSE ) ;
break ;
2017-06-19 06:46:08 +02:00
2018-07-15 01:41:53 +02:00
case IDC_CONFIGURE_MIDI :
h = GetDlgItem ( hdlg , IDC_COMBO_MIDI ) ;
temp_midi_device = settings_list_to_midi [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2017-06-19 06:46:08 +02:00
2018-07-15 01:41:53 +02:00
temp_deviceconfig | = deviceconfig_open ( hdlg , ( void * ) midi_device_getdevice ( temp_midi_device ) ) ;
break ;
2017-06-03 20:32:58 +02:00
2020-01-01 20:20:16 +01:00
case IDC_COMBO_MIDI_IN :
h = GetDlgItem ( hdlg , IDC_COMBO_MIDI_IN ) ;
temp_midi_input_device = settings_list_to_midi_in [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
h = GetDlgItem ( hdlg , IDC_CONFIGURE_MIDI_IN ) ;
if ( midi_in_device_has_config ( temp_midi_input_device ) )
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
h = GetDlgItem ( hdlg , IDC_CHECK_MPU401 ) ;
SendMessage ( h , BM_SETCHECK , temp_mpu401 , 0 ) ;
EnableWindow ( h , mpu401_standalone_allow ( ) ? TRUE : FALSE ) ;
h = GetDlgItem ( hdlg , IDC_CONFIGURE_MPU401 ) ;
EnableWindow ( h , ( mpu401_standalone_allow ( ) & & temp_mpu401 ) ? TRUE : FALSE ) ;
break ;
case IDC_CONFIGURE_MIDI_IN :
h = GetDlgItem ( hdlg , IDC_COMBO_MIDI_IN ) ;
temp_midi_input_device = settings_list_to_midi_in [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
temp_deviceconfig | = deviceconfig_open ( hdlg , ( void * ) midi_in_device_getdevice ( temp_midi_input_device ) ) ;
break ;
2018-07-15 01:41:53 +02:00
case IDC_CHECK_MPU401 :
h = GetDlgItem ( hdlg , IDC_CHECK_MPU401 ) ;
temp_mpu401 = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
2017-06-03 20:32:58 +02:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_MPU401 ) ;
EnableWindow ( h , mpu401_present ( ) ? TRUE : FALSE ) ;
break ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case IDC_CONFIGURE_MPU401 :
2018-09-11 23:12:23 +02:00
temp_deviceconfig | = deviceconfig_open ( hdlg , ( machines [ temp_machine ] . flags & MACHINE_MCA ) ?
( void * ) & mpu401_mca_device : ( void * ) & mpu401_device ) ;
2018-09-11 22:41:14 +02:00
break ;
2020-01-08 17:49:06 +01:00
case IDC_CHECK_GUS :
h = GetDlgItem ( hdlg , IDC_CHECK_GUS ) ;
temp_GUS = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
h = GetDlgItem ( hdlg , IDC_CONFIGURE_GUS ) ;
EnableWindow ( h , temp_GUS ? TRUE : FALSE ) ;
break ;
case IDC_CONFIGURE_GUS :
temp_deviceconfig | = deviceconfig_open ( hdlg , ( void * ) & gus_device ) ;
break ;
2018-07-15 01:41:53 +02:00
}
return FALSE ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case WM_SAVESETTINGS :
h = GetDlgItem ( hdlg , IDC_COMBO_SOUND ) ;
2018-09-03 14:42:09 +02:00
temp_sound_card = settings_list_to_device [ 0 ] [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_MIDI ) ;
temp_midi_device = settings_list_to_midi [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2017-06-03 20:32:58 +02:00
2020-01-01 20:20:16 +01:00
h = GetDlgItem ( hdlg , IDC_COMBO_MIDI_IN ) ;
temp_midi_input_device = settings_list_to_midi_in [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_MPU401 ) ;
temp_mpu401 = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_CMS ) ;
temp_GAMEBLASTER = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_GUS ) ;
temp_GUS = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_SSI ) ;
temp_SSI2001 = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_FLOAT ) ;
temp_float = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
default :
return FALSE ;
}
return FALSE ;
2017-05-18 14:03:43 -04:00
}
2019-03-20 02:42:55 +08:00
# if defined(__amd64__) || defined(__aarch64__)
2017-12-13 22:39:41 +01:00
static LRESULT CALLBACK
# else
static BOOL CALLBACK
# endif
win_settings_ports_proc ( HWND hdlg , UINT message , WPARAM wParam , LPARAM lParam )
2017-09-02 23:39:26 +02:00
{
2018-07-15 01:41:53 +02:00
HWND h ;
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
int c , i ;
2018-07-15 01:41:53 +02:00
char * s ;
LPTSTR lptsTemp ;
2017-09-02 23:39:26 +02:00
2018-07-15 01:41:53 +02:00
switch ( message ) {
case WM_INITDIALOG :
2019-02-06 03:34:39 +01:00
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
2018-07-15 01:41:53 +02:00
for ( i = 0 ; i < 3 ; i + + ) {
h = GetDlgItem ( hdlg , IDC_COMBO_LPT1 + i ) ;
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
c = 0 ;
2018-07-15 01:41:53 +02:00
while ( 1 ) {
s = lpt_device_get_name ( c ) ;
2017-09-02 23:39:26 +02:00
2018-07-15 01:41:53 +02:00
if ( ! s )
break ;
2017-09-02 23:39:26 +02:00
2018-07-15 01:41:53 +02:00
if ( c = = 0 )
2020-04-26 19:22:13 +02:00
SendMessage ( h , CB_ADDSTRING , 0 , win_get_string ( IDS_2103 ) ) ;
2018-07-15 01:41:53 +02:00
else {
mbstowcs ( lptsTemp , s , strlen ( s ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
2018-02-06 19:53:34 +01:00
}
2018-07-15 01:41:53 +02:00
c + + ;
2017-09-02 23:39:26 +02:00
}
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
SendMessage ( h , CB_SETCURSEL , temp_lpt_devices [ i ] , 0 ) ;
2017-09-02 23:39:26 +02:00
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_PARALLEL1 + i ) ;
SendMessage ( h , BM_SETCHECK , temp_lpt [ i ] , 0 ) ;
2020-04-10 15:14:34 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_LPT1 + i ) ;
EnableWindow ( h , temp_lpt [ i ] ? TRUE : FALSE ) ;
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
}
2017-09-02 23:39:26 +02:00
2020-07-08 04:24:25 +02:00
for ( i = 0 ; i < 4 ; i + + ) {
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_SERIAL1 + i ) ;
SendMessage ( h , BM_SETCHECK , temp_serial [ i ] , 0 ) ;
}
2017-09-02 23:39:26 +02:00
2018-07-15 01:41:53 +02:00
free ( lptsTemp ) ;
2017-09-02 23:39:26 +02:00
2018-07-15 01:41:53 +02:00
return TRUE ;
2017-09-02 23:39:26 +02:00
2020-04-10 15:14:34 +02:00
case WM_COMMAND :
switch ( LOWORD ( wParam ) ) {
case IDC_CHECK_PARALLEL1 :
case IDC_CHECK_PARALLEL2 :
case IDC_CHECK_PARALLEL3 :
i = LOWORD ( wParam ) - IDC_CHECK_PARALLEL1 ;
h = GetDlgItem ( hdlg , IDC_CHECK_PARALLEL1 + i ) ;
if ( SendMessage ( h , BM_GETCHECK , 0 , 0 ) = = BST_CHECKED )
{
h = GetDlgItem ( hdlg , IDC_COMBO_LPT1 + i ) ;
EnableWindow ( h , TRUE ) ;
}
else
{
h = GetDlgItem ( hdlg , IDC_COMBO_LPT1 + i ) ;
EnableWindow ( h , FALSE ) ;
}
break ;
}
break ;
2018-07-15 01:41:53 +02:00
case WM_SAVESETTINGS :
for ( i = 0 ; i < 3 ; i + + ) {
h = GetDlgItem ( hdlg , IDC_COMBO_LPT1 + i ) ;
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
temp_lpt_devices [ i ] = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
2017-09-02 23:39:26 +02:00
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_PARALLEL1 + i ) ;
temp_lpt [ i ] = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
}
2017-09-02 23:39:26 +02:00
2020-07-08 04:24:25 +02:00
for ( i = 0 ; i < 4 ; i + + ) {
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_SERIAL1 + i ) ;
temp_serial [ i ] = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
}
2017-09-02 23:39:26 +02:00
2018-07-15 01:41:53 +02:00
default :
return FALSE ;
}
return FALSE ;
2017-09-02 23:39:26 +02:00
}
2018-07-15 01:41:53 +02:00
static void
2019-02-06 03:34:39 +01:00
recalc_hdc_list ( HWND hdlg )
2017-09-02 23:39:26 +02:00
{
2019-02-06 03:34:39 +01:00
HWND h = GetDlgItem ( hdlg , IDC_COMBO_HDC ) ;
int c = 0 , d = 0 ;
int found_card = 0 ;
WCHAR szText [ 512 ] ;
2018-07-15 01:41:53 +02:00
SendMessage ( h , CB_RESETCONTENT , 0 , 0 ) ;
2019-02-06 03:34:39 +01:00
SendMessage ( h , CB_SETCURSEL , 0 , 0 ) ;
2018-07-15 01:41:53 +02:00
while ( 1 ) {
2019-02-06 03:34:39 +01:00
/* Skip "internal" if machine doesn't have it. */
if ( ( c = = 1 ) & & ! ( machines [ temp_machine ] . flags & MACHINE_HDC ) ) {
2017-10-02 02:15:35 -04:00
c + + ;
2018-07-15 01:41:53 +02:00
continue ;
2017-10-02 02:15:35 -04:00
}
2017-09-02 23:39:26 +02:00
2019-02-06 03:34:39 +01:00
char * s = hdc_get_name ( c ) ;
if ( ! s [ 0 ] )
break ;
if ( hdc_available ( c ) & &
device_is_valid ( hdc_get_device ( c ) , machines [ temp_machine ] . flags ) ) {
mbstowcs ( szText , s , strlen ( s ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) szText ) ;
if ( c = = temp_hdc ) {
SendMessage ( h , CB_SETCURSEL , d , 0 ) ;
found_card = 1 ;
}
d + + ;
2017-09-02 23:39:26 +02:00
}
2019-02-06 03:34:39 +01:00
2018-07-15 01:41:53 +02:00
c + + ;
}
2019-02-06 03:34:39 +01:00
if ( ! found_card )
2018-07-15 01:41:53 +02:00
SendMessage ( h , CB_SETCURSEL , 0 , 0 ) ;
2017-09-02 23:39:26 +02:00
}
2019-03-20 02:42:55 +08:00
# if defined(__amd64__) || defined(__aarch64__)
2017-12-13 22:39:41 +01:00
static LRESULT CALLBACK
# else
static BOOL CALLBACK
# endif
win_settings_peripherals_proc ( HWND hdlg , UINT message , WPARAM wParam , LPARAM lParam )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
HWND h ;
2019-02-06 03:34:39 +01:00
int c , d ;
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
int e , is_at ;
2018-07-15 01:41:53 +02:00
LPTSTR lptsTemp ;
2019-02-06 03:34:39 +01:00
char * stransi ;
2018-07-15 01:41:53 +02:00
const device_t * scsi_dev ;
2018-09-06 14:38:43 +02:00
const device_t * dev ;
2020-06-17 14:29:24 +02:00
const device_t * fdc_dev ;
2018-09-06 14:38:43 +02:00
char * s ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
switch ( message ) {
case WM_INITDIALOG :
2019-02-06 03:34:39 +01:00
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
stransi = ( char * ) malloc ( 512 ) ;
/*HD controller config*/
recalc_hdc_list ( hdlg ) ;
h = GetDlgItem ( hdlg , IDC_CONFIGURE_HDC ) ;
if ( hdc_has_config ( temp_hdc ) )
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
2017-05-18 14:03:43 -04:00
2020-06-17 14:29:24 +02:00
/*FD controller config*/
h = GetDlgItem ( hdlg , IDC_COMBO_FDC ) ;
c = d = 0 ;
while ( 1 ) {
char * s = fdc_card_getname ( c ) ;
if ( ! s [ 0 ] )
break ;
settings_fdc_to_list [ 0 ] [ c ] = d ;
if ( fdc_card_available ( c ) ) {
fdc_dev = fdc_card_getdevice ( c ) ;
if ( device_is_valid ( fdc_dev , machines [ temp_machine ] . flags ) ) {
if ( c = = 0 )
SendMessage ( h , CB_ADDSTRING , 0 , win_get_string ( IDS_2118 ) ) ;
else {
mbstowcs ( lptsTemp , s , strlen ( s ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
}
settings_list_to_fdc [ 0 ] [ d ] = c ;
d + + ;
}
}
c + + ;
}
SendMessage ( h , CB_SETCURSEL , settings_fdc_to_list [ 0 ] [ temp_fdc_card ] , 0 ) ;
EnableWindow ( h , d ? TRUE : FALSE ) ;
h = GetDlgItem ( hdlg , IDC_CONFIGURE_FDC ) ;
EnableWindow ( h , fdc_card_has_config ( temp_fdc_card ) ? TRUE : FALSE ) ;
2018-07-15 01:41:53 +02:00
/*SCSI config*/
h = GetDlgItem ( hdlg , IDC_COMBO_SCSI ) ;
c = d = 0 ;
while ( 1 ) {
char * s = scsi_card_getname ( c ) ;
2017-10-10 00:14:15 +02:00
2018-07-15 01:41:53 +02:00
if ( ! s [ 0 ] )
break ;
2017-10-10 03:07:29 -04:00
2018-09-03 14:42:09 +02:00
settings_device_to_list [ 0 ] [ c ] = d ;
2018-07-15 01:41:53 +02:00
if ( scsi_card_available ( c ) ) {
scsi_dev = scsi_card_getdevice ( c ) ;
if ( device_is_valid ( scsi_dev , machines [ temp_machine ] . flags ) ) {
if ( c = = 0 )
2020-04-26 19:22:13 +02:00
SendMessage ( h , CB_ADDSTRING , 0 , win_get_string ( IDS_2103 ) ) ;
2018-07-15 01:41:53 +02:00
else {
mbstowcs ( lptsTemp , s , strlen ( s ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
2017-05-18 14:03:43 -04:00
}
2018-09-03 14:42:09 +02:00
settings_list_to_device [ 0 ] [ d ] = c ;
2018-07-15 01:41:53 +02:00
d + + ;
2017-05-18 14:03:43 -04:00
}
}
2018-07-15 01:41:53 +02:00
c + + ;
}
2018-09-03 14:42:09 +02:00
SendMessage ( h , CB_SETCURSEL , settings_device_to_list [ 0 ] [ temp_scsi_card ] , 0 ) ;
2017-10-10 00:14:15 +02:00
2018-07-15 01:41:53 +02:00
EnableWindow ( h , d ? TRUE : FALSE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_SCSI ) ;
EnableWindow ( h , scsi_card_has_config ( temp_scsi_card ) ? TRUE : FALSE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_IDE_TER ) ;
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
is_at = IS_ARCH ( temp_machine , ( MACHINE_BUS_ISA16 | MACHINE_BUS_MCA | MACHINE_BUS_PCMCIA ) ) ;
EnableWindow ( h , is_at ? TRUE : FALSE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_BUTTON_IDE_TER ) ;
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
EnableWindow ( h , ( is_at & & temp_ide_ter ) ? TRUE : FALSE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_IDE_QUA ) ;
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
EnableWindow ( h , is_at ? TRUE : FALSE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_BUTTON_IDE_QUA ) ;
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
EnableWindow ( h , ( is_at & & temp_ide_qua ) ? TRUE : FALSE ) ;
2018-04-25 23:51:13 +02:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_IDE_TER ) ;
SendMessage ( h , BM_SETCHECK , temp_ide_ter , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_IDE_QUA ) ;
SendMessage ( h , BM_SETCHECK , temp_ide_qua , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_BUGGER ) ;
SendMessage ( h , BM_SETCHECK , temp_bugger , 0 ) ;
2017-05-18 14:03:43 -04:00
2020-03-23 17:03:28 -03:00
h = GetDlgItem ( hdlg , IDC_CHECK_POSTCARD ) ;
SendMessage ( h , BM_SETCHECK , temp_postcard , 0 ) ;
2018-09-03 13:55:09 +02:00
/* Populate the ISA RTC card dropdown. */
e = 0 ;
h = GetDlgItem ( hdlg , IDC_COMBO_ISARTC ) ;
for ( d = 0 ; ; d + + ) {
2018-09-06 14:38:43 +02:00
s = isartc_get_name ( d ) ;
2018-09-03 13:55:09 +02:00
if ( ! s [ 0 ] )
break ;
2018-09-03 14:42:09 +02:00
settings_device_to_list [ 1 ] [ d ] = e ;
2018-09-03 13:55:09 +02:00
if ( d = = 0 ) {
/* Translate "None". */
2020-04-26 19:22:13 +02:00
SendMessage ( h , CB_ADDSTRING , 0 , win_get_string ( IDS_2103 ) ) ;
2018-09-03 13:55:09 +02:00
} else {
mbstowcs ( lptsTemp , s , strlen ( s ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
}
2018-09-03 14:42:09 +02:00
settings_list_to_device [ 1 ] [ e ] = d ;
2018-09-03 13:55:09 +02:00
e + + ;
}
SendMessage ( h , CB_SETCURSEL , temp_isartc , 0 ) ;
h = GetDlgItem ( hdlg , IDC_CONFIGURE_ISARTC ) ;
if ( temp_isartc ! = 0 )
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
/* Populate the ISA memory card dropdowns. */
for ( c = 0 ; c < ISAMEM_MAX ; c + + ) {
h = GetDlgItem ( hdlg , IDC_COMBO_ISAMEM_1 + c ) ;
for ( d = 0 ; ; d + + ) {
2018-09-06 14:38:43 +02:00
s = ( char * ) isamem_get_internal_name ( d ) ;
if ( s = = NULL )
2018-09-03 13:55:09 +02:00
break ;
if ( d = = 0 ) {
/* Translate "None". */
2020-04-26 21:59:22 +02:00
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) win_get_string ( IDS_2103 ) ) ;
2018-09-03 13:55:09 +02:00
} else {
2018-09-06 14:38:43 +02:00
s = ( char * ) isamem_get_name ( d ) ;
2018-09-03 13:55:09 +02:00
mbstowcs ( lptsTemp , s , strlen ( s ) + 1 ) ;
2018-09-06 14:38:43 +02:00
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
2018-09-03 13:55:09 +02:00
}
}
SendMessage ( h , CB_SETCURSEL , temp_isamem [ c ] , 0 ) ;
h = GetDlgItem ( hdlg , IDC_CONFIGURE_ISAMEM_1 + c ) ;
if ( temp_isamem [ c ] ! = 0 )
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
}
2018-09-06 14:38:43 +02:00
2019-02-06 03:34:39 +01:00
free ( stransi ) ;
2018-07-15 01:41:53 +02:00
free ( lptsTemp ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
return TRUE ;
2018-04-25 23:51:13 +02:00
2018-07-15 01:41:53 +02:00
case WM_COMMAND :
switch ( LOWORD ( wParam ) ) {
2020-06-17 14:29:24 +02:00
case IDC_CONFIGURE_FDC :
h = GetDlgItem ( hdlg , IDC_COMBO_FDC ) ;
temp_fdc_card = settings_list_to_fdc [ 0 ] [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2020-06-16 16:25:23 +02:00
2020-06-17 14:29:24 +02:00
temp_deviceconfig | = deviceconfig_open ( hdlg , ( void * ) fdc_card_getdevice ( temp_fdc_card ) ) ;
2020-06-16 16:25:23 +02:00
break ;
2020-06-17 14:29:24 +02:00
case IDC_COMBO_FDC :
h = GetDlgItem ( hdlg , IDC_COMBO_FDC ) ;
temp_fdc_card = settings_list_to_fdc [ 0 ] [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2020-06-16 16:25:23 +02:00
2020-06-17 14:29:24 +02:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_FDC ) ;
if ( fdc_card_has_config ( temp_fdc_card ) )
2020-06-16 16:25:23 +02:00
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
2020-06-17 14:29:24 +02:00
break ;
2020-06-16 16:25:23 +02:00
2019-02-06 03:34:39 +01:00
case IDC_CONFIGURE_HDC :
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
stransi = ( char * ) malloc ( 512 ) ;
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_HDC ) ;
2019-02-06 03:34:39 +01:00
SendMessage ( h , CB_GETLBTEXT , SendMessage ( h , CB_GETCURSEL , 0 , 0 ) , ( LPARAM ) lptsTemp ) ;
wcstombs ( stransi , lptsTemp , 512 ) ;
temp_deviceconfig | = deviceconfig_open ( hdlg , ( void * ) hdc_get_device ( hdc_get_id ( stransi ) ) ) ;
2018-07-15 01:41:53 +02:00
2019-02-06 03:34:39 +01:00
free ( stransi ) ;
free ( lptsTemp ) ;
2018-07-15 01:41:53 +02:00
break ;
2018-04-25 23:51:13 +02:00
2019-02-06 03:34:39 +01:00
case IDC_COMBO_HDC :
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
stransi = ( char * ) malloc ( 512 ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_HDC ) ;
SendMessage ( h , CB_GETLBTEXT , SendMessage ( h , CB_GETCURSEL , 0 , 0 ) , ( LPARAM ) lptsTemp ) ;
wcstombs ( stransi , lptsTemp , 512 ) ;
temp_hdc = hdc_get_id ( stransi ) ;
h = GetDlgItem ( hdlg , IDC_CONFIGURE_HDC ) ;
if ( hdc_has_config ( temp_hdc ) )
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
2018-04-25 23:51:13 +02:00
2019-02-06 03:34:39 +01:00
free ( stransi ) ;
free ( lptsTemp ) ;
2018-07-15 01:41:53 +02:00
break ;
2018-04-25 23:51:13 +02:00
2018-07-15 01:41:53 +02:00
case IDC_CONFIGURE_SCSI :
h = GetDlgItem ( hdlg , IDC_COMBO_SCSI ) ;
2018-09-03 14:42:09 +02:00
temp_scsi_card = settings_list_to_device [ 0 ] [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
temp_deviceconfig | = deviceconfig_open ( hdlg , ( void * ) scsi_card_getdevice ( temp_scsi_card ) ) ;
break ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case IDC_COMBO_SCSI :
h = GetDlgItem ( hdlg , IDC_COMBO_SCSI ) ;
2018-09-03 14:42:09 +02:00
temp_scsi_card = settings_list_to_device [ 0 ] [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_SCSI ) ;
if ( scsi_card_has_config ( temp_scsi_card ) )
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
break ;
2018-04-25 23:51:13 +02:00
2018-09-03 13:55:09 +02:00
case IDC_CONFIGURE_ISARTC :
h = GetDlgItem ( hdlg , IDC_COMBO_ISARTC ) ;
2018-09-03 14:42:09 +02:00
temp_isartc = settings_list_to_device [ 1 ] [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2018-09-03 13:55:09 +02:00
temp_deviceconfig | = deviceconfig_open ( hdlg , ( void * ) isartc_get_device ( temp_isartc ) ) ;
break ;
2018-09-03 14:42:09 +02:00
2018-09-03 13:55:09 +02:00
case IDC_COMBO_ISARTC :
h = GetDlgItem ( hdlg , IDC_COMBO_ISARTC ) ;
2018-09-03 14:42:09 +02:00
temp_isartc = settings_list_to_device [ 1 ] [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2018-09-03 13:55:09 +02:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_ISARTC ) ;
if ( temp_isartc ! = 0 )
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
break ;
2018-09-03 14:42:09 +02:00
2018-09-03 13:55:09 +02:00
case IDC_COMBO_ISAMEM_1 :
case IDC_COMBO_ISAMEM_2 :
case IDC_COMBO_ISAMEM_3 :
2018-09-06 14:38:43 +02:00
case IDC_COMBO_ISAMEM_4 :
c = LOWORD ( wParam ) - IDC_COMBO_ISAMEM_1 ;
h = GetDlgItem ( hdlg , LOWORD ( wParam ) ) ;
temp_isamem [ c ] = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
2018-09-03 14:42:09 +02:00
2018-09-06 14:38:43 +02:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_ISAMEM_1 + c ) ;
if ( temp_isamem [ c ] ! = 0 )
2018-09-03 13:55:09 +02:00
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
break ;
2018-09-06 14:38:43 +02:00
case IDC_CONFIGURE_ISAMEM_1 :
case IDC_CONFIGURE_ISAMEM_2 :
case IDC_CONFIGURE_ISAMEM_3 :
case IDC_CONFIGURE_ISAMEM_4 :
c = LOWORD ( wParam ) - IDC_CONFIGURE_ISAMEM_1 ;
2018-10-23 21:14:41 +02:00
dev = isamem_get_device ( temp_isamem [ c ] ) ;
temp_deviceconfig | = deviceconfig_inst_open ( hdlg , ( void * ) dev , c + 1 ) ;
2018-09-03 13:55:09 +02:00
break ;
2018-07-15 01:41:53 +02:00
case IDC_CHECK_IDE_TER :
h = GetDlgItem ( hdlg , IDC_CHECK_IDE_TER ) ;
temp_ide_ter = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
2018-04-25 23:51:13 +02:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_BUTTON_IDE_TER ) ;
EnableWindow ( h , temp_ide_ter ? TRUE : FALSE ) ;
break ;
2018-04-25 23:51:13 +02:00
2018-07-15 01:41:53 +02:00
case IDC_BUTTON_IDE_TER :
temp_deviceconfig | = deviceconfig_open ( hdlg , ( void * ) & ide_ter_device ) ;
break ;
2018-04-25 23:51:13 +02:00
2018-07-15 01:41:53 +02:00
case IDC_CHECK_IDE_QUA :
h = GetDlgItem ( hdlg , IDC_CHECK_IDE_QUA ) ;
temp_ide_qua = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
2018-04-25 23:51:13 +02:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_BUTTON_IDE_QUA ) ;
EnableWindow ( h , temp_ide_qua ? TRUE : FALSE ) ;
break ;
2018-04-25 23:51:13 +02:00
2018-07-15 01:41:53 +02:00
case IDC_BUTTON_IDE_QUA :
temp_deviceconfig | = deviceconfig_open ( hdlg , ( void * ) & ide_qua_device ) ;
break ;
}
return FALSE ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case WM_SAVESETTINGS :
2019-02-06 03:34:39 +01:00
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
stransi = ( char * ) malloc ( 512 ) ;
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_HDC ) ;
2019-02-06 03:34:39 +01:00
SendMessage ( h , CB_GETLBTEXT , SendMessage ( h , CB_GETCURSEL , 0 , 0 ) , ( LPARAM ) lptsTemp ) ;
wcstombs ( stransi , lptsTemp , 512 ) ;
temp_hdc = hdc_get_id ( stransi ) ;
2017-05-18 14:03:43 -04:00
2020-06-17 14:29:24 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_FDC ) ;
temp_fdc_card = settings_list_to_fdc [ 0 ] [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_SCSI ) ;
2018-09-03 14:45:55 +02:00
temp_scsi_card = settings_list_to_device [ 0 ] [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
h = GetDlgItem ( hdlg , IDC_COMBO_ISARTC ) ;
temp_isartc = settings_list_to_device [ 1 ] [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_IDE_TER ) ;
temp_ide_ter = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_IDE_QUA ) ;
temp_ide_qua = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECK_BUGGER ) ;
temp_bugger = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
2020-03-23 17:03:28 -03:00
h = GetDlgItem ( hdlg , IDC_CHECK_POSTCARD ) ;
temp_postcard = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
2017-05-18 14:03:43 -04:00
2019-02-06 03:34:39 +01:00
free ( stransi ) ;
free ( lptsTemp ) ;
2018-07-15 01:41:53 +02:00
default :
return FALSE ;
}
return FALSE ;
2017-05-18 14:03:43 -04:00
}
static void network_recalc_combos ( HWND hdlg )
{
2018-07-15 01:41:53 +02:00
HWND h ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
ignore_change = 1 ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_PCAP ) ;
EnableWindow ( h , ( temp_net_type = = NET_TYPE_PCAP ) ? TRUE : FALSE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_NET ) ;
if ( temp_net_type = = NET_TYPE_SLIRP )
EnableWindow ( h , TRUE ) ;
else if ( ( temp_net_type = = NET_TYPE_PCAP ) & &
( network_dev_to_id ( temp_pcap_dev ) > 0 ) )
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CONFIGURE_NET ) ;
if ( network_card_has_config ( temp_net_card ) & &
( temp_net_type = = NET_TYPE_SLIRP ) )
EnableWindow ( h , TRUE ) ;
else if ( network_card_has_config ( temp_net_card ) & &
( temp_net_type = = NET_TYPE_PCAP ) & &
( network_dev_to_id ( temp_pcap_dev ) > 0 ) )
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
ignore_change = 0 ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
2019-03-20 02:42:55 +08:00
# if defined(__amd64__) || defined(__aarch64__)
2017-12-13 22:39:41 +01:00
static LRESULT CALLBACK
# else
static BOOL CALLBACK
# endif
win_settings_network_proc ( HWND hdlg , UINT message , WPARAM wParam , LPARAM lParam )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
HWND h ;
int c , d ;
LPTSTR lptsTemp ;
char * s ;
switch ( message ) {
case WM_INITDIALOG :
2019-02-06 03:34:39 +01:00
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_NET_TYPE ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) L " None " ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) L " PCap " ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) L " SLiRP " ) ;
SendMessage ( h , CB_SETCURSEL , temp_net_type , 0 ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_PCAP ) ;
if ( temp_net_type = = NET_TYPE_PCAP )
EnableWindow ( h , TRUE ) ;
else
EnableWindow ( h , FALSE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_PCAP ) ;
for ( c = 0 ; c < network_ndev ; c + + ) {
mbstowcs ( lptsTemp , network_devs [ c ] . description , strlen ( network_devs [ c ] . description ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
}
SendMessage ( h , CB_SETCURSEL , network_dev_to_id ( temp_pcap_dev ) , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
/*NIC config*/
h = GetDlgItem ( hdlg , IDC_COMBO_NET ) ;
c = d = 0 ;
while ( 1 ) {
s = network_card_getname ( c ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( s [ 0 ] = = ' \0 ' )
break ;
2017-05-18 14:03:43 -04:00
2018-09-03 14:42:09 +02:00
settings_device_to_list [ 0 ] [ c ] = d ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( network_card_available ( c ) & & device_is_valid ( network_card_getdevice ( c ) , machines [ temp_machine ] . flags ) ) {
if ( c = = 0 )
2020-04-26 21:59:22 +02:00
SendMessage ( h , CB_ADDSTRING , 0 , win_get_string ( IDS_2103 ) ) ;
2018-07-15 01:41:53 +02:00
else {
mbstowcs ( lptsTemp , s , strlen ( s ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
2017-05-18 14:03:43 -04:00
}
2018-09-03 14:42:09 +02:00
settings_list_to_device [ 0 ] [ d ] = c ;
2018-07-15 01:41:53 +02:00
d + + ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
c + + ;
}
2017-05-18 14:03:43 -04:00
2018-09-03 14:42:09 +02:00
SendMessage ( h , CB_SETCURSEL , settings_device_to_list [ 0 ] [ temp_net_card ] , 0 ) ;
2018-07-15 01:41:53 +02:00
EnableWindow ( h , d ? TRUE : FALSE ) ;
network_recalc_combos ( hdlg ) ;
free ( lptsTemp ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
return TRUE ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case WM_COMMAND :
switch ( LOWORD ( wParam ) ) {
case IDC_COMBO_NET_TYPE :
if ( ignore_change )
return FALSE ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_NET_TYPE ) ;
temp_net_type = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
network_recalc_combos ( hdlg ) ;
break ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case IDC_COMBO_PCAP :
if ( ignore_change )
return FALSE ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_PCAP ) ;
memset ( temp_pcap_dev , ' \0 ' , sizeof ( temp_pcap_dev ) ) ;
strcpy ( temp_pcap_dev , network_devs [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] . device ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
network_recalc_combos ( hdlg ) ;
break ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case IDC_COMBO_NET :
if ( ignore_change )
return FALSE ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_NET ) ;
2018-09-03 14:42:09 +02:00
temp_net_card = settings_list_to_device [ 0 ] [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
network_recalc_combos ( hdlg ) ;
break ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case IDC_CONFIGURE_NET :
if ( ignore_change )
return FALSE ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_NET ) ;
2018-09-03 14:42:09 +02:00
temp_net_card = settings_list_to_device [ 0 ] [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
temp_deviceconfig | = deviceconfig_open ( hdlg , ( void * ) network_card_getdevice ( temp_net_card ) ) ;
break ;
}
return FALSE ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case WM_SAVESETTINGS :
h = GetDlgItem ( hdlg , IDC_COMBO_NET_TYPE ) ;
temp_net_type = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_PCAP ) ;
memset ( temp_pcap_dev , ' \0 ' , sizeof ( temp_pcap_dev ) ) ;
strcpy ( temp_pcap_dev , network_devs [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] . device ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_NET ) ;
2018-09-03 14:42:09 +02:00
temp_net_card = settings_list_to_device [ 0 ] [ SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ] ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
default :
return FALSE ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
return FALSE ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
static void
normalize_hd_list ( )
{
hard_disk_t ihdd [ HDD_NUM ] ;
int i , j ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
j = 0 ;
memset ( ihdd , 0x00 , HDD_NUM * sizeof ( hard_disk_t ) ) ;
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
for ( i = 0 ; i < HDD_NUM ; i + + ) {
if ( temp_hdd [ i ] . bus ! = HDD_BUS_DISABLED ) {
memcpy ( & ( ihdd [ j ] ) , & ( temp_hdd [ i ] ) , sizeof ( hard_disk_t ) ) ;
j + + ;
}
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
memcpy ( temp_hdd , ihdd , HDD_NUM * sizeof ( hard_disk_t ) ) ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
static int
get_selected_hard_disk ( HWND hdlg )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
int hard_disk = - 1 ;
int i , j = 0 ;
HWND h ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( hd_listview_items = = 0 )
return 0 ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
for ( i = 0 ; i < hd_listview_items ; i + + ) {
h = GetDlgItem ( hdlg , IDC_LIST_HARD_DISKS ) ;
j = ListView_GetItemState ( h , i , LVIS_SELECTED ) ;
if ( j )
hard_disk = i ;
}
return hard_disk ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
static void
add_locations ( HWND hdlg )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
LPTSTR lptsTemp ;
HWND h ;
int i = 0 ;
2017-05-18 14:03:43 -04:00
2019-02-06 03:34:39 +01:00
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
2017-05-29 01:18:32 +02:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_HD_BUS ) ;
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
for ( i = 0 ; i < 6 ; i + + )
2018-07-15 01:41:53 +02:00
SendMessage ( h , CB_ADDSTRING , 0 , win_get_string ( IDS_4352 + i ) ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_HD_CHANNEL ) ;
for ( i = 0 ; i < 2 ; i + + ) {
wsprintf ( lptsTemp , plat_get_string ( IDS_4097 ) , i > > 1 , i & 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_HD_ID ) ;
for ( i = 0 ; i < 16 ; i + + ) {
wsprintf ( lptsTemp , plat_get_string ( IDS_4098 ) , i ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_HD_CHANNEL_IDE ) ;
for ( i = 0 ; i < 8 ; i + + ) {
wsprintf ( lptsTemp , plat_get_string ( IDS_4097 ) , i > > 1 , i & 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
free ( lptsTemp ) ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
static uint8_t
next_free_binary_channel ( uint64_t * tracking )
{
int64_t i ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
for ( i = 0 ; i < 2 ; i + + ) {
if ( ! ( * tracking & ( 0xffLL < < ( i < < 3LL ) ) ) )
return i ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
return 2 ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
static uint8_t
next_free_ide_channel ( void )
2018-01-19 15:39:13 +01:00
{
2018-07-15 01:41:53 +02:00
int64_t i ;
2018-01-19 15:39:13 +01:00
2018-07-15 01:41:53 +02:00
for ( i = 0 ; i < 8 ; i + + ) {
if ( ! ( ide_tracking & ( 0xffLL < < ( i < < 3LL ) ) ) )
return i ;
}
2018-01-19 15:39:13 +01:00
2018-07-15 01:41:53 +02:00
return 7 ;
2018-01-19 15:39:13 +01:00
}
2018-07-15 01:41:53 +02:00
static void
next_free_scsi_id ( uint8_t * id )
2018-01-19 15:39:13 +01:00
{
2018-07-15 01:41:53 +02:00
int64_t i ;
2018-01-19 15:39:13 +01:00
2018-07-15 01:41:53 +02:00
for ( i = 0 ; i < 16 ; i + + ) {
if ( ! ( scsi_tracking [ i > > 3 ] & ( 0xffLL < < ( ( i & 0x07 ) < < 3LL ) ) ) ) {
* id = i ;
return ;
2018-01-19 15:39:13 +01:00
}
2018-07-15 01:41:53 +02:00
}
2018-01-19 15:39:13 +01:00
2018-07-15 01:41:53 +02:00
* id = 6 ;
2018-01-19 15:39:13 +01:00
}
2018-07-15 01:41:53 +02:00
static void
recalc_location_controls ( HWND hdlg , int is_add_dlg , int assign_id )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
int i = 0 ;
HWND h ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
int bus = 0 ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
for ( i = IDT_1722 ; i < = IDT_1723 ; i + + ) {
h = GetDlgItem ( hdlg , i ) ;
2017-05-18 14:03:43 -04:00
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
2018-07-15 01:41:53 +02:00
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_HD_CHANNEL ) ;
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_HD_ID ) ;
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_HD_CHANNEL_IDE ) ;
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( ( hd_listview_items > 0 ) | | is_add_dlg ) {
h = GetDlgItem ( hdlg , IDC_COMBO_HD_BUS ) ;
bus = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
bus + + ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
switch ( bus ) {
case HDD_BUS_MFM : /* MFM */
h = GetDlgItem ( hdlg , IDT_1722 ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_HD_CHANNEL ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
if ( assign_id )
temp_hdd [ lv1_current_sel ] . mfm_channel = next_free_binary_channel ( & mfm_tracking ) ;
SendMessage ( h , CB_SETCURSEL , is_add_dlg ? new_hdd . mfm_channel : temp_hdd [ lv1_current_sel ] . mfm_channel , 0 ) ;
break ;
case HDD_BUS_XTA : /* XTA */
h = GetDlgItem ( hdlg , IDT_1722 ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_HD_CHANNEL ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
if ( assign_id )
temp_hdd [ lv1_current_sel ] . xta_channel = next_free_binary_channel ( & xta_tracking ) ;
SendMessage ( h , CB_SETCURSEL , is_add_dlg ? new_hdd . xta_channel : temp_hdd [ lv1_current_sel ] . xta_channel , 0 ) ;
break ;
case HDD_BUS_ESDI : /* ESDI */
h = GetDlgItem ( hdlg , IDT_1722 ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_HD_CHANNEL ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
if ( assign_id )
temp_hdd [ lv1_current_sel ] . esdi_channel = next_free_binary_channel ( & esdi_tracking ) ;
SendMessage ( h , CB_SETCURSEL , is_add_dlg ? new_hdd . esdi_channel : temp_hdd [ lv1_current_sel ] . esdi_channel , 0 ) ;
break ;
case HDD_BUS_IDE : /* IDE */
h = GetDlgItem ( hdlg , IDT_1722 ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_HD_CHANNEL_IDE ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
if ( assign_id )
temp_hdd [ lv1_current_sel ] . ide_channel = next_free_ide_channel ( ) ;
SendMessage ( h , CB_SETCURSEL , is_add_dlg ? new_hdd . ide_channel : temp_hdd [ lv1_current_sel ] . ide_channel , 0 ) ;
break ;
case HDD_BUS_SCSI : /* SCSI */
h = GetDlgItem ( hdlg , IDT_1723 ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
h = GetDlgItem ( hdlg , IDT_1724 ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( assign_id )
2018-10-24 16:01:20 +02:00
next_free_scsi_id ( ( uint8_t * ) ( is_add_dlg ? & ( new_hdd . scsi_id ) : & ( temp_hdd [ lv1_current_sel ] . scsi_id ) ) ) ;
2018-01-19 15:39:13 +01:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_HD_ID ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
SendMessage ( h , CB_SETCURSEL , is_add_dlg ? new_hdd . scsi_id : temp_hdd [ lv1_current_sel ] . scsi_id , 0 ) ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( ( hd_listview_items = = 0 ) & & ! is_add_dlg ) {
h = GetDlgItem ( hdlg , IDT_1721 ) ;
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_HD_BUS ) ;
EnableWindow ( h , FALSE ) ; ShowWindow ( h , SW_HIDE ) ;
} else {
h = GetDlgItem ( hdlg , IDT_1721 ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_HD_BUS ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
}
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
static int
bus_full ( uint64_t * tracking , int count )
2018-01-27 02:38:52 +01:00
{
2018-07-15 01:41:53 +02:00
int full = 0 ;
switch ( count ) {
case 2 :
default :
full = ( * tracking & 0xFF00LL ) ;
full = full & & ( * tracking & 0x00FFLL ) ;
return full ;
case 8 :
full = ( * tracking & 0xFF00000000000000LL ) ;
full = full & & ( * tracking & 0x00FF000000000000LL ) ;
full = full & & ( * tracking & 0x0000FF0000000000LL ) ;
full = full & & ( * tracking & 0x000000FF00000000LL ) ;
full = full & & ( * tracking & 0x00000000FF000000LL ) ;
full = full & & ( * tracking & 0x0000000000FF0000LL ) ;
full = full & & ( * tracking & 0x000000000000FF00LL ) ;
full = full & & ( * tracking & 0x00000000000000FFLL ) ;
return full ;
}
2018-01-27 02:38:52 +01:00
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
static void
recalc_next_free_id ( HWND hdlg )
{
HWND h ;
int i , enable_add = 0 ;
int c_mfm = 0 , c_esdi = 0 ;
int c_xta = 0 , c_ide = 0 ;
int c_scsi = 0 ;
next_free_id = - 1 ;
for ( i = 0 ; i < HDD_NUM ; i + + ) {
if ( temp_hdd [ i ] . bus = = HDD_BUS_MFM )
c_mfm + + ;
else if ( temp_hdd [ i ] . bus = = HDD_BUS_ESDI )
c_esdi + + ;
else if ( temp_hdd [ i ] . bus = = HDD_BUS_XTA )
c_xta + + ;
else if ( temp_hdd [ i ] . bus = = HDD_BUS_IDE )
c_ide + + ;
else if ( temp_hdd [ i ] . bus = = HDD_BUS_SCSI )
c_scsi + + ;
}
for ( i = 0 ; i < HDD_NUM ; i + + ) {
if ( temp_hdd [ i ] . bus = = HDD_BUS_DISABLED ) {
next_free_id = i ;
break ;
}
}
enable_add = enable_add | | ( next_free_id > = 0 ) ;
enable_add = enable_add & & ( ( c_mfm < MFM_NUM ) | | ( c_esdi < ESDI_NUM ) | | ( c_xta < XTA_NUM ) | |
( c_ide < IDE_NUM ) | | ( c_scsi < SCSI_NUM ) ) ;
enable_add = enable_add & & ! bus_full ( & mfm_tracking , 2 ) ;
enable_add = enable_add & & ! bus_full ( & esdi_tracking , 2 ) ;
enable_add = enable_add & & ! bus_full ( & xta_tracking , 2 ) ;
enable_add = enable_add & & ! bus_full ( & ide_tracking , 8 ) ;
for ( i = 0 ; i < 2 ; i + + )
enable_add = enable_add & & ! bus_full ( & ( scsi_tracking [ i ] ) , 8 ) ;
h = GetDlgItem ( hdlg , IDC_BUTTON_HDD_ADD_NEW ) ;
EnableWindow ( h , enable_add ? TRUE : FALSE ) ;
h = GetDlgItem ( hdlg , IDC_BUTTON_HDD_ADD ) ;
EnableWindow ( h , enable_add ? TRUE : FALSE ) ;
h = GetDlgItem ( hdlg , IDC_BUTTON_HDD_REMOVE ) ;
EnableWindow ( h , ( ( c_mfm = = 0 ) & & ( c_esdi = = 0 ) & & ( c_xta = = 0 ) & & ( c_ide = = 0 ) & & ( c_scsi = = 0 ) ) ?
FALSE : TRUE ) ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
static void
win_settings_hard_disks_update_item ( HWND hwndList , int i , int column )
{
LVITEM lvI ;
WCHAR szText [ 256 ] ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
lvI . mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE ;
lvI . stateMask = lvI . iSubItem = lvI . state = 0 ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
lvI . iSubItem = column ;
lvI . iItem = i ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( column = = 0 ) {
switch ( temp_hdd [ i ] . bus ) {
case HDD_BUS_MFM :
wsprintf ( szText , plat_get_string ( IDS_4608 ) , temp_hdd [ i ] . mfm_channel > > 1 , temp_hdd [ i ] . mfm_channel & 1 ) ;
break ;
case HDD_BUS_XTA :
wsprintf ( szText , plat_get_string ( IDS_4609 ) , temp_hdd [ i ] . xta_channel > > 1 , temp_hdd [ i ] . xta_channel & 1 ) ;
break ;
case HDD_BUS_ESDI :
wsprintf ( szText , plat_get_string ( IDS_4610 ) , temp_hdd [ i ] . esdi_channel > > 1 , temp_hdd [ i ] . esdi_channel & 1 ) ;
break ;
case HDD_BUS_IDE :
wsprintf ( szText , plat_get_string ( IDS_4611 ) , temp_hdd [ i ] . ide_channel > > 1 , temp_hdd [ i ] . ide_channel & 1 ) ;
break ;
case HDD_BUS_SCSI :
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
wsprintf ( szText , plat_get_string ( IDS_4613 ) , temp_hdd [ i ] . scsi_id ) ;
2018-07-15 01:41:53 +02:00
break ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
lvI . pszText = szText ;
lvI . iImage = 0 ;
} else if ( column = = 1 ) {
2020-04-24 14:56:30 +02:00
if ( ! wcsnicmp ( temp_hdd [ i ] . fn , usr_path , wcslen ( usr_path ) ) )
lvI . pszText = temp_hdd [ i ] . fn + wcslen ( usr_path ) ;
else
lvI . pszText = temp_hdd [ i ] . fn ;
2018-07-15 01:41:53 +02:00
lvI . iImage = 0 ;
} else if ( column = = 2 ) {
wsprintf ( szText , plat_get_string ( IDS_4098 ) , temp_hdd [ i ] . tracks ) ;
lvI . pszText = szText ;
lvI . iImage = 0 ;
} else if ( column = = 3 ) {
wsprintf ( szText , plat_get_string ( IDS_4098 ) , temp_hdd [ i ] . hpc ) ;
lvI . pszText = szText ;
lvI . iImage = 0 ;
} else if ( column = = 4 ) {
wsprintf ( szText , plat_get_string ( IDS_4098 ) , temp_hdd [ i ] . spt ) ;
lvI . pszText = szText ;
lvI . iImage = 0 ;
} else if ( column = = 5 ) {
wsprintf ( szText , plat_get_string ( IDS_4098 ) , ( temp_hdd [ i ] . tracks * temp_hdd [ i ] . hpc * temp_hdd [ i ] . spt ) > > 11 ) ;
lvI . pszText = szText ;
lvI . iImage = 0 ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
return ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
static BOOL
win_settings_hard_disks_recalc_list ( HWND hwndList )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
LVITEM lvI ;
int i , j = 0 ;
WCHAR szText [ 256 ] ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
hd_listview_items = 0 ;
lv1_current_sel = - 1 ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
ListView_DeleteAllItems ( hwndList ) ;
lvI . mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE ;
lvI . stateMask = lvI . iSubItem = lvI . state = 0 ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
for ( i = 0 ; i < HDD_NUM ; i + + ) {
if ( temp_hdd [ i ] . bus > 0 ) {
hdc_id_to_listview_index [ i ] = j ;
lvI . iSubItem = 0 ;
switch ( temp_hdd [ i ] . bus ) {
2017-05-27 03:53:32 +02:00
case HDD_BUS_MFM :
2017-10-10 03:07:29 -04:00
wsprintf ( szText , plat_get_string ( IDS_4608 ) , temp_hdd [ i ] . mfm_channel > > 1 , temp_hdd [ i ] . mfm_channel & 1 ) ;
2017-05-27 03:53:32 +02:00
break ;
2018-04-25 23:51:13 +02:00
case HDD_BUS_XTA :
wsprintf ( szText , plat_get_string ( IDS_4609 ) , temp_hdd [ i ] . xta_channel > > 1 , temp_hdd [ i ] . xta_channel & 1 ) ;
2017-07-24 12:04:39 +02:00
break ;
2017-08-25 02:21:26 -04:00
case HDD_BUS_ESDI :
2017-10-10 03:07:29 -04:00
wsprintf ( szText , plat_get_string ( IDS_4610 ) , temp_hdd [ i ] . esdi_channel > > 1 , temp_hdd [ i ] . esdi_channel & 1 ) ;
2017-05-27 03:53:32 +02:00
break ;
2018-04-25 23:51:13 +02:00
case HDD_BUS_IDE :
2017-10-10 03:07:29 -04:00
wsprintf ( szText , plat_get_string ( IDS_4611 ) , temp_hdd [ i ] . ide_channel > > 1 , temp_hdd [ i ] . ide_channel & 1 ) ;
2017-05-18 14:03:43 -04:00
break ;
2017-05-27 03:53:32 +02:00
case HDD_BUS_SCSI :
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
wsprintf ( szText , plat_get_string ( IDS_4613 ) , temp_hdd [ i ] . scsi_id ) ;
2017-05-27 03:53:32 +02:00
break ;
2017-05-18 14:03:43 -04:00
}
lvI . pszText = szText ;
2018-07-15 01:41:53 +02:00
lvI . iItem = j ;
2018-04-25 23:51:13 +02:00
lvI . iImage = 0 ;
2018-07-15 01:41:53 +02:00
if ( ListView_InsertItem ( hwndList , & lvI ) = = - 1 )
return FALSE ;
lvI . iSubItem = 1 ;
2020-04-24 14:56:30 +02:00
if ( ! wcsnicmp ( temp_hdd [ i ] . fn , usr_path , wcslen ( usr_path ) ) )
lvI . pszText = temp_hdd [ i ] . fn + wcslen ( usr_path ) ;
else
lvI . pszText = temp_hdd [ i ] . fn ;
2018-07-15 01:41:53 +02:00
lvI . iItem = j ;
2017-05-18 14:03:43 -04:00
lvI . iImage = 0 ;
2018-07-15 01:41:53 +02:00
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
return FALSE ;
lvI . iSubItem = 2 ;
2017-10-10 03:07:29 -04:00
wsprintf ( szText , plat_get_string ( IDS_4098 ) , temp_hdd [ i ] . tracks ) ;
2017-05-18 14:03:43 -04:00
lvI . pszText = szText ;
2018-07-15 01:41:53 +02:00
lvI . iItem = j ;
2017-05-18 14:03:43 -04:00
lvI . iImage = 0 ;
2018-07-15 01:41:53 +02:00
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
return FALSE ;
lvI . iSubItem = 3 ;
2017-10-10 03:07:29 -04:00
wsprintf ( szText , plat_get_string ( IDS_4098 ) , temp_hdd [ i ] . hpc ) ;
2017-05-18 14:03:43 -04:00
lvI . pszText = szText ;
2018-07-15 01:41:53 +02:00
lvI . iItem = j ;
2017-05-18 14:03:43 -04:00
lvI . iImage = 0 ;
2018-07-15 01:41:53 +02:00
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
return FALSE ;
lvI . iSubItem = 4 ;
2017-10-10 03:07:29 -04:00
wsprintf ( szText , plat_get_string ( IDS_4098 ) , temp_hdd [ i ] . spt ) ;
2017-05-18 14:03:43 -04:00
lvI . pszText = szText ;
2018-07-15 01:41:53 +02:00
lvI . iItem = j ;
2017-05-18 14:03:43 -04:00
lvI . iImage = 0 ;
2018-07-15 01:41:53 +02:00
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
return FALSE ;
lvI . iSubItem = 5 ;
2017-10-10 03:07:29 -04:00
wsprintf ( szText , plat_get_string ( IDS_4098 ) , ( temp_hdd [ i ] . tracks * temp_hdd [ i ] . hpc * temp_hdd [ i ] . spt ) > > 11 ) ;
2017-05-18 14:03:43 -04:00
lvI . pszText = szText ;
2018-07-15 01:41:53 +02:00
lvI . iItem = j ;
2017-05-18 14:03:43 -04:00
lvI . iImage = 0 ;
2018-07-15 01:41:53 +02:00
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
return FALSE ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
j + + ;
} else
hdc_id_to_listview_index [ i ] = - 1 ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
hd_listview_items = j ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
return TRUE ;
}
2017-05-18 14:03:43 -04:00
2020-09-03 12:14:22 +08:00
static void
win_settings_hard_disks_resize_columns ( HWND hwndList )
{
int iCol ;
/* Bus, File, Cylinders, Heads, Sectors, Size */
int width [ C_COLUMNS_HARD_DISKS ] = { 130 , 130 , 41 , 25 , 25 , 41 } ;
for ( iCol = 0 ; iCol < C_COLUMNS_HARD_DISKS ; iCol + + ) {
ListView_SetColumnWidth ( hwndList , iCol , MulDiv ( width [ iCol ] , dpi , 96 ) ) ;
}
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
static BOOL
win_settings_hard_disks_init_columns ( HWND hwndList )
{
LVCOLUMN lvc ;
int iCol ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
lvc . mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
for ( iCol = 0 ; iCol < C_COLUMNS_HARD_DISKS ; iCol + + ) {
lvc . iSubItem = iCol ;
2020-04-26 19:22:13 +02:00
lvc . pszText = plat_get_string ( IDS_2081 + iCol ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
switch ( iCol ) {
case 0 : /* Bus */
2020-09-03 12:14:22 +08:00
lvc . cx = 130 ;
2018-07-15 01:41:53 +02:00
lvc . fmt = LVCFMT_LEFT ;
break ;
case 2 : /* Cylinders */
lvc . cx = 41 ;
lvc . fmt = LVCFMT_RIGHT ;
break ;
case 3 : /* Heads */
case 4 : /* Sectors */
lvc . cx = 25 ;
lvc . fmt = LVCFMT_RIGHT ;
break ;
case 1 : /* File */
2020-09-03 12:14:22 +08:00
lvc . cx = 130 ;
2018-07-15 01:41:53 +02:00
lvc . fmt = LVCFMT_LEFT ;
break ;
case 5 : /* Size (MB) 8 */
lvc . cx = 41 ;
lvc . fmt = LVCFMT_RIGHT ;
break ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
if ( ListView_InsertColumn ( hwndList , iCol , & lvc ) = = - 1 )
return FALSE ;
}
2017-05-18 14:03:43 -04:00
2020-09-03 12:14:22 +08:00
win_settings_hard_disks_resize_columns ( hwndList ) ;
2018-07-15 01:41:53 +02:00
return TRUE ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
static void
get_edit_box_contents ( HWND hdlg , int id , uint32_t * val )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
HWND h ;
WCHAR szText [ 256 ] ;
char stransi [ 256 ] ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , id ) ;
SendMessage ( h , WM_GETTEXT , 255 , ( LPARAM ) szText ) ;
wcstombs ( stransi , szText , 256 ) ;
sscanf ( stransi , " %u " , val ) ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
static void
get_combo_box_selection ( HWND hdlg , int id , uint32_t * val )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
HWND h ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , id ) ;
* val = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
static void
set_edit_box_contents ( HWND hdlg , int id , uint32_t val )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
HWND h ;
WCHAR szText [ 256 ] ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , id ) ;
2020-04-26 19:22:13 +02:00
wsprintf ( szText , plat_get_string ( IDS_2106 ) , val ) ;
2018-07-15 01:41:53 +02:00
SendMessage ( h , WM_SETTEXT , ( WPARAM ) wcslen ( szText ) , ( LPARAM ) szText ) ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
static int hdconf_initialize_hdt_combo ( HWND hdlg )
{
HWND h ;
int i = 0 ;
uint64_t temp_size = 0 ;
uint32_t size_mb = 0 ;
WCHAR szText [ 256 ] ;
selection = 127 ;
h = GetDlgItem ( hdlg , IDC_COMBO_HD_TYPE ) ;
for ( i = 0 ; i < 127 ; i + + ) {
2020-01-14 22:26:22 +01:00
temp_size = ( ( uint64_t ) hdd_table [ i ] [ 0 ] ) * hdd_table [ i ] [ 1 ] * hdd_table [ i ] [ 2 ] ;
2018-07-15 01:41:53 +02:00
size_mb = ( uint32_t ) ( temp_size > > 11LL ) ;
2020-04-26 19:22:13 +02:00
wsprintf ( szText , plat_get_string ( IDS_2107 ) , size_mb , hdd_table [ i ] [ 0 ] , hdd_table [ i ] [ 1 ] , hdd_table [ i ] [ 2 ] ) ;
2018-07-15 01:41:53 +02:00
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) szText ) ;
if ( ( tracks = = ( int ) hdd_table [ i ] [ 0 ] ) & & ( hpc = = ( int ) hdd_table [ i ] [ 1 ] ) & &
( spt = = ( int ) hdd_table [ i ] [ 2 ] ) )
selection = i ;
}
SendMessage ( h , CB_ADDSTRING , 0 , win_get_string ( IDS_4100 ) ) ;
SendMessage ( h , CB_ADDSTRING , 0 , win_get_string ( IDS_4101 ) ) ;
SendMessage ( h , CB_SETCURSEL , selection , 0 ) ;
return selection ;
2017-05-18 14:03:43 -04:00
}
2018-04-25 23:51:13 +02:00
2018-07-15 01:41:53 +02:00
static void
recalc_selection ( HWND hdlg )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
HWND h ;
int i = 0 ;
selection = 127 ;
h = GetDlgItem ( hdlg , IDC_COMBO_HD_TYPE ) ;
for ( i = 0 ; i < 127 ; i + + ) {
if ( ( tracks = = ( int ) hdd_table [ i ] [ 0 ] ) & &
( hpc = = ( int ) hdd_table [ i ] [ 1 ] ) & &
( spt = = ( int ) hdd_table [ i ] [ 2 ] ) )
selection = i ;
}
if ( ( selection = = 127 ) & & ( hpc = = 16 ) & & ( spt = = 63 ) )
selection = 128 ;
SendMessage ( h , CB_SETCURSEL , selection , 0 ) ;
2017-05-18 14:03:43 -04:00
}
2017-05-27 03:53:32 +02:00
2019-03-20 02:42:55 +08:00
# if defined(__amd64__) || defined(__aarch64__)
2017-12-13 22:39:41 +01:00
static LRESULT CALLBACK
# else
static BOOL CALLBACK
# endif
win_settings_hard_disks_add_proc ( HWND hdlg , UINT message , WPARAM wParam , LPARAM lParam )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
HWND h ;
FILE * f ;
uint32_t temp , i = 0 , sector_size = 512 ;
uint32_t zero = 0 , base = 0x1000 ;
uint64_t signature = 0xD778A82044445459ll ;
uint64_t temp_size , r = 0 ;
char buf [ 512 ] , * big_buf ;
int b = 0 ;
uint8_t channel = 0 ;
uint8_t id = 0 ;
wchar_t * twcs ;
vhd_footer_t * vft = NULL ;
2019-11-19 04:52:24 +01:00
MSG msg ;
2018-07-15 01:41:53 +02:00
switch ( message ) {
case WM_INITDIALOG :
memset ( hd_file_name , 0 , sizeof ( hd_file_name ) ) ;
hdd_ptr = & ( temp_hdd [ next_free_id ] ) ;
SetWindowText ( hdlg , plat_get_string ( ( existing & 1 ) ? IDS_4103 : IDS_4102 ) ) ;
no_update = 1 ;
spt = ( existing & 1 ) ? 0 : 17 ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SPT , spt ) ;
hpc = ( existing & 1 ) ? 0 : 15 ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_HPC , hpc ) ;
tracks = ( existing & 1 ) ? 0 : 1023 ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_CYL , tracks ) ;
size = ( tracks * hpc * spt ) < < 9 ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , ( uint32_t ) ( size > > 20LL ) ) ;
hdconf_initialize_hdt_combo ( hdlg ) ;
if ( existing & 1 ) {
h = GetDlgItem ( hdlg , IDC_EDIT_HD_SPT ) ;
2017-05-18 14:03:43 -04:00
EnableWindow ( h , FALSE ) ;
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_EDIT_HD_HPC ) ;
2018-01-24 20:58:39 +01:00
EnableWindow ( h , FALSE ) ;
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_EDIT_HD_CYL ) ;
EnableWindow ( h , FALSE ) ;
h = GetDlgItem ( hdlg , IDC_EDIT_HD_SIZE ) ;
2018-01-24 20:58:39 +01:00
EnableWindow ( h , FALSE ) ;
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_HD_TYPE ) ;
EnableWindow ( h , FALSE ) ;
chs_enabled = 0 ;
} else
chs_enabled = 1 ;
add_locations ( hdlg ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_HD_BUS ) ;
hdd_ptr - > bus = HDD_BUS_IDE ;
max_spt = 63 ;
max_hpc = 255 ;
SendMessage ( h , CB_SETCURSEL , hdd_ptr - > bus , 0 ) ;
max_tracks = 266305 ;
recalc_location_controls ( hdlg , 1 , 0 ) ;
channel = next_free_ide_channel ( ) ;
next_free_scsi_id ( & id ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_HD_CHANNEL ) ;
SendMessage ( h , CB_SETCURSEL , 0 , 0 ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_HD_ID ) ;
SendMessage ( h , CB_SETCURSEL , id , 0 ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_HD_CHANNEL_IDE ) ;
SendMessage ( h , CB_SETCURSEL , channel , 0 ) ;
new_hdd . mfm_channel = next_free_binary_channel ( & mfm_tracking ) ;
new_hdd . esdi_channel = next_free_binary_channel ( & esdi_tracking ) ;
new_hdd . xta_channel = next_free_binary_channel ( & xta_tracking ) ;
new_hdd . ide_channel = channel ;
new_hdd . scsi_id = id ;
h = GetDlgItem ( hdlg , IDC_EDIT_HD_FILE_NAME ) ;
EnableWindow ( h , FALSE ) ;
2018-01-24 20:58:39 +01:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDT_1752 ) ;
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_PBAR_IMG_CREATE ) ;
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
no_update = 0 ;
return TRUE ;
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
case WM_COMMAND :
switch ( LOWORD ( wParam ) ) {
case IDOK :
h = GetDlgItem ( hdlg , IDC_COMBO_HD_BUS ) ;
hdd_ptr - > bus = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) + 1 ;
/* Make sure no file name is allowed with removable SCSI hard disks. */
if ( wcslen ( hd_file_name ) = = 0 ) {
hdd_ptr - > bus = HDD_BUS_DISABLED ;
2020-06-19 00:16:05 -03:00
settings_msgbox_header ( MBX_ERROR , ( wchar_t * ) IDS_2130 , ( wchar_t * ) IDS_4112 ) ;
2018-07-15 01:41:53 +02:00
return TRUE ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
get_edit_box_contents ( hdlg , IDC_EDIT_HD_SPT , & ( hdd_ptr - > spt ) ) ;
get_edit_box_contents ( hdlg , IDC_EDIT_HD_HPC , & ( hdd_ptr - > hpc ) ) ;
get_edit_box_contents ( hdlg , IDC_EDIT_HD_CYL , & ( hdd_ptr - > tracks ) ) ;
spt = hdd_ptr - > spt ;
hpc = hdd_ptr - > hpc ;
tracks = hdd_ptr - > tracks ;
switch ( hdd_ptr - > bus ) {
case HDD_BUS_MFM :
h = GetDlgItem ( hdlg , IDC_COMBO_HD_CHANNEL ) ;
hdd_ptr - > mfm_channel = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
break ;
case HDD_BUS_ESDI :
h = GetDlgItem ( hdlg , IDC_COMBO_HD_CHANNEL ) ;
hdd_ptr - > esdi_channel = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
break ;
case HDD_BUS_XTA :
h = GetDlgItem ( hdlg , IDC_COMBO_HD_CHANNEL ) ;
hdd_ptr - > xta_channel = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
break ;
case HDD_BUS_IDE :
h = GetDlgItem ( hdlg , IDC_COMBO_HD_CHANNEL_IDE ) ;
hdd_ptr - > ide_channel = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
break ;
case HDD_BUS_SCSI :
h = GetDlgItem ( hdlg , IDC_COMBO_HD_ID ) ;
hdd_ptr - > scsi_id = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
break ;
}
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
memset ( hdd_ptr - > fn , 0 , sizeof ( hdd_ptr - > fn ) ) ;
wcscpy ( hdd_ptr - > fn , hd_file_name ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
sector_size = 512 ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( ! ( existing & 1 ) & & ( wcslen ( hd_file_name ) > 0 ) ) {
f = _wfopen ( hd_file_name , L " wb " ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( size > 0x1FFFFFFE00ll ) {
fclose ( f ) ;
2020-06-19 00:16:05 -03:00
settings_msgbox_header ( MBX_ERROR , ( wchar_t * ) IDS_4116 , ( wchar_t * ) IDS_4105 ) ;
2018-07-15 01:41:53 +02:00
return TRUE ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( image_is_hdi ( hd_file_name ) ) {
if ( size > = 0x100000000ll ) {
fclose ( f ) ;
2020-06-19 00:16:05 -03:00
settings_msgbox_header ( MBX_ERROR , ( wchar_t * ) IDS_4116 , ( wchar_t * ) IDS_4104 ) ;
2018-07-15 01:41:53 +02:00
return TRUE ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
fwrite ( & zero , 1 , 4 , f ) ; /* 00000000: Zero/unknown */
fwrite ( & zero , 1 , 4 , f ) ; /* 00000004: Zero/unknown */
fwrite ( & base , 1 , 4 , f ) ; /* 00000008: Offset at which data starts */
fwrite ( & size , 1 , 4 , f ) ; /* 0000000C: Full size of the data (32-bit) */
fwrite ( & sector_size , 1 , 4 , f ) ; /* 00000010: Sector size in bytes */
fwrite ( & spt , 1 , 4 , f ) ; /* 00000014: Sectors per cylinder */
fwrite ( & hpc , 1 , 4 , f ) ; /* 00000018: Heads per cylinder */
fwrite ( & tracks , 1 , 4 , f ) ; /* 0000001C: Cylinders */
for ( i = 0 ; i < 0x3f8 ; i + + )
fwrite ( & zero , 1 , 4 , f ) ;
} else if ( image_is_hdx ( hd_file_name , 0 ) ) {
fwrite ( & signature , 1 , 8 , f ) ; /* 00000000: Signature */
fwrite ( & size , 1 , 8 , f ) ; /* 00000008: Full size of the data (64-bit) */
fwrite ( & sector_size , 1 , 4 , f ) ; /* 00000010: Sector size in bytes */
fwrite ( & spt , 1 , 4 , f ) ; /* 00000014: Sectors per cylinder */
fwrite ( & hpc , 1 , 4 , f ) ; /* 00000018: Heads per cylinder */
fwrite ( & tracks , 1 , 4 , f ) ; /* 0000001C: Cylinders */
fwrite ( & zero , 1 , 4 , f ) ; /* 00000020: [Translation] Sectors per cylinder */
fwrite ( & zero , 1 , 4 , f ) ; /* 00000004: [Translation] Heads per cylinder */
}
2018-03-19 09:48:44 +01:00
2019-11-19 04:52:24 +01:00
big_buf = ( char * ) malloc ( 1048576 ) ;
memset ( big_buf , 0 , 1048576 ) ;
2017-05-29 01:18:32 +02:00
2018-07-15 01:41:53 +02:00
temp_size = size ;
2018-01-24 20:58:39 +01:00
2018-07-15 01:41:53 +02:00
r = size > > 20 ;
size & = 0xfffff ;
2018-01-24 20:58:39 +01:00
2018-07-15 01:41:53 +02:00
if ( size | | r ) {
h = GetDlgItem ( hdlg , IDT_1731 ) ;
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
2018-01-24 20:58:39 +01:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_EDIT_HD_FILE_NAME ) ;
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
2018-01-24 20:58:39 +01:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CFILE ) ;
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
2018-01-24 20:58:39 +01:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_PBAR_IMG_CREATE ) ;
EnableWindow ( h , TRUE ) ;
ShowWindow ( h , SW_SHOW ) ;
SendMessage ( h , PBM_SETRANGE32 , ( WPARAM ) 0 , ( LPARAM ) r ) ;
SendMessage ( h , PBM_SETPOS , ( WPARAM ) 0 , ( LPARAM ) 0 ) ;
2017-05-29 01:18:32 +02:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDT_1752 ) ;
EnableWindow ( h , TRUE ) ;
ShowWindow ( h , SW_SHOW ) ;
}
2017-05-18 14:03:43 -04:00
2019-11-19 04:52:24 +01:00
h = GetDlgItem ( hdlg , IDC_PBAR_IMG_CREATE ) ;
2018-07-15 01:41:53 +02:00
if ( size ) {
2019-11-19 04:52:24 +01:00
fwrite ( big_buf , 1 , size , f ) ;
2018-07-15 01:41:53 +02:00
SendMessage ( h , PBM_SETPOS , ( WPARAM ) 1 , ( LPARAM ) 0 ) ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
if ( r ) {
for ( i = 0 ; i < r ; i + + ) {
fwrite ( big_buf , 1 , 1048576 , f ) ;
2020-02-04 22:11:14 +08:00
SendMessage ( h , PBM_SETPOS , ( WPARAM ) ( i + 1 ) , ( LPARAM ) 0 ) ;
2019-11-19 04:52:24 +01:00
while ( PeekMessage ( & msg , 0 , 0 , 0 , PM_REMOVE | PM_NOYIELD ) ) {
TranslateMessage ( & msg ) ;
DispatchMessage ( & msg ) ;
}
2018-07-15 01:41:53 +02:00
}
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( image_is_vhd ( hd_file_name , 0 ) ) {
/* VHD image. */
/* Generate new footer. */
new_vhd_footer ( & vft ) ;
vft - > orig_size = vft - > curr_size = temp_size ;
vft - > geom . cyl = tracks ;
vft - > geom . heads = hpc ;
vft - > geom . spt = spt ;
generate_vhd_checksum ( vft ) ;
2019-11-19 04:52:24 +01:00
vhd_footer_to_bytes ( ( uint8_t * ) big_buf , vft ) ;
fwrite ( big_buf , 1 , 512 , f ) ;
2018-07-15 01:41:53 +02:00
free ( vft ) ;
vft = NULL ;
}
2017-05-18 14:03:43 -04:00
2019-11-19 04:52:24 +01:00
free ( big_buf ) ;
2018-07-15 01:41:53 +02:00
fclose ( f ) ;
2020-06-19 00:16:05 -03:00
settings_msgbox_header ( MBX_INFO , ( wchar_t * ) IDS_4113 , ( wchar_t * ) IDS_4117 ) ;
2018-07-15 01:41:53 +02:00
}
hard_disk_added = 1 ;
EndDialog ( hdlg , 0 ) ;
return TRUE ;
case IDCANCEL :
hard_disk_added = 0 ;
hdd_ptr - > bus = HDD_BUS_DISABLED ;
EndDialog ( hdlg , 0 ) ;
return TRUE ;
case IDC_CFILE :
if ( ! file_dlg_w ( hdlg , plat_get_string ( IDS_4106 ) , L " " , ! ( existing & 1 ) ) ) {
if ( ! wcschr ( wopenfilestring , L ' . ' ) ) {
if ( wcslen ( wopenfilestring ) & & ( wcslen ( wopenfilestring ) < = 256 ) ) {
twcs = & wopenfilestring [ wcslen ( wopenfilestring ) ] ;
twcs [ 0 ] = L ' . ' ;
twcs [ 1 ] = L ' i ' ;
twcs [ 2 ] = L ' m ' ;
twcs [ 3 ] = L ' g ' ;
2018-03-19 03:01:09 +01:00
}
2018-07-15 01:41:53 +02:00
}
2018-03-19 03:01:09 +01:00
2018-07-15 01:41:53 +02:00
if ( ! ( existing & 1 ) ) {
f = _wfopen ( wopenfilestring , L " rb " ) ;
if ( f ! = NULL ) {
fclose ( f ) ;
2020-06-19 00:21:40 -03:00
if ( settings_msgbox_ex ( MBX_QUESTION_YN , ( wchar_t * ) IDS_4111 , ( wchar_t * ) IDS_4118 , ( wchar_t * ) IDS_4120 , ( wchar_t * ) IDS_4121 , NULL ) ! = 0 ) /* yes */
2018-07-15 01:41:53 +02:00
return FALSE ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
f = _wfopen ( wopenfilestring , ( existing & 1 ) ? L " rb " : L " wb " ) ;
if ( f = = NULL ) {
2017-05-27 03:53:32 +02:00
hdd_add_file_open_error :
2020-01-15 18:48:22 +01:00
fclose ( f ) ;
2020-06-19 00:16:05 -03:00
settings_msgbox_header ( MBX_ERROR , ( existing & 1 ) ? ( wchar_t * ) IDS_4114 : ( wchar_t * ) IDS_4115 , ( existing & 1 ) ? ( wchar_t * ) IDS_4107 : ( wchar_t * ) IDS_4108 ) ;
2018-07-15 01:41:53 +02:00
return TRUE ;
}
if ( existing & 1 ) {
if ( image_is_hdi ( wopenfilestring ) | | image_is_hdx ( wopenfilestring , 1 ) ) {
fseeko64 ( f , 0x10 , SEEK_SET ) ;
fread ( & sector_size , 1 , 4 , f ) ;
if ( sector_size ! = 512 ) {
2020-06-19 00:16:05 -03:00
settings_msgbox_header ( MBX_ERROR , ( wchar_t * ) IDS_4119 , ( wchar_t * ) IDS_4109 ) ;
2017-05-18 14:03:43 -04:00
fclose ( f ) ;
2018-07-15 01:41:53 +02:00
return TRUE ;
}
spt = hpc = tracks = 0 ;
fread ( & spt , 1 , 4 , f ) ;
fread ( & hpc , 1 , 4 , f ) ;
fread ( & tracks , 1 , 4 , f ) ;
} else if ( image_is_vhd ( wopenfilestring , 1 ) ) {
fseeko64 ( f , - 512 , SEEK_END ) ;
fread ( buf , 1 , 512 , f ) ;
new_vhd_footer ( & vft ) ;
vhd_footer_from_bytes ( vft , ( uint8_t * ) buf ) ;
size = vft - > orig_size ;
tracks = vft - > geom . cyl ;
hpc = vft - > geom . heads ;
spt = vft - > geom . spt ;
free ( vft ) ;
vft = NULL ;
} else {
fseeko64 ( f , 0 , SEEK_END ) ;
size = ftello64 ( f ) ;
if ( ( ( size % 17 ) = = 0 ) & & ( size < = 142606336 ) ) {
spt = 17 ;
if ( size < = 26738688 )
hpc = 4 ;
else if ( ( ( size % 3072 ) = = 0 ) & & ( size < = 53477376 ) )
hpc = 6 ;
else {
for ( i = 5 ; i < 16 ; i + + ) {
if ( ( ( size % ( i < < 9 ) ) = = 0 ) & & ( size < = ( ( i * 17 ) < < 19 ) ) )
break ;
if ( i = = 5 )
i + + ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
hpc = i ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
} else {
spt = 63 ;
hpc = 16 ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
tracks = ( ( size > > 9 ) / hpc ) / spt ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
if ( ( spt > max_spt ) | | ( hpc > max_hpc ) | | ( tracks > max_tracks ) )
goto hdd_add_file_open_error ;
no_update = 1 ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SPT , spt ) ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_HPC , hpc ) ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_CYL , tracks ) ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , size > > 20 ) ;
recalc_selection ( hdlg ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_EDIT_HD_SPT ) ;
EnableWindow ( h , TRUE ) ;
h = GetDlgItem ( hdlg , IDC_EDIT_HD_HPC ) ;
EnableWindow ( h , TRUE ) ;
h = GetDlgItem ( hdlg , IDC_EDIT_HD_CYL ) ;
EnableWindow ( h , TRUE ) ;
h = GetDlgItem ( hdlg , IDC_EDIT_HD_SIZE ) ;
EnableWindow ( h , TRUE ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_HD_TYPE ) ;
EnableWindow ( h , TRUE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
chs_enabled = 1 ;
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
no_update = 0 ;
2020-01-15 04:58:28 +01:00
}
fclose ( f ) ;
2018-07-15 01:41:53 +02:00
}
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_EDIT_HD_FILE_NAME ) ;
SendMessage ( h , WM_SETTEXT , 0 , ( LPARAM ) wopenfilestring ) ;
memset ( hd_file_name , 0 , sizeof ( hd_file_name ) ) ;
wcscpy ( hd_file_name , wopenfilestring ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
return TRUE ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case IDC_EDIT_HD_CYL :
if ( no_update )
return FALSE ;
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
no_update = 1 ;
get_edit_box_contents ( hdlg , IDC_EDIT_HD_CYL , & temp ) ;
if ( tracks ! = ( int64_t ) temp ) {
tracks = temp ;
2018-09-12 03:02:02 +02:00
size = ( ( uint64_t ) tracks * ( uint64_t ) hpc * ( uint64_t ) spt ) < < 9LL ;
2018-07-15 01:41:53 +02:00
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , ( uint32_t ) ( size > > 20 ) ) ;
recalc_selection ( hdlg ) ;
}
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
if ( tracks > max_tracks ) {
tracks = max_tracks ;
2018-09-12 03:02:02 +02:00
size = ( ( uint64_t ) tracks * ( uint64_t ) hpc * ( uint64_t ) spt ) < < 9LL ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_CYL , ( uint32_t ) tracks ) ;
2018-07-15 01:41:53 +02:00
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , ( uint32_t ) ( size > > 20 ) ) ;
recalc_selection ( hdlg ) ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
no_update = 0 ;
break ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case IDC_EDIT_HD_HPC :
if ( no_update )
return FALSE ;
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
no_update = 1 ;
get_edit_box_contents ( hdlg , IDC_EDIT_HD_HPC , & temp ) ;
if ( hpc ! = ( int64_t ) temp ) {
hpc = temp ;
2018-09-12 03:02:02 +02:00
size = ( ( uint64_t ) tracks * ( uint64_t ) hpc * ( uint64_t ) spt ) < < 9LL ;
2018-07-15 01:41:53 +02:00
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , ( uint32_t ) ( size > > 20 ) ) ;
recalc_selection ( hdlg ) ;
}
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
if ( hpc > max_hpc ) {
hpc = max_hpc ;
2018-09-12 03:02:02 +02:00
size = ( ( uint64_t ) tracks * ( uint64_t ) hpc * ( uint64_t ) spt ) < < 9LL ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_HPC , ( uint32_t ) hpc ) ;
2018-07-15 01:41:53 +02:00
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , ( uint32_t ) ( size > > 20 ) ) ;
recalc_selection ( hdlg ) ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
no_update = 0 ;
break ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case IDC_EDIT_HD_SPT :
if ( no_update )
return FALSE ;
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
no_update = 1 ;
get_edit_box_contents ( hdlg , IDC_EDIT_HD_SPT , & temp ) ;
if ( spt ! = ( int64_t ) temp ) {
spt = temp ;
2018-09-12 03:02:02 +02:00
size = ( ( uint64_t ) tracks * ( uint64_t ) hpc * ( uint64_t ) spt ) < < 9LL ;
2018-07-15 01:41:53 +02:00
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , ( uint32_t ) ( size > > 20 ) ) ;
recalc_selection ( hdlg ) ;
}
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
if ( spt > max_spt ) {
spt = max_spt ;
2018-09-12 03:02:02 +02:00
size = ( ( uint64_t ) tracks * ( uint64_t ) hpc * ( uint64_t ) spt ) < < 9LL ;
2018-07-15 01:41:53 +02:00
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SPT , spt ) ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , ( uint32_t ) ( size > > 20 ) ) ;
recalc_selection ( hdlg ) ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
no_update = 0 ;
break ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case IDC_EDIT_HD_SIZE :
if ( no_update )
return FALSE ;
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
no_update = 1 ;
get_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , & temp ) ;
if ( temp ! = ( uint32_t ) ( size > > 20 ) ) {
size = ( ( uint64_t ) temp ) < < 20LL ;
/* This is needed to ensure VHD standard compliance. */
hdd_image_calc_chs ( ( uint32_t * ) & tracks , ( uint32_t * ) & hpc , ( uint32_t * ) & spt , temp ) ;
2018-09-12 03:02:02 +02:00
set_edit_box_contents ( hdlg , IDC_EDIT_HD_CYL , ( uint32_t ) tracks ) ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_HPC , ( uint32_t ) hpc ) ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SPT , ( uint32_t ) spt ) ;
2018-07-15 01:41:53 +02:00
recalc_selection ( hdlg ) ;
}
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
if ( tracks > max_tracks ) {
tracks = max_tracks ;
2018-09-12 03:02:02 +02:00
size = ( ( uint64_t ) tracks * ( uint64_t ) hpc * ( uint64_t ) spt ) < < 9LL ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_CYL , ( uint32_t ) tracks ) ;
2018-07-15 01:41:53 +02:00
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , ( uint32_t ) ( size > > 20 ) ) ;
recalc_selection ( hdlg ) ;
}
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
if ( hpc > max_hpc ) {
hpc = max_hpc ;
2018-09-12 03:02:02 +02:00
size = ( ( uint64_t ) tracks * ( uint64_t ) hpc * ( uint64_t ) spt ) < < 9LL ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_HPC , ( uint32_t ) hpc ) ;
2018-07-15 01:41:53 +02:00
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , ( uint32_t ) ( size > > 20 ) ) ;
recalc_selection ( hdlg ) ;
}
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
if ( spt > max_spt ) {
spt = max_spt ;
2018-09-12 03:02:02 +02:00
size = ( ( uint64_t ) tracks * ( uint64_t ) hpc * ( uint64_t ) spt ) < < 9LL ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SPT , ( uint32_t ) spt ) ;
2018-07-15 01:41:53 +02:00
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , ( uint32_t ) ( size > > 20 ) ) ;
recalc_selection ( hdlg ) ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
no_update = 0 ;
break ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case IDC_COMBO_HD_TYPE :
if ( no_update )
return FALSE ;
2017-05-27 04:17:18 +02:00
2018-07-15 01:41:53 +02:00
no_update = 1 ;
get_combo_box_selection ( hdlg , IDC_COMBO_HD_TYPE , & temp ) ;
if ( ( temp ! = selection ) & & ( temp ! = 127 ) & & ( temp ! = 128 ) ) {
selection = temp ;
tracks = hdd_table [ selection ] [ 0 ] ;
hpc = hdd_table [ selection ] [ 1 ] ;
spt = hdd_table [ selection ] [ 2 ] ;
2018-09-12 03:02:02 +02:00
size = ( ( uint64_t ) tracks * ( uint64_t ) hpc * ( uint64_t ) spt ) < < 9LL ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_CYL , ( uint32_t ) tracks ) ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_HPC , ( uint32_t ) hpc ) ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SPT , ( uint32_t ) spt ) ;
2018-07-15 01:41:53 +02:00
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , ( uint32_t ) ( size > > 20 ) ) ;
} else if ( ( temp ! = selection ) & & ( temp = = 127 ) )
selection = temp ;
else if ( ( temp ! = selection ) & & ( temp = = 128 ) ) {
selection = temp ;
hpc = 16 ;
spt = 63 ;
2018-09-12 03:02:02 +02:00
size = ( ( uint64_t ) tracks * ( uint64_t ) hpc * ( uint64_t ) spt ) < < 9LL ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_HPC , ( uint32_t ) hpc ) ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SPT , ( uint32_t ) spt ) ;
2018-07-15 01:41:53 +02:00
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , ( uint32_t ) ( size > > 20 ) ) ;
}
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
if ( spt > max_spt ) {
spt = max_spt ;
2018-09-12 03:02:02 +02:00
size = ( ( uint64_t ) tracks * ( uint64_t ) hpc * ( uint64_t ) spt ) < < 9LL ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SPT , ( uint32_t ) spt ) ;
2018-07-15 01:41:53 +02:00
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , ( uint32_t ) ( size > > 20 ) ) ;
recalc_selection ( hdlg ) ;
}
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
if ( hpc > max_hpc ) {
hpc = max_hpc ;
2018-09-12 03:02:02 +02:00
size = ( ( uint64_t ) tracks * ( uint64_t ) hpc * ( uint64_t ) spt ) < < 9LL ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_HPC , ( uint32_t ) hpc ) ;
2018-07-15 01:41:53 +02:00
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , ( uint32_t ) ( size > > 20 ) ) ;
recalc_selection ( hdlg ) ;
}
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
if ( tracks > max_tracks ) {
tracks = max_tracks ;
2018-09-12 03:02:02 +02:00
size = ( ( uint64_t ) tracks * ( uint64_t ) hpc * ( uint64_t ) spt ) < < 9LL ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_CYL , ( uint32_t ) tracks ) ;
2018-07-15 01:41:53 +02:00
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , ( uint32_t ) ( size > > 20 ) ) ;
recalc_selection ( hdlg ) ;
}
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
no_update = 0 ;
break ;
case IDC_COMBO_HD_BUS :
if ( no_update )
return FALSE ;
no_update = 1 ;
recalc_location_controls ( hdlg , 1 , 0 ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_HD_BUS ) ;
b = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) + 1 ;
if ( b = = hdd_ptr - > bus )
goto hd_add_bus_skip ;
hdd_ptr - > bus = b ;
switch ( hdd_ptr - > bus ) {
case HDD_BUS_DISABLED :
default :
max_spt = max_hpc = max_tracks = 0 ;
break ;
case HDD_BUS_MFM :
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
max_spt = 26 ; /* 17 for MFM, 26 for RLL. */
2018-07-15 01:41:53 +02:00
max_hpc = 15 ;
2020-06-19 12:10:04 +02:00
max_tracks = 2047 ;
2018-07-15 01:41:53 +02:00
break ;
case HDD_BUS_XTA :
max_spt = 63 ;
max_hpc = 16 ;
max_tracks = 1023 ;
break ;
2019-11-19 07:48:49 +01:00
case HDD_BUS_ESDI :
max_spt = 99 ; /* ESDI drives usually had 32 to 43 sectors per track. */
max_hpc = 16 ;
max_tracks = 266305 ;
break ;
2018-07-15 01:41:53 +02:00
case HDD_BUS_IDE :
max_spt = 63 ;
max_hpc = 255 ;
max_tracks = 266305 ;
break ;
case HDD_BUS_SCSI :
max_spt = 99 ;
max_hpc = 255 ;
max_tracks = 266305 ;
break ;
}
if ( ! chs_enabled ) {
h = GetDlgItem ( hdlg , IDC_EDIT_HD_SPT ) ;
EnableWindow ( h , FALSE ) ;
h = GetDlgItem ( hdlg , IDC_EDIT_HD_HPC ) ;
EnableWindow ( h , FALSE ) ;
h = GetDlgItem ( hdlg , IDC_EDIT_HD_CYL ) ;
EnableWindow ( h , FALSE ) ;
h = GetDlgItem ( hdlg , IDC_EDIT_HD_SIZE ) ;
EnableWindow ( h , FALSE ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_HD_TYPE ) ;
EnableWindow ( h , FALSE ) ;
}
if ( spt > max_spt ) {
spt = max_spt ;
2018-09-12 03:02:02 +02:00
size = ( ( uint64_t ) tracks * ( uint64_t ) hpc * ( uint64_t ) spt ) < < 9LL ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SPT , ( uint32_t ) spt ) ;
2018-07-15 01:41:53 +02:00
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , ( uint32_t ) ( size > > 20 ) ) ;
recalc_selection ( hdlg ) ;
}
if ( hpc > max_hpc ) {
hpc = max_hpc ;
2018-09-12 03:02:02 +02:00
size = ( ( uint64_t ) tracks * ( uint64_t ) hpc * ( uint64_t ) spt ) < < 9LL ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_HPC , ( uint32_t ) hpc ) ;
2018-07-15 01:41:53 +02:00
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , ( uint32_t ) ( size > > 20 ) ) ;
recalc_selection ( hdlg ) ;
}
if ( tracks > max_tracks ) {
tracks = max_tracks ;
2018-09-12 03:02:02 +02:00
size = ( ( uint64_t ) tracks * ( uint64_t ) hpc * ( uint64_t ) spt ) < < 9LL ;
set_edit_box_contents ( hdlg , IDC_EDIT_HD_CYL , ( uint32_t ) tracks ) ;
2018-07-15 01:41:53 +02:00
set_edit_box_contents ( hdlg , IDC_EDIT_HD_SIZE , ( uint32_t ) ( size > > 20 ) ) ;
recalc_selection ( hdlg ) ;
}
2017-05-27 03:53:32 +02:00
2017-05-27 04:17:18 +02:00
hd_add_bus_skip :
2018-07-15 01:41:53 +02:00
no_update = 0 ;
break ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
return FALSE ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
return FALSE ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
int
hard_disk_was_added ( void )
2017-05-27 03:53:32 +02:00
{
2018-07-15 01:41:53 +02:00
return hard_disk_added ;
2017-05-27 03:53:32 +02:00
}
2018-07-15 01:41:53 +02:00
void
hard_disk_add_open ( HWND hwnd , int is_existing )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
existing = is_existing ;
hard_disk_added = 0 ;
DialogBox ( hinstance , ( LPCWSTR ) DLG_CFG_HARD_DISKS_ADD , hwnd , win_settings_hard_disks_add_proc ) ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
static void
hard_disk_track ( uint8_t id )
2018-01-19 15:39:13 +01:00
{
2018-07-15 01:41:53 +02:00
switch ( temp_hdd [ id ] . bus ) {
case HDD_BUS_MFM :
mfm_tracking | = ( 1 < < ( temp_hdd [ id ] . mfm_channel < < 3 ) ) ;
break ;
case HDD_BUS_ESDI :
esdi_tracking | = ( 1 < < ( temp_hdd [ id ] . esdi_channel < < 3 ) ) ;
break ;
case HDD_BUS_XTA :
xta_tracking | = ( 1 < < ( temp_hdd [ id ] . xta_channel < < 3 ) ) ;
break ;
case HDD_BUS_IDE :
ide_tracking | = ( 1 < < ( temp_hdd [ id ] . ide_channel < < 3 ) ) ;
break ;
case HDD_BUS_SCSI :
scsi_tracking [ temp_hdd [ id ] . scsi_id > > 3 ] | = ( 1 < < ( ( temp_hdd [ id ] . scsi_id & 0x07 ) < < 3 ) ) ;
break ;
}
2018-01-19 15:39:13 +01:00
}
2018-07-15 01:41:53 +02:00
static void
hard_disk_untrack ( uint8_t id )
2018-01-19 15:39:13 +01:00
{
2018-07-15 01:41:53 +02:00
switch ( temp_hdd [ id ] . bus ) {
case HDD_BUS_MFM :
mfm_tracking & = ~ ( 1 < < ( temp_hdd [ id ] . mfm_channel < < 3 ) ) ;
break ;
case HDD_BUS_ESDI :
esdi_tracking & = ~ ( 1 < < ( temp_hdd [ id ] . esdi_channel < < 3 ) ) ;
break ;
case HDD_BUS_XTA :
xta_tracking & = ~ ( 1 < < ( temp_hdd [ id ] . xta_channel < < 3 ) ) ;
break ;
case HDD_BUS_IDE :
ide_tracking & = ~ ( 1 < < ( temp_hdd [ id ] . ide_channel < < 3 ) ) ;
break ;
case HDD_BUS_SCSI :
scsi_tracking [ temp_hdd [ id ] . scsi_id > > 3 ] & = ~ ( 1 < < ( ( temp_hdd [ id ] . scsi_id & 0x07 ) < < 3 ) ) ;
break ;
}
2018-01-19 15:39:13 +01:00
}
2018-07-15 01:41:53 +02:00
static void
hard_disk_track_all ( void )
2018-01-27 02:38:52 +01:00
{
2018-07-15 01:41:53 +02:00
int i ;
2018-01-27 02:38:52 +01:00
2018-07-15 01:41:53 +02:00
for ( i = 0 ; i < HDD_NUM ; i + + )
hard_disk_track ( i ) ;
2018-01-27 02:38:52 +01:00
}
2019-03-20 02:42:55 +08:00
# if defined(__amd64__) || defined(__aarch64__)
2017-12-13 22:39:41 +01:00
static LRESULT CALLBACK
# else
static BOOL CALLBACK
# endif
win_settings_hard_disks_proc ( HWND hdlg , UINT message , WPARAM wParam , LPARAM lParam )
2017-05-18 14:03:43 -04:00
{
2019-03-20 02:42:55 +08:00
HWND h = NULL ;
2018-07-15 01:41:53 +02:00
int old_sel = 0 , b = 0 , assign = 0 ;
2020-07-19 06:07:58 +02:00
const uint8_t hd_icons [ 2 ] = { 80 , 0 } ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
switch ( message ) {
case WM_INITDIALOG :
ignore_change = 1 ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
normalize_hd_list ( ) ; /* Normalize the hard disks so that non-disabled hard disks start from index 0, and so they are contiguous.
This will cause an emulator reset prompt on the first opening of this category with a messy hard disk list
( which can only happen by manually editing the configuration file ) . */
h = GetDlgItem ( hdlg , IDC_LIST_HARD_DISKS ) ;
win_settings_hard_disks_init_columns ( h ) ;
image_list_init ( h , ( const uint8_t * ) hd_icons ) ;
win_settings_hard_disks_recalc_list ( h ) ;
recalc_next_free_id ( hdlg ) ;
add_locations ( hdlg ) ;
if ( hd_listview_items > 0 ) {
ListView_SetItemState ( h , 0 , LVIS_FOCUSED | LVIS_SELECTED , 0x000F ) ;
lv1_current_sel = 0 ;
h = GetDlgItem ( hdlg , IDC_COMBO_HD_BUS ) ;
SendMessage ( h , CB_SETCURSEL , temp_hdd [ 0 ] . bus - 1 , 0 ) ;
} else
lv1_current_sel = - 1 ;
recalc_location_controls ( hdlg , 0 , 0 ) ;
2018-03-07 20:06:08 +01:00
2018-07-15 01:41:53 +02:00
ignore_change = 0 ;
return TRUE ;
2018-03-07 20:06:08 +01:00
2018-07-15 01:41:53 +02:00
case WM_NOTIFY :
if ( ( hd_listview_items = = 0 ) | | ignore_change )
2018-03-07 20:06:08 +01:00
return FALSE ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( ( ( ( LPNMHDR ) lParam ) - > code = = LVN_ITEMCHANGED ) & & ( ( ( LPNMHDR ) lParam ) - > idFrom = = IDC_LIST_HARD_DISKS ) ) {
old_sel = lv1_current_sel ;
lv1_current_sel = get_selected_hard_disk ( hdlg ) ;
if ( lv1_current_sel = = old_sel )
return FALSE ;
else if ( lv1_current_sel = = - 1 ) {
ignore_change = 1 ;
lv1_current_sel = old_sel ;
ListView_SetItemState ( h , lv1_current_sel , LVIS_FOCUSED | LVIS_SELECTED , 0x000F ) ;
ignore_change = 0 ;
return FALSE ;
}
ignore_change = 1 ;
h = GetDlgItem ( hdlg , IDC_COMBO_HD_BUS ) ;
SendMessage ( h , CB_SETCURSEL , temp_hdd [ lv1_current_sel ] . bus - 1 , 0 ) ;
recalc_location_controls ( hdlg , 0 , 0 ) ;
ignore_change = 0 ;
2018-01-26 22:17:09 +01:00
}
2018-07-15 01:41:53 +02:00
break ;
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
case WM_COMMAND :
if ( ignore_change & & ( LOWORD ( wParam ) ! = IDC_BUTTON_HDD_ADD ) & &
( LOWORD ( wParam ) ! = IDC_BUTTON_HDD_ADD_NEW ) & & ( LOWORD ( wParam ) ! = IDC_BUTTON_HDD_REMOVE ) )
2018-01-26 22:17:09 +01:00
return FALSE ;
2018-07-15 01:41:53 +02:00
switch ( LOWORD ( wParam ) ) {
case IDC_COMBO_HD_BUS :
ignore_change = 1 ;
h = GetDlgItem ( hdlg , IDC_COMBO_HD_BUS ) ;
b = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) + 1 ;
if ( b = = temp_hdd [ lv1_current_sel ] . bus )
goto hd_bus_skip ;
hard_disk_untrack ( lv1_current_sel ) ;
assign = ( temp_hdd [ lv1_current_sel ] . bus = = b ) ? 0 : 1 ;
temp_hdd [ lv1_current_sel ] . bus = b ;
recalc_location_controls ( hdlg , 0 , assign ) ;
hard_disk_track ( lv1_current_sel ) ;
h = GetDlgItem ( hdlg , IDC_LIST_HARD_DISKS ) ;
win_settings_hard_disks_update_item ( h , lv1_current_sel , 0 ) ;
hd_bus_skip :
ignore_change = 0 ;
return FALSE ;
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
case IDC_COMBO_HD_CHANNEL :
ignore_change = 1 ;
h = GetDlgItem ( hdlg , IDC_COMBO_HD_CHANNEL ) ;
hard_disk_untrack ( lv1_current_sel ) ;
if ( temp_hdd [ lv1_current_sel ] . bus = = HDD_BUS_MFM )
temp_hdd [ lv1_current_sel ] . mfm_channel = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
else if ( temp_hdd [ lv1_current_sel ] . bus = = HDD_BUS_ESDI )
temp_hdd [ lv1_current_sel ] . esdi_channel = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
else if ( temp_hdd [ lv1_current_sel ] . bus = = HDD_BUS_XTA )
temp_hdd [ lv1_current_sel ] . xta_channel = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
hard_disk_track ( lv1_current_sel ) ;
h = GetDlgItem ( hdlg , IDC_LIST_HARD_DISKS ) ;
win_settings_hard_disks_update_item ( h , lv1_current_sel , 0 ) ;
ignore_change = 0 ;
return FALSE ;
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
case IDC_COMBO_HD_CHANNEL_IDE :
ignore_change = 1 ;
h = GetDlgItem ( hdlg , IDC_COMBO_HD_CHANNEL_IDE ) ;
hard_disk_untrack ( lv1_current_sel ) ;
temp_hdd [ lv1_current_sel ] . ide_channel = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
hard_disk_track ( lv1_current_sel ) ;
h = GetDlgItem ( hdlg , IDC_LIST_HARD_DISKS ) ;
win_settings_hard_disks_update_item ( h , lv1_current_sel , 0 ) ;
ignore_change = 0 ;
return FALSE ;
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
case IDC_COMBO_HD_ID :
ignore_change = 1 ;
h = GetDlgItem ( hdlg , IDC_COMBO_HD_ID ) ;
hard_disk_untrack ( lv1_current_sel ) ;
temp_hdd [ lv1_current_sel ] . scsi_id = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
hard_disk_track ( lv1_current_sel ) ;
h = GetDlgItem ( hdlg , IDC_LIST_HARD_DISKS ) ;
win_settings_hard_disks_update_item ( h , lv1_current_sel , 0 ) ;
ignore_change = 0 ;
return FALSE ;
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
case IDC_BUTTON_HDD_ADD :
hard_disk_add_open ( hdlg , 1 ) ;
if ( hard_disk_added ) {
ignore_change = 1 ;
h = GetDlgItem ( hdlg , IDC_LIST_HARD_DISKS ) ;
win_settings_hard_disks_recalc_list ( h ) ;
recalc_next_free_id ( hdlg ) ;
hard_disk_track_all ( ) ;
ignore_change = 0 ;
}
return FALSE ;
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
case IDC_BUTTON_HDD_ADD_NEW :
hard_disk_add_open ( hdlg , 0 ) ;
if ( hard_disk_added ) {
ignore_change = 1 ;
h = GetDlgItem ( hdlg , IDC_LIST_HARD_DISKS ) ;
win_settings_hard_disks_recalc_list ( h ) ;
recalc_next_free_id ( hdlg ) ;
hard_disk_track_all ( ) ;
ignore_change = 0 ;
}
return FALSE ;
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
case IDC_BUTTON_HDD_REMOVE :
2018-09-03 14:25:10 +02:00
memcpy ( temp_hdd [ lv1_current_sel ] . fn , L " " , sizeof ( L " " ) ) ;
2018-07-15 01:41:53 +02:00
hard_disk_untrack ( lv1_current_sel ) ;
temp_hdd [ lv1_current_sel ] . bus = HDD_BUS_DISABLED ; /* Only set the bus to zero, the list normalize code below will take care of turning this entire entry to a complete zero. */
normalize_hd_list ( ) ; /* Normalize the hard disks so that non-disabled hard disks start from index 0, and so they are contiguous. */
ignore_change = 1 ;
h = GetDlgItem ( hdlg , IDC_LIST_HARD_DISKS ) ;
win_settings_hard_disks_recalc_list ( h ) ;
recalc_next_free_id ( hdlg ) ;
if ( hd_listview_items > 0 ) {
ListView_SetItemState ( h , 0 , LVIS_FOCUSED | LVIS_SELECTED , 0x000F ) ;
lv1_current_sel = 0 ;
h = GetDlgItem ( hdlg , IDC_COMBO_HD_BUS ) ;
SendMessage ( h , CB_SETCURSEL , temp_hdd [ 0 ] . bus - 1 , 0 ) ;
} else
lv1_current_sel = - 1 ;
recalc_location_controls ( hdlg , 0 , 0 ) ;
ignore_change = 0 ;
return FALSE ;
}
2018-01-26 22:17:09 +01:00
2020-09-03 12:14:22 +08:00
case WM_DPICHANGED_AFTERPARENT :
h = GetDlgItem ( hdlg , IDC_LIST_HARD_DISKS ) ;
win_settings_hard_disks_resize_columns ( h ) ;
image_list_init ( h , ( const uint8_t * ) hd_icons ) ;
break ;
2018-07-15 01:41:53 +02:00
default :
2018-01-26 22:17:09 +01:00
return FALSE ;
2018-07-15 01:41:53 +02:00
}
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
return FALSE ;
2018-01-26 22:17:09 +01:00
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
static int
combo_id_to_string_id ( int combo_id )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
return IDS_5376 + combo_id ;
2017-05-18 14:03:43 -04:00
}
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
static int
combo_id_to_format_string_id ( int combo_id )
{
return IDS_5632 + combo_id ;
2018-01-26 22:17:09 +01:00
}
2018-07-15 01:41:53 +02:00
static BOOL
win_settings_floppy_drives_recalc_list ( HWND hwndList )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
LVITEM lvI ;
int i = 0 ;
2020-01-15 01:03:54 +01:00
char s [ 256 ] , * t ;
2018-07-15 01:41:53 +02:00
WCHAR szText [ 256 ] ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
lvI . mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE ;
lvI . stateMask = lvI . state = 0 ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
for ( i = 0 ; i < 4 ; i + + ) {
2017-05-18 14:03:43 -04:00
lvI . iSubItem = 0 ;
2018-07-15 01:41:53 +02:00
if ( temp_fdd_types [ i ] > 0 ) {
2020-01-14 23:07:10 +01:00
t = fdd_getname ( temp_fdd_types [ i ] ) ;
if ( strlen ( t ) < = 256 )
strcpy ( s , t ) ;
else
strncpy ( s , t , 256 ) ;
2017-05-18 14:03:43 -04:00
mbstowcs ( szText , s , strlen ( s ) + 1 ) ;
lvI . pszText = szText ;
2018-07-15 01:41:53 +02:00
} else
2017-10-10 03:07:29 -04:00
lvI . pszText = plat_get_string ( IDS_5376 ) ;
2018-07-15 01:41:53 +02:00
lvI . iItem = i ;
2017-05-18 14:03:43 -04:00
lvI . iImage = temp_fdd_types [ i ] ;
2018-07-15 01:41:53 +02:00
if ( ListView_InsertItem ( hwndList , & lvI ) = = - 1 )
return FALSE ;
2017-06-04 02:14:27 +02:00
lvI . iSubItem = 1 ;
2017-10-10 03:07:29 -04:00
lvI . pszText = plat_get_string ( temp_fdd_turbo [ i ] ? IDS_2060 : IDS_2061 ) ;
2017-06-04 02:14:27 +02:00
lvI . iItem = i ;
lvI . iImage = 0 ;
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
2018-07-15 01:41:53 +02:00
return FALSE ;
2017-07-27 17:14:52 +02:00
lvI . iSubItem = 2 ;
2017-10-10 03:07:29 -04:00
lvI . pszText = plat_get_string ( temp_fdd_check_bpb [ i ] ? IDS_2060 : IDS_2061 ) ;
2017-07-27 17:14:52 +02:00
lvI . iItem = i ;
lvI . iImage = 0 ;
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
2018-07-15 01:41:53 +02:00
return FALSE ;
}
return TRUE ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
static BOOL
win_settings_cdrom_drives_recalc_list ( HWND hwndList )
{
LVITEM lvI ;
int i = 0 , fsid = 0 ;
WCHAR szText [ 256 ] ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
lvI . mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE ;
2020-07-19 06:07:58 +02:00
lvI . stateMask = lvI . iSubItem = lvI . state = 0 ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
for ( i = 0 ; i < 4 ; i + + ) {
2018-10-17 05:29:48 +02:00
fsid = combo_id_to_format_string_id ( temp_cdrom [ i ] . bus_type ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
lvI . iSubItem = 0 ;
2018-10-17 05:29:48 +02:00
switch ( temp_cdrom [ i ] . bus_type ) {
2017-05-27 03:53:32 +02:00
case CDROM_BUS_DISABLED :
2017-05-18 14:03:43 -04:00
default :
2017-10-10 03:07:29 -04:00
lvI . pszText = plat_get_string ( fsid ) ;
2017-05-27 03:53:32 +02:00
lvI . iImage = 0 ;
2017-05-18 14:03:43 -04:00
break ;
2018-04-25 23:51:13 +02:00
case CDROM_BUS_ATAPI :
2018-10-17 05:29:48 +02:00
wsprintf ( szText , plat_get_string ( fsid ) , temp_cdrom [ i ] . ide_channel > > 1 , temp_cdrom [ i ] . ide_channel & 1 ) ;
2017-05-27 03:53:32 +02:00
lvI . pszText = szText ;
2017-08-22 02:16:15 +02:00
lvI . iImage = 1 ;
2017-05-27 03:53:32 +02:00
break ;
case CDROM_BUS_SCSI :
2018-10-17 05:29:48 +02:00
wsprintf ( szText , plat_get_string ( fsid ) , temp_cdrom [ i ] . scsi_device_id ) ;
2017-05-18 14:03:43 -04:00
lvI . pszText = szText ;
2017-08-22 02:16:15 +02:00
lvI . iImage = 1 ;
2017-05-18 14:03:43 -04:00
break ;
}
2018-07-15 01:41:53 +02:00
lvI . iItem = i ;
if ( ListView_InsertItem ( hwndList , & lvI ) = = - 1 )
return FALSE ;
2018-03-07 20:06:08 +01:00
lvI . iSubItem = 1 ;
2018-10-17 05:29:48 +02:00
if ( temp_cdrom [ i ] . bus_type = = CDROM_BUS_DISABLED )
2020-04-26 19:22:13 +02:00
lvI . pszText = plat_get_string ( IDS_2103 ) ;
2018-03-07 20:06:08 +01:00
else {
2018-10-17 05:29:48 +02:00
wsprintf ( szText , L " %ix " , temp_cdrom [ i ] . speed ) ;
2018-03-07 20:06:08 +01:00
lvI . pszText = szText ;
}
lvI . iItem = i ;
lvI . iImage = 0 ;
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
2018-07-15 01:41:53 +02:00
return FALSE ;
}
return TRUE ;
2017-05-18 14:03:43 -04:00
}
2020-07-15 09:03:30 +08:00
static BOOL
win_settings_mo_drives_recalc_list ( HWND hwndList )
{
LVITEM lvI ;
int i = 0 , fsid = 0 ;
WCHAR szText [ 256 ] ;
char szType [ 30 ] ;
lvI . mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE ;
lvI . stateMask = lvI . iSubItem = lvI . state = 0 ;
for ( i = 0 ; i < MO_NUM ; i + + ) {
fsid = combo_id_to_format_string_id ( temp_mo_drives [ i ] . bus_type ) ;
lvI . iSubItem = 0 ;
switch ( temp_mo_drives [ i ] . bus_type ) {
case MO_BUS_DISABLED :
default :
lvI . pszText = plat_get_string ( fsid ) ;
lvI . iImage = 0 ;
break ;
case MO_BUS_ATAPI :
wsprintf ( szText , plat_get_string ( fsid ) , temp_mo_drives [ i ] . ide_channel > > 1 , temp_mo_drives [ i ] . ide_channel & 1 ) ;
lvI . pszText = szText ;
lvI . iImage = 1 ;
break ;
case MO_BUS_SCSI :
wsprintf ( szText , plat_get_string ( fsid ) , temp_mo_drives [ i ] . scsi_device_id ) ;
lvI . pszText = szText ;
lvI . iImage = 1 ;
break ;
}
lvI . iItem = i ;
if ( ListView_InsertItem ( hwndList , & lvI ) = = - 1 )
return FALSE ;
lvI . iSubItem = 1 ;
if ( temp_mo_drives [ i ] . bus_type = = MO_BUS_DISABLED )
lvI . pszText = plat_get_string ( IDS_2103 ) ;
else {
memset ( szType , 0 , 30 ) ;
memcpy ( szType , mo_drive_types [ temp_mo_drives [ i ] . type ] . vendor , 8 ) ;
szType [ strlen ( szType ) ] = ' ' ;
memcpy ( szType + strlen ( szType ) , mo_drive_types [ temp_mo_drives [ i ] . type ] . model , 16 ) ;
szType [ strlen ( szType ) ] = ' ' ;
memcpy ( szType + strlen ( szType ) , mo_drive_types [ temp_mo_drives [ i ] . type ] . revision , 4 ) ;
mbstowcs ( szText , szType , strlen ( szType ) + 1 ) ;
lvI . pszText = szText ;
}
lvI . iItem = i ;
lvI . iImage = 0 ;
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
return FALSE ;
}
return TRUE ;
}
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
static BOOL
win_settings_zip_drives_recalc_list ( HWND hwndList )
{
LVITEM lvI ;
int i = 0 , fsid = 0 ;
WCHAR szText [ 256 ] ;
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
lvI . mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE ;
lvI . stateMask = lvI . iSubItem = lvI . state = 0 ;
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
for ( i = 0 ; i < 4 ; i + + ) {
2018-01-26 22:17:09 +01:00
fsid = combo_id_to_format_string_id ( temp_zip_drives [ i ] . bus_type ) ;
2018-07-15 01:41:53 +02:00
lvI . iSubItem = 0 ;
switch ( temp_zip_drives [ i ] . bus_type ) {
2018-01-26 22:17:09 +01:00
case ZIP_BUS_DISABLED :
default :
lvI . pszText = plat_get_string ( fsid ) ;
lvI . iImage = 0 ;
break ;
2018-04-25 23:51:13 +02:00
case ZIP_BUS_ATAPI :
2018-01-26 22:17:09 +01:00
wsprintf ( szText , plat_get_string ( fsid ) , temp_zip_drives [ i ] . ide_channel > > 1 , temp_zip_drives [ i ] . ide_channel & 1 ) ;
lvI . pszText = szText ;
lvI . iImage = 1 ;
break ;
case ZIP_BUS_SCSI :
2018-07-15 01:41:53 +02:00
wsprintf ( szText , plat_get_string ( fsid ) , temp_zip_drives [ i ] . scsi_device_id ) ;
2018-01-26 22:17:09 +01:00
lvI . pszText = szText ;
lvI . iImage = 1 ;
break ;
}
2018-07-15 01:41:53 +02:00
lvI . iItem = i ;
if ( ListView_InsertItem ( hwndList , & lvI ) = = - 1 )
return FALSE ;
2018-01-26 22:17:09 +01:00
lvI . iSubItem = 1 ;
lvI . pszText = plat_get_string ( temp_zip_drives [ i ] . is_250 ? IDS_5901 : IDS_5900 ) ;
lvI . iItem = i ;
lvI . iImage = 0 ;
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
2018-07-15 01:41:53 +02:00
return FALSE ;
}
return TRUE ;
2018-01-26 22:17:09 +01:00
}
2018-07-15 01:41:53 +02:00
2020-09-03 12:14:22 +08:00
static void
win_settings_floppy_drives_resize_columns ( HWND hwndList )
{
ListView_SetColumnWidth ( hwndList , 0 , MulDiv ( 250 , dpi , 96 ) ) ;
ListView_SetColumnWidth ( hwndList , 1 , MulDiv ( 50 , dpi , 96 ) ) ;
ListView_SetColumnWidth ( hwndList , 2 , MulDiv ( 75 , dpi , 96 ) ) ;
}
2018-07-15 01:41:53 +02:00
static BOOL
win_settings_floppy_drives_init_columns ( HWND hwndList )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
LVCOLUMN lvc ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
lvc . mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM ;
2018-03-07 20:06:08 +01:00
2018-07-15 01:41:53 +02:00
lvc . iSubItem = 0 ;
2020-04-26 19:22:13 +02:00
lvc . pszText = plat_get_string ( IDS_2092 ) ;
2017-05-18 14:03:43 -04:00
2020-09-03 12:14:22 +08:00
lvc . cx = 250 ;
2018-07-15 01:41:53 +02:00
lvc . fmt = LVCFMT_LEFT ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( ListView_InsertColumn ( hwndList , 0 , & lvc ) = = - 1 )
return FALSE ;
lvc . iSubItem = 1 ;
lvc . pszText = plat_get_string ( IDS_2059 ) ;
lvc . cx = 50 ;
lvc . fmt = LVCFMT_LEFT ;
if ( ListView_InsertColumn ( hwndList , 1 , & lvc ) = = - 1 )
return FALSE ;
lvc . iSubItem = 2 ;
2020-04-26 19:22:13 +02:00
lvc . pszText = plat_get_string ( IDS_2087 ) ;
2018-07-15 01:41:53 +02:00
lvc . cx = 75 ;
lvc . fmt = LVCFMT_LEFT ;
if ( ListView_InsertColumn ( hwndList , 2 , & lvc ) = = - 1 )
2020-09-03 12:14:22 +08:00
return FALSE ;
2017-05-18 14:03:43 -04:00
2020-09-03 12:14:22 +08:00
win_settings_floppy_drives_resize_columns ( hwndList ) ;
2018-07-15 01:41:53 +02:00
return TRUE ;
2017-05-18 14:03:43 -04:00
}
2018-03-07 20:06:08 +01:00
2018-07-15 01:41:53 +02:00
2020-09-03 12:14:22 +08:00
static void
win_settings_cdrom_drives_resize_columns ( HWND hwndList )
{
ListView_SetColumnWidth ( hwndList , 0 , MulDiv ( 342 , dpi , 96 ) ) ;
ListView_SetColumnWidth ( hwndList , 1 , MulDiv ( 50 , dpi , 96 ) ) ;
}
2018-07-15 01:41:53 +02:00
static BOOL
win_settings_cdrom_drives_init_columns ( HWND hwndList )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
LVCOLUMN lvc ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
lvc . mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
lvc . iSubItem = 0 ;
2020-04-26 19:22:13 +02:00
lvc . pszText = plat_get_string ( IDS_2081 ) ;
2018-07-15 01:41:53 +02:00
lvc . cx = 342 ;
lvc . fmt = LVCFMT_LEFT ;
if ( ListView_InsertColumn ( hwndList , 0 , & lvc ) = = - 1 )
return FALSE ;
lvc . iSubItem = 1 ;
lvc . pszText = plat_get_string ( IDS_2053 ) ;
lvc . cx = 50 ;
lvc . fmt = LVCFMT_LEFT ;
if ( ListView_InsertColumn ( hwndList , 1 , & lvc ) = = - 1 )
2020-09-03 12:14:22 +08:00
return FALSE ;
2018-07-15 01:41:53 +02:00
2020-09-03 12:14:22 +08:00
win_settings_cdrom_drives_resize_columns ( hwndList ) ;
2018-07-15 01:41:53 +02:00
return TRUE ;
}
2020-09-03 12:14:22 +08:00
static void
win_settings_mo_drives_resize_columns ( HWND hwndList )
{
ListView_SetColumnWidth ( hwndList , 0 , MulDiv ( 120 , dpi , 96 ) ) ;
ListView_SetColumnWidth ( hwndList , 1 , MulDiv ( 260 , dpi , 96 ) ) ;
}
2018-07-15 01:41:53 +02:00
2020-07-15 09:03:30 +08:00
static BOOL
win_settings_mo_drives_init_columns ( HWND hwndList )
{
LVCOLUMN lvc ;
lvc . mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM ;
lvc . iSubItem = 0 ;
lvc . pszText = plat_get_string ( IDS_2081 ) ;
lvc . cx = 120 ;
lvc . fmt = LVCFMT_LEFT ;
if ( ListView_InsertColumn ( hwndList , 0 , & lvc ) = = - 1 )
return FALSE ;
lvc . iSubItem = 1 ;
lvc . pszText = plat_get_string ( IDS_2092 ) ;
lvc . cx = 260 ;
lvc . fmt = LVCFMT_LEFT ;
if ( ListView_InsertColumn ( hwndList , 1 , & lvc ) = = - 1 )
2020-09-03 12:14:22 +08:00
return FALSE ;
2020-07-15 09:03:30 +08:00
2020-09-03 12:14:22 +08:00
win_settings_mo_drives_resize_columns ( hwndList ) ;
2020-07-15 09:03:30 +08:00
return TRUE ;
}
2020-09-03 12:14:22 +08:00
static void
win_settings_zip_drives_resize_columns ( HWND hwndList )
{
ListView_SetColumnWidth ( hwndList , 0 , MulDiv ( 342 , dpi , 96 ) ) ;
ListView_SetColumnWidth ( hwndList , 1 , MulDiv ( 50 , dpi , 96 ) ) ;
}
2020-07-19 06:07:58 +02:00
2018-07-15 01:41:53 +02:00
static BOOL
win_settings_zip_drives_init_columns ( HWND hwndList )
{
LVCOLUMN lvc ;
lvc . mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM ;
lvc . iSubItem = 0 ;
2020-04-26 19:22:13 +02:00
lvc . pszText = plat_get_string ( IDS_2081 ) ;
2018-07-15 01:41:53 +02:00
lvc . cx = 342 ;
lvc . fmt = LVCFMT_LEFT ;
if ( ListView_InsertColumn ( hwndList , 0 , & lvc ) = = - 1 )
return FALSE ;
lvc . iSubItem = 1 ;
2020-04-26 19:22:13 +02:00
lvc . pszText = plat_get_string ( IDS_2092 ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
lvc . cx = 50 ;
lvc . fmt = LVCFMT_LEFT ;
if ( ListView_InsertColumn ( hwndList , 1 , & lvc ) = = - 1 )
2020-09-03 12:14:22 +08:00
return FALSE ;
2018-07-15 01:41:53 +02:00
2020-09-03 12:14:22 +08:00
win_settings_zip_drives_resize_columns ( hwndList ) ;
2018-07-15 01:41:53 +02:00
return TRUE ;
}
static int
get_selected_drive ( HWND hdlg , int id )
{
int drive = - 1 ;
int i , j = 0 ;
HWND h ;
for ( i = 0 ; i < 4 ; i + + ) {
h = GetDlgItem ( hdlg , id ) ;
j = ListView_GetItemState ( h , i , LVIS_SELECTED ) ;
if ( j )
drive = i ;
}
return drive ;
}
static void
win_settings_floppy_drives_update_item ( HWND hwndList , int i )
{
LVITEM lvI ;
2020-01-15 01:07:06 +01:00
char s [ 256 ] , * t ;
2018-07-15 01:41:53 +02:00
WCHAR szText [ 256 ] ;
lvI . mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE ;
lvI . stateMask = lvI . iSubItem = lvI . state = 0 ;
lvI . iSubItem = 0 ;
lvI . iItem = i ;
if ( temp_fdd_types [ i ] > 0 ) {
2020-01-15 01:07:06 +01:00
t = fdd_getname ( temp_fdd_types [ i ] ) ;
if ( strlen ( t ) < = 256 )
strcpy ( s , t ) ;
else
strncpy ( s , t , 256 ) ;
2018-07-15 01:41:53 +02:00
mbstowcs ( szText , s , strlen ( s ) + 1 ) ;
lvI . pszText = szText ;
} else
lvI . pszText = plat_get_string ( IDS_5376 ) ;
lvI . iImage = temp_fdd_types [ i ] ;
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
return ;
lvI . iSubItem = 1 ;
lvI . pszText = plat_get_string ( temp_fdd_turbo [ i ] ? IDS_2060 : IDS_2061 ) ;
lvI . iItem = i ;
lvI . iImage = 0 ;
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
return ;
lvI . iSubItem = 2 ;
lvI . pszText = plat_get_string ( temp_fdd_check_bpb [ i ] ? IDS_2060 : IDS_2061 ) ;
lvI . iItem = i ;
lvI . iImage = 0 ;
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
return ;
}
static void
win_settings_cdrom_drives_update_item ( HWND hwndList , int i )
{
LVITEM lvI ;
WCHAR szText [ 256 ] ;
int fsid ;
lvI . mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE ;
lvI . stateMask = lvI . iSubItem = lvI . state = 0 ;
lvI . iSubItem = 0 ;
lvI . iItem = i ;
2018-10-17 05:29:48 +02:00
fsid = combo_id_to_format_string_id ( temp_cdrom [ i ] . bus_type ) ;
2018-07-15 01:41:53 +02:00
2018-10-17 05:29:48 +02:00
switch ( temp_cdrom [ i ] . bus_type ) {
2018-07-15 01:41:53 +02:00
case CDROM_BUS_DISABLED :
default :
lvI . pszText = plat_get_string ( fsid ) ;
lvI . iImage = 0 ;
break ;
case CDROM_BUS_ATAPI :
2018-10-17 05:29:48 +02:00
wsprintf ( szText , plat_get_string ( fsid ) , temp_cdrom [ i ] . ide_channel > > 1 , temp_cdrom [ i ] . ide_channel & 1 ) ;
2018-07-15 01:41:53 +02:00
lvI . pszText = szText ;
lvI . iImage = 1 ;
break ;
case CDROM_BUS_SCSI :
2018-10-17 05:29:48 +02:00
wsprintf ( szText , plat_get_string ( fsid ) , temp_cdrom [ i ] . scsi_device_id ) ;
2018-07-15 01:41:53 +02:00
lvI . pszText = szText ;
lvI . iImage = 1 ;
break ;
}
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
return ;
lvI . iSubItem = 1 ;
2018-10-17 05:29:48 +02:00
if ( temp_cdrom [ i ] . bus_type = = CDROM_BUS_DISABLED )
2020-04-26 19:22:13 +02:00
lvI . pszText = plat_get_string ( IDS_2103 ) ;
2018-07-15 01:41:53 +02:00
else {
2018-10-17 05:29:48 +02:00
wsprintf ( szText , L " %ix " , temp_cdrom [ i ] . speed ) ;
2018-07-15 01:41:53 +02:00
lvI . pszText = szText ;
}
lvI . iItem = i ;
lvI . iImage = 0 ;
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
return ;
}
2020-07-19 06:07:58 +02:00
2020-07-15 09:03:30 +08:00
static void
win_settings_mo_drives_update_item ( HWND hwndList , int i )
{
LVITEM lvI ;
WCHAR szText [ 256 ] ;
char szType [ 30 ] ;
int fsid ;
lvI . mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE ;
lvI . stateMask = lvI . iSubItem = lvI . state = 0 ;
lvI . iSubItem = 0 ;
lvI . iItem = i ;
fsid = combo_id_to_format_string_id ( temp_mo_drives [ i ] . bus_type ) ;
switch ( temp_mo_drives [ i ] . bus_type ) {
case MO_BUS_DISABLED :
default :
lvI . pszText = plat_get_string ( fsid ) ;
lvI . iImage = 0 ;
break ;
case MO_BUS_ATAPI :
wsprintf ( szText , plat_get_string ( fsid ) , temp_mo_drives [ i ] . ide_channel > > 1 , temp_mo_drives [ i ] . ide_channel & 1 ) ;
lvI . pszText = szText ;
lvI . iImage = 1 ;
break ;
case MO_BUS_SCSI :
wsprintf ( szText , plat_get_string ( fsid ) , temp_mo_drives [ i ] . scsi_device_id ) ;
lvI . pszText = szText ;
lvI . iImage = 1 ;
break ;
}
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
return ;
lvI . iSubItem = 1 ;
if ( temp_mo_drives [ i ] . bus_type = = MO_BUS_DISABLED )
lvI . pszText = plat_get_string ( IDS_2103 ) ;
else {
memset ( szType , 0 , 30 ) ;
memcpy ( szType , mo_drive_types [ temp_mo_drives [ i ] . type ] . vendor , 8 ) ;
szType [ strlen ( szType ) ] = ' ' ;
memcpy ( szType + strlen ( szType ) , mo_drive_types [ temp_mo_drives [ i ] . type ] . model , 16 ) ;
szType [ strlen ( szType ) ] = ' ' ;
memcpy ( szType + strlen ( szType ) , mo_drive_types [ temp_mo_drives [ i ] . type ] . revision , 4 ) ;
mbstowcs ( szText , szType , strlen ( szType ) + 1 ) ;
lvI . pszText = szText ;
}
lvI . iItem = i ;
lvI . iImage = 0 ;
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
return ;
}
2018-07-15 01:41:53 +02:00
static void
win_settings_zip_drives_update_item ( HWND hwndList , int i )
{
LVITEM lvI ;
WCHAR szText [ 256 ] ;
int fsid ;
lvI . mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE ;
lvI . stateMask = lvI . iSubItem = lvI . state = 0 ;
lvI . iSubItem = 0 ;
lvI . iItem = i ;
fsid = combo_id_to_format_string_id ( temp_zip_drives [ i ] . bus_type ) ;
switch ( temp_zip_drives [ i ] . bus_type ) {
case ZIP_BUS_DISABLED :
default :
lvI . pszText = plat_get_string ( fsid ) ;
lvI . iImage = 0 ;
break ;
case ZIP_BUS_ATAPI :
wsprintf ( szText , plat_get_string ( fsid ) , temp_zip_drives [ i ] . ide_channel > > 1 , temp_zip_drives [ i ] . ide_channel & 1 ) ;
lvI . pszText = szText ;
lvI . iImage = 1 ;
break ;
case ZIP_BUS_SCSI :
wsprintf ( szText , plat_get_string ( fsid ) , temp_zip_drives [ i ] . scsi_device_id ) ;
lvI . pszText = szText ;
lvI . iImage = 1 ;
break ;
}
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
return ;
lvI . iSubItem = 1 ;
lvI . pszText = plat_get_string ( temp_zip_drives [ i ] . is_250 ? IDS_5901 : IDS_5900 ) ;
lvI . iItem = i ;
lvI . iImage = 0 ;
if ( ListView_SetItem ( hwndList , & lvI ) = = - 1 )
return ;
}
static void
cdrom_add_locations ( HWND hdlg )
{
LPTSTR lptsTemp ;
HWND h ;
int i = 0 ;
2019-02-06 03:34:39 +01:00
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_CD_BUS ) ;
2019-09-26 10:02:43 +02:00
for ( i = CDROM_BUS_DISABLED ; i < = CDROM_BUS_SCSI ; i + + ) {
2018-07-15 01:41:53 +02:00
if ( ( i = = CDROM_BUS_DISABLED ) | | ( i > = CDROM_BUS_ATAPI ) )
SendMessage ( h , CB_ADDSTRING , 0 , win_get_string ( combo_id_to_string_id ( i ) ) ) ;
}
h = GetDlgItem ( hdlg , IDC_COMBO_CD_SPEED ) ;
for ( i = 1 ; i < = 72 ; i + + ) {
wsprintf ( lptsTemp , L " %ix " , i ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
}
h = GetDlgItem ( hdlg , IDC_COMBO_CD_ID ) ;
for ( i = 0 ; i < 16 ; i + + ) {
wsprintf ( lptsTemp , plat_get_string ( IDS_4098 ) , i ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
}
h = GetDlgItem ( hdlg , IDC_COMBO_CD_CHANNEL_IDE ) ;
for ( i = 0 ; i < 8 ; i + + ) {
wsprintf ( lptsTemp , plat_get_string ( IDS_4097 ) , i > > 1 , i & 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
}
free ( lptsTemp ) ;
}
static void cdrom_recalc_location_controls ( HWND hdlg , int assign_id )
{
int i = 0 ;
HWND h ;
2020-07-19 06:07:58 +02:00
int bus = temp_cdrom [ lv2_current_sel ] . bus_type ;
2018-07-15 01:41:53 +02:00
for ( i = IDT_1741 ; i < ( IDT_1742 + 1 ) ; i + + ) {
h = GetDlgItem ( hdlg , i ) ;
2017-05-18 14:03:43 -04:00
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
2018-07-15 01:41:53 +02:00
}
h = GetDlgItem ( hdlg , IDC_COMBO_CD_ID ) ;
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_CD_CHANNEL_IDE ) ;
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_CD_SPEED ) ;
if ( bus = = CDROM_BUS_DISABLED ) {
2017-05-18 14:03:43 -04:00
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
2018-07-15 01:41:53 +02:00
} else {
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
2020-07-19 06:07:58 +02:00
SendMessage ( h , CB_SETCURSEL , temp_cdrom [ lv2_current_sel ] . speed - 1 , 0 ) ;
2018-07-15 01:41:53 +02:00
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDT_1758 ) ;
if ( bus = = CDROM_BUS_DISABLED ) {
2017-05-18 14:03:43 -04:00
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
2018-07-15 01:41:53 +02:00
} else {
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
switch ( bus ) {
case CDROM_BUS_ATAPI : /* ATAPI */
h = GetDlgItem ( hdlg , IDT_1742 ) ;
2018-03-07 20:06:08 +01:00
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
if ( assign_id )
2020-07-19 06:07:58 +02:00
temp_cdrom [ lv2_current_sel ] . ide_channel = next_free_ide_channel ( ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_CD_CHANNEL_IDE ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
2020-07-19 06:07:58 +02:00
SendMessage ( h , CB_SETCURSEL , temp_cdrom [ lv2_current_sel ] . ide_channel , 0 ) ;
2018-07-15 01:41:53 +02:00
break ;
case CDROM_BUS_SCSI : /* SCSI */
h = GetDlgItem ( hdlg , IDT_1741 ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
2018-01-19 15:39:13 +01:00
2018-07-15 01:41:53 +02:00
if ( assign_id )
2020-07-19 06:07:58 +02:00
next_free_scsi_id ( ( uint8_t * ) & temp_cdrom [ lv2_current_sel ] . scsi_device_id ) ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_CD_ID ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
2020-07-19 06:07:58 +02:00
SendMessage ( h , CB_SETCURSEL , temp_cdrom [ lv2_current_sel ] . scsi_device_id , 0 ) ;
2018-07-15 01:41:53 +02:00
break ;
}
2017-05-18 14:03:43 -04:00
}
2020-07-15 09:03:30 +08:00
static void
mo_add_locations ( HWND hdlg )
{
2020-07-19 06:07:58 +02:00
LPTSTR lptsTemp ;
char * temp ;
2020-07-15 09:03:30 +08:00
HWND h ;
int i = 0 ;
2020-07-19 06:07:58 +02:00
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
temp = ( char * ) malloc ( 30 * sizeof ( char ) ) ;
2020-07-15 09:03:30 +08:00
2020-07-19 06:07:58 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_MO_BUS ) ;
2020-07-15 09:03:30 +08:00
for ( i = MO_BUS_DISABLED ; i < = MO_BUS_SCSI ; i + + ) {
if ( ( i = = MO_BUS_DISABLED ) | | ( i > = MO_BUS_ATAPI ) )
SendMessage ( h , CB_ADDSTRING , 0 , win_get_string ( combo_id_to_string_id ( i ) ) ) ;
}
h = GetDlgItem ( hdlg , IDC_COMBO_MO_ID ) ;
for ( i = 0 ; i < 16 ; i + + ) {
wsprintf ( lptsTemp , plat_get_string ( IDS_4098 ) , i ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
}
h = GetDlgItem ( hdlg , IDC_COMBO_MO_CHANNEL_IDE ) ;
for ( i = 0 ; i < 8 ; i + + ) {
wsprintf ( lptsTemp , plat_get_string ( IDS_4097 ) , i > > 1 , i & 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
}
2020-07-19 06:07:58 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_MO_TYPE ) ;
for ( int i = 0 ; i < KNOWN_MO_DRIVE_TYPES ; i + + ) {
memset ( temp , 0 , 30 ) ;
memcpy ( temp , mo_drive_types [ i ] . vendor , 8 ) ;
temp [ strlen ( temp ) ] = ' ' ;
memcpy ( temp + strlen ( temp ) , mo_drive_types [ i ] . model , 16 ) ;
temp [ strlen ( temp ) ] = ' ' ;
memcpy ( temp + strlen ( temp ) , mo_drive_types [ i ] . revision , 4 ) ;
mbstowcs ( lptsTemp , temp , strlen ( temp ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
}
2020-07-15 09:03:30 +08:00
2020-07-19 06:07:58 +02:00
free ( temp ) ;
free ( lptsTemp ) ;
2020-07-15 09:03:30 +08:00
}
static void
mo_recalc_location_controls ( HWND hdlg , int assign_id )
{
int i = 0 ;
HWND h ;
int bus = temp_mo_drives [ lv1_current_sel ] . bus_type ;
for ( i = IDT_1771 ; i < ( IDT_1772 + 1 ) ; i + + ) {
h = GetDlgItem ( hdlg , i ) ;
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
}
h = GetDlgItem ( hdlg , IDC_COMBO_MO_ID ) ;
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_MO_CHANNEL_IDE ) ;
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_MO_TYPE ) ;
if ( bus = = MO_BUS_DISABLED ) {
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
} else {
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
SendMessage ( h , CB_SETCURSEL , temp_mo_drives [ lv1_current_sel ] . type , 0 ) ;
}
h = GetDlgItem ( hdlg , IDT_1773 ) ;
if ( bus = = CDROM_BUS_DISABLED ) {
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
} else {
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
}
switch ( bus ) {
case MO_BUS_ATAPI : /* ATAPI */
h = GetDlgItem ( hdlg , IDT_1772 ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
if ( assign_id )
temp_mo_drives [ lv1_current_sel ] . ide_channel = next_free_ide_channel ( ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_MO_CHANNEL_IDE ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
SendMessage ( h , CB_SETCURSEL , temp_mo_drives [ lv1_current_sel ] . ide_channel , 0 ) ;
break ;
case MO_BUS_SCSI : /* SCSI */
h = GetDlgItem ( hdlg , IDT_1771 ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
if ( assign_id )
next_free_scsi_id ( ( uint8_t * ) & temp_mo_drives [ lv1_current_sel ] . scsi_device_id ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_MO_ID ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
SendMessage ( h , CB_SETCURSEL , temp_mo_drives [ lv1_current_sel ] . scsi_device_id , 0 ) ;
break ;
}
}
2018-07-15 01:41:53 +02:00
static void
zip_add_locations ( HWND hdlg )
2018-01-26 22:17:09 +01:00
{
2018-07-15 01:41:53 +02:00
LPTSTR lptsTemp ;
HWND h ;
int i = 0 ;
2018-01-26 22:17:09 +01:00
2019-02-06 03:34:39 +01:00
lptsTemp = ( LPTSTR ) malloc ( 512 * sizeof ( WCHAR ) ) ;
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_ZIP_BUS ) ;
for ( i = ZIP_BUS_DISABLED ; i < = ZIP_BUS_SCSI ; i + + ) {
if ( ( i = = ZIP_BUS_DISABLED ) | | ( i > = ZIP_BUS_ATAPI ) )
SendMessage ( h , CB_ADDSTRING , 0 , win_get_string ( combo_id_to_string_id ( i ) ) ) ;
}
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_ZIP_ID ) ;
for ( i = 0 ; i < 16 ; i + + ) {
wsprintf ( lptsTemp , plat_get_string ( IDS_4098 ) , i ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
}
h = GetDlgItem ( hdlg , IDC_COMBO_ZIP_CHANNEL_IDE ) ;
for ( i = 0 ; i < 8 ; i + + ) {
wsprintf ( lptsTemp , plat_get_string ( IDS_4097 ) , i > > 1 , i & 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) lptsTemp ) ;
}
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
free ( lptsTemp ) ;
2018-01-26 22:17:09 +01:00
}
2018-03-07 20:06:08 +01:00
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
static void
zip_recalc_location_controls ( HWND hdlg , int assign_id )
{
int i = 0 ;
HWND h ;
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
int bus = temp_zip_drives [ lv2_current_sel ] . bus_type ;
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
for ( i = IDT_1754 ; i < ( IDT_1755 + 1 ) ; i + + ) {
h = GetDlgItem ( hdlg , i ) ;
2018-01-26 22:17:09 +01:00
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
2018-07-15 01:41:53 +02:00
}
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_ZIP_ID ) ;
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_ZIP_CHANNEL_IDE ) ;
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
h = GetDlgItem ( hdlg , IDC_CHECK250 ) ;
if ( bus = = ZIP_BUS_DISABLED ) {
2018-01-26 22:17:09 +01:00
EnableWindow ( h , FALSE ) ;
ShowWindow ( h , SW_HIDE ) ;
2018-07-15 01:41:53 +02:00
} else {
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
SendMessage ( h , BM_SETCHECK , temp_zip_drives [ lv2_current_sel ] . is_250 , 0 ) ;
}
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
switch ( bus ) {
case ZIP_BUS_ATAPI : /* ATAPI */
h = GetDlgItem ( hdlg , IDT_1755 ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
if ( assign_id )
temp_zip_drives [ lv2_current_sel ] . ide_channel = next_free_ide_channel ( ) ;
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_ZIP_CHANNEL_IDE ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
SendMessage ( h , CB_SETCURSEL , temp_zip_drives [ lv2_current_sel ] . ide_channel , 0 ) ;
break ;
case ZIP_BUS_SCSI : /* SCSI */
h = GetDlgItem ( hdlg , IDT_1754 ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
if ( assign_id )
next_free_scsi_id ( ( uint8_t * ) & temp_zip_drives [ lv2_current_sel ] . scsi_device_id ) ;
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_ZIP_ID ) ;
ShowWindow ( h , SW_SHOW ) ;
EnableWindow ( h , TRUE ) ;
SendMessage ( h , CB_SETCURSEL , temp_zip_drives [ lv2_current_sel ] . scsi_device_id , 0 ) ;
break ;
}
2018-01-26 22:17:09 +01:00
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
static void
cdrom_track ( uint8_t id )
2018-01-19 15:39:13 +01:00
{
2018-10-17 05:29:48 +02:00
if ( temp_cdrom [ id ] . bus_type = = CDROM_BUS_ATAPI )
ide_tracking | = ( 2 < < ( temp_cdrom [ id ] . ide_channel < < 3 ) ) ;
2019-09-26 10:02:43 +02:00
else if ( temp_cdrom [ id ] . bus_type = = CDROM_BUS_SCSI )
2018-10-17 05:29:48 +02:00
scsi_tracking [ temp_cdrom [ id ] . scsi_device_id > > 3 ] | = ( 1 < < ( temp_cdrom [ id ] . scsi_device_id & 0x07 ) ) ;
2018-01-19 15:39:13 +01:00
}
2018-07-15 01:41:53 +02:00
static void
cdrom_untrack ( uint8_t id )
2018-01-26 22:17:09 +01:00
{
2018-10-17 05:29:48 +02:00
if ( temp_cdrom [ id ] . bus_type = = CDROM_BUS_ATAPI )
ide_tracking & = ~ ( 2 < < ( temp_cdrom [ id ] . ide_channel < < 3 ) ) ;
2019-09-26 10:02:43 +02:00
else if ( temp_cdrom [ id ] . bus_type = = CDROM_BUS_SCSI )
2018-10-17 05:29:48 +02:00
scsi_tracking [ temp_cdrom [ id ] . scsi_device_id > > 3 ] & = ~ ( 1 < < ( temp_cdrom [ id ] . scsi_device_id & 0x07 ) ) ;
2018-01-26 22:17:09 +01:00
}
2017-05-18 14:03:43 -04:00
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
static void
zip_track ( uint8_t id )
2018-01-26 22:17:09 +01:00
{
2018-07-15 01:41:53 +02:00
if ( temp_zip_drives [ id ] . bus_type = = ZIP_BUS_ATAPI )
ide_tracking | = ( 1 < < temp_zip_drives [ id ] . ide_channel ) ;
else if ( temp_zip_drives [ id ] . bus_type = = ZIP_BUS_SCSI )
scsi_tracking [ temp_zip_drives [ id ] . scsi_device_id > > 3 ] | = ( 1 < < ( temp_zip_drives [ id ] . scsi_device_id & 0x07 ) ) ;
2018-01-26 22:17:09 +01:00
}
2018-07-15 01:41:53 +02:00
static void
zip_untrack ( uint8_t id )
2018-01-26 22:17:09 +01:00
{
2018-07-15 01:41:53 +02:00
if ( temp_zip_drives [ id ] . bus_type = = ZIP_BUS_ATAPI )
ide_tracking & = ~ ( 1 < < temp_zip_drives [ id ] . ide_channel ) ;
else if ( temp_zip_drives [ id ] . bus_type = = ZIP_BUS_SCSI )
scsi_tracking [ temp_zip_drives [ id ] . scsi_device_id > > 3 ] & = ~ ( 1 < < ( temp_zip_drives [ id ] . scsi_device_id & 0x07 ) ) ;
2018-01-26 22:17:09 +01:00
}
2020-07-15 09:03:30 +08:00
static void
mo_track ( uint8_t id )
{
if ( temp_mo_drives [ id ] . bus_type = = MO_BUS_ATAPI )
ide_tracking | = ( 1 < < ( temp_zip_drives [ id ] . ide_channel < < 3 ) ) ;
else if ( temp_mo_drives [ id ] . bus_type = = MO_BUS_SCSI )
scsi_tracking [ temp_mo_drives [ id ] . scsi_device_id > > 3 ] | = ( 1 < < ( temp_mo_drives [ id ] . scsi_device_id & 0x07 ) ) ;
}
static void
mo_untrack ( uint8_t id )
{
if ( temp_mo_drives [ id ] . bus_type = = MO_BUS_ATAPI )
ide_tracking & = ~ ( 1 < < ( temp_zip_drives [ id ] . ide_channel < < 3 ) ) ;
else if ( temp_mo_drives [ id ] . bus_type = = MO_BUS_SCSI )
scsi_tracking [ temp_mo_drives [ id ] . scsi_device_id > > 3 ] & = ~ ( 1 < < ( temp_mo_drives [ id ] . scsi_device_id & 0x07 ) ) ;
}
2019-03-20 02:42:55 +08:00
# if defined(__amd64__) || defined(__aarch64__)
2018-01-26 22:17:09 +01:00
static LRESULT CALLBACK
# else
2017-12-13 22:39:41 +01:00
static BOOL CALLBACK
# endif
2020-07-19 06:07:58 +02:00
win_settings_floppy_and_cdrom_drives_proc ( HWND hdlg , UINT message , WPARAM wParam , LPARAM lParam )
2017-05-18 14:03:43 -04:00
{
2019-03-20 02:42:55 +08:00
HWND h = NULL ;
2020-07-19 06:07:58 +02:00
int i = 0 , old_sel = 0 , b = 0 , assign = 0 ;
uint32_t b2 = 0 ;
2018-07-15 01:41:53 +02:00
WCHAR szText [ 256 ] ;
const uint8_t fd_icons [ 15 ] = { 248 , 16 , 16 , 16 , 16 , 16 , 16 , 24 , 24 , 24 , 24 , 24 , 24 , 24 , 0 } ;
2020-07-19 06:07:58 +02:00
const uint8_t cd_icons [ 3 ] = { 249 , 32 , 0 } ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
switch ( message ) {
case WM_INITDIALOG :
ignore_change = 1 ;
2017-06-04 02:14:27 +02:00
2018-07-15 01:41:53 +02:00
lv1_current_sel = 0 ;
h = GetDlgItem ( hdlg , IDC_LIST_FLOPPY_DRIVES ) ;
win_settings_floppy_drives_init_columns ( h ) ;
image_list_init ( h , ( const uint8_t * ) fd_icons ) ;
win_settings_floppy_drives_recalc_list ( h ) ;
ListView_SetItemState ( h , 0 , LVIS_FOCUSED | LVIS_SELECTED , 0x000F ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_FD_TYPE ) ;
for ( i = 0 ; i < 14 ; i + + ) {
if ( i = = 0 )
SendMessage ( h , CB_ADDSTRING , 0 , win_get_string ( IDS_5376 ) ) ;
else {
mbstowcs ( szText , fdd_getname ( i ) , strlen ( fdd_getname ( i ) ) + 1 ) ;
SendMessage ( h , CB_ADDSTRING , 0 , ( LPARAM ) szText ) ;
}
}
SendMessage ( h , CB_SETCURSEL , temp_fdd_types [ lv1_current_sel ] , 0 ) ;
2017-07-27 17:14:52 +02:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECKTURBO ) ;
SendMessage ( h , BM_SETCHECK , temp_fdd_turbo [ lv1_current_sel ] , 0 ) ;
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_CHECKBPB ) ;
SendMessage ( h , BM_SETCHECK , temp_fdd_check_bpb [ lv1_current_sel ] , 0 ) ;
2018-01-26 22:17:09 +01:00
2020-07-19 06:07:58 +02:00
lv2_current_sel = 0 ;
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_LIST_CDROM_DRIVES ) ;
win_settings_cdrom_drives_init_columns ( h ) ;
image_list_init ( h , ( const uint8_t * ) cd_icons ) ;
win_settings_cdrom_drives_recalc_list ( h ) ;
ListView_SetItemState ( h , 0 , LVIS_FOCUSED | LVIS_SELECTED , 0x000F ) ;
cdrom_add_locations ( hdlg ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_CD_BUS ) ;
2020-07-19 06:07:58 +02:00
switch ( temp_cdrom [ lv2_current_sel ] . bus_type ) {
2018-07-15 01:41:53 +02:00
case CDROM_BUS_DISABLED :
default :
b = 0 ;
break ;
case CDROM_BUS_ATAPI :
b = 1 ;
break ;
case CDROM_BUS_SCSI :
b = 2 ;
break ;
}
SendMessage ( h , CB_SETCURSEL , b , 0 ) ;
cdrom_recalc_location_controls ( hdlg , 0 ) ;
2020-07-15 09:03:30 +08:00
ignore_change = 0 ;
return TRUE ;
case WM_NOTIFY :
if ( ignore_change )
return FALSE ;
2020-07-19 06:07:58 +02:00
if ( ( ( ( LPNMHDR ) lParam ) - > code = = LVN_ITEMCHANGED ) & & ( ( ( LPNMHDR ) lParam ) - > idFrom = = IDC_LIST_FLOPPY_DRIVES ) ) {
2020-07-15 09:03:30 +08:00
old_sel = lv1_current_sel ;
2020-07-19 06:07:58 +02:00
lv1_current_sel = get_selected_drive ( hdlg , IDC_LIST_FLOPPY_DRIVES ) ;
2020-07-15 09:03:30 +08:00
if ( lv1_current_sel = = old_sel )
return FALSE ;
else if ( lv1_current_sel = = - 1 ) {
ignore_change = 1 ;
lv1_current_sel = old_sel ;
ListView_SetItemState ( h , lv1_current_sel , LVIS_FOCUSED | LVIS_SELECTED , 0x000F ) ;
ignore_change = 0 ;
return FALSE ;
}
ignore_change = 1 ;
2020-07-19 06:07:58 +02:00
h = GetDlgItem ( hdlg , IDC_COMBO_FD_TYPE ) ;
SendMessage ( h , CB_SETCURSEL , temp_fdd_types [ lv1_current_sel ] , 0 ) ;
h = GetDlgItem ( hdlg , IDC_CHECKTURBO ) ;
SendMessage ( h , BM_SETCHECK , temp_fdd_turbo [ lv1_current_sel ] , 0 ) ;
h = GetDlgItem ( hdlg , IDC_CHECKBPB ) ;
SendMessage ( h , BM_SETCHECK , temp_fdd_check_bpb [ lv1_current_sel ] , 0 ) ;
ignore_change = 0 ;
} else if ( ( ( ( LPNMHDR ) lParam ) - > code = = LVN_ITEMCHANGED ) & & ( ( ( LPNMHDR ) lParam ) - > idFrom = = IDC_LIST_CDROM_DRIVES ) ) {
old_sel = lv2_current_sel ;
lv2_current_sel = get_selected_drive ( hdlg , IDC_LIST_CDROM_DRIVES ) ;
if ( lv2_current_sel = = old_sel )
return FALSE ;
else if ( lv2_current_sel = = - 1 ) {
ignore_change = 1 ;
lv2_current_sel = old_sel ;
ListView_SetItemState ( h , lv2_current_sel , LVIS_FOCUSED | LVIS_SELECTED , 0x000F ) ;
ignore_change = 0 ;
return FALSE ;
}
ignore_change = 1 ;
2020-07-15 09:03:30 +08:00
h = GetDlgItem ( hdlg , IDC_COMBO_CD_BUS ) ;
2020-07-19 06:07:58 +02:00
switch ( temp_cdrom [ lv2_current_sel ] . bus_type ) {
2020-07-15 09:03:30 +08:00
case CDROM_BUS_DISABLED :
default :
b = 0 ;
break ;
case CDROM_BUS_ATAPI :
b = 1 ;
break ;
case CDROM_BUS_SCSI :
b = 2 ;
break ;
}
SendMessage ( h , CB_SETCURSEL , b , 0 ) ;
mo_recalc_location_controls ( hdlg , 0 ) ;
ignore_change = 0 ;
}
break ;
case WM_COMMAND :
if ( ignore_change )
return FALSE ;
ignore_change = 1 ;
2020-07-19 06:07:58 +02:00
switch ( LOWORD ( wParam ) ) {
case IDC_COMBO_FD_TYPE :
h = GetDlgItem ( hdlg , IDC_COMBO_FD_TYPE ) ;
temp_fdd_types [ lv1_current_sel ] = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
h = GetDlgItem ( hdlg , IDC_LIST_FLOPPY_DRIVES ) ;
win_settings_floppy_drives_update_item ( h , lv1_current_sel ) ;
break ;
case IDC_CHECKTURBO :
h = GetDlgItem ( hdlg , IDC_CHECKTURBO ) ;
temp_fdd_turbo [ lv1_current_sel ] = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
h = GetDlgItem ( hdlg , IDC_LIST_FLOPPY_DRIVES ) ;
win_settings_floppy_drives_update_item ( h , lv1_current_sel ) ;
break ;
case IDC_CHECKBPB :
h = GetDlgItem ( hdlg , IDC_CHECKBPB ) ;
temp_fdd_check_bpb [ lv1_current_sel ] = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
h = GetDlgItem ( hdlg , IDC_LIST_FLOPPY_DRIVES ) ;
win_settings_floppy_drives_update_item ( h , lv1_current_sel ) ;
break ;
2020-07-15 09:03:30 +08:00
case IDC_COMBO_CD_BUS :
h = GetDlgItem ( hdlg , IDC_COMBO_CD_BUS ) ;
b = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
switch ( b ) {
case 0 :
b2 = CDROM_BUS_DISABLED ;
break ;
case 1 :
b2 = CDROM_BUS_ATAPI ;
break ;
case 2 :
b2 = CDROM_BUS_SCSI ;
break ;
}
2020-07-19 06:07:58 +02:00
if ( b2 = = temp_cdrom [ lv2_current_sel ] . bus_type )
2020-07-15 09:03:30 +08:00
break ;
2020-07-19 06:07:58 +02:00
cdrom_untrack ( lv2_current_sel ) ;
assign = ( temp_cdrom [ lv2_current_sel ] . bus_type = = b2 ) ? 0 : 1 ;
if ( temp_cdrom [ lv2_current_sel ] . bus_type = = CDROM_BUS_DISABLED )
temp_cdrom [ lv2_current_sel ] . speed = 8 ;
temp_cdrom [ lv2_current_sel ] . bus_type = b2 ;
2020-07-15 09:03:30 +08:00
cdrom_recalc_location_controls ( hdlg , assign ) ;
2020-07-19 06:07:58 +02:00
cdrom_track ( lv2_current_sel ) ;
2020-07-15 09:03:30 +08:00
h = GetDlgItem ( hdlg , IDC_LIST_CDROM_DRIVES ) ;
2020-07-19 06:07:58 +02:00
win_settings_cdrom_drives_update_item ( h , lv2_current_sel ) ;
2020-07-15 09:03:30 +08:00
break ;
case IDC_COMBO_CD_ID :
h = GetDlgItem ( hdlg , IDC_COMBO_CD_ID ) ;
2020-07-19 06:07:58 +02:00
cdrom_untrack ( lv2_current_sel ) ;
temp_cdrom [ lv2_current_sel ] . scsi_device_id = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
cdrom_track ( lv2_current_sel ) ;
2020-07-15 09:03:30 +08:00
h = GetDlgItem ( hdlg , IDC_LIST_CDROM_DRIVES ) ;
2020-07-19 06:07:58 +02:00
win_settings_cdrom_drives_update_item ( h , lv2_current_sel ) ;
2020-07-15 09:03:30 +08:00
break ;
case IDC_COMBO_CD_CHANNEL_IDE :
h = GetDlgItem ( hdlg , IDC_COMBO_CD_CHANNEL_IDE ) ;
2020-07-19 06:07:58 +02:00
cdrom_untrack ( lv2_current_sel ) ;
temp_cdrom [ lv2_current_sel ] . ide_channel = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
cdrom_track ( lv2_current_sel ) ;
2020-07-15 09:03:30 +08:00
h = GetDlgItem ( hdlg , IDC_LIST_CDROM_DRIVES ) ;
2020-07-19 06:07:58 +02:00
win_settings_cdrom_drives_update_item ( h , lv2_current_sel ) ;
2020-07-15 09:03:30 +08:00
break ;
case IDC_COMBO_CD_SPEED :
h = GetDlgItem ( hdlg , IDC_COMBO_CD_SPEED ) ;
2020-07-19 06:07:58 +02:00
temp_cdrom [ lv2_current_sel ] . speed = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) + 1 ;
2020-07-15 09:03:30 +08:00
h = GetDlgItem ( hdlg , IDC_LIST_CDROM_DRIVES ) ;
2020-07-19 06:07:58 +02:00
win_settings_cdrom_drives_update_item ( h , lv2_current_sel ) ;
2020-07-15 09:03:30 +08:00
break ;
}
ignore_change = 0 ;
2020-09-03 12:14:22 +08:00
case WM_DPICHANGED_AFTERPARENT :
h = GetDlgItem ( hdlg , IDC_LIST_FLOPPY_DRIVES ) ;
win_settings_floppy_drives_resize_columns ( h ) ;
image_list_init ( h , ( const uint8_t * ) fd_icons ) ;
h = GetDlgItem ( hdlg , IDC_LIST_CDROM_DRIVES ) ;
win_settings_cdrom_drives_resize_columns ( h ) ;
image_list_init ( h , ( const uint8_t * ) cd_icons ) ;
break ;
2020-07-15 09:03:30 +08:00
default :
return FALSE ;
}
return FALSE ;
}
2020-07-19 06:07:58 +02:00
2020-07-15 09:03:30 +08:00
# if defined(__amd64__) || defined(__aarch64__)
static LRESULT CALLBACK
# else
static BOOL CALLBACK
# endif
win_settings_other_removable_devices_proc ( HWND hdlg , UINT message , WPARAM wParam , LPARAM lParam )
{
HWND h = NULL ;
int old_sel = 0 , b = 0 , assign = 0 ;
uint32_t b2 = 0 ;
2020-07-19 06:07:58 +02:00
const uint8_t mo_icons [ 3 ] = { 251 , 56 , 0 } ;
2020-07-15 09:03:30 +08:00
const uint8_t zip_icons [ 3 ] = { 250 , 48 , 0 } ;
switch ( message ) {
case WM_INITDIALOG :
ignore_change = 1 ;
lv1_current_sel = 0 ;
h = GetDlgItem ( hdlg , IDC_LIST_MO_DRIVES ) ;
win_settings_mo_drives_init_columns ( h ) ;
image_list_init ( h , ( const uint8_t * ) mo_icons ) ;
win_settings_mo_drives_recalc_list ( h ) ;
ListView_SetItemState ( h , 0 , LVIS_FOCUSED | LVIS_SELECTED , 0x000F ) ;
mo_add_locations ( hdlg ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_MO_BUS ) ;
switch ( temp_mo_drives [ lv1_current_sel ] . bus_type ) {
case MO_BUS_DISABLED :
default :
b = 0 ;
break ;
case MO_BUS_ATAPI :
b = 1 ;
break ;
case MO_BUS_SCSI :
b = 2 ;
break ;
}
SendMessage ( h , CB_SETCURSEL , b , 0 ) ;
mo_recalc_location_controls ( hdlg , 0 ) ;
2018-07-15 01:41:53 +02:00
lv2_current_sel = 0 ;
h = GetDlgItem ( hdlg , IDC_LIST_ZIP_DRIVES ) ;
win_settings_zip_drives_init_columns ( h ) ;
image_list_init ( h , ( const uint8_t * ) zip_icons ) ;
win_settings_zip_drives_recalc_list ( h ) ;
ListView_SetItemState ( h , 0 , LVIS_FOCUSED | LVIS_SELECTED , 0x000F ) ;
zip_add_locations ( hdlg ) ;
h = GetDlgItem ( hdlg , IDC_COMBO_ZIP_BUS ) ;
switch ( temp_zip_drives [ lv2_current_sel ] . bus_type ) {
case ZIP_BUS_DISABLED :
default :
b = 0 ;
break ;
case ZIP_BUS_ATAPI :
b = 1 ;
break ;
case ZIP_BUS_SCSI :
b = 2 ;
break ;
}
SendMessage ( h , CB_SETCURSEL , b , 0 ) ;
zip_recalc_location_controls ( hdlg , 0 ) ;
ignore_change = 0 ;
return TRUE ;
case WM_NOTIFY :
if ( ignore_change )
return FALSE ;
2020-07-15 09:03:30 +08:00
if ( ( ( ( LPNMHDR ) lParam ) - > code = = LVN_ITEMCHANGED ) & & ( ( ( LPNMHDR ) lParam ) - > idFrom = = IDC_LIST_MO_DRIVES ) ) {
2018-07-15 01:41:53 +02:00
old_sel = lv1_current_sel ;
2020-07-15 09:03:30 +08:00
lv1_current_sel = get_selected_drive ( hdlg , IDC_LIST_MO_DRIVES ) ;
2018-07-15 01:41:53 +02:00
if ( lv1_current_sel = = old_sel )
return FALSE ;
else if ( lv1_current_sel = = - 1 ) {
ignore_change = 1 ;
lv1_current_sel = old_sel ;
ListView_SetItemState ( h , lv1_current_sel , LVIS_FOCUSED | LVIS_SELECTED , 0x000F ) ;
ignore_change = 0 ;
return FALSE ;
}
ignore_change = 1 ;
2017-05-27 03:53:32 +02:00
2020-07-15 09:03:30 +08:00
h = GetDlgItem ( hdlg , IDC_COMBO_MO_BUS ) ;
2017-05-27 03:53:32 +02:00
2020-07-15 09:03:30 +08:00
switch ( temp_mo_drives [ lv1_current_sel ] . bus_type ) {
case MO_BUS_DISABLED :
2017-05-27 03:53:32 +02:00
default :
b = 0 ;
break ;
2020-07-15 09:03:30 +08:00
case MO_BUS_ATAPI :
2017-05-27 03:53:32 +02:00
b = 1 ;
break ;
2020-07-15 09:03:30 +08:00
case MO_BUS_SCSI :
2018-04-25 23:51:13 +02:00
b = 2 ;
2017-05-27 03:53:32 +02:00
break ;
2017-05-18 14:03:43 -04:00
}
2017-05-27 03:53:32 +02:00
SendMessage ( h , CB_SETCURSEL , b , 0 ) ;
2020-07-15 09:03:30 +08:00
mo_recalc_location_controls ( hdlg , 0 ) ;
2018-07-15 01:41:53 +02:00
ignore_change = 0 ;
} else if ( ( ( ( LPNMHDR ) lParam ) - > code = = LVN_ITEMCHANGED ) & & ( ( ( LPNMHDR ) lParam ) - > idFrom = = IDC_LIST_ZIP_DRIVES ) ) {
old_sel = lv2_current_sel ;
lv2_current_sel = get_selected_drive ( hdlg , IDC_LIST_ZIP_DRIVES ) ;
if ( lv2_current_sel = = old_sel )
return FALSE ;
else if ( lv2_current_sel = = - 1 ) {
ignore_change = 1 ;
lv2_current_sel = old_sel ;
ListView_SetItemState ( h , lv2_current_sel , LVIS_FOCUSED | LVIS_SELECTED , 0x000F ) ;
ignore_change = 0 ;
return FALSE ;
}
ignore_change = 1 ;
2018-01-26 22:17:09 +01:00
h = GetDlgItem ( hdlg , IDC_COMBO_ZIP_BUS ) ;
2018-07-15 01:41:53 +02:00
switch ( temp_zip_drives [ lv2_current_sel ] . bus_type ) {
2018-01-26 22:17:09 +01:00
case ZIP_BUS_DISABLED :
default :
b = 0 ;
break ;
2018-04-25 23:51:13 +02:00
case ZIP_BUS_ATAPI :
2018-01-26 22:17:09 +01:00
b = 1 ;
break ;
case ZIP_BUS_SCSI :
2018-04-25 23:51:13 +02:00
b = 2 ;
2018-01-26 22:17:09 +01:00
break ;
}
SendMessage ( h , CB_SETCURSEL , b , 0 ) ;
zip_recalc_location_controls ( hdlg , 0 ) ;
2018-07-15 01:41:53 +02:00
ignore_change = 0 ;
}
break ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
case WM_COMMAND :
if ( ignore_change )
return FALSE ;
2017-05-27 03:53:32 +02:00
2018-07-15 01:41:53 +02:00
ignore_change = 1 ;
2020-07-15 09:03:30 +08:00
switch ( LOWORD ( wParam ) ) {
case IDC_COMBO_MO_BUS :
h = GetDlgItem ( hdlg , IDC_COMBO_MO_BUS ) ;
2018-07-15 01:41:53 +02:00
b = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
switch ( b ) {
case 0 :
2020-07-15 09:03:30 +08:00
b2 = MO_BUS_DISABLED ;
2017-05-27 03:53:32 +02:00
break ;
2018-07-15 01:41:53 +02:00
case 1 :
2020-07-15 09:03:30 +08:00
b2 = MO_BUS_ATAPI ;
2017-05-27 03:53:32 +02:00
break ;
2018-07-15 01:41:53 +02:00
case 2 :
2020-07-15 09:03:30 +08:00
b2 = MO_BUS_SCSI ;
2017-05-27 03:53:32 +02:00
break ;
2017-05-18 14:03:43 -04:00
}
2020-07-15 09:03:30 +08:00
if ( b2 = = temp_mo_drives [ lv1_current_sel ] . bus_type )
2018-07-15 01:41:53 +02:00
break ;
2020-07-15 09:03:30 +08:00
mo_untrack ( lv1_current_sel ) ;
assign = ( temp_mo_drives [ lv1_current_sel ] . bus_type = = b2 ) ? 0 : 1 ;
if ( temp_mo_drives [ lv1_current_sel ] . bus_type = = MO_BUS_DISABLED )
temp_mo_drives [ lv1_current_sel ] . type = 0 ;
temp_mo_drives [ lv1_current_sel ] . bus_type = b2 ;
mo_recalc_location_controls ( hdlg , assign ) ;
mo_track ( lv1_current_sel ) ;
h = GetDlgItem ( hdlg , IDC_LIST_MO_DRIVES ) ;
win_settings_mo_drives_update_item ( h , lv1_current_sel ) ;
2018-07-15 01:41:53 +02:00
break ;
2017-05-27 03:53:32 +02:00
2020-07-15 09:03:30 +08:00
case IDC_COMBO_MO_ID :
h = GetDlgItem ( hdlg , IDC_COMBO_MO_ID ) ;
mo_untrack ( lv1_current_sel ) ;
temp_mo_drives [ lv1_current_sel ] . scsi_device_id = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
mo_track ( lv1_current_sel ) ;
h = GetDlgItem ( hdlg , IDC_LIST_MO_DRIVES ) ;
win_settings_mo_drives_update_item ( h , lv1_current_sel ) ;
2018-07-15 01:41:53 +02:00
break ;
2017-05-27 03:53:32 +02:00
2020-07-15 09:03:30 +08:00
case IDC_COMBO_MO_CHANNEL_IDE :
h = GetDlgItem ( hdlg , IDC_COMBO_MO_CHANNEL_IDE ) ;
mo_untrack ( lv1_current_sel ) ;
temp_mo_drives [ lv1_current_sel ] . ide_channel = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
mo_track ( lv1_current_sel ) ;
h = GetDlgItem ( hdlg , IDC_LIST_MO_DRIVES ) ;
win_settings_mo_drives_update_item ( h , lv1_current_sel ) ;
2018-07-15 01:41:53 +02:00
break ;
2017-05-18 14:03:43 -04:00
2020-07-15 09:03:30 +08:00
case IDC_COMBO_MO_TYPE :
h = GetDlgItem ( hdlg , IDC_COMBO_MO_TYPE ) ;
temp_mo_drives [ lv1_current_sel ] . type = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
h = GetDlgItem ( hdlg , IDC_LIST_MO_DRIVES ) ;
win_settings_mo_drives_update_item ( h , lv1_current_sel ) ;
2018-07-15 01:41:53 +02:00
break ;
2017-06-04 02:14:27 +02:00
2018-07-15 01:41:53 +02:00
case IDC_COMBO_ZIP_BUS :
h = GetDlgItem ( hdlg , IDC_COMBO_ZIP_BUS ) ;
b = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
switch ( b ) {
case 0 :
b2 = ZIP_BUS_DISABLED ;
2018-01-26 22:17:09 +01:00
break ;
2018-07-15 01:41:53 +02:00
case 1 :
b2 = ZIP_BUS_ATAPI ;
2018-01-26 22:17:09 +01:00
break ;
2018-07-15 01:41:53 +02:00
case 2 :
b2 = ZIP_BUS_SCSI ;
2018-01-26 22:17:09 +01:00
break ;
}
2018-07-15 01:41:53 +02:00
if ( b2 = = temp_zip_drives [ lv2_current_sel ] . bus_type )
break ;
zip_untrack ( lv2_current_sel ) ;
assign = ( temp_zip_drives [ lv2_current_sel ] . bus_type = = b2 ) ? 0 : 1 ;
temp_zip_drives [ lv2_current_sel ] . bus_type = b2 ;
zip_recalc_location_controls ( hdlg , assign ) ;
zip_track ( lv2_current_sel ) ;
h = GetDlgItem ( hdlg , IDC_LIST_ZIP_DRIVES ) ;
win_settings_zip_drives_update_item ( h , lv2_current_sel ) ;
break ;
2017-07-27 17:14:52 +02:00
2018-07-15 01:41:53 +02:00
case IDC_COMBO_ZIP_ID :
h = GetDlgItem ( hdlg , IDC_COMBO_ZIP_ID ) ;
zip_untrack ( lv2_current_sel ) ;
temp_zip_drives [ lv2_current_sel ] . scsi_device_id = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
zip_track ( lv2_current_sel ) ;
h = GetDlgItem ( hdlg , IDC_LIST_ZIP_DRIVES ) ;
win_settings_zip_drives_update_item ( h , lv2_current_sel ) ;
break ;
2017-07-27 17:14:52 +02:00
2018-07-15 01:41:53 +02:00
case IDC_COMBO_ZIP_CHANNEL_IDE :
h = GetDlgItem ( hdlg , IDC_COMBO_ZIP_CHANNEL_IDE ) ;
zip_untrack ( lv2_current_sel ) ;
temp_zip_drives [ lv2_current_sel ] . ide_channel = SendMessage ( h , CB_GETCURSEL , 0 , 0 ) ;
zip_track ( lv2_current_sel ) ;
h = GetDlgItem ( hdlg , IDC_LIST_ZIP_DRIVES ) ;
win_settings_zip_drives_update_item ( h , lv2_current_sel ) ;
break ;
2018-01-26 22:17:09 +01:00
2018-07-15 01:41:53 +02:00
case IDC_CHECK250 :
2018-01-26 22:17:09 +01:00
h = GetDlgItem ( hdlg , IDC_CHECK250 ) ;
2018-07-15 01:41:53 +02:00
temp_zip_drives [ lv2_current_sel ] . is_250 = SendMessage ( h , BM_GETCHECK , 0 , 0 ) ;
h = GetDlgItem ( hdlg , IDC_LIST_ZIP_DRIVES ) ;
win_settings_zip_drives_update_item ( h , lv2_current_sel ) ;
break ;
}
ignore_change = 0 ;
2017-05-18 14:03:43 -04:00
2020-09-03 12:14:22 +08:00
case WM_DPICHANGED_AFTERPARENT :
h = GetDlgItem ( hdlg , IDC_LIST_MO_DRIVES ) ;
win_settings_mo_drives_resize_columns ( h ) ;
image_list_init ( h , ( const uint8_t * ) mo_icons ) ;
h = GetDlgItem ( hdlg , IDC_LIST_ZIP_DRIVES ) ;
win_settings_zip_drives_resize_columns ( h ) ;
image_list_init ( h , ( const uint8_t * ) zip_icons ) ;
break ;
2018-07-15 01:41:53 +02:00
default :
return FALSE ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
return FALSE ;
2017-05-18 14:03:43 -04:00
}
2017-08-27 00:58:44 +02:00
2017-05-18 14:03:43 -04:00
void win_settings_show_child ( HWND hwndParent , DWORD child_id )
{
2018-07-15 01:41:53 +02:00
if ( child_id = = displayed_category )
return ;
else
displayed_category = child_id ;
SendMessage ( hwndChildDialog , WM_SAVESETTINGS , 0 , 0 ) ;
DestroyWindow ( hwndChildDialog ) ;
switch ( child_id ) {
case SETTINGS_PAGE_MACHINE :
hwndChildDialog = CreateDialog ( hinstance , ( LPCWSTR ) DLG_CFG_MACHINE , hwndParent , win_settings_machine_proc ) ;
break ;
case SETTINGS_PAGE_VIDEO :
hwndChildDialog = CreateDialog ( hinstance , ( LPCWSTR ) DLG_CFG_VIDEO , hwndParent , win_settings_video_proc ) ;
break ;
case SETTINGS_PAGE_INPUT :
hwndChildDialog = CreateDialog ( hinstance , ( LPCWSTR ) DLG_CFG_INPUT , hwndParent , win_settings_input_proc ) ;
break ;
case SETTINGS_PAGE_SOUND :
hwndChildDialog = CreateDialog ( hinstance , ( LPCWSTR ) DLG_CFG_SOUND , hwndParent , win_settings_sound_proc ) ;
break ;
case SETTINGS_PAGE_NETWORK :
hwndChildDialog = CreateDialog ( hinstance , ( LPCWSTR ) DLG_CFG_NETWORK , hwndParent , win_settings_network_proc ) ;
break ;
case SETTINGS_PAGE_PORTS :
hwndChildDialog = CreateDialog ( hinstance , ( LPCWSTR ) DLG_CFG_PORTS , hwndParent , win_settings_ports_proc ) ;
break ;
case SETTINGS_PAGE_PERIPHERALS :
hwndChildDialog = CreateDialog ( hinstance , ( LPCWSTR ) DLG_CFG_PERIPHERALS , hwndParent , win_settings_peripherals_proc ) ;
break ;
case SETTINGS_PAGE_HARD_DISKS :
hwndChildDialog = CreateDialog ( hinstance , ( LPCWSTR ) DLG_CFG_HARD_DISKS , hwndParent , win_settings_hard_disks_proc ) ;
break ;
2020-07-19 06:07:58 +02:00
case SETTINGS_PAGE_FLOPPY_AND_CDROM_DRIVES :
hwndChildDialog = CreateDialog ( hinstance , ( LPCWSTR ) DLG_CFG_FLOPPY_AND_CDROM_DRIVES , hwndParent , win_settings_floppy_and_cdrom_drives_proc ) ;
2020-07-15 09:03:30 +08:00
break ;
2018-07-15 01:41:53 +02:00
case SETTINGS_PAGE_OTHER_REMOVABLE_DEVICES :
hwndChildDialog = CreateDialog ( hinstance , ( LPCWSTR ) DLG_CFG_OTHER_REMOVABLE_DEVICES , hwndParent , win_settings_other_removable_devices_proc ) ;
break ;
default :
fatal ( " Invalid child dialog ID \n " ) ;
2017-05-18 14:03:43 -04:00
return ;
2018-07-15 01:41:53 +02:00
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
ShowWindow ( hwndChildDialog , SW_SHOWNORMAL ) ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
static BOOL
win_settings_main_insert_categories ( HWND hwndList )
2017-05-18 14:03:43 -04:00
{
2018-07-15 01:41:53 +02:00
LVITEM lvI ;
int i = 0 ;
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
lvI . mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE ;
lvI . stateMask = lvI . iSubItem = lvI . state = 0 ;
2017-05-18 14:03:43 -04:00
2020-07-19 06:07:58 +02:00
for ( i = 0 ; i < 10 ; i + + ) {
lvI . pszText = plat_get_string ( IDS_2065 + i ) ;
2020-07-15 09:03:30 +08:00
lvI . iItem = i ;
lvI . iImage = i ;
2017-05-18 14:03:43 -04:00
2020-07-15 09:03:30 +08:00
if ( ListView_InsertItem ( hwndList , & lvI ) = = - 1 )
return FALSE ;
2018-07-15 01:41:53 +02:00
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
return TRUE ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
2018-10-23 19:41:17 +02:00
2019-03-20 02:42:55 +08:00
# if defined(__amd64__) || defined(__aarch64__)
2018-10-23 19:41:17 +02:00
static LRESULT CALLBACK
# else
static BOOL CALLBACK
# endif
win_settings_confirm ( HWND hdlg , int button )
{
2018-10-23 19:45:05 +02:00
int i ;
2018-10-23 19:41:17 +02:00
SendMessage ( hwndChildDialog , WM_SAVESETTINGS , 0 , 0 ) ;
i = settings_msgbox_reset ( ) ;
if ( i > 0 ) {
if ( i = = 2 )
win_settings_save ( ) ;
DestroyWindow ( hwndChildDialog ) ;
EndDialog ( hdlg , 0 ) ;
2019-11-03 03:18:30 +01:00
win_notify_dlg_closed ( ) ;
2019-02-06 03:34:39 +01:00
2018-10-23 19:41:17 +02:00
return button ? TRUE : FALSE ;
} else
return button ? FALSE : TRUE ;
}
2019-03-20 02:42:55 +08:00
# if defined(__amd64__) || defined(__aarch64__)
2017-12-13 22:39:41 +01:00
static LRESULT CALLBACK
# else
static BOOL CALLBACK
# endif
win_settings_main_proc ( HWND hdlg , UINT message , WPARAM wParam , LPARAM lParam )
2017-05-18 14:03:43 -04:00
{
2019-03-20 02:42:55 +08:00
HWND h = NULL ;
2018-07-15 01:41:53 +02:00
int category , i = 0 , j = 0 ;
2020-07-19 06:07:58 +02:00
const uint8_t cat_icons [ 12 ] = { 240 , 241 , 242 , 243 , 96 , 244 , 245 , 80 , 246 , 247 , 0 } ;
2018-07-15 01:41:53 +02:00
hwndParentDialog = hdlg ;
switch ( message ) {
case WM_INITDIALOG :
2020-09-03 12:14:22 +08:00
dpi = win_get_dpi ( hdlg ) ;
2018-07-15 01:41:53 +02:00
win_settings_init ( ) ;
displayed_category = - 1 ;
h = GetDlgItem ( hdlg , IDC_SETTINGSCATLIST ) ;
image_list_init ( h , ( const uint8_t * ) cat_icons ) ;
win_settings_main_insert_categories ( h ) ;
2019-02-11 01:54:00 +01:00
ListView_SetItemState ( h , first_cat , LVIS_FOCUSED | LVIS_SELECTED , 0x000F ) ;
2018-07-15 01:41:53 +02:00
return TRUE ;
case WM_NOTIFY :
if ( ( ( ( LPNMHDR ) lParam ) - > code = = LVN_ITEMCHANGED ) & & ( ( ( LPNMHDR ) lParam ) - > idFrom = = IDC_SETTINGSCATLIST ) ) {
category = - 1 ;
2020-07-15 09:03:30 +08:00
for ( i = 0 ; i < 11 ; i + + ) {
2018-07-15 01:41:53 +02:00
h = GetDlgItem ( hdlg , IDC_SETTINGSCATLIST ) ;
j = ListView_GetItemState ( h , i , LVIS_SELECTED ) ;
if ( j )
category = i ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
if ( category ! = - 1 )
win_settings_show_child ( hdlg , category ) ;
}
break ;
2018-10-23 19:41:17 +02:00
case WM_CLOSE :
return win_settings_confirm ( hdlg , 0 ) ;
2018-07-15 01:41:53 +02:00
case WM_COMMAND :
switch ( LOWORD ( wParam ) ) {
case IDOK :
2018-10-23 19:41:17 +02:00
return win_settings_confirm ( hdlg , 1 ) ;
2018-07-15 01:41:53 +02:00
case IDCANCEL :
DestroyWindow ( hwndChildDialog ) ;
EndDialog ( hdlg , 0 ) ;
2019-11-03 03:18:30 +01:00
win_notify_dlg_closed ( ) ;
2018-07-15 01:41:53 +02:00
return TRUE ;
}
break ;
2020-09-03 12:14:22 +08:00
case WM_DPICHANGED :
dpi = HIWORD ( wParam ) ;
h = GetDlgItem ( hdlg , IDC_SETTINGSCATLIST ) ;
image_list_init ( h , ( const uint8_t * ) cat_icons ) ;
break ;
2018-07-15 01:41:53 +02:00
default :
return FALSE ;
}
2017-05-18 14:03:43 -04:00
2018-07-15 01:41:53 +02:00
return FALSE ;
2017-05-18 14:03:43 -04:00
}
2018-07-15 01:41:53 +02:00
void
2019-02-11 01:54:00 +01:00
win_settings_open_ex ( HWND hwnd , int category )
2017-05-18 14:03:43 -04:00
{
2019-11-03 03:18:30 +01:00
win_notify_dlg_open ( ) ;
2018-10-26 18:16:57 +02:00
2019-02-11 01:54:00 +01:00
first_cat = category ;
2018-10-26 18:16:57 +02:00
DialogBox ( hinstance , ( LPCWSTR ) DLG_CONFIG , hwnd , win_settings_main_proc ) ;
2017-05-18 14:03:43 -04:00
}
2019-02-11 01:54:00 +01:00
void
win_settings_open ( HWND hwnd )
{
win_settings_open_ex ( hwnd , SETTINGS_PAGE_MACHINE ) ;
}