rewrite the emulator to use UTF-8 internally

This commit is contained in:
David Hrdlička
2021-03-14 20:35:01 +01:00
parent 56d62de4fe
commit dfbbe08a07
146 changed files with 1507 additions and 1457 deletions

View File

@@ -70,7 +70,7 @@ static img_t *img[FDD_NUM];
static fdc_t *img_fdc;
static double bit_rate_300;
static wchar_t *ext;
static char *ext;
static uint8_t first_byte,
second_byte,
third_byte,
@@ -621,7 +621,7 @@ is_divisible(uint16_t total, uint8_t what)
void
img_load(int drive, wchar_t *fn)
img_load(int drive, char *fn)
{
uint16_t bpb_bps;
uint16_t bpb_total;
@@ -654,9 +654,9 @@ img_load(int drive, wchar_t *fn)
dev = (img_t *)malloc(sizeof(img_t));
memset(dev, 0x00, sizeof(img_t));
dev->f = plat_fopen(fn, L"rb+");
dev->f = plat_fopen(fn, "rb+");
if (dev->f == NULL) {
dev->f = plat_fopen(fn, L"rb");
dev->f = plat_fopen(fn, "rb");
if (dev->f == NULL) {
free(dev);
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
@@ -673,13 +673,13 @@ img_load(int drive, wchar_t *fn)
dev->interleave = dev->skew = 0;
if (! wcscasecmp(ext, L"DDI")) {
if (! strcasecmp(ext, "DDI")) {
ddi = 1;
dev->base = 0x2400;
} else
dev->base = 0;
if (! wcscasecmp(ext, L"FDI")) {
if (! strcasecmp(ext, "FDI")) {
/* This is a Japanese FDI image, so let's read the header */
img_log("img_load(): File is a Japanese FDI image...\n");
fseek(dev->f, 0x10, SEEK_SET);
@@ -721,7 +721,7 @@ img_load(int drive, wchar_t *fn)
img_log("img_load(): File is a FDF image...\n");
fwriteprot[drive] = writeprot[drive] = 1;
fclose(dev->f);
dev->f = plat_fopen(fn, L"rb");
dev->f = plat_fopen(fn, "rb");
fdf = 1;
cqm = 0;
@@ -861,7 +861,7 @@ img_load(int drive, wchar_t *fn)
img_log("img_load(): File is a CopyQM image...\n");
fwriteprot[drive] = writeprot[drive] = 1;
fclose(dev->f);
dev->f = plat_fopen(fn, L"rb");
dev->f = plat_fopen(fn, "rb");
fseek(dev->f, 0x03, SEEK_SET);
fread(&bpb_bps, 1, 2, dev->f);