More general cleanups and bugfixes.

This commit is contained in:
waltje
2017-10-13 02:44:32 -04:00
parent 97b3ca3430
commit e9bd160ad1
19 changed files with 124 additions and 130 deletions

View File

@@ -70,12 +70,9 @@ uint8_t scsi_cdrom_drives[16][8] = { { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } }; { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } };
#ifdef __MSC__
# pragma pack(push,1) #pragma pack(push,1)
static struct static struct
#else
static struct __attribute__((__packed__))
#endif
{ {
uint8_t opcode; uint8_t opcode;
uint8_t polled; uint8_t polled;
@@ -85,24 +82,17 @@ static struct __attribute__((__packed__))
uint16_t len; uint16_t len;
uint8_t control; uint8_t control;
} *gesn_cdb; } *gesn_cdb;
#ifdef __MSC__ #pragma pack(pop)
# pragma pack(pop)
#endif
#ifdef __MSC__ #pragma pack(push,1)
# pragma pack(push,1)
static struct static struct
#else
static struct __attribute__((__packed__))
#endif
{ {
uint16_t len; uint16_t len;
uint8_t notification_class; uint8_t notification_class;
uint8_t supported_events; uint8_t supported_events;
} *gesn_event_header; } *gesn_event_header;
#ifdef __MSC__ #pragma pack(pop)
# pragma pack(pop)
#endif
/* Table of all SCSI commands and their flags, needed for the new disc change / not ready handler. */ /* Table of all SCSI commands and their flags, needed for the new disc change / not ready handler. */
uint8_t cdrom_command_flags[0x100] = uint8_t cdrom_command_flags[0x100] =
@@ -3989,24 +3979,41 @@ void cdrom_hard_reset(void)
} }
} }
void cdrom_general_init(void)
{
int c = 0;
#if 0 /* Peform a master init on the entire module. */
void
cdrom_global_init(void)
{
int c;
/* Clear the global data. */
memset(cdrom, 0x00, sizeof(cdrom));
memset(cdrom_drives, 0x00, sizeof(cdrom_drives));
/* Initialize the host devices, if any. */
cdrom_init_host_drives(); cdrom_init_host_drives();
#endif
/* Set all drives to NULL mode. */
for (c=0; c<CDROM_NUM; c++)
cdrom_null_open(c, cdrom_drives[c].host_drive);
}
void
cdrom_global_reset(void)
{
int c;
for (c=0; c<CDROM_NUM; c++) { for (c=0; c<CDROM_NUM; c++) {
if (cdrom_drives[c].bus_type) { if (cdrom_drives[c].bus_type) {
SCSIReset(cdrom_drives[c].scsi_device_id, cdrom_drives[c].scsi_device_lun); SCSIReset(cdrom_drives[c].scsi_device_id, cdrom_drives[c].scsi_device_lun);
} }
pclog("CDROM global_reset drive=%d host=%02x\n", c, cdrom_drives[c].host_drive);
if (cdrom_drives[c].host_drive == 200) { if (cdrom_drives[c].host_drive == 200) {
image_open(c, cdrom_image[c].image_path); image_open(c, cdrom_image[c].image_path);
} else } else
if ((cdrom_drives[c].host_drive>='A') && (cdrom_drives[c].host_drive <= 'Z')) if ((cdrom_drives[c].host_drive>='A') && (cdrom_drives[c].host_drive <= 'Z')) {
{
ioctl_open(c, cdrom_drives[c].host_drive); ioctl_open(c, cdrom_drives[c].host_drive);
} else { } else {
cdrom_null_open(c, cdrom_drives[c].host_drive); cdrom_null_open(c, cdrom_drives[c].host_drive);

View File

@@ -9,10 +9,11 @@
* Implementation of the CD-ROM drive with SCSI(-like) * Implementation of the CD-ROM drive with SCSI(-like)
* commands, for both ATAPI and SCSI usage. * commands, for both ATAPI and SCSI usage.
* *
* Version: @(#)cdrom.h 1.0.1 2017/06/03 * Version: @(#)cdrom.h 1.0.2 2017/10/12
* *
* Author: Miran Grca, <mgrca8@gmail.com> * Author: Miran Grca, <mgrca8@gmail.com>
* Copyright 2016-2017 Miran Grca. *
* Copyright 2016,2017 Miran Grca.
*/ */
#ifndef EMU_CDROM_H #ifndef EMU_CDROM_H
#define EMU_CDROM_H #define EMU_CDROM_H
@@ -41,6 +42,7 @@ typedef struct {
int (*ready)(uint8_t id); int (*ready)(uint8_t id);
int (*medium_changed)(uint8_t id); int (*medium_changed)(uint8_t id);
int (*media_type_id)(uint8_t id); int (*media_type_id)(uint8_t id);
void (*audio_callback)(uint8_t id, int16_t *output, int len); void (*audio_callback)(uint8_t id, int16_t *output, int len);
void (*audio_stop)(uint8_t id); void (*audio_stop)(uint8_t id);
int (*readtoc)(uint8_t id, uint8_t *b, uint8_t starttrack, int msf, int maxlen, int single); int (*readtoc)(uint8_t id, uint8_t *b, uint8_t starttrack, int msf, int maxlen, int single);
@@ -61,7 +63,6 @@ typedef struct {
void (*exit)(uint8_t id); void (*exit)(uint8_t id);
} CDROM; } CDROM;
#pragma pack(push,1)
typedef struct { typedef struct {
uint8_t previous_command; uint8_t previous_command;
@@ -132,9 +133,7 @@ typedef struct {
int init_length; int init_length;
} cdrom_t; } cdrom_t;
#pragma pack(pop)
#pragma pack(push,1)
typedef struct { typedef struct {
int max_blocks_at_once; int max_blocks_at_once;
@@ -155,7 +154,6 @@ typedef struct {
unsigned int sound_on; unsigned int sound_on;
unsigned int atapi_dma; unsigned int atapi_dma;
} cdrom_drive_t; } cdrom_drive_t;
#pragma pack(pop)
typedef struct { typedef struct {
int image_is_iso; int image_is_iso;
@@ -229,14 +227,15 @@ int cdrom_lba_to_msf_accurate(int lba);
} }
#endif #endif
void cdrom_reset(uint8_t id); extern void cdrom_close(uint8_t id);
void cdrom_set_signature(int id); extern void cdrom_reset(uint8_t id);
void cdrom_request_sense_for_scsi(uint8_t id, uint8_t *buffer, uint8_t alloc_length); extern void cdrom_set_signature(int id);
void cdrom_update_cdb(uint8_t *cdb, int lba_pos, int number_of_blocks); extern void cdrom_request_sense_for_scsi(uint8_t id, uint8_t *buffer, uint8_t alloc_length);
void cdrom_insert(uint8_t id); extern void cdrom_update_cdb(uint8_t *cdb, int lba_pos, int number_of_blocks);
extern void cdrom_insert(uint8_t id);
int find_cdrom_for_scsi_id(uint8_t scsi_id, uint8_t scsi_lun); extern int find_cdrom_for_scsi_id(uint8_t scsi_id, uint8_t scsi_lun);
int cdrom_read_capacity(uint8_t id, uint8_t *cdb, uint8_t *buffer, uint32_t *len); extern int cdrom_read_capacity(uint8_t id, uint8_t *cdb, uint8_t *buffer, uint32_t *len);
#define cdrom_sense_error cdrom[id].sense[0] #define cdrom_sense_error cdrom[id].sense[0]
#define cdrom_sense_key cdrom[id].sense[2] #define cdrom_sense_key cdrom[id].sense[2]
@@ -244,9 +243,9 @@ int cdrom_read_capacity(uint8_t id, uint8_t *cdb, uint8_t *buffer, uint32_t *len
#define cdrom_ascq cdrom[id].sense[13] #define cdrom_ascq cdrom[id].sense[13]
#define cdrom_drive cdrom_drives[id].host_drive #define cdrom_drive cdrom_drives[id].host_drive
extern void cdrom_close(uint8_t id); extern void cdrom_global_init(void);
extern void cdrom_global_reset(void);
extern void cdrom_hard_reset(void); extern void cdrom_hard_reset(void);
extern void cdrom_general_init(void);
#endif /*EMU_CDROM_H*/ #endif /*EMU_CDROM_H*/

View File

@@ -991,7 +991,7 @@ int image_open(uint8_t id, wchar_t *fn)
if (!cdrom_image[id].image_inited || cdrom_image[id].image_changed) if (!cdrom_image[id].image_inited || cdrom_image[id].image_changed)
{ {
swprintf(cdrom_image[id].image_path, sizeof(cdrom_image[id].image_path)/sizeof(wchar_t), L"%ws", fn); swprintf(cdrom_image[id].image_path, sizeof(cdrom_image[id].image_path)/sizeof(wchar_t), L"%S", fn);
} }
if (! wcscasecmp(get_extension_w(fn), L"ISO")) if (! wcscasecmp(get_extension_w(fn), L"ISO"))

View File

@@ -8,7 +8,7 @@
* *
* Configuration file handler. * Configuration file handler.
* *
* Version: @(#)config.c 1.0.18 2017/10/12 * Version: @(#)config.c 1.0.19 2017/10/12
* *
* Authors: Sarah Walker, * Authors: Sarah Walker,
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -258,6 +258,10 @@ config_read(wchar_t *fn)
fgetws(buff, sizeof(buff)-1, f); fgetws(buff, sizeof(buff)-1, f);
if (feof(f)) break; if (feof(f)) break;
/* Make sure there are no stray newlines or hard-returns in there. */
if (buff[wcslen(buff)-1] == L'\n') buff[wcslen(buff)-1] = L'\0';
if (buff[wcslen(buff)-1] == L'\r') buff[wcslen(buff)-1] = L'\0';
c = 0; c = 0;
while (buff[c] == L' ') while (buff[c] == L' ')
c++; c++;
@@ -353,9 +357,9 @@ config_write(wchar_t *fn)
if (sec->name[0]) { if (sec->name[0]) {
mbstowcs(wname, sec->name, strlen(sec->name)+1); mbstowcs(wname, sec->name, strlen(sec->name)+1);
if (fl) if (fl)
fwprintf(f, L"\n[%ws]\n", wname); fwprintf(f, L"\n[%S]\n", wname);
else else
fwprintf(f, L"[%ws]\n", wname); fwprintf(f, L"[%S]\n", wname);
fl++; fl++;
} }
@@ -364,9 +368,9 @@ config_write(wchar_t *fn)
if (ent->name[0]) { if (ent->name[0]) {
mbstowcs(wname, ent->name, strlen(ent->name)+1); mbstowcs(wname, ent->name, strlen(ent->name)+1);
if (ent->wdata[0] == L'\0') if (ent->wdata[0] == L'\0')
fwprintf(f, L"%ws = \n", wname); fwprintf(f, L"%S = \n", wname);
else else
fwprintf(f, L"%ws = %ws\n", wname, ent->wdata); fwprintf(f, L"%S = %S\n", wname, ent->wdata);
fl++; fl++;
} }
@@ -964,7 +968,7 @@ load_removable_devices(void)
memcpy(floppyfns[c], wp, (wcslen(wp) << 1) + 2); memcpy(floppyfns[c], wp, (wcslen(wp) << 1) + 2);
if (*wp != L'\0') if (*wp != L'\0')
printf("Floppy%d: %ws\n", c, floppyfns[c]); printf("Floppy%d: %S\n", c, floppyfns[c]);
sprintf(temp, "fdd_%02i_writeprot", c+1); sprintf(temp, "fdd_%02i_writeprot", c+1);
ui_writeprot[c] = !!config_get_int(cat, temp, 0); ui_writeprot[c] = !!config_get_int(cat, temp, 0);
sprintf(temp, "fdd_%02i_turbo", c + 1); sprintf(temp, "fdd_%02i_turbo", c + 1);
@@ -1107,7 +1111,7 @@ config_load(wchar_t *fn)
{ {
if (fn == NULL) if (fn == NULL)
fn = config_file_default; fn = config_file_default;
pclog("Loading config file '%ws'..\n", fn); pclog("Loading config file '%S'..\n", fn);
if (! config_read(fn)) { if (! config_read(fn)) {
cpu = 0; cpu = 0;
@@ -1963,6 +1967,7 @@ config_set_wstring(char *head, char *name, wchar_t *val)
} }
#if 0
/* FIXME: should be moved elsewhere. --FvK */ /* FIXME: should be moved elsewhere. --FvK */
char * char *
get_filename(char *s) get_filename(char *s)
@@ -1977,6 +1982,7 @@ get_filename(char *s)
return(s); return(s);
} }
#endif
/* FIXME: should be moved elsewhere. --FvK */ /* FIXME: should be moved elsewhere. --FvK */
@@ -1995,23 +2001,26 @@ get_filename_w(wchar_t *s)
} }
#if 0
/* FIXME: should be moved elsewhere. --FvK */ /* FIXME: should be moved elsewhere. --FvK */
void void
append_filename(char *dest, char *s1, char *s2, int size) append_filename(char *dest, char *s1, char *s2, int size)
{ {
sprintf(dest, "%s%s", s1, s2); sprintf(dest, "%s%s", s1, s2);
} }
#endif
/* FIXME: should be moved elsewhere. --FvK */ /* FIXME: should be moved elsewhere. --FvK */
void void
append_filename_w(wchar_t *dest, wchar_t *s1, wchar_t *s2, int size) append_filename_w(wchar_t *dest, wchar_t *s1, wchar_t *s2, int size)
{ {
/* We assume 512 here (pathnames) which "should" be safe. --FvK */ wcscat(dest, s1);
swprintf(dest, 512, L"%s%s", s1, s2); wcscat(dest, s2);
} }
#if 0
/* FIXME: should be moved elsewhere. --FvK */ /* FIXME: should be moved elsewhere. --FvK */
void void
put_backslash(char *s) put_backslash(char *s)
@@ -2021,6 +2030,7 @@ put_backslash(char *s)
if (s[c] != '/' && s[c] != '\\') if (s[c] != '/' && s[c] != '\\')
s[c] = '/'; s[c] = '/';
} }
#endif
/* FIXME: should be moved elsewhere. --FvK */ /* FIXME: should be moved elsewhere. --FvK */

View File

@@ -50,12 +50,6 @@ int cgate32;
uint32_t cr2, cr3, cr4; uint32_t cr2, cr3, cr4;
uint32_t dr[8]; uint32_t dr[8];
#if FIXME
/* in mem.c and rom.c */
uint8_t romext[32768];
uint8_t *ram,*rom;
#endif
uint32_t rmdat32; uint32_t rmdat32;
#define rmdat rmdat32 #define rmdat rmdat32
#define fetchdat rmdat32 #define fetchdat rmdat32

View File

@@ -51,11 +51,6 @@ uint16_t ea_rseg;
int cgate32; int cgate32;
#if FIXME
uint8_t romext[32768];
uint8_t *ram,*rom;
#endif
uint32_t rmdat32; uint32_t rmdat32;
uint32_t backupregs[16]; uint32_t backupregs[16];
int oddeven=0; int oddeven=0;

View File

@@ -543,7 +543,7 @@ static x86seg *FETCH_EA_16(x86seg *op_ea_seg, uint32_t fetchdat, int op_ssegs, u
} }
else else
{ {
int base_reg, index_reg; int base_reg = 0, index_reg = 0;
switch (rm) switch (rm)
{ {

View File

@@ -64,7 +64,9 @@ static int last_ssegs;
void codegen_init() void codegen_init()
{ {
#if UNUSED
int c; int c;
#endif
#ifdef __linux__ #ifdef __linux__
void *start; void *start;
size_t len; size_t len;
@@ -238,7 +240,9 @@ void codegen_check_flush(page_t *page, uint64_t mask, uint32_t phys_addr)
void codegen_block_init(uint32_t phys_addr) void codegen_block_init(uint32_t phys_addr)
{ {
codeblock_t *block; codeblock_t *block;
#if UNUSED
int has_evicted = 0; int has_evicted = 0;
#endif
page_t *page = &pages[phys_addr >> 12]; page_t *page = &pages[phys_addr >> 12];
if (!page->block[(phys_addr >> 10) & 3]) if (!page->block[(phys_addr >> 10) & 3])
@@ -278,7 +282,9 @@ void codegen_block_init(uint32_t phys_addr)
void codegen_block_start_recompile(codeblock_t *block) void codegen_block_start_recompile(codeblock_t *block)
{ {
#if UNUSED
int has_evicted = 0; int has_evicted = 0;
#endif
page_t *page = &pages[block->phys >> 12]; page_t *page = &pages[block->phys >> 12];
if (!page->block[(block->phys >> 10) & 3]) if (!page->block[(block->phys >> 10) & 3])
@@ -594,7 +600,7 @@ static x86seg *codegen_generate_ea_16_long(x86seg *op_ea_seg, uint32_t fetchdat,
} }
else else
{ {
int base_reg, index_reg; int base_reg = 0, index_reg = 0;
switch (cpu_rm) switch (cpu_rm)
{ {
@@ -1078,11 +1084,11 @@ void codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t
generate_call: generate_call:
codegen_timing_opcode(opcode, fetchdat, op_32); codegen_timing_opcode(opcode, fetchdat, op_32);
if ((op_table == x86_dynarec_opcodes && if (((op_table == x86_dynarec_opcodes) &&
((opcode & 0xf0) == 0x70 || (opcode & 0xfc) == 0xe0 || opcode == 0xc2 || (((opcode & 0xf0) == 0x70) || ((opcode & 0xfc) == 0xe0) || (opcode == 0xc2) ||
(opcode & 0xfe) == 0xca || (opcode & 0xfc) == 0xcc || (opcode & 0xfc) == 0xe8 || ((opcode & 0xfe) == 0xca) || ((opcode & 0xfc) == 0xcc) || ((opcode & 0xfc) == 0xe8) ||
(opcode == 0xff && ((fetchdat & 0x38) >= 0x10 && (fetchdat & 0x38) < 0x30))) || ((opcode == 0xff) && (((fetchdat & 0x38) >= 0x10) && ((fetchdat & 0x38) < 0x30)))) ||
(op_table == x86_dynarec_opcodes_0f && ((opcode & 0xf0) == 0x80)))) ((op_table == x86_dynarec_opcodes_0f) && ((opcode & 0xf0) == 0x80))))
{ {
/*Opcode is likely to cause block to exit, update cycle count*/ /*Opcode is likely to cause block to exit, update cycle count*/
if (codegen_block_cycles) if (codegen_block_cycles)

View File

@@ -103,7 +103,7 @@ image_is_hdx(const wchar_t *s, int check_signature)
return 0; return 0;
} }
memcpy(ext, ws + ((len - 4) << 1), 8); memcpy(ext, ws + ((len - 4) << 1), 8);
if (wcsicmp(ext, L".HDX") == 0) if (wcscasecmp(ext, L".HDX") == 0)
{ {
if (check_signature) if (check_signature)
{ {

View File

@@ -156,7 +156,7 @@ void floppy_load(int drive, wchar_t *fn)
} }
c++; c++;
} }
pclog("Couldn't load %ws %s\n",fn,p); pclog("Couldn't load %S %s\n",fn,p);
drive_empty[drive] = 1; drive_empty[drive] = 1;
fdd_set_head(real_drive(drive), 0); fdd_set_head(real_drive(drive), 0);
memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));

View File

@@ -198,7 +198,7 @@ void *intel_flash_init(uint8_t type)
wcscpy(flash_path, flash_name); wcscpy(flash_path, flash_name);
pclog("Flash path: %ws\n", flash_name); pclog("Flash path: %S\n", flash_name);
flash->flash_id = (type & FLASH_IS_BXB) ? 0x95 : 0x94; flash->flash_id = (type & FLASH_IS_BXB) ? 0x95 : 0x94;
flash->invert_high_pin = (type & FLASH_INVERT); flash->invert_high_pin = (type & FLASH_INVERT);

View File

@@ -186,7 +186,7 @@
* (DS12887A) which implemented a "century" register to be * (DS12887A) which implemented a "century" register to be
* compatible with Y2K. * compatible with Y2K.
* *
* Version: @(#)nvr.c 1.0.7 2017/10/12 * Version: @(#)nvr.c 1.0.8 2017/10/12
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -680,7 +680,7 @@ nvr_load(void)
/* We are responsible for loading. */ /* We are responsible for loading. */
f = NULL; f = NULL;
if (saved_nvr->mask != 0) { if (saved_nvr->mask != 0) {
pclog("Opening NVR file: %ws...\n", saved_nvr->fname); pclog("Opening NVR file: %S...\n", saved_nvr->fname);
f = plat_fopen(nvr_path(saved_nvr->fname), L"rb"); f = plat_fopen(nvr_path(saved_nvr->fname), L"rb");
} }
@@ -723,7 +723,7 @@ nvr_save(void)
/* We are responsible for saving. */ /* We are responsible for saving. */
f = NULL; f = NULL;
if (saved_nvr->mask != 0) { if (saved_nvr->mask != 0) {
pclog("Saving NVR file: %ws...\n", saved_nvr->fname); pclog("Saving NVR file: %S...\n", saved_nvr->fname);
f = plat_fopen(nvr_path(saved_nvr->fname), L"wb"); f = plat_fopen(nvr_path(saved_nvr->fname), L"wb");
} }

View File

@@ -67,12 +67,6 @@
#include "sound/snd_ssi2001.h" #include "sound/snd_ssi2001.h"
#include "video/video.h" #include "video/video.h"
#include "video/vid_voodoo.h" #include "video/vid_voodoo.h"
#ifdef WALTJE
# define UNICODE
# include <direct.h>
# include "plat_dir.h"
# undef UNICODE
#endif
#include "ui.h" #include "ui.h"
#include "plat.h" #include "plat.h"
#include "plat_joystick.h" #include "plat_joystick.h"
@@ -192,12 +186,7 @@ pc_concat(wchar_t *str)
int int
pc_init(int argc, wchar_t *argv[]) pc_init(int argc, wchar_t *argv[])
{ {
wchar_t *cfg = NULL; wchar_t *cfg = NULL, *p;
wchar_t *p;
#ifdef WALTJE
struct direct *dp;
DIR *dir;
#endif
int c; int c;
/* Grab the executable's full path. */ /* Grab the executable's full path. */
@@ -227,33 +216,19 @@ usage:
printf("-P or --vmpath path - set 'path' to be root for vm\n"); printf("-P or --vmpath path - set 'path' to be root for vm\n");
printf("\nA config file can be specified. If none ie, the default file will be used.\n"); printf("\nA config file can be specified. If none ie, the default file will be used.\n");
return(0); return(0);
} else if (!_wcsicmp(argv[c], L"--dump") || } else if (!wcscasecmp(argv[c], L"--dump") ||
!_wcsicmp(argv[c], L"-D")) { !wcscasecmp(argv[c], L"-D")) {
dump_on_exit = 1; dump_on_exit = 1;
} else if (!_wcsicmp(argv[c], L"--fullscreen") || } else if (!wcscasecmp(argv[c], L"--fullscreen") ||
!_wcsicmp(argv[c], L"-F")) { !wcscasecmp(argv[c], L"-F")) {
start_in_fullscreen = 1; start_in_fullscreen = 1;
} else if (!_wcsicmp(argv[c], L"--vmpath") || } else if (!wcscasecmp(argv[c], L"--vmpath") ||
!_wcsicmp(argv[c], L"-P")) { !wcscasecmp(argv[c], L"-P")) {
if ((c+1) == argc) break; if ((c+1) == argc) break;
wcscpy(cfg_path, argv[++c]); wcscpy(cfg_path, argv[++c]);
} else if (!_wcsicmp(argv[c], L"--test")) { } else if (!wcscasecmp(argv[c], L"--test")) {
/* some (undocumented) test function here.. */ /* some (undocumented) test function here.. */
#ifdef WALTJE
dir = opendirw(exe_path);
if (dir != NULL) {
printf("Directory '%ws':\n", exe_path);
for (;;) {
dp = readdir(dir);
if (dp == NULL) break;
printf(">> '%ws'\n", dp->d_name);
}
closedir(dir);
} else {
printf("Could not open '%ws'..\n", exe_path);
}
#endif
/* .. and then exit. */ /* .. and then exit. */
return(0); return(0);
@@ -275,12 +250,16 @@ usage:
*/ */
/* Make sure cfg_path has a trailing backslash. */ /* Make sure cfg_path has a trailing backslash. */
pclog("exe_path=%ws\n", exe_path); pclog("exe_path=%S\n", exe_path);
if ((cfg_path[wcslen(cfg_path)-1] != L'\\') && if ((cfg_path[wcslen(cfg_path)-1] != L'\\') &&
(cfg_path[wcslen(cfg_path)-1] != L'/')) { (cfg_path[wcslen(cfg_path)-1] != L'/')) {
#ifdef WIN32
wcscat(cfg_path, L"\\"); wcscat(cfg_path, L"\\");
#else
wcscat(cfg_path, L"/");
#endif
} }
pclog("cfg_path=%ws\n", cfg_path); pclog("cfg_path=%S\n", cfg_path);
if (cfg != NULL) { if (cfg != NULL) {
/* /*
@@ -291,10 +270,13 @@ usage:
* Otherwise, assume the pathname given is * Otherwise, assume the pathname given is
* relative to whatever the cfg_path is. * relative to whatever the cfg_path is.
*/ */
#ifdef WIN32
if ((cfg[1] == L':') || /* drive letter present */ if ((cfg[1] == L':') || /* drive letter present */
(cfg[0] == L'\\')) /* backslash, root dir */ (cfg[0] == L'\\')) /* backslash, root dir */
append_filename_w(config_file_default, #else
NULL, cfg, 511); if (cfg[0] == L'/') /* slash, root dir */
#endif
wcscpy(config_file_default, cfg);
else else
append_filename_w(config_file_default, append_filename_w(config_file_default,
cfg_path, cfg, 511); cfg_path, cfg, 511);
@@ -311,7 +293,7 @@ usage:
*/ */
hdd_init(); hdd_init();
network_init(); network_init();
cdrom_init_host_drives(); cdrom_global_init();
/* Load the configuration file. */ /* Load the configuration file. */
config_load(cfg); config_load(cfg);
@@ -435,7 +417,7 @@ again2:
ide_init_first(); ide_init_first();
cdrom_general_init(); cdrom_global_reset();
device_init(); device_init();

View File

@@ -13,7 +13,7 @@
* - c386sx16 BIOS fails checksum * - c386sx16 BIOS fails checksum
* - the loadfont() calls should be done elsewhere * - the loadfont() calls should be done elsewhere
* *
* Version: @(#)rom.c 1.0.9 2017/10/12 * Version: @(#)rom.c 1.0.10 2017/10/12
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -135,7 +135,7 @@ rom_load_linear(wchar_t *fn, uint32_t addr, int sz, int off, uint8_t *ptr)
FILE *f = rom_fopen(fn, L"rb"); FILE *f = rom_fopen(fn, L"rb");
if (f == NULL) { if (f == NULL) {
pclog("ROM: image '%ws' not found\n", fn); pclog("ROM: image '%S' not found\n", fn);
return(0); return(0);
} }
@@ -166,9 +166,9 @@ rom_load_interleaved(wchar_t *fnl, wchar_t *fnh, uint32_t addr, int sz, int off,
int c; int c;
if (fl == NULL || fh == NULL) { if (fl == NULL || fh == NULL) {
if (fl == NULL) pclog("ROM: image '%ws' not found\n", fnl); if (fl == NULL) pclog("ROM: image '%S' not found\n", fnl);
else (void)fclose(fl); else (void)fclose(fl);
if (fh == NULL) pclog("ROM: image '%ws' not found\n", fnh); if (fh == NULL) pclog("ROM: image '%S' not found\n", fnh);
else (void)fclose(fh); else (void)fclose(fh);
return(0); return(0);

View File

@@ -12,7 +12,7 @@
* *
* NOTE: THIS IS CURRENTLY A MESS, but will be cleaned up as I go. * NOTE: THIS IS CURRENTLY A MESS, but will be cleaned up as I go.
* *
* Version: @(#)scsi_aha154x.c 1.0.27 2017/10/11 * Version: @(#)scsi_aha154x.c 1.0.28 2017/10/12
* *
* Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Original Buslogic version by SA1988 and Miran Grca. * Original Buslogic version by SA1988 and Miran Grca.
@@ -2030,7 +2030,7 @@ aha_setbios(aha_t *dev)
if (dev->bios_path == NULL) return; if (dev->bios_path == NULL) return;
/* Open the BIOS image file and make sure it exists. */ /* Open the BIOS image file and make sure it exists. */
pclog("%s: loading BIOS from '%ws'\n", dev->name, dev->bios_path); pclog("%s: loading BIOS from '%S'\n", dev->name, dev->bios_path);
if ((f = rom_fopen(dev->bios_path, L"rb")) == NULL) { if ((f = rom_fopen(dev->bios_path, L"rb")) == NULL) {
pclog("%s: BIOS ROM not found!\n", dev->name); pclog("%s: BIOS ROM not found!\n", dev->name);
return; return;

View File

@@ -43,7 +43,7 @@ static Bit32s getPANFactor(Bit32s panSetting) {
if (firstRun) { if (firstRun) {
firstRun = false; firstRun = false;
for (Bit32u i = 1; i < PAN_FACTORS_COUNT; i++) { for (Bit32u i = 1; i < (Bit32u)PAN_FACTORS_COUNT; i++) {
PAN_FACTORS[i] = Bit32s(0.5 + i * 8192.0 / double(PAN_FACTORS_COUNT - 1)); PAN_FACTORS[i] = Bit32s(0.5 + i * 8192.0 / double(PAN_FACTORS_COUNT - 1));
} }
} }

View File

@@ -8,7 +8,7 @@
* *
* Define the various UI functions. * Define the various UI functions.
* *
* Version: @(#)ui.h 1.0.2 2017/10/09 * Version: @(#)ui.h 1.0.2 2017/10/12
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
@@ -28,7 +28,7 @@ extern "C" {
#ifdef WIN32 #ifdef WIN32
# include "win/resource.h" # include "win/resource.h"
#else #else
# include "lnx/strings.h" # include "linux/strings.h"
#endif #endif

View File

@@ -8,10 +8,11 @@
* *
* Windows resource script. * Windows resource script.
* *
* Version: @(#)86Box.rc 1.0.15 2017/10/05 * Version: @(#)86Box.rc 1.0.16 2017/10/12
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2016,2017 Miran Grca. * Copyright 2016,2017 Miran Grca.
*/ */
#include <inttypes.h> #include <inttypes.h>
@@ -816,7 +817,7 @@ BEGIN
IDS_2155 "IRQ %i" IDS_2155 "IRQ %i"
IDS_2156 "%" PRIu64 IDS_2156 "%" PRIu64
IDS_2157 "%" PRIu64 " MB (CHS: %" PRIu64 ", %" PRIu64 ", %" PRIu64 ")" IDS_2157 "%" PRIu64 " MB (CHS: %" PRIu64 ", %" PRIu64 ", %" PRIu64 ")"
IDS_2158 "Floppy %i (%s): %ws" IDS_2158 "Floppy %i (%s): %S"
IDS_2159"All floppy images (*.0??;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.JSON;*.TD0;*.VFD;*.XDF)\0*.0??;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.JSON;*.TD0;*.VFD;*.XDF\0Advanced sector-based images (*.IMD;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector-based images (*.0??;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMG;*.JSON;*.VFD;*.XDF)\0*.0??;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMG;*.JSON;*.VFD;*.XDF\0Flux images (*.FDI)\0*.FDI\0Surface-based images (*.86F)\0*.86F\0All files (*.*)\0*.*\0" IDS_2159"All floppy images (*.0??;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.JSON;*.TD0;*.VFD;*.XDF)\0*.0??;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.JSON;*.TD0;*.VFD;*.XDF\0Advanced sector-based images (*.IMD;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector-based images (*.0??;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMG;*.JSON;*.VFD;*.XDF)\0*.0??;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMG;*.JSON;*.VFD;*.XDF\0Flux images (*.FDI)\0*.FDI\0Surface-based images (*.86F)\0*.86F\0All files (*.*)\0*.*\0"
IDS_2160 "Configuration files (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0" IDS_2160 "Configuration files (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0"
IDS_2161 "&New image..." IDS_2161 "&New image..."
@@ -862,7 +863,7 @@ BEGIN
IDS_4112 "Please enter a valid file name" IDS_4112 "Please enter a valid file name"
IDS_4113 "Remember to partition and format the new drive" IDS_4113 "Remember to partition and format the new drive"
IDS_4114 "MFM/RLL or ESDI CD-ROM drives never existed" IDS_4114 "MFM/RLL or ESDI CD-ROM drives never existed"
IDS_4115 "Removable disk %i (SCSI): %ws" IDS_4115 "Removable disk %i (SCSI): %S"
IDS_4352 "MFM/RLL" IDS_4352 "MFM/RLL"
IDS_4353 "XT IDE" IDS_4353 "XT IDE"

View File

@@ -8,7 +8,7 @@
* *
* The Emulator's Windows core. * The Emulator's Windows core.
* *
* Version: @(#)win.c 1.0.21 2017/10/12 * Version: @(#)win.c 1.0.22 2017/10/12
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -1547,7 +1547,7 @@ take_screenshot(void)
ddraw_take_screenshot(path); ddraw_take_screenshot(path);
} }
pclog("Screenshot: fn='%ws'\n", path); pclog("Screenshot: fn='%S'\n", path);
} }