PCem
changeset 112:c5989dbbc2ce
Reorganised Windows-specific code a bit.
| author | TomW |
|---|---|
| date | Tue Jun 24 21:15:42 2014 +0100 |
| parents | 912e602b3406 |
| children | f749363ad763 |
| files | src/Makefile.mingw src/device.c src/ibm.h src/pc.c src/pc.rc src/resources.h src/vid_svga.c src/win-config.c src/win-hdconf.c src/win-status.c src/win-timer.c src/win.c src/win.h |
| diffstat | 13 files changed, 963 insertions(+), 990 deletions(-) [+] |
line diff
1.1 --- a/src/Makefile.mingw Thu Jun 19 21:02:59 2014 +0100 1.2 +++ b/src/Makefile.mingw Tue Jun 24 21:15:42 2014 +0100 1.3 @@ -18,8 +18,9 @@ 1.4 vid_oti067.o vid_paradise.o vid_pc1512.o vid_pc1640.o vid_pc200.o vid_pcjr.o vid_s3.o \ 1.5 vid_s3_virge.o vid_sdac_ramdac.o vid_stg_ramdac.o vid_svga.o vid_svga_render.o \ 1.6 vid_tandy.o vid_tgui9440.o vid_tkd8001_ramdac.o vid_tvga.o vid_unk_ramdac.o vid_vga.o \ 1.7 - vid_voodoo.o video.o wd76c10.o win.o win-d3d.o win-d3d-fs.o win-ddraw.o win-ddraw-fs.o win-joystick.o win-keyboard.o win-midi.o \ 1.8 - win-mouse.o win-timer.o win-video.o x86seg.o x87.o xtide.o pc.res 1.9 + vid_voodoo.o video.o wd76c10.o win.o win-config.o win-d3d.o win-d3d-fs.o win-ddraw.o \ 1.10 + win-ddraw-fs.o win-hdconf.o win-joystick.o win-keyboard.o win-midi.o win-mouse.o \ 1.11 + win-status.o win-video.o x86seg.o x87.o xtide.o pc.res 1.12 FMOBJ = dbopl.o 1.13 SIDOBJ = convolve.o envelope.o extfilt.o filter.o pot.o sid.o voice.o wave6581__ST.o wave6581_P_T.o wave6581_PS_.o wave6581_PST.o wave8580__ST.o wave8580_P_T.o wave8580_PS_.o wave8580_PST.o wave.o 1.14
2.1 --- a/src/device.c Thu Jun 19 21:02:59 2014 +0100 2.2 +++ b/src/device.c Tue Jun 24 21:15:42 2014 +0100 2.3 @@ -90,7 +90,7 @@ 2.4 { 2.5 int c; 2.6 2.7 - s[0] = 0; 2.8 + s += strlen(s); 2.9 2.10 for (c = 0; c < 256; c++) 2.11 {
3.1 --- a/src/ibm.h Thu Jun 19 21:02:59 2014 +0100 3.2 +++ b/src/ibm.h Tue Jun 24 21:15:42 2014 +0100 3.3 @@ -317,6 +317,9 @@ 3.4 ROM_MAX 3.5 }; 3.6 3.7 +extern int romspresent[ROM_MAX]; 3.8 +extern int gfx_present[19]; 3.9 + 3.10 //#define ROM_IBMPCJR 5 /*Not working! ROMs are corrupt*/ 3.11 #define is386 (romset>=ROM_IBMAT386) 3.12 #define is386sx 0
4.1 --- a/src/pc.c Thu Jun 19 21:02:59 2014 +0100 4.2 +++ b/src/pc.c Tue Jun 24 21:15:42 2014 +0100 4.3 @@ -49,7 +49,7 @@ 4.4 4.5 int framecount,fps; 4.6 int intcount; 4.7 -int wakeups,wokeups; 4.8 + 4.9 int output; 4.10 int atfullspeed; 4.11 void loadconfig(); 4.12 @@ -93,7 +93,6 @@ 4.13 } 4.14 4.15 uint8_t cgastat; 4.16 -int drawit=0; 4.17 4.18 int pollmouse_delay = 2; 4.19 void pollmouse() 4.20 @@ -239,8 +238,6 @@ 4.21 pc_reset(); 4.22 4.23 pit_reset(); 4.24 - install_int_ex(onesec,BPS_TO_TIMER(1)); 4.25 -// install_int_ex(vsyncint,BPS_TO_TIMER(60)); 4.26 /* if (romset==ROM_AMI386 || romset==ROM_AMI486) */fullspeed(); 4.27 mem_updatecache(); 4.28 ali1429_reset(); 4.29 @@ -352,7 +349,6 @@ 4.30 cycles_lost = 0; 4.31 mmuflush=0; 4.32 intcount=0; 4.33 - wakeups=wokeups=0; 4.34 intcount=pitcount=0; 4.35 emu_fps = frames; 4.36 frames = 0; 4.37 @@ -365,16 +361,6 @@ 4.38 } 4.39 done++; 4.40 frame++; 4.41 -/* if ((at70hz && VGA)!=oldat70hz) 4.42 - { 4.43 - oldat70hz=(at70hz && VGA); 4.44 - if (oldat70hz) setrefresh(70); //install_int_ex(vsyncint,BPS_TO_TIMER(70)); 4.45 - else setrefresh(60); //install_int_ex(vsyncint,BPS_TO_TIMER(60)); 4.46 - drawit=0; 4.47 - done=0; 4.48 - }*/ 4.49 -// printf("End of run!\n"); 4.50 -// } 4.51 } 4.52 4.53 void fullspeed()
5.1 --- a/src/pc.rc Thu Jun 19 21:02:59 2014 +0100 5.2 +++ b/src/pc.rc Tue Jun 24 21:15:42 2014 +0100 5.3 @@ -87,32 +87,32 @@ 5.4 PUSHBUTTON "Cancel",IDCANCEL,101+12,152,50,14 5.5 5.6 LTEXT "C:",IDC_STATIC,7,6,27,10 5.7 - EDITTEXT IDC_EDITC, 7, 22, 136, 12, WS_DISABLED 5.8 + EDITTEXT IDC_EDIT_C_FN, 7, 22, 136, 12, WS_DISABLED 5.9 PUSHBUTTON "...",IDC_CFILE,7 + 136, 22, 16, 14 5.10 PUSHBUTTON "New",IDC_CNEW,7 + 136 + 16, 22, 24, 14 5.11 PUSHBUTTON "Eject", IDC_EJECTC, 7 + 136 + 16 + 24, 22, 24, 14 5.12 5.13 - EDITTEXT IDC_EDIT1,36,38,16,12, WS_DISABLED 5.14 - EDITTEXT IDC_EDIT2,94,38,16,12, WS_DISABLED 5.15 - EDITTEXT IDC_EDIT3,152,38,28,12, WS_DISABLED 5.16 + EDITTEXT IDC_EDIT_C_SPT,36,38,16,12, WS_DISABLED 5.17 + EDITTEXT IDC_EDIT_C_HPC,94,38,16,12, WS_DISABLED 5.18 + EDITTEXT IDC_EDIT_C_CYL,152,38,28,12, WS_DISABLED 5.19 LTEXT "Sectors:",IDC_STATIC,7,38,27,10 5.20 LTEXT "Heads:",IDC_STATIC,63,38,29,8 5.21 LTEXT "Cylinders:",IDC_STATIC,120,38,32,12 5.22 - LTEXT "", IDC_TEXT1, 7, 54, 136, 12 5.23 + LTEXT "", IDC_TEXT_C_SIZE, 7, 54, 136, 12 5.24 5.25 LTEXT "D:",IDC_STATIC,7,76,27,10 5.26 - EDITTEXT IDC_EDITD, 7, 92, 136, 12, WS_DISABLED 5.27 + EDITTEXT IDC_EDIT_D_FN, 7, 92, 136, 12, WS_DISABLED 5.28 PUSHBUTTON "...",IDC_DFILE,7 + 136, 92, 16, 14 5.29 PUSHBUTTON "New",IDC_DNEW,7 + 136 + 16, 92, 24, 14 5.30 PUSHBUTTON "Eject", IDC_EJECTD, 7 + 136 + 16 + 24, 92, 24, 14 5.31 5.32 - EDITTEXT IDC_EDIT4,36,108,16,12, WS_DISABLED 5.33 - EDITTEXT IDC_EDIT5,94,108,16,12, WS_DISABLED 5.34 - EDITTEXT IDC_EDIT6,152,108,28,12, WS_DISABLED 5.35 + EDITTEXT IDC_EDIT_D_SPT,36,108,16,12, WS_DISABLED 5.36 + EDITTEXT IDC_EDIT_D_HPC,94,108,16,12, WS_DISABLED 5.37 + EDITTEXT IDC_EDIT_D_CYL,152,108,28,12, WS_DISABLED 5.38 LTEXT "Sectors:",IDC_STATIC,7,108,27,10 5.39 LTEXT "Heads:",IDC_STATIC,63,108,29,8 5.40 LTEXT "Cylinders:",IDC_STATIC,120,108,32,12 5.41 - LTEXT "", IDC_TEXT2, 7, 124, 136, 12 5.42 + LTEXT "", IDC_TEXT_D_SIZE, 7, 124, 136, 12 5.43 5.44 END 5.45 5.46 @@ -160,13 +160,5 @@ 5.47 CAPTION "Status" 5.48 FONT 8, "MS Sans Serif" 5.49 BEGIN 5.50 - LTEXT "1",IDC_STEXT1,16,16,180,10 5.51 - LTEXT "2",IDC_STEXT2,16,28,180,10 5.52 - LTEXT "3",IDC_STEXT3,16,40,180,10 5.53 - LTEXT "4",IDC_STEXT4,16,52,180,10 5.54 - LTEXT "5",IDC_STEXT5,16,64,180,10 5.55 - LTEXT "6",IDC_STEXT6,16,76,180,10 5.56 - LTEXT "7",IDC_STEXT7,16,88,180,10 5.57 - LTEXT "8",IDC_STEXT8,16,100,180,10 5.58 - LTEXT "9",IDC_STEXT_DEVICE,16,112,180,1000 5.59 + LTEXT "1",IDC_STEXT_DEVICE,16,16,180,1000 5.60 END
6.1 --- a/src/resources.h Thu Jun 19 21:02:59 2014 +0100 6.2 +++ b/src/resources.h Tue Jun 24 21:15:42 2014 +0100 6.3 @@ -66,5 +66,16 @@ 6.4 #define IDC_STEXT8 1107 6.5 #define IDC_STEXT_DEVICE 1108 6.6 6.7 +#define IDC_EDIT_C_SPT 1200 6.8 +#define IDC_EDIT_C_HPC 1201 6.9 +#define IDC_EDIT_C_CYL 1202 6.10 +#define IDC_EDIT_D_SPT 1203 6.11 +#define IDC_EDIT_D_HPC 1204 6.12 +#define IDC_EDIT_D_CYL 1205 6.13 +#define IDC_TEXT_C_SIZE 1210 6.14 +#define IDC_TEXT_D_SIZE 1211 6.15 +#define IDC_EDIT_C_FN 1220 6.16 +#define IDC_EDIT_D_FN 1221 6.17 + 6.18 #define WM_RESETD3D WM_USER 6.19 #define WM_LEAVEFULLSCREEN WM_USER + 1
7.1 --- a/src/vid_svga.c Thu Jun 19 21:02:59 2014 +0100 7.2 +++ b/src/vid_svga.c Tue Jun 24 21:15:42 2014 +0100 7.3 @@ -1345,9 +1345,9 @@ 7.4 int cur_len = max_len; 7.5 int len; 7.6 7.7 - if (svga->chain4) len = snprintf(s, max_len, "SVGA chained (possibly mode 13h)\n"); 7.8 - else len = snprintf(s, max_len, "SVGA unchained (possibly mode-X)\n"); 7.9 - if (len < 0) return; 7.10 + if (svga->chain4) strcpy(temps, "SVGA chained (possibly mode 13h)\n"); 7.11 + else strcpy(temps, "SVGA unchained (possibly mode-X)\n"); 7.12 + strncat(s, temps, cur_len); 7.13 cur_len -= len; 7.14 7.15 if (!svga->video_bpp) strcpy(temps, "SVGA in text mode\n");
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/src/win-config.c Tue Jun 24 21:15:42 2014 +0100 8.3 @@ -0,0 +1,334 @@ 8.4 +#define BITMAP WINDOWS_BITMAP 8.5 +#include <windows.h> 8.6 +#include <windowsx.h> 8.7 +#undef BITMAP 8.8 + 8.9 +#include <commctrl.h> 8.10 + 8.11 +#include "ibm.h" 8.12 +#include "cpu.h" 8.13 +#include "model.h" 8.14 +#include "resources.h" 8.15 +#include "sound.h" 8.16 +#include "video.h" 8.17 +#include "win.h" 8.18 + 8.19 +extern int is486; 8.20 +static int romstolist[ROM_MAX], listtomodel[ROM_MAX], romstomodel[ROM_MAX], modeltolist[ROM_MAX]; 8.21 +static int settings_sound_to_list[20], settings_list_to_sound[20]; 8.22 + 8.23 +static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) 8.24 +{ 8.25 + char temp_str[256]; 8.26 + HWND h; 8.27 + int c, d; 8.28 + int rom, gfx, mem, fpu; 8.29 + int temp_cpu, temp_cpu_m, temp_model; 8.30 + int temp_GAMEBLASTER, temp_GUS, temp_SSI2001, temp_sound_card_current; 8.31 +// pclog("Dialog msg %i %08X\n",message,message); 8.32 + switch (message) 8.33 + { 8.34 + case WM_INITDIALOG: 8.35 + pause = 1; 8.36 + h = GetDlgItem(hdlg, IDC_COMBO1); 8.37 + for (c = 0; c < ROM_MAX; c++) 8.38 + romstolist[c] = 0; 8.39 + c = d = 0; 8.40 + while (models[c].id != -1) 8.41 + { 8.42 + pclog("INITDIALOG : %i %i %i\n",c,models[c].id,romspresent[models[c].id]); 8.43 + if (romspresent[models[c].id]) 8.44 + { 8.45 + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)models[c].name); 8.46 + modeltolist[c] = d; 8.47 + listtomodel[d] = c; 8.48 + romstolist[models[c].id] = d; 8.49 + romstomodel[models[c].id] = c; 8.50 + d++; 8.51 + } 8.52 + c++; 8.53 + } 8.54 + SendMessage(h, CB_SETCURSEL, modeltolist[model], 0); 8.55 + 8.56 + h = GetDlgItem(hdlg, IDC_COMBOVID); 8.57 + c = d = 0; 8.58 + while (1) 8.59 + { 8.60 + char *s = video_card_getname(c); 8.61 + 8.62 + if (!s[0]) 8.63 + break; 8.64 + 8.65 + if (video_card_available(c) && gfx_present[video_new_to_old(c)]) 8.66 + { 8.67 + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s); 8.68 + if (video_new_to_old(c) == gfxcard) 8.69 + SendMessage(h, CB_SETCURSEL, d, 0); 8.70 + 8.71 + d++; 8.72 + } 8.73 + 8.74 + c++; 8.75 + } 8.76 + if (models[model].fixed_gfxcard) 8.77 + EnableWindow(h, FALSE); 8.78 + 8.79 + h = GetDlgItem(hdlg, IDC_COMBOCPUM); 8.80 + c = 0; 8.81 + while (models[romstomodel[romset]].cpu[c].cpus != NULL && c < 3) 8.82 + { 8.83 + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)models[romstomodel[romset]].cpu[c].name); 8.84 + c++; 8.85 + } 8.86 + EnableWindow(h, TRUE); 8.87 + SendMessage(h, CB_SETCURSEL, cpu_manufacturer, 0); 8.88 + if (c == 1) EnableWindow(h, FALSE); 8.89 + else EnableWindow(h, TRUE); 8.90 + 8.91 + h = GetDlgItem(hdlg, IDC_COMBO3); 8.92 + c = 0; 8.93 + while (models[romstomodel[romset]].cpu[cpu_manufacturer].cpus[c].cpu_type != -1) 8.94 + { 8.95 + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)models[romstomodel[romset]].cpu[cpu_manufacturer].cpus[c].name); 8.96 + c++; 8.97 + } 8.98 + EnableWindow(h, TRUE); 8.99 + SendMessage(h, CB_SETCURSEL, cpu, 0); 8.100 + 8.101 + h = GetDlgItem(hdlg, IDC_COMBOSND); 8.102 + c = d = 0; 8.103 + while (1) 8.104 + { 8.105 + char *s = sound_card_getname(c); 8.106 + 8.107 + if (!s[0]) 8.108 + break; 8.109 + 8.110 + settings_sound_to_list[c] = d; 8.111 + 8.112 + if (sound_card_available(c)) 8.113 + { 8.114 + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s); 8.115 + settings_list_to_sound[d] = c; 8.116 + d++; 8.117 + } 8.118 + 8.119 + c++; 8.120 + } 8.121 + SendMessage(h, CB_SETCURSEL, settings_sound_to_list[sound_card_current], 0); 8.122 + 8.123 + h=GetDlgItem(hdlg, IDC_CHECK3); 8.124 + SendMessage(h, BM_SETCHECK, GAMEBLASTER, 0); 8.125 + 8.126 + h=GetDlgItem(hdlg, IDC_CHECKGUS); 8.127 + SendMessage(h, BM_SETCHECK, GUS, 0); 8.128 + 8.129 + h=GetDlgItem(hdlg, IDC_CHECKSSI); 8.130 + SendMessage(h, BM_SETCHECK, SSI2001, 0); 8.131 + 8.132 + h=GetDlgItem(hdlg, IDC_CHECK2); 8.133 + SendMessage(h, BM_SETCHECK, slowega, 0); 8.134 + 8.135 + h=GetDlgItem(hdlg, IDC_CHECK4); 8.136 + SendMessage(h, BM_SETCHECK, cga_comp, 0); 8.137 + 8.138 + h = GetDlgItem(hdlg, IDC_COMBOCHC); 8.139 + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"A little"); 8.140 + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"A bit"); 8.141 + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Some"); 8.142 + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"A lot"); 8.143 + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Infinite"); 8.144 + SendMessage(h, CB_SETCURSEL, cache, 0); 8.145 + 8.146 + h = GetDlgItem(hdlg, IDC_COMBOSPD); 8.147 + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"8-bit"); 8.148 + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Slow 16-bit"); 8.149 + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Fast 16-bit"); 8.150 + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Slow VLB/PCI"); 8.151 + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Mid VLB/PCI"); 8.152 + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Fast VLB/PCI"); 8.153 + SendMessage(h, CB_SETCURSEL, video_speed, 0); 8.154 + 8.155 + h = GetDlgItem(hdlg, IDC_MEMSPIN); 8.156 + SendMessage(h, UDM_SETBUDDY, (WPARAM)GetDlgItem(hdlg, IDC_MEMTEXT), 0); 8.157 + SendMessage(h, UDM_SETRANGE, 0, (1 << 16) | 256); 8.158 + SendMessage(h, UDM_SETPOS, 0, mem_size); 8.159 + 8.160 + return TRUE; 8.161 + 8.162 + case WM_COMMAND: 8.163 + switch (LOWORD(wParam)) 8.164 + { 8.165 + case IDOK: 8.166 + h = GetDlgItem(hdlg, IDC_MEMTEXT); 8.167 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)temp_str); 8.168 + sscanf(temp_str, "%i", &mem); 8.169 + if (mem < 1 || mem > 256) 8.170 + { 8.171 + MessageBox(NULL, "Invalid memory size\nMemory must be between 1 and 256 MB", "PCem", MB_OK); 8.172 + break; 8.173 + } 8.174 + 8.175 + 8.176 + h = GetDlgItem(hdlg, IDC_COMBO1); 8.177 + temp_model = listtomodel[SendMessage(h, CB_GETCURSEL, 0, 0)]; 8.178 + 8.179 + h = GetDlgItem(hdlg, IDC_COMBOVID); 8.180 + SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM)temp_str); 8.181 + gfx = video_new_to_old(video_card_getid(temp_str)); 8.182 + 8.183 + h = GetDlgItem(hdlg, IDC_COMBOCPUM); 8.184 + temp_cpu_m = SendMessage(h, CB_GETCURSEL, 0, 0); 8.185 + h = GetDlgItem(hdlg, IDC_COMBO3); 8.186 + temp_cpu = SendMessage(h, CB_GETCURSEL, 0, 0); 8.187 + fpu = (models[temp_model].cpu[temp_cpu_m].cpus[temp_cpu].cpu_type >= CPU_i486DX) ? 1 : 0; 8.188 + 8.189 + h = GetDlgItem(hdlg, IDC_CHECK3); 8.190 + temp_GAMEBLASTER = SendMessage(h, BM_GETCHECK, 0, 0); 8.191 + 8.192 + h = GetDlgItem(hdlg, IDC_CHECKGUS); 8.193 + temp_GUS = SendMessage(h, BM_GETCHECK, 0, 0); 8.194 + 8.195 + h = GetDlgItem(hdlg, IDC_CHECKSSI); 8.196 + temp_SSI2001 = SendMessage(h, BM_GETCHECK, 0, 0); 8.197 + 8.198 + h = GetDlgItem(hdlg, IDC_COMBOSND); 8.199 + temp_sound_card_current = settings_list_to_sound[SendMessage(h, CB_GETCURSEL, 0, 0)]; 8.200 + 8.201 + if (temp_model != model || gfx != gfxcard || mem != mem_size || fpu != hasfpu || temp_GAMEBLASTER != GAMEBLASTER || temp_GUS != GUS || temp_SSI2001 != SSI2001 || temp_sound_card_current != sound_card_current) 8.202 + { 8.203 + if (MessageBox(NULL,"This will reset PCem!\nOkay to continue?","PCem",MB_OKCANCEL)==IDOK) 8.204 + { 8.205 + model = temp_model; 8.206 + romset = model_getromset(); 8.207 + gfxcard = gfx; 8.208 + mem_size = mem; 8.209 + cpu_manufacturer = temp_cpu_m; 8.210 + cpu = temp_cpu; 8.211 + GAMEBLASTER = temp_GAMEBLASTER; 8.212 + GUS = temp_GUS; 8.213 + SSI2001 = temp_SSI2001; 8.214 + sound_card_current = temp_sound_card_current; 8.215 + 8.216 + mem_resize(); 8.217 + loadbios(); 8.218 + resetpchard(); 8.219 + } 8.220 + else 8.221 + { 8.222 + EndDialog(hdlg, 0); 8.223 + pause = 0; 8.224 + return TRUE; 8.225 + } 8.226 + } 8.227 + 8.228 + h = GetDlgItem(hdlg, IDC_COMBOSPD); 8.229 + video_speed = SendMessage(h, CB_GETCURSEL, 0, 0); 8.230 + 8.231 + h = GetDlgItem(hdlg, IDC_CHECK4); 8.232 + cga_comp=SendMessage(h, BM_GETCHECK, 0, 0); 8.233 + 8.234 + cpu_manufacturer = temp_cpu_m; 8.235 + cpu = temp_cpu; 8.236 + cpu_set(); 8.237 + 8.238 + h = GetDlgItem(hdlg, IDC_COMBOCHC); 8.239 + cache=SendMessage(h, CB_GETCURSEL, 0, 0); 8.240 + mem_updatecache(); 8.241 + 8.242 + saveconfig(); 8.243 + 8.244 + speedchanged(); 8.245 + 8.246 + case IDCANCEL: 8.247 + EndDialog(hdlg, 0); 8.248 + pause=0; 8.249 + return TRUE; 8.250 + case IDC_COMBO1: 8.251 + if (HIWORD(wParam) == CBN_SELCHANGE) 8.252 + { 8.253 + h = GetDlgItem(hdlg,IDC_COMBO1); 8.254 + temp_model = listtomodel[SendMessage(h,CB_GETCURSEL,0,0)]; 8.255 + 8.256 + /*Enable/disable gfxcard list*/ 8.257 + h = GetDlgItem(hdlg, IDC_COMBOVID); 8.258 + if (!models[temp_model].fixed_gfxcard) 8.259 + { 8.260 + char *s = video_card_getname(video_old_to_new(gfxcard)); 8.261 + 8.262 + EnableWindow(h, TRUE); 8.263 + 8.264 + c = 0; 8.265 + while (1) 8.266 + { 8.267 + SendMessage(h, CB_GETLBTEXT, c, (LPARAM)temp_str); 8.268 + if (!strcmp(temp_str, s)) 8.269 + break; 8.270 + c++; 8.271 + } 8.272 + SendMessage(h, CB_SETCURSEL, c, 0); 8.273 + } 8.274 + else 8.275 + EnableWindow(h, FALSE); 8.276 + 8.277 + /*Rebuild manufacturer list*/ 8.278 + h = GetDlgItem(hdlg, IDC_COMBOCPUM); 8.279 + temp_cpu_m = SendMessage(h, CB_GETCURSEL, 0, 0); 8.280 + SendMessage(h, CB_RESETCONTENT, 0, 0); 8.281 + c = 0; 8.282 + while (models[temp_model].cpu[c].cpus != NULL && c < 3) 8.283 + { 8.284 + SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)models[temp_model].cpu[c].name); 8.285 + c++; 8.286 + } 8.287 + if (temp_cpu_m >= c) temp_cpu_m = c - 1; 8.288 + SendMessage(h, CB_SETCURSEL, temp_cpu_m, 0); 8.289 + if (c == 1) EnableWindow(h, FALSE); 8.290 + else EnableWindow(h, TRUE); 8.291 + 8.292 + /*Rebuild CPU list*/ 8.293 + h = GetDlgItem(hdlg, IDC_COMBO3); 8.294 + temp_cpu = SendMessage(h, CB_GETCURSEL, 0, 0); 8.295 + SendMessage(h, CB_RESETCONTENT, 0, 0); 8.296 + c = 0; 8.297 + while (models[temp_model].cpu[temp_cpu_m].cpus[c].cpu_type != -1) 8.298 + { 8.299 + SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)models[temp_model].cpu[temp_cpu_m].cpus[c].name); 8.300 + c++; 8.301 + } 8.302 + if (temp_cpu >= c) temp_cpu = c - 1; 8.303 + SendMessage(h, CB_SETCURSEL, temp_cpu, 0); 8.304 + } 8.305 + break; 8.306 + case IDC_COMBOCPUM: 8.307 + if (HIWORD(wParam) == CBN_SELCHANGE) 8.308 + { 8.309 + h = GetDlgItem(hdlg, IDC_COMBO1); 8.310 + temp_model = listtomodel[SendMessage(h, CB_GETCURSEL, 0, 0)]; 8.311 + h = GetDlgItem(hdlg, IDC_COMBOCPUM); 8.312 + temp_cpu_m = SendMessage(h, CB_GETCURSEL, 0, 0); 8.313 + 8.314 + /*Rebuild CPU list*/ 8.315 + h=GetDlgItem(hdlg, IDC_COMBO3); 8.316 + temp_cpu = SendMessage(h, CB_GETCURSEL, 0, 0); 8.317 + SendMessage(h, CB_RESETCONTENT, 0, 0); 8.318 + c = 0; 8.319 + while (models[temp_model].cpu[temp_cpu_m].cpus[c].cpu_type != -1) 8.320 + { 8.321 + SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)models[temp_model].cpu[temp_cpu_m].cpus[c].name); 8.322 + c++; 8.323 + } 8.324 + if (temp_cpu >= c) temp_cpu = c - 1; 8.325 + SendMessage(h, CB_SETCURSEL, temp_cpu, 0); 8.326 + } 8.327 + break; 8.328 + } 8.329 + break; 8.330 + } 8.331 + return FALSE; 8.332 +} 8.333 + 8.334 +void config_open(HWND hwnd) 8.335 +{ 8.336 + DialogBox(hinstance, TEXT("ConfigureDlg"), hwnd, config_dlgproc); 8.337 +}
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/src/win-hdconf.c Tue Jun 24 21:15:42 2014 +0100 9.3 @@ -0,0 +1,493 @@ 9.4 +#define BITMAP WINDOWS_BITMAP 9.5 +#include <windows.h> 9.6 +#include <windowsx.h> 9.7 +#undef BITMAP 9.8 + 9.9 +#include "ibm.h" 9.10 +#include "ide.h" 9.11 +#include "resources.h" 9.12 +#include "win.h" 9.13 + 9.14 +static int hd_changed = 0; 9.15 + 9.16 +static char hd_new_name[512]; 9.17 +static int hd_new_spt, hd_new_hpc, hd_new_cyl; 9.18 + 9.19 +static BOOL CALLBACK hdnew_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) 9.20 +{ 9.21 + char s[260]; 9.22 + HWND h; 9.23 + int c; 9.24 + PcemHDC hd[2]; 9.25 + FILE *f; 9.26 + uint8_t buf[512]; 9.27 + switch (message) 9.28 + { 9.29 + case WM_INITDIALOG: 9.30 + h = GetDlgItem(hdlg, IDC_EDIT1); 9.31 + sprintf(s, "%i", 63); 9.32 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.33 + h = GetDlgItem(hdlg, IDC_EDIT2); 9.34 + sprintf(s, "%i", 16); 9.35 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.36 + h = GetDlgItem(hdlg, IDC_EDIT3); 9.37 + sprintf(s, "%i", 511); 9.38 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.39 + 9.40 + h = GetDlgItem(hdlg, IDC_EDITC); 9.41 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)""); 9.42 + 9.43 + h = GetDlgItem(hdlg, IDC_TEXT1); 9.44 + sprintf(s, "Size : %imb", (((511*16*63)*512)/1024)/1024); 9.45 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.46 + 9.47 + return TRUE; 9.48 + case WM_COMMAND: 9.49 + switch (LOWORD(wParam)) 9.50 + { 9.51 + case IDOK: 9.52 + h = GetDlgItem(hdlg, IDC_EDITC); 9.53 + SendMessage(h, WM_GETTEXT, 511, (LPARAM)hd_new_name); 9.54 + if (!hd_new_name[0]) 9.55 + { 9.56 + MessageBox(ghwnd,"Please enter a valid filename","PCem error",MB_OK); 9.57 + return TRUE; 9.58 + } 9.59 + h = GetDlgItem(hdlg, IDC_EDIT1); 9.60 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.61 + sscanf(s, "%i", &hd_new_spt); 9.62 + h = GetDlgItem(hdlg, IDC_EDIT2); 9.63 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.64 + sscanf(s, "%i", &hd_new_hpc); 9.65 + h = GetDlgItem(hdlg, IDC_EDIT3); 9.66 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.67 + sscanf(s, "%i", &hd_new_cyl); 9.68 + 9.69 + if (hd_new_spt > 63) 9.70 + { 9.71 + MessageBox(ghwnd, "Drive has too many sectors (maximum is 63)", "PCem error", MB_OK); 9.72 + return TRUE; 9.73 + } 9.74 + if (hd_new_hpc > 128) 9.75 + { 9.76 + MessageBox(ghwnd, "Drive has too many heads (maximum is 128)", "PCem error", MB_OK); 9.77 + return TRUE; 9.78 + } 9.79 + if (hd_new_cyl > 16383) 9.80 + { 9.81 + MessageBox(ghwnd, "Drive has too many cylinders (maximum is 16383)", "PCem error", MB_OK); 9.82 + return TRUE; 9.83 + } 9.84 + 9.85 + f = fopen64(hd_new_name, "wb"); 9.86 + if (!f) 9.87 + { 9.88 + MessageBox(ghwnd, "Can't open file for write", "PCem error", MB_OK); 9.89 + return TRUE; 9.90 + } 9.91 + memset(buf, 0, 512); 9.92 + for (c = 0; c < (hd_new_cyl * hd_new_hpc * hd_new_spt); c++) 9.93 + fwrite(buf, 512, 1, f); 9.94 + fclose(f); 9.95 + 9.96 + MessageBox(ghwnd, "Remember to partition and format the new drive", "PCem", MB_OK); 9.97 + 9.98 + EndDialog(hdlg, 1); 9.99 + return TRUE; 9.100 + case IDCANCEL: 9.101 + EndDialog(hdlg, 0); 9.102 + return TRUE; 9.103 + 9.104 + case IDC_CFILE: 9.105 + if (!getsfile(hdlg, "Hard disc image (*.IMG)\0*.IMG\0All files (*.*)\0*.*\0", "")) 9.106 + { 9.107 + h = GetDlgItem(hdlg, IDC_EDITC); 9.108 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)openfilestring); 9.109 + } 9.110 + return TRUE; 9.111 + 9.112 + case IDC_EDIT1: case IDC_EDIT2: case IDC_EDIT3: 9.113 + h = GetDlgItem(hdlg, IDC_EDIT1); 9.114 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.115 + sscanf(s, "%i", &hd[0].spt); 9.116 + h = GetDlgItem(hdlg, IDC_EDIT2); 9.117 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.118 + sscanf(s, "%i", &hd[0].hpc); 9.119 + h = GetDlgItem(hdlg, IDC_EDIT3); 9.120 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.121 + sscanf(s, "%i", &hd[0].tracks); 9.122 + 9.123 + h = GetDlgItem(hdlg, IDC_TEXT1); 9.124 + sprintf(s, "Size : %imb", (((((uint64_t)hd[0].tracks*(uint64_t)hd[0].hpc)*(uint64_t)hd[0].spt)*512)/1024)/1024); 9.125 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.126 + return TRUE; 9.127 + } 9.128 + break; 9.129 + 9.130 + } 9.131 + return FALSE; 9.132 +} 9.133 + 9.134 +BOOL CALLBACK hdsize_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) 9.135 +{ 9.136 + char s[260]; 9.137 + HWND h; 9.138 + PcemHDC hd[2]; 9.139 + switch (message) 9.140 + { 9.141 + case WM_INITDIALOG: 9.142 + h = GetDlgItem(hdlg, IDC_EDIT1); 9.143 + sprintf(s, "%i", hd_new_spt); 9.144 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.145 + h = GetDlgItem(hdlg, IDC_EDIT2); 9.146 + sprintf(s, "%i", hd_new_hpc); 9.147 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.148 + h = GetDlgItem(hdlg, IDC_EDIT3); 9.149 + sprintf(s, "%i", hd_new_cyl); 9.150 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.151 + 9.152 + h = GetDlgItem(hdlg, IDC_TEXT1); 9.153 + sprintf(s, "Size : %imb", ((((uint64_t)hd_new_spt*(uint64_t)hd_new_hpc*(uint64_t)hd_new_cyl)*512)/1024)/1024); 9.154 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.155 + 9.156 + return TRUE; 9.157 + case WM_COMMAND: 9.158 + switch (LOWORD(wParam)) 9.159 + { 9.160 + case IDOK: 9.161 + h = GetDlgItem(hdlg, IDC_EDIT1); 9.162 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.163 + sscanf(s, "%i", &hd_new_spt); 9.164 + h = GetDlgItem(hdlg, IDC_EDIT2); 9.165 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.166 + sscanf(s, "%i", &hd_new_hpc); 9.167 + h = GetDlgItem(hdlg, IDC_EDIT3); 9.168 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.169 + sscanf(s, "%i", &hd_new_cyl); 9.170 + 9.171 + if (hd_new_spt > 63) 9.172 + { 9.173 + MessageBox(ghwnd,"Drive has too many sectors (maximum is 63)","PCem error",MB_OK); 9.174 + return TRUE; 9.175 + } 9.176 + if (hd_new_hpc > 128) 9.177 + { 9.178 + MessageBox(ghwnd,"Drive has too many heads (maximum is 128)","PCem error",MB_OK); 9.179 + return TRUE; 9.180 + } 9.181 + if (hd_new_cyl > 16383) 9.182 + { 9.183 + MessageBox(ghwnd,"Drive has too many cylinders (maximum is 16383)","PCem error",MB_OK); 9.184 + return TRUE; 9.185 + } 9.186 + 9.187 + EndDialog(hdlg,1); 9.188 + return TRUE; 9.189 + case IDCANCEL: 9.190 + EndDialog(hdlg,0); 9.191 + return TRUE; 9.192 + 9.193 + case IDC_EDIT1: case IDC_EDIT2: case IDC_EDIT3: 9.194 + h = GetDlgItem(hdlg, IDC_EDIT1); 9.195 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.196 + sscanf(s, "%i", &hd[0].spt); 9.197 + h = GetDlgItem(hdlg, IDC_EDIT2); 9.198 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.199 + sscanf(s, "%i", &hd[0].hpc); 9.200 + h = GetDlgItem(hdlg, IDC_EDIT3); 9.201 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.202 + sscanf(s, "%i", &hd[0].tracks); 9.203 + 9.204 + h = GetDlgItem(hdlg, IDC_TEXT1); 9.205 + sprintf(s, "Size : %imb", (((((uint64_t)hd[0].tracks*(uint64_t)hd[0].hpc)*(uint64_t)hd[0].spt)*512)/1024)/1024); 9.206 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.207 + return TRUE; 9.208 + } 9.209 + break; 9.210 + 9.211 + } 9.212 + return FALSE; 9.213 +} 9.214 + 9.215 +static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) 9.216 +{ 9.217 + char s[260]; 9.218 + HWND h; 9.219 + PcemHDC hd[2]; 9.220 + FILE *f; 9.221 + off64_t sz; 9.222 + switch (message) 9.223 + { 9.224 + case WM_INITDIALOG: 9.225 + pause = 1; 9.226 + hd[0] = hdc[0]; 9.227 + hd[1] = hdc[1]; 9.228 + hd_changed = 0; 9.229 + 9.230 + h = GetDlgItem(hdlg, IDC_EDIT_C_SPT); 9.231 + sprintf(s, "%i", hdc[0].spt); 9.232 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.233 + h = GetDlgItem(hdlg, IDC_EDIT_C_HPC); 9.234 + sprintf(s, "%i", hdc[0].hpc); 9.235 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.236 + h = GetDlgItem(hdlg, IDC_EDIT_C_CYL); 9.237 + sprintf(s, "%i", hdc[0].tracks); 9.238 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.239 + h = GetDlgItem(hdlg, IDC_EDIT_C_FN); 9.240 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)ide_fn[0]); 9.241 + 9.242 + h = GetDlgItem(hdlg, IDC_EDIT_D_SPT); 9.243 + sprintf(s, "%i", hdc[1].spt); 9.244 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.245 + h = GetDlgItem(hdlg, IDC_EDIT_D_HPC); 9.246 + sprintf(s, "%i", hdc[1].hpc); 9.247 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.248 + h = GetDlgItem(hdlg, IDC_EDIT_D_CYL); 9.249 + sprintf(s, "%i", hdc[1].tracks); 9.250 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.251 + h= GetDlgItem(hdlg, IDC_EDIT_D_FN); 9.252 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)ide_fn[1]); 9.253 + 9.254 + h = GetDlgItem(hdlg, IDC_TEXT_C_SIZE); 9.255 + sprintf(s, "Size : %imb", (((((uint64_t)hd[0].tracks*(uint64_t)hd[0].hpc)*(uint64_t)hd[0].spt)*512)/1024)/1024); 9.256 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.257 + 9.258 + h = GetDlgItem(hdlg, IDC_TEXT_D_SIZE); 9.259 + sprintf(s, "Size : %imb", (((((uint64_t)hd[1].tracks*(uint64_t)hd[1].hpc)*(uint64_t)hd[1].spt)*512)/1024)/1024); 9.260 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.261 + return TRUE; 9.262 + 9.263 + case WM_COMMAND: 9.264 + switch (LOWORD(wParam)) 9.265 + { 9.266 + case IDOK: 9.267 + if (hd_changed) 9.268 + { 9.269 + if (MessageBox(NULL, "This will reset PCem!\nOkay to continue?", "PCem", MB_OKCANCEL) == IDOK) 9.270 + { 9.271 + h = GetDlgItem(hdlg, IDC_EDIT_C_SPT); 9.272 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.273 + sscanf(s, "%i", &hd[0].spt); 9.274 + h = GetDlgItem(hdlg, IDC_EDIT_C_HPC); 9.275 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.276 + sscanf(s, "%i", &hd[0].hpc); 9.277 + h = GetDlgItem(hdlg, IDC_EDIT_C_CYL); 9.278 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.279 + sscanf(s, "%i", &hd[0].tracks); 9.280 + h = GetDlgItem(hdlg, IDC_EDIT_C_FN); 9.281 + SendMessage(h, WM_GETTEXT, 511, (LPARAM)ide_fn[0]); 9.282 + 9.283 + h = GetDlgItem(hdlg, IDC_EDIT_D_SPT); 9.284 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.285 + sscanf(s, "%i", &hd[1].spt); 9.286 + h = GetDlgItem(hdlg, IDC_EDIT_D_HPC); 9.287 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.288 + sscanf(s, "%i", &hd[1].hpc); 9.289 + h = GetDlgItem(hdlg, IDC_EDIT_D_CYL); 9.290 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.291 + sscanf(s, "%i", &hd[1].tracks); 9.292 + h = GetDlgItem(hdlg, IDC_EDIT_D_FN); 9.293 + SendMessage(h, WM_GETTEXT, 511, (LPARAM)ide_fn[1]); 9.294 + 9.295 + hdc[0] = hd[0]; 9.296 + hdc[1] = hd[1]; 9.297 + 9.298 + saveconfig(); 9.299 + 9.300 + resetpchard(); 9.301 + } 9.302 + } 9.303 + case IDCANCEL: 9.304 + EndDialog(hdlg, 0); 9.305 + pause = 0; 9.306 + return TRUE; 9.307 + 9.308 + case IDC_EJECTC: 9.309 + hd[0].spt = 0; 9.310 + hd[0].hpc = 0; 9.311 + hd[0].tracks = 0; 9.312 + ide_fn[0][0] = 0; 9.313 + SetDlgItemText(hdlg, IDC_EDIT_C_SPT, "0"); 9.314 + SetDlgItemText(hdlg, IDC_EDIT_C_HPC, "0"); 9.315 + SetDlgItemText(hdlg, IDC_EDIT_C_CYL, "0"); 9.316 + SetDlgItemText(hdlg, IDC_EDIT_C_FN, ""); 9.317 + hd_changed = 1; 9.318 + return TRUE; 9.319 + case IDC_EJECTD: 9.320 + hd[1].spt = 0; 9.321 + hd[1].hpc = 0; 9.322 + hd[1].tracks = 0; 9.323 + ide_fn[1][0] = 0; 9.324 + SetDlgItemText(hdlg, IDC_EDIT_D_SPT, "0"); 9.325 + SetDlgItemText(hdlg, IDC_EDIT_D_HPC, "0"); 9.326 + SetDlgItemText(hdlg, IDC_EDIT_D_CYL, "0"); 9.327 + SetDlgItemText(hdlg, IDC_EDIT_D_FN, ""); 9.328 + hd_changed = 1; 9.329 + return TRUE; 9.330 + 9.331 + case IDC_CNEW: 9.332 + if (DialogBox(hinstance, TEXT("HdNewDlg"), hdlg, hdnew_dlgproc) == 1) 9.333 + { 9.334 + h = GetDlgItem(hdlg, IDC_EDIT_C_SPT); 9.335 + sprintf(s, "%i", hd_new_spt); 9.336 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.337 + h = GetDlgItem(hdlg, IDC_EDIT_C_CYL); 9.338 + sprintf(s, "%i", hd_new_hpc); 9.339 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.340 + h = GetDlgItem(hdlg, IDC_EDIT_C_CYL); 9.341 + sprintf(s, "%i", hd_new_cyl); 9.342 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.343 + h = GetDlgItem(hdlg, IDC_EDIT_C_FN); 9.344 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)hd_new_name); 9.345 + 9.346 + h = GetDlgItem(hdlg, IDC_TEXT_C_SIZE); 9.347 + sprintf(s, "Size : %imb", (((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024); 9.348 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.349 + 9.350 + hd_changed = 1; 9.351 + } 9.352 + return TRUE; 9.353 + 9.354 + case IDC_CFILE: 9.355 + if (!getfile(hdlg, "Hard disc image (*.IMG)\0*.IMG\0All files (*.*)\0*.*\0", "")) 9.356 + { 9.357 + f = fopen64(openfilestring, "rb"); 9.358 + if (!f) 9.359 + { 9.360 + MessageBox(ghwnd,"Can't open file for read","PCem error",MB_OK); 9.361 + return TRUE; 9.362 + } 9.363 + fseeko64(f, -1, SEEK_END); 9.364 + sz = ftello64(f) + 1; 9.365 + fclose(f); 9.366 + hd_new_spt = 63; 9.367 + hd_new_hpc = 16; 9.368 + hd_new_cyl = ((sz / 512) / 16) / 63; 9.369 + 9.370 + if (DialogBox(hinstance, TEXT("HdSizeDlg"), hdlg, hdsize_dlgproc) == 1) 9.371 + { 9.372 + h = GetDlgItem(hdlg, IDC_EDIT_C_SPT); 9.373 + sprintf(s, "%i", hd_new_spt); 9.374 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.375 + h = GetDlgItem(hdlg, IDC_EDIT_C_HPC); 9.376 + sprintf(s, "%i", hd_new_hpc); 9.377 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.378 + h = GetDlgItem(hdlg, IDC_EDIT_C_CYL); 9.379 + sprintf(s, "%i", hd_new_cyl); 9.380 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.381 + h = GetDlgItem(hdlg, IDC_EDIT_C_FN); 9.382 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)openfilestring); 9.383 + 9.384 + h= GetDlgItem(hdlg, IDC_TEXT_C_SIZE); 9.385 + sprintf(s, "Size : %imb", (((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024); 9.386 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.387 + 9.388 + hd_changed = 1; 9.389 + } 9.390 + } 9.391 + return TRUE; 9.392 + 9.393 + case IDC_DNEW: 9.394 + if (DialogBox(hinstance, TEXT("HdNewDlg"), hdlg, hdnew_dlgproc) == 1) 9.395 + { 9.396 + h = GetDlgItem(hdlg, IDC_EDIT_D_SPT); 9.397 + sprintf(s, "%i", hd_new_spt); 9.398 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.399 + h = GetDlgItem(hdlg, IDC_EDIT_D_HPC); 9.400 + sprintf(s, "%i", hd_new_hpc); 9.401 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.402 + h = GetDlgItem(hdlg, IDC_EDIT_D_CYL); 9.403 + sprintf(s, "%i", hd_new_cyl); 9.404 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.405 + h = GetDlgItem(hdlg, IDC_EDIT_D_FN); 9.406 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)hd_new_name); 9.407 + 9.408 + h= GetDlgItem(hdlg, IDC_TEXT_D_SIZE); 9.409 + sprintf(s, "Size : %imb", (((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024); 9.410 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.411 + 9.412 + hd_changed = 1; 9.413 + } 9.414 + return TRUE; 9.415 + 9.416 + case IDC_DFILE: 9.417 + if (!getfile(hdlg, "Hard disc image (*.IMG)\0*.IMG\0All files (*.*)\0*.*\0", "")) 9.418 + { 9.419 + f = fopen64(openfilestring, "rb"); 9.420 + if (!f) 9.421 + { 9.422 + MessageBox(ghwnd,"Can't open file for read","PCem error",MB_OK); 9.423 + return TRUE; 9.424 + } 9.425 + fseeko64(f, -1, SEEK_END); 9.426 + sz = ftello64(f) + 1; 9.427 + fclose(f); 9.428 + hd_new_spt = 63; 9.429 + hd_new_hpc = 16; 9.430 + hd_new_cyl = ((sz / 512) / 16) / 63; 9.431 + 9.432 + if (DialogBox(hinstance, TEXT("HdSizeDlg"), hdlg, hdsize_dlgproc) == 1) 9.433 + { 9.434 + h = GetDlgItem(hdlg, IDC_EDIT_D_SPT); 9.435 + sprintf(s, "%i", hd_new_spt); 9.436 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.437 + h = GetDlgItem(hdlg, IDC_EDIT_D_HPC); 9.438 + sprintf(s, "%i", hd_new_hpc); 9.439 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.440 + h = GetDlgItem(hdlg, IDC_EDIT_D_CYL); 9.441 + sprintf(s, "%i", hd_new_cyl); 9.442 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.443 + h = GetDlgItem(hdlg, IDC_EDIT_D_FN); 9.444 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)openfilestring); 9.445 + 9.446 + h = GetDlgItem(hdlg, IDC_TEXT_D_SIZE); 9.447 + sprintf(s, "Size : %imb", (((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024); 9.448 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.449 + 9.450 + hd_changed = 1; 9.451 + } 9.452 + } 9.453 + return TRUE; 9.454 + 9.455 + case IDC_EDIT_C_SPT: case IDC_EDIT_C_HPC: case IDC_EDIT_C_CYL: 9.456 + h = GetDlgItem(hdlg, IDC_EDIT_C_SPT); 9.457 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.458 + sscanf(s, "%i", &hd[0].spt); 9.459 + h = GetDlgItem(hdlg, IDC_EDIT_C_HPC); 9.460 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.461 + sscanf(s, "%i", &hd[0].hpc); 9.462 + h = GetDlgItem(hdlg, IDC_EDIT_C_CYL); 9.463 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.464 + sscanf(s, "%i", &hd[0].tracks); 9.465 + 9.466 + h = GetDlgItem(hdlg, IDC_TEXT_C_SIZE); 9.467 + sprintf(s, "Size : %imb", ((((hd[0].tracks*hd[0].hpc)*hd[0].spt)*512)/1024)/1024); 9.468 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.469 + return TRUE; 9.470 + 9.471 + case IDC_EDIT_D_SPT: case IDC_EDIT_D_HPC: case IDC_EDIT_D_CYL: 9.472 + h = GetDlgItem(hdlg, IDC_EDIT_D_SPT); 9.473 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.474 + sscanf(s, "%i", &hd[1].spt); 9.475 + h = GetDlgItem(hdlg, IDC_EDIT_D_HPC); 9.476 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.477 + sscanf(s, "%i", &hd[1].hpc); 9.478 + h = GetDlgItem(hdlg, IDC_EDIT_D_CYL); 9.479 + SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 9.480 + sscanf(s, "%i", &hd[1].tracks); 9.481 + 9.482 + h = GetDlgItem(hdlg, IDC_TEXT_D_SIZE); 9.483 + sprintf(s, "Size : %imb", ((((hd[1].tracks*hd[1].hpc)*hd[1].spt)*512)/1024)/1024); 9.484 + SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 9.485 + return TRUE; 9.486 + } 9.487 + break; 9.488 + 9.489 + } 9.490 + return FALSE; 9.491 +} 9.492 + 9.493 +void hdconf_open(HWND hwnd) 9.494 +{ 9.495 + DialogBox(hinstance, TEXT("HdConfDlg"), hwnd, hdconf_dlgproc); 9.496 +}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/src/win-status.c Tue Jun 24 21:15:42 2014 +0100 10.3 @@ -0,0 +1,66 @@ 10.4 +#define BITMAP WINDOWS_BITMAP 10.5 +#include <windows.h> 10.6 +#include <windowsx.h> 10.7 +#undef BITMAP 10.8 + 10.9 +#include "ibm.h" 10.10 +#include "video.h" 10.11 +#include "resources.h" 10.12 +#include "win.h" 10.13 + 10.14 +HWND status_hwnd; 10.15 +int status_is_open = 0; 10.16 + 10.17 +extern int sreadlnum, swritelnum, segareads, segawrites, scycles_lost; 10.18 + 10.19 +static BOOL CALLBACK status_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) 10.20 +{ 10.21 + char s[256]; 10.22 + char device_s[4096]; 10.23 + switch (message) 10.24 + { 10.25 + case WM_INITDIALOG: 10.26 + status_is_open = 1; 10.27 + case WM_USER: 10.28 + sprintf(device_s, 10.29 + "CPU speed : %f MIPS\n" 10.30 + "FPU speed : %f MFLOPS\n\n" 10.31 + "Cache misses (read) : %i/sec\n" 10.32 + "Cache misses (write) : %i/sec\n\n" 10.33 + "Video throughput (read) : %i bytes/sec\n\n" 10.34 + "Video throughput (write) : %i bytes/sec\n\n" 10.35 + "Effective clockspeed : %iHz\n\n" 10.36 + "Timer 0 frequency : %fHz\n\n", 10.37 + mips, 10.38 + flops, 10.39 + sreadlnum, 10.40 + swritelnum, 10.41 + segareads, 10.42 + segawrites, 10.43 + clockrate - (sreadlnum*memwaitstate) - (swritelnum*memwaitstate) - scycles_lost, 10.44 + pit_timer0_freq() 10.45 + ); 10.46 + 10.47 + device_add_status_info(device_s, 4096); 10.48 + SendDlgItemMessage(hdlg, IDC_STEXT_DEVICE, WM_SETTEXT, (WPARAM)NULL, (LPARAM)device_s); 10.49 + return TRUE; 10.50 + 10.51 + case WM_COMMAND: 10.52 + switch (LOWORD(wParam)) 10.53 + { 10.54 + case IDOK: 10.55 + case IDCANCEL: 10.56 + status_is_open = 0; 10.57 + EndDialog(hdlg, 0); 10.58 + return TRUE; 10.59 + } 10.60 + break; 10.61 + } 10.62 + return FALSE; 10.63 +} 10.64 + 10.65 +void status_open(HWND hwnd) 10.66 +{ 10.67 + status_hwnd = CreateDialog(hinstance, TEXT("StatusDlg"), hwnd, status_dlgproc); 10.68 + ShowWindow(status_hwnd, SW_SHOW); 10.69 +}
11.1 --- a/src/win-timer.c Thu Jun 19 21:02:59 2014 +0100 11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 11.3 @@ -1,8 +0,0 @@ 11.4 -int BPS_TO_TIMER(int a) 11.5 -{ 11.6 - return a; 11.7 -} 11.8 - 11.9 -void install_int_ex(void (*rout)(), int a) 11.10 -{ 11.11 -}
12.1 --- a/src/win.c Thu Jun 19 21:02:59 2014 +0100 12.2 +++ b/src/win.c Tue Jun 24 21:15:42 2014 +0100 12.3 @@ -54,52 +54,39 @@ 12.4 12.5 int winsizex=640,winsizey=480; 12.6 int gfx_present[19]; 12.7 -int wakeups,wokeups; 12.8 #undef cs 12.9 CRITICAL_SECTION cs; 12.10 -void waitmain(); 12.11 -void vsyncint(); 12.12 -int vgapresent; 12.13 12.14 -int cursoron = 1; 12.15 - 12.16 -HANDLE soundthreadh; 12.17 -HANDLE blitthreadh; 12.18 HANDLE mainthreadh; 12.19 12.20 -void soundthread(LPVOID param); 12.21 -void endmainthread(); 12.22 -void endsoundthread(); 12.23 -void silencesound(); 12.24 -void restoresound(); 12.25 -static HANDLE frameobject; 12.26 - 12.27 int infocus=1; 12.28 12.29 int drawits=0; 12.30 -void vsyncint() 12.31 -{ 12.32 -// if (infocus) 12.33 -// { 12.34 - drawits++; 12.35 - wakeups++; 12.36 - SetEvent(frameobject); 12.37 -// } 12.38 -} 12.39 12.40 int romspresent[ROM_MAX]; 12.41 int quited=0; 12.42 12.43 RECT oldclip; 12.44 int mousecapture=0; 12.45 -int drawit; 12.46 + 12.47 /* Declare Windows procedure */ 12.48 LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); 12.49 LRESULT CALLBACK subWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); 12.50 12.51 HWND ghwnd; 12.52 + 12.53 +HINSTANCE hinstance; 12.54 + 12.55 +HMENU menu; 12.56 + 12.57 +extern int updatestatus; 12.58 + 12.59 +int pause=0; 12.60 + 12.61 static int win_doresize = 0; 12.62 12.63 +static int leave_fullscreen_flag = 0; 12.64 + 12.65 void updatewindowsize(int x, int y) 12.66 { 12.67 RECT r; 12.68 @@ -119,19 +106,6 @@ 12.69 } 12.70 } 12.71 12.72 -void setrefresh(int rate) 12.73 -{ 12.74 - return; 12.75 - remove_int(vsyncint); 12.76 - drawit=0; 12.77 - install_int_ex(vsyncint,BPS_TO_TIMER(rate)); 12.78 -/* printf("Vsyncint at %i hz\n",rate); 12.79 - counter_freq.QuadPart=counter_base.QuadPart/rate;*/ 12.80 -// DeleteTimerQueueTimer( &hTimer, hTimerQueue, NULL); 12.81 -// CreateTimerQueueTimer( &hTimer, hTimerQueue, 12.82 -// mainroutine, NULL , 100, 1000/rate, 0); 12.83 -} 12.84 - 12.85 void startblit() 12.86 { 12.87 EnterCriticalSection(&cs); 12.88 @@ -142,44 +116,17 @@ 12.89 LeaveCriticalSection(&cs); 12.90 } 12.91 12.92 -static int leave_fullscreen_flag = 0; 12.93 void leave_fullscreen() 12.94 { 12.95 leave_fullscreen_flag = 1; 12.96 } 12.97 12.98 -int mainthreadon=0; 12.99 - 12.100 -/*static HANDLE blitobject; 12.101 -void blitthread(LPVOID param) 12.102 -{ 12.103 - while (!quited) 12.104 - { 12.105 - WaitForSingleObject(blitobject,100); 12.106 - if (quited) break; 12.107 - doblit(); 12.108 - } 12.109 -} 12.110 - 12.111 -void wakeupblit() 12.112 -{ 12.113 - SetEvent(blitobject); 12.114 -}*/ 12.115 - 12.116 -HWND statushwnd; 12.117 -int statusopen=0; 12.118 -extern int updatestatus; 12.119 -extern int sreadlnum, swritelnum, segareads, segawrites, scycles_lost; 12.120 - 12.121 -int pause=0; 12.122 - 12.123 void mainthread(LPVOID param) 12.124 { 12.125 int t = 0; 12.126 int frames = 0; 12.127 DWORD old_time, new_time; 12.128 12.129 - mainthreadon=1; 12.130 // Sleep(500); 12.131 drawits=0; 12.132 old_time = GetTickCount(); 12.133 @@ -187,8 +134,9 @@ 12.134 { 12.135 if (updatestatus) 12.136 { 12.137 - updatestatus=0; 12.138 - if (statusopen) SendMessage(statushwnd,WM_USER,0,0); 12.139 + updatestatus = 0; 12.140 + if (status_is_open) 12.141 + SendMessage(status_hwnd, WM_USER, 0, 0); 12.142 } 12.143 new_time = GetTickCount(); 12.144 drawits += new_time - old_time; 12.145 @@ -196,7 +144,6 @@ 12.146 if (drawits > 0 && !pause) 12.147 { 12.148 drawits-=10; if (drawits>50) drawits=0; 12.149 - wokeups++; 12.150 runpc(); 12.151 frames++; 12.152 if (frames >= 200 && nvr_dosave) 12.153 @@ -226,11 +173,8 @@ 12.154 SendMessage(ghwnd, WM_LEAVEFULLSCREEN, 0, 0); 12.155 } 12.156 } 12.157 - mainthreadon=0; 12.158 } 12.159 12.160 -HMENU menu; 12.161 - 12.162 static void initmenu(void) 12.163 { 12.164 int c; 12.165 @@ -252,8 +196,6 @@ 12.166 } 12.167 } 12.168 12.169 -HINSTANCE hinstance; 12.170 - 12.171 void get_executable_name(char *s, int size) 12.172 { 12.173 GetModuleFileName(hinstance, s, size); 12.174 @@ -418,33 +360,18 @@ 12.175 loadbios(); 12.176 12.177 timeBeginPeriod(1); 12.178 -// soundobject=CreateEvent(NULL, FALSE, FALSE, NULL); 12.179 -// soundthreadh=CreateThread(NULL,0,soundthread,NULL,NULL,NULL); 12.180 - 12.181 12.182 atexit(releasemouse); 12.183 -// atexit(endsoundthread); 12.184 - drawit=0; 12.185 + 12.186 // QueryPerformanceFrequency(&counter_base); 12.187 /// QueryPerformanceCounter(&counter_posold); 12.188 // counter_posold.QuadPart*=100; 12.189 12.190 -InitializeCriticalSection(&cs); 12.191 - frameobject=CreateEvent(NULL, FALSE, FALSE, NULL); 12.192 + InitializeCriticalSection(&cs); 12.193 mainthreadh=(HANDLE)_beginthread(mainthread,0,NULL); 12.194 -// atexit(endmainthread); 12.195 -// soundthreadh=(HANDLE)_beginthread(soundthread,0,NULL); 12.196 -// atexit(endsoundthread); 12.197 SetThreadPriority(mainthreadh, THREAD_PRIORITY_HIGHEST); 12.198 12.199 -// blitobject=CreateEvent(NULL, FALSE, FALSE, NULL); 12.200 -// blitthreadh=(HANDLE)_beginthread(blitthread,0,NULL); 12.201 - 12.202 -// SetThreadPriority(soundthreadh, THREAD_PRIORITY_HIGHEST); 12.203 - 12.204 - drawit=0; 12.205 - install_int_ex(vsyncint,BPS_TO_TIMER(100)); 12.206 - 12.207 + 12.208 updatewindowsize(640, 480); 12.209 12.210 QueryPerformanceFrequency(&qpc_freq); 12.211 @@ -497,7 +424,6 @@ 12.212 // pclog("Sleep 1000\n"); 12.213 Sleep(200); 12.214 // pclog("TerminateThread\n"); 12.215 - TerminateThread(blitthreadh,0); 12.216 TerminateThread(mainthreadh,0); 12.217 // pclog("Quited? %i\n",quited); 12.218 // pclog("Closepc\n"); 12.219 @@ -507,7 +433,6 @@ 12.220 vid_apis[video_fullscreen][vid_api].close(); 12.221 12.222 timeEndPeriod(1); 12.223 -// endsoundthread(); 12.224 // dumpregs(); 12.225 if (mousecapture) 12.226 { 12.227 @@ -603,846 +528,7 @@ 12.228 return 1; 12.229 } 12.230 12.231 -extern int is486; 12.232 -int romstolist[ROM_MAX], listtomodel[ROM_MAX], romstomodel[ROM_MAX], modeltolist[ROM_MAX]; 12.233 -static int settings_sound_to_list[20], settings_list_to_sound[20]; 12.234 12.235 -BOOL CALLBACK configdlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) 12.236 -{ 12.237 - char temp_str[256]; 12.238 - HWND h; 12.239 - int c, d; 12.240 - int rom,gfx,mem,fpu; 12.241 - int temp_cpu, temp_cpu_m, temp_model; 12.242 - int temp_GAMEBLASTER, temp_GUS, temp_SSI2001, temp_sound_card_current; 12.243 -// pclog("Dialog msg %i %08X\n",message,message); 12.244 - switch (message) 12.245 - { 12.246 - case WM_INITDIALOG: 12.247 - pause=1; 12.248 - h=GetDlgItem(hdlg,IDC_COMBO1); 12.249 - for (c=0;c<ROM_MAX;c++) romstolist[c]=0; 12.250 - c = d = 0; 12.251 - while (models[c].id != -1) 12.252 - { 12.253 - pclog("INITDIALOG : %i %i %i\n",c,models[c].id,romspresent[models[c].id]); 12.254 - if (romspresent[models[c].id]) 12.255 - { 12.256 - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)models[c].name); 12.257 - modeltolist[c] = d; 12.258 - listtomodel[d] = c; 12.259 - romstolist[models[c].id] = d; 12.260 - romstomodel[models[c].id] = c; 12.261 - d++; 12.262 - } 12.263 - c++; 12.264 - } 12.265 - SendMessage(h, CB_SETCURSEL, modeltolist[model], 0); 12.266 - 12.267 - h = GetDlgItem(hdlg, IDC_COMBOVID); 12.268 - c = d = 0; 12.269 - while (1) 12.270 - { 12.271 - char *s = video_card_getname(c); 12.272 - 12.273 - if (!s[0]) 12.274 - break; 12.275 - 12.276 - if (video_card_available(c) && gfx_present[video_new_to_old(c)]) 12.277 - { 12.278 - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s); 12.279 - if (video_new_to_old(c) == gfxcard) 12.280 - SendMessage(h, CB_SETCURSEL, d, 0); 12.281 - 12.282 - d++; 12.283 - } 12.284 - 12.285 - c++; 12.286 - } 12.287 - if (models[model].fixed_gfxcard) 12.288 - EnableWindow(h, FALSE); 12.289 - 12.290 - h=GetDlgItem(hdlg,IDC_COMBOCPUM); 12.291 - c = 0; 12.292 - while (models[romstomodel[romset]].cpu[c].cpus != NULL && c < 3) 12.293 - { 12.294 - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)models[romstomodel[romset]].cpu[c].name); 12.295 - c++; 12.296 - } 12.297 - EnableWindow(h,TRUE); 12.298 - SendMessage(h, CB_SETCURSEL, cpu_manufacturer, 0); 12.299 - if (c == 1) EnableWindow(h, FALSE); 12.300 - else EnableWindow(h, TRUE); 12.301 - 12.302 - h=GetDlgItem(hdlg,IDC_COMBO3); 12.303 - c = 0; 12.304 - while (models[romstomodel[romset]].cpu[cpu_manufacturer].cpus[c].cpu_type != -1) 12.305 - { 12.306 - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)models[romstomodel[romset]].cpu[cpu_manufacturer].cpus[c].name); 12.307 - c++; 12.308 - } 12.309 - EnableWindow(h,TRUE); 12.310 - SendMessage(h, CB_SETCURSEL, cpu, 0); 12.311 - 12.312 - h=GetDlgItem(hdlg,IDC_COMBOSND); 12.313 - c = d = 0; 12.314 - while (1) 12.315 - { 12.316 - char *s = sound_card_getname(c); 12.317 - 12.318 - if (!s[0]) 12.319 - break; 12.320 - 12.321 - settings_sound_to_list[c] = d; 12.322 - 12.323 - if (sound_card_available(c)) 12.324 - { 12.325 - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s); 12.326 - settings_list_to_sound[d] = c; 12.327 - d++; 12.328 - } 12.329 - 12.330 - c++; 12.331 - } 12.332 - SendMessage(h, CB_SETCURSEL, settings_sound_to_list[sound_card_current], 0); 12.333 - 12.334 - h=GetDlgItem(hdlg, IDC_CHECK3); 12.335 - SendMessage(h, BM_SETCHECK, GAMEBLASTER, 0); 12.336 - 12.337 - h=GetDlgItem(hdlg, IDC_CHECKGUS); 12.338 - SendMessage(h, BM_SETCHECK, GUS, 0); 12.339 - 12.340 - h=GetDlgItem(hdlg, IDC_CHECKSSI); 12.341 - SendMessage(h, BM_SETCHECK, SSI2001, 0); 12.342 - 12.343 - h=GetDlgItem(hdlg, IDC_CHECK2); 12.344 - SendMessage(h, BM_SETCHECK, slowega, 0); 12.345 - 12.346 - h=GetDlgItem(hdlg, IDC_CHECK4); 12.347 - SendMessage(h, BM_SETCHECK, cga_comp, 0); 12.348 - 12.349 - h=GetDlgItem(hdlg,IDC_COMBOCHC); 12.350 - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"A little"); 12.351 - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"A bit"); 12.352 - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"Some"); 12.353 - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"A lot"); 12.354 - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"Infinite"); 12.355 - SendMessage(h,CB_SETCURSEL,cache,0); 12.356 - 12.357 - h=GetDlgItem(hdlg,IDC_COMBOSPD); 12.358 - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"8-bit"); 12.359 - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"Slow 16-bit"); 12.360 - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"Fast 16-bit"); 12.361 - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"Slow VLB/PCI"); 12.362 - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"Mid VLB/PCI"); 12.363 - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)"Fast VLB/PCI"); 12.364 - SendMessage(h,CB_SETCURSEL,video_speed,0); 12.365 - 12.366 - h = GetDlgItem(hdlg, IDC_MEMSPIN); 12.367 - SendMessage(h, UDM_SETBUDDY, (WPARAM)GetDlgItem(hdlg, IDC_MEMTEXT), 0); 12.368 - SendMessage(h, UDM_SETRANGE, 0, (1 << 16) | 256); 12.369 - SendMessage(h, UDM_SETPOS, 0, mem_size); 12.370 - 12.371 - return TRUE; 12.372 - case WM_COMMAND: 12.373 - switch (LOWORD(wParam)) 12.374 - { 12.375 - case IDOK: 12.376 - h = GetDlgItem(hdlg, IDC_MEMTEXT); 12.377 - SendMessage(h, WM_GETTEXT, 255, (LPARAM)temp_str); 12.378 - sscanf(temp_str, "%i", &mem); 12.379 - if (mem < 1 || mem > 256) 12.380 - { 12.381 - MessageBox(NULL, "Invalid memory size\nMemory must be between 1 and 256 MB", "PCem", MB_OK); 12.382 - break; 12.383 - } 12.384 - 12.385 - 12.386 - h=GetDlgItem(hdlg,IDC_COMBO1); 12.387 - temp_model = listtomodel[SendMessage(h,CB_GETCURSEL,0,0)]; 12.388 - 12.389 - h = GetDlgItem(hdlg, IDC_COMBOVID); 12.390 - SendMessage(h, CB_GETLBTEXT, SendMessage(h,CB_GETCURSEL,0,0), (LPARAM)temp_str); 12.391 - gfx = video_new_to_old(video_card_getid(temp_str)); 12.392 - 12.393 - h = GetDlgItem(hdlg, IDC_COMBOCPUM); 12.394 - temp_cpu_m = SendMessage(h, CB_GETCURSEL, 0, 0); 12.395 - h = GetDlgItem(hdlg, IDC_COMBO3); 12.396 - temp_cpu = SendMessage(h, CB_GETCURSEL, 0, 0); 12.397 - fpu = (models[temp_model].cpu[temp_cpu_m].cpus[temp_cpu].cpu_type >= CPU_i486DX) ? 1 : 0; 12.398 - pclog("newcpu - %i %i %i %i\n",temp_cpu_m,temp_cpu,fpu,models[temp_model].cpu[temp_cpu_m].cpus[temp_cpu].cpu_type); 12.399 - 12.400 - h = GetDlgItem(hdlg, IDC_CHECK3); 12.401 - temp_GAMEBLASTER = SendMessage(h, BM_GETCHECK, 0, 0); 12.402 - 12.403 - h = GetDlgItem(hdlg, IDC_CHECKGUS); 12.404 - temp_GUS = SendMessage(h, BM_GETCHECK, 0, 0); 12.405 - 12.406 - h = GetDlgItem(hdlg, IDC_CHECKSSI); 12.407 - temp_SSI2001 = SendMessage(h, BM_GETCHECK, 0, 0); 12.408 - 12.409 - h = GetDlgItem(hdlg, IDC_COMBOSND); 12.410 - temp_sound_card_current = settings_list_to_sound[SendMessage(h, CB_GETCURSEL, 0, 0)]; 12.411 - 12.412 - if (temp_model != model || gfx != gfxcard || mem != mem_size || fpu != hasfpu || temp_GAMEBLASTER != GAMEBLASTER || temp_GUS != GUS || temp_SSI2001 != SSI2001 || temp_sound_card_current != sound_card_current) 12.413 - { 12.414 - if (MessageBox(NULL,"This will reset PCem!\nOkay to continue?","PCem",MB_OKCANCEL)==IDOK) 12.415 - { 12.416 - model = temp_model; 12.417 - romset = model_getromset(); 12.418 - gfxcard=gfx; 12.419 - mem_size=mem; 12.420 - cpu_manufacturer = temp_cpu_m; 12.421 - cpu = temp_cpu; 12.422 - GAMEBLASTER = temp_GAMEBLASTER; 12.423 - GUS = temp_GUS; 12.424 - SSI2001 = temp_SSI2001; 12.425 - sound_card_current = temp_sound_card_current; 12.426 - 12.427 - mem_resize(); 12.428 - loadbios(); 12.429 - resetpchard(); 12.430 - } 12.431 - else 12.432 - { 12.433 - EndDialog(hdlg,0); 12.434 - pause=0; 12.435 - return TRUE; 12.436 - } 12.437 - } 12.438 - 12.439 - h=GetDlgItem(hdlg,IDC_COMBOSPD); 12.440 - video_speed = SendMessage(h,CB_GETCURSEL,0,0); 12.441 - 12.442 - h=GetDlgItem(hdlg,IDC_CHECK4); 12.443 - cga_comp=SendMessage(h,BM_GETCHECK,0,0); 12.444 - 12.445 - cpu_manufacturer = temp_cpu_m; 12.446 - cpu = temp_cpu; 12.447 - cpu_set(); 12.448 - 12.449 - h=GetDlgItem(hdlg,IDC_COMBOCHC); 12.450 - cache=SendMessage(h,CB_GETCURSEL,0,0); 12.451 - mem_updatecache(); 12.452 - 12.453 - saveconfig(); 12.454 - 12.455 - speedchanged(); 12.456 -// if (romset>2) cpuspeed=1; 12.457 -// setpitclock(clocks[AT?1:0][cpuspeed][0]); 12.458 -// if (cpuspeed) setpitclock(8000000.0); 12.459 -// else setpitclock(4772728.0); 12.460 - 12.461 - case IDCANCEL: 12.462 - EndDialog(hdlg,0); 12.463 - pause=0; 12.464 - return TRUE; 12.465 - case IDC_COMBO1: 12.466 - if (HIWORD(wParam) == CBN_SELCHANGE) 12.467 - { 12.468 - h = GetDlgItem(hdlg,IDC_COMBO1); 12.469 - temp_model = listtomodel[SendMessage(h,CB_GETCURSEL,0,0)]; 12.470 - 12.471 - /*Enable/disable gfxcard list*/ 12.472 - h = GetDlgItem(hdlg, IDC_COMBOVID); 12.473 - if (!models[temp_model].fixed_gfxcard) 12.474 - { 12.475 - char *s = video_card_getname(video_old_to_new(gfxcard)); 12.476 - 12.477 - EnableWindow(h, TRUE); 12.478 - 12.479 - c = 0; 12.480 - while (1) 12.481 - { 12.482 - SendMessage(h, CB_GETLBTEXT, c, (LPARAM)temp_str); 12.483 - if (!strcmp(temp_str, s)) 12.484 - break; 12.485 - c++; 12.486 - } 12.487 - SendMessage(h, CB_SETCURSEL, c, 0); 12.488 - } 12.489 - else 12.490 - EnableWindow(h, FALSE); 12.491 - 12.492 - /*Rebuild manufacturer list*/ 12.493 - h = GetDlgItem(hdlg, IDC_COMBOCPUM); 12.494 - temp_cpu_m = SendMessage(h, CB_GETCURSEL, 0, 0); 12.495 - SendMessage(h, CB_RESETCONTENT, 0, 0); 12.496 - c = 0; 12.497 - while (models[temp_model].cpu[c].cpus != NULL && c < 3) 12.498 - { 12.499 - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)models[temp_model].cpu[c].name); 12.500 - c++; 12.501 - } 12.502 - if (temp_cpu_m >= c) temp_cpu_m = c - 1; 12.503 - SendMessage(h, CB_SETCURSEL, temp_cpu_m, 0); 12.504 - if (c == 1) EnableWindow(h, FALSE); 12.505 - else EnableWindow(h, TRUE); 12.506 - 12.507 - /*Rebuild CPU list*/ 12.508 - h = GetDlgItem(hdlg, IDC_COMBO3); 12.509 - temp_cpu = SendMessage(h, CB_GETCURSEL, 0, 0); 12.510 - SendMessage(h, CB_RESETCONTENT, 0, 0); 12.511 - c = 0; 12.512 - while (models[temp_model].cpu[temp_cpu_m].cpus[c].cpu_type != -1) 12.513 - { 12.514 - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)models[temp_model].cpu[temp_cpu_m].cpus[c].name); 12.515 - c++; 12.516 - } 12.517 - if (temp_cpu >= c) temp_cpu = c - 1; 12.518 - SendMessage(h, CB_SETCURSEL, temp_cpu, 0); 12.519 - } 12.520 - break; 12.521 - case IDC_COMBOCPUM: 12.522 - if (HIWORD(wParam) == CBN_SELCHANGE) 12.523 - { 12.524 - h = GetDlgItem(hdlg, IDC_COMBO1); 12.525 - temp_model = listtomodel[SendMessage(h, CB_GETCURSEL, 0, 0)]; 12.526 - h = GetDlgItem(hdlg, IDC_COMBOCPUM); 12.527 - temp_cpu_m = SendMessage(h, CB_GETCURSEL, 0, 0); 12.528 - 12.529 - /*Rebuild CPU list*/ 12.530 - h=GetDlgItem(hdlg, IDC_COMBO3); 12.531 - temp_cpu = SendMessage(h, CB_GETCURSEL, 0, 0); 12.532 - SendMessage(h, CB_RESETCONTENT, 0, 0); 12.533 - c = 0; 12.534 - while (models[temp_model].cpu[temp_cpu_m].cpus[c].cpu_type != -1) 12.535 - { 12.536 - SendMessage(h,CB_ADDSTRING,0,(LPARAM)(LPCSTR)models[temp_model].cpu[temp_cpu_m].cpus[c].name); 12.537 - c++; 12.538 - } 12.539 - if (temp_cpu >= c) temp_cpu = c - 1; 12.540 - SendMessage(h, CB_SETCURSEL, temp_cpu, 0); 12.541 - } 12.542 - break; 12.543 - } 12.544 - break; 12.545 - 12.546 - } 12.547 - return FALSE; 12.548 -} 12.549 -static char hd_new_name[512]; 12.550 -static int hd_new_spt, hd_new_hpc, hd_new_cyl; 12.551 - 12.552 -BOOL CALLBACK hdnewdlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) 12.553 -{ 12.554 - char s[260]; 12.555 - HWND h; 12.556 - int c; 12.557 - PcemHDC hd[2]; 12.558 - FILE *f; 12.559 - uint8_t buf[512]; 12.560 - switch (message) 12.561 - { 12.562 - case WM_INITDIALOG: 12.563 - h = GetDlgItem(hdlg, IDC_EDIT1); 12.564 - sprintf(s, "%i", 63); 12.565 - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 12.566 - h = GetDlgItem(hdlg, IDC_EDIT2); 12.567 - sprintf(s, "%i", 16); 12.568 - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 12.569 - h = GetDlgItem(hdlg, IDC_EDIT3); 12.570 - sprintf(s, "%i", 511); 12.571 - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 12.572 - 12.573 - h = GetDlgItem(hdlg, IDC_EDITC); 12.574 - SendMessage(h, WM_SETTEXT, 0, (LPARAM)""); 12.575 - 12.576 - h = GetDlgItem(hdlg, IDC_TEXT1); 12.577 - sprintf(s, "Size : %imb", (((511*16*63)*512)/1024)/1024); 12.578 - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 12.579 - 12.580 - return TRUE; 12.581 - case WM_COMMAND: 12.582 - switch (LOWORD(wParam)) 12.583 - { 12.584 - case IDOK: 12.585 - h = GetDlgItem(hdlg, IDC_EDITC); 12.586 - SendMessage(h, WM_GETTEXT, 511, (LPARAM)hd_new_name); 12.587 - if (!hd_new_name[0]) 12.588 - { 12.589 - MessageBox(ghwnd,"Please enter a valid filename","PCem error",MB_OK); 12.590 - return TRUE; 12.591 - } 12.592 - h = GetDlgItem(hdlg, IDC_EDIT1); 12.593 - SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 12.594 - sscanf(s, "%i", &hd_new_spt); 12.595 - h = GetDlgItem(hdlg, IDC_EDIT2); 12.596 - SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 12.597 - sscanf(s, "%i", &hd_new_hpc); 12.598 - h = GetDlgItem(hdlg, IDC_EDIT3); 12.599 - SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 12.600 - sscanf(s, "%i", &hd_new_cyl); 12.601 - 12.602 - if (hd_new_spt > 63) 12.603 - { 12.604 - MessageBox(ghwnd,"Drive has too many sectors (maximum is 63)","PCem error",MB_OK); 12.605 - return TRUE; 12.606 - } 12.607 - if (hd_new_hpc > 128) 12.608 - { 12.609 - MessageBox(ghwnd,"Drive has too many heads (maximum is 128)","PCem error",MB_OK); 12.610 - return TRUE; 12.611 - } 12.612 - if (hd_new_cyl > 16383) 12.613 - { 12.614 - MessageBox(ghwnd,"Drive has too many cylinders (maximum is 16383)","PCem error",MB_OK); 12.615 - return TRUE; 12.616 - } 12.617 - 12.618 - f = fopen64(hd_new_name, "wb"); 12.619 - if (!f) 12.620 - { 12.621 - MessageBox(ghwnd,"Can't open file for write","PCem error",MB_OK); 12.622 - return TRUE; 12.623 - } 12.624 - memset(buf, 0, 512); 12.625 - for (c = 0; c < (hd_new_cyl * hd_new_hpc * hd_new_spt); c++) 12.626 - fwrite(buf, 512, 1, f); 12.627 - fclose(f); 12.628 - 12.629 - MessageBox(ghwnd,"Remember to partition and format the new drive","PCem",MB_OK); 12.630 - 12.631 - EndDialog(hdlg,1); 12.632 - return TRUE; 12.633 - case IDCANCEL: 12.634 - EndDialog(hdlg,0); 12.635 - return TRUE; 12.636 - 12.637 - case IDC_CFILE: 12.638 - if (!getsfile(hdlg, "Hard disc image (*.IMG)\0*.IMG\0All files (*.*)\0*.*\0", "")) 12.639 - { 12.640 - h = GetDlgItem(hdlg, IDC_EDITC); 12.641 - SendMessage(h, WM_SETTEXT, 0, (LPARAM)openfilestring); 12.642 - } 12.643 - return TRUE; 12.644 - 12.645 - case IDC_EDIT1: case IDC_EDIT2: case IDC_EDIT3: 12.646 - h=GetDlgItem(hdlg,IDC_EDIT1); 12.647 - SendMessage(h,WM_GETTEXT,255,(LPARAM)s); 12.648 - sscanf(s,"%i",&hd[0].spt); 12.649 - h=GetDlgItem(hdlg,IDC_EDIT2); 12.650 - SendMessage(h,WM_GETTEXT,255,(LPARAM)s); 12.651 - sscanf(s,"%i",&hd[0].hpc); 12.652 - h=GetDlgItem(hdlg,IDC_EDIT3); 12.653 - SendMessage(h,WM_GETTEXT,255,(LPARAM)s); 12.654 - sscanf(s,"%i",&hd[0].tracks); 12.655 - 12.656 - h=GetDlgItem(hdlg,IDC_TEXT1); 12.657 - sprintf(s,"Size : %imb",(((((uint64_t)hd[0].tracks*(uint64_t)hd[0].hpc)*(uint64_t)hd[0].spt)*512)/1024)/1024); 12.658 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.659 - return TRUE; 12.660 - } 12.661 - break; 12.662 - 12.663 - } 12.664 - return FALSE; 12.665 -} 12.666 - 12.667 -BOOL CALLBACK hdsizedlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) 12.668 -{ 12.669 - char s[260]; 12.670 - HWND h; 12.671 - PcemHDC hd[2]; 12.672 - switch (message) 12.673 - { 12.674 - case WM_INITDIALOG: 12.675 - h = GetDlgItem(hdlg, IDC_EDIT1); 12.676 - sprintf(s, "%i", hd_new_spt); 12.677 - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 12.678 - h = GetDlgItem(hdlg, IDC_EDIT2); 12.679 - sprintf(s, "%i", hd_new_hpc); 12.680 - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 12.681 - h = GetDlgItem(hdlg, IDC_EDIT3); 12.682 - sprintf(s, "%i", hd_new_cyl); 12.683 - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 12.684 - 12.685 - h = GetDlgItem(hdlg, IDC_TEXT1); 12.686 - sprintf(s, "Size : %imb", ((((uint64_t)hd_new_spt*(uint64_t)hd_new_hpc*(uint64_t)hd_new_cyl)*512)/1024)/1024); 12.687 - SendMessage(h, WM_SETTEXT, 0, (LPARAM)s); 12.688 - 12.689 - return TRUE; 12.690 - case WM_COMMAND: 12.691 - switch (LOWORD(wParam)) 12.692 - { 12.693 - case IDOK: 12.694 - h = GetDlgItem(hdlg, IDC_EDIT1); 12.695 - SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 12.696 - sscanf(s, "%i", &hd_new_spt); 12.697 - h = GetDlgItem(hdlg, IDC_EDIT2); 12.698 - SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 12.699 - sscanf(s, "%i", &hd_new_hpc); 12.700 - h = GetDlgItem(hdlg, IDC_EDIT3); 12.701 - SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); 12.702 - sscanf(s, "%i", &hd_new_cyl); 12.703 - 12.704 - if (hd_new_spt > 63) 12.705 - { 12.706 - MessageBox(ghwnd,"Drive has too many sectors (maximum is 63)","PCem error",MB_OK); 12.707 - return TRUE; 12.708 - } 12.709 - if (hd_new_hpc > 128) 12.710 - { 12.711 - MessageBox(ghwnd,"Drive has too many heads (maximum is 128)","PCem error",MB_OK); 12.712 - return TRUE; 12.713 - } 12.714 - if (hd_new_cyl > 16383) 12.715 - { 12.716 - MessageBox(ghwnd,"Drive has too many cylinders (maximum is 16383)","PCem error",MB_OK); 12.717 - return TRUE; 12.718 - } 12.719 - 12.720 - EndDialog(hdlg,1); 12.721 - return TRUE; 12.722 - case IDCANCEL: 12.723 - EndDialog(hdlg,0); 12.724 - return TRUE; 12.725 - 12.726 - case IDC_EDIT1: case IDC_EDIT2: case IDC_EDIT3: 12.727 - h=GetDlgItem(hdlg,IDC_EDIT1); 12.728 - SendMessage(h,WM_GETTEXT,255,(LPARAM)s); 12.729 - sscanf(s,"%i",&hd[0].spt); 12.730 - h=GetDlgItem(hdlg,IDC_EDIT2); 12.731 - SendMessage(h,WM_GETTEXT,255,(LPARAM)s); 12.732 - sscanf(s,"%i",&hd[0].hpc); 12.733 - h=GetDlgItem(hdlg,IDC_EDIT3); 12.734 - SendMessage(h,WM_GETTEXT,255,(LPARAM)s); 12.735 - sscanf(s,"%i",&hd[0].tracks); 12.736 - 12.737 - h=GetDlgItem(hdlg,IDC_TEXT1); 12.738 - sprintf(s,"Size : %imb",(((((uint64_t)hd[0].tracks*(uint64_t)hd[0].hpc)*(uint64_t)hd[0].spt)*512)/1024)/1024); 12.739 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.740 - return TRUE; 12.741 - } 12.742 - break; 12.743 - 12.744 - } 12.745 - return FALSE; 12.746 -} 12.747 - 12.748 -static int hd_changed = 0; 12.749 -BOOL CALLBACK hdconfdlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) 12.750 -{ 12.751 - char s[260]; 12.752 - HWND h; 12.753 - PcemHDC hd[2]; 12.754 - FILE *f; 12.755 - off64_t sz; 12.756 - switch (message) 12.757 - { 12.758 - case WM_INITDIALOG: 12.759 - pause=1; 12.760 - hd[0]=hdc[0]; 12.761 - hd[1]=hdc[1]; 12.762 - hd_changed = 0; 12.763 - 12.764 - h=GetDlgItem(hdlg,IDC_EDIT1); 12.765 - sprintf(s,"%i",hdc[0].spt); 12.766 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.767 - h=GetDlgItem(hdlg,IDC_EDIT2); 12.768 - sprintf(s,"%i",hdc[0].hpc); 12.769 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.770 - h=GetDlgItem(hdlg,IDC_EDIT3); 12.771 - sprintf(s,"%i",hdc[0].tracks); 12.772 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.773 - h=GetDlgItem(hdlg,IDC_EDITC); 12.774 - SendMessage(h,WM_SETTEXT,0,(LPARAM)ide_fn[0]); 12.775 - 12.776 - h=GetDlgItem(hdlg,IDC_EDIT4); 12.777 - sprintf(s,"%i",hdc[1].spt); 12.778 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.779 - h=GetDlgItem(hdlg,IDC_EDIT5); 12.780 - sprintf(s,"%i",hdc[1].hpc); 12.781 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.782 - h=GetDlgItem(hdlg,IDC_EDIT6); 12.783 - sprintf(s,"%i",hdc[1].tracks); 12.784 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.785 - h=GetDlgItem(hdlg,IDC_EDITD); 12.786 - SendMessage(h,WM_SETTEXT,0,(LPARAM)ide_fn[1]); 12.787 - 12.788 - h=GetDlgItem(hdlg,IDC_TEXT1); 12.789 - sprintf(s,"Size : %imb",(((((uint64_t)hd[0].tracks*(uint64_t)hd[0].hpc)*(uint64_t)hd[0].spt)*512)/1024)/1024); 12.790 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.791 - 12.792 - h=GetDlgItem(hdlg,IDC_TEXT2); 12.793 - sprintf(s,"Size : %imb",(((((uint64_t)hd[1].tracks*(uint64_t)hd[1].hpc)*(uint64_t)hd[1].spt)*512)/1024)/1024); 12.794 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.795 - return TRUE; 12.796 - case WM_COMMAND: 12.797 - switch (LOWORD(wParam)) 12.798 - { 12.799 - case IDOK: 12.800 - if (hd_changed) 12.801 - { 12.802 - if (MessageBox(NULL,"This will reset PCem!\nOkay to continue?","PCem",MB_OKCANCEL)==IDOK) 12.803 - { 12.804 - h=GetDlgItem(hdlg,IDC_EDIT1); 12.805 - SendMessage(h,WM_GETTEXT,255,(LPARAM)s); 12.806 - sscanf(s,"%i",&hd[0].spt); 12.807 - h=GetDlgItem(hdlg,IDC_EDIT2); 12.808 - SendMessage(h,WM_GETTEXT,255,(LPARAM)s); 12.809 - sscanf(s,"%i",&hd[0].hpc); 12.810 - h=GetDlgItem(hdlg,IDC_EDIT3); 12.811 - SendMessage(h,WM_GETTEXT,255,(LPARAM)s); 12.812 - sscanf(s,"%i",&hd[0].tracks); 12.813 - h=GetDlgItem(hdlg,IDC_EDITC); 12.814 - SendMessage(h,WM_GETTEXT,511,(LPARAM)ide_fn[0]); 12.815 - 12.816 - h=GetDlgItem(hdlg,IDC_EDIT4); 12.817 - SendMessage(h,WM_GETTEXT,255,(LPARAM)s); 12.818 - sscanf(s,"%i",&hd[1].spt); 12.819 - h=GetDlgItem(hdlg,IDC_EDIT5); 12.820 - SendMessage(h,WM_GETTEXT,255,(LPARAM)s); 12.821 - sscanf(s,"%i",&hd[1].hpc); 12.822 - h=GetDlgItem(hdlg,IDC_EDIT6); 12.823 - SendMessage(h,WM_GETTEXT,255,(LPARAM)s); 12.824 - sscanf(s,"%i",&hd[1].tracks); 12.825 - h=GetDlgItem(hdlg,IDC_EDITD); 12.826 - SendMessage(h,WM_GETTEXT,511,(LPARAM)ide_fn[1]); 12.827 - 12.828 - hdc[0] = hd[0]; 12.829 - hdc[1] = hd[1]; 12.830 - 12.831 - saveconfig(); 12.832 - 12.833 - resetpchard(); 12.834 - } 12.835 - } 12.836 - case IDCANCEL: 12.837 - EndDialog(hdlg,0); 12.838 - pause=0; 12.839 - return TRUE; 12.840 - 12.841 - case IDC_EJECTC: 12.842 - hd[0].spt = 0; 12.843 - hd[0].hpc = 0; 12.844 - hd[0].tracks = 0; 12.845 - ide_fn[0][0] = 0; 12.846 - SetDlgItemText(hdlg, IDC_EDIT1, "0"); 12.847 - SetDlgItemText(hdlg, IDC_EDIT2, "0"); 12.848 - SetDlgItemText(hdlg, IDC_EDIT3, "0"); 12.849 - SetDlgItemText(hdlg, IDC_EDITC, ""); 12.850 - hd_changed = 1; 12.851 - return TRUE; 12.852 - case IDC_EJECTD: 12.853 - hd[1].spt = 0; 12.854 - hd[1].hpc = 0; 12.855 - hd[1].tracks = 0; 12.856 - ide_fn[1][0] = 0; 12.857 - SetDlgItemText(hdlg, IDC_EDIT4, "0"); 12.858 - SetDlgItemText(hdlg, IDC_EDIT5, "0"); 12.859 - SetDlgItemText(hdlg, IDC_EDIT6, "0"); 12.860 - SetDlgItemText(hdlg, IDC_EDITD, ""); 12.861 - hd_changed = 1; 12.862 - return TRUE; 12.863 - 12.864 - case IDC_CNEW: 12.865 - if (DialogBox(hinstance,TEXT("HdNewDlg"),hdlg,hdnewdlgproc) == 1) 12.866 - { 12.867 - h=GetDlgItem(hdlg,IDC_EDIT1); 12.868 - sprintf(s,"%i",hd_new_spt); 12.869 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.870 - h=GetDlgItem(hdlg,IDC_EDIT2); 12.871 - sprintf(s,"%i",hd_new_hpc); 12.872 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.873 - h=GetDlgItem(hdlg,IDC_EDIT3); 12.874 - sprintf(s,"%i",hd_new_cyl); 12.875 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.876 - h=GetDlgItem(hdlg,IDC_EDITC); 12.877 - SendMessage(h,WM_SETTEXT,0,(LPARAM)hd_new_name); 12.878 - 12.879 - h=GetDlgItem(hdlg,IDC_TEXT1); 12.880 - sprintf(s,"Size : %imb",(((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024); 12.881 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.882 - 12.883 - hd_changed = 1; 12.884 - } 12.885 - return TRUE; 12.886 - 12.887 - case IDC_CFILE: 12.888 - if (!getfile(hdlg, "Hard disc image (*.IMG)\0*.IMG\0All files (*.*)\0*.*\0", "")) 12.889 - { 12.890 - f = fopen64(openfilestring, "rb"); 12.891 - if (!f) 12.892 - { 12.893 - MessageBox(ghwnd,"Can't open file for read","PCem error",MB_OK); 12.894 - return TRUE; 12.895 - } 12.896 - fseeko64(f, -1, SEEK_END); 12.897 - sz = ftello64(f) + 1; 12.898 - fclose(f); 12.899 - hd_new_spt = 63; 12.900 - hd_new_hpc = 16; 12.901 - hd_new_cyl = ((sz / 512) / 16) / 63; 12.902 - 12.903 - if (DialogBox(hinstance,TEXT("HdSizeDlg"),hdlg,hdsizedlgproc) == 1) 12.904 - { 12.905 - h=GetDlgItem(hdlg,IDC_EDIT1); 12.906 - sprintf(s,"%i",hd_new_spt); 12.907 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.908 - h=GetDlgItem(hdlg,IDC_EDIT2); 12.909 - sprintf(s,"%i",hd_new_hpc); 12.910 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.911 - h=GetDlgItem(hdlg,IDC_EDIT3); 12.912 - sprintf(s,"%i",hd_new_cyl); 12.913 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.914 - h=GetDlgItem(hdlg,IDC_EDITC); 12.915 - SendMessage(h,WM_SETTEXT,0,(LPARAM)openfilestring); 12.916 - 12.917 - h=GetDlgItem(hdlg,IDC_TEXT1); 12.918 - sprintf(s,"Size : %imb",(((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024); 12.919 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.920 - 12.921 - hd_changed = 1; 12.922 - } 12.923 - } 12.924 - return TRUE; 12.925 - 12.926 - case IDC_DNEW: 12.927 - if (DialogBox(hinstance,TEXT("HdNewDlg"),hdlg,hdnewdlgproc) == 1) 12.928 - { 12.929 - h=GetDlgItem(hdlg,IDC_EDIT4); 12.930 - sprintf(s,"%i",hd_new_spt); 12.931 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.932 - h=GetDlgItem(hdlg,IDC_EDIT5); 12.933 - sprintf(s,"%i",hd_new_hpc); 12.934 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.935 - h=GetDlgItem(hdlg,IDC_EDIT6); 12.936 - sprintf(s,"%i",hd_new_cyl); 12.937 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.938 - h=GetDlgItem(hdlg,IDC_EDITD); 12.939 - SendMessage(h,WM_SETTEXT,0,(LPARAM)hd_new_name); 12.940 - 12.941 - h=GetDlgItem(hdlg,IDC_TEXT2); 12.942 - sprintf(s,"Size : %imb",(((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024); 12.943 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.944 - 12.945 - hd_changed = 1; 12.946 - } 12.947 - return TRUE; 12.948 - 12.949 - case IDC_DFILE: 12.950 - if (!getfile(hdlg, "Hard disc image (*.IMG)\0*.IMG\0All files (*.*)\0*.*\0", "")) 12.951 - { 12.952 - f = fopen64(openfilestring, "rb"); 12.953 - if (!f) 12.954 - { 12.955 - MessageBox(ghwnd,"Can't open file for read","PCem error",MB_OK); 12.956 - return TRUE; 12.957 - } 12.958 - fseeko64(f, -1, SEEK_END); 12.959 - sz = ftello64(f) + 1; 12.960 - fclose(f); 12.961 - hd_new_spt = 63; 12.962 - hd_new_hpc = 16; 12.963 - hd_new_cyl = ((sz / 512) / 16) / 63; 12.964 - 12.965 - if (DialogBox(hinstance,TEXT("HdSizeDlg"),hdlg,hdsizedlgproc) == 1) 12.966 - { 12.967 - h=GetDlgItem(hdlg,IDC_EDIT4); 12.968 - sprintf(s,"%i",hd_new_spt); 12.969 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.970 - h=GetDlgItem(hdlg,IDC_EDIT5); 12.971 - sprintf(s,"%i",hd_new_hpc); 12.972 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.973 - h=GetDlgItem(hdlg,IDC_EDIT6); 12.974 - sprintf(s,"%i",hd_new_cyl); 12.975 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.976 - h=GetDlgItem(hdlg,IDC_EDITD); 12.977 - SendMessage(h,WM_SETTEXT,0,(LPARAM)openfilestring); 12.978 - 12.979 - h=GetDlgItem(hdlg,IDC_TEXT2); 12.980 - sprintf(s,"Size : %imb",(((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024); 12.981 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.982 - 12.983 - hd_changed = 1; 12.984 - } 12.985 - } 12.986 - return TRUE; 12.987 - 12.988 - case IDC_EDIT1: case IDC_EDIT2: case IDC_EDIT3: 12.989 - h=GetDlgItem(hdlg,IDC_EDIT1); 12.990 - SendMessage(h,WM_GETTEXT,255,(LPARAM)s); 12.991 - sscanf(s,"%i",&hd[0].spt); 12.992 - h=GetDlgItem(hdlg,IDC_EDIT2); 12.993 - SendMessage(h,WM_GETTEXT,255,(LPARAM)s); 12.994 - sscanf(s,"%i",&hd[0].hpc); 12.995 - h=GetDlgItem(hdlg,IDC_EDIT3); 12.996 - SendMessage(h,WM_GETTEXT,255,(LPARAM)s); 12.997 - sscanf(s,"%i",&hd[0].tracks); 12.998 - 12.999 - h=GetDlgItem(hdlg,IDC_TEXT1); 12.1000 - sprintf(s,"Size : %imb",((((hd[0].tracks*hd[0].hpc)*hd[0].spt)*512)/1024)/1024); 12.1001 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.1002 - return TRUE; 12.1003 - 12.1004 - case IDC_EDIT4: case IDC_EDIT5: case IDC_EDIT6: 12.1005 - h=GetDlgItem(hdlg,IDC_EDIT4); 12.1006 - SendMessage(h,WM_GETTEXT,255,(LPARAM)s); 12.1007 - sscanf(s,"%i",&hd[1].spt); 12.1008 - h=GetDlgItem(hdlg,IDC_EDIT5); 12.1009 - SendMessage(h,WM_GETTEXT,255,(LPARAM)s); 12.1010 - sscanf(s,"%i",&hd[1].hpc); 12.1011 - h=GetDlgItem(hdlg,IDC_EDIT6); 12.1012 - SendMessage(h,WM_GETTEXT,255,(LPARAM)s); 12.1013 - sscanf(s,"%i",&hd[1].tracks); 12.1014 - 12.1015 - h=GetDlgItem(hdlg,IDC_TEXT2); 12.1016 - sprintf(s,"Size : %imb",((((hd[1].tracks*hd[1].hpc)*hd[1].spt)*512)/1024)/1024); 12.1017 - SendMessage(h,WM_SETTEXT,0,(LPARAM)s); 12.1018 - return TRUE; 12.1019 - } 12.1020 - break; 12.1021 - 12.1022 - } 12.1023 - return FALSE; 12.1024 -} 12.1025 - 12.1026 -BOOL CALLBACK statusdlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) 12.1027 -{ 12.1028 - int egasp; 12.1029 - char s[256]; 12.1030 - char device_s[4096]; 12.1031 - switch (message) 12.1032 - { 12.1033 - case WM_INITDIALOG: 12.1034 - statusopen=1; 12.1035 - case WM_USER: 12.1036 - sprintf(s,"CPU speed : %f MIPS",mips); 12.1037 - SendDlgItemMessage(hdlg,IDC_STEXT1,WM_SETTEXT,(WPARAM)NULL,(LPARAM)s); 12.1038 - sprintf(s,"FPU speed : %f MFLOPS",flops); 12.1039 - SendDlgItemMessage(hdlg,IDC_STEXT2,WM_SETTEXT,(WPARAM)NULL,(LPARAM)s); 12.1040 - sprintf(s,"Cache misses (read) : %i/sec",sreadlnum); 12.1041 - SendDlgItemMessage(hdlg,IDC_STEXT3,WM_SETTEXT,(WPARAM)NULL,(LPARAM)s); 12.1042 - sprintf(s,"Cache misses (write) : %i/sec",swritelnum); 12.1043 - SendDlgItemMessage(hdlg,IDC_STEXT4,WM_SETTEXT,(WPARAM)NULL,(LPARAM)s); 12.1044 - sprintf(s,"Video throughput (read) : %i bytes/sec",segareads); 12.1045 - SendDlgItemMessage(hdlg,IDC_STEXT5,WM_SETTEXT,(WPARAM)NULL,(LPARAM)s); 12.1046 - sprintf(s,"Video throughput (write) : %i bytes/sec",segawrites); 12.1047 - SendDlgItemMessage(hdlg,IDC_STEXT6,WM_SETTEXT,(WPARAM)NULL,(LPARAM)s); 12.1048 - egasp=(slowega)?egacycles:egacycles2; 12.1049 - sprintf(s,"Effective clockspeed : %iHz",clockrate-(sreadlnum*memwaitstate)-(swritelnum*memwaitstate)- scycles_lost); 12.1050 -// pclog("%i : %i %i %i %i : %i %i\n",clockrate,sreadlnum*memwaitstate,swritelnum*memwaitstate,segareads*egasp,segawrites*egasp,segawrites,egasp); 12.1051 - SendDlgItemMessage(hdlg,IDC_STEXT7,WM_SETTEXT,(WPARAM)NULL,(LPARAM)s); 12.1052 - sprintf(s,"Timer 0 frequency : %fHz",pit_timer0_freq()); 12.1053 - SendDlgItemMessage(hdlg,IDC_STEXT8,WM_SETTEXT,(WPARAM)NULL,(LPARAM)s); 12.1054 - device_s[0] = 0; 12.1055 - device_add_status_info(device_s, 4096); 12.1056 - SendDlgItemMessage(hdlg,IDC_STEXT_DEVICE,WM_SETTEXT,(WPARAM)NULL,(LPARAM)device_s); 12.1057 - return TRUE; 12.1058 - case WM_COMMAND: 12.1059 - switch (LOWORD(wParam)) 12.1060 - { 12.1061 - case IDOK: 12.1062 - case IDCANCEL: 12.1063 - statusopen=0; 12.1064 - EndDialog(hdlg,0); 12.1065 - return TRUE; 12.1066 - } 12.1067 - break; 12.1068 - } 12.1069 - return FALSE; 12.1070 -} 12.1071 12.1072 12.1073 HHOOK hKeyboardHook; 12.1074 @@ -1486,14 +572,12 @@ 12.1075 Sleep(100); 12.1076 resetpc(); 12.1077 pause=0; 12.1078 - drawit=1; 12.1079 break; 12.1080 case IDM_FILE_HRESET: 12.1081 pause=1; 12.1082 Sleep(100); 12.1083 resetpchard(); 12.1084 pause=0; 12.1085 - drawit=1; 12.1086 break; 12.1087 case IDM_FILE_EXIT: 12.1088 PostQuitMessage (0); /* send a WM_QUIT to the message queue */ 12.1089 @@ -1525,14 +609,13 @@ 12.1090 saveconfig(); 12.1091 break; 12.1092 case IDM_HDCONF: 12.1093 - DialogBox(hinstance,TEXT("HdConfDlg"),hwnd,hdconfdlgproc); 12.1094 + hdconf_open(hwnd); 12.1095 break; 12.1096 case IDM_CONFIG: 12.1097 - DialogBox(hinstance,TEXT("ConfigureDlg"),hwnd,configdlgproc); 12.1098 + config_open(hwnd); 12.1099 break; 12.1100 case IDM_STATUS: 12.1101 - statushwnd=CreateDialog(hinstance,TEXT("StatusDlg"),hwnd,statusdlgproc); 12.1102 - ShowWindow(statushwnd,SW_SHOW); 12.1103 + status_open(hwnd); 12.1104 break; 12.1105 12.1106 case IDM_VID_RESIZE: 12.1107 @@ -1648,10 +731,7 @@ 12.1108 12.1109 case WM_SETFOCUS: 12.1110 infocus=1; 12.1111 - drawit=0; 12.1112 // QueryPerformanceCounter(&counter_posold); 12.1113 -// ResetEvent(frameobject); 12.1114 -// restoresound(); 12.1115 // pclog("Set focus!\n"); 12.1116 break; 12.1117 case WM_KILLFOCUS: 12.1118 @@ -1662,7 +742,6 @@ 12.1119 ShowCursor(TRUE); 12.1120 mousecapture=0; 12.1121 } 12.1122 -// silencesound(); 12.1123 // pclog("Lost focus!\n"); 12.1124 break; 12.1125
13.1 --- a/src/win.h Thu Jun 19 21:02:59 2014 +0100 13.2 +++ b/src/win.h Tue Jun 24 21:15:42 2014 +0100 13.3 @@ -14,3 +14,19 @@ 13.4 #ifdef __cplusplus 13.5 } 13.6 #endif 13.7 + 13.8 + 13.9 +void status_open(HWND hwnd); 13.10 +extern HWND status_hwnd; 13.11 +extern int status_is_open; 13.12 + 13.13 +void hdconf_open(HWND hwnd); 13.14 + 13.15 +void config_open(HWND hwnd); 13.16 + 13.17 +extern char openfilestring[260]; 13.18 + 13.19 +int getfile(HWND hwnd, char *f, char *fn); 13.20 +int getsfile(HWND hwnd, char *f, char *fn); 13.21 + 13.22 +extern int pause;
