From 5aec4ef147fadac8ce0fa8c354bc816c3a9935d5 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 19 Jul 2020 06:07:58 +0200 Subject: [PATCH] Changed the MO icons to proper ones, added cassette icons, merged the Floppy drives and CD-ROM drives section of the Settings dialog into one, and changed the configuration file format accordingly with a backward compatibility measure added to correctly load older configuration files. --- src/config.c | 213 +++++++++++++--- src/include/86box/language.h | 17 +- src/include/86box/mo.h | 19 +- src/include/86box/resource.h | 30 +-- src/include/86box/win.h | 5 +- src/win/86Box.rc | 88 ++++--- src/win/icons/cassette.ico | Bin 0 -> 1150 bytes src/win/icons/cassette_active.ico | Bin 0 -> 1150 bytes src/win/icons/cassette_empty.ico | Bin 0 -> 1150 bytes src/win/icons/cassette_empty_active.ico | Bin 0 -> 1150 bytes src/win/icons/floppy_and_cdrom_drives.ico | Bin 0 -> 1150 bytes src/win/icons/floppy_drives.ico | Bin 1150 -> 0 bytes src/win/icons/mo.ico | Bin 1150 -> 1150 bytes src/win/icons/mo_active.ico | Bin 1150 -> 1150 bytes src/win/icons/mo_disabled.ico | Bin 1150 -> 1150 bytes src/win/icons/mo_empty.ico | Bin 1150 -> 1150 bytes src/win/icons/mo_empty_active.ico | Bin 1150 -> 1150 bytes src/win/icons/other_removable_devices.ico | Bin 1150 -> 1150 bytes src/win/win_media_menu.c | 2 +- src/win/win_new_floppy.c | 144 ++++++++++- src/win/win_settings.c | 297 +++++++++------------- src/win/win_stbar.c | 14 +- 22 files changed, 545 insertions(+), 284 deletions(-) create mode 100644 src/win/icons/cassette.ico create mode 100644 src/win/icons/cassette_active.ico create mode 100644 src/win/icons/cassette_empty.ico create mode 100644 src/win/icons/cassette_empty_active.ico create mode 100644 src/win/icons/floppy_and_cdrom_drives.ico delete mode 100644 src/win/icons/floppy_drives.ico diff --git a/src/config.c b/src/config.c index 6ea5b8fa0..da58b02e8 100644 --- a/src/config.c +++ b/src/config.c @@ -111,6 +111,9 @@ typedef struct { static list_t config_head; +/* TODO: Backwards compatibility, get rid of this when enough time has passed. */ +static int backwards_compat = 0; + #ifdef ENABLE_CONFIG_LOG int config_do_log = ENABLE_CONFIG_LOG; @@ -1003,6 +1006,7 @@ load_hard_disks(void) } +/* TODO: Backwards compatibility, get rid of this when enough time has passed. */ /* Load "Floppy Drives" section. */ static void load_floppy_drives(void) @@ -1012,6 +1016,72 @@ load_floppy_drives(void) wchar_t *wp; int c; + if (!backwards_compat) + return; + + for (c=0; c 13) + fdd_set_type(c, 13); + config_delete_var(cat, temp); + + sprintf(temp, "fdd_%02i_fn", c + 1); + wp = config_get_wstring(cat, temp, L""); + config_delete_var(cat, temp); + +#if 0 + /* + * NOTE: + * Temporary hack to remove the absolute + * path currently saved in most config + * files. We should remove this before + * finalizing this release! --FvK + */ + if (! wcsnicmp(wp, usr_path, wcslen(usr_path))) { + /* + * Yep, its absolute and prefixed + * with the EXE path. Just strip + * that off for now... + */ + wcsncpy(floppyfns[c], &wp[wcslen(usr_path)], sizeof_w(floppyfns[c])); + } else +#endif + wcsncpy(floppyfns[c], wp, sizeof_w(floppyfns[c])); + + /* if (*wp != L'\0') + config_log("Floppy%d: %ls\n", c, floppyfns[c]); */ + sprintf(temp, "fdd_%02i_writeprot", c+1); + ui_writeprot[c] = !!config_get_int(cat, temp, 0); + config_delete_var(cat, temp); + sprintf(temp, "fdd_%02i_turbo", c + 1); + fdd_set_turbo(c, !!config_get_int(cat, temp, 0)); + config_delete_var(cat, temp); + sprintf(temp, "fdd_%02i_check_bpb", c+1); + fdd_set_check_bpb(c, !!config_get_int(cat, temp, 1)); + config_delete_var(cat, temp); + } + + delete_section_if_empty(cat); +} + + +/* Load "Floppy and CD-ROM Drives" section. */ +static void +load_floppy_and_cdrom_drives(void) +{ + char *cat = "Floppy and CD-ROM drives"; + char temp[512], tmp2[512], *p; + char s[512]; + unsigned int board = 0, dev = 0; + wchar_t *wp; + int c, d = 0; + + /* TODO: Backwards compatibility, get rid of this when enough time has passed. */ + backwards_compat = (find_section(cat) == NULL); + + memset(temp, 0x00, sizeof(temp)); for (c=0; c>1, (c+2)&1); + p = config_get_string(cat, temp, tmp2); + sscanf(p, "%01u:%01u", &board, &dev); + board &= 3; + dev &= 1; + cdrom[c].ide_channel = (board<<1)+dev; + + if (cdrom[c].ide_channel > 7) + cdrom[c].ide_channel = 7; + } else { + sprintf(temp, "cdrom_%02i_scsi_id", c+1); + if (cdrom[c].bus_type == CDROM_BUS_SCSI) { + cdrom[c].scsi_device_id = config_get_int(cat, temp, c+2); + + if (cdrom[c].scsi_device_id > 15) + cdrom[c].scsi_device_id = 15; + } else + config_delete_var(cat, temp); + } + config_delete_var(cat, temp); + + sprintf(temp, "cdrom_%02i_image_path", c+1); + wp = config_get_wstring(cat, temp, L""); + config_delete_var(cat, temp); + +#if 0 + /* + * NOTE: + * Temporary hack to remove the absolute + * path currently saved in most config + * files. We should remove this before + * finalizing this release! --FvK + */ + if (! wcsnicmp(wp, usr_path, wcslen(usr_path))) { + /* + * Yep, its absolute and prefixed + * with the EXE path. Just strip + * that off for now... + */ + wcsncpy(cdrom[c].image_path, &wp[wcslen(usr_path)], sizeof_w(cdrom[c].image_path)); + } else +#endif + wcsncpy(cdrom[c].image_path, wp, sizeof_w(cdrom[c].image_path)); + + if (cdrom[c].host_drive && (cdrom[c].host_drive != 200)) + cdrom[c].host_drive = 0; + + if ((cdrom[c].host_drive == 0x200) && + (wcslen(cdrom[c].image_path) == 0)) + cdrom[c].host_drive = 0; + } + } + backwards_compat = 0; memset(temp, 0x00, sizeof(temp)); for (c=0; c902iTdXSXeF+1>U}NFtGVDVV6Fl)@H~Zd*8b(HJn%i#HQ5dh*~w z4@wMr0HQ&N5-2KA#0pX5`%`J5EoHm2yEDF9FC4w<3~^W z5AWW4mLC{-mmmB*sXw0{#v}97rI$0K+Q3{=do??z4t+`D!E{m^N>7%?7Z(hV*Q2@| zj?~-aC$hG8K*pw0y3*O9*VonR=g!t^Ey1AHc}3RSTSNN!x>`dHHQ}dyFYtOMM^^T7 zL=XfOYMiz78`+$B|G`6itG9<%Gfzn3p)k1xcW1jotpo?JM(QR zGqtdoom<*aL2q)1O+D`GH@>d#m@D9E-3w|nf9&p)rC-+m4=m0)b2U>aV;MNV-%ngF z=Y+euTK9O|x**gTexDECrN;2O-Pr4{#*!!ypCnSBB$z^t7fXVGp>8ZmqV94!4*&K4 PM2|Iwq4aNXOhSJHAuysW literal 0 HcmV?d00001 diff --git a/src/win/icons/cassette_active.ico b/src/win/icons/cassette_active.ico new file mode 100644 index 0000000000000000000000000000000000000000..831d4545f301566ee5833c19d013011709d82090 GIT binary patch literal 1150 zcmd6l%TE(Q9LJ{#4MYRsq_OO7-|TMrBa}oC3`xO6ZAw8}L?{#vUNi{CN0exyhKt4+ zNYLOxi9*zBGzENwf};pzZALjMEZ1cxpU3o6qk49^dcoZ!!SL$d#TB z$Xx}hk^tBR0N@BDMKW7?@&Nlt?Vnc*D3T4x2IU_4W~wW7g1f}kB7n-I<8Jfm4MPZs|@SY3?(~L46GYomBGBCJDv`+w* zJLNdVnSzs^CB@_9JIRQl6p$f3abi9+@gZJHqK!e3TFRAVta+-z1@3}v6kQ6uvtfs% zVkqf|$%IO6HtB@jE>_y@QnkZ@s%ss{QCBC{)Ho)m)`B<@ccZ8v+ zh0d2Q*wWs)-gNyz(Ao1Q`25p=@X+IeJ!76o*KlvtInp0J(|s9U^V~pfV|Q`W;8oP@ zZjp3)U0AJDdb|4v(d^0^dN<@1?3EQlUQV`fV1Hh;#B7dM9=8hR$1K9ZoNUo*F~R#C zkKmjyfTmXhh-KL@nek&xKkpAn%{OnsvyBb-P*EX1TyzvyRaD>$jrI6^!)a_UFU6-$ z)?%B@D$e?YXo~0!23{olJL+$gCj#l-UcUjmX~>QM literal 0 HcmV?d00001 diff --git a/src/win/icons/cassette_empty.ico b/src/win/icons/cassette_empty.ico new file mode 100644 index 0000000000000000000000000000000000000000..467ff3548c5c71e9199f6a4908eccb6e3ad58f2f GIT binary patch literal 1150 zcmds0&rcIU6kZem08XC07}~ha?lvt=%Qn0HGfXrR<6#SlHf?Fy?Y?=lZ6WcZ5lr;p z&3NHtVxk9$fdh@E5C~Q+ib#|n<(E)e3ZClQ<-*ac&gR=U^L_7qGjEa+gbVcb^a%97 zEEpFB;gTQ-J_1q1obeO{owWaL$g(t~$TF8DiOaIWuLcw@D?x9qC^VM>Tn>ob*L#Kg zdwtyR_i-r@Ac$O&0$D{8L7^NEu8&MU`uU*_9g1d|k9F-)c}<^YKMbCqgwlnjl&i$*1s?Z zfeqZa#%^98fZ=o+&^B2ipJlg*GqWjpJ@pp0n{C`WY@@2GHuacv>vxXY_DF?qjI>;S=t)I&pJ!Rd$+0Y98HTVdM=q3dgyjsGoa5*-Q%b-y zs_h4gc0jA-4&*91uX8fFu1j~wF?z_+nGC8AOMR%9fofG4+S7IFwu)XADOF=tCltOc zR8F^_ik5K?&44MsvR9F54s^Am7nVH!H#);({ZydCeJ>;4@G z2V=hBmL9XkEE^35F*H4gV>=1_De@KhF+??2FQaQ$YG8xg4Y4dCUy}!2r!~prf^P;t zz_r~ZUfoGzp66w{M~A9k-%H}2-d=dWvx7Km9pq-Mix3FO!_Ir;LC0O<_cf9`w}Qm$ zl~8PNAFoioAlMK+UuWpcERH8q@cT*(lGXqc9S&IUk&vgM5lYR?vLrRjqA1GldN&-M zn1UOLLloQH$5yKqGJ3r@{&@zkB~o}Jd4SfF2RNQQfbspq44bK6UWzZaz1I|p{%n~4 zu}tGq)57w)O!b&$^kVvpv6=UZB`x&HY*WqJmxDb(8lwS?i<={R%9$Qc(eL{ V|KlNLSWy&m1OSSX4Rrcs{Q-Q`p7#I% literal 0 HcmV?d00001 diff --git a/src/win/icons/floppy_and_cdrom_drives.ico b/src/win/icons/floppy_and_cdrom_drives.ico new file mode 100644 index 0000000000000000000000000000000000000000..8fcec1a885a3281b36f7a1c3cc81b5ad73e492b9 GIT binary patch literal 1150 zcma)*ZERXq7{~9TiC;;U?AsFkVB$v?mzXSS>dQ=Aby;I{iE-9 zuE-$ZbOZ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$Y(!gB+AO6A z2?;78AV@4hED4FSh@b|j)cjNe!Xg1#N(c#%rH+b2t43}?#1)lK@0gHJKA6#c@6DMx z_r7!QeZw&C(Yk?hWGBz!3UxUPW(j7k)T$FxS+49HBrpBC3pNEDA{!vY}uA zWo9GZdgY$uWXFGKyYx4zye^FgRgod^+`rpAZWv0|Vt&Cv&&BTCPZ!%T{b&fYvuVss zjbUbD2rn}!JWY+jVY7f|eUQa4WJ%0(mq@#>x(dckhQ;ltCLiOs$uUe%jw6+tLOMN*netUcPvS+^c^G%Pr#C;@RAvsB}2MhghhR2qDbF z@2f_Itqcd6ny~-SL7Z(n2leZA$U*>(Q41Pkc6<|Ypz%uuyePx#@qiBo5vKS8FMwlN zs-FudTU)WSu^xTD{EXV~$FZ@{fR%-(uui`hAAWok{taf7>sO%4=SPU*Q|`%!kk=6+ z4bkLw?B3IWVI{)E zMUudC6q9PF@kBwZA>lF^^`zDl0!Mk_SV)u~J`_Yvl?Q=pFIZm<3H>ZM+t-h(b7zfWHPFPbKwfW&T{)ZB{s44s7$f!3O>0BY;>;#r9+ZyXxxZ>+0&U z^Q$jVUS0;XaWhVL^`QH5AKH2@p_Q!t!ez8{|A>y>zWj4kkx>8bE_~P6@PdwTfyrdr zmrN$6Y*uS#U1@RVTu0aZna=KPbIbW`^V#<7(PO7GM~*jV&YbVev~>2&IqbInHEVRc NiM!&>f8br`{{bKJbZGzp diff --git a/src/win/icons/mo_active.ico b/src/win/icons/mo_active.ico index 26ffaa6259ec10401c594757f82f67c88abe406c..3512b20abed50c7ec2e5656e3be13c69634b03db 100644 GIT binary patch literal 1150 zcma)*>rY!{9LEoakvX$v2{AnV%B{wPPco}?$L-Ocr~Xj+My%`A%^i(V%yekV&FC-W{RZ@OH} z3GItFQShyVboXB#`Ko}*vz0>`(K}aXOjm>80e-ex%#N z`w#~%AGos`4*xXK(aE%}gEx9RIp^vUY9VViGhwli5=a}u`=P|1ojvT`*-PPeVSZe6 zsp#IU+x>A!ttO^#BW2P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~N3E9_rm5`2DQ5_T<4sBp*M`Ar#w>jw5Y2*L4Ov ztp`wEx*0Ch2DmE=U^f-OW!?yjQI7z{)N~wq2)yPIptc`Ez)wDnlusi>k%g)V2uEZ@ zA__ub1!_=*s?r=Ztw0_WpCc{5(pF@NbXq<?2OphREw)JdXf%RYG>WE36T(4- zcn)4qBb?5?sCVtn+zYFv5_U%o_POf7`aI;}ML4Wte=LeaEiFqeEv;yN|6Np9SHWz2 z3m2{qVPIq&y+dChLFgMCLC?T7T)94;>4y{vtsfo2;r6y?bcG8{CeyK4EIMzgtW0e$ zFHK##a&;-*KalS3xt#94*q81+cOmu3XWgmz<^EJp|IlwWR?E$;TlF2J&3pMD_`mf( D=5tpL diff --git a/src/win/icons/mo_disabled.ico b/src/win/icons/mo_disabled.ico index 08f66d4f7999b10fc2faed1f1eae621bb25f7daa..7cb3b6fcfd85286b3bd459d06f3f5d6a42626de3 100644 GIT binary patch literal 1150 zcma)4>rb0i9DbL$Y#&Uv#6*q8fNs;7xQrRO%^8TLt_9L&9i?jv?c35&dcR-Z-rlFT zw=J}_tx&cV%b>HmEMyT07*G?kFg_T~Ak56pzkv_?CST@h^^@^~@5ytXbAIPMzuS2! z>KGZPPg7)Wr>0(_s8=b9I!{1M#PYYD5YEx!ZXE-TlM%Hy$=$ayIMA2kG z&S*rI;QYDAhjSJWS75(hz1-XQbB1}aT4!@;YkT^v;&#(vg#t->99bQWS(65Fvet>k z&4_oGDUV28wCD;kV2i$w59rC@HzkkV<9w_2eR z3_?frYQoY_iq)=Fq3*VR}H#o+z5rU`5b5y{>X8sqlN0dB z!9)%ofT7!wJ^NX*X+G@Pr{>$O1mp2={3-MO}8JQgNPY0mj@gXDpZ7P8@$-z1z zf#tdc4(SLo8X7B%A6*wdz}YiraPI7TQ1tUao{wUclj$&rK%y$bB=fANC;uELV95(^`Bb zlc6vqhOJ+KltPIOF8+@`8rsfhQ40i7v{(@%vAr}6E1yR&0GoghMx#S*RF0BNf$W$H zKTM~v&L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Y<4)6N(9wv@Xu?IGn-IxyP=nj!A$%HqSA$d9r_DeZ2Z``i+o@H=i%aE zd1}@Gy;KI1d>p2+acsvIkei=FP^(3NA4+sj~De^9+?n_EEhp46vi47@LiaKVqh5Zp{Fq1-w$D0-SJ-za`B4OiI=@z zYz6~($-^RIG9jRzK*XSjZ$gQHfk8oa0q$WbR0B_7Y~XRMk-JICr>>`yvF%tC8-WlS zfgoORIKYwhPRR&7<1)C;OAupBxT4XZI<5jcB14YW;bu1Vk3X@nS1F+xiK6CmBT4oS zF$~;N31JkhObXs;Msr$=x`sw+MvwOvb7*DL9e;dA7yYnW!v2d@G-DA`GwDTc5xHU& z`BDw}at#sIj|@5gy32`Mg$(v;MF={bK+31yzqrirFIDl$N)3DU3R;x{^4UC6sVvfj zOqR^UQC#IC__$WVXBX?(tCn%KSctd%Zx#x=uij}*fB(U*_uJi@u3KA|Jn2+gNGB3V q#^Oi{fWSxMyu-%x27N4K&@W7mN}>%eWbY|DYZJAN&O#Pw5i? literal 1150 zcmbVMTTc^d7#<8J8e?KMMmHpy)x>0fi}B72FU)4W*lfHYFOECbWXTkwJi1vIEX(>P_7Cs>z}zS9|8O93 zpel)iIS}ecN84q5+2ofV&t;xHE?{+K5!LDkG;owV!B|^|wp!bUwpoovW6j&W<#I-2w*>rmgJ6@_|_a2#CM zJL>A9n|dEI!zx5sMK~0K7>z=fL`b3pAr_xDiQ=eu0qo_Xd3lkb7hJ_`96tCSW9!RAT~hT_r!A2lZgzDK6Y!dlx>h2Z3N82FQ*PSBUY5 z$2ANYNtmhBXeyP)$jA-!^mK!D{fU`k33E@&D3qQePq1Zf?g?g}lxwz5eWp_;kVy~I z6W;4~yMHr`WYp{N7+2a`jofT;G+UfAr*nC8I$JO&CTEO?Q`1H^Uo>*XQlii2WiMTF O{7T&2|NRHPSAGRBu)u%- diff --git a/src/win/icons/other_removable_devices.ico b/src/win/icons/other_removable_devices.ico index ff389b15cfdfa36ec6c6741abefe3ef0a2db0d4f..0f40fef8518ab7d693a174dadd3ab6b6de3f76a7 100644 GIT binary patch delta 498 zcmeyz@sDGI7Lx29Cz3MWxgK&C!b<8;V$s<{vBpv z`9Idqb}}cEDR+XM!+%$O!~bpuMw2~({8(H2|1SClAUwGf$j|ri{1@lw_&?pvb@E9j zQ~u7V=s#5{jUeQvDMG-|AMUa|3J0>7*Ihy!>ruwuiI-Y{;w%7{y!l- z<$r#D;s4ycqW^gXCI7P%QvUY>4P0H6_kVL$>Hog8ls~BY85ow;*6csIV9uG73+Fyw z*VFkVCp+g~c1Gs^tn|$P8A-{1a)N`t6a@JFjCFPXULO_t1XaHi1H%J`|Nmi_0mvo_ J^8?jEF#tKb;y3^R delta 441 zcmeyz@sDGI78e5x1A`DZ2v0N=o9MMgfB_0-&YZ~_7aQ|;G9RM>KS*rDh7G)@PMr!* zh)Ec^M7eU;s3bU z*#FKBcK>HDTJnFv$~FJzEME41=Da2Ur_EXLcfqpNUm9B49{G5=uMPo@J9^~*`SYj$zkU1S|DQj<{=a|!>fiP27oQwGd>{$rOIVNq zX+sd3@#Ml;YFlS5n7eD^_Rq(UAOC;y#EJjs&Yk}M;`zh>zkmPw_vzEehxhK?%sqVg zu;4^PaaG3sn>L96Ibp!?+X=+)&z(E_>+ap_51&7OHtX))yQXK(oZ*^iC?fa(XgUlZ Y0J0k<8cI%d;NoEbxd9jp4e|^O0A+XSW&i*H diff --git a/src/win/win_media_menu.c b/src/win/win_media_menu.c index 6340d36b4..cb3994a19 100644 --- a/src/win/win_media_menu.c +++ b/src/win/win_media_menu.c @@ -477,7 +477,7 @@ media_menu_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; case IDM_MO_IMAGE_NEW: - NewFloppyDialogCreate(hwnd, id | 0x80, 0); /* NewZIPDialogCreate */ + NewFloppyDialogCreate(hwnd, id | 0x100, 0); /* NewZIPDialogCreate */ break; case IDM_MO_IMAGE_EXISTING_WP: diff --git a/src/win/win_new_floppy.c b/src/win/win_new_floppy.c index 33c83299f..f09d0d6f2 100644 --- a/src/win/win_new_floppy.c +++ b/src/win/win_new_floppy.c @@ -30,6 +30,7 @@ #include <86box/random.h> #include <86box/ui.h> #include <86box/scsi_device.h> +#include <86box/mo.h> #include <86box/zip.h> #include <86box/win.h> @@ -173,6 +174,7 @@ create_86f(WCHAR *file_name, disk_size_t disk_size, uint8_t rpm_mode) static int is_zip; +static int is_mo; static int @@ -204,7 +206,7 @@ create_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_fdi) fat2_offs = fat1_offs + fat_size; zero_bytes = fat2_offs + fat_size + root_dir_bytes; - if (!is_zip && is_fdi) { + if (!is_zip && !is_mo && is_fdi) { empty = (unsigned char *) malloc(base); memset(empty, 0, base); @@ -222,7 +224,7 @@ create_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_fdi) empty = (unsigned char *) malloc(total_size); memset(empty, 0x00, zero_bytes); - if (!is_zip) { + if (!is_zip && !is_mo) { memset(empty + zero_bytes, 0xF6, total_size - zero_bytes); empty[0x00] = 0xEB; /* Jump to make MS-DOS happy. */ @@ -352,10 +354,21 @@ create_zip_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_zdi, fwrite(empty, 1, 2048, f); SendMessage(h, PBM_SETPOS, (WPARAM) 1, (LPARAM) 0); + while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + fwrite(&empty[0x0800], 1, 2048, f); free(empty); SendMessage(h, PBM_SETPOS, (WPARAM) 2, (LPARAM) 0); + + while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + pbar_max -= 2; } @@ -507,6 +520,106 @@ create_zip_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_zdi, } +static int +create_mo_sector_image(WCHAR *file_name, int8_t disk_size, uint8_t is_mdi, HWND hwnd) +{ + HWND h; + FILE *f; + const mo_type_t *dp = &mo_types[disk_size]; + uint8_t *empty; + uint32_t total_size = 0; + uint32_t total_sectors = 0; + uint32_t sector_bytes = 0; + uint16_t base = 0x1000; + uint32_t pbar_max = 0; + uint32_t i; + MSG msg; + + f = plat_fopen(file_name, L"wb"); + if (!f) + return 0; + + sector_bytes = dp->bytes_per_sector; + total_sectors = dp->sectors; + total_size = total_sectors * sector_bytes; + + pbar_max = dp->sectors >> 11; + if (is_mdi) + pbar_max += base; + pbar_max >>= 11; + pbar_max--; + + h = GetDlgItem(hwnd, IDC_COMBO_RPM_MODE); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + h = GetDlgItem(hwnd, IDT_1751); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + h = GetDlgItem(hwnd, IDC_PBAR_IMG_CREATE); + SendMessage(h, PBM_SETRANGE32, (WPARAM) 0, (LPARAM) pbar_max); + SendMessage(h, PBM_SETPOS, (WPARAM) 0, (LPARAM) 0); + EnableWindow(h, TRUE); + ShowWindow(h, SW_SHOW); + h = GetDlgItem(hwnd, IDT_1757); + EnableWindow(h, TRUE); + ShowWindow(h, SW_SHOW); + + h = GetDlgItem(hwnd, IDC_PBAR_IMG_CREATE); + pbar_max++; + + if (is_mdi) { + empty = (unsigned char *) malloc(base); + memset(empty, 0, base); + + *(uint32_t *) &(empty[0x08]) = (uint32_t) base; + *(uint32_t *) &(empty[0x0C]) = total_size; + *(uint16_t *) &(empty[0x10]) = (uint16_t) sector_bytes; + *(uint8_t *) &(empty[0x14]) = (uint8_t) 25; + *(uint8_t *) &(empty[0x18]) = (uint8_t) 64; + *(uint8_t *) &(empty[0x1C]) = (uint8_t) (dp->sectors / 64) / 25; + + fwrite(empty, 1, 2048, f); + SendMessage(h, PBM_SETPOS, (WPARAM) 1, (LPARAM) 0); + + while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + fwrite(&empty[0x0800], 1, 2048, f); + free(empty); + + SendMessage(h, PBM_SETPOS, (WPARAM) 2, (LPARAM) 0); + + while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + pbar_max -= 2; + } + + empty = (unsigned char *) malloc(total_size); + memset(empty, 0x00, total_size); + + for (i = 0; i < pbar_max; i++) { + fwrite(&empty[i << 11], 1, 2048, f); + SendMessage(h, PBM_SETPOS, (WPARAM) i + 2, (LPARAM) 0); + + while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + free(empty); + + fclose(f); + + return 1; +} + + static int fdd_id, sb_part; static int file_type = 0; /* 0 = IMG, 1 = Japanese FDI, 2 = 86F */ @@ -562,7 +675,7 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) uint8_t disk_size, rpm_mode; int ret; FILE *f; - int zip_types; + int zip_types, mo_types; wchar_t *twcs; switch (message) { @@ -574,6 +687,11 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) zip_types = zip_drives[fdd_id].is_250 ? 2 : 1; for (i = 0; i < zip_types; i++) SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_5900 + i)); + } else if (is_mo) { + mo_types = 10; + /* TODO: Proper string ID's. */ + for (i = 0; i < mo_types; i++) + SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_5902 + i)); } else { for (i = 0; i < 12; i++) SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_5888 + i)); @@ -606,22 +724,24 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) disk_size = SendMessage(h, CB_GETCURSEL, 0, 0); if (is_zip) disk_size += 12; - if (file_type == 2) { + if (!is_zip && !is_mo && (file_type == 2)) { h = GetDlgItem(hdlg, IDC_COMBO_RPM_MODE); rpm_mode = SendMessage(h, CB_GETCURSEL, 0, 0); ret = create_86f(fd_file_name, disk_sizes[disk_size], rpm_mode); } else { if (is_zip) ret = create_zip_sector_image(fd_file_name, disk_sizes[disk_size], file_type, hdlg); + if (is_mo) + ret = create_mo_sector_image(fd_file_name, disk_size, file_type, hdlg); else ret = create_sector_image(fd_file_name, disk_sizes[disk_size], file_type); } if (ret) { if (is_zip) - //ui_sb_mount_zip_img(fdd_id, sb_part, 0, fd_file_name); zip_mount(fdd_id, fd_file_name, 0); + else if (is_mo) + mo_mount(fdd_id, fd_file_name, 0); else - //ui_sb_mount_floppy_img(fdd_id, sb_part, 0, fd_file_name); floppy_mount(fdd_id, fd_file_name, 0); } else { new_floppy_msgbox_header(hdlg, MBX_ERROR, (wchar_t *) IDS_4108, (wchar_t *) IDS_4115); @@ -639,7 +759,7 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) if (wcslen(wopenfilestring) && (wcslen(wopenfilestring) <= 256)) { twcs = &wopenfilestring[wcslen(wopenfilestring)]; twcs[0] = L'.'; - if (!is_zip && (filterindex == 3)) { + if (!is_zip && !is_mo && (filterindex == 3)) { twcs[1] = L'8'; twcs[2] = L'6'; twcs[3] = L'f'; @@ -671,6 +791,11 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) file_type = 1; else file_type = 0; + } else if (is_mo) { + if (((wcs_len >= 4) && !wcsicmp(ext, L".MDI"))) + file_type = 1; + else + file_type = 0; } else { if (((wcs_len >= 4) && !wcsicmp(ext, L".FDI"))) file_type = 1; @@ -717,5 +842,10 @@ NewFloppyDialogCreate(HWND hwnd, int id, int part) fdd_id = id & 0x7f; sb_part = part; is_zip = !!(id & 0x80); + is_mo = !!(id & 0x100); + if (is_zip && is_mo) { + fatal("Attempting to create a new image dialog that is for both ZIP and MO at the same time\n"); + return; + } DialogBox(hinstance, (LPCTSTR)DLG_NEW_FLOPPY, hwnd, NewFloppyDialogProcedure); } diff --git a/src/win/win_settings.c b/src/win/win_settings.c index f13cc4f29..ebf20dbd3 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -322,13 +322,13 @@ win_settings_init(void) 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)); } - 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)); - } + 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)); + } temp_deviceconfig = 0; } @@ -411,7 +411,7 @@ win_settings_changed(void) /* Other removable devices category */ i = i || memcmp(cdrom, temp_cdrom, CDROM_NUM * sizeof(cdrom_t)); i = i || memcmp(zip_drives, temp_zip_drives, ZIP_NUM * sizeof(zip_drive_t)); - i = i || memcmp(mo_drives, temp_mo_drives, MO_NUM * sizeof(mo_drive_t)); + i = i || memcmp(mo_drives, temp_mo_drives, MO_NUM * sizeof(mo_drive_t)); i = i || !!temp_deviceconfig; @@ -540,7 +540,7 @@ win_settings_save(void) zip_drives[i].f = NULL; zip_drives[i].priv = NULL; } - memcpy(mo_drives, temp_mo_drives, MO_NUM * sizeof(mo_drive_t)); + memcpy(mo_drives, temp_mo_drives, MO_NUM * sizeof(mo_drive_t)); for (i = 0; i < MO_NUM; i++) { mo_drives[i].f = NULL; mo_drives[i].priv = NULL; @@ -3518,7 +3518,7 @@ win_settings_hard_disks_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPar { HWND h = NULL; int old_sel = 0, b = 0, assign = 0; - const uint8_t hd_icons[2] = { 64, 0 }; + const uint8_t hd_icons[2] = { 80, 0 }; switch (message) { case WM_INITDIALOG: @@ -3754,7 +3754,7 @@ win_settings_cdrom_drives_recalc_list(HWND hwndList) WCHAR szText[256]; lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; - lvI.stateMask = lvI.iSubItem = lvI.state = 0; + lvI.stateMask = lvI.iSubItem = lvI.state = 0; for (i = 0; i < 4; i++) { fsid = combo_id_to_format_string_id(temp_cdrom[i].bus_type); @@ -4007,6 +4007,7 @@ win_settings_mo_drives_init_columns(HWND hwndList) return TRUE; } + static BOOL win_settings_zip_drives_init_columns(HWND hwndList) { @@ -4150,6 +4151,7 @@ win_settings_cdrom_drives_update_item(HWND hwndList, int i) return; } + static void win_settings_mo_drives_update_item(HWND hwndList, int i) { @@ -4296,7 +4298,7 @@ static void cdrom_recalc_location_controls(HWND hdlg, int assign_id) int i = 0; HWND h; - int bus = temp_cdrom[lv1_current_sel].bus_type; + int bus = temp_cdrom[lv2_current_sel].bus_type; for (i = IDT_1741; i < (IDT_1742 + 1); i++) { h = GetDlgItem(hdlg, i); @@ -4319,7 +4321,7 @@ static void cdrom_recalc_location_controls(HWND hdlg, int assign_id) } else { ShowWindow(h, SW_SHOW); EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, temp_cdrom[lv1_current_sel].speed - 1, 0); + SendMessage(h, CB_SETCURSEL, temp_cdrom[lv2_current_sel].speed - 1, 0); } h = GetDlgItem(hdlg, IDT_1758); @@ -4338,12 +4340,12 @@ static void cdrom_recalc_location_controls(HWND hdlg, int assign_id) EnableWindow(h, TRUE); if (assign_id) - temp_cdrom[lv1_current_sel].ide_channel = next_free_ide_channel(); + temp_cdrom[lv2_current_sel].ide_channel = next_free_ide_channel(); h = GetDlgItem(hdlg, IDC_COMBO_CD_CHANNEL_IDE); ShowWindow(h, SW_SHOW); EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, temp_cdrom[lv1_current_sel].ide_channel, 0); + SendMessage(h, CB_SETCURSEL, temp_cdrom[lv2_current_sel].ide_channel, 0); break; case CDROM_BUS_SCSI: /* SCSI */ h = GetDlgItem(hdlg, IDT_1741); @@ -4351,12 +4353,12 @@ static void cdrom_recalc_location_controls(HWND hdlg, int assign_id) EnableWindow(h, TRUE); if (assign_id) - next_free_scsi_id((uint8_t *) &temp_cdrom[lv1_current_sel].scsi_device_id); + next_free_scsi_id((uint8_t *) &temp_cdrom[lv2_current_sel].scsi_device_id); h = GetDlgItem(hdlg, IDC_COMBO_CD_ID); ShowWindow(h, SW_SHOW); EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, temp_cdrom[lv1_current_sel].scsi_device_id, 0); + SendMessage(h, CB_SETCURSEL, temp_cdrom[lv2_current_sel].scsi_device_id, 0); break; } } @@ -4364,15 +4366,15 @@ static void cdrom_recalc_location_controls(HWND hdlg, int assign_id) static void mo_add_locations(HWND hdlg) { - LPTSTR lptsTemp; - char *temp; + LPTSTR lptsTemp; + char *temp; HWND h; int i = 0; - lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); - temp = (char*) malloc(30*sizeof(char)); + lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); + temp = (char*) malloc(30*sizeof(char)); - h = GetDlgItem(hdlg, IDC_COMBO_MO_BUS); + h = GetDlgItem(hdlg, IDC_COMBO_MO_BUS); 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))); @@ -4390,21 +4392,21 @@ mo_add_locations(HWND hdlg) SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); } - 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); + 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); - } + mbstowcs(lptsTemp, temp, strlen(temp)+1); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + } - free(temp); - free(lptsTemp); + free(temp); + free(lptsTemp); } @@ -4639,12 +4641,14 @@ static LRESULT CALLBACK #else static BOOL CALLBACK #endif -win_settings_floppy_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) +win_settings_floppy_and_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { HWND h = NULL; - int i = 0, old_sel = 0; + int i = 0, old_sel = 0, b = 0, assign = 0; + uint32_t b2 = 0; WCHAR szText[256]; const uint8_t fd_icons[15] = { 248, 16, 16, 16, 16, 16, 16, 24, 24, 24, 24, 24, 24, 24, 0 }; + const uint8_t cd_icons[3] = { 249, 32, 0 }; switch (message) { case WM_INITDIALOG: @@ -4673,6 +4677,33 @@ win_settings_floppy_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM l h = GetDlgItem(hdlg, IDC_CHECKBPB); SendMessage(h, BM_SETCHECK, temp_fdd_check_bpb[lv1_current_sel], 0); + lv2_current_sel = 0; + 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); + + switch (temp_cdrom[lv2_current_sel].bus_type) { + 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); + ignore_change = 0; return TRUE; @@ -4700,6 +4731,39 @@ win_settings_floppy_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM l 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; + + h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS); + + switch (temp_cdrom[lv2_current_sel].bus_type) { + 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; @@ -4729,109 +4793,7 @@ win_settings_floppy_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM l h = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES); win_settings_floppy_drives_update_item(h, lv1_current_sel); break; - } - ignore_change = 0; - default: - return FALSE; - } - - return FALSE; -} - - -#if defined(__amd64__) || defined(__aarch64__) -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif -win_settings_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - HWND h = NULL; - int old_sel = 0, b = 0, assign = 0; - uint32_t b2 = 0; - const uint8_t cd_icons[3] = { 249, 32, 0 }; - - switch (message) { - case WM_INITDIALOG: - ignore_change = 1; - - lv1_current_sel = 0; - 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); - - switch (temp_cdrom[lv1_current_sel].bus_type) { - 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); - - ignore_change = 0; - return TRUE; - - case WM_NOTIFY: - if (ignore_change) - return FALSE; - - if ((((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) && (((LPNMHDR)lParam)->idFrom == IDC_LIST_CDROM_DRIVES)) { - old_sel = lv1_current_sel; - lv1_current_sel = get_selected_drive(hdlg, IDC_LIST_CDROM_DRIVES); - 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_CD_BUS); - - switch (temp_cdrom[lv1_current_sel].bus_type) { - 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; - switch (LOWORD(wParam)) { case IDC_COMBO_CD_BUS: h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS); b = SendMessage(h, CB_GETCURSEL, 0, 0); @@ -4846,42 +4808,42 @@ win_settings_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP b2 = CDROM_BUS_SCSI; break; } - if (b2 == temp_cdrom[lv1_current_sel].bus_type) + if (b2 == temp_cdrom[lv2_current_sel].bus_type) break; - cdrom_untrack(lv1_current_sel); - assign = (temp_cdrom[lv1_current_sel].bus_type == b2) ? 0 : 1; - if (temp_cdrom[lv1_current_sel].bus_type == CDROM_BUS_DISABLED) - temp_cdrom[lv1_current_sel].speed = 8; - temp_cdrom[lv1_current_sel].bus_type = b2; + 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; cdrom_recalc_location_controls(hdlg, assign); - cdrom_track(lv1_current_sel); + cdrom_track(lv2_current_sel); h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); - win_settings_cdrom_drives_update_item(h, lv1_current_sel); + win_settings_cdrom_drives_update_item(h, lv2_current_sel); break; case IDC_COMBO_CD_ID: h = GetDlgItem(hdlg, IDC_COMBO_CD_ID); - cdrom_untrack(lv1_current_sel); - temp_cdrom[lv1_current_sel].scsi_device_id = SendMessage(h, CB_GETCURSEL, 0, 0); - cdrom_track(lv1_current_sel); + cdrom_untrack(lv2_current_sel); + temp_cdrom[lv2_current_sel].scsi_device_id = SendMessage(h, CB_GETCURSEL, 0, 0); + cdrom_track(lv2_current_sel); h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); - win_settings_cdrom_drives_update_item(h, lv1_current_sel); + win_settings_cdrom_drives_update_item(h, lv2_current_sel); break; case IDC_COMBO_CD_CHANNEL_IDE: h = GetDlgItem(hdlg, IDC_COMBO_CD_CHANNEL_IDE); - cdrom_untrack(lv1_current_sel); - temp_cdrom[lv1_current_sel].ide_channel = SendMessage(h, CB_GETCURSEL, 0, 0); - cdrom_track(lv1_current_sel); + cdrom_untrack(lv2_current_sel); + temp_cdrom[lv2_current_sel].ide_channel = SendMessage(h, CB_GETCURSEL, 0, 0); + cdrom_track(lv2_current_sel); h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); - win_settings_cdrom_drives_update_item(h, lv1_current_sel); + win_settings_cdrom_drives_update_item(h, lv2_current_sel); break; case IDC_COMBO_CD_SPEED: h = GetDlgItem(hdlg, IDC_COMBO_CD_SPEED); - temp_cdrom[lv1_current_sel].speed = SendMessage(h, CB_GETCURSEL, 0, 0) + 1; + temp_cdrom[lv2_current_sel].speed = SendMessage(h, CB_GETCURSEL, 0, 0) + 1; h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); - win_settings_cdrom_drives_update_item(h, lv1_current_sel); + win_settings_cdrom_drives_update_item(h, lv2_current_sel); break; } ignore_change = 0; @@ -4893,6 +4855,7 @@ win_settings_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP return FALSE; } + #if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else @@ -4903,7 +4866,7 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam HWND h = NULL; int old_sel = 0, b = 0, assign = 0; uint32_t b2 = 0; - const uint8_t mo_icons[3] = { 251, 56, 0 }; + const uint8_t mo_icons[3] = { 251, 56, 0 }; const uint8_t zip_icons[3] = { 250, 48, 0 }; switch (message) { @@ -5195,11 +5158,8 @@ void win_settings_show_child(HWND hwndParent, DWORD child_id) case SETTINGS_PAGE_HARD_DISKS: hwndChildDialog = CreateDialog(hinstance, (LPCWSTR)DLG_CFG_HARD_DISKS, hwndParent, win_settings_hard_disks_proc); break; - case SETTINGS_PAGE_FLOPPY_DRIVES: - hwndChildDialog = CreateDialog(hinstance, (LPCWSTR)DLG_CFG_FLOPPY_DRIVES, hwndParent, win_settings_floppy_drives_proc); - break; - case SETTINGS_PAGE_CDROM_DRIVES: - hwndChildDialog = CreateDialog(hinstance, (LPCWSTR)DLG_CFG_CDROM_DRIVES, hwndParent, win_settings_cdrom_drives_proc); + 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); break; case SETTINGS_PAGE_OTHER_REMOVABLE_DEVICES: hwndChildDialog = CreateDialog(hinstance, (LPCWSTR)DLG_CFG_OTHER_REMOVABLE_DEVICES, hwndParent, win_settings_other_removable_devices_proc); @@ -5222,13 +5182,8 @@ win_settings_main_insert_categories(HWND hwndList) lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; lvI.stateMask = lvI.iSubItem = lvI.state = 0; - for (i = 0; i < 11; i++) { - if (i <= 8) - lvI.pszText = plat_get_string(IDS_2065+i); - else if (i == 9) - lvI.pszText = plat_get_string(IDS_2139); - else if (i == 10) - lvI.pszText = plat_get_string(IDS_2074); + for (i = 0; i < 10; i++) { + lvI.pszText = plat_get_string(IDS_2065+i); lvI.iItem = i; lvI.iImage = i; @@ -5275,7 +5230,7 @@ win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { HWND h = NULL; int category, i = 0, j = 0; - const uint8_t cat_icons[12] = { 240, 241, 242, 243, 80, 244, 245, 64, 246, 32, 247, 0 }; + const uint8_t cat_icons[12] = { 240, 241, 242, 243, 96, 244, 245, 80, 246, 247, 0 }; hwndParentDialog = hdlg; diff --git a/src/win/win_stbar.c b/src/win/win_stbar.c index afd47a384..67add30f1 100644 --- a/src/win/win_stbar.c +++ b/src/win/win_stbar.c @@ -259,6 +259,7 @@ StatusBarCreateZIPTip(int part) wcscpy(sbTips[part], tempTip); } + static void StatusBarCreateMOTip(int part) { @@ -287,6 +288,7 @@ StatusBarCreateMOTip(int part) wcscpy(sbTips[part], tempTip); } + static void StatusBarCreateDiskTip(int part) { @@ -677,12 +679,12 @@ ui_sb_update_panes(void) break; case SB_HDD: /* Hard disk */ - sb_part_icons[i] = 64; + sb_part_icons[i] = 80; StatusBarCreateDiskTip(i); break; case SB_NETWORK: /* Network */ - sb_part_icons[i] = 80; + sb_part_icons[i] = 96; StatusBarCreateNetworkTip(i); break; @@ -806,12 +808,14 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 48; i < 50; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); - for (i = 56; i < 58; i++) + for (i = 56; i < 58; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 64; i < 66; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 80; i < 82; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); + for (i = 96; i < 98; i++) + hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 144; i < 146; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 152; i < 154; i++) @@ -820,7 +824,9 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 176; i < 178; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); - for (i = 184; i < 186; i++) + for (i = 184; i < 186; i++) + hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); + for (i = 192; i < 194; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 243; i < 244; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);