CD-ROM images are now working correctly again;

Fixed all the reported bugs regarding the Settings dialog;
MIDI out device is now no longer reset to 0 after hard reset;
Removed all vestiges of the old disk activity flash;
The configuration file is no longer saved when it shouldn't be;
Redone the status bar icon updating so it is only done in win.c;
Made sure all variables in ibm.h are extern;
A lot of other bugfixes;
Added Mouse Systems Mouse emulation (patch from TheCollector1995);
Added IBM PS/1 Model 2133 (486) emulation (patch from TheCollector1995);
Tweaked the CPU dynamic recompiler cycle periods - 486SX 33 and 486DX 33 now work;
Increased compatibility with configuration files from before the previous commit.
This commit is contained in:
OBattler
2017-05-29 01:18:32 +02:00
parent 84480b7347
commit fc2a293536
54 changed files with 740 additions and 372 deletions

View File

@@ -138,6 +138,7 @@ static int *sb_part_icons;
static WCHAR **sbTips;
static int sb_parts = 0;
static int sb_ready = 0;
void updatewindowsize(int x, int y)
@@ -311,6 +312,12 @@ void mainthread(LPVOID param)
winsizey + (GetSystemMetrics(SM_CYEDGE) * 2) + (GetSystemMetrics(vid_resize ? SM_CYSIZEFRAME : SM_CYFIXEDFRAME) * 2) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 17 + sb_borders[1] + 1,
TRUE);
if (mousecapture)
{
GetWindowRect(ghwnd, &r);
ClipCursor(&r);
}
win_doresize = 0;
}
@@ -394,7 +401,7 @@ static void init_cdrom_host_drives(void)
for (i='A'; i<='Z'; i++)
{
_swprintf(s, L"%c:\\", i + 0x41);
_swprintf(s, L"%c:\\", i);
if (GetDriveType(s)==DRIVE_CDROM)
{
@@ -465,7 +472,7 @@ void create_cdrom_submenu(HMENU m, int id)
for (i = 0; i < 26; i++)
{
_swprintf(s, L"%c:\\", i + 0x41);
wsprintf(s, L"Host CD/DVD Drive (%c:)", i + 0x41);
if (host_cdrom_drive_available[i])
{
AppendMenu(m, MF_STRING, IDM_CDROM_HOST_DRIVE | (i << 3) | id, s);
@@ -475,21 +482,21 @@ void create_cdrom_submenu(HMENU m, int id)
check_menu_items:
if (!cdrom_drives[id].sound_on)
{
CheckMenuItem(smenu, IDM_CDROM_MUTE | id, MF_CHECKED);
CheckMenuItem(m, IDM_CDROM_MUTE | id, MF_CHECKED);
}
if (cdrom_drives[id].host_drive == 200)
{
CheckMenuItem(smenu, IDM_CDROM_IMAGE | id, MF_CHECKED);
CheckMenuItem(m, IDM_CDROM_IMAGE | id, MF_CHECKED);
}
else if ((cdrom_drives[id].host_drive >= 'A') && (cdrom_drives[id].host_drive <= 'Z'))
{
CheckMenuItem(smenu, IDM_CDROM_HOST_DRIVE | id | (cdrom_drives[id].host_drive << 3), MF_CHECKED);
CheckMenuItem(m, IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_CHECKED);
}
else
{
cdrom_drives[id].host_drive = 0;
CheckMenuItem(smenu, IDM_CDROM_EMPTY | id, MF_CHECKED);
CheckMenuItem(m, IDM_CDROM_EMPTY | id, MF_CHECKED);
}
}
@@ -667,7 +674,7 @@ int find_status_bar_part(int tag)
int i = 0;
int found = -1;
if (sb_part_meanings == NULL)
if (!sb_ready || (sb_parts == 0) || (sb_part_meanings == NULL))
{
return -1;
}
@@ -690,7 +697,7 @@ void update_status_bar_icon(int tag, int active)
int found = -1;
int temp_flags = 0;
if (((tag & 0xf0) >= SB_TEXT) || (sb_icon_flags == NULL) || (sb_part_icons == NULL))
if (((tag & 0xf0) >= SB_TEXT) || !sb_ready || (sb_parts == 0) || (sb_icon_flags == NULL) || (sb_part_icons == NULL))
{
return;
}
@@ -719,7 +726,7 @@ void update_status_bar_icon_state(int tag, int state)
{
int found = -1;
if (((tag & 0xf0) >= SB_HDD) || (sb_icon_flags == NULL) || (sb_part_icons == NULL))
if (((tag & 0xf0) >= SB_HDD) || !sb_ready || (sb_parts == 0) || (sb_icon_flags == NULL) || (sb_part_icons == NULL))
{
return;
}
@@ -866,6 +873,11 @@ void update_tip(int meaning)
int i = 0;
int part = -1;
if (!sb_ready || (sb_parts == 0) || (sb_part_meanings == NULL))
{
return;
}
for (i = 0; i < sb_parts; i++)
{
if (sb_part_meanings[i] == meaning)
@@ -903,6 +915,11 @@ void status_settextw(wchar_t *wstr)
int i = 0;
int part = -1;
if (!sb_ready || (sb_parts == 0) || (sb_part_meanings == NULL))
{
return;
}
for (i = 0; i < sb_parts; i++)
{
if (sb_part_meanings[i] == SB_TEXT)
@@ -972,6 +989,8 @@ void update_status_bar_panes(HWND hwnds)
int c_ide_dma = 0;
int c_scsi = 0;
sb_ready = 0;
c_mfm = count_hard_disks(HDD_BUS_MFM);
c_rll = count_hard_disks(HDD_BUS_RLL);
c_xtide = count_hard_disks(HDD_BUS_XTIDE);
@@ -1011,7 +1030,7 @@ void update_status_bar_panes(HWND hwnds)
sb_parts++;
}
}
for (i = 0; i < 16; i++)
for (i = 0; i < HDC_NUM; i++)
{
if (hdc[i].bus == HDD_BUS_SCSI_REMOVABLE)
{
@@ -1044,17 +1063,17 @@ void update_status_bar_panes(HWND hwnds)
}
sb_parts++;
iStatusWidths = (int *) malloc(sb_parts << 2);
sb_part_meanings = (int *) malloc(sb_parts << 2);
sb_part_icons = (int *) malloc(sb_parts << 2);
sb_icon_flags = (int *) malloc(sb_parts << 2);
iStatusWidths = (int *) malloc(sb_parts * sizeof(int));
sb_part_meanings = (int *) malloc(sb_parts * sizeof(int));
sb_part_icons = (int *) malloc(sb_parts * sizeof(int));
sb_icon_flags = (int *) malloc(sb_parts * sizeof(int));
sb_menu_handles = (HMENU *) malloc(sb_parts * sizeof(HMENU));
sbTips = (WCHAR **) malloc(sb_parts * sizeof(WCHAR *));
memset(iStatusWidths, 0, sb_parts << 2);
memset(sb_part_meanings, 0, sb_parts << 2);
memset(sb_part_icons, 0, sb_parts << 2);
memset(sb_icon_flags, 0, sb_parts << 2);
memset(iStatusWidths, 0, sb_parts * sizeof(int));
memset(sb_part_meanings, 0, sb_parts * sizeof(int));
memset(sb_part_icons, 0, sb_parts * sizeof(int));
memset(sb_icon_flags, 0, sb_parts * sizeof(int));
memset(sb_menu_handles, 0, sb_parts * sizeof(HMENU));
sb_parts = 0;
@@ -1225,6 +1244,8 @@ void update_status_bar_panes(HWND hwnds)
SendMessage(hwnds, SB_SETICON, i, (LPARAM) NULL);
}
}
sb_ready = 1;
}
HWND EmulatorStatusBar(HWND hwndParent, int idStatus, HINSTANCE hinst)
@@ -1421,17 +1442,27 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
ghwnd=hwnd;
initpc(argc, argv);
printf("hwndRender;\n");
hwndRender = CreateWindow(L"STATIC", NULL, WS_VISIBLE | WS_CHILD | SS_BITMAP, 0, 0, 1, 1, ghwnd, NULL, hinstance, NULL);
printf("initpc();\n");
initpc(argc, argv);
printf("init_cdrom_host_drives();\n");
init_cdrom_host_drives();
printf("EmulatorStatusBar();\n");
hwndStatus = EmulatorStatusBar(hwnd, IDC_STATUS, hThisInstance);
printf("OriginalStatusBarProcedure;\n");
OriginalStatusBarProcedure = GetWindowLongPtr(hwndStatus, GWLP_WNDPROC);
printf("SetWindowLongPtr;\n");
SetWindowLongPtr(hwndStatus, GWL_WNDPROC, (LONG_PTR) &StatusBarProcedure);
smenu = LoadMenu(hThisInstance, TEXT("StatusBarMenu"));
init_cdrom_host_drives();
printf("initmodules();\n");
initmodules();
if (vid_apis[0][vid_api].init(hwndRender) == 0)
{
@@ -2024,10 +2055,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
GetClipCursor(&oldclip);
GetWindowRect(hwnd, &rect);
rect.left += GetSystemMetrics(SM_CXFIXEDFRAME) + 20;
rect.right = GetSystemMetrics(SM_CXFIXEDFRAME) + 20;
rect.top += GetSystemMetrics(SM_CXFIXEDFRAME) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 20;
rect.bottom -= GetSystemMetrics(SM_CXFIXEDFRAME) + 20;
ClipCursor(&rect);
mousecapture = 1;
while (1)
@@ -2069,10 +2097,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
if (mousecapture)
{
GetWindowRect(hwnd, &rect);
rect.left += GetSystemMetrics(SM_CXFIXEDFRAME) + 20;
rect.right -= GetSystemMetrics(SM_CXFIXEDFRAME) + 20;
rect.top += GetSystemMetrics(SM_CXFIXEDFRAME) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 20;
rect.bottom -= GetSystemMetrics(SM_CXFIXEDFRAME) + 20;
ClipCursor(&rect);
}
@@ -2085,6 +2110,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
window_h = rect.bottom - rect.top;
save_window_pos = 1;
}
saveconfig();
break;
case WM_MOVE:
@@ -2124,6 +2151,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
mouse_close();
vid_apis[1][vid_api].close();
video_fullscreen = 0;
saveconfig();
vid_apis[0][vid_api].init(hwndRender);
mouse_init();
endblit();
@@ -2283,10 +2311,20 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED);
if ((cdrom_drives[id].host_drive >= 'A') && (cdrom_drives[id].host_drive <= 'Z'))
{
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | (cdrom_drives[id].host_drive << 3), MF_UNCHECKED);
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_UNCHECKED);
}
cdrom_drives[id].host_drive = (wcslen(cdrom_image[id].image_path) == 0) ? 0 : 200;
if (cdrom_drives[id].host_drive == 200)
{
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_CHECKED);
update_status_bar_icon_state(SB_CDROM | id, 0);
}
else
{
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_UNCHECKED);
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED);
update_status_bar_icon_state(SB_CDROM | id, 1);
}
cdrom_drives[id].host_drive = 200;
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_CHECKED);
update_tip(SB_CDROM | id);
saveconfig();
}
@@ -2316,12 +2354,13 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED);
if ((cdrom_drives[id].host_drive >= 'A') && (cdrom_drives[id].host_drive <= 'Z'))
{
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | (cdrom_drives[id].host_drive << 3), MF_UNCHECKED);
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_UNCHECKED);
}
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_UNCHECKED);
cdrom_drives[id].host_drive = new_cdrom_drive;
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | (cdrom_drives[id].host_drive << 3), MF_CHECKED);
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_CHECKED);
EnableMenuItem(sb_menu_handles[part], IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
update_status_bar_icon_state(SB_CDROM | id, 0);
update_tip(SB_CDROM | id);
saveconfig();
break;

View File

@@ -178,29 +178,6 @@ static void ddraw_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
lpdds_back2->Blt(&r_src, lpdds_back, &r_src, DDBLT_WAIT, NULL);
}
if (readflash)
{
readflash = 0;
#ifdef LEGACY_READ_FLASH
if (enable_flash)
{
hr = lpdds_back2->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
if (hr == DDERR_SURFACELOST)
{
lpdds_back2->Restore();
lpdds_back2->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
device_force_redraw();
}
if (!ddsd.lpSurface) return;
for (yy = 8; yy < 14; yy++)
{
p = &(((uint32_t *) ddsd.lpSurface)[yy * ddsd.lPitch]);
for (xx = (w - 40); xx < (w - 8); xx++)
p[xx] = 0xffffffff;
}
}
#endif
}
lpdds_back2->Unlock(NULL);
// pclog("Blit from %i,%i %i,%i to %i,%i %i,%i\n", r_src.left, r_src.top, r_src.right, r_src.bottom, r_dest.left, r_dest.top, r_dest.right, r_dest.bottom);
@@ -276,29 +253,6 @@ static void ddraw_blit_memtoscreen_8(int x, int y, int w, int h)
lpdds_back2->Blt(&r_src, lpdds_back, &r_src, DDBLT_WAIT, NULL);
}
if (readflash)
{
readflash = 0;
if (enable_flash)
{
hr = lpdds_back2->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
if (hr == DDERR_SURFACELOST)
{
lpdds_back2->Restore();
lpdds_back2->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
device_force_redraw();
}
if (!ddsd.lpSurface) return;
for (yy = 8; yy < 14; yy++)
{
p = (uint32_t *) &(((uint8_t *) ddsd.lpSurface)[yy * ddsd.lPitch]);
for (xx = (w - 40); xx < (w - 8); xx++)
p[xx] = 0xffffffff;
}
lpdds_back2->Unlock(NULL);
}
}
hr = lpdds_pri->Blt(&r_dest, lpdds_back2, &r_src, DDBLT_WAIT, NULL);
if (hr == DDERR_SURFACELOST)
{

View File

@@ -227,17 +227,6 @@ static void ddraw_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h
lpdds_back2->Blt(&r_dest, lpdds_back, &r_src, DDBLT_WAIT, NULL);
}
if (readflash && enable_flash)
{
RECT r;
r.left = window_rect.right - 40;
r.right = window_rect.right - 8;
r.top = 8;
r.bottom = 14;
ddbltfx.dwFillColor = 0xffffff;
lpdds_back2->Blt(&r, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddbltfx);
}
hr = lpdds_pri->Flip(NULL, DDFLIP_NOVSYNC);
if (hr == DDERR_SURFACELOST)
{
@@ -314,17 +303,6 @@ static void ddraw_fs_blit_memtoscreen_8(int x, int y, int w, int h)
lpdds_back2->Blt(&r_dest, lpdds_back, &r_src, DDBLT_WAIT, NULL);
}
if (readflash && enable_flash)
{
RECT r;
r.left = window_rect.right - 40;
r.right = window_rect.right - 8;
r.top = 8;
r.bottom = 14;
ddbltfx.dwFillColor = 0xffffff;
lpdds_back2->Blt(&r, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddbltfx);
}
lpdds_pri->Flip(NULL, DDFLIP_NOVSYNC);
}

View File

@@ -52,7 +52,7 @@ void cdrom_eject(uint8_t id)
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_UNCHECKED);
if ((cdrom_drives[id].host_drive >= 65) && (cdrom_drives[id].host_drive <= 90))
{
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | (cdrom_drive << 3), MF_UNCHECKED);
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_UNCHECKED);
}
cdrom_drives[id].prev_host_drive = cdrom_drives[id].host_drive;
cdrom_drives[id].host_drive=0;
@@ -89,9 +89,20 @@ void cdrom_reload(uint8_t id)
/* Signal disc change to the emulated machine. */
cdrom_insert(id);
}
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED);
cdrom_drives[id].host_drive = 200;
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_CHECKED);
if (wcslen(cdrom_image[id].image_path) == 0)
{
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_CHECKED);
cdrom_drives[id].host_drive = 0;
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_UNCHECKED);
update_status_bar_icon_state(SB_CDROM | id, 1);
}
else
{
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED);
cdrom_drives[id].host_drive = 200;
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_CHECKED);
update_status_bar_icon_state(SB_CDROM | id, 0);
}
}
else
{
@@ -103,10 +114,10 @@ void cdrom_reload(uint8_t id)
cdrom_insert(id);
}
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED);
cdrom_drive = new_cdrom_drive;
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | (cdrom_drives[id].host_drive << 3), MF_CHECKED);
cdrom_drives[id].host_drive = new_cdrom_drive;
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_CHECKED);
update_status_bar_icon_state(SB_CDROM | id, 0);
}
update_status_bar_icon_state(SB_CDROM | id, 0);
EnableMenuItem(sb_menu_handles[part], IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
update_tip(SB_CDROM | id);
saveconfig();

View File

@@ -49,8 +49,8 @@ void midi_init()
{
MMRESULT hr = MMSYSERR_NOERROR;
memset(midi_rt_buf, 0, 1024);
memset(midi_cmd_buf, 0, 1024);
memset(midi_rt_buf, 0, sizeof(midi_rt_buf));
memset(midi_cmd_buf, 0, sizeof(midi_cmd_buf));
midi_cmd_pos = midi_cmd_len = 0;
midi_status = 0;
@@ -81,7 +81,7 @@ void midi_close()
{
midiOutReset(midi_out_device);
midiOutClose(midi_out_device);
midi_out_device = NULL;
/* midi_out_device = NULL; */
CloseHandle(m_event);
}
}

View File

@@ -87,6 +87,7 @@ static void win_settings_init(void)
/* Machine category */
temp_model = model;
temp_cpu_m = cpu_manufacturer;
temp_wait_states = cpu_waitstates;
temp_cpu = cpu;
temp_mem_size = mem_size;
temp_dynarec = cpu_use_dynarec;
@@ -149,6 +150,7 @@ static int win_settings_changed(void)
/* Machine category */
i = i || (model != temp_model);
i = i || (cpu_manufacturer != temp_cpu_m);
i = i || (cpu_waitstates != temp_wait_states);
i = i || (cpu != temp_cpu);
i = i || (mem_size != temp_mem_size);
i = i || (temp_dynarec != cpu_use_dynarec);
@@ -243,6 +245,7 @@ static void win_settings_save(void)
model = temp_model;
romset = model_getromset();
cpu_manufacturer = temp_cpu_m;
cpu_waitstates = temp_wait_states;
cpu = temp_cpu;
mem_size = temp_mem_size;
cpu_use_dynarec = temp_dynarec;
@@ -297,6 +300,8 @@ static void win_settings_save(void)
mem_resize();
loadbios();
update_status_bar_panes(hwndStatus);
resetpchard();
cpu_set();
@@ -308,8 +313,6 @@ static void win_settings_save(void)
speedchanged();
if (joystick_type != 7) gameport_update_joystick_type();
update_status_bar_panes(hwndStatus);
}
@@ -399,6 +402,10 @@ static void win_settings_machine_recalc_cpu_m(HWND hdlg)
c++;
}
EnableWindow(h, TRUE);
if (temp_cpu > c)
{
temp_cpu = c;
}
SendMessage(h, CB_SETCURSEL, temp_cpu, 0);
win_settings_machine_recalc_cpu(hdlg);
@@ -440,6 +447,10 @@ static void win_settings_machine_recalc_model(HWND hdlg)
c++;
}
EnableWindow(h, TRUE);
if (temp_cpu_m > c)
{
temp_cpu_m = c;
}
SendMessage(h, CB_SETCURSEL, temp_cpu_m, 0);
if (c == 1)
{
@@ -519,7 +530,7 @@ static BOOL CALLBACK win_settings_machine_proc(HWND hdlg, UINT message, WPARAM w
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
}
SendMessage(h, CB_SETCURSEL, cpu_waitstates, 0);
SendMessage(h, CB_SETCURSEL, temp_wait_states, 0);
h=GetDlgItem(hdlg, IDC_CHECK_DYNAREC);
SendMessage(h, BM_SETCHECK, temp_dynarec, 0);
@@ -644,7 +655,7 @@ static void recalc_vid_list(HWND hdlg)
{
mbstowcs(szText, s, strlen(s) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) szText);
if (video_new_to_old(c) == gfxcard)
if (video_new_to_old(c) == temp_gfxcard)
{
SendMessage(h, CB_SETCURSEL, d, 0);
@@ -1682,7 +1693,12 @@ static int get_selected_hard_disk(HWND hdlg)
int i, j = 0;
HWND h;
for (i = 0; i < 6; i++)
if (hd_listview_items == 0)
{
return 0;
}
for (i = 0; i < hd_listview_items; i++)
{
h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS);
j = ListView_GetItemState(h, i, LVIS_SELECTED);
@@ -2318,7 +2334,9 @@ static BOOL CALLBACK win_settings_hard_disks_add_proc(HWND hdlg, UINT message, W
uint32_t base = 0x1000;
uint64_t signature = 0xD778A82044445459ll;
char buf[512];
char *big_buf;
int b = 0;
uint64_t r = 0;
switch (message)
{
@@ -2547,9 +2565,27 @@ static BOOL CALLBACK win_settings_hard_disks_add_proc(HWND hdlg, UINT message, W
memset(buf, 0, 512);
size >>= 9;
for (i = 0; i < size; i++)
r = (size >> 11) << 11;
size -= r;
r >>= 11;
if (size)
{
fwrite(buf, 512, 1, f);
for (i = 0; i < size; i++)
{
fwrite(buf, 1, 512, f);
}
}
if (r)
{
big_buf = (char *) malloc(1048576);
memset(big_buf, 0, 1048576);
for (i = 0; i < r; i++)
{
fwrite(big_buf, 1, 1048576, f);
}
free(big_buf);
}
fclose(f);