More cleanups to separate main code from platform support and UI support, plus a few bugfixes.
This commit is contained in:
@@ -9,10 +9,11 @@
|
||||
* Implementation of the raw sector-based floppy image format,
|
||||
* as well as the Japanese FDI, CopyQM, and FDF formats.
|
||||
*
|
||||
* Version: @(#)floppy_img.c 1.0.2 2017/09/24
|
||||
* Version: @(#)floppy_img.c 1.0.3 2017/10/12
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
@@ -23,6 +24,7 @@
|
||||
#include <wchar.h>
|
||||
#include "../ibm.h"
|
||||
#include "../config.h"
|
||||
#include "../plat.h"
|
||||
#include "floppy.h"
|
||||
#include "floppy_img.h"
|
||||
#include "fdc.h"
|
||||
@@ -349,10 +351,10 @@ void img_load(int drive, wchar_t *fn)
|
||||
d86f_unregister(drive);
|
||||
|
||||
writeprot[drive] = 0;
|
||||
img[drive].f = _wfopen(fn, L"rb+");
|
||||
img[drive].f = plat_fopen(fn, L"rb+");
|
||||
if (!img[drive].f)
|
||||
{
|
||||
img[drive].f = _wfopen(fn, L"rb");
|
||||
img[drive].f = plat_fopen(fn, L"rb");
|
||||
if (!img[drive].f)
|
||||
{
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
@@ -370,7 +372,7 @@ void img_load(int drive, wchar_t *fn)
|
||||
|
||||
img[drive].interleave = img[drive].skew = 0;
|
||||
|
||||
if (_wcsicmp(ext, L"FDI") == 0)
|
||||
if (! wcscasecmp(ext, L"FDI"))
|
||||
{
|
||||
/* This is a Japanese FDI image, so let's read the header */
|
||||
pclog("img_load(): File is a Japanese FDI image...\n");
|
||||
@@ -415,7 +417,7 @@ void img_load(int drive, wchar_t *fn)
|
||||
pclog("img_load(): File is a FDF image...\n");
|
||||
fwriteprot[drive] = writeprot[drive] = 1;
|
||||
fclose(img[drive].f);
|
||||
img[drive].f = _wfopen(fn, L"rb");
|
||||
img[drive].f = plat_fopen(fn, L"rb");
|
||||
|
||||
fdf = 1;
|
||||
|
||||
@@ -600,7 +602,7 @@ void img_load(int drive, wchar_t *fn)
|
||||
pclog("img_load(): File is a CopyQM image...\n");
|
||||
fwriteprot[drive] = writeprot[drive] = 1;
|
||||
fclose(img[drive].f);
|
||||
img[drive].f = _wfopen(fn, L"rb");
|
||||
img[drive].f = plat_fopen(fn, L"rb");
|
||||
|
||||
fseek(img[drive].f, 0x03, SEEK_SET);
|
||||
fread(&bpb_bps, 1, 2, img[drive].f);
|
||||
|
||||
Reference in New Issue
Block a user