More cleanups to separate main code from platform support and UI support, plus a few bugfixes.

This commit is contained in:
waltje
2017-10-12 14:25:17 -04:00
parent aa7e85d0d7
commit 724e5c44df
46 changed files with 217 additions and 259 deletions

View File

@@ -9,7 +9,7 @@
* Implementation of the IDE emulation for hard disks and ATAPI
* CD-ROM devices.
*
* Version: @(#)hdc_ide.c 1.0.11 2017/10/09
* Version: @(#)hdc_ide.c 1.0.12 2017/10/11
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -17,6 +17,9 @@
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016,2017 Miran Grca.
*/
#define __USE_LARGEFILE64
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
#include <stdio.h>
#include <stdint.h>
#include <string.h>
@@ -621,7 +624,7 @@ void ide_reset(void)
ide_drives[d].type = IDE_NONE;
if (ide_drives[d].hdd_num != -1)
hdd_image_close(ide_drives[d].hdd_num);
if (ide_drive_is_cdrom(&ide_drives[d]))
if ((d < 8) && ide_drive_is_cdrom(&ide_drives[d]))
{
cdrom[atapi_cdrom_drives[d]].status = READY_STAT | DSC_STAT;
}

View File

@@ -12,7 +12,7 @@
* based design. Most cards were WD1003-WA2 or -WAH, where the
* -WA2 cards had a floppy controller as well (to save space.)
*
* Version: @(#)hdd_mfm_at.c 1.0.6 2017/10/09
* Version: @(#)hdd_mfm_at.c 1.0.7 2017/10/11
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -20,6 +20,9 @@
* Copyright 2008-2017 Sarah Walker.
* Copyright 2017 Fred N. van Kempen.
*/
#define __USE_LARGEFILE64
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
#include <stdio.h>
#include <stdint.h>
#include <string.h>

View File

@@ -41,7 +41,7 @@
* Since all controllers (including the ones made by DTC) use
* (mostly) the same API, we keep them all in this module.
*
* Version: @(#)hdd_mfm_xt.c 1.0.8 2017/10/09
* Version: @(#)hdd_mfm_xt.c 1.0.9 2017/10/11
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -49,6 +49,9 @@
* Copyright 2008-2017 Sarah Walker.
* Copyright 2017 Fred N. van Kempen.
*/
#define __USE_LARGEFILE64
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
#include <stdio.h>
#include <stdint.h>
#include <string.h>

View File

@@ -8,11 +8,12 @@
*
* Handling of hard disk image files.
*
* Version: @(#)hdd_image.c 1.0.2 2017/10/01
* Version: @(#)hdd_image.c 1.0.4 2017/11/12
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
* Copyright 2017 Fred N. van Kempen.
@@ -28,6 +29,7 @@
#include <wchar.h>
#include <errno.h>
#include "../ibm.h"
#include "../plat.h"
#include "hdd.h"
@@ -75,7 +77,7 @@ int image_is_hdi(const wchar_t *s)
return 0;
}
memcpy(ext, ws + ((len - 4) << 1), 8);
if (wcsicmp(ext, L".HDI") == 0)
if (! wcscasecmp(ext, L".HDI"))
{
return 1;
}
@@ -105,7 +107,7 @@ image_is_hdx(const wchar_t *s, int check_signature)
{
if (check_signature)
{
f = _wfopen(s, L"rb");
f = plat_fopen((wchar_t *)s, L"rb");
if (!f)
{
return 0;
@@ -176,7 +178,7 @@ int hdd_image_load(int id)
memset(hdd[id].fn, 0, sizeof(hdd[id].fn));
return 0;
}
hdd_images[id].file = _wfopen(fn, L"rb+");
hdd_images[id].file = plat_fopen(fn, L"rb+");
if (hdd_images[id].file == NULL)
{
/* Failed to open existing hard disk image */
@@ -191,7 +193,7 @@ int hdd_image_load(int id)
return 0;
}
hdd_images[id].file = _wfopen(fn, L"wb+");
hdd_images[id].file = plat_fopen(fn, L"wb+");
if (hdd_images[id].file == NULL)
{
hdd_image_log("Unable to open image\n");