rewrite the emulator to use UTF-8 internally
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
|
||||
|
||||
#define HDC_TIME (TIMER_USEC*10LL)
|
||||
#define BIOS_FILE L"roms/hdd/esdi_at/62-000279-061.bin"
|
||||
#define BIOS_FILE "roms/hdd/esdi_at/62-000279-061.bin"
|
||||
|
||||
#define STAT_ERR 0x01
|
||||
#define STAT_INDEX 0x02
|
||||
@@ -744,7 +744,7 @@ esdi_callback(void *priv)
|
||||
|
||||
|
||||
static void
|
||||
loadhd(esdi_t *esdi, int hdd_num, int d, const wchar_t *fn)
|
||||
loadhd(esdi_t *esdi, int hdd_num, int d, const char *fn)
|
||||
{
|
||||
drive_t *drive = &esdi->drives[hdd_num];
|
||||
|
||||
|
||||
@@ -86,8 +86,8 @@
|
||||
#define ESDI_IOADDR_SEC 0x3518
|
||||
#define ESDI_IRQCHAN 14
|
||||
|
||||
#define BIOS_FILE_L L"roms/hdd/esdi/90x8969.bin"
|
||||
#define BIOS_FILE_H L"roms/hdd/esdi/90x8970.bin"
|
||||
#define BIOS_FILE_L "roms/hdd/esdi/90x8969.bin"
|
||||
#define BIOS_FILE_H "roms/hdd/esdi/90x8970.bin"
|
||||
|
||||
|
||||
#define ESDI_TIME (200*TIMER_USEC)
|
||||
|
||||
@@ -704,7 +704,7 @@ ide_next_sector(ide_t *ide)
|
||||
|
||||
|
||||
static void
|
||||
loadhd(ide_t *ide, int d, const wchar_t *fn)
|
||||
loadhd(ide_t *ide, int d, const char *fn)
|
||||
{
|
||||
if (! hdd_image_load(d)) {
|
||||
ide->type = IDE_NONE;
|
||||
|
||||
@@ -692,7 +692,7 @@ do_callback(void *priv)
|
||||
|
||||
|
||||
static void
|
||||
loadhd(mfm_t *mfm, int c, int d, const wchar_t *fn)
|
||||
loadhd(mfm_t *mfm, int c, int d, const char *fn)
|
||||
{
|
||||
drive_t *drive = &mfm->drives[c];
|
||||
|
||||
@@ -725,7 +725,7 @@ mfm_init(const device_t *info)
|
||||
if ((hdd[d].bus == HDD_BUS_MFM) && (hdd[d].mfm_channel < MFM_NUM)) {
|
||||
loadhd(mfm, hdd[d].mfm_channel, d, hdd[d].fn);
|
||||
|
||||
st506_at_log("WD1003(%d): (%ls) geometry %d/%d/%d\n", c, hdd[d].fn,
|
||||
st506_at_log("WD1003(%d): (%s) geometry %d/%d/%d\n", c, hdd[d].fn,
|
||||
(int)hdd[d].tracks, (int)hdd[d].hpc, (int)hdd[d].spt);
|
||||
|
||||
if (++c >= MFM_NUM) break;
|
||||
|
||||
@@ -91,15 +91,15 @@
|
||||
#include <86box/hdd.h>
|
||||
|
||||
|
||||
#define XEBEC_BIOS_FILE L"roms/hdd/st506/ibm_xebec_62x0822_1985.bin"
|
||||
#define DTC_BIOS_FILE L"roms/hdd/st506/dtc_cxd21a.bin"
|
||||
#define ST11_BIOS_FILE_OLD L"roms/hdd/st506/st11_bios_vers_1.7.bin"
|
||||
#define ST11_BIOS_FILE_NEW L"roms/hdd/st506/st11_bios_vers_2.0.bin"
|
||||
#define WD1002A_WX1_BIOS_FILE L"roms/hdd/st506/wd1002a_wx1-62-000094-032.bin"
|
||||
#define XEBEC_BIOS_FILE "roms/hdd/st506/ibm_xebec_62x0822_1985.bin"
|
||||
#define DTC_BIOS_FILE "roms/hdd/st506/dtc_cxd21a.bin"
|
||||
#define ST11_BIOS_FILE_OLD "roms/hdd/st506/st11_bios_vers_1.7.bin"
|
||||
#define ST11_BIOS_FILE_NEW "roms/hdd/st506/st11_bios_vers_2.0.bin"
|
||||
#define WD1002A_WX1_BIOS_FILE "roms/hdd/st506/wd1002a_wx1-62-000094-032.bin"
|
||||
/* SuperBIOS was for both the WX1 and 27X, users jumpers readout to determine
|
||||
if to use 26 sectors per track, 26 -> 17 sectors per track translation, or
|
||||
17 sectors per track. */
|
||||
#define WD1002A_27X_BIOS_FILE L"roms/hdd/st506/wd1002a_27x-62-000094-032.bin"
|
||||
#define WD1002A_27X_BIOS_FILE "roms/hdd/st506/wd1002a_27x-62-000094-032.bin"
|
||||
|
||||
|
||||
#define ST506_TIME (250 * TIMER_USEC)
|
||||
@@ -1305,7 +1305,7 @@ mem_read(uint32_t addr, void *priv)
|
||||
* standard 'rom_init' function here.
|
||||
*/
|
||||
static void
|
||||
loadrom(hdc_t *dev, const wchar_t *fn)
|
||||
loadrom(hdc_t *dev, const char *fn)
|
||||
{
|
||||
uint32_t size;
|
||||
FILE *fp;
|
||||
@@ -1317,8 +1317,8 @@ loadrom(hdc_t *dev, const wchar_t *fn)
|
||||
return;
|
||||
}
|
||||
|
||||
if ((fp = rom_fopen((wchar_t *) fn, L"rb")) == NULL) {
|
||||
st506_xt_log("ST506: BIOS ROM '%ls' not found!\n", fn);
|
||||
if ((fp = rom_fopen((char *) fn, "rb")) == NULL) {
|
||||
st506_xt_log("ST506: BIOS ROM '%s' not found!\n", fn);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1349,7 +1349,7 @@ loadrom(hdc_t *dev, const wchar_t *fn)
|
||||
|
||||
|
||||
static void
|
||||
loadhd(hdc_t *dev, int c, int d, const wchar_t *fn)
|
||||
loadhd(hdc_t *dev, int c, int d, const char *fn)
|
||||
{
|
||||
drive_t *drive = &dev->drives[c];
|
||||
|
||||
@@ -1423,7 +1423,7 @@ set_switches(hdc_t *dev)
|
||||
static void *
|
||||
st506_init(const device_t *info)
|
||||
{
|
||||
wchar_t *fn = NULL;
|
||||
char *fn = NULL;
|
||||
hdc_t *dev;
|
||||
int i, c;
|
||||
|
||||
@@ -1531,7 +1531,7 @@ st506_init(const device_t *info)
|
||||
#endif
|
||||
for (c = 0, i = 0; i < HDD_NUM; i++) {
|
||||
if ((hdd[i].bus == HDD_BUS_MFM) && (hdd[i].mfm_channel < MFM_NUM)) {
|
||||
st506_xt_log("ST506: disk '%ls' on channel %i\n",
|
||||
st506_xt_log("ST506: disk '%s' on channel %i\n",
|
||||
hdd[i].fn, hdd[i].mfm_channel);
|
||||
loadhd(dev, hdd[i].mfm_channel, i, hdd[i].fn);
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
|
||||
#define HDC_TIME (50*TIMER_USEC)
|
||||
|
||||
#define WD_BIOS_FILE L"roms/hdd/xta/idexywd2.bin"
|
||||
#define WD_BIOS_FILE "roms/hdd/xta/idexywd2.bin"
|
||||
|
||||
|
||||
enum {
|
||||
@@ -995,7 +995,7 @@ static void *
|
||||
xta_init(const device_t *info)
|
||||
{
|
||||
drive_t *drive;
|
||||
wchar_t *fn = NULL;
|
||||
char *fn = NULL;
|
||||
hdc_t *dev;
|
||||
int c, i;
|
||||
int max = XTA_NUM;
|
||||
|
||||
@@ -45,10 +45,10 @@
|
||||
#include <86box/hdc_ide.h>
|
||||
|
||||
|
||||
#define ROM_PATH_XT L"roms/hdd/xtide/ide_xt.bin"
|
||||
#define ROM_PATH_AT L"roms/hdd/xtide/ide_at.bin"
|
||||
#define ROM_PATH_PS2 L"roms/hdd/xtide/SIDE1V12.BIN"
|
||||
#define ROM_PATH_PS2AT L"roms/hdd/xtide/ide_at_1_1_5.bin"
|
||||
#define ROM_PATH_XT "roms/hdd/xtide/ide_xt.bin"
|
||||
#define ROM_PATH_AT "roms/hdd/xtide/ide_at.bin"
|
||||
#define ROM_PATH_PS2 "roms/hdd/xtide/SIDE1V12.BIN"
|
||||
#define ROM_PATH_PS2AT "roms/hdd/xtide/ide_at_1_1_5.bin"
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -142,7 +142,7 @@ hdd_is_valid(int c)
|
||||
if (hdd[c].bus == HDD_BUS_DISABLED)
|
||||
return(0);
|
||||
|
||||
if (wcslen(hdd[c].fn) == 0)
|
||||
if (strlen(hdd[c].fn) == 0)
|
||||
return(0);
|
||||
|
||||
if ((hdd[c].tracks==0) || (hdd[c].hpc==0) || (hdd[c].spt==0))
|
||||
|
||||
@@ -76,16 +76,9 @@ hdd_image_log(const char *fmt, ...)
|
||||
#endif
|
||||
|
||||
int
|
||||
image_is_hdi(const wchar_t *s)
|
||||
image_is_hdi(const char *s)
|
||||
{
|
||||
int len;
|
||||
wchar_t ext[5] = { 0, 0, 0, 0, 0 };
|
||||
char *ws = (char *) s;
|
||||
len = wcslen(s);
|
||||
if ((len < 4) || (s[0] == L'.'))
|
||||
return 0;
|
||||
memcpy(ext, ws + ((len - 4) << 1), 8);
|
||||
if (! wcscasecmp(ext, L".HDI"))
|
||||
if (! strcasecmp(plat_get_extension((char *) s), "HDI"))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
@@ -93,21 +86,16 @@ image_is_hdi(const wchar_t *s)
|
||||
|
||||
|
||||
int
|
||||
image_is_hdx(const wchar_t *s, int check_signature)
|
||||
image_is_hdx(const char *s, int check_signature)
|
||||
{
|
||||
int len;
|
||||
FILE *f;
|
||||
uint64_t filelen;
|
||||
uint64_t signature;
|
||||
char *ws = (char *) s;
|
||||
wchar_t ext[5] = { 0, 0, 0, 0, 0 };
|
||||
len = wcslen(s);
|
||||
if ((len < 4) || (s[0] == L'.'))
|
||||
return 0;
|
||||
memcpy(ext, ws + ((len - 4) << 1), 8);
|
||||
if (wcscasecmp(ext, L".HDX") == 0) {
|
||||
|
||||
if (! strcasecmp(plat_get_extension((char *) s), "HDX")) {
|
||||
if (check_signature) {
|
||||
f = plat_fopen((wchar_t *)s, L"rb");
|
||||
f = plat_fopen(s, "rb");
|
||||
if (!f)
|
||||
return 0;
|
||||
if (fseeko64(f, 0, SEEK_END))
|
||||
@@ -135,19 +123,14 @@ image_is_hdx(const wchar_t *s, int check_signature)
|
||||
|
||||
|
||||
int
|
||||
image_is_vhd(const wchar_t *s, int check_signature)
|
||||
image_is_vhd(const char *s, int check_signature)
|
||||
{
|
||||
int len;
|
||||
FILE* f;
|
||||
char *ws = (char *) s;
|
||||
wchar_t ext[5] = { 0, 0, 0, 0, 0 };
|
||||
len = wcslen(s);
|
||||
if ((len < 4) || (s[0] == L'.'))
|
||||
return 0;
|
||||
memcpy(ext, ws + ((len - 4) << 1), 8);
|
||||
if (wcscasecmp(ext, L".VHD") == 0) {
|
||||
|
||||
if (! strcasecmp(plat_get_extension((char *) s), "VHD")) {
|
||||
if (check_signature) {
|
||||
f = plat_fopen((wchar_t*)s, L"rb");
|
||||
f = plat_fopen(s, "rb");
|
||||
if (!f)
|
||||
return 0;
|
||||
|
||||
@@ -265,8 +248,7 @@ hdd_image_load(int id)
|
||||
uint64_t spt = 0, hpc = 0, tracks = 0;
|
||||
int c, ret;
|
||||
uint64_t s = 0;
|
||||
wchar_t *fn = hdd[id].fn;
|
||||
char fn_multibyte_buf[1200];
|
||||
char *fn = hdd[id].fn;
|
||||
int is_hdx[2] = { 0, 0 };
|
||||
int is_vhd[2] = { 0, 0 };
|
||||
int vhd_error = 0;
|
||||
@@ -301,7 +283,7 @@ hdd_image_load(int id)
|
||||
memset(hdd[id].fn, 0, sizeof(hdd[id].fn));
|
||||
return 0;
|
||||
}
|
||||
hdd_images[id].file = plat_fopen(fn, L"rb+");
|
||||
hdd_images[id].file = plat_fopen(fn, "rb+");
|
||||
if (hdd_images[id].file == NULL) {
|
||||
/* Failed to open existing hard disk image */
|
||||
if (errno == ENOENT) {
|
||||
@@ -313,7 +295,7 @@ hdd_image_load(int id)
|
||||
return 0;
|
||||
}
|
||||
|
||||
hdd_images[id].file = plat_fopen(fn, L"wb+");
|
||||
hdd_images[id].file = plat_fopen(fn, "wb+");
|
||||
if (hdd_images[id].file == NULL) {
|
||||
hdd_image_log("Unable to open image\n");
|
||||
memset(hdd[id].fn, 0, sizeof(hdd[id].fn));
|
||||
@@ -360,8 +342,7 @@ hdd_image_load(int id)
|
||||
((uint64_t) hdd[id].tracks) << 9LL;
|
||||
hdd_images[id].last_sector = (full_size >> 9LL) - 1;
|
||||
|
||||
wcstombs(fn_multibyte_buf, fn, sizeof fn_multibyte_buf);
|
||||
hdd_images[id].vhd = mvhd_create_fixed(fn_multibyte_buf, geometry, &vhd_error, NULL);
|
||||
hdd_images[id].vhd = mvhd_create_fixed(fn, geometry, &vhd_error, NULL);
|
||||
if (hdd_images[id].vhd == NULL)
|
||||
fatal("hdd_image_load(): VHD: Could not create VHD : %s\n", mvhd_strerr(vhd_error));
|
||||
|
||||
@@ -449,16 +430,15 @@ hdd_image_load(int id)
|
||||
} else if (is_vhd[1]) {
|
||||
fclose(hdd_images[id].file);
|
||||
hdd_images[id].file = NULL;
|
||||
wcstombs(fn_multibyte_buf, fn, sizeof fn_multibyte_buf);
|
||||
hdd_images[id].vhd = mvhd_open(fn_multibyte_buf, (bool)0, &vhd_error);
|
||||
hdd_images[id].vhd = mvhd_open(fn, (bool)0, &vhd_error);
|
||||
if (hdd_images[id].vhd == NULL) {
|
||||
if (vhd_error == MVHD_ERR_FILE)
|
||||
fatal("hdd_image_load(): VHD: Error opening VHD file '%s': %s\n", fn_multibyte_buf, strerror(mvhd_errno));
|
||||
fatal("hdd_image_load(): VHD: Error opening VHD file '%s': %s\n", fn, strerror(mvhd_errno));
|
||||
else
|
||||
fatal("hdd_image_load(): VHD: Error opening VHD file '%s': %s\n", fn_multibyte_buf, mvhd_strerr(vhd_error));
|
||||
fatal("hdd_image_load(): VHD: Error opening VHD file '%s': %s\n", fn, mvhd_strerr(vhd_error));
|
||||
}
|
||||
else if (vhd_error == MVHD_ERR_TIMESTAMP) {
|
||||
fatal("hdd_image_load(): VHD: Parent/child timestamp mismatch for VHD file '%s'\n", fn_multibyte_buf);
|
||||
fatal("hdd_image_load(): VHD: Parent/child timestamp mismatch for VHD file '%s'\n", fn);
|
||||
}
|
||||
|
||||
hdd[id].tracks = hdd_images[id].vhd->footer.geom.cyl;
|
||||
@@ -670,7 +650,7 @@ hdd_image_get_type(uint8_t id)
|
||||
void
|
||||
hdd_image_unload(uint8_t id, int fn_preserve)
|
||||
{
|
||||
if (wcslen(hdd[id].fn) == 0)
|
||||
if (strlen(hdd[id].fn) == 0)
|
||||
return;
|
||||
|
||||
if (hdd_images[id].loaded) {
|
||||
@@ -688,7 +668,7 @@ hdd_image_unload(uint8_t id, int fn_preserve)
|
||||
|
||||
memset(hdd[id].prev_fn, 0, sizeof(hdd[id].prev_fn));
|
||||
if (fn_preserve)
|
||||
wcscpy(hdd[id].prev_fn, hdd[id].fn);
|
||||
strcpy(hdd[id].prev_fn, hdd[id].fn);
|
||||
memset(hdd[id].fn, 0, sizeof(hdd[id].fn));
|
||||
}
|
||||
|
||||
|
||||
@@ -330,16 +330,9 @@ mo_load_abort(mo_t *dev)
|
||||
|
||||
|
||||
int
|
||||
image_is_mdi(const wchar_t *s)
|
||||
image_is_mdi(const char *s)
|
||||
{
|
||||
int len;
|
||||
wchar_t ext[5] = { 0, 0, 0, 0, 0 };
|
||||
char *ws = (char *) s;
|
||||
len = wcslen(s);
|
||||
if ((len < 4) || (s[0] == L'.'))
|
||||
return 0;
|
||||
memcpy(ext, ws + ((len - 4) << 1), 8);
|
||||
if (! wcscasecmp(ext, L".MDI"))
|
||||
if (! strcasecmp(plat_get_extension((char *) s), "MDI"))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
@@ -347,7 +340,7 @@ image_is_mdi(const wchar_t *s)
|
||||
|
||||
|
||||
int
|
||||
mo_load(mo_t *dev, wchar_t *fn)
|
||||
mo_load(mo_t *dev, char *fn)
|
||||
{
|
||||
int is_mdi;
|
||||
uint32_t size = 0;
|
||||
@@ -355,10 +348,10 @@ mo_load(mo_t *dev, wchar_t *fn)
|
||||
|
||||
is_mdi = image_is_mdi(fn);
|
||||
|
||||
dev->drv->f = plat_fopen(fn, dev->drv->read_only ? L"rb" : L"rb+");
|
||||
dev->drv->f = plat_fopen(fn, dev->drv->read_only ? "rb" : "rb+");
|
||||
if (!dev->drv->f) {
|
||||
if (!dev->drv->read_only) {
|
||||
dev->drv->f = plat_fopen(fn, L"rb");
|
||||
dev->drv->f = plat_fopen(fn, "rb");
|
||||
if (dev->drv->f)
|
||||
dev->drv->read_only = 1;
|
||||
else
|
||||
@@ -391,7 +384,7 @@ mo_load(mo_t *dev, wchar_t *fn)
|
||||
if (fseek(dev->drv->f, dev->drv->base, SEEK_SET) == -1)
|
||||
fatal("mo_load(): Error seeking to the beginning of the file\n");
|
||||
|
||||
wcsncpy(dev->drv->image_path, fn, sizeof_w(dev->drv->image_path));
|
||||
strncpy(dev->drv->image_path, fn, sizeof(dev->drv->image_path) - 1);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -402,7 +395,7 @@ mo_disk_reload(mo_t *dev)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (wcslen(dev->drv->prev_image_path) == 0)
|
||||
if (strlen(dev->drv->prev_image_path) == 0)
|
||||
return;
|
||||
else
|
||||
ret = mo_load(dev, dev->drv->prev_image_path);
|
||||
@@ -535,7 +528,7 @@ static void
|
||||
mo_mode_sense_load(mo_t *dev)
|
||||
{
|
||||
FILE *f;
|
||||
wchar_t file_name[512];
|
||||
char file_name[512];
|
||||
|
||||
memset(&dev->ms_pages_saved, 0, sizeof(mode_sense_pages_t));
|
||||
if (mo_drives[dev->id].bus_type == MO_BUS_SCSI)
|
||||
@@ -543,12 +536,12 @@ mo_mode_sense_load(mo_t *dev)
|
||||
else
|
||||
memcpy(&dev->ms_pages_saved, &mo_mode_sense_pages_default, sizeof(mode_sense_pages_t));
|
||||
|
||||
memset(file_name, 0, 512 * sizeof(wchar_t));
|
||||
memset(file_name, 0, 512);
|
||||
if (dev->drv->bus_type == MO_BUS_SCSI)
|
||||
swprintf(file_name, 512, L"scsi_mo_%02i_mode_sense_bin", dev->id);
|
||||
sprintf(file_name, "scsi_mo_%02i_mode_sense_bin", dev->id);
|
||||
else
|
||||
swprintf(file_name, 512, L"mo_%02i_mode_sense_bin", dev->id);
|
||||
f = plat_fopen(nvr_path(file_name), L"rb");
|
||||
sprintf(file_name, "mo_%02i_mode_sense_bin", dev->id);
|
||||
f = plat_fopen(nvr_path(file_name), "rb");
|
||||
if (f) {
|
||||
/* Nothing to read, not used by MO. */
|
||||
fclose(f);
|
||||
@@ -560,14 +553,14 @@ static void
|
||||
mo_mode_sense_save(mo_t *dev)
|
||||
{
|
||||
FILE *f;
|
||||
wchar_t file_name[512];
|
||||
char file_name[512];
|
||||
|
||||
memset(file_name, 0, 512 * sizeof(wchar_t));
|
||||
memset(file_name, 0, 512);
|
||||
if (dev->drv->bus_type == MO_BUS_SCSI)
|
||||
swprintf(file_name, 512, L"scsi_mo_%02i_mode_sense_bin", dev->id);
|
||||
sprintf(file_name, "scsi_mo_%02i_mode_sense_bin", dev->id);
|
||||
else
|
||||
swprintf(file_name, 512, L"mo_%02i_mode_sense_bin", dev->id);
|
||||
f = plat_fopen(nvr_path(file_name), L"wb");
|
||||
sprintf(file_name, "mo_%02i_mode_sense_bin", dev->id);
|
||||
f = plat_fopen(nvr_path(file_name), "wb");
|
||||
if (f) {
|
||||
/* Nothing to write, not used by MO. */
|
||||
fclose(f);
|
||||
@@ -2187,7 +2180,7 @@ mo_hard_reset(void)
|
||||
|
||||
mo_init(dev);
|
||||
|
||||
if (wcslen(mo_drives[c].image_path))
|
||||
if (strlen(mo_drives[c].image_path))
|
||||
mo_load(dev, mo_drives[c].image_path);
|
||||
|
||||
mo_mode_sense_load(dev);
|
||||
|
||||
@@ -484,14 +484,14 @@ zip_load_abort(zip_t *dev)
|
||||
|
||||
|
||||
int
|
||||
zip_load(zip_t *dev, wchar_t *fn)
|
||||
zip_load(zip_t *dev, char *fn)
|
||||
{
|
||||
int size = 0;
|
||||
|
||||
dev->drv->f = plat_fopen(fn, dev->drv->read_only ? L"rb" : L"rb+");
|
||||
dev->drv->f = plat_fopen(fn, dev->drv->read_only ? "rb" : "rb+");
|
||||
if (!dev->drv->f) {
|
||||
if (!dev->drv->read_only) {
|
||||
dev->drv->f = plat_fopen(fn, L"rb");
|
||||
dev->drv->f = plat_fopen(fn, "rb");
|
||||
if (dev->drv->f)
|
||||
dev->drv->read_only = 1;
|
||||
else
|
||||
@@ -529,7 +529,7 @@ zip_load(zip_t *dev, wchar_t *fn)
|
||||
if (fseek(dev->drv->f, dev->drv->base, SEEK_SET) == -1)
|
||||
fatal("zip_load(): Error seeking to the beginning of the file\n");
|
||||
|
||||
wcsncpy(dev->drv->image_path, fn, sizeof_w(dev->drv->image_path));
|
||||
strncpy(dev->drv->image_path, fn, sizeof(dev->drv->image_path) - 1);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -540,7 +540,7 @@ zip_disk_reload(zip_t *dev)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (wcslen(dev->drv->prev_image_path) == 0)
|
||||
if (strlen(dev->drv->prev_image_path) == 0)
|
||||
return;
|
||||
else
|
||||
ret = zip_load(dev, dev->drv->prev_image_path);
|
||||
@@ -673,7 +673,7 @@ static void
|
||||
zip_mode_sense_load(zip_t *dev)
|
||||
{
|
||||
FILE *f;
|
||||
wchar_t file_name[512];
|
||||
char file_name[512];
|
||||
|
||||
memset(&dev->ms_pages_saved, 0, sizeof(mode_sense_pages_t));
|
||||
if (dev->drv->is_250) {
|
||||
@@ -688,12 +688,12 @@ zip_mode_sense_load(zip_t *dev)
|
||||
memcpy(&dev->ms_pages_saved, &zip_mode_sense_pages_default, sizeof(mode_sense_pages_t));
|
||||
}
|
||||
|
||||
memset(file_name, 0, 512 * sizeof(wchar_t));
|
||||
memset(file_name, 0, 512);
|
||||
if (dev->drv->bus_type == ZIP_BUS_SCSI)
|
||||
swprintf(file_name, 512, L"scsi_zip_%02i_mode_sense_bin", dev->id);
|
||||
sprintf(file_name, "scsi_zip_%02i_mode_sense_bin", dev->id);
|
||||
else
|
||||
swprintf(file_name, 512, L"zip_%02i_mode_sense_bin", dev->id);
|
||||
f = plat_fopen(nvr_path(file_name), L"rb");
|
||||
sprintf(file_name, "zip_%02i_mode_sense_bin", dev->id);
|
||||
f = plat_fopen(nvr_path(file_name), "rb");
|
||||
if (f) {
|
||||
/* Nothing to read, not used by ZIP. */
|
||||
fclose(f);
|
||||
@@ -705,14 +705,14 @@ static void
|
||||
zip_mode_sense_save(zip_t *dev)
|
||||
{
|
||||
FILE *f;
|
||||
wchar_t file_name[512];
|
||||
char file_name[512];
|
||||
|
||||
memset(file_name, 0, 512 * sizeof(wchar_t));
|
||||
memset(file_name, 0, 512);
|
||||
if (dev->drv->bus_type == ZIP_BUS_SCSI)
|
||||
swprintf(file_name, 512, L"scsi_zip_%02i_mode_sense_bin", dev->id);
|
||||
sprintf(file_name, "scsi_zip_%02i_mode_sense_bin", dev->id);
|
||||
else
|
||||
swprintf(file_name, 512, L"zip_%02i_mode_sense_bin", dev->id);
|
||||
f = plat_fopen(nvr_path(file_name), L"wb");
|
||||
sprintf(file_name, "zip_%02i_mode_sense_bin", dev->id);
|
||||
f = plat_fopen(nvr_path(file_name), "wb");
|
||||
if (f) {
|
||||
/* Nothing to write, not used by ZIP. */
|
||||
fclose(f);
|
||||
@@ -2404,7 +2404,7 @@ zip_hard_reset(void)
|
||||
|
||||
zip_init(dev);
|
||||
|
||||
if (wcslen(zip_drives[c].image_path))
|
||||
if (strlen(zip_drives[c].image_path))
|
||||
zip_load(dev, zip_drives[c].image_path);
|
||||
|
||||
zip_mode_sense_load(dev);
|
||||
|
||||
Reference in New Issue
Block a user