uae_u8 wdregs[32];
-static int isirq(void)
+static int isirq (void)
{
if (superdmac) {
if ((dmac_cntr & SCNTR_INTEN) && (dmac_istr & (ISTR_INTS | ISTR_E_INT)))
return 0;
}
-void rethink_a2091(void)
+void rethink_a2091 (void)
{
if (currprefs.cs_cdtvscsi)
return;
if (isirq()) {
uae_int_requested |= 2;
#if A2091_DEBUG > 2 || A3000_DEBUG > 2
- write_log ("Interrupt_RETHINK\n");
+ write_log (L"Interrupt_RETHINK\n");
#endif
} else {
uae_int_requested &= ~2;
}
}
-static void INT2(void)
+static void INT2 (void)
{
int irq = 0;
if (!(auxstatus & 0x80))
return;
dmac_istr |= ISTR_INTS;
- if (isirq())
+ if (isirq ())
uae_int_requested |= 2;
}
-static void dmac_start_dma(void)
+static void dmac_start_dma (void)
{
#if A3000_DEBUG > 0 || A2091_DEBUG > 0
- write_log ("DMAC DMA started, ADDR=%08X, LEN=%08X words\n", dmac_acr, dmac_wtc);
+ write_log (L"DMAC DMA started, ADDR=%08X, LEN=%08X words\n", dmac_acr, dmac_wtc);
#endif
dmac_dma = 1;
}
-static void dmac_stop_dma(void)
+static void dmac_stop_dma (void)
{
dmac_dma = 0;
dmac_istr &= ~ISTR_E_INT;
}
-static void dmac_reset(void)
+static void dmac_reset (void)
{
#if WD33C93_DEBUG > 0
if (superdmac)
- write_log ("A3000 %s SCSI reset\n", WD33C93);
+ write_log (L"A3000 %s SCSI reset\n", WD33C93);
else
- write_log ("A2091 %s SCSI reset\n", WD33C93);
+ write_log (L"A2091 %s SCSI reset\n", WD33C93);
#endif
}
-static void incsasr(int w)
+static void incsasr (int w)
{
if (sasr == WD_AUXILIARY_STATUS || sasr == WD_DATA || sasr == WD_COMMAND)
return;
sasr &= 0x1f;
}
-static void dmac_cint(void)
+static void dmac_cint (void)
{
dmac_istr = 0;
rethink_a2091();
}
-static void doscsistatus(void)
+static void doscsistatus (void)
{
wdregs[WD_SCSI_STATUS] = scsidelay_status;
auxstatus |= 0x80;
#if WD33C93_DEBUG > 0
- write_log ("%s STATUS=%02X\n", WD33C93, scsidelay_status);
+ write_log (L"%s STATUS=%02X\n", WD33C93, scsidelay_status);
#endif
if (currprefs.cs_cdtvscsi) {
cdtv_scsi_int ();
return;
INT2();
#if A2091_DEBUG > 2 || A3000_DEBUG > 2
- write_log ("Interrupt\n");
+ write_log (L"Interrupt\n");
#endif
}
-void scsi_hsync(void)
+void scsi_hsync (void)
{
if (scsidelay_irq == 1) {
scsidelay_irq = 0;
scsidelay_irq--;
}
-static void set_status(uae_u8 status, int quick)
+static void set_status (uae_u8 status, int quick)
{
scsidelay_irq = quick <= 2 ? 2 : quick;
scsidelay_status = status;
}
-static char *scsitostring(void)
+static TCHAR *scsitostring (void)
{
- static char buf[200];
- char *p;
+ static TCHAR buf[200];
+ TCHAR *p;
int i;
p = buf;
p[0] = 0;
for (i = 0; i < wd_tc && i < sizeof wd_data; i++) {
if (i > 0) {
- strcat(p, ".");
+ _tcscat (p, L".");
p++;
}
- sprintf(p, "%02X", wd_data[i]);
- p += strlen(p);
+ _stprintf (p, L"%02X", wd_data[i]);
+ p += _tcslen (p);
}
return buf;
}
-static void wd_cmd_sel_xfer(void)
+static void wd_cmd_sel_xfer (void)
{
int phase = wdregs[WD_COMMAND_PHASE];
#if WD33C93_DEBUG > 0
- write_log ("* %s select and transfer, ID=%d phase=%02X\n", WD33C93, wdregs[WD_DESTINATION_ID] & 0x7, phase);
+ write_log (L"* %s select and transfer, ID=%d phase=%02X\n", WD33C93, wdregs[WD_DESTINATION_ID] & 0x7, phase);
#endif
if (!SCSIID) {
set_status (CSR_TIMEOUT, 0);
set_status (wd_phase, 1);
}
-static void do_dma(void)
+static void do_dma (void)
{
if (currprefs.cs_cdtvscsi)
cdtv_getdmadata (&dmac_acr);
if (SCSIID->direction == 0) {
- write_log ("%s DMA but no data!?\n", WD33C93);
+ write_log (L"%s DMA but no data!?\n", WD33C93);
} else if (SCSIID->direction < 0) {
for (;;) {
uae_u8 v;
}
}
-static void wd_do_transfer_out(void)
+static void wd_do_transfer_out (void)
{
#if WD33C93_DEBUG > 0
- write_log ("%s SCSI O [%02X] %d/%d %s\n", WD33C93, wdregs[WD_COMMAND_PHASE], wd_dataoffset, wd_tc, scsitostring());
+ write_log (L"%s SCSI O [%02X] %d/%d %s\n", WD33C93, wdregs[WD_COMMAND_PHASE], wd_dataoffset, wd_tc, scsitostring());
#endif
if (wdregs[WD_COMMAND_PHASE] == 0x11) {
wdregs[WD_COMMAND_PHASE] = 0x20;
wd_busy = 0;
}
-static void wd_do_transfer_in(void)
+static void wd_do_transfer_in (void)
{
#if WD33C93_DEBUG > 0
- write_log ("%s SCSI I [%02X] %d/%d %s\n", WD33C93, wdregs[WD_COMMAND_PHASE], wd_dataoffset, wd_tc, scsitostring());
+ write_log (L"%s SCSI I [%02X] %d/%d %s\n", WD33C93, wdregs[WD_COMMAND_PHASE], wd_dataoffset, wd_tc, scsitostring());
#endif
wd_dataoffset = 0;
if (wdregs[WD_COMMAND_PHASE] >= 0x36 && wdregs[WD_COMMAND_PHASE] < 0x47) {
SCSIID->direction = 0;
}
-static void wd_cmd_sel_xfer_atn(void)
+static void wd_cmd_sel_xfer_atn (void)
{
int i, tmp_tc;
tmp_tc = wdregs[WD_TRANSFER_COUNT_LSB] | (wdregs[WD_TRANSFER_COUNT] << 8) | (wdregs[WD_TRANSFER_COUNT_MSB] << 16);
#if WD33C93_DEBUG > 0
- write_log ("* %s select and transfer with atn, ID=%d PHASE=%02X TC=%d\n",
+ write_log (L"* %s select and transfer with atn, ID=%d PHASE=%02X TC=%d\n",
WD33C93, wdregs[WD_DESTINATION_ID] & 0x7, wdregs[WD_COMMAND_PHASE], tmp_tc);
#endif
if (wdregs[WD_COMMAND] & 0x80)
}
-static void wd_cmd_trans_info(void)
+static void wd_cmd_trans_info (void)
{
if (wdregs[WD_COMMAND_PHASE] == 0x47)
SCSIID->buffer[0] = SCSIID->status;
wd_tc = 1;
wd_dataoffset = 0;
#if WD33C93_DEBUG > 0
- write_log ("* %s transfer info phase=%02x len=%d dma=%d\n", WD33C93, wdregs[WD_COMMAND_PHASE], wd_tc, wdregs[WD_CONTROL] >> 5);
+ write_log (L"* %s transfer info phase=%02x len=%d dma=%d\n", WD33C93, wdregs[WD_COMMAND_PHASE], wd_tc, wdregs[WD_CONTROL] >> 5);
#endif
scsi_start_transfer (SCSIID, wd_tc);
if (wdregs[WD_COMMAND_PHASE] >= 0x36 && wdregs[WD_COMMAND_PHASE] <= 0x3f)
static void wd_cmd_sel_atn (void)
{
#if WD33C93_DEBUG > 0
- write_log ("* %s select with atn, ID=%d\n", WD33C93, wdregs[WD_DESTINATION_ID] & 0x7);
+ write_log (L"* %s select with atn, ID=%d\n", WD33C93, wdregs[WD_DESTINATION_ID] & 0x7);
#endif
wd_phase = 0;
wdregs[WD_COMMAND_PHASE] = 0;
int i;
#if WD33C93_DEBUG > 0
- write_log ("%s reset\n", WD33C93);
+ write_log (L"%s reset\n", WD33C93);
#endif
for (i = 1; i < 0x16; i++)
wdregs[i] = 0;
static void wd_cmd_abort (void)
{
#if WD33C93_DEBUG > 0
- write_log ("%s abort\n", WD33C93);
+ write_log (L"%s abort\n", WD33C93);
#endif
set_status (CSR_SEL_ABORT, 0);
}
{
#if WD33C93_DEBUG > 1
if (WD33C93_DEBUG > 3 || sasr != WD_DATA)
- write_log ("W %s REG %02X (%d) = %02X (%d) PC=%08X\n", WD33C93, sasr, sasr, d, d, M68K_GETPC);
+ write_log (L"W %s REG %02X (%d) = %02X (%d) PC=%08X\n", WD33C93, sasr, sasr, d, d, M68K_GETPC);
#endif
if (!writeonlyreg (sasr))
wdregs[sasr] = d;
if (!wd_used) {
wd_used = 1;
- write_log ("%s in use\n", WD33C93);
+ write_log (L"%s in use\n", WD33C93);
}
if (sasr == WD_COMMAND_PHASE) {
#if WD33C93_DEBUG > 0
- write_log ("%s PHASE=%02X\n", WD33C93, d);
+ write_log (L"%s PHASE=%02X\n", WD33C93, d);
#endif
} else if (sasr == WD_DATA) {
if (wd_dataoffset < sizeof wd_data)
wd_cmd_trans_info ();
break;
default:
- write_log ("%s unimplemented/unknown command %02X\n", WD33C93, d);
+ write_log (L"%s unimplemented/unknown command %02X\n", WD33C93, d);
break;
}
}
return (auxstatus & 0x80) | (wd_busy ? 0x20 : 0) | (wd_busy ? 0x01 : 0);
}
-uae_u8 wdscsi_get(void)
+uae_u8 wdscsi_get (void)
{
uae_u8 v, osasr = sasr;
incsasr (0);
#if WD33C93_DEBUG > 1
if (WD33C93_DEBUG > 3 || osasr != WD_DATA)
- write_log ("R %s REG %02X (%d) = %02X (%d) PC=%08X\n", WD33C93, osasr, osasr, v, v, M68K_GETPC);
+ write_log (L"R %s REG %02X (%d) = %02X (%d) PC=%08X\n", WD33C93, osasr, osasr, v, v, M68K_GETPC);
#endif
return v;
}
break;
}
#if A2091_DEBUG > 0
- write_log ("dmac_bget %04X=%02X PC=%08X\n", addr, v, M68K_GETPC);
+ write_log (L"dmac_bget %04X=%02X PC=%08X\n", addr, v, M68K_GETPC);
#endif
return v;
}
break;
}
#if A2091_DEBUG > 0
- write_log ("dmac_bput %04X=%02X PC=%08X\n", addr, b & 255, M68K_GETPC);
+ write_log (L"dmac_bput %04X=%02X PC=%08X\n", addr, b & 255, M68K_GETPC);
#endif
}
v |= dmac_bget2 (addr + 3);
#ifdef A2091_DEBUG
if (addr >= 0x40 && addr < ROM_OFFSET)
- write_log ("dmac_lget %08X=%08X PC=%08X\n", addr, v, M68K_GETPC);
+ write_log (L"dmac_lget %08X=%08X PC=%08X\n", addr, v, M68K_GETPC);
#endif
return v;
}
v |= dmac_bget2 (addr + 1);
#if A2091_DEBUG > 0
if (addr >= 0x40 && addr < ROM_OFFSET)
- write_log ("dmac_wget %08X=%04X PC=%08X\n", addr, v, M68K_GETPC);
+ write_log (L"dmac_wget %08X=%04X PC=%08X\n", addr, v, M68K_GETPC);
#endif
return v;
}
addr &= 65535;
#if A2091_DEBUG > 0
if (addr >= 0x40 && addr < ROM_OFFSET)
- write_log ("dmac_lput %08X=%08X PC=%08X\n", addr, l, M68K_GETPC);
+ write_log (L"dmac_lput %08X=%08X PC=%08X\n", addr, l, M68K_GETPC);
#endif
dmac_bput2 (addr, l >> 24);
dmac_bput2 (addr + 1, l >> 16);
addr &= 65535;
#if A2091_DEBUG > 0
if (addr >= 0x40 && addr < ROM_OFFSET)
- write_log ("dmac_wput %04X=%04X PC=%08X\n", addr, w & 65535, M68K_GETPC);
+ write_log (L"dmac_wput %04X=%04X PC=%08X\n", addr, w & 65535, M68K_GETPC);
#endif
dmac_bput2 (addr, w >> 8);
dmac_bput2 (addr + 1, w);
addr &= 65535;
if (addr == 0x48 && !configured) {
map_banks (&dmaca2091_bank, b, 0x10000 >> 16, 0x10000);
- write_log ("A590/A2091 Z2 autoconfigured at %02X0000\n", b);
+ write_log (L"A590/A2091 Z2 autoconfigured at %02X0000\n", b);
configured = 1;
expamem_next ();
return;
}
if (addr == 0x4c && !configured) {
- write_log ("A590/A2091 DMAC AUTOCONFIG SHUT-UP!\n");
+ write_log (L"A590/A2091 DMAC AUTOCONFIG SHUT-UP!\n");
configured = 1;
expamem_next ();
return;
addrbank dmaca2091_bank = {
dmac_lget, dmac_wget, dmac_bget,
dmac_lput, dmac_wput, dmac_bput,
- default_xlate, default_check, NULL, "A2091/A590",
+ default_xlate, default_check, NULL, L"A2091/A590",
dmac_lgeti, dmac_wgeti, ABFLAG_IO
};
-static void dmacreg_write(uae_u32 *reg, int addr, uae_u32 val, int size)
+static void dmacreg_write (uae_u32 *reg, int addr, uae_u32 val, int size)
{
addr = (size - 1) - addr;
(*reg) &= ~(0xff << (addr * 8));
(*reg) |= (val & 0xff) << (addr * 8);
}
-static uae_u32 dmacreg_read(uae_u32 val, int addr, int size)
+static uae_u32 dmacreg_read (uae_u32 val, int addr, int size)
{
addr = (size - 1) - addr;
return (val >> (addr * 8)) & 0xff;
if (currprefs.cs_mbdmac > 1)
return;
#if A3000_DEBUG > 1
- write_log ("DMAC_WRITE %08X=%02X PC=%08X\n", addr, val & 0xff, M68K_GETPC);
+ write_log (L"DMAC_WRITE %08X=%02X PC=%08X\n", addr, val & 0xff, M68K_GETPC);
#endif
addr &= 0xffff;
switch (addr)
break;
}
#if A3000_DEBUG > 1
- write_log ("DMAC_READ %08X=%02X PC=%X\n", vaddr, v & 0xff, M68K_GETPC);
+ write_log (L"DMAC_READ %08X=%02X PC=%X\n", vaddr, v & 0xff, M68K_GETPC);
#endif
return v;
}
addrbank mbdmac_a3000_bank = {
mbdmac_lget, mbdmac_wget, mbdmac_bget,
mbdmac_lput, mbdmac_wput, mbdmac_bput,
- default_xlate, default_check, NULL, "A3000 DMAC",
+ default_xlate, default_check, NULL, L"A3000 DMAC",
dummy_lgeti, dummy_wgeti, ABFLAG_IO
};
}
}
-static void freescsi(struct scsi_data *sd)
+static void freescsi (struct scsi_data *sd)
{
if (!sd)
return;
scsi_free (sd);
}
-int addscsi(int ch, char *path, int blocksize, int readonly,
- char *devname, int sectors, int surfaces, int reserved,
- int bootpri, char *filesys, int scsi_level)
+int addscsi (int ch, TCHAR *path, int blocksize, int readonly,
+ TCHAR *devname, int sectors, int surfaces, int reserved,
+ int bootpri, TCHAR *filesys, int scsi_level)
{
struct hd_hardfiledata *hfd;
return scsis[ch] ? 1 : 0;
}
-static void freenativescsi(void)
+static void freenativescsi (void)
{
int i;
for (i = 0; i < 7; i++) {
}
}
-static void addnativescsi(void)
+static void addnativescsi (void)
{
int i, j;
int devices[MAX_TOTAL_DEVICES];
while (devices[i] >= 0 && j < 7) {
if (scsis[j] == NULL) {
scsis[j] = scsi_alloc_native(j, devices[i]);
- write_log ("SCSI: %d:'%s'\n", j, dis[i].label);
+ write_log (L"SCSI: %d:'%s'\n", j, dis[i].label);
i++;
}
j++;
}
}
-int a3000_add_scsi_unit (int ch, char *path, int blocksize, int readonly,
- char *devname, int sectors, int surfaces, int reserved,
- int bootpri, char *filesys)
+int a3000_add_scsi_unit (int ch, TCHAR *path, int blocksize, int readonly,
+ TCHAR *devname, int sectors, int surfaces, int reserved,
+ int bootpri, TCHAR *filesys)
{
return addscsi (ch, path, blocksize, readonly, devname, sectors, surfaces, reserved, bootpri, filesys, 2);
}
freenativescsi ();
}
-int a2091_add_scsi_unit (int ch, char *path, int blocksize, int readonly,
- char *devname, int sectors, int surfaces, int reserved,
- int bootpri, char *filesys)
+int a2091_add_scsi_unit (int ch, TCHAR *path, int blocksize, int readonly,
+ TCHAR *devname, int sectors, int surfaces, int reserved,
+ int bootpri, TCHAR *filesys)
{
return addscsi (ch, path, blocksize, readonly, devname, sectors, surfaces, reserved, bootpri, filesys, 1);
}
rd = rl->rd;
z = read_rom (&rd);
if (z) {
- write_log ("A590/A2091 BOOT ROM %d.%d ", rd->ver, rd->rev);
+ write_log (L"A590/A2091 BOOT ROM %d.%d ", rd->ver, rd->rev);
rom_size = rd->size;
rom = xmalloc (rom_size);
if (rl->rd->id == 56)
static void irq (void)
{
#if AKIKO_DEBUG_IO > 1
- write_log ("Akiko Interrupt\n");
+ write_log (L"Akiko Interrupt\n");
#endif
if (!(intreq & 8)) {
INTREQ_0 (0x8000 | 0x0008);
if (!currprefs.cs_cd32nvram)
return;
- f = zfile_fopen (currprefs.flashfile, "rb+");
+ f = zfile_fopen (currprefs.flashfile, L"rb+");
if (!f) {
- f = zfile_fopen (currprefs.flashfile, "wb");
+ f = zfile_fopen (currprefs.flashfile, L"wb");
if (!f) return;
zfile_fwrite (cd32_nvram, NVRAM_SIZE, 1, f);
}
if (!currprefs.cs_cd32nvram)
return;
- f = zfile_fopen (currprefs.flashfile, "rb");
+ f = zfile_fopen (currprefs.flashfile, L"rb");
memset (cd32_nvram, 0, NVRAM_SIZE);
if (!f) return;
zfile_fread (cd32_nvram, NVRAM_SIZE, 1, f);
bitcounter = 0;
direction = -1;
#if AKIKO_DEBUG_NVRAM
- write_log ("START\n");
+ write_log (L"START\n");
#endif
return;
} else if(sda_out && !osda) { /* STOP-condition? */
state = I2C_WAIT;
bitcounter = -1;
#if AKIKO_DEBUG_NVRAM
- write_log ("STOP\n");
+ write_log (L"STOP\n");
#endif
if (direction > 0) {
memcpy (cd32_nvram + (nvram_address & ~(NVRAM_PAGE_SIZE - 1)), nvram_writetmp, NVRAM_PAGE_SIZE);
nvram_write (nvram_address & ~(NVRAM_PAGE_SIZE - 1), NVRAM_PAGE_SIZE);
direction = -1;
#if AKIKO_DEBUG_NVRAM
- write_log ("NVRAM write address %04X:", nvram_address & ~(NVRAM_PAGE_SIZE - 1));
+ write_log (L"NVRAM write address %04X:", nvram_address & ~(NVRAM_PAGE_SIZE - 1));
for (i = 0; i < NVRAM_PAGE_SIZE; i++)
- write_log ("%02X", nvram_writetmp[i]);
- write_log ("\n");
+ write_log (L"%02X", nvram_writetmp[i]);
+ write_log (L"\n");
#endif
}
if (scl_out && !oscl) {
if (bitcounter == 8) {
#if AKIKO_DEBUG_NVRAM
- write_log ("RB %02X ", nvram_byte, M68K_GETPC);
+ write_log (L"RB %02X ", nvram_byte, M68K_GETPC);
#endif
sda_in = 0; /* ACK */
if (direction > 0) {
bitcounter = -1;
}
} else {
- //write_log ("NVRAM received bit %d, offset %d\n", sda_out, bitcounter);
+ //write_log (L"NVRAM received bit %d, offset %d\n", sda_out, bitcounter);
nvram_byte <<= 1;
nvram_byte |= sda_out;
bitcounter++;
nvram_byte = cd32_nvram[nvram_address];
sda_dir_nvram = 1;
sda_in = (nvram_byte & 0x80) ? 1 : 0;
- //write_log ("NVRAM sent bit %d, offset %d\n", sda_in, bitcounter);
+ //write_log (L"NVRAM sent bit %d, offset %d\n", sda_in, bitcounter);
nvram_byte <<= 1;
bitcounter++;
if (bitcounter == 8) {
#if AKIKO_DEBUG_NVRAM
- write_log ("NVRAM sent byte %02X address %04X PC=%08X\n", cd32_nvram[nvram_address], nvram_address, M68K_GETPC);
+ write_log (L"NVRAM sent byte %02X address %04X PC=%08X\n", cd32_nvram[nvram_address], nvram_address, M68K_GETPC);
#endif
nvram_address++;
nvram_address &= NVRAM_SIZE - 1;
{
case I2C_DEVICEADDR:
if ((nvram_byte & 0xf0) != 0xa0) {
- write_log ("WARNING: I2C_DEVICEADDR: device address != 0xA0\n");
+ write_log (L"WARNING: I2C_DEVICEADDR: device address != 0xA0\n");
state = I2C_WAIT;
return;
}
}
bitcounter = 0;
#if AKIKO_DEBUG_NVRAM
- write_log ("I2C_DEVICEADDR: rw %d, address %02Xxx PC=%08X\n", nvram_rw, nvram_address >> 8, M68K_GETPC);
+ write_log (L"I2C_DEVICEADDR: rw %d, address %02Xxx PC=%08X\n", nvram_rw, nvram_address >> 8, M68K_GETPC);
#endif
break;
case I2C_WORDADDR:
nvram_address &= 0x300;
nvram_address |= nvram_byte;
#if AKIKO_DEBUG_NVRAM
- write_log ("I2C_WORDADDR: address %04X PC=%08X\n", nvram_address, M68K_GETPC);
+ write_log (L"I2C_WORDADDR: address %04X PC=%08X\n", nvram_address, M68K_GETPC);
#endif
if (direction < 0) {
memcpy (nvram_writetmp, cd32_nvram + (nvram_address & ~(NVRAM_PAGE_SIZE - 1)), NVRAM_PAGE_SIZE);
break;
}
if ((s[1] & 0x0c) == 0x04) {
- write_log ("tried to play data track %d!\n", s[3]);
+ write_log (L"tried to play data track %d!\n", s[3]);
s += 11;
startmsf = (s[8] << 16) | (s[9] << 8) | (s[10] << 0);
s += 11;
if (sys_command_open (DF_IOCTL, unitnum)) {
di2 = sys_command_info (DF_IOCTL, unitnum, &di1);
if (di2 && di2->type == INQ_ROMD) {
- write_log ("%s: ", di2->label);
+ write_log (L"%s: ", di2->label);
if (first < 0)
first = unitnum;
if (!cdrom_toc ()) {
if (p) {
if (!memcmp (p + 8, "CDTV", 4) || !memcmp (p + 8, "CD32", 4)) {
uae_u32 crc;
- write_log ("CD32 or CDTV");
+ write_log (L"CD32 or CDTV");
if (cd32unit < 0)
cd32unit = unitnum;
p = sys_command_cd_read (DF_IOCTL, unitnum, 21);
crc = get_crc32 (p, 2048);
if (crc == 0xe56c340f)
- write_log (" [CD32.TM]");
- write_log ("\n");
+ write_log (L" [CD32.TM]");
+ write_log (L"\n");
} else {
- write_log ("non CD32/CDTV data CD\n");
+ write_log (L"non CD32/CDTV data CD\n");
}
} else {
- write_log ("read error\n");
+ write_log (L"read error\n");
}
} else {
- write_log ("Audio CD\n");
+ write_log (L"Audio CD\n");
if (audiounit < 0)
audiounit = unitnum;
}
} else {
- write_log ("can't read TOC\n");
+ write_log (L"can't read TOC\n");
}
}
sys_command_close (DF_IOCTL, unitnum);
if (unitnum < 0)
return 1;
if (!sys_command_open (DF_IOCTL, unitnum))
- write_log ("re-opening unit %d failed!\n", unitnum);
+ write_log (L"re-opening unit %d failed!\n", unitnum);
di2 = sys_command_info (DF_IOCTL, unitnum, &di1);
if (!di2) {
- write_log ("unit %d info failed\n", unitnum);
+ write_log (L"unit %d info failed\n", unitnum);
sys_command_close (DF_IOCTL, unitnum);
return 1;
}
if (!sys_command_ismedia(DF_IOCTL, unitnum, 0))
cd_hunt = 1;
- write_log ("using drive %s (unit %d, media %d)\n", di2->label, unitnum, di2->media_inserted);
+ write_log (L"using drive %s (unit %d, media %d)\n", di2->label, unitnum, di2->media_inserted);
/* make sure CD audio is not playing */
cdaudiostop ();
return 0;
if (len <= 0)
return;
#if AKIKO_DEBUG_IO_CMD
- write_log ("OUT:");
+ write_log (L"OUT:");
#endif
checksum = 0xff;
for (i = 0; i < len; i++) {
checksum -= cdrom_result_buffer[i];
put_byte (cmd_buf + ((cdrom_result_complete + i) & 0xff), cdrom_result_buffer[i]);
#if AKIKO_DEBUG_IO_CMD
- write_log ("%02X ", cdrom_result_buffer[i]);
+ write_log (L"%02X ", cdrom_result_buffer[i]);
#endif
}
put_byte (cmd_buf + ((cdrom_result_complete + len) & 0xff), checksum);
#if AKIKO_DEBUG_IO_CMD
- write_log ("%02X\n", checksum);
+ write_log (L"%02X\n", checksum);
#endif
cdrom_result_complete += len + 1;
set_status (CDSTATUS_DATA_AVAILABLE);
int cdrom_data_offset_end = msf2lsn (endpos);
cdrom_data_offset = msf2lsn (seekpos);
#if AKIKO_DEBUG_IO_CMD
- write_log ("READ DATA %06X (%d) - %06X (%d) SPD=%dx PC=%08X\n",
+ write_log (L"READ DATA %06X (%d) - %06X (%d) SPD=%dx PC=%08X\n",
seekpos, cdrom_data_offset, endpos, cdrom_data_offset_end, cdrom_speed, M68K_GETPC);
#endif
cdrom_result_buffer[1] |= 0x02;
else if (cdrom_command_buffer[7] & 0x08)
scan = -1;
#if AKIKO_DEBUG_IO_CMD
- write_log ("PLAY FROM %06X (%d) to %06X (%d) SCAN=%d\n",
+ write_log (L"PLAY FROM %06X (%d) to %06X (%d) SCAN=%d\n",
seekpos, msf2lsn (seekpos), endpos, msf2lsn (endpos), scan);
#endif
if (!cd_play_audio (seekpos, endpos, 0)) {
}
} else {
#if AKIKO_DEBUG_IO_CMD
- write_log ("SEEKTO %06X\n",seekpos);
+ write_log (L"SEEKTO %06X\n",seekpos);
#endif
if (seekpos < 150)
cdrom_toc_counter = 0;
cmd_len = command_lengths[cdrom_command & 0x0f];
if (cmd_len < 0) {
#if AKIKO_DEBUG_IO_CMD
- write_log ("unknown command\n");
+ write_log (L"unknown command\n");
#endif
cmd_len = 1;
}
#if AKIKO_DEBUG_IO_CMD
- write_log ("IN:");
+ write_log (L"IN:");
#endif
checksum = 0;
for (i = 0; i < cmd_len + 1; i++) {
cdrom_command_buffer[i] = get_byte (cmd_buf + ((cdrom_command_offset_complete + i) & 0xff));
checksum += cdrom_command_buffer[i];
#if AKIKO_DEBUG_IO_CMD
- write_log ("%02X ", cdrom_command_buffer[i]);
+ write_log (L"%02X ", cdrom_command_buffer[i]);
#endif
}
if (checksum!=0xff) {
#if AKIKO_DEBUG_IO_CMD
- write_log (" checksum error");
+ write_log (L" checksum error");
#endif
cdrom_checksum_error = 1;
}
#if AKIKO_DEBUG_IO_CMD
- write_log ("\n");
+ write_log (L"\n");
#endif
cdrom_command_active = 1;
cdrom_command_length = cmd_len;
return;
}
#if AKIKO_DEBUG_IO_CMD
- write_log ("read sector=%d, scnt=%d -> %d. %08X\n",
+ write_log (L"read sector=%d, scnt=%d -> %d. %08X\n",
cdrom_data_offset, cdrom_sector_counter, sector, cdrom_address1 + j * 4096);
#endif
cdrom_readmask_w &= ~(1 << j);
int media = sys_command_ismedia (DF_IOCTL, unitnum, 0);
mediacheckcnt = 312 * 50 * 2;
if (media != lastmediastate) {
- write_log ("media changed = %d\n", media);
+ write_log (L"media changed = %d\n", media);
lastmediastate = cdrom_disk = media;
cdrom_return_data (cdrom_command_media_status ());
if (!media)
if (sys_command_open(DF_IOCTL, i) > 0) {
unitnum = i;
cd_hunt = 0;
- write_log ("CD32: autodetected unit %d\n", unitnum);
+ write_log (L"CD32: autodetected unit %d\n", unitnum);
}
}
(sector_buffer_sector_1 < 0 || sector < sector_buffer_sector_1 || sector >= sector_buffer_sector_1 + SECTOR_BUFFER_SIZE * 2 / 3 || i != SECTOR_BUFFER_SIZE)) {
memset (sector_buffer_info_2, 0, SECTOR_BUFFER_SIZE);
#if AKIKO_DEBUG_IO_CMD
- write_log ("filling buffer sector=%d (max=%d)\n", sector, cdrom_data_end);
+ write_log (L"filling buffer sector=%d (max=%d)\n", sector, cdrom_data_end);
#endif
sector_buffer_sector_2 = sector;
offset = 0;
}
default:
- write_log ("akiko_bget: unknown address %08X\n", addr);
+ write_log (L"akiko_bget: unknown address %08X\n", addr);
v = 0;
break;
}
akiko_internal ();
uae_sem_post (&akiko_sem);
if (msg && addr < 0x30 && AKIKO_DEBUG_IO)
- write_log ("akiko_bget %08X: %08X %02X\n", M68K_GETPC, addr, v & 0xff);
+ write_log (L"akiko_bget %08X: %08X %02X\n", M68K_GETPC, addr, v & 0xff);
return v;
}
v = akiko_bget2 (addr + 1, 0);
v |= akiko_bget2 (addr + 0, 0) << 8;
if (addr < 0x30 && AKIKO_DEBUG_IO)
- write_log ("akiko_wget %08X: %08X %04X\n", M68K_GETPC, addr, v & 0xffff);
+ write_log (L"akiko_wget %08X: %08X %04X\n", M68K_GETPC, addr, v & 0xffff);
return v;
}
v |= akiko_bget2 (addr + 1, 0) << 16;
v |= akiko_bget2 (addr + 0, 0) << 24;
if (addr < 0x30 && (addr != 4 && addr != 8) && AKIKO_DEBUG_IO)
- write_log ("akiko_lget %08: %08X %08X\n", M68K_GETPC, addr, v);
+ write_log (L"akiko_lget %08: %08X %08X\n", M68K_GETPC, addr, v);
return v;
}
v &= 0xff;
if(msg && addr < 0x30 && AKIKO_DEBUG_IO)
- write_log ("akiko_bput %08X: %08X=%02X\n", M68K_GETPC, addr, v & 0xff);
+ write_log (L"akiko_bput %08X: %08X=%02X\n", M68K_GETPC, addr, v & 0xff);
switch (addr)
{
}
default:
- write_log ("akiko_bput: unknown address %08X\n", addr);
+ write_log (L"akiko_bput: unknown address %08X\n", addr);
break;
}
akiko_internal ();
#endif
addr &= 0xfff;
if((addr < 0x30 && AKIKO_DEBUG_IO))
- write_log ("akiko_wput %08X: %08X=%04X\n", M68K_GETPC, addr, v & 0xffff);
+ write_log (L"akiko_wput %08X: %08X=%04X\n", M68K_GETPC, addr, v & 0xffff);
akiko_bput2 (addr + 1, v & 0xff, 0);
akiko_bput2 (addr + 0, v >> 8, 0);
}
#endif
addr &= 0xffff;
if(addr < 0x30 && AKIKO_DEBUG_IO)
- write_log ("akiko_lput %08X: %08X=%08X\n", M68K_GETPC, addr, v);
+ write_log (L"akiko_lput %08X: %08X=%08X\n", M68K_GETPC, addr, v);
akiko_bput2 (addr + 3, (v >> 0) & 0xff, 0);
akiko_bput2 (addr + 2, (v >> 8) & 0xff, 0);
akiko_bput2 (addr + 1, (v >> 16) & 0xff, 0);
addrbank akiko_bank = {
akiko_lget, akiko_wget, akiko_bget,
akiko_lput, akiko_wput, akiko_bput,
- default_xlate, default_check, NULL, "Akiko",
+ default_xlate, default_check, NULL, L"Akiko",
dummy_lgeti, dummy_wgeti, ABFLAG_IO
};
p[i + 7] = 0x71;
p[i + 8] = 0x4e;
p[i + 9] = 0x71;
- write_log ("extended rom delay loop patched at 0x%08x\n", i + 6 + 0xe00000);
+ write_log (L"extended rom delay loop patched at 0x%08x\n", i + 6 + 0xe00000);
return;
}
if (!memcmp (p + i, patchdata2, sizeof(patchdata2)))
return;
}
- write_log ("couldn't patch extended rom\n");
+ write_log (L"couldn't patch extended rom\n");
}
void akiko_free (void)
if (currprefs.cs_cd32cd && cdromok == 0) {
unitnum = -1;
if (!device_func_init (DEVICE_TYPE_ANY)) {
- write_log ("no CDROM support\n");
+ write_log (L"no CDROM support\n");
return 0;
}
if (!sys_cddev_open ()) {
}
if (cdromok && !akiko_thread_running) {
akiko_thread_running = 1;
- uae_start_thread ("akiko", akiko_thread, 0, NULL);
+ uae_start_thread (L"akiko", akiko_thread, 0, NULL);
}
return 1;
}
if (!currprefs.cs_cd32cd)
return NULL;
- dstbak = dst = (uae_u8*)malloc (1000);
+ dstbak = dst = malloc (1000);
save_u16 (0);
save_u16 (0xCAFE);
save_u32 (cdrom_status1);
}
data = val;
if (AMAX_LOG > 0)
- write_log ("AMAX: load byte, rom=%d addr=%06x (%06x) data=%02x (%02x) PC=%08X\n", rom_oddeven, romptr, addr, v, val, M68K_GETPC);
+ write_log (L"AMAX: load byte, rom=%d addr=%06x (%06x) data=%02x (%02x) PC=%08X\n", rom_oddeven, romptr, addr, v, val, M68K_GETPC);
}
static void amax_check (void)
/* DIR low = reset address counter */
if ((bfd100 & 2)) {
if (romptr && AMAX_LOG > 0)
- write_log ("AMAX: counter reset PC=%08X\n", M68K_GETPC);
+ write_log (L"AMAX: counter reset PC=%08X\n", M68K_GETPC);
romptr = 0;
}
}
if (dwlastbit && !(w & 0x8000)) {
romptr++;
if (AMAX_LOG > 0)
- write_log ("AMAX: counter increase %d PC=%08X\n", romptr, M68K_GETPC);
+ write_log (L"AMAX: counter increase %d PC=%08X\n", romptr, M68K_GETPC);
}
dwlastbit = (w & 0x8000) ? 1 : 0;
w <<= 1;
data <<= 1;
data |= 1;
if (AMAX_LOG > 0)
- write_log ("AMAX: data shifted\n");
+ write_log (L"AMAX: data shifted\n");
}
/* TK0 = even, WPRO = odd */
rom_oddeven = -1;
if (!currprefs.amaxromfile[0])
return;
amax_reset ();
- z = zfile_fopen (currprefs.amaxromfile, "rb");
+ z = zfile_fopen (currprefs.amaxromfile, L"rb");
if (!z) {
- write_log ("AMAX: failed to load rom '%s'\n", currprefs.amaxromfile);
+ write_log (L"AMAX: failed to load rom '%s'\n", currprefs.amaxromfile);
return;
}
zfile_fseek (z, 0, SEEK_END);
rom = xmalloc (rom_size);
zfile_fread (rom, rom_size, 1, z);
zfile_fclose (z);
- write_log ("AMAX: '%s' loaded, %d bytes\n", currprefs.amaxromfile, rom_size);
+ write_log (L"AMAX: '%s' loaded, %d bytes\n", currprefs.amaxromfile, rom_size);
dselect = 0x20;
}
#define write_log_debug
#endif
-static char *cart_memnames[] = { NULL, "hrtmon", "arhrtmon", "superiv" };
+static TCHAR *cart_memnames[] = { NULL, L"hrtmon", L"arhrtmon", L"superiv" };
#define ARMODE_FREEZE 0 /* AR2/3 The action replay 'freeze' button has been pressed. */
#define ARMODE_BREAKPOINT_AR2 2 /* AR2: The action replay is activated via a breakpoint. */
static addrbank hrtmem_bank = {
hrtmem_lget, hrtmem_wget, hrtmem_bget,
hrtmem_lput, hrtmem_wput, hrtmem_bput,
- hrtmem_xlate, hrtmem_check, NULL, "Cartridge Bank",
+ hrtmem_xlate, hrtmem_check, NULL, L"Cartridge Bank",
hrtmem_lget, hrtmem_wget, ABFLAG_RAM
};
static addrbank hrtmem2_bank = {
hrtmem2_lget, hrtmem2_wget, hrtmem2_bget,
hrtmem2_lput, hrtmem2_wput, hrtmem2_bput,
- hrtmem2_xlate, hrtmem2_check, NULL, "Cartridge Bank 2",
+ hrtmem2_xlate, hrtmem2_check, NULL, L"Cartridge Bank 2",
hrtmem2_lget, hrtmem2_wget, ABFLAG_RAM
};
static addrbank hrtmem3_bank = {
hrtmem3_lget, hrtmem3_wget, hrtmem3_bget,
hrtmem3_lput, hrtmem3_wput, hrtmem3_bput,
- hrtmem3_xlate, hrtmem3_check, NULL, "Cartridge Bank 3",
+ hrtmem3_xlate, hrtmem3_check, NULL, L"Cartridge Bank 3",
hrtmem3_lget, hrtmem3_wget, ABFLAG_RAM
};
armode = b;
if (armode >= 2) {
if (armode == ARMODE_BREAKPOINT_AR2) {
- write_log ("AR2: exit with breakpoint(s) active\n"); /* Correct for AR2 */
+ write_log (L"AR2: exit with breakpoint(s) active\n"); /* Correct for AR2 */
} else if (armode == ARMODE_BREAKPOINT_AR3_RESET_AR2 )
- write_log ("AR3: exit waiting for breakpoint.\n"); /* Correct for AR3 (waiting for breakpoint)*/
+ write_log (L"AR3: exit waiting for breakpoint.\n"); /* Correct for AR3 (waiting for breakpoint)*/
else
- write_log ("AR2/3: mode(%d) > 3 this shouldn't happen.\n", armode);
+ write_log (L"AR2/3: mode(%d) > 3 this shouldn't happen.\n", armode);
} else
- write_log ("AR: exit with armode(%d)\n", armode);
+ write_log (L"AR: exit with armode(%d)\n", armode);
set_special (®s, SPCFLAG_ACTION_REPLAY);
action_replay_flag = ACTION_REPLAY_HIDE;
} else if (addr == 6) {
copytoamiga (regs.vbr + 0x7c, artemp, 4);
- write_log ("AR: chipmem returned\n");
+ write_log (L"AR: chipmem returned\n");
}
return 0;
}
addr &= arram_mask;
m = (uae_u32 *)(armemory_ram + addr);
if (strncmp ("T8", (char*)m, 2) == 0)
- write_log_debug ("Reading T8 from addr %088x PC=%p\n", addr, m68k_getpc (®s));
+ write_log_debug (L"Reading T8 from addr %088x PC=%p\n", addr, m68k_getpc (®s));
if (strncmp ("LAME", (char*)m, 4) == 0)
- write_log_debug ("Reading LAME from addr %08x PC=%p\n", addr, m68k_getpc (®s));
+ write_log_debug (L"Reading LAME from addr %08x PC=%p\n", addr, m68k_getpc (®s));
if (strncmp ("RES1", (char*)m, 4) == 0)
- write_log_debug ("Reading RES1 from addr %08x PC=%p\n", addr, m68k_getpc (®s));
+ write_log_debug (L"Reading RES1 from addr %08x PC=%p\n", addr, m68k_getpc (®s));
if (strncmp ("ARON", (char*)m, 4) == 0)
- write_log_debug ("Reading ARON from addr %08x PC=%p\n", addr, m68k_getpc (®s));
+ write_log_debug (L"Reading ARON from addr %08x PC=%p\n", addr, m68k_getpc (®s));
if (strncmp ("KILL", (char*)m, 4) == 0)
- write_log_debug ("Reading KILL from addr %08x PC=%p\n", addr, m68k_getpc (®s));
+ write_log_debug (L"Reading KILL from addr %08x PC=%p\n", addr, m68k_getpc (®s));
if (strncmp ("BRON", (char*)m, 4) == 0)
- write_log_debug ("Reading BRON from addr %08x PC=%p\n", addr, m68k_getpc (®s));
+ write_log_debug (L"Reading BRON from addr %08x PC=%p\n", addr, m68k_getpc (®s));
if (strncmp ("PRIN", (char*)m, 4) == 0)
- write_log_debug ("Reading PRIN from addr %08x PC=%p\n", addr, m68k_getpc (®s));
+ write_log_debug (L"Reading PRIN from addr %08x PC=%p\n", addr, m68k_getpc (®s));
return do_get_mem_long (m);
}
addr &= arram_mask;
m = (uae_u32 *)(armemory_ram + addr);
if (strncmp ("T8", (char*)m, 2) == 0)
- write_log_debug ("Writing T8 to addr %08x PC=%p\n", addr, m68k_getpc (®s));
+ write_log_debug (L"Writing T8 to addr %08x PC=%p\n", addr, m68k_getpc (®s));
if (strncmp ("LAME", (char*)m, 4) == 0)
- write_log_debug ("Writing LAME to addr %08x PC=%p\n", addr, m68k_getpc (®s));
+ write_log_debug (L"Writing LAME to addr %08x PC=%p\n", addr, m68k_getpc (®s));
if (strncmp ("RES1", (char*)m, 4) == 0)
- write_log_debug ("Writing RES1 to addr %08x PC=%p\n", addr, m68k_getpc (®s));
+ write_log_debug (L"Writing RES1 to addr %08x PC=%p\n", addr, m68k_getpc (®s));
if (strncmp ("ARON", (char*)m, 4) == 0)
- write_log_debug ("Writing ARON to addr %08x PC=%p\n", addr, m68k_getpc (®s));
+ write_log_debug (L"Writing ARON to addr %08x PC=%p\n", addr, m68k_getpc (®s));
if (strncmp ("KILL", (char*)m, 4) == 0)
- write_log_debug ("Writing KILL to addr %08x PC=%p\n", addr, m68k_getpc (®s));
+ write_log_debug (L"Writing KILL to addr %08x PC=%p\n", addr, m68k_getpc (®s));
if (strncmp ("BRON", (char*)m, 4) == 0)
- write_log_debug ("Writing BRON to addr %08x PC=%p\n", addr, m68k_getpc (®s));
+ write_log_debug (L"Writing BRON to addr %08x PC=%p\n", addr, m68k_getpc (®s));
if (strncmp ("PRIN", (char*)m, 4) == 0)
- write_log_debug ("Writing PRIN to addr %08x PC=%p\n", addr, m68k_getpc (®s));
+ write_log_debug (L"Writing PRIN to addr %08x PC=%p\n", addr, m68k_getpc (®s));
do_put_mem_long (m, l);
}
static addrbank arrom_bank = {
arrom_lget, arrom_wget, arrom_bget,
arrom_lput, arrom_wput, arrom_bput,
- arrom_xlate, arrom_check, NULL, "Action Replay ROM",
+ arrom_xlate, arrom_check, NULL, L"Action Replay ROM",
arrom_lget, arrom_wget, ABFLAG_ROM
};
static addrbank arram_bank = {
arram_lget, arram_wget, arram_bget,
arram_lput, arram_wput, arram_bput,
- arram_xlate, arram_check, NULL, "Action Replay RAM",
+ arram_xlate, arram_check, NULL, L"Action Replay RAM",
arram_lget, arram_wget, ABFLAG_RAM
};
if (!hrtmemory)
return;
hrtmon_map_banks ();
- write_log ("%s: freeze\n", cart_memnames[cart_type]);
+ write_log (L"%s: freeze\n", cart_memnames[cart_type]);
hrtmon_go();
}
return;
triggered_once = 1;
if (armodel == 1) {
- write_log ("AR1: Enter PC:%p\n", m68k_getpc (®s));
+ write_log (L"AR1: Enter PC:%p\n", m68k_getpc (®s));
action_replay_go1 (7);
unset_special (®s, SPCFLAG_ACTION_REPLAY);
return;
}
if (action_replay_flag == ACTION_REPLAY_DORESET) {
- write_log ("AR2/3: reset\n");
+ write_log (L"AR2/3: reset\n");
armode = ARMODE_BREAKPOINT_AR3_RESET_AR2;
} else if (armode == ARMODE_FREEZE) {
- write_log ("AR2/3: activated (freeze)\n");
+ write_log (L"AR2/3: activated (freeze)\n");
} else if (armode >= 2) {
if (armode == ARMODE_BREAKPOINT_AR2)
- write_log ("AR2: activated (breakpoint)\n");
+ write_log (L"AR2: activated (breakpoint)\n");
else if (armode == ARMODE_BREAKPOINT_AR3_RESET_AR2)
- write_log ("AR3: activated (breakpoint)\n");
+ write_log (L"AR3: activated (breakpoint)\n");
else
- write_log ("AR2/3: mode(%d) > 3 this shouldn't happen.\n", armode);
+ write_log (L"AR2/3: mode(%d) > 3 this shouldn't happen.\n", armode);
armode = ARMODE_BREAKPOINT_ACTIVATED;
}
action_replay_go();
{
if (currprefs.cart_internal != changed_prefs.cart_internal)
currprefs.cart_internal = changed_prefs.cart_internal;
- if (strcmp (currprefs.cartfile, changed_prefs.cartfile) != 0) {
- write_log ("Cartridge ROM Prefs changed.\n");
+ if (_tcscmp (currprefs.cartfile, changed_prefs.cartfile) != 0) {
+ write_log (L"Cartridge ROM Prefs changed.\n");
if (action_replay_unload (in_memory_reset)) {
memcpy (currprefs.cartfile, changed_prefs.cartfile, sizeof currprefs.cartfile);
#ifdef ACTION_REPLAY
action_replay_flag = ACTION_REPLAY_ACTIVE;
hide_cart (0);
} else {
- write_log_debug ("Setting flag to ACTION_REPLAY_WAITRESET\n");
- write_log_debug ("armode == %d\n", armode);
+ write_log_debug (L"Setting flag to ACTION_REPLAY_WAITRESET\n");
+ write_log_debug (L"armode == %d\n", armode);
action_replay_flag = ACTION_REPLAY_WAITRESET;
hide_cart (0);
}
cartridge_exit();
hrtmon_flag = ACTION_REPLAY_IDLE;
unset_special (®s, SPCFLAG_ACTION_REPLAY);
- //write_log ("HRTMON: Exit\n");
+ //write_log (L"HRTMON: Exit\n");
}
void hrtmon_breakenter(void)
armemory_rom[off2 + 1] = (uae_u8)((off1 + kickmem_start + 2) >> 16);
armemory_rom[off2 + 2] = (uae_u8)((off1 + kickmem_start + 2) >> 8);
armemory_rom[off2 + 3] = (uae_u8)((off1 + kickmem_start + 2) >> 0);
- write_log ("AR ROM patched for KS2.0+\n");
+ write_log (L"AR ROM patched for KS2.0+\n");
}
/* Returns 0 if the checksum is OK.
if (checksum)
do_put_mem_long (checksum, new_checksum);
else
- write_log ("Unable to locate Checksum in ROM.\n");
+ write_log (L"Unable to locate Checksum in ROM.\n");
return;
}
if (do_get_mem_word((uae_u16*)(addr-6)) == 0x6100 && /* bsr.w */
do_get_mem_word((uae_u16*)(addr-2)) == 0x41fa) /* lea relative */
{
- write_log ("Patching to disable ROM TEST.\n");
+ write_log (L"Patching to disable ROM TEST.\n");
do_put_mem_word((uae_u16*)(addr-6), 0x4e75); /* rts */
}
}
if (do_get_mem_word((uae_u16*)(addr-6)) == 0x6100 && /* bsr.w */
do_get_mem_word((uae_u16*)(addr-2)) == 0x41f9) /* lea absolute */
{
- write_log ("Patching to disable ROM TEST.\n");
+ write_log (L"Patching to disable ROM TEST.\n");
do_put_mem_word((uae_u16*)(addr-6), 0x4e75); /* rts */
}
}
if (!armemory_rom)
return;
if (action_replay_calculate_checksum() == 0)
- write_log ("Action Replay Checksum is OK.\n");
+ write_log (L"Action Replay Checksum is OK.\n");
else
- write_log ("Action Replay Checksum is INVALID.\n");
+ write_log (L"Action Replay Checksum is INVALID.\n");
disable_rom_test();
}
/* param to allow us to unload the cart. Currently we know it is safe if we are doing a reset to unload it.*/
int action_replay_unload (int in_memory_reset)
{
- static const char *state[] = {
- "ACTION_REPLAY_WAIT_PC",
- "ACTION_REPLAY_INACTIVE",
- "ACTION_REPLAY_WAITRESET",
- "0",
- "ACTION_REPLAY_IDLE",
- "ACTION_REPLAY_ACTIVATE",
- "ACTION_REPLAY_ACTIVE",
- "ACTION_REPLAY_DORESET",
- "ACTION_REPLAY_HIDE",
+ static const TCHAR *state[] = {
+ L"ACTION_REPLAY_WAIT_PC",
+ L"ACTION_REPLAY_INACTIVE",
+ L"ACTION_REPLAY_WAITRESET",
+ L"0",
+ L"ACTION_REPLAY_IDLE",
+ L"ACTION_REPLAY_ACTIVATE",
+ L"ACTION_REPLAY_ACTIVE",
+ L"ACTION_REPLAY_DORESET",
+ L"ACTION_REPLAY_HIDE",
};
- write_log_debug("Action Replay State:(%s)\nHrtmon State:(%s)\n", state[action_replay_flag+3],state[hrtmon_flag+3]);
+ write_log_debug (L"Action Replay State:(%s)\nHrtmon State:(%s)\n", state[action_replay_flag+3],state[hrtmon_flag+3]);
if (armemory_rom && armodel == 1) {
if (is_ar_pc_in_ram() || is_ar_pc_in_rom() || action_replay_flag == ACTION_REPLAY_WAIT_PC) {
- write_log ("Can't Unload Action Replay 1. It is Active.\n");
+ write_log (L"Can't Unload Action Replay 1. It is Active.\n");
return 0;
}
} else {
if (action_replay_flag != ACTION_REPLAY_IDLE && action_replay_flag != ACTION_REPLAY_INACTIVE) {
- write_log ("Can't Unload Action Replay. It is Active.\n");
+ write_log (L"Can't Unload Action Replay. It is Active.\n");
return 0; /* Don't unload it whilst it's active, or it will crash the amiga if not the emulator */
}
if (hrtmon_flag != ACTION_REPLAY_IDLE && hrtmon_flag != ACTION_REPLAY_INACTIVE) {
- write_log ("Can't Unload Hrtmon. It is Active.\n");
+ write_log (L"Can't Unload Hrtmon. It is Active.\n");
return 0; /* Don't unload it whilst it's active, or it will crash the amiga if not the emulator */
}
}
uae_u32 chip = currprefs.chipmem_size - 0x10000;
int subtype = rd->id;
int flags = rd->type;
- char *memname1, *memname2, *memname3;
+ TCHAR *memname1, *memname2, *memname3;
memname1 = memname2 = memname3 = NULL;
hrtmem2_start = 0xf20000;
hrtmem2_size = 0x10000;
hrtmem_rom = 1;
- memname1 = "xpower_e2";
- memname2 = "xpower_f2";
+ memname1 = L"xpower_e2";
+ memname2 = L"xpower_f2";
} else if (flags & ROMTYPE_NORDIC) { /* nordic */
hrtmem_start = 0xf00000;
hrtmem_size = 0x10000;
hrtmem2_end = 0xf60000;
hrtmem2_size = 0x10000;
hrtmem_rom = 1;
- memname1 = "nordic_f0";
- memname2 = "nordic_f4";
+ memname1 = L"nordic_f0";
+ memname2 = L"nordic_f4";
if (subtype == 70) {
hrtmem_start += 0x60000;
hrtmem_end += 0x60000;
- memname1 = "nordic_f6";
+ memname1 = L"nordic_f6";
}
} else { /* super4 */
hrtmem_start = 0xd00000;
hrtmem2_size2 = 0x0c0000;
hrtmem3_start = 0xe00000;
hrtmem3_size = 0x80000;
- memname1 = "superiv_d0";
- memname2 = "superiv_b0";
- memname3 = "superiv_e0";
+ memname1 = L"superiv_d0";
+ memname2 = L"superiv_b0";
+ memname3 = L"superiv_e0";
}
if (hrtmem2_size && !hrtmem2_size2)
hrtmem2_size2 = hrtmem2_size;
}
hrtmon_flag = ACTION_REPLAY_IDLE;
- write_log ("%s installed at %08X\n", cart_memnames[cart_type], hrtmem_start);
+ write_log (L"%s installed at %08X\n", cart_memnames[cart_type], hrtmem_start);
return 1;
}
armodel = 0;
action_replay_flag = ACTION_REPLAY_INACTIVE;
- write_log_debug("Entered action_replay_load ()\n");
+ write_log_debug (L"Entered action_replay_load ()\n");
/* Don't load a rom if one is already loaded. Use action_replay_unload () first. */
if (armemory_rom || hrtmemory) {
- write_log ("action_replay_load () ROM already loaded.\n");
+ write_log (L"action_replay_load () ROM already loaded.\n");
return 0;
}
- if (strlen(currprefs.cartfile) == 0)
+ if (_tcslen (currprefs.cartfile) == 0)
return 0;
rd = getromdatabypath (currprefs.cartfile);
if (rd) {
}
f = read_rom_name (currprefs.cartfile);
if (!f) {
- write_log ("failed to load '%s' cartridge ROM\n", currprefs.cartfile);
+ write_log (L"failed to load '%s' cartridge ROM\n", currprefs.cartfile);
return 0;
}
rd = getromdatabyzfile(f);
if (!rd) {
- write_log ("Unknown cartridge ROM\n");
+ write_log (L"Unknown cartridge ROM\n");
} else {
if (rd->type & (ROMTYPE_SUPERIV | ROMTYPE_NORDIC | ROMTYPE_XPOWER)) {
return superiv_init (rd, f);
return 0;
}
if (ar_rom_file_size != 65536 && ar_rom_file_size != 131072 && ar_rom_file_size != 262144) {
- write_log ("rom size must be 64KB (AR1), 128KB (AR2) or 256KB (AR3)\n");
+ write_log (L"rom size must be 64KB (AR1), 128KB (AR2) or 256KB (AR3)\n");
zfile_fclose(f);
return 0;
}
arram_mask = arram_size - 1;
arrom_mask = arrom_size - 1;
armemory_ram = (uae_u8*)xcalloc (arram_size, 1);
- write_log ("Action Replay %d installed at %08X, size %08X\n", armodel, arrom_start, arrom_size);
+ write_log (L"Action Replay %d installed at %08X, size %08X\n", armodel, arrom_start, arrom_size);
action_replay_version();
return armodel;
}
}
if (!isinternal) {
- if (strlen(currprefs.cartfile) == 0)
+ if (_tcslen (currprefs.cartfile) == 0)
return 0;
f = read_rom_name (currprefs.cartfile);
if(!f) {
- write_log ("failed to load '%s' cartridge ROM\n", currprefs.cartfile);
+ write_log (L"failed to load '%s' cartridge ROM\n", currprefs.cartfile);
return 0;
}
zfile_fread(header, sizeof header, 1, f);
hrtmem_mask = hrtmem_size - 1;
if (isinternal) {
#ifdef ACTION_REPLAY_HRTMON
- struct zfile *zf = zfile_fopen_data ("hrtrom.gz", hrtrom_len, hrtrom);
+ struct zfile *zf = zfile_fopen_data (L"hrtrom.gz", hrtrom_len, hrtrom);
f = zfile_gunzip (zf);
#else
return 0;
#endif
cart_type = CART_HRTMON;
}
- hrtmemory = mapped_malloc (hrtmem_size, "hrtmem");
+ hrtmemory = mapped_malloc (hrtmem_size, L"hrtmem");
memset (hrtmemory, 0xff, 0x80000);
zfile_fseek (f, 0, SEEK_SET);
zfile_fread (hrtmemory, 1, 524288, f);
#endif
hrtmem_bank.baseaddr = hrtmemory;
hrtmon_flag = ACTION_REPLAY_IDLE;
- write_log ("%s installed at %08X\n", cart_memnames[cart_type], hrtmem_start);
+ write_log (L"%s installed at %08X\n", cart_memnames[cart_type], hrtmem_start);
return 1;
}
#define AR_VER_STR_OFFSET 0x4 /* offset in the rom where the version string begins. */
#define AR_VER_STR_END 0x7c /* offset in the rom where the version string ends. */
#define AR_VER_STR_LEN (AR_VER_STR_END - AR_VER_STR_OFFSET)
-char arVersionString[AR_VER_STR_LEN+1];
+static uae_char arVersionString[AR_VER_STR_LEN+1];
/* This function extracts the version info for AR2 and AR3. */
int iArVersionMajor = -1 ;
int iArVersionMinor = -1;
char* pNext;
- char sArDate[11];
+ uae_char sArDate[11];
*sArDate = '\0';
if (!armemory_rom)
}
if (iArVersionMajor > 0) {
- write_log ("Version of cart is '%d.%.02d', date is '%s'\n", iArVersionMajor, iArVersionMinor, sArDate);
+ write_log (L"Version of cart is '%d.%.02d', date is '%s'\n", iArVersionMajor, iArVersionMinor, sArDate);
}
}
save_u8 (cart_type);
save_u8 (0);
save_u32 (0);
- strcpy (dst, currprefs.cartfile);
- dst += strlen (dst) + 1;
+ save_string (currprefs.cartfile);
save_u32 (0);
if (!hrtmem_rom) {
save_u32 (hrtmem_size);
uae_u8 *restore_hrtmon (uae_u8 *src)
{
uae_u32 size;
+ TCHAR *s;
action_replay_unload (1);
restore_u8 ();
restore_u8 ();
restore_u32 ();
- strncpy (changed_prefs.cartfile, src, 255);
- strcpy (currprefs.cartfile, changed_prefs.cartfile);
- src += strlen (src) + 1;
+ s = restore_string ();
+ _tcsncpy (changed_prefs.cartfile, s, 255);
+ xfree (s);
+ _tcscpy (currprefs.cartfile, changed_prefs.cartfile);
hrtmon_load ();
action_replay_load ();
if (restore_u32 () != 0)
save_u8 (0);
save_u8 (armodel);
save_u32 (get_crc32 (armemory_rom + 4, arrom_size - 4));
- strcpy (dst, currprefs.cartfile);
- dst += strlen (dst) + 1;
+ save_string (currprefs.cartfile);
save_u32 (arrom_size);
save_u32 (arram_size);
memcpy (dst, armemory_ram, arram_size);
uae_u8 *restore_action_replay (uae_u8 *src)
{
uae_u32 crc32;
+ TCHAR *s;
action_replay_unload (1);
restore_u8 ();
if (!armodel)
return src;
crc32 = restore_u32 ();
- strncpy (changed_prefs.cartfile, src, 255);
- strcpy (currprefs.cartfile, changed_prefs.cartfile);
- src += strlen (src) + 1;
+ s = restore_string ();
+ _tcsncpy (changed_prefs.cartfile, s, 255);
+ _tcscpy (currprefs.cartfile, changed_prefs.cartfile);
+ xfree (s);
action_replay_load ();
if (restore_u32 () != arrom_size)
return src;
#define NPSIZE 65536
-static unsigned char bswap (unsigned char v,int b7,int b6,int b5,int b4,int b3,int b2,int b1,int b0)
+static uae_u8 bswap (uae_u8 v,int b7,int b6,int b5,int b4,int b3,int b2,int b1,int b0)
{
- unsigned char b = 0;
+ uae_u8 b = 0;
b |= ((v >> b7) & 1) << 7;
b |= ((v >> b6) & 1) << 6;
return b;
}
-static unsigned short wswap (unsigned short v,int b15,int b14,int b13,int b12, int b11, int b10, int b9, int b8, int b7,int b6,int b5,int b4,int b3,int b2,int b1,int b0)
+static uae_u16 wswap (uae_u16 v,int b15,int b14,int b13,int b12, int b11, int b10, int b9, int b8, int b7,int b6,int b5,int b4,int b3,int b2,int b1,int b0)
{
- unsigned short b = 0;
+ uae_u16 b = 0;
b |= ((v >> b15) & 1) << 15;
b |= ((v >> b14) & 1) << 14;
#define AXOR 0x817f
// middle (even)
-static void descramble1(unsigned char *buf, int size)
+static void descramble1 (uae_u8 *buf, int size)
{
int i;
for (i = 0; i < size; i++)
- buf[i] = bswap(buf[i], 4, 1, 5, 3, 0, 7, 6, 2);
+ buf[i] = bswap (buf[i], 4, 1, 5, 3, 0, 7, 6, 2);
}
-static void descramble1a(unsigned char *buf, int size)
+static void descramble1a (uae_u8 *buf, int size)
{
int i;
- unsigned char tbuf[NPSIZE];
+ uae_u8 tbuf[NPSIZE];
- memcpy(tbuf, buf, size);
+ memcpy (tbuf, buf, size);
for (i = 0; i < size; i++) {
int a = (i ^ AXOR) & (size - 1);
- buf[i] = tbuf[wswap(a, 15, 9, 10, 4, 6, 5, 3, 8, 14, 13, 0, 12, 11, 2, 1, 7)];
+ buf[i] = tbuf[wswap (a, 15, 9, 10, 4, 6, 5, 3, 8, 14, 13, 0, 12, 11, 2, 1, 7)];
}
}
// corner (odd)
-static void descramble2(unsigned char *buf, int size)
+static void descramble2 (uae_u8 *buf, int size)
{
int i;
for (i = 0; i < size; i++)
- buf[i] = bswap(buf[i], 5, 4, 3, 2, 1, 0, 7, 6);
+ buf[i] = bswap (buf[i], 5, 4, 3, 2, 1, 0, 7, 6);
}
-static void descramble2a(unsigned char *buf, int size)
+static void descramble2a (uae_u8 *buf, int size)
{
int i;
- unsigned char tbuf[NPSIZE];
+ uae_u8 tbuf[NPSIZE];
- memcpy(tbuf, buf, size);
+ memcpy (tbuf, buf, size);
for (i = 0; i < size; i++) {
int a = (i ^ AXOR) & (size - 1);
- buf[i] = tbuf[wswap(a, 15, 2, 4, 0, 1, 10, 11, 8, 13, 14, 12, 9, 7, 5, 6, 3)];
+ buf[i] = tbuf[wswap (a, 15, 2, 4, 0, 1, 10, 11, 8, 13, 14, 12, 9, 7, 5, 6, 3)];
}
}
void descramble_nordicpro (uae_u8 *buf, int size, int odd)
static struct arcadiarom roms[] = {
- { 49, "ar_bios.zip", "scpa21", ARCADIA_BIOS, 0, 6, 1, 0, 2, 3, 4, 5, 7 },
- { 50, "ar_bios.zip", "gcp-", ARCADIA_BIOS, 3, 7, 6, 5, 4, 3, 2, 1, 0 },
- { 51, "ar_bios.zip", "scpav3_0.", ARCADIA_BIOS, 0, 6, 1, 0, 2, 3, 4, 5, 7 },
-
- { 33, "ar_airh.zip", "airh_", ARCADIA_GAME, 1, 5, 0, 2, 4, 7, 6, 1, 3 },
- { 34, "ar_bowl.zip", "bowl_", ARCADIA_GAME, 1, 7, 6, 0, 1, 2, 3, 4, 5 },
- { 35, "ar_dart.zip", "dart_", ARCADIA_GAME, 1, 4, 0, 7, 6, 3, 1, 2, 5 },
- { 36, "ar_fast.zip", "fastv28.", ARCADIA_GAME, 0, 7, 6, 5, 4, 3, 2, 1, 0 },
- { 37, "ar_ldrb.zip", "lbg240", ARCADIA_GAME, 0, 7, 6, 5, 4, 3, 2, 1, 0 },
- { 38, "ar_ldrba.zip","ldrb_", ARCADIA_GAME, 1, 2, 3, 4, 1, 0, 7, 5, 6 },
- { 39, "ar_ninj.zip", "ninj_", ARCADIA_GAME, 1, 1, 6, 5, 7, 4, 2, 0, 3 },
- { 40, "ar_rdwr.zip", "rdwr_", ARCADIA_GAME, 1, 3, 1, 6, 4, 0, 5, 2, 7 },
- { 41, "ar_sdwr.zip", "sdwr_", ARCADIA_GAME, 1, 6, 3, 4, 5, 2, 1, 0, 7 },
- { 42, "ar_spot.zip", "spotv2.", ARCADIA_GAME, 0, 7, 6, 5, 4, 3, 2, 1, 0 },
- { 43, "ar_sprg.zip", "sprg_", ARCADIA_GAME, 1, 4, 7, 3, 0, 6, 5, 2, 1 },
- { 44, "ar_xeon.zip", "xeon_", ARCADIA_GAME, 1, 3, 1, 2, 4, 0, 5, 6, 7 },
- { 45, "ar_socc.zip", "socc30.", ARCADIA_GAME, 2, 0, 7, 1, 6, 5, 4, 3, 2 },
+ { 49, L"ar_bios.zip", L"scpa21", ARCADIA_BIOS, 0, 6, 1, 0, 2, 3, 4, 5, 7 },
+ { 50, L"ar_bios.zip", L"gcp-", ARCADIA_BIOS, 3, 7, 6, 5, 4, 3, 2, 1, 0 },
+ { 51, L"ar_bios.zip", L"scpav3_0.", ARCADIA_BIOS, 0, 6, 1, 0, 2, 3, 4, 5, 7 },
+
+ { 33, L"ar_airh.zip", L"airh_", ARCADIA_GAME, 1, 5, 0, 2, 4, 7, 6, 1, 3 },
+ { 34, L"ar_bowl.zip", L"bowl_", ARCADIA_GAME, 1, 7, 6, 0, 1, 2, 3, 4, 5 },
+ { 35, L"ar_dart.zip", L"dart_", ARCADIA_GAME, 1, 4, 0, 7, 6, 3, 1, 2, 5 },
+ { 36, L"ar_fast.zip", L"fastv28.", ARCADIA_GAME, 0, 7, 6, 5, 4, 3, 2, 1, 0 },
+ { 37, L"ar_ldrb.zip", L"lbg240", ARCADIA_GAME, 0, 7, 6, 5, 4, 3, 2, 1, 0 },
+ { 38, L"ar_ldrba.zip",L"ldrb_", ARCADIA_GAME, 1, 2, 3, 4, 1, 0, 7, 5, 6 },
+ { 39, L"ar_ninj.zip", L"ninj_", ARCADIA_GAME, 1, 1, 6, 5, 7, 4, 2, 0, 3 },
+ { 40, L"ar_rdwr.zip", L"rdwr_", ARCADIA_GAME, 1, 3, 1, 6, 4, 0, 5, 2, 7 },
+ { 41, L"ar_sdwr.zip", L"sdwr_", ARCADIA_GAME, 1, 6, 3, 4, 5, 2, 1, 0, 7 },
+ { 42, L"ar_spot.zip", L"spotv2.", ARCADIA_GAME, 0, 7, 6, 5, 4, 3, 2, 1, 0 },
+ { 43, L"ar_sprg.zip", L"sprg_", ARCADIA_GAME, 1, 4, 7, 3, 0, 6, 5, 2, 1 },
+ { 44, L"ar_xeon.zip", L"xeon_", ARCADIA_GAME, 1, 3, 1, 2, 4, 0, 5, 6, 7 },
+ { 45, L"ar_socc.zip", L"socc30.", ARCADIA_GAME, 2, 0, 7, 1, 6, 5, 4, 3, 2 },
{ -1 }
};
static int nvwrite;
-static int load_rom8 (char *xpath, uae_u8 *mem, int extra)
+static int load_rom8 (TCHAR *xpath, uae_u8 *mem, int extra)
{
struct zfile *zf;
- char path[MAX_DPATH];
+ TCHAR path[MAX_DPATH];
int i;
- uae_u8 *tmp = (uae_u8*)xmalloc (131072);
- char *bin = extra == 1 ? ".bin" : "";
+ uae_u8 *tmp = xmalloc (131072);
+ TCHAR *bin = extra == 1 ? L".bin" : L"";
memset (tmp, 0, 131072);
- sprintf (path, "%s%s%s", xpath, extra == 3 ? "-hi" : (extra == 2 ? "hi" : "h"), bin);
- zf = zfile_fopen (path, "rb");
+ _stprintf (path, L"%s%s%s", xpath, extra == 3 ? L"-hi" : (extra == 2 ? L"hi" : L"h"), bin);
+ zf = zfile_fopen (path, L"rb");
if (!zf)
goto end;
if (zfile_fread (tmp, 65536, 1, zf) == 0)
goto end;
zfile_fclose (zf);
- sprintf (path, "%s%s%s", xpath, extra == 3 ? "-lo" : (extra == 2 ? "lo" : "l"), bin);
- zf = zfile_fopen (path, "rb");
+ _stprintf (path, L"%s%s%s", xpath, extra == 3 ? L"-lo" : (extra == 2 ? L"lo" : L"l"), bin);
+ zf = zfile_fopen (path, L"rb");
if (!zf)
goto end;
if (zfile_fread (tmp + 65536, 65536, 1, zf) == 0)
return 0;
}
-static struct arcadiarom *is_arcadia (char *xpath, int cnt)
+static struct arcadiarom *is_arcadia (const TCHAR *xpath, int cnt)
{
- char path[MAX_DPATH], *p;
+ TCHAR path[MAX_DPATH], *p;
struct arcadiarom *rom = NULL;
int i;
- strcpy (path, xpath);
+ _tcscpy (path, xpath);
p = path;
- for (i = strlen (xpath) - 1; i > 0; i--) {
+ for (i = _tcslen (xpath) - 1; i > 0; i--) {
if (path[i] == '\\' || path[i] == '/') {
path[i++] = 0;
p = path + i;
}
}
for (i = 0; roms[i].romid > 0; i++) {
- if (!strcmpi (p, roms[i].name) || !strcmpi (p, roms[i].rom)) {
+ if (!_tcsicmp (p, roms[i].name) || !_tcsicmp (p, roms[i].rom)) {
if (cnt > 0) {
cnt--;
continue;
static int load_roms (struct arcadiarom *rom)
{
- char path[MAX_DPATH], path2[MAX_DPATH], path3[MAX_DPATH], *p;
+ TCHAR path[MAX_DPATH], path2[MAX_DPATH], path3[MAX_DPATH], *p;
int i, offset;
- char *xpath;
+ TCHAR *xpath;
if (rom->type == ARCADIA_BIOS)
xpath = currprefs.romextfile;
else
xpath = currprefs.cartfile;
- strcpy (path3, xpath);
- p = path3 + strlen (path3) - 1;
+ _tcscpy (path3, xpath);
+ p = path3 + _tcslen (path3) - 1;
while (p > path3) {
if (p[0] == '\\' || p[0] == '/') {
*p = 0;
}
if (p == path3)
*p = 0;
- strcpy (path2, xpath);
+ _tcscpy (path2, xpath);
offset = 0;
if (rom->type == ARCADIA_BIOS)
offset = bios_offset;
i = 0;
for (;;) {
- sprintf (path, "%s%d", xpath, i + 1);
+ _stprintf (path, L"%s%d", xpath, i + 1);
if (!load_rom8 (path, arbmemory + 2 * 65536 * i + offset, rom->extra)) {
if (i == 0)
- write_log ("Arcadia: %s rom load failed ('%s')\n", rom->type == ARCADIA_BIOS ? "bios" : "game", path);
+ write_log (L"Arcadia: %s rom load failed ('%s')\n", rom->type == ARCADIA_BIOS ? "bios" : "game", path);
break;
}
i++;
}
if (i == 0)
return 0;
- write_log ("Arcadia: %s rom %s loaded\n", rom->type == ARCADIA_BIOS ? "bios" : "game", xpath);
+ write_log (L"Arcadia: %s rom %s loaded\n", rom->type == ARCADIA_BIOS ? "bios" : "game", xpath);
return 1;
}
static addrbank arcadia_boot_bank = {
arbb_lget, arbb_wget, arbb_bget,
arbb_lput, arbb_wput, arbb_bput,
- default_xlate, default_check, NULL, "Arcadia BIOS",
+ default_xlate, default_check, NULL, L"Arcadia BIOS",
arbb_lget, arbb_wget, ABFLAG_ROM
};
static addrbank arcadia_rom_bank = {
arb_lget, arb_wget, arb_bget,
arb_lput, arb_wput, arb_bput,
- default_xlate, default_check, NULL, "Arcadia Game ROM",
+ default_xlate, default_check, NULL, L"Arcadia Game ROM",
arb_lget, arb_wget, ABFLAG_ROM
};
allocated_arbmemory >> 16, 0);
}
-int is_arcadia_rom (char *path)
+int is_arcadia_rom (const TCHAR *path)
{
struct arcadiarom *rom;
static void nvram_write (void)
{
- struct zfile *f = zfile_fopen (currprefs.flashfile, "rb+");
+ struct zfile *f = zfile_fopen (currprefs.flashfile, L"rb+");
if (!f) {
- f = zfile_fopen (currprefs.flashfile, "wb");
+ f = zfile_fopen (currprefs.flashfile, L"wb");
if (!f)
return;
}
{
struct zfile *f;
- f = zfile_fopen (currprefs.flashfile, "rb");
+ f = zfile_fopen (currprefs.flashfile, L"rb");
memset (arbmemory + nvram_offset, 0, NVRAM_SIZE);
if (!f)
return;
return v;
}
-struct romdata *scan_arcadia_rom (char *path, int cnt)
+struct romdata *scan_arcadia_rom (TCHAR *path, int cnt)
{
struct romdata *rd = 0;
struct romlist **arc_rl;
struct arcadiarom *arcadia_rom;
int i;
- arcadia_rom = is_arcadia(path, cnt);
+ arcadia_rom = is_arcadia (path, cnt);
if (arcadia_rom) {
arc_rl = getarcadiaroms();
for (i = 0; arc_rl[i]; i++) {
if (arc_rl[i]->rd->id == arcadia_rom->romid) {
rd = arc_rl[i]->rd;
- strcat(path, "/");
- strcat(path, arcadia_rom->rom);
+ _tcscat (path, L"/");
+ _tcscat (path, arcadia_rom->rom);
break;
}
}
- xfree(arc_rl);
+ xfree (arc_rl);
}
return rd;
}
static void log_error(int track)
{
- write_log ("DMS: Ignored error on track %d!\n", track);
+ write_log (L"DMS: Ignored error on track %d!\n", track);
}
USHORT DMS_Process_File(struct zfile *fi, struct zfile *fo, USHORT cmd, USHORT opt, USHORT PCRC, USHORT pwd){
if ( (cmd == CMD_VIEW) || (cmd == CMD_VIEWFULL) ) {
pv = (USHORT)(c_version/100);
- write_log (" Created with DMS version %d.%02d ",pv,c_version-pv*100);
+ write_log (L" Created with DMS version %d.%02d ",pv,c_version-pv*100);
if (geninfo & 0x80)
- write_log ("Registered\n");
+ write_log (L"Registered\n");
else
- write_log ("Evaluation\n");
+ write_log (L"Evaluation\n");
- write_log (" Creation date : %s",ctime(&date));
- write_log (" Lowest track in archive : %d\n",from);
- write_log (" Highest track in archive : %d\n",to);
- write_log (" Packed data size : %lu\n",pkfsize);
- write_log (" Unpacked data size : %lu\n",unpkfsize);
- write_log (" Disk type of archive : ");
+ write_log (L" Creation date : %s",ctime(&date));
+ write_log (L" Lowest track in archive : %d\n",from);
+ write_log (L" Highest track in archive : %d\n",to);
+ write_log (L" Packed data size : %lu\n",pkfsize);
+ write_log (L" Unpacked data size : %lu\n",unpkfsize);
+ write_log (L" Disk type of archive : ");
/* The original DMS from SDS software (DMS up to 1.11) used other values */
/* in disk type to indicate formats as MS-DOS, AMax and Mac, but it was */
case 0:
case 1:
/* Can also be a non-dos disk */
- write_log ("AmigaOS 1.0 OFS\n");
+ write_log (L"AmigaOS 1.0 OFS\n");
break;
case 2:
- write_log ("AmigaOS 2.0 FFS\n");
+ write_log (L"AmigaOS 2.0 FFS\n");
break;
case 3:
- write_log ("AmigaOS 3.0 OFS / International\n");
+ write_log (L"AmigaOS 3.0 OFS / International\n");
break;
case 4:
- write_log ("AmigaOS 3.0 FFS / International\n");
+ write_log (L"AmigaOS 3.0 FFS / International\n");
break;
case 5:
- write_log ("AmigaOS 3.0 OFS / Dir Cache\n");
+ write_log (L"AmigaOS 3.0 OFS / Dir Cache\n");
break;
case 6:
- write_log ("AmigaOS 3.0 FFS / Dir Cache\n");
+ write_log (L"AmigaOS 3.0 FFS / Dir Cache\n");
break;
case 7:
- write_log ("FMS Amiga System File\n");
+ write_log (L"FMS Amiga System File\n");
break;
default:
- write_log ("Unknown\n");
+ write_log (L"Unknown\n");
}
- write_log (" Compression mode used : ");
+ write_log (L" Compression mode used : ");
if (cmode>6)
- write_log ("Unknown !\n");
+ write_log (L"Unknown !\n");
else
- write_log ("%s\n",modes[cmode]);
-
- write_log (" General info : ");
- if ((geninfo==0)||(geninfo==0x80)) write_log ("None");
- if (geninfo & 1) write_log ("NoZero ");
- if (geninfo & 2) write_log ("Encrypted ");
- if (geninfo & 4) write_log ("Appends ");
- if (geninfo & 8) write_log ("Banner ");
- if (geninfo & 16) write_log ("HD ");
- if (geninfo & 32) write_log ("MS-DOS ");
- if (geninfo & 64) write_log ("DMS_DEV_Fixed ");
- if (geninfo & 256) write_log ("FILEID.DIZ");
- write_log ("\n");
-
- write_log (" Info Header CRC : %04X\n\n",hcrc);
+ write_log (L"%s\n",modes[cmode]);
+
+ write_log (L" General info : ");
+ if ((geninfo==0)||(geninfo==0x80)) write_log (L"None");
+ if (geninfo & 1) write_log (L"NoZero ");
+ if (geninfo & 2) write_log (L"Encrypted ");
+ if (geninfo & 4) write_log (L"Appends ");
+ if (geninfo & 8) write_log (L"Banner ");
+ if (geninfo & 16) write_log (L"HD ");
+ if (geninfo & 32) write_log (L"MS-DOS ");
+ if (geninfo & 64) write_log (L"DMS_DEV_Fixed ");
+ if (geninfo & 256) write_log (L"FILEID.DIZ");
+ write_log (L"\n");
+
+ write_log (L" Info Header CRC : %04X\n\n",hcrc);
}
if (cmd == CMD_VIEWFULL) {
- write_log (" Track Plength Ulength Cmode USUM HCRC DCRC Cflag\n");
- write_log (" ------ ------- ------- ------ ---- ---- ---- -----\n");
+ write_log (L" Track Plength Ulength Cmode USUM HCRC DCRC Cflag\n");
+ write_log (L" ------ ------- ------- ------ ---- ---- ---- -----\n");
}
// if (((cmd==CMD_UNPACK) || (cmd==CMD_SHOWBANNER)) && (geninfo & 2) && (!pwd))
}
}
- if ((cmd == CMD_VIEWFULL) || (cmd == CMD_SHOWDIZ) || (cmd == CMD_SHOWBANNER)) write_log ("\n");
+ if ((cmd == CMD_VIEWFULL) || (cmd == CMD_SHOWDIZ) || (cmd == CMD_SHOWBANNER)) write_log (L"\n");
if (ret == DMS_FILE_END) ret = NO_PROBLEM;
if (cmd == CMD_VIEWFULL) {
if (number==80)
- write_log (" FileID ");
+ write_log (L" FileID ");
else if (number==0xffff)
- write_log (" Banner ");
+ write_log (L" Banner ");
else if ((number==0) && (unpklen==1024))
- write_log (" FakeBB ");
+ write_log (L" FakeBB ");
else
- write_log (" %2d ",(short)number);
+ write_log (L" %2d ",(short)number);
- write_log ("%5d %5d %s %04X %04X %04X %0d\n", pklen1, unpklen, modes[cmode], usum, hcrc, dcrc, flags);
+ write_log (L"%5d %5d %s %04X %04X %04X %0d\n", pklen1, unpklen, modes[cmode], usum, hcrc, dcrc, flags);
}
if ((pklen1 > TRACK_BUFFER_LEN) || (pklen2 >TRACK_BUFFER_LEN) || (unpklen > TRACK_BUFFER_LEN)) return ERR_BIGTRACK;
if (usum1 == Calc_CheckSum(b2,(ULONG)unpklen)) {
passfound = maybeencrypted;
if (passfound)
- write_log ("DMS: decryption key = 0x%04X\n", prevpass);
+ write_log (L"DMS: decryption key = 0x%04X\n", prevpass);
err = NO_PROBLEM;
pass = prevpass;
break;
while (i<m+len) {
if (*i == 10) {
*i=0;
- write_log ("%s\n",j);
+ write_log (L"%s\n",j);
j=i+1;
}
i++;
if (zfile_fread(data + I_HEADER_CHECKSUM,
sizeof(char), header_size - 1, fp) < header_size - 1) {
- fatal_error("Invalid header (LHarc file ?)");
+ fatal_error(L"Invalid header (LHarc file ?)");
return FALSE; /* finish */
}
setup_get(data + I_HEADER_LEVEL);
hdr->header_level = get_byte ();
if (hdr->header_level != 2 &&
zfile_fread(data + header_size, sizeof(char), 2, fp) < 2) {
- fatal_error("Invalid header (LHarc file ?)");
+ fatal_error(L"Invalid header (LHarc file ?)");
return FALSE; /* finish */
}
if (hdr->header_level >= 3) {
- fatal_error("Unknown level header");
+ fatal_error(L"Unknown level header");
return FALSE;
}
if ((hdr->header_level = get_byte ()) != 2) {
if (calc_sum(data + I_METHOD, header_size) != checksum)
- warning("Checksum error (LHarc file?)", "");
+ warning(L"Checksum error (LHarc file?)", L"");
name_length = get_byte ();
for (i = 0; i < name_length; i++)
hdr->name[i] = (char) get_byte ();
hdr->extend_type = EXTEND_GENERIC;
hdr->has_crc = FALSE;
} else {
- fatal_error("Unkonwn header (lha file?)");
+ fatal_error(L"Unkonwn header (lha file?)");
return FALSE;
}
} else {
if (hdr->header_level != 2 &&
((data + LZHEADER_STRAGE - get_ptr < header_size) ||
zfile_fread(get_ptr, sizeof(char), header_size, fp) < header_size)) {
- fatal_error("Invalid header (LHa file ?)");
+ fatal_error(L"Invalid header (LHa file ?)");
return FALSE;
}
switch (get_byte ()) {
total += weight[i] * count[i];
}
if ((total & 0xffff) != 0)
- error("make_table()", "Bad table (5)\n");
+ error(L"make_table()", L"Bad table (5)\n");
/* shift data for make table. */
m = 16 - tablebits;
{
char *p = (char *) realloc(old, size);
if (!p)
- fatal_error("Not enough memory");
+ fatal_error(L"Not enough memory");
return p;
}
method = i;
}
memset(&zai, 0, sizeof zai);
- zai.name = hdr.name;
+ zai.name = au (hdr.name);
zai.size = hdr.original_size;
zai.flags = hdr.attribute;
zai.t = hdr.unix_last_modified_stamp -= _timezone;
if (hdr.name[strlen(hdr.name) + 1] != 0)
- zai.comment = &hdr.name[strlen(hdr.name) + 1];
+ zai.comment = au (&hdr.name[strlen(hdr.name) + 1]);
if (method == LZHDIRS_METHOD_NUM) {
zvolume_adddir_abs(zv, &zai);
} else {
zn->packedsize = hdr.packed_size;
zn->method = method;
}
+ xfree (zai.name);
+ xfree (zai.comment);
zfile_fseek(zf, hdr.packed_size, SEEK_CUR);
}
unpsize -= decrunch_length;
crc_calc (pdest, decrunch_length);
} else {
- write_log ("LZX corrupt compressed data %s\n", zn->name);
+ write_log (L"LZX corrupt compressed data %s\n", zn->name);
goto end;
}
}
second = temp & 63;
memset(&zai, 0, sizeof zai);
- zai.name = header_filename;
+ zai.name = au (header_filename);
if (header_comment[0])
- zai.comment = header_comment;
+ zai.comment = au (header_comment);
zai.flags |= (attributes & 32) ? 0x80 : 0;
zai.flags |= (attributes & 64) ? 0x40 : 0;
zai.flags |= (attributes & 128) ? 0x20 : 0;
zai.size = unpack_size;
zn = zvolume_addfile_abs(zv, &zai);
zn->offset2 = merge_size;
+ xfree (zai.name);
+ xfree (zai.comment);
total_pack += pack_size;
total_unpack += unpack_size;
else
abort = 0; /* continue */
- //write_log ("unp=%6d mrg=%6d pack=%6d off=%6d %s\n", unpack_size, merge_size, pack_size, zn->offset, zai.name);
+ //write_log (L"unp=%6d mrg=%6d pack=%6d off=%6d %s\n", unpack_size, merge_size, pack_size, zn->offset, zai.name);
}
if (!iswrp (buf))
break;
if (!nf) {
- nf = zfile_fopen_empty ("zipped.wrp", 1760 * 512);
- tmpf = zfile_fopen_empty ("tmp", outsize2);
+ nf = zfile_fopen_empty (L"zipped.wrp", 1760 * 512);
+ tmpf = zfile_fopen_empty (L"tmp", outsize2);
}
track = (buf[10] << 8) | buf[11];
algo = buf[19];
}
break;
default:
- write_log ("WRP unknown compression method %d, track=%d,size=%d\n", algo, track, side);
+ write_log (L"WRP unknown compression method %d, track=%d,size=%d\n", algo, track, side);
goto end;
break;
}
if (err) {
- write_log ("WRP corrupt data, track=%d,side=%d,err=%d\n", track, side, err);
+ write_log (L"WRP corrupt data, track=%d,side=%d,err=%d\n", track, side, err);
} else {
uae_u16 crc2;
int os = zfile_ftell (tmpf);
data = zfile_getdata (tmpf, 0, os);
crc2 = wrpcrc16 (wrpcrc16table, data, os);
if (crc != crc2)
- write_log ("WRP crc error %04x<>%04x, track=%d,side=%d\n", crc, crc2, track, side);
+ write_log (L"WRP crc error %04x<>%04x, track=%d,side=%d\n", crc, crc2, track, side);
xfree (data);
}
if (dstpos >= 0) {
sample[i] += 0x80;
}
-static void namesplit (char *s)
+static void namesplit (TCHAR *s)
{
int l;
- l = strlen (s) - 1;
+ l = _tcslen (s) - 1;
while (l >= 0) {
if (s[l] == '.')
s[l] = 0;
l--;
}
if (l > 0)
- memmove (s, s + l, strlen (s + l) + 1);
+ memmove (s, s + l, (_tcslen (s + l) + 1) * sizeof (TCHAR));
}
void audio_sampleripper (int mode)
{
struct ripped_sample *rs = ripped_samples;
int cnt = 1;
- char path[MAX_DPATH], name[MAX_DPATH], filename[MAX_DPATH];
- char underline[] = "_";
- char extension[4];
+ TCHAR path[MAX_DPATH], name[MAX_DPATH], filename[MAX_DPATH];
+ TCHAR underline[] = L"_";
+ TCHAR extension[4];
struct zfile *wavfile;
if (mode < 0) {
fetch_ripperpath (path, sizeof (path));
name[0] = 0;
if (currprefs.dfxtype[0] >= 0)
- strcpy (name, currprefs.df[0]);
+ _tcscpy (name, currprefs.df[0]);
if (!name[0])
underline[0] = 0;
namesplit (name);
- strcpy (extension, "wav");
- sprintf (filename, "%s%s%s%03.3d.%s", path, name, underline, cnt, extension);
- wavfile = zfile_fopen(filename, "wb");
+ _tcscpy (extension, L"wav");
+ _stprintf (filename, L"%s%s%s%03.3d.%s", path, name, underline, cnt, extension);
+ wavfile = zfile_fopen (filename, L"wb");
if (wavfile) {
int freq = rs->per > 0 ? (currprefs.ntscmode ? 3579545 : 3546895 / rs->per) : 8000;
write_wavheader (wavfile, 0, 0);
convertsample (rs->sample, rs->len);
write_wavheader (wavfile, zfile_ftell(wavfile), freq);
zfile_fclose (wavfile);
- write_log ("SAMPLERIPPER: %d: %dHz %d bytes\n", cnt, freq, rs->len);
+ write_log (L"SAMPLERIPPER: %d: %dHz %d bytes\n", cnt, freq, rs->len);
} else {
- write_log ("SAMPLERIPPER: failed to open '%s'\n", filename);
+ write_log (L"SAMPLERIPPER: failed to open '%s'\n", filename);
}
}
cnt++;
xfree (rs->sample);
rs->sample = xmalloc (len);
memcpy (rs->sample, smp, len);
- write_log ("SAMPLERIPPER: replaced sample %d (%d -> %d)\n", cnt, rs->len, len);
+ write_log (L"SAMPLERIPPER: replaced sample %d (%d -> %d)\n", cnt, rs->len, len);
rs->len = len;
rs->per = adp->per / CYCLE_UNIT;
rs->changed = 1;
memcpy(rs->sample, smp, len);
rs->next = NULL;
rs->changed = 1;
- write_log ("SAMPLERIPPER: sample added (%06X, %d bytes), total %d samples\n", adp->pt, len, ++cnt);
+ write_log (L"SAMPLERIPPER: sample added (%06X, %d bytes), total %d samples\n", adp->pt, len, ++cnt);
audio_sampleripper (0);
}
* write data into sinc queue for mixing in the BLEP */
if (acd->sinc_output_state != output) {
if (acd->sinc_queue_length > SINC_QUEUE_LENGTH - 1) {
- //write_log ("warning: sinc queue truncated. Last age: %d.\n", acd->sinc_queue[SINC_QUEUE_LENGTH-1].age);
+ //write_log (L"warning: sinc queue truncated. Last age: %d.\n", acd->sinc_queue[SINC_QUEUE_LENGTH-1].age);
acd->sinc_queue_length = SINC_QUEUE_LENGTH - 1;
}
/* make room for new and add the new value */
{
#ifdef DEBUG_AUDIO
if (debugchannel (nr))
- write_log ("SETIRQ %d %08X\n", nr, M68K_GETPC);
+ write_log (L"SETIRQ %d %08X\n", nr, M68K_GETPC);
#endif
INTREQ (0x8000 | (0x80 << nr));
}
do_samplerip (cdp);
#ifdef DEBUG_AUDIO
if (debugchannel (cdp - audio_channel))
- write_log ("Channel %d looped, LC=%08X LEN=%d\n", cdp - audio_channel, cdp->pt, cdp->wlen);
+ write_log (L"Channel %d looped, LC=%08X LEN=%d\n", cdp - audio_channel, cdp->pt, cdp->wlen);
#endif
} else {
cdp->wlen = (cdp->wlen - 1) & 0xFFFF;
cdp->pt = cdp->lc;
#ifdef DEBUG_AUDIO
if (debugchannel (nr))
- write_log ("%d:0>1: LEN=%d\n", nr, cdp->wlen);
+ write_log (L"%d:0>1: LEN=%d\n", nr, cdp->wlen);
#endif
cdp->request_word = 0;
cdp->request_word_skip = 0;
if (currprefs.produce_sound >= 2) {
if (!init_audio ()) {
if (! sound_available) {
- write_log ("Sound is not supported.\n");
+ write_log (L"Sound is not supported.\n");
} else {
- write_log ("Sorry, can't initialize sound.\n");
+ write_log (L"Sorry, can't initialize sound.\n");
currprefs.produce_sound = 0;
/* So we don't do this every frame */
changed_prefs.produce_sound = 0;
do_samplerip (cdp);
#ifdef DEBUG_AUDIO
if (debugchannel (nr))
- write_log ("%d:>5: LEN=%d PT=%08X\n", nr, cdp->wlen, cdp->pt);
+ write_log (L"%d:>5: LEN=%d PT=%08X\n", nr, cdp->wlen, cdp->pt);
#endif
}
cdp->dat2 = chipmem_agnus_wget (cdp->pt);
if (cdp->dmaen != chan_ena) {
#ifdef DEBUG_AUDIO
if (debugchannel (nr))
- write_log ("AUD%dDMA %d->%d (%d) LEN=%d/%d %08X\n", nr, cdp->dmaen, chan_ena,
+ write_log (L"AUD%dDMA %d->%d (%d) LEN=%d/%d %08X\n", nr, cdp->dmaen, chan_ena,
cdp->state, cdp->wlen, cdp->len, M68K_GETPC);
#endif
cdp->dmaen = chan_ena;
#ifdef DEBUG_AUDIO
if (debugchannel (nr))
- write_log ("AUD%dDAT: %04X STATE=%d IRQ=%d %08X\n", nr,
+ write_log (L"AUD%dDAT: %04X STATE=%d IRQ=%d %08X\n", nr,
v, cdp->state, isirq(nr) ? 1 : 0, M68K_GETPC);
#endif
audio_activate();
audio_channel[nr].lc = (audio_channel[nr].lc & 0xffff) | ((uae_u32)v << 16);
#ifdef DEBUG_AUDIO
if (debugchannel (nr))
- write_log ("AUD%dLCH: %04X %08X\n", nr, v, M68K_GETPC);
+ write_log (L"AUD%dLCH: %04X %08X\n", nr, v, M68K_GETPC);
#endif
}
audio_channel[nr].lc = (audio_channel[nr].lc & ~0xffff) | (v & 0xFFFE);
#ifdef DEBUG_AUDIO
if (debugchannel (nr))
- write_log ("AUD%dLCL: %04X %08X\n", nr, v, M68K_GETPC);
+ write_log (L"AUD%dLCL: %04X %08X\n", nr, v, M68K_GETPC);
#endif
}
audio_channel[nr].per = per;
#ifdef DEBUG_AUDIO
if (debugchannel (nr))
- write_log ("AUD%dPER: %d %08X\n", nr, v, M68K_GETPC);
+ write_log (L"AUD%dPER: %d %08X\n", nr, v, M68K_GETPC);
#endif
}
audio_channel[nr].len = v;
#ifdef DEBUG_AUDIO
if (debugchannel (nr))
- write_log ("AUD%dLEN: %d %08X\n", nr, v, M68K_GETPC);
+ write_log (L"AUD%dLEN: %d %08X\n", nr, v, M68K_GETPC);
#endif
}
#endif
#ifdef DEBUG_AUDIO
if (debugchannel (nr))
- write_log ("AUD%dVOL: %d %08X\n", nr, v2, M68K_GETPC);
+ write_log (L"AUD%dVOL: %d %08X\n", nr, v2, M68K_GETPC);
#endif
}
if ((1 << i) & DEBUG_CHANNEL_MASK) {
uae_u16 mask = 0x80 << i;
if ((v2 & mask) != (v3 & mask))
- write_log ("AUD%dINTREQ %d->%d %08X\n", i, !!(v3 & mask), !!(v2 & mask), M68K_GETPC);
+ write_log (L"AUD%dINTREQ %d->%d %08X\n", i, !!(v3 & mask), !!(v2 & mask), M68K_GETPC);
}
}
#endif
if ((prevcon & 0xff) != (adkcon & 0xff)) {
audio_activate();
#ifdef DEBUG_AUDIO
- write_log ("ADKCON=%02x %08X\n", adkcon & 0xff, M68K_GETPC);
+ write_log (L"ADKCON=%02x %08X\n", adkcon & 0xff, M68K_GETPC);
#endif
prevcon = adkcon;
}
addrbank rtarea_bank = {
rtarea_lget, rtarea_wget, rtarea_bget,
rtarea_lput, rtarea_wput, rtarea_bput,
- rtarea_xlate, rtarea_check, NULL, "UAE Boot ROM",
+ rtarea_xlate, rtarea_check, NULL, L"UAE Boot ROM",
rtarea_lget, rtarea_wget, ABFLAG_ROMIN
};
* backward. store pointer at current address
*/
-uae_u32 ds (const char *str)
+uae_u32 ds_ansi (const uae_char *str)
{
int len;
return addr (rt_straddr);
len = strlen (str) + 1;
rt_straddr -= len;
- strcpy ((char *)rtarea + rt_straddr, str);
+ strcpy ((uae_char*)rtarea + rt_straddr, str);
return addr (rt_straddr);
}
+uae_u32 ds (const TCHAR *str)
+{
+ char *s = ua (str);
+ uae_u32 v = ds_ansi (s);
+ xfree (s);
+ return v;
+}
+
void calltrap (uae_u32 n)
{
dw (0xA000 + n);
void org (uae_u32 a)
{
if ( ((a & 0xffff0000) != 0x00f00000) && ((a & 0xffff0000) != rtarea_base) )
- write_log ("ORG: corrupt address! %08X", a);
+ write_log (L"ORG: corrupt address! %08X", a);
rt_addr = a & 0xffff;
}
static uae_u32 REGPARAM2 nullfunc (TrapContext *context)
{
- write_log ("Null function called\n");
+ write_log (L"Null function called\n");
return 0;
}
static uae_u32 REGPARAM2 uae_puts (TrapContext *context)
{
- puts ((char *)get_real_address (m68k_areg (&context->regs, 0)));
+ puts ((uae_u8*)get_real_address (m68k_areg (&context->regs, 0)));
return 0;
}
void rtarea_init_mem (void)
{
- rtarea = mapped_malloc (0x10000, "rtarea");
+ rtarea = mapped_malloc (0x10000, L"rtarea");
if (!rtarea) {
- write_log ("virtual memory exhausted (rtarea)!\n");
+ write_log (L"virtual memory exhausted (rtarea)!\n");
abort ();
}
rtarea_bank.baseaddr = rtarea;
void rtarea_init (void)
{
uae_u32 a;
- char uaever[100];
+ TCHAR uaever[100];
rt_straddr = 0xFF00 - 2;
rt_addr = 0;
rtarea_init_mem ();
memset (rtarea, 0, 0x10000);
- sprintf (uaever, "uae-%d.%d.%d", UAEMAJOR, UAEMINOR, UAESUBREV);
+ _stprintf (uaever, L"uae-%d.%d.%d", UAEMAJOR, UAEMINOR, UAESUBREV);
EXPANSION_uaeversion = ds (uaever);
- EXPANSION_explibname = ds ("expansion.library");
- EXPANSION_doslibname = ds ("dos.library");
- EXPANSION_uaedevname = ds ("uae.device");
+ EXPANSION_explibname = ds (L"expansion.library");
+ EXPANSION_doslibname = ds (L"dos.library");
+ EXPANSION_uaedevname = ds (L"uae.device");
deftrap (NULL); /* Generic emulator trap */
a = here();
/* Dummy trap - removing this breaks the filesys emulation. */
org (rtarea_base + 0xFF00);
- calltrap (deftrap2 (nullfunc, TRAPFLAG_NO_RETVAL, ""));
+ calltrap (deftrap2 (nullfunc, TRAPFLAG_NO_RETVAL, L""));
org (rtarea_base + 0xFF80);
- calltrap (deftrapres (getchipmemsize, TRAPFLAG_DORET, "getchipmemsize"));
+ calltrap (deftrapres (getchipmemsize, TRAPFLAG_DORET, L"getchipmemsize"));
org (rtarea_base + 0xFF10);
- calltrap (deftrapres (uae_puts, TRAPFLAG_NO_RETVAL, "uae_puts"));
+ calltrap (deftrapres (uae_puts, TRAPFLAG_NO_RETVAL, L"uae_puts"));
dw (RTS);
org (a);
{
uaecptr base = need_uae_boot_rom ();
if (base) {
- write_log ("RTAREA located at %08X\n", base);
+ write_log (L"RTAREA located at %08X\n", base);
rtarea_base = base;
}
}
static void blitter_dump (void)
{
- write_log ("APT=%08X BPT=%08X CPT=%08X DPT=%08X\n", bltapt, bltbpt, bltcpt, bltdpt);
- write_log ("CON0=%04X CON1=%04X ADAT=%04X BDAT=%04X CDAT=%04X\n",
+ write_log (L"APT=%08X BPT=%08X CPT=%08X DPT=%08X\n", bltapt, bltbpt, bltcpt, bltdpt);
+ write_log (L"CON0=%04X CON1=%04X ADAT=%04X BDAT=%04X CDAT=%04X\n",
bltcon0, bltcon1, blt_info.bltadat, blt_info.bltbdat, blt_info.bltcdat);
- write_log ("AFWM=%04X ALWM=%04X AMOD=%04X BMOD=%04X CMOD=%04X DMOD=%04X\n",
+ write_log (L"AFWM=%04X ALWM=%04X AMOD=%04X BMOD=%04X CMOD=%04X DMOD=%04X\n",
blt_info.bltafwm, blt_info.bltalwm,
blt_info.bltamod & 0xffff, blt_info.bltbmod & 0xffff, blt_info.bltcmod & 0xffff, blt_info.bltdmod & 0xffff);
}
event2_remevent (ev2_blitter);
unset_special (®s, SPCFLAG_BLTNASTY);
#ifdef BLITTER_DEBUG
- write_log ("vpos=%d, cycles %d, missed %d, total %d\n",
+ write_log (L"vpos=%d, cycles %d, missed %d, total %d\n",
vpos, blit_cyclecounter, blit_misscyclecounter, blit_cyclecounter + blit_misscyclecounter);
#endif
}
uaecptr dstp = 0;
int dodst = 0;
- /*if (!blitfill) write_log ("minterm %x not present\n",mt); */
+ /*if (!blitfill) write_log (L"minterm %x not present\n",mt); */
for (j = 0; j < blt_info.vblitsize; j++) {
blitfc = !!(bltcon1 & 0x4);
for (i = 0; i < blt_info.hblitsize; i++) {
/* "free" blitter in immediate mode if it has been "stuck" ~3 frames
* fixes some JIT game incompatibilities
*/
- debugtest (DEBUGTEST_BLITTER, "force-unstuck!\n");
+ debugtest (DEBUGTEST_BLITTER, L"force-unstuck!\n");
}
blitter_stuck = 0;
if (blit_slowdown > 0 && !currprefs.immediate_blits) {
*/
odmacon = dmacon;
dmacon |= DMA_MASTER | DMA_BLITTER;
- write_log ("forcing blitter finish\n");
+ write_log (L"forcing blitter finish\n");
if (blitter_cycle_exact) {
int rounds = 10000;
while (bltstate != BLT_done && rounds > 0) {
rounds--;
}
if (rounds == 0)
- write_log ("blitter froze!?\n");
+ write_log (L"blitter froze!?\n");
} else {
actually_do_blit ();
}
if (blitline) {
if (blt_info.hblitsize != 2)
- debugtest (DEBUGTEST_BLITTER, "weird hblitsize in linemode: %d vsize=%d\n",
+ debugtest (DEBUGTEST_BLITTER, L"weird hblitsize in linemode: %d vsize=%d\n",
blt_info.hblitsize, blt_info.vblitsize);
blit_diag = blit_cycle_diagram_line;
} else {
blitfc = !!(bltcon1 & 0x4);
blitife = bltcon1 & 0x8;
if ((bltcon1 & 0x18) == 0x18) {
- debugtest (DEBUGTEST_BLITTER, "weird fill mode\n");
+ debugtest (DEBUGTEST_BLITTER, L"weird fill mode\n");
blitife = 0;
}
}
if (blitfill && !blitdesc)
- debugtest (DEBUGTEST_BLITTER, "fill without desc\n");
+ debugtest (DEBUGTEST_BLITTER, L"fill without desc\n");
blit_diag = blitfill ? blit_cycle_diagram_fill[blit_ch] : blit_cycle_diagram[blit_ch];
}
if ((bltcon1 & 0x80) && (currprefs.chipset_mask & CSMASK_ECS_AGNUS))
- debugtest (DEBUGTEST_BLITTER, "ECS BLTCON1 DOFF-bit set\n");
+ debugtest (DEBUGTEST_BLITTER, L"ECS BLTCON1 DOFF-bit set\n");
blit_dmacount = blit_dmacount2 = 0;
blit_nod = 1;
if (1) {
int ch = 0;
if (oldstate != BLT_done)
- write_log ("blitter was already active!\n");
+ write_log (L"blitter was already active!\n");
if (blit_ch & 1)
ch++;
if (blit_ch & 2)
ch++;
if (blit_ch & 8)
ch++;
- write_log ("blitstart: v=%03d h=%03d %dx%d ch=%d %d*%d=%d d=%d f=%02X n=%d pc=%p l=%d dma=%04X\n",
+ write_log (L"blitstart: v=%03d h=%03d %dx%d ch=%d %d*%d=%d d=%d f=%02X n=%d pc=%p l=%d dma=%04X\n",
vpos, hpos, blt_info.hblitsize, blt_info.vblitsize, ch, blit_diag[1], cycles, blit_diag[1] * cycles,
blitdesc ? 1 : 0, blitfill, dmaen (DMA_BLITPRI) ? 1 : 0, M68K_GETPC, blitline, dmacon);
blitter_dump ();
#ifndef BLITTER_DEBUG
warned = 1;
#endif
- debugtest (DEBUGTEST_BLITTER, "program does not wait for blitter vpos=%d tc=%d\n",
+ debugtest (DEBUGTEST_BLITTER, L"program does not wait for blitter vpos=%d tc=%d\n",
vpos, blit_cyclecounter);
}
bltstate = (flags & 1) ? BLT_init : BLT_done;
if (flags & 2) {
- write_log ("blitter was force-finished when this statefile was saved\n");
- write_log ("contact the author if restored program freezes\n");
+ write_log (L"blitter was force-finished when this statefile was saved\n");
+ write_log (L"contact the author if restored program freezes\n");
}
return src;
}
void restore_blitter_finish (void)
{
if (bltstate == BLT_init) {
- write_log ("blitter was started but DMA was inactive during save\n");
+ write_log (L"blitter was started but DMA was inactive during save\n");
do_blitter (0);
}
}
forced = 0;
if (bltstate != BLT_done && bltstate != BLT_init) {
- write_log ("blitter is active, forcing immediate finish\n");
+ write_log (L"blitter is active, forcing immediate finish\n");
/* blitter is active just now but we don't have blitter state support yet */
blitter_force_finish ();
forced = 2;
if (have_ioctl)
support_ioctl = device_func[DF_IOCTL]->openbus (1 << INQ_ROMD) ? 1 : 0;
initialized = 1;
- write_log ("support_scsi = %d support_ioctl = %d\n", support_scsi, support_ioctl);
+ write_log (L"support_scsi = %d support_ioctl = %d\n", support_scsi, support_ioctl);
return (support_scsi ? (1 << DF_SCSI) : 0) | (support_ioctl ? (1 << DF_IOCTL) : 0);
}
{
int i;
for (i = 0; i < cdblen; i++) {
- write_log ("%s%02X", i > 0 ? "." : "", cdb[i]);
+ write_log (L"%s%02X", i > 0 ? "." : "", cdb[i]);
}
- write_log ("\n");
+ write_log (L"\n");
if (data) {
- write_log ("DATAOUT: %d\n", datalen);
+ write_log (L"DATAOUT: %d\n", datalen);
for (i = 0; i < datalen && i < 100; i++)
- write_log ("%s%02X", i > 0 ? "." : "", data[i]);
+ write_log (L"%s%02X", i > 0 ? "." : "", data[i]);
if (datalen > 0)
- write_log ("\n");
+ write_log (L"\n");
}
}
void scsi_log_after (uae_u8 *data, int datalen, uae_u8 *sense, int senselen)
{
int i;
- write_log ("DATAIN: %d\n", datalen);
+ write_log (L"DATAIN: %d\n", datalen);
for (i = 0; i < datalen && i < 100 && data; i++)
- write_log ("%s%02X", i > 0 ? "." : "", data[i]);
+ write_log (L"%s%02X", i > 0 ? "." : "", data[i]);
if (data && datalen > 0)
- write_log ("\n");
+ write_log (L"\n");
if (senselen > 0) {
- write_log ("SENSE: %d,", senselen);
+ write_log (L"SENSE: %d,", senselen);
for (i = 0; i < senselen && i < 32; i++) {
- write_log ("%s%02X", i > 0 ? "." : "", sense[i]);
+ write_log (L"%s%02X", i > 0 ? "." : "", sense[i]);
}
- write_log ("\n");
+ write_log (L"\n");
}
}
static long curruniqid = 65536;
static struct sockd *sockdata;
-uae_u32 strncpyha (uae_u32 dst, const char *src, int size)
+uae_u32 strncpyha (uae_u32 dst, const uae_char *src, int size)
{
uae_u32 res = dst;
- if (!addr_valid("strncpyha", dst, size))
+ if (!addr_valid (L"strncpyha", dst, size))
return res;
while (size--) {
put_byte (dst++, *src);
return res;
}
-uae_u32 addstr (uae_u32 * dst, const char *src)
+uae_u32 addstr (uae_u32 * dst, const TCHAR *src)
+{
+ uae_u32 res = *dst;
+ int len;
+ char *s = ua (src);
+ len = strlen (s) + 1;
+ strcpyha_safe (*dst, s);
+ (*dst) += len;
+ xfree (s);
+ return res;
+}
+uae_u32 addstr_ansi (uae_u32 * dst, const uae_char *src)
{
uae_u32 res = *dst;
int len;
-
len = strlen (src) + 1;
-
strcpyha_safe (*dst, src);
(*dst) += len;
-
return res;
}
-uae_u32 addmem (uae_u32 * dst, const char *src, int len)
+uae_u32 addmem (uae_u32 * dst, const uae_char *src, int len)
{
uae_u32 res = *dst;
m68k_areg (&context->regs, 1) = a1;
- TRACE (("[%s] ", get_real_address (get_long (currtask + 10))));
+ BSDTRACE ((L"[%s] ", get_real_address (get_long (currtask + 10))));
return currtask;
}
return TRUE;
}
}
- TRACE(("checksd FALSE s 0x%x sd %d\n",s,sd));
+ BSDTRACE(("checksd FALSE s 0x%x sd %d\n",s,sd));
return FALSE;
}
SOCKET_TYPE getsock (SB, int sd)
{
if ((unsigned int) (sd - 1) >= (unsigned int) sb->dtablesize) {
- TRACE (("Invalid Socket Descriptor (%d)\n", sd));
+ BSDTRACE ((L"Invalid Socket Descriptor (%d)\n", sd));
bsdsocklib_seterrno (sb, 38); /* ENOTSOCK */
return -1;
}
if (sb->dtable[sd - 1] == INVALID_SOCKET) {
struct socketbase *sb1, *nsb;
uaecptr ot;
- if (!addr_valid("getsock1", sb->ownertask + 10, 4))
+ if (!addr_valid (L"getsock1", sb->ownertask + 10, 4))
return -1;
ot = get_long (sb->ownertask + 10);
- if (!addr_valid("getsock2", ot, 1))
+ if (!addr_valid (L"getsock2", ot, 1))
return -1;
// Fix for Newsrog (All Tasks of Newsrog using the same dtable)
for (sb1 = socketbases; sb1; sb1 = nsb) {
uaecptr ot1;
- if (!addr_valid("getsock3", sb1->ownertask + 10, 4))
+ if (!addr_valid (L"getsock3", sb1->ownertask + 10, 4))
break;
ot1 = get_long (sb1->ownertask + 10);
- if (!addr_valid("getsock4", ot1, 1))
+ if (!addr_valid (L"getsock4", ot1, 1))
break;
if (strcmp(get_real_address (ot1), get_real_address (ot)) == 0) {
// Task with same name already exists -> use same dtable
sb->signal = CallLib (context, get_long (4), -0x14A); /* AllocSignal */
if (sb->signal == -1) {
- write_log ("bsdsocket: ERROR: Couldn't allocate signal for task 0x%lx.\n", sb->ownertask);
+ write_log (L"bsdsocket: ERROR: Couldn't allocate signal for task 0x%lx.\n", sb->ownertask);
free (sb);
return NULL;
}
static uae_u32 REGPARAM2 bsdsocklib_Expunge (TrapContext *context)
{
- TRACE (("Expunge() -> [ignored]\n"));
+ BSDTRACE ((L"Expunge() -> [ignored]\n"));
return 0;
}
int opencount;
SB;
- TRACE (("OpenLibrary() -> "));
+ BSDTRACE ((L"OpenLibrary() -> "));
if ((sb = alloc_socketbase (context)) != NULL) {
put_word (SockLibBase + 32, opencount = get_word (SockLibBase + 32) + 1);
put_pointer (result + offsetof (struct UAEBSDBase, sb), sb);
- TRACE (("%0lx [%d]\n", result, opencount));
+ BSDTRACE ((L"%0lx [%d]\n", result, opencount));
} else
- TRACE (("failed (out of memory)\n"));
+ BSDTRACE ((L"failed (out of memory)\n"));
return result;
}
m68k_dreg (&context->regs, 0) = negsize + get_word (base + 18);
CallLib (context, get_long (4), -0xD2); /* FreeMem */
- TRACE (("CloseLibrary() -> [%d]\n", opencount));
+ BSDTRACE ((L"CloseLibrary() -> [%d]\n", opencount));
return 0;
}
{
struct socketbase *sb = get_socketbase (context);
- TRACE (("SetSocketSignals(0x%08lx,0x%08lx,0x%08lx) -> ", m68k_dreg (&context->regs, 0), m68k_dreg (&context->regs, 1), m68k_dreg (&context->regs, 2)));
+ BSDTRACE ((L"SetSocketSignals(0x%08lx,0x%08lx,0x%08lx) -> ", m68k_dreg (&context->regs, 0), m68k_dreg (&context->regs, 1), m68k_dreg (&context->regs, 2)));
sb->eintrsigs = m68k_dreg (&context->regs, 0);
sb->eventsigs = m68k_dreg (&context->regs, 1);
id = m68k_dreg (&context->regs, 0);
- TRACE (("ObtainSocket(%d,%d,%d,%d) -> ", id, m68k_dreg (&context->regs, 1), m68k_dreg (&context->regs, 2), m68k_dreg (&context->regs, 3)));
+ BSDTRACE ((L"ObtainSocket(%d,%d,%d,%d) -> ", id, m68k_dreg (&context->regs, 1), m68k_dreg (&context->regs, 2), m68k_dreg (&context->regs, 3)));
i = sockpoolindex (id);
if (i == -1) {
- TRACE (("[invalid key]\n"));
+ BSDTRACE ((L"[invalid key]\n"));
return -1;
}
s = sockdata->sockpoolsocks[i];
sd = getsd (sb, s);
- TRACE (("%d\n", sd));
+ BSDTRACE ((L"%d\n", sd));
if (sd != -1) {
sb->ftable[sd - 1] = sockdata->sockpoolflags[i];
id = m68k_dreg (&context->regs, 1);
sd++;
- TRACE (("ReleaseSocket(%d,%d) -> ", sd, id));
+ BSDTRACE ((L"ReleaseSocket(%d,%d) -> ", sd, id));
s = getsock (sb, sd);
flags = sb->ftable[sd - 1];
if (flags & REP_ALL) {
- write_log ("bsdsocket: ERROR: ReleaseSocket() is not supported for sockets with async event notification enabled!\n");
+ write_log (L"bsdsocket: ERROR: ReleaseSocket() is not supported for sockets with async event notification enabled!\n");
return -1;
}
releasesock (sb, sd);
id = curruniqid;
} else if (id < 0 && id > 65535) {
if (sockpoolindex (id) != -1) {
- TRACE (("[unique ID already exists]\n"));
+ BSDTRACE ((L"[unique ID already exists]\n"));
return -1;
}
}
i = sockpoolindex (-1);
if (i == -1) {
- TRACE (("-1\n"));
- write_log (("bsdsocket: ERROR: Global socket pool overflow\n"));
+ BSDTRACE ((L"-1\n"));
+ write_log (L"bsdsocket: ERROR: Global socket pool overflow\n");
return -1;
}
sockdata->sockpoolids[i] = id;
sockdata->sockpoolsocks[i] = s;
sockdata->sockpoolflags[i] = flags;
- TRACE (("id %d s 0x%x\n", id,s));
+ BSDTRACE ((L"id %d s 0x%x\n", id,s));
} else {
- TRACE (("[invalid socket descriptor]\n"));
+ BSDTRACE ((L"[invalid socket descriptor]\n"));
return -1;
}
id = m68k_dreg (&context->regs, 1);
sd++;
- TRACE (("ReleaseSocket(%d,%d) -> ", sd, id));
+ BSDTRACE ((L"ReleaseSocket(%d,%d) -> ", sd, id));
s = getsock (sb, sd);
flags = sb->ftable[sd - 1];
if (flags & REP_ALL) {
- write_log ("bsdsocket: ERROR: ReleaseCopyOfSocket() is not supported for sockets with async event notification enabled!\n");
+ write_log (L"bsdsocket: ERROR: ReleaseCopyOfSocket() is not supported for sockets with async event notification enabled!\n");
return -1;
}
if (id == UNIQUE_ID) {
id = curruniqid;
} else if (id < 0 && id > 65535) {
if (sockpoolindex (id) != -1) {
- TRACE (("[unique ID already exists]\n"));
+ BSDTRACE ((L"[unique ID already exists]\n"));
return -1;
}
}
i = sockpoolindex (-1);
if (i == -1) {
- TRACE (("-1\n"));
- write_log (("bsdsocket: ERROR: Global socket pool overflow\n"));
+ BSDTRACE ((L"-1\n"));
+ write_log (L"bsdsocket: ERROR: Global socket pool overflow\n");
return -1;
}
sockdata->sockpoolids[i] = id;
sockdata->sockpoolsocks[i] = s;
sockdata->sockpoolflags[i] = flags;
- TRACE (("id %d s 0x%x\n", id,s));
+ BSDTRACE ((L"id %d s 0x%x\n", id,s));
} else {
- TRACE (("[invalid socket descriptor]\n"));
+ BSDTRACE ((L"[invalid socket descriptor]\n"));
return -1;
}
static uae_u32 REGPARAM2 bsdsocklib_Errno (TrapContext *context)
{
struct socketbase *sb = get_socketbase (context);
- TRACE (("Errno() -> %d\n", sb->sb_errno));
+ BSDTRACE ((L"Errno() -> %d\n", sb->sb_errno));
return sb->sb_errno;
}
struct socketbase *sb = get_socketbase (context);
uae_u32 errnoptr = m68k_areg (&context->regs, 0), size = m68k_dreg (&context->regs, 0);
- TRACE (("SetErrnoPtr(0x%lx,%d) -> ", errnoptr, size));
+ BSDTRACE ((L"SetErrnoPtr(0x%lx,%d) -> ", errnoptr, size));
if (size == 1 || size == 2 || size == 4) {
sb->errnoptr = errnoptr;
sb->errnosize = size;
- TRACE (("OK\n"));
+ BSDTRACE ((L"OK\n"));
return 0;
}
bsdsocklib_seterrno (sb, 22); /* EINVAL */
/* Inet_LnaOf(in)(d0) */
static uae_u32 REGPARAM2 bsdsocklib_Inet_LnaOf (TrapContext *context)
{
- write_log ("bsdsocket: UNSUPPORTED: Inet_LnaOf()\n");
+ write_log (L"bsdsocket: UNSUPPORTED: Inet_LnaOf()\n");
return 0;
}
/* Inet_NetOf(in)(d0) */
static uae_u32 REGPARAM2 bsdsocklib_Inet_NetOf (TrapContext *context)
{
- write_log ("bsdsocket: UNSUPPORTED: Inet_NetOf()\n");
+ write_log (L"bsdsocket: UNSUPPORTED: Inet_NetOf()\n");
return 0;
}
/* Inet_MakeAddr(net, host)(d0/d1) */
static uae_u32 REGPARAM2 bsdsocklib_Inet_MakeAddr (TrapContext *context)
{
- write_log ("bsdsocket: UNSUPPORTED: Inet_MakeAddr()\n");
+ write_log (L"bsdsocket: UNSUPPORTED: Inet_MakeAddr()\n");
return 0;
}
/* getnetbyname(name)(a0) */
static uae_u32 REGPARAM2 bsdsocklib_getnetbyname (TrapContext *context)
{
- write_log ("bsdsocket: UNSUPPORTED: getnetbyname()\n");
+ write_log (L"bsdsocket: UNSUPPORTED: getnetbyname()\n");
return 0;
}
/* getnetbyaddr(net, type)(d0/d1) */
static uae_u32 REGPARAM2 bsdsocklib_getnetbyaddr (TrapContext *context)
{
- write_log ("bsdsocket: UNSUPPORTED: getnetbyaddr()\n");
+ write_log (L"bsdsocket: UNSUPPORTED: getnetbyaddr()\n");
return 0;
}
/* Syslog(level, format, ap)(d0/a0/a1) */
static uae_u32 REGPARAM2 bsdsocklib_vsyslog (TrapContext *context)
{
- write_log ("bsdsocket: UNSUPPORTED: vsyslog()\n");
+ write_log (L"bsdsocket: UNSUPPORTED: vsyslog()\n");
return 0;
}
static uae_u32 REGPARAM2 bsdsocklib_sendmsg (TrapContext *context)
{
- write_log ("bsdsocket: UNSUPPORTED: sendmsg()\n");
+ write_log (L"bsdsocket: UNSUPPORTED: sendmsg()\n");
return 0;
}
static uae_u32 REGPARAM2 bsdsocklib_recvmsg (TrapContext *context)
{
- write_log ("bsdsocket: UNSUPPORTED: recvmsg()\n");
+ write_log (L"bsdsocket: UNSUPPORTED: recvmsg()\n");
return 0;
}
static uae_u32 REGPARAM2 bsdsocklib_gethostid (TrapContext *context)
{
- write_log ("bsdsocket: WARNING: Process '%s' calls deprecated function gethostid() - returning 127.0.0.1\n",
+ write_log (L"bsdsocket: WARNING: Process '%s' calls deprecated function gethostid() - returning 127.0.0.1\n",
get_real_address (get_long (gettask (context) + 10)));
return 0x7f000001;
}
-static const char *errortexts[] =
-{"No error", "Operation not permitted", "No such file or directory",
- "No such process", "Interrupted system call", "Input/output error", "Device not configured",
- "Argument list too long", "Exec format error", "Bad file descriptor", "No child processes",
- "Resource deadlock avoided", "Cannot allocate memory", "Permission denied", "Bad address",
- "Block device required", "Device busy", "Object exists", "Cross-device link",
- "Operation not supported by device", "Not a directory", "Is a directory", "Invalid argument",
- "Too many open files in system", "Too many open files", "Inappropriate ioctl for device",
- "Text file busy", "File too large", "No space left on device", "Illegal seek",
- "Read-only file system", "Too many links", "Broken pipe", "Numerical argument out of domain",
- "Result too large", "Resource temporarily unavailable", "Operation now in progress",
- "Operation already in progress", "Socket operation on non-socket", "Destination address required",
- "Message too long", "Protocol wrong type for socket", "Protocol not available",
- "Protocol not supported", "Socket type not supported", "Operation not supported",
- "Protocol family not supported", "Address family not supported by protocol family",
- "Address already in use", "Can't assign requested address", "Network is down",
- "Network is unreachable", "Network dropped connection on reset", "Software caused connection abort",
- "Connection reset by peer", "No buffer space available", "Socket is already connected",
- "Socket is not connected", "Can't send after socket shutdown", "Too many references: can't splice",
- "Connection timed out", "Connection refused", "Too many levels of symbolic links",
- "File name too long", "Host is down", "No route to host", "Directory not empty",
- "Too many processes", "Too many users", "Disc quota exceeded", "Stale NFS file handle",
- "Too many levels of remote in path", "RPC struct is bad", "RPC version wrong",
- "RPC prog. not avail", "Program version wrong", "Bad procedure for program", "No locks available",
- "Function not implemented", "Inappropriate file type or format", "PError 0"};
+static const TCHAR *errortexts[] =
+{L"No error", L"Operation not permitted", L"No such file or directory",
+ L"No such process", L"Interrupted system call", L"Input/output error", L"Device not configured",
+ L"Argument list too long", L"Exec format error", L"Bad file descriptor", L"No child processes",
+ L"Resource deadlock avoided", L"Cannot allocate memory", L"Permission denied", L"Bad address",
+ L"Block device required", L"Device busy", L"Object exists", L"Cross-device link",
+ L"Operation not supported by device", L"Not a directory", L"Is a directory", L"Invalid argument",
+ L"Too many open files in system", L"Too many open files", L"Inappropriate ioctl for device",
+ L"Text file busy", L"File too large", L"No space left on device", L"Illegal seek",
+ L"Read-only file system", L"Too many links", L"Broken pipe", L"Numerical argument out of domain",
+ L"Result too large", L"Resource temporarily unavailable", L"Operation now in progress",
+ L"Operation already in progress", L"Socket operation on non-socket", L"Destination address required",
+ L"Message too long", L"Protocol wrong type for socket", L"Protocol not available",
+ L"Protocol not supported", L"Socket type not supported", L"Operation not supported",
+ L"Protocol family not supported", L"Address family not supported by protocol family",
+ L"Address already in use", L"Can't assign requested address", L"Network is down",
+ L"Network is unreachable", L"Network dropped connection on reset", L"Software caused connection abort",
+ L"Connection reset by peer", L"No buffer space available", L"Socket is already connected",
+ L"Socket is not connected", L"Can't send after socket shutdown", L"Too many references: can't splice",
+ L"Connection timed out", L"Connection refused", L"Too many levels of symbolic links",
+ L"File name too long", L"Host is down", L"No route to host", L"Directory not empty",
+ L"Too many processes", L"Too many users", L"Disc quota exceeded", L"Stale NFS file handle",
+ L"Too many levels of remote in path", L"RPC struct is bad", L"RPC version wrong",
+ L"RPC prog. not avail", L"Program version wrong", L"Bad procedure for program", L"No locks available",
+ L"Function not implemented", L"Inappropriate file type or format", L"PError 0"};
static uae_u32 errnotextptrs[sizeof (errortexts) / sizeof (*errortexts)];
static const uae_u32 number_sys_error = sizeof (errortexts) / sizeof (*errortexts);
-static const char *herrortexts[] =
- {"No error", "Unknown host", "Host name lookup failure", "Unknown server error",
- "No address associated with name"};
+static const TCHAR *herrortexts[] =
+ {L"No error", L"Unknown host", L"Host name lookup failure", L"Unknown server error",
+ L"No address associated with name"};
static uae_u32 herrnotextptrs[sizeof (herrortexts) / sizeof (*herrortexts)];
static const uae_u32 number_host_error = sizeof (herrortexts) / sizeof (*herrortexts);
-static const char * const strErr = "Errlist lookup error";
+static const TCHAR * const strErr = L"Errlist lookup error";
static uae_u32 strErrptr;
uae_u32 currtag;
uae_u32 currval;
- TRACE (("SocketBaseTagList("));
+ BSDTRACE ((L"SocketBaseTagList("));
for (;;) {
currtag = get_long (tagptr);
switch (currtag) {
case TAG_DONE:
- TRACE (("TAG_DONE"));
+ BSDTRACE ((L"TAG_DONE"));
tagsprocessed = 0;
goto done;
case TAG_IGNORE:
- TRACE (("TAG_IGNORE"));
+ BSDTRACE ((L"TAG_IGNORE"));
break;
case TAG_MORE:
- TRACE (("TAG_MORE(0x%lx)", currval));
+ BSDTRACE ((L"TAG_MORE(0x%lx)", currval));
tagptr = currval;
break;
case TAG_SKIP:
- TRACE (("TAG_SKIP(%d)", currval));
+ BSDTRACE ((L"TAG_SKIP(%d)", currval));
tagptr += currval * 8;
break;
default:
if (currtag & TAG_USER) {
- TRACE (("SBTM_"));
- TRACE ((currtag & 0x0001 ? "SET" : "GET"));
- TRACE ((currtag & 0x8000 ? "REF(" : "VAL("));
+ BSDTRACE ((L"SBTM_"));
+ BSDTRACE ((currtag & 0x0001 ? "SET" : "GET"));
+ BSDTRACE ((currtag & 0x8000 ? "REF(" : "VAL("));
switch ((currtag >> 1) & SBTS_CODE) {
case SBTC_BREAKMASK:
- TRACE (("SBTC_BREAKMASK),0x%lx", currval));
+ BSDTRACE ((L"SBTC_BREAKMASK),0x%lx", currval));
tagcopy (currtag, currval, tagptr, &sb->eintrsigs);
break;
case SBTC_SIGEVENTMASK:
- TRACE (("SBTC_SIGEVENTMASK),0x%lx", currval));
+ BSDTRACE ((L"SBTC_SIGEVENTMASK),0x%lx", currval));
tagcopy (currtag, currval, tagptr, &sb->eventsigs);
break;
case SBTC_SIGIOMASK:
- TRACE (("SBTC_SIGEVENTMASK),0x%lx", currval));
+ BSDTRACE ((L"SBTC_SIGEVENTMASK),0x%lx", currval));
tagcopy (currtag, currval, tagptr, &sb->eventsigs);
break;
case SBTC_ERRNO:
- TRACE (("SBTC_ERRNO),%d", currval));
+ BSDTRACE ((L"SBTC_ERRNO),%d", currval));
tagcopy (currtag, currval, tagptr, &sb->sb_errno);
break;
case SBTC_HERRNO:
- TRACE (("SBTC_HERRNO),%d", currval));
+ BSDTRACE ((L"SBTC_HERRNO),%d", currval));
tagcopy (currtag, currval, tagptr, &sb->sb_herrno);
break;
case SBTC_DTABLESIZE:
- TRACE (("SBTC_DTABLESIZE),0x%lx", currval));
+ BSDTRACE ((L"SBTC_DTABLESIZE),0x%lx", currval));
if (currtag & 1) {
bsdsocklib_SetDTableSize(sb, currval);
} else {
break;
case SBTC_ERRNOSTRPTR:
if (currtag & 1) {
- TRACE (("ERRNOSTRPTR),invalid"));
+ BSDTRACE ((L"ERRNOSTRPTR),invalid"));
} else {
unsigned long ulTmp;
if (currtag & 0x8000) { /* SBTM_GETREF */
} else { /* SBTM_GETVAL */
ulTmp = currval;
}
- TRACE (("ERRNOSTRPTR),%d", ulTmp));
+ BSDTRACE ((L"ERRNOSTRPTR),%d", ulTmp));
if (ulTmp < number_sys_error) {
tagcopy (currtag, currval, tagptr, &errnotextptrs[ulTmp]);
} else {
break;
case SBTC_HERRNOSTRPTR:
if (currtag & 1) {
- TRACE (("HERRNOSTRPTR),invalid"));
+ BSDTRACE ((L"HERRNOSTRPTR),invalid"));
} else {
unsigned long ulTmp;
if (currtag & 0x8000) { /* SBTM_GETREF */
} else { /* SBTM_GETVAL */
ulTmp = currval;
}
- TRACE (("HERRNOSTRPTR),%d", ulTmp));
+ BSDTRACE ((L"HERRNOSTRPTR),%d", ulTmp));
if (ulTmp < number_host_error) {
tagcopy (currtag, currval, tagptr, &herrnotextptrs[ulTmp]);
} else {
}
break;
case SBTC_ERRNOBYTEPTR:
- TRACE (("SBTC_ERRNOBYTEPTR),0x%lx", currval));
+ BSDTRACE ((L"SBTC_ERRNOBYTEPTR),0x%lx", currval));
tagcopy (currtag, currval, tagptr, &sb->errnoptr);
sb->errnosize = 1;
break;
case SBTC_ERRNOWORDPTR:
- TRACE (("SBTC_ERRNOWORDPTR),0x%lx", currval));
+ BSDTRACE ((L"SBTC_ERRNOWORDPTR),0x%lx", currval));
tagcopy (currtag, currval, tagptr, &sb->errnoptr);
sb->errnosize = 2;
break;
case SBTC_ERRNOLONGPTR:
- TRACE (("SBTC_ERRNOLONGPTR),0x%lx", currval));
+ BSDTRACE ((L"SBTC_ERRNOLONGPTR),0x%lx", currval));
tagcopy (currtag, currval, tagptr, &sb->errnoptr);
sb->errnosize = 4;
break;
case SBTC_HERRNOLONGPTR:
- TRACE (("SBTC_HERRNOLONGPTR),0x%lx", currval));
+ BSDTRACE ((L"SBTC_HERRNOLONGPTR),0x%lx", currval));
tagcopy (currtag, currval, tagptr, &sb->herrnoptr);
sb->herrnosize = 4;
break;
default:
- write_log ("bsdsocket: WARNING: Unsupported tag type (%08x) in SocketBaseTagList(%x)\n",
+ write_log (L"bsdsocket: WARNING: Unsupported tag type (%08x) in SocketBaseTagList(%x)\n",
currtag, m68k_areg (&context->regs, 0));
break;
}
} else {
- TRACE (("TAG_UNKNOWN(0x%x)", currtag));
+ BSDTRACE ((L"TAG_UNKNOWN(0x%x)", currtag));
/* Aminetradio uses 0x00004e55 as an ending tag */
if ((currtag & 0xffff8000) == 0) {
- write_log ("bsdsocket: WARNING: Corrupted SocketBaseTagList(%x) tag detected (%08x)\n",
+ write_log (L"bsdsocket: WARNING: Corrupted SocketBaseTagList(%x) tag detected (%08x)\n",
m68k_areg (&context->regs, 0), currtag);
goto done;
}
}
}
- TRACE ((","));
+ BSDTRACE ((L","));
tagptr += 8;
}
done:
- TRACE ((") -> %d\n", tagsprocessed));
+ BSDTRACE ((L") -> %d\n", tagsprocessed));
return tagsprocessed;
}
int flags;
uae_u32 ptr = m68k_areg (&context->regs, 0);
- TRACE (("GetSocketEvents(0x%x) -> ", ptr));
+ BSDTRACE ((L"GetSocketEvents(0x%x) -> ", ptr));
for (i = sb->dtablesize; i--; sb->eventindex++) {
if (sb->eventindex >= sb->dtablesize)
if (flags) {
sb->ftable[sb->eventindex] &= ~SET_ALL;
put_long (m68k_areg (&context->regs, 0), flags >> 8);
- TRACE (("%d (0x%x)\n", sb->eventindex + 1, flags >> 8));
+ BSDTRACE ((L"%d (0x%x)\n", sb->eventindex + 1, flags >> 8));
return sb->eventindex; // xxx
}
}
}
#endif
- TRACE (("-1\n"));
+ BSDTRACE ((L"-1\n"));
return -1;
}
uae_u32 tmp1;
int i;
- write_log ("Creating UAE bsdsocket.library 4.1\n");
+ write_log (L"Creating UAE bsdsocket.library 4.1\n");
if (SockLibBase)
bsdlib_reset ();
tmp1 = CallLib (context, m68k_areg (&context->regs, 6), -0x54); /* MakeLibrary */
if (!tmp1) {
- write_log ("bsdoscket: FATAL: Cannot create bsdsocket.library!\n");
+ write_log (L"bsdoscket: FATAL: Cannot create bsdsocket.library!\n");
return 0;
}
m68k_areg (&context->regs, 1) = tmp1;
/* Install error strings in Amiga memory */
tmp1 = 0;
for (i = number_sys_error; i--;)
- tmp1 += strlen (errortexts[i])+1;
+ tmp1 += _tcslen (errortexts[i]) + 1;
for (i = number_host_error; i--;)
- tmp1 += strlen (herrortexts[i])+1;
+ tmp1 += _tcslen (herrortexts[i]) + 1;
- tmp1 += strlen(strErr)+1;
+ tmp1 += _tcslen (strErr) + 1;
m68k_dreg (&context->regs, 0) = tmp1;
m68k_dreg (&context->regs, 1) = 0;
tmp1 = CallLib (context, get_long (4), -0xC6); /* AllocMem */
if (!tmp1) {
- write_log ("bsdsocket: FATAL: Ran out of memory while creating bsdsocket.library!\n");
+ write_log (L"bsdsocket: FATAL: Ran out of memory while creating bsdsocket.library!\n");
return 0;
}
for (i = 0; i < (int) (number_sys_error); i++)
errnotextptrs[i] = addstr (&tmp1, errortexts[i]);
-
for (i = 0; i < (int) (number_host_error); i++)
herrnotextptrs[i] = addstr (&tmp1, herrortexts[i]);
-
strErrptr = addstr (&tmp1, strErr);
#if 0
SockLibBase = 0;
- write_log("BSDSOCK: cleanup start..\n");
+ write_log (L"BSDSOCK: cleanup start..\n");
host_sbcleanup (NULL);
for (sb = socketbases; sb; sb = nsb) {
nsb = sb->next;
- write_log("BSDSOCK: cleanup start socket %x\n", sb);
+ write_log (L"BSDSOCK: cleanup start socket %x\n", sb);
host_sbcleanup (sb);
free (sb->dtable);
free (sb);
}
- write_log("BSDSOCK: cleanup end\n");
+ write_log (L"BSDSOCK: cleanup end\n");
socketbases = NULL;
#if 1
}
host_sbreset ();
- write_log("BSDSOCK: cleanup finished\n");
+ write_log (L"BSDSOCK: cleanup finished\n");
}
static const TrapHandler sockfuncs[] = {
bsdsocklib_GetSocketEvents
};
-static const char * const funcnames[] = {
- "bsdsocklib_init", "bsdsocklib_Open", "bsdsocklib_Close", "bsdsocklib_Expunge",
- "bsdsocklib_socket", "bsdsocklib_bind", "bsdsocklib_listen", "bsdsocklib_accept",
- "bsdsocklib_connect", "bsdsocklib_sendto", "bsdsocklib_send", "bsdsocklib_recvfrom", "bsdsocklib_recv",
- "bsdsocklib_shutdown", "bsdsocklib_setsockopt", "bsdsocklib_getsockopt", "bsdsocklib_getsockname",
- "bsdsocklib_getpeername", "bsdsocklib_IoctlSocket", "bsdsocklib_CloseSocket", "bsdsocklib_WaitSelect",
- "bsdsocklib_SetSocketSignals", "bsdsocklib_getdtablesize", "bsdsocklib_ObtainSocket", "bsdsocklib_ReleaseSocket",
- "bsdsocklib_ReleaseCopyOfSocket", "bsdsocklib_Errno", "bsdsocklib_SetErrnoPtr", "bsdsocklib_Inet_NtoA",
- "bsdsocklib_inet_addr", "bsdsocklib_Inet_LnaOf", "bsdsocklib_Inet_NetOf", "bsdsocklib_Inet_MakeAddr",
- "bsdsocklib_inet_network", "bsdsocklib_gethostbyname", "bsdsocklib_gethostbyaddr", "bsdsocklib_getnetbyname",
- "bsdsocklib_getnetbyaddr", "bsdsocklib_getservbyname", "bsdsocklib_getservbyport", "bsdsocklib_getprotobyname",
- "bsdsocklib_getprotobynumber", "bsdsocklib_vsyslog", "bsdsocklib_Dup2Socket", "bsdsocklib_sendmsg",
- "bsdsocklib_recvmsg", "bsdsocklib_gethostname", "bsdsocklib_gethostid", "bsdsocklib_SocketBaseTagList",
- "bsdsocklib_GetSocketEvents"
+static const TCHAR * const funcnames[] = {
+ L"bsdsocklib_init", L"bsdsocklib_Open", L"bsdsocklib_Close", L"bsdsocklib_Expunge",
+ L"bsdsocklib_socket", L"bsdsocklib_bind", L"bsdsocklib_listen", L"bsdsocklib_accept",
+ L"bsdsocklib_connect", L"bsdsocklib_sendto", L"bsdsocklib_send", L"bsdsocklib_recvfrom", L"bsdsocklib_recv",
+ L"bsdsocklib_shutdown", L"bsdsocklib_setsockopt", L"bsdsocklib_getsockopt", L"bsdsocklib_getsockname",
+ L"bsdsocklib_getpeername", L"bsdsocklib_IoctlSocket", L"bsdsocklib_CloseSocket", L"bsdsocklib_WaitSelect",
+ L"bsdsocklib_SetSocketSignals", L"bsdsocklib_getdtablesize", L"bsdsocklib_ObtainSocket", L"bsdsocklib_ReleaseSocket",
+ L"bsdsocklib_ReleaseCopyOfSocket", L"bsdsocklib_Errno", L"bsdsocklib_SetErrnoPtr", L"bsdsocklib_Inet_NtoA",
+ L"bsdsocklib_inet_addr", L"bsdsocklib_Inet_LnaOf", L"bsdsocklib_Inet_NetOf", L"bsdsocklib_Inet_MakeAddr",
+ L"bsdsocklib_inet_network", L"bsdsocklib_gethostbyname", L"bsdsocklib_gethostbyaddr", L"bsdsocklib_getnetbyname",
+ L"bsdsocklib_getnetbyaddr", L"bsdsocklib_getservbyname", L"bsdsocklib_getservbyport", L"bsdsocklib_getprotobyname",
+ L"bsdsocklib_getprotobynumber", L"bsdsocklib_vsyslog", L"bsdsocklib_Dup2Socket", L"bsdsocklib_sendmsg",
+ L"bsdsocklib_recvmsg", L"bsdsocklib_gethostname", L"bsdsocklib_gethostid", L"bsdsocklib_SocketBaseTagList",
+ L"bsdsocklib_GetSocketEvents"
};
static uae_u32 sockfuncvecs[sizeof (sockfuncs) / sizeof (*sockfuncs)];
if (!init_socket_layer ())
return;
- res_name = ds ("bsdsocket.library");
- res_id = ds ("UAE bsdsocket.library 4.1");
+ res_name = ds (L"bsdsocket.library");
+ res_id = ds (L"UAE bsdsocket.library 4.1");
for (i = 0; i < (int) (sizeof (sockfuncs) / sizeof (sockfuncs[0])); i++) {
sockfuncvecs[i] = here ();
dl (datatable);
dl (*sockfuncvecs);
- write_log ("bsdsocked.library installed\n");
+ write_log (L"bsdsocked.library installed\n");
}
#endif /* ! BSDSOCKET */
* Copyright 1995,1996 Bernd Schmidt
*/
+#include <stdlib.h>
+#include <tchar.h>
+#include <assert.h>
+#include <ctype.h>
+
+#define TCHAR char
+
#include "sysconfig.h"
#include "sysdeps.h"
-#include <assert.h>
-#include <ctype.h>
#include "readcpu.h"
for(i = 0; i < 5; i++) {
printf("{%d,%d}%s", flaguse[i], flagset[i], i == 4 ? "" : ",");
}
- printf("},%2d,\"%s\"}", sduse, opstrp);
+ printf("},%2d,L\"%s\"}", sduse, opstrp);
}
}
printf("};\nint n_defs68k = %d;\n", no_insns);
buf1[0] = (uae_u8)addr;
if (handle != INVALID_HANDLE_VALUE) {
if (!DeviceIoControl (handle, CW_PEEKREG_FULL, buf1, 1, buf2, 1, &did_read, 0))
- write_log ("catweasel_do_bget %02x fail err=%d\n", buf1[0], GetLastError ());
+ write_log (L"catweasel_do_bget %02x fail err=%d\n", buf1[0], GetLastError ());
} else {
buf2[0] = ioport_read (cwc.iobase + addr);
}
- //write_log ("G %02X %02X %d\n", buf1[0], buf2[0], did_read);
+ //write_log (L"G %02X %02X %d\n", buf1[0], buf2[0], did_read);
return buf2[0];
}
buf[1] = b;
if (handle != INVALID_HANDLE_VALUE) {
if (!DeviceIoControl (handle, CW_POKEREG_FULL, buf, 2, 0, 0, &did_read, 0))
- write_log ("catweasel_do_bput %02x=%02x fail err=%d\n", buf[0], buf[1], GetLastError ());
+ write_log (L"catweasel_do_bput %02x=%02x fail err=%d\n", buf[0], buf[1], GetLastError ());
} else {
ioport_write (cwc.iobase + addr, b);
}
- //write_log ("P %02X %02X %d\n", (uae_u8)addr, (uae_u8)b, did_read);
+ //write_log (L"P %02X %02X %d\n", (uae_u8)addr, (uae_u8)b, did_read);
}
#include "core.cw4.c"
sleep_millis(10);
if (cw_config_done()) {
- write_log ("CW: FPGA already configured, skipping core upload\n");
+ write_log (L"CW: FPGA already configured, skipping core upload\n");
return 1;
}
cw_resetFPGA();
sleep_millis(10);
if (cw_config_done()) {
- write_log ("CW: FPGA failed to reset!\n");
+ write_log (L"CW: FPGA failed to reset!\n");
return 0;
}
- f = zfile_fopen("core.cw4", "rb");
+ f = zfile_fopen(L"core.cw4", L"rb");
if (!f) {
- f = zfile_fopen_data ("core.cw4.gz", core_len, core);
+ f = zfile_fopen_data (L"core.cw4.gz", core_len, core);
f = zfile_gunzip (f);
}
- write_log ("CW: starting core upload, this will take few seconds\n");
+ write_log (L"CW: starting core upload, this will take few seconds\n");
t = time(NULL) + 10; // give up if upload takes more than 10s
for (;;) {
uae_u8 b;
ioport_write (cwc.iobase + 3, (b & 1) ? 67 : 65);
while (!cw_fpga_ready()) {
if (time(NULL) >= t) {
- write_log ("CW: FPGA core upload got stuck!?\n");
+ write_log (L"CW: FPGA core upload got stuck!?\n");
cw_resetFPGA();
return 0;
}
ioport_write (cwc.iobase + 192, b);
}
if (!cw_config_done()) {
- write_log ("CW: FPGA didn't accept the core!\n");
+ write_log (L"CW: FPGA didn't accept the core!\n");
cw_resetFPGA();
return 0;
}
sleep_millis(10);
- write_log ("CW: core uploaded successfully\n");
+ write_log (L"CW: core uploaded successfully\n");
return 1;
}
if (resId == ResType_IO) {
PIO_RESOURCE pIoData = (PIO_RESOURCE)resDesData;
if(pIoData->IO_Header.IOD_Alloc_End-pIoData->IO_Header.IOD_Alloc_Base+1) {
- write_log ("CW: PCI SCAN: CWMK%d @%I64X - %I64X\n", cw,
+ write_log (L"CW: PCI SCAN: CWMK%d @%I64X - %I64X\n", cw,
pIoData->IO_Header.IOD_Alloc_Base,pIoData->IO_Header.IOD_Alloc_End);
cwc.iobase = (int)pIoData->IO_Header.IOD_Alloc_Base;
cwc.direct_type = cw;
int catweasel_init(void)
{
- char name[32], tmp[1000];
+ TCHAR name[32], tmp[1000];
int i, len;
uae_u8 buffer[10000];
uae_u32 model, base;
i = currprefs.catweasel;
if (currprefs.catweasel < 0)
i = -currprefs.catweasel + 1;
- sprintf (name, "\\\\.\\CAT%d_F0", i);
+ _stprintf (name, L"\\\\.\\CAT%d_F0", i);
handle = CreateFile (name, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (handle != INVALID_HANDLE_VALUE || currprefs.catweasel > 0)
}
if (handle == INVALID_HANDLE_VALUE) {
- strcpy(name, "[DIRECT]");
+ _tcscpy (name, L"[DIRECT]");
if (cwc.direct_type && ioport_init()) {
cwc.direct_access = 1;
if (cwc.direct_type == 4 && catweasel4_configure()) {
}
}
if (cwc.type == 0) {
- write_log ("CW: No Catweasel detected\n");
+ write_log (L"CW: No Catweasel detected\n");
goto fail;
}
}
if (!cwc.direct_type) {
if (!DeviceIoControl (handle, CW_GET_VERSION, 0, 0, buffer, sizeof (buffer), &len, 0)) {
- write_log ("CW: CW_GET_VERSION failed %d\n", GetLastError());
+ write_log (L"CW: CW_GET_VERSION failed %d\n", GetLastError());
goto fail;
}
- write_log ("CW driver version string '%s'\n", buffer);
+ write_log (L"CW driver version string '%s'\n", buffer);
if (!DeviceIoControl (handle, CW_GET_HWVERSION, 0, 0, buffer, sizeof (buffer), &len, 0)) {
- write_log ("CW: CW_GET_HWVERSION failed %d\n", GetLastError());
+ write_log (L"CW: CW_GET_HWVERSION failed %d\n", GetLastError());
goto fail;
}
- write_log ("CW: v=%d 14=%d 28=%d 56=%d joy=%d dpm=%d sid=%d kb=%d sidfifo=%d\n",
+ write_log (L"CW: v=%d 14=%d 28=%d 56=%d joy=%d dpm=%d sid=%d kb=%d sidfifo=%d\n",
buffer[0], buffer[1], buffer[2], buffer[3], buffer[4], buffer[5],
buffer[6], buffer[7], ((uae_u32*)(buffer + 8))[0]);
cwc.can_joy = (buffer[4] & 1) ? 2 : 0;
cwc.can_kb = buffer[7] & 1;
cwc.can_mouse = (buffer[4] & 2) ? 2 : 0;
if (!DeviceIoControl (handle, CW_LOCK_EXCLUSIVE, 0, 0, buffer, sizeof (buffer), &len, 0)) {
- write_log ("CW: CW_LOCK_EXCLUSIVE failed %d\n", GetLastError ());
+ write_log (L"CW: CW_LOCK_EXCLUSIVE failed %d\n", GetLastError ());
goto fail;
}
model = *((uae_u32*)(buffer + 4));
cwc.iobase = base;
if (!cwc.direct_access) {
if (!DeviceIoControl (handle, CW_UNLOCK_EXCLUSIVE, 0, 0, 0, 0, &len, 0)) {
- write_log ("CW: CW_UNLOCK_EXCLUSIVE failed %d\n", GetLastError ());
+ write_log (L"CW: CW_UNLOCK_EXCLUSIVE failed %d\n", GetLastError ());
}
}
if (cwc.type == CATWEASEL_TYPE_MK4 && cwc.can_sid)
}
//catweasel_init_controller(&cwc);
- sprintf(tmp, "CW: Catweasel MK%d @%p (%s) enabled. %s.",
+ _stprintf (tmp, L"CW: Catweasel MK%d @%p (%s) enabled. %s.",
cwc.type, (uae_u8*)cwc.iobase, name, cwc.direct_access ? "DIRECTIO": "API");
if (cwc.direct_access) {
if (cwc.can_sid) {
- char *p = tmp + strlen(tmp);
+ TCHAR *p = tmp + _tcslen (tmp);
catweasel_detect_sid ();
- sprintf(p, " SID0=%d", cwc.sid[0]);
+ _stprintf (p, L" SID0=%d", cwc.sid[0]);
if (cwc.can_sid > 1) {
- p += strlen(p);
- sprintf(p, " SID1=%d", cwc.sid[1]);
+ p += _tcslen (p);
+ _stprintf (p, L" SID1=%d", cwc.sid[1]);
}
}
}
- write_log ("%s\n", tmp);
+ write_log (L"%s\n", tmp);
detected = 1;
return 1;
int catweasel_detect (void)
{
- char name[32];
+ TCHAR name[32];
int i;
HANDLE h;
detected = -1;
for (i = 0; i < 4; i++) {
- sprintf (name, "\\\\.\\CAT%u_F0", i);
+ _stprintf (name, L"\\\\.\\CAT%u_F0", i);
h = CreateFile (name, GENERIC_READ, FILE_SHARE_WRITE|FILE_SHARE_READ, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (h != INVALID_HANDLE_VALUE) {
CloseHandle (h);
- write_log ("CW: Windows driver device detected '%s'\n", name);
+ write_log (L"CW: Windows driver device detected '%s'\n", name);
detected = 1;
return TRUE;
}
static uae_u8 fmv_bget2 (uaecptr addr)
{
#ifdef FMV_DEBUG
- write_log ("fmv_bget2 %08X PC=%8X\n", addr, M68K_GETPC);
+ write_log (L"fmv_bget2 %08X PC=%8X\n", addr, M68K_GETPC);
#endif
if (addr >= rom_size) {
- write_log ("fmv_bget2 %08X PC=%8X\n", addr, M68K_GETPC);
+ write_log (L"fmv_bget2 %08X PC=%8X\n", addr, M68K_GETPC);
return 0;
}
return rom[addr];
static void fmv_bput2 (uaecptr addr, uae_u8 v)
{
if (addr >= rom_size && addr < 0xf0000) {
- ;//write_log ("fmv_bput2 %08X=%02X PC=%8X\n", addr, v & 0xff, M68K_GETPC);
+ ;//write_log (L"fmv_bput2 %08X=%02X PC=%8X\n", addr, v & 0xff, M68K_GETPC);
}
}
v = (fmv_bget2 (addr) << 24) | (fmv_bget2 (addr + 1) << 16) |
(fmv_bget2 (addr + 2) << 8) | (fmv_bget2 (addr + 3));
#ifdef FMV_DEBUG
- write_log ("fmv_lget %08X=%08X PC=%08X\n", addr, v, M68K_GETPC);
+ write_log (L"fmv_lget %08X=%08X PC=%08X\n", addr, v, M68K_GETPC);
#endif
return v;
}
addr &= fmv_mask;
v = (fmv_bget2 (addr) << 8) | fmv_bget2 (addr + 1);
#ifdef FMV_DEBUG
- write_log ("fmv_wget %08X=%04X PC=%08X\n", addr, v, M68K_GETPC);
+ write_log (L"fmv_wget %08X=%04X PC=%08X\n", addr, v, M68K_GETPC);
#endif
return v;
}
addr -= fmv_start & fmv_mask;
addr &= fmv_mask;
#ifdef FMV_DEBUG
- write_log ("fmv_lput %08X=%08X PC=%08X\n", addr, l, M68K_GETPC);
+ write_log (L"fmv_lput %08X=%08X PC=%08X\n", addr, l, M68K_GETPC);
#endif
fmv_bput2 (addr, l >> 24);
fmv_bput2 (addr + 1, l >> 16);
addr -= fmv_start & fmv_mask;
addr &= fmv_mask;
#ifdef FMV_DEBUG
- write_log ("fmv_wput %04X=%04X PC=%08X\n", addr, w & 65535, M68K_GETPC);
+ write_log (L"fmv_wput %04X=%04X PC=%08X\n", addr, w & 65535, M68K_GETPC);
#endif
fmv_bput2 (addr, w >> 8);
fmv_bput2 (addr + 1, w);
if (addr < rom_size)
return do_get_mem_word ((uae_u16 *)m);
#ifdef FMV_DEBUG
- write_log ("fmv_wgeti %08X %08X PC=%08X\n", addr, v, M68K_GETPC);
+ write_log (L"fmv_wgeti %08X %08X PC=%08X\n", addr, v, M68K_GETPC);
#endif
return v;
}
if (addr < rom_size)
return do_get_mem_long ((uae_u32 *)m);
#ifdef FMV_DEBUG
- write_log ("fmv_lgeti %08X %08X PC=%08X\n", addr, v, M68K_GETPC);
+ write_log (L"fmv_lgeti %08X %08X PC=%08X\n", addr, v, M68K_GETPC);
#endif
return v;
}
static addrbank fmv_bank = {
fmv_lget, fmv_wget, fmv_bget,
fmv_lput, fmv_wput, fmv_bput,
- fmv_xlate, fmv_check, NULL, "CD32 FMV module",
+ fmv_xlate, fmv_check, NULL, L"CD32 FMV module",
fmv_lgeti, fmv_wgeti, ABFLAG_ROM | ABFLAG_IO
};
struct romdata *rd;
struct zfile *z;
- write_log ("CD32 FMV mapped @$%lx\n", start);
+ write_log (L"CD32 FMV mapped @$%lx\n", start);
if (start != fmv_start)
return;
if (!rl)
rd = rl->rd;
z = read_rom (&rd);
if (z) {
- write_log ("CD32 FMV ROM %d.%d\n", rd->ver, rd->rev);
- rom = mapped_malloc (fmv_size, "fast");
+ write_log (L"CD32 FMV ROM %d.%d\n", rd->ver, rd->rev);
+ rom = mapped_malloc (fmv_size, L"fast");
if (rom)
zfile_fread (rom, rd->size, 1, z);
zfile_fclose (z);
static int read_sectors(int start, int length)
{
- write_log ("READ DATA sector %d, %d sectors (blocksize=%d)\n", start, length, cdtv_sectorsize);
+ write_log (L"READ DATA sector %d, %d sectors (blocksize=%d)\n", start, length, cdtv_sectorsize);
cdrom_sector = start;
cdrom_sectors = length;
cdrom_offset = start * cdtv_sectorsize;
}
play_end = msf2lsn (end);
play_start = msf2lsn (start);
- write_log ("PLAY CD AUDIO from %d-%d, %06X (%d) to %06X (%d)\n",
+ write_log (L"PLAY CD AUDIO from %d-%d, %06X (%d) to %06X (%d)\n",
track_start, track_end, start, msf2lsn (start), end, msf2lsn (end));
play_state = 1;
play_state_cmd = 1;
end = last_cd_position;
play_end = msf2lsn (end);
play_start = msf2lsn (start);
- write_log ("PLAY CD AUDIO from %06X (%d) to %06X (%d)\n",
+ write_log (L"PLAY CD AUDIO from %06X (%d) to %06X (%d)\n",
start, msf2lsn (start), end, msf2lsn (end));
play_state = 1;
play_state_cmd = 1;
{
cdtv_sectorsize = (cmd[2] << 8) | cmd[3];
if (cdtv_sectorsize != 2048 && cdtv_sectorsize != 2336) {
- write_log ("CDTV: tried to set unknown sector size %d\n", cdtv_sectorsize);
+ write_log (L"CDTV: tried to set unknown sector size %d\n", cdtv_sectorsize);
cdtv_sectorsize = 2048;
}
return 0;
static void cdrom_command_accepted (int size, uae_u8 *cdrom_command_input, int *cdrom_command_cnt_in)
{
#ifdef CDTV_DEBUG_CMD
- char tmp[200];
+ TCHAR tmp[200];
int i;
#endif
cdrom_command_size_out = size;
tmp[0] = 0;
for (i = 0; i < *cdrom_command_cnt_in; i++)
sprintf(tmp + i * 3, "%02X%c", cdrom_command_input[i], i < *cdrom_command_cnt_in - 1 ? '.' : ' ');
- write_log ("CD<-: %s\n", tmp);
+ write_log (L"CD<-: %s\n", tmp);
if (size > 0) {
tmp[0] = 0;
for (i = 0; i < size; i++)
sprintf(tmp + i * 3, "%02X%c", cdrom_command_output[i], i < size - 1 ? '.' : ' ');
- write_log ("CD->: %s\n", tmp);
+ write_log (L"CD->: %s\n", tmp);
}
#endif
*cdrom_command_cnt_in = 0;
}
break;
default:
- write_log ("unknown CDROM command %02X!\n", s[0]);
+ write_log (L"unknown CDROM command %02X!\n", s[0]);
cd_error = 1;
cdrom_command_accepted (0, s, &cdrom_command_cnt_in);
break;
static struct zfile *f;
static int track;
int trackcnt;
- char fname[MAX_DPATH];
+ TCHAR fname[MAX_DPATH];
static uae_u8 buf[4096];
uae_u32 prevlsn = 0;
uae_u8 *s = cdrom_toc + 4;
s += 11;
}
if (track != trackcnt) {
- sprintf (fname, "track%d.bin", trackcnt);
+ _stprintf (fname, L"track%d.bin", trackcnt);
zfile_fclose (f);
- f = zfile_fopen (fname, "rb");
+ f = zfile_fopen (fname, L"rb");
if (!f)
- write_log ("failed to open '%s'\n", fname);
+ write_log (L"failed to open '%s'\n", fname);
else
- write_log ("opened '%s'\n", fname);
+ write_log (L"opened '%s'\n", fname);
track = trackcnt;
}
if (f) {
- write_log ("CDTV fakeraw: %dx%d=%d\n", sector, size, sector * size);
+ write_log (L"CDTV fakeraw: %dx%d=%d\n", sector, size, sector * size);
zfile_fseek (f, sector * size, SEEK_SET);
zfile_fread (buf, size, 1, f);
return buf;
if (!cdtv_sectorsize)
return;
cnt = dmac_wtc;
- write_log ("DMAC DMA: sector=%d, addr=%08X, words=%d (of %d)\n",
+ write_log (L"DMAC DMA: sector=%d, addr=%08X, words=%d (of %d)\n",
cdrom_offset / cdtv_sectorsize, dmac_acr, cnt, cdrom_length / 2);
dma_wait += cnt * (uae_u64)312 * 50 / 75 + 1;
while (cnt > 0 && dmac_dma) {
if (!p) {
cd_error = 1;
activate_stch = 1;
- write_log ("CDTV: CD read error!\n");
+ write_log (L"CDTV: CD read error!\n");
break;
}
static void *dev_thread (void *p)
{
- write_log ("CDTV: CD thread started\n");
+ write_log (L"CDTV: CD thread started\n");
thread_alive = 1;
for (;;) {
{
static int volstrobe1, volstrobe2;
#ifdef CDTV_DEBUG_6525
- write_log ("6525 write %x=%02X PC=%x\n", addr, v, M68K_GETPC);
+ write_log (L"6525 write %x=%02X PC=%x\n", addr, v, M68K_GETPC);
#endif
switch (addr)
{
}
if (!volstrobe2 && ((tp_b >> 7) & 1)) {
#ifdef CDTV_DEBUG_CMD
- write_log ("CDTV CD volume = %d\n", cd_volume);
+ write_log (L"CDTV CD volume = %d\n", cd_volume);
#endif
cd_volume = 0;
volstrobe2 = 1;
{
case 0:
v = tp_a;
- write_log ("TPA read!\n");
+ write_log (L"TPA read!\n");
break;
case 1:
v = tp_b;
#ifdef CDTV_DEBUG_6525
if (addr < 7)
- write_log ("6525 read %x=%02X PC=%x\n", addr, v, M68K_GETPC);
+ write_log (L"6525 read %x=%02X PC=%x\n", addr, v, M68K_GETPC);
#endif
return v;
}
if (sys_command_open (DF_IOCTL, i) > 0) {
unitnum = i;
cd_hunt = 0;
- write_log ("CDTV: autodetected unit %d\n", unitnum);
+ write_log (L"CDTV: autodetected unit %d\n", unitnum);
} else {
unitnum = -1;
}
if ((dmac_cntr & (CNTR_INTEN | CNTR_TCEN)) == (CNTR_INTEN | CNTR_TCEN)) {
dmac_istr |= ISTR_INT_P | ISTR_E_INT;
#ifdef CDTV_DEBUG
- write_log ("DMA finished\n");
+ write_log (L"DMA finished\n");
#endif
}
dma_finished = 0;
activate_stch = 0;
tp_air |= 1 << 2;
INT2();
- write_log ("STCH %d\n", stch_cnt++);
+ write_log (L"STCH %d\n", stch_cnt++);
}
}
static void cdtv_reset (void)
{
- write_log ("CDTV: reset\n");
+ write_log (L"CDTV: reset\n");
cdaudiostop();
cd_playing = cd_paused = 0;
cd_motor = 0;
#ifdef CDTV_DEBUG
if (addr != 0x41)
- write_log ("dmac_bget %04X=%02X PC=%08X\n", addr, v, M68K_GETPC);
+ write_log (L"dmac_bget %04X=%02X PC=%08X\n", addr, v, M68K_GETPC);
#endif
return v;
}
#ifdef CDTV_DEBUG
- write_log ("dmac_bput %04X=%02X PC=%08X\n", addr, b & 255, M68K_GETPC);
+ write_log (L"dmac_bput %04X=%02X PC=%08X\n", addr, b & 255, M68K_GETPC);
#endif
switch (addr)
v = (dmac_bget2 (addr) << 24) | (dmac_bget2 (addr + 1) << 16) |
(dmac_bget2 (addr + 2) << 8) | (dmac_bget2 (addr + 3));
#ifdef CDTV_DEBUG
- write_log ("dmac_lget %08X=%08X PC=%08X\n", addr, v, M68K_GETPC);
+ write_log (L"dmac_lget %08X=%08X PC=%08X\n", addr, v, M68K_GETPC);
#endif
return v;
}
addr &= 65535;
v = (dmac_bget2 (addr) << 8) | dmac_bget2 (addr + 1);
#ifdef CDTV_DEBUG
- write_log ("dmac_wget %08X=%04X PC=%08X\n", addr, v, M68K_GETPC);
+ write_log (L"dmac_wget %08X=%04X PC=%08X\n", addr, v, M68K_GETPC);
#endif
return v;
}
#endif
addr &= 65535;
#ifdef CDTV_DEBUG
- write_log ("dmac_lput %08X=%08X PC=%08X\n", addr, l, M68K_GETPC);
+ write_log (L"dmac_lput %08X=%08X PC=%08X\n", addr, l, M68K_GETPC);
#endif
dmac_bput2 (addr, l >> 24);
dmac_bput2 (addr + 1, l >> 16);
#endif
addr &= 65535;
#ifdef CDTV_DEBUG
- write_log ("dmac_wput %04X=%04X PC=%08X\n", addr, w & 65535, M68K_GETPC);
+ write_log (L"dmac_wput %04X=%04X PC=%08X\n", addr, w & 65535, M68K_GETPC);
#endif
dmac_bput2 (addr, w >> 8);
dmac_bput2 (addr + 1, w);
b &= 0xff;
if (addr == 0x48) {
map_banks (&dmac_bank, b, 0x10000 >> 16, 0x10000);
- write_log ("CDTV DMAC autoconfigured at %02X0000\n", b);
+ write_log (L"CDTV DMAC autoconfigured at %02X0000\n", b);
configured = 1;
expamem_next();
return;
}
if (addr == 0x4c) {
- write_log ("CDTV DMAC AUTOCONFIG SHUT-UP!\n");
+ write_log (L"CDTV DMAC AUTOCONFIG SHUT-UP!\n");
configured = 1;
expamem_next();
return;
unitnum = -1;
cdtv_reset ();
if (!device_func_init (DEVICE_TYPE_ANY)) {
- write_log ("no CDROM support\n");
+ write_log (L"no CDROM support\n");
return;
}
for (unitnum = 0; unitnum < MAX_TOTAL_DEVICES; unitnum++) {
if (sys_command_open (DF_IOCTL, unitnum)) {
di2 = sys_command_info (DF_IOCTL, unitnum, &di1);
if (di2 && di2->type == INQ_ROMD) {
- write_log ("%s: ", di2->label);
+ write_log (L"%s: ", di2->label);
if (first < 0)
first = unitnum;
if (get_toc () > 0) {
uae_u8 *p = sys_command_cd_read (DF_IOCTL, unitnum, 16);
if (p) {
if (!memcmp (p + 8, "CDTV", 4)) {
- write_log ("CDTV\n");
+ write_log (L"CDTV\n");
if (cdtvunit < 0)
cdtvunit = unitnum;
}
}
} else {
- write_log ("Audio CD\n");
+ write_log (L"Audio CD\n");
if (audiounit < 0)
audiounit = unitnum;
}
} else {
- write_log ("TOC read failed\n");
+ write_log (L"TOC read failed\n");
}
}
sys_command_close (DF_IOCTL, unitnum);
addrbank dmac_bank = {
dmac_lget, dmac_wget, dmac_bget,
dmac_lput, dmac_wput, dmac_bput,
- default_xlate, default_check, NULL, "CDTV DMAC/CD Controller",
+ default_xlate, default_check, NULL, L"CDTV DMAC/CD Controller",
dmac_lgeti, dmac_wgeti, ABFLAG_IO
};
struct zfile *f;
memset (p, 0, size);
- f = zfile_fopen (currprefs.flashfile, "rb");
+ f = zfile_fopen (currprefs.flashfile, L"rb");
if (!f)
return;
zfile_fseek (f, CDTV_NVRAM_SIZE, SEEK_SET);
{
struct zfile *f;
- f = zfile_fopen (currprefs.flashfile, "rb+");
+ f = zfile_fopen (currprefs.flashfile, L"rb+");
if (!f)
return;
zfile_fseek (f, CDTV_NVRAM_SIZE, SEEK_SET);
int v;
memset (cdtv_battram, 0, CDTV_NVRAM_SIZE);
- f = zfile_fopen (currprefs.flashfile, "rb+");
+ f = zfile_fopen (currprefs.flashfile, L"rb+");
if (!f) {
- f = zfile_fopen (currprefs.flashfile, "wb");
+ f = zfile_fopen (currprefs.flashfile, L"wb");
if (f) {
zfile_fwrite (cdtv_battram, CDTV_NVRAM_SIZE, 1, f);
zfile_fclose (f);
if (cdtv_battram[offset] == v)
return;
cdtv_battram[offset] = v;
- f = zfile_fopen (currprefs.flashfile, "rb+");
+ f = zfile_fopen (currprefs.flashfile, L"rb+");
if (!f)
return;
zfile_fseek (f, offset, SEEK_SET);
return v;
}
-int cdtv_add_scsi_unit(int ch, char *path, int blocksize, int readonly,
- char *devname, int sectors, int surfaces, int reserved,
- int bootpri, char *filesys)
+int cdtv_add_scsi_unit(int ch, TCHAR *path, int blocksize, int readonly,
+ TCHAR *devname, int sectors, int surfaces, int reserved,
+ int bootpri, TCHAR *filesys)
{
- return addscsi(ch, path, blocksize, readonly, devname, sectors, surfaces, reserved, bootpri, filesys, 1);
+ return addscsi (ch, path, blocksize, readonly, devname, sectors, surfaces, reserved, bootpri, filesys, 1);
}
void cdtv_free (void)
rl = getromlistbyids(roms);
if (rl) {
- write_log ("A590/A2091 BOOT ROM '%s' %d.%d\n", rl->path, rl->rd->ver, rl->rd->rev);
+ write_log (L"A590/A2091 BOOT ROM '%s' %d.%d\n", rl->path, rl->rd->ver, rl->rd->rev);
z = zfile_fopen(rl->path, "rb");
if (z) {
rom_size = 16384;
{
if (!thread_alive) {
init_comm_pipe (&requests, 100, 1);
- uae_start_thread ("cdtv", dev_thread, NULL, NULL);
+ uae_start_thread (L"cdtv", dev_thread, NULL, NULL);
while (!thread_alive)
sleep_millis(10);
}
static struct strlist *temp_lines;
static struct zfile *default_file;
static int uaeconfig;
+static int unicode_config = 0;
/* @@@ need to get rid of this... just cut part of the manual and print that
* as a help text. */
struct cfg_lines
{
- const char *config_label, *config_help;
+ const TCHAR *config_label, *config_help;
};
static const struct cfg_lines opttable[] =
{
- {"help", "Prints this help" },
- {"config_description", "" },
- {"config_info", "" },
- {"use_gui", "Enable the GUI? If no, then goes straight to emulator" },
- {"use_debugger", "Enable the debugger?" },
- {"cpu_speed", "can be max, real, or a number between 1 and 20" },
- {"cpu_model", "Can be 68000, 68010, 68020, 68030, 68040, 68060" },
- {"fpu_model", "Can be 68881, 68882, 68040, 68060" },
- {"cpu_compatible", "yes enables compatibility-mode" },
- {"cpu_24bit_addressing", "must be set to 'no' in order for Z3mem or P96mem to work" },
- {"autoconfig", "yes = add filesystems and extra ram" },
- {"log_illegal_mem", "print illegal memory access by Amiga software?" },
- {"fastmem_size", "Size in megabytes of fast-memory" },
- {"chipmem_size", "Size in megabytes of chip-memory" },
- {"bogomem_size", "Size in megabytes of bogo-memory at 0xC00000" },
- {"a3000mem_size", "Size in megabytes of A3000 memory" },
- {"gfxcard_size", "Size in megabytes of Picasso96 graphics-card memory" },
- {"z3mem_size", "Size in megabytes of Zorro-III expansion memory" },
- {"gfx_test_speed", "Test graphics speed?" },
- {"gfx_framerate", "Print every nth frame" },
- {"gfx_width", "Screen width" },
- {"gfx_height", "Screen height" },
- {"gfx_refreshrate", "Fullscreen refresh rate" },
- {"gfx_vsync", "Sync screen refresh to refresh rate" },
- {"gfx_lores", "Treat display as lo-res?" },
- {"gfx_linemode", "Can be none, double, or scanlines" },
- {"gfx_fullscreen_amiga", "Amiga screens are fullscreen?" },
- {"gfx_fullscreen_picasso", "Picasso screens are fullscreen?" },
- {"gfx_center_horizontal", "Center display horizontally?" },
- {"gfx_center_vertical", "Center display vertically?" },
- {"gfx_colour_mode", "" },
- {"32bit_blits", "Enable 32 bit blitter emulation" },
- {"immediate_blits", "Perform blits immediately" },
- {"show_leds", "LED display" },
- {"keyboard_leds", "Keyboard LEDs" },
- {"gfxlib_replacement", "Use graphics.library replacement?" },
- {"sound_output", "" },
- {"sound_frequency", "" },
- {"sound_bits", "" },
- {"sound_channels", "" },
- {"sound_max_buff", "" },
- {"comp_trustbyte", "How to access bytes in compiler (direct/indirect/indirectKS/afterPic" },
- {"comp_trustword", "How to access words in compiler (direct/indirect/indirectKS/afterPic" },
- {"comp_trustlong", "How to access longs in compiler (direct/indirect/indirectKS/afterPic" },
- {"comp_nf", "Whether to optimize away flag generation where possible" },
- {"comp_fpu", "Whether to provide JIT FPU emulation" },
- {"compforcesettings", "Whether to force the JIT compiler settings" },
- {"cachesize", "How many MB to use to buffer translated instructions"},
- {"override_dga_address","Address from which to map the frame buffer (upper 16 bits) (DANGEROUS!)"},
- {"avoid_cmov", "Set to yes on machines that lack the CMOV instruction" },
- {"avoid_dga", "Set to yes if the use of DGA extension creates problems" },
- {"avoid_vid", "Set to yes if the use of the Vidmode extension creates problems" },
- {"parallel_on_demand", "" },
- {"serial_on_demand", "" },
- {"scsi", "scsi.device emulation" },
- {"joyport0", "" },
- {"joyport1", "" },
- {"pci_devices", "List of PCI devices to make visible to the emulated Amiga" },
- {"kickstart_rom_file", "Kickstart ROM image, (C) Copyright Amiga, Inc." },
- {"kickstart_ext_rom_file", "Extended Kickstart ROM image, (C) Copyright Amiga, Inc." },
- {"kickstart_key_file", "Key-file for encrypted ROM images (from Cloanto's Amiga Forever)" },
- {"flash_ram_file", "Flash/battery backed RAM image file." },
- {"cart_file", "Freezer cartridge ROM image file." },
- {"floppy0", "Diskfile for drive 0" },
- {"floppy1", "Diskfile for drive 1" },
- {"floppy2", "Diskfile for drive 2" },
- {"floppy3", "Diskfile for drive 3" },
- {"hardfile", "access,sectors, surfaces, reserved, blocksize, path format" },
- {"filesystem", "access,'Amiga volume-name':'host directory path' - where 'access' can be 'read-only' or 'read-write'" },
- {"catweasel", "Catweasel board io base address" }
+ {L"help", L"Prints this help" },
+ {L"config_description", L"" },
+ {L"config_info", L"" },
+ {L"use_gui", L"Enable the GUI? If no, then goes straight to emulator" },
+ {L"use_debugger", L"Enable the debugger?" },
+ {L"cpu_speed", L"can be max, real, or a number between 1 and 20" },
+ {L"cpu_model", L"Can be 68000, 68010, 68020, 68030, 68040, 68060" },
+ {L"fpu_model", L"Can be 68881, 68882, 68040, 68060" },
+ {L"cpu_compatible", L"yes enables compatibility-mode" },
+ {L"cpu_24bit_addressing", L"must be set to 'no' in order for Z3mem or P96mem to work" },
+ {L"autoconfig", L"yes = add filesystems and extra ram" },
+ {L"log_illegal_mem", L"print illegal memory access by Amiga software?" },
+ {L"fastmem_size", L"Size in megabytes of fast-memory" },
+ {L"chipmem_size", L"Size in megabytes of chip-memory" },
+ {L"bogomem_size", L"Size in megabytes of bogo-memory at 0xC00000" },
+ {L"a3000mem_size", L"Size in megabytes of A3000 memory" },
+ {L"gfxcard_size", L"Size in megabytes of Picasso96 graphics-card memory" },
+ {L"z3mem_size", L"Size in megabytes of Zorro-III expansion memory" },
+ {L"gfx_test_speed", L"Test graphics speed?" },
+ {L"gfx_framerate", L"Print every nth frame" },
+ {L"gfx_width", L"Screen width" },
+ {L"gfx_height", L"Screen height" },
+ {L"gfx_refreshrate", L"Fullscreen refresh rate" },
+ {L"gfx_vsync", L"Sync screen refresh to refresh rate" },
+ {L"gfx_lores", L"Treat display as lo-res?" },
+ {L"gfx_linemode", L"Can be none, double, or scanlines" },
+ {L"gfx_fullscreen_amiga", L"Amiga screens are fullscreen?" },
+ {L"gfx_fullscreen_picasso", L"Picasso screens are fullscreen?" },
+ {L"gfx_center_horizontal", L"Center display horizontally?" },
+ {L"gfx_center_vertical", L"Center display vertically?" },
+ {L"gfx_colour_mode", L"" },
+ {L"32bit_blits", L"Enable 32 bit blitter emulation" },
+ {L"immediate_blits", L"Perform blits immediately" },
+ {L"show_leds", L"LED display" },
+ {L"keyboard_leds", L"Keyboard LEDs" },
+ {L"gfxlib_replacement", L"Use graphics.library replacement?" },
+ {L"sound_output", L"" },
+ {L"sound_frequency", L"" },
+ {L"sound_bits", L"" },
+ {L"sound_channels", L"" },
+ {L"sound_max_buff", L"" },
+ {L"comp_trustbyte", L"How to access bytes in compiler (direct/indirect/indirectKS/afterPic" },
+ {L"comp_trustword", L"How to access words in compiler (direct/indirect/indirectKS/afterPic" },
+ {L"comp_trustlong", L"How to access longs in compiler (direct/indirect/indirectKS/afterPic" },
+ {L"comp_nf", L"Whether to optimize away flag generation where possible" },
+ {L"comp_fpu", L"Whether to provide JIT FPU emulation" },
+ {L"compforcesettings", L"Whether to force the JIT compiler settings" },
+ {L"cachesize", L"How many MB to use to buffer translated instructions"},
+ {L"override_dga_address",L"Address from which to map the frame buffer (upper 16 bits) (DANGEROUS!)"},
+ {L"avoid_cmov", L"Set to yes on machines that lack the CMOV instruction" },
+ {L"avoid_dga", L"Set to yes if the use of DGA extension creates problems" },
+ {L"avoid_vid", L"Set to yes if the use of the Vidmode extension creates problems" },
+ {L"parallel_on_demand", L"" },
+ {L"serial_on_demand", L"" },
+ {L"scsi", L"scsi.device emulation" },
+ {L"joyport0", L"" },
+ {L"joyport1", L"" },
+ {L"pci_devices", L"List of PCI devices to make visible to the emulated Amiga" },
+ {L"kickstart_rom_file", L"Kickstart ROM image, (C) Copyright Amiga, Inc." },
+ {L"kickstart_ext_rom_file", L"Extended Kickstart ROM image, (C) Copyright Amiga, Inc." },
+ {L"kickstart_key_file", L"Key-file for encrypted ROM images (from Cloanto's Amiga Forever)" },
+ {L"flash_ram_file", L"Flash/battery backed RAM image file." },
+ {L"cart_file", L"Freezer cartridge ROM image file." },
+ {L"floppy0", L"Diskfile for drive 0" },
+ {L"floppy1", L"Diskfile for drive 1" },
+ {L"floppy2", L"Diskfile for drive 2" },
+ {L"floppy3", L"Diskfile for drive 3" },
+ {L"hardfile", L"access,sectors, surfaces, reserved, blocksize, path format" },
+ {L"filesystem", L"access,'Amiga volume-name':'host directory path' - where 'access' can be 'read-only' or 'read-write'" },
+ {L"catweasel", L"Catweasel board io base address" }
};
-static const char *guimode1[] = { "no", "yes", "nowait", 0 };
-static const char *guimode2[] = { "false", "true", "nowait", 0 };
-static const char *guimode3[] = { "0", "1", "nowait", 0 };
-static const char *csmode[] = { "ocs", "ecs_agnus", "ecs_denise", "ecs", "aga", 0 };
-static const char *linemode1[] = { "none", "double", "scanlines", 0 };
-static const char *linemode2[] = { "n", "d", "s", 0 };
-static const char *speedmode[] = { "max", "real", 0 };
-static const char *colormode1[] = { "8bit", "15bit", "16bit", "8bit_dither", "4bit_dither", "32bit", 0 };
-static const char *colormode2[] = { "8", "15", "16", "8d", "4d", "32", 0 };
-static const char *soundmode1[] = { "none", "interrupts", "normal", "exact", 0 };
-static const char *soundmode2[] = { "none", "interrupts", "good", "best", 0 };
-static const char *centermode1[] = { "none", "simple", "smart", 0 };
-static const char *centermode2[] = { "false", "true", "smart", 0 };
-static const char *stereomode[] = { "mono", "stereo", "clonedstereo", "4ch", "clonedstereo6ch", "6ch", "mixed", 0 };
-static const char *interpolmode[] = { "none", "anti", "sinc", "rh", "crux", 0 };
-static const char *collmode[] = { "none", "sprites", "playfields", "full", 0 };
-static const char *compmode[] = { "direct", "indirect", "indirectKS", "afterPic", 0 };
-static const char *flushmode[] = { "soft", "hard", 0 };
-static const char *kbleds[] = { "none", "POWER", "DF0", "DF1", "DF2", "DF3", "HD", "CD", 0 };
-static const char *onscreenleds[] = { "false", "true", "rtg", "both", 0 };
-static const char *soundfiltermode1[] = { "off", "emulated", "on", 0 };
-static const char *soundfiltermode2[] = { "standard", "enhanced", 0 };
-static const char *lorestype1[] = { "lores", "hires", "superhires" };
-static const char *lorestype2[] = { "true", "false" };
-static const char *loresmode[] = { "normal", "filtered", 0 };
+static const TCHAR *guimode1[] = { L"no", L"yes", L"nowait", 0 };
+static const TCHAR *guimode2[] = { L"false", L"true", L"nowait", 0 };
+static const TCHAR *guimode3[] = { L"0", L"1", L"nowait", 0 };
+static const TCHAR *csmode[] = { L"ocs", L"ecs_agnus", L"ecs_denise", L"ecs", L"aga", 0 };
+static const TCHAR *linemode1[] = { L"none", L"double", L"scanlines", 0 };
+static const TCHAR *linemode2[] = { L"n", L"d", L"s", 0 };
+static const TCHAR *speedmode[] = { L"max", L"real", 0 };
+static const TCHAR *colormode1[] = { L"8bit", L"15bit", L"16bit", L"8bit_dither", L"4bit_dither", L"32bit", 0 };
+static const TCHAR *colormode2[] = { L"8", L"15", L"16", L"8d", L"4d", L"32", 0 };
+static const TCHAR *soundmode1[] = { L"none", L"interrupts", L"normal", L"exact", 0 };
+static const TCHAR *soundmode2[] = { L"none", L"interrupts", L"good", L"best", 0 };
+static const TCHAR *centermode1[] = { L"none", L"simple", L"smart", 0 };
+static const TCHAR *centermode2[] = { L"false", L"true", L"smart", 0 };
+static const TCHAR *stereomode[] = { L"mono", L"stereo", L"clonedstereo", L"4ch", L"clonedstereo6ch", L"6ch", L"mixed", 0 };
+static const TCHAR *interpolmode[] = { L"none", L"anti", L"sinc", L"rh", L"crux", 0 };
+static const TCHAR *collmode[] = { L"none", L"sprites", L"playfields", L"full", 0 };
+static const TCHAR *compmode[] = { L"direct", L"indirect", L"indirectKS", L"afterPic", 0 };
+static const TCHAR *flushmode[] = { L"soft", L"hard", 0 };
+static const TCHAR *kbleds[] = { L"none", L"POWER", L"DF0", L"DF1", L"DF2", L"DF3", L"HD", L"CD", 0 };
+static const TCHAR *onscreenleds[] = { L"false", L"true", L"rtg", L"both", 0 };
+static const TCHAR *soundfiltermode1[] = { L"off", L"emulated", L"on", 0 };
+static const TCHAR *soundfiltermode2[] = { L"standard", L"enhanced", 0 };
+static const TCHAR *lorestype1[] = { L"lores", L"hires", L"superhires" };
+static const TCHAR *lorestype2[] = { L"true", L"false" };
+static const TCHAR *loresmode[] = { L"normal", L"filtered", 0 };
#ifdef GFXFILTER
-static const char *filtermode1[] = { "no_16", "bilinear_16", "no_32", "bilinear_32", 0 };
-static const char *filtermode2[] = { "0x", "1x", "2x", "3x", "4x", 0 };
+static const TCHAR *filtermode1[] = { L"no_16", L"bilinear_16", L"no_32", L"bilinear_32", 0 };
+static const TCHAR *filtermode2[] = { L"0x", L"1x", L"2x", L"3x", L"4x", 0 };
#endif
-static const char *cartsmode[] = { "none", "hrtmon", 0 };
-static const char *idemode[] = { "none", "a600/a1200", "a4000", 0 };
-static const char *rtctype[] = { "none", "MSM6242B", "RP5C01A", 0 };
-static const char *ciaatodmode[] = { "vblank", "50hz", "60hz", 0 };
-static const char *ksmirrortype[] = { "none", "e0", "a8+e0", 0 };
-static const char *cscompa[] = {
- "-", "Generic", "CDTV", "CD32", "A500", "A500+", "A600",
- "A1000", "A1200", "A2000", "A3000", "A3000T", "A4000", "A4000T", 0
+static const TCHAR *cartsmode[] = { L"none", L"hrtmon", 0 };
+static const TCHAR *idemode[] = { L"none", L"a600/a1200", L"a4000", 0 };
+static const TCHAR *rtctype[] = { L"none", L"MSM6242B", L"RP5C01A", 0 };
+static const TCHAR *ciaatodmode[] = { L"vblank", L"50hz", L"60hz", 0 };
+static const TCHAR *ksmirrortype[] = { L"none", L"e0", L"a8+e0", 0 };
+static const TCHAR *cscompa[] = {
+ L"-", L"Generic", L"CDTV", L"CD32", L"A500", L"A500+", L"A600",
+ L"A1000", L"A1200", L"A2000", L"A3000", L"A3000T", L"A4000", L"A4000T", 0
};
/* 3-state boolean! */
-static const char *fullmodes[] = { "false", "true", /* "FILE_NOT_FOUND", */ "fullwindow", 0 };
+static const TCHAR *fullmodes[] = { L"false", L"true", /* "FILE_NOT_FOUND", */ L"fullwindow", 0 };
/* bleh for compatibility */
-static const char *scsimode[] = { "false", "true", "scsi", 0 };
-static const char *maxhoriz[] = { "lores", "hires", "superhires", 0 };
-static const char *maxvert[] = { "nointerlace", "interlace", 0 };
-static const char *abspointers[] = { "none", "mousehack", "tablet", 0 };
-static const char *magiccursors[] = { "both", "native", "host", 0 };
-static const char *autoscale[] = { "none", "scale", "resize", 0 };
-
-static const char *obsolete[] = {
- "accuracy", "gfx_opengl", "gfx_32bit_blits", "32bit_blits",
- "gfx_immediate_blits", "gfx_ntsc", "win32", "gfx_filter_bits",
- "sound_pri_cutoff", "sound_pri_time", "sound_min_buff", "sound_bits",
- "gfx_test_speed", "gfxlib_replacement", "enforcer", "catweasel_io",
- "kickstart_key_file", "fast_copper", "sound_adjust",
- "serial_hardware_dtrdsr", "gfx_filter_upscale",
- "gfx_correct_aspect",
+static const TCHAR *scsimode[] = { L"false", L"true", L"scsi", 0 };
+static const TCHAR *maxhoriz[] = { L"lores", L"hires", L"superhires", 0 };
+static const TCHAR *maxvert[] = { L"nointerlace", L"interlace", 0 };
+static const TCHAR *abspointers[] = { L"none", L"mousehack", L"tablet", 0 };
+static const TCHAR *magiccursors[] = { L"both", L"native", L"host", 0 };
+static const TCHAR *autoscale[] = { L"none", L"scale", L"resize", 0 };
+
+static const TCHAR *obsolete[] = {
+ L"accuracy", L"gfx_opengl", L"gfx_32bit_blits", L"32bit_blits",
+ L"gfx_immediate_blits", L"gfx_ntsc", L"win32", L"gfx_filter_bits",
+ L"sound_pri_cutoff", L"sound_pri_time", L"sound_min_buff", L"sound_bits",
+ L"gfx_test_speed", L"gfxlib_replacement", L"enforcer", L"catweasel_io",
+ L"kickstart_key_file", L"fast_copper", L"sound_adjust",
+ L"serial_hardware_dtrdsr", L"gfx_filter_upscale",
+ L"gfx_correct_aspect",
NULL
};
-#define UNEXPANDED "$(FILE_PATH)"
+#define UNEXPANDED L"$(FILE_PATH)"
-static void trimws (char *s)
+static void trimws (TCHAR *s)
{
/* Delete trailing whitespace. */
- int len = strlen (s);
- while (len > 0 && strcspn (s + len - 1, "\t \r\n") == 0)
+ int len = _tcslen (s);
+ while (len > 0 && _tcscspn (s + len - 1, L"\t \r\n") == 0)
s[--len] = '\0';
}
-static int match_string (const char *table[], const char *str)
+static int match_string (const TCHAR *table[], const TCHAR *str)
{
int i;
for (i = 0; table[i] != 0; i++)
return -1;
}
-char *cfgfile_subst_path (const char *path, const char *subst, const char *file)
+TCHAR *cfgfile_subst_path (const TCHAR *path, const TCHAR *subst, const TCHAR *file)
{
/* @@@ use strcasecmp for some targets. */
- if (strlen (path) > 0 && strncmp (file, path, strlen (path)) == 0) {
+ if (_tcslen (path) > 0 && _tcsncmp (file, path, _tcslen (path)) == 0) {
int l;
- char *p = xmalloc (strlen (file) + strlen (subst) + 2);
- strcpy (p, subst);
- l = strlen (p);
+ TCHAR *p = xmalloc ((_tcslen (file) + _tcslen (subst) + 2) * sizeof (TCHAR));
+ _tcscpy (p, subst);
+ l = _tcslen (p);
while (l > 0 && p[l - 1] == '/')
p[--l] = '\0';
- l = strlen (path);
+ l = _tcslen (path);
while (file[l] == '/')
l++;
- strcat (p, "/"); strcat (p, file + l);
+ _tcscat (p, L"/"); _tcscat (p, file + l);
return p;
}
return my_strdup (file);
}
-static int isdefault (const char *s)
+static int isdefault (const TCHAR *s)
{
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
if (!default_file || uaeconfig)
return 0;
zfile_fseek (default_file, 0, SEEK_SET);
- while (zfile_fgets (tmp, sizeof tmp, default_file)) {
- if (!strcmp (tmp, s))
+ while (zfile_fgets (tmp, sizeof tmp / sizeof (TCHAR), default_file)) {
+ if (!_tcscmp (tmp, s))
return 1;
}
return 0;
}
-void cfgfile_write (struct zfile *f, char *format,...)
+static size_t cfg_write (void *b, struct zfile *z)
+{
+ size_t v;
+ if (unicode_config) {
+ v = zfile_fwrite (b, _tcslen (b), sizeof (TCHAR), z);
+ } else {
+ char *s = ua (b);
+ v = zfile_fwrite (s, strlen(s), 1, z);
+ xfree (s);
+ }
+ return v;
+}
+
+
+void cfgfile_write (struct zfile *f, TCHAR *format,...)
{
va_list parms;
- char tmp[CONFIG_BLEN];
+ TCHAR tmp[CONFIG_BLEN];
va_start (parms, format);
- vsprintf (tmp, format, parms);
- zfile_fwrite (tmp, 1, strlen (tmp), f);
+ _vstprintf (tmp, format, parms);
+ cfg_write (tmp, f);
va_end (parms);
}
-void cfgfile_dwrite (struct zfile *f, char *format,...)
+void cfgfile_dwrite (struct zfile *f, TCHAR *format,...)
{
va_list parms;
- char tmp[CONFIG_BLEN];
+ TCHAR tmp[CONFIG_BLEN];
va_start (parms, format);
- vsprintf (tmp, format, parms);
+ _vstprintf (tmp, format, parms);
if (!isdefault (tmp))
- zfile_fwrite (tmp, 1, strlen (tmp), f);
+ cfg_write (tmp, f);
va_end (parms);
}
-void cfgfile_target_write (struct zfile *f, char *format,...)
+void cfgfile_target_write (struct zfile *f, TCHAR *format,...)
{
va_list parms;
- char tmp[CONFIG_BLEN];
+ TCHAR tmp[CONFIG_BLEN];
va_start (parms, format);
- vsprintf (tmp + strlen (TARGET_NAME) + 1, format, parms);
- memcpy (tmp, TARGET_NAME, strlen (TARGET_NAME));
- tmp[strlen (TARGET_NAME)] = '.';
- zfile_fwrite (tmp, 1, strlen (tmp), f);
+ _vstprintf (tmp + _tcslen (TARGET_NAME) + 1, format, parms);
+ memcpy (tmp, TARGET_NAME, _tcslen (TARGET_NAME) * sizeof (TCHAR));
+ tmp[_tcslen (TARGET_NAME)] = '.';
+ cfg_write (tmp, f);
va_end (parms);
}
-void cfgfile_target_dwrite (struct zfile *f, char *format,...)
+void cfgfile_target_dwrite (struct zfile *f, TCHAR *format,...)
{
va_list parms;
- char tmp[CONFIG_BLEN];
+ TCHAR tmp[CONFIG_BLEN];
va_start (parms, format);
- vsprintf (tmp + strlen (TARGET_NAME) + 1, format, parms);
- memcpy (tmp, TARGET_NAME, strlen (TARGET_NAME));
- tmp[strlen (TARGET_NAME)] = '.';
+ _vstprintf (tmp + _tcslen (TARGET_NAME) + 1, format, parms);
+ memcpy (tmp, TARGET_NAME, _tcslen (TARGET_NAME) * sizeof (TCHAR));
+ tmp[_tcslen (TARGET_NAME)] = '.';
if (!isdefault (tmp))
- zfile_fwrite (tmp, 1, strlen (tmp), f);
+ cfg_write (tmp, f);
va_end (parms);
}
-static void write_filesys_config (struct uae_prefs *p, const char *unexpanded,
- const char *default_path, struct zfile *f)
+static void write_filesys_config (struct uae_prefs *p, const TCHAR *unexpanded,
+ const TCHAR *default_path, struct zfile *f)
{
int i;
- char tmp[MAX_DPATH], tmp2[MAX_DPATH];
- char *hdcontrollers[] = { "uae",
- "ide0", "ide1", "ide2", "ide3",
- "scsi0", "scsi1", "scsi2", "scsi3", "scsi4", "scsi5", "scsi6",
- "scsram", "scside" }; /* scsram = smart card sram = pcmcia sram card */
+ TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH];
+ TCHAR *hdcontrollers[] = { L"uae",
+ L"ide0", L"ide1", L"ide2", L"ide3",
+ L"scsi0", L"scsi1", L"scsi2", L"scsi3", L"scsi4", L"scsi5", L"scsi6",
+ L"scsram", L"scside" }; /* scsram = smart card sram = pcmcia sram card */
for (i = 0; i < p->mountitems; i++) {
struct uaedev_config_info *uci = &p->mountconfig[i];
- char *str;
+ TCHAR *str;
int bp = uci->bootpri;
if (!uci->autoboot)
bp = -129;
str = cfgfile_subst_path (default_path, unexpanded, uci->rootdir);
if (!uci->ishdf) {
- sprintf (tmp, "%s,%s:%s:%s,%d\n", uci->readonly ? "ro" : "rw",
- uci->devname ? uci->devname : "", uci->volname, str, bp);
- sprintf (tmp2, "filesystem2=%s", tmp);
+ _stprintf (tmp, L"%s,%s:%s:%s,%d\n", uci->readonly ? L"ro" : L"rw",
+ uci->devname ? uci->devname : L"", uci->volname, str, bp);
+ _stprintf (tmp2, L"filesystem2=%s", tmp);
zfile_fputs (f, tmp2);
#if 0
- sprintf (tmp2, "filesystem=%s,%s:%s\n", uci->readonly ? "ro" : "rw",
+ _stprintf (tmp2, L"filesystem=%s,%s:%s\n", uci->readonly ? L"ro" : L"rw",
uci->volname, str);
zfile_fputs (f, tmp2);
#endif
} else {
- sprintf (tmp, "%s,%s:%s,%d,%d,%d,%d,%d,%s,%s\n",
- uci->readonly ? "ro" : "rw",
- uci->devname ? uci->devname : "", str,
+ _stprintf (tmp, L"%s,%s:%s,%d,%d,%d,%d,%d,%s,%s\n",
+ uci->readonly ? L"ro" : L"rw",
+ uci->devname ? uci->devname : L"", str,
uci->sectors, uci->surfaces, uci->reserved, uci->blocksize,
- bp, uci->filesys ? uci->filesys : "", hdcontrollers[uci->controller]);
- sprintf (tmp2, "hardfile2=%s", tmp);
+ bp, uci->filesys ? uci->filesys : L"", hdcontrollers[uci->controller]);
+ _stprintf (tmp2, L"hardfile2=%s", tmp);
zfile_fputs (f, tmp2);
#if 0
- sprintf (tmp2, "hardfile=%s,%d,%d,%d,%d,%s\n",
+ _stprintf (tmp2, L"hardfile=%s,%d,%d,%d,%d,%s\n",
uci->readonly ? "ro" : "rw", uci->sectors,
uci->surfaces, uci->reserved, uci->blocksize, str);
zfile_fputs (f, tmp2);
#endif
}
- sprintf (tmp2, "uaehf%d=%s,%s", i, uci->ishdf ? "hdf" : "dir", tmp);
+ _stprintf (tmp2, L"uaehf%d=%s,%s", i, uci->ishdf ? L"hdf" : L"dir", tmp);
zfile_fputs (f, tmp2);
xfree (str);
}
static void write_compatibility_cpu (struct zfile *f, struct uae_prefs *p)
{
- char tmp[100];
+ TCHAR tmp[100];
int model;
model = p->cpu_model;
if (model == 68060)
model = 68040;
if (p->address_space_24 && model == 68020)
- strcpy (tmp, "68ec020");
+ _tcscpy (tmp, L"68ec020");
else
- sprintf(tmp, "%d", model);
+ _stprintf (tmp, L"%d", model);
if (model == 68020 && (p->fpu_model == 68881 || p->fpu_model == 68882))
- strcat(tmp,"/68881");
- cfgfile_write (f, "cpu_type=%s\n", tmp);
+ _tcscat (tmp, L"/68881");
+ cfgfile_write (f, L"cpu_type=%s\n", tmp);
}
void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
{
struct strlist *sl;
- char *str;
+ TCHAR *str;
int i;
- cfgfile_write (f, "config_description=%s\n", p->description);
- cfgfile_write (f, "config_hardware=%s\n", (type & CONFIG_TYPE_HARDWARE) ? "true" : "false");
- cfgfile_write (f, "config_host=%s\n", (type & CONFIG_TYPE_HOST) ? "true" : "false");
+ cfgfile_write (f, L"config_description=%s\n", p->description);
+ cfgfile_write (f, L"config_hardware=%s\n", (type & CONFIG_TYPE_HARDWARE) ? L"true" : L"false");
+ cfgfile_write (f, L"config_host=%s\n", (type & CONFIG_TYPE_HOST) ? L"true" : L"false");
if (p->info[0])
- cfgfile_write (f, "config_info=%s\n", p->info);
- cfgfile_write (f, "config_version=%d.%d.%d\n", UAEMAJOR, UAEMINOR, UAESUBREV);
- cfgfile_write (f, "config_hardware_path=%s\n", p->config_hardware_path);
- cfgfile_write (f, "config_host_path=%s\n", p->config_host_path);
+ cfgfile_write (f, L"config_info=%s\n", p->info);
+ cfgfile_write (f, L"config_version=%d.%d.%d\n", UAEMAJOR, UAEMINOR, UAESUBREV);
+ cfgfile_write (f, L"config_hardware_path=%s\n", p->config_hardware_path);
+ cfgfile_write (f, L"config_host_path=%s\n", p->config_host_path);
for (sl = p->all_lines; sl; sl = sl->next) {
if (sl->unknown)
- cfgfile_write (f, "%s=%s\n", sl->option, sl->value);
+ cfgfile_write (f, L"%s=%s\n", sl->option, sl->value);
}
- cfgfile_write (f, "%s.rom_path=%s\n", TARGET_NAME, p->path_rom);
- cfgfile_write (f, "%s.floppy_path=%s\n", TARGET_NAME, p->path_floppy);
- cfgfile_write (f, "%s.hardfile_path=%s\n", TARGET_NAME, p->path_hardfile);
+ cfgfile_write (f, L"%s.rom_path=%s\n", TARGET_NAME, p->path_rom);
+ cfgfile_write (f, L"%s.floppy_path=%s\n", TARGET_NAME, p->path_floppy);
+ cfgfile_write (f, L"%s.hardfile_path=%s\n", TARGET_NAME, p->path_hardfile);
- cfgfile_write (f, "; host-specific\n");
+ cfgfile_write (f, L"; host-specific\n");
target_save_options (f, p);
- cfgfile_write (f, "; common\n");
+ cfgfile_write (f, L"; common\n");
- cfgfile_write (f, "use_gui=%s\n", guimode1[p->start_gui]);
- cfgfile_write (f, "use_debugger=%s\n", p->start_debugger ? "true" : "false");
+ cfgfile_write (f, L"use_gui=%s\n", guimode1[p->start_gui]);
+ cfgfile_write (f, L"use_debugger=%s\n", p->start_debugger ? L"true" : L"false");
str = cfgfile_subst_path (p->path_rom, UNEXPANDED, p->romfile);
- cfgfile_write (f, "kickstart_rom_file=%s\n", str);
+ cfgfile_write (f, L"kickstart_rom_file=%s\n", str);
free (str);
if (p->romident[0])
- cfgfile_dwrite (f, "kickstart_rom=%s\n", p->romident);
+ cfgfile_dwrite (f, L"kickstart_rom=%s\n", p->romident);
str = cfgfile_subst_path (p->path_rom, UNEXPANDED, p->romextfile);
- cfgfile_write (f, "kickstart_ext_rom_file=%s\n", str);
+ cfgfile_write (f, L"kickstart_ext_rom_file=%s\n", str);
free (str);
if (p->romextident[0])
- cfgfile_write (f, "kickstart_ext_rom=%s\n", p->romextident);
+ cfgfile_write (f, L"kickstart_ext_rom=%s\n", p->romextident);
str = cfgfile_subst_path (p->path_rom, UNEXPANDED, p->flashfile);
- cfgfile_write (f, "flash_file=%s\n", str);
+ cfgfile_write (f, L"flash_file=%s\n", str);
free (str);
str = cfgfile_subst_path (p->path_rom, UNEXPANDED, p->cartfile);
- cfgfile_write (f, "cart_file=%s\n", str);
+ cfgfile_write (f, L"cart_file=%s\n", str);
free (str);
if (p->cartident[0])
- cfgfile_write (f, "cart=%s\n", p->cartident);
- //cfgfile_write (f, "cart_internal=%s\n", cartsmode[p->cart_internal]);
+ cfgfile_write (f, L"cart=%s\n", p->cartident);
+ //cfgfile_write (f, L"cart_internal=%s\n", cartsmode[p->cart_internal]);
if (p->amaxromfile[0]) {
str = cfgfile_subst_path (p->path_rom, UNEXPANDED, p->amaxromfile);
- cfgfile_write (f, "amax_rom_file=%s\n", str);
+ cfgfile_write (f, L"amax_rom_file=%s\n", str);
free (str);
}
- cfgfile_write (f, "kickshifter=%s\n", p->kickshifter ? "true" : "false");
+ cfgfile_write (f, L"kickshifter=%s\n", p->kickshifter ? L"true" : L"false");
p->nr_floppies = 4;
for (i = 0; i < 4; i++) {
str = cfgfile_subst_path (p->path_floppy, UNEXPANDED, p->df[i]);
- cfgfile_write (f, "floppy%d=%s\n", i, str);
+ cfgfile_write (f, L"floppy%d=%s\n", i, str);
free (str);
- cfgfile_dwrite (f, "floppy%dtype=%d\n", i, p->dfxtype[i]);
- cfgfile_dwrite (f, "floppy%dsound=%d\n", i, p->dfxclick[i]);
+ cfgfile_dwrite (f, L"floppy%dtype=%d\n", i, p->dfxtype[i]);
+ cfgfile_dwrite (f, L"floppy%dsound=%d\n", i, p->dfxclick[i]);
if (p->dfxclick[i] < 0 && p->dfxclickexternal[i][0])
- cfgfile_dwrite (f, "floppy%dsoundext=%s\n", i, p->dfxclickexternal[i]);
+ cfgfile_dwrite (f, L"floppy%dsoundext=%s\n", i, p->dfxclickexternal[i]);
if (p->dfxtype[i] < 0 && p->nr_floppies > i)
p->nr_floppies = i;
}
for (i = 0; i < MAX_SPARE_DRIVES; i++) {
if (p->dfxlist[i][0])
- cfgfile_dwrite (f, "diskimage%d=%s\n", i, p->dfxlist[i]);
- }
-
- cfgfile_write (f, "nr_floppies=%d\n", p->nr_floppies);
- cfgfile_write (f, "floppy_speed=%d\n", p->floppy_speed);
- cfgfile_write (f, "floppy_volume=%d\n", p->dfxclickvolume);
- cfgfile_write (f, "parallel_on_demand=%s\n", p->parallel_demand ? "true" : "false");
- cfgfile_write (f, "serial_on_demand=%s\n", p->serial_demand ? "true" : "false");
- cfgfile_write (f, "serial_hardware_ctsrts=%s\n", p->serial_hwctsrts ? "true" : "false");
- cfgfile_write (f, "serial_direct=%s\n", p->serial_direct ? "true" : "false");
- cfgfile_write (f, "scsi=%s\n", scsimode[p->scsi]);
- cfgfile_write (f, "uaeserial=%s\n", p->uaeserial ? "true" : "false");
- cfgfile_write (f, "sana2=%s\n", p->sana2 ? "true" : "false");
-
- cfgfile_write (f, "sound_output=%s\n", soundmode1[p->produce_sound]);
- cfgfile_write (f, "sound_channels=%s\n", stereomode[p->sound_stereo]);
- cfgfile_write (f, "sound_stereo_separation=%d\n", p->sound_stereo_separation);
- cfgfile_write (f, "sound_stereo_mixing_delay=%d\n", p->sound_mixed_stereo_delay >= 0 ? p->sound_mixed_stereo_delay : 0);
- cfgfile_write (f, "sound_max_buff=%d\n", p->sound_maxbsiz);
- cfgfile_write (f, "sound_frequency=%d\n", p->sound_freq);
- cfgfile_write (f, "sound_latency=%d\n", p->sound_latency);
- cfgfile_write (f, "sound_interpol=%s\n", interpolmode[p->sound_interpol]);
- cfgfile_write (f, "sound_filter=%s\n", soundfiltermode1[p->sound_filter]);
- cfgfile_write (f, "sound_filter_type=%s\n", soundfiltermode2[p->sound_filter_type]);
- cfgfile_write (f, "sound_volume=%d\n", p->sound_volume);
- cfgfile_write (f, "sound_auto=%s\n", p->sound_auto ? "yes" : "no");
- cfgfile_write (f, "sound_stereo_swap_paula=%s\n", p->sound_stereo_swap_paula ? "yes" : "no");
- cfgfile_write (f, "sound_stereo_swap_ahi=%s\n", p->sound_stereo_swap_ahi ? "yes" : "no");
-
- cfgfile_write (f, "comp_trustbyte=%s\n", compmode[p->comptrustbyte]);
- cfgfile_write (f, "comp_trustword=%s\n", compmode[p->comptrustword]);
- cfgfile_write (f, "comp_trustlong=%s\n", compmode[p->comptrustlong]);
- cfgfile_write (f, "comp_trustnaddr=%s\n", compmode[p->comptrustnaddr]);
- cfgfile_write (f, "comp_nf=%s\n", p->compnf ? "true" : "false");
- cfgfile_write (f, "comp_constjump=%s\n", p->comp_constjump ? "true" : "false");
- cfgfile_write (f, "comp_oldsegv=%s\n", p->comp_oldsegv ? "true" : "false");
-
- cfgfile_write (f, "comp_flushmode=%s\n", flushmode[p->comp_hardflush]);
- cfgfile_write (f, "compfpu=%s\n", p->compfpu ? "true" : "false");
- cfgfile_write (f, "fpu_strict=%s\n", p->fpu_strict ? "true" : "false");
- cfgfile_write (f, "comp_midopt=%s\n", p->comp_midopt ? "true" : "false");
- cfgfile_write (f, "comp_lowopt=%s\n", p->comp_lowopt ? "true" : "false");
- cfgfile_write (f, "avoid_cmov=%s\n", p->avoid_cmov ? "true" : "false" );
- cfgfile_write (f, "avoid_dga=%s\n", p->avoid_dga ? "true" : "false" );
- cfgfile_write (f, "avoid_vid=%s\n", p->avoid_vid ? "true" : "false" );
- cfgfile_write (f, "cachesize=%d\n", p->cachesize);
+ cfgfile_dwrite (f, L"diskimage%d=%s\n", i, p->dfxlist[i]);
+ }
+
+ cfgfile_write (f, L"nr_floppies=%d\n", p->nr_floppies);
+ cfgfile_write (f, L"floppy_speed=%d\n", p->floppy_speed);
+ cfgfile_write (f, L"floppy_volume=%d\n", p->dfxclickvolume);
+ cfgfile_write (f, L"parallel_on_demand=%s\n", p->parallel_demand ? L"true" : L"false");
+ cfgfile_write (f, L"serial_on_demand=%s\n", p->serial_demand ? L"true" : L"false");
+ cfgfile_write (f, L"serial_hardware_ctsrts=%s\n", p->serial_hwctsrts ? L"true" : L"false");
+ cfgfile_write (f, L"serial_direct=%s\n", p->serial_direct ? L"true" : L"false");
+ cfgfile_write (f, L"scsi=%s\n", scsimode[p->scsi]);
+ cfgfile_write (f, L"uaeserial=%s\n", p->uaeserial ? L"true" : L"false");
+ cfgfile_write (f, L"sana2=%s\n", p->sana2 ? L"true" : L"false");
+
+ cfgfile_write (f, L"sound_output=%s\n", soundmode1[p->produce_sound]);
+ cfgfile_write (f, L"sound_channels=%s\n", stereomode[p->sound_stereo]);
+ cfgfile_write (f, L"sound_stereo_separation=%d\n", p->sound_stereo_separation);
+ cfgfile_write (f, L"sound_stereo_mixing_delay=%d\n", p->sound_mixed_stereo_delay >= 0 ? p->sound_mixed_stereo_delay : 0);
+ cfgfile_write (f, L"sound_max_buff=%d\n", p->sound_maxbsiz);
+ cfgfile_write (f, L"sound_frequency=%d\n", p->sound_freq);
+ cfgfile_write (f, L"sound_latency=%d\n", p->sound_latency);
+ cfgfile_write (f, L"sound_interpol=%s\n", interpolmode[p->sound_interpol]);
+ cfgfile_write (f, L"sound_filter=%s\n", soundfiltermode1[p->sound_filter]);
+ cfgfile_write (f, L"sound_filter_type=%s\n", soundfiltermode2[p->sound_filter_type]);
+ cfgfile_write (f, L"sound_volume=%d\n", p->sound_volume);
+ cfgfile_write (f, L"sound_auto=%s\n", p->sound_auto ? L"yes" : L"no");
+ cfgfile_write (f, L"sound_stereo_swap_paula=%s\n", p->sound_stereo_swap_paula ? L"yes" : L"no");
+ cfgfile_write (f, L"sound_stereo_swap_ahi=%s\n", p->sound_stereo_swap_ahi ? L"yes" : L"no");
+
+ cfgfile_write (f, L"comp_trustbyte=%s\n", compmode[p->comptrustbyte]);
+ cfgfile_write (f, L"comp_trustword=%s\n", compmode[p->comptrustword]);
+ cfgfile_write (f, L"comp_trustlong=%s\n", compmode[p->comptrustlong]);
+ cfgfile_write (f, L"comp_trustnaddr=%s\n", compmode[p->comptrustnaddr]);
+ cfgfile_write (f, L"comp_nf=%s\n", p->compnf ? L"true" : L"false");
+ cfgfile_write (f, L"comp_constjump=%s\n", p->comp_constjump ? L"true" : L"false");
+ cfgfile_write (f, L"comp_oldsegv=%s\n", p->comp_oldsegv ? L"true" : L"false");
+
+ cfgfile_write (f, L"comp_flushmode=%s\n", flushmode[p->comp_hardflush]);
+ cfgfile_write (f, L"compfpu=%s\n", p->compfpu ? L"true" : L"false");
+ cfgfile_write (f, L"fpu_strict=%s\n", p->fpu_strict ? L"true" : L"false");
+ cfgfile_write (f, L"comp_midopt=%s\n", p->comp_midopt ? L"true" : L"false");
+ cfgfile_write (f, L"comp_lowopt=%s\n", p->comp_lowopt ? L"true" : L"false");
+ cfgfile_write (f, L"avoid_cmov=%s\n", p->avoid_cmov ? L"true" : L"false" );
+ cfgfile_write (f, L"avoid_dga=%s\n", p->avoid_dga ? L"true" : L"false" );
+ cfgfile_write (f, L"avoid_vid=%s\n", p->avoid_vid ? L"true" : L"false" );
+ cfgfile_write (f, L"cachesize=%d\n", p->cachesize);
if (p->override_dga_address)
- cfgfile_write (f, "override_dga_address=0x%08x\n", p->override_dga_address);
+ cfgfile_write (f, L"override_dga_address=0x%08x\n", p->override_dga_address);
for (i = 0; i < 2; i++) {
struct jport *jp = &p->jports[i];
int v = jp->id;
- char tmp1[MAX_DPATH], tmp2[MAX_DPATH];
+ TCHAR tmp1[MAX_DPATH], tmp2[MAX_DPATH];
if (v < 0) {
- strcpy (tmp2, "none");
+ _tcscpy (tmp2, L"none");
} else if (v < JSEM_JOYS) {
- sprintf (tmp2, "kbd%d", v + 1);
+ _stprintf (tmp2, L"kbd%d", v + 1);
} else if (v < JSEM_MICE) {
- sprintf (tmp2, "joy%d", v - JSEM_JOYS);
+ _stprintf (tmp2, L"joy%d", v - JSEM_JOYS);
} else {
- strcpy (tmp2, "mouse");
+ _tcscpy (tmp2, L"mouse");
if (v - JSEM_MICE > 0)
- sprintf (tmp2, "mouse%d", v - JSEM_MICE);
+ _stprintf (tmp2, L"mouse%d", v - JSEM_MICE);
}
- sprintf (tmp1, "joyport%d=%s\n", i, tmp2);
+ _stprintf (tmp1, L"joyport%d=%s\n", i, tmp2);
cfgfile_write (f, tmp1);
if (jp->name) {
- sprintf (tmp1, "joyportfriendlyname%d=%s\n", i, jp->name);
+ _stprintf (tmp1, L"joyportfriendlyname%d=%s\n", i, jp->name);
cfgfile_write (f, tmp1);
}
if (jp->configname) {
- sprintf (tmp1, "joyportname%d=%s\n", i, jp->configname);
+ _stprintf (tmp1, L"joyportname%d=%s\n", i, jp->configname);
cfgfile_write (f, tmp1);
}
}
- cfgfile_write (f, "bsdsocket_emu=%s\n", p->socket_emu ? "true" : "false");
-
- cfgfile_write (f, "synchronize_clock=%s\n", p->tod_hack ? "yes" : "no");
- cfgfile_write (f, "maprom=0x%x\n", p->maprom);
- cfgfile_write (f, "parallel_postscript_emulation=%s\n", p->parallel_postscript_emulation ? "yes" : "no");
- cfgfile_write (f, "parallel_postscript_detection=%s\n", p->parallel_postscript_detection ? "yes" : "no");
- cfgfile_write (f, "ghostscript_parameters=%s\n", p->ghostscript_parameters);
- cfgfile_write (f, "parallel_autoflush=%d\n", p->parallel_autoflush_time);
- cfgfile_dwrite (f, "uae_hide=%d\n", p->uae_hide);
- cfgfile_dwrite (f, "magic_mouse=%s\n", p->input_magic_mouse ? "true" : "false");
- cfgfile_dwrite (f, "magic_mousecursor=%s\n", magiccursors[p->input_magic_mouse_cursor]);
- cfgfile_dwrite (f, "absolute_mouse=%s\n", abspointers[p->input_tablet]);
-
- cfgfile_write (f, "gfx_display=%d\n", p->gfx_display);
- cfgfile_write (f, "gfx_display_name=%s\n", p->gfx_display_name);
- cfgfile_write (f, "gfx_framerate=%d\n", p->gfx_framerate);
- cfgfile_write (f, "gfx_width=%d\n", p->gfx_size_win.width); /* compatibility with old versions */
- cfgfile_write (f, "gfx_height=%d\n", p->gfx_size_win.height); /* compatibility with old versions */
- cfgfile_write (f, "gfx_top_windowed=%d\n", p->gfx_size_win.x);
- cfgfile_write (f, "gfx_left_windowed=%d\n", p->gfx_size_win.y);
- cfgfile_write (f, "gfx_width_windowed=%d\n", p->gfx_size_win.width);
- cfgfile_write (f, "gfx_height_windowed=%d\n", p->gfx_size_win.height);
- cfgfile_write (f, "gfx_width_fullscreen=%d\n", p->gfx_size_fs.width);
- cfgfile_write (f, "gfx_height_fullscreen=%d\n", p->gfx_size_fs.height);
- cfgfile_write (f, "gfx_refreshrate=%d\n", p->gfx_refreshrate);
- cfgfile_write (f, "gfx_autoresolution=%d\n", p->gfx_autoresolution);
- cfgfile_write (f, "gfx_vsync=%s\n", p->gfx_avsync ? "true" : "false");
- cfgfile_write (f, "gfx_vsync_picasso=%s\n", p->gfx_pvsync ? "true" : "false");
- cfgfile_write (f, "gfx_lores=%s\n", p->gfx_resolution == 0 ? "true" : "false");
- cfgfile_write (f, "gfx_resolution=%s\n", lorestype1[p->gfx_resolution]);
- cfgfile_write (f, "gfx_lores_mode=%s\n", loresmode[p->gfx_lores_mode]);
- cfgfile_write (f, "gfx_flickerfixer=%s\n", p->gfx_scandoubler ? "true" : "false");
- cfgfile_write (f, "gfx_linemode=%s\n", linemode1[p->gfx_linedbl]);
- cfgfile_write (f, "gfx_fullscreen_amiga=%s\n", fullmodes[p->gfx_afullscreen]);
- cfgfile_write (f, "gfx_fullscreen_picasso=%s\n", fullmodes[p->gfx_pfullscreen]);
- cfgfile_write (f, "gfx_center_horizontal=%s\n", centermode1[p->gfx_xcenter]);
- cfgfile_write (f, "gfx_center_vertical=%s\n", centermode1[p->gfx_ycenter]);
- cfgfile_write (f, "gfx_colour_mode=%s\n", colormode1[p->color_mode]);
- cfgfile_write (f, "gfx_blacker_than_black=%s\n", p->gfx_blackerthanblack ? "true" : "false");
+ cfgfile_write (f, L"bsdsocket_emu=%s\n", p->socket_emu ? L"true" : L"false");
+
+ cfgfile_write (f, L"synchronize_clock=%s\n", p->tod_hack ? L"yes" : L"no");
+ cfgfile_write (f, L"maprom=0x%x\n", p->maprom);
+ cfgfile_write (f, L"parallel_postscript_emulation=%s\n", p->parallel_postscript_emulation ? L"yes" : L"no");
+ cfgfile_write (f, L"parallel_postscript_detection=%s\n", p->parallel_postscript_detection ? L"yes" : L"no");
+ cfgfile_write (f, L"ghostscript_parameters=%s\n", p->ghostscript_parameters);
+ cfgfile_write (f, L"parallel_autoflush=%d\n", p->parallel_autoflush_time);
+ cfgfile_dwrite (f, L"uae_hide=%d\n", p->uae_hide);
+ cfgfile_dwrite (f, L"magic_mouse=%s\n", p->input_magic_mouse ? L"true" : L"false");
+ cfgfile_dwrite (f, L"magic_mousecursor=%s\n", magiccursors[p->input_magic_mouse_cursor]);
+ cfgfile_dwrite (f, L"absolute_mouse=%s\n", abspointers[p->input_tablet]);
+
+ cfgfile_write (f, L"gfx_display=%d\n", p->gfx_display);
+ cfgfile_write (f, L"gfx_display_name=%s\n", p->gfx_display_name);
+ cfgfile_write (f, L"gfx_framerate=%d\n", p->gfx_framerate);
+ cfgfile_write (f, L"gfx_width=%d\n", p->gfx_size_win.width); /* compatibility with old versions */
+ cfgfile_write (f, L"gfx_height=%d\n", p->gfx_size_win.height); /* compatibility with old versions */
+ cfgfile_write (f, L"gfx_top_windowed=%d\n", p->gfx_size_win.x);
+ cfgfile_write (f, L"gfx_left_windowed=%d\n", p->gfx_size_win.y);
+ cfgfile_write (f, L"gfx_width_windowed=%d\n", p->gfx_size_win.width);
+ cfgfile_write (f, L"gfx_height_windowed=%d\n", p->gfx_size_win.height);
+ cfgfile_write (f, L"gfx_width_fullscreen=%d\n", p->gfx_size_fs.width);
+ cfgfile_write (f, L"gfx_height_fullscreen=%d\n", p->gfx_size_fs.height);
+ cfgfile_write (f, L"gfx_refreshrate=%d\n", p->gfx_refreshrate);
+ cfgfile_write (f, L"gfx_autoresolution=%d\n", p->gfx_autoresolution);
+ cfgfile_write (f, L"gfx_vsync=%s\n", p->gfx_avsync ? L"true" : L"false");
+ cfgfile_write (f, L"gfx_vsync_picasso=%s\n", p->gfx_pvsync ? L"true" : L"false");
+ cfgfile_write (f, L"gfx_lores=%s\n", p->gfx_resolution == 0 ? L"true" : L"false");
+ cfgfile_write (f, L"gfx_resolution=%s\n", lorestype1[p->gfx_resolution]);
+ cfgfile_write (f, L"gfx_lores_mode=%s\n", loresmode[p->gfx_lores_mode]);
+ cfgfile_write (f, L"gfx_flickerfixer=%s\n", p->gfx_scandoubler ? L"true" : L"false");
+ cfgfile_write (f, L"gfx_linemode=%s\n", linemode1[p->gfx_linedbl]);
+ cfgfile_write (f, L"gfx_fullscreen_amiga=%s\n", fullmodes[p->gfx_afullscreen]);
+ cfgfile_write (f, L"gfx_fullscreen_picasso=%s\n", fullmodes[p->gfx_pfullscreen]);
+ cfgfile_write (f, L"gfx_center_horizontal=%s\n", centermode1[p->gfx_xcenter]);
+ cfgfile_write (f, L"gfx_center_vertical=%s\n", centermode1[p->gfx_ycenter]);
+ cfgfile_write (f, L"gfx_colour_mode=%s\n", colormode1[p->color_mode]);
+ cfgfile_write (f, L"gfx_blacker_than_black=%s\n", p->gfx_blackerthanblack ? L"true" : L"false");
#ifdef GFXFILTER
if (p->gfx_filter > 0) {
uf = &uaefilters[i];
if (uf->type == p->gfx_filter) {
if (p->gfx_filtershader[0])
- cfgfile_dwrite (f, "gfx_filter=%s:%s\n", uf->cfgname, p->gfx_filtershader);
+ cfgfile_dwrite (f, L"gfx_filter=%s:%s\n", uf->cfgname, p->gfx_filtershader);
else
- cfgfile_dwrite (f, "gfx_filter=%s\n", uf->cfgname);
+ cfgfile_dwrite (f, L"gfx_filter=%s\n", uf->cfgname);
if (uf->type == p->gfx_filter) {
if (uf->x[0]) {
- cfgfile_dwrite (f, "gfx_filter_mode=%s\n", filtermode1[p->gfx_filter_filtermode]);
+ cfgfile_dwrite (f, L"gfx_filter_mode=%s\n", filtermode1[p->gfx_filter_filtermode]);
} else {
int mt[4], i = 0;
if (uf->x[1])
mt[i++] = 3;
if (uf->x[4])
mt[i++] = 4;
- cfgfile_dwrite (f, "gfx_filter_mode=%dx\n", mt[p->gfx_filter_filtermode]);
+ cfgfile_dwrite (f, L"gfx_filter_mode=%dx\n", mt[p->gfx_filter_filtermode]);
}
}
}
i++;
}
} else {
- cfgfile_dwrite (f, "gfx_filter=no\n");
- }
-
- cfgfile_dwrite (f, "gfx_filter_vert_zoom=%d\n", p->gfx_filter_vert_zoom);
- cfgfile_dwrite (f, "gfx_filter_horiz_zoom=%d\n", p->gfx_filter_horiz_zoom);
- cfgfile_dwrite (f, "gfx_filter_vert_zoom_mult=%d\n", p->gfx_filter_vert_zoom_mult);
- cfgfile_dwrite (f, "gfx_filter_horiz_zoom_mult=%d\n", p->gfx_filter_horiz_zoom_mult);
- cfgfile_dwrite (f, "gfx_filter_vert_offset=%d\n", p->gfx_filter_vert_offset);
- cfgfile_dwrite (f, "gfx_filter_horiz_offset=%d\n", p->gfx_filter_horiz_offset);
- cfgfile_dwrite (f, "gfx_filter_scanlines=%d\n", p->gfx_filter_scanlines);
- cfgfile_dwrite (f, "gfx_filter_scanlinelevel=%d\n", p->gfx_filter_scanlinelevel);
- cfgfile_dwrite (f, "gfx_filter_scanlineratio=%d\n", p->gfx_filter_scanlineratio);
- cfgfile_dwrite (f, "gfx_filter_luminance=%d\n", p->gfx_filter_luminance);
- cfgfile_dwrite (f, "gfx_filter_contrast=%d\n", p->gfx_filter_contrast);
- cfgfile_dwrite (f, "gfx_filter_saturation=%d\n", p->gfx_filter_saturation);
- cfgfile_dwrite (f, "gfx_filter_gamma=%d\n", p->gfx_filter_gamma);
- cfgfile_dwrite (f, "gfx_filter_blur=%d\n", p->gfx_filter_blur);
- cfgfile_dwrite (f, "gfx_filter_noise=%d\n", p->gfx_filter_noise);
- cfgfile_dwrite (f, "gfx_filter_keep_aspect=%s\n", p->gfx_filter_keep_aspect ? "true" : "false");
- cfgfile_dwrite (f, "gfx_filter_autoscale=%s\n", autoscale[p->gfx_filter_autoscale]);
- cfgfile_dwrite (f, "gfx_filter_aspect_ratio=%d:%d\n",
+ cfgfile_dwrite (f, L"gfx_filter=no\n");
+ }
+
+ cfgfile_dwrite (f, L"gfx_filter_vert_zoom=%d\n", p->gfx_filter_vert_zoom);
+ cfgfile_dwrite (f, L"gfx_filter_horiz_zoom=%d\n", p->gfx_filter_horiz_zoom);
+ cfgfile_dwrite (f, L"gfx_filter_vert_zoom_mult=%d\n", p->gfx_filter_vert_zoom_mult);
+ cfgfile_dwrite (f, L"gfx_filter_horiz_zoom_mult=%d\n", p->gfx_filter_horiz_zoom_mult);
+ cfgfile_dwrite (f, L"gfx_filter_vert_offset=%d\n", p->gfx_filter_vert_offset);
+ cfgfile_dwrite (f, L"gfx_filter_horiz_offset=%d\n", p->gfx_filter_horiz_offset);
+ cfgfile_dwrite (f, L"gfx_filter_scanlines=%d\n", p->gfx_filter_scanlines);
+ cfgfile_dwrite (f, L"gfx_filter_scanlinelevel=%d\n", p->gfx_filter_scanlinelevel);
+ cfgfile_dwrite (f, L"gfx_filter_scanlineratio=%d\n", p->gfx_filter_scanlineratio);
+ cfgfile_dwrite (f, L"gfx_filter_luminance=%d\n", p->gfx_filter_luminance);
+ cfgfile_dwrite (f, L"gfx_filter_contrast=%d\n", p->gfx_filter_contrast);
+ cfgfile_dwrite (f, L"gfx_filter_saturation=%d\n", p->gfx_filter_saturation);
+ cfgfile_dwrite (f, L"gfx_filter_gamma=%d\n", p->gfx_filter_gamma);
+ cfgfile_dwrite (f, L"gfx_filter_blur=%d\n", p->gfx_filter_blur);
+ cfgfile_dwrite (f, L"gfx_filter_noise=%d\n", p->gfx_filter_noise);
+ cfgfile_dwrite (f, L"gfx_filter_keep_aspect=%s\n", p->gfx_filter_keep_aspect ? L"true" : L"false");
+ cfgfile_dwrite (f, L"gfx_filter_autoscale=%s\n", autoscale[p->gfx_filter_autoscale]);
+ cfgfile_dwrite (f, L"gfx_filter_aspect_ratio=%d:%d\n",
p->gfx_filter_aspect >= 0 ? (p->gfx_filter_aspect >> 8) : -1,
p->gfx_filter_aspect >= 0 ? (p->gfx_filter_aspect & 0xff) : -1);
- cfgfile_dwrite (f, "gfx_luminance=%d\n", p->gfx_luminance);
- cfgfile_dwrite (f, "gfx_contrast=%d\n", p->gfx_contrast);
- cfgfile_dwrite (f, "gfx_gamma=%d\n", p->gfx_gamma);
+ cfgfile_dwrite (f, L"gfx_luminance=%d\n", p->gfx_luminance);
+ cfgfile_dwrite (f, L"gfx_contrast=%d\n", p->gfx_contrast);
+ cfgfile_dwrite (f, L"gfx_gamma=%d\n", p->gfx_gamma);
#endif
- cfgfile_write (f, "immediate_blits=%s\n", p->immediate_blits ? "true" : "false");
- cfgfile_write (f, "ntsc=%s\n", p->ntscmode ? "true" : "false");
- cfgfile_write (f, "genlock=%s\n", p->genlock ? "true" : "false");
- cfgfile_dwrite (f, "show_leds=%s\n", (p->leds_on_screen & STATUSLINE_CHIPSET) ? "true" : "false");
- cfgfile_dwrite (f, "keyboard_leds=numlock:%s,capslock:%s,scrolllock:%s\n",
+ cfgfile_write (f, L"immediate_blits=%s\n", p->immediate_blits ? L"true" : L"false");
+ cfgfile_write (f, L"ntsc=%s\n", p->ntscmode ? L"true" : L"false");
+ cfgfile_write (f, L"genlock=%s\n", p->genlock ? L"true" : L"false");
+ cfgfile_dwrite (f, L"show_leds=%s\n", (p->leds_on_screen & STATUSLINE_CHIPSET) ? L"true" : L"false");
+ cfgfile_dwrite (f, L"keyboard_leds=numlock:%s,capslock:%s,scrolllock:%s\n",
kbleds[p->keyboard_leds[0]], kbleds[p->keyboard_leds[1]], kbleds[p->keyboard_leds[2]]);
if (p->chipset_mask & CSMASK_AGA)
- cfgfile_dwrite (f, "chipset=aga\n");
+ cfgfile_dwrite (f, L"chipset=aga\n");
else if ((p->chipset_mask & CSMASK_ECS_AGNUS) && (p->chipset_mask & CSMASK_ECS_DENISE))
- cfgfile_dwrite (f, "chipset=ecs\n");
+ cfgfile_dwrite (f, L"chipset=ecs\n");
else if (p->chipset_mask & CSMASK_ECS_AGNUS)
- cfgfile_dwrite (f, "chipset=ecs_agnus\n");
+ cfgfile_dwrite (f, L"chipset=ecs_agnus\n");
else if (p->chipset_mask & CSMASK_ECS_DENISE)
- cfgfile_dwrite (f, "chipset=ecs_denise\n");
+ cfgfile_dwrite (f, L"chipset=ecs_denise\n");
else
- cfgfile_dwrite (f, "chipset=ocs\n");
- cfgfile_write (f, "chipset_refreshrate=%d\n", p->chipset_refreshrate);
- cfgfile_write (f, "collision_level=%s\n", collmode[p->collision_level]);
-
- cfgfile_write (f, "chipset_compatible=%s\n", cscompa[p->cs_compatible]);
- cfgfile_dwrite (f, "ciaatod=%s\n", ciaatodmode[p->cs_ciaatod]);
- cfgfile_dwrite (f, "rtc=%s\n", rtctype[p->cs_rtc]);
- //cfgfile_dwrite (f, "chipset_rtc_adjust=%d\n", p->cs_rtc_adjust);
- cfgfile_dwrite (f, "ksmirror_e0=%s\n", p->cs_ksmirror_e0 ? "true" : "false");
- cfgfile_dwrite (f, "ksmirror_a8=%s\n", p->cs_ksmirror_a8 ? "true" : "false");
- cfgfile_dwrite (f, "cd32cd=%s\n", p->cs_cd32cd ? "true" : "false");
- cfgfile_dwrite (f, "cd32c2p=%s\n", p->cs_cd32c2p ? "true" : "false");
- cfgfile_dwrite (f, "cd32nvram=%s\n", p->cs_cd32nvram ? "true" : "false");
- cfgfile_dwrite (f, "cdtvcd=%s\n", p->cs_cdtvcd ? "true" : "false");
- cfgfile_dwrite (f, "cdtvram=%s\n", p->cs_cdtvram ? "true" : "false");
- cfgfile_dwrite (f, "cdtvramcard=%d\n", p->cs_cdtvcard);
- cfgfile_dwrite (f, "ide=%s\n", p->cs_ide == 1 ? "a600/a1200" : (p->cs_ide == 2 ? "a4000" : "none"));
- cfgfile_dwrite (f, "a1000ram=%s\n", p->cs_a1000ram ? "true" : "false");
- cfgfile_dwrite (f, "fatgary=%d\n", p->cs_fatgaryrev);
- cfgfile_dwrite (f, "ramsey=%d\n", p->cs_ramseyrev);
- cfgfile_dwrite (f, "pcmcia=%s\n", p->cs_pcmcia ? "true" :"false");
- cfgfile_dwrite (f, "scsi_cdtv=%s\n", p->cs_cdtvscsi ? "true" : "false");
- cfgfile_dwrite (f, "scsi_a2091=%s\n", p->cs_a2091 ? "true" : "false");
- cfgfile_dwrite (f, "scsi_a4091=%s\n", p->cs_a4091 ? "true" : "false");
- cfgfile_dwrite (f, "scsi_a3000=%s\n", p->cs_mbdmac == 1 ? "true" : "false");
- cfgfile_dwrite (f, "scsi_a4000t=%s\n", p->cs_mbdmac == 2 ? "true" : "false");
- cfgfile_dwrite (f, "bogomem_fast=%s\n", p->cs_slowmemisfast ? "true" : "false");
- cfgfile_dwrite (f, "resetwarning=%s\n", p->cs_resetwarning ? "true" : "false");
- cfgfile_dwrite (f, "denise_noehb=%s\n", p->cs_denisenoehb ? "true" : "false");
- cfgfile_dwrite (f, "agnus_bltbusybug=%s\n", p->cs_agnusbltbusybug ? "true" : "false");
-
- cfgfile_write (f, "fastmem_size=%d\n", p->fastmem_size / 0x100000);
- cfgfile_write (f, "a3000mem_size=%d\n", p->mbresmem_low_size / 0x100000);
- cfgfile_write (f, "mbresmem_size=%d\n", p->mbresmem_high_size / 0x100000);
- cfgfile_write (f, "z3mem_size=%d\n", p->z3fastmem_size / 0x100000);
- cfgfile_write (f, "z3mem2_size=%d\n", p->z3fastmem2_size / 0x100000);
- cfgfile_write (f, "z3mem_start=0x%x\n", p->z3fastmem_start);
- cfgfile_write (f, "bogomem_size=%d\n", p->bogomem_size / 0x40000);
- cfgfile_write (f, "gfxcard_size=%d\n", p->gfxmem_size / 0x100000);
- cfgfile_write (f, "chipmem_size=%d\n", p->chipmem_size == 0x20000 ? -1 : (p->chipmem_size == 0x40000 ? 0 : p->chipmem_size / 0x80000));
+ cfgfile_dwrite (f, L"chipset=ocs\n");
+ cfgfile_write (f, L"chipset_refreshrate=%d\n", p->chipset_refreshrate);
+ cfgfile_write (f, L"collision_level=%s\n", collmode[p->collision_level]);
+
+ cfgfile_write (f, L"chipset_compatible=%s\n", cscompa[p->cs_compatible]);
+ cfgfile_dwrite (f, L"ciaatod=%s\n", ciaatodmode[p->cs_ciaatod]);
+ cfgfile_dwrite (f, L"rtc=%s\n", rtctype[p->cs_rtc]);
+ //cfgfile_dwrite (f, L"chipset_rtc_adjust=%d\n", p->cs_rtc_adjust);
+ cfgfile_dwrite (f, L"ksmirror_e0=%s\n", p->cs_ksmirror_e0 ? L"true" : L"false");
+ cfgfile_dwrite (f, L"ksmirror_a8=%s\n", p->cs_ksmirror_a8 ? L"true" : L"false");
+ cfgfile_dwrite (f, L"cd32cd=%s\n", p->cs_cd32cd ? L"true" : L"false");
+ cfgfile_dwrite (f, L"cd32c2p=%s\n", p->cs_cd32c2p ? L"true" : L"false");
+ cfgfile_dwrite (f, L"cd32nvram=%s\n", p->cs_cd32nvram ? L"true" : L"false");
+ cfgfile_dwrite (f, L"cdtvcd=%s\n", p->cs_cdtvcd ? L"true" : L"false");
+ cfgfile_dwrite (f, L"cdtvram=%s\n", p->cs_cdtvram ? L"true" : L"false");
+ cfgfile_dwrite (f, L"cdtvramcard=%d\n", p->cs_cdtvcard);
+ cfgfile_dwrite (f, L"ide=%s\n", p->cs_ide == 1 ? L"a600/a1200" : (p->cs_ide == 2 ? L"a4000" : L"none"));
+ cfgfile_dwrite (f, L"a1000ram=%s\n", p->cs_a1000ram ? L"true" : L"false");
+ cfgfile_dwrite (f, L"fatgary=%d\n", p->cs_fatgaryrev);
+ cfgfile_dwrite (f, L"ramsey=%d\n", p->cs_ramseyrev);
+ cfgfile_dwrite (f, L"pcmcia=%s\n", p->cs_pcmcia ? L"true" : L"false");
+ cfgfile_dwrite (f, L"scsi_cdtv=%s\n", p->cs_cdtvscsi ? L"true" : L"false");
+ cfgfile_dwrite (f, L"scsi_a2091=%s\n", p->cs_a2091 ? L"true" : L"false");
+ cfgfile_dwrite (f, L"scsi_a4091=%s\n", p->cs_a4091 ? L"true" : L"false");
+ cfgfile_dwrite (f, L"scsi_a3000=%s\n", p->cs_mbdmac == 1 ? L"true" : L"false");
+ cfgfile_dwrite (f, L"scsi_a4000t=%s\n", p->cs_mbdmac == 2 ? L"true" : L"false");
+ cfgfile_dwrite (f, L"bogomem_fast=%s\n", p->cs_slowmemisfast ? L"true" : L"false");
+ cfgfile_dwrite (f, L"resetwarning=%s\n", p->cs_resetwarning ? L"true" : L"false");
+ cfgfile_dwrite (f, L"denise_noehb=%s\n", p->cs_denisenoehb ? L"true" : L"false");
+ cfgfile_dwrite (f, L"agnus_bltbusybug=%s\n", p->cs_agnusbltbusybug ? L"true" : L"false");
+
+ cfgfile_write (f, L"fastmem_size=%d\n", p->fastmem_size / 0x100000);
+ cfgfile_write (f, L"a3000mem_size=%d\n", p->mbresmem_low_size / 0x100000);
+ cfgfile_write (f, L"mbresmem_size=%d\n", p->mbresmem_high_size / 0x100000);
+ cfgfile_write (f, L"z3mem_size=%d\n", p->z3fastmem_size / 0x100000);
+ cfgfile_write (f, L"z3mem2_size=%d\n", p->z3fastmem2_size / 0x100000);
+ cfgfile_write (f, L"z3mem_start=0x%x\n", p->z3fastmem_start);
+ cfgfile_write (f, L"bogomem_size=%d\n", p->bogomem_size / 0x40000);
+ cfgfile_write (f, L"gfxcard_size=%d\n", p->gfxmem_size / 0x100000);
+ cfgfile_write (f, L"chipmem_size=%d\n", p->chipmem_size == 0x20000 ? -1 : (p->chipmem_size == 0x40000 ? 0 : p->chipmem_size / 0x80000));
if (p->m68k_speed > 0)
- cfgfile_write (f, "finegrain_cpu_speed=%d\n", p->m68k_speed);
+ cfgfile_write (f, L"finegrain_cpu_speed=%d\n", p->m68k_speed);
else
- cfgfile_write (f, "cpu_speed=%s\n", p->m68k_speed == -1 ? "max" : "real");
+ cfgfile_write (f, L"cpu_speed=%s\n", p->m68k_speed == -1 ? L"max" : L"real");
/* do not reorder start */
write_compatibility_cpu(f, p);
- cfgfile_write (f, "cpu_model=%d\n", p->cpu_model);
+ cfgfile_write (f, L"cpu_model=%d\n", p->cpu_model);
if (p->fpu_model)
- cfgfile_write (f, "fpu_model=%d\n", p->fpu_model);
- cfgfile_write (f, "cpu_compatible=%s\n", p->cpu_compatible ? "true" : "false");
- cfgfile_write (f, "cpu_24bit_addressing=%s\n", p->address_space_24 ? "true" : "false");
+ cfgfile_write (f, L"fpu_model=%d\n", p->fpu_model);
+ cfgfile_write (f, L"cpu_compatible=%s\n", p->cpu_compatible ? L"true" : L"false");
+ cfgfile_write (f, L"cpu_24bit_addressing=%s\n", p->address_space_24 ? L"true" : L"false");
/* do not reorder end */
- cfgfile_write (f, "cpu_cycle_exact=%s\n", p->cpu_cycle_exact ? "true" : "false");
- cfgfile_write (f, "blitter_cycle_exact=%s\n", p->blitter_cycle_exact ? "true" : "false");
- cfgfile_write (f, "rtg_nocustom=%s\n", p->picasso96_nocustom ? "true" : "false");
- cfgfile_write (f, "rtg_modes=0x%x\n", p->picasso96_modeflags);
+ cfgfile_write (f, L"cpu_cycle_exact=%s\n", p->cpu_cycle_exact ? L"true" : L"false");
+ cfgfile_write (f, L"blitter_cycle_exact=%s\n", p->blitter_cycle_exact ? L"true" : L"false");
+ cfgfile_write (f, L"rtg_nocustom=%s\n", p->picasso96_nocustom ? L"true" : L"false");
+ cfgfile_write (f, L"rtg_modes=0x%x\n", p->picasso96_modeflags);
- cfgfile_write (f, "log_illegal_mem=%s\n", p->illegal_mem ? "true" : "false");
+ cfgfile_write (f, L"log_illegal_mem=%s\n", p->illegal_mem ? L"true" : L"false");
if (p->catweasel >= 100)
- cfgfile_dwrite (f, "catweasel=0x%x\n", p->catweasel);
+ cfgfile_dwrite (f, L"catweasel=0x%x\n", p->catweasel);
else
- cfgfile_dwrite (f, "catweasel=%d\n", p->catweasel);
+ cfgfile_dwrite (f, L"catweasel=%d\n", p->catweasel);
- cfgfile_write (f, "kbd_lang=%s\n", (p->keyboard_lang == KBD_LANG_DE ? "de"
- : p->keyboard_lang == KBD_LANG_DK ? "dk"
- : p->keyboard_lang == KBD_LANG_ES ? "es"
- : p->keyboard_lang == KBD_LANG_US ? "us"
- : p->keyboard_lang == KBD_LANG_SE ? "se"
- : p->keyboard_lang == KBD_LANG_FR ? "fr"
- : p->keyboard_lang == KBD_LANG_IT ? "it"
- : "FOO"));
+ cfgfile_write (f, L"kbd_lang=%s\n", (p->keyboard_lang == KBD_LANG_DE ? L"de"
+ : p->keyboard_lang == KBD_LANG_DK ? L"dk"
+ : p->keyboard_lang == KBD_LANG_ES ? L"es"
+ : p->keyboard_lang == KBD_LANG_US ? L"us"
+ : p->keyboard_lang == KBD_LANG_SE ? L"se"
+ : p->keyboard_lang == KBD_LANG_FR ? L"fr"
+ : p->keyboard_lang == KBD_LANG_IT ? L"it"
+ : L"FOO"));
- cfgfile_dwrite (f, "state_replay=%s\n", p->statecapture ? "yes" : "no");
- cfgfile_dwrite (f, "state_replay_rate=%d\n", p->statecapturerate);
- cfgfile_dwrite (f, "state_replay_buffer=%d\n", p->statecapturebuffersize);
+ cfgfile_dwrite (f, L"state_replay=%s\n", p->statecapture ? L"yes" : L"no");
+ cfgfile_dwrite (f, L"state_replay_rate=%d\n", p->statecapturerate);
+ cfgfile_dwrite (f, L"state_replay_buffer=%d\n", p->statecapturebuffersize);
#ifdef FILESYS
write_filesys_config (p, UNEXPANDED, p->path_hardfile, f);
if (p->filesys_no_uaefsdb)
- cfgfile_write (f, "filesys_no_fsdb=%s\n", p->filesys_no_uaefsdb ? "true" : "false");
+ cfgfile_write (f, L"filesys_no_fsdb=%s\n", p->filesys_no_uaefsdb ? L"true" : L"false");
#endif
write_inputdevice_config (p, f);
/* Don't write gfxlib/gfx_test_speed options. */
}
-int cfgfile_yesno (const char *option, const char *value, const char *name, int *location)
+int cfgfile_yesno (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location)
{
- if (strcmp (option, name) != 0)
+ if (_tcscmp (option, name) != 0)
return 0;
- if (strcasecmp (value, "yes") == 0 || strcasecmp (value, "y") == 0
- || strcasecmp (value, "true") == 0 || strcasecmp (value, "t") == 0)
+ if (strcasecmp (value, L"yes") == 0 || strcasecmp (value, L"y") == 0
+ || strcasecmp (value, L"true") == 0 || strcasecmp (value, L"t") == 0)
*location = 1;
- else if (strcasecmp (value, "no") == 0 || strcasecmp (value, "n") == 0
- || strcasecmp (value, "false") == 0 || strcasecmp (value, "f") == 0)
+ else if (strcasecmp (value, L"no") == 0 || strcasecmp (value, L"n") == 0
+ || strcasecmp (value, L"false") == 0 || strcasecmp (value, L"f") == 0)
*location = 0;
else {
- write_log ("Option `%s' requires a value of either `yes' or `no'.\n", option);
+ write_log (L"Option `%s' requires a value of either `yes' or `no'.\n", option);
return -1;
}
return 1;
}
-int cfgfile_intval (const char *option, const char *value, const char *name, int *location, int scale)
+int cfgfile_intval (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, int scale)
{
int base = 10;
- char *endptr;
- if (strcmp (option, name) != 0)
+ TCHAR *endptr;
+ if (_tcscmp (option, name) != 0)
return 0;
/* I guess octal isn't popular enough to worry about here... */
if (value[0] == '0' && value[1] == 'x')
value += 2, base = 16;
- *location = strtol (value, &endptr, base) * scale;
+ *location = _tcstol (value, &endptr, base) * scale;
if (*endptr != '\0' || *value == '\0') {
- write_log ("Option `%s' requires a numeric argument.\n", option);
+ write_log (L"Option `%s' requires a numeric argument.\n", option);
return -1;
}
return 1;
}
-int cfgfile_strval (const char *option, const char *value, const char *name, int *location, const char *table[], int more)
+int cfgfile_strval (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, const TCHAR *table[], int more)
{
int val;
- if (strcmp (option, name) != 0)
+ if (_tcscmp (option, name) != 0)
return 0;
val = match_string (table, value);
if (val == -1) {
if (more)
return 0;
- write_log ("Unknown value for option `%s'.\n", option);
+ write_log (L"Unknown value for option `%s'.\n", option);
return -1;
}
*location = val;
return 1;
}
-int cfgfile_string (const char *option, const char *value, const char *name, char *location, int maxsz)
+int cfgfile_string (const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz)
{
- if (strcmp (option, name) != 0)
+ if (_tcscmp (option, name) != 0)
return 0;
- strncpy (location, value, maxsz - 1);
+ _tcsncpy (location, value, maxsz - 1);
location[maxsz - 1] = '\0';
return 1;
}
-static int getintval (char **p, int *result, int delim)
+static int getintval (TCHAR **p, int *result, int delim)
{
- char *value = *p;
+ TCHAR *value = *p;
int base = 10;
- char *endptr;
- char *p2 = strchr (*p, delim);
+ TCHAR *endptr;
+ TCHAR *p2 = _tcschr (*p, delim);
if (p2 == 0)
return 0;
*p2++ = '\0';
- if (value[0] == '0' && toupper (value[1]) == 'X')
+ if (value[0] == '0' && _totupper (value[1]) == 'X')
value += 2, base = 16;
- *result = strtol (value, &endptr, base);
+ *result = _tcstol (value, &endptr, base);
*p = p2;
if (*endptr != '\0' || *value == '\0')
return 1;
}
-static int getintval2 (char **p, int *result, int delim)
+static int getintval2 (TCHAR **p, int *result, int delim)
{
- char *value = *p;
+ TCHAR *value = *p;
int base = 10;
- char *endptr;
- char *p2 = strchr (*p, delim);
+ TCHAR *endptr;
+ TCHAR *p2 = _tcschr (*p, delim);
if (p2 == 0) {
- p2 = strchr (*p, 0);
+ p2 = _tcschr (*p, 0);
if (p2 == 0) {
*p = 0;
return 0;
if (*p2 != 0)
*p2++ = '\0';
- if (value[0] == '0' && toupper (value[1]) == 'X')
+ if (value[0] == '0' && _totupper (value[1]) == 'X')
value += 2, base = 16;
- *result = strtol (value, &endptr, base);
+ *result = _tcstol (value, &endptr, base);
*p = p2;
if (*endptr != '\0' || *value == '\0') {
: CSMASK_AGA | CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS);
}
-static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value)
+static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
{
int i;
- char *section = 0;
- char *tmpp;
- char tmpbuf[CONFIG_BLEN];
+ TCHAR *section = 0;
+ TCHAR *tmpp;
+ TCHAR tmpbuf[CONFIG_BLEN];
- if (memcmp (option, "input.", 6) == 0) {
+ if (_tcsncmp (option, L"input.", 6) == 0) {
read_inputdevice_config (p, option, value);
return 1;
}
for (tmpp = option; *tmpp != '\0'; tmpp++)
- if (isupper (*tmpp))
- *tmpp = tolower (*tmpp);
- tmpp = strchr (option, '.');
+ if (_istupper (*tmpp))
+ *tmpp = _totlower (*tmpp);
+ tmpp = _tcschr (option, '.');
if (tmpp) {
section = option;
option = tmpp + 1;
*tmpp = '\0';
- if (strcmp (section, TARGET_NAME) == 0) {
+ if (_tcscmp (section, TARGET_NAME) == 0) {
/* We special case the various path options here. */
- if (cfgfile_string (option, value, "rom_path", p->path_rom, sizeof p->path_rom)
- || cfgfile_string (option, value, "floppy_path", p->path_floppy, sizeof p->path_floppy)
- || cfgfile_string (option, value, "hardfile_path", p->path_hardfile, sizeof p->path_hardfile))
+ if (cfgfile_string (option, value, L"rom_path", p->path_rom, sizeof p->path_rom / sizeof (TCHAR))
+ || cfgfile_string (option, value, L"floppy_path", p->path_floppy, sizeof p->path_floppy / sizeof (TCHAR))
+ || cfgfile_string (option, value, L"hardfile_path", p->path_hardfile, sizeof p->path_hardfile / sizeof (TCHAR)))
return 1;
return target_parse_option (p, option, value);
}
return 0;
}
for (i = 0; i < MAX_SPARE_DRIVES; i++) {
- sprintf (tmpbuf, "diskimage%d", i);
- if (cfgfile_string (option, value, tmpbuf, p->dfxlist[i], sizeof p->dfxlist[i])) {
+ _stprintf (tmpbuf, L"diskimage%d", i);
+ if (cfgfile_string (option, value, tmpbuf, p->dfxlist[i], sizeof p->dfxlist[i] / sizeof (TCHAR))) {
#if 0
if (i < 4 && !p->df[i][0])
- strcpy (p->df[i], p->dfxlist[i]);
+ _tcscpy (p->df[i], p->dfxlist[i]);
#endif
return 1;
}
}
- if (cfgfile_intval (option, value, "sound_frequency", &p->sound_freq, 1)) {
+ if (cfgfile_intval (option, value, L"sound_frequency", &p->sound_freq, 1)) {
/* backwards compatibility */
p->sound_latency = 1000 * (p->sound_maxbsiz >> 1) / p->sound_freq;
return 1;
}
- if (cfgfile_intval (option, value, "sound_latency", &p->sound_latency, 1)
- || cfgfile_intval (option, value, "sound_max_buff", &p->sound_maxbsiz, 1)
- || cfgfile_intval (option, value, "state_replay_rate", &p->statecapturerate, 1)
- || cfgfile_intval (option, value, "state_replay_buffer", &p->statecapturebuffersize, 1)
- || cfgfile_intval (option, value, "sound_frequency", &p->sound_freq, 1)
- || cfgfile_intval (option, value, "sound_volume", &p->sound_volume, 1)
- || cfgfile_intval (option, value, "sound_stereo_separation", &p->sound_stereo_separation, 1)
- || cfgfile_intval (option, value, "sound_stereo_mixing_delay", &p->sound_mixed_stereo_delay, 1)
-
- || cfgfile_intval (option, value, "gfx_display", &p->gfx_display, 1)
- || cfgfile_intval (option, value, "gfx_framerate", &p->gfx_framerate, 1)
- || cfgfile_intval (option, value, "gfx_width_windowed", &p->gfx_size_win.width, 1)
- || cfgfile_intval (option, value, "gfx_height_windowed", &p->gfx_size_win.height, 1)
- || cfgfile_intval (option, value, "gfx_top_windowed", &p->gfx_size_win.x, 1)
- || cfgfile_intval (option, value, "gfx_left_windowed", &p->gfx_size_win.y, 1)
- || cfgfile_intval (option, value, "gfx_width_fullscreen", &p->gfx_size_fs.width, 1)
- || cfgfile_intval (option, value, "gfx_height_fullscreen", &p->gfx_size_fs.height, 1)
- || cfgfile_intval (option, value, "gfx_refreshrate", &p->gfx_refreshrate, 1)
- || cfgfile_intval (option, value, "gfx_autoresolution", &p->gfx_autoresolution, 1)
-
- || cfgfile_intval (option, value, "gfx_center_horizontal_position", &p->gfx_xcenter_pos, 1)
- || cfgfile_intval (option, value, "gfx_center_vertical_position", &p->gfx_ycenter_pos, 1)
- || cfgfile_intval (option, value, "gfx_center_horizontal_size", &p->gfx_xcenter_size, 1)
- || cfgfile_intval (option, value, "gfx_center_vertical_size", &p->gfx_ycenter_size, 1)
+ if (cfgfile_intval (option, value, L"sound_latency", &p->sound_latency, 1)
+ || cfgfile_intval (option, value, L"sound_max_buff", &p->sound_maxbsiz, 1)
+ || cfgfile_intval (option, value, L"state_replay_rate", &p->statecapturerate, 1)
+ || cfgfile_intval (option, value, L"state_replay_buffer", &p->statecapturebuffersize, 1)
+ || cfgfile_intval (option, value, L"sound_frequency", &p->sound_freq, 1)
+ || cfgfile_intval (option, value, L"sound_volume", &p->sound_volume, 1)
+ || cfgfile_intval (option, value, L"sound_stereo_separation", &p->sound_stereo_separation, 1)
+ || cfgfile_intval (option, value, L"sound_stereo_mixing_delay", &p->sound_mixed_stereo_delay, 1)
+
+ || cfgfile_intval (option, value, L"gfx_display", &p->gfx_display, 1)
+ || cfgfile_intval (option, value, L"gfx_framerate", &p->gfx_framerate, 1)
+ || cfgfile_intval (option, value, L"gfx_width_windowed", &p->gfx_size_win.width, 1)
+ || cfgfile_intval (option, value, L"gfx_height_windowed", &p->gfx_size_win.height, 1)
+ || cfgfile_intval (option, value, L"gfx_top_windowed", &p->gfx_size_win.x, 1)
+ || cfgfile_intval (option, value, L"gfx_left_windowed", &p->gfx_size_win.y, 1)
+ || cfgfile_intval (option, value, L"gfx_width_fullscreen", &p->gfx_size_fs.width, 1)
+ || cfgfile_intval (option, value, L"gfx_height_fullscreen", &p->gfx_size_fs.height, 1)
+ || cfgfile_intval (option, value, L"gfx_refreshrate", &p->gfx_refreshrate, 1)
+ || cfgfile_intval (option, value, L"gfx_autoresolution", &p->gfx_autoresolution, 1)
+
+ || cfgfile_intval (option, value, L"gfx_center_horizontal_position", &p->gfx_xcenter_pos, 1)
+ || cfgfile_intval (option, value, L"gfx_center_vertical_position", &p->gfx_ycenter_pos, 1)
+ || cfgfile_intval (option, value, L"gfx_center_horizontal_size", &p->gfx_xcenter_size, 1)
+ || cfgfile_intval (option, value, L"gfx_center_vertical_size", &p->gfx_ycenter_size, 1)
#ifdef GFXFILTER
- || cfgfile_intval (option, value, "gfx_filter_vert_zoom", &p->gfx_filter_vert_zoom, 1)
- || cfgfile_intval (option, value, "gfx_filter_horiz_zoom", &p->gfx_filter_horiz_zoom, 1)
- || cfgfile_intval (option, value, "gfx_filter_vert_zoom_mult", &p->gfx_filter_vert_zoom_mult, 1)
- || cfgfile_intval (option, value, "gfx_filter_horiz_zoom_mult", &p->gfx_filter_horiz_zoom_mult, 1)
- || cfgfile_intval (option, value, "gfx_filter_vert_offset", &p->gfx_filter_vert_offset, 1)
- || cfgfile_intval (option, value, "gfx_filter_horiz_offset", &p->gfx_filter_horiz_offset, 1)
- || cfgfile_intval (option, value, "gfx_filter_scanlines", &p->gfx_filter_scanlines, 1)
- || cfgfile_intval (option, value, "gfx_filter_scanlinelevel", &p->gfx_filter_scanlinelevel, 1)
- || cfgfile_intval (option, value, "gfx_filter_scanlineratio", &p->gfx_filter_scanlineratio, 1)
- || cfgfile_intval (option, value, "gfx_filter_luminance", &p->gfx_filter_luminance, 1)
- || cfgfile_intval (option, value, "gfx_filter_contrast", &p->gfx_filter_contrast, 1)
- || cfgfile_intval (option, value, "gfx_filter_saturation", &p->gfx_filter_saturation, 1)
- || cfgfile_intval (option, value, "gfx_filter_gamma", &p->gfx_filter_gamma, 1)
- || cfgfile_intval (option, value, "gfx_filter_blur", &p->gfx_filter_blur, 1)
- || cfgfile_intval (option, value, "gfx_filter_noise", &p->gfx_filter_noise, 1)
- || cfgfile_yesno (option, value, "gfx_filter_keep_aspect", &p->gfx_filter_keep_aspect)
- || cfgfile_intval (option, value, "gfx_luminance", &p->gfx_luminance, 1)
- || cfgfile_intval (option, value, "gfx_contrast", &p->gfx_contrast, 1)
- || cfgfile_intval (option, value, "gfx_gamma", &p->gfx_gamma, 1)
+ || cfgfile_intval (option, value, L"gfx_filter_vert_zoom", &p->gfx_filter_vert_zoom, 1)
+ || cfgfile_intval (option, value, L"gfx_filter_horiz_zoom", &p->gfx_filter_horiz_zoom, 1)
+ || cfgfile_intval (option, value, L"gfx_filter_vert_zoom_mult", &p->gfx_filter_vert_zoom_mult, 1)
+ || cfgfile_intval (option, value, L"gfx_filter_horiz_zoom_mult", &p->gfx_filter_horiz_zoom_mult, 1)
+ || cfgfile_intval (option, value, L"gfx_filter_vert_offset", &p->gfx_filter_vert_offset, 1)
+ || cfgfile_intval (option, value, L"gfx_filter_horiz_offset", &p->gfx_filter_horiz_offset, 1)
+ || cfgfile_intval (option, value, L"gfx_filter_scanlines", &p->gfx_filter_scanlines, 1)
+ || cfgfile_intval (option, value, L"gfx_filter_scanlinelevel", &p->gfx_filter_scanlinelevel, 1)
+ || cfgfile_intval (option, value, L"gfx_filter_scanlineratio", &p->gfx_filter_scanlineratio, 1)
+ || cfgfile_intval (option, value, L"gfx_filter_luminance", &p->gfx_filter_luminance, 1)
+ || cfgfile_intval (option, value, L"gfx_filter_contrast", &p->gfx_filter_contrast, 1)
+ || cfgfile_intval (option, value, L"gfx_filter_saturation", &p->gfx_filter_saturation, 1)
+ || cfgfile_intval (option, value, L"gfx_filter_gamma", &p->gfx_filter_gamma, 1)
+ || cfgfile_intval (option, value, L"gfx_filter_blur", &p->gfx_filter_blur, 1)
+ || cfgfile_intval (option, value, L"gfx_filter_noise", &p->gfx_filter_noise, 1)
+ || cfgfile_yesno (option, value, L"gfx_filter_keep_aspect", &p->gfx_filter_keep_aspect)
+ || cfgfile_intval (option, value, L"gfx_luminance", &p->gfx_luminance, 1)
+ || cfgfile_intval (option, value, L"gfx_contrast", &p->gfx_contrast, 1)
+ || cfgfile_intval (option, value, L"gfx_gamma", &p->gfx_gamma, 1)
#endif
- || cfgfile_intval (option, value, "floppy0sound", &p->dfxclick[0], 1)
- || cfgfile_intval (option, value, "floppy1sound", &p->dfxclick[1], 1)
- || cfgfile_intval (option, value, "floppy2sound", &p->dfxclick[2], 1)
- || cfgfile_intval (option, value, "floppy3sound", &p->dfxclick[3], 1)
- || cfgfile_intval (option, value, "floppy_volume", &p->dfxclickvolume, 1)
- || cfgfile_intval (option, value, "override_dga_address", &p->override_dga_address, 1))
+ || cfgfile_intval (option, value, L"floppy0sound", &p->dfxclick[0], 1)
+ || cfgfile_intval (option, value, L"floppy1sound", &p->dfxclick[1], 1)
+ || cfgfile_intval (option, value, L"floppy2sound", &p->dfxclick[2], 1)
+ || cfgfile_intval (option, value, L"floppy3sound", &p->dfxclick[3], 1)
+ || cfgfile_intval (option, value, L"floppy_volume", &p->dfxclickvolume, 1)
+ || cfgfile_intval (option, value, L"override_dga_address", &p->override_dga_address, 1))
return 1;
- if (cfgfile_string (option, value, "floppy0soundext", p->dfxclickexternal[0], sizeof p->dfxclickexternal[0])
- || cfgfile_string (option, value, "floppy1soundext", p->dfxclickexternal[1], sizeof p->dfxclickexternal[1])
- || cfgfile_string (option, value, "floppy2soundext", p->dfxclickexternal[2], sizeof p->dfxclickexternal[2])
- || cfgfile_string (option, value, "floppy3soundext", p->dfxclickexternal[3], sizeof p->dfxclickexternal[3])
- || cfgfile_string (option, value, "gfx_display_name", p->gfx_display_name, sizeof p->gfx_display_name)
- || cfgfile_string (option, value, "config_info", p->info, sizeof p->info)
- || cfgfile_string (option, value, "config_description", p->description, sizeof p->description))
+ if (cfgfile_string (option, value, L"floppy0soundext", p->dfxclickexternal[0], sizeof p->dfxclickexternal[0] / sizeof (TCHAR))
+ || cfgfile_string (option, value, L"floppy1soundext", p->dfxclickexternal[1], sizeof p->dfxclickexternal[1] / sizeof (TCHAR))
+ || cfgfile_string (option, value, L"floppy2soundext", p->dfxclickexternal[2], sizeof p->dfxclickexternal[2] / sizeof (TCHAR))
+ || cfgfile_string (option, value, L"floppy3soundext", p->dfxclickexternal[3], sizeof p->dfxclickexternal[3] / sizeof (TCHAR))
+ || cfgfile_string (option, value, L"gfx_display_name", p->gfx_display_name, sizeof p->gfx_display_name / sizeof (TCHAR))
+ || cfgfile_string (option, value, L"config_info", p->info, sizeof p->info / sizeof (TCHAR))
+ || cfgfile_string (option, value, L"config_description", p->description, sizeof p->description / sizeof (TCHAR)))
return 1;
- if (cfgfile_yesno (option, value, "use_debugger", &p->start_debugger)
- || cfgfile_yesno (option, value, "sound_auto", &p->sound_auto)
- || cfgfile_yesno (option, value, "sound_stereo_swap_paula", &p->sound_stereo_swap_paula)
- || cfgfile_yesno (option, value, "sound_stereo_swap_ahi", &p->sound_stereo_swap_ahi)
- || cfgfile_yesno (option, value, "state_replay", &p->statecapture)
- || cfgfile_yesno (option, value, "avoid_cmov", &p->avoid_cmov)
- || cfgfile_yesno (option, value, "avoid_dga", &p->avoid_dga)
- || cfgfile_yesno (option, value, "avoid_vid", &p->avoid_vid)
- || cfgfile_yesno (option, value, "log_illegal_mem", &p->illegal_mem)
- || cfgfile_yesno (option, value, "filesys_no_fsdb", &p->filesys_no_uaefsdb)
- || cfgfile_yesno (option, value, "gfx_vsync", &p->gfx_avsync)
- || cfgfile_yesno (option, value, "gfx_vsync_picasso", &p->gfx_pvsync)
- || cfgfile_yesno (option, value, "gfx_blacker_than_black", &p->gfx_blackerthanblack)
- || cfgfile_yesno (option, value, "gfx_flickerfixer", &p->gfx_scandoubler)
- || cfgfile_yesno (option, value, "show_leds", &p->leds_on_screen)
- || cfgfile_yesno (option, value, "synchronize_clock", &p->tod_hack)
- || cfgfile_yesno (option, value, "magic_mouse", &p->input_magic_mouse)
- || cfgfile_yesno (option, value, "bsdsocket_emu", &p->socket_emu))
+ if (cfgfile_yesno (option, value, L"use_debugger", &p->start_debugger)
+ || cfgfile_yesno (option, value, L"sound_auto", &p->sound_auto)
+ || cfgfile_yesno (option, value, L"sound_stereo_swap_paula", &p->sound_stereo_swap_paula)
+ || cfgfile_yesno (option, value, L"sound_stereo_swap_ahi", &p->sound_stereo_swap_ahi)
+ || cfgfile_yesno (option, value, L"state_replay", &p->statecapture)
+ || cfgfile_yesno (option, value, L"avoid_cmov", &p->avoid_cmov)
+ || cfgfile_yesno (option, value, L"avoid_dga", &p->avoid_dga)
+ || cfgfile_yesno (option, value, L"avoid_vid", &p->avoid_vid)
+ || cfgfile_yesno (option, value, L"log_illegal_mem", &p->illegal_mem)
+ || cfgfile_yesno (option, value, L"filesys_no_fsdb", &p->filesys_no_uaefsdb)
+ || cfgfile_yesno (option, value, L"gfx_vsync", &p->gfx_avsync)
+ || cfgfile_yesno (option, value, L"gfx_vsync_picasso", &p->gfx_pvsync)
+ || cfgfile_yesno (option, value, L"gfx_blacker_than_black", &p->gfx_blackerthanblack)
+ || cfgfile_yesno (option, value, L"gfx_flickerfixer", &p->gfx_scandoubler)
+ || cfgfile_yesno (option, value, L"show_leds", &p->leds_on_screen)
+ || cfgfile_yesno (option, value, L"synchronize_clock", &p->tod_hack)
+ || cfgfile_yesno (option, value, L"magic_mouse", &p->input_magic_mouse)
+ || cfgfile_yesno (option, value, L"bsdsocket_emu", &p->socket_emu))
return 1;
- if (cfgfile_strval (option, value, "sound_output", &p->produce_sound, soundmode1, 1)
- || cfgfile_strval (option, value, "sound_output", &p->produce_sound, soundmode2, 0)
- || cfgfile_strval (option, value, "sound_interpol", &p->sound_interpol, interpolmode, 0)
- || cfgfile_strval (option, value, "sound_filter", &p->sound_filter, soundfiltermode1, 0)
- || cfgfile_strval (option, value, "sound_filter_type", &p->sound_filter_type, soundfiltermode2, 0)
- || cfgfile_strval (option, value, "use_gui", &p->start_gui, guimode1, 1)
- || cfgfile_strval (option, value, "use_gui", &p->start_gui, guimode2, 1)
- || cfgfile_strval (option, value, "use_gui", &p->start_gui, guimode3, 0)
- || cfgfile_strval (option, value, "gfx_resolution", &p->gfx_resolution, lorestype1, 0)
- || cfgfile_strval (option, value, "gfx_lores", &p->gfx_resolution, lorestype2, 0)
- || cfgfile_strval (option, value, "gfx_lores_mode", &p->gfx_lores_mode, loresmode, 0)
- || cfgfile_strval (option, value, "gfx_fullscreen_amiga", &p->gfx_afullscreen, fullmodes, 0)
- || cfgfile_strval (option, value, "gfx_fullscreen_picasso", &p->gfx_pfullscreen, fullmodes, 0)
- || cfgfile_strval (option, value, "gfx_linemode", &p->gfx_linedbl, linemode1, 1)
- || cfgfile_strval (option, value, "gfx_linemode", &p->gfx_linedbl, linemode2, 0)
- || cfgfile_strval (option, value, "gfx_center_horizontal", &p->gfx_xcenter, centermode1, 1)
- || cfgfile_strval (option, value, "gfx_center_vertical", &p->gfx_ycenter, centermode1, 1)
- || cfgfile_strval (option, value, "gfx_center_horizontal", &p->gfx_xcenter, centermode2, 0)
- || cfgfile_strval (option, value, "gfx_center_vertical", &p->gfx_ycenter, centermode2, 0)
- || cfgfile_strval (option, value, "gfx_colour_mode", &p->color_mode, colormode1, 1)
- || cfgfile_strval (option, value, "gfx_colour_mode", &p->color_mode, colormode2, 0)
- || cfgfile_strval (option, value, "gfx_color_mode", &p->color_mode, colormode1, 1)
- || cfgfile_strval (option, value, "gfx_color_mode", &p->color_mode, colormode2, 0)
- || cfgfile_strval (option, value, "gfx_max_horizontal", &p->gfx_max_horizontal, maxhoriz, 0)
- || cfgfile_strval (option, value, "gfx_max_vertical", &p->gfx_max_vertical, maxvert, 0)
- || cfgfile_strval (option, value, "gfx_filter_autoscale", &p->gfx_filter_autoscale, autoscale, 0)
- || cfgfile_strval (option, value, "magic_mousecursor", &p->input_magic_mouse_cursor, magiccursors, 0)
- || cfgfile_strval (option, value, "absolute_mouse", &p->input_tablet, abspointers, 0))
+ if (cfgfile_strval (option, value, L"sound_output", &p->produce_sound, soundmode1, 1)
+ || cfgfile_strval (option, value, L"sound_output", &p->produce_sound, soundmode2, 0)
+ || cfgfile_strval (option, value, L"sound_interpol", &p->sound_interpol, interpolmode, 0)
+ || cfgfile_strval (option, value, L"sound_filter", &p->sound_filter, soundfiltermode1, 0)
+ || cfgfile_strval (option, value, L"sound_filter_type", &p->sound_filter_type, soundfiltermode2, 0)
+ || cfgfile_strval (option, value, L"use_gui", &p->start_gui, guimode1, 1)
+ || cfgfile_strval (option, value, L"use_gui", &p->start_gui, guimode2, 1)
+ || cfgfile_strval (option, value, L"use_gui", &p->start_gui, guimode3, 0)
+ || cfgfile_strval (option, value, L"gfx_resolution", &p->gfx_resolution, lorestype1, 0)
+ || cfgfile_strval (option, value, L"gfx_lores", &p->gfx_resolution, lorestype2, 0)
+ || cfgfile_strval (option, value, L"gfx_lores_mode", &p->gfx_lores_mode, loresmode, 0)
+ || cfgfile_strval (option, value, L"gfx_fullscreen_amiga", &p->gfx_afullscreen, fullmodes, 0)
+ || cfgfile_strval (option, value, L"gfx_fullscreen_picasso", &p->gfx_pfullscreen, fullmodes, 0)
+ || cfgfile_strval (option, value, L"gfx_linemode", &p->gfx_linedbl, linemode1, 1)
+ || cfgfile_strval (option, value, L"gfx_linemode", &p->gfx_linedbl, linemode2, 0)
+ || cfgfile_strval (option, value, L"gfx_center_horizontal", &p->gfx_xcenter, centermode1, 1)
+ || cfgfile_strval (option, value, L"gfx_center_vertical", &p->gfx_ycenter, centermode1, 1)
+ || cfgfile_strval (option, value, L"gfx_center_horizontal", &p->gfx_xcenter, centermode2, 0)
+ || cfgfile_strval (option, value, L"gfx_center_vertical", &p->gfx_ycenter, centermode2, 0)
+ || cfgfile_strval (option, value, L"gfx_colour_mode", &p->color_mode, colormode1, 1)
+ || cfgfile_strval (option, value, L"gfx_colour_mode", &p->color_mode, colormode2, 0)
+ || cfgfile_strval (option, value, L"gfx_color_mode", &p->color_mode, colormode1, 1)
+ || cfgfile_strval (option, value, L"gfx_color_mode", &p->color_mode, colormode2, 0)
+ || cfgfile_strval (option, value, L"gfx_max_horizontal", &p->gfx_max_horizontal, maxhoriz, 0)
+ || cfgfile_strval (option, value, L"gfx_max_vertical", &p->gfx_max_vertical, maxvert, 0)
+ || cfgfile_strval (option, value, L"gfx_filter_autoscale", &p->gfx_filter_autoscale, autoscale, 0)
+ || cfgfile_strval (option, value, L"magic_mousecursor", &p->input_magic_mouse_cursor, magiccursors, 0)
+ || cfgfile_strval (option, value, L"absolute_mouse", &p->input_tablet, abspointers, 0))
return 1;
#ifdef GFXFILTER
- if (strcmp (option,"gfx_filter") == 0) {
+ if (_tcscmp (option, L"gfx_filter") == 0) {
int i = 0;
- char *s = strchr (value, ':');
+ TCHAR *s = _tcschr (value, ':');
if (s)
*s++ = 0;
p->gfx_filtershader[0] = 0;
p->gfx_filter = 0;
while(uaefilters[i].name) {
- if (!strcmp (uaefilters[i].cfgname, value)) {
+ if (!_tcscmp (uaefilters[i].cfgname, value)) {
p->gfx_filter = uaefilters[i].type;
if (s)
- strcpy (p->gfx_filtershader, s);
+ _tcscpy (p->gfx_filtershader, s);
break;
}
i++;
}
return 1;
}
- if (strcmp (option,"gfx_filter_mode") == 0) {
+ if (_tcscmp (option, L"gfx_filter_mode") == 0) {
p->gfx_filter_filtermode = 0;
if (p->gfx_filter > 0) {
struct uae_filter *uf;
uf = &uaefilters[i];
if (uf->type == p->gfx_filter) {
if (uf->x[0]) {
- cfgfile_strval (option, value, "gfx_filter_mode", &p->gfx_filter_filtermode, filtermode1, 0);
+ cfgfile_strval (option, value, L"gfx_filter_mode", &p->gfx_filter_filtermode, filtermode1, 0);
} else {
int mt[4], j;
i = 0;
mt[i++] = 3;
if (uf->x[4])
mt[i++] = 4;
- cfgfile_strval (option, value, "gfx_filter_mode", &i, filtermode2, 0);
+ cfgfile_strval (option, value, L"gfx_filter_mode", &i, filtermode2, 0);
for (j = 0; j < i; j++) {
if (mt[j] == i)
p->gfx_filter_filtermode = j;
}
return 1;
}
- if (cfgfile_string (option, value, "gfx_filter_aspect_ratio", tmpbuf, sizeof tmpbuf)) {
+ if (cfgfile_string (option, value, L"gfx_filter_aspect_ratio", tmpbuf, sizeof tmpbuf / sizeof (TCHAR))) {
int v1, v2;
- char *s;
+ TCHAR *s;
p->gfx_filter_aspect = -1;
- v1 = atol (tmpbuf);
- s = strchr (tmpbuf, ':');
+ v1 = _tstol (tmpbuf);
+ s = _tcschr (tmpbuf, ':');
if (s) {
- v2 = atol (s + 1);
+ v2 = _tstol (s + 1);
if (v1 < 0 || v2 < 0)
p->gfx_filter_aspect = -1;
else if (v1 == 0 || v2 == 0)
}
#endif
- if (strcmp (option, "gfx_width") == 0 || strcmp (option, "gfx_height") == 0) {
- cfgfile_intval (option, value, "gfx_width", &p->gfx_size_win.width, 1);
- cfgfile_intval (option, value, "gfx_height", &p->gfx_size_win.height, 1);
+ if (_tcscmp (option, L"gfx_width") == 0 || _tcscmp (option, L"gfx_height") == 0) {
+ cfgfile_intval (option, value, L"gfx_width", &p->gfx_size_win.width, 1);
+ cfgfile_intval (option, value, L"gfx_height", &p->gfx_size_win.height, 1);
p->gfx_size_fs.width = p->gfx_size_win.width;
p->gfx_size_fs.height = p->gfx_size_win.height;
return 1;
}
- if (strcmp (option, "gfx_fullscreen_multi") == 0 || strcmp (option, "gfx_windowed_multi") == 0) {
- char tmp[256], *tmpp, *tmpp2;
+ if (_tcscmp (option, L"gfx_fullscreen_multi") == 0 || _tcscmp (option, L"gfx_windowed_multi") == 0) {
+ TCHAR tmp[256], *tmpp, *tmpp2;
struct wh *wh = p->gfx_size_win_xtra;
- if (strcmp (option, "gfx_fullscreen_multi") == 0)
+ if (_tcscmp (option, L"gfx_fullscreen_multi") == 0)
wh = p->gfx_size_fs_xtra;
- sprintf (tmp, ",%s,", value);
+ _stprintf (tmp, L",%s,", value);
tmpp2 = tmp;
for (i = 0; i < 4; i++) {
- tmpp = strchr (tmpp2, ',');
+ tmpp = _tcschr (tmpp2, ',');
tmpp++;
- wh[i].width = atol (tmpp);
+ wh[i].width = _tstol (tmpp);
while (*tmpp != ',' && *tmpp != 'x')
tmpp++;
- wh[i].height = atol (tmpp + 1);
+ wh[i].height = _tstol (tmpp + 1);
tmpp2 = tmpp;
}
return 1;
}
- if (strcmp (option, "joyportfriendlyname0") == 0 || strcmp (option, "joyportfriendlyname1") == 0) {
- inputdevice_joyport_config (p, value, strcmp (option, "joyportfriendlyname0") == 0 ? 0 : 1, 2);
+ if (_tcscmp (option, L"joyportfriendlyname0") == 0 || _tcscmp (option, L"joyportfriendlyname1") == 0) {
+ inputdevice_joyport_config (p, value, _tcscmp (option, L"joyportfriendlyname0") == 0 ? 0 : 1, 2);
return 1;
}
- if (strcmp (option, "joyportname0") == 0 || strcmp (option, "joyportname1") == 0) {
- inputdevice_joyport_config (p, value, strcmp (option, "joyportname0") == 0 ? 0 : 1, 1);
+ if (_tcscmp (option, L"joyportname0") == 0 || _tcscmp (option, L"joyportname1") == 0) {
+ inputdevice_joyport_config (p, value, _tcscmp (option, L"joyportname0") == 0 ? 0 : 1, 1);
return 1;
}
- if (strcmp (option, "joyport0") == 0 || strcmp (option, "joyport1") == 0) {
- inputdevice_joyport_config (p, value, strcmp (option, "joyport0") == 0 ? 0 : 1, 0);
+ if (_tcscmp (option, L"joyport0") == 0 || _tcscmp (option, L"joyport1") == 0) {
+ inputdevice_joyport_config (p, value, _tcscmp (option, L"joyport0") == 0 ? 0 : 1, 0);
return 1;
}
- if (cfgfile_string (option, value, "statefile", tmpbuf, sizeof (tmpbuf))) {
- strcpy (savestate_fname, tmpbuf);
+ if (cfgfile_string (option, value, L"statefile", tmpbuf, sizeof (tmpbuf) / sizeof (TCHAR))) {
+ _tcscpy (savestate_fname, tmpbuf);
if (zfile_exists (savestate_fname)) {
savestate_state = STATE_DORESTORE;
} else {
int ok = 0;
if (savestate_fname[0]) {
for (;;) {
- char *p;
+ TCHAR *p;
if (my_existsdir (savestate_fname)) {
ok = 1;
break;
}
- p = strrchr (savestate_fname, '\\');
+ p = _tcsrchr (savestate_fname, '\\');
if (!p)
- p = strrchr (savestate_fname, '/');
+ p = _tcsrchr (savestate_fname, '/');
if (!p)
break;
*p = 0;
return 1;
}
- if (cfgfile_strval (option, value, "sound_channels", &p->sound_stereo, stereomode, 1)) {
+ if (cfgfile_strval (option, value, L"sound_channels", &p->sound_stereo, stereomode, 1)) {
if (p->sound_stereo == SND_NONE) { /* "mixed stereo" compatibility hack */
p->sound_stereo = SND_STEREO;
p->sound_mixed_stereo_delay = 5;
return 1;
}
- if (strcmp (option, "kbd_lang") == 0) {
+ if (_tcscmp (option, L"kbd_lang") == 0) {
KbdLang l;
- if ((l = KBD_LANG_DE, strcasecmp (value, "de") == 0)
- || (l = KBD_LANG_DK, strcasecmp (value, "dk") == 0)
- || (l = KBD_LANG_SE, strcasecmp (value, "se") == 0)
- || (l = KBD_LANG_US, strcasecmp (value, "us") == 0)
- || (l = KBD_LANG_FR, strcasecmp (value, "fr") == 0)
- || (l = KBD_LANG_IT, strcasecmp (value, "it") == 0)
- || (l = KBD_LANG_ES, strcasecmp (value, "es") == 0))
+ if ((l = KBD_LANG_DE, strcasecmp (value, L"de") == 0)
+ || (l = KBD_LANG_DK, strcasecmp (value, L"dk") == 0)
+ || (l = KBD_LANG_SE, strcasecmp (value, L"se") == 0)
+ || (l = KBD_LANG_US, strcasecmp (value, L"us") == 0)
+ || (l = KBD_LANG_FR, strcasecmp (value, L"fr") == 0)
+ || (l = KBD_LANG_IT, strcasecmp (value, L"it") == 0)
+ || (l = KBD_LANG_ES, strcasecmp (value, L"es") == 0))
p->keyboard_lang = l;
else
- write_log ("Unknown keyboard language\n");
+ write_log (L"Unknown keyboard language\n");
return 1;
}
- if (cfgfile_string (option, value, "config_version", tmpbuf, sizeof (tmpbuf))) {
- char *tmpp2;
- tmpp = strchr (value, '.');
+ if (cfgfile_string (option, value, L"config_version", tmpbuf, sizeof (tmpbuf) / sizeof (TCHAR))) {
+ TCHAR *tmpp2;
+ tmpp = _tcschr (value, '.');
if (tmpp) {
*tmpp++ = 0;
tmpp2 = tmpp;
- p->config_version = atol (tmpbuf) << 16;
- tmpp = strchr (tmpp, '.');
+ p->config_version = _tstol (tmpbuf) << 16;
+ tmpp = _tcschr (tmpp, '.');
if (tmpp) {
*tmpp++ = 0;
- p->config_version |= atol (tmpp2) << 8;
- p->config_version |= atol (tmpp);
+ p->config_version |= _tstol (tmpp2) << 8;
+ p->config_version |= _tstol (tmpp);
}
}
return 1;
}
- if (cfgfile_string (option, value, "keyboard_leds", tmpbuf, sizeof (tmpbuf))) {
- char *tmpp2 = tmpbuf;
+ if (cfgfile_string (option, value, L"keyboard_leds", tmpbuf, sizeof (tmpbuf) / sizeof (TCHAR))) {
+ TCHAR *tmpp2 = tmpbuf;
int i, num;
p->keyboard_leds[0] = p->keyboard_leds[1] = p->keyboard_leds[2] = 0;
p->keyboard_leds_in_use = 0;
- strcat (tmpbuf, ",");
+ _tcscat (tmpbuf, L",");
for (i = 0; i < 3; i++) {
- tmpp = strchr (tmpp2, ':');
+ tmpp = _tcschr (tmpp2, ':');
if (!tmpp)
break;
*tmpp++= 0;
num = -1;
- if (!strcasecmp (tmpp2, "numlock"))
+ if (!strcasecmp (tmpp2, L"numlock"))
num = 0;
- if (!strcasecmp (tmpp2, "capslock"))
+ if (!strcasecmp (tmpp2, L"capslock"))
num = 1;
- if (!strcasecmp (tmpp2, "scrolllock"))
+ if (!strcasecmp (tmpp2, L"scrolllock"))
num = 2;
tmpp2 = tmpp;
- tmpp = strchr (tmpp2, ',');
+ tmpp = _tcschr (tmpp2, ',');
if (!tmpp)
break;
*tmpp++= 0;
return 0;
}
-static void decode_rom_ident (char *romfile, int maxlen, char *ident)
+static void decode_rom_ident (TCHAR *romfile, int maxlen, TCHAR *ident)
{
- char *p;
+ TCHAR *p;
int ver, rev, subver, subrev, round, i;
- char model[64], *modelp;
+ TCHAR model[64], *modelp;
struct romlist **rl;
- char *romtxt;
+ TCHAR *romtxt;
if (!ident[0])
return;
- romtxt = (char*)malloc (10000);
+ romtxt = malloc (10000 * sizeof (TCHAR));
romtxt[0] = 0;
for (round = 0; round < 2; round++) {
ver = rev = subver = subrev = -1;
memset (model, 0, sizeof model);
p = ident;
while (*p) {
- char c = *p++;
+ TCHAR c = *p++;
int *pp1 = NULL, *pp2 = NULL;
- if (toupper(c) == 'V' && isdigit(*p)) {
+ if (_totupper(c) == 'V' && _istdigit(*p)) {
pp1 = &ver;
pp2 = &rev;
- } else if (toupper(c) == 'R' && isdigit(*p)) {
+ } else if (_totupper(c) == 'R' && _istdigit(*p)) {
pp1 = &subver;
pp2 = &subrev;
- } else if (!isdigit(c) && c != ' ') {
- strncpy (model, p - 1, (sizeof model) - 1);
- p += strlen(model);
+ } else if (!_istdigit(c) && c != ' ') {
+ _tcsncpy (model, p - 1, (sizeof model) - 1);
+ p += _tcslen (model);
modelp = model;
}
if (pp1) {
- *pp1 = atol(p);
+ *pp1 = _tstol(p);
while (*p != 0 && *p != '.' && *p != ' ')
p++;
if (*p == '.') {
p++;
if (pp2)
- *pp2 = atol(p);
+ *pp2 = _tstol(p);
}
}
if (*p == 0 || *p == ';') {
- rl = getromlistbyident(ver, rev, subver, subrev, modelp, round);
+ rl = getromlistbyident (ver, rev, subver, subrev, modelp, round);
if (rl) {
for (i = 0; rl[i]; i++) {
if (round) {
- char romname[MAX_DPATH];
+ TCHAR romname[MAX_DPATH];
getromname(rl[i]->rd, romname);
- strcat (romtxt, romname);
- strcat (romtxt, "\n");
+ _tcscat (romtxt, romname);
+ _tcscat (romtxt, L"\n");
} else {
- strncpy (romfile, rl[i]->path, maxlen);
+ _tcsncpy (romfile, rl[i]->path, maxlen);
goto end;
}
}
if (round && romtxt[0]) {
notify_user_parms (NUMSG_ROMNEED, romtxt, romtxt);
}
- xfree(romtxt);
+ xfree (romtxt);
}
static struct uaedev_config_info *getuci(struct uae_prefs *p)
}
struct uaedev_config_info *add_filesys_config (struct uae_prefs *p, int index,
- char *devname, char *volname, char *rootdir, int readonly,
+ TCHAR *devname, TCHAR *volname, TCHAR *rootdir, int readonly,
int secspertrack, int surfaces, int reserved,
int blocksize, int bootpri,
- char *filesysdir, int hdc, int flags) {
+ TCHAR *filesysdir, int hdc, int flags) {
struct uaedev_config_info *uci;
int i;
- char *s;
+ TCHAR *s;
if (index < 0) {
uci = getuci(p);
if (!uci)
return 0;
uci->ishdf = volname == NULL ? 1 : 0;
- strcpy (uci->devname, devname ? devname : "");
- strcpy (uci->volname, volname ? volname : "");
- strcpy (uci->rootdir, rootdir ? rootdir : "");
+ _tcscpy (uci->devname, devname ? devname : L"");
+ _tcscpy (uci->volname, volname ? volname : L"");
+ _tcscpy (uci->rootdir, rootdir ? rootdir : L"");
uci->readonly = readonly;
uci->sectors = secspertrack;
uci->surfaces = surfaces;
else if (bootpri >= -127)
uci->autoboot = 1;
uci->controller = hdc;
- strcpy (uci->filesys, filesysdir ? filesysdir : "");
+ _tcscpy (uci->filesys, filesysdir ? filesysdir : L"");
if (!uci->devname[0]) {
- char base[32];
- char base2[32];
+ TCHAR base[32];
+ TCHAR base2[32];
int num = 0;
if (uci->rootdir[0] == 0 && !uci->ishdf)
- strcpy (base, "RDH");
+ _tcscpy (base, L"RDH");
else
- strcpy (base, "DH");
- strcpy (base2, base);
+ _tcscpy (base, L"DH");
+ _tcscpy (base2, base);
for (i = 0; i < p->mountitems; i++) {
- sprintf(base2, "%s%d", base, num);
- if (!strcmp(base2, p->mountconfig[i].devname)) {
+ _stprintf (base2, L"%s%d", base, num);
+ if (!_tcscmp(base2, p->mountconfig[i].devname)) {
num++;
i = -1;
continue;
}
}
- strcpy (uci->devname, base2);
+ _tcscpy (uci->devname, base2);
}
- s = filesys_createvolname (volname, rootdir, "Harddrive");
- strcpy (uci->volname, s);
+ s = filesys_createvolname (volname, rootdir, L"Harddrive");
+ _tcscpy (uci->volname, s);
xfree (s);
return uci;
}
-static void parse_addmem (struct uae_prefs *p, char *buf, int num)
+static void parse_addmem (struct uae_prefs *p, TCHAR *buf, int num)
{
uae_u32 size = 0, addr = 0;
p->custom_memory_sizes[num] = size;
}
-static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *value)
+static int cfgfile_parse_hardware (struct uae_prefs *p, TCHAR *option, TCHAR *value)
{
int tmpval, dummyint, i;
- char *section = 0;
- char tmpbuf[CONFIG_BLEN];
+ TCHAR *section = 0;
+ TCHAR tmpbuf[CONFIG_BLEN];
- if (cfgfile_yesno (option, value, "cpu_cycle_exact", &p->cpu_cycle_exact)
- || cfgfile_yesno (option, value, "blitter_cycle_exact", &p->blitter_cycle_exact)) {
+ if (cfgfile_yesno (option, value, L"cpu_cycle_exact", &p->cpu_cycle_exact)
+ || cfgfile_yesno (option, value, L"blitter_cycle_exact", &p->blitter_cycle_exact)) {
if (p->cpu_model >= 68020 && p->cachesize > 0)
p->cpu_cycle_exact = p->blitter_cycle_exact = 0;
/* we don't want cycle-exact in 68020/40+JIT modes */
return 1;
}
- if (cfgfile_yesno (option, value, "scsi_a3000", &dummyint)) {
+ if (cfgfile_yesno (option, value, L"scsi_a3000", &dummyint)) {
if (dummyint)
p->cs_mbdmac = 1;
return 1;
}
- if (cfgfile_yesno (option, value, "scsi_a4000t", &dummyint)) {
+ if (cfgfile_yesno (option, value, L"scsi_a4000t", &dummyint)) {
if (dummyint)
p->cs_mbdmac = 2;
return 1;
}
- if (cfgfile_yesno (option, value, "immediate_blits", &p->immediate_blits)
- || cfgfile_yesno (option, value, "cd32cd", &p->cs_cd32cd)
- || cfgfile_yesno (option, value, "cd32c2p", &p->cs_cd32c2p)
- || cfgfile_yesno (option, value, "cd32nvram", &p->cs_cd32nvram)
- || cfgfile_yesno (option, value, "cdtvcd", &p->cs_cdtvcd)
- || cfgfile_yesno (option, value, "cdtvram", &p->cs_cdtvram)
- || cfgfile_yesno (option, value, "a1000ram", &p->cs_a1000ram)
- || cfgfile_yesno (option, value, "pcmcia", &p->cs_pcmcia)
- || cfgfile_yesno (option, value, "scsi_cdtv", &p->cs_cdtvscsi)
- || cfgfile_yesno (option, value, "scsi_a4091", &p->cs_a4091)
- || cfgfile_yesno (option, value, "scsi_a2091", &p->cs_a2091)
- || cfgfile_yesno (option, value, "cia_overlay", &p->cs_ciaoverlay)
- || cfgfile_yesno (option, value, "bogomem_fast", &p->cs_slowmemisfast)
- || cfgfile_yesno (option, value, "ksmirror_e0", &p->cs_ksmirror_e0)
- || cfgfile_yesno (option, value, "ksmirror_a8", &p->cs_ksmirror_a8)
- || cfgfile_yesno (option, value, "resetwarning", &p->cs_resetwarning)
- || cfgfile_yesno (option, value, "denise_noehb", &p->cs_denisenoehb)
- || cfgfile_yesno (option, value, "agnus_bltbusybug", &p->cs_agnusbltbusybug)
-
- || cfgfile_yesno (option, value, "kickshifter", &p->kickshifter)
- || cfgfile_yesno (option, value, "ntsc", &p->ntscmode)
- || cfgfile_yesno (option, value, "sana2", &p->sana2)
- || cfgfile_yesno (option, value, "genlock", &p->genlock)
- || cfgfile_yesno (option, value, "cpu_compatible", &p->cpu_compatible)
- || cfgfile_yesno (option, value, "cpu_24bit_addressing", &p->address_space_24)
- || cfgfile_yesno (option, value, "parallel_on_demand", &p->parallel_demand)
- || cfgfile_yesno (option, value, "parallel_postscript_emulation", &p->parallel_postscript_emulation)
- || cfgfile_yesno (option, value, "parallel_postscript_detection", &p->parallel_postscript_detection)
- || cfgfile_yesno (option, value, "serial_on_demand", &p->serial_demand)
- || cfgfile_yesno (option, value, "serial_hardware_ctsrts", &p->serial_hwctsrts)
- || cfgfile_yesno (option, value, "serial_direct", &p->serial_direct)
- || cfgfile_yesno (option, value, "comp_nf", &p->compnf)
- || cfgfile_yesno (option, value, "comp_constjump", &p->comp_constjump)
- || cfgfile_yesno (option, value, "comp_oldsegv", &p->comp_oldsegv)
- || cfgfile_yesno (option, value, "compforcesettings", &dummyint)
- || cfgfile_yesno (option, value, "compfpu", &p->compfpu)
- || cfgfile_yesno (option, value, "fpu_strict", &p->fpu_strict)
- || cfgfile_yesno (option, value, "comp_midopt", &p->comp_midopt)
- || cfgfile_yesno (option, value, "comp_lowopt", &p->comp_lowopt)
- || cfgfile_yesno (option, value, "rtg_nocustom", &p->picasso96_nocustom)
- || cfgfile_yesno (option, value, "uaeserial", &p->uaeserial))
+ if (cfgfile_yesno (option, value, L"immediate_blits", &p->immediate_blits)
+ || cfgfile_yesno (option, value, L"cd32cd", &p->cs_cd32cd)
+ || cfgfile_yesno (option, value, L"cd32c2p", &p->cs_cd32c2p)
+ || cfgfile_yesno (option, value, L"cd32nvram", &p->cs_cd32nvram)
+ || cfgfile_yesno (option, value, L"cdtvcd", &p->cs_cdtvcd)
+ || cfgfile_yesno (option, value, L"cdtvram", &p->cs_cdtvram)
+ || cfgfile_yesno (option, value, L"a1000ram", &p->cs_a1000ram)
+ || cfgfile_yesno (option, value, L"pcmcia", &p->cs_pcmcia)
+ || cfgfile_yesno (option, value, L"scsi_cdtv", &p->cs_cdtvscsi)
+ || cfgfile_yesno (option, value, L"scsi_a4091", &p->cs_a4091)
+ || cfgfile_yesno (option, value, L"scsi_a2091", &p->cs_a2091)
+ || cfgfile_yesno (option, value, L"cia_overlay", &p->cs_ciaoverlay)
+ || cfgfile_yesno (option, value, L"bogomem_fast", &p->cs_slowmemisfast)
+ || cfgfile_yesno (option, value, L"ksmirror_e0", &p->cs_ksmirror_e0)
+ || cfgfile_yesno (option, value, L"ksmirror_a8", &p->cs_ksmirror_a8)
+ || cfgfile_yesno (option, value, L"resetwarning", &p->cs_resetwarning)
+ || cfgfile_yesno (option, value, L"denise_noehb", &p->cs_denisenoehb)
+ || cfgfile_yesno (option, value, L"agnus_bltbusybug", &p->cs_agnusbltbusybug)
+
+ || cfgfile_yesno (option, value, L"kickshifter", &p->kickshifter)
+ || cfgfile_yesno (option, value, L"ntsc", &p->ntscmode)
+ || cfgfile_yesno (option, value, L"sana2", &p->sana2)
+ || cfgfile_yesno (option, value, L"genlock", &p->genlock)
+ || cfgfile_yesno (option, value, L"cpu_compatible", &p->cpu_compatible)
+ || cfgfile_yesno (option, value, L"cpu_24bit_addressing", &p->address_space_24)
+ || cfgfile_yesno (option, value, L"parallel_on_demand", &p->parallel_demand)
+ || cfgfile_yesno (option, value, L"parallel_postscript_emulation", &p->parallel_postscript_emulation)
+ || cfgfile_yesno (option, value, L"parallel_postscript_detection", &p->parallel_postscript_detection)
+ || cfgfile_yesno (option, value, L"serial_on_demand", &p->serial_demand)
+ || cfgfile_yesno (option, value, L"serial_hardware_ctsrts", &p->serial_hwctsrts)
+ || cfgfile_yesno (option, value, L"serial_direct", &p->serial_direct)
+ || cfgfile_yesno (option, value, L"comp_nf", &p->compnf)
+ || cfgfile_yesno (option, value, L"comp_constjump", &p->comp_constjump)
+ || cfgfile_yesno (option, value, L"comp_oldsegv", &p->comp_oldsegv)
+ || cfgfile_yesno (option, value, L"compforcesettings", &dummyint)
+ || cfgfile_yesno (option, value, L"compfpu", &p->compfpu)
+ || cfgfile_yesno (option, value, L"fpu_strict", &p->fpu_strict)
+ || cfgfile_yesno (option, value, L"comp_midopt", &p->comp_midopt)
+ || cfgfile_yesno (option, value, L"comp_lowopt", &p->comp_lowopt)
+ || cfgfile_yesno (option, value, L"rtg_nocustom", &p->picasso96_nocustom)
+ || cfgfile_yesno (option, value, L"uaeserial", &p->uaeserial))
return 1;
- if (cfgfile_intval (option, value, "cachesize", &p->cachesize, 1)
- || cfgfile_intval (option, value, "cpu060_revision", &p->cpu060_revision, 1)
- || cfgfile_intval (option, value, "fpu_revision", &p->fpu_revision, 1)
- || cfgfile_intval (option, value, "cdtvramcard", &p->cs_cdtvcard, 1)
- || cfgfile_intval (option, value, "fatgary", &p->cs_fatgaryrev, 1)
- || cfgfile_intval (option, value, "ramsey", &p->cs_ramseyrev, 1)
- || cfgfile_intval (option, value, "chipset_refreshrate", &p->chipset_refreshrate, 1)
- || cfgfile_intval (option, value, "fastmem_size", &p->fastmem_size, 0x100000)
- || cfgfile_intval (option, value, "a3000mem_size", &p->mbresmem_low_size, 0x100000)
- || cfgfile_intval (option, value, "mbresmem_size", &p->mbresmem_high_size, 0x100000)
- || cfgfile_intval (option, value, "z3mem_size", &p->z3fastmem_size, 0x100000)
- || cfgfile_intval (option, value, "z3mem2_size", &p->z3fastmem2_size, 0x100000)
- || cfgfile_intval (option, value, "z3mem_start", &p->z3fastmem_start, 1)
- || cfgfile_intval (option, value, "bogomem_size", &p->bogomem_size, 0x40000)
- || cfgfile_intval (option, value, "gfxcard_size", &p->gfxmem_size, 0x100000)
- || cfgfile_intval (option, value, "rtg_modes", &p->picasso96_modeflags, 1)
- || cfgfile_intval (option, value, "floppy_speed", &p->floppy_speed, 1)
- || cfgfile_intval (option, value, "floppy_write_length", &p->floppy_write_length, 1)
- || cfgfile_intval (option, value, "nr_floppies", &p->nr_floppies, 1)
- || cfgfile_intval (option, value, "floppy0type", &p->dfxtype[0], 1)
- || cfgfile_intval (option, value, "floppy1type", &p->dfxtype[1], 1)
- || cfgfile_intval (option, value, "floppy2type", &p->dfxtype[2], 1)
- || cfgfile_intval (option, value, "floppy3type", &p->dfxtype[3], 1)
- || cfgfile_intval (option, value, "maprom", &p->maprom, 1)
- || cfgfile_intval (option, value, "parallel_autoflush", &p->parallel_autoflush_time, 1)
- || cfgfile_intval (option, value, "uae_hide", &p->uae_hide, 1)
- || cfgfile_intval (option, value, "catweasel", &p->catweasel, 1))
+ if (cfgfile_intval (option, value, L"cachesize", &p->cachesize, 1)
+ || cfgfile_intval (option, value, L"cpu060_revision", &p->cpu060_revision, 1)
+ || cfgfile_intval (option, value, L"fpu_revision", &p->fpu_revision, 1)
+ || cfgfile_intval (option, value, L"cdtvramcard", &p->cs_cdtvcard, 1)
+ || cfgfile_intval (option, value, L"fatgary", &p->cs_fatgaryrev, 1)
+ || cfgfile_intval (option, value, L"ramsey", &p->cs_ramseyrev, 1)
+ || cfgfile_intval (option, value, L"chipset_refreshrate", &p->chipset_refreshrate, 1)
+ || cfgfile_intval (option, value, L"fastmem_size", &p->fastmem_size, 0x100000)
+ || cfgfile_intval (option, value, L"a3000mem_size", &p->mbresmem_low_size, 0x100000)
+ || cfgfile_intval (option, value, L"mbresmem_size", &p->mbresmem_high_size, 0x100000)
+ || cfgfile_intval (option, value, L"z3mem_size", &p->z3fastmem_size, 0x100000)
+ || cfgfile_intval (option, value, L"z3mem2_size", &p->z3fastmem2_size, 0x100000)
+ || cfgfile_intval (option, value, L"z3mem_start", &p->z3fastmem_start, 1)
+ || cfgfile_intval (option, value, L"bogomem_size", &p->bogomem_size, 0x40000)
+ || cfgfile_intval (option, value, L"gfxcard_size", &p->gfxmem_size, 0x100000)
+ || cfgfile_intval (option, value, L"rtg_modes", &p->picasso96_modeflags, 1)
+ || cfgfile_intval (option, value, L"floppy_speed", &p->floppy_speed, 1)
+ || cfgfile_intval (option, value, L"floppy_write_length", &p->floppy_write_length, 1)
+ || cfgfile_intval (option, value, L"nr_floppies", &p->nr_floppies, 1)
+ || cfgfile_intval (option, value, L"floppy0type", &p->dfxtype[0], 1)
+ || cfgfile_intval (option, value, L"floppy1type", &p->dfxtype[1], 1)
+ || cfgfile_intval (option, value, L"floppy2type", &p->dfxtype[2], 1)
+ || cfgfile_intval (option, value, L"floppy3type", &p->dfxtype[3], 1)
+ || cfgfile_intval (option, value, L"maprom", &p->maprom, 1)
+ || cfgfile_intval (option, value, L"parallel_autoflush", &p->parallel_autoflush_time, 1)
+ || cfgfile_intval (option, value, L"uae_hide", &p->uae_hide, 1)
+ || cfgfile_intval (option, value, L"catweasel", &p->catweasel, 1))
return 1;
- if (cfgfile_strval (option, value, "comp_trustbyte", &p->comptrustbyte, compmode, 0)
- || cfgfile_strval (option, value, "chipset_compatible", &p->cs_compatible, cscompa, 0)
- || cfgfile_strval (option, value, "rtc", &p->cs_rtc, rtctype, 0)
- || cfgfile_strval (option, value, "ksmirror", &p->cs_ksmirror_e0, ksmirrortype, 0)
- || cfgfile_strval (option, value, "ciaatod", &p->cs_ciaatod, ciaatodmode, 0)
- || cfgfile_strval (option, value, "ide", &p->cs_ide, idemode, 0)
- || cfgfile_strval (option, value, "scsi", &p->scsi, scsimode, 0)
- || cfgfile_strval (option, value, "comp_trustword", &p->comptrustword, compmode, 0)
- || cfgfile_strval (option, value, "comp_trustlong", &p->comptrustlong, compmode, 0)
- || cfgfile_strval (option, value, "comp_trustnaddr", &p->comptrustnaddr, compmode, 0)
- || cfgfile_strval (option, value, "collision_level", &p->collision_level, collmode, 0)
- || cfgfile_strval (option, value, "comp_flushmode", &p->comp_hardflush, flushmode, 0))
+ if (cfgfile_strval (option, value, L"comp_trustbyte", &p->comptrustbyte, compmode, 0)
+ || cfgfile_strval (option, value, L"chipset_compatible", &p->cs_compatible, cscompa, 0)
+ || cfgfile_strval (option, value, L"rtc", &p->cs_rtc, rtctype, 0)
+ || cfgfile_strval (option, value, L"ksmirror", &p->cs_ksmirror_e0, ksmirrortype, 0)
+ || cfgfile_strval (option, value, L"ciaatod", &p->cs_ciaatod, ciaatodmode, 0)
+ || cfgfile_strval (option, value, L"ide", &p->cs_ide, idemode, 0)
+ || cfgfile_strval (option, value, L"scsi", &p->scsi, scsimode, 0)
+ || cfgfile_strval (option, value, L"comp_trustword", &p->comptrustword, compmode, 0)
+ || cfgfile_strval (option, value, L"comp_trustlong", &p->comptrustlong, compmode, 0)
+ || cfgfile_strval (option, value, L"comp_trustnaddr", &p->comptrustnaddr, compmode, 0)
+ || cfgfile_strval (option, value, L"collision_level", &p->collision_level, collmode, 0)
+ || cfgfile_strval (option, value, L"comp_flushmode", &p->comp_hardflush, flushmode, 0))
return 1;
- if (cfgfile_string (option, value, "kickstart_rom_file", p->romfile, sizeof p->romfile)
- || cfgfile_string (option, value, "kickstart_ext_rom_file", p->romextfile, sizeof p->romextfile)
- || cfgfile_string (option, value, "amax_rom_file", p->amaxromfile, sizeof p->amaxromfile)
- || cfgfile_string (option, value, "flash_file", p->flashfile, sizeof p->flashfile)
- || cfgfile_string (option, value, "cart_file", p->cartfile, sizeof p->cartfile)
- || cfgfile_string (option, value, "pci_devices", p->pci_devices, sizeof p->pci_devices)
- || cfgfile_string (option, value, "ghostscript_parameters", p->ghostscript_parameters, sizeof p->ghostscript_parameters))
+ if (cfgfile_string (option, value, L"kickstart_rom_file", p->romfile, sizeof p->romfile / sizeof (TCHAR))
+ || cfgfile_string (option, value, L"kickstart_ext_rom_file", p->romextfile, sizeof p->romextfile / sizeof (TCHAR))
+ || cfgfile_string (option, value, L"amax_rom_file", p->amaxromfile, sizeof p->amaxromfile / sizeof (TCHAR))
+ || cfgfile_string (option, value, L"flash_file", p->flashfile, sizeof p->flashfile / sizeof (TCHAR))
+ || cfgfile_string (option, value, L"cart_file", p->cartfile, sizeof p->cartfile / sizeof (TCHAR))
+ || cfgfile_string (option, value, L"pci_devices", p->pci_devices, sizeof p->pci_devices / sizeof (TCHAR))
+ || cfgfile_string (option, value, L"ghostscript_parameters", p->ghostscript_parameters, sizeof p->ghostscript_parameters / sizeof (TCHAR)))
return 1;
- if (cfgfile_strval (option, value, "cart_internal", &p->cart_internal, cartsmode, 0)) {
+ if (cfgfile_strval (option, value, L"cart_internal", &p->cart_internal, cartsmode, 0)) {
if (p->cart_internal) {
- struct romdata *rd = getromdatabyid(63);
+ struct romdata *rd = getromdatabyid (63);
if (rd)
- sprintf(p->cartfile, ":%s", rd->configname);
+ _stprintf (p->cartfile, L":%s", rd->configname);
}
return 1;
}
- if (cfgfile_string (option, value, "kickstart_rom", p->romident, sizeof p->romident)) {
- decode_rom_ident (p->romfile, sizeof p->romfile, p->romident);
+ if (cfgfile_string (option, value, L"kickstart_rom", p->romident, sizeof p->romident / sizeof (TCHAR))) {
+ decode_rom_ident (p->romfile, sizeof p->romfile / sizeof (TCHAR), p->romident);
return 1;
}
- if (cfgfile_string (option, value, "kickstart_ext_rom", p->romextident, sizeof p->romextident)) {
- decode_rom_ident (p->romextfile, sizeof p->romextfile, p->romextident);
+ if (cfgfile_string (option, value, L"kickstart_ext_rom", p->romextident, sizeof p->romextident / sizeof (TCHAR))) {
+ decode_rom_ident (p->romextfile, sizeof p->romextfile / sizeof (TCHAR), p->romextident);
return 1;
}
- if (cfgfile_string (option, value, "cart", p->cartident, sizeof p->cartident)) {
- decode_rom_ident (p->cartfile, sizeof p->cartfile, p->cartident);
+ if (cfgfile_string (option, value, L"cart", p->cartident, sizeof p->cartident / sizeof (TCHAR))) {
+ decode_rom_ident (p->cartfile, sizeof p->cartfile / sizeof (TCHAR), p->cartident);
return 1;
}
for (i = 0; i < 4; i++) {
- sprintf (tmpbuf, "floppy%d", i);
- if (cfgfile_string (option, value, tmpbuf, p->df[i], sizeof p->df[i]))
+ _stprintf (tmpbuf, L"floppy%d", i);
+ if (cfgfile_string (option, value, tmpbuf, p->df[i], sizeof p->df[i] / sizeof (TCHAR)))
return 1;
}
- if (cfgfile_intval (option, value, "chipmem_size", &dummyint, 1)) {
+ if (cfgfile_intval (option, value, L"chipmem_size", &dummyint, 1)) {
if (dummyint < 0)
p->chipmem_size = 0x20000; /* 128k, prototype support */
else if (dummyint == 0)
return 1;
}
- if (cfgfile_string (option, value, "addmem1", tmpbuf, sizeof tmpbuf)) {
+ if (cfgfile_string (option, value, L"addmem1", tmpbuf, sizeof tmpbuf / sizeof (TCHAR))) {
parse_addmem (p, tmpbuf, 0);
return 1;
}
- if (cfgfile_string (option, value, "addmem2", tmpbuf, sizeof tmpbuf)) {
+ if (cfgfile_string (option, value, L"addmem2", tmpbuf, sizeof tmpbuf / sizeof (TCHAR))) {
parse_addmem (p, tmpbuf, 1);
return 1;
}
- if (cfgfile_strval (option, value, "chipset", &tmpval, csmode, 0)) {
+ if (cfgfile_strval (option, value, L"chipset", &tmpval, csmode, 0)) {
set_chipset_mask (p, tmpval);
return 1;
}
- if (cfgfile_string (option, value, "fpu_model", tmpbuf, sizeof tmpbuf)) {
- p->fpu_model = atol(tmpbuf);
+ if (cfgfile_string (option, value, L"fpu_model", tmpbuf, sizeof tmpbuf / sizeof (TCHAR))) {
+ p->fpu_model = _tstol(tmpbuf);
return 1;
}
- if (cfgfile_string (option, value, "cpu_model", tmpbuf, sizeof tmpbuf)) {
- p->cpu_model = atol(tmpbuf);
+ if (cfgfile_string (option, value, L"cpu_model", tmpbuf, sizeof tmpbuf / sizeof (TCHAR))) {
+ p->cpu_model = _tstol(tmpbuf);
p->fpu_model = 0;
return 1;
}
/* old-style CPU configuration */
- if (cfgfile_string (option, value, "cpu_type", tmpbuf, sizeof tmpbuf)) {
+ if (cfgfile_string (option, value, L"cpu_type", tmpbuf, sizeof tmpbuf / sizeof (TCHAR))) {
p->fpu_model = 0;
p->address_space_24 = 0;
p->cpu_model = 680000;
- if (!strcmp(tmpbuf, "68000")) {
+ if (!_tcscmp (tmpbuf, L"68000")) {
p->cpu_model = 68000;
- } else if (!strcmp(tmpbuf, "68010")) {
+ } else if (!_tcscmp (tmpbuf, L"68010")) {
p->cpu_model = 68010;
- } else if (!strcmp(tmpbuf, "68ec020")) {
+ } else if (!_tcscmp (tmpbuf, L"68ec020")) {
p->cpu_model = 68020;
p->address_space_24 = 1;
- } else if (!strcmp(tmpbuf, "68020")) {
+ } else if (!_tcscmp (tmpbuf, L"68020")) {
p->cpu_model = 68020;
- } else if (!strcmp(tmpbuf, "68ec020/68881")) {
+ } else if (!_tcscmp (tmpbuf, L"68ec020/68881")) {
p->cpu_model = 68020;
p->fpu_model = 68881;
p->address_space_24 = 1;
- } else if (!strcmp(tmpbuf, "68020/68881")) {
+ } else if (!_tcscmp (tmpbuf, L"68020/68881")) {
p->cpu_model = 68020;
p->fpu_model = 68881;
- } else if (!strcmp(tmpbuf, "68040")) {
+ } else if (!_tcscmp (tmpbuf, L"68040")) {
p->cpu_model = 68040;
p->fpu_model = 68040;
- } else if (!strcmp(tmpbuf, "68060")) {
+ } else if (!_tcscmp (tmpbuf, L"68060")) {
p->cpu_model = 68060;
p->fpu_model = 68060;
}
}
if (p->config_version < (21 << 16)) {
- if (cfgfile_strval (option, value, "cpu_speed", &p->m68k_speed, speedmode, 1)
+ if (cfgfile_strval (option, value, L"cpu_speed", &p->m68k_speed, speedmode, 1)
/* Broken earlier versions used to write this out as a string. */
- || cfgfile_strval (option, value, "finegraincpu_speed", &p->m68k_speed, speedmode, 1))
+ || cfgfile_strval (option, value, L"finegraincpu_speed", &p->m68k_speed, speedmode, 1))
{
p->m68k_speed--;
return 1;
}
}
- if (cfgfile_intval (option, value, "cpu_speed", &p->m68k_speed, 1)) {
+ if (cfgfile_intval (option, value, L"cpu_speed", &p->m68k_speed, 1)) {
p->m68k_speed *= CYCLE_UNIT;
return 1;
}
- if (cfgfile_intval (option, value, "finegrain_cpu_speed", &p->m68k_speed, 1)) {
+ if (cfgfile_intval (option, value, L"finegrain_cpu_speed", &p->m68k_speed, 1)) {
if (OFFICIAL_CYCLE_UNIT > CYCLE_UNIT) {
int factor = OFFICIAL_CYCLE_UNIT / CYCLE_UNIT;
p->m68k_speed = (p->m68k_speed + factor - 1) / factor;
}
- if (strcasecmp (value, "max") == 0)
+ if (strcasecmp (value, L"max") == 0)
p->m68k_speed = -1;
return 1;
}
for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
- char tmp[100];
- sprintf (tmp, "uaehf%d", i);
- if (strcmp (option, tmp) == 0)
+ TCHAR tmp[100];
+ _stprintf (tmp, L"uaehf%d", i);
+ if (_tcscmp (option, tmp) == 0)
return 1;
}
- if (strcmp (option, "filesystem") == 0
- || strcmp (option, "hardfile") == 0)
+ if (_tcscmp (option, L"filesystem") == 0
+ || _tcscmp (option, L"hardfile") == 0)
{
int secs, heads, reserved, bs, ro;
- char *aname, *root;
- char *tmpp = strchr (value, ',');
- char *str;
+ TCHAR *aname, *root;
+ TCHAR *tmpp = _tcschr (value, ',');
+ TCHAR *str;
if (config_newfilesystem)
return 1;
goto invalid_fs;
*tmpp++ = '\0';
- if (strcmp (value, "1") == 0 || strcasecmp (value, "ro") == 0
- || strcasecmp (value, "readonly") == 0
- || strcasecmp (value, "read-only") == 0)
+ if (_tcscmp (value, L"1") == 0 || strcasecmp (value, L"ro") == 0
+ || strcasecmp (value, L"readonly") == 0
+ || strcasecmp (value, L"read-only") == 0)
ro = 1;
- else if (strcmp (value, "0") == 0 || strcasecmp (value, "rw") == 0
- || strcasecmp (value, "readwrite") == 0
- || strcasecmp (value, "read-write") == 0)
+ else if (_tcscmp (value, L"0") == 0 || strcasecmp (value, L"rw") == 0
+ || strcasecmp (value, L"readwrite") == 0
+ || strcasecmp (value, L"read-write") == 0)
ro = 0;
else
goto invalid_fs;
secs = 0; heads = 0; reserved = 0; bs = 0;
value = tmpp;
- if (strcmp (option, "filesystem") == 0) {
- tmpp = strchr (value, ':');
+ if (_tcscmp (option, L"filesystem") == 0) {
+ tmpp = _tcschr (value, ':');
if (tmpp == 0)
goto invalid_fs;
*tmpp++ = '\0';
}
- if (strcmp (option, "filesystem2") == 0
- || strcmp (option, "hardfile2") == 0)
+ if (_tcscmp (option, L"filesystem2") == 0
+ || _tcscmp (option, L"hardfile2") == 0)
{
int secs, heads, reserved, bs, ro, bp, hdcv;
- char *dname = NULL, *aname = "", *root = NULL, *fs = NULL, *hdc;
- char *tmpp = strchr (value, ',');
- char *str = NULL;
+ TCHAR *dname = NULL, *aname = L"", *root = NULL, *fs = NULL, *hdc;
+ TCHAR *tmpp = _tcschr (value, ',');
+ TCHAR *str = NULL;
config_newfilesystem = 1;
if (tmpp == 0)
goto invalid_fs;
*tmpp++ = '\0';
- if (strcasecmp (value, "ro") == 0)
+ if (strcasecmp (value, L"ro") == 0)
ro = 1;
- else if (strcasecmp (value, "rw") == 0)
+ else if (strcasecmp (value, L"rw") == 0)
ro = 0;
else
goto invalid_fs;
fs = 0; hdc = 0; hdcv = 0;
value = tmpp;
- if (strcmp (option, "filesystem2") == 0) {
- tmpp = strchr (value, ':');
+ if (_tcscmp (option, L"filesystem2") == 0) {
+ tmpp = _tcschr (value, ':');
if (tmpp == 0)
goto empty_fs;
*tmpp++ = 0;
dname = value;
aname = tmpp;
- tmpp = strchr (tmpp, ':');
+ tmpp = _tcschr (tmpp, ':');
if (tmpp == 0)
goto empty_fs;
*tmpp++ = 0;
root = tmpp;
- tmpp = strchr (tmpp, ',');
+ tmpp = _tcschr (tmpp, ',');
if (tmpp == 0)
goto empty_fs;
*tmpp++ = 0;
if (! getintval (&tmpp, &bp, 0))
goto empty_fs;
} else {
- tmpp = strchr (value, ':');
+ tmpp = _tcschr (value, ':');
if (tmpp == 0)
goto invalid_fs;
*tmpp++ = '\0';
dname = value;
root = tmpp;
- tmpp = strchr (tmpp, ',');
+ tmpp = _tcschr (tmpp, ',');
if (tmpp == 0)
goto invalid_fs;
*tmpp++ = 0;
goto invalid_fs;
if (getintval2 (&tmpp, &bp, ',')) {
fs = tmpp;
- tmpp = strchr (tmpp, ',');
+ tmpp = _tcschr (tmpp, ',');
if (tmpp != 0) {
*tmpp++ = 0;
hdc = tmpp;
- if(strlen (hdc) >= 4 && !memcmp( hdc, "ide", 3)) {
+ if(_tcslen (hdc) >= 4 && !_tcsncmp (hdc, L"ide", 3)) {
hdcv = hdc[3] - '0' + HD_CONTROLLER_IDE0;
if (hdcv < HD_CONTROLLER_IDE0 || hdcv > HD_CONTROLLER_IDE3)
hdcv = 0;
}
- if(strlen (hdc) >= 5 && !memcmp (hdc, "scsi", 4)) {
+ if(_tcslen (hdc) >= 5 && !_tcsncmp (hdc, L"scsi", 4)) {
hdcv = hdc[4] - '0' + HD_CONTROLLER_SCSI0;
if (hdcv < HD_CONTROLLER_SCSI0 || hdcv > HD_CONTROLLER_SCSI6)
hdcv = 0;
}
- if (strlen (hdc) >= 6 && !memcmp (hdc, "scsram", 6))
+ if (_tcslen (hdc) >= 6 && !_tcsncmp (hdc, L"scsram", 6))
hdcv = HD_CONTROLLER_PCMCIA_SRAM;
}
}
return 1;
invalid_fs:
- write_log ("Invalid filesystem/hardfile specification.\n");
+ write_log (L"Invalid filesystem/hardfile specification.\n");
return 1;
}
return 0;
}
-int cfgfile_parse_option (struct uae_prefs *p, char *option, char *value, int type)
+int cfgfile_parse_option (struct uae_prefs *p, TCHAR *option, TCHAR *value, int type)
{
- if (!strcmp (option, "config_hardware"))
+ if (!_tcscmp (option, L"config_hardware"))
return 1;
- if (!strcmp (option, "config_host"))
+ if (!_tcscmp (option, L"config_host"))
return 1;
- if (cfgfile_string (option, value, "config_hardware_path", p->config_hardware_path, sizeof p->config_hardware_path))
+ if (cfgfile_string (option, value, L"config_hardware_path", p->config_hardware_path, sizeof p->config_hardware_path / sizeof (TCHAR)))
return 1;
- if (cfgfile_string (option, value, "config_host_path", p->config_host_path, sizeof p->config_host_path))
+ if (cfgfile_string (option, value, L"config_host_path", p->config_host_path, sizeof p->config_host_path / sizeof (TCHAR)))
return 1;
if (type == 0 || (type & CONFIG_TYPE_HARDWARE)) {
if (cfgfile_parse_hardware (p, option, value))
return 0;
}
-static int cfgfile_separate_line (char *line, char *line1b, char *line2b)
+static int cfgfile_separate_line (TCHAR *line, TCHAR *line1b, TCHAR *line2b)
{
- char *line1, *line2;
+ TCHAR *line1, *line2;
int i;
line1 = line;
- line2 = strchr (line, '=');
+ line2 = _tcschr (line, '=');
if (! line2) {
- write_log ("CFGFILE: line was incomplete with only %s\n", line1);
+ write_log (L"CFGFILE: line was incomplete with only %s\n", line1);
return 0;
}
*line2++ = '\0';
- strcpy (line1b, line1);
- strcpy (line2b, line2);
+ _tcscpy (line1b, line1);
+ _tcscpy (line2b, line2);
/* Get rid of whitespace. */
- i = strlen (line2);
+ i = _tcslen (line2);
while (i > 0 && (line2[i - 1] == '\t' || line2[i - 1] == ' '
|| line2[i - 1] == '\r' || line2[i - 1] == '\n'))
line2[--i] = '\0';
- line2 += strspn (line2, "\t \r\n");
- strcpy (line2b, line2);
- i = strlen (line);
+ line2 += _tcsspn (line2, L"\t \r\n");
+ _tcscpy (line2b, line2);
+ i = _tcslen (line);
while (i > 0 && (line[i - 1] == '\t' || line[i - 1] == ' '
|| line[i - 1] == '\r' || line[i - 1] == '\n'))
line[--i] = '\0';
- line += strspn (line, "\t \r\n");
- strcpy (line1b, line);
+ line += _tcsspn (line, L"\t \r\n");
+ _tcscpy (line1b, line);
return 1;
}
-static int isobsolete (char *s)
+static int isobsolete (TCHAR *s)
{
int i = 0;
while (obsolete[i]) {
if (!strcasecmp (s, obsolete[i])) {
- write_log ("obsolete config entry '%s'\n", s);
+ write_log (L"obsolete config entry '%s'\n", s);
return 1;
}
i++;
}
- if (strlen (s) >= 10 && !memcmp (s, "gfx_opengl", 10)) {
- write_log ("obsolete config entry '%s\n", s);
+ if (_tcslen (s) >= 10 && !_tcsncmp (s, L"gfx_opengl", 10)) {
+ write_log (L"obsolete config entry '%s\n", s);
return 1;
}
- if (strlen (s) >= 6 && !memcmp (s, "gfx_3d", 6)) {
- write_log ("obsolete config entry '%s\n", s);
+ if (_tcslen (s) >= 6 && !_tcsncmp (s, L"gfx_3d", 6)) {
+ write_log (L"obsolete config entry '%s\n", s);
return 1;
}
return 0;
}
-static void cfgfile_parse_separated_line (struct uae_prefs *p, char *line1b, char *line2b, int type)
+static void cfgfile_parse_separated_line (struct uae_prefs *p, TCHAR *line1b, TCHAR *line2b, int type)
{
- char line3b[CONFIG_BLEN], line4b[CONFIG_BLEN];
+ TCHAR line3b[CONFIG_BLEN], line4b[CONFIG_BLEN];
struct strlist *sl;
int ret;
- strcpy (line3b, line1b);
- strcpy (line4b, line2b);
+ _tcscpy (line3b, line1b);
+ _tcscpy (line4b, line2b);
ret = cfgfile_parse_option (p, line1b, line2b, type);
if (!isobsolete (line3b)) {
for (sl = p->all_lines; sl; sl = sl->next) {
}
if (!sl) {
struct strlist *u = xcalloc (sizeof (struct strlist), 1);
- u->option = my_strdup(line3b);
- u->value = my_strdup(line4b);
+ u->option = my_strdup (line3b);
+ u->value = my_strdup (line4b);
u->next = p->all_lines;
p->all_lines = u;
if (!ret) {
u->unknown = 1;
- write_log ("unknown config entry: '%s=%s'\n", u->option, u->value);
+ write_log (L"unknown config entry: '%s=%s'\n", u->option, u->value);
}
}
}
}
-void cfgfile_parse_line (struct uae_prefs *p, char *line, int type)
+void cfgfile_parse_line (struct uae_prefs *p, TCHAR *line, int type)
{
- char line1b[CONFIG_BLEN], line2b[CONFIG_BLEN];
+ TCHAR line1b[CONFIG_BLEN], line2b[CONFIG_BLEN];
if (!cfgfile_separate_line (line, line1b, line2b))
return;
cfgfile_parse_separated_line (p, line1b, line2b, type);
}
-static void subst (char *p, char *f, int n)
+static void subst (TCHAR *p, TCHAR *f, int n)
{
- char *str = cfgfile_subst_path (UNEXPANDED, p, f);
- strncpy (f, str, n - 1);
+ TCHAR *str = cfgfile_subst_path (UNEXPANDED, p, f);
+ _tcsncpy (f, str, n - 1);
f[n - 1] = '\0';
free (str);
}
-static char *cfg_fgets (char *line, int max, struct zfile *fh)
+static TCHAR *cfg_fgets (TCHAR *line, int max, struct zfile *fh)
{
#ifdef SINGLEFILE
- extern char singlefile_config[];
- static char *sfile_ptr;
- char *p;
+ extern TCHAR singlefile_config[];
+ static TCHAR *sfile_ptr;
+ TCHAR *p;
#endif
if (fh)
if (sfile_ptr == 0) {
sfile_ptr = singlefile_config;
if (*sfile_ptr) {
- write_log ("singlefile config found\n");
+ write_log (L"singlefile config found\n");
while (*sfile_ptr++);
}
}
p = sfile_ptr;
while (*p != 13 && *p != 10 && *p != 0) p++;
memset (line, 0, max);
- memcpy (line, sfile_ptr, p - sfile_ptr);
+ memcpy (line, sfile_ptr, (p - sfile_ptr) * sizeof (TCHAR));
sfile_ptr = p + 1;
if (*sfile_ptr == 13)
sfile_ptr++;
return 0;
}
-static int cfgfile_load_2 (struct uae_prefs *p, const char *filename, int real, int *type)
+static int cfgfile_load_2 (struct uae_prefs *p, const TCHAR *filename, int real, int *type)
{
int i;
struct zfile *fh;
- char line[CONFIG_BLEN], line1b[CONFIG_BLEN], line2b[CONFIG_BLEN];
+ TCHAR line[CONFIG_BLEN], line1b[CONFIG_BLEN], line2b[CONFIG_BLEN];
struct strlist *sl;
int type1 = 0, type2 = 0, askedtype = 0;
reset_inputdevice_config (p);
}
- fh = zfile_fopen (filename, "r");
+ fh = zfile_fopen (filename, L"r");
#ifndef SINGLEFILE
if (! fh)
return 0;
#endif
- while (cfg_fgets (line, sizeof (line), fh) != 0) {
+ while (cfg_fgets (line, sizeof (line) / sizeof (TCHAR), fh) != 0) {
trimws (line);
- if (strlen (line) > 0) {
+ if (_tcslen (line) > 0) {
if (line[0] == '#' || line[0] == ';')
continue;
if (!cfgfile_separate_line (line, line1b, line2b))
continue;
type1 = type2 = 0;
- if (cfgfile_yesno (line1b, line2b, "config_hardware", &type1) ||
- cfgfile_yesno (line1b, line2b, "config_host", &type2)) {
+ if (cfgfile_yesno (line1b, line2b, L"config_hardware", &type1) ||
+ cfgfile_yesno (line1b, line2b, L"config_host", &type2)) {
if (type1 && type)
*type |= CONFIG_TYPE_HARDWARE;
if (type2 && type)
if (real) {
cfgfile_parse_separated_line (p, line1b, line2b, askedtype);
} else {
- cfgfile_string (line1b, line2b, "config_description", p->description, sizeof p->description);
- cfgfile_string (line1b, line2b, "config_hardware_path", p->config_hardware_path, sizeof p->config_hardware_path);
- cfgfile_string (line1b, line2b, "config_host_path", p->config_host_path, sizeof p->config_host_path);
+ cfgfile_string (line1b, line2b, L"config_description", p->description, sizeof p->description / sizeof (TCHAR));
+ cfgfile_string (line1b, line2b, L"config_hardware_path", p->config_hardware_path, sizeof p->config_hardware_path / sizeof (TCHAR));
+ cfgfile_string (line1b, line2b, L"config_host_path", p->config_host_path, sizeof p->config_host_path / sizeof (TCHAR));
}
}
}
return 1;
for (sl = temp_lines; sl; sl = sl->next) {
- sprintf (line, "%s=%s", sl->option, sl->value);
+ _stprintf (line, L"%s=%s", sl->option, sl->value);
cfgfile_parse_line (p, line, 0);
}
for (i = 0; i < 4; i++)
subst (p->path_floppy, p->df[i], sizeof p->df[i]);
- subst (p->path_rom, p->romfile, sizeof p->romfile);
- subst (p->path_rom, p->romextfile, sizeof p->romextfile);
+ subst (p->path_rom, p->romfile, sizeof p->romfile / sizeof (TCHAR));
+ subst (p->path_rom, p->romextfile, sizeof p->romextfile / sizeof (TCHAR));
return 1;
}
-int cfgfile_load (struct uae_prefs *p, const char *filename, int *type, int ignorelink)
+int cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink)
{
int v;
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
int type2;
static int recursive;
if (recursive > 1)
return 0;
recursive++;
- write_log ("load config '%s':%d\n", filename, type ? *type : -1);
+ write_log (L"load config '%s':%d\n", filename, type ? *type : -1);
v = cfgfile_load_2 (p, filename, 1, type);
if (!v) {
- write_log ("load failed\n");
+ write_log (L"load failed\n");
goto end;
}
if (!ignorelink) {
if (p->config_hardware_path[0]) {
- fetch_configurationpath (tmp, sizeof (tmp));
- strncat (tmp, p->config_hardware_path, sizeof (tmp));
+ fetch_configurationpath (tmp, sizeof (tmp) / sizeof (TCHAR));
+ _tcsncat (tmp, p->config_hardware_path, sizeof (tmp) / sizeof (TCHAR));
type2 = CONFIG_TYPE_HARDWARE;
cfgfile_load (p, tmp, &type2, 1);
}
if (p->config_host_path[0]) {
- fetch_configurationpath (tmp, sizeof (tmp));
- strncat (tmp, p->config_host_path, sizeof (tmp));
+ fetch_configurationpath (tmp, sizeof (tmp) / sizeof (TCHAR));
+ _tcsncat (tmp, p->config_host_path, sizeof (tmp) / sizeof (TCHAR));
type2 = CONFIG_TYPE_HOST;
cfgfile_load (p, tmp, &type2, 1);
}
return v;
}
-void cfgfile_backup (const char *path)
+void cfgfile_backup (const TCHAR *path)
{
- char dpath[MAX_DPATH];
+ TCHAR dpath[MAX_DPATH];
- fetch_configurationpath (dpath, sizeof (dpath));
- strcat (dpath, "configuration.backup");
+ fetch_configurationpath (dpath, sizeof (dpath) / sizeof (TCHAR));
+ _tcscat (dpath, L"configuration.backup");
my_unlink (dpath);
my_rename (path, dpath);
}
-int cfgfile_save (struct uae_prefs *p, const char *filename, int type)
+int cfgfile_save (struct uae_prefs *p, const TCHAR *filename, int type)
{
struct zfile *fh;
cfgfile_backup (filename);
- fh = zfile_fopen (filename, "w");
- write_log ("save config '%s'\n", filename);
+ fh = zfile_fopen (filename, unicode_config ? L"w, ccs=UTF-8" : L"w");
if (! fh)
return 0;
return 1;
}
-int cfgfile_get_description (const char *filename, char *description, char *hostlink, char *hardwarelink, int *type)
+int cfgfile_get_description (const TCHAR *filename, TCHAR *description, TCHAR *hostlink, TCHAR *hardwarelink, int *type)
{
int result = 0;
struct uae_prefs *p = xmalloc (sizeof (struct uae_prefs));
if (cfgfile_load_2 (p, filename, 0, type)) {
result = 1;
if (description)
- strcpy (description, p->description);
+ _tcscpy (description, p->description);
if (hostlink)
- strcpy (hostlink, p->config_host_path);
+ _tcscpy (hostlink, p->config_host_path);
if (hardwarelink)
- strcpy (hardwarelink, p->config_hardware_path);
+ _tcscpy (hardwarelink, p->config_hardware_path);
}
xfree (p);
return result;
void cfgfile_show_usage (void)
{
int i;
- write_log ("UAE Configuration Help:\n" \
- "=======================\n");
+ write_log (L"UAE Configuration Help:\n" \
+ L"=======================\n");
for (i = 0; i < sizeof opttable / sizeof *opttable; i++)
- write_log ("%s: %s\n", opttable[i].config_label, opttable[i].config_help);
+ write_log (L"%s: %s\n", opttable[i].config_label, opttable[i].config_help);
}
/* This implements the old commandline option parsing. I've re-added this
because the new way of doing things is painful for me (it requires me
to type a couple hundred characters when invoking UAE). The following
is far less annoying to use. */
-static void parse_gfx_specs (struct uae_prefs *p, char *spec)
+static void parse_gfx_specs (struct uae_prefs *p, const TCHAR *spec)
{
- char *x0 = my_strdup (spec);
- char *x1, *x2;
+ TCHAR *x0 = my_strdup (spec);
+ TCHAR *x1, *x2;
- x1 = strchr (x0, ':');
+ x1 = _tcschr (x0, ':');
if (x1 == 0)
goto argh;
- x2 = strchr (x1+1, ':');
+ x2 = _tcschr (x1+1, ':');
if (x2 == 0)
goto argh;
*x1++ = 0; *x2++ = 0;
- p->gfx_size_win.width = p->gfx_size_fs.width = atoi (x0);
- p->gfx_size_win.height = p->gfx_size_fs.height = atoi (x1);
- p->gfx_resolution = strchr (x2, 'l') != 0 ? 1 : 0;
- p->gfx_xcenter = strchr (x2, 'x') != 0 ? 1 : strchr (x2, 'X') != 0 ? 2 : 0;
- p->gfx_ycenter = strchr (x2, 'y') != 0 ? 1 : strchr (x2, 'Y') != 0 ? 2 : 0;
- p->gfx_linedbl = strchr (x2, 'd') != 0;
- p->gfx_linedbl += 2 * (strchr (x2, 'D') != 0);
- p->gfx_afullscreen = strchr (x2, 'a') != 0;
- p->gfx_pfullscreen = strchr (x2, 'p') != 0;
+ p->gfx_size_win.width = p->gfx_size_fs.width = _tstoi (x0);
+ p->gfx_size_win.height = p->gfx_size_fs.height = _tstoi (x1);
+ p->gfx_resolution = _tcschr (x2, 'l') != 0 ? 1 : 0;
+ p->gfx_xcenter = _tcschr (x2, 'x') != 0 ? 1 : _tcschr (x2, 'X') != 0 ? 2 : 0;
+ p->gfx_ycenter = _tcschr (x2, 'y') != 0 ? 1 : _tcschr (x2, 'Y') != 0 ? 2 : 0;
+ p->gfx_linedbl = _tcschr (x2, 'd') != 0;
+ p->gfx_linedbl += 2 * (_tcschr (x2, 'D') != 0);
+ p->gfx_afullscreen = _tcschr (x2, 'a') != 0;
+ p->gfx_pfullscreen = _tcschr (x2, 'p') != 0;
if (p->gfx_linedbl == 3) {
- write_log ("You can't use both 'd' and 'D' modifiers in the display mode specification.\n");
+ write_log (L"You can't use both 'd' and 'D' modifiers in the display mode specification.\n");
}
free (x0);
return;
argh:
- write_log ("Bad display mode specification.\n");
- write_log ("The format to use is: \"width:height:modifiers\"\n");
- write_log ("Type \"uae -h\" for detailed help.\n");
+ write_log (L"Bad display mode specification.\n");
+ write_log (L"The format to use is: \"width:height:modifiers\"\n");
+ write_log (L"Type \"uae -h\" for detailed help.\n");
free (x0);
}
-static void parse_sound_spec (struct uae_prefs *p, char *spec)
+static void parse_sound_spec (struct uae_prefs *p, const TCHAR *spec)
{
- char *x0 = my_strdup (spec);
- char *x1, *x2 = NULL, *x3 = NULL, *x4 = NULL, *x5 = NULL;
+ TCHAR *x0 = my_strdup (spec);
+ TCHAR *x1, *x2 = NULL, *x3 = NULL, *x4 = NULL, *x5 = NULL;
- x1 = strchr (x0, ':');
+ x1 = _tcschr (x0, ':');
if (x1 != NULL) {
*x1++ = '\0';
- x2 = strchr (x1 + 1, ':');
+ x2 = _tcschr (x1 + 1, ':');
if (x2 != NULL) {
*x2++ = '\0';
- x3 = strchr (x2 + 1, ':');
+ x3 = _tcschr (x2 + 1, ':');
if (x3 != NULL) {
*x3++ = '\0';
- x4 = strchr (x3 + 1, ':');
+ x4 = _tcschr (x3 + 1, ':');
if (x4 != NULL) {
*x4++ = '\0';
- x5 = strchr (x4 + 1, ':');
+ x5 = _tcschr (x4 + 1, ':');
}
}
}
}
- p->produce_sound = atoi (x0);
+ p->produce_sound = _tstoi (x0);
if (x1) {
p->sound_stereo_separation = 0;
if (*x1 == 'S') {
p->sound_stereo = SND_MONO;
}
if (x3)
- p->sound_freq = atoi (x3);
+ p->sound_freq = _tstoi (x3);
if (x4)
- p->sound_maxbsiz = atoi (x4);
+ p->sound_maxbsiz = _tstoi (x4);
free (x0);
}
-static void parse_joy_spec (struct uae_prefs *p, char *spec)
+static void parse_joy_spec (struct uae_prefs *p, const TCHAR *spec)
{
int v0 = 2, v1 = 0;
- if (strlen(spec) != 2)
+ if (_tcslen(spec) != 2)
goto bad;
switch (spec[0]) {
/* Let's scare Pascal programmers */
if (0)
bad:
- write_log ("Bad joystick mode specification. Use -J xy, where x and y\n"
- "can be 0 for joystick 0, 1 for joystick 1, M for mouse, and\n"
- "a, b or c for different keyboard settings.\n");
+ write_log (L"Bad joystick mode specification. Use -J xy, where x and y\n"
+ L"can be 0 for joystick 0, 1 for joystick 1, M for mouse, and\n"
+ L"a, b or c for different keyboard settings.\n");
p->jports[0].id = v0;
p->jports[1].id = v1;
}
-static void parse_filesys_spec (struct uae_prefs *p, int readonly, char *spec)
+static void parse_filesys_spec (struct uae_prefs *p, int readonly, const TCHAR *spec)
{
- char buf[256];
- char *s2;
+ TCHAR buf[256];
+ TCHAR *s2;
- strncpy (buf, spec, 255); buf[255] = 0;
- s2 = strchr (buf, ':');
+ _tcsncpy (buf, spec, 255); buf[255] = 0;
+ s2 = _tcschr (buf, ':');
if (s2) {
*s2++ = '\0';
#ifdef __DOS__
{
- char *tmp;
+ TCHAR *tmp;
- while ((tmp = strchr (s2, '\\')))
+ while ((tmp = _tcschr (s2, '\\')))
*tmp = '/';
}
#endif
add_filesys_config (p, -1, NULL, buf, s2, readonly, 0, 0, 0, 0, 0, 0, 0, 0);
#endif
} else {
- write_log ("Usage: [-m | -M] VOLNAME:mount_point\n");
+ write_log (L"Usage: [-m | -M] VOLNAME:mount_point\n");
}
}
-static void parse_hardfile_spec (struct uae_prefs *p, char *spec)
+static void parse_hardfile_spec (struct uae_prefs *p, const TCHAR *spec)
{
- char *x0 = my_strdup (spec);
- char *x1, *x2, *x3, *x4;
+ TCHAR *x0 = my_strdup (spec);
+ TCHAR *x1, *x2, *x3, *x4;
- x1 = strchr (x0, ':');
+ x1 = _tcschr (x0, ':');
if (x1 == NULL)
goto argh;
*x1++ = '\0';
- x2 = strchr (x1 + 1, ':');
+ x2 = _tcschr (x1 + 1, ':');
if (x2 == NULL)
goto argh;
*x2++ = '\0';
- x3 = strchr (x2 + 1, ':');
+ x3 = _tcschr (x2 + 1, ':');
if (x3 == NULL)
goto argh;
*x3++ = '\0';
- x4 = strchr (x3 + 1, ':');
+ x4 = _tcschr (x3 + 1, ':');
if (x4 == NULL)
goto argh;
*x4++ = '\0';
#ifdef FILESYS
- add_filesys_config (p, -1, NULL, NULL, x4, 0, atoi (x0), atoi (x1), atoi (x2), atoi (x3), 0, 0, 0, 0);
+ add_filesys_config (p, -1, NULL, NULL, x4, 0, _tstoi (x0), _tstoi (x1), _tstoi (x2), _tstoi (x3), 0, 0, 0, 0);
#endif
free (x0);
return;
argh:
free (x0);
- write_log ("Bad hardfile parameter specified - type \"uae -h\" for help.\n");
+ write_log (L"Bad hardfile parameter specified - type \"uae -h\" for help.\n");
return;
}
-static void parse_cpu_specs (struct uae_prefs *p, char *spec)
+static void parse_cpu_specs (struct uae_prefs *p, const TCHAR *spec)
{
if (*spec < '0' || *spec > '4') {
- write_log ("CPU parameter string must begin with '0', '1', '2', '3' or '4'.\n");
+ write_log (L"CPU parameter string must begin with '0', '1', '2', '3' or '4'.\n");
return;
}
switch (*spec) {
case 'a':
if (p->cpu_model < 68020)
- write_log ("In 68000/68010 emulation, the address space is always 24 bit.\n");
+ write_log (L"In 68000/68010 emulation, the address space is always 24 bit.\n");
else if (p->cpu_model >= 68040)
- write_log ("In 68040/060 emulation, the address space is always 32 bit.\n");
+ write_log (L"In 68040/060 emulation, the address space is always 32 bit.\n");
else
p->address_space_24 = 1;
break;
case 'c':
if (p->cpu_model != 68000)
- write_log ("The more compatible CPU emulation is only available for 68000\n"
- "emulation, not for 68010 upwards.\n");
+ write_log (L"The more compatible CPU emulation is only available for 68000\n"
+ L"emulation, not for 68010 upwards.\n");
else
p->cpu_compatible = 1;
break;
default:
- write_log ("Bad CPU parameter specified - type \"uae -h\" for help.\n");
+ write_log (L"Bad CPU parameter specified - type \"uae -h\" for help.\n");
break;
}
spec++;
}
/* Returns the number of args used up (0 or 1). */
-int parse_cmdline_option (struct uae_prefs *p, char c, char *arg)
+int parse_cmdline_option (struct uae_prefs *p, TCHAR c, const TCHAR *arg)
{
- struct strlist *u = (struct strlist*)xcalloc (sizeof (struct strlist), 1);
- const char arg_required[] = "0123rKpImWSAJwNCZUFcblOdHRv";
+ struct strlist *u = xcalloc (sizeof (struct strlist), 1);
+ const TCHAR arg_required[] = L"0123rKpImWSAJwNCZUFcblOdHRv";
- if (strchr (arg_required, c) && ! arg) {
- write_log ("Missing argument for option `-%c'!\n", c);
+ if (_tcschr (arg_required, c) && ! arg) {
+ write_log (L"Missing argument for option `-%c'!\n", c);
return 0;
}
- u->option = (char*)malloc (2);
+ u->option = malloc (2 * sizeof (TCHAR));
u->option[0] = c;
u->option[1] = 0;
- u->value = my_strdup(arg);
+ u->value = my_strdup (arg);
u->next = p->all_lines;
p->all_lines = u;
switch (c) {
case 'h': usage (); exit (0);
- case '0': strncpy (p->df[0], arg, 255); p->df[0][255] = 0; break;
- case '1': strncpy (p->df[1], arg, 255); p->df[1][255] = 0; break;
- case '2': strncpy (p->df[2], arg, 255); p->df[2][255] = 0; break;
- case '3': strncpy (p->df[3], arg, 255); p->df[3][255] = 0; break;
- case 'r': strncpy (p->romfile, arg, 255); p->romfile[255] = 0; break;
- case 'K': strncpy (p->romextfile, arg, 255); p->romextfile[255] = 0; break;
- case 'p': strncpy (p->prtname, arg, 255); p->prtname[255] = 0; break;
- /* case 'I': strncpy (p->sername, arg, 255); p->sername[255] = 0; currprefs.use_serial = 1; break; */
+ case '0': _tcsncpy (p->df[0], arg, 255); p->df[0][255] = 0; break;
+ case '1': _tcsncpy (p->df[1], arg, 255); p->df[1][255] = 0; break;
+ case '2': _tcsncpy (p->df[2], arg, 255); p->df[2][255] = 0; break;
+ case '3': _tcsncpy (p->df[3], arg, 255); p->df[3][255] = 0; break;
+ case 'r': _tcsncpy (p->romfile, arg, 255); p->romfile[255] = 0; break;
+ case 'K': _tcsncpy (p->romextfile, arg, 255); p->romextfile[255] = 0; break;
+ case 'p': _tcsncpy (p->prtname, arg, 255); p->prtname[255] = 0; break;
+ /* case 'I': _tcsncpy (p->sername, arg, 255); p->sername[255] = 0; currprefs.use_serial = 1; break; */
case 'm': case 'M': parse_filesys_spec (p, c == 'M', arg); break;
case 'W': parse_hardfile_spec (p, arg); break;
case 'S': parse_sound_spec (p, arg); break;
- case 'R': p->gfx_framerate = atoi (arg); break;
+ case 'R': p->gfx_framerate = _tstoi (arg); break;
case 'x': p->no_xhair = 1; break;
case 'i': p->illegal_mem = 1; break;
case 'J': parse_joy_spec (p, arg); break;
case 'L': p->x11_use_low_bandwidth = 1; break;
case 'T': p->x11_use_mitshm = 1; break;
#endif
- case 'w': p->m68k_speed = atoi (arg); break;
+ case 'w': p->m68k_speed = _tstoi (arg); break;
/* case 'g': p->use_gfxlib = 1; break; */
case 'G': p->start_gui = 0; break;
case 'D': p->start_debugger = 1; break;
case 'n':
- if (strchr (arg, 'i') != 0)
+ if (_tcschr (arg, 'i') != 0)
p->immediate_blits = 1;
break;
case 'v':
- set_chipset_mask (p, atoi (arg));
+ set_chipset_mask (p, _tstoi (arg));
break;
case 'C':
break;
case 'Z':
- p->z3fastmem_size = atoi (arg) * 0x100000;
+ p->z3fastmem_size = _tstoi (arg) * 0x100000;
break;
case 'U':
- p->gfxmem_size = atoi (arg) * 0x100000;
+ p->gfxmem_size = _tstoi (arg) * 0x100000;
break;
case 'F':
- p->fastmem_size = atoi (arg) * 0x100000;
+ p->fastmem_size = _tstoi (arg) * 0x100000;
break;
case 'b':
- p->bogomem_size = atoi (arg) * 0x40000;
+ p->bogomem_size = _tstoi (arg) * 0x40000;
break;
case 'c':
- p->chipmem_size = atoi (arg) * 0x80000;
+ p->chipmem_size = _tstoi (arg) * 0x80000;
break;
case 'l':
- if (0 == strcasecmp(arg, "de"))
+ if (0 == strcasecmp(arg, L"de"))
p->keyboard_lang = KBD_LANG_DE;
- else if (0 == strcasecmp(arg, "dk"))
+ else if (0 == strcasecmp(arg, L"dk"))
p->keyboard_lang = KBD_LANG_DK;
- else if (0 == strcasecmp(arg, "us"))
+ else if (0 == strcasecmp(arg, L"us"))
p->keyboard_lang = KBD_LANG_US;
- else if (0 == strcasecmp(arg, "se"))
+ else if (0 == strcasecmp(arg, L"se"))
p->keyboard_lang = KBD_LANG_SE;
- else if (0 == strcasecmp(arg, "fr"))
+ else if (0 == strcasecmp(arg, L"fr"))
p->keyboard_lang = KBD_LANG_FR;
- else if (0 == strcasecmp(arg, "it"))
+ else if (0 == strcasecmp(arg, L"it"))
p->keyboard_lang = KBD_LANG_IT;
- else if (0 == strcasecmp(arg, "es"))
+ else if (0 == strcasecmp(arg, L"es"))
p->keyboard_lang = KBD_LANG_ES;
break;
case 'O': parse_gfx_specs (p, arg); break;
case 'd':
- if (strchr (arg, 'S') != NULL || strchr (arg, 's')) {
- write_log (" Serial on demand.\n");
+ if (_tcschr (arg, 'S') != NULL || _tcschr (arg, 's')) {
+ write_log (L" Serial on demand.\n");
p->serial_demand = 1;
}
- if (strchr (arg, 'P') != NULL || strchr (arg, 'p')) {
- write_log (" Parallel on demand.\n");
+ if (_tcschr (arg, 'P') != NULL || _tcschr (arg, 'p')) {
+ write_log (L" Parallel on demand.\n");
p->parallel_demand = 1;
}
break;
case 'H':
- p->color_mode = atoi (arg);
+ p->color_mode = _tstoi (arg);
if (p->color_mode < 0) {
- write_log ("Bad color mode selected. Using default.\n");
+ write_log (L"Bad color mode selected. Using default.\n");
p->color_mode = 0;
}
break;
default:
- write_log ("Unknown option `-%c'!\n", c);
+ write_log (L"Unknown option `-%c'!\n", c);
break;
}
- return !! strchr (arg_required, c);
+ return !! _tcschr (arg_required, c);
}
-void cfgfile_addcfgparam (char *line)
+void cfgfile_addcfgparam (TCHAR *line)
{
struct strlist *u;
- char line1b[CONFIG_BLEN], line2b[CONFIG_BLEN];
+ TCHAR line1b[CONFIG_BLEN], line2b[CONFIG_BLEN];
if (!line) {
struct strlist **ps = &temp_lines;
while (*ps) {
struct strlist *s = *ps;
*ps = s->next;
- free (s->value);
- free (s->option);
- free (s);
+ xfree (s->value);
+ xfree (s->option);
+ xfree (s);
}
temp_lines = 0;
return;
if (!cfgfile_separate_line (line, line1b, line2b))
return;
u = xcalloc (sizeof (struct strlist), 1);
- u->option = my_strdup(line1b);
- u->value = my_strdup(line2b);
+ u->option = my_strdup (line1b);
+ u->value = my_strdup (line2b);
u->next = temp_lines;
temp_lines = u;
}
-static int getconfigstoreline (struct zfile *z, char *option, char *value)
+static int getconfigstoreline (struct zfile *z, TCHAR *option, TCHAR *value)
{
- char tmp[CONFIG_BLEN * 2];
+ TCHAR tmp[CONFIG_BLEN * 2];
int idx = 0;
for (;;) {
- uae_u8 b = 0;
- if (zfile_fread (&b, 1, 1, z) != 1)
+ TCHAR b = 0;
+ if (zfile_fread (&b, 1, sizeof (TCHAR), z) != 1)
return 0;
tmp[idx++] = b;
tmp[idx] = 0;
}
#if 0
-static int cfgfile_handle_custom_event (char *custom, int mode)
+static int cfgfile_handle_custom_event (TCHAR *custom, int mode)
{
- char option[CONFIG_BLEN], value[CONFIG_BLEN];
- char option2[CONFIG_BLEN], value2[CONFIG_BLEN];
- char *tmp, *p, *nextp;
+ TCHAR option[CONFIG_BLEN], value[CONFIG_BLEN];
+ TCHAR option2[CONFIG_BLEN], value2[CONFIG_BLEN];
+ TCHAR *tmp, *p, *nextp;
struct zfile *configstore = NULL;
int cnt = 0, cnt_ok = 0;
uae_u8 zero = 0;
configstore = zfile_fopen_empty ("configstore", 50000);
cfgfile_save_options (configstore, &currprefs, 0);
- zfile_fwrite (&zero, 1, 1, configstore);
+ cfg_write (&zero, configstore);
}
nextp = NULL;
- tmp = p = xcalloc (strlen (custom) + 2, 1);
- strcpy (tmp, custom);
+ tmp = p = xcalloc (_tcslen (custom) + 2, 1);
+ _tcscpy (tmp, custom);
while (p && *p) {
if (*p == '\"') {
- char *p2;
+ TCHAR *p2;
p++;
p2 = p;
while (*p2 != '\"' && *p2 != 0)
for (;;) {
if (!getconfigstoreline (configstore, option2, value2))
break;
- if (!strcmpi (option, option2) && !strcmpi (value, value2)) {
+ if (!_tcscmpi (option, option2) && !_tcscmpi (value, value2)) {
cnt_ok++;
break;
}
}
#endif
-int cmdlineparser (char *s, char *outp[], int max)
+int cmdlineparser (TCHAR *s, TCHAR *outp[], int max)
{
int j, cnt = 0;
int slash = 0;
int quote = 0;
- char tmp1[MAX_DPATH];
- char *prev;
+ TCHAR tmp1[MAX_DPATH];
+ TCHAR *prev;
int doout;
doout = 0;
prev = s;
j = 0;
while (cnt < max) {
- char c = *s++;
+ TCHAR c = *s++;
if (!c)
break;
if (c < 32)
#define UAELIB_MAX_PARSE 100
-uae_u32 cfgfile_modify (uae_u32 index, char *parms, uae_u32 size, char *out, uae_u32 outsize)
+uae_u32 cfgfile_modify (uae_u32 index, TCHAR *parms, uae_u32 size, TCHAR *out, uae_u32 outsize)
{
- char *p;
- char *argc[UAELIB_MAX_PARSE];
+ TCHAR *p;
+ TCHAR *argc[UAELIB_MAX_PARSE];
int argv, i;
uae_u32 err;
- uae_u8 zero = 0;
+ TCHAR zero = 0;
static struct zfile *configstore;
- static char *configsearch;
+ static TCHAR *configsearch;
static int configsearchfound;
err = 0;
goto end;
}
if (configsearch) {
- char tmp[CONFIG_BLEN];
+ TCHAR tmp[CONFIG_BLEN];
int j = 0;
- char *in = configsearch;
- int inlen = strlen (configsearch);
+ TCHAR *in = configsearch;
+ int inlen = _tcslen (configsearch);
int joker = 0;
if (in[inlen - 1] == '*') {
err = 0;
goto end;
}
- if (j >= sizeof (tmp) - 1)
- j = sizeof (tmp) - 1;
+ if (j >= sizeof (tmp) / sizeof (TCHAR) - 1)
+ j = sizeof (tmp) / sizeof (TCHAR) - 1;
if (b == 0) {
err = 10;
if (configsearch)
goto end;
}
if (b == '\n') {
- if (configsearch && !strncmp (tmp, in, inlen) &&
- ((inlen > 0 && strlen (tmp) > inlen && tmp[inlen] == '=') || (joker))) {
- char *p;
+ if (configsearch && !_tcsncmp (tmp, in, inlen) &&
+ ((inlen > 0 && _tcslen (tmp) > inlen && tmp[inlen] == '=') || (joker))) {
+ TCHAR *p;
if (joker)
p = tmp - 1;
else
- p = strchr (tmp, '=');
+ p = _tcschr (tmp, '=');
if (p) {
for (i = 0; i < outsize - 1; i++) {
- uae_u8 b = *++p;
+ TCHAR b = *++p;
out[i] = b;
out[i + 1] = 0;
if (!b)
if (argv <= 1 && index == 0xffffffff) {
zfile_fclose (configstore);
xfree (configsearch);
- configstore = zfile_fopen_empty ("configstore", 50000);
+ configstore = zfile_fopen_empty (L"configstore", 50000);
configsearch = NULL;
- if (argv > 0 && strlen (argc[0]) > 0)
+ if (argv > 0 && _tcslen (argc[0]) > 0)
configsearch = my_strdup (argc[0]);
if (!configstore) {
err = 20;
uaeconfig++;
cfgfile_save_options (configstore, &currprefs, 0);
uaeconfig--;
- zfile_fwrite (&zero, 1, 1, configstore);
+ cfg_write (&zero, configstore);
zfile_fseek (configstore, 0, SEEK_SET);
err = 0xffffffff;
configsearchfound = 0;
uae_u32 cfgfile_uaelib_modify (uae_u32 index, uae_u32 parms, uae_u32 size, uae_u32 out, uae_u32 outsize)
{
- char *p, *parms_p = NULL, *out_p = NULL;
+ uae_char *p, *parms_p = NULL, *parms_out = NULL;
int i, ret;
+ TCHAR *out_p = NULL, *parms_in = NULL;
put_byte (out, 0);
parms_p = xmalloc (size + 1);
ret = 10;
goto end;
}
- out_p = xmalloc (outsize + 1);
+ out_p = xmalloc ((outsize + 1) * sizeof (TCHAR));
if (!out_p) {
ret = 10;
goto end;
}
p[i] = 0;
out_p[0] = 0;
- ret = cfgfile_modify (index, parms_p, size, out_p, outsize);
- p = out_p;
+ parms_in = au (parms_p);
+ ret = cfgfile_modify (index, parms_in, size, out_p, outsize);
+ xfree (parms_in);
+ parms_out = ua (out_p);
+ p = parms_out;
for (i = 0; i < outsize - 1; i++) {
uae_u8 b = *p++;
put_byte (out + i, b);
if (!b)
break;
}
+ xfree (parms_out);
end:
xfree (out_p);
xfree (parms_p);
uae_u32 cfgfile_uaelib (int mode, uae_u32 name, uae_u32 dst, uae_u32 maxlen)
{
- char tmp[CONFIG_BLEN];
+ TCHAR tmp[CONFIG_BLEN];
int i;
struct strlist *sl;
if (mode)
return 0;
- for (i = 0; i < sizeof(tmp); i++) {
+ for (i = 0; i < sizeof (tmp) / sizeof (TCHAR); i++) {
tmp[i] = get_byte (name + i);
if (tmp[i] == 0)
break;
}
- tmp[sizeof(tmp) - 1] = 0;
+ tmp[sizeof(tmp) / sizeof (TCHAR) - 1] = 0;
if (tmp[0] == 0)
return 0;
for (sl = currprefs.all_lines; sl; sl = sl->next) {
}
if (sl) {
+ char *s = ua (sl->value);
for (i = 0; i < maxlen; i++) {
- put_byte (dst + i, sl->value[i]);
- if (sl->value[i] == 0)
+ put_byte (dst + i, s[i]);
+ if (s[i] == 0)
break;
}
+ xfree (s);
return dst;
}
return 0;
uae_u8 *restore_configuration (uae_u8 *src)
{
- write_log (src);
- src += strlen(src) + 1;
+ TCHAR *s = au (src);
+ write_log (s);
+ xfree (s);
+ src += strlen (src) + 1;
return src;
}
uae_u8 *save_configuration (int *len)
{
int tmpsize = 30000;
- uae_u8 *dstbak, *dst;
- char *p;
+ uae_u8 *dstbak, *dst, *p;
int index = -1;
- dstbak = dst = (uae_u8*)malloc (tmpsize);
+ dstbak = dst = malloc (tmpsize * sizeof (TCHAR));
p = dst;
for (;;) {
- char tmpout[256];
+ TCHAR tmpout[256];
int ret;
tmpout[0] = 0;
- ret = cfgfile_modify (index, "*", 1, tmpout, sizeof (tmpout));
+ ret = cfgfile_modify (index, L"*", 1, tmpout, sizeof (tmpout) / sizeof (TCHAR));
index++;
- if (strlen(tmpout) > 0) {
- if (!memcmp (tmpout, "input.", 6))
+ if (_tcslen (tmpout) > 0) {
+ char *out;
+ if (!_tcsncmp (tmpout, L"input.", 6))
continue;
- strcpy (p, tmpout);
+ out = ua (tmpout);
+ strcpy (p, out);
+ xfree (out);
strcat (p, "\n");
p += strlen (p);
if (p - dstbak >= tmpsize - sizeof (tmpout))
static int configure_rom (struct uae_prefs *p, int *rom, int msg)
{
struct romdata *rd;
- char *path = 0;
+ TCHAR *path = 0;
int i;
i = 0;
return 0;
}
if (rd->type & (ROMTYPE_KICK | ROMTYPE_KICKCD32))
- strcpy (p->romfile, path);
+ _tcscpy (p->romfile, path);
if (rd->type & (ROMTYPE_EXTCD32 | ROMTYPE_EXTCDTV | ROMTYPE_ARCADIABIOS))
- strcpy (p->romextfile, path);
+ _tcscpy (p->romextfile, path);
if (rd->type & (ROMTYPE_CD32CART | ROMTYPE_ARCADIAGAME | ROMTYPE_HRTMON | ROMTYPE_XPOWER | ROMTYPE_NORDIC | ROMTYPE_AR | ROMTYPE_SUPERIV))
- strcpy (p->cartfile, path);
+ _tcscpy (p->cartfile, path);
return 1;
}
static void default_prefs_mini (struct uae_prefs *p, int type)
{
- strcpy (p->description, "UAE default A500 configuration");
+ _tcscpy (p->description, L"UAE default A500 configuration");
p->nr_floppies = 1;
p->dfxtype[0] = DRV_35_DD;
struct zfile *f;
memset (p, 0, sizeof (*p));
- strcpy (p->description, "UAE default configuration");
+ _tcscpy (p->description, L"UAE default configuration");
p->config_hardware_path[0] = 0;
p->config_host_path[0] = 0;
p->gfx_filter_keep_aspect = 0;
p->gfx_filter_autoscale = 0;
- strcpy (p->df[0], "df0.adf");
- strcpy (p->df[1], "df1.adf");
- strcpy (p->df[2], "df2.adf");
- strcpy (p->df[3], "df3.adf");
+ _tcscpy (p->df[0], L"df0.adf");
+ _tcscpy (p->df[1], L"df1.adf");
+ _tcscpy (p->df[2], L"df2.adf");
+ _tcscpy (p->df[3], L"df3.adf");
configure_rom (p, roms, 0);
- strcpy (p->romextfile, "");
- strcpy (p->flashfile, "");
- strcpy (p->cartfile, "");
+ _tcscpy (p->romextfile, L"");
+ _tcscpy (p->flashfile, L"");
+ _tcscpy (p->cartfile, L"");
- strcpy (p->path_rom, "./");
- strcpy (p->path_floppy, "./");
- strcpy (p->path_hardfile, "./");
+ _tcscpy (p->path_rom, L"./");
+ _tcscpy (p->path_floppy, L"./");
+ _tcscpy (p->path_hardfile, L"./");
p->prtname[0] = 0;
p->sername[0] = 0;
zfile_fclose (default_file);
default_file = NULL;
- f = zfile_fopen_empty ("configstore", 100000);
+ f = zfile_fopen_empty (L"configstore", 100000);
if (f) {
uaeconfig++;
cfgfile_save_options (f, p, 0);
uaeconfig--;
- zfile_fwrite (&zero, 1, 1, f);
+ cfg_write (&zero, f);
default_file = f;
}
}
p->cs_df0idhw = 1;
p->cs_resetwarning = 0;
- strcpy (p->romfile, "");
- strcpy (p->romextfile, "");
- strcpy (p->flashfile, "");
- strcpy (p->cartfile, "");
- strcpy (p->amaxromfile, "");
+ _tcscpy (p->romfile, L"");
+ _tcscpy (p->romextfile, L"");
+ _tcscpy (p->flashfile, L"");
+ _tcscpy (p->cartfile, L"");
+ _tcscpy (p->amaxromfile, L"");
p->prtname[0] = 0;
p->sername[0] = 0;
set_68000_compa (p, compa);
p->cs_compatible = CP_CDTV;
built_in_chipset_prefs (p);
- fetch_datapath (p->flashfile, sizeof (p->flashfile));
- strcat(p->flashfile, "cdtv.nvr");
+ fetch_datapath (p->flashfile, sizeof (p->flashfile) / sizeof (TCHAR));
+ _tcscat (p->flashfile, L"cdtv.nvr");
return 1;
}
set_68020_compa (p, compa);
p->cs_compatible = CP_CD32;
built_in_chipset_prefs (p);
- fetch_datapath (p->flashfile, sizeof (p->flashfile));
- strcat(p->flashfile, "cd32.nvr");
+ fetch_datapath (p->flashfile, sizeof (p->flashfile) / sizeof (TCHAR));
+ _tcscat (p->flashfile, L"cd32.nvr");
return 1;
}
built_in_chipset_prefs (p);
p->cs_ide = -1;
p->cs_ciaatod = p->ntscmode ? 2 : 1;
- //strcat(p->flashfile, "battclock.nvr");
+ //_tcscat(p->flashfile, L"battclock.nvr");
return configure_rom (p, roms, romcheck);
}
set_68000_compa (p, compa);
p->cs_compatible = CP_A500;
built_in_chipset_prefs (p);
- fetch_datapath (p->flashfile, sizeof (p->flashfile));
- strcat(p->flashfile, "arcadia.nvr");
+ fetch_datapath (p->flashfile, sizeof (p->flashfile) / sizeof (TCHAR));
+ _tcscat (p->flashfile, L"arcadia.nvr");
roms[0] = 5;
roms[1] = 4;
roms[2] = -1;
}
return 1;
}
-
if (tod_hack_enabled > 1) {
tod_hack_enabled--;
if (tod_hack_enabled == 1) {
- write_log ("TOD HACK enabled\n");
+ write_log (L"TOD HACK enabled\n");
tod_hack_reset ();
}
return;
return;
if (rate != oldrate || ciaatod != tod_hack_tod_last) {
if (ciaatod != 0)
- write_log ("TOD HACK reset %d,%d %d,%d\n",
+ write_log (L"TOD HACK reset %d,%d %d,%d\n",
rate, oldrate, ciaatod, tod_hack_tod_last);
tod_hack_reset ();
oldrate = rate;
ciaasdr_unread = 1;
ciaaicr |= 8;
RethinkICRA ();
- write_log ("KB: sent reset warning code (phase=%d)\n", resetwarning_phase);
+ write_log (L"KB: sent reset warning code (phase=%d)\n", resetwarning_phase);
}
int resetwarning_do (int canreset)
}
resetwarning_phase = 1;
resetwarning_timer = maxvpos * 5;
- write_log ("KB: reset warning triggered\n");
+ write_log (L"KB: reset warning triggered\n");
sendrw ();
return 1;
}
if (resetwarning_timer > 0) {
resetwarning_timer--;
if (resetwarning_timer <= 0) {
- write_log ("KB: reset warning forced reset. Phase=%d\n", resetwarning_phase);
+ write_log (L"KB: reset warning forced reset. Phase=%d\n", resetwarning_phase);
resetwarning_phase = -1;
uae_reset (0);
}
}
if (resetwarning_phase == 1) {
if (kback && !(ciaacra & 0x40) && ciaasdr_unread == 2) {
- write_log ("KB: reset warning second phase..\n");
+ write_log (L"KB: reset warning second phase..\n");
resetwarning_phase = 2;
resetwarning_timer = maxvpos * 5;
sendrw ();
} else if (resetwarning_phase == 2) {
if (ciaacra & 0x40) {
resetwarning_phase = 3;
- write_log ("KB: reset warning SP = output\n");
+ write_log (L"KB: reset warning SP = output\n");
resetwarning_timer = 10 * maxvpos * vblank_hz; /* wait max 10s */
}
} else if (resetwarning_phase == 3) {
if (!(ciaacra & 0x40)) {
- write_log ("KB: reset warning end by software. reset.\n");
+ write_log (L"KB: reset warning end by software. reset.\n");
resetwarning_phase = -1;
uae_reset (0);
}
compute_passed_time ();
#ifdef CIAA_DEBUG_R
- write_log ("R_CIAA: bfe%x01 %08X\n", addr, M68K_GETPC);
+ write_log (L"R_CIAA: bfe%x01 %08X\n", addr, M68K_GETPC);
#endif
switch (addr & 0xf) {
tmp = (tmp & ~0x80) | (ciaapra & 0x80);
#ifdef DONGLE_DEBUG
if (notinrom())
- write_log ("BFE001 R %02X %s\n", tmp, debuginfo(0));
+ write_log (L"BFE001 R %02X %s\n", tmp, debuginfo(0));
#endif
return tmp;
case 1:
tmp = handle_parport_joystick (0, ciaaprb, ciaadrb);
#ifdef DONGLE_DEBUG
if (notinrom())
- write_log ("BFE101 R %02X %s\n", tmp, debuginfo(0));
+ write_log (L"BFE101 R %02X %s\n", tmp, debuginfo(0));
#endif
}
if (ciaacrb & 2) {
case 2:
#ifdef DONGLE_DEBUG
if (notinrom ())
- write_log ("BFE201 R %02X %s\n", ciaadra, debuginfo(0));
+ write_log (L"BFE201 R %02X %s\n", ciaadra, debuginfo(0));
#endif
return ciaadra;
case 3:
#ifdef DONGLE_DEBUG
if (notinrom ())
- write_log ("BFE301 R %02X %s\n", ciaadrb, debuginfo(0));
+ write_log (L"BFE301 R %02X %s\n", ciaadrb, debuginfo(0));
#endif
return ciaadrb;
case 4:
#ifdef CIAB_DEBUG_R
if (addr >= 8 && addr <= 10)
- write_log ("R_CIAB: bfd%x00 %08X\n", addr, M68K_GETPC);
+ write_log (L"R_CIAB: bfd%x00 %08X\n", addr, M68K_GETPC);
#endif
compute_passed_time ();
#endif
#ifdef DONGLE_DEBUG
if (notinrom ())
- write_log ("BFD000 R %02X %s\n", tmp, debuginfo(0));
+ write_log (L"BFD000 R %02X %s\n", tmp, debuginfo(0));
#endif
return tmp;
case 1:
#ifdef DONGLE_DEBUG
if (notinrom ())
- write_log ("BFD100 R %02X %s\n", ciabprb, debuginfo(0));
+ write_log (L"BFD100 R %02X %s\n", ciabprb, debuginfo(0));
#endif
tmp = ciabprb;
if (ciabcrb & 2) {
static void WriteCIAA (uae_u16 addr,uae_u8 val)
{
#ifdef CIAA_DEBUG_W
- write_log ("W_CIAA: bfe%x01 %02X %08X\n", addr, val, M68K_GETPC);
+ write_log (L"W_CIAA: bfe%x01 %02X %08X\n", addr, val, M68K_GETPC);
#endif
#ifdef ACTION_REPLAY
ar_ciaa[addr & 0xf] = val;
case 0:
#ifdef DONGLE_DEBUG
if (notinrom ())
- write_log ("BFE001 W %02X %s\n", val, debuginfo(0));
+ write_log (L"BFE001 W %02X %s\n", val, debuginfo(0));
#endif
ciaapra = (ciaapra & ~0xc3) | (val & 0xc3);
bfe001_change ();
case 1:
#ifdef DONGLE_DEBUG
if (notinrom ())
- write_log ("BFE101 W %02X %s\n", val, debuginfo(0));
+ write_log (L"BFE101 W %02X %s\n", val, debuginfo(0));
#endif
ciaaprb = val;
#ifdef PARALLEL_PORT
case 2:
#ifdef DONGLE_DEBUG
if (notinrom ())
- write_log ("BFE201 W %02X %s\n", val, debuginfo(0));
+ write_log (L"BFE201 W %02X %s\n", val, debuginfo(0));
#endif
ciaadra = val; bfe001_change (); break;
case 3:
ciaadrb = val;
#ifdef DONGLE_DEBUG
if (notinrom ())
- write_log ("BFE301 W %02X %s\n", val, debuginfo(0));
+ write_log (L"BFE301 W %02X %s\n", val, debuginfo(0));
#endif
#ifdef ARCADIA
if (arcadia_bios)
{
#ifdef CIAB_DEBUG_W
if (addr >= 8 && addr <= 10)
- write_log ("W_CIAB: bfd%x00 %02X %08X\n", addr, val, M68K_GETPC);
+ write_log (L"W_CIAB: bfd%x00 %02X %08X\n", addr, val, M68K_GETPC);
#endif
#ifdef ACTION_REPLAY
ar_ciab[addr & 0xf] = val;
case 0:
#ifdef DONGLE_DEBUG
if (notinrom ())
- write_log ("BFD000 W %02X %s\n", val, debuginfo(0));
+ write_log (L"BFD000 W %02X %s\n", val, debuginfo(0));
#endif
ciabpra = val;
#ifdef SERIAL_PORT
case 1:
#ifdef DONGLE_DEBUG
if (notinrom ())
- write_log ("BFD100 W %02X %s\n", val, debuginfo(0));
+ write_log (L"BFD100 W %02X %s\n", val, debuginfo(0));
#endif
ciabprb = val; DISK_select(val); break;
case 2:
#ifdef DONGLE_DEBUG
if (notinrom ())
- write_log ("BFD200 W %02X %s\n", val, debuginfo(0));
+ write_log (L"BFD200 W %02X %s\n", val, debuginfo(0));
#endif
ciabdra = val;
#ifdef SERIAL_PORT
case 3:
#ifdef DONGLE_DEBUG
if (notinrom ())
- write_log ("BFD300 W %02X %s\n", val, debuginfo(0));
+ write_log (L"BFD300 W %02X %s\n", val, debuginfo(0));
#endif
ciabdrb = val; break;
case 4:
void dumpcia (void)
{
- console_out_f ("A: CRA %02x CRB %02x ICR %02x IM %02x TA %04x (%04x) TB %04x (%04x)\n",
+ console_out_f (L"A: CRA %02x CRB %02x ICR %02x IM %02x TA %04x (%04x) TB %04x (%04x)\n",
ciaacra, ciaacrb, ciaaicr, ciaaimask, ciaata, ciaala, ciaatb, ciaalb);
- console_out_f ("TOD %06x (%06x) ALARM %06x %c%c\n",
+ console_out_f (L"TOD %06x (%06x) ALARM %06x %c%c\n",
ciaatod, ciaatol, ciaaalarm, ciaatlatch ? 'L' : ' ', ciaatodon ? ' ' : 'S');
- console_out_f ("B: CRA %02x CRB %02x ICR %02x IM %02x TA %04x (%04x) TB %04x (%04x)\n",
+ console_out_f (L"B: CRA %02x CRB %02x ICR %02x IM %02x TA %04x (%04x) TB %04x (%04x)\n",
ciabcra, ciabcrb, ciaaicr, ciabimask, ciabta, ciabla, ciabtb, ciablb);
- console_out_f ("TOD %06x (%06x) ALARM %06x %c%c\n",
+ console_out_f (L"TOD %06x (%06x) ALARM %06x %c%c\n",
ciabtod, ciabtol, ciabalarm, ciabtlatch ? 'L' : ' ', ciabtodon ? ' ' : 'S');
}
addrbank cia_bank = {
cia_lget, cia_wget, cia_bget,
cia_lput, cia_wput, cia_bput,
- default_xlate, default_check, NULL, "CIA",
+ default_xlate, default_check, NULL, L"CIA",
cia_lgeti, cia_wgeti, ABFLAG_IO
};
if (currprefs.cpu_model == 68000 && currprefs.cpu_compatible)
v = (addr & 1) ? regs.irc : regs.irc >> 8;
if (warned > 0) {
- write_log ("cia_bget: unknown CIA address %x PC=%x\n", addr, M68K_GETPC);
+ write_log (L"cia_bget: unknown CIA address %x PC=%x\n", addr, M68K_GETPC);
warned--;
}
break;
if (currprefs.cpu_model == 68000 && currprefs.cpu_compatible)
v = regs.irc;
if (warned > 0) {
- write_log ("cia_wget: unknown CIA address %x PC=%x\n", addr, M68K_GETPC);
+ write_log (L"cia_wget: unknown CIA address %x PC=%x\n", addr, M68K_GETPC);
warned--;
}
break;
if ((addr & 0x1000) == 0)
WriteCIAA (r, value);
if (((addr & 0x3000) == 0x3000) && warned > 0) {
- write_log ("cia_bput: unknown CIA address %x %x\n", addr, value);
+ write_log (L"cia_bput: unknown CIA address %x %x\n", addr, value);
warned--;
}
}
if ((addr & 0x1000) == 0)
WriteCIAA (r, value & 0xff);
if (((addr & 0x3000) == 0x3000) && warned > 0) {
- write_log ("cia_wput: unknown CIA address %x %x\n", addr, value);
+ write_log (L"cia_wput: unknown CIA address %x %x\n", addr, value);
warned--;
}
}
addrbank clock_bank = {
clock_lget, clock_wget, clock_bget,
clock_lput, clock_wput, clock_bput,
- default_xlate, default_check, NULL, "Battery backed up clock (none)",
+ default_xlate, default_check, NULL, L"Battery backed up clock (none)",
dummy_lgeti, dummy_wgeti, ABFLAG_IO
};
static void write_battclock (void)
{
- struct zfile *f = zfile_fopen (currprefs.flashfile, "rb+");
+ struct zfile *f = zfile_fopen (currprefs.flashfile, L"rb+");
if (!f) {
- f = zfile_fopen (currprefs.flashfile, "wb");
+ f = zfile_fopen (currprefs.flashfile, L"wb");
if (f) {
zfile_fwrite (rtc_memory, RF5C01A_RAM_SIZE, 1, f);
zfile_fwrite (rtc_alarm, RF5C01A_RAM_SIZE, 1, f);
void rtc_hardreset (void)
{
if (currprefs.cs_rtc == 1) { /* MSM6242B */
- clock_bank.name = "Battery backed up clock (MSM6242B)";
+ clock_bank.name = L"Battery backed up clock (MSM6242B)";
clock_control_d = 0x1;
clock_control_e = 0;
clock_control_f = 0x4; /* 24/12 */
} else if (currprefs.cs_rtc == 2) { /* RF5C01A */
- clock_bank.name = "Battery backed up clock (RF5C01A)";
+ clock_bank.name = L"Battery backed up clock (RF5C01A)";
clock_control_d = 0x4; /* Timer EN */
clock_control_e = 0;
clock_control_f = 0;
#endif
-static void mmu_dump_ttr(const char * label, uae_u32 ttr)
+static void mmu_dump_ttr(const TCHAR * label, uae_u32 ttr)
{
uae_u32 from_addr, to_addr;
from_addr = ttr & MMU_TTR_LOGICAL_BASE;
to_addr = (ttr & MMU_TTR_LOGICAL_MASK) << 8;
- D(bug("%s: [%08lx] %08lx - %08lx enabled=%d supervisor=%d wp=%d cm=%02d\n",
+ D(bug(L"%s: [%08lx] %08lx - %08lx enabled=%d supervisor=%d wp=%d cm=%02d\n",
label, ttr,
from_addr, to_addr,
ttr & MMU_TTR_BIT_ENABLED ? 1 : 0,
*ttr |= ((baseaddr + size - 1) & MMU_TTR_LOGICAL_BASE) >> 8;
*ttr |= MMU_TTR_BIT_ENABLED;
- D(bug("MMU: map transparent mapping of %08x\n", *ttr));
+ D(bug(L"MMU: map transparent mapping of %08x\n", *ttr));
}
/* check if an address matches a ttr */
#define ROOT_INDEX_SHIFT 25
#define PTR_INDEX_SHIFT 18
/* {{{ mmu_dump_table */
-static void mmu_dump_table(const char * label, uaecptr root_ptr)
+static void mmu_dump_table(const TCHAR * label, uaecptr root_ptr)
{
// DUNUSED(label);
// const int PAGE_INDEX_SHIFT = 12;
uaecptr ptr_des_addr, page_addr,
root_log, ptr_log, page_log;
- D(bug("%s: root=%lx", label, root_ptr));
+ D(bug(L"%s: root=%lx", label, root_ptr));
for (root_idx = 0; root_idx < ROOT_TABLE_SIZE; root_idx++) {
root_des = phys_get_long(root_ptr + root_idx);
if ((root_des & 2) == 0)
continue; /* invalid */
- D(bug("ROOT: %03d U=%d W=%d UDT=%02d", root_idx,
+ D(bug(L"ROOT: %03d U=%d W=%d UDT=%02d", root_idx,
root_des & 8 ? 1 : 0,
root_des & 4 ? 1 : 0,
root_des & 3
if (n_pages_used == -1)
continue;
- D(bug(" PTR: %03d U=%d W=%d UDT=%02d", ptr_idx,
+ D(bug(L" PTR: %03d U=%d W=%d UDT=%02d", ptr_idx,
ptr_des & 8 ? 1 : 0,
ptr_des & 4 ? 1 : 0,
ptr_des & 3
page_des = page_info[page_idx].match;
if ((page_des & MMU_PDT_MASK) == 2) {
- D(bug(" PAGE: %03d-%03d log=%08lx INDIRECT --> addr=%08lx",
+ D(bug(L" PAGE: %03d-%03d log=%08lx INDIRECT --> addr=%08lx",
page_info[page_idx].start_idx,
page_info[page_idx].start_idx + page_info[page_idx].n_pages - 1,
page_info[page_idx].log,
));
} else {
- D(bug(" PAGE: %03d-%03d log=%08lx addr=%08lx UR=%02d G=%d U1/0=%d S=%d CM=%d M=%d U=%d W=%d",
+ D(bug(L" PAGE: %03d-%03d log=%08lx addr=%08lx UR=%02d G=%d U1/0=%d S=%d CM=%d M=%d U=%d W=%d",
page_info[page_idx].start_idx,
page_info[page_idx].start_idx + page_info[page_idx].n_pages - 1,
page_info[page_idx].log,
for (j = 0; j < ATC_L2_SIZE; j++) {
if (atc_l2[i][j].tag == 0x8000)
continue;
- D(bug("ATC[%02d] G=%d TT=%d M=%d WP=%d VD=%d VI=%d tag=%08x --> phys=%08x",
+ D(bug(L"ATC[%02d] G=%d TT=%d M=%d WP=%d VD=%d VI=%d tag=%08x --> phys=%08x",
j, atc_l2[i][j].global, atc_l2[i][j].tt, atc_l2[i][j].modified,
atc_l2[i][j].write_protect, atc_l2[i][j].valid_data, atc_l2[i][j].valid_inst,
atc_l2[i][j].tag, atc_l2[i][j].phys));
/* {{{ mmu_dump_tables */
void mmu_dump_tables(void)
{
- D(bug("URP: %08x SRP: %08x MMUSR: %x TC: %x\n", regs.urp, regs.srp, regs.mmusr, regs.tcr));
- mmu_dump_ttr("DTT0", regs.dtt0);
- mmu_dump_ttr("DTT1", regs.dtt1);
- mmu_dump_ttr("ITT0", regs.itt0);
- mmu_dump_ttr("ITT1", regs.itt1);
+ D(bug(L"URP: %08x SRP: %08x MMUSR: %x TC: %x\n", regs.urp, regs.srp, regs.mmusr, regs.tcr));
+ mmu_dump_ttr(L"DTT0", regs.dtt0);
+ mmu_dump_ttr(L"DTT1", regs.dtt1);
+ mmu_dump_ttr(L"ITT0", regs.itt0);
+ mmu_dump_ttr(L"ITT1", regs.itt1);
mmu_dump_atc();
//mmu_dump_table("SRP", regs.srp);
}
regs.mmu_fault_addr = addr;
regs.mmu_ssw = ssw | MMU_SSW_ATC;
- D(bug("BUS ERROR: fc=%d w=%d log=%08x ssw=%04x", fc, write, addr, ssw));
+ D(bug(L"BUS ERROR: fc=%d w=%d log=%08x ssw=%04x", fc, write, addr, ssw));
THROW(2);
}
SAVE_EXCEPTION;
TRY(prb) {
desc = mmu_lookup_pagetable(addr, super, write);
- D(bug("translate: %x,%u,%u,%u -> %x", addr, super, write, data, desc));
+ D(bug(L"translate: %x,%u,%u,%u -> %x", addr, super, write, data, desc));
RESTORE_EXCEPTION;
}
CATCH(prb) {
mmu_fill_atc_l2(addr, super, data, write, l);
}
if (!(data ? l->valid_data : l->valid_inst)) {
- D(bug("MMU: non-resident page (%x,%x,%x)!", addr, regs.pc, regs.fault_pc));
+ D(bug(L"MMU: non-resident page (%x,%x,%x)!", addr, regs.pc, regs.fault_pc));
goto fail;
}
if (write) {
if (l->write_protect) {
- D(bug("MMU: write protected (via %s) %lx", l->tt ? "ttr" : "atc", addr));
+ D(bug(L"MMU: write protected (via %s) %lx", l->tt ? "ttr" : "atc", addr));
goto fail;
}
if (!l->modified)
desc_addr = (desc & MMU_ROOT_PTR_ADDR_MASK) | i;
desc = phys_get_long(desc_addr);
if ((desc & 2) == 0) {
- D(bug("MMU: invalid root descriptor for %lx", addr));
+ D(bug(L"MMU: invalid root descriptor for %lx", addr));
return 0;
}
desc_addr = (desc & MMU_ROOT_PTR_ADDR_MASK) | i;
desc = phys_get_long(desc_addr);
if ((desc & 2) == 0) {
- D(bug("MMU: invalid ptr descriptor for %lx", addr));
+ D(bug(L"MMU: invalid ptr descriptor for %lx", addr));
return 0;
}
wp |= desc;
desc = phys_get_long(desc_addr);
if ((desc & 1) == 0) {
if ((desc & 2) == 0) {
- D(bug("MMU: invalid page descriptor log=%08lx desc=%08lx @%08lx", addr, desc, desc_addr));
+ D(bug(L"MMU: invalid page descriptor log=%08lx desc=%08lx @%08lx", addr, desc, desc_addr));
return desc;
}
/* indirect */
if (indirect) {
- D(bug("MMU: double indirect descriptor log=%lx descriptor @ %lx", addr, desc_addr));
+ D(bug(L"MMU: double indirect descriptor log=%lx descriptor @ %lx", addr, desc_addr));
return desc;
}
wp |= desc;
glob = (opcode & 8) != 0;
if (opcode & 16) {
- D(bug("pflusha(%u,%u)\n", glob, regs.dfc));
+ D(bug(L"pflusha(%u,%u)\n", glob, regs.dfc));
mmu_flush_atc_all(glob);
} else {
addr = m68k_areg(®s, regno);
- D(bug("pflush(%u,%u,%x)\n", glob, regs.dfc, addr));
+ D(bug(L"pflush(%u,%u,%x)\n", glob, regs.dfc, addr));
mmu_flush_atc(addr, super, glob);
}
flush_internals();
write = (opcode & 32) == 0;
addr = m68k_areg(®s, regno);
//bug("ptest(%u,%u,%x)", write, regs.dfc, addr);
- D(bug("PTEST%c (A%d) %08x DFC=%d\n", write ? 'W' : 'R', regno, addr, regs.dfc));
+ D(bug(L"PTEST%c (A%d) %08x DFC=%d\n", write ? 'W' : 'R', regno, addr, regs.dfc));
mmu_flush_atc(addr, super, true);
SAVE_EXCEPTION;
TRY(prb) {
regs.mmusr = MMU_MMUSR_B;
}
RESTORE_EXCEPTION;
- D(bug("PTEST result: mmusr %08x\n", regs.mmusr));
+ D(bug(L"PTEST result: mmusr %08x\n", regs.mmusr));
} else
op_illg (opcode, ®s);
}
regs.mmu_pagesize_8k = tc & 0x4000 ? 1 : 0;
mmu_flush_atc_all(true);
- D(bug("MMU: enabled=%d page8k=%d\n", regs.mmu_enabled, regs.mmu_pagesize_8k));
+ D(bug(L"MMU: enabled=%d page8k=%d\n", regs.mmu_enabled, regs.mmu_pagesize_8k));
}
void REGPARAM2 mmu_set_super(bool super)
sha1_update( &ctx, input, len );
sha1_finish( &ctx, out );
}
-char *get_sha1_txt (uae_u8 *input, int len)
+const TCHAR *get_sha1_txt (uae_u8 *input, int len)
{
- static char outtxt[SHA1_SIZE * 2 + 1];
+ static TCHAR outtxt[SHA1_SIZE * 2 + 1];
uae_u8 out[SHA1_SIZE];
int i;
- char *p;
+ TCHAR *p;
p = outtxt;
- get_sha1(input, len, out);
+ get_sha1 (input, len, out);
for (i = 0; i < SHA1_SIZE; i++) {
- sprintf(p, "%02X", out[i]);
+ _stprintf (p, L"%02X", out[i]);
p += 2;
}
*p = 0;
return 0;
}
-void uae_abort (const char *format,...)
+void uae_abort (const TCHAR *format,...)
{
static int nomore;
va_list parms;
- char buffer[1000];
+ TCHAR buffer[1000];
va_start (parms, format);
- _vsnprintf(buffer, sizeof (buffer) - 1, format, parms );
+ _vsntprintf (buffer, sizeof (buffer) - 1, format, parms );
va_end (parms);
if (nomore) {
- write_log ("%s\n", buffer);
+ write_log (L"%s\n", buffer);
return;
}
gui_message (buffer);
rpt_did_reset = 1;
is_lastline = 0;
vsyncmintime = read_processor_time () + vsynctime;
- write_log ("Resetting frame rate hack\n");
+ write_log (L"Resetting frame rate hack\n");
}
STATIC_INLINE void setclr (uae_u16 *p, uae_u16 val)
#ifdef CPUEMU_12
#if 0
if (cycle_line[hpos])
- write_log ("hpos=%d, old=%d, new=%d\n", hpos, cycle_line[hpos], type);
+ write_log (L"hpos=%d, old=%d, new=%d\n", hpos, cycle_line[hpos], type);
if ((type == CYCLE_CPU || type == CYCLE_COPPER) && (hpos & 1))
- write_log ("odd %d cycle %d\n", hpos);
+ write_log (L"odd %d cycle %d\n", hpos);
if (!(hpos & 1) && (type == CYCLE_SPRITE || type == CYCLE_REFRESH || type == CYCLE_MISC))
- write_log ("even %d cycle %d\n", type, hpos);
+ write_log (L"even %d cycle %d\n", type, hpos);
#endif
cycle_line[hpos] = type;
#endif
if (!chipmem_bank.check (plpt, bytecount)) {
static int count = 0;
if (!count)
- count++, write_log ("Warning: Bad playfield pointer\n");
+ count++, write_log (L"Warning: Bad playfield pointer\n");
return NULL;
}
return chipmem_bank.xlateaddr (plpt);
static void debug_cycle_diagram (void)
{
int fm, res, planes, cycle, v;
- char aa;
+ TCHAR aa;
for (fm = 0; fm <= 2; fm++) {
- write_log ("FMODE %d\n=======\n", fm);
+ write_log (L"FMODE %d\n=======\n", fm);
for (res = 0; res <= 2; res++) {
for (planes = 0; planes <= 8; planes++) {
- write_log ("%d: ",planes);
+ write_log (L"%d: ",planes);
for (cycle = 0; cycle < 32; cycle++) {
v=cycle_diagram_table[fm][res][planes][cycle];
if (v==0) aa='-'; else if(v>0) aa='1'; else aa='X';
- write_log ("%c",aa);
+ write_log (L"%c",aa);
}
- write_log (" %d:%d\n",
+ write_log (L" %d:%d\n",
cycle_diagram_free_cycles[fm][res][planes], cycle_diagram_total_cycles[fm][res][planes]);
}
- write_log ("\n");
+ write_log (L"\n");
}
}
fm=0;
delayoffset = 16;
else /* what about 40 and 56? */
delayoffset = 0;
- //write_log ("%d:%d ", vpos, delayoffset);
+ //write_log (L"%d:%d ", vpos, delayoffset);
#endif
}
toscr_nbits += 2 << toscr_res;
if (toscr_nbits > 16) {
- uae_abort ("toscr_nbits > 16 (%d)", toscr_nbits);
+ uae_abort (L"toscr_nbits > 16 (%d)", toscr_nbits);
toscr_nbits = 0;
}
if (toscr_nbits == 16)
case 1: return one_fetch_cycle_fm1 (pos, ddfstop_to_test, dma);
case 2: return one_fetch_cycle_fm2 (pos, ddfstop_to_test, dma);
#endif
- default: uae_abort ("fm corrupt"); return 0;
+ default: uae_abort (L"fm corrupt"); return 0;
}
}
case 1: update_fetch_1 (hpos); break;
case 2: update_fetch_2 (hpos); break;
#endif
- default: uae_abort ("fetchmode corrupt");
+ default: uae_abort (L"fetchmode corrupt");
}
}
last_fetch_hpos = hpos;
{
static int olx;
if (clxdat != olx)
- write_log ("%d: %04X\n", vpos, clxdat);
+ write_log (L"%d: %04X\n", vpos, clxdat);
olx = clxdat;
}
#endif
}
if (sprxp < e->pos)
- uae_abort ("sprxp < e->pos");
+ uae_abort (L"sprxp < e->pos");
e->max = sprxp + width;
e[1].first_pixel = e->first_pixel + ((e->max - e->pos + 3) & ~3);
if (thisline_decision.plfleft != -1 && thisline_decision.plflinelen == -1) {
if (fetch_state != fetch_not_started) {
- write_log ("fetch_state=%d plfleft=%d,len=%d,vpos=%d,hpos=%d\n",
+ write_log (L"fetch_state=%d plfleft=%d,len=%d,vpos=%d,hpos=%d\n",
fetch_state, thisline_decision.plfleft, thisline_decision.plflinelen,
vpos, hpos);
- uae_abort ("fetch_state != fetch_not_started");
+ uae_abort (L"fetch_state != fetch_not_started");
}
thisline_decision.plfright = thisline_decision.plfleft;
thisline_decision.plflinelen = 0;
if (cnt < 0)
return;
cnt--;
- write_log ("BEAMCON0=%04X VTOTAL=%04X HTOTAL=%04X\n", new_beamcon0, vtotal, htotal);
- write_log ("HSSTOP=%04X HBSTRT=%04X HBSTOP=%04X\n", hsstop, hbstrt, hbstop);
- write_log ("VSSTOP=%04X VBSTRT=%04X VBSTOP=%04X\n", vsstop, vbstrt, vbstop);
- write_log ("HSSTRT=%04X VSSTRT=%04X HCENTER=%04X\n", hsstrt, vsstrt, hcenter);
+ write_log (L"BEAMCON0=%04X VTOTAL=%04X HTOTAL=%04X\n", new_beamcon0, vtotal, htotal);
+ write_log (L"HSSTOP=%04X HBSTRT=%04X HBSTOP=%04X\n", hsstop, hbstrt, hbstop);
+ write_log (L"VSSTOP=%04X VBSTRT=%04X VBSTOP=%04X\n", vsstop, vbstrt, vbstop);
+ write_log (L"HSSTRT=%04X VSSTRT=%04X HCENTER=%04X\n", hsstrt, vsstrt, hcenter);
}
/* set PAL/NTSC or custom timing variables */
hzc = 1;
if (beamcon0 != new_beamcon0) {
hack_vpos = 0;
- write_log ("BEAMCON0 %04x -> %04x\n", beamcon0, new_beamcon0);
+ write_log (L"BEAMCON0 %04x -> %04x\n", beamcon0, new_beamcon0);
}
if (beamcon0 & 0x80)
hack_vpos = -1;
init_hz_p96 ();
#endif
inputdevice_tablet_strobe ();
- write_log ("%s mode%s%s V=%dHz H=%dHz (%dx%d)\n",
- isntsc ? "NTSC" : "PAL",
- (bplcon0 & 4) ? " interlaced" : "",
- doublescan > 0 ? " dblscan" : "",
+ write_log (L"%s mode%s%s V=%dHz H=%dHz (%dx%d)\n",
+ isntsc ? L"NTSC" : L"PAL",
+ (bplcon0 & 4) ? L" interlaced" : L"",
+ doublescan > 0 ? L" dblscan" : L"",
vblank_hz, vblank_hz * maxvpos,
maxhpos, maxvpos);
}
vp &= 1;
vp = vp | (lof ? 0x8000 : 0) | csbit;
#if 0
- write_log ("VPOSR %04x at %08x\n", vp, M68K_GETPC);
+ write_log (L"VPOSR %04x at %08x\n", vp, M68K_GETPC);
#endif
if (currprefs.cpu_model >= 68020)
hsyncdelay ();
static void VPOSW (uae_u16 v)
{
#if 0
- write_log ("VPOSW %d PC=%08x\n", v, M68K_GETPC);
+ write_log (L"VPOSW %d PC=%08x\n", v, M68K_GETPC);
#endif
if (lof != ((v & 0x8000) ? 1 : 0))
lof_changed = 1;
if (currprefs.cpu_model >= 68020)
hsyncdelay ();
#if 0
- write_log ("VPOS %04x %04x at %08x\n", VPOSR(), vp, M68K_GETPC);
+ write_log (L"VPOS %04x %04x at %08x\n", VPOSR(), vp, M68K_GETPC);
if (M68K_GETPC == 0x40e6) {
activate_debugger();
}
setclr (&intena,v);
#if 0
if (v & 0x40)
- write_log ("INTENA %04X (%04X) %p\n", intena, v, M68K_GETPC);
+ write_log (L"INTENA %04X (%04X) %p\n", intena, v, M68K_GETPC);
#endif
if (v & 0x8000) {
if (!use_eventmode ())
if (v != new_beamcon0) {
new_beamcon0 = v;
if (v & ~0x20)
- write_log ("warning: %04X written to BEAMCON0 PC=%08X\n", v, M68K_GETPC);
+ write_log (L"warning: %04X written to BEAMCON0 PC=%08X\n", v, M68K_GETPC);
}
}
}
decide_fetch (hpos);
bplpt[num] = (bplpt[num] & 0x0000ffff) | ((uae_u32)v << 16);
bplptx[num] = (bplptx[num] & 0x0000ffff) | ((uae_u32)v << 16);
- //write_log ("%d:%d:BPL%dPTH %08X COP=%08x\n", hpos, vpos, num, bplpt[num], cop_state.ip);
+ //write_log (L"%d:%d:BPL%dPTH %08X COP=%08x\n", hpos, vpos, num, bplpt[num], cop_state.ip);
}
static void BPLxPTL (int hpos, uae_u16 v, int num)
{
}
bplpt[num] = (bplpt[num] & 0xffff0000) | ((v + delta) & 0x0000fffe);
bplptx[num] = (bplptx[num] & 0xffff0000) | ((v + delta) & 0x0000fffe);
- //write_log ("%d:%d:BPL%dPTL %08X COP=%08x\n", hpos, vpos, num, bplpt[num], cop_state.ip);
+ //write_log (L"%d:%d:BPL%dPTL %08X COP=%08x\n", hpos, vpos, num, bplpt[num], cop_state.ip);
}
static int isehb (uae_u16 bplcon0, uae_u16 bplcon2)
static int last_warned;
last_warned = (last_warned + 1) & 4095;
if (last_warned == 0)
- write_log ("WARNING! Very strange DDF values (%x %x).\n", ddfstrt, ddfstop);
+ write_log (L"WARNING! Very strange DDF values (%x %x).\n", ddfstrt, ddfstop);
}
}
if (ddfstop > 0xD4 && (ddfstrt & 4) == 4) {
static int last_warned;
if (last_warned == 0)
- write_log ("WARNING! Very strange DDF values (%x).\n", ddfstop);
+ write_log (L"WARNING! Very strange DDF values (%x).\n", ddfstop);
last_warned = (last_warned + 1) & 4095;
}
}
SPRxCTLPOS (num);
#if SPRITE_DEBUG > 0
if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) {
- write_log ("%d:%d:SPR%dCTL %04X P=%06X VSTRT=%d VSTOP=%d HSTRT=%d D=%d A=%d CP=%x PC=%x\n",
+ write_log (L"%d:%d:SPR%dCTL %04X P=%06X VSTRT=%d VSTOP=%d HSTRT=%d D=%d A=%d CP=%x PC=%x\n",
vpos, hpos, num, v, s->pt, s->vstart, s->vstop, s->xpos, spr[num].dmastate, spr[num].armed, cop_state.ip, M68K_GETPC);
}
#endif
SPRxCTLPOS (num);
#if SPRITE_DEBUG > 0
if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) {
- write_log ("%d:%d:SPR%dPOS %04X P=%06X VSTRT=%d VSTOP=%d HSTRT=%d D=%d A=%d CP=%x PC=%x\n",
+ write_log (L"%d:%d:SPR%dPOS %04X P=%06X VSTRT=%d VSTOP=%d HSTRT=%d D=%d A=%d CP=%x PC=%x\n",
vpos, hpos, num, v, s->pt, s->vstart, s->vstop, s->xpos, spr[num].dmastate, spr[num].armed, cop_state.ip, M68K_GETPC);
}
#endif
spr_arm (num, 1);
#if SPRITE_DEBUG > 1
if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) {
- write_log ("%d:%d:SPR%dDATA %04X P=%06X D=%d A=%d PC=%x\n",
+ write_log (L"%d:%d:SPR%dDATA %04X P=%06X D=%d A=%d PC=%x\n",
vpos, hpos, num, v, spr[num].pt, spr[num].dmastate, spr[num].armed, M68K_GETPC);
}
#endif
#endif
#if SPRITE_DEBUG > 1
if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) {
- write_log ("%d:%d:SPR%dDATB %04X P=%06X D=%d A=%d PC=%x\n",
+ write_log (L"%d:%d:SPR%dDATB %04X P=%06X D=%d A=%d PC=%x\n",
vpos, hpos, num, v, spr[num].pt, spr[num].dmastate, spr[num].armed, M68K_GETPC);
}
#endif
spr[num].pt |= (uae_u32)v << 16;
#if SPRITE_DEBUG > 0
if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) {
- write_log ("%d:%d:SPR%dPTH %06X\n", vpos, hpos, num, spr[num].pt);
+ write_log (L"%d:%d:SPR%dPTH %06X\n", vpos, hpos, num, spr[num].pt);
}
#endif
}
spr[num].pt |= v;
#if SPRITE_DEBUG > 0
if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) {
- write_log ("%d:%d:SPR%dPTL %06X\n", vpos, hpos, num, spr[num].pt);
+ write_log (L"%d:%d:SPR%dPTL %06X\n", vpos, hpos, num, spr[num].pt);
}
#endif
}
rgb2 = current_colors.color_regs_aga[c2] | (color_regs_aga_genlock[c2] << 31);
rgb3 = current_colors.color_regs_aga[c3] | (color_regs_aga_genlock[c3] << 31);
rgb4 = current_colors.color_regs_aga[c4] | (color_regs_aga_genlock[c4] << 31);
- console_out_f ("%3d %08X %3d %08X %3d %08X %3d %08X\n",
+ console_out_f (L"%3d %08X %3d %08X %3d %08X %3d %08X\n",
c1, rgb1, c2, rgb2, c3, rgb3, c4, rgb4);
}
}
cop_state.last_write_hpos = old_hpos;
old_hpos++;
if (!nocustom () && address >= 0x140 && address < 0x180 && old_hpos >= SPR0_HPOS && old_hpos < SPR0_HPOS + 4 * MAX_SPRITES) {
- //write_log ("%d:%d %04X:%04X\n", vpos, old_hpos, cop_state.saved_i1, cop_state.saved_i2);
+ //write_log (L"%d:%d %04X:%04X\n", vpos, old_hpos, cop_state.saved_i1, cop_state.saved_i2);
do_sprites (old_hpos);
}
}
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};
-static void dump_copper (char *error, int until_hpos)
+static void dump_copper (TCHAR *error, int until_hpos)
{
- write_log ("%s: vpos=%d until_hpos=%d\n",
+ write_log (L"%s: vpos=%d until_hpos=%d\n",
error, vpos, until_hpos);
- write_log ("cvcmp=%d chcmp=%d chpos=%d cvpos=%d ci1=%04X ci2=%04X\n",
+ write_log (L"cvcmp=%d chcmp=%d chpos=%d cvpos=%d ci1=%04X ci2=%04X\n",
cop_state.vcmp,cop_state.hcmp,cop_state.hpos,cop_state.vpos,cop_state.saved_i1,cop_state.saved_i2);
- write_log ("cstate=%d ip=%x SPCFLAGS=%x\n",
+ write_log (L"cstate=%d ip=%x SPCFLAGS=%x\n",
cop_state.state, cop_state.ip, regs.spcflags);
}
return;
if (cop_state.state == COP_wait && vp < cop_state.vcmp) {
- dump_copper ("error2", until_hpos);
+ dump_copper (L"error2", until_hpos);
copper_enabled_thisline = 0;
cop_state.state = COP_stop;
unset_special (®s, SPCFLAG_COPPER);
#endif
#if SPRITE_DEBUG > 3
if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY)
- write_log ("%d:%d:slot%d:%d\n", vpos, hpos, num, cycle);
+ write_log (L"%d:%d:slot%d:%d\n", vpos, hpos, num, cycle);
#endif
if (vpos == s->vstart) {
#if SPRITE_DEBUG > 0
if (!s->dmastate && vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY)
- write_log ("%d:%d:SPR%d START\n", vpos, hpos, num);
+ write_log (L"%d:%d:SPR%d START\n", vpos, hpos, num);
#endif
s->dmastate = 1;
if (num == 0 && cycle == 0)
if (vpos == s->vstop || vpos == sprite_vblank_endline) {
#if SPRITE_DEBUG > 0
if (s->dmastate && vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY)
- write_log ("%d:%d:SPR%d STOP\n", vpos, hpos, num);
+ write_log (L"%d:%d:SPR%d STOP\n", vpos, hpos, num);
#endif
s->dmastate = 0;
#if 1
}
#if SPRITE_DEBUG > 1
if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) {
- write_log ("%d:%d:dma:P=%06X ", vpos, hpos, s->pt);
+ write_log (L"%d:%d:dma:P=%06X ", vpos, hpos, s->pt);
}
#endif
- //write_log ("%d:%d: %04X=%04X\n", vpos, hpos, 0x140 + cycle * 2 + num * 8, data);
+ //write_log (L"%d:%d: %04X=%04X\n", vpos, hpos, 0x140 + cycle * 2 + num * 8, data);
if (cycle == 0) {
SPRxPOS_1 (data, num, hpos);
s->dmacycle = 1;
data = sprite_fetch (s, dma, hpos, cycle, 1);
#if SPRITE_DEBUG > 1
if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) {
- write_log ("%d:%d:dma:P=%06X ", vpos, hpos, s->pt);
+ write_log (L"%d:%d:dma:P=%06X ", vpos, hpos, s->pt);
}
#endif
if (cycle == 0) {
memset (&sprite_entries[0][max_sprite_entry], (mcc - max_sprite_entry) * sizeof(struct sprite_entry), 0);
memset (&sprite_entries[1][max_sprite_entry], (mcc - max_sprite_entry) * sizeof(struct sprite_entry), 0);
- write_log ("New max_sprite_entry=%d\n", mcc);
+ write_log (L"New max_sprite_entry=%d\n", mcc);
max_sprite_entry = mcc;
} else
- write_log ("WARNING: Failed to enlarge sprite_entries table\n");
+ write_log (L"WARNING: Failed to enlarge sprite_entries table\n");
}
if (delta_color_change) {
void *p1;
color_changes[0] = p1;
color_changes[1] = p2;
- write_log ("New max_color_change=%d\n", mcc);
+ write_log (L"New max_color_change=%d\n", mcc);
max_color_change = mcc;
} else
- write_log ("WARNING: Failed to enlarge color_changes table\n");
+ write_log (L"WARNING: Failed to enlarge color_changes table\n");
}
#endif
}
int vp = vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80);
if (vp < cop_state.vcmp) {
if (copper_enabled_thisline)
- write_log ("COPPER BUG %d: vp=%d vpos=%d vcmp=%d act=%d thisline=%d\n", n, vp, vpos, cop_state.vcmp, copper_enabled_thisline);
+ write_log (L"COPPER BUG %d: vp=%d vpos=%d vcmp=%d act=%d thisline=%d\n", n, vp, vpos, cop_state.vcmp, copper_enabled_thisline);
}
}
}
inprec_pend();
}
if (v != ciavsync_counter)
- write_log ("INPREC: ciavsync sync error %d <> %d\n", v, ciavsync_counter);
+ write_log (L"INPREC: ciavsync sync error %d <> %d\n", v, ciavsync_counter);
}
#endif
ciavsync_counter++;
inprec_pend();
}
if (v != vsync_counter)
- write_log ("INPREC: vsync sync error %d <> %d\n", v, vsync_counter);
+ write_log (L"INPREC: vsync sync error %d <> %d\n", v, vsync_counter);
}
#endif
vsync_counter++;
while (input_recording < 0 && inprec_pstart (INPREC_DISKINSERT)) {
int drv = inprec_pu8 ();
inprec_pstr (currprefs.df[drv]);
- strcpy (changed_prefs.df[drv], currprefs.df[drv]);
+ _tcscpy (changed_prefs.df[drv], currprefs.df[drv]);
disk_insert_force (drv, currprefs.df[drv]);
inprec_pend ();
}
}
}
if (no == ev2_max) {
- write_log ("out of event2's! PC=%x\n", M68K_GETPC);
+ write_log (L"out of event2's! PC=%x\n", M68K_GETPC);
return;
}
}
int zero = 0;
reset_all_systems ();
- write_log ("Reset at %08X\n", m68k_getpc (®s));
+ write_log (L"Reset at %08X\n", m68k_getpc (®s));
memory_map_dump();
hsync_counter = 0;
CLXCON (clxcon);
CLXCON2 (clxcon2);
calcdiw ();
- write_log ("State restored\n");
+ write_log (L"State restored\n");
for (i = 0; i < 8; i++)
nr_armed += spr[i].armed != 0;
if (! currprefs.produce_sound) {
void dumpcustom (void)
{
- console_out_f ("DMACON: %x INTENA: %x INTREQ: %x VPOS: %x HPOS: %x\n", DMACONR(),
+ console_out_f (L"DMACON: %x INTENA: %x INTREQ: %x VPOS: %x HPOS: %x\n", DMACONR(),
(unsigned int)intena, (unsigned int)intreq, (unsigned int)vpos, (unsigned int)current_hpos());
- console_out_f ("COP1LC: %08lx, COP2LC: %08lx COPPTR: %08lx\n", (unsigned long)cop1lc, (unsigned long)cop2lc, cop_state.ip);
- console_out_f ("DIWSTRT: %04x DIWSTOP: %04x DDFSTRT: %04x DDFSTOP: %04x\n",
+ console_out_f (L"COP1LC: %08lx, COP2LC: %08lx COPPTR: %08lx\n", (unsigned long)cop1lc, (unsigned long)cop2lc, cop_state.ip);
+ console_out_f (L"DIWSTRT: %04x DIWSTOP: %04x DDFSTRT: %04x DDFSTOP: %04x\n",
(unsigned int)diwstrt, (unsigned int)diwstop, (unsigned int)ddfstrt, (unsigned int)ddfstop);
- console_out_f ("BPLCON 0: %04x 1: %04x 2: %04x 3: %04x 4: %04x\n", bplcon0, bplcon1, bplcon2, bplcon3, bplcon4);
+ console_out_f (L"BPLCON 0: %04x 1: %04x 2: %04x 3: %04x 4: %04x\n", bplcon0, bplcon1, bplcon2, bplcon3, bplcon4);
if (timeframes) {
- console_out_f ("Average frame time: %.2f ms [frames: %d time: %d]\n",
+ console_out_f (L"Average frame time: %.2f ms [frames: %d time: %d]\n",
(double)frametime / timeframes, timeframes, frametime);
if (total_skipped)
- console_out_f ("Skipped frames: %d\n", total_skipped);
+ console_out_f (L"Skipped frames: %d\n", total_skipped);
}
}
addrbank custom_bank = {
custom_lget, custom_wget, custom_bget,
custom_lput, custom_wput, custom_bput,
- default_xlate, default_check, NULL, "Custom chipset",
+ default_xlate, default_check, NULL, L"Custom chipset",
custom_lgeti, custom_wgeti, ABFLAG_IO
};
#endif
addr &= 0xfff;
#ifdef CUSTOM_DEBUG
- write_log ("%d:%d:wget: %04X=%04X pc=%p\n", current_hpos(), vpos, addr, addr & 0x1fe, m68k_getpc ());
+ write_log (L"%d:%d:wget: %04X=%04X pc=%p\n", current_hpos(), vpos, addr, addr & 0x1fe, m68k_getpc ());
#endif
switch (addr & 0x1fe) {
case 0x002: v = DMACONR (); break;
special_mem |= S_WRITE;
#endif
#ifdef CUSTOM_DEBUG
- write_log ("%d:%d:wput: %04X %04X pc=%p\n", hpos, vpos, addr & 0x01fe, value & 0xffff, m68k_getpc ());
+ write_log (L"%d:%d:wput: %04X %04X pc=%p\n", hpos, vpos, addr & 0x01fe, value & 0xffff, m68k_getpc ());
#endif
sync_copper_with_cpu (hpos, 1);
if (addr & 1) {
}
if (warned < 10) {
if (M68K_GETPC < 0xe00000 || M68K_GETPC >= 0x10000000) {
- write_log ("Byte put to custom register %04X PC=%08X\n", addr, M68K_GETPC);
+ write_log (L"Byte put to custom register %04X PC=%08X\n", addr, M68K_GETPC);
warned++;
}
}
int debug_sprite_mask = 0xff;
static uaecptr processptr;
-static char *processname;
+static uae_char *processname;
static uaecptr debug_copper_pc;
debugging = 0;
exception_debugging = 0;
processptr = 0;
- xfree(processname);
+ xfree (processname);
processname = NULL;
}
int lasthist = 0;
static struct regstruct history[MAX_HIST];
-static char help[] = {
- " HELP for UAE Debugger\n"
- " -----------------------\n\n"
- " g [<address>] Start execution at the current address or <address>\n"
- " c Dump state of the CIA, disk drives and custom registers\n"
- " r Dump state of the CPU\n"
- " r <reg> <value> Modify CPU registers (Dx,Ax,USP,ISP,VBR,...)\n"
- " m <address> [<lines>] Memory dump starting at <address>\n"
- " m r<register> Memory dump starting at <register>\n"
- " d <address> [<lines>] Disassembly starting at <address>\n"
- " t [instructions] Step one or more instructions\n"
- " z Step through one instruction - useful for JSR, DBRA etc\n"
- " f Step forward until PC in RAM (\"boot block finder\")\n"
- " f <address> Add/remove breakpoint\n"
- " fa <address> [<start>] [<end>]\n"
- " Find effective address <address>\n"
- " fi Step forward until PC points to RTS/RTD or RTE\n"
- " fi <opcode> Step forward until PC points to <opcode>\n"
- " fp \"<name>\"/<addr> Step forward until process <name> or <addr> is active\n"
- " fl List breakpoints\n"
- " fd Remove all breakpoints\n"
- " fs <val> <mask> Break when (SR & mask) = val\n"
- " f <addr1> <addr2> Step forward until <addr1> <= PC <= <addr2>\n"
- " e Dump contents of all custom registers, ea = AGA colors\n"
- " i [<addr>] Dump contents of interrupt and trap vectors\n"
- " o <0-2|addr> [<lines>]View memory as Copper instructions\n"
- " od Enable/disable Copper vpos/hpos tracing\n"
- " ot Copper single step trace\n"
- " ob <addr> Copper breakpoint\n"
- " O Display bitplane offsets\n"
- " O <plane> <offset> Offset a bitplane\n"
- " H[H] <cnt> Show PC history (HH=full CPU info) <cnt> instructions\n"
- " C <value> Search for values like energy or lifes in games\n"
- " Cl List currently found trainer addresses\n"
- " D[idxzs <[max diff]>] Deep trainer. i=new value must be larger, d=smaller,\n"
- " x = must be same, z = must be different, s = restart.\n"
- " W <address> <value> Write into Amiga memory\n"
- " w <num> <address> <length> <R/W/I/F> [<value>] (read/write/opcode/freeze)\n"
- " Add/remove memory watchpoints\n"
- " wd [<0-1>] Enable illegal access logger. 1 = enable break.\n"
- " S <file> <addr> <n> Save a block of Amiga memory\n"
- " s \"<string>\"/<values> [<addr>] [<length>]\n"
- " Search for string/bytes\n"
- " T Show exec tasks and their PCs\n"
- " b Step to previous state capture position\n"
- " M<a/b/s> <val> Enable or disable audio channels, bitplanes or sprites\n"
- " sp <addr> [<addr2][<size>] Dump sprite information\n"
- " di <mode> [<track>] Break on disk access. R=DMA read,W=write,RW=both,P=PIO\n"
- " Also enables level 1 disk logging\n"
- " did <log level> Enable disk logging\n"
- " dj [<level bitmask>] Enable joystick/mouse input debugging\n"
- " smc [<0-1>] Enable self-modifying code detector. 1 = enable break.\n"
- " dm Dump current address space map\n"
- " ?<value> Hex/Bin/Dec converter\n"
+static TCHAR help[] = {
+ L" HELP for UAE Debugger\n"
+ L" -----------------------\n\n"
+ L" g [<address>] Start execution at the current address or <address>\n"
+ L" c Dump state of the CIA, disk drives and custom registers\n"
+ L" r Dump state of the CPU\n"
+ L" r <reg> <value> Modify CPU registers (Dx,Ax,USP,ISP,VBR,...)\n"
+ L" m <address> [<lines>] Memory dump starting at <address>\n"
+ L" m r<register> Memory dump starting at <register>\n"
+ L" d <address> [<lines>] Disassembly starting at <address>\n"
+ L" t [instructions] Step one or more instructions\n"
+ L" z Step through one instruction - useful for JSR, DBRA etc\n"
+ L" f Step forward until PC in RAM (\"boot block finder\")\n"
+ L" f <address> Add/remove breakpoint\n"
+ L" fa <address> [<start>] [<end>]\n"
+ L" Find effective address <address>\n"
+ L" fi Step forward until PC points to RTS/RTD or RTE\n"
+ L" fi <opcode> Step forward until PC points to <opcode>\n"
+ L" fp \"<name>\"/<addr> Step forward until process <name> or <addr> is active\n"
+ L" fl List breakpoints\n"
+ L" fd Remove all breakpoints\n"
+ L" fs <val> <mask> Break when (SR & mask) = val\n"
+ L" f <addr1> <addr2> Step forward until <addr1> <= PC <= <addr2>\n"
+ L" e Dump contents of all custom registers, ea = AGA colors\n"
+ L" i [<addr>] Dump contents of interrupt and trap vectors\n"
+ L" o <0-2|addr> [<lines>]View memory as Copper instructions\n"
+ L" od Enable/disable Copper vpos/hpos tracing\n"
+ L" ot Copper single step trace\n"
+ L" ob <addr> Copper breakpoint\n"
+ L" O Display bitplane offsets\n"
+ L" O <plane> <offset> Offset a bitplane\n"
+ L" H[H] <cnt> Show PC history (HH=full CPU info) <cnt> instructions\n"
+ L" C <value> Search for values like energy or lifes in games\n"
+ L" Cl List currently found trainer addresses\n"
+ L" D[idxzs <[max diff]>] Deep trainer. i=new value must be larger, d=smaller,\n"
+ L" x = must be same, z = must be different, s = restart.\n"
+ L" W <address> <value> Write into Amiga memory\n"
+ L" w <num> <address> <length> <R/W/I/F> [<value>] (read/write/opcode/freeze)\n"
+ L" Add/remove memory watchpoints\n"
+ L" wd [<0-1>] Enable illegal access logger. 1 = enable break.\n"
+ L" S <file> <addr> <n> Save a block of Amiga memory\n"
+ L" s \"<string>\"/<values> [<addr>] [<length>]\n"
+ L" Search for string/bytes\n"
+ L" T Show exec tasks and their PCs\n"
+ L" b Step to previous state capture position\n"
+ L" M<a/b/s> <val> Enable or disable audio channels, bitplanes or sprites\n"
+ L" sp <addr> [<addr2][<size>] Dump sprite information\n"
+ L" di <mode> [<track>] Break on disk access. R=DMA read,W=write,RW=both,P=PIO\n"
+ L" Also enables level 1 disk logging\n"
+ L" did <log level> Enable disk logging\n"
+ L" dj [<level bitmask>] Enable joystick/mouse input debugging\n"
+ L" smc [<0-1>] Enable self-modifying code detector. 1 = enable break.\n"
+ L" dm Dump current address space map\n"
+ L" ?<value> Hex/Bin/Dec converter\n"
#ifdef _WIN32
- " x Close debugger.\n"
- " xx Switch between console and GUI debugger.\n"
- " mg <address> Memory dump starting at <address> in GUI\n"
- " dg <address> Disassembly starting at <address> in GUI\n"
+ L" x Close debugger.\n"
+ L" xx Switch between console and GUI debugger.\n"
+ L" mg <address> Memory dump starting at <address> in GUI\n"
+ L" dg <address> Disassembly starting at <address> in GUI\n"
#endif
- " q Quit the emulator. You don't want to use this command.\n\n"
+ L" q Quit the emulator. You don't want to use this command.\n\n"
};
void debug_help (void)
static int debug_linecounter;
#define MAX_LINECOUNTER 1000
-static int debug_out (const char *format, ...)
+static int debug_out (const TCHAR *format, ...)
{
va_list parms;
- char buffer[4000];
+ TCHAR buffer[4000];
va_start (parms, format);
- _vsnprintf (buffer, 4000 - 1, format, parms);
+ _vsntprintf (buffer, 4000 - 1, format, parms);
va_end (parms);
console_out (buffer);
return 1;
}
-static void ignore_ws (char **c)
+static void ignore_ws (TCHAR **c)
{
- while (**c && isspace(**c))
+ while (**c && _istspace(**c))
(*c)++;
}
-static uae_u32 readint (char **c);
-static uae_u32 readbin (char **c);
-static uae_u32 readhex (char **c);
+static uae_u32 readint (TCHAR **c);
+static uae_u32 readbin (TCHAR **c);
+static uae_u32 readhex (TCHAR **c);
-static int readregx (char **c, uae_u32 *valp)
+static int readregx (TCHAR **c, uae_u32 *valp)
{
int i;
uae_u32 addr;
- char *p = *c;
- char tmp[10];
+ TCHAR *p = *c;
+ TCHAR tmp[10];
int extra = 0;
addr = 0;
i = 0;
while (p[i]) {
- tmp[i] = toupper(p[i]);
+ tmp[i] = _totupper(p[i]);
if (i >= sizeof (tmp) - 1)
break;
i++;
}
tmp[i] = 0;
- if (toupper (tmp[0]) == 'R') {
+ if (_totupper (tmp[0]) == 'R') {
memmove (tmp, tmp + 1, sizeof (tmp) - 1);
extra = 1;
}
- if (!strcmp(tmp, "USP")) {
+ if (!_tcscmp (tmp, L"USP")) {
addr = regs.usp;
(*c) += 3;
- } else if (!strcmp(tmp, "VBR")) {
+ } else if (!_tcscmp (tmp, L"VBR")) {
addr = regs.vbr;
(*c) += 3;
- } else if (!strcmp(tmp, "MSP")) {
+ } else if (!_tcscmp (tmp, L"MSP")) {
addr = regs.msp;
(*c) += 3;
- } else if (!strcmp(tmp, "ISP")) {
+ } else if (!_tcscmp (tmp, L"ISP")) {
addr = regs.isp;
(*c) += 3;
- } else if (!strcmp(tmp, "PC")) {
+ } else if (!_tcscmp (tmp, L"PC")) {
addr = regs.pc;
(*c) += 2;
} else if (tmp[0] == 'A' || tmp[0] == 'D') {
return 1;
}
-static uae_u32 readbinx (char **c)
+static uae_u32 readbinx (TCHAR **c)
{
uae_u32 val = 0;
ignore_ws (c);
for (;;) {
- char nc = **c;
+ TCHAR nc = **c;
if (nc != '1' && nc != '0')
break;
(*c)++;
return val;
}
-static uae_u32 readhexx (char **c)
+static uae_u32 readhexx (TCHAR **c)
{
uae_u32 val = 0;
- char nc;
+ TCHAR nc;
ignore_ws (c);
while (isxdigit (nc = **c)) {
(*c)++;
val *= 16;
- nc = toupper (nc);
+ nc = _totupper (nc);
if (isdigit (nc)) {
val += nc - '0';
} else {
return val;
}
-static uae_u32 readintx (char **c)
+static uae_u32 readintx (TCHAR **c)
{
uae_u32 val = 0;
- char nc;
+ TCHAR nc;
int negative = 0;
ignore_ws (c);
}
-static int checkvaltype (char **c, uae_u32 *val)
+static int checkvaltype (TCHAR **c, uae_u32 *val)
{
- char nc;
+ TCHAR nc;
ignore_ws (c);
- nc = toupper (**c);
+ nc = _totupper (**c);
if (nc == '!') {
(*c)++;
*val = readintx (c);
*val = readhexx (c);
return 1;
}
- if (nc == '0' && toupper ((*c)[1]) == 'X') {
+ if (nc == '0' && _totupper ((*c)[1]) == 'X') {
(*c)+= 2;
*val = readhexx (c);
return 1;
return 0;
}
-static uae_u32 readint (char **c)
+static uae_u32 readint (TCHAR **c)
{
uae_u32 val;
if (checkvaltype (c, &val))
return val;
return readintx (c);
}
-static uae_u32 readhex (char **c)
+static uae_u32 readhex (TCHAR **c)
{
uae_u32 val;
if (checkvaltype (c, &val))
return val;
return readhexx (c);
}
-static uae_u32 readbin (char **c)
+static uae_u32 readbin (TCHAR **c)
{
uae_u32 val;
if (checkvaltype (c, &val))
return readbinx (c);
}
-static char next_char(char **c)
+static TCHAR next_char(TCHAR **c)
{
ignore_ws (c);
return *(*c)++;
}
-static char peek_next_char(char **c)
+static TCHAR peek_next_char(TCHAR **c)
{
- char *pc = *c;
+ TCHAR *pc = *c;
return pc[1];
}
-static int more_params (char **c)
+static int more_params (TCHAR **c)
{
ignore_ws (c);
return (**c) != 0;
}
-static int next_string (char **c, char *out, int max, int forceupper)
+static int next_string (TCHAR **c, TCHAR *out, int max, int forceupper)
{
- char *p = out;
+ TCHAR *p = out;
int startmarker = 0;
if (**c == '\"') {
}
*p = next_char (c);
if (forceupper)
- *p = toupper(*p);
+ *p = _totupper(*p);
*++p = 0;
max--;
if (max <= 1)
break;
}
- return strlen (out);
+ return _tcslen (out);
}
-static void converter (char **c)
+static void converter (TCHAR **c)
{
uae_u32 v = readint (c);
- char s[100];
- char *p = s;
+ TCHAR s[100];
+ TCHAR *p = s;
int i;
for (i = 0; i < 32; i++)
s[i] = (v & (1 << (31 - i))) ? '1' : '0';
s[i] = 0;
- console_out_f ("0x%08X = %%%s = %u = %d\n", v, s, v, (uae_s32)v);
+ console_out_f (L"0x%08X = %%%s = %u = %d\n", v, s, v, (uae_s32)v);
}
int notinrom (void)
return 0;
}
-uaecptr dumpmem2 (uaecptr addr, char *out, int osize)
+uaecptr dumpmem2 (uaecptr addr, TCHAR *out, int osize)
{
int i, cols = 8;
int nonsafe = 0;
if (osize <= (9 + cols * 5 + 1 + 2 * cols))
return addr;
- sprintf (out, "%08lX ", addr);
+ _stprintf (out, L"%08lX ", addr);
for (i = 0; i < cols; i++) {
uae_u8 b1, b2;
b1 = b2 = 0;
if (safe_addr(addr, 2)) {
b1 = get_byte (addr + 0);
b2 = get_byte (addr + 1);
- sprintf (out + 9 + i * 5, "%02X%02X ", b1, b2);
+ _stprintf (out + 9 + i * 5, L"%02X%02X ", b1, b2);
out[9 + cols * 5 + 1 + i * 2 + 0] = b1 >= 32 && b1 < 127 ? b1 : '.';
out[9 + cols * 5 + 1 + i * 2 + 1] = b2 >= 32 && b2 < 127 ? b2 : '.';
} else {
nonsafe++;
- strcpy (out + 9 + i * 5, "**** ");
+ _tcscpy (out + 9 + i * 5, L"**** ");
out[9 + cols * 5 + 1 + i * 2 + 0] = '*';
out[9 + cols * 5 + 1 + i * 2 + 1] = '*';
}
if (nonsafe == cols) {
addrbank *ab = &get_mem_bank (addr);
if (ab->name)
- memcpy (out + 9 + 4 + 1, ab->name, strlen (ab->name));
+ memcpy (out + 9 + 4 + 1, ab->name, _tcslen (ab->name));
}
return addr;
}
static void dumpmem (uaecptr addr, uaecptr *nxmem, int lines)
{
- char line[MAX_LINEWIDTH + 1];
+ TCHAR line[MAX_LINEWIDTH + 1];
for (;lines--;) {
addr = dumpmem2 (addr, line, sizeof(line));
- debug_out ("%s", line);
- if (!debug_out ("\n"))
+ debug_out (L"%s", line);
+ if (!debug_out (L"\n"))
break;
}
*nxmem = addr;
addr2 = custd[j].adr & 0x1ff;
v1 = (p1[addr1 + 0] << 8) | p1[addr1 + 1];
v2 = (p1[addr2 + 0] << 8) | p1[addr2 + 1];
- console_out_f ("%03X %s\t%04X\t%03X %s\t%04X\n",
+ console_out_f (L"%03X %s\t%04X\t%03X %s\t%04X\n",
addr1, custd[i].name, v1,
addr2, custd[j].name, v2);
}
while (int_labels[i].name || trap_labels[j].name) {
if (int_labels[i].name) {
- console_out_f ("$%08X: %s \t $%08X\t", int_labels[i].adr + addr,
+ console_out_f (L"$%08X: %s \t $%08X\t", int_labels[i].adr + addr,
int_labels[i].name, get_long (int_labels[i].adr + addr));
i++;
} else {
- console_out ("\t\t\t\t");
+ console_out (L"\t\t\t\t");
}
if (trap_labels[j].name) {
- console_out_f ("$%08X: %s \t $%08X", trap_labels[j].adr + addr,
+ console_out_f (L"$%08X: %s \t $%08X", trap_labels[j].adr + addr,
trap_labels[j].name, get_long (trap_labels[j].adr + addr));
j++;
}
- console_out ("\n");
+ console_out (L"\n");
}
}
static void disassemble_wait (FILE *file, unsigned long insn)
{
int vp, hp, ve, he, bfd, v_mask, h_mask;
+ int doout = 0;
vp = (insn & 0xff000000) >> 24;
hp = (insn & 0x00fe0000) >> 16;
v_mask = vp & (ve | 0x80);
h_mask = hp & he;
if (v_mask > 0) {
- console_out ("vpos ");
+ doout = 1;
+ console_out (L"vpos ");
if (ve != 0x7f) {
- console_out_f ("& 0x%02x ", ve);
+ console_out_f (L"& 0x%02x ", ve);
}
- console_out_f (">= 0x%02x", v_mask);
+ console_out_f (L">= 0x%02x", v_mask);
}
if (he > 0) {
if (v_mask > 0) {
- console_out (" and");
+ console_out (L" and");
}
- console_out (" hpos ");
+ console_out (L" hpos ");
if (he != 0xfe) {
- console_out_f ("& 0x%02x ", he);
+ console_out_f (L"& 0x%02x ", he);
}
- console_out_f (">= 0x%02x", h_mask);
+ console_out_f (L">= 0x%02x", h_mask);
} else {
- console_out (", ignore horizontal");
+ if (doout)
+ console_out (L", ");
+ console_out (L", ignore horizontal");
}
- console_out_f (".\n \t; VP %02x, VE %02x; HP %02x, HE %02x; BFD %d\n",
+ console_out_f (L".\n \t; VP %02x, VE %02x; HP %02x, HE %02x; BFD %d\n",
vp, ve, hp, he, bfd);
}
{
uae_u32 insn_type = insn & 0x00010001;
int hpos, vpos;
- char here = ' ';
- char record[] = " ";
+ TCHAR here = ' ';
+ TCHAR record[] = L" L";
if (find_copper_record (addr, &hpos, &vpos)) {
- sprintf (record, " [%03x %03x]", vpos, hpos);
+ _stprintf (record, L" [%03x %03x]", vpos, hpos);
}
- if (get_copper_address(-1) >= addr && get_copper_address(-1) <= addr + 3)
+ if (get_copper_address (-1) >= addr && get_copper_address(-1) <= addr + 3)
here = '*';
- console_out_f ("%c%08lx: %04lx %04lx%s\t; ", here, addr, insn >> 16, insn & 0xFFFF, record);
+ console_out_f (L"%c%08lx: %04lx %04lx%s\t; ", here, addr, insn >> 16, insn & 0xFFFF, record);
switch (insn_type) {
case 0x00010000: /* WAIT insn */
- console_out ("Wait for ");
+ console_out (L"Wait for ");
disassemble_wait (file, insn);
if (insn == 0xfffffffe)
- console_out (" \t; End of Copperlist\n");
+ console_out (L" \t; End of Copperlist\n");
break;
case 0x00010001: /* SKIP insn */
- console_out ("Skip if ");
+ console_out (L"Skip if ");
disassemble_wait (file, insn);
break;
i++;
}
if (custd[i].name)
- console_out_f ("%s := 0x%04lx\n", custd[i].name, insn & 0xffff);
+ console_out_f (L"%s := 0x%04lx\n", custd[i].name, insn & 0xffff);
else
- console_out_f ("%04x := 0x%04lx\n", addr, insn & 0xffff);
+ console_out_f (L"%04x := 0x%04lx\n", addr, insn & 0xffff);
}
break;
* values that mean the end of the copperlist */
}
-static int copper_debugger (char **c)
+static int copper_debugger (TCHAR **c)
{
static uaecptr nxcopper;
uae_u32 maddr;
debug_copper = 0;
else
debug_copper = 1;
- console_out_f ("Copper debugger %s.\n", debug_copper ? "enabled" : "disabled");
+ console_out_f (L"Copper debugger %s.\n", debug_copper ? L"enabled" : L"disabled");
} else if(**c == 't') {
debug_copper = 1|2;
return 1;
debug_copper = 1|4;
if (more_params(c)) {
debug_copper_pc = readhex(c);
- console_out_f ("Copper breakpoint @0x%08x\n", debug_copper_pc);
+ console_out_f (L"Copper breakpoint @0x%08x\n", debug_copper_pc);
} else {
debug_copper &= ~4;
}
b = get_word (ts->addr);
}
if (mode)
- console_out_f ("%08X=%04X ", ts->addr, b);
+ console_out_f (L"%08X=%04X ", ts->addr, b);
else
- console_out_f ("%08X ", ts->addr);
+ console_out_f (L"%08X ", ts->addr);
if ((i % skip) == skip)
- console_out ("\n");
+ console_out (L"\n");
}
}
-static void deepcheatsearch (char **c)
+static void deepcheatsearch (TCHAR **c)
{
static int first = 1;
static uae_u8 *memtmp;
static int size;
static int inconly, deconly, maxdiff;
int addrcnt, cnt;
- char v;
+ TCHAR v;
- v = toupper (**c);
+ v = _totupper (**c);
if(!memtmp || v == 'S') {
maxdiff = 0x10000;
*p1++ = get_byte (i);
addr = end - 1;
}
- console_out ("Deep trainer first pass complete.\n");
+ console_out (L"Deep trainer first pass complete.\n");
return;
}
inconly = deconly = 0;
}
}
- console_out_f ("%d addresses found\n", cnt);
+ console_out_f (L"%d addresses found\n", cnt);
if (cnt <= MAX_CHEAT_VIEW) {
clearcheater ();
cnt = 0;
cnt++;
}
if (cnt > 0)
- console_out ("\n");
+ console_out (L"\n");
listcheater (1, size);
} else {
- console_out ("Now continue with 'g' and use 'D' again after you have lost another life\n");
+ console_out (L"Now continue with 'g' and use 'D' again after you have lost another life\n");
}
}
/* cheat-search by Toni Wilen (originally by Holger Jakob) */
-static void cheatsearch (char **c)
+static void cheatsearch (TCHAR **c)
{
static uae_u8 *vlist;
static int listsize;
addr = end - 1;
}
- if (toupper (**c) == 'L') {
+ if (_totupper (**c) == 'L') {
listcheater (1, size);
return;
}
ignore_ws (c);
if (!more_params (c)) {
first = 1;
- console_out ("search reset\n");
+ console_out (L"Search reset\n");
xfree (vlist);
listsize = memsize;
vlist = xcalloc (listsize >> 3, 1);
}
listcheater (0, size);
}
- console_out_f ("Found %d possible addresses with 0x%X (%u) (%d bytes)\n", count, val, val, size);
+ console_out_f (L"Found %d possible addresses with 0x%X (%u) (%d bytes)\n", count, val, val, size);
if (count > 0)
- console_out ("Now continue with 'g' and use 'C' with a different value\n");
+ console_out (L"Now continue with 'g' and use 'C' with a different value\n");
first = 0;
}
illg_debug_check (ad, rwi, size, val);
} else if ((mask & 3) == 0) {
if (rwi & 2)
- console_out_f ("W: %08X=%02X PC=%08X\n", ad, v, pc);
+ console_out_f (L"W: %08X=%02X PC=%08X\n", ad, v, pc);
else if (rwi & 1)
- console_out_f ("R: %08X PC=%08X\n", ad, pc);
+ console_out_f (L"R: %08X PC=%08X\n", ad, pc);
if (illgdebug_break)
activate_debugger ();
} else if (!(mask & 1) && (rwi & 1)) {
- console_out_f ("RO: %08X=%02X PC=%08X\n", ad, v, pc);
+ console_out_f (L"RO: %08X=%02X PC=%08X\n", ad, v, pc);
if (illgdebug_break)
activate_debugger ();
} else if (!(mask & 2) && (rwi & 2)) {
- console_out_f ("WO: %08X PC=%08X\n", ad, pc);
+ console_out_f (L"WO: %08X PC=%08X\n", ad, pc);
if (illgdebug_break)
activate_debugger ();
}
static void smc_free (void)
{
if (smc_table)
- console_out ("SMCD disabled\n");
+ console_out (L"SMCD disabled\n");
xfree(smc_table);
smc_mode = 0;
smc_table = NULL;
}
static void initialize_memwatch (int mode);
-static void smc_detect_init (char **c)
+static void smc_detect_init (TCHAR **c)
{
int v, i;
initialize_memwatch (0);
if (v)
smc_mode = 1;
- console_out_f ("SMCD enabled. Break=%d\n", smc_mode);
+ console_out_f (L"SMCD enabled. Break=%d\n", smc_mode);
}
#define SMC_MAXHITS 8
}
if (hitcnt < 100) {
smc_table[hitaddr].cnt++;
- console_out_f ("SMC at %08X - %08X (%d) from %08X\n",
+ console_out_f (L"SMC at %08X - %08X (%d) from %08X\n",
hitaddr, hitaddr + hitcnt, hitcnt, hitpc);
if (smc_mode)
activate_debugger ();
if (smc_table[hitaddr].cnt >= SMC_MAXHITS)
- console_out_f ("* hit count >= %d, future hits ignored\n", SMC_MAXHITS);
+ console_out_f (L"* hit count >= %d, future hits ignored\n", SMC_MAXHITS);
}
}
return -1;
}
-void memwatch_dump2 (char *buf, int bufsize, int num)
+void memwatch_dump2 (TCHAR *buf, int bufsize, int num)
{
int i;
struct memwatch_node *mwn;
mwn = &mwnodes[i];
if (mwn->size == 0)
continue;
- buf = buf_out (buf, &bufsize, "%d: %08X - %08X (%d) %c%c%c",
+ buf = buf_out (buf, &bufsize, L"%d: %08X - %08X (%d) %c%c%c",
i, mwn->addr, mwn->addr + (mwn->size - 1), mwn->size,
(mwn->rwi & 1) ? 'R' : ' ', (mwn->rwi & 2) ? 'W' : ' ', (mwn->rwi & 4) ? 'I' : ' ');
if (mwn->frozen)
- buf = buf_out (buf, &bufsize, "F");
+ buf = buf_out (buf, &bufsize, L"F");
if (mwn->val_enabled)
- buf = buf_out (buf, &bufsize, " =%X", mwn->val);
+ buf = buf_out (buf, &bufsize, L" =%X", mwn->val);
if (mwn->modval_written)
- buf = buf_out (buf, &bufsize, " =M");
- buf = buf_out (buf, &bufsize, "\n");
+ buf = buf_out (buf, &bufsize, L" =M");
+ buf = buf_out (buf, &bufsize, L"\n");
}
}
}
static void memwatch_dump (int num)
{
- char *buf;
+ TCHAR *buf;
int multiplier = num < 0 ? MEMWATCH_TOTAL : 1;
buf = malloc (50 * multiplier);
if (!buf)
return;
memwatch_dump2 (buf, 50 * multiplier, num);
- f_out (stdout, "%s", buf);
+ f_out (stdout, L"%s", buf);
xfree (buf);
}
-static void memwatch (char **c)
+static void memwatch (TCHAR **c)
{
int num;
struct memwatch_node *mwn;
- char nc;
+ TCHAR nc;
if (!memwatch_enabled) {
initialize_memwatch (0);
- console_out ("Memwatch breakpoints enabled\n");
+ console_out (L"Memwatch breakpoints enabled\n");
}
ignore_ws (c);
nc = next_char (c);
if (nc == '-') {
deinitialize_memwatch ();
- console_out ("Memwatch breakpoints disabled\n");
+ console_out (L"Memwatch breakpoints disabled\n");
return;
}
if (nc == 'd') {
uae_u32 len = 1;
if (more_params (c))
len = readhex (c);
- console_out_f ("cleared logging addresses %08X - %08X\n", addr, addr + len);
+ console_out_f (L"Cleared logging addresses %08X - %08X\n", addr, addr + len);
while (len > 0) {
addr &= 0xffffff;
illgdebug[addr] = 7;
}
} else {
illg_free();
- console_out ("Illegal memory access logging disabled\n");
+ console_out (L"Illegal memory access logging disabled\n");
}
} else {
illg_init ();
illgdebug_break = 0;
if (more_params (c))
illgdebug_break = 1;
- console_out_f ("Illegal memory access logging enabled. Break=%d\n", illgdebug_break);
+ console_out_f (L"Illegal memory access logging enabled. Break=%d\n", illgdebug_break);
}
return;
}
mwn->size = 0;
ignore_ws (c);
if (!more_params (c)) {
- console_out_f ("Memwatch %d removed\n", num);
+ console_out_f (L"Memwatch %d removed\n", num);
return;
}
mwn->addr = readhex (c);
ignore_ws (c);
if (more_params (c)) {
for (;;) {
- char ncc = peek_next_char(c);
- char nc = toupper (next_char (c));
+ TCHAR ncc = peek_next_char(c);
+ TCHAR nc = _totupper (next_char (c));
if (mwn->rwi == 7)
mwn->rwi = 0;
if (nc == 'F')
}
ignore_ws (c);
if (more_params (c)) {
- if (toupper(**c) == 'M') {
+ if (_totupper(**c) == 'M') {
mwn->modval_written = 1;
} else {
mwn->val = readhex (c);
memwatch_dump (num);
}
-static void writeintomem (char **c)
+static void writeintomem (TCHAR **c)
{
uae_u32 addr = 0;
uae_u32 val = 0;
- char cc;
+ TCHAR cc;
int len = 1;
ignore_ws(c);
put_byte (addr, val);
cc = 'B';
}
- console_out_f ("Wrote %X (%u) at %08X.%c\n", val, val, addr, cc);
+ console_out_f (L"Wrote %X (%u) at %08X.%c\n", val, val, addr, cc);
}
static uae_u8 *dump_xlate (uae_u32 addr)
{
int i, j, max, im;
addrbank *a1 = mem_banks[0];
- char txt[256];
+ TCHAR txt[256];
im = currprefs.illegal_mem;
currprefs.illegal_mem = 0;
a2 = mem_banks[i];
if (a1 != a2) {
int k, mirrored, size, size_out;
- char size_ext;
+ TCHAR size_ext;
uae_u8 *caddr;
- char *name;
- char tmp[MAX_DPATH];
+ TCHAR *name;
+ TCHAR tmp[MAX_DPATH];
name = a1->name;
if (name == NULL)
- name = "<none>";
+ name = L"<none>";
k = j;
caddr = dump_xlate (k << 16);
size_out /= 1024;
size_ext = 'M';
}
- sprintf (txt, "%08X %7d%c/%d = %7d%c %s", j << 16, size_out, size_ext,
+ _stprintf (txt, L"%08X %7d%c/%d = %7d%c %s", j << 16, size_out, size_ext,
mirrored, mirrored ? size_out / mirrored : size_out, size_ext, name);
tmp[0] = 0;
if (a1->flags == ABFLAG_ROM && mirrored) {
- char *p = txt + strlen (txt);
+ TCHAR *p = txt + _tcslen (txt);
uae_u32 crc = get_crc32 (a1->xlateaddr(j << 16), (size * 1024) / mirrored);
struct romdata *rd = getromdatabycrc (crc);
- sprintf(p, " (%08X)", crc);
+ _stprintf (p, L" (%08X)", crc);
if (rd) {
tmp[0] = '=';
getromname (rd, tmp + 1);
- strcat (tmp,"\n");
+ _tcscat (tmp, L"\n");
}
}
- strcat (txt,"\n");
+ _tcscat (txt, L"\n");
if (log)
write_log (txt);
else
{
return addr << 2;
}
-static char* BSTR2CSTR (uae_u8 *bstr)
+static TCHAR *BSTR2CSTR (uae_u8 *bstr)
{
+ WCHAR *s;
char *cstr = xmalloc (bstr[0] + 1);
if (cstr) {
memcpy (cstr, bstr + 1, bstr[0]);
cstr[bstr[0]] = 0;
}
- return cstr;
+ s = au (cstr);
+ xfree (cstr);
+ return s;
}
static void print_task_info (uaecptr node)
{
int process = get_byte (node + 8) == 13 ? 1 : 0;
- console_out_f ("%08X: %08X", node, 0);
- console_out_f (process ? " PROCESS '%s'" : " TASK '%s'\n", get_real_address (get_long (node + 10)));
+ console_out_f (L"%08X: %08X", node, 0);
+ console_out_f (process ? L" PROCESS '%s'" : L" TASK '%s'\n", get_real_address (get_long (node + 10)));
if (process) {
uaecptr cli = BPTR2APTR (get_long (node + 172));
int tasknum = get_long (node + 140);
if (cli && tasknum) {
uae_u8 *command_bstr = get_real_address (BPTR2APTR (get_long (cli + 16)));
- char *command = BSTR2CSTR (command_bstr);
- console_out_f (" [%d, '%s']\n", tasknum, command);
+ TCHAR *command = BSTR2CSTR (command_bstr);
+ console_out_f (L" [%d, '%s']\n", tasknum, command);
xfree (command);
} else {
- console_out ("\n");
+ console_out (L"\n");
}
}
}
uaecptr taskready = get_long (execbase + 406);
uaecptr taskwait = get_long (execbase + 420);
uaecptr node, end;
- console_out_f ("execbase at 0x%08X\n", (unsigned long) execbase);
- console_out ("Current:\n");
+ console_out_f (L"Execbase at 0x%08X\n", (unsigned long) execbase);
+ console_out (L"Current:\n");
node = get_long (execbase + 276);
print_task_info (node);
- console_out_f ("Ready:\n");
+ console_out_f (L"Ready:\n");
node = get_long (taskready);
end = get_long (taskready + 4);
while (node) {
print_task_info (node);
node = get_long (node);
}
- console_out ("Waiting:\n");
+ console_out (L"Waiting:\n");
node = get_long (taskwait);
end = get_long (taskwait + 4);
while (node) {
#endif
static uaecptr nextpc;
-int instruction_breakpoint (char **c)
+int instruction_breakpoint (TCHAR **c)
{
struct breakpoint_node *bpn;
int i;
if (more_params (c)) {
- char nc = toupper ((*c)[0]);
+ TCHAR nc = _totupper ((*c)[0]);
if (nc == 'S') {
next_char (c);
sr_bpvalue = sr_bpmask = 0;
if (more_params (c))
sr_bpmask = readhex (c);
}
- console_out_f ("SR breakpoint, value=%04X, mask=%04X\n", sr_bpvalue, sr_bpmask);
+ console_out_f (L"SR breakpoint, value=%04X, mask=%04X\n", sr_bpvalue, sr_bpmask);
return 0;
} else if (nc == 'I') {
next_char (c);
} else if (nc == 'D' && (*c)[1] == 0) {
for (i = 0; i < BREAKPOINT_TOTAL; i++)
bpnodes[i].enabled = 0;
- console_out ("All breakpoints removed\n");
+ console_out (L"All breakpoints removed\n");
return 0;
} else if (nc == 'L') {
int got = 0;
bpn = &bpnodes[i];
if (!bpn->enabled)
continue;
- console_out_f ("%8X ", bpn->addr);
+ console_out_f (L"%8X ", bpn->addr);
got = 1;
}
if (!got)
- console_out ("No breakpoints\n");
+ console_out (L"No breakpoints\n");
else
- console_out ("\n");
+ console_out (L"\n");
return 0;
}
skipaddr_doskip = 1;
bpn = &bpnodes[i];
if (bpn->enabled && bpn->addr == skipaddr_start) {
bpn->enabled = 0;
- console_out ("Breakpoint removed\n");
+ console_out (L"Breakpoint removed\n");
skipaddr_start = 0xffffffff;
skipaddr_doskip = 0;
return 0;
continue;
bpn->addr = skipaddr_start;
bpn->enabled = 1;
- console_out ("Breakpoint added\n");
+ console_out (L"Breakpoint added\n");
skipaddr_start = 0xffffffff;
skipaddr_doskip = 0;
break;
return 1;
}
-static int process_breakpoint(char **c)
+static int process_breakpoint(TCHAR **c)
{
processptr = 0;
xfree (processname);
if (!more_params (c))
return 0;
if (**c == '\"') {
- processname = xmalloc (200);
- next_string (c, processname, 200, 0);
+ TCHAR pn[200];
+ next_string (c, pn, 200, 0);
+ processname = ua (pn);
} else {
processptr = readhex (c);
}
return 1;
}
-static void savemem (char **cc)
+static void savemem (TCHAR **cc)
{
uae_u8 b;
uae_u32 src, src2, len, len2;
- char *name;
+ TCHAR *name;
FILE *fp;
if (!more_params (cc))
if (!more_params (cc))
goto S_argh;
len2 = len = readhex (cc);
- fp = fopen (name, "wb");
+ fp = _tfopen (name, L"wb");
if (fp == NULL) {
- console_out_f ("Couldn't open file '%s'\n", name);
+ console_out_f (L"Couldn't open file '%s'\n", name);
return;
}
while (len > 0) {
src++;
len--;
if (fwrite (&b, 1, 1, fp) != 1) {
- console_out ("Error writing file\n");
+ console_out (L"Error writing file\n");
break;
}
}
fclose (fp);
if (len == 0)
- console_out_f ("Wrote %08X - %08X (%d bytes) to '%s'\n",
+ console_out_f (L"Wrote %08X - %08X (%d bytes) to '%s'\n",
src2, src2 + len2, len2, name);
return;
S_argh:
- console_out ("S-command needs more arguments!\n");
+ console_out (L"S-command needs more arguments!\n");
}
-static void searchmem (char **cc)
+static void searchmem (TCHAR **cc)
{
int i, sslen, got, val, stringmode;
uae_u8 ss[256];
uae_u32 addr, endaddr;
- char nc;
+ TCHAR nc;
got = 0;
sslen = 0;
for (;;) {
if (**cc == 32 || **cc == 0)
break;
- nc = toupper (next_char (cc));
+ nc = _totupper (next_char (cc));
if (isspace (nc))
break;
if (isdigit(nc))
val *= 16;
if (**cc == 32 || **cc == 0)
break;
- nc = toupper (next_char (cc));
+ nc = _totupper (next_char (cc));
if (isspace (nc))
break;
if (isdigit(nc))
if (more_params (cc))
endaddr = readhex (cc);
}
- console_out_f ("Searching from %08X to %08X..\n", addr, endaddr);
+ console_out_f (L"Searching from %08X to %08X..\n", addr, endaddr);
while ((addr = nextaddr (addr, NULL)) != 0xffffffff) {
if (addr == endaddr)
break;
}
if (i == sslen) {
got++;
- console_out_f (" %08X", addr);
+ console_out_f (L" %08X", addr);
if (got > 100) {
- console_out ("\nMore than 100 results, aborting..");
+ console_out (L"\nMore than 100 results, aborting..");
break;
}
}
}
if (!got)
- console_out ("nothing found");
- console_out ("\n");
+ console_out (L"nothing found");
+ console_out (L"\n");
}
-static int staterecorder (char **cc)
+static int staterecorder (TCHAR **cc)
{
- char nc;
+ TCHAR nc;
if (!more_params (cc)) {
if (savestate_dorewind (1)) {
}
static int debugtest_modes[DEBUGTEST_MAX];
-static const char *debugtest_names[] = {
- "Blitter", "Keyboard", "Floppy"
+static const TCHAR *debugtest_names[] = {
+ L"Blitter", L"Keyboard", L"Floppy"
};
-void debugtest (enum debugtest_item di, const char *format, ...)
+void debugtest (enum debugtest_item di, const TCHAR *format, ...)
{
va_list parms;
- char buffer[1000];
+ TCHAR buffer[1000];
if (!debugtest_modes[di])
return;
va_start (parms, format);
- _vsnprintf (buffer, 1000 - 1, format, parms);
+ _vsntprintf (buffer, 1000 - 1, format, parms);
va_end (parms);
- write_log ("%s PC=%08X: %s\n", debugtest_names[di], M68K_GETPC, buffer);
+ write_log (L"%s PC=%08X: %s\n", debugtest_names[di], M68K_GETPC, buffer);
if (debugtest_modes[di] == 2)
activate_debugger ();
}
-static void debugtest_set (char **inptr)
+static void debugtest_set (TCHAR **inptr)
{
int i, val, val2;
ignore_ws (inptr);
if (!more_params (inptr)) {
for (i = 0; i < DEBUGTEST_MAX; i++)
debugtest_modes[i] = 0;
- console_out ("all debugtests disabled\n");
+ console_out (L"All debugtests disabled\n");
return;
}
val = readint (inptr);
if (val < 0) {
for (i = 0; i < DEBUGTEST_MAX; i++)
debugtest_modes[i] = val2;
- console_out ("all debugtests enabled\n");
+ console_out (L"All debugtests enabled\n");
return;
}
if (val >= 0 && val < DEBUGTEST_MAX) {
debugtest_modes[val] = 0;
else
debugtest_modes[val] = val2;
- console_out_f ("debugtest '%s': %s. break = %s\n",
- debugtest_names[val], debugtest_modes[val] ? "on" :"off", val2 == 2 ? "on" : "off");
+ console_out_f (L"Debugtest '%s': %s. break = %s\n",
+ debugtest_names[val], debugtest_modes[val] ? L"on" :L"off", val2 == 2 ? L"on" : L"off");
}
}
-static void debug_sprite (char **inptr)
+static void debug_sprite (TCHAR **inptr)
{
uaecptr saddr, addr, addr2;
int xpos, xpos_ecs;
int size = 1, width;
int ecs, sh10;
int y, i;
- char tmp[80];
+ TCHAR tmp[80];
int max = 2;
addr2 = 0;
width = size * 16;
w1 = get_word (addr);
w2 = get_word (addr + size * 2);
- console_out_f (" %06X ", addr);
+ console_out_f (L" %06X ", addr);
for (i = 0; i < size * 2; i++)
- console_out_f ("%04X ", get_word (addr + i * 2));
- console_out_f ("\n");
+ console_out_f (L"%04X ", get_word (addr + i * 2));
+ console_out_f (L"\n");
ypos = w1 >> 8;
xpos = w1 & 255;
}
}
tmp[width] = 0;
- console_out_f ("%3d %06X %s\n", y, addr, tmp);
+ console_out_f (L"%3d %06X %s\n", y, addr, tmp);
}
- console_out_f ("Sprite address %08X, width = %d\n", saddr, size * 16);
- console_out_f ("OCS: StartX=%d StartY=%d EndY=%d\n", xpos, ypos, ypose);
- console_out_f ("ECS: StartX=%d (%d.%d) StartY=%d EndY=%d%s\n", xpos_ecs, xpos_ecs / 4, xpos_ecs & 3, ypos_ecs, ypose_ecs, ecs ? " (*)" : "");
- console_out_f ("Attach: %d. AGA SSCAN/SH10 bit: %d\n", attach, sh10);
+ console_out_f (L"Sprite address %08X, width = %d\n", saddr, size * 16);
+ console_out_f (L"OCS: StartX=%d StartY=%d EndY=%d\n", xpos, ypos, ypose);
+ console_out_f (L"ECS: StartX=%d (%d.%d) StartY=%d EndY=%d%s\n", xpos_ecs, xpos_ecs / 4, xpos_ecs & 3, ypos_ecs, ypose_ecs, ecs ? " (*)" : "");
+ console_out_f (L"Attach: %d. AGA SSCAN/SH10 bit: %d\n", attach, sh10);
addr += size * 4;
if (get_word (addr) == 0 && get_word (addr + size * 4) == 0)
}
-static void disk_debug (char **inptr)
+static void disk_debug (TCHAR **inptr)
{
- char parm[10];
+ TCHAR parm[10];
int i;
if (**inptr == 'd') {
(*inptr)++;
ignore_ws (inptr);
disk_debug_logging = readint (inptr);
- console_out_f ("disk logging level %d\n", disk_debug_logging);
+ console_out_f (L"Disk logging level %d\n", disk_debug_logging);
return;
}
disk_debug_mode = 0;
ignore_ws (inptr);
if (!next_string (inptr, parm, sizeof (parm), 1))
goto end;
- for (i = 0; i < strlen(parm); i++) {
+ for (i = 0; i < _tcslen(parm); i++) {
if (parm[i] == 'R')
disk_debug_mode |= DISK_DEBUG_DMA_READ;
if (parm[i] == 'W')
if (disk_debug_logging == 0)
disk_debug_logging = 1;
end:
- console_out_f ("disk breakpoint mode %c%c%c track %d\n",
+ console_out_f (L"Disk breakpoint mode %c%c%c track %d\n",
disk_debug_mode & DISK_DEBUG_DMA_READ ? 'R' : '-',
disk_debug_mode & DISK_DEBUG_DMA_WRITE ? 'W' : '-',
disk_debug_mode & DISK_DEBUG_PIO ? 'P' : '-',
disk_debug_track);
}
-static void find_ea (char **inptr)
+static void find_ea (TCHAR **inptr)
{
uae_u32 ea, sea, dea;
uaecptr addr, end;
if (more_params(inptr))
end = readhex (inptr);
}
- console_out_f ("Searching from %08X to %08X\n", addr, end);
+ console_out_f (L"Searching from %08X to %08X\n", addr, end);
while((addr = nextaddr(addr, &end)) != 0xffffffff) {
if ((addr & 1) == 0 && addr + 6 <= end) {
sea = 0xffffffff;
m68k_disasm (stdout, addr, NULL, 1);
hits++;
if (hits > 100) {
- write_log ("Too many hits. End addr = %08X\n", addr);
+ write_log (L"Too many hits. End addr = %08X\n", addr);
break;
}
}
}
}
-static void m68k_modify (char **inptr)
+static void m68k_modify (TCHAR **inptr)
{
uae_u32 v;
- char parm[10];
- char c1, c2;
+ TCHAR parm[10];
+ TCHAR c1, c2;
int i;
if (!next_string (inptr, parm, sizeof (parm), 1))
return;
- c1 = toupper (parm[0]);
+ c1 = _totupper (parm[0]);
c2 = 99;
if (c1 == 'A' || c1 == 'D' || c1 == 'P') {
- c2 = toupper (parm[1]);
+ c2 = _totupper (parm[1]);
if (isdigit (c2))
c2 -= '0';
else
regs.irc = v;
else if (c1 == 'P' && c2 == 1)
regs.ir = v;
- else if (!strcmp (parm, "SR")) {
+ else if (!_tcscmp (parm, L"SR")) {
regs.sr = v;
MakeFromSR (®s);
- } else if (!strcmp (parm, "CCR")) {
+ } else if (!_tcscmp (parm, L"CCR")) {
regs.sr = (regs.sr & ~31) | (v & 31);
MakeFromSR (®s);
- } else if (!strcmp(parm, "USP")) {
+ } else if (!_tcscmp (parm, L"USP")) {
regs.usp = v;
- } else if (!strcmp(parm, "ISP")) {
+ } else if (!_tcscmp (parm, L"ISP")) {
regs.isp = v;
- } else if (!strcmp (parm, "PC")) {
+ } else if (!_tcscmp (parm, L"PC")) {
m68k_setpc (®s, v);
fill_prefetch_slow (®s);
} else {
for (i = 0; m2cregs[i].regname; i++) {
- if (!strcmp (parm, m2cregs[i].regname))
+ if (!_tcscmp (parm, m2cregs[i].regname))
val_move2c2 (m2cregs[i].regno, v);
}
}
static void debug_1 (void)
{
- char input[MAX_LINEWIDTH];
+ TCHAR input[MAX_LINEWIDTH];
uaecptr nxdis, nxmem, addr;
m68k_dumpstate (stdout, &nextpc);
debugger_active = 1;
for (;;) {
- char cmd, *inptr;
+ TCHAR cmd, *inptr;
int v;
if (!debugger_active)
return;
update_debug_info ();
- console_out (">");
+ console_out (L">");
console_flush ();
debug_linecounter = 0;
v = console_get (input, MAX_LINEWIDTH);
inputdevice_logging = 1 | 2;
if (more_params (&inptr))
inputdevice_logging = readint(&inptr);
- console_out_f ("input logging level %d\n", inputdevice_logging);
+ console_out_f (L"Input logging level %d\n", inputdevice_logging);
} else if (*inptr == 'm') {
memory_map_dump_2 (0);
} else if (*inptr == 't') {
return;
case 'x':
- if (toupper(inptr[0]) == 'X') {
+ if (_totupper(inptr[0]) == 'X') {
debugger_change(-1);
} else {
deactivate_debugger();
case 'a':
if (more_params (&inptr))
audio_channel_mask = readhex (&inptr);
- console_out_f ("Audio mask = %02X\n", audio_channel_mask);
+ console_out_f (L"Audio mask = %02X\n", audio_channel_mask);
break;
case 's':
if (more_params (&inptr))
debug_sprite_mask = readhex (&inptr);
- console_out_f ("sprite mask: %02X\n", debug_sprite_mask);
+ console_out_f (L"Sprite mask: %02X\n", debug_sprite_mask);
break;
case 'b':
if (more_params (&inptr)) {
debug_bpl_mask_one = readhex (&inptr) & 0xff;
notice_screen_contents_lost ();
}
- console_out_f ("bitplane mask: %02X (%02X)\n", debug_bpl_mask, debug_bpl_mask_one);
+ console_out_f (L"Bitplane mask: %02X (%02X)\n", debug_bpl_mask, debug_bpl_mask_one);
break;
}
}
} else {
int i;
for (i = 0; i < 8; i++)
- console_out_f ("Plane %d offset %d\n", i, bpl_off[i]);
+ console_out_f (L"Plane %d offset %d\n", i, bpl_off[i]);
}
break;
case 'b':
continue;
if (bpnodes[i].addr == pc) {
bp = 1;
- console_out_f ("Breakpoint at %08X\n", pc);
+ console_out_f (L"Breakpoint at %08X\n", pc);
break;
}
}
uaecptr cli = BPTR2APTR(get_long (activetask + 172));
uaecptr seglist = 0;
- uae_u8 *command = NULL;
+ uae_char *command = NULL;
if (cli) {
if (processname)
command = get_real_address (BPTR2APTR(get_long (cli + 16)));
if (sr_bpmask || sr_bpvalue) {
MakeSR (®s);
if ((regs.sr & sr_bpmask) == sr_bpvalue) {
- console_out ("SR breakpoint\n");
+ console_out (L"SR breakpoint\n");
bp = 1;
}
}
}
}
} else {
- console_out_f ("Memwatch %d: break at %08X.%c %c%c%c %08X PC=%08X\n", memwatch_triggered - 1, mwhit.addr,
+ console_out_f (L"Memwatch %d: break at %08X.%c %c%c%c %08X PC=%08X\n", memwatch_triggered - 1, mwhit.addr,
mwhit.size == 1 ? 'B' : (mwhit.size == 2 ? 'W' : 'L'),
(mwhit.rwi & 1) ? 'R' : ' ', (mwhit.rwi & 2) ? 'W' : ' ', (mwhit.rwi & 4) ? 'I' : ' ',
mwhit.val, mwhit.pc);
inputdevice_acquire (TRUE);
}
-const char *debuginfo (int mode)
+const TCHAR *debuginfo (int mode)
{
- static char txt[100];
+ static TCHAR txt[100];
uae_u32 pc = M68K_GETPC;
- sprintf (txt, "PC=%08X INS=%04X %04X %04X",
+ _stprintf (txt, L"PC=%08X INS=%04X %04X %04X",
pc, get_word (pc), get_word (pc + 2), get_word (pc + 4));
return txt;
}
mmur = regs;
pc = m68k_getpc (®s);
if (mmu_logging)
- console_out_f ("MMU: hit %08X SZ=%d RW=%d V=%08X PC=%08X\n", addr, size, rwi, v, pc);
+ console_out_f (L"MMU: hit %08X SZ=%d RW=%d V=%08X PC=%08X\n", addr, size, rwi, v, pc);
p = mmu_regs;
put_long (p, 0); p += 4;
if (maddr == addr) /* infinite mmu hit loop? no thanks.. */
return 1;
if (mmu_logging)
- console_out_f ("MMU: remap %08X -> %08X SZ=%d RW=%d\n", addr, maddr, size, rwi);
+ console_out_f (L"MMU: remap %08X -> %08X SZ=%d RW=%d\n", addr, maddr, size, rwi);
if ((rwi & 2)) {
switch (size)
{
if (currprefs.cachesize) {
wasjit = currprefs.cachesize;
changed_prefs.cachesize = 0;
- console_out ("MMU: JIT disabled\n");
+ console_out (L"MMU: JIT disabled\n");
check_prefs_changed_comp ();
}
if (mmu_enabled) {
mmu_free ();
deinitialize_memwatch ();
- console_out ("MMU: disabled\n");
+ console_out (L"MMU: disabled\n");
changed_prefs.cachesize = wasjit;
}
mmu_logging = 0;
p = parm;
mmu_struct = p;
if (get_long (p) != 1) {
- console_out_f ("MMU: version mismatch %d <> %d\n", get_long (p), 1);
+ console_out_f (L"MMU: version mismatch %d <> %d\n", get_long (p), 1);
return 0;
}
p += 4;
if (mn->mmubank->p_addr == parm2) {
getmmubank(mn->mmubank, parm2);
if (mmu_logging)
- console_out_f ("MMU: bank update %08X: %08X - %08X %08X\n",
+ console_out_f (L"MMU: bank update %08X: %08X - %08X %08X\n",
mn->mmubank->flags, mn->mmubank->addr, mn->mmubank->len + mn->mmubank->addr,
mn->mmubank->remap);
}
}
initialize_memwatch (1);
- console_out_f ("MMU: enabled, %d banks, CB=%08X S=%08X BNK=%08X SF=%08X, %d*%d\n",
+ console_out_f (L"MMU: enabled, %d banks, CB=%08X S=%08X BNK=%08X SF=%08X, %d*%d\n",
size - 1, mmu_callback, parm, banks, mmu_regs, mmu_slots, 1 << MMU_PAGE_SHIFT);
set_special (®s, SPCFLAG_BRK);
return 1;
int drive_id_scnt; /* drive id shift counter */
int idbit;
unsigned long drive_id; /* drive id to be reported */
- char newname[256]; /* storage space for new filename during eject delay */
+ TCHAR newname[256]; /* storage space for new filename during eject delay */
uae_u32 crc32;
#ifdef FDI2RAW
FDI *fdi;
static uae_u16 bigmfmbufw[0x4000 * DDHDMULT];
static drive floppy[MAX_FLOPPY_DRIVES];
-static char dfxhistory[MAX_PREVIOUS_FLOPPIES][MAX_DPATH];
+static TCHAR dfxhistory[MAX_PREVIOUS_FLOPPIES][MAX_DPATH];
static uae_u8 exeheader[]={0x00,0x00,0x03,0xf3,0x00,0x00,0x00,0x00};
static uae_u8 bootblock[]={
time_t t;
struct tm *today;
int year, days, minutes, ticks;
- char tmp[10];
+ TCHAR tmp[10];
+
time (&t);
today = localtime( &t );
- strftime (tmp, sizeof (tmp), "%Y", today);
- year = atol (tmp);
- strftime (tmp, sizeof (tmp), "%j", today);
- days = atol (tmp) - 1;
- strftime (tmp, sizeof (tmp), "%H", today);
- minutes = atol (tmp) * 60;
- strftime (tmp, sizeof (tmp), "%M", today);
- minutes += atol (tmp);
- strftime (tmp, sizeof (tmp), "%S", today);
- ticks = atol (tmp) * 50;
+ _tcsftime (tmp, sizeof (tmp), L"%Y", today);
+ year = _tstoi (tmp);
+ _tcsftime (tmp, sizeof (tmp), L"%j", today);
+ days = _tstoi (tmp) - 1;
+ _tcsftime (tmp, sizeof (tmp), L"%H", today);
+ minutes = _tstoi (tmp) * 60;
+ _tcsftime (tmp, sizeof (tmp), L"%M", today);
+ minutes += _tstoi (tmp);
+ _tcsftime (tmp, sizeof (tmp), L"%S", today);
+ ticks = _tstoi (tmp) * 50;
while (year > 1978) {
if ( !(year % 100) ? !(year % 400) : !(year % 4) ) days++;
days += 365;
sector[offset + 3] = v >> 0;
}
-static int createdirheaderblock (uae_u8 *sector, int parent, char *filename, uae_u8 *bitmap)
+static int createdirheaderblock (uae_u8 *sector, int parent, const char *filename, uae_u8 *bitmap)
{
int block = getblock (bitmap);
return block;
}
-static int createfileheaderblock (struct zfile *z,uae_u8 *sector, int parent, char *filename, struct zfile *src, uae_u8 *bitmap)
+static int createfileheaderblock (struct zfile *z,uae_u8 *sector, int parent, const char *filename, struct zfile *src, uae_u8 *bitmap)
{
uae_u8 sector2[FS_FLOPPY_BLOCKSIZE];
uae_u8 sector3[FS_FLOPPY_BLOCKSIZE];
int totalblocks;
int fblock1, dblock1;
char *fname1 = "runme.exe";
+ TCHAR *fname1b = L"runme.adf";
char *fname2 = "startup-sequence";
char *dirname1 = "s";
struct zfile *ss;
bitmap[1] = 1;
dblock1 = createdirheaderblock (sector2, 880, dirname1, bitmap);
- ss = zfile_fopen_empty (fname1, strlen(fname1));
+ ss = zfile_fopen_empty (fname1b, strlen (fname1));
zfile_fwrite (fname1, strlen(fname1), 1, ss);
fblock1 = createfileheaderblock (dst, sector1, dblock1, fname2, ss, bitmap);
zfile_fclose (ss);
return m;
}
-static char *drive_id_name(drive *drv)
+static TCHAR *drive_id_name(drive *drv)
{
switch(drv->drive_id)
{
- case DRIVE_ID_35HD : return "3.5HD";
- case DRIVE_ID_525SD: return "5.25SD";
- case DRIVE_ID_35DD : return "3.5DD";
- case DRIVE_ID_NONE : return "NONE";
+ case DRIVE_ID_35HD : return L"3.5HD";
+ case DRIVE_ID_525SD: return L"5.25SD";
+ case DRIVE_ID_35DD : return L"3.5DD";
+ case DRIVE_ID_NONE : return L"NONE";
}
- return "UNKNOWN";
+ return L"UNKNOWN";
}
/* Simulate exact behaviour of an A3000T 3.5 HD disk drive.
break;
}
#ifdef DEBUG_DRIVE_ID
- write_log ("drive_settype_id: DF%d: set to %s\n", drv-floppy, drive_id_name(drv));
+ write_log (L"drive_settype_id: DF%d: set to %s\n", drv-floppy, drive_id_name(drv));
#endif
}
drv->writediskfile = 0;
}
-static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const char *fname);
+static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR *fname);
static void reset_drive_gui(int i)
{
for (j = 0; j < MAX_FLOPPY_DRIVES; j++) {
if ((1 << j) & disabled) {
floppy[j].amax = 1;
- write_log ("AMAX: drive %d\n", j);
+ write_log (L"AMAX: drive %d\n", j);
return;
}
}
drv->buffered_side = -1;
gui_led (i + 1, 0);
drive_settype_id (drv);
- strcpy (currprefs.df[i], changed_prefs.df[i]);
+ _tcscpy (currprefs.df[i], changed_prefs.df[i]);
drv->newname[0] = 0;
if (!drive_insert (drv, &currprefs, i, currprefs.df[i]))
disk_eject (i);
&& drv->crc32 == gui_data.crc32[num]
&& writ == gui_data.drive_writing[num])
return;
- strcpy (gui_data.df[num], currprefs.df[num]);
+ _tcscpy (gui_data.df[num], currprefs.df[num]);
gui_data.crc32[num] = drv->crc32;
gui_data.drive_motor[num] = drv->state;
gui_data.drive_track[num] = drv->cyl;
static void drive_fill_bigbuf (drive * drv,int);
-struct zfile *DISK_validate_filename (const char *fname, int leave_open, int *wrprot, uae_u32 *crc32)
+struct zfile *DISK_validate_filename (const TCHAR *fname, int leave_open, int *wrprot, uae_u32 *crc32)
{
if (crc32)
*crc32 = 0;
if (leave_open) {
- struct zfile *f = zfile_fopen (fname, "r+b");
+ struct zfile *f = zfile_fopen (fname, L"r+b");
if (f) {
if (wrprot)
*wrprot = 0;
} else {
if (wrprot)
*wrprot = 1;
- f = zfile_fopen (fname, "rb");
+ f = zfile_fopen (fname, L"rb");
}
if (f && crc32)
*crc32 = zfile_crc32 (f);
if (wrprot)
*wrprot = 0;
if (crc32) {
- struct zfile *f = zfile_fopen (fname, "rb");
+ struct zfile *f = zfile_fopen (fname, L"rb");
if (f)
*crc32 = zfile_crc32 (f);
zfile_fclose (f);
return 1;
}
-char *DISK_get_saveimagepath (const char *name)
+TCHAR *DISK_get_saveimagepath (const TCHAR *name)
{
- static char name1[MAX_DPATH];
- char name2[MAX_DPATH];
- char path[MAX_DPATH];
+ static TCHAR name1[MAX_DPATH];
+ TCHAR name2[MAX_DPATH];
+ TCHAR path[MAX_DPATH];
int i;
- strcpy (name2, name);
- i = strlen (name2) - 1;
+ _tcscpy (name2, name);
+ i = _tcslen (name2) - 1;
while (i > 0) {
if (name2[i] == '.') {
name2[i] = 0;
i--;
}
fetch_saveimagepath (path, sizeof (path), 1);
- sprintf (name1, "%s%s_save.adf", path, name2 + i);
+ _stprintf (name1, L"%s%s_save.adf", path, name2 + i);
return name1;
}
-static struct zfile *getwritefile (const char *name, int *wrprot)
+static struct zfile *getwritefile (const TCHAR *name, int *wrprot)
{
return DISK_validate_filename (DISK_get_saveimagepath (name), 1, wrprot, NULL);
}
-static int iswritefileempty (const char *name)
+static int iswritefileempty (const TCHAR *name)
{
struct zfile *zf;
int wrprot;
- uae_u8 buffer[8];
+ uae_char buffer[8];
trackid td[MAX_TRACKS];
int tracks, ddhd, i, ret;
zf = getwritefile (name, &wrprot);
if (!zf) return 1;
zfile_fread (buffer, sizeof (char), 8, zf);
- if (strncmp ((char *) buffer, "UAE-1ADF", 8))
+ if (strncmp ((uae_char*)buffer, "UAE-1ADF", 8))
return 0;
ret = read_header_ext2 (zf, td, &tracks, &ddhd);
zfile_fclose (zf);
return drv->writediskfile ? 1 : 0;
}
-static int diskfile_iswriteprotect (const char *fname, int *needwritefile, drive_type *drvtype)
+static int diskfile_iswriteprotect (const TCHAR *fname, int *needwritefile, drive_type *drvtype)
{
struct zfile *zf1, *zf2;
int wrprot1 = 0, wrprot2 = 1;
- unsigned char buffer[25];
+ uae_char buffer[25];
*needwritefile = 0;
*drvtype = DRV_35_DD;
zfile_fclose (zf2);
zfile_fread (buffer, sizeof (char), 25, zf1);
zfile_fclose (zf1);
- if (strncmp ((char *) buffer, "CAPS", 4) == 0) {
+ if (strncmp ((uae_char*) buffer, "CAPS", 4) == 0) {
*needwritefile = 1;
return wrprot2;
}
- if (strncmp ((char *) buffer, "Formatted Disk Image file", 25) == 0) {
+ if (strncmp ((uae_char*) buffer, "Formatted Disk Image file", 25) == 0) {
*needwritefile = 1;
return wrprot2;
}
- if (strncmp ((char *) buffer, "UAE-1ADF", 8) == 0) {
+ if (strncmp ((uae_char*) buffer, "UAE-1ADF", 8) == 0) {
if (wrprot1)
return wrprot2;
return wrprot1;
}
- if (strncmp ((char *) buffer, "UAE--ADF", 8) == 0) {
+ if (strncmp ((uae_char*) buffer, "UAE--ADF", 8) == 0) {
*needwritefile = 1;
return wrprot2;
}
return wrprot1;
}
-static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const char *fname)
+static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR *fname)
{
- unsigned char buffer[2 + 2 + 4 + 4];
+ uae_char buffer[2 + 2 + 4 + 4];
trackid *tid;
int num_tracks, size;
inprec_rend ();
}
- strncpy (currprefs.df[dnum], fname, 255);
+ _tcsncpy (currprefs.df[dnum], fname, 255);
currprefs.df[dnum][255] = 0;
- strncpy (changed_prefs.df[dnum], fname, 255);
+ _tcsncpy (changed_prefs.df[dnum], fname, 255);
changed_prefs.df[dnum][255] = 0;
- strcpy (drv->newname, fname);
+ _tcscpy (drv->newname, fname);
gui_filename (dnum, fname);
memset (buffer, 0, sizeof (buffer));
drv->ddhd = 1;
#ifdef CAPS
- } else if (strncmp ((char *) buffer, "CAPS", 4) == 0) {
+ } else if (strncmp ((uae_char*)buffer, "CAPS", 4) == 0) {
drv->wrprot = 1;
if (!caps_loadimage (drv->diskfile, drv - floppy, &num_tracks)) {
drv->num_secs = fdi2raw_get_num_sector (drv->fdi);
drv->filetype = ADF_FDI;
#endif
- } else if (strncmp ((char *) buffer, "UAE-1ADF", 8) == 0) {
+ } else if (strncmp ((uae_char*)buffer, "UAE-1ADF", 8) == 0) {
read_header_ext2 (drv->diskfile, drv->trackdata, &drv->num_tracks, &drv->ddhd);
drv->filetype = ADF_EXT2;
if (drv->ddhd > 1)
drv->num_secs = 22;
- } else if (strncmp ((char *) buffer, "UAE--ADF", 8) == 0) {
+ } else if (strncmp ((uae_char*)buffer, "UAE--ADF", 8) == 0) {
int offs = 160 * 4 + 8;
int i;
} else if (memcmp (exeheader, buffer, sizeof (exeheader)) == 0) {
int i;
- struct zfile *z = zfile_fopen_empty ("", 512 * 1760);
+ struct zfile *z = zfile_fopen_empty (L"", 512 * 1760);
createimagefromexe (drv->diskfile, z);
drv->filetype = ADF_NORMAL;
zfile_fclose (drv->diskfile);
drv->num_tracks = size / (512 * (drv->num_secs = 11));
if (drv->num_tracks > MAX_TRACKS)
- write_log ("Your diskfile is too big, %d bytes!\n", size);
+ write_log (L"Your diskfile is too big, %d bytes!\n", size);
for (i = 0; i < drv->num_tracks; i++) {
tid = &drv->trackdata[i];
tid->type = TRACK_AMIGADOS;
drv->cyl += dir;
if (drv->cyl < 0)
drv->cyl = 0;
- write_log ("%d -> %d\n", dir, drv->cyl);
+ write_log (L"%d -> %d\n", dir, drv->cyl);
return;
}
#endif
if (drv->steplimit && get_cycles() - drv->steplimitcycle < MIN_STEPLIMIT_CYCLE) {
if (disk_debug_logging > 1)
- write_log (" step ignored drive %d, %d",
+ write_log (L" step ignored drive %d, %d",
drv - floppy, (get_cycles() - drv->steplimitcycle) / CYCLE_UNIT);
return;
}
#endif
}
/* else
- write_log ("program tried to step beyond track zero\n");
+ write_log (L"program tried to step beyond track zero\n");
"no-click" programs does that
*/
} else {
#endif
}
if (drv->cyl >= maxtrack)
- write_log ("program tried to step over track %d\n", maxtrack);
+ write_log (L"program tried to step over track %d\n", maxtrack);
#ifdef DRIVESOUND
driveclick_click (drv - floppy, drv->cyl);
#endif
}
rand_shifter (drv);
if (disk_debug_logging > 1)
- write_log (" ->step %d", drv->cyl);
+ write_log (L" ->step %d", drv->cyl);
}
static int drive_track0 (drive * drv)
driveclick_motor (drv - floppy, drv->dskready_down_time == 0 ? 2 : 1);
#endif
if (disk_debug_logging > 1)
- write_log (" ->motor on");
+ write_log (L" ->motor on");
}
if (!drv->motoroff && off) {
drv->drive_id_scnt = 0; /* Reset id shift reg counter */
driveclick_motor (drv - floppy, 0);
#endif
#ifdef DEBUG_DRIVE_ID
- write_log ("drive_motor: Selected DF%d: reset id shift reg.\n",drv-floppy);
+ write_log (L"drive_motor: Selected DF%d: reset id shift reg.\n",drv-floppy);
#endif
if (disk_debug_logging > 1)
- write_log (" ->motor off");
+ write_log (L" ->motor off");
if (currprefs.cpu_model <= 68010 && currprefs.m68k_speed == 0) {
drv->motordelay = 1;
event2_newevent2 (30, drv - floppy, motordelay_func);
#endif
}
-static void read_floppy_data (struct zfile *diskfile, trackid *tid, int offset, unsigned char *dst, int len)
+static void read_floppy_data (struct zfile *diskfile, trackid *tid, int offset, uae_u8 *dst, int len)
{
if (len == 0)
return;
drv->skipoffset = 0;
drv->tracklen = (dstmfmbuf - drv->bigmfmbuf) * 16;
if (disk_debug_logging > 0)
- write_log ("pcdos read track %d\n", tr);
+ write_log (L"pcdos read track %d\n", tr);
}
static void decode_amigados (drive *drv)
}
if (disk_debug_logging > 0)
- write_log ("amigados read track %d\n", tr);
+ write_log (L"amigados read track %d\n", tr);
}
static void drive_fill_bigbuf (drive * drv, int force)
int i;
trackid *wti = &drv->writetrackdata[tr];
drv->tracklen = wti->bitlen;
- read_floppy_data (drv->writediskfile, wti, 0, (char *) drv->bigmfmbuf, (wti->bitlen + 7) / 8);
+ read_floppy_data (drv->writediskfile, wti, 0, (uae_u8*)drv->bigmfmbuf, (wti->bitlen + 7) / 8);
for (i = 0; i < (drv->tracklen + 15) / 16; i++) {
uae_u16 *mfm = drv->bigmfmbuf + i;
uae_u8 *data = (uae_u8 *) mfm;
*mfm = 256 * *data + *(data + 1);
}
if (disk_debug_logging > 0)
- write_log ("track %d, length %d read from \"saveimage\"\n", tr, drv->tracklen);
+ write_log (L"track %d, length %d read from \"saveimage\"\n", tr, drv->tracklen);
} else if (drv->filetype == ADF_CATWEASEL) {
#ifdef CATWEASEL
drv->tracklen = 0;
int base_offset = ti->type == TRACK_RAW ? 0 : 1;
drv->tracklen = ti->bitlen + 16 * base_offset;
drv->bigmfmbuf[0] = ti->sync;
- read_floppy_data (drv->diskfile, ti, 0, (char *) (drv->bigmfmbuf + base_offset), (ti->bitlen + 7) / 8);
+ read_floppy_data (drv->diskfile, ti, 0, (uae_u8*)(drv->bigmfmbuf + base_offset), (ti->bitlen + 7) / 8);
for (i = base_offset; i < (drv->tracklen + 15) / 16; i++) {
uae_u16 *mfm = drv->bigmfmbuf + i;
uae_u8 *data = (uae_u8 *) mfm;
*mfm = 256 * *data + *(data + 1);
}
if (disk_debug_logging > 1)
- write_log ("rawtrack %d image offset=%x\n", tr, ti->offs);
+ write_log (L"rawtrack %d image offset=%x\n", tr, ti->offs);
}
drv->buffered_side = side;
drv->buffered_cyl = drv->cyl;
free (zerobuf);
}
if (disk_debug_logging > 0)
- write_log ("track %d, raw track length %d written (total size %d)\n", ti->track, (ti->bitlen + 7) / 8, ti->len);
+ write_log (L"track %d, raw track length %d written (total size %d)\n", ti->track, (ti->bitlen + 7) / 8, ti->len);
}
#define MFMMASK 0x55555555
trackoffs = (id & 0xff00) >> 8;
if (trackoffs + 1 > drvsec) {
- write_log ("Disk decode: weird sector number %d\n", trackoffs);
+ write_log (L"Disk decode: weird sector number %d\n", trackoffs);
if (filetype == ADF_EXT2)
return 2;
continue;
even = getmfmlong (mbuf + 2, shift);
mbuf += 4;
if (((odd << 1) | even) != chksum || ((id & 0x00ff0000) >> 16) != cyl * 2 + side) {
- write_log ("Disk decode: checksum error on sector %d header\n", trackoffs);
+ write_log (L"Disk decode: checksum error on sector %d header\n", trackoffs);
if (filetype == ADF_EXT2)
return 3;
continue;
chksum ^= odd ^ even;
}
if (chksum) {
- write_log ("Disk decode: sector %d, data checksum error\n", trackoffs);
+ write_log (L"Disk decode: sector %d, data checksum error\n", trackoffs);
if (filetype == ADF_EXT2)
return 4;
continue;
if (filetype == ADF_EXT2 && (secwritten == 0 || secwritten < 0))
return 5;
if (secwritten == 0)
- write_log ("Disk decode: unsupported format\n");
+ write_log (L"Disk decode: unsupported format\n");
if (secwritten < 0)
- write_log ("Disk decode: sector labels ignored\n");
+ write_log (L"Disk decode: sector labels ignored\n");
*drvsecp = drvsec;
return 0;
}
tmp[0] = 0xa1; tmp[1] = 0xa1; tmp[2] = 0xa1; tmp[3] = mark;
tmp[4] = cyl; tmp[5] = head; tmp[6] = sector; tmp[7] = size;
if (get_crc16(tmp, 8) != crc || cyl != drv->cyl || head != side || size != 2 || sector < 1 || sector > drv->num_secs) {
- write_log ("PCDOS: track %d, corrupted sector header\n", drv->cyl * 2 + side);
+ write_log (L"PCDOS: track %d, corrupted sector header\n", drv->cyl * 2 + side);
return 1;
}
sector--;
continue;
}
if (mark != 0xfb) {
- write_log ("PCDOS: track %d: unknown address mark %02X\n", drv->cyl * 2 + side, mark);
+ write_log (L"PCDOS: track %d: unknown address mark %02X\n", drv->cyl * 2 + side, mark);
continue;
}
if (sector < 0)
secbuf[i + 4] = mfmdecode(&mbuf, shift);
crc = (mfmdecode(&mbuf, shift) << 8) | mfmdecode(&mbuf, shift);
if (get_crc16(secbuf, 3 + 1 + 512) != crc) {
- write_log ("PCDOS: track %d, sector %d data checksum error\n",
+ write_log (L"PCDOS: track %d, sector %d data checksum error\n",
drv->cyl * 2 + side, sector + 1);
continue;
}
secwritten++;
zfile_fseek (drv->diskfile, drv->trackdata[drv->cyl * 2 + side].offs + sector * 512, SEEK_SET);
zfile_fwrite (secbuf + 4, sizeof (uae_u8), 512, drv->diskfile);
- write_log ("PCDOS: track %d sector %d written\n", drv->cyl * 2 + side, sector + 1);
+ write_log (L"PCDOS: track %d sector %d written\n", drv->cyl * 2 + side, sector + 1);
sector = -1;
}
if (secwritten != drv->num_secs)
- write_log ("PCDOS: track %d, %d corrupted sectors ignored\n",
+ write_log (L"PCDOS: track %d, %d corrupted sectors ignored\n",
drv->cyl * 2 + side, drv->num_secs - secwritten);
return 0;
}
len = (tracklen + 7) / 8;
if (len > ti->len) {
- write_log ("disk raw write: image file's track %d is too small (%d < %d)!\n", ti->track, ti->len, len);
+ write_log (L"disk raw write: image file's track %d is too small (%d < %d)!\n", ti->track, ti->len, len);
len = ti->len;
}
diskfile_update (diskfile, ti, tracklen, TRACK_RAW);
if (!longwritemode)
ret = drive_write_adf_amigados (drv);
if (ret) {
- write_log ("not an amigados track %d (error %d), writing as raw track\n", drv->cyl * 2 + side, ret);
+ write_log (L"not an amigados track %d (error %d), writing as raw track\n", drv->cyl * 2 + side, ret);
drive_write_ext2 (drv->bigmfmbuf, drv->diskfile, &drv->trackdata[drv->cyl * 2 + side],
longwritemode ? dsklength2 * 8 : drv->tracklen);
}
case ADF_PCDOS:
ret = drive_write_pcdos (drv);
if (ret)
- write_log ("not a PC formatted track %d (error %d)\n", drv->cyl * 2 + side, ret);
+ write_log (L"not a PC formatted track %d (error %d)\n", drv->cyl * 2 + side, ret);
break;
}
drv->tracktiming[0] = 0;
drv->crc32 = 0;
drive_settype_id (drv); /* Back to 35 DD */
if (disk_debug_logging > 0)
- write_log ("eject drive %d\n", drv - &floppy[0]);
+ write_log (L"eject drive %d\n", drv - &floppy[0]);
if (input_recording > 0) {
inprec_rstart (INPREC_DISKREMOVE);
inprec_ru8 (drv - floppy);
/* type: 0=regular, 1=ext2adf */
/* adftype: 0=DD,1=HD,2=525SD */
-void disk_creatediskfile (char *name, int type, drive_type adftype, char *disk_name)
+void disk_creatediskfile (TCHAR *name, int type, drive_type adftype, TCHAR *disk_name)
{
struct zfile *f;
int i, l, file_size, tracks, track_len;
- char *chunk = NULL;
+ uae_u8 *chunk = NULL;
uae_u8 tmp[3*4];
+ uae_char *s;
- if (disk_name == NULL || strlen(disk_name) == 0)
- disk_name = "empty";
+ if (disk_name == NULL || _tcslen (disk_name) == 0)
+ disk_name = L"empty";
if (type == 1)
tracks = 2 * 83;
tracks /= 2;
}
- f = zfile_fopen (name, "wb");
- chunk = (uae_u8*)xmalloc (16384);
+ f = zfile_fopen (name, L"wb");
+ chunk = xmalloc (16384);
if (f && chunk) {
memset(chunk,0,16384);
if (type == 0 && adftype < 2) {
chunk[12+3] = 0x48;
chunk[312] = chunk[313] = chunk[314] = chunk[315] = (uae_u8)0xff;
chunk[316+2] = (block + 1) >> 8; chunk[316+3] = (block + 1) & 255;
- chunk[432] = strlen (disk_name);
- strcpy (chunk + 433, disk_name);
+ s = ua (disk_name);
+ chunk[432] = strlen (s);
+ strcpy (chunk + 433, s);
+ xfree (s);
chunk[508 + 3] = 1;
disk_date (chunk + 420);
memcpy (chunk + 472, chunk + 420, 3 * 4);
zfile_fclose (f);
}
-int disk_getwriteprotect (const char *name)
+int disk_getwriteprotect (const TCHAR *name)
{
int needwritefile;
drive_type drvtype;
return diskfile_iswriteprotect (name, &needwritefile, &drvtype);
}
-static void diskfile_readonly (const char *name, int readonly)
+static void diskfile_readonly (const TCHAR *name, int readonly)
{
struct stat st;
int mode, oldmode;
}
drv->dskchange_time = dsktime;
if (disk_debug_logging > 0)
- write_log ("delayed insert enable %d\n", dsktime);
+ write_log (L"delayed insert enable %d\n", dsktime);
}
void DISK_reinsert (int num)
setdskchangetime (&floppy[num], 20);
}
-int disk_setwriteprotect (int num, const char *name, int protect)
+int disk_setwriteprotect (int num, const TCHAR *name, int protect)
{
int needwritefile, oldprotect;
struct zfile *zf1, *zf2;
int wrprot1, wrprot2, i;
- char *name2;
+ TCHAR *name2;
drive_type drvtype;
oldprotect = diskfile_iswriteprotect (name, &needwritefile, &drvtype);
zfile_fclose (zf2);
if (protect && iswritefileempty (name)) {
for (i = 0; i < MAX_FLOPPY_DRIVES; i++) {
- if (!strcmp (name, floppy[i].newname))
+ if (!_tcscmp (name, floppy[i].newname))
drive_eject (&floppy[i]);
}
- unlink (name2);
+ _wunlink (name2);
}
if (!needwritefile)
void disk_eject (int num)
{
- gui_filename (num, "");
+ gui_filename (num, L"");
drive_eject (floppy + num);
*currprefs.df[num] = *changed_prefs.df[num] = 0;
floppy[num].newname[0] = 0;
update_drive_gui (num);
}
-int DISK_history_add (const char *name, int idx)
+int DISK_history_add (const TCHAR *name, int idx)
{
int i;
return 0;
dfxhistory[idx][0] = 0;
for (i = 0; i < MAX_PREVIOUS_FLOPPIES; i++) {
- if (!strcmp (dfxhistory[i], name))
+ if (!_tcscmp (dfxhistory[i], name))
return 0;
}
- strcpy (dfxhistory[idx], name);
+ _tcscpy (dfxhistory[idx], name);
return 1;
}
for (i = 0; i < MAX_PREVIOUS_FLOPPIES; i++) {
- if (!strcmp (dfxhistory[i], name)) {
+ if (!_tcscmp (dfxhistory[i], name)) {
while (i < MAX_PREVIOUS_FLOPPIES - 1) {
- strcpy (dfxhistory[i], dfxhistory[i + 1]);
+ _tcscpy (dfxhistory[i], dfxhistory[i + 1]);
i++;
}
dfxhistory[MAX_PREVIOUS_FLOPPIES - 1][0] = 0;
}
}
for (i = MAX_PREVIOUS_FLOPPIES - 2; i >= 0; i--)
- strcpy (dfxhistory[i + 1], dfxhistory[i]);
- strcpy (dfxhistory[0], name);
+ _tcscpy (dfxhistory[i + 1], dfxhistory[i]);
+ _tcscpy (dfxhistory[0], name);
return 1;
}
-char *DISK_history_get (int idx)
+TCHAR *DISK_history_get (int idx)
{
if (idx >= MAX_PREVIOUS_FLOPPIES)
return 0;
return dfxhistory[idx];
}
-static void disk_insert_2 (int num, const char *name, int forced)
+static void disk_insert_2 (int num, const TCHAR *name, int forced)
{
drive *drv = floppy + num;
drive_insert (drv, &currprefs, num, name);
return;
}
- if (!strcmp (currprefs.df[num], name))
+ if (!_tcscmp (currprefs.df[num], name))
return;
- strcpy (drv->newname, name);
- strcpy (currprefs.df[num], name);
+ _tcscpy (drv->newname, name);
+ _tcscpy (currprefs.df[num], name);
DISK_history_add (name, -1);
if (name[0] == 0) {
disk_eject (num);
}
}
-void disk_insert (int num, const char *name)
+void disk_insert (int num, const TCHAR *name)
{
disk_insert_2 (num, name, 0);
}
-void disk_insert_force (int num, const char *name)
+void disk_insert_force (int num, const TCHAR *name)
{
disk_insert_2 (num, name, 1);
}
rp_floppydrive_change (i, currprefs.dfxtype[i] >= 0 ? 1 : 0);
#endif
}
- if (drv->dskchange_time == 0 && strcmp (currprefs.df[i], changed_prefs.df[i]))
+ if (drv->dskchange_time == 0 && _tcscmp (currprefs.df[i], changed_prefs.df[i]))
disk_insert (i, changed_prefs.df[i]);
gui_unlock ();
if (drv->dskready_down_time > 0)
if (drv->dskchange_time == 0) {
drive_insert (drv, &currprefs, i, drv->newname);
if (disk_debug_logging > 0)
- write_log ("delayed insert, drive %d, image '%s'\n", i, drv->newname);
+ write_log (L"delayed insert, drive %d, image '%s'\n", i, drv->newname);
update_drive_gui (i);
}
return drive_empty (floppy + num);
}
-static char *tobin(uae_u8 v)
+static TCHAR *tobin(uae_u8 v)
{
int i;
- static char buf[10];
+ static TCHAR buf[10];
for( i = 7; i >= 0; i--)
buf[7 - i] = v & (1 << i) ? '1' : '0';
buf[i] = 0;
step_pulse = data & 1;
if (disk_debug_logging > 1)
- write_log ("%08X %02X %s drvmask=%x", M68K_GETPC, data, tobin(data), selected ^ 15);
+ write_log (L"%08X %02X %s drvmask=%x", M68K_GETPC, data, tobin(data), selected ^ 15);
#ifdef AMAX
if (currprefs.amaxromfile[0])
if (floppy[dr].indexhackmode > 1 && !(selected & (1 << dr))) {
floppy[dr].indexhack = 1;
if (disk_debug_logging > 1)
- write_log (" indexhack!");
+ write_log (L" indexhack!");
}
}
}
if (disk_debug_logging > 1) {
- write_log (" %d%d%d%d% ", (selected & 1) ? 0 : 1, (selected & 2) ? 0 : 1, (selected & 4) ? 0 : 1, (selected & 8) ? 0 : 1);
+ write_log (L" %d%d%d%d% ", (selected & 1) ? 0 : 1, (selected & 2) ? 0 : 1, (selected & 4) ? 0 : 1, (selected & 8) ? 0 : 1);
if ((prevdata & 0x80) != (data & 0x80))
- write_log (" dskmotor %d ", (data & 0x80) ? 1 : 0);
+ write_log (L" dskmotor %d ", (data & 0x80) ? 1 : 0);
if ((prevdata & 0x02) != (data & 0x02))
- write_log (" direct %d ", (data & 0x02) ? 1 : 0);
+ write_log (L" direct %d ", (data & 0x02) ? 1 : 0);
if ((prevdata & 0x04) != (data & 0x04))
- write_log (" side %d ", (data & 0x04) ? 1 : 0);
+ write_log (L" side %d ", (data & 0x04) ? 1 : 0);
}
if (step != step_pulse) {
if (disk_debug_logging > 1)
- write_log (" dskstep %d ", step_pulse);
+ write_log (L" dskstep %d ", step_pulse);
step = step_pulse;
if (step && !savestate_state) {
for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
if (!currprefs.cs_df0idhw && dr == 0)
drv->idbit = 0;
#ifdef DEBUG_DRIVE_ID
- write_log ("DISK_status: sel %d id %s (%08X) [0x%08lx, bit #%02d: %d]\n",
+ write_log (L"DISK_status: sel %d id %s (%08X) [0x%08lx, bit #%02d: %d]\n",
dr, drive_id_name(drv), drv->drive_id, drv->drive_id << drv->drive_id_scnt, 31 - drv->drive_id_scnt, drv->idbit);
#endif
}
}
prevdata = data;
if (disk_debug_logging > 1)
- write_log ("\n");
+ write_log (L"\n");
}
uae_u8 DISK_status (void)
for (i = 0; i < MAX_FLOPPY_DRIVES; i++) {
drive *drv = &floppy[i];
if (!(disabled & (1 << i))) {
- console_out_f ("Drive %d: motor %s cylinder %2d sel %s %s mfmpos %d/%d\n",
+ console_out_f (L"Drive %d: motor %s cylinder %2d sel %s %s mfmpos %d/%d\n",
i, drv->motoroff ? "off" : " on", drv->cyl, (selected & (1 << i)) ? "no" : "yes",
drive_writeprotected(drv) ? "ro" : "rw", drv->mfmpos, drv->tracklen);
w = word;
for (j = 0; j < 15; j++) {
- console_out_f ("%04X ", w);
+ console_out_f (L"%04X ", w);
for (k = 0; k < 16; k++) {
w <<= 1;
w |= getonebit (drv->bigmfmbuf, drv->mfmpos + j * 16 + k);
}
}
- console_out ("\n");
+ console_out (L"\n");
}
}
- console_out_f ("side %d, dma %d, bitoffset %d, word %04X, dskbytr %04X adkcon %04X dsksync %04X\n", side, dskdmaen, bitoffset, word, dskbytr_val, adkcon, dsksync);
+ console_out_f (L"side %d, dma %d, bitoffset %d, word %04X, dskbytr %04X adkcon %04X dsksync %04X\n", side, dskdmaen, bitoffset, word, dskbytr_val, adkcon, dsksync);
}
static void disk_dmafinished (void)
dskdmaen = 0;
if (disk_debug_logging > 0) {
int dr, mfmpos = -1;
- write_log ("disk dma finished %08X MFMpos=", dskpt);
+ write_log (L"disk dma finished %08X MFMpos=", dskpt);
for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++)
- write_log ("%d%s", floppy[dr].mfmpos, dr < MAX_FLOPPY_DRIVES - 1 ? "," : "");
- write_log ("\n");
+ write_log (L"%d%s", floppy[dr].mfmpos, dr < MAX_FLOPPY_DRIVES - 1 ? "," : "");
+ write_log (L"\n");
}
}
if (drv->dskready_time == 0) {
drv->dskready = 1;
if (disk_debug_logging > 0)
- write_log ("%d: %d\n", i, drv->mfmpos);
+ write_log (L"%d: %d\n", i, drv->mfmpos);
}
}
}
static int warned;
warned++;
if (warned < 50)
- write_log ("corrupted trackspeed value %d\n", drv->trackspeed);
+ write_log (L"corrupted trackspeed value %d\n", drv->trackspeed);
drv->trackspeed = 1000;
}
}
else
word |= getonebit (drv->bigmfmbuf, drv->mfmpos);
}
- //write_log ("%08X bo=%d so=%d mfmpos=%d dma=%d\n", (word & 0xffffff), bitoffset, syncoffset, drv->mfmpos,dma_enable);
+ //write_log (L"%08X bo=%d so=%d mfmpos=%d dma=%d\n", (word & 0xffffff), bitoffset, syncoffset, drv->mfmpos,dma_enable);
drv->mfmpos++;
drv->mfmpos %= drv->tracklen;
if (drv->mfmpos == drv->indexoffset) {
if (disk_debug_logging > 1 && drv->indexhack)
- write_log ("indexhack cleared\n");
+ write_log (L"indexhack cleared\n");
drv->indexhack = 0;
}
if (drv->mfmpos == drv->skipoffset) {
#if 0
dma_tab[j++] = word;
if (j == MAX_DISK_WORDS_PER_LINE - 1) {
- write_log ("Bug: Disk DMA buffer overflow!\n");
+ write_log (L"Bug: Disk DMA buffer overflow!\n");
j--;
}
#endif
bitoffset = 15;
if (dskdmaen) {
if (disk_debug_logging && dma_enable == 0)
- write_log ("Sync match, DMA started at %d\n", drv->mfmpos);
+ write_log (L"Sync match, DMA started at %d\n", drv->mfmpos);
dma_enable = 1;
}
}
static void disk_dma_debugmsg (void)
{
- write_log ("LEN=%04X (%d) SYNC=%04X PT=%08X ADKCON=%04X PC=%08X\n",
+ write_log (L"LEN=%04X (%d) SYNC=%04X PT=%08X ADKCON=%04X PC=%08X\n",
dsklength, dsklength, (adkcon & 0x400) ? dsksync : 0xffff, dskpt, adkcon, M68K_GETPC);
}
if (dsklen & 0x4000)
v |= 0x2000;
if (disk_debug_logging > 1)
- write_log ("DSKBYTR=%04X hpos=%d\n", v, hpos);
+ write_log (L"DSKBYTR=%04X hpos=%d\n", v, hpos);
if (disk_debug_mode & DISK_DEBUG_PIO) {
int dr;
for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
if (!(selected & (1 << dr))) {
if (disk_debug_track < 0 || disk_debug_track == 2 * drv->cyl + side) {
disk_dma_debugmsg ();
- write_log ("DSKBYTR=%04X\n", v);
+ write_log (L"DSKBYTR=%04X\n", v);
activate_debugger ();
break;
}
if (dskdmaen) {
/* Megalomania and Knightmare does this */
if (disk_debug_logging > 0 && dskdmaen == 2)
- write_log ("warning: Disk read DMA aborted, %d words left PC=%x\n", dsklength, M68K_GETPC);
+ write_log (L"warning: Disk read DMA aborted, %d words left PC=%x\n", dsklength, M68K_GETPC);
if (dskdmaen == 3) {
- write_log ("warning: Disk write DMA aborted, %d words left PC=%x\n", dsklength, M68K_GETPC);
+ write_log (L"warning: Disk write DMA aborted, %d words left PC=%x\n", dsklength, M68K_GETPC);
// did program write something that needs to be stored to file?
for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
drive *drv2 = &floppy[dr];
break;
}
if (dr == 4) {
- write_log ("disk %s DMA started, drvmask=%x motormask=%x\n",
+ write_log (L"disk %s DMA started, drvmask=%x motormask=%x\n",
dskdmaen == 3 ? "write" : "read", selected ^ 15, motormask);
noselected = 1;
} else {
if (disk_debug_logging > 0) {
- write_log ("disk %s DMA started, drvmask=%x track %d mfmpos %d dmaen=%d\n",
+ write_log (L"disk %s DMA started, drvmask=%x track %d mfmpos %d dmaen=%d\n",
dskdmaen == 3 ? "write" : "read", selected ^ 15,
floppy[dr].cyl * 2 + side, floppy[dr].mfmpos, dma_enable);
disk_dma_debugmsg ();
#endif
if (count < 5) {
count++;
- write_log ("%04X written to DSKDAT. Not good. PC=%08X", v, M68K_GETPC);
+ write_log (L"%04X written to DSKDAT. Not good. PC=%08X", v, M68K_GETPC);
if (count == 5)
- write_log ("(further messages suppressed)");
+ write_log (L"(further messages suppressed)");
- write_log ("\n");
+ write_log (L"\n");
}
}
void DSKPTH (uae_u16 v)
disk_eject (dr);
}
if (disk_empty (0))
- write_log ("No disk in drive 0.\n");
+ write_log (L"No disk in drive 0.\n");
amax_init ();
}
setamax();
}
-uae_u8 *restore_disk(int num,uae_u8 *src)
+uae_u8 *restore_disk (int num,uae_u8 *src)
{
drive *drv;
int state, dfxtype;
- char old[MAX_DPATH];
+ TCHAR old[MAX_DPATH];
+ TCHAR *s;
int newis;
drv = &floppy[num];
drv->dskchange = 0;
drv->dskchange_time = 0;
restore_u32 ();
- strcpy (old, currprefs.df[num]);
- strncpy (changed_prefs.df[num], src, 255);
+ s = restore_string ();
+ _tcscpy (old, currprefs.df[num]);
+ _tcsncpy (changed_prefs.df[num], s, 255);
+ xfree (s);
newis = changed_prefs.df[num][0] ? 1 : 0;
- src += strlen(src) + 1;
if (!(disabled & (1 << num))) {
if (!newis) {
drv->dskchange = 1;
drive_insert (floppy + num, &currprefs, num, changed_prefs.df[num]);
if (drive_empty (floppy + num)) {
if (newis && old[0]) {
- strcpy (changed_prefs.df[num], old);
+ _tcscpy (changed_prefs.df[num], old);
drive_insert (floppy + num, &currprefs, num, changed_prefs.df[num]);
if (drive_empty (floppy + num))
drv->dskchange = 1;
save_u8 (drv->drive_id_scnt); /* id mode position */
save_u32 (drv->mfmpos); /* disk position */
save_u32 (getadfcrc (drv)); /* CRC of disk image */
- strcpy (dst, currprefs.df[num]);/* image name */
- dst += strlen(dst) + 1;
+ save_string (currprefs.df[num]);/* image name */
*len = dst - dstbak;
return dstbak;
#define LINE_DONE_AS_PREVIOUS 8
#define LINE_REMEMBERED_AS_PREVIOUS 9
-static char linestate[(MAXVPOS + 1) * 2 + 1];
+static uae_u8 linestate[(MAXVPOS + 1) * 2 + 1];
uae_u8 line_data[(MAXVPOS + 1) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2];
ok = 0;
if (!ok) {
- write_log ("*** %d-%d (%dx%dx%d %d) %p\n",
+ write_log (L"*** %d-%d (%dx%dx%d %d) %p\n",
start - min, end - min, gfxvidinfo.width, gfxvidinfo.height,
gfxvidinfo.pixbytes, gfxvidinfo.rowbytes,
xlinebuffer);
*pdx = dx;
*pdy = dy;
- write_log ("Display Size: %dx%d Offset: %dx%d\n", w, h, dx, dy);
- write_log ("first: %d last: %d minv: %d maxv: %d min: %d\n",
+ write_log (L"Display Size: %dx%d Offset: %dx%d\n", w, h, dx, dy);
+ write_log (L"first: %d last: %d minv: %d maxv: %d min: %d\n",
plffirstline_total, plflastline_total,
first_planes_vpos, last_planes_vpos, minfirstline);
return 1;
nints = gfxvidinfo.width >> (2 - shift);
nrem = nints & 7;
nints &= ~7;
- start = (int *)(((char *)xlinebuffer) + (visible_left_border << shift));
+ start = (int *)(((uae_u8*)xlinebuffer) + (visible_left_border << shift));
#ifdef ECS_DENISE
val = brdblank ? 0 : colors_for_drawing.acolors[0];
#else
{
int i, j;
if (gfxvidinfo.height > MAX_VIDHEIGHT) {
- write_log ("Resolution too high, aborting\n");
+ write_log (L"Resolution too high, aborting\n");
abort ();
}
j = 0;
{
case LINE_REMEMBERED_AS_PREVIOUS:
if (!warned)
- write_log ("Shouldn't get here... this is a bug.\n"), warned++;
+ write_log (L"Shouldn't get here... this is a bug.\n"), warned++;
return;
case LINE_BLACK:
#if 0
if (currprefs.gfx_xcenter_size > 0) {
int diff = ((gfxvidinfo.width << (RES_MAX - currprefs.gfx_resolution)) - currprefs.gfx_xcenter_size) / 1;
- write_log ("%d %d\n", currprefs.gfx_xcenter_size, gfxvidinfo.width);
+ write_log (L"%d %d\n", currprefs.gfx_xcenter_size, gfxvidinfo.width);
val -= diff >> RES_MAX;
}
#endif
void hsync_record_line_state (int lineno, enum nln_how how, int changed)
{
- char *state;
+ uae_u8 *state;
if (framecnt != 0)
return;
return 0;
}
-static int loadsample (char *path, struct drvsample *ds)
+static int loadsample (TCHAR *path, struct drvsample *ds)
{
struct zfile *f;
uae_u8 *buf;
int size;
- char name[MAX_DPATH];
+ TCHAR name[MAX_DPATH];
- f = zfile_fopen (path, "rb");
+ f = zfile_fopen (path, L"rb");
if (!f) {
- strcpy (name, path);
- strcat (name, ".wav");
- f = zfile_fopen (name, "rb");
+ _tcscpy (name, path);
+ _tcscat (name, L".wav");
+ f = zfile_fopen (name, L"rb");
if (!f) {
- write_log ("driveclick: can't open '%s' (or '%s')\n", path, name);
+ write_log (L"driveclick: can't open '%s' (or '%s')\n", path, name);
return 0;
}
}
void driveclick_init (void)
{
int v, vv, i, j;
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
driveclick_fdrawcmd_detect ();
driveclick_free ();
break;
}
} else if (currprefs.dfxclick[i] == -1) {
- char path2[MAX_DPATH];
+ TCHAR path2[MAX_DPATH];
wave_initialized = 1;
for (j = 0; j < CLICK_TRACKS; j++)
drvs[i][DS_CLICK].lengths[j] = drvs[i][DS_CLICK].len;
- sprintf (tmp, "%splugins%cfloppysounds%c", start_path_data, FSDB_DIR_SEPARATOR, FSDB_DIR_SEPARATOR, FSDB_DIR_SEPARATOR);
+ _stprintf (tmp, L"%splugins%cfloppysounds%c", start_path_data, FSDB_DIR_SEPARATOR, FSDB_DIR_SEPARATOR, FSDB_DIR_SEPARATOR);
if (my_existsdir (tmp))
- strcpy (path2, tmp);
+ _tcscpy (path2, tmp);
else
- sprintf (path2, "%suae_data%c", start_path_data, FSDB_DIR_SEPARATOR);
- sprintf (tmp, "%sdrive_click_%s",
+ _stprintf (path2, L"%suae_data%c", start_path_data, FSDB_DIR_SEPARATOR);
+ _stprintf (tmp, L"%sdrive_click_%s",
path2, currprefs.dfxclickexternal[i]);
v = loadsample (tmp, &drvs[i][DS_CLICK]);
if (v)
processclicks (&drvs[i][DS_CLICK]);
- sprintf (tmp, "%sdrive_spin_%s",
+ _stprintf (tmp, L"%sdrive_spin_%s",
path2, currprefs.dfxclickexternal[i]);
v += loadsample (tmp, &drvs[i][DS_SPIN]);
- sprintf (tmp, "%sdrive_spinnd_%s",
+ _stprintf (tmp, L"%sdrive_spinnd_%s",
path2, currprefs.dfxclickexternal[i]);
v += loadsample (tmp, &drvs[i][DS_SPINND]);
- sprintf (tmp, "%sdrive_startup_%s",
+ _stprintf (tmp, L"%sdrive_startup_%s",
path2, currprefs.dfxclickexternal[i]);
v += loadsample (tmp, &drvs[i][DS_START]);
- sprintf (tmp, "%sdrive_snatch_%s",
+ _stprintf (tmp, L"%sdrive_snatch_%s",
path2, currprefs.dfxclickexternal[i]);
v += loadsample (tmp, &drvs[i][DS_SNATCH]);
}
currprefs.dfxclick[1] != changed_prefs.dfxclick[1] ||
currprefs.dfxclick[2] != changed_prefs.dfxclick[2] ||
currprefs.dfxclick[3] != changed_prefs.dfxclick[3] ||
- strcmp (currprefs.dfxclickexternal[0], changed_prefs.dfxclickexternal[0]) ||
- strcmp (currprefs.dfxclickexternal[1], changed_prefs.dfxclickexternal[1]) ||
- strcmp (currprefs.dfxclickexternal[2], changed_prefs.dfxclickexternal[2]) ||
- strcmp (currprefs.dfxclickexternal[3], changed_prefs.dfxclickexternal[3]))
+ _tcscmp (currprefs.dfxclickexternal[0], changed_prefs.dfxclickexternal[0]) ||
+ _tcscmp (currprefs.dfxclickexternal[1], changed_prefs.dfxclickexternal[1]) ||
+ _tcscmp (currprefs.dfxclickexternal[2], changed_prefs.dfxclickexternal[2]) ||
+ _tcscmp (currprefs.dfxclickexternal[3], changed_prefs.dfxclickexternal[3]))
{
currprefs.dfxclickvolume = changed_prefs.dfxclickvolume;
for (i = 0; i < 4; i++) {
currprefs.dfxclick[i] = changed_prefs.dfxclick[i];
- strcpy (currprefs.dfxclickexternal[i], changed_prefs.dfxclickexternal[i]);
+ _tcscpy (currprefs.dfxclickexternal[i], changed_prefs.dfxclickexternal[i]);
}
driveclick_init ();
}
static int enforcer_hit = 0; /* set to 1 if displaying the hit */
#define ENFORCER_BUF_SIZE 8192
-static char enforcer_buf[ENFORCER_BUF_SIZE];
+static TCHAR enforcer_buf[ENFORCER_BUF_SIZE];
uae_u32 (REGPARAM3 *saved_chipmem_lget) (uaecptr addr);
uae_u32 (REGPARAM3 *saved_chipmem_wget) (uaecptr addr);
/*************************************************************
Writes the Hunk and Offset of the given Address into buf
*************************************************************/
-static int enforcer_decode_hunk_and_offset (char *buf, uae_u32 pc)
+static int enforcer_decode_hunk_and_offset (TCHAR *buf, uae_u32 pc)
{
uae_u32 sysbase = get_long (4);
uae_u32 semaphore_list = sysbase + 532;
if (pc > address && pc < address + size) {
uae_u32 name, offset;
- uae_u8 *native_name;
+ TCHAR *native_name;
offset = pc - address - 4;
name = get_long (node + 8); /* ln_Name */
if (name) {
- native_name = amiga2native(name,100);
- if (!native_name) native_name = "Unknown";
- } else native_name = "Unknown";
-
- sprintf (buf, "----> %08lx - \"%s\" Hunk %04lx Offset %08lx\n", pc, native_name, hunk, offset);
+ native_name = au (amiga2native(name,100));
+ if (!native_name)
+ native_name = my_strdup (L"Unknown");
+ } else {
+ native_name = my_strdup (L"Unknown");
+ }
+ _stprintf (buf, L"----> %08lx - \"%s\" Hunk %04lx Offset %08lx\n", pc, native_name, hunk, offset);
+ xfree (native_name);
return 1;
}
/*************************************************************
Display the enforcer hit
*************************************************************/
-static void enforcer_display_hit (const char *addressmode, uae_u32 pc, uaecptr addr)
+static void enforcer_display_hit (const TCHAR *addressmode, uae_u32 pc, uaecptr addr)
{
uae_u32 a7;
uae_u32 sysbase;
uae_u32 this_task;
uae_u32 task_name;
- uae_u8 *native_task_name;
+ TCHAR *native_task_name = NULL;
int i, j;
- static char buf[256],instrcode[256];
- static char lines[INSTRUCTIONLINES/2][256];
+ static TCHAR buf[256],instrcode[256];
+ static TCHAR lines[INSTRUCTIONLINES/2][256];
static uaecptr bestpc_array[INSTRUCTIONLINES/2][5];
static int bestpc_idxs[INSTRUCTIONLINES/2];
- char *enforcer_buf_ptr = enforcer_buf;
+ TCHAR *enforcer_buf_ptr = enforcer_buf;
uaecptr bestpc, pospc, nextpc, temppc;
if (enforcer_hit)
goto end;
task_name = get_long (this_task + 10); /* ln_Name */
- native_task_name = amiga2native (task_name, 100);
+ native_task_name = au (amiga2native (task_name, 100));
/*if (strcmp(native_task_name,"c:MCP")!=0)
{
Exception (0x2d,0);
}*/
- strcpy (enforcer_buf_ptr, "Enforcer Hit! Bad program\n");
- enforcer_buf_ptr += strlen (enforcer_buf_ptr);
+ _tcscpy (enforcer_buf_ptr, L"Enforcer Hit! Bad program\n");
+ enforcer_buf_ptr += _tcslen (enforcer_buf_ptr);
- sprintf (buf, "Illegal %s: %08lx", addressmode, addr);
- sprintf (enforcer_buf_ptr, "%-48sPC: %0lx\n", buf, pc);
- enforcer_buf_ptr += strlen (enforcer_buf_ptr);
+ _stprintf (buf, L"Illegal %s: %08lx", addressmode, addr);
+ _stprintf (enforcer_buf_ptr, L"%-48sPC: %0lx\n", buf, pc);
+ enforcer_buf_ptr += _tcslen (enforcer_buf_ptr);
/* Data registers */
- sprintf (enforcer_buf_ptr, "Data: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
+ _stprintf (enforcer_buf_ptr, L"Data: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
m68k_dreg (®s, 0), m68k_dreg (®s, 1), m68k_dreg (®s, 2), m68k_dreg (®s, 3),
m68k_dreg (®s, 4), m68k_dreg (®s, 5), m68k_dreg (®s, 6), m68k_dreg (®s, 7));
- enforcer_buf_ptr += strlen (enforcer_buf_ptr);
+ enforcer_buf_ptr += _tcslen (enforcer_buf_ptr);
/* Address registers */
- sprintf(enforcer_buf_ptr, "Addr: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
+ _stprintf (enforcer_buf_ptr, L"Addr: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
m68k_areg (®s, 0), m68k_areg (®s, 1), m68k_areg (®s, 2), m68k_areg (®s, 3),
m68k_areg (®s, 4), m68k_areg (®s, 5), m68k_areg (®s, 6), m68k_areg (®s, 7));
- enforcer_buf_ptr += strlen (enforcer_buf_ptr);
+ enforcer_buf_ptr += _tcslen (enforcer_buf_ptr);
/* Stack */
a7 = m68k_areg (®s, 7);
for (i = 0; i < 8 * STACKLINES; i++) {
a7 += 4;
if (!(i % 8)) {
- strcpy (enforcer_buf_ptr, "Stck:");
- enforcer_buf_ptr += strlen (enforcer_buf_ptr);
+ _tcscpy (enforcer_buf_ptr, L"Stck:");
+ enforcer_buf_ptr += _tcslen (enforcer_buf_ptr);
}
- sprintf (enforcer_buf_ptr, " %08lx",get_long (a7));
- enforcer_buf_ptr += strlen (enforcer_buf_ptr);
+ _stprintf (enforcer_buf_ptr, L" %08lx",get_long (a7));
+ enforcer_buf_ptr += _tcslen (enforcer_buf_ptr);
if (i%8 == 7)
*enforcer_buf_ptr++ = '\n';
a7 = m68k_areg (®s, 7);
if (get_long (a7 - 4) != pc) {
if (enforcer_decode_hunk_and_offset (buf, pc)) {
- strcpy (enforcer_buf_ptr, buf);
- enforcer_buf_ptr += strlen (enforcer_buf_ptr);
+ _tcscpy (enforcer_buf_ptr, buf);
+ enforcer_buf_ptr += _tcslen (enforcer_buf_ptr);
}
}
for (i = 0; i < BACKTRACELONGS; i++) {
a7 += 4;
if (enforcer_decode_hunk_and_offset (buf, get_long (a7))) {
- int l = strlen (buf);
+ int l = _tcslen (buf);
if (ENFORCER_BUF_SIZE - (enforcer_buf_ptr - enforcer_buf) > l + 256) {
- strcpy (enforcer_buf_ptr, buf);
+ _tcscpy (enforcer_buf_ptr, buf);
enforcer_buf_ptr += l;
}
}
}
sm68k_disasm (buf, instrcode, bestpc, NULL);
- sprintf (lines[i], "%08lx : %-20s %s\n", bestpc, instrcode, buf);
+ _stprintf (lines[i], L"%08lx : %-20s %s\n", bestpc, instrcode, buf);
temppc = bestpc;
}
i--;
for (; i >= 0; i--) {
- strcpy (enforcer_buf_ptr, lines[i]);
- enforcer_buf_ptr += strlen (enforcer_buf_ptr);
+ _tcscpy (enforcer_buf_ptr, lines[i]);
+ enforcer_buf_ptr += _tcslen (enforcer_buf_ptr);
}
/* Now the instruction after the pc including the pc */
temppc = pc;
for (i = 0; i < (INSTRUCTIONLINES + 1) / 2; i++) {
sm68k_disasm (buf, instrcode, temppc, &nextpc);
- sprintf (enforcer_buf_ptr, "%08lx : %s %-20s %s\n", temppc,
- (i == 0 ? "*" : " "), instrcode, buf);
- enforcer_buf_ptr += strlen (enforcer_buf_ptr);
+ _stprintf (enforcer_buf_ptr, L"%08lx : %s %-20s %s\n", temppc,
+ (i == 0 ? L"*" : L" "), instrcode, buf);
+ enforcer_buf_ptr += _tcslen (enforcer_buf_ptr);
temppc = nextpc;
}
if (!native_task_name)
- native_task_name = "Unknown";
- sprintf (enforcer_buf_ptr, "Name: \"%s\"\n\n", native_task_name);
- enforcer_buf_ptr += strlen (enforcer_buf_ptr);
+ native_task_name = L"Unknown";
+ _stprintf (enforcer_buf_ptr, L"Name: \"%s\"\n\n", native_task_name);
+ enforcer_buf_ptr += _tcslen (enforcer_buf_ptr);
console_out (enforcer_buf);
write_log (enforcer_buf);
flashscreen = 30;
end:
+ xfree (native_task_name);
enforcer_hit = 0;
}
if (ISILLEGAL (addr))
{
- enforcer_display_hit ("LONG READ from",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
+ enforcer_display_hit (L"LONG READ from",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
if (enforcermode & 1)
set_special (®s, SPCFLAG_TRAP);
}
if (ISILLEGAL (addr))
{
- enforcer_display_hit ("WORD READ from",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
+ enforcer_display_hit (L"WORD READ from",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
if (enforcermode & 1)
set_special (®s, SPCFLAG_TRAP);
}
if (ISILLEGAL (addr))
{
- enforcer_display_hit ("BYTE READ from",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
+ enforcer_display_hit (L"BYTE READ from",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
if (enforcermode & 1)
set_special (®s, SPCFLAG_TRAP);
}
if (ISILLEGAL (addr))
{
- enforcer_display_hit ("LONG WRITE to",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
+ enforcer_display_hit (L"LONG WRITE to",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
if (enforcermode & 1)
if (addr != 0x100)
set_special (®s, SPCFLAG_TRAP);
if (ISILLEGAL (addr))
{
- enforcer_display_hit ("WORD WRITE to",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
+ enforcer_display_hit (L"WORD WRITE to",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
if (enforcermode & 1)
set_special (®s, SPCFLAG_TRAP);
}
if (ISILLEGAL (addr))
{
- enforcer_display_hit ("BYTE WRITE to",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
+ enforcer_display_hit (L"BYTE WRITE to",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
if (enforcermode & 1)
set_special (®s, SPCFLAG_TRAP);
}
uae_u32 REGPARAM2 dummy_lget2 (uaecptr addr)
{
special_mem_r;
- enforcer_display_hit ("LONG READ from",(uae_u32)(regs.pc_p - NMEM_OFFSET), addr);
+ enforcer_display_hit (L"LONG READ from",(uae_u32)(regs.pc_p - NMEM_OFFSET), addr);
if (enforcermode & 1) {
set_special (®s, SPCFLAG_TRAP);
return 0;
if (addr >= 0x00F10000 && addr <= 0x00F7FFFF) {
if (!warned_JIT_0xF10000) {
warned_JIT_0xF10000 = 1;
- enforcer_display_hit ("LONG READ from",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
+ enforcer_display_hit (L"LONG READ from",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
}
return 0;
}
#endif
- enforcer_display_hit ("WORD READ from",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
+ enforcer_display_hit (L"WORD READ from",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
if (enforcermode & 1) {
set_special (®s, SPCFLAG_TRAP);
return 0;
uae_u32 REGPARAM2 dummy_bget2 (uaecptr addr)
{
special_mem_r;
- enforcer_display_hit ("BYTE READ from",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
+ enforcer_display_hit (L"BYTE READ from",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
if (enforcermode & 1) {
set_special (®s, SPCFLAG_TRAP);
return 0;
void REGPARAM2 dummy_lput2 (uaecptr addr, uae_u32 l)
{
special_mem_w;
- enforcer_display_hit ("LONG WRITE to",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
+ enforcer_display_hit (L"LONG WRITE to",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
if (enforcermode & 1) {
set_special (®s, SPCFLAG_TRAP);
return;
void REGPARAM2 dummy_wput2 (uaecptr addr, uae_u32 w)
{
special_mem_w;
- enforcer_display_hit ("WORD WRITE to",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
+ enforcer_display_hit (L"WORD WRITE to",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
if (enforcermode & 1) {
set_special (®s, SPCFLAG_TRAP);
return;
void REGPARAM2 dummy_bput2 (uaecptr addr, uae_u32 b)
{
special_mem_w;
- enforcer_display_hit ("BYTE WRITE to",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
+ enforcer_display_hit (L"BYTE WRITE to",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
if (enforcermode & 1) {
set_special (®s, SPCFLAG_TRAP);
return;
int REGPARAM2 dummy_check2 (uaecptr addr, uae_u32 size)
{
special_mem_r;
- enforcer_display_hit ("CHECK from ",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
+ enforcer_display_hit (L"CHECK from ",(uae_u32)(regs.pc_p - NMEM_OFFSET),addr);
return 0;
}
break;
default:
- write_log ("Only CMD_READ supported in DoIO()\n");
+ write_log (L"Only CMD_READ supported in DoIO()\n");
ersatz_failed ();
}
{
uaecptr a;
already_failed = 0;
- write_log ("initializing kickstart replacement\n");
+ write_log (L"initializing kickstart replacement\n");
if (disk_empty (0)) {
already_failed = 1;
notify_user (NUMSG_KICKREP);
/* kickstart disk loader */
if (get_long (0x4000) == 0x4b49434b) {
/* a kickstart disk was found in drive 0! */
- write_log ("Loading Kickstart rom image from Kickstart disk\n");
+ write_log (L"Loading Kickstart rom image from Kickstart disk\n");
/* print some notes... */
- write_log ("NOTE: if UAE crashes set CPU to 68000 and/or chipmem size to 512KB!\n");
+ write_log (L"NOTE: if UAE crashes set CPU to 68000 and/or chipmem size to 512KB!\n");
/* read rom image from kickstart disk */
put_word (request + 0x1C, 2);
break;
case EOP_NIMP:
- write_log ("Unimplemented Kickstart function called\n");
+ write_log (L"Unimplemented Kickstart function called\n");
ersatz_failed ();
/* fall through */
case EOP_OPENLIB:
default:
- write_log ("Internal error. Giving up.\n");
+ write_log (L"Internal error. Giving up.\n");
ersatz_failed ();
}
}
addrbank expamem_bank = {
expamem_lget, expamem_wget, expamem_bget,
expamem_lput, expamem_wput, expamem_bput,
- default_xlate, default_check, NULL, "Autoconfig",
+ default_xlate, default_check, NULL, L"Autoconfig",
dummy_lgeti, dummy_wgeti, ABFLAG_IO | ABFLAG_SAFE
};
static void expamem_map_clear (void)
{
- write_log ("expamem_map_clear() got called. Shouldn't happen.\n");
+ write_log (L"expamem_map_clear() got called. Shouldn't happen.\n");
}
static void expamem_init_clear (void)
static void expamem_init_last (void)
{
expamem_init_clear2 ();
- write_log ("Memory map after autoconfig:\n");
+ write_log (L"Memory map after autoconfig:\n");
memory_map_dump();
}
static uae_u32 REGPARAM2 expamem_lget (uaecptr addr)
{
- write_log ("warning: READ.L from address $%lx PC=%x\n", addr, M68K_GETPC);
+ write_log (L"warning: READ.L from address $%lx PC=%x\n", addr, M68K_GETPC);
return (expamem_wget (addr) << 16) | expamem_wget (addr + 2);
}
static uae_u32 REGPARAM2 expamem_wget (uaecptr addr)
{
uae_u32 v = (expamem_bget (addr) << 8) | expamem_bget (addr + 1);
- write_log ("warning: READ.W from address $%lx=%04x PC=%x\n", addr, v & 0xffff, M68K_GETPC);
+ write_log (L"warning: READ.W from address $%lx=%04x PC=%x\n", addr, v & 0xffff, M68K_GETPC);
return v;
}
#endif
addr &= 0xFFFF;
b = expamem[addr];
- //write_log ("%08x=%02X\n", addr, b);
+ //write_log (L"%08x=%02X\n", addr, b);
return b;
}
#ifdef JIT
special_mem |= S_WRITE;
#endif
- write_log ("warning: WRITE.L to address $%lx : value $%lx\n", addr, value);
+ write_log (L"warning: WRITE.L to address $%lx : value $%lx\n", addr, value);
}
static void REGPARAM2 expamem_wput (uaecptr addr, uae_u32 value)
if (ecard >= cardno)
return;
if (expamem_type() != zorroIII)
- write_log ("warning: WRITE.W to address $%lx : value $%x\n", addr, value);
+ write_log (L"warning: WRITE.W to address $%lx : value $%x\n", addr, value);
else {
switch (addr & 0xff) {
case 0x44:
(*card_map[ecard]) ();
ecard++;
if (p1 != p2)
- write_log (" Card %d remapped %04x0000 -> %04x0000\n", ecard, p1, p2);
- write_log (" Card %d (Zorro%s) done.\n", ecard, expamem_type () == 0xc0 ? "II" : "III");
+ write_log (L" Card %d remapped %04x0000 -> %04x0000\n", ecard, p1, p2);
+ write_log (L" Card %d (Zorro%s) done.\n", ecard, expamem_type () == 0xc0 ? L"II" : L"III");
if (ecard < cardno)
(*card_init[ecard]) ();
else
if (expamem_type () == zorroII) {
expamem_hi = value;
(*card_map[ecard]) ();
- write_log (" Card %d (Zorro%s) done.\n", ecard + 1, expamem_type () == 0xc0 ? "II" : "III");
+ write_log (L" Card %d (Zorro%s) done.\n", ecard + 1, expamem_type () == 0xc0 ? "II" : "III");
++ecard;
if (ecard < cardno)
(*card_init[ecard]) ();
break;
case 0x4c:
- write_log (" Card %d (Zorro%s) had no success.\n", ecard + 1, expamem_type () == 0xc0 ? "II" : "III");
+ write_log (L" Card %d (Zorro%s) had no success.\n", ecard + 1, expamem_type () == 0xc0 ? "II" : "III");
++ecard;
if (ecard < cardno)
(*card_init[ecard]) ();
expamem_init_clear ();
if (!rl)
return;
- write_log ("CD32 FMV ROM '%s' %d.%d\n", rl->path, rl->rd->ver, rl->rd->rev);
+ write_log (L"CD32 FMV ROM '%s' %d.%d\n", rl->path, rl->rd->ver, rl->rd->rev);
rd = rl->rd;
z = read_rom (&rd);
if (z) {
addrbank fastmem_bank = {
fastmem_lget, fastmem_wget, fastmem_bget,
fastmem_lput, fastmem_wput, fastmem_bput,
- fastmem_xlate, fastmem_check, NULL, "Fast memory",
+ fastmem_xlate, fastmem_check, NULL, L"Fast memory",
fastmem_lget, fastmem_wget, ABFLAG_RAM
};
#ifdef JIT
special_mem |= S_READ;
#endif
- write_log ("catweasel_lget @%08X!\n",addr);
+ write_log (L"catweasel_lget @%08X!\n",addr);
return 0;
}
#ifdef JIT
special_mem |= S_READ;
#endif
- write_log ("catweasel_wget @%08X!\n",addr);
+ write_log (L"catweasel_wget @%08X!\n",addr);
return 0;
}
#ifdef JIT
special_mem |= S_WRITE;
#endif
- write_log ("catweasel_lput @%08X=%08X!\n",addr,l);
+ write_log (L"catweasel_lput @%08X=%08X!\n",addr,l);
}
static void REGPARAM2 catweasel_wput (uaecptr addr, uae_u32 w)
#ifdef JIT
special_mem |= S_WRITE;
#endif
- write_log ("catweasel_wput @%08X=%04X!\n",addr,w);
+ write_log (L"catweasel_wput @%08X=%04X!\n",addr,w);
}
static void REGPARAM2 catweasel_bput (uaecptr addr, uae_u32 b)
static uae_u8 *REGPARAM2 catweasel_xlate (uaecptr addr)
{
- write_log ("catweasel_xlate @%08X size %08X\n", addr);
+ write_log (L"catweasel_xlate @%08X size %08X\n", addr);
return 0;
}
static addrbank catweasel_bank = {
catweasel_lget, catweasel_wget, catweasel_bget,
catweasel_lput, catweasel_wput, catweasel_bput,
- catweasel_xlate, catweasel_check, NULL, "Catweasel",
+ catweasel_xlate, catweasel_check, NULL, L"Catweasel",
dummy_lgeti, dummy_wgeti, ABFLAG_IO
};
{
catweasel_start = ((expamem_hi | (expamem_lo >> 4)) << 16);
map_banks (&catweasel_bank, catweasel_start >> 16, 1, 0);
- write_log ("Catweasel MK%d: mapped @$%lx\n", cwc.type, catweasel_start);
+ write_log (L"Catweasel MK%d: mapped @$%lx\n", cwc.type, catweasel_start);
}
static void expamem_init_catweasel (void)
#ifdef JIT
special_mem |= S_WRITE;
#endif
- write_log ("filesys_lput called PC=%p\n", M68K_GETPC);
+ write_log (L"filesys_lput called PC=%p\n", M68K_GETPC);
}
static void REGPARAM2 filesys_wput (uaecptr addr, uae_u32 w)
#ifdef JIT
special_mem |= S_WRITE;
#endif
- write_log ("filesys_wput called PC=%p\n", M68K_GETPC);
+ write_log (L"filesys_wput called PC=%p\n", M68K_GETPC);
}
static void REGPARAM2 filesys_bput (uaecptr addr, uae_u32 b)
static addrbank filesys_bank = {
filesys_lget, filesys_wget, filesys_bget,
filesys_lput, filesys_wput, filesys_bput,
- default_xlate, default_check, NULL, "Filesystem Autoconfig Area",
+ default_xlate, default_check, NULL, L"Filesystem Autoconfig Area",
dummy_lgeti, dummy_wgeti, ABFLAG_IO | ABFLAG_SAFE
};
addrbank z3fastmem_bank = {
z3fastmem_lget, z3fastmem_wget, z3fastmem_bget,
z3fastmem_lput, z3fastmem_wput, z3fastmem_bput,
- z3fastmem_xlate, z3fastmem_check, NULL, "ZorroIII Fast RAM",
+ z3fastmem_xlate, z3fastmem_check, NULL, L"ZorroIII Fast RAM",
z3fastmem_lget, z3fastmem_wget, ABFLAG_RAM
};
addrbank z3fastmem2_bank = {
z3fastmem2_lget, z3fastmem2_wget, z3fastmem2_bget,
z3fastmem2_lput, z3fastmem2_wput, z3fastmem2_bput,
- z3fastmem2_xlate, z3fastmem2_check, NULL, "ZorroIII Fast RAM #2",
+ z3fastmem2_xlate, z3fastmem2_check, NULL, L"ZorroIII Fast RAM #2",
z3fastmem2_lget, z3fastmem2_wget, ABFLAG_RAM
};
{
fastmem_start = ((expamem_hi | (expamem_lo >> 4)) << 16);
map_banks (&fastmem_bank, fastmem_start >> 16, allocated_fastmem >> 16, 0);
- write_log ("Fastcard: mapped @$%lx: %dMB fast memory\n", fastmem_start, allocated_fastmem >> 20);
+ write_log (L"Fastcard: mapped @$%lx: %dMB fast memory\n", fastmem_start, allocated_fastmem >> 20);
}
static void expamem_init_fastcard (void)
filesys_start = ((expamem_hi | (expamem_lo >> 4)) << 16);
map_banks (&filesys_bank, filesys_start >> 16, 1, 0);
- write_log ("Filesystem: mapped memory @$%lx.\n", filesys_start);
+ write_log (L"Filesystem: mapped memory @$%lx.\n", filesys_start);
/* 68k code needs to know this. */
a = here ();
org (rtarea_base + 0xFFFC);
int start = *startp;
if (start != z3fs) {
- write_log ("WARNING: Z3FAST mapping changed from $%08x to $%08x\n", start, z3fs);
+ write_log (L"WARNING: Z3FAST mapping changed from $%08x to $%08x\n", start, z3fs);
map_banks (&dummy_bank, start >> 16, size >> 16,
allocated);
*startp = z3fs;
map_banks (bank, start >> 16, size >> 16,
allocated);
}
- write_log ("Fastmem (32bit): mapped @$%08x: %d MB Zorro III fast memory \n",
+ write_log (L"Fastmem (32bit): mapped @$%08x: %d MB Zorro III fast memory \n",
start, allocated / 0x100000);
}
{
gfxmem_start = (expamem_hi | (expamem_lo >> 4)) << 16;
map_banks (&gfxmem_bankx, gfxmem_start >> 16, allocated_gfxmem >> 16, allocated_gfxmem);
- write_log ("UAEGFX-card: mapped @$%lx, %d MB RTG RAM\n", gfxmem_start, allocated_gfxmem / 0x100000);
+ write_log (L"UAEGFX-card: mapped @$%lx, %d MB RTG RAM\n", gfxmem_start, allocated_gfxmem / 0x100000);
}
static void expamem_init_gfxcard (void)
fastmem_mask = allocated_fastmem - 1;
if (allocated_fastmem) {
- fastmemory = mapped_malloc (allocated_fastmem, "fast");
+ fastmemory = mapped_malloc (allocated_fastmem, L"fast");
if (fastmemory == 0) {
- write_log ("Out of memory for fastmem card.\n");
+ write_log (L"Out of memory for fastmem card.\n");
allocated_fastmem = 0;
}
}
z3fastmem_mask = allocated_z3fastmem - 1;
if (allocated_z3fastmem) {
- z3fastmem = mapped_malloc (allocated_z3fastmem, "z3");
+ z3fastmem = mapped_malloc (allocated_z3fastmem, L"z3");
if (z3fastmem == 0) {
- write_log ("Out of memory for 32 bit fast memory.\n");
+ write_log (L"Out of memory for 32 bit fast memory.\n");
allocated_z3fastmem = 0;
}
}
z3fastmem2_mask = allocated_z3fastmem2 - 1;
if (allocated_z3fastmem2) {
- z3fastmem2 = mapped_malloc (allocated_z3fastmem2, "z3_2");
+ z3fastmem2 = mapped_malloc (allocated_z3fastmem2, L"z3_2");
if (z3fastmem2 == 0) {
- write_log ("Out of memory for 32 bit fast memory #2.\n");
+ write_log (L"Out of memory for 32 bit fast memory #2.\n");
allocated_z3fastmem2 = 0;
}
}
gfxmem_mask = allocated_gfxmem - 1;
if (allocated_gfxmem) {
- gfxmemory = mapped_malloc (allocated_gfxmem, "gfx");
+ gfxmemory = mapped_malloc (allocated_gfxmem, L"gfx");
if (gfxmemory == 0) {
- write_log ("Out of memory for graphics card memory\n");
+ write_log (L"Out of memory for graphics card memory\n");
allocated_gfxmem = 0;
}
}
|| kickstart_version < 34))
{
/* warn user */
- write_log ("Kickstart version is below 1.3! Disabling autoconfig devices.\n");
+ write_log (L"Kickstart version is below 1.3! Disabling autoconfig devices.\n");
do_mount = 0;
}
if (need_uae_boot_rom() == 0)
if (currprefs.cs_cd32cd && currprefs.fastmem_size == 0 && currprefs.chipmem_size <= 0x200000) {
int ids[] = { 23, -1 };
struct romlist *rl = getromlistbyids (ids);
- if (rl && !strcmp (rl->path, currprefs.cartfile)) {
+ if (rl && !_tcscmp (rl->path, currprefs.cartfile)) {
card_init[cardno] = expamem_init_cd32fmv;
card_map[cardno++] = expamem_map_cd32fmv;
}
allocate_expamem ();
#ifdef FILESYS
- filesysory = mapped_malloc (0x10000, "filesys");
+ filesysory = mapped_malloc (0x10000, L"filesys");
if (!filesysory) {
- write_log ("virtual memory exhausted (filesysory)!\n");
+ write_log (L"virtual memory exhausted (filesysory)!\n");
exit (0);
}
filesys_bank.baseaddr = filesysory;
#include <assert.h>
#ifdef DEBUG
-static char *datalog (uae_u8 *src, int len)
+static TCHAR *datalog (uae_u8 *src, int len)
{
- static char buf[1000];
+ static TCHAR buf[1000];
static int offset;
int i = 0, offset2;
offset2 = offset;
buf[offset++]='\'';
while (len--) {
- sprintf (buf + offset, "%02X", src[i]);
+ _stprintf (buf + offset, "%02X", src[i]);
offset += 2;
i++;
if (i > 10) break;
return buf + offset2;
}
#else
-static char *datalog (uae_u8 *src, int len) { return ""; }
+static TCHAR *datalog (uae_u8 *src, int len) { return L""; }
#endif
#ifdef DEBUG
return;
size = ((int*)p)[-1];
fdi_allocated -= size;
- write_log ("%d freed (%d)\n", size, fdi_allocated);
+ write_log (L"%d freed (%d)\n", size, fdi_allocated);
free ((int*)p - 1);
}
static void *fdi_malloc (int size)
void *p = xmalloc (size + sizeof (int));
((int*)p)[0] = size;
fdi_allocated += size;
- write_log ("%d allocated (%d)\n", size, fdi_allocated);
+ write_log (L"%d allocated (%d)\n", size, fdi_allocated);
return (int*)p + 1;
}
#else
/* unknown track */
static void zxx (FDI *fdi)
{
- outlog ("track %d: unknown track type 0x%02X\n", fdi->current_track, fdi->track_type);
+ outlog (L"track %d: unknown track type 0x%02X\n", fdi->current_track, fdi->track_type);
// return -1;
}
/* unsupported track */
static void zyy (FDI *fdi)
{
- outlog ("track %d: unsupported track type 0x%02X\n", fdi->current_track, fdi->track_type);
+ outlog (L"track %d: unsupported track type 0x%02X\n", fdi->current_track, fdi->track_type);
// return -1;
}
/* empty track */
/* unknown sector described type */
static void dxx (FDI *fdi)
{
- outlog ("\ntrack %d: unknown sector described type 0x%02X\n", fdi->current_track, fdi->track_type);
+ outlog (L"\ntrack %d: unknown sector described type 0x%02X\n", fdi->current_track, fdi->track_type);
fdi->err = 1;
}
/* unsupported sector described type */
static void dyy (FDI *fdi)
{
- outlog ("\ntrack %d: unsupported sector described 0x%02X\n", fdi->current_track, fdi->track_type);
+ outlog (L"\ntrack %d: unsupported sector described 0x%02X\n", fdi->current_track, fdi->track_type);
fdi->err = 1;
}
/* add position of mfm sync bit */
}
fdi->mfmsync_buffer[fdi->mfmsync_offset++] = fdi->out;
if (fdi->out == 0) {
- outlog ("illegal position for mfm sync bit, offset=%d\n",fdi->out);
+ outlog (L"illegal position for mfm sync bit, offset=%d\n",fdi->out);
fdi->err = 1;
}
if (fdi->mfmsync_offset >= MAX_MFM_SYNC_BUFFER) {
fdi->mfmsync_offset = 0;
- outlog ("mfmsync buffer overflow\n");
+ outlog (L"mfmsync buffer overflow\n");
fdi->err = 1;
}
fdi->out++;
fdi->track_dst[BIT_BYTEOFFSET] |= (1 << BIT_BITOFFSET);
fdi->out++;
if (fdi->out >= MAX_DST_BUFFER * 8) {
- outlog ("destination buffer overflow\n");
+ outlog (L"destination buffer overflow\n");
fdi->err = 1;
fdi->out = 1;
}
static void bit_drop_next (FDI *fdi)
{
if (fdi->nextdrop > 0) {
- outlog ("multiple bit_drop_next() called");
+ outlog (L"multiple bit_drop_next() called");
} else if (fdi->nextdrop < 0) {
fdi->nextdrop = 0;
debuglog (":DNN:");
static void bit_dedrop (FDI *fdi)
{
if (fdi->nextdrop) {
- outlog ("bit_drop_next called before bit_dedrop");
+ outlog (L"bit_drop_next called before bit_dedrop");
}
fdi->nextdrop = -1;
debuglog (":BDD:");
uae_u8 secbuf[544];
uae_u8 bigmfmbuf[60000];
uae_u8 *mbuf, *mbuf2, *mend;
- char sectable[22];
+ TCHAR sectable[22];
uae_u8 *raw = fdi->track_dst_buffer;
int slabel, off;
int ok = 1;
trackoffs = (id & 0xff00) >> 8;
if (trackoffs + 1 > drvsec) {
- outlog ("illegal sector offset %d\n",trackoffs);
+ outlog (L"illegal sector offset %d\n",trackoffs);
ok = 0;
mbuf = mbuf2;
continue;
}
if ((id >> 24) != 0xff) {
- outlog ("sector %d format type %02X?\n", trackoffs, id >> 24);
+ outlog (L"sector %d format type %02X?\n", trackoffs, id >> 24);
ok = 0;
}
chksum = odd ^ even;
even = getmfmlong (mbuf + 2 * 2);
mbuf += 4 * 2;
if (((odd << 1) | even) != chksum) {
- outlog ("sector %d header crc error\n", trackoffs);
+ outlog (L"sector %d header crc error\n", trackoffs);
ok = 0;
mbuf = mbuf2;
continue;
}
- outlog ("sector %d header crc ok\n", trackoffs);
+ outlog (L"sector %d header crc ok\n", trackoffs);
if (((id & 0x00ff0000) >> 16) != (uae_u32)fdi->current_track) {
- outlog ("illegal track number %d <> %d\n",fdi->current_track,(id & 0x00ff0000) >> 16);
+ outlog (L"illegal track number %d <> %d\n",fdi->current_track,(id & 0x00ff0000) >> 16);
ok++;
mbuf = mbuf2;
continue;
}
mbuf += 256 * 2;
if (chksum) {
- outlog ("sector %d data checksum error\n",trackoffs);
+ outlog (L"sector %d data checksum error\n",trackoffs);
ok = 0;
} else if (sectable[trackoffs]) {
- outlog ("sector %d already found?\n", trackoffs);
+ outlog (L"sector %d already found?\n", trackoffs);
mbuf = mbuf2;
} else {
- outlog ("sector %d ok\n",trackoffs);
- if (slabel) outlog ("(non-empty sector header)\n");
+ outlog (L"sector %d ok\n",trackoffs);
+ if (slabel) outlog (L"(non-empty sector header)\n");
sectable[trackoffs] = 1;
secwritten++;
if (trackoffs == 9)
}
for (i = 0; i < drvsec; i++) {
if (!sectable[i]) {
- outlog ("sector %d missing\n", i);
+ outlog (L"sector %d missing\n", i);
ok = 0;
}
}
fdi->index_offset = get_u32(fdi->track_src);
fdi->index_offset >>= 8;
fdi->track_src += 3;
- outlog ("sectors_described, index offset: %d\n",fdi->index_offset);
+ outlog (L"sectors_described, index offset: %d\n",fdi->index_offset);
do {
fdi->track_type = *fdi->track_src++;
- outlog ("%06X %06X %02X:",fdi->track_src - start_src + 0x200, fdi->out/8, fdi->track_type);
+ outlog (L"%06X %06X %02X:",fdi->track_src - start_src + 0x200, fdi->out/8, fdi->track_type);
oldout = fdi->out;
decode_sectors_described_track[fdi->track_type](fdi);
- outlog (" %d\n", fdi->out - oldout);
+ outlog (L" %d\n", fdi->out - oldout);
oldout = fdi->out;
if (fdi->out < 0 || fdi->err) {
- outlog ("\nin %d bytes, out %d bits\n", fdi->track_src - fdi->track_src_buffer, fdi->out);
+ outlog (L"\nin %d bytes, out %d bits\n", fdi->track_src - fdi->track_src_buffer, fdi->out);
return -1;
}
if (fdi->track_src - fdi->track_src_buffer >= fdi->track_src_len) {
- outlog ("source buffer overrun, previous type: %02X\n", fdi->track_type);
+ outlog (L"source buffer overrun, previous type: %02X\n", fdi->track_type);
return -1;
}
} while (fdi->track_type != 0xff);
- outlog ("\n");
+ outlog (L"\n");
fix_mfm_sync (fdi);
return fdi->out;
}
static void dumpstream(int track, uae_u8 *stream, int len)
{
#if 0
- char name[100];
+ TCHAR name[100];
FILE *f;
- sprintf (name, "track_%d.raw", track);
+ _stprintf (name, "track_%d.raw", track);
f = fopen(name, "wb");
fwrite (stream, 1, len * 4, f);
fclose (f);
|| (avgp[i] < (standard_MFM_2_bit_cell_size - (standard_MFM_2_bit_cell_size / 4))) ) )
i++;
if (i == pulses) {
- outlog ("No stable and long-enough pulse in track.\n");
+ outlog (L"No stable and long-enough pulse in track.\n");
return;
}
i--;
|| (minp[i] < (standard_MFM_2_bit_cell_size - (standard_MFM_2_bit_cell_size / 4))) ) )
i++;
if (i == pulses) {
- outlog ("FDI: No stable and long-enough pulse in track.\n");
+ outlog (L"FDI: No stable and long-enough pulse in track.\n");
return;
}
nexti = i;
}
avg_pulse += jitter;
if ((avg_pulse < min_pulse) || (avg_pulse > max_pulse)) {
- outlog ("FDI: avg_pulse outside bounds! avg=%u min=%u max=%u\n", avg_pulse, min_pulse, max_pulse);
- outlog ("FDI: avgp=%u (%u) minp=%u (%u) maxp=%u (%u) jitter=%d i=%d ni=%d\n",
+ outlog (L"FDI: avg_pulse outside bounds! avg=%u min=%u max=%u\n", avg_pulse, min_pulse, max_pulse);
+ outlog (L"FDI: avgp=%u (%u) minp=%u (%u) maxp=%u (%u) jitter=%d i=%d ni=%d\n",
avgp[i], avgp[nexti], minp[i], minp[nexti], maxp[i], maxp[nexti], jitter, i, nexti);
}
if (avg_pulse < ref_pulse)
- outlog ("FDI: avg_pulse < ref_pulse! (%u < %u)\n", avg_pulse, ref_pulse);
+ outlog (L"FDI: avg_pulse < ref_pulse! (%u < %u)\n", avg_pulse, ref_pulse);
pulse += avg_pulse - ref_pulse;
ref_pulse = 0;
if (i == eodat)
return 1;
}
-static unsigned char fdiid[]={"Formatted Disk Image file"};
+static uae_char fdiid[] = {"Formatted Disk Image file"};
static int bit_rate_table[16] = { 125,150,250,300,500,1000 };
void fdi2raw_header_free (FDI *fdi)
uae_u32 crc = get_crc32(fdi->header, 508);
uae_u32 crc2 = (fdi->header[508] << 24) | (fdi->header[509] << 16) | (fdi->header[510] << 8) | fdi->header[511];
if (crc != crc2) {
- outlog ("FDI: header checksum error\n");
+ outlog (L"FDI: header checksum error\n");
fdi_free(fdi);
return NULL;
}
fdi->last_track = ((fdi->header[142] << 8) + fdi->header[143]) + 1;
fdi->last_track *= fdi->header[144] + 1;
if (fdi->last_track >= MAX_TRACKS) {
- write_log ("FDI: last_track >= MAX_TRACKS (%d >= %d)\n", fdi->last_track, MAX_TRACKS);
+ write_log (L"FDI: last_track >= MAX_TRACKS (%d >= %d)\n", fdi->last_track, MAX_TRACKS);
fdi->last_track = MAX_TRACKS - 1;
}
fdi->last_head = fdi->header[144];
fdi->rotation_speed = fdi->header[146] + 128;
fdi->write_protect = fdi->header[147] & 1;
fdi->reversed_side = (fdi->header[147] & 4) ? 1 : 0;
- outlog ("FDI version %d.%d\n", fdi->header[140], fdi->header[141]);
- outlog ("last_track=%d rotation_speed=%d\n", fdi->last_track, fdi->rotation_speed);
+ outlog (L"FDI version %d.%d\n", fdi->header[140], fdi->header[141]);
+ outlog (L"last_track=%d rotation_speed=%d\n", fdi->last_track, fdi->rotation_speed);
offset = 512;
i = fdi->last_track;
static uae_sem_t test_sem;
+static char *ua_fs (const TCHAR *src)
+{
+ return uacp (src, currprefs.win32_fscodepage);
+}
+static TCHAR *au_fs (const char *src)
+{
+ return aucp (src, currprefs.win32_fscodepage);
+}
+static TCHAR *au_fs_copy (TCHAR *dst, int maxlen, const char *src)
+{
+ return aucp_copy (dst, maxlen, src, currprefs.win32_fscodepage);
+}
+static char *ua_fs_copy (char *dst, int maxlen, const TCHAR *src)
+{
+ return uacp_copy (dst, maxlen, src, currprefs.win32_fscodepage);
+}
+
static void aino_test (a_inode *aino)
{
#ifdef AINO_DEBUG
if (!aino || !aino->next)
return;
if ((aino->checksum1 ^ aino->checksum2) != 0xaaaa5555) {
- write_log ("PANIC: corrupted or freed but used aino detected!", aino);
+ write_log (L"PANIC: corrupted or freed but used aino detected!", aino);
}
aino3 = aino;
aino = aino->next;
if (aino->prev != aino3) {
- write_log ("PANIC: corrupted aino linking!\n");
+ write_log (L"PANIC: corrupted aino linking!\n");
break;
}
if (aino == aino2) break;
typedef struct {
int open;
- char *devname; /* device name, e.g. UAE0: */
+ TCHAR *devname; /* device name, e.g. UAE0: */
uaecptr devname_amiga;
uaecptr startup;
- char *volname; /* volume name, e.g. CDROM, WORK, etc. */
+ TCHAR *volname; /* volume name, e.g. CDROM, WORK, etc. */
int volflags; /* volume flags, readonly, stream uaefsdb support */
- char *rootdir; /* root native directory/hdf. empty drive if invalid path */
+ TCHAR *rootdir; /* root native directory/hdf. empty drive if invalid path */
struct zvolume *zarchive;
- char *rootdirdiff; /* "diff" file/directory */
+ TCHAR *rootdirdiff; /* "diff" file/directory */
int readonly; /* disallow write access? */
int bootpri; /* boot priority. -128 = no autoboot, -129 = no mount */
int devno;
int rdb_cylblocks;
uae_u8 *rdb_filesysstore;
int rdb_filesyssize;
- char *filesysdir;
+ TCHAR *filesysdir;
} UnitInfo;
ui = &uitmp;
if (!uci->ishdf) {
mi->ismounted = 1;
- if (uci->rootdir && strlen(uci->rootdir) == 0)
+ if (uci->rootdir && _tcslen(uci->rootdir) == 0)
return FILESYS_VIRTUAL;
if (my_existsfile (uci->rootdir)) {
mi->ismedia = 1;
return FILESYS_HARDFILE;
}
-static void stripsemicolon(char *s)
+static void stripsemicolon (TCHAR *s)
{
if (!s)
return;
- while(strlen(s) > 0 && s[strlen(s) - 1] == ':')
- s[strlen(s) - 1] = 0;
+ while(_tcslen(s) > 0 && s[_tcslen(s) - 1] == ':')
+ s[_tcslen(s) - 1] = 0;
}
-char *filesys_createvolname (const char *volname, const char *rootdir, const char *def)
+TCHAR *filesys_createvolname (const TCHAR *volname, const TCHAR *rootdir, const TCHAR *def)
{
- char *nvol = NULL;
+ TCHAR *nvol = NULL;
int i, archivehd;
- char *p = NULL;
+ TCHAR *p = NULL;
archivehd = -1;
if (my_existsfile (rootdir))
else if (my_existsdir (rootdir))
archivehd = 0;
- if ((!volname || strlen (volname) == 0) && rootdir && archivehd >= 0) {
+ if ((!volname || _tcslen (volname) == 0) && rootdir && archivehd >= 0) {
p = my_strdup (rootdir);
- for (i = strlen (p) - 1; i >= 0; i--) {
- char c = p[i];
+ for (i = _tcslen (p) - 1; i >= 0; i--) {
+ TCHAR c = p[i];
if (c == ':' || c == '/' || c == '\\') {
- if (i == strlen (p) - 1)
+ if (i == _tcslen (p) - 1)
continue;
- if (!strcmp (p + i, ":\\")) {
+ if (!_tcscmp (p + i, L":\\")) {
xfree (p);
- p = xmalloc (10);
+ p = xmalloc (10 * sizeof (TCHAR));
p[0] = rootdir[0];
p[1] = 0;
i = 0;
nvol = my_strdup (p + i);
}
if (!nvol && archivehd >= 0) {
- char *s = NULL;
- if (volname && strlen(volname) > 0)
+ TCHAR *s = NULL;
+ if (volname && _tcslen (volname) > 0)
nvol = my_strdup (volname);
else
nvol = my_strdup (def);
}
if (!nvol) {
- if (volname && strlen (volname))
+ if (volname && _tcslen (volname))
nvol = my_strdup (volname);
else
- nvol = my_strdup ("");
+ nvol = my_strdup (L"");
}
stripsemicolon (nvol);
xfree (p);
return nvol;
}
-static int set_filesys_volume(const char *rootdir, int *flags, int *readonly, int *emptydrive, struct zvolume **zvp)
+static int set_filesys_volume (const TCHAR *rootdir, int *flags, int *readonly, int *emptydrive, struct zvolume **zvp)
{
*emptydrive = 0;
if (my_existsfile(rootdir)) {
struct zvolume *zv;
zv = zfile_fopen_archive(rootdir);
if (!zv) {
- write_log ("'%s' is not a supported archive file\n", rootdir);
+ write_log (L"'%s' is not a supported archive file\n", rootdir);
return -1;
}
*zvp = zv;
*flags = my_getvolumeinfo (rootdir);
if (*flags < 0) {
if (rootdir && rootdir[0])
- write_log ("directory '%s' not found, mounting as empty drive\n", rootdir);
+ write_log (L"directory '%s' not found, mounting as empty drive\n", rootdir);
*emptydrive = 1;
*flags = 0;
} else if ((*flags) & MYVOLUMEINFO_READONLY) {
- write_log ("'%s' set to read-only\n", rootdir);
+ write_log (L"'%s' set to read-only\n", rootdir);
*readonly = 1;
}
}
}
static int set_filesys_unit_1 (int nr,
- char *devname, char *volname, const char *rootdir, int readonly,
+ TCHAR *devname, TCHAR *volname, const TCHAR *rootdir, int readonly,
int secspertrack, int surfaces, int reserved,
int blocksize, int bootpri, int donotmount, int autoboot,
- char *filesysdir, int hdc, int flags)
+ TCHAR *filesysdir, int hdc, int flags)
{
UnitInfo *ui;
int i;
break;
}
if (nr == MAX_FILESYSTEM_UNITS) {
- write_log ("No slot allocated for this unit\n");
+ write_log (L"No slot allocated for this unit\n");
return -1;
}
}
for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
if (nr == i || !mountinfo.ui[i].open)
continue;
- if (rootdir && strlen(rootdir) > 0 && !strcmpi (mountinfo.ui[i].rootdir, rootdir)) {
- write_log ("directory/hardfile '%s' already added\n", rootdir);
+ if (rootdir && _tcslen (rootdir) > 0 && !_tcsicmp (mountinfo.ui[i].rootdir, rootdir)) {
+ write_log (L"directory/hardfile '%s' already added\n", rootdir);
return -1;
}
}
if (set_filesys_volume (rootdir, &flags, &readonly, &emptydrive, &ui->zarchive) < 0)
return -1;
}
- ui->volname = filesys_createvolname (volname, rootdir, "harddrive");
+ ui->volname = filesys_createvolname (volname, rootdir, L"harddrive");
ui->volflags = flags;
} else {
ui->hf.secspertrack = secspertrack;
ui->hf.readonly = readonly;
if (!ui->hf.drive_empty) {
if (ui->hf.handle_valid == 0) {
- write_log ("Hardfile %s not found\n", ui->hf.device_name);
+ write_log (L"Hardfile %s not found\n", ui->hf.device_name);
goto err;
}
if ((ui->hf.blocksize & (ui->hf.blocksize - 1)) != 0 || ui->hf.blocksize == 0) {
- write_log ("Hardfile %s bad blocksize\n", ui->hf.device_name);
+ write_log (L"Hardfile %s bad blocksize\n", ui->hf.device_name);
goto err;
}
if ((ui->hf.secspertrack || ui->hf.surfaces || ui->hf.reservedblocks) &&
(ui->hf.secspertrack < 1 || ui->hf.surfaces < 1 || ui->hf.surfaces > 1023 ||
ui->hf.reservedblocks < 0 || ui->hf.reservedblocks > 1023) != 0) {
- write_log ("Hardfile %s bad hardfile geometry\n", ui->hf.device_name);
+ write_log (L"Hardfile %s bad hardfile geometry\n", ui->hf.device_name);
goto err;
}
if (ui->hf.blocksize > ui->hf.virtsize || ui->hf.virtsize == 0) {
- write_log ("Hardfile %s too small\n", ui->hf.device_name);
+ write_log (L"Hardfile %s too small\n", ui->hf.device_name);
goto err;
}
ui->hf.nrcyls = (int)(ui->hf.secspertrack * ui->hf.surfaces ? (ui->hf.virtsize / ui->hf.blocksize) / (ui->hf.secspertrack * ui->hf.surfaces) : 0);
}
static int set_filesys_unit (int nr,
- char *devname, char *volname, const char *rootdir, int readonly,
+ TCHAR *devname, TCHAR *volname, const TCHAR *rootdir, int readonly,
int secspertrack, int surfaces, int reserved,
int blocksize, int bootpri, int donotmount, int autoboot,
- char *filesysdir, int hdc, int flags)
+ TCHAR *filesysdir, int hdc, int flags)
{
int ret;
return ret;
}
-static int add_filesys_unit (char *devname, char *volname, const char *rootdir, int readonly,
+static int add_filesys_unit (TCHAR *devname, TCHAR *volname, const TCHAR *rootdir, int readonly,
int secspertrack, int surfaces, int reserved,
int blocksize, int bootpri, int donotmount, int autoboot,
- char *filesysdir, int hdc, int flags)
+ TCHAR *filesysdir, int hdc, int flags)
{
int ret;
gayle_add_pcmcia_sram_unit (uci->rootdir, uci->readonly);
}
}
- filesys_addexternals();
+ filesys_addexternals ();
}
-int sprintf_filesys_unit (char *buffer, int num)
+int sprintf_filesys_unit (TCHAR *buffer, int num)
{
UnitInfo *uip = mountinfo.ui;
if (uip[num].volname != 0)
- sprintf (buffer, "(DH%d:) Filesystem, %s: %s %s", num, uip[num].volname,
+ _stprintf (buffer, L"(DH%d:) Filesystem, %s: %s %s", num, uip[num].volname,
uip[num].rootdir, uip[num].readonly ? "ro" : "");
else
- sprintf (buffer, "(DH%d:) Hardfile, \"%s\", size %d Mbytes", num,
+ _stprintf (buffer, L"(DH%d:) Hardfile, \"%s\", size %d Mbytes", num,
uip[num].rootdir, uip[num].hf.virtsize / (1024 * 1024));
return 0;
}
#define dp_Arg4 32
#define dp_Arg5 36
+#define DP64_INIT -3L
+
+#define dp64_Type 8
+#define dp64_Res0 12
+#define dp64_Res2 16
+#define dp64_Res1 24
+#define dp64_Arg1 32
+#define dp64_Arg2 40
+#define dp64_Arg3 48
+#define dp64_Arg4 52
+#define dp64_Arg5 56
+
/* result codes */
#define DOS_TRUE ((unsigned long)-1L)
#define DOS_FALSE (0L)
+#define MAXFILESIZE32 (0x7fffffff)
+
/* Passed as type to Lock() */
#define SHARED_LOCK -2 /* File is readable by others */
#define ACCESS_READ -2 /* Synonym */
#define ACTION_ADD_NOTIFY 4097
#define ACTION_REMOVE_NOTIFY 4098
+#define ACTION_CHANGE_FILE_POSITION64 8001
+#define ACTION_GET_FILE_POSITION64 8002
+#define ACTION_CHANGE_FILE_SIZE64 8003
+#define ACTION_GET_FILE_SIZE64 8004
+
#define DISK_TYPE 0x444f5301 /* DOS\1 */
typedef struct {
a_inode *aino;
uae_u32 uniq;
void *fd;
- off_t file_pos;
+ uae_u64 file_pos;
int dosmode;
int createmode;
int notifyactive;
typedef struct notify {
struct notify *next;
uaecptr notifyrequest;
- char *fullname;
- char *partname;
+ TCHAR *fullname;
+ TCHAR *partname;
} Notify;
typedef struct exallkey {
uae_u32 id;
void *dirhandle;
- char *fn;
+ TCHAR *fn;
uaecptr control;
} ExAllKey;
/* Native stuff */
uae_s32 unit; /* unit number */
UnitInfo ui; /* unit startup info */
- char tmpbuf3[256];
+ TCHAR tmpbuf3[256];
/* Dummy message processing */
uaecptr dummy_message;
struct zvolume *zarchive;
int reinsertdelay;
- char *newvolume;
- char *newrootdir;
+ TCHAR *newvolume;
+ TCHAR *newrootdir;
int newreadonly;
int newflags;
#define GET_PCK_ARG4(p) ((uae_s32)(do_get_mem_long ((uae_u32 *)((p) + dp_Arg4))))
#define GET_PCK_ARG5(p) ((uae_s32)(do_get_mem_long ((uae_u32 *)((p) + dp_Arg5))))
-static int flush_cache(Unit *unit, int num);
+#define PUT_PCK64_RES0(p,v) do { do_put_mem_long ((uae_u32 *)((p) + dp64_Res0), (v)); } while (0)
+#define PUT_PCK64_RES1(p,v) do { do_put_mem_long ((uae_u32 *)((p) + dp64_Res1), ((v) >> 32)); do_put_mem_long ((uae_u32 *)((p) + dp64_Res1 + 4), ((uae_u32)v)); } while (0)
+#define PUT_PCK64_RES2(p,v) do { do_put_mem_long ((uae_u32 *)((p) + dp64_Res2), (v)); } while (0)
-static char *char1 (uaecptr addr)
+#define GET_PCK64_TYPE(p) ((uae_s32)(do_get_mem_long ((uae_u32 *)((p) + dp64_Type))))
+#define GET_PCK64_RES0(p) ((uae_s32)(do_get_mem_long ((uae_u32 *)((p) + dp64_Res0))))
+#define GET_PCK64_RES1(p) ( (((uae_s64)(do_get_mem_long ((uae_u32 *)((p) + dp64_Res1)))) << 32) | (((uae_s64)(do_get_mem_long ((uae_u32 *)((p) + dp64_Res1 + 4)))) << 0) )
+#define GET_PCK64_ARG1(p) ((uae_s32)(do_get_mem_long ((uae_u32 *)((p) + dp64_Arg1))))
+#define GET_PCK64_ARG2(p) ( (((uae_s64)(do_get_mem_long ((uae_u32 *)((p) + dp64_Arg2)))) << 32) | (((uae_s64)(do_get_mem_long ((uae_u32 *)((p) + dp64_Arg2 + 4)))) << 0) )
+#define GET_PCK64_ARG3(p) ((uae_s32)(do_get_mem_long ((uae_u32 *)((p) + dp64_Arg3))))
+#define GET_PCK64_ARG4(p) ((uae_s32)(do_get_mem_long ((uae_u32 *)((p) + dp64_Arg4))))
+#define GET_PCK64_ARG5(p) ( (((uae_s64)(do_get_mem_long ((uae_u32 *)((p) + dp64_Arg5)))) << 32) | (((uae_s64)(do_get_mem_long ((uae_u32 *)((p) + dp64_Arg5 + 4)))) << 0) )
+
+static int flush_cache (Unit *unit, int num);
+
+static TCHAR *char1 (uaecptr addr)
{
- static char buf[1024];
+ static uae_char buf[1024];
+ static TCHAR bufx[1024];
unsigned int i = 0;
do {
buf[i] = get_byte (addr);
addr++;
- } while (buf[i++] && i < sizeof(buf));
- return buf;
+ } while (buf[i++] && i < sizeof (buf));
+ return au_fs_copy (bufx, sizeof (bufx) / sizeof (TCHAR), buf);
}
-static char *bstr1 (uaecptr addr)
+static TCHAR *bstr1 (uaecptr addr)
{
- static char buf[256];
+ static TCHAR bufx[256];
+ static uae_char buf[256];
int i;
int n = get_byte (addr);
addr++;
for (i = 0; i < n; i++, addr++)
buf[i] = get_byte (addr);
buf[i] = 0;
- return buf;
+ return au_fs_copy (bufx, sizeof (bufx) / sizeof (TCHAR), buf);
}
-static char *bstr (Unit *unit, uaecptr addr)
+static TCHAR *bstr (Unit *unit, uaecptr addr)
{
int i;
int n = get_byte (addr);
+ uae_char buf[256];
addr++;
for (i = 0; i < n; i++, addr++)
- unit->tmpbuf3[i] = get_byte (addr);
- unit->tmpbuf3[i] = 0;
+ buf[i] = get_byte (addr);
+ buf[i] = 0;
+ au_fs_copy (unit->tmpbuf3, sizeof (unit->tmpbuf3) / sizeof (TCHAR), buf);
return unit->tmpbuf3;
}
-static char *bstr_cut (Unit *unit, uaecptr addr)
+static TCHAR *bstr_cut (Unit *unit, uaecptr addr)
{
- char *p = unit->tmpbuf3;
+ TCHAR *p = unit->tmpbuf3;
int i, colon_seen = 0;
int n = get_byte (addr);
}
-static void *fs_opendir (Unit *u, const char *nname)
+static void *fs_opendir (Unit *u, const TCHAR *nname)
{
if (u->volflags & MYVOLUMEINFO_ARCHIVE)
return zfile_opendir_archive (nname);
else
my_closedir (d);
}
-static void *fs_open (Unit *unit, const char *name, int flags)
+static void *fs_open (Unit *unit, const TCHAR *name, int flags)
{
int isarch = unit->volflags & MYVOLUMEINFO_ARCHIVE;
if (isarch)
else
return my_read (d, b, size);
}
-static unsigned int fs_lseek (Unit *unit, void *d, unsigned int offset, int whence)
+static uae_u64 fs_lseek64 (Unit *unit, void *d, uae_s64 offset, int whence)
{
int isarch = unit->volflags & MYVOLUMEINFO_ARCHIVE;
if (isarch)
else
return my_lseek (d, offset, whence);
}
-
+static uae_u32 fs_lseek (Unit *unit, void *d, uae_s32 offset, int whence)
+{
+ int isarch = unit->volflags & MYVOLUMEINFO_ARCHIVE;
+ if (isarch)
+ return (uae_u32)zfile_lseek_archive (d, (uae_s32)offset, whence);
+ else
+ return (uae_u32)my_lseek (d, (uae_s32)offset, whence);
+}
static void set_volume_name (Unit *unit)
{
int namelen;
int i;
+ char *s;
- namelen = strlen (unit->ui.volname);
+ s = ua_fs (unit->ui.volname);
+ namelen = strlen (s);
put_byte (unit->volume + 44, namelen);
for (i = 0; i < namelen; i++)
- put_byte (unit->volume + 45 + i, unit->ui.volname[i]);
+ put_byte (unit->volume + 45 + i, s[i]);
put_byte (unit->volume + 45 + namelen, 0);
+ xfree (s);
unit->rootnode.aname = unit->ui.volname;
unit->rootnode.nname = unit->ui.rootdir;
unit->rootnode.mountcount = unit->mountcount;
zfile_fclose_archive (u->zarchive);
u->zarchive = NULL;
u->mountcount++;
- write_log ("FILESYS: removed volume '%s'\n", u->ui.volname);
+ write_log (L"FILESYS: removed volume '%s'\n", u->ui.volname);
flush_cache (u, -1);
put_byte (u->volume + 172 - 32, -2);
- uae_Signal (get_long(u->volume + 176 - 32), 1 << 13);
+ uae_Signal (get_long (u->volume + 176 - 32), 1 << 13);
return 1;
}
}
}
}
-static void filesys_delayed_change (Unit *u, int frames, const char *rootdir, const char *volume, int readonly, int flags)
+static void filesys_delayed_change (Unit *u, int frames, const TCHAR *rootdir, const TCHAR *volume, int readonly, int flags)
{
u->reinsertdelay = 50;
u->newflags = flags;
if (volume)
u->newvolume = my_strdup (volume);
filesys_eject(u->unit);
- if (!rootdir || strlen (rootdir) == 0)
+ if (!rootdir || _tcslen (rootdir) == 0)
u->reinsertdelay = 0;
if (u->reinsertdelay > 0)
- write_log ("FILESYS: delayed insert %d: '%s' ('%s')\n", u->unit, volume ? volume : "<none>", rootdir);
+ write_log (L"FILESYS: delayed insert %d: '%s' ('%s')\n", u->unit, volume ? volume : L"<none>", rootdir);
}
-int filesys_media_change (const char *rootdir, int inserted, struct uaedev_config_info *uci)
+int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_config_info *uci)
{
Unit *u;
UnitInfo *ui;
int nr = -1;
- char volname[MAX_DPATH], *volptr;
- char devname[MAX_DPATH];
+ TCHAR volname[MAX_DPATH], *volptr;
+ TCHAR devname[MAX_DPATH];
if (!mountertask)
return 0;
for (u = units; u; u = u->next) {
if (is_hardfile (u->unit) == FILESYS_VIRTUAL) {
ui = &mountinfo.ui[u->unit];
- if (ui->rootdir && !memcmp (ui->rootdir, rootdir, strlen (rootdir)) && strlen (rootdir) + 3 >= strlen (ui->rootdir)) {
+ if (ui->rootdir && !memcmp (ui->rootdir, rootdir, _tcslen (rootdir)) && _tcslen (rootdir) + 3 >= _tcslen (ui->rootdir)) {
if (filesys_isvolume (u) && inserted) {
if (uci)
filesys_delayed_change (u, 50, rootdir, uci->volname, uci->readonly, 0);
volptr = NULL;
if (ui && ui->configureddrive && ui->volname) {
volptr = volname;
- strcpy (volptr, ui->volname);
+ _tcscpy (volptr, ui->volname);
}
}
if (!volptr) {
- volptr = filesys_createvolname (NULL, rootdir, "removable");
- strcpy (volname, volptr);
+ volptr = filesys_createvolname (NULL, rootdir, L"removable");
+ _tcscpy (volname, volptr);
xfree (volptr);
volptr = volname;
}
}
/* nope, uh, need black magic now.. */
if (uci)
- strcpy (devname, uci->devname);
+ _tcscpy (devname, uci->devname);
else
- sprintf (devname, "RDH%d", nr_units());
+ _stprintf (devname, L"RDH%d", nr_units());
nr = add_filesys_unit (devname, volptr, rootdir, 0, 0, 0, 0, 0, 0, 0, 1, NULL, 0, MYVOLUMEINFO_REUSABLE);
if (nr < 0)
return 0;
return 1;
}
-int filesys_insert (int nr, char *volume, const char *rootdir, int readonly, int flags)
+int filesys_insert (int nr, TCHAR *volume, const TCHAR *rootdir, int readonly, int flags)
{
struct uaedev_config_info *uci;
int emptydrive = 0;
if (emptydrive)
return 0;
xfree (u->ui.volname);
- ui->volname = u->ui.volname = filesys_createvolname (volume, rootdir, "removable");
+ ui->volname = u->ui.volname = filesys_createvolname (volume, rootdir, L"removable");
set_volume_name (u);
- write_log ("FILESYS: inserted volume NR=%d RO=%d '%s' ('%s')\n", nr, readonly, ui->volname, rootdir);
+ write_log (L"FILESYS: inserted volume NR=%d RO=%d '%s' ('%s')\n", nr, readonly, ui->volname, rootdir);
if (flags >= 0)
ui->volflags = u->volflags = u->ui.volflags = flags;
- strcpy (uci->volname, ui->volname);
- strcpy (uci->rootdir, rootdir);
+ _tcscpy (uci->volname, ui->volname);
+ _tcscpy (uci->rootdir, rootdir);
if (readonly >= 0)
uci->readonly = ui->readonly = u->ui.readonly = readonly;
put_byte (u->volume + 44, 0);
return 0;
}
-static void prepare_for_open (char *name)
+static void prepare_for_open (TCHAR *name)
{
#if 0
struct stat statbuf;
}
}
-static int flush_cache(Unit *unit, int num)
+static int flush_cache (Unit *unit, int num)
{
int i = 0;
int cnt = 100;
- write_log ("FILESYS: flushing cache unit %d (max %d items)\n", unit->unit, num);
+ write_log (L"FILESYS: flushing cache unit %d (max %d items)\n", unit->unit, num);
if (num == 0)
num = -1;
while (i < num || num < 0) {
aip = &aino->sibling;
} else {
if (aino->shlock > 0 || aino->elock)
- write_log ("panic: freeing locked a_inode!\n");
+ write_log (L"panic: freeing locked a_inode!\n");
de_recycle_aino (unit, aino);
dispose_aino (unit, aip, aino);
i++;
/* Still in use */
return;
- TRACE (("Recycling; cache size %d, total_locked %d\n",
+ TRACE ((L"Recycling; cache size %d, total_locked %d\n",
unit->aino_cache_size, unit->total_locked_ainos));
if (unit->aino_cache_size > 5000 + unit->total_locked_ainos) {
/* Reap a few. */
flush_cache (unit, 50);
#if 0
{
- char buffer[40];
- sprintf (buffer, "%d ainos reaped.\n", i);
+ TCHAR buffer[40];
+ _stprintf (buffer, "%d ainos reaped.\n", i);
TRACE ((buffer));
}
#endif
static void update_child_names (Unit *unit, a_inode *a, a_inode *parent)
{
- int l0 = strlen (parent->nname) + 2;
+ int l0 = _tcslen (parent->nname) + 2;
while (a != 0) {
- char *name_start;
- char *new_name;
- char dirsep[2] = { FSDB_DIR_SEPARATOR, '\0' };
+ TCHAR *name_start;
+ TCHAR *new_name;
+ TCHAR dirsep[2] = { FSDB_DIR_SEPARATOR, '\0' };
a->parent = parent;
- name_start = strrchr (a->nname, FSDB_DIR_SEPARATOR);
+ name_start = _tcsrchr (a->nname, FSDB_DIR_SEPARATOR);
if (name_start == 0) {
- write_log ("malformed file name");
+ write_log (L"malformed file name");
}
name_start++;
- new_name = (char *)xmalloc (strlen (name_start) + l0);
- strcpy (new_name, parent->nname);
- strcat (new_name, dirsep);
- strcat (new_name, name_start);
+ new_name = xmalloc ((_tcslen (name_start) + l0) * sizeof (TCHAR));
+ _tcscpy (new_name, parent->nname);
+ _tcscat (new_name, dirsep);
+ _tcscat (new_name, name_start);
xfree (a->nname);
a->nname = new_name;
if (a->child)
{
a_inode **aip;
- TRACE(("deleting aino %x\n", aino->uniq));
+ TRACE((L"deleting aino %x\n", aino->uniq));
aino_test (aino);
aino->dirty = 1;
/* If any ExKeys are currently pointing at us, advance them. */
if (aino->parent->exnext_count > 0) {
int i;
- TRACE(("entering exkey validation\n"));
+ TRACE((L"entering exkey validation\n"));
for (i = 0; i < EXKEYS; i++) {
ExamineKey *k = unit->examine_keys + i;
if (k->uniq == 0)
continue;
if (k->aino == aino->parent) {
- TRACE(("Same parent found for %d\n", i));
+ TRACE((L"Same parent found for %d\n", i));
if (k->curr_file == aino) {
k->curr_file = aino->sibling;
- TRACE(("Advancing curr_file\n"));
+ TRACE((L"Advancing curr_file\n"));
}
}
}
while (*aip != aino && *aip != 0)
aip = &(*aip)->sibling;
if (*aip != aino) {
- write_log ("Couldn't delete aino.\n");
+ write_log (L"Couldn't delete aino.\n");
return;
}
dispose_aino (unit, aip, aino);
return a;
}
-char *build_nname (const char *d, const char *n)
+TCHAR *build_nname (const TCHAR *d, const TCHAR *n)
{
- char dsep[2] = { FSDB_DIR_SEPARATOR, '\0' };
- char *p = (char *) xmalloc (strlen (d) + strlen (n) + 2);
- strcpy (p, d);
- strcat (p, dsep);
- strcat (p, n);
+ TCHAR dsep[2] = { FSDB_DIR_SEPARATOR, '\0' };
+ TCHAR *p = xmalloc ((_tcslen (d) + _tcslen (n) + 2) * sizeof (TCHAR));
+ _tcscpy (p, d);
+ _tcscat (p, dsep);
+ _tcscat (p, n);
return p;
}
-char *build_aname (const char *d, const char *n)
+TCHAR *build_aname (const TCHAR *d, const TCHAR *n)
{
- char *p = (char *) xmalloc (strlen (d) + strlen (n) + 2);
- strcpy (p, d);
- strcat (p, "/");
- strcat (p, n);
+ TCHAR *p = xmalloc ((_tcslen (d) + _tcslen (n) + 2) * sizeof (TCHAR));
+ _tcscpy (p, d);
+ _tcscat (p, L"/");
+ _tcscat (p, n);
return p;
}
/* This gets called to translate an Amiga name that some program used to
* a name that we can use on the native filesystem. */
-static char *get_nname (Unit *unit, a_inode *base, char *rel,
- char **modified_rel)
+static TCHAR *get_nname (Unit *unit, a_inode *base, TCHAR *rel,
+ TCHAR **modified_rel)
{
- char *found;
- char *p = 0;
+ TCHAR *found;
+ TCHAR *p = 0;
*modified_rel = 0;
return build_nname (base->nname, found);
}
-static char *create_nname (Unit *unit, a_inode *base, char *rel)
+static TCHAR *create_nname (Unit *unit, a_inode *base, TCHAR *rel)
{
- char *p;
+ TCHAR *p;
aino_test (base);
/* We are trying to create a file called REL. */
oh_dear:
#endif
if (currprefs.filesys_no_uaefsdb && !(base->volflags & MYVOLUMEINFO_STREAMS)) {
- write_log ("illegal filename '%s', no stream supporting filesystem and uaefsdb disabled\n", rel);
+ write_log (L"illegal filename '%s', no stream supporting filesystem and uaefsdb disabled\n", rel);
return 0;
}
p = fsdb_create_unique_nname (base, rel);
#if 0
/* Delete this code once we know everything works. */
if (access (p, R_OK) >= 0 || errno != ENOENT) {
- write_log ("Filesystem in trouble... please report.\n");
+ write_log (L"Filesystem in trouble... please report.\n");
xfree (p);
goto oh_dear;
}
return p;
}
-static int fill_file_attrs(Unit *u, a_inode *base, a_inode *c)
+static int fill_file_attrs (Unit *u, a_inode *base, a_inode *c)
{
if (u->volflags & MYVOLUMEINFO_ARCHIVE) {
int isdir, flags;
- char *comment;
- zfile_fill_file_attrs_archive(c->nname, &isdir, &flags, &comment);
+ TCHAR *comment;
+ zfile_fill_file_attrs_archive (c->nname, &isdir, &flags, &comment);
c->dir = isdir;
c->amigaos_mode = flags;
c->comment = comment;
* figure out that this is supposed to be the file "foobar.inf".
* DOS sucks...
*/
-static char *get_aname (Unit *unit, a_inode *base, char *rel)
+static TCHAR *get_aname (Unit *unit, a_inode *base, TCHAR *rel)
{
return my_strdup (rel);
}
{
aino->uniq = ++a_uniq;
if (a_uniq == 0xFFFFFFFF) {
- write_log ("Running out of a_inodes (prepare for big trouble)!\n");
+ write_log (L"Running out of a_inodes (prepare for big trouble)!\n");
}
aino->shlock = 0;
aino->elock = 0;
unit->total_locked_ainos++;
base->locked_children++;
}
- init_child_aino_tree(unit, base, aino);
+ init_child_aino_tree (unit, base, aino);
aino_test_init (aino);
aino_test (aino);
}
-static a_inode *new_child_aino (Unit *unit, a_inode *base, char *rel)
+static a_inode *new_child_aino (Unit *unit, a_inode *base, TCHAR *rel)
{
- char *modified_rel;
- char *nn;
+ TCHAR *modified_rel;
+ TCHAR *nn;
a_inode *aino = NULL;
int isarch = unit->volflags & MYVOLUMEINFO_ARCHIVE;
- TRACE(("new_child_aino %s, %s\n", base->aname, rel));
+ TRACE((L"new_child_aino %s, %s\n", base->aname, rel));
if (!isarch)
aino = fsdb_lookup_aino_aname (base, rel);
if (nn == 0)
return 0;
- aino = (a_inode *) xcalloc (sizeof (a_inode), 1);
+ aino = xcalloc (sizeof (a_inode), 1);
if (aino == 0)
return 0;
aino->aname = modified_rel ? modified_rel : my_strdup (rel);
init_child_aino (unit, base, aino);
recycle_aino (unit, aino);
- TRACE(("created aino %x, lookup, amigaos_mode %d\n", aino->uniq, aino->amigaos_mode));
+ TRACE((L"created aino %x, lookup, amigaos_mode %d\n", aino->uniq, aino->amigaos_mode));
return aino;
}
-static a_inode *create_child_aino (Unit *unit, a_inode *base, char *rel, int isdir)
+static a_inode *create_child_aino (Unit *unit, a_inode *base, TCHAR *rel, int isdir)
{
- a_inode *aino = (a_inode *) xcalloc (sizeof (a_inode), 1);
+ a_inode *aino = xcalloc (sizeof (a_inode), 1);
if (aino == 0)
return 0;
aino->dirty = 1;
recycle_aino (unit, aino);
- TRACE(("created aino %x, create\n", aino->uniq));
+ TRACE((L"created aino %x, create\n", aino->uniq));
return aino;
}
-static a_inode *lookup_child_aino (Unit *unit, a_inode *base, char *rel, uae_u32 *err)
+static a_inode *lookup_child_aino (Unit *unit, a_inode *base, TCHAR *rel, uae_u32 *err)
{
a_inode *c = base->child;
- int l0 = strlen (rel);
+ int l0 = _tcslen (rel);
aino_test (base);
aino_test (c);
}
while (c != 0) {
- int l1 = strlen (c->aname);
+ int l1 = _tcslen (c->aname);
if (l0 <= l1 && same_aname (rel, c->aname + l1 - l0)
&& (l0 == l1 || c->aname[l1-l0-1] == '/') && c->mountcount == unit->mountcount)
break;
}
/* Different version because for this one, REL is an nname. */
-static a_inode *lookup_child_aino_for_exnext (Unit *unit, a_inode *base, char *rel, uae_u32 *err)
+static a_inode *lookup_child_aino_for_exnext (Unit *unit, a_inode *base, TCHAR *rel, uae_u32 *err)
{
a_inode *c = base->child;
- int l0 = strlen (rel);
+ int l0 = _tcslen (rel);
int isarch = unit->volflags & MYVOLUMEINFO_ARCHIVE;
aino_test (base);
*err = 0;
while (c != 0) {
- int l1 = strlen (c->nname);
- /* Note: using strcmp here. */
- if (l0 <= l1 && strcmp (rel, c->nname + l1 - l0) == 0
+ int l1 = _tcslen (c->nname);
+ /* Note: using _tcscmp here. */
+ if (l0 <= l1 && _tcscmp (rel, c->nname + l1 - l0) == 0
&& (l0 == l1 || c->nname[l1-l0-1] == FSDB_DIR_SEPARATOR) && c->mountcount == unit->mountcount)
break;
c = c->sibling;
if (!isarch)
c = fsdb_lookup_aino_nname (base, rel);
if (c == 0) {
- c = (a_inode*)xcalloc (sizeof (a_inode), 1);
+ c = xcalloc (sizeof (a_inode), 1);
if (c == 0) {
*err = ERROR_NO_FREE_STORE;
return 0;
c->aname = get_aname (unit, base, rel);
c->comment = 0;
c->has_dbentry = 0;
- if (!fill_file_attrs(unit, base, c)) {
+ if (!fill_file_attrs (unit, base, c)) {
xfree (c);
*err = ERROR_NO_FREE_STORE;
return 0;
init_child_aino (unit, base, c);
recycle_aino (unit, c);
- TRACE(("created aino %x, exnext\n", c->uniq));
+ TRACE((L"created aino %x, exnext\n", c->uniq));
return c;
}
-static a_inode *get_aino (Unit *unit, a_inode *base, const char *rel, uae_u32 *err)
+static a_inode *get_aino (Unit *unit, a_inode *base, const TCHAR *rel, uae_u32 *err)
{
- char *tmp;
- char *p;
+ TCHAR *tmp;
+ TCHAR *p;
a_inode *curr;
int i;
aino_test (base);
*err = 0;
- TRACE(("get_path(%s,%s)\n", base->aname, rel));
+ TRACE((L"get_path(%s,%s)\n", base->aname, rel));
/* root-relative path? */
for (i = 0; rel[i] && rel[i] != '/' && rel[i] != ':'; i++)
} else {
a_inode *next;
- char *component_end;
- component_end = strchr (p, '/');
+ TCHAR *component_end;
+ component_end = _tcschr (p, '/');
if (component_end != 0)
*component_end = '\0';
next = lookup_child_aino (unit, curr, p, err);
}
-static uae_u32 notifyhash (char *s)
+static uae_u32 notifyhash (TCHAR *s)
{
uae_u32 hash = 0;
while (*s)
return hash % NOTIFY_HASH_SIZE;
}
-static Notify *new_notify (Unit *unit, char *name)
+static Notify *new_notify (Unit *unit, TCHAR *name)
{
- Notify *n = (Notify*)xmalloc (sizeof(Notify));
+ Notify *n = xmalloc (sizeof (Notify));
uae_u32 hash = notifyhash (name);
n->next = unit->notifyhash[hash];
unit->notifyhash[hash] = n;
}
#ifdef UAE_FILESYS_THREADS
if (is_hardfile (nr) == FILESYS_VIRTUAL) {
- ui->unit_pipe = (smp_comm_pipe *)xmalloc (sizeof (smp_comm_pipe));
- ui->back_pipe = (smp_comm_pipe *)xmalloc (sizeof (smp_comm_pipe));
+ ui->unit_pipe = xmalloc (sizeof (smp_comm_pipe));
+ ui->back_pipe = xmalloc (sizeof (smp_comm_pipe));
init_comm_pipe (ui->unit_pipe, 100, 3);
init_comm_pipe (ui->back_pipe, 100, 1);
- uae_start_thread ("filesys", filesys_thread, (void *)ui, &ui->tid);
+ uae_start_thread (L"filesys", filesys_thread, (void *)ui, &ui->tid);
}
#endif
if (savestate_state == STATE_RESTORE)
uaecptr arg2 = get_long (pkt + dp_Arg2);
uaecptr devnode;
int i;
- char* devname = bstr1 (get_long (pkt + dp_Arg1) << 2);
- char* s;
+ TCHAR *devname = bstr1 (get_long (pkt + dp_Arg1) << 2);
+ TCHAR *s;
Unit *unit;
UnitInfo *uinfo;
int late = 0;
/* find UnitInfo with correct device name */
- s = strchr (devname, ':');
+ s = _tcschr (devname, ':');
if (s)
*s = '\0';
}
if (i == MAX_FILESYSTEM_UNITS) {
- write_log ("Failed attempt to mount device '%s'\n", devname);
+ write_log (L"Failed attempt to mount device '%s'\n", devname);
put_long (pkt + dp_Res1, DOS_FALSE);
put_long (pkt + dp_Res2, ERROR_DEVICE_NOT_MOUNTED);
return 0;
if (!mountinfo.ui[i].wasisempty && !my_existsdir (mountinfo.ui[i].rootdir) && !my_existsfile (mountinfo.ui[i].rootdir))
{
- write_log ("Failed attempt to mount device '%s'\n", devname);
+ write_log (L"Failed attempt to mount device '%s'\n", devname);
put_long (pkt + dp_Res1, DOS_FALSE);
put_long (pkt + dp_Res2, ERROR_DEVICE_NOT_MOUNTED);
return 0;
/* write_comm_pipe_int (unit->ui.unit_pipe, -1, 1);*/
- write_log ("FS: %s (flags=%08X) starting..\n", unit->ui.volname, unit->volflags);
+ write_log (L"FS: %s (flags=%08X) starting..\n", unit->ui.volname, unit->volflags);
/* fill in our process in the device node */
devnode = get_long (pkt + dp_Arg3) << 2;
static void
action_disk_info (Unit *unit, dpacket packet)
{
- TRACE(("ACTION_DISK_INFO\n"));
- do_info(unit, packet, GET_PCK_ARG1 (packet) << 2);
+ TRACE((L"ACTION_DISK_INFO\n"));
+ do_info (unit, packet, GET_PCK_ARG1 (packet) << 2);
}
static void
action_info (Unit *unit, dpacket packet)
{
- TRACE(("ACTION_INFO\n"));
- do_info(unit, packet, GET_PCK_ARG2 (packet) << 2);
+ TRACE((L"ACTION_INFO\n"));
+ do_info (unit, packet, GET_PCK_ARG2 (packet) << 2);
}
static void free_key (Unit *unit, Key *k)
if (uniq == k->uniq)
return k;
}
- write_log ("Error: couldn't find key %u / %u!\n", uniq, total);
+ write_log (L"Error: couldn't find key %u / %u!\n", uniq, total);
return 0;
}
static Key *new_key (Unit *unit)
{
- Key *k = xmalloc (sizeof(Key));
+ Key *k = xmalloc (sizeof (Key));
k->uniq = ++key_uniq;
k->fd = NULL;
k->file_pos = 0;
dumplock (Unit *unit, uaecptr lock)
{
a_inode *a;
- TRACE(("LOCK: 0x%lx", lock));
+ TRACE((L"LOCK: 0x%lx", lock));
if (!lock) {
- TRACE(("\n"));
+ TRACE((L"\n"));
return;
}
- TRACE(("{ next=0x%lx, mode=%ld, handler=0x%lx, volume=0x%lx, aino %lx ",
+ TRACE((L"{ next=0x%lx, mode=%ld, handler=0x%lx, volume=0x%lx, aino %lx ",
get_long (lock) << 2, get_long (lock+8),
get_long (lock+12), get_long (lock+16),
get_long (lock + 4)));
a = lookup_aino (unit, get_long (lock + 4));
if (a == 0) {
- TRACE(("not found!"));
+ TRACE((L"not found!"));
} else {
- TRACE(("%s", a->nname));
+ TRACE((L"%s", a->nname));
}
- TRACE((" }\n"));
+ TRACE((L" }\n"));
}
-static a_inode *find_aino (Unit *unit, uaecptr lock, const char *name, uae_u32 *err)
+static a_inode *find_aino (Unit *unit, uaecptr lock, const TCHAR *name, uae_u32 *err)
{
a_inode *a;
/* That's the best we can hope to do. */
a = get_aino (unit, &unit->rootnode, name, err);
} else {
- TRACE(("aino: 0x%08lx", (unsigned long int)olda->uniq));
- TRACE((" \"%s\"\n", olda->nname));
+ TRACE((L"aino: 0x%08lx", (unsigned long int)olda->uniq));
+ TRACE((L" \"%s\"\n", olda->nname));
a = get_aino (unit, olda, name, err);
}
} else {
a = get_aino (unit, &unit->rootnode, name, err);
}
if (a) {
- TRACE(("aino=\"%s\"\n", a->nname));
+ TRACE((L"aino=\"%s\"\n", a->nname));
}
aino_test (a);
return a;
uaecptr nr = GET_PCK_ARG1 (packet);
int flags;
Notify *n;
- char *name, *p, *partname;
+ TCHAR *name, *p, *partname;
- TRACE(("ACTION_ADD_NOTIFY\n"));
+ TRACE((L"ACTION_ADD_NOTIFY\n"));
name = my_strdup (char1 (get_long (nr + 4)));
flags = get_long (nr + 12);
}
#if 0
- write_log ("Notify:\n");
- write_log ("nr_Name '%s'\n", char1 (get_long (nr + 0)));
- write_log ("nr_FullName '%s'\n", name);
- write_log ("nr_UserData %08X\n", get_long (nr + 8));
- write_log ("nr_Flags %08X\n", flags);
+ write_log (L"Notify:\n");
+ write_log (L"nr_Name '%s'\n", char1 (get_long (nr + 0)));
+ write_log (L"nr_FullName '%s'\n", name);
+ write_log (L"nr_UserData %08X\n", get_long (nr + 8));
+ write_log (L"nr_Flags %08X\n", flags);
if (flags & NRF_SEND_MESSAGE) {
- write_log ("Message NotifyRequest, port = %08X\n", get_long (nr + 16));
+ write_log (L"Message NotifyRequest, port = %08X\n", get_long (nr + 16));
} else if (flags & NRF_SEND_SIGNAL) {
- write_log ("Signal NotifyRequest, Task = %08X signal = %d\n", get_long (nr + 16), get_long (nr + 20));
+ write_log (L"Signal NotifyRequest, Task = %08X signal = %d\n", get_long (nr + 16), get_long (nr + 20));
} else {
- write_log ("corrupt NotifyRequest\n");
+ write_log (L"corrupt NotifyRequest\n");
}
#endif
- p = name + strlen (name) - 1;
+ p = name + _tcslen (name) - 1;
if (p[0] == ':')
p--;
while (p > name && p[0] != ':' && p[0] != '/')
Notify *n;
int hash;
- TRACE(("ACTION_REMOVE_NOTIFY\n"));
+ TRACE((L"ACTION_REMOVE_NOTIFY\n"));
for (hash = 0; hash < NOTIFY_HASH_SIZE; hash++) {
for (n = unit->notifyhash[hash]; n; n = n->next) {
if (n->notifyrequest == nr) {
- //write_log ("NotifyRequest %08X freed\n", n->notifyrequest);
+ //write_log (L"NotifyRequest %08X freed\n", n->notifyrequest);
xfree (n->fullname);
xfree (n->partname);
free_notify (unit, hash, n);
}
}
}
- //write_log ("Tried to free non-existing NotifyRequest %08X\n", nr);
+ //write_log (L"Tried to free non-existing NotifyRequest %08X\n", nr);
PUT_PCK_RES1 (packet, DOS_TRUE);
}
current = next;
}
if (!current) {
- write_log ("tried to unlock non-existing lock %x\n", lock);
+ write_log (L"tried to unlock non-existing lock %x\n", lock);
return;
}
put_long (current << 2, get_long (lock));
uae_u32 err;
if (mode != SHARED_LOCK && mode != EXCLUSIVE_LOCK) {
- TRACE(("Bad mode %d (should be %d or %d).\n", mode, SHARED_LOCK, EXCLUSIVE_LOCK));
+ TRACE((L"Bad mode %d (should be %d or %d).\n", mode, SHARED_LOCK, EXCLUSIVE_LOCK));
mode = SHARED_LOCK;
}
- TRACE(("ACTION_LOCK(0x%lx, \"%s\", %d)\n", lock, bstr (unit, name), mode));
+ TRACE((L"ACTION_LOCK(0x%lx, \"%s\", %d)\n", lock, bstr (unit, name), mode));
DUMPLOCK(unit, lock);
a = find_aino (unit, lock, bstr (unit, name), &err);
{
uaecptr lock = GET_PCK_ARG1 (packet) << 2;
a_inode *a;
- TRACE(("ACTION_FREE_LOCK(0x%lx)\n", lock));
+ TRACE((L"ACTION_FREE_LOCK(0x%lx)\n", lock));
DUMPLOCK(unit, lock);
a = lookup_aino (unit, get_long (lock + 4));
action_dup_lock (Unit *unit, dpacket packet)
{
uaecptr lock = GET_PCK_ARG1 (packet) << 2;
- TRACE(("ACTION_DUP_LOCK(0x%lx)\n", lock));
+ TRACE((L"ACTION_DUP_LOCK(0x%lx)\n", lock));
if (!lock) {
PUT_PCK_RES1 (packet, 0);
return;
action_lock_from_fh (Unit *unit, dpacket packet)
{
Key *k = lookup_key (unit, GET_PCK_ARG1 (packet));
- TRACE(("ACTION_COPY_DIR_FH(0x%lx)\n", GET_PCK_ARG1 (packet)));
+ TRACE((L"ACTION_COPY_DIR_FH(0x%lx)\n", GET_PCK_ARG1 (packet)));
if (k == 0) {
PUT_PCK_RES1 (packet, DOS_FALSE);
return;
static void free_exkey (Unit *unit, ExamineKey *ek)
{
if (--ek->aino->exnext_count == 0) {
- TRACE (("Freeing ExKey and reducing total_locked from %d by %d\n",
+ TRACE ((L"Freeing ExKey and reducing total_locked from %d by %d\n",
unit->total_locked_ainos, ek->aino->locked_children));
unit->total_locked_ainos -= ek->aino->locked_children;
ek->aino->locked_children = 0;
if (ek->uniq == uniq)
return ek;
}
- write_log ("Houston, we have a BIG problem.\n");
+ write_log (L"Houston, we have a BIG problem.\n");
return 0;
}
goto found;
}
/* This message should usually be harmless. */
- write_log ("Houston, we have a problem (%s).\n", aino->nname);
+ write_log (L"Houston, we have a problem (%s).\n", aino->nname);
free_exkey (unit, oldest_ek);
ek = oldest_ek;
found:
}
}
if (tmp != from->exnext_count)
- write_log ("filesys.c: Bug in ExNext bookkeeping. BAD.\n");
+ write_log (L"filesys.c: Bug in ExNext bookkeeping. BAD.\n");
to->exnext_count = from->exnext_count;
to->locked_children = from->locked_children;
from->exnext_count = 0;
static void
get_fileinfo (Unit *unit, dpacket packet, uaecptr info, a_inode *aino)
{
- struct stat statbuf;
+ struct _stat64 statbuf;
long days, mins, ticks;
int i, n, entrytype;
int fsdb_can = fsdb_cando (unit);
- char *x;
+ TCHAR *xs;
+ char *x, *x2;
- memset(&statbuf, 0, sizeof statbuf);
+ memset (&statbuf, 0, sizeof statbuf);
/* No error checks - this had better work. */
if (unit->volflags & MYVOLUMEINFO_ARCHIVE)
zfile_stat_archive (aino->nname, &statbuf);
else
- stat (aino->nname, &statbuf);
+ _wstat64 (aino->nname, &statbuf);
if (aino->parent == 0) {
/* Guru book says ST_ROOT = 1 (root directory, not currently used)
* but some programs really expect 2 from root dir..
*/
entrytype = 2;
- x = unit->ui.volname;
+ xs = unit->ui.volname;
} else {
entrytype = aino->dir ? 2 : -3;
- x = aino->aname;
+ xs = aino->aname;
}
put_long (info + 4, entrytype);
/* AmigaOS docs say these have to contain the same value. */
put_long (info + 120, entrytype);
- TRACE(("name=\"%s\"\n", x));
+
+ TRACE((L"name=\"%s\"\n", xs));
+ x2 = x = ua_fs (xs);
n = strlen (x);
if (n > 106)
n = 106;
put_byte (info + i, *x), i++, x++;
while (i < 108)
put_byte (info + i, 0), i++;
+ xfree (x2);
put_long (info + 116, fsdb_can ? aino->amigaos_mode : fsdb_mode_supported(aino));
- put_long (info + 124, statbuf.st_size);
+ put_long (info + 124, statbuf.st_size > MAXFILESIZE32 ? MAXFILESIZE32 : statbuf.st_size);
#ifdef HAVE_ST_BLOCKS
put_long (info + 128, statbuf.st_blocks);
#else
- put_long (info + 128, statbuf.st_size / 512 + 1);
+ put_long (info + 128, (statbuf.st_size > MAXFILESIZE32 ? MAXFILESIZE32 : statbuf.st_size) / 512 + 1);
#endif
get_time (statbuf.st_mtime, &days, &mins, &ticks);
put_long (info + 132, days);
if (aino->comment == 0 || !fsdb_can)
put_long (info + 144, 0);
else {
- TRACE(("comment=\"%s\"\n", aino->comment));
+ TRACE((L"comment=\"%s\"\n", aino->comment));
i = 144;
- x = aino->comment;
- if (! x)
- x = "";
+ xs = aino->comment;
+ if (!xs)
+ xs= L"";
+ x2 = x = ua_fs (xs);
n = strlen (x);
if (n > 78)
n = 78;
put_byte (info + i, *x), i++, x++;
while (i < 224)
put_byte (info + i, 0), i++;
+ xfree (x2);
}
PUT_PCK_RES1 (packet, DOS_TRUE);
}
-int get_native_path (uae_u32 lock, char *out)
+int get_native_path (uae_u32 lock, TCHAR *out)
{
int i = 0;
for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
if (mountinfo.ui[i].self) {
a_inode *a = lookup_aino (mountinfo.ui[i].self, get_long ((lock << 2) + 4));
if (a) {
- strcpy (out, a->nname);
+ _tcscpy (out, a->nname);
return 0;
}
}
int i;
int size, size2;
int entrytype;
- char *x = NULL, *comment = NULL;
+ TCHAR *xs = NULL, *commentx = NULL;
uae_u32 flags = 15, days, mins, ticks;
- struct stat statbuf;
+ struct _stat64 statbuf;
int fsdb_can = fsdb_cando (unit);
uae_u16 uid = 0, gid = 0;
+ char *x = NULL, *comment = NULL;
+ int ret = 0;
memset(&statbuf, 0, sizeof statbuf);
if (unit->volflags & MYVOLUMEINFO_ARCHIVE)
zfile_stat_archive (aino->nname, &statbuf);
else
- stat (aino->nname, &statbuf);
+ _wstat64 (aino->nname, &statbuf);
if (aino->parent == 0) {
entrytype = 2;
- x = unit->ui.volname;
+ xs = unit->ui.volname;
} else {
entrytype = aino->dir ? 2 : -3;
- x = aino->aname;
+ xs = aino->aname;
}
+ x = ua_fs (xs);
size = 0;
size2 = 4;
- if (control >= 1) {
+ if (type >= 1) {
size2 += 4;
size += strlen (x) + 1;
size = (size + 3) & ~3;
}
- if (control >= 2)
+ if (type >= 2)
size2 += 4;
- if (control >= 3)
+ if (type >= 3)
size2 += 4;
- if (control >= 4) {
- flags = fsdb_can ? aino->amigaos_mode : fsdb_mode_supported(aino);
+ if (type >= 4) {
+ flags = fsdb_can ? aino->amigaos_mode : fsdb_mode_supported (aino);
size2 += 4;
}
- if (control >= 5) {
+ if (type >= 5) {
get_time (statbuf.st_mtime, &days, &mins, &ticks);
size2 += 12;
}
- if (control >= 6) {
+ if (type >= 6) {
size2 += 4;
if (aino->comment == 0 || !fsdb_can)
- comment = "";
+ commentx = L"";
else
- comment = aino->comment;
+ commentx = aino->comment;
+ comment = ua_fs (commentx);
size += strlen (comment) + 1;
size = (size + 3) & ~3;
}
- if (control >= 7) {
+ if (type >= 7) {
size2 += 4;
uid = 0;
gid = 0;
}
if (exalldata + exalldatasize - exp < size + size2)
- return 0; /* not enough space */
+ goto end; /* not enough space */
#if EXALL_DEBUG > 0
- write_log("ID=%d, %d, %08x: '%s'%s\n",
- get_long (control + 4), get_long (control + 0), exp, x, aino->dir ? " [DIR]" : "");
+ write_log (L"ID=%d, %d, %08x: '%s'%s\n",
+ get_long (control + 4), get_long (control + 0), exp, xs, aino->dir ? L" [DIR]" : L"");
#endif
put_long (exp, exp + size + size2); /* ed_Next */
- if (control >= 1) {
+ if (type >= 1) {
put_long (exp + 4, exp + size2);
for (i = 0; i <= strlen (x); i++) {
put_byte (exp + size2, x[i]);
size2++;
}
}
- if (control >= 2)
+ if (type >= 2)
put_long (exp + 8, entrytype);
- if (control >= 3)
- put_long (exp + 12, statbuf.st_size);
- if (control >= 4)
+ if (type >= 3)
+ put_long (exp + 12, statbuf.st_size > MAXFILESIZE32 ? MAXFILESIZE32 : statbuf.st_size);
+ if (type >= 4)
put_long (exp + 16, flags);
- if (control >= 5) {
+ if (type >= 5) {
put_long (exp + 20, days);
put_long (exp + 24, mins);
put_long (exp + 28, ticks);
}
- if (control >= 6) {
+ if (type >= 6) {
put_long (exp + 32, exp + size2);
put_byte (exp + size2, strlen (comment));
for (i = 0; i <= strlen (comment); i++) {
size2++;
}
}
- if (control >= 7) {
+ if (type >= 7) {
put_word (exp + 36, uid);
put_word (exp + 38, gid);
}
put_long (control + 0, get_long (control + 0) + 1);
- return 1;
+ ret = 1;
+end:
+ xfree (x);
+ xfree (comment);
+ return ret;
}
static int action_examine_all_do (Unit *unit, uaecptr lock, ExAllKey *eak, uaecptr exalldata, uae_u32 exalldatasize, uae_u32 type, uaecptr control)
uae_u32 err;
int isarch = unit->volflags & MYVOLUMEINFO_ARCHIVE;
void *d;
- char fn[MAX_DPATH];
+ TCHAR fn[MAX_DPATH];
if (lock != 0)
base = lookup_aino (unit, get_long (lock + 4));
if (!ok)
return 0;
} else {
- strcpy (fn, eak->fn);
+ _tcscpy (fn, eak->fn);
xfree (eak->fn);
eak->fn = NULL;
}
id = get_long (control + 4);
eak = getexall (unit, control, id);
#if EXALL_DEBUG > 0
- write_log ("EXALL_END ID=%d %x\n", id, eak);
+ write_log (L"EXALL_END ID=%d %x\n", id, eak);
#endif
if (!eak) {
- write_log ("FILESYS: EXALL_END non-existing ID %d\n", id);
+ write_log (L"FILESYS: EXALL_END non-existing ID %d\n", id);
doserr = ERROR_OBJECT_WRONG_TYPE;
} else {
eak->id = 0;
ok = 0;
#if EXALL_DEBUG > 0
- write_log ("exall: %08x %08x-%08x %d %d %08x\n",
+ write_log (L"exall: %08x %08x-%08x %d %d %08x\n",
lock, exalldata, exalldata + exalldatasize, exalldatasize, type, control);
- write_log ("exall: MatchString %08x, MatchFunc %08x\n",
+ write_log (L"exall: MatchString %08x, MatchFunc %08x\n",
get_long (control + 8), get_long (control + 12));
#endif
PUT_PCK_RES1 (packet, DOS_TRUE);
id = get_long (control + 4);
if (id == EXALL_END) {
- write_log ("FILESYS: EXALL called twice with ERROR_NO_MORE_ENTRIES\n");
+ write_log (L"FILESYS: EXALL called twice with ERROR_NO_MORE_ENTRIES\n");
goto fail; /* already ended exall() */
}
if (id) {
eak = getexall (unit, control, id);
if (!eak) {
- write_log ("FILESYS: EXALL non-existing ID %d\n", id);
+ write_log (L"FILESYS: EXALL non-existing ID %d\n", id);
doserr = ERROR_OBJECT_WRONG_TYPE;
goto fail;
}
uae_u32 id = get_long (control + 4);
#if EXALL_DEBUG > 0
- write_log ("FILESYS: EXALL extra round ID=%d\n", id);
+ write_log (L"FILESYS: EXALL extra round ID=%d\n", id);
#endif
if (id == EXALL_END)
return 1;
uaecptr info = GET_PCK_ARG2 (packet) << 2;
a_inode *aino = 0;
- TRACE(("ACTION_EXAMINE_OBJECT(0x%lx,0x%lx)\n", lock, info));
+ TRACE((L"ACTION_EXAMINE_OBJECT(0x%lx,0x%lx)\n", lock, info));
DUMPLOCK(unit, lock);
if (lock != 0)
base->locked_children++;
unit->total_locked_ainos++;
}
- TRACE(("Populating directory, child %p, locked_children %d\n",
+ TRACE((L"Populating directory, child %p, locked_children %d\n",
base->child, base->locked_children));
for (;;) {
- char fn[MAX_DPATH];
+ TCHAR fn[MAX_DPATH];
int ok;
uae_u32 err;
static void do_examine (Unit *unit, dpacket packet, ExamineKey *ek, uaecptr info)
{
for (;;) {
- char *name;
+ TCHAR *name;
if (ek->curr_file == 0)
break;
name = ek->curr_file->nname;
get_fileinfo (unit, packet, info, ek->curr_file);
ek->curr_file = ek->curr_file->sibling;
if (!(unit->volflags & MYVOLUMEINFO_ARCHIVE) && !fsdb_exists(name)) {
- TRACE (("%s orphaned", name));
+ TRACE ((L"%s orphaned", name));
continue;
}
- TRACE (("curr_file set to %p %s\n", ek->curr_file,
- ek->curr_file ? ek->curr_file->aname : "NULL"));
+ TRACE ((L"curr_file set to %p %s\n", ek->curr_file,
+ ek->curr_file ? ek->curr_file->aname : L"NULL"));
return;
}
- TRACE(("no more entries\n"));
+ TRACE((L"no more entries\n"));
free_exkey (unit, ek);
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_NO_MORE_ENTRIES);
ExamineKey *ek;
uae_u32 uniq;
- TRACE(("ACTION_EXAMINE_NEXT(0x%lx,0x%lx)\n", lock, info));
+ TRACE((L"ACTION_EXAMINE_NEXT(0x%lx,0x%lx)\n", lock, info));
gui_hd_led (unit->unit, 1);
DUMPLOCK(unit, lock);
for(;;) {
uniq = get_long (info);
if (uniq == 0) {
- write_log ("ExNext called for a file! (Houston?)\n");
+ write_log (L"ExNext called for a file! (Houston?)\n");
goto no_more_entries;
} else if (uniq == 0xFFFFFFFE)
goto no_more_entries;
else if (uniq == 0xFFFFFFFF) {
- TRACE(("Creating new ExKey\n"));
+ TRACE((L"Creating new ExKey\n"));
ek = new_exkey (unit, aino);
if (ek) {
if (aino->exnext_count++ == 0)
populate_directory (unit, aino);
ek->curr_file = aino->child;
- TRACE(("Initial curr_file: %p %s\n", ek->curr_file,
- ek->curr_file ? ek->curr_file->aname : "NULL"));
+ TRACE((L"Initial curr_file: %p %s\n", ek->curr_file,
+ ek->curr_file ? ek->curr_file->aname : L"NULL"));
}
} else {
- TRACE(("Looking up ExKey\n"));
+ TRACE((L"Looking up ExKey\n"));
ek = lookup_exkey (unit, get_long (info));
}
if (ek == 0) {
- write_log ("Couldn't find a matching ExKey. Prepare for trouble.\n");
+ write_log (L"Couldn't find a matching ExKey. Prepare for trouble.\n");
goto no_more_entries;
}
put_long (info, ek->uniq);
int aino_created = 0;
int isarch = unit->volflags & MYVOLUMEINFO_ARCHIVE;
- TRACE(("ACTION_FIND_*(0x%lx,0x%lx,\"%s\",%d,%d)\n", fh, lock, bstr (unit, name), mode, create));
+ TRACE((L"ACTION_FIND_*(0x%lx,0x%lx,\"%s\",%d,%d)\n", fh, lock, bstr (unit, name), mode, create));
DUMPLOCK(unit, lock);
aino = find_aino (unit, lock, bstr (unit, name), &err);
int mode;
int isarch = unit->volflags & MYVOLUMEINFO_ARCHIVE;
- TRACE(("ACTION_FH_FROM_LOCK(0x%lx,0x%lx)\n", fh, lock));
+ TRACE((L"ACTION_FH_FROM_LOCK(0x%lx,0x%lx)\n", fh, lock));
DUMPLOCK(unit,lock);
if (!lock) {
prepare_for_open (aino->nname);
- TRACE ((" mode is %d\n", mode));
+ TRACE ((L" mode is %d\n", mode));
openmode = (((mode & A_FIBF_READ) ? O_WRONLY
: (mode & A_FIBF_WRITE) ? O_RDONLY
: O_RDWR));
action_end (Unit *unit, dpacket packet)
{
Key *k;
- TRACE(("ACTION_END(0x%lx)\n", GET_PCK_ARG1 (packet)));
+ TRACE((L"ACTION_END(0x%lx)\n", GET_PCK_ARG1 (packet)));
k = lookup_key (unit, GET_PCK_ARG1 (packet));
if (k != 0) {
/* PUT_PCK_RES2 (packet, EINVAL); */
return;
}
- TRACE(("ACTION_READ(%s,0x%lx,%ld)\n", k->aino->nname, addr, size));
+ TRACE((L"ACTION_READ(%s,0x%lx,%ld)\n", k->aino->nname, addr, size));
gui_hd_led (unit->unit, 1);
#ifdef RELY_ON_LOADSEG_DETECTION
/* HACK HACK HACK HACK
* Try to detect a LoadSeg() */
if (k->file_pos == 0 && size >= 4) {
- unsigned char buf[4];
+ unsigned TCHAR buf[4];
off_t currpos = fs_lseek (unit, k->fd, 0, SEEK_CUR);
my_read (k->fd, buf, 4);
fs_lseek (unit, k->fd, currpos, SEEK_SET);
k->file_pos += actual;
}
} else {
- char *buf;
+ TCHAR *buf;
off_t old, filesize;
- write_log ("unixfs warning: Bad pointer passed for read: %08x, size %d\n", addr, size);
+ write_log (L"unixfs warning: Bad pointer passed for read: %08x, size %d\n", addr, size);
/* ugh this is inefficient but easy */
old = fs_lseek (unit, k->fd, 0, SEEK_CUR);
}
xfree (buf);
}
- TRACE(("=%d\n", actual));
+ TRACE((L"=%d\n", actual));
}
static void
uaecptr addr = GET_PCK_ARG2 (packet);
long size = GET_PCK_ARG3 (packet);
long actual;
- char *buf;
+ TCHAR *buf;
int i;
if (k == 0) {
}
gui_hd_led (unit->unit, 2);
- TRACE(("ACTION_WRITE(%s,0x%lx,%ld)\n", k->aino->nname, addr, size));
+ TRACE((L"ACTION_WRITE(%s,0x%lx,%ld)\n", k->aino->nname, addr, size));
if (unit->ui.readonly) {
PUT_PCK_RES1 (packet, DOS_FALSE);
} else {
- write_log ("unixfs warning: Bad pointer passed for write: %08x, size %d\n", addr, size);
+ write_log (L"unixfs warning: Bad pointer passed for write: %08x, size %d\n", addr, size);
/* ugh this is inefficient but easy */
- buf = (char *)malloc(size);
+ buf = (TCHAR *)malloc(size);
if (!buf) {
PUT_PCK_RES1 (packet, -1);
PUT_PCK_RES2 (packet, ERROR_NO_FREE_STORE);
xfree (buf);
}
- TRACE(("=%d\n", actual));
+ TRACE((L"=%d\n", actual));
PUT_PCK_RES1 (packet, actual);
if (actual != size)
PUT_PCK_RES2 (packet, dos_errno ());
return;
}
- if (mode > 0) whence = SEEK_END;
- if (mode < 0) whence = SEEK_SET;
+ if (mode > 0)
+ whence = SEEK_END;
+ if (mode < 0)
+ whence = SEEK_SET;
- TRACE(("ACTION_SEEK(%s,%d,%d)\n", k->aino->nname, pos, mode));
+ TRACE((L"ACTION_SEEK(%s,%d,%d)\n", k->aino->nname, pos, mode));
gui_hd_led (unit->unit, 1);
old = fs_lseek (unit, k->fd, 0, SEEK_CUR);
a_inode *a;
uae_u32 err;
- TRACE(("ACTION_SET_PROTECT(0x%lx,\"%s\",0x%lx)\n", lock, bstr (unit, name), mask));
+ TRACE((L"ACTION_SET_PROTECT(0x%lx,\"%s\",0x%lx)\n", lock, bstr (unit, name), mask));
if (unit->ui.readonly) {
PUT_PCK_RES1 (packet, DOS_FALSE);
uaecptr lock = GET_PCK_ARG2 (packet) << 2;
uaecptr name = GET_PCK_ARG3 (packet) << 2;
uaecptr comment = GET_PCK_ARG4 (packet) << 2;
- char *commented = NULL;
+ TCHAR *commented = NULL;
a_inode *a;
uae_u32 err;
if (fsdb_cando (unit)) {
commented = bstr (unit, comment);
- if (strlen (commented) > 0) {
- char *p = commented;
- commented = (char*)xmalloc (81);
- strncpy (commented, p, 80);
+ if (_tcslen (commented) > 0) {
+ TCHAR *p = commented;
+ commented = xmalloc (81 * sizeof (TCHAR));
+ _tcsncpy (commented, p, 80);
commented[80] = 0;
} else {
commented = NULL;
}
}
- TRACE (("ACTION_SET_COMMENT(0x%lx,\"%s\")\n", lock, commented));
+ TRACE ((L"ACTION_SET_COMMENT(0x%lx,\"%s\")\n", lock, commented));
a = find_aino (unit, lock, bstr (unit, name), &err);
if (err != 0) {
PUT_PCK_RES2 (packet, 0);
if (a->comment == 0 && commented == 0)
goto maybe_free_and_out;
- if (a->comment != 0 && commented != 0 && strcmp (a->comment, commented) == 0)
+ if (a->comment != 0 && commented != 0 && _tcscmp (a->comment, commented) == 0)
goto maybe_free_and_out;
if (a->comment)
xfree (a->comment);
uaecptr lock1 = GET_PCK_ARG1 (packet) << 2;
uaecptr lock2 = GET_PCK_ARG2 (packet) << 2;
- TRACE(("ACTION_SAME_LOCK(0x%lx,0x%lx)\n", lock1, lock2));
+ TRACE((L"ACTION_SAME_LOCK(0x%lx,0x%lx)\n", lock1, lock2));
DUMPLOCK(unit, lock1); DUMPLOCK(unit, lock2);
if (!lock1 || !lock2) {
unsigned long uniq;
a_inode *a = NULL, *olda = NULL;
uae_u32 err = 0;
- TRACE(("ACTION_CHANGE_MODE(0x%lx,%d,%d)\n", object, type, mode));
+ TRACE((L"ACTION_CHANGE_MODE(0x%lx,%d,%d)\n", object, type, mode));
if (! object || (type != CHANGE_FH && type != CHANGE_LOCK)) {
PUT_PCK_RES1 (packet, DOS_FALSE);
{
uaecptr lock = GET_PCK_ARG1 (packet) << 2;
- TRACE(("ACTION_PARENT(0x%lx)\n",lock));
+ TRACE((L"ACTION_PARENT(0x%lx)\n",lock));
if (!lock) {
PUT_PCK_RES1 (packet, 0);
} else {
action_parent_common (unit, packet, get_long (lock + 4));
}
- TRACE(("=%x %d\n", GET_PCK_RES1 (packet), GET_PCK_RES2 (packet)));
+ TRACE((L"=%x %d\n", GET_PCK_RES1 (packet), GET_PCK_RES2 (packet)));
}
static void
a_inode *aino;
uae_u32 err;
- TRACE(("ACTION_CREATE_DIR(0x%lx,\"%s\")\n", lock, bstr (unit, name)));
+ TRACE((L"ACTION_CREATE_DIR(0x%lx,\"%s\")\n", lock, bstr (unit, name)));
if (unit->ui.readonly) {
PUT_PCK_RES1 (packet, DOS_FALSE);
a_inode *aino = 0;
uaecptr info = GET_PCK_ARG2 (packet) << 2;
- TRACE(("ACTION_EXAMINE_FH(0x%lx,0x%lx)\n",
+ TRACE((L"ACTION_EXAMINE_FH(0x%lx,0x%lx)\n",
GET_PCK_ARG1 (packet), GET_PCK_ARG2 (packet) ));
k = lookup_key (unit, GET_PCK_ARG1 (packet));
long mode = (uae_s32)GET_PCK_ARG3 (packet);
int whence = SEEK_CUR;
- if (mode > 0) whence = SEEK_END;
- if (mode < 0) whence = SEEK_SET;
+ if (mode > 0)
+ whence = SEEK_END;
+ if (mode < 0)
+ whence = SEEK_SET;
- TRACE(("ACTION_SET_FILE_SIZE(0x%lx, %d, 0x%x)\n", GET_PCK_ARG1 (packet), offset, mode));
+ TRACE((L"ACTION_SET_FILE_SIZE(0x%lx, %d, 0x%x)\n", GET_PCK_ARG1 (packet), offset, mode));
k = lookup_key (unit, GET_PCK_ARG1 (packet));
if (k == 0) {
for (k1 = unit->keys; k1; k1 = k1->next) {
if (k != k1 && k->aino == k1->aino) {
if (k1->file_pos > offset)
- offset = k1->file_pos;
+ offset = (off_t)k1->file_pos;
}
}
/* Write one then truncate: that should give the right size in all cases. */
offset = fs_lseek (unit, k->fd, offset, whence);
- my_write (k->fd, /* whatever */(char *)&k1, 1);
+ my_write (k->fd, /* whatever */(uae_u8*)&k1, 1);
if (k->file_pos > offset)
k->file_pos = offset;
- fs_lseek (unit, k->fd, k->file_pos, SEEK_SET);
+ fs_lseek (unit, k->fd, (off_t)k->file_pos, SEEK_SET);
/* Brian: no bug here; the file _must_ be one byte too large after writing
The write is supposed to guarantee that the file can't be smaller than
if (k1->aino == a1 && k1->fd) {
wehavekeys++;
fs_close (unit, k1->fd);
- write_log ("handle %p freed\n", k1->fd);
+ write_log (L"handle %p freed\n", k1->fd);
}
}
return wehavekeys;
if (failed) {
/* rename still failed, restore fd */
k1->fd = fs_open (unit, a1->nname, mode);
- write_log ("restoring old handle '%s' %d\n", a1->nname, k1->dosmode);
+ write_log (L"restoring old handle '%s' %d\n", a1->nname, k1->dosmode);
} else {
/* transfer fd to new name */
if (a2) {
k1->aino = a2;
k1->fd = fs_open (unit, a2->nname, mode);
- write_log ("restoring new handle '%s' %d\n", a2->nname, k1->dosmode);
+ write_log (L"restoring new handle '%s' %d\n", a2->nname, k1->dosmode);
} else {
- write_log ("no new handle, deleting old lock(s).\n");
+ write_log (L"no new handle, deleting old lock(s).\n");
}
}
if (k1->fd == NULL) {
- write_log ("relocking failed '%s' -> '%s'\n", a1->nname, a2->nname);
+ write_log (L"relocking failed '%s' -> '%s'\n", a1->nname, a2->nname);
free_key (unit, k1);
} else {
- fs_lseek (unit, k1->fd, k1->file_pos, SEEK_SET);
+ fs_lseek64 (unit, k1->fd, k1->file_pos, SEEK_SET);
}
}
}
a_inode *a;
uae_u32 err;
- TRACE(("ACTION_DELETE_OBJECT(0x%lx,\"%s\")\n", lock, bstr (unit, name)));
+ TRACE((L"ACTION_DELETE_OBJECT(0x%lx,\"%s\")\n", lock, bstr (unit, name)));
if (unit->ui.readonly) {
PUT_PCK_RES1 (packet, DOS_FALSE);
notify_check (unit, a);
updatedirtime (a, 1);
if (a->child != 0) {
- write_log ("Serious error in action_delete_object.\n");
+ write_log (L"Serious error in action_delete_object.\n");
a->deleted = 1;
} else {
delete_aino (unit, a);
struct utimbuf ut;
uae_u32 err;
- TRACE(("ACTION_SET_DATE(0x%lx,\"%s\")\n", lock, bstr (unit, name)));
+ TRACE((L"ACTION_SET_DATE(0x%lx,\"%s\")\n", lock, bstr (unit, name)));
if (unit->ui.readonly) {
PUT_PCK_RES1 (packet, DOS_FALSE);
Key *k1, *knext;
int wehavekeys = 0;
- TRACE(("ACTION_RENAME_OBJECT(0x%lx,\"%s\",", lock1, bstr (unit, name1)));
- TRACE(("0x%lx,\"%s\")\n", lock2, bstr (unit, name2)));
+ TRACE((L"ACTION_RENAME_OBJECT(0x%lx,\"%s\",", lock1, bstr (unit, name1)));
+ TRACE((L"0x%lx,\"%s\")\n", lock2, bstr (unit, name2)));
if (unit->ui.readonly) {
PUT_PCK_RES1 (packet, DOS_FALSE);
if (a2 == a1) {
/* Renaming to the same name, but possibly different case. */
- if (strcmp (a1->aname, bstr_cut (unit, name2)) == 0) {
+ if (_tcscmp (a1->aname, bstr_cut (unit, name2)) == 0) {
/* Exact match -> do nothing. */
notify_check (unit, a1);
updatedirtime (a1, 1);
if (-1 == my_rename (a1->nname, a2->nname)) {
int ret = -1;
/* maybe we have open file handles that caused failure? */
- write_log ("rename '%s' -> '%s' failed, trying relocking..\n", a1->nname, a2->nname);
+ write_log (L"rename '%s' -> '%s' failed, trying relocking..\n", a1->nname, a2->nname);
wehavekeys = relock_do(unit, a1);
/* try again... */
ret = my_rename (a1->nname, a2->nname);
action_rename_disk (Unit *unit, dpacket packet)
{
uaecptr name = GET_PCK_ARG1 (packet) << 2;
- int i;
- int namelen;
- TRACE(("ACTION_RENAME_DISK(\"%s\")\n", bstr (unit, name)));
+ TRACE((L"ACTION_RENAME_DISK(\"%s\")\n", bstr (unit, name)));
if (unit->ui.readonly) {
PUT_PCK_RES1 (packet, DOS_FALSE);
}
/* get volume name */
- namelen = get_byte (name); name++;
xfree (unit->ui.volname);
- unit->ui.volname = (char *) xmalloc (namelen + 1);
- for (i = 0; i < namelen; i++, name++)
- unit->ui.volname[i] = get_byte (name);
- unit->ui.volname[i] = 0;
+ unit->ui.volname = bstr1 (name);
set_volume_name (unit);
PUT_PCK_RES1 (packet, DOS_TRUE);
static void
action_is_filesystem (Unit *unit, dpacket packet)
{
- TRACE(("ACTION_IS_FILESYSTEM()\n"));
+ TRACE((L"ACTION_IS_FILESYSTEM()\n"));
PUT_PCK_RES1 (packet, DOS_TRUE);
}
static void
action_flush (Unit *unit, dpacket packet)
{
- TRACE(("ACTION_FLUSH()\n"));
+ TRACE((L"ACTION_FLUSH()\n"));
PUT_PCK_RES1 (packet, DOS_TRUE);
flush_cache(unit, 0);
}
static void
action_more_cache (Unit *unit, dpacket packet)
{
- TRACE(("ACTION_MORE_CACHE()\n"));
+ TRACE((L"ACTION_MORE_CACHE()\n"));
PUT_PCK_RES1 (packet, 50); /* bug but AmigaOS expects it */
if (GET_PCK_ARG1 (packet) != 0)
flush_cache(unit, 0);
PUT_PCK_RES1 (packet, DOS_TRUE);
flush_cache(unit, 0);
unit->inhibited = GET_PCK_ARG1 (packet);
- TRACE(("ACTION_INHIBIT(%d:%d)\n", unit->unit, unit->inhibited));
+ TRACE((L"ACTION_INHIBIT(%d:%d)\n", unit->unit, unit->inhibited));
}
static void
action_write_protect (Unit *unit, dpacket packet)
{
- TRACE(("ACTION_WRITE_PROTECT()\n"));
+ TRACE((L"ACTION_WRITE_PROTECT()\n"));
PUT_PCK_RES1 (packet, DOS_TRUE);
if (GET_PCK_ARG1 (packet)) {
if (!(unit->ui.readonly & 2)) {
}
}
+static void action_change_file_position64 (Unit *unit, dpacket packet)
+{
+ Key *k = lookup_key (unit, GET_PCK64_ARG1 (packet));
+ uae_s64 pos = GET_PCK64_ARG2 (packet);
+ long mode = GET_PCK64_ARG3 (packet);
+ long whence = SEEK_CUR;
+ uae_s64 res, old;
+
+ PUT_PCK64_RES0 (packet, DP64_INIT);
+
+ if (k == 0) {
+ PUT_PCK64_RES1 (packet, (uae_s64)-1);
+ PUT_PCK64_RES2 (packet, ERROR_INVALID_LOCK);
+ return;
+ }
+
+ if (mode > 0)
+ whence = SEEK_END;
+ if (mode < 0)
+ whence = SEEK_SET;
+
+ TRACE((L"ACTION_CHANGE_FILE_POSITION64(%s,%I64d,%d)\n", k->aino->nname, pos, mode));
+ gui_hd_led (unit->unit, 1);
+
+ old = fs_lseek64 (unit, k->fd, 0, SEEK_CUR);
+ {
+ uae_s64 temppos;
+ uae_s64 filesize = fs_lseek64 (unit, k->fd, 0, SEEK_END);
+ fs_lseek64 (unit, k->fd, old, SEEK_SET);
+
+ if (whence == SEEK_CUR)
+ temppos = old + pos;
+ if (whence == SEEK_SET)
+ temppos = pos;
+ if (whence == SEEK_END)
+ temppos = filesize + pos;
+ if (filesize < temppos) {
+ res = -1;
+ PUT_PCK64_RES1 (packet, res);
+ PUT_PCK64_RES2 (packet, ERROR_SEEK_ERROR);
+ return;
+ }
+ }
+ res = fs_lseek64 (unit, k->fd, pos, whence);
+
+ if (-1 == res) {
+ PUT_PCK64_RES1 (packet, res);
+ PUT_PCK64_RES2 (packet, ERROR_SEEK_ERROR);
+ } else {
+ PUT_PCK64_RES1 (packet, TRUE);
+ PUT_PCK64_RES2 (packet, DOS_TRUE);
+ }
+ k->file_pos = res;
+
+}
+
+static void action_get_file_position64 (Unit *unit, dpacket packet)
+{
+ Key *k = lookup_key (unit, GET_PCK64_ARG1 (packet));
+
+ PUT_PCK64_RES0 (packet, DP64_INIT);
+
+ if (k == 0) {
+ PUT_PCK64_RES1 (packet, (uae_s64)-1);
+ PUT_PCK64_RES2 (packet, ERROR_INVALID_LOCK);
+ return;
+ }
+ TRACE((L"ACTION_GET_FILE_POSITION64(%s)\n", k->aino->nname));
+ PUT_PCK64_RES1 (packet, k->file_pos);
+ PUT_PCK64_RES2 (packet, DOS_TRUE);
+}
+
+static void action_change_file_size64 (Unit *unit, dpacket packet)
+{
+ Key *k, *k1;
+ uae_s64 offset = GET_PCK64_ARG2 (packet);
+ long mode = (uae_s32)GET_PCK64_ARG3 (packet);
+ int whence = SEEK_CUR;
+
+ PUT_PCK64_RES0 (packet, DP64_INIT);
+
+ if (mode > 0)
+ whence = SEEK_END;
+ if (mode < 0)
+ whence = SEEK_SET;
+
+ TRACE((L"ACTION_CHANGE_FILE_SIZE64(0x%lx, %I64d, 0x%x)\n", GET_PCK64_ARG1 (packet), offset, mode));
+
+ k = lookup_key (unit, GET_PCK64_ARG1 (packet));
+ if (k == 0) {
+ PUT_PCK64_RES1 (packet, DOS_TRUE);
+ PUT_PCK64_RES2 (packet, ERROR_OBJECT_NOT_AROUND);
+ return;
+ }
+
+ gui_hd_led (unit->unit, 1);
+ k->notifyactive = 1;
+ /* If any open files have file pointers beyond this size, truncate only
+ * so far that these pointers do not become invalid. */
+ for (k1 = unit->keys; k1; k1 = k1->next) {
+ if (k != k1 && k->aino == k1->aino) {
+ if (k1->file_pos > offset)
+ offset = k1->file_pos;
+ }
+ }
+
+ /* Write one then truncate: that should give the right size in all cases. */
+ offset = fs_lseek (unit, k->fd, offset, whence);
+ my_write (k->fd, /* whatever */(uae_u8*)&k1, 1);
+ if (k->file_pos > offset)
+ k->file_pos = offset;
+ fs_lseek (unit, k->fd, k->file_pos, SEEK_SET);
+
+ if (my_truncate (k->aino->nname, offset) == -1) {
+ PUT_PCK64_RES1 (packet, DOS_FALSE);
+ PUT_PCK64_RES2 (packet, dos_errno ());
+ return;
+ }
+
+ PUT_PCK64_RES1 (packet, DOS_TRUE);
+ PUT_PCK64_RES2 (packet, TRUE);
+}
+
+
+static void action_get_file_size64 (Unit *unit, dpacket packet)
+{
+ Key *k = lookup_key (unit, GET_PCK64_ARG1 (packet));
+ uae_s64 old, filesize;
+
+ PUT_PCK64_RES0 (packet, DP64_INIT);
+
+ if (k == 0) {
+ PUT_PCK64_RES1 (packet, (uae_s64)-1);
+ PUT_PCK64_RES2 (packet, ERROR_INVALID_LOCK);
+ return;
+ }
+ TRACE((L"ACTION_GET_FILE_SIZE64(%s)\n", k->aino->nname));
+ old = fs_lseek64 (unit, k->fd, 0, SEEK_CUR);
+ if (old >= 0) {
+ filesize = fs_lseek64 (unit, k->fd, 0, SEEK_END);
+ if (filesize >= 0) {
+ fs_lseek64 (unit, k->fd, old, SEEK_SET);
+ PUT_PCK64_RES1 (packet, filesize);
+ PUT_PCK64_RES2 (packet, DOS_TRUE);
+ return;
+ }
+ }
+ PUT_PCK64_RES1 (packet, (uae_s64)-1);
+ PUT_PCK64_RES2 (packet, ERROR_SEEK_ERROR);
+}
+
/* We don't want multiple interrupts to be active at the same time. I don't
* know whether AmigaOS takes care of that, but this does. */
static uae_sem_t singlethread_int_sem;
lockend = locks;
while (get_long (lockend) != 0) {
if (get_long (lockend) == lockend) {
- write_log ("filesystem lock queue corrupted!\n");
+ write_log (L"filesystem lock queue corrupted!\n");
break;
}
lockend = get_long (lockend);
cnt++;
}
- TRACE(("%d %x %x %x\n", cnt, locks, lockend, m68k_areg (&context->regs, 3)));
+ TRACE((L"%d %x %x %x\n", cnt, locks, lockend, m68k_areg (&context->regs, 3)));
put_long (lockend, get_long (m68k_areg (&context->regs, 3)));
put_long (m68k_areg (&context->regs, 3), locks);
}
}
#else
- write_log ("exter_int_helper should not be called with arg 1!\n");
+ write_log (L"exter_int_helper should not be called with arg 1!\n");
#endif
break;
case 2:
return 5;
default:
- write_log ("exter_int_helper: unknown native action %X\n", cmd);
+ write_log (L"exter_int_helper: unknown native action %X\n", cmd);
break;
}
}
break;
default:
- write_log ("Shouldn't happen in exter_int_helper.\n");
+ write_log (L"Shouldn't happen in exter_int_helper.\n");
break;
}
return 0;
case ACTION_EXAMINE_ALL: return action_examine_all (unit, pck);
case ACTION_EXAMINE_ALL_END: return action_examine_all_end (unit, pck);
- /* unsupported packets */
+ /* OS4+ packet types */
+ case ACTION_CHANGE_FILE_POSITION64: action_change_file_position64 (unit, pck); break;
+ case ACTION_GET_FILE_POSITION64: action_get_file_position64 (unit, pck); break;
+ case ACTION_CHANGE_FILE_SIZE64: action_change_file_size64 (unit, pck); break;
+ case ACTION_GET_FILE_SIZE64: action_get_file_size64 (unit, pck); break;
+
+ /* unsupported packets */
case ACTION_LOCK_RECORD:
case ACTION_FREE_RECORD:
case ACTION_MAKE_LINK:
case ACTION_FORMAT:
return 0;
default:
- write_log ("FILESYS: UNKNOWN PACKET %x\n", type);
+ write_log (L"FILESYS: UNKNOWN PACKET %x\n", type);
return 0;
}
return 1;
uae_u8 *pck;
uae_u8 *msg;
if (! valid_address (packet_addr, 36) || ! valid_address (message_addr, 14)) {
- write_log ("FILESYS: Bad address %x/%x passed for packet.\n", packet_addr, message_addr);
+ write_log (L"FILESYS: Bad address %x/%x passed for packet.\n", packet_addr, message_addr);
goto error2;
}
pck = get_real_address (packet_addr);
do_put_mem_long ((uae_u32 *)(msg + 4), -1);
if (!unit || !unit->volume) {
- write_log ("FILESYS: was not initialized.\n");
+ write_log (L"FILESYS: was not initialized.\n");
goto error;
}
#ifdef UAE_FILESYS_THREADS
PUT_PCK_RES1 (pck, DOS_FALSE);
PUT_PCK_RES2 (pck, ERROR_ACTION_NOT_KNOWN);
}
- TRACE(("reply: %8lx, %ld\n", GET_PCK_RES1 (pck), GET_PCK_RES2 (pck)));
+ TRACE((L"reply: %8lx, %ld\n", GET_PCK_RES1 (pck), GET_PCK_RES2 (pck)));
error2:
uaecptr start = resaddr;
uaecptr residents, tmp;
- TRACE (("filesystem: diagentry called\n"));
+ TRACE ((L"filesystem: diagentry called\n"));
filesys_configdev = m68k_areg (&context->regs, 3);
init_filesys_diagentry ();
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3]);
}
-int rdb_checksum (char *id, uae_u8 *p, int block)
+int rdb_checksum (TCHAR *id, uae_u8 *p, int block)
{
uae_u32 sum = 0;
int i, blocksize;
sum += rl (p + i * 4);
sum = -sum;
if (sum) {
- write_log ("RDB: block %d ('%s') checksum error\n", block, id);
+ write_log (L"RDB: block %d ('%s') checksum error\n", block, id);
return 0;
}
return 1;
}
-static int device_isdup (uaecptr expbase, char *devname)
+static int device_isdup (uaecptr expbase, TCHAR *devname)
{
uaecptr bnode, dnode, name;
int len, i;
- char dname[256];
+ TCHAR dname[256];
bnode = get_long (expbase + 74); /* expansion.library bootnode list */
while (get_long (bnode)) {
for (i = 0; i < len; i++)
dname[i] = get_byte (name + 1 + i);
dname[len] = 0;
- if (!strcmpi (devname, dname))
+ if (!_tcsicmp (devname, dname))
return 1;
bnode = get_long (bnode);
}
return 0;
}
-static char *device_dupfix (uaecptr expbase, char *devname)
+static TCHAR *device_dupfix (uaecptr expbase, TCHAR *devname)
{
int modified;
- char newname[256];
+ TCHAR newname[256];
- strcpy (newname, devname);
+ _tcscpy (newname, devname);
modified = 1;
while (modified) {
modified = 0;
if (device_isdup (expbase, newname)) {
- if (strlen (newname) > 2 && newname[strlen (newname) - 2] == '_') {
- newname[strlen (newname) - 1]++;
+ if (_tcslen (newname) > 2 && newname[_tcslen (newname) - 2] == '_') {
+ newname[_tcslen (newname) - 1]++;
} else {
- strcat (newname, "_0");
+ _tcscat (newname, L"_0");
}
modified = 1;
}
return my_strdup (newname);
}
-static void dump_partinfo (char *name, int num, uaecptr pp, int partblock)
+static void dump_partinfo (uae_char *name, int num, uaecptr pp, int partblock)
{
+ TCHAR *s = au (name);
uae_u32 dostype = get_long (pp + 80);
- write_log ("RDB: '%s' dostype=%08X. PartBlock=%d\n", name, dostype, partblock);
- write_log ("BlockSize: %d, Surfaces: %d, SectorsPerBlock %d\n",
+ write_log (L"RDB: '%s' dostype=%08X. PartBlock=%d\n", s, dostype, partblock);
+ write_log (L"BlockSize: %d, Surfaces: %d, SectorsPerBlock %d\n",
get_long (pp + 20) * 4, get_long (pp + 28), get_long (pp + 32));
- write_log ("SectorsPerTrack: %d, Reserved: %d, LowCyl %d, HighCyl %d\n",
+ write_log (L"SectorsPerTrack: %d, Reserved: %d, LowCyl %d, HighCyl %d\n",
get_long (pp + 36), get_long (pp + 40), get_long (pp + 52), get_long (pp + 56));
- write_log ("Buffers: %d, BufMemType: %08x, MaxTransfer: %08x, BootPri: %d\n",
+ write_log (L"Buffers: %d, BufMemType: %08x, MaxTransfer: %08x, BootPri: %d\n",
get_long (pp + 60), get_long (pp + 64), get_long (pp + 68), get_long (pp + 76));
+ xfree (s);
}
-#define rdbmnt write_log ("Mounting uaehf.device %d (%d) (size=%I64u):\n", unit_no, partnum, hfd->virtsize);
+#define rdbmnt write_log (L"Mounting uaehf.device %d (%d) (size=%I64u):\n", unit_no, partnum, hfd->virtsize);
static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacket)
{
int err = 0;
int oldversion, oldrevision;
int newversion, newrevision;
+ TCHAR *s;
- write_log ("%s:\n", uip->rootdir);
+ write_log (L"%s:\n", uip->rootdir);
if (hfd->drive_empty) {
rdbmnt
- write_log ("ignored, drive is empty\n");
+ write_log (L"ignored, drive is empty\n");
return -2;
}
if (hfd->blocksize == 0) {
rdbmnt
- write_log ("failed, blocksize == 0\n");
+ write_log (L"failed, blocksize == 0\n");
return -1;
}
if (lastblock * hfd->blocksize > hfd->virtsize) {
rdbmnt
- write_log ("failed, too small (%d*%d > %I64u)\n", lastblock, hfd->blocksize, hfd->virtsize);
+ write_log (L"failed, too small (%d*%d > %I64u)\n", lastblock, hfd->blocksize, hfd->virtsize);
return -2;
}
for (rdblock = 0; rdblock < lastblock; rdblock++) {
hdf_read (hfd, bufrdb, rdblock * hfd->blocksize, hfd->blocksize);
- if (rdb_checksum ("RDSK", bufrdb, rdblock))
+ if (rdb_checksum (L"RDSK", bufrdb, rdblock))
break;
hdf_read (hfd, bufrdb, rdblock * hfd->blocksize, hfd->blocksize);
- if (!memcmp ("RDSK", bufrdb, 4)) {
+ if (!memcmp (L"RDSK", bufrdb, 4)) {
bufrdb[0xdc] = 0;
bufrdb[0xdd] = 0;
bufrdb[0xde] = 0;
bufrdb[0xdf] = 0;
- if (rdb_checksum ("RDSK", bufrdb, rdblock)) {
- write_log ("Windows 95/98/ME trashed RDB detected, fixing..\n");
+ if (rdb_checksum (L"RDSK", bufrdb, rdblock)) {
+ write_log (L"Windows 95/98/ME trashed RDB detected, fixing..\n");
hdf_write (hfd, bufrdb, rdblock * hfd->blocksize, hfd->blocksize);
break;
}
}
if (rdblock == lastblock) {
rdbmnt
- write_log ("failed, no RDB detected\n");
+ write_log (L"failed, no RDB detected\n");
return -2;
}
blocksize = rl (bufrdb + 16);
badblock = rl (bufrdb + 24);
if (badblock != -1) {
rdbmnt
- write_log ("RDB: badblock list is not yet supported. Contact the author.\n");
+ write_log (L"RDB: badblock list is not yet supported. Contact the author.\n");
return -2;
}
driveinitblock = rl (bufrdb + 36);
if (driveinitblock != -1) {
rdbmnt
- write_log ("RDB: driveinit is not yet supported. Contact the author.\n");
+ write_log (L"RDB: driveinit is not yet supported. Contact the author.\n");
return -2;
}
hfd->cylinders = rl (bufrdb + 64);
fileblock = rl (bufrdb + 32);
if (partnum == 0) {
- write_log ("RDB: RDSK detected at %d, FSHD=%d, C=%d S=%d H=%d\n",
+ write_log (L"RDB: RDSK detected at %d, FSHD=%d, C=%d S=%d H=%d\n",
rdblock, fileblock, hfd->cylinders, hfd->sectors, hfd->heads);
}
- buf = (uae_u8*)xmalloc (readblocksize);
+ buf = xmalloc (readblocksize);
for (i = 0; i <= partnum; i++) {
if (i == 0)
partblock = rl (bufrdb + 28);
}
memset (buf, 0, readblocksize);
hdf_read (hfd, buf, partblock * hfd->blocksize, readblocksize);
- if (!rdb_checksum ("PART", buf, partblock)) {
+ if (!rdb_checksum (L"PART", buf, partblock)) {
err = -2;
goto error;
}
flags = rl (buf + 20);
if (flags & 2) { /* do not mount */
err = -1;
- write_log ("RDB: Automount disabled, not mounting\n");
+ write_log (L"RDB: Automount disabled, not mounting\n");
goto error;
}
m68k_dreg (®s, 7) = m68k_dreg (®s, 7) & ~1;
buf[37 + buf[36]] = 0; /* zero terminate BSTR */
- uip->rdb_devname_amiga[partnum] = ds (device_dupfix (get_long (parmpacket + PP_EXPLIB), buf + 37));
+ s = au (buf + 37);
+ uip->rdb_devname_amiga[partnum] = ds (device_dupfix (get_long (parmpacket + PP_EXPLIB), s));
+ xfree (s);
put_long (parmpacket, uip->rdb_devname_amiga[partnum]); /* name */
put_long (parmpacket + 4, ROM_hardfile_resname);
put_long (parmpacket + 8, uip->devno);
dostype = get_long (parmpacket + 80);
if (dostype == 0) {
- write_log ("RDB: mount failed, dostype=0\n");
+ write_log (L"RDB: mount failed, dostype=0\n");
err = -1;
goto error;
}
if (hfd->cylinders * hfd->sectors * hfd->heads * blocksize > hfd->virtsize)
- write_log ("RDB: WARNING: end of partition > size of disk!\n");
+ write_log (L"RDB: WARNING: end of partition > size of disk!\n");
err = 2;
fsres = get_long (parmpacket + PP_FSRES);
if (!fsres) {
- write_log ("RDB: FileSystem.resource not found, this shouldn't happen!\n");
+ write_log (L"RDB: FileSystem.resource not found, this shouldn't happen!\n");
goto error;
}
fsnode = get_long (fsres + 18);
for (;;) {
if (fileblock == -1) {
if (!fsnode)
- write_log ("RDB: required FS %08X not in FileSystem.resource or in RDB\n", dostype);
+ write_log (L"RDB: required FS %08X not in FileSystem.resource or in RDB\n", dostype);
goto error;
}
if (!legalrdbblock (uip, fileblock)) {
- write_log ("RDB: corrupt FSHD pointer %d\n", fileblock);
+ write_log (L"RDB: corrupt FSHD pointer %d\n", fileblock);
goto error;
}
memset (buf, 0, readblocksize);
hdf_read (hfd, buf, fileblock * hfd->blocksize, readblocksize);
- if (!rdb_checksum ("FSHD", buf, fileblock)) {
- write_log ("RDB: checksum error in FSHD block %d\n", fileblock);
+ if (!rdb_checksum (L"FSHD", buf, fileblock)) {
+ write_log (L"RDB: checksum error in FSHD block %d\n", fileblock);
goto error;
}
fileblock = rl (buf + 16);
newversion = (buf[36] << 8) | buf[37];
newrevision = (buf[38] << 8) | buf[39];
- write_log ("RDB: RDB filesystem %08X version %d.%d\n", dostype, newversion, newrevision);
+ write_log (L"RDB: RDB filesystem %08X version %d.%d\n", dostype, newversion, newrevision);
if (fsnode) {
- write_log ("RDB: %08X in FileSystem.resouce version %d.%d\n", dostype, oldversion, oldrevision);
+ write_log (L"RDB: %08X in FileSystem.resouce version %d.%d\n", dostype, oldversion, oldrevision);
}
if (newversion * 65536 + newrevision <= oldversion * 65536 + oldrevision && oldversion >= 0) {
- write_log ("RDB: FS in FileSystem.resource is newer or same, ignoring RDB filesystem\n");
+ write_log (L"RDB: FS in FileSystem.resource is newer or same, ignoring RDB filesystem\n");
goto error;
}
put_byte (parmpacket + PP_FSHDSTART + i, buf[32 + i]);
put_long (parmpacket + PP_FSHDSTART, dostype);
/* we found required FSHD block */
- fsmem = (uae_u8*)xmalloc (262144);
+ fsmem = xmalloc (262144);
lsegblock = rl (buf + 72);
i = 0;
for (;;) {
goto error;
memset (buf, 0, readblocksize);
hdf_read (hfd, buf, lsegblock * hfd->blocksize, readblocksize);
- if (!rdb_checksum ("LSEG", buf, lsegblock))
+ if (!rdb_checksum (L"LSEG", buf, lsegblock))
goto error;
lsegblock = rl (buf + 16);
if (lsegblock == pb)
if (lsegblock == -1)
break;
}
- write_log ("RDB: Filesystem loaded, %d bytes\n", i * (blocksize - 20));
+ write_log (L"RDB: Filesystem loaded, %d bytes\n", i * (blocksize - 20));
put_long (parmpacket + PP_FSSIZE, i * (blocksize - 20)); /* RDB filesystem size hack */
uip->rdb_filesysstore = fsmem;
uip->rdb_filesyssize = i * (blocksize - 20);
static int dofakefilesys (UnitInfo *uip, uaecptr parmpacket)
{
int i, size;
- char tmp[1024];
+ TCHAR tmp[1024];
struct zfile *zf;
uae_u32 dostype, fsres, fsnode;
}
tmp[0] = 0;
- if (uip->filesysdir && strlen(uip->filesysdir) > 0) {
- strcpy (tmp, uip->filesysdir);
+ if (uip->filesysdir && _tcslen(uip->filesysdir) > 0) {
+ _tcscpy (tmp, uip->filesysdir);
} else if ((dostype & 0xffffff00) == 0x444f5300) {
- strcpy (tmp, currprefs.romfile);
- i = strlen (tmp);
+ _tcscpy (tmp, currprefs.romfile);
+ i = _tcslen (tmp);
while (i > 0 && tmp[i - 1] != '/' && tmp[i - 1] != '\\')
i--;
- strcpy (tmp + i, "FastFileSystem");
+ _tcscpy (tmp + i, L"FastFileSystem");
}
if (tmp[0] == 0) {
- write_log ("RDB: no filesystem for dostype 0x%08X\n", dostype);
+ write_log (L"RDB: no filesystem for dostype 0x%08X\n", dostype);
if ((dostype & 0xffffff00) == 0x444f5300)
return FILESYS_HARDFILE;
return -1;
}
- write_log ("RDB: fakefilesys, trying to load '%s', dostype 0x%08X\n", tmp, dostype);
- zf = zfile_fopen (tmp, "rb");
+ write_log (L"RDB: fakefilesys, trying to load '%s', dostype 0x%08X\n", tmp, dostype);
+ zf = zfile_fopen (tmp, L"rb");
if (!zf) {
- write_log ("RDB: filesys not found\n");
+ write_log (L"RDB: filesys not found\n");
if ((dostype & 0xffffff00) == 0x444f5300)
return FILESYS_HARDFILE;
return -1;
size = zfile_ftell (zf);
if (size > 0) {
zfile_fseek (zf, 0, SEEK_SET);
- uip->rdb_filesysstore = (uae_u8*)xmalloc (size);
+ uip->rdb_filesysstore = xmalloc (size);
zfile_fread (uip->rdb_filesysstore, size, 1, zf);
}
zfile_fclose (zf);
uip->rdb_filesyssize = size;
put_long (parmpacket + PP_FSSIZE, uip->rdb_filesyssize);
addfakefilesys (parmpacket, dostype);
- write_log ("HDF: faked RDB filesystem %08X loaded\n", dostype);
+ write_log (L"HDF: faked RDB filesystem %08X loaded\n", dostype);
return FILESYS_HARDFILE;
}
-static void get_new_device (int type, uaecptr parmpacket, char **devname, uaecptr *devname_amiga, int unit_no)
+static void get_new_device (int type, uaecptr parmpacket, TCHAR **devname, uaecptr *devname_amiga, int unit_no)
{
- char buffer[80];
+ TCHAR buffer[80];
uaecptr expbase = get_long (parmpacket + PP_EXPLIB);
- if (*devname == 0 || strlen(*devname) == 0) {
+ if (*devname == 0 || _tcslen (*devname) == 0) {
int un = unit_no;
for (;;) {
- sprintf (buffer, "DH%d", un++);
+ _stprintf (buffer, L"DH%d", un++);
if (!device_isdup (expbase, buffer))
break;
}
} else {
- strcpy (buffer, *devname);
+ _tcscpy (buffer, *devname);
}
*devname_amiga = ds (device_dupfix (expbase, buffer));
if (type == FILESYS_VIRTUAL)
- write_log ("FS: mounted virtual unit %s (%s)\n", buffer, mountinfo.ui[unit_no].rootdir);
+ write_log (L"FS: mounted virtual unit %s (%s)\n", buffer, mountinfo.ui[unit_no].rootdir);
else
- write_log ("FS: mounted HDF unit %s (%04x-%08x, %s)\n", buffer,
+ write_log (L"FS: mounted HDF unit %s (%04x-%08x, %s)\n", buffer,
(uae_u32)(mountinfo.ui[unit_no].hf.virtsize >> 32),
(uae_u32)(mountinfo.ui[unit_no].hf.virtsize),
mountinfo.ui[unit_no].rootdir);
}
if (sub_no)
return -2;
- write_log ("Mounting uaehf.device %d (%d):\n", unit_no, sub_no);
+ write_log (L"Mounting uaehf.device %d (%d):\n", unit_no, sub_no);
get_new_device (type, parmpacket, &uip[unit_no].devname, &uip[unit_no].devname_amiga, unit_no);
uip[unit_no].devno = unit_no;
put_long (parmpacket, uip[unit_no].devname_amiga);
{
uaecptr loop;
- TRACE (("Installing filesystem\n"));
+ TRACE ((L"Installing filesystem\n"));
uae_sem_init (&singlethread_int_sem, 0, 1);
uae_sem_init (&test_sem, 0, 1);
- ROM_filesys_resname = ds("UAEunixfs.resource");
- ROM_filesys_resid = ds("UAE unixfs 0.4");
+ ROM_filesys_resname = ds(L"UAEunixfs.resource");
+ ROM_filesys_resid = ds(L"UAE unixfs 0.4");
- fsdevname = ds ("uae.device"); /* does not really exist */
+ fsdevname = ds (L"uae.device"); /* does not really exist */
ROM_filesys_diagentry = here();
- calltrap (deftrap2(filesys_diagentry, 0, "filesys_diagentry"));
+ calltrap (deftrap2(filesys_diagentry, 0, L"filesys_diagentry"));
dw(0x4ED0); /* JMP (a0) - jump to code that inits Residents */
loop = here ();
org (rtarea_base + 0xFF18);
- calltrap (deftrap2 (filesys_dev_bootfilesys, 0, "filesys_dev_bootfilesys"));
+ calltrap (deftrap2 (filesys_dev_bootfilesys, 0, L"filesys_dev_bootfilesys"));
dw (RTS);
/* Special trap for the assembly make_dev routine */
org (rtarea_base + 0xFF20);
- calltrap (deftrap2 (filesys_dev_remember, 0, "filesys_dev_remember"));
+ calltrap (deftrap2 (filesys_dev_remember, 0, L"filesys_dev_remember"));
dw (RTS);
org (rtarea_base + 0xFF28);
- calltrap (deftrap2 (filesys_dev_storeinfo, 0, "filesys_dev_storeinfo"));
+ calltrap (deftrap2 (filesys_dev_storeinfo, 0, L"filesys_dev_storeinfo"));
dw (RTS);
org (rtarea_base + 0xFF30);
- calltrap (deftrap2 (filesys_handler, 0, "filesys_handler"));
+ calltrap (deftrap2 (filesys_handler, 0, L"filesys_handler"));
dw (RTS);
org (rtarea_base + 0xFF38);
- calltrap (deftrap2 (mousehack_done, 0, "mousehack_done"));
+ calltrap (deftrap2 (mousehack_done, 0, L"mousehack_done"));
dw (RTS);
org (rtarea_base + 0xFF40);
- calltrap (deftrap2 (startup_handler, 0, "startup_handler"));
+ calltrap (deftrap2 (startup_handler, 0, L"startup_handler"));
dw (RTS);
org (rtarea_base + 0xFF48);
- calltrap (deftrap2 (filesys_init_storeinfo, TRAPFLAG_EXTRA_STACK, "filesys_init_storeinfo"));
+ calltrap (deftrap2 (filesys_init_storeinfo, TRAPFLAG_EXTRA_STACK, L"filesys_init_storeinfo"));
dw (RTS);
org (rtarea_base + 0xFF50);
- calltrap (deftrap2 (exter_int_helper, 0, "exter_int_helper"));
+ calltrap (deftrap2 (exter_int_helper, 0, L"exter_int_helper"));
dw (RTS);
org (rtarea_base + 0xFF58);
- calltrap (deftrap2 (exall_helper, 0, "exall_helper"));
+ calltrap (deftrap2 (exall_helper, 0, L"exall_helper"));
dw (RTS);
org (loop);
static uae_u8 *restore_filesys_hardfile (UnitInfo *ui, uae_u8 *src)
{
struct hardfiledata *hfd = &ui->hf;
- char *s;
+ TCHAR *s;
hfd->virtsize = restore_u64();
hfd->offset = restore_u64();
hfd->sectors = restore_u32();
hfd->heads = restore_u32();
s = restore_string();
- strcpy (hfd->vendor_id, s);
+ _tcscpy (hfd->vendor_id, s);
xfree(s);
s = restore_string();
- strcpy (hfd->product_id, s);
+ _tcscpy (hfd->product_id, s);
xfree(s);
s = restore_string();
- strcpy (hfd->product_rev, s);
+ _tcscpy (hfd->product_rev, s);
xfree(s);
s = restore_string();
- strcpy (hfd->device_name, s);
+ _tcscpy (hfd->device_name, s);
xfree(s);
return src;
}
return dst;
}
-static a_inode *restore_filesys_get_base(Unit *u, char *npath)
+static a_inode *restore_filesys_get_base (Unit *u, TCHAR *npath)
{
- char *path, *p, *p2;
+ TCHAR *path, *p, *p2;
a_inode *a;
int cnt, err, i;
/* no '/' = parent is root */
- if (!strchr(npath, '/'))
+ if (!_tcschr (npath, '/'))
return &u->rootnode;
/* iterate from root to last to previous path part,
* create ainos if not already created.
*/
- path = (char*)xcalloc(strlen(npath) + 2, 1);
+ path = xcalloc((_tcslen(npath) + 2) * sizeof (TCHAR), 1);
cnt = 1;
for (;;) {
- strcpy (path, npath);
- strcat (path, "/");
+ _tcscpy (path, npath);
+ _tcscat (path, L"/");
p = path;
for (i = 0; i < cnt ;i++) {
if (i > 0)
err = 0;
get_aino (u, &u->rootnode, path, &err);
if (err) {
- write_log ("*** FS: missing path '%s'!\n", path);
+ write_log (L"*** FS: missing path '%s'!\n", path);
return NULL;
}
cnt++;
}
/* find base (parent) of last path part */
- strcpy (path, npath);
+ _tcscpy (path, npath);
p = path;
a = u->rootnode.child;
for (;;) {
if (*p == 0) {
- write_log ("*** FS: base aino NOT found '%s' ('%s')\n", a->nname, npath);
+ write_log (L"*** FS: base aino NOT found '%s' ('%s')\n", a->nname, npath);
xfree (path);
return NULL;
}
}
p = p2 + 1;
if (*p == 0) {
- write_log ("FS: base aino found '%s' ('%s')\n", a->nname, npath);
+ write_log (L"FS: base aino found '%s' ('%s')\n", a->nname, npath);
xfree (path);
return a;
}
break;
}
if (!a) {
- write_log ("*** FS: path part '%s' not found ('%s')\n", p, npath);
+ write_log (L"*** FS: path part '%s' not found ('%s')\n", p, npath);
xfree (path);
return NULL;
}
}
}
-static char *makenativepath(UnitInfo *ui, char *apath)
+static TCHAR *makenativepath (UnitInfo *ui, TCHAR *apath)
{
int i;
- char *pn;
+ TCHAR *pn;
/* create native path. FIXME: handle 'illegal' characters */
- pn = xcalloc (strlen (apath) + 1 + strlen (ui->rootdir) + 1, 1);
- sprintf (pn, "%s/%s", ui->rootdir, apath);
+ pn = xcalloc ((_tcslen (apath) + 1 + _tcslen (ui->rootdir) + 1) * sizeof (TCHAR), 1);
+ _stprintf (pn, L"%s/%s", ui->rootdir, apath);
if (FSDB_DIR_SEPARATOR != '/') {
- for (i = 0; i < strlen (pn); i++) {
+ for (i = 0; i < _tcslen (pn); i++) {
if (pn[i] == '/')
pn[i] = FSDB_DIR_SEPARATOR;
}
return pn;
}
-static uae_u8 *restore_aino(UnitInfo *ui, Unit *u, uae_u8 *src)
+static uae_u8 *restore_aino (UnitInfo *ui, Unit *u, uae_u8 *src)
{
- char *p, *p2, *pn;
+ TCHAR *p, *p2, *pn;
uae_u32 flags;
int missing;
a_inode *base, *a;
missing = 0;
- a = (a_inode*)xcalloc (sizeof (a_inode), 1);
+ a = xcalloc (sizeof (a_inode), 1);
a->uniq = restore_u64 ();
a->locked_children = restore_u32 ();
a->exnext_count = restore_u32 ();
p = restore_string ();
/* root (p = volume label) */
if (a->uniq == 0) {
- a->nname = my_strdup(ui->rootdir);
+ a->nname = my_strdup (ui->rootdir);
a->aname = p;
a->dir = 1;
if (ui->volflags < 0) {
- write_log ("FS: Volume '%s' ('%s') missing!\n", a->aname, a->nname);
+ write_log (L"FS: Volume '%s' ('%s') missing!\n", a->aname, a->nname);
} else {
a->volflags = ui->volflags;
recycle_aino (u, a);
- write_log ("FS: Lock (root) '%s' ('%s')\n", a->aname, a->nname);
+ write_log (L"FS: Lock (root) '%s' ('%s')\n", a->aname, a->nname);
}
return src;
}
- p2 = strrchr(p, '/');
+ p2 = _tcsrchr(p, '/');
if (p2)
p2++;
else
p2 = p;
- pn = makenativepath(ui, p);
+ pn = makenativepath (ui, p);
a->nname = pn;
- a->aname = my_strdup(p2);
+ a->aname = my_strdup (p2);
/* find parent of a->aname (Already restored previously. I hope..) */
if (p2 != p)
p2[-1] = 0;
- base = restore_filesys_get_base(u, p);
+ base = restore_filesys_get_base (u, p);
xfree(p);
if (flags & 2) {
a->dir = 1;
if (!my_existsdir(a->nname))
- write_log ("*** FS: Directory '%s' missing!\n", a->nname);
+ write_log (L"*** FS: Directory '%s' missing!\n", a->nname);
else
fsdb_clean_dir (a);
} else {
if (!my_existsfile(a->nname))
- write_log ("*** FS: File '%s' missing!\n", a->nname);
+ write_log (L"*** FS: File '%s' missing!\n", a->nname);
}
if (base) {
fill_file_attrs (u, base, a);
init_child_aino_tree (u, base, a);
} else {
- write_log ("*** FS: parent directory missing '%s' ('%s')\n", a->aname, a->nname);
+ write_log (L"*** FS: parent directory missing '%s' ('%s')\n", a->aname, a->nname);
missing = 1;
}
if (missing) {
- write_log ("*** FS: Lock restore failed '%s' ('%s')\n", a->aname, a->nname);
+ write_log (L"*** FS: Lock restore failed '%s' ('%s')\n", a->aname, a->nname);
xfree (a->nname);
xfree (a->aname);
xfree (a);
} else {
- write_log ("FS: Lock '%s' ('%s')\n", a->aname, a->nname);
+ write_log (L"FS: Lock '%s' ('%s')\n", a->aname, a->nname);
recycle_aino (u, a);
}
return src;
}
-static uae_u8 *restore_key(UnitInfo *ui, Unit *u, uae_u8 *src)
+static uae_u8 *restore_key (UnitInfo *ui, Unit *u, uae_u8 *src)
{
int savedsize, uniq;
- char *p, *pn;
+ TCHAR *p, *pn;
mode_t openmode;
DWORD err;
int missing;
Key *k;
missing = 0;
- k = (Key*)xcalloc(sizeof(Key), 1);
- k->uniq = restore_u64();
- k->file_pos = restore_u32();
- k->createmode = restore_u32();
- k->dosmode = restore_u32();
- savedsize = restore_u32();
- uniq = restore_u64();
- p = restore_string();
+ k = xcalloc (sizeof(Key), 1);
+ k->uniq = restore_u64 ();
+ k->file_pos = restore_u32 ();
+ k->createmode = restore_u32 ();
+ k->dosmode = restore_u32 ();
+ savedsize = restore_u32 ();
+ uniq = restore_u64 ();
+ p = restore_string ();
+ restore_u64 ();
+ restore_u64 ();
pn = makenativepath (ui, p);
openmode = ((k->dosmode & A_FIBF_READ) == 0 ? O_WRONLY
: (k->dosmode & A_FIBF_WRITE) == 0 ? O_RDONLY
: O_RDWR);
- write_log ("FS: open file '%s' ('%s'), pos=%d\n", p, pn, k->file_pos);
+ write_log (L"FS: open file '%s' ('%s'), pos=%d\n", p, pn, k->file_pos);
a = get_aino (u, &u->rootnode, p, &err);
if (!a)
- write_log ("*** FS: Open file aino creation failed '%s'\n", p);
+ write_log (L"*** FS: Open file aino creation failed '%s'\n", p);
missing = 1;
if (a) {
missing = 0;
k->aino = a;
if (a->uniq != uniq)
- write_log ("*** FS: Open file '%s' aino id %d != %d\n", p, uniq, a->uniq);
+ write_log (L"*** FS: Open file '%s' aino id %d != %d\n", p, uniq, a->uniq);
if (!my_existsfile(pn)) {
- write_log ("*** FS: Open file '%s' is missing, creating dummy file!\n", p);
+ write_log (L"*** FS: Open file '%s' is missing, creating dummy file!\n", p);
k->fd = fs_open (u, pn, openmode | O_CREAT |O_BINARY);
if (k->fd) {
- uae_u8 *buf = (uae_u8*)xcalloc (10000, 1);
+ uae_u8 *buf = xcalloc (10000, 1);
int sp = savedsize;
while (sp) {
int s = sp >= 10000 ? 10000 : sp;
sp -= s;
}
xfree(buf);
- write_log ("*** FS: dummy file created\n");
+ write_log (L"*** FS: dummy file created\n");
} else {
- write_log ("*** FS: Open file '%s', couldn't create dummy file!\n", p);
+ write_log (L"*** FS: Open file '%s', couldn't create dummy file!\n", p);
}
} else {
k->fd = fs_open (u, pn, openmode | O_BINARY);
}
if (!k->fd) {
- write_log ("*** FS: Open file '%s' failed to open!\n", p);
+ write_log (L"*** FS: Open file '%s' failed to open!\n", p);
missing = 1;
} else {
- size_t s;
- s = fs_lseek (u, k->fd, 0, SEEK_END);
+ uae_s64 s;
+ s = fs_lseek64 (u, k->fd, 0, SEEK_END);
if (s != savedsize)
- write_log ("FS: restored file '%s' size changed! orig=%d, now=%d!!\n", p, savedsize, s);
+ write_log (L"FS: restored file '%s' size changed! orig=%d, now=%d!!\n", p, savedsize, s);
if (k->file_pos > s) {
- write_log ("FS: restored filepos larger than size of file '%s'!! %d > %d\n", p, k->file_pos, s);
+ write_log (L"FS: restored filepos larger than size of file '%s'!! %d > %d\n", p, k->file_pos, s);
k->file_pos = s;
}
- fs_lseek (u,k->fd, k->file_pos, SEEK_SET);
+ fs_lseek64 (u,k->fd, k->file_pos, SEEK_SET);
}
}
xfree (p);
{
Notify *n = xcalloc (sizeof (Notify), 1);
uae_u32 hash;
- char *s;
+ TCHAR *s;
n->notifyrequest = restore_u32 ();
s = restore_string ();
- n->fullname = xmalloc (strlen (ui->volname) + 2 + strlen (s) + 1);
- sprintf (n->fullname, "%s:%s", ui->volname, s);
+ n->fullname = xmalloc ((_tcslen (ui->volname) + 2 + _tcslen (s) + 1) * sizeof (TCHAR));
+ _stprintf (n->fullname, L"%s:%s", ui->volname, s);
xfree(s);
- s = strrchr (n->fullname, '/');
+ s = _tcsrchr (n->fullname, '/');
if (s)
s++;
else
hash = notifyhash (n->fullname);
n->next = u->notifyhash[hash];
u->notifyhash[hash] = n;
- write_log ("FS: notify %08X '%s' '%s'\n", n->notifyrequest, n->fullname, n->partname);
+ write_log (L"FS: notify %08X '%s' '%s'\n", n->notifyrequest, n->fullname, n->partname);
return src;
}
u->volflags = ui->volflags;
cnt = restore_u32 ();
- write_log ("FS: restoring %d locks\n", cnt);
+ write_log (L"FS: restoring %d locks\n", cnt);
while (cnt-- > 0)
src = restore_aino(ui, u, src);
cnt = restore_u32 ();
- write_log ("FS: restoring %d open files\n", cnt);
+ write_log (L"FS: restoring %d open files\n", cnt);
while (cnt-- > 0)
src = restore_key(ui, u, src);
cnt = restore_u32 ();
- write_log ("FS: restoring %d notifications\n", cnt);
+ write_log (L"FS: restoring %d notifications\n", cnt);
while (cnt-- > 0)
src = restore_notify (ui, u, src);
cnt = restore_u32 ();
- write_log ("FS: restoring %d exkeys\n", cnt);
+ write_log (L"FS: restoring %d exkeys\n", cnt);
while (cnt-- > 0)
src = restore_exkey (ui, u, src);
return src;
}
-static char *getfullaname(a_inode *a)
+static TCHAR *getfullaname(a_inode *a)
{
- char *p;
+ TCHAR *p;
int first = 1;
- p = (char*)xcalloc (2000, 1);
+ p = xcalloc (2000 * sizeof (TCHAR), 1);
while (a) {
- int len = strlen (a->aname);
- memmove (p + len + 1, p, strlen (p) + 1);
- memcpy (p, a->aname, strlen (a->aname));
+ int len = _tcslen (a->aname);
+ memmove (p + len + 1, p, (_tcslen (p) + 1) * sizeof (TCHAR));
+ memcpy (p, a->aname, _tcslen (a->aname) * sizeof (TCHAR));
if (!first)
p[len] = '/';
first = 0;
//write_log("recurse '%s' '%s' %d %08x\n", a->aname, a->nname, a->uniq, a->parent);
if (a->elock || a->shlock || a->uniq == 0) {
if (dst) {
- char *fn;
- write_log ("%04x s=%d e=%d d=%d '%s' '%s'\n", a->uniq, a->shlock, a->elock, a->dir, a->aname, a->nname);
+ TCHAR *fn;
+ write_log (L"%04x s=%d e=%d d=%d '%s' '%s'\n", a->uniq, a->shlock, a->elock, a->dir, a->aname, a->nname);
fn = getfullaname(a);
- write_log ("->'%s'\n", fn);
+ write_log (L"->'%s'\n", fn);
save_u64 (a->uniq);
save_u32 (a->locked_children);
save_u32 (a->exnext_count);
return cnt;
}
-static uae_u8 *save_key(uae_u8 *dst, Key *k)
+static uae_u8 *save_key (uae_u8 *dst, Key *k)
{
- char *fn = getfullaname(k->aino);
- int size;
+ TCHAR *fn = getfullaname (k->aino);
+ uae_u64 size;
save_u64 (k->uniq);
- save_u32 (k->file_pos);
+ save_u32 ((uae_u32)k->file_pos);
save_u32 (k->createmode);
save_u32 (k->dosmode);
size = my_lseek (k->fd, 0, SEEK_END);
- save_u32 (size);
+ save_u32 ((uae_u32)size);
save_u64 (k->aino->uniq);
my_lseek (k->fd, k->file_pos, SEEK_SET);
save_string (fn);
- write_log ("'%s' uniq=%d size=%d seekpos=%d mode=%d dosmode=%d\n",
+ save_u64 (k->file_pos);
+ save_u64 (size);
+ write_log (L"'%s' uniq=%d size=%d seekpos=%d mode=%d dosmode=%d\n",
fn, k->uniq, size, k->file_pos, k->createmode, k->dosmode);
xfree (fn);
return dst;
static uae_u8 *save_notify (UnitInfo *ui, uae_u8 *dst, Notify *n)
{
- char *s;
- save_u32(n->notifyrequest);
+ TCHAR *s;
+ save_u32 (n->notifyrequest);
s = n->fullname;
- if (strlen (s) >= strlen (ui->volname) && !memcmp (n->fullname, ui->volname, strlen (ui->volname)))
- s = n->fullname + strlen (ui->volname) + 1;
+ if (_tcslen (s) >= _tcslen (ui->volname) && !_tcsncmp (n->fullname, ui->volname, _tcslen (ui->volname)))
+ s = n->fullname + _tcslen (ui->volname) + 1;
save_string (s);
- write_log ("FS: notify %08X '%s'\n", n->notifyrequest, n->fullname);
+ write_log (L"FS: notify %08X '%s'\n", n->notifyrequest, n->fullname);
return dst;
}
Key *k;
int cnt, i, j;
- write_log ("FSSAVE: '%s'\n", ui->devname);
+ write_log (L"FSSAVE: '%s'\n", ui->devname);
save_u32 (u->dosbase);
save_u32 (u->volume);
save_u32 (u->port);
save_u32 (u->total_locked_ainos);
cnt = recurse_aino (ui, &u->rootnode, 0, NULL);
save_u32 (cnt);
- write_log ("%d open locks\n", cnt);
+ write_log (L"%d open locks\n", cnt);
cnt = recurse_aino (ui, &u->rootnode, 0, &dst);
cnt = 0;
for (k = u->keys; k; k = k->next)
cnt++;
save_u32 (cnt);
- write_log ("%d open files\n", cnt);
+ write_log (L"%d open files\n", cnt);
for (k = u->keys; k; k = k->next)
dst = save_key (dst, k);
for (j = 0; j < 2; j++) {
}
if (j == 0) {
save_u32 (cnt);
- write_log ("%d notify requests\n", cnt);
+ write_log (L"%d notify requests\n", cnt);
}
}
for (j = 0; j < 2; j++) {
}
if (j == 0) {
save_u32 (cnt);
- write_log ("%d exkeys\n", cnt);
+ write_log (L"%d exkeys\n", cnt);
}
}
- write_log ("END\n");
+ write_log (L"END\n");
return dst;
}
/* not initialized yet, do not save */
if (type == FILESYS_VIRTUAL && (ui->self == NULL || ui->volname == NULL))
return NULL;
- write_log ("FS_FILESYS: '%s' '%s'\n", ui->devname, ui->volname);
+ write_log (L"FS_FILESYS: '%s' '%s'\n", ui->devname, ui->volname);
dstbak = dst = xmalloc (100000);
save_u32 (2); /* version */
save_u32 (ui->devno);
{
int type, devno;
UnitInfo *ui;
- char *devname = 0, *volname = 0, *rootdir = 0, *filesysdir = 0;
+ TCHAR *devname = 0, *volname = 0, *rootdir = 0, *filesysdir = 0;
int bootpri, readonly;
if (restore_u32 () != 2)
if (set_filesys_unit (devno, devname, volname, rootdir, readonly,
ui->hf.secspertrack, ui->hf.surfaces, ui->hf.reservedblocks, ui->hf.blocksize,
bootpri, 0, 1, filesysdir[0] ? filesysdir : NULL, 0, 0) < 0) {
- write_log ("filesys '%s' failed to restore\n", rootdir);
+ write_log (L"filesys '%s' failed to restore\n", rootdir);
goto end;
}
if (type == FILESYS_VIRTUAL)
src = restore_filesys_virtual (ui, src, devno);
- write_log ("'%s' restored\n", rootdir);
+ write_log (L"'%s' restored\n", rootdir);
end:
xfree (rootdir);
xfree (devname);
put_long (m68k_areg (regs, 7), newpc);
m68k_areg (regs, 7) -= 2;
put_word (m68k_areg (regs, 7), regs->sr);
- write_log("68040/060 FPU disabled exception PC=%x\n", newpc);
+ write_log (L"68040/060 FPU disabled exception PC=%x\n", newpc);
newpc = get_long (regs->vbr + 11 * 4);
m68k_setpc (regs, newpc);
set_special (regs, SPCFLAG_END_COMPILE);
#if DEBUG_FPP
if (!isinrom ())
- write_log ("PUTFP: %f %04X %04X\n", value, opcode, extra);
+ write_log (L"PUTFP: %f %04X %04X\n", value, opcode, extra);
#endif
if (!(extra & 0x4000)) {
regs->fp[(extra >> 10) & 7] = value;
#if DEBUG_FPP
if (!isinrom ())
- write_log ("fdbcc_opp at %08lx\n", m68k_getpc (regs));
+ write_log (L"fdbcc_opp at %08lx\n", m68k_getpc (regs));
#endif
if (fault_if_no_fpu (opcode, regs, 4))
return;
#if DEBUG_FPP
if (!isinrom ())
- write_log ("fscc_opp at %08lx\n", m68k_getpc (regs));
+ write_log (L"fscc_opp at %08lx\n", m68k_getpc (regs));
#endif
if (fault_if_no_fpu (opcode, regs, 4))
return;
#if DEBUG_FPP
if (!isinrom ())
- write_log ("ftrapcc_opp at %08lx\n", m68k_getpc (regs));
+ write_log (L"ftrapcc_opp at %08lx\n", m68k_getpc (regs));
#endif
if (fault_if_no_fpu (opcode, regs, m68k_getpc(regs) - oldpc))
return;
#if DEBUG_FPP
if (!isinrom ())
- write_log ("fbcc_opp at %08lx\n", m68k_getpc (regs));
+ write_log (L"fbcc_opp at %08lx\n", m68k_getpc (regs));
#endif
if (fault_if_no_fpu (opcode, regs, m68k_getpc(regs) - pc))
return;
#if DEBUG_FPP
if (!isinrom ())
- write_log ("fsave_opp at %08lx\n", m68k_getpc (regs));
+ write_log (L"fsave_opp at %08lx\n", m68k_getpc (regs));
#endif
if (fault_if_no_fpu (opcode, regs, 2))
return;
#if DEBUG_FPP
if (!isinrom ())
- write_log ("frestore_opp at %08lx\n", m68k_getpc (regs));
+ write_log (L"frestore_opp at %08lx\n", m68k_getpc (regs));
#endif
if (fault_if_no_fpu (opcode, regs, 2))
return;
#if DEBUG_FPP
if (!isinrom ())
- write_log ("FPP %04lx %04x at %08lx\n", opcode & 0xffff, extra, m68k_getpc (regs) - 4);
+ write_log (L"FPP %04lx %04x at %08lx\n", opcode & 0xffff, extra, m68k_getpc (regs) - 4);
#endif
if (fault_if_no_fpu (opcode, regs, 4))
return;
restore_u32();
restore_u32();
}
- write_log ("FPU=%d\n", currprefs.fpu_model);
+ write_log (L"FPU=%d\n", currprefs.fpu_model);
return src;
}
#define TRACE(x)
#endif
-char *nname_begin (char *nname)
+TCHAR *nname_begin (TCHAR *nname)
{
- char *p = strrchr (nname, FSDB_DIR_SEPARATOR);
+ TCHAR *p = _tcsrchr (nname, FSDB_DIR_SEPARATOR);
if (p)
return p + 1;
return nname;
* has the same name when compared case-insensitively, return a
* malloced string that contains the name we found. If no file
* exists that compares equal to REL, return 0. */
-char *fsdb_search_dir (const char *dirname, char *rel)
+TCHAR *fsdb_search_dir (const TCHAR *dirname, TCHAR *rel)
{
- char *p = 0;
+ TCHAR *p = 0;
int de;
void *dir;
- char fn[MAX_DPATH];
+ TCHAR fn[MAX_DPATH];
dir = my_opendir (dirname);
/* This really shouldn't happen... */
}
#endif
-static FILE *get_fsdb (a_inode *dir, const char *mode)
+static FILE *get_fsdb (a_inode *dir, const TCHAR *mode)
{
- char *n;
+ TCHAR *n;
FILE *f;
n = build_nname (dir->nname, FSDB_FILE);
- f = fopen (n, mode);
+ f = _tfopen (n, mode);
free (n);
return f;
}
static void kill_fsdb (a_inode *dir)
{
- char *n = build_nname (dir->nname, FSDB_FILE);
- unlink (n);
- free (n);
+ TCHAR *n = build_nname (dir->nname, FSDB_FILE);
+ _wunlink (n);
+ xfree (n);
}
-static void fsdb_fixup (FILE *f, char *buf, int size, a_inode *base)
+static void fsdb_fixup (FILE *f, TCHAR *buf, int size, a_inode *base)
{
- char *nname;
+ TCHAR *nname;
int ret;
if (buf[0] == 0)
free (nname);
return;
}
- TRACE (("uaefsdb '%s' deleted\n", nname));
+ TRACE ((L"uaefsdb '%s' deleted\n", nname));
/* someone deleted this file/dir outside of emulation.. */
buf[0] = 0;
free (nname);
/* Prune the db file the first time this directory is opened in a session. */
void fsdb_clean_dir (a_inode *dir)
{
- char buf[1 + 4 + 257 + 257 + 81];
- char *n;
+ TCHAR buf[1 + 4 + 257 + 257 + 81];
+ TCHAR *n;
FILE *f;
off_t pos1 = 0, pos2;
n = build_nname (dir->nname, FSDB_FILE);
- f = fopen (n, "r+b");
+ f = _tfopen (n, L"r+b");
if (f == 0) {
free (n);
return;
free (n);
}
-static a_inode *aino_from_buf (a_inode *base, char *buf, long off)
+static a_inode *aino_from_buf (a_inode *base, uae_u8 *buf, long off)
{
uae_u32 mode;
a_inode *aino = (a_inode *) xcalloc (sizeof (a_inode), 1);
+ TCHAR *s;
mode = do_get_mem_long ((uae_u32 *)(buf + 1));
buf += 5;
- aino->aname = my_strdup (buf);
+ aino->aname = au (buf);
buf += 257;
- aino->nname = build_nname (base->nname, buf);
+ s = au (buf);
+ aino->nname = build_nname (base->nname, s);
+ xfree (s);
buf += 257;
- aino->comment = *buf != '\0' ? my_strdup (buf) : 0;
+ aino->comment = *buf != '\0' ? au (buf) : 0;
fsdb_fill_file_attrs (base, aino);
aino->amigaos_mode = mode;
aino->has_dbentry = 1;
return aino;
}
-a_inode *fsdb_lookup_aino_aname (a_inode *base, const char *aname)
+a_inode *fsdb_lookup_aino_aname (a_inode *base, const TCHAR *aname)
{
FILE *f;
- f = get_fsdb (base, "r+b");
+ f = get_fsdb (base, L"r+b");
if (f == 0) {
if (currprefs.filesys_custom_uaefsdb && (base->volflags & MYVOLUMEINFO_STREAMS))
return custom_fsdb_lookup_aino_aname (base, aname);
return 0;
}
for (;;) {
- char buf[1 + 4 + 257 + 257 + 81];
+ uae_u8 buf[1 + 4 + 257 + 257 + 81];
+ TCHAR *s;
if (fread (buf, 1, sizeof buf, f) < sizeof buf)
break;
- if (buf[0] != 0 && same_aname (buf + 5, aname)) {
+ s = au (buf + 5);
+ if (buf[0] != 0 && same_aname (s, aname)) {
long pos = ftell (f) - sizeof buf;
fclose (f);
+ xfree (s);
return aino_from_buf (base, buf, pos);
}
+ xfree (s);
}
fclose (f);
return 0;
}
-a_inode *fsdb_lookup_aino_nname (a_inode *base, const char *nname)
+a_inode *fsdb_lookup_aino_nname (a_inode *base, const TCHAR *nname)
{
FILE *f;
+ char *s;
- f = get_fsdb (base, "r+b");
+ f = get_fsdb (base, L"r+b");
if (f == 0) {
if (currprefs.filesys_custom_uaefsdb && (base->volflags & MYVOLUMEINFO_STREAMS))
return custom_fsdb_lookup_aino_nname (base, nname);
return 0;
}
+ s = ua (nname);
for (;;) {
- char buf[1 + 4 + 257 + 257 + 81];
+ uae_u8 buf[1 + 4 + 257 + 257 + 81];
if (fread (buf, 1, sizeof buf, f) < sizeof buf)
break;
- if (buf[0] != 0 && strcmp (buf + 5 + 257, nname) == 0) {
+ if (buf[0] != 0 && strcmp (buf + 5 + 257, s) == 0) {
long pos = ftell (f) - sizeof buf;
fclose (f);
+ xfree (s);
return aino_from_buf (base, buf, pos);
}
}
+ xfree (s);
fclose (f);
return 0;
}
-int fsdb_used_as_nname (a_inode *base, const char *nname)
+int fsdb_used_as_nname (a_inode *base, const TCHAR *nname)
{
FILE *f;
- char buf[1 + 4 + 257 + 257 + 81];
+ uae_u8 buf[1 + 4 + 257 + 257 + 81];
- f = get_fsdb (base, "r+b");
+ f = get_fsdb (base, L"r+b");
if (f == 0) {
if (currprefs.filesys_custom_uaefsdb && (base->volflags & MYVOLUMEINFO_STREAMS))
return custom_fsdb_used_as_nname (base, nname);
return 0;
}
for (;;) {
+ TCHAR *s;
if (fread (buf, 1, sizeof buf, f) < sizeof buf)
break;
if (buf[0] == 0)
continue;
- if (strcmp (buf + 5 + 257, nname) == 0) {
+ s = au (buf + 5 + 257);
+ if (_tcscmp (s, nname) == 0) {
+ xfree (s);
fclose (f);
return 1;
}
+ xfree (s);
}
fclose (f);
return 0;
static int needs_dbentry (a_inode *aino)
{
- const char *nn_begin;
+ const TCHAR *nn_begin;
if (aino->deleted)
return 0;
return 1;
nn_begin = nname_begin (aino->nname);
- return strcmp (nn_begin, aino->aname) != 0;
+ return _tcscmp (nn_begin, aino->aname) != 0;
}
static void write_aino (FILE *f, a_inode *aino)
{
- char buf[1 + 4 + 257 + 257 + 81];
+ uae_u8 buf[1 + 4 + 257 + 257 + 81];
+
buf[0] = aino->needs_dbentry;
do_put_mem_long ((uae_u32 *)(buf + 1), aino->amigaos_mode);
- strncpy (buf + 5, aino->aname, 256);
+ ua_copy (buf + 5, 256, aino->aname);
buf[5 + 256] = '\0';
- strncpy (buf + 5 + 257, nname_begin (aino->nname), 256);
+ ua_copy (buf + 5 + 257, 256, nname_begin (aino->nname));
buf[5 + 257 + 256] = '\0';
- strncpy (buf + 5 + 2 * 257, aino->comment ? aino->comment : "", 80);
+ ua_copy (buf + 5 + 2 * 257, 80, aino->comment ? aino->comment : L"");
buf[5 + 2 * 257 + 80] = '\0';
aino->db_offset = ftell (f);
fwrite (buf, 1, sizeof buf, f);
aino->has_dbentry = aino->needs_dbentry;
- TRACE (("%d '%s' '%s' written\n", aino->db_offset, aino->aname, aino->nname));
+ TRACE ((L"%d '%s' '%s' written\n", aino->db_offset, aino->aname, aino->nname));
}
/* Write back the db file for a directory. */
uae_u8 *tmpbuf;
int size, i;
- TRACE (("fsdb writeback %s\n", dir->aname));
+ TRACE ((L"fsdb writeback %s\n", dir->aname));
/* First pass: clear dirty bits where unnecessary, and see if any work
* needs to be done. */
for (aino = dir->child; aino; aino = aino->sibling) {
}
if (! entries_needed) {
kill_fsdb (dir);
- TRACE (("fsdb removed\n"));
+ TRACE ((L"fsdb removed\n"));
return;
}
if (! changes_needed) {
- TRACE (("not modified\n"));
+ TRACE ((L"not modified\n"));
return;
}
- f = get_fsdb (dir, "r+b");
+ f = get_fsdb (dir, L"r+b");
if (f == 0) {
if ((currprefs.filesys_custom_uaefsdb && (dir->volflags & MYVOLUMEINFO_STREAMS)) || currprefs.filesys_no_uaefsdb) {
for (aino = dir->child; aino; aino = aino->sibling) {
}
return;
}
- f = get_fsdb (dir, "w+b");
+ f = get_fsdb (dir, L"w+b");
if (f == 0) {
- TRACE (("failed\n"));
+ TRACE ((L"failed\n"));
/* This shouldn't happen... */
return;
}
tmpbuf = (uae_u8*)malloc (size);
fread (tmpbuf, 1, size, f);
}
- TRACE (("**** updating '%s' %d\n", dir->aname, size));
+ TRACE ((L"**** updating '%s' %d\n", dir->aname, size));
for (aino = dir->child; aino; aino = aino->sibling) {
if (! aino->dirty)
i = 0;
while (!aino->has_dbentry && i < size) {
- if (!strcmp (tmpbuf + i + 5, aino->aname)) {
+ TCHAR *s = au (tmpbuf + i + 5);
+ if (!_tcscmp (s, aino->aname)) {
aino->has_dbentry = 1;
aino->db_offset = i;
}
+ xfree (s);
i += 1 + 4 + 257 + 257 + 81;
}
}
write_aino (f, aino);
}
- TRACE (("end\n"));
+ TRACE ((L"end\n"));
fclose (f);
free (tmpbuf);
}
#include "sysdeps.h"
#include "od-win32/posixemu.h"
#include <windows.h>
-int get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp)
+int get_fs_usage (const TCHAR *path, const TCHAR *disk, struct fs_usage *fsp)
{
- char buf2[MAX_DPATH];
+ TCHAR buf2[MAX_DPATH];
ULARGE_INTEGER FreeBytesAvailable, TotalNumberOfBytes, TotalNumberOfFreeBytes;
- if (!GetFullPathName (path, sizeof buf2, buf2, NULL)) {
- write_log ("GetFullPathName() failed err=%d\n", GetLastError());
+ if (!GetFullPathName (path, sizeof buf2 / sizeof (TCHAR), buf2, NULL)) {
+ write_log (L"GetFullPathName() failed err=%d\n", GetLastError());
return -1;
}
- if (!memcmp (buf2, "\\\\", 2)) {
- char *p;
- strcat(buf2, "\\");
- p = strchr(buf2 + 2, '\\');
+ if (!_tcsncmp (buf2, L"\\\\", 2)) {
+ TCHAR *p;
+ _tcscat (buf2, L"\\");
+ p = _tcschr (buf2 + 2, '\\');
if (!p)
return -1;
- p = strchr(p + 1, '\\');
+ p = _tcschr (p + 1, '\\');
if (!p)
return -1;
p[1] = 0;
}
if (!GetDiskFreeSpaceEx (buf2, &FreeBytesAvailable, &TotalNumberOfBytes, &TotalNumberOfFreeBytes)) {
- write_log ("GetDiskFreeSpaceEx() failed err=%d\n", GetLastError());
+ write_log (L"GetDiskFreeSpaceEx() failed err=%d\n", GetLastError());
return -1;
}
int
safe_read (desc, ptr, len)
int desc;
- char *ptr;
+ TCHAR *ptr;
int len;
{
int n_chars;
on a system that requires a non-NULL value. */
int
get_fs_usage (path, disk, fsp)
- const char *path;
- const char *disk;
+ const TCHAR *path;
+ const TCHAR *disk;
struct fs_usage *fsp;
{
#ifdef STAT_STATFS3_OSF1
if (fd < 0)
return -1;
lseek (fd, (long) SUPERBOFF, 0);
- if (safe_read (fd, (char *) &fsd, sizeof fsd) != sizeof fsd)
+ if (safe_read (fd, (TCHAR *) &fsd, sizeof fsd) != sizeof fsd)
{
close (fd);
return -1;
int
statfs (path, fsb)
- char *path;
+ TCHAR *path;
struct statfs *fsb;
{
struct stat stats;
ide->secbuf[offset * 2 + 0] = (uae_u8)w;
ide->secbuf[offset * 2 + 1] = w >> 8;
}
-static void ps (int offset, char *s, int max)
+static void ps (int offset, TCHAR *src, int max)
{
int i, len;
+ char *s;
offset *= 2;
+ s = ua (src);
len = strlen (s);
for (i = 0; i < max; i++) {
char c = ' ';
/* PCMCIA disable -> enable */
card_trigger (!(gayle_cs & GAYLE_CS_DIS) ? 1 : 0);
if (PCMCIA_LOG)
- write_log ("PCMCIA slot: %s PC=%08X\n", !(gayle_cs & 1) ? "enabled" : "disabled", M68K_GETPC);
+ write_log (L"PCMCIA slot: %s PC=%08X\n", !(gayle_cs & 1) ? "enabled" : "disabled", M68K_GETPC);
}
}
static uae_u8 read_gayle_cs (void)
static void ide_recalibrate (void)
{
- write_log ("IDE%d recalibrate\n", ide->num);
+ write_log (L"IDE%d recalibrate\n", ide->num);
ide_sector = 0;
ide_lcyl = ide_hcyl = 0;
ide_interrupt ();
uae_u64 totalsecs;
int v;
uae_u8 *buf = ide->secbuf;
- char tmp[100];
+ TCHAR tmp[100];
if (ide->hdhfd.size == 0) {
ide_fail ();
}
memset (buf, 0, 512);
if (IDE_LOG > 0)
- write_log ("IDE%d identify drive\n", ide->num);
+ write_log (L"IDE%d identify drive\n", ide->num);
ide_data_ready (1);
pw (0, 1 << 6);
pw (1, ide->hdhfd.cyls_def);
pw (4, 512 * ide->hdhfd.secspertrack_def);
pw (5, 512);
pw (6, ide->hdhfd.secspertrack_def);
- ps (10, "68000", 20); /* serial */
+ ps (10, L"68000", 20); /* serial */
pw (20, 3);
pw (21, 512);
pw (22, 4);
- ps (23, "0.3", 8); /* firmware revision */
- sprintf (tmp, "UAE-IDE %s", ide->hdhfd.hfd.product_id);
+ ps (23, L"0.3", 8); /* firmware revision */
+ _stprintf (tmp, L"UAE-IDE %s", ide->hdhfd.hfd.product_id);
ps (27, tmp, 40); /* model */
pw (47, MAX_MULTIPLE_SECTORS); /* max sectors in multiple mode */
pw (48, 1);
ide_error |= IDE_ERR_ABRT;
ide->status |= IDE_STATUS_ERR;
}
- write_log ("IDE%d initialize drive parameters, CYL=%d,SPT=%d,HEAD=%d\n",
+ write_log (L"IDE%d initialize drive parameters, CYL=%d,SPT=%d,HEAD=%d\n",
ide->num, ide->hdhfd.cyls, ide->hdhfd.secspertrack, ide->hdhfd.heads);
ide_interrupt ();
}
static void ide_set_multiple_mode (void)
{
- write_log ("IDE%d drive multiple mode = %d\n", ide->num, ide_nsector);
+ write_log (L"IDE%d drive multiple mode = %d\n", ide->num, ide_nsector);
ide->multiple_mode = ide_nsector;
ide_interrupt ();
}
int type = ide_nsector >> 3;
int mode = ide_nsector & 7;
- write_log ("IDE%d set features %02X (%02X)\n", ide->num, ide_feat, ide_nsector);
+ write_log (L"IDE%d set features %02X (%02X)\n", ide->num, ide_feat, ide_nsector);
ide_fail ();
}
nsec = get_nsec (lba48);
get_lbachs (ide, &lba, &cyl, &head, &sec, lba48);
if (IDE_LOG > 0)
- write_log ("IDE%d read off=%d, sec=%d (%d) lba%d\n", ide->num, (uae_u32)lba, nsec, ide->multiple_mode, lba48 ? 48 : 28);
+ write_log (L"IDE%d read off=%d, sec=%d (%d) lba%d\n", ide->num, (uae_u32)lba, nsec, ide->multiple_mode, lba48 ? 48 : 28);
if (multi && ide->multiple_mode > nsec)
nsec = ide->multiple_mode;
if (lba * 512 >= ide->hdhfd.size) {
return;
}
if (IDE_LOG > 0)
- write_log ("IDE%d write off=%d, sec=%d (%d) lba%d\n", ide->num, (uae_u32)lba, nsec, ide->multiple_mode, lba48 ? 48 : 28);
+ write_log (L"IDE%d write off=%d, sec=%d (%d) lba%d\n", ide->num, (uae_u32)lba, nsec, ide->multiple_mode, lba48 ? 48 : 28);
if (nsec * 512 > ide->hdhfd.size - lba * 512)
nsec = (ide->hdhfd.size - lba * 512) / 512;
if (nsec <= 0) {
int lba48 = ide->lba48;
if (IDE_LOG > 1)
- write_log ("**** IDE%d command %02X\n", ide->num, cmd);
+ write_log (L"**** IDE%d command %02X\n", ide->num, cmd);
ide->status &= ~ (IDE_STATUS_DRDY | IDE_STATUS_DRQ | IDE_STATUS_ERR);
ide_error = 0;
ide_interrupt ();
} else {
ide_fail ();
- write_log ("IDE%d: unknown command %x\n", ide->num, cmd);
+ write_log (L"IDE%d: unknown command %x\n", ide->num, cmd);
}
}
if (ide->data_size == 0) {
if (IDE_LOG > 0)
- write_log ("IDE%d DATA read without DRQ!?\n", ide->num);
+ write_log (L"IDE%d DATA read without DRQ!?\n", ide->num);
if (ide->hdhfd.size == 0)
return 0xffff;
return 0;
if (ide->data_size == 0) {
if (IDE_LOG > 0)
- write_log ("IDE%d DATA write without DRQ!?\n", ide->num);
+ write_log (L"IDE%d DATA write without DRQ!?\n", ide->num);
return;
}
ide->secbuf[ide->data_offset + 1] = v & 0xff;
ide->data_size -= 2;
if (((ide->data_offset % 512) == 0) && ((ide->data_offset / 512) % ide->data_multi) == 0) {
if (IDE_LOG > 0)
- write_log ("IDE%d write interrupt, %d total bytes transferred so far\n", ide->num, ide->data_offset);
+ write_log (L"IDE%d write interrupt, %d total bytes transferred so far\n", ide->num, ide->data_offset);
irq = 1;
}
if (ide->data_size == 0) {
nsec = ide->data_offset / 512;
get_lbachs (ide, &lba, &cyl, &head, &sec, ide->lba48);
if (IDE_LOG > 0)
- write_log ("IDE%d write finished, %d bytes (%d) written\n", ide->num, ide->data_offset, ide->data_offset / 512);
+ write_log (L"IDE%d write finished, %d bytes (%d) written\n", ide->num, ide->data_offset, ide->data_offset / 512);
hdf_write (&ide->hdhfd.hfd, ide->secbuf, lba * 512, ide->data_offset);
put_lbachs (ide, lba, cyl, head, sec, nsec, ide->lba48);
irq = 1;
addr &= 0xffff;
if (IDE_LOG > 2 && addr != 0x2000 && addr != 0x2001 && addr != 0x2020 && addr != 0x2021 && addr != GAYLE_IRQ_1200)
- write_log ("IDE_READ %08X PC=%X\n", addr, M68K_GETPC);
+ write_log (L"IDE_READ %08X PC=%X\n", addr, M68K_GETPC);
if (currprefs.cs_ide <= 0) {
if (addr == 0x201c) // AR1200 IDE detection hack
return 0x7f;
break;
}
if (IDE_LOG > 2 && ide_reg > 0)
- write_log ("IDE%d register %d->%02X\n", ide->num, ide_reg, (uae_u32)v & 0xff);
+ write_log (L"IDE%d register %d->%02X\n", ide->num, ide_reg, (uae_u32)v & 0xff);
return v;
}
int ide_reg;
if (IDE_LOG > 2 && addr != 0x2000 && addr != 0x2001 && addr != 0x2020 && addr != 0x2021 && addr != GAYLE_IRQ_1200)
- write_log ("IDE_WRITE %08X=%02X PC=%X\n", addr, (uae_u32)val & 0xff, M68K_GETPC);
+ write_log (L"IDE_WRITE %08X=%02X PC=%X\n", addr, (uae_u32)val & 0xff, M68K_GETPC);
if (currprefs.cs_ide <= 0)
return;
if (currprefs.cs_ide == 1) {
ide_devcon &= ~0x80; /* clear HOB */
ide_reg = get_ide_reg (addr);
if (IDE_LOG > 2 && ide_reg > 0)
- write_log ("IDE%d register %d=%02X\n", ide->num, ide_reg, (uae_u32)val & 0xff);
+ write_log (L"IDE%d register %d=%02X\n", ide->num, ide_reg, (uae_u32)val & 0xff);
switch (ide_reg)
{
case IDE_DRVADDR:
v = read_gayle_cs ();
got = 1;
if (PCMCIA_LOG)
- write_log ("PCMCIA STATUS READ %08X=%02X PC=%08X\n", oaddr, (uae_u32)v & 0xff, M68K_GETPC);
+ write_log (L"PCMCIA STATUS READ %08X=%02X PC=%08X\n", oaddr, (uae_u32)v & 0xff, M68K_GETPC);
} else if (addr == GAYLE_CFG_1200) {
v = read_gayle_cfg ();
got = 1;
if (PCMCIA_LOG)
- write_log ("PCMCIA CONFIG READ %08X=%02X PC=%08X\n", oaddr, (uae_u32)v & 0xff, M68K_GETPC);
+ write_log (L"PCMCIA CONFIG READ %08X=%02X PC=%08X\n", oaddr, (uae_u32)v & 0xff, M68K_GETPC);
}
}
if (!got)
v = ide_read (addr);
if (GAYLE_LOG)
- write_log ("GAYLE_READ %08X=%02X PC=%08X\n", oaddr, (uae_u32)v & 0xff, M68K_GETPC);
+ write_log (L"GAYLE_READ %08X=%02X PC=%08X\n", oaddr, (uae_u32)v & 0xff, M68K_GETPC);
return v;
}
static void gayle_write (uaecptr addr, int val)
write_gayle_cs (val);
got = 1;
if (PCMCIA_LOG > 1)
- write_log ("PCMCIA STATUS WRITE %08X=%02X PC=%08X\n", oaddr, (uae_u32)val & 0xff, M68K_GETPC);
+ write_log (L"PCMCIA STATUS WRITE %08X=%02X PC=%08X\n", oaddr, (uae_u32)val & 0xff, M68K_GETPC);
} else if (addr == GAYLE_CFG_1200) {
write_gayle_cfg (val);
got = 1;
if (PCMCIA_LOG > 1)
- write_log ("PCMCIA CONFIG WRITE %08X=%02X PC=%08X\n", oaddr, (uae_u32)val & 0xff, M68K_GETPC);
+ write_log (L"PCMCIA CONFIG WRITE %08X=%02X PC=%08X\n", oaddr, (uae_u32)val & 0xff, M68K_GETPC);
}
}
if (GAYLE_LOG)
- write_log ("GAYLE_WRITE %08X=%02X PC=%08X\n", addr, (uae_u32)val & 0xff, M68K_GETPC);
+ write_log (L"GAYLE_WRITE %08X=%02X PC=%08X\n", addr, (uae_u32)val & 0xff, M68K_GETPC);
if (!got)
ide_write (addr, val);
}
addrbank gayle_bank = {
gayle_lget, gayle_wget, gayle_bget,
gayle_lput, gayle_wput, gayle_bput,
- default_xlate, default_check, NULL, "Gayle (low)",
+ default_xlate, default_check, NULL, L"Gayle (low)",
dummy_lgeti, dummy_wgeti, ABFLAG_IO
};
addrbank gayle2_bank = {
gayle2_lget, gayle2_wget, gayle2_bget,
gayle2_lput, gayle2_wput, gayle2_bput,
- default_xlate, default_check, NULL, "Gayle (high)",
+ default_xlate, default_check, NULL, L"Gayle (high)",
dummy_lgeti, dummy_wgeti, ABFLAG_IO
};
addr &= 0xffff;
if (MBRES_LOG > 0)
- write_log ("MBRES_WRITE %08X=%08X (%d) PC=%08X S=%d\n", addr, val, size, M68K_GETPC, regs.s);
+ write_log (L"MBRES_WRITE %08X=%08X (%d) PC=%08X S=%d\n", addr, val, size, M68K_GETPC, regs.s);
if (regs.s) { /* CPU FC = supervisor only */
if (addr == 0x1002)
garyidoffset = -1;
v = custom_bank.wget (addr);
}
if (MBRES_LOG > 0)
- write_log ("MBRES_READ %08X=%08X (%d) PC=%08X S=%d\n", addr, v, size, M68K_GETPC, regs.s);
+ write_log (L"MBRES_READ %08X=%08X (%d) PC=%08X S=%d\n", addr, v, size, M68K_GETPC, regs.s);
return v;
}
addrbank mbres_bank = {
mbres_lget, mbres_wget, mbres_bget,
mbres_lput, mbres_wput, mbres_bput,
- default_xlate, default_check, NULL, "Motherboard Resources",
+ default_xlate, default_check, NULL, L"Motherboard Resources",
dummy_lgeti, dummy_wgeti, ABFLAG_IO
};
uae_u8 v = 0;
if (PCMCIA_LOG > 1)
- write_log ("PCMCIA ATTR R: %x %x\n", addr, M68K_GETPC);
+ write_log (L"PCMCIA ATTR R: %x %x\n", addr, M68K_GETPC);
addr &= 0x80000 - 1;
if (addr >= 0x40000) {
if (PCMCIA_LOG > 0)
- write_log ("GAYLE: Reset disabled\n");
+ write_log (L"GAYLE: Reset disabled\n");
return v;
}
if (addr >= pcmcia_attrs_size)
static void gayle_attr_write (uaecptr addr, uae_u32 v)
{
if (PCMCIA_LOG > 1)
- write_log ("PCMCIA ATTR W: %x=%x %x\n", addr, v, M68K_GETPC);
+ write_log (L"PCMCIA ATTR W: %x=%x %x\n", addr, v, M68K_GETPC);
addr &= 0x80000 - 1;
if (addr >= 0x40000) {
if (PCMCIA_LOG > 0)
- write_log ("GAYLE: Reset active\n");
+ write_log (L"GAYLE: Reset active\n");
} else if (addr < pcmcia_attrs_size) {
;
}
*p++= 4; /* PCMCIA 2.1 */
*p++= 1;
if (real) {
- strcpy (p, hfd->product_id);
+ ua_copy (p, -1, hfd->product_id);
p += strlen (p) + 1;
- strcpy (p, hfd->product_rev);
+ ua_copy(p, -1, hfd->product_rev);
} else {
strcpy (p, "UAE");
p += strlen (p) + 1;
return 1;
}
-static int initpcmcia (const char *path, int readonly, int reset)
+static int initpcmcia (const TCHAR *path, int readonly, int reset)
{
if (currprefs.cs_pcmcia == 0)
return 0;
if (!pcmcia_sram->hfd.drive_empty) {
pcmcia_common_size = pcmcia_sram->hfd.virtsize;
if (pcmcia_sram->hfd.virtsize > 4 * 1024 * 1024) {
- write_log ("PCMCIA SRAM: too large device, %d bytes\n", pcmcia_sram->hfd.virtsize);
+ write_log (L"PCMCIA SRAM: too large device, %d bytes\n", pcmcia_sram->hfd.virtsize);
pcmcia_common_size = 4 * 1024 * 1024;
}
pcmcia_common = xcalloc (pcmcia_common_size, 1);
- write_log ("PCMCIA SRAM: '%s' open, size=%d\n", path, pcmcia_common_size);
+ write_log (L"PCMCIA SRAM: '%s' open, size=%d\n", path, pcmcia_common_size);
hdf_read (&pcmcia_sram->hfd, pcmcia_common, 0, pcmcia_common_size);
pcmcia_card = 1;
initsramattr (pcmcia_common_size, readonly);
{
uae_u8 v = 0;
if (PCMCIA_LOG > 2)
- write_log ("PCMCIA COMMON R: %x %x\n", addr, M68K_GETPC);
+ write_log (L"PCMCIA COMMON R: %x %x\n", addr, M68K_GETPC);
if (!pcmcia_common_size)
return 0;
addr -= PCMCIA_COMMON_START & (PCMCIA_COMMON_SIZE - 1);
static void gayle_common_write (uaecptr addr, uae_u32 v)
{
if (PCMCIA_LOG > 2)
- write_log ("PCMCIA COMMON W: %x=%x %x\n", addr, v, M68K_GETPC);
+ write_log (L"PCMCIA COMMON W: %x=%x %x\n", addr, v, M68K_GETPC);
if (!pcmcia_common_size)
return;
if (pcmcia_readonly)
static addrbank gayle_common_bank = {
gayle_common_lget, gayle_common_wget, gayle_common_bget,
gayle_common_lput, gayle_common_wput, gayle_common_bput,
- gayle_common_xlate, gayle_common_check, NULL, "Gayle PCMCIA Common",
+ gayle_common_xlate, gayle_common_check, NULL, L"Gayle PCMCIA Common",
gayle_common_lget, gayle_common_wget, ABFLAG_RAM | ABFLAG_SAFE
};
addrbank gayle_attr_bank = {
gayle_attr_lget, gayle_attr_wget, gayle_attr_bget,
gayle_attr_lput, gayle_attr_wput, gayle_attr_bput,
- default_xlate, default_check, NULL, "Gayle PCMCIA Attribute/Misc",
+ default_xlate, default_check, NULL, L"Gayle PCMCIA Attribute/Misc",
dummy_lgeti, dummy_wgeti, ABFLAG_IO | ABFLAG_SAFE
};
}
#endif
-int gayle_add_ide_unit (int ch, char *path, int blocksize, int readonly,
- char *devname, int sectors, int surfaces, int reserved,
- int bootpri, char *filesys)
+int gayle_add_ide_unit (int ch, TCHAR *path, int blocksize, int readonly,
+ TCHAR *devname, int sectors, int surfaces, int reserved,
+ int bootpri, TCHAR *filesys)
{
struct ide_hdf *ide;
if (!hdf_hd_open (&ide->hdhfd, path, blocksize, readonly, devname, sectors, surfaces, reserved, bootpri, filesys))
return -1;
ide->lba48 = ide->hdhfd.size >= 128 * (uae_u64)0x40000000 ? 1 : 0;
- write_log ("IDE%d '%s', CHS=%d,%d,%d. %uM. LBA48=%d\n",
+ write_log (L"IDE%d '%s', CHS=%d,%d,%d. %uM. LBA48=%d\n",
ch, path, ide->hdhfd.cyls, ide->hdhfd.heads, ide->hdhfd.secspertrack, (int)(ide->hdhfd.size / (1024 * 1024)), ide->lba48);
ide->status = 0;
ide->data_offset = 0;
return 1;
}
-int gayle_add_pcmcia_sram_unit (const char *path, int readonly)
+int gayle_add_pcmcia_sram_unit (const TCHAR *path, int readonly)
{
return initpcmcia (path, readonly, 1);
}
-int gayle_modify_pcmcia_sram_unit (const char *path, int readonly, int insert)
+int gayle_modify_pcmcia_sram_unit (const TCHAR *path, int readonly, int insert)
{
if (insert)
return initpcmcia (path, readonly, pcmcia_sram ? 0 : 1);
ide_splitter = 0;
if (idedrive[2]->hdhfd.size) {
ide_splitter = 1;
- write_log ("IDE splitter enabled\n");
+ write_log (L"IDE splitter enabled\n");
}
for (i = 0; i < 4; i++)
idedrive[i]->num = i;
void gayle_reset (int hardreset)
{
- static char bankname[100];
+ static TCHAR bankname[100];
initide ();
if (hardreset) {
gary_timeout = 0;
gary_toenb = 0;
}
- strcpy (bankname, "Gayle (low)");
+ _tcscpy (bankname, L"Gayle (low)");
if (currprefs.cs_ide == 2)
- strcpy (bankname, "A4000 IDE");
+ _tcscpy (bankname, L"A4000 IDE");
if (currprefs.cs_mbdmac == 2) {
- strcat (bankname," + NCR53C710 SCSI");
+ _tcscat (bankname, L" + NCR53C710 SCSI");
ncr_reset ();
}
gayle_bank.name = bankname;
{
int num, readonly, blocksize;
uae_u64 size;
- char *path;
+ TCHAR *path;
struct ide_hdf *ide;
alloc_ide_mem ();
while (b && b->uniq != uniq)
b = b->next;
if (!b)
- write_log ("Couldn't find structure. Bad\n");
+ write_log (L"Couldn't find structure. Bad\n");
return b;
}
b = &(*b)->next;
c = *b;
if (!c)
- write_log ("Couldn't find structure. Bad\n");
+ write_log (L"Couldn't find structure. Bad\n");
else
*b = c->next;
return c;
int x2, y2;
if (bitmap == 0) {
- write_log ("bogus RastPort in WritePixel\n");
+ write_log (L"bogus RastPort in WritePixel\n");
return -1;
}
* suppose if we can't find a ClipRect, we aren't supposed to draw
* the dot.
*/
- /*write_log ("Weirdness in WritePixel\n");*/
+ /*write_log (L"Weirdness in WritePixel\n");*/
v = -1;
} else if (get_long (cliprect + 8) == 0) {
v = GFX_Bitmap_WritePixel(bitmap, x2, y2, rp);
}
if ((mem & 1) != 0 || (count & 1) != 0)
- write_log ("gfx: BltClear called with odd parameters\n");
+ write_log (L"gfx: BltClear called with odd parameters\n");
/* Bit 2 set means use pattern (V36+ only, but we might as well emulate
* it always) */
rl->rects[i].MaxY = bl->maxy[j];
break;
}
- write_log ("Foo..\n");
+ write_log (L"Foo..\n");
}
}
qsort(rl->rects, rl->count, sizeof (struct Rectangle), regionrect_cmpfn);
rpp = rr;
}
if (get_long (rpp) != 0)
- write_log ("BUG\n");
+ write_log (L"BUG\n");
}
put_word (reg2+0, rl3.bounds.MinX);
put_word (reg2+2, rl3.bounds.MinY);
if (! currprefs.use_gfxlib)
return;
- write_log ("Warning: you enabled the graphics.library replacement with -g\n"
+ write_log (L"Warning: you enabled the graphics.library replacement with -g\n"
"This may be buggy right now, and will not speed things up much.\n");
resname = ds ("UAEgfxlib.resource");
map = (xcolnr *)malloc (sizeof(xcolnr) * maxcol);
if (!map) {
- write_log ("Not enough mem for colormap!\n");
+ write_log (L"Not enough mem for colormap!\n");
abort ();
}
map = (xcolnr *)malloc (sizeof(xcolnr) * maxcol);
if (!map) {
- write_log ("Not enough mem for colormap!\n");
+ write_log (L"Not enough mem for colormap!\n");
abort();
}
map = (xcolnr *)malloc (sizeof(xcolnr) * maxcol);
if (!map) {
- write_log ("Not enough mem for colormap!\n");
+ write_log (L"Not enough mem for colormap!\n");
abort();
}
}
}
}
-/* write_log ("%d color(s) lost\n",maxcol - l);*/
+/* write_log (L"%d color(s) lost\n",maxcol - l);*/
/*
* for each component compute the mapping
pl (p, 2, sum);
}
-static void create_virtual_rdb (struct hardfiledata *hfd, uae_u32 dostype, int bootpri, const char *filesys)
+static void create_virtual_rdb (struct hardfiledata *hfd, uae_u32 dostype, int bootpri, const TCHAR *filesys)
{
uae_u8 *rdb, *part, *denv;
int cyl = hfd->heads * hfd->secspertrack;
pl(rdb, 37, 0); // autopark
pl(rdb, 38, 2); // highrdskblock
pl(rdb, 39, -1); // res
- strcpy (rdb + 40 * 4, hfd->vendor_id);
- strcpy (rdb + 42 * 4, hfd->product_id);
- strcpy (rdb + 46 * 4, "UAE");
- rdb_crc(rdb);
+ ua_copy (rdb + 40 * 4, -1, hfd->vendor_id);
+ ua_copy (rdb + 42 * 4, -1, hfd->product_id);
+ ua_copy (rdb + 46 * 4, -1, L"UAE");
+ rdb_crc (rdb);
pl(part, 0, 0x50415254);
pl(part, 1, 64);
pl(part, 6, -1);
pl(part, 7, -1);
pl(part, 8, 0); // devflags
- part[9 * 4] = strlen(hfd->device_name);
- strcpy (part + 9 * 4 + 1, hfd->device_name);
+ part[9 * 4] = _tcslen (hfd->device_name);
+ ua_copy (part + 9 * 4 + 1, -1, hfd->device_name);
denv = part + 128;
pl(denv, 0, 80);
xfree (hfd->path);
}
-int hdf_hd_open (struct hd_hardfiledata *hfd, const char *path, int blocksize, int readonly,
- const char *devname, int sectors, int surfaces, int reserved,
- int bootpri, const char *filesys)
+int hdf_hd_open (struct hd_hardfiledata *hfd, const TCHAR *path, int blocksize, int readonly,
+ const TCHAR *devname, int sectors, int surfaces, int reserved,
+ int bootpri, const TCHAR *filesys)
{
memset (hfd, 0, sizeof (struct hd_hardfiledata));
hfd->bootpri = bootpri;
hfd->hfd.reservedblocks = reserved;
hfd->hfd.secspertrack = sectors;
if (devname)
- strcpy (hfd->hfd.device_name, devname);
+ _tcscpy (hfd->hfd.device_name, devname);
getchshd (&hfd->hfd, &hfd->cyls, &hfd->heads, &hfd->secspertrack);
hfd->cyls_def = hfd->cyls;
hfd->secspertrack_def = hfd->secspertrack;
if (hfd->hfd.heads && hfd->hfd.secspertrack) {
uae_u8 buf[512] = { 0 };
hdf_read (&hfd->hfd, buf, 0, 512);
- if (buf[0] != 0 && memcmp (buf, "RDSK", 4)) {
+ if (buf[0] != 0 && memcmp (buf, L"RDSK", 4)) {
hfd->hfd.nrcyls = (hfd->hfd.virtsize / blocksize) / (sectors * surfaces);
create_virtual_rdb (&hfd->hfd, rl (buf), hfd->bootpri, filesys);
while (hfd->hfd.nrcyls * surfaces * sectors > hfd->cyls_def * hfd->secspertrack_def * hfd->heads_def) {
return ~sum;
}
-int hdf_open (struct hardfiledata *hfd, const char *pname)
+int hdf_open (struct hardfiledata *hfd, const TCHAR *pname)
{
uae_u8 tmp[512], tmp2[512];
uae_u32 v;
hfd->vhd_sectormapblock = -1;
hfd->vhd_bitmapsize = ((hfd->vhd_blocksize / (8 * 512)) + 511) & ~511;
}
- write_log ("HDF is VHD %s image, virtual size=%dK\n",
+ write_log (L"HDF is VHD %s image, virtual size=%dK\n",
hfd->vhd_type == 2 ? "fixed" : "dynamic",
hfd->virtsize / 1024);
return 1;
extern int get_guid_target (uae_u8 *out);
-int vhd_create (const char *name, uae_u64 size)
+int vhd_create (const TCHAR *name, uae_u64 size)
{
struct hardfiledata hfd;
struct zfile *zf;
batsize &= ~511;
ret = 0;
b = NULL;
- zf = zfile_fopen (name, "wb");
+ zf = zfile_fopen (name, L"wb");
if (!zf)
goto end;
b = xcalloc (512 + 1024 + batsize + 512, 1);
uae_u32 sectoroffset;
uae_u64 read;
- //write_log ("%08x %08x\n", (uae_u32)offset, (uae_u32)len);
+ //write_log (L"%08x %08x\n", (uae_u32)offset, (uae_u32)len);
read = 0;
if (offset & 511)
return read;
sectormapblock = sectoroffset * 512 + (bitmapoffsetbytes & ~511);
if (hfd->vhd_sectormapblock != sectormapblock) {
// read sector bitmap
- //write_log ("BM %08x\n", sectormapblock);
+ //write_log (L"BM %08x\n", sectormapblock);
if (hdf_read_target (hfd, hfd->vhd_sectormap, sectormapblock, 512) != 512)
return read;
hfd->vhd_sectormapblock = sectormapblock;
if (hfd->vhd_sectormap[bitmapoffsetbytes & 511] & (1 << (7 - (bitmapoffsetbits & 7)))) {
// read data block
int block = sectoroffset * 512 + hfd->vhd_bitmapsize + bitmapoffsetbits * 512;
- //write_log ("DB %08x\n", block);
+ //write_log (L"DB %08x\n", block);
if (hdf_read_target (hfd, dataptr, block, 512) != 512)
return read;
} else {
uae_u32 sectoroffset;
uae_u64 written;
- //write_log ("%08x %08x\n", (uae_u32)offset, (uae_u32)len);
+ //write_log (L"%08x %08x\n", (uae_u32)offset, (uae_u32)len);
written = 0;
if (offset & 511)
return written;
int scsi_len = -1;
int status = 0;
int i;
+ char *ss;
*reply_len = *sense_len = 0;
memset(r, 0, 256);
r[2] = hdhfd->ansi_version;
r[3] = hdhfd->ansi_version >= 2 ? 2 : 0;
}
+ ss = ua (hfd->vendor_id);
i = 0; /* vendor id */
- while (i < 8 && hfd->vendor_id[i]) {
- r[8 + i] = hfd->vendor_id[i];
+ while (i < 8 && ss[i]) {
+ r[8 + i] = ss[i];
i++;
}
while (i < 8) {
r[8 + i] = 32;
i++;
}
+ xfree (ss);
+ ss = ua (hfd->product_id);
i = 0; /* product id */
- while (i < 16 && hfd->product_id[i]) {
- r[16 + i] = hfd->product_id[i];
+ while (i < 16 && ss[i]) {
+ r[16 + i] = ss[i];
i++;
}
while (i < 16) {
r[16 + i] = 32;
i++;
}
+ xfree (ss);
+ ss = ua (hfd->product_rev);
i = 0; /* product revision */
- while (i < 4 && hfd->product_rev[i]) {
- r[32 + i] = hfd->product_rev[i];
+ while (i < 4 && ss[i]) {
+ r[32 + i] = ss[i];
i++;
}
while (i < 4) {
r[32 + i] = 32;
i++;
}
+ xfree (ss);
break;
case 0x1a: /* MODE SENSE(6) */
{
} else {
getchs (hfd, &cyl, &cylsec, &head, &tracksec);
}
- //write_log ("MODE SENSE PC=%d CODE=%d DBD=%d\n", pc, pcode, dbd);
+ //write_log (L"MODE SENSE PC=%d CODE=%d DBD=%d\n", pc, pcode, dbd);
p = r;
p[0] = 4 - 1;
p[1] = 0;
case 0x37: /* READ DEFECT DATA */
if (nodisk (hfd))
goto nodisk;
- write_log ("UAEHF: READ DEFECT DATA\n");
+ write_log (L"UAEHF: READ DEFECT DATA\n");
status = 2; /* CHECK CONDITION */
s[0] = 0x70;
s[2] = 0; /* NO SENSE */
default:
err:
lr = -1;
- write_log ("UAEHF: unsupported scsi command 0x%02X\n", cmdbuf[0]);
+ write_log (L"UAEHF: unsupported scsi command 0x%02X\n", cmdbuf[0]);
status = 2; /* CHECK CONDITION */
s[0] = 0x70;
s[2] = 5; /* ILLEGAL REQUEST */
return;
uae_sem_wait (&change_sem);
hardfpd[fsid].changenum++;
- write_log("uaehf.device:%d media status=%d changenum=%d\n", fsid, insert, hardfpd[fsid].changenum);
+ write_log (L"uaehf.device:%d media status=%d changenum=%d\n", fsid, insert, hardfpd[fsid].changenum);
hfd->drive_empty = newstate;
j = 0;
while (j < MAX_ASYNC_REQUESTS) {
hfpd->base = m68k_areg (&context->regs, 6);
init_comm_pipe (&hfpd->requests, 100, 1);
uae_sem_init (&hfpd->sync_sem, 0, 0);
- uae_start_thread ("hardfile", hardfile_thread, hfpd, NULL);
+ uae_start_thread (L"hardfile", hardfile_thread, hfpd, NULL);
uae_sem_wait (&hfpd->sync_sem);
return hfpd->thread_running;
}
put_long (ioreq + 24, unit); /* io_Unit */
put_byte (ioreq + 31, 0); /* io_Error */
put_byte (ioreq + 8, 7); /* ln_type = NT_REPLYMSG */
- hf_log ("hardfile_open, unit %d (%d), OK\n", unit, m68k_dreg (&context->regs, 0));
+ hf_log (L"hardfile_open, unit %d (%d), OK\n", unit, m68k_dreg (&context->regs, 0));
return 0;
}
}
} else {
err = IOERR_BADLENGTH;
}
- hf_log ("hardfile_open, unit %d (%d), ERR=%d\n", unit, m68k_dreg (&context->regs, 0), err);
+ hf_log (L"hardfile_open, unit %d (%d), ERR=%d\n", unit, m68k_dreg (&context->regs, 0), err);
put_long (ioreq + 20, (uae_u32)err);
put_byte (ioreq + 31, (uae_u8)err);
return (uae_u32)err;
static void outofbounds (int cmd, uae_u64 offset, uae_u64 len, uae_u64 max)
{
- write_log ("UAEHF: cmd %d: out of bounds, %08X-%08X + %08X-%08X > %08X-%08X\n", cmd,
+ write_log (L"UAEHF: cmd %d: out of bounds, %08X-%08X + %08X-%08X > %08X-%08X\n", cmd,
(uae_u32)(offset >> 32),(uae_u32)offset,(uae_u32)(len >> 32),(uae_u32)len,
(uae_u32)(max >> 32),(uae_u32)max);
}
static void unaligned (int cmd, uae_u64 offset, uae_u64 len, int blocksize)
{
- write_log ("UAEHF: cmd %d: unaligned access, %08X-%08X, %08X-%08X, %08X\n", cmd,
+ write_log (L"UAEHF: cmd %d: unaligned access, %08X-%08X, %08X-%08X, %08X\n", cmd,
(uae_u32)(offset >> 32),(uae_u32)offset,(uae_u32)(len >> 32),(uae_u32)len,
blocksize);
}
error = handle_scsi (request, hfd);
} else { /* we don't want users trashing their "partition" hardfiles with hdtoolbox */
error = IOERR_NOCMD;
- write_log ("UAEHF: HD_SCSICMD tried on regular HDF, unit %d\n", unit);
+ write_log (L"UAEHF: HD_SCSICMD tried on regular HDF, unit %d\n", unit);
}
break;
uae_sem_init (&change_sem, 0, 1);
- ROM_hardfile_resname = ds ("uaehf.device");
- ROM_hardfile_resid = ds ("UAE hardfile.device 0.2");
+ ROM_hardfile_resname = ds (L"uaehf.device");
+ ROM_hardfile_resid = ds (L"UAE hardfile.device 0.2");
nscmd_cmd = here ();
dw (NSCMD_DEVICEQUERY);
const struct mem_labels int_labels[] =
{
- { "Reset:SSP", 0x0000 },
- { "EXECBASE", 0x0004 },
- { "BUS ERROR", 0x0008 },
- { "ADR ERROR", 0x000C },
- { "ILLEG OPC", 0x0010 },
- { "DIV BY 0", 0x0014 },
- { "CHK", 0x0018 },
- { "TRAPV", 0x001C },
- { "PRIVIL VIO", 0x0020 },
- { "TRACE", 0x0024 },
- { "LINEA EMU", 0x0028 },
- { "LINEF EMU", 0x002C },
- { "INT Uninit", 0x003C },
- { "INT Unjust", 0x0060 },
- { "Lvl 1 Int", 0x0064 },
- { "Lvl 2 Int", 0x0068 },
- { "Lvl 3 Int", 0x006C },
- { "Lvl 4 Int", 0x0070 },
- { "Lvl 5 Int", 0x0074 },
- { "Lvl 6 Int", 0x0078 },
- { "NMI", 0x007C },
+ { L"Reset:SSP", 0x0000 },
+ { L"EXECBASE", 0x0004 },
+ { L"BUS ERROR", 0x0008 },
+ { L"ADR ERROR", 0x000C },
+ { L"ILLEG OPC", 0x0010 },
+ { L"DIV BY 0", 0x0014 },
+ { L"CHK", 0x0018 },
+ { L"TRAPV", 0x001C },
+ { L"PRIVIL VIO", 0x0020 },
+ { L"TRACE", 0x0024 },
+ { L"LINEA EMU", 0x0028 },
+ { L"LINEF EMU", 0x002C },
+ { L"INT Uninit", 0x003C },
+ { L"INT Unjust", 0x0060 },
+ { L"Lvl 1 Int", 0x0064 },
+ { L"Lvl 2 Int", 0x0068 },
+ { L"Lvl 3 Int", 0x006C },
+ { L"Lvl 4 Int", 0x0070 },
+ { L"Lvl 5 Int", 0x0074 },
+ { L"Lvl 6 Int", 0x0078 },
+ { L"NMI", 0x007C },
{ 0, 0 }
};
const struct mem_labels trap_labels[] =
{
- { "TRAP 00", 0x0080 },
- { "TRAP 01", 0x0084 },
- { "TRAP 02", 0x0088 },
- { "TRAP 03", 0x008C },
- { "TRAP 04", 0x0090 },
- { "TRAP 05", 0x0094 },
- { "TRAP 06", 0x0098 },
- { "TRAP 07", 0x009C },
- { "TRAP 08", 0x00A0 },
- { "TRAP 09", 0x00A4 },
- { "TRAP 10", 0x00A8 },
- { "TRAP 11", 0x00AC },
- { "TRAP 12", 0x00B0 },
- { "TRAP 13", 0x00B4 },
- { "TRAP 14", 0x00B8 },
- { "TRAP 15", 0x00BC },
+ { L"TRAP 00", 0x0080 },
+ { L"TRAP 01", 0x0084 },
+ { L"TRAP 02", 0x0088 },
+ { L"TRAP 03", 0x008C },
+ { L"TRAP 04", 0x0090 },
+ { L"TRAP 05", 0x0094 },
+ { L"TRAP 06", 0x0098 },
+ { L"TRAP 07", 0x009C },
+ { L"TRAP 08", 0x00A0 },
+ { L"TRAP 09", 0x00A4 },
+ { L"TRAP 10", 0x00A8 },
+ { L"TRAP 11", 0x00AC },
+ { L"TRAP 12", 0x00B0 },
+ { L"TRAP 13", 0x00B4 },
+ { L"TRAP 14", 0x00B8 },
+ { L"TRAP 15", 0x00BC },
{ 0, 0 }
};
const struct mem_labels mem_labels[] =
{
- { "CIAB PRA", 0xBFD000 },
- { "CIAB PRB", 0xBFD100 },
- { "CIAB DDRA", 0xBFD200 },
- { "CIAB DDRB", 0xBFD300 },
- { "CIAB TALO", 0xBFD400 },
- { "CIAB TAHI", 0xBFD500 },
- { "CIAB TBLO", 0xBFD600 },
- { "CIAB TBHI", 0xBFD700 },
- { "CIAB TDLO", 0xBFD800 },
- { "CIAB TDMD", 0xBFD900 },
- { "CIAB TDHI", 0xBFDA00 },
- { "CIAB SDR", 0xBFDC00 },
- { "CIAB ICR", 0xBFDD00 },
- { "CIAB CRA", 0xBFDE00 },
- { "CIAB CRB", 0xBFDF00 },
- { "CIAA PRA", 0xBFE001 },
- { "CIAA PRB", 0xBFE101 },
- { "CIAA DDRA", 0xBFE201 },
- { "CIAA DDRB", 0xBFE301 },
- { "CIAA TALO", 0xBFE401 },
- { "CIAA TAHI", 0xBFE501 },
- { "CIAA TBLO", 0xBFE601 },
- { "CIAA TBHI", 0xBFE701 },
- { "CIAA TDLO", 0xBFE801 },
- { "CIAA TDMD", 0xBFE901 },
- { "CIAA TDHI", 0xBFEA01 },
- { "CIAA SDR", 0xBFEC01 },
- { "CIAA ICR", 0xBFED01 },
- { "CIAA CRA", 0xBFEE01 },
- { "CIAA CRB", 0xBFEF01 },
- { "CLK S1", 0xDC0000 },
- { "CLK S10", 0xDC0004 },
- { "CLK MI1", 0xDC0008 },
- { "CLK MI10", 0xDC000C },
- { "CLK H1", 0xDC0010 },
- { "CLK H10", 0xDC0014 },
- { "CLK D1", 0xDC0018 },
- { "CLK D10", 0xDC001C },
- { "CLK MO1", 0xDC0020 },
- { "CLK MO10", 0xDC0024 },
- { "CLK Y1", 0xDC0028 },
- { "CLK Y10", 0xDC002E },
- { "CLK WEEK", 0xDC0030 },
- { "CLK CD", 0xDC0034 },
- { "CLK CE", 0xDC0038 },
- { "CLK CF", 0xDC003C },
+ { L"CIAB PRA", 0xBFD000 },
+ { L"CIAB PRB", 0xBFD100 },
+ { L"CIAB DDRA", 0xBFD200 },
+ { L"CIAB DDRB", 0xBFD300 },
+ { L"CIAB TALO", 0xBFD400 },
+ { L"CIAB TAHI", 0xBFD500 },
+ { L"CIAB TBLO", 0xBFD600 },
+ { L"CIAB TBHI", 0xBFD700 },
+ { L"CIAB TDLO", 0xBFD800 },
+ { L"CIAB TDMD", 0xBFD900 },
+ { L"CIAB TDHI", 0xBFDA00 },
+ { L"CIAB SDR", 0xBFDC00 },
+ { L"CIAB ICR", 0xBFDD00 },
+ { L"CIAB CRA", 0xBFDE00 },
+ { L"CIAB CRB", 0xBFDF00 },
+ { L"CIAA PRA", 0xBFE001 },
+ { L"CIAA PRB", 0xBFE101 },
+ { L"CIAA DDRA", 0xBFE201 },
+ { L"CIAA DDRB", 0xBFE301 },
+ { L"CIAA TALO", 0xBFE401 },
+ { L"CIAA TAHI", 0xBFE501 },
+ { L"CIAA TBLO", 0xBFE601 },
+ { L"CIAA TBHI", 0xBFE701 },
+ { L"CIAA TDLO", 0xBFE801 },
+ { L"CIAA TDMD", 0xBFE901 },
+ { L"CIAA TDHI", 0xBFEA01 },
+ { L"CIAA SDR", 0xBFEC01 },
+ { L"CIAA ICR", 0xBFED01 },
+ { L"CIAA CRA", 0xBFEE01 },
+ { L"CIAA CRB", 0xBFEF01 },
+ { L"CLK S1", 0xDC0000 },
+ { L"CLK S10", 0xDC0004 },
+ { L"CLK MI1", 0xDC0008 },
+ { L"CLK MI10", 0xDC000C },
+ { L"CLK H1", 0xDC0010 },
+ { L"CLK H10", 0xDC0014 },
+ { L"CLK D1", 0xDC0018 },
+ { L"CLK D10", 0xDC001C },
+ { L"CLK MO1", 0xDC0020 },
+ { L"CLK MO10", 0xDC0024 },
+ { L"CLK Y1", 0xDC0028 },
+ { L"CLK Y10", 0xDC002E },
+ { L"CLK WEEK", 0xDC0030 },
+ { L"CLK CD", 0xDC0034 },
+ { L"CLK CE", 0xDC0038 },
+ { L"CLK CF", 0xDC003C },
{ NULL, 0 }
};
const struct customData custd[] =
{
#if 0
- { "BLTDDAT", 0xdff000 }, /* Blitter dest. early read (dummy address) */
+ { L"BLTDDAT", 0xdff000 }, /* Blitter dest. early read (dummy address) */
#endif
- { "DMACONR", 0xdff002, 1 }, /* Dma control (and blitter status) read */
- { "VPOSR", 0xdff004, 1 }, /* Read vert most sig. bits (and frame flop */
- { "VHPOSR", 0xdff006, 1 }, /* Read vert and horiz position of beam */
+ { L"DMACONR", 0xdff002, 1 }, /* Dma control (and blitter status) read */
+ { L"VPOSR", 0xdff004, 1 }, /* Read vert most sig. bits (and frame flop */
+ { L"VHPOSR", 0xdff006, 1 }, /* Read vert and horiz position of beam */
#if 0
- { "DSKDATR", 0xdff008 }, /* Disk data early read (dummy address) */
+ { L"DSKDATR", 0xdff008 }, /* Disk data early read (dummy address) */
#endif
- { "JOY0DAT", 0xdff00A, 1 }, /* Joystick-mouse 0 data (vert,horiz) */
- { "JOT1DAT", 0xdff00C, 1 }, /* Joystick-mouse 1 data (vert,horiz) */
- { "CLXDAT", 0xdff00E, 1 }, /* Collision data reg. (read and clear) */
- { "ADKCONR", 0xdff010, 1 }, /* Audio,disk control register read */
- { "POT0DAT", 0xdff012, 1 }, /* Pot counter pair 0 data (vert,horiz) */
- { "POT1DAT", 0xdff014, 1 }, /* Pot counter pair 1 data (vert,horiz) */
- { "POTGOR", 0xdff016, 1 }, /* Pot pin data read */
- { "SERDATR", 0xdff018, 1 }, /* Serial port data and status read */
- { "DSKBYTR", 0xdff01A, 1 }, /* Disk data byte and status read */
- { "INTENAR", 0xdff01C, 1 }, /* Interrupt enable bits read */
- { "INTREQR", 0xdff01E, 1 }, /* Interrupt request bits read */
- { "DSKPTH", 0xdff020, 2, 1 }, /* Disk pointer (high 5 bits) */
- { "DSKPTL", 0xdff022, 2, 2 }, /* Disk pointer (low 15 bits) */
- { "DSKLEN", 0xdff024, 2, 0 }, /* Disk lentgh */
+ { L"JOY0DAT", 0xdff00A, 1 }, /* Joystick-mouse 0 data (vert,horiz) */
+ { L"JOT1DAT", 0xdff00C, 1 }, /* Joystick-mouse 1 data (vert,horiz) */
+ { L"CLXDAT", 0xdff00E, 1 }, /* Collision data reg. (read and clear) */
+ { L"ADKCONR", 0xdff010, 1 }, /* Audio,disk control register read */
+ { L"POT0DAT", 0xdff012, 1 }, /* Pot counter pair 0 data (vert,horiz) */
+ { L"POT1DAT", 0xdff014, 1 }, /* Pot counter pair 1 data (vert,horiz) */
+ { L"POTGOR", 0xdff016, 1 }, /* Pot pin data read */
+ { L"SERDATR", 0xdff018, 1 }, /* Serial port data and status read */
+ { L"DSKBYTR", 0xdff01A, 1 }, /* Disk data byte and status read */
+ { L"INTENAR", 0xdff01C, 1 }, /* Interrupt enable bits read */
+ { L"INTREQR", 0xdff01E, 1 }, /* Interrupt request bits read */
+ { L"DSKPTH", 0xdff020, 2, 1 }, /* Disk pointer (high 5 bits) */
+ { L"DSKPTL", 0xdff022, 2, 2 }, /* Disk pointer (low 15 bits) */
+ { L"DSKLEN", 0xdff024, 2, 0 }, /* Disk lentgh */
#if 0
- { "DSKDAT", 0xdff026 }, /* Disk DMA data write */
- { "REFPTR", 0xdff028 }, /* Refresh pointer */
+ { L"DSKDAT", 0xdff026 }, /* Disk DMA data write */
+ { L"REFPTR", 0xdff028 }, /* Refresh pointer */
#endif
- { "VPOSW", 0xdff02A, 2, 0 }, /* Write vert most sig. bits(and frame flop) */
- { "VHPOSW", 0xdff02C, 2, 0 }, /* Write vert and horiz pos of beam */
- { "COPCON", 0xdff02e, 2, 0 }, /* Coprocessor control reg (CDANG) */
- { "SERDAT", 0xdff030, 2, 0 }, /* Serial port data and stop bits write */
- { "SERPER", 0xdff032, 2, 0 }, /* Serial port period and control */
- { "POTGO", 0xdff034, 2, 0 }, /* Pot count start,pot pin drive enable data */
- { "JOYTEST", 0xdff036, 2, 0 }, /* Write to all 4 joystick-mouse counters at once */
- { "STREQU", 0xdff038, 2, 0 }, /* Strobe for horiz sync with VB and EQU */
- { "STRVBL", 0xdff03A, 2, 0 }, /* Strobe for horiz sync with VB (vert blank) */
- { "STRHOR", 0xdff03C, 2, 0 }, /* Strobe for horiz sync */
- { "STRLONG", 0xdff03E, 2, 0 }, /* Strobe for identification of long horiz line */
- { "BLTCON0", 0xdff040, 2, 0 }, /* Blitter control reg 0 */
- { "BLTCON1", 0xdff042, 2, 0 }, /* Blitter control reg 1 */
- { "BLTAFWM", 0xdff044, 2, 0 }, /* Blitter first word mask for source A */
- { "BLTALWM", 0xdff046, 2, 0 }, /* Blitter last word mask for source A */
- { "BLTCPTH", 0xdff048, 2, 1 }, /* Blitter pointer to source C (high 5 bits) */
- { "BLTCPTL", 0xdff04A, 2, 2 }, /* Blitter pointer to source C (low 15 bits) */
- { "BLTBPTH", 0xdff04C, 2, 1 }, /* Blitter pointer to source B (high 5 bits) */
- { "BLTBPTL", 0xdff04E, 2, 2 }, /* Blitter pointer to source B (low 15 bits) */
- { "BLTAPTH", 0xdff050, 2, 1 }, /* Blitter pointer to source A (high 5 bits) */
- { "BLTAPTL", 0xdff052, 2, 2 }, /* Blitter pointer to source A (low 15 bits) */
- { "BPTDPTH", 0xdff054, 2, 1 }, /* Blitter pointer to destn D (high 5 bits) */
- { "BLTDPTL", 0xdff056, 2, 2 }, /* Blitter pointer to destn D (low 15 bits) */
- { "BLTSIZE", 0xdff058, 2, 0 }, /* Blitter start and size (win/width,height) */
- { "BLTCON0L", 0xdff05A, 2, 4 }, /* Blitter control 0 lower 8 bits (minterms) */
- { "BLTSIZV", 0xdff05C, 2, 4 }, /* Blitter V size (for 15 bit vert size) */
- { "BLTSIZH", 0xdff05E, 2, 4 }, /* Blitter H size & start (for 11 bit H size) */
- { "BLTCMOD", 0xdff060, 2, 0 }, /* Blitter modulo for source C */
- { "BLTBMOD", 0xdff062, 2, 0 }, /* Blitter modulo for source B */
- { "BLTAMOD", 0xdff064, 2, 0 }, /* Blitter modulo for source A */
- { "BLTDMOD", 0xdff066, 2, 0 }, /* Blitter modulo for destn D */
+ { L"VPOSW", 0xdff02A, 2, 0 }, /* Write vert most sig. bits(and frame flop) */
+ { L"VHPOSW", 0xdff02C, 2, 0 }, /* Write vert and horiz pos of beam */
+ { L"COPCON", 0xdff02e, 2, 0 }, /* Coprocessor control reg (CDANG) */
+ { L"SERDAT", 0xdff030, 2, 0 }, /* Serial port data and stop bits write */
+ { L"SERPER", 0xdff032, 2, 0 }, /* Serial port period and control */
+ { L"POTGO", 0xdff034, 2, 0 }, /* Pot count start,pot pin drive enable data */
+ { L"JOYTEST", 0xdff036, 2, 0 }, /* Write to all 4 joystick-mouse counters at once */
+ { L"STREQU", 0xdff038, 2, 0 }, /* Strobe for horiz sync with VB and EQU */
+ { L"STRVBL", 0xdff03A, 2, 0 }, /* Strobe for horiz sync with VB (vert blank) */
+ { L"STRHOR", 0xdff03C, 2, 0 }, /* Strobe for horiz sync */
+ { L"STRLONG", 0xdff03E, 2, 0 }, /* Strobe for identification of long horiz line */
+ { L"BLTCON0", 0xdff040, 2, 0 }, /* Blitter control reg 0 */
+ { L"BLTCON1", 0xdff042, 2, 0 }, /* Blitter control reg 1 */
+ { L"BLTAFWM", 0xdff044, 2, 0 }, /* Blitter first word mask for source A */
+ { L"BLTALWM", 0xdff046, 2, 0 }, /* Blitter last word mask for source A */
+ { L"BLTCPTH", 0xdff048, 2, 1 }, /* Blitter pointer to source C (high 5 bits) */
+ { L"BLTCPTL", 0xdff04A, 2, 2 }, /* Blitter pointer to source C (low 15 bits) */
+ { L"BLTBPTH", 0xdff04C, 2, 1 }, /* Blitter pointer to source B (high 5 bits) */
+ { L"BLTBPTL", 0xdff04E, 2, 2 }, /* Blitter pointer to source B (low 15 bits) */
+ { L"BLTAPTH", 0xdff050, 2, 1 }, /* Blitter pointer to source A (high 5 bits) */
+ { L"BLTAPTL", 0xdff052, 2, 2 }, /* Blitter pointer to source A (low 15 bits) */
+ { L"BPTDPTH", 0xdff054, 2, 1 }, /* Blitter pointer to destn D (high 5 bits) */
+ { L"BLTDPTL", 0xdff056, 2, 2 }, /* Blitter pointer to destn D (low 15 bits) */
+ { L"BLTSIZE", 0xdff058, 2, 0 }, /* Blitter start and size (win/width,height) */
+ { L"BLTCON0L", 0xdff05A, 2, 4 }, /* Blitter control 0 lower 8 bits (minterms) */
+ { L"BLTSIZV", 0xdff05C, 2, 4 }, /* Blitter V size (for 15 bit vert size) */
+ { L"BLTSIZH", 0xdff05E, 2, 4 }, /* Blitter H size & start (for 11 bit H size) */
+ { L"BLTCMOD", 0xdff060, 2, 0 }, /* Blitter modulo for source C */
+ { L"BLTBMOD", 0xdff062, 2, 0 }, /* Blitter modulo for source B */
+ { L"BLTAMOD", 0xdff064, 2, 0 }, /* Blitter modulo for source A */
+ { L"BLTDMOD", 0xdff066, 2, 0 }, /* Blitter modulo for destn D */
#if 0
- { "Unknown", 0xdff068 }, /* Unknown or Unused */
- { "Unknown", 0xdff06a }, /* Unknown or Unused */
- { "Unknown", 0xdff06c }, /* Unknown or Unused */
- { "Unknown", 0xdff06e }, /* Unknown or Unused */
+ { L"Unknown", 0xdff068 }, /* Unknown or Unused */
+ { L"Unknown", 0xdff06a }, /* Unknown or Unused */
+ { L"Unknown", 0xdff06c }, /* Unknown or Unused */
+ { L"Unknown", 0xdff06e }, /* Unknown or Unused */
#endif
- { "BLTCDAT", 0xdff070, 2, 0 }, /* Blitter source C data reg */
- { "BLTBDAT", 0xdff072, 2, 0 }, /* Blitter source B data reg */
- { "BLTADAT", 0xdff074, 2, 0 }, /* Blitter source A data reg */
- { "BLTDDAT", 0xdff076, 2, 0 }, /* Blitter destination reg */
+ { L"BLTCDAT", 0xdff070, 2, 0 }, /* Blitter source C data reg */
+ { L"BLTBDAT", 0xdff072, 2, 0 }, /* Blitter source B data reg */
+ { L"BLTADAT", 0xdff074, 2, 0 }, /* Blitter source A data reg */
+ { L"BLTDDAT", 0xdff076, 2, 0 }, /* Blitter destination reg */
#if 0
- { "SPRHDAT", 0xdff078 }, /* Ext logic UHRES sprite pointer and data identifier */
- { "BPLHDAT", 0xdff07A }, /* Ext logic UHRES bit plane identifier */
+ { L"SPRHDAT", 0xdff078 }, /* Ext logic UHRES sprite pointer and data identifier */
+ { L"BPLHDAT", 0xdff07A }, /* Ext logic UHRES bit plane identifier */
#endif
- { "LISAID", 0xdff07C, 1, 8 }, /* Chip revision level for Denise/Lisa */
- { "DSKSYNC", 0xdff07E, 2 }, /* Disk sync pattern reg for disk read */
- { "COP1LCH", 0xdff080, 2, 1 }, /* Coprocessor first location reg (high 5 bits) */
- { "COP1LCL", 0xdff082, 2, 2 }, /* Coprocessor first location reg (low 15 bits) */
- { "COP2LCH", 0xdff084, 2, 1 }, /* Coprocessor second reg (high 5 bits) */
- { "COP2LCL", 0xdff086, 2, 2 }, /* Coprocessor second reg (low 15 bits) */
- { "COPJMP1", 0xdff088, 2 }, /* Coprocessor restart at first location */
- { "COPJMP2", 0xdff08A, 2 }, /* Coprocessor restart at second location */
+ { L"LISAID", 0xdff07C, 1, 8 }, /* Chip revision level for Denise/Lisa */
+ { L"DSKSYNC", 0xdff07E, 2 }, /* Disk sync pattern reg for disk read */
+ { L"COP1LCH", 0xdff080, 2, 1 }, /* Coprocessor first location reg (high 5 bits) */
+ { L"COP1LCL", 0xdff082, 2, 2 }, /* Coprocessor first location reg (low 15 bits) */
+ { L"COP2LCH", 0xdff084, 2, 1 }, /* Coprocessor second reg (high 5 bits) */
+ { L"COP2LCL", 0xdff086, 2, 2 }, /* Coprocessor second reg (low 15 bits) */
+ { L"COPJMP1", 0xdff088, 2 }, /* Coprocessor restart at first location */
+ { L"COPJMP2", 0xdff08A, 2 }, /* Coprocessor restart at second location */
#if 0
- { "COPINS", 0xdff08C }, /* Coprocessor inst fetch identify */
+ { L"COPINS", 0xdff08C }, /* Coprocessor inst fetch identify */
#endif
- { "DIWSTRT", 0xdff08E, 2 }, /* Display window start (upper left vert-hor pos) */
- { "DIWSTOP", 0xdff090, 2 }, /* Display window stop (lower right vert-hor pos) */
- { "DDFSTRT", 0xdff092, 2 }, /* Display bit plane data fetch start.hor pos */
- { "DDFSTOP", 0xdff094, 2 }, /* Display bit plane data fetch stop.hor pos */
- { "DMACON", 0xdff096, 2 }, /* DMA control write (clear or set) */
- { "CLXCON", 0xdff098, 2 }, /* Collision control */
- { "INTENA", 0xdff09A, 2 }, /* Interrupt enable bits (clear or set bits) */
- { "INTREQ", 0xdff09C, 2 }, /* Interrupt request bits (clear or set bits) */
- { "ADKCON", 0xdff09E, 2 }, /* Audio,disk,UART,control */
- { "AUD0LCH", 0xdff0A0, 2, 1 }, /* Audio channel 0 location (high 5 bits) */
- { "AUD0LCL", 0xdff0A2, 2, 2 }, /* Audio channel 0 location (low 15 bits) */
- { "AUD0LEN", 0xdff0A4, 2 }, /* Audio channel 0 lentgh */
- { "AUD0PER", 0xdff0A6, 2 }, /* Audio channel 0 period */
- { "AUD0VOL", 0xdff0A8, 2 }, /* Audio channel 0 volume */
- { "AUD0DAT", 0xdff0AA, 2 }, /* Audio channel 0 data */
+ { L"DIWSTRT", 0xdff08E, 2 }, /* Display window start (upper left vert-hor pos) */
+ { L"DIWSTOP", 0xdff090, 2 }, /* Display window stop (lower right vert-hor pos) */
+ { L"DDFSTRT", 0xdff092, 2 }, /* Display bit plane data fetch start.hor pos */
+ { L"DDFSTOP", 0xdff094, 2 }, /* Display bit plane data fetch stop.hor pos */
+ { L"DMACON", 0xdff096, 2 }, /* DMA control write (clear or set) */
+ { L"CLXCON", 0xdff098, 2 }, /* Collision control */
+ { L"INTENA", 0xdff09A, 2 }, /* Interrupt enable bits (clear or set bits) */
+ { L"INTREQ", 0xdff09C, 2 }, /* Interrupt request bits (clear or set bits) */
+ { L"ADKCON", 0xdff09E, 2 }, /* Audio,disk,UART,control */
+ { L"AUD0LCH", 0xdff0A0, 2, 1 }, /* Audio channel 0 location (high 5 bits) */
+ { L"AUD0LCL", 0xdff0A2, 2, 2 }, /* Audio channel 0 location (low 15 bits) */
+ { L"AUD0LEN", 0xdff0A4, 2 }, /* Audio channel 0 lentgh */
+ { L"AUD0PER", 0xdff0A6, 2 }, /* Audio channel 0 period */
+ { L"AUD0VOL", 0xdff0A8, 2 }, /* Audio channel 0 volume */
+ { L"AUD0DAT", 0xdff0AA, 2 }, /* Audio channel 0 data */
#if 0
- { "Unknown", 0xdff0AC }, /* Unknown or Unused */
- { "Unknown", 0xdff0AE }, /* Unknown or Unused */
+ { L"Unknown", 0xdff0AC }, /* Unknown or Unused */
+ { L"Unknown", 0xdff0AE }, /* Unknown or Unused */
#endif
- { "AUD1LCH", 0xdff0B0, 2, 1 }, /* Audio channel 1 location (high 5 bits) */
- { "AUD1LCL", 0xdff0B2, 2, 2 }, /* Audio channel 1 location (low 15 bits) */
- { "AUD1LEN", 0xdff0B4, 2 }, /* Audio channel 1 lentgh */
- { "AUD1PER", 0xdff0B6, 2 }, /* Audio channel 1 period */
- { "AUD1VOL", 0xdff0B8, 2 }, /* Audio channel 1 volume */
- { "AUD1DAT", 0xdff0BA, 2 }, /* Audio channel 1 data */
+ { L"AUD1LCH", 0xdff0B0, 2, 1 }, /* Audio channel 1 location (high 5 bits) */
+ { L"AUD1LCL", 0xdff0B2, 2, 2 }, /* Audio channel 1 location (low 15 bits) */
+ { L"AUD1LEN", 0xdff0B4, 2 }, /* Audio channel 1 lentgh */
+ { L"AUD1PER", 0xdff0B6, 2 }, /* Audio channel 1 period */
+ { L"AUD1VOL", 0xdff0B8, 2 }, /* Audio channel 1 volume */
+ { L"AUD1DAT", 0xdff0BA, 2 }, /* Audio channel 1 data */
#if 0
- { "Unknown", 0xdff0BC }, /* Unknown or Unused */
- { "Unknown", 0xdff0BE }, /* Unknown or Unused */
+ { L"Unknown", 0xdff0BC }, /* Unknown or Unused */
+ { L"Unknown", 0xdff0BE }, /* Unknown or Unused */
#endif
- { "AUD2LCH", 0xdff0C0, 2, 1 }, /* Audio channel 2 location (high 5 bits) */
- { "AUD2LCL", 0xdff0C2, 2, 2 }, /* Audio channel 2 location (low 15 bits) */
- { "AUD2LEN", 0xdff0C4, 2 }, /* Audio channel 2 lentgh */
- { "AUD2PER", 0xdff0C6, 2 }, /* Audio channel 2 period */
- { "AUD2VOL", 0xdff0C8, 2 }, /* Audio channel 2 volume */
- { "AUD2DAT", 0xdff0CA, 2 }, /* Audio channel 2 data */
+ { L"AUD2LCH", 0xdff0C0, 2, 1 }, /* Audio channel 2 location (high 5 bits) */
+ { L"AUD2LCL", 0xdff0C2, 2, 2 }, /* Audio channel 2 location (low 15 bits) */
+ { L"AUD2LEN", 0xdff0C4, 2 }, /* Audio channel 2 lentgh */
+ { L"AUD2PER", 0xdff0C6, 2 }, /* Audio channel 2 period */
+ { L"AUD2VOL", 0xdff0C8, 2 }, /* Audio channel 2 volume */
+ { L"AUD2DAT", 0xdff0CA, 2 }, /* Audio channel 2 data */
#if 0
- { "Unknown", 0xdff0CC }, /* Unknown or Unused */
- { "Unknown", 0xdff0CE }, /* Unknown or Unused */
+ { L"Unknown", 0xdff0CC }, /* Unknown or Unused */
+ { L"Unknown", 0xdff0CE }, /* Unknown or Unused */
#endif
- { "AUD3LCH", 0xdff0D0, 2, 1 }, /* Audio channel 3 location (high 5 bits) */
- { "AUD3LCL", 0xdff0D2, 2, 2 }, /* Audio channel 3 location (low 15 bits) */
- { "AUD3LEN", 0xdff0D4, 2 }, /* Audio channel 3 lentgh */
- { "AUD3PER", 0xdff0D6, 2 }, /* Audio channel 3 period */
- { "AUD3VOL", 0xdff0D8, 2 }, /* Audio channel 3 volume */
- { "AUD3DAT", 0xdff0DA, 2 }, /* Audio channel 3 data */
+ { L"AUD3LCH", 0xdff0D0, 2, 1 }, /* Audio channel 3 location (high 5 bits) */
+ { L"AUD3LCL", 0xdff0D2, 2, 2 }, /* Audio channel 3 location (low 15 bits) */
+ { L"AUD3LEN", 0xdff0D4, 2 }, /* Audio channel 3 lentgh */
+ { L"AUD3PER", 0xdff0D6, 2 }, /* Audio channel 3 period */
+ { L"AUD3VOL", 0xdff0D8, 2 }, /* Audio channel 3 volume */
+ { L"AUD3DAT", 0xdff0DA, 2 }, /* Audio channel 3 data */
#if 0
- { "Unknown", 0xdff0DC }, /* Unknown or Unused */
- { "Unknown", 0xdff0DE }, /* Unknown or Unused */
+ { L"Unknown", 0xdff0DC }, /* Unknown or Unused */
+ { L"Unknown", 0xdff0DE }, /* Unknown or Unused */
#endif
- { "BPL1PTH", 0xdff0E0, 2, 1 }, /* Bit plane pointer 1 (high 5 bits) */
- { "BPL1PTL", 0xdff0E2, 2, 2 }, /* Bit plane pointer 1 (low 15 bits) */
- { "BPL2PTH", 0xdff0E4, 2, 1 }, /* Bit plane pointer 2 (high 5 bits) */
- { "BPL2PTL", 0xdff0E6, 2, 2 }, /* Bit plane pointer 2 (low 15 bits) */
- { "BPL3PTH", 0xdff0E8, 2, 1 }, /* Bit plane pointer 3 (high 5 bits) */
- { "BPL3PTL", 0xdff0EA, 2, 2 }, /* Bit plane pointer 3 (low 15 bits) */
- { "BPL4PTH", 0xdff0EC, 2, 1 }, /* Bit plane pointer 4 (high 5 bits) */
- { "BPL4PTL", 0xdff0EE, 2, 2 }, /* Bit plane pointer 4 (low 15 bits) */
- { "BPL5PTH", 0xdff0F0, 2, 1 }, /* Bit plane pointer 5 (high 5 bits) */
- { "BPL5PTL", 0xdff0F2, 2, 2 }, /* Bit plane pointer 5 (low 15 bits) */
- { "BPL6PTH", 0xdff0F4, 2, 1|8 }, /* Bit plane pointer 6 (high 5 bits) */
- { "BPL6PTL", 0xdff0F6, 2, 2|8 }, /* Bit plane pointer 6 (low 15 bits) */
- { "BPL7PTH", 0xdff0F8, 2, 1|8 }, /* Bit plane pointer 7 (high 5 bits) */
- { "BPL7PTL", 0xdff0FA, 2, 2|8 }, /* Bit plane pointer 7 (low 15 bits) */
- { "BPL8PTH", 0xdff0FC, 2, 1|8 }, /* Bit plane pointer 8 (high 5 bits) */
- { "BPL8PTL", 0xdff0FE, 2, 2|8 }, /* Bit plane pointer 8 (low 15 bits) */
- { "BPLCON0", 0xdff100, 2 }, /* Bit plane control reg (misc control bits) */
- { "BPLCON1", 0xdff102, 2 }, /* Bit plane control reg (scroll val PF1,PF2) */
- { "BPLCON2", 0xdff104, 2 }, /* Bit plane control reg (priority control) */
- { "BPLCON3", 0xdff106, 2|8 }, /* Bit plane control reg (enhanced features) */
- { "BPL1MOD", 0xdff108, 2 }, /* Bit plane modulo (odd planes,or active- fetch lines if bitplane scan-doubling is enabled */
- { "BPL2MOD", 0xdff10A, 2 }, /* Bit plane modulo (even planes or inactive- fetch lines if bitplane scan-doubling is enabled */
- { "BPLCON4", 0xdff10C, 2|8 }, /* Bit plane control reg (bitplane and sprite masks) */
- { "CLXCON2", 0xdff10e, 2|8 }, /* Extended collision control reg */
- { "BPL1DAT", 0xdff110, 2 }, /* Bit plane 1 data (parallel to serial con- vert) */
- { "BPL2DAT", 0xdff112, 2 }, /* Bit plane 2 data (parallel to serial con- vert) */
- { "BPL3DAT", 0xdff114, 2 }, /* Bit plane 3 data (parallel to serial con- vert) */
- { "BPL4DAT", 0xdff116, 2 }, /* Bit plane 4 data (parallel to serial con- vert) */
- { "BPL5DAT", 0xdff118, 2 }, /* Bit plane 5 data (parallel to serial con- vert) */
- { "BPL6DAT", 0xdff11a, 2 }, /* Bit plane 6 data (parallel to serial con- vert) */
- { "BPL7DAT", 0xdff11c, 2|8 }, /* Bit plane 7 data (parallel to serial con- vert) */
- { "BPL8DAT", 0xdff11e, 2|8 }, /* Bit plane 8 data (parallel to serial con- vert) */
- { "SPR0PTH", 0xdff120, 2, 1 }, /* Sprite 0 pointer (high 5 bits) */
- { "SPR0PTL", 0xdff122, 2, 2 }, /* Sprite 0 pointer (low 15 bits) */
- { "SPR1PTH", 0xdff124, 2, 1 }, /* Sprite 1 pointer (high 5 bits) */
- { "SPR1PTL", 0xdff126, 2, 2 }, /* Sprite 1 pointer (low 15 bits) */
- { "SPR2PTH", 0xdff128, 2, 1 }, /* Sprite 2 pointer (high 5 bits) */
- { "SPR2PTL", 0xdff12A, 2, 2 }, /* Sprite 2 pointer (low 15 bits) */
- { "SPR3PTH", 0xdff12C, 2, 1 }, /* Sprite 3 pointer (high 5 bits) */
- { "SPR3PTL", 0xdff12E, 2, 2 }, /* Sprite 3 pointer (low 15 bits) */
- { "SPR4PTH", 0xdff130, 2, 1 }, /* Sprite 4 pointer (high 5 bits) */
- { "SPR4PTL", 0xdff132, 2, 2 }, /* Sprite 4 pointer (low 15 bits) */
- { "SPR5PTH", 0xdff134, 2, 1 }, /* Sprite 5 pointer (high 5 bits) */
- { "SPR5PTL", 0xdff136, 2, 2 }, /* Sprite 5 pointer (low 15 bits) */
- { "SPR6PTH", 0xdff138, 2, 1 }, /* Sprite 6 pointer (high 5 bits) */
- { "SPR6PTL", 0xdff13A, 2, 2 }, /* Sprite 6 pointer (low 15 bits) */
- { "SPR7PTH", 0xdff13C, 2, 1 }, /* Sprite 7 pointer (high 5 bits) */
- { "SPR7PTL", 0xdff13E, 2, 2 }, /* Sprite 7 pointer (low 15 bits) */
- { "SPR0POS", 0xdff140, 2 }, /* Sprite 0 vert-horiz start pos data */
- { "SPR0CTL", 0xdff142, 2 }, /* Sprite 0 position and control data */
- { "SPR0DATA", 0xdff144, 2 }, /* Sprite 0 image data register A */
- { "SPR0DATB", 0xdff146, 2 }, /* Sprite 0 image data register B */
- { "SPR1POS", 0xdff148, 2 }, /* Sprite 1 vert-horiz start pos data */
- { "SPR1CTL", 0xdff14A, 2 }, /* Sprite 1 position and control data */
- { "SPR1DATA", 0xdff14C, 2 }, /* Sprite 1 image data register A */
- { "SPR1DATB", 0xdff14E, 2 }, /* Sprite 1 image data register B */
- { "SPR2POS", 0xdff150, 2 }, /* Sprite 2 vert-horiz start pos data */
- { "SPR2CTL", 0xdff152, 2 }, /* Sprite 2 position and control data */
- { "SPR2DATA", 0xdff154, 2 }, /* Sprite 2 image data register A */
- { "SPR2DATB", 0xdff156, 2 }, /* Sprite 2 image data register B */
- { "SPR3POS", 0xdff158, 2 }, /* Sprite 3 vert-horiz start pos data */
- { "SPR3CTL", 0xdff15A, 2 }, /* Sprite 3 position and control data */
- { "SPR3DATA", 0xdff15C, 2 }, /* Sprite 3 image data register A */
- { "SPR3DATB", 0xdff15E, 2 }, /* Sprite 3 image data register B */
- { "SPR4POS", 0xdff160, 2 }, /* Sprite 4 vert-horiz start pos data */
- { "SPR4CTL", 0xdff162, 2 }, /* Sprite 4 position and control data */
- { "SPR4DATA", 0xdff164, 2 }, /* Sprite 4 image data register A */
- { "SPR4DATB", 0xdff166, 2 }, /* Sprite 4 image data register B */
- { "SPR5POS", 0xdff168, 2 }, /* Sprite 5 vert-horiz start pos data */
- { "SPR5CTL", 0xdff16A, 2 }, /* Sprite 5 position and control data */
- { "SPR5DATA", 0xdff16C, 2 }, /* Sprite 5 image data register A */
- { "SPR5DATB", 0xdff16E, 2 }, /* Sprite 5 image data register B */
- { "SPR6POS", 0xdff170, 2 }, /* Sprite 6 vert-horiz start pos data */
- { "SPR6CTL", 0xdff172, 2 }, /* Sprite 6 position and control data */
- { "SPR6DATA", 0xdff174, 2 }, /* Sprite 6 image data register A */
- { "SPR6DATB", 0xdff176, 2 }, /* Sprite 6 image data register B */
- { "SPR7POS", 0xdff178, 2 }, /* Sprite 7 vert-horiz start pos data */
- { "SPR7CTL", 0xdff17A, 2 }, /* Sprite 7 position and control data */
- { "SPR7DATA", 0xdff17C, 2 }, /* Sprite 7 image data register A */
- { "SPR7DATB", 0xdff17E, 2 }, /* Sprite 7 image data register B */
- { "COLOR00", 0xdff180, 2 }, /* Color table 00 */
- { "COLOR01", 0xdff182, 2 }, /* Color table 01 */
- { "COLOR02", 0xdff184, 2 }, /* Color table 02 */
- { "COLOR03", 0xdff186, 2 }, /* Color table 03 */
- { "COLOR04", 0xdff188, 2 }, /* Color table 04 */
- { "COLOR05", 0xdff18A, 2 }, /* Color table 05 */
- { "COLOR06", 0xdff18C, 2 }, /* Color table 06 */
- { "COLOR07", 0xdff18E, 2 }, /* Color table 07 */
- { "COLOR08", 0xdff190, 2 }, /* Color table 08 */
- { "COLOR09", 0xdff192, 2 }, /* Color table 09 */
- { "COLOR10", 0xdff194, 2 }, /* Color table 10 */
- { "COLOR11", 0xdff196, 2 }, /* Color table 11 */
- { "COLOR12", 0xdff198, 2 }, /* Color table 12 */
- { "COLOR13", 0xdff19A, 2 }, /* Color table 13 */
- { "COLOR14", 0xdff19C, 2 }, /* Color table 14 */
- { "COLOR15", 0xdff19E, 2 }, /* Color table 15 */
- { "COLOR16", 0xdff1A0, 2 }, /* Color table 16 */
- { "COLOR17", 0xdff1A2, 2 }, /* Color table 17 */
- { "COLOR18", 0xdff1A4, 2 }, /* Color table 18 */
- { "COLOR19", 0xdff1A6, 2 }, /* Color table 19 */
- { "COLOR20", 0xdff1A8, 2 }, /* Color table 20 */
- { "COLOR21", 0xdff1AA, 2 }, /* Color table 21 */
- { "COLOR22", 0xdff1AC, 2 }, /* Color table 22 */
- { "COLOR23", 0xdff1AE, 2 }, /* Color table 23 */
- { "COLOR24", 0xdff1B0, 2 }, /* Color table 24 */
- { "COLOR25", 0xdff1B2, 2 }, /* Color table 25 */
- { "COLOR26", 0xdff1B4, 2 }, /* Color table 26 */
- { "COLOR27", 0xdff1B6, 2 }, /* Color table 27 */
- { "COLOR28", 0xdff1B8, 2 }, /* Color table 28 */
- { "COLOR29", 0xdff1BA, 2 }, /* Color table 29 */
- { "COLOR30", 0xdff1BC, 2 }, /* Color table 30 */
- { "COLOR31", 0xdff1BE, 2 }, /* Color table 31 */
- { "HTOTAL", 0xdff1C0, 2|4 }, /* Highest number count in horiz line (VARBEAMEN = 1) */
- { "HSSTOP", 0xdff1C2, 2|4 }, /* Horiz line pos for HSYNC stop */
- { "HBSTRT", 0xdff1C4, 2|4 }, /* Horiz line pos for HBLANK start */
- { "HBSTOP", 0xdff1C6, 2|4 }, /* Horiz line pos for HBLANK stop */
- { "VTOTAL", 0xdff1C8, 2|4 }, /* Highest numbered vertical line (VARBEAMEN = 1) */
- { "VSSTOP", 0xdff1CA, 2|4 }, /* Vert line for VBLANK start */
- { "VBSTRT", 0xdff1CC, 2|4 }, /* Vert line for VBLANK start */
- { "VBSTOP", 0xdff1CE, 2|4 }, /* Vert line for VBLANK stop */
+ { L"BPL1PTH", 0xdff0E0, 2, 1 }, /* Bit plane pointer 1 (high 5 bits) */
+ { L"BPL1PTL", 0xdff0E2, 2, 2 }, /* Bit plane pointer 1 (low 15 bits) */
+ { L"BPL2PTH", 0xdff0E4, 2, 1 }, /* Bit plane pointer 2 (high 5 bits) */
+ { L"BPL2PTL", 0xdff0E6, 2, 2 }, /* Bit plane pointer 2 (low 15 bits) */
+ { L"BPL3PTH", 0xdff0E8, 2, 1 }, /* Bit plane pointer 3 (high 5 bits) */
+ { L"BPL3PTL", 0xdff0EA, 2, 2 }, /* Bit plane pointer 3 (low 15 bits) */
+ { L"BPL4PTH", 0xdff0EC, 2, 1 }, /* Bit plane pointer 4 (high 5 bits) */
+ { L"BPL4PTL", 0xdff0EE, 2, 2 }, /* Bit plane pointer 4 (low 15 bits) */
+ { L"BPL5PTH", 0xdff0F0, 2, 1 }, /* Bit plane pointer 5 (high 5 bits) */
+ { L"BPL5PTL", 0xdff0F2, 2, 2 }, /* Bit plane pointer 5 (low 15 bits) */
+ { L"BPL6PTH", 0xdff0F4, 2, 1|8 }, /* Bit plane pointer 6 (high 5 bits) */
+ { L"BPL6PTL", 0xdff0F6, 2, 2|8 }, /* Bit plane pointer 6 (low 15 bits) */
+ { L"BPL7PTH", 0xdff0F8, 2, 1|8 }, /* Bit plane pointer 7 (high 5 bits) */
+ { L"BPL7PTL", 0xdff0FA, 2, 2|8 }, /* Bit plane pointer 7 (low 15 bits) */
+ { L"BPL8PTH", 0xdff0FC, 2, 1|8 }, /* Bit plane pointer 8 (high 5 bits) */
+ { L"BPL8PTL", 0xdff0FE, 2, 2|8 }, /* Bit plane pointer 8 (low 15 bits) */
+ { L"BPLCON0", 0xdff100, 2 }, /* Bit plane control reg (misc control bits) */
+ { L"BPLCON1", 0xdff102, 2 }, /* Bit plane control reg (scroll val PF1,PF2) */
+ { L"BPLCON2", 0xdff104, 2 }, /* Bit plane control reg (priority control) */
+ { L"BPLCON3", 0xdff106, 2|8 }, /* Bit plane control reg (enhanced features) */
+ { L"BPL1MOD", 0xdff108, 2 }, /* Bit plane modulo (odd planes,or active- fetch lines if bitplane scan-doubling is enabled */
+ { L"BPL2MOD", 0xdff10A, 2 }, /* Bit plane modulo (even planes or inactive- fetch lines if bitplane scan-doubling is enabled */
+ { L"BPLCON4", 0xdff10C, 2|8 }, /* Bit plane control reg (bitplane and sprite masks) */
+ { L"CLXCON2", 0xdff10e, 2|8 }, /* Extended collision control reg */
+ { L"BPL1DAT", 0xdff110, 2 }, /* Bit plane 1 data (parallel to serial con- vert) */
+ { L"BPL2DAT", 0xdff112, 2 }, /* Bit plane 2 data (parallel to serial con- vert) */
+ { L"BPL3DAT", 0xdff114, 2 }, /* Bit plane 3 data (parallel to serial con- vert) */
+ { L"BPL4DAT", 0xdff116, 2 }, /* Bit plane 4 data (parallel to serial con- vert) */
+ { L"BPL5DAT", 0xdff118, 2 }, /* Bit plane 5 data (parallel to serial con- vert) */
+ { L"BPL6DAT", 0xdff11a, 2 }, /* Bit plane 6 data (parallel to serial con- vert) */
+ { L"BPL7DAT", 0xdff11c, 2|8 }, /* Bit plane 7 data (parallel to serial con- vert) */
+ { L"BPL8DAT", 0xdff11e, 2|8 }, /* Bit plane 8 data (parallel to serial con- vert) */
+ { L"SPR0PTH", 0xdff120, 2, 1 }, /* Sprite 0 pointer (high 5 bits) */
+ { L"SPR0PTL", 0xdff122, 2, 2 }, /* Sprite 0 pointer (low 15 bits) */
+ { L"SPR1PTH", 0xdff124, 2, 1 }, /* Sprite 1 pointer (high 5 bits) */
+ { L"SPR1PTL", 0xdff126, 2, 2 }, /* Sprite 1 pointer (low 15 bits) */
+ { L"SPR2PTH", 0xdff128, 2, 1 }, /* Sprite 2 pointer (high 5 bits) */
+ { L"SPR2PTL", 0xdff12A, 2, 2 }, /* Sprite 2 pointer (low 15 bits) */
+ { L"SPR3PTH", 0xdff12C, 2, 1 }, /* Sprite 3 pointer (high 5 bits) */
+ { L"SPR3PTL", 0xdff12E, 2, 2 }, /* Sprite 3 pointer (low 15 bits) */
+ { L"SPR4PTH", 0xdff130, 2, 1 }, /* Sprite 4 pointer (high 5 bits) */
+ { L"SPR4PTL", 0xdff132, 2, 2 }, /* Sprite 4 pointer (low 15 bits) */
+ { L"SPR5PTH", 0xdff134, 2, 1 }, /* Sprite 5 pointer (high 5 bits) */
+ { L"SPR5PTL", 0xdff136, 2, 2 }, /* Sprite 5 pointer (low 15 bits) */
+ { L"SPR6PTH", 0xdff138, 2, 1 }, /* Sprite 6 pointer (high 5 bits) */
+ { L"SPR6PTL", 0xdff13A, 2, 2 }, /* Sprite 6 pointer (low 15 bits) */
+ { L"SPR7PTH", 0xdff13C, 2, 1 }, /* Sprite 7 pointer (high 5 bits) */
+ { L"SPR7PTL", 0xdff13E, 2, 2 }, /* Sprite 7 pointer (low 15 bits) */
+ { L"SPR0POS", 0xdff140, 2 }, /* Sprite 0 vert-horiz start pos data */
+ { L"SPR0CTL", 0xdff142, 2 }, /* Sprite 0 position and control data */
+ { L"SPR0DATA", 0xdff144, 2 }, /* Sprite 0 image data register A */
+ { L"SPR0DATB", 0xdff146, 2 }, /* Sprite 0 image data register B */
+ { L"SPR1POS", 0xdff148, 2 }, /* Sprite 1 vert-horiz start pos data */
+ { L"SPR1CTL", 0xdff14A, 2 }, /* Sprite 1 position and control data */
+ { L"SPR1DATA", 0xdff14C, 2 }, /* Sprite 1 image data register A */
+ { L"SPR1DATB", 0xdff14E, 2 }, /* Sprite 1 image data register B */
+ { L"SPR2POS", 0xdff150, 2 }, /* Sprite 2 vert-horiz start pos data */
+ { L"SPR2CTL", 0xdff152, 2 }, /* Sprite 2 position and control data */
+ { L"SPR2DATA", 0xdff154, 2 }, /* Sprite 2 image data register A */
+ { L"SPR2DATB", 0xdff156, 2 }, /* Sprite 2 image data register B */
+ { L"SPR3POS", 0xdff158, 2 }, /* Sprite 3 vert-horiz start pos data */
+ { L"SPR3CTL", 0xdff15A, 2 }, /* Sprite 3 position and control data */
+ { L"SPR3DATA", 0xdff15C, 2 }, /* Sprite 3 image data register A */
+ { L"SPR3DATB", 0xdff15E, 2 }, /* Sprite 3 image data register B */
+ { L"SPR4POS", 0xdff160, 2 }, /* Sprite 4 vert-horiz start pos data */
+ { L"SPR4CTL", 0xdff162, 2 }, /* Sprite 4 position and control data */
+ { L"SPR4DATA", 0xdff164, 2 }, /* Sprite 4 image data register A */
+ { L"SPR4DATB", 0xdff166, 2 }, /* Sprite 4 image data register B */
+ { L"SPR5POS", 0xdff168, 2 }, /* Sprite 5 vert-horiz start pos data */
+ { L"SPR5CTL", 0xdff16A, 2 }, /* Sprite 5 position and control data */
+ { L"SPR5DATA", 0xdff16C, 2 }, /* Sprite 5 image data register A */
+ { L"SPR5DATB", 0xdff16E, 2 }, /* Sprite 5 image data register B */
+ { L"SPR6POS", 0xdff170, 2 }, /* Sprite 6 vert-horiz start pos data */
+ { L"SPR6CTL", 0xdff172, 2 }, /* Sprite 6 position and control data */
+ { L"SPR6DATA", 0xdff174, 2 }, /* Sprite 6 image data register A */
+ { L"SPR6DATB", 0xdff176, 2 }, /* Sprite 6 image data register B */
+ { L"SPR7POS", 0xdff178, 2 }, /* Sprite 7 vert-horiz start pos data */
+ { L"SPR7CTL", 0xdff17A, 2 }, /* Sprite 7 position and control data */
+ { L"SPR7DATA", 0xdff17C, 2 }, /* Sprite 7 image data register A */
+ { L"SPR7DATB", 0xdff17E, 2 }, /* Sprite 7 image data register B */
+ { L"COLOR00", 0xdff180, 2 }, /* Color table 00 */
+ { L"COLOR01", 0xdff182, 2 }, /* Color table 01 */
+ { L"COLOR02", 0xdff184, 2 }, /* Color table 02 */
+ { L"COLOR03", 0xdff186, 2 }, /* Color table 03 */
+ { L"COLOR04", 0xdff188, 2 }, /* Color table 04 */
+ { L"COLOR05", 0xdff18A, 2 }, /* Color table 05 */
+ { L"COLOR06", 0xdff18C, 2 }, /* Color table 06 */
+ { L"COLOR07", 0xdff18E, 2 }, /* Color table 07 */
+ { L"COLOR08", 0xdff190, 2 }, /* Color table 08 */
+ { L"COLOR09", 0xdff192, 2 }, /* Color table 09 */
+ { L"COLOR10", 0xdff194, 2 }, /* Color table 10 */
+ { L"COLOR11", 0xdff196, 2 }, /* Color table 11 */
+ { L"COLOR12", 0xdff198, 2 }, /* Color table 12 */
+ { L"COLOR13", 0xdff19A, 2 }, /* Color table 13 */
+ { L"COLOR14", 0xdff19C, 2 }, /* Color table 14 */
+ { L"COLOR15", 0xdff19E, 2 }, /* Color table 15 */
+ { L"COLOR16", 0xdff1A0, 2 }, /* Color table 16 */
+ { L"COLOR17", 0xdff1A2, 2 }, /* Color table 17 */
+ { L"COLOR18", 0xdff1A4, 2 }, /* Color table 18 */
+ { L"COLOR19", 0xdff1A6, 2 }, /* Color table 19 */
+ { L"COLOR20", 0xdff1A8, 2 }, /* Color table 20 */
+ { L"COLOR21", 0xdff1AA, 2 }, /* Color table 21 */
+ { L"COLOR22", 0xdff1AC, 2 }, /* Color table 22 */
+ { L"COLOR23", 0xdff1AE, 2 }, /* Color table 23 */
+ { L"COLOR24", 0xdff1B0, 2 }, /* Color table 24 */
+ { L"COLOR25", 0xdff1B2, 2 }, /* Color table 25 */
+ { L"COLOR26", 0xdff1B4, 2 }, /* Color table 26 */
+ { L"COLOR27", 0xdff1B6, 2 }, /* Color table 27 */
+ { L"COLOR28", 0xdff1B8, 2 }, /* Color table 28 */
+ { L"COLOR29", 0xdff1BA, 2 }, /* Color table 29 */
+ { L"COLOR30", 0xdff1BC, 2 }, /* Color table 30 */
+ { L"COLOR31", 0xdff1BE, 2 }, /* Color table 31 */
+ { L"HTOTAL", 0xdff1C0, 2|4 }, /* Highest number count in horiz line (VARBEAMEN = 1) */
+ { L"HSSTOP", 0xdff1C2, 2|4 }, /* Horiz line pos for HSYNC stop */
+ { L"HBSTRT", 0xdff1C4, 2|4 }, /* Horiz line pos for HBLANK start */
+ { L"HBSTOP", 0xdff1C6, 2|4 }, /* Horiz line pos for HBLANK stop */
+ { L"VTOTAL", 0xdff1C8, 2|4 }, /* Highest numbered vertical line (VARBEAMEN = 1) */
+ { L"VSSTOP", 0xdff1CA, 2|4 }, /* Vert line for VBLANK start */
+ { L"VBSTRT", 0xdff1CC, 2|4 }, /* Vert line for VBLANK start */
+ { L"VBSTOP", 0xdff1CE, 2|4 }, /* Vert line for VBLANK stop */
#if 0
- { "SPRHSTRT", 0xdff1D0 }, /* UHRES sprite vertical start */
- { "SPRHSTOP", 0xdff1D2 }, /* UHRES sprite vertical stop */
- { "BPLHSTRT", 0xdff1D4 }, /* UHRES bit plane vertical stop */
- { "BPLHSTOP", 0xdff1D6 }, /* UHRES bit plane vertical stop */
- { "HHPOSW", 0xdff1D8 }, /* DUAL mode hires H beam counter write */
- { "HHPOSR", 0xdff1DA }, /* DUAL mode hires H beam counter read */
+ { L"SPRHSTRT", 0xdff1D0 }, /* UHRES sprite vertical start */
+ { L"SPRHSTOP", 0xdff1D2 }, /* UHRES sprite vertical stop */
+ { L"BPLHSTRT", 0xdff1D4 }, /* UHRES bit plane vertical stop */
+ { L"BPLHSTOP", 0xdff1D6 }, /* UHRES bit plane vertical stop */
+ { L"HHPOSW", 0xdff1D8 }, /* DUAL mode hires H beam counter write */
+ { L"HHPOSR", 0xdff1DA }, /* DUAL mode hires H beam counter read */
#endif
- { "BEAMCON0", 0xdff1DC, 2|4 }, /* Beam counter control register (SHRES,UHRES,PAL) */
- { "HSSTRT", 0xdff1DE, 2|4 }, /* Horizontal sync start (VARHSY) */
- { "VSSTRT", 0xdff1E0, 2|4 }, /* Vertical sync start (VARVSY) */
- { "HCENTER", 0xdff1E2, 2|4 }, /* Horizontal pos for vsync on interlace */
- { "DIWHIGH", 0xdff1E4, 2|4 }, /* Display window upper bits for start/stop */
+ { L"BEAMCON0", 0xdff1DC, 2|4 }, /* Beam counter control register (SHRES,UHRES,PAL) */
+ { L"HSSTRT", 0xdff1DE, 2|4 }, /* Horizontal sync start (VARHSY) */
+ { L"VSSTRT", 0xdff1E0, 2|4 }, /* Vertical sync start (VARVSY) */
+ { L"HCENTER", 0xdff1E2, 2|4 }, /* Horizontal pos for vsync on interlace */
+ { L"DIWHIGH", 0xdff1E4, 2|4 }, /* Display window upper bits for start/stop */
#if 0
- { "BPLHMOD", 0xdff1E6 }, /* UHRES bit plane modulo */
- { "SPRHPTH", 0xdff1E8 }, /* UHRES sprite pointer (high 5 bits) */
- { "SPRHPTL", 0xdff1EA }, /* UHRES sprite pointer (low 15 bits) */
- { "BPLHPTH", 0xdff1EC }, /* VRam (UHRES) bitplane pointer (hi 5 bits) */
- { "BPLHPTL", 0xdff1EE }, /* VRam (UHRES) bitplane pointer (lo 15 bits) */
- { "RESERVED", 0xdff1F0 }, /* Reserved (forever i guess!) */
- { "RESERVED", 0xdff1F2 }, /* Reserved (forever i guess!) */
- { "RESERVED", 0xdff1F4 }, /* Reserved (forever i guess!) */
- { "RESERVED", 0xdff1F6 }, /* Reserved (forever i guess!) */
- { "RESERVED", 0xdff1F8 }, /* Reserved (forever i guess!) */
- { "RESERVED", 0xdff1Fa }, /* Reserved (forever i guess!) */
+ { L"BPLHMOD", 0xdff1E6 }, /* UHRES bit plane modulo */
+ { L"SPRHPTH", 0xdff1E8 }, /* UHRES sprite pointer (high 5 bits) */
+ { L"SPRHPTL", 0xdff1EA }, /* UHRES sprite pointer (low 15 bits) */
+ { L"BPLHPTH", 0xdff1EC }, /* VRam (UHRES) bitplane pointer (hi 5 bits) */
+ { L"BPLHPTL", 0xdff1EE }, /* VRam (UHRES) bitplane pointer (lo 15 bits) */
+ { L"RESERVED", 0xdff1F0 }, /* Reserved (forever i guess!) */
+ { L"RESERVED", 0xdff1F2 }, /* Reserved (forever i guess!) */
+ { L"RESERVED", 0xdff1F4 }, /* Reserved (forever i guess!) */
+ { L"RESERVED", 0xdff1F6 }, /* Reserved (forever i guess!) */
+ { L"RESERVED", 0xdff1F8 }, /* Reserved (forever i guess!) */
+ { L"RESERVED", 0xdff1Fa }, /* Reserved (forever i guess!) */
#endif
- { "FMODE", 0xdff1FC, 2|8 }, /* Fetch mode register */
- { "NO-OP(NULL)", 0xdff1FE }, /* Can also indicate last 2 or 3 refresh
+ { L"FMODE", 0xdff1FC, 2|8 }, /* Fetch mode register */
+ { L"NO-OP(NULL)", 0xdff1FE }, /* Can also indicate last 2 or 3 refresh
cycles or the restart of the COPPER after lockup.*/
{ NULL }
};
extern void a3000scsi_reset (void);
extern void rethink_a2091 (void);
-extern void wdscsi_put(uae_u8);
-extern uae_u8 wdscsi_get(void);
-extern uae_u8 wdscsi_getauxstatus(void);
-extern void wdscsi_sasr(uae_u8);
+extern void wdscsi_put (uae_u8);
+extern uae_u8 wdscsi_get (void);
+extern uae_u8 wdscsi_getauxstatus (void);
+extern void wdscsi_sasr (uae_u8);
-extern void scsi_hsync(void);
+extern void scsi_hsync (void);
extern uae_u8 wdregs[32];
extern struct scsi_data *scsis[8];
-#define WD33C93 "WD33C93"
+#define WD33C93 L"WD33C93"
#define SCSIID (scsis[wdregs[WD_DESTINATION_ID] & 7])
-extern int a2091_add_scsi_unit(int ch, char *path, int blocksize, int readonly,
- char *devname, int sectors, int surfaces, int reserved,
- int bootpri, char *filesys);
-extern int a3000_add_scsi_unit(int ch, char *path, int blocksize, int readonly,
- char *devname, int sectors, int surfaces, int reserved,
- int bootpri, char *filesys);
+extern int a2091_add_scsi_unit (int ch, TCHAR *path, int blocksize, int readonly,
+ TCHAR *devname, int sectors, int surfaces, int reserved,
+ int bootpri, TCHAR *filesys);
+extern int a3000_add_scsi_unit (int ch, TCHAR *path, int blocksize, int readonly,
+ TCHAR *devname, int sectors, int surfaces, int reserved,
+ int bootpri, TCHAR *filesys);
-extern int addscsi(int ch, char *path, int blocksize, int readonly,
- char *devname, int sectors, int surfaces, int reserved,
- int bootpri, char *filesys, int scsi_level);
+extern int addscsi (int ch, TCHAR *path, int blocksize, int readonly,
+ TCHAR *devname, int sectors, int surfaces, int reserved,
+ int bootpri, TCHAR *filesys, int scsi_level);
#endif
#ifdef ARCADIA
extern void arcadia_init (void);
-extern int is_arcadia_rom (char *path);
+extern int is_arcadia_rom (const TCHAR *path);
extern int arcadia_map_banks (void);
extern void arcadia_unmap (void);
extern void arcadia_vsync (void);
extern void arcadia_reset (void);
extern uae_u8 arcadia_parport (int port, uae_u8 pra, uae_u8 dra);
-extern struct romdata *scan_arcadia_rom (char*, int);
+extern struct romdata *scan_arcadia_rom (TCHAR*, int);
struct arcadiarom {
int romid;
- char *name, *rom;
+ TCHAR *name, *rom;
int type, extra;
int b7, b6, b5, b4, b3, b2, b1, b0;
};
extern void db (uae_u8);
extern void dw (uae_u16);
extern void dl (uae_u32);
-extern uae_u32 ds (const char *);
+extern uae_u32 ds_ansi (const uae_char*);
+extern uae_u32 ds (const TCHAR*);
extern void calltrap (uae_u32);
extern void org (uae_u32);
extern uae_u32 here (void);
extern uaecptr makedatatable (uaecptr resid, uaecptr resname, uae_u8 type, uae_s8 priority, uae_u16 ver, uae_u16 rev);
-#define deftrap(f) define_trap((f), 0, "")
+#define deftrap(f) define_trap((f), 0, L"")
#define deftrap2(f, mode, str) define_trap((f), (mode), (str))
#define deftrapres(f, mode, str) define_trap((f), (mode | TRAPFLAG_UAERES), (str))
int nrcyls;
};
-extern int add_filesys_unitconfig (struct uae_prefs *p, int index, char *error);
+extern int add_filesys_unitconfig (struct uae_prefs *p, int index, TCHAR *error);
extern int get_filesys_unitconfig (struct uae_prefs *p, int index, struct mountedinfo*);
extern int kill_filesys_unitconfig (struct uae_prefs *p, int nr);
extern int move_filesys_unitconfig (struct uae_prefs *p, int nr, int to);
-int filesys_insert(int nr, char *volume, const char *rootdir, int readonly, int flags);
+int filesys_insert(int nr, TCHAR *volume, const TCHAR *rootdir, int readonly, int flags);
int filesys_eject(int nr);
-int filesys_media_change (const char *rootdir, int inserted, struct uaedev_config_info *uci);
+int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_config_info *uci);
-extern char *filesys_createvolname (const char *volname, const char *rootdir, const char *def);
-extern int target_get_volume_name(struct uaedev_mount_info *mtinf, const char *volumepath, char *volumename, int size, int inserted, int fullcheck);
+extern TCHAR *filesys_createvolname (const TCHAR *volname, const TCHAR *rootdir, const TCHAR *def);
+extern int target_get_volume_name(struct uaedev_mount_info *mtinf, const TCHAR *volumepath, TCHAR *volumename, int size, int inserted, int fullcheck);
-extern int sprintf_filesys_unit (char *buffer, int num);
+extern int sprintf_filesys_unit (TCHAR *buffer, int num);
extern void filesys_reset (void);
extern void filesys_cleanup (void);
int bytespersector;
int bus, target, lun;
int id;
- char label[MAX_DPATH];
+ TCHAR label[MAX_DPATH];
};
struct device_scsi_info {
//#define TRACING_ENABLED
#ifdef TRACING_ENABLED
-#define TRACE(x) do { write_log x; } while(0)
+#define BSDTRACE(x) do { write_log x; } while(0)
#else
-#define TRACE(x)
+#define BSDTRACE(x)
#endif
extern int init_socket_layer (void);
#define LIBRARY_SIZEOF 36
struct UAEBSDBase {
- char dummy[LIBRARY_SIZEOF];
+ uae_u8 dummy[LIBRARY_SIZEOF];
struct socketbase *sb;
- char scratchbuf[SCRATCHBUFSIZE];
+ uae_u8 scratchbuf[SCRATCHBUFSIZE];
};
/* socket flags */
#define SF_BLOCKING 0x80000000
#define SF_BLOCKINGINPROGRESS 0x40000000
-extern uae_u32 addstr (uae_u32 *, const char *);
-extern uae_u32 addmem (uae_u32 *, const char *, int len);
-
-extern char *strncpyah (char *, uae_u32, int);
-extern uae_u32 strncpyha (uae_u32, const char *, int);
+uae_u32 addstr (uae_u32 * dst, const TCHAR *src);
+uae_u32 addstr_ansi (uae_u32 * dst, const uae_char *src);
+uae_u32 strncpyha (uae_u32 dst, const uae_char *src, int size);
+uae_u32 addmem (uae_u32 * dst, const uae_char *src, int len);
#define SB struct socketbase *sb
void cdtv_battram_write (int addr, int v);
uae_u8 cdtv_battram_read (int addr);
-extern void cdtv_loadcardmem(uae_u8*, int);
-extern void cdtv_savecardmem(uae_u8*, int);
+extern void cdtv_loadcardmem (uae_u8*, int);
+extern void cdtv_savecardmem (uae_u8*, int);
-int cdtv_add_scsi_unit(int ch, char *path, int blocksize, int readonly,
- char *devname, int sectors, int surfaces, int reserved,
- int bootpri, char *filesys);
+int cdtv_add_scsi_unit (int ch, TCHAR *path, int blocksize, int readonly,
+ TCHAR *devname, int sectors, int surfaces, int reserved,
+ int bootpri, TCHAR *filesys);
-extern void cdtv_getdmadata(uae_u32*);
+extern void cdtv_getdmadata (uae_u32*);
extern void rethink_cdtv (void);
extern void cdtv_scsi_int (void);
static ALWAYS_INLINE bool test_ram_boundary (uaecptr addr, int size, bool super, bool write) { return false; }
static ALWAYS_INLINE void flush_internals (void) { }
-typedef char flagtype;
+typedef uae_u8 flagtype;
struct xttrx {
uae_u32 log_addr_base : 8;
-extern uae_u32 get_crc32 (uae_u8 *p, int size);
-extern uae_u16 get_crc16 (uae_u8 *p, int size);
+extern uae_u32 get_crc32 (void *p, int size);
+extern uae_u16 get_crc16 (void *p, int size);
extern uae_u32 get_crc32_val (uae_u8 v, uae_u32 crc);
-extern void get_sha1 (uae_u8 *p, int size, uae_u8 *out);
-extern char *get_sha1_txt (uae_u8 *p, int size);
+extern void get_sha1 (void *p, int size, void *out);
+extern const TCHAR *get_sha1_txt (void *p, int size);
#define SHA1_SIZE 20
extern void activate_debugger(void);
extern void deactivate_debugger (void);
extern int notinrom (void);
-extern const char *debuginfo(int);
+extern const TCHAR *debuginfo (int);
extern void record_copper (uaecptr addr, int hpos, int vpos);
extern void record_copper_reset(void);
extern int mmu_init(int,uaecptr,uaecptr);
extern void dump_aga_custom (void);
extern void memory_map_dump (void);
extern void debug_help (void);
-extern uaecptr dumpmem2 (uaecptr addr, char *out, int osize);
+extern uaecptr dumpmem2 (uaecptr addr, TCHAR *out, int osize);
extern void update_debug_info (void);
-extern int instruction_breakpoint (char **c);
+extern int instruction_breakpoint (TCHAR **c);
extern int debug_bankchange (int);
#define BREAKPOINT_TOTAL 8
};
extern struct memwatch_node mwnodes[MEMWATCH_TOTAL];
-extern void memwatch_dump2 (char *buf, int bufsize, int num);
+extern void memwatch_dump2 (TCHAR *buf, int bufsize, int num);
void debug_lgetpeek (uaecptr addr, uae_u32 v);
void debug_wgetpeek (uaecptr addr, uae_u32 v);
void debug_lputpeek(uaecptr addr, uae_u32 v);
enum debugtest_item { DEBUGTEST_BLITTER, DEBUGTEST_KEYBOARD, DEBUGTEST_FLOPPY, DEBUGTEST_MAX };
-void debugtest (enum debugtest_item, const char *, ...);
+void debugtest (enum debugtest_item, const TCHAR *, ...);
#else
extern uae_u8 DISK_status (void);
extern void disk_eject (int num);
extern int disk_empty (int num);
-extern void disk_insert (int num, const char *name);
-extern void disk_insert_force (int num, const char *name);
+extern void disk_insert (int num, const TCHAR *name);
+extern void disk_insert_force (int num, const TCHAR *name);
extern void DISK_check_change (void);
-extern struct zfile *DISK_validate_filename (const char *, int, int *, uae_u32 *);
+extern struct zfile *DISK_validate_filename (const TCHAR *, int, int *, uae_u32 *);
extern void DISK_handler (uae_u32);
extern void DISK_update (int hpos);
extern void DISK_hsync (int hpos);
extern void DISK_reset (void);
-extern int disk_getwriteprotect (const char *name);
-extern int disk_setwriteprotect (int num, const char *name, int protect);
-extern void disk_creatediskfile (char *name, int type, drive_type adftype, char *disk_name);
+extern int disk_getwriteprotect (const TCHAR *name);
+extern int disk_setwriteprotect (int num, const TCHAR *name, int protect);
+extern void disk_creatediskfile (TCHAR *name, int type, drive_type adftype, TCHAR *disk_name);
extern void dumpdisk (void);
-extern int DISK_history_add (const char *name, int idx);
-extern char *DISK_history_get (int idx);
+extern int DISK_history_add (const TCHAR *name, int idx);
+extern TCHAR *DISK_history_get (int idx);
int DISK_examine_image (struct uae_prefs *p, int num, uae_u32 *crc32);
-extern char *DISK_get_saveimagepath (const char *name);
+extern TCHAR *DISK_get_saveimagepath (const TCHAR *name);
extern void DISK_reinsert (int num);
extern void DSKLEN (uae_u16 v, int hpos);
#define DS_SNATCH 4
#define DS_END 5
-extern void driveclick_click(int drive, int startOffset);
-extern void driveclick_motor(int drive, int running);
-extern void driveclick_insert(int drive, int eject);
-extern void driveclick_init(void);
-extern void driveclick_free(void);
-extern void driveclick_reset(void);
-extern void driveclick_mix(uae_s16*, int);
-extern int driveclick_loadresource(struct drvsample*, int);
+extern void driveclick_click (int drive, int startOffset);
+extern void driveclick_motor (int drive, int running);
+extern void driveclick_insert (int drive, int eject);
+extern void driveclick_init (void);
+extern void driveclick_free (void);
+extern void driveclick_reset (void);
+extern void driveclick_mix (uae_s16*, int);
+extern int driveclick_loadresource (struct drvsample*, int);
extern void driveclick_check_prefs (void);
extern uae_s16 *decodewav (uae_u8 *s, int *len);
#define DS_BUILD_IN_SOUNDS 1
-#define DS_NAME_CLICK "drive_click_"
-#define DS_NAME_SPIN "drive_spin_"
-#define DS_NAME_SPIN_ND "drive_spinnd_"
-#define DS_NAME_START "drive_start_"
-#define DS_NAME_SNATCH "drive_snatch_"
+#define DS_NAME_CLICK L"drive_click_"
+#define DS_NAME_SPIN L"drive_spin_"
+#define DS_NAME_SPIN_ND L"drive_spinnd_"
+#define DS_NAME_START L"drive_start_"
+#define DS_NAME_SNATCH L"drive_snatch_"
-extern int driveclick_fdrawcmd_open(int);
-extern void driveclick_fdrawcmd_close(int);
-extern void driveclick_fdrawcmd_detect(void);
-extern void driveclick_fdrawcmd_seek(int, int);
-extern void driveclick_fdrawcmd_motor(int, int);
-extern void driveclick_fdrawcmd_vsync(void);
+extern int driveclick_fdrawcmd_open (int);
+extern void driveclick_fdrawcmd_close (int);
+extern void driveclick_fdrawcmd_detect (void);
+extern void driveclick_fdrawcmd_seek (int, int);
+extern void driveclick_fdrawcmd_motor (int, int);
+extern void driveclick_fdrawcmd_vsync (void);
extern int driveclick_pcdrivemask, driveclick_pcdrivenum;
\ No newline at end of file
uae_u8 *cache;
int cache_valid;
uae_u64 cache_offset;
- char vendor_id[8 + 1];
- char product_id[16 + 1];
- char product_rev[4 + 1];
- char device_name[256];
+ TCHAR vendor_id[8 + 1];
+ TCHAR product_id[16 + 1];
+ TCHAR product_rev[4 + 1];
+ TCHAR device_name[256];
/* geometry from possible RDSK block */
unsigned int cylinders;
unsigned int sectors;
uae_u64 vhd_footerblock;
int drive_empty;
- char *emptyname;
+ TCHAR *emptyname;
};
#define HFD_FLAGS_REALDRIVE 1
unsigned int cyls_def;
unsigned int secspertrack_def;
unsigned int heads_def;
- char *path;
+ TCHAR *path;
int ansi_version;
};
extern struct hardfiledata *get_hardfile_data (int nr);
#define FILESYS_MAX_BLOCKSIZE 2048
-extern int hdf_open (struct hardfiledata *hfd, const char *name);
+extern int hdf_open (struct hardfiledata *hfd, const TCHAR *name);
extern int hdf_dup (struct hardfiledata *dhfd, const struct hardfiledata *shfd);
extern void hdf_close (struct hardfiledata *hfd);
extern int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len);
extern int hdf_write (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len);
extern int hdf_getnumharddrives (void);
-extern char *hdf_getnameharddrive (int index, int flags, int *sectorsize);
-extern int isspecialdrive(const char *name);
-extern int get_native_path(uae_u32 lock, char *out);
+extern TCHAR *hdf_getnameharddrive (int index, int flags, int *sectorsize);
+extern int isspecialdrive(const TCHAR *name);
+extern int get_native_path(uae_u32 lock, TCHAR *out);
extern void hardfile_do_disk_change (struct uaedev_config_info *uci, int insert);
void hdf_hd_close(struct hd_hardfiledata *hfd);
-int hdf_hd_open(struct hd_hardfiledata *hfd, const char *path, int blocksize, int readonly,
- const char *devname, int sectors, int surfaces, int reserved,
- int bootpri, const char *filesys);
+int hdf_hd_open(struct hd_hardfiledata *hfd, const TCHAR *path, int blocksize, int readonly,
+ const TCHAR *devname, int sectors, int surfaces, int reserved,
+ int bootpri, const TCHAR *filesys);
-extern int vhd_create (const char *name, uae_u64 size);
+extern int vhd_create (const TCHAR *name, uae_u64 size);
extern int hdf_init_target (void);
-extern int hdf_open_target (struct hardfiledata *hfd, const char *name);
+extern int hdf_open_target (struct hardfiledata *hfd, const TCHAR *name);
extern int hdf_dup_target (struct hardfiledata *dhfd, const struct hardfiledata *shfd);
extern void hdf_close_target (struct hardfiledata *hfd);
extern int hdf_read_target (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len);
*/
#ifndef FSDB_FILE
-#define FSDB_FILE "_UAEFSDB.___"
+#define FSDB_FILE L"_UAEFSDB.___"
#endif
#ifndef FSDB_DIR_SEPARATOR
struct a_inode_struct *child, *sibling;
/* AmigaOS name, and host OS name. The host OS name is a full path, the
* AmigaOS name is relative to the parent. */
- char *aname;
- char *nname;
+ TCHAR *aname;
+ TCHAR *nname;
/* AmigaOS file comment, or NULL if file has none. */
- char *comment;
+ TCHAR *comment;
/* AmigaOS protection bits. */
int amigaos_mode;
/* Unique number for identification. */
#endif
} a_inode;
-extern char *nname_begin (char *);
+extern TCHAR *nname_begin (TCHAR *);
-extern char *build_nname (const char *d, const char *n);
-extern char *build_aname (const char *d, const char *n);
+extern TCHAR *build_nname (const TCHAR *d, const TCHAR *n);
+extern TCHAR *build_aname (const TCHAR *d, const TCHAR *n);
/* Filesystem-independent functions. */
extern void fsdb_clean_dir (a_inode *);
-extern char *fsdb_search_dir (const char *dirname, char *rel);
+extern TCHAR *fsdb_search_dir (const TCHAR *dirname, TCHAR *rel);
extern void fsdb_dir_writeback (a_inode *);
-extern int fsdb_used_as_nname (a_inode *base, const char *);
-extern a_inode *fsdb_lookup_aino_aname (a_inode *base, const char *);
-extern a_inode *fsdb_lookup_aino_nname (a_inode *base, const char *);
-extern int fsdb_exists (char *nname);
+extern int fsdb_used_as_nname (a_inode *base, const TCHAR *);
+extern a_inode *fsdb_lookup_aino_aname (a_inode *base, const TCHAR *);
+extern a_inode *fsdb_lookup_aino_nname (a_inode *base, const TCHAR *);
+extern int fsdb_exists (TCHAR *nname);
-STATIC_INLINE int same_aname (const char *an1, const char *an2)
+STATIC_INLINE int same_aname (const TCHAR *an1, const TCHAR *an2)
{
return strcasecmp (an1, an2) == 0;
}
/* Filesystem-dependent functions. */
-extern int fsdb_name_invalid (const char *n);
+extern int fsdb_name_invalid (const TCHAR *n);
extern int fsdb_fill_file_attrs (a_inode *, a_inode *);
extern int fsdb_set_file_attrs (a_inode *);
extern int fsdb_mode_representable_p (const a_inode *, int);
extern int fsdb_mode_supported (const a_inode *);
-extern char *fsdb_create_unique_nname (a_inode *base, const char *);
+extern TCHAR *fsdb_create_unique_nname (a_inode *base, const TCHAR *);
-extern void *my_opendir (const char*);
+extern void *my_opendir (const TCHAR*);
extern void my_closedir (void*);
-extern int my_readdir (void*, char*);
+extern int my_readdir (void*, TCHAR*);
-extern int my_rmdir (const char*);
-extern int my_mkdir (const char*);
-extern int my_unlink (const char*);
-extern int my_rename (const char*, const char*);
+extern int my_rmdir (const TCHAR*);
+extern int my_mkdir (const TCHAR*);
+extern int my_unlink (const TCHAR*);
+extern int my_rename (const TCHAR*, const TCHAR*);
-extern void *my_open (const char*, int);
+extern void *my_open (const TCHAR*, int);
extern void my_close (void*);
-extern unsigned int my_lseek (void*, unsigned int, int);
+extern uae_s64 my_lseek (void*, uae_s64, int);
extern unsigned int my_read (void*, void*, unsigned int);
extern unsigned int my_write (void*, void*, unsigned int);
-extern int my_truncate (const char *name, long int len);
+extern int my_truncate (const TCHAR *name, uae_u64 len);
extern int dos_errno (void);
-extern int my_existsfile (const char *name);
-extern int my_existsdir (const char *name);
+extern int my_existsfile (const TCHAR *name);
+extern int my_existsdir (const TCHAR *name);
-extern char *custom_fsdb_search_dir (const char *dirname, char *rel);
-extern a_inode *custom_fsdb_lookup_aino_aname (a_inode *base, const char *aname);
-extern a_inode *custom_fsdb_lookup_aino_nname (a_inode *base, const char *nname);
-extern int custom_fsdb_used_as_nname (a_inode *base, const char *nname);
+extern char *custom_fsdb_search_dir (const char *dirname, TCHAR *rel);
+extern a_inode *custom_fsdb_lookup_aino_aname (a_inode *base, const TCHAR *aname);
+extern a_inode *custom_fsdb_lookup_aino_nname (a_inode *base, const TCHAR *nname);
+extern int custom_fsdb_used_as_nname (a_inode *base, const TCHAR *nname);
#define MYVOLUMEINFO_READONLY 1
#define MYVOLUMEINFO_STREAMS 2
#define MYVOLUMEINFO_ARCHIVE 4
#define MYVOLUMEINFO_REUSABLE 8
-extern int my_getvolumeinfo (const char *root);
+extern int my_getvolumeinfo (const TCHAR *root);
-extern void gayle_reset(int);
-extern void gayle_hsync(void);
-extern int gayle_add_ide_unit(int ch, char *path, int blocksize, int readonly,
- char *devname, int sectors, int surfaces, int reserved,
- int bootpri, char *filesys);
-extern int gayle_modify_pcmcia_sram_unit(const char *path, int readonly, int insert);
-extern int gayle_add_pcmcia_sram_unit(const char *path, int readonly);
-extern void gayle_free_units(void);
+extern void gayle_reset (int);
+extern void gayle_hsync (void);
+extern int gayle_add_ide_unit (int ch, TCHAR *path, int blocksize, int readonly,
+ TCHAR *devname, int sectors, int surfaces, int reserved,
+ int bootpri, TCHAR *filesys);
+extern int gayle_modify_pcmcia_sram_unit (const TCHAR *path, int readonly, int insert);
+extern int gayle_add_pcmcia_sram_unit (const TCHAR *path, int readonly);
+extern void gayle_free_units (void);
extern void rethink_gayle (void);
extern void gayle_map_pcmcia (void);
struct uae_filter
{
int type, yuv, intmul;
- char *name, *cfgname;
+ TCHAR *name, *cfgname;
int x[6];
};
extern void gui_exit (void);
extern void gui_led (int, int);
extern void gui_handle_events (void);
-extern void gui_filename (int, const char *);
+extern void gui_filename (int, const TCHAR *);
extern void gui_fps (int fps, int idle);
extern void gui_changesettings (void);
extern void gui_lock (void);
extern void gui_unlock (void);
extern void gui_hd_led (int, int);
extern void gui_cd_led (int, int);
-extern void gui_disk_image_change (int, const char *);
+extern void gui_disk_image_change (int, const TCHAR *);
extern unsigned int gui_ledstate;
extern void gui_display (int shortcut);
uae_u8 cd; /* CD */
int fps, idle;
int sndbuf, sndbuf_status;
- char df[4][256]; /* inserted image */
+ TCHAR df[4][256]; /* inserted image */
uae_u32 crc32[4]; /* crc32 of image */
};
#define NUM_LEDS (1 + 1 + 1 + 1 + 1 + 1 + 4)
extern void gui_update_gfx (void);
void notify_user (int msg);
-void notify_user_parms (int msg, const char *parms, ...);
-int translate_message (int msg, char *out);
+void notify_user_parms (int msg, const TCHAR *parms, ...);
+int translate_message (int msg, TCHAR *out);
typedef enum {
NUMSG_NEEDEXT2, NUMSG_NOROM, NUMSG_NOROMKEY,
NUMSG_KSROMCRCERROR, NUMSG_KSROMREADERROR, NUMSG_NOEXTROM,
struct mem_labels
{
- const char *name;
+ const TCHAR *name;
uae_u32 adr;
};
struct customData
{
- const char *name;
+ const TCHAR *name;
uae_u32 adr;
uae_u8 rw, special;
};
void (*unacquire)(int);
void (*read)(void);
int (*get_num)(void);
- char* (*get_friendlyname)(int);
- char* (*get_uniquename)(int);
+ TCHAR* (*get_friendlyname)(int);
+ TCHAR* (*get_uniquename)(int);
int (*get_widget_num)(int);
- int (*get_widget_type)(int,int,char*,uae_u32*);
+ int (*get_widget_type)(int,int,TCHAR*,uae_u32*);
int (*get_widget_first)(int,int);
int (*get_flags)(int);
};
#define ID_AXIS_OFFSET 32
#define ID_AXIS_TOTAL 32
-extern int inputdevice_iterate (int devnum, int num, char *name, int *af);
-extern int inputdevice_set_mapping (int devnum, int num, char *name, char *custom, int af, int sub);
-extern int inputdevice_get_mapped_name (int devnum, int num, int *pflags, char *name, char *custom, int sub);
+extern int inputdevice_iterate (int devnum, int num, TCHAR *name, int *af);
+extern int inputdevice_set_mapping (int devnum, int num, TCHAR *name, TCHAR *custom, int af, int sub);
+extern int inputdevice_get_mapped_name (int devnum, int num, int *pflags, TCHAR *name, TCHAR *custom, int sub);
extern void inputdevice_copyconfig (const struct uae_prefs *src, struct uae_prefs *dst);
extern void inputdevice_copy_single_config (struct uae_prefs *p, int src, int dst, int devnum);
extern void inputdevice_swap_ports (struct uae_prefs *p, int devnum);
extern void inputdevice_config_change (void);
extern int inputdevice_config_change_test (void);
extern int inputdevice_get_device_index (int devnum);
-extern char *inputdevice_get_device_name (int type, int devnum);
-extern char *inputdevice_get_device_unique_name (int type, int devnum);
+extern TCHAR *inputdevice_get_device_name (int type, int devnum);
+extern TCHAR *inputdevice_get_device_unique_name (int type, int devnum);
extern int inputdevice_get_device_status (int devnum);
extern void inputdevice_set_device_status (int devnum, int enabled);
extern int inputdevice_get_device_total (int type);
extern int inputdevice_get_widget_num (int devnum);
-extern int inputdevice_get_widget_type (int devnum, int num, char *name);
+extern int inputdevice_get_widget_type (int devnum, int num, TCHAR *name);
extern int input_get_default_mouse (struct uae_input_device *uid, int num, int port);
extern int input_get_default_joystick (struct uae_input_device *uid, int num, int port);
extern void inputdevice_reset (void);
extern void write_inputdevice_config (struct uae_prefs *p, struct zfile *f);
-extern void read_inputdevice_config (struct uae_prefs *p, char *option, char *value);
+extern void read_inputdevice_config (struct uae_prefs *p, TCHAR *option, TCHAR *value);
extern void reset_inputdevice_config (struct uae_prefs *pr);
-extern int inputdevice_joyport_config (struct uae_prefs *p, char *value, int portnum, int type);
+extern int inputdevice_joyport_config (struct uae_prefs *p, TCHAR *value, int portnum, int type);
extern int inputdevice_getjoyportdevice (int jport);
extern void inputdevice_init (void);
extern int jsem_iskbdjoy (int port, const struct uae_prefs *p);
extern void do_fake_joystick (int nr, int *fake);
-extern int inputdevice_uaelib (char *, char *);
+extern int inputdevice_uaelib (TCHAR *, TCHAR *);
#define INPREC_JOYPORT 1
#define INPREC_JOYBUTTON 2
#define INPREC_END 0xff
extern int input_recording;
-extern void inprec_close(void);
-extern int inprec_open(char*, int);
-extern void inprec_rend(void);
-extern void inprec_rstart(uae_u8);
-extern void inprec_ru8(uae_u8);
-extern void inprec_ru16(uae_u16);
-extern void inprec_ru32(uae_u32);
-extern void inprec_rstr(const char*);
-extern int inprec_pstart(uae_u8);
-extern void inprec_pend(void);
-extern uae_u8 inprec_pu8(void);
-extern uae_u16 inprec_pu16(void);
-extern uae_u32 inprec_pu32(void);
-extern int inprec_pstr(char*);
-
-extern int inputdevice_testread (char *name);
+extern void inprec_close (void);
+extern int inprec_open (TCHAR*, int);
+extern void inprec_rend (void);
+extern void inprec_rstart (uae_u8);
+extern void inprec_ru8 (uae_u8);
+extern void inprec_ru16 (uae_u16);
+extern void inprec_ru32 (uae_u32);
+extern void inprec_rstr (const TCHAR*);
+extern int inprec_pstart (uae_u8);
+extern void inprec_pend (void);
+extern uae_u8 inprec_pu8 (void);
+extern uae_u16 inprec_pu16 (void);
+extern uae_u32 inprec_pu32 (void);
+extern int inprec_pstr (TCHAR*);
+
+extern int inputdevice_testread (TCHAR *name);
extern int inputdevice_istest (void);
typedef uae_u8 *(REGPARAM3 *xlate_func)(uaecptr) REGPARAM;
typedef int (REGPARAM3 *check_func)(uaecptr, uae_u32) REGPARAM;
-extern char *address_space, *good_address_map;
+extern uae_u8 *address_space, *good_address_map;
extern uae_u8 *chipmemory;
extern uae_u32 allocated_chipmem;
ourselves. This holds the memory address where the start of memory is
for this particular bank. */
uae_u8 *baseaddr;
- char *name;
+ TCHAR *name;
/* for instruction opcode/operand fetches */
mem_get_func lgeti, wgeti;
int flags;
STATIC_INLINE uae_u8 *get_real_address (uaecptr addr)
{
- return get_mem_bank(addr).xlateaddr(addr);
+ return get_mem_bank (addr).xlateaddr(addr);
}
-STATIC_INLINE int valid_address(uaecptr addr, uae_u32 size)
+STATIC_INLINE int valid_address (uaecptr addr, uae_u32 size)
{
- return get_mem_bank(addr).check(addr, size);
+ return get_mem_bank (addr).check(addr, size);
}
-extern int addr_valid(char*,uaecptr,uae_u32);
+extern int addr_valid (TCHAR*, uaecptr,uae_u32);
/* For faster access in custom chip emulation. */
extern uae_u32 REGPARAM3 chipmem_lget (uaecptr) REGPARAM;
#endif
-extern uae_u8 *mapped_malloc (size_t, const char *);
+extern uae_u8 *mapped_malloc (size_t, const TCHAR*);
extern void mapped_free (uae_u8 *);
extern void clearexec (void);
extern void mapkick (void);
extern int decode_cloanto_rom_do (uae_u8 *mem, int size, int real_size);
-extern void a3000_fakekick(int);
+extern void a3000_fakekick (int);
#define ROMTYPE_KICK 0x000001
#define ROMTYPE_KICKCD32 0x000002
#define ROMTYPE_SCRAMBLED 0x400000
struct romheader {
- char *name;
+ TCHAR *name;
int id;
};
struct romdata {
- char *name;
+ TCHAR *name;
int ver, rev;
int subver, subrev;
- char *model;
+ TCHAR *model;
uae_u32 size;
int id;
int cpu;
int type;
int group;
int title;
- char *partnumber;
+ TCHAR *partnumber;
uae_u32 crc32;
uae_u32 sha1[5];
- char *configname;
+ TCHAR *configname;
};
struct romlist {
- char *path;
+ TCHAR *path;
struct romdata *rd;
};
-extern struct romdata *getromdatabypath(char *path);
+extern struct romdata *getromdatabypath (TCHAR *path);
extern struct romdata *getromdatabycrc (uae_u32 crc32);
extern struct romdata *getromdatabydata (uae_u8 *rom, int size);
extern struct romdata *getromdatabyid (int id);
extern struct romdata *getromdatabyidgroup (int id, int group, int subitem);
extern struct romdata *getromdatabyzfile (struct zfile *f);
extern struct romlist **getarcadiaroms (void);
-extern struct romdata *getarcadiarombyname (char *name);
-extern struct romlist **getromlistbyident(int ver, int rev, int subver, int subrev, char *model, int all);
-extern void getromname (struct romdata*, char*);
-extern struct romdata *getromdatabyname (char*);
-extern struct romlist *getromlistbyids(int *ids);
+extern struct romdata *getarcadiarombyname (TCHAR *name);
+extern struct romlist **getromlistbyident (int ver, int rev, int subver, int subrev, TCHAR *model, int all);
+extern void getromname (struct romdata*, TCHAR*);
+extern struct romdata *getromdatabyname (TCHAR*);
+extern struct romlist *getromlistbyids (int *ids);
extern void romwarning(int *ids);
-extern struct romlist *getromlistbyromdata(struct romdata *rd);
-extern void romlist_add (char *path, struct romdata *rd);
-extern char *romlist_get (struct romdata *rd);
+extern struct romlist *getromlistbyromdata (struct romdata *rd);
+extern void romlist_add (TCHAR *path, struct romdata *rd);
+extern TCHAR *romlist_get (struct romdata *rd);
extern void romlist_clear (void);
extern struct zfile *read_rom (struct romdata **rd);
-extern struct zfile *read_rom_name (const char *filename);
+extern struct zfile *read_rom_name (const TCHAR *filename);
-extern int load_keyring (struct uae_prefs *p, char *path);
-extern uae_u8 *target_load_keyfile (struct uae_prefs *p, char *path, int *size, char *name);
+extern int load_keyring (struct uae_prefs *p, TCHAR *path);
+extern uae_u8 *target_load_keyfile (struct uae_prefs *p, TCHAR *path, int *size, TCHAR *name);
extern void free_keyring (void);
extern int get_keyring (void);
-uaecptr strcpyha_safe (uaecptr dst, const char *src);
-extern char *strcpyah_safe (char *dst, uaecptr src, int maxsize);
-void memcpyha_safe (uaecptr dst, const uae_u8 *src, int size);
-void memcpyha (uaecptr dst, const uae_u8 *src, int size);
-void memcpyah_safe (uae_u8 *dst, uaecptr src, int size);
-void memcpyah (uae_u8 *dst, uaecptr src, int size);
+extern uaecptr strcpyha_safe (uaecptr dst, const uae_char *src);
+extern uae_char *strcpyah_safe (uae_u8 *dst, uaecptr src, int maxsize);
+extern void memcpyha_safe (uaecptr dst, const uae_u8 *src, int size);
+extern void memcpyha (uaecptr dst, const uae_u8 *src, int size);
+extern void memcpyah_safe (uae_u8 *dst, uaecptr src, int size);
+extern void memcpyah (uae_u8 *dst, uaecptr src, int size);
extern unsigned long REGPARAM3 op_illg (uae_u32, struct regstruct *regs) REGPARAM;
-typedef char flagtype;
+typedef uae_u8 flagtype;
#ifdef FPUEMU
/* You can set this to long double to be more accurate. However, the
STATIC_INLINE uaecptr m68k_getpc (struct regstruct *regs)
{
- return (uaecptr)(regs->pc + ((char *)regs->pc_p - (char *)regs->pc_oldp));
+ return (uaecptr)(regs->pc + ((uae_u8*)regs->pc_p - (uae_u8*)regs->pc_oldp));
}
#define M68K_GETPC m68k_getpc(®s)
STATIC_INLINE uaecptr m68k_getpc_p (struct regstruct *regs, uae_u8 *p)
{
- return (uaecptr)(regs->pc + ((char *)p - (char *)regs->pc_oldp));
+ return (uaecptr)(regs->pc + ((uae_u8*)p - (uae_u8*)regs->pc_oldp));
}
#define m68k_incpc(regs, o) ((regs)->pc_p += (o))
extern uae_u32 REGPARAM3 get_disp_ea_000 (struct regstruct *regs, uae_u32 base, uae_u32 dp) REGPARAM;
extern void m68k_disasm_ea (void *f, uaecptr addr, uaecptr *nextpc, int cnt, uae_u32 *seaddr, uae_u32 *deaddr);
extern void m68k_disasm (void *f, uaecptr addr, uaecptr *nextpc, int cnt);
-extern void m68k_disasm_2 (char *buf, int bufsize, uaecptr addr, uaecptr *nextpc, int cnt, uae_u32 *seaddr, uae_u32 *deaddr, int safemode);
+extern void m68k_disasm_2 (TCHAR *buf, int bufsize, uaecptr addr, uaecptr *nextpc, int cnt, uae_u32 *seaddr, uae_u32 *deaddr, int safemode);
extern int get_cpu_model(void);
extern void REGPARAM3 MakeSR (struct regstruct *regs) REGPARAM;
extern void m68k_go (int);
extern void m68k_dumpstate (void *, uaecptr *);
extern void m68k_disasm (void *, uaecptr, uaecptr *, int);
-extern void sm68k_disasm(char *, char *, uaecptr addr, uaecptr *nextpc);
+extern void sm68k_disasm (TCHAR*, TCHAR*, uaecptr addr, uaecptr *nextpc);
extern void m68k_reset (int);
extern int getDivu68kCycles(uae_u32 dividend, uae_u16 divisor);
extern int getDivs68kCycles(uae_s32 dividend, uae_s16 divisor);
extern void val_move2c2 (int regno, uae_u32 val);
struct cpum2c {
int regno;
- char *regname;
+ TCHAR *regname;
};
extern struct cpum2c m2cregs[];
struct strlist {
struct strlist *next;
- char *option, *value;
+ TCHAR *option, *value;
int unknown;
};
#define MAX_INPUT_SIMULTANEOUS_KEYS 4
struct uae_input_device {
- char *name;
- char *configname;
+ TCHAR *name;
+ TCHAR *configname;
uae_s16 eventid[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT];
- char *custom[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT];
+ TCHAR *custom[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT];
uae_u16 flags[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT];
uae_s16 extra[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SIMULTANEOUS_KEYS];
uae_u8 enabled;
#define MAX_JPORTNAME 128
struct jport {
int id;
- char name[MAX_JPORTNAME];
- char configname[MAX_JPORTNAME];
+ TCHAR name[MAX_JPORTNAME];
+ TCHAR configname[MAX_JPORTNAME];
};
#define MAX_SPARE_DRIVES 20
#define MOUNT_CONFIG_SIZE 30
struct uaedev_config_info {
- char devname[MAX_DPATH];
- char volname[MAX_DPATH];
- char rootdir[MAX_DPATH];
+ TCHAR devname[MAX_DPATH];
+ TCHAR volname[MAX_DPATH];
+ TCHAR rootdir[MAX_DPATH];
int ishdf;
int readonly;
int bootpri;
int autoboot;
int donotmount;
- char filesys[MAX_DPATH];
+ TCHAR filesys[MAX_DPATH];
int surfaces;
int sectors;
int reserved;
struct strlist *all_lines;
- char description[256];
- char info[256];
+ TCHAR description[256];
+ TCHAR info[256];
int config_version;
- char config_hardware_path[MAX_DPATH];
- char config_host_path[MAX_DPATH];
+ TCHAR config_hardware_path[MAX_DPATH];
+ TCHAR config_host_path[MAX_DPATH];
int illegal_mem;
int no_xhair;
int parallel_postscript_emulation;
int parallel_postscript_detection;
int parallel_autoflush_time;
- char ghostscript_parameters[256];
+ TCHAR ghostscript_parameters[256];
int use_gfxlib;
int socket_emu;
uae_u32 override_dga_address;
int gfx_display;
- char gfx_display_name[256];
+ TCHAR gfx_display_name[256];
int gfx_framerate, gfx_autoframerate;
struct wh gfx_size_win;
struct wh gfx_size_fs;
int color_mode;
int gfx_filter;
- char gfx_filtershader[MAX_DPATH];
+ TCHAR gfx_filtershader[MAX_DPATH];
int gfx_filter_scanlines;
int gfx_filter_scanlineratio;
int gfx_filter_scanlinelevel;
int cs_denisenoehb;
int cs_agnusbltbusybug;
- char df[4][MAX_DPATH];
- char dfxlist[MAX_SPARE_DRIVES][MAX_DPATH];
- char romfile[MAX_DPATH];
- char romident[256];
- char romextfile[MAX_DPATH];
- char romextident[256];
- char flashfile[MAX_DPATH];
- char cartfile[MAX_DPATH];
- char cartident[256];
+ TCHAR df[4][MAX_DPATH];
+ TCHAR dfxlist[MAX_SPARE_DRIVES][MAX_DPATH];
+ TCHAR romfile[MAX_DPATH];
+ TCHAR romident[256];
+ TCHAR romextfile[MAX_DPATH];
+ TCHAR romextident[256];
+ TCHAR flashfile[MAX_DPATH];
+ TCHAR cartfile[MAX_DPATH];
+ TCHAR cartident[256];
int cart_internal;
- char pci_devices[256];
- char prtname[256];
- char sername[256];
- char amaxromfile[MAX_DPATH];
+ TCHAR pci_devices[256];
+ TCHAR prtname[256];
+ TCHAR sername[256];
+ TCHAR amaxromfile[MAX_DPATH];
- char path_floppy[256];
- char path_hardfile[256];
- char path_rom[256];
+ TCHAR path_floppy[256];
+ TCHAR path_hardfile[256];
+ TCHAR path_rom[256];
int m68k_speed;
int cpu_model;
int nr_floppies;
int dfxtype[4];
int dfxclick[4];
- char dfxclickexternal[4][256];
+ TCHAR dfxclickexternal[4][256];
int dfxclickvolume;
/* Target specific options */
int win32_specialkey;
int win32_guikey;
int win32_kbledmode;
+ int win32_fscodepage;
int curses_reverse_video;
/* input */
- char inputname[256];
+ TCHAR inputname[256];
struct jport jports[2];
int input_selected_setting;
int input_joymouse_multiplier;
};
/* Contains the filename of .uaerc */
-extern char optionsfile[];
+extern TCHAR optionsfile[];
extern void save_options (struct zfile *, struct uae_prefs *, int);
-extern void cfgfile_write (struct zfile *, char *format,...);
-extern void cfgfile_dwrite (struct zfile *, char *format,...);
-extern void cfgfile_target_write (struct zfile *, char *format,...);
-extern void cfgfile_target_dwrite (struct zfile *, char *format,...);
-extern void cfgfile_backup (const char *path);
+extern void cfgfile_write (struct zfile *, TCHAR *format,...);
+extern void cfgfile_dwrite (struct zfile *, TCHAR *format,...);
+extern void cfgfile_target_write (struct zfile *, TCHAR *format,...);
+extern void cfgfile_target_dwrite (struct zfile *, TCHAR *format,...);
+extern void cfgfile_backup (const TCHAR *path);
extern struct uaedev_config_info *add_filesys_config (struct uae_prefs *p, int index,
- char *devname, char *volname, char *rootdir, int readonly,
+ TCHAR *devname, TCHAR *volname, TCHAR *rootdir, int readonly,
int secspertrack, int surfaces, int reserved,
- int blocksize, int bootpri, char *filesysdir, int hdc, int flags);
+ int blocksize, int bootpri, TCHAR *filesysdir, int hdc, int flags);
extern void default_prefs (struct uae_prefs *, int);
extern void discard_prefs (struct uae_prefs *, int);
-int parse_cmdline_option (struct uae_prefs *, char, char *);
+int parse_cmdline_option (struct uae_prefs *, TCHAR, const TCHAR *);
-extern int cfgfile_yesno (const char *option, const char *value, const char *name, int *location);
-extern int cfgfile_intval (const char *option, const char *value, const char *name, int *location, int scale);
-extern int cfgfile_strval (const char *option, const char *value, const char *name, int *location, const char *table[], int more);
-extern int cfgfile_string (const char *option, const char *value, const char *name, char *location, int maxsz);
-extern char *cfgfile_subst_path (const char *path, const char *subst, const char *file);
+extern int cfgfile_yesno (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location);
+extern int cfgfile_intval (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, int scale);
+extern int cfgfile_strval (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, const TCHAR *table[], int more);
+extern int cfgfile_string (const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz);
+extern TCHAR *cfgfile_subst_path (const TCHAR *path, const TCHAR *subst, const TCHAR *file);
-extern int target_parse_option (struct uae_prefs *, char *option, char *value);
+extern int target_parse_option (struct uae_prefs *, TCHAR *option, TCHAR *value);
extern void target_save_options (struct zfile*, struct uae_prefs *);
extern void target_default_options (struct uae_prefs *, int type);
extern void target_fixup_options (struct uae_prefs *);
-extern int target_cfgfile_load (struct uae_prefs *, char *filename, int type, int isdefault);
+extern int target_cfgfile_load (struct uae_prefs *, TCHAR *filename, int type, int isdefault);
extern void target_quit (void);
extern void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type);
-extern int cfgfile_load (struct uae_prefs *p, const char *filename, int *type, int ignorelink);
-extern int cfgfile_save (struct uae_prefs *p, const char *filename, int);
-extern void cfgfile_parse_line (struct uae_prefs *p, char *, int);
-extern int cfgfile_parse_option (struct uae_prefs *p, char *option, char *value, int);
-extern int cfgfile_get_description (const char *filename, char *description, char *hostlink, char *hardwarelink, int *type);
+extern int cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink);
+extern int cfgfile_save (struct uae_prefs *p, const TCHAR *filename, int);
+extern void cfgfile_parse_line (struct uae_prefs *p, TCHAR *, int);
+extern int cfgfile_parse_option (struct uae_prefs *p, TCHAR *option, TCHAR *value, int);
+extern int cfgfile_get_description (const TCHAR *filename, TCHAR *description, TCHAR *hostlink, TCHAR *hardwarelink, int *type);
extern void cfgfile_show_usage (void);
extern uae_u32 cfgfile_uaelib (int mode, uae_u32 name, uae_u32 dst, uae_u32 maxlen);
extern uae_u32 cfgfile_uaelib_modify (uae_u32 mode, uae_u32 parms, uae_u32 size, uae_u32 out, uae_u32 outsize);
-extern uae_u32 cfgfile_modify (uae_u32 index, char *parms, uae_u32 size, char *out, uae_u32 outsize);
-extern void cfgfile_addcfgparam (char *);
+extern uae_u32 cfgfile_modify (uae_u32 index, TCHAR *parms, uae_u32 size, TCHAR *out, uae_u32 outsize);
+extern void cfgfile_addcfgparam (TCHAR *);
extern int built_in_prefs (struct uae_prefs *p, int model, int config, int compa, int romcheck);
extern int built_in_chipset_prefs (struct uae_prefs *p);
-extern int cmdlineparser (char *s, char *outp[], int max);
+extern int cmdlineparser (TCHAR *s, TCHAR *outp[], int max);
extern int cfgfile_configuration_change(int);
extern void fixup_prefs_dimensions (struct uae_prefs *prefs);
extern void fixup_prefs (struct uae_prefs *prefs);
#define fuzzy_memset(p, c, o, l) fuzzy_memset_1 ((p), QUADRUPLIFY (c), (o) & ~3, ((l) + 4) >> 2)
STATIC_INLINE void fuzzy_memset_1 (void *p, uae_u32 c, int offset, int len)
{
- uae_u32 *p2 = (uae_u32 *)((char *)p + offset);
+ uae_u32 *p2 = (uae_u32 *)((TCHAR *)p + offset);
int a = len & 7;
len >>= 3;
switch (a) {
#define fuzzy_memset_le32(p, c, o, l) fuzzy_memset_le32_1 ((p), QUADRUPLIFY (c), (o) & ~3, ((l) + 7) >> 2)
STATIC_INLINE void fuzzy_memset_le32_1 (void *p, uae_u32 c, int offset, int len)
{
- uae_u32 *p2 = (uae_u32 *)((char *)p + offset);
+ uae_u32 *p2 = (uae_u32 *)((TCHAR *)p + offset);
switch (len) {
case 9: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; p2[6] = c; p2[7] = c; p2[8] = c; break;
extern struct mnemolookup {
instrmnem mnemo;
- const char *name;
- const char *friendlyname;
+ const TCHAR *name;
+ const TCHAR *friendlyname;
} lookuptab[];
ENUMDECL {
struct instr_def {
unsigned int bits;
int n_variable;
- char bitpos[16];
+ uae_u8 bitpos[16];
unsigned int mask;
int cpulevel;
int plevel;
unsigned int flaguse:3;
unsigned int flagset:3;
} flaginfo[5];
- unsigned char sduse;
- const char *opcstr;
+ uae_u8 sduse;
+ const TCHAR *opcstr;
};
extern struct instr_def defs68k[];
extern uae_u16 restore_u16_func (uae_u8 **);
extern uae_u8 restore_u8_func (uae_u8 **);
-extern void save_string_func (uae_u8 **, const char*);
-extern char *restore_string_func (uae_u8 **);
+extern void save_string_func (uae_u8 **, const TCHAR*);
+extern TCHAR *restore_string_func (uae_u8 **);
#define save_u64(x) save_u64_func (&dst, (x))
#define save_u32(x) save_u32_func (&dst, (x))
extern uae_u8 *restore_hrtmon (uae_u8 *);
extern uae_u8 *save_hrtmon (int *, uae_u8 *);
-extern void savestate_initsave (const char *filename, int docompress, int nodialogs);
-extern int save_state (const char *filename, const char *description);
-extern void restore_state (const char *filename);
+extern void savestate_initsave (const TCHAR *filename, int docompress, int nodialogs);
+extern int save_state (const TCHAR *filename, const TCHAR *description);
+extern void restore_state (const TCHAR *filename);
extern void savestate_restore_finish (void);
extern void custom_save_state (void);
#define STATE_DOREWIND 32
extern int savestate_state;
-extern char savestate_fname[MAX_DPATH];
+extern TCHAR savestate_fname[MAX_DPATH];
extern struct zfile *savestate_file;
extern void savestate_quick (int slot, int save);
#include <errno.h>
#include <assert.h>
#include <limits.h>
+#include <tchar.h>
#ifndef __STDC__
#ifndef _MSC_VER
/* If char has more then 8 bits, good night. */
typedef unsigned char uae_u8;
typedef signed char uae_s8;
+typedef unsigned char uae_char;
typedef struct { uae_u8 RGB[3]; } RGB;
#endif
#ifdef HAVE_STRDUP
-#define my_strdup strdup
+#define my_strdup _tcsdup
#else
-extern char *my_strdup (const char*s);
-#endif
-
-extern void *xmalloc(size_t);
-extern void *xcalloc(size_t, size_t);
-extern void xfree(const void*);
+extern TCHAR *my_strdup (const TCHAR*s);
+#endif
+extern TCHAR *my_strdup_ansi (const char*);
+extern TCHAR *au (const char*);
+extern char *ua (const TCHAR*);
+extern TCHAR *aucp (const char*, unsigned int cp);
+extern char *uacp (const TCHAR*, unsigned int cp);
+extern char *ua_copy (char *dst, int maxlen, const TCHAR *src);
+extern TCHAR *au_copy (TCHAR *dst, int maxlen, const char *src);
+extern char *uacp_copy (char *dst, int maxlen, const TCHAR *src, unsigned int cp);
+extern TCHAR *aucp_copy (TCHAR *dst, int maxlen, const char *src, unsigned int cp);
+
+extern void *xmalloc (size_t);
+extern void *xcalloc (size_t, size_t);
+extern void xfree (const void*);
/* We can only rely on GNU C getting enums right. Mickeysoft VSC++ is known
* to have problems, and it's likely that other compilers choke too. */
#define O_RDWR _O_RDWR
#define O_CREAT _O_CREAT
#define O_TRUNC _O_TRUNC
-#define strcasecmp _stricmp
-#define strncasecmp _strnicmp
+#define strcasecmp _tcsicmp
+#define strncasecmp _tcsncicmp
#define W_OK 0x2
#define R_OK 0x4
#define STAT struct stat
#define DIR struct DIR
struct direct
{
- char d_name[1];
+ TCHAR d_name[1];
};
#include <sys/utime.h>
#define utimbuf _utimbuf
#define S_IXUSR FILEFLAG_EXECUTE
/* These are prototypes for functions from the Win32 posixemu file */
-extern void get_time(time_t t, long* days, long* mins, long* ticks);
+extern void get_time (time_t t, long* days, long* mins, long* ticks);
extern time_t put_time (long days, long mins, long ticks);
-extern DWORD getattr(const char *name, LPFILETIME lpft, size_t *size);
+extern DWORD getattr (const TCHAR *name, LPFILETIME lpft, size_t *size);
/* #define DONT_HAVE_POSIX - don't need all of Mathias' posixemu_functions, just a subset (below) */
#define chmod(a,b) posixemu_chmod ((a), (b))
-extern int posixemu_chmod (const char *, int);
+extern int posixemu_chmod (const TCHAR *, int);
#define stat(a,b) posixemu_stat ((a), (b))
-extern int posixemu_stat (const char *, struct stat *);
+extern int posixemu_stat (const TCHAR *, struct stat *);
#define mkdir(x,y) mkdir(x)
#define truncate posixemu_truncate
-extern int posixemu_truncate (const char *, long int);
+extern int posixemu_truncate (const TCHAR *, long int);
#define utime posixemu_utime
-extern int posixemu_utime (const char *, struct utimbuf *);
+extern int posixemu_utime (const TCHAR *, struct utimbuf *);
#define opendir posixemu_opendir
-extern DIR * posixemu_opendir (const char *);
+extern DIR * posixemu_opendir (const TCHAR *);
#define readdir posixemu_readdir
extern struct dirent* posixemu_readdir (DIR *);
#define closedir posixemu_closedir
#ifdef DONT_HAVE_POSIX
#define access posixemu_access
-extern int posixemu_access (const char *, int);
+extern int posixemu_access (const TCHAR *, int);
#define open posixemu_open
-extern int posixemu_open (const char *, int, int);
+extern int posixemu_open (const TCHAR *, int, int);
#define close posixemu_close
extern void posixemu_close (int);
#define read posixemu_read
-extern int posixemu_read (int, char *, int);
+extern int posixemu_read (int, TCHAR *, int);
#define write posixemu_write
-extern int posixemu_write (int, const char *, int);
+extern int posixemu_write (int, const TCHAR *, int);
#undef lseek
#define lseek posixemu_seek
extern int posixemu_seek (int, int, int);
#define stat(a,b) posixemu_stat ((a), (b))
-extern int posixemu_stat (const char *, STAT *);
+extern int posixemu_stat (const TCHAR *, STAT *);
#define mkdir posixemu_mkdir
-extern int mkdir (const char *, int);
+extern int mkdir (const TCHAR *, int);
#define rmdir posixemu_rmdir
-extern int posixemu_rmdir (const char *);
+extern int posixemu_rmdir (const TCHAR *);
#define unlink posixemu_unlink
-extern int posixemu_unlink (const char *);
+extern int posixemu_unlink (const TCHAR *);
#define truncate posixemu_truncate
-extern int posixemu_truncate (const char *, long int);
+extern int posixemu_truncate (const TCHAR *, long int);
#define rename posixemu_rename
-extern int posixemu_rename (const char *, const char *);
+extern int posixemu_rename (const TCHAR *, const TCHAR *);
#define chmod posixemu_chmod
-extern int posixemu_chmod (const char *, int);
+extern int posixemu_chmod (const TCHAR *, int);
#define tmpnam posixemu_tmpnam
-extern void posixemu_tmpnam (char *);
+extern void posixemu_tmpnam (TCHAR *);
#define utime posixemu_utime
-extern int posixemu_utime (const char *, struct utimbuf *);
+extern int posixemu_utime (const TCHAR *, struct utimbuf *);
#define opendir posixemu_opendir
-extern DIR * posixemu_opendir (const char *);
+extern DIR * posixemu_opendir (const TCHAR *);
#define readdir posixemu_readdir
extern struct dirent* readdir (DIR *);
#define closedir posixemu_closedir
#ifdef DONT_HAVE_STDIO
-extern FILE *stdioemu_fopen (const char *, const char *);
+extern FILE *stdioemu_fopen (const TCHAR *, const TCHAR *);
#define fopen(a,b) stdioemu_fopen(a, b)
extern int stdioemu_fseek (FILE *, int, int);
#define fseek(a,b,c) stdioemu_fseek(a, b, c)
-extern int stdioemu_fread (char *, int, int, FILE *);
+extern int stdioemu_fread (TCHAR *, int, int, FILE *);
#define fread(a,b,c,d) stdioemu_fread(a, b, c, d)
-extern int stdioemu_fwrite (const char *, int, int, FILE *);
+extern int stdioemu_fwrite (const TCHAR *, int, int, FILE *);
#define fwrite(a,b,c,d) stdioemu_fwrite(a, b, c, d)
extern int stdioemu_ftell (FILE *);
#define ftell(a) stdioemu_ftell(a)
#endif
#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 6
-extern void write_log (const char *, ...) __attribute__ ((format (printf, 1, 2)));
+extern void write_log (const TCHAR *, ...) __attribute__ ((format (printf, 1, 2)));
#else
-extern void write_log (const char *, ...);
+extern void write_log (const TCHAR *, ...);
#endif
-extern void write_dlog (const char *, ...);
+extern void write_dlog (const TCHAR *, ...);
extern void flush_log (void);
extern void close_console (void);
extern void reopen_console (void);
-extern void console_out (const char *);
-extern void console_out_f (const char *, ...);
+extern void console_out (const TCHAR *);
+extern void console_out_f (const TCHAR *, ...);
extern void console_flush (void);
-extern int console_get (char *, int);
-extern void f_out (void *, const char *, ...);
-extern char* buf_out (char *buffer, int *bufsize, const char *format, ...);
-extern void gui_message (const char *,...);
-extern int gui_message_multibutton (int flags, const char *format,...);
+extern int console_get (TCHAR *, int);
+extern void f_out (void *, const TCHAR *, ...);
+extern TCHAR* buf_out (TCHAR *buffer, int *bufsize, const TCHAR *format, ...);
+extern void gui_message (const TCHAR *,...);
+extern int gui_message_multibutton (int flags, const TCHAR *format,...);
#define write_log_err write_log
-extern void logging_init(void);
-extern void *log_open(const char *name, int append, int bootlog);
-extern void log_close(void *f);
+extern void logging_init (void);
+extern void *log_open (const TCHAR *name, int append, int bootlog);
+extern void log_close (void *f);
#ifndef O_BINARY
*/
extern void REGPARAM3 m68k_handle_trap (unsigned int trap_num, struct regstruct *) REGPARAM;
-unsigned int define_trap (TrapHandler handler_func, int flags, const char *name);
-uaecptr find_trap (const char *name);
+unsigned int define_trap (TrapHandler handler_func, int flags, const TCHAR *name);
+uaecptr find_trap (const TCHAR *name);
/*
* Call a 68k Library function from an extended trap
extern void do_leave_program (void);
extern void start_program (void);
extern void leave_program (void);
-extern void real_main (int, char **);
+extern void real_main (int, TCHAR **);
extern void usage (void);
-extern void parse_cmdline (int argc, char **argv);
+extern void parse_cmdline (int argc, TCHAR **argv);
extern void sleep_millis (int ms);
extern void sleep_millis_busy (int ms);
extern int sleep_resolution;
extern void uae_reset (int);
extern void uae_quit (void);
-extern void uae_restart (int, char*);
+extern void uae_restart (int, TCHAR*);
extern void reset_all_systems (void);
extern void target_reset (void);
extern int quit_program;
-extern char warning_buffer[256];
-extern char start_path_data[];
-extern char start_path_data_exe[];
+extern TCHAR warning_buffer[256];
+extern TCHAR start_path_data[];
+extern TCHAR start_path_data_exe[];
/* This structure is used to define menus. The val field can hold key
* shortcuts, or one of these special codes:
* 0: Menu title
*/
struct bstring {
- const char *data;
+ const TCHAR *data;
int val;
};
-extern char *colormodes[];
-extern void fetch_saveimagepath (char*, int, int);
-extern void fetch_configurationpath (char *out, int size);
-extern void fetch_screenshotpath (char *out, int size);
-extern void fetch_ripperpath (char *out, int size);
-extern void fetch_datapath (char *out, int size);
+extern TCHAR *colormodes[];
+extern void fetch_saveimagepath (TCHAR*, int, int);
+extern void fetch_configurationpath (TCHAR *out, int size);
+extern void fetch_screenshotpath (TCHAR *out, int size);
+extern void fetch_ripperpath (TCHAR *out, int size);
+extern void fetch_datapath (TCHAR *out, int size);
extern int uaerand(void);
\ No newline at end of file
struct uae_xcmd {
struct uae_xcmd *prev, *next;
- char *cmd;
+ TCHAR *cmd;
};
#define UAEEXE_ORG 0xF0FF90 /* sam: I hope this slot is free */
#define UAEEXE_NOMEM 2
extern void uaeexe_install (void);
-extern int uaeexe (const char *cmd);
+extern int uaeexe (const TCHAR *cmd);
-#define COMPIPENAME "WinUAE_COM"
+#define COMPIPENAME L"WinUAE_COM"
-extern void *createIPC(const char *name, int);
-extern void closeIPC(void*);
-extern int checkIPC(void*,struct uae_prefs*);
-extern void *geteventhandleIPC(void*);
-extern int sendBinIPC(void*, uae_u8 *msg, int len);
-extern int sendIPC(void*, char *msg);
-extern int isIPC (const char *pipename);
+extern void *createIPC (const TCHAR *name, int);
+extern void closeIPC (void*);
+extern int checkIPC (void*,struct uae_prefs*);
+extern void *geteventhandleIPC (void*);
+extern int sendBinIPC (void*, uae_u8 *msg, int len);
+extern int sendIPC (void*, TCHAR *msg);
+extern int isIPC (const TCHAR *pipename);
struct zfile {
- char *name;
- char *zipname;
+ TCHAR *name;
+ TCHAR *zipname;
FILE *f;
uae_u8 *data;
- int size;
- int seek;
+ uae_u64 size;
+ uae_u64 seek;
int deleteafterclose;
struct zfile *next;
};
struct znode *next;
struct znode *prev;
struct znode *vfile; // points to real file when this node is virtual directory
- char *name;
- char *fullname;
- unsigned int size;
+ TCHAR *name;
+ TCHAR *fullname;
+ uae_u64 size;
struct zfile *f;
- char *comment;
+ TCHAR *comment;
int flags;
time_t mtime;
/* decompressor specific */
struct zvolume *next;
struct znode *last;
struct zvolume *parent;
- unsigned int size;
+ uae_u64 size;
unsigned int blocks;
unsigned int id;
- unsigned int archivesize;
+ uae_u64 archivesize;
unsigned int method;
};
struct zarchive_info
{
- const char *name;
- unsigned int size;
+ const TCHAR *name;
+ uae_u64 size;
int flags;
- char *comment;
+ TCHAR *comment;
time_t t;
};
#define ArchiveFormatPLAIN '----'
#define ArchiveFormatAA 'aa ' // method only
-extern int zfile_is_ignore_ext(const char *name);
+extern int zfile_is_ignore_ext(const TCHAR *name);
extern struct zvolume *zvolume_alloc(struct zfile *z, unsigned int id, void *handle);
-extern struct zvolume *zvolume_alloc_empty(const char *name);
+extern struct zvolume *zvolume_alloc_empty(const TCHAR *name);
extern struct znode *zvolume_addfile_abs(struct zvolume *zv, struct zarchive_info*);
extern struct znode *zvolume_adddir_abs(struct zvolume *zv, struct zarchive_info *zai);
-extern struct znode *znode_adddir(struct znode *parent, const char *name, struct zarchive_info*);
+extern struct znode *znode_adddir(struct znode *parent, const TCHAR *name, struct zarchive_info*);
extern struct zvolume *archive_directory_plain(struct zfile *zf);
extern struct zfile *archive_access_plain (struct znode *zn);
typedef int (*zfile_callback)(struct zfile*, void*);
-extern struct zfile *zfile_fopen (const char *, const char *);
-extern struct zfile *zfile_fopen_nozip (const char *, const char *);
-extern struct zfile *zfile_fopen_empty (const char *name, int size);
-extern struct zfile *zfile_fopen_data (const char *name, int size, uae_u8 *data);
-extern int zfile_exists (const char *name);
+extern struct zfile *zfile_fopen (const TCHAR *, const TCHAR *);
+extern struct zfile *zfile_fopen_nozip (const TCHAR *, const TCHAR *);
+extern struct zfile *zfile_fopen_empty (const TCHAR *name, uae_u64 size);
+extern struct zfile *zfile_fopen_data (const TCHAR *name, uae_u64 size, uae_u8 *data);
+extern int zfile_exists (const TCHAR *name);
extern void zfile_fclose (struct zfile *);
-extern int zfile_fseek (struct zfile *z, long offset, int mode);
-extern long zfile_ftell (struct zfile *z);
+extern uae_s64 zfile_fseek (struct zfile *z, uae_s64 offset, int mode);
+extern uae_s64 zfile_ftell (struct zfile *z);
extern size_t zfile_fread (void *b, size_t l1, size_t l2, struct zfile *z);
extern size_t zfile_fwrite (void *b, size_t l1, size_t l2, struct zfile *z);
-extern char *zfile_fgets(char *s, int size, struct zfile *z);
-extern size_t zfile_fputs (struct zfile *z, char *s);
+extern TCHAR *zfile_fgets(TCHAR *s, int size, struct zfile *z);
+extern size_t zfile_fputs (struct zfile *z, TCHAR *s);
extern int zfile_getc (struct zfile *z);
extern int zfile_putc (int c, struct zfile *z);
extern int zfile_ferror (struct zfile *z);
-extern char *zfile_getdata (struct zfile *z, int offset, int len);
+extern uae_u8 *zfile_getdata (struct zfile *z, uae_s64 offset, int len);
extern void zfile_exit (void);
-extern int execute_command (char *);
+extern int execute_command (TCHAR *);
extern int zfile_iscompressed (struct zfile *z);
extern int zfile_zcompress (struct zfile *dst, void *src, int size);
extern int zfile_zuncompress (void *dst, int dstsize, struct zfile *src, int srcsize);
extern int zfile_gettype (struct zfile *z);
-extern int zfile_zopen (const char *name, zfile_callback zc, void *user);
-extern char *zfile_getname (struct zfile *f);
+extern int zfile_zopen (const TCHAR *name, zfile_callback zc, void *user);
+extern TCHAR *zfile_getname (struct zfile *f);
extern uae_u32 zfile_crc32 (struct zfile *f);
extern struct zfile *zfile_dup (struct zfile *f);
extern struct zfile *zfile_gunzip (struct zfile *z);
-extern int zfile_isdiskimage (const char *name);
+extern int zfile_isdiskimage (const TCHAR *name);
extern int iszip (struct zfile *z);
#define ZFILE_UNKNOWN 0
#define ZFILE_NVR 7
#define ZFILE_HDFRDB 8
-extern const char *uae_archive_extensions[];
-extern const char *uae_ignoreextensions[];
-extern const char *uae_diskimageextensions[];
+extern const TCHAR *uae_archive_extensions[];
+extern const TCHAR *uae_ignoreextensions[];
+extern const TCHAR *uae_diskimageextensions[];
-extern struct zvolume *zfile_fopen_archive(const char *filename);
+extern struct zvolume *zfile_fopen_archive(const TCHAR *filename);
extern void zfile_fclose_archive(struct zvolume *zv);
-extern int zfile_fs_usage_archive(const char *path, const char *disk, struct fs_usage *fsp);
-extern int zfile_stat_archive(const char *path, struct stat *statbuf);
-extern void *zfile_opendir_archive(const char *path);
+extern int zfile_fs_usage_archive(const TCHAR *path, const TCHAR *disk, struct fs_usage *fsp);
+extern int zfile_stat_archive(const TCHAR *path, struct _stat64 *statbuf);
+extern void *zfile_opendir_archive(const TCHAR *path);
extern void zfile_closedir_archive(void*);
-extern int zfile_readdir_archive(void*, char*);
-extern zfile_fill_file_attrs_archive(const char *path, int *isdir, int *flags, char **comment);
-extern unsigned int zfile_lseek_archive (void *d, unsigned int offset, int whence);
+extern int zfile_readdir_archive(void*, TCHAR*);
+extern zfile_fill_file_attrs_archive(const TCHAR *path, int *isdir, int *flags, TCHAR **comment);
+extern uae_s64 zfile_lseek_archive (void *d, uae_s64 offset, int whence);
extern unsigned int zfile_read_archive (void *d, void *b, unsigned int size);
extern void zfile_close_archive (void *d);
-extern void *zfile_open_archive (const char *path, int flags);
-extern int zfile_exists_archive(const char *path, const char *rel);
+extern void *zfile_open_archive (const TCHAR *path, int flags);
+extern int zfile_exists_archive(const TCHAR *path, const TCHAR *rel);
#define DIR_DOWN 8
struct inputevent {
- const char *confname;
- const char *name;
+ const TCHAR *confname;
+ const TCHAR *name;
int allow_mask;
int type;
int unit;
/* event flags */
#define ID_FLAG_AUTOFIRE 1
-#define DEFEVENT(A, B, C, D, E, F) {#A, B, C, D, E, F },
+#define DEFEVENT(A, B, C, D, E, F) {L#A, B, C, D, E, F },
struct inputevent events[] = {
{0, 0, AM_K,0,0,0},
#include "inputevents.def"
static uae_u32 oldbuttons[4];
static uae_u16 oldjoy[2];
-int inprec_open(char *fname, int record)
+int inprec_open (TCHAR *fname, int record)
{
uae_u32 t = (uae_u32)time(0);
int i;
inprec_close();
- inprec_zf = zfile_fopen(fname, record > 0 ? "wb" : "rb");
+ inprec_zf = zfile_fopen (fname, record > 0 ? L"wb" : L"rb");
if (inprec_zf == NULL)
return 0;
inprec_size = 10000;
inprec_plastptr = inprec_buffer;
id = inprec_pu32();
if (id != 'UAE\0') {
- inprec_close();
+ inprec_close ();
return 0;
}
inprec_pu32();
- t = inprec_pu32();
- i = inprec_pu32();
+ t = inprec_pu32 ();
+ i = inprec_pu32 ();
while (i-- > 0)
- inprec_pu8();
+ inprec_pu8 ();
inprec_p = inprec_plastptr;
oldbuttons[0] = oldbuttons[1] = oldbuttons[2] = oldbuttons[3] = 0;
oldjoy[0] = oldjoy[1] = 0;
if (record < -1)
inprec_div = maxvpos;
} else if (record > 0) {
- inprec_buffer = inprec_p = (uae_u8*)xmalloc (inprec_size);
- inprec_ru32('UAE\0');
- inprec_ru8(1);
- inprec_ru8(UAEMAJOR);
- inprec_ru8(UAEMINOR);
- inprec_ru8(UAESUBREV);
- inprec_ru32(t);
- inprec_ru32(0); // extra header size
+ inprec_buffer = inprec_p = xmalloc (inprec_size);
+ inprec_ru32 ('UAE\0');
+ inprec_ru8 (1);
+ inprec_ru8 (UAEMAJOR);
+ inprec_ru8 (UAEMINOR);
+ inprec_ru8 (UAESUBREV);
+ inprec_ru32 (t);
+ inprec_ru32 (0); // extra header size
} else {
return 0;
}
input_recording = record;
srand(t);
- CIA_inprec_prepare();
- write_log ("inprec initialized '%s', mode=%d\n", fname, input_recording);
+ CIA_inprec_prepare ();
+ write_log (L"inprec initialized '%s', mode=%d\n", fname, input_recording);
return 1;
}
xfree (inprec_buffer);
inprec_buffer = NULL;
input_recording = 0;
- write_log ("inprec finished\n");
+ write_log (L"inprec finished\n");
}
void inprec_ru8(uae_u8 v)
{
*inprec_p++= v;
}
-void inprec_ru16(uae_u16 v)
+void inprec_ru16 (uae_u16 v)
{
- inprec_ru8((uae_u8)(v >> 8));
- inprec_ru8((uae_u8)v);
+ inprec_ru8 ((uae_u8)(v >> 8));
+ inprec_ru8 ((uae_u8)v);
}
-void inprec_ru32(uae_u32 v)
+void inprec_ru32 (uae_u32 v)
{
- inprec_ru16((uae_u16)(v >> 16));
- inprec_ru16((uae_u16)v);
+ inprec_ru16 ((uae_u16)(v >> 16));
+ inprec_ru16 ((uae_u16)v);
}
-void inprec_rstr(const char *s)
+void inprec_rstr (const TCHAR *src)
{
+ char *s = ua (src);
while(*s) {
- inprec_ru8(*s);
+ inprec_ru8 (*s);
s++;
}
- inprec_ru8(0);
+ inprec_ru8 (0);
+ xfree (s);
}
-void inprec_rstart(uae_u8 type)
+void inprec_rstart (uae_u8 type)
{
- write_log ("INPREC: %08X: %d\n", hsync_counter, type);
- inprec_ru32(hsync_counter);
- inprec_ru8(0);
+ write_log (L"INPREC: %08X: %d\n", hsync_counter, type);
+ inprec_ru32 (hsync_counter);
+ inprec_ru8 (0);
inprec_plast = inprec_p;
- inprec_ru8(0xff);
- inprec_ru8(type);
+ inprec_ru8 (0xff);
+ inprec_ru8 (type);
}
-void inprec_rend(void)
+void inprec_rend (void)
{
*inprec_plast = inprec_p - (inprec_plast + 2);
if (inprec_p >= inprec_buffer + inprec_size - 256) {
}
}
-int inprec_pstart(uae_u8 type)
+int inprec_pstart (uae_u8 type)
{
uae_u8 *p = inprec_p;
uae_u32 hc = hsync_counter;
if (savestate_state)
return 0;
if (p[5 + 1] == INPREC_END) {
- inprec_close();
+ inprec_close ();
return 0;
}
hc_orig = hc;
for (;;) {
uae_u32 hc2 = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
if (p > lastp) {
- write_log ("INPREC: Next %08x (%08x=%d): %d (%d)\n", hc2, hc, hc2 - hc, p[5 + 1], p[5]);
+ write_log (L"INPREC: Next %08x (%08x=%d): %d (%d)\n", hc2, hc, hc2 - hc, p[5 + 1], p[5]);
lastp = p;
}
hc2_orig = hc2;
hc2 /= inprec_div;
hc2 *= inprec_div;
if (hc > hc2) {
- write_log ("INPREC: %08x > %08x: %d (%d) missed!\n", hc, hc2, p[5 + 1], p[5]);
- inprec_close();
+ write_log (L"INPREC: %08x > %08x: %d (%d) missed!\n", hc, hc2, p[5 + 1], p[5]);
+ inprec_close ();
return 0;
}
if (hc2 != hc) {
break;
}
if (p[5 + 1] == type) {
- write_log ("INPREC: %08x: %d (%d) (%+d)\n", hc, type, p[5], hc_orig - hc2_orig);
+ write_log (L"INPREC: %08x: %d (%d) (%+d)\n", hc, type, p[5], hc_orig - hc2_orig);
inprec_plast = p;
inprec_plastptr = p + 5 + 2;
return 1;
inprec_plast = NULL;
return 0;
}
-void inprec_pend(void)
+void inprec_pend (void)
{
uae_u8 *p = inprec_p;
uae_u32 hc = hsync_counter;
}
inprec_p = p;
if (p[5 + 1] == INPREC_END)
- inprec_close();
+ inprec_close ();
}
-uae_u8 inprec_pu8(void)
+uae_u8 inprec_pu8 (void)
{
return *inprec_plastptr++;
}
-uae_u16 inprec_pu16(void)
+uae_u16 inprec_pu16 (void)
{
- uae_u16 v = inprec_pu8() << 8;
- v |= inprec_pu8();
+ uae_u16 v = inprec_pu8 () << 8;
+ v |= inprec_pu8 ();
return v;
}
-uae_u32 inprec_pu32(void)
+uae_u32 inprec_pu32 (void)
{
- uae_u32 v = inprec_pu16() << 16;
- v |= inprec_pu16();
+ uae_u32 v = inprec_pu16 () << 16;
+ v |= inprec_pu16 ();
return v;
}
-int inprec_pstr(char *s)
+int inprec_pstr (TCHAR *dst)
{
+ char tmp[MAX_DPATH];
+ char *s;
int len = 0;
+
+ s = tmp;
for(;;) {
- uae_u8 v = inprec_pu8();
+ uae_u8 v = inprec_pu8 ();
*s++ = v;
if (!v)
break;
len++;
}
+ au_copy (dst, MAX_DPATH, tmp);
return len;
}
return 0;
}
-int inputdevice_uaelib (char *s, char *parm)
+int inputdevice_uaelib (TCHAR *s, TCHAR *parm)
{
int i;
for (i = 1; events[i].name; i++) {
- if (!strcmp (s, events[i].confname)) {
- handle_input_event (i, atol (parm), 1, 0);
+ if (!_tcscmp (s, events[i].confname)) {
+ handle_input_event (i, _tstol (parm), 1, 0);
return 1;
}
}
static void copyjport (const struct uae_prefs *src, struct uae_prefs *dst, int num)
{
freejport (dst, num);
- strcpy (dst->jports[num].configname, src->jports[num].configname);
- strcpy (dst->jports[num].name, src->jports[num].name);
+ _tcscpy (dst->jports[num].configname, src->jports[num].configname);
+ _tcscpy (dst->jports[num].name, src->jports[num].name);
dst->jports[num].id = src->jports[num].id;
}
-static void out_config (struct zfile *f, int id, int num, char *s1, char *s2)
+static void out_config (struct zfile *f, int id, int num, TCHAR *s1, TCHAR *s2)
{
- cfgfile_write (f, "input.%d.%s%d=%s\n", id, s1, num, s2);
+ cfgfile_write (f, L"input.%d.%s%d=%s\n", id, s1, num, s2);
}
-static void write_config2 (struct zfile *f, int idnum, int i, int offset, char *tmp1, struct uae_input_device *id)
+static void write_config2 (struct zfile *f, int idnum, int i, int offset, TCHAR *tmp1, struct uae_input_device *id)
{
- char tmp2[200], *p;
+ TCHAR tmp2[200], *p;
int evt, got, j, k;
- char *custom;
+ TCHAR *custom;
p = tmp2;
got = 0;
*p = 0;
}
if (custom)
- sprintf (p, "'%s'.%d", custom, id->flags[i + offset][j] & 0xff);
+ _stprintf (p, L"'%s'.%d", custom, id->flags[i + offset][j] & 0xff);
else if (evt <= 0)
- sprintf (p, "NULL");
+ _stprintf (p, L"NULL");
else
- sprintf (p, "%s.%d", events[evt].confname, id->flags[i + offset][j]);
- p += strlen (p);
+ _stprintf (p, L"%s.%d", events[evt].confname, id->flags[i + offset][j]);
+ p += _tcslen (p);
}
if (p > tmp2)
- cfgfile_write (f, "input.%d.%s%d=%s\n", idnum, tmp1, i, tmp2);
+ cfgfile_write (f, L"input.%d.%s%d=%s\n", idnum, tmp1, i, tmp2);
}
static struct inputdevice_functions *getidf (int devnum);
-static void write_config (struct zfile *f, int idnum, int devnum, char *name, struct uae_input_device *id, struct uae_input_device2 *id2, struct inputdevice_functions *idf)
+static void write_config (struct zfile *f, int idnum, int devnum, TCHAR *name, struct uae_input_device *id, struct uae_input_device2 *id2, struct inputdevice_functions *idf)
{
- char tmp1[MAX_DPATH], *s;
+ TCHAR tmp1[MAX_DPATH], *s;
int i;
if (!isdevice (id)) {
- cfgfile_write (f, "input.%d.%s.%d.empty=true\n", idnum, name, devnum);
+ cfgfile_write (f, L"input.%d.%s.%d.empty=true\n", idnum, name, devnum);
if (id->enabled)
- cfgfile_write (f, "input.%d.%s.%d.disabled=%d\n", idnum, name, devnum, id->enabled ? 0 : 1);
+ cfgfile_write (f, L"input.%d.%s.%d.disabled=%d\n", idnum, name, devnum, id->enabled ? 0 : 1);
return;
}
- cfgfile_write (f, "input.%d.%s.%d.empty=false\n", idnum, name, devnum);
- cfgfile_write (f, "input.%d.%s.%d.disabled=%d\n", idnum, name, devnum, id->enabled ? 0 : 1);
+ cfgfile_write (f, L"input.%d.%s.%d.empty=false\n", idnum, name, devnum);
+ cfgfile_write (f, L"input.%d.%s.%d.disabled=%d\n", idnum, name, devnum, id->enabled ? 0 : 1);
s = NULL;
if (id->name)
else if (devnum < idf->get_num ())
s = idf->get_friendlyname (devnum);
if (s)
- cfgfile_write (f, "input.%d.%s.%d.friendlyname=%s\n", idnum, name, devnum, s);
+ cfgfile_write (f, L"input.%d.%s.%d.friendlyname=%s\n", idnum, name, devnum, s);
s = NULL;
if (id->configname)
else if (devnum < idf->get_num ())
s = idf->get_uniquename (devnum);
if (s)
- cfgfile_write (f, "input.%d.%s.%d.name=%s\n", idnum, name, devnum, s);
+ cfgfile_write (f, L"input.%d.%s.%d.name=%s\n", idnum, name, devnum, s);
- sprintf (tmp1, "%s.%d.axis.", name, devnum);
+ _stprintf (tmp1, L"%s.%d.axis.", name, devnum);
for (i = 0; i < ID_AXIS_TOTAL; i++)
write_config2 (f, idnum, i, ID_AXIS_OFFSET, tmp1, id);
- sprintf (tmp1, "%s.%d.button." ,name, devnum);
+ _stprintf (tmp1, L"%s.%d.button." ,name, devnum);
for (i = 0; i < ID_BUTTON_TOTAL; i++)
write_config2 (f, idnum, i, ID_BUTTON_OFFSET, tmp1, id);
}
-static void kbrlabel (char *s)
+static void kbrlabel (TCHAR *s)
{
while (*s) {
*s = toupper(*s);
static void write_kbr_config (struct zfile *f, int idnum, int devnum, struct uae_input_device *kbr, struct inputdevice_functions *idf)
{
- char tmp1[200], tmp2[200], tmp3[200], *p;
+ TCHAR tmp1[200], tmp2[200], tmp3[200], *p;
int i, j, k, evt, skip;
if (!keyboard_default)
p = tmp2;
p[0] = 0;
for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) {
- char *custom = kbr->custom[i][j];
+ TCHAR *custom = kbr->custom[i][j];
evt = kbr->eventid[i][j];
if (custom == NULL && evt <= 0) {
for (k = j + 1; k < MAX_INPUT_SUB_EVENT; k++) {
*p = 0;
}
if (custom)
- sprintf (p, "'%s'.%d", custom, kbr->flags[i][j] & 0xff);
+ _stprintf (p, L"'%s'.%d", custom, kbr->flags[i][j] & 0xff);
else if (evt > 0)
- sprintf (p, "%s.%d", events[evt].confname, kbr->flags[i][j]);
+ _stprintf (p, L"%s.%d", events[evt].confname, kbr->flags[i][j]);
else
- strcat (p, "NULL");
- p += strlen(p);
+ _tcscat (p, L"NULL");
+ p += _tcslen(p);
}
- sprintf (tmp3, "%d", kbr->extra[i][0]);
+ _stprintf (tmp3, L"%d", kbr->extra[i][0]);
kbrlabel (tmp3);
- sprintf (tmp1, "keyboard.%d.button.%s", devnum, tmp3);
- cfgfile_write (f, "input.%d.%s=%s\n", idnum, tmp1, tmp2[0] ? tmp2 : "NULL");
+ _stprintf (tmp1, L"keyboard.%d.button.%s", devnum, tmp3);
+ cfgfile_write (f, L"input.%d.%s=%s\n", idnum, tmp1, tmp2[0] ? tmp2 : L"NULL");
i++;
}
}
{
int i, id;
- cfgfile_write (f, "input.config=%d\n", p->input_selected_setting);
- cfgfile_write (f, "input.joymouse_speed_analog=%d\n", p->input_joymouse_multiplier);
- cfgfile_write (f, "input.joymouse_speed_digital=%d\n", p->input_joymouse_speed);
- cfgfile_write (f, "input.joymouse_deadzone=%d\n", p->input_joymouse_deadzone);
- cfgfile_write (f, "input.joystick_deadzone=%d\n", p->input_joystick_deadzone);
- cfgfile_write (f, "input.analog_joystick_multiplier=%d\n", p->input_analog_joystick_mult);
- cfgfile_write (f, "input.analog_joystick_offset=%d\n", p->input_analog_joystick_offset);
- cfgfile_write (f, "input.mouse_speed=%d\n", p->input_mouse_speed);
- cfgfile_write (f, "input.autofire=%d\n", p->input_autofire_framecnt);
+ cfgfile_write (f, L"input.config=%d\n", p->input_selected_setting);
+ cfgfile_write (f, L"input.joymouse_speed_analog=%d\n", p->input_joymouse_multiplier);
+ cfgfile_write (f, L"input.joymouse_speed_digital=%d\n", p->input_joymouse_speed);
+ cfgfile_write (f, L"input.joymouse_deadzone=%d\n", p->input_joymouse_deadzone);
+ cfgfile_write (f, L"input.joystick_deadzone=%d\n", p->input_joystick_deadzone);
+ cfgfile_write (f, L"input.analog_joystick_multiplier=%d\n", p->input_analog_joystick_mult);
+ cfgfile_write (f, L"input.analog_joystick_offset=%d\n", p->input_analog_joystick_offset);
+ cfgfile_write (f, L"input.mouse_speed=%d\n", p->input_mouse_speed);
+ cfgfile_write (f, L"input.autofire=%d\n", p->input_autofire_framecnt);
for (id = 1; id <= MAX_INPUT_SETTINGS; id++) {
for (i = 0; i < MAX_INPUT_DEVICES; i++)
- write_config (f, id, i, "joystick", &p->joystick_settings[id][i], &joysticks2[i], &idev[IDTYPE_JOYSTICK]);
+ write_config (f, id, i, L"joystick", &p->joystick_settings[id][i], &joysticks2[i], &idev[IDTYPE_JOYSTICK]);
for (i = 0; i < MAX_INPUT_DEVICES; i++)
- write_config (f, id, i, "mouse", &p->mouse_settings[id][i], &mice2[i], &idev[IDTYPE_MOUSE]);
+ write_config (f, id, i, L"mouse", &p->mouse_settings[id][i], &mice2[i], &idev[IDTYPE_MOUSE]);
for (i = 0; i < MAX_INPUT_DEVICES; i++)
write_kbr_config (f, id, i, &p->keyboard_settings[id][i], &idev[IDTYPE_KEYBOARD]);
}
}
-static int getnum (const char **pp)
+static int getnum (const TCHAR **pp)
{
- const char *p = *pp;
- int v = atol (p);
+ const TCHAR *p = *pp;
+ int v = _tstol (p);
while (*p != 0 && *p !='.' && *p != ',') p++;
if (*p == '.' || *p == ',') p++;
*pp = p;
return v;
}
-static char *getstring (const char **pp)
+static TCHAR *getstring (const TCHAR **pp)
{
int i;
- static char str[1000];
- const char *p = *pp;
+ static TCHAR str[1000];
+ const TCHAR *p = *pp;
if (*p == 0)
return 0;
memset (id, 0, sizeof (struct uae_input_device));
}
-void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value)
+void read_inputdevice_config (struct uae_prefs *pr, TCHAR *option, TCHAR *value)
{
struct uae_input_device *id = 0;
struct inputevent *ie;
int devnum, num, button, joystick, flags, i, subnum, idnum, keynum;
int mask;
- char *p, *p2, *custom;
+ TCHAR *p, *p2, *custom;
option += 6; /* "input." */
p = getstring (&option);
- if (!strcasecmp (p, "config"))
- pr->input_selected_setting = atol (value);
- if (!strcasecmp (p, "joymouse_speed_analog"))
- pr->input_joymouse_multiplier = atol (value);
- if (!strcasecmp (p, "joymouse_speed_digital"))
- pr->input_joymouse_speed = atol (value);
- if (!strcasecmp (p, "joystick_deadzone"))
- pr->input_joystick_deadzone = atol (value);
- if (!strcasecmp (p, "joymouse_deadzone"))
- pr->input_joymouse_deadzone = atol (value);
- if (!strcasecmp (p, "mouse_speed"))
- pr->input_mouse_speed = atol (value);
- if (!strcasecmp (p, "autofire"))
- pr->input_autofire_framecnt = atol (value);
- if (!strcasecmp (p, "analog_joystick_multiplier"))
- pr->input_analog_joystick_mult = atol (value);
- if (!strcasecmp (p, "analog_joystick_offset"))
- pr->input_analog_joystick_offset = atol (value);
-
- idnum = atol (p);
+ if (!strcasecmp (p, L"config"))
+ pr->input_selected_setting = _tstol (value);
+ if (!strcasecmp (p, L"joymouse_speed_analog"))
+ pr->input_joymouse_multiplier = _tstol (value);
+ if (!strcasecmp (p, L"joymouse_speed_digital"))
+ pr->input_joymouse_speed = _tstol (value);
+ if (!strcasecmp (p, L"joystick_deadzone"))
+ pr->input_joystick_deadzone = _tstol (value);
+ if (!strcasecmp (p, L"joymouse_deadzone"))
+ pr->input_joymouse_deadzone = _tstol (value);
+ if (!strcasecmp (p, L"mouse_speed"))
+ pr->input_mouse_speed = _tstol (value);
+ if (!strcasecmp (p, L"autofire"))
+ pr->input_autofire_framecnt = _tstol (value);
+ if (!strcasecmp (p, L"analog_joystick_multiplier"))
+ pr->input_analog_joystick_mult = _tstol (value);
+ if (!strcasecmp (p, L"analog_joystick_offset"))
+ pr->input_analog_joystick_offset = _tstol (value);
+
+ idnum = _tstol (p);
if (idnum <= 0 || idnum > MAX_INPUT_SETTINGS)
return;
- if (memcmp (option, "mouse.", 6) == 0) {
+ if (_tcsncmp (option, L"mouse.", 6) == 0) {
p = option + 6;
- } else if (memcmp (option, "joystick.", 9) == 0) {
+ } else if (_tcsncmp (option, L"joystick.", 9) == 0) {
p = option + 9;
- } else if (memcmp (option, "keyboard.", 9) == 0) {
+ } else if (_tcsncmp (option, L"keyboard.", 9) == 0) {
p = option + 9;
} else
return;
if (!p2)
return;
- if (memcmp (option, "mouse.", 6) == 0) {
+ if (_tcsncmp (option, L"mouse.", 6) == 0) {
id = &pr->mouse_settings[idnum][devnum];
joystick = 0;
- } else if (memcmp (option, "joystick.", 9) == 0) {
+ } else if (_tcsncmp (option, L"joystick.", 9) == 0) {
id = &pr->joystick_settings[idnum][devnum];
joystick = 1;
- } else if (memcmp (option, "keyboard.", 9) == 0) {
+ } else if (_tcsncmp (option, L"keyboard.", 9) == 0) {
id = &pr->keyboard_settings[idnum][devnum];
joystick = -1;
}
if (!id)
return;
- if (!strcmp (p2, "name")) {
+ if (!_tcscmp (p2, L"name")) {
xfree (id->configname);
id->configname = my_strdup (value);
return;
}
- if (!strcmp (p2, "friendlyname")) {
+ if (!_tcscmp (p2, L"friendlyname")) {
xfree (id->name);
id->name = my_strdup (value);
return;
}
- if (!strcmp (p2, "empty")) {
+ if (!_tcscmp (p2, L"empty")) {
clear_id (id);
id->enabled = 1;
return;
}
- if (!strcmp (p2, "disabled")) {
+ if (!_tcscmp (p2, L"disabled")) {
int disabled;
p = value;
disabled = getnum (&p);
return;
} else {
button = -1;
- if (!strcmp (p2, "axis"))
+ if (!_tcscmp (p2, L"axis"))
button = 0;
- else if(!strcmp (p2, "button"))
+ else if(!_tcscmp (p2, L"button"))
button = 1;
if (button < 0)
return;
break;
i = 1;
while (events[i].name) {
- if (!strcmp (events[i].confname, p2))
+ if (!_tcscmp (events[i].confname, p2))
break;
i++;
}
ie = &events[i];
if (!ie->name) {
ie = &events[0];
- if (strlen (p2) > 2 && p2[0] == '\'' && p2[strlen (p2) - 1] == '\'') {
+ if (_tcslen (p2) > 2 && p2[0] == '\'' && p2[_tcslen (p2) - 1] == '\'') {
custom = my_strdup (p2 + 1);
- custom[strlen (custom) - 1] = 0;
+ custom[_tcslen (custom) - 1] = 0;
}
}
flags = 0;
if (p[-1] == '.')
flags = getnum (&p);
if (custom == NULL && ie->name == NULL) {
- if (!strcmp(p2, "NULL")) {
+ if (!_tcscmp(p2, L"NULL")) {
if (joystick < 0) {
id->eventid[keynum][subnum] = 0;
id->flags[keynum][subnum] = 0;
return mousehack_alive_cnt > 0 ? mousehack_alive_cnt : 0;
}
-static uaecptr get_base (const char *name)
+static uaecptr get_base (const TCHAR *name)
{
uaecptr v = get_long (4);
addrbank *b = &get_mem_bank(v);
if (b->flags != ABFLAG_ROM && b->flags != ABFLAG_RAM)
return 0;
p = b->xlateaddr(v2);
- if (!memcmp(p, name, strlen(name) + 1))
+ if (!memcmp (p, name, _tcslen (name) + 1))
return v;
}
return 0;
return 0;
if (magicmouse_ibase)
return magicmouse_ibase;
- magicmouse_ibase = get_base ("intuition.library");
+ magicmouse_ibase = get_base (L"intuition.library");
return magicmouse_ibase;
}
static uaecptr get_gfxbase (void)
return 0;
if (magicmouse_gfxbase)
return magicmouse_gfxbase;
- magicmouse_gfxbase = get_base ("graphics.library");
+ magicmouse_gfxbase = get_base (L"graphics.library");
return magicmouse_gfxbase;
}
mode |= 1;
if (inputdevice_is_tablet () > 0)
mode |= 2;
- write_log ("Tablet driver enabled (%s)\n", ((mode & 3) == 3 ? "tablet+mousehack" : ((mode & 3) == 2) ? "tablet" : "mousehack"));
+ write_log (L"Tablet driver enabled (%s)\n", ((mode & 3) == 3 ? "tablet+mousehack" : ((mode & 3) == 2) ? "tablet" : "mousehack"));
rtarea[off + MH_E] = 0x80;
}
{
mouseoffset_x = (uae_s16)get_word (pointerprefs + 28);
mouseoffset_y = (uae_s16)get_word (pointerprefs + 30);
- write_log ("MO: %dx%d\n", mouseoffset_x, mouseoffset_y);
}
void input_mousehack_status (int mode, uaecptr diminfo, uaecptr dispinfo, uaecptr vp, uae_u32 moffset)
uae_u8 v = rtarea[12 + get_long (rtarea_base + 36)];
v |= 0x40;
rtarea[12 + get_long (rtarea_base + 36)] = v;
- write_log ("Tablet driver running (%02x)\n", v);
+ write_log (L"Tablet driver running (%02x)\n", v);
} else if (mode == 1) {
int x1 = -1, y1 = -1, x2 = -1, y2 = -1;
uae_u32 props = 0;
if (dispinfo)
props = get_long (dispinfo + 18);
dimensioninfo_dbl = (props & 0x00020000) ? 1 : 0;
- write_log ("%08x %08x %08x (%dx%d)-(%dx%d) d=%dx%d %s\n",
+ write_log (L"%08x %08x %08x (%dx%d)-(%dx%d) d=%dx%d %s\n",
diminfo, props, vp, x1, y1, x2, y2, vp_xoffset, vp_yoffset,
(props & 0x00020000) ? "dbl" : "");
} else if (mode == 2) {
mousehack_enable ();
if (inputdevice_is_tablet () <= 0)
return;
- //write_log ("%d %d %d %d %08X %d %d %d %d\n", x, y, z, pressure, buttonbits, inproximity, ax, ay, az);
+ //write_log (L"%d %d %d %d %08X %d %d %d %d\n", x, y, z, pressure, buttonbits, inproximity, ax, ay, az);
off = 12 + get_long (rtarea_base + 36);
p = rtarea + off;
uaecptr gb = get_intuitionbase ();
maxy = get_word (gb + 1344 + 2);
maxx = get_word (gb + 1348 + 2);
- write_log ("%d %d\n", maxx, maxy);
+ write_log (L"%d %d\n", maxx, maxy);
}
#endif
#if 1
h = get_word (vp + 26) * 2;
dw = get_word (vp + 28);
dh = get_word (vp + 30);
- //write_log ("%d %d %d %d\n", w, h, dw, dh);
+ //write_log (L"%d %d %d %d\n", w, h, dw, dh);
if (w < maxx)
maxx = w;
if (h < maxy)
y -= dh;
}
}
- //write_log ("* %d %d\n", get_word (gb + 218), get_word (gb + 216));
+ //write_log (L"* %d %d\n", get_word (gb + 218), get_word (gb + 216));
}
- //write_log ("%d %d\n", maxx, maxy);
+ //write_log (L"%d %d\n", maxx, maxy);
#endif
maxx = maxx * 1000 / fmx;
if (y >= maxy)
y = maxy - 1;
- //write_log ("%d %d %d %d\n", x, y, maxx, maxy);
+ //write_log (L"%d %d %d %d\n", x, y, maxx, maxy);
p[MH_X] = x >> 8;
p[MH_X + 1] = x;
uae_u16 v = 0;
if (inputdevice_logging & 2)
- write_log ("JOY%dDAT %08x\n", joy, M68K_GETPC);
+ write_log (L"JOY%dDAT %08x\n", joy, M68K_GETPC);
readinput ();
if (joydir[joy] & DIR_LEFT)
left = 1;
}
#ifdef DONGLE_DEBUG
if (notinrom ())
- write_log ("JOY%dDAT %04X %s\n", joy, v, debuginfo (0));
+ write_log (L"JOY%dDAT %04X %s\n", joy, v, debuginfo (0));
#endif
if (input_recording > 0 && oldjoy[joy] != v) {
oldjoy[joy] = v;
mouse_frame_x[1] = mouse_x[1];
mouse_frame_y[1] = mouse_y[1];
if (inputdevice_logging & 2)
- write_log ("JOYTEST: %04X PC=%x\n", v , M68K_GETPC);
+ write_log (L"JOYTEST: %04X PC=%x\n", v , M68K_GETPC);
}
static uae_u8 parconvert (uae_u8 v, int jd, int shift)
}
}
if (inputdevice_logging & 4)
- write_log ("BFE001: %02X:%02X %x\n", dra, but, M68K_GETPC);
+ write_log (L"BFE001: %02X:%02X %x\n", dra, but, M68K_GETPC);
return but;
}
{
uae_u16 v = (pot_dat[joy][1] << 8) | pot_dat[joy][0];
if (inputdevice_logging & 16)
- write_log ("POTDAT%d: %04X %08X\n", joy, v, M68K_GETPC);
+ write_log (L"POTDAT%d: %04X %08X\n", joy, v, M68K_GETPC);
return v;
}
int i, j;
if (inputdevice_logging & 16)
- write_log ("POTGO_W: %04X %08X\n", v, M68K_GETPC);
+ write_log (L"POTGO_W: %04X %08X\n", v, M68K_GETPC);
#ifdef DONGLE_DEBUG
if (notinrom ())
- write_log ("POTGO %04X %s\n", v, debuginfo(0));
+ write_log (L"POTGO %04X %s\n", v, debuginfo(0));
#endif
potgo_value = potgo_value & 0x5500; /* keep state of data bits */
potgo_value |= v & 0xaa00; /* get new direction bits */
uae_u16 v = handle_joystick_potgor (potgo_value) & 0x5500;
#ifdef DONGLE_DEBUG
if (notinrom ())
- write_log ("POTGOR %04X %s\n", v, debuginfo(0));
+ write_log (L"POTGOR %04X %s\n", v, debuginfo(0));
#endif
if (inputdevice_logging & 16)
- write_log ("POTGO_R: %04X %08X %d\n", v, M68K_GETPC, cd32_shifter[1]);
+ write_log (L"POTGO_R: %04X %08X %d\n", v, M68K_GETPC, cd32_shifter[1]);
return v;
}
if (iq->framecnt < 0) break;
}
if (i == INPUT_QUEUE_SIZE) {
- write_log ("input queue overflow\n");
+ write_log (L"input queue overflow\n");
return;
}
iq->event = event;
}
record_key ((uae_u8)((key << 1) | (key >> 7)));
if (inputdevice_logging & 1)
- write_log ("Amiga key %02X %d\n", key & 0x7f, key >> 7);
+ write_log (L"Amiga key %02X %d\n", key & 0x7f, key >> 7);
return;
}
inputdevice_add_inputcode (code, state);
if (code == 0)
return;
if (vpos != 0)
- write_log ("inputcode=%d but vpos = %d", code, vpos);
+ write_log (L"inputcode=%d but vpos = %d", code, vpos);
#ifdef ARCADIA
switch (code)
case AKS_DISKSWAPPER_INSERT1:
case AKS_DISKSWAPPER_INSERT2:
case AKS_DISKSWAPPER_INSERT3:
- strcpy (changed_prefs.df[code - AKS_DISKSWAPPER_INSERT0], currprefs.dfxlist[swapperslot]);
+ _tcscpy (changed_prefs.df[code - AKS_DISKSWAPPER_INSERT0], currprefs.dfxlist[swapperslot]);
break;
break;
}
}
-int handle_custom_event (char *custom)
+int handle_custom_event (TCHAR *custom)
{
- char *p, *buf, *nextp;
+ TCHAR *p, *buf, *nextp;
if (custom == NULL)
return 0;
p = buf = my_strdup (custom);
while (p && *p) {
- char *p2;
+ TCHAR *p2;
if (*p != '\"')
break;
p++;
return 0;
ie = &events[nr];
if (inputdevice_logging & 1)
- write_log ("'%s' %d %d\n", ie->name, state, max);
+ write_log (L"'%s' %d %d\n", ie->name, state, max);
if (autofire) {
if (state)
queue_input_event (nr, state, max, currprefs.input_autofire_framecnt, 1);
int i;
if (inputdevice_logging & 32)
- write_log ("*\n");
+ write_log (L"*\n");
for (i = 0; i < INPUT_QUEUE_SIZE; i++) {
iq = &input_queue[i];
int ismouse = 0;
int newport = 0;
int flags = 0;
- char *name = NULL;
+ TCHAR *name = NULL;
int otherbuttonpressed = 0;
if (num >= 4)
if (flags)
return 0;
if (name) {
- write_log ("inputdevice change '%s':%d->%d\n", name, num, newport);
+ write_log (L"inputdevice change '%s':%d->%d\n", name, num, newport);
inputdevice_joyport_config (&changed_prefs, name, newport, 2);
inputdevice_copyconfig (&changed_prefs, &currprefs);
return 1;
}
}
}
- write_log ("inputdevice change '%s':%d->%d\n", name, num, newport);
+ write_log (L"inputdevice change '%s':%d->%d\n", name, num, newport);
inputdevice_copyconfig (&currprefs, &changed_prefs);
inputdevice_copyconfig (&changed_prefs, &currprefs);
return 1;
{
int idx = -1;
int custompos = (id->flags[offset][0] >> 15) & 1;
- char *custom;
+ TCHAR *custom;
if (state < 0) {
idx = 0;
if ((joy = jsem_ismouse (0, prefs)) >= 0) {
input_get_default_mouse (mice, joy, 0);
mice[joy].enabled = 1;
- strncpy (prefs->jports[0].name, idev[IDTYPE_MOUSE].get_friendlyname (joy), MAX_JPORTNAME - 1);
- strncpy (prefs->jports[0].configname, idev[IDTYPE_MOUSE].get_uniquename (joy), MAX_JPORTNAME - 1);
+ _tcsncpy (prefs->jports[0].name, idev[IDTYPE_MOUSE].get_friendlyname (joy), MAX_JPORTNAME - 1);
+ _tcsncpy (prefs->jports[0].configname, idev[IDTYPE_MOUSE].get_uniquename (joy), MAX_JPORTNAME - 1);
}
if ((joy = jsem_ismouse (1, prefs)) >= 0) {
input_get_default_mouse (mice, joy, 1);
mice[joy].enabled = 1;
- strncpy (prefs->jports[1].name, idev[IDTYPE_MOUSE].get_friendlyname (joy), MAX_JPORTNAME - 1);
- strncpy (prefs->jports[1].configname, idev[IDTYPE_MOUSE].get_uniquename (joy), MAX_JPORTNAME - 1);
+ _tcsncpy (prefs->jports[1].name, idev[IDTYPE_MOUSE].get_friendlyname (joy), MAX_JPORTNAME - 1);
+ _tcsncpy (prefs->jports[1].configname, idev[IDTYPE_MOUSE].get_uniquename (joy), MAX_JPORTNAME - 1);
}
joy = jsem_isjoy (1, prefs);
used[joy] = 1;
input_get_default_joystick (joysticks, joy, 1);
joysticks[joy].enabled = 1;
- strncpy (prefs->jports[1].name, idev[IDTYPE_JOYSTICK].get_friendlyname (joy), MAX_JPORTNAME - 1);
- strncpy (prefs->jports[1].configname, idev[IDTYPE_JOYSTICK].get_uniquename (joy), MAX_JPORTNAME - 1);
+ _tcsncpy (prefs->jports[1].name, idev[IDTYPE_JOYSTICK].get_friendlyname (joy), MAX_JPORTNAME - 1);
+ _tcsncpy (prefs->jports[1].configname, idev[IDTYPE_JOYSTICK].get_uniquename (joy), MAX_JPORTNAME - 1);
}
joy = jsem_isjoy (0, prefs);
used[joy] = 1;
input_get_default_joystick (joysticks, joy, 0);
joysticks[joy].enabled = 1;
- strncpy (prefs->jports[0].name, idev[IDTYPE_JOYSTICK].get_friendlyname (joy), MAX_JPORTNAME - 1);
- strncpy (prefs->jports[0].configname, idev[IDTYPE_JOYSTICK].get_uniquename (joy), MAX_JPORTNAME - 1);
+ _tcsncpy (prefs->jports[0].name, idev[IDTYPE_JOYSTICK].get_friendlyname (joy), MAX_JPORTNAME - 1);
+ _tcsncpy (prefs->jports[0].configname, idev[IDTYPE_JOYSTICK].get_uniquename (joy), MAX_JPORTNAME - 1);
}
for (joy = 0; used[joy]; joy++);
int i, j;
for (i = 0; i < inf->get_num (); i++) {
- char *aname1 = inf->get_friendlyname (i);
- char *aname2 = inf->get_uniquename (i);
+ TCHAR *aname1 = inf->get_friendlyname (i);
+ TCHAR *aname2 = inf->get_uniquename (i);
int match = -1;
for (j = 0; j < MAX_INPUT_DEVICES; j++) {
if (aname2 && uid[j].configname) {
- char bname[MAX_DPATH];
- char bname2[MAX_DPATH];
- char *p1 ,*p2;
- strcpy (bname, uid[j].configname);
- strcpy (bname2, aname2);
- p1 = strchr (bname, ' ');
- p2 = strchr (bname2, ' ');
+ TCHAR bname[MAX_DPATH];
+ TCHAR bname2[MAX_DPATH];
+ TCHAR *p1 ,*p2;
+ _tcscpy (bname, uid[j].configname);
+ _tcscpy (bname2, aname2);
+ p1 = _tcschr (bname, ' ');
+ p2 = _tcschr (bname2, ' ');
if (p1 && p2 && p1 - bname == p2 - bname2) {
*p1 = 0;
*p2 = 0;
- if (bname && !strcmp (bname2, bname)) {
+ if (bname && !_tcscmp (bname2, bname)) {
if (match >= 0)
match = -2;
else
// multiple matches -> use complete local-only id string for comparisons
if (match == -2) {
for (j = 0; j < MAX_INPUT_DEVICES; j++) {
- char *bname = uid[j].configname;
- if (aname2 && bname && !strcmp (aname2, bname))
+ TCHAR *bname = uid[j].configname;
+ if (aname2 && bname && !_tcscmp (aname2, bname))
match = j;
}
}
if (match < 0) {
for (j = 0; j < MAX_INPUT_DEVICES; j++) {
- char *bname = uid[j].name;
- if (aname2 && bname && !strcmp (aname2, bname))
+ TCHAR *bname = uid[j].name;
+ if (aname2 && bname && !_tcscmp (aname2, bname))
match = j;
}
}
{
int acc = input_acquired;
int i, idx;
- char *jports[2];
+ TCHAR *jports[2];
for (i = 0; i < 2; i++) {
jports[i] = 0;
if (kbr->eventid[i][k] == 0) break;
}
if (k == MAX_INPUT_SUB_EVENT) {
- write_log ("corrupt default keyboard mappings\n");
+ write_log (L"corrupt default keyboard mappings\n");
return;
}
kbr->eventid[i][k] = trans[l].event;
return uid;
}
-static int get_event_data (const struct inputdevice_functions *id, int devnum, int num, int *eventid, char **custom, int *flags, int sub)
+static int get_event_data (const struct inputdevice_functions *id, int devnum, int num, int *eventid, TCHAR **custom, int *flags, int sub)
{
const struct uae_input_device *uid = get_uid (id, devnum);
int type = id->get_widget_type (devnum, num, 0, 0);
return -1;
}
-static int put_event_data (const struct inputdevice_functions *id, int devnum, int num, int eventid, char *custom, int flags, int sub)
+static int put_event_data (const struct inputdevice_functions *id, int devnum, int num, int eventid, TCHAR *custom, int flags, int sub)
{
struct uae_input_device *uid = get_uid (id, devnum);
int type = id->get_widget_type (devnum, num, 0, 0);
{
struct uae_input_device *uid = get_uid (id, devnum);
int num, evt, flag, sub;
- char *custom;
+ TCHAR *custom;
for (num = 0; num < id->get_widget_num (devnum); num++) {
for (sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) {
return idev[type].get_num ();
}
/* returns the name of device */
-char *inputdevice_get_device_name (int type, int devnum)
+TCHAR *inputdevice_get_device_name (int type, int devnum)
{
return idev[type].get_friendlyname (devnum);
}
/* returns machine readable name of device */
-char *inputdevice_get_device_unique_name (int type, int devnum)
+TCHAR *inputdevice_get_device_unique_name (int type, int devnum)
{
return idev[type].get_uniquename (devnum);
}
return idf->get_widget_num (inputdevice_get_device_index (devnum));
}
-static void get_ename (const struct inputevent *ie, char *out)
+static void get_ename (const struct inputevent *ie, TCHAR *out)
{
if (!out)
return;
if (ie->allow_mask == AM_K)
- sprintf (out, "%s (0x%02X)", ie->name, ie->data);
+ _stprintf (out, L"%s (0x%02X)", ie->name, ie->data);
else
- strcpy (out, ie->name);
+ _tcscpy (out, ie->name);
}
-int inputdevice_iterate (int devnum, int num, char *name, int *af)
+int inputdevice_iterate (int devnum, int num, TCHAR *name, int *af)
{
const struct inputdevice_functions *idf = getidf (devnum);
static int id_iterator;
struct inputevent *ie;
int mask, data, flags, type;
int devindex = inputdevice_get_device_index (devnum);
- char *custom;
+ TCHAR *custom;
*af = 0;
*name = 0;
}
}
-int inputdevice_get_mapped_name (int devnum, int num, int *pflags, char *name, char *custom, int sub)
+int inputdevice_get_mapped_name (int devnum, int num, int *pflags, TCHAR *name, TCHAR *custom, int sub)
{
const struct inputdevice_functions *idf = getidf (devnum);
const struct uae_input_device *uid = get_uid (idf, inputdevice_get_device_index (devnum));
int flags = 0, flag, data;
int devindex = inputdevice_get_device_index (devnum);
- char *customp = NULL;
+ TCHAR *customp = NULL;
if (name)
- strcpy (name, "<none>");
+ _tcscpy (name, L"<none>");
if (custom)
custom[0] = 0;
if (pflags)
if (get_event_data (idf, devindex, num, &data, &customp, &flag, sub) < 0)
return 0;
if (customp && custom)
- strcpy (custom, customp);
+ _tcscpy (custom, customp);
if (flag & ID_FLAG_AUTOFIRE)
flags |= IDEV_MAPPED_AUTOFIRE_SET;
if (!data)
return data;
}
-int inputdevice_set_mapping (int devnum, int num, char *name, char *custom, int af, int sub)
+int inputdevice_set_mapping (int devnum, int num, TCHAR *name, TCHAR *custom, int af, int sub)
{
const struct inputdevice_functions *idf = getidf (devnum);
const struct uae_input_device *uid = get_uid (idf, inputdevice_get_device_index (devnum));
int eid, data, flag, amask;
- char ename[256];
+ TCHAR ename[256];
int devindex = inputdevice_get_device_index (devnum);
- char *customp = NULL;
+ TCHAR *customp = NULL;
if (uid == 0 || num < 0)
return 0;
eid = 1;
while (events[eid].name) {
get_ename (&events[eid], ename);
- if (!strcmp(ename, name)) break;
+ if (!_tcscmp(ename, name)) break;
eid++;
}
if (!events[eid].name)
return 0;
}
-int inputdevice_get_widget_type (int devnum, int num, char *name)
+int inputdevice_get_widget_type (int devnum, int num, TCHAR *name)
{
const struct inputdevice_functions *idf = getidf (devnum);
return idf->get_widget_type (inputdevice_get_device_index (devnum), num, name, 0);
idev[IDTYPE_KEYBOARD].acquire (i, 0);
}
// if (!input_acquired)
-// write_log ("input devices acquired (%s)\n", allmode ? "all" : "selected only");
+// write_log (L"input devices acquired (%s)\n", allmode ? "all" : "selected only");
input_acquired = 1;
}
int i;
// if (input_acquired)
-// write_log ("input devices unacquired\n");
+// write_log (L"input devices unacquired\n");
input_acquired = 0;
for (i = 0; i < MAX_INPUT_DEVICES; i++)
idev[IDTYPE_JOYSTICK].unacquire (i);
static void testrecord (int type, int num, int wtype, int wnum, int state)
{
- char tmp[2000];
+ TCHAR tmp[2000];
tmp[0] = 0;
wnum += idev[type].get_widget_first (num, wtype);
idev[type].get_widget_type (num, wnum, tmp, NULL);
- write_log ("%s: %s %d\n", idev[type].get_friendlyname (num), tmp, state);
+ write_log (L"%s: %s %d\n", idev[type].get_friendlyname (num), tmp, state);
}
int inputdevice_istest (void)
return testmode;
}
-int inputdevice_testread (char *name)
+int inputdevice_testread (TCHAR *name)
{
testmode = 1;
idev[IDTYPE_KEYBOARD].read ();
{
int fr, fr2;
- write_log ("%d %d %d\n", currprefs.gfx_framerate, turbo_emulation, mode);
+ write_log (L"%d %d %d\n", currprefs.gfx_framerate, turbo_emulation, mode);
fr = currprefs.gfx_framerate;
if (fr == 0)
return v;
}
-int inputdevice_joyport_config (struct uae_prefs *p, char *value, int portnum, int type)
+int inputdevice_joyport_config (struct uae_prefs *p, TCHAR *value, int portnum, int type)
{
switch (type)
{
}
idf = &idev[type];
for (i = 0; i < idf->get_num (); i++) {
- char *name1 = idf->get_friendlyname (i);
- char *name2 = idf->get_uniquename (i);
- if ((name1 && !strcmp (name1, value)) || (name2 && !strcmp (name2, value))) {
+ TCHAR *name1 = idf->get_friendlyname (i);
+ TCHAR *name2 = idf->get_uniquename (i);
+ if ((name1 && !_tcscmp (name1, value)) || (name2 && !_tcscmp (name2, value))) {
p->jports[portnum].id = idnum + i;
return 1;
}
case 0:
{
int start = -1, got = 0;
- char *pp = 0;
- if (strncmp (value, "kbd", 3) == 0) {
+ TCHAR *pp = 0;
+ if (_tcsncmp (value, L"kbd", 3) == 0) {
start = JSEM_KBDLAYOUT;
pp = value + 3;
got = 1;
- } else if (strncmp (value, "joy", 3) == 0) {
+ } else if (_tcsncmp (value, L"joy", 3) == 0) {
start = JSEM_JOYS;
pp = value + 3;
got = 1;
- } else if (strncmp (value, "mouse", 5) == 0) {
+ } else if (_tcsncmp (value, L"mouse", 5) == 0) {
start = JSEM_MICE;
pp = value + 5;
got = 1;
- } else if (strcmp (value, "none") == 0) {
+ } else if (_tcscmp (value, L"none") == 0) {
got = 2;
}
if (got) {
if (pp) {
- int v = atol (pp);
+ int v = _tstol (pp);
if (start >= 0) {
if (start == JSEM_KBDLAYOUT && v > 0)
v--;
/* joystick/mouse port 1 */
-DEFEVENT(JOYPORT1_START,"Joystick port 1", AM_INFO, 0,1,0)
-
-DEFEVENT(MOUSE1_FIRST, "", AM_DUMMY, 0,0,0)
-
-DEFEVENT(MOUSE1_HORIZ,"Mouse1 Horizontal",AM_MOUSE_AXIS|AM_JOY_AXIS,8,1,0)
-DEFEVENT(MOUSE1_VERT,"Mouse1 Vertical",AM_MOUSE_AXIS|AM_JOY_AXIS,8,1,1)
-DEFEVENT(MOUSE1_HORIZ_INV,"Mouse1 Horizontal (inverted)",AM_MOUSE_AXIS|AM_JOY_AXIS,8,1,0|IE_INVERT)
-DEFEVENT(MOUSE1_VERT_INV,"Mouse1 Vertical (inverted)",AM_MOUSE_AXIS|AM_JOY_AXIS,8,1,1|IE_INVERT)
-
-DEFEVENT(MOUSE1_LAST, "", AM_DUMMY, 0,0,0)
-
-DEFEVENT(MOUSE1_UP,"Mouse1 Up",AM_KEY|AM_JOY_BUT|AM_MOUSE_BUT,32,1,DIR_UP)
-DEFEVENT(MOUSE1_DOWN,"Mouse1 Down",AM_KEY|AM_JOY_BUT|AM_MOUSE_BUT,32,1,DIR_DOWN)
-DEFEVENT(MOUSE1_LEFT,"Mouse1 Left",AM_KEY|AM_JOY_BUT|AM_MOUSE_BUT,64,1,DIR_LEFT)
-DEFEVENT(MOUSE1_RIGHT,"Mouse1 Right",AM_KEY|AM_JOY_BUT|AM_MOUSE_BUT,64,1,DIR_RIGHT)
-
-DEFEVENT(MOUSE1_WHEEL,"Mouse1 Wheel",AM_MOUSE_AXIS|AM_JOY_AXIS,8,1,2)
-
-DEFEVENT(JOY1_HORIZ,"Joy1 Horizontal",AM_JOY_AXIS,0,1,DIR_LEFT|DIR_RIGHT)
-DEFEVENT(JOY1_VERT,"Joy1 Vertical",AM_JOY_AXIS,0,1,DIR_UP|DIR_DOWN)
-DEFEVENT(JOY1_HORIZ_POT,"Joy1 Horizontal (Analog)",AM_JOY_AXIS,128,1,1)
-DEFEVENT(JOY1_VERT_POT,"Joy1 Vertical (Analog)",AM_JOY_AXIS,128,1,0)
-DEFEVENT(JOY1_HORIZ_POT_INV,"Joy1 Horizontal (Analog, inverted)",AM_JOY_AXIS,128,1,1|IE_INVERT)
-DEFEVENT(JOY1_VERT_POT_INV,"Joy1 Vertical (Analog, inverted)",AM_JOY_AXIS,128,1,0|IE_INVERT)
-
-DEFEVENT(JOY1_LEFT,"Joy1 Left",AM_K,16,1,DIR_LEFT)
-DEFEVENT(JOY1_RIGHT,"Joy1 Right",AM_K,16,1,DIR_RIGHT)
-DEFEVENT(JOY1_UP,"Joy1 Up",AM_K,16,1,DIR_UP)
-DEFEVENT(JOY1_DOWN,"Joy1 Down",AM_K,16,1,DIR_DOWN)
-DEFEVENT(JOY1_LEFT_UP,"Joy1 Left+Up",AM_K,16,1,DIR_LEFT|DIR_UP)
-DEFEVENT(JOY1_LEFT_DOWN,"Joy1 Left+Down",AM_K,16,1,DIR_LEFT|DIR_DOWN)
-DEFEVENT(JOY1_RIGHT_UP,"Joy1 Right+Up",AM_K,16,1,DIR_RIGHT|DIR_UP)
-DEFEVENT(JOY1_RIGHT_DOWN,"Joy1 Right+Down",AM_K,16,1,DIR_RIGHT|DIR_DOWN)
-
-DEFEVENT(JOY1_FIRE_BUTTON,"Joy1 Fire/Mouse1 Left Button",AM_K,4,1,JOYBUTTON_1)
-DEFEVENT(JOY1_2ND_BUTTON,"Joy1 2nd Button/Mouse1 Right Button",AM_K,4,1,JOYBUTTON_2)
-DEFEVENT(JOY1_3RD_BUTTON,"Joy1 3rd Button/Mouse1 Middle Button",AM_K,4,1,JOYBUTTON_3)
-DEFEVENT(JOY1_CD32_PLAY,"Joy1 CD32 Play",AM_K,4,1,JOYBUTTON_CD32_PLAY)
-DEFEVENT(JOY1_CD32_RWD,"Joy1 CD32 RWD",AM_K,4,1,JOYBUTTON_CD32_RWD)
-DEFEVENT(JOY1_CD32_FFW,"Joy1 CD32 FFW",AM_K,4,1,JOYBUTTON_CD32_FFW)
-DEFEVENT(JOY1_CD32_GREEN,"Joy1 CD32 Green",AM_K,4,1,JOYBUTTON_CD32_GREEN)
-DEFEVENT(JOY1_CD32_YELLOW,"Joy1 CD32 Yellow",AM_K,4,1,JOYBUTTON_CD32_YELLOW)
-DEFEVENT(JOY1_CD32_RED,"Joy1 CD32 Red",AM_K,4,1,JOYBUTTON_CD32_RED)
-DEFEVENT(JOY1_CD32_BLUE,"Joy1 CD32 Blue",AM_K,4,1,JOYBUTTON_CD32_BLUE)
+DEFEVENT(JOYPORT1_START,L"Joystick port 1", AM_INFO, 0,1,0)
+
+DEFEVENT(MOUSE1_FIRST, L"", AM_DUMMY, 0,0,0)
+
+DEFEVENT(MOUSE1_HORIZ,L"Mouse1 Horizontal",AM_MOUSE_AXIS|AM_JOY_AXIS,8,1,0)
+DEFEVENT(MOUSE1_VERT,L"Mouse1 Vertical",AM_MOUSE_AXIS|AM_JOY_AXIS,8,1,1)
+DEFEVENT(MOUSE1_HORIZ_INV,L"Mouse1 Horizontal (inverted)",AM_MOUSE_AXIS|AM_JOY_AXIS,8,1,0|IE_INVERT)
+DEFEVENT(MOUSE1_VERT_INV,L"Mouse1 Vertical (inverted)",AM_MOUSE_AXIS|AM_JOY_AXIS,8,1,1|IE_INVERT)
+
+DEFEVENT(MOUSE1_LAST, L"", AM_DUMMY, 0,0,0)
+
+DEFEVENT(MOUSE1_UP,L"Mouse1 Up",AM_KEY|AM_JOY_BUT|AM_MOUSE_BUT,32,1,DIR_UP)
+DEFEVENT(MOUSE1_DOWN,L"Mouse1 Down",AM_KEY|AM_JOY_BUT|AM_MOUSE_BUT,32,1,DIR_DOWN)
+DEFEVENT(MOUSE1_LEFT,L"Mouse1 Left",AM_KEY|AM_JOY_BUT|AM_MOUSE_BUT,64,1,DIR_LEFT)
+DEFEVENT(MOUSE1_RIGHT,L"Mouse1 Right",AM_KEY|AM_JOY_BUT|AM_MOUSE_BUT,64,1,DIR_RIGHT)
+
+DEFEVENT(MOUSE1_WHEEL,L"Mouse1 Wheel",AM_MOUSE_AXIS|AM_JOY_AXIS,8,1,2)
+
+DEFEVENT(JOY1_HORIZ,L"Joy1 Horizontal",AM_JOY_AXIS,0,1,DIR_LEFT|DIR_RIGHT)
+DEFEVENT(JOY1_VERT,L"Joy1 Vertical",AM_JOY_AXIS,0,1,DIR_UP|DIR_DOWN)
+DEFEVENT(JOY1_HORIZ_POT,L"Joy1 Horizontal (Analog)",AM_JOY_AXIS,128,1,1)
+DEFEVENT(JOY1_VERT_POT,L"Joy1 Vertical (Analog)",AM_JOY_AXIS,128,1,0)
+DEFEVENT(JOY1_HORIZ_POT_INV,L"Joy1 Horizontal (Analog, inverted)",AM_JOY_AXIS,128,1,1|IE_INVERT)
+DEFEVENT(JOY1_VERT_POT_INV,L"Joy1 Vertical (Analog, inverted)",AM_JOY_AXIS,128,1,0|IE_INVERT)
+
+DEFEVENT(JOY1_LEFT,L"Joy1 Left",AM_K,16,1,DIR_LEFT)
+DEFEVENT(JOY1_RIGHT,L"Joy1 Right",AM_K,16,1,DIR_RIGHT)
+DEFEVENT(JOY1_UP,L"Joy1 Up",AM_K,16,1,DIR_UP)
+DEFEVENT(JOY1_DOWN,L"Joy1 Down",AM_K,16,1,DIR_DOWN)
+DEFEVENT(JOY1_LEFT_UP,L"Joy1 Left+Up",AM_K,16,1,DIR_LEFT|DIR_UP)
+DEFEVENT(JOY1_LEFT_DOWN,L"Joy1 Left+Down",AM_K,16,1,DIR_LEFT|DIR_DOWN)
+DEFEVENT(JOY1_RIGHT_UP,L"Joy1 Right+Up",AM_K,16,1,DIR_RIGHT|DIR_UP)
+DEFEVENT(JOY1_RIGHT_DOWN,L"Joy1 Right+Down",AM_K,16,1,DIR_RIGHT|DIR_DOWN)
+
+DEFEVENT(JOY1_FIRE_BUTTON,L"Joy1 Fire/Mouse1 Left Button",AM_K,4,1,JOYBUTTON_1)
+DEFEVENT(JOY1_2ND_BUTTON,L"Joy1 2nd Button/Mouse1 Right Button",AM_K,4,1,JOYBUTTON_2)
+DEFEVENT(JOY1_3RD_BUTTON,L"Joy1 3rd Button/Mouse1 Middle Button",AM_K,4,1,JOYBUTTON_3)
+DEFEVENT(JOY1_CD32_PLAY,L"Joy1 CD32 Play",AM_K,4,1,JOYBUTTON_CD32_PLAY)
+DEFEVENT(JOY1_CD32_RWD,L"Joy1 CD32 RWD",AM_K,4,1,JOYBUTTON_CD32_RWD)
+DEFEVENT(JOY1_CD32_FFW,L"Joy1 CD32 FFW",AM_K,4,1,JOYBUTTON_CD32_FFW)
+DEFEVENT(JOY1_CD32_GREEN,L"Joy1 CD32 Green",AM_K,4,1,JOYBUTTON_CD32_GREEN)
+DEFEVENT(JOY1_CD32_YELLOW,L"Joy1 CD32 Yellow",AM_K,4,1,JOYBUTTON_CD32_YELLOW)
+DEFEVENT(JOY1_CD32_RED,L"Joy1 CD32 Red",AM_K,4,1,JOYBUTTON_CD32_RED)
+DEFEVENT(JOY1_CD32_BLUE,L"Joy1 CD32 Blue",AM_K,4,1,JOYBUTTON_CD32_BLUE)
/* joystick/mouse port 2 */
-DEFEVENT(JOYPORT2_START,"Joystick port 2", AM_INFO, 0,2,0)
-
-DEFEVENT(MOUSE2_FIRST, "", AM_DUMMY, 0,0,0)
-
-DEFEVENT(MOUSE2_HORIZ,"Mouse2 Horizontal",AM_MOUSE_AXIS|AM_JOY_AXIS,8,2,0)
-DEFEVENT(MOUSE2_VERT,"Mouse2 Vertical",AM_MOUSE_AXIS|AM_JOY_AXIS,8,2,1)
-DEFEVENT(MOUSE2_HORIZ_INV,"Mouse2 Horizontal (inverted)",AM_MOUSE_AXIS|AM_JOY_AXIS,8,2,0|IE_INVERT)
-DEFEVENT(MOUSE2_VERT_INV,"Mouse2 Vertical (inverted)",AM_MOUSE_AXIS|AM_JOY_AXIS,8,2,1|IE_INVERT)
-
-DEFEVENT(MOUSE2_LAST, "", AM_DUMMY, 0,0,0)
-
-DEFEVENT(MOUSE2_UP,"Mouse2 Up",AM_KEY|AM_JOY_BUT|AM_MOUSE_BUT,32,2,DIR_UP)
-DEFEVENT(MOUSE2_DOWN,"Mouse2 Down",AM_KEY|AM_JOY_BUT|AM_MOUSE_BUT,32,2,DIR_DOWN)
-DEFEVENT(MOUSE2_LEFT,"Mouse2 Left",AM_KEY|AM_JOY_BUT|AM_MOUSE_BUT,64,2,DIR_LEFT)
-DEFEVENT(MOUSE2_RIGHT,"Mouse2 Right",AM_KEY|AM_JOY_BUT|AM_MOUSE_BUT,64,2,DIR_RIGHT)
-
-DEFEVENT(JOY2_HORIZ,"Joy2 Horizontal",AM_JOY_AXIS,0,2,DIR_LEFT|DIR_RIGHT)
-DEFEVENT(JOY2_VERT,"Joy2 Vertical",AM_JOY_AXIS,0,2,DIR_UP|DIR_DOWN)
-DEFEVENT(JOY2_HORIZ_POT,"Joy2 Horizontal (Analog)",AM_JOY_AXIS,128,2,1)
-DEFEVENT(JOY2_VERT_POT,"Joy2 Vertical (Analog)",AM_JOY_AXIS,128,2,0)
-DEFEVENT(JOY2_HORIZ_POT_INV,"Joy2 Horizontal (Analog, inverted)",AM_JOY_AXIS,128,2,1|IE_INVERT)
-DEFEVENT(JOY2_VERT_POT_INV,"Joy2 Vertical (Analog, inverted)",AM_JOY_AXIS,128,2,0|IE_INVERT)
-
-DEFEVENT(JOY2_LEFT,"Joy2 Left",AM_K,16,2,DIR_LEFT)
-DEFEVENT(JOY2_RIGHT,"Joy2 Right",AM_K,16,2,DIR_RIGHT)
-DEFEVENT(JOY2_UP,"Joy2 Up",AM_K,16,2,DIR_UP)
-DEFEVENT(JOY2_DOWN,"Joy2 Down",AM_K,16,2,DIR_DOWN)
-DEFEVENT(JOY2_LEFT_UP,"Joy2 Left+Up",AM_K,16,2,DIR_LEFT|DIR_UP)
-DEFEVENT(JOY2_LEFT_DOWN,"Joy2 Left+Down",AM_K,16,2,DIR_LEFT|DIR_DOWN)
-DEFEVENT(JOY2_RIGHT_UP,"Joy2 Right+Up",AM_K,16,2,DIR_RIGHT|DIR_UP)
-DEFEVENT(JOY2_RIGHT_DOWN,"Joy2 Right+Down",AM_K,16,2,DIR_RIGHT|DIR_DOWN)
-
-DEFEVENT(JOY2_FIRE_BUTTON,"Joy2 Fire/Mouse2 Left Button",AM_K,4,2,JOYBUTTON_1)
-DEFEVENT(JOY2_2ND_BUTTON,"Joy2 2nd Button/Mouse2 Right Button",AM_K,4,2,JOYBUTTON_2)
-DEFEVENT(JOY2_3RD_BUTTON,"Joy2 3rd Button/Mouse2 Middle Button",AM_K,4,2,JOYBUTTON_3)
-DEFEVENT(JOY2_CD32_PLAY,"Joy2 CD32 Play",AM_K,4,2,JOYBUTTON_CD32_PLAY)
-DEFEVENT(JOY2_CD32_RWD,"Joy2 CD32 RWD",AM_K,4,2,JOYBUTTON_CD32_RWD)
-DEFEVENT(JOY2_CD32_FFW,"Joy2 CD32 FFW",AM_K,4,2,JOYBUTTON_CD32_FFW)
-DEFEVENT(JOY2_CD32_GREEN,"Joy2 CD32 Green",AM_K,4,2,JOYBUTTON_CD32_GREEN)
-DEFEVENT(JOY2_CD32_YELLOW,"Joy2 CD32 Yellow",AM_K,4,2,JOYBUTTON_CD32_YELLOW)
-DEFEVENT(JOY2_CD32_RED,"Joy2 CD32 Red",AM_K,4,2,JOYBUTTON_CD32_RED)
-DEFEVENT(JOY2_CD32_BLUE,"Joy2 CD32 Blue",AM_K,4,2,JOYBUTTON_CD32_BLUE)
-
-DEFEVENT(LIGHTPEN_HORIZ,"Lightpen Horizontal",AM_MOUSE_AXIS,0,5,0)
-DEFEVENT(LIGHTPEN_VERT,"Lightpen Vertical",AM_MOUSE_AXIS,0,5,1)
+DEFEVENT(JOYPORT2_START,L"Joystick port 2", AM_INFO, 0,2,0)
+
+DEFEVENT(MOUSE2_FIRST, L"", AM_DUMMY, 0,0,0)
+
+DEFEVENT(MOUSE2_HORIZ,L"Mouse2 Horizontal",AM_MOUSE_AXIS|AM_JOY_AXIS,8,2,0)
+DEFEVENT(MOUSE2_VERT,L"Mouse2 Vertical",AM_MOUSE_AXIS|AM_JOY_AXIS,8,2,1)
+DEFEVENT(MOUSE2_HORIZ_INV,L"Mouse2 Horizontal (inverted)",AM_MOUSE_AXIS|AM_JOY_AXIS,8,2,0|IE_INVERT)
+DEFEVENT(MOUSE2_VERT_INV,L"Mouse2 Vertical (inverted)",AM_MOUSE_AXIS|AM_JOY_AXIS,8,2,1|IE_INVERT)
+
+DEFEVENT(MOUSE2_LAST, L"", AM_DUMMY, 0,0,0)
+
+DEFEVENT(MOUSE2_UP,L"Mouse2 Up",AM_KEY|AM_JOY_BUT|AM_MOUSE_BUT,32,2,DIR_UP)
+DEFEVENT(MOUSE2_DOWN,L"Mouse2 Down",AM_KEY|AM_JOY_BUT|AM_MOUSE_BUT,32,2,DIR_DOWN)
+DEFEVENT(MOUSE2_LEFT,L"Mouse2 Left",AM_KEY|AM_JOY_BUT|AM_MOUSE_BUT,64,2,DIR_LEFT)
+DEFEVENT(MOUSE2_RIGHT,L"Mouse2 Right",AM_KEY|AM_JOY_BUT|AM_MOUSE_BUT,64,2,DIR_RIGHT)
+
+DEFEVENT(JOY2_HORIZ,L"Joy2 Horizontal",AM_JOY_AXIS,0,2,DIR_LEFT|DIR_RIGHT)
+DEFEVENT(JOY2_VERT,L"Joy2 Vertical",AM_JOY_AXIS,0,2,DIR_UP|DIR_DOWN)
+DEFEVENT(JOY2_HORIZ_POT,L"Joy2 Horizontal (Analog)",AM_JOY_AXIS,128,2,1)
+DEFEVENT(JOY2_VERT_POT,L"Joy2 Vertical (Analog)",AM_JOY_AXIS,128,2,0)
+DEFEVENT(JOY2_HORIZ_POT_INV,L"Joy2 Horizontal (Analog, inverted)",AM_JOY_AXIS,128,2,1|IE_INVERT)
+DEFEVENT(JOY2_VERT_POT_INV,L"Joy2 Vertical (Analog, inverted)",AM_JOY_AXIS,128,2,0|IE_INVERT)
+
+DEFEVENT(JOY2_LEFT,L"Joy2 Left",AM_K,16,2,DIR_LEFT)
+DEFEVENT(JOY2_RIGHT,L"Joy2 Right",AM_K,16,2,DIR_RIGHT)
+DEFEVENT(JOY2_UP,L"Joy2 Up",AM_K,16,2,DIR_UP)
+DEFEVENT(JOY2_DOWN,L"Joy2 Down",AM_K,16,2,DIR_DOWN)
+DEFEVENT(JOY2_LEFT_UP,L"Joy2 Left+Up",AM_K,16,2,DIR_LEFT|DIR_UP)
+DEFEVENT(JOY2_LEFT_DOWN,L"Joy2 Left+Down",AM_K,16,2,DIR_LEFT|DIR_DOWN)
+DEFEVENT(JOY2_RIGHT_UP,L"Joy2 Right+Up",AM_K,16,2,DIR_RIGHT|DIR_UP)
+DEFEVENT(JOY2_RIGHT_DOWN,L"Joy2 Right+Down",AM_K,16,2,DIR_RIGHT|DIR_DOWN)
+
+DEFEVENT(JOY2_FIRE_BUTTON,L"Joy2 Fire/Mouse2 Left Button",AM_K,4,2,JOYBUTTON_1)
+DEFEVENT(JOY2_2ND_BUTTON,L"Joy2 2nd Button/Mouse2 Right Button",AM_K,4,2,JOYBUTTON_2)
+DEFEVENT(JOY2_3RD_BUTTON,L"Joy2 3rd Button/Mouse2 Middle Button",AM_K,4,2,JOYBUTTON_3)
+DEFEVENT(JOY2_CD32_PLAY,L"Joy2 CD32 Play",AM_K,4,2,JOYBUTTON_CD32_PLAY)
+DEFEVENT(JOY2_CD32_RWD,L"Joy2 CD32 RWD",AM_K,4,2,JOYBUTTON_CD32_RWD)
+DEFEVENT(JOY2_CD32_FFW,L"Joy2 CD32 FFW",AM_K,4,2,JOYBUTTON_CD32_FFW)
+DEFEVENT(JOY2_CD32_GREEN,L"Joy2 CD32 Green",AM_K,4,2,JOYBUTTON_CD32_GREEN)
+DEFEVENT(JOY2_CD32_YELLOW,L"Joy2 CD32 Yellow",AM_K,4,2,JOYBUTTON_CD32_YELLOW)
+DEFEVENT(JOY2_CD32_RED,L"Joy2 CD32 Red",AM_K,4,2,JOYBUTTON_CD32_RED)
+DEFEVENT(JOY2_CD32_BLUE,L"Joy2 CD32 Blue",AM_K,4,2,JOYBUTTON_CD32_BLUE)
+
+DEFEVENT(LIGHTPEN_HORIZ,L"Lightpen Horizontal",AM_MOUSE_AXIS,0,5,0)
+DEFEVENT(LIGHTPEN_VERT,L"Lightpen Vertical",AM_MOUSE_AXIS,0,5,1)
/* parallel port joystick adapter */
-DEFEVENT(PAR_JOY1_START, "Parallel port joystick adapter", AM_INFO, 0,3,0)
-
-DEFEVENT(PAR_JOY1_HORIZ,"Parallel Joy1 Horizontal",AM_JOY_AXIS,0,3,DIR_LEFT|DIR_RIGHT)
-DEFEVENT(PAR_JOY1_VERT,"Parallel Joy1 Vertical",AM_JOY_AXIS,0,3,DIR_UP|DIR_DOWN)
-DEFEVENT(PAR_JOY1_LEFT,"Parallel Joy1 Left",AM_K,16,3,DIR_LEFT)
-DEFEVENT(PAR_JOY1_RIGHT,"Parallel Joy1 Right",AM_K,16,3,DIR_RIGHT)
-DEFEVENT(PAR_JOY1_UP,"Parallel Joy1 Up",AM_K,16,3,DIR_UP)
-DEFEVENT(PAR_JOY1_DOWN,"Parallel Joy1 Down",AM_K,16,3,DIR_DOWN)
-DEFEVENT(PAR_JOY1_LEFT_UP,"Parallel Joy1 Left+Up",AM_K,16,3,DIR_LEFT|DIR_UP)
-DEFEVENT(PAR_JOY1_LEFT_DOWN,"Parallel Joy1 Left+Down",AM_K,16,3,DIR_LEFT|DIR_DOWN)
-DEFEVENT(PAR_JOY1_RIGHT_UP,"Parallel Joy1 Right+Up",AM_K,16,3,DIR_RIGHT|DIR_UP)
-DEFEVENT(PAR_JOY1_RIGHT_DOWN,"Parallel Joy1 Right+Down",AM_K,16,3,DIR_RIGHT|DIR_DOWN)
-DEFEVENT(PAR_JOY1_FIRE_BUTTON,"Parallel Joy1 Fire Button",AM_K,4,3,JOYBUTTON_1)
-
-DEFEVENT(PAR_JOY2_START, "", AM_DUMMY, 0,4,0)
-
-DEFEVENT(PAR_JOY2_HORIZ,"Parallel Joy2 Horizontal",AM_JOY_AXIS,0,4,DIR_LEFT|DIR_RIGHT)
-DEFEVENT(PAR_JOY2_VERT,"Parallel Joy2 Vertical",AM_JOY_AXIS,0,4,DIR_UP|DIR_DOWN)
-DEFEVENT(PAR_JOY2_LEFT,"Parallel Joy2 Left",AM_K,16,4,DIR_LEFT)
-DEFEVENT(PAR_JOY2_RIGHT,"Parallel Joy2 Right",AM_K,16,4,DIR_RIGHT)
-DEFEVENT(PAR_JOY2_UP,"Parallel Joy2 Up",AM_K,16,4,DIR_UP)
-DEFEVENT(PAR_JOY2_DOWN,"Parallel Joy2 Down",AM_K,16,4,DIR_DOWN)
-DEFEVENT(PAR_JOY2_LEFT_UP,"Parallel Joy2 Left+Up",AM_K,16,4,DIR_LEFT|DIR_UP)
-DEFEVENT(PAR_JOY2_LEFT_DOWN,"Parallel Joy2 Left+Down",AM_K,16,4,DIR_LEFT|DIR_DOWN)
-DEFEVENT(PAR_JOY2_RIGHT_UP,"Parallel Joy2 Right+Up",AM_K,16,4,DIR_RIGHT|DIR_UP)
-DEFEVENT(PAR_JOY2_RIGHT_DOWN,"Parallel Joy2 Right+Down",AM_K,16,4,DIR_RIGHT|DIR_DOWN)
-DEFEVENT(PAR_JOY2_FIRE_BUTTON,"Parallel Joy2 Fire Button",AM_K,4,4,JOYBUTTON_1)
-
-DEFEVENT(PAR_JOY_END, "", AM_DUMMY, 0,0,0)
+DEFEVENT(PAR_JOY1_START, L"Parallel port joystick adapter", AM_INFO, 0,3,0)
+
+DEFEVENT(PAR_JOY1_HORIZ,L"Parallel Joy1 Horizontal",AM_JOY_AXIS,0,3,DIR_LEFT|DIR_RIGHT)
+DEFEVENT(PAR_JOY1_VERT,L"Parallel Joy1 Vertical",AM_JOY_AXIS,0,3,DIR_UP|DIR_DOWN)
+DEFEVENT(PAR_JOY1_LEFT,L"Parallel Joy1 Left",AM_K,16,3,DIR_LEFT)
+DEFEVENT(PAR_JOY1_RIGHT,L"Parallel Joy1 Right",AM_K,16,3,DIR_RIGHT)
+DEFEVENT(PAR_JOY1_UP,L"Parallel Joy1 Up",AM_K,16,3,DIR_UP)
+DEFEVENT(PAR_JOY1_DOWN,L"Parallel Joy1 Down",AM_K,16,3,DIR_DOWN)
+DEFEVENT(PAR_JOY1_LEFT_UP,L"Parallel Joy1 Left+Up",AM_K,16,3,DIR_LEFT|DIR_UP)
+DEFEVENT(PAR_JOY1_LEFT_DOWN,L"Parallel Joy1 Left+Down",AM_K,16,3,DIR_LEFT|DIR_DOWN)
+DEFEVENT(PAR_JOY1_RIGHT_UP,L"Parallel Joy1 Right+Up",AM_K,16,3,DIR_RIGHT|DIR_UP)
+DEFEVENT(PAR_JOY1_RIGHT_DOWN,L"Parallel Joy1 Right+Down",AM_K,16,3,DIR_RIGHT|DIR_DOWN)
+DEFEVENT(PAR_JOY1_FIRE_BUTTON,L"Parallel Joy1 Fire Button",AM_K,4,3,JOYBUTTON_1)
+
+DEFEVENT(PAR_JOY2_START, L"", AM_DUMMY, 0,4,0)
+
+DEFEVENT(PAR_JOY2_HORIZ,L"Parallel Joy2 Horizontal",AM_JOY_AXIS,0,4,DIR_LEFT|DIR_RIGHT)
+DEFEVENT(PAR_JOY2_VERT,L"Parallel Joy2 Vertical",AM_JOY_AXIS,0,4,DIR_UP|DIR_DOWN)
+DEFEVENT(PAR_JOY2_LEFT,L"Parallel Joy2 Left",AM_K,16,4,DIR_LEFT)
+DEFEVENT(PAR_JOY2_RIGHT,L"Parallel Joy2 Right",AM_K,16,4,DIR_RIGHT)
+DEFEVENT(PAR_JOY2_UP,L"Parallel Joy2 Up",AM_K,16,4,DIR_UP)
+DEFEVENT(PAR_JOY2_DOWN,L"Parallel Joy2 Down",AM_K,16,4,DIR_DOWN)
+DEFEVENT(PAR_JOY2_LEFT_UP,L"Parallel Joy2 Left+Up",AM_K,16,4,DIR_LEFT|DIR_UP)
+DEFEVENT(PAR_JOY2_LEFT_DOWN,L"Parallel Joy2 Left+Down",AM_K,16,4,DIR_LEFT|DIR_DOWN)
+DEFEVENT(PAR_JOY2_RIGHT_UP,L"Parallel Joy2 Right+Up",AM_K,16,4,DIR_RIGHT|DIR_UP)
+DEFEVENT(PAR_JOY2_RIGHT_DOWN,L"Parallel Joy2 Right+Down",AM_K,16,4,DIR_RIGHT|DIR_DOWN)
+DEFEVENT(PAR_JOY2_FIRE_BUTTON,L"Parallel Joy2 Fire Button",AM_K,4,4,JOYBUTTON_1)
+
+DEFEVENT(PAR_JOY_END, L"", AM_DUMMY, 0,0,0)
/* keys */
-DEFEVENT(KEY_START,"Keyboard",AM_INFO, 0,0,0)
+DEFEVENT(KEY_START,L"Keyboard",AM_INFO, 0,0,0)
-DEFEVENT(KEY_F1,"F1",AM_K,0,0,AK_F1)
-DEFEVENT(KEY_F2,"F2",AM_K,0,0,AK_F2)
-DEFEVENT(KEY_F3,"F3",AM_K,0,0,AK_F3)
-DEFEVENT(KEY_F4,"F4",AM_K,0,0,AK_F4)
-DEFEVENT(KEY_F5,"F5",AM_K,0,0,AK_F5)
-DEFEVENT(KEY_F6,"F6",AM_K,0,0,AK_F6)
-DEFEVENT(KEY_F7,"F7",AM_K,0,0,AK_F7)
-DEFEVENT(KEY_F8,"F8",AM_K,0,0,AK_F8)
-DEFEVENT(KEY_F9,"F9",AM_K,0,0,AK_F9)
-DEFEVENT(KEY_F10,"F10",AM_K,0,0,AK_F10)
+DEFEVENT(KEY_F1,L"F1",AM_K,0,0,AK_F1)
+DEFEVENT(KEY_F2,L"F2",AM_K,0,0,AK_F2)
+DEFEVENT(KEY_F3,L"F3",AM_K,0,0,AK_F3)
+DEFEVENT(KEY_F4,L"F4",AM_K,0,0,AK_F4)
+DEFEVENT(KEY_F5,L"F5",AM_K,0,0,AK_F5)
+DEFEVENT(KEY_F6,L"F6",AM_K,0,0,AK_F6)
+DEFEVENT(KEY_F7,L"F7",AM_K,0,0,AK_F7)
+DEFEVENT(KEY_F8,L"F8",AM_K,0,0,AK_F8)
+DEFEVENT(KEY_F9,L"F9",AM_K,0,0,AK_F9)
+DEFEVENT(KEY_F10,L"F10",AM_K,0,0,AK_F10)
/* "special" keys */
-DEFEVENT(KEY_ESC,"ESC",AM_K,0,0,AK_ESC)
-DEFEVENT(KEY_TAB,"Tab",AM_K,0,0,AK_TAB)
-DEFEVENT(KEY_CTRL,"CTRL",AM_K,0,0,AK_CTRL)
-DEFEVENT(KEY_CTRL_RIGHT,"Right CTRL",AM_K,0,0,AK_RCTRL)
-DEFEVENT(KEY_CAPS_LOCK,"Caps Lock",AM_K,0,0,AK_CAPSLOCK)
-DEFEVENT(KEY_SHIFT_LEFT,"Left Shift",AM_K,0,0,AK_LSH)
-DEFEVENT(KEY_ALT_LEFT,"Left Alt",AM_K,0,0,AK_LALT)
-DEFEVENT(KEY_AMIGA_LEFT,"Left Amiga",AM_K,0,0,AK_LAMI)
-DEFEVENT(KEY_AMIGA_RIGHT,"Right Amiga",AM_K,0,0,AK_RAMI)
-DEFEVENT(KEY_ALT_RIGHT,"Right Alt",AM_K,0,0,AK_RALT)
-DEFEVENT(KEY_SHIFT_RIGHT,"Right Shift",AM_K,0,0,AK_RSH)
-DEFEVENT(KEY_SPACE,"Space",AM_K,0,0,AK_SPC)
-DEFEVENT(KEY_CURSOR_UP,"Cursor Up",AM_K,0,0,AK_UP)
-DEFEVENT(KEY_CURSOR_DOWN,"Cursor Down",AM_K,0,0,AK_DN)
-DEFEVENT(KEY_CURSOR_LEFT,"Cursor Left",AM_K,0,0,AK_LF)
-DEFEVENT(KEY_CURSOR_RIGHT,"Cursor Right",AM_K,0,0,AK_RT)
-DEFEVENT(KEY_HELP,"Help",AM_K,0,0,AK_HELP)
-DEFEVENT(KEY_DEL,"Del",AM_K,0,0,AK_DEL)
-DEFEVENT(KEY_BACKSPACE,"Backspace",AM_K,0,0,AK_BS)
-DEFEVENT(KEY_RETURN,"Return",AM_K,0,0,AK_RET)
+DEFEVENT(KEY_ESC,L"ESC",AM_K,0,0,AK_ESC)
+DEFEVENT(KEY_TAB,L"Tab",AM_K,0,0,AK_TAB)
+DEFEVENT(KEY_CTRL,L"CTRL",AM_K,0,0,AK_CTRL)
+DEFEVENT(KEY_CTRL_RIGHT,L"Right CTRL",AM_K,0,0,AK_RCTRL)
+DEFEVENT(KEY_CAPS_LOCK,L"Caps Lock",AM_K,0,0,AK_CAPSLOCK)
+DEFEVENT(KEY_SHIFT_LEFT,L"Left Shift",AM_K,0,0,AK_LSH)
+DEFEVENT(KEY_ALT_LEFT,L"Left Alt",AM_K,0,0,AK_LALT)
+DEFEVENT(KEY_AMIGA_LEFT,L"Left Amiga",AM_K,0,0,AK_LAMI)
+DEFEVENT(KEY_AMIGA_RIGHT,L"Right Amiga",AM_K,0,0,AK_RAMI)
+DEFEVENT(KEY_ALT_RIGHT,L"Right Alt",AM_K,0,0,AK_RALT)
+DEFEVENT(KEY_SHIFT_RIGHT,L"Right Shift",AM_K,0,0,AK_RSH)
+DEFEVENT(KEY_SPACE,L"Space",AM_K,0,0,AK_SPC)
+DEFEVENT(KEY_CURSOR_UP,L"Cursor Up",AM_K,0,0,AK_UP)
+DEFEVENT(KEY_CURSOR_DOWN,L"Cursor Down",AM_K,0,0,AK_DN)
+DEFEVENT(KEY_CURSOR_LEFT,L"Cursor Left",AM_K,0,0,AK_LF)
+DEFEVENT(KEY_CURSOR_RIGHT,L"Cursor Right",AM_K,0,0,AK_RT)
+DEFEVENT(KEY_HELP,L"Help",AM_K,0,0,AK_HELP)
+DEFEVENT(KEY_DEL,L"Del",AM_K,0,0,AK_DEL)
+DEFEVENT(KEY_BACKSPACE,L"Backspace",AM_K,0,0,AK_BS)
+DEFEVENT(KEY_RETURN,L"Return",AM_K,0,0,AK_RET)
/* numpad */
-DEFEVENT(KEY_A,"A",AM_K,0,0,AK_A)
-DEFEVENT(KEY_B,"B",AM_K,0,0,AK_B)
-DEFEVENT(KEY_C,"C",AM_K,0,0,AK_C)
-DEFEVENT(KEY_D,"D",AM_K,0,0,AK_D)
-DEFEVENT(KEY_E,"E",AM_K,0,0,AK_E)
-DEFEVENT(KEY_F,"F",AM_K,0,0,AK_F)
-DEFEVENT(KEY_G,"G",AM_K,0,0,AK_G)
-DEFEVENT(KEY_H,"H",AM_K,0,0,AK_H)
-DEFEVENT(KEY_I,"I",AM_K,0,0,AK_I)
-DEFEVENT(KEY_J,"J",AM_K,0,0,AK_J)
-DEFEVENT(KEY_K,"K",AM_K,0,0,AK_K)
-DEFEVENT(KEY_L,"L",AM_K,0,0,AK_L)
-DEFEVENT(KEY_M,"M",AM_K,0,0,AK_M)
-DEFEVENT(KEY_N,"N",AM_K,0,0,AK_N)
-DEFEVENT(KEY_O,"O",AM_K,0,0,AK_O)
-DEFEVENT(KEY_P,"P",AM_K,0,0,AK_P)
-DEFEVENT(KEY_Q,"Q",AM_K,0,0,AK_Q)
-DEFEVENT(KEY_R,"R",AM_K,0,0,AK_R)
-DEFEVENT(KEY_S,"S",AM_K,0,0,AK_S)
-DEFEVENT(KEY_T,"T",AM_K,0,0,AK_T)
-DEFEVENT(KEY_U,"U",AM_K,0,0,AK_U)
-DEFEVENT(KEY_V,"V",AM_K,0,0,AK_V)
-DEFEVENT(KEY_W,"W",AM_K,0,0,AK_W)
-DEFEVENT(KEY_X,"X",AM_K,0,0,AK_X)
-DEFEVENT(KEY_Y,"Y",AM_K,0,0,AK_Y)
-DEFEVENT(KEY_Z,"Z",AM_K,0,0,AK_Z)
-
-DEFEVENT(KEY_ENTER,"Numpad Enter",AM_K,0,0,AK_ENT)
-DEFEVENT(KEY_NP_0,"Numpad 0",AM_K,0,0,AK_NP0)
-DEFEVENT(KEY_NP_1,"Numpad 1",AM_K,0,0,AK_NP1)
-DEFEVENT(KEY_NP_2,"Numpad 2",AM_K,0,0,AK_NP2)
-DEFEVENT(KEY_NP_3,"Numpad 3",AM_K,0,0,AK_NP3)
-DEFEVENT(KEY_NP_4,"Numpad 4",AM_K,0,0,AK_NP4)
-DEFEVENT(KEY_NP_5,"Numpad 5",AM_K,0,0,AK_NP5)
-DEFEVENT(KEY_NP_6,"Numpad 6",AM_K,0,0,AK_NP6)
-DEFEVENT(KEY_NP_7,"Numpad 7",AM_K,0,0,AK_NP7)
-DEFEVENT(KEY_NP_8,"Numpad 8",AM_K,0,0,AK_NP8)
-DEFEVENT(KEY_NP_9,"Numpad 9",AM_K,0,0,AK_NP9)
-DEFEVENT(KEY_NP_PERIOD,"Numpad Period",AM_K,0,0,AK_NPDEL)
-DEFEVENT(KEY_NP_ADD,"Numpad Plus",AM_K,0,0,AK_NPADD)
-DEFEVENT(KEY_NP_SUB,"Numpad Minus",AM_K,0,0,AK_NPSUB)
-DEFEVENT(KEY_NP_MUL,"Numpad Multiply",AM_K,0,0,AK_NPMUL)
-DEFEVENT(KEY_NP_DIV,"Numpad Divide",AM_K,0,0,AK_NPDIV)
-DEFEVENT(KEY_NP_LPAREN,"Numpad Left Parenthesis",AM_K,0,0,AK_NPLPAREN)
-DEFEVENT(KEY_NP_RPAREN,"Numpad Right Parenthesis",AM_K,0,0,AK_NPRPAREN)
-DEFEVENT(KEY_2B,"Keycode 0x2b",AM_K,0,0,0x2b)
-DEFEVENT(KEY_30,"Keycode 0x30",AM_K,0,0,0x30)
-
-DEFEVENT(KEY_BACKQUOTE,"Back Quote",AM_K,0,0,AK_BACKQUOTE)
-DEFEVENT(KEY_1,"1",AM_K,0,0,AK_1)
-DEFEVENT(KEY_2,"2",AM_K,0,0,AK_2)
-DEFEVENT(KEY_3,"3",AM_K,0,0,AK_3)
-DEFEVENT(KEY_4,"4",AM_K,0,0,AK_4)
-DEFEVENT(KEY_5,"5",AM_K,0,0,AK_5)
-DEFEVENT(KEY_6,"6",AM_K,0,0,AK_6)
-DEFEVENT(KEY_7,"7",AM_K,0,0,AK_7)
-DEFEVENT(KEY_8,"8",AM_K,0,0,AK_8)
-DEFEVENT(KEY_9,"9",AM_K,0,0,AK_9)
-DEFEVENT(KEY_0,"0",AM_K,0,0,AK_0)
-DEFEVENT(KEY_SUB,"Minus",AM_K,0,0,AK_MINUS)
-DEFEVENT(KEY_EQUALS,"Equals",AM_K,0,0,AK_EQUAL)
-DEFEVENT(KEY_BACKSLASH,"Backslash",AM_K,0,0,AK_BACKSLASH)
-
-DEFEVENT(KEY_LEFTBRACKET,"Left Bracket",AM_K,0,0,AK_LBRACKET)
-DEFEVENT(KEY_RIGHTBRACKET,"Right Bracket",AM_K,0,0,AK_RBRACKET)
-DEFEVENT(KEY_SEMICOLON,"Semicolon",AM_K,0,0,AK_SEMICOLON)
-DEFEVENT(KEY_SINGLEQUOTE,"Single Quote",AM_K,0,0,AK_QUOTE)
-DEFEVENT(KEY_COMMA,"Comma",AM_K,0,0,AK_COMMA)
-DEFEVENT(KEY_PERIOD,"Period",AM_K,0,0,AK_PERIOD)
-DEFEVENT(KEY_DIV,"Slash",AM_K,0,0,AK_SLASH)
-
-// DEFEVENT(KEY_,"",AM_K,0,0,0x)
+DEFEVENT(KEY_A,L"A",AM_K,0,0,AK_A)
+DEFEVENT(KEY_B,L"B",AM_K,0,0,AK_B)
+DEFEVENT(KEY_C,L"C",AM_K,0,0,AK_C)
+DEFEVENT(KEY_D,L"D",AM_K,0,0,AK_D)
+DEFEVENT(KEY_E,L"E",AM_K,0,0,AK_E)
+DEFEVENT(KEY_F,L"F",AM_K,0,0,AK_F)
+DEFEVENT(KEY_G,L"G",AM_K,0,0,AK_G)
+DEFEVENT(KEY_H,L"H",AM_K,0,0,AK_H)
+DEFEVENT(KEY_I,L"I",AM_K,0,0,AK_I)
+DEFEVENT(KEY_J,L"J",AM_K,0,0,AK_J)
+DEFEVENT(KEY_K,L"K",AM_K,0,0,AK_K)
+DEFEVENT(KEY_L,L"L",AM_K,0,0,AK_L)
+DEFEVENT(KEY_M,L"M",AM_K,0,0,AK_M)
+DEFEVENT(KEY_N,L"N",AM_K,0,0,AK_N)
+DEFEVENT(KEY_O,L"O",AM_K,0,0,AK_O)
+DEFEVENT(KEY_P,L"P",AM_K,0,0,AK_P)
+DEFEVENT(KEY_Q,L"Q",AM_K,0,0,AK_Q)
+DEFEVENT(KEY_R,L"R",AM_K,0,0,AK_R)
+DEFEVENT(KEY_S,L"S",AM_K,0,0,AK_S)
+DEFEVENT(KEY_T,L"T",AM_K,0,0,AK_T)
+DEFEVENT(KEY_U,L"U",AM_K,0,0,AK_U)
+DEFEVENT(KEY_V,L"V",AM_K,0,0,AK_V)
+DEFEVENT(KEY_W,L"W",AM_K,0,0,AK_W)
+DEFEVENT(KEY_X,L"X",AM_K,0,0,AK_X)
+DEFEVENT(KEY_Y,L"Y",AM_K,0,0,AK_Y)
+DEFEVENT(KEY_Z,L"Z",AM_K,0,0,AK_Z)
+
+DEFEVENT(KEY_ENTER,L"Numpad Enter",AM_K,0,0,AK_ENT)
+DEFEVENT(KEY_NP_0,L"Numpad 0",AM_K,0,0,AK_NP0)
+DEFEVENT(KEY_NP_1,L"Numpad 1",AM_K,0,0,AK_NP1)
+DEFEVENT(KEY_NP_2,L"Numpad 2",AM_K,0,0,AK_NP2)
+DEFEVENT(KEY_NP_3,L"Numpad 3",AM_K,0,0,AK_NP3)
+DEFEVENT(KEY_NP_4,L"Numpad 4",AM_K,0,0,AK_NP4)
+DEFEVENT(KEY_NP_5,L"Numpad 5",AM_K,0,0,AK_NP5)
+DEFEVENT(KEY_NP_6,L"Numpad 6",AM_K,0,0,AK_NP6)
+DEFEVENT(KEY_NP_7,L"Numpad 7",AM_K,0,0,AK_NP7)
+DEFEVENT(KEY_NP_8,L"Numpad 8",AM_K,0,0,AK_NP8)
+DEFEVENT(KEY_NP_9,L"Numpad 9",AM_K,0,0,AK_NP9)
+DEFEVENT(KEY_NP_PERIOD,L"Numpad Period",AM_K,0,0,AK_NPDEL)
+DEFEVENT(KEY_NP_ADD,L"Numpad Plus",AM_K,0,0,AK_NPADD)
+DEFEVENT(KEY_NP_SUB,L"Numpad Minus",AM_K,0,0,AK_NPSUB)
+DEFEVENT(KEY_NP_MUL,L"Numpad Multiply",AM_K,0,0,AK_NPMUL)
+DEFEVENT(KEY_NP_DIV,L"Numpad Divide",AM_K,0,0,AK_NPDIV)
+DEFEVENT(KEY_NP_LPAREN,L"Numpad Left Parenthesis",AM_K,0,0,AK_NPLPAREN)
+DEFEVENT(KEY_NP_RPAREN,L"Numpad Right Parenthesis",AM_K,0,0,AK_NPRPAREN)
+DEFEVENT(KEY_2B,L"Keycode 0x2b",AM_K,0,0,0x2b)
+DEFEVENT(KEY_30,L"Keycode 0x30",AM_K,0,0,0x30)
+
+DEFEVENT(KEY_BACKQUOTE,L"Back Quote",AM_K,0,0,AK_BACKQUOTE)
+DEFEVENT(KEY_1,L"1",AM_K,0,0,AK_1)
+DEFEVENT(KEY_2,L"2",AM_K,0,0,AK_2)
+DEFEVENT(KEY_3,L"3",AM_K,0,0,AK_3)
+DEFEVENT(KEY_4,L"4",AM_K,0,0,AK_4)
+DEFEVENT(KEY_5,L"5",AM_K,0,0,AK_5)
+DEFEVENT(KEY_6,L"6",AM_K,0,0,AK_6)
+DEFEVENT(KEY_7,L"7",AM_K,0,0,AK_7)
+DEFEVENT(KEY_8,L"8",AM_K,0,0,AK_8)
+DEFEVENT(KEY_9,L"9",AM_K,0,0,AK_9)
+DEFEVENT(KEY_0,L"0",AM_K,0,0,AK_0)
+DEFEVENT(KEY_SUB,L"Minus",AM_K,0,0,AK_MINUS)
+DEFEVENT(KEY_EQUALS,L"Equals",AM_K,0,0,AK_EQUAL)
+DEFEVENT(KEY_BACKSLASH,L"Backslash",AM_K,0,0,AK_BACKSLASH)
+
+DEFEVENT(KEY_LEFTBRACKET,L"Left Bracket",AM_K,0,0,AK_LBRACKET)
+DEFEVENT(KEY_RIGHTBRACKET,L"Right Bracket",AM_K,0,0,AK_RBRACKET)
+DEFEVENT(KEY_SEMICOLON,L"Semicolon",AM_K,0,0,AK_SEMICOLON)
+DEFEVENT(KEY_SINGLEQUOTE,L"Single Quote",AM_K,0,0,AK_QUOTE)
+DEFEVENT(KEY_COMMA,L"Comma",AM_K,0,0,AK_COMMA)
+DEFEVENT(KEY_PERIOD,L"Period",AM_K,0,0,AK_PERIOD)
+DEFEVENT(KEY_DIV,L"Slash",AM_K,0,0,AK_SLASH)
+
+// DEFEVENT(KEY_,L"",AM_K,0,0,0x)
/* mouse wheel "keys" */
-DEFEVENT(MOUSEWHEEL_DOWN,"Mouse Wheel Down",AM_K,0,0,0x7a)
-DEFEVENT(MOUSEWHEEL_UP,"Mouse Wheel Up",AM_K,0,0,0x7b)
+DEFEVENT(MOUSEWHEEL_DOWN,L"Mouse Wheel Down",AM_K,0,0,0x7a)
+DEFEVENT(MOUSEWHEEL_UP,L"Mouse Wheel Up",AM_K,0,0,0x7b)
/* misc */
-DEFEVENT(KEY_CDTV_STOP,"CDTV Stop",AM_K,0,0,0x72)
-DEFEVENT(KEY_CDTV_PLAYPAUSE,"CDTV Play/Pause",AM_K,0,0,0x73)
-DEFEVENT(KEY_CDTV_PREV,"CDTV Previous",AM_K,0,0,0x74)
-DEFEVENT(KEY_CDTV_NEXT,"CDTV Next",AM_K,0,0,0x75)
-DEFEVENT(KEY_CDTV_REW,"CDTV Rewind",AM_K,0,0,0x76)
-DEFEVENT(KEY_CDTV_FF,"CDTV Fast Forward",AM_K,0,0,0x77)
-
-DEFEVENT(KEY_0E,"Keycode 0x0E",AM_K,0,0,0x0e)
-
-DEFEVENT(KEY_1C,"Keycode 0x1C",AM_K,0,0,0x1c)
-
-DEFEVENT(KEY_2C,"Keycode 0x2C",AM_K,0,0,0x2C)
-
-DEFEVENT(KEY_3B,"Keycode 0x3B",AM_K,0,0,0x3b)
-DEFEVENT(KEY_47,"Keycode 0x47",AM_K,0,0,0x47)
-
-DEFEVENT(KEY_48,"Keycode 0x48",AM_K,0,0,0x48)
-DEFEVENT(KEY_49,"Keycode 0x49",AM_K,0,0,0x49)
-DEFEVENT(KEY_4B,"Keycode 0x4B",AM_K,0,0,0x4b)
-
-DEFEVENT(KEY_68,"Keycode 0x68",AM_K,0,0,0x68)
-DEFEVENT(KEY_69,"Keycode 0x69",AM_K,0,0,0x69)
-DEFEVENT(KEY_6A,"Keycode 0x6A",AM_K,0,0,0x6a)
-DEFEVENT(KEY_6B,"Keycode 0x6B",AM_K,0,0,0x6b)
-DEFEVENT(KEY_6C,"Keycode 0x6C",AM_K,0,0,0x6c)
-DEFEVENT(KEY_6D,"Keycode 0x6D",AM_K,0,0,0x6d)
-DEFEVENT(KEY_6E,"Keycode 0x6E",AM_K,0,0,0x6e)
-DEFEVENT(KEY_6F,"Keycode 0x6F",AM_K,0,0,0x6f)
-
-DEFEVENT(KEY_70,"Keycode 0x70",AM_K,0,0,0x70)
-DEFEVENT(KEY_71,"Keycode 0x71",AM_K,0,0,0x71)
-DEFEVENT(KEY_78,"Keycode 0x78 (Reset Warning)",AM_K,0,0,0x78)
-DEFEVENT(KEY_79,"Keycode 0x79",AM_K,0,0,0x79)
-DEFEVENT(KEY_7A,"Keycode 0x7A",AM_K,0,0,0x7a)
-DEFEVENT(KEY_7B,"Keycode 0x7B",AM_K,0,0,0x7b)
-DEFEVENT(KEY_7C,"Keycode 0x7C",AM_K,0,0,0x7c)
-DEFEVENT(KEY_7D,"Keycode 0x7D",AM_K,0,0,0x7d)
-DEFEVENT(KEY_7E,"Keycode 0x7E",AM_K,0,0,0x7e)
-DEFEVENT(KEY_7F,"Keycode 0x7F",AM_K,0,0,0x7f)
+DEFEVENT(KEY_CDTV_STOP,L"CDTV Stop",AM_K,0,0,0x72)
+DEFEVENT(KEY_CDTV_PLAYPAUSE,L"CDTV Play/Pause",AM_K,0,0,0x73)
+DEFEVENT(KEY_CDTV_PREV,L"CDTV Previous",AM_K,0,0,0x74)
+DEFEVENT(KEY_CDTV_NEXT,L"CDTV Next",AM_K,0,0,0x75)
+DEFEVENT(KEY_CDTV_REW,L"CDTV Rewind",AM_K,0,0,0x76)
+DEFEVENT(KEY_CDTV_FF,L"CDTV Fast Forward",AM_K,0,0,0x77)
+
+DEFEVENT(KEY_0E,L"Keycode 0x0E",AM_K,0,0,0x0e)
+
+DEFEVENT(KEY_1C,L"Keycode 0x1C",AM_K,0,0,0x1c)
+
+DEFEVENT(KEY_2C,L"Keycode 0x2C",AM_K,0,0,0x2C)
+
+DEFEVENT(KEY_3B,L"Keycode 0x3B",AM_K,0,0,0x3b)
+DEFEVENT(KEY_47,L"Keycode 0x47",AM_K,0,0,0x47)
+
+DEFEVENT(KEY_48,L"Keycode 0x48",AM_K,0,0,0x48)
+DEFEVENT(KEY_49,L"Keycode 0x49",AM_K,0,0,0x49)
+DEFEVENT(KEY_4B,L"Keycode 0x4B",AM_K,0,0,0x4b)
+
+DEFEVENT(KEY_68,L"Keycode 0x68",AM_K,0,0,0x68)
+DEFEVENT(KEY_69,L"Keycode 0x69",AM_K,0,0,0x69)
+DEFEVENT(KEY_6A,L"Keycode 0x6A",AM_K,0,0,0x6a)
+DEFEVENT(KEY_6B,L"Keycode 0x6B",AM_K,0,0,0x6b)
+DEFEVENT(KEY_6C,L"Keycode 0x6C",AM_K,0,0,0x6c)
+DEFEVENT(KEY_6D,L"Keycode 0x6D",AM_K,0,0,0x6d)
+DEFEVENT(KEY_6E,L"Keycode 0x6E",AM_K,0,0,0x6e)
+DEFEVENT(KEY_6F,L"Keycode 0x6F",AM_K,0,0,0x6f)
+
+DEFEVENT(KEY_70,L"Keycode 0x70",AM_K,0,0,0x70)
+DEFEVENT(KEY_71,L"Keycode 0x71",AM_K,0,0,0x71)
+DEFEVENT(KEY_78,L"Keycode 0x78 (Reset Warning)",AM_K,0,0,0x78)
+DEFEVENT(KEY_79,L"Keycode 0x79",AM_K,0,0,0x79)
+DEFEVENT(KEY_7A,L"Keycode 0x7A",AM_K,0,0,0x7a)
+DEFEVENT(KEY_7B,L"Keycode 0x7B",AM_K,0,0,0x7b)
+DEFEVENT(KEY_7C,L"Keycode 0x7C",AM_K,0,0,0x7c)
+DEFEVENT(KEY_7D,L"Keycode 0x7D",AM_K,0,0,0x7d)
+DEFEVENT(KEY_7E,L"Keycode 0x7E",AM_K,0,0,0x7e)
+DEFEVENT(KEY_7F,L"Keycode 0x7F",AM_K,0,0,0x7f)
/* special */
-DEFEVENT(SPC_ENTERGUI,"Enter GUI",AM_K,0,0,AKS_ENTERGUI)
-DEFEVENT(SPC_SCREENSHOT,"Screenshot",AM_K,0,0,AKS_SCREENSHOT)
-DEFEVENT(SPC_FREEZEBUTTON,"Activate Cartridge",AM_K,0,0,AKS_FREEZEBUTTON)
-DEFEVENT(SPC_FLOPPY0,"Change disk in DF0:",AM_K,0,0,AKS_FLOPPY0)
-DEFEVENT(SPC_FLOPPY1,"Change disk in DF1:",AM_K,0,0,AKS_FLOPPY1)
-DEFEVENT(SPC_FLOPPY2,"Change disk in DF2:",AM_K,0,0,AKS_FLOPPY2)
-DEFEVENT(SPC_FLOPPY3,"Change disk in DF3:",AM_K,0,0,AKS_FLOPPY3)
-DEFEVENT(SPC_EFLOPPY0,"Eject disk in DF0:",AM_K,0,0,AKS_EFLOPPY0)
-DEFEVENT(SPC_EFLOPPY1,"Eject disk in DF1:",AM_K,0,0,AKS_EFLOPPY1)
-DEFEVENT(SPC_EFLOPPY2,"Eject disk in DF2:",AM_K,0,0,AKS_EFLOPPY2)
-DEFEVENT(SPC_EFLOPPY3,"Eject disk in DF3:",AM_K,0,0,AKS_EFLOPPY3)
-DEFEVENT(SPC_PAUSE,"Pause emulation",AM_K,0,0,AKS_PAUSE)
-DEFEVENT(SPC_WARP,"Warp mode",AM_K,0,0,AKS_WARP)
-DEFEVENT(SPC_INHIBITSCREEN,"Toggle screen updates",AM_K,0,0,AKS_INHIBITSCREEN)
-DEFEVENT(SPC_IRQ7,"Level 7 interrupt",AM_K,0,0,AKS_IRQ7)
-DEFEVENT(SPC_STATEREWIND,"Load previous state capture",AM_K,0,0,AKS_STATEREWIND)
-DEFEVENT(SPC_VOLUME_DOWN,"Decrease volume level",AM_K,0,0,AKS_VOLDOWN)
-DEFEVENT(SPC_VOLUME_UP,"Increase volume level",AM_K,0,0,AKS_VOLUP)
-DEFEVENT(SPC_VOLUME_MUTE,"Mute/unmute volume",AM_K,0,0,AKS_VOLMUTE)
-DEFEVENT(SPC_MASTER_VOLUME_DOWN,"Decrease master volume level",AM_K,0,0,AKS_MVOLDOWN)
-DEFEVENT(SPC_MASTER_VOLUME_UP,"Increase master volume level",AM_K,0,0,AKS_MVOLUP)
-DEFEVENT(SPC_MASTER_VOLUME_MUTE,"Mute/unmute master volume",AM_K,0,0,AKS_MVOLMUTE)
-DEFEVENT(SPC_QUIT,"Quit emulator",AM_K,0,0,AKS_QUIT)
-DEFEVENT(SPC_SOFTRESET,"Reset emulation",AM_K,0,0,AKS_SOFTRESET)
-DEFEVENT(SPC_HARDRESET,"Hard reset emulation",AM_K,0,0,AKS_HARDRESET)
-DEFEVENT(SPC_ENTERDEBUGGER,"Activate the built-in debugger",AM_K,0,0,AKS_ENTERDEBUGGER)
-DEFEVENT(SPC_STATESAVE,"Quick save state",AM_K,0,0,AKS_STATESAVEQUICK)
-DEFEVENT(SPC_STATERESTORE,"Quick restore state",AM_K,0,0,AKS_STATERESTOREQUICK)
-DEFEVENT(SPC_STATESAVEDIALOG,"Save state",AM_K,0,0,AKS_STATESAVEDIALOG)
-DEFEVENT(SPC_STATERESTOREDIALOG,"Restore state",AM_K,0,0,AKS_STATERESTOREDIALOG)
-DEFEVENT(SPC_TOGGLEFULLSCREEN,"Toggle windowed/fullscreen",AM_K,0,0,AKS_TOGGLEFULLSCREEN)
-DEFEVENT(SPC_TOGGLEMOUSEGRAB,"Toggle between mouse grabbed and un-grabbed",AM_K,0,0,AKS_TOGGLEMOUSEGRAB)
-DEFEVENT(SPC_DECREASE_REFRESHRATE,"Decrease emulation speed",AM_K,0,0,AKS_DECREASEREFRESHRATE)
-DEFEVENT(SPC_INCREASE_REFRESHRATE,"Increase emulation speed",AM_K,0,0,AKS_INCREASEREFRESHRATE)
-DEFEVENT(SPC_SWITCHINTERPOL,"Switch between audio interpolation methods",AM_K,0,0,AKS_SWITCHINTERPOL)
-
-DEFEVENT(SPC_DISKSWAPPER_NEXT,"Next slot in Disk Swapper",AM_K,0,0,AKS_DISKSWAPPER_NEXT)
-DEFEVENT(SPC_DISKSWAPPER_PREV,"Previous slot in Disk Swapper",AM_K,0,0,AKS_DISKSWAPPER_PREV)
-DEFEVENT(SPC_DISKSWAPPER_INSERT0,"Insert disk in current Disk Swapper slot in DF0:",AM_K,0,0,AKS_DISKSWAPPER_INSERT0)
-DEFEVENT(SPC_DISKSWAPPER_INSERT1,"Insert disk in current Disk Swapper slot in DF1:",AM_K,0,0,AKS_DISKSWAPPER_INSERT1)
-DEFEVENT(SPC_DISKSWAPPER_INSERT2,"Insert disk in current Disk Swapper slot in DF2:",AM_K,0,0,AKS_DISKSWAPPER_INSERT2)
-DEFEVENT(SPC_DISKSWAPPER_INSERT3,"Insert disk in current Disk Swapper slot in DF3:",AM_K,0,0,AKS_DISKSWAPPER_INSERT3)
-
-DEFEVENT(SPC_INPUT_CONFIG1,"Select Input Configuration #1",AM_K,0,0,AKS_INPUT_CONFIG_1)
-DEFEVENT(SPC_INPUT_CONFIG2,"Select Input Configuration #2",AM_K,0,0,AKS_INPUT_CONFIG_2)
-DEFEVENT(SPC_INPUT_CONFIG3,"Select Input Configuration #3",AM_K,0,0,AKS_INPUT_CONFIG_3)
-DEFEVENT(SPC_INPUT_CONFIG4,"Select Input Configuration #4",AM_K,0,0,AKS_INPUT_CONFIG_4)
-
-DEFEVENT(SPC_ARCADIA_DIAGNOSTICS,"Arcadia diagnostics dip switch",AM_K,0,0,AKS_ARCADIADIAGNOSTICS)
-DEFEVENT(SPC_ARCADIA_PLAYER1,"Arcadia player 1",AM_K,0,0,AKS_ARCADIAPLY1)
-DEFEVENT(SPC_ARCADIA_PLAYER2,"Arcadia player 2",AM_K,0,0,AKS_ARCADIAPLY2)
-DEFEVENT(SPC_ARCADIA_COIN1,"Arcadia coin player 1",AM_K,0,0,AKS_ARCADIACOIN1)
-DEFEVENT(SPC_ARCADIA_COIN2,"Arcadia coin player 2",AM_K,0,0,AKS_ARCADIACOIN2)
+DEFEVENT(SPC_ENTERGUI,L"Enter GUI",AM_K,0,0,AKS_ENTERGUI)
+DEFEVENT(SPC_SCREENSHOT,L"Screenshot",AM_K,0,0,AKS_SCREENSHOT)
+DEFEVENT(SPC_FREEZEBUTTON,L"Activate Cartridge",AM_K,0,0,AKS_FREEZEBUTTON)
+DEFEVENT(SPC_FLOPPY0,L"Change disk in DF0:",AM_K,0,0,AKS_FLOPPY0)
+DEFEVENT(SPC_FLOPPY1,L"Change disk in DF1:",AM_K,0,0,AKS_FLOPPY1)
+DEFEVENT(SPC_FLOPPY2,L"Change disk in DF2:",AM_K,0,0,AKS_FLOPPY2)
+DEFEVENT(SPC_FLOPPY3,L"Change disk in DF3:",AM_K,0,0,AKS_FLOPPY3)
+DEFEVENT(SPC_EFLOPPY0,L"Eject disk in DF0:",AM_K,0,0,AKS_EFLOPPY0)
+DEFEVENT(SPC_EFLOPPY1,L"Eject disk in DF1:",AM_K,0,0,AKS_EFLOPPY1)
+DEFEVENT(SPC_EFLOPPY2,L"Eject disk in DF2:",AM_K,0,0,AKS_EFLOPPY2)
+DEFEVENT(SPC_EFLOPPY3,L"Eject disk in DF3:",AM_K,0,0,AKS_EFLOPPY3)
+DEFEVENT(SPC_PAUSE,L"Pause emulation",AM_K,0,0,AKS_PAUSE)
+DEFEVENT(SPC_WARP,L"Warp mode",AM_K,0,0,AKS_WARP)
+DEFEVENT(SPC_INHIBITSCREEN,L"Toggle screen updates",AM_K,0,0,AKS_INHIBITSCREEN)
+DEFEVENT(SPC_IRQ7,L"Level 7 interrupt",AM_K,0,0,AKS_IRQ7)
+DEFEVENT(SPC_STATEREWIND,L"Load previous state capture",AM_K,0,0,AKS_STATEREWIND)
+DEFEVENT(SPC_VOLUME_DOWN,L"Decrease volume level",AM_K,0,0,AKS_VOLDOWN)
+DEFEVENT(SPC_VOLUME_UP,L"Increase volume level",AM_K,0,0,AKS_VOLUP)
+DEFEVENT(SPC_VOLUME_MUTE,L"Mute/unmute volume",AM_K,0,0,AKS_VOLMUTE)
+DEFEVENT(SPC_MASTER_VOLUME_DOWN,L"Decrease master volume level",AM_K,0,0,AKS_MVOLDOWN)
+DEFEVENT(SPC_MASTER_VOLUME_UP,L"Increase master volume level",AM_K,0,0,AKS_MVOLUP)
+DEFEVENT(SPC_MASTER_VOLUME_MUTE,L"Mute/unmute master volume",AM_K,0,0,AKS_MVOLMUTE)
+DEFEVENT(SPC_QUIT,L"Quit emulator",AM_K,0,0,AKS_QUIT)
+DEFEVENT(SPC_SOFTRESET,L"Reset emulation",AM_K,0,0,AKS_SOFTRESET)
+DEFEVENT(SPC_HARDRESET,L"Hard reset emulation",AM_K,0,0,AKS_HARDRESET)
+DEFEVENT(SPC_ENTERDEBUGGER,L"Activate the built-in debugger",AM_K,0,0,AKS_ENTERDEBUGGER)
+DEFEVENT(SPC_STATESAVE,L"Quick save state",AM_K,0,0,AKS_STATESAVEQUICK)
+DEFEVENT(SPC_STATERESTORE,L"Quick restore state",AM_K,0,0,AKS_STATERESTOREQUICK)
+DEFEVENT(SPC_STATESAVEDIALOG,L"Save state",AM_K,0,0,AKS_STATESAVEDIALOG)
+DEFEVENT(SPC_STATERESTOREDIALOG,L"Restore state",AM_K,0,0,AKS_STATERESTOREDIALOG)
+DEFEVENT(SPC_TOGGLEFULLSCREEN,L"Toggle windowed/fullscreen",AM_K,0,0,AKS_TOGGLEFULLSCREEN)
+DEFEVENT(SPC_TOGGLEMOUSEGRAB,L"Toggle between mouse grabbed and un-grabbed",AM_K,0,0,AKS_TOGGLEMOUSEGRAB)
+DEFEVENT(SPC_DECREASE_REFRESHRATE,L"Decrease emulation speed",AM_K,0,0,AKS_DECREASEREFRESHRATE)
+DEFEVENT(SPC_INCREASE_REFRESHRATE,L"Increase emulation speed",AM_K,0,0,AKS_INCREASEREFRESHRATE)
+DEFEVENT(SPC_SWITCHINTERPOL,L"Switch between audio interpolation methods",AM_K,0,0,AKS_SWITCHINTERPOL)
+
+DEFEVENT(SPC_DISKSWAPPER_NEXT,L"Next slot in Disk Swapper",AM_K,0,0,AKS_DISKSWAPPER_NEXT)
+DEFEVENT(SPC_DISKSWAPPER_PREV,L"Previous slot in Disk Swapper",AM_K,0,0,AKS_DISKSWAPPER_PREV)
+DEFEVENT(SPC_DISKSWAPPER_INSERT0,L"Insert disk in current Disk Swapper slot in DF0:",AM_K,0,0,AKS_DISKSWAPPER_INSERT0)
+DEFEVENT(SPC_DISKSWAPPER_INSERT1,L"Insert disk in current Disk Swapper slot in DF1:",AM_K,0,0,AKS_DISKSWAPPER_INSERT1)
+DEFEVENT(SPC_DISKSWAPPER_INSERT2,L"Insert disk in current Disk Swapper slot in DF2:",AM_K,0,0,AKS_DISKSWAPPER_INSERT2)
+DEFEVENT(SPC_DISKSWAPPER_INSERT3,L"Insert disk in current Disk Swapper slot in DF3:",AM_K,0,0,AKS_DISKSWAPPER_INSERT3)
+
+DEFEVENT(SPC_INPUT_CONFIG1,L"Select Input Configuration #1",AM_K,0,0,AKS_INPUT_CONFIG_1)
+DEFEVENT(SPC_INPUT_CONFIG2,L"Select Input Configuration #2",AM_K,0,0,AKS_INPUT_CONFIG_2)
+DEFEVENT(SPC_INPUT_CONFIG3,L"Select Input Configuration #3",AM_K,0,0,AKS_INPUT_CONFIG_3)
+DEFEVENT(SPC_INPUT_CONFIG4,L"Select Input Configuration #4",AM_K,0,0,AKS_INPUT_CONFIG_4)
+
+DEFEVENT(SPC_ARCADIA_DIAGNOSTICS,L"Arcadia diagnostics dip switch",AM_K,0,0,AKS_ARCADIADIAGNOSTICS)
+DEFEVENT(SPC_ARCADIA_PLAYER1,L"Arcadia player 1",AM_K,0,0,AKS_ARCADIAPLY1)
+DEFEVENT(SPC_ARCADIA_PLAYER2,L"Arcadia player 2",AM_K,0,0,AKS_ARCADIAPLY2)
+DEFEVENT(SPC_ARCADIA_COIN1,L"Arcadia coin player 1",AM_K,0,0,AKS_ARCADIACOIN1)
+DEFEVENT(SPC_ARCADIA_COIN2,L"Arcadia coin player 2",AM_K,0,0,AKS_ARCADIACOIN2)
}
case 2: /* (d16,PC) */
{
- uae_u32 address=start_pc+((char *)comp_pc_p-(char *)start_pc_p)+
+ uae_u32 address=start_pc+((TCHAR *)comp_pc_p-(TCHAR *)start_pc_p)+
m68k_pc_offset;
uae_s32 PC16off =(uae_s32)(uae_s16)comp_get_iword((m68k_pc_offset+=2)-2);
mov_l_ri(S1,address+PC16off);
float si = (float) li;
if (li == (int) si) {
- //write_log ("converted immediate LONG constant to SINGLE\n");
+ //write_log (L"converted immediate LONG constant to SINGLE\n");
fmovs_ri(treg,*(uae_u32 *)&si);
return 1;
}
- //write_log ("immediate LONG constant\n");
+ //write_log (L"immediate LONG constant\n");
fmovl_ri(treg,li);
return 2;
}
case 1:
- //write_log ("immediate SINGLE constant\n");
+ //write_log (L"immediate SINGLE constant\n");
fmovs_ri(treg,comp_get_ilong(m68k_pc_offset-4));
return 1;
case 2:
- //write_log ("immediate LONG DOUBLE constant\n");
+ //write_log (L"immediate LONG DOUBLE constant\n");
fmov_ext_ri(treg,comp_get_ilong(m68k_pc_offset-4),
comp_get_ilong(m68k_pc_offset-8),
(comp_get_ilong(m68k_pc_offset-12)>>16)&0xffff);
{
float si = (float)(uae_s16)comp_get_iword(m68k_pc_offset-2);
- //write_log ("converted immediate WORD constant to SINGLE\n");
+ //write_log (L"converted immediate WORD constant to SINGLE\n");
fmovs_ri(treg,*(uae_u32 *)&si);
return 1;
}
float si = (float)*(double *)longarray;
if (*(double *)longarray == (double)si) {
- //write_log ("SPEED GAIN: converted a DOUBLE constant to SINGLE\n");
+ //write_log (L"SPEED GAIN: converted a DOUBLE constant to SINGLE\n");
fmovs_ri(treg,*(uae_u32 *)&si);
return 1;
}
- //write_log ("immediate DOUBLE constant\n");
+ //write_log (L"immediate DOUBLE constant\n");
fmov_ri(treg,longarray[0],longarray[1]);
return 2;
}
{
float si = (float)(uae_s8)comp_get_ibyte(m68k_pc_offset-2);
- //write_log ("immediate BYTE constant converted to SINGLE\n");
+ //write_log (L"immediate BYTE constant converted to SINGLE\n");
fmovs_ri(treg,*(uae_u32 *)&si);
return 1;
}
break;
}
default: /* All other modes are not allowed for FPx to <EA> */
- write_log ("JIT FMOVE FPx,<EA> Mode is not allowed %04x %04x\n",opcode,extra);
+ write_log (L"JIT FMOVE FPx,<EA> Mode is not allowed %04x %04x\n",opcode,extra);
return -1;
}
}
}
#if DEBUG_FPP
- write_log ("JIT: fscc_opp at %08lx\n", M68K_GETPC);
+ write_log (L"JIT: fscc_opp at %08lx\n", M68K_GETPC);
#endif
if (extra&0x20) { /* only cc from 00 to 1f are defined */
mov_l_rr((opcode & 7)+8,ad);
return;
} /* no break */
- write_log ("fallback from JIT FMOVEM dynamic register list\n");
+ write_log (L"fallback from JIT FMOVEM dynamic register list\n");
FAIL(1);
return;
#endif
case 2: /* from <EA> to FPx */
dont_care_fflags();
if ((extra & 0xfc00) == 0x5c00) { /* FMOVECR */
- //write_log ("JIT FMOVECR %x\n", opmode);
+ //write_log (L"JIT FMOVECR %x\n", opmode);
switch (opmode) {
case 0x00:
fmov_pi(dreg);
fmov_rr(FP_RESULT,dreg);
return;
default:
- write_log ("Unsupported JIT-FPU instruction: 0x%04x %04x\n",opcode,extra);
+ write_log (L"Unsupported JIT-FPU instruction: 0x%04x %04x\n",opcode,extra);
FAIL(1);
return;
}
{
#ifdef JIT_DEBUG
if (d!=MUL_NREG1 || s!=MUL_NREG2) {
- write_log ("JIT: Bad register in IMUL: d=%d, s=%d\n",d,s);
+ write_log (L"JIT: Bad register in IMUL: d=%d, s=%d\n",d,s);
abort();
}
#endif
{
#ifdef JIT_DEBUG
if (d!=MUL_NREG1 || s!=MUL_NREG2) {
- write_log ("JIT: Bad register in MUL: d=%d, s=%d\n",d,s);
+ write_log (L"JIT: Bad register in MUL: d=%d, s=%d\n",d,s);
abort();
}
#endif
if (pExceptRecord)
addr = (uae_u32)(pExceptRecord->ExceptionInformation[1]);
#ifdef JIT_DEBUG
- write_log ("JIT: fault address is 0x%x at 0x%x\n",addr,i);
+ write_log (L"JIT: fault address is 0x%x at 0x%x\n",addr,i);
#endif
if (!canbang || !currprefs.cachesize)
return EXCEPTION_CONTINUE_SEARCH;
if (in_handler)
- write_log ("JIT: Argh --- Am already in a handler. Shouldn't happen!\n");
+ write_log (L"JIT: Argh --- Am already in a handler. Shouldn't happen!\n");
if (canbang && i>=compiled_code && i<=current_compile_p) {
if (*i==0x66) {
if (r!=-1) {
void* pr=NULL;
#ifdef JIT_DEBUG
- write_log ("JIT: register was %d, direction was %d, size was %d\n",r,dir,size);
+ write_log (L"JIT: register was %d, direction was %d, size was %d\n",r,dir,size);
#endif
switch(r) {
#ifdef JIT_DEBUG
if ((addr>=0x10000000 && addr<0x40000000) ||
(addr>=0x50000000)) {
- write_log ("JIT: Suspicious address 0x%x in SEGV handler.\n",addr);
+ write_log (L"JIT: Suspicious address 0x%x in SEGV handler.\n",addr);
}
#endif
if (dir==SIG_READ) {
}
}
#ifdef JIT_DEBUG
- write_log ("JIT: Handled one access!\n");
+ write_log (L"JIT: Handled one access!\n");
#endif
fflush(stdout);
segvcount++;
#ifdef JIT_DEBUG
if ((addr>=0x10000000 && addr<0x40000000) ||
(addr>=0x50000000)) {
- write_log ("JIT: Suspicious address 0x%x in SEGV handler.\n",addr);
+ write_log (L"JIT: Suspicious address 0x%x in SEGV handler.\n",addr);
}
#endif
emit_long((uae_u32)veccode-(uae_u32)target-4);
#ifdef JIT_DEBUG
- write_log ("JIT: Create jump to %p\n",veccode);
- write_log ("JIT: Handled one access!\n");
+ write_log (L"JIT: Create jump to %p\n",veccode);
+ write_log (L"JIT: Handled one access!\n");
#endif
segvcount++;
(uae_u8*)bi->direct_handler<=i &&
(uae_u8*)bi->nexthandler>i) {
#ifdef JIT_DEBUG
- write_log ("JIT: deleted trigger (%p<%p<%p) %p\n",
+ write_log (L"JIT: deleted trigger (%p<%p<%p) %p\n",
bi->handler,
i,
bi->nexthandler,
(uae_u8*)bi->direct_handler<=i &&
(uae_u8*)bi->nexthandler>i) {
#ifdef JIT_DEBUG
- write_log ("JIT: deleted trigger (%p<%p<%p) %p\n",
+ write_log (L"JIT: deleted trigger (%p<%p<%p) %p\n",
bi->handler,
i,
bi->nexthandler,
bi=bi->next;
}
#ifdef JIT_DEBUG
- write_log ("JIT: Huh? Could not find trigger!\n");
+ write_log (L"JIT: Huh? Could not find trigger!\n");
#endif
return EXCEPTION_CONTINUE_EXECUTION;
}
}
- write_log ("JIT: Can't handle access %08X!\n", i);
+ write_log (L"JIT: Can't handle access %08X!\n", i);
#if 0
if (i)
{
int j;
for (j=0;j<10;j++) {
- write_log ("JIT: instruction byte %2d is 0x%02x\n",j,i[j]);
+ write_log (L"JIT: instruction byte %2d is 0x%02x\n",j,i[j]);
}
}
- write_log ("Please send the above info (starting at \"fault address\") to\n"
- "bmeyer@csse.monash.edu.au\n"
- "This shouldn't happen ;-)\n");
+ write_log (L"Please send the above info (starting at \"fault address\") to\n"
+ L"bmeyer@csse.monash.edu.au\n"
+ L"This shouldn't happen ;-)\n");
#endif
return EXCEPTION_CONTINUE_SEARCH;
}
int len=0;
int j;
- write_log ("JIT: fault address is %08x at %08x\n",sc.cr2,sc.eip);
+ write_log (L"JIT: fault address is %08x at %08x\n",sc.cr2,sc.eip);
if (!canbang)
- write_log ("JIT: Not happy! Canbang is 0 in SIGSEGV handler!\n");
+ write_log (L"JIT: Not happy! Canbang is 0 in SIGSEGV handler!\n");
if (in_handler)
- write_log ("JIT: Argh --- Am already in a handler. Shouldn't happen!\n");
+ write_log (L"JIT: Argh --- Am already in a handler. Shouldn't happen!\n");
if (canbang && i>=compiled_code && i<=current_compile_p) {
if (*i==0x66) {
if (r!=-1) {
void* pr=NULL;
- write_log ("JIT: register was %d, direction was %d, size was %d\n",r,dir,size);
+ write_log (L"JIT: register was %d, direction was %d, size was %d\n",r,dir,size);
switch(r) {
case 0: pr=&(sc.eax); break;
if ((addr>=0x10000000 && addr<0x40000000) ||
(addr>=0x50000000)) {
- write_log ("JIT: Suspicious address in %x SEGV handler.\n",addr);
+ write_log (L"JIT: Suspicious address in %x SEGV handler.\n",addr);
}
if (dir==SIG_READ) {
switch(size) {
default: abort();
}
}
- write_log ("JIT: Handled one access!\n");
+ write_log (L"JIT: Handled one access!\n");
fflush(stdout);
segvcount++;
sc.eip+=len;
if ((addr>=0x10000000 && addr<0x40000000) ||
(addr>=0x50000000)) {
- write_log ("JIT: Suspicious address 0x%x in SEGV handler.\n",addr);
+ write_log (L"JIT: Suspicious address 0x%x in SEGV handler.\n",addr);
}
target=(uae_u8*)sc.eip;
vecbuf[i]=target[i];
emit_byte(0xe9);
emit_long((uae_u32)veccode-(uae_u32)target-4);
- write_log ("JIT: Create jump to %p\n",veccode);
+ write_log (L"JIT: Create jump to %p\n",veccode);
- write_log ("JIT: Handled one access!\n");
+ write_log (L"JIT: Handled one access!\n");
segvcount++;
target=veccode;
if (bi->handler &&
(uae_u8*)bi->direct_handler<=i &&
(uae_u8*)bi->nexthandler>i) {
- write_log ("JIT: deleted trigger (%p<%p<%p) %p\n",
+ write_log (L"JIT: deleted trigger (%p<%p<%p) %p\n",
bi->handler,
i,
bi->nexthandler,
if (bi->handler &&
(uae_u8*)bi->direct_handler<=i &&
(uae_u8*)bi->nexthandler>i) {
- write_log ("JIT: deleted trigger (%p<%p<%p) %p\n",
+ write_log (L"JIT: deleted trigger (%p<%p<%p) %p\n",
bi->handler,
i,
bi->nexthandler,
}
bi=bi->next;
}
- write_log ("JIT: Huh? Could not find trigger!\n");
+ write_log (L"JIT: Huh? Could not find trigger!\n");
return;
}
}
- write_log ("JIT: Can't handle access!\n");
+ write_log (L"JIT: Can't handle access!\n");
for (j=0;j<10;j++) {
- write_log ("JIT: instruction byte %2d is %02x\n",j,i[j]);
+ write_log (L"JIT: instruction byte %2d is %02x\n",j,i[j]);
}
#if 0
- write_log ("Please send the above info (starting at \"fault address\") to\n"
+ write_log (L"Please send the above info (starting at \"fault address\") to\n"
"bmeyer@csse.monash.edu.au\n"
"This shouldn't happen ;-)\n");
fflush(stdout);
align_loops = x86_alignments[c->x86_processor].align_loop;
align_jumps = x86_alignments[c->x86_processor].align_jump;
}
-
- write_log ("CPUID level=%d, Family=%d, Model=%d, Mask=%d, Vendor=%s [%d]\n",
- c->cpuid_level, c->x86, c->x86_model, c->x86_mask, c->x86_vendor_id, c->x86_vendor);
+ {
+ TCHAR *s = au (c->x86_vendor_id);
+ write_log (L"CPUID level=%d, Family=%d, Model=%d, Mask=%d, Vendor=%s [%d]\n",
+ c->cpuid_level, c->x86, c->x86_model, c->x86_mask, s, c->x86_vendor);
+ xfree (s);
+ }
}
#if 0
}
}}}}
if (mismatch)
- write_log ("Target CPU defines all flags on BSF instruction\n");
+ write_log (L"Target CPU defines all flags on BSF instruction\n");
return !mismatch;
}
#endif
x=cpuid(0);
maxlev=x.eax;
- write_log ("Max CPUID level=%d Processor is %c%c%c%c%c%c%c%c%c%c%c%c\n",
+ write_log (L"Max CPUID level=%d Processor is %c%c%c%c%c%c%c%c%c%c%c%c\n",
maxlev,
x.ebx,
x.ebx>>8,
have_rat_stall=0;
#endif
#if 0
- write_log ("have_cmov=%d, avoid_cmov=%d, have_rat_stall=%d\n",
+ write_log (L"have_cmov=%d, avoid_cmov=%d, have_rat_stall=%d\n",
have_cmov,currprefs.avoid_cmov,have_rat_stall);
if (currprefs.avoid_cmov) {
- write_log ("Disabling cmov use despite processor claiming to support it!\n");
+ write_log (L"Disabling cmov use despite processor claiming to support it!\n");
have_cmov=0;
}
#else
/* Dear Bernie, I don't want to keep around options which are useless, and not
represented in the GUI anymore... Is this okay? */
- write_log ("have_cmov=%d, have_rat_stall=%d\n", have_cmov, have_rat_stall);
+ write_log (L"have_cmov=%d, have_rat_stall=%d\n", have_cmov, have_rat_stall);
#endif
#if 0 /* For testing of non-cmov code! */
have_cmov=0;
if (live.spos[r]<0)
abort();
if (live.tos<live.spos[r]) {
- write_log ("JIT: Looking for spos for fnreg %d\n",r);
+ write_log (L"JIT: Looking for spos for fnreg %d\n",r);
abort();
}
return live.tos-live.spos[r];
{
if (live.spos[r]<0) {
- // write_log ("usereg wants to push reg %d onto the x87 stack calling make_tos\n", r);
+ // write_log (L"usereg wants to push reg %d onto the x87 stack calling make_tos\n", r);
make_tos(r);
}
}
int ds;
if (s==d) {
- //write_log ("FSINCOS src = dest\n");
+ //write_log (L"FSINCOS src = dest\n");
make_tos(s);
emit_byte(0xd9);
emit_byte(0xfb); /* fsincos sin(x) push cos(x) */
int ds;
if (live.spos[d]==live.tos && live.spos[s]==live.tos-1) {
- //write_log ("fscale found x in TOS-1 and y in TOS\n");
+ //write_log (L"fscale found x in TOS-1 and y in TOS\n");
emit_byte(0xd9);
emit_byte(0xfd); /* fscale y*(2^x) */
}
int ds;
if (live.spos[d]==live.tos && live.spos[s]==live.tos-1) {
- //write_log ("frem found x in TOS-1 and y in TOS\n");
+ //write_log (L"frem found x in TOS-1 and y in TOS\n");
emit_byte(0xd9);
emit_byte(0xf8); /* fprem rem(y/x) */
}
int ds;
if (live.spos[d]==live.tos && live.spos[s]==live.tos-1) {
- //write_log ("frem1 found x in TOS-1 and y in TOS\n");
+ //write_log (L"frem1 found x in TOS-1 and y in TOS\n");
emit_byte(0xd9);
emit_byte(0xf5); /* fprem1 rem1(y/x) */
}
STATIC_INLINE void set_dhtu(blockinfo* bi, void* dh)
{
- //write_log ("JIT: bi is %p\n",bi);
+ //write_log (L"JIT: bi is %p\n",bi);
if (dh!=bi->direct_handler_to_use) {
dependency* x=bi->deplist;
- //write_log ("JIT: bi->deplist=%p\n",bi->deplist);
+ //write_log (L"JIT: bi->deplist=%p\n",bi->deplist);
while (x) {
- //write_log ("JIT: x is %p\n",x);
- //write_log ("JIT: x->next is %p\n",x->next);
- //write_log ("JIT: x->prev_p is %p\n",x->prev_p);
+ //write_log (L"JIT: x is %p\n",x);
+ //write_log (L"JIT: x->next is %p\n",x->next);
+ //write_log (L"JIT: x->prev_p is %p\n",x->prev_p);
if (x->jmp_off) {
adjust_jmpdep(x,dh);
count++;
}
}
- write_log ("JIT: count=%d\n",count);
+ write_log (L"JIT: count=%d\n",count);
for (i=0;i<N_REGS;i++) { // FIXME --- don't do dirty yet
s->nat[i].dirtysize=0;
}
changed = 1;
if (currprefs.cachesize)
- write_log ( "JIT: Reverting to \"indirect\" access, because canbang is zero!\n" );
+ write_log (L"JIT: Reverting to \"indirect\" access, because canbang is zero!\n");
}
if (changed)
- write_log ("JIT: cache=%d. b=%d w=%d l=%d fpu=%d nf=%d const=%d hard=%d\n",
+ write_log (L"JIT: cache=%d. b=%d w=%d l=%d fpu=%d nf=%d const=%d hard=%d\n",
currprefs.cachesize,
currprefs.comptrustbyte, currprefs.comptrustword, currprefs.comptrustlong,
currprefs.compfpu, currprefs.compnf, currprefs.comp_constjump, currprefs.comp_hardflush);
if (!currprefs.compforcesettings) {
int stop=0;
if (currprefs.comptrustbyte!=0 && currprefs.comptrustbyte!=3)
- stop = 1, write_log ("JIT: comptrustbyte is not 'direct' or 'afterpic'\n");
+ stop = 1, write_log (L"JIT: comptrustbyte is not 'direct' or 'afterpic'\n");
if (currprefs.comptrustword!=0 && currprefs.comptrustword!=3)
- stop = 1, write_log ("JIT: comptrustword is not 'direct' or 'afterpic'\n");
+ stop = 1, write_log (L"JIT: comptrustword is not 'direct' or 'afterpic'\n");
if (currprefs.comptrustlong!=0 && currprefs.comptrustlong!=3)
- stop = 1, write_log ("JIT: comptrustlong is not 'direct' or 'afterpic'\n");
+ stop = 1, write_log (L"JIT: comptrustlong is not 'direct' or 'afterpic'\n");
if (currprefs.comptrustnaddr!=0 && currprefs.comptrustnaddr!=3)
- stop = 1, write_log ("JIT: comptrustnaddr is not 'direct' or 'afterpic'\n");
+ stop = 1, write_log (L"JIT: comptrustnaddr is not 'direct' or 'afterpic'\n");
if (currprefs.compnf!=1)
- stop = 1, write_log ("JIT: compnf is not 'yes'\n");
+ stop = 1, write_log (L"JIT: compnf is not 'yes'\n");
if (currprefs.cachesize<1024)
- stop = 1, write_log ("JIT: cachesize is less than 1024\n");
+ stop = 1, write_log (L"JIT: cachesize is less than 1024\n");
if (currprefs.comp_hardflush)
- stop = 1, write_log ("JIT: comp_flushmode is 'hard'\n");
+ stop = 1, write_log (L"JIT: comp_flushmode is 'hard'\n");
if (!canbang)
- stop = 1, write_log ("JIT: Cannot use most direct memory access,\n"
+ stop = 1, write_log (L"JIT: Cannot use most direct memory access,\n"
" and unable to recover from failed guess!\n");
if (stop) {
gui_message("JIT: Configuration problems were detected!\n"
return;
- write_log ("----------------------\n");
+ write_log (L"----------------------\n");
for (i=0;i<N_REGS;i++) {
switch(nstate[i]) {
- case L_UNKNOWN: write_log ("Nat %d : UNKNOWN\n",i); break;
- case L_UNAVAIL: write_log ("Nat %d : UNAVAIL\n",i); break;
- default: write_log ("Nat %d : %d\n",i,nstate[i]); break;
+ case L_UNKNOWN: write_log (L"Nat %d : UNKNOWN\n",i); break;
+ case L_UNAVAIL: write_log (L"Nat %d : UNAVAIL\n",i); break;
+ default: write_log (L"Nat %d : %d\n",i,nstate[i]); break;
}
}
for (i=0;i<VREGS;i++) {
if (vstate[i]==L_UNNEEDED)
- write_log ("Virt %d: UNNEEDED\n",i);
+ write_log (L"Virt %d: UNNEEDED\n",i);
}
}
if (live.state[r].val &&
live.nat[rr].nholds==1 &&
!live.nat[rr].locked) {
- // write_log ("JIT: RemovingA offset %x from reg %d (%d) at %p\n",
+ // write_log (L"JIT: RemovingA offset %x from reg %d (%d) at %p\n",
// live.state[r].val,r,rr,target);
adjust_nreg(rr,live.state[r].val);
live.state[r].val=0;
rr=live.state[r].realreg;
if (live.nat[rr].nholds==1) {
- //write_log ("JIT: RemovingB offset %x from reg %d (%d) at %p\n",
+ //write_log (L"JIT: RemovingB offset %x from reg %d (%d) at %p\n",
// live.state[r].val,r,rr,target);
adjust_nreg(rr,live.state[r].val);
live.state[r].dirtysize=4;
int answer=-1;
if (live.state[r].status==UNDEF) {
- write_log ("JIT: WARNING: Unexpected read of undefined register %d\n",r);
+ write_log (L"JIT: WARNING: Unexpected read of undefined register %d\n",r);
}
if (!can_offset)
remove_offset(r,spec);
int answer=-1;
if (live.state[r].status==UNDEF) {
- write_log ("JIT: WARNING: Unexpected read of undefined register %d\n",r);
+ write_log (L"JIT: WARNING: Unexpected read of undefined register %d\n",r);
}
remove_offset(r,spec);
make_exclusive(r,0,spec);
}
}
Dif (live.fat[rr].nholds!=1) {
- write_log ("JIT: realreg %d holds %d (",rr,live.fat[rr].nholds);
+ write_log (L"JIT: realreg %d holds %d (",rr,live.fat[rr].nholds);
for (i=0;i<live.fat[rr].nholds;i++) {
- write_log ("JIT: %d(%d,%d)",live.fat[rr].holds[i],
+ write_log (L"JIT: %d(%d,%d)",live.fat[rr].holds[i],
live.fate[live.fat[rr].holds[i]].realreg,
live.fate[live.fat[rr].holds[i]].realind);
}
- write_log ("\n");
+ write_log (L"\n");
jit_abort("x");
}
return;
live.nat[s].nholds++;
log_clobberreg(d);
- /* write_log ("JIT: Added %d to nreg %d(%d), now holds %d regs\n",
+ /* write_log (L"JIT: Added %d to nreg %d(%d), now holds %d regs\n",
d,s,live.state[d].realind,live.nat[s].nholds); */
unlock(s);
#else
case UNDEF:
break;
default:
- write_log ("JIT: Weird status: %d\n",live.state[i].status);
+ write_log (L"JIT: Weird status: %d\n",live.state[i].status);
abort();
}
}
int n=live.state[i].realreg;
if (live.nat[n].nholds!=1) {
- write_log ("JIT: Register %d isn't alone in nreg %d\n",
+ write_log (L"JIT: Register %d isn't alone in nreg %d\n",
i,n);
abort();
}
if (vton[i]==-1) {
- write_log ("JIT: Register %d is still in register, shouldn't be\n",
+ write_log (L"JIT: Register %d is still in register, shouldn't be\n",
i);
abort();
}
int n=vton[i];
if (n==-1) {
Dif (isinreg(i)) {
- write_log ("JIT: Register %d unexpectedly in nreg %d\n",
+ write_log (L"JIT: Register %d unexpectedly in nreg %d\n",
i,live.state[i].realreg);
abort();
}
break;
case INMEM:
Dif (live.nat[n].nholds) {
- write_log ("JIT: natreg %d holds %d vregs, should be empty\n",
+ write_log (L"JIT: natreg %d holds %d vregs, should be empty\n",
n,live.nat[n].nholds);
}
raw_mov_l_rm(n,(uae_u32)live.state[i].mem);
break;
case ISCONST:
if (i!=PC_P) {
- write_log ("JIT: Got constant in matchstate for reg %d. Bad!\n",i);
+ write_log (L"JIT: Got constant in matchstate for reg %d. Bad!\n",i);
abort();
}
break;
default: break;
}
Dif (live.state[i].val && i!=PC_P) {
- write_log ("JIT: Register %d still has val %x\n",
+ write_log (L"JIT: Register %d still has val %x\n",
i,live.state[i].val);
}
}
raw_fp_cleanup_drop();
}
if (needflags) {
- write_log ("JIT: Warning! flush with needflags=1!\n");
+ write_log (L"JIT: Warning! flush with needflags=1!\n");
}
lopt_emit_all();
int i;
for (i=0;i<N_REGS;i++)
if (live.nat[i].locked && i!=4)
- write_log ("JIT: Warning! %d is locked\n",i);
+ write_log (L"JIT: Warning! %d is locked\n",i);
for (i=0;i<VREGS;i++)
if (live.state[i].needflush==NF_SCRATCH) {
}
else {
while (len>0) {
- write_log ("%08x ",*pos);
+ write_log (L"%08x ",*pos);
pos++;
len-=4;
}
- write_log (" bla\n");
+ write_log (L" bla\n");
}
}
bi->handler_to_use=bi->handler;
set_dhtu(bi,bi->direct_handler);
- /* write_log ("JIT: reactivate %p/%p (%x %x/%x %x)\n",bi,bi->pc_p,
+ /* write_log (L"JIT: reactivate %p/%p (%x %x/%x %x)\n",bi,bi->pc_p,
c1,c2,bi->c1,bi->c2);*/
remove_from_list(bi);
add_to_active(bi);
else {
/* This block actually changed. We need to invalidate it,
and set it up to be recompiled */
- /* write_log ("JIT: discard %p/%p (%x %x/%x %x)\n",bi,bi->pc_p,
+ /* write_log (L"JIT: discard %p/%p (%x %x/%x %x)\n",bi,bi->pc_p,
c1,c2,bi->c1,bi->c2); */
invalidate_block(bi);
raise_in_cl_list(bi);
#endif
raw_init_cpu();
#ifdef NATMEM_OFFSET
- write_log ("JIT: Setting signal handler\n");
+ write_log (L"JIT: Setting signal handler\n");
#ifndef _WIN32
signal(SIGSEGV,vec);
#endif
#endif
- write_log ("JIT: Building Compiler function table\n");
+ write_log (L"JIT: Building Compiler function table\n");
for (opcode = 0; opcode < 65536; opcode++) {
#ifdef NOFLAGS_SUPPORT
nfcpufunctbl[opcode] = op_illg;
if (compfunctbl[opcode])
count++;
}
- write_log ("JIT: Supposedly %d compileable opcodes!\n",count);
+ write_log (L"JIT: Supposedly %d compileable opcodes!\n",count);
/* Initialise state */
alloc_cache();
hard_flush_count++;
#if 0
- write_log ("JIT: Flush Icache_hard(%d/%x/%p), %u instruction bytes\n",
+ write_log (L"JIT: Flush Icache_hard(%d/%x/%p), %u instruction bytes\n",
n,regs.pc,regs.pc_p,current_compile_p-compiled_code);
#endif
bi=active;
int k = kc >> 1;
int b = !(kc & 1);
- //write_log ("got kc %02X\n", ((kc << 7) | (kc >> 1)) & 0xff);
+ //write_log (L"got kc %02X\n", ((kc << 7) | (kc >> 1)) & 0xff);
if (kpb_next == 256)
kpb_next = 0;
if (kpb_next == kpb_last) {
- write_log ("Keyboard buffer overrun. Congratulations.\n");
+ write_log (L"Keyboard buffer overrun. Congratulations.\n");
return;
}
struct gui_info gui_data;
-char warning_buffer[256];
+TCHAR warning_buffer[256];
-char optionsfile[256];
+TCHAR optionsfile[256];
int uaerand (void)
{
return rand ();
}
-/* If you want to pipe printer output to a file, put something like
- * "cat >>printerfile.tmp" above.
- * The printer support was only tested with the driver "PostScript" on
- * Amiga side, using apsfilter for linux to print ps-data.
- *
- * Under DOS it ought to be -p LPT1: or -p PRN: but you'll need a
- * PostScript printer or ghostscript -=SR=-
- */
-
-/* Slightly stupid place for this... */
-/* ncurses.c might use quite a few of those. */
-char *colormodes[] = { "256 colors", "32768 colors", "65536 colors",
- "256 colors dithered", "16 colors dithered", "16 million colors",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
-};
void discard_prefs (struct uae_prefs *p, int type)
{
|| p->chipmem_size < 0x20000
|| p->chipmem_size > 0x800000)
{
- write_log ("Unsupported chipmem size %x!\n", p->chipmem_size);
+ write_log (L"Unsupported chipmem size %x!\n", p->chipmem_size);
p->chipmem_size = 0x200000;
err = 1;
}
if ((p->fastmem_size & (p->fastmem_size - 1)) != 0
|| (p->fastmem_size != 0 && (p->fastmem_size < 0x100000 || p->fastmem_size > 0x800000)))
{
- write_log ("Unsupported fastmem size %x!\n", p->fastmem_size);
+ write_log (L"Unsupported fastmem size %x!\n", p->fastmem_size);
err = 1;
}
if ((p->gfxmem_size & (p->gfxmem_size - 1)) != 0
|| (p->gfxmem_size != 0 && (p->gfxmem_size < 0x100000 || p->gfxmem_size > max_z3fastmem / 2)))
{
- write_log ("Unsupported graphics card memory size %x (%x)!\n", p->gfxmem_size, max_z3fastmem / 2);
+ write_log (L"Unsupported graphics card memory size %x (%x)!\n", p->gfxmem_size, max_z3fastmem / 2);
if (p->gfxmem_size > max_z3fastmem / 2)
p->gfxmem_size = max_z3fastmem / 2;
else
if ((p->z3fastmem_size & (p->z3fastmem_size - 1)) != 0
|| (p->z3fastmem_size != 0 && (p->z3fastmem_size < 0x100000 || p->z3fastmem_size > max_z3fastmem)))
{
- write_log ("Unsupported Zorro III fastmem size %x (%x)!\n", p->z3fastmem_size, max_z3fastmem);
+ write_log (L"Unsupported Zorro III fastmem size %x (%x)!\n", p->z3fastmem_size, max_z3fastmem);
if (p->z3fastmem_size > max_z3fastmem)
p->z3fastmem_size = max_z3fastmem;
else
if ((p->z3fastmem2_size & (p->z3fastmem2_size - 1)) != 0
|| (p->z3fastmem2_size != 0 && (p->z3fastmem2_size < 0x100000 || p->z3fastmem2_size > max_z3fastmem)))
{
- write_log ("Unsupported Zorro III fastmem size %x (%x)!\n", p->z3fastmem2_size, max_z3fastmem);
+ write_log (L"Unsupported Zorro III fastmem size %x (%x)!\n", p->z3fastmem2_size, max_z3fastmem);
if (p->z3fastmem2_size > max_z3fastmem)
p->z3fastmem2_size = max_z3fastmem;
else
if (p->address_space_24 && (p->gfxmem_size != 0 || p->z3fastmem_size != 0)) {
p->z3fastmem_size = p->gfxmem_size = 0;
- write_log ("Can't use a graphics card or Zorro III fastmem when using a 24 bit\n"
- "address space - sorry.\n");
+ write_log (L"Can't use a graphics card or Zorro III fastmem when using a 24 bit\n"
+ L"address space - sorry.\n");
}
if (p->bogomem_size != 0 && p->bogomem_size != 0x80000 && p->bogomem_size != 0x100000 && p->bogomem_size != 0x180000 && p->bogomem_size != 0x1c0000) {
p->bogomem_size = 0;
- write_log ("Unsupported bogomem size!\n");
+ write_log (L"Unsupported bogomem size!\n");
err = 1;
}
if (p->bogomem_size > 0x100000 && (p->cs_fatgaryrev >= 0 || p->cs_ide || p->cs_ramseyrev >= 0)) {
p->bogomem_size = 0x100000;
- write_log ("Possible Gayle bogomem conflict fixed\n");
+ write_log (L"Possible Gayle bogomem conflict fixed\n");
}
if (p->chipmem_size > 0x200000 && p->fastmem_size != 0) {
- write_log ("You can't use fastmem and more than 2MB chip at the same time!\n");
+ write_log (L"You can't use fastmem and more than 2MB chip at the same time!\n");
p->fastmem_size = 0;
err = 1;
}
if (p->mbresmem_low_size > 0x04000000 || (p->mbresmem_low_size & 0xfffff)) {
p->mbresmem_low_size = 0;
- write_log ("Unsupported A3000 MB RAM size\n");
+ write_log (L"Unsupported A3000 MB RAM size\n");
}
if (p->mbresmem_high_size > 0x04000000 || (p->mbresmem_high_size & 0xfffff)) {
p->mbresmem_high_size = 0;
- write_log ("Unsupported Motherboard RAM size\n");
+ write_log (L"Unsupported Motherboard RAM size\n");
}
#if 0
if (p->m68k_speed < -1 || p->m68k_speed > 20) {
- write_log ("Bad value for -w parameter: must be -1, 0, or within 1..20.\n");
+ write_log (L"Bad value for -w parameter: must be -1, 0, or within 1..20.\n");
p->m68k_speed = 4;
err = 1;
}
#endif
if (p->produce_sound < 0 || p->produce_sound > 3) {
- write_log ("Bad value for -S parameter: enable value must be within 0..3\n");
+ write_log (L"Bad value for -S parameter: enable value must be within 0..3\n");
p->produce_sound = 0;
err = 1;
}
if (p->comptrustbyte < 0 || p->comptrustbyte > 3) {
- write_log ("Bad value for comptrustbyte parameter: value must be within 0..2\n");
+ write_log (L"Bad value for comptrustbyte parameter: value must be within 0..2\n");
p->comptrustbyte = 1;
err = 1;
}
if (p->comptrustword < 0 || p->comptrustword > 3) {
- write_log ("Bad value for comptrustword parameter: value must be within 0..2\n");
+ write_log (L"Bad value for comptrustword parameter: value must be within 0..2\n");
p->comptrustword = 1;
err = 1;
}
if (p->comptrustlong < 0 || p->comptrustlong > 3) {
- write_log ("Bad value for comptrustlong parameter: value must be within 0..2\n");
+ write_log (L"Bad value for comptrustlong parameter: value must be within 0..2\n");
p->comptrustlong = 1;
err = 1;
}
if (p->comptrustnaddr < 0 || p->comptrustnaddr > 3) {
- write_log ("Bad value for comptrustnaddr parameter: value must be within 0..2\n");
+ write_log (L"Bad value for comptrustnaddr parameter: value must be within 0..2\n");
p->comptrustnaddr = 1;
err = 1;
}
if (p->compnf < 0 || p->compnf > 1) {
- write_log ("Bad value for compnf parameter: value must be within 0..1\n");
+ write_log (L"Bad value for compnf parameter: value must be within 0..1\n");
p->compnf = 1;
err = 1;
}
if (p->comp_hardflush < 0 || p->comp_hardflush > 1) {
- write_log ("Bad value for comp_hardflush parameter: value must be within 0..1\n");
+ write_log (L"Bad value for comp_hardflush parameter: value must be within 0..1\n");
p->comp_hardflush = 1;
err = 1;
}
if (p->comp_constjump < 0 || p->comp_constjump > 1) {
- write_log ("Bad value for comp_constjump parameter: value must be within 0..1\n");
+ write_log (L"Bad value for comp_constjump parameter: value must be within 0..1\n");
p->comp_constjump = 1;
err = 1;
}
if (p->comp_oldsegv < 0 || p->comp_oldsegv > 1) {
- write_log ("Bad value for comp_oldsegv parameter: value must be within 0..1\n");
+ write_log (L"Bad value for comp_oldsegv parameter: value must be within 0..1\n");
p->comp_oldsegv = 1;
err = 1;
}
if (p->cachesize < 0 || p->cachesize > 16384) {
- write_log ("Bad value for cachesize parameter: value must be within 0..16384\n");
+ write_log (L"Bad value for cachesize parameter: value must be within 0..16384\n");
p->cachesize = 0;
err = 1;
}
if (p->z3fastmem_size > 0 && (p->address_space_24 || p->cpu_model < 68020)) {
- write_log ("Z3 fast memory can't be used with a 68000/68010 emulation. It\n"
- "requires a 68020 emulation. Turning off Z3 fast memory.\n");
+ write_log (L"Z3 fast memory can't be used with a 68000/68010 emulation. It\n"
+ L"requires a 68020 emulation. Turning off Z3 fast memory.\n");
p->z3fastmem_size = 0;
err = 1;
}
if (p->gfxmem_size > 0 && (p->cpu_model < 68020 || p->address_space_24)) {
- write_log ("Picasso96 can't be used with a 68000/68010 or 68EC020 emulation. It\n"
- "requires a 68020 emulation. Turning off Picasso96.\n");
+ write_log (L"Picasso96 can't be used with a 68000/68010 or 68EC020 emulation. It\n"
+ L"requires a 68020 emulation. Turning off Picasso96.\n");
p->gfxmem_size = 0;
err = 1;
}
#if !defined (BSDSOCKET)
if (p->socket_emu) {
- write_log ("Compile-time option of BSDSOCKET_SUPPORTED was not enabled. You can't use bsd-socket emulation.\n");
+ write_log (L"Compile-time option of BSDSOCKET_SUPPORTED was not enabled. You can't use bsd-socket emulation.\n");
p->socket_emu = 0;
err = 1;
}
#endif
if (p->nr_floppies < 0 || p->nr_floppies > 4) {
- write_log ("Invalid number of floppies. Using 4.\n");
+ write_log (L"Invalid number of floppies. Using 4.\n");
p->nr_floppies = 4;
p->dfxtype[0] = 0;
p->dfxtype[1] = 0;
p->input_mouse_speed = 100;
}
if (p->collision_level < 0 || p->collision_level > 3) {
- write_log ("Invalid collision support level. Using 1.\n");
+ write_log (L"Invalid collision support level. Using 1.\n");
p->collision_level = 1;
err = 1;
}
int quit_program = 0;
static int restart_program;
-static char restart_config[256];
+static TCHAR restart_config[256];
void uae_reset (int hardreset)
{
}
/* 0 = normal, 1 = nogui, -1 = disable nogui */
-void uae_restart (int opengui, char *cfgfile)
+void uae_restart (int opengui, TCHAR *cfgfile)
{
uae_quit ();
restart_program = opengui > 0 ? 1 : (opengui == 0 ? 2 : 3);
restart_config[0] = 0;
if (cfgfile)
- strcpy (restart_config, cfgfile);
+ _tcscpy (restart_config, cfgfile);
}
#ifndef DONT_PARSE_CMDLINE
void usage (void)
{
}
-static void parse_cmdline_2 (int argc, char **argv)
+static void parse_cmdline_2 (int argc, TCHAR **argv)
{
int i;
cfgfile_addcfgparam (0);
for (i = 1; i < argc; i++) {
- if (strcmp (argv[i], "-cfgparam") == 0) {
+ if (_tcscmp (argv[i], L"-cfgparam") == 0) {
if (i + 1 == argc)
- write_log ("Missing argument for '-cfgparam' option.\n");
+ write_log (L"Missing argument for '-cfgparam' option.\n");
else
cfgfile_addcfgparam (argv[++i]);
}
}
}
-static void parse_diskswapper (char *s)
+static void parse_diskswapper (TCHAR *s)
{
- char *tmp = my_strdup (s);
- char *delim = ",";
- char *p1, *p2;
+ TCHAR *tmp = my_strdup (s);
+ TCHAR *delim = L",";
+ TCHAR *p1, *p2;
int num = 0;
p1 = tmp;
for (;;) {
- p2 = strtok (p1, delim);
+ p2 = _tcstok (p1, delim);
if (!p2)
break;
p1 = NULL;
if (num >= MAX_SPARE_DRIVES)
break;
- strncpy (currprefs.dfxlist[num], p2, 255);
+ _tcsncpy (currprefs.dfxlist[num], p2, 255);
num++;
}
free (tmp);
}
-static void parse_cmdline (int argc, char **argv)
+static void parse_cmdline (int argc, TCHAR **argv)
{
int i;
for (i = 1; i < argc; i++) {
- if (!strncmp (argv[i], "-diskswapper=", 13)) {
+ if (!_tcsncmp (argv[i], L"-diskswapper=", 13)) {
parse_diskswapper (argv[i] + 13);
- } else if (strcmp (argv[i], "-cfgparam") == 0) {
+ } else if (_tcscmp (argv[i], L"-cfgparam") == 0) {
if (i + 1 < argc)
i++;
- } else if (strncmp (argv[i], "-config=", 8) == 0) {
+ } else if (_tcsncmp (argv[i], L"-config=", 8) == 0) {
currprefs.mountitems = 0;
target_cfgfile_load (&currprefs, argv[i] + 8, -1, 1);
- } else if (strncmp (argv[i], "-statefile=", 11) == 0) {
+ } else if (_tcsncmp (argv[i], L"-statefile=", 11) == 0) {
savestate_state = STATE_DORESTORE;
- strcpy (savestate_fname, argv[i] + 11);
- } else if (strcmp (argv[i], "-f") == 0) {
+ _tcscpy (savestate_fname, argv[i] + 11);
+ } else if (_tcscmp (argv[i], L"-f") == 0) {
/* Check for new-style "-f xxx" argument, where xxx is config-file */
if (i + 1 == argc) {
- write_log ("Missing argument for '-f' option.\n");
+ write_log (L"Missing argument for '-f' option.\n");
} else {
currprefs.mountitems = 0;
target_cfgfile_load (&currprefs, argv[++i], -1, 1);
}
- } else if (strcmp (argv[i], "-s") == 0) {
+ } else if (_tcscmp (argv[i], L"-s") == 0) {
if (i + 1 == argc)
- write_log ("Missing argument for '-s' option.\n");
+ write_log (L"Missing argument for '-s' option.\n");
else
cfgfile_parse_line (&currprefs, argv[++i], 0);
- } else if (strcmp (argv[i], "-h") == 0 || strcmp (argv[i], "-help") == 0) {
+ } else if (_tcscmp (argv[i], L"-h") == 0 || _tcscmp (argv[i], L"-help") == 0) {
usage ();
exit (0);
} else {
if (argv[i][0] == '-' && argv[i][1] != '\0') {
- const char *arg = argv[i] + 2;
+ const TCHAR *arg = argv[i] + 2;
int extra_arg = *arg == '\0';
if (extra_arg)
arg = i + 1 < argc ? argv[i + 1] : 0;
- if (parse_cmdline_option (&currprefs, argv[i][1], (char*)arg) && extra_arg)
+ if (parse_cmdline_option (&currprefs, argv[i][1], arg) && extra_arg)
i++;
}
}
}
#endif
-static void parse_cmdline_and_init_file (int argc, char **argv)
+static void parse_cmdline_and_init_file (int argc, TCHAR **argv)
{
- strcpy (optionsfile, "");
+ _tcscpy (optionsfile, L"");
#ifdef OPTIONS_IN_HOME
{
- char *home = getenv ("HOME");
+ TCHAR *home = getenv ("HOME");
if (home != NULL && strlen (home) < 240)
{
- strcpy (optionsfile, home);
- strcat (optionsfile, "/");
+ _tcscpy (optionsfile, home);
+ _tcscat (optionsfile, L"/");
}
}
#endif
parse_cmdline_2 (argc, argv);
- strcat (optionsfile, restart_config);
+ _tcscat (optionsfile, restart_config);
if (! target_cfgfile_load (&currprefs, optionsfile, 0, 0)) {
- write_log ("failed to load config '%s'\n", optionsfile);
+ write_log (L"failed to load config '%s'\n", optionsfile);
#ifdef OPTIONS_IN_HOME
/* sam: if not found in $HOME then look in current directory */
- strcpy (optionsfile, restart_config);
+ _tcscpy (optionsfile, restart_config);
target_cfgfile_load (&currprefs, optionsfile, 0);
#endif
}
do_leave_program ();
}
-static void real_main2 (int argc, char **argv)
+static void real_main2 (int argc, TCHAR **argv)
{
#if defined (JIT) && (defined (_WIN32) || defined (_WIN64)) && !defined (NO_WIN32_EXCEPTION_HANDLER)
extern int EvalException (LPEXCEPTION_POINTERS blah, int n_except);
}
if (! setup_sound ()) {
- write_log ("Sound driver unavailable: Sound output disabled\n");
+ write_log (L"Sound driver unavailable: Sound output disabled\n");
currprefs.produce_sound = 0;
}
inputdevice_init ();
int err = gui_init ();
currprefs = changed_prefs;
if (err == -1) {
- write_log ("Failed to initialize the GUI\n");
+ write_log (L"Failed to initialize the GUI\n");
} else if (err == -2) {
return;
}
#endif
#ifdef JIT
- if (!((currprefs.cpu_model >= 68020) && (currprefs.address_space_24 == 0) && (currprefs.cachesize)))
+ if (!(currprefs.cpu_model >= 68020 && currprefs.address_space_24 == 0 && currprefs.cachesize))
canbang = 0;
#endif
if (!init_audio ()) {
if (sound_available && currprefs.produce_sound > 1) {
- write_log ("Sound driver unavailable: Sound output disabled\n");
+ write_log (L"Sound driver unavailable: Sound output disabled\n");
}
currprefs.produce_sound = 0;
}
}
}
-#if defined (JIT) && (defined ( _WIN32 ) || defined (_WIN64)) && !defined (NO_WIN32_EXCEPTION_HANDLER)
+#if defined (JIT) && (defined (_WIN32) || defined (_WIN64)) && !defined (NO_WIN32_EXCEPTION_HANDLER)
__except (EvalException (GetExceptionInformation (), GetExceptionCode ()))
{
// EvalException does the good stuff...
#endif
}
-void real_main (int argc, char **argv)
+void real_main (int argc, TCHAR **argv)
{
restart_program = 1;
- fetch_configurationpath (restart_config, sizeof (restart_config));
- strcat (restart_config, OPTIONSFILENAME);
+ fetch_configurationpath (restart_config, sizeof (restart_config) / sizeof (TCHAR));
+ _tcscat (restart_config, OPTIONSFILENAME);
while (restart_program) {
changed_prefs = currprefs;
real_main2 (argc, argv);
}
#ifndef NO_MAIN_IN_MAIN_C
-int main (int argc, char **argv)
+int main (int argc, TCHAR **argv)
{
real_main (argc, argv);
return 0;
static struct romlist *rl;
static int romlist_cnt;
-char *romlist_get (struct romdata *rd)
+TCHAR *romlist_get (struct romdata *rd)
{
int i;
}
static void romlist_cleanup (void);
-void romlist_add (char *path, struct romdata *rd)
+void romlist_add (TCHAR *path, struct romdata *rd)
{
struct romlist *rl2;
}
-struct romdata *getromdatabypath(char *path)
+struct romdata *getromdatabypath(TCHAR *path)
{
int i;
for (i = 0; i < romlist_cnt; i++) {
struct romdata *rd = rl[i].rd;
if (rd->configname && path[0] == ':') {
- if (!strcmp(path + 1, rd->configname))
+ if (!_tcscmp(path + 1, rd->configname))
return rd;
}
- if (!strcmp(rl[i].path, path))
+ if (!_tcscmp(rl[i].path, path))
return rl[i].rd;
}
return NULL;
#define NEXT_ROM_ID 73
static struct romheader romheaders[] = {
- { "Freezer Cartridges", 1 },
- { "Arcadia Games", 2 },
+ { L"Freezer Cartridges", 1 },
+ { L"Arcadia Games", 2 },
{ NULL, 0 }
};
#define ALTROM(id,grp,num,size,flags,crc32,a,b,c,d,e) \
- { "X", 0, 0, 0, 0, 0, size, id, 0, 0, flags, (grp << 16) | num, 0, NULL, crc32, a, b, c, d, e },
+ { L"X", 0, 0, 0, 0, 0, size, id, 0, 0, flags, (grp << 16) | num, 0, NULL, crc32, a, b, c, d, e },
#define ALTROMPN(id,grp,num,size,flags,pn,crc32,a,b,c,d,e) \
- { "X", 0, 0, 0, 0, 0, size, id, 0, 0, flags, (grp << 16) | num, 0, pn, crc32, a, b, c, d, e },
+ { L"X", 0, 0, 0, 0, 0, size, id, 0, 0, flags, (grp << 16) | num, 0, pn, crc32, a, b, c, d, e },
static struct romdata roms[] = {
- { "Cloanto Amiga Forever ROM key", 0, 0, 0, 0, 0, 2069, 0, 0, 1, ROMTYPE_KEY, 0, 0, NULL,
+ { L"Cloanto Amiga Forever ROM key", 0, 0, 0, 0, 0, 2069, 0, 0, 1, ROMTYPE_KEY, 0, 0, NULL,
0x869ae1b1, 0x801bbab3,0x2e3d3738,0x6dd1636d,0x4f1d6fa7,0xe21d5874 },
- { "Cloanto Amiga Forever 2006 ROM key", 0, 0, 0, 0, 0, 750, 48, 0, 1, ROMTYPE_KEY, 0, 0, NULL,
+ { L"Cloanto Amiga Forever 2006 ROM key", 0, 0, 0, 0, 0, 750, 48, 0, 1, ROMTYPE_KEY, 0, 0, NULL,
0xb01c4b56, 0xbba8e5cd,0x118b8d92,0xafed5693,0x5eeb9770,0x2a662d8f },
- { "KS ROM v1.0 (A1000)(NTSC)", 1, 0, 1, 0, "A1000\0", 262144, 1, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
+ { L"KS ROM v1.0 (A1000)(NTSC)", 1, 0, 1, 0, L"A1000\0", 262144, 1, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
0x299790ff, 0x00C15406,0xBEB4B8AB,0x1A16AA66,0xC05860E1,0xA7C1AD79 },
- { "KS ROM v1.1 (A1000)(NTSC)", 1, 1, 31, 34, "A1000\0", 262144, 2, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
+ { L"KS ROM v1.1 (A1000)(NTSC)", 1, 1, 31, 34, L"A1000\0", 262144, 2, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
0xd060572a, 0x4192C505,0xD130F446,0xB2ADA6BD,0xC91DAE73,0x0ACAFB4C},
- { "KS ROM v1.1 (A1000)(PAL)", 1, 1, 31, 34, "A1000\0", 262144, 3, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
+ { L"KS ROM v1.1 (A1000)(PAL)", 1, 1, 31, 34, L"A1000\0", 262144, 3, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
0xec86dae2, 0x16DF8B5F,0xD524C5A1,0xC7584B24,0x57AC15AF,0xF9E3AD6D },
- { "KS ROM v1.2 (A1000)", 1, 2, 33, 166, "A1000\0", 262144, 4, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
+ { L"KS ROM v1.2 (A1000)", 1, 2, 33, 166, L"A1000\0", 262144, 4, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
0x9ed783d0, 0x6A7BFB5D,0xBD6B8F17,0x9F03DA84,0xD8D95282,0x67B6273B },
- { "KS ROM v1.2 (A500,A1000,A2000)", 1, 2, 33, 180, "A500\0A1000\0A2000\0", 262144, 5, 0, 0, ROMTYPE_KICK, 0, 0, "315093-01",
+ { L"KS ROM v1.2 (A500,A1000,A2000)", 1, 2, 33, 180, L"A500\0A1000\0A2000\0", 262144, 5, 0, 0, ROMTYPE_KICK, 0, 0, L"315093-01",
0xa6ce1636, 0x11F9E62C,0xF299F721,0x84835B7B,0x2A70A163,0x33FC0D88 },
- { "KS ROM v1.3 (A500,A1000,A2000)", 1, 3, 34, 5, "A500\0A1000\0A2000\0", 262144, 6, 0, 0, ROMTYPE_KICK, 0, 0, "315093-02",
+ { L"KS ROM v1.3 (A500,A1000,A2000)", 1, 3, 34, 5, L"A500\0A1000\0A2000\0", 262144, 6, 0, 0, ROMTYPE_KICK, 0, 0, L"315093-02",
0xc4f0f55f, 0x891E9A54,0x7772FE0C,0x6C19B610,0xBAF8BC4E,0xA7FCB785 },
- { "KS ROM v1.3 (A3000)(SK)", 1, 3, 34, 5, "A3000\0", 262144, 32, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
+ { L"KS ROM v1.3 (A3000)(SK)", 1, 3, 34, 5, L"A3000\0", 262144, 32, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
0xe0f37258, 0xC39BD909,0x4D4E5F4E,0x28C1411F,0x30869504,0x06062E87 },
- { "KS ROM v1.4 (A3000)", 1, 4, 36, 16, "A3000\0", 524288, 59, 3, 0, ROMTYPE_KICK, 0, 0, NULL,
+ { L"KS ROM v1.4 (A3000)", 1, 4, 36, 16, L"A3000\0", 524288, 59, 3, 0, ROMTYPE_KICK, 0, 0, NULL,
0xbc0ec13f, 0xF76316BF,0x36DFF14B,0x20FA349E,0xD02E4B11,0xDD932B07 },
- ALTROMPN(59, 1, 1, 262144, ROMTYPE_EVEN, "390629-02", 0x58327536,0xd1713d7f,0x31474a59,0x48e6d488,0xe3368606,0x1cf3d1e2)
- ALTROMPN(59, 1, 2, 262144, ROMTYPE_ODD , "390630-02", 0xfe2f7fb9,0xc05c9c52,0xd014c66f,0x9019152b,0x3f2a2adc,0x2c678794)
- { "KS ROM v2.04 (A500+)", 2, 4, 37, 175, "A500+\0", 524288, 7, 0, 0, ROMTYPE_KICK, 0, 0, "390979-01",
+ ALTROMPN(59, 1, 1, 262144, ROMTYPE_EVEN, L"390629-02", 0x58327536,0xd1713d7f,0x31474a59,0x48e6d488,0xe3368606,0x1cf3d1e2)
+ ALTROMPN(59, 1, 2, 262144, ROMTYPE_ODD , L"390630-02", 0xfe2f7fb9,0xc05c9c52,0xd014c66f,0x9019152b,0x3f2a2adc,0x2c678794)
+ { L"KS ROM v2.04 (A500+)", 2, 4, 37, 175, L"A500+\0", 524288, 7, 0, 0, ROMTYPE_KICK, 0, 0, L"390979-01",
0xc3bdb240, 0xC5839F5C,0xB98A7A89,0x47065C3E,0xD2F14F5F,0x42E334A1 },
- { "KS ROM v2.05 (A600)", 2, 5, 37, 299, "A600\0", 524288, 8, 0, 0, ROMTYPE_KICK, 0, 0, "391388-01",
+ { L"KS ROM v2.05 (A600)", 2, 5, 37, 299, L"A600\0", 524288, 8, 0, 0, ROMTYPE_KICK, 0, 0, L"391388-01",
0x83028fb5, 0x87508DE8,0x34DC7EB4,0x7359CEDE,0x72D2E3C8,0xA2E5D8DB },
- { "KS ROM v2.05 (A600HD)", 2, 5, 37, 300, "A600HD\0A600\0", 524288, 9, 0, 0, ROMTYPE_KICK, 0, 0, "391304-01",
+ { L"KS ROM v2.05 (A600HD)", 2, 5, 37, 300, L"A600HD\0A600\0", 524288, 9, 0, 0, ROMTYPE_KICK, 0, 0, L"391304-01",
0x64466c2a, 0xF72D8914,0x8DAC39C6,0x96E30B10,0x859EBC85,0x9226637B },
- { "KS ROM v2.05 (A600HD)", 2, 5, 37, 350, "A600HD\0A600\0", 524288, 10, 0, 0, ROMTYPE_KICK, 0, 0, "391304-02",
+ { L"KS ROM v2.05 (A600HD)", 2, 5, 37, 350, L"A600HD\0A600\0", 524288, 10, 0, 0, ROMTYPE_KICK, 0, 0, L"391304-02",
0x43b0df7b, 0x02843C42,0x53BBD29A,0xBA535B0A,0xA3BD9A85,0x034ECDE4 },
- { "KS ROM v2.04 (A3000)", 2, 4, 37, 175, "A3000\0", 524288, 71, 3, 0, ROMTYPE_KICK, 0, 0, NULL,
+ { L"KS ROM v2.04 (A3000)", 2, 4, 37, 175, L"A3000\0", 524288, 71, 3, 0, ROMTYPE_KICK, 0, 0, NULL,
0x234a7233, 0xd82ebb59,0xafc53540,0xddf2d718,0x7ecf239b,0x7ea91590 },
- ALTROMPN(71, 1, 1, 262144, ROMTYPE_EVEN, "390629-03", 0x7db1332b,0x48f14b31,0x279da675,0x7848df6f,0xeb531881,0x8f8f576c)
- ALTROMPN(71, 1, 2, 262144, ROMTYPE_ODD , "390630-03", 0xa245dbdf,0x83bab8e9,0x5d378b55,0xb0c6ae65,0x61385a96,0xf638598f)
+ ALTROMPN(71, 1, 1, 262144, ROMTYPE_EVEN, L"390629-03", 0x7db1332b,0x48f14b31,0x279da675,0x7848df6f,0xeb531881,0x8f8f576c)
+ ALTROMPN(71, 1, 2, 262144, ROMTYPE_ODD , L"390630-03", 0xa245dbdf,0x83bab8e9,0x5d378b55,0xb0c6ae65,0x61385a96,0xf638598f)
- { "KS ROM v3.0 (A1200)", 3, 0, 39, 106, "A1200\0", 524288, 11, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
+ { L"KS ROM v3.0 (A1200)", 3, 0, 39, 106, L"A1200\0", 524288, 11, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
0x6c9b07d2, 0x70033828,0x182FFFC7,0xED106E53,0x73A8B89D,0xDA76FAA5 },
- ALTROMPN(11, 1, 1, 262144, ROMTYPE_EVEN, "391523-01", 0xc742a412,0x999eb81c,0x65dfd07a,0x71ee1931,0x5d99c7eb,0x858ab186)
- ALTROMPN(11, 1, 2, 262144, ROMTYPE_ODD , "391524-01", 0xd55c6ec6,0x3341108d,0x3a402882,0xb5ef9d3b,0x242cbf3c,0x8ab1a3e9)
- { "KS ROM v3.0 (A4000)", 3, 0, 39, 106, "A4000\0", 524288, 12, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL,
+ ALTROMPN(11, 1, 1, 262144, ROMTYPE_EVEN, L"391523-01", 0xc742a412,0x999eb81c,0x65dfd07a,0x71ee1931,0x5d99c7eb,0x858ab186)
+ ALTROMPN(11, 1, 2, 262144, ROMTYPE_ODD , L"391524-01", 0xd55c6ec6,0x3341108d,0x3a402882,0xb5ef9d3b,0x242cbf3c,0x8ab1a3e9)
+ { L"KS ROM v3.0 (A4000)", 3, 0, 39, 106, L"A4000\0", 524288, 12, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL,
0x9e6ac152, 0xF0B4E9E2,0x9E12218C,0x2D5BD702,0x0E4E7852,0x97D91FD7 },
- ALTROMPN(12, 1, 1, 262144, ROMTYPE_EVEN, "391513-02", 0x36f64dd0,0x196e9f3f,0x9cad934e,0x181c07da,0x33083b1f,0x0a3c702f)
- ALTROMPN(12, 1, 2, 262144, ROMTYPE_ODD , "391514-02", 0x17266a55,0x42fbed34,0x53d1f11c,0xcbde89a9,0x826f2d11,0x75cca5cc)
- { "KS ROM v3.1 (A4000)", 3, 1, 40, 70, "A4000\0", 524288, 13, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL,
+ ALTROMPN(12, 1, 1, 262144, ROMTYPE_EVEN, L"391513-02", 0x36f64dd0,0x196e9f3f,0x9cad934e,0x181c07da,0x33083b1f,0x0a3c702f)
+ ALTROMPN(12, 1, 2, 262144, ROMTYPE_ODD , L"391514-02", 0x17266a55,0x42fbed34,0x53d1f11c,0xcbde89a9,0x826f2d11,0x75cca5cc)
+ { L"KS ROM v3.1 (A4000)", 3, 1, 40, 70, L"A4000\0", 524288, 13, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL,
0x2b4566f1, 0x81c631dd,0x096bbb31,0xd2af9029,0x9c76b774,0xdb74076c },
ALTROM(13, 1, 1, 262144, ROMTYPE_EVEN, 0xf9cbecc9,0x138d8cb4,0x3b8312fe,0x16d69070,0xde607469,0xb3d4078e)
ALTROM(13, 1, 2, 262144, ROMTYPE_ODD , 0xf8248355,0xc2379547,0x9fae3910,0xc185512c,0xa268b82f,0x1ae4fe05)
- { "KS ROM v3.1 (A500,A600,A2000)", 3, 1, 40, 63, "A500\0A600\0A2000\0", 524288, 14, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
+ { L"KS ROM v3.1 (A500,A600,A2000)", 3, 1, 40, 63, L"A500\0A600\0A2000\0", 524288, 14, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
0xfc24ae0d, 0x3B7F1493,0xB27E2128,0x30F989F2,0x6CA76C02,0x049F09CA },
- { "KS ROM v3.1 (A1200)", 3, 1, 40, 68, "A1200\0", 524288, 15, 1, 0, ROMTYPE_KICK, 0, 0, NULL,
+ { L"KS ROM v3.1 (A1200)", 3, 1, 40, 68, L"A1200\0", 524288, 15, 1, 0, ROMTYPE_KICK, 0, 0, NULL,
0x1483a091, 0xE2154572,0x3FE8374E,0x91342617,0x604F1B3D,0x703094F1 },
- ALTROMPN(15, 1, 1, 262144, ROMTYPE_EVEN, "391773-01", 0x08dbf275,0xb8800f5f,0x90929810,0x9ea69690,0xb1b8523f,0xa22ddb37)
- ALTROMPN(15, 1, 2, 262144, ROMTYPE_ODD , "391774-01", 0x16c07bf8,0x90e331be,0x1970b0e5,0x3f53a9b0,0x390b51b5,0x9b3869c2)
- { "KS ROM v3.1 (A3000)", 3, 1, 40, 68, "A3000\0", 524288, 61, 2, 0, ROMTYPE_KICK, 0, 0, NULL,
+ ALTROMPN(15, 1, 1, 262144, ROMTYPE_EVEN, L"391773-01", 0x08dbf275,0xb8800f5f,0x90929810,0x9ea69690,0xb1b8523f,0xa22ddb37)
+ ALTROMPN(15, 1, 2, 262144, ROMTYPE_ODD , L"391774-01", 0x16c07bf8,0x90e331be,0x1970b0e5,0x3f53a9b0,0x390b51b5,0x9b3869c2)
+ { L"KS ROM v3.1 (A3000)", 3, 1, 40, 68, L"A3000\0", 524288, 61, 2, 0, ROMTYPE_KICK, 0, 0, NULL,
0xefb239cc, 0xF8E210D7,0x2B4C4853,0xE0C9B85D,0x223BA20E,0x3D1B36EE },
ALTROM(61, 1, 1, 262144, ROMTYPE_EVEN, 0x286b9a0d,0x6763a225,0x8ec493f7,0x408cf663,0x110dae9a,0x17803ad1)
ALTROM(61, 1, 2, 262144, ROMTYPE_ODD , 0x0b8cde6a,0x5f02e97b,0x48ebbba8,0x7d516a56,0xb0400c6f,0xc3434d8d)
- { "KS ROM v3.1 (A4000)(Cloanto)", 3, 1, 40, 68, "A4000\0", 524288, 31, 2 | 4, 1, ROMTYPE_KICK, 0, 0, NULL,
+ { L"KS ROM v3.1 (A4000)(Cloanto)", 3, 1, 40, 68, L"A4000\0", 524288, 31, 2 | 4, 1, ROMTYPE_KICK, 0, 0, NULL,
0x43b6dd22, 0xC3C48116,0x0866E60D,0x085E436A,0x24DB3617,0xFF60B5F9 },
- { "KS ROM v3.1 (A4000)", 3, 1, 40, 68, "A4000\0", 524288, 16, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL,
+ { L"KS ROM v3.1 (A4000)", 3, 1, 40, 68, L"A4000\0", 524288, 16, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL,
0xd6bae334, 0x5FE04842,0xD04A4897,0x20F0F4BB,0x0E469481,0x99406F49 },
ALTROM(16, 1, 1, 262144, ROMTYPE_EVEN, 0xb2af34f8,0x24e52b5e,0xfc020495,0x17387ab7,0xb1a1475f,0xc540350e)
ALTROM(16, 1, 2, 262144, ROMTYPE_ODD , 0xe65636a3,0x313c7cbd,0xa5779e56,0xf19a41d3,0x4e760f51,0x7626d882)
- { "KS ROM v3.1 (A4000T)", 3, 1, 40, 70, "A4000T\0", 524288, 17, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL,
+ { L"KS ROM v3.1 (A4000T)", 3, 1, 40, 70, L"A4000T\0", 524288, 17, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL,
0x75932c3a, 0xB0EC8B84,0xD6768321,0xE01209F1,0x1E6248F2,0xF5281A21 },
- ALTROMPN(17, 1, 1, 262144, ROMTYPE_EVEN, "391657-01", 0x0ca94f70,0xb3806eda,0xcb3362fc,0x16a154ce,0x1eeec5bf,0x5bc24789)
- ALTROMPN(17, 1, 2, 262144, ROMTYPE_ODD , "391658-01", 0xdfe03120,0xcd7a706c,0x431b04d8,0x7814d3a2,0xd8b39710,0x0cf44c0c)
- { "KS ROM v3.X (A4000)(Cloanto)", 3, 10, 45, 57, "A4000\0", 524288, 46, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL,
+ ALTROMPN(17, 1, 1, 262144, ROMTYPE_EVEN, L"391657-01", 0x0ca94f70,0xb3806eda,0xcb3362fc,0x16a154ce,0x1eeec5bf,0x5bc24789)
+ ALTROMPN(17, 1, 2, 262144, ROMTYPE_ODD , L"391658-01", 0xdfe03120,0xcd7a706c,0x431b04d8,0x7814d3a2,0xd8b39710,0x0cf44c0c)
+ { L"KS ROM v3.X (A4000)(Cloanto)", 3, 10, 45, 57, L"A4000\0", 524288, 46, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL,
0x3ac99edc, 0x3cbfc9e1,0xfe396360,0x157bd161,0xde74fc90,0x1abee7ec },
- { "CD32 KS ROM v3.1", 3, 1, 40, 60, "CD32\0", 524288, 18, 1, 0, ROMTYPE_KICKCD32, 0, 0, NULL,
+ { L"CD32 KS ROM v3.1", 3, 1, 40, 60, L"CD32\0", 524288, 18, 1, 0, ROMTYPE_KICKCD32, 0, 0, NULL,
0x1e62d4a5, 0x3525BE88,0x87F79B59,0x29E017B4,0x2380A79E,0xDFEE542D },
- { "CD32 extended ROM", 3, 1, 40, 60, "CD32\0", 524288, 19, 1, 0, ROMTYPE_EXTCD32, 0, 0, NULL,
+ { L"CD32 extended ROM", 3, 1, 40, 60, L"CD32\0", 524288, 19, 1, 0, ROMTYPE_EXTCD32, 0, 0, NULL,
0x87746be2, 0x5BEF3D62,0x8CE59CC0,0x2A66E6E4,0xAE0DA48F,0x60E78F7F },
/* plain CD32 rom */
- { "CD32 ROM (KS + extended)", 3, 1, 40, 60, "CD32\0", 2 * 524288, 64, 1, 0, ROMTYPE_KICKCD32 | ROMTYPE_EXTCD32 | ROMTYPE_CD32, 0, 0, NULL,
+ { L"CD32 ROM (KS + extended)", 3, 1, 40, 60, L"CD32\0", 2 * 524288, 64, 1, 0, ROMTYPE_KICKCD32 | ROMTYPE_EXTCD32 | ROMTYPE_CD32, 0, 0, NULL,
0xf5d4f3c8, 0x9fa14825,0xc40a2475,0xa2eba5cf,0x325bd483,0xc447e7c1 },
/* real CD32 rom dump 391640-03 */
- ALTROMPN(64, 1, 1, 2 * 524288, ROMTYPE_CD32, "391640-03", 0xa4fbc94a, 0x816ce6c5,0x07787585,0x0c7d4345,0x2230a9ba,0x3a2902db )
+ ALTROMPN(64, 1, 1, 2 * 524288, ROMTYPE_CD32, L"391640-03", 0xa4fbc94a, 0x816ce6c5,0x07787585,0x0c7d4345,0x2230a9ba,0x3a2902db )
- { "CD32 MPEG Cartridge ROM", 3, 1, 40, 30, "CD32FMV\0", 262144, 23, 1, 0, ROMTYPE_CD32CART, 0, 0, NULL,
+ { L"CD32 MPEG Cartridge ROM", 3, 1, 40, 30, L"CD32FMV\0", 262144, 23, 1, 0, ROMTYPE_CD32CART, 0, 0, NULL,
0xc35c37bf, 0x03ca81c7,0xa7b259cf,0x64bc9582,0x863eca0f,0x6529f435 },
- { "CDTV extended ROM v1.00", 1, 0, 1, 0, "CDTV\0", 262144, 20, 0, 0, ROMTYPE_EXTCDTV, 0, 0, NULL,
+ { L"CDTV extended ROM v1.00", 1, 0, 1, 0, L"CDTV\0", 262144, 20, 0, 0, ROMTYPE_EXTCDTV, 0, 0, NULL,
0x42baa124, 0x7BA40FFA,0x17E500ED,0x9FED041F,0x3424BD81,0xD9C907BE },
- ALTROMPN(20, 1, 1, 131072, ROMTYPE_EVEN | ROMTYPE_8BIT, "252606-01", 0x791cb14b,0x277a1778,0x92449635,0x3ffe56be,0x68063d2a,0x334360e4)
- ALTROMPN(20, 1, 2, 131072, ROMTYPE_ODD | ROMTYPE_8BIT, "252607-01", 0xaccbbc2e,0x41b06d16,0x79c6e693,0x3c3378b7,0x626025f7,0x641ebc5c)
- { "CDTV extended ROM v2.07", 2, 7, 2, 7, "CDTV\0", 262144, 22, 0, 0, ROMTYPE_EXTCDTV, 0, 0, NULL,
+ ALTROMPN(20, 1, 1, 131072, ROMTYPE_EVEN | ROMTYPE_8BIT, L"252606-01", 0x791cb14b,0x277a1778,0x92449635,0x3ffe56be,0x68063d2a,0x334360e4)
+ ALTROMPN(20, 1, 2, 131072, ROMTYPE_ODD | ROMTYPE_8BIT, L"252607-01", 0xaccbbc2e,0x41b06d16,0x79c6e693,0x3c3378b7,0x626025f7,0x641ebc5c)
+ { L"CDTV extended ROM v2.07", 2, 7, 2, 7, L"CDTV\0", 262144, 22, 0, 0, ROMTYPE_EXTCDTV, 0, 0, NULL,
0xceae68d2, 0x5BC114BB,0xA29F60A6,0x14A31174,0x5B3E2464,0xBFA06846 },
ALTROM(22, 1, 1, 131072, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x36d73cb8,0x9574e546,0x4b390697,0xf28f9a43,0x4e604e5e,0xf5e5490a)
ALTROM(22, 1, 2, 131072, ROMTYPE_ODD | ROMTYPE_8BIT, 0x6e84dce7,0x01a0679e,0x895a1a0f,0x559c7253,0xf539606b,0xd447b54f)
- { "CDTV/A570 extended ROM v2.30", 2, 30, 2, 30, "CDTV\0", 262144, 21, 0, 0, ROMTYPE_EXTCDTV, 0, 0, "391298-01",
+ { L"CDTV/A570 extended ROM v2.30", 2, 30, 2, 30, L"CDTV\0", 262144, 21, 0, 0, ROMTYPE_EXTCDTV, 0, 0, L"391298-01",
0x30b54232, 0xED7E461D,0x1FFF3CDA,0x321631AE,0x42B80E3C,0xD4FA5EBB },
ALTROM(21, 1, 1, 131072, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x48e4d74f,0x54946054,0x2269e410,0x36018402,0xe1f6b855,0xfd89092b)
ALTROM(21, 1, 2, 131072, ROMTYPE_ODD | ROMTYPE_8BIT, 0x8a54f362,0x03df800f,0x032046fd,0x892f6e7e,0xec08b76d,0x33981e8c)
- { "A1000 bootstrap ROM", 0, 0, 0, 0, "A1000\0", 65536, 24, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
+ { L"A1000 bootstrap ROM", 0, 0, 0, 0, L"A1000\0", 65536, 24, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
0x0b1ad2d0, 0xBA93B8B8,0x5CA0D83A,0x68225CC3,0x3B95050D,0x72D2FDD7 },
ALTROM(24, 1, 1, 8192, 0, 0x62f11c04, 0xC87F9FAD,0xA4EE4E69,0xF3CCA0C3,0x6193BE82,0x2B9F5FE6)
- ALTROMPN(24, 2, 1, 4096, ROMTYPE_EVEN | ROMTYPE_8BIT, "252179-01", 0x42553bc4,0x8855a97f,0x7a44e3f6,0x2d1c88d9,0x38fee1f4,0xc606af5b)
- ALTROMPN(24, 2, 2, 4096, ROMTYPE_ODD | ROMTYPE_8BIT, "252180-01", 0x8e5b9a37,0xd10f1564,0xb99f5ffe,0x108fa042,0x362e877f,0x569de2c3)
+ ALTROMPN(24, 2, 1, 4096, ROMTYPE_EVEN | ROMTYPE_8BIT, L"252179-01", 0x42553bc4,0x8855a97f,0x7a44e3f6,0x2d1c88d9,0x38fee1f4,0xc606af5b)
+ ALTROMPN(24, 2, 2, 4096, ROMTYPE_ODD | ROMTYPE_8BIT, L"252180-01", 0x8e5b9a37,0xd10f1564,0xb99f5ffe,0x108fa042,0x362e877f,0x569de2c3)
- { "The Diagnostic 2.0 (Logica)", 2, 0, 2, 0, "LOGICA\0", 524288, 72, 0, 0, ROMTYPE_KICK | ROMTYPE_SPECIALKICK, 0, 0, NULL,
+ { L"The Diagnostic 2.0 (Logica)", 2, 0, 2, 0, L"LOGICA\0", 524288, 72, 0, 0, ROMTYPE_KICK | ROMTYPE_SPECIALKICK, 0, 0, NULL,
0x8484f426, 0xba10d161,0x66b2e2d6,0x177c979c,0x99edf846,0x2b21651e },
- { "Freezer: Action Replay Mk I v1.00", 1, 0, 1, 0, "AR\0", 65536, 52, 0, 0, ROMTYPE_AR, 0, 1, NULL,
+ { L"Freezer: Action Replay Mk I v1.00", 1, 0, 1, 0, L"AR\0", 65536, 52, 0, 0, ROMTYPE_AR, 0, 1, NULL,
0x2d921771, 0x1EAD9DDA,0x2DAD2914,0x6441F5EF,0x72183750,0x22E01248 },
ALTROM(52, 1, 1, 32768, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x82d6eb87, 0x7c9bac11,0x28666017,0xeee6f019,0x63fb3890,0x7fbea355)
ALTROM(52, 1, 2, 32768, ROMTYPE_ODD | ROMTYPE_8BIT, 0x40ae490c, 0x81d8e432,0x01b73fd9,0x2e204ebd,0x68af8602,0xb62ce397)
- { "Freezer: Action Replay Mk I v1.50", 1, 50, 1, 50, "AR\0", 65536, 25, 0, 0, ROMTYPE_AR, 0, 1, NULL,
+ { L"Freezer: Action Replay Mk I v1.50", 1, 50, 1, 50, L"AR\0", 65536, 25, 0, 0, ROMTYPE_AR, 0, 1, NULL,
0xd4ce0675, 0x843B433B,0x2C56640E,0x045D5FDC,0x854DC6B1,0xA4964E7C },
ALTROM(25, 1, 1, 32768, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x7fbd6de2, 0xb5f71a5c,0x09d65ecc,0xa8a3bc93,0x93558461,0xca190228)
ALTROM(25, 1, 2, 32768, ROMTYPE_ODD | ROMTYPE_8BIT, 0x43018069, 0xad8ff242,0xb2cbf125,0x1fc53a73,0x581cf57a,0xb69cee00)
- { "Freezer: Action Replay Mk II v2.05", 2, 5, 2, 5, "AR\0", 131072, 26, 0, 0, ROMTYPE_AR, 0, 1, NULL,
+ { L"Freezer: Action Replay Mk II v2.05", 2, 5, 2, 5, L"AR\0", 131072, 26, 0, 0, ROMTYPE_AR, 0, 1, NULL,
0x1287301f, 0xF6601DE8,0x888F0050,0x72BF562B,0x9F533BBC,0xAF1B0074 },
- { "Freezer: Action Replay Mk II v2.12", 2, 12, 2, 12, "AR\0", 131072, 27, 0, 0, ROMTYPE_AR, 0, 1, NULL,
+ { L"Freezer: Action Replay Mk II v2.12", 2, 12, 2, 12, L"AR\0", 131072, 27, 0, 0, ROMTYPE_AR, 0, 1, NULL,
0x804d0361, 0x3194A07A,0x0A82D8B5,0xF2B6AEFA,0x3CA581D6,0x8BA8762B },
- { "Freezer: Action Replay Mk II v2.14", 2, 14, 2, 14, "AR\0", 131072, 28, 0, 0, ROMTYPE_AR, 0, 1, NULL,
+ { L"Freezer: Action Replay Mk II v2.14", 2, 14, 2, 14, L"AR\0", 131072, 28, 0, 0, ROMTYPE_AR, 0, 1, NULL,
0x49650e4f, 0x255D6DF6,0x3A4EAB0A,0x838EB1A1,0x6A267B09,0x59DFF634 },
- { "Freezer: Action Replay Mk III v3.09", 3, 9, 3, 9, "AR\0", 262144, 29, 0, 0, ROMTYPE_AR, 0, 1, NULL,
+ { L"Freezer: Action Replay Mk III v3.09", 3, 9, 3, 9, L"AR\0", 262144, 29, 0, 0, ROMTYPE_AR, 0, 1, NULL,
0x0ed9b5aa, 0x0FF3170A,0xBBF0CA64,0xC9DD93D6,0xEC0C7A01,0xB5436824 },
ALTROM(29, 1, 1, 131072, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x2b84519f, 0x7841873b,0xf009d834,0x1dfa2794,0xb3751bac,0xf86adcc8)
ALTROM(29, 1, 2, 131072, ROMTYPE_ODD | ROMTYPE_8BIT, 0x1d35bd56, 0x6464be16,0x26b51949,0x9e76e4e3,0x409e8016,0x515d48b6)
- { "Freezer: Action Replay Mk III v3.17", 3, 17, 3, 17, "AR\0", 262144, 30, 0, 0, ROMTYPE_AR, 0, 1, NULL,
+ { L"Freezer: Action Replay Mk III v3.17", 3, 17, 3, 17, L"AR\0", 262144, 30, 0, 0, ROMTYPE_AR, 0, 1, NULL,
0xc8a16406, 0x5D4987C2,0xE3FFEA8B,0x1B02E314,0x30EF190F,0x2DB76542 },
- { "Freezer: Action Replay 1200", 0, 0, 0, 0, "AR\0", 262144, 47, 0, 0, ROMTYPE_AR, 0, 1, NULL,
+ { L"Freezer: Action Replay 1200", 0, 0, 0, 0, L"AR\0", 262144, 47, 0, 0, ROMTYPE_AR, 0, 1, NULL,
0x8d760101, 0x0F6AB834,0x2810094A,0xC0642F62,0xBA42F78B,0xC0B07E6A },
- { "Freezer: Action Cartridge Super IV Professional", 0, 0, 0, 0, "SUPERIV\0", 0, 62, 0, 0, ROMTYPE_SUPERIV, 0, 1, NULL,
- 0xffffffff, 0, 0, 0, 0, 0, "SuperIV" },
- { "Freezer: Action Cart. Super IV Pro (+ROM v4.3)", 4, 3, 4, 3, "SUPERIV\0", 170368, 60, 0, 0, ROMTYPE_SUPERIV, 0, 1, NULL,
+ { L"Freezer: Action Cartridge Super IV Professional", 0, 0, 0, 0, L"SUPERIV\0", 0, 62, 0, 0, ROMTYPE_SUPERIV, 0, 1, NULL,
+ 0xffffffff, 0, 0, 0, 0, 0, L"SuperIV" },
+ { L"Freezer: Action Cart. Super IV Pro (+ROM v4.3)", 4, 3, 4, 3, L"SUPERIV\0", 170368, 60, 0, 0, ROMTYPE_SUPERIV, 0, 1, NULL,
0xe668a0be, 0x633A6E65,0xA93580B8,0xDDB0BE9C,0x9A64D4A1,0x7D4B4801 },
- { "Freezer: X-Power Professional 500 v1.2", 1, 2, 1, 2, "XPOWER\0", 131072, 65, 0, 0, ROMTYPE_XPOWER, 0, 1, NULL,
+ { L"Freezer: X-Power Professional 500 v1.2", 1, 2, 1, 2, L"XPOWER\0", 131072, 65, 0, 0, ROMTYPE_XPOWER, 0, 1, NULL,
0x9e70c231, 0xa2977a1c,0x41a8ca7d,0x4af4a168,0x726da542,0x179d5963 },
ALTROM(65, 1, 1, 65536, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xf98742e4,0xe8e683ba,0xd8b38d1f,0x79f3ad83,0xa9e67c6f,0xa91dc96c)
ALTROM(65, 1, 2, 65536, ROMTYPE_ODD |ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xdfb9984b,0x8d6bdd49,0x469ec8e2,0x0143fbb3,0x72e92500,0x99f07910)
- { "Freezer: X-Power Professional 500 v1.3", 1, 2, 1, 2, "XPOWER\0", 131072, 68, 0, 0, ROMTYPE_XPOWER, 0, 1, NULL,
+ { L"Freezer: X-Power Professional 500 v1.3", 1, 2, 1, 2, L"XPOWER\0", 131072, 68, 0, 0, ROMTYPE_XPOWER, 0, 1, NULL,
0x31e057f0, 0x84650266,0x465d1859,0x7fd71dee,0x00775930,0xb7e450ee },
ALTROM(68, 1, 1, 65536, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0x0b2ce0c7,0x45ad5456,0x89192404,0x956f47ce,0xf66a5274,0x57ace33b)
ALTROM(68, 1, 2, 65536, ROMTYPE_ODD |ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0x34580c35,0x8ad42566,0x7364f238,0x978f4381,0x08f8d5ec,0x470e72ea)
- { "Freezer: Nordic Power v1.5", 1, 5, 1, 5, "NPOWER\0", 65536, 69, 0, 0, ROMTYPE_NORDIC, 0, 1, NULL,
+ { L"Freezer: Nordic Power v1.5", 1, 5, 1, 5, L"NPOWER\0", 65536, 69, 0, 0, ROMTYPE_NORDIC, 0, 1, NULL,
0x83b4b21c, 0xc56ced25,0x506a5aab,0x3fa13813,0x4fc9e5ae,0x0f9d3709 },
ALTROM(69, 1, 1, 32768, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xdd207174,0xae67652d,0x64f5db20,0x0f4b2110,0xee59567f,0xfbd90a1b)
ALTROM(69, 1, 2, 32768, ROMTYPE_ODD |ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0x8f93d85d,0x73c62d21,0x40c0c092,0x6315b702,0xdd5d0f05,0x3dad7fab)
- { "Freezer: Nordic Power v2.0", 2, 0, 2, 0, "NPOWER\0", 65536, 67, 0, 0, ROMTYPE_NORDIC, 0, 1, NULL,
+ { L"Freezer: Nordic Power v2.0", 2, 0, 2, 0, L"NPOWER\0", 65536, 67, 0, 0, ROMTYPE_NORDIC, 0, 1, NULL,
0xa4db2906, 0x0aec68f7,0x25470c89,0x6b699ff4,0x6623dec5,0xc777466e },
ALTROM(67, 1, 1, 32768, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xb21be46c,0x50dc607c,0xce976bbd,0x3841eaf0,0x591ddc7e,0xa1939ad2)
ALTROM(67, 1, 2, 32768, ROMTYPE_ODD |ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0x96057aed,0xdd9209e2,0x1d5edfc1,0xcdb52abe,0x93de0f35,0xc43da696)
- { "Freezer: Nordic Power v3.0", 3, 0, 3, 0, "NPOWER\0", 65536, 70, 0, 0, ROMTYPE_NORDIC, 0, 1, NULL,
+ { L"Freezer: Nordic Power v3.0", 3, 0, 3, 0, L"NPOWER\0", 65536, 70, 0, 0, ROMTYPE_NORDIC, 0, 1, NULL,
0x72850aef, 0x59c91d1f,0xa8f118f9,0x0bdba05a,0x9ae788d7,0x7a6cc7c9 },
ALTROM(70, 1, 1, 32768, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xf3330e1f,0x3a597db2,0xb7d11b6c,0xb8e13496,0xc215f223,0x88c4ca3c)
ALTROM(70, 1, 2, 32768, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xee58e0f9,0x4148f4cb,0xb42cec33,0x8ca144de,0xd4f54118,0xe0f185dd)
- { "Freezer: HRTMon v2.30 (built-in)", 0, 0, 0, 0, "HRTMON\0", 0, 63, 0, 0, ROMTYPE_HRTMON, 0, 1, NULL,
- 0xffffffff, 0, 0, 0, 0, 0, "HRTMon" },
+ { L"Freezer: HRTMon v2.30 (built-in)", 0, 0, 0, 0, L"HRTMON\0", 0, 63, 0, 0, ROMTYPE_HRTMON, 0, 1, NULL,
+ 0xffffffff, 0, 0, 0, 0, 0, L"HRTMon" },
- { "A590/A2091 SCSI boot ROM", 6, 0, 6, 0, "A590\0A2091\0", 16384, 53, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
+ { L"A590/A2091 SCSI boot ROM", 6, 0, 6, 0, L"A590\0A2091\0", 16384, 53, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
0x8396cf4e, 0x5E03BC61,0x8C862ABE,0x7BF79723,0xB4EEF4D2,0x1859A0F2 },
ALTROM(53, 1, 1, 8192, ROMTYPE_ODD | ROMTYPE_8BIT, 0xb0b8cf24,0xfcf40175,0x05f4d441,0x814b45d5,0x59c19eab,0x43816b30)
ALTROM(53, 1, 2, 8192, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x2e77bbff,0x8a098845,0x068f32cf,0xa4d34a27,0x8cd290f6,0x1d35a52c)
- { "A590/A2091 SCSI boot ROM", 6, 6, 6, 6, "A590\0A2091\0", 16384, 54, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
+ { L"A590/A2091 SCSI boot ROM", 6, 6, 6, 6, L"A590\0A2091\0", 16384, 54, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
0x33e00a7a, 0x739BB828,0xE874F064,0x9360F59D,0x26B5ED3F,0xBC99BB66 },
ALTROM(54, 1, 1, 8192, ROMTYPE_ODD | ROMTYPE_8BIT, 0xe536bbb2,0xfd7f8a6d,0xa18c1b02,0xd07eb990,0xc2467a24,0x183ede12)
ALTROM(54, 1, 2, 8192, ROMTYPE_EVEN | ROMTYPE_8BIT, 0xc0871d25,0xe155f18a,0xbb90cf82,0x0589c15e,0x70559d3b,0x6b391af8)
- { "A590/A2091 SCSI boot ROM", 7, 0, 7, 0, "A590\0A2091\0", 16384, 55, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
+ { L"A590/A2091 SCSI boot ROM", 7, 0, 7, 0, L"A590\0A2091\0", 16384, 55, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
0x714a97a2, 0xE50F01BA,0xF2899892,0x85547863,0x72A82C33,0x3C91276E },
ALTROM(55, 1, 1, 8192, ROMTYPE_ODD | ROMTYPE_8BIT, 0xa9ccffed,0x149f5bd5,0x2e2d2990,0x4e3de483,0xb9ad7724,0x48e9278e)
ALTROM(55, 1, 2, 8192, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x2942747a,0xdbd7648e,0x79c75333,0x7ff3e4f4,0x91de224b,0xf05e6bb6)
- { "A590/A2091 SCSI Guru boot ROM", 6, 14, 6, 14, "A590\0A2091\0", 32768, 56, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
+ { L"A590/A2091 SCSI Guru boot ROM", 6, 14, 6, 14, L"A590\0A2091\0", 32768, 56, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
0x04e52f93, 0x6DA21B6F,0x5E8F8837,0xD64507CD,0x8A4D5CDC,0xAC4F426B },
- { "A4091 SCSI boot ROM", 40, 9, 40, 9, "A4091\0", 32768, 57, 0, 0, ROMTYPE_A4091BOOT, 0, 0, NULL,
+ { L"A4091 SCSI boot ROM", 40, 9, 40, 9, L"A4091\0", 32768, 57, 0, 0, ROMTYPE_A4091BOOT, 0, 0, NULL,
0x00000000, 0, 0, 0, 0, 0 },
- { "A4091 SCSI boot ROM", 40, 13, 40, 13, "A4091\0", 32768, 58, 0, 0, ROMTYPE_A4091BOOT, 0, 0, NULL,
+ { L"A4091 SCSI boot ROM", 40, 13, 40, 13, L"A4091\0", 32768, 58, 0, 0, ROMTYPE_A4091BOOT, 0, 0, NULL,
0x54cb9e85, 0x3CE66919,0xF6FD6797,0x4923A12D,0x91B730F1,0xFFB4A7BA },
- { "Arcadia OnePlay 2.11", 0, 0, 0, 0, "ARCADIA\0", 0, 49, 0, 0, ROMTYPE_ARCADIABIOS, 0, 0 },
- { "Arcadia TenPlay 2.11", 0, 0, 0, 0, "ARCADIA\0", 0, 50, 0, 0, ROMTYPE_ARCADIABIOS, 0, 0 },
- { "Arcadia OnePlay 3.00", 0, 0, 0, 0, "ARCADIA\0", 0, 51, 0, 0, ROMTYPE_ARCADIABIOS, 0, 0 },
-
- { "Arcadia SportTime Table Hockey", 0, 0, 0, 0, "ARCADIA\0", 0, 33, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
- { "Arcadia SportTime Bowling", 0, 0, 0, 0, "ARCADIA\0", 0, 34, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
- { "Arcadia World Darts", 0, 0, 0, 0, "ARCADIA\0", 0, 35, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
- { "Arcadia Magic Johnson's Fast Break", 0, 0, 0, 0, "ARCADIA\0", 0, 36, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
- { "Arcadia Leader Board Golf", 0, 0, 0, 0, "ARCADIA\0", 0, 37, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
- { "Arcadia Leader Board Golf (alt)", 0, 0, 0, 0, "ARCADIA\0", 0, 38, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
- { "Arcadia Ninja Mission", 0, 0, 0, 0, "ARCADIA\0", 0, 39, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
- { "Arcadia Road Wars", 0, 0, 0, 0, "ARCADIA\0", 0, 40, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
- { "Arcadia Sidewinder", 0, 0, 0, 0, "ARCADIA\0", 0, 41, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
- { "Arcadia Spot", 0, 0, 0, 0, "ARCADIA\0", 0, 42, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
- { "Arcadia Space Ranger", 0, 0, 0, 0, "ARCADIA\0", 0, 43, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
- { "Arcadia Xenon", 0, 0, 0, 0, "ARCADIA\0", 0, 44, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
- { "Arcadia World Trophy Soccer", 0, 0, 0, 0, "ARCADIA\0", 0, 45, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
+ { L"Arcadia OnePlay 2.11", 0, 0, 0, 0, L"ARCADIA\0", 0, 49, 0, 0, ROMTYPE_ARCADIABIOS, 0, 0 },
+ { L"Arcadia TenPlay 2.11", 0, 0, 0, 0, L"ARCADIA\0", 0, 50, 0, 0, ROMTYPE_ARCADIABIOS, 0, 0 },
+ { L"Arcadia OnePlay 3.00", 0, 0, 0, 0, L"ARCADIA\0", 0, 51, 0, 0, ROMTYPE_ARCADIABIOS, 0, 0 },
+
+ { L"Arcadia SportTime Table Hockey", 0, 0, 0, 0, L"ARCADIA\0", 0, 33, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
+ { L"Arcadia SportTime Bowling", 0, 0, 0, 0, L"ARCADIA\0", 0, 34, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
+ { L"Arcadia World Darts", 0, 0, 0, 0, L"ARCADIA\0", 0, 35, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
+ { L"Arcadia Magic Johnson's Fast Break", 0, 0, 0, 0, L"ARCADIA\0", 0, 36, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
+ { L"Arcadia Leader Board Golf", 0, 0, 0, 0, L"ARCADIA\0", 0, 37, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
+ { L"Arcadia Leader Board Golf (alt)", 0, 0, 0, 0, L"ARCADIA\0", 0, 38, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
+ { L"Arcadia Ninja Mission", 0, 0, 0, 0, L"ARCADIA\0", 0, 39, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
+ { L"Arcadia Road Wars", 0, 0, 0, 0, L"ARCADIA\0", 0, 40, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
+ { L"Arcadia Sidewinder", 0, 0, 0, 0, L"ARCADIA\0", 0, 41, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
+ { L"Arcadia Spot", 0, 0, 0, 0, L"ARCADIA\0", 0, 42, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
+ { L"Arcadia Space Ranger", 0, 0, 0, 0, L"ARCADIA\0", 0, 43, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
+ { L"Arcadia Xenon", 0, 0, 0, 0, L"ARCADIA\0", 0, 44, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
+ { L"Arcadia World Trophy Soccer", 0, 0, 0, 0, L"ARCADIA\0", 0, 45, 0, 0, ROMTYPE_ARCADIAGAME, 0, 2 },
{ NULL }
int i;
int mask = 0;
struct romdata *parent;
- char *pn;
+ TCHAR *pn;
xfree (rl);
rl = 0;
rd->type &= ~ROMTYPE_MASK;
rd->type |= mask & ROMTYPE_MASK;
if (rd->partnumber && !pn) {
- char *newpn;
+ TCHAR *newpn;
if (parent->partnumber == NULL)
- parent->partnumber = my_strdup ("");
- newpn = xcalloc (strlen (parent->partnumber) + 1 + strlen (rd->partnumber) + 1, 1);
- if (strlen (parent->partnumber) > 0) {
- strcpy (newpn, parent->partnumber);
- strcat (newpn, "/");
+ parent->partnumber = my_strdup (L"");
+ newpn = xcalloc ((_tcslen (parent->partnumber) + 1 + _tcslen (rd->partnumber) + 1) * sizeof (TCHAR), 1);
+ if (_tcslen (parent->partnumber) > 0) {
+ _tcscpy (newpn, parent->partnumber);
+ _tcscat (newpn, L"/");
}
- strcat (newpn, rd->partnumber);
+ _tcscat (newpn, rd->partnumber);
xfree (parent->partnumber);
parent->partnumber = newpn;
}
struct romlist *rl = romlist_getrl (&roms[i]);
if (rl) {
int cnt = romlist_cnt - i - 1;
- write_log ("%d '%s' removed from romlist\n", roms[k].name, rl->path);
+ write_log (L"%d '%s' removed from romlist\n", roms[k].name, rl->path);
xfree (rl->path);
if (cnt > 0)
memmove (rl, rl + 1, cnt * sizeof (struct romlist));
}
for (i = 0; i < romlist_cnt; i++) {
struct romlist *rll = &rl[i];
- //write_log ("%s (%s)\n", rll->rd->name, rll->path);
+ //write_log (L"%s (%s)\n", rll->rd->name, rll->path);
}
}
-struct romlist **getromlistbyident(int ver, int rev, int subver, int subrev, char *model, int all)
+struct romlist **getromlistbyident(int ver, int rev, int subver, int subrev, TCHAR *model, int all)
{
int i, j, ok, out, max;
struct romdata *rd;
rd = &roms[i];
if (rd->group)
continue;
- if (model && !strcmpi(model, rd->name))
+ if (model && !_tcsicmp (model, rd->name))
ok = 2;
if (rd->ver == ver && (rev < 0 || rd->rev == rev)) {
if (subver >= 0) {
if (!ok)
continue;
if (model && ok < 2) {
- char *p = rd->model;
+ TCHAR *p = rd->model;
ok = 0;
while (*p) {
- if (!strcmp(rd->model, model)) {
+ if (!_tcscmp(rd->model, model)) {
ok = 1;
break;
}
- p = p + strlen(p) + 1;
+ p = p + _tcslen(p) + 1;
}
}
if (!model && rd->type != ROMTYPE_KICK)
return rdout;
}
-struct romdata *getarcadiarombyname (char *name)
+struct romdata *getarcadiarombyname (TCHAR *name)
{
int i;
for (i = 0; roms[i].name; i++) {
if (roms[i].group == 0 && (roms[i].type == ROMTYPE_ARCADIAGAME || roms[i].type == ROMTYPE_ARCADIAGAME)) {
- char *p = roms[i].name;
- p = p + strlen (p) + 1;
- if (strlen (name) >= strlen (p) + 4) {
- char *p2 = name + strlen (name) - strlen (p) - 4;
- if (!memcmp (p, p2, strlen (p)) && !memcmp (p2 + strlen (p2) - 4, ".zip", 4))
+ TCHAR *p = roms[i].name;
+ p = p + _tcslen (p) + 1;
+ if (_tcslen (name) >= _tcslen (p) + 4) {
+ TCHAR *p2 = name + _tcslen (name) - _tcslen (p) - 4;
+ if (!memcmp (p, p2, _tcslen (p)) && !memcmp (p2 + _tcslen (p2) - 4, ".zip", 4))
return &roms[i];
}
}
static struct rom_key keyring[ROM_KEY_NUM];
-static void addkey (uae_u8 *key, int size, const char *name)
+static void addkey (uae_u8 *key, int size, const TCHAR *name)
{
int i;
}
keyring[i].key = key;
keyring[i].size = size;
- write_log ("ROM KEY '%s' %d bytes loaded\n", name, size);
+ write_log (L"ROM KEY '%s' %d bytes loaded\n", name, size);
}
-static void addkeyfile (const char *path)
+static void addkeyfile (const TCHAR *path)
{
struct zfile *f;
int keysize;
uae_u8 *keybuf;
- f = zfile_fopen (path, "rb");
+ f = zfile_fopen (path, L"rb");
if (!f)
return;
zfile_fseek (f, 0, SEEK_END);
zfile_fclose (f);
}
-static void addkeydir (const char *path)
+static void addkeydir (const TCHAR *path)
{
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
- strcpy (tmp, path);
+ _tcscpy (tmp, path);
if (zfile_exists (tmp)) {
int i;
- for (i = strlen (tmp) - 1; i > 0; i--) {
+ for (i = _tcslen (tmp) - 1; i > 0; i--) {
if (tmp[i] == '\\' || tmp[i] == '/')
break;
}
tmp[i] = 0;
}
- strcat (tmp, "/");
- strcat (tmp, "rom.key");
+ _tcscat (tmp, L"/");
+ _tcscat (tmp, L"rom.key");
addkeyfile (tmp);
}
return num;
}
-int load_keyring (struct uae_prefs *p, char *path)
+int load_keyring (struct uae_prefs *p, TCHAR *path)
{
uae_u8 *keybuf;
int keysize;
- char tmp[MAX_PATH], *d;
+ TCHAR tmp[MAX_PATH], *d;
int keyids[] = { 0, 48, -1 };
int cnt, i;
addkey (keybuf, keysize, tmp);
for (i = 0; keyids[i] >= 0; i++) {
struct romdata *rd = getromdatabyid (keyids[i]);
- char *s;
+ TCHAR *s;
if (rd) {
s = romlist_get (rd);
if (s)
{
case 0:
if (path)
- strcpy (tmp, path);
+ _tcscpy (tmp, path);
break;
case 1:
- strcat (tmp, "rom.key");
+ _tcscat (tmp, L"rom.key");
break;
case 2:
if (p) {
- strcpy (tmp, p->path_rom);
- strcat (tmp, "rom.key");
+ _tcscpy (tmp, p->path_rom);
+ _tcscat (tmp, L"rom.key");
}
break;
case 3:
- strcpy (tmp, "roms/rom.key");
+ _tcscpy (tmp, L"roms/rom.key");
break;
case 4:
- strcpy (tmp, start_path_data);
- strcat (tmp, "rom.key");
+ _tcscpy (tmp, start_path_data);
+ _tcscat (tmp, L"rom.key");
break;
case 5:
- sprintf (tmp, "%s../shared/rom/rom.key", start_path_data);
+ _stprintf (tmp, L"%s../shared/rom/rom.key", start_path_data);
break;
case 6:
if (p) {
for (i = 0; uae_archive_extensions[i]; i++) {
- if (strstr(p->romfile, uae_archive_extensions[i]))
+ if (_tcsstr (p->romfile, uae_archive_extensions[i]))
break;
}
if (!uae_archive_extensions[i]) {
- strcpy (tmp, p->romfile);
- d = strrchr(tmp, '/');
+ _tcscpy (tmp, p->romfile);
+ d = _tcsrchr (tmp, '/');
if (!d)
- d = strrchr(tmp, '\\');
+ d = _tcsrchr (tmp, '\\');
if (d)
- strcpy (d + 1, "rom.key");
+ _tcscpy (d + 1, L"rom.key");
}
}
break;
memset(keyring, 0, sizeof (struct rom_key) * ROM_KEY_NUM);
}
-struct romdata *getromdatabyname (char *name)
+struct romdata *getromdatabyname (TCHAR *name)
{
- char tmp[MAX_PATH];
+ TCHAR tmp[MAX_PATH];
int i = 0;
while (roms[i].name) {
if (!roms[i].group) {
getromname (&roms[i], tmp);
- if (!strcmp (tmp, name) || !strcmp (roms[i].name, name))
+ if (!_tcscmp (tmp, name) || !_tcscmp (roms[i].name, name))
return &roms[i];
}
i++;
return rd;
}
-void getromname (struct romdata *rd, char *name)
+void getromname (struct romdata *rd, TCHAR *name)
{
name[0] = 0;
if (!rd)
return;
while (rd->group)
rd--;
- strcat (name, rd->name);
+ _tcscat (name, rd->name);
if ((rd->subrev || rd->subver) && rd->subver != rd->ver)
- sprintf (name + strlen (name), " rev %d.%d", rd->subver, rd->subrev);
+ _stprintf (name + _tcslen (name), L" rev %d.%d", rd->subver, rd->subrev);
if (rd->size > 0)
- sprintf (name + strlen (name), " (%dk)", (rd->size + 1023) / 1024);
- if (rd->partnumber && strlen (rd->partnumber) > 0)
- sprintf (name + strlen (name), " [%s]", rd->partnumber);
+ _stprintf (name + _tcslen (name), L" (%dk)", (rd->size + 1023) / 1024);
+ if (rd->partnumber && _tcslen (rd->partnumber) > 0)
+ _stprintf (name + _tcslen (name), L" [%s]", rd->partnumber);
}
struct romlist *getromlistbyromdata (struct romdata *rd)
void romwarning (int *ids)
{
int i, exp;
- char tmp1[MAX_DPATH], tmp2[MAX_DPATH];
- char tmp3[MAX_DPATH];
+ TCHAR tmp1[MAX_DPATH], tmp2[MAX_DPATH];
+ TCHAR tmp3[MAX_DPATH];
exp = 0;
tmp2[0] = 0;
while (ids[i] >= 0) {
struct romdata *rd = getromdatabyid (ids[i]);
getromname (rd, tmp1);
- strcat (tmp2, "- ");
- strcat (tmp2, tmp1);
- strcat (tmp2, "\n");
+ _tcscat (tmp2, L"- ");
+ _tcscat (tmp2, tmp1);
+ _tcscat (tmp2, L"\n");
if (rd->type & (ROMTYPE_A2091BOOT | ROMTYPE_A4091BOOT))
exp++;
i++;
}
#endif
-int addr_valid (char *txt, uaecptr addr, uae_u32 len)
+int addr_valid (TCHAR *txt, uaecptr addr, uae_u32 len)
{
addrbank *ab = &get_mem_bank(addr);
if (ab == 0 || !(ab->flags & ABFLAG_RAM) || addr < 0x100 || len < 0 || len > 16777215 || !valid_address (addr, len)) {
- write_log ("corrupt %s pointer %x (%d) detected!\n", txt, addr, len);
+ write_log (L"corrupt %s pointer %x (%d) detected!\n", txt, addr, len);
return 0;
}
return 1;
if (MAX_ILG >= 0)
illegal_count++;
if (ins) {
- write_log ("WARNING: Illegal opcode %cget at %08lx PC=%x\n",
+ write_log (L"WARNING: Illegal opcode %cget at %08lx PC=%x\n",
size == 2 ? 'w' : 'l', addr, M68K_GETPC);
} else if (rw) {
- write_log ("Illegal %cput at %08lx=%08lx PC=%x\n",
+ write_log (L"Illegal %cput at %08lx=%08lx PC=%x\n",
size == 1 ? 'b' : size == 2 ? 'w' : 'l', addr, val, M68K_GETPC);
} else {
- write_log ("Illegal %cget at %08lx PC=%x\n",
+ write_log (L"Illegal %cget at %08lx PC=%x\n",
size == 1 ? 'b' : size == 2 ? 'w' : 'l', addr, M68K_GETPC);
}
}
} else
a1000_handle_kickstart (0);
} else if (currprefs.illegal_mem)
- write_log ("Illegal kickmem lput at %08lx\n", addr);
+ write_log (L"Illegal kickmem lput at %08lx\n", addr);
}
static void REGPARAM2 kickmem_wput (uaecptr addr, uae_u32 b)
} else
a1000_handle_kickstart (0);
} else if (currprefs.illegal_mem)
- write_log ("Illegal kickmem wput at %08lx\n", addr);
+ write_log (L"Illegal kickmem wput at %08lx\n", addr);
}
static void REGPARAM2 kickmem_bput (uaecptr addr, uae_u32 b)
} else
a1000_handle_kickstart (0);
} else if (currprefs.illegal_mem)
- write_log ("Illegal kickmem lput at %08lx\n", addr);
+ write_log (L"Illegal kickmem lput at %08lx\n", addr);
}
static void REGPARAM2 kickmem2_lput (uaecptr addr, uae_u32 l)
special_mem |= S_WRITE;
#endif
if (currprefs.illegal_mem)
- write_log ("Illegal extendedkickmem lput at %08lx\n", addr);
+ write_log (L"Illegal extendedkickmem lput at %08lx\n", addr);
}
static void REGPARAM2 extendedkickmem_wput (uaecptr addr, uae_u32 b)
{
special_mem |= S_WRITE;
#endif
if (currprefs.illegal_mem)
- write_log ("Illegal extendedkickmem wput at %08lx\n", addr);
+ write_log (L"Illegal extendedkickmem wput at %08lx\n", addr);
}
static void REGPARAM2 extendedkickmem_bput (uaecptr addr, uae_u32 b)
{
special_mem |= S_WRITE;
#endif
if (currprefs.illegal_mem)
- write_log ("Illegal extendedkickmem lput at %08lx\n", addr);
+ write_log (L"Illegal extendedkickmem lput at %08lx\n", addr);
}
static int REGPARAM2 extendedkickmem_check (uaecptr addr, uae_u32 size)
{
special_mem |= S_WRITE;
#endif
if (currprefs.illegal_mem)
- write_log ("Illegal extendedkickmem2 lput at %08lx\n", addr);
+ write_log (L"Illegal extendedkickmem2 lput at %08lx\n", addr);
}
static void REGPARAM2 extendedkickmem2_wput (uaecptr addr, uae_u32 b)
{
special_mem |= S_WRITE;
#endif
if (currprefs.illegal_mem)
- write_log ("Illegal extendedkickmem2 wput at %08lx\n", addr);
+ write_log (L"Illegal extendedkickmem2 wput at %08lx\n", addr);
}
static void REGPARAM2 extendedkickmem2_bput (uaecptr addr, uae_u32 b)
{
special_mem |= S_WRITE;
#endif
if (currprefs.illegal_mem)
- write_log ("Illegal extendedkickmem2 lput at %08lx\n", addr);
+ write_log (L"Illegal extendedkickmem2 lput at %08lx\n", addr);
}
static int REGPARAM2 extendedkickmem2_check (uaecptr addr, uae_u32 size)
{
int i, j;
uaecptr a2 = a - 32;
uaecptr a3 = m68k_getpc (®s) - 32;
- write_log ("Your Amiga program just did something terribly stupid %08X PC=%08X\n", a, M68K_GETPC);
+ write_log (L"Your Amiga program just did something terribly stupid %08X PC=%08X\n", a, M68K_GETPC);
m68k_dumpstate (0, 0);
for (i = 0; i < 10; i++) {
- write_log ("%08X ", i >= 5 ? a3 : a2);
+ write_log (L"%08X ", i >= 5 ? a3 : a2);
for (j = 0; j < 16; j += 2) {
- write_log (" %04X", get_word (i >= 5 ? a3 : a2));
+ write_log (L" %04X", get_word (i >= 5 ? a3 : a2));
if (i >= 5) a3 += 2; else a2 += 2;
}
- write_log ("\n");
+ write_log (L"\n");
}
memory_map_dump ();
}
addrbank chipmem_bank = {
chipmem_lget, chipmem_wget, chipmem_bget,
chipmem_lput, chipmem_wput, chipmem_bput,
- chipmem_xlate, chipmem_check, NULL, "Chip memory",
+ chipmem_xlate, chipmem_check, NULL, L"Chip memory",
chipmem_lget, chipmem_wget, ABFLAG_RAM
};
addrbank chipmem_dummy_bank = {
chipmem_dummy_lget, chipmem_dummy_wget, chipmem_dummy_bget,
chipmem_dummy_lput, chipmem_dummy_wput, chipmem_dummy_bput,
- default_xlate, dummy_check, NULL, "Dummy Chip memory",
+ default_xlate, dummy_check, NULL, L"Dummy Chip memory",
dummy_lgeti, dummy_wgeti, ABFLAG_IO
};
addrbank chipmem_bank_ce2 = {
chipmem_lget_ce2, chipmem_wget_ce2, chipmem_bget_ce2,
chipmem_lput_ce2, chipmem_wput_ce2, chipmem_bput_ce2,
- chipmem_xlate, chipmem_check, NULL, "Chip memory (68020 'ce')",
+ chipmem_xlate, chipmem_check, NULL, L"Chip memory (68020 'ce')",
chipmem_lget_ce2, chipmem_wget_ce2, ABFLAG_RAM
};
#endif
addrbank bogomem_bank = {
bogomem_lget, bogomem_wget, bogomem_bget,
bogomem_lput, bogomem_wput, bogomem_bput,
- bogomem_xlate, bogomem_check, NULL, "Slow memory",
+ bogomem_xlate, bogomem_check, NULL, L"Slow memory",
bogomem_lget, bogomem_wget, ABFLAG_RAM
};
addrbank cardmem_bank = {
cardmem_lget, cardmem_wget, cardmem_bget,
cardmem_lput, cardmem_wput, cardmem_bput,
- cardmem_xlate, cardmem_check, NULL, "CDTV memory card",
+ cardmem_xlate, cardmem_check, NULL, L"CDTV memory card",
cardmem_lget, cardmem_wget, ABFLAG_RAM
};
addrbank a3000lmem_bank = {
a3000lmem_lget, a3000lmem_wget, a3000lmem_bget,
a3000lmem_lput, a3000lmem_wput, a3000lmem_bput,
- a3000lmem_xlate, a3000lmem_check, NULL, "RAMSEY memory (low)",
+ a3000lmem_xlate, a3000lmem_check, NULL, L"RAMSEY memory (low)",
a3000lmem_lget, a3000lmem_wget, ABFLAG_RAM
};
addrbank a3000hmem_bank = {
a3000hmem_lget, a3000hmem_wget, a3000hmem_bget,
a3000hmem_lput, a3000hmem_wput, a3000hmem_bput,
- a3000hmem_xlate, a3000hmem_check, NULL, "RAMSEY memory (high)",
+ a3000hmem_xlate, a3000hmem_check, NULL, L"RAMSEY memory (high)",
a3000hmem_lget, a3000hmem_wget, ABFLAG_RAM
};
addrbank kickmem_bank = {
kickmem_lget, kickmem_wget, kickmem_bget,
kickmem_lput, kickmem_wput, kickmem_bput,
- kickmem_xlate, kickmem_check, NULL, "Kickstart ROM",
+ kickmem_xlate, kickmem_check, NULL, L"Kickstart ROM",
kickmem_lget, kickmem_wget, ABFLAG_ROM
};
addrbank kickram_bank = {
kickmem_lget, kickmem_wget, kickmem_bget,
kickmem2_lput, kickmem2_wput, kickmem2_bput,
- kickmem_xlate, kickmem_check, NULL, "Kickstart Shadow RAM",
+ kickmem_xlate, kickmem_check, NULL, L"Kickstart Shadow RAM",
kickmem_lget, kickmem_wget, ABFLAG_UNK | ABFLAG_SAFE
};
addrbank extendedkickmem_bank = {
extendedkickmem_lget, extendedkickmem_wget, extendedkickmem_bget,
extendedkickmem_lput, extendedkickmem_wput, extendedkickmem_bput,
- extendedkickmem_xlate, extendedkickmem_check, NULL, "Extended Kickstart ROM",
+ extendedkickmem_xlate, extendedkickmem_check, NULL, L"Extended Kickstart ROM",
extendedkickmem_lget, extendedkickmem_wget, ABFLAG_ROM
};
addrbank extendedkickmem2_bank = {
extendedkickmem2_lget, extendedkickmem2_wget, extendedkickmem2_bget,
extendedkickmem2_lput, extendedkickmem2_wput, extendedkickmem2_bput,
- extendedkickmem2_xlate, extendedkickmem2_check, NULL, "Extended 2nd Kickstart ROM",
+ extendedkickmem2_xlate, extendedkickmem2_check, NULL, L"Extended 2nd Kickstart ROM",
extendedkickmem2_lget, extendedkickmem2_wget, ABFLAG_ROM
};
addrbank custmem1_bank = {
custmem1_lget, custmem1_wget, custmem1_bget,
custmem1_lput, custmem1_wput, custmem1_bput,
- custmem1_xlate, custmem1_check, NULL, "Non-autoconfig RAM #1",
+ custmem1_xlate, custmem1_check, NULL, L"Non-autoconfig RAM #1",
custmem1_lget, custmem1_wget, ABFLAG_RAM
};
addrbank custmem2_bank = {
custmem1_lget, custmem1_wget, custmem1_bget,
custmem1_lput, custmem1_wput, custmem1_bput,
- custmem1_xlate, custmem1_check, NULL, "Non-autoconfig RAM #2",
+ custmem1_xlate, custmem1_check, NULL, L"Non-autoconfig RAM #2",
custmem1_lget, custmem1_wget, ABFLAG_RAM
};
memcpy (kickmemory + fkickmem_size / 2, fkickmemory, fkickmem_size / 2);
extendedkickmem_size = 65536;
extendedkickmem_mask = extendedkickmem_size - 1;
- extendedkickmemory = mapped_malloc (extendedkickmem_size, "rom_f0");
+ extendedkickmemory = mapped_malloc (extendedkickmem_size, L"rom_f0");
extendedkickmem_bank.baseaddr = extendedkickmemory;
memcpy (extendedkickmemory, fkickmemory + fkickmem_size / 2, 65536);
map_banks (&extendedkickmem_bank, 0xf0, 1, 1);
{
struct zfile *zf;
struct romlist *rl = romlist_getrl (rd);
- char tmp[11];
+ uae_char tmp[11];
- if (!rl || strlen (rl->path) == 0)
+ if (!rl || _tcslen (rl->path) == 0)
return 0;
- zf = zfile_fopen (rl->path, "rb");
+ zf = zfile_fopen (rl->path, L"rb");
if (!zf)
return 0;
addkeydir (rl->path);
{
struct romdata *rd2 = *prd;
struct romdata *rd = *prd;
- char *name;
+ TCHAR *name;
int id = rd->id;
uae_u32 crc32;
int size;
return NULL;
}
-struct zfile *read_rom_name (const char *filename)
+struct zfile *read_rom_name (const TCHAR *filename)
{
int i;
struct zfile *f;
for (i = 0; i < romlist_cnt; i++) {
- if (!strcmpi (filename, rl[i].path)) {
+ if (!_tcsicmp (filename, rl[i].path)) {
struct romdata *rd = rl[i].rd;
f = read_rom (&rd);
if (f)
return f;
}
}
- f = zfile_fopen (filename, "rb");
+ f = zfile_fopen (filename, L"rb");
if (f) {
uae_u8 tmp[11];
zfile_fread (tmp, sizeof tmp, 1, f);
zfile_fseek (f, sizeof tmp, SEEK_SET);
buf = xmalloc (size);
zfile_fread (buf, size, 1, f);
- df = zfile_fopen_empty ("tmp.rom", size);
+ df = zfile_fopen_empty (L"tmp.rom", size);
decode_cloanto_rom_do (buf, size, size);
zfile_fwrite (buf, size, 1, df);
zfile_fclose (f);
return f;
}
-static char *kickstring = "exec.library";
+static uae_char *kickstring = "exec.library";
static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksum, int noalias)
{
- unsigned char buffer[20];
+ uae_char buffer[20];
int i, j, oldpos;
int cr = 0, kickdisk = 0;
zfile_fseek (f, oldpos + 0x6c, SEEK_SET);
cr = 2;
#endif
- } else if (strncmp ((char *)buffer, "AMIROMTYPE1", 11) != 0) {
+ } else if (memcmp ((uae_char*)buffer, "AMIROMTYPE1", 11) != 0) {
zfile_fseek (f, oldpos, SEEK_SET);
} else {
cloanto_rom = 1;
struct zfile *f;
int size, off;
- if (strlen (currprefs.romextfile) == 0)
+ if (_tcslen (currprefs.romextfile) == 0)
return 0;
if (is_arcadia_rom (currprefs.romextfile) == ARCADIA_BIOS) {
extendedkickmem_type = EXTENDED_ROM_ARCADIA;
zfile_fseek (f, off, SEEK_SET);
switch (extendedkickmem_type) {
case EXTENDED_ROM_CDTV:
- extendedkickmemory = mapped_malloc (extendedkickmem_size, "rom_f0");
+ extendedkickmemory = mapped_malloc (extendedkickmem_size, L"rom_f0");
extendedkickmem_bank.baseaddr = extendedkickmemory;
break;
case EXTENDED_ROM_CD32:
- extendedkickmemory = mapped_malloc (extendedkickmem_size, "rom_e0");
+ extendedkickmemory = mapped_malloc (extendedkickmem_size, L"rom_e0");
extendedkickmem_bank.baseaddr = extendedkickmemory;
break;
}
!memcmp (kickmemory + i, kickshift2, sizeof (kickshift2)) ||
!memcmp (kickmemory + i, kickshift3, sizeof (kickshift3))) {
kickmemory[i + 2] = 0x30;
- write_log ("Kickstart KickShifted @%04X\n", i);
+ write_log (L"Kickstart KickShifted @%04X\n", i);
patched++;
}
}
static int patch_residents (uae_u8 *kickmemory, int size)
{
int i, j, patched = 0;
- char *residents[] = { "NCR scsi.device", 0 };
+ uae_char *residents[] = { "NCR scsi.device", 0 };
// "scsi.device", "carddisk.device", "card.resource" };
uaecptr base = size == 524288 ? 0xf80000 : 0xfc0000;
j = 0;
while (residents[j]) {
if (!memcmp (residents[j], kickmemory + addr - base, strlen (residents[j]) + 1)) {
- write_log ("KSPatcher: '%s' at %08X disabled\n", residents[j], i + base);
+ write_log (L"KSPatcher: '%s' at %08X disabled\n", residents[j], i + base);
kickmemory[i] = 0x4b; /* destroy RTC_MATCHWORD */
patched++;
break;
static int load_kickstart (void)
{
struct zfile *f;
- char tmprom[MAX_DPATH], tmprom2[MAX_DPATH];
+ TCHAR tmprom[MAX_DPATH], tmprom2[MAX_DPATH];
int patched = 0;
cloanto_rom = 0;
f = read_rom_name (currprefs.romfile);
- strcpy (tmprom, currprefs.romfile);
+ _tcscpy (tmprom, currprefs.romfile);
if (f == NULL) {
- sprintf (tmprom2, "%s%s", start_path_data, currprefs.romfile);
- f = zfile_fopen (tmprom2, "rb");
+ _stprintf (tmprom2, L"%s%s", start_path_data, currprefs.romfile);
+ f = zfile_fopen (tmprom2, L"rb");
if (f == NULL) {
- sprintf (currprefs.romfile, "%sroms/kick.rom", start_path_data);
- f = zfile_fopen (currprefs.romfile, "rb");
+ _stprintf (currprefs.romfile, L"%sroms/kick.rom", start_path_data);
+ f = zfile_fopen (currprefs.romfile, L"rb");
if (f == NULL) {
- sprintf (currprefs.romfile, "%skick.rom", start_path_data);
- f = zfile_fopen (currprefs.romfile, "rb");
+ _stprintf (currprefs.romfile, L"%skick.rom", start_path_data);
+ f = zfile_fopen (currprefs.romfile, L"rb");
if (f == NULL) {
- sprintf (currprefs.romfile, "%s../shared/rom/kick.rom", start_path_data);
- f = zfile_fopen (currprefs.romfile, "rb");
+ _stprintf (currprefs.romfile, L"%s../shared/rom/kick.rom", start_path_data);
+ f = zfile_fopen (currprefs.romfile, L"rb");
if (f == NULL) {
- sprintf (currprefs.romfile, "%s../System/rom/kick.rom", start_path_data);
- f = zfile_fopen (currprefs.romfile, "rb");
+ _stprintf (currprefs.romfile, L"%s../System/rom/kick.rom", start_path_data);
+ f = zfile_fopen (currprefs.romfile, L"rb");
}
}
}
} else {
- strcpy (currprefs.romfile, tmprom2);
+ _tcscpy (currprefs.romfile, tmprom2);
}
}
addkeydir (currprefs.romfile);
#define USE_UAE_ERSATZ "USE_UAE_ERSATZ"
if( !getenv(USE_UAE_ERSATZ))
{
- write_log ("Using current ROM. (create ENV:%s to "
+ write_log (L"Using current ROM. (create ENV:%s to "
"use uae's ROM replacement)\n",USE_UAE_ERSATZ);
memcpy(kickmemory,(char*)0x1000000-kickmem_size,kickmem_size);
kickstart_checksum (kickmemory, kickmem_size);
if (currprefs.cs_cdtvcd || currprefs.cs_cdtvram) {
extendedkickmem_type = EXTENDED_ROM_CDTV;
extendedkickmem_size *= 2;
- extendedkickmemory = mapped_malloc (extendedkickmem_size, "rom_f0");
+ extendedkickmemory = mapped_malloc (extendedkickmem_size, L"rom_f0");
} else {
extendedkickmem_type = EXTENDED_ROM_KS;
- extendedkickmemory = mapped_malloc (extendedkickmem_size, "rom_e0");
+ extendedkickmemory = mapped_malloc (extendedkickmem_size, L"rom_e0");
}
extendedkickmem_bank.baseaddr = extendedkickmemory;
zfile_fseek (f, extpos, SEEK_SET);
}
if (filesize > 524288 * 2) {
extendedkickmem2_size = 524288 * 2;
- extendedkickmemory2 = mapped_malloc (extendedkickmem2_size, "rom_a8");
+ extendedkickmemory2 = mapped_malloc (extendedkickmem2_size, L"rom_a8");
extendedkickmem2_bank.baseaddr = extendedkickmemory2;
zfile_fseek (f, extpos + 524288, SEEK_SET);
read_kickstart (f, extendedkickmemory2, 524288, 0, 1);
zfile_fclose (f);
return 1;
err:
- strcpy (currprefs.romfile, tmprom);
+ _tcscpy (currprefs.romfile, tmprom);
zfile_fclose (f);
return 0;
}
#ifndef NATMEM_OFFSET
-uae_u8 *mapped_malloc (size_t s, char *file)
+uae_u8 *mapped_malloc (size_t s, TCHAR *file)
{
return xmalloc (s);
}
static void dumplist (void)
{
shmpiece *x = shm_start;
- write_log ("Start Dump:\n");
+ write_log (L"Start Dump:\n");
while (x) {
- write_log ("this=%p,Native %p,id %d,prev=%p,next=%p,size=0x%08x\n",
+ write_log (L"this=%p,Native %p,id %d,prev=%p,next=%p,size=0x%08x\n",
x, x->native_address, x->id, x->prev, x->next, x->size);
x = x->next;
}
- write_log ("End Dump:\n");
+ write_log (L"End Dump:\n");
}
static shmpiece *find_shmpiece (uae_u8 *base)
while (x && x->native_address != base)
x = x->next;
if (!x) {
- write_log ("NATMEM: Failure to find mapping at %08X, %p\n", base - NATMEM_OFFSET, base);
+ write_log (L"NATMEM: Failure to find mapping at %08X, %p\n", base - NATMEM_OFFSET, base);
nocanbang ();
return 0;
}
if (x->size > size) {
if (isdirectjit ())
- write_log ("NATMEM WARNING: size mismatch mapping at %08x (size %08x, delsize %08x)\n",start,x->size,size);
+ write_log (L"NATMEM WARNING: size mismatch mapping at %08x (size %08x, delsize %08x)\n",start,x->size,size);
size = x->size;
}
#if 0
base = ((uae_u8 *) NATMEM_OFFSET) + start;
y->native_address = shmat (y->id, base, 0);
if (y->native_address == (void *) -1) {
- write_log ("NATMEM: Failure to map existing at %08x(%p)\n", start, base);
+ write_log (L"NATMEM: Failure to map existing at %08x(%p)\n", start, base);
dumplist ();
nocanbang ();
return;
shm_start = y;
}
-uae_u8 *mapped_malloc (size_t s, const char *file)
+uae_u8 *mapped_malloc (size_t s, const TCHAR *file)
{
int id;
void *answer;
answer = shmat (id, 0, 0);
shmctl (id, IPC_RMID, NULL);
if (answer != (void *) -1) {
- x = (shmpiece*)xmalloc (sizeof (shmpiece));
+ x = xmalloc (sizeof (shmpiece));
x->native_address = (uae_u8*)answer;
x->id = id;
x->size = s;
chipmem_mask = allocated_chipmem - 1;
chipmem_full_mask = allocated_chipmem * 2 - 1;
chipmem_full_size = 0x80000 * 2;
- chipmemory = mapped_malloc (memsize1 + memsize2, "chip");
+ chipmemory = mapped_malloc (memsize1 + memsize2, L"chip");
bogomemory = chipmemory + memsize1;
bogomem_mask = allocated_bogomem - 1;
if (chipmemory == 0) {
- write_log ("Fatal error: out of memory for chipmem.\n");
+ write_log (L"Fatal error: out of memory for chipmem.\n");
allocated_chipmem = 0;
} else {
need_hardreset = 1;
memsize = 0x100000;
if (memsize > 0x100000 && memsize < 0x200000)
memsize = 0x200000;
- chipmemory = mapped_malloc (memsize, "chip");
+ chipmemory = mapped_malloc (memsize, L"chip");
if (chipmemory == 0) {
- write_log ("Fatal error: out of memory for chipmem.\n");
+ write_log (L"Fatal error: out of memory for chipmem.\n");
allocated_chipmem = 0;
} else {
need_hardreset = 1;
bogomem_mask = allocated_bogomem - 1;
if (allocated_bogomem) {
- bogomemory = mapped_malloc (allocated_bogomem, "bogo");
+ bogomemory = mapped_malloc (allocated_bogomem, L"bogo");
if (bogomemory == 0) {
- write_log ("Out of memory for bogomem.\n");
+ write_log (L"Out of memory for bogomem.\n");
allocated_bogomem = 0;
}
}
a3000lmem_mask = allocated_a3000lmem - 1;
a3000lmem_start = 0x08000000 - allocated_a3000lmem;
if (allocated_a3000lmem) {
- a3000lmemory = mapped_malloc (allocated_a3000lmem, "ramsey_low");
+ a3000lmemory = mapped_malloc (allocated_a3000lmem, L"ramsey_low");
if (a3000lmemory == 0) {
- write_log ("Out of memory for a3000lowmem.\n");
+ write_log (L"Out of memory for a3000lowmem.\n");
allocated_a3000lmem = 0;
}
}
a3000hmem_mask = allocated_a3000hmem - 1;
a3000hmem_start = 0x08000000;
if (allocated_a3000hmem) {
- a3000hmemory = mapped_malloc (allocated_a3000hmem, "ramsey_high");
+ a3000hmemory = mapped_malloc (allocated_a3000hmem, L"ramsey_high");
if (a3000hmemory == 0) {
- write_log ("Out of memory for a3000highmem.\n");
+ write_log (L"Out of memory for a3000highmem.\n");
allocated_a3000hmem = 0;
}
}
allocated_cardmem = currprefs.cs_cdtvcard * 1024;
cardmem_mask = allocated_cardmem - 1;
if (allocated_cardmem) {
- cardmemory = mapped_malloc (allocated_cardmem, "rom_e0");
+ cardmemory = mapped_malloc (allocated_cardmem, L"rom_e0");
if (cardmemory == 0) {
- write_log ("Out of memory for cardmem.\n");
+ write_log (L"Out of memory for cardmem.\n");
allocated_cardmem = 0;
}
}
allocated_custmem1 = currprefs.custom_memory_sizes[0];
custmem1_mask = allocated_custmem1 - 1;
if (allocated_custmem1) {
- custmem1 = mapped_malloc (allocated_custmem1, "custmem1");
+ custmem1 = mapped_malloc (allocated_custmem1, L"custmem1");
if (!custmem1)
allocated_custmem1 = 0;
}
allocated_custmem2 = currprefs.custom_memory_sizes[1];
custmem2_mask = allocated_custmem2 - 1;
if (allocated_custmem2) {
- custmem2 = mapped_malloc (allocated_custmem2, "custmem2");
+ custmem2 = mapped_malloc (allocated_custmem2, L"custmem2");
if (!custmem2)
allocated_custmem2 = 0;
}
init_mem_banks ();
allocate_memory ();
- if (strcmp (currprefs.romfile, changed_prefs.romfile) != 0
- || strcmp (currprefs.romextfile, changed_prefs.romextfile) != 0)
+ if (_tcscmp (currprefs.romfile, changed_prefs.romfile) != 0
+ || _tcscmp (currprefs.romextfile, changed_prefs.romextfile) != 0)
{
kickstart_rom = 1;
ersatzkickfile = 0;
load_extendedkickstart ();
kickmem_mask = 524288 - 1;
if (!load_kickstart ()) {
- if (strlen (currprefs.romfile) > 0) {
- write_log ("Failed to open '%s'\n", currprefs.romfile);
+ if (_tcslen (currprefs.romfile) > 0) {
+ write_log (L"Failed to open '%s'\n", currprefs.romfile);
notify_user (NUMSG_NOROM);
}
#ifdef AUTOCONFIG
#ifdef ARCADIA
if (is_arcadia_rom (currprefs.romextfile) == ARCADIA_BIOS) {
- if (strcmp (currprefs.romextfile, changed_prefs.romextfile) != 0)
+ if (_tcscmp (currprefs.romextfile, changed_prefs.romextfile) != 0)
memcpy (currprefs.romextfile, changed_prefs.romextfile, sizeof currprefs.romextfile);
- if (strcmp (currprefs.cartfile, changed_prefs.cartfile) != 0)
+ if (_tcscmp (currprefs.cartfile, changed_prefs.cartfile) != 0)
memcpy (currprefs.cartfile, changed_prefs.cartfile, sizeof currprefs.cartfile);
arcadia_unmap ();
is_arcadia_rom (currprefs.romextfile);
init_mem_banks ();
- kickmemory = mapped_malloc (0x80000, "kick");
+ kickmemory = mapped_malloc (0x80000, L"kick");
memset (kickmemory, 0, 0x80000);
kickmem_bank.baseaddr = kickmemory;
- strcpy (currprefs.romfile, "<none>");
+ _tcscpy (currprefs.romfile, L"<none>");
currprefs.romextfile[0] = 0;
#ifdef ACTION_REPLAY
addrbank *orgbank = bank;
uae_u32 realstart = start;
- //write_log ("MAP_BANK %04X0000 %d %s\n", start, size, bank->name);
+ //write_log (L"MAP_BANK %04X0000 %d %s\n", start, size, bank->name);
old = debug_bankchange (-1);
flush_icache (0, 3); /* Sure don't want to keep any old mappings around! */
realsize = size << 16;
if ((size << 16) < realsize) {
- write_log ("Broken mapping, size=%x, realsize=%x\nStart is %x\n",
+ write_log (L"Broken mapping, size=%x, realsize=%x\nStart is %x\n",
size, realsize, start);
}
uae_u8 *restore_rom (uae_u8 *src)
{
uae_u32 crc32, mem_start, mem_size, mem_type, version;
+ TCHAR *s;
int i;
mem_start = restore_u32 ();
mem_type = restore_u32 ();
version = restore_u32 ();
crc32 = restore_u32 ();
+ s = restore_string ();
for (i = 0; i < romlist_cnt; i++) {
if (rl[i].rd->crc32 == crc32 && crc32) {
switch (mem_type)
{
case 0:
- strncpy (changed_prefs.romfile, rl[i].path, 255);
+ _tcsncmp (changed_prefs.romfile, rl[i].path, 255);
break;
case 1:
- strncpy (changed_prefs.romextfile, rl[i].path, 255);
+ _tcsncmp (changed_prefs.romextfile, rl[i].path, 255);
break;
}
break;
}
}
- src += strlen (src) + 1;
- if (zfile_exists(src)) {
+ xfree (s);
+ s = restore_string ();
+ if (zfile_exists (s)) {
switch (mem_type)
{
case 0:
- strncpy (changed_prefs.romfile, src, 255);
+ _tcsncmp (changed_prefs.romfile, s, 255);
break;
case 1:
- strncpy (changed_prefs.romextfile, src, 255);
+ _tcsncmp (changed_prefs.romextfile, s, 255);
break;
}
}
- src += strlen (src) + 1;
+ xfree (s);
return src;
}
uae_u8 *dst, *dstbak;
uae_u8 *mem_real_start;
uae_u32 version;
- char *path;
+ TCHAR *path;
int mem_start, mem_size, mem_type, saverom;
int i;
- char tmpname[1000];
+ TCHAR tmpname[1000];
version = 0;
saverom = 0;
mem_start += 262144;
}
version = longget (mem_start + 12); /* version+revision */
- sprintf (tmpname, "Kickstart %d.%d", wordget (mem_start + 12), wordget (mem_start + 14));
+ _stprintf (tmpname, L"Kickstart %d.%d", wordget (mem_start + 12), wordget (mem_start + 14));
break;
case 1: /* Extended ROM */
if (!extendedkickmem_type)
mem_real_start = extendedkickmemory;
mem_size = extendedkickmem_size;
path = currprefs.romextfile;
- sprintf (tmpname, "Extended");
+ _stprintf (tmpname, L"Extended");
break;
default:
return 0;
save_u32 (mem_type);
save_u32 (version);
save_u32 (get_crc32 (mem_real_start, mem_size));
- strcpy (dst, tmpname);
- dst += strlen (dst) + 1;
- strcpy (dst, path);/* rom image name */
- dst += strlen (dst) + 1;
+ save_string (tmpname);
+ save_string (path);
if (saverom) {
for (i = 0; i < mem_size; i++)
*dst++ = byteget (mem_start + i);
void memcpyha_safe (uaecptr dst, const uae_u8 *src, int size)
{
- if (!addr_valid ("memcpyha", dst, size))
+ if (!addr_valid (L"memcpyha", dst, size))
return;
while (size--)
put_byte (dst++, *src++);
}
void memcpyah_safe (uae_u8 *dst, uaecptr src, int size)
{
- if (!addr_valid ("memcpyah", src, size))
+ if (!addr_valid (L"memcpyah", src, size))
return;
while (size--)
*dst++ = get_byte (src++);
while (size--)
*dst++ = get_byte (src++);
}
-char *strcpyah_safe (char *dst, uaecptr src, int maxsize)
+uae_char *strcpyah_safe (uae_char *dst, uaecptr src, int maxsize)
{
- char *res = dst;
+ uae_char *res = dst;
uae_u8 b;
do {
- if (!addr_valid ("strcpyah", src, 1))
+ if (!addr_valid (L"_tcscpyah", src, 1))
return res;
b = get_byte (src++);
*dst++ = b;
} while (b);
return res;
}
-uaecptr strcpyha_safe (uaecptr dst, const char *src)
+uaecptr strcpyha_safe (uaecptr dst, const uae_char *src)
{
uaecptr res = dst;
uae_u8 b;
do {
- if (!addr_valid ("strcpyha", dst, 1))
+ if (!addr_valid (L"_tcscpyha", dst, 1))
return res;
b = *src++;
put_byte (dst++, b);
#ifndef HAVE_STRDUP
-char *my_strdup (const char *s)
+TCHAR *my_strdup (const TCHAR *s)
{
- /* The casts to char * are there to shut up the compiler on HPUX */
- char *x = (char*)xmalloc(strlen((char *)s) + 1);
- strcpy(x, (char *)s);
+ TCHAR *x = (char*)xmalloc(strlen((TCHAR *)s) + 1);
+ strcpy(x, (TCHAR *)s);
return x;
}
prowizard_search (buf, size);
#ifdef _WIN32
} __except(ExceptionFilter (GetExceptionInformation (), GetExceptionCode ())) {
- write_log ("prowizard scan crashed\n");
+ write_log (L"prowizard scan crashed\n");
}
#endif
if (!got)
FILE *moduleripper_fopen (const char *name, const char *mode)
{
- char tmp[MAX_DPATH], tmp2[MAX_DPATH];
+ TCHAR tmp2[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
+ TCHAR *ufn, *umode;
+ FILE *f;
+
fetch_ripperpath (tmp, sizeof tmp);
- sprintf (tmp2, "%s%s", tmp, name);
- return fopen (tmp2, mode);
+ ufn = au (name);
+ umode = au (mode);
+ _stprintf (tmp2, L"%s%s", tmp, ufn);
+ f = _tfopen (tmp2, umode);
+ xfree (umode);
+ xfree (ufn);
+ return f;
}
FILE *moduleripper2_fopen (const char *name, const char *mode, const char *id, int addr, int size)
{
- char msg[MAX_DPATH], msg2[MAX_DPATH];
+ TCHAR msg[MAX_DPATH], msg2[MAX_DPATH];
int ret;
if (canceled)
return NULL;
got++;
translate_message (NUMSG_MODRIP_SAVE, msg);
- sprintf (msg2, msg, id, addr, size);
+ _stprintf (msg2, msg, id, addr, size);
ret = gui_message_multibutton (2, msg2);
if (ret < 0)
canceled = 1;
#include "ncr_scsi.h"
#include "zfile.h"
-#define NCRNAME "NCR53C710"
+#define NCRNAME L"NCR53C710"
#define NCR_REGS 0x40
#define ROM_VECTOR 0x0200
static uae_u8 ncrregs[NCR_REGS];
struct ncrscsi {
- char *name;
+ TCHAR *name;
int be, le;
};
static struct ncrscsi regsinfo[] =
{
- "SCNTL0", 0, 3,
- "SCNTL1", 1, 2,
- "SDID", 2, 1,
- "SIEN", 3, 0,
- "SCID", 4, 7,
- "SXFER", 5, 6,
- "SODL", 6, 5,
- "SOCL", 7, 4,
- "SFBR", 8, 11,
- "SIDL", 9, 10,
- "SBDL", 10, -1,
- "SBCL", 11, 8,
- "DSTAT", 12, 15,
- "SSTAT0", 13, 14,
- "SSTAT1", 14, 13,
- "SSTAT2", 15, 12,
- "DSA0", 16, 19,
- "DSA1", 17, 18,
- "DSA2", 18, 17,
- "DSA3", 19, 16,
- "CTEST0", 20, 23,
- "CTEST1", 21, 22,
- "CTEST2", 22, 21,
- "CTEST3", 23, 20,
- "CTEST4", 24, 27,
- "CTEST5", 25, 26,
- "CTEST6", 26, 25,
- "CTEST7", 27, 24,
- "TEMP0", 28, 31,
- "TEMP1", 29, 30,
- "TEMP2", 30, 29,
- "TEMP3", 31, 28,
- "DFIFO", 32, 35,
- "ISTAT", 33, 34,
- "CTEST8", 34, 33,
- "LCRC", 35, 32,
- "DBC0", 36, 39,
- "DBC1", 37, 38,
- "DBC2", 38, 37,
- "DCMD", 39, 36,
- "DNAD0", 40, 43,
- "DNAD1", 41, 42,
- "DNAD2", 42, 41,
- "DNAD3", 43, 40,
- "DSP0", 44, 47,
- "DSP1", 45, 46,
- "DSP2", 46, 45,
- "DSP3", 47, 44,
- "DSPS0", 48, 51,
- "DSPS1", 49, 50,
- "DSPS2", 50, 49,
- "DSPS3", 51, 48,
- "SCRATCH0", 52, 55,
- "SCRATCH1", 53, 54,
- "SCRATCH2", 54, 53,
- "SCRATCH3", 55, 52,
- "DMODE", 56, 59,
- "DIEN", 57, 58,
- "DWT", 58, 57,
- "DCNTL", 59, 56,
- "ADDER0", 60, 63,
- "ADDER1", 61, 62,
- "ADDER2", 62, 61,
- "ADDER3", 63, 60,
+ L"SCNTL0", 0, 3,
+ L"SCNTL1", 1, 2,
+ L"SDID", 2, 1,
+ L"SIEN", 3, 0,
+ L"SCID", 4, 7,
+ L"SXFER", 5, 6,
+ L"SODL", 6, 5,
+ L"SOCL", 7, 4,
+ L"SFBR", 8, 11,
+ L"SIDL", 9, 10,
+ L"SBDL", 10, -1,
+ L"SBCL", 11, 8,
+ L"DSTAT", 12, 15,
+ L"SSTAT0", 13, 14,
+ L"SSTAT1", 14, 13,
+ L"SSTAT2", 15, 12,
+ L"DSA0", 16, 19,
+ L"DSA1", 17, 18,
+ L"DSA2", 18, 17,
+ L"DSA3", 19, 16,
+ L"CTEST0", 20, 23,
+ L"CTEST1", 21, 22,
+ L"CTEST2", 22, 21,
+ L"CTEST3", 23, 20,
+ L"CTEST4", 24, 27,
+ L"CTEST5", 25, 26,
+ L"CTEST6", 26, 25,
+ L"CTEST7", 27, 24,
+ L"TEMP0", 28, 31,
+ L"TEMP1", 29, 30,
+ L"TEMP2", 30, 29,
+ L"TEMP3", 31, 28,
+ L"DFIFO", 32, 35,
+ L"ISTAT", 33, 34,
+ L"CTEST8", 34, 33,
+ L"LCRC", 35, 32,
+ L"DBC0", 36, 39,
+ L"DBC1", 37, 38,
+ L"DBC2", 38, 37,
+ L"DCMD", 39, 36,
+ L"DNAD0", 40, 43,
+ L"DNAD1", 41, 42,
+ L"DNAD2", 42, 41,
+ L"DNAD3", 43, 40,
+ L"DSP0", 44, 47,
+ L"DSP1", 45, 46,
+ L"DSP2", 46, 45,
+ L"DSP3", 47, 44,
+ L"DSPS0", 48, 51,
+ L"DSPS1", 49, 50,
+ L"DSPS2", 50, 49,
+ L"DSPS3", 51, 48,
+ L"SCRATCH0", 52, 55,
+ L"SCRATCH1", 53, 54,
+ L"SCRATCH2", 54, 53,
+ L"SCRATCH3", 55, 52,
+ L"DMODE", 56, 59,
+ L"DIEN", 57, 58,
+ L"DWT", 58, 57,
+ L"DCNTL", 59, 56,
+ L"ADDER0", 60, 63,
+ L"ADDER1", 61, 62,
+ L"ADDER2", 62, 61,
+ L"ADDER3", 63, 60,
NULL
};
-static char *regname(uaecptr addr)
+static TCHAR *regname (uaecptr addr)
{
int i;
if (regsinfo[i].le == addr)
return regsinfo[i].name;
}
- return "?";
+ return L"?";
}
#define SCNTL0_REG 0x03
if (ncrregs[SIEN_REG] == 0)
return;
INTREQ_f(0x8000 | 0x0008);
- write_log ("IRQ\n");
+ write_log (L"IRQ\n");
}
static uae_u8 read_rombyte (uaecptr addr)
{
uae_u8 v = rom[addr];
- //write_log ("%08X = %02X PC=%08X\n", addr, v, M68K_GETPC);
+ //write_log (L"%08X = %02X PC=%08X\n", addr, v, M68K_GETPC);
return v;
}
INT2();
break;
}
- write_log ("%s write %04X (%s) = %02X PC=%08X\n", NCRNAME, addr, regname(addr), v & 0xff, M68K_GETPC);
+ write_log (L"%s write %04X (%s) = %02X PC=%08X\n", NCRNAME, addr, regname(addr), v & 0xff, M68K_GETPC);
ncrregs[addr] = val;
}
v &= 0x0f; // revision 0
break;
}
- write_log ("%s read %04X (%s) = %02X PC=%08X\n", NCRNAME, addr, regname(addr), v, M68K_GETPC);
+ write_log (L"%s read %04X (%s) = %02X PC=%08X\n", NCRNAME, addr, regname(addr), v, M68K_GETPC);
if (v2 != v)
ncrregs[addr] = v2;
return v;
(ncr_bget2 (addr + 2) << 8) | (ncr_bget2 (addr + 3));
#if NCR_DEBUG > 0
if (addr < ROM_VECTOR)
- write_log ("ncr_lget %08X=%08X PC=%08X\n", addr, v, M68K_GETPC);
+ write_log (L"ncr_lget %08X=%08X PC=%08X\n", addr, v, M68K_GETPC);
#endif
return v;
}
v = (ncr_bget2 (addr) << 8) | ncr_bget2 (addr + 1);
#if NCR_DEBUG > 0
if (addr < ROM_VECTOR)
- write_log ("ncr_wget %08X=%04X PC=%08X\n", addr, v, M68K_GETPC);
+ write_log (L"ncr_wget %08X=%04X PC=%08X\n", addr, v, M68K_GETPC);
#endif
return v;
}
addr &= board_mask;
#if NCR_DEBUG > 0
if (addr < ROM_VECTOR)
- write_log ("ncr_lput %08X=%08X PC=%08X\n", addr, l, M68K_GETPC);
+ write_log (L"ncr_lput %08X=%08X PC=%08X\n", addr, l, M68K_GETPC);
#endif
ncr_bput2 (addr, l >> 24);
ncr_bput2 (addr + 1, l >> 16);
addr &= board_mask;
#if NCR_DEBUG > 0
if (addr < ROM_VECTOR)
- write_log ("ncr_wput %04X=%04X PC=%08X\n", addr, w & 65535, M68K_GETPC);
+ write_log (L"ncr_wput %04X=%04X PC=%08X\n", addr, w & 65535, M68K_GETPC);
#endif
if (addr == 0x44 && !configured) {
uae_u32 value = (p96ram_start + ((currprefs.gfxmem_size + 0xffffff) & ~0xffffff)) >> 16;
chipmem_wput (regs.regs[11] + 0x20, value);
chipmem_wput (regs.regs[11] + 0x28, value);
map_banks (&ncr_bank, value, BOARD_SIZE >> 16, 0);
- write_log ("A4091 Z3 autoconfigured at %04X0000\n", value);
+ write_log (L"A4091 Z3 autoconfigured at %04X0000\n", value);
configured = 1;
expamem_next();
return;
b &= 0xff;
addr &= board_mask;
if (addr == 0x4c && !configured) {
- write_log ("A4091 AUTOCONFIG SHUT-UP!\n");
+ write_log (L"A4091 AUTOCONFIG SHUT-UP!\n");
configured = 1;
expamem_next();
return;
static addrbank ncr_bank = {
ncr_lget, ncr_wget, ncr_bget,
ncr_lput, ncr_wput, ncr_bput,
- default_xlate, default_check, NULL, "A4091",
+ default_xlate, default_check, NULL, L"A4091",
dummy_lgeti, dummy_wgeti, ABFLAG_IO
};
struct romdata *rd = rl->rd;
z = read_rom (&rd);
if (z) {
- write_log ("A4091 BOOT ROM %d.%d\n", rd->ver, rd->rev);
+ write_log (L"A4091 BOOT ROM %d.%d\n", rd->ver, rd->rev);
rom = (uae_u8*)xmalloc (ROM_SIZE * 4);
for (i = 0; i < ROM_SIZE; i++) {
uae_u8 b;
return instrcount[*(const uae_u16 *)el1] < instrcount[*(const uae_u16 *)el2];
}
-static char *icountfilename (void)
+static TCHAR *icountfilename (void)
{
- char *name = getenv ("INSNCOUNT");
+ TCHAR *name = getenv ("INSNCOUNT");
if (name)
return name;
return COUNT_INSTRS == 2 ? "frequent.68k" : "insncount";
unsigned long int total;
int i;
- write_log ("Writing instruction count file...\n");
+ write_log (L"Writing instruction count file...\n");
for (i = 0; i < 65536; i++) {
opcodenums[i] = i;
total += instrcount[i];
}
if (tbl == 0) {
- write_log ("no CPU emulation cores available!");
+ write_log (L"no CPU emulation cores available!");
abort ();
}
opcnt++;
}
}
- write_log ("Building CPU, %d opcodes (%d %d %d)\n",
+ write_log (L"Building CPU, %d opcodes (%d %d %d)\n",
opcnt, lvl,
currprefs.cpu_cycle_exact ? -1 : currprefs.cpu_compatible ? 1 : 0, currprefs.address_space_24);
- write_log ("CPU=%d, FPU=%d, JIT%s=%d.\n",
+ write_log (L"CPU=%d, FPU=%d, JIT%s=%d.\n",
currprefs.cpu_model, currprefs.fpu_model,
- currprefs.cachesize ? (currprefs.compfpu ? "=CPU/FPU" : "=CPU") : "",
+ currprefs.cachesize ? (currprefs.compfpu ? L"=CPU/FPU" : L"=CPU") : L"",
currprefs.cachesize);
#ifdef JIT
build_comp ();
memset (instrcount, 0, sizeof instrcount);
if (f) {
uae_u32 opcode, count, total;
- char name[20];
- write_log ("Reading instruction count file...\n");
+ TCHAR name[20];
+ write_log (L"Reading instruction count file...\n");
fscanf (f, "Total: %lu\n", &total);
while (fscanf (f, "%lx: %lu %s\n", &opcode, &count, name) == 3) {
instrcount[opcode] = count;
}
}
#endif
- write_log ("Building CPU table for configuration: %d", currprefs.cpu_model);
+ write_log (L"Building CPU table for configuration: %d", currprefs.cpu_model);
regs.address_space_mask = 0xffffffff;
if (currprefs.cpu_compatible > 0) {
if (currprefs.address_space_24 && currprefs.cpu_model >= 68030)
currprefs.address_space_24 = 0;
}
if (currprefs.fpu_model > 0)
- write_log ("/%d", currprefs.fpu_model);
+ write_log (L"/%d", currprefs.fpu_model);
if (currprefs.cpu_cycle_exact) {
if (currprefs.cpu_model == 68000)
- write_log (" prefetch and cycle-exact");
+ write_log (L" prefetch and cycle-exact");
else
- write_log (" ~cycle-exact");
+ write_log (L" ~cycle-exact");
} else if (currprefs.cpu_compatible)
- write_log (" prefetch");
+ write_log (L" prefetch");
if (currprefs.address_space_24) {
regs.address_space_mask = 0x00ffffff;
- write_log (" 24-bit");
+ write_log (L" 24-bit");
}
- write_log ("\n");
+ write_log (L"\n");
read_table68k ();
do_merges ();
- write_log ("%d CPU functions\n", nr_cpuop_funcs);
+ write_log (L"%d CPU functions\n", nr_cpuop_funcs);
build_cpufunctbl ();
#define get_iword_1(o) get_word (regs.pc + (regs.pc_p - regs.pc_oldp) + (o))
#define get_ilong_1(o) get_long (regs.pc + (regs.pc_p - regs.pc_oldp) + (o))
-static uae_s32 ShowEA (void *f, uae_u16 opcode, int reg, amodes mode, wordsizes size, char *buf, uae_u32 *eaddr, int safemode)
+static uae_s32 ShowEA (void *f, uae_u16 opcode, int reg, amodes mode, wordsizes size, TCHAR *buf, uae_u32 *eaddr, int safemode)
{
uae_u16 dp;
uae_s8 disp8;
uae_u32 dispreg;
uaecptr addr = 0;
uae_s32 offset = 0;
- char buffer[80];
+ TCHAR buffer[80];
switch (mode){
case Dreg:
- sprintf (buffer, "D%d", reg);
+ _stprintf (buffer, L"D%d", reg);
break;
case Areg:
- sprintf (buffer, "A%d", reg);
+ _stprintf (buffer, L"A%d", reg);
break;
case Aind:
- sprintf (buffer, "(A%d)", reg);
+ _stprintf (buffer, L"(A%d)", reg);
addr = regs.regs[reg + 8];
break;
case Aipi:
- sprintf (buffer, "(A%d)+", reg);
+ _stprintf (buffer, L"(A%d)+", reg);
addr = regs.regs[reg + 8];
break;
case Apdi:
- sprintf (buffer, "-(A%d)", reg);
+ _stprintf (buffer, L"-(A%d)", reg);
addr = regs.regs[reg + 8];
break;
case Ad16:
{
- char offtxt[80];
+ TCHAR offtxt[80];
disp16 = get_iword_1 (m68kpc_offset); m68kpc_offset += 2;
if (disp16 < 0)
- sprintf (offtxt, "-$%04x", -disp16);
+ _stprintf (offtxt, L"-$%04x", -disp16);
else
- sprintf (offtxt, "$%04x", disp16);
+ _stprintf (offtxt, L"$%04x", disp16);
addr = m68k_areg (®s, reg) + disp16;
- sprintf (buffer, "(A%d, %s) == $%08lx", reg, offtxt, (unsigned long)addr);
+ _stprintf (buffer, L"(A%d, %s) == $%08lx", reg, offtxt, (unsigned long)addr);
}
break;
case Ad8r:
if (dp & 0x100) {
uae_s32 outer = 0, disp = 0;
uae_s32 base = m68k_areg (®s, reg);
- char name[10];
- sprintf (name, "A%d, ", reg);
+ TCHAR name[10];
+ _stprintf (name, L"A%d, ", reg);
if (dp & 0x80) { base = 0; name[0] = 0; }
if (dp & 0x40) dispreg = 0;
if ((dp & 0x30) == 0x20) { disp = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset); m68kpc_offset += 2; }
if (dp & 4) base += dispreg;
addr = base + outer;
- sprintf (buffer, "(%s%c%d.%c*%d+%ld)+%ld == $%08lx", name,
+ _stprintf (buffer, L"(%s%c%d.%c*%d+%ld)+%ld == $%08lx", name,
dp & 0x8000 ? 'A' : 'D', (int)r, dp & 0x800 ? 'L' : 'W',
1 << ((dp >> 9) & 3),
disp, outer,
(unsigned long)addr);
} else {
addr = m68k_areg (®s, reg) + (uae_s32)((uae_s8)disp8) + dispreg;
- sprintf (buffer, "(A%d, %c%d.%c*%d, $%02x) == $%08lx", reg,
+ _stprintf (buffer, L"(A%d, %c%d.%c*%d, $%02x) == $%08lx", reg,
dp & 0x8000 ? 'A' : 'D', (int)r, dp & 0x800 ? 'L' : 'W',
1 << ((dp >> 9) & 3), disp8,
(unsigned long)addr);
addr = m68k_getpc (®s) + m68kpc_offset;
disp16 = get_iword_1 (m68kpc_offset); m68kpc_offset += 2;
addr += (uae_s16)disp16;
- sprintf (buffer, "(PC,$%04x) == $%08lx", disp16 & 0xffff, (unsigned long)addr);
+ _stprintf (buffer, L"(PC,$%04x) == $%08lx", disp16 & 0xffff, (unsigned long)addr);
break;
case PC8r:
addr = m68k_getpc (®s) + m68kpc_offset;
if (dp & 0x100) {
uae_s32 outer = 0, disp = 0;
uae_s32 base = addr;
- char name[10];
- sprintf (name, "PC, ");
+ TCHAR name[10];
+ _stprintf (name, L"PC, ");
if (dp & 0x80) { base = 0; name[0] = 0; }
if (dp & 0x40) dispreg = 0;
if ((dp & 0x30) == 0x20) { disp = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset); m68kpc_offset += 2; }
if (dp & 4) base += dispreg;
addr = base + outer;
- sprintf (buffer, "(%s%c%d.%c*%d+%ld)+%ld == $%08lx", name,
+ _stprintf (buffer, L"(%s%c%d.%c*%d+%ld)+%ld == $%08lx", name,
dp & 0x8000 ? 'A' : 'D', (int)r, dp & 0x800 ? 'L' : 'W',
1 << ((dp >> 9) & 3),
disp, outer,
(unsigned long)addr);
} else {
addr += (uae_s32)((uae_s8)disp8) + dispreg;
- sprintf (buffer, "(PC, %c%d.%c*%d, $%02x) == $%08lx", dp & 0x8000 ? 'A' : 'D',
+ _stprintf (buffer, L"(PC, %c%d.%c*%d, $%02x) == $%08lx", dp & 0x8000 ? 'A' : 'D',
(int)r, dp & 0x800 ? 'L' : 'W', 1 << ((dp >> 9) & 3),
disp8, (unsigned long)addr);
}
break;
case absw:
addr = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset);
- sprintf (buffer, "$%08lx", (unsigned long)addr);
+ _stprintf (buffer, L"$%08lx", (unsigned long)addr);
m68kpc_offset += 2;
break;
case absl:
addr = get_ilong_1 (m68kpc_offset);
- sprintf (buffer, "$%08lx", (unsigned long)addr);
+ _stprintf (buffer, L"$%08lx", (unsigned long)addr);
m68kpc_offset += 4;
break;
case imm:
switch (size){
case sz_byte:
- sprintf (buffer, "#$%02x", (unsigned int)(get_iword_1 (m68kpc_offset) & 0xff));
+ _stprintf (buffer, L"#$%02x", (unsigned int)(get_iword_1 (m68kpc_offset) & 0xff));
m68kpc_offset += 2;
break;
case sz_word:
- sprintf (buffer, "#$%04x", (unsigned int)(get_iword_1 (m68kpc_offset) & 0xffff));
+ _stprintf (buffer, L"#$%04x", (unsigned int)(get_iword_1 (m68kpc_offset) & 0xffff));
m68kpc_offset += 2;
break;
case sz_long:
- sprintf (buffer, "#$%08lx", (unsigned long)(get_ilong_1 (m68kpc_offset)));
+ _stprintf (buffer, L"#$%08lx", (unsigned long)(get_ilong_1 (m68kpc_offset)));
m68kpc_offset += 4;
break;
default:
case imm0:
offset = (uae_s32)(uae_s8)get_iword_1 (m68kpc_offset);
m68kpc_offset += 2;
- sprintf (buffer, "#$%02x", (unsigned int)(offset & 0xff));
+ _stprintf (buffer, L"#$%02x", (unsigned int)(offset & 0xff));
break;
case imm1:
offset = (uae_s32)(uae_s16)get_iword_1 (m68kpc_offset);
m68kpc_offset += 2;
buffer[0] = 0;
- sprintf (buffer, "#$%04x", (unsigned int)(offset & 0xffff));
+ _stprintf (buffer, L"#$%04x", (unsigned int)(offset & 0xffff));
break;
case imm2:
offset = (uae_s32)get_ilong_1 (m68kpc_offset);
m68kpc_offset += 4;
- sprintf (buffer, "#$%08lx", (unsigned long)offset);
+ _stprintf (buffer, L"#$%08lx", (unsigned long)offset);
break;
case immi:
offset = (uae_s32)(uae_s8)(reg & 0xff);
- sprintf (buffer, "#$%08lx", (unsigned long)offset);
+ _stprintf (buffer, L"#$%08lx", (unsigned long)offset);
break;
default:
break;
}
if (buf == 0)
- f_out (f, "%s", buffer);
+ f_out (f, L"%s", buffer);
else
- strcat (buf, buffer);
+ _tcscat (buf, buffer);
if (eaddr)
*eaddr = addr;
return offset;
#ifdef DEBUGGER
if (!exception_debugging)
return;
- console_out_f ("Exception %d, PC=%08X\n", nr, m68k_getpc (®s));
+ console_out_f (L"Exception %d, PC=%08X\n", nr, M68K_GETPC);
#endif
}
put_word_ce (m68k_areg (regs, 7) + 4, last_fault_for_exception_3);
put_word_ce (m68k_areg (regs, 7) + 0, mode);
put_word_ce (m68k_areg (regs, 7) + 2, last_fault_for_exception_3 >> 16);
- write_log ("Exception %d (%x) at %x -> %x!\n", nr, oldpc, currpc, get_long (4 * nr));
+ write_log (L"Exception %d (%x) at %x -> %x!\n", nr, oldpc, currpc, get_long (4 * nr));
goto kludge_me_do;
}
m68k_areg (regs, 7) -= 6;
m68k_areg (regs, 7) -= 2;
put_word (m68k_areg (regs, 7), 0xb000 + nr * 4);
}
- write_log ("Exception %d (%x) at %x -> %x!\n", nr, oldpc, currpc, get_long (regs->vbr + 4*nr));
+ write_log (L"Exception %d (%x) at %x -> %x!\n", nr, oldpc, currpc, get_long (regs->vbr + 4*nr));
} else if (nr ==5 || nr == 6 || nr == 7 || nr == 9) {
m68k_areg (regs, 7) -= 4;
put_long (m68k_areg (regs, 7), oldpc);
put_word (m68k_areg (regs, 7) + 6, last_op_for_exception_3);
put_word (m68k_areg (regs, 7) + 8, regs->sr);
put_long (m68k_areg (regs, 7) + 10, last_addr_for_exception_3);
- write_log ("Exception %d (%x) at %x -> %x!\n", nr, oldpc, currpc, get_long (regs->vbr + 4*nr));
+ write_log (L"Exception %d (%x) at %x -> %x!\n", nr, oldpc, currpc, get_long (regs->vbr + 4*nr));
goto kludge_me_do;
}
m68k_areg (regs, 7) -= 4;
#if 0
//if (nr < 24)
if (nr == 24 + 3)
- write_log ("exception %d %08X %08X (%04X %04X)\n",
+ write_log (L"exception %d %08X %08X (%04X %04X)\n",
nr, oldpc, m68k_getpc (regs), intena, intreq);
#endif
#ifdef CPUEMU_12
int vector;
#if 0
if (nr == 2)
- write_log (".");
- //write_log ("irq %d at %x (%04X) ", nr, m68k_getpc (regs), intena & intreq);
+ write_log (L".");
+ //write_log (L"irq %d at %x (%04X) ", nr, m68k_getpc (regs), intena & intreq);
#endif
regs->stopped = 0;
unset_special (regs, SPCFLAG_STOP);
int m68k_move2c (int regno, uae_u32 *regp)
{
#if MOVEC_DEBUG > 0
- write_log ("move2c %04X <- %08X PC=%x\n", regno, *regp, M68K_GETPC);
+ write_log (L"move2c %04X <- %08X PC=%x\n", regno, *regp, M68K_GETPC);
#endif
if (movec_illg (regno)) {
op_illg (0x4E7B, ®s);
regs.pcr &= ~(0x40 | 2 | 1);
regs.pcr |= (*regp) & (0x40 | 2 | 1);
if (((opcr ^ regs.pcr) & 2) == 2) {
- write_log ("68060 FPU state: %s\n", regs.pcr & 2 ? "disabled" : "enabled");
+ write_log (L"68060 FPU state: %s\n", regs.pcr & 2 ? "disabled" : "enabled");
/* flush possible already translated FPU instructions */
flush_icache (0, 3);
}
int m68k_movec2 (int regno, uae_u32 *regp)
{
#if MOVEC_DEBUG > 0
- write_log ("movec2 %04X PC=%x\n", regno, M68K_GETPC);
+ write_log (L"movec2 %04X PC=%x\n", regno, M68K_GETPC);
#endif
if (movec_illg (regno)) {
op_illg (0x4E7A, ®s);
}
}
#if MOVEC_DEBUG > 0
- write_log ("-> %08X\n", *regp);
+ write_log (L"-> %08X\n", *regp);
#endif
return 1;
}
if ((opcode & 0xF000) == 0xF000) {
if (warned < 20) {
- write_log ("B-Trap %x at %x (%p)\n", opcode, pc, regs->pc_p);
+ write_log (L"B-Trap %x at %x (%p)\n", opcode, pc, regs->pc_p);
warned++;
}
Exception (0xB, regs, 0);
}
if ((opcode & 0xF000) == 0xA000) {
if (warned < 20) {
- write_log ("A-Trap %x at %x (%p)\n", opcode, pc, regs->pc_p);
+ write_log (L"A-Trap %x at %x (%p)\n", opcode, pc, regs->pc_p);
warned++;
}
Exception (0xA, regs, 0);
return 4;
}
if (warned < 20) {
- write_log ("Illegal instruction: %04x at %08X -> %08X\n", opcode, pc, get_long (regs->vbr + 0x10));
+ write_log (L"Illegal instruction: %04x at %08X -> %08X\n", opcode, pc, get_long (regs->vbr + 0x10));
warned++;
}
#ifdef CPUEMU_0
-static char *mmu30regs[] = { "TCR", "", "SRP", "CRP", "", "", "", "" };
+static TCHAR *mmu30regs[] = { L"TCR", L"", L"SRP", L"CRP", L"", L"", L"", L"" };
static void mmu_op30_pmove (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra)
{
int preg = (next >> 10) & 31;
int rw = (next >> 9) & 1;
int fd = (next >> 8) & 1;
- char *reg = NULL;
+ TCHAR *reg = NULL;
uae_u32 otc = tc_030;
int siz;
switch (preg)
{
case 0x10: // TC
- reg = "TC";
+ reg = L"TC";
siz = 4;
if (rw)
put_long (extra, tc_030);
tc_030 = get_long (extra);
break;
case 0x12: // SRP
- reg = "SRP";
+ reg = L"SRP";
siz = 8;
if (rw) {
put_long (extra, srp_030 >> 32);
}
break;
case 0x13: // CRP
- reg = "CRP";
+ reg = L"CRP";
siz = 8;
if (rw) {
put_long (extra, crp_030 >> 32);
}
break;
case 0x18: // MMUSR
- reg = "MMUSR";
+ reg = L"MMUSR";
siz = 2;
if (rw)
put_word (extra, mmusr_030);
mmusr_030 = get_word (extra);
break;
case 0x02: // TT0
- reg = "TT0";
+ reg = L"TT0";
siz = 4;
if (rw)
put_long (extra, tt0_030);
tt0_030 = get_long (extra);
break;
case 0x03: // TT1
- reg = "TT1";
+ reg = L"TT1";
siz = 4;
if (rw)
put_long (extra, tt1_030);
uae_u32 val2 = get_long (extra);
val = get_long (extra + 4);
if (rw)
- write_log ("PMOVE %s,%08X%08X", reg, val2, val);
+ write_log (L"PMOVE %s,%08X%08X", reg, val2, val);
else
- write_log ("PMOVE %08X%08X,%s", val2, val, reg);
+ write_log (L"PMOVE %08X%08X,%s", val2, val, reg);
} else {
if (siz == 4)
val = get_long (extra);
else
val = get_word (extra);
if (rw)
- write_log ("PMOVE %s,%08X", reg, val);
+ write_log (L"PMOVE %s,%08X", reg, val);
else
- write_log ("PMOVE %08X,%s", val, reg);
+ write_log (L"PMOVE %08X,%s", val, reg);
}
- write_log (" PC=%08X\n", pc);
+ write_log (L" PC=%08X\n", pc);
}
#endif
if (currprefs.cs_mbdmac == 1 && currprefs.mbresmem_low_size > 0) {
static void mmu_op30_ptest (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra)
{
#if MMUOP_DEBUG > 0
- char tmp[10];
+ TCHAR tmp[10];
tmp[0] = 0;
if ((next >> 8) & 1)
- sprintf (tmp, ",A%d", (next >> 4) & 15);
- write_log ("PTEST%c %02X,%08X,#%X%s PC=%08X\n",
+ _stprintf (tmp, L",A%d", (next >> 4) & 15);
+ write_log (L"PTEST%c %02X,%08X,#%X%s PC=%08X\n",
((next >> 9) & 1) ? 'W' : 'R', (next & 15), extra, (next >> 10) & 7, tmp, pc);
#endif
mmusr_030 = 0;
static void mmu_op30_pflush (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra)
{
#if MMUOP_DEBUG > 0
- write_log ("PFLUSH PC=%08X\n", pc);
+ write_log (L"PFLUSH PC=%08X\n", pc);
#endif
}
m68k_setpc (regs, m68k_getpc (regs) + 2);
} else {
#if MMUOP_DEBUG > 0
- write_log ("MMU030: %04x PC=%08x\n", opcode, m68k_getpc (regs));
+ write_log (L"MMU030: %04x PC=%08x\n", opcode, m68k_getpc (regs));
#endif
}
return;
void mmu_op (uae_u32 opcode, struct regstruct *regs, uae_u32 extra)
{
#if MMUOP_DEBUG > 1
- write_log ("mmu_op %04X PC=%08X\n", opcode, m68k_getpc (regs));
+ write_log (L"mmu_op %04X PC=%08X\n", opcode, m68k_getpc (regs));
#endif
if (currprefs.cpu_model) {
mmu_op_real (opcode, extra);
/* PFLUSH */
regs->mmusr = 0;
#if MMUOP_DEBUG > 0
- write_log ("PFLUSH\n");
+ write_log (L"PFLUSH\n");
#endif
return;
} else if ((opcode & 0x0FD8) == 0x548) {
if (currprefs.cpu_model < 68060) { /* PTEST not in 68060 */
/* PTEST */
#if MMUOP_DEBUG > 0
- write_log ("PTEST\n");
+ write_log (L"PTEST\n");
#endif
return;
}
/* PLPA */
if (currprefs.cpu_model == 68060) {
#if MMUOP_DEBUG > 0
- write_log ("PLPA\n");
+ write_log (L"PLPA\n");
#endif
return;
}
}
#if MMUOP_DEBUG > 0
- write_log ("Unknown MMU OP %04X\n", opcode);
+ write_log (L"Unknown MMU OP %04X\n", opcode);
#endif
m68k_setpc (regs, m68k_getpc (regs) - 2);
op_illg (opcode, regs);
#endif
if ((regs->spcflags & SPCFLAG_ACTION_REPLAY) && action_replay_flag != ACTION_REPLAY_INACTIVE) {
/*if (action_replay_flag == ACTION_REPLAY_ACTIVE && !is_ar_pc_in_rom ())*/
- /* write_log ("PC:%p\n", m68k_getpc ());*/
+ /* write_log (L"PC:%p\n", m68k_getpc ());*/
if (action_replay_flag == ACTION_REPLAY_ACTIVATE || action_replay_flag == ACTION_REPLAY_DORESET)
action_replay_enter ();
unset_special (regs, SPCFLAG_ACTION_REPLAY);
}
if (action_replay_flag == ACTION_REPLAY_WAIT_PC) {
- /*write_log ("Waiting for PC: %p, current PC= %p\n", wait_for_pc, m68k_getpc ());*/
+ /*write_log (L"Waiting for PC: %p, current PC= %p\n", wait_for_pc, m68k_getpc ());*/
if (m68k_getpc (regs) == wait_for_pc) {
action_replay_flag = ACTION_REPLAY_ACTIVATE; /* Activate after next instruction. */
}
static void out_cd32io2 (void)
{
uae_u32 request = cd32request;
- write_log ("%08x returned\n", request);
- //write_log ("ACTUAL=%d ERROR=%d\n", get_long (request + 32), get_byte (request + 31));
+ write_log (L"%08x returned\n", request);
+ //write_log (L"ACTUAL=%d ERROR=%d\n", get_long (request + 32), get_byte (request + 31));
cd32nextpc = 0;
cd32request = 0;
}
static void out_cd32io (uae_u32 pc)
{
- char out[100];
+ TCHAR out[100];
int ioreq = 0;
uae_u32 request = m68k_areg (®s, 1);
{
case 0xe57cc0:
case 0xf04c34:
- sprintf (out, "opendevice");
+ _stprintf (out, "opendevice");
break;
case 0xe57ce6:
case 0xf04c56:
- sprintf (out, "closedevice");
+ _stprintf (out, "closedevice");
break;
case 0xe57e44:
case 0xf04f2c:
- sprintf (out, "beginio");
+ _stprintf (out, "beginio");
ioreq = 1;
break;
case 0xe57ef2:
case 0xf0500e:
- sprintf (out, "abortio");
+ _stprintf (out, "abortio");
ioreq = -1;
break;
}
if (out[0] == 0)
return;
if (cd32request)
- write_log ("old request still not returned!\n");
+ write_log (L"old request still not returned!\n");
cd32request = request;
cd32nextpc = get_long (m68k_areg (®s, 7));
- write_log ("%s A1=%08X\n", out, request);
+ write_log (L"%s A1=%08X\n", out, request);
if (ioreq) {
static int cnt = 0;
int cmd = get_word (request + 28);
activate_debugger ();
}
#endif
- write_log ("CMD=%d DATA=%08X LEN=%d %OFF=%d PC=%x\n",
+ write_log (L"CMD=%d DATA=%08X LEN=%d %OFF=%d PC=%x\n",
cmd, get_long (request + 40),
get_long (request + 36), get_long (request + 44), M68K_GETPC);
}
#if 0
int pc = m68k_getpc ();
if (pc == 0xdff002)
- write_log ("hip\n");
+ write_log (L"hip\n");
if (pc != pcs[0] && (pc < 0xd00000 || pc > 0x1000000)) {
memmove (pcs + 1, pcs, 998 * 4);
pcs[0] = pc;
- //write_log ("%08X-%04X ", pc, opcode);
+ //write_log (L"%08X-%04X ", pc, opcode);
}
#endif
do_cycles (cpu_cycles);
int hardboot = 1;
if (in_m68k_go || !may_quit) {
- write_log ("Bug! m68k_go is not reentrant.\n");
+ write_log (L"Bug! m68k_go is not reentrant.\n");
abort ();
}
m68k_reset (hardreset);
if (hardreset) {
memory_hardreset ();
- write_log ("hardreset, memory cleared\n");
+ write_log (L"hardreset, memory cleared\n");
}
#ifdef SAVESTATE
/* We may have been restoring state, but we're done now. */
exception2_handle (regs.panic_pc, regs.panic_addr);
if (regs.panic) {
/* system is very badly confused */
- write_log ("double bus error or corrupted stack, forcing reboot..\n");
+ write_log (L"double bus error or corrupted stack, forcing reboot..\n");
regs.panic = 0;
uae_reset (1);
}
}
#endif
-static const char* ccnames[] =
-{ "T ","F ","HI","LS","CC","CS","NE","EQ",
- "VC","VS","PL","MI","GE","LT","GT","LE" };
+static const TCHAR *ccnames[] =
+{ L"T ",L"F ",L"HI",L"LS",L"CC",L"CS",L"NE",L"EQ",
+ L"VC",L"VS",L"PL",L"MI",L"GE",L"LT",L"GT",L"LE" };
-static void addmovemreg (char *out, int *prevreg, int *lastreg, int *first, int reg)
+static void addmovemreg (TCHAR *out, int *prevreg, int *lastreg, int *first, int reg)
{
- char *p = out + strlen (out);
+ TCHAR *p = out + _tcslen (out);
if (*prevreg < 0) {
*prevreg = reg;
*lastreg = reg;
return;
}
if ((*prevreg) + 1 != reg || (reg & 8) != ((*prevreg & 8))) {
- sprintf (p, "%s%c%d", (*first) ? "" : "/", (*lastreg) < 8 ? 'D' : 'A', (*lastreg) & 7);
- p = p + strlen (p);
+ _stprintf (p, L"%s%c%d", (*first) ? L"" : L"/", (*lastreg) < 8 ? 'D' : 'A', (*lastreg) & 7);
+ p = p + _tcslen (p);
if ((*lastreg) + 2 == reg) {
- sprintf (p, "/%c%d", (*prevreg) < 8 ? 'D' : 'A', (*prevreg) & 7);
+ _stprintf (p, L"/%c%d", (*prevreg) < 8 ? 'D' : 'A', (*prevreg) & 7);
} else if ((*lastreg) != (*prevreg)) {
- sprintf (p, "-%c%d", (*prevreg) < 8 ? 'D' : 'A', (*prevreg) & 7);
+ _stprintf (p, L"-%c%d", (*prevreg) < 8 ? 'D' : 'A', (*prevreg) & 7);
}
*lastreg = reg;
*first = 0;
*prevreg = reg;
}
-static void movemout (char *out, uae_u16 mask, int mode)
+static void movemout (TCHAR *out, uae_u16 mask, int mode)
{
unsigned int dmask, amask;
int prevreg = -1, lastreg = -1, first = 1;
addmovemreg (out, &prevreg, &lastreg, &first, -1);
}
-static void disasm_size (char *instrname, struct instr *dp)
+static void disasm_size (TCHAR *instrname, struct instr *dp)
{
#if 0
int i, size;
switch (dp->size)
{
case sz_byte:
- strcat (instrname, ".B ");
+ _tcscat (instrname, L".B ");
break;
case sz_word:
- strcat (instrname, ".W ");
+ _tcscat (instrname, L".W ");
break;
case sz_long:
- strcat (instrname, ".L ");
+ _tcscat (instrname, L".L ");
break;
default:
- strcat (instrname, " ");
+ _tcscat (instrname, L" ");
break;
}
}
-void m68k_disasm_2 (char *buf, int bufsize, uaecptr addr, uaecptr *nextpc, int cnt, uae_u32 *seaddr, uae_u32 *deaddr, int safemode)
+void m68k_disasm_2 (TCHAR *buf, int bufsize, uaecptr addr, uaecptr *nextpc, int cnt, uae_u32 *seaddr, uae_u32 *deaddr, int safemode)
{
uaecptr newpc = 0;
m68kpc_offset = addr - m68k_getpc (®s);
if (!table68k)
return;
while (cnt-- > 0) {
- char instrname[100], *ccpt;
+ TCHAR instrname[100], *ccpt;
int i;
uae_u32 opcode;
struct mnemolookup *lookup;
for (lookup = lookuptab;lookup->mnemo != dp->mnemo; lookup++)
;
- buf = buf_out (buf, &bufsize, "%08lX ", m68k_getpc (®s) + m68kpc_offset);
+ buf = buf_out (buf, &bufsize, L"%08lX ", m68k_getpc (®s) + m68kpc_offset);
m68kpc_offset += 2;
if (lookup->friendlyname)
- strcpy (instrname, lookup->friendlyname);
+ _tcscpy (instrname, lookup->friendlyname);
else
- strcpy (instrname, lookup->name);
- ccpt = strstr (instrname, "cc");
+ _tcscpy (instrname, lookup->name);
+ ccpt = _tcsstr (instrname, L"cc");
if (ccpt != 0) {
- strncpy (ccpt, ccnames[dp->cc], 2);
+ _tcsncpy (ccpt, ccnames[dp->cc], 2);
}
disasm_size (instrname, dp);
uae_u16 imm = get_iword_1 (m68kpc_offset);
uae_u16 creg = imm & 0x0fff;
uae_u16 r = imm >> 12;
- char regs[16], *cname = "?";
+ TCHAR regs[16], *cname = L"?";
int i;
for (i = 0; m2cregs[i].regname; i++) {
if (m2cregs[i].regno == creg)
break;
}
- sprintf (regs, "%c%d", r >= 8 ? 'A' : 'D', r >= 8 ? r - 8 : r);
+ _stprintf (regs, L"%c%d", r >= 8 ? 'A' : 'D', r >= 8 ? r - 8 : r);
if (m2cregs[i].regname)
cname = m2cregs[i].regname;
if (lookup->mnemo == i_MOVE2C) {
- strcat (instrname, regs);
- strcat (instrname, ",");
- strcat (instrname, cname);
+ _tcscat (instrname, regs);
+ _tcscat (instrname, L",");
+ _tcscat (instrname, cname);
} else {
- strcat (instrname, cname);
- strcat (instrname, ",");
- strcat (instrname, regs);
+ _tcscat (instrname, cname);
+ _tcscat (instrname, L",");
+ _tcscat (instrname, regs);
}
m68kpc_offset += 2;
} else if (lookup->mnemo == i_MVMEL) {
newpc = m68k_getpc (®s) + m68kpc_offset;
m68kpc_offset += 2;
newpc += ShowEA (0, opcode, dp->dreg, dp->dmode, dp->size, instrname, deaddr, safemode);
- strcat (instrname, ",");
+ _tcscat (instrname, L",");
movemout (instrname, get_iword_1 (m68kpc_offset - 2), dp->dmode);
} else if (lookup->mnemo == i_MVMLE) {
m68kpc_offset += 2;
movemout (instrname, get_iword_1 (m68kpc_offset - 2), dp->dmode);
- strcat (instrname, ",");
+ _tcscat (instrname, L",");
newpc = m68k_getpc (®s) + m68kpc_offset;
newpc += ShowEA (0, opcode, dp->dreg, dp->dmode, dp->size, instrname, deaddr, safemode);
} else {
newpc += ShowEA (0, opcode, dp->sreg, dp->smode, dp->size, instrname, seaddr, safemode);
}
if (dp->suse && dp->duse)
- strcat (instrname, ",");
+ _tcscat (instrname, L",");
if (dp->duse) {
newpc = m68k_getpc (®s) + m68kpc_offset;
newpc += ShowEA (0, opcode, dp->dreg, dp->dmode, dp->size, instrname, deaddr, safemode);
}
for (i = 0; i < (m68kpc_offset - oldpc) / 2; i++) {
- buf = buf_out (buf, &bufsize, "%04x ", get_iword_1 (oldpc + i * 2));
+ buf = buf_out (buf, &bufsize, L"%04x ", get_iword_1 (oldpc + i * 2));
}
while (i++ < 5)
- buf = buf_out (buf, &bufsize, " ");
+ buf = buf_out (buf, &bufsize, L" ");
buf = buf_out (buf, &bufsize, instrname);
if (deaddr)
*deaddr = newpc;
if (cctrue (®s.ccrflags, dp->cc))
- buf = buf_out (buf, &bufsize, " == $%08lX (T)", newpc);
+ buf = buf_out (buf, &bufsize, L" == $%08lX (T)", newpc);
else
- buf = buf_out (buf, &bufsize, " == $%08lX (F)", newpc);
+ buf = buf_out (buf, &bufsize, L" == $%08lX (F)", newpc);
} else if ((opcode & 0xff00) == 0x6100) { /* BSR */
if (deaddr)
*deaddr = newpc;
- buf = buf_out (buf, &bufsize, " == $%08lX", newpc);
+ buf = buf_out (buf, &bufsize, L" == $%08lX", newpc);
}
- buf = buf_out (buf, &bufsize, "\n");
+ buf = buf_out (buf, &bufsize, L"\n");
}
if (nextpc)
*nextpc = m68k_getpc (®s) + m68kpc_offset;
void m68k_disasm_ea (void *f, uaecptr addr, uaecptr *nextpc, int cnt, uae_u32 *seaddr, uae_u32 *deaddr)
{
- char *buf;
+ TCHAR *buf;
- buf = malloc ((MAX_LINEWIDTH + 1) * cnt);
+ buf = malloc ((MAX_LINEWIDTH + 1) * cnt * sizeof (TCHAR));
if (!buf)
return;
m68k_disasm_2 (buf, (MAX_LINEWIDTH + 1) * cnt, addr, nextpc, cnt, seaddr, deaddr, 1);
- f_out (f, "%s", buf);
- free (buf);
+ f_out (f, L"%s", buf);
+ xfree (buf);
}
void m68k_disasm (void *f, uaecptr addr, uaecptr *nextpc, int cnt)
{
- char *buf;
+ TCHAR *buf;
- buf = malloc ((MAX_LINEWIDTH + 1) * cnt);
+ buf = malloc ((MAX_LINEWIDTH + 1) * cnt * sizeof (TCHAR));
if (!buf)
return;
m68k_disasm_2 (buf, (MAX_LINEWIDTH + 1) * cnt, addr, nextpc, cnt, NULL, NULL, 0);
- f_out (f, "%s", buf);
- free (buf);
+ f_out (f, L"%s", buf);
+ xfree (buf);
}
/*************************************************************
Disasm the m68kcode at the given address into instrname
and instrcode
*************************************************************/
-void sm68k_disasm (char *instrname, char *instrcode, uaecptr addr, uaecptr *nextpc)
+void sm68k_disasm (TCHAR *instrname, TCHAR *instrcode, uaecptr addr, uaecptr *nextpc)
{
- char *ccpt;
+ TCHAR *ccpt;
uae_u32 opcode;
struct mnemolookup *lookup;
struct instr *dp;
m68kpc_offset += 2;
- strcpy (instrname, lookup->name);
- ccpt = strstr (instrname, "cc");
+ _tcscpy (instrname, lookup->name);
+ ccpt = _tcsstr (instrname, L"cc");
if (ccpt != 0) {
- strncpy (ccpt, ccnames[dp->cc], 2);
+ _tcsncpy (ccpt, ccnames[dp->cc], 2);
}
switch (dp->size){
- case sz_byte: strcat (instrname, ".B "); break;
- case sz_word: strcat (instrname, ".W "); break;
- case sz_long: strcat (instrname, ".L "); break;
- default: strcat (instrname, " "); break;
+ case sz_byte: _tcscat (instrname, L".B "); break;
+ case sz_word: _tcscat (instrname, L".W "); break;
+ case sz_long: _tcscat (instrname, L".L "); break;
+ default: _tcscat (instrname, L" "); break;
}
if (dp->suse) {
newpc += ShowEA (0, opcode, dp->sreg, dp->smode, dp->size, instrname, NULL, 0);
}
if (dp->suse && dp->duse)
- strcat (instrname, ",");
+ _tcscat (instrname, L",");
if (dp->duse) {
newpc = m68k_getpc (®s) + m68kpc_offset;
newpc += ShowEA (0, opcode, dp->dreg, dp->dmode, dp->size, instrname, NULL, 0);
int i;
for (i = 0; i < (m68kpc_offset - oldpc) / 2; i++)
{
- sprintf (instrcode, "%04x ", get_iword_1 (oldpc + i * 2));
- instrcode += strlen (instrcode);
+ _stprintf (instrcode, L"%04x ", get_iword_1 (oldpc + i * 2));
+ instrcode += _tcslen (instrcode);
}
}
}
struct cpum2c m2cregs[] = {
- 0, "SFC",
- 1, "DFC",
- 2, "CACR",
- 3, "TC",
- 4, "ITT0",
- 5, "ITT1",
- 6, "DTT0",
- 7, "DTT1",
- 8, "BUSC",
- 0x800, "USP",
- 0x801, "VBR",
- 0x802, "CAAR",
- 0x803, "MSP",
- 0x804, "ISP",
- 0x805, "MMUS",
- 0x806, "URP",
- 0x807, "SRP",
- 0x808, "PCR",
+ 0, L"SFC",
+ 1, L"DFC",
+ 2, L"CACR",
+ 3, L"TC",
+ 4, L"ITT0",
+ 5, L"ITT1",
+ 6, L"DTT0",
+ 7, L"DTT1",
+ 8, L"BUSC",
+ 0x800, L"USP",
+ 0x801, L"VBR",
+ 0x802, L"CAAR",
+ 0x803, L"MSP",
+ 0x804, L"ISP",
+ 0x805, L"MMUS",
+ 0x806, L"URP",
+ 0x807, L"SRP",
+ 0x808, L"PCR",
-1, NULL
};
int i, j;
for (i = 0; i < 8; i++){
- f_out (f, " D%d %08lX ", i, m68k_dreg (®s, i));
- if ((i & 3) == 3) f_out (f, "\n");
+ f_out (f, L" LD%d %08lX ", i, m68k_dreg (®s, i));
+ if ((i & 3) == 3) f_out (f, L"\n");
}
for (i = 0; i < 8; i++){
- f_out (f, " A%d %08lX ", i, m68k_areg (®s, i));
- if ((i & 3) == 3) f_out (f, "\n");
+ f_out (f, L" LA%d %08lX ", i, m68k_areg (®s, i));
+ if ((i & 3) == 3) f_out (f, L"\n");
}
if (regs.s == 0) regs.usp = m68k_areg (®s, 7);
if (regs.s && regs.m) regs.msp = m68k_areg (®s, 7);
if (regs.s && regs.m == 0) regs.isp = m68k_areg (®s, 7);
j = 2;
- f_out (f, "USP %08X ISP %08X ", regs.usp, regs.isp);
+ f_out (f, L"USP %08X ISP %08X ", regs.usp, regs.isp);
for (i = 0; m2cregs[i].regno>= 0; i++) {
if (!movec_illg (m2cregs[i].regno)) {
- if (!strcmp (m2cregs[i].regname, "USP") || !strcmp (m2cregs[i].regname, "ISP"))
+ if (!_tcscmp (m2cregs[i].regname, L"USP") || !_tcscmp (m2cregs[i].regname, L"ISP"))
continue;
if (j > 0 && (j % 4) == 0)
- f_out (f, "\n");
- f_out (f, "%-4s %08X ", m2cregs[i].regname, val_move2c (m2cregs[i].regno));
+ f_out (f, L"\n");
+ f_out (f, L"%-4s %08X ", m2cregs[i].regname, val_move2c (m2cregs[i].regno));
j++;
}
}
if (j > 0)
- f_out (f, "\n");
- f_out (f, "T=%d%d S=%d M=%d X=%d N=%d Z=%d V=%d C=%d IMASK=%d STP=%d\n",
+ f_out (f, L"\n");
+ f_out (f, L"T=%d%d S=%d M=%d X=%d N=%d Z=%d V=%d C=%d IMASK=%d STP=%d\n",
regs.t1, regs.t0, regs.s, regs.m,
GET_XFLG (®s.ccrflags), GET_NFLG (®s.ccrflags), GET_ZFLG (®s.ccrflags),
GET_VFLG (®s.ccrflags), GET_CFLG (®s.ccrflags),
if (currprefs.fpu_model) {
uae_u32 fpsr;
for (i = 0; i < 8; i++){
- f_out (f, "FP%d: %g ", i, regs.fp[i]);
- if ((i & 3) == 3) f_out (f, "\n");
+ f_out (f, L"FP%d: %g ", i, regs.fp[i]);
+ if ((i & 3) == 3)
+ f_out (f, L"\n");
}
fpsr = get_fpsr ();
- f_out (f, "N=%d Z=%d I=%d NAN=%d\n",
+ f_out (f, L"N=%d Z=%d I=%d NAN=%d\n",
(fpsr & 0x8000000) != 0,
(fpsr & 0x4000000) != 0,
(fpsr & 0x2000000) != 0,
for (lookup1 = lookuptab; lookup1->mnemo != dp->mnemo; lookup1++);
dp = table68k + regs.ir;
for (lookup2 = lookuptab; lookup2->mnemo != dp->mnemo; lookup2++);
- f_out (f, "Prefetch %04x (%s) %04x (%s)\n", regs.irc, lookup1->name, regs.ir, lookup2->name);
+ f_out (f, L"Prefetch %04x (%s) %04x (%s)\n", regs.irc, lookup1->name, regs.ir, lookup2->name);
}
m68k_disasm (f, m68k_getpc (®s), nextpc, 1);
if (nextpc)
- f_out (f, "Next PC: %08lx\n", *nextpc);
+ f_out (f, L"Next PC: %08lx\n", *nextpc);
}
#ifdef SAVESTATE
if (khz > 0 && khz < 800000)
currprefs.m68k_speed = changed_prefs.m68k_speed = 0;
}
- write_log ("CPU %d%s%03d, PC=%08X\n",
+ write_log (L"CPU %d%s%03d, PC=%08X\n",
model / 1000, flags & 1 ? "EC" : "", model % 1000, regs.pc);
return src;
void exception2 (uaecptr addr, uaecptr fault)
{
- write_log ("delayed exception2!\n");
+ write_log (L"delayed exception2!\n");
regs.panic_pc = m68k_getpc (®s);
regs.panic_addr = addr;
regs.panic = 2;
customreset (0);
return;
}
- write_log ("M68K RESET PC=%x, rebooting..\n", pc);
+ write_log (L"M68K RESET PC=%x, rebooting..\n", pc);
customreset (0);
m68k_setpc (®s, ksboot);
return;
if ((ins & ~7) == 0x4ed0) {
int reg = ins & 7;
uae_u32 addr = m68k_areg (®s, reg);
- write_log ("reset/jmp (ax) combination emulated -> %x\n", addr);
+ write_log (L"reset/jmp (ax) combination emulated -> %x\n", addr);
customreset (0);
if (addr < 0x80000)
addr += 0xf80000;
m68k_setpc (®s, addr - 2);
return;
}
- write_log ("M68K RESET PC=%x, rebooting..\n", pc);
+ write_log (L"M68K RESET PC=%x, rebooting..\n", pc);
customreset (0);
m68k_setpc (®s, ksboot);
}
int getDivu68kCycles (uae_u32 dividend, uae_u16 divisor)
{
int v = getDivu68kCycles_2 (dividend, divisor) - 4;
-// write_log ("U%d ", v);
+// write_log (L"U%d ", v);
return v;
}
int getDivs68kCycles (uae_s32 dividend, uae_s16 divisor)
{
int v = getDivs68kCycles_2 (dividend, divisor) - 4;
-// write_log ("S%d ", v);
+// write_log (L"S%d ", v);
return v;
}
static long samples, playchannel, intcount;
static int record_enabled;
int ahi_on;
-static char *sndptrmax, soundneutral, sndptr;
+static TCHAR *sndptrmax, soundneutral, sndptr;
static LPSTR lpData,sndptrout;
extern uae_u32 chipmem_mask;
unsigned int *sndbufrecpt;
-static char *ahisndbuffer, *sndrecbuffer;
+static TCHAR *ahisndbuffer, *sndrecbuffer;
static int ahisndbufsize, *ahisndbufpt, ahitweak;;
int ahi_pollrate = 40;
if (lpDSB2) {
hr = IDirectSoundBuffer_Stop (lpDSB2);
if(FAILED (hr))
- write_log ("AHI: SoundStop() failure: %s\n", DXError (hr));
+ write_log (L"AHI: SoundStop() failure: %s\n", DXError (hr));
} else {
- write_log ("AHI: Sound Stopped...\n");
+ write_log (L"AHI: Sound Stopped...\n");
}
if (lpDSB2)
hr = IDirectSoundBuffer_Lock (lpDSB2, oldpos, amigablksize * 4, &dwData1, &dwBytes1, &dwData2, &dwBytes2, 0);
if(hr == DSERR_BUFFERLOST) {
- write_log ("AHI: lostbuf %d %x\n", pos, amigablksize);
+ write_log (L"AHI: lostbuf %d %x\n", pos, amigablksize);
IDirectSoundBuffer_Restore (lpDSB2);
hr = IDirectSoundBuffer_Lock (lpDSB2, oldpos, amigablksize * 4, &dwData1, &dwBytes1, &dwData2, &dwBytes2, 0);
}
// Record begin
hr = DirectSoundCaptureCreate (NULL, &lpDS2r, NULL);
if (FAILED (hr)) {
- write_log ( "AHI: DirectSoundCaptureCreate() failure: %s\n", DXError (hr));
+ write_log (L"AHI: DirectSoundCaptureCreate() failure: %s\n", DXError (hr));
record_enabled = -1;
return 0;
}
hr = IDirectSoundCapture_CreateCaptureBuffer (lpDS2r, &sound_buffer_rec, &lpDSB2r, NULL);
if (FAILED (hr)) {
- write_log ("AHI: CreateCaptureSoundBuffer() failure: %s\n", DXError(hr));
+ write_log (L"AHI: CreateCaptureSoundBuffer() failure: %s\n", DXError(hr));
record_enabled = -1;
return 0;
}
hr = IDirectSoundCaptureBuffer_Start (lpDSB2r, DSCBSTART_LOOPING);
if (FAILED (hr)) {
- write_log ("AHI: DirectSoundCaptureBuffer_Start failed: %s\n", DXError (hr));
+ write_log (L"AHI: DirectSoundCaptureBuffer_Start failed: %s\n", DXError (hr));
record_enabled = -1;
return 0;
}
record_enabled = 1;
- write_log ("AHI: Init AHI Audio Recording \n");
+ write_log (L"AHI: Init AHI Audio Recording \n");
return 1;
}
return;
hr = IDirectSoundBuffer_SetVolume (lpDSB2, vol);
if (FAILED (hr))
- write_log ("AHI: SetVolume(%d) failed: %s\n", vol, DXError (hr));
+ write_log (L"AHI: SetVolume(%d) failed: %s\n", vol, DXError (hr));
}
static int ahi_init_sound_win32 (void)
wavfmt.nAvgBytesPerSec = wavfmt.nBlockAlign * sound_freq_ahi;
wavfmt.cbSize = 0;
- write_log ("AHI: Init AHI Sound Rate %d, Channels %d, Bits %d, Buffsize %d\n",
+ write_log (L"AHI: Init AHI Sound Rate %d, Channels %d, Bits %d, Buffsize %d\n",
sound_freq_ahi, sound_channels_ahi, sound_bits_ahi, amigablksize);
if (!amigablksize)
else
hr = DirectSoundCreate (&sound_devices[currprefs.win32_soundcard].guid, &lpDS2, NULL);
if (FAILED (hr)) {
- write_log ("AHI: DirectSoundCreate() failure: %s\n", DXError (hr));
+ write_log (L"AHI: DirectSoundCreate() failure: %s\n", DXError (hr));
return 0;
}
memset (&sound_buffer, 0, sizeof (DSBUFFERDESC));
hr = IDirectSound_GetCaps (lpDS2, &DSCaps);
if (SUCCEEDED (hr)) {
if (DSCaps.dwFlags & DSCAPS_EMULDRIVER)
- write_log ( "AHI: Your DirectSound Driver is emulated via WaveOut - yuck!\n");
+ write_log (L"AHI: Your DirectSound Driver is emulated via WaveOut - yuck!\n");
}
if (FAILED (IDirectSound_SetCooperativeLevel (lpDS2, hMainWnd, DSSCL_PRIORITY)))
return 0;
hr = IDirectSound_CreateSoundBuffer (lpDS2, &sound_buffer, &lpDSBprimary2, NULL);
if (FAILED (hr)) {
- write_log ("AHI: CreateSoundBuffer() failure: %s\n", DXError(hr));
+ write_log (L"AHI: CreateSoundBuffer() failure: %s\n", DXError(hr));
return 0;
}
hr = IDirectSoundBuffer_SetFormat (lpDSBprimary2, &wavfmt);
if (FAILED (hr)) {
- write_log ("AHI: SetFormat() failure: %s\n", DXError (hr));
+ write_log (L"AHI: SetFormat() failure: %s\n", DXError (hr));
return 0;
}
sound_buffer.dwBufferBytes = ahisndbufsize;
sound_buffer.guid3DAlgorithm = GUID_NULL;
hr = IDirectSound_CreateSoundBuffer (lpDS2, &sound_buffer, &lpDSB2, NULL);
if (FAILED (hr)) {
- write_log ("AHI: CreateSoundBuffer() failure: %s\n", DXError (hr));
+ write_log (L"AHI: CreateSoundBuffer() failure: %s\n", DXError (hr));
return 0;
}
hr = IDirectSoundBuffer_GetFormat (lpDSBprimary2,&wavfmt,500,0);
if (FAILED (hr)) {
- write_log ("AHI: GetFormat() failure: %s\n", DXError (hr));
+ write_log (L"AHI: GetFormat() failure: %s\n", DXError (hr));
return 0;
}
{
uae_u32 src, num_vars;
static int cap_pos, clipsize;
- static char *clipdat;
+ static TCHAR *clipdat;
case 0:
cap_pos = 0;
if (OpenClipboard (0)) {
clipdat = GetClipboardData (CF_TEXT);
if (clipdat) {
- clipsize = strlen (clipdat);
+ clipsize = _tcslen (clipdat);
clipsize++;
return clipsize;
}
case 12:
{
#if 1
- uae_u8 *addr = get_real_address (m68k_areg (®s, 0));
+ TCHAR *s = au (get_real_address (m68k_areg (®s, 0)));
static LPTSTR p;
int slen;
- LPTSTR p2;
if (OpenClipboard (0)) {
EmptyClipboard();
- slen = strlen(addr);
+ slen = _tcslen (s);
if (p)
GlobalFree (p);
- p = GlobalAlloc (GMEM_MOVEABLE,slen+2);
+ p = GlobalAlloc (GMEM_MOVEABLE, (slen + 1) * sizeof (TCHAR));
if (p) {
- p2 = GlobalLock (p);
+ TCHAR *p2 = GlobalLock (p);
if (p2) {
- memcpy (p2, addr, slen);
- p2[slen] = 0;
+ _tcscpy (p2, s);
GlobalUnlock (p);
- SetClipboardData (CF_TEXT,p2);
+ SetClipboardData (CF_TEXT, p);
}
}
CloseClipboard ();
}
+ xfree (s);
#endif
}
return 0;
case 100: // open dll
{
- char *dlldir = TEXT ("winuae_dll");
- char *dllname;
+ TCHAR *dlldir = TEXT ("winuae_dll");
+ TCHAR *dllname;
uaecptr dllptr;
HMODULE h = NULL;
- char dpath[MAX_DPATH];
- char newdllpath[MAX_DPATH];
+ TCHAR dpath[MAX_DPATH];
+ TCHAR newdllpath[MAX_DPATH];
int ok = 0;
- char *filepart;
+ TCHAR *filepart;
dllptr = m68k_areg (&context->regs, 0);
- dllname = (char *)get_real_address (dllptr);
+ dllname = (TCHAR *)get_real_address (dllptr);
dpath[0] = 0;
- GetFullPathName (dllname, sizeof dpath, dpath, &filepart);
- if (strlen (dpath) > strlen (start_path_data) && !strnicmp (dpath, start_path_data, strlen (start_path_data))) {
+ GetFullPathName (dllname, sizeof dpath / sizeof (TCHAR), dpath, &filepart);
+ if (_tcslen (dpath) > _tcslen (start_path_data) && !_tcsncmp (dpath, start_path_data, _tcslen (start_path_data))) {
/* path really is relative to winuae directory */
ok = 1;
- strcpy (newdllpath, dpath + strlen (start_path_data));
- if (!strnicmp (newdllpath, dlldir, strlen (dlldir))) /* remove "winuae_dll" */
- strcpy (newdllpath, dpath + strlen (start_path_data) + 1 + strlen (dlldir));
- sprintf (dpath, "%s%s%s", start_path_data, WIN32_PLUGINDIR, newdllpath);
+ _tcscpy (newdllpath, dpath + _tcslen (start_path_data));
+ if (!_tcsncmp (newdllpath, dlldir, _tcslen (dlldir))) /* remove "winuae_dll" */
+ _tcscpy (newdllpath, dpath + _tcslen (start_path_data) + 1 + _tcslen (dlldir));
+ _stprintf (dpath, L"%s%s%s", start_path_data, WIN32_PLUGINDIR, newdllpath);
h = LoadLibrary (dpath);
if (h == NULL)
- write_log ("native open: '%s' = %d\n", dpath, GetLastError ());
+ write_log (L"native open: '%s' = %d\n", dpath, GetLastError ());
if (h == NULL) {
- sprintf (dpath, "%s%s\\%s", start_path_data, dlldir, newdllpath);
+ _stprintf (dpath, L"%s%s\\%s", start_path_data, dlldir, newdllpath);
h = LoadLibrary (dllname);
if (h == NULL)
- write_log ("fallback native open: '%s' = %d\n", dpath, GetLastError ());
+ write_log (L"fallback native open: '%s' = %d\n", dpath, GetLastError ());
}
} else {
- write_log ("native open outside of installation dir '%s'!\n", dpath);
+ write_log (L"native open outside of installation dir '%s'!\n", dpath);
}
#if 0
if (h == NULL) {
h = LoadLibrary (filepart);
- write_log ("native file open: '%s' = %p\n", filepart, h);
+ write_log (L"native file open: '%s' = %p\n", filepart, h);
if (h == NULL) {
- sprintf (dpath, "%s%s%s", start_path_data, WIN32_PLUGINDIR, filepart);
+ _stprintf (dpath, "%s%s%s", start_path_data, WIN32_PLUGINDIR, filepart);
h = LoadLibrary (dpath);
- write_log ("native path open: '%s' = %p\n", dpath, h);
+ write_log (L"native path open: '%s' = %p\n", dpath, h);
}
}
#endif
case 101: //get dll label
{
HMODULE m;
+ uaecptr funcaddr;
char *funcname;
m = (HMODULE) m68k_dreg (&context->regs, 1);
- funcname = (char *)m68k_areg (&context->regs, 0);
- funcname = (char *)get_real_address ((uae_u32)funcname);
+ funcaddr = m68k_areg (&context->regs, 0);
+ funcname = get_real_address (funcaddr);
return (uae_u32) GetProcAddress (m, funcname);
}
extern void ahi_updatesound(int force);
-extern uae_u32 REGPARAM2 ahi_demux(TrapContext*);
+extern uae_u32 REGPARAM2 ahi_demux (TrapContext*);
extern int ahi_open_sound (void);
extern void ahi_close_sound (void);
-extern void ahi_finish_sound_buffer( void );
+extern void ahi_finish_sound_buffer (void);
extern int ahi_on;
extern int ahi_pollrate;
\ No newline at end of file
t = (evt)(cycles / f);
if (dsahip->evttime == t)
return;
- write_log ("AHI: playerfunc freq = %.2fHz\n", f);
+ write_log (L"AHI: playerfunc freq = %.2fHz\n", f);
dsahip->evttime = t;
if (t < 10)
return;
{
alGetError ();
}
-static int alError (const char *format,...)
+static int alError (const TCHAR *format,...)
{
- char buffer[1000];
+ TCHAR buffer[1000];
va_list parms;
int err;
if (err == AL_NO_ERROR)
return 0;
va_start (parms, format);
- _vsnprintf (buffer, sizeof buffer -1, format, parms);
- sprintf (buffer + strlen (buffer), ": ERR=%x\n", err);
- write_log ("%s", buffer);
+ _vsntprintf (buffer, sizeof buffer -1, format, parms);
+ _stprintf (buffer + _tcslen (buffer), L": ERR=%x\n", err);
+ write_log (L"%s", buffer);
return err;
}
alcCloseDevice (dsahip->al_dev);
dsahip->al_dev = 0;
if (ahi_debug && ahi_active)
- write_log ("AHI: OpenAL freed\n");
+ write_log (L"AHI: OpenAL freed\n");
ahi_active = 0;
}
int freq = get_long (dsahip->audioctrl + ahiac_MixFreq);
struct sound_device *sd;
int device;
+ char *s;
if (!freq)
return 0;
dsahip->record_ch = 2;
dsahip->record_bytespersample = 2;
alClear ();
- dsahip->al_recorddev = alcCaptureOpenDevice (sd->alname, freq, AL_FORMAT_STEREO16, dsahip->record_samples);
+ s = ua (sd->alname);
+ dsahip->al_recorddev = alcCaptureOpenDevice (s, freq, AL_FORMAT_STEREO16, dsahip->record_samples);
+ xfree (s);
if (dsahip->al_recorddev == NULL)
goto error;
return 1;
error:
if (ahi_debug)
- write_log ("AHI: OPENAL recording initialization failed\n");
+ write_log (L"AHI: OPENAL recording initialization failed\n");
return 0;
}
int v;
struct sound_device *sd;
int device;
+ char *s;
device = dsahip->output;
sd = sound_devices;
if (sd->name == NULL)
return 0;
}
- dsahip->al_dev = alcOpenDevice (sd->alname);
+ s = ua (sd->alname);
+ dsahip->al_dev = alcOpenDevice (s);
+ xfree (s);
if (!dsahip->al_dev)
goto error;
dsahip->al_ctx = alcCreateContext (dsahip->al_dev, NULL);
dsahip->bytespersampleout = dsahip->bitspersampleout / 8;
dsahip->channellength = 65536 * dsahip->chout * dsahip->bytespersampleout;
if (ahi_debug)
- write_log("AHI: CH=%d BLEN=%d\n",
+ write_log (L"AHI: CH=%d BLEN=%d\n",
dsahip->chout, dsahip->channellength);
dsahip->tmpbuffer_size = 1000000;
dsahip->tmpbuffer = xmalloc (dsahip->tmpbuffer_size);
if (ahi_debug)
- write_log ("AHI: OpenAL initialized: %s\n", sound_devices[dsahip->output].name);
+ write_log (L"AHI: OpenAL initialized: %s\n", sound_devices[dsahip->output].name);
return 1;
error:
if (ahi_debug)
- write_log ("AHI: OpenAL initialization failed\n");
+ write_log (L"AHI: OpenAL initialization failed\n");
ds_free (dsahip);
return 0;
}
float vol = ((float)(abs (dc->csnext.volume))) / 65536.0;
alClear ();
alSourcef (dc->al_source, AL_GAIN, vol);
- alError ("AHI: SetVolume(%d,%d)", dc->num, vol);
+ alError (L"AHI: SetVolume(%d,%d)", dc->num, vol);
}
if (abs (dc->cs.panning) != abs (dc->csnext.panning)) {
;// pan = (abs (dc->csnext.panning) - 0x8000) * DSBPAN_RIGHT / 32768;
if (dc->dsplaying && dc->cs.frequency != dc->csnext.frequency && dc->csnext.frequency > 0 && dc->al_source != -1) {
//alClear ();
//alSourcei (dc->al_source, AL_FREQUENCY, dc->csnext.frequency);
- //alError ("AHI: SetFrequency(%d,%d)", dc->num, dc->csnext.frequency);
+ //alError (L"AHI: SetFrequency(%d,%d)", dc->num, dc->csnext.frequency);
}
dc->cs.frequency = dc->csnext.frequency;
}
return 1;
alClear ();
alGenSources (1, &dc->al_source);
- if (alError ("alGenSources()"))
+ if (alError (L"alGenSources()"))
goto error;
dc->cs.frequency = -1;
dc->cs.volume = -1;
ds_setvolume (dsahip, dc);
ds_setfreq (dsahip, dc);
if (ahi_debug)
- write_log ("AHI: allocated OpenAL source for channel %d. vol=%d pan=%d freq=%d\n",
+ write_log (L"AHI: allocated OpenAL source for channel %d. vol=%d pan=%d freq=%d\n",
dc->num, dc->cs.volume, dc->cs.panning, dc->cs.frequency);
return 1;
error:
{
alClear ();
alSourcei (dc->al_source, AL_LOOPING, state ? AL_TRUE : AL_FALSE);
- alError ("AHI: ds_play() alSourcei(AL_LOOPING)");
+ alError (L"AHI: ds_play() alSourcei(AL_LOOPING)");
}
static void al_startplay (struct dschannel *dc)
{
alClear ();
alSourcePlay (dc->al_source);
- alError ("AHI: ds_play() alSourcePlay");
+ alError (L"AHI: ds_play() alSourcePlay");
}
static void preparesample_single (struct DSAHI *dsahip, struct dschannel *dc)
dlen = copysampledata (dsahip, dc, ds, &p, pe, ps, dsahip->tmpbuffer, slen);
alClear ();
alBufferData (ds->al_buffer[dc->buffertoggle], dsahip->al_bufferformat, dsahip->tmpbuffer, dlen, dc->cs.frequency);
- alError ("AHI: preparesample_single:alBufferData(len=%d,freq=%d)", dlen, dc->cs.frequency);
+ alError (L"AHI: preparesample_single:alBufferData(len=%d,freq=%d)", dlen, dc->cs.frequency);
alClear ();
alSourceQueueBuffers (dc->al_source, 1, &ds->al_buffer[dc->buffertoggle]);
- alError ("AHI: al_initsample_single:alSourceQueueBuffers(freq=%d)", dc->cs.frequency);
+ alError (L"AHI: al_initsample_single:alSourceQueueBuffers(freq=%d)", dc->cs.frequency);
if (ahi_debug > 2)
- write_log ("AHI: sample queued %d: %d/%d\n",
+ write_log (L"AHI: sample queued %d: %d/%d\n",
dc->num, dc->samplecounter, dc->totalsamples);
}
dlen = copysampledata (dsahip, dc, ds, &p, pe, ps, dsahip->tmpbuffer, slen);
alClear ();
alBufferData (ds->al_buffer[dc->buffertoggle], dsahip->al_bufferformat, dsahip->tmpbuffer, dlen, dc->cs.frequency);
- alError ("AHI: preparesample:alBufferData(len=%d,freq=%d)", dlen, dc->cs.frequency);
+ alError (L"AHI: preparesample:alBufferData(len=%d,freq=%d)", dlen, dc->cs.frequency);
alClear ();
alSourceQueueBuffers (dc->al_source, 1, &ds->al_buffer[dc->buffertoggle]);
- alError ("AHI: al_initsample:alSourceQueueBuffers(freq=%d)", dc->cs.frequency);
+ alError (L"AHI: al_initsample:alSourceQueueBuffers(freq=%d)", dc->cs.frequency);
if (ahi_debug > 2)
- write_log ("AHI: sample queued %d: %d/%d\n",
+ write_log (L"AHI: sample queued %d: %d/%d\n",
dc->num, dc->samplecounter, dc->totalsamples);
dc->samplecounter++;
dc->buffertoggle ^= 1;
alSourceStop (dc->al_source);
alClear ();
alSourcei (dc->al_source, AL_BUFFER, AL_NONE);
- alError ("AHI: al_initsample:AL_BUFFER=AL_NONE");
+ alError (L"AHI: al_initsample:AL_BUFFER=AL_NONE");
memcpy (&dc->cs, &dc->csnext, sizeof (struct chsample));
dc->csnext.ds = NULL;
if (dc->dsplaying) {
alClear ();
alGetSourcei (dc->al_source, AL_SOURCE_STATE, &v);
- alError ("AHI: queuesample AL_SOURCE_STATE");
+ alError (L"AHI: queuesample AL_SOURCE_STATE");
if (v != AL_PLAYING) {
alClear ();
alSourceRewind (dc->al_source);
- alError ("AHI: queuesample:restart");
+ alError (L"AHI: queuesample:restart");
restart = 1;
if (ahi_debug > 2)
- write_log ("AHI: queuesample, play restart\n");
+ write_log (L"AHI: queuesample, play restart\n");
preparesample_multi (dsahip, dc);
}
}
if (restart)
al_startplay (dc);
if (ahi_debug > 2)
- write_log ("AHI: sample %d queued to channel %d\n", dc->cs.ds->num, dc->num);
+ write_log (L"AHI: sample %d queued to channel %d\n", dc->cs.ds->num, dc->num);
}
static int unqueuebuffers (struct dschannel *dc)
ALuint tmp;
alClear ();
alGetSourcei (dc->al_source, AL_BUFFERS_PROCESSED, &v);
- if (alError ("AHI: hsync AL_BUFFERS_PROCESSED %d", dc->num))
+ if (alError (L"AHI: hsync AL_BUFFERS_PROCESSED %d", dc->num))
return cnt;
if (v == 0)
return cnt;
v = 0;
alClear ();
alGetSourcei (dc->al_source, AL_SOURCE_STATE, &v);
- alError ("AHI: hsync AL_SOURCE_STATE");
+ alError (L"AHI: hsync AL_SOURCE_STATE");
if (v != AL_PLAYING) {
if (dc->cs.ds) {
setchannelevent (dsahip, dc);
if (ahi_debug)
- write_log ("AHI: ********* channel %d stopped state=%d!\n", dc->num, v);
+ write_log (L"AHI: ********* channel %d stopped state=%d!\n", dc->num, v);
removed = 1;
dc->dsplaying = 2;
dc->waitforack = 0;
if (!dc->waitforack && dc->samplecounter >= 0 && removed) {
int evt = 0;
if (ahi_debug > 2)
- write_log ("sample end channel %d: %d/%d\n", dc->num, dc->samplecounter, dc->totalsamples);
+ write_log (L"sample end channel %d: %d/%d\n", dc->num, dc->samplecounter, dc->totalsamples);
if (dc->samplecounter >= dc->totalsamples) {
evt = 1;
if (ahi_debug > 2)
- write_log ("sample finished channel %d: %d\n", dc->num, dc->totalsamples);
+ write_log (L"sample finished channel %d: %d\n", dc->num, dc->totalsamples);
dc->samplecounter = 0;
if (dc->csnext.ds) {
memcpy (&dc->cs, &dc->csnext, sizeof (struct chsample));
alcCaptureStop (dsahip->al_recorddev);
dsahip->dsrecording = 0;
}
- alError ("AHI: alcCapture%s failed", start ? "Start" : "Stop");
+ alError (L"AHI: alcCapture%s failed", start ? "Start" : "Stop");
}
static void ds_stop (struct DSAHI *dsahip, struct dschannel *dc)
if (dc->al_source == -1)
return;
if (ahi_debug)
- write_log ("AHI: ds_stop(%d)\n", dc->num);
+ write_log (L"AHI: ds_stop(%d)\n", dc->num);
alClear ();
alSourceStop (dc->al_source);
- alError ("AHI: alSourceStop");
+ alError (L"AHI: alSourceStop");
unqueuebuffers (dc);
}
if (dc->al_source == -1)
return;
if (ahi_debug)
- write_log ("AHI: ds_play(%d)\n", dc->num);
+ write_log (L"AHI: ds_play(%d)\n", dc->num);
al_startplay (dc);
}
int i, j;
enumerate_sound_devices ();
- xahi_author = ds ("Toni Wilen");
- xahi_copyright = ds ("GPL");
- xahi_version = ds ("uae2 0.2 (xx.xx.2008)\r\n");
+ xahi_author = ds (L"Toni Wilen");
+ xahi_copyright = ds (L"GPL");
+ xahi_version = ds (L"uae2 0.2 (xx.xx.2008)\r\n");
j = 0;
for (i = 0; sound_devices[i].name; i++) {
if (sound_devices[i].type == SOUND_DEVICE_AL)
struct DSAHI *dsahip = &dsahi[0];
if (ahi_debug)
- write_log ("AHI: AllocAudio(%08x,%08x)\n", tags, audioctrl);
+ write_log (L"AHI: AllocAudio(%08x,%08x)\n", tags, audioctrl);
ver = get_long (pbase + pub_Version);
size = get_long (pbase + pub_SizeOf);
if (ver != AHI_STRUCT_VERSION) {
- gui_message ("AHI: Incompatible DEVS:AHI/uae2.audio\nVersion mismatch %d<>%d.", ver, AHI_STRUCT_VERSION);
+ gui_message (L"AHI: Incompatible DEVS:AHI/uae2.audio\nVersion mismatch %d<>%d.", ver, AHI_STRUCT_VERSION);
return AHISF_ERROR;
}
if (size < pub_End) {
- gui_message ("AHI: Incompatible DEVS:AHI/uae2.audio.\nInternal structure size %d<>%d.", size, pub_End);
+ gui_message (L"AHI: Incompatible DEVS:AHI/uae2.audio.\nInternal structure size %d<>%d.", size, pub_End);
return AHISF_ERROR;
}
v = get_long (pbase + pub_Index);
if (v != -1) {
- write_log ("AHI: corrupted memory\n");
+ write_log (L"AHI: corrupted memory\n");
return AHISF_ERROR;
}
put_long (pbase + pub_Index, dsahip - dsahi);
dsahip->audioid = 0x003b0001;
while ((tag = gettag (&tags, &data))) {
if (ahi_debug)
- write_log ("- TAG %08x=%d: %08x=%u\n", tag, tag & 0x7fff, data, data);
+ write_log (L"- TAG %08x=%d: %08x=%u\n", tag, tag & 0x7fff, data, data);
switch (tag)
{
case AHIA_AudioID:
uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
struct DSAHI *dsahip = GETAHI;
if (ahi_debug > 1)
- write_log ("AHI: Disable(%08x)\n", audioctrl);
+ write_log (L"AHI: Disable(%08x)\n", audioctrl);
dsahip->enabledisable++;
}
uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
struct DSAHI *dsahip = GETAHI;
if (ahi_debug > 1)
- write_log ("AHI: Enable(%08x)\n", audioctrl);
+ write_log (L"AHI: Enable(%08x)\n", audioctrl);
dsahip->enabledisable--;
if (dsahip->enabledisable == 0 && dsahip->playing)
setevent (dsahip);
uae_u32 pbase = get_long (audioctrl + ahiac_DriverData);
struct DSAHI *dsahip = GETAHI;
if (ahi_debug)
- write_log ("AHI: FreeAudio(%08x)\n", audioctrl);
+ write_log (L"AHI: FreeAudio(%08x)\n", audioctrl);
if (ahi_active == 0)
return;
ahi_active = 0;
v = getattr2 (dsahip, attribute, argument, def);
if (ahi_debug)
- write_log ("AHI: GetAttr(%08x=%d,%08x,%08x)=%08x\n", attribute, attribute & 0x7fff, argument, def, v);
+ write_log (L"AHI: GetAttr(%08x=%d,%08x,%08x)=%08x\n", attribute, attribute & 0x7fff, argument, def, v);
return v;
}
uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
struct DSAHI *dsahip = GETAHI;
if (ahi_debug)
- write_log ("AHI: HardwareControl(%08x=%d,%08x,%08x)\n", attribute, attribute & 0x7fff, argument, audioctrl);
+ write_log (L"AHI: HardwareControl(%08x=%d,%08x,%08x)\n", attribute, attribute & 0x7fff, argument, audioctrl);
switch (attribute)
{
case AHIC_Input:
int i;
if (ahi_debug)
- write_log ("AHI: Play(%08x,%08x)\n",
+ write_log (L"AHI: Play(%08x,%08x)\n",
flags, audioctrl);
if ((flags & AHISF_PLAY) && !dsahip->playing) {
dsahip->playing = 1;
int i;
if (ahi_debug)
- write_log ("AHI: Stop(%08x,%08x)\n",
+ write_log (L"AHI: Stop(%08x,%08x)\n",
flags, audioctrl);
if ((flags & AHISF_PLAY) && dsahip->playing) {
dsahip->playing = 0;
uae_u32 audioctrl = m68k_areg (&ctx->regs, 2);
struct DSAHI *dsahip = GETAHI;
if (ahi_debug)
- write_log ("AHI: Update(%08x,%08x)\n", flags, audioctrl);
+ write_log (L"AHI: Update(%08x,%08x)\n", flags, audioctrl);
setevent (dsahip);
return 0;
}
struct dschannel *dc = GETCHANNEL;
if (ahi_debug > 1)
- write_log ("AHI: SetVol(%d,%d,%d,%08x,%08x)\n",
+ write_log (L"AHI: SetVol(%d,%d,%d,%08x,%08x)\n",
channel, volume, pan, audioctrl, flags);
if (dc) {
if (volume < -65535)
struct dschannel *dc = GETCHANNEL;
if (ahi_debug > 1)
- write_log ("AHI: SetFreq(%d,%d,%08x,%08x)\n",
+ write_log (L"AHI: SetFreq(%d,%d,%08x,%08x)\n",
channel, frequency, audioctrl, flags);
if (dc) {
dc->csnext.frequency = frequency;
struct dschannel *dc = GETCHANNEL;
if (ahi_debug > 1)
- write_log ("AHI: SetSound(%d,%d,%08x,%d,%08x,%08x)\n",
+ write_log (L"AHI: SetSound(%d,%d,%08x,%d,%08x,%08x)\n",
channel, sound, offset, length, audioctrl, flags);
if (dc == NULL)
return AHIE_UNKNOWN;
struct DSAHI *dsahip = GETAHI;
if (ahi_debug)
- write_log ("AHI: SetEffect(%08x (%08x),%08x)\n", effect, effectype, audioctrl);
+ write_log (L"AHI: SetEffect(%08x (%08x),%08x)\n", effect, effectype, audioctrl);
switch (effectype)
{
case AHIET_CHANNELINFO:
put_long (puaebase + pub_ChannelInfo, 0);
break;
case AHIET_MASTERVOLUME:
- write_log ("AHI: SetEffect(MasterVolume=%08x)\n", get_long (effect + 4));
+ write_log (L"AHI: SetEffect(MasterVolume=%08x)\n", get_long (effect + 4));
case AHIET_MASTERVOLUME | AHIET_CANCEL:
break;
default:
int bps;
if (ahi_debug > 1)
- write_log ("AHI: LoadSound(%d,%d,%08x,%08x,SMP=%d,ADDR=%08x,LEN=%d)\n",
+ write_log (L"AHI: LoadSound(%d,%d,%08x,%08x,SMP=%d,ADDR=%08x,LEN=%d)\n",
sound, type, info, audioctrl, sampletype, addr, len);
if (!ds)
if (ds->al_buffer[0] == -1) {
alClear ();
alGenBuffers (2, ds->al_buffer);
- if (alError ("AHI: alGenBuffers"))
+ if (alError (L"AHI: alGenBuffers"))
return AHIE_NOMEM;
if (ahi_debug > 1)
- write_log ("AHI:LoadSound:allocated OpenAL buffer\n");
+ write_log (L"AHI:LoadSound:allocated OpenAL buffer\n");
}
return AHIE_OK;
}
struct dssample *ds = GETSAMPLE;
if (ahi_debug > 1)
- write_log ("AHI: UnloadSound(%d,%08x)\n",
+ write_log (L"AHI: UnloadSound(%d,%08x)\n",
sound, audioctrl);
ds->num = -1;
return AHIE_OK;
uae_u32 offset = get_long (sp + 4);
if (0 && ahi_debug)
- write_log ("AHI: %d\n", offset);
+ write_log (L"AHI: %d\n", offset);
switch (offset)
{
{
uaecptr a = here ();
org (rtarea_base + 0xFFC8);
- calltrap (deftrapres (ahi_demux, 0, "ahi_v2"));
+ calltrap (deftrapres (ahi_demux, 0, L"ahi_v2"));
dw (RTS);
org (a);
}
int avioutput_fps = VBLANK_HZ_PAL;
DWORD avioutput_framelimiter = 0, avioutput_nosoundoutput = 0;
-char avioutput_filename[MAX_DPATH];
-static char avioutput_filename_tmp[MAX_DPATH];
+TCHAR avioutput_filename[MAX_DPATH];
+static TCHAR avioutput_filename_tmp[MAX_DPATH];
extern struct uae_prefs workprefs;
-extern char config_filename[256];
+extern TCHAR config_filename[256];
static CRITICAL_SECTION AVIOutput_CriticalSection;
static int cs_allocated;
static UAEREG *openavikey (void)
{
- return regcreatetree (NULL, "AVConfiguration");
+ return regcreatetree (NULL, L"AVConfiguration");
}
static void storesettings (UAEREG *avikey)
{
- regsetint (avikey, "FrameLimiter", avioutput_framelimiter);
- regsetint (avikey, "NoSoundOutput", avioutput_nosoundoutput);
- regsetint (avikey, "FPS", avioutput_fps);
+ regsetint (avikey, L"FrameLimiter", avioutput_framelimiter);
+ regsetint (avikey, L"NoSoundOutput", avioutput_nosoundoutput);
+ regsetint (avikey, L"FPS", avioutput_fps);
}
static void getsettings (UAEREG *avikey)
{
DWORD val;
- if (regqueryint (avikey, "NoSoundOutput", &val))
+ if (regqueryint (avikey, L"NoSoundOutput", &val))
avioutput_nosoundoutput = val;
- if (regqueryint (avikey, "FrameLimiter", &val))
+ if (regqueryint (avikey, L"FrameLimiter", &val))
avioutput_framelimiter = val;
if (!avioutput_framelimiter)
avioutput_nosoundoutput = 1;
- if (regqueryint (avikey, "FPS", &val))
+ if (regqueryint (avikey, L"FPS", &val))
avioutput_fps = val;
}
AVIOutput_ReleaseAudio ();
if ((err = acmMetrics (NULL, ACM_METRIC_MAX_SIZE_FORMAT, &wfxMaxFmtSize))) {
- gui_message("acmMetrics() FAILED (%X)\n", err);
+ gui_message (L"acmMetrics() FAILED (%X)\n", err);
return 0;
}
acmopt.fdwStyle = ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT;
acmopt.pwfx = pwfxDst;
acmopt.cbwfx = wfxMaxFmtSize;
- acmopt.pszTitle = "Choose Audio Codec";
+ acmopt.pszTitle = L"Choose Audio Codec";
//acmopt.szFormatTag =; // not valid until the format is chosen
//acmopt.szFormat =; // not valid until the format is chosen
return 1;
}
-static int AVIOutput_ValidateAudio (WAVEFORMATEX *wft, char *name, int len)
+static int AVIOutput_ValidateAudio (WAVEFORMATEX *wft, TCHAR *name, int len)
{
DWORD ret;
ACMFORMATTAGDETAILS aftd;
return 0;
if (name)
- sprintf (name, "%s %s", aftd.szFormatTag, afd.szFormat);
+ _stprintf (name, L"%s %s", aftd.szFormatTag, afd.szFormat);
return 1;
}
getsettings (avikey);
if (wft) {
ss = wfxMaxFmtSize;
- if (regquerydata (avikey, "AudioConfigurationVars", wft, &ss)) {
+ if (regquerydata (avikey, L"AudioConfigurationVars", wft, &ss)) {
if (AVIOutput_ValidateAudio (wft, NULL, 0))
ok = 1;
}
}
if (!ok)
- regdelete (avikey, "AudioConfigurationVars");
+ regdelete (avikey, L"AudioConfigurationVars");
regclosetree (avikey);
return ok;
}
-static int AVIOutput_GetAudioCodecName (WAVEFORMATEX *wft, char *name, int len)
+static int AVIOutput_GetAudioCodecName (WAVEFORMATEX *wft, TCHAR *name, int len)
{
return AVIOutput_ValidateAudio (wft, name, len);
}
-int AVIOutput_GetAudioCodec (char *name, int len)
+int AVIOutput_GetAudioCodec (TCHAR *name, int len)
{
if (AVIOutput_AudioAllocated ())
return AVIOutput_GetAudioCodecName (pwfxDst, name, len);
return 0;
}
-int AVIOutput_ChooseAudioCodec (HWND hwnd, char *s, int len)
+int AVIOutput_ChooseAudioCodec (HWND hwnd, TCHAR *s, int len)
{
AVIOutput_End();
if (!AVIOutput_AllocateAudio ())
case MMSYSERR_NOERROR:
{
UAEREG *avikey;
- strcpy (s, acmopt.szFormatTag);
+ _tcscpy (s, acmopt.szFormatTag);
avikey = openavikey ();
if (avikey) {
- regsetdata (avikey, "AudioConfigurationVars", pwfxDst, pwfxDst->cbSize + sizeof (WAVEFORMATEX));
+ regsetdata (avikey, L"AudioConfigurationVars", pwfxDst, pwfxDst->cbSize + sizeof (WAVEFORMATEX));
storesettings (avikey);
regclosetree (avikey);
}
break;
case ACMERR_NOTPOSSIBLE:
- MessageBox (hwnd, "The buffer identified by the pwfx member of the ACMFORMATCHOOSE structure is too small to contain the selected format.", VersionStr, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
+ MessageBox (hwnd, L"The buffer identified by the pwfx member of the ACMFORMATCHOOSE structure is too small to contain the selected format.", VersionStr, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
break;
case MMSYSERR_INVALFLAG:
- MessageBox (hwnd, "At least one flag is invalid.", VersionStr, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
+ MessageBox (hwnd, L"At least one flag is invalid.", VersionStr, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
break;
case MMSYSERR_INVALHANDLE:
- MessageBox (hwnd, "The specified handle is invalid.", VersionStr, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
+ MessageBox (hwnd, L"The specified handle is invalid.", VersionStr, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
break;
case MMSYSERR_INVALPARAM:
- MessageBox (hwnd, "At least one parameter is invalid.", VersionStr, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
+ MessageBox (hwnd, L"At least one parameter is invalid.", VersionStr, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
break;
case MMSYSERR_NODRIVER:
- MessageBox (hwnd, "A suitable driver is not available to provide valid format selections.\n(Unsupported channel-mode selected in Sound-panel?)", VersionStr, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
+ MessageBox (hwnd, L"A suitable driver is not available to provide valid format selections.\n(Unsupported channel-mode selected in Sound-panel?)", VersionStr, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
break;
default:
- MessageBox (hwnd, "acmFormatChoose() FAILED", VersionStr, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
+ MessageBox (hwnd, L"acmFormatChoose() FAILED", VersionStr, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
break;
}
return 0;
if (pcv) {
ss = pcv->cbSize;
pcv->hic = 0;
- if (regquerydata (avikey, "VideoConfigurationVars", pcv, &ss)) {
+ if (regquerydata (avikey, L"VideoConfigurationVars", pcv, &ss)) {
pcv->hic = 0;
pcv->lpbiIn = pcv->lpbiOut = 0;
pcv->cbState = 0;
- if (regquerydatasize (avikey, "VideoConfigurationState", &ss)) {
+ if (regquerydatasize (avikey, L"VideoConfigurationState", &ss)) {
if (ss > 0) {
LPBYTE state = xmalloc (ss);
- if (regquerydata (avikey, "VideoConfigurationState", state, &ss)) {
+ if (regquerydata (avikey, L"VideoConfigurationState", state, &ss)) {
pcv->hic = ICOpen (pcv->fccType, pcv->fccHandler, ICMODE_COMPRESS);
if (pcv->hic) {
ok = 1;
}
}
if (!ok) {
- regdelete (avikey, "VideoConfigurationVars");
- regdelete (avikey, "VideoConfigurationState");
+ regdelete (avikey, L"VideoConfigurationVars");
+ regdelete (avikey, L"VideoConfigurationState");
}
regclosetree (avikey);
return ok;
}
-static int AVIOutput_GetVideoCodecName (COMPVARS *pcv, char *name, int len)
+static int AVIOutput_GetVideoCodecName (COMPVARS *pcv, TCHAR *name, int len)
{
ICINFO icinfo = { 0 };
name[0] = 0;
if (pcv->fccHandler == mmioFOURCC ('D','I','B',' ')) {
- strcpy (name, "Full Frames (Uncompressed)");
+ _tcscpy (name, L"Full Frames (Uncompressed)");
return 1;
}
if (ICGetInfo (pcv->hic, &icinfo, sizeof (ICINFO)) != 0) {
- if (WideCharToMultiByte (CP_ACP, 0, icinfo.szDescription, -1, name, len, NULL, NULL) != 0)
- return 1;
+ _tcsncpy (name, icinfo.szDescription, len);
+ return 1;
}
return 0;
}
-int AVIOutput_GetVideoCodec (char *name, int len)
+int AVIOutput_GetVideoCodec (TCHAR *name, int len)
{
if (AVIOutput_VideoAllocated ())
return AVIOutput_GetVideoCodecName (pcompvars, name, len);
return 0;
}
-int AVIOutput_ChooseVideoCodec (HWND hwnd, char *s, int len)
+int AVIOutput_ChooseVideoCodec (HWND hwnd, TCHAR *s, int len)
{
AVIOutput_End ();
if (!AVIOutput_AllocateVideo ())
state = xmalloc (1);
avikey = openavikey ();
if (avikey) {
- regsetdata (avikey, "VideoConfigurationState", state, ss);
- regsetdata (avikey, "VideoConfigurationVars", pcompvars, pcompvars->cbSize);
+ regsetdata (avikey, L"VideoConfigurationState", state, ss);
+ regsetdata (avikey, L"VideoConfigurationVars", pcompvars, pcompvars->cbSize);
storesettings (avikey);
regclosetree (avikey);
}
int tmp_partcnt = partcnt + 1;
int tmp_avioutput_video = avioutput_video;
int tmp_avioutput_audio = avioutput_audio;
- char fn[MAX_DPATH];
+ TCHAR fn[MAX_DPATH];
if (!force && total_avi_size < MAX_AVI_SIZE)
return;
if (total_avi_size == 0)
return;
- strcpy (fn, avioutput_filename_tmp);
- sprintf (avioutput_filename, "%s_%d.avi", fn, tmp_partcnt);
- write_log ("AVI split %d at %d bytes, %d frames\n",
+ _tcscpy (fn, avioutput_filename_tmp);
+ _stprintf (avioutput_filename, L"%s_%d.avi", fn, tmp_partcnt);
+ write_log (L"AVI split %d at %d bytes, %d frames\n",
tmp_partcnt, total_avi_size, frame_count);
AVIOutput_End ();
first_frame = 0;
avioutput_video = tmp_avioutput_video;
avioutput_audio = tmp_avioutput_audio;
AVIOutput_Begin ();
- strcpy (avioutput_filename_tmp, fn);
+ _tcscpy (avioutput_filename_tmp, fn);
partcnt = tmp_partcnt;
}
static void dorestart (void)
{
- write_log ("AVIOutput: parameters changed, restarting..\n");
+ write_log (L"AVIOutput: parameters changed, restarting..\n");
avioutput_needs_restart = 0;
checkAVIsize (1);
}
goto error;
if ((err = acmStreamSize (has, ae->sndsize, &dwOutputBytes, ACM_STREAMSIZEF_SOURCE) != 0)) {
- gui_message ("acmStreamSize() FAILED (%X)\n", err);
+ gui_message (L"acmStreamSize() FAILED (%X)\n", err);
goto error;
}
ash.dwDstUser = 0;
if ((err = acmStreamPrepareHeader (has, &ash, 0))) {
- gui_message ("acmStreamPrepareHeader() FAILED (%X)\n", err);
+ gui_message (L"acmStreamPrepareHeader() FAILED (%X)\n", err);
goto error;
}
if ((err = acmStreamConvert (has, &ash, ACM_STREAMCONVERTF_BLOCKALIGN))) {
- gui_message ("acmStreamConvert() FAILED (%X)\n", err);
+ gui_message (L"acmStreamConvert() FAILED (%X)\n", err);
goto error;
}
if ((err = AVIStreamWrite (AVIAudioStream, StreamSizeAudio, ash.cbDstLengthUsed / pwfxDst->nBlockAlign, lpAudio, ash.cbDstLengthUsed, 0, &swritten, &written)) != 0) {
- gui_message ("AVIStreamWrite() FAILED (%X)\n", err);
+ gui_message (L"AVIStreamWrite() FAILED (%X)\n", err);
goto error;
}
BitBlt (hdcMem, (avioutput_width / 2) - (actual_width / 2), (avioutput_height / 2) - (actual_height / 2), actual_width, actual_height, hdc, 0, 0, SRCCOPY);
SelectObject (hdcMem, hbitmapOld);
if (GetDIBits (hdc, hbitmap, 0, avioutput_height, avie->lpVideo, (LPBITMAPINFO)lpbi, DIB_RGB_COLORS) == 0) {
- gui_message ("GetDIBits() FAILED (%X)\n", GetLastError());
+ gui_message (L"GetDIBits() FAILED (%X)\n", GetLastError());
ok = 0;
}
DeleteObject (hbitmap);
if (!frame_count) {
if ((err = AVIStreamSetFormat (AVIVideoStream, frame_count, ae->lpbi, ae->lpbi->biSize + (ae->lpbi->biClrUsed * sizeof (RGBQUAD)))) != 0) {
- gui_message ("AVIStreamSetFormat() FAILED (%X)\n", err);
+ gui_message (L"AVIStreamSetFormat() FAILED (%X)\n", err);
goto error;
}
}
if ((err = AVIStreamWrite (AVIVideoStream, frame_count, 1, ae->lpVideo, ae->lpbi->biSizeImage, 0, NULL, &written)) != 0) {
- gui_message ("AVIStreamWrite() FAILED (%X)\n", err);
+ gui_message (L"AVIStreamWrite() FAILED (%X)\n", err);
goto error;
}
} else {
- gui_message ("DirectDraw_GetDC() FAILED\n");
+ gui_message (L"DirectDraw_GetDC() FAILED\n");
goto error;
}
if ((frame_count % (avioutput_fps * 10)) == 0)
- write_log ("AVIOutput: %d frames, (%d fps)\n", frame_count, avioutput_fps);
+ write_log (L"AVIOutput: %d frames, (%d fps)\n", frame_count, avioutput_fps);
return 1;
error:
avioutput_enabled = 0;
if (alive) {
- write_log ("killing worker thread\n");
+ write_log (L"killing worker thread\n");
write_comm_pipe_u32 (&workindex, 0xfffffffe, 1);
while (alive) {
while (comm_pipe_has_data (&queuefull))
{
AVISTREAMINFO avistreaminfo; // Structure containing information about the stream, including the stream type and its sample rate
int i, err;
- char *ext1, *ext2;
+ TCHAR *ext1, *ext2;
struct avientry *ae = NULL;
avientryindex = -1;
reset_sound ();
if (avioutput_audio == AVIAUDIO_WAV) {
- ext1 = ".wav"; ext2 = ".avi";
+ ext1 = L".wav"; ext2 = L".avi";
} else {
- ext1 = ".avi"; ext2 = ".wav";
+ ext1 = L".avi"; ext2 = L".wav";
}
- if (strlen (avioutput_filename) >= 4 && !strcmpi (avioutput_filename + strlen (avioutput_filename) - 4, ext2))
- avioutput_filename[strlen (avioutput_filename) - 4] = 0;
- if (strlen (avioutput_filename) >= 4 && strcmpi (avioutput_filename + strlen (avioutput_filename) - 4, ext1))
- strcat (avioutput_filename, ext1);
- strcpy (avioutput_filename_tmp, avioutput_filename);
- i = strlen (avioutput_filename_tmp) - 1;
+ if (_tcslen (avioutput_filename) >= 4 && !_tcsicmp (avioutput_filename + _tcslen (avioutput_filename) - 4, ext2))
+ avioutput_filename[_tcslen (avioutput_filename) - 4] = 0;
+ if (_tcslen (avioutput_filename) >= 4 && _tcsicmp (avioutput_filename + _tcslen (avioutput_filename) - 4, ext1))
+ _tcscat (avioutput_filename, ext1);
+ _tcscpy (avioutput_filename_tmp, avioutput_filename);
+ i = _tcslen (avioutput_filename_tmp) - 1;
while (i > 0 && avioutput_filename_tmp[i] != '.') i--;
if (i > 0)
avioutput_filename_tmp[i] = 0;
DeleteFile (avioutput_filename);
if (avioutput_audio == AVIAUDIO_WAV) {
- wavfile = fopen (avioutput_filename, "wb");
+ wavfile = _tfopen (avioutput_filename, L"wb");
if (!wavfile) {
- gui_message ("Failed to open wave-file\n\nThis can happen if the path and or file name was entered incorrectly.\n");
+ gui_message (L"Failed to open wave-file\n\nThis can happen if the path and or file name was entered incorrectly.\n");
goto error;
}
writewavheader (0);
- write_log ("wave-output to '%s' started\n", avioutput_filename);
+ write_log (L"wave-output to '%s' started\n", avioutput_filename);
return;
}
if (((err = AVIFileOpen (&pfile, avioutput_filename, OF_CREATE | OF_WRITE, NULL)) != 0)) {
- gui_message ("AVIFileOpen() FAILED (Error %X)\n\nThis can happen if the path and or file name was entered incorrectly.\nRequired *.avi extension.\n", err);
+ gui_message (L"AVIFileOpen() FAILED (Error %X)\n\nThis can happen if the path and or file name was entered incorrectly.\nRequired *.avi extension.\n", err);
goto error;
}
//avistreaminfo.rcFrame; // doesn't apply to audio
//avistreaminfo.dwEditCount =; // Number of times the stream has been edited. The stream handler maintains this count.
//avistreaminfo.dwFormatChangeCount =; // Number of times the stream format has changed. The stream handler maintains this count.
- strcpy (avistreaminfo.szName, "Audiostream"); // description of the stream.
+ _tcscpy (avistreaminfo.szName, L"Audiostream"); // description of the stream.
// create the audio stream
if ((err = AVIFileCreateStream (pfile, &AVIAudioStream, &avistreaminfo)) != 0) {
- gui_message ("AVIFileCreateStream() FAILED (%X)\n", err);
+ gui_message (L"AVIFileCreateStream() FAILED (%X)\n", err);
goto error;
}
if ((err = AVIStreamSetFormat (AVIAudioStream, 0, pwfxDst, sizeof (WAVEFORMATEX) + pwfxDst->cbSize)) != 0) {
- gui_message ("AVIStreamSetFormat() FAILED (%X)\n", err);
+ gui_message (L"AVIStreamSetFormat() FAILED (%X)\n", err);
goto error;
}
if ((err = acmStreamOpen(&has, NULL, &wfxSrc.Format, pwfxDst, NULL, 0, 0, ACM_STREAMOPENF_NONREALTIME)) != 0) {
- gui_message ("acmStreamOpen() FAILED (%X)\n", err);
+ gui_message (L"acmStreamOpen() FAILED (%X)\n", err);
goto error;
}
}
//avistreaminfo.dwEditCount =; // Number of times the stream has been edited. The stream handler maintains this count.
//avistreaminfo.dwFormatChangeCount =; // Number of times the stream format has changed. The stream handler maintains this count.
- strcpy (avistreaminfo.szName, "Videostream"); // description of the stream.
+ _tcscpy (avistreaminfo.szName, L"Videostream"); // description of the stream.
// create the stream
if ((err = AVIFileCreateStream (pfile, &AVIStreamInterface, &avistreaminfo)) != 0) {
- gui_message ("AVIFileCreateStream() FAILED (%X)\n", err);
+ gui_message (L"AVIFileCreateStream() FAILED (%X)\n", err);
goto error;
}
// create a compressed stream from our uncompressed stream and a compression filter
if ((err = AVIMakeCompressedStream (&AVIVideoStream, AVIStreamInterface, &videoOptions, NULL)) != AVIERR_OK) {
- gui_message("AVIMakeCompressedStream() FAILED (%X)\n", err);
+ gui_message (L"AVIMakeCompressedStream() FAILED (%X)\n", err);
goto error;
}
}
init_comm_pipe (&workindex, 20, 1);
init_comm_pipe (&queuefull, 20, 1);
alive = -1;
- uae_start_thread ("aviworker", AVIOutput_worker, NULL, NULL);
- write_log ("AVIOutput enabled: video=%d audio=%d\n", avioutput_video, avioutput_audio);
+ uae_start_thread (L"aviworker", AVIOutput_worker, NULL, NULL);
+ write_log (L"AVIOutput enabled: video=%d audio=%d\n", avioutput_video, avioutput_audio);
return;
error:
static void *AVIOutput_worker (void *arg)
{
- write_log ("AVIOutput worker thread started\n");
+ write_log (L"AVIOutput worker thread started\n");
alive = 1;
for (;;) {
uae_u32 idx = read_comm_pipe_u32_blocking (&workindex);
if (idx == 0xfffffffe || idx == 0xffffffff)
break;
}
- write_log ("AVIOutput worker thread killed\n");
+ write_log (L"AVIOutput worker thread killed\n");
alive = 0;
return 0;
}
sound_setadjust (0.0);
#if 0
- write_log ("%d ", idiff);
+ write_log (L"%d ", idiff);
diff = idiff / 20.0;
skipmode = pow (diff < 0 ? -diff : diff, EXP);
if (idiff < 0)
skipmode = -ADJUST_SIZE;
if (skipmode > ADJUST_SIZE)
skipmode = ADJUST_SIZE;
- write_log ("%d/%.2f\n", idiff, skipmode);
+ write_log (L"%d/%.2f\n", idiff, skipmode);
sound_setadjust (skipmode);
if (0 && !(frame_count % avioutput_fps))
- write_log ("AVIOutput: diff=%.2f skip=%.2f (%d-%d=%d)\n", diff, skipmode,
+ write_log (L"AVIOutput: diff=%.2f skip=%.2f (%d-%d=%d)\n", diff, skipmode,
StreamSizeAudio, StreamSizeAudioExpected, idiff);
#endif
}
extern int avioutput_fps;
extern DWORD avioutput_framelimiter, avioutput_nosoundoutput;
-extern char avioutput_filename[MAX_DPATH];
-
-extern void AVIOutput_WriteAudio(uae_u8 *sndbuffer, int sndbufsize);
-extern void AVIOutput_WriteVideo(void);
-extern int AVIOutput_ChooseAudioCodec(HWND hwnd,char*,int);
-extern int AVIOutput_GetAudioCodec(char*,int);
-extern int AVIOutput_ChooseVideoCodec(HWND hwnd,char*,int);
-extern int AVIOutput_GetVideoCodec(char*,int);
-extern void AVIOutput_Restart(void);
-extern void AVIOutput_End(void);
-extern void AVIOutput_Begin(void);
-extern void AVIOutput_Release(void);
-extern void AVIOutput_Initialize(void);
-extern void AVIOutput_RGBinfo(int,int,int,int,int,int);
-extern void AVIOutput_GetSettings(void);
-extern void AVIOutput_SetSettings(void);
+extern TCHAR avioutput_filename[MAX_DPATH];
+
+extern void AVIOutput_WriteAudio (uae_u8 *sndbuffer, int sndbufsize);
+extern void AVIOutput_WriteVideo (void);
+extern int AVIOutput_ChooseAudioCodec (HWND hwnd,TCHAR*,int);
+extern int AVIOutput_GetAudioCodec (TCHAR*,int);
+extern int AVIOutput_ChooseVideoCodec (HWND hwnd,TCHAR*,int);
+extern int AVIOutput_GetVideoCodec (TCHAR*,int);
+extern void AVIOutput_Restart (void);
+extern void AVIOutput_End (void);
+extern void AVIOutput_Begin (void);
+extern void AVIOutput_Release (void);
+extern void AVIOutput_Initialize (void);
+extern void AVIOutput_RGBinfo (int,int,int,int,int,int);
+extern void AVIOutput_GetSettings (void);
+extern void AVIOutput_SetSettings (void);
#define AVIAUDIO_AVI 1
#define AVIAUDIO_WAV 2
-
-/*
-extern int avioutput_pause;
-
-extern int avioutput_bits;
-
-extern int avioutput_fps;
-
-extern int avioutput_width, avioutput_height;
-
-extern int avioutput_video, avioutput_audio;
-
-extern int avioutput_init;
-
-extern int frame_count;
-
-extern char avioutput_filename[MAX_DPATH];
-
-extern void AviOutputClearAudioCodec(HWND hwnd);
-extern void AviOutputClearVideoCodec(HWND hwnd);
-
-extern void avioutput_screenshot(void);
-
-extern void AVIWriteAudio(uae_u16* sndbuffer, int sndbufsize);
-extern void AVIWriteVideo(void);
-extern LPSTR AVIChooseAudioCodec(HWND hwnd);
-extern LPSTR AVIChooseVideoCodec(HWND hwnd);
-extern void AVIUninitialize(void);
-extern void AVIInitialize(void);
-*/
\ No newline at end of file
int type;
int mediainserted;
uae_u8 *buf;
- char label[100];
+ TCHAR label[100];
SCSI *handle;
int isatapi;
int removable;
static struct scsi_info si[MAX_TOTAL_DEVICES];
static int unitcnt;
-static int getversion(const char *name, VS_FIXEDFILEINFO *ver)
+static int getversion(const TCHAR *name, VS_FIXEDFILEINFO *ver)
{
int ok = FALSE;
DWORD dwVersionHandle, dwFileVersionInfoSize;
if(vsFileInfo) {
memcpy (ver, vsFileInfo, sizeof (*ver));
ok = TRUE;
- write_log ("%s version %d.%d.%d.%d\n", name,
+ write_log (L"%s version %d.%d.%d.%d\n", name,
vsFileInfo->dwFileVersionMS >> 16,
vsFileInfo->dwFileVersionMS & 0xffff,
vsFileInfo->dwFileVersionLS >> 16,
return ok;
}
-const char *get_aspi_path(int aspitype)
+const TCHAR *get_aspi_path(int aspitype)
{
static int nero, adaptec, frog;
- static char path_nero[MAX_DPATH];
- static char path_adaptec[MAX_DPATH];
- static const char *path_frog = "FrogAspi.dll";
+ static TCHAR path_nero[MAX_DPATH];
+ static TCHAR path_adaptec[MAX_DPATH];
+ static const TCHAR *path_frog = L"FrogAspi.dll";
VS_FIXEDFILEINFO ver;
switch (aspitype)
if (nero < 0)
return NULL;
nero = -1;
- if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "SOFTWARE\\Ahead\\shared", 0, KEY_READ, &key) == ERROR_SUCCESS) {
- if (RegQueryValueEx (key, "NeroAPI", 0, &type, (LPBYTE)path_nero, &size) == ERROR_SUCCESS) {
- if (path_nero[strlen(path_nero) - 1] != '\\')
- strcat (path_nero, "\\");
- strcat (path_nero, "wnaspi32.dll");
+ if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, L"SOFTWARE\\Ahead\\shared", 0, KEY_READ, &key) == ERROR_SUCCESS) {
+ if (RegQueryValueEx (key, L"NeroAPI", 0, &type, (LPBYTE)path_nero, &size) == ERROR_SUCCESS) {
+ if (path_nero[_tcslen (path_nero) - 1] != '\\')
+ _tcscat (path_nero, L"\\");
+ _tcscat (path_nero, L"wnaspi32.dll");
RegCloseKey (key);
if (getversion(path_nero, &ver)) {
if (ver.dwFileVersionMS >= 0x20000) {
if (adaptec < 0)
return NULL;
adaptec = -1;
- strcpy (path_adaptec, "wnaspi32.dll");
+ _tcscpy (path_adaptec, L"wnaspi32.dll");
if (getversion(path_adaptec, &ver)) {
if (ver.dwFileVersionMS >= 0x40000 || ver.dwFileVersionMS < 0x10000) {
adaptec = 1;
Status = pfnSendASPI32Command((LPSRB)ip);
if (log_scsi)
- write_log ("ASPI: S=%d ha=%d, ID=%d, M='%s', Id='%s'\n",
+ write_log (L"ASPI: S=%d ha=%d, ID=%d, M='%s', Id='%s'\n",
Status, ip->HA_Count, ip->HA_SCSI_ID, ip->HA_ManagerId, ip->HA_Identifier);
if (ip->SRB_Status != SS_COMP)
return -1;
static int open_driver (SCSI *scgp)
{
- char path[MAX_DPATH];
+ TCHAR path[MAX_DPATH];
DWORD astatus;
BYTE HACount;
BYTE ASPIStatus;
return TRUE;
nero = frog = 0;
- strcpy (path, "WNASPI32");
+ _tcscpy (path, L"WNASPI32");
if (currprefs.win32_uaescsimode == UAESCSI_NEROASPI) {
- const char *p = get_aspi_path(1);
+ const TCHAR *p = get_aspi_path(1);
if (p) {
- strcpy (path, p);
+ _tcscpy (path, p);
nero = 1;
}
} else if (currprefs.win32_uaescsimode == UAESCSI_FROGASPI) {
- const char *p = get_aspi_path(2);
+ const TCHAR *p = get_aspi_path(2);
if (p) {
- strcpy (path, p);
+ _tcscpy (path, p);
frog = 1;
}
}
/*
* Load the ASPI library
*/
- write_log ("ASPI: driver location '%s'\n", path);
- hAspiLib = LoadLibrary(path);
+ write_log (L"ASPI: driver location '%s'\n", path);
+ hAspiLib = LoadLibrary (path);
if (hAspiLib == NULL && (nero || frog)) {
- write_log ("ASPI: NERO/FROG ASPI failed to load, falling back to default\n");
- hAspiLib = LoadLibrary("WNASPI32");
+ write_log (L"ASPI: NERO/FROG ASPI failed to load, falling back to default\n");
+ hAspiLib = LoadLibrary (L"WNASPI32");
}
/*
* Check if ASPI library is loaded correctly
*/
if (hAspiLib == NULL) {
- write_log ("ASPI: failed to load wnaspi32.dll\n");
+ write_log (L"ASPI: failed to load wnaspi32.dll\n");
return FALSE;
}
/*
pfnSendASPI32Command = (DWORD(*)(LPSRB))GetProcAddress(hAspiLib, "SendASPI32Command");
if (pfnGetASPI32SupportInfo == NULL || pfnSendASPI32Command == NULL) {
- write_log ("ASPI: obsolete wnaspi32.dll found\n");
+ write_log (L"ASPI: obsolete wnaspi32.dll found\n");
return FALSE;
}
ASPIStatus = HIBYTE(LOWORD(astatus));
HACount = LOBYTE(LOWORD(astatus));
- write_log ("ASPI: open_driver %X HostASPIStatus=0x%x HACount=0x%x\n", astatus, ASPIStatus, HACount);
+ write_log (L"ASPI: open_driver %X HostASPIStatus=0x%x HACount=0x%x\n", astatus, ASPIStatus, HACount);
if (ASPIStatus != SS_COMP && ASPIStatus != SS_NO_ADAPTERS) {
- write_log ("ASPI: Could not find any host adapters, ASPIStatus == 0x%02X\n", ASPIStatus);
+ write_log (L"ASPI: Could not find any host adapters, ASPIStatus == 0x%02X\n", ASPIStatus);
return FALSE;
}
busses = HACount;
- write_log ("ASPI: open_driver HostASPIStatus=0x%x HACount=0x%x\n", ASPIStatus, HACount);
+ write_log (L"ASPI: open_driver HostASPIStatus=0x%x HACount=0x%x\n", ASPIStatus, HACount);
for (i=0; i < busses; i++) {
SRB_HAInquiry s;
if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) {
errno = EINVAL;
if (log_scsi)
- write_log ("ASPI: Illegal value for busno, target or lun '%d,%d,%d'\n", busno, tgt, tlun);
+ write_log (L"ASPI: Illegal value for busno, target or lun '%d,%d,%d'\n", busno, tgt, tlun);
return 0;
}
/*
return;
if (scanphase)
return;
- write_log ("ASPI EXEC_SCSI: bus=%d,target=%d,lun=%d\n",
+ write_log (L"ASPI EXEC_SCSI: bus=%d,target=%d,lun=%d\n",
s->SRB_HaId, s->SRB_Target, s->SRB_Lun);
scsi_log_before (scgp->scmd->cdb.cmd_cdb, scgp->scmd->cdb_len,
(s->SRB_Flags & SRB_DIR_OUT) ? s->SRB_BufPointer : 0, s->SRB_BufLen);
SRB_Abort s;
if (log_scsi)
- write_log ("ASPI: Attempting to abort SCSI command\n");
+ write_log (L"ASPI: Attempting to abort SCSI command\n");
/*
* Set structure variables
*/
*/
if (s.SRB_Status != SS_COMP) {
if (log_scsi)
- write_log ("ASPI: Abort ERROR! 0x%08X\n", s.SRB_Status);
+ write_log (L"ASPI: Abort ERROR! 0x%08X\n", s.SRB_Status);
return FALSE;
}
if (log_scsi)
- write_log ("ASPI: Abort SCSI command completed\n");
+ write_log (L"ASPI: Abort SCSI command completed\n");
/*
* Everything went OK
*/
sp->error = SCG_FATAL;
sp->ux_errno = EINVAL;
if (log_scsi)
- write_log ("ASPI: sp->cdb_len > sizeof(SRB_ExecSCSICmd.CDBByte). Fatal error in scgo_send, exiting...\n");
+ write_log (L"ASPI: sp->cdb_len > sizeof(SRB_ExecSCSICmd.CDBByte). Fatal error in scgo_send, exiting...\n");
return -1;
}
/*
if (s.SRB_Status != SS_COMP) {
if (log_scsi && s.SRB_Status != 0x82)
- write_log ("ASPI: Error in scgo_send: s.SRB_Status is 0x%x\n", s.SRB_Status);
+ write_log (L"ASPI: Error in scgo_send: s.SRB_Status is 0x%x\n", s.SRB_Status);
set_error(&s, sp); /* Set error flags */
copy_sensedata(&s, sp); /* Copy sense and status */
if (log_scsi && s.SRB_Status != 0x82)
- write_log ("ASPI: Mapped to: error %d errno: %d\n", sp->error, sp->ux_errno);
+ write_log (L"ASPI: Mapped to: error %d errno: %d\n", sp->error, sp->ux_errno);
return 1;
}
/*
register struct scg_cmd *cp = scgp->scmd;
if(cp->error != SCG_NO_ERROR ||
- cp->ux_errno != 0 || *(u_char *)&cp->scb != 0)
+ cp->ux_errno != 0 || *(u_char*)&cp->scb != 0)
return -1;
return 0;
}
static void scan_scsi_bus (SCSI *scgp, int flags)
{
/* add all units we find */
- write_log ("ASPI: SCSI scan starting..\n");
+ write_log (L"ASPI: SCSI scan starting..\n");
scanphase = 1;
for (scgp->addr.scsibus=0; scgp->addr.scsibus < 8; scgp->addr.scsibus++) {
if (!scsi_havebus(scgp, scgp->addr.scsibus))
continue;
for (scgp->addr.lun=0; scgp->addr.lun < 8; scgp->addr.lun++) {
if (!inquiry (scgp, &inq, sizeof(inq))) {
- write_log ("ASPI: %d:%d:%d ", scgp->addr.scsibus,scgp->addr.target,scgp->addr.lun);
- write_log ("'%.8s' ", inq.vendor_info);
- write_log ("'%.16s' ", inq.prod_ident);
- write_log ("'%.4s' ", inq.prod_revision);
+ write_log (L"ASPI: %d:%d:%d ", scgp->addr.scsibus,scgp->addr.target,scgp->addr.lun);
+ write_log (L"'%.8s' ", inq.vendor_info);
+ write_log (L"'%.16s' ", inq.prod_ident);
+ write_log (L"'%.4s' ", inq.prod_revision);
if (unitcnt < MAX_TOTAL_DEVICES) {
struct scsi_info *cis = &si[unitcnt];
int use = 0;
- write_log ("[");
+ write_log (L"[");
if (inq.type == INQ_ROMD) {
- write_log ("CDROM");
+ write_log (L"CDROM");
use = 1;
} else if ((inq.type >= INQ_SEQD && inq.type < INQ_COMM && aspi_allow_misc) || aspi_allow_all) {
- write_log ("%d", inq.type);
+ write_log (L"%d", inq.type);
use = 1;
} else {
- write_log ("<%d>", inq.type);
+ write_log (L"<%d>", inq.type);
}
if (inq.ansi_version == 0) {
- write_log (",ATAPI");
+ write_log (L",ATAPI");
cis->isatapi = 1;
} else
- write_log (",SCSI");
- write_log ("]");
+ write_log (L",SCSI");
+ write_log (L"]");
if (use) {
unitcnt++;
cis->buf = malloc (DEVICE_SCSI_BUFSIZE);
cis->lun = scgp->addr.lun;
cis->type = inq.type;
cis->removable = inq.removable;
- sprintf (cis->label, "%.8s %.16s %.4s", inq.vendor_info, inq.prod_ident, inq.prod_revision);
+ _stprintf (cis->label, L"%.8s %.16s %.4s", inq.vendor_info, inq.prod_ident, inq.prod_revision);
}
}
- write_log ("\n");
+ write_log (L"\n");
}
}
}
}
- write_log ("ASPI: SCSI scan ended\n");
+ write_log (L"ASPI: SCSI scan ended\n");
scanphase = 0;
}
if (unitnum >= unitcnt)
return 0;
if (log_scsi)
- write_log ("ASPI: opening %d:%d:%d (%d)\n", si[unitnum].scsibus, si[unitnum].target, si[unitnum].lun, unitnum);
+ write_log (L"ASPI: opening %d:%d:%d (%d)\n", si[unitnum].scsibus, si[unitnum].target, si[unitnum].lun, unitnum);
si[unitnum].handle = openscsi (si[unitnum].scsibus, si[unitnum].target, si[unitnum].lun);
if (si[unitnum].handle)
si[unitnum].mediainserted = mediacheck (unitnum);
if (log_scsi)
- write_log ("unit %d: %s\n", unitnum, si[unitnum].mediainserted ? "CD inserted" : "Drive empty");
+ write_log (L"unit %d: %s\n", unitnum, si[unitnum].mediainserted ? "CD inserted" : "Drive empty");
return si[unitnum].handle ? 1 : 0;
}
mediacheck_full (unitnum, di);
di->id = unitnum + 1;
di->removable = sif->removable;
- strcpy (di->label, sif->label);
+ _tcscpy (di->label, sif->label);
if (log_scsi) {
- write_log ("MI=%d TP=%d WP=%d CY=%d BK=%d '%s'\n",
+ write_log (L"MI=%d TP=%d WP=%d CY=%d BK=%d '%s'\n",
di->media_inserted, di->type, di->write_protected, di->cylinders, di->bytespersector, di->label);
}
return di;
}
-void win32_aspi_media_change (char driveletter, int insert)
+void win32_aspi_media_change (TCHAR driveletter, int insert)
{
int i, now;
if (si[i].type == INQ_ROMD) {
now = mediacheck (i);
if (now != si[i].mediainserted) {
- write_log ("ASPI: media change %c %d\n", driveletter, insert);
+ write_log (L"ASPI: media change %c %d\n", driveletter, insert);
si[i].mediainserted = now;
scsi_do_disk_change (i + 1, insert);
}
struct dev_info_ioctl {
HANDLE h;
uae_u8 *tempbuffer;
- char drvletter;
- char devname[30];
+ TCHAR drvletter;
+ TCHAR devname[30];
int mediainserted;
int type;
int blocksize;
static void close_device (int unitnum);
static int open_device (int unitnum);
-static void mcierr(char *str, DWORD err)
+static void mcierr(TCHAR *str, DWORD err)
{
- char es[1000];
+ TCHAR es[1000];
if (err == MMSYSERR_NOERROR)
return;
- if (mciGetErrorString(err, es, sizeof es))
- write_log ("MCIErr: %s: %d = '%s'\n", str, err, es);
+ if (mciGetErrorString (err, es, sizeof es))
+ write_log (L"MCIErr: %s: %d = '%s'\n", str, err, es);
}
-static int win32_error (int unitnum, const char *format,...)
+static int win32_error (int unitnum, const TCHAR *format,...)
{
LPVOID lpMsgBuf;
va_list arglist;
- char buf[1000];
- DWORD err = GetLastError();
+ TCHAR buf[1000];
+ DWORD err = GetLastError ();
if (err == ERROR_WRONG_DISK) {
- write_log ("IOCTL: media change, re-opening device\n");
+ write_log (L"IOCTL: media change, re-opening device\n");
close_device (unitnum);
if (!open_device (unitnum))
- write_log ("IOCTL: re-opening failed!\n");
+ write_log (L"IOCTL: re-opening failed!\n");
return -1;
}
va_start (arglist, format );
- vsprintf (buf, format, arglist);
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
+ _vstprintf (buf, format, arglist);
+ FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&lpMsgBuf, 0, NULL);
if (log_scsi)
- write_log ("IOCTL: unit=%d %s,%d: %s\n", unitnum, buf, err, (char*)lpMsgBuf);
- va_end(arglist);
+ write_log (L"IOCTL: unit=%d %s,%d: %s\n", unitnum, buf, err, (TCHAR*)lpMsgBuf);
+ va_end (arglist);
return err;
}
-static int close_createfile(int unitnum)
+static int close_createfile (int unitnum)
{
struct dev_info_ioctl *ciw = &ciw32[unitnum];
ciw->fullaccess = 0;
if (ciw->h != INVALID_HANDLE_VALUE) {
if (log_scsi)
- write_log ("IOCTL: IOCTL close\n");
- CloseHandle(ciw->h);
+ write_log (L"IOCTL: IOCTL close\n");
+ CloseHandle (ciw->h);
if (log_scsi)
- write_log ("IOCTL: IOCTL close completed\n");
+ write_log (L"IOCTL: IOCTL close completed\n");
ciw->h = INVALID_HANDLE_VALUE;
return 1;
}
return 0;
}
-static int close_mci(int unitnum)
+static int close_mci (int unitnum)
{
struct dev_info_ioctl *ciw = &ciw32[unitnum];
MCI_GENERIC_PARMS gp = { 0 };
ciw->playend = -1;
if (ciw->mciid > 0) {
if (log_scsi)
- write_log ("IOCTL: MCI close\n");
- mcierr("MCI_STOP", mciSendCommand(ciw->mciid, MCI_STOP, MCI_WAIT, (DWORD_PTR)&gp));
- mcierr("MCI_CLOSE", mciSendCommand(ciw->mciid, MCI_CLOSE, MCI_WAIT, (DWORD_PTR)&gp));
+ write_log (L"IOCTL: MCI close\n");
+ mcierr (L"MCI_STOP", mciSendCommand (ciw->mciid, MCI_STOP, MCI_WAIT, (DWORD_PTR)&gp));
+ mcierr (L"MCI_CLOSE", mciSendCommand (ciw->mciid, MCI_CLOSE, MCI_WAIT, (DWORD_PTR)&gp));
if (log_scsi)
- write_log ("IOCTL: MCI close completed\n");
+ write_log (L"IOCTL: MCI close completed\n");
ciw->mciid = 0;
return 1;
}
return 0;
}
-static int open_createfile(int unitnum, int fullaccess)
+static int open_createfile (int unitnum, int fullaccess)
{
struct dev_info_ioctl *ciw = &ciw32[unitnum];
int closed = 0;
return 1;
}
}
- closed = close_mci(unitnum);
+ closed = close_mci (unitnum);
if (log_scsi)
- write_log ("IOCTL: opening IOCTL %s\n", ciw->devname);
+ write_log (L"IOCTL: opening IOCTL %s\n", ciw->devname);
for (;;) {
if (fullaccess) {
- ciw->h = CreateFile(ciw->devname, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ ciw->h = CreateFile (ciw->devname, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (ciw->h != INVALID_HANDLE_VALUE)
ciw->fullaccess = 1;
} else {
DWORD flags = GENERIC_READ;
- ciw->h = CreateFile(ciw->devname, flags, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ ciw->h = CreateFile (ciw->devname, flags, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (ciw->h == INVALID_HANDLE_VALUE) {
- ciw->h = CreateFile(ciw->devname, flags, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ ciw->h = CreateFile (ciw->devname, flags, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (ciw->h == INVALID_HANDLE_VALUE) {
flags |= GENERIC_WRITE;
- ciw->h = CreateFile(ciw->devname, flags, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ ciw->h = CreateFile (ciw->devname, flags, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
}
}
}
if (ciw->h == INVALID_HANDLE_VALUE) {
- DWORD err = GetLastError();
+ DWORD err = GetLastError ();
if (err == ERROR_SHARING_VIOLATION) {
if (closed && cnt > 0) {
cnt--;
- Sleep(10);
+ Sleep (10);
continue;
}
}
if (closed)
- write_log ("IOCTL: failed to re-open '%s', err=%d\n", ciw->devname, GetLastError());
+ write_log (L"IOCTL: failed to re-open '%s', err=%d\n", ciw->devname, GetLastError());
return 0;
}
break;
}
- if (!DeviceIoControl(ciw->h, FSCTL_ALLOW_EXTENDED_DASD_IO, NULL, 0, NULL, 0, &len, NULL))
- write_log ("IOCTL: FSCTL_ALLOW_EXTENDED_DASD_IO returned %d\n", GetLastError());
+ if (!DeviceIoControl (ciw->h, FSCTL_ALLOW_EXTENDED_DASD_IO, NULL, 0, NULL, 0, &len, NULL))
+ write_log (L"IOCTL: FSCTL_ALLOW_EXTENDED_DASD_IO returned %d\n", GetLastError());
if (log_scsi)
- write_log ("IOCTL: IOCTL open completed\n");
+ write_log (L"IOCTL: IOCTL open completed\n");
return 1;
}
-static int open_mci(int unitnum)
+static int open_mci (int unitnum)
{
struct dev_info_ioctl *ciw = &ciw32[unitnum];
- char elname[10];
- char alname[100];
+ TCHAR elname[10];
+ TCHAR alname[100];
MCI_OPEN_PARMS mciOpen;
DWORD err, flags;
int closed = 0;
if (ciw->mciid > 0 || MCICDA == 0)
return 1;
ciw->playend = -1;
- closed = close_createfile(unitnum);
+ closed = close_createfile (unitnum);
if (log_scsi)
- write_log ("IOCTL: MCI opening %c:\n", ciw->drvletter);
- memset (&mciOpen, 0, sizeof(mciOpen));
- mciOpen.lpstrDeviceType = (LPSTR)MCI_DEVTYPE_CD_AUDIO;
- sprintf(elname,"%c:", ciw->drvletter);
- sprintf(alname,"CD%u:", GetCurrentTime());
+ write_log (L"IOCTL: MCI opening %c:\n", ciw->drvletter);
+ memset (&mciOpen, 0, sizeof (mciOpen));
+ mciOpen.lpstrDeviceType = (LPWSTR)MCI_DEVTYPE_CD_AUDIO;
+ _stprintf (elname, L"%c:", ciw->drvletter);
+ _stprintf (alname, L"CD%u:", GetCurrentTime ());
mciOpen.lpstrElementName = elname;
mciOpen.lpstrAlias = alname;
flags = MCI_OPEN_ELEMENT | MCI_OPEN_SHAREABLE | MCI_OPEN_ALIAS | MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID | MCI_WAIT;
- err = mciSendCommand(0, MCI_OPEN, flags, (DWORD)(LPVOID)&mciOpen);
+ err = mciSendCommand (0, MCI_OPEN, flags, (DWORD)(LPVOID)&mciOpen);
ciw->mciid = mciOpen.wDeviceID;
if (err != MMSYSERR_NOERROR) {
if (closed)
- mcierr("MCI_OPEN", err);
+ mcierr (L"MCI_OPEN", err);
return 0;
}
if (log_scsi)
- write_log ("IOCTL: MCI open completed\n");
+ write_log (L"IOCTL: MCI open completed\n");
return 1;
}
MCI_GENERIC_PARMS gp = { 0 };
if (paused)
- mcierr("MCI_PAUSE", mciSendCommand(ciw->mciid, MCI_PAUSE, MCI_WAIT, (DWORD_PTR)&gp));
+ mcierr(L"MCI_PAUSE", mciSendCommand (ciw->mciid, MCI_PAUSE, MCI_WAIT, (DWORD_PTR)&gp));
else
- mcierr("MCI_RESUME", mciSendCommand(ciw->mciid, MCI_RESUME, MCI_WAIT, (DWORD_PTR)&gp));
+ mcierr(L"MCI_RESUME", mciSendCommand (ciw->mciid, MCI_RESUME, MCI_WAIT, (DWORD_PTR)&gp));
} else {
seterrormode (unitnum);
if (!DeviceIoControl(ciw32[unitnum].h, command, NULL, 0, NULL, 0, &len, NULL)) {
reseterrormode (unitnum);
- if (win32_error (unitnum, paused ? "IOCTL_CDROM_PAUSE_AUDIO" : "IOCTL_CDROM_RESUME_AUDIO") < 0)
+ if (win32_error (unitnum, paused ? L"IOCTL_CDROM_PAUSE_AUDIO" : L"IOCTL_CDROM_RESUME_AUDIO") < 0)
continue;
return 0;
}
if (ciw->mciid > 0) {
MCI_GENERIC_PARMS gp = { 0 };
- mcierr("MCI_STOP", mciSendCommand(ciw->mciid, MCI_STOP, MCI_WAIT, (DWORD_PTR)&gp));
+ mcierr (L"MCI_STOP", mciSendCommand (ciw->mciid, MCI_STOP, MCI_WAIT, (DWORD_PTR)&gp));
ciw->playend = -1;
} else {
while (cnt-- > 0) {
seterrormode (unitnum);
- if(!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_STOP_AUDIO, NULL, 0, NULL, 0, &len, NULL)) {
+ if(!DeviceIoControl (ciw32[unitnum].h, IOCTL_CDROM_STOP_AUDIO, NULL, 0, NULL, 0, &len, NULL)) {
reseterrormode (unitnum);
- if (win32_error (unitnum, "IOCTL_CDROM_STOP_AUDIO") < 0)
+ if (win32_error (unitnum, L"IOCTL_CDROM_STOP_AUDIO") < 0)
continue;
return 0;
}
MCI_PLAY_PARMS playParms = {0};
setParms.dwTimeFormat = MCI_FORMAT_MSF;
- mcierr("MCI_SET", mciSendCommand(ciw->mciid, MCI_SET, MCI_SET_TIME_FORMAT | MCI_WAIT, (DWORD_PTR)&setParms));
+ mcierr (L"MCI_SET", mciSendCommand (ciw->mciid, MCI_SET, MCI_SET_TIME_FORMAT | MCI_WAIT, (DWORD_PTR)&setParms));
playParms.dwFrom = MCI_MAKE_MSF((start >> 16) & 0xff, (start >> 8) & 0xff, start & 0xff);
playParms.dwTo = MCI_MAKE_MSF((end >> 16) & 0xff, (end >> 8) & 0xff, end & 0xff);
- mcierr("MCI_PLAY", mciSendCommand(ciw->mciid, MCI_PLAY, MCI_FROM | MCI_TO, (DWORD_PTR)&playParms));
+ mcierr (L"MCI_PLAY", mciSendCommand (ciw->mciid, MCI_PLAY, MCI_FROM | MCI_TO, (DWORD_PTR)&playParms));
ciw->playend = end;
} else {
{
VOLUME_CONTROL vc;
if (!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_GET_VOLUME, NULL, 0, &vc, sizeof(vc), &len, NULL))
- write_log ("IOCTL_CDROM_GET_VOLUME %d\n", GetLastError());
+ write_log (L"IOCTL_CDROM_GET_VOLUME %d\n", GetLastError());
vc.PortVolume[0] = 0xff;
vc.PortVolume[1] = 0xff;
vc.PortVolume[2] = 0xff;
vc.PortVolume[3] = 0xff;
if (!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_SET_VOLUME, &vc, sizeof(vc), NULL, 0, &len, NULL))
- write_log ("IOCTL_CDROM_SET_VOLUME %d\n", GetLastError());
+ write_log (L"IOCTL_CDROM_SET_VOLUME %d\n", GetLastError());
}
#endif
pa.EndingS = end >> 8;
pa.EndingF = end >> 0;
seterrormode (unitnum);
- if (!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_PLAY_AUDIO_MSF, &pa, sizeof(pa), NULL, 0, &len, NULL)) {
+ if (!DeviceIoControl (ciw32[unitnum].h, IOCTL_CDROM_PLAY_AUDIO_MSF, &pa, sizeof(pa), NULL, 0, &len, NULL)) {
reseterrormode (unitnum);
- if (win32_error (unitnum, "IOCTL_CDROM_PLAY_AUDIO_MSF %02.%02.%02-%02.%02.%02",
+ if (win32_error (unitnum, L"IOCTL_CDROM_PLAY_AUDIO_MSF %02.%02.%02-%02.%02.%02",
pa.StartingM, pa.StartingS, pa.StartingF, pa.EndingM, pa.EndingS, pa.EndingF ) < 0) continue;
return 0;
}
uae_u32 pos, pos2;
int trk;
- memset(buf, 0, sizeof buf);
- memset(&mciStatusParms, 0, sizeof mciStatusParms);
+ memset (buf, 0, sizeof buf);
+ memset (&mciStatusParms, 0, sizeof mciStatusParms);
mciStatusParms.dwItem = MCI_STATUS_MODE;
- err = mciSendCommand(ciw->mciid, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD)(LPVOID)&mciStatusParms);
+ err = mciSendCommand (ciw->mciid, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD)(LPVOID)&mciStatusParms);
if (err != MMSYSERR_NOERROR)
return 0;
mode = mciStatusParms.dwReturn;
mciStatusParms.dwItem = MCI_STATUS_CURRENT_TRACK;
- err = mciSendCommand(ciw->mciid, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD)(LPVOID)&mciStatusParms);
+ err = mciSendCommand (ciw->mciid, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD)(LPVOID)&mciStatusParms);
if (err != MMSYSERR_NOERROR)
return 0;
trk = mciStatusParms.dwReturn - 1;
if (trk < 0)
trk = 0;
mciStatusParms.dwItem = MCI_STATUS_POSITION;
- err = mciSendCommand(ciw->mciid, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD)(LPVOID)&mciStatusParms);
+ err = mciSendCommand (ciw->mciid, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD)(LPVOID)&mciStatusParms);
if (err != MMSYSERR_NOERROR)
return 0;
pos = (((mciStatusParms.dwReturn >> 16) & 0xff) << 0) | (((mciStatusParms.dwReturn >> 8) & 0xff) << 8) | (((mciStatusParms.dwReturn >> 0) & 0xff) << 16);
p[6] = (pos >> 8) & 0xff;
p[7] = (pos >> 0) & 0xff;
- pos = msf2lsn(pos);
+ pos = msf2lsn (pos);
pos2 = (ciw->toc.TrackData[trk].Address[1] << 16) | (ciw->toc.TrackData[trk].Address[2] << 8) | (ciw->toc.TrackData[trk].Address[3] << 0);
- pos -= msf2lsn(pos2);
+ pos -= msf2lsn (pos2);
if (pos < 0)
pos = 0;
- pos = lsn2msf(pos);
+ pos = lsn2msf (pos);
p[9] = (pos >> 16) & 0xff;
p[10] = (pos >> 8) & 0xff;
p[3] = 12;
while (cnt-- > 0) {
reseterrormode (unitnum);
- if(!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_READ_Q_CHANNEL, &in, sizeof(in), &qcd, sizeof (qcd), &len, NULL)) {
+ if(!DeviceIoControl (ciw32[unitnum].h, IOCTL_CDROM_READ_Q_CHANNEL, &in, sizeof(in), &qcd, sizeof (qcd), &len, NULL)) {
reseterrormode (unitnum);
- if (win32_error (unitnum, "IOCTL_CDROM_READ_Q_CHANNEL") < 0)
+ if (win32_error (unitnum, L"IOCTL_CDROM_READ_Q_CHANNEL") < 0)
continue;
return 0;
}
uae_u8 cmd[12] = { 0xbe, 0, 0, 0, 0, 0, 0, 0, 1, 0x10, 0, 0 };
int len = sizeof cmd;
- if (!open_createfile(unitnum, 1))
+ if (!open_createfile (unitnum, 1))
return 0;
cmd[3] = (uae_u8)(sector >> 16);
cmd[4] = (uae_u8)(sector >> 8);
&returned, NULL);
reseterrormode (unitnum);
if (!status) {
- DWORD err = GetLastError();
- write_log ("IOCTL_RAW_SCSI unit %d, ERR=%d ", unitnum, err);
+ DWORD err = GetLastError ();
+ write_log (L"IOCTL_RAW_SCSI unit %d, ERR=%d ", unitnum, err);
return 0;
}
return p;
uae_u8 *p = ciw32[unitnum].tempbuffer;
if (log_scsi)
- write_log ("IOCTL rawread unit=%d sector=%d blocksize=%d\n", unitnum, sector, sectorsize);
+ write_log (L"IOCTL rawread unit=%d sector=%d blocksize=%d\n", unitnum, sector, sectorsize);
if (!os_vista)
return spti_read (unitnum, sector, sectorsize);
- if (!open_createfile(unitnum, 1))
+ if (!open_createfile (unitnum, 1))
return 0;
if (sectorsize != 2336 && sectorsize != 2352 && sectorsize != 2048)
return 0;
rri.TrackMode = RawWithSubCode;
len = sectorsize;
memset (p, 0, sectorsize);
- if (!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_RAW_READ, &rri, sizeof rri,
+ if (!DeviceIoControl (ciw32[unitnum].h, IOCTL_CDROM_RAW_READ, &rri, sizeof rri,
p, IOCTL_DATA_BUFFER, &len, NULL)) {
DWORD err = GetLastError ();
}
uae_u8 *p = ciw32[unitnum].tempbuffer;
*ptr = NULL;
- if (!open_createfile(unitnum, 0))
+ if (!open_createfile (unitnum, 0))
return 0;
while (cnt-- > 0) {
gui_cd_led (unitnum, 1);
seterrormode (unitnum);
if (SetFilePointer (ciw32[unitnum].h, sector * ciw32[unitnum].blocksize, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER) {
reseterrormode (unitnum);
- if (win32_error (unitnum, "SetFilePointer") < 0)
+ if (win32_error (unitnum, L"SetFilePointer") < 0)
continue;
return 0;
}
if (!WriteFile (ciw32[unitnum].h, p, blocksize, &dtotal, 0)) {
int err;
reseterrormode (unitnum);
- err = win32_error (unitnum, "WriteFile");
+ err = win32_error (unitnum, L"WriteFile");
if (err < 0)
continue;
if (err == ERROR_WRITE_PROTECT)
dtotal = 0;
if (!ReadFile (ciw32[unitnum].h, p, blocksize, &dtotal, 0)) {
reseterrormode (unitnum);
- if (win32_error (unitnum, "ReadFile") < 0)
+ if (win32_error (unitnum, L"ReadFile") < 0)
continue;
return 0;
}
/* ESS Mega (CDTV) "fake" data area returns zero bytes and no error.. */
*ptr = spti_read (unitnum, sector, 2048);
if (log_scsi)
- write_log ("IOCTL unit %d, sector %d: ReadFile()==0. SPTI=%d\n", unitnum, sector, *ptr == 0 ? GetLastError() : 0);
+ write_log (L"IOCTL unit %d, sector %d: ReadFile()==0. SPTI=%d\n", unitnum, sector, *ptr == 0 ? GetLastError () : 0);
return 1;
#if 0
DWORD len = CD_RAW_SECTOR_WITH_SUBCODE_SIZE, err = -1;
err = GetLastError (); /* returns ERROR_IO_DEVICE and still succeeds?! */
}
p += 16; /* skip raw header */
- write_log ("ioctl_command_read(%d,%d)==0, IOCTL_CDROM_RAW_READ = d\n",
+ write_log (L"ioctl_command_read(%d,%d)==0, IOCTL_CDROM_RAW_READ = d\n",
sector, blocksize, err);
#endif
}
DWORD len;
int cnt = 3;
- if (!open_createfile(unitnum, 0))
+ if (!open_createfile (unitnum, 0))
return 0;
while (cnt-- > 0) {
seterrormode (unitnum);
- if (!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_GET_DRIVE_GEOMETRY, NULL, 0, &geom, sizeof(geom), &len, NULL)) {
+ if (!DeviceIoControl (ciw32[unitnum].h, IOCTL_CDROM_GET_DRIVE_GEOMETRY, NULL, 0, &geom, sizeof(geom), &len, NULL)) {
reseterrormode (unitnum);
- if (win32_error (unitnum, "IOCTL_CDROM_GET_DRIVE_GEOMETRY") < 0)
+ if (win32_error (unitnum, L"IOCTL_CDROM_GET_DRIVE_GEOMETRY") < 0)
continue;
return 0;
}
MCI_STATUS_PARMS mciStatusParms;
mciStatusParms.dwItem = MCI_STATUS_MEDIA_PRESENT;
- err = mciSendCommand(ciw->mciid, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD)(LPVOID)&mciStatusParms);
+ err = mciSendCommand (ciw->mciid, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD)(LPVOID)&mciStatusParms);
if (err != MMSYSERR_NOERROR)
return 0;
if (mciStatusParms.dwReturn)
} else {
struct device_info di;
- memset(&di, 0, sizeof di);
+ memset (&di, 0, sizeof di);
return fetch_geometry (unitnum, &di);
}
}
int cnt = 3;
CDROM_TOC *toc = &ciw32[unitnum].toc;
- if (!open_createfile(unitnum, 0))
+ if (!open_createfile (unitnum, 0))
return 0;
gui_cd_led (unitnum, 1);
while (cnt-- > 0) {
seterrormode (unitnum);
- if (!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_READ_TOC, NULL, 0, toc, sizeof(CDROM_TOC), &len, NULL)) {
+ if (!DeviceIoControl (ciw32[unitnum].h, IOCTL_CDROM_READ_TOC, NULL, 0, toc, sizeof(CDROM_TOC), &len, NULL)) {
reseterrormode (unitnum);
- if (win32_error (unitnum, "IOCTL_CDROM_READ_TOC") < 0)
+ if (win32_error (unitnum, L"IOCTL_CDROM_READ_TOC") < 0)
continue;
return 0;
}
/* buffer must be page aligned for device access */
ciw->tempbuffer = VirtualAlloc (NULL, IOCTL_DATA_BUFFER, MEM_COMMIT, PAGE_READWRITE);
if (!ciw->tempbuffer) {
- write_log ("IOCTL: failed to allocate buffer");
+ write_log (L"IOCTL: failed to allocate buffer");
return 1;
}
- if (!open_createfile(unitnum, 0)) {
- write_log ("IOCTL: failed to open '%s', err=%d\n", ciw->devname, GetLastError());
+ if (!open_createfile (unitnum, 0)) {
+ write_log (L"IOCTL: failed to open '%s', err=%d\n", ciw->devname, GetLastError ());
goto error;
}
ciw->mediainserted = ioctl_command_toc (unitnum) ? 1 : 0;
- write_log ("IOCTL: device '%s' opened succesfully (unit number=%d,media=%d)\n", ciw->devname, unitnum, ciw->mediainserted);
+ write_log (L"IOCTL: device '%s' opened succesfully (unit number=%d,media=%d)\n", ciw->devname, unitnum, ciw->mediainserted);
ioctl_command_stop (unitnum);
return 0;
error:
- win32_error (unitnum, "CreateFile");
+ win32_error (unitnum, L"CreateFile");
VirtualFree (ciw->tempbuffer, 0, MEM_RELEASE);
ciw->tempbuffer = NULL;
CloseHandle (ciw->h);
if (!unitcheck (unitnum))
return;
- close_createfile(unitnum);
- close_mci(unitnum);
+ close_createfile (unitnum);
+ close_mci (unitnum);
VirtualFree (ciw->tempbuffer, 0, MEM_RELEASE);
ciw->tempbuffer = NULL;
}
{
int dwDriveMask;
int drive, i;
- char tmp[10];
+ TCHAR tmp[10];
for (i = 0; i < MAX_TOTAL_DEVICES; i++) {
memset (&ciw32[i], 0, sizeof (struct dev_info_ioctl));
}
MCICDA = 1;//os_vista ? 1 : 0;
total_devices = 0;
- dwDriveMask = GetLogicalDrives();
+ dwDriveMask = GetLogicalDrives ();
if (log_scsi)
- write_log ("IOCTL: drive mask = %08X\n", dwDriveMask);
+ write_log (L"IOCTL: drive mask = %08X\n", dwDriveMask);
dwDriveMask >>= 2; // Skip A and B drives...
for( drive = 'C'; drive <= 'Z'; drive++) {
if (dwDriveMask & 1) {
int dt;
- sprintf(tmp, "%c:\\", drive);
+ _stprintf (tmp, L"%c:\\", drive);
dt = GetDriveType (tmp);
if (log_scsi)
- write_log ("IOCTL: drive %c type %d\n", drive, dt);
+ write_log (L"IOCTL: drive %c type %d\n", drive, dt);
if (((flags & (1 << INQ_ROMD)) && dt == DRIVE_CDROM) || ((flags & (1 << INQ_DASD)) && dt == DRIVE_FIXED)) {
if (log_scsi)
- write_log ("IOCTL: drive %c: = unit %d\n", drive, total_devices);
+ write_log (L"IOCTL: drive %c: = unit %d\n", drive, total_devices);
ciw32[total_devices].drvletter = drive;
ciw32[total_devices].type = dt;
ciw32[total_devices].blocksize = 2048;
- sprintf (ciw32[total_devices].devname,"\\\\.\\%c:", drive);
+ _stprintf (ciw32[total_devices].devname, L"\\\\.\\%c:", drive);
total_devices++;
}
}
struct dev_info_ioctl *ciw = &ciw32[unitnum];
return ciw->mediainserted;
}
- return ismedia(unitnum);
+ return ismedia (unitnum);
}
static struct device_info *info_device (int unitnum, struct device_info *di)
di->write_protected = ciw32[unitnum].type == DRIVE_CDROM ? 1 : 0;
di->type = ciw32[unitnum].type == DRIVE_CDROM ? INQ_ROMD : INQ_DASD;
di->id = ciw32[unitnum].drvletter;
- sprintf (di->label, "Drive %c:", ciw32[unitnum].drvletter);
+ _stprintf (di->label, L"Drive %c:", ciw32[unitnum].drvletter);
return di;
}
-void win32_ioctl_media_change (char driveletter, int insert)
+void win32_ioctl_media_change (TCHAR driveletter, int insert)
{
int i;
for (i = 0; i < MAX_TOTAL_DEVICES; i++) {
if (ciw32[i].drvletter == driveletter && ciw32[i].mediainserted != insert) {
- write_log ("IOCTL: media change %c %d\n", driveletter, insert);
+ write_log (L"IOCTL: media change %c %d\n", driveletter, insert);
ciw32[i].mediainserted = insert;
scsi_do_disk_change (driveletter, insert);
}
static int unitcnt = 0;
struct dev_info_spti {
- char *drvpath;
- char *name;
- char *inquirydata;
+ TCHAR *drvpath;
+ TCHAR *name;
+ TCHAR *inquirydata;
int mediainserted;
HANDLE handle;
int isatapi;
*err = 0;
if (log_scsi) {
- write_log ("SCSI, H=%X:%d:%d:%d:%d: ", di->handle, di->bus, di->path, di->target, di->lun);
+ write_log (L"SCSI, H=%X:%d:%d:%d:%d: ", di->handle, di->bus, di->path, di->target, di->lun);
scsi_log_before (swb->spt.Cdb, swb->spt.CdbLength,
swb->spt.DataIn == SCSI_IOCTL_DATA_OUT ? swb->spt.DataBuffer : 0,swb->spt.DataTransferLength);
}
if (!status) {
int lasterror = GetLastError();
*err = lasterror;
- write_log ("SCSI ERROR, H=%X:%d:%d:%d:%d: ", di->handle, di->bus, di->path, di->target, di->lun);
- write_log ("Status = %d, Error code = %d, LastError=%d\n", status, swb->spt.ScsiStatus, lasterror);
+ write_log (L"SCSI ERROR, H=%X:%d:%d:%d:%d: ", di->handle, di->bus, di->path, di->target, di->lun);
+ write_log (L"Status = %d, Error code = %d, LastError=%d\n", status, swb->spt.ScsiStatus, lasterror);
scsi_log_before (swb->spt.Cdb, swb->spt.CdbLength,
swb->spt.DataIn == SCSI_IOCTL_DATA_OUT ? swb->spt.DataBuffer : 0,swb->spt.DataTransferLength);
}
static void close_scsi_device (int unitnum)
{
if (dev_info[unitnum].handle != INVALID_HANDLE_VALUE) {
- write_log ("SPTI: unit %d closed\n", unitnum);
+ write_log (L"SPTI: unit %d closed\n", unitnum);
CloseHandle (dev_info[unitnum].handle);
}
dev_info[unitnum].handle = INVALID_HANDLE_VALUE;
{
int i;
for (i = 0; i < total_devices; i++)
- free_scsi_device(i);
+ free_scsi_device (i);
}
static void checkcapabilities (int unitnum)
&query, sizeof query, &desc, sizeof desc, &ret, NULL);
if (status) {
if (desc.Version > offsetof (STORAGE_ADAPTER_DESCRIPTOR, BusType))
- write_log ("SCSI CAPS: BusType=%d, MaxTransfer=0x%08X, Mask=0x%08X\n",
+ write_log (L"SCSI CAPS: BusType=%d, MaxTransfer=0x%08X, Mask=0x%08X\n",
desc.BusType, desc.MaximumTransferLength, desc.AlignmentMask);
}
}
di->type = 0x1f;
if (!p) {
if (log_scsi)
- write_log ("SPTI: INQUIRY failed\n");
+ write_log (L"SPTI: INQUIRY failed\n");
return 0;
}
inqlen = outlen > INQUIRY_SIZE ? INQUIRY_SIZE : outlen;
memcpy (inquirydata, p, inqlen);
if (log_scsi) {
if (outlen >= INQUIRY_SIZE)
- write_log ("SPTI: INQUIRY: %02X%02X%02X %d '%-8s' '%-16s'\n",
+ write_log (L"SPTI: INQUIRY: %02X%02X%02X %d '%-8s' '%-16s'\n",
p[0], p[1], p[2], di->isatapi, p + 8, p + 16);
}
return inqlen;
di->write_protected = (p[3] & 0x80) ? 1 : 0;
}
}
-// write_log ("mediacheck_full(%d,%d,%d,%d,%d)\n",
+// write_log (L"mediacheck_full(%d,%d,%d,%d,%d)\n",
// di->bytespersector, di->sectorspertrack, di->trackspercylinder, di->cylinders, di->write_protected);
return 1;
}
int open_scsi_device (int unitnum)
{
HANDLE h;
- char *dev;
+ TCHAR *dev;
struct dev_info_spti *di;
di = &dev_info[unitnum];
return 0;
if (di->bus >= 0) {
dev = xmalloc (100);
- sprintf (dev, "\\\\.\\Scsi%d:", di->bus);
+ _stprintf (dev, L"\\\\.\\Scsi%d:", di->bus);
} else {
- dev = my_strdup(di->drvpath);
+ dev = my_strdup (di->drvpath);
}
if (!di->scsibuf)
di->scsibuf = VirtualAlloc (NULL, DEVICE_SCSI_BUFSIZE, MEM_COMMIT, PAGE_READWRITE);
h = CreateFile(dev,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,NULL);
di->handle = h;
if (h == INVALID_HANDLE_VALUE) {
- write_log ("SPTI: failed to open unit %d err=%d ('%s')\n", unitnum, GetLastError(), dev);
+ write_log (L"SPTI: failed to open unit %d err=%d ('%s')\n", unitnum, GetLastError(), dev);
} else {
uae_u8 inqdata[INQUIRY_SIZE + 1] = { 0 };
checkcapabilities (unitnum);
if (!inquiry (unitnum, di, inqdata)) {
- write_log ("SPTI: inquiry failed unit %d ('%s':%d:%d:%d:%d)\n", unitnum, dev,
+ write_log (L"SPTI: inquiry failed unit %d ('%s':%d:%d:%d:%d)\n", unitnum, dev,
di->bus, di->path, di->target, di->lun);
close_scsi_device (unitnum);
xfree (dev);
return 0;
}
inqdata[INQUIRY_SIZE] = 0;
+ di->name = my_strdup_ansi (inqdata + 8);
if (di->type == INQ_ROMD) {
dev_info[unitnum].mediainserted = mediacheck (unitnum);
- write_log ("SPTI: unit %d opened [%s], %s, '%s'\n", unitnum,
- di->isatapi ? "ATAPI" : "SCSI",
- di->mediainserted ? "media inserted" : "drive empty", inqdata + 8);
+ write_log (L"SPTI: unit %d opened [%s], %s, '%s'\n", unitnum,
+ di->isatapi ? L"ATAPI" : L"SCSI",
+ di->mediainserted ? L"media inserted" : L"drive empty",
+ di->name);
} else {
- write_log ("SPTI: unit %d, type %d, '%s'\n",
- unitnum, di->type, inqdata + 8);
+ write_log (L"SPTI: unit %d, type %d, '%s'\n",
+ unitnum, di->type, di->name);
}
- di->name = my_strdup (inqdata + 8);
di->inquirydata = xmalloc (INQUIRY_SIZE);
memcpy (di->inquirydata, inqdata, INQUIRY_SIZE);
xfree (dev);
return 0;
}
-static int adddrive (char *drvpath, int bus, int pathid, int targetid, int lunid, int scanmode)
+static int adddrive (TCHAR *drvpath, int bus, int pathid, int targetid, int lunid, int scanmode)
{
struct dev_info_spti *di;
int cnt = total_devices, i;
return 0;
for (i = 0; i < total_devices; i++) {
di = &dev_info[i];
- if (!strcmp (drvpath, di->drvpath))
+ if (!_tcscmp (drvpath, di->drvpath))
return 0;
}
- write_log ("SPTI: unit %d '%s' added\n", total_devices, drvpath);
+ write_log (L"SPTI: unit %d '%s' added\n", total_devices, drvpath);
di = &dev_info[total_devices];
di->drvpath = my_strdup (drvpath);
di->type = 0;
if (open_scsi_device (cnt)) {
for (i = 0; i < cnt; i++) {
if (!memcmp (di->inquirydata, dev_info[i].inquirydata, INQUIRY_SIZE) && di->scanmode != dev_info[i].scanmode) {
- write_log ("duplicate device, skipped..\n");
+ write_log (L"duplicate device, skipped..\n");
break;
}
}
if (unitnum >= MAX_TOTAL_DEVICES || dev_info[unitnum].handle == INVALID_HANDLE_VALUE)
return 0;
dispti = &dev_info[unitnum];
- strcpy (di->label, dispti->name);
+ _tcscpy (di->label, dispti->name);
di->bus = 0;
di->target = unitnum;
di->lun = 0;
di->type = dispti->type;
di->id = unitnum + 1;
if (log_scsi) {
- write_log ("MI=%d TP=%d WP=%d CY=%d BK=%d RMB=%d '%s'\n",
+ write_log (L"MI=%d TP=%d WP=%d CY=%d BK=%d RMB=%d '%s'\n",
di->media_inserted, di->type, di->write_protected, di->cylinders, di->bytespersector, di->removable, di->label);
}
return di;
}
-void win32_spti_media_change (char driveletter, int insert)
+void win32_spti_media_change (TCHAR driveletter, int insert)
{
int i, now;
if (dev_info[i].type == INQ_ROMD) {
now = mediacheck (i);
if (now != dev_info[i].mediainserted) {
- write_log ("SPTI: media change %c %d\n", driveletter, insert);
+ write_log (L"SPTI: media change %c %d\n", driveletter, insert);
dev_info[i].mediainserted = now;
scsi_do_disk_change (i + 1, insert);
}
0, 0, 0, 0, 0, 0, 0, 0, check_isatapi, scsi_info, 0
};
-static int getCDROMProperty(int idx, HDEVINFO DevInfo, const GUID *guid)
+static int getCDROMProperty (int idx, HDEVINFO DevInfo, const GUID *guid)
{
SP_DEVICE_INTERFACE_DATA interfaceData;
PSP_DEVICE_INTERFACE_DETAIL_DATA interfaceDetailData = NULL;
}
#define SCSI_INFO_BUFFER_SIZE 0x5000
-static void scanscsi(void)
+static void scanscsi (void)
{
PSCSI_BUS_DATA BusData;
PSCSI_INQUIRY_DATA InquiryData;
SHORT Bus, Luns;
DWORD bytesTransferred;
int idx;
- char DeviceName[256];
+ TCHAR DeviceName[256];
- AdapterInfo = (PSCSI_ADAPTER_BUS_INFO)xmalloc(SCSI_INFO_BUFFER_SIZE) ;
+ AdapterInfo = xmalloc (SCSI_INFO_BUFFER_SIZE) ;
if (AdapterInfo == NULL)
return;
idx = 0;
for (;;) {
- sprintf(DeviceName, "\\\\.\\Scsi%d:", idx++);
+ _stprintf (DeviceName, L"\\\\.\\Scsi%d:", idx++);
h = CreateFile (DeviceName,
GENERIC_READ | GENERIC_WRITE,
0,
if (h == INVALID_HANDLE_VALUE)
return;
- if(!DeviceIoControl(h,
+ if(!DeviceIoControl (h,
IOCTL_SCSI_RESCAN_BUS,
NULL,
0,
0,
&bytesTransferred,
NULL)) {
- write_log ( "Rescan SCSI port %d failed [Error %d]\n", idx - 1, GetLastError());
- CloseHandle(h);
+ write_log (L"Rescan SCSI port %d failed [Error %d]\n", idx - 1, GetLastError());
+ CloseHandle (h);
continue;
}
// Get the SCSI inquiry data for all devices for the given SCSI bus
- status = DeviceIoControl(
+ status = DeviceIoControl (
h,
IOCTL_SCSI_GET_INQUIRY_DATA,
NULL,
NULL);
if (!status) {
- write_log ("Error in IOCTL_SCSI_GET_INQUIRY_DATA\n" );
+ write_log (L"Error in IOCTL_SCSI_GET_INQUIRY_DATA\n" );
CloseHandle (h);
continue;
}
for (Bus = 0; Bus < AdapterInfo->NumberOfBuses; Bus++) {
int luncheck = 0;
BusData = &AdapterInfo->BusData[Bus];
- InquiryData = (PSCSI_INQUIRY_DATA) ( (PUCHAR) AdapterInfo + BusData->InquiryDataOffset );
+ InquiryData = (PSCSI_INQUIRY_DATA) ((PUCHAR)AdapterInfo + BusData->InquiryDataOffset);
for (Luns = 0; Luns < BusData->NumberOfLogicalUnits; Luns++) {
- char label[100];
+ TCHAR label[100];
int type = InquiryData->InquiryData[0] & 0x1f;
Claimed = InquiryData->DeviceClaimed;
- write_log ("SCSI=%d Initiator=%d Path=%d Target=%d LUN=%d Claimed=%s Type=%d\n",
+ write_log (L"SCSI=%d Initiator=%d Path=%d Target=%d LUN=%d Claimed=%s Type=%d\n",
idx - 1,
BusData->InitiatorBusId, InquiryData->PathId, InquiryData->TargetId,
- InquiryData->Lun, Claimed ? "Yes" : "No ", type);
+ InquiryData->Lun, Claimed ? L"Yes" : L"No ", type);
if (Claimed == 0 && !luncheck) {
luncheck = 1;
- sprintf (label, "SCSI(%d):%d:%d:%d:%d", idx - 1, BusData->InitiatorBusId,
+ _stprintf (label, L"SCSI(%d):%d:%d:%d:%d", idx - 1, BusData->InitiatorBusId,
InquiryData->PathId, InquiryData->TargetId, InquiryData->Lun);
adddrive (label, idx - 1, InquiryData->PathId, InquiryData->TargetId, InquiryData->Lun, 3);
}
- InquiryData = (PSCSI_INQUIRY_DATA) ( (PUCHAR) AdapterInfo + InquiryData->NextInquiryDataOffset );
+ InquiryData = (PSCSI_INQUIRY_DATA) ((PUCHAR)AdapterInfo + InquiryData->NextInquiryDataOffset);
} // for Luns
} // for Bus
CloseHandle(h);
&GUID_DEVCLASS_IMAGE,
&GUID_DEVCLASS_TAPEDRIVE,
NULL };
-static const char *scsinames[] = { "Tape", "Scanner", "Changer", NULL };
+static const TCHAR *scsinames[] = { L"Tape", L"Scanner", L"Changer", NULL };
-static int rescan(void)
+static int rescan (void)
{
int idx, idx2;
NULL, NULL, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
if (hDevInfo != INVALID_HANDLE_VALUE) {
for (idx = 0; ; idx++) {
- if (!getCDROMProperty(idx, hDevInfo, guids[idx2]))
+ if (!getCDROMProperty (idx, hDevInfo, guids[idx2]))
break;
}
- SetupDiDestroyDeviceInfoList(hDevInfo);
+ SetupDiDestroyDeviceInfoList (hDevInfo);
}
}
for (idx2 = 0; scsinames[idx2]; idx2++) {
int max = 10;
for (idx = 0; idx < max; idx++) {
- char tmp[100];
+ TCHAR tmp[100];
HANDLE h;
- sprintf (tmp, "\\\\.\\%s%d", scsinames[idx2], idx);
- h = CreateFile(tmp, GENERIC_READ | GENERIC_WRITE,
+ _stprintf (tmp, L"\\\\.\\%s%d", scsinames[idx2], idx);
+ h = CreateFile (tmp, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);
if (h != INVALID_HANDLE_VALUE) {
- adddrive(tmp, -1, -1, -1, -1, 2);
- CloseHandle(h);
+ adddrive (tmp, -1, -1, -1, -1, 2);
+ CloseHandle (h);
if (idx == max - 1)
max++;
}
}
}
if (currprefs.win32_uaescsimode == UAESCSI_SPTISCAN) {
- write_log ("SCSI adapter enumeration..\n");
- scanscsi();
- write_log ("SCSI adapter enumeration ends\n");
+ write_log (L"SCSI adapter enumeration..\n");
+ scanscsi ();
+ write_log (L"SCSI adapter enumeration ends\n");
}
return 1;
}
uae_u32 args2;
int args3;
long args4;
- char buf[MAXGETHOSTSTRUCT];
+ uae_char buf[MAXGETHOSTSTRUCT];
};
struct threadargsw {
int result = 0, i;
SOCKET dummy;
DWORD lasterror;
+ TCHAR *ss;
if (!bsd) {
bsd = calloc (sizeof (struct bsdsockdata), 1);
for (i = 0; i < MAX_GET_THREADS; i++)
threadindextable[i] = i;
}
- if (WSAStartup(MAKEWORD(SOCKVER_MAJOR, SOCKVER_MINOR), &bsd->wsbData)) {
+ if (WSAStartup (MAKEWORD (SOCKVER_MAJOR, SOCKVER_MINOR), &bsd->wsbData)) {
lasterror = WSAGetLastError();
if(lasterror == WSAVERNOTSUPPORTED) {
- char szMessage[MAX_DPATH];
+ TCHAR szMessage[MAX_DPATH];
WIN32GUI_LoadUIString(IDS_WSOCK2NEEDED, szMessage, MAX_DPATH);
gui_message(szMessage);
} else
- write_log ("BSDSOCK: ERROR - Unable to initialize Windows socket layer! Error code: %d\n", lasterror);
+ write_log (L"BSDSOCK: ERROR - Unable to initialize Windows socket layer! Error code: %d\n", lasterror);
return 0;
}
- if (LOBYTE (bsd->wsbData.wVersion) != SOCKVER_MAJOR || HIBYTE (bsd->wsbData.wVersion) != SOCKVER_MINOR) {
- char szMessage[MAX_DPATH];
- WIN32GUI_LoadUIString(IDS_WSOCK2NEEDED, szMessage, MAX_DPATH);
- gui_message(szMessage);
-
- return 0;
+ ss = au (bsd->wsbData.szDescription);
+ write_log (L"BSDSOCK: using %s\n", ss);
+ xfree (ss);
+ // make sure WSP/NSPStartup gets called from within the regular stack
+ // (Windows 95/98 need this)
+ if((dummy = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) != INVALID_SOCKET) {
+ closesocket(dummy);
+ result = 1;
} else {
- write_log ("BSDSOCK: using %s\n", bsd->wsbData.szDescription);
- // make sure WSP/NSPStartup gets called from within the regular stack
- // (Windows 95/98 need this)
- if((dummy = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) != INVALID_SOCKET) {
- closesocket(dummy);
- result = 1;
- } else {
- write_log ("BSDSOCK: ERROR - WSPStartup/NSPStartup failed! Error code: %d\n",
- WSAGetLastError());
- result = 0;
- }
+ write_log (L"BSDSOCK: ERROR - WSPStartup/NSPStartup failed! Error code: %d\n",
+ WSAGetLastError());
+ result = 0;
}
return result;
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
wc.hbrBackground = GetStockObject (BLACK_BRUSH);
wc.lpszMenuName = 0;
- wc.lpszClassName = "SocketFun";
+ wc.lpszClassName = L"SocketFun";
RegisterClass(&wc);
bsd->hSockWnd = CreateWindowEx (0,
- "SocketFun", "WinUAE Socket Window",
+ L"SocketFun", L"WinUAE Socket Window",
WS_POPUP,
0, 0,
1, 1,
NULL, NULL, 0, NULL);
bsd->hSockThread = THREAD(sock_thread, NULL);
if (!bsd->hSockWnd) {
- write_log ("bsdsocket initialization failed\n");
+ write_log (L"bsdsocket initialization failed\n");
deinit_socket_layer();
return 0;
}
bsd->hSockReqHandled = NULL;
DestroyWindow (bsd->hSockWnd);
bsd->hSockWnd = NULL;
- UnregisterClass ("SocketFun", hInst);
+ UnregisterClass (L"SocketFun", hInst);
}
close_selectget_threads ();
WSACleanup();
BOOL b = 1;
if(s) {
- setsockopt(s, SOL_SOCKET, SO_DONTLINGER, (char *)&b, sizeof(b));
+ setsockopt(s, SOL_SOCKET, SO_DONTLINGER, (uae_char*)&b, sizeof(b));
shutdown(s, 1);
closesocket(s);
}
if (sb->sb_errno >= 1001 && sb->sb_errno <= 1005) {
bsdsocklib_setherrno(sb, sb->sb_errno - 1000);
} else if (sb->sb_errno == 55) { // ENOBUFS
- write_log ("BSDSOCK: ERROR - Buffer overflow - %d bytes requested\n",
+ write_log (L"BSDSOCK: ERROR - Buffer overflow - %d bytes requested\n",
WSAGETASYNCBUFLEN(lParam));
}
} else {
unlocksigqueue();
bsdsocklib_seterrno(sb, 12); // ENOMEM
- write_log ("BSDSOCK: ERROR - Async operation completion table overflow\n");
+ write_log (L"BSDSOCK: ERROR - Async operation completion table overflow\n");
return 0;
}
static void prepamigaaddr(struct sockaddr *realpt, int len)
{
// little endian address family value to the byte sin_family member
- ((char *)realpt)[1] = *((char *)realpt);
+ ((TCHAR *)realpt)[1] = *((TCHAR *)realpt);
// set size of address
- *((char *)realpt) = len;
+ *((TCHAR *)realpt) = len;
}
{
SOCKET s1,s2;
- TRACE(("dup2socket(%d,%d) -> ",fd1,fd2));
+ BSDTRACE((L"dup2socket(%d,%d) -> ",fd1,fd2));
fd1++;
s1 = getsock(sb, fd1);
if (s1 != INVALID_SOCKET) {
if (fd2 != -1) {
if ((unsigned int) (fd2) >= (unsigned int) sb->dtablesize) {
- TRACE (("Bad file descriptor (%d)\n", fd2));
+ BSDTRACE (("Bad file descriptor (%d)\n", fd2));
bsdsocklib_seterrno (sb, 9); /* EBADF */
}
fd2++;
closesocket(s2);
}
setsd(sb,fd2,s1);
- TRACE(("0\n"));
+ BSDTRACE((L"0\n"));
return 0;
} else {
fd2 = getsd(sb, 1);
setsd(sb,fd2,s1);
- TRACE(("%d\n",fd2));
+ BSDTRACE((L"%d\n",fd2));
return (fd2 - 1);
}
}
- TRACE(("-1\n"));
+ BSDTRACE((L"-1\n"));
return -1;
}
SOCKET s;
unsigned long nonblocking = 1;
- TRACE(("socket(%s,%s,%d) -> ",af == AF_INET ? "AF_INET" : "AF_other",type == SOCK_STREAM ? "SOCK_STREAM" : type == SOCK_DGRAM ? "SOCK_DGRAM " : "SOCK_RAW",protocol));
+ BSDTRACE((L"socket(%s,%s,%d) -> ",af == AF_INET ? "AF_INET" : "AF_other",type == SOCK_STREAM ? "SOCK_STREAM" : type == SOCK_DGRAM ? "SOCK_DGRAM " : "SOCK_RAW",protocol));
if ((s = socket(af,type,protocol)) == INVALID_SOCKET) {
SETERRNO;
- TRACE(("failed (%d)\n",sb->sb_errno));
+ BSDTRACE((L"failed (%d)\n",sb->sb_errno));
return -1;
} else
sd = getsd(sb,(int)s);
sb->ftable[sd-1] = SF_BLOCKING;
ioctlsocket(s,FIONBIO,&nonblocking);
- TRACE(("%d\n",sd));
+ BSDTRACE((L"%d\n",sd));
if (type == SOCK_RAW) {
if (protocol==IPPROTO_UDP) {
uae_u32 host_bind(SB, uae_u32 sd, uae_u32 name, uae_u32 namelen)
{
- char buf[MAXADDRLEN];
+ TCHAR buf[MAXADDRLEN];
uae_u32 success = 0;
SOCKET s;
sd++;
- TRACE(("bind(%d,0x%lx,%d) -> ",sd, name, namelen));
+ BSDTRACE((L"bind(%d,0x%lx,%d) -> ",sd, name, namelen));
s = getsock(sb, sd);
if (s != INVALID_SOCKET) {
if (namelen <= sizeof buf) {
- if (!addr_valid("host_bind", name, namelen))
+ if (!addr_valid (L"host_bind", name, namelen))
return 0;
memcpy(buf, get_real_address (name), namelen);
if ((success = bind(s,(struct sockaddr *)buf, namelen)) != 0) {
SETERRNO;
- TRACE(("failed (%d)\n",sb->sb_errno));
+ BSDTRACE((L"failed (%d)\n",sb->sb_errno));
} else
- TRACE(("OK\n"));
+ BSDTRACE((L"OK\n"));
} else
- write_log ("BSDSOCK: ERROR - Excessive namelen (%d) in bind()!\n", namelen);
+ write_log (L"BSDSOCK: ERROR - Excessive namelen (%d) in bind()!\n", namelen);
}
return success;
uae_u32 success = -1;
sd++;
- TRACE(("listen(%d,%d) -> ", sd, backlog));
+ BSDTRACE((L"listen(%d,%d) -> ", sd, backlog));
s = getsock(sb, sd);
if (s != INVALID_SOCKET) {
if ((success = listen(s,backlog)) != 0) {
SETERRNO;
- TRACE(("failed (%d)\n",sb->sb_errno));
+ BSDTRACE((L"failed (%d)\n",sb->sb_errno));
} else
- TRACE(("OK\n"));
+ BSDTRACE((L"OK\n"));
}
return success;
}
sd++;
if (name != 0) {
- if (!addr_valid("host_accept1", name, sizeof(struct sockaddr)) || !addr_valid("host_accept2", namelen, 4))
+ if (!addr_valid (L"host_accept1", name, sizeof(struct sockaddr)) || !addr_valid (L"host_accept2", namelen, 4))
return;
rp_nameuae = rp_name = (struct sockaddr *)get_real_address (name);
hlenuae = hlen = get_long (namelen);
rp_name = &sockaddr;
hlen = sizeof(sockaddr);
}
- TRACE(("accept(%d,%d,%d) -> ",sd,name,hlenuae));
+ BSDTRACE((L"accept(%d,%d,%d) -> ",sd,name,hlenuae));
s = getsock(sb, (int)sd);
}
if (sb->eintr) {
- TRACE(("[interrupted]\n"));
+ BSDTRACE((L"[interrupted]\n"));
ENDBLOCKING;
return;
}
SETERRNO;
if (sb->sb_errno == WSAEWOULDBLOCK - WSABASEERR)
- write_log ("BSDSOCK: ERRRO - accept() would block despite FD_ACCEPT message\n");
+ write_log (L"BSDSOCK: ERRRO - accept() would block despite FD_ACCEPT message\n");
}
}
}
if (s2 == INVALID_SOCKET) {
sb->resultval = -1;
- TRACE(("failed (%d)\n",sb->sb_errno));
+ BSDTRACE((L"failed (%d)\n",sb->sb_errno));
} else {
sb->resultval = getsd(sb, s2);
sb->ftable[sb->resultval - 1] = sb->ftable[sd - 1]; // new socket inherits the old socket's properties
}
}
}
- TRACE(("%d/%d\n", sb->resultval, hlen));
+ BSDTRACE((L"%d/%d\n", sb->resultval, hlen));
}
ENDBLOCKING;
{
struct sendto_params
{
- char *buf;
- char *realpt;
+ uae_char *buf;
+ uae_char *realpt;
uae_u32 sd;
uae_u32 msg;
uae_u32 len;
} sendto_s;
struct recvfrom_params
{
- char *realpt;
+ uae_char *realpt;
uae_u32 addr;
uae_u32 len;
uae_u32 flags;
} recvfrom_s;
struct connect_params
{
- char *buf;
+ uae_char *buf;
uae_u32 namelen;
} connect_s;
struct abort_params
break;
case last_req:
default:
- write_log ( "BSDSOCK: Invalid sock-thread request!\n" );
+ write_log (L"BSDSOCK: Invalid sock-thread request!\n");
handled = FALSE;
break;
}
}
}
}
- write_log ( "BSDSOCK: We have exited our sock_thread()\n" );
+ write_log (L"BSDSOCK: We have exited our sock_thread()\n");
THREADEND(result);
return result;
}
SOCKET s;
int success = 0;
unsigned int wMsg;
- char buf[MAXADDRLEN];
+ uae_char buf[MAXADDRLEN];
sd++;
- TRACE(("connect(%d,0x%lx,%d) -> ", sd, name, namelen));
+ BSDTRACE((L"connect(%d,0x%lx,%d) -> ", sd, name, namelen));
- if (!addr_valid("host_connect", name, namelen))
+ if (!addr_valid (L"host_connect", name, namelen))
return;
s = getsock(sb,(int)sd);
}
}
} else
- write_log ("BSDSOCK: WARNING - Excessive namelen (%d) in connect()!\n", namelen);
+ write_log (L"BSDSOCK: WARNING - Excessive namelen (%d) in connect()!\n", namelen);
}
- TRACE(("%d\n",sb->sb_errno));
+ BSDTRACE((L"%d\n",sb->sb_errno));
}
-void host_sendto(TrapContext *context, SB, uae_u32 sd, uae_u32 msg, uae_u32 len, uae_u32 flags, uae_u32 to, uae_u32 tolen)
+void host_sendto (TrapContext *context, SB, uae_u32 sd, uae_u32 msg, uae_u32 len, uae_u32 flags, uae_u32 to, uae_u32 tolen)
{
SOCKET s;
- char *realpt;
+ uae_char *realpt;
unsigned int wMsg;
- char buf[MAXADDRLEN];
+ uae_char buf[MAXADDRLEN];
int iCut;
#ifdef TRACING_ENABLED
if (to)
- TRACE(("sendto(%d,0x%lx,%d,0x%lx,0x%lx,%d) -> ",sd,msg,len,flags,to,tolen));
+ BSDTRACE((L"sendto(%d,0x%lx,%d,0x%lx,0x%lx,%d) -> ",sd,msg,len,flags,to,tolen));
else
- TRACE(("send(%d,0x%lx,%d,%d) -> ",sd,msg,len,flags));
+ BSDTRACE((L"send(%d,0x%lx,%d,%d) -> ",sd,msg,len,flags));
#endif
sd++;
s = getsock(sb,sd);
if (s != INVALID_SOCKET) {
- if (!addr_valid("host_sendto1", msg, 4))
+ if (!addr_valid (L"host_sendto1", msg, 4))
return;
realpt = get_real_address (msg);
if (to) {
if (tolen > sizeof buf) {
- write_log ("BSDSOCK: WARNING - Target address in sendto() too large (%d)!\n", tolen);
+ write_log (L"BSDSOCK: WARNING - Target address in sendto() too large (%d)!\n", tolen);
} else {
- if (!addr_valid("host_sendto2", to, tolen))
+ if (!addr_valid (L"host_sendto2", to, tolen))
return;
memcpy(buf, get_real_address (to), tolen);
// some Amiga software sets this field to bogus values
}
if (sb->eintr) {
- TRACE(("[interrupted]\n"));
+ BSDTRACE((L"[interrupted]\n"));
return;
}
} else
#ifdef TRACING_ENABLED
if (sb->resultval == -1)
- TRACE(("failed (%d)\n",sb->sb_errno));
+ BSDTRACE((L"failed (%d)\n",sb->sb_errno));
else
- TRACE(("%d\n",sb->resultval));
+ BSDTRACE((L"%d\n",sb->resultval));
#endif
}
void host_recvfrom(TrapContext *context, SB, uae_u32 sd, uae_u32 msg, uae_u32 len, uae_u32 flags, uae_u32 addr, uae_u32 addrlen)
{
SOCKET s;
- char *realpt;
+ uae_char *realpt;
struct sockaddr *rp_addr = NULL;
int hlen;
unsigned int wMsg;
#ifdef TRACING_ENABLED
if (addr)
- TRACE(("recvfrom(%d,0x%lx,%d,0x%lx,0x%lx,%d) -> ",sd,msg,len,flags,addr,get_long (addrlen)));
+ BSDTRACE((L"recvfrom(%d,0x%lx,%d,0x%lx,0x%lx,%d) -> ",sd,msg,len,flags,addr,get_long (addrlen)));
else
- TRACE(("recv(%d,0x%lx,%d,0x%lx) -> ",sd,msg,len,flags));
+ BSDTRACE((L"recv(%d,0x%lx,%d,0x%lx) -> ",sd,msg,len,flags));
#endif
sd++;
s = getsock(sb,sd);
if (s != INVALID_SOCKET) {
- if (!addr_valid("host_recvfrom1", msg, 4))
+ if (!addr_valid (L"host_recvfrom1", msg, 4))
return;
realpt = get_real_address (msg);
if (addr) {
- if (!addr_valid("host_recvfrom1", addrlen, 4))
+ if (!addr_valid (L"host_recvfrom1", addrlen, 4))
return;
hlen = get_long (addrlen);
- if (!addr_valid("host_recvfrom2", addr, hlen))
+ if (!addr_valid (L"host_recvfrom2", addr, hlen))
return;
rp_addr = (struct sockaddr *)get_real_address (addr);
}
}
if (sb->eintr) {
- TRACE(("[interrupted]\n"));
+ BSDTRACE((L"[interrupted]\n"));
return;
}
} else
#ifdef TRACING_ENABLED
if (sb->resultval == -1)
- TRACE(("failed (%d)\n",sb->sb_errno));
+ BSDTRACE((L"failed (%d)\n",sb->sb_errno));
else
- TRACE(("%d\n",sb->resultval));
+ BSDTRACE((L"%d\n",sb->resultval));
#endif
}
{
SOCKET s;
- TRACE(("shutdown(%d,%d) -> ",sd,how));
+ BSDTRACE((L"shutdown(%d,%d) -> ",sd,how));
sd++;
s = getsock(sb,sd);
if (s != INVALID_SOCKET) {
if (shutdown(s,how)) {
SETERRNO;
- TRACE(("failed (%d)\n",sb->sb_errno));
+ BSDTRACE((L"failed (%d)\n",sb->sb_errno));
} else {
- TRACE(("OK\n"));
+ BSDTRACE((L"OK\n"));
return 0;
}
}
void host_setsockopt(SB, uae_u32 sd, uae_u32 level, uae_u32 optname, uae_u32 optval, uae_u32 len)
{
SOCKET s;
- char buf[MAXADDRLEN];
+ uae_char buf[MAXADDRLEN];
- TRACE(("setsockopt(%d,%d,0x%lx,0x%lx,%d) -> ",sd,(short)level,optname,optval,len));
+ BSDTRACE((L"setsockopt(%d,%d,0x%lx,0x%lx,%d) -> ",sd,(short)level,optname,optval,len));
sd++;
s = getsock(sb,sd);
if (s != INVALID_SOCKET) {
if (len > sizeof buf) {
- write_log ("BSDSOCK: WARNING - Excessive optlen in setsockopt() (%d)\n", len);
+ write_log (L"BSDSOCK: WARNING - Excessive optlen in setsockopt() (%d)\n", len);
len = sizeof buf;
}
if (level == IPPROTO_IP && optname == 2) { // IP_HDRINCL emulated by icmp.dll
else if (len == 2)
*(short *)buf = get_word (optval);
else
- write_log ("BSDSOCK: ERROR - Unknown optlen (%d) in setsockopt(%d,%d)\n", len, level, optname);
+ write_log (L"BSDSOCK: ERROR - Unknown optlen (%d) in setsockopt(%d,%d)\n", len, level, optname);
}
// handle SO_EVENTMASK
sb->resultval = setsockopt(s,level,optname,buf,len);
if (!sb->resultval) {
- TRACE(("OK\n"));
+ BSDTRACE((L"OK\n"));
return;
} else
SETERRNO;
- TRACE(("failed (%d)\n",sb->sb_errno));
+ BSDTRACE((L"failed (%d)\n",sb->sb_errno));
}
}
uae_u32 host_getsockopt(SB, uae_u32 sd, uae_u32 level, uae_u32 optname, uae_u32 optval, uae_u32 optlen)
{
SOCKET s;
- char buf[MAXADDRLEN];
+ uae_char buf[MAXADDRLEN];
int len = sizeof(buf);
- TRACE(("getsockopt(%d,%d,0x%lx,0x%lx,0x%lx) -> ",sd,(short)level,optname,optval,optlen));
+ BSDTRACE((L"getsockopt(%d,%d,0x%lx,0x%lx,0x%lx) -> ",sd,(short)level,optname,optval,optlen));
sd++;
s = getsock(sb,sd);
else if (len == 2)
put_word (optval,*(short *)buf);
else
- write_log ("BSDSOCK: ERROR - Unknown optlen (%d) in setsockopt(%d,%d)\n", len, level, optname);
+ write_log (L"BSDSOCK: ERROR - Unknown optlen (%d) in setsockopt(%d,%d)\n", len, level, optname);
}
// put_long (optlen,len); // some programs pass the actual length instead of a pointer to the length, so...
- TRACE(("OK (%d,%d)\n",len,*(long *)buf));
+ BSDTRACE((L"OK (%d,%d)\n",len,*(long *)buf));
return 0;
} else {
SETERRNO;
- TRACE(("failed (%d)\n",sb->sb_errno));
+ BSDTRACE((L"failed (%d)\n",sb->sb_errno));
}
}
struct sockaddr *rp_name;
sd++;
- if (!addr_valid("host_getsockname1", namelen, 4))
+ if (!addr_valid (L"host_getsockname1", namelen, 4))
return -1;
len = get_long (namelen);
- TRACE(("getsockname(%d,0x%lx,%d) -> ",sd,name,len));
+ BSDTRACE((L"getsockname(%d,0x%lx,%d) -> ",sd,name,len));
s = getsock(sb,sd);
if (s != INVALID_SOCKET) {
- if (!addr_valid("host_getsockname2", name, len))
+ if (!addr_valid (L"host_getsockname2", name, len))
return -1;
rp_name = (struct sockaddr *)get_real_address (name);
if (getsockname(s,rp_name,&len)) {
SETERRNO;
- TRACE(("failed (%d)\n",sb->sb_errno));
+ BSDTRACE((L"failed (%d)\n",sb->sb_errno));
} else {
- TRACE(("%d\n",len));
+ BSDTRACE((L"%d\n",len));
prepamigaaddr(rp_name,len);
put_long (namelen,len);
return 0;
struct sockaddr *rp_name;
sd++;
- if (!addr_valid("host_getpeername1", namelen, 4))
+ if (!addr_valid (L"host_getpeername1", namelen, 4))
return -1;
len = get_long (namelen);
- TRACE(("getpeername(%d,0x%lx,%d) -> ",sd,name,len));
+ BSDTRACE((L"getpeername(%d,0x%lx,%d) -> ",sd,name,len));
s = getsock(sb,sd);
if (s != INVALID_SOCKET) {
- if (!addr_valid("host_getpeername2", name, len))
+ if (!addr_valid (L"host_getpeername2", name, len))
return -1;
rp_name = (struct sockaddr *)get_real_address (name);
if (getpeername(s,rp_name,&len)) {
SETERRNO;
- TRACE(("failed (%d)\n",sb->sb_errno));
+ BSDTRACE((L"failed (%d)\n",sb->sb_errno));
} else {
- TRACE(("%d\n",len));
+ BSDTRACE((L"%d\n",len));
prepamigaaddr(rp_name,len);
put_long (namelen,len);
return 0;
uae_u32 data;
int success = SOCKET_ERROR;
- TRACE(("IoctlSocket(%d,0x%lx,0x%lx) ",sd,request,arg));
+ BSDTRACE((L"IoctlSocket(%d,0x%lx,0x%lx) ",sd,request,arg));
sd++;
s = getsock(sb,sd);
success = 0;
break;
case FIONBIO:
- TRACE(("[FIONBIO] -> "));
+ BSDTRACE((L"[FIONBIO] -> "));
if (get_long (arg)) {
- TRACE(("nonblocking\n"));
+ BSDTRACE((L"nonblocking\n"));
sb->ftable[sd-1] &= ~SF_BLOCKING;
} else {
- TRACE(("blocking\n"));
+ BSDTRACE((L"blocking\n"));
sb->ftable[sd-1] |= SF_BLOCKING;
}
success = 0;
break;
case FIONREAD:
ioctlsocket(s,request,(u_long *)&data);
- TRACE(("[FIONREAD] -> %d\n",data));
+ BSDTRACE((L"[FIONREAD] -> %d\n",data));
put_long (arg,data);
success = 0;
break;
if (get_long (arg)) {
sb->ftable[sd-1] |= REP_ALL;
- TRACE(("[FIOASYNC] -> enabled\n"));
+ BSDTRACE((L"[FIOASYNC] -> enabled\n"));
if (sb->mtable[sd-1] || (sb->mtable[sd-1] = allocasyncmsg(sb,sd,s))) {
WSAAsyncSelect(s,hWndSelector ? hAmigaWnd : bsd-> hSockWnd, sb->mtable[sd-1],
FD_ACCEPT | FD_CONNECT | FD_OOB | FD_READ | FD_WRITE | FD_CLOSE);
}
}
else
- write_log (("BSDSOCK: WARNING - FIOASYNC disabling unsupported.\n"));
+ write_log (L"BSDSOCK: WARNING - FIOASYNC disabling unsupported.\n");
success = -1;
break;
default:
- write_log ("BSDSOCK: WARNING - Unknown IoctlSocket request: 0x%08lx\n", request);
+ write_log (L"BSDSOCK: WARNING - Unknown IoctlSocket request: 0x%08lx\n", request);
bsdsocklib_seterrno(sb, 22); // EINVAL
break;
}
unsigned int wMsg;
SOCKET s;
- TRACE(("CloseSocket(%d) -> ",sd));
+ BSDTRACE((L"CloseSocket(%d) -> ",sd));
sd++;
s = getsock(sb,sd);
shutdown(s,1);
if (!closesocket(s)) {
releasesock(sb,sd);
- TRACE(("OK\n"));
+ BSDTRACE((L"OK\n"));
return 0;
}
cancelasyncmsg(context, wMsg);
if (sb->eintr) {
- TRACE(("[interrupted]\n"));
+ BSDTRACE((L"[interrupted]\n"));
break;
}
} else
ENDBLOCKING;
}
- TRACE(("failed (%d)\n",sb->sb_errno));
+ BSDTRACE((L"failed (%d)\n",sb->sb_errno));
return -1;
}
}
if (nfds > sb->dtablesize) {
- write_log ("BSDSOCK: ERROR - select()ing more sockets (%d) than socket descriptors available (%d)!\n", nfds, sb->dtablesize);
+ write_log (L"BSDSOCK: ERROR - select()ing more sockets (%d) than socket descriptors available (%d)!\n", nfds, sb->dtablesize);
nfds = sb->dtablesize;
}
fd_set_win->fd_array[fd_set_win->fd_count++] = s;
if (fd_set_win->fd_count >= FD_SETSIZE) {
- write_log ("BSDSOCK: ERROR - select()ing more sockets (%d) than the hard-coded fd_set limit (%d) - please report\n", nfds, FD_SETSIZE);
+ write_log (L"BSDSOCK: ERROR - select()ing more sockets (%d) than the hard-coded fd_set limit (%d) - please report\n", nfds, FD_SETSIZE);
return;
}
}
if (timeout) {
tv.tv_sec = get_long (timeout);
tv.tv_usec = get_long (timeout+4);
- TRACE(("(timeout: %d.%06d) ",tv.tv_sec,tv.tv_usec));
+ BSDTRACE((L"(timeout: %d.%06d) ",tv.tv_sec,tv.tv_usec));
}
- TRACE(("-> "));
+ BSDTRACE((L"-> "));
resultval = select(nfds+1, &readsocks, writefds ? &writesocks : NULL,
exceptfds ? &exceptsocks : NULL, timeout ? &tv : 0);
}
if (sb->resultval == SOCKET_ERROR) {
SETERRNO;
- TRACE(("failed (%d) - ",sb->sb_errno));
+ BSDTRACE((L"failed (%d) - ",sb->sb_errno));
if (readfds)
fd_zero(readfds,nfds);
if (writefds)
SetEvent(sb->hEvent);
}
}
- write_log ("BSDSOCK: thread_WaitSelect2 terminated\n");
+ write_log (L"BSDSOCK: thread_WaitSelect2 terminated\n");
THREADEND(result);
return result;
}
wssigs = sigmp ? get_long (sigmp) : 0;
- TRACE(("WaitSelect(%d,0x%lx,0x%lx,0x%lx,0x%lx,0x%lx) ",
+ BSDTRACE((L"WaitSelect(%d,0x%lx,0x%lx,0x%lx,0x%lx,0x%lx) ",
nfds, readfds, writefds, exceptfds, timeout, wssigs));
if (!readfds && !writefds && !exceptfds && !timeout && !wssigs) {
sb->resultval = 0;
- TRACE(("-> [ignored]\n"));
+ BSDTRACE((L"-> [ignored]\n"));
return;
}
if (wssigs) {
sigs = CallLib (context, get_long (4),-0x132) & wssigs; // SetSignal()
if (sigs) {
- TRACE(("-> [preempted by signals 0x%08lx]\n",sigs & wssigs));
+ BSDTRACE((L"-> [preempted by signals 0x%08lx]\n",sigs & wssigs));
put_long (sigmp,sigs & wssigs);
// Check for zero address -> otherwise WinUAE crashes
if (readfds)
bsd->hThreads[i] = THREAD(thread_WaitSelect, &threadindextable[i]);
if (bsd->hEvents[i] == NULL || bsd->hThreads[i] == NULL) {
bsd->hThreads[i] = 0;
- write_log ("BSDSOCK: ERROR - Thread/Event creation failed - error code: %d\n",
+ write_log (L"BSDSOCK: ERROR - Thread/Event creation failed - error code: %d\n",
GetLastError());
bsdsocklib_seterrno(sb,12); // ENOMEM
sb->resultval = -1;
}
if (i >= MAX_SELECT_THREADS)
- write_log ("BSDSOCK: ERROR - Too many select()s\n");
+ write_log (L"BSDSOCK: ERROR - Too many select()s\n");
else {
SOCKET newsock = INVALID_SOCKET;
*/
if (sb->needAbort) {
if ((newsock = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) == INVALID_SOCKET)
- write_log ("BSDSOCK: ERROR - Cannot create socket: %d\n", WSAGetLastError());
+ write_log (L"BSDSOCK: ERROR - Cannot create socket: %d\n", WSAGetLastError());
shutdown(sb->sockAbort,1);
if (newsock != sb->sockAbort) {
shutdown(sb->sockAbort, 1);
put_long (sigmp,sigs & wssigs);
if (sigs & sb->eintrsigs) {
- TRACE(("[interrupted]\n"));
+ BSDTRACE((L"[interrupted]\n"));
sb->resultval = -1;
bsdsocklib_seterrno(sb,4); // EINTR
} else if (sigs & wssigs) {
- TRACE(("[interrupted by signals 0x%08lx]\n",sigs & wssigs));
+ BSDTRACE((L"[interrupted by signals 0x%08lx]\n",sigs & wssigs));
if (readfds) fd_zero(readfds,nfds);
if (writefds) fd_zero(writefds,nfds);
if (exceptfds) fd_zero(exceptfds,nfds);
sb->resultval = 0;
}
if (sb->resultval >= 0) {
- TRACE(("%d\n",sb->resultval));
+ BSDTRACE((L"%d\n",sb->resultval));
} else {
- TRACE(("%d errno %d\n",sb->resultval,sb->sb_errno));
+ BSDTRACE((L"%d errno %d\n",sb->resultval,sb->sb_errno));
}
} else
- TRACE(("%d\n",sb->resultval));
+ BSDTRACE((L"%d\n",sb->resultval));
}
}
uae_u32 host_Inet_NtoA(TrapContext *context, SB, uae_u32 in)
{
- char *addr;
+ uae_char *addr;
struct in_addr ina;
uae_u32 scratchbuf;
*(uae_u32 *)&ina = htonl(in);
- TRACE(("Inet_NtoA(%lx) -> ",in));
+ BSDTRACE((L"Inet_NtoA(%lx) -> ",in));
if ((addr = inet_ntoa(ina)) != NULL) {
scratchbuf = m68k_areg (&context->regs,6) + offsetof(struct UAEBSDBase,scratchbuf);
strncpyha(scratchbuf,addr,SCRATCHBUFSIZE);
- TRACE(("%s\n",addr));
+ BSDTRACE((L"%s\n",addr));
return scratchbuf;
} else
SETERRNO;
- TRACE(("failed (%d)\n",sb->sb_errno));
+ BSDTRACE((L"failed (%d)\n",sb->sb_errno));
return 0;
}
uae_u32 host_inet_addr(uae_u32 cp)
{
uae_u32 addr;
- char *cp_rp;
+ uae_char *cp_rp;
- if (!addr_valid("host_inet_addr", cp, 4))
+ if (!addr_valid (L"host_inet_addr", cp, 4))
return 0;
cp_rp = get_real_address (cp);
addr = htonl(inet_addr(cp_rp));
- TRACE(("inet_addr(%s) -> 0x%08lx\n",cp_rp,addr));
+ BSDTRACE((L"inet_addr(%s) -> 0x%08lx\n",cp_rp,addr));
return addr;
}
return bReturn;
}
-static unsigned int thread_get2(void *indexp)
+static unsigned int thread_get2 (void *indexp)
{
int index = *((int*)indexp);
unsigned int result = 0;
uae_u32 name;
uae_u32 namelen;
long addrtype;
- char *name_rp;
+ uae_char *name_rp;
SB;
while (bsd->hGetEvents[index]) {
name = args->args2;
namelen = args->args3;
addrtype = args->args4;
- name_rp = "";
- if (addr_valid("thread_get1", name, 1))
+ if (addr_valid (L"thread_get1", name, 1))
name_rp = get_real_address (name);
+ else
+ name_rp = "";
- if (strchr(name_rp, '.') == 0 || CheckOnline(sb) == TRUE) {
+ if (strchr (name_rp, '.') == 0 || CheckOnline(sb) == TRUE) {
// Local Address or Internet Online ?
if (addrtype == -1) {
- host = gethostbyname(name_rp);
+ host = gethostbyname (name_rp);
} else {
- host = gethostbyaddr(name_rp, namelen, addrtype);
+ host = gethostbyaddr (name_rp, namelen, addrtype);
}
if (bsd->threadGetargs_inuse[index] != -1) {
// No CTRL-C Signal
if (host == 0) {
// Error occured
SETERRNO;
- TRACE(("failed (%d) - ", sb->sb_errno));
+ BSDTRACE((L"failed (%d) - ", sb->sb_errno));
} else {
bsdsocklib_seterrno(sb, 0);
memcpy(args->buf, host, sizeof(HOSTENT));
struct protoent *proto;
name = args->args2;
- name_rp = "";
- if (addr_valid("thread_get2", name, 1))
+ if (addr_valid (L"thread_get2", name, 1))
name_rp = get_real_address (name);
+ else
+ name_rp = "";
proto = getprotobyname (name_rp);
if (bsd->threadGetargs_inuse[index] != -1) { // No CTRL-C Signal
if (proto == 0) {
// Error occured
SETERRNO;
- TRACE(("failed (%d) - ", sb->sb_errno));
+ BSDTRACE((L"failed (%d) - ", sb->sb_errno));
} else {
bsdsocklib_seterrno(sb, 0);
memcpy(args->buf, proto, sizeof(struct protoent));
uae_u32 nameport;
uae_u32 proto;
uae_u32 type;
- char *proto_rp = 0;
+ uae_char *proto_rp = 0;
struct servent *serv;
nameport = args->args2;
type = args->args4;
if (proto) {
- if (addr_valid("thread_get3", proto, 1))
+ if (addr_valid (L"thread_get3", proto, 1))
proto_rp = get_real_address (proto);
}
if (type) {
serv = getservbyport(nameport, proto_rp);
} else {
- if (addr_valid("thread_get4", nameport, 1))
+ if (addr_valid (L"thread_get4", nameport, 1))
name_rp = get_real_address (nameport);
serv = getservbyname(name_rp, proto_rp);
}
if (serv == 0) {
// Error occured
SETERRNO;
- TRACE(("failed (%d) - ", sb->sb_errno));
+ BSDTRACE((L"failed (%d) - ", sb->sb_errno));
} else {
bsdsocklib_seterrno(sb, 0);
memcpy(args->buf, serv, sizeof(struct servent));
}
}
- TRACE(("-> "));
+ BSDTRACE((L"-> "));
if (bsd->threadGetargs_inuse[index] != -1)
SETSIGNAL;
}
}
- write_log ("BSDSOCK: thread_get2 terminated\n");
+ write_log (L"BSDSOCK: thread_get2 terminated\n");
THREADEND(result);
return result;
}
bsd->hGetThreads[i] = THREAD(thread_get, &threadindextable[i]);
if (bsd->hGetEvents[i] == NULL || bsd->hGetThreads[i] == NULL) {
bsd->hGetThreads[i] = NULL;
- write_log ("BSDSOCK: ERROR - Thread/Event creation failed - error code: %d\n",
+ write_log (L"BSDSOCK: ERROR - Thread/Event creation failed - error code: %d\n",
GetLastError());
bsdsocklib_seterrno(sb, 12); // ENOMEM
sb->resultval = -1;
}
if (i >= MAX_GET_THREADS) {
- write_log ("BSDSOCK: ERROR - Too many gethostbyname()s\n");
+ write_log (L"BSDSOCK: ERROR - Too many gethostbyname()s\n");
bsdsocklib_seterrno(sb, 12); // ENOMEM
sb->resultval = -1;
return 0;
return &bsd->threadGetargs[i];
}
-void host_gethostbynameaddr(TrapContext *context, SB, uae_u32 name, uae_u32 namelen, long addrtype)
+void host_gethostbynameaddr (TrapContext *context, SB, uae_u32 name, uae_u32 namelen, long addrtype)
{
HOSTENT *h;
int size, numaliases = 0, numaddr = 0;
uae_u32 aptr;
- char *name_rp;
+ uae_char *name_rp;
int i;
struct threadargs args;
volatile struct threadargs *argsp;
uae_u32 addr;
uae_u32 *addr_list[2];
- volatile char *buf;
+ volatile uae_char *buf;
unsigned int wMsg = 0;
-// char on = 1;
+// TCHAR on = 1;
// InternetSetOption(0,INTERNET_OPTION_SETTINGS_CHANGED,&on,strlen(&on));
// Do not use: Causes locks with some machines
buf = argsp->buf;
name_rp = "";
- if (addr_valid("host_gethostbynameaddr", name, 1))
+ if (addr_valid (L"host_gethostbynameaddr", name, 1))
name_rp = get_real_address (name);
if (addrtype == -1) {
- TRACE(("gethostbyname(%s) -> ",name_rp));
+ BSDTRACE((L"gethostbyname(%s) -> ",name_rp));
// workaround for numeric host "names"
if ((addr = inet_addr(name_rp)) != INADDR_NONE) {
((HOSTENT *)buf)->h_aliases = NULL;
((HOSTENT *)buf)->h_addrtype = AF_INET;
((HOSTENT *)buf)->h_length = 4;
- ((HOSTENT *)buf)->h_addr_list = (char **)&addr_list;
+ ((HOSTENT *)buf)->h_addr_list = (uae_char**)&addr_list;
addr_list[0] = &addr;
addr_list[1] = NULL;
goto kludge;
}
} else {
- TRACE(("gethostbyaddr(0x%lx,0x%lx,%ld) -> ",name,namelen,addrtype));
+ BSDTRACE((L"gethostbyaddr(0x%lx,0x%lx,%ld) -> ",name,namelen,addrtype));
}
argsp->sb = sb;
sb->hostent = uae_AllocMem(context, size, 0);
if (!sb->hostent) {
- write_log ("BSDSOCK: WARNING - gethostby%s() ran out of Amiga memory "
- "(couldn't allocate %ld bytes) while returning result of lookup for '%s'\n",
+ write_log (L"BSDSOCK: WARNING - gethostby%s() ran out of Amiga memory "
+ L"(couldn't allocate %ld bytes) while returning result of lookup for '%s'\n",
addrtype == -1 ? "name" : "addr", size, name_rp);
bsdsocklib_seterrno(sb, 12); // ENOMEM
return;
put_long (sb->hostent + 16, sb->hostent + 24 + numaliases * 4);
for (i = 0; i < numaliases; i++)
- put_long (sb->hostent + 20 + i * 4, addstr(&aptr, h->h_aliases[i]));
+ put_long (sb->hostent + 20 + i * 4, addstr_ansi (&aptr, h->h_aliases[i]));
put_long (sb->hostent + 20 + numaliases * 4, 0);
for (i = 0; i < numaddr; i++)
- put_long (sb->hostent + 24 + (numaliases + i) * 4, addmem(&aptr, h->h_addr_list[i], h->h_length));
+ put_long (sb->hostent + 24 + (numaliases + i) * 4, addmem (&aptr, h->h_addr_list[i], h->h_length));
put_long (sb->hostent + 24 + numaliases * 4 + numaddr * 4, 0);
put_long (sb->hostent, aptr);
- addstr(&aptr, h->h_name);
+ addstr_ansi (&aptr, h->h_name);
- TRACE(("OK (%s)\n", h->h_name));
+ BSDTRACE((L"OK (%s)\n", h->h_name));
bsdsocklib_seterrno(sb, 0);
} else {
- TRACE(("failed (%d/%d)\n", sb->sb_errno, sb->sb_herrno));
+ BSDTRACE((L"failed (%d/%d)\n", sb->sb_errno, sb->sb_herrno));
}
}
PROTOENT *p;
int size, numaliases = 0;
uae_u32 aptr;
- char *name_rp;
+ uae_char *name_rp;
int i;
struct threadargs args;
volatile struct threadargs *argsp;
name_rp = "";
- if (addr_valid("host_gethostbynameaddr", name, 1))
+ if (addr_valid (L"host_gethostbynameaddr", name, 1))
name_rp = get_real_address (name);
- TRACE(("getprotobyname(%s) -> ",name_rp));
+ BSDTRACE((L"getprotobyname(%s) -> ",name_rp));
memset(&args, 0, sizeof (args));
argsp = &args;
sb->protoent = uae_AllocMem(context, size, 0);
if (!sb->protoent) {
- write_log ("BSDSOCK: WARNING - getprotobyname() ran out of Amiga memory "
- "(couldn't allocate %ld bytes) while returning result of lookup for '%s'\n",
+ write_log (L"BSDSOCK: WARNING - getprotobyname() ran out of Amiga memory "
+ L"(couldn't allocate %ld bytes) while returning result of lookup for '%s'\n",
size, name_rp);
bsdsocklib_seterrno(sb,12); // ENOMEM
return;
put_long (sb->protoent+8,p->p_proto);
for (i = 0; i < numaliases; i++)
- put_long (sb->protoent + 12 + i * 4, addstr(&aptr, p->p_aliases[i]));
+ put_long (sb->protoent + 12 + i * 4, addstr_ansi (&aptr, p->p_aliases[i]));
put_long (sb->protoent + 12 + numaliases * 4,0);
put_long (sb->protoent, aptr);
- addstr(&aptr, p->p_name);
- TRACE(("OK (%s, %d)\n", p->p_name, p->p_proto));
- bsdsocklib_seterrno(sb,0);
+ addstr_ansi (&aptr, p->p_name);
+ BSDTRACE((L"OK (%s, %d)\n", p->p_name, p->p_proto));
+ bsdsocklib_seterrno (sb,0);
} else {
- TRACE(("failed (%d)\n", sb->sb_errno));
+ BSDTRACE((L"failed (%d)\n", sb->sb_errno));
}
}
SERVENT *s;
int size, numaliases = 0;
uae_u32 aptr;
- char *name_rp = NULL, *proto_rp = NULL;
+ TCHAR *name_rp = NULL, *proto_rp = NULL;
int i;
struct threadargs args;
volatile struct threadargs *argsp;
if (proto) {
- if (addr_valid("host_getservbynameport1", proto, 1))
- proto_rp = get_real_address (proto);
+ if (addr_valid (L"host_getservbynameport1", proto, 1))
+ proto_rp = au (get_real_address (proto));
}
if (type) {
- TRACE(("getservbyport(%d,%s) -> ",nameport,proto_rp ? proto_rp : "NULL"));
+ BSDTRACE((L"getservbyport(%d,%s) -> ",nameport, proto_rp ? proto_rp : L"NULL"));
} else {
- if (addr_valid("host_getservbynameport2", nameport, 1))
- name_rp = get_real_address (nameport);
- TRACE(("getservbyname(%s,%s) -> ",name_rp,proto_rp ? proto_rp : "NULL"));
+ if (addr_valid (L"host_getservbynameport2", nameport, 1))
+ name_rp = au (get_real_address (nameport));
+ BSDTRACE((L"getservbyname(%s,%s) -> ",name_rp, proto_rp ? proto_rp : L"NULL"));
}
memset(&args, 0, sizeof (args));
argsp->args3 = proto;
argsp->args4 = type;
- argsp = run_get_thread(context, sb, &args);
+ argsp = run_get_thread (context, sb, &args);
if (!argsp)
return;
sb->servent = uae_AllocMem(context, size, 0);
if (!sb->servent) {
- write_log ("BSDSOCK: WARNING - getservby%s() ran out of Amiga memory (couldn't allocate %ld bytes)\n", type ? "port" : "name", size);
+ write_log (L"BSDSOCK: WARNING - getservby%s() ran out of Amiga memory (couldn't allocate %ld bytes)\n", type ? "port" : "name", size);
bsdsocklib_seterrno(sb, 12); // ENOMEM
return;
}
put_long (sb->servent + 8, (unsigned short)htons(s->s_port));
for (i = 0; i < numaliases; i++)
- put_long (sb->servent + 16 + i * 4,addstr(&aptr,s->s_aliases[i]));
+ put_long (sb->servent + 16 + i * 4,addstr_ansi (&aptr,s->s_aliases[i]));
put_long (sb->servent + 16 + numaliases * 4,0);
put_long (sb->servent, aptr);
- addstr(&aptr, s->s_name);
+ addstr_ansi (&aptr, s->s_name);
put_long (sb->servent + 12, aptr);
- addstr(&aptr, s->s_proto);
+ addstr_ansi (&aptr, s->s_proto);
- TRACE(("OK (%s, %d)\n", s->s_name, (unsigned short)htons(s->s_port)));
+ BSDTRACE((L"OK (%s, %d)\n", s->s_name, (unsigned short)htons(s->s_port)));
bsdsocklib_seterrno(sb, 0);
} else {
- TRACE(("failed (%d)\n",sb->sb_errno));
+ BSDTRACE((L"failed (%d)\n",sb->sb_errno));
}
}
uae_u32 host_gethostname(uae_u32 name, uae_u32 namelen)
{
- if (!addr_valid("host_gethostname", name, namelen))
+ if (!addr_valid (L"host_gethostname", name, namelen))
return -1;
return gethostname(get_real_address (name),namelen);
}
int i;
HMODULE h;
struct CapsVersionInfo cvi;
- char *dllname = "CAPSImg.dll";
+ TCHAR *dllname = L"CAPSImg.dll";
if (init)
return 1;
h = WIN32_LoadLibrary (dllname);
if (!h) {
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
if (SUCCEEDED(SHGetFolderPath (NULL, CSIDL_PROGRAM_FILES_COMMON, NULL, 0, tmp))) {
- strcat (tmp, "\\Software Preservation Society\\");
- strcat (tmp, dllname);
+ _tcscat (tmp, L"\\Software Preservation Society\\");
+ _tcscat (tmp, dllname);
h = LoadLibrary (tmp);
if (!h) {
if (noticed)
init = 1;
cvi.type = LIB_TYPE;
pCAPSGetVersionInfo (&cvi, 0);
- write_log ("CAPS: library version %d.%d\n", cvi.release, cvi.revision);
+ write_log (L"CAPS: library version %d.%d\n", cvi.release, cvi.revision);
for (i = 0; i < 4; i++)
caps_cont[i] = pCAPSAddImage ();
return 1;
struct CapsImageInfo ci;
int len, ret;
uae_u8 *buf;
- char s1[100];
+ TCHAR s1[100];
struct CapsDateTimeExt *cdt;
if (!caps_init ())
*num_tracks = (ci.maxcylinder - ci.mincylinder + 1) * (ci.maxhead - ci.minhead + 1);
pCAPSLoadImage(caps_cont[drv], caps_flags);
cdt = &ci.crdt;
- sprintf (s1, "%d.%d.%d %d:%d:%d", cdt->day, cdt->month, cdt->year, cdt->hour, cdt->min, cdt->sec);
- write_log ("caps: type:%d date:%s rel:%d rev:%d\n",
+ _stprintf (s1, L"%d.%d.%d %d:%d:%d", cdt->day, cdt->month, cdt->year, cdt->hour, cdt->min, cdt->sec);
+ write_log (L"caps: type:%d date:%s rel:%d rev:%d\n",
ci.type, s1, ci.release, ci.revision);
return 1;
}
tracktiming[i] = (uae_u16)ci.timebuf[i];
}
#if 0
- write_log ("caps: drive:%d track:%d len:%d multi:%d timing:%d type:%d overlap:%d\n",
+ write_log (L"caps: drive:%d track:%d len:%d multi:%d timing:%d type:%d overlap:%d\n",
drv, track, len, *multirev, ci.timelen, type, ci.overlap);
#endif
return 1;
static void *clipboard_delayed_data;
static int clipboard_delayed_size;
-static void debugwrite (const char *name, uae_u8 *p, int size)
+static void debugwrite (const TCHAR *name, uae_u8 *p, int size)
{
FILE *f;
int cnt;
return;
cnt = 0;
for (;;) {
- char tmp[MAX_DPATH];
- sprintf (tmp, "%s.%03d.dat", name, cnt);
- f = fopen (tmp, "rb");
+ TCHAR tmp[MAX_DPATH];
+ _stprintf (tmp, L"%s.%03d.dat", name, cnt);
+ f = _tfopen (tmp, L"rb");
if (f) {
fclose (f);
cnt++;
continue;
}
- f = fopen (tmp, "wb");
+ f = _tfopen (tmp, L"wb");
if (f) {
fwrite (p, size, 1, f);
fclose (f);
if (!clipboard_data)
return;
if (clipboard_debug) {
- debugwrite ("clipboard_p2a", to_amiga, to_amiga_size);
+ debugwrite (L"clipboard_p2a", to_amiga, to_amiga_size);
}
put_long (clipboard_data, to_amiga_size);
uae_Signal (get_long (clipboard_data + 8), 1 << 13);
}
-static char *pctoamiga (const char *txt)
+static TCHAR *pctoamiga (const TCHAR *txt)
{
int len;
- char *txt2;
+ TCHAR *txt2;
int i, j;
- len = strlen (txt) + 1;
- txt2 = xmalloc (len);
+ len = _tcslen (txt) + 1;
+ txt2 = xmalloc (len * sizeof (TCHAR));
j = 0;
for (i = 0; i < len; i++) {
- char c = txt[i];
+ TCHAR c = txt[i];
if (c == 13)
continue;
txt2[j++] = c;
return txt2;
}
-static int parsecsi (const char *txt, int off, int len)
+static int parsecsi (const uae_u8 *txt, int off, int len)
{
while (off < len) {
if (txt[off] >= 0x40)
return off;
}
-static char *amigatopc (const char *txt)
+static TCHAR *amigatopc (const uae_u8 *txt)
{
int i, j, cnt;
int len, pc;
char *txt2;
+ TCHAR *s;
pc = 0;
cnt = 0;
len = strlen (txt) + 1;
for (i = 0; i < len; i++) {
- char c = txt[i];
+ TCHAR c = txt[i];
if (c == 13)
pc = 1;
if (c == 10)
cnt++;
}
if (pc)
- return my_strdup (txt);
+ return my_strdup_ansi (txt);
txt2 = xcalloc (len + cnt, 1);
j = 0;
for (i = 0; i < len; i++) {
- char c = txt[i];
+ uae_u8 c = txt[i];
if (c == 0 && i + 1 < len)
continue;
if (c == 10)
}
txt2[j++] = c;
}
- return txt2;
+ s = my_strdup_ansi (txt2);
+ xfree (txt2);
+ return s;
}
-static void to_iff_text (char *pctxt)
+static void to_iff_text (TCHAR *pctxt)
{
uae_u8 b[] = { 'F','O','R','M',0,0,0,0,'F','T','X','T','C','H','R','S',0,0,0,0 };
uae_u32 size;
int txtlen;
- char *txt;
-
+ TCHAR *txt;
+ char *s;
+
txt = pctoamiga (pctxt);
- txtlen = strlen (txt);
+ s = ua (txt);
+ txtlen = strlen (s);
xfree (to_amiga);
size = txtlen + sizeof b + (txtlen & 1) - 8;
b[4] = size >> 24;
to_amiga_size = sizeof b + txtlen + (txtlen & 1);
to_amiga = xcalloc (to_amiga_size, 1);
memcpy (to_amiga, b, sizeof b);
- memcpy (to_amiga + sizeof b, txt, strlen (txt));
+ memcpy (to_amiga + sizeof b, s, txtlen);
to_amiga_start ();
xfree (txt);
+ xfree (s);
}
-static int clipboard_put_text (const char *txt);
+static int clipboard_put_text (const TCHAR *txt);
static void from_iff_text (uaecptr ftxt, uae_u32 len)
{
uae_u8 *addr = NULL, *eaddr;
char *txt = NULL;
int txtsize = 0;
- char *pctxt;
#if 0
{
else if (csize >= 1 && addr[-1] == 0x0d && addr[0] == 0x0a)
addr++;
}
- if (txt == NULL)
- txt = my_strdup ("");
- pctxt = amigatopc (txt);
- clipboard_put_text (pctxt);
- xfree (pctxt);
+ if (txt == NULL) {
+ clipboard_put_text (L"");
+ } else {
+ TCHAR *pctxt = amigatopc (txt);
+ clipboard_put_text (pctxt);
+ xfree (pctxt);
+ }
xfree (txt);
}
return;
}
- write_log ("BMP2IFF: W=%d H=%d bpp=%d\n", w, h, bpp);
+ write_log (L"BMP2IFF: W=%d H=%d bpp=%d\n", w, h, bpp);
iffbpp = bpp > 8 ? 24 : bpp;
cnt = 0;
i >>= 1;
iffbpp++;
}
- write_log ("BMP2IFF: Colors=%d BPP=%d\n", cnt, iffbpp);
+ write_log (L"BMP2IFF: Colors=%d BPP=%d\n", cnt, iffbpp);
}
bodysize = (((w + 15) & ~15) / 8) * h * iffbpp;
uae_u8 *caddr = NULL, *dptr;
body = 1;
- write_log ("W=%d H=%d planes=%d mask=%d comp=%d CAMG=%08x\n", w, h, planes, masking, compr, camg);
+ write_log (L"W=%d H=%d planes=%d mask=%d comp=%d CAMG=%08x\n", w, h, planes, masking, compr, camg);
ham = 0; ehb = 0;
if ((camg & 0x0800) && planes > 4)
return;
addr = get_real_address (data);
if (clipboard_debug)
- debugwrite ("clipboard_a2p", addr, len);
+ debugwrite (L"clipboard_a2p", addr, len);
if (memcmp ("FORM", addr, 4))
return;
if (!memcmp ("FTXT", addr + 8, 4))
if (!OpenClipboard (hwnd))
return;
f = 0;
- write_log ("clipboard: windows clipboard: ");
+ write_log (L"clipboard: windows clipboard: ");
while (f = EnumClipboardFormats (f)) {
- write_log ("%d ", f);
+ write_log (L"%d ", f);
if (f == CF_TEXT)
text = TRUE;
if (f == CF_BITMAP)
bmp = TRUE;
}
- write_log ("\n");
+ write_log (L"\n");
if (text) {
hglb = GetClipboardData (CF_TEXT);
if (hglb != NULL) {
- char *lptstr = GlobalLock (hglb);
+ TCHAR *lptstr = GlobalLock (hglb);
if (lptstr != NULL) {
to_iff_text (lptstr);
GlobalUnlock (hglb);
ret = TRUE;
CloseClipboard ();
clipopen--;
- write_log ("clipboard: BMP written to windows clipboard\n");
+ write_log (L"clipboard: BMP written to windows clipboard\n");
return ret;
}
-static int clipboard_put_text_real (const char *txt)
+static int clipboard_put_text_real (const TCHAR *txt)
{
HGLOBAL hglb;
int ret = FALSE;
return ret;
clipopen++;
EmptyClipboard ();
- hglb = GlobalAlloc (GMEM_MOVEABLE, strlen (txt) + 1);
+ hglb = GlobalAlloc (GMEM_MOVEABLE, (_tcslen (txt) + 1) * sizeof (TCHAR));
if (hglb) {
- char *lptstr = GlobalLock (hglb);
- strcpy (lptstr, txt);
+ TCHAR *lptstr = GlobalLock (hglb);
+ _tcscpy (lptstr, txt);
GlobalUnlock (hglb);
SetClipboardData (CF_TEXT, hglb);
ret = TRUE;
}
CloseClipboard ();
clipopen--;
- write_log ("clipboard: text written to windows clipboard\n");
+ write_log (L"clipboard: text written to windows clipboard\n");
return ret;
}
-static int clipboard_put_text (const char *txt)
+static int clipboard_put_text (const TCHAR *txt)
{
if (!clipactive)
return clipboard_put_text_real (txt);
void amiga_clipboard_die (void)
{
signaling = 0;
- write_log ("clipboard not initialized\n");
+ write_log (L"clipboard not initialized\n");
}
void amiga_clipboard_init (void)
{
signaling = 0;
- write_log ("clipboard initialized\n");
+ write_log (L"clipboard initialized\n");
}
void amiga_clipboard_task_start (uaecptr data)
{
clipboard_data = data;
signaling = 1;
- write_log ("clipboard task init: %08x\n", data);
+ write_log (L"clipboard task init: %08x\n", data);
}
uae_u32 amiga_clipboard_proc_start (void)
{
- write_log ("clipboard process init\n");
+ write_log (L"clipboard process init\n");
signaling = 1;
return clipboard_data;
}
void amiga_clipboard_got_data (uaecptr data, uae_u32 size, uae_u32 actual)
{
uae_u8 *addr = get_real_address (data);
- write_log ("clipboard: <-amiga, %08x %d %d\n", data, size, actual);
+ write_log (L"clipboard: <-amiga, %08x %d %d\n", data, size, actual);
from_iff (data, actual);
}
memcpy (raddr, to_amiga, size);
}
xfree (to_amiga);
- write_log ("clipboard: ->amiga, %08x %d bytes\n", addr, size);
+ write_log (L"clipboard: ->amiga, %08x %d bytes\n", addr, size);
to_amiga = NULL;
to_amiga_size = 0;
}
extern uae_u32 get_fpsr();
extern void set_fpsr(uae_u32 x);
-static char linebreak[] = {'\r', '\n', '\0'};
+static TCHAR linebreak[] = {'\r', '\n', '\0'};
#define MAXLINES 250
#define MAXINPUTHIST 50
static int reopen;
struct histnode {
- char *command;
+ TCHAR *command;
struct histnode *prev;
struct histnode *next;
};
HWND ctrl[MAXPAGECONTROLS];
uae_u32 memaddr;
uae_u32 dasmaddr;
- char addrinput[9];
+ TCHAR addrinput[9];
int selection;
int init;
int autoset;
static int currpage, pages;
static int pagetype;
-char *pname[] = { "OUT1", "OUT2", "MEM1", "MEM2", "DASM1", "DASM2", "BRKPTS", "MISC", "CUSTOM" };
+TCHAR *pname[] = { L"OUT1", L"OUT2", L"MEM1", L"MEM2", L"DASM1", L"DASM2", L"BRKPTS", L"MISC", L"CUSTOM" };
static int pstatuscolor[MAXPAGES];
static int dbgwnd_minx = 800, dbgwnd_miny = 600;
static BOOL useinternalcmd = FALSE;
-static char internalcmd[MAX_LINEWIDTH + 1];
+static TCHAR internalcmd[MAX_LINEWIDTH + 1];
-static const char *markinstr[] = { "JMP", "BT ", "RTS", "RTD", "RTE", "RTR", 0 };
-static const char *ucbranch[] = { "BSR", "JMP", "JSR", 0 };
-static const char *cbranch[] = { "B", "DB", "FB", "FDB", 0 };
-static const char *ccode[] = { "T ", "F ", "HI", "LS", "CC", "CS", "NE", "EQ",
- "VC", "VS", "PL", "MI", "GE", "LT", "GT", "LE", 0 };
+static const TCHAR *markinstr[] = { L"JMP", L"BT L", L"RTS", L"RTD", L"RTE", L"RTR", 0 };
+static const TCHAR *ucbranch[] = { L"BSR", L"JMP", L"JSR", 0 };
+static const TCHAR *cbranch[] = { L"B", L"DB", L"FB", L"FDB", 0 };
+static const TCHAR *ccode[] = { L"T ", L"F ", L"HI", L"LS", L"CC", L"CS", L"NE", L"EQ",
+ L"VC", L"VS", L"PL", L"MI", L"GE", L"LT", L"GT", L"LE", 0 };
static void OutputCurrHistNode(HWND hWnd)
{
int txtlen;
- char *buf;
+ TCHAR *buf;
if (currhist->command) {
txtlen = GetWindowTextLength(hWnd);
buf = malloc(txtlen + 1);
GetWindowText(hWnd, buf, txtlen + 1);
- if (strcmp(buf, currhist->command)) {
+ if (_tcscmp(buf, currhist->command)) {
SetWindowText(hWnd, currhist->command);
- txtlen = strlen(currhist->command);
+ txtlen = _tcslen(currhist->command);
SendMessage(hWnd, EM_SETSEL, (WPARAM)txtlen, (LPARAM)txtlen);
SendMessage(hWnd, EM_SETSEL, -1, -1);
}
}
}
-static void AddToHistory(const char *command)
+static void AddToHistory(const TCHAR *command)
{
struct histnode *tmp;
currhist = NULL;
- if (histcount > 0 && !strcmp(command, lasthist->command))
+ if (histcount > 0 && !_tcscmp(command, lasthist->command))
return;
else if (histcount == MAXINPUTHIST)
DeleteFromHistory(1);
lasthist = malloc(sizeof(struct histnode));
if (histcount == 0)
firsthist = lasthist;
- lasthist->command = strdup(command);
+ lasthist->command = my_strdup(command);
lasthist->next = NULL;
lasthist->prev = tmp;
if (tmp)
histcount++;
}
-int GetInput (char *out, int maxlen)
+int GetInput (TCHAR *out, int maxlen)
{
HWND hInput;
- int chars;
+ int TCHARs;
if (!hDbgWnd)
return 0;
hInput = GetDlgItem(hDbgWnd, IDC_DBG_INPUT);
- chars = GetWindowText(hInput, out, maxlen);
- if (chars == 0)
+ TCHARs = GetWindowText(hInput, out, maxlen);
+ if (TCHARs == 0)
return 0;
WriteOutput(linebreak + 1, 2);
- WriteOutput(out, strlen(out));
+ WriteOutput(out, _tcslen(out));
WriteOutput(linebreak + 1, 2);
AddToHistory(out);
- SetWindowText(hInput, "");
- return chars;
+ SetWindowText(hInput, L"");
+ return TCHARs;
}
-static int CheckLineLimit(HWND hWnd, const char *out)
+static int CheckLineLimit(HWND hWnd, const TCHAR *out)
{
- char *tmp, *p;
+ TCHAR *tmp, *p;
int lines_have, lines_new = 0, lastchr, txtlen, visible;
- tmp = (char *)out;
+ tmp = (TCHAR *)out;
lines_have = SendMessage(hWnd, EM_GETLINECOUNT, 0, 0);
- while (strlen(tmp) > 0 && (p = strchr(tmp, '\n')) > 0) {
+ while (_tcslen(tmp) > 0 && (p = _tcschr(tmp, '\n')) > 0) {
lines_new++;
tmp = p + 1;
}
return 1;
}
-void WriteOutput(const char *out, int len)
+void WriteOutput(const TCHAR *out, int len)
{
int txtlen, pos = 0, count, index, leave = 0;
- char *buf = 0, *p, *tmp;
+ TCHAR *buf = 0, *p, *tmp;
- if (!hOutput || !strcmp(out, ">") || len == 0)
+ if (!hOutput || !_tcscmp(out, L">") || len == 0)
return;
if (!CheckLineLimit(hOutput, out))
return;
- tmp = (char *)out;
+ tmp = (TCHAR *)out;
for(;;) {
- p = strchr(tmp, '\n');
+ p = _tcschr(tmp, '\n');
if (p) {
pos = p - tmp + 1;
if (pos > (MAX_LINEWIDTH + 1))
pos = MAX_LINEWIDTH + 1;
buf = xmalloc(pos + 2);
memset(buf, 0, pos + 2);
- strncpy(buf, tmp, pos - 1);
- strcat(buf, linebreak);
- } else if (strlen(tmp) == 0) {
+ _tcsncmp(buf, tmp, pos - 1);
+ _tcscat(buf, linebreak);
+ } else if (_tcslen(tmp) == 0) {
leave = 1;
} else {
count = SendMessage(hOutput, EM_GETLINECOUNT, 0, 0);
index = SendMessage(hOutput, EM_LINEINDEX, count - 1, 0);
txtlen = SendMessage(hOutput, EM_LINELENGTH, index, 0);
- if (strlen(tmp) + txtlen > MAX_LINEWIDTH) {
+ if (_tcslen(tmp) + txtlen > MAX_LINEWIDTH) {
buf = xmalloc(MAX_LINEWIDTH + 3 - txtlen);
memset(buf, 0, MAX_LINEWIDTH + 3 - txtlen);
- strncpy(buf, tmp, MAX_LINEWIDTH - txtlen);
- strcat(buf, linebreak);
+ _tcsncmp(buf, tmp, MAX_LINEWIDTH - txtlen);
+ _tcscat(buf, linebreak);
}
leave = 1;
}
static HWND ulbs_hwnd;
static int ulbs_pos;
-static void UpdateListboxString(HWND hWnd, int pos, char *out, int mark)
+static void UpdateListboxString(HWND hWnd, int pos, TCHAR *out, int mark)
{
int count;
- char text[MAX_LINEWIDTH + 1], *p;
+ TCHAR text[MAX_LINEWIDTH + 1], *p;
COLORREF cr;
if (!IsWindowEnabled(hWnd)) {
- p = strchr(out, ':');
+ p = _tcschr(out, ':');
if (p)
*(p + 1) = '\0';
}
- if (strlen(out) > MAX_LINEWIDTH)
+ if (_tcslen(out) > MAX_LINEWIDTH)
out[MAX_LINEWIDTH] = '\0';
- p = strchr(out, '\n');
+ p = _tcschr(out, '\n');
if (p)
*p = '\0';
cr = GetSysColor(COLOR_WINDOWTEXT);
if (pos < count) {
memset(text, 0, MAX_LINEWIDTH + 1);
SendMessage(hWnd, LB_GETTEXT, pos, (LPARAM)((LPTSTR)text));
- if (strcmp(out, text) != 0 && mark)
+ if (_tcscmp(out, text) != 0 && mark)
cr = GetSysColor(COLOR_HIGHLIGHT);
SendMessage(hWnd, LB_DELETESTRING, pos, 0);
}
ulbs_hwnd = hwnd;
ulbs_pos = 0;
}
-static void ULBS(const char *format, ...)
+static void ULBS(const TCHAR *format, ...)
{
- char buffer[MAX_LINEWIDTH + 1];
+ TCHAR buffer[MAX_LINEWIDTH + 1];
va_list parms;
va_start(parms, format);
- _vsnprintf(buffer, MAX_LINEWIDTH, format, parms);
+ _vsntprintf(buffer, MAX_LINEWIDTH, format, parms);
UpdateListboxString(ulbs_hwnd, ulbs_pos++, buffer, FALSE);
}
-static void ULBST(const char *format, ...)
+static void ULBST(const TCHAR *format, ...)
{
- char buffer[MAX_LINEWIDTH + 1];
+ TCHAR buffer[MAX_LINEWIDTH + 1];
va_list parms;
va_start(parms, format);
- _vsnprintf(buffer, MAX_LINEWIDTH, format, parms);
+ _vsntprintf(buffer, MAX_LINEWIDTH, format, parms);
UpdateListboxString(ulbs_hwnd, ulbs_pos++, buffer, TRUE);
}
static void ShowMiscCPU(HWND hwnd)
{
int line = 0;
- char out[MAX_LINEWIDTH + 1];
+ TCHAR out[MAX_LINEWIDTH + 1];
int i;
for (i = 0; m2cregs[i].regno>= 0; i++) {
if (!movec_illg(m2cregs[i].regno)) {
- sprintf(out, "%-4s %08X", m2cregs[i].regname, val_move2c(m2cregs[i].regno));
+ _stprintf(out, L"%-4s %08X", m2cregs[i].regname, val_move2c(m2cregs[i].regno));
UpdateListboxString(hwnd, line++, out, TRUE);
}
}
{
int len, i, j, cnt;
uae_u8 *p1, *p2, *p3, *p4;
- char out[MAX_LINEWIDTH + 1];
+ TCHAR out[MAX_LINEWIDTH + 1];
p1 = p2 = save_custom (&len, 0, 1);
p1 += 4; // skip chipset type
}
ULBSINIT(hwnd);
cnt = 0;
- sprintf(out, "CPU %d", currprefs.cpu_model);
+ _stprintf(out, L"CPU %d", currprefs.cpu_model);
if (currprefs.fpu_model)
- sprintf (out + strlen(out), "/%d", currprefs.fpu_model);
- sprintf(out + strlen(out), " %s", (currprefs.chipset_mask & CSMASK_AGA) ? "AGA" : ((currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? "ECS" : "OCS"));
+ _stprintf (out + _tcslen(out), L"/%d", currprefs.fpu_model);
+ _stprintf(out + _tcslen(out), L" %s", (currprefs.chipset_mask & CSMASK_AGA) ? L"AGA" : ((currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? L"ECS" : L"OCS"));
ULBST(out);
- ULBST("VPOS %04X (%d)", vpos, vpos);
- ULBST("HPOS %04X (%d)", current_hpos(), current_hpos());
+ ULBST(L"VPOS %04X (%d)", vpos, vpos);
+ ULBST(L"HPOS %04X (%d)", current_hpos(), current_hpos());
for (i = 0; dcustom[i]; i++) {
for (j = 0; custd[j].name; j++) {
if (custd[j].adr == (dcustom[i] & 0x1fe) + 0xdff000) {
if (dcustom[i] & 0x8000)
- ULBST("%-8s %08X", custd[j].name, (gw(p1, dcustom[i] & 0x1fe) << 16) | gw(p1, (dcustom[i] & 0x1fe) + 2));
+ ULBST(L"%-8s %08X", custd[j].name, (gw(p1, dcustom[i] & 0x1fe) << 16) | gw(p1, (dcustom[i] & 0x1fe) + 2));
else
- ULBST("%-8s %04X", custd[j].name, gw(p1, dcustom[i] & 0x1fe));
+ ULBST(L"%-8s %04X", custd[j].name, gw(p1, dcustom[i] & 0x1fe));
break;
}
}
ULBSINIT(hMisc);
for (i = 0; i < 2; i++) {
p = p2 = save_cia (i, &len, NULL);
- ULBS("");
- ULBS("CIA %c:", i == 1 ? 'B' : 'A');
- ULBS("");
- ULBS("PRA %02X PRB %02X", p[0], p[1]);
- ULBS("DRA %02X DRB %02X", p[2], p[3]);
- ULBS("CRA %02X CRB %02X ICR %02X IM %02X",
+ ULBS(L"");
+ ULBS(L"CIA %c:", i == 1 ? 'B' : 'A');
+ ULBS(L"");
+ ULBS(L"PRA %02X PRB %02X", p[0], p[1]);
+ ULBS(L"DRA %02X DRB %02X", p[2], p[3]);
+ ULBS(L"CRA %02X CRB %02X ICR %02X IM %02X",
p[14], p[15], p[13], p[16]);
- ULBS("TA %04X (%04X) TB %04X (%04X)",
+ ULBS(L"TA %04X (%04X) TB %04X (%04X)",
(p[5] << 8) | p[4], (p[18] << 8) | p[17],
(p[7] << 8) | p[6], (p[20] << 8) | p[19]);
- ULBS("TOD %06X (%06X) ALARM %06X %c%c",
+ ULBS(L"TOD %06X (%06X) ALARM %06X %c%c",
(p[10] << 16) | (p[ 9] << 8) | p[ 8],
(p[23] << 16) | (p[22] << 8) | p[21],
(p[26] << 16) | (p[25] << 8) | p[24],
}
for (i = 0; i < 4; i++) {
p = p2 = save_disk (i, &len, NULL);
- ULBS("");
- ULBS("Drive DF%d: (%s)", i, (p[4] & 2) ? "disabled" : "enabled");
- ULBS("ID %08X Motor %s Cylinder %2d MFMPOS %d",
+ ULBS(L"");
+ ULBS(L"Drive DF%d: (%s)", i, (p[4] & 2) ? "disabled" : "enabled");
+ ULBS(L"ID %08X Motor %s Cylinder %2d MFMPOS %d",
(p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3],
- (p[4] & 1) ? "On" : "Off",
+ (p[4] & 1) ? L"On" : L"Off",
p[5], (p[8] << 24) | (p[9] << 16) | (p[10] << 8) | p[11]);
if (p[16])
- ULBS("'%s'", p + 16);
+ ULBS(L"'%s'", p + 16);
else
- ULBS("Drive is empty");
+ ULBS(L"Drive is empty");
free(p2);
}
p = p2 = save_floppy (&len, NULL);
- ULBS("");
- ULBS("Disk controller:");
- ULBS("");
- ULBS("Shift register: Data=%04X Shift=%d. DMA=%d,%d", (p[0] << 8) | p[1], p[2], p[3], p[5]);
+ ULBS(L"");
+ ULBS(L"Disk controller:");
+ ULBS(L"");
+ ULBS(L"Shift register: Data=%04X Shift=%d. DMA=%d,%d", (p[0] << 8) | p[1], p[2], p[3], p[5]);
free (p2);
}
addr2 = custd[j].adr & 0x1ff;
v1 = (p1[addr1 + 0] << 8) | p1[addr1 + 1];
v2 = (p1[addr2 + 0] << 8) | p1[addr2 + 1];
- ULBS("%03.3X %-15s %04X %03X %-15s %04X",
+ ULBS(L"%03.3X %-15s %04X %03X %-15s %04X",
addr1, custd[i].name, v1,
addr2, custd[j].name, v2);
}
{
HWND hBrkpts;
int i, lines_old, got;
- char outbp[MAX_LINEWIDTH + 1], outw[50];
+ TCHAR outbp[MAX_LINEWIDTH + 1], outw[50];
hBrkpts = GetDlgItem(hDbgWnd, IDC_DBG_BRKPTS);
ULBSINIT(hBrkpts);
lines_old = SendMessage(hBrkpts, LB_GETCOUNT, 0, 0);
- ULBS("");
- ULBS("Breakpoints:");
- ULBS("");
+ ULBS(L"");
+ ULBS(L"Breakpoints:");
+ ULBS(L"");
got = 0;
for (i = 0; i < BREAKPOINT_TOTAL; i++) {
if (!bpnodes[i].enabled)
got = 1;
}
if (!got)
- ULBS("none");
- ULBS("");
- ULBS("Memwatch breakpoints:");
- ULBS("");
+ ULBS(L"none");
+ ULBS(L"");
+ ULBS(L"Memwatch breakpoints:");
+ ULBS(L"");
got = 0;
for (i = 0; i < MEMWATCH_TOTAL; i++) {
if (mwnodes[i].size == 0)
got = 1;
}
if (!got)
- ULBS("none");
+ ULBS(L"none");
for (i = ulbs_pos; i < lines_old; i++)
SendMessage(hBrkpts, LB_DELETESTRING, ulbs_pos, 0);
}
{
uae_u32 addr;
int i, lines_old, lines_new;
- char out[MAX_LINEWIDTH + 1];
+ TCHAR out[MAX_LINEWIDTH + 1];
HWND hMemory;
dbgpage[currpage].memaddr += offset;
{
uae_u32 addr = 0, prev;
int i, lines_old, lines_new;
- char out[MAX_LINEWIDTH + 1];
+ TCHAR out[MAX_LINEWIDTH + 1];
HWND hDasm;
if (currpage == 0)
if (addr > dbgpage[currpage].dasmaddr)
UpdateListboxString(hDasm, i, out, FALSE);
else
- UpdateListboxString(hDasm, i, "", FALSE);
+ UpdateListboxString(hDasm, i, L"", FALSE);
}
for (i = lines_new; i < lines_old; i++) {
SendMessage(hDasm, LB_DELETESTRING, lines_new, 0);
int i, id;
dbgpage[currpage].dasmaddr = m68k_getpc (®s);
- sprintf(dbgpage[currpage].addrinput, "%08lX", dbgpage[currpage].dasmaddr);
+ _stprintf(dbgpage[currpage].addrinput, L"%08lX", dbgpage[currpage].dasmaddr);
for (i = 0; i < MAXPAGECONTROLS; i++) {
id = GetDlgCtrlID(dbgpage[currpage].ctrl[i]);
if (id == IDC_DBG_MEMINPUT)
pages++;
}
-static int GetTextSize(HWND hWnd, char *text, int width)
+static int GetTextSize(HWND hWnd, TCHAR *text, int width)
{
HDC hdc;
TEXTMETRIC tm;
if (!width)
return tm.tmHeight + tm.tmExternalLeading;
else if (text)
- return tm.tmMaxCharWidth * strlen(text);
+ return tm.tmMaxCharWidth * _tcslen(text);
return 0;
}
for (i = 0; i < (sizeof(dpage) / sizeof(dpage[0])); i++)
AddPage(dpage[i]);
memset(parts, 0, MAXPAGES * sizeof(int));
- width = GetTextSize(hDbgWnd, "12345678", TRUE); // longest pagename + 2
+ width = GetTextSize(hDbgWnd, L"12345678", TRUE); // longest pagename + 2
for (i = 0; i < pages; i++) {
pwidth += width;
parts[i] = pwidth;
{
HANDLE hdata;
LPTSTR lptstr;
- char allowed[] = "1234567890abcdefABCDEF";
+ TCHAR allowed[] = L"1234567890abcdefABCDEF";
int ok = 1;
- char addrstr[11];
+ TCHAR addrstr[11];
uae_u32 addr;
WNDPROC oldproc;
case 0x16: //ctrl+v
break;
default:
- if (!debugger_active || !strchr(allowed, wParam))
+ if (!debugger_active || !_tcschr(allowed, wParam))
return 0;
break;
}
if (hdata) {
lptstr = GlobalLock(hdata);
if (lptstr) {
- if (strspn(lptstr, allowed) != strlen(lptstr))
+ if (_tcsspn(lptstr, allowed) != _tcslen(lptstr))
ok = 0;
GlobalUnlock(hdata);
}
return 0;
switch (wParam) {
case VK_RETURN:
- sprintf(addrstr, "0x");
+ _stprintf(addrstr, L"0x");
GetWindowText(hWnd, addrstr + 2, 9);
if (addrstr[2] != 0) {
- addr = strtoul(addrstr, NULL, 0);
+ addr = _tcstoul(addrstr, NULL, 0);
if (pagetype == IDC_DBG_MEM || pagetype == IDC_DBG_MEM2) {
dbgpage[currpage].memaddr = addr;
ShowMem(0);
switch (LOWORD(wParam)) {
case IDOK:
{
- char addrstr[11] = { '0', 'x', '\0' };
+ TCHAR addrstr[11] = { '0', 'x', '\0' };
SendMessage(GetDlgItem(hDlg, IDC_DBG_MEMINPUT2), WM_GETTEXT, 9, (LPARAM)addrstr + 2);
if (addrstr[2] != 0) {
- uae_u32 addr = strtoul(addrstr, NULL, 0);
+ uae_u32 addr = _tcstoul(addrstr, NULL, 0);
if (dbgpage[currpage].selection == IDC_DBG_MEM || dbgpage[currpage].selection == IDC_DBG_MEM2) {
dbgpage[currpage].memaddr = addr;
ShowMem(0);
static void ToggleBreakpoint(HWND hwnd)
{
- char addrstr[MAX_LINEWIDTH + 1], *ptr;
+ TCHAR addrstr[MAX_LINEWIDTH + 1], *ptr;
int index = dbgpage[currpage].selection;
SendMessage(hwnd, LB_GETTEXT, index, (LPARAM)addrstr);
addrstr[8] = '\0';
ptr = addrstr;
- console_out_f ("\nf %s\n", addrstr);
+ console_out_f (L"\nf %s\n", addrstr);
instruction_breakpoint(&ptr);
RedrawWindow(hwnd, 0, 0, RDW_INVALIDATE);
}
static void DeleteBreakpoints(HWND hwnd)
{
- char *cmd = "d";
- console_out("\nfd\n");
+ TCHAR *cmd = L"d";
+ console_out(L"\nfd\n");
instruction_breakpoint(&cmd);
RedrawWindow(hwnd, 0, 0, RDW_INVALIDATE);
}
-static void ignore_ws (char **c)
+static void ignore_ws (TCHAR **c)
{
- while (**c && isspace(**c))
+ while (**c && _istspace(**c))
(*c)++;
}
static void ListboxEndEdit(HWND hwnd, BOOL acceptinput)
{
MSG msg;
- char *p, *p2, txt[MAX_LINEWIDTH + 1], tmp[MAX_LINEWIDTH + 1], hexstr[11] = { '0', 'x', '\0' };
+ TCHAR *p, *p2, txt[MAX_LINEWIDTH + 1], tmp[MAX_LINEWIDTH + 1], hexstr[11] = { '0', 'x', '\0' };
if (!hedit)
return;
GetWindowText(hedit, txt, MAX_LINEWIDTH + 1);
p = txt;
ignore_ws(&p);
- if ((GetWindowTextLength(hedit) == 0) || (strlen(p) == 0))
+ if ((GetWindowTextLength(hedit) == 0) || (_tcslen(p) == 0))
acceptinput = FALSE;
while (PeekMessage(&msg, hedit, 0, 0, PM_REMOVE))
;
if (acceptinput) {
int index = dbgpage[currpage].selection, id = GetDlgCtrlID(hwnd);
if (id == IDC_DBG_DREG) {
- strncpy(hexstr + 2, txt, 8);
+ _tcsncmp(hexstr + 2, txt, 8);
hexstr[10] = '\0';
- m68k_dreg(®s, index) = strtoul(hexstr, NULL, 0);
+ m68k_dreg(®s, index) = _tcstoul(hexstr, NULL, 0);
}
else if (id == IDC_DBG_AREG) {
- strncpy(hexstr + 2, txt, 8);
+ _tcsncmp(hexstr + 2, txt, 8);
hexstr[10] = '\0';
- m68k_areg(®s, index) = strtoul(hexstr, NULL, 0);
+ m68k_areg(®s, index) = _tcstoul(hexstr, NULL, 0);
}
else if (id == IDC_DBG_FPREG) {
- char *stopstr;
+ TCHAR *stopstr;
double value;
errno = 0;
- value = strtod(txt, &stopstr);
- if (strlen(stopstr) == 0 && errno == 0)
- regs.fp[index] = strtod(txt, &stopstr);
+ value = _tcstod(txt, &stopstr);
+ if (_tcslen(stopstr) == 0 && errno == 0)
+ regs.fp[index] = _tcstod(txt, &stopstr);
}
else {
int bytes, i, offset = -1;
bytes = 16;
}
else if (id == IDC_DBG_MEM || id == IDC_DBG_MEM2) {
- strncpy(hexstr + 2, tmp, 8);
+ _tcsncmp(hexstr + 2, tmp, 8);
hexstr[10] = '\0';
- addr = strtoul(hexstr, NULL, 0);
+ addr = _tcstoul(hexstr, NULL, 0);
offset = 9;
bytes = 16;
}
else if (id == IDC_DBG_DASM || id == IDC_DBG_DASM2) {
- strncpy(hexstr + 2, tmp, 8);
+ _tcsncmp(hexstr + 2, tmp, 8);
hexstr[10] = '\0';
- addr = strtoul(hexstr, NULL, 0);
+ addr = _tcstoul(hexstr, NULL, 0);
bytes = 0;
p = tmp + 9;
- while (isxdigit(p[0]) && p[4] == ' ') {
+ while (_istxdigit(p[0]) && p[4] == ' ') {
bytes += 2;
p += 5;
}
}
- if (offset >= 0 && !isxdigit(tmp[offset])) {
+ if (offset >= 0 && !_istxdigit(tmp[offset])) {
int t = 0;
do {
t += 5;
addr += 2;
bytes -= 2;
- } while (!isxdigit(tmp[offset + t]) && !isxdigit(tmp[offset + t + 1]) && isspace(tmp[offset + t + 4]));
+ } while (!_istxdigit(tmp[offset + t]) && !_istxdigit(tmp[offset + t + 1]) && _istspace(tmp[offset + t + 4]));
}
p = txt;
for (i = 0; i < bytes; i++) {
ignore_ws(&p);
- if (!isxdigit(p[0]))
+ if (!_istxdigit(p[0]))
break;
p2 = p + 1;
ignore_ws(&p2);
- if (!isxdigit(p2[0]))
+ if (!_istxdigit(p2[0]))
break;
hexstr[2] = p[0];
hexstr[3] = p2[0];
hexstr[4] = '\0';
- value = (uae_u8)strtoul(hexstr, NULL, 0);
+ value = (uae_u8)_tcstoul(hexstr, NULL, 0);
put_byte(addr, value);
p = p2 + 1;
addr++;
{
HANDLE hdata;
LPTSTR lptstr;
- char allowed[] = "1234567890abcdefABCDEF ";
+ TCHAR allowed[] = L"1234567890abcdefABCDEF ";
int ok = 1, id;
WNDPROC oldproc;
HWND hparent = GetParent(hWnd);
id = GetDlgCtrlID(hparent);
if (id == IDC_DBG_DREG || id == IDC_DBG_AREG)
- allowed[strlen(allowed) - 1] = '\0'; // no space
+ allowed[_tcslen(allowed) - 1] = '\0'; // no space
else if (id == IDC_DBG_FPREG)
- sprintf(allowed, "1234567890deDE.+-");
+ _stprintf(allowed, L"1234567890deDE.+-");
switch (message) {
case WM_GETDLGCODE:
return DLGC_WANTALLKEYS;
ListboxEndEdit(hparent, FALSE);
return 0;
default:
- if (!strchr(allowed, wParam))
+ if (!_tcschr(allowed, wParam))
return 0;
break;
}
if (hdata) {
lptstr = GlobalLock(hdata);
if (lptstr) {
- if (strspn(lptstr, allowed) != strlen(lptstr))
+ if (_tcsspn(lptstr, allowed) != _tcslen(lptstr))
ok = 0;
GlobalUnlock(hdata);
}
RECT rc, ri;
HFONT hfont;
WNDPROC oldproc;
- char txt[MAX_LINEWIDTH + 1], tmp[MAX_LINEWIDTH + 1];
+ TCHAR txt[MAX_LINEWIDTH + 1], tmp[MAX_LINEWIDTH + 1];
if (!debugger_active || hedit)
return;
if (!hwnd)
}
else
return;
- hedit = CreateWindow("Edit", "Listbox Edit", WS_BORDER | WS_CHILD, 0, 0, 1, 1, hwnd, NULL, hInst, NULL);
+ hedit = CreateWindow(L"Edit", L"Listbox Edit", WS_BORDER | WS_CHILD, 0, 0, 1, 1, hwnd, NULL, hInst, NULL);
if (!hedit)
return;
size = GetTextSize(hwnd, NULL, 0);
SendMessage(hwnd, LB_GETITEMRECT, (WPARAM)index, (LPARAM)&ri);
SendMessage(hwnd, LB_GETTEXT, (WPARAM)index, (LPARAM)(LPTSTR)txt);
if (id == IDC_DBG_DASM || id == IDC_DBG_DASM2) {
- while (isxdigit(txt[offset + length]) && isspace(txt[offset + length + 4]))
+ while (_istxdigit(txt[offset + length]) && _istspace(txt[offset + length + 4]))
length += 5;
length--;
}
if (length > 0) {
int t = 0;
- if (!isxdigit(txt[offset])) {
- while (isxdigit(txt[offset + length - t - 1]) && isspace(txt[offset + length - t - 5]))
+ if (!_istxdigit(txt[offset])) {
+ while (_istxdigit(txt[offset + length - t - 1]) && _istspace(txt[offset + length - t - 5]))
t += 5;
offset += length - t + 1;
length = t - 1;
}
- else if (!isxdigit(txt[offset + length - 1])) {
- while (isxdigit(txt[offset + t]) && isspace(txt[offset + t + 4]))
+ else if (!_istxdigit(txt[offset + length - 1])) {
+ while (_istxdigit(txt[offset + t]) && _istspace(txt[offset + t + 4]))
t += 5;
length = t - 1;
}
ListboxEndEdit(hwnd, FALSE);
return;
}
- strncpy(tmp, txt + offset, length);
+ _tcsncmp(tmp, txt + offset, length);
tmp[length] = '\0';
radjust = GetTextSize(hwnd, tmp, TRUE);
}
else if (id == IDC_DBG_FPREG)
length = 20;
else
- length = strlen(txt + offset);
- strncpy(tmp, txt, offset);
+ length = _tcslen(txt + offset);
+ _tcsncmp(tmp, txt, offset);
tmp[offset] = '\0';
ri.left += GetTextSize(hwnd, tmp, TRUE);
if (radjust)
{
int size = GetTextSize(hwnd, NULL, 0);
int index = y / size;
- char txt[MAX_LINEWIDTH + 1];
+ TCHAR txt[MAX_LINEWIDTH + 1];
memset(txt, 0, MAX_LINEWIDTH + 1);
SendMessage(hwnd, LB_GETTEXT, (WPARAM)index, (LPARAM)(LPTSTR)txt);
{
int i, id, enable = TRUE, items = 0;
WNDPROC newproc = NULL, oldproc;
- char classname[CLASSNAMELENGTH];
+ TCHAR classname[CLASSNAMELENGTH];
WINDOWINFO pwi;
RECT *r;
break;
default:
if (GetClassName(hWnd, classname, CLASSNAMELENGTH)) {
- if (!strcmp(classname, "ListBox"))
+ if (!_tcscmp(classname, L"ListBox"))
newproc = ListboxProc;
- else if (!strcmp(classname, "Edit"))
+ else if (!_tcscmp(classname, L"Edit"))
newproc = EditProc;
}
break;
static void step(BOOL over)
{
if (over)
- strcpy(internalcmd, "z");
+ _tcscpy(internalcmd, L"z");
else
- strcpy(internalcmd, "t");
+ _tcscpy(internalcmd, L"t");
useinternalcmd = TRUE;
inputfinished = 1;
}
dbgwnd_miny = rw.bottom - rw.top;
GetClientRect(hDlg, &dlgRect);
newpos = 1;
- if (!regqueryint (NULL, "DebuggerPosX", &x))
+ if (!regqueryint (NULL, L"DebuggerPosX", &x))
newpos = 0;
- if (!regqueryint (NULL, "DebuggerPosY", &y))
+ if (!regqueryint (NULL, L"DebuggerPosY", &y))
newpos = 0;
- if (!regqueryint (NULL, "DebuggerPosW", &w))
+ if (!regqueryint (NULL, L"DebuggerPosW", &w))
newpos = 0;
- if (!regqueryint (NULL, "DebuggerPosH", &h))
+ if (!regqueryint (NULL, L"DebuggerPosH", &h))
newpos = 0;
if (newpos) {
RECT rc;
r->bottom -= r->top;
r->left += xoffset;
r->top += yoffset;
- regsetint (NULL, "DebuggerPosX", r->left);
- regsetint (NULL, "DebuggerPosY", r->top);
- regsetint (NULL, "DebuggerPosW", r->right);
- regsetint (NULL, "DebuggerPosH", r->bottom);
- regsetint (NULL, "DebuggerMaximized", (IsZoomed(hDlg) || (wp.flags & WPF_RESTORETOMAXIMIZED)) ? 1 : 0);
+ regsetint (NULL, L"DebuggerPosX", r->left);
+ regsetint (NULL, L"DebuggerPosY", r->top);
+ regsetint (NULL, L"DebuggerPosW", r->right);
+ regsetint (NULL, L"DebuggerPosH", r->bottom);
+ regsetint (NULL, L"DebuggerMaximized", (IsZoomed(hDlg) || (wp.flags & WPF_RESTORETOMAXIMIZED)) ? 1 : 0);
}
hDbgWnd = 0;
PostQuitMessage(0);
DRAWITEMSTRUCT *pdis = (DRAWITEMSTRUCT *)lParam;
HDC hdc = pdis->hDC;
RECT rc = pdis->rcItem;
- char text[MAX_LINEWIDTH + 1];
+ TCHAR text[MAX_LINEWIDTH + 1];
uae_u32 addr;
SetBkMode(hdc, TRANSPARENT);
if (wParam == IDC_DBG_STATUS) {
SetTextColor(hdc, GetSysColor(pstatuscolor[pdis->itemID]));
- DrawText(hdc, pname[pdis->itemID], lstrlen(pname[pdis->itemID]), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
+ DrawText(hdc, pname[pdis->itemID], _tcslen(pname[pdis->itemID]), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
return TRUE;
}
else {
}
SetTextColor(hdc, pdis->itemData);
if (wParam == IDC_DBG_DASM || wParam == IDC_DBG_DASM2) {
- char addrstr[11] = { '0', 'x', '\0'}, *btemp;
+ TCHAR addrstr[11] = { '0', 'x', '\0'}, *btemp;
int i, j, size = rc.bottom - rc.top;
- strncpy(addrstr + 2, text, 8);
+ _tcsncmp(addrstr + 2, text, 8);
addrstr[10] = 0;
- addr = strtoul(addrstr, NULL, 0);
+ addr = _tcstoul(addrstr, NULL, 0);
for (i = 0; i < BREAKPOINT_TOTAL; i++) {
if (addr == bpnodes[i].addr && bpnodes[i].enabled) {
int offset = 0;
btemp = NULL;
addrstr[2] = '\0';
while (ucbranch[i]) {
- if (!strncmp(text + 34, ucbranch[i], strlen(ucbranch[i]))) {
- btemp = strchr(text + 34, '=');
+ if (!_tcsncmp(text + 34, ucbranch[i], _tcslen(ucbranch[i]))) {
+ btemp = _tcschr(text + 34, '=');
if (btemp)
- strncpy(addrstr + 2, btemp + 4, 8);
+ _tcsncmp(addrstr + 2, btemp + 4, 8);
else {
- int pos = 34 + strlen(ucbranch[i]) + 3;
+ int pos = 34 + _tcslen(ucbranch[i]) + 3;
if (text[pos] == '$') //absolute addressing
- strncpy(addrstr + 2, text + pos + 1, 8);
- else if (text[pos] == '(' && isdigit(text[pos + 2])) { //address register indirect
- int reg = atoi(text + pos + 2);
+ _tcsncmp(addrstr + 2, text + pos + 1, 8);
+ else if (text[pos] == '(' && _istdigit(text[pos + 2])) { //address register indirect
+ int reg = _tstoi(text + pos + 2);
uae_u32 loc = m68k_areg (®s, reg);
- sprintf(addrstr + 2, "%08lx", loc);
+ _stprintf(addrstr + 2, L"%08lx", loc);
}
}
break;
}
i = 0;
while (addrstr[2] == '\0' && cbranch[i]) {
- if (!strncmp(text + 34, cbranch[i], strlen(cbranch[i]))) {
+ if (!_tcsncmp(text + 34, cbranch[i], _tcslen(cbranch[i]))) {
j = 0;
while (ccode[j]) {
- if (!strncmp(text + 34 + strlen(cbranch[i]), ccode[j], strlen(ccode[j]))) {
- btemp = strchr(text + 34, '=');
+ if (!_tcsncmp(text + 34 + _tcslen(cbranch[i]), ccode[j], _tcslen(ccode[j]))) {
+ btemp = _tcschr(text + 34, '=');
if (btemp)
- strncpy(addrstr + 2, btemp + 4, 8);
+ _tcsncmp(addrstr + 2, btemp + 4, 8);
break;
}
j++;
i++;
}
if (addrstr[2] != '\0') {
- uae_u32 branchaddr = strtoul(addrstr, NULL, 0);
+ uae_u32 branchaddr = _tcstoul(addrstr, NULL, 0);
if (branchaddr < addr)
- TextOut(hdc, rc.left, rc.top, "^", 1);
+ TextOut(hdc, rc.left, rc.top, L"^", 1);
else if (branchaddr > addr) {
HFONT hfontold = (HFONT)SelectObject(hdc, udfont);
- int width = GetTextSize(hDlg, "^", TRUE);
- TextOut(hdc, rc.left + width, rc.bottom, "^", 1);
+ int width = GetTextSize(hDlg, L"^", TRUE);
+ TextOut(hdc, rc.left + width, rc.bottom, L"^", 1);
SelectObject(hdc, hfontold);
}
else
- TextOut(hdc, rc.left, rc.top, "=", 1);
+ TextOut(hdc, rc.left, rc.top, L"=", 1);
}
rc.left += size;
if (addr == m68k_getpc(®s)) {
SetBkColor(hdc, GetSysColor(COLOR_HIGHLIGHT));
SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
}
- TextOut(hdc, rc.left, rc.top, text, strlen(text));
+ TextOut(hdc, rc.left, rc.top, text, _tcslen(text));
i = 0;
while (markinstr[i]) {
- if (!strncmp(text + 34, markinstr[i], strlen(markinstr[i]))) {
+ if (!_tcsncmp(text + 34, markinstr[i], _tcslen(markinstr[i]))) {
MoveToEx(hdc, rc.left, rc.bottom - 1, NULL);
LineTo(hdc, rc.right, rc.bottom - 1);
break;
DrawFocusRect(hdc, &rc);
}
else if (wParam == IDC_DBG_MEM || wParam == IDC_DBG_MEM2) {
- TextOut(hdc, rc.left, rc.top, text, strlen(text));
+ TextOut(hdc, rc.left, rc.top, text, _tcslen(text));
if ((pdis->itemState) & (ODS_SELECTED))
DrawFocusRect(hdc, &rc);
}
else
- TextOut(hdc, rc.left, rc.top, text, strlen(text));
+ TextOut(hdc, rc.left, rc.top, text, _tcslen(text));
return TRUE;
}
break;
return 0;
InitPages();
ShowPage(0, TRUE);
- if (!regqueryint (NULL, "DebuggerMaximized", &maximized))
+ if (!regqueryint (NULL, L"DebuggerMaximized", &maximized))
maximized = 0;
ShowWindow(hDbgWnd, maximized ? SW_SHOWMAXIMIZED : SW_SHOW);
UpdateWindow(hDbgWnd);
DestroyWindow(hDbgWnd);
}
-int console_get_gui (char *out, int maxlen)
+int console_get_gui (TCHAR *out, int maxlen)
{
MSG msg;
int ret;
inputfinished = 0;
if (useinternalcmd) {
useinternalcmd = FALSE;
- console_out("\n");
+ console_out(L"\n");
console_out(internalcmd);
- console_out("\n");
- strncpy(out, internalcmd, maxlen);
- return strlen(out);
+ console_out(L"\n");
+ _tcsncmp(out, internalcmd, maxlen);
+ return _tcslen(out);
}
else
return GetInput(out, maxlen);
void update_debug_info(void)
{
int i;
- char out[MAX_LINEWIDTH + 1];
+ TCHAR out[MAX_LINEWIDTH + 1];
HWND hwnd;
struct instr *dp;
struct mnemolookup *lookup1, *lookup2;
uae_u32 fpsr;
- char *fpsrflag[] = { "N: ", "Z: ", "I: ", "NAN: " };
+ TCHAR *fpsrflag[] = { L"N: ", L"Z: ", L"I: ", L"NAN: " };
if (!hDbgWnd)
return;
hwnd = GetDlgItem(hDbgWnd, IDC_DBG_DREG);
for (i = 0; i < 8; i++) {
- sprintf(out, "D%d: %08lX", i, m68k_dreg (®s, i));
+ _stprintf(out, L"D%d: %08lX", i, m68k_dreg (®s, i));
UpdateListboxString(hwnd, i, out, TRUE);
}
hwnd = GetDlgItem(hDbgWnd, IDC_DBG_AREG);
for (i = 0; i < 8; i++) {
hwnd = GetDlgItem(hDbgWnd, IDC_DBG_AREG);
- sprintf(out, "A%d: %08lX", i, m68k_areg (®s, i));
+ _stprintf(out, L"A%d: %08lX", i, m68k_areg (®s, i));
UpdateListboxString(hwnd, i, out, TRUE);
hwnd = GetDlgItem(hDbgWnd, IDC_DBG_AMEM);
dumpmem2(m68k_areg (®s, i), out, sizeof(out));
}
hwnd = GetDlgItem(hDbgWnd, IDC_DBG_CCR);
- UpdateListboxString(hwnd, 0, GET_XFLG(®s.ccrflags) ? "X: 1" : "X: 0", TRUE);
- UpdateListboxString(hwnd, 1, GET_NFLG(®s.ccrflags) ? "N: 1" : "N: 0", TRUE);
- UpdateListboxString(hwnd, 2, GET_ZFLG(®s.ccrflags) ? "Z: 1" : "Z: 0", TRUE);
- UpdateListboxString(hwnd, 3, GET_VFLG(®s.ccrflags) ? "V: 1" : "V: 0", TRUE);
- UpdateListboxString(hwnd, 4, GET_CFLG(®s.ccrflags) ? "C: 1" : "C: 0", TRUE);
+ UpdateListboxString(hwnd, 0, GET_XFLG(®s.ccrflags) ? L"X: 1" : L"X: 0", TRUE);
+ UpdateListboxString(hwnd, 1, GET_NFLG(®s.ccrflags) ? L"N: 1" : L"N: 0", TRUE);
+ UpdateListboxString(hwnd, 2, GET_ZFLG(®s.ccrflags) ? L"Z: 1" : L"Z: 0", TRUE);
+ UpdateListboxString(hwnd, 3, GET_VFLG(®s.ccrflags) ? L"V: 1" : L"V: 0", TRUE);
+ UpdateListboxString(hwnd, 4, GET_CFLG(®s.ccrflags) ? L"C: 1" : L"C: 0", TRUE);
hwnd = GetDlgItem(hDbgWnd, IDC_DBG_SP_VBR);
- sprintf(out, "USP: %08lX", regs.usp);
+ _stprintf(out, L"USP: %08lX", regs.usp);
UpdateListboxString(hwnd, 0, out, TRUE);
- sprintf(out, "ISP: %08lX", regs.isp);
+ _stprintf(out, L"ISP: %08lX", regs.isp);
UpdateListboxString(hwnd, 1, out, TRUE);
ShowMiscCPU(GetDlgItem(hDbgWnd, IDC_DBG_MISCCPU));
hwnd = GetDlgItem(hDbgWnd, IDC_DBG_MMISC);
- sprintf(out, "T: %d%d", regs.t1, regs.t0);
+ _stprintf(out, L"T: %d%d", regs.t1, regs.t0);
UpdateListboxString(hwnd, 0, out, TRUE);
- sprintf(out, "S: %d", regs.s);
+ _stprintf(out, L"S: %d", regs.s);
UpdateListboxString(hwnd, 1, out, TRUE);
- sprintf(out, "M: %d", regs.m);
+ _stprintf(out, L"M: %d", regs.m);
UpdateListboxString(hwnd, 2, out, TRUE);
- sprintf(out, "IMASK: %d", regs.intmask);
+ _stprintf(out, L"IMASK: %d", regs.intmask);
UpdateListboxString(hwnd, 3, out, TRUE);
- sprintf(out, "STP: %d", regs.stopped);
+ _stprintf(out, L"STP: %d", regs.stopped);
UpdateListboxString(hwnd, 4, out, TRUE);
hwnd = GetDlgItem(hDbgWnd, IDC_DBG_PC);
- sprintf(out, "PC: %08lX", m68k_getpc (®s));
+ _stprintf(out, L"PC: %08lX", m68k_getpc (®s));
UpdateListboxString(hwnd, 0, out, TRUE);
hwnd = GetDlgItem(hDbgWnd, IDC_DBG_PREFETCH);
for (lookup1 = lookuptab; lookup1->mnemo != dp->mnemo; lookup1++);
dp = table68k + regs.ir;
for (lookup2 = lookuptab; lookup2->mnemo != dp->mnemo; lookup2++);
- sprintf(out, "Prefetch: %04X (%s) %04X (%s)", regs.irc, lookup1->name, regs.ir, lookup2->name);
+ _stprintf(out, L"Prefetch: %04X (%s) %04X (%s)", regs.irc, lookup1->name, regs.ir, lookup2->name);
UpdateListboxString(hwnd, 0, out, TRUE);
ShowCustomSmall(GetDlgItem(hDbgWnd, IDC_DBG_MCUSTOM));
hwnd = GetDlgItem(hDbgWnd, IDC_DBG_FPREG);
for (i = 0; i < 8; i++) {
- sprintf(out, "FP%d: %g", i, regs.fp[i]);
+ _stprintf(out, L"FP%d: %g", i, regs.fp[i]);
UpdateListboxString(hwnd, i, out, TRUE);
}
hwnd = GetDlgItem(hDbgWnd, IDC_DBG_FPSR);
fpsr = get_fpsr();
for (i = 0; i < 4; i++) {
- sprintf(out, "%s%d", fpsrflag[i], (fpsr & (0x8000000 >> i)) != 0 ? 1 : 0);
+ _stprintf(out, L"%s%d", fpsrflag[i], (fpsr & (0x8000000 >> i)) != 0 ? 1 : 0);
UpdateListboxString(hwnd, i, out, TRUE);
}
ShowPage(currpage, TRUE);
extern int open_debug_window(void);
extern void close_debug_window(void);
-extern void WriteOutput(const char *out, int len);
-extern int GetInput (char *out, int maxlen);
-extern int console_get_gui (char *out, int maxlen);
+extern void WriteOutput(const TCHAR *out, int len);
+extern int GetInput (TCHAR *out, int maxlen);
+extern int console_get_gui (TCHAR *out, int maxlen);
#endif
int superdevice;
GUID iguid;
GUID pguid;
- char *name;
- char *sortname;
- char *configname;
+ TCHAR *name;
+ TCHAR *sortname;
+ TCHAR *configname;
int connection;
LPDIRECTINPUTDEVICE8 lpdi;
int axles;
int buttons, buttons_real;
int axismappings[MAX_MAPPINGS];
- char *axisname[MAX_MAPPINGS];
+ TCHAR *axisname[MAX_MAPPINGS];
int axissort[MAX_MAPPINGS];
int axistype[MAX_MAPPINGS];
int buttonmappings[MAX_MAPPINGS];
- char *buttonname[MAX_MAPPINGS];
+ TCHAR *buttonname[MAX_MAPPINGS];
int buttonsort[MAX_MAPPINGS];
int axisparent[MAX_MAPPINGS];
{
if (did->buttons > 0)
return;
- write_log ("'%s' has no buttons, adding single default button\n", did->name);
- did->buttonmappings[0] = DIJOFS_BUTTON(0);
+ write_log (L"'%s' has no buttons, adding single default button\n", did->name);
+ did->buttonmappings[0] = DIJOFS_BUTTON (0);
did->buttonsort[0] = 0;
- did->buttonname[0] = my_strdup("Button");
+ did->buttonname[0] = my_strdup (L"Button");
did->buttons++;
}
static void addplusminus (struct didata *did, int i)
{
- char tmp[256];
+ TCHAR tmp[256];
int j;
if (did->buttons + 1 >= MAX_MAPPINGS)
return;
for (j = 0; j < 2; j++) {
- sprintf (tmp, "%s [%c]", did->axisname[i], j ? '+' : '-');
+ _stprintf (tmp, L"%s [%c]", did->axisname[i], j ? '+' : '-');
did->buttonname[did->buttons] = my_strdup (tmp);
did->buttonmappings[did->buttons] = did->axismappings[i];
did->buttonsort[did->buttons] = 1000 + (did->axismappings[i] + did->axistype[i]) * 2 + j;
if (num == 0)
return 1;
if (pRegisterRawInputDevices (rid, num, sizeof (RAWINPUTDEVICE)) == FALSE) {
- write_log ("RAWINPUT registration failed %d (%d,%d->%d,%d->%d)\n",
+ write_log (L"RAWINPUT registration failed %d (%d,%d->%d,%d->%d)\n",
GetLastError (), num,
rawinput_registered_mouse, rm,
rawinput_registered_kb, rkb);
static int xmax, ymax, zmax;
static int xres, yres;
static int maxpres;
-static char *tabletname;
+static TCHAR *tabletname;
static int tablet_x, tablet_y, tablet_z, tablet_pressure, tablet_buttons, tablet_proximity;
static int tablet_ax, tablet_ay, tablet_az, tablet_flags;
void send_tablet (int x, int y, int z, int pres, uae_u32 buttons, int flags, int ax, int ay, int az, int rx, int ry, int rz, RECT *r)
{
- //write_log ("%d %d %d (%d,%d,%d), %08X %d\n", x, y, pres, ax, ay, az, buttons, proxi);
+ //write_log (L"%d %d %d (%d,%d,%d), %08X %d\n", x, y, pres, ax, ay, az, buttons, proxi);
if (axmax > 0)
ax = ax * 255 / axmax;
else
lc.lcInExtY = ty.axMax;
if (zmax > 0)
lc.lcInExtZ = tz.axMax;
- write_log ("Tablet '%s' parameters\n", tabletname);
- write_log ("Xmax=%d,Ymax=%d,Zmax=%d\n", xmax, ymax, zmax);
- write_log ("Xres=%.1f:%d,Yres=%.1f:%d,Zres=%.1f:%d\n",
+ write_log (L"Tablet '%s' parameters\n", tabletname);
+ write_log (L"Xmax=%d,Ymax=%d,Zmax=%d\n", xmax, ymax, zmax);
+ write_log (L"Xres=%.1f:%d,Yres=%.1f:%d,Zres=%.1f:%d\n",
tx.axResolution / 65536.0, tx.axUnits, ty.axResolution / 65536.0, ty.axUnits, tz.axResolution / 65536.0, tz.axUnits);
- write_log ("Xrotmax=%d,Yrotmax=%d,Zrotmax=%d\n", axmax, aymax, azmax);
- write_log ("PressureMin=%d,PressureMax=%d\n", pres.axMin, pres.axMax);
+ write_log (L"Xrotmax=%d,Yrotmax=%d,Zrotmax=%d\n", axmax, aymax, azmax);
+ write_log (L"PressureMin=%d,PressureMax=%d\n", pres.axMin, pres.axMax);
maxpres = pres.axMax;
xres = gettabletres (&tx);
yres = gettabletres (&ty);
static int initialize_tablet (void)
{
HANDLE h;
- char name[MAX_DPATH];
+ TCHAR name[MAX_DPATH];
struct tagAXIS ori[3];
int tilt = 0;
- h = LoadLibrary ("wintab32.dll");
+ h = LoadLibrary (L"wintab32.dll");
if (h == NULL) {
- write_log ("Tablet: no wintab32.dll\n");
+ write_log (L"Tablet: no wintab32.dll\n");
return 0;
}
FreeLibrary (h);
if (!WTInfo (0, 0, NULL)) {
- write_log ("Tablet: WTInfo() returned failure\n");
+ write_log (L"Tablet: WTInfo() returned failure\n");
return 0;
}
WTInfo (WTI_DEVICES, DVC_NAME, name);
if (ori[2].axMax > 0)
azmax = ori[2].axMax;
}
- write_log ("Tablet '%s' detected\n", name);
+ write_log (L"Tablet '%s' detected\n", name);
tabletname = my_strdup (name);
tablet = TRUE;
return 1;
static int initialize_catweasel (void)
{
int j, i;
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
struct didata *did;
if (catweasel_ismouse ()) {
cleardid(did);
did->connection = DIDC_CAT;
did->catweasel = i;
- sprintf (tmp, "Catweasel mouse");
+ _stprintf (tmp, L"Catweasel mouse");
did->name = my_strdup (tmp);
did->sortname = my_strdup (tmp);
- sprintf (tmp, "CWMOUSE%d", i);
+ _stprintf (tmp, L"CWMOUSE%d", i);
did->configname = my_strdup (tmp);
did->buttons = did->buttons_real = 3;
did->axles = 2;
did->axissort[0] = 0;
- did->axisname[0] = my_strdup ("X-Axis");
+ did->axisname[0] = my_strdup (L"X-Axis");
did->axissort[1] = 1;
- did->axisname[1] = my_strdup ("Y-Axis");
+ did->axisname[1] = my_strdup (L"Y-Axis");
for (j = 0; j < did->buttons; j++) {
did->buttonsort[j] = j;
- sprintf (tmp, "Button %d", j + 1);
+ _stprintf (tmp, L"Button %d", j + 1);
did->buttonname[j] = my_strdup (tmp);
}
did->priority = -1;
cleardid(did);
did->connection = DIDC_CAT;
did->catweasel = i;
- sprintf (tmp, "Catweasel joystick");
+ _stprintf (tmp, L"Catweasel joystick");
did->name = my_strdup (tmp);
did->sortname = my_strdup (tmp);
- sprintf (tmp, "CWJOY%d", i);
+ _stprintf (tmp, L"CWJOY%d", i);
did->configname = my_strdup (tmp);
did->buttons = did->buttons_real =(catweasel_isjoystick() & 0x80) ? 3 : 1;
did->axles = 2;
did->axissort[0] = 0;
- did->axisname[0] = my_strdup ("X-Axis");
+ did->axisname[0] = my_strdup (L"X-Axis");
did->axissort[1] = 1;
- did->axisname[1] = my_strdup ("Y-Axis");
+ did->axisname[1] = my_strdup (L"Y-Axis");
for (j = 0; j < did->buttons; j++) {
did->buttonsort[j] = j;
- sprintf (tmp, "Button %d", j + 1);
+ _stprintf (tmp, L"Button %d", j + 1);
did->buttonname[j] = my_strdup (tmp);
}
did->priority = -1;
}
-#define RDP_DEVICE1 "\\??\\Root#RDP_"
-#define RDP_DEVICE2 "\\\\?\\Root#RDP_"
+#define RDP_DEVICE1 L"\\??\\Root#RDP_"
+#define RDP_DEVICE2 L"\\\\?\\Root#RDP_"
-static int rdpdevice(char *buf)
+static int rdpdevice(TCHAR *buf)
{
- if (!memcmp (RDP_DEVICE1, buf, strlen (RDP_DEVICE1)))
+ if (!_tcsncmp (RDP_DEVICE1, buf, _tcslen (RDP_DEVICE1)))
return 1;
- if (!memcmp (RDP_DEVICE2, buf, strlen (RDP_DEVICE2)))
+ if (!_tcsncmp (RDP_DEVICE2, buf, _tcslen (RDP_DEVICE2)))
return 1;
return 0;
}
-static void rawinputfixname (const char *name, const char *friendlyname)
+static void rawinputfixname (const TCHAR *name, const TCHAR *friendlyname)
{
int i, ii, j;
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
- sprintf (tmp, "\\\\?\\%s", name);
- for (i = 4; i < strlen (tmp); i++) {
+ _stprintf (tmp, L"\\\\?\\%s", name);
+ for (i = 4; i < _tcslen (tmp); i++) {
if (tmp[i] == '\\')
tmp[i] = '#';
- tmp[i] = toupper (tmp[i]);
+ tmp[i] = _totupper (tmp[i]);
}
for (ii = 0; ii < 2; ii++) {
for (i = 0; i < (ii == 0 ? num_mouse : num_keyboard); i++) {
struct didata *did = ii == 0 ? &di_mouse[i] : &di_keyboard[i];
- char tmp2[MAX_DPATH];
+ TCHAR tmp2[MAX_DPATH];
if (!did->rawinput)
continue;
- for (j = 0; j < strlen (did->configname); j++)
- tmp2[j] = toupper (did->configname[j]);
+ for (j = 0; j < _tcslen (did->configname); j++)
+ tmp2[j] = _totupper (did->configname[j]);
tmp2[j] = 0;
- if (strlen (tmp2) >= strlen (tmp) && !memcmp (tmp2, tmp, strlen (tmp))) {
+ if (_tcslen (tmp2) >= _tcslen (tmp) && !_tcsncmp (tmp2, tmp, _tcslen (tmp))) {
xfree (did->name);
xfree (did->sortname);
did->name = my_strdup (friendlyname);
did->sortname = my_strdup (friendlyname);
- write_log ("'%s' ('%s')\n", did->name, did->configname);
+ write_log (L"'%s' ('%s')\n", did->name, did->configname);
}
}
}
SP_DEVINFO_DATA dd;
dd.cbSize = sizeof dd;
for (i = 0; SetupDiEnumDeviceInfo (di, i, &dd); i++) {
- char buf[MAX_DPATH];
+ TCHAR buf[MAX_DPATH];
DWORD size = 0;
if (SetupDiGetDeviceInstanceId (di, &dd, buf, sizeof buf , &size)) {
- char fname[MAX_DPATH];
+ TCHAR fname[MAX_DPATH];
DWORD dt;
fname[0] = 0;
size = 0;
}
}
-static char *rawkeyboardlabels[] =
+static TCHAR *rawkeyboardlabels[] =
{
- "ESCAPE",
- "1","2","3","4","5","6","7","8","9","0",
- "MINUS","EQUALS","BACK","TAB",
- "Q","W","E","R","T","Y","U","I","O","P",
- "LBRACKET","RBRACKET","RETURN","LCONTROL",
- "A","S","D","F","G","H","J","K","L",
- "SEMICOLON","APOSTROPHE","GRAVE","LSHIFT","BACKSLASH",
- "Z","X","C","V","B","N","M",
- "COMMA","PERIOD","SLASH","RSHIFT","MULTIPLY","LMENU","SPACE","CAPITAL",
- "F1","F2","F3","F4","F5","F6","F7","F8","F9","F10",
- "NULOCK","SCROLL","NUMPAD7","NUMPAD8","NUMPAD9","SUBTRACT",
- "NUMPAD4","NUMPAD5","NUMPAD6","ADD","NUMPAD1","NUMPAD2","NUMPAD3","NUMPAD0",
- "DECIMAL",NULL,NULL,"OEM_102","F11","F12",
+ L"ESCAPE",
+ L"1",L"2",L"3",L"4",L"5",L"6",L"7",L"8",L"9",L"0",
+ L"MINUS",L"EQUALS",L"BACK",L"TAB",
+ L"Q",L"W",L"E",L"R",L"T",L"Y",L"U",L"I",L"O",L"P",
+ L"LBRACKET",L"RBRACKET",L"RETURN",L"LCONTROL",
+ L"A",L"S",L"D",L"F",L"G",L"H",L"J",L"K",L"L",
+ L"SEMICOLON",L"APOSTROPHE",L"GRAVE",L"LSHIFT",L"BACKSLASH",
+ L"Z",L"X",L"C",L"V",L"B",L"N",L"M",
+ L"COMMA",L"PERIOD",L"SLASH",L"RSHIFT",L"MULTIPLY",L"LMENU",L"SPACE",L"CAPITAL",
+ L"F1",L"F2",L"F3",L"F4",L"F5",L"F6",L"F7",L"F8",L"F9",L"F10",
+ L"NULOCK",L"SCROLL",L"NUMPAD7",L"NUMPAD8",L"NUMPAD9",L"SUBTRACT",
+ L"NUMPAD4",L"NUMPAD5",L"NUMPAD6",L"ADD",L"NUMPAD1",L"NUMPAD2",L"NUMPAD3",L"NUMPAD0",
+ L"DECIMAL",NULL,NULL,L"OEM_102",L"F11",L"F12",
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,
- "NUMPADEQUALS",NULL,NULL,
- "PREVTRACK",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
- "NEXTTRACK",NULL,NULL,"NUMPADENTER","RCONTROL",NULL,NULL,
- "MUTE","CALCULATOR","PLAYPAUSE",NULL,"MEDIASTOP",
+ L"NUMPADEQUALS",NULL,NULL,
+ L"PREVTRACK",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+ L"NEXTTRACK",NULL,NULL,L"NUMPADENTER",L"RCONTROL",NULL,NULL,
+ L"MUTE",L"CALCULATOR",L"PLAYPAUSE",NULL,L"MEDIASTOP",
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
- "VOLUMEDOWN",NULL,"VOLUMEUP",NULL,"WEBHOME","NUMPADCOMMA",NULL,
- "DIVIDE",NULL,"SYSRQ","RMENU",
+ L"VOLUMEDOWN",NULL,L"VOLUMEUP",NULL,L"WEBHOME",L"NUMPADCOMMA",NULL,
+ L"DIVIDE",NULL,L"SYSRQ",L"RMENU",
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
- "PAUSE",NULL,"HOME","UP","PRIOR",NULL,"LEFT",NULL,"RIGHT",NULL,"END",
- "DOWN","NEXT","INSERT","DELETE",
+ L"PAUSE",NULL,L"HOME",L"UP",L"PRIOR",NULL,L"LEFT",NULL,L"RIGHT",NULL,L"END",
+ L"DOWN",L"NEXT",L"INSERT",L"DELETE",
NULL,NULL,NULL,NULL,NULL,NULL,NULL,
- "LWIN","RWIN","APPS","POWER","SLEEP",
+ L"LWIN",L"RWIN",L"APPS",L"POWER",L"SLEEP",
NULL,NULL,NULL,
- "WAKE",NULL,"WEBSEARCH","WEBFAVORITES","WEBREFRESH","WEBSTOP",
- "WEBFORWARD","WEBBACK","MYCOMPUTER","MAIL","MEDIASELECT",
- ""
+ L"WAKE",NULL,L"WEBSEARCH",L"WEBFAVORITES",L"WEBREFRESH",L"WEBSTOP",
+ L"WEBFORWARD",L"WEBBACK",L"MYCOMPUTER",L"MAIL",L"MEDIASELECT",
+ L""
};
static int initialize_rawinput (void)
RAWINPUTDEVICELIST *ridl = 0;
int num = 500, gotnum, i, bufsize, vtmp;
int rnum_mouse, rnum_kb, rnum_raw;
- uae_u8 *buf = 0;
+ TCHAR *buf = NULL;
int rmouse = 0, rkb = 0;
- char tmp[100];
+ TCHAR tmp[100];
if (no_rawinput)
goto error;
pRegisterRawInputDevices = (REGISTERRAWINPUTDEVICES)GetProcAddress (
- GetModuleHandle ("user32.dll"), "RegisterRawInputDevices");
+ GetModuleHandle (L"user32.dll"), "RegisterRawInputDevices");
pGetRawInputData = (GETRAWINPUTDATA)GetProcAddress (
- GetModuleHandle ("user32.dll"), "GetRawInputData");
+ GetModuleHandle (L"user32.dll"), "GetRawInputData");
pGetRawInputDeviceList = (GETRAWINPUTDEVICELIST)GetProcAddress (
- GetModuleHandle ("user32.dll"), "GetRawInputDeviceList");
+ GetModuleHandle (L"user32.dll"), "GetRawInputDeviceList");
pGetRawInputDeviceInfo = (GETRAWINPUTDEVICEINFO)GetProcAddress (
- GetModuleHandle ("user32.dll"), "GetRawInputDeviceInfoA");
+ GetModuleHandle (L"user32.dll"), "GetRawInputDeviceInfoW");
pGetRawInputBuffer = (GETRAWINPUTBUFFER)GetProcAddress (
- GetModuleHandle ("user32.dll"), "GetRawInputBuffer");
+ GetModuleHandle (L"user32.dll"), "GetRawInputBuffer");
pDefRawInputProc = (DEFRAWINPUTPROC)GetProcAddress (
- GetModuleHandle ("user32.dll"), "DefRawInputProc");
+ GetModuleHandle (L"user32.dll"), "DefRawInputProc");
if (!pRegisterRawInputDevices || !pGetRawInputData || !pGetRawInputDeviceList ||
!pGetRawInputDeviceInfo || !pGetRawInputBuffer || !pDefRawInputProc)
goto error;
- bufsize = 10000;
+ bufsize = 10000 * sizeof (TCHAR);
buf = xmalloc (bufsize);
register_rawinput ();
if (pGetRawInputDeviceList (NULL, &num, sizeof (RAWINPUTDEVICELIST)) != 0) {
- write_log ("RAWINPUT error %08X\n", GetLastError());
+ write_log (L"RAWINPUT error %08X\n", GetLastError());
goto error2;
}
- write_log ("RAWINPUT: found %d devices\n", num);
+ write_log (L"RAWINPUT: found %d devices\n", num);
if (num <= 0)
goto error2;
- ridl = xcalloc (sizeof(RAWINPUTDEVICELIST), num);
+ ridl = xcalloc (sizeof (RAWINPUTDEVICELIST), num);
gotnum = pGetRawInputDeviceList (ridl, &num, sizeof (RAWINPUTDEVICELIST));
if (gotnum <= 0) {
- write_log ("RAWINPUT didn't find any devices\n");
+ write_log (L"RAWINPUT didn't find any devices\n");
goto error2;
}
rnum_raw = rnum_mouse = rnum_kb = 0;
rnum_raw++;
cleardid (did);
- sprintf (tmp, "%s", type == RIM_TYPEMOUSE ? "RAW Mouse" : "RAW Keyboard");
+ _stprintf (tmp, L"%s", type == RIM_TYPEMOUSE ? L"RAW Mouse" : L"RAW Keyboard");
did->name = my_strdup (tmp);
did->rawinput = h;
did->connection = DIDC_RAW;
- write_log ("%p %s: ", h, type == RIM_TYPEMOUSE ? "mouse" : "keyboard");
+ write_log (L"%p %s: ", h, type == RIM_TYPEMOUSE ? L"mouse" : L"keyboard");
did->sortname = my_strdup (buf);
- write_log ("'%s'\n", buf);
+ write_log (L"'%s'\n", buf);
did->configname = my_strdup (buf);
rdi = (PRID_DEVICE_INFO)buf;
memset (rdi, 0, sizeof (RID_DEVICE_INFO));
if (type == RIM_TYPEMOUSE) {
PRID_DEVICE_INFO_MOUSE rdim = &rdi->mouse;
- write_log ("id=%d buttons=%d hw=%d rate=%d\n",
+ write_log (L"id=%d buttons=%d hw=%d rate=%d\n",
rdim->dwId, rdim->dwNumberOfButtons, rdim->fHasHorizontalWheel, rdim->dwSampleRate);
if (rdim->dwNumberOfButtons >= MAX_MAPPINGS) {
- write_log ("bogus number of buttons, ignored\n");
+ write_log (L"bogus number of buttons, ignored\n");
continue;
}
did->buttons_real = did->buttons = rdim->dwNumberOfButtons;
for (j = 0; j < did->buttons; j++) {
did->buttonsort[j] = j;
- sprintf (tmp, "Button %d", j + 1);
+ _stprintf (tmp, L"Button %d", j + 1);
did->buttonname[j] = my_strdup (tmp);
}
did->axles = 3;
did->axissort[0] = 0;
- did->axisname[0] = my_strdup ("X-Axis");
+ did->axisname[0] = my_strdup (L"X-Axis");
did->axissort[1] = 1;
- did->axisname[1] = my_strdup ("Y-Axis");
+ did->axisname[1] = my_strdup (L"Y-Axis");
did->axissort[2] = 2;
- did->axisname[2] = my_strdup ("Wheel");
+ did->axisname[2] = my_strdup (L"Wheel");
addplusminus (did, 2);
if (rdim->fHasHorizontalWheel) {
did->axissort[3] = 3;
- did->axisname[3] = my_strdup ("HWheel");
+ did->axisname[3] = my_strdup (L"HWheel");
did->axles++;
addplusminus (did, 3);
}
} else {
int j;
PRID_DEVICE_INFO_KEYBOARD rdik = &rdi->keyboard;
- write_log ("type=%d sub=%d mode=%d fkeys=%d indicators=%d tkeys=%d",
+ write_log (L"type=%d sub=%d mode=%d fkeys=%d indicators=%d tkeys=%d",
rdik->dwType, rdik->dwSubType, rdik->dwKeyboardMode,
rdik->dwNumberOfFunctionKeys, rdik->dwNumberOfIndicators, rdik->dwNumberOfKeysTotal);
j = 0;
for (i = 0; i < 254; i++) {
- char tmp[100];
+ TCHAR tmp[100];
tmp[0] = 0;
if (rawkeyboardlabels[j] != NULL) {
if (rawkeyboardlabels[j][0]) {
- strcpy (tmp, rawkeyboardlabels[j]);
+ _tcscpy (tmp, rawkeyboardlabels[j]);
j++;
}
} else {
j++;
}
if (!tmp[0])
- sprintf (tmp, "Key %02X", i + 1);
+ _stprintf (tmp, L"Key %02X", i + 1);
did->buttonname[i] = my_strdup (tmp);
did->buttonmappings[i] = i + 1;
did->buttonsort[i] = i + 1;
return 1;
error:
- write_log ("RAWINPUT not available or failed to initialize\n");
+ write_log (L"RAWINPUT not available or failed to initialize\n");
error2:
xfree (ridl);
xfree (buf);
static void initialize_windowsmouse (void)
{
struct didata *did = di_mouse;
- char tmp[100], *name;
+ TCHAR tmp[100], *name;
int i, j;
did += num_mouse;
if (num_mouse >= MAX_INPUT_DEVICES)
return;
num_mouse++;
- name = (i == 0) ? "Windows mouse" : "Mousehack mouse";
+ name = (i == 0) ? L"Windows mouse" : L"Mousehack mouse";
did->connection = DIDC_WIN;
- did->name = my_strdup (i ? "Mousehack mouse (Required for tablets)" : "Windows mouse");
- did->sortname = my_strdup (i ? "Windowsmouse2" : "Windowsmouse1");
- did->configname = my_strdup (i ? "WINMOUSE2" : "WINMOUSE1");
+ did->name = my_strdup (i ? L"Mousehack mouse (Required for tablets)" : L"Windows mouse");
+ did->sortname = my_strdup (i ? L"Windowsmouse2" : L"Windowsmouse1");
+ did->configname = my_strdup (i ? L"WINMOUSE2" : L"WINMOUSE1");
did->buttons = GetSystemMetrics (SM_CMOUSEBUTTONS);
if (did->buttons < 3)
did->buttons = 3;
did->buttons_real = did->buttons;
for (j = 0; j < did->buttons; j++) {
did->buttonsort[j] = j;
- sprintf (tmp, "Button %d", j + 1);
+ _stprintf (tmp, L"Button %d", j + 1);
did->buttonname[j] = my_strdup (tmp);
}
winmousewheelbuttonstart = did->buttons;
did->axles = os_vista ? 4 : 3;
did->axissort[0] = 0;
- did->axisname[0] = my_strdup ("X-Axis");
+ did->axisname[0] = my_strdup (L"X-Axis");
did->axissort[1] = 1;
- did->axisname[1] = my_strdup ("Y-Axis");
+ did->axisname[1] = my_strdup (L"Y-Axis");
if (did->axles > 2) {
did->axissort[2] = 2;
- did->axisname[2] = my_strdup ("Wheel");
+ did->axisname[2] = my_strdup (L"Wheel");
addplusminus (did, 2);
}
if (did->axles > 3) {
did->axissort[3] = 3;
- did->axisname[3] = my_strdup ("HWheel");
+ did->axisname[3] = my_strdup (L"HWheel");
addplusminus (did, 3);
}
did->priority = 2;
break;
}
#ifdef DI_DEBUG_RAWINPUT
- write_log ("HANDLE=%08x %04x %04x %04x %08x %3d %3d %08x M=%d\n",
+ write_log (L"HANDLE=%08x %04x %04x %04x %08x %3d %3d %08x M=%d\n",
raw->header.hDevice,
rm->usFlags,
rm->usButtonFlags,
if (num == num_mouse)
return;
- if (focus) {
- if (mouseactive || isfullscreen () > 0) {
- for (i = 0; i < (5 > did->buttons ? did->buttons : 5); i++) {
- if (rm->usButtonFlags & (3 << (i * 2)))
- setmousebuttonstate (num, i, (rm->usButtonFlags & (1 << (i * 2))) ? 1 : 0);
- }
- if (did->buttons > 5) {
- for (i = 5; i < did->buttons; i++)
- setmousebuttonstate (num, i, (rm->ulRawButtons & (1 << i)) ? 1 : 0);
- }
- if (did->buttons >= 3 && (rm->usButtonFlags & RI_MOUSE_MIDDLE_BUTTON_DOWN)) {
- if (currprefs.win32_middle_mouse) {
- if (isfullscreen () > 0)
- minimizewindow ();
- if (mouseactive)
- setmouseactive(0);
- }
- }
+ if (isfocus () > 0) {
+ for (i = 0; i < (5 > did->buttons ? did->buttons : 5); i++) {
+ if (rm->usButtonFlags & (3 << (i * 2)))
+ setmousebuttonstate (num, i, (rm->usButtonFlags & (1 << (i * 2))) ? 1 : 0);
+ }
+ if (did->buttons > 5) {
+ for (i = 5; i < did->buttons; i++)
+ setmousebuttonstate (num, i, (rm->ulRawButtons & (1 << i)) ? 1 : 0);
}
if (rm->usButtonFlags & RI_MOUSE_WHEEL) {
int val = (short)rm->usButtonData;
setmousestate (num, 0, rm->lLastX, (rm->usFlags & MOUSE_MOVE_ABSOLUTE) ? 1 : 0);
setmousestate (num, 1, rm->lLastY, (rm->usFlags & MOUSE_MOVE_ABSOLUTE) ? 1 : 0);
}
+ if (isfocus ()) {
+ if (did->buttons >= 3 && (rm->usButtonFlags & RI_MOUSE_MIDDLE_BUTTON_DOWN)) {
+ if (currprefs.win32_middle_mouse) {
+ if (isfullscreen () > 0)
+ minimizewindow ();
+ if (mouseactive)
+ setmouseactive(0);
+ }
+ }
+ }
} else if (raw->header.dwType == RIM_TYPEKEYBOARD) {
int istest = inputdevice_istest ();
int pressed = (rk->Flags & RI_KEY_BREAK) ? 0 : 1;
#ifdef DI_DEBUG_RAWINPUT
- write_log ("HANDLE=%x CODE=%x Flags=%x VK=%x MSG=%x EXTRA=%x\n",
+ write_log (L"HANDLE=%x CODE=%x Flags=%x VK=%x MSG=%x EXTRA=%x\n",
raw->header.hDevice,
raw->data.keyboard.MakeCode,
raw->data.keyboard.Flags,
inputdevice_do_keyboard (scancode, pressed);
} else {
scancode = keyhack (scancode, pressed, num);
- if (scancode < 0)
+ if (scancode < 0 || isfocus () <= 0)
return;
di_keycodes[num][scancode] = pressed;
if (stopoutput == 0)
}
}
-static void unacquire (LPDIRECTINPUTDEVICE8 lpdi, char *txt)
+static void unacquire (LPDIRECTINPUTDEVICE8 lpdi, TCHAR *txt)
{
if (lpdi) {
HRESULT hr = IDirectInputDevice8_Unacquire (lpdi);
if (FAILED (hr) && hr != DI_NOEFFECT)
- write_log ("unacquire %s failed, %s\n", txt, DXError (hr));
+ write_log (L"unacquire %s failed, %s\n", txt, DXError (hr));
}
}
-static int acquire (LPDIRECTINPUTDEVICE8 lpdi, char *txt)
+static int acquire (LPDIRECTINPUTDEVICE8 lpdi, TCHAR *txt)
{
HRESULT hr = DI_OK;
if (lpdi) {
hr = IDirectInputDevice8_Acquire (lpdi);
if (FAILED (hr) && hr != 0x80070005) {
- write_log ("acquire %s failed, %s\n", txt, DXError (hr));
+ write_log (L"acquire %s failed, %s\n", txt, DXError (hr));
}
}
return SUCCEEDED (hr) ? 1 : 0;
}
-static int setcoop (struct didata *did, DWORD mode, char *txt)
+static int setcoop (struct didata *did, DWORD mode, TCHAR *txt)
{
HRESULT hr = DI_OK;
if (did->lpdi) {
if (!did->coop && hMainWnd) {
hr = IDirectInputDevice8_SetCooperativeLevel (did->lpdi, hMainWnd, mode);
if (FAILED (hr) && hr != E_NOTIMPL) {
- write_log ("setcooperativelevel %s failed, %s\n", txt, DXError (hr));
+ write_log (L"setcooperativelevel %s failed, %s\n", txt, DXError (hr));
} else {
did->coop = 1;
- //write_log ("cooperativelevel %s set\n", txt);
+ //write_log (L"cooperativelevel %s set\n", txt);
}
}
}
dd[i].type = type;
for (j = i + 1; j < num; j++) {
dd[j].type = type;
- if (dd[i].priority < dd[j].priority || (dd[i].priority == dd[j].priority && strcmp (dd[i].sortname, dd[j].sortname) > 0)) {
+ if (dd[i].priority < dd[j].priority || (dd[i].priority == dd[j].priority && _tcscmp (dd[i].sortname, dd[j].sortname) > 0)) {
memcpy (&ddtmp, &dd[i], sizeof (ddtmp));
memcpy (&dd[i], &dd[j], sizeof (ddtmp));
memcpy (&dd[j], &ddtmp, sizeof (ddtmp));
/* rename duplicate names */
for (i = 0; i < num; i++) {
for (j = i + 1; j < num; j++) {
- if (!strcmp (dd[i].name, dd[j].name)) {
+ if (!_tcscmp (dd[i].name, dd[j].name)) {
int cnt = 1;
- char tmp[MAX_DPATH], tmp2[MAX_DPATH];
- strcpy (tmp2, dd[i].name);
+ TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH];
+ _tcscpy (tmp2, dd[i].name);
for (j = i; j < num; j++) {
- if (!strcmp (tmp2, dd[j].name)) {
- sprintf (tmp, "%s [%d]", dd[j].name, cnt++);
+ if (!_tcscmp (tmp2, dd[j].name)) {
+ _stprintf (tmp, L"%s [%d]", dd[j].name, cnt++);
xfree (dd[j].name);
dd[j].name = my_strdup (tmp);
}
}
-static void sortobjects (struct didata *did, int *mappings, int *sort, char **names, int *types, int num)
+static void sortobjects (struct didata *did, int *mappings, int *sort, TCHAR **names, int *types, int num)
{
int i, j, tmpi;
- char *tmpc;
+ TCHAR *tmpc;
for (i = 0; i < num; i++) {
for (j = i + 1; j < num; j++) {
}
#ifdef DI_DEBUG
if (num > 0) {
- write_log ("%s (PGUID=%s):\n", did->name, outGUID (&did->pguid));
+ write_log (L"%s (PGUID=%s):\n", did->name, outGUID (&did->pguid));
for (i = 0; i < num; i++)
- write_log ("%02X %03d '%s' (%d,%d)\n", mappings[i], mappings[i], names[i], sort[i], types ? types[i] : -1);
+ write_log (L"%02X %03d '%s' (%d,%d)\n", mappings[i], mappings[i], names[i], sort[i], types ? types[i] : -1);
}
#endif
}
{
struct didata *did = pContext;
int i;
- char tmp[100];
+ TCHAR tmp[100];
#if 0
if (pdidoi->dwOfs != DIDFT_GETINSTANCE (pdidoi->dwType))
- write_log ("%x-%s: %x <> %x\n", pdidoi->dwType & 0xff, pdidoi->tszName,
+ write_log (L"%x-%s: %x <> %x\n", pdidoi->dwType & 0xff, pdidoi->tszName,
pdidoi->dwOfs, DIDFT_GETINSTANCE (pdidoi->dwType));
#endif
if (pdidoi->dwType & DIDFT_AXIS) {
if (sort < 0) {
for (i = 0; i < did->axles; i++) {
if (did->axissort[i] == sort) {
- write_log ("ignored duplicate '%s'\n", pdidoi->tszName);
+ write_log (L"ignored duplicate '%s'\n", pdidoi->tszName);
return DIENUM_CONTINUE;
}
}
did->axissort[did->axles] = makesort_mouse (&pdidoi->guidType, &did->axismappings[did->axles]);
for (i = 0; i < 2; i++) {
did->axismappings[did->axles + i] = DIJOFS_POV(numpov);
- sprintf (tmp, "%s (%d)", pdidoi->tszName, i + 1);
+ _stprintf (tmp, L"%s (%d)", pdidoi->tszName, i + 1);
did->axisname[did->axles + i] = my_strdup (tmp);
did->axissort[did->axles + i] = did->axissort[did->axles];
did->axistype[did->axles + i] = i + 1;
return DIENUM_CONTINUE;
}
-static void trimws (char *s)
+static void trimws (TCHAR *s)
{
/* Delete trailing whitespace. */
- int len = strlen (s);
- while (len > 0 && strcspn (s + len - 1, "\t \r\n") == 0)
+ int len = _tcslen (s);
+ while (len > 0 && _tcscspn (s + len - 1, L"\t \r\n") == 0)
s[--len] = '\0';
}
{
struct didata *did;
int len, type;
- char *typetxt;
- char tmp[100];
+ TCHAR *typetxt;
+ TCHAR tmp[100];
type = lpddi->dwDevType & 0xff;
if (type == DI8DEVTYPE_MOUSE || type == DI8DEVTYPE_SCREENPOINTER) {
did = di_mouse;
- typetxt = "Mouse";
+ typetxt = L"Mouse";
} else if (type == DI8DEVTYPE_GAMEPAD || type == DI8DEVTYPE_JOYSTICK ||
type == DI8DEVTYPE_FLIGHT || type == DI8DEVTYPE_DRIVING || type == DI8DEVTYPE_1STPERSON) {
did = di_joystick;
- typetxt = "Game controller";
+ typetxt = L"Game controller";
} else if (type == DI8DEVTYPE_KEYBOARD) {
did = di_keyboard;
- typetxt = "Keyboard";
+ typetxt = L"Keyboard";
} else {
did = NULL;
- typetxt = "Unknown";
+ typetxt = L"Unknown";
}
#ifdef DI_DEBUG
- write_log ("I=%s ", outGUID (&lpddi->guidInstance));
- write_log ("P=%s\n", outGUID (&lpddi->guidProduct));
- write_log ("'%s' '%s' %08X [%s]\n", lpddi->tszProductName, lpddi->tszInstanceName, lpddi->dwDevType, typetxt);
+ write_log (L"I=%s ", outGUID (&lpddi->guidInstance));
+ write_log (L"P=%s\n", outGUID (&lpddi->guidProduct));
+ write_log (L"'%s' '%s' %08X [%s]\n", lpddi->tszProductName, lpddi->tszInstanceName, lpddi->dwDevType, typetxt);
#endif
if (did == di_mouse) {
cleardid (did);
if (lpddi->tszInstanceName) {
- len = strlen (lpddi->tszInstanceName) + 5 + 1;
- did->name = malloc (len);
- strcpy (did->name, lpddi->tszInstanceName);
+ len = _tcslen (lpddi->tszInstanceName) + 5 + 1;
+ did->name = malloc (len * sizeof (TCHAR));
+ _tcscpy (did->name, lpddi->tszInstanceName);
} else {
did->name = malloc (100);
- sprintf(did->name, "[no name]");
+ _stprintf (did->name, L"[no name]");
}
trimws (did->name);
- sprintf (tmp, "%08X-%04X-%04X-%02X%02X%02X%02X%02X%02X%02X%02X %08X-%04X-%04X-%02X%02X%02X%02X%02X%02X%02X%02X",
+ _stprintf (tmp, L"%08X-%04X-%04X-%02X%02X%02X%02X%02X%02X%02X%02X %08X-%04X-%04X-%02X%02X%02X%02X%02X%02X%02X%02X",
lpddi->guidProduct.Data1, lpddi->guidProduct.Data2, lpddi->guidProduct.Data3,
lpddi->guidProduct.Data4[0], lpddi->guidProduct.Data4[1], lpddi->guidProduct.Data4[2], lpddi->guidProduct.Data4[3],
lpddi->guidProduct.Data4[4], lpddi->guidProduct.Data4[5], lpddi->guidProduct.Data4[6], lpddi->guidProduct.Data4[7],
if (!memcmp (&did->iguid, &GUID_SysKeyboard, sizeof (GUID)) || !memcmp (&did->iguid, &GUID_SysMouse, sizeof (GUID))) {
did->priority = 2;
did->superdevice = 1;
- strcat (did->name, " *");
+ _tcscat (did->name, L" *");
}
return DIENUM_CONTINUE;
}
di_dev_free (&di_mouse[i]);
di_dev_free (&di_keyboard[i]);
}
- hr = DirectInput8Create (hInst, DIRECTINPUT_VERSION, &IID_IDirectInput8A, (LPVOID *)&g_lpdi, NULL);
+ hr = DirectInput8Create (hInst, DIRECTINPUT_VERSION, &IID_IDirectInput8, (LPVOID *)&g_lpdi, NULL);
if (FAILED(hr)) {
- write_log ("DirectInput8Create failed, %s\n", DXError (hr));
- gui_message ("Failed to initialize DirectInput!");
+ write_log (L"DirectInput8Create failed, %s\n", DXError (hr));
+ gui_message (L"Failed to initialize DirectInput!");
return 0;
}
if (dinput_enum_all) {
- write_log ("DirectInput enumeration..\n");
+ write_log (L"DirectInput enumeration..\n");
IDirectInput8_EnumDevices (g_lpdi, DI8DEVCLASS_ALL, di_enumcallback, 0, DIEDFL_ATTACHEDONLY);
} else {
if (rawkeyboard <= 0) {
- write_log ("DirectInput enumeration.. Keyboards..\n");
+ write_log (L"DirectInput enumeration.. Keyboards..\n");
IDirectInput8_EnumDevices (g_lpdi, DI8DEVCLASS_KEYBOARD, di_enumcallback, 0, DIEDFL_ATTACHEDONLY);
}
- write_log ("DirectInput enumeration.. Pointing devices..\n");
+ write_log (L"DirectInput enumeration.. Pointing devices..\n");
IDirectInput8_EnumDevices (g_lpdi, DI8DEVCLASS_POINTER, di_enumcallback, 0, DIEDFL_ATTACHEDONLY);
- write_log ("DirectInput enumeration.. Game controllers..\n");
+ write_log (L"DirectInput enumeration.. Game controllers..\n");
IDirectInput8_EnumDevices (g_lpdi, DI8DEVCLASS_GAMECTRL, di_enumcallback, 0, DIEDFL_ATTACHEDONLY);
}
- write_log ("RawInput enumeration..\n");
+ write_log (L"RawInput enumeration..\n");
initialize_rawinput ();
- write_log ("Windowsmouse initialization..\n");
+ write_log (L"Windowsmouse initialization..\n");
initialize_windowsmouse ();
- write_log ("Catweasel joymouse initialization..\n");
+ write_log (L"Catweasel joymouse initialization..\n");
initialize_catweasel ();
- write_log ("wintab tablet initialization..\n");
+ write_log (L"wintab tablet initialization..\n");
initialize_tablet ();
- write_log ("end\n");
+ write_log (L"end\n");
sortdd (di_joystick, num_joystick, DID_JOYSTICK);
sortdd (di_mouse, num_mouse, DID_MOUSE);
return num_mouse;
}
-static char *get_mouse_friendlyname (int mouse)
+static TCHAR *get_mouse_friendlyname (int mouse)
{
return di_mouse[mouse].name;
}
-static char *get_mouse_uniquename (int mouse)
+static TCHAR *get_mouse_uniquename (int mouse)
{
return di_mouse[mouse].configname;
}
return -1;
}
-static int get_mouse_widget_type (int mouse, int num, char *name, uae_u32 *code)
+static int get_mouse_widget_type (int mouse, int num, TCHAR *name, uae_u32 *code)
{
struct didata *did = &di_mouse[mouse];
int buttons = did->buttons;
if (num >= axles && num < axles + buttons) {
if (name)
- strcpy (name, did->buttonname[num - did->axles]);
+ _tcscpy (name, did->buttonname[num - did->axles]);
return IDEV_WIDGET_BUTTON;
} else if (num < axles) {
if (name)
- strcpy (name, did->axisname[num]);
+ _tcscpy (name, did->axisname[num]);
return IDEV_WIDGET_AXIS;
}
return IDEV_WIDGET_NONE;
sortobjects (did, did->buttonmappings, did->buttonsort, did->buttonname, 0, did->buttons);
did->lpdi = lpdi;
} else {
- write_log ("mouse %d CreateDevice failed, %s\n", i, DXError (hr));
+ write_log (L"mouse %d CreateDevice failed, %s\n", i, DXError (hr));
}
}
}
DIPROPDWORD dipdw;
HRESULT hr;
- unacquire (lpdi, "mouse");
+ unacquire (lpdi, L"mouse");
if (did->connection == DIDC_DX && lpdi) {
- setcoop (&di_mouse[num], flags ? (DISCL_FOREGROUND | DISCL_EXCLUSIVE) : (DISCL_BACKGROUND | DISCL_NONEXCLUSIVE), "mouse");
+ setcoop (&di_mouse[num], flags ? (DISCL_FOREGROUND | DISCL_EXCLUSIVE) : (DISCL_BACKGROUND | DISCL_NONEXCLUSIVE), L"mouse");
dipdw.diph.dwSize = sizeof(DIPROPDWORD);
dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
dipdw.diph.dwObj = 0;
dipdw.dwData = DI_BUFFER;
hr = IDirectInputDevice8_SetProperty (lpdi, DIPROP_BUFFERSIZE, &dipdw.diph);
if (FAILED (hr))
- write_log ("mouse setpropertry failed, %s\n", DXError (hr));
- di_mouse[num].acquired = acquire (lpdi, "mouse") ? 1 : -1;
+ write_log (L"mouse setpropertry failed, %s\n", DXError (hr));
+ di_mouse[num].acquired = acquire (lpdi, L"mouse") ? 1 : -1;
} else {
di_mouse[num].acquired = 1;
}
static void unacquire_mouse (int num)
{
- unacquire (di_mouse[num].lpdi, "mouse");
+ unacquire (di_mouse[num].lpdi, L"mouse");
if (di_mouse[num].acquired > 0) {
if (di_mouse[num].rawinput)
rawmouse--;
int data = didod[j].dwData;
int state = (data & 0x80) ? 1 : 0;
#ifdef DI_DEBUG2
- write_log ("MOUSE: %d OFF=%d DATA=%d STATE=%d\n", i, dimofs, data, state);
+ write_log (L"MOUSE: %d OFF=%d DATA=%d STATE=%d\n", i, dimofs, data, state);
#endif
- if (istest || focus) {
- if (istest || mouseactive || fs) {
- for (k = 0; k < did->axles; k++) {
- if (did->axismappings[k] == dimofs)
- setmousestate (i, k, data, 0);
- }
- for (k = 0; k < did->buttons; k++) {
- if (did->buttonmappings[k] == dimofs) {
- if (did->axisparent[k] >= 0) {
- int dir = did->axisparentdir[k];
- int bstate = 0;
- if (dir)
- bstate = data > 0 ? 1 : 0;
- else
- bstate = data < 0 ? 1 : 0;
- if (bstate)
- setmousebuttonstate (i, k, -1);
- } else {
+ if (istest || isfocus () > 0) {
+ for (k = 0; k < did->axles; k++) {
+ if (did->axismappings[k] == dimofs)
+ setmousestate (i, k, data, 0);
+ }
+ for (k = 0; k < did->buttons; k++) {
+ if (did->buttonmappings[k] == dimofs) {
+ if (did->axisparent[k] >= 0) {
+ int dir = did->axisparentdir[k];
+ int bstate = 0;
+ if (dir)
+ bstate = data > 0 ? 1 : 0;
+ else
+ bstate = data < 0 ? 1 : 0;
+ if (bstate)
+ setmousebuttonstate (i, k, -1);
+ } else {
#ifdef SINGLEFILE
- if (k == 0)
- uae_quit ();
+ if (k == 0)
+ uae_quit ();
#endif
- if ((currprefs.win32_middle_mouse && k != 2) || !(currprefs.win32_middle_mouse))
- setmousebuttonstate (i, k, state);
- }
+ if ((currprefs.win32_middle_mouse && k != 2) || !(currprefs.win32_middle_mouse))
+ setmousebuttonstate (i, k, state);
}
}
}
- if (!istest && currprefs.win32_middle_mouse && dimofs == DIMOFS_BUTTON2 && state) {
- if (isfullscreen () > 0)
- minimizewindow ();
- if (mouseactive)
- setmouseactive (0);
- }
+ }
+ if (!istest && isfocus () && currprefs.win32_middle_mouse && dimofs == DIMOFS_BUTTON2 && state) {
+ if (isfullscreen () > 0)
+ minimizewindow ();
+ if (mouseactive)
+ setmouseactive (0);
}
}
} else if (hr == DIERR_INPUTLOST) {
- acquire (lpdi, "mouse");
+ acquire (lpdi, L"mouse");
} else if (did->acquired && hr == DIERR_NOTACQUIRED) {
- acquire (lpdi, "mouse");
+ acquire (lpdi, L"mouse");
}
IDirectInputDevice8_Poll (lpdi);
}
return num_keyboard;
}
-static char *get_kb_friendlyname (int kb)
+static TCHAR *get_kb_friendlyname (int kb)
{
return di_keyboard[kb].name;
}
-static char *get_kb_uniquename (int kb)
+static TCHAR *get_kb_uniquename (int kb)
{
return di_keyboard[kb].configname;
}
return 0;
}
-static int get_kb_widget_type (int kb, int num, char *name, uae_u32 *code)
+static int get_kb_widget_type (int kb, int num, TCHAR *name, uae_u32 *code)
{
if (name)
- sprintf (name, "[%02X] %s", di_keyboard[kb].buttonmappings[num], di_keyboard[kb].buttonname[num]);
+ _stprintf (name, L"[%02X] %s", di_keyboard[kb].buttonmappings[num], di_keyboard[kb].buttonname[num]);
if (code)
*code = di_keyboard[kb].buttonmappings[num];
return IDEV_WIDGET_KEY;
InputBuffer.LedFlags |= KEYBOARD_SCROLL_LOCK_ON;
if (!DeviceIoControl (kbhandle, IOCTL_KEYBOARD_SET_INDICATORS,
&InputBuffer, DataLength, NULL, 0, &ReturnedLength, NULL))
- write_log ("kbleds: DeviceIoControl() failed %d\n", GetLastError());
+ write_log (L"kbleds: DeviceIoControl() failed %d\n", GetLastError());
#endif
}
}
if (SUCCEEDED (hr)) {
hr = IDirectInputDevice8_SetDataFormat (lpdi, &c_dfDIKeyboard);
if (FAILED (hr))
- write_log ("keyboard setdataformat failed, %s\n", DXError (hr));
+ write_log (L"keyboard setdataformat failed, %s\n", DXError (hr));
memset (&dipdw, 0, sizeof (dipdw));
dipdw.diph.dwSize = sizeof (DIPROPDWORD);
dipdw.diph.dwHeaderSize = sizeof (DIPROPHEADER);
dipdw.dwData = DI_KBBUFFER;
hr = IDirectInputDevice8_SetProperty (lpdi, DIPROP_BUFFERSIZE, &dipdw.diph);
if (FAILED (hr))
- write_log ("keyboard setpropertry failed, %s\n", DXError (hr));
+ write_log (L"keyboard setpropertry failed, %s\n", DXError (hr));
IDirectInputDevice8_EnumObjects (lpdi, EnumObjectsCallback, did, DIDFT_ALL);
sortobjects (did, did->axismappings, did->axissort, did->axisname, did->axistype, did->axles);
sortobjects (did, did->buttonmappings, did->buttonsort, did->buttonname, 0, did->buttons);
did->lpdi = lpdi;
} else
- write_log ("keyboard CreateDevice failed, %s\n", DXError (hr));
+ write_log (L"keyboard CreateDevice failed, %s\n", DXError (hr));
}
}
keyboard_german = 0;
else
kc[i] = 0;
if (kc[i] != di_keycodes[num][i]) {
- write_log ("%02X -> %d\n", i, kc[i]);
+ write_log (L"%02X -> %d\n", i, kc[i]);
di_keycodes[num][i] = kc[i];
my_kbd_handler (num, i, kc[i]);
}
}
} else if (hr == DIERR_INPUTLOST) {
- acquire (lpdi, "keyboard");
+ acquire (lpdi, L"keyboard");
IDirectInputDevice8_Poll (lpdi);
return 0;
}
}
elements = DI_KBBUFFER;
hr = IDirectInputDevice8_GetDeviceData (lpdi, sizeof(DIDEVICEOBJECTDATA), didod, &elements, 0);
- if (SUCCEEDED (hr) || hr == DI_BUFFEROVERFLOW) {
+ if ((SUCCEEDED (hr) || hr == DI_BUFFEROVERFLOW) && isfocus () > 0) {
if (did->superdevice && (normalkb || rawkb))
continue;
for (j = 0; j < elements; j++) {
int scancode = didod[j].dwOfs;
int pressed = (didod[j].dwData & 0x80) ? 1 : 0;
- //write_log ("%d: %02X %d\n", j, scancode, pressed);
+ //write_log (L"%d: %02X %d\n", j, scancode, pressed);
if (!istest)
scancode = keyhack (scancode, pressed, i);
if (scancode < 0)
}
}
} else if (hr == DIERR_INPUTLOST) {
- acquire (lpdi, "keyboard");
+ acquire (lpdi, L"keyboard");
kb_do_refresh |= 1 << i;
} else if (did->acquired && hr == DIERR_NOTACQUIRED) {
- acquire (lpdi, "keyboard");
+ acquire (lpdi, L"keyboard");
}
IDirectInputDevice8_Poll (lpdi);
}
#ifdef CATWEASEL
{
- char kc;
+ uae_u8 kc;
if (stopoutput == 0 && catweasel_read_keyboard (&kc))
inputdevice_do_keyboard (kc & 0x7f, kc & 0x80);
}
{
LPDIRECTINPUTDEVICE8 lpdi = di_keyboard[num].lpdi;
- unacquire (lpdi, "keyboard");
+ unacquire (lpdi, L"keyboard");
if (currprefs.keyboard_leds_in_use) {
#ifdef WINDDK
if (!currprefs.win32_kbledmode) {
- if (DefineDosDevice (DDD_RAW_TARGET_PATH, "Kbd","\\Device\\KeyboardClass0")) {
- kbhandle = CreateFile ("\\\\.\\Kbd", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
+ if (DefineDosDevice (DDD_RAW_TARGET_PATH, L"Kbd", L"\\Device\\KeyboardClass0")) {
+ kbhandle = CreateFile (L"\\\\.\\Kbd", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (kbhandle == INVALID_HANDLE_VALUE) {
- write_log ("kbled: CreateFile failed, error %d\n", GetLastError());
+ write_log (L"kbled: CreateFile failed, error %d\n", GetLastError());
currprefs.win32_kbledmode = 1;
}
} else {
currprefs.win32_kbledmode = 1;
- write_log ("kbled: DefineDosDevice failed, error %d\n", GetLastError());
+ write_log (L"kbled: DefineDosDevice failed, error %d\n", GetLastError());
}
}
#else
set_leds (oldusedleds);
}
- setcoop (&di_keyboard[num], DISCL_NOWINKEY | DISCL_FOREGROUND | DISCL_EXCLUSIVE, "keyboard");
+ setcoop (&di_keyboard[num], DISCL_NOWINKEY | DISCL_FOREGROUND | DISCL_EXCLUSIVE, L"keyboard");
kb_do_refresh = ~0;
di_keyboard[num].acquired = -1;
- if (acquire (lpdi, "keyboard")) {
+ if (acquire (lpdi, L"keyboard")) {
if (di_keyboard[num].rawinput)
rawkb++;
else if (di_keyboard[num].superdevice)
{
LPDIRECTINPUTDEVICE8 lpdi = di_keyboard[num].lpdi;
- unacquire (lpdi, "keyboard");
+ unacquire (lpdi, L"keyboard");
if (di_keyboard[num].acquired > 0) {
if (di_keyboard[num].rawinput)
rawkb--;
#ifdef WINDDK
if (kbhandle != INVALID_HANDLE_VALUE) {
CloseHandle (kbhandle);
- DefineDosDevice (DDD_REMOVE_DEFINITION, "Kbd", NULL);
+ DefineDosDevice (DDD_REMOVE_DEFINITION, L"Kbd", NULL);
kbhandle = INVALID_HANDLE_VALUE;
}
#endif
return di_joystick[joy].axles + di_joystick[joy].buttons;
}
-static int get_joystick_widget_type (int joy, int num, char *name, uae_u32 *code)
+static int get_joystick_widget_type (int joy, int num, TCHAR *name, uae_u32 *code)
{
struct didata *did = &di_joystick[joy];
if (num >= did->axles && num < did->axles + did->buttons) {
if (name)
- strcpy (name, did->buttonname[num - did->axles]);
+ _tcscpy (name, did->buttonname[num - did->axles]);
return IDEV_WIDGET_BUTTON;
} else if (num < di_joystick[joy].axles) {
if (name)
- strcpy (name, did->axisname[num]);
+ _tcscpy (name, did->axisname[num]);
return IDEV_WIDGET_AXIS;
}
return IDEV_WIDGET_NONE;
return -1;
}
-static char *get_joystick_friendlyname (int joy)
+static TCHAR *get_joystick_friendlyname (int joy)
{
return di_joystick[joy].name;
}
-static char *get_joystick_uniquename (int joy)
+static TCHAR *get_joystick_uniquename (int joy)
{
return di_joystick[joy].configname;
}
if (!did->acquired)
continue;
if (did->connection == DIDC_CAT) {
- if (getjoystickstate (i)) {
+ if (getjoystickstate (i) && isfocus () > 0) {
/* only read CW state if it is really needed */
uae_u8 cdir, cbuttons;
if (catweasel_read_joystick (&cdir, &cbuttons)) {
continue;
elements = DI_BUFFER;
hr = IDirectInputDevice8_GetDeviceData (lpdi, sizeof (DIDEVICEOBJECTDATA), didod, &elements, 0);
- if (SUCCEEDED (hr) || hr == DI_BUFFEROVERFLOW) {
+ if ((SUCCEEDED (hr) || hr == DI_BUFFEROVERFLOW) && isfocus () > 0) {
for (j = 0; j < elements; j++) {
int dimofs = didod[j].dwOfs;
int data = didod[j].dwData;
if (bstate >= 0)
setjoybuttonstate (i, k, bstate);
#ifdef DI_DEBUG2
- write_log ("AB:NUM=%d OFF=%d AXIS=%d DIR=%d NAME=%s VAL=%d STATE=%d\n",
+ write_log (L"AB:NUM=%d OFF=%d AXIS=%d DIR=%d NAME=%s VAL=%d STATE=%d\n",
k, dimofs, axis, dir, did->buttonname[k], data, state);
#endif
} else if (did->axisparent[k] < 0 && did->buttonmappings[k] == dimofs) {
#ifdef DI_DEBUG2
- write_log ("B:NUM=%d OFF=%d NAME=%s VAL=%d STATE=%d\n",
+ write_log (L"B:NUM=%d OFF=%d NAME=%s VAL=%d STATE=%d\n",
k, dimofs, did->buttonname[k], data, state);
#endif
setjoybuttonstate (i, k, state);
} else if (did->axistype[k] == 2) {
setjoystickstate (i, k, ((data2 >= 29250 && data2 <= 33750) || (data2 >= 0 && data2 <= 6750)) ? -1 : (data2 >= 11250 && data2 <= 24750) ? 1 : 0, 1);
#ifdef DI_DEBUG2
- write_log ("P:NUM=%d OFF=%d NAME=%s VAL=%d\n", k, dimofs, did->axisname[k], data2);
+ write_log (L"P:NUM=%d OFF=%d NAME=%s VAL=%d\n", k, dimofs, did->axisname[k], data2);
#endif
} else if (did->axistype[k] == 0) {
#ifdef DI_DEBUG2
if (data < -20000 || data > 20000)
- write_log ("A:NUM=%d OFF=%d NAME=%s VAL=%d\n", k, dimofs, did->axisname[k], data);
+ write_log (L"A:NUM=%d OFF=%d NAME=%s VAL=%d\n", k, dimofs, did->axisname[k], data);
#endif
setjoystickstate (i, k, data, 32768);
}
}
} else if (hr == DIERR_INPUTLOST) {
- acquire (lpdi, "joystick");
+ acquire (lpdi, L"joystick");
} else if (did->acquired && hr == DIERR_NOTACQUIRED) {
- acquire (lpdi, "joystick");
+ acquire (lpdi, L"joystick");
}
IDirectInputDevice8_Poll (lpdi);
}
sortobjects (did, did->buttonmappings, did->buttonsort, did->buttonname, 0, did->buttons);
}
} else {
- write_log ("joystick createdevice failed, %s\n", DXError (hr));
+ write_log (L"joystick createdevice failed, %s\n", DXError (hr));
}
}
}
DIPROPDWORD dipdw;
HRESULT hr;
- unacquire (lpdi, "joystick");
+ unacquire (lpdi, L"joystick");
if (di_joystick[num].connection == DIDC_DX && lpdi) {
- setcoop (&di_joystick[num], flags ? (DISCL_FOREGROUND | DISCL_EXCLUSIVE) : (DISCL_BACKGROUND | DISCL_NONEXCLUSIVE), "joystick");
+ setcoop (&di_joystick[num], flags ? (DISCL_FOREGROUND | DISCL_EXCLUSIVE) : (DISCL_BACKGROUND | DISCL_NONEXCLUSIVE), L"joystick");
memset (&dipdw, 0, sizeof (dipdw));
dipdw.diph.dwSize = sizeof (DIPROPDWORD);
dipdw.diph.dwHeaderSize = sizeof (DIPROPHEADER);
dipdw.dwData = DI_BUFFER;
hr = IDirectInputDevice8_SetProperty (lpdi, DIPROP_BUFFERSIZE, &dipdw.diph);
if (FAILED (hr))
- write_log ("joystick setproperty failed, %s\n", DXError (hr));
- di_joystick[num].acquired = acquire (lpdi, "joystick") ? 1 : -1;
+ write_log (L"joystick setproperty failed, %s\n", DXError (hr));
+ di_joystick[num].acquired = acquire (lpdi, L"joystick") ? 1 : -1;
} else {
di_joystick[num].acquired = 1;
}
static void unacquire_joystick (int num)
{
- unacquire (di_joystick[num].lpdi, "joystick");
+ unacquire (di_joystick[num].lpdi, L"joystick");
di_joystick[num].acquired = 0;
}
D3DXVECTOR2 texcoord; // texture coords
};
-static char *D3D_ErrorText (HRESULT error)
+static TCHAR *D3D_ErrorText (HRESULT error)
{
- return "";
+ return L"";
}
-static char *D3D_ErrorString (HRESULT dival)
+static TCHAR *D3D_ErrorString (HRESULT dival)
{
- static char dierr[200];
- sprintf(dierr, "%08X S=%d F=%04X C=%04X (%d) (%s)",
+ static TCHAR dierr[200];
+ _stprintf (dierr, L"%08X S=%d F=%04X C=%04X (%d) (%s)",
dival, (dival & 0x80000000) ? 1 : 0,
HRESULT_FACILITY(dival),
HRESULT_CODE(dival),
return pOut;
}
-static char *D3DX_ErrorString (HRESULT hr, LPD3DXBUFFER Errors)
+static TCHAR *D3DX_ErrorString (HRESULT hr, LPD3DXBUFFER Errors)
{
- static char buffer[1000];
- char *s = NULL;
+ static TCHAR buffer[1000];
+ TCHAR *s = NULL;
if (Errors)
s = Errors->lpVtbl->GetBufferPointer (Errors);
- strcpy (buffer, D3D_ErrorString (hr));
+ _tcscpy (buffer, D3D_ErrorString (hr));
if (s) {
- strcat (buffer, " ");
- strcat (buffer, s);
+ _tcscat (buffer, L" ");
+ _tcscat (buffer, s);
}
return buffer;
}
if (ppTextureShader)
ppTextureShader->lpVtbl->Release (ppTextureShader);
} else {
- write_log ("D3D: Could not compile texture shader: %s\n", D3DX_ErrorString (hr, lpErrors));
+ write_log (L"D3D: Could not compile texture shader: %s\n", D3DX_ErrorString (hr, lpErrors));
if (lpErrors)
lpErrors->lpVtbl->Release (lpErrors);
return 0;
if (yesno > 0)
return 1;
yesno = -1;
- h = LoadLibrary ("d3dx9_40.dll");
+ h = LoadLibrary (L"d3dx9_40.dll");
if (h != NULL) {
FreeLibrary (h);
d3dx = Direct3DCreate9 (D3D_SDK_VERSION);
if (d3dx != NULL) {
if (SUCCEEDED (IDirect3D9_GetDeviceCaps (d3dx, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dCaps))) {
if(d3dCaps.PixelShaderVersion >= D3DPS_VERSION(2,0)) {
- write_log ("D3D: Pixel shader 2.0+ support detected, shader filters enabled.\n");
+ write_log (L"D3D: Pixel shader 2.0+ support detected, shader filters enabled.\n");
yesno = 1;
}
}
return yesno > 0 ? 1 : 0;
}
-static int psEffect_LoadEffect (const char *shaderfile)
+static int psEffect_LoadEffect (const TCHAR *shaderfile)
{
int ret = 0;
LPD3DXEFFECTCOMPILER EffectCompiler = NULL;
LPD3DXBUFFER Errors = NULL;
LPD3DXBUFFER BufferEffect = NULL;
HRESULT hr;
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
static int first;
if (!D3D_canshaders ()) {
if (!first)
- gui_message ("Installed DirectX is too old\nD3D shaders disabled.");
+ gui_message (L"Installed DirectX is too old\nD3D shaders disabled.");
first = 1;
return 0;
}
- sprintf (tmp, "%s%sfiltershaders\\direct3d\\%s", start_path_exe, WIN32_PLUGINDIR, shaderfile);
+ _stprintf (tmp, L"%s%sfiltershaders\\direct3d\\%s", start_path_exe, WIN32_PLUGINDIR, shaderfile);
hr = D3DXCreateEffectCompilerFromFile (tmp, NULL, NULL, 0, &EffectCompiler, &Errors);
if (FAILED (hr)) {
- write_log ("D3D: D3DXCreateEffectCompilerFromFile failed: %s\n", D3DX_ErrorString (hr, Errors));
+ write_log (L"D3D: D3DXCreateEffectCompilerFromFile failed: %s\n", D3DX_ErrorString (hr, Errors));
goto end;
}
hr = EffectCompiler->lpVtbl->CompileEffect (EffectCompiler, 0, &BufferEffect, &Errors);
if (FAILED (hr)) {
- write_log ("D3D: CompileEffect failed: %s\n", D3DX_ErrorString (hr, Errors));
+ write_log (L"D3D: CompileEffect failed: %s\n", D3DX_ErrorString (hr, Errors));
goto end;
}
hr = D3DXCreateEffect (d3ddev,
0,
NULL, &pEffect, &Errors);
if (FAILED (hr)) {
- write_log ("D3D: D3DXCreateEffect failed: %s\n", D3DX_ErrorString (hr, Errors));
+ write_log (L"D3D: D3DXCreateEffect failed: %s\n", D3DX_ErrorString (hr, Errors));
goto end;
}
pEffect->lpVtbl->GetDesc (pEffect, &EffectDesc);
psActive = TRUE;
if (psEffect_hasPreProcess ())
psPreProcess = TRUE;
- write_log ("D3D: pixelshader filter '%s' enabled, preproc=%d\n", tmp, psPreProcess);
+ write_log (L"D3D: pixelshader filter '%s' enabled, preproc=%d\n", tmp, psPreProcess);
} else {
- write_log ("D3D: pixelshader filter '%s' failed to initialize\n", tmp);
+ write_log (L"D3D: pixelshader filter '%s' failed to initialize\n", tmp);
}
return ret;
}
if (m_MatWorldEffectHandle) {
hr = pEffect->lpVtbl->SetMatrix (pEffect, m_MatWorldEffectHandle, matWorld);
if (FAILED (hr)) {
- write_log ("D3D:Create:SetMatrix:matWorld %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D:Create:SetMatrix:matWorld %s\n", D3D_ErrorString (hr));
return 0;
}
}
if (m_MatViewEffectHandle) {
hr = pEffect->lpVtbl->SetMatrix (pEffect, m_MatViewEffectHandle, matView);
if (FAILED (hr)) {
- write_log ("D3D:Create:SetMatrix:matView %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D:Create:SetMatrix:matView %s\n", D3D_ErrorString (hr));
return 0;
}
}
if (m_MatProjEffectHandle) {
hr = pEffect->lpVtbl->SetMatrix (pEffect, m_MatProjEffectHandle, matProj);
if (FAILED (hr)) {
- write_log ("D3D:Create:SetMatrix:matProj %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D:Create:SetMatrix:matProj %s\n", D3D_ErrorString (hr));
return 0;
}
}
D3DXMatrixMultiply (&matWorldView, matWorld, matView);
hr = pEffect->lpVtbl->SetMatrix (pEffect, m_MatWorldViewEffectHandle, &matWorldView);
if (FAILED (hr)) {
- write_log ("D3D:Create:SetMatrix:matWorldView %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D:Create:SetMatrix:matWorldView %s\n", D3D_ErrorString (hr));
return 0;
}
}
D3DXMatrixMultiply (&matViewProj, matView, matProj);
hr = pEffect->lpVtbl->SetMatrix (pEffect, m_MatViewProjEffectHandle, &matViewProj);
if (FAILED (hr)) {
- write_log ("D3D:Create:SetMatrix:matViewProj %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D:Create:SetMatrix:matViewProj %s\n", D3D_ErrorString (hr));
return 0;
}
}
D3DXMatrixMultiply (&matWorldViewProj, &tmp, matProj);
hr = pEffect->lpVtbl->SetMatrix (pEffect, m_MatWorldViewProjEffectHandle, &matWorldViewProj);
if (FAILED (hr)) {
- write_log ("D3D:Create:SetMatrix:matWorldViewProj %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D:Create:SetMatrix:matWorldViewProj %s\n", D3D_ErrorString (hr));
return 0;
}
}
D3DXVECTOR4 fDims, fTexelSize;
if (!m_SourceTextureEffectHandle) {
- write_log ("D3D: Texture with SOURCETEXTURE semantic not found\n");
+ write_log (L"D3D: Texture with SOURCETEXTURE semantic not found\n");
return 0;
}
hr = pEffect->lpVtbl->SetTexture (pEffect, m_SourceTextureEffectHandle, (LPDIRECT3DBASETEXTURE9)lpSource);
if (FAILED (hr)) {
- write_log ("D3D:SetTextures:lpSource %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D:SetTextures:lpSource %s\n", D3D_ErrorString (hr));
return 0;
}
if(m_WorkingTexture1EffectHandle) {
hr = pEffect->lpVtbl->SetTexture (pEffect, m_WorkingTexture1EffectHandle, (LPDIRECT3DBASETEXTURE9)lpWorking1);
if (FAILED (hr)) {
- write_log ("D3D:SetTextures:lpWorking1 %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D:SetTextures:lpWorking1 %s\n", D3D_ErrorString (hr));
return 0;
}
}
if(m_WorkingTexture2EffectHandle) {
hr = pEffect->lpVtbl->SetTexture (pEffect, m_WorkingTexture2EffectHandle, (LPDIRECT3DBASETEXTURE9)lpWorking2);
if (FAILED (hr)) {
- write_log ("D3D:SetTextures:lpWorking2 %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D:SetTextures:lpWorking2 %s\n", D3D_ErrorString (hr));
return 0;
}
}
if(m_Hq2xLookupTextureHandle) {
hr = pEffect->lpVtbl->SetTexture (pEffect, m_Hq2xLookupTextureHandle, (LPDIRECT3DBASETEXTURE9)lpHq2xLookupTexture);
if (FAILED (hr)) {
- write_log ("D3D:SetTextures:lpHq2xLookupTexture %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D:SetTextures:lpHq2xLookupTexture %s\n", D3D_ErrorString (hr));
return 0;
}
}
if (m_SourceDimsEffectHandle) {
hr = pEffect->lpVtbl->SetVector (pEffect, m_SourceDimsEffectHandle, &fDims);
if (FAILED (hr)) {
- write_log ("D3D:SetTextures:SetVector:Source %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D:SetTextures:SetVector:Source %s\n", D3D_ErrorString (hr));
return 0;
}
}
if (m_TexelSizeEffectHandle) {
hr = pEffect->lpVtbl->SetVector (pEffect, m_TexelSizeEffectHandle, &fTexelSize);
if (FAILED (hr)) {
- write_log ("D3D:SetTextures:SetVector:Texel %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D:SetTextures:SetVector:Texel %s\n", D3D_ErrorString (hr));
return 0;
}
}
break;
}
if(FAILED(hr)) {
- write_log ("D3D: SetTechnique: %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D: SetTechnique: %s\n", D3D_ErrorString (hr));
return 0;
}
hr = pEffect->lpVtbl->Begin (pEffect, pPasses, D3DXFX_DONOTSAVESTATE|D3DXFX_DONOTSAVESHADERSTATE);
if(FAILED(hr)) {
- write_log ("D3D: Begin: %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D: Begin: %s\n", D3D_ErrorString (hr));
return 0;
}
return 1;
hr = pEffect->lpVtbl->BeginPass (pEffect, Pass);
if (FAILED (hr)) {
- write_log ("D3D: BeginPass: %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D: BeginPass: %s\n", D3D_ErrorString (hr));
return 0;
}
return 1;
hr = pEffect->lpVtbl->EndPass (pEffect);
if (FAILED (hr)) {
- write_log ("D3D: EndPass: %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D: EndPass: %s\n", D3D_ErrorString (hr));
return 0;
}
return 1;
hr = pEffect->lpVtbl->End (pEffect);
if (FAILED (hr)) {
- write_log ("D3D: End: %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D: End: %s\n", D3D_ErrorString (hr));
return 0;
}
return 1;
D3DPOOL_MANAGED, &t, NULL);
}
if (FAILED (hr)) {
- write_log ("IDirect3DDevice9_CreateTexture failed: %s\n", D3D_ErrorString (hr));
+ write_log (L"IDirect3DDevice9_CreateTexture failed: %s\n", D3D_ErrorString (hr));
return 0;
}
return 0;
twidth = ww;
theight = hh;
- write_log ("D3D: %d*%d texture allocated, bits per pixel %d\n", ww, hh, t_depth);
+ write_log (L"D3D: %d*%d texture allocated, bits per pixel %d\n", ww, hh, t_depth);
if (psActive) {
D3DLOCKED_BOX lockedBox;
if (FAILED (hr = IDirect3DDevice9_CreateTexture (d3ddev, ww, hh, 1,
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture1, NULL))) {
- write_log ("D3D:Failed to create working texture1: %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D:Failed to create working texture1: %s\n", D3D_ErrorString (hr));
return 0;
}
if (FAILED (hr = IDirect3DDevice9_CreateTexture (d3ddev, ww, hh, 1,
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture2, NULL))) {
- write_log ("D3D:Failed to create working texture2: %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D:Failed to create working texture2: %s\n", D3D_ErrorString (hr));
return 0;
}
if (FAILED (hr = IDirect3DDevice9_CreateVolumeTexture (d3ddev, 256, 16, 256, 1, 0,
D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &lpHq2xLookupTexture, NULL))) {
- write_log ("D3D:Failed to create volume texture: %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D:Failed to create volume texture: %s\n", D3D_ErrorString (hr));
return 0;
}
if (FAILED (hr = IDirect3DVolumeTexture9_LockBox (lpHq2xLookupTexture, 0, &lockedBox, NULL, 0))) {
- write_log ("D3D: Failed to lock box of volume texture: %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D: Failed to lock box of volume texture: %s\n", D3D_ErrorString (hr));
return 0;
}
//BuildHq2xLookupTexture(tin_w, tin_w, window_w, window_h, (unsigned char*)lockedBox.pBits);
return 0;
required_sl_texture_w = ww;
required_sl_texture_h = hh;
- write_log ("D3D: SL %d*%d texture allocated\n", ww, hh);
+ write_log (L"D3D: SL %d*%d texture allocated\n", ww, hh);
scanlines_ok = 1;
return 1;
float w, h;
float dw, dh;
-// write_log ("%dx%d %dx%d %dx%d\n", twidth, theight, tin_w, tin_h, window_w, window_h);
+// write_log (L"%dx%d %dx%d %dx%d\n", twidth, theight, tin_w, tin_h, window_w, window_h);
getfilterrect2 (&dr, &sr, &zr, window_w, window_h, tin_w, tin_h, 1, tin_w, tin_h);
-// write_log ("(%d %d %d %d) - (%d %d %d %d) (%d %d)\n",
+// write_log (L"(%d %d %d %d) - (%d %d %d %d) (%d %d)\n",
// dr.left, dr.top, dr.right, dr.bottom, sr.left, sr.top, sr.right, sr.bottom, zr.left, zr.top);
dw = dr.right - dr.left;
dh = dr.bottom - dr.top;
w = sr.right - sr.left;
h = sr.bottom - sr.top;
-// write_log ("%.1fx%.1f %.1fx%.1f\n", dw, dh, w, h);
+// write_log (L"%.1fx%.1f %.1fx%.1f\n", dw, dh, w, h);
MatrixOrthoOffCenterLH (&m_matProj, 0, w, 0, h, 0.0f, 1.0f);
hr = IDirect3DTexture9_LockRect (sltexture, 0, &locked, NULL, D3DLOCK_DISCARD);
if (FAILED (hr)) {
- write_log ("SL IDirect3DTexture9_LockRect failed: %s\n", D3D_ErrorString (hr));
+ write_log (L"SL IDirect3DTexture9_LockRect failed: %s\n", D3D_ErrorString (hr));
return;
}
sld = (uae_u8*)locked.pBits;
hr = IDirect3DDevice9_SetFVF (d3ddev, D3DFVF_TLVERTEX);
if (FAILED (IDirect3DDevice9_CreateVertexBuffer (d3ddev, vbsize, D3DUSAGE_WRITEONLY,
D3DFVF_TLVERTEX, D3DPOOL_MANAGED, &vertexBuffer, NULL))) {
- write_log ("D3D: failed to create vertex buffer: %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D: failed to create vertex buffer: %s\n", D3D_ErrorString (hr));
return 0;
}
createvertex ();
psActive = 0;
}
-const char *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth)
+const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth)
{
HRESULT ret, hr;
- static char errmsg[100] = { 0 };
+ static TCHAR errmsg[100] = { 0 };
D3DDISPLAYMODE mode;
D3DDISPLAYMODEEX modeex;
D3DCAPS9 d3dCaps;
d3d_enabled = 0;
scanlines_ok = 0;
if (currprefs.gfx_filter != UAE_FILTER_DIRECT3D) {
- strcpy (errmsg, "D3D: not enabled");
+ _tcscpy (errmsg, L"D3D: not enabled");
return errmsg;
}
d3d_ex = FALSE;
- d3dDLL = LoadLibrary ("D3D9.DLL");
+ d3dDLL = LoadLibrary (L"D3D9.DLL");
if (d3dDLL == NULL) {
- strcpy (errmsg, "Direct3D: DirectX 9 or newer required");
+ _tcscpy (errmsg, L"Direct3D: DirectX 9 or newer required");
return errmsg;
} else {
typedef HRESULT (WINAPI *LPDIRECT3DCREATE9EX)(UINT, IDirect3D9Ex**);
hr = -1;
if (d3d_ex && D3DEX) {
hr = Direct3DCreate9Ex (D3D_SDK_VERSION, &d3dex);
- write_log ("Direct3D: failed to create D3DEx object: %s\n", D3D_ErrorString (hr));
+ write_log (L"Direct3D: failed to create D3DEx object: %s\n", D3D_ErrorString (hr));
d3d = (IDirect3D9*)d3dex;
}
if (FAILED (hr)) {
d3d = Direct3DCreate9 (D3D_SDK_VERSION);
if (d3d == NULL) {
D3D_free ();
- strcpy (errmsg, "Direct3D: failed to create D3D object");
+ _tcscpy (errmsg, L"Direct3D: failed to create D3D object");
return errmsg;
}
}
if (d3dex && D3DEX)
IDirect3D9Ex_GetAdapterDisplayModeEx (d3dex, adapter, &modeex, NULL);
if (FAILED (hr = IDirect3D9_GetAdapterDisplayMode (d3d, adapter, &mode)))
- write_log ("D3D: IDirect3D9_GetAdapterDisplayMode failed %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D: IDirect3D9_GetAdapterDisplayMode failed %s\n", D3D_ErrorString (hr));
if (FAILED (hr = IDirect3D9_GetDeviceCaps (d3d, adapter, D3DDEVTYPE_HAL, &d3dCaps)))
- write_log ("D3D: IDirect3D9_GetDeviceCaps failed %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D: IDirect3D9_GetDeviceCaps failed %s\n", D3D_ErrorString (hr));
memset (&dpp, 0, sizeof (dpp));
dpp.Windowed = isfullscreen() <= 0;
ret = IDirect3D9_CreateDevice (d3d, adapter, D3DDEVTYPE_HAL, d3dhwnd, flags, &dpp, &d3ddev);
}
if (FAILED (ret)) {
- sprintf (errmsg, "%s failed, %s\n", d3d_ex && D3DEX ? "CreateDeviceEx" : "CreateDevice", D3D_ErrorString (ret));
+ _stprintf (errmsg, L"%s failed, %s\n", d3d_ex && D3DEX ? L"CreateDeviceEx" : L"CreateDevice", D3D_ErrorString (ret));
D3D_free ();
return errmsg;
}
max_texture_w = d3dCaps.MaxTextureWidth;
max_texture_h = d3dCaps.MaxTextureHeight;
- write_log ("D3D: PS=%d.%d VS=%d.%d Square=%d, Pow2=%d, Tex Size=%d*%d\n",
+ write_log (L"D3D: PS=%d.%d VS=%d.%d Square=%d, Pow2=%d, Tex Size=%d*%d\n",
(d3dCaps.PixelShaderVersion >> 8) & 0xff, d3dCaps.PixelShaderVersion & 0xff,
(d3dCaps.VertexShaderVersion >> 8) & 0xff, d3dCaps.VertexShaderVersion & 0xff,
tex_square, tex_pow2,
max_texture_w, max_texture_h);
if (max_texture_w < t_w || max_texture_h < t_h) {
- sprintf (errmsg, "Direct3D: %d * %d or bigger texture support required\nYour card's maximum texture size is only %d * %d",
+ _stprintf (errmsg, L"Direct3D: %d * %d or bigger texture support required\nYour card's maximum texture size is only %d * %d",
t_w, t_h, max_texture_w, max_texture_h);
return errmsg;
}
required_sl_texture_w = w_w;
required_sl_texture_h = w_h;
if (currprefs.gfx_filter_scanlines > 0 && (max_texture_w < w_w || max_texture_h < w_h)) {
- gui_message ("Direct3D: %d * %d or bigger texture support required for scanlines (max is only %d * %d)\n"
- "Scanlines disabled.",
+ gui_message (L"Direct3D: %d * %d or bigger texture support required for scanlines (max is only %d * %d)\n"
+ L"Scanlines disabled.",
required_sl_texture_w, required_sl_texture_h, max_texture_w, max_texture_h);
changed_prefs.gfx_filter_scanlines = currprefs.gfx_filter_scanlines = 0;
}
tin_h = t_h;
if (!restoredeviceobjects ()) {
D3D_free ();
- sprintf (errmsg, "Direct3D: texture creation failed");
+ _stprintf (errmsg, L"Direct3D: texture creation failed");
return errmsg;
}
if (hr == D3DERR_DEVICENOTRESET) {
hr = IDirect3DDevice9_Reset (d3ddev, &dpp);
if (FAILED (hr)) {
- write_log ("D3D: Reset failed %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D: Reset failed %s\n", D3D_ErrorString (hr));
return 1;
}
}
pass2:
IDirect3DTexture9_GetSurfaceLevel (lpWorkTexture, 0, &lpNewRenderTarget);
if (FAILED (hr = IDirect3DDevice9_SetRenderTarget (d3ddev, 0, lpNewRenderTarget))) {
- write_log ("D3D: IDirect3DDevice9_SetRenderTarget: %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D: IDirect3DDevice9_SetRenderTarget: %s\n", D3D_ErrorString (hr));
return;
}
if (lpRenderTarget)
if (FAILED (hr)) {
if (hr == D3DERR_DEVICELOST) {
if (!dpp.Windowed && IsWindow (d3dhwnd) && !IsIconic (d3dhwnd)) {
- write_log ("D3D: minimize\n");
+ write_log (L"D3D: minimize\n");
ShowWindow (d3dhwnd, SW_MINIMIZE);
}
}
hr = IDirect3DTexture9_LockRect (texture, 0, &locked, NULL, D3DLOCK_NO_DIRTY_UPDATE);
if (FAILED (hr)) {
if (hr != D3DERR_DRIVERINTERNALERROR) {
- write_log ("IDirect3DTexture9_LockRect failed: %s\n", D3D_ErrorString (hr));
+ write_log (L"IDirect3DTexture9_LockRect failed: %s\n", D3D_ErrorString (hr));
D3D_unlocktexture ();
return 0;
}
}
if (locked.pBits == NULL || locked.Pitch == 0) {
- write_log ("IDirect3DTexture9_LockRect return NULL texture\n");
+ write_log (L"IDirect3DTexture9_LockRect return NULL texture\n");
D3D_unlocktexture ();
return 0;
}
return;
hr = IDirect3DDevice9_SetDialogBoxMode (d3ddev, guion);
if (FAILED (hr))
- write_log ("D3D: SetDialogBoxMode %s\n", D3D_ErrorString (hr));
+ write_log (L"D3D: SetDialogBoxMode %s\n", D3D_ErrorString (hr));
guimode = guion;
}
if (!hdc) {
hr = IDirect3DDevice9_GetBackBuffer (d3ddev, 0, 0, D3DBACKBUFFER_TYPE_MONO, &bb);
if (FAILED (hr)) {
- write_log ("IDirect3DDevice9_GetBackBuffer() failed: %s\n", D3D_ErrorString (hr));
+ write_log (L"IDirect3DDevice9_GetBackBuffer() failed: %s\n", D3D_ErrorString (hr));
return 0;
}
hr = IDirect3DSurface9_GetDC (bb, &hdc);
if (SUCCEEDED (hr))
return hdc;
- write_log ("IDirect3DSurface9_GetDC() failed: %s\n", D3D_ErrorString (hr));
+ write_log (L"IDirect3DSurface9_GetDC() failed: %s\n", D3D_ErrorString (hr));
return 0;
}
IDirect3DSurface9_ReleaseDC (bb, hdc);
extern void D3D_resize (int width, int height);
-extern void D3D_free ();
-extern const char *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth);
+extern void D3D_free (void);
+extern const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth);
extern void D3D_render (void);
extern void D3D_getpixelformat (int depth,int *rb, int *bb, int *gb, int *rs, int *bs, int *gs, int *ab, int *ar, int *a);
extern void D3D_refresh (void);
return 1;
thread_ok = 1;
init_comm_pipe (dc_pipe, DC_PIPE_SIZE, 3);
- uae_start_thread("fdrawcmd_win32", driveclick_thread, NULL, NULL);
+ uae_start_thread (L"fdrawcmd_win32", driveclick_thread, NULL, NULL);
return 1;
}
static int driveclick_fdrawcmd_open_2(int drive)
{
- char s[32];
+ TCHAR s[32];
driveclick_fdrawcmd_close(drive);
- sprintf (s, "\\\\.\\fdraw%d", drive);
+ _stprintf (s, L"\\\\.\\fdraw%d", drive);
h[drive] = CreateFile(s, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (h[drive] == INVALID_HANDLE_VALUE)
return 0;
dxdata.native.dwSize = sizeof (DDSURFACEDESC2);
ddrval = IDirectDraw7_GetDisplayMode (dxdata.maindd, &dxdata.native);
if (FAILED (ddrval))
- write_log ("IDirectDraw7_GetDisplayMode: %s\n", DXError (ddrval));
+ write_log (L"IDirectDraw7_GetDisplayMode: %s\n", DXError (ddrval));
return ddrval;
}
return ddrval;
ddrval = IDirectDrawSurface7_Restore (surf);
if (FAILED (ddrval)) {
- write_log ("IDirectDrawSurface7_Restore: %s\n", DXError (ddrval));
+ write_log (L"IDirectDrawSurface7_Restore: %s\n", DXError (ddrval));
} else {
if (surf == dxdata.primary && dxdata.palette)
IDirectDrawSurface7_SetPalette (dxdata.primary, dxdata.palette);
if (FAILED (ddrval))
return 0;
} else if (ddrval != DDERR_SURFACEBUSY) {
- write_log ("locksurface: %s\n", DXError (ddrval));
+ write_log (L"locksurface: %s\n", DXError (ddrval));
return 0;
}
}
ddrval = IDirectDrawSurface7_Unlock (surf, NULL);
if (FAILED (ddrval))
- write_log ("IDirectDrawSurface7_Unlock: %s\n", DXError (ddrval));
+ write_log (L"IDirectDrawSurface7_Unlock: %s\n", DXError (ddrval));
}
static void setsurfacecap (DDSURFACEDESC2 *desc, int w, int h, int mode)
return (((rgb >> (16 + 3)) & 0x1f) << 11) | (((rgb >> (8 + 2)) & 0x3f) << 5) | (((rgb >> (0 + 3)) & 0x1f) << 0);
}
-static char *alloctexts[] = { "NonLocalVRAM", "DefaultRAM", "VRAM", "RAM" };
+static TCHAR *alloctexts[] = { L"NonLocalVRAM", L"DefaultRAM", L"VRAM", L"RAM" };
static LPDIRECTDRAWSURFACE7 allocsurface_3 (int width, int height, uae_u8 *ptr, int pitch, int ck, int forcemode)
{
HRESULT ddrval;
}
ddrval = IDirectDraw7_CreateSurface (dxdata.maindd, &desc, &surf, NULL);
if (FAILED (ddrval)) {
- write_log ("IDirectDraw7_CreateSurface (%dx%d,%s): %s\n", width, height, alloctexts[forcemode], DXError (ddrval));
+ write_log (L"IDirectDraw7_CreateSurface (%dx%d,%s): %s\n", width, height, alloctexts[forcemode], DXError (ddrval));
} else {
- write_log ("Created %dx%dx%d (%p) surface in %s (%d)%s\n", width, height, desc.ddpfPixelFormat.dwRGBBitCount, surf,
- alloctexts[forcemode], forcemode, ck ? (dxcaps.cancolorkey ? " hardware colorkey" : " software colorkey") : "");
+ write_log (L"Created %dx%dx%d (%p) surface in %s (%d)%s\n", width, height, desc.ddpfPixelFormat.dwRGBBitCount, surf,
+ alloctexts[forcemode], forcemode, ck ? (dxcaps.cancolorkey ? L" hardware colorkey" : L" software colorkey") : L"");
}
return surf;
}
clearsurface (cksurf);
clearsurface (tmp);
if (failed) {
- write_log ("Color key test failure, display driver bug, falling back to software emulation.\n");
+ write_log (L"Color key test failure, display driver bug, falling back to software emulation.\n");
dxcaps.cancolorkey = 0;
releaser (dxdata.cursorsurface1, IDirectDrawSurface7_Release);
dxdata.cursorsurface1 = allocsurface_2 (dxcaps.cursorwidth, dxcaps.cursorheight, TRUE);
ddrval = IDirectDrawSurface7_GetAttachedSurface (dxdata.flipping[0], &ddscaps, &dxdata.flipping[1]);
}
if (FAILED (ddrval))
- write_log ("IDirectDrawSurface7_GetAttachedSurface: %s\n", DXError (ddrval));
+ write_log (L"IDirectDrawSurface7_GetAttachedSurface: %s\n", DXError (ddrval));
} else {
desc.dwBackBufferCount = 0;
desc.ddsCaps.dwCaps = oldcaps;
}
}
if (FAILED (ddrval)) {
- write_log ("IDirectDraw7_CreateSurface: %s\n", DXError (ddrval));
+ write_log (L"IDirectDraw7_CreateSurface: %s\n", DXError (ddrval));
return ddrval;
}
dxdata.native.dwSize = sizeof (DDSURFACEDESC2);
ddrval = IDirectDrawSurface7_GetSurfaceDesc (dxdata.primary, &dxdata.native);
if (FAILED (ddrval))
- write_log ("IDirectDrawSurface7_GetSurfaceDesc: %s\n", DXError (ddrval));
+ write_log (L"IDirectDrawSurface7_GetSurfaceDesc: %s\n", DXError (ddrval));
if (dxdata.fsmodeset) {
clearsurf (dxdata.primary, 0);
dxdata.fsmodeset = 1;
dxdata.pitch = desc.lPitch;
unlocksurface (surf);
} else {
- write_log ("Couldn't get surface pitch!\n");
+ write_log (L"Couldn't get surface pitch!\n");
}
createcursorsurface ();
} else {
ddrval = DD_FALSE;
}
- write_log ("DDRAW: primary surface %p, secondary %p (%dx%dx%d)\n",
+ write_log (L"DDRAW: primary surface %p, secondary %p (%dx%dx%d)\n",
dxdata.primary, surf, width, height, dxdata.native.ddpfPixelFormat.dwRGBBitCount);
return ddrval;
}
return DD_OK;
ddrval = IDirectDraw7_SetDisplayMode (dxdata.maindd, width, height, bits, freq, 0);
if (FAILED (ddrval)) {
- write_log ("IDirectDraw7_SetDisplayMode: %s\n", DXError (ddrval));
+ write_log (L"IDirectDraw7_SetDisplayMode: %s\n", DXError (ddrval));
IDirectDraw7_RestoreDisplayMode (dxdata.maindd);
dxdata.fsmodeset = 0;
} else {
ddrval = IDirectDraw7_SetCooperativeLevel (dxdata.maindd, window, fullscreen ?
DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN : DDSCL_NORMAL);
if (FAILED (ddrval))
- write_log ("IDirectDraw7_SetCooperativeLevel: SET %s\n", DXError (ddrval));
+ write_log (L"IDirectDraw7_SetCooperativeLevel: SET %s\n", DXError (ddrval));
} else {
ddrval = IDirectDraw7_SetCooperativeLevel (dxdata.maindd, dxdata.hwnd, DDSCL_NORMAL);
if (FAILED (ddrval))
- write_log ("IDirectDraw7_SetCooperativeLevel: RESET %s\n", DXError (ddrval));
+ write_log (L"IDirectDraw7_SetCooperativeLevel: RESET %s\n", DXError (ddrval));
}
return ddrval;
}
ddrval = IDirectDraw7_CreateClipper (dxdata.maindd, 0, &dxdata.dclip, NULL);
if (FAILED (ddrval))
- write_log ("IDirectDraw7_CreateClipper: %s\n", DXError (ddrval));
+ write_log (L"IDirectDraw7_CreateClipper: %s\n", DXError (ddrval));
return ddrval;
}
return DD_FALSE;
ddrval = IDirectDrawSurface7_SetClipper (dxdata.primary, hWnd ? dxdata.dclip : NULL);
if (FAILED (ddrval))
- write_log ("IDirectDrawSurface7_SetClipper: %s\n", DXError (ddrval));
+ write_log (L"IDirectDrawSurface7_SetClipper: %s\n", DXError (ddrval));
if(hWnd && SUCCEEDED (ddrval)) {
ddrval = IDirectDrawClipper_SetHWnd (dxdata.dclip, 0, hWnd);
if (FAILED (ddrval))
- write_log ("IDirectDrawClipper_SetHWnd: %s\n", DXError (ddrval));
+ write_log (L"IDirectDrawClipper_SetHWnd: %s\n", DXError (ddrval));
}
return ddrval;
}
-char *outGUID (const GUID *guid)
+TCHAR *outGUID (const GUID *guid)
{
- static char gb[64];
+ static TCHAR gb[64];
if (guid == NULL)
- return "NULL";
- sprintf (gb, "%08X-%04X-%04X-%02X%02X%02X%02X%02X%02X%02X%02X",
+ return L"NULL";
+ _stprintf (gb, L"%08X-%04X-%04X-%02X%02X%02X%02X%02X%02X%02X%02X",
guid->Data1, guid->Data2, guid->Data3,
guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
return gb;
}
-const char *DXError (HRESULT ddrval)
+const TCHAR *DXError (HRESULT ddrval)
{
- static char dderr[1000];
- sprintf (dderr, "%08X S=%d F=%04X C=%04X (%d) (%s)",
+ static TCHAR dderr[1000];
+ _stprintf (dderr, L"%08X S=%d F=%04X C=%04X (%d) (%s)",
ddrval, (ddrval & 0x80000000) ? 1 : 0,
HRESULT_FACILITY(ddrval),
HRESULT_CODE(ddrval),
break;
default:
- write_log ("Unknown %d bit format %d %d %d\n", pfp->dwRGBBitCount, r, g, b);
+ write_log (L"Unknown %d bit format %d %d %d\n", pfp->dwRGBBitCount, r, g, b);
break;
}
return RGBFB_NONE;
return result;
}
-HRESULT DirectDraw_EnumDisplays (LPDDENUMCALLBACKEX callback)
+HRESULT DirectDraw_EnumDisplays (LPDDENUMCALLBACKEXA callback)
{
HRESULT result;
- result = DirectDrawEnumerateEx (callback, 0, DDENUM_DETACHEDSECONDARYDEVICES | DDENUM_ATTACHEDSECONDARYDEVICES);
+ result = DirectDrawEnumerateExA (callback, 0, DDENUM_DETACHEDSECONDARYDEVICES | DDENUM_ATTACHEDSECONDARYDEVICES);
return result;
}
void DirectDraw_SurfaceUnlock (void)
{
if (dxdata.lockcnt < 0)
- write_log ("DirectDraw_SurfaceUnlock negative lock count %d!\n", dxdata.lockcnt);
+ write_log (L"DirectDraw_SurfaceUnlock negative lock count %d!\n", dxdata.lockcnt);
if (dxdata.lockcnt == 0)
return;
dxdata.lockcnt--;
if (FAILED (ddrval))
return 0;
} else if (ddrval != DDERR_SURFACEBUSY) {
- write_log ("DirectDraw_BlitToPrimary: %s\n", DXError (ddrval));
+ write_log (L"DirectDraw_BlitToPrimary: %s\n", DXError (ddrval));
break;
}
}
if (FAILED (ddrval))
return 0;
} else if (ddrval != DDERR_SURFACEBUSY) {
- write_log ("DirectDraw_BlitToPrimary: %s\n", DXError (ddrval));
+ write_log (L"DirectDraw_BlitToPrimary: %s\n", DXError (ddrval));
break;
}
}
if (FAILED (ddrval))
return 0;
} else if (ddrval != DDERR_SURFACEBUSY) {
- write_log ("DirectDraw_Blit: %s\n", DXError (ddrval));
+ write_log (L"DirectDraw_Blit: %s\n", DXError (ddrval));
return 0;
}
}
if (FAILED (ddrval))
break;
} else if (ddrval != DDERR_SURFACEBUSY) {
- write_log ("DirectDraw_Fill: %s\n", DXError (ddrval));
+ write_log (L"DirectDraw_Fill: %s\n", DXError (ddrval));
break;
}
}
recurse--;
}
} else if(FAILED (ddrval)) {
- write_log ("IDirectDrawSurface7_Flip: %s\n", DXError (ddrval));
+ write_log (L"IDirectDrawSurface7_Flip: %s\n", DXError (ddrval));
}
}
return DD_FALSE;
ddrval = IDirectDrawSurface7_SetPalette (dxdata.primary, remove ? NULL : dxdata.palette);
if (FAILED (ddrval))
- write_log ("IDirectDrawSurface7_SetPalette: %s\n", DXError (ddrval));
+ write_log (L"IDirectDrawSurface7_SetPalette: %s\n", DXError (ddrval));
return ddrval;
}
HRESULT DirectDraw_CreatePalette (LPPALETTEENTRY pal)
HRESULT ddrval;
ddrval = IDirectDraw_CreatePalette (dxdata.maindd, DDPCAPS_8BIT | DDPCAPS_ALLOW256, pal, &dxdata.palette, NULL);
if (FAILED (ddrval))
- write_log ("IDirectDraw_CreatePalette: %s\n", DXError (ddrval));
+ write_log (L"IDirectDraw_CreatePalette: %s\n", DXError (ddrval));
return ddrval;
}
struct dxcap {
int num;
- char *name;
+ TCHAR *name;
DWORD mask;
};
static struct dxcap dxcapsinfo[] =
{
- { 1, "DDCAPS_BLT", DDCAPS_BLT },
- { 1, "DDCAPS_BLTQUEUE", DDCAPS_BLTQUEUE },
- { 1, "DDCAPS_BLTFOURCC", DDCAPS_BLTFOURCC },
- { 1, "DDCAPS_BLTCOLORFILL", DDCAPS_BLTSTRETCH },
- { 1, "DDCAPS_BLTSTRETCH", DDCAPS_BLTSTRETCH },
- { 1, "DDCAPS_CANBLTSYSMEM", DDCAPS_CANBLTSYSMEM },
- { 1, "DDCAPS_CANCLIP", DDCAPS_CANCLIP },
- { 1, "DDCAPS_CANCLIPSTRETCHED", DDCAPS_CANCLIPSTRETCHED },
- { 1, "DDCAPS_COLORKEY", DDCAPS_COLORKEY },
- { 1, "DDCAPS_COLORKEYHWASSIST", DDCAPS_COLORKEYHWASSIST },
- { 1, "DDCAPS_GDI", DDCAPS_GDI },
- { 1, "DDCAPS_NOHARDWARE", DDCAPS_NOHARDWARE },
- { 1, "DDCAPS_OVERLAY", DDCAPS_OVERLAY },
- { 1, "DDCAPS_VBI", DDCAPS_VBI },
- { 1, "DDCAPS_3D", DDCAPS_3D },
- { 1, "DDCAPS_BANKSWITCHED", DDCAPS_BANKSWITCHED },
- { 1, "DDCAPS_PALETTE", DDCAPS_PALETTE },
- { 1, "DDCAPS_PALETTEVSYNC", DDCAPS_PALETTEVSYNC },
- { 1, "DDCAPS_READSCANLINE", DDCAPS_READSCANLINE },
- { 2, "DDCAPS2_CERTIFIED", DDCAPS2_CERTIFIED },
- { 2, "DDCAPS2_CANRENDERWINDOWED", DDCAPS2_CANRENDERWINDOWED },
- { 2, "DDCAPS2_NOPAGELOCKREQUIRED", DDCAPS2_NOPAGELOCKREQUIRED },
- { 2, "DDCAPS2_FLIPNOVSYNC", DDCAPS2_FLIPNOVSYNC },
- { 2, "DDCAPS2_FLIPINTERVAL", DDCAPS2_FLIPINTERVAL },
- { 2, "DDCAPS2_NO2DDURING3DSCENE", DDCAPS2_NO2DDURING3DSCENE },
- { 2, "DDCAPS2_NONLOCALVIDMEM", DDCAPS2_NONLOCALVIDMEM },
- { 2, "DDCAPS2_NONLOCALVIDMEMCAPS", DDCAPS2_NONLOCALVIDMEMCAPS },
- { 2, "DDCAPS2_WIDESURFACES", DDCAPS2_WIDESURFACES },
- { 3, "DDCKEYCAPS_DESTBLT", DDCKEYCAPS_DESTBLT },
- { 3, "DDCKEYCAPS_DESTBLTCLRSPACE", DDCKEYCAPS_DESTBLTCLRSPACE },
- { 3, "DDCKEYCAPS_SRCBLT", DDCKEYCAPS_SRCBLT },
- { 3, "DDCKEYCAPS_SRCBLTCLRSPACE", DDCKEYCAPS_SRCBLTCLRSPACE },
+ { 1, L"DDCAPS_BLT", DDCAPS_BLT },
+ { 1, L"DDCAPS_BLTQUEUE", DDCAPS_BLTQUEUE },
+ { 1, L"DDCAPS_BLTFOURCC", DDCAPS_BLTFOURCC },
+ { 1, L"DDCAPS_BLTCOLORFILL", DDCAPS_BLTSTRETCH },
+ { 1, L"DDCAPS_BLTSTRETCH", DDCAPS_BLTSTRETCH },
+ { 1, L"DDCAPS_CANBLTSYSMEM", DDCAPS_CANBLTSYSMEM },
+ { 1, L"DDCAPS_CANCLIP", DDCAPS_CANCLIP },
+ { 1, L"DDCAPS_CANCLIPSTRETCHED", DDCAPS_CANCLIPSTRETCHED },
+ { 1, L"DDCAPS_COLORKEY", DDCAPS_COLORKEY },
+ { 1, L"DDCAPS_COLORKEYHWASSIST", DDCAPS_COLORKEYHWASSIST },
+ { 1, L"DDCAPS_GDI", DDCAPS_GDI },
+ { 1, L"DDCAPS_NOHARDWARE", DDCAPS_NOHARDWARE },
+ { 1, L"DDCAPS_OVERLAY", DDCAPS_OVERLAY },
+ { 1, L"DDCAPS_VBI", DDCAPS_VBI },
+ { 1, L"DDCAPS_3D", DDCAPS_3D },
+ { 1, L"DDCAPS_BANKSWITCHED", DDCAPS_BANKSWITCHED },
+ { 1, L"DDCAPS_PALETTE", DDCAPS_PALETTE },
+ { 1, L"DDCAPS_PALETTEVSYNC", DDCAPS_PALETTEVSYNC },
+ { 1, L"DDCAPS_READSCANLINE", DDCAPS_READSCANLINE },
+ { 2, L"DDCAPS2_CERTIFIED", DDCAPS2_CERTIFIED },
+ { 2, L"DDCAPS2_CANRENDERWINDOWED", DDCAPS2_CANRENDERWINDOWED },
+ { 2, L"DDCAPS2_NOPAGELOCKREQUIRED", DDCAPS2_NOPAGELOCKREQUIRED },
+ { 2, L"DDCAPS2_FLIPNOVSYNC", DDCAPS2_FLIPNOVSYNC },
+ { 2, L"DDCAPS2_FLIPINTERVAL", DDCAPS2_FLIPINTERVAL },
+ { 2, L"DDCAPS2_NO2DDURING3DSCENE", DDCAPS2_NO2DDURING3DSCENE },
+ { 2, L"DDCAPS2_NONLOCALVIDMEM", DDCAPS2_NONLOCALVIDMEM },
+ { 2, L"DDCAPS2_NONLOCALVIDMEMCAPS", DDCAPS2_NONLOCALVIDMEMCAPS },
+ { 2, L"DDCAPS2_WIDESURFACES", DDCAPS2_WIDESURFACES },
+ { 3, L"DDCKEYCAPS_DESTBLT", DDCKEYCAPS_DESTBLT },
+ { 3, L"DDCKEYCAPS_DESTBLTCLRSPACE", DDCKEYCAPS_DESTBLTCLRSPACE },
+ { 3, L"DDCKEYCAPS_SRCBLT", DDCKEYCAPS_SRCBLT },
+ { 3, L"DDCKEYCAPS_SRCBLTCLRSPACE", DDCKEYCAPS_SRCBLTCLRSPACE },
{ 0, NULL }
};
static void showcaps (DDCAPS_DX7 *dc)
{
int i, out;
- write_log ("%08x %08x %08x %08x %08x %08x\n",
+ write_log (L"%08x %08x %08x %08x %08x %08x\n",
dc->dwCaps, dc->dwCaps2, dc->dwCKeyCaps, dc->dwFXCaps, dc->dwFXAlphaCaps, dc->dwPalCaps, dc->ddsCaps);
out = 0;
for (i = 0; dxcapsinfo[i].name; i++) {
}
if (caps & dxcapsinfo[i].mask) {
if (out > 0)
- write_log (",");
- write_log ("%s", dxcapsinfo[i].name);
+ write_log (L",");
+ write_log (L"%s", dxcapsinfo[i].name);
out++;
}
}
if (out > 0)
- write_log ("\n");
+ write_log (L"\n");
if ((dc->dwCaps & DDCAPS_COLORKEY) && (dc->dwCKeyCaps & DDCKEYCAPS_SRCBLT))
dxcaps.cancolorkey = TRUE;
if (dc->dwCaps2 & DDCAPS2_NONLOCALVIDMEM)
hc.dwSize = sizeof hc;
hr = IDirectDraw7_GetCaps (dxdata.maindd, &dc, &hc);
if (FAILED (hr)) {
- write_log ("IDirectDraw7_GetCaps() failed %s\n", DXError (hr));
+ write_log (L"IDirectDraw7_GetCaps() failed %s\n", DXError (hr));
return;
}
- write_log ("DriverCaps: ");
+ write_log (L"DriverCaps: ");
showcaps (&dc);
- write_log ("HELCaps : ");
+ write_log (L"HELCaps : ");
showcaps (&hc);
}
LPDIRECTDRAW dd;
ddrval = DirectDrawCreate (guid, &dd, NULL);
if (FAILED (ddrval)) {
- write_log ("DirectDrawCreate() failed, %s\n", DXError (ddrval));
+ write_log (L"DirectDrawCreate() failed, %s\n", DXError (ddrval));
if (guid != NULL)
return 0;
goto oops;
ddrval = IDirectDraw_QueryInterface (dd, &IID_IDirectDraw7, &dxdata.maindd);
IDirectDraw_Release (dd);
if (FAILED (ddrval)) {
- write_log ("IDirectDraw_QueryInterface() failed, %s\n", DXError (ddrval));
+ write_log (L"IDirectDraw_QueryInterface() failed, %s\n", DXError (ddrval));
goto oops;
}
#else
ddrval = DirectDrawCreateEx (guid, &dxdata.maindd, &IID_IDirectDraw7, NULL);
if (FAILED (ddrval)) {
- write_log ("DirectDrawCreateEx() failed, %s\n", DXError (ddrval));
+ write_log (L"DirectDrawCreateEx() failed, %s\n", DXError (ddrval));
if (guid != NULL)
return 0;
goto oops;
dxcaps.cursorwidth = 48;
dxcaps.cursorheight = 48;
if (!d3ddone) {
- d3dDLL = LoadLibrary ("D3D9.DLL");
+ d3dDLL = LoadLibrary (L"D3D9.DLL");
if (d3dDLL) {
d3d = Direct3DCreate9 (D3D9b_SDK_VERSION);
if (d3d) {
if (SUCCEEDED (IDirect3D9_GetDeviceCaps (d3d, 0, D3DDEVTYPE_HAL, &d3dCaps))) {
dxcaps.maxwidth = d3dCaps.MaxTextureWidth;
dxcaps.maxheight = d3dCaps.MaxTextureHeight;
- write_log ("Max hardware surface size: %dx%d\n", dxcaps.maxwidth, dxcaps.maxheight);
+ write_log (L"Max hardware surface size: %dx%d\n", dxcaps.maxwidth, dxcaps.maxheight);
}
IDirect3D9_Release (d3d);
}
return 1;
}
oops:
- write_log ("DirectDraw_Start: %s\n", DXError (ddrval));
+ write_log (L"DirectDraw_Start: %s\n", DXError (ddrval));
DirectDraw_Release ();
return 0;
}
int depth; /* depth in bytes-per-pixel */
int residx;
int refresh[MAX_REFRESH_RATES]; /* refresh-rates in Hz */
- char name[25];
+ TCHAR name[25];
/* Bit mask of RGBFF_xxx values. */
uae_u32 colormodes;
};
struct MultiDisplay {
int primary, disabled, gdi;
GUID guid;
- char *name;
- char *name2;
+ TCHAR *name;
+ TCHAR *name2;
struct PicassoResolution *DisplayModes;
RECT rect;
};
blue_mask
} DirectDraw_Mask_e;
-extern const char *DXError (HRESULT hr);
-extern char *outGUID (const GUID *guid);
+extern const TCHAR *DXError (HRESULT hr);
+extern TCHAR *outGUID (const GUID *guid);
HRESULT DirectDraw_GetDisplayMode (void);
void DirectDraw_Release(void);
HRESULT DirectDraw_SetClipper(HWND hWnd);
RGBFTYPE DirectDraw_GetSurfacePixelFormat(LPDDSURFACEDESC2 surface);
HRESULT DirectDraw_EnumDisplayModes(DWORD flags, LPDDENUMMODESCALLBACK2 callback, void *context);
-HRESULT DirectDraw_EnumDisplays(LPDDENUMCALLBACKEX callback);
+HRESULT DirectDraw_EnumDisplays(LPDDENUMCALLBACKEXA callback);
DWORD DirectDraw_CurrentWidth (void);
DWORD DirectDraw_CurrentHeight (void);
DWORD DirectDraw_GetCurrentDepth (void);
/* these are deadly (but I think allowed on the Amiga): */
#define NUM_EVILCHARS 7
-static char evilchars[NUM_EVILCHARS] = { '\\', '*', '?', '\"', '<', '>', '|' };
+static TCHAR evilchars[NUM_EVILCHARS] = { '\\', '*', '?', '\"', '<', '>', '|' };
-#define UAEFSDB_BEGINS "__uae___"
-#define UAEFSDB_BEGINSX "__uae___*"
+#define UAEFSDB_BEGINS L"__uae___"
+#define UAEFSDB_BEGINSX L"__uae___*"
#define UAEFSDB_LEN 604
+#define UAEFSDB2_LEN 1632
/* The on-disk format is as follows:
* Offset 0, 1 byte, valid
* Offset 262, 257 bytes, nname
* Offset 519, 81 bytes, comment
* Offset 600, 4 bytes, Windows-side mode
+ *
+ * 1.6.0+ Unicode data
+ *
+ * Offset 604, 257 * 2 bytes, aname
+ * Offset 1118, 257 * 2 bytes, nname
+ * 1632
*/
-static char *make_uaefsdbpath (const char *dir, const char *name)
+static TCHAR *make_uaefsdbpath (const TCHAR *dir, const TCHAR *name)
{
int len;
- char *p;
+ TCHAR *p;
- len = strlen (dir) + 1 + 1;
+ len = _tcslen (dir) + 1 + 1;
if (name)
- len += 1 + strlen (name);
- len += 1 + strlen (FSDB_FILE);
- p = xmalloc (len);
+ len += 1 + _tcslen (name);
+ len += 1 + _tcslen (FSDB_FILE);
+ p = xmalloc (len * sizeof (TCHAR));
if (!p)
return NULL;
if (name)
- sprintf (p, "%s\\%s:%s", dir, name, FSDB_FILE);
+ _stprintf (p, L"%s\\%s:%s", dir, name, FSDB_FILE);
else
- sprintf (p, "%s:%s", dir, FSDB_FILE);
+ _stprintf (p, L"%s:%s", dir, FSDB_FILE);
return p;
}
-static int read_uaefsdb (const char *dir, const char *name, uae_u8 *fsdb)
+static int read_uaefsdb (const TCHAR *dir, const TCHAR *name, uae_u8 *fsdb)
{
- char *p;
+ TCHAR *p;
HANDLE h;
DWORD read;
h = CreateFile (p, GENERIC_READ, 0,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (fsdb_debug)
- write_log ("read_uaefsdb '%s' = %x\n", p, h);
+ write_log (L"read_uaefsdb '%s' = %x\n", p, h);
xfree (p);
if (h != INVALID_HANDLE_VALUE) {
- ReadFile (h, fsdb, UAEFSDB_LEN, &read, NULL);
+ memset (fsdb, 0, UAEFSDB2_LEN);
+ ReadFile (h, fsdb, UAEFSDB2_LEN, &read, NULL);
CloseHandle (h);
- if (read == UAEFSDB_LEN) {
+ if (read == UAEFSDB_LEN || read == UAEFSDB2_LEN) {
if (fsdb_debug) {
- write_log ("->ok\n");
- write_log ("v=%02x flags=%08x an='%s' nn='%s' c='%s'\n", fsdb[0], ((uae_u32*)(fsdb+1))[0], fsdb + 5, fsdb + 262, fsdb + 519);
+ TCHAR *an, *nn, *co;
+ write_log (L"->ok\n");
+ an = aucp (fsdb + 5, currprefs.win32_fscodepage);
+ nn = aucp (fsdb + 262, currprefs.win32_fscodepage);
+ co = aucp (fsdb + 519, currprefs.win32_fscodepage);
+ write_log (L"v=%02x flags=%08x an='%s' nn='%s' c='%s'\n",
+ fsdb[0], ((uae_u32*)(fsdb+1))[0], an, nn, co);
+ xfree (co);
+ xfree (nn);
+ xfree (an);
}
return 1;
}
}
if (fsdb_debug)
- write_log ("->fail %d, %d\n", read, GetLastError ());
- memset (fsdb, 0, UAEFSDB_LEN);
+ write_log (L"->fail %d, %d\n", read, GetLastError ());
+ memset (fsdb, 0, UAEFSDB2_LEN);
return 0;
}
-static int delete_uaefsdb (const char *dir)
+static int delete_uaefsdb (const TCHAR *dir)
{
- char *p;
+ TCHAR *p;
int ret;
p = make_uaefsdbpath (dir, NULL);
- ret = DeleteFile(p);
+ ret = DeleteFile (p);
if (fsdb_debug)
- write_log ("delete_uaefsdb '%s' = %d\n", p, ret);
+ write_log (L"delete_uaefsdb '%s' = %d\n", p, ret);
xfree (p);
return ret;
}
-static int write_uaefsdb (const char *dir, uae_u8 *fsdb)
+static int write_uaefsdb (const TCHAR *dir, uae_u8 *fsdb)
{
- char *p;
+ TCHAR *p;
HANDLE h;
DWORD written = 0, dirflag, dirattr;
DWORD attr = INVALID_FILE_ATTRIBUTES;
h = CreateFile (p, GENERIC_WRITE, 0,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (fsdb_debug) {
- write_log ("write_uaefsdb '%s' = %x\n", p, h);
- write_log ("v=%02x flags=%08x an='%s' nn='%s' c='%s'\n", fsdb[0], ((uae_u32*)(fsdb+1))[0], fsdb + 5, fsdb + 262, fsdb + 519);
+ TCHAR *an, *nn, *co;
+ an = aucp (fsdb + 5, currprefs.win32_fscodepage);
+ nn = aucp (fsdb + 262, currprefs.win32_fscodepage);
+ co = aucp (fsdb + 519, currprefs.win32_fscodepage);
+ write_log (L"write_uaefsdb '%s' = %x\n", p, h);
+ write_log (L"v=%02x flags=%08x an='%s' nn='%s' c='%s'\n",
+ fsdb[0], ((uae_u32*)(fsdb+1))[0], an, nn, co);
+ xfree (co);
+ xfree (nn);
+ xfree (an);
}
if (h == INVALID_HANDLE_VALUE && GetLastError () == ERROR_ACCESS_DENIED) {
attr = GetFileAttributes (p);
h = CreateFile (p, GENERIC_WRITE, 0,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (fsdb_debug)
- write_log ("write_uaefsdb (2) '%s' = %x\n", p, h);
+ write_log (L"write_uaefsdb (2) '%s' = %x\n", p, h);
}
}
}
if (h != INVALID_HANDLE_VALUE) {
- WriteFile (h, fsdb, UAEFSDB_LEN, &written, NULL);
+ WriteFile (h, fsdb, UAEFSDB2_LEN, &written, NULL);
CloseHandle (h);
- if (written == UAEFSDB_LEN) {
+ if (written == UAEFSDB2_LEN) {
if (fsdb_debug)
- write_log ("->ok\n");
+ write_log (L"->ok\n");
ret = 1;
goto end;
}
}
if (fsdb_debug)
- write_log ("->fail %d, %d\n", written, GetLastError ());
+ write_log (L"->fail %d, %d\n", written, GetLastError ());
DeleteFile (p);
end:
static void create_uaefsdb (a_inode *aino, uae_u8 *buf, int winmode)
{
+ TCHAR *nn;
+ char *s;
buf[0] = 1;
do_put_mem_long ((uae_u32 *)(buf + 1), aino->amigaos_mode);
- strncpy (buf + 5, aino->aname, 256);
+ s = uacp (aino->nname, currprefs.win32_fscodepage);
+ strncpy (buf + 5, s, 256);
buf[5 + 256] = '\0';
- strncpy (buf + 5 + 257, nname_begin (aino->nname), 256);
+ xfree (s);
+ nn = nname_begin (aino->nname);
+ s = uacp (nn, currprefs.win32_fscodepage);
+ strncpy (buf + 5 + 257, s, 256);
buf[5 + 257 + 256] = '\0';
- strncpy (buf + 5 + 2 * 257, aino->comment ? aino->comment : "", 80);
+ xfree (s);
+ s = uacp (aino->comment ? aino->comment : L"", currprefs.win32_fscodepage);
+ strncpy (buf + 5 + 2 * 257, s, 80);
buf[5 + 2 * 257 + 80] = '\0';
+ xfree (s);
do_put_mem_long ((uae_u32 *)(buf + 5 + 2 * 257 + 81), winmode);
+ _tcsncpy ((TCHAR*)(buf + 604), aino->nname, 256);
+ _tcsncpy ((TCHAR*)(buf + 1118), nn, 256);
aino->has_dbentry = 0;
aino->dirty = 0;
}
static a_inode *aino_from_buf (a_inode *base, uae_u8 *buf, int *winmode)
{
uae_u32 mode;
- a_inode *aino = (a_inode *) xcalloc (sizeof (a_inode), 1);
+ a_inode *aino = xcalloc (sizeof (a_inode), 1);
+ uae_u8 *buf2;
+ TCHAR *s;
+ buf2 = buf + 604;
mode = do_get_mem_long ((uae_u32 *)(buf + 1));
buf += 5;
- aino->aname = my_strdup (buf);
+ if (buf2[0]) {
+ aino->aname = my_strdup ((TCHAR*)buf2);
+ } else {
+ aino->aname = aucp (buf, currprefs.win32_fscodepage);
+ }
buf += 257;
- aino->nname = build_nname (base->nname, buf);
+ buf2 += 257 * 2;
+ if (buf2[0]) {
+ aino->nname = build_nname (base->nname, (TCHAR*)buf2);
+ } else {
+ s = aucp (buf, currprefs.win32_fscodepage);
+ aino->nname = build_nname (base->nname, s);
+ xfree (s);
+ }
buf += 257;
- aino->comment = *buf != '\0' ? my_strdup (buf) : 0;
+ aino->comment = *buf != '\0' ? my_strdup_ansi (buf) : 0;
buf += 81;
aino->amigaos_mode = mode;
*winmode = do_get_mem_long ((uae_u32 *)buf);
+ aino->dir = ((*winmode) & FILE_ATTRIBUTE_DIRECTORY) ? 1 : 0;
*winmode &= FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN;
aino->has_dbentry = 0;
aino->dirty = 0;
aino->db_offset = 0;
- if((mode = GetFileAttributes(aino->nname)) == INVALID_FILE_ATTRIBUTES) {
- write_log ("xGetFileAttributes('%s') failed! error=%d, aino=%p\n",
- aino->nname, GetLastError(), aino);
+ if((mode = GetFileAttributes (aino->nname)) == INVALID_FILE_ATTRIBUTES) {
+ write_log (L"xGetFileAttributes('%s') failed! error=%d, aino=%p\n",
+ aino->nname, GetLastError (), aino);
return aino;
}
aino->dir = (mode & FILE_ATTRIBUTE_DIRECTORY) ? 1 : 0;
}
/* Return nonzero for any name we can't create on the native filesystem. */
-int fsdb_name_invalid (const char *n)
+int fsdb_name_invalid (const TCHAR *n)
{
int i;
- char a = n[0];
- char b = (a == '\0' ? a : n[1]);
- char c = (b == '\0' ? b : n[2]);
- char d = (c == '\0' ? c : n[3]);
- int l = strlen (n), ll;
+ TCHAR a = n[0];
+ TCHAR b = (a == '\0' ? a : n[1]);
+ TCHAR c = (b == '\0' ? b : n[2]);
+ TCHAR d = (c == '\0' ? c : n[3]);
+ int l = _tcslen (n), ll;
if (a >= 'a' && a <= 'z')
a -= 32;
/* these characters are *never* allowed */
for (i = 0; i < NUM_EVILCHARS; i++) {
- if (strchr (n, evilchars[i]) != 0)
+ if (_tcschr (n, evilchars[i]) != 0)
return 1;
}
/* the reserved fsdb filename */
- if (strcmp (n, FSDB_FILE) == 0)
+ if (_tcscmp (n, FSDB_FILE) == 0)
return 1;
return 0; /* the filename passed all checks, now it should be ok */
}
return mask ^ 0xf;
}
-int fsdb_exists (char *nname)
+int fsdb_exists (TCHAR *nname)
{
if (GetFileAttributes(nname) == INVALID_FILE_ATTRIBUTES)
return 0;
int fsdb_fill_file_attrs (a_inode *base, a_inode *aino)
{
int mode, winmode, oldamode;
- uae_u8 fsdb[UAEFSDB_LEN];
+ uae_u8 fsdb[UAEFSDB2_LEN];
int reset = 0;
if((mode = GetFileAttributes(aino->nname)) == INVALID_FILE_ATTRIBUTES) {
- write_log ("GetFileAttributes('%s') failed! error=%d, aino=%p dir=%d\n",
+ write_log (L"GetFileAttributes('%s') failed! error=%d, aino=%p dir=%d\n",
aino->nname, GetLastError(), aino, aino->dir);
return 0;
}
xfree (aino->comment);
aino->comment = NULL;
if (fsdb[5 + 2 * 257])
- aino->comment = my_strdup (fsdb + 5 + 2 * 257);
+ aino->comment = my_strdup_ansi (fsdb + 5 + 2 * 257);
xfree (aino_from_buf (base, fsdb, &winmode));
if (winmode == mode) /* no Windows-side editing? */
return 1;
- write_log ("FS: '%s' protection flags edited from Windows-side\n", aino->nname);
+ write_log (L"FS: '%s' protection flags edited from Windows-side\n", aino->nname);
reset = 1;
/* edited from Windows-side -> use Windows side flags instead */
}
static int needs_fsdb (a_inode *aino)
{
- const char *nn_begin;
+ const TCHAR *nn_begin;
if (aino->deleted)
return 0;
return 1;
nn_begin = nname_begin (aino->nname);
- return strcmp (nn_begin, aino->aname) != 0;
+ return _tcscmp (nn_begin, aino->aname) != 0;
}
int fsdb_set_file_attrs (a_inode *aino)
{
uae_u32 tmpmask;
- uae_u8 fsdb[UAEFSDB_LEN];
+ uae_u8 fsdb[UAEFSDB2_LEN];
uae_u32 mode;
tmpmask = filesys_parse_mask (aino->amigaos_mode);
return 0;
}
-char *fsdb_create_unique_nname (a_inode *base, const char *suggestion)
+TCHAR *fsdb_create_unique_nname (a_inode *base, const TCHAR *suggestion)
{
- char *c;
- char tmp[256] = UAEFSDB_BEGINS;
+ TCHAR *c;
+ TCHAR tmp[256] = UAEFSDB_BEGINS;
int i;
- strncat (tmp, suggestion, 240);
+ _tcsncat (tmp, suggestion, 240);
/* replace the evil ones... */
- for (i=0; i < NUM_EVILCHARS; i++)
- while ((c = strchr (tmp, evilchars[i])) != 0)
+ for (i = 0; i < NUM_EVILCHARS; i++)
+ while ((c = _tcschr (tmp, evilchars[i])) != 0)
*c = '_';
- while ((c = strchr (tmp, '.')) != 0)
+ while ((c = _tcschr (tmp, '.')) != 0)
*c = '_';
- while ((c = strchr (tmp, ' ')) != 0)
+ while ((c = _tcschr (tmp, ' ')) != 0)
*c = '_';
for (;;) {
- char *p = build_nname (base->nname, tmp);
+ TCHAR *p = build_nname (base->nname, tmp);
if (!fsdb_exists (p)) {
- write_log ("unique name: %s\n", p);
+ write_log (L"unique name: %s\n", p);
return p;
}
xfree (p);
}
}
-char *fsdb_search_dir (const char *dirname, char *rel)
+TCHAR *fsdb_search_dir (const TCHAR *dirname, TCHAR *rel)
{
WIN32_FIND_DATA fd;
HANDLE h;
- char *tmp, *p = 0;
+ TCHAR *tmp, *p = 0;
tmp = build_nname (dirname, rel);
h = FindFirstFile (tmp, &fd);
if (h != INVALID_HANDLE_VALUE) {
- if (strcmp (fd.cFileName, rel) == 0)
+ if (_tcscmp (fd.cFileName, rel) == 0)
p = rel;
else
p = my_strdup (fd.cFileName);
return p;
}
-static a_inode *custom_fsdb_lookup_aino (a_inode *base, const char *aname, int offset, int dontcreate)
+static a_inode *custom_fsdb_lookup_aino (a_inode *base, const TCHAR *aname, int offset, int dontcreate)
{
- uae_u8 fsdb[UAEFSDB_LEN];
- char *tmp1;
+ uae_u8 fsdb[UAEFSDB2_LEN];
+ TCHAR *tmp1;
HANDLE h;
WIN32_FIND_DATA fd;
static a_inode dummy;
+ TCHAR *s;
tmp1 = build_nname (base->nname, UAEFSDB_BEGINSX);
if (!tmp1)
return NULL;
+ s = au (fsdb + offset);
h = FindFirstFile (tmp1, &fd);
if (h != INVALID_HANDLE_VALUE) {
do {
if (read_uaefsdb (base->nname, fd.cFileName, fsdb)) {
- if (same_aname (fsdb + offset, aname)) {
+ if (same_aname (s, aname)) {
int winmode;
FindClose (h);
xfree (tmp1);
+ xfree (s);
if (dontcreate)
return &dummy;
return aino_from_buf (base, fsdb, &winmode);
} while (FindNextFile (h, &fd));
FindClose (h);
}
+ xfree (s);
xfree (tmp1);
return NULL;
}
-a_inode *custom_fsdb_lookup_aino_aname (a_inode *base, const char *aname)
+a_inode *custom_fsdb_lookup_aino_aname (a_inode *base, const TCHAR *aname)
{
return custom_fsdb_lookup_aino (base, aname, 5, 0);
}
-a_inode *custom_fsdb_lookup_aino_nname (a_inode *base, const char *nname)
+a_inode *custom_fsdb_lookup_aino_nname (a_inode *base, const TCHAR *nname)
{
return custom_fsdb_lookup_aino (base, nname, 5 + 257, 0);
}
-int custom_fsdb_used_as_nname (a_inode *base, const char *nname)
+int custom_fsdb_used_as_nname (a_inode *base, const TCHAR *nname)
{
if (custom_fsdb_lookup_aino (base, nname, 5 + 257, 1))
return 1;
return 0;
}
-int my_mkdir (const char *name)
+int my_mkdir (const TCHAR *name)
{
return CreateDirectory (name, NULL) == 0 ? -1 : 0;
}
-static int recycle (const char *name)
+static int recycle (const TCHAR *name)
{
if (currprefs.win32_norecyclebin) {
DWORD dirattr = GetFileAttributes (name);
} else {
SHFILEOPSTRUCT fos;
/* name must be terminated by \0\0 */
- char *p = xcalloc (strlen (name) + 2, 1);
+ TCHAR *p = xcalloc ((_tcslen (name) + 2) * sizeof (TCHAR), 1);
int v;
- strcpy (p, name);
+ _tcscpy (p, name);
memset (&fos, 0, sizeof (fos));
fos.wFunc = FO_DELETE;
fos.pFrom = p;
}
}
-int my_rmdir (const char *name)
+int my_rmdir (const TCHAR *name)
{
void *od;
int cnt;
- char tname[MAX_DPATH];
+ TCHAR tname[MAX_DPATH];
/* SHFileOperation() ignores FOF_NORECURSION when deleting directories.. */
od = my_opendir (name);
}
cnt = 0;
while (my_readdir (od, tname)) {
- if (!strcmp (tname, ".") || !strcmp (tname, ".."))
+ if (!_tcscmp (tname, L".") || !_tcscmp (tname, L".."))
continue;
cnt++;
break;
}
/* "move to Recycle Bin" (if enabled) -version of DeleteFile() */
-int my_unlink (const char *name)
+int my_unlink (const TCHAR *name)
{
return recycle (name);
}
-int my_rename (const char *oldname, const char *newname)
+int my_rename (const TCHAR *oldname, const TCHAR *newname)
{
return MoveFile (oldname, newname) == 0 ? -1 : 0;
}
int first;
};
-void *my_opendir (const char *name)
+void *my_opendir (const TCHAR *name)
{
struct my_opendirs *mod;
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
- strcpy (tmp, name);
- strcat (tmp, "\\*.*");
+ _tcscpy (tmp, name);
+ _tcscat (tmp, L"\\*.*");
mod = xmalloc (sizeof (struct my_opendirs));
if (!mod)
return NULL;
xfree (mod);
}
-int my_readdir (void *d, char *name)
+int my_readdir (void *d, TCHAR *name)
{
struct my_opendirs *mod = d;
if (mod->first) {
- strcpy (name, mod->fd.cFileName);
+ _tcscpy (name, mod->fd.cFileName);
mod->first = 0;
return 1;
}
if (!FindNextFile (mod->h, &mod->fd))
return 0;
- strcpy (name, mod->fd.cFileName);
+ _tcscpy (name, mod->fd.cFileName);
return 1;
}
xfree (mos);
}
-unsigned int my_lseek (void *d, unsigned int offset, int whence)
+uae_s64 int my_lseek (void *d, uae_s64 int offset, int whence)
{
struct my_opens *mos = d;
- return SetFilePointer (mos->h, offset, NULL,
+ LARGE_INTEGER li;
+
+ li.QuadPart = offset;
+ li.LowPart = SetFilePointer (mos->h, li.LowPart, &li.HighPart,
whence == SEEK_SET ? FILE_BEGIN : (whence == SEEK_END ? FILE_END : FILE_CURRENT));
+ if (li.LowPart == INVALID_SET_FILE_POINTER && GetLastError () != NO_ERROR)
+ li.QuadPart = -1;
+ return li.QuadPart;
}
unsigned int my_read (void *d, void *b, unsigned int size)
return written;
}
-static DWORD GetFileAttributesSafe(const char *name)
+static DWORD GetFileAttributesSafe(const TCHAR *name)
{
DWORD attr, last;
return attr;
}
-int my_existsfile (const char *name)
+int my_existsfile (const TCHAR *name)
{
DWORD attr = GetFileAttributesSafe (name);
if (attr == INVALID_FILE_ATTRIBUTES)
return 0;
}
-int my_existsdir (const char *name)
+int my_existsdir (const TCHAR *name)
{
DWORD attr = GetFileAttributesSafe (name);
if (attr == INVALID_FILE_ATTRIBUTES)
return 0;
}
-void *my_open (const char *name, int flags)
+void *my_open (const TCHAR *name, int flags)
{
struct my_opens *mos;
HANDLE h;
err = GetLastError();
}
if (h == INVALID_HANDLE_VALUE) {
- write_log ("failed to open '%s' %x %x err=%d\n", name, DesiredAccess, CreationDisposition, err);
+ write_log (L"failed to open '%s' %x %x err=%d\n", name, DesiredAccess, CreationDisposition, err);
xfree (mos);
mos = NULL;
goto err;
}
mos->h = h;
err:
- //write_log ("open '%s' = %x\n", name, mos ? mos->h : 0);
+ //write_log (L"open '%s' = %x\n", name, mos ? mos->h : 0);
return mos;
}
-int my_truncate (const char *name, long int len)
+int my_truncate (const TCHAR *name, uae_u64 len)
{
HANDLE hFile;
BOOL bResult = FALSE;
if ((hFile = CreateFile (name, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ) ) != INVALID_HANDLE_VALUE )
{
- if (SetFilePointer (hFile, len, NULL, FILE_BEGIN) == (DWORD)len) {
+ LARGE_INTEGER li;
+ li.QuadPart = len;
+ li.LowPart = SetFilePointer (hFile, li.LowPart, &li.HighPart, FILE_BEGIN);
+ if (li.LowPart == INVALID_SET_FILE_POINTER && GetLastError () != NO_ERROR) {
+ write_log (L"truncate: SetFilePointer() failure for %s to posn %d\n", name, len);
+ } else {
if (SetEndOfFile (hFile) == TRUE)
result = 0;
- } else {
- write_log ("truncate: SetFilePointer() failure for %s to posn %d\n", name, len);
}
- CloseHandle( hFile );
+ CloseHandle (hFile);
} else {
- write_log ("truncate: CreateFile() failed to open %s\n", name);
+ write_log (L"truncate: CreateFile() failed to open %s\n", name);
}
return result;
}
{
DWORD e = GetLastError ();
- //write_log ("ec=%d\n", e);
+ //write_log (L"ec=%d\n", e);
switch (e) {
case ERROR_NOT_ENOUGH_MEMORY:
case ERROR_OUTOFMEMORY:
return ERROR_SEEK_ERROR;
default:
- write_log ("Unimplemented error %d\n", e);
+ gui_message (L"Unimplemented error %d\nContact author!", e);
return ERROR_NOT_IMPLEMENTED;
}
}
typedef BOOL (CALLBACK* GETVOLUMEPATHNAME)
(LPCTSTR lpszFileName, LPTSTR lpszVolumePathName, DWORD cchBufferLength);
-int my_getvolumeinfo (const char *root)
+int my_getvolumeinfo (const TCHAR *root)
{
DWORD v, err;
int ret = 0;
GETVOLUMEPATHNAME pGetVolumePathName;
- char volume[MAX_DPATH];
+ TCHAR volume[MAX_DPATH];
v = GetFileAttributesSafe (root);
err = GetLastError ();
ret |= MYVOLUMEINFO_READONLY;
*/
pGetVolumePathName = (GETVOLUMEPATHNAME)GetProcAddress(
- GetModuleHandle("kernel32.dll"), "GetVolumePathNameA");
+ GetModuleHandle (L"kernel32.dll"), "GetVolumePathNameW");
if (pGetVolumePathName && pGetVolumePathName (root, volume, sizeof (volume))) {
- char fsname[MAX_DPATH];
+ TCHAR fsname[MAX_DPATH];
DWORD comlen;
DWORD flags;
if (GetVolumeInformation (volume, NULL, 0, NULL, &comlen, &flags, fsname, sizeof (fsname))) {
- write_log ("Volume %s FS=%s maxlen=%d flags=%08X\n", volume, fsname, comlen, flags);
+ write_log (L"Volume %s FS=%s maxlen=%d flags=%08X\n", volume, fsname, comlen, flags);
if (flags & FILE_NAMED_STREAMS)
ret |= MYVOLUMEINFO_STREAMS;
}
static int usefloppydrives = 0;
struct uae_driveinfo {
- char vendor_id[128];
- char product_id[128];
- char product_rev[128];
- char product_serial[128];
- char device_name[2048];
- char device_path[2048];
+ TCHAR vendor_id[128];
+ TCHAR product_id[128];
+ TCHAR product_rev[128];
+ TCHAR product_serial[128];
+ TCHAR device_name[2048];
+ TCHAR device_path[2048];
uae_u64 size;
uae_u64 offset;
int bytespersector;
{
static int cnt = 1;
int i, blocks;
- char name[100];
+ TCHAR name[100];
FILE *f;
blocks = (buf[132] << 24) | (buf[133] << 16) | (buf[134] << 8) | (buf[135] << 0);
if (blocks < 0 || blocks > 100000)
return;
- sprintf (name, "rdb_dump_%d.rdb", cnt);
- f = fopen (name, "wb");
+ _stprintf (name, L"rdb_dump_%d.rdb", cnt);
+ f = _tfopen (name, L"wb");
if (!f)
return;
for (i = 0; i <= blocks; i++) {
for (j = 0; j < blocks; j++) {
high = (DWORD)(offset >> 32);
if (SetFilePointer (h, (DWORD)offset, &high, FILE_BEGIN) == INVALID_FILE_SIZE) {
- write_log ("hd ignored, SetFilePointer failed, error %d\n", GetLastError());
+ write_log (L"hd ignored, SetFilePointer failed, error %d\n", GetLastError());
return 1;
}
memset (buf, 0xaa, blocksize);
ReadFile (h, buf, blocksize, &outlen, NULL);
if (outlen != blocksize) {
- write_log ("hd ignored, read error %d!\n", GetLastError());
+ write_log (L"hd ignored, read error %d!\n", GetLastError());
return 2;
}
if (!memcmp (buf, "RDSK", 4)) {
if (do_rdbdump)
rdbdump (h, offset, buf, blocksize);
- write_log ("hd accepted (rdb detected at block %d)\n", j);
+ write_log (L"hd accepted (rdb detected at block %d)\n", j);
return -1;
}
if (!memcmp (buf + 2, "CIS@", 4) && !memcmp (buf + 16, CA, strlen (CA))) {
- write_log ("hd accepted (PCMCIA RAM)\n");
+ write_log (L"hd accepted (PCMCIA RAM)\n");
return -2;
}
if (j == 0) {
offset += blocksize;
}
if (!empty) {
- write_log ("hd ignored, not empty and no RDB detected\n");
+ write_log (L"hd ignored, not empty and no RDB detected\n");
return 0;
}
- write_log ("hd accepted (empty)\n");
+ write_log (L"hd accepted (empty)\n");
return -9;
}
-static void trim (char *s)
+static void trim (TCHAR *s)
{
- while(strlen(s) > 0 && s[strlen(s) - 1] == ' ')
- s[strlen(s) - 1] = 0;
+ while(_tcslen(s) > 0 && s[_tcslen(s) - 1] == ' ')
+ s[_tcslen(s) - 1] = 0;
}
-int isharddrive (const char *name)
+int isharddrive (const TCHAR *name)
{
int i;
for (i = 0; i < hdf_getnumharddrives (); i++) {
- if (!strcmp (uae_drives[i].device_name, name))
+ if (!_tcscmp (uae_drives[i].device_name, name))
return i;
}
return -1;
}
-static char *hdz[] = { "hdz", "zip", "rar", "7z", NULL };
+static TCHAR *hdz[] = { L"hdz", L"zip", L"rar", L"7z", NULL };
-int hdf_open_target (struct hardfiledata *hfd, const char *pname)
+int hdf_open_target (struct hardfiledata *hfd, const TCHAR *pname)
{
HANDLE h = INVALID_HANDLE_VALUE;
DWORD flags;
int i;
struct uae_driveinfo *udi;
- char *name = my_strdup (pname);
+ TCHAR *name = my_strdup (pname);
hfd->flags = 0;
hfd->drive_empty = 0;
hfd->virtual_size = 0;
hfd->virtual_rdb = NULL;
if (!hfd->cache) {
- write_log ("VirtualAlloc(%d) failed, error %d\n", CACHE_SIZE, GetLastError());
+ write_log (L"VirtualAlloc(%d) failed, error %d\n", CACHE_SIZE, GetLastError());
goto end;
}
- hfd_log ("hfd open: '%s'\n", name);
- if (strlen (name) > 4 && !memcmp (name, "HD_", 3)) {
+ hfd_log (L"hfd open: '%s'\n", name);
+ if (_tcslen (name) > 4 && !_tcsncmp (name, L"HD_", 3)) {
hdf_init_target ();
i = isharddrive (name);
if (i >= 0) {
if (h == INVALID_HANDLE_VALUE)
goto end;
if (!DeviceIoControl(h, FSCTL_ALLOW_EXTENDED_DASD_IO, NULL, 0, NULL, 0, &r, NULL))
- write_log ("WARNING: '%s' FSCTL_ALLOW_EXTENDED_DASD_IO returned %d\n", name, GetLastError());
- strncpy (hfd->vendor_id, udi->vendor_id, 8);
- strncpy (hfd->product_id, udi->product_id, 16);
- strncpy (hfd->product_rev, udi->product_rev, 4);
+ write_log (L"WARNING: '%s' FSCTL_ALLOW_EXTENDED_DASD_IO returned %d\n", name, GetLastError());
+ _tcsncpy (hfd->vendor_id, udi->vendor_id, 8);
+ _tcsncpy (hfd->product_id, udi->product_id, 16);
+ _tcsncpy (hfd->product_rev, udi->product_rev, 4);
hfd->offset = udi->offset;
hfd->physsize = hfd->virtsize = udi->size;
hfd->blocksize = udi->bytespersector;
}
} else {
int zmode = 0;
- char *ext = strrchr (name, '.');
+ TCHAR *ext = _tcsrchr (name, '.');
if (ext != NULL) {
ext++;
for (i = 0; hdz[i]; i++) {
- if (!stricmp (ext, hdz[i]))
+ if (!_tcsicmp (ext, hdz[i]))
zmode = 1;
}
}
h = CreateFile (name, GENERIC_READ | (hfd->readonly ? 0 : GENERIC_WRITE), hfd->readonly ? FILE_SHARE_READ : 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
hfd->handle = h;
- i = strlen (name) - 1;
+ i = _tcslen (name) - 1;
while (i >= 0) {
if ((i > 0 && (name[i - 1] == '/' || name[i - 1] == '\\')) || i == 0) {
- strcpy (hfd->vendor_id, "UAE");
- strncpy (hfd->product_id, name + i, 15);
- strcpy (hfd->product_rev, "0.3");
+ _tcscpy (hfd->vendor_id, L"UAE");
+ _tcsncpy (hfd->product_id, name + i, 15);
+ _tcscpy (hfd->product_rev, L"0.3");
break;
}
i--;
hfd->physsize = hfd->virtsize = ((uae_u64)high << 32) | low;
hfd->handle_valid = HDF_HANDLE_WIN32;
if (hfd->physsize < 64 * 1024 * 1024 && zmode) {
- write_log ("HDF '%s' re-opened in zfile-mode\n", name);
+ write_log (L"HDF '%s' re-opened in zfile-mode\n", name);
CloseHandle (h);
- hfd->handle = h = zfile_fopen(name, hfd->readonly ? "rb" : "r+b");
+ hfd->handle = h = zfile_fopen(name, hfd->readonly ? L"rb" : L"r+b");
if (!h)
goto end;
zfile_fseek (h, 0, SEEK_END);
hfd->handle_valid = HDF_HANDLE_ZFILE;
}
} else {
- write_log ("HDF '%s' failed to open. error = %d\n", name, GetLastError ());
+ write_log (L"HDF '%s' failed to open. error = %d\n", name, GetLastError ());
}
}
hfd->handle = h;
if (hfd->handle_valid || hfd->drive_empty) {
- hfd_log ("HDF '%s' opened, size=%dK mode=%d empty=%d\n",
+ hfd_log (L"HDF '%s' opened, size=%dK mode=%d empty=%d\n",
name, hfd->physsize / 1024, hfd->handle_valid, hfd->drive_empty);
return 1;
}
DWORD high, ret;
if (hfd->handle_valid == 0) {
- gui_message ("hd: hdf handle is not valid. bug.");
+ gui_message (L"hd: hdf handle is not valid. bug.");
abort();
}
if (offset >= hfd->physsize - hfd->virtual_size) {
- gui_message ("hd: tried to seek out of bounds! (%I64X >= %I64X)\n", offset, hfd->physsize);
+ gui_message (L"hd: tried to seek out of bounds! (%I64X >= %I64X)\n", offset, hfd->physsize);
abort ();
}
offset += hfd->offset;
if (offset & (hfd->blocksize - 1)) {
- gui_message ("hd: poscheck failed, offset not aligned to blocksize! (%I64X & %04X = %04X)\n",
+ gui_message (L"hd: poscheck failed, offset not aligned to blocksize! (%I64X & %04X = %04X)\n",
offset, hfd->blocksize, offset & (hfd->blocksize - 1));
abort ();
}
ret = SetFilePointer (hfd->handle, 0, &high, FILE_CURRENT);
err = GetLastError ();
if (ret == INVALID_FILE_SIZE && err != NO_ERROR) {
- gui_message ("hd: poscheck failed. seek failure, error %d", err);
+ gui_message (L"hd: poscheck failed. seek failure, error %d", err);
abort ();
}
pos = ((uae_u64)high) << 32 | ret;
pos = zfile_ftell (hfd->handle);
}
if (len < 0) {
- gui_message ("hd: poscheck failed, negative length! (%d)", len);
+ gui_message (L"hd: poscheck failed, negative length! (%d)", len);
abort ();
}
if (pos < hfd->offset) {
- gui_message ("hd: poscheck failed, offset out of bounds! (%I64d < %I64d)", pos, hfd->offset);
+ gui_message (L"hd: poscheck failed, offset out of bounds! (%I64d < %I64d)", pos, hfd->offset);
abort ();
}
if (pos >= hfd->offset + hfd->physsize - hfd->virtual_size || pos >= hfd->offset + hfd->physsize + len - hfd->virtual_size) {
- gui_message ("hd: poscheck failed, offset out of bounds! (%I64d >= %I64d, LEN=%d)", pos, hfd->offset + hfd->physsize, len);
+ gui_message (L"hd: poscheck failed, offset out of bounds! (%I64d >= %I64d, LEN=%d)", pos, hfd->offset + hfd->physsize, len);
abort ();
}
if (pos & (hfd->blocksize - 1)) {
- gui_message ("hd: poscheck failed, offset not aligned to blocksize! (%I64X & %04X = %04X\n", pos, hfd->blocksize, pos & hfd->blocksize);
+ gui_message (L"hd: poscheck failed, offset not aligned to blocksize! (%I64X & %04X = %04X\n", pos, hfd->blocksize, pos & hfd->blocksize);
abort ();
}
}
memcpy (buffer, hfd->cache + coffset, len);
return len;
}
- write_log ("hdf_read: cache bug! offset=%I64d len=%d\n", offset, len);
+ write_log (L"hdf_read: cache bug! offset=%I64d len=%d\n", offset, len);
hfd->cache_valid = 0;
return 0;
}
static void generatestorageproperty (struct uae_driveinfo *udi, int ignoreduplicates)
{
- strcpy (udi->vendor_id, "UAE");
- strcpy (udi->product_id, "DISK");
- strcpy (udi->product_rev, "1.0");
- sprintf (udi->device_name, "%s", udi->device_path);
+ _tcscpy (udi->vendor_id, L"UAE");
+ _tcscpy (udi->product_id, L"DISK");
+ _tcscpy (udi->product_rev, L"1.0");
+ _stprintf (udi->device_name, L"%s", udi->device_path);
udi->removablemedia = 1;
}
static int getstorageproperty (PUCHAR outBuf, int returnedLength, struct uae_driveinfo *udi, int ignoreduplicates)
{
PSTORAGE_DEVICE_DESCRIPTOR devDesc;
- char orgname[1024];
+ TCHAR orgname[1024];
PUCHAR p;
int i, j;
int size;
size = devDesc->Version;
p = (PUCHAR) outBuf;
if (offsetof(STORAGE_DEVICE_DESCRIPTOR, CommandQueueing) > size) {
- write_log ("too short STORAGE_DEVICE_DESCRIPTOR only %d bytes\n", size);
+ write_log (L"too short STORAGE_DEVICE_DESCRIPTOR only %d bytes\n", size);
return 1;
}
if (devDesc->DeviceType != INQ_DASD && devDesc->DeviceType != INQ_ROMD && devDesc->DeviceType != INQ_OPTD) {
- write_log ("not a direct access device, ignored (type=%d)\n", devDesc->DeviceType);
+ write_log (L"not a direct access device, ignored (type=%d)\n", devDesc->DeviceType);
return 1;
}
if (size > offsetof(STORAGE_DEVICE_DESCRIPTOR, VendorIdOffset) && devDesc->VendorIdOffset && p[devDesc->VendorIdOffset]) {
udi->product_serial[j++] = p[i];
}
if (udi->vendor_id[0])
- strcat (udi->device_name, udi->vendor_id);
+ _tcscat (udi->device_name, udi->vendor_id);
if (udi->product_id[0]) {
if (udi->device_name[0])
- strcat (udi->device_name, " ");
- strcat (udi->device_name, udi->product_id);
+ _tcscat (udi->device_name, L" ");
+ _tcscat (udi->device_name, udi->product_id);
}
if (udi->product_rev[0]) {
if (udi->device_name[0])
- strcat (udi->device_name, " ");
- strcat (udi->device_name, udi->product_rev);
+ _tcscat (udi->device_name, L" ");
+ _tcscat (udi->device_name, udi->product_rev);
}
if (udi->product_serial[0]) {
if (udi->device_name[0])
- strcat (udi->device_name, " ");
- strcat (udi->device_name, udi->product_serial);
+ _tcscat (udi->device_name, L" ");
+ _tcscat (udi->device_name, udi->product_serial);
}
if (!udi->device_name[0]) {
- write_log ("empty device id?!?, replacing with device path\n");
- strcpy (udi->device_name, udi->device_path);
+ write_log (L"empty device id?!?, replacing with device path\n");
+ _tcscpy (udi->device_name, udi->device_path);
}
udi->removablemedia = devDesc->RemovableMedia;
- write_log ("device id string: '%s'\n", udi->device_name);
+ write_log (L"device id string: '%s'\n", udi->device_name);
if (ignoreduplicates) {
- sprintf (orgname, "HD_%s", udi->device_name);
+ _stprintf (orgname, L"HD_%s", udi->device_name);
if (isharddrive (orgname) >= 0) {
- write_log ("duplicate device, ignored\n");
+ write_log (L"duplicate device, ignored\n");
return 1;
}
if (!udi->removablemedia) {
- write_log ("drive letter not removable, ignored\n");
+ write_log (L"drive letter not removable, ignored\n");
return 1;
}
}
return 0;
}
-static BOOL GetDevicePropertyFromName(const char *DevicePath, DWORD Index, DWORD *index2, uae_u8 *buffer, int ignoreduplicates)
+static BOOL GetDevicePropertyFromName(const TCHAR *DevicePath, DWORD Index, DWORD *index2, uae_u8 *buffer, int ignoreduplicates)
{
int i, nosp;
int ret = -1;
STORAGE_PROPERTY_QUERY query;
DRIVE_LAYOUT_INFORMATION *dli;
struct uae_driveinfo *udi;
- char orgname[1024];
+ TCHAR orgname[1024];
HANDLE hDevice = INVALID_HANDLE_VALUE;
UCHAR outBuf[20000];
DISK_GEOMETRY dg;
udi = &uae_drives[*index2];
memset (udi, 0, sizeof (struct uae_driveinfo));
- strcpy (udi->device_path, DevicePath);
- write_log ("opening device '%s'\n", udi->device_path);
+ _tcscpy (udi->device_path, DevicePath);
+ write_log (L"opening device '%s'\n", udi->device_path);
hDevice = CreateFile(
udi->device_path, // device interface name
GENERIC_READ | GENERIC_WRITE, // dwDesiredAccess
if (hDevice == INVALID_HANDLE_VALUE) {
- write_log ("CreateFile failed with error: %d\n", GetLastError());
+ write_log (L"CreateFile failed with error: %d\n", GetLastError());
ret = 1;
goto end;
}
NULL
);
if (!status) {
- write_log ("IOCTL_STORAGE_QUERY_PROPERTY failed with error code %d.\n", GetLastError());
+ write_log (L"IOCTL_STORAGE_QUERY_PROPERTY failed with error code %d.\n", GetLastError());
} else {
adpDesc = (PSTORAGE_ADAPTER_DESCRIPTOR) outBuf;
}
NULL);
if (!status) {
DWORD err = GetLastError ();
- write_log ("IOCTL_STORAGE_QUERY_PROPERTY failed with error code %d.\n", err);
+ write_log (L"IOCTL_STORAGE_QUERY_PROPERTY failed with error code %d.\n", err);
if (err != ERROR_INVALID_FUNCTION) {
ret = 1;
goto end;
goto end;
}
}
- strcpy (orgname, udi->device_name);
+ _tcscpy (orgname, udi->device_name);
udi->bytespersector = 512;
if (!DeviceIoControl (hDevice, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, (void*)&dg, sizeof (dg), &returnedLength, NULL)) {
DWORD err = GetLastError();
udi->nomedia = 1;
goto amipartfound;
}
- write_log ("IOCTL_DISK_GET_DRIVE_GEOMETRY failed with error code %d.\n", err);
+ write_log (L"IOCTL_DISK_GET_DRIVE_GEOMETRY failed with error code %d.\n", err);
ret = 1;
goto end;
}
gli_ok = 1;
if (!DeviceIoControl (hDevice, IOCTL_DISK_GET_LENGTH_INFO, NULL, 0, (void*)&gli, sizeof (gli), &returnedLength, NULL)) {
gli_ok = 0;
- write_log ("IOCTL_DISK_GET_LENGTH_INFO failed with error code %d.\n", GetLastError());
+ write_log (L"IOCTL_DISK_GET_LENGTH_INFO failed with error code %d.\n", GetLastError());
if (!nosp)
- write_log ("IOCTL_DISK_GET_LENGTH_INFO not supported, detected disk size may not be correct.\n");
+ write_log (L"IOCTL_DISK_GET_LENGTH_INFO not supported, detected disk size may not be correct.\n");
}
udi->bytespersector = dg.BytesPerSector;
if (dg.BytesPerSector < 512) {
- write_log ("unsupported blocksize < 512 (%d)\n", dg.BytesPerSector);
+ write_log (L"unsupported blocksize < 512 (%d)\n", dg.BytesPerSector);
ret = 1;
goto end;
}
if (dg.BytesPerSector > 2048) {
- write_log ("unsupported blocksize > 2048 (%d)\n", dg.BytesPerSector);
+ write_log (L"unsupported blocksize > 2048 (%d)\n", dg.BytesPerSector);
ret = 1;
goto end;
}
udi->offset = 0;
- write_log ("BPS=%d Cyls=%I64d TPC=%d SPT=%d MediaType=%d\n",
+ write_log (L"BPS=%d Cyls=%I64d TPC=%d SPT=%d MediaType=%d\n",
dg.BytesPerSector, dg.Cylinders.QuadPart, dg.TracksPerCylinder, dg.SectorsPerTrack, dg.MediaType);
udi->size = (uae_u64)dg.BytesPerSector * (uae_u64)dg.Cylinders.QuadPart *
(uae_u64)dg.TracksPerCylinder * (uae_u64)dg.SectorsPerTrack;
if (gli_ok)
udi->size = gli.Length.QuadPart;
- write_log ("device size %I64d (0x%I64x) bytes\n", udi->size, udi->size);
+ write_log (L"device size %I64d (0x%I64x) bytes\n", udi->size, udi->size);
trim (orgname);
memset (outBuf, 0, sizeof (outBuf));
&outBuf, sizeof (outBuf), &returnedLength, NULL);
if (!status) {
DWORD err = GetLastError();
- write_log ("IOCTL_DISK_GET_DRIVE_LAYOUT failed with error code %d.\n", err);
+ write_log (L"IOCTL_DISK_GET_DRIVE_LAYOUT failed with error code %d.\n", err);
if (err != ERROR_INVALID_FUNCTION) {
ret = 1;
goto end;
int nonzeropart = 0;
int gotpart = 0;
int safepart = 0;
- write_log ("%d MBR partitions found\n", dli->PartitionCount);
+ write_log (L"%d MBR partitions found\n", dli->PartitionCount);
for (i = 0; i < dli->PartitionCount && (*index2) < MAX_FILESYSTEM_UNITS; i++) {
PARTITION_INFORMATION *pi = &dli->PartitionEntry[i];
if (pi->PartitionType == PARTITION_ENTRY_UNUSED)
continue;
- write_log ("%d: num: %d type: %02X offset: %I64d size: %I64d, ", i, pi->PartitionNumber, pi->PartitionType, pi->StartingOffset.QuadPart, pi->PartitionLength.QuadPart);
+ write_log (L"%d: num: %d type: %02X offset: %I64d size: %I64d, ", i, pi->PartitionNumber, pi->PartitionType, pi->StartingOffset.QuadPart, pi->PartitionLength.QuadPart);
if (pi->RecognizedPartition == 0) {
- write_log ("unrecognized\n");
+ write_log (L"unrecognized\n");
continue;
}
nonzeropart++;
if (pi->PartitionType != 0x76) {
- write_log ("type not 0x76\n");
+ write_log (L"type not 0x76\n");
continue;
}
memmove (udi, udi2, sizeof (*udi));
udi->device_name[0] = 0;
udi->offset = pi->StartingOffset.QuadPart;
udi->size = pi->PartitionLength.QuadPart;
- write_log ("used\n");
+ write_log (L"used\n");
if (safetycheck (hDevice, udi->offset, buffer, dg.BytesPerSector) <= 0) {
- sprintf (udi->device_name, "HD_P#%d_%s", pi->PartitionNumber, orgname);
+ _stprintf (udi->device_name, L"HD_P#%d_%s", pi->PartitionNumber, orgname);
udi++;
(*index2)++;
safepart = 1;
gotpart = 1;
}
if (!nonzeropart) {
- write_log ("empty MBR partition table detected, checking for RDB\n");
+ write_log (L"empty MBR partition table detected, checking for RDB\n");
} else if (!gotpart) {
- write_log ("non-empty MBR partition table detected, doing RDB check anyway\n");
+ write_log (L"non-empty MBR partition table detected, doing RDB check anyway\n");
} else if (safepart) {
goto amipartfound; /* ugly but bleh.. */
}
} else {
- write_log ("no MBR partition table detected, checking for RDB\n");
+ write_log (L"no MBR partition table detected, checking for RDB\n");
}
udi->dangerous = safetycheck (hDevice, 0, buffer, dg.BytesPerSector);
if (udi->dangerous > 0)
goto end;
amipartfound:
- sprintf (udi->device_name, "HD_%s", orgname);
+ _stprintf (udi->device_name, L"HD_%s", orgname);
{
int cnt = 1;
- int off = strlen (udi->device_name);
+ int off = _tcslen (udi->device_name);
while (isharddrive (udi->device_name) >= 0) {
udi->device_name[off] = '_';
udi->device_name[off + 1] = cnt + '0';
if (status == FALSE) {
errorCode = GetLastError();
if (errorCode != ERROR_NO_MORE_ITEMS) {
- write_log ("SetupDiEnumDeviceInterfaces failed with error: %d\n", errorCode);
+ write_log (L"SetupDiEnumDeviceInterfaces failed with error: %d\n", errorCode);
}
ret = 0;
goto end;
if (status == FALSE) {
errorCode = GetLastError();
if (errorCode != ERROR_INSUFFICIENT_BUFFER) {
- write_log ("SetupDiGetDeviceInterfaceDetail failed with error: %d\n", errorCode);
+ write_log (L"SetupDiGetDeviceInterfaceDetail failed with error: %d\n", errorCode);
ret = 0;
goto end;
}
interfaceDetailDataSize = reqSize;
interfaceDetailData = malloc (interfaceDetailDataSize);
if (interfaceDetailData == NULL) {
- write_log ("Unable to allocate memory to get the interface detail data.\n");
+ write_log (L"Unable to allocate memory to get the interface detail data.\n");
ret = 0;
goto end;
}
NULL); // Interface device info
if (status == FALSE) {
- write_log ("Error in SetupDiGetDeviceInterfaceDetail failed with error: %d\n", GetLastError());
+ write_log (L"Error in SetupDiGetDeviceInterfaceDetail failed with error: %d\n", GetLastError());
ret = 0;
goto end;
}
dwDriveMask = GetLogicalDrives();
for(drive = 'A'; drive <= 'Z'; drive++) {
if((dwDriveMask & 1) && (drive >= 'C' || usefloppydrives)) {
- char tmp1[20], tmp2[20];
+ TCHAR tmp1[20], tmp2[20];
DWORD drivetype;
- sprintf (tmp1, "%c:\\", drive);
+ _stprintf (tmp1, L"%c:\\", drive);
drivetype = GetDriveType(tmp1);
if (drivetype != DRIVE_REMOTE) {
- sprintf (tmp2, "\\\\.\\%c:", drive);
+ _stprintf (tmp2, L"\\\\.\\%c:", drive);
GetDevicePropertyFromName (tmp2, index, &index2, buffer, 1);
num_drives = index2;
}
VirtualFree (buffer, 0, MEM_RELEASE);
}
num_drives = index2;
- write_log ("Drive scan result: %d Amiga formatted drives detected\n", num_drives);
+ write_log (L"Drive scan result: %d Amiga formatted drives detected\n", num_drives);
#endif
return num_drives;
}
return num_drives;
}
-char *hdf_getnameharddrive (int index, int flags, int *sectorsize)
+TCHAR *hdf_getnameharddrive (int index, int flags, int *sectorsize)
{
- static char name[512];
- char tmp[32];
+ static TCHAR name[512];
+ TCHAR tmp[32];
uae_u64 size = uae_drives[index].size;
int nomedia = uae_drives[index].nomedia;
- char *dang = "?";
- char *rw = "RW";
+ TCHAR *dang = L"?";
+ TCHAR *rw = L"RW";
switch (uae_drives[index].dangerous)
{
case -9:
- dang = "Empty";
+ dang = L"Empty";
break;
case -2:
- dang = "SRAM";
+ dang = L"SRAM";
break;
case -1:
- dang = "RDB";
+ dang = L"RDB";
break;
case 0:
- dang = "NON-EMPTY";
+ dang = L"NON-EMPTY";
break;
}
if (nomedia)
- dang = "NO MEDIA";
+ dang = L"NO MEDIA";
if (uae_drives[index].readonly)
- rw = "RO";
+ rw = L"RO";
if (sectorsize)
*sectorsize = uae_drives[index].bytespersector;
if (flags & 1) {
if (nomedia) {
- strcpy (tmp, "N/A");
+ _tcscpy (tmp, L"N/A");
} else {
if (size >= 1024 * 1024 * 1024)
- sprintf (tmp, "%.1fG", ((double)(uae_u32)(size / (1024 * 1024))) / 1024.0);
+ _stprintf (tmp, L"%.1fG", ((double)(uae_u32)(size / (1024 * 1024))) / 1024.0);
else if (size < 10 * 1024 * 1024)
- sprintf (tmp, "%dK", size / 1024);
+ _stprintf (tmp, L"%dK", size / 1024);
else
- sprintf (tmp, "%.1fM", ((double)(uae_u32)(size / (1024))) / 1024.0);
+ _stprintf (tmp, L"%.1fM", ((double)(uae_u32)(size / (1024))) / 1024.0);
}
- sprintf (name, "%10s [%s,%s] %s", dang, tmp, rw, uae_drives[index].device_name + 3);
+ _stprintf (name, L"%10s [%s,%s] %s", dang, tmp, rw, uae_drives[index].device_name + 3);
return name;
}
if (flags & 2)
while (hfd->handle_valid) {
DWORD errormode;
- write_log ("testing if %s has media inserted\n", hfd->emptyname);
+ write_log (L"testing if %s has media inserted\n", hfd->emptyname);
status = 0;
errormode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
SetFilePointer (hfd->handle, 0, NULL, FILE_BEGIN);
SetErrorMode(errormode);
if (ret) {
if (got == hfd->blocksize) {
- write_log ("read ok (%d)\n", got);
+ write_log (L"read ok (%d)\n", got);
} else {
- write_log ("read ok but no data (%d)\n", hfd->blocksize);
+ write_log (L"read ok but no data (%d)\n", hfd->blocksize);
ret = 0;
err = 0;
}
} else {
- write_log ("=%d\n", err);
+ write_log (L"=%d\n", err);
}
if (!ret && (err == ERROR_DEV_NOT_EXIST || err == ERROR_WRONG_DISK)) {
if (!first)
status = -1;
end:
xfree (buf);
- write_log("hmc returned %d\n", status);
+ write_log (L"hmc returned %d\n", status);
return status;
}
static void hmc_check (struct hardfiledata *hfd, struct uaedev_config_info *uci, int *rescanned, int *reopen,
- int *gotinsert, const char *drvname, int inserted)
+ int *gotinsert, const TCHAR *drvname, int inserted)
{
int ret;
hdf_init2 (1);
*rescanned = 1;
}
- if (hfd->emptyname && strlen (hfd->emptyname) >= 6 && drvname && strlen (drvname) == 3 && drvname[1] == ':' && drvname[2] == '\\' && !inserted) { /* drive letter check */
- char tmp[10], *p;
- sprintf (tmp, "\\\\.\\%c:", drvname[0]);
- p = hfd->emptyname + strlen (hfd->emptyname) - 6;
- write_log("workaround-remove test: '%s' and '%s'\n", p, drvname);
- if (!strcmp (tmp, p)) {
- char *en = my_strdup (hfd->emptyname);
- write_log ("workaround-remove done\n");
+ if (hfd->emptyname && _tcslen (hfd->emptyname) >= 6 && drvname && _tcslen (drvname) == 3 && drvname[1] == ':' && drvname[2] == '\\' && !inserted) { /* drive letter check */
+ TCHAR tmp[10], *p;
+ _stprintf (tmp, L"\\\\.\\%c:", drvname[0]);
+ p = hfd->emptyname + _tcslen (hfd->emptyname) - 6;
+ write_log( L"workaround-remove test: '%s' and '%s'\n", p, drvname);
+ if (!_tcscmp (tmp, p)) {
+ TCHAR *en = my_strdup (hfd->emptyname);
+ write_log (L"workaround-remove done\n");
hdf_close (hfd);
hfd->emptyname = en;
hfd->drive_empty = 1;
if (hfd->drive_empty < 0 || !hfd->handle_valid) {
int empty = hfd->drive_empty;
int r;
- //write_log ("trying to open '%s' de=%d hv=%d\n", hfd->emptyname, hfd->drive_empty, hfd->handle_valid);
+ //write_log (L"trying to open '%s' de=%d hv=%d\n", hfd->emptyname, hfd->drive_empty, hfd->handle_valid);
r = hdf_open (hfd, hfd->emptyname);
- //write_log ("=%d\n", r);
+ //write_log (L"=%d\n", r);
if (!r)
return;
*reopen = 1;
hardfile_do_disk_change (uci, ret < 0 ? 0 : 1);
}
-int win32_hardfile_media_change (const char *drvname, int inserted)
+int win32_hardfile_media_change (const TCHAR *drvname, int inserted)
{
int gotinsert = 0, rescanned = 0;
int i, j;
}
}
- //write_log ("win32_hardfile_media_change returned %d\n", gotinsert);
+ //write_log (L"win32_hardfile_media_change returned %d\n", gotinsert);
return gotinsert;
}
DWORD ret, got, gotdst, get;
uae_u64 size, sizecnt, written;
LARGE_INTEGER li;
- char path[MAX_DPATH], tmp[MAX_DPATH], tmp2[MAX_DPATH];
+ TCHAR path[MAX_DPATH], tmp[MAX_DPATH], tmp2[MAX_DPATH];
DWORD retcode = 0;
HWND hwnd, hwndprogress, hwndprogresstxt;
MSG msg;
break;
if (cnt > 0) {
SendMessage(hwndprogress, PBM_SETPOS, (WPARAM)pct, 0);
- sprintf (tmp, "%dM / %dM (%d%%)", (int)(written >> 20), (int)(size >> 20), pct);
+ _stprintf (tmp, L"%dM / %dM (%d%%)", (int)(written >> 20), (int)(size >> 20), pct);
SendMessage(hwndprogresstxt, WM_SETTEXT, 0, (LPARAM)tmp);
while (PeekMessage (&msg, 0, 0, 0, PM_REMOVE)) {
TranslateMessage (&msg);
err:
WIN32GUI_LoadUIString (IDS_HDCLONE_FAIL, tmp, MAX_DPATH);
- sprintf (tmp2, tmp, progressdialogreturn, GetLastError());
+ _stprintf (tmp2, tmp, progressdialogreturn, GetLastError());
gui_message (tmp2);
ok:
return initialized > 0 ? 1 : 0;
#ifndef IOPORT_EMU
- ioh = WIN32_LoadLibrary ("tvicport.dll");
+ ioh = WIN32_LoadLibrary (L"tvicport.dll");
if (ioh) {
for (;;) {
pOpenTVicPort = (OPENTVICPORT)GetProcAddress (ioh, "OpenTVicPort");
pReadPort = (READPORT)GetProcAddress (ioh, "ReadPort");
pWritePort = (WRITEPORT)GetProcAddress (ioh, "WritePort");
if (!pOpenTVicPort || !pCloseTVicPort || !pIsDriverOpened || !pReadPort || !pWritePort) {
- write_log ("IO: incompatible tvicport.dll\n");
+ write_log (L"IO: incompatible tvicport.dll\n");
break;
}
if (!pOpenTVicPort()) {
- write_log ("IO: tvicport.dll failed to initialize\n");
+ write_log (L"IO: tvicport.dll failed to initialize\n");
break;
}
if (!pIsDriverOpened()) {
- write_log ("IO: tvicport.dll failed to initialize!\n");
+ write_log (L"IO: tvicport.dll failed to initialize!\n");
pCloseTVicPort();
break;
}
initialized = 1;
- write_log ("IO: tvicport.dll initialized\n");
+ write_log (L"IO: tvicport.dll initialized\n");
return 1;
}
}
FreeLibrary(ioh);
- ioh = WIN32_LoadLibrary ("winio.dll");
+ ioh = WIN32_LoadLibrary (L"winio.dll");
if (ioh) {
for (;;) {
pInitializeWinIo = (INITIALIZEWINIO)GetProcAddress (ioh, "InitializeWinIo");
pGetPortVal = (GETPORTVAL)GetProcAddress (ioh, "GetPortVal");
pSetPortVal = (SETPORTVAL)GetProcAddress (ioh, "SetPortVal");
if (!pInitializeWinIo || !pShutdownWinIo || !pGetPortVal || !pSetPortVal) {
- write_log ("IO: incompatible winio.dll\n");
+ write_log (L"IO: incompatible winio.dll\n");
break;
}
__try {
initialized = pInitializeWinIo() ? 2 : 0;
} __except (EXCEPTION_EXECUTE_HANDLER) {
- write_log ("IO: winio.dll initialization failed\n");
+ write_log (L"IO: winio.dll initialization failed\n");
}
if (!initialized)
break;
- write_log ("IO: winio.dll initialized\n");
+ write_log (L"IO: winio.dll initialized\n");
return 1;
}
}
FreeLibrary(ioh);
initialized = -1;
- write_log ("IO: tvicport.dll or winio.dll failed to initialize\n");
+ write_log (L"IO: tvicport.dll or winio.dll failed to initialize\n");
return 0;
#else
initialized = 1;
void paraport_free (void) { }
int paraport_init (void) { return 0; }
-int paraport_open (char *port) { return 0; }
+int paraport_open (TCHAR *port) { return 0; }
int parallel_direct_write_status (uae_u8 v, uae_u8 dir) { return 0; }
int parallel_direct_read_status (uae_u8 *vp) { return 0; }
int parallel_direct_write_data (uae_u8 v, uae_u8 dir) { return 0; }
int paraport_init (void)
{
- char tmp[10];
int mask = 0, i;
HANDLE pp;
paraport_free ();
- para = WIN32_LoadLibrary("ParaPort.dll");
+ para = WIN32_LoadLibrary(L"ParaPort.dll");
if (!para) {
- write_log ("PARAPORT: no ParaPort.dll, direct parallel port emulation disabled\n");
+ write_log (L"PARAPORT: no ParaPort.dll, direct parallel port emulation disabled\n");
return 0;
}
pp_closeport = (closePort)GetProcAddress (para, "closePort");
pp_getportinfo = (getPortInfo)GetProcAddress (para, "getPortInfo");
pp_openport = (openPort)GetProcAddress (para, "openPort");
if (!pp_openport || !pp_closeport || !pp_executecycle) {
- write_log ("PARAPORT: GetProcAddress() failed\n");
+ write_log (L"PARAPORT: GetProcAddress() failed\n");
paraport_free ();
}
- write_log ("PARAPORT:");
+ write_log (L"PARAPORT:");
for (i = 0; i < 4 ; i++) {
+ char tmp[10];
sprintf (tmp, "LPT%d", i + 1);
pp = pp_openport (tmp);
if (pp != INVALID_HANDLE_VALUE) {
mask |= 1 << i;
pp_closeport (pp);
- write_log (" %s", tmp);
}
pp = 0;
}
if (!mask)
- write_log ("no parallel ports detected");
- write_log ("\n");
+ write_log (L"no parallel ports detected");
+ write_log (L"\n");
return mask;
}
-int paraport_open (char *port)
+int paraport_open (TCHAR *port)
{
- static char oldport[10];
+ static TCHAR oldport[10];
PARAPORT_CYCLE c[1];
+ char *port2;
if (!para)
return 0;
- if (pport && !strcmp (port, oldport))
+ if (pport && !_tcscmp (port, oldport))
return 1;
- pport = pp_openport(port);
+ port2 = ua (port);
+ pport = pp_openport (port2);
+ xfree (port2);
if (!pport) {
- write_log ("PARAPORT: couldn't open '%s'\n", port);
+ write_log (L"PARAPORT: couldn't open '%s'\n", port);
paraport_free ();
return 0;
}
- strcpy (oldport, port);
- write_log ("PARAPORT: port '%s' opened\n", port);
+ _tcscpy (oldport, port);
+ write_log (L"PARAPORT: port '%s' opened\n", port);
memset (c, 0, sizeof (PARAPORT_CYCLE));
c[0].MaskControl = PARAPORT_MASK_CONTROL | PARAPORT_MASK_CONTROL_DIRECTION;
c[0].Control = PARAPORT_MASK_CONTROL_INIT | PARAPORT_MASK_CONTROL_DIRECTION;
if (!pp_executecycle (pport, c, 1)) {
- write_log ("PARAPORT: init executeCycle failed\n");
+ write_log (L"PARAPORT: init executeCycle failed\n");
}
return 1;
}
memset (c, 0, sizeof (PARAPORT_CYCLE));
c[0].MaskControl = PARAPORT_MASK_CONTROL_SELECTIN;
if ((dir & 1)) {
- write_log ("PARAPORT: BUSY can't be output\n");
+ write_log (L"PARAPORT: BUSY can't be output\n");
ok = 0;
}
if ((dir & 2)) {
- write_log ("PARAPORT: POUT can't be output\n");
+ write_log (L"PARAPORT: POUT can't be output\n");
ok = 0;
}
if ((dir & 4) && !(v & 4))
c[0].Control |= PARAPORT_MASK_CONTROL_SELECTIN;
if (!pp_executecycle (pport, c, 1)) {
- write_log ("PARAPORT: write executeCycle failed, CTL=%02X DIR=%02X\n", v & 7, dir & 7);
+ write_log (L"PARAPORT: write executeCycle failed, CTL=%02X DIR=%02X\n", v & 7, dir & 7);
return 0;
}
- para_log ("PARAPORT: write CTL=%02X DIR=%02X\n", v & 7, dir & 7);
+ para_log (L"PARAPORT: write CTL=%02X DIR=%02X\n", v & 7, dir & 7);
return ok;
}
memset (c + 0, 0, sizeof (PARAPORT_CYCLE));
c[0].MaskStatus = PARAPORT_MASK_STATUS;
if (!pp_executecycle (pport, c, 1)) {
- write_log ("PARAPORT: CTL read executeCycle failed\n");
+ write_log (L"PARAPORT: CTL read executeCycle failed\n");
return 0;
}
if (c[0].Status & PARAPORT_MASK_STATUS_SELECT)
} else {
oldack = 0;
}
- para_log ("PARAPORT: read CTL=%02X\n", v);
+ para_log (L"PARAPORT: read CTL=%02X\n", v);
v &= 7;
*vp &= ~7;
*vp |= v;
if (!pport)
return 0;
if (dir != 0xff) {
- write_log ("PARAPORT: unsupported mixed i/o attempted, DATA=%02X DIR=%02X, ignored\n", v, dir);
+ write_log (L"PARAPORT: unsupported mixed i/o attempted, DATA=%02X DIR=%02X, ignored\n", v, dir);
return 0;
}
memset (c, 0, 3 * sizeof (PARAPORT_CYCLE));
c[2].MaskControl = PARAPORT_MASK_CONTROL_STROBE;
if (!pp_executecycle (pport, c, 3)) {
- write_log ("PARAPORT: write executeCycle failed, data=%02X\n", v);
+ write_log (L"PARAPORT: write executeCycle failed, data=%02X\n", v);
return 0;
}
- para_log ("PARAPORT: write DATA=%02X\n", v);
+ para_log (L"PARAPORT: write DATA=%02X\n", v);
return 1;
}
c[2].MaskControl = PARAPORT_MASK_CONTROL_STROBE;
if (!pp_executecycle (pport, c, 3)) {
- write_log ("PARAPORT: DATA read executeCycle failed\n");
+ write_log (L"PARAPORT: DATA read executeCycle failed\n");
return 0;
}
*v = c[0].Data;
- para_log ("PARAPORT: read DATA=%02X\n", v);
+ para_log (L"PARAPORT: read DATA=%02X\n", v);
return ok;
}
uae_u8 ioport_read (int);
int paraport_init (void);
-int paraport_open (char*);
+int paraport_open (TCHAR*);
void paraport_free (void);
} else {
int i;
for (i = 0; i < 4; i++) {
- if (!strcmp (currprefs.df[i], currprefs.dfxlist[num]))
+ if (!_tcscmp (currprefs.df[i], currprefs.dfxlist[num]))
changed_prefs.df[i][0] = 0;
}
- strcpy (changed_prefs.df[swapperdrive], currprefs.dfxlist[num]);
+ _tcscpy (changed_prefs.df[swapperdrive], currprefs.dfxlist[num]);
}
}
break;
ret = lgLcdInit ();
if (ret != ERROR_SUCCESS) {
if (ret == RPC_S_SERVER_UNAVAILABLE || ret == ERROR_OLD_WIN_VERSION) {
- write_log ("LCD: Logitech LCD system not detected\n");
+ write_log (L"LCD: Logitech LCD system not detected\n");
return 0;
}
- write_log ("LCD: lgLcdInit() returned %d\n", ret);
+ write_log (L"LCD: lgLcdInit() returned %d\n", ret);
return 0;
}
memset (&cctx, 0, sizeof (cctx));
- cctx.appFriendlyName = "WinUAE";
+ cctx.appFriendlyName = L"WinUAE";
cctx.isPersistent = TRUE;
cctx.isAutostartable = FALSE;
ret = lgLcdConnect (&cctx);
if (ret != ERROR_SUCCESS) {
- write_log ("LCD: lgLcdConnect() returned %d\n", ret);
+ write_log (L"LCD: lgLcdConnect() returned %d\n", ret);
lcd_close();
return 0;
}
ret = lgLcdEnumerate (cctx.connection, 0, &desc);
if (ret != ERROR_SUCCESS) {
- write_log ("LCD: lgLcdEnumerate() returned %d\n", ret);
+ write_log (L"LCD: lgLcdEnumerate() returned %d\n", ret);
lcd_close();
return 0;
}
octx.index = 0;
ret = lgLcdOpen (&octx);
if (ret != ERROR_SUCCESS) {
- write_log ("LCD: lgLcdOpen() returned %d\n", ret);
+ write_log (L"LCD: lgLcdOpen() returned %d\n", ret);
lcd_close();
return 0;
}
memcpy (origbitmap, bitmap, desc.Width * desc.Height);
DeleteDC (dc);
- write_log ("LCD: Logitech LCD system initialized\n");
+ write_log (L"LCD: Logitech LCD system initialized\n");
return 1;
}
-extern int lcd_open(void);
-extern void lcd_close(void);
-extern void lcd_update(int, int);
-extern void lcd_priority(int);
\ No newline at end of file
+extern int lcd_open (void);
+extern void lcd_close (void);
+extern void lcd_update (int, int);
+extern void lcd_priority (int);
\ No newline at end of file
static HMIDIIN inHandle;
static MIDIHDR midiin[MIDI_INBUFFERS];
-static char *inbuffer[MIDI_INBUFFERS] = { 0, 0} ;
+static uae_u8 *inbuffer[MIDI_INBUFFERS] = { 0, 0} ;
static long inbufferlength[MIDI_INBUFFERS] = { 0,0};
static int in_allocated = 0;
static HMIDIOUT outHandle;
static MIDIHDR midiout[MIDI_BUFFERS];
-static char *outbuffer[MIDI_BUFFERS] = { 0, 0 };
+static uae_u8 *outbuffer[MIDI_BUFFERS] = { 0, 0 };
static long outbufferlength[MIDI_BUFFERS] = { 0, 0 };
static int outbufferselect = 0;
static int out_allocated = 0;
* 1999.09.06 1.0 Brian King - Creation
*
*/
-static char *getmidiouterr(char *txt, int err)
+static TCHAR *getmidiouterr(TCHAR *txt, int err)
{
midiOutGetErrorText(err, txt, MAX_DPATH);
return txt;
}
outbufferselect = 0;
} else {
- write_log ("MIDI: ERROR - MidiOutAlloc() called twice?\n");
+ write_log (L"MIDI: ERROR - MidiOutAlloc() called twice?\n");
}
return out_allocated;
}
static int MidiOut_PrepareHeader(LPMIDIHDR out, LPSTR data, DWORD length)
{
int result = 1;
- char err[MAX_DPATH];
+ TCHAR err[MAX_DPATH];
out->lpData = data;
out->dwBufferLength = length;
out->dwFlags = 0;
if((result = midiOutPrepareHeader(outHandle, out, sizeof( MIDIHDR)))) {
- write_log ( "MIDI: error %s / %d\n", getmidiouterr(err, result), result);
+ write_log (L"MIDI: error %s / %d\n", getmidiouterr (err, result), result);
result = 0;
}
return result;
* 1999.09.06 1.0 Brian King - Creation
*
*/
-static char *getmidiinerr(char *txt, int err)
+static TCHAR *getmidiinerr(TCHAR *txt, int err)
{
midiInGetErrorText(err, txt, MAX_DPATH);
return txt;
}
}
} else {
- write_log ("MIDI: ERROR - MidiInAlloc() called twice?\n");
+ write_log (L"MIDI: ERROR - MidiInAlloc() called twice?\n");
}
return in_allocated;
}
only_one_time = 0;
}
-static unsigned char plen[128] = {
+static uae_u8 plen[128] = {
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
{
int result = 0;
static unsigned short bufferindex;
- static char *bufferpoint = 0;
+ static uae_u8 *bufferpoint = 0;
if(direction == midi_output) {
BYTE data = *dataptr;
bufferindex = BUFFLEN - 1;
out_status.status = MIDI_SYSX;
// Flush this buffer using midiOutLongMsg
- MidiOut_PrepareHeader(&midiout[ outbufferselect ], bufferpoint, bufferindex);
+ MidiOut_PrepareHeader(&midiout[outbufferselect], bufferpoint, bufferindex);
midiOutLongMsg(outHandle, &midiout[outbufferselect], sizeof(MIDIHDR));
outbufferselect = !outbufferselect;
bufferpoint = outbuffer[outbufferselect];
*/
-static unsigned char midibuf[BUFFLEN];
+static uae_u8 midibuf[BUFFLEN];
static long midi_inptr = 0, midi_inlast = 0;
static void add1byte(DWORD_PTR w) //put 1 Byte to Midibuffer
EnterCriticalSection (&cs_proc);
if (overflow == 1) {
- char szMessage[MAX_DPATH];
+ TCHAR szMessage[MAX_DPATH];
WIN32GUI_LoadUIString(IDS_MIDIOVERFLOW, szMessage, MAX_DPATH);
gui_message(szMessage);
overflow = 0;
int Midi_Open(void)
{
unsigned long result = 0, i;
- char err[MAX_DPATH];
+ TCHAR err[MAX_DPATH];
if((result = midiOutOpen(&outHandle, currprefs.win32_midioutdev, 0, 0,CALLBACK_NULL))) {
- write_log ("MIDI OUT: error %s / %d while opening port %d\n", getmidiouterr(err, result), result, currprefs.win32_midioutdev);
+ write_log (L"MIDI OUT: error %s / %d while opening port %d\n", getmidiouterr(err, result), result, currprefs.win32_midioutdev);
result = 0;
} else {
InitializeCriticalSection(&cs_proc);
// We don't need input for output...
if((currprefs.win32_midiindev >= 0) &&
(result = midiInOpen( &inHandle, currprefs.win32_midiindev, (DWORD_PTR)MidiInProc, 0, CALLBACK_FUNCTION|MIDI_IO_STATUS))) {
- write_log ( "MIDI IN: error %s / %d while opening port %d\n", getmidiinerr(err, result), result, currprefs.win32_midiindev);
+ write_log (L"MIDI IN: error %s / %d while opening port %d\n", getmidiinerr(err, result), result, currprefs.win32_midiindev);
} else {
midi_in_ready = TRUE;
result=midiInStart(inHandle);
exitin = 0;
}
midi_ready = FALSE;
- write_log ("MIDI: closed.\n");
+ write_log (L"MIDI: closed.\n");
DeleteCriticalSection(&cs_proc);
}
}
static SYSTEM_INFO si;
int maxmem;
-static void *virtualallocwithlock(LPVOID addr, SIZE_T size, DWORD allocationtype, DWORD protect)
+static void *virtualallocwithlock (LPVOID addr, SIZE_T size, DWORD allocationtype, DWORD protect)
{
void *p = VirtualAlloc (addr, size, allocationtype, protect);
return p;
}
-static void virtualfreewithlock(LPVOID addr, SIZE_T size, DWORD freetype)
+static void virtualfreewithlock (LPVOID addr, SIZE_T size, DWORD freetype)
{
VirtualFree(addr, size, freetype);
}
-void cache_free(void *cache)
+void cache_free (void *cache)
{
- virtualfreewithlock(cache, 0, MEM_RELEASE);
+ virtualfreewithlock (cache, 0, MEM_RELEASE);
}
-void *cache_alloc(int size)
+void *cache_alloc (int size)
{
- return virtualallocwithlock(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+ return virtualallocwithlock (NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
}
#if 0
ps = si.dwPageSize;
- pGetWriteWatch = (GETWRITEWATCH)GetProcAddress(GetModuleHandle("kernel32.dll"), "GetWriteWatch");
+ pGetWriteWatch = (GETWRITEWATCH)GetProcAddress (GetModuleHandle (L"kernel32.dll"), "GetWriteWatch");
if (pGetWriteWatch == NULL) {
- write_log ("GetWriteWatch(): missing!?\n");
+ write_log (L"GetWriteWatch(): missing!?\n");
return 0;
}
mem = VirtualAlloc (NULL, TEST_SIZE, MEM_RESERVE | MEM_WRITE_WATCH, PAGE_EXECUTE_READWRITE);
if (mem == NULL) {
- write_log ("GetWriteWatch(): MEM_WRITE_WATCH not supported!? err=%d\n", GetLastError());
+ write_log (L"GetWriteWatch(): MEM_WRITE_WATCH not supported!? err=%d\n", GetLastError());
return 0;
}
if (VirtualAlloc (mem, TEST_SIZE, MEM_COMMIT, PAGE_EXECUTE_READWRITE) == NULL) {
- write_log ("GetWriteWatch(): test memory area MEM_COMMIT failed!? err=%d\n", GetLastError());
+ write_log (L"GetWriteWatch(): test memory area MEM_COMMIT failed!? err=%d\n", GetLastError());
goto end;
}
ResetWriteWatch (mem, TEST_SIZE);
((uae_u8*)mem)[1] = 0;
gwwcnt = TEST_SIZE / ps;
- if (GetWriteWatch(WRITE_WATCH_FLAG_RESET, mem, TEST_SIZE, pages, &gwwcnt, &ps)) {
- write_log ("GetWriteWatch(): failed!? err=%d\n", GetLastError ());
+ if (GetWriteWatch (WRITE_WATCH_FLAG_RESET, mem, TEST_SIZE, pages, &gwwcnt, &ps)) {
+ write_log (L"GetWriteWatch(): failed!? err=%d\n", GetLastError ());
goto end;
}
if (ps != si.dwPageSize) {
- write_log ("GetWriteWatch(): pagesize %d != %d!?\n", si.dwPageSize, ps);
+ write_log (L"GetWriteWatch(): pagesize %d != %d!?\n", si.dwPageSize, ps);
goto end;
}
if (gwwcnt != 1) {
- write_log ("GetWriteWatch(): modified pages returned %d != 1!?\n", gwwcnt);
+ write_log (L"GetWriteWatch(): modified pages returned %d != 1!?\n", gwwcnt);
goto end;
}
if (pages[0] != mem) {
- write_log ("GetWriteWatch(): modified page was wrong!?\n");
+ write_log (L"GetWriteWatch(): modified page was wrong!?\n");
goto end;
}
- write_log ("GetWriteWatch() test ok\n");
+ write_log (L"GetWriteWatch() test ok\n");
ret = 1;
memwatchok = 1;
end:
{
if (memwatchok) {
if (ResetWriteWatch (lpBaseAddress, dwRegionSize))
- write_log ("ResetWriteWatch() failed, %d\n", GetLastError ());
+ write_log (L"ResetWriteWatch() failed, %d\n", GetLastError ());
} else {
DWORD op;
memset (memwatchtable, 0, p96mem_size / si.dwPageSize);
if (!VirtualProtect (lpBaseAddress, dwRegionSize, PAGE_READWRITE | PAGE_GUARD, &op))
- write_log ("VirtualProtect() failed, err=%d\n", GetLastError ());
+ write_log (L"VirtualProtect() failed, err=%d\n", GetLastError ());
}
}
GlobalMemoryStatus(&memstats);
totalphys64 = memstats.dwTotalPhys;
total64 = (uae_u64)memstats.dwAvailPageFile + (uae_u64)memstats.dwTotalPhys;
- pGlobalMemoryStatusEx = (GLOBALMEMORYSTATUSEX)GetProcAddress(GetModuleHandle("kernel32.dll"), "GlobalMemoryStatusEx");
+ pGlobalMemoryStatusEx = (GLOBALMEMORYSTATUSEX)GetProcAddress (GetModuleHandle (L"kernel32.dll"), "GlobalMemoryStatusEx");
if (pGlobalMemoryStatusEx) {
memstatsex.dwLength = sizeof (MEMORYSTATUSEX);
if (pGlobalMemoryStatusEx(&memstatsex)) {
shmids[i].name[0] = 0;
}
- write_log ("Max Z3FastRAM %dM. Total physical RAM %uM\n", max_z3fastmem >> 20, totalphys64 >> 20);
+ write_log (L"Max Z3FastRAM %dM. Total physical RAM %uM\n", max_z3fastmem >> 20, totalphys64 >> 20);
testwritewatch ();
canbang = 1;
}
shmaddr = natmem_offset + ((uae_u8*)s->attached - (uae_u8*)s->natmembase);
result = virtualallocwithlock (shmaddr, size, MEM_COMMIT, s->mode);
if (result != shmaddr)
- write_log ("NATMEM: realloc(%p,%d,%d) failed, err=%x\n", shmaddr, size, s->mode, GetLastError ());
+ write_log (L"NATMEM: realloc(%p,%d,%d) failed, err=%x\n", shmaddr, size, s->mode, GetLastError ());
else
- write_log ("NATMEM: rellocated(%p,%d,%s)\n", shmaddr, size, s->name);
+ write_log (L"NATMEM: rellocated(%p,%d,%s)\n", shmaddr, size, s->name);
}
}
int lowround = 0;
LPVOID blah = NULL;
if (rounds > 0)
- write_log ("NATMEM: retrying %d..\n", rounds);
+ write_log (L"NATMEM: retrying %d..\n", rounds);
rounds++;
if (natmem_offset)
VirtualFree(natmem_offset, 0, MEM_RELEASE);
int change = lowmem ();
if (!change)
return 0;
- write_log ("NATMEM: %d, %dM > %dM = %dM\n", ++lowround, totalsize >> 20, size64 >> 20, (totalsize - change) >> 20);
+ write_log (L"NATMEM: %d, %dM > %dM = %dM\n", ++lowround, totalsize >> 20, size64 >> 20, (totalsize - change) >> 20);
totalsize -= change;
}
if ((rounds > 1 && totalsize < 0x10000000) || rounds > 20) {
- write_log ("NATMEM: No special area could be allocated (3)!\n");
+ write_log (L"NATMEM: No special area could be allocated (3)!\n");
return 0;
}
natmemsize = size + z3size;
memwatchtable = 0;
if (currprefs.gfxmem_size) {
if (!memwatchok) {
- write_log ("GetWriteWatch() not supported, using guard pages, RTG performance will be slower.\n");
+ write_log (L"GetWriteWatch() not supported, using guard pages, RTG performance will be slower.\n");
memwatchtable = xcalloc (currprefs.gfxmem_size / si.dwPageSize + 1, 1);
}
}
natmem_offset = blah;
break;
}
- write_log ("NATMEM: %dM area failed to allocate, err=%d (Z3=%dM,RTG=%dM)\n",
+ write_log (L"NATMEM: %dM area failed to allocate, err=%d (Z3=%dM,RTG=%dM)\n",
natmemsize >> 20, GetLastError (), (currprefs.z3fastmem_size + currprefs.z3fastmem2_size) >> 20, currprefs.gfxmem_size >> 20);
if (!lowmem ()) {
- write_log ("NATMEM: No special area could be allocated (2)!\n");
+ write_log (L"NATMEM: No special area could be allocated (2)!\n");
return 0;
}
}
if (p96mem_size) {
VirtualFree (natmem_offset, 0, MEM_RELEASE);
if (!VirtualAlloc (natmem_offset, natmemsize + rtgbarrier, MEM_RESERVE, PAGE_READWRITE)) {
- write_log ("VirtualAlloc() part 2 error %d. RTG disabled.\n", GetLastError ());
+ write_log (L"VirtualAlloc() part 2 error %d. RTG disabled.\n", GetLastError ());
currprefs.gfxmem_size = changed_prefs.gfxmem_size = 0;
rtgbarrier = si.dwPageSize;
rtgextra = 0;
MEM_RESERVE | (memwatchok == 1 ? MEM_WRITE_WATCH : 0), PAGE_READWRITE);
if (!p96mem_offset) {
currprefs.gfxmem_size = changed_prefs.gfxmem_size = 0;
- write_log ("NATMEM: failed to allocate special Picasso96 GFX RAM, err=%d\n", GetLastError ());
+ write_log (L"NATMEM: failed to allocate special Picasso96 GFX RAM, err=%d\n", GetLastError ());
}
}
if (!natmem_offset) {
- write_log ("NATMEM: No special area could be allocated! (1) err=%d\n", GetLastError ());
+ write_log (L"NATMEM: No special area could be allocated! (1) err=%d\n", GetLastError ());
} else {
- write_log ("NATMEM: Our special area: 0x%p-0x%p (%08x %dM)\n",
+ write_log (L"NATMEM: Our special area: 0x%p-0x%p (%08x %dM)\n",
natmem_offset, (uae_u8*)natmem_offset + natmemsize,
natmemsize, natmemsize >> 20);
if (currprefs.gfxmem_size)
- write_log ("NATMEM: P96 special area: 0x%p-0x%p (%08x %dM)\n",
+ write_log (L"NATMEM: P96 special area: 0x%p-0x%p (%08x %dM)\n",
p96mem_offset, (uae_u8*)p96mem_offset + currprefs.gfxmem_size,
currprefs.gfxmem_size, currprefs.gfxmem_size >> 20);
canbang = 1;
return shmids[shmid].attached;
if ((uae_u8*)shmaddr < natmem_offset) {
- if(!strcmp(shmids[shmid].name,"chip")) {
+ if(!_tcscmp (shmids[shmid].name, L"chip")) {
shmaddr=natmem_offset;
got = TRUE;
if (currprefs.fastmem_size == 0 || currprefs.chipmem_size < 2 * 1024 * 1024)
size += BARRIER;
}
- if(!strcmp(shmids[shmid].name,"kick")) {
+ if(!_tcscmp (shmids[shmid].name, L"kick")) {
shmaddr=natmem_offset + 0xf80000;
got = TRUE;
size += BARRIER;
}
- if(!strcmp(shmids[shmid].name,"rom_a8")) {
+ if(!_tcscmp (shmids[shmid].name, L"rom_a8")) {
shmaddr=natmem_offset + 0xa80000;
got = TRUE;
}
- if(!strcmp(shmids[shmid].name,"rom_e0")) {
+ if(!_tcscmp (shmids[shmid].name, L"rom_e0")) {
shmaddr=natmem_offset + 0xe00000;
got = TRUE;
}
- if(!strcmp(shmids[shmid].name,"rom_f0")) {
+ if(!_tcscmp (shmids[shmid].name, L"rom_f0")) {
shmaddr=natmem_offset + 0xf00000;
got = TRUE;
}
- if(!strcmp(shmids[shmid].name,"rtarea")) {
+ if(!_tcscmp (shmids[shmid].name, L"rtarea")) {
shmaddr=natmem_offset + rtarea_base;
got = TRUE;
}
- if(!strcmp(shmids[shmid].name,"fast")) {
+ if(!_tcscmp (shmids[shmid].name, L"fast")) {
shmaddr=natmem_offset + 0x200000;
got = TRUE;
size += BARRIER;
}
- if(!strcmp(shmids[shmid].name,"ramsey_low")) {
+ if(!_tcscmp (shmids[shmid].name, L"ramsey_low")) {
shmaddr=natmem_offset + a3000lmem_start;
got = TRUE;
}
- if(!strcmp(shmids[shmid].name,"ramsey_high")) {
+ if(!_tcscmp (shmids[shmid].name, L"ramsey_high")) {
shmaddr=natmem_offset + a3000hmem_start;
got = TRUE;
}
- if(!strcmp(shmids[shmid].name,"z3")) {
+ if(!_tcscmp (shmids[shmid].name, L"z3")) {
shmaddr=natmem_offset + currprefs.z3fastmem_start;
if (!currprefs.z3fastmem2_size)
size += BARRIER;
got = TRUE;
}
- if(!strcmp(shmids[shmid].name,"z3_2")) {
+ if(!_tcscmp (shmids[shmid].name, L"z3_2")) {
shmaddr=natmem_offset + currprefs.z3fastmem_start + currprefs.z3fastmem_size;
size += BARRIER;
got = TRUE;
}
- if(!strcmp(shmids[shmid].name,"gfx")) {
+ if(!_tcscmp (shmids[shmid].name, L"gfx")) {
got = TRUE;
p96special = TRUE;
p96ram_start = p96mem_offset - natmem_offset;
if (!memwatchok)
protect |= PAGE_GUARD;
}
- if(!strcmp(shmids[shmid].name,"bogo")) {
+ if(!_tcscmp (shmids[shmid].name, L"bogo")) {
shmaddr=natmem_offset+0x00C00000;
got = TRUE;
if (currprefs.bogomem_size <= 0x100000)
size += BARRIER;
}
- if(!strcmp(shmids[shmid].name,"filesys")) {
+ if(!_tcscmp (shmids[shmid].name, L"filesys")) {
static uae_u8 *filesysptr;
if (filesysptr == NULL)
filesysptr = xcalloc (size, 1);
shmids[shmid].attached = result;
return result;
}
- if(!strcmp(shmids[shmid].name,"custmem1")) {
+ if(!_tcscmp (shmids[shmid].name, L"custmem1")) {
shmaddr=natmem_offset + currprefs.custom_memory_addrs[0];
got = TRUE;
}
- if(!strcmp(shmids[shmid].name,"custmem2")) {
+ if(!_tcscmp (shmids[shmid].name, L"custmem2")) {
shmaddr=natmem_offset + currprefs.custom_memory_addrs[1];
got = TRUE;
}
- if(!strcmp(shmids[shmid].name,"hrtmem")) {
+ if(!_tcscmp (shmids[shmid].name, L"hrtmem")) {
shmaddr=natmem_offset + 0x00a10000;
got = TRUE;
}
- if(!strcmp(shmids[shmid].name,"arhrtmon")) {
+ if(!_tcscmp (shmids[shmid].name, L"arhrtmon")) {
shmaddr=natmem_offset + 0x00800000;
size += BARRIER;
got = TRUE;
}
- if(!strcmp(shmids[shmid].name,"xpower_e2")) {
+ if(!_tcscmp (shmids[shmid].name, L"xpower_e2")) {
shmaddr=natmem_offset + 0x00e20000;
size += BARRIER;
got = TRUE;
}
- if(!strcmp(shmids[shmid].name,"xpower_f2")) {
+ if(!_tcscmp (shmids[shmid].name, L"xpower_f2")) {
shmaddr=natmem_offset + 0x00f20000;
size += BARRIER;
got = TRUE;
}
- if(!strcmp(shmids[shmid].name,"nordic_f0")) {
+ if(!_tcscmp (shmids[shmid].name, L"nordic_f0")) {
shmaddr=natmem_offset + 0x00f00000;
size += BARRIER;
got = TRUE;
}
- if(!strcmp(shmids[shmid].name,"nordic_f4")) {
+ if(!_tcscmp (shmids[shmid].name, L"nordic_f4")) {
shmaddr=natmem_offset + 0x00f40000;
size += BARRIER;
got = TRUE;
}
- if(!strcmp(shmids[shmid].name,"nordic_f6")) {
+ if(!_tcscmp (shmids[shmid].name, L"nordic_f6")) {
shmaddr=natmem_offset + 0x00f60000;
size += BARRIER;
got = TRUE;
}
- if(!strcmp(shmids[shmid].name,"superiv_b0")) {
+ if(!_tcscmp(shmids[shmid].name, L"superiv_b0")) {
shmaddr=natmem_offset + 0x00b00000;
size += BARRIER;
got = TRUE;
}
- if(!strcmp(shmids[shmid].name,"superiv_d0")) {
+ if(!_tcscmp (shmids[shmid].name, L"superiv_d0")) {
shmaddr=natmem_offset + 0x00d00000;
size += BARRIER;
got = TRUE;
}
- if(!strcmp(shmids[shmid].name,"superiv_e0")) {
+ if(!_tcscmp (shmids[shmid].name, L"superiv_e0")) {
shmaddr=natmem_offset + 0x00e00000;
size += BARRIER;
got = TRUE;
result = virtualallocwithlock (shmaddr, size, MEM_COMMIT, protect);
if (result == NULL) {
result = (void*)-1;
- write_log ("VirtualAlloc %08X - %08X %x (%dk) failed %d\n",
+ write_log (L"VirtualAlloc %08X - %08X %x (%dk) failed %d\n",
(uae_u8*)shmaddr - natmem_offset, (uae_u8*)shmaddr - natmem_offset + size,
size, size >> 10, GetLastError ());
} else {
shmids[shmid].attached = result;
- write_log ("VirtualAlloc %08X - %08X %x (%dk) ok%s\n",
+ write_log (L"VirtualAlloc %08X - %08X %x (%dk) ok%s\n",
(uae_u8*)shmaddr - natmem_offset, (uae_u8*)shmaddr - natmem_offset + size,
- size, size >> 10, p96special ? " P96" : "");
+ size, size >> 10, p96special ? L" P96" : L"");
}
}
return result;
return 0;
}
-int shmget (key_t key, size_t size, int shmflg, const char *name)
+int shmget (key_t key, size_t size, int shmflg, const TCHAR *name)
{
int result = -1;
if((key == IPC_PRIVATE) || ((shmflg & IPC_CREAT) && (find_shmkey (key) == -1))) {
- write_log ("shmget of size %d (%dk) for %s\n", size, size >> 10, name);
+ write_log (L"shmget of size %d (%dk) for %s\n", size, size >> 10, name);
if ((result = get_next_shmkey ()) != -1) {
shmids[result].size = size;
- strcpy(shmids[result].name, name);
+ _tcscpy (shmids[result].name, name);
} else {
result = -1;
}
static PIXELFORMATDESCRIPTOR pfd;
-static void testerror (char *s)
+static void testerror (TCHAR *s)
{
for (;;) {
GLint err = glGetError();
if (err == 0)
return;
- write_log ("OpenGL error %d (%s)\n", err, s);
+ write_log (L"OpenGL error %d (%s)\n", err, s);
}
}
#ifdef FSAA
// WGLisExtensionSupported: This Is A Form Of The Extension For WGL
-static int WGLisExtensionSupported(const char *extension)
+static int WGLisExtensionSupported(const TCHAR *extension)
{
const size_t extlen = strlen(extension);
- const char *supported = NULL;
- const char *p;
+ const TCHAR *supported = NULL;
+ const TCHAR *p;
// Try To Use wglGetExtensionStringARB On Current DC, If Possible
PROC wglGetExtString = wglGetProcAddress("wglGetExtensionsStringARB");
if (valid && numFormats >= 1) {
arbMultisampleSupported = i;
arbMultisampleFormat = pixelFormat;
- write_log ("OPENGL: max FSAA = %d\n", i);
+ write_log (L"OPENGL: max FSAA = %d\n", i);
return arbMultisampleSupported;
}
}
// Return The Valid Format
- write_log ("OPENGL: no FSAA support detected\n");
+ write_log (L"OPENGL: no FSAA support detected\n");
return arbMultisampleSupported;
}
#endif
-const char *OGL_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth)
+const TCHAR *OGL_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth)
{
int PixelFormat;
const char *ext1;
- static char errmsg[100] = { 0 };
+ static TCHAR errmsg[100] = { 0 };
static int init;
ogl_enabled = 0;
if (currprefs.gfx_filter != UAE_FILTER_OPENGL) {
- strcpy (errmsg, "OPENGL: not enabled");
+ _tcscpy (errmsg, L"OPENGL: not enabled");
return errmsg;
}
total_textures = 2;
if (isfullscreen() > 0 && WIN32GFX_GetDepth (TRUE) < 15) {
- strcpy (errmsg, "OPENGL: display depth must be at least 15 bit");
+ _tcscpy (errmsg, L"OPENGL: display depth must be at least 15 bit");
return errmsg;
}
if (!arbMultisampleSupported) {
PixelFormat = ChoosePixelFormat (openglhdc, &pfd); // Find A Compatible Pixel Format
if (PixelFormat == 0) { // Did We Find A Compatible Format?
- strcpy (errmsg, "OPENGL: can't find suitable pixelformat");
+ _tcscpy (errmsg, L"OPENGL: can't find suitable pixelformat");
return errmsg;
}
} else {
}
if (!SetPixelFormat (openglhdc, PixelFormat, &pfd)) {
- sprintf (errmsg, "OPENGL: can't set pixelformat %x", PixelFormat);
+ _stprintf (errmsg, L"OPENGL: can't set pixelformat %x", PixelFormat);
return errmsg;
}
if (!(hrc = wglCreateContext (openglhdc))) {
- strcpy (errmsg, "OPENGL: can't create gl rendering context");
+ _tcscpy (errmsg, L"OPENGL: can't create gl rendering context");
return errmsg;
}
if (!wglMakeCurrent (openglhdc, hrc)) {
- strcpy (errmsg, "OPENGL: can't activate gl rendering context");
+ _tcscpy (errmsg, L"OPENGL: can't activate gl rendering context");
return errmsg;
}
#ifdef FSAA
if(!arbMultisampleSupported) {
if(InitMultisample(openglhdc, &pfd)) {
OGL_free ();
- strcpy (errmsg, "*");
+ _tcscpy (errmsg, "*");
return errmsg;
}
}
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_texture_size);
required_texture_size = 2 << exact_log2 (t_width > t_height ? t_width : t_height);
if (max_texture_size < t_width || max_texture_size < t_height) {
- sprintf (errmsg, "OPENGL: %d * %d or bigger texture support required\nYour gfx card's maximum texture size is only %d * %d",
+ _stprintf (errmsg, L"OPENGL: %d * %d or bigger texture support required\nYour gfx card's maximum texture size is only %d * %d",
required_texture_size, required_texture_size, max_texture_size, max_texture_size);
return errmsg;
}
required_sl_texture_size = 2 << exact_log2 (w_width > w_height ? w_width : w_height);
if (currprefs.gfx_filter_scanlines > 0 && (max_texture_size < w_width || max_texture_size < w_height)) {
- gui_message ("OPENGL: %d * %d or bigger texture support required for scanlines (max is only %d * %d)\n"
- "Scanlines disabled.",
+ gui_message (L"OPENGL: %d * %d or bigger texture support required for scanlines (max is only %d * %d)\n"
+ L"Scanlines disabled.",
required_sl_texture_size, required_sl_texture_size, max_texture_size, max_texture_size);
changed_prefs.gfx_filter_scanlines = currprefs.gfx_filter_scanlines = 0;
}
ext1 = glGetString (GL_EXTENSIONS);
if (!init)
- write_log ("OpenGL extensions: %s\n", ext1);
+ write_log (L"OpenGL extensions: %s\n", ext1);
if (strstr (ext1, "EXT_packed_pixels"))
packed_pixels = 1;
if (strstr (ext1, "WGL_EXT_swap_control")) {
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress ("wglSwapIntervalEXT");
wglGetSwapIntervalEXT = (PFNWGLGETSWAPINTERVALEXTPROC)wglGetProcAddress ("wglGetSwapIntervalEXT");
if (!wglGetSwapIntervalEXT || !wglSwapIntervalEXT) {
- write_log ("OPENGL: WGL_EXT_swap_control extension found but no wglGetSwapIntervalEXT or wglSwapIntervalEXT found!?\n");
+ write_log (L"OPENGL: WGL_EXT_swap_control extension found but no wglGetSwapIntervalEXT or wglSwapIntervalEXT found!?\n");
wglSwapIntervalEXT = 0;
wglGetSwapIntervalEXT = 0;
}
ti2d_type = -1;
if (depth == 15 || depth == 16) {
if (!packed_pixels) {
- sprintf (errmsg, "OPENGL: can't use 15/16 bit screen depths because\n"
- "EXT_packed_pixels extension was not found.");
+ _stprintf (errmsg, L"OPENGL: can't use 15/16 bit screen depths because\n"
+ L"EXT_packed_pixels extension was not found.");
OGL_free ();
return errmsg;
}
}
}
if (ti2d_type < 0) {
- sprintf (errmsg, "OPENGL: Only 15, 16 or 32 bit screen depths supported (was %d)", depth);
+ _stprintf (errmsg, L"OPENGL: Only 15, 16 or 32 bit screen depths supported (was %d)", depth);
OGL_free ();
return errmsg;
}
OGL_refresh ();
init = 1;
- write_log ("OPENGL: using texture depth %d texture size %d * %d scanline texture size %d * %d\n",
+ write_log (L"OPENGL: using texture depth %d texture size %d * %d scanline texture size %d * %d\n",
depth, required_texture_size, required_texture_size, required_sl_texture_size, required_sl_texture_size);
return 0;
}
float dw, dh;
getfilterrect2 (&dr, &sr, &zr, w_width, w_height, t_width, t_height, 1, t_width, t_height);
-// write_log ("(%d %d %d %d) - (%d %d %d %d) (%d %d)\n",
+// write_log (L"(%d %d %d %d) - (%d %d %d %d) (%d %d)\n",
// dr.left, dr.top, dr.right, dr.bottom, sr.left, sr.top, sr.right, sr.bottom, zr.left, zr.top);
dw = dr.right - dr.left;
dh = dr.bottom - dr.top;
multx = dw * t_width / w_width;
multy = dh * t_height / w_height;
-// write_log ("%fx%f\n", multx, multy);
+// write_log (L"%fx%f\n", multx, multy);
x1 = -0.5f + dw * t_width / w_width / 2 - zr.left - sr.left;
y1 = 0.5f + dh * t_height / w_height / 2 - zr.top - (t_height - 2 * zr.top - h) + sr.top;
extern void OGL_resize (int width, int height);
extern void OGL_free ();
-extern const char *OGL_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth);
+extern const TCHAR *OGL_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth);
extern void OGL_render (void);
extern void OGL_getpixelformat (int depth,int *rb, int *bb, int *gb, int *rs, int *bs, int *gs, int *ab, int *ar, int *a);
extern void OGL_refresh (void);
static DWORD dwJob;
static int prtopen;
extern void flushpixels(void);
-void DoSomeWeirdPrintingStuff(char val);
+void DoSomeWeirdPrintingStuff(uae_char val);
static int uartbreak;
static int parflush;
static int openprinter_ps (void)
{
- char *gsargv[] = {
- "-dNOPAUSE", "-dBATCH", "-dNOPAGEPROMPT", "-dNOPROMPT", "-dQUIET", "-dNoCancel",
- "-sDEVICE=mswinpr2", NULL
+ TCHAR *gsargv[] = {
+ L"-dNOPAUSE", L"-dBATCH", L"-dNOPAGEPROMPT", L"-dNOPROMPT", L"-dQUIET", L"-dNoCancel",
+ L"-sDEVICE=mswinpr2", NULL
};
int gsargc, gsargc2, i;
- char *tmpparms[100];
- char tmp[MAX_DPATH];
+ TCHAR *tmpparms[100];
+ TCHAR tmp[MAX_DPATH];
+ char *gsparms[100];
if (ptr_gsapi_new_instance (&gsinstance, NULL) < 0)
return 0;
- tmpparms[0] = "WinUAE";
+ tmpparms[0] = L"WinUAE";
gsargc2 = cmdlineparser (currprefs.ghostscript_parameters, tmpparms + 1, 100 - 10) + 1;
- for (gsargc = 0; gsargv[gsargc]; gsargc++);
+
+ for (gsargc = 0; gsargv[gsargc]; gsargc++) {
+ gsparms[gsargc] = ua (gsargv[gsargc]);
+ }
for (i = 0; i < gsargc; i++)
- tmpparms[gsargc2++] = gsargv[i];
+ gsparms[gsargc2++] = ua (tmpparms[i]);
if (currprefs.prtname[0]) {
- sprintf (tmp, "-sOutputFile=%%printer%%%s", currprefs.prtname);
- tmpparms[gsargc2++] = tmp;
+ _stprintf (tmp, L"-sOutputFile=%%printer%%%s", currprefs.prtname);
+ gsparms[gsargc2++] = ua (tmp);
}
if (postscript_print_debugging) {
- for(i = 0; i < gsargc2; i++)
- write_log ("GSPARM%d: '%s'\n", i, tmpparms[i]);
+ for(i = 0; i < gsargc2; i++) {
+ TCHAR *parm = au (gsparms[i]);
+ write_log (L"GSPARM%d: '%s'\n", i, parm);
+ xfree (parm);
+ }
}
__try {
- int rc = ptr_gsapi_init_with_args (gsinstance, gsargc2, tmpparms);
+ int rc = ptr_gsapi_init_with_args (gsinstance, gsargc2, gsparms);
+ for (i = 0; i < gsargc2; i++) {
+ xfree (gsparms[i]);
+ }
if (rc != 0) {
- write_log ("GS failed, returncode %d\n", rc);
+ write_log (L"GS failed, returncode %d\n", rc);
return 0;
}
ptr_gsapi_run_string_begin (gsinstance, 0, &gs_exitcode);
} __except (ExceptionFilter (GetExceptionInformation (), GetExceptionCode ())) {
- write_log ("GS crashed\n");
+ write_log (L"GS crashed\n");
return 0;
}
psmode = 1;
SetThreadPriority (GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
if (load_ghostscript ()) {
if (openprinter_ps ()) {
- write_log ("PostScript printing emulation started..\n");
+ write_log (L"PostScript printing emulation started..\n");
cnt = 0;
while (buffers[cnt]) {
uae_u8 *p = buffers[cnt];
err = ptr_gsapi_run_string_continue (gsinstance, p + 2, (p[0] << 8) | p[1], 0, &gs_exitcode);
if (err != e_NeedInput && err <= e_Fatal) {
ptr_gsapi_exit (gsinstance);
- write_log ("PostScript parsing failed.\n");
+ write_log (L"PostScript parsing failed.\n");
ok = 0;
break;
}
}
free (buffers);
if (ok) {
- write_log ("PostScript printing emulation finished..\n");
+ write_log (L"PostScript printing emulation finished..\n");
ptr_gsapi_run_string_end (gsinstance, 0, &gs_exitcode);
}
} else {
- write_log ("gsdll32.dll failed to initialize\n");
+ write_log (L"gsdll32.dll failed to initialize\n");
}
} else {
- write_log ("gsdll32.dll failed to load\n");
+ write_log (L"gsdll32.dll failed to load\n");
}
unload_ghostscript ();
prt_running--;
} else if (hPrt != INVALID_HANDLE_VALUE) {
if (WritePrinter(hPrt, prtbuf, prtbufbytes, &written)) {
if (written != prtbufbytes)
- write_log ("PRINTER: Only wrote %d of %d bytes!\n", written, prtbufbytes);
+ write_log (L"PRINTER: Only wrote %d of %d bytes!\n", written, prtbufbytes);
} else {
- write_log ("PRINTER: Couldn't write data!\n");
+ write_log (L"PRINTER: Couldn't write data!\n");
}
} else {
- write_log ("PRINTER: Not open!\n");
+ write_log (L"PRINTER: Not open!\n");
}
prtbufbytes = 0;
}
flushprtbuf ();
}
-static void DoSomeWeirdPrintingStuff (char val)
+static void DoSomeWeirdPrintingStuff (uae_char val)
{
- static char prev[5];
+ static uae_char prev[5];
memmove (prev, prev + 1, 3);
prev[3] = val;
*prtbuf = val;
prtbufbytes = 1;
flushprtbuf ();
- write_log ("PostScript end detected..\n");
+ write_log (L"PostScript end detected..\n");
if (postscript_print_debugging) {
zfile_fclose (prtdump);
if (currprefs.parallel_postscript_emulation) {
prt_started = 0;
- if (uae_start_thread ("postscript", prt_thread, psbuffer, NULL)) {
+ if (uae_start_thread (L"postscript", prt_thread, psbuffer, NULL)) {
while (!prt_started)
Sleep (5);
psbuffers = 0;
} else if (!psmode && !stricmp (prev, "%!PS")) {
if (postscript_print_debugging)
- prtdump = zfile_fopen ("psdump.dat", "wb");
+ prtdump = zfile_fopen (L"psdump.dat", L"wb");
psmode = 1;
psbuffer = malloc (sizeof (uae_u8*));
strcpy (prtbuf, "%!PS");
prtbufbytes = strlen (prtbuf);
flushprtbuf ();
- write_log ("PostScript start detected..\n");
+ write_log (L"PostScript start detected..\n");
return;
}
}
{
if (!currprefs.prtname[0])
return 0;
- if (!memcmp(currprefs.prtname,"LPT", 3)) {
+ if (!_tcsncmp (currprefs.prtname, L"LPT", 3)) {
paraport_open (currprefs.prtname);
return -1;
}
int load_ghostscript (void)
{
struct gsapi_revision_s r;
- char path[MAX_DPATH];
+ TCHAR path[MAX_DPATH];
+ TCHAR *s;
if (gsdll)
return 1;
- strcpy(path, "gsdll32.dll");
+ _tcscpy(path, L"gsdll32.dll");
gsdll = WIN32_LoadLibrary (path);
if (!gsdll) {
- if (GetEnvironmentVariable ("GS_DLL", path, sizeof (path)))
+ if (GetEnvironmentVariable (L"GS_DLL", path, sizeof (path) / sizeof (TCHAR)))
gsdll = LoadLibrary (path);
}
if (!gsdll) {
HKEY key;
- DWORD ret = RegOpenKeyEx (HKEY_LOCAL_MACHINE, "SOFTWARE\\AFPL Ghostscript", 0, KEY_READ, &key);
- if (ret |= ERROR_SUCCESS)
- ret = RegOpenKeyEx (HKEY_LOCAL_MACHINE, "SOFTWARE\\GPL Ghostscript", 0, KEY_READ, &key);
+ DWORD ret = RegOpenKeyEx (HKEY_LOCAL_MACHINE, L"SOFTWARE\\AFPL Ghostscript", 0, KEY_READ, &key);
+ if (ret != ERROR_SUCCESS)
+ ret = RegOpenKeyEx (HKEY_LOCAL_MACHINE, L"SOFTWARE\\GPL Ghostscript", 0, KEY_READ, &key);
if (ret == ERROR_SUCCESS) {
int idx = 0, cnt = 20;
- char tmp1[MAX_DPATH];
+ TCHAR tmp1[MAX_DPATH];
while (cnt-- > 0) {
- DWORD size1 = sizeof (tmp1);
+ DWORD size1 = sizeof (tmp1) / sizeof (TCHAR);
FILETIME ft;
if (RegEnumKeyEx (key, idx, tmp1, &size1, NULL, NULL, NULL, &ft) == ERROR_SUCCESS) {
HKEY key2;
if (RegOpenKeyEx (key, tmp1, 0, KEY_READ, &key2) == ERROR_SUCCESS) {
DWORD type = REG_SZ;
- DWORD size = sizeof (path);
- if (RegQueryValueEx (key2, "GS_DLL", 0, &type, (LPBYTE)path, &size) == ERROR_SUCCESS) {
+ DWORD size = sizeof (path) / sizeof (TCHAR);
+ if (RegQueryValueEx (key2, L"GS_DLL", 0, &type, (LPBYTE)path, &size) == ERROR_SUCCESS) {
gsdll = LoadLibrary (path);
}
RegCloseKey (key2);
ptr_gsapi_revision = (GSAPI_REVISION)GetProcAddress (gsdll, "gsapi_revision");
if (!ptr_gsapi_revision) {
unload_ghostscript ();
- write_log ("incompatible %s! (1)\n", path);
+ write_log (L"incompatible %s! (1)\n", path);
return -1;
}
if (ptr_gsapi_revision(&r, sizeof(r))) {
unload_ghostscript ();
- write_log ("incompatible %s! (2)\n", path);
+ write_log (L"incompatible %s! (2)\n", path);
return -2;
}
ptr_gsapi_new_instance = (GSAPI_NEW_INSTANCE)GetProcAddress (gsdll, "gsapi_new_instance");
!ptr_gsapi_run_string_begin || !ptr_gsapi_run_string_continue || !ptr_gsapi_run_string_end ||
!ptr_gsapi_init_with_args) {
unload_ghostscript ();
- write_log ("incompatible %s! (3)\n", path);
+ write_log (L"incompatible %s! (3)\n", path);
return -3;
}
- write_log ("%s: %s rev %d initialized\n", path, r.product, r.revision);
+ s = au (r.product);
+ write_log (L"%s: %s rev %d initialized\n", path, s, r.revision);
+ xfree (s);
return 1;
}
flushprtbuf ();
if (OpenPrinter (currprefs.prtname, &hPrt, NULL)) {
// Fill in the structure with info about this "document."
- DocInfo.pDocName = "My Document";
+ DocInfo.pDocName = L"My Document";
DocInfo.pOutputFile = NULL;
- DocInfo.pDatatype = "RAW";
+ DocInfo.pDatatype = L"RAW";
// Inform the spooler the document is beginning.
if ((dwJob = StartDocPrinter(hPrt, 1, (LPSTR)&DocInfo)) == 0) {
ClosePrinter(hPrt );
}
}
if (hPrt != INVALID_HANDLE_VALUE) {
- write_log ( "PRINTER: Opening printer \"%s\" with handle 0x%x.\n", currprefs.prtname, hPrt );
+ write_log (L"PRINTER: Opening printer \"%s\" with handle 0x%x.\n", currprefs.prtname, hPrt);
} else if (*currprefs.prtname) {
- write_log ( "PRINTER: ERROR - Couldn't open printer \"%s\" for output.\n", currprefs.prtname );
+ write_log (L"PRINTER: ERROR - Couldn't open printer \"%s\" for output.\n", currprefs.prtname);
}
}
EndDocPrinter (hPrt);
ClosePrinter (hPrt);
hPrt = INVALID_HANDLE_VALUE;
- write_log ("PRINTER: Closing printer.\n");
+ write_log (L"PRINTER: Closing printer.\n");
}
if (currprefs.parallel_postscript_emulation)
prtopen = 1;
else
prtopen = 0;
if (prt_running) {
- write_log ("waiting for printing to finish...\n");
+ write_log (L"waiting for printing to finish...\n");
while (prt_running)
Sleep (10);
}
//dcb.XonLim = 2048;
if (!SetCommState (sd->hCom, &dcb)) {
- write_log ("uaeserial: SetCommState() failed %d\n", GetLastError());
+ write_log (L"uaeserial: SetCommState() failed %d\n", GetLastError());
return 5;
}
SetupComm (sd->hCom, rbuffer, rbuffer);
int uaeser_open (struct uaeserialdatawin32 *sd, void *user, int unit)
{
- char buf[256];
+ TCHAR buf[256];
COMMTIMEOUTS CommTimeOuts;
sd->user = user;
- sprintf (buf, "\\\\.\\COM%d", unit);
+ _stprintf (buf, L"\\\\.\\COM%d", unit);
sd->evtr = CreateEvent (NULL, TRUE, FALSE, NULL);
sd->evtw = CreateEvent (NULL, TRUE, FALSE, NULL);
sd->evtt = CreateEvent (NULL, FALSE, FALSE, NULL);
sd->hCom = CreateFile (buf, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);
if (sd->hCom == INVALID_HANDLE_VALUE) {
- sprintf (buf, "\\.\\\\COM%d", unit);
+ _stprintf (buf, L"\\.\\\\COM%d", unit);
sd->hCom = CreateFile (buf, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);
if (sd->hCom == INVALID_HANDLE_VALUE) {
- write_log ("UAESER: '%s' failed to open, err=%d\n", buf, GetLastError());
+ write_log (L"UAESER: '%s' failed to open, err=%d\n", buf, GetLastError());
goto end;
}
}
uae_sem_init (&sd->sync_sem, 0, 0);
uae_sem_init (&sd->change_sem, 0, 1);
- uae_start_thread ("uaeserial_win32", uaeser_trap_thread, sd, NULL);
+ uae_start_thread (L"uaeserial_win32", uaeser_trap_thread, sd, NULL);
uae_sem_wait (&sd->sync_sem);
CommTimeOuts.ReadIntervalTimeout = 0;
static OVERLAPPED writeol, readol;
static writepending;
-int openser (char *sername)
+int openser (TCHAR *sername)
{
COMMTIMEOUTS CommTimeOuts;
if (!(readevent = CreateEvent (NULL, TRUE, FALSE, NULL))) {
- write_log ("SERIAL: Failed to create r event!\n");
+ write_log (L"SERIAL: Failed to create r event!\n");
return 0;
}
readol.hEvent = readevent;
if (!(writeevent = CreateEvent (NULL, TRUE, FALSE, NULL))) {
- write_log ("SERIAL: Failed to create w event!\n");
+ write_log (L"SERIAL: Failed to create w event!\n");
return 0;
}
SetEvent (writeevent);
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
NULL);
if (hCom == INVALID_HANDLE_VALUE) {
- write_log ("SERIAL: failed to open '%s' err=%d\n", sername, GetLastError());
+ write_log (L"SERIAL: failed to open '%s' err=%d\n", sername, GetLastError());
closeser();
return 0;
}
//dcb.XonLim = 2048;
if (SetCommState (hCom, &dcb)) {
- write_log ("SERIAL: Using %s CTS/RTS=%d\n", sername, currprefs.serial_hwctsrts);
+ write_log (L"SERIAL: Using %s CTS/RTS=%d\n", sername, currprefs.serial_hwctsrts);
return 1;
}
- write_log ("SERIAL: serial driver didn't accept new parameters\n");
+ write_log (L"SERIAL: serial driver didn't accept new parameters\n");
closeser();
return 0;
}
{
if (midi_ready) {
BYTE outchar = (BYTE)c;
- Midi_Parse(midi_output, &outchar);
+ Midi_Parse (midi_output, &outchar);
} else {
if (!currprefs.use_serial)
return;
- if (datainoutput + 1 < sizeof(outputbuffer)) {
+ if (datainoutput + 1 < sizeof (outputbuffer)) {
outputbuffer[datainoutput++] = c;
} else {
- write_log ("serial output buffer overflow, data will be lost\n");
+ write_log (L"serial output buffer overflow, data will be lost\n");
datainoutput = 0;
}
outser ();
/* MIDI baud-rate */
if (!midi_ready) {
if (Midi_Open())
- write_log ("Midi enabled\n");
+ write_log (L"Midi enabled\n");
}
return 1;
} else {
if (GetCommState (hCom, &dcb)) {
dcb.BaudRate = baud;
if (!SetCommState (hCom, &dcb)) {
- write_log ("SERIAL: Error setting baud rate %d!\n", baud);
+ write_log (L"SERIAL: Error setting baud rate %d!\n", baud);
return 0;
}
} else {
- write_log ("SERIAL: setbaud internal error!\n");
+ write_log (L"SERIAL: setbaud internal error!\n");
}
}
}
if (uae_boot_rom) {
uaecptr a = here (); //this install the ahisound
org (rtarea_base + 0xFFC0);
- calltrap (deftrapres (ahi_demux, 0, "ahi_winuae"));
+ calltrap (deftrapres (ahi_demux, 0, L"ahi_winuae"));
dw (RTS);
org (a);
init_ahi_v2 ();
SP_DEVICE_INTERFACE_DETAIL_DATA *pDetData = NULL;
BOOL bOk = TRUE;
SP_DEVICE_INTERFACE_DATA ifcData;
- DWORD dwDetDataSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA) + 256;
+ DWORD dwDetDataSize = sizeof (SP_DEVICE_INTERFACE_DETAIL_DATA) + 256;
DWORD ii;
int cnt = 0;
- hDevInfo = SetupDiGetClassDevs(&GUID_CLASS_COMPORT, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
+ hDevInfo = SetupDiGetClassDevs (&GUID_CLASS_COMPORT, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
if(hDevInfo == INVALID_HANDLE_VALUE)
return 0;
// Enumerate the serial ports
pDetData = xmalloc (dwDetDataSize);
// This is required, according to the documentation. Yes,
// it's weird.
- ifcData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
- pDetData->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
+ ifcData.cbSize = sizeof (SP_DEVICE_INTERFACE_DATA);
+ pDetData->cbSize = sizeof (SP_DEVICE_INTERFACE_DETAIL_DATA);
for (ii = 0; bOk; ii++) {
- bOk = SetupDiEnumDeviceInterfaces(hDevInfo, NULL, &GUID_CLASS_COMPORT, ii, &ifcData);
+ bOk = SetupDiEnumDeviceInterfaces (hDevInfo, NULL, &GUID_CLASS_COMPORT, ii, &ifcData);
if (bOk) {
// Got a device. Get the details.
- SP_DEVINFO_DATA devdata = {sizeof(SP_DEVINFO_DATA)};
- bOk = SetupDiGetDeviceInterfaceDetail(hDevInfo,
+ SP_DEVINFO_DATA devdata = { sizeof (SP_DEVINFO_DATA)};
+ bOk = SetupDiGetDeviceInterfaceDetail (hDevInfo,
&ifcData, pDetData, dwDetDataSize, NULL, &devdata);
if (bOk) {
// Got a path to the device. Try to get some more info.
TCHAR fname[256];
TCHAR desc[256];
- BOOL bSuccess = SetupDiGetDeviceRegistryProperty(
+ BOOL bSuccess = SetupDiGetDeviceRegistryProperty (
hDevInfo, &devdata, SPDRP_FRIENDLYNAME, NULL,
- (PBYTE)fname, sizeof(fname), NULL);
- bSuccess = bSuccess && SetupDiGetDeviceRegistryProperty(
+ (PBYTE)fname, sizeof (fname), NULL);
+ bSuccess = bSuccess && SetupDiGetDeviceRegistryProperty (
hDevInfo, &devdata, SPDRP_DEVICEDESC, NULL,
- (PBYTE)desc, sizeof(desc), NULL);
+ (PBYTE)desc, sizeof (desc), NULL);
if (bSuccess && cnt < MAX_SERIAL_PORTS) {
- char *p;
+ TCHAR *p;
comports[cnt].dev = my_strdup (pDetData->DevicePath);
comports[cnt].name = my_strdup (fname);
- p = strstr(fname,"(COM");
+ p = _tcsstr (fname, L"(COM");
if (p && (p[5] == ')' || p[6] == ')')) {
comports[cnt].cfgname = xmalloc (100);
if (isdigit(p[5]))
- sprintf(comports[cnt].cfgname, "COM%c%c", p[4], p[5]);
+ _stprintf (comports[cnt].cfgname, L"COM%c%c", p[4], p[5]);
else
- sprintf(comports[cnt].cfgname, "COM%c", p[4]);
+ _stprintf (comports[cnt].cfgname, L"COM%c", p[4]);
} else {
comports[cnt].cfgname = my_strdup (pDetData->DevicePath);
}
- write_log ("SERPORT: '%s' = '%s' = '%s'\n", comports[cnt].name, comports[cnt].cfgname, comports[cnt].dev);
+ write_log (L"SERPORT: '%s' = '%s' = '%s'\n", comports[cnt].name, comports[cnt].cfgname, comports[cnt].dev);
cnt++;
}
} else {
- write_log ("SetupDiGetDeviceInterfaceDetail failed, err=%d", GetLastError());
+ write_log (L"SetupDiGetDeviceInterfaceDetail failed, err=%d", GetLastError ());
goto end;
}
} else {
DWORD err = GetLastError();
if (err != ERROR_NO_MORE_ITEMS) {
- write_log ("SetupDiEnumDeviceInterfaces failed, err=%d", err);
+ write_log (L"SetupDiEnumDeviceInterfaces failed, err=%d", err);
goto end;
}
}
end:
xfree(pDetData);
if (hDevInfo != INVALID_HANDLE_VALUE)
- SetupDiDestroyDeviceInfoList(hDevInfo);
+ SetupDiDestroyDeviceInfoList (hDevInfo);
return cnt;
}
int enumserialports(void)
{
int cnt, i, j;
- char name[256];
- DWORD size = sizeof(COMMCONFIG);
- char devname[1000];
+ TCHAR name[256];
+ DWORD size = sizeof (COMMCONFIG);
+ TCHAR devname[1000];
- write_log ("Serial port enumeration..\n");
- cnt = enumserialports_2();
+ write_log (L"Serial port enumeration..\n");
+ cnt = enumserialports_2 ();
for (i = 0; i < 10; i++) {
- sprintf(name, "COM%d", i);
- if (!QueryDosDevice(name, devname, sizeof devname))
+ _stprintf(name, L"COM%d", i);
+ if (!QueryDosDevice (name, devname, sizeof devname))
continue;
for(j = 0; j < cnt; j++) {
- if (!strcmp(comports[j].cfgname, name))
+ if (!_tcscmp(comports[j].cfgname, name))
break;
}
if (j == cnt) {
if (cnt >= MAX_SERIAL_PORTS)
break;
- comports[j].dev = xmalloc(100);
- sprintf(comports[cnt].dev, "\\.\\\\%s", name);
+ comports[j].dev = xmalloc (100);
+ _stprintf (comports[cnt].dev, L"\\.\\\\%s", name);
comports[j].cfgname = my_strdup (name);
comports[j].name = my_strdup (name);
- write_log ("SERPORT: %d:'%s' = '%s' (%s)\n", cnt, comports[j].name, comports[j].dev, devname);
+ write_log (L"SERPORT: %d:'%s' = '%s' (%s)\n", cnt, comports[j].name, comports[j].dev, devname);
cnt++;
}
}
if (isIPC (COMPIPENAME)) {
- comports[j].dev = xmalloc(100);
- sprintf (comports[cnt].dev, "\\\\.\\pipe\\%s", COMPIPENAME);
+ comports[j].dev = xmalloc (100);
+ _stprintf (comports[cnt].dev, L"\\\\.\\pipe\\%s", COMPIPENAME);
comports[j].cfgname = my_strdup (COMPIPENAME);
comports[j].name = my_strdup (COMPIPENAME);
}
- write_log ("Serial port enumeration end\n");
+ write_log (L"Serial port enumeration end\n");
return cnt;
}
-void sernametodev(char *sername)
+void sernametodev(TCHAR *sername)
{
int i;
for (i = 0; i < MAX_SERIAL_PORTS && comports[i].name; i++) {
- if (!strcmp(sername, comports[i].cfgname)) {
- strcpy (sername, comports[i].dev);
+ if (!_tcscmp(sername, comports[i].cfgname)) {
+ _tcscpy (sername, comports[i].dev);
return;
}
}
sername[0] = 0;
}
-void serdevtoname(char *sername)
+void serdevtoname(TCHAR *sername)
{
int i;
for (i = 0; i < MAX_SERIAL_PORTS && comports[i].name; i++) {
- if (!strcmp(sername, comports[i].dev)) {
- strcpy (sername, comports[i].cfgname);
+ if (!_tcscmp(sername, comports[i].dev)) {
+ _tcscpy (sername, comports[i].cfgname);
return;
}
}
int readser (int *buffer);
int readseravail (void);
void writeser (int c);
-int openser (char *sername);
+int openser (TCHAR *sername);
void closeser (void);
void doserout (void);
void closeprinter (void);
#define MAX_SERIAL_PORTS 32
struct serialportinfo
{
- char *dev;
- char *cfgname;
- char *name;
+ TCHAR *dev;
+ TCHAR *cfgname;
+ TCHAR *name;
};
extern struct serialportinfo comports[MAX_SERIAL_PORTS];
-extern int enumserialports(void);
-extern void sernametodev(char*);
-extern void serdevtoname(char*);
+extern int enumserialports (void);
+extern void sernametodev (TCHAR*);
+extern void serdevtoname (TCHAR*);
uae_u16 ver = get_word (v + 20);
uae_u16 rev = get_word (v + 22);
if (ver * 10000 + rev < UAE_RTG_LIBRARY_VERSION * 10000 + UAE_RTG_LIBRARY_REVISION) {
- char msg[2000];
+ TCHAR msg[2000];
WIN32GUI_LoadUIString(IDS_OLDRTGLIBRARY, msg, sizeof(msg));
gui_message(msg, ver, rev, UAE_RTG_LIBRARY_VERSION, UAE_RTG_LIBRARY_REVISION);
} else {
- write_log ("P96: rtg.library %d.%d detected\n", ver, rev);
+ write_log (L"P96: rtg.library %d.%d detected\n", ver, rev);
}
checked = TRUE;
}
*/
static void DumpModeInfoStructure (uaecptr amigamodeinfoptr)
{
- write_log ("ModeInfo Structure Dump:\n");
- write_log (" Node.ln_Succ = 0x%x\n", get_long (amigamodeinfoptr));
- write_log (" Node.ln_Pred = 0x%x\n", get_long (amigamodeinfoptr + 4));
- write_log (" Node.ln_Type = 0x%x\n", get_byte (amigamodeinfoptr + 8));
- write_log (" Node.ln_Pri = %d\n", get_byte (amigamodeinfoptr + 9));
- /*write_log (" Node.ln_Name = %s\n", uaememptr->Node.ln_Name); */
- write_log (" OpenCount = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_OpenCount));
- write_log (" Active = %d\n", get_byte (amigamodeinfoptr + PSSO_ModeInfo_Active));
- write_log (" Width = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_Width));
- write_log (" Height = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_Height));
- write_log (" Depth = %d\n", get_byte (amigamodeinfoptr + PSSO_ModeInfo_Depth));
- write_log (" Flags = %d\n", get_byte (amigamodeinfoptr + PSSO_ModeInfo_Flags));
- write_log (" HorTotal = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_HorTotal));
- write_log (" HorBlankSize = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_HorBlankSize));
- write_log (" HorSyncStart = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_HorSyncStart));
- write_log (" HorSyncSize = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_HorSyncSize));
- write_log (" HorSyncSkew = %d\n", get_byte (amigamodeinfoptr + PSSO_ModeInfo_HorSyncSkew));
- write_log (" HorEnableSkew = %d\n", get_byte (amigamodeinfoptr + PSSO_ModeInfo_HorEnableSkew));
- write_log (" VerTotal = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_VerTotal));
- write_log (" VerBlankSize = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_VerBlankSize));
- write_log (" VerSyncStart = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_VerSyncStart));
- write_log (" VerSyncSize = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_VerSyncSize));
- write_log (" Clock = %d\n", get_byte (amigamodeinfoptr + PSSO_ModeInfo_first_union));
- write_log (" ClockDivide = %d\n", get_byte (amigamodeinfoptr + PSSO_ModeInfo_second_union));
- write_log (" PixelClock = %d\n", get_long (amigamodeinfoptr + PSSO_ModeInfo_PixelClock));
+ write_log (L"ModeInfo Structure Dump:\n");
+ write_log (L" Node.ln_Succ = 0x%x\n", get_long (amigamodeinfoptr));
+ write_log (L" Node.ln_Pred = 0x%x\n", get_long (amigamodeinfoptr + 4));
+ write_log (L" Node.ln_Type = 0x%x\n", get_byte (amigamodeinfoptr + 8));
+ write_log (L" Node.ln_Pri = %d\n", get_byte (amigamodeinfoptr + 9));
+ /*write_log (L" Node.ln_Name = %s\n", uaememptr->Node.ln_Name); */
+ write_log (L" OpenCount = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_OpenCount));
+ write_log (L" Active = %d\n", get_byte (amigamodeinfoptr + PSSO_ModeInfo_Active));
+ write_log (L" Width = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_Width));
+ write_log (L" Height = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_Height));
+ write_log (L" Depth = %d\n", get_byte (amigamodeinfoptr + PSSO_ModeInfo_Depth));
+ write_log (L" Flags = %d\n", get_byte (amigamodeinfoptr + PSSO_ModeInfo_Flags));
+ write_log (L" HorTotal = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_HorTotal));
+ write_log (L" HorBlankSize = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_HorBlankSize));
+ write_log (L" HorSyncStart = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_HorSyncStart));
+ write_log (L" HorSyncSize = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_HorSyncSize));
+ write_log (L" HorSyncSkew = %d\n", get_byte (amigamodeinfoptr + PSSO_ModeInfo_HorSyncSkew));
+ write_log (L" HorEnableSkew = %d\n", get_byte (amigamodeinfoptr + PSSO_ModeInfo_HorEnableSkew));
+ write_log (L" VerTotal = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_VerTotal));
+ write_log (L" VerBlankSize = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_VerBlankSize));
+ write_log (L" VerSyncStart = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_VerSyncStart));
+ write_log (L" VerSyncSize = %d\n", get_word (amigamodeinfoptr + PSSO_ModeInfo_VerSyncSize));
+ write_log (L" Clock = %d\n", get_byte (amigamodeinfoptr + PSSO_ModeInfo_first_union));
+ write_log (L" ClockDivide = %d\n", get_byte (amigamodeinfoptr + PSSO_ModeInfo_second_union));
+ write_log (L" PixelClock = %d\n", get_long (amigamodeinfoptr + PSSO_ModeInfo_PixelClock));
}
static void DumpLibResolutionStructure (uaecptr amigalibresptr)
uaecptr amigamodeinfoptr;
struct LibResolution *uaememptr = (struct LibResolution *)get_mem_bank(amigalibresptr).xlateaddr(amigalibresptr);
- write_log ("LibResolution Structure Dump:\n");
+ write_log (L"LibResolution Structure Dump:\n");
if (get_long (amigalibresptr + PSSO_LibResolution_DisplayID) == 0xFFFFFFFF) {
- write_log (" Finished With LibResolutions...\n");
+ write_log (L" Finished With LibResolutions...\n");
} else {
- write_log (" Name = %s\n", uaememptr->P96ID);
- write_log (" DisplayID = 0x%x\n", get_long (amigalibresptr + PSSO_LibResolution_DisplayID));
- write_log (" Width = %d\n", get_word (amigalibresptr + PSSO_LibResolution_Width));
- write_log (" Height = %d\n", get_word (amigalibresptr + PSSO_LibResolution_Height));
- write_log (" Flags = %d\n", get_word (amigalibresptr + PSSO_LibResolution_Flags));
+ write_log (L" Name = %s\n", uaememptr->P96ID);
+ write_log (L" DisplayID = 0x%x\n", get_long (amigalibresptr + PSSO_LibResolution_DisplayID));
+ write_log (L" Width = %d\n", get_word (amigalibresptr + PSSO_LibResolution_Width));
+ write_log (L" Height = %d\n", get_word (amigalibresptr + PSSO_LibResolution_Height));
+ write_log (L" Flags = %d\n", get_word (amigalibresptr + PSSO_LibResolution_Flags));
for (i = 0; i < MAXMODES; i++) {
amigamodeinfoptr = get_long (amigalibresptr + PSSO_LibResolution_Modes + i*4);
- write_log (" ModeInfo[%d] = 0x%x\n", i, amigamodeinfoptr);
+ write_log (L" ModeInfo[%d] = 0x%x\n", i, amigamodeinfoptr);
if (amigamodeinfoptr)
DumpModeInfoStructure (amigamodeinfoptr);
}
- write_log (" BoardInfo = 0x%x\n", get_long (amigalibresptr + PSSO_LibResolution_BoardInfo));
+ write_log (L" BoardInfo = 0x%x\n", get_long (amigalibresptr + PSSO_LibResolution_BoardInfo));
}
}
-static char binary_byte[9] = { 0,0,0,0,0,0,0,0,0 };
+static TCHAR binary_byte[9] = { 0,0,0,0,0,0,0,0,0 };
-static char *BuildBinaryString (uae_u8 value)
+static TCHAR *BuildBinaryString (uae_u8 value)
{
int i;
for (i = 0; i < 8; i++) {
for (row = 0; row < (1 << patt->Size); row++) {
mem = patt->Memory + row * 2;
for (col = 0; col < 2; col++) {
- write_log ("%s ", BuildBinaryString (*mem++));
+ write_log (L"%s ", BuildBinaryString (*mem++));
}
- write_log ("\n");
+ write_log (L"\n");
}
}
uae_u8 *mem = tmp->Memory;
unsigned int row, col, width;
width = (w + 7) >> 3;
- write_log ("xoffset = %d, bpr = %d\n", tmp->XOffset, tmp->BytesPerRow);
+ write_log (L"xoffset = %d, bpr = %d\n", tmp->XOffset, tmp->BytesPerRow);
for (row = 0; row < h; row++) {
mem = tmp->Memory + row * tmp->BytesPerRow;
for (col = 0; col < width; col++) {
- write_log ("%s ", BuildBinaryString (*mem++));
+ write_log (L"%s ", BuildBinaryString (*mem++));
}
- write_log ("\n");
+ write_log (L"\n");
}
}
static void DumpLine(struct Line *line)
{
if (line) {
- write_log ("Line->X = %d\n", line->X);
- write_log ("Line->Y = %d\n", line->Y);
- write_log ("Line->Length = %d\n", line->Length);
- write_log ("Line->dX = %d\n", line->dX);
- write_log ("Line->dY = %d\n", line->dY);
- write_log ("Line->sDelta = %d\n", line->sDelta);
- write_log ("Line->lDelta = %d\n", line->lDelta);
- write_log ("Line->twoSDminusLD = %d\n", line->twoSDminusLD);
- write_log ("Line->LinePtrn = %d\n", line->LinePtrn);
- write_log ("Line->PatternShift = %d\n", line->PatternShift);
- write_log ("Line->FgPen = 0x%x\n", line->FgPen);
- write_log ("Line->BgPen = 0x%x\n", line->BgPen);
- write_log ("Line->Horizontal = %d\n", line->Horizontal);
- write_log ("Line->DrawMode = %d\n", line->DrawMode);
- write_log ("Line->Xorigin = %d\n", line->Xorigin);
- write_log ("Line->Yorigin = %d\n", line->Yorigin);
+ write_log (L"Line->X = %d\n", line->X);
+ write_log (L"Line->Y = %d\n", line->Y);
+ write_log (L"Line->Length = %d\n", line->Length);
+ write_log (L"Line->dX = %d\n", line->dX);
+ write_log (L"Line->dY = %d\n", line->dY);
+ write_log (L"Line->sDelta = %d\n", line->sDelta);
+ write_log (L"Line->lDelta = %d\n", line->lDelta);
+ write_log (L"Line->twoSDminusLD = %d\n", line->twoSDminusLD);
+ write_log (L"Line->LinePtrn = %d\n", line->LinePtrn);
+ write_log (L"Line->PatternShift = %d\n", line->PatternShift);
+ write_log (L"Line->FgPen = 0x%x\n", line->FgPen);
+ write_log (L"Line->BgPen = 0x%x\n", line->BgPen);
+ write_log (L"Line->Horizontal = %d\n", line->Horizontal);
+ write_log (L"Line->DrawMode = %d\n", line->DrawMode);
+ write_log (L"Line->Xorigin = %d\n", line->Xorigin);
+ write_log (L"Line->Yorigin = %d\n", line->Yorigin);
}
}
{
int i = 0;
- write_log ("-----------------\n");
+ write_log (L"-----------------\n");
while (newmodes[i].depth >= 0) {
- write_log ("%s\n", newmodes[i].name);
+ write_log (L"%s\n", newmodes[i].name);
i++;
}
- write_log ("-----------------\n");
+ write_log (L"-----------------\n");
}
#endif
ri->RGBFormat = get_long (amigamemptr + PSSO_RenderInfo_RGBFormat);
return 1;
}
- write_log ("ERROR - Invalid RenderInfo memory area...\n");
+ write_log (L"ERROR - Invalid RenderInfo memory area...\n");
return 0;
}
pattern->DrawMode = get_byte (amigamemptr + PSSO_Pattern_DrawMode);
return 1;
}
- write_log ("ERROR - Invalid Pattern memory area...\n");
+ write_log (L"ERROR - Invalid Pattern memory area...\n");
return 0;
}
tmpl->BgPen = get_long (amigamemptr + PSSO_Template_BgPen);
return 1;
}
- write_log ("ERROR - Invalid Template memory area...\n");
+ write_log (L"ERROR - Invalid Template memory area...\n");
return 0;
}
line->Yorigin = get_word (amigamemptr + PSSO_Line_Yorigin);
return 1;
}
- write_log ("ERROR - Invalid Line structure...\n");
+ write_log (L"ERROR - Invalid Line structure...\n");
return 0;
}
alloc_colors_rgb (8, 8, 8, 16, 8, 0, 0, 0, 0, 0, p96rc, p96gc, p96bc);
else
alloc_colors_rgb (5, 6, 5, 11, 5, 0, 0, 0, 0, 0, p96rc, p96gc, p96bc);
- write_log ("RTG conversion: Depth=%d HostRGBF=%d P96RGBF=%d Mode=%d\n", d, host_mode, picasso96_state.RGBFormat, v);
+ write_log (L"RTG conversion: Depth=%d HostRGBF=%d P96RGBF=%d Mode=%d\n", d, host_mode, picasso96_state.RGBFormat, v);
recursor ();
full_refresh = 1;
}
}
flushpixels ();
} else {
- write_log ("ERROR - picasso_refresh() can't refresh!\n");
+ write_log (L"ERROR - picasso_refresh() can't refresh!\n");
}
}
src = ri->Memory + srcx * Bpp + srcy * ri->BytesPerRow;
dst = dstri->Memory + dstx * Bpp + dsty * dstri->BytesPerRow;
if (mask != 0xFF && Bpp > 1) {
- write_log ("WARNING - BlitRect() has mask 0x%x with Bpp %d.\n", mask, Bpp);
+ write_log (L"WARNING - BlitRect() has mask 0x%x with Bpp %d.\n", mask, Bpp);
}
P96TRACE (("(%dx%d)=(%dx%d)=(%dx%d)=%d\n", srcx, srcy, dstx, dsty, width, height, opcode));
ddrval = IDirectDrawSurface7_Blt (dstsurf, &cursor_r1, dxdata.cursorsurface2, &cursor_r2, DDBLT_WAIT, NULL);
if (FAILED(ddrval)) {
if (ddrval != DDERR_SURFACELOST)
- write_log ("Cursor surface clearblit failed: %s\n", DXError (ddrval));
+ write_log (L"Cursor surface clearblit failed: %s\n", DXError (ddrval));
}
}
}
}
}
- write_log ("wincursor: %dx%d hires=%d doubled=%d\n", w2, h2, hiressprite, doubledsprite);
+ write_log (L"wincursor: %dx%d hires=%d doubled=%d\n", w2, h2, hiressprite, doubledsprite);
xfree (tmp_sprite_data);
tmp_sprite_data = NULL;
}
if (!ret)
- write_log ("RTG Windows color cursor creation failed\n");
+ write_log (L"RTG Windows color cursor creation failed\n");
exit:
if (currprefs.input_tablet && currprefs.input_magic_mouse && currprefs.input_magic_mouse_cursor == MAGICMOUSE_NATIVE_ONLY) {
if (ddrval == DDERR_SURFACELOST) {
ddrval = IDirectDrawSurface7_Restore (dxdata.cursorsurface1);
if (FAILED(ddrval)) {
- write_log ("sprite surface failed to restore: %s\n", DXError (ddrval));
+ write_log (L"sprite surface failed to restore: %s\n", DXError (ddrval));
goto end;
}
}
return 0x50001000 | (mi[i].id * 0x10000);
}
(*unkcnt)++;
- write_log ("P96: Non-unique mode %dx%d\n", w, h);
+ write_log (L"P96: Non-unique mode %dx%d\n", w, h);
return 0x51001000 - (*unkcnt) * 0x10000;
}
int size = get_long (uaegfx_base + CARD_RESLISTSIZE);
picasso96_amem = get_long (uaegfx_base + CARD_RESLIST);
picasso96_amemend = picasso96_amem + size;
- write_log("P96 RESINFO: %08X-%08X (%d,%d)\n", picasso96_amem, picasso96_amemend, size / PSSO_ModeInfo_sizeof, size);
+ write_log (L"P96 RESINFO: %08X-%08X (%d,%d)\n", picasso96_amem, picasso96_amemend, size / PSSO_ModeInfo_sizeof, size);
}
xfree (gwwbuf);
GetSystemInfo (&si);
struct MultiDisplay *md = getdisplay (&currprefs);
struct PicassoResolution *DisplayModes = md->DisplayModes;
- uaegfx_resname = ds ("uaegfx.card");
+ uaegfx_resname = ds (L"uaegfx.card");
xfree (newmodes);
newmodes = NULL;
picasso96_amem = picasso96_amemend = 0;
memcpy (pr, &DisplayModes[i], sizeof (struct PicassoResolution));
pr->res.width = missmodes[misscnt * 2 + 0];
pr->res.height = missmodes[misscnt * 2 + 1];
- sprintf (pr->name, "%dx%d FAKE", pr->res.width, pr->res.height);
+ _stprintf (pr->name, L"%dx%d FAKE", pr->res.width, pr->res.height);
size += PSSO_ModeInfo_sizeof * depths;
cnt++;
misscnt++;
if (romtagp == addr) {
uaecptr ver = get_long (addr + 18);
if (valid_address (ver, 8)) {
- char *vers = my_strdup (get_real_address (ver));
+ TCHAR *vers = my_strdup (get_real_address (ver));
int version = get_byte (addr + 11);
while (strlen (vers) > 0 && (vers[strlen (vers) - 1] == 10 || vers[strlen (vers) - 1] == 13))
vers[strlen (vers) - 1] = 0;
- write_log ("P96: v%d %08X %s\n", version, addr, vers);
+ write_log (L"P96: v%d %08X %s\n", version, addr, vers);
if (version == 1) {
static int warned;
if (!warned)
}
}
if (!ok)
- write_log ("P96: uaegfx.card not detected!?\n");
+ write_log (L"P96: uaegfx.card not detected!?\n");
}
#endif
cursordeactivate = 0;
reloadcursor = 0;
- write_log ("RTG mode mask: %x\n", currprefs.picasso96_modeflags);
+ write_log (L"RTG mode mask: %x\n", currprefs.picasso96_modeflags);
put_word (ABI + PSSO_BoardInfo_BitsPerCannon, 8);
put_word (ABI + PSSO_BoardInfo_RGBFormats, currprefs.picasso96_modeflags);
put_long (ABI + PSSO_BoardInfo_BoardType, picasso96_BT);
if (flags & BIF_HARDWARESPRITE) {
hwsprite = 1;
put_word (ABI + PSSO_BoardInfo_SoftSpriteFlags, 0);
- write_log ("P96: uaegfx.card: hardware sprite support enabled\n");
+ write_log (L"P96: uaegfx.card: hardware sprite support enabled\n");
} else {
hwsprite = 0;
- write_log ("P96: uaegfx.card: no hardware sprite support\n");
+ write_log (L"P96: uaegfx.card: no hardware sprite support\n");
put_word (ABI + PSSO_BoardInfo_SoftSpriteFlags, currprefs.picasso96_modeflags);
}
if (uaegfxcard_old && (flags & BIF_HARDWARESPRITE)) {
flags &= ~BIF_HARDWARESPRITE;
- write_log ("P96: uaegfx.card: old version (<2.0), forced hardware sprite disabled\n");
+ write_log (L"P96: uaegfx.card: old version (<2.0), forced hardware sprite disabled\n");
}
if (!(flags & BIF_BLITTER))
- write_log ("P96: no blitter support, bogus uaegfx.card!?\n");
+ write_log (L"P96: no blitter support, bogus uaegfx.card!?\n");
#else
hwsprite = 1;
flags |= BIF_HARDWARESPRITE;
#endif
if (flags & BIF_NOBLITTER)
- write_log ("P96: blitter disabled in devs:monitors/uaegfx!\n");
+ write_log (L"P96: blitter disabled in devs:monitors/uaegfx!\n");
if (currprefs.win32_rtgvblankrate >= -1)
flags |= BIF_VBLANKINTERRUPT;
#endif
}
-static void addmode (uaecptr AmigaBoardInfo, uaecptr *amem, struct LibResolution *res, int w, int h, const char *name, int display, int *unkcnt)
+static void addmode (uaecptr AmigaBoardInfo, uaecptr *amem, struct LibResolution *res, int w, int h, const TCHAR *name, int display, int *unkcnt)
{
int depth;
res->Height = h;
res->Flags = P96F_PUBLIC;
memcpy (res->P96ID, "P96-0:", 6);
- if (name)
- strcpy (res->Name, name);
- else
+ if (name) {
+ char *n2 = ua (name);
+ strcpy (res->Name, n2);
+ xfree (n2);
+ } else {
sprintf (res->Name, "UAE:%4dx%4d", w, h);
+ }
for (depth = 8; depth <= 32; depth++) {
if (!p96depth (depth))
uaegfxversion (AmigaBoardInfo);
#endif
if (!picasso96_amem) {
- write_log ("P96: InitCard() but no resolution memory!\n");
+ write_log (L"P96: InitCard() but no resolution memory!\n");
return 0;
}
amem = picasso96_amem;
unkcnt = 0;
while (newmodes[i].depth >= 0) {
struct LibResolution res = { 0 };
+ TCHAR *s;
j = i;
addmode (AmigaBoardInfo, &amem, &res, newmodes[i].res.width, newmodes[i].res.height, NULL, 0, &unkcnt);
- write_log ("%08X %4dx%4d %s\n", res.DisplayID, res.Width, res.Height, res.Name);
+ s = au (res.Name);
+ write_log (L"%08X %4dx%4d %s\n", res.DisplayID, res.Width, res.Height, s);
+ xfree (s);
while (newmodes[i].depth >= 0
&& newmodes[i].res.width == newmodes[j].res.width
&& newmodes[i].res.height == newmodes[j].res.height)
struct MultiDisplay *md = &Displays[i];
int w = md->rect.right - md->rect.left;
int h = md->rect.bottom - md->rect.top;
- char tmp[100];
+ TCHAR tmp[100];
if (md->primary)
strcpy (tmp, "UAE:Primary");
else
- sprintf (tmp, "UAE:Display#%d", i);
+ _stprintf (tmp, "UAE:Display#%d", i);
addmode (AmigaBoardInfo, &amem, &res, w, h, tmp, i + 1, &unkcnt);
- write_log ("%08X %4dx%4d %s\n", res.DisplayID, res.Width + 16, res.Height, res.Name);
+ write_log (L"%08X %4dx%4d %s\n", res.DisplayID, res.Width + 16, res.Height, res.Name);
LibResolutionStructureCount++;
CopyLibResolutionStructureU2A (&res, amem);
#if P96TRACING_ENABLED && P96TRACING_LEVEL > 1
#endif
if (amem > picasso96_amemend)
- write_log ("P96: display resolution list corruption %08x<>%08x (%d)\n", amem, picasso96_amemend, i);
+ write_log (L"P96: display resolution list corruption %08x<>%08x (%d)\n", amem, picasso96_amemend, i);
return -1;
}
{
struct regstruct *regs = &ctx->regs;
uae_u16 flag = m68k_dreg (regs, 0) & 0xFFFF;
- char p96text[100];
+ TCHAR p96text[100];
/* Do not switch immediately. Tell the custom chip emulation about the
* desired state, and wait for custom.c to call picasso_enablescreen
picasso_requested_on = flag;
p96text[0] = 0;
if (flag)
- sprintf (p96text, "Picasso96 %dx%dx%d (%dx%dx%d)",
+ _stprintf (p96text, L"Picasso96 %dx%dx%d (%dx%dx%d)",
picasso96_state.Width, picasso96_state.Height, picasso96_state.BytesPerPixel * 8,
picasso_vidinfo.width, picasso_vidinfo.height, picasso_vidinfo.pixbytes * 8);
- write_log ("SetSwitch() - %s\n", flag ? p96text : "amiga");
+ write_log (L"SetSwitch() - %s\n", flag ? p96text : L"amiga");
/* Put old switch-state in D0 */
return !flag;
}
if (picasso96_state.BytesPerPixel == picasso_vidinfo.pixbytes)
p96surface = createsurface (get_real_address (picasso96_state.Address),
picasso96_state.Width * picasso96_state.BytesPerPixel, picasso96_state.Width, picasso96_state.Height);
- write_log ("P96Surface: %08X %p\n", picasso96_state.Address, p96surface);
+ write_log (L"P96Surface: %08X %p\n", picasso96_state.Address, p96surface);
#endif
}
/* We get here only if Mask != 0xFF */
if (Bpp != 1) {
- write_log ("WARNING - FillRect() has unhandled mask 0x%x with Bpp %d. Using fall-back routine.\n", Mask, Bpp);
+ write_log (L"WARNING - FillRect() has unhandled mask 0x%x with Bpp %d. Using fall-back routine.\n", Mask, Bpp);
} else {
Pen &= Mask;
Mask = ~Mask;
uae_u8 Bpp = GetBytesPerPixel (ri->RGBFormat);
if (opcode == BLIT_DST) {
- write_log ( "WARNING: BlitRect() being called with opcode of BLIT_DST\n" );
+ write_log ( L"WARNING: BlitRect() being called with opcode of BLIT_DST\n" );
return 1;
}
if(Bpp > 1)
Mask = 0xFF;
if(tmp.DrawMode == COMP) {
- write_log ("WARNING - BlitTemplate() has unhandled mask 0x%x with COMP DrawMode. Using fall-back routine.\n", Mask);
+ write_log (L"WARNING - BlitTemplate() has unhandled mask 0x%x with COMP DrawMode. Using fall-back routine.\n", Mask);
return 0;
} else {
result = 1;
if (p96vblank >= 300)
p96vblank = 300;
p96syncrate = maxvpos * vblank_hz / p96vblank;
- write_log ("P96FREQ: %d*%d = %d / %d = %d\n", maxvpos, vblank_hz, maxvpos * vblank_hz, p96vblank, p96syncrate);
+ write_log (L"P96FREQ: %d*%d = %d / %d = %d\n", maxvpos, vblank_hz, maxvpos * vblank_hz, p96vblank, p96syncrate);
}
/* NOTE: Watch for those planeptrs of 0x00000000 and 0xFFFFFFFF for all zero / all one bitmaps !!!! */
if (NOBLITTER)
return 0;
if (minterm != 0x0C) {
- write_log ("ERROR - BlitPlanar2Chunky() has minterm 0x%x, which I don't handle. Using fall-back routine.\n",
+ write_log (L"ERROR - BlitPlanar2Chunky() has minterm 0x%x, which I don't handle. Using fall-back routine.\n",
minterm);
} else if (CopyRenderInfoStructureA2U (ri, &local_ri) && CopyBitMapStructureA2U (bm, &local_bm)) {
P96TRACE(("BlitPlanar2Chunky(%d, %d, %d, %d, %d, %d) Minterm 0x%x, Mask 0x%x, Depth %d\n",
if (NOBLITTER)
return 0;
if (minterm != 0x0C) {
- write_log ("WARNING - BlitPlanar2Direct() has unhandled op-code 0x%x. Using fall-back routine.\n", minterm);
+ write_log (L"WARNING - BlitPlanar2Direct() has unhandled op-code 0x%x. Using fall-back routine.\n", minterm);
return 0;
}
if (CopyRenderInfoStructureA2U (ri, &local_ri) && CopyBitMapStructureA2U (bm, &local_bm)) {
uae_u8 *dst = NULL;
ULONG_PTR gwwcnt;
#if 0
- write_log ("%dx%d %dx%d %dx%d\n", picasso96_state.Width, picasso96_state.Width,
+ write_log (L"%dx%d %dx%d %dx%d\n", picasso96_state.Width, picasso96_state.Width,
picasso96_state.VirtualWidth, picasso96_state.VirtualHeight,
picasso_vidinfo.width, picasso_vidinfo.height);
#endif
addrbank gfxmem_bankx = {
gfxmem_lgetx, gfxmem_wgetx, gfxmem_bgetx,
gfxmem_lputx, gfxmem_wputx, gfxmem_bputx,
- gfxmem_xlate, gfxmem_check, NULL, "RTG RAM",
+ gfxmem_xlate, gfxmem_check, NULL, L"RTG RAM",
dummy_lgeti, dummy_wgeti, ABFLAG_RAM
};
uaecptr bi = m68k_areg (regs, 0);
uae_u32 onoff = m68k_dreg (regs, 0);
interrupt_enabled = onoff;
- //write_log ("Picasso_SetInterrupt(%08x,%d)\n", bi, onoff);
+ //write_log (L"Picasso_SetInterrupt(%08x,%d)\n", bi, onoff);
return onoff;
}
RTGCALL2(PSSO_BoardInfo_SetInterrupt, picasso_SetInterrupt);
- write_log ("uaegfx.card magic code: %08X-%08X ABI=%08X\n", start, here (), ABI);
+ write_log (L"uaegfx.card magic code: %08X-%08X ABI=%08X\n", start, here (), ABI);
ptr = here ();
org (old);
uaecptr findcardfunc, initcardfunc;
uaecptr exec = get_long (4);
- uaegfx_resid = ds ("UAE Graphics Card 3.2");
- uaegfx_vblankname = ds ("UAE Graphics Card VBLANK");
- uaegfx_vblankname = ds ("UAE Graphics Card PORTS");
+ uaegfx_resid = ds (L"UAE Graphics Card 3.2");
+ uaegfx_vblankname = ds (L"UAE Graphics Card VBLANK");
+ uaegfx_vblankname = ds (L"UAE Graphics Card PORTS");
/* Open */
openfunc = here ();
if (currprefs.win32_rtgvblankrate >= -1)
initvblankirq (ctx, uaegfx_base);
- write_log ("uaegfx.card %d.%d init @%08X\n", UAEGFX_VERSION, UAEGFX_REVISION, uaegfx_base);
+ write_log (L"uaegfx.card %d.%d init @%08X\n", UAEGFX_VERSION, UAEGFX_REVISION, uaegfx_base);
return uaegfx_base;
}
#endif
*ticks = t * 50;
}
-static DWORD getattr(const char *name, LPFILETIME lpft, size_t *size)
+static DWORD getattr(const TCHAR *name, LPFILETIME lpft, size_t *size)
{
HANDLE hFind;
WIN32_FIND_DATA fd;
return fd.dwFileAttributes;
}
-int posixemu_stat(const char *name, struct stat *statbuf)
+int posixemu_stat(const TCHAR *name, struct stat *statbuf)
{
DWORD attr;
FILETIME ft, lft;
return 0;
}
-int posixemu_chmod(const char *name, int mode)
+int posixemu_chmod(const TCHAR *name, int mode)
{
DWORD attr = FILE_ATTRIBUTE_NORMAL;
if (!(mode & FILEFLAG_WRITE))
}
}
-static int setfiletime (const char *name, unsigned int days, int minute, int tick, int tolocal)
+static int setfiletime (const TCHAR *name, unsigned int days, int minute, int tick, int tolocal)
{
FILETIME LocalFileTime, FileTime;
HANDLE hFile;
return success;
}
-int posixemu_utime (const char *name, struct utimbuf *ttime)
+int posixemu_utime (const TCHAR *name, struct utimbuf *ttime)
{
int result = -1, tolocal;
long days, mins, ticks;
}
}
-int uae_start_thread (char *name, void *(*f)(void *), void *arg, uae_thread_id *tid)
+int uae_start_thread (TCHAR *name, void *(*f)(void *), void *arg, uae_thread_id *tid)
{
HANDLE hThread;
int result = 1;
if (hThread) {
SetThreadPriority (hThread, THREAD_PRIORITY_ABOVE_NORMAL);
if (name)
- write_log ("Thread '%s' started (%d)\n", name, hThread);
+ write_log (L"Thread '%s' started (%d)\n", name, hThread);
} else {
result = 0;
- write_log ("Thread '%s' failed to start!?\n", name ? name : "<unknown>");
+ write_log (L"Thread '%s' failed to start!?\n", name ? name : L"<unknown>");
}
if (tid)
*tid = hThread;
#include "crc32.h"
static int inimode = 0;
-static char *inipath;
-#define PUPPA "eitätäoo"
+static TCHAR *inipath;
+#define PUPPA L"eitätäoo"
static HKEY gr (UAEREG *root)
{
return hWinUAEKey;
return root->fkey;
}
-static char *gs (UAEREG *root)
+static TCHAR *gs (UAEREG *root)
{
if (!root)
- return "WinUAE";
+ return L"WinUAE";
return root->inipath;
}
-static char *gsn (UAEREG *root, const char *name)
+static TCHAR *gsn (UAEREG *root, const TCHAR *name)
{
- char *r, *s;
+ TCHAR *r, *s;
if (!root)
return my_strdup (name);
r = gs (root);
- s = xmalloc (strlen (r) + 1 + strlen (name) + 1);
- sprintf (s, "%s/%s", r, name);
+ s = xmalloc ((_tcslen (r) + 1 + _tcslen (name) + 1) * sizeof (TCHAR));
+ _stprintf (s, L"%s/%s", r, name);
return s;
}
-int regsetstr (UAEREG *root, const char *name, const char *str)
+int regsetstr (UAEREG *root, const TCHAR *name, const TCHAR *str)
{
if (inimode) {
DWORD ret;
HKEY rk = gr (root);
if (!rk)
return 0;
- return RegSetValueEx (rk, name, 0, REG_SZ, (CONST BYTE *)str, strlen (str) + 1) == ERROR_SUCCESS;
+ return RegSetValueEx (rk, name, 0, REG_SZ, (CONST BYTE *)str, (_tcslen (str) + 1) * sizeof (TCHAR)) == ERROR_SUCCESS;
}
}
-int regsetint (UAEREG *root, const char *name, int val)
+int regsetint (UAEREG *root, const TCHAR *name, int val)
{
if (inimode) {
DWORD ret;
- char tmp[100];
- sprintf (tmp, "%d", val);
+ TCHAR tmp[100];
+ _stprintf (tmp, L"%d", val);
ret = WritePrivateProfileString (gs (root), name, tmp, inipath);
return ret;
} else {
}
}
-int regqueryint (UAEREG *root, const char *name, int *val)
+int regqueryint (UAEREG *root, const TCHAR *name, int *val)
{
if (inimode) {
int ret = 0;
- char tmp[100];
- GetPrivateProfileString (gs (root), name, PUPPA, tmp, sizeof (tmp), inipath);
- if (strcmp (tmp, PUPPA)) {
- *val = atol (tmp);
+ TCHAR tmp[100];
+ GetPrivateProfileString (gs (root), name, PUPPA, tmp, sizeof (tmp) / sizeof (TCHAR), inipath);
+ if (_tcscmp (tmp, PUPPA)) {
+ *val = _tstol (tmp);
ret = 1;
}
return ret;
}
}
-int regquerystr (UAEREG *root, const char *name, char *str, int *size)
+int regquerystr (UAEREG *root, const TCHAR *name, TCHAR *str, int *size)
{
if (inimode) {
int ret = 0;
- char *tmp = xmalloc ((*size) + 1);
+ TCHAR *tmp = xmalloc (((*size) + 1) * sizeof (TCHAR));
GetPrivateProfileString (gs (root), name, PUPPA, tmp, *size, inipath);
- if (strcmp (tmp, PUPPA)) {
- strcpy (str, tmp);
+ if (_tcscmp (tmp, PUPPA)) {
+ _tcscpy (str, tmp);
ret = 1;
}
xfree (tmp);
HKEY rk = gr (root);
if (!rk)
return 0;
- return RegQueryValueEx (rk, name, 0, NULL, str, size) == ERROR_SUCCESS;
+ return RegQueryValueEx (rk, name, 0, NULL, (LPBYTE)str, size) == ERROR_SUCCESS;
}
}
-int regenumstr (UAEREG *root, int idx, char *name, int *nsize, char *str, int *size)
+int regenumstr (UAEREG *root, int idx, TCHAR *name, int *nsize, TCHAR *str, int *size)
{
+ name[0] = 0;
+ str[0] = 0;
if (inimode) {
int ret = 0;
int tmpsize = 65536;
- char *tmp = xmalloc (tmpsize);
+ TCHAR *tmp = xmalloc (tmpsize * sizeof (TCHAR));
if (GetPrivateProfileSection (gs (root), tmp, tmpsize, inipath) > 0) {
int i;
- char *p = tmp, *p2;
+ TCHAR *p = tmp, *p2;
for (i = 0; i < idx; i++) {
if (p[0] == 0)
break;
- p += strlen (p) + 1;
+ p += _tcslen (p) + 1;
}
if (p[0]) {
- p2 = strchr (p, '=');
+ p2 = _tcschr (p, '=');
*p2++ = 0;
- strcpy_s (name, *nsize, p);
- strcpy_s (str, *size, p2);
+ _tcscpy_s (name, *nsize, p);
+ _tcscpy_s (str, *size, p2);
ret = 1;
}
}
HKEY rk = gr (root);
if (!rk)
return 0;
- return RegEnumValue (rk, idx, name, nsize, NULL, NULL, str, size) == ERROR_SUCCESS;
+ return RegEnumValue (rk, idx, name, nsize, NULL, NULL, (LPBYTE)str, size) == ERROR_SUCCESS;
}
}
-int regquerydatasize (UAEREG *root, const char *name, int *size)
+int regquerydatasize (UAEREG *root, const TCHAR *name, int *size)
{
if (inimode) {
int ret = 0;
int csize = 65536;
- char *tmp = xmalloc (csize);
+ TCHAR *tmp = xmalloc (csize * sizeof (TCHAR));
if (regquerystr (root, name, tmp, &csize)) {
- *size = strlen (tmp) / 2;
+ *size = _tcslen (tmp) / 2;
ret = 1;
}
xfree (tmp);
}
}
-int regsetdata (UAEREG *root, const char *name, void *str, int size)
+int regsetdata (UAEREG *root, const TCHAR *name, void *str, int size)
{
if (inimode) {
uae_u8 *in = str;
DWORD ret;
int i;
- char *tmp = xmalloc (size * 2 + 1);
+ TCHAR *tmp = xmalloc ((size * 2 + 1) * sizeof (TCHAR));
for (i = 0; i < size; i++)
- sprintf (tmp + i * 2, "%02X", in[i]);
+ _stprintf (tmp + i * 2, L"%02X", in[i]);
ret = WritePrivateProfileString (gs (root), name, tmp, inipath);
xfree (tmp);
return ret;
return RegSetValueEx(rk, name, 0, REG_BINARY, (BYTE*)str, size) == ERROR_SUCCESS;
}
}
-int regquerydata (UAEREG *root, const char *name, void *str, int *size)
+int regquerydata (UAEREG *root, const TCHAR *name, void *str, int *size)
{
if (inimode) {
int csize = (*size) * 2 + 1;
int i, j;
int ret = 0;
- char *tmp = xmalloc (csize);
+ TCHAR *tmp = xmalloc (csize * sizeof (TCHAR));
uae_u8 *out = str;
if (!regquerystr (root, name, tmp, &csize))
goto err;
j = 0;
- for (i = 0; i < strlen (tmp); i += 2) {
- char c1 = toupper(tmp[i + 0]);
- char c2 = toupper(tmp[i + 1]);
+ for (i = 0; i < _tcslen (tmp); i += 2) {
+ TCHAR c1 = toupper(tmp[i + 0]);
+ TCHAR c2 = toupper(tmp[i + 1]);
if (c1 >= 'A')
c1 -= 'A' - 10;
else if (c1 >= '0')
}
}
-int regdelete (UAEREG *root, const char *name)
+int regdelete (UAEREG *root, const TCHAR *name)
{
if (inimode) {
WritePrivateProfileString (gs (root), name, NULL, inipath);
}
}
-int regexists (UAEREG *root, const char *name)
+int regexists (UAEREG *root, const TCHAR *name)
{
if (inimode) {
int ret = 1;
- char *tmp = xmalloc (strlen (PUPPA) + 1);
- int size = strlen (PUPPA) + 1;
+ TCHAR *tmp = xmalloc ((_tcslen (PUPPA) + 1) * sizeof (TCHAR));
+ int size = _tcslen (PUPPA) + 1;
GetPrivateProfileString (gs (root), name, PUPPA, tmp, size, inipath);
- if (!strcmp (tmp, PUPPA))
+ if (!_tcscmp (tmp, PUPPA))
ret = 0;
xfree (tmp);
return ret;
}
}
-void regdeletetree (UAEREG *root, const char *name)
+void regdeletetree (UAEREG *root, const TCHAR *name)
{
if (inimode) {
- char *s = gsn (root, name);
+ TCHAR *s = gsn (root, name);
if (!s)
return;
- WritePrivateProfileSection (s, "", inipath);
+ WritePrivateProfileSection (s, L"", inipath);
xfree (s);
} else {
HKEY rk = gr (root);
}
}
-int regexiststree (UAEREG *root, const char *name)
+int regexiststree (UAEREG *root, const TCHAR *name)
{
if (inimode) {
int ret = 0;
int tmpsize = 65536;
- char *p, *tmp;
- char *s = gsn (root, name);
+ TCHAR *p, *tmp;
+ TCHAR *s = gsn (root, name);
if (!s)
return 0;
tmp = xmalloc (tmpsize);
GetPrivateProfileSectionNames (tmp, tmpsize, inipath);
p = tmp;
while (p[0]) {
- if (!strcmp (p, name)) {
+ if (!_tcscmp (p, name)) {
ret = 1;
break;
}
- p += strlen (p) + 1;
+ p += _tcslen (p) + 1;
}
xfree (tmp);
xfree (s);
}
-UAEREG *regcreatetree (UAEREG *root, const char *name)
+UAEREG *regcreatetree (UAEREG *root, const TCHAR *name)
{
UAEREG *fkey;
HKEY rkey;
if (inimode) {
- char *ininame;
+ TCHAR *ininame;
if (!root) {
if (!name)
ininame = my_strdup (gs (NULL));
else
ininame = my_strdup (name);
} else {
- ininame = xmalloc (strlen (root->inipath) + 1 + strlen (name) + 1);
- sprintf (ininame, "%s/%s", root->inipath, name);
+ ininame = xmalloc ((_tcslen (root->inipath) + 1 + _tcslen (name) + 1) * sizeof (TCHAR));
+ _stprintf (ininame, L"%s/%s", root->inipath, name);
}
fkey = xcalloc (sizeof (UAEREG), 1);
fkey->inipath = ininame;
} else {
+ DWORD err;
HKEY rk = gr (root);
if (!rk) {
rk = HKEY_CURRENT_USER;
- name = "Software\\Arabuusimiehet\\WinUAE";
+ name = L"Software\\Arabuusimiehet\\WinUAE";
+ } else if (!name) {
+ name = L"";
}
- if (RegCreateKeyEx(rk, name, 0, NULL, REG_OPTION_NON_VOLATILE,
- KEY_READ | KEY_WRITE, NULL, &rkey, NULL) != ERROR_SUCCESS)
+ err = RegCreateKeyEx (rk, name, 0, NULL, REG_OPTION_NON_VOLATILE,
+ KEY_READ | KEY_WRITE, NULL, &rkey, NULL);
+ if (err != ERROR_SUCCESS)
return 0;
fkey = xcalloc (sizeof (UAEREG), 1);
fkey->fkey = rkey;
xfree (key);
}
-static uae_u8 crcok[20] = { 0xD3,0x34,0xDE,0x75,0x31,0x2B,0x44,0x51,0xA2,0xB8,0x8D,0xC3,0x52,0xFB,0x65,0x8F,0x95,0xCB,0x0C,0xF2 };
+//static uae_u8 crcok[20] = { 0xD3,0x34,0xDE,0x75,0x31,0x2B,0x44,0x51,0xA2,0xB8,0x8D,0xC3,0x52,0xFB,0x65,0x8F,0x95,0xCB,0x0C,0xF2 };
+static uae_u8 crcok[20] = { 0xaf,0xb7,0x36,0x15,0x05,0xca,0xe6,0x9d,0x23,0x17,0x4d,0x50,0x2b,0x5c,0xc3,0x64,0x38,0xb8,0x4e,0xfc };
-int reginitializeinit (const char *ppath)
+int reginitializeinit (const TCHAR *ppath)
{
UAEREG *r = NULL;
- char tmp1[1000];
+ TCHAR tmp1[1000];
uae_u8 crc[20];
int s, v1, v2, v3;
- char path[MAX_DPATH], fpath[MAX_PATH];
+ TCHAR path[MAX_DPATH], fpath[MAX_PATH];
if (!ppath) {
int ok = 0;
- char *posn;
- strcpy (path, _pgmptr);
- if (strlen (path) > 4 && !stricmp (path + strlen (path) - 4, ".exe")) {
- strcpy (path + strlen (path) - 3, "ini");
+ TCHAR *posn;
+ _tcscpy (path, pgmptr);
+ if (_tcslen (path) > 4 && !_tcsicmp (path + _tcslen (path) - 4, L".exe")) {
+ _tcscpy (path + _tcslen (path) - 3, L"ini");
if (GetFileAttributes (path) != INVALID_FILE_ATTRIBUTES)
ok = 1;
}
if (!ok) {
- strcpy (path, _pgmptr);
- if((posn = strrchr (path, '\\')))
+ _tcscpy (path, pgmptr);
+ if((posn = _tcsrchr (path, '\\')))
posn[1] = 0;
- strcat (path, "winuae.ini");
+ _tcscat (path, L"winuae.ini");
}
if (GetFileAttributes (path) == INVALID_FILE_ATTRIBUTES)
return 0;
} else {
- strcpy (path, ppath);
+ _tcscpy (path, ppath);
}
fpath[0] = 0;
- GetFullPathName (path, sizeof fpath, fpath, NULL);
- if (strlen (fpath) < 5 || stricmp (fpath + strlen (fpath) - 4, ".ini"))
+ GetFullPathName (path, sizeof fpath / sizeof (TCHAR), fpath, NULL);
+ if (_tcslen (fpath) < 5 || _tcsicmp (fpath + _tcslen (fpath) - 4, L".ini"))
return 0;
inimode = 1;
inipath = my_strdup (fpath);
- if (!regexists (NULL, "Version"))
+ if (!regexists (NULL, L"Version"))
goto fail;
- r = regcreatetree (NULL, "Warning");
+ r = regcreatetree (NULL, L"Warning");
if (!r)
goto fail;
memset (tmp1, 0, sizeof tmp1);
s = 200;
- if (!regquerystr (r, "info1", tmp1, &s))
+ if (!regquerystr (r, L"info1", tmp1, &s))
goto fail;
- if (!regquerystr (r, "info2", tmp1 + 200, &s))
+ if (!regquerystr (r, L"info2", tmp1 + 200, &s))
goto fail;
get_sha1 (tmp1, sizeof tmp1, crc);
if (memcmp (crc, crcok, sizeof crcok))
goto fail;
v1 = v2 = -1;
- regsetint (r, "check", 1);
- regqueryint (r, "check", &v1);
- regsetint (r, "check", 3);
- regqueryint (r, "check", &v2);
- regdelete (r, "check");
- if (regqueryint (r, "check", &v3))
+ regsetint (r, L"check", 1);
+ regqueryint (r, L"check", &v1);
+ regsetint (r, L"check", 3);
+ regqueryint (r, L"check", &v2);
+ regdelete (r, L"check");
+ if (regqueryint (r, L"check", &v3))
goto fail;
if (v1 != 1 || v2 != 3)
goto fail;
DeleteFile (path);
if (GetFileAttributes (path) != INVALID_FILE_ATTRIBUTES)
goto end;
- r = regcreatetree (NULL, "Warning");
+ r = regcreatetree (NULL, L"Warning");
if (!r)
goto end;
- regsetstr (r, "info1", "This is unsupported file. Compatibility between versions is not guaranteed.");
- regsetstr (r, "info2", "Incompatible ini-files may be re-created from scratch!");
+ regsetstr (r, L"info1", L"This is unsupported file. Compatibility between versions is not guaranteed.");
+ regsetstr (r, L"info2", L"Incompatible ini-files may be re-created from scratch!");
regclosetree (r);
return 1;
end:
void regstatus (void)
{
if (inimode)
- write_log ("WARNING: Unsupported '%s' enabled\n", inipath);
+ write_log (L"WARNING: Unsupported '%s' enabled\n", inipath);
}
int getregmode (void)
{
return inimode;
-}
\ No newline at end of file
+}
typedef struct UAEREG {
HKEY fkey;
- char *inipath;
+ TCHAR *inipath;
} UAEREG;
extern int getregmode (void);
-extern int reginitializeinit (const char *path);
+extern int reginitializeinit (const TCHAR *path);
extern void regstatus (void);
-extern int regsetstr (UAEREG*, const char *name, const char *str);
-extern int regsetint (UAEREG*, const char *name, int val);
-extern int regqueryint (UAEREG*, const char *name, int *val);
-extern int regquerystr (UAEREG*, const char *name, char *str, int *size);
+extern int regsetstr (UAEREG*, const TCHAR *name, const TCHAR *str);
+extern int regsetint (UAEREG*, const TCHAR *name, int val);
+extern int regqueryint (UAEREG*, const TCHAR *name, int *val);
+extern int regquerystr (UAEREG*, const TCHAR *name, TCHAR *str, int *size);
-extern int regdelete (UAEREG*, const char *name);
-extern void regdeletetree (UAEREG*, const char *name);
+extern int regdelete (UAEREG*, const TCHAR *name);
+extern void regdeletetree (UAEREG*, const TCHAR *name);
-extern int regexists (UAEREG*, const char *name);
-extern int regexiststree (UAEREG *, const char *name);
+extern int regexists (UAEREG*, const TCHAR *name);
+extern int regexiststree (UAEREG *, const TCHAR *name);
-extern int regquerydatasize (UAEREG *root, const char *name, int *size);
-extern int regsetdata (UAEREG*, const char *name, const void *str, int size);
-extern int regquerydata (UAEREG *root, const char *name, void *str, int *size);
+extern int regquerydatasize (UAEREG *root, const TCHAR *name, int *size);
+extern int regsetdata (UAEREG*, const TCHAR *name, const void *str, int size);
+extern int regquerydata (UAEREG *root, const TCHAR *name, void *str, int *size);
-extern int regenumstr (UAEREG*, int idx, char *name, int *nsize, char *str, int *size);
+extern int regenumstr (UAEREG*, int idx, TCHAR *name, int *nsize, TCHAR *str, int *size);
-extern UAEREG *regcreatetree (UAEREG*, const char *name);
+extern UAEREG *regcreatetree (UAEREG*, const TCHAR *name);
extern void regclosetree (UAEREG *key);
static int initialized;
static RPGUESTINFO guestinfo;
-char *rp_param = NULL;
+TCHAR *rp_param = NULL;
int rp_rpescapekey = 0x01;
int rp_rpescapeholdtime = 600;
int rp_screenmode = 0;
static void outhex (const uae_u8 *s)
{
for (;;) {
- write_log ("%02X%02X ", s[0], s[1]);
+ write_log (L"%02X%02X ", s[0], s[1]);
if (s[0] == 0 && s[1] == 0)
break;
s += 2;
}
- write_log ("\n");
+ write_log (L"\n");
}
-static char *ua (const WCHAR *s)
-{
- char *d;
- int len;
-
- if (s == NULL)
- return NULL;
- len = WideCharToMultiByte (CP_ACP, 0, s, -1, NULL, 0, 0, FALSE);
- if (!len)
- return my_strdup ("");
- d = xmalloc (len + 1);
- WideCharToMultiByte (CP_ACP, 0, s, -1, d, len, 0, FALSE);
- return d;
-}
-static WCHAR *au (const char *s)
-{
- WCHAR *d;
- int len = MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, s, -1, NULL, 0);
- if (!len)
- return xcalloc (2, 1);
- d = xmalloc ((len + 1) * sizeof (WCHAR));
- MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, s, -1, d, len);
- return d;
-}
-
-static const char *getmsg (int msg)
+static const TCHAR *getmsg (int msg)
{
switch (msg)
{
- case RPIPCGM_REGISTER: return "RPIPCGM_REGISTER";
- case RPIPCGM_FEATURES: return "RPIPCGM_FEATURES";
- case RPIPCGM_CLOSED: return "RPIPCGM_CLOSED";
- case RPIPCGM_CLOSE: return "RPIPCGM_CLOSE";
- case RPIPCGM_ACTIVATED: return "RPIPCGM_ACTIVATED";
- case RPIPCGM_DEACTIVATED: return "RPIPCGM_DEACTIVATED";
- case RPIPCGM_PARENT: return "RPIPCGM_PARENT";
- case RPIPCGM_SCREENMODE: return "RPIPCGM_SCREENMODE";
- case RPIPCGM_POWERLED: return "RPIPCGM_POWERLED";
- case RPIPCGM_DEVICES: return "RPIPCGM_DEVICES";
- case RPIPCGM_DEVICEACTIVITY: return "RPIPCGM_DEVICEACTIVITY";
- case RPIPCGM_MOUSECAPTURE: return "RPIPCGM_MOUSECAPTURE";
- case RPIPCGM_HOSTAPIVERSION: return "RPIPCGM_HOSTAPIVERSION";
- case RPIPCGM_PAUSE: return "RPIPCGM_PAUSE";
- case RPIPCGM_TURBO: return "RPIPCGM_TURBO";
- case RPIPCGM_VOLUME: return "RPIPCGM_VOLUME";
- case RPIPCGM_DEVICECONTENT: return "RPIPCGM_DEVICECONTENT";
- case RPIPCGM_DEVICESEEK: return "RPIPCGM_DEVICESEEK";
- case RPIPCGM_ESCAPED: return "RPIPCGM_ESCAPED";
-
- case RPIPCHM_CLOSE: return "RPIPCHM_CLOSE";
- case RPIPCHM_SCREENMODE: return "RPIPCHM_SCREENMODE";
- case RPIPCHM_SCREENCAPTURE: return "RPIPCHM_SCREENCAPTURE";
- case RPIPCHM_PAUSE: return "RPIPCHM_PAUSE";
- case RPIPCHM_RESET: return "RPIPCHM_RESET";
- case RPIPCHM_TURBO: return "RPIPCHM_TURBO";
- case RPIPCHM_VOLUME: return "RPIPCHM_VOLUME";
- case RPIPCHM_EVENT: return "RPIPCHM_EVENT";
- case RPIPCHM_ESCAPEKEY: return "RPIPCHM_ESCAPEKEY";
- case RPIPCHM_MOUSECAPTURE: return "RPIPCHM_MOUSECAPTURE";
- case RPIPCHM_DEVICECONTENT: return "RPIPCHM_DEVICECONTENT";
- case RPIPCHM_PING: return "RPIPCHM_PING";
- case RPIPCHM_SAVESTATE: return "RPIPCHM_SAVESTATE";
- case RPIPCHM_LOADSTATE: return "RPIPCHM_LOADSTATE";
-
- default: return "UNKNOWN";
+ case RPIPCGM_REGISTER: return L"RPIPCGM_REGISTER";
+ case RPIPCGM_FEATURES: return L"RPIPCGM_FEATURES";
+ case RPIPCGM_CLOSED: return L"RPIPCGM_CLOSED";
+ case RPIPCGM_CLOSE: return L"RPIPCGM_CLOSE";
+ case RPIPCGM_ACTIVATED: return L"RPIPCGM_ACTIVATED";
+ case RPIPCGM_DEACTIVATED: return L"RPIPCGM_DEACTIVATED";
+ case RPIPCGM_PARENT: return L"RPIPCGM_PARENT";
+ case RPIPCGM_SCREENMODE: return L"RPIPCGM_SCREENMODE";
+ case RPIPCGM_POWERLED: return L"RPIPCGM_POWERLED";
+ case RPIPCGM_DEVICES: return L"RPIPCGM_DEVICES";
+ case RPIPCGM_DEVICEACTIVITY: return L"RPIPCGM_DEVICEACTIVITY";
+ case RPIPCGM_MOUSECAPTURE: return L"RPIPCGM_MOUSECAPTURE";
+ case RPIPCGM_HOSTAPIVERSION: return L"RPIPCGM_HOSTAPIVERSION";
+ case RPIPCGM_PAUSE: return L"RPIPCGM_PAUSE";
+ case RPIPCGM_TURBO: return L"RPIPCGM_TURBO";
+ case RPIPCGM_VOLUME: return L"RPIPCGM_VOLUME";
+ case RPIPCGM_DEVICECONTENT: return L"RPIPCGM_DEVICECONTENT";
+ case RPIPCGM_DEVICESEEK: return L"RPIPCGM_DEVICESEEK";
+ case RPIPCGM_ESCAPED: return L"RPIPCGM_ESCAPED";
+
+ case RPIPCHM_CLOSE: return L"RPIPCHM_CLOSE";
+ case RPIPCHM_SCREENMODE: return L"RPIPCHM_SCREENMODE";
+ case RPIPCHM_SCREENCAPTURE: return L"RPIPCHM_SCREENCAPTURE";
+ case RPIPCHM_PAUSE: return L"RPIPCHM_PAUSE";
+ case RPIPCHM_RESET: return L"RPIPCHM_RESET";
+ case RPIPCHM_TURBO: return L"RPIPCHM_TURBO";
+ case RPIPCHM_VOLUME: return L"RPIPCHM_VOLUME";
+ case RPIPCHM_EVENT: return L"RPIPCHM_EVENT";
+ case RPIPCHM_ESCAPEKEY: return L"RPIPCHM_ESCAPEKEY";
+ case RPIPCHM_MOUSECAPTURE: return L"RPIPCHM_MOUSECAPTURE";
+ case RPIPCHM_DEVICECONTENT: return L"RPIPCHM_DEVICECONTENT";
+ case RPIPCHM_PING: return L"RPIPCHM_PING";
+ case RPIPCHM_SAVESTATE: return L"RPIPCHM_SAVESTATE";
+ case RPIPCHM_LOADSTATE: return L"RPIPCHM_LOADSTATE";
+
+ default: return L"UNKNOWN";
}
}
-static void trimws (char *s)
+static void trimws (TCHAR *s)
{
/* Delete trailing whitespace. */
- int len = strlen (s);
- while (len > 0 && strcspn (s + len - 1, "\t \r\n") == 0)
+ int len = _tcslen (s);
+ while (len > 0 && _tcscspn (s + len - 1, L"\t \r\n") == 0)
s[--len] = '\0';
}
-static int port_insert2 (int num, const char *name)
+static int port_insert2 (int num, const TCHAR *name)
{
- char tmp2[1000];
+ TCHAR tmp2[1000];
int i, type;
type = 1;
- strcpy (tmp2, name);
+ _tcscpy (tmp2, name);
for (i = 1; i <= 4; i++) {
- char tmp1[1000];
- sprintf (tmp1, "Mouse%d", i);
- if (!strcmp (name, tmp1)) {
- sprintf (tmp2, "mouse%d", i - 1);
+ TCHAR tmp1[1000];
+ _stprintf (tmp1, L"Mouse%d", i);
+ if (!_tcscmp (name, tmp1)) {
+ _stprintf (tmp2, L"mouse%d", i - 1);
type = 0;
break;
}
- sprintf (tmp1, "Joystick%d", i);
- if (!strcmp (name, tmp1)) {
+ _stprintf (tmp1, L"Joystick%d", i);
+ if (!_tcscmp (name, tmp1)) {
if (i - 1 == JSEM_XARCADE1LAYOUT)
- sprintf (tmp2, "kbd%d", JSEM_XARCADE1LAYOUT);
+ _stprintf (tmp2, L"kbd%d", JSEM_XARCADE1LAYOUT);
else if (i - 1 == JSEM_XARCADE2LAYOUT)
- sprintf (tmp2, "kbd%d", JSEM_XARCADE2LAYOUT);
+ _stprintf (tmp2, L"kbd%d", JSEM_XARCADE2LAYOUT);
else
- sprintf (tmp2, "joy%d", i - 1);
+ _stprintf (tmp2, L"joy%d", i - 1);
type = 0;
break;
}
- sprintf (tmp1, "KeyboardLayout%d", i);
- if (!strcmp (name, tmp1)) {
- sprintf (tmp2, "kbd%d", i);
+ _stprintf (tmp1, L"KeyboardLayout%d", i);
+ if (!_tcscmp (name, tmp1)) {
+ _stprintf (tmp2, L"kbd%d", i);
type = 0;
break;
}
return inputdevice_joyport_config (&changed_prefs, tmp2, num, type);
}
-static int port_insert (int num, const char *name)
+static int port_insert (int num, const TCHAR *name)
{
- char tmp1[1000];
+ TCHAR tmp1[1000];
if (num < 0 || num > 1)
return FALSE;
- if (strlen (name) == 0) {
- inputdevice_joyport_config (&changed_prefs, "none", num, 0);
+ if (_tcslen (name) == 0) {
+ inputdevice_joyport_config (&changed_prefs, L"none", num, 0);
return TRUE;
}
- if (strlen (name) >= sizeof (tmp1) - 1)
+ if (_tcslen (name) >= sizeof (tmp1) / sizeof (TCHAR) - 1)
return FALSE;
- strcpy (tmp1, name);
+ _tcscpy (tmp1, name);
for (;;) {
- char *p = strrchr (tmp1, '\\');
+ TCHAR *p = _tcsrchr (tmp1, '\\');
if (p) {
int v = port_insert2 (num, p + 1);
if (v)
int dolog = log_rp;
if (!pInfo) {
- write_log ("RPPOST: pInfo == NULL!\n");
+ write_log (L"RPPOST: pInfo == NULL!\n");
return FALSE;
}
if (uMessage == RPIPCGM_DEVICESEEK || uMessage == RPIPCGM_DEVICEACTIVITY)
cnt++;
ncnt = cnt;
if (dolog)
- write_log ("RPPOST_%d->\n", ncnt);
+ write_log (L"RPPOST_%d->\n", ncnt);
v = RPPostMessage (uMessage, wParam, lParam, pInfo);
recursive--;
if (dolog) {
- write_log ("RPPOST_%d(%s [%d], %08x, %08x)\n", ncnt,
+ write_log (L"RPPOST_%d(%s [%d], %08x, %08x)\n", ncnt,
getmsg (uMessage), uMessage - WM_APP, wParam, lParam);
if (v == FALSE)
- write_log("ERROR %d\n", GetLastError ());
+ write_log (L"ERROR %d\n", GetLastError ());
}
return v;
}
int dolog = log_rp;
if (!pInfo) {
- write_log ("RPSEND: pInfo == NULL!\n");
+ write_log (L"RPSEND: pInfo == NULL!\n");
return FALSE;
}
if (!pInfo->hHostMessageWindow) {
- write_log ("RPSEND: pInfo->hHostMessageWindow == NULL!\n");
+ write_log (L"RPSEND: pInfo->hHostMessageWindow == NULL!\n");
return FALSE;
}
if (uMessage == RPIPCGM_DEVICESEEK)
cnt++;
ncnt = cnt;
if (dolog)
- write_log ("RPSEND_%d->\n", ncnt);
+ write_log (L"RPSEND_%d->\n", ncnt);
v = RPSendMessage (uMessage, wParam, lParam, pData, dwDataSize, pInfo, plResult);
recursive--;
if (dolog) {
- write_log ("RPSEND_%d(%s [%d], %08x, %08x, %08x, %d)\n", ncnt,
+ write_log (L"RPSEND_%d(%s [%d], %08x, %08x, %08x, %d)\n", ncnt,
getmsg (uMessage), uMessage - WM_APP, wParam, lParam, pData, dwDataSize);
if (v == FALSE)
- write_log("ERROR %d\n", GetLastError ());
+ write_log (L"ERROR %d\n", GetLastError ());
}
return v;
}
vres = max_vert_dbl;
if (log_rp)
- write_log ("GET_RPSM: hres=%d (%d) vres=%d (%d) full=%d xcpos=%d ycpos=%d w=%d h=%d\n",
+ write_log (L"GET_RPSM: hres=%d (%d) vres=%d (%d) full=%d xcpos=%d ycpos=%d w=%d h=%d\n",
totalhdbl, hres, totalvdbl, vres, full,
p->gfx_xcenter_pos, p->gfx_ycenter_pos,
p->gfx_size_win.width, p->gfx_size_win.height);
sm->dwScreenMode = m;
if (log_rp)
- write_log ("GET_RPSM: %08X %dx%d %dx%d hres=%d (%d) vres=%d (%d) disp=%d fs=%d\n",
+ write_log (L"GET_RPSM: %08X %dx%d %dx%d hres=%d (%d) vres=%d (%d) disp=%d fs=%d\n",
sm->dwScreenMode, sm->lClipLeft, sm->lClipTop, sm->lClipWidth, sm->lClipHeight,
totalhdbl, hres, totalvdbl, vres, p->gfx_display, full);
}
disp = getdisplay (p);
if (log_rp)
- write_log ("SET_RPSM: %08X %dx%d %dx%d hres=%d vres=%d disp=%d fs=%d\n",
+ write_log (L"SET_RPSM: %08X %dx%d %dx%d hres=%d vres=%d disp=%d fs=%d\n",
sm->dwScreenMode, sm->lClipLeft, sm->lClipTop, sm->lClipWidth, sm->lClipHeight,
hdbl, vdbl, display, fs);
p->gfx_filter_horiz_zoom_mult = 1000;
p->gfx_filter_vert_zoom_mult = 1000;
if (log_rp)
- write_log ("WW=%d WH=%d FW=%d FH=%d\n",
+ write_log (L"WW=%d WH=%d FW=%d FH=%d\n",
p->gfx_size_win.width, p->gfx_size_win.height,
p->gfx_size_fs.width, p->gfx_size_fs.height);
if (fs) {
LPCVOID pData, DWORD dwDataSize, LPARAM lMsgFunctionParam)
{
if (log_rp)
- write_log ("RPFUNC(%s [%d], %08x, %08x, %08x, %d, %08x)\n",
+ write_log (L"RPFUNC(%s [%d], %08x, %08x, %08x, %d, %08x)\n",
getmsg (uMessage), uMessage - WM_APP, wParam, lParam, pData, dwDataSize, lMsgFunctionParam);
switch (uMessage)
{
default:
- write_log ("RP: Unknown or unsupported command %x\n", uMessage);
+ write_log (L"RP: Unknown or unsupported command %x\n", uMessage);
break;
case RPIPCHM_PING:
return TRUE;
case RPIPCHM_DEVICECONTENT:
{
struct RPDeviceContent *dc = (struct RPDeviceContent*)pData;
- char *n = ua (dc->szContent);
+ TCHAR *n = dc->szContent;
int num = dc->btDeviceNumber;
int ok = FALSE;
switch (dc->btDeviceCategory)
}
case RPIPCHM_EVENT:
{
- char out[256];
- char *s = ua ((WCHAR*)pData);
+ TCHAR out[256];
+ TCHAR *s = (WCHAR*)pData;
int idx = -1;
for (;;) {
int ret;
out[0] = 0;
- ret = cfgfile_modify (idx++, s, strlen (s), out, sizeof out);
+ ret = cfgfile_modify (idx++, s, _tcslen (s), out, sizeof out / sizeof (TCHAR));
if (ret >= 0)
break;
}
- xfree (s);
return TRUE;
}
case RPIPCHM_SCREENCAPTURE:
{
- extern int screenshotf (const char *spath, int mode, int doprepare);
+ extern int screenshotf (const TCHAR *spath, int mode, int doprepare);
extern int screenshotmode;
int ok;
int ossm = screenshotmode;
- char *s = ua ((WCHAR*)pData);
+ TCHAR *s = (TCHAR*)pData;
screenshotmode = 0;
ok = screenshotf (s, 1, 1);
screenshotmode = ossm;
- xfree (s);
return ok ? TRUE : FALSE;
}
case RPIPCHM_SAVESTATE:
{
- char *s = ua ((WCHAR*)pData);
+ TCHAR *s = (TCHAR*)pData;
DWORD ret = FALSE;
if (s == NULL) {
savestate_initsave (NULL, 0, TRUE);
return 1;
}
if (vpos == 0) {
- savestate_initsave ("", 1, TRUE);
- save_state (s, "AF2008");
+ savestate_initsave (L"", 1, TRUE);
+ save_state (s, L"AF2008");
ret = 1;
} else {
//savestate_initsave (s, 1, TRUE);
//ret = -1;
}
- xfree (s);
return ret;
}
case RPIPCHM_LOADSTATE:
{
- char *s = ua ((WCHAR*)pData);
+ TCHAR *s = (WCHAR*)pData;
DWORD ret = FALSE;
DWORD attr = GetFileAttributes (s);
if (attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY)) {
savestate_state = STATE_DORESTORE;
- strcpy (savestate_fname, s);
+ _tcscpy (savestate_fname, s);
ret = -1;
}
- xfree (s);
return ret;
}
}
hr = RPInitializeGuest(&guestinfo, hInst, rp_param, RPHostMsgFunction, 0);
if (SUCCEEDED (hr)) {
initialized = TRUE;
- write_log ("rp_init('%s') succeeded\n", rp_param);
+ write_log (L"rp_init('%s') succeeded\n", rp_param);
} else {
- write_log ("rp_init('%s') failed, error code %08x\n", rp_param, hr);
+ write_log (L"rp_init('%s') failed, error code %08x\n", rp_param, hr);
}
xfree (rp_param);
rp_param = NULL;
if (!initialized)
return;
- write_log ("rp_fixup_options(escapekey=%d,escapeholdtime=%d,screenmode=%d,inputmode=%d)\n",
+ write_log (L"rp_fixup_options(escapekey=%d,escapeholdtime=%d,screenmode=%d,inputmode=%d)\n",
rp_rpescapekey, rp_rpescapeholdtime, rp_screenmode, rp_inputmode);
- write_log ("w=%dx%d fs=%dx%d\n",
+ write_log (L"w=%dx%d fs=%dx%d\n",
p->gfx_size_win.width, p->gfx_size_win.height,
p->gfx_size_fs.width, p->gfx_size_fs.height);
rp_update_leds (i, 0, 0);
}
-static void rp_device_change (int dev, int num, const char *name)
+static void rp_device_change (int dev, int num, const TCHAR *name)
{
struct RPDeviceContent *dc;
int dc_size;
- char np[MAX_DPATH];
+ TCHAR np[MAX_DPATH];
if (!cando ())
return;
return;
np[0] = 0;
if (name != NULL)
- strcpy (np, name);
- dc_size = sizeof (struct RPDeviceContent) + (strlen (np) + 1) * sizeof (WCHAR);
+ _tcscpy (np, name);
+ dc_size = sizeof (struct RPDeviceContent) + (_tcslen (np) + 1) * sizeof (TCHAR);
dc = xcalloc (dc_size, 1);
dc->btDeviceCategory = dev;
dc->btDeviceNumber = num;
- wcscpy (dc->szContent, au (np));
+ _tcscpy (dc->szContent, np);
RPSendMessagex (RPIPCGM_DEVICECONTENT, 0, 0, dc, dc_size, &guestinfo, NULL);
xfree (dc);
}
int j = jsem_isjoy (num, &currprefs);
int m = jsem_ismouse (num, &currprefs);
int k = jsem_iskbdjoy (num, &currprefs);
- char name[MAX_DPATH];
- char *name2 = NULL, *name3 = NULL;
+ TCHAR name[MAX_DPATH];
+ TCHAR *name2 = NULL, *name3 = NULL;
if (JSEM_ISXARCADE1 (num, &currprefs)) {
j = 2;
if (j >= 0) {
name2 = inputdevice_get_device_name (IDTYPE_JOYSTICK, j);
name3 = inputdevice_get_device_unique_name (IDTYPE_JOYSTICK, j);
- sprintf (name, "Joystick%d", j + 1);
+ _stprintf (name, L"Joystick%d", j + 1);
} else if (m >= 0) {
name2 = inputdevice_get_device_name (IDTYPE_MOUSE, m);
name3 = inputdevice_get_device_unique_name (IDTYPE_MOUSE, m);
- sprintf (name, "Mouse%d", m + 1);
+ _stprintf (name, L"Mouse%d", m + 1);
} else if (k >= 0) {
- sprintf (name, "KeyboardLayout%d", k + 1);
+ _stprintf (name, L"KeyboardLayout%d", k + 1);
}
if (name3) {
- strcat (name, "\\");
- strcat (name, name3);
+ _tcscat (name, L"\\");
+ _tcscat (name, name3);
if (name2) {
- strcat (name, "\\");
- strcat (name, name2);
+ _tcscat (name, L"\\");
+ _tcscat (name, name2);
}
}
rp_device_change (RP_DEVICE_INPUTPORT, num, name);
}
-void rp_disk_image_change (int num, const char *name)
+void rp_disk_image_change (int num, const TCHAR *name)
{
rp_device_change (RP_DEVICE_FLOPPY, num, name);
}
-void rp_harddrive_image_change (int num, const char *name)
+void rp_harddrive_image_change (int num, const TCHAR *name)
{
rp_device_change (RP_DEVICE_HD, num, name);
}
extern HWND rp_getparent (void);
extern void rp_rtg_switch (void);
-extern char *rp_param;
+extern TCHAR *rp_param;
extern int rp_rpescapekey;
extern int rp_rpescapeholdtime;
extern int rp_screenmode;
extern int log_rp;
extern void rp_input_change (int num);
-extern void rp_disk_image_change (int num, const char *name);
-extern void rp_harddrive_image_change (int num, const char *name);
+extern void rp_disk_image_change (int num, const TCHAR *name);
+extern void rp_harddrive_image_change (int num, const TCHAR *name);
int screenshotmode = PNG_SCREENSHOTS;
-static void namesplit (char *s)
+static void namesplit (TCHAR *s)
{
int l;
- l = strlen (s) - 1;
+ l = _tcslen (s) - 1;
while (l >= 0) {
if (s[l] == '.')
s[l] = 0;
l--;
}
if (l > 0)
- memmove (s, s + l, strlen (s + l) + 1);
+ memmove (s, s + l, (_tcslen (s + l) + 1) * sizeof (TCHAR));
}
static int toclipboard (BITMAPINFO *bi, void *bmp)
#if PNG_SCREENSHOTS > 0
-static void pngtest_blah(png_structp png_ptr, png_const_charp message)
+static void pngtest_blah (png_structp png_ptr, png_const_charp message)
{
- char *name = "unknown";
+ TCHAR *name = L"unknown";
if (png_ptr != NULL && png_ptr->error_ptr != NULL)
name = png_ptr->error_ptr;
- write_log ("%s: libpng warning: %s\n", name, message);
+ write_log (L"%s: libpng warning: %s\n", name, message);
}
static int savepng(FILE *fp)
png_set_IHDR (png_ptr, info_ptr,
w, h, 8, PNG_COLOR_TYPE_RGB,
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
- row_pointers = xmalloc (h * sizeof(png_bytep*));
+ row_pointers = xmalloc (h * sizeof (png_bytep*));
for (i = 0; i < h; i++) {
int j = h - i - 1;
row_pointers[i] = (uae_u8*)lpvBits + j * 3 * ((w + 3) & ~3);
BITMAPFILEHEADER bfh;
// write the file header, bitmap information and pixel data
bfh.bfType = 19778;
- bfh.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + bi.bmiHeader.biSizeImage;
+ bfh.bfSize = sizeof (BITMAPFILEHEADER) + sizeof (BITMAPINFOHEADER) + bi.bmiHeader.biSizeImage;
bfh.bfReserved1 = 0;
bfh.bfReserved2 = 0;
- bfh.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
- if (fwrite (&bfh, 1, sizeof(BITMAPFILEHEADER), fp) < sizeof(BITMAPFILEHEADER))
+ bfh.bfOffBits = sizeof (BITMAPFILEHEADER) + sizeof (BITMAPINFOHEADER);
+ if (fwrite (&bfh, 1, sizeof (BITMAPFILEHEADER), fp) < sizeof (BITMAPFILEHEADER))
return 0; // failed to write bitmap file header
- if (fwrite (&bi, 1, sizeof(BITMAPINFOHEADER), fp) < sizeof(BITMAPINFOHEADER))
+ if (fwrite (&bi, 1, sizeof (BITMAPINFOHEADER), fp) < sizeof (BITMAPINFOHEADER))
return 0; // failed to write bitmap infomation header
if (fwrite (lpvBits, 1, bi.bmiHeader.biSizeImage, fp) < bi.bmiHeader.biSizeImage)
return 0; // failed to write the bitmap
/*
Captures the Amiga display (DirectDraw, D3D or OpenGL) surface and saves it to file as a 24bit bitmap.
*/
-int screenshotf (const char *spath, int mode, int doprepare)
+int screenshotf (const TCHAR *spath, int mode, int doprepare)
{
static int recursive;
FILE *fp = NULL;
if (mode == 0) {
toclipboard (&bi, lpvBits);
} else {
- char filename[MAX_DPATH];
- char path[MAX_DPATH];
- char name[MAX_DPATH];
- char underline[] = "_";
+ TCHAR filename[MAX_DPATH];
+ TCHAR path[MAX_DPATH];
+ TCHAR name[MAX_DPATH];
+ TCHAR underline[] = L"_";
int number = 0;
if (spath) {
- fp = fopen (spath, "wb");
+ fp = _tfopen (spath, L"wb");
if (fp) {
#if PNG_SCREENSHOTS > 0
if (screenshotmode)
goto oops;
}
}
- fetch_path ("ScreenshotPath", path, sizeof (path));
+ fetch_path (L"ScreenshotPath", path, sizeof (path) / sizeof (TCHAR));
CreateDirectory (path, NULL);
name[0] = 0;
if (currprefs.dfxtype[0] >= 0)
- strcpy (name, currprefs.df[0]);
+ _tcscpy (name, currprefs.df[0]);
if (!name[0])
underline[0] = 0;
namesplit (name);
while(++number < 1000) // limit 999 iterations / screenshots
{
- sprintf (filename, "%s%s%s%03d.%s", path, name, underline, number, screenshotmode ? "png" : "bmp");
- if ((fp = fopen (filename, "rb")) == NULL) // does file not exist?
+ _stprintf (filename, L"%s%s%s%03d.%s", path, name, underline, number, screenshotmode ? L"png" : L"bmp");
+ if ((fp = _tfopen (filename, L"rb")) == NULL) // does file not exist?
{
int ok = 0;
- if ((fp = fopen (filename, "wb")) == NULL)
+ if ((fp = _tfopen (filename, L"wb")) == NULL)
goto oops; // error
#if PNG_SCREENSHOTS > 0
if (screenshotmode)
fp = NULL;
if (!ok)
goto oops;
- write_log ("Screenshot saved as \"%s\"\n", filename);
+ write_log (L"Screenshot saved as \"%s\"\n", filename);
allok = 1;
break;
}
serial_period_hsyncs = 1;
serial_period_hsync_counter = 0;
- write_log ("SERIAL: period=%d, baud=%d, hsyncs=%d, bits=%d, PC=%x\n", w, baud, serial_period_hsyncs, ninebit ? 9 : 8, M68K_GETPC);
+ write_log (L"SERIAL: period=%d, baud=%d, hsyncs=%d, bits=%d, PC=%x\n", w, baud, serial_period_hsyncs, ninebit ? 9 : 8, M68K_GETPC);
if (ninebit)
baud *= 2;
#endif
}
-static char dochar (int v)
+static uae_char dochar (int v)
{
v &= 0xff;
if (v >= 32 && v < 127) return (char)v;
ovrun = 1;
INTREQ_f (0x8000 | 0x0800);
while (readser (&recdata));
- write_log ("SERIAL: overrun\n");
+ write_log (L"SERIAL: overrun\n");
}
return;
}
} else {
ninebitdata = recdata;
if ((ninebitdata & ~1) != 0xa8) {
- write_log ("SERIAL: 9-bit serial emulation sync lost, %02X != %02X\n", ninebitdata & ~1, 0xa8);
+ write_log (L"SERIAL: 9-bit serial emulation sync lost, %02X != %02X\n", ninebitdata & ~1, 0xa8);
ninebitdata = 0;
return;
}
data_in_serdatr = 1;
serial_check_irq ();
#if SERIALDEBUG > 2
- write_log ("SERIAL: received %02X (%c)\n", serdatr & 0xff, dochar (serdatr));
+ write_log (L"SERIAL: received %02X (%c)\n", serdatr & 0xff, doTCHAR (serdatr));
#endif
#endif
}
data_in_serdat = 0;
INTREQ_f (0x8000 | 0x0001);
#if SERIALDEBUG > 2
- write_log ("SERIAL: send %04X (%c)\n", serdatshift, dochar (serdatshift));
+ write_log (L"SERIAL: send %04X (%c)\n", serdatshift, doTCHAR (serdatshift));
#endif
}
}
if (!(w & 0x3ff)) {
#if SERIALDEBUG > 1
- write_log ("SERIAL: zero serial word written?! PC=%x\n", M68K_GETPC);
+ write_log (L"SERIAL: zero serial word written?! PC=%x\n", M68K_GETPC);
#endif
return;
}
#if SERIALDEBUG > 1
if (data_in_serdat) {
- write_log ("SERIAL: program wrote to SERDAT but old byte wasn't fetched yet\n");
+ write_log (L"SERIAL: program wrote to SERDAT but old byte wasn't fetched yet\n");
}
#endif
if (seriallog)
- console_out_f ("%c", dochar (w));
+ console_out_f (L"%c", dochar (w));
if (serper == 372) {
extern int enforcermode;
if (enforcermode & 2) {
- console_out_f ("%c", dochar (w));
+ console_out_f (L"%c", dochar (w));
if (w == 266)
- console_out("\n");
+ console_out(L"\n");
}
}
checksend (1);
#if SERIALDEBUG > 2
- write_log ("SERIAL: wrote 0x%04x (%c) PC=%x\n", w, dochar (w), M68K_GETPC);
+ write_log (L"SERIAL: wrote 0x%04x (%c) PC=%x\n", w, doTCHAR (w), M68K_GETPC);
#endif
return;
if (ovrun)
serdatr |= 0x8000;
#if SERIALDEBUG > 2
- write_log ( "SERIAL: read 0x%04x (%c) %x\n", serdatr, dochar (serdatr), M68K_GETPC);
+ write_log ( "SERIAL: read 0x%04x (%c) %x\n", serdatr, doTCHAR (serdatr), M68K_GETPC);
#endif
ovrun = 0;
data_in_serdatr = 0;
static uae_u8 oldserbits;
-static void serial_status_debug (char *s)
+static void serial_status_debug (TCHAR *s)
{
#if SERIALHSDEBUG > 1
- write_log ("%s: DTR=%d RTS=%d CD=%d CTS=%d DSR=%d\n", s,
+ write_log (L"%s: DTR=%d RTS=%d CD=%d CTS=%d DSR=%d\n", s,
(oldserbits & 0x80) ? 0 : 1, (oldserbits & 0x40) ? 0 : 1,
(oldserbits & 0x20) ? 0 : 1, (oldserbits & 0x10) ? 0 : 1, (oldserbits & 0x08) ? 0 : 1);
#endif
oldserbits &= ~(0x08 | 0x10 | 0x20);
oldserbits |= serbits;
- serial_status_debug("read");
+ serial_status_debug (L"read");
return oldserbits;
}
if (newstate & 0x40) {
setserstat (TIOCM_RTS, 0);
#if SERIALHSDEBUG > 0
- write_log ("SERIAL: RTS cleared\n");
+ write_log (L"SERIAL: RTS cleared\n");
#endif
} else {
setserstat (TIOCM_RTS, 1);
#if SERIALHSDEBUG > 0
- write_log ("SERIAL: RTS set\n");
+ write_log (L"SERIAL: RTS set\n");
#endif
}
}
#if 0 /* CIA io-pins can be read even when set to output.. */
if ((newstate & 0x20) != (oldserbits & 0x20) && (dir & 0x20))
- write_log ("SERIAL: warning, program tries to use CD as an output!\n");
+ write_log (L"SERIAL: warning, program tries to use CD as an output!\n");
if ((newstate & 0x10) != (oldserbits & 0x10) && (dir & 0x10))
- write_log ("SERIAL: warning, program tries to use CTS as an output!\n");
+ write_log (L"SERIAL: warning, program tries to use CTS as an output!\n");
if ((newstate & 0x08) != (oldserbits & 0x08) && (dir & 0x08))
- write_log ("SERIAL: warning, program tries to use DSR as an output!\n");
+ write_log (L"SERIAL: warning, program tries to use DSR as an output!\n");
#endif
if (logcnt > 0) {
if (((newstate ^ oldserbits) & 0x40) && !(dir & 0x40)) {
- write_log ("SERIAL: warning, program tries to use RTS as an input! PC=%x\n", M68K_GETPC);
+ write_log (L"SERIAL: warning, program tries to use RTS as an input! PC=%x\n", M68K_GETPC);
logcnt--;
}
if (((newstate ^ oldserbits) & 0x80) && !(dir & 0x80)) {
- write_log ("SERIAL: warning, program tries to use DTR as an input! PC=%x\n", M68K_GETPC);
+ write_log (L"SERIAL: warning, program tries to use DTR as an input! PC=%x\n", M68K_GETPC);
logcnt--;
}
}
oldserbits &= ~(0x80 | 0x40);
newstate &= 0x80 | 0x40;
oldserbits |= newstate;
- serial_status_debug("write");
+ serial_status_debug (L"write");
return oldserbits;
}
if (serdev)
return;
serper = 0;
- if(!openser(currprefs.sername)) {
- write_log ("SERIAL: Could not open device %s\n", currprefs.sername);
+ if(!openser (currprefs.sername)) {
+ write_log (L"SERIAL: Could not open device %s\n", currprefs.sername);
return;
}
serdev = 1;
hr = IDirectSoundBuffer_Lock (lpDSBsecondary, 0, dsoundbuf, &buffer, &size, NULL, NULL, 0);
}
if (FAILED (hr)) {
- write_log ("SOUND: failed to Lock sound buffer (clear): %s\n", DXError (hr));
+ write_log (L"SOUND: failed to Lock sound buffer (clear): %s\n", DXError (hr));
return;
}
memset (buffer, 0, size);
waiting_for_buffer = 0;
hr = IDirectSoundBuffer_Stop (lpDSBsecondary);
if (FAILED (hr))
- write_log ("SOUND: DirectSoundBuffer_Stop failed, %s\n", DXError(hr));
+ write_log (L"SOUND: DirectSoundBuffer_Stop failed, %s\n", DXError(hr));
hr = IDirectSoundBuffer_SetCurrentPosition (lpDSBsecondary, 0);
if (FAILED (hr))
- write_log ("SOUND: DirectSoundBuffer_SetCurretPosition failed, %s\n", DXError (hr));
+ write_log (L"SOUND: DirectSoundBuffer_SetCurretPosition failed, %s\n", DXError (hr));
clearbuffer ();
}
static void resume_audio_ds (void)
{
PaError err = Pa_StopStream (pastream);
if (err != paNoError)
- write_log ("SOUND: Pa_StopStream() error %d (%s)\n", err, Pa_GetErrorText (err));
+ write_log (L"SOUND: Pa_StopStream() error %d (%s)\n", err, Pa_GetErrorText (err));
}
static void resume_audio_pa (void)
{
PaError err = Pa_StartStream (pastream);
if (err != paNoError)
- write_log ("SOUND: Pa_StartStream() error %d (%s)\n", err, Pa_GetErrorText (err));
+ write_log (L"SOUND: Pa_StartStream() error %d (%s)\n", err, Pa_GetErrorText (err));
paused = 0;
}
static void pause_audio_al (void)
if (hr != DSERR_BUFFERLOST)
return 0;
if (sound_debug)
- write_log ("SOUND: sound buffer lost\n");
+ write_log (L"SOUND: sound buffer lost\n");
hr = IDirectSoundBuffer_Restore (lpDSBsecondary);
if (FAILED(hr)) {
- write_log ("SOUND: restore failed %s\n", DXError (hr));
+ write_log (L"SOUND: restore failed %s\n", DXError (hr));
return 1;
}
pause_audio_ds ();
#endif
if (lpDS) {
IDirectSound_Release (lpDS);
- write_log ("SOUND: DirectSound driver freed\n");
+ write_log (L"SOUND: DirectSound driver freed\n");
}
lpDS = 0;
}
vol = (LONG)((DSBVOLUME_MIN / 2) + (-DSBVOLUME_MIN / 2) * log (1 + (2.718281828 - 1) * (1 - volume / 100.0)));
hr = IDirectSoundBuffer_SetVolume (lpDSBsecondary, vol);
if (FAILED (hr))
- write_log ("SOUND: SetVolume(%d) failed: %s\n", vol, DXError (hr));
+ write_log (L"SOUND: SetVolume(%d) failed: %s\n", vol, DXError (hr));
setvolume_ahi (vol);
}
}
break;
}
}
- write_log ("SOUND: sound format not supported\n");
+ write_log (L"SOUND: sound format not supported\n");
goto end;
}
err = Pa_OpenStream (&pastream, NULL, &p, freq, paframesperbuffer, paNoFlag, portAudioCallback, NULL);
if (err != paNoError) {
- write_log ("SOUND: Pa_OpenStream() error %d (%s)\n", err, Pa_GetErrorText (err));
+ write_log (L"SOUND: Pa_OpenStream() error %d (%s)\n", err, Pa_GetErrorText (err));
goto end;
}
paevent = CreateEvent (NULL, FALSE, FALSE, NULL);
{
int freq = currprefs.sound_freq;
int ch = get_audio_nativechannels ();
+ char *name;
devicetype = SOUND_DEVICE_AL;
size *= ch * 2;
sndbufsize = SND_MAX_BUFFER;
al_bufsize = size;
al_bigbuffer = xcalloc (al_bufsize, 1);
- al_dev = alcOpenDevice (sound_devices[currprefs.win32_soundcard].alname);
+ name = ua (sound_devices[currprefs.win32_soundcard].alname);
+ al_dev = alcOpenDevice (name);
+ xfree (name);
if (!al_dev)
goto error;
al_ctx = alcCreateContext (al_dev, NULL);
if (al_format == 0)
goto error;
- write_log ("SOUND: %08X,CH=%d,FREQ=%d '%s' buffer %d (%d)\n",
+ write_log (L"SOUND: %08X,CH=%d,FREQ=%d '%s' buffer %d (%d)\n",
al_format, ch, freq, sound_devices[currprefs.win32_soundcard].alname,
sndbufsize, al_bufsize);
return 1;
hr = DirectSoundCreate8 (&sound_devices[currprefs.win32_soundcard].guid, &lpDS, NULL);
if (FAILED (hr)) {
- write_log ("SOUND: DirectSoundCreate8() failure: %s\n", DXError (hr));
+ write_log (L"SOUND: DirectSoundCreate8() failure: %s\n", DXError (hr));
return 0;
}
hr = IDirectSound_SetCooperativeLevel (lpDS, hMainWnd, DSSCL_PRIORITY);
if (FAILED (hr)) {
- write_log ("SOUND: Can't set cooperativelevel: %s\n", DXError (hr));
+ write_log (L"SOUND: Can't set cooperativelevel: %s\n", DXError (hr));
goto error;
}
DSCaps.dwSize = sizeof (DSCaps);
hr = IDirectSound_GetCaps (lpDS, &DSCaps);
if (FAILED(hr)) {
- write_log ("SOUND: Error getting DirectSound capabilities: %s\n", DXError (hr));
+ write_log (L"SOUND: Error getting DirectSound capabilities: %s\n", DXError (hr));
goto error;
}
if (DSCaps.dwFlags & DSCAPS_EMULDRIVER) {
- write_log ("SOUND: Emulated DirectSound driver detected, don't complain if sound quality is crap :)\n");
+ write_log (L"SOUND: Emulated DirectSound driver detected, don't complain if sound quality is crap :)\n");
}
if (DSCaps.dwFlags & DSCAPS_CONTINUOUSRATE) {
int minfreq = DSCaps.dwMinSecondarySampleRate;
if (minfreq > freq && freq < 22050) {
freq = minfreq;
changed_prefs.sound_freq = currprefs.sound_freq = freq;
- write_log ("SOUND: minimum supported frequency: %d\n", minfreq);
+ write_log (L"SOUND: minimum supported frequency: %d\n", minfreq);
}
if (maxfreq < freq && freq > 44100) {
freq = maxfreq;
changed_prefs.sound_freq = currprefs.sound_freq = freq;
- write_log ("SOUND: maximum supported frequency: %d\n", maxfreq);
+ write_log (L"SOUND: maximum supported frequency: %d\n", maxfreq);
}
}
speakerconfig = fillsupportedmodes (lpDS, freq, supportedmodes);
- write_log ("SOUND: %08X ", speakerconfig);
+ write_log (L"SOUND: %08X ", speakerconfig);
for (i = 0; supportedmodes[i].ch; i++)
- write_log ("%d:%08X ", supportedmodes[i].ch, supportedmodes[i].ksmode);
- write_log ("\n");
+ write_log (L"%d:%08X ", supportedmodes[i].ch, supportedmodes[i].ksmode);
+ write_log (L"\n");
for (round = 0; supportedmodes[round].ch; round++) {
DWORD ksmode = 0;
wavfmt.Format.nAvgBytesPerSec = wavfmt.Format.nBlockAlign * wavfmt.Format.nSamplesPerSec;
samplesize = ch * 2;
- write_log ("SOUND: %08X,CH=%d,FREQ=%d '%s' buffer %d (%d), dist %d\n",
+ write_log (L"SOUND: %08X,CH=%d,FREQ=%d '%s' buffer %d (%d), dist %d\n",
ksmode, ch, freq, sound_devices[currprefs.win32_soundcard].name,
max_sndbufsize / samplesize, max_sndbufsize, snd_configsize / samplesize);
sound_buffer.dwFlags |= DSBCAPS_LOCSOFTWARE;
hr = IDirectSound_CreateSoundBuffer (lpDS, &sound_buffer, &pdsb, NULL);
if (SUCCEEDED(hr)) {
- //write_log ("SOUND: Couldn't use hardware buffer (switched to software): %s\n", DXError (hr2));
+ //write_log (L"SOUND: Couldn't use hardware buffer (switched to software): %s\n", DXError (hr2));
break;
}
}
- write_log ("SOUND: Secondary CreateSoundBuffer() failure: %s\n", DXError (hr));
+ write_log (L"SOUND: Secondary CreateSoundBuffer() failure: %s\n", DXError (hr));
}
if (pdsb == NULL)
goto error;
hr = IDirectSound_QueryInterface (pdsb, &IID_IDirectSoundBuffer8, (LPVOID*)&lpDSBsecondary);
if (FAILED (hr)) {
- write_log ("SOUND: Secondary QueryInterface() failure: %s\n", DXError (hr));
+ write_log (L"SOUND: Secondary QueryInterface() failure: %s\n", DXError (hr));
goto error;
}
IDirectSound_Release (pdsb);
return;
hr = IDirectSoundBuffer_GetCurrentPosition (lpDSBsecondary, &playpos, &safed);
if (FAILED (hr)) {
- write_log ("SOUND: DirectSoundBuffer_GetCurrentPosition failed, %s\n", DXError (hr));
+ write_log (L"SOUND: DirectSoundBuffer_GetCurrentPosition failed, %s\n", DXError (hr));
return;
}
writepos = safed + snd_writeoffset;
alGetSourcei (al_Source, AL_BUFFERS_PROCESSED, &v1);
alGetSourcei (al_Source, AL_BUFFERS_QUEUED, &v2);
alGetSourcei (al_Source, AL_SOURCE_STATE, &v3);
- write_log ("OpenAL %d: error %d. PROC=%d QUEUE=%d STATE=%d\n", v, err, v1, v2, v3);
- write_log (" %d %08x %08x %08x %d %d\n",
+ write_log (L"OpenAL %d: error %d. PROC=%d QUEUE=%d STATE=%d\n", v, err, v1, v2, v3);
+ write_log (L" %d %08x %08x %08x %d %d\n",
al_toggle, al_Buffers[al_toggle], al_format, al_bigbuffer, al_bufsize, currprefs.sound_freq);
return 1;
}
alSourceUnqueueBuffers (al_Source, 1, &tmp);
alGetError ();
-// write_log (" %d %08x %08x %08x %d %d\n",
+// write_log (L" %d %08x %08x %08x %d %d\n",
// al_toggle, al_Buffers[al_toggle], al_format, al_bigbuffer, al_bufsize, currprefs.sound_freq);
alBufferData (al_Buffers[al_toggle], al_format, al_bigbuffer, al_bufsize, currprefs.sound_freq);
alcheck(3);
if (v != AL_PLAYING && v2 >= AL_BUFFERS) {
if (waiting_for_buffer > 0) {
- write_log ("AL SOUND PLAY!\n");
+ write_log (L"AL SOUND PLAY!\n");
alSourcePlay (al_Source);
waiting_for_buffer = -1;
tfprev = timeframes + 10;
} else {
gui_data.sndbuf_status = 2;
statuscnt = SND_STATUSCNT;
- write_log ("AL underflow\n");
+ write_log (L"AL underflow\n");
clearbuffer ();
waiting_for_buffer = 1;
}
}
if (tfprev != timeframes) {
if ((0 || sound_debug) && !(tfprev % 10))
- write_log ("s=%+02.1f\n", skipmode);
+ write_log (L"s=%+02.1f\n", skipmode);
tfprev = timeframes;
if (!avioutput_audio)
sound_setadjust (skipmode);
if (waiting_for_buffer == 1) {
hr = IDirectSoundBuffer_Play (lpDSBsecondary, 0, 0, DSBPLAY_LOOPING);
if (FAILED (hr)) {
- write_log ("SOUND: Play failed: %s\n", DXError (hr));
+ write_log (L"SOUND: Play failed: %s\n", DXError (hr));
restore_ds (DSERR_BUFFERLOST);
waiting_for_buffer = 0;
return;
}
hr = IDirectSoundBuffer_SetCurrentPosition (lpDSBsecondary, 0);
if (FAILED (hr)) {
- write_log ("SOUND: 1st SetCurrentPosition failed: %s\n", DXError (hr));
+ write_log (L"SOUND: 1st SetCurrentPosition failed: %s\n", DXError (hr));
restore_ds (DSERR_BUFFERLOST);
waiting_for_buffer = 0;
return;
sleep_millis (1);
counter--;
if (counter < 0) {
- write_log ("SOUND: stuck?!?!\n");
+ write_log (L"SOUND: stuck?!?!\n");
break;
}
}
- write_log ("SOUND: %d = (%d - %d)\n", (safedist - playpos) / samplesize, safedist / samplesize, playpos / samplesize);
+ write_log (L"SOUND: %d = (%d - %d)\n", (safedist - playpos) / samplesize, safedist / samplesize, playpos / samplesize);
recalc_offsets ();
safedist -= playpos;
if (safedist < 64)
#endif
waiting_for_buffer = -1;
restart_sound_buffer ();
- write_log ("SOUND: bs=%d w=%d max=%d tof=%d tuf=%d\n",
+ write_log (L"SOUND: bs=%d w=%d max=%d tof=%d tuf=%d\n",
sndbufsize / samplesize, snd_writeoffset / samplesize,
snd_maxoffset / samplesize, snd_totalmaxoffset_of / samplesize,
snd_totalmaxoffset_uf / samplesize);
counter = 5000;
hr = IDirectSoundBuffer_GetStatus (lpDSBsecondary, &status);
if (FAILED (hr)) {
- write_log ("SOUND: GetStatus() failed: %s\n", DXError (hr));
+ write_log (L"SOUND: GetStatus() failed: %s\n", DXError (hr));
restore_ds (DSERR_BUFFERLOST);
return;
}
if (status & DSBSTATUS_BUFFERLOST) {
- write_log ("SOUND: buffer lost\n");
+ write_log (L"SOUND: buffer lost\n");
restore_ds (DSERR_BUFFERLOST);
return;
}
if ((status & (DSBSTATUS_PLAYING | DSBSTATUS_LOOPING)) != (DSBSTATUS_PLAYING | DSBSTATUS_LOOPING)) {
- write_log ("SOUND: status = %08X\n", status);
+ write_log (L"SOUND: status = %08X\n", status);
restore_ds (DSERR_BUFFERLOST);
return;
}
hr = IDirectSoundBuffer_GetCurrentPosition (lpDSBsecondary, &playpos, &safepos);
if (FAILED (hr)) {
restore_ds (hr);
- write_log ("SOUND: GetCurrentPosition failed: %s\n", DXError (hr));
+ write_log (L"SOUND: GetCurrentPosition failed: %s\n", DXError (hr));
return;
}
if (writepos >= safepos)
statuscnt = SND_STATUSCNT;
restart_sound_buffer ();
diff = snd_writeoffset;
- write_log ("SOUND: underflow (%d %d)\n", diff / samplesize, snd_totalmaxoffset_of / samplesize);
+ write_log (L"SOUND: underflow (%d %d)\n", diff / samplesize, snd_totalmaxoffset_of / samplesize);
break;
}
sleep_millis (1);
counter--;
if (counter < 0) {
- write_log ("SOUND: sound system got stuck!?\n");
+ write_log (L"SOUND: sound system got stuck!?\n");
restore_ds (DSERR_BUFFERLOST);
return;
}
if (restore_ds (hr))
return;
if (FAILED (hr)) {
- write_log ("SOUND: lock failed: %s (%d %d)\n", DXError (hr), writepos / samplesize, sndbufsize / samplesize);
+ write_log (L"SOUND: lock failed: %s (%d %d)\n", DXError (hr), writepos / samplesize, sndbufsize / samplesize);
return;
}
memcpy (b1, sndbuffer, s1);
if (tfprev != timeframes) {
if (sound_debug && !(tfprev % 10))
- write_log ("b=%4d,%5d,%5d,%5d d=%5d vd=%5.0f s=%+02.1f\n",
+ write_log (L"b=%4d,%5d,%5d,%5d d=%5d vd=%5.0f s=%+02.1f\n",
sndbufsize / samplesize, snd_configsize / samplesize, max_sndbufsize / samplesize,
dsoundbuf / samplesize, diff / samplesize, vdiff, skipmode);
tfprev = timeframes;
if (ok) {
sd->type = SOUND_DEVICE_AL;
if (ppDefaultDevice) {
- char tmp[MAX_DPATH];
- sprintf (tmp, "Default [%s]", devname);
- sd->alname = my_strdup (ppDefaultDevice);
+ TCHAR tmp[MAX_DPATH];
+ TCHAR *tdevname = au (devname);
+ _stprintf (tmp, L"Default [%s]", tdevname);
+ xfree (tdevname);
+ sd->alname = my_strdup_ansi (ppDefaultDevice);
sd->name = my_strdup (tmp);
} else {
- sd->alname = my_strdup (pDeviceNames);
- sd->name = my_strdup (pDeviceNames);
+ sd->alname = my_strdup_ansi (pDeviceNames);
+ sd->name = my_strdup_ansi (pDeviceNames);
}
sd->cfgname = my_strdup (sd->alname);
}
}
}
-static int isdllversion (const char *name, int version, int revision, int subver, int subrev)
+static int isdllversion (const TCHAR *name, int version, int revision, int subver, int subrev)
{
DWORD dwVersionHandle, dwFileVersionInfoSize;
LPVOID lpFileVersionData = NULL;
if (vsFileInfo) {
uae_u64 v1 = ((uae_u64)vsFileInfo->dwProductVersionMS << 32) | vsFileInfo->dwProductVersionLS;
uae_u64 v2 = ((uae_u64)version << 48) | ((uae_u64)revision << 32) | (subver << 16) | (subrev << 0);
- write_log ("%s %d.%d.%d.%d\n", name,
+ write_log (L"%s %d.%d.%d.%d\n", name,
HIWORD (vsFileInfo->dwProductVersionMS), LOWORD (vsFileInfo->dwProductVersionMS),
HIWORD (vsFileInfo->dwProductVersionLS), LOWORD (vsFileInfo->dwProductVersionLS));
if (v1 >= v2)
struct sound_device *sd;
int num;
int i, j;
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
num = Pa_GetDeviceCount ();
for (j = 0; j < num; j++) {
}
if (i >= MAX_SOUND_DEVICES)
return;
- sprintf (tmp, "[%s] %s", hai->name, di->name);
+ _stprintf (tmp, L"[%s] %s", hai->name, di->name);
sd->type = SOUND_DEVICE_PA;
sd->name = my_strdup (tmp);
sd->cfgname = my_strdup (tmp);
{
if (!num_sound_devices) {
HMODULE l = NULL;
- write_log ("Enumerating DirectSound devices..\n");
+ write_log (L"Enumerating DirectSound devices..\n");
DirectSoundEnumerate ((LPDSENUMCALLBACK)DSEnumProc, sound_devices);
DirectSoundCaptureEnumerate ((LPDSENUMCALLBACK)DSEnumProc, record_devices);
- if (isdllversion ("openal32.dll", 6, 14, 357, 22)) {
- write_log ("Enumerating OpenAL devices..\n");
+ if (isdllversion (L"openal32.dll", 6, 14, 357, 22)) {
+ write_log (L"Enumerating OpenAL devices..\n");
if (alcIsExtensionPresent (NULL, "ALC_ENUMERATION_EXT")) {
- const ALchar* ppDefaultDevice = alcGetString (NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
- const ALchar* pDeviceNames = alcGetString (NULL, ALC_DEVICE_SPECIFIER);
+ const char* ppDefaultDevice = alcGetString (NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
+ const char* pDeviceNames = alcGetString (NULL, ALC_DEVICE_SPECIFIER);
if (alcIsExtensionPresent (NULL, "ALC_ENUMERATE_ALL_EXT"))
pDeviceNames = alcGetString (NULL, ALC_ALL_DEVICES_SPECIFIER);
OpenALEnumerate (sound_devices, pDeviceNames, ppDefaultDevice, FALSE);
}
#if PORTAUDIO
{
- HMODULE hm = WIN32_LoadLibrary ("portaudio_x86.dll");
+ HMODULE hm = WIN32_LoadLibrary (L"portaudio_x86.dll");
if (hm) {
PaError err;
- write_log ("Enumerating PortAudio devices..\n");
- write_log ("%s (%d)\n", Pa_GetVersionText (), Pa_GetVersion ());
+ write_log (L"Enumerating PortAudio devices..\n");
+ write_log (L"%s (%d)\n", Pa_GetVersionText (), Pa_GetVersion ());
err = Pa_Initialize ();
if (err == paNoError) {
PortAudioEnumerate (sound_devices);
} else {
- write_log ("Portaudio initializiation failed: %d (%s)\n",
+ write_log (L"Portaudio initializiation failed: %d (%s)\n",
err, Pa_GetErrorText (err));
FreeLibrary (hm);
}
}
}
#endif
- write_log("Enumeration end\n");
+ write_log (L"Enumeration end\n");
for (num_sound_devices = 0; num_sound_devices < MAX_SOUND_DEVICES; num_sound_devices++) {
if (sound_devices[num_sound_devices].name == NULL)
break;
return ok == 2;
}
-static void mcierr (char *str, DWORD err)
+static void mcierr (TCHAR *str, DWORD err)
{
- char es[1000];
+ TCHAR es[1000];
if (err == MMSYSERR_NOERROR)
return;
- if (mciGetErrorString (err, es, sizeof es))
- write_log ("MCIErr: %s: %d = '%s'\n", str, err, es);
+ if (mciGetErrorString (err, es, sizeof es / sizeof (TCHAR)))
+ write_log (L"MCIErr: %s: %d = '%s'\n", str, err, es);
else
- write_log ("%s, errcode=%d\n", str, err);
+ write_log (L"%s, errcode=%d\n", str, err);
}
/* from http://www.codeproject.com/audio/mixerSetControlDetails.asp */
static int setget_master_volume_xp (int setvolume, int *volume, int *mute)
if (result == MMSYSERR_NOERROR)
ok = 1;
} else
- mcierr ("mixerGetLineControls Mute", result);
+ mcierr (L"mixerGetLineControls Mute", result);
} else
- mcierr ("mixerGetLineControls Volume", result);
+ mcierr (L"mixerGetLineControls Volume", result);
} else
- mcierr ("mixerGetLineInfo", result);
+ mcierr (L"mixerGetLineInfo", result);
mixerClose (hMixer);
} else
- mcierr ("mixerOpen", result);
+ mcierr (L"mixerOpen", result);
return ok;
}
key_t key;
size_t size;
void *addr;
- char name[MAX_PATH];
+ TCHAR name[MAX_PATH];
void *attached;
int mode;
void *natmembase;
int mprotect (void *addr, size_t len, int prot);
void *shmat (int shmid, LPVOID shmaddr, int shmflg);
int shmdt (const void *shmaddr);
-int shmget (key_t key, size_t size, int shmflg, const char*);
+int shmget (key_t key, size_t size, int shmflg, const TCHAR*);
int shmctl (int shmid, int cmd, struct shmid_ds *buf);
int init_shm (void);
#define TARGET_NO_ZFILE
#define DONT_PARSE_CMDLINE
#else
-#define TARGET_NAME "win32"
+#define TARGET_NAME L"win32"
#endif
#define TARGET_PROVIDES_DEFAULT_PREFS
#define TARGET_NO_DITHER
#define NO_MAIN_IN_MAIN_C
-#define OPTIONSFILENAME "default.uae"
+#define OPTIONSFILENAME L"default.uae"
extern void uae_sem_post (uae_sem_t*);
extern void uae_sem_wait (uae_sem_t*t);
extern void uae_sem_init (uae_sem_t*, int manual_reset, int initial_state);
-extern int uae_start_thread (char *name, void *(*f)(void *), void *arg, uae_thread_id *thread);
+extern int uae_start_thread (TCHAR *name, void *(*f)(void *), void *arg, uae_thread_id *thread);
extern int uae_start_thread_fast (void *(*f)(void *), void *arg, uae_thread_id *thread);
extern void uae_end_thread (uae_thread_id *thread);
extern void uae_set_thread_priority (int);
--- /dev/null
+
+#include <windows.h>
+
+#include "sysconfig.h"
+#include "sysdeps.h"
+
+static char *ua_2 (const WCHAR *s, UINT cp)
+{
+ char *d;
+ int len;
+
+ if (s == NULL)
+ return NULL;
+ len = WideCharToMultiByte (cp, 0, s, -1, NULL, 0, 0, FALSE);
+ if (!len)
+ return strdup ("");
+ d = xmalloc (len + 1);
+ WideCharToMultiByte (cp, 0, s, -1, d, len, 0, FALSE);
+ return d;
+}
+
+char *ua (const WCHAR *s)
+{
+ return ua_2 (s, CP_ACP);
+}
+char *uacp (const WCHAR *s, UINT cp)
+{
+ return ua_2 (s, cp);
+}
+
+static WCHAR *au_2 (const char *s, UINT cp)
+{
+ WCHAR *d;
+ int len;
+
+ if (s == NULL)
+ return NULL;
+ len = MultiByteToWideChar (cp, MB_PRECOMPOSED, s, -1, NULL, 0);
+ if (!len)
+ return xcalloc (2, 1);
+ d = xmalloc ((len + 1) * sizeof (WCHAR));
+ MultiByteToWideChar (cp, MB_PRECOMPOSED, s, -1, d, len);
+ return d;
+}
+
+WCHAR *au (const char *s)
+{
+ return au_2 (s, CP_ACP);
+}
+WCHAR *aucp (const char *s, UINT cp)
+{
+ return au_2 (s, cp);
+}
+
+WCHAR *au_copy (TCHAR *dst, int maxlen, const char *src)
+{
+ MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, src, -1, dst, maxlen);
+ return dst;
+}
+WCHAR *aucp_copy (TCHAR *dst, int maxlen, const char *src, UINT cp)
+{
+ MultiByteToWideChar (cp, MB_PRECOMPOSED, src, -1, dst, maxlen);
+ return dst;
+}
+
+char *ua_copy (char *dst, int maxlen, const TCHAR *src)
+{
+ WideCharToMultiByte (CP_ACP, 0, src, -1, dst, maxlen, 0, FALSE);
+ return dst;
+}
+char *uacp_copy (char *dst, int maxlen, const TCHAR *src, UINT cp)
+{
+ WideCharToMultiByte (cp, 0, src, -1, dst, maxlen, 0, FALSE);
+ return dst;
+}
+
+TCHAR *my_strdup_ansi (const char *src)
+{
+ return au (src);
+}
//#define MEMDEBUG
-#include "sysconfig.h"
-
#include <stdlib.h>
#include <stdarg.h>
#include <signal.h>
+#include "sysconfig.h"
+
+
#define _WIN32_WINNT 0x600 /* XButtons + MOUSEHWHEEL */
#include <windows.h>
HINSTANCE hInst = NULL;
HMODULE hUIDLL = NULL;
-HWND (WINAPI *pHtmlHelp)(HWND, LPCSTR, UINT, LPDWORD) = NULL;
+HWND (WINAPI *pHtmlHelp)(HWND, LPCWSTR, UINT, LPDWORD) = NULL;
HWND hAmigaWnd, hMainWnd, hHiddenWnd, hGUIWnd;
RECT amigawin_rect;
static int mouseposx, mouseposy;
HCURSOR normalcursor;
static HWND hwndNextViewer;
-char VersionStr[256];
-char BetaStr[64];
+TCHAR VersionStr[256];
+TCHAR BetaStr[64];
extern int path_type;
int in_sizemove;
static int didmousepos;
static int sound_closed;
static int recapture;
-int mouseactive, focus;
+static int focus;
+int mouseactive;
static int mm_timerres;
static int timermode, timeon;
int sleep_resolution;
static CRITICAL_SECTION cs_time;
-char start_path_data[MAX_DPATH];
-char start_path_exe[MAX_DPATH];
-char start_path_af[MAX_DPATH]; /* OLD AF */
-char start_path_new1[MAX_DPATH]; /* AF2005 */
-char start_path_new2[MAX_DPATH]; /* AMIGAFOREVERDATA */
-char help_file[MAX_DPATH];
+TCHAR start_path_data[MAX_DPATH];
+TCHAR start_path_exe[MAX_DPATH];
+TCHAR *pgmptr;
+TCHAR start_path_af[MAX_DPATH]; /* OLD AF */
+TCHAR start_path_new1[MAX_DPATH]; /* AF2005 */
+TCHAR start_path_new2[MAX_DPATH]; /* AMIGAFOREVERDATA */
+TCHAR help_file[MAX_DPATH];
int af_path_2005, af_path_old;
DWORD quickstart = 1, configurationcache = 1;
static int multi_display = 1;
-static char *inipath = NULL;
+static TCHAR *inipath = NULL;
static int timeend (void)
{
timeon = 0;
if (timeEndPeriod (mm_timerres) == TIMERR_NOERROR)
return 1;
- write_log ("TimeEndPeriod() failed\n");
+ write_log (L"TimeEndPeriod() failed\n");
return 0;
}
timeon = 1;
return 1;
}
- write_log ("TimeBeginPeriod() failed\n");
+ write_log (L"TimeBeginPeriod() failed\n");
return 0;
}
cnt++;
if (cnt > 1000000) {
- write_log("**************\n");
+ write_log(L"**************\n");
cnt = 0;
}
#endif
clockrate = (win32_read_processor_time () - clockrate) * 2;
dummythread_die = 0;
SetThreadPriority (th, oldpri);
- write_log ("CLOCKFREQ: RDTSC %.2fMHz\n", clockrate / 1000000.0);
+ write_log (L"CLOCKFREQ: RDTSC %.2fMHz\n", clockrate / 1000000.0);
syncbase = clockrate >> 6;
}
qpfrate >>= 1;
qpcdivisor++;
}
- write_log ("CLOCKFREQ: QPF %.2fMHz (%.2fMHz, DIV=%d)\n", freq.QuadPart / 1000000.0,
+ write_log (L"CLOCKFREQ: QPF %.2fMHz (%.2fMHz, DIV=%d)\n", freq.QuadPart / 1000000.0,
qpfrate / 1000000.0, 1 << qpcdivisor);
syncbase = (unsigned long)qpfrate;
}
return;
}
#if 0
- write_log ("%d %d %d %d %d - %d %d %d %d %d\n",
+ write_log (L"%d %d %d %d %d - %d %d %d %d %d\n",
x, amigawin_rect.left, amigawin_rect.right, mouseposx, oldx,
y, amigawin_rect.top, amigawin_rect.bottom, mouseposy, oldy);
#endif
}
mouseposx = mouseposy = 0;
if (oldx < 0 || oldy < 0 || oldx > amigawin_rect.right - amigawin_rect.left || oldy > amigawin_rect.bottom - amigawin_rect.top) {
- write_log ("Mouse out of range: %dx%d (%dx%d %dx%d)\n", oldx, oldy,
+ write_log (L"Mouse out of range: %dx%d (%dx%d %dx%d)\n", oldx, oldy,
amigawin_rect.left, amigawin_rect.top, amigawin_rect.right, amigawin_rect.bottom);
return;
}
static int showcursor;
-extern char config_filename[MAX_DPATH];
+extern TCHAR config_filename[MAX_DPATH];
static void setmaintitle (HWND hwnd)
{
- char txt[1000], txt2[500];
+ TCHAR txt[1000], txt2[500];
#ifdef RETROPLATFORM
if (rp_isactive ())
#endif
txt[0] = 0;
if (config_filename[0]) {
- strcat (txt, "[");
- strcat (txt, config_filename);
- strcat (txt, "] - ");
+ _tcscat (txt, L"[");
+ _tcscat (txt, config_filename);
+ _tcscat (txt, L"] - ");
}
- strcat (txt, "WinUAE");
+ _tcscat (txt, L"WinUAE");
txt2[0] = 0;
if (mouseactive > 0) {
WIN32GUI_LoadUIString (currprefs.win32_middle_mouse ? IDS_WINUAETITLE_MMB : IDS_WINUAETITLE_NORMAL,
- txt2, sizeof (txt2));
+ txt2, sizeof (txt2) / sizeof (TCHAR));
}
- if (strlen (WINUAEBETA) > 0) {
- strcat (txt, BetaStr);
- if (strlen (WINUAEEXTRA) > 0) {
- strcat (txt, " ");
- strcat (txt, WINUAEEXTRA);
+ if (_tcslen (WINUAEBETA) > 0) {
+ _tcscat (txt, BetaStr);
+ if (_tcslen (WINUAEEXTRA) > 0) {
+ _tcscat (txt, L" ");
+ _tcscat (txt, WINUAEEXTRA);
}
}
if (txt2[0]) {
- strcat (txt, " - ");
- strcat (txt, txt2);
+ _tcscat (txt, L" - ");
+ _tcscat (txt, txt2);
}
SetWindowText (hwnd, txt);
}
int err;
err = SetPriorityClass (GetCurrentProcess (), pri->classvalue);
if (!err)
- write_log ("priority set failed, %08X\n", GetLastError ());
+ write_log (L"priority set failed, %08X\n", GetLastError ());
}
static void setcursorshape (void)
mouseactive = active;
mouseposx = mouseposy = 0;
- //write_log ("setmouseactive(%d)\n", active);
+ //write_log (L"setmouseactive(%d)\n", active);
releasecapture ();
recapture = 0;
if (SetForegroundWindow (w1) == FALSE) {
if (w3 == NULL || SetForegroundWindow (w3) == FALSE) {
donotfocus = 1;
- write_log ("wanted focus but SetforegroundWindow() failed\n");
+ write_log (L"wanted focus but SetforegroundWindow() failed\n");
}
}
}
{
struct threadpriorities *pri;
- write_log ("winuae_active(%d)\n", minimized);
+ write_log (L"winuae_active(%d)\n", minimized);
/* without this returning from hibernate-mode causes wrong timing
*/
timeend ();
struct threadpriorities *pri;
int wasfocus = focus;
- write_log ("winuae_inactive(%d)\n", minimized);
+ write_log (L"winuae_inactive(%d)\n", minimized);
if (minimized)
exit_gui (0);
focus = 0;
}
}
+int isfocus (void)
+{
+ if (isfullscreen () > 0)
+ return 1;
+ if (focus && mouseactive)
+ return 1;
+ if (focus)
+ return -1;
+ return 0;
+}
+
static void handleXbutton (WPARAM wParam, int updown)
{
int b = GET_XBUTTON_WPARAM (wParam);
static int mm, minimized, recursive, ignoremousemove;
#if MSGDEBUG > 1
- write_log ("AWP: %x %d\n", hWnd, message);
+ write_log (L"AWP: %x %d\n", hWnd, message);
#endif
if (ignore_messages_all)
return DefWindowProc (hWnd, message, wParam, lParam);
return 0;
case WM_LBUTTONUP:
- if (dinput_winmouse () >= 0)
+ if (dinput_winmouse () >= 0 && isfocus ())
setmousebuttonstate (dinput_winmouse (), 0, 0);
return 0;
case WM_LBUTTONDOWN:
case WM_LBUTTONDBLCLK:
if (!mouseactive && isfullscreen() <= 0 && !gui_active && !mousehack_alive ()) {
setmouseactive (1);
- } else if (dinput_winmouse () >= 0) {
+ } else if (dinput_winmouse () >= 0 && isfocus ()) {
setmousebuttonstate (dinput_winmouse (), 0, 1);
}
return 0;
case WM_RBUTTONUP:
- if (dinput_winmouse () >= 0)
+ if (dinput_winmouse () >= 0 && isfocus ())
setmousebuttonstate (dinput_winmouse (), 1, 0);
return 0;
case WM_RBUTTONDOWN:
case WM_RBUTTONDBLCLK:
- if (dinput_winmouse () >= 0)
+ if (dinput_winmouse () >= 0 && isfocus ())
setmousebuttonstate (dinput_winmouse (), 1, 1);
return 0;
case WM_MBUTTONUP:
if (!currprefs.win32_middle_mouse) {
- if (dinput_winmouse () >= 0)
+ if (dinput_winmouse () >= 0 && isfocus ())
setmousebuttonstate (dinput_winmouse (), 2, 0);
}
return 0;
if (mouseactive)
setmouseactive (0);
} else {
- if (dinput_winmouse () >= 0)
+ if (dinput_winmouse () >= 0 && isfocus ())
setmousebuttonstate (dinput_winmouse (), 2, 1);
}
return 0;
case WM_XBUTTONUP:
- if (dinput_winmouse () >= 0) {
+ if (dinput_winmouse () >= 0 && isfocus ()) {
handleXbutton (wParam, 0);
return TRUE;
}
return 0;
case WM_XBUTTONDOWN:
case WM_XBUTTONDBLCLK:
- if (dinput_winmouse () >= 0) {
+ if (dinput_winmouse () >= 0 && isfocus ()) {
handleXbutton (wParam, 1);
return TRUE;
}
return 0;
case WM_MOUSEWHEEL:
- if (dinput_winmouse () >= 0) {
+ if (dinput_winmouse () >= 0 && isfocus ()) {
int val = ((short)HIWORD (wParam));
setmousestate (dinput_winmouse (), 2, val, 0);
if (val < 0)
}
return 0;
case WM_MOUSEHWHEEL:
- if (dinput_winmouse () >= 0) {
+ if (dinput_winmouse () >= 0 && isfocus ()) {
int val = ((short)HIWORD (wParam));
setmousestate (dinput_winmouse (), 3, val, 0);
if (val < 0)
setmousestate (dinput_winmouse (), 1, my, 1);
return 0;
}
- if (!focus)
+ if (!focus || !mouseactive)
return DefWindowProc (hWnd, message, wParam, lParam);
if (dinput_winmousemode () == 0) {
/* relative */
setmousestate (dinput_winmouse (), 0, mx, 0);
setmousestate (dinput_winmouse (), 1, my, 0);
}
- } else if (!mouseactive && isfullscreen () <= 0) {
+ } else if (isfocus () < 0 && (istablet || currprefs.input_tablet >= TABLET_MOUSEHACK)) {
setmousestate (0, 0, mx, 1);
setmousestate (0, 1, my, 1);
}
DWORD dwItem1; // dwItem1 contains the previous PIDL or name of the folder.
DWORD dwItem2; // dwItem2 contains the new PIDL or name of the folder.
} SHNOTIFYSTRUCT;
- char path[MAX_PATH];
+ TCHAR path[MAX_PATH];
if (lParam == SHCNE_MEDIAINSERTED || lParam == SHCNE_MEDIAREMOVED) {
SHNOTIFYSTRUCT *shns = (SHNOTIFYSTRUCT*)wParam;
if(SHGetPathFromIDList((struct _ITEMIDLIST *)(shns->dwItem1), path)) {
int inserted = lParam == SHCNE_MEDIAINSERTED ? 1 : 0;
- write_log("Shell Notification %d '%s'\n", inserted, path);
+ write_log (L"Shell Notification %d '%s'\n", inserted, path);
if (!win32_hardfile_media_change (path, inserted)) {
if ((inserted && CheckRM (path)) || !inserted) {
if (inserted) {
return TRUE;
case WM_DEVICECHANGE:
{
- extern void win32_spti_media_change (char driveletter, int insert);
- extern void win32_ioctl_media_change (char driveletter, int insert);
- extern void win32_aspi_media_change (char driveletter, int insert);
+ extern void win32_spti_media_change (TCHAR driveletter, int insert);
+ extern void win32_ioctl_media_change (TCHAR driveletter, int insert);
+ extern void win32_aspi_media_change (TCHAR driveletter, int insert);
DEV_BROADCAST_HDR *pBHdr = (DEV_BROADCAST_HDR *)lParam;
static int waitfornext;
if (wParam == DBT_DEVICEARRIVAL || wParam == DBT_DEVICEREMOVECOMPLETE) {
if (pBVol->dbcv_unitmask) {
int inserted, i;
- char drive;
+ TCHAR drive;
for (i = 0; i <= 'Z'-'A'; i++) {
if (pBVol->dbcv_unitmask & (1 << i)) {
- char drvname[10];
+ TCHAR drvname[10];
int type;
drive = 'A' + i;
- sprintf (drvname, "%c:\\", drive);
+ _stprintf (drvname, L"%c:\\", drive);
type = GetDriveType (drvname);
if (wParam == DBT_DEVICEARRIVAL)
inserted = 1;
win32_aspi_media_change (drive, inserted);
}
if (type == DRIVE_REMOVABLE || type == DRIVE_CDROM || !inserted) {
- write_log("WM_DEVICECHANGE '%s' type=%d inserted=%d\n", drvname, type, inserted);
+ write_log (L"WM_DEVICECHANGE '%s' type=%d inserted=%d\n", drvname, type, inserted);
if (!win32_hardfile_media_change (drvname, inserted)) {
if ((inserted && CheckRM (drvname)) || !inserted) {
if (type == DRIVE_CDROM && inserted)
HDC hDC;
#if MSGDEBUG > 1
- write_log ("MWP: %x %d\n", hWnd, message);
+ write_log (L"MWP: %x %d\n", hWnd, message);
#endif
switch (message)
}
if (store_xy++) {
- regsetint (NULL, "MainPosX", left);
- regsetint (NULL, "MainPosY", top);
+ regsetint (NULL, L"MainPosX", left);
+ regsetint (NULL, L"MainPosY", top);
}
changed_prefs.gfx_size_win.x = left;
changed_prefs.gfx_size_win.y = top;
break;
}
if (TaskbarRestart != 0 && TaskbarRestartHWND == hWnd && message == TaskbarRestart) {
- //write_log ("notif: taskbarrestart\n");
+ //write_log (L"notif: taskbarrestart\n");
systray (TaskbarRestartHWND, FALSE);
}
return DefWindowProc (hWnd, message, wParam, lParam);
wc.hIcon = LoadIcon (GetModuleHandle (NULL), MAKEINTRESOURCE (IDI_APPICON));
wc.hCursor = NULL; //LoadCursor (NULL, IDC_ARROW);
wc.lpszMenuName = 0;
- wc.lpszClassName = "AmigaPowah";
+ wc.lpszClassName = L"AmigaPowah";
wc.hbrBackground = CreateSolidBrush (g_dwBackgroundColor);
if (!RegisterClass (&wc))
return 0;
wc.hCursor = NULL; //LoadCursor (NULL, IDC_ARROW);
wc.hbrBackground = CreateSolidBrush (black);
wc.lpszMenuName = 0;
- wc.lpszClassName = "PCsuxRox";
+ wc.lpszClassName = L"PCsuxRox";
if (!RegisterClass (&wc))
return 0;
wc.hCursor = NULL; //LoadCursor (NULL, IDC_ARROW);
wc.hbrBackground = CreateSolidBrush (g_dwBackgroundColor);
wc.lpszMenuName = 0;
- wc.lpszClassName = "Useless";
+ wc.lpszClassName = L"Useless";
if (!RegisterClass (&wc))
return 0;
hHiddenWnd = CreateWindowEx (0,
- "Useless", "You don't see me",
+ L"Useless", L"You don't see me",
WS_POPUP,
0, 0,
1, 1,
/* HtmlHelp Initialization - optional component */
int WIN32_InitHtmlHelp (void)
{
- char *chm = "WinUAE.chm";
+ TCHAR *chm = L"WinUAE.chm";
int result = 0;
- sprintf(help_file, "%s%s", start_path_data, chm);
+ _stprintf(help_file, L"%s%s", start_path_data, chm);
if (!zfile_exists (help_file))
- sprintf(help_file, "%s%s", start_path_exe, chm);
+ _stprintf(help_file, L"%s%s", start_path_exe, chm);
if (zfile_exists (help_file)) {
- if (hHtmlHelp = LoadLibrary ("HHCTRL.OCX")) {
- pHtmlHelp = (HWND(WINAPI *)(HWND, LPCSTR, UINT, LPDWORD))GetProcAddress (hHtmlHelp, "HtmlHelpA");
+ if (hHtmlHelp = LoadLibrary (L"HHCTRL.OCX")) {
+ pHtmlHelp = (HWND(WINAPI *)(HWND, LPCWSTR, UINT, LPDWORD))GetProcAddress (hHtmlHelp, "HtmlHelpW");
result = 1;
}
}
struct winuae_lang langs[] =
{
- { LANG_AFRIKAANS, "Afrikaans" },
- { LANG_ARABIC, "Arabic" },
- { LANG_ARMENIAN, "Armenian" },
- { LANG_ASSAMESE, "Assamese" },
- { LANG_AZERI, "Azeri" },
- { LANG_BASQUE, "Basque" },
- { LANG_BELARUSIAN, "Belarusian" },
- { LANG_BENGALI, "Bengali" },
- { LANG_BULGARIAN, "Bulgarian" },
- { LANG_CATALAN, "Catalan" },
- { LANG_CHINESE, "Chinese" },
- { LANG_CROATIAN, "Croatian" },
- { LANG_CZECH, "Czech" },
- { LANG_DANISH, "Danish" },
- { LANG_DUTCH, "Dutch" },
- { LANG_ESTONIAN, "Estoanian" },
- { LANG_FAEROESE, "Faeroese" },
- { LANG_FARSI, "Farsi" },
- { LANG_FINNISH, "Finnish" },
- { LANG_FRENCH, "French" },
- { LANG_GEORGIAN, "Georgian" },
- { LANG_GERMAN, "German" },
- { LANG_GREEK, "Greek" },
- { LANG_GUJARATI, "Gujarati" },
- { LANG_HEBREW, "Hebrew" },
- { LANG_HINDI, "Hindi" },
- { LANG_HUNGARIAN, "Hungarian" },
- { LANG_ICELANDIC, "Icelandic" },
- { LANG_INDONESIAN, "Indonesian" },
- { LANG_ITALIAN, "Italian" },
- { LANG_JAPANESE, "Japanese" },
- { LANG_KANNADA, "Kannada" },
- { LANG_KASHMIRI, "Kashmiri" },
- { LANG_KAZAK, "Kazak" },
- { LANG_KONKANI, "Konkani" },
- { LANG_KOREAN, "Korean" },
- { LANG_LATVIAN, "Latvian" },
- { LANG_LITHUANIAN, "Lithuanian" },
- { LANG_MACEDONIAN, "Macedonian" },
- { LANG_MALAY, "Malay" },
- { LANG_MALAYALAM, "Malayalam" },
- { LANG_MANIPURI, "Manipuri" },
- { LANG_MARATHI, "Marathi" },
- { LANG_NEPALI, "Nepali" },
- { LANG_NORWEGIAN, "Norwegian" },
- { LANG_ORIYA, "Oriya" },
- { LANG_POLISH, "Polish" },
- { LANG_PORTUGUESE, "Portuguese" },
- { LANG_PUNJABI, "Punjabi" },
- { LANG_ROMANIAN, "Romanian" },
- { LANG_RUSSIAN, "Russian" },
- { LANG_SANSKRIT, "Sanskrit" },
- { LANG_SINDHI, "Sindhi" },
- { LANG_SLOVAK, "Slovak" },
- { LANG_SLOVENIAN, "Slovenian" },
- { LANG_SPANISH, "Spanish" },
- { LANG_SWAHILI, "Swahili" },
- { LANG_SWEDISH, "Swedish" },
- { LANG_TAMIL, "Tamil" },
- { LANG_TATAR, "Tatar" },
- { LANG_TELUGU, "Telugu" },
- { LANG_THAI, "Thai" },
- { LANG_TURKISH, "Turkish" },
- { LANG_UKRAINIAN, "Ukrainian" },
- { LANG_UZBEK, "Uzbek" },
- { LANG_VIETNAMESE, "Vietnamese" },
- { LANG_ENGLISH, "default" },
- { 0x400, "guidll.dll"},
+ { LANG_AFRIKAANS, L"Afrikaans" },
+ { LANG_ARABIC, L"Arabic" },
+ { LANG_ARMENIAN, L"Armenian" },
+ { LANG_ASSAMESE, L"Assamese" },
+ { LANG_AZERI, L"Azeri" },
+ { LANG_BASQUE, L"Basque" },
+ { LANG_BELARUSIAN, L"Belarusian" },
+ { LANG_BENGALI, L"Bengali" },
+ { LANG_BULGARIAN, L"Bulgarian" },
+ { LANG_CATALAN, L"Catalan" },
+ { LANG_CHINESE, L"Chinese" },
+ { LANG_CROATIAN, L"Croatian" },
+ { LANG_CZECH, L"Czech" },
+ { LANG_DANISH, L"Danish" },
+ { LANG_DUTCH, L"Dutch" },
+ { LANG_ESTONIAN, L"Estoanian" },
+ { LANG_FAEROESE, L"Faeroese" },
+ { LANG_FARSI, L"Farsi" },
+ { LANG_FINNISH, L"Finnish" },
+ { LANG_FRENCH, L"French" },
+ { LANG_GEORGIAN, L"Georgian" },
+ { LANG_GERMAN, L"German" },
+ { LANG_GREEK, L"Greek" },
+ { LANG_GUJARATI, L"Gujarati" },
+ { LANG_HEBREW, L"Hebrew" },
+ { LANG_HINDI, L"Hindi" },
+ { LANG_HUNGARIAN, L"Hungarian" },
+ { LANG_ICELANDIC, L"Icelandic" },
+ { LANG_INDONESIAN, L"Indonesian" },
+ { LANG_ITALIAN, L"Italian" },
+ { LANG_JAPANESE, L"Japanese" },
+ { LANG_KANNADA, L"Kannada" },
+ { LANG_KASHMIRI, L"Kashmiri" },
+ { LANG_KAZAK, L"Kazak" },
+ { LANG_KONKANI, L"Konkani" },
+ { LANG_KOREAN, L"Korean" },
+ { LANG_LATVIAN, L"Latvian" },
+ { LANG_LITHUANIAN, L"Lithuanian" },
+ { LANG_MACEDONIAN, L"Macedonian" },
+ { LANG_MALAY, L"Malay" },
+ { LANG_MALAYALAM, L"Malayalam" },
+ { LANG_MANIPURI, L"Manipuri" },
+ { LANG_MARATHI, L"Marathi" },
+ { LANG_NEPALI, L"Nepali" },
+ { LANG_NORWEGIAN, L"Norwegian" },
+ { LANG_ORIYA, L"Oriya" },
+ { LANG_POLISH, L"Polish" },
+ { LANG_PORTUGUESE, L"Portuguese" },
+ { LANG_PUNJABI, L"Punjabi" },
+ { LANG_ROMANIAN, L"Romanian" },
+ { LANG_RUSSIAN, L"Russian" },
+ { LANG_SANSKRIT, L"Sanskrit" },
+ { LANG_SINDHI, L"Sindhi" },
+ { LANG_SLOVAK, L"Slovak" },
+ { LANG_SLOVENIAN, L"Slovenian" },
+ { LANG_SPANISH, L"Spanish" },
+ { LANG_SWAHILI, L"Swahili" },
+ { LANG_SWEDISH, L"Swedish" },
+ { LANG_TAMIL, L"Tamil" },
+ { LANG_TATAR, L"Tatar" },
+ { LANG_TELUGU, L"Telugu" },
+ { LANG_THAI, L"Thai" },
+ { LANG_TURKISH, L"Turkish" },
+ { LANG_UKRAINIAN, L"Ukrainian" },
+ { LANG_UZBEK, L"Uzbek" },
+ { LANG_VIETNAMESE, L"Vietnamese" },
+ { LANG_ENGLISH, L"default" },
+ { 0x400, L"guidll.dll"},
{ 0, NULL }
};
-static char *getlanguagename(DWORD id)
+static TCHAR *getlanguagename(DWORD id)
{
int i;
for (i = 0; langs[i].name; i++) {
HMODULE language_load (WORD language)
{
HMODULE result = NULL;
- char dllbuf[MAX_DPATH];
- char *dllname;
+ TCHAR dllbuf[MAX_DPATH];
+ TCHAR *dllname;
if (language <= 0) {
/* new user-specific Windows ME/2K/XP method to get UI language */
pGetUserDefaultUILanguage = (PGETUSERDEFAULTUILANGUAGE)GetProcAddress (
- GetModuleHandle ("kernel32.dll"), "GetUserDefaultUILanguage");
+ GetModuleHandle (L"kernel32.dll"), "GetUserDefaultUILanguage");
language = GetUserDefaultLangID ();
if (pGetUserDefaultUILanguage)
language = pGetUserDefaultUILanguage ();
int fail = 1;
if (language == 0x400)
- strcpy (dllbuf, "guidll.dll");
+ _tcscpy (dllbuf, L"guidll.dll");
else
- sprintf (dllbuf, "WinUAE_%s.dll", dllname);
+ _stprintf (dllbuf, L"WinUAE_%s.dll", dllname);
result = WIN32_LoadLibrary (dllbuf);
if (result) {
dwFileVersionInfoSize = GetFileVersionInfoSize (dllbuf, &dwVersionHandle);
&& LOWORD(vsFileInfo->dwProductVersionMS) == UAEMINOR
&& (HIWORD(vsFileInfo->dwProductVersionLS) == UAESUBREV || HIWORD(vsFileInfo->dwProductVersionLS) == UAESUBREV - 1)) {
success = TRUE;
- write_log ("Translation DLL '%s' loaded and enabled\n", dllbuf);
+ write_log (L"Translation DLL '%s' loaded and enabled\n", dllbuf);
} else {
- write_log ("Translation DLL '%s' version mismatch (%d.%d.%d)\n", dllbuf,
+ write_log (L"Translation DLL '%s' version mismatch (%d.%d.%d)\n", dllbuf,
HIWORD(vsFileInfo->dwProductVersionMS),
LOWORD(vsFileInfo->dwProductVersionMS),
HIWORD(vsFileInfo->dwProductVersionLS));
if (fail) {
DWORD err = GetLastError ();
if (err != ERROR_MOD_NOT_FOUND && err != ERROR_DLL_NOT_FOUND)
- write_log ("Translation DLL '%s' failed to load, error %d\n", dllbuf, GetLastError ());
+ write_log (L"Translation DLL '%s' failed to load, error %d\n", dllbuf, GetLastError ());
}
if (result && !success) {
FreeLibrary (result);
int i;
for (i = 0; priorities[i].id; i++) {
- char tmp[MAX_DPATH];
- WIN32GUI_LoadUIString (priorities[i].id, tmp, sizeof (tmp));
+ TCHAR tmp[MAX_DPATH];
+ WIN32GUI_LoadUIString (priorities[i].id, tmp, sizeof (tmp) / sizeof (TCHAR));
priorities[i].name = my_strdup (tmp);
}
}
int lid;
WORD langid = -1;
- if (regqueryint (NULL, "Language", &lid))
+ if (regqueryint (NULL, L"Language", &lid))
langid = (WORD)lid;
hUIDLL = language_load (langid);
pritransla ();
CoInitialize (0);
/* Determine our processor speed and capabilities */
if (!init_mmtimer ()) {
- pre_gui_message ("MMTimer initialization failed, exiting..");
+ pre_gui_message (L"MMTimer initialization failed, exiting..");
return 0;
}
if (!QueryPerformanceCounter (&freq)) {
- pre_gui_message ("No QueryPerformanceFrequency() supported, exiting..\n");
+ pre_gui_message (L"No QueryPerformanceFrequency() supported, exiting..\n");
return 0;
}
rpt_available = 1;
figure_processor_speed ();
if (!timebegin ()) {
- pre_gui_message ("MMTimer second initialization failed, exiting..");
+ pre_gui_message (L"MMTimer second initialization failed, exiting..");
return 0;
}
- hRichEdit = LoadLibrary ("RICHED32.DLL");
+ hRichEdit = LoadLibrary (L"RICHED32.DLL");
return 1;
}
void toggle_mousegrab (void)
{
}
-#define LOG_BOOT "winuaebootlog.txt"
-#define LOG_NORMAL "winuaelog.txt"
+#define LOG_BOOT L"winuaebootlog.txt"
+#define LOG_NORMAL L"winuaelog.txt"
void logging_open(int bootlog, int append)
{
- char debugfilename[MAX_DPATH];
+ TCHAR debugfilename[MAX_DPATH];
debugfilename[0] = 0;
#ifndef SINGLEFILE
if (currprefs.win32_logfile)
- sprintf (debugfilename, "%s%s", start_path_data, LOG_NORMAL);
+ _stprintf (debugfilename, L"%s%s", start_path_data, LOG_NORMAL);
if (bootlog)
- sprintf (debugfilename, "%s%s", start_path_data, LOG_BOOT);
+ _stprintf (debugfilename, L"%s%s", start_path_data, LOG_BOOT);
if (debugfilename[0]) {
if (!debugfile)
debugfile = log_open (debugfilename, append, bootlog);
static int first;
if (first > 1) {
- write_log ("** RESTART **\n");
+ write_log (L"** RESTART **\n");
return;
}
if (first == 1) {
- write_log ("Log (%s): '%s%s'\n", currprefs.win32_logfile ? "enabled" : "disabled",
+ write_log (L"Log (%s): '%s%s'\n", currprefs.win32_logfile ? L"enabled" : L"disabled",
start_path_data, LOG_NORMAL);
if (debugfile)
log_close (debugfile);
logging_open (first ? 0 : 1, 0);
logging_started = 1;
first++;
- fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress (GetModuleHandle ("kernel32"), "IsWow64Process");
+ fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress (GetModuleHandle (L"kernel32"), "IsWow64Process");
if (fnIsWow64Process)
fnIsWow64Process (GetCurrentProcess (), &wow64);
- write_log ("%s (%d.%d %s%s[%d])", VersionStr,
+ write_log (L"%s (%d.%d %s%s[%d])", VersionStr,
osVersion.dwMajorVersion, osVersion.dwMinorVersion, osVersion.szCSDVersion,
- strlen(osVersion.szCSDVersion) > 0 ? " " : "", os_winnt_admin);
- write_log (" %d-bit %X.%X %d", wow64 ? 64 : 32,
+ _tcslen (osVersion.szCSDVersion) > 0 ? L" " : L"", os_winnt_admin);
+ write_log (L" %d-bit %X.%X %d", wow64 ? 64 : 32,
SystemInfo.wProcessorLevel, SystemInfo.wProcessorRevision,
SystemInfo.dwNumberOfProcessors);
- write_log ("\n(c) 1995-2001 Bernd Schmidt - Core UAE concept and implementation."
- "\n(c) 1998-2009 Toni Wilen - Win32 port, core code updates."
- "\n(c) 1996-2001 Brian King - Win32 port, Picasso96 RTG, and GUI."
- "\n(c) 1996-1999 Mathias Ortmann - Win32 port and bsdsocket support."
- "\n(c) 2000-2001 Bernd Meyer - JIT engine."
- "\n(c) 2000-2005 Bernd Roesch - MIDI input, many fixes."
- "\nPress F12 to show the Settings Dialog (GUI), Alt-F4 to quit."
- "\nEnd+F1 changes floppy 0, End+F2 changes floppy 1, etc."
- "\n");
- write_log ("EXE: '%s', DATA: '%s'\n", start_path_exe, start_path_data);
+ write_log (L"\n(c) 1995-2001 Bernd Schmidt - Core UAE concept and implementation."
+ L"\n(c) 1998-2009 Toni Wilen - Win32 port, core code updates."
+ L"\n(c) 1996-2001 Brian King - Win32 port, Picasso96 RTG, and GUI."
+ L"\n(c) 1996-1999 Mathias Ortmann - Win32 port and bsdsocket support."
+ L"\n(c) 2000-2001 Bernd Meyer - JIT engine."
+ L"\n(c) 2000-2005 Bernd Roesch - MIDI input, many fixes."
+ L"\nPress F12 to show the Settings Dialog (GUI), Alt-F4 to quit."
+ L"\nEnd+F1 changes floppy 0, End+F2 changes floppy 1, etc."
+ L"\n");
+ write_log (L"EXE: '%s', DATA: '%s'\n", start_path_exe, start_path_data);
regstatus ();
}
if (!logging_started)
return NULL;
- f = fopen (bootlog ? LOG_BOOT : LOG_NORMAL, "rb");
+ f = _tfopen (bootlog ? LOG_BOOT : LOG_NORMAL, L"rb");
if (!f)
return NULL;
fseek (f, 0, SEEK_END);
return dst;
}
-static void strip_slashes (char *p)
+static void strip_slashes (TCHAR *p)
{
- while (strlen (p) > 0 && (p[strlen (p) - 1] == '\\' || p[strlen (p) - 1] == '/'))
- p[strlen (p) - 1] = 0;
+ while (_tcslen (p) > 0 && (p[_tcslen (p) - 1] == '\\' || p[_tcslen (p) - 1] == '/'))
+ p[_tcslen (p) - 1] = 0;
}
-static void fixtrailing(char *p)
+static void fixtrailing(TCHAR *p)
{
- if (strlen(p) == 0)
+ if (_tcslen(p) == 0)
return;
- if (p[strlen(p) - 1] == '/' || p[strlen(p) - 1] == '\\')
+ if (p[_tcslen(p) - 1] == '/' || p[_tcslen(p) - 1] == '\\')
return;
- strcat(p, "\\");
+ _tcscat(p, L"\\");
}
typedef DWORD (STDAPICALLTYPE *PFN_GetKey)(LPVOID lpvBuffer, DWORD dwSize);
-uae_u8 *target_load_keyfile (struct uae_prefs *p, char *path, int *sizep, char *name)
+uae_u8 *target_load_keyfile (struct uae_prefs *p, TCHAR *path, int *sizep, TCHAR *name)
{
uae_u8 *keybuf = NULL;
HMODULE h;
PFN_GetKey pfnGetKey;
int size;
- char *libname = "amigaforever.dll";
+ TCHAR *libname = L"amigaforever.dll";
h = WIN32_LoadLibrary (libname);
if (!h) {
- char path[MAX_DPATH];
- sprintf (path, "%s..\\Player\\%s", start_path_exe, libname);
+ TCHAR path[MAX_DPATH];
+ _stprintf (path, L"%s..\\Player\\%s", start_path_exe, libname);
h = LoadLibrary (path);
if (!h) {
- char *afr = getenv ("AMIGAFOREVERROOT");
+ TCHAR *afr = _wgetenv (L"AMIGAFOREVERROOT");
if (afr) {
- char tmp[MAX_DPATH];
- strcpy (tmp, afr);
+ TCHAR tmp[MAX_DPATH];
+ _tcscpy (tmp, afr);
fixtrailing (tmp);
- sprintf (path, "%sPlayer\\%s", tmp, libname);
+ _stprintf (path, L"%sPlayer\\%s", tmp, libname);
h = LoadLibrary (path);
if (!h)
return NULL;
}
-extern char *get_aspi_path(int);
+extern TCHAR *get_aspi_path(int);
static get_aspi (int old)
{
p->win32_rtgallowscaling = 0;
p->win32_rtgscaleaspectratio = -1;
p->win32_rtgvblankrate = 0;
+ p->win32_fscodepage = 1252;
}
if (type == 1 || type == 0) {
p->win32_uaescsimode = get_aspi (p->win32_uaescsimode);
}
}
-static const char *scsimode[] = { "none", "SPTI", "SPTI+SCSISCAN", "AdaptecASPI", "NeroASPI", "FrogASPI", 0 };
+static const TCHAR *scsimode[] = { L"none", L"SPTI", L"SPTI+SCSISCAN", L"AdaptecASPI", L"NeroASPI", L"FrogASPI", 0 };
void target_save_options (struct zfile *f, struct uae_prefs *p)
{
- cfgfile_target_dwrite (f, "middle_mouse=%s\n", p->win32_middle_mouse ? "true" : "false");
- cfgfile_target_dwrite (f, "logfile=%s\n", p->win32_logfile ? "true" : "false");
- cfgfile_target_dwrite (f, "map_drives=%s\n", p->win32_automount_drives ? "true" : "false");
- cfgfile_target_dwrite (f, "map_drives_auto=%s\n", p->win32_automount_removable ? "true" : "false");
- cfgfile_target_dwrite (f, "map_cd_drives=%s\n", p->win32_automount_cddrives ? "true" : "false");
- cfgfile_target_dwrite (f, "map_net_drives=%s\n", p->win32_automount_netdrives ? "true" : "false");
- cfgfile_target_dwrite (f, "map_removable_drives=%s\n", p->win32_automount_removabledrives ? "true" : "false");
+ cfgfile_target_dwrite (f, L"middle_mouse=%s\n", p->win32_middle_mouse ? L"true" : L"false");
+ cfgfile_target_dwrite (f, L"logfile=%s\n", p->win32_logfile ? L"true" : L"false");
+ cfgfile_target_dwrite (f, L"map_drives=%s\n", p->win32_automount_drives ? L"true" : L"false");
+ cfgfile_target_dwrite (f, L"map_drives_auto=%s\n", p->win32_automount_removable ? L"true" : L"false");
+ cfgfile_target_dwrite (f, L"map_cd_drives=%s\n", p->win32_automount_cddrives ? L"true" : L"false");
+ cfgfile_target_dwrite (f, L"map_net_drives=%s\n", p->win32_automount_netdrives ? L"true" : L"false");
+ cfgfile_target_dwrite (f, L"map_removable_drives=%s\n", p->win32_automount_removabledrives ? L"true" : L"false");
serdevtoname (p->sername);
- cfgfile_target_dwrite (f, "serial_port=%s\n", p->sername[0] ? p->sername : "none");
+ cfgfile_target_dwrite (f, L"serial_port=%s\n", p->sername[0] ? p->sername : L"none");
sernametodev (p->sername);
- cfgfile_target_dwrite (f, "parallel_port=%s\n", p->prtname[0] ? p->prtname : "none");
-
- cfgfile_target_dwrite (f, "active_priority=%d\n", priorities[p->win32_active_priority].value);
- cfgfile_target_dwrite (f, "inactive_priority=%d\n", priorities[p->win32_inactive_priority].value);
- cfgfile_target_dwrite (f, "inactive_nosound=%s\n", p->win32_inactive_nosound ? "true" : "false");
- cfgfile_target_dwrite (f, "inactive_pause=%s\n", p->win32_inactive_pause ? "true" : "false");
- cfgfile_target_dwrite (f, "iconified_priority=%d\n", priorities[p->win32_iconified_priority].value);
- cfgfile_target_dwrite (f, "iconified_nosound=%s\n", p->win32_iconified_nosound ? "true" : "false");
- cfgfile_target_dwrite (f, "iconified_pause=%s\n", p->win32_iconified_pause ? "true" : "false");
-
- cfgfile_target_dwrite (f, "ctrl_f11_is_quit=%s\n", p->win32_ctrl_F11_is_quit ? "true" : "false");
- cfgfile_target_dwrite (f, "midiout_device=%d\n", p->win32_midioutdev);
- cfgfile_target_dwrite (f, "midiin_device=%d\n", p->win32_midiindev);
- cfgfile_target_dwrite (f, "rtg_match_depth=%s\n", p->win32_rtgmatchdepth ? "true" : "false");
- cfgfile_target_dwrite (f, "rtg_scale_small=%s\n", p->win32_rtgscaleifsmall ? "true" : "false");
- cfgfile_target_dwrite (f, "rtg_scale_allow=%s\n", p->win32_rtgallowscaling ? "true" : "false");
- cfgfile_target_dwrite (f, "rtg_scale_aspect_ratio=%d:%d\n",
+ cfgfile_target_dwrite (f, L"parallel_port=%s\n", p->prtname[0] ? p->prtname : L"none");
+
+ cfgfile_target_dwrite (f, L"active_priority=%d\n", priorities[p->win32_active_priority].value);
+ cfgfile_target_dwrite (f, L"inactive_priority=%d\n", priorities[p->win32_inactive_priority].value);
+ cfgfile_target_dwrite (f, L"inactive_nosound=%s\n", p->win32_inactive_nosound ? L"true" : L"false");
+ cfgfile_target_dwrite (f, L"inactive_pause=%s\n", p->win32_inactive_pause ? L"true" : L"false");
+ cfgfile_target_dwrite (f, L"iconified_priority=%d\n", priorities[p->win32_iconified_priority].value);
+ cfgfile_target_dwrite (f, L"iconified_nosound=%s\n", p->win32_iconified_nosound ? L"true" : L"false");
+ cfgfile_target_dwrite (f, L"iconified_pause=%s\n", p->win32_iconified_pause ? L"true" : L"false");
+
+ cfgfile_target_dwrite (f, L"ctrl_f11_is_quit=%s\n", p->win32_ctrl_F11_is_quit ? L"true" : L"false");
+ cfgfile_target_dwrite (f, L"midiout_device=%d\n", p->win32_midioutdev);
+ cfgfile_target_dwrite (f, L"midiin_device=%d\n", p->win32_midiindev);
+ cfgfile_target_dwrite (f, L"rtg_match_depth=%s\n", p->win32_rtgmatchdepth ? L"true" : L"false");
+ cfgfile_target_dwrite (f, L"rtg_scale_small=%s\n", p->win32_rtgscaleifsmall ? L"true" : L"false");
+ cfgfile_target_dwrite (f, L"rtg_scale_allow=%s\n", p->win32_rtgallowscaling ? L"true" : L"false");
+ cfgfile_target_dwrite (f, L"rtg_scale_aspect_ratio=%d:%d\n",
p->win32_rtgscaleaspectratio >= 0 ? (p->win32_rtgscaleaspectratio >> 8) : -1,
p->win32_rtgscaleaspectratio >= 0 ? (p->win32_rtgscaleaspectratio & 0xff) : -1);
if (p->win32_rtgvblankrate <= 0)
- cfgfile_target_dwrite (f, "rtg_vblank=%s\n", p->win32_rtgvblankrate == -1 ? "real" : (p->win32_rtgvblankrate == -2 ? "disabled" : "chipset"));
+ cfgfile_target_dwrite (f, L"rtg_vblank=%s\n", p->win32_rtgvblankrate == -1 ? L"real" : (p->win32_rtgvblankrate == -2 ? L"disabled" : L"chipset"));
else
- cfgfile_target_dwrite (f, "rtg_vblank=%d\n", p->win32_rtgvblankrate);
- cfgfile_target_dwrite (f, "borderless=%s\n", p->win32_borderless ? "true" : "false");
- cfgfile_target_dwrite (f, "uaescsimode=%s\n", scsimode[p->win32_uaescsimode]);
- cfgfile_target_dwrite (f, "soundcard=%d\n", p->win32_soundcard);
+ cfgfile_target_dwrite (f, L"rtg_vblank=%d\n", p->win32_rtgvblankrate);
+ cfgfile_target_dwrite (f, L"borderless=%s\n", p->win32_borderless ? L"true" : L"false");
+ cfgfile_target_dwrite (f, L"uaescsimode=%s\n", scsimode[p->win32_uaescsimode]);
+ cfgfile_target_dwrite (f, L"soundcard=%d\n", p->win32_soundcard);
if (sound_devices[p->win32_soundcard].cfgname)
- cfgfile_target_dwrite (f, "soundcardname=%s\n", sound_devices[p->win32_soundcard].cfgname);
- cfgfile_target_dwrite (f, "cpu_idle=%d\n", p->cpu_idle);
- cfgfile_target_dwrite (f, "notaskbarbutton=%s\n", p->win32_notaskbarbutton ? "true" : "false");
- cfgfile_target_dwrite (f, "always_on_top=%s\n", p->win32_alwaysontop ? "true" : "false");
- cfgfile_target_dwrite (f, "no_recyclebin=%s\n", p->win32_norecyclebin ? "true" : "false");
- cfgfile_target_dwrite (f, "specialkey=0x%x\n", p->win32_specialkey);
+ cfgfile_target_dwrite (f, L"soundcardname=%s\n", sound_devices[p->win32_soundcard].cfgname);
+ cfgfile_target_dwrite (f, L"cpu_idle=%d\n", p->cpu_idle);
+ cfgfile_target_dwrite (f, L"notaskbarbutton=%s\n", p->win32_notaskbarbutton ? L"true" : L"false");
+ cfgfile_target_dwrite (f, L"always_on_top=%s\n", p->win32_alwaysontop ? L"true" : L"false");
+ cfgfile_target_dwrite (f, L"no_recyclebin=%s\n", p->win32_norecyclebin ? L"true" : L"false");
+ cfgfile_target_dwrite (f, L"specialkey=0x%x\n", p->win32_specialkey);
if (p->win32_guikey >= 0)
- cfgfile_target_dwrite (f, "guikey=0x%x\n", p->win32_guikey);
- cfgfile_target_dwrite (f, "kbledmode=%d\n", p->win32_kbledmode);
- cfgfile_target_dwrite (f, "powersavedisabled=%s\n", p->win32_powersavedisabled ? "true" : "false");
+ cfgfile_target_dwrite (f, L"guikey=0x%x\n", p->win32_guikey);
+ cfgfile_target_dwrite (f, L"kbledmode=%d\n", p->win32_kbledmode);
+ cfgfile_target_dwrite (f, L"powersavedisabled=%s\n", p->win32_powersavedisabled ? L"true" : L"false");
+ cfgfile_target_dwrite (f, L"filesystem_codepage=%d\n", p->win32_fscodepage);
}
return defpri;
}
-static const char *obsolete[] = {
- "killwinkeys", "sound_force_primary", "iconified_highpriority",
- "sound_sync", "sound_tweak", "directx6", "sound_style",
- "file_path", "iconified_nospeed", "activepriority", "magic_mouse",
+static const TCHAR *obsolete[] = {
+ L"killwinkeys", L"sound_force_primary", L"iconified_highpriority",
+ L"sound_sync", L"sound_tweak", L"directx6", L"sound_style",
+ L"file_path", L"iconified_nospeed", L"activepriority", L"magic_mouse",
0
};
-int target_parse_option (struct uae_prefs *p, char *option, char *value)
+int target_parse_option (struct uae_prefs *p, TCHAR *option, TCHAR *value)
{
- char tmpbuf[CONFIG_BLEN];
+ TCHAR tmpbuf[CONFIG_BLEN];
int i, v;
- int result = (cfgfile_yesno (option, value, "middle_mouse", &p->win32_middle_mouse)
- || cfgfile_yesno (option, value, "map_drives", &p->win32_automount_drives)
- || cfgfile_yesno (option, value, "map_drives_auto", &p->win32_automount_removable)
- || cfgfile_yesno (option, value, "map_cd_drives", &p->win32_automount_cddrives)
- || cfgfile_yesno (option, value, "map_net_drives", &p->win32_automount_netdrives)
- || cfgfile_yesno (option, value, "map_removable_drives", &p->win32_automount_removabledrives)
- || cfgfile_yesno (option, value, "logfile", &p->win32_logfile)
- || cfgfile_yesno (option, value, "networking", &p->socket_emu)
- || cfgfile_yesno (option, value, "borderless", &p->win32_borderless)
- || cfgfile_yesno (option, value, "inactive_pause", &p->win32_inactive_pause)
- || cfgfile_yesno (option, value, "inactive_nosound", &p->win32_inactive_nosound)
- || cfgfile_yesno (option, value, "iconified_pause", &p->win32_iconified_pause)
- || cfgfile_yesno (option, value, "iconified_nosound", &p->win32_iconified_nosound)
- || cfgfile_yesno (option, value, "ctrl_f11_is_quit", &p->win32_ctrl_F11_is_quit)
- || cfgfile_yesno (option, value, "no_recyclebin", &p->win32_norecyclebin)
- || cfgfile_intval (option, value, "midi_device", &p->win32_midioutdev, 1)
- || cfgfile_intval (option, value, "midiout_device", &p->win32_midioutdev, 1)
- || cfgfile_intval (option, value, "midiin_device", &p->win32_midiindev, 1)
- || cfgfile_intval (option, value, "soundcard", &p->win32_soundcard, 1)
- || cfgfile_yesno (option, value, "notaskbarbutton", &p->win32_notaskbarbutton)
- || cfgfile_yesno (option, value, "always_on_top", &p->win32_alwaysontop)
- || cfgfile_yesno (option, value, "powersavedisabled", &p->win32_powersavedisabled)
- || cfgfile_intval (option, value, "specialkey", &p->win32_specialkey, 1)
- || cfgfile_intval (option, value, "guikey", &p->win32_guikey, 1)
- || cfgfile_intval (option, value, "kbledmode", &p->win32_kbledmode, 1)
- || cfgfile_intval (option, value, "cpu_idle", &p->cpu_idle, 1));
-
- if (cfgfile_yesno (option, value, "rtg_match_depth", &p->win32_rtgmatchdepth))
+ int result = (cfgfile_yesno (option, value, L"middle_mouse", &p->win32_middle_mouse)
+ || cfgfile_yesno (option, value, L"map_drives", &p->win32_automount_drives)
+ || cfgfile_yesno (option, value, L"map_drives_auto", &p->win32_automount_removable)
+ || cfgfile_yesno (option, value, L"map_cd_drives", &p->win32_automount_cddrives)
+ || cfgfile_yesno (option, value, L"map_net_drives", &p->win32_automount_netdrives)
+ || cfgfile_yesno (option, value, L"map_removable_drives", &p->win32_automount_removabledrives)
+ || cfgfile_yesno (option, value, L"logfile", &p->win32_logfile)
+ || cfgfile_yesno (option, value, L"networking", &p->socket_emu)
+ || cfgfile_yesno (option, value, L"borderless", &p->win32_borderless)
+ || cfgfile_yesno (option, value, L"inactive_pause", &p->win32_inactive_pause)
+ || cfgfile_yesno (option, value, L"inactive_nosound", &p->win32_inactive_nosound)
+ || cfgfile_yesno (option, value, L"iconified_pause", &p->win32_iconified_pause)
+ || cfgfile_yesno (option, value, L"iconified_nosound", &p->win32_iconified_nosound)
+ || cfgfile_yesno (option, value, L"ctrl_f11_is_quit", &p->win32_ctrl_F11_is_quit)
+ || cfgfile_yesno (option, value, L"no_recyclebin", &p->win32_norecyclebin)
+ || cfgfile_intval (option, value, L"midi_device", &p->win32_midioutdev, 1)
+ || cfgfile_intval (option, value, L"midiout_device", &p->win32_midioutdev, 1)
+ || cfgfile_intval (option, value, L"midiin_device", &p->win32_midiindev, 1)
+ || cfgfile_intval (option, value, L"soundcard", &p->win32_soundcard, 1)
+ || cfgfile_yesno (option, value, L"notaskbarbutton", &p->win32_notaskbarbutton)
+ || cfgfile_yesno (option, value, L"always_on_top", &p->win32_alwaysontop)
+ || cfgfile_yesno (option, value, L"powersavedisabled", &p->win32_powersavedisabled)
+ || cfgfile_intval (option, value, L"specialkey", &p->win32_specialkey, 1)
+ || cfgfile_intval (option, value, L"guikey", &p->win32_guikey, 1)
+ || cfgfile_intval (option, value, L"kbledmode", &p->win32_kbledmode, 1)
+ || cfgfile_intval (option, value, L"filesystem_codepage", &p->win32_fscodepage, 1)
+ || cfgfile_intval (option, value, L"cpu_idle", &p->cpu_idle, 1));
+
+ if (cfgfile_yesno (option, value, L"rtg_match_depth", &p->win32_rtgmatchdepth))
return 1;
- if (cfgfile_yesno (option, value, "rtg_scale_small", &p->win32_rtgscaleifsmall))
+ if (cfgfile_yesno (option, value, L"rtg_scale_small", &p->win32_rtgscaleifsmall))
return 1;
- if (cfgfile_yesno (option, value, "rtg_scale_allow", &p->win32_rtgallowscaling))
+ if (cfgfile_yesno (option, value, L"rtg_scale_allow", &p->win32_rtgallowscaling))
return 1;
- if (cfgfile_string (option, value, "soundcardname", tmpbuf, sizeof tmpbuf)) {
+ if (cfgfile_string (option, value, L"soundcardname", tmpbuf, sizeof tmpbuf / sizeof (TCHAR))) {
int i;
for (i = 0; sound_devices[i].cfgname; i++) {
- if (!strcmp (sound_devices[i].cfgname, tmpbuf)) {
+ if (!_tcscmp (sound_devices[i].cfgname, tmpbuf)) {
p->win32_soundcard = i;
break;
}
return 1;
}
- if (cfgfile_yesno (option, value, "aspi", &v)) {
+ if (cfgfile_yesno (option, value, L"aspi", &v)) {
p->win32_uaescsimode = 0;
if (v)
p->win32_uaescsimode = get_aspi(0);
return 1;
}
- if (cfgfile_string (option, value, "rtg_vblank", tmpbuf, sizeof tmpbuf)) {
- if (!strcmp (tmpbuf, "real")) {
+ if (cfgfile_string (option, value, L"rtg_vblank", tmpbuf, sizeof tmpbuf / sizeof (TCHAR))) {
+ if (!_tcscmp (tmpbuf, L"real")) {
p->win32_rtgvblankrate = -1;
return 1;
}
- if (!strcmp (tmpbuf, "disabled")) {
+ if (!_tcscmp (tmpbuf, L"disabled")) {
p->win32_rtgvblankrate = -2;
return 1;
}
- if (!strcmp (tmpbuf, "chipset")) {
+ if (!_tcscmp (tmpbuf, L"chipset")) {
p->win32_rtgvblankrate = 0;
return 1;
}
- p->win32_rtgvblankrate = atol (tmpbuf);
+ p->win32_rtgvblankrate = _tstol (tmpbuf);
return 1;
}
- if (cfgfile_string (option, value, "rtg_scale_aspect_ratio", tmpbuf, sizeof tmpbuf)) {
+ if (cfgfile_string (option, value, L"rtg_scale_aspect_ratio", tmpbuf, sizeof tmpbuf) / sizeof (TCHAR)) {
int v1, v2;
- char *s;
+ TCHAR *s;
p->gfx_filter_aspect = -1;
- v1 = atol (tmpbuf);
- s = strchr (tmpbuf, ':');
+ v1 = _tstol (tmpbuf);
+ s = _tcschr (tmpbuf, ':');
if (s) {
- v2 = atol (s + 1);
+ v2 = _tstol (s + 1);
if (v1 < 0 || v2 < 0)
p->gfx_filter_aspect = -1;
else if (v1 == 0 || v2 == 0)
return 1;
}
- if (cfgfile_strval (option, value, "uaescsimode", &p->win32_uaescsimode, scsimode, 0))
+ if (cfgfile_strval (option, value, L"uaescsimode", &p->win32_uaescsimode, scsimode, 0))
return 1;
- if (cfgfile_intval (option, value, "active_priority", &v, 1)) {
+ if (cfgfile_intval (option, value, L"active_priority", &v, 1)) {
p->win32_active_priority = fetchpri (v, 1);
return 1;
}
- if (cfgfile_intval (option, value, "activepriority", &v, 1)) {
+ if (cfgfile_intval (option, value, L"activepriority", &v, 1)) {
p->win32_active_priority = fetchpri (v, 1);
return 1;
}
- if (cfgfile_intval (option, value, "inactive_priority", &v, 1)) {
+ if (cfgfile_intval (option, value, L"inactive_priority", &v, 1)) {
p->win32_inactive_priority = fetchpri (v, 1);
return 1;
}
- if (cfgfile_intval (option, value, "iconified_priority", &v, 1)) {
+ if (cfgfile_intval (option, value, L"iconified_priority", &v, 1)) {
p->win32_iconified_priority = fetchpri (v, 2);
return 1;
}
- if (cfgfile_string (option, value, "serial_port", &p->sername[0], 256)) {
+ if (cfgfile_string (option, value, L"serial_port", &p->sername[0], 256)) {
sernametodev(p->sername);
if (p->sername[0])
p->use_serial = 1;
return 1;
}
- if (cfgfile_string (option, value, "parallel_port", &p->prtname[0], 256)) {
- if (!strcmp(p->prtname, "none"))
+ if (cfgfile_string (option, value, L"parallel_port", &p->prtname[0], 256)) {
+ if (!_tcscmp(p->prtname, L"none"))
p->prtname[0] = 0;
return 1;
}
i = 0;
while (obsolete[i]) {
if (!strcasecmp (obsolete[i], option)) {
- write_log ("obsolete config entry '%s'\n", option);
+ write_log (L"obsolete config entry '%s'\n", option);
return 1;
}
i++;
return result;
}
-static void createdir (const char *path)
+static void createdir (const TCHAR *path)
{
CreateDirectory (path, NULL);
}
-void fetch_saveimagepath (char *out, int size, int dir)
+void fetch_saveimagepath (TCHAR *out, int size, int dir)
{
- fetch_path ("SaveimagePath", out, size);
+ assert (size > MAX_DPATH);
+ fetch_path (L"SaveimagePath", out, size);
if (dir) {
- out[strlen (out) - 1] = 0;
+ out[_tcslen (out) - 1] = 0;
createdir (out);
- fetch_path ("SaveimagePath", out, size);
+ fetch_path (L"SaveimagePath", out, size);
}
}
-void fetch_configurationpath (char *out, int size)
+void fetch_configurationpath (TCHAR *out, int size)
{
- fetch_path ("ConfigurationPath", out, size);
+ fetch_path (L"ConfigurationPath", out, size);
}
-void fetch_screenshotpath (char *out, int size)
+void fetch_screenshotpath (TCHAR *out, int size)
{
- fetch_path ("ScreenshotPath", out, size);
+ fetch_path (L"ScreenshotPath", out, size);
}
-void fetch_ripperpath (char *out, int size)
+void fetch_ripperpath (TCHAR *out, int size)
{
- fetch_path ("RipperPath", out, size);
+ fetch_path (L"RipperPath", out, size);
}
-void fetch_datapath (char *out, int size)
+void fetch_datapath (TCHAR *out, int size)
{
fetch_path (NULL, out, size);
}
-static int isfilesindir(char *p)
+static int isfilesindir (TCHAR *p)
{
WIN32_FIND_DATA fd;
HANDLE h;
- char path[MAX_DPATH];
+ TCHAR path[MAX_DPATH];
int i = 0;
DWORD v;
v = GetFileAttributes (p);
if (v == INVALID_FILE_ATTRIBUTES || !(v & FILE_ATTRIBUTE_DIRECTORY))
return 0;
- strcpy (path, p);
- strcat (path, "\\*.*");
+ _tcscpy (path, p);
+ _tcscat (path, L"\\*.*");
h = FindFirstFile (path, &fd);
if (h != INVALID_HANDLE_VALUE) {
for (i = 0; i < 3; i++) {
return 0;
}
-void fetch_path (char *name, char *out, int size)
+void fetch_path (TCHAR *name, TCHAR *out, int size)
{
int size2 = size;
- strcpy (out, start_path_data);
+ _tcscpy (out, start_path_data);
if (!name)
return;
- if (!strcmp (name, "FloppyPath"))
- strcat (out, "..\\shared\\adf\\");
- if (!strcmp (name, "hdfPath"))
- strcat (out, "..\\shared\\hdf\\");
- if (!strcmp (name, "KickstartPath"))
- strcat (out, "..\\shared\\rom\\");
- if (!strcmp (name, "ConfigurationPath"))
- strcat (out, "Configurations\\");
+ if (!_tcscmp (name, L"FloppyPath"))
+ _tcscat (out, L"..\\shared\\adf\\");
+ if (!_tcscmp (name, L"hdfPath"))
+ _tcscat (out, L"..\\shared\\hdf\\");
+ if (!_tcscmp (name, L"KickstartPath"))
+ _tcscat (out, L"..\\shared\\rom\\");
+ if (!_tcscmp (name, L"ConfigurationPath"))
+ _tcscat (out, L"Configurations\\");
if (start_data >= 0)
regquerystr (NULL, name, out, &size);
- if (out[0] == '\\' && (strlen(out) >= 2 && out[1] != '\\')) { /* relative? */
- strcpy (out, start_path_data);
+ if (out[0] == '\\' && (_tcslen (out) >= 2 && out[1] != '\\')) { /* relative? */
+ _tcscpy (out, start_path_data);
if (start_data >= 0) {
- size2 -= strlen (out);
+ size2 -= _tcslen (out);
regquerystr (NULL, name, out, &size2);
}
}
strip_slashes (out);
- if (!strcmp (name, "KickstartPath")) {
+ if (!_tcscmp (name, L"KickstartPath")) {
DWORD v = GetFileAttributes (out);
if (v == INVALID_FILE_ATTRIBUTES || !(v & FILE_ATTRIBUTE_DIRECTORY))
- strcpy (out, start_path_data);
+ _tcscpy (out, start_path_data);
}
fixtrailing (out);
}
-int get_rom_path(char *out, int mode)
+int get_rom_path(TCHAR *out, int mode)
{
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
tmp[0] = 0;
switch (mode)
{
case 0:
{
- if (!strcmp (start_path_data, start_path_exe))
- strcpy (tmp, ".\\");
+ if (!_tcscmp (start_path_data, start_path_exe))
+ _tcscpy (tmp, L".\\");
else
- strcpy (tmp, start_path_data);
+ _tcscpy (tmp, start_path_data);
if (GetFileAttributes (tmp) != INVALID_FILE_ATTRIBUTES) {
- char tmp2[MAX_DPATH];
- strcpy (tmp2, tmp);
- strcat (tmp2, "rom");
+ TCHAR tmp2[MAX_DPATH];
+ _tcscpy (tmp2, tmp);
+ _tcscat (tmp2, L"rom");
if (GetFileAttributes (tmp2) != INVALID_FILE_ATTRIBUTES) {
- strcpy (tmp, tmp2);
+ _tcscpy (tmp, tmp2);
} else {
- strcpy (tmp2, tmp);
- strcpy (tmp2, "roms");
+ _tcscpy (tmp2, tmp);
+ _tcscpy (tmp2, L"roms");
if (GetFileAttributes (tmp2) != INVALID_FILE_ATTRIBUTES)
- strcpy (tmp, tmp2);
+ _tcscpy (tmp, tmp2);
}
}
}
break;
case 1:
{
- char tmp2[MAX_DPATH];
- strcpy (tmp2, start_path_new1);
- strcat (tmp2, "..\\system\\rom");
+ TCHAR tmp2[MAX_DPATH];
+ _tcscpy (tmp2, start_path_new1);
+ _tcscat (tmp2, L"..\\system\\rom");
if (isfilesindir (tmp2))
- strcpy (tmp, tmp2);
+ _tcscpy (tmp, tmp2);
}
break;
case 2:
{
- char tmp2[MAX_DPATH];
- strcpy (tmp2, start_path_new2);
- strcat (tmp2, "system\\rom");
+ TCHAR tmp2[MAX_DPATH];
+ _tcscpy (tmp2, start_path_new2);
+ _tcscat (tmp2, L"system\\rom");
if (isfilesindir (tmp2))
- strcpy (tmp, tmp2);
+ _tcscpy (tmp, tmp2);
}
break;
case 3:
{
- char tmp2[MAX_DPATH];
- strcpy (tmp2, start_path_af);
- strcat (tmp2, "..\\shared\\rom");
+ TCHAR tmp2[MAX_DPATH];
+ _tcscpy (tmp2, start_path_af);
+ _tcscat (tmp2, L"..\\shared\\rom");
if (isfilesindir (tmp2))
- strcpy (tmp, tmp2);
+ _tcscpy (tmp, tmp2);
}
break;
default:
return -1;
}
if (isfilesindir (tmp)) {
- strcpy (out, tmp);
+ _tcscpy (out, tmp);
fixtrailing (out);
}
return out[0] ? 1 : 0;
-void set_path (char *name, char *path)
+void set_path (TCHAR *name, TCHAR *path)
{
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
if (!path) {
- if (!strcmp (start_path_data, start_path_exe))
- strcpy (tmp, ".\\");
+ if (!_tcscmp (start_path_data, start_path_exe))
+ _tcscpy (tmp, L".\\");
else
- strcpy (tmp, start_path_data);
- if (!strcmp (name, "KickstartPath"))
- strcat (tmp, "Roms");
- if (!strcmp (name, "ConfigurationPath"))
- strcat (tmp, "Configurations");
- if (!strcmp (name, "ScreenshotPath"))
- strcat (tmp, "Screenshots");
- if (!strcmp (name, "StatefilePath"))
- strcat (tmp, "Savestates");
- if (!strcmp (name, "SaveimagePath"))
- strcat (tmp, "SaveImages");
- if (!strcmp (name, "InputPath"))
- strcat (tmp, "Inputrecordings");
+ _tcscpy (tmp, start_path_data);
+ if (!_tcscmp (name, L"KickstartPath"))
+ _tcscat (tmp, L"Roms");
+ if (!_tcscmp (name, L"ConfigurationPath"))
+ _tcscat (tmp, L"Configurations");
+ if (!_tcscmp (name, L"ScreenshotPath"))
+ _tcscat (tmp, L"Screenshots");
+ if (!_tcscmp (name, L"StatefilePath"))
+ _tcscat (tmp, L"Savestates");
+ if (!_tcscmp (name, L"SaveimagePath"))
+ _tcscat (tmp, L"SaveImages");
+ if (!_tcscmp (name, L"InputPath"))
+ _tcscat (tmp, L"Inputrecordings");
} else {
- strcpy (tmp, path);
+ _tcscpy (tmp, path);
}
strip_slashes (tmp);
- if (!strcmp (name, "KickstartPath")) {
+ if (!_tcscmp (name, L"KickstartPath")) {
DWORD v = GetFileAttributes (tmp);
if (v == INVALID_FILE_ATTRIBUTES || !(v & FILE_ATTRIBUTE_DIRECTORY))
get_rom_path (tmp, 0);
regsetstr (NULL, name, tmp);
}
-static void initpath (char *name, char *path)
+static void initpath (TCHAR *name, TCHAR *path)
{
if (regexists (NULL, name))
return;
set_path (name, NULL);
}
-static void romlist_add2 (char *path, struct romdata *rd)
+static void romlist_add2 (TCHAR *path, struct romdata *rd)
{
if (getregmode ()) {
int ok = 0;
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
if (path[0] == '/' || path[0] == '\\')
ok = 1;
- if (strlen (path) > 1 && path[1] == ':')
+ if (_tcslen (path) > 1 && path[1] == ':')
ok = 1;
if (!ok) {
- strcpy (tmp, start_path_exe);
- strcat (tmp, path);
+ _tcscpy (tmp, start_path_exe);
+ _tcscat (tmp, path);
romlist_add (tmp, rd);
return;
}
extern int scan_roms (int);
void read_rom_list (void)
{
- char tmp2[1000];
+ TCHAR tmp2[1000];
int idx, idx2;
UAEREG *fkey;
- char tmp[1000];
+ TCHAR tmp[1000];
int size, size2, exists;
romlist_clear ();
- exists = regexiststree (NULL, "DetectedROMs");
- fkey = regcreatetree (NULL, "DetectedROMs");
+ exists = regexiststree (NULL, L"DetectedROMs");
+ fkey = regcreatetree (NULL, L"DetectedROMs");
if (fkey == NULL)
return;
if (!exists || forceroms) {
forceroms = 0;
idx = 0;
for (;;) {
- size = sizeof (tmp);
- size2 = sizeof (tmp2);
+ size = sizeof (tmp) / sizeof (TCHAR);
+ size2 = sizeof (tmp2) / sizeof (TCHAR);
if (!regenumstr (fkey, idx, tmp, &size, tmp2, &size2))
break;
- if (strlen (tmp) == 7 || strlen (tmp) == 13) {
+ if (_tcslen (tmp) == 7 || _tcslen (tmp) == 13) {
int group = 0;
int subitem = 0;
- idx2 = atol (tmp + 4);
- if (strlen (tmp) == 13) {
- group = atol (tmp + 8);
- subitem = atol (tmp + 11);
+ idx2 = _tstol (tmp + 4);
+ if (_tcslen (tmp) == 13) {
+ group = _tstol (tmp + 8);
+ subitem = _tstol (tmp + 11);
}
- if (idx2 >= 0 && strlen (tmp2) > 0) {
+ if (idx2 >= 0 && _tcslen (tmp2) > 0) {
struct romdata *rd = getromdatabyidgroup (idx2, group, subitem);
if (rd) {
- char *s = strchr (tmp2, '\"');
- if (s && strlen (s) > 1) {
- char *s2 = my_strdup (s + 1);
- s = strchr (s2, '\"');
+ TCHAR *s = _tcschr (tmp2, '\"');
+ if (s && _tcslen (s) > 1) {
+ TCHAR *s2 = my_strdup (s + 1);
+ s = _tcschr (s2, '\"');
if (s)
*s = 0;
romlist_add2 (s2, rd);
regclosetree (fkey);
}
-static int parseversion (char **vs)
+static int parseversion (TCHAR **vs)
{
- char tmp[10];
+ TCHAR tmp[10];
int i;
i = 0;
while (**vs >= '0' && **vs <= '9') {
- if (i >= sizeof (tmp))
+ if (i >= sizeof (tmp) / sizeof (TCHAR))
return 0;
tmp[i++] = **vs;
(*vs)++;
if (**vs == '.')
(*vs)++;
tmp[i] = 0;
- return atol (tmp);
+ return _tstol (tmp);
}
-static int checkversion (char *vs)
+static int checkversion (TCHAR *vs)
{
- if (strlen (vs) < 10)
+ if (_tcslen (vs) < 10)
return 0;
- if (memcmp (vs, "WinUAE ", 7))
+ if (_tcsncmp (vs, L"WinUAE L", 7))
return 0;
vs += 7;
if (parseversion (&vs) > UAEMAJOR)
return 1;
}
-static int shell_deassociate (const char *extension)
+static int shell_deassociate (const TCHAR *extension)
{
HKEY rkey;
- const char *progid = "WinUAE";
- int def = !strcmp (extension, ".uae");
- char rpath1[MAX_DPATH], rpath2[MAX_DPATH], progid2[MAX_DPATH];
+ const TCHAR *progid = L"WinUAE";
+ int def = !_tcscmp (extension, L".uae");
+ TCHAR rpath1[MAX_DPATH], rpath2[MAX_DPATH], progid2[MAX_DPATH];
UAEREG *fkey;
- if (extension == NULL || strlen (extension) < 1 || extension[0] != '.')
+ if (extension == NULL || _tcslen (extension) < 1 || extension[0] != '.')
return 0;
- strcpy (progid2, progid);
- strcat (progid2, extension);
+ _tcscpy (progid2, progid);
+ _tcscat (progid2, extension);
if (os_winnt_admin > 1)
rkey = HKEY_LOCAL_MACHINE;
else
rkey = HKEY_CURRENT_USER;
- strcpy (rpath1, "Software\\Classes\\");
- strcpy (rpath2, rpath1);
- strcat (rpath2, extension);
+ _tcscpy (rpath1, L"Software\\Classes\\");
+ _tcscpy (rpath2, rpath1);
+ _tcscat (rpath2, extension);
if (RegDeleteKey (rkey, rpath2) != ERROR_SUCCESS)
return 0;
- strcpy (rpath2, rpath1);
- strcat (rpath2, progid);
+ _tcscpy (rpath2, rpath1);
+ _tcscat (rpath2, progid);
if (!def)
- strcat (rpath2, extension);
+ _tcscat (rpath2, extension);
SHDeleteKey (rkey, rpath2);
- fkey = regcreatetree (NULL, "FileAssociations");
+ fkey = regcreatetree (NULL, L"FileAssociations");
regdelete (fkey, extension);
regclosetree (fkey);
return 1;
}
-static int shell_associate_2 (const char *extension, const char *shellcommand, const char *command, const char *perceivedtype,
- const char *description, const char *ext2)
+static int shell_associate_2 (const TCHAR *extension, const TCHAR *shellcommand, const TCHAR *command, const TCHAR *perceivedtype,
+ const TCHAR *description, const TCHAR *ext2)
{
- char rpath1[MAX_DPATH], rpath2[MAX_DPATH], progid2[MAX_DPATH];
+ TCHAR rpath1[MAX_DPATH], rpath2[MAX_DPATH], progid2[MAX_DPATH];
HKEY rkey, key1;
DWORD disposition;
- const char *progid = "WinUAE";
- int def = !strcmp (extension, ".uae");
+ const TCHAR *progid = L"WinUAE";
+ int def = !_tcscmp (extension, L".uae");
UAEREG *fkey;
- strcpy (progid2, progid);
- strcat (progid2, ext2 ? ext2 : extension);
+ _tcscpy (progid2, progid);
+ _tcscat (progid2, ext2 ? ext2 : extension);
if (os_winnt_admin > 1)
rkey = HKEY_LOCAL_MACHINE;
else
rkey = HKEY_CURRENT_USER;
- strcpy (rpath1, "Software\\Classes\\");
- strcpy (rpath2, rpath1);
- strcat (rpath2, extension);
+ _tcscpy (rpath1, L"Software\\Classes\\");
+ _tcscpy (rpath2, rpath1);
+ _tcscat (rpath2, extension);
if (RegCreateKeyEx (rkey, rpath2, 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_WRITE | KEY_READ, NULL, &key1, &disposition) == ERROR_SUCCESS) {
- RegSetValueEx (key1, "", 0, REG_SZ, (CONST BYTE *)(def ? progid : progid2), strlen (def ? progid : progid2) + 1);
+ RegSetValueEx (key1, L"", 0, REG_SZ, (CONST BYTE *)(def ? progid : progid2), (_tcslen (def ? progid : progid2) + 1) * sizeof (TCHAR));
if (perceivedtype)
- RegSetValueEx (key1, "PerceivedType", 0, REG_SZ, (CONST BYTE *)perceivedtype, strlen (perceivedtype) + 1);
+ RegSetValueEx (key1, L"PerceivedType", 0, REG_SZ, (CONST BYTE *)perceivedtype, (_tcslen (perceivedtype) + 1) * sizeof (TCHAR));
RegCloseKey (key1);
}
- strcpy (rpath2, rpath1);
- strcat (rpath2, progid);
+ _tcscpy (rpath2, rpath1);
+ _tcscat (rpath2, progid);
if (!def)
- strcat (rpath2, ext2 ? ext2 : extension);
+ _tcscat (rpath2, ext2 ? ext2 : extension);
if (description) {
if (RegCreateKeyEx (rkey, rpath2, 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_WRITE | KEY_READ, NULL, &key1, &disposition) == ERROR_SUCCESS) {
- RegSetValueEx (key1, "", 0, REG_SZ, (CONST BYTE *)description, strlen (description) + 1);
+ RegSetValueEx (key1, L"", 0, REG_SZ, (CONST BYTE *)description, (_tcslen (description) + 1) * sizeof (TCHAR));
RegCloseKey (key1);
}
}
if (command) {
- strcat (rpath2, "\\shell\\");
+ _tcscat (rpath2, L"\\shell\\");
if (shellcommand)
- strcat (rpath2, shellcommand);
+ _tcscat (rpath2, shellcommand);
else
- strcat (rpath2, "open");
- strcat (rpath2, "\\command");
+ _tcscat (rpath2, L"open");
+ _tcscat (rpath2, L"\\command");
if (RegCreateKeyEx (rkey, rpath2, 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_WRITE | KEY_READ, NULL, &key1, &disposition) == ERROR_SUCCESS) {
- char path[MAX_DPATH];
- sprintf (path, "\"%sWinUAE.exe\" %s", start_path_exe, command);
- RegSetValueEx (key1, "", 0, REG_SZ, (CONST BYTE *)path, strlen (path) + 1);
+ TCHAR path[MAX_DPATH];
+ _stprintf (path, L"\"%sWinUAE.exe\" %s", start_path_exe, command);
+ RegSetValueEx (key1, L"", 0, REG_SZ, (CONST BYTE *)path, (_tcslen (path) + 1) * sizeof (TCHAR));
RegCloseKey (key1);
}
}
- fkey = regcreatetree (NULL, "FileAssociations");
- regsetstr (fkey, extension, "");
+ fkey = regcreatetree (NULL, L"FileAssociations");
+ regsetstr (fkey, extension, L"");
regclosetree (fkey);
return 1;
}
-static int shell_associate (const char *extension, const char *command, const char *perceivedtype, const char *description, const char *ext2)
+static int shell_associate (const TCHAR *extension, const TCHAR *command, const TCHAR *perceivedtype, const TCHAR *description, const TCHAR *ext2)
{
int v = shell_associate_2 (extension, NULL, command, perceivedtype, description, ext2);
- if (!strcmp (extension, ".uae"))
- shell_associate_2 (extension, "edit", "-f \"%1\" -s use_gui=yes", "text", description, NULL);
+ if (!_tcscmp (extension, L".uae"))
+ shell_associate_2 (extension, L"edit", L"-f \"%1\" -s use_gui=yes", L"text", description, NULL);
return v;
}
-static int shell_associate_is (const char *extension)
+static int shell_associate_is (const TCHAR *extension)
{
- char rpath1[MAX_DPATH], rpath2[MAX_DPATH];
- char progid2[MAX_DPATH], tmp[MAX_DPATH];
+ TCHAR rpath1[MAX_DPATH], rpath2[MAX_DPATH];
+ TCHAR progid2[MAX_DPATH], tmp[MAX_DPATH];
DWORD size;
HKEY rkey, key1;
- const char *progid = "WinUAE";
- int def = !strcmp (extension, ".uae");
+ const TCHAR *progid = L"WinUAE";
+ int def = !_tcscmp (extension, L".uae");
- strcpy (progid2, progid);
- strcat (progid2, extension);
+ _tcscpy (progid2, progid);
+ _tcscat (progid2, extension);
if (os_winnt_admin > 1)
rkey = HKEY_LOCAL_MACHINE;
else
rkey = HKEY_CURRENT_USER;
- strcpy (rpath1, "Software\\Classes\\");
- strcpy (rpath2, rpath1);
- strcat (rpath2, extension);
+ _tcscpy (rpath1, L"Software\\Classes\\");
+ _tcscpy (rpath2, rpath1);
+ _tcscat (rpath2, extension);
size = sizeof tmp;
if (RegOpenKeyEx (rkey, rpath2, 0, KEY_READ, &key1) == ERROR_SUCCESS) {
- if (RegQueryValueEx (key1, NULL, NULL, NULL, tmp, &size) == ERROR_SUCCESS) {
- if (strcmp (tmp, def ? progid : progid2)) {
+ if (RegQueryValueEx (key1, NULL, NULL, NULL, (LPBYTE)tmp, &size) == ERROR_SUCCESS) {
+ if (_tcscmp (tmp, def ? progid : progid2)) {
RegCloseKey (key1);
return 0;
}
}
RegCloseKey (key1);
}
- strcpy (rpath2, rpath1);
- strcat (rpath2, progid);
+ _tcscpy (rpath2, rpath1);
+ _tcscat (rpath2, progid);
if (!def)
- strcat (rpath2, extension);
+ _tcscat (rpath2, extension);
if (RegOpenKeyEx (rkey, rpath2, 0, KEY_READ, &key1) == ERROR_SUCCESS) {
RegCloseKey (key1);
return 1;
}
struct assext exts[] = {
- { ".uae", "-f \"%1\"", "WinUAE configuration file", },
- { ".adf", "-0 \"%1\" -s use_gui=no", "WinUAE floppy disk image" },
- { ".adz", "-0 \"%1\" -s use_gui=no", "WinUAE floppy disk image" },
- { ".dms", "-0 \"%1\" -s use_gui=no", "WinUAE floppy disk image" },
- { ".fdi", "-0 \"%1\" -s use_gui=no", "WinUAE floppy disk image" },
- { ".ipf", "-0 \"%1\" -s use_gui=no", "WinUAE floppy disk image" },
- { ".uss", "-s statefile=\"%1\" -s use_gui=no", "WinUAE statefile" },
+ { L".uae", L"-f \"%1\"", L"WinUAE configuration file", },
+ { L".adf", L"-0 \"%1\" -s use_gui=no", L"WinUAE floppy disk image" },
+ { L".adz", L"-0 \"%1\" -s use_gui=no", L"WinUAE floppy disk image" },
+ { L".dms", L"-0 \"%1\" -s use_gui=no", L"WinUAE floppy disk image" },
+ { L".fdi", L"-0 \"%1\" -s use_gui=no", L"WinUAE floppy disk image" },
+ { L".ipf", L"-0 \"%1\" -s use_gui=no", L"WinUAE floppy disk image" },
+ { L".uss", L"-s statefile=\"%1\" -s use_gui=no", L"WinUAE statefile" },
{ NULL }
};
exts[i].enabled = 1;
}
// associate .uae by default when running for the first time
- if (!regexiststree (NULL, "FileAssociations")) {
+ if (!regexiststree (NULL, L"FileAssociations")) {
UAEREG *fkey;
if (exts[0].enabled == 0) {
shell_associate (exts[0].ext, exts[0].cmd, NULL, exts[0].desc, NULL);
exts[0].enabled = shell_associate_is (exts[0].ext);
}
- fkey = regcreatetree (NULL, "FileAssociations");
- regsetstr (fkey, exts[0].ext, "");
+ fkey = regcreatetree (NULL, L"FileAssociations");
+ regsetstr (fkey, exts[0].ext, L"");
regclosetree (fkey);
}
#if 0
UAEREG *fkey;
- fkey = regcreatetree (NULL, "FileAssociations");
+ fkey = regcreatetree (NULL, L"FileAssociations");
if (fkey) {
int ok = 1;
- char tmp[MAX_DPATH];
- strcpy (tmp, "Following file associations:\n");
+ TCHAR tmp[MAX_DPATH];
+ _tcscpy (tmp, L"Following file associations:\n");
for (i = 0; exts[i].ext; i++) {
- char tmp2[10];
+ TCHAR tmp2[10];
int size = sizeof tmp;
int is1 = exts[i].enabled;
int is2 = regquerystr (fkey, exts[i].ext, tmp2, &size);
if (is1 == 0 && is2 != 0) {
- strcat (tmp, exts[i].ext);
- strcat (tmp, "\n");
+ _tcscat (tmp, exts[i].ext);
+ _tcscat (tmp, L"\n");
ok = 0;
}
}
if (!ok) {
- char szTitle[MAX_DPATH];
+ TCHAR szTitle[MAX_DPATH];
WIN32GUI_LoadUIString (IDS_ERRORTITLE, szTitle, MAX_DPATH);
- strcat (szTitle, BetaStr);
+ _tcscat (szTitle, BetaStr);
if (MessageBox (NULL, tmp, szTitle, MB_YESNO | MB_TASKMODAL) == IDOK) {
for (i = 0; exts[i].ext; i++) {
- char tmp2[10];
+ TCHAR tmp2[10];
int size = sizeof tmp;
int is1 = exts[i].enabled;
int is2 = regquerystr (fkey, exts[i].ext, tmp2, &size);
DWORD dwType = REG_DWORD;
DWORD dwDisplayInfoSize = sizeof (colortype);
DWORD size;
- char path[MAX_DPATH] = "";
- char version[100];
-
- initpath ("FloppyPath", start_path_data);
- initpath ("KickstartPath", start_path_data);
- initpath ("hdfPath", start_path_data);
- initpath ("ConfigurationPath", start_path_data);
- initpath ("ScreenshotPath", start_path_data);
- initpath ("StatefilePath", start_path_data);
- initpath ("SaveimagePath", start_path_data);
- initpath ("VideoPath", start_path_data);
- initpath ("InputPath", start_path_data);
- if (!regexists (NULL, "MainPosX") || !regexists (NULL, "GUIPosX")) {
+ TCHAR path[MAX_DPATH] = L"";
+ TCHAR version[100];
+
+ initpath (L"FloppyPath", start_path_data);
+ initpath (L"KickstartPath", start_path_data);
+ initpath (L"hdfPath", start_path_data);
+ initpath (L"ConfigurationPath", start_path_data);
+ initpath (L"ScreenshotPath", start_path_data);
+ initpath (L"StatefilePath", start_path_data);
+ initpath (L"SaveimagePath", start_path_data);
+ initpath (L"VideoPath", start_path_data);
+ initpath (L"InputPath", start_path_data);
+ if (!regexists (NULL, L"MainPosX") || !regexists (NULL, L"GUIPosX")) {
int x = GetSystemMetrics (SM_CXSCREEN);
int y = GetSystemMetrics (SM_CYSCREEN);
x = (x - 800) / 2;
if (y < 10)
y = 10;
/* Create and initialize all our sub-keys to the default values */
- regsetint (NULL, "MainPosX", x);
- regsetint (NULL, "MainPosY", y);
- regsetint (NULL, "GUIPosX", x);
- regsetint (NULL, "GUIPosY", y);
+ regsetint (NULL, L"MainPosX", x);
+ regsetint (NULL, L"MainPosY", y);
+ regsetint (NULL, L"GUIPosX", x);
+ regsetint (NULL, L"GUIPosY", y);
}
- size = sizeof (version);
- if (regquerystr (NULL, "Version", version, &size)) {
+ size = sizeof (version) / sizeof (TCHAR);
+ if (regquerystr (NULL, L"Version", version, &size)) {
if (checkversion (version))
- regsetstr (NULL, "Version", VersionStr);
+ regsetstr (NULL, L"Version", VersionStr);
} else {
- regsetstr (NULL, "Version", VersionStr);
+ regsetstr (NULL, L"Version", VersionStr);
}
- size = sizeof (version);
- if (regquerystr (NULL, "ROMCheckVersion", version, &size)) {
+ size = sizeof (version) / sizeof (TCHAR);
+ if (regquerystr (NULL, L"ROMCheckVersion", version, &size)) {
if (checkversion (version)) {
- if (regsetstr (NULL, "ROMCheckVersion", VersionStr))
+ if (regsetstr (NULL, L"ROMCheckVersion", VersionStr))
forceroms = 1;
}
} else {
- if (regsetstr (NULL, "ROMCheckVersion", VersionStr))
- forceroms = 1;
+ if (regsetstr (NULL, L"ROMCheckVersion", VersionStr))
+ forceroms = 1;
}
- regqueryint (NULL, "DirectDraw_Secondary", &ddforceram);
- if (regexists (NULL, "ConfigurationCache"))
- regqueryint (NULL, "ConfigurationCache", &configurationcache);
+ regqueryint (NULL, L"DirectDraw_Secondary", &ddforceram);
+ if (regexists (NULL, L"ConfigurationCache"))
+ regqueryint (NULL, L"ConfigurationCache", &configurationcache);
else
- regsetint (NULL, "ConfigurationCache", configurationcache);
- regqueryint (NULL, "QuickStartMode", &quickstart);
+ regsetint (NULL, L"ConfigurationCache", configurationcache);
+ regqueryint (NULL, L"QuickStartMode", &quickstart);
reopen_console ();
- fetch_path ("ConfigurationPath", path, sizeof (path));
- path[strlen (path) - 1] = 0;
+ fetch_path (L"ConfigurationPath", path, sizeof (path) / sizeof (TCHAR));
+ path[_tcslen (path) - 1] = 0;
createdir (path);
- strcat (path, "\\Host");
+ _tcscat (path, L"\\Host");
createdir (path);
- fetch_path ("ConfigurationPath", path, sizeof (path));
- strcat (path, "Hardware");
+ fetch_path (L"ConfigurationPath", path, sizeof (path) / sizeof (TCHAR));
+ _tcscat (path, L"Hardware");
createdir (path);
- fetch_path ("StatefilePath", path, sizeof (path));
+ fetch_path (L"StatefilePath", path, sizeof (path) / sizeof (TCHAR));
createdir (path);
- strcat (path, "default.uss");
- strcpy (savestate_fname, path);
- fetch_path ("InputPath", path, sizeof (path));
+ _tcscat (path, L"default.uss");
+ _tcscpy (savestate_fname, path);
+ fetch_path (L"InputPath", path, sizeof (path) / sizeof (TCHAR));
createdir (path);
regclosetree (read_disk_history ());
associate_init_extensions ();
}
#if WINUAEPUBLICBETA > 0
-static char *BETAMESSAGE = {
- "This is unstable beta software. Click cancel if you are not comfortable using software that is incomplete and can have serious programming errors."
+static TCHAR *BETAMESSAGE = {
+ L"This is unstable beta software. Click cancel if you are not comfortable using software that is incomplete and can have serious programming errors."
};
#endif
for (;;) {
FILETIME ft, sft;
SYSTEMTIME st;
- char tmp1[MAX_DPATH];
+ TCHAR tmp1[MAX_DPATH];
if (!hWinUAEKey)
break;
- if (GetModuleFileName (NULL, tmp1, sizeof tmp1) == 0)
+ if (GetModuleFileName (NULL, tmp1, sizeof tmp1 / sizeof (TCHAR)) == 0)
break;
h = CreateFile (tmp1, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (h == INVALID_HANDLE_VALUE)
ft64.HighPart = ft.dwHighDateTime;
dwType = REG_QWORD;
size = sizeof regft64;
- if (RegQueryValueEx (hWinUAEKey, "BetaToken", 0, &dwType, (LPBYTE)®ft64, &size) != ERROR_SUCCESS)
+ if (RegQueryValueEx (hWinUAEKey, L"BetaToken", 0, &dwType, (LPBYTE)®ft64, &size) != ERROR_SUCCESS)
break;
GetSystemTime(&st);
SystemTimeToFileTime(&st, &sft);
CloseHandle (h);
if (showmsg) {
int r;
- char title[MAX_DPATH];
+ TCHAR title[MAX_DPATH];
dwType = REG_DWORD;
size = sizeof data;
- if (hWinUAEKey && RegQueryValueEx (hWinUAEKey, "Beta_Just_Shut_Up", 0, &dwType, (LPBYTE)&data, &size) == ERROR_SUCCESS) {
+ if (hWinUAEKey && RegQueryValueEx (hWinUAEKey, L"Beta_Just_Shut_Up", 0, &dwType, (LPBYTE)&data, &size) == ERROR_SUCCESS) {
if (data == 68000) {
- write_log ("I was told to shut up :(\n");
+ write_log (L"I was told to shut up :(\n");
return 1;
}
}
t = _gmtime64 (<ime);
/* "expire" in 1 month */
if (MAKEBD(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday) > WINUAEDATE + 100)
- pre_gui_message ("This beta build of WinUAE is obsolete.\nPlease download newer version.");
+ pre_gui_message (L"This beta build of WinUAE is obsolete.\nPlease download newer version.");
- strcpy (title, "WinUAE Public Beta Disclaimer");
- strcat (title, BetaStr);
+ _tcscpy (title, L"WinUAE Public Beta Disclaimer");
+ _tcscat (title, BetaStr);
r = MessageBox (NULL, BETAMESSAGE, title, MB_OKCANCEL | MB_TASKMODAL | MB_SETFOREGROUND | MB_ICONWARNING | MB_DEFBUTTON2);
if (r == IDABORT || r == IDCANCEL)
return 0;
if (ft64.QuadPart > 0) {
regft64 = ft64.QuadPart;
- RegSetValueEx (hWinUAEKey, "BetaToken", 0, REG_QWORD, (LPBYTE)®ft64, sizeof regft64);
+ RegSetValueEx (hWinUAEKey, L"BetaToken", 0, REG_QWORD, (LPBYTE)®ft64, sizeof regft64);
}
}
#endif
{
#if !defined(WIN64)
/* believe or not but this is MS supported way of detecting DX8+ */
- HMODULE h = LoadLibrary ("D3D8.DLL");
- char szWrongDXVersion[MAX_DPATH];
+ HMODULE h = LoadLibrary (L"D3D8.DLL");
+ TCHAR szWrongDXVersion[MAX_DPATH];
if (h) {
FreeLibrary (h);
return 1;
// Open a handle to the access token for the calling process.
if (!OpenProcessToken (GetCurrentProcess (), TOKEN_QUERY, &hToken)) {
- write_log ("OpenProcessToken Error %u\n", GetLastError ());
+ write_log (L"OpenProcessToken Error %u\n", GetLastError ());
return FALSE;
}
if(!GetTokenInformation (hToken, TokenGroups, NULL, dwSize, &dwSize)) {
dwResult = GetLastError ();
if(dwResult != ERROR_INSUFFICIENT_BUFFER) {
- write_log ("GetTokenInformation Error %u\n", dwResult);
+ write_log (L"GetTokenInformation Error %u\n", dwResult);
return FALSE;
}
}
// Call GetTokenInformation again to get the group information.
if (!GetTokenInformation (hToken, TokenGroups, pGroupInfo, dwSize, &dwSize)) {
- write_log ("GetTokenInformation Error %u\n", GetLastError ());
+ write_log (L"GetTokenInformation Error %u\n", GetLastError ());
return FALSE;
}
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0,
&pSID)) {
- write_log ("AllocateAndInitializeSid Error %u\n", GetLastError ());
+ write_log (L"AllocateAndInitializeSid Error %u\n", GetLastError ());
return FALSE;
}
PISUSERANADMIN pIsUserAnAdmin;
pGetNativeSystemInfo = (PGETNATIVESYSTEMINFO)GetProcAddress (
- GetModuleHandle ("kernel32.dll"), "GetNativeSystemInfo");
+ GetModuleHandle (L"kernel32.dll"), "GetNativeSystemInfo");
pIsUserAnAdmin = (PISUSERANADMIN)GetProcAddress (
- GetModuleHandle ("shell32.dll"), "IsUserAnAdmin");
+ GetModuleHandle (L"shell32.dll"), "IsUserAnAdmin");
GetSystemInfo (&SystemInfo);
if (pGetNativeSystemInfo)
(osVersion.dwMajorVersion <= 4))
{
/* WinUAE not supported on this version of Windows... */
- char szWrongOSVersion[MAX_DPATH];
+ TCHAR szWrongOSVersion[MAX_DPATH];
WIN32GUI_LoadUIString (IDS_WRONGOSVERSION, szWrongOSVersion, MAX_DPATH);
pre_gui_message (szWrongOSVersion);
return FALSE;
void create_afnewdir (int remove)
{
- char tmp[MAX_DPATH], tmp2[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH];
if (SUCCEEDED (SHGetFolderPath (NULL, CSIDL_COMMON_DOCUMENTS, NULL, 0, tmp))) {
fixtrailing (tmp);
- strcpy (tmp2, tmp);
- strcat (tmp2, "Amiga Files");
- strcpy (tmp, tmp2);
- strcat (tmp, "\\WinUAE");
+ _tcscpy (tmp2, tmp);
+ _tcscat (tmp2, L"Amiga Files");
+ _tcscpy (tmp, tmp2);
+ _tcscat (tmp, L"\\WinUAE");
if (remove) {
if (GetFileAttributes (tmp) != INVALID_FILE_ATTRIBUTES) {
RemoveDirectory (tmp);
static void getstartpaths (void)
{
- char *posn, *p;
- char tmp[MAX_DPATH], tmp2[MAX_DPATH], prevpath[MAX_DPATH];
+ TCHAR *posn, *p;
+ TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH], prevpath[MAX_DPATH];
DWORD v;
UAEREG *key;
- char xstart_path_uae[MAX_DPATH], xstart_path_old[MAX_DPATH];
- char xstart_path_new1[MAX_DPATH], xstart_path_new2[MAX_DPATH];
+ TCHAR xstart_path_uae[MAX_DPATH], xstart_path_old[MAX_DPATH];
+ TCHAR xstart_path_new1[MAX_DPATH], xstart_path_new2[MAX_DPATH];
path_type = -1;
+ prevpath[0] = 0;
xstart_path_uae[0] = xstart_path_old[0] = xstart_path_new1[0] = xstart_path_new2[0] = 0;
key = regcreatetree (NULL, NULL);
if (key) {
- DWORD size = sizeof (prevpath);
- if (!regquerystr (key, "PathMode", prevpath, &size))
+ DWORD size = sizeof (prevpath) / sizeof (TCHAR);
+ if (!regquerystr (key, L"PathMode", prevpath, &size))
prevpath[0] = 0;
regclosetree (key);
}
- if (!strcmp (prevpath, "WinUAE"))
+ if (!_tcscmp (prevpath, L"WinUAE"))
path_type = PATH_TYPE_WINUAE;
- if (!strcmp (prevpath, "WinUAE_2"))
+ if (!_tcscmp (prevpath, L"WinUAE_2"))
path_type = PATH_TYPE_NEWWINUAE;
- if (!strcmp (prevpath, "AF"))
+ if (!_tcscmp (prevpath, L"AF"))
path_type = PATH_TYPE_OLDAF;
- if (!strcmp (prevpath, "AF2005"))
+ if (!_tcscmp (prevpath, L"AF2005"))
path_type = PATH_TYPE_NEWAF;
- if (!strcmp (prevpath, "AMIGAFOREVERDATA"))
+ if (!_tcscmp (prevpath, L"AMIGAFOREVERDATA"))
path_type = PATH_TYPE_AMIGAFOREVERDATA;
- strcpy (start_path_exe, _pgmptr);
- if((posn = strrchr (start_path_exe, '\\')))
+ _tcscpy (start_path_exe, pgmptr);
+ if((posn = _tcsrchr (start_path_exe, '\\')))
posn[1] = 0;
- strcpy (tmp, start_path_exe);
- strcat (tmp, "roms");
+ _tcscpy (tmp, start_path_exe);
+ _tcscat (tmp, L"roms");
if (isfilesindir (tmp)) {
- strcpy (xstart_path_uae, start_path_exe);
+ _tcscpy (xstart_path_uae, start_path_exe);
}
- strcpy (tmp, start_path_exe);
- strcat (tmp, "configurations");
+ _tcscpy (tmp, start_path_exe);
+ _tcscat (tmp, L"configurations");
if (isfilesindir (tmp)) {
- strcpy (xstart_path_uae, start_path_exe);
+ _tcscpy (xstart_path_uae, start_path_exe);
}
- strcpy (tmp, start_path_exe);
- strcat (tmp, "..\\system\\rom\\rom.key");
+ _tcscpy (tmp, start_path_exe);
+ _tcscat (tmp, L"..\\system\\rom\\rom.key");
v = GetFileAttributes (tmp);
if (v != INVALID_FILE_ATTRIBUTES) {
af_path_old = 1;
- strcpy (xstart_path_old, start_path_exe);
- strcat (xstart_path_old, "..\\system\\");
- strcpy (start_path_af, xstart_path_old);
+ _tcscpy (xstart_path_old, start_path_exe);
+ _tcscat (xstart_path_old, L"..\\system\\");
+ _tcscpy (start_path_af, xstart_path_old);
} else {
- strcpy (tmp, start_path_exe);
- strcat (tmp, "..\\shared\\rom\\rom.key");
+ _tcscpy (tmp, start_path_exe);
+ _tcscat (tmp, L"..\\shared\\rom\\rom.key");
v = GetFileAttributes (tmp);
if (v != INVALID_FILE_ATTRIBUTES) {
af_path_old = 1;
- strcpy (xstart_path_old, start_path_exe);
- strcat (xstart_path_old, "..\\shared\\");
- strcpy (start_path_af, xstart_path_old);
+ _tcscpy (xstart_path_old, start_path_exe);
+ _tcscat (xstart_path_old, L"..\\shared\\");
+ _tcscpy (start_path_af, xstart_path_old);
}
}
- p = getenv ("AMIGAFOREVERDATA");
+ p = _wgetenv (L"AMIGAFOREVERDATA");
if (p) {
- strcpy (tmp, p);
+ _tcscpy (tmp, p);
fixtrailing (tmp);
- strcpy (start_path_new2, p);
+ _tcscpy (start_path_new2, p);
fixtrailing (start_path_af);
v = GetFileAttributes (tmp);
if (v != INVALID_FILE_ATTRIBUTES && (v & FILE_ATTRIBUTE_DIRECTORY)) {
- strcpy (xstart_path_new2, start_path_af);
- strcat (xstart_path_new2, "WinUAE\\");
+ _tcscpy (xstart_path_new2, start_path_af);
+ _tcscpy (xstart_path_new2, L"WinUAE\\");
af_path_2005 |= 2;
}
}
{
if (SUCCEEDED (SHGetFolderPath (NULL, CSIDL_COMMON_DOCUMENTS, NULL, 0, tmp))) {
fixtrailing (tmp);
- strcpy (tmp2, tmp);
- strcat (tmp2, "Amiga Files\\");
- strcpy (tmp, tmp2);
- strcat (tmp, "WinUAE");
+ _tcscpy (tmp2, tmp);
+ _tcscat (tmp2, L"Amiga Files\\");
+ _tcscpy (tmp, tmp2);
+ _tcscat (tmp, L"WinUAE");
v = GetFileAttributes (tmp);
if (v == INVALID_FILE_ATTRIBUTES || (v & FILE_ATTRIBUTE_DIRECTORY)) {
- char *p;
- strcpy (xstart_path_new1, tmp2);
- strcat (xstart_path_new1, "WinUAE\\");
- strcpy (xstart_path_uae, start_path_exe);
- strcpy (start_path_new1, xstart_path_new1);
- p = tmp2 + strlen (tmp2);
- strcpy (p, "System");
+ TCHAR *p;
+ _tcscpy (xstart_path_new1, tmp2);
+ _tcscat (xstart_path_new1, L"WinUAE\\");
+ _tcscpy (xstart_path_uae, start_path_exe);
+ _tcscpy (start_path_new1, xstart_path_new1);
+ p = tmp2 + _tcslen (tmp2);
+ _tcscpy (p, L"System");
if (isfilesindir (tmp2)) {
af_path_2005 |= 1;
} else {
- strcpy (p, "Shared");
+ _tcscpy (p, L"Shared");
if (isfilesindir (tmp2)) {
af_path_2005 |= 1;
}
if (start_data == 0) {
start_data = 1;
if (path_type == 0 && xstart_path_uae[0]) {
- strcpy (start_path_data, xstart_path_uae);
+ _tcscpy (start_path_data, xstart_path_uae);
} else if (path_type == PATH_TYPE_OLDAF && af_path_old && xstart_path_old[0]) {
- strcpy (start_path_data, xstart_path_old);
+ _tcscpy (start_path_data, xstart_path_old);
} else if (path_type == PATH_TYPE_NEWWINUAE && xstart_path_new1[0]) {
- strcpy (start_path_data, xstart_path_new1);
+ _tcscpy (start_path_data, xstart_path_new1);
create_afnewdir(0);
} else if (path_type == PATH_TYPE_NEWAF && (af_path_2005 & 1) && xstart_path_new1[0]) {
- strcpy (start_path_data, xstart_path_new1);
+ _tcscpy (start_path_data, xstart_path_new1);
create_afnewdir(0);
} else if (path_type == PATH_TYPE_AMIGAFOREVERDATA && (af_path_2005 & 2) && xstart_path_new2[0]) {
- strcpy (start_path_data, xstart_path_new2);
+ _tcscpy (start_path_data, xstart_path_new2);
} else if (path_type < 0) {
path_type = 0;
- strcpy (start_path_data, xstart_path_uae);
+ _tcscpy (start_path_data, xstart_path_uae);
if (af_path_old) {
path_type = PATH_TYPE_OLDAF;
- strcpy (start_path_data, xstart_path_old);
+ _tcscpy (start_path_data, xstart_path_old);
}
if (af_path_2005 & 1) {
path_type = PATH_TYPE_NEWAF;
create_afnewdir (1);
- strcpy (start_path_data, xstart_path_new1);
+ _tcscpy (start_path_data, xstart_path_new1);
}
if (af_path_2005 & 2) {
- strcpy (tmp, xstart_path_new2);
- strcat (tmp, "system\\rom");
+ _tcscpy (tmp, xstart_path_new2);
+ _tcscat (tmp, L"system\\rom");
if (isfilesindir (tmp)) {
path_type = PATH_TYPE_AMIGAFOREVERDATA;
} else {
- strcpy (tmp, xstart_path_new2);
- strcat (tmp, "shared\\rom");
+ _tcscpy (tmp, xstart_path_new2);
+ _tcscat (tmp, L"shared\\rom");
if (isfilesindir (tmp)) {
path_type = PATH_TYPE_AMIGAFOREVERDATA;
} else {
path_type = PATH_TYPE_NEWWINUAE;
}
}
- strcpy (start_path_data, xstart_path_new2);
+ _tcscpy (start_path_data, xstart_path_new2);
}
}
}
v = GetFileAttributes (start_path_data);
if (v == INVALID_FILE_ATTRIBUTES || !(v & FILE_ATTRIBUTE_DIRECTORY) || start_data == 0 || start_data == -2) {
- strcpy (start_path_data, start_path_exe);
+ _tcscpy (start_path_data, start_path_exe);
}
fixtrailing (start_path_data);
- GetFullPathName (start_path_data, sizeof tmp, tmp, NULL);
- strcpy (start_path_data, tmp);
+ GetFullPathName (start_path_data, sizeof tmp / sizeof (TCHAR), tmp, NULL);
+ _tcscpy (start_path_data, tmp);
SetCurrentDirectory (start_path_data);
}
extern DWORD_PTR cpu_affinity, cpu_paffinity;
static DWORD_PTR original_affinity = -1;
-static int getval(const char *s)
+static int getval (const TCHAR *s)
{
int base = 10;
int v;
- char *endptr;
+ TCHAR *endptr;
- if (s[0] == '0' && toupper(s[1]) == 'X')
+ if (s[0] == '0' && _totupper(s[1]) == 'X')
s += 2, base = 16;
- v = strtol (s, &endptr, base);
+ v = _tcstol (s, &endptr, base);
if (*endptr != '\0' || *s == '\0')
return 0;
return v;
}
-static void makeverstr(char *s)
+static void makeverstr(TCHAR *s)
{
- if (strlen (WINUAEBETA) > 0) {
- sprintf (BetaStr, " (%sBeta %s, %d.%02d.%02d)", WINUAEPUBLICBETA > 0 ? "Public " : "", WINUAEBETA,
+ if (_tcslen (WINUAEBETA) > 0) {
+ _stprintf (BetaStr, L" (%sBeta %s, %d.%02d.%02d)", WINUAEPUBLICBETA > 0 ? L"Public " : L"", WINUAEBETA,
GETBDY(WINUAEDATE), GETBDM(WINUAEDATE), GETBDD(WINUAEDATE));
- sprintf (s, "WinUAE %d.%d.%d%s%s",
+ _stprintf (s, L"WinUAE %d.%d.%d%s%s",
UAEMAJOR, UAEMINOR, UAESUBREV, WINUAEREV, BetaStr);
} else {
- sprintf(s, "WinUAE %d.%d.%d%s (%d.%02d.%02d)",
+ _stprintf(s, L"WinUAE %d.%d.%d%s (%d.%02d.%02d)",
UAEMAJOR, UAEMINOR, UAESUBREV, WINUAEREV, GETBDY(WINUAEDATE), GETBDM(WINUAEDATE), GETBDD(WINUAEDATE));
}
- if (strlen (WINUAEEXTRA) > 0) {
- strcat (s, " ");
- strcat (s, WINUAEEXTRA);
+ if (_tcslen (WINUAEEXTRA) > 0) {
+ _tcscat (s, L" ");
+ _tcscat (s, WINUAEEXTRA);
}
}
-static int parseargs (const char *arg, const char *np)
+static int parseargs (const TCHAR *arg, const TCHAR *np)
{
- if (!strcmp (arg, "-log")) {
+ if (!_tcscmp (arg, L"-log")) {
console_logging = 1;
return 1;
}
#ifdef FILESYS
- if (!strcmp (arg, "-rdbdump")) {
+ if (!_tcscmp (arg, L"-rdbdump")) {
do_rdbdump = 1;
return 1;
}
- if (!strcmp (arg, "-disableharddrivesafetycheck")) {
+ if (!_tcscmp (arg, L"-disableharddrivesafetycheck")) {
harddrive_dangerous = 0x1234dead;
return 1;
}
- if (!strcmp (arg, "-noaspifiltering")) {
+ if (!_tcscmp (arg, L"-noaspifiltering")) {
aspi_allow_all = 1;
return 1;
}
#endif
- if (!strcmp (arg, "-norawinput")) {
+ if (!_tcscmp (arg, L"-norawinput")) {
no_rawinput = 1;
return 1;
}
- if (!strcmp (arg, "-rawkeyboard")) {
+ if (!_tcscmp (arg, L"-rawkeyboard")) {
rawkeyboard = 1;
return 1;
}
- if (!strcmp (arg, "-scsilog")) {
+ if (!_tcscmp (arg, L"-scsilog")) {
log_scsi = 1;
return 1;
}
- if (!strcmp (arg, "-netlog")) {
+ if (!_tcscmp (arg, L"-netlog")) {
log_net = 1;
return 1;
}
- if (!strcmp (arg, "-seriallog")) {
+ if (!_tcscmp (arg, L"-seriallog")) {
log_uaeserial = 1;
return 1;
}
- if (!strcmp (arg, "-clipboarddebug")) {
+ if (!_tcscmp (arg, L"-clipboarddebug")) {
clipboard_debug = 1;
return 1;
}
- if (!strcmp (arg, "-rplog")) {
+ if (!_tcscmp (arg, L"-rplog")) {
log_rp = 1;
return 1;
}
- if (!strcmp (arg, "-nomultidisplay")) {
+ if (!_tcscmp (arg, L"-nomultidisplay")) {
multi_display = 0;
return 1;
}
- if (!strcmp (arg, "-legacypaths")) {
+ if (!_tcscmp (arg, L"-legacypaths")) {
start_data = -2;
return 1;
}
- if (!strcmp (arg, "-screenshotbmp")) {
+ if (!_tcscmp (arg, L"-screenshotbmp")) {
screenshotmode = 0;
return 1;
}
- if (!strcmp (arg, "-psprintdebug")) {
+ if (!_tcscmp (arg, L"-psprintdebug")) {
postscript_print_debugging = 1;
return 1;
}
- if (!strcmp (arg, "-sounddebug")) {
+ if (!_tcscmp (arg, L"-sounddebug")) {
sound_debug = 1;
return 1;
}
- if (!strcmp (arg, "-directcatweasel")) {
+ if (!_tcscmp (arg, L"-directcatweasel")) {
force_direct_catweasel = 1;
if (np) {
force_direct_catweasel = getval (np);
}
return 1;
}
- if (!strcmp (arg, "-forcerdtsc")) {
+ if (!_tcscmp (arg, L"-forcerdtsc")) {
userdtsc = 1;
return 1;
}
- if (!strcmp (arg, "-ddsoftwarecolorkey")) {
+ if (!_tcscmp (arg, L"-ddsoftwarecolorkey")) {
extern int ddsoftwarecolorkey;
ddsoftwarecolorkey = 1;
return 1;
}
- if (!strcmp (arg, "-logflush")) {
+ if (!_tcscmp (arg, L"-logflush")) {
extern int always_flush_log;
always_flush_log = 1;
return 1;
}
- if (!strcmp (arg, "-ahidebug")) {
+ if (!_tcscmp (arg, L"-ahidebug")) {
extern int ahi_debug;
ahi_debug = 2;
return 1;
}
- if (!strcmp (arg, "-ahidebug2")) {
+ if (!_tcscmp (arg, L"-ahidebug2")) {
extern int ahi_debug;
ahi_debug = 3;
return 1;
if (!np)
return 0;
- if (!strcmp (arg, "-ddforcemode")) {
+ if (!_tcscmp (arg, L"-ddforcemode")) {
extern int ddforceram;
ddforceram = getval (np);
if (ddforceram < 0 || ddforceram > 3)
ddforceram = 0;
return 2;
}
- if (!strcmp (arg, "-affinity")) {
+ if (!_tcscmp (arg, L"-affinity")) {
cpu_affinity = getval (np);
if (cpu_affinity == 0)
cpu_affinity = original_affinity;
SetThreadAffinityMask (GetCurrentThread (), cpu_affinity);
return 2;
}
- if (!strcmp (arg, "-paffinity")) {
+ if (!_tcscmp (arg, L"-paffinity")) {
cpu_paffinity = getval (np);
if (cpu_paffinity == 0)
cpu_paffinity = original_affinity;
SetProcessAffinityMask (GetCurrentProcess (), cpu_paffinity);
return 2;
}
- if (!strcmp (arg, "-datapath")) {
- strcpy(start_path_data, np);
+ if (!_tcscmp (arg, L"-datapath")) {
+ _tcscpy(start_path_data, np);
start_data = -1;
return 2;
}
- if (!strcmp (arg, "-maxmem")) {
+ if (!_tcscmp (arg, L"-maxmem")) {
maxmem = getval (np);
return 2;
}
- if (!strcmp (arg, "-soundmodeskip")) {
+ if (!_tcscmp (arg, L"-soundmodeskip")) {
sound_mode_skip = getval (np);
return 2;
}
- if (!strcmp (arg, "-ini")) {
+ if (!_tcscmp (arg, L"-ini")) {
inipath = my_strdup (np);
return 2;
}
- if (!strcmp (arg, "-p96skipmode")) {
+ if (!_tcscmp (arg, L"-p96skipmode")) {
extern int p96skipmode;
p96skipmode = getval (np);
return 2;
}
- if (!strcmp (arg, "-minidumpmode")) {
+ if (!_tcscmp (arg, L"-minidumpmode")) {
minidumpmode = getval (np);
return 2;
}
- if (!strcmp (arg, "-jitevent")) {
+ if (!_tcscmp (arg, L"-jitevent")) {
pissoff_value = getval (np);
return 2;
}
#ifdef RETROPLATFORM
- if (!strcmp (arg, "-rphost")) {
+ if (!_tcscmp (arg, L"-rphost")) {
rp_param = my_strdup (np);
return 2;
}
- if (!strcmp (arg, "-rpescapekey")) {
+ if (!_tcscmp (arg, L"-rpescapekey")) {
rp_rpescapekey = getval (np);
return 2;
}
- if (!strcmp (arg, "-rpescapeholdtime")) {
+ if (!_tcscmp (arg, L"-rpescapeholdtime")) {
rp_rpescapeholdtime = getval (np);
return 2;
}
- if (!strcmp (arg, "-rpscreenmode")) {
+ if (!_tcscmp (arg, L"-rpscreenmode")) {
rp_screenmode = getval (np);
return 2;
}
- if (!strcmp (arg, "-rpinputmode")) {
+ if (!_tcscmp (arg, L"-rpinputmode")) {
rp_inputmode = getval (np);
return 2;
}
}
-static char **parseargstring (char *s, char **xargv)
+static TCHAR **parseargstring (TCHAR *s, TCHAR **xargv)
{
int cnt, i, xargc;
- char **args;
+ TCHAR **args;
- if (strlen (s) == 0)
+ if (_tcslen (s) == 0)
return NULL;
- args = xcalloc (sizeof (char*), 32 + 1);
+ args = xcalloc (sizeof (TCHAR*), 32 + 1);
cnt = 0;
for (;;) {
- char *p = s;
+ TCHAR *p = s;
int skip = 0;
while (*p && isspace (*p))
p++;
}
for (xargc = 0; xargv[xargc]; xargc++);
for (i = 0; i < cnt; i++) {
- char *arg = args[i];
- char *next = i + 1 < cnt ? args[i + 1] : NULL;
+ TCHAR *arg = args[i];
+ TCHAR *next = i + 1 < cnt ? args[i + 1] : NULL;
int v = parseargs (arg, next);
if (!v)
xargv[xargc++] = my_strdup (arg);
}
-static int process_arg (char **xargv)
+static int process_arg (TCHAR **xargv)
{
int i, argc, xargc;
char **argv;
xargc = 0;
argc = __argc; argv = __argv;
- xargv[xargc++] = my_strdup (argv[0]);
+ xargv[xargc++] = my_strdup_ansi (argv[0]);
for (i = 1; i < argc; i++) {
- char *arg = argv[i];
- char *next = i + 1 < argc ? argv[i + 1] : NULL;
+ TCHAR *arg = au (argv[i]);
+ TCHAR *next = i + 1 < argc ? au (argv[i + 1]) : NULL;
int v = parseargs (arg, next);
if (!v)
xargv[xargc++] = my_strdup (arg);
return xargc;
}
-static char **WIN32_InitRegistry (char **argv)
+static TCHAR **WIN32_InitRegistry (TCHAR **argv)
{
DWORD disposition;
- char tmp[MAX_DPATH];
- DWORD size = sizeof tmp;
+ TCHAR tmp[MAX_DPATH];
+ DWORD size = sizeof tmp / sizeof (TCHAR);
reginitializeinit (inipath);
hWinUAEKey = NULL;
if (getregmode () == 0 || WINUAEPUBLICBETA > 0) {
/* Create/Open the hWinUAEKey which points our config-info */
- RegCreateKeyEx (HKEY_CURRENT_USER, "Software\\Arabuusimiehet\\WinUAE", 0, "", REG_OPTION_NON_VOLATILE,
+ RegCreateKeyEx (HKEY_CURRENT_USER, L"Software\\Arabuusimiehet\\WinUAE", 0, L"", REG_OPTION_NON_VOLATILE,
KEY_WRITE | KEY_READ, NULL, &hWinUAEKey, &disposition);
}
- if (regquerystr (NULL, "Commandline", tmp, &size))
+ if (regquerystr (NULL, L"Commandline", tmp, &size))
return parseargstring (tmp, argv);
return NULL;
}
-static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
+static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
HANDLE hMutex;
- char **argv = NULL, **argv2 = NULL;
+ TCHAR **argv = NULL, **argv2 = NULL;
int argc, i;
#ifdef _DEBUG
return 0;
hInst = hInstance;
- hMutex = CreateMutex (NULL, FALSE, "WinUAE Instantiated"); // To tell the installer we're running
+ hMutex = CreateMutex (NULL, FALSE, L"WinUAE Instantiated"); // To tell the installer we're running
#ifdef AVIOUTPUT
AVIOutput_Initialize ();
#endif
- argv = xcalloc (sizeof (char*), __argc);
+ argv = xcalloc (sizeof (TCHAR*), __argc);
argc = process_arg (argv);
argv2 = WIN32_InitRegistry (argv);
makeverstr (VersionStr);
logging_init ();
+#if 0
if (__argc > 1) {
- write_log ("params:\n");
+ write_log (L"params:\n");
for (i = 1; i < __argc; i++)
- write_log ("%d: '%s'\n", i, __argv[i]);
+ write_log (L"%d: '%s'\n", i, __argv[i]);
}
+#endif
if (argv2) {
- write_log ("extra params:\n");
+ write_log (L"extra params:\n");
for (i = 0; argv2[i]; i++)
- write_log ("%d: '%s'\n", i + 1, argv2[i]);
+ write_log (L"%d: '%s'\n", i + 1, argv2[i]);
}
if (WIN32_RegisterClasses () && WIN32_InitLibraries () && DirectDraw_Start (NULL)) {
DEVMODE devmode;
DWORD i;
DirectDraw_Release ();
- write_log ("Enumerating display devices.. \n");
+ write_log (L"Enumerating display devices.. \n");
enumeratedisplays (multi_display);
- write_log ("Sorting devices and modes..\n");
+ write_log (L"Sorting devices and modes..\n");
sortdisplays ();
- write_log ("Display buffer mode = %d\n", ddforceram);
+ write_log (L"Display buffer mode = %d\n", ddforceram);
enumerate_sound_devices ();
for (i = 0; sound_devices[i].name; i++) {
int type = sound_devices[i].type;
- write_log ("%d:%s: %s\n", i, type == SOUND_DEVICE_DS ? "DS" : (type == SOUND_DEVICE_AL ? "AL" : "PA"), sound_devices[i].name);
+ write_log (L"%d:%s: %s\n", i, type == SOUND_DEVICE_DS ? L"DS" : (type == SOUND_DEVICE_AL ? L"AL" : L"PA"), sound_devices[i].name);
}
- write_log ("Enumerating recording devices:\n");
+ write_log (L"Enumerating recording devices:\n");
for (i = 0; record_devices[i].name; i++) {
int type = record_devices[i].type;
- write_log ("%d:%s: %s\n", i, type == SOUND_DEVICE_DS ? "DS" : (type == SOUND_DEVICE_AL ? "AL" : "PA"), record_devices[i].name);
+ write_log (L"%d:%s: %s\n", i, type == SOUND_DEVICE_DS ? L"DS" : (type == SOUND_DEVICE_AL ? L"AL" : L"PA"), record_devices[i].name);
}
- write_log ("done\n");
+ write_log (L"done\n");
memset (&devmode, 0, sizeof (devmode));
devmode.dmSize = sizeof (DEVMODE);
if (EnumDisplaySettings (NULL, ENUM_CURRENT_SETTINGS, &devmode)) {
#ifdef PARALLEL_PORT
paraport_mask = paraport_init ();
#endif
- globalipc = createIPC ("WinUAE", 0);
+ globalipc = createIPC (L"WinUAE", 0);
serialipc = createIPC (COMPIPENAME, 1);
enumserialports ();
real_main (argc, argv);
}
#if 0
-int execute_command (char *cmd)
+int execute_command (TCHAR *cmd)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ok = 1;
for (i = 0; drvsampleres[i] >= 0; i += 2) {
struct drvsample *s = sp + drvsampleres[i + 1];
- HRSRC res = FindResource (NULL, MAKEINTRESOURCE (drvsampleres[i + 0]), "WAVE");
+ HRSRC res = FindResource (NULL, MAKEINTRESOURCE (drvsampleres[i + 0]), L"WAVE");
if (res != 0) {
HANDLE h = LoadResource (NULL, res);
int len = SizeofResource (NULL, res);
static LONG WINAPI WIN32_ExceptionFilter( struct _EXCEPTION_POINTERS * pExceptionPointers, DWORD ec)
{
- write_log ("EVALEXCEPTION!\n");
+ write_log (L"EVALEXCEPTION!\n");
return EXCEPTION_EXECUTE_HANDLER;
}
#else
MINIDUMP_EXCEPTION_INFORMATION exinfo;
MINIDUMP_USER_STREAM_INFORMATION musi, *musip;
MINIDUMP_USER_STREAM mus[2], *musp;
- char *log;
+ uae_char *log;
int loglen;
musip = NULL;
if (ec == EXCEPTION_ACCESS_VIOLATION && !er->ExceptionFlags &&
er->NumberParameters >= 2 && !er->ExceptionInformation[0] && regs.pc_p) {
void *p = (void*)er->ExceptionInformation[1];
- write_log ("ExceptionFilter Trap: %p %p %p\n", p, regs.pc_p, prevpc);
+ write_log (L"ExceptionFilter Trap: %p %p %p\n", p, regs.pc_p, prevpc);
if ((p >= (void*)regs.pc_p && p < (void*)(regs.pc_p + 32))
|| (p >= (void*)prevpc && p < (void*)(prevpc + 32))) {
int got = 0;
efix (&ctx->Edx, p, ps, &got);
efix (&ctx->Esi, p, ps, &got);
efix (&ctx->Edi, p, ps, &got);
- write_log ("Access violation! (68KPC=%08X HOSTADDR=%p)\n", M68K_GETPC, p);
+ write_log (L"Access violation! (68KPC=%08X HOSTADDR=%p)\n", M68K_GETPC, p);
if (got == 0) {
- write_log ("failed to find and fix the problem (%p). crashing..\n", p);
+ write_log (L"failed to find and fix the problem (%p). crashing..\n", p);
} else {
void *ppc = regs.pc_p;
m68k_setpc (®s, 0);
}
#ifndef _DEBUG
if (lRet == EXCEPTION_CONTINUE_SEARCH) {
- char path[MAX_DPATH];
- char path2[MAX_DPATH];
- char msg[1024];
- char *p;
+ TCHAR path[MAX_DPATH];
+ TCHAR path2[MAX_DPATH];
+ TCHAR msg[1024];
+ TCHAR *p;
HMODULE dll = NULL;
struct tm when;
__time64_t now;
if (os_winnt && GetModuleFileName (NULL, path, MAX_DPATH)) {
- char *slash = strrchr (path, '\\');
+ TCHAR *slash = _tcsrchr (path, '\\');
_time64 (&now);
when = *_localtime64 (&now);
- strcpy (path2, path);
+ _tcscpy (path2, path);
if (slash) {
- strcpy (slash + 1, "DBGHELP.DLL");
+ _tcscpy (slash + 1, L"DBGHELP.DLL");
dll = WIN32_LoadLibrary (path);
}
- slash = strrchr (path2, '\\');
+ slash = _tcsrchr (path2, '\\');
if (slash)
p = slash + 1;
else
p = path2;
- sprintf (p, "winuae_%d%d%d%d_%d%02d%02d_%02d%02d%02d.dmp",
+ _stprintf (p, L"winuae_%d%d%d%d_%d%02d%02d_%02d%02d%02d.dmp",
UAEMAJOR, UAEMINOR, UAESUBREV, WINUAEBETA,
when.tm_year + 1900, when.tm_mon + 1, when.tm_mday, when.tm_hour, when.tm_min, when.tm_sec);
if (dll == NULL)
- dll = WIN32_LoadLibrary ("DBGHELP.DLL");
+ dll = WIN32_LoadLibrary (L"DBGHELP.DLL");
if (dll) {
MINIDUMPWRITEDUMP dump = (MINIDUMPWRITEDUMP)GetProcAddress (dll, "MiniDumpWriteDump");
if (dump) {
savedump (dump, f, pExceptionPointers);
CloseHandle (f);
if (isfullscreen () <= 0) {
- sprintf (msg, "Crash detected. MiniDump saved as:\n%s\n", path2);
- MessageBox (NULL, msg, "Crash", MB_OK | MB_ICONWARNING | MB_TASKMODAL | MB_SETFOREGROUND);
+ _stprintf (msg, L"Crash detected. MiniDump saved as:\n%s\n", path2);
+ MessageBox (NULL, msg, L"Crash", MB_OK | MB_ICONWARNING | MB_TASKMODAL | MB_SETFOREGROUND);
}
}
}
}
#endif
#if 0
- HMODULE hFaultRepDll = LoadLibrary ("FaultRep.dll") ;
+ HMODULE hFaultRepDll = LoadLibrary (L"FaultRep.dll") ;
if (hFaultRepDll) {
- pfn_REPORTFAULT pfn = (pfn_REPORTFAULT)GetProcAddress (hFaultRepDll, "ReportFault");
+ pfn_REPORTFAULT pfn = (pfn_REPORTFAULT)GetProcAddress (hFaultRepDll, L"ReportFault");
if (pfn) {
EFaultRepRetVal rc = pfn (pExceptionPointers, 0);
lRet = EXCEPTION_EXECUTE_HANDLER;
SHCHANGENOTIFYDEREGISTER pSHChangeNotifyDeregister;
pSHChangeNotifyRegister = (SHCHANGENOTIFYREGISTER)GetProcAddress (
- GetModuleHandle ("shell32.dll"), "SHChangeNotifyRegister");
+ GetModuleHandle (L"shell32.dll"), "SHChangeNotifyRegister");
pSHChangeNotifyDeregister = (SHCHANGENOTIFYDEREGISTER)GetProcAddress (
- GetModuleHandle ("shell32.dll"), "SHChangeNotifyDeregister");
+ GetModuleHandle (L"shell32.dll"), "SHChangeNotifyDeregister");
if (remove) {
if (ret > 0 && pSHChangeNotifyDeregister)
if (rp_isactive ())
return;
#endif
- //write_log ("notif: systray(%x,%d)\n", hwnd, remove);
+ //write_log (L"notif: systray(%x,%d)\n", hwnd, remove);
if (!remove) {
- TaskbarRestart = RegisterWindowMessage (TEXT ("TaskbarCreated"));
+ TaskbarRestart = RegisterWindowMessage (L"TaskbarCreated");
TaskbarRestartHWND = hwnd;
- //write_log ("notif: taskbarrestart = %d\n", TaskbarRestart);
+ //write_log (L"notif: taskbarrestart = %d\n", TaskbarRestart);
} else {
TaskbarRestart = 0;
hwnd = TaskbarRestartHWND;
memset (&nid, 0, sizeof (nid));
nid.cbSize = sizeof (nid);
nid.hWnd = hwnd;
- nid.hIcon = LoadIcon (hInst, (LPCSTR)MAKEINTRESOURCE(IDI_APPICON));
+ nid.hIcon = LoadIcon (hInst, (LPCWSTR)MAKEINTRESOURCE (IDI_APPICON));
nid.uFlags = NIF_ICON | NIF_MESSAGE;
nid.uCallbackMessage = WM_USER + 1;
v = Shell_NotifyIcon (remove ? NIM_DELETE : NIM_ADD, &nid);
- //write_log ("notif: Shell_NotifyIcon returned %d\n", v);
+ //write_log (L"notif: Shell_NotifyIcon returned %d\n", v);
if (v) {
if (remove)
TaskbarRestartHWND = NULL;
} else {
DWORD err = GetLastError ();
- write_log ("Notify error code = %x (%d)\n", err, err);
+ write_log (L"Notify error code = %x (%d)\n", err, err);
}
}
HMENU menu, menu2, drvmenu;
int drvs[] = { ID_ST_DF0, ID_ST_DF1, ID_ST_DF2, ID_ST_DF3, -1 };
int i;
- char text[100];
+ TCHAR text[100];
- WIN32GUI_LoadUIString (IDS_STMENUNOFLOPPY, text, sizeof (text));
+ WIN32GUI_LoadUIString (IDS_STMENUNOFLOPPY, text, sizeof (text) / sizeof (TCHAR));
GetCursorPos (&pt);
menu = LoadMenu (hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDM_SYSTRAY));
if (!menu)
EnableMenuItem (menu2, ID_ST_HELP, pHtmlHelp ? MF_ENABLED : MF_GRAYED);
i = 0;
while (drvs[i] >= 0) {
- char s[MAX_DPATH];
+ TCHAR s[MAX_DPATH];
if (currprefs.df[i][0])
- sprintf (s, "DF%d: [%s]", i, currprefs.df[i]);
+ _stprintf (s, L"DF%d: [%s]", i, currprefs.df[i]);
else
- sprintf (s, "DF%d: [%s]", i, text);
+ _stprintf (s, L"DF%d: [%s]", i, text);
ModifyMenu (drvmenu, drvs[i], MF_BYCOMMAND | MF_STRING, drvs[i], s);
EnableMenuItem (menu2, drvs[i], currprefs.dfxtype[i] < 0 ? MF_GRAYED : MF_ENABLED);
i++;
DestroyMenu (menu);
}
-static void LLError(const char *s)
+static void LLError(const TCHAR *s)
{
DWORD err = GetLastError ();
if (err == ERROR_MOD_NOT_FOUND || err == ERROR_DLL_NOT_FOUND)
return;
- write_log ("%s failed to open %d\n", s, err);
+ write_log (L"%s failed to open %d\n", s, err);
}
-HMODULE WIN32_LoadLibrary (const char *name)
+HMODULE WIN32_LoadLibrary (const TCHAR *name)
{
HMODULE m = NULL;
- char *newname;
+ TCHAR *newname;
DWORD err = -1;
#ifdef CPU_64_BIT
- char *p;
+ TCHAR *p;
#endif
int round;
- newname = xmalloc (strlen (name) + 1 + 10);
+ newname = xmalloc ((_tcslen (name) + 1 + 10) * sizeof (TCHAR));
if (!newname)
return NULL;
for (round = 0; round < 4; round++) {
- char *s;
- strcpy (newname, name);
+ TCHAR *s;
+ _tcscpy (newname, name);
#ifdef CPU_64_BIT
switch(round)
{
break;
case 1:
p = strchr (newname,'.');
- strcpy(p,"_64");
- strcat(p, strchr (name,'.'));
+ _tcscpy(p,"_64");
+ _tcscat(p, strchr (name,'.'));
break;
case 2:
p = strchr (newname,'.');
- strcpy (p,"64");
- strcat (p, strchr (name,'.'));
+ _tcscpy (p,"64");
+ _tcscat (p, strchr (name,'.'));
break;
}
#endif
- s = xmalloc (strlen (start_path_exe) + strlen (WIN32_PLUGINDIR) + strlen (newname) + 1);
+ s = xmalloc ((_tcslen (start_path_exe) + _tcslen (WIN32_PLUGINDIR) + _tcslen (newname) + 1) * sizeof (TCHAR));
if (s) {
- sprintf (s, "%s%s%s", start_path_exe, WIN32_PLUGINDIR, newname);
+ _stprintf (s, L"%s%s%s", start_path_exe, WIN32_PLUGINDIR, newname);
m = LoadLibrary (s);
if (m)
goto end;
- sprintf (s, "%s%s", start_path_exe, newname);
+ _stprintf (s, L"%s%s", start_path_exe, newname);
m = LoadLibrary (s);
if (m)
goto end;
- sprintf (s, "%s%s%s", start_path_exe, WIN32_PLUGINDIR, newname);
+ _stprintf (s, L"%s%s%s", start_path_exe, WIN32_PLUGINDIR, newname);
LLError(s);
xfree (s);
}
#define MSGFLT_ADD 1
CHANGEWINDOWMESSAGEFILTER pChangeWindowMessageFilter;
pChangeWindowMessageFilter = (CHANGEWINDOWMESSAGEFILTER)GetProcAddress(
- GetModuleHandle("user32.dll"), "ChangeWindowMessageFilter");
+ GetModuleHandle(L"user32.dll"), L"ChangeWindowMessageFilter");
if (pChangeWindowMessageFilter)
pChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD);
#endif
pSetProcessDPIAware = (SETPROCESSDPIAWARE)GetProcAddress (
- GetModuleHandle ("user32.dll"), "SetProcessDPIAware");
+ GetModuleHandle (L"user32.dll"), "SetProcessDPIAware");
if (pSetProcessDPIAware)
pSetProcessDPIAware ();
+ pgmptr = au (_pgmptr);
+
__try {
- WinMain2 (hInstance, hPrevInstance, lpCmdLine, nCmdShow);
+ WinMain2 (hInstance, hPrevInstance, GetCommandLineW (), nCmdShow);
} __except(WIN32_ExceptionFilter (GetExceptionInformation (), GetExceptionCode ())) {
}
//SetThreadAffinityMask(thread, original_affinity);
#define WINUAEPUBLICBETA 1
-#define WINUAEBETA "14"
-#define WINUAEDATE MAKEBD(2009, 2, 28)
-#define WINUAEEXTRA ""
-#define WINUAEREV ""
+#define WINUAEBETA L"15"
+#define WINUAEDATE MAKEBD(2009, 3, 7)
+#define WINUAEEXTRA L""
+#define WINUAEREV L""
#define IHF_WINDOWHIDDEN 6
#define NORMAL_WINDOW_STYLE (WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU | WS_SIZEBOX)
extern int in_sizemove;
extern int manual_painting_needed;
extern int manual_palette_refresh_needed;
-extern int mouseactive, focus;
+extern int mouseactive;
extern int ignore_messages_all;
extern void *globalipc, *serialipc;
-extern char start_path_exe[MAX_DPATH];
-extern char start_path_data[MAX_DPATH];
+extern TCHAR start_path_exe[MAX_DPATH];
+extern TCHAR start_path_data[MAX_DPATH];
extern void my_kbd_handler (int, int, int);
extern void clearallkeys (void);
extern void remove_brkhandler (void);
extern void disablecapture (void);
extern void fullscreentoggle (void);
+extern int isfocus (void);
extern void setmouseactive (int active);
extern void minimizewindow (void);
extern int pause_emulation;
extern int sound_available;
extern int framecnt;
-extern char prtname[];
-extern char VersionStr[256];
-extern char BetaStr[64];
+extern TCHAR prtname[];
+extern TCHAR VersionStr[256];
+extern TCHAR BetaStr[64];
extern int os_winnt_admin, os_64bit, os_vista, os_winxp, os_win7;
extern OSVERSIONINFO osVersion;
extern int paraport_mask;
extern int win_x_diff, win_y_diff;
extern int window_extra_width, window_extra_height;
extern int af_path_2005, af_path_old;
-extern char start_path_af[MAX_DPATH], start_path_new1[MAX_DPATH], start_path_new2[MAX_DPATH];
+extern TCHAR start_path_af[MAX_DPATH], start_path_new1[MAX_DPATH], start_path_new2[MAX_DPATH];
+extern TCHAR *pgmptr;
#define PATH_TYPE_WINUAE 0
#define PATH_TYPE_NEWWINUAE 1
#define PATH_TYPE_OLDAF 2
#define DEFAULT_PRIORITY 2
struct threadpriorities {
- char *name;
+ TCHAR *name;
int value;
int classvalue;
int id;
extern void send_tablet_proximity (int);
void addnotifications (HWND hwnd, int remove);
-int win32_hardfile_media_change (const char *drvname, int inserted);
-extern int CheckRM (char *DriveName);
+int win32_hardfile_media_change (const TCHAR *drvname, int inserted);
+extern int CheckRM (TCHAR *DriveName);
void systray (HWND hwnd, int remove);
void systraymenu (HWND hwnd);
void exit_gui (int);
-void fetch_path (char *name, char *out, int size);
-void set_path (char *name, char *path);
+void fetch_path (TCHAR *name, TCHAR *out, int size);
+void set_path (TCHAR *name, TCHAR *path);
void read_rom_list (void);
void associate_file_extensions (void);
-#define WIN32_PLUGINDIR "plugins\\"
-HMODULE WIN32_LoadLibrary (const char *);
+#define WIN32_PLUGINDIR L"plugins\\"
+HMODULE WIN32_LoadLibrary (const TCHAR *);
extern int screenshot_prepare (void);
extern void screenshot_free (void);
struct winuae_lang
{
WORD id;
- char *name;
+ TCHAR *name;
};
extern struct winuae_lang langs[];
extern HMODULE language_load (WORD language);
struct sound_device
{
GUID guid;
- char *name;
- char *alname;
- char *cfgname;
+ TCHAR *name;
+ TCHAR *alname;
+ TCHAR *cfgname;
int panum;
int type;
};
extern struct sound_device record_devices[MAX_SOUND_DEVICES];
struct assext {
- char *ext;
- char *cmd;
- char *desc;
+ TCHAR *ext;
+ TCHAR *cmd;
+ TCHAR *desc;
int enabled;
};
struct assext exts[];
/* Determines if this drive-letter currently has a disk inserted */
-int CheckRM(char *DriveName)
+int CheckRM (TCHAR *DriveName)
{
- char filename[MAX_DPATH];
+ TCHAR filename[MAX_DPATH];
DWORD dwHold;
BOOL result = FALSE;
- sprintf(filename, "%s.", DriveName);
+ _stprintf(filename, L"%s.", DriveName);
dwHold = GetFileAttributes(filename);
if(dwHold != 0xFFFFFFFF)
result = TRUE;
/* This function makes sure the volume-name being requested is not already in use, or any of the following
illegal values: */
-static char *illegal_volumenames[] = { "SYS", "DEVS", "LIBS", "FONTS", "C", "L", "S" };
+static TCHAR *illegal_volumenames[] = { L"SYS", L"DEVS", L"LIBS", L"FONTS", L"C", L"L", L"S" };
-static int valid_volumename(struct uaedev_mount_info *mountinfo, char *volumename, int fullcheck)
+static int valid_volumename (struct uaedev_mount_info *mountinfo, TCHAR *volumename, int fullcheck)
{
- int i, result = 1, illegal_count = sizeof(illegal_volumenames) / sizeof(char *);
+ int i, result = 1, illegal_count = sizeof (illegal_volumenames) / sizeof(TCHAR*);
for (i = 0; i < illegal_count; i++) {
- if(strcmp(volumename, illegal_volumenames[i]) == 0) {
+ if(_tcscmp (volumename, illegal_volumenames[i]) == 0) {
result = 0;
break;
}
}
/* if result is still good, we've passed the illegal names check, and must check for duplicates now */
if(result && fullcheck) {
- for(i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
- if(mountinfo->ui[i].open && mountinfo->ui[i].volname && strcmp(mountinfo->ui[i].volname, volumename) == 0) {
+ for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
+ if (mountinfo->ui[i].open && mountinfo->ui[i].volname && _tcscmp (mountinfo->ui[i].volname, volumename) == 0) {
result = 0;
break;
}
}
/* Returns 1 if an actual volume-name was found, 2 if no volume-name (so uses some defaults) */
-int target_get_volume_name (struct uaedev_mount_info *mtinf, const char *volumepath, char *volumename, int size, int inserted, int fullcheck)
+int target_get_volume_name (struct uaedev_mount_info *mtinf, const TCHAR *volumepath, TCHAR *volumename, int size, int inserted, int fullcheck)
{
int result = 2;
int drivetype;
volumename[0] &&
valid_volumename (mtinf, volumename, fullcheck)) {
// +++Bernd Roesch
- if(!strcmp (volumename, "AmigaOS35"))
- strcpy (volumename, "AmigaOS3.5");
- if(!strcmp (volumename, "AmigaOS39"))
- strcpy (volumename, "AmigaOS3.9");
+ if(!_tcscmp (volumename, L"AmigaOS35"))
+ _tcscpy (volumename, L"AmigaOS3.5");
+ if(!_tcscmp (volumename, L"AmigaOS39"))
+ _tcscpy (volumename, L"AmigaOS3.9");
// ---Bernd Roesch
- if (strlen (volumename) > 0)
+ if (_tcslen (volumename) > 0)
result = 1;
}
}
switch(drivetype)
{
case DRIVE_FIXED:
- sprintf (volumename, "WinDH_%c", volumepath[0]);
+ _stprintf (volumename, L"WinDH_%c", volumepath[0]);
break;
case DRIVE_CDROM:
- sprintf (volumename, "WinCD_%c", volumepath[0]);
+ _stprintf (volumename, L"WinCD_%c", volumepath[0]);
break;
case DRIVE_REMOVABLE:
- sprintf (volumename, "WinRMV_%c", volumepath[0]);
+ _stprintf (volumename, L"WinRMV_%c", volumepath[0]);
break;
case DRIVE_REMOTE:
- sprintf (volumename, "WinNET_%c", volumepath[0]);
+ _stprintf (volumename, L"WinNET_%c", volumepath[0]);
break;
case DRIVE_RAMDISK:
- sprintf (volumename, "WinRAM_%c", volumepath[0]);
+ _stprintf (volumename, L"WinRAM_%c", volumepath[0]);
break;
case DRIVE_UNKNOWN:
case DRIVE_NO_ROOT_DIR:
{
int drive, drivetype;
UINT errormode;
- char volumename[MAX_DPATH]="";
- char volumepath[6];
+ TCHAR volumename[MAX_DPATH] = L"";
+ TCHAR volumepath[6];
DWORD dwDriveMask;
int drvnum = 0;
dwDriveMask >>= 2; // Skip A and B drives...
for(drive = 'C'; drive <= 'Z'; ++drive) {
- sprintf(volumepath, "%c:\\", drive);
+ _stprintf(volumepath, L"%c:\\", drive);
/* Is this drive-letter valid (it used to check for media in drive) */
if(dwDriveMask & 1) {
- char devname[100];
- BOOL inserted = CheckRM(volumepath); /* Is there a disk inserted? */
+ TCHAR devname[100];
+ BOOL inserted = CheckRM (volumepath); /* Is there a disk inserted? */
int nok = FALSE;
int rw = 1;
- drivetype = GetDriveType(volumepath);
+ drivetype = GetDriveType (volumepath);
devname[0] = 0;
for (;;) {
if (drivetype == DRIVE_CDROM && currprefs.win32_automount_cddrives) {
- sprintf (devname, "WinCD_%c", drive);
+ _stprintf (devname, L"WinCD_%c", drive);
rw = 0;
break;
}
if (inserted) {
target_get_volume_name (&mountinfo, volumepath, volumename, MAX_DPATH, inserted, 1);
if (!volumename[0])
- sprintf (volumename, "WinUNK_%c", drive);
+ _stprintf (volumename, L"WinUNK_%c", drive);
}
if (drivetype == DRIVE_REMOTE)
- strcat(volumepath, ".");
+ _tcscat (volumepath, L".");
else
- strcat(volumepath, "..");
- //write_log ("Drive type %d: '%s' '%s'\n", drivetype, volumepath, volumename);
+ _tcscat (volumepath, L"..");
+ //write_log (L"Drive type %d: '%s' '%s'\n", drivetype, volumepath, volumename);
add_filesys_unit (devname[0] ? devname : NULL, volumename, volumepath, !rw, 0, 0, 0, 0, -20 - drvnum, 0, 1, 0, 0, 0);
drvnum++;
} /* if drivemask */
struct uae_filter uaefilters[] =
{
- { UAE_FILTER_NULL, 0, 1, "Null filter", "null", 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32, 0, 0, 0 },
+ { UAE_FILTER_NULL, 0, 1, L"Null filter", L"null", 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32, 0, 0, 0 },
- { UAE_FILTER_DIRECT3D, 0, 1, "Direct3D", "direct3d", 1, 0, 0, 0, 0 },
+ { UAE_FILTER_DIRECT3D, 0, 1, L"Direct3D", L"direct3d", 1, 0, 0, 0, 0 },
- { UAE_FILTER_OPENGL, 0, 1, "OpenGL", "opengl", 1, 0, 0, 0, 0 },
+ { UAE_FILTER_OPENGL, 0, 1, L"OpenGL", L"opengl", 1, 0, 0, 0, 0 },
- { UAE_FILTER_SCALE2X, 0, 2, "Scale2X", "scale2x", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32, 0, 0 },
+ { UAE_FILTER_SCALE2X, 0, 2, L"Scale2X", L"scale2x", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32, 0, 0 },
- { UAE_FILTER_HQ, 0, 2, "hq2x/3x/4x", "hqx", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32 },
+ { UAE_FILTER_HQ, 0, 2, L"hq2x/3x/4x", L"hqx", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32 },
- { UAE_FILTER_SUPEREAGLE, 0, 2, "SuperEagle", "supereagle", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, 0, 0 },
+ { UAE_FILTER_SUPEREAGLE, 0, 2, L"SuperEagle", L"supereagle", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, 0, 0 },
- { UAE_FILTER_SUPER2XSAI, 0, 2, "Super2xSaI", "super2xsai", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, 0, 0 },
+ { UAE_FILTER_SUPER2XSAI, 0, 2, L"Super2xSaI", L"super2xsai", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, 0, 0 },
- { UAE_FILTER_2XSAI, 0, 2, "2xSaI", "2xsai", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, 0, 0 },
+ { UAE_FILTER_2XSAI, 0, 2, L"2xSaI", L"2xsai", 0, 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_16_32, 0, 0 },
- { UAE_FILTER_PAL, 1, 1, "PAL", "pal", 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32, 0, 0, 0 },
+ { UAE_FILTER_PAL, 1, 1, L"PAL", L"pal", 0, UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32, 0, 0, 0 },
{ 0 }
};
tempsurf = allocsurface (temp_width, temp_height);
}
if (!tempsurf)
- write_log ("DDRAW: failed to create temp surface (%dx%d)\n", temp_width, temp_height);
+ write_log (L"DDRAW: failed to create temp surface (%dx%d)\n", temp_width, temp_height);
}
unlocksurface (tempsurf);
getfilterrect2 (&dr, &sr, &zr, dst_width, dst_height, aw, ah, scale, temp_width, temp_height);
- //write_log ("(%d %d %d %d) - (%d %d %d %d) (%d %d)\n", dr.left, dr.top, dr.right, dr.bottom, sr.left, sr.top, sr.right, sr.bottom, zr.left, zr.top);
+ //write_log (L"(%d %d %d %d) - (%d %d %d %d) (%d %d)\n", dr.left, dr.top, dr.right, dr.bottom, sr.left, sr.top, sr.right, sr.bottom, zr.left, zr.top);
OffsetRect (&sr, zr.left, zr.top);
if (sr.left >= 0 && sr.top >= 0 && sr.right < temp_width && sr.bottom < temp_height) {
if (sr.left < sr.right && sr.top < sr.bottom)
uae_sem_post (&sd->change_sem);
}
if (r < 0) {
- write_log ("pcap_next_ex failed, err=%d\n", r);
+ write_log (L"pcap_next_ex failed, err=%d\n", r);
break;
}
}
int uaenet_open (struct uaenetdatawin32 *sd, struct netdriverdata *tc, void *user, int promiscuous)
{
- sd->fp = pcap_open (tc->name, 65536, (promiscuous ? PCAP_OPENFLAG_PROMISCUOUS : 0) | PCAP_OPENFLAG_MAX_RESPONSIVENESS, 100, NULL, sd->errbuf);
+ char *s;
+
+ s = ua (tc->name);
+ sd->fp = pcap_open (s, 65536, (promiscuous ? PCAP_OPENFLAG_PROMISCUOUS : 0) | PCAP_OPENFLAG_MAX_RESPONSIVENESS, 100, NULL, sd->errbuf);
+ xfree (s);
if (sd->fp == NULL) {
- write_log ("'%s' failed to open: %s\n", tc->name, sd->errbuf);
+ TCHAR *ss = au (sd->errbuf);
+ write_log (L"'%s' failed to open: %s\n", tc->name, ss);
+ xfree (ss);
return 0;
}
sd->tc = tc;
uae_sem_init (&sd->change_sem, 0, 1);
uae_sem_init (&sd->sync_semr, 0, 0);
- uae_start_thread ("uaenet_win32r", uaenet_trap_threadr, sd, &sd->tidr);
+ uae_start_thread (L"uaenet_win32r", uaenet_trap_threadr, sd, &sd->tidr);
uae_sem_wait (&sd->sync_semr);
uae_sem_init (&sd->sync_semw, 0, 0);
- uae_start_thread ("uaenet_win32w", uaenet_trap_threadw, sd, &sd->tidw);
+ uae_start_thread (L"uaenet_win32w", uaenet_trap_threadw, sd, &sd->tidw);
uae_sem_wait (&sd->sync_semw);
- write_log ("uaenet_win32 initialized\n");
+ write_log (L"uaenet_win32 initialized\n");
return 1;
end:
if (sd->threadactiver) {
while (sd->threadactiver)
Sleep(10);
- write_log ("uaenet_win32 thread %d killed\n", sd->tidr);
+ write_log (L"uaenet_win32 thread %d killed\n", sd->tidr);
uae_end_thread (&sd->tidr);
}
if (sd->threadactivew) {
while (sd->threadactivew)
Sleep(10);
CloseHandle (sd->evttw);
- write_log ("uaenet_win32 thread %d killed\n", sd->tidw);
+ write_log (L"uaenet_win32 thread %d killed\n", sd->tidw);
uae_end_thread (&sd->tidw);
}
xfree (sd->readbuffer);
if (sd->fp)
pcap_close (sd->fp);
uaeser_initdata (sd, sd->user);
- write_log ("uaenet_win32 closed\n");
+ write_log (L"uaenet_win32 closed\n");
}
struct netdriverdata *tc;
pcap_t *fp;
int val;
+ TCHAR *ss;
- hm = LoadLibrary ("wpcap.dll");
+ hm = LoadLibrary (L"wpcap.dll");
if (hm == NULL) {
- write_log ("uaenet: winpcap not installed (wpcap.dll)\n");
+ write_log (L"uaenet: winpcap not installed (wpcap.dll)\n");
return 0;
}
FreeLibrary (hm);
- hm = LoadLibrary ("packet.dll");
+ hm = LoadLibrary (L"packet.dll");
if (hm == NULL) {
- write_log ("uaenet: winpcap not installed (packet.dll)\n");
+ write_log (L"uaenet: winpcap not installed (packet.dll)\n");
return 0;
}
FreeLibrary (hm);
- write_log ("uaenet: %s\n", pcap_lib_version ());
+ ss = au (pcap_lib_version ());
+ write_log (L"uaenet: %s\n", ss);
+ xfree (ss);
if (pcap_findalldevs_ex (PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1) {
- write_log ("uaenet: failed to get interfaces: %s\n", errbuf);
+ ss = au (errbuf);
+ write_log (L"uaenet: failed to get interfaces: %s\n", ss);
+ xfree (ss);
return 0;
}
- write_log ("uaenet: detecting interfaces\n");
+ write_log (L"uaenet: detecting interfaces\n");
for(cnt = 0, d = alldevs; d != NULL; d = d->next) {
char *n2;
+ TCHAR *ss2;
tc = tcp + cnt;
if (cnt >= MAX_TOTAL_NET_DEVICES) {
- write_log ("buffer overflow\n");
+ write_log (L"buffer overflow\n");
break;
}
- write_log ("%s\n- %s\n",
- d->name, d->description ? d->description : "(no description)");
+ ss = au (d->name);
+ ss2 = d->description ? au (d->description) : L"(no description)";
+ write_log (L"%s\n- %s\n", ss, ss2);
+ xfree (ss2);
+ xfree (ss);
n2 = d->name;
if (strlen (n2) <= strlen (PCAP_SRC_IF_STRING)) {
- write_log ("- corrupt name\n");
+ write_log (L"- corrupt name\n");
continue;
}
fp = pcap_open (d->name, 65536, 0, 0, NULL, errbuf);
if (!fp) {
- write_log ("- pcap_open() failed: %s\n", errbuf);
+ ss = au (errbuf);
+ write_log (L"- pcap_open() failed: %s\n", ss);
+ xfree (ss);
continue;
}
val = pcap_datalink (fp);
pcap_close (fp);
if (val != DLT_EN10MB) {
- write_log ("- not an ethernet adapter (%d)\n", val);
+ write_log (L"- not an ethernet adapter (%d)\n", val);
continue;
}
lpAdapter = PacketOpenAdapter (n2 + strlen (PCAP_SRC_IF_STRING));
if (lpAdapter == NULL) {
- write_log ("- PacketOpenAdapter() failed\n");
+ write_log (L"- PacketOpenAdapter() failed\n");
continue;
}
OidData = calloc(6 + sizeof(PACKET_OID_DATA), 1);
OidData->Oid = OID_802_3_CURRENT_ADDRESS;
if (PacketRequest (lpAdapter, FALSE, OidData)) {
memcpy (tc->mac, OidData->Data, 6);
- write_log ("- MAC %02X:%02X:%02X:%02X:%02X:%02X\n",
+ write_log (L"- MAC %02X:%02X:%02X:%02X:%02X:%02X\n",
tc->mac[0], tc->mac[1], tc->mac[2],
tc->mac[3], tc->mac[4], tc->mac[5]);
- write_log ("- mapped as uaenet.device:%d\n", cnt++);
+ write_log (L"- mapped as uaenet.device:%d\n", cnt++);
tc->active = 1;
tc->mtu = 1500;
- tc->name = my_strdup (d->name);
+ tc->name = au (d->name);
} else {
- write_log (" - failed to get MAC\n");
+ write_log (L" - failed to get MAC\n");
}
free (OidData);
}
PacketCloseAdapter (lpAdapter);
}
- write_log ("uaenet: end of detection\n");
+ write_log (L"uaenet: end of detection\n");
pcap_freealldevs(alldevs);
return 0;
}
struct netdriverdata
{
- char *name;
+ TCHAR *name;
int mtu;
uae_u8 mac[6];
int active;
i = 0;
while (Displays[i].name) {
struct MultiDisplay *md = &Displays[i];
- if (p->gfx_display_name[0] && !strcmp (md->name, p->gfx_display_name))
+ if (p->gfx_display_name[0] && !_tcscmp (md->name, p->gfx_display_name))
return md;
- if (p->gfx_display_name[0] && !strcmp (md->name2, p->gfx_display_name))
+ if (p->gfx_display_name[0] && !_tcscmp (md->name2, p->gfx_display_name))
return md;
i++;
}
if (i == 0) {
- gui_message ("no display adapters! Exiting");
+ gui_message (L"no display adapters! Exiting");
exit (0);
}
if (display >= i)
}
if (got == FALSE)
freq = 0;
- write_log ("set_ddraw: trying %dx%d, bits=%d, refreshrate=%d\n", width, height, bits, freq);
+ write_log (L"set_ddraw: trying %dx%d, bits=%d, refreshrate=%d\n", width, height, bits, freq);
ddrval = DirectDraw_SetDisplayMode (width, height, bits, freq);
if (SUCCEEDED (ddrval))
break;
olderr = ddrval;
if (freq) {
- write_log ("set_ddraw: failed, trying without forced refresh rate\n");
+ write_log (L"set_ddraw: failed, trying without forced refresh rate\n");
DirectDraw_SetCooperativeLevel (hAmigaWnd, dxfullscreen, TRUE);
ddrval = DirectDraw_SetDisplayMode (width, height, bits, 0);
if (SUCCEEDED (ddrval))
goto oops;
ddrval = DirectDraw_CreateMainSurface (width, height);
if (FAILED(ddrval)) {
- write_log ("set_ddraw: couldn't CreateSurface() for primary because %s.\n", DXError (ddrval));
+ write_log (L"set_ddraw: couldn't CreateSurface() for primary because %s.\n", DXError (ddrval));
goto oops;
}
ddrval = DirectDraw_SetClipper (hAmigaWnd);
DirectDraw_CreatePalette (currentmode->pal);
}
- write_log ("set_ddraw: %dx%d@%d-bytes\n", width, height, bits);
+ write_log (L"set_ddraw: %dx%d@%d-bytes\n", width, height, bits);
return 1;
oops:
return 0;
md->DisplayModes[i].refresh[1] = 0;
md->DisplayModes[i].colormodes = ct;
md->DisplayModes[i + 1].depth = -1;
- sprintf (md->DisplayModes[i].name, "%dx%d, %d-bit",
+ _stprintf (md->DisplayModes[i].name, L"%dx%d, %d-bit",
md->DisplayModes[i].res.width, md->DisplayModes[i].res.height, md->DisplayModes[i].depth * 8);
return DDENUMRET_OK;
}
i = 0;
while (md->DisplayModes[i].depth >= 0) {
- write_log ("%d: %s (", i, md->DisplayModes[i].name);
+ write_log (L"%d: %s (", i, md->DisplayModes[i].name);
j = 0;
while (md->DisplayModes[i].refresh[j] > 0) {
if (j > 0)
- write_log (",");
- write_log ("%d", md->DisplayModes[i].refresh[j]);
+ write_log (L",");
+ write_log (L"%d", md->DisplayModes[i].refresh[j]);
j++;
}
- write_log (")\n");
+ write_log (L")\n");
i++;
}
}
-BOOL CALLBACK displaysCallback (GUID *guid, LPSTR desc, LPSTR name, LPVOID ctx, HMONITOR hm)
+BOOL CALLBACK displaysCallback (GUID *guid, char *adesc, char *aname, LPVOID ctx, HMONITOR hm)
{
struct MultiDisplay *md = Displays;
MONITORINFOEX lpmi;
- char tmp[200];
+ TCHAR tmp[200];
+ TCHAR *desc = au (adesc);
+ TCHAR *name = au (aname);
+ int ret = 0;
while (md->name) {
if (md - Displays >= MAX_DISPLAYS)
- return 0;
+ goto end;
md++;
}
lpmi.cbSize = sizeof (lpmi);
}
md->rect = lpmi.rcMonitor;
if (md->rect.left == 0 && md->rect.top == 0)
- sprintf (tmp, "%s (%d*%d)", desc, md->rect.right - md->rect.left, md->rect.bottom - md->rect.top);
+ _stprintf (tmp, L"%s (%d*%d)", desc, md->rect.right - md->rect.left, md->rect.bottom - md->rect.top);
else
- sprintf (tmp, "%s (%d*%d) [%d*%d]", desc, md->rect.right - md->rect.left, md->rect.bottom - md->rect.top, md->rect.left, md->rect.top);
+ _stprintf (tmp, L"%s (%d*%d) [%d*%d]", desc, md->rect.right - md->rect.left, md->rect.bottom - md->rect.top, md->rect.left, md->rect.top);
md->name = my_strdup (tmp);
md->name2 = my_strdup (desc);
- write_log ("'%s' '%s' %s\n", desc, name, outGUID(guid));
- return 1;
+ write_log (L"'%s' '%s' %s\n", desc, name, outGUID(guid));
+ ret = 1;
+end:
+ xfree (name);
+ xfree (desc);
+ return ret;
}
static BOOL CALLBACK monitorEnumProc (HMONITOR h, HDC hdc, LPRECT rect, LPARAM data)
DirectDraw_EnumDisplays (displaysCallback);
EnumDisplayMonitors (NULL, NULL, monitorEnumProc, (LPARAM)&cnt);
} else {
- write_log ("Multimonitor detection disabled\n");
+ write_log (L"Multimonitor detection disabled\n");
Displays[0].primary = 1;
- Displays[0].name = "Display";
+ Displays[0].name = L"Display";
Displays[0].disabled = 0;
}
}
int w = DirectDraw_CurrentWidth ();
int h = DirectDraw_CurrentHeight ();
int b = DirectDraw_GetCurrentDepth ();
- write_log ("Desktop: W=%d H=%d B=%d. CXVS=%d CYVS=%d\n", w, h, b,
+ write_log (L"Desktop: W=%d H=%d B=%d. CXVS=%d CYVS=%d\n", w, h, b,
GetSystemMetrics (SM_CXVIRTUALSCREEN), GetSystemMetrics (SM_CYVIRTUALSCREEN));
DirectDraw_EnumDisplayModes (DDEDM_REFRESHRATES , modesCallback, md1);
//dhack();
i = 0;
while (md1->DisplayModes[i].depth > 0)
i++;
- write_log ("'%s', %d display modes (%s)\n", md1->name, i, md1->disabled ? "disabled" : "enabled");
+ write_log (L"'%s', %d display modes (%s)\n", md1->name, i, md1->disabled ? L"disabled" : L"enabled");
md1++;
}
displayGUID = NULL;
updatewinfsmode (&currprefs);
if (!DirectDraw_Start (displayGUID))
return 0;
- write_log ("DirectDraw GUID=%s\n", outGUID (displayGUID));
+ write_log (L"DirectDraw GUID=%s\n", outGUID (displayGUID));
ret = -2;
do {
c |= currprefs.gfx_autoresolution != changed_prefs.gfx_autoresolution ? (2|8) : 0;
c |= currprefs.gfx_filter != changed_prefs.gfx_filter ? (2|8) : 0;
- c |= strcmp (currprefs.gfx_filtershader, changed_prefs.gfx_filtershader) ? (2|8|32) : 0;
+ c |= _tcscmp (currprefs.gfx_filtershader, changed_prefs.gfx_filtershader) ? (2|8|32) : 0;
c |= currprefs.gfx_filter_filtermode != changed_prefs.gfx_filter_filtermode ? (2|8|32) : 0;
c |= currprefs.gfx_filter_horiz_zoom_mult != changed_prefs.gfx_filter_horiz_zoom_mult ? (1|8) : 0;
c |= currprefs.gfx_filter_vert_zoom_mult != changed_prefs.gfx_filter_vert_zoom_mult ? (1|8) : 0;
c |= currprefs.gfx_lores_mode != changed_prefs.gfx_lores_mode ? (2 | 8) : 0;
c |= currprefs.gfx_scandoubler != changed_prefs.gfx_scandoubler ? (2 | 8) : 0;
c |= currprefs.gfx_display != changed_prefs.gfx_display ? (2|4|8) : 0;
- c |= strcmp (currprefs.gfx_display_name, changed_prefs.gfx_display_name) ? (2|4|8) : 0;
+ c |= _tcscmp (currprefs.gfx_display_name, changed_prefs.gfx_display_name) ? (2|4|8) : 0;
c |= currprefs.gfx_blackerthanblack != changed_prefs.gfx_blackerthanblack ? (2 | 8) : 0;
c |= currprefs.win32_alwaysontop != changed_prefs.win32_alwaysontop ? 32 : 0;
}
currprefs.gfx_filter = changed_prefs.gfx_filter;
- strcpy (currprefs.gfx_filtershader, changed_prefs.gfx_filtershader);
+ _tcscpy (currprefs.gfx_filtershader, changed_prefs.gfx_filtershader);
currprefs.gfx_filter_filtermode = changed_prefs.gfx_filter_filtermode;
currprefs.gfx_filter_horiz_zoom_mult = changed_prefs.gfx_filter_horiz_zoom_mult;
currprefs.gfx_filter_vert_zoom_mult = changed_prefs.gfx_filter_vert_zoom_mult;
currprefs.gfx_resolution = changed_prefs.gfx_resolution;
currprefs.gfx_linedbl = changed_prefs.gfx_linedbl;
currprefs.gfx_display = changed_prefs.gfx_display;
- strcpy (currprefs.gfx_display_name, changed_prefs.gfx_display_name);
+ _tcscpy (currprefs.gfx_display_name, changed_prefs.gfx_display_name);
currprefs.gfx_blackerthanblack = changed_prefs.gfx_blackerthanblack;
currprefs.win32_alwaysontop = changed_prefs.win32_alwaysontop;
return 1;
}
- if (strcmp (currprefs.prtname, changed_prefs.prtname) ||
+ if (_tcscmp (currprefs.prtname, changed_prefs.prtname) ||
currprefs.parallel_autoflush_time != changed_prefs.parallel_autoflush_time ||
currprefs.parallel_postscript_emulation != changed_prefs.parallel_postscript_emulation ||
currprefs.parallel_postscript_detection != changed_prefs.parallel_postscript_detection ||
- strcmp (currprefs.ghostscript_parameters, changed_prefs.ghostscript_parameters)) {
- strcpy (currprefs.prtname, changed_prefs.prtname);
+ _tcscmp (currprefs.ghostscript_parameters, changed_prefs.ghostscript_parameters)) {
+ _tcscpy (currprefs.prtname, changed_prefs.prtname);
currprefs.parallel_autoflush_time = changed_prefs.parallel_autoflush_time;
currprefs.parallel_postscript_emulation = changed_prefs.parallel_postscript_emulation;
currprefs.parallel_postscript_detection = changed_prefs.parallel_postscript_detection;
- strcpy (currprefs.ghostscript_parameters, changed_prefs.ghostscript_parameters);
+ _tcscpy (currprefs.ghostscript_parameters, changed_prefs.ghostscript_parameters);
#ifdef PARALLEL_PORT
closeprinter ();
#endif
}
- if (strcmp (currprefs.sername, changed_prefs.sername) ||
+ if (_tcscmp (currprefs.sername, changed_prefs.sername) ||
currprefs.serial_hwctsrts != changed_prefs.serial_hwctsrts ||
currprefs.serial_direct != changed_prefs.serial_direct ||
currprefs.serial_demand != changed_prefs.serial_demand) {
- strcpy (currprefs.sername, changed_prefs.sername);
+ _tcscpy (currprefs.sername, changed_prefs.sername);
currprefs.serial_hwctsrts = changed_prefs.serial_hwctsrts;
currprefs.serial_demand = changed_prefs.serial_demand;
currprefs.serial_direct = changed_prefs.serial_direct;
if(!hDevNotify)
{
- write_log ("RegisterDeviceNotification failed: %d\n", GetLastError());
+ write_log (L"RegisterDeviceNotification failed: %d\n", GetLastError());
return FALSE;
}
for (; md->DisplayModes[i].depth >= 0; i++) {
struct PicassoResolution *pr = &md->DisplayModes[i];
if (pr->res.width >= currentmode->native_width && pr->res.height >= currentmode->native_height) {
- write_log ("FS: %dx%d -> %dx%d\n", currentmode->native_width, currentmode->native_height,
+ write_log (L"FS: %dx%d -> %dx%d\n", currentmode->native_width, currentmode->native_height,
pr->res.width, pr->res.height);
currentmode->native_width = pr->res.width;
currentmode->native_height = pr->res.height;
GetWindowRect (hAmigaWnd, &amigawin_rect);
if (d3dfs || dxfs)
SetCursorPos (x + w / 2, y + h / 2);
- write_log ("window already open\n");
+ write_log (L"window already open\n");
#ifdef RETROPLATFORM
rp_set_hwnd (hAmigaWnd);
#endif
int oldx, oldy;
int first = 2;
- regqueryint (NULL, "MainPosX", &stored_x);
- regqueryint (NULL, "MainPosY", &stored_y);
+ regqueryint (NULL, L"MainPosX", &stored_x);
+ regqueryint (NULL, L"MainPosY", &stored_y);
while (first) {
first--;
win_y_diff = rc.top - oldy;
if (MonitorFromRect (&rc, MONITOR_DEFAULTTONULL) == NULL) {
- write_log ("window coordinates are not visible on any monitor, reseting..\n");
+ write_log (L"window coordinates are not visible on any monitor, reseting..\n");
stored_x = stored_y = 0;
continue;
}
if (!borderless) {
RECT rc2;
hMainWnd = CreateWindowEx (WS_EX_ACCEPTFILES | exstyle | flags,
- "PCsuxRox", "WinUAE",
+ L"PCsuxRox", L"WinUAE",
style,
rc.left, rc.top,
rc.right - rc.left + 1, rc.bottom - rc.top + 1,
hhWnd, NULL, hInst, NULL);
if (!hMainWnd) {
- write_log ("main window creation failed\n");
+ write_log (L"main window creation failed\n");
return 0;
}
GetWindowRect (hMainWnd, &rc2);
if (rp_isactive () && !dxfs && !d3dfs && !fsw) {
HWND parent = rp_getparent ();
hAmigaWnd = CreateWindowEx (dxfs || d3dfs ? WS_EX_ACCEPTFILES | WS_EX_TOPMOST : WS_EX_ACCEPTFILES | WS_EX_TOOLWINDOW | (currprefs.win32_alwaysontop ? WS_EX_TOPMOST : 0),
- "AmigaPowah", "WinUAE",
+ L"AmigaPowah", L"WinUAE",
WS_POPUP,
x, y, w, h,
parent, NULL, hInst, NULL);
hAmigaWnd = CreateWindowEx (dxfs || d3dfs ?
WS_EX_TOPMOST :
WS_EX_ACCEPTFILES | exstyle | (currprefs.win32_alwaysontop ? WS_EX_TOPMOST : 0),
- "AmigaPowah", "WinUAE",
+ L"AmigaPowah", L"WinUAE",
(dxfs || d3dfs ? WS_POPUP : (WS_CLIPCHILDREN | WS_CLIPSIBLINGS | (hMainWnd ? WS_VISIBLE | WS_CHILD : WS_VISIBLE | WS_POPUP | WS_SYSMENU | WS_MINIMIZEBOX))),
x, y, w, h,
borderless ? NULL : (hMainWnd ? hMainWnd : hhWnd), NULL, hInst, NULL);
}
if (!hAmigaWnd) {
- write_log ("creation of amiga window failed\n");
+ write_log (L"creation of amiga window failed\n");
close_hwnds();
return 0;
}
static BOOL doInit (void)
{
int fs_warning = -1;
- char tmpstr[300];
+ TCHAR tmpstr[300];
RGBFTYPE colortype;
int tmp_depth;
int ret = 0;
currentmode->native_height = rc.bottom - rc.top;
}
- write_log ("W=%d H=%d B=%d CT=%d\n",
+ write_log (L"W=%d H=%d B=%d CT=%d\n",
DirectDraw_CurrentWidth (), DirectDraw_CurrentHeight (), DirectDraw_GetCurrentDepth (), colortype);
if (currentmode->current_depth < 15 && (currprefs.chipset_mask & CSMASK_AGA) && isfullscreen () > 0 && !WIN32GFX_IsPicassoScreen()) {
static int warned;
if (!warned) {
- char szMessage[MAX_DPATH];
+ TCHAR szMessage[MAX_DPATH];
currentmode->current_depth = 16;
WIN32GUI_LoadUIString(IDS_AGA8BIT, szMessage, MAX_DPATH);
gui_message(szMessage);
fs_warning = IDS_UNSUPPORTEDSCREENMODE_3;
}
if (fs_warning >= 0 && isfullscreen () <= 0) {
- char szMessage[MAX_DPATH], szMessage2[MAX_DPATH];
+ TCHAR szMessage[MAX_DPATH], szMessage2[MAX_DPATH];
WIN32GUI_LoadUIString(IDS_UNSUPPORTEDSCREENMODE, szMessage, MAX_DPATH);
WIN32GUI_LoadUIString(fs_warning, szMessage2, MAX_DPATH);
// Temporarily drop the DirectDraw stuff
DirectDraw_Release ();
- sprintf (tmpstr, szMessage, szMessage2);
+ _stprintf (tmpstr, szMessage, szMessage2);
gui_message (tmpstr);
DirectDraw_Start (displayGUID);
if (screen_is_picasso)
}
#if defined OPENGL
if (currentmode->flags & DM_OPENGL) {
- const char *err = OGL_init (hAmigaWnd, currentmode->native_width, currentmode->native_height,
+ const TCHAR *err = OGL_init (hAmigaWnd, currentmode->native_width, currentmode->native_height,
currentmode->amiga_width, currentmode->amiga_height, currentmode->current_depth);
if (err) {
OGL_free ();
#endif
#ifdef D3D
if (currentmode->flags & DM_D3D) {
- const char *err = D3D_init (hAmigaWnd, currentmode->native_width, currentmode->native_height,
+ const TCHAR *err = D3D_init (hAmigaWnd, currentmode->native_width, currentmode->native_height,
currentmode->amiga_width, currentmode->amiga_height, currentmode->current_depth);
if (err) {
D3D_free ();
#include "rp.h"
#include "statusline.h"
-#define ARCHIVE_STRING "*.zip;*.7z;*.rar;*.lha;*.lzh;*.lzx"
+#define ARCHIVE_STRING L"*.zip;*.7z;*.rar;*.lha;*.lzh;*.lzx"
-#define DISK_FORMAT_STRING "(*.adf;*.adz;*.gz;*.dms;*.fdi;*.ipf;*.exe)\0*.adf;*.adz;*.gz;*.dms;*.fdi;*.ipf;*.exe;*.ima;*.wrp;*.dsq;" ARCHIVE_STRING "\0"
-#define ROM_FORMAT_STRING "(*.rom;*.roz)\0*.rom;*.roz;" ARCHIVE_STRING "\0"
-#define USS_FORMAT_STRING_RESTORE "(*.uss)\0*.uss;*.gz;" ARCHIVE_STRING "\0"
-#define USS_FORMAT_STRING_SAVE "(*.uss)\0*.uss\0"
-#define HDF_FORMAT_STRING "(*.hdf;*.rdf;*.hdz;*.rdz)\0*.hdf;*.rdf;*.hdz;*.rdz\0"
-#define INP_FORMAT_STRING "(*.inp)\0*.inp\0"
-#define CONFIG_HOST "Host"
-#define CONFIG_HARDWARE "Hardware"
+#define DISK_FORMAT_STRING L"(*.adf;*.adz;*.gz;*.dms;*.fdi;*.ipf;*.exe)\0*.adf;*.adz;*.gz;*.dms;*.fdi;*.ipf;*.exe;*.ima;*.wrp;*.dsq;" ARCHIVE_STRING L"\0"
+#define ROM_FORMAT_STRING L"(*.rom;*.roz)\0*.rom;*.roz;" ARCHIVE_STRING L"\0"
+#define USS_FORMAT_STRING_RESTORE L"(*.uss)\0*.uss;*.gz;" ARCHIVE_STRING L"\0"
+#define USS_FORMAT_STRING_SAVE L"(*.uss)\0*.uss\0"
+#define HDF_FORMAT_STRING L"(*.hdf;*.rdf;*.hdz;*.rdz)\0*.hdf;*.rdf;*.hdz;*.rdz\0"
+#define INP_FORMAT_STRING L"(*.inp)\0*.inp\0"
+#define CONFIG_HOST L"Host"
+#define CONFIG_HARDWARE L"Hardware"
-static char szNone[MAX_DPATH];
+static TCHAR szNone[MAX_DPATH];
static int allow_quit;
static int restart_requested;
static int qs_override;
int gui_active;
-extern HWND (WINAPI *pHtmlHelp)(HWND, LPCSTR, UINT, LPDWORD);
+extern HWND (WINAPI *pHtmlHelp)(HWND, LPCWSTR, UINT, LPDWORD);
#undef HtmlHelp
#ifndef HH_DISPLAY_TOPIC
#define HH_DISPLAY_TOPIC 0
#endif
#define HtmlHelp(a,b,c,d) if(pHtmlHelp) (*pHtmlHelp)(a,b,c,(LPDWORD)d); else \
-{ char szMessage[MAX_DPATH]; WIN32GUI_LoadUIString(IDS_NOHELP, szMessage, MAX_DPATH); gui_message(szMessage); }
+{ TCHAR szMessage[MAX_DPATH]; WIN32GUI_LoadUIString (IDS_NOHELP, szMessage, MAX_DPATH); gui_message (szMessage); }
-extern char help_file[MAX_DPATH];
+extern TCHAR help_file[MAX_DPATH];
extern int mouseactive;
-char config_filename[MAX_DPATH] = "";
-static char stored_path[MAX_DPATH];
+TCHAR config_filename[MAX_DPATH] = L"";
+static TCHAR stored_path[MAX_DPATH];
-#define Error(x) MessageBox(NULL, (x), "WinUAE Error", MB_OK)
+#define Error(x) MessageBox (NULL, (x), L"WinUAE Error", MB_OK)
-void WIN32GUI_LoadUIString(DWORD id, char *string, DWORD dwStringLen)
+void WIN32GUI_LoadUIString (DWORD id, TCHAR *string, DWORD dwStringLen)
{
- if (LoadString(hUIDLL ? hUIDLL : hInst, id, string, dwStringLen) == 0)
- LoadString(hInst, id, string, dwStringLen);
+ if (LoadString (hUIDLL ? hUIDLL : hInst, id, string, dwStringLen) == 0)
+ LoadString (hInst, id, string, dwStringLen);
}
static int C_PAGES;
EnableWindow (w, !!enable);
}
-static char *ua (const WCHAR *s)
-{
- char *d;
- int len;
-
- if (s == NULL)
- return NULL;
- len = WideCharToMultiByte (CP_ACP, 0, s, -1, NULL, 0, 0, FALSE);
- if (!len)
- return my_strdup ("");
- d = xmalloc (len + 1);
- WideCharToMultiByte (CP_ACP, 0, s, -1, d, len, 0, FALSE);
- return d;
-}
-static WCHAR *au (const char *s)
-{
- WCHAR *d;
- int len = MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, s, -1, NULL, 0);
- if (!len)
- return xcalloc (2, 1);
- d = xmalloc ((len + 1) * sizeof (WCHAR));
- MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, s, -1, d, len);
- return d;
-}
-
-
-
static int CALLBACK BrowseForFolderCallback (HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData)
{
- char szPath[MAX_PATH];
+ TCHAR szPath[MAX_PATH];
switch(uMsg)
{
case BFFM_INITIALIZED:
{
BROWSEINFO bi;
LPITEMIDLIST pidlBrowse;
- char buf[MAX_DPATH], fullpath[MAX_DPATH];
- char *path = ofn->lpstrFile;
+ TCHAR buf[MAX_DPATH], fullpath[MAX_DPATH];
+ TCHAR *path = ofn->lpstrFile;
int ret = 0;
buf[0] = 0;
bi.pszDisplayName = buf;
bi.lpszTitle = NULL;
bi.ulFlags = BIF_DONTGOBELOWDOMAIN | BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
- if (path[0] && GetFullPathName (path, sizeof fullpath, fullpath, NULL)) {
+ if (path[0] && GetFullPathName (path, sizeof fullpath / sizeof (TCHAR), fullpath, NULL)) {
bi.lpfn = BrowseForFolderCallback;
bi.lParam = (LPARAM)fullpath;
}
pidlBrowse = SHBrowseForFolder (&bi);
if (pidlBrowse != NULL) {
if (SHGetPathFromIDList (pidlBrowse, buf)) {
- strcpy (path, buf);
+ _tcscpy (path, buf);
ret = 1;
}
CoTaskMemFree (pidlBrowse);
return ret;
}
-static char *getfilepath (char *s)
+static TCHAR *getfilepath (TCHAR *s)
{
- char *p = strrchr (s, '\\');
+ TCHAR *p = _tcsrchr (s, '\\');
if (p)
return p + 1;
return NULL;
static BOOL GetFileDialog (OPENFILENAME *opn, const GUID *guid, int mode)
{
SHCREATEITEMFROMPARSINGNAME pSHCreateItemFromParsingName;
- WCHAR *title = NULL;
- WCHAR *defext = NULL;
- WCHAR *initialdir = NULL;
HRESULT hr;
IFileOpenDialog *pfd;
FILEOPENDIALOGOPTIONS pfos;
hr = -1;
ret = 0;
pSHCreateItemFromParsingName = (SHCREATEITEMFROMPARSINGNAME)GetProcAddress (
- GetModuleHandle ("shell32.dll"), "SHCreateItemFromParsingName");
+ GetModuleHandle (L"shell32.dll"), "SHCreateItemFromParsingName");
if (pSHCreateItemFromParsingName)
hr = CoCreateInstance (mode > 0 ? &CLSID_FileSaveDialog : &CLSID_FileOpenDialog,
NULL,
IFileDialog_SetClientGuid (pfd, guid);
if (opn->lpstrFilter) {
- const char *p = opn->lpstrFilter;
+ const TCHAR *p = opn->lpstrFilter;
int i;
while (*p) {
- p += strlen (p) + 1;
- p += strlen (p) + 1;
+ p += _tcslen (p) + 1;
+ p += _tcslen (p) + 1;
filtercnt++;
}
if (filtercnt) {
fs = xmalloc (sizeof (COMDLG_FILTERSPEC) * filtercnt);
p = opn->lpstrFilter;
for (i = 0; i < filtercnt; i++) {
- fs[i].pszName = au (p);
- p += strlen (p) + 1;
- fs[i].pszSpec = au (p);
- p += strlen (p) + 1;
+ fs[i].pszName = p;
+ p += _tcslen (p) + 1;
+ fs[i].pszSpec = p;
+ p += _tcslen (p) + 1;
}
IFileDialog_SetFileTypes (pfd, filtercnt, fs);
}
}
if (opn->lpstrTitle) {
- title = au (opn->lpstrTitle);
- IFileDialog_SetTitle (pfd, title);
+ IFileDialog_SetTitle (pfd, opn->lpstrTitle);
}
if (opn->lpstrDefExt) {
- defext = au (opn->lpstrDefExt);
- IFileDialog_SetDefaultExtension (pfd, defext);
+ IFileDialog_SetDefaultExtension (pfd, opn->lpstrDefExt);
}
if (opn->lpstrInitialDir) {
- char tmp[MAX_DPATH];
- const char *p = opn->lpstrInitialDir;
- if (GetFullPathName (p, sizeof tmp, tmp, NULL))
+ TCHAR tmp[MAX_DPATH];
+ const TCHAR *p = opn->lpstrInitialDir;
+ if (GetFullPathName (p, sizeof tmp / sizeof (TCHAR), tmp, NULL))
p = tmp;
- initialdir = au (p);
- hr = pSHCreateItemFromParsingName (initialdir, NULL, &IID_IShellItem, &shellitem);
+ hr = pSHCreateItemFromParsingName (p, NULL, &IID_IShellItem, &shellitem);
if (SUCCEEDED (hr))
IFileDialog_SetFolder (pfd, shellitem);
}
WCHAR *path = NULL;
hr = IShellItem_GetDisplayName (pitem, SIGDN_FILESYSPATH, &path);
if (SUCCEEDED (hr)) {
- char *spath = ua (path);
- char *p = opn->lpstrFile;
- strcpy (p, spath);
- p[strlen (p) + 1] = 0;
- xfree (spath);
+ TCHAR *p = opn->lpstrFile;
+ _tcscpy (p, path);
+ p[_tcslen (p) + 1] = 0;
p = getfilepath (opn->lpstrFile);
if (p && opn->lpstrFileTitle)
- strcpy (opn->lpstrFileTitle, p);
+ _tcscpy (opn->lpstrFileTitle, p);
}
IShellItem_Release (pitem);
}
WCHAR *path = NULL;
hr = IShellItem_GetDisplayName (pitem, SIGDN_FILESYSPATH, &path);
if (SUCCEEDED (hr)) {
- char *spath = ua (path);
- char *p = opn->lpstrFile;
+ TCHAR *p = opn->lpstrFile;
while (*p)
- p += strlen (p) + 1;
- if (p - opn->lpstrFile + strlen (spath) + 2 < opn->nMaxFile) {
- strcpy (p, spath);
- p[strlen (p) + 1] = 0;
+ p += _tcslen (p) + 1;
+ if (p - opn->lpstrFile + _tcslen (path) + 2 < opn->nMaxFile) {
+ _tcscpy (p, path);
+ p[_tcslen (p) + 1] = 0;
}
- xfree (spath);
if (opn->lpstrFileTitle && !opn->lpstrFileTitle[0]) {
p = getfilepath (opn->lpstrFile);
if (p && opn->lpstrFileTitle)
- strcpy (opn->lpstrFileTitle, p);
+ _tcscpy (opn->lpstrFileTitle, p);
}
}
CoTaskMemFree (path);
if (shellitem)
IShellItem_Release (shellitem);
if (filtercnt) {
- int i;
- for (i = 0; i < filtercnt; i++) {
- xfree (fs[i].pszName);
- xfree (fs[i].pszSpec);
- }
xfree (fs);
}
- xfree (title);
- xfree (defext);
- xfree (initialdir);
return ret;
}
{
return GetFileDialog (opn, guid, 1);
}
-int DirectorySelection (HWND hDlg, const GUID *guid, char *path)
+int DirectorySelection (HWND hDlg, const GUID *guid, TCHAR *path)
{
OPENFILENAME ofn = { 0 };
ofn.hwndOwner = hDlg;
void write_disk_history (void)
{
int i, j;
- char tmp[16];
+ TCHAR tmp[16];
UAEREG *fkey;
- fkey = regcreatetree (NULL, "DiskImageMRUList");
+ fkey = regcreatetree (NULL, L"DiskImageMRUList");
if (fkey == NULL)
return;
j = 1;
for (i = 0; i <= MAX_PREVIOUS_FLOPPIES; i++) {
- char *s = DISK_history_get (i);
- if (s == 0 || strlen(s) == 0)
+ TCHAR *s = DISK_history_get (i);
+ if (s == 0 || _tcslen (s) == 0)
continue;
- sprintf (tmp, "Image%02d", j);
+ _stprintf (tmp, L"Image%02d", j);
regsetstr (fkey, tmp, s);
j++;
}
while (j <= MAX_PREVIOUS_FLOPPIES) {
- char *s = "";
- sprintf (tmp, "Image%02d", j);
+ TCHAR *s = L"";
+ _stprintf (tmp, L"Image%02d", j);
regsetstr (fkey, tmp, s);
j++;
}
UAEREG *read_disk_history (void)
{
static int regread;
- char tmp2[1000];
+ TCHAR tmp2[1000];
DWORD size2;
int idx, idx2;
UAEREG *fkey;
- char tmp[1000];
+ TCHAR tmp[1000];
DWORD size;
- fkey = regcreatetree (NULL, "DiskImageMRUList");
+ fkey = regcreatetree (NULL, L"DiskImageMRUList");
if (fkey == NULL || regread)
return fkey;
idx = 0;
for (;;) {
- size = sizeof (tmp);
- size2 = sizeof (tmp2);
+ size = sizeof (tmp) / sizeof (TCHAR);
+ size2 = sizeof (tmp2) / sizeof (TCHAR);
if (!regenumstr (fkey, idx, tmp, &size, tmp2, &size2))
break;
- if (strlen (tmp) == 7) {
- idx2 = atol (tmp + 5) - 1;
+ if (_tcslen (tmp) == 7) {
+ idx2 = _tstol (tmp + 5) - 1;
if (idx2 >= 0)
DISK_history_add (tmp2, idx2);
}
SendMessage (guiDlg, WM_COMMAND, ok ? IDOK : IDCANCEL, 0);
}
-static int getcbn (HWND hDlg, int v, char *out, int len)
+static int getcbn (HWND hDlg, int v, TCHAR *out, int len)
{
LRESULT val = SendDlgItemMessage (hDlg, v, CB_GETCURSEL, 0, 0L);
out[0] = 0;
}
#define MAXFAVORITES 30
-static void writefavoritepaths (int num, char **values, char **paths)
+static void writefavoritepaths (int num, TCHAR **values, TCHAR **paths)
{
int i;
UAEREG *fkey;
- fkey = regcreatetree (NULL, "FavoritePaths");
+ fkey = regcreatetree (NULL, L"FavoritePaths");
if (fkey == NULL)
return;
for (i = 0; i < num; i++) {
- char str[MAX_DPATH];
- char key[100];
- if (!strcmp (values[i], paths[i]))
- strcpy (str, values[i]);
+ TCHAR str[MAX_DPATH];
+ TCHAR key[100];
+ if (!_tcscmp (values[i], paths[i]))
+ _tcscpy (str, values[i]);
else
- sprintf (str, "%s \"%s\"", values[i], paths[i]);
- sprintf (key, "PATH_ALL_%02d", i + 1);
+ _stprintf (str, L"%s \"%s\"", values[i], paths[i]);
+ _stprintf (key, L"PATH_ALL_%02d", i + 1);
regsetstr (fkey, key, str);
xfree (values[i]);
xfree (paths[i]);
}
while (i < MAXFAVORITES) {
- char key[100];
- sprintf (key, "PATH_ALL_%02d", i + 1);
+ TCHAR key[100];
+ _stprintf (key, L"PATH_ALL_%02d", i + 1);
regdelete (fkey, key);
i++;
}
}
-static int askinputcustom (HWND hDlg, char *custom, int maxlen, DWORD titleid);
-static int addfavoritepath (HWND hDlg, int num, char **values, char **paths)
+static int askinputcustom (HWND hDlg, TCHAR *custom, int maxlen, DWORD titleid);
+static int addfavoritepath (HWND hDlg, int num, TCHAR **values, TCHAR **paths)
{
- char name[MAX_DPATH];
+ TCHAR name[MAX_DPATH];
const GUID favoriteguid =
{ 0xed6e5ad9, 0xc0aa, 0x42fb, { 0x83, 0x3, 0x37, 0x41, 0x77, 0xb4, 0x6f, 0x18 } };
GetModuleFileName (NULL, stored_path, MAX_DPATH);
while (stored_path[0]) {
DWORD v = GetFileAttributes (stored_path);
- char *s;
+ TCHAR *s;
if (v == INVALID_FILE_ATTRIBUTES)
break;
if (v & FILE_ATTRIBUTE_DIRECTORY)
break;
- s = strrchr (stored_path, '\\');
+ s = _tcsrchr (stored_path, '\\');
if (!s)
- s = strrchr (stored_path, '/');
+ s = _tcsrchr (stored_path, '/');
if (!s) {
stored_path[0] = 0;
break;
}
if (!DirectorySelection (hDlg, &favoriteguid, stored_path))
return 0;
- strcpy (name, stored_path);
- if (askinputcustom (hDlg, name, sizeof name, IDS_SB_FAVORITENAME)) {
+ _tcscpy (name, stored_path);
+ if (askinputcustom (hDlg, name, sizeof name / sizeof (TCHAR), IDS_SB_FAVORITENAME)) {
values[num] = my_strdup (name);
paths[num] = my_strdup (stored_path);
num++;
}
return 1;
}
-static void removefavoritepath (int idx, int num, char **values, char **paths)
+static void removefavoritepath (int idx, int num, TCHAR **values, TCHAR **paths)
{
int i;
writefavoritepaths (num, values, paths);
}
-static void addeditmenu (HMENU menu, char **items)
+static void addeditmenu (HMENU menu, TCHAR **items)
{
int i;
HMENU emenu = CreatePopupMenu ();
- char newpath[MAX_DPATH];
+ TCHAR newpath[MAX_DPATH];
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof mii;
mii.fMask = MIIM_STRING | MIIM_ID;
mii.fType = MFT_STRING;
mii.fState = MFS_ENABLED;
- mii.dwTypeData = "Add New";
- mii.cch = strlen (mii.dwTypeData);
+ mii.dwTypeData = L"Add New";
+ mii.cch = _tcslen (mii.dwTypeData);
mii.wID = 1000;
InsertMenuItem (emenu, -1, TRUE, &mii);
i = 0;
mii.fType = MFT_STRING;
mii.fState = MFS_ENABLED;
mii.wID = 1001 + i;
- sprintf (newpath, "Remove '%s'", items[i]);
+ _stprintf (newpath, L"Remove '%s'", items[i]);
mii.dwTypeData = newpath;
- mii.cch = strlen (mii.dwTypeData);
+ mii.cch = _tcslen (mii.dwTypeData);
InsertMenuItem (emenu, -1, TRUE, &mii);
i++;
}
mii.fMask = MIIM_STRING | MIIM_SUBMENU;
mii.fType = MFT_STRING;
mii.fState = MFS_ENABLED;
- mii.dwTypeData = "Edit";
- mii.cch = strlen (mii.dwTypeData);
+ mii.dwTypeData = L"Edit";
+ mii.cch = _tcslen (mii.dwTypeData);
mii.hSubMenu = emenu;
InsertMenuItem (menu, -1, TRUE, &mii);
}
-static int popupmenu (HWND hwnd, char **items)
+static int popupmenu (HWND hwnd, TCHAR **items)
{
int i, item;
HMENU menu;
mii.fState = MFS_ENABLED;
mii.wID = 1 + i;
mii.dwTypeData = items[i];
- mii.cch = strlen (mii.dwTypeData);
+ mii.cch = _tcslen (mii.dwTypeData);
InsertMenuItem (menu, -1, TRUE, &mii);
i++;
}
DestroyMenu (menu);
return item;
}
-static char *favoritepopup (HWND hwnd)
+static TCHAR *favoritepopup (HWND hwnd)
{
UAEREG *fkey;
int idx, idx2;
- char *values[MAXFAVORITES + 1];
- char *paths[MAXFAVORITES + 1];
+ TCHAR *values[MAXFAVORITES + 1];
+ TCHAR *paths[MAXFAVORITES + 1];
int ret, i, j, num;
for (;;) {
- fkey = regcreatetree (NULL, "FavoritePaths");
+ fkey = regcreatetree (NULL, L"FavoritePaths");
if (fkey == NULL)
return NULL;
idx = 0;
num = 0;
for (;;) {
- char *p;
+ TCHAR *p;
DWORD size, size2;
- char tmp[1000], tmp2[1000];
- size = sizeof (tmp);
- size2 = sizeof (tmp2);
+ TCHAR tmp[1000], tmp2[1000];
+ size = sizeof (tmp) / sizeof (TCHAR);
+ size2 = sizeof (tmp2) / sizeof (TCHAR);
if (!regenumstr (fkey, idx, tmp, &size, tmp2, &size2))
break;
- p = strrchr (tmp, '_');
+ p = _tcsrchr (tmp, '_');
if (p) {
- idx2 = atol (p + 1);
+ idx2 = _tstol (p + 1);
if (idx2 > 0 && idx2 < MAXFAVORITES) {
- char *p2 = strchr (tmp2, '"');
- char *str, *fname;
+ TCHAR *p2 = _tcschr (tmp2, '"');
+ TCHAR *str, *fname;
idx2--;
if (p2) {
fname = my_strdup (p2 + 1);
p2[0] = 0;
- p2 = strchr (fname, '"');
+ p2 = _tcschr (fname, '"');
if (p2)
*p2 = 0;
str = my_strdup (tmp2);
regclosetree (fkey);
for (i = 0; i < idx; i++) {
for (j = i + 1; j < idx; j++) {
- if (strcmp (values[i], values[j]) > 0) {
- char *tmp = values[i];
+ if (_tcscmp (values[i], values[j]) > 0) {
+ TCHAR *tmp = values[i];
values[i] = values[j];
values[j] = tmp;
tmp = paths[i];
size = zfile_ftell (f);
zfile_fseek (f, 0, SEEK_SET);
if (size > 524288 * 2) {/* don't skip KICK disks or 1M ROMs */
- write_log ("'%s': too big %d, ignored\n", zfile_getname(f), size);
+ write_log (L"'%s': too big %d, ignored\n", zfile_getname(f), size);
return 0;
}
zfile_fread (buffer, 1, 11, f);
- if (!memcmp (buffer, "KICK", 4)) {
+ if (!memcmp (buffer, L"KICK", 4)) {
zfile_fseek (f, 512, SEEK_SET);
if (size > 262144)
size = 262144;
- } else if (!memcmp (buffer, "AMIROMTYPE1", 11)) {
+ } else if (!memcmp (buffer, L"AMIROMTYPE1", 11)) {
cl = 1;
size -= 11;
} else {
}
}
if (!rd) {
- write_log ("!: Name='%s':%d\nCRC32=%08X SHA1=%s\n",
+ write_log (L"!: Name='%s':%d\nCRC32=%08X SHA1=%s\n",
zfile_getname(f), size, get_crc32(rombuf, size), get_sha1_txt(rombuf, size));
} else {
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
getromname (rd, tmp);
- write_log ("*: %s:%d = %s\nCRC32=%08X SHA1=%s\n",
+ write_log (L"*: %s:%d = %s\nCRC32=%08X SHA1=%s\n",
zfile_getname(f), size, tmp, get_crc32(rombuf, size), get_sha1_txt(rombuf, size));
}
xfree (rombuf);
return rd;
}
-static struct romdata *scan_single_rom (char *path)
+static struct romdata *scan_single_rom (TCHAR *path)
{
struct zfile *z;
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
struct romdata *rd;
- strcpy (tmp, path);
+ _tcscpy (tmp, path);
rd = scan_arcadia_rom (tmp, 0);
if (rd)
return rd;
rd = getromdatabypath (path);
if (rd && rd->crc32 == 0xffffffff)
return rd;
- z = zfile_fopen (path, "rb");
+ z = zfile_fopen (path, L"rb");
if (!z)
return 0;
return scan_single_rom_2 (z);
}
-static void abspathtorelative (char *name)
+static void abspathtorelative (TCHAR *name)
{
- if (!strnicmp (start_path_exe, name, strlen (start_path_exe)))
- memmove (name, name + strlen (start_path_exe), strlen (name) - strlen (start_path_exe) + 1);
+ if (!_tcsncmp (start_path_exe, name, _tcslen (start_path_exe)))
+ memmove (name, name + _tcslen (start_path_exe), (_tcslen (name) - _tcslen (start_path_exe) + 1) * sizeof (TCHAR));
}
-static int addrom (UAEREG *fkey, struct romdata *rd, char *name)
+static int addrom (UAEREG *fkey, struct romdata *rd, TCHAR *name)
{
- char tmp1[MAX_DPATH], tmp2[MAX_DPATH];
+ TCHAR tmp1[MAX_DPATH], tmp2[MAX_DPATH];
- sprintf (tmp1, "ROM_%03d", rd->id);
+ _stprintf (tmp1, L"ROM_%03d", rd->id);
if (rd->group) {
- char *p = tmp1 + strlen (tmp1);
- sprintf (p, "_%02d_%02d", rd->group >> 16, rd->group & 65535);
+ TCHAR *p = tmp1 + _tcslen (tmp1);
+ _stprintf (p, L"_%02d_%02d", rd->group >> 16, rd->group & 65535);
}
if (regexists (fkey, tmp1))
return 0;
getromname (rd, tmp2);
if (name) {
- strcat (tmp2, " / \"");
+ _tcscat (tmp2, L" / \"");
if (getregmode ())
abspathtorelative (name);
- strcat (tmp2, name);
- strcat (tmp2, "\"");
+ _tcscat (tmp2, name);
+ _tcscat (tmp2, L"\"");
}
if (rd->crc32 == 0xffffffff) {
if (rd->configname)
- sprintf(tmp2, ":%s", rd->configname);
+ _stprintf (tmp2, L":%s", rd->configname);
else
- sprintf(tmp2, ":ROM_%03d", rd->id);
+ _stprintf (tmp2, L":ROM_%03d", rd->id);
}
if (!regsetstr (fkey, tmp1, tmp2))
return 0;
return 1;
}
-static int isromext (char *path)
+static int isromext (TCHAR *path)
{
- char *ext;
+ TCHAR *ext;
int i;
if (!path)
return 0;
- ext = strrchr (path, '.');
+ ext = _tcsrchr (path, '.');
if (!ext)
return 0;
ext++;
- if (!stricmp (ext, "rom") || !stricmp (ext, "adf") || !stricmp (ext, "key")
- || !stricmp (ext, "a500") || !stricmp (ext, "a1200") || !stricmp (ext, "a4000"))
+ if (!_tcsicmp (ext, L"rom") || !_tcsicmp (ext, L"adf") || !_tcsicmp (ext, L"key")
+ || !_tcsicmp (ext, L"a500") || !_tcsicmp (ext, L"a1200") || !_tcsicmp (ext, L"a4000"))
return 1;
- if (strlen (ext) >= 2 && toupper(ext[0]) == 'U' && isdigit (ext[1]))
+ if (_tcslen (ext) >= 2 && toupper(ext[0]) == 'U' && isdigit (ext[1]))
return 1;
for (i = 0; uae_archive_extensions[i]; i++) {
- if (!stricmp (ext, uae_archive_extensions[i]))
+ if (!_tcsicmp (ext, uae_archive_extensions[i]))
return 1;
}
return 0;
static int scan_rom_2 (struct zfile *f, struct romscandata *rsd)
{
- char *path = zfile_getname(f);
+ TCHAR *path = zfile_getname(f);
struct romdata *rd;
if (!isromext(path))
return 0;
}
-static int scan_rom (char *path, UAEREG *fkey)
+static int scan_rom (TCHAR *path, UAEREG *fkey)
{
struct romscandata rsd = { fkey, 0 };
struct romdata *rd;
return 0;
}
for (;;) {
- char tmp[MAX_DPATH];
- strcpy (tmp, path);
+ TCHAR tmp[MAX_DPATH];
+ _tcscpy (tmp, path);
rd = scan_arcadia_rom (tmp, cnt++);
if (rd) {
if (!addrom (fkey, rd, tmp))
static void show_rom_list (void)
{
- char *p;
- char unavail[MAX_DPATH], avail[MAX_DPATH];
- char *p1, *p2;
+ TCHAR *p;
+ TCHAR unavail[MAX_DPATH], avail[MAX_DPATH];
+ TCHAR *p1, *p2;
int *rp;
int romtable[] = {
5, 4, -1, -1, // A500 1.2
0, 0, 0
};
- WIN32GUI_LoadUIString (IDS_ROM_AVAILABLE, avail, sizeof (avail));
- WIN32GUI_LoadUIString (IDS_ROM_UNAVAILABLE, unavail, sizeof (avail));
- strcat (avail, "\n");
- strcat (unavail, "\n");
- p1 = "A500 Boot ROM 1.2\0A500 Boot ROM 1.3\0A500+\0A600\0A1000\0A1200\0A3000\0A4000\0\nCD32\0CDTV\0Arcadia Multi Select\0High end WinUAE\0\nA590/A2091 SCSI Boot ROM\0\0";
+ WIN32GUI_LoadUIString (IDS_ROM_AVAILABLE, avail, sizeof (avail) / sizeof (TCHAR));
+ WIN32GUI_LoadUIString (IDS_ROM_UNAVAILABLE, unavail, sizeof (avail) / sizeof (TCHAR));
+ _tcscat (avail, L"\n");
+ _tcscat (unavail, L"\n");
+ p1 = L"A500 Boot ROM 1.2\0A500 Boot ROM 1.3\0A500+\0A600\0A1000\0A1200\0A3000\0A4000\0\nCD32\0CDTV\0Arcadia Multi Select\0High end WinUAE\0\nA590/A2091 SCSI Boot ROM\0\0";
p = malloc (100000);
if (!p)
return;
WIN32GUI_LoadUIString (IDS_ROMSCANEND, p, 100);
- strcat (p, "\n\n");
+ _tcscat (p, L"\n\n");
rp = romtable;
while(rp[0]) {
int ok = 0;
- p2 = p1 + strlen(p1) + 1;
- strcat (p, " ");
- strcat (p, p1); strcat (p, ": ");
+ p2 = p1 + _tcslen (p1) + 1;
+ _tcscat (p, L" ");
+ _tcscat (p, p1); _tcscat (p, L": ");
if (listrom (rp))
ok = 1;
while(*rp++ != -1);
}
rp++;
if (ok)
- strcat (p, avail); else strcat (p, unavail);
+ _tcscat (p, avail); else _tcscat (p, unavail);
p1 = p2;
}
free (p);
}
-static int scan_roms_2 (UAEREG *fkey, char *path)
+static int scan_roms_2 (UAEREG *fkey, TCHAR *path)
{
- char buf[MAX_DPATH];
+ TCHAR buf[MAX_DPATH];
WIN32_FIND_DATA find_data;
HANDLE handle;
int ret;
if (!path)
return 0;
- write_log("ROM scan directory '%s'\n", path);
- strcpy (buf, path);
- strcat (buf, "*.*");
+ write_log (L"ROM scan directory '%s'\n", path);
+ _tcscpy (buf, path);
+ _tcscat (buf, L"*.*");
ret = 0;
handle = FindFirstFile (buf, &find_data);
if (handle == INVALID_HANDLE_VALUE)
return 0;
for (;;) {
- char tmppath[MAX_DPATH];
- strcpy (tmppath, path);
- strcat (tmppath, find_data.cFileName);
+ TCHAR tmppath[MAX_DPATH];
+ _tcscpy (tmppath, path);
+ _tcscat (tmppath, find_data.cFileName);
if (!(find_data.dwFileAttributes & (FILE_ATTRIBUTE_DIRECTORY |FILE_ATTRIBUTE_SYSTEM)) && find_data.nFileSizeLow < 10000000) {
if (scan_rom (tmppath, fkey))
ret = 1;
#define MAX_ROM_PATHS 10
-static int scan_roms_3(void *fkey, char **paths, char *path)
+static int scan_roms_3(void *fkey, TCHAR **paths, TCHAR *path)
{
int i, ret;
- char pathp[MAX_DPATH];
+ TCHAR pathp[MAX_DPATH];
ret = 0;
GetFullPathName (path, MAX_DPATH, pathp, NULL);
for (i = 0; i < MAX_ROM_PATHS; i++) {
- if (paths[i] && !strcmpi(paths[i], pathp))
+ if (paths[i] && !_tcsicmp (paths[i], pathp))
return ret;
}
ret = scan_roms_2 (fkey, pathp);
return ret;
}
-extern int get_rom_path(char *out, int mode);
+extern int get_rom_path(TCHAR *out, int mode);
int scan_roms (int show)
{
- char path[MAX_DPATH];
+ TCHAR path[MAX_DPATH];
static int recursive;
int id, i, ret, keys, cnt;
UAEREG *fkey, *fkey2;
- char *paths[MAX_ROM_PATHS];
+ TCHAR *paths[MAX_ROM_PATHS];
if (recursive)
return 0;
recursive++;
- regdeletetree (NULL, "DetectedROMs");
- fkey = regcreatetree (NULL, "DetectedROMs");
+ regdeletetree (NULL, L"DetectedROMs");
+ fkey = regcreatetree (NULL, L"DetectedROMs");
if (fkey == NULL)
goto end;
paths[i] = NULL;
for (;;) {
keys = get_keyring ();
- fetch_path ("KickstartPath", path, sizeof path);
+ fetch_path (L"KickstartPath", path, sizeof path / sizeof (TCHAR));
cnt += scan_roms_3 (fkey, paths, path);
if (TRUE) {
for(i = 0; i < MAX_ROM_PATHS; i++) {
cnt += scan_roms_3 (fkey, paths, path);
}
if (get_keyring() > keys) { /* more keys detected in previous scan? */
- write_log ("ROM scan: more keys found, restarting..\n");
+ write_log (L"ROM scan: more keys found, restarting..\n");
for (i = 0; i < MAX_ROM_PATHS; i++) {
xfree (paths[i]);
paths[i] = NULL;
for (i = 0; i < MAX_ROM_PATHS; i++)
xfree (paths[i]);
- fkey2 = regcreatetree (NULL, "DetectedROMS");
+ fkey2 = regcreatetree (NULL, L"DetectedROMS");
if (fkey2) {
id = 1;
for (;;) {
}
struct ConfigStruct {
- char Name[MAX_DPATH];
- char Path[MAX_DPATH];
- char Fullpath[MAX_DPATH];
- char HostLink[MAX_DPATH];
- char HardwareLink[MAX_DPATH];
- char Description[CFG_DESCRIPTION_LENGTH];
+ TCHAR Name[MAX_DPATH];
+ TCHAR Path[MAX_DPATH];
+ TCHAR Fullpath[MAX_DPATH];
+ TCHAR HostLink[MAX_DPATH];
+ TCHAR HardwareLink[MAX_DPATH];
+ TCHAR Description[CFG_DESCRIPTION_LENGTH];
int Type, Directory;
struct ConfigStruct *Parent, *Child;
int host, hardware;
FILETIME t;
};
-static char *configreg[] = { "ConfigFile", "ConfigFileHardware", "ConfigFileHost" };
-static char *configreg2[] = { "", "ConfigFileHardware_Auto", "ConfigFileHost_Auto" };
+static TCHAR *configreg[] = { L"ConfigFile", L"ConfigFileHardware", L"ConfigFileHost" };
+static TCHAR *configreg2[] = { L"", L"ConfigFileHardware_Auto", L"ConfigFileHost_Auto" };
static struct ConfigStruct **configstore;
static int configstoresize, configstoreallocated, configtype, configtypepanel;
-static struct ConfigStruct *getconfigstorefrompath (char *path, char *out, int type)
+static struct ConfigStruct *getconfigstorefrompath (TCHAR *path, TCHAR *out, int type)
{
int i;
for (i = 0; i < configstoresize; i++) {
if (((configstore[i]->Type == 0 || configstore[i]->Type == 3) && type == 0) || (configstore[i]->Type == type)) {
- char path2[MAX_DPATH];
- strcpy (path2, configstore[i]->Path);
- strncat (path2, configstore[i]->Name, MAX_DPATH);
- if (!strcmp (path, path2)) {
- strcpy (out, configstore[i]->Fullpath);
- strncat (out, configstore[i]->Name, MAX_DPATH);
+ TCHAR path2[MAX_DPATH];
+ _tcscpy (path2, configstore[i]->Path);
+ _tcsncat (path2, configstore[i]->Name, MAX_DPATH);
+ if (!_tcscmp (path, path2)) {
+ _tcscpy (out, configstore[i]->Fullpath);
+ _tcsncat (out, configstore[i]->Name, MAX_DPATH);
return configstore[i];
}
}
return 0;
}
-int target_cfgfile_load (struct uae_prefs *p, char *filename, int type, int isdefault)
+int target_cfgfile_load (struct uae_prefs *p, TCHAR *filename, int type, int isdefault)
{
int v, i, type2;
DWORD ct, ct2, size;
- char tmp1[MAX_DPATH], tmp2[MAX_DPATH];
- char fname[MAX_DPATH];
+ TCHAR tmp1[MAX_DPATH], tmp2[MAX_DPATH];
+ TCHAR fname[MAX_DPATH];
- strcpy (fname, filename);
+ _tcscpy (fname, filename);
if (!zfile_exists (fname)) {
- fetch_configurationpath (fname, sizeof (fname));
- if (memcmp(fname, filename, strlen(fname)))
- strcat (fname, filename);
+ fetch_configurationpath (fname, sizeof (fname) / sizeof (TCHAR));
+ if (memcmp(fname, filename, _tcslen (fname)))
+ _tcscat (fname, filename);
else
- strcpy (fname, filename);
+ _tcscpy (fname, filename);
}
if (isdefault)
type2 = type;
if (type == 0)
default_prefs (p, type);
- regqueryint (NULL, "ConfigFile_NoAuto", &ct2);
+ regqueryint (NULL, L"ConfigFile_NoAuto", &ct2);
v = cfgfile_load (p, fname, &type2, ct2);
if (!v)
return v;
ct = 0;
regqueryint (NULL, configreg2[i], &ct);
if (ct && ((i == 1 && p->config_hardware_path[0] == 0) || (i == 2 && p->config_host_path[0] == 0) || ct2)) {
- size = sizeof (tmp1);
+ size = sizeof (tmp1) / sizeof (TCHAR);
regquerystr (NULL, configreg[i], tmp1, &size);
- fetch_path ("ConfigurationPath", tmp2, sizeof (tmp2));
- strcat (tmp2, tmp1);
+ fetch_path (L"ConfigurationPath", tmp2, sizeof (tmp2) / sizeof (TCHAR));
+ _tcscat (tmp2, tmp1);
v = i;
cfgfile_load (p, tmp2, &v, 1);
}
static int mm = 0;
static void m(void)
{
- write_log ("%d:0: %dx%d %dx%d %dx%d\n", mm, currprefs.gfx_size.width, currprefs.gfx_size.height,
+ write_log (L"%d:0: %dx%d %dx%d %dx%d\n", mm, currprefs.gfx_size.width, currprefs.gfx_size.height,
workprefs.gfx_size.width, workprefs.gfx_size.height, changed_prefs.gfx_size.width, changed_prefs.gfx_size.height);
- write_log ("%d:1: %dx%d %dx%d %dx%d\n", mm, currprefs.gfx_size_fs.width, currprefs.gfx_size_fs.height,
+ write_log (L"%d:1: %dx%d %dx%d %dx%d\n", mm, currprefs.gfx_size_fs.width, currprefs.gfx_size_fs.height,
workprefs.gfx_size_fs.width, workprefs.gfx_size_fs.height, changed_prefs.gfx_size_fs.width, changed_prefs.gfx_size_fs.height);
mm++;
}
if (isfullscreen () > 0) {
hr = DirectDraw_FlipToGDISurface ();
if (FAILED (hr))
- write_log ("FlipToGDISurface failed, %s\n", DXError (hr));
+ write_log (L"FlipToGDISurface failed, %s\n", DXError (hr));
}
flush_log ();
DiskSelection (hAmigaWnd, IDC_DF0 + shortcut, 0, &changed_prefs, 0);
} else if (shortcut == 5) {
if (DiskSelection (hAmigaWnd, IDC_DOSAVESTATE, 9, &changed_prefs, 0))
- save_state (savestate_fname, "Description!");
+ save_state (savestate_fname, L"Description!");
} else if (shortcut == 4) {
if (DiskSelection (hAmigaWnd, IDC_DOLOADSTATE, 10, &changed_prefs, 0))
savestate_state = STATE_DORESTORE;
changed_prefs = workprefs;
/* filesys hack */
currprefs.mountitems = changed_prefs.mountitems;
- memcpy(&currprefs.mountconfig, &changed_prefs.mountconfig, MOUNT_CONFIG_SIZE * sizeof (struct uaedev_config_info));
+ memcpy (&currprefs.mountconfig, &changed_prefs.mountconfig, MOUNT_CONFIG_SIZE * sizeof (struct uaedev_config_info));
updatewinfsmode (&changed_prefs);
}
// flag = 14 for loading filesystem
// flag = 15 for loading input
// flag = 16 for recording input
-int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, char *path_out, int *multi)
+int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, TCHAR *path_out, int *multi)
{
static int statefile_previousfilter;
static int previousfilter[20];
OPENFILENAME openFileName;
- char full_path[MAX_DPATH] = "";
- char full_path2[MAX_DPATH];
- char file_name[MAX_DPATH] = "";
- char init_path[MAX_DPATH] = "";
+ TCHAR full_path[MAX_DPATH] = L"";
+ TCHAR full_path2[MAX_DPATH];
+ TCHAR file_name[MAX_DPATH] = L"";
+ TCHAR init_path[MAX_DPATH] = L"";
BOOL result = FALSE;
- char *amiga_path = NULL, *initialdir = NULL, *defext = NULL;
- char description[CFG_DESCRIPTION_LENGTH] = "";
- char *p, *nextp;
+ TCHAR *amiga_path = NULL, *initialdir = NULL, *defext = NULL;
+ TCHAR description[CFG_DESCRIPTION_LENGTH] = L"";
+ TCHAR *p, *nextp;
int all = 1;
int next;
int nosavepath = 0;
const GUID *guid = NULL;
- char szTitle[MAX_DPATH] = { 0 };
- char szFormat[MAX_DPATH];
- char szFilter[MAX_DPATH] = { 0 };
+ TCHAR szTitle[MAX_DPATH] = { 0 };
+ TCHAR szFormat[MAX_DPATH];
+ TCHAR szFilter[MAX_DPATH] = { 0 };
memset (&openFileName, 0, sizeof (OPENFILENAME));
if (path_out && path_out[0]) {
- strcpy (init_path, path_out);
+ _tcscpy (init_path, path_out);
nosavepath = 1;
} else {
- strncpy (init_path, start_path_data, MAX_DPATH);
+ _tcsncpy (init_path, start_path_data, MAX_DPATH);
switch (flag)
{
case 0:
case 1:
- fetch_path ("FloppyPath", init_path, sizeof (init_path));
+ fetch_path (L"FloppyPath", init_path, sizeof (init_path) / sizeof (TCHAR));
guid = &diskselectionguids[0];
break;
case 2:
case 3:
- fetch_path ("hdfPath", init_path, sizeof (init_path));
+ fetch_path (L"hdfPath", init_path, sizeof (init_path) / sizeof (TCHAR));
guid = &diskselectionguids[1];
break;
case 6:
case 7:
case 11:
- fetch_path ("KickstartPath", init_path, sizeof (init_path));
+ fetch_path (L"KickstartPath", init_path, sizeof (init_path) / sizeof (TCHAR));
guid = &diskselectionguids[2];
break;
case 4:
case 5:
case 8:
- fetch_path ("ConfigurationPath", init_path, sizeof (init_path));
+ fetch_path (L"ConfigurationPath", init_path, sizeof (init_path) / sizeof (TCHAR));
guid = &diskselectionguids[3];
break;
case 9:
{
int ok = 0;
if (savestate_fname[0]) {
- strcpy (init_path, savestate_fname);
+ _tcscpy (init_path, savestate_fname);
for (;;) {
- char *p;
+ TCHAR *p;
if (my_existsdir (init_path)) {
ok = 1;
break;
}
- p = strrchr (init_path, '\\');
+ p = _tcsrchr (init_path, '\\');
if (!p)
- p = strrchr (init_path, '/');
+ p = _tcsrchr (init_path, '/');
if (!p)
break;
*p = 0;
}
}
if (!ok)
- fetch_path ("StatefilePath", init_path, sizeof (init_path));
+ fetch_path (L"StatefilePath", init_path, sizeof (init_path) / sizeof (TCHAR));
guid = &diskselectionguids[4];
}
break;
case 15:
case 16:
- fetch_path ("InputPath", init_path, sizeof (init_path));
+ fetch_path (L"InputPath", init_path, sizeof (init_path) / sizeof (TCHAR));
guid = &diskselectionguids[5];
break;
}
case 0:
WIN32GUI_LoadUIString (IDS_SELECTADF, szTitle, MAX_DPATH);
WIN32GUI_LoadUIString (IDS_ADF, szFormat, MAX_DPATH);
- sprintf (szFilter, "%s ", szFormat);
- memcpy (szFilter + strlen (szFilter), DISK_FORMAT_STRING, sizeof (DISK_FORMAT_STRING) + 1);
- defext = "ADF";
+ _stprintf (szFilter, L"%s ", szFormat);
+ memcpy (szFilter + _tcslen (szFilter), DISK_FORMAT_STRING, sizeof (DISK_FORMAT_STRING) + sizeof (TCHAR));
+ defext = L"ADF";
break;
case 1:
WIN32GUI_LoadUIString (IDS_CHOOSEBLANK, szTitle, MAX_DPATH);
WIN32GUI_LoadUIString (IDS_ADF, szFormat, MAX_DPATH);
- sprintf (szFilter, "%s ", szFormat);
- memcpy (szFilter + strlen (szFilter), "(*.adf)\0*.adf\0", 15);
- defext = "ADF";
+ _stprintf (szFilter, L"%s ", szFormat);
+ memcpy (szFilter + _tcslen (szFilter), L"(*.adf)\0*.adf\0", 15);
+ defext = L"ADF";
break;
case 2:
case 3:
WIN32GUI_LoadUIString (IDS_SELECTHDF, szTitle, MAX_DPATH);
WIN32GUI_LoadUIString (IDS_HDF, szFormat, MAX_DPATH);
- sprintf (szFilter, "%s ", szFormat);
- memcpy (szFilter + strlen (szFilter), HDF_FORMAT_STRING, sizeof (HDF_FORMAT_STRING) + 1);
- defext = "HDF";
+ _stprintf (szFilter, L"%s ", szFormat);
+ memcpy (szFilter + _tcslen (szFilter), HDF_FORMAT_STRING, sizeof (HDF_FORMAT_STRING) + sizeof (TCHAR));
+ defext = L"HDF";
break;
case 4:
case 5:
WIN32GUI_LoadUIString (IDS_SELECTUAE, szTitle, MAX_DPATH);
WIN32GUI_LoadUIString (IDS_UAE, szFormat, MAX_DPATH );
- sprintf (szFilter, "%s ", szFormat);
- memcpy (szFilter + strlen (szFilter), "(*.uae)\0*.uae\0", 15);
- defext = "UAE";
+ _stprintf (szFilter, L"%s ", szFormat);
+ memcpy (szFilter + _tcslen (szFilter), L"(*.uae)\0*.uae\0", 15);
+ defext = L"UAE";
break;
case 6:
WIN32GUI_LoadUIString (IDS_SELECTROM, szTitle, MAX_DPATH);
WIN32GUI_LoadUIString (IDS_ROM, szFormat, MAX_DPATH);
- sprintf (szFilter, "%s ", szFormat);
- memcpy (szFilter + strlen(szFilter), ROM_FORMAT_STRING, sizeof (ROM_FORMAT_STRING) + 1);
- defext = "ROM";
+ _stprintf (szFilter, L"%s ", szFormat);
+ memcpy (szFilter + _tcslen (szFilter), ROM_FORMAT_STRING, sizeof (ROM_FORMAT_STRING) + sizeof (TCHAR));
+ defext = L"ROM";
break;
case 7:
WIN32GUI_LoadUIString (IDS_SELECTKEY, szTitle, MAX_DPATH);
WIN32GUI_LoadUIString (IDS_KEY, szFormat, MAX_DPATH);
- sprintf (szFilter, "%s ", szFormat);
- memcpy (szFilter + strlen(szFilter), "(*.key)\0*.key\0", 15);
- defext = "KEY";
+ _stprintf (szFilter, L"%s ", szFormat);
+ memcpy (szFilter + _tcslen (szFilter), L"(*.key)\0*.key\0", 15);
+ defext = L"KEY";
break;
case 15:
case 16:
WIN32GUI_LoadUIString (flag == 15 ? IDS_RESTOREINP : IDS_SAVEINP, szTitle, MAX_DPATH);
WIN32GUI_LoadUIString (IDS_INP, szFormat, MAX_DPATH);
- sprintf (szFilter, "%s ", szFormat);
- memcpy (szFilter + strlen(szFilter), INP_FORMAT_STRING, sizeof (INP_FORMAT_STRING) + 1);
- defext = "IMP";
+ _stprintf (szFilter, L"%s ", szFormat);
+ memcpy (szFilter + _tcslen (szFilter), INP_FORMAT_STRING, sizeof (INP_FORMAT_STRING) + sizeof (TCHAR));
+ defext = L"IMP";
break;
case 9:
case 10:
WIN32GUI_LoadUIString (flag == 10 ? IDS_RESTOREUSS : IDS_SAVEUSS, szTitle, MAX_DPATH);
WIN32GUI_LoadUIString (IDS_USS, szFormat, MAX_DPATH);
- sprintf (szFilter, "%s ", szFormat);
+ _stprintf (szFilter, L"%s ", szFormat);
if (flag == 10) {
- memcpy (szFilter + strlen(szFilter), USS_FORMAT_STRING_RESTORE, sizeof (USS_FORMAT_STRING_RESTORE) + 1);
+ memcpy (szFilter + _tcslen (szFilter), USS_FORMAT_STRING_RESTORE, sizeof (USS_FORMAT_STRING_RESTORE) + sizeof (TCHAR));
all = 1;
} else {
- char tmp[MAX_DPATH];
- memcpy (szFilter + strlen(szFilter), USS_FORMAT_STRING_SAVE, sizeof (USS_FORMAT_STRING_SAVE) + 1);
+ TCHAR tmp[MAX_DPATH];
+ memcpy (szFilter + _tcslen (szFilter), USS_FORMAT_STRING_SAVE, sizeof (USS_FORMAT_STRING_SAVE) + sizeof (TCHAR));
p = szFilter;
while (p[0] != 0 || p[1] !=0 ) p++;
p++;
- WIN32GUI_LoadUIString (IDS_STATEFILE_UNCOMPRESSED, tmp, sizeof (tmp));
- strcat (p, tmp);
- strcat (p, " (*.uss)");
- p += strlen (p) + 1;
- strcpy (p, "*.uss");
- p += strlen (p) + 1;
- WIN32GUI_LoadUIString (IDS_STATEFILE_RAMDUMP, tmp, sizeof (tmp));
- strcat (p, tmp);
- strcat (p, " (*.dat)");
- p += strlen(p) + 1;
- strcpy (p, "*.dat");
- p += strlen (p) + 1;
- WIN32GUI_LoadUIString (IDS_STATEFILE_WAVE, tmp, sizeof (tmp));
- strcat (p, tmp);
- strcat (p, " (*.wav)");
- p += strlen (p) + 1;
- strcpy (p, "*.wav");
- p += strlen (p) + 1;
+ WIN32GUI_LoadUIString (IDS_STATEFILE_UNCOMPRESSED, tmp, sizeof (tmp) / sizeof (TCHAR));
+ _tcscat (p, tmp);
+ _tcscat (p, L" (*.uss)");
+ p += _tcslen (p) + 1;
+ _tcscpy (p, L"*.uss");
+ p += _tcslen (p) + 1;
+ WIN32GUI_LoadUIString (IDS_STATEFILE_RAMDUMP, tmp, sizeof (tmp) / sizeof (TCHAR));
+ _tcscat (p, tmp);
+ _tcscat (p, L" (*.dat)");
+ p += _tcslen (p) + 1;
+ _tcscpy (p, L"*.dat");
+ p += _tcslen (p) + 1;
+ WIN32GUI_LoadUIString (IDS_STATEFILE_WAVE, tmp, sizeof (tmp) / sizeof (TCHAR));
+ _tcscat (p, tmp);
+ _tcscat (p, L" (*.wav)");
+ p += _tcslen (p) + 1;
+ _tcscpy (p, L"*.wav");
+ p += _tcslen (p) + 1;
*p = 0;
all = 0;
}
- defext = "USS";
+ defext = L"USS";
break;
case 11:
WIN32GUI_LoadUIString (IDS_SELECTFLASH, szTitle, MAX_DPATH);
WIN32GUI_LoadUIString (IDS_FLASH, szFormat, MAX_DPATH);
- sprintf (szFilter, "%s ", szFormat);
- memcpy (szFilter + strlen (szFilter), "(*.nvr)\0*.nvr\0", 15);
- defext = "NVR";
+ _stprintf (szFilter, L"%s ", szFormat);
+ memcpy (szFilter + _tcslen (szFilter), L"(*.nvr)\0*.nvr\0", 15 * sizeof (TCHAR));
+ defext = L"NVR";
break;
case 8:
default:
initialdir = path_out;
break;
case 14:
- strcpy (szTitle, "Select supported archive file");
- sprintf (szFilter, "%s (%s)", "Archive", ARCHIVE_STRING);
- strcpy (szFilter + strlen (szFilter) + 1, ARCHIVE_STRING);
+ _tcscpy (szTitle, L"Select supported archive file");
+ _stprintf (szFilter, L"%s (%s)", L"Archive", ARCHIVE_STRING);
+ _tcscpy (szFilter + _tcslen (szFilter) + 1, ARCHIVE_STRING);
initialdir = path_out;
break;
}
p = szFilter;
while (p[0] != 0 || p[1] !=0) p++;
p++;
- strcpy (p, "All files (*.*)");
- p += strlen(p) + 1;
- strcpy (p, "*.*");
- p += strlen(p) + 1;
+ _tcscpy (p, L"All files (*.*)");
+ p += _tcslen (p) + 1;
+ _tcscpy (p, L"*.*");
+ p += _tcslen (p) + 1;
*p = 0;
}
openFileName.lStructSize = sizeof (OPENFILENAME);
openFileName.Flags |= OFN_ALLOWMULTISELECT;
if (flag == 1 || flag == 3 || flag == 5 || flag == 9 || flag == 11 || flag == 16) {
if (!(result = GetSaveFileName_2 (&openFileName, guid)))
- write_log ("GetSaveFileNameX() failed, err=%d.\n", GetLastError());
+ write_log (L"GetSaveFileNameX() failed, err=%d.\n", GetLastError());
} else {
if (!(result = GetOpenFileName_2 (&openFileName, guid)))
- write_log ("GetOpenFileNameX() failed, err=%d.\n", GetLastError());
+ write_log (L"GetOpenFileNameX() failed, err=%d.\n", GetLastError());
}
previousfilter[flag] = openFileName.nFilterIndex;
- memcpy (full_path2, full_path, sizeof (full_path));
- memcpy (stored_path, full_path, sizeof (stored_path));
+ memcpy (full_path2, full_path, sizeof (full_path) / sizeof (TCHAR));
+ memcpy (stored_path, full_path, sizeof (stored_path) / sizeof (TCHAR));
next = 0;
nextp = full_path2 + openFileName.nFileOffset;
if (path_out) {
if (multi) {
while (nextp[0])
- nextp += strlen (nextp) + 1;
- memcpy (path_out, full_path2, nextp - full_path2 + 1);
+ nextp += _tcslen (nextp) + 1;
+ memcpy (path_out, full_path2, (nextp - full_path2 + 1) * sizeof (TCHAR));
} else {
- strcpy (path_out, full_path2);
+ _tcscpy (path_out, full_path2);
}
}
nextp = full_path2 + openFileName.nFileOffset;
- if (nextp[strlen(nextp) + 1] == 0)
+ if (nextp[_tcslen (nextp) + 1] == 0)
multi = 0;
while (result && next >= 0)
{
if (multi) {
if (nextp[0] == 0)
break;
- sprintf (full_path, "%s\\%s", full_path2, nextp);
- nextp += strlen (nextp) + 1;
+ _stprintf (full_path, L"%s\\%s", full_path2, nextp);
+ nextp += _tcslen (nextp) + 1;
}
switch (wParam)
{
case IDC_PATH_NAME:
case IDC_PATH_FILESYS:
if (flag == 8) {
- if(strstr(full_path, "Configurations\\")) {
- strcpy(full_path, init_path);
- strcat(full_path, file_name);
+ if(_tcsstr(full_path, L"Configurations\\")) {
+ _tcscpy(full_path, init_path);
+ _tcscat(full_path, file_name);
}
}
SetDlgItemText (hDlg, wParam, full_path);
case IDC_DF0:
case IDC_DF0QQ:
SetDlgItemText (hDlg, IDC_DF0TEXT, full_path);
- strcpy(prefs->df[0], full_path);
+ _tcscpy(prefs->df[0], full_path);
DISK_history_add (full_path, -1);
next = IDC_DF1;
break;
case IDC_DF1:
case IDC_DF1QQ:
SetDlgItemText (hDlg, IDC_DF1TEXT, full_path);
- strcpy(prefs->df[1], full_path);
+ _tcscpy(prefs->df[1], full_path);
DISK_history_add (full_path, -1);
next = IDC_DF2;
break;
case IDC_DF2:
SetDlgItemText (hDlg, IDC_DF2TEXT, full_path);
- strcpy(prefs->df[2], full_path);
+ _tcscpy(prefs->df[2], full_path);
DISK_history_add (full_path, -1);
next = IDC_DF3;
break;
case IDC_DF3:
SetDlgItemText (hDlg, IDC_DF3TEXT, full_path);
- strcpy (prefs->df[3], full_path);
+ _tcscpy (prefs->df[3], full_path);
DISK_history_add (full_path, -1);
break;
case IDC_DOSAVESTATE:
break;
case IDC_CREATE:
{
- char disk_name[32];
+ TCHAR disk_name[32];
disk_name[0] = 0; disk_name[31] = 0;
GetDlgItemText (hDlg, IDC_CREATE_NAME, disk_name, 30);
disk_creatediskfile (full_path, 0, SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_GETCURSEL, 0, 0L), disk_name);
break;
case IDC_LOAD:
if (target_cfgfile_load (&workprefs, full_path, 0, 0) == 0) {
- char szMessage[MAX_DPATH];
+ TCHAR szMessage[MAX_DPATH];
WIN32GUI_LoadUIString (IDS_COULDNOTLOADCONFIG, szMessage, MAX_DPATH);
pre_gui_message (szMessage);
} else {
cfgfile_save (&workprefs, full_path, 0);
break;
case IDC_ROMFILE:
- strcpy (workprefs.romfile, full_path);
+ _tcscpy (workprefs.romfile, full_path);
break;
case IDC_ROMFILE2:
- strcpy (workprefs.romextfile, full_path);
+ _tcscpy (workprefs.romextfile, full_path);
break;
case IDC_FLASHFILE:
- strcpy (workprefs.flashfile, full_path);
+ _tcscpy (workprefs.flashfile, full_path);
break;
case IDC_CARTFILE:
- strcpy (workprefs.cartfile, full_path);
+ _tcscpy (workprefs.cartfile, full_path);
break;
case IDC_INPREC_PLAY:
inprec_open (full_path, IsDlgButtonChecked (hDlg, IDC_INPREC_PLAYMODE) == BST_CHECKED ? -1 : -2);
}
if (!nosavepath) {
if (flag == 0 || flag == 1) {
- amiga_path = strstr (openFileName.lpstrFile, openFileName.lpstrFileTitle);
+ amiga_path = _tcsstr (openFileName.lpstrFile, openFileName.lpstrFileTitle);
if (amiga_path && amiga_path != openFileName.lpstrFile) {
*amiga_path = 0;
- regsetstr (NULL, "FloppyPath", openFileName.lpstrFile);
+ regsetstr (NULL, L"FloppyPath", openFileName.lpstrFile);
}
} else if (flag == 2 || flag == 3) {
- amiga_path = strstr (openFileName.lpstrFile, openFileName.lpstrFileTitle);
+ amiga_path = _tcsstr (openFileName.lpstrFile, openFileName.lpstrFileTitle);
if (amiga_path && amiga_path != openFileName.lpstrFile) {
*amiga_path = 0;
- regsetstr (NULL, "hdfPath", openFileName.lpstrFile);
+ regsetstr (NULL, L"hdfPath", openFileName.lpstrFile);
}
}
}
}
return result;
}
-int DiskSelection (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, char *path_out)
+int DiskSelection (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, TCHAR *path_out)
{
return DiskSelection_2 (hDlg, wParam, flag, prefs, path_out, NULL);
}
-int MultiDiskSelection (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, char *path_out)
+int MultiDiskSelection (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, TCHAR *path_out)
{
int multi = 0;
return DiskSelection_2 (hDlg, wParam, flag, prefs, path_out, &multi);
}
-static int loopmulti (char *s, char *out)
+static int loopmulti (TCHAR *s, TCHAR *out)
{
static int index;
if (!out) {
- index = strlen (s) + 1;
+ index = _tcslen (s) + 1;
return 1;
}
if (index < 0)
return 0;
if (!s[index]) {
- if (s[strlen (s) + 1] == 0) {
- strcpy (out, s);
+ if (s[_tcslen (s) + 1] == 0) {
+ _tcscpy (out, s);
index = -1;
return 1;
}
return 0;
}
- sprintf (out, "%s\\%s", s, s + index);
- index += strlen (s + index) + 1;
+ _stprintf (out, L"%s\\%s", s, s + index);
+ index += _tcslen (s + index) + 1;
return 1;
}
-static BOOL CreateHardFile (HWND hDlg, UINT hfsizem, char *dostype, char *newpath)
+static BOOL CreateHardFile (HWND hDlg, UINT hfsizem, TCHAR *dostype, TCHAR *newpath)
{
HANDLE hf;
int i = 0;
BOOL result = FALSE;
LONG highword = 0;
DWORD ret, written;
- char init_path[MAX_DPATH] = "";
+ TCHAR init_path[MAX_DPATH] = L"";
uae_u64 hfsize;
uae_u32 dt;
uae_u8 b;
ret = SetFilePointer (hf, (DWORD)hfsize, NULL, FILE_BEGIN);
}
if (ret == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR)
- write_log ("SetFilePointer() failure for %s to posn %ud\n", init_path, hfsize);
+ write_log (L"SetFilePointer() failure for %s to posn %ud\n", init_path, hfsize);
else
result = SetEndOfFile (hf);
SetFilePointer (hf, 0, NULL, FILE_BEGIN);
WriteFile (hf, &b, 1, &written, NULL);
WriteFile (hf, &b, 1, &written, NULL);
WriteFile (hf, &b, 1, &written, NULL);
- if (sscanf (dostype, "%x", &dt) > 0) {
+ if (_stscanf (dostype, L"%x", &dt) > 0) {
SetFilePointer (hf, 0, NULL, FILE_BEGIN);
b = dt >> 24;
WriteFile (hf, &b, 1, &written, NULL);
}
CloseHandle (hf);
} else {
- write_log ("CreateFile() failed to create %s\n", init_path);
+ write_log (L"CreateFile() failed to create %s\n", init_path);
}
SetCursor (LoadCursor (NULL, IDC_ARROW));
}
}
if (!result) {
- char szMessage[MAX_DPATH];
- char szTitle[MAX_DPATH];
+ TCHAR szMessage[MAX_DPATH];
+ TCHAR szTitle[MAX_DPATH];
WIN32GUI_LoadUIString (IDS_FAILEDHARDFILECREATION, szMessage, MAX_DPATH);
WIN32GUI_LoadUIString (IDS_CREATIONERROR, szTitle, MAX_DPATH);
MessageBox (hDlg, szMessage, szTitle, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
return result;
}
-static const char *memsize_names[] = {
+static const TCHAR *memsize_names[] = {
/* 0 */ szNone,
-/* 1 */ "256 K",
-/* 2 */ "512 K",
-/* 3 */ "1 MB",
-/* 4 */ "2 MB",
-/* 5 */ "4 MB",
-/* 6 */ "8 MB",
-/* 7 */ "16 MB",
-/* 8 */ "32 MB",
-/* 9 */ "64 MB",
-/* 10*/ "128 MB",
-/* 11*/ "256 MB",
-/* 12*/ "512 MB",
-/* 13*/ "1 GB",
-/* 14*/ "1.5MB",
-/* 15*/ "1.8MB",
-/* 16*/ "2 GB",
-/* 17*/ "384 MB",
-/* 18*/ "768 MB",
-/* 19*/ "1.5 GB",
+/* 1 */ L"256 K",
+/* 2 */ L"512 K",
+/* 3 */ L"1 MB",
+/* 4 */ L"2 MB",
+/* 5 */ L"4 MB",
+/* 6 */ L"8 MB",
+/* 7 */ L"16 MB",
+/* 8 */ L"32 MB",
+/* 9 */ L"64 MB",
+/* 10*/ L"128 MB",
+/* 11*/ L"256 MB",
+/* 12*/ L"512 MB",
+/* 13*/ L"1 GB",
+/* 14*/ L"1.5MB",
+/* 15*/ L"1.8MB",
+/* 16*/ L"2 GB",
+/* 17*/ L"384 MB",
+/* 18*/ L"768 MB",
+/* 19*/ L"1.5 GB",
};
static unsigned long memsizes[] = {
return mbytes;
}
-static const char *nth[] = {
- "", "second ", "third ", "fourth ", "fifth ", "sixth ", "seventh ", "eighth ", "ninth ", "tenth "
+static const TCHAR *nth[] = {
+ L"", L"second ", L"third ", L"fourth ", L"fifth ", L"sixth ", L"seventh ", L"eighth ", L"ninth ", L"tenth "
};
static void setguititle (HWND phwnd)
{
- static char title[200];
- char title2[1000];
- char *name;
+ static TCHAR title[200];
+ TCHAR title2[1000];
+ TCHAR *name;
static HWND hwnd;
if (phwnd)
hwnd = phwnd;
if (hwnd && !title[0]) {
- GetWindowText (hwnd, title, sizeof (title));
- if (strlen (WINUAEBETA) > 0) {
- strcat (title, BetaStr);
- if (strlen(WINUAEEXTRA) > 0) {
- strcat (title, " ");
- strcat (title, WINUAEEXTRA);
+ GetWindowText (hwnd, title, sizeof (title) / sizeof (TCHAR));
+ if (_tcslen (WINUAEBETA) > 0) {
+ _tcscat (title, BetaStr);
+ if (_tcslen (WINUAEEXTRA) > 0) {
+ _tcscat (title, L" ");
+ _tcscat (title, WINUAEEXTRA);
}
}
}
title2[0] = 0;
name = config_filename;
- if (name && strlen (name) > 0) {
- strcat (title2, "[");
- strcat (title2, name);
- strcat (title2, "] - ");
+ if (name && _tcslen (name) > 0) {
+ _tcscat (title2, L"[");
+ _tcscat (title2, name);
+ _tcscat (title2, L"] - ");
}
- strcat (title2, title);
+ _tcscat (title2, title);
SetWindowText (hwnd, title2);
}
-static void GetConfigPath (char *path, struct ConfigStruct *parent, int noroot)
+static void GetConfigPath (TCHAR *path, struct ConfigStruct *parent, int noroot)
{
if (parent == NULL) {
path[0] = 0;
if (!noroot) {
- fetch_path ("ConfigurationPath", path, MAX_DPATH);
+ fetch_path (L"ConfigurationPath", path, MAX_DPATH);
}
return;
}
if (parent) {
GetConfigPath (path, parent->Parent, noroot);
- strncat (path, parent->Name, MAX_DPATH);
- strncat (path, "\\", MAX_DPATH);
+ _tcsncat (path, parent->Name, MAX_DPATH);
+ _tcsncat (path, L"\\", MAX_DPATH);
}
}
configstoresize = configstoreallocated = 0;
}
-static void getconfigcache (char *dst, const char *path)
+static void getconfigcache (TCHAR *dst, const TCHAR *path)
{
- strcpy (dst, path);
- strncat (dst, "configuration.cache", MAX_DPATH);
+ _tcscpy (dst, path);
+ _tcsncat (dst, L"configuration.cache", MAX_DPATH);
}
-static char *fgetsx (char *dst, FILE *f)
+static TCHAR *fgetsx (TCHAR *dst, FILE *f)
{
- char *s;
+ TCHAR *s2;
dst[0] = 0;
- s = fgets (dst, MAX_DPATH, f);
- if (!s)
- return s;
- if (strlen (dst) == 0)
- return s;
- if (dst[strlen (dst) - 1] == '\n')
- dst[strlen (dst) - 1] = 0;
- if (dst[strlen (dst) - 1] == '\r')
- dst[strlen (dst) - 1] = 0;
- return s;
+ s2 = fgetws (dst, MAX_DPATH, f);
+ if (!s2)
+ return NULL;
+ if (_tcslen (dst) == 0)
+ return dst;
+ if (dst[_tcslen (dst) - 1] == '\n')
+ dst[_tcslen (dst) - 1] = 0;
+ if (dst[_tcslen (dst) - 1] == '\r')
+ dst[_tcslen (dst) - 1] = 0;
+ return dst;
}
-static char configcachever[] = "WinUAE Configuration.Cache";
+static TCHAR configcachever[] = L"WinUAE Configuration.Cache";
static void setconfighosthard (struct ConfigStruct *config)
{
if (!config->Directory)
return;
- if (!stricmp (config->Name, CONFIG_HOST))
+ if (!_tcsicmp (config->Name, CONFIG_HOST))
config->host = 1;
- if (!stricmp (config->Name, CONFIG_HARDWARE))
+ if (!_tcsicmp (config->Name, CONFIG_HARDWARE))
config->hardware = 1;
}
-static void flushconfigcache (const char *cachepath)
+static void flushconfigcache (const TCHAR *cachepath)
{
FILE *zcache;
- zcache = fopen (cachepath, "r");
+ zcache = _tfopen (cachepath, L"r");
if (zcache == NULL)
return;
fclose (zcache);
- zcache = fopen (cachepath, "w+");
+ zcache = _tfopen (cachepath, L"w+, ccs=UTF-8");
if (zcache)
fclose (zcache);
- write_log ("'%s' flushed\n", cachepath);
+ write_log (L"'%s' flushed\n", cachepath);
}
-static struct ConfigStruct *readconfigcache (const char *path)
+static struct ConfigStruct *readconfigcache (const TCHAR *path)
{
FILE *zcache;
- char cachepath[MAX_DPATH];
- char buf[MAX_DPATH];
- char rootpath[MAX_DPATH];
- char path2[MAX_DPATH], tmp[MAX_DPATH];
+ TCHAR cachepath[MAX_DPATH];
+ TCHAR buf[MAX_DPATH];
+ TCHAR rootpath[MAX_DPATH];
+ TCHAR path2[MAX_DPATH], tmp[MAX_DPATH];
struct ConfigStruct *cs, *first;
int err;
int filelines, dirlines, headlines, dirmode, lines;
- char dirsep = '\\';
+ TCHAR dirsep = '\\';
FILETIME t;
SYSTEMTIME st;
ULARGE_INTEGER t1, stt, dirtt;
err = 0;
first = NULL;
getconfigcache (cachepath, path);
- zcache = fopen (cachepath, "r");
+ zcache = _tfopen (cachepath, L"r");
if (!zcache)
return NULL;
if (!configurationcache) {
fclose (zcache);
- unlink (cachepath);
+ _wunlink (cachepath);
return NULL;
}
fgetsx (buf, zcache);
if (feof (zcache))
goto end;
- if (strcmp (buf, configcachever))
+ if (_tcscmp (buf, configcachever))
goto end;
- GetFullPathName (path, sizeof path2, path2, NULL);
- strcpy (rootpath, path2);
- if (path2[strlen (path2) - 1] == '\\' || path2[strlen (path2) -1] == '/')
- path2[strlen (path2) - 1] = 0;
+ GetFullPathName (path, sizeof path2 / sizeof (TCHAR), path2, NULL);
+ _tcscpy (rootpath, path2);
+ if (path2[_tcslen (path2) - 1] == '\\' || path2[_tcslen (path2) -1] == '/')
+ path2[_tcslen (path2) - 1] = 0;
h = FindFirstFile (path2, &ffd);
if (h == INVALID_HANDLE_VALUE)
goto end;
memcpy (&dirtt, &ffd.ftLastWriteTime, sizeof (ULARGE_INTEGER));
fgetsx (buf, zcache);
- headlines = atol (buf);
+ headlines = _tstol (buf);
fgetsx (buf, zcache);
headlines--;
- dirlines = atol (buf);
+ dirlines = _tstol (buf);
fgetsx (buf, zcache);
headlines--;
- filelines = atol (buf);
+ filelines = _tstol (buf);
fgetsx (buf, zcache);
- t1.QuadPart = _atoi64 (buf);
+ t1.QuadPart = _tstoi64 (buf);
headlines--;
GetSystemTime (&st);
SystemTimeToFileTime (&st, &t);
goto end;
while (fgetsx (buf, zcache)) {
- char c;
- char dirpath[MAX_DPATH];
+ TCHAR c;
+ TCHAR dirpath[MAX_DPATH];
dirmode = 0;
- if (strlen (buf) > 0) {
- c = buf[strlen (buf) - 1];
+ if (_tcslen (buf) > 0) {
+ c = buf[_tcslen (buf) - 1];
if (c == '/' || c == '\\') {
dirmode = 1;
dirsep = c;
}
}
- strcpy (dirpath, buf);
+ _tcscpy (dirpath, buf);
if (dirmode) {
lines = dirlines;
} else {
- char *p;
+ TCHAR *p;
lines = filelines;
- p = strrchr (dirpath, dirsep);
+ p = _tcsrchr (dirpath, dirsep);
if (p)
p[0] = 0;
else
first = cs;
cs->Directory = dirmode;
- strcpy (tmp, path);
- strcat (tmp, dirpath);
- strcpy (cs->Fullpath, tmp);
- strcpy (cs->Path, dirpath);
+ _tcscpy (tmp, path);
+ _tcscat (tmp, dirpath);
+ _tcscpy (cs->Fullpath, tmp);
+ _tcscpy (cs->Path, dirpath);
fgetsx (tmp, zcache);
lines--;
- t1.QuadPart = _atoi64 (tmp);
+ t1.QuadPart = _tstoi64 (tmp);
if (t1.QuadPart > stt.QuadPart)
goto end;
fgetsx (cs->Description, zcache);
lines--;
- strcpy (tmp, cs->Path);
- if (strlen (tmp) > 0) {
- char *p = tmp;
- if (tmp[strlen (tmp) - 1] == dirsep) {
- tmp[strlen (tmp) - 1] = 0;
- p = strrchr (tmp, dirsep);
+ _tcscpy (tmp, cs->Path);
+ if (_tcslen (tmp) > 0) {
+ TCHAR *p = tmp;
+ if (tmp[_tcslen (tmp) - 1] == dirsep) {
+ tmp[_tcslen (tmp) - 1] = 0;
+ p = _tcsrchr (tmp, dirsep);
if (p)
p[1] = 0;
} else {
- tmp[strlen (tmp) + 1] = 0;
- tmp[strlen (tmp)] = dirsep;
+ tmp[_tcslen (tmp) + 1] = 0;
+ tmp[_tcslen (tmp)] = dirsep;
}
if (p) {
int i;
for (i = 0; i < configstoresize; i++) {
struct ConfigStruct *cs2 = configstore[i];
- if (cs2 != cs && !strcmp (cs2->Path, tmp) && cs2->Directory) {
+ if (cs2 != cs && !_tcscmp (cs2->Path, tmp) && cs2->Directory) {
cs->Parent = cs2;
if (!cs2->Child)
cs2->Child = cs;
}
}
- if (strlen (cs->Path) > 0 && !dirmode) {
- strcat (cs->Path, "\\");
- strcat (cs->Fullpath, "\\");
+ if (_tcslen (cs->Path) > 0 && !dirmode) {
+ _tcscat (cs->Path, L"\\");
+ _tcscat (cs->Fullpath, L"\\");
}
if (!dirmode) {
lines--;
fgetsx (buf, zcache);
lines--;
- cs->Type = atol (buf);
+ cs->Type = _tstol (buf);
}
setconfighosthard (cs);
err = 1;
fclose (zcache);
if (err || first == NULL) {
- write_log ("'%s' load failed\n", cachepath);
+ write_log (L"'%s' load failed\n", cachepath);
flushconfigcache (cachepath);
FreeConfigStore ();
return NULL;
} else {
- write_log ("'%s' loaded successfully\n", cachepath);
+ write_log (L"'%s' loaded successfully\n", cachepath);
}
return first;
}
-static void writeconfigcacheentry (FILE *zcache, const char *relpath, struct ConfigStruct *cs)
+static void writeconfigcacheentry (FILE *zcache, const TCHAR *relpath, struct ConfigStruct *cs)
{
- char path2[MAX_DPATH];
- char lf = 10;
- char el[] = ";\n";
- char *p;
+ TCHAR path2[MAX_DPATH];
+ TCHAR lf = 10;
+ TCHAR el[] = L";\n";
+ TCHAR *p;
ULARGE_INTEGER li;
- GetFullPathName (cs->Fullpath, sizeof path2, path2, NULL);
- if (strlen (path2) < strlen (relpath))
+ GetFullPathName (cs->Fullpath, sizeof path2 / sizeof (TCHAR), path2, NULL);
+ if (_tcslen (path2) < _tcslen (relpath))
return;
- if (memcmp (path2, relpath, strlen (relpath)))
+ if (_tcsncmp (path2, relpath, _tcslen (relpath)))
return;
- p = path2 + strlen (relpath);
+ p = path2 + _tcslen (relpath);
if (!cs->Directory)
- strcat (p, cs->Name);
- fwrite (p, strlen (p), 1, zcache);
- fwrite (&lf, 1, 1, zcache);
+ _tcscat (p, cs->Name);
+ fwrite (p, _tcslen (p), sizeof (TCHAR), zcache);
+ fwrite (&lf, 1, sizeof (TCHAR), zcache);
memcpy (&li, &cs->t, sizeof (ULARGE_INTEGER));
- sprintf (path2, "%I64u", li.QuadPart);
- fwrite (path2, strlen (path2), 1, zcache);
- fwrite (&lf, 1, 1, zcache);
+ _stprintf (path2, L"%I64u", li.QuadPart);
+ fwrite (path2, _tcslen (path2), sizeof (TCHAR), zcache);
+ fwrite (&lf, 1, sizeof (TCHAR), zcache);
- fwrite (cs->Name, strlen (cs->Name), 1, zcache);
- fwrite (&lf, 1, 1, zcache);
- fwrite (cs->Description, strlen (cs->Description), 1, zcache);
- fwrite (&lf, 1, 1, zcache);
+ fwrite (cs->Name, _tcslen (cs->Name), sizeof (TCHAR), zcache);
+ fwrite (&lf, 1, sizeof (TCHAR), zcache);
+ fwrite (cs->Description, _tcslen (cs->Description), sizeof (TCHAR), zcache);
+ fwrite (&lf, 1, sizeof (TCHAR), zcache);
if (!cs->Directory) {
- fwrite (cs->HardwareLink, strlen (cs->HardwareLink), 1, zcache);
- fwrite (&lf, 1, 1, zcache);
- fwrite (cs->HostLink, strlen (cs->HostLink), 1, zcache);
- fwrite (&lf, 1, 1, zcache);
- sprintf (path2, "%d", cs->Type);
- fwrite (path2, strlen (path2), 1, zcache);
- fwrite (&lf, 1, 1, zcache);
+ fwrite (cs->HardwareLink, _tcslen (cs->HardwareLink), sizeof (TCHAR), zcache);
+ fwrite (&lf, 1, sizeof (TCHAR), zcache);
+ fwrite (cs->HostLink, _tcslen (cs->HostLink), sizeof (TCHAR), zcache);
+ fwrite (&lf, 1, sizeof (TCHAR), zcache);
+ _stprintf (path2, L"%d", cs->Type);
+ fwrite (path2, _tcslen (path2), sizeof (TCHAR), zcache);
+ fwrite (&lf, 1, sizeof (TCHAR), zcache);
}
- fwrite (el, strlen (el), 1, zcache);
+ fwrite (el, _tcslen (el), sizeof (TCHAR), zcache);
}
-static void writeconfigcacherec (FILE *zcache, const char *relpath, struct ConfigStruct *cs)
+static void writeconfigcacherec (FILE *zcache, const TCHAR *relpath, struct ConfigStruct *cs)
{
int i;
}
}
-static void writeconfigcache (const char *path)
+static void writeconfigcache (const TCHAR *path)
{
int i;
- char lf = 10;
+ TCHAR lf = 10;
FILE *zcache;
- char cachepath[MAX_DPATH];
- char path2[MAX_DPATH];
+ TCHAR cachepath[MAX_DPATH];
+ TCHAR path2[MAX_DPATH];
FILETIME t;
SYSTEMTIME st;
if (!configurationcache)
return;
getconfigcache (cachepath, path);
- zcache = fopen (cachepath, "w");
+ zcache = _tfopen (cachepath, L"w, ccs=UTF-8");
if (!zcache)
return;
t.dwHighDateTime = t.dwLowDateTime = 0;
GetSystemTime (&st);
SystemTimeToFileTime (&st, &t);
- fwrite (configcachever, strlen (configcachever), 1, zcache);
- fwrite (&lf, 1, 1, zcache);
- sprintf (path2, "3\n4\n7\n%I64u\n;\n", t);
- fwrite (path2, strlen (path2), 1, zcache);
- GetFullPathName (path, sizeof path2, path2, NULL);
+ fwrite (configcachever, _tcslen (configcachever), sizeof (TCHAR), zcache);
+ fwrite (&lf, 1, sizeof (TCHAR), zcache);
+ _stprintf (path2, L"3\n4\n7\n%I64u\n;\n", t);
+ fwrite (path2, _tcslen (path2), sizeof (TCHAR), zcache);
+ GetFullPathName (path, sizeof path2 / sizeof (TCHAR), path2, NULL);
for (i = 0; i < configstoresize; i++) {
struct ConfigStruct *cs = configstore[i];
if (cs->Directory && cs->Parent == NULL)
writeconfigcacheentry (zcache, path2, cs);
}
fclose (zcache);
- write_log ("'%s' created\n", cachepath);
+ write_log (L"'%s' created\n", cachepath);
}
static struct ConfigStruct *GetConfigs (struct ConfigStruct *configparent, int usedirs, int *level, int flushcache)
{
DWORD num_bytes = 0;
- char path[MAX_DPATH];
- char path2[MAX_DPATH];
- char shortpath[MAX_DPATH];
+ TCHAR path[MAX_DPATH];
+ TCHAR path2[MAX_DPATH];
+ TCHAR shortpath[MAX_DPATH];
WIN32_FIND_DATA find_data;
struct ConfigStruct *config, *first;
HANDLE handle;
first = NULL;
GetConfigPath (path, configparent, FALSE);
GetConfigPath (shortpath, configparent, TRUE);
- strcpy (path2, path);
- strncat (path2, "*.*", MAX_DPATH);
+ _tcscpy (path2, path);
+ _tcsncat (path2, L"*.*", MAX_DPATH);
if (*level == 0) {
if (flushcache) {
- char cachepath[MAX_DPATH];
+ TCHAR cachepath[MAX_DPATH];
getconfigcache (cachepath, path);
flushconfigcache (cachepath);
}
}
for (;;) {
config = NULL;
- if (strcmp (find_data.cFileName, ".") && strcmp (find_data.cFileName, "..")) {
+ if (_tcscmp (find_data.cFileName, L".") && _tcscmp (find_data.cFileName, L"..")) {
int ok = 0;
config = AllocConfigStruct ();
- strcpy (config->Path, shortpath);
- strcpy (config->Fullpath, path);
+ _tcscpy (config->Path, shortpath);
+ _tcscpy (config->Fullpath, path);
memcpy (&config->t, &find_data.ftLastWriteTime, sizeof (FILETIME));
if ((find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && usedirs) {
if ((*level) < 2) {
struct ConfigStruct *child;
- strcpy (config->Name, find_data.cFileName);
- strcpy (config->Path, shortpath);
- strcat (config->Path, config->Name);
- strcat (config->Path, "\\");
- strcpy (config->Fullpath, path);
- strcat (config->Fullpath, config->Name);
- strcat (config->Fullpath, "\\");
+ _tcscpy (config->Name, find_data.cFileName);
+ _tcscpy (config->Path, shortpath);
+ _tcscat (config->Path, config->Name);
+ _tcscat (config->Path, L"\\");
+ _tcscpy (config->Fullpath, path);
+ _tcscat (config->Fullpath, config->Name);
+ _tcscat (config->Fullpath, L"\\");
config->Directory = 1;
(*level)++;
config->Parent = configparent;
ok = 1;
}
} else if (!(find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
- char path3[MAX_DPATH];
- if (strlen (find_data.cFileName) > 4 && !strcasecmp (find_data.cFileName + strlen (find_data.cFileName) - 4, ".uae")) {
- strcpy (path3, path);
- strncat (path3, find_data.cFileName, MAX_DPATH);
+ TCHAR path3[MAX_DPATH];
+ if (_tcslen (find_data.cFileName) > 4 && !strcasecmp (find_data.cFileName + _tcslen (find_data.cFileName) - 4, L".uae")) {
+ _tcscpy (path3, path);
+ _tcsncat (path3, find_data.cFileName, MAX_DPATH);
if (cfgfile_get_description (path3, config->Description, config->HostLink, config->HardwareLink, &config->Type)) {
- strcpy (config->Name, find_data.cFileName);
+ _tcscpy (config->Name, find_data.cFileName);
ok = 1;
}
}
static struct ConfigStruct *CreateConfigStore (struct ConfigStruct *oldconfig, int flushcache)
{
int level, i;
- char path[MAX_DPATH], name[MAX_DPATH];
+ TCHAR path[MAX_DPATH], name[MAX_DPATH];
struct ConfigStruct *cs;
if (oldconfig) {
- strcpy (path, oldconfig->Path);
- strcpy (name, oldconfig->Name);
+ _tcscpy (path, oldconfig->Path);
+ _tcscpy (name, oldconfig->Name);
}
level = 0;
GetConfigs (NULL, 1, &level, flushcache);
if (oldconfig) {
for (i = 0; i < configstoresize; i++) {
cs = configstore[i];
- if (!cs->Directory && !strcmp (path, cs->Path) && !strcmp (name, cs->Name))
+ if (!cs->Directory && !_tcscmp (path, cs->Path) && !_tcscmp (name, cs->Name))
return cs;
}
}
return 0;
}
-static char *HandleConfiguration (HWND hDlg, int flag, struct ConfigStruct *config, char *newpath)
+static TCHAR *HandleConfiguration (HWND hDlg, int flag, struct ConfigStruct *config, TCHAR *newpath)
{
- char name[MAX_DPATH], desc[MAX_DPATH];
- char path[MAX_DPATH];
- static char full_path[MAX_DPATH];
+ TCHAR name[MAX_DPATH], desc[MAX_DPATH];
+ TCHAR path[MAX_DPATH];
+ static TCHAR full_path[MAX_DPATH];
full_path[0] = 0;
name[0] = 0;
desc[0] = 0;
GetDlgItemText (hDlg, IDC_EDITNAME, name, MAX_DPATH);
- strcpy (config_filename, name);
+ _tcscpy (config_filename, name);
if (flag == CONFIG_SAVE_FULL || flag == CONFIG_SAVE) {
- if (strlen (name) < 4 || strcasecmp (name + strlen (name) - 4, ".uae")) {
- strcat (name, ".uae");
+ if (_tcslen (name) < 4 || strcasecmp (name + _tcslen (name) - 4, L".uae")) {
+ _tcscat (name, L".uae");
SetDlgItemText (hDlg, IDC_EDITNAME, name);
}
if (config)
- strcpy (config->Name, name);
+ _tcscpy (config->Name, name);
}
GetDlgItemText (hDlg, IDC_EDITDESCRIPTION, desc, MAX_DPATH);
if (config) {
- strcpy (path, config->Fullpath);
+ _tcscpy (path, config->Fullpath);
} else {
- fetch_configurationpath (path, sizeof (path));
+ fetch_configurationpath (path, sizeof (path) / sizeof (TCHAR));
}
- strncat (path, name, MAX_DPATH);
- strcpy (full_path, path);
+ _tcsncat (path, name, MAX_DPATH);
+ _tcscpy (full_path, path);
switch (flag)
{
case CONFIG_SAVE_FULL:
break;
case CONFIG_SAVE:
- if (strlen (name) == 0 || strcmp (name, ".uae") == 0) {
- char szMessage[MAX_DPATH];
+ if (_tcslen (name) == 0 || _tcscmp (name, L".uae") == 0) {
+ TCHAR szMessage[MAX_DPATH];
WIN32GUI_LoadUIString(IDS_MUSTENTERNAME, szMessage, MAX_DPATH);
pre_gui_message (szMessage);
} else {
- strcpy (workprefs.description, desc);
+ _tcscpy (workprefs.description, desc);
cfgfile_save (&workprefs, path, configtypepanel);
}
break;
case CONFIG_LOAD:
- if (strlen (name) == 0) {
- char szMessage[MAX_DPATH];
+ if (_tcslen (name) == 0) {
+ TCHAR szMessage[MAX_DPATH];
WIN32GUI_LoadUIString (IDS_MUSTSELECTCONFIG, szMessage, MAX_DPATH);
pre_gui_message (szMessage);
} else {
if (target_cfgfile_load (&workprefs, path, configtypepanel, 0) == 0) {
- char szMessage[MAX_DPATH];
+ TCHAR szMessage[MAX_DPATH];
WIN32GUI_LoadUIString (IDS_COULDNOTLOADCONFIG, szMessage, MAX_DPATH);
pre_gui_message (szMessage);
config_filename[0] = 0;
break;
case CONFIG_DELETE:
- if (strlen (name) == 0) {
- char szMessage[MAX_DPATH];
+ if (_tcslen (name) == 0) {
+ TCHAR szMessage[MAX_DPATH];
WIN32GUI_LoadUIString (IDS_MUSTSELECTCONFIGFORDELETE, szMessage, MAX_DPATH);
pre_gui_message (szMessage);
} else {
- char szMessage[MAX_DPATH];
- char szTitle[MAX_DPATH];
+ TCHAR szMessage[MAX_DPATH];
+ TCHAR szTitle[MAX_DPATH];
WIN32GUI_LoadUIString (IDS_DELETECONFIGCONFIRMATION, szMessage, MAX_DPATH);
WIN32GUI_LoadUIString (IDS_DELETECONFIGTITLE, szTitle, MAX_DPATH );
if (MessageBox (hDlg, szMessage, szTitle,
MB_YESNO | MB_ICONWARNING | MB_APPLMODAL | MB_SETFOREGROUND) == IDYES) {
cfgfile_backup (path);
DeleteFile (path);
- write_log ("deleted config '%s'\n", path);
+ write_log (L"deleted config '%s'\n", path);
config_filename[0] = 0;
}
}
{
int i;
for (i = 0; i < 4; i++) {
- if (strlen (workprefs.dfxlist[entry]) > 0 && !strcmp (workprefs.dfxlist[entry], workprefs.df[i]))
+ if (_tcslen (workprefs.dfxlist[entry]) > 0 && !_tcscmp (workprefs.dfxlist[entry], workprefs.df[i]))
return i;
}
return -1;
return 1;
}
- if (strcmp (workprefs.df[drv], currprefs.df[drv])) {
- strcpy (workprefs.df[drv], currprefs.df[drv]);
+ if (_tcscmp (workprefs.df[drv], currprefs.df[drv])) {
+ _tcscpy (workprefs.df[drv], currprefs.df[drv]);
disk_insert (drv, workprefs.df[drv]);
} else {
workprefs.df[drv][0] = 0;
while (drv < 4 && drvs[drv] >= 0)
drv++;
if (drv < 4 && workprefs.dfxtype[drv] >= 0) {
- strcpy (workprefs.df[drv], workprefs.dfxlist[entry]);
+ _tcscpy (workprefs.df[drv], workprefs.dfxlist[entry]);
disk_insert (drv, workprefs.df[drv]);
}
}
}
for (i = 0; i < 4; i++) {
if (drvs[i] < 0 && workprefs.dfxtype[i] >= 0) {
- strcpy (workprefs.df[i], workprefs.dfxlist[entry]);
+ _tcscpy (workprefs.df[i], workprefs.dfxlist[entry]);
disk_insert (i, workprefs.df[i]);
return 1;
}
}
- strcpy (workprefs.df[0], workprefs.dfxlist[entry]);
+ _tcscpy (workprefs.df[0], workprefs.dfxlist[entry]);
disk_insert (0, workprefs.df[0]);
return 1;
}
static void set_lventry_input (HWND list, int index)
{
int flags, i, sub;
- char name[256];
- char custom[MAX_DPATH];
- char af[10];
+ TCHAR name[256];
+ TCHAR custom[MAX_DPATH];
+ TCHAR af[10];
inputdevice_get_mapped_name (input_selected_device, index, &flags, name, custom, input_selected_sub_num);
if (flags & IDEV_MAPPED_AUTOFIRE_SET)
- WIN32GUI_LoadUIString (IDS_YES, af, sizeof (af));
+ WIN32GUI_LoadUIString (IDS_YES, af, sizeof (af) / sizeof (TCHAR));
else if (flags & IDEV_MAPPED_AUTOFIRE_POSSIBLE)
- WIN32GUI_LoadUIString (IDS_NO, af, sizeof (af));
+ WIN32GUI_LoadUIString (IDS_NO, af, sizeof (af) / sizeof (TCHAR));
else
- strcpy (af,"-");
+ _tcscpy (af, L"-");
ListView_SetItemText(list, index, 1, custom[0] ? custom : name);
ListView_SetItemText(list, index, 2, af);
sub = 0;
if (inputdevice_get_mapped_name (input_selected_device, index, &flags, name, custom, i) || custom[0])
sub++;
}
- sprintf (name, "%d", sub);
+ _stprintf (name, L"%d", sub);
ListView_SetItemText(list, index, 3, name);
}
LV_ITEM lvstruct;
LV_COLUMN lvcolumn;
RECT rect;
- char column_heading[HARDDISK_COLUMNS][MAX_COLUMN_HEADING_WIDTH];
- char blocksize_str[6] = "";
- char readwrite_str[10] = "";
- char size_str[32] = "";
- char volname_str[MAX_DPATH] = "";
- char devname_str[MAX_DPATH] = "";
- char bootpri_str[6] = "";
+ TCHAR column_heading[HARDDISK_COLUMNS][MAX_COLUMN_HEADING_WIDTH];
+ TCHAR blocksize_str[6] = L"";
+ TCHAR readwrite_str[10] = L"";
+ TCHAR size_str[32] = L"";
+ TCHAR volname_str[MAX_DPATH] = L"";
+ TCHAR devname_str[MAX_DPATH] = L"";
+ TCHAR bootpri_str[6] = L"";
int width = 0;
int items = 0, result = 0, i, j, entry = 0, temp = 0;
- char tmp[10], tmp2[MAX_DPATH];
+ TCHAR tmp[10], tmp2[MAX_DPATH];
int listview_column_width[HARDDISK_COLUMNS];
if (hDlg == pages[HARDDISK_ID]) {
listview_num_columns = HARDDISK_COLUMNS;
lv_type = LV_HARDDISK;
- strcpy (column_heading[0], "*");
+ _tcscpy (column_heading[0], L"*");
WIN32GUI_LoadUIString(IDS_DEVICE, column_heading[1], MAX_COLUMN_HEADING_WIDTH);
WIN32GUI_LoadUIString(IDS_VOLUME, column_heading[2], MAX_COLUMN_HEADING_WIDTH);
WIN32GUI_LoadUIString(IDS_PATH, column_heading[3], MAX_COLUMN_HEADING_WIDTH);
WIN32GUI_LoadUIString(IDS_INPUTHOSTWIDGET, column_heading[0], MAX_COLUMN_HEADING_WIDTH);
WIN32GUI_LoadUIString(IDS_INPUTAMIGAEVENT, column_heading[1], MAX_COLUMN_HEADING_WIDTH);
WIN32GUI_LoadUIString(IDS_INPUTAUTOFIRE, column_heading[2], MAX_COLUMN_HEADING_WIDTH);
- strcpy (column_heading[3], "#");
+ _tcscpy (column_heading[3], L"#");
list = GetDlgItem(hDlg, IDC_INPUTLIST);
} else if (hDlg == pages[MISC2_ID]) {
listview_num_columns = MISC2_COLUMNS;
lv_type = LV_MISC2;
- strcpy (column_heading[0], "Extension");
- strcpy (column_heading[1], "");
+ _tcscpy (column_heading[0], L"Extension");
+ _tcscpy (column_heading[1], L"");
list = GetDlgItem (hDlg, IDC_ASSOCIATELIST);
} else {
listview_num_columns = DISK_COLUMNS;
lv_type = LV_DISK;
- strcpy (column_heading[0], "#");
+ _tcscpy (column_heading[0], L"#");
WIN32GUI_LoadUIString(IDS_DISK_IMAGENAME, column_heading[1], MAX_COLUMN_HEADING_WIDTH);
WIN32GUI_LoadUIString(IDS_DISK_DRIVENAME, column_heading[2], MAX_COLUMN_HEADING_WIDTH);
list = GetDlgItem (hDlg, IDC_DISK);
lvstruct.iItem = i;
lvstruct.iSubItem = 0;
result = ListView_InsertItem (list, &lvstruct);
- ListView_SetItemText (list, result, 1, exts[i].enabled ? "*" : "");
+ ListView_SetItemText (list, result, 1, exts[i].enabled ? L"*" : L"");
}
} else if (lv_type == LV_INPUT) {
for (i = 0; input_total_devices && i < inputdevice_get_widget_num (input_selected_device); i++) {
- char name[100];
+ TCHAR name[100];
inputdevice_get_widget_type (input_selected_device, i, name);
lvstruct.mask = LVIF_TEXT | LVIF_PARAM;
lvstruct.pszText = name;
} else if (lv_type == LV_DISK) {
for (i = 0; i < MAX_SPARE_DRIVES; i++) {
int drv;
- sprintf (tmp, "%d", i + 1);
+ _stprintf (tmp, L"%d", i + 1);
lvstruct.mask = LVIF_TEXT | LVIF_PARAM;
lvstruct.pszText = tmp;
lvstruct.lParam = 0;
lvstruct.iItem = i;
lvstruct.iSubItem = 0;
result = ListView_InsertItem (list, &lvstruct);
- strcpy (tmp2, workprefs.dfxlist[i]);
- j = strlen (tmp2) - 1;
+ _tcscpy (tmp2, workprefs.dfxlist[i]);
+ j = _tcslen (tmp2) - 1;
if (j < 0)
j = 0;
while (j > 0) {
drv = disk_in_drive (i);
tmp[0] = 0;
if (drv >= 0)
- sprintf (tmp, "DF%d:", drv);
+ _stprintf (tmp, L"DF%d:", drv);
ListView_SetItemText (list, result, 2, tmp);
width = ListView_GetStringWidth (list, lvstruct.pszText) + 15;
if (width > listview_column_width[0])
struct uaedev_config_info *uci = &workprefs.mountconfig[i];
int nosize = 0, type;
struct mountedinfo mi;
- char *rootdir = uci->rootdir;
+ TCHAR *rootdir = uci->rootdir;
type = get_filesys_unitconfig (&workprefs, i, &mi);
if (type < 0) {
}
if (nosize)
- strcpy (size_str, "n/a");
+ _tcscpy (size_str, L"n/a");
else if (mi.size >= 1024 * 1024 * 1024)
- sprintf (size_str, "%.1fG", ((double)(uae_u32)(mi.size / (1024 * 1024))) / 1024.0);
+ _stprintf (size_str, L"%.1fG", ((double)(uae_u32)(mi.size / (1024 * 1024))) / 1024.0);
else if (mi.size < 10 * 1024 * 1024)
- sprintf (size_str, "%dK", mi.size / 1024);
+ _stprintf (size_str, L"%dK", mi.size / 1024);
else
- sprintf (size_str, "%.1fM", ((double)(uae_u32)(mi.size / (1024))) / 1024.0);
+ _stprintf (size_str, L"%.1fM", ((double)(uae_u32)(mi.size / (1024))) / 1024.0);
if (uci->controller >= HD_CONTROLLER_IDE0 && uci->controller <= HD_CONTROLLER_IDE3) {
- sprintf (blocksize_str, "%d", uci->blocksize);
- sprintf (devname_str, "*IDE%d*", uci->controller - HD_CONTROLLER_IDE0);
- strcpy (volname_str, "n/a");
- strcpy (bootpri_str, "n/a");
+ _stprintf (blocksize_str, L"%d", uci->blocksize);
+ _stprintf (devname_str, L"*IDE%d*", uci->controller - HD_CONTROLLER_IDE0);
+ _tcscpy (volname_str, L"n/a");
+ _tcscpy (bootpri_str, L"n/a");
} else if (uci->controller >= HD_CONTROLLER_SCSI0 && uci->controller <= HD_CONTROLLER_SCSI6) {
- sprintf (blocksize_str, "%d", uci->blocksize);
- sprintf (devname_str, "*SCSI%d*", uci->controller - HD_CONTROLLER_SCSI0);
- strcpy (volname_str, "n/a");
- strcpy (bootpri_str, "n/a");
+ _stprintf (blocksize_str, L"%d", uci->blocksize);
+ _stprintf (devname_str, L"*SCSI%d*", uci->controller - HD_CONTROLLER_SCSI0);
+ _tcscpy (volname_str, L"n/a");
+ _tcscpy (bootpri_str, L"n/a");
} else if (uci->controller == HD_CONTROLLER_PCMCIA_SRAM) {
- strcpy (blocksize_str, "n/a");
- strcpy(devname_str, "*SCSRAM*");
- strcpy (volname_str, "n/a");
- strcpy (bootpri_str, "n/a");
+ _tcscpy (blocksize_str, L"n/a");
+ _tcscpy(devname_str, L"*SCSRAM*");
+ _tcscpy (volname_str, L"n/a");
+ _tcscpy (bootpri_str, L"n/a");
} else if (type == FILESYS_HARDFILE) {
- sprintf (blocksize_str, "%d", uci->blocksize);
- strcpy (devname_str, uci->devname);
- strcpy (volname_str, "n/a");
- sprintf (bootpri_str, "%d", uci->bootpri);
+ _stprintf (blocksize_str, L"%d", uci->blocksize);
+ _tcscpy (devname_str, uci->devname);
+ _tcscpy (volname_str, L"n/a");
+ _stprintf (bootpri_str, L"%d", uci->bootpri);
} else if (type == FILESYS_HARDFILE_RDB || type == FILESYS_HARDDRIVE || uci->controller) {
- sprintf (blocksize_str, "%d", uci->blocksize);
- strcpy (devname_str, "n/a");
- strcpy (volname_str, "n/a");
- strcpy (bootpri_str, "n/a");
- if (!memcmp (rootdir, "HD_", 3))
+ _stprintf (blocksize_str, L"%d", uci->blocksize);
+ _tcscpy (devname_str, L"n/a");
+ _tcscpy (volname_str, L"n/a");
+ _tcscpy (bootpri_str, L"n/a");
+ if (!memcmp (rootdir, L"HD_", 3))
rootdir += 3;
} else {
- strcpy (blocksize_str, "n/a");
- strcpy (devname_str, uci->devname);
- strcpy (volname_str, uci->volname);
- strcpy (size_str, "n/a");
- sprintf (bootpri_str, "%d", uci->bootpri);
+ _tcscpy (blocksize_str, L"n/a");
+ _tcscpy (devname_str, uci->devname);
+ _tcscpy (volname_str, uci->volname);
+ _tcscpy (size_str, L"n/a");
+ _stprintf (bootpri_str, L"%d", uci->bootpri);
}
if (!mi.ismedia) {
- strcpy (blocksize_str, "n/a");
- strcpy (size_str, "n/a");
+ _tcscpy (blocksize_str, L"n/a");
+ _tcscpy (size_str, L"n/a");
}
- WIN32GUI_LoadUIString (uci->readonly ? IDS_NO : IDS_YES, readwrite_str, sizeof (readwrite_str));
+ WIN32GUI_LoadUIString (uci->readonly ? IDS_NO : IDS_YES, readwrite_str, sizeof (readwrite_str) / sizeof (TCHAR));
lvstruct.mask = LVIF_TEXT | LVIF_PARAM;
- lvstruct.pszText = mi.ismedia == 0 ? "E" : (nosize ? "X" : (mi.ismounted ? "*" : " "));
+ lvstruct.pszText = mi.ismedia == 0 ? L"E" : (nosize ? L"X" : (mi.ismounted ? L"*" : L" "));
if (uci->controller)
- lvstruct.pszText = " ";
+ lvstruct.pszText = L" ";
lvstruct.lParam = 0;
lvstruct.iItem = i;
lvstruct.iSubItem = 0;
return FALSE;
}
-static HTREEITEM AddConfigNode (HWND hDlg, struct ConfigStruct *config, char *name, char *desc, char *path, int isdir, int expand, HTREEITEM parent)
+static HTREEITEM AddConfigNode (HWND hDlg, struct ConfigStruct *config, TCHAR *name, TCHAR *desc, TCHAR *path, int isdir, int expand, HTREEITEM parent)
{
TVINSERTSTRUCT is;
HWND TVhDlg;
- char s[MAX_DPATH] = "";
- char file_name[MAX_DPATH], file_path[MAX_DPATH];
+ TCHAR s[MAX_DPATH] = L"";
+ TCHAR file_name[MAX_DPATH], file_path[MAX_DPATH];
GetDlgItemText (hDlg, IDC_EDITNAME, file_name, MAX_DPATH);
GetDlgItemText (hDlg, IDC_EDITPATH, file_path, MAX_DPATH);
is.hInsertAfter = isdir < 0 ? TVI_ROOT : TVI_SORT;
is.hParent = parent;
is.itemex.mask = TVIF_TEXT | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
- if (!strcmp (file_name, name) && !strcmp (file_path, path)) {
+ if (!_tcscmp (file_name, name) && !_tcscmp (file_path, path)) {
is.itemex.state |= TVIS_SELECTED;
is.itemex.stateMask |= TVIS_SELECTED;
}
if (isdir) {
- strcat (s, " ");
+ _tcscat (s, L" ");
is.itemex.state |= TVIS_BOLD;
is.itemex.stateMask |= TVIS_BOLD;
}
is.itemex.state |= TVIS_EXPANDED;
is.itemex.stateMask |= TVIS_EXPANDED;
}
- strcat (s, name);
- if (strlen (s) > 4 && !stricmp (s + strlen (s) - 4, ".uae"))
- s[strlen(s) - 4] = 0;
- if (desc && strlen(desc) > 0) {
- strcat (s, " (");
- strcat (s, desc);
- strcat (s, ")");
+ _tcscat (s, name);
+ if (_tcslen (s) > 4 && !_tcsicmp (s + _tcslen (s) - 4, L".uae"))
+ s[_tcslen (s) - 4] = 0;
+ if (desc && _tcslen (desc) > 0) {
+ _tcscat (s, L" (");
+ _tcscat (s, desc);
+ _tcscat (s, L")");
}
is.itemex.pszText = s;
is.itemex.iImage = is.itemex.iSelectedImage = isdir > 0 ? 0 : (isdir < 0) ? 2 : 1;
int i, j, idx1, idx2;
if (config == NULL) {
- SetDlgItemText (hDlg, IDC_EDITNAME, "");
- SetDlgItemText (hDlg, IDC_EDITDESCRIPTION, "");
+ SetDlgItemText (hDlg, IDC_EDITNAME, L"");
+ SetDlgItemText (hDlg, IDC_EDITDESCRIPTION, L"");
} else {
SetDlgItemText (hDlg, IDC_EDITNAME, config->Name);
SetDlgItemText (hDlg, IDC_EDITDESCRIPTION, config->Description);
}
SendDlgItemMessage (hDlg, IDC_CONFIGLINK, CB_RESETCONTENT, 0, 0L);
- SendDlgItemMessage (hDlg, IDC_CONFIGLINK, CB_ADDSTRING, 0, (LPARAM)"");
+ SendDlgItemMessage (hDlg, IDC_CONFIGLINK, CB_ADDSTRING, 0, (LPARAM)L"");
idx1 = 1;
idx2 = 0;
for (j = 0; j < 2; j++) {
for (i = 0; i < configstoresize; i++) {
struct ConfigStruct *cs = configstore[i];
if ((j == 0 && cs->Type == CONFIG_TYPE_HOST) || (j == 1 && cs->Type == CONFIG_TYPE_HARDWARE)) {
- char tmp2[MAX_DPATH];
- strcpy (tmp2, configstore[i]->Path);
- strncat (tmp2, configstore[i]->Name, MAX_DPATH);
+ TCHAR tmp2[MAX_DPATH];
+ _tcscpy (tmp2, configstore[i]->Path);
+ _tcsncat (tmp2, configstore[i]->Name, MAX_DPATH);
SendDlgItemMessage (hDlg, IDC_CONFIGLINK, CB_ADDSTRING, 0, (LPARAM)tmp2);
- if (config && (!strcmpi (tmp2, config->HardwareLink) || !strcmpi (tmp2, config->HostLink)))
+ if (config && (!_tcsicmp (tmp2, config->HardwareLink) || !_tcsicmp (tmp2, config->HostLink)))
idx2 = idx1;
idx1++;
}
HIMAGELIST himl = ImageList_Create (16, 16, ILC_COLOR8 | ILC_MASK, 3, 0);
HWND TVhDlg = GetDlgItem(hDlg, IDC_CONFIGTREE);
HTREEITEM parent;
- char path[MAX_DPATH];
+ TCHAR path[MAX_DPATH];
if (himl) {
HICON icon;
- icon = LoadIcon (hInst, (LPCSTR)MAKEINTRESOURCE(IDI_FOLDER));
+ icon = LoadIcon (hInst, (LPCWSTR)MAKEINTRESOURCE(IDI_FOLDER));
ImageList_AddIcon (himl, icon);
- icon = LoadIcon (hInst, (LPCSTR)MAKEINTRESOURCE(IDI_CONFIGFILE));
+ icon = LoadIcon (hInst, (LPCWSTR)MAKEINTRESOURCE(IDI_CONFIGFILE));
ImageList_AddIcon (himl, icon);
- icon = LoadIcon (hInst, (LPCSTR)MAKEINTRESOURCE(IDI_ROOT));
+ icon = LoadIcon (hInst, (LPCWSTR)MAKEINTRESOURCE(IDI_ROOT));
ImageList_AddIcon (himl, icon);
TreeView_SetImageList (TVhDlg, himl, TVSIL_NORMAL);
}
static void ConfigToRegistry (struct ConfigStruct *config, int type)
{
if (config) {
- char path[MAX_DPATH];
- strcpy (path, config->Path);
- strncat (path, config->Name, MAX_DPATH);
+ TCHAR path[MAX_DPATH];
+ _tcscpy (path, config->Path);
+ _tcsncat (path, config->Name, MAX_DPATH);
regsetstr (NULL, configreg[type], path);
}
}
if (type > 0)
regsetint (NULL, configreg2[type], ct);
if (noauto == 0 || noauto == 1)
- regsetint (NULL, "ConfigFile_NoAuto", noauto);
+ regsetint (NULL, L"ConfigFile_NoAuto", noauto);
}
static void checkautoload (HWND hDlg, struct ConfigStruct *config)
}
CheckDlgButton(hDlg, IDC_CONFIGAUTO, ct ? BST_CHECKED : BST_UNCHECKED);
ew (hDlg, IDC_CONFIGAUTO, configtypepanel > 0 && config && !config->Directory ? TRUE : FALSE);
- regqueryint (NULL, "ConfigFile_NoAuto", &ct);
+ regqueryint (NULL, L"ConfigFile_NoAuto", &ct);
CheckDlgButton(hDlg, IDC_CONFIGNOLINK, ct ? BST_CHECKED : BST_UNCHECKED);
}
static struct ConfigStruct *initloadsave (HWND hDlg, struct ConfigStruct *config)
{
HTREEITEM root;
- char name_buf[MAX_DPATH];
- DWORD dwRFPsize = sizeof (name_buf);
- char path[MAX_DPATH];
+ TCHAR name_buf[MAX_DPATH];
+ DWORD dwRFPsize = sizeof (name_buf) / sizeof (TCHAR);
+ TCHAR path[MAX_DPATH];
EnableWindow (GetDlgItem (hDlg, IDC_VIEWINFO), workprefs.info[0]);
- SetDlgItemText (hDlg, IDC_EDITPATH, "");
+ SetDlgItemText (hDlg, IDC_EDITPATH, L"");
SetDlgItemText (hDlg, IDC_EDITDESCRIPTION, workprefs.description);
root = InitializeConfigTreeView (hDlg);
if (regquerystr (NULL, configreg[configtypepanel], name_buf, &dwRFPsize)) {
return config;
}
-static void loadsavecommands (HWND hDlg, WPARAM wParam, struct ConfigStruct **configp, char **pcfgfile, char *newpath)
+static void loadsavecommands (HWND hDlg, WPARAM wParam, struct ConfigStruct **configp, TCHAR **pcfgfile, TCHAR *newpath)
{
struct ConfigStruct *config = *configp;
switch (LOWORD (wParam))
break;
case IDC_VIEWINFO:
if (workprefs.info[0]) {
- char name_buf[MAX_DPATH];
- if (strstr (workprefs.info, "Configurations\\"))
- sprintf (name_buf, "%s\\%s", start_path_data, workprefs.info);
+ TCHAR name_buf[MAX_DPATH];
+ if (_tcsstr (workprefs.info, L"Configurations\\"))
+ _stprintf (name_buf, L"%s\\%s", start_path_data, workprefs.info);
else
- strcpy (name_buf, workprefs.info);
+ _tcscpy (name_buf, workprefs.info);
ShellExecute (NULL, NULL, name_buf, NULL, NULL, SW_SHOWNORMAL);
}
break;
case IDC_CONFIGLINK:
if (HIWORD (wParam) == CBN_SELCHANGE || HIWORD (wParam) == CBN_KILLFOCUS) {
LRESULT val;
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
tmp[0] = 0;
val = SendDlgItemMessage (hDlg, IDC_CONFIGLINK, CB_GETCURSEL, 0, 0L);
if (val == CB_ERR)
- SendDlgItemMessage (hDlg, IDC_CONFIGLINK, WM_GETTEXT, (WPARAM)sizeof(tmp), (LPARAM)tmp);
+ SendDlgItemMessage (hDlg, IDC_CONFIGLINK, WM_GETTEXT, (WPARAM)sizeof(tmp) / sizeof (TCHAR), (LPARAM)tmp);
else
SendDlgItemMessage (hDlg, IDC_CONFIGLINK, CB_GETLBTEXT, (WPARAM)val, (LPARAM)tmp);
- strcpy (workprefs.config_host_path, tmp);
+ _tcscpy (workprefs.config_host_path, tmp);
}
break;
}
static INT_PTR CALLBACK LoadSaveDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- char *cfgfile = NULL;
+ TCHAR *cfgfile = NULL;
static int recursive;
static struct ConfigStruct *config;
{
int id = GetDlgCtrlID((HWND)wParam);
if (id == IDC_SAVE || id == IDC_LOAD) {
- char *s = favoritepopup (hDlg);
+ TCHAR *s = favoritepopup (hDlg);
if (s) {
loadsavecommands (hDlg, id, &config, &cfgfile, s);
xfree (s);
static INT_PTR CALLBACK ContributorsProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
CHARFORMAT CharFormat;
- char szContributors1[MAX_CONTRIBUTORS_LENGTH];
- char szContributors2[MAX_CONTRIBUTORS_LENGTH];
- char szContributors[MAX_CONTRIBUTORS_LENGTH * 2];
+ TCHAR szContributors1[MAX_CONTRIBUTORS_LENGTH];
+ TCHAR szContributors2[MAX_CONTRIBUTORS_LENGTH];
+ TCHAR szContributors[MAX_CONTRIBUTORS_LENGTH * 2];
switch (msg) {
case WM_COMMAND:
WIN32GUI_LoadUIString(IDS_CONTRIBUTORS1, szContributors1, MAX_CONTRIBUTORS_LENGTH);
WIN32GUI_LoadUIString(IDS_CONTRIBUTORS2, szContributors2, MAX_CONTRIBUTORS_LENGTH);
- sprintf(szContributors, "%s%s", szContributors1, szContributors2);
+ _stprintf (szContributors, L"%s%s", szContributors1, szContributors2);
SetDlgItemText (hDlg, IDC_CONTRIBUTORS, szContributors );
SendDlgItemMessage (hDlg, IDC_CONTRIBUTORS, EM_GETCHARFORMAT, 0, (LPARAM) & CharFormat);
CharFormat.dwMask |= CFM_SIZE | CFM_FACE;
CharFormat.yHeight = 8 * 20; /* height in twips, where a twip is 1/20th of a point - for a pt.size of 18 */
- strcpy (CharFormat.szFaceName, os_vista ? "Segoe UI" : "Tahoma");
+ _tcscpy (CharFormat.szFaceName, os_vista ? L"Segoe UI" : L"Tahoma");
SendDlgItemMessage (hDlg, IDC_CONTRIBUTORS, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) & CharFormat);
return TRUE;
}
{
int id;
BOOL state;
- char *display;
- char *url;
+ TCHAR *display;
+ TCHAR *url;
} urlinfo;
static urlinfo urls[] =
{
- {IDC_CLOANTOHOME, FALSE, "Cloanto's Amiga Forever", "http://www.amigaforever.com/"},
- {IDC_AMIGAHOME, FALSE, "Amiga Inc.", "http://www.amiga.com"},
- {IDC_PICASSOHOME, FALSE, "Picasso96 Home Page", "http://www.picasso96.cogito.de/"},
- {IDC_UAEHOME, FALSE, "UAE Home Page", "http://uae.coresystems.de/"},
- {IDC_WINUAEHOME, FALSE, "WinUAE Home Page", "http://www.winuae.net/"},
- {IDC_AIABHOME, FALSE, "AIAB", "http://www.amigainabox.co.uk/"},
- {IDC_THEROOTS, FALSE, "Back To The Roots", "http://www.back2roots.org/"},
- {IDC_ABIME, FALSE, "abime.net", "http://www.abime.net/"},
- {IDC_CAPS, FALSE, "SPS", "http://www.softpres.org/"},
- {IDC_AMIGASYS, FALSE, "AmigaSYS", "http://amigasys.extra.hu/"},
- {IDC_AMIKIT, FALSE, "AmiKit", "http://amikit.amiga.sk/"},
+ {IDC_CLOANTOHOME, FALSE, L"Cloanto's Amiga Forever", L"http://www.amigaforever.com/"},
+ {IDC_AMIGAHOME, FALSE, L"Amiga Inc.", L"http://www.amiga.com"},
+ {IDC_PICASSOHOME, FALSE, L"Picasso96 Home Page", L"http://www.picasso96.cogito.de/"},
+ {IDC_UAEHOME, FALSE, L"UAE Home Page", L"http://uae.coresystems.de/"},
+ {IDC_WINUAEHOME, FALSE, L"WinUAE Home Page", L"http://www.winuae.net/"},
+ {IDC_AIABHOME, FALSE, L"AIAB", L"http://www.amigainabox.co.uk/"},
+ {IDC_THEROOTS, FALSE, L"Back To The Roots", L"http://www.back2roots.org/"},
+ {IDC_ABIME, FALSE, L"abime.net", L"http://www.abime.net/"},
+ {IDC_CAPS, FALSE, L"SPS", L"http://www.softpres.org/"},
+ {IDC_AMIGASYS, FALSE, L"AmigaSYS", L"http://amigasys.extra.hu/"},
+ {IDC_AMIKIT, FALSE, L"AmiKit", L"http://amikit.amiga.sk/"},
{ -1, FALSE, NULL, NULL }
};
CharFormat.yHeight = 10 * 20; /* height in twips, where a twip is 1/20th of a point - for a pt.size of 18 */
CharFormat.crTextColor = GetSysColor(COLOR_ACTIVECAPTION);
- strcpy (CharFormat.szFaceName, os_vista ? "Segoe UI" : "Tahoma");
+ _tcscpy (CharFormat.szFaceName, os_vista ? L"Segoe UI" : L"Tahoma");
SendDlgItemMessage(hDlg, url->id, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&CharFormat);
SendDlgItemMessage(hDlg, url->id, EM_SETBKGNDCOLOR, 0, GetSysColor(COLOR_3DFACE));
}
}
static void setautocomplete (HWND hDlg, int id)
{
- HWND item = FindWindowEx (GetDlgItem (hDlg, id), NULL, "Edit", NULL);
+ HWND item = FindWindowEx (GetDlgItem (hDlg, id), NULL, L"Edit", NULL);
if (item)
SHAutoComplete (item, SHACF_FILESYSTEM | SHACF_AUTOAPPEND_FORCE_ON | SHACF_AUTOSUGGEST_FORCE_ON | SHACF_USETAB);
}
setautocomplete (hDlg, ids[i]);
}
-static void setpath (HWND hDlg, char *name, DWORD d, char *def)
+static void setpath (HWND hDlg, TCHAR *name, DWORD d, TCHAR *def)
{
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
- strcpy (tmp, def);
- fetch_path (name, tmp, sizeof (tmp));
+ _tcscpy (tmp, def);
+ fetch_path (name, tmp, sizeof (tmp) / sizeof (TCHAR));
SetDlgItemText (hDlg, d, tmp);
}
static void values_to_pathsdialog (HWND hDlg)
{
- setpath (hDlg, "KickstartPath", IDC_PATHS_ROM, "Roms");
- setpath (hDlg, "ConfigurationPath", IDC_PATHS_CONFIG, "Configurations");
- setpath (hDlg, "ScreenshotPath", IDC_PATHS_SCREENSHOT, "ScreenShots");
- setpath (hDlg, "StatefilePath", IDC_PATHS_SAVESTATE, "Savestates");
- setpath (hDlg, "SaveimagePath", IDC_PATHS_SAVEIMAGE, "SaveImages");
- setpath (hDlg, "VideoPath", IDC_PATHS_AVIOUTPUT, "Videos");
- setpath (hDlg, "RipperPath", IDC_PATHS_RIP, ".\\");
+ setpath (hDlg, L"KickstartPath", IDC_PATHS_ROM, L"Roms");
+ setpath (hDlg, L"ConfigurationPath", IDC_PATHS_CONFIG, L"Configurations");
+ setpath (hDlg, L"ScreenshotPath", IDC_PATHS_SCREENSHOT, L"ScreenShots");
+ setpath (hDlg, L"StatefilePath", IDC_PATHS_SAVESTATE, L"Savestates");
+ setpath (hDlg, L"SaveimagePath", IDC_PATHS_SAVEIMAGE, L"SaveImages");
+ setpath (hDlg, L"VideoPath", IDC_PATHS_AVIOUTPUT, L"Videos");
+ setpath (hDlg, L"RipperPath", IDC_PATHS_RIP, L".\\");
}
static void resetregistry (void)
{
- regdeletetree (NULL, "DetectedROMs");
- regdelete (NULL, "QuickStartMode");
- regdelete (NULL, "ConfigFile");
- regdelete (NULL, "ConfigFileHardware");
- regdelete (NULL, "ConfigFileHost");
- regdelete (NULL, "ConfigFileHardware_Auto");
- regdelete (NULL, "ConfigFileHost_Auto");
- regdelete (NULL, "ConfigurationPath");
- regdelete (NULL, "SaveimagePath");
- regdelete (NULL, "ScreenshotPath");
- regdelete (NULL, "StatefilePath");
- regdelete (NULL, "VideoPath");
- regdelete (NULL, "RipperPath");
- regdelete (NULL, "QuickStartModel");
- regdelete (NULL, "QuickStartConfiguration");
- regdelete (NULL, "QuickStartCompatibility");
- regdelete (NULL, "QuickStartHostConfig");
- regdelete (NULL, "ConfigurationCache");
- regdelete (NULL, "DirectDraw_Secondary");
+ regdeletetree (NULL, L"DetectedROMs");
+ regdelete (NULL, L"QuickStartMode");
+ regdelete (NULL, L"ConfigFile");
+ regdelete (NULL, L"ConfigFileHardware");
+ regdelete (NULL, L"ConfigFileHost");
+ regdelete (NULL, L"ConfigFileHardware_Auto");
+ regdelete (NULL, L"ConfigFileHost_Auto");
+ regdelete (NULL, L"ConfigurationPath");
+ regdelete (NULL, L"SaveimagePath");
+ regdelete (NULL, L"ScreenshotPath");
+ regdelete (NULL, L"StatefilePath");
+ regdelete (NULL, L"VideoPath");
+ regdelete (NULL, L"RipperPath");
+ regdelete (NULL, L"QuickStartModel");
+ regdelete (NULL, L"QuickStartConfiguration");
+ regdelete (NULL, L"QuickStartCompatibility");
+ regdelete (NULL, L"QuickStartHostConfig");
+ regdelete (NULL, L"ConfigurationCache");
+ regdelete (NULL, L"DirectDraw_Secondary");
}
int path_type;
static int recursive;
static int ptypes[3], numtypes;
int val, selpath = 0;
- char tmp[MAX_DPATH], pathmode[32];
+ TCHAR tmp[MAX_DPATH], pathmode[32];
switch (msg)
{
numtypes = 0;
SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_RESETCONTENT, 0, 0L);
if (af_path_2005 & 1) {
- WIN32GUI_LoadUIString (IDS_DEFAULT_AF2005, tmp, sizeof tmp);
+ WIN32GUI_LoadUIString (IDS_DEFAULT_AF2005, tmp, sizeof tmp / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_ADDSTRING, 0, (LPARAM)tmp);
if (path_type == PATH_TYPE_NEWAF)
selpath = numtypes;
ptypes[numtypes++] = PATH_TYPE_NEWAF;
}
if (start_path_new1[0]) {
- WIN32GUI_LoadUIString (IDS_DEFAULT_NEWWINUAE, tmp, sizeof tmp);
+ WIN32GUI_LoadUIString (IDS_DEFAULT_NEWWINUAE, tmp, sizeof tmp / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_ADDSTRING, 0, (LPARAM)tmp);
if (path_type == PATH_TYPE_NEWWINUAE)
selpath = numtypes;
ptypes[numtypes++] = PATH_TYPE_NEWWINUAE;
}
if (af_path_2005 & 2) {
- SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_ADDSTRING, 0, (LPARAM)"AmigaForeverData");
+ SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_ADDSTRING, 0, (LPARAM)L"AmigaForeverData");
if (path_type == PATH_TYPE_AMIGAFOREVERDATA)
selpath = numtypes;
ptypes[numtypes++] = PATH_TYPE_AMIGAFOREVERDATA;
}
if (af_path_old) {
- WIN32GUI_LoadUIString (IDS_DEFAULT_AF, tmp, sizeof tmp);
+ WIN32GUI_LoadUIString (IDS_DEFAULT_AF, tmp, sizeof tmp / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_ADDSTRING, 0, (LPARAM)tmp);
if (path_type == PATH_TYPE_OLDAF)
selpath = numtypes;
ptypes[numtypes++] = PATH_TYPE_OLDAF;
}
- WIN32GUI_LoadUIString (IDS_DEFAULT_WINUAE, tmp, sizeof tmp);
+ WIN32GUI_LoadUIString (IDS_DEFAULT_WINUAE, tmp, sizeof tmp / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_ADDSTRING, 0, (LPARAM)tmp);
if (path_type == 0)
selpath = numtypes;
switch (LOWORD (wParam))
{
case IDC_PATHS_ROMS:
- fetch_path ("KickstartPath", tmp, sizeof (tmp));
+ fetch_path (L"KickstartPath", tmp, sizeof (tmp) / sizeof (TCHAR));
if (DirectorySelection (hDlg, &pathsguid, tmp)) {
load_keyring (&workprefs, NULL);
- set_path ("KickstartPath", tmp);
+ set_path (L"KickstartPath", tmp);
if (!scan_roms (1))
gui_message_id (IDS_ROMSCANNOROMS);
values_to_pathsdialog (hDlg);
}
break;
case IDC_PATHS_ROM:
- GetWindowText (GetDlgItem (hDlg, IDC_PATHS_ROM), tmp, sizeof (tmp));
- set_path ("KickstartPath", tmp);
+ GetWindowText (GetDlgItem (hDlg, IDC_PATHS_ROM), tmp, sizeof (tmp) / sizeof (TCHAR));
+ set_path (L"KickstartPath", tmp);
break;
case IDC_PATHS_CONFIGS:
- fetch_path ("ConfigurationPath", tmp, sizeof (tmp));
+ fetch_path (L"ConfigurationPath", tmp, sizeof (tmp) / sizeof (TCHAR));
if (DirectorySelection (hDlg, &pathsguid, tmp)) {
- set_path ("ConfigurationPath", tmp);
+ set_path (L"ConfigurationPath", tmp);
values_to_pathsdialog (hDlg);
FreeConfigStore ();
}
break;
case IDC_PATHS_CONFIG:
- GetWindowText (GetDlgItem (hDlg, IDC_PATHS_CONFIG), tmp, sizeof (tmp));
- set_path ("ConfigurationPath", tmp);
+ GetWindowText (GetDlgItem (hDlg, IDC_PATHS_CONFIG), tmp, sizeof (tmp) / sizeof (TCHAR));
+ set_path (L"ConfigurationPath", tmp);
FreeConfigStore ();
break;
case IDC_PATHS_SCREENSHOTS:
- fetch_path ("ScreenshotPath", tmp, sizeof (tmp));
+ fetch_path (L"ScreenshotPath", tmp, sizeof (tmp) / sizeof (TCHAR));
if (DirectorySelection (hDlg, &pathsguid, tmp)) {
- set_path ("ScreenshotPath", tmp);
+ set_path (L"ScreenshotPath", tmp);
values_to_pathsdialog (hDlg);
}
break;
case IDC_PATHS_SCREENSHOT:
- GetWindowText (GetDlgItem (hDlg, IDC_PATHS_SCREENSHOT), tmp, sizeof (tmp));
- set_path ("ScreenshotPath", tmp);
+ GetWindowText (GetDlgItem (hDlg, IDC_PATHS_SCREENSHOT), tmp, sizeof (tmp) / sizeof (TCHAR));
+ set_path (L"ScreenshotPath", tmp);
break;
case IDC_PATHS_SAVESTATES:
- fetch_path ("StatefilePath", tmp, sizeof (tmp));
+ fetch_path (L"StatefilePath", tmp, sizeof (tmp) / sizeof (TCHAR));
if (DirectorySelection (hDlg, &pathsguid, tmp)) {
- set_path ("StatefilePath", tmp);
+ set_path (L"StatefilePath", tmp);
values_to_pathsdialog (hDlg);
}
break;
case IDC_PATHS_SAVESTATE:
- GetWindowText (GetDlgItem (hDlg, IDC_PATHS_SAVESTATE), tmp, sizeof (tmp));
- set_path ("StatefilePath", tmp);
+ GetWindowText (GetDlgItem (hDlg, IDC_PATHS_SAVESTATE), tmp, sizeof (tmp) / sizeof (TCHAR));
+ set_path (L"StatefilePath", tmp);
break;
case IDC_PATHS_SAVEIMAGES:
- fetch_path ("SaveimagePath", tmp, sizeof (tmp));
+ fetch_path (L"SaveimagePath", tmp, sizeof (tmp) / sizeof (TCHAR));
if (DirectorySelection (hDlg, &pathsguid, tmp)) {
- set_path ("SaveimagePath", tmp);
+ set_path (L"SaveimagePath", tmp);
values_to_pathsdialog (hDlg);
}
break;
case IDC_PATHS_SAVEIMAGE:
- GetWindowText (GetDlgItem (hDlg, IDC_PATHS_SAVEIMAGE), tmp, sizeof (tmp));
- set_path ("SaveimagePath", tmp);
+ GetWindowText (GetDlgItem (hDlg, IDC_PATHS_SAVEIMAGE), tmp, sizeof (tmp) / sizeof (TCHAR));
+ set_path (L"SaveimagePath", tmp);
break;
case IDC_PATHS_AVIOUTPUTS:
- fetch_path ("VideoPath", tmp, sizeof (tmp));
+ fetch_path (L"VideoPath", tmp, sizeof (tmp) / sizeof (TCHAR));
if (DirectorySelection (hDlg, &pathsguid, tmp)) {
- set_path ("VideoPath", tmp);
+ set_path (L"VideoPath", tmp);
values_to_pathsdialog (hDlg);
}
break;
case IDC_PATHS_RIPS:
- fetch_path ("RipperPath", tmp, sizeof (tmp));
+ fetch_path (L"RipperPath", tmp, sizeof (tmp) / sizeof (TCHAR));
if (DirectorySelection (hDlg, &pathsguid, tmp)) {
- set_path ("RipperPath", tmp);
+ set_path (L"RipperPath", tmp);
values_to_pathsdialog (hDlg);
}
break;
case IDC_PATHS_AVIOUTPUT:
- GetWindowText (GetDlgItem (hDlg, IDC_PATHS_AVIOUTPUT), tmp, sizeof (tmp));
- set_path ("VideoPath", tmp);
+ GetWindowText (GetDlgItem (hDlg, IDC_PATHS_AVIOUTPUT), tmp, sizeof (tmp) / sizeof (TCHAR));
+ set_path (L"VideoPath", tmp);
break;
case IDC_PATHS_RIP:
- GetWindowText (GetDlgItem (hDlg, IDC_PATHS_RIP), tmp, sizeof (tmp));
- set_path ("RipperPath", tmp);
+ GetWindowText (GetDlgItem (hDlg, IDC_PATHS_RIP), tmp, sizeof (tmp) / sizeof (TCHAR));
+ set_path (L"RipperPath", tmp);
break;
case IDC_PATHS_DEFAULT:
val = SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_GETCURSEL, 0, 0L);
if (val != CB_ERR && val >= 0 && val < numtypes) {
val = ptypes[val];
if (val == PATH_TYPE_WINUAE) {
- strcpy (start_path_data, start_path_exe);
+ _tcscpy (start_path_data, start_path_exe);
path_type = PATH_TYPE_WINUAE;
- strcpy (pathmode, "WinUAE");
+ _tcscpy (pathmode, L"WinUAE");
} else if (val == PATH_TYPE_NEWWINUAE && start_path_new1[0]) {
- strcpy (start_path_data, start_path_new1);
+ _tcscpy (start_path_data, start_path_new1);
path_type = PATH_TYPE_NEWWINUAE;
create_afnewdir(0);
- strcpy (pathmode, "WinUAE_2");
+ _tcscpy (pathmode, L"WinUAE_2");
} else if (val == PATH_TYPE_OLDAF && start_path_af[0]) {
- strcpy (start_path_data, start_path_af);
- strcpy (pathmode, "AF");
+ _tcscpy (start_path_data, start_path_af);
+ _tcscpy (pathmode, L"AF");
path_type = PATH_TYPE_OLDAF;
} else if (val == PATH_TYPE_NEWAF && start_path_new1[0]) {
- strcpy (pathmode, "AF2005");
+ _tcscpy (pathmode, L"AF2005");
path_type = PATH_TYPE_NEWAF;
create_afnewdir(0);
- strcpy (start_path_data, start_path_new1);
+ _tcscpy (start_path_data, start_path_new1);
} else if (val == PATH_TYPE_AMIGAFOREVERDATA && start_path_new2[0]) {
- strcpy (pathmode, "AMIGAFOREVERDATA");
+ _tcscpy (pathmode, L"AMIGAFOREVERDATA");
path_type = PATH_TYPE_AMIGAFOREVERDATA;
- strcpy (start_path_data, start_path_new1);
+ _tcscpy (start_path_data, start_path_new1);
}
SetCurrentDirectory (start_path_data);
- regsetstr (NULL, "PathMode", pathmode);
- set_path ("KickstartPath", NULL);
- set_path ("ConfigurationPath", NULL);
- set_path ("ScreenshotPath", NULL);
- set_path ("StatefilePath", NULL);
- set_path ("SaveimagePath", NULL);
- set_path ("VideoPath", NULL);
- set_path ("RipperPath", NULL);
+ regsetstr (NULL, L"PathMode", pathmode);
+ set_path (L"KickstartPath", NULL);
+ set_path (L"ConfigurationPath", NULL);
+ set_path (L"ScreenshotPath", NULL);
+ set_path (L"StatefilePath", NULL);
+ set_path (L"SaveimagePath", NULL);
+ set_path (L"VideoPath", NULL);
+ set_path (L"RipperPath", NULL);
values_to_pathsdialog (hDlg);
FreeConfigStore ();
}
break;
case IDC_PATHS_CONFIGCACHE:
configurationcache = IsDlgButtonChecked (hDlg, IDC_PATHS_CONFIGCACHE) ? 1 : 0;
- regsetint (NULL, "ConfigurationCache", configurationcache);
+ regsetint (NULL, L"ConfigurationCache", configurationcache);
break;
}
setguititle (NULL);
}
-static void quickstarthost (HWND hDlg, char *name)
+static void quickstarthost (HWND hDlg, TCHAR *name)
{
int type = CONFIG_TYPE_HOST;
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
if (getconfigstorefrompath (name, tmp, CONFIG_TYPE_HOST)) {
if (cfgfile_load (&workprefs, tmp, &type, 1))
}
}
-static void init_quickstartdlg_tooltip (HWND hDlg, char *tt)
+static void init_quickstartdlg_tooltip (HWND hDlg, TCHAR *tt)
{
TOOLINFO ti;
- ti.cbSize = sizeof(TOOLINFO);
+ ti.cbSize = sizeof (TOOLINFO);
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
ti.hwnd = hDlg;
ti.hinst = hInst;
{
static int firsttime;
int i, j, idx, idx2, qssize;
- char tmp1[2 * MAX_DPATH], tmp2[MAX_DPATH], hostconf[MAX_DPATH];
- char *p1, *p2;
+ TCHAR tmp1[2 * MAX_DPATH], tmp2[MAX_DPATH], hostconf[MAX_DPATH];
+ TCHAR *p1, *p2;
- qssize = sizeof (tmp1);
- regquerystr (NULL, "QuickStartHostConfig", hostconf, &qssize);
+ qssize = sizeof (tmp1) / sizeof (TCHAR);
+ regquerystr (NULL, L"QuickStartHostConfig", hostconf, &qssize);
if (firsttime == 0 && workprefs.start_gui) {
- regqueryint (NULL, "QuickStartModel", &quickstart_model);
- regqueryint (NULL, "QuickStartConfiguration", &quickstart_conf);
- regqueryint (NULL, "QuickStartCompatibility", &quickstart_compa);
- regqueryint (NULL, "QuickStartFloppies", &quickstart_floppy);
+ regqueryint (NULL, L"QuickStartModel", &quickstart_model);
+ regqueryint (NULL, L"QuickStartConfiguration", &quickstart_conf);
+ regqueryint (NULL, L"QuickStartCompatibility", &quickstart_compa);
+ regqueryint (NULL, L"QuickStartFloppies", &quickstart_floppy);
if (quickstart) {
workprefs.df[0][0] = 0;
workprefs.df[1][0] = 0;
CheckDlgButton (hDlg, IDC_QUICKSTARTMODE, quickstart);
- WIN32GUI_LoadUIString (IDS_QS_MODELS, tmp1, sizeof (tmp1));
- strcat (tmp1, "\n");
+ WIN32GUI_LoadUIString (IDS_QS_MODELS, tmp1, sizeof (tmp1) / sizeof (TCHAR));
+ _tcscat (tmp1, L"\n");
p1 = tmp1;
SendDlgItemMessage (hDlg, IDC_QUICKSTART_MODEL, CB_RESETCONTENT, 0, 0L);
idx = idx2 = 0;
i = 0;
while (amodels[i].compalevels >= 0) {
if (amodels[i].compalevels > 0) {
- p2 = strchr (p1, '\n');
- if (p2 && strlen (p2) > 0) {
+ p2 = _tcschr (p1, '\n');
+ if (p2 && _tcslen (p2) > 0) {
*p2++ = 0;
SendDlgItemMessage (hDlg, IDC_QUICKSTART_MODEL, CB_ADDSTRING, 0, (LPARAM)p1);
p1 = p2;
}
SendDlgItemMessage (hDlg, IDC_QUICKSTART_MODEL, CB_SETCURSEL, idx2, 0);
- WIN32GUI_LoadUIString (amodels[quickstart_model].id, tmp1, sizeof (tmp1));
- strcat (tmp1, "\n");
+ WIN32GUI_LoadUIString (amodels[quickstart_model].id, tmp1, sizeof (tmp1) / sizeof (TCHAR));
+ _tcscat (tmp1, L"\n");
p1 = tmp1;
init_quickstartdlg_tooltip (hDlg, 0);
SendDlgItemMessage (hDlg, IDC_QUICKSTART_CONFIGURATION, CB_RESETCONTENT, 0, 0L);
i = 0;
for (;;) {
- p2 = strchr (p1, '\n');
+ p2 = _tcschr (p1, '\n');
if (!p2)
break;
*p2++= 0;
SendDlgItemMessage (hDlg, IDC_QUICKSTART_CONFIGURATION, CB_ADDSTRING, 0, (LPARAM)p1);
p1 = p2;
- p2 = strchr (p1, '\n');
+ p2 = _tcschr (p1, '\n');
if (!p2)
break;
*p2++= 0;
- if (quickstart_conf == i && strlen (p1) > 0)
+ if (quickstart_conf == i && _tcslen (p1) > 0)
init_quickstartdlg_tooltip (hDlg, p1);
p1 = p2;
i++;
SendDlgItemMessage( hDlg, IDC_QUICKSTART_COMPATIBILITY, TBM_SETPOS, TRUE, quickstart_compa);
SendDlgItemMessage (hDlg, IDC_QUICKSTART_HOSTCONFIG, CB_RESETCONTENT, 0, 0L);
- WIN32GUI_LoadUIString (IDS_DEFAULT_HOST, tmp1, sizeof (tmp1));
+ WIN32GUI_LoadUIString (IDS_DEFAULT_HOST, tmp1, sizeof (tmp1) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_QUICKSTART_HOSTCONFIG, CB_ADDSTRING, 0, (LPARAM)tmp1);
idx = 0;
j = 1;
for (i = 0; i < configstoresize; i++) {
if (configstore[i]->Type == CONFIG_TYPE_HOST) {
- strcpy (tmp2, configstore[i]->Path);
- strncat (tmp2, configstore[i]->Name, MAX_DPATH);
- if (!strcmp (tmp2, hostconf))
+ _tcscpy (tmp2, configstore[i]->Path);
+ _tcsncat (tmp2, configstore[i]->Name, MAX_DPATH);
+ if (!_tcscmp (tmp2, hostconf))
idx = j;
SendDlgItemMessage (hDlg, IDC_QUICKSTART_HOSTCONFIG, CB_ADDSTRING, 0, (LPARAM)tmp2);
j++;
}
}
SendDlgItemMessage (hDlg, IDC_QUICKSTART_HOSTCONFIG, CB_SETCURSEL, idx, 0);
- regsetint (NULL, "QuickStartModel", quickstart_model);
- regsetint (NULL, "QuickStartConfiguration", quickstart_conf);
- regsetint (NULL, "QuickStartCompatibility", quickstart_compa);
+ regsetint (NULL, L"QuickStartModel", quickstart_model);
+ regsetint (NULL, L"QuickStartConfiguration", quickstart_conf);
+ regsetint (NULL, L"QuickStartCompatibility", quickstart_compa);
}
static void floppytooltip (HWND hDlg, int num, uae_u32 crc32);
int reload = 0;
uae_u32 crc32;
int messageid = -1;
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
floppytooltip (hDlg, num, 0);
quickstart_ok_floppy = 0;
break;
}
if (messageid > 0) {
- WIN32GUI_LoadUIString (messageid, tmp, sizeof (tmp));
+ WIN32GUI_LoadUIString (messageid, tmp, sizeof (tmp) / sizeof (TCHAR));
gui_message (tmp);
}
if (reload && quickstart) {
{
static int recursive;
int ret = FALSE, i;
- char tmp[MAX_DPATH];
- static char df0[MAX_DPATH];
- static char df1[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
+ static TCHAR df0[MAX_DPATH];
+ static TCHAR df1[MAX_DPATH];
static int dfxtype[2] = { -1, -1 };
static int doinit;
LRESULT val;
pages[QUICKSTART_ID] = hDlg;
currentpage = QUICKSTART_ID;
enable_for_quickstart (hDlg);
- strcpy (df0, workprefs.df[0]);
- strcpy (df1, workprefs.df[1]);
+ _tcscpy (df0, workprefs.df[0]);
+ _tcscpy (df1, workprefs.df[1]);
setmultiautocomplete (hDlg, ids);
doinit = 1;
break;
val = SendDlgItemMessage (hDlg, IDC_QUICKSTART_HOSTCONFIG, CB_GETCURSEL, 0, 0);
if (val != CB_ERR) {
SendDlgItemMessage (hDlg, IDC_QUICKSTART_HOSTCONFIG, CB_GETLBTEXT, (WPARAM)val, (LPARAM)tmp);
- regsetstr (NULL, "QuickStartHostConfig", tmp);
+ regsetstr (NULL, L"QuickStartHostConfig", tmp);
quickstarthost (hDlg, tmp);
if (val == 0 && quickstart)
load_quickstart (hDlg, 0);
{
case IDC_QUICKSTARTMODE:
quickstart = IsDlgButtonChecked (hDlg, IDC_QUICKSTARTMODE);
- regsetint (NULL, "QuickStartMode", quickstart);
+ regsetint (NULL, L"QuickStartMode", quickstart);
if (quickstart) {
init_quickstartdlg (hDlg);
load_quickstart (hDlg, 0);
}
if (recursive == 0 && quickstart) {
recursive++;
- if (strcmp (workprefs.df[0], df0) || workprefs.dfxtype[0] != dfxtype[0]) {
- strcpy (df0, workprefs.df[0]);
+ if (_tcscmp (workprefs.df[0], df0) || workprefs.dfxtype[0] != dfxtype[0]) {
+ _tcscpy (df0, workprefs.df[0]);
dfxtype[0] = workprefs.dfxtype[0];
testimage (hDlg, 0);
enable_for_quickstart (hDlg);
}
- if (strcmp (workprefs.df[1], df1) || workprefs.dfxtype[1] != dfxtype[1]) {
- strcpy (df1, workprefs.df[1]);
+ if (_tcscmp (workprefs.df[1], df1) || workprefs.dfxtype[1] != dfxtype[1]) {
+ _tcscpy (df1, workprefs.df[1]);
dfxtype[1] = workprefs.dfxtype[1];
testimage (hDlg, 1);
}
CharFormat.cbSize = sizeof (CharFormat);
- SetDlgItemText (hDlg, IDC_RICHEDIT1, "WinUAE");
+ SetDlgItemText (hDlg, IDC_RICHEDIT1, L"WinUAE");
SendDlgItemMessage (hDlg, IDC_RICHEDIT1, EM_GETCHARFORMAT, 0, (LPARAM) & CharFormat);
CharFormat.dwMask |= CFM_BOLD | CFM_SIZE | CFM_FACE;
CharFormat.dwEffects = CFE_BOLD;
CharFormat.yHeight = 18 * 20; /* height in twips, where a twip is 1/20th of a point - for a pt.size of 18 */
- strcpy (CharFormat.szFaceName, "Times New Roman");
+ _tcscpy (CharFormat.szFaceName, L"Times New Roman");
SendDlgItemMessage (hDlg, IDC_RICHEDIT1, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) & CharFormat);
SendDlgItemMessage (hDlg, IDC_RICHEDIT1, EM_SETBKGNDCOLOR, 0, GetSysColor (COLOR_3DFACE));
SendDlgItemMessage (hDlg, IDC_RICHEDIT2, EM_GETCHARFORMAT, 0, (LPARAM) & CharFormat);
CharFormat.dwMask |= CFM_SIZE | CFM_FACE;
CharFormat.yHeight = 10 * 20;
- strcpy (CharFormat.szFaceName, "Times New Roman");
+ _tcscpy (CharFormat.szFaceName, L"Times New Roman");
SendDlgItemMessage (hDlg, IDC_RICHEDIT2, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) & CharFormat);
SendDlgItemMessage (hDlg, IDC_RICHEDIT2, EM_SETBKGNDCOLOR, 0, GetSysColor (COLOR_3DFACE));
}
static DWORD idnth[] = { IDS_SECOND, IDS_THIRD, IDS_FOURTH, IDS_FIFTH, IDS_SIXTH, IDS_SEVENTH, IDS_EIGHTH, IDS_NINTH, IDS_TENTH, -1 };
-static void LoadNthString( DWORD value, char *nth, DWORD dwNthMax )
+static void LoadNthString( DWORD value, TCHAR *nth, DWORD dwNthMax )
{
nth[0] = 0;
if (value >= 1 && value <= 9)
static void init_frequency_combo (HWND hDlg, int dmode)
{
int i, j, freq, tmp;
- char hz[20], hz2[20], txt[100];
+ TCHAR hz[20], hz2[20], txt[100];
LRESULT index;
struct MultiDisplay *md = getdisplay (&workprefs);
hz[0] = hz2[0] = 0;
SendDlgItemMessage(hDlg, IDC_REFRESHRATE, CB_RESETCONTENT, 0, 0);
- WIN32GUI_LoadUIString (IDS_VSYNC_DEFAULT, txt, sizeof (txt));
+ WIN32GUI_LoadUIString (IDS_VSYNC_DEFAULT, txt, sizeof (txt) / sizeof (TCHAR));
SendDlgItemMessage(hDlg, IDC_REFRESHRATE, CB_ADDSTRING, 0, (LPARAM)txt);
for (i = 0; i < index; i++) {
freq = storedrefreshrates[i];
if (freq < 0) {
freq = -freq;
- sprintf (hz, "(%dHz)", freq);
+ _stprintf (hz, L"(%dHz)", freq);
} else {
- sprintf (hz, "%dHz", freq);
+ _stprintf (hz, L"%dHz", freq);
}
if (freq == 50 || freq == 100)
- strcat (hz, " PAL");
+ _tcscat (hz, L" PAL");
if (freq == 60 || freq == 120)
- strcat (hz, " NTSC");
+ _tcscat (hz, L" NTSC");
if (abs(workprefs.gfx_refreshrate) == freq)
- strcpy (hz2, hz);
+ _tcscpy (hz2, hz);
SendDlgItemMessage (hDlg, IDC_REFRESHRATE, CB_ADDSTRING, 0, (LPARAM)hz);
}
index = CB_ERR;
if (hz2[0] >= 0)
index = SendDlgItemMessage (hDlg, IDC_REFRESHRATE, CB_SELECTSTRING, 0, (LPARAM)hz2);
if (index == CB_ERR) {
- WIN32GUI_LoadUIString (IDS_VSYNC_DEFAULT, txt, sizeof (txt));
+ WIN32GUI_LoadUIString (IDS_VSYNC_DEFAULT, txt, sizeof (txt) / sizeof (TCHAR));
SendDlgItemMessage(hDlg, IDC_REFRESHRATE, CB_SELECTSTRING, i, (LPARAM)txt);
workprefs.gfx_refreshrate = 0;
}
{
int *p;
SendDlgItemMessage(hDlg, IDC_DA_MODE, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage(hDlg, IDC_DA_MODE, CB_ADDSTRING, 0, (LPARAM)"Brightness");
- SendDlgItemMessage(hDlg, IDC_DA_MODE, CB_ADDSTRING, 0, (LPARAM)"Contrast");
- SendDlgItemMessage(hDlg, IDC_DA_MODE, CB_ADDSTRING, 0, (LPARAM)"Gamma");
+ SendDlgItemMessage(hDlg, IDC_DA_MODE, CB_ADDSTRING, 0, (LPARAM)L"Brightness");
+ SendDlgItemMessage(hDlg, IDC_DA_MODE, CB_ADDSTRING, 0, (LPARAM)L"Contrast");
+ SendDlgItemMessage(hDlg, IDC_DA_MODE, CB_ADDSTRING, 0, (LPARAM)L"Gamma");
if (da_mode_selected == CB_ERR)
da_mode_selected = 0;
SendDlgItemMessage (hDlg, IDC_DA_MODE, CB_SETCURSEL, da_mode_selected, 0);
gui_display_depths[0] = gui_display_depths[1] = gui_display_depths[2] = -1;
for (i = 0; md->DisplayModes[i].depth >= 0; i++) {
if (md->DisplayModes[i].depth > 1 && md->DisplayModes[i].residx == md->DisplayModes[index].residx) {
- char tmp[64];
- sprintf (tmp, "%d", md->DisplayModes[i].depth * 8);
+ TCHAR tmp[64];
+ _stprintf (tmp, L"%d", md->DisplayModes[i].depth * 8);
SendDlgItemMessage(hDlg, IDC_RESOLUTIONDEPTH, CB_ADDSTRING, 0, (LPARAM)tmp);
if (md->DisplayModes[i].depth == d)
SendDlgItemMessage (hDlg, IDC_RESOLUTIONDEPTH, CB_SETCURSEL, cnt, 0);
static void values_to_displaydlg (HWND hDlg)
{
- char buffer[MAX_DPATH], buffer2[MAX_DPATH];
- char Nth[MAX_NTH_LENGTH];
- LPSTR blah[1] = { Nth };
- LPTSTR string = NULL;
+ TCHAR buffer[MAX_DPATH], buffer2[MAX_DPATH];
+ TCHAR Nth[MAX_NTH_LENGTH];
+ TCHAR *blah[1] = { Nth };
+ TCHAR *string = NULL;
int v;
init_display_mode (hDlg);
if (v == 0)
v = currprefs.ntscmode ? 60 : 50;
SendDlgItemMessage (hDlg, IDC_FRAMERATE2, TBM_SETPOS, TRUE, v);
- sprintf (buffer, "%d", v);
+ _stprintf (buffer, L"%d", v);
SetDlgItemText (hDlg, IDC_RATE2TEXT, buffer);
v = workprefs.cpu_cycle_exact ? 1 : workprefs.gfx_framerate;
SendDlgItemMessage (hDlg, IDC_FRAMERATE, TBM_SETPOS, TRUE, v);
- WIN32GUI_LoadUIString(IDS_FRAMERATE, buffer, sizeof buffer);
+ WIN32GUI_LoadUIString(IDS_FRAMERATE, buffer, sizeof buffer / sizeof (TCHAR));
LoadNthString (v - 1, Nth, MAX_NTH_LENGTH);
if(FormatMessage(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_ALLOCATE_BUFFER,
buffer, 0, 0, (LPTSTR)&string, MAX_FRAMERATE_LENGTH + MAX_NTH_LENGTH, (va_list *)blah ) == 0)
{
DWORD dwLastError = GetLastError();
- sprintf (buffer, "Every %s Frame", nth[v - 1]);
+ _stprintf (buffer, L"Every %s Frame", nth[v - 1]);
SetDlgItemText(hDlg, IDC_RATETEXT, buffer);
} else {
SetDlgItemText( hDlg, IDC_RATETEXT, string);
CheckRadioButton (hDlg, IDC_LM_NORMAL, IDC_LM_SCANLINES, IDC_LM_NORMAL + workprefs.gfx_linedbl);
SendDlgItemMessage(hDlg, IDC_SCREENMODE_NATIVE, CB_RESETCONTENT, 0, 0);
- WIN32GUI_LoadUIString(IDS_SCREEN_WINDOWED, buffer, sizeof buffer);
+ WIN32GUI_LoadUIString(IDS_SCREEN_WINDOWED, buffer, sizeof buffer / sizeof (TCHAR));
SendDlgItemMessage(hDlg, IDC_SCREENMODE_NATIVE, CB_ADDSTRING, 0, (LPARAM)buffer);
- WIN32GUI_LoadUIString(IDS_SCREEN_FULLSCREEN, buffer, sizeof buffer);
+ WIN32GUI_LoadUIString(IDS_SCREEN_FULLSCREEN, buffer, sizeof buffer / sizeof (TCHAR));
SendDlgItemMessage(hDlg, IDC_SCREENMODE_NATIVE, CB_ADDSTRING, 0, (LPARAM)buffer);
- WIN32GUI_LoadUIString(IDS_SCREEN_VSYNC, buffer2, sizeof buffer2);
- sprintf (buffer + strlen(buffer), " + %s", buffer2);
+ WIN32GUI_LoadUIString(IDS_SCREEN_VSYNC, buffer2, sizeof buffer2 / sizeof (TCHAR));
+ _stprintf (buffer + _tcslen (buffer), L" + %s", buffer2);
SendDlgItemMessage(hDlg, IDC_SCREENMODE_NATIVE, CB_ADDSTRING, 0, (LPARAM)buffer);
- WIN32GUI_LoadUIString(IDS_SCREEN_FULLWINDOW, buffer, sizeof buffer);
+ WIN32GUI_LoadUIString(IDS_SCREEN_FULLWINDOW, buffer, sizeof buffer / sizeof (TCHAR));
SendDlgItemMessage(hDlg, IDC_SCREENMODE_NATIVE, CB_ADDSTRING, 0, (LPARAM)buffer);
SendDlgItemMessage(hDlg, IDC_SCREENMODE_NATIVE, CB_SETCURSEL, display_toselect(workprefs.gfx_afullscreen, workprefs.gfx_avsync, 0), 0);
SendDlgItemMessage(hDlg, IDC_SCREENMODE_RTG, CB_RESETCONTENT, 0, 0);
- WIN32GUI_LoadUIString(IDS_SCREEN_WINDOWED, buffer, sizeof buffer);
+ WIN32GUI_LoadUIString(IDS_SCREEN_WINDOWED, buffer, sizeof buffer / sizeof (TCHAR));
SendDlgItemMessage(hDlg, IDC_SCREENMODE_RTG, CB_ADDSTRING, 0, (LPARAM)buffer);
- sprintf (buffer + strlen(buffer), " + %s", buffer2);
+ _stprintf (buffer + _tcslen (buffer), L" + %s", buffer2);
SendDlgItemMessage(hDlg, IDC_SCREENMODE_RTG, CB_ADDSTRING, 0, (LPARAM)buffer);
- WIN32GUI_LoadUIString(IDS_SCREEN_FULLSCREEN, buffer, sizeof buffer);
+ WIN32GUI_LoadUIString(IDS_SCREEN_FULLSCREEN, buffer, sizeof buffer / sizeof (TCHAR));
SendDlgItemMessage(hDlg, IDC_SCREENMODE_RTG, CB_ADDSTRING, 0, (LPARAM)buffer);
- WIN32GUI_LoadUIString(IDS_SCREEN_VSYNC, buffer2, sizeof buffer2);
- sprintf (buffer + strlen(buffer), " + %s", buffer2);
+ WIN32GUI_LoadUIString(IDS_SCREEN_VSYNC, buffer2, sizeof buffer2 / sizeof (TCHAR));
+ _stprintf (buffer + _tcslen (buffer), L" + %s", buffer2);
SendDlgItemMessage(hDlg, IDC_SCREENMODE_RTG, CB_ADDSTRING, 0, (LPARAM)buffer);
- WIN32GUI_LoadUIString(IDS_SCREEN_FULLWINDOW, buffer, sizeof buffer);
+ WIN32GUI_LoadUIString(IDS_SCREEN_FULLWINDOW, buffer, sizeof buffer / sizeof (TCHAR));
SendDlgItemMessage(hDlg, IDC_SCREENMODE_RTG, CB_ADDSTRING, 0, (LPARAM)buffer);
- sprintf (buffer + strlen(buffer), " + %s", buffer2);
+ _stprintf (buffer + _tcslen (buffer), L" + %s", buffer2);
SendDlgItemMessage(hDlg, IDC_SCREENMODE_RTG, CB_ADDSTRING, 0, (LPARAM)buffer);
SendDlgItemMessage(hDlg, IDC_SCREENMODE_RTG, CB_SETCURSEL, display_toselect(workprefs.gfx_pfullscreen, workprefs.gfx_pvsync, 1), 0);
SendDlgItemMessage(hDlg, IDC_LORES, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage(hDlg, IDC_LORES, CB_ADDSTRING, 0, (LPARAM)"Lores");
- SendDlgItemMessage(hDlg, IDC_LORES, CB_ADDSTRING, 0, (LPARAM)"Hires (normal)");
- SendDlgItemMessage(hDlg, IDC_LORES, CB_ADDSTRING, 0, (LPARAM)"SuperHires");
+ SendDlgItemMessage(hDlg, IDC_LORES, CB_ADDSTRING, 0, (LPARAM)L"Lores");
+ SendDlgItemMessage(hDlg, IDC_LORES, CB_ADDSTRING, 0, (LPARAM)L"Hires (normal)");
+ SendDlgItemMessage(hDlg, IDC_LORES, CB_ADDSTRING, 0, (LPARAM)L"SuperHires");
SendDlgItemMessage (hDlg, IDC_LORES, CB_SETCURSEL, workprefs.gfx_resolution, 0);
CheckDlgButton (hDlg, IDC_BLACKER_THAN_BLACK, workprefs.gfx_blackerthanblack);
static void init_resolution_combo (HWND hDlg)
{
int i = 0, idx = -1;
- char tmp[64];
+ TCHAR tmp[64];
struct MultiDisplay *md = getdisplay (&workprefs);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_RESETCONTENT, 0, 0);
while (md->DisplayModes[i].depth >= 0) {
if (md->DisplayModes[i].depth > 1 && md->DisplayModes[i].residx != idx) {
- sprintf (tmp, "%dx%d", md->DisplayModes[i].res.width, md->DisplayModes[i].res.height);
+ _stprintf (tmp, L"%dx%d", md->DisplayModes[i].res.width, md->DisplayModes[i].res.height);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, 0, (LPARAM)tmp);
idx = md->DisplayModes[i].residx;
}
static void init_displays_combo (HWND hDlg)
{
int i = 0;
- SendDlgItemMessage(hDlg, IDC_DISPLAYSELECT, CB_RESETCONTENT, 0, 0);
+ SendDlgItemMessage (hDlg, IDC_DISPLAYSELECT, CB_RESETCONTENT, 0, 0);
while (Displays[i].name) {
- SendDlgItemMessage(hDlg, IDC_DISPLAYSELECT, CB_ADDSTRING, 0, (LPARAM)Displays[i].name);
+ SendDlgItemMessage (hDlg, IDC_DISPLAYSELECT, CB_ADDSTRING, 0, (LPARAM)Displays[i].name);
i++;
}
if (workprefs.gfx_display >= i)
workprefs.gfx_display = 0;
- SendDlgItemMessage(hDlg, IDC_DISPLAYSELECT, CB_SETCURSEL, workprefs.gfx_display, 0);
+ SendDlgItemMessage (hDlg, IDC_DISPLAYSELECT, CB_SETCURSEL, workprefs.gfx_display, 0);
}
static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
workprefs.chipset_refreshrate = SendDlgItemMessage (hDlg, IDC_FRAMERATE2, TBM_GETPOS, 0, 0);
{
- char buffer[MAX_FRAMERATE_LENGTH];
- char Nth[MAX_NTH_LENGTH];
- LPSTR blah[1] = { Nth };
- LPTSTR string = NULL;
+ TCHAR buffer[MAX_FRAMERATE_LENGTH];
+ TCHAR Nth[MAX_NTH_LENGTH];
+ TCHAR *blah[1] = { Nth };
+ TCHAR *string = NULL;
WIN32GUI_LoadUIString(IDS_FRAMERATE, buffer, MAX_FRAMERATE_LENGTH);
LoadNthString(workprefs.gfx_framerate - 1, Nth, MAX_NTH_LENGTH);
buffer, 0, 0, (LPTSTR)&string, MAX_FRAMERATE_LENGTH + MAX_NTH_LENGTH, (va_list *)blah ) == 0)
{
DWORD dwLastError = GetLastError();
- sprintf (buffer, "Every %s Frame", nth[workprefs.gfx_framerate - 1]);
+ _stprintf (buffer, L"Every %s Frame", nth[workprefs.gfx_framerate - 1]);
SetDlgItemText(hDlg, IDC_RATETEXT, buffer);
}
else
SetDlgItemText(hDlg, IDC_RATETEXT, string);
LocalFree(string);
}
- sprintf (buffer, "%d", workprefs.chipset_refreshrate);
+ _stprintf (buffer, L"%d", workprefs.chipset_refreshrate);
SetDlgItemText (hDlg, IDC_RATE2TEXT, buffer);
workprefs.gfx_size_win.width = GetDlgItemInt(hDlg, IDC_XSIZE, &success, FALSE);
if(!success)
static void values_to_chipsetdlg (HWND hDlg)
{
- char Nth[MAX_NTH_LENGTH];
- LPSTR blah[1] = { Nth };
- LPTSTR string = NULL;
+ TCHAR Nth[MAX_NTH_LENGTH];
+ TCHAR *blah[1] = { Nth };
+ TCHAR *string = NULL;
int which_button;
switch(workprefs.chipset_mask)
}
CheckRadioButton (hDlg, IDC_CS_SOUND0, IDC_CS_SOUND2, which_button);
SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"");
- SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"Generic");
- SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"CDTV");
- SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"CD32");
- SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A500");
- SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A500+");
- SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A600");
- SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A1000");
- SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A1200");
- SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A2000");
- SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A3000");
- SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A3000T");
- SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A4000");
- SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A4000T");
+ SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)L"");
+ SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)L"Generic");
+ SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)L"CDTV");
+ SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)L"CD32");
+ SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)L"A500");
+ SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)L"A500+");
+ SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)L"A600");
+ SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)L"A1000");
+ SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)L"A1200");
+ SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)L"A2000");
+ SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)L"A3000");
+ SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)L"A3000T");
+ SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)L"A4000");
+ SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)L"A4000T");
SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_SETCURSEL, workprefs.cs_compatible, 0);
}
static void values_to_chipsetdlg2 (HWND hDlg)
{
- char txt[32];
+ TCHAR txt[32];
uae_u32 rev;
switch(workprefs.cs_ciaatod)
CheckDlgButton (hDlg, IDC_CS_IDE1, workprefs.cs_ide > 0 && (workprefs.cs_ide & 1));
CheckDlgButton (hDlg, IDC_CS_IDE2, workprefs.cs_ide > 0 && (workprefs.cs_ide & 2));
txt[0] = 0;
- sprintf (txt, "%d", workprefs.cs_rtc_adjust);
+ _stprintf (txt, L"%d", workprefs.cs_rtc_adjust);
SetDlgItemText(hDlg, IDC_CS_RTCADJUST, txt);
txt[0] = 0;
if (workprefs.cs_fatgaryrev >= 0)
- sprintf (txt, "%02X", workprefs.cs_fatgaryrev);
+ _stprintf (txt, L"%02X", workprefs.cs_fatgaryrev);
SetDlgItemText(hDlg, IDC_CS_FATGARYREV, txt);
txt[0] = 0;
if (workprefs.cs_ramseyrev >= 0)
- sprintf (txt, "%02X", workprefs.cs_ramseyrev);
+ _stprintf (txt, L"%02X", workprefs.cs_ramseyrev);
SetDlgItemText(hDlg, IDC_CS_RAMSEYREV, txt);
txt[0] = 0;
if (workprefs.cs_agnusrev >= 0) {
rev = workprefs.cs_agnusrev;
- sprintf (txt, "%02X", rev);
+ _stprintf (txt, L"%02X", rev);
} else if (workprefs.cs_compatible) {
rev = 0;
if (workprefs.ntscmode)
rev |= (currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? 0x20 : 0;
if (workprefs.chipmem_size > 1024 * 1024 && (workprefs.chipset_mask & CSMASK_ECS_AGNUS))
rev |= 0x21;
- sprintf (txt, "%02X", rev);
+ _stprintf (txt, L"%02X", rev);
}
SetDlgItemText(hDlg, IDC_CS_AGNUSREV, txt);
txt[0] = 0;
if (workprefs.cs_deniserev >= 0) {
rev = workprefs.cs_deniserev;
- sprintf (txt, "%01.1X", rev);
+ _stprintf (txt, L"%01.1X", rev);
} else if (workprefs.cs_compatible) {
rev = 0xf;
if (workprefs.chipset_mask & CSMASK_ECS_DENISE)
rev = 0xc;
if (workprefs.chipset_mask & CSMASK_AGA)
rev = 0x8;
- sprintf (txt, "%01.1X", rev);
+ _stprintf (txt, L"%01.1X", rev);
}
SetDlgItemText(hDlg, IDC_CS_DENISEREV, txt);
}
static void values_from_chipsetdlg2 (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- char txt[32], *p;
+ TCHAR txt[32], *p;
int v;
workprefs.cs_compatible = IsDlgButtonChecked (hDlg, IDC_CS_COMPATIBLE);
if (workprefs.cs_rtc) {
txt[0] = 0;
- SendDlgItemMessage (hDlg, IDC_CS_RTCADJUST, WM_GETTEXT, (WPARAM)sizeof(txt), (LPARAM)txt);
- workprefs.cs_rtc_adjust = atol(txt);
+ SendDlgItemMessage (hDlg, IDC_CS_RTCADJUST, WM_GETTEXT, (WPARAM)sizeof (txt) / sizeof (TCHAR), (LPARAM)txt);
+ workprefs.cs_rtc_adjust = _tstol(txt);
}
if (workprefs.cs_fatgaryrev >= 0) {
txt[0] = 0;
- SendDlgItemMessage (hDlg, IDC_CS_FATGARYREV, WM_GETTEXT, (WPARAM)sizeof(txt), (LPARAM)txt);
- v = strtol (txt, &p, 16);
+ SendDlgItemMessage (hDlg, IDC_CS_FATGARYREV, WM_GETTEXT, (WPARAM)sizeof (txt) / sizeof (TCHAR), (LPARAM)txt);
+ v = _tcstol (txt, &p, 16);
if (v >= 0 && v <= 255)
workprefs.cs_fatgaryrev = v;
}
if (workprefs.cs_ramseyrev >= 0) {
txt[0] = 0;
- SendDlgItemMessage (hDlg, IDC_CS_RAMSEYREV, WM_GETTEXT, (WPARAM)sizeof(txt), (LPARAM)txt);
- v = strtol (txt, &p, 16);
+ SendDlgItemMessage (hDlg, IDC_CS_RAMSEYREV, WM_GETTEXT, (WPARAM)sizeof (txt) / sizeof (TCHAR), (LPARAM)txt);
+ v = _tcstol (txt, &p, 16);
if (v >= 0 && v <= 255)
workprefs.cs_ramseyrev = v;
}
if (workprefs.cs_agnusrev >= 0) {
txt[0] = 0;
- SendDlgItemMessage (hDlg, IDC_CS_AGNUSREV, WM_GETTEXT, (WPARAM)sizeof(txt), (LPARAM)txt);
- v = strtol (txt, &p, 16);
+ SendDlgItemMessage (hDlg, IDC_CS_AGNUSREV, WM_GETTEXT, (WPARAM)sizeof (txt) / sizeof (TCHAR), (LPARAM)txt);
+ v = _tcstol (txt, &p, 16);
if (v >= 0 && v <= 255)
workprefs.cs_agnusrev = v;
}
if (workprefs.cs_deniserev >= 0) {
txt[0] = 0;
- SendDlgItemMessage (hDlg, IDC_CS_DENISEREV, WM_GETTEXT, (WPARAM)sizeof(txt), (LPARAM)txt);
- v = strtol (txt, &p, 16);
+ SendDlgItemMessage (hDlg, IDC_CS_DENISEREV, WM_GETTEXT, (WPARAM)sizeof (txt) / sizeof (TCHAR), (LPARAM)txt);
+ v = _tcstol (txt, &p, 16);
if (v >= 0 && v <= 15)
workprefs.cs_deniserev = v;
}
(workprefs.win32_rtgvblankrate == 70) ? 5 :
(workprefs.win32_rtgvblankrate == 75) ? 6 : 0, 0);
} else {
- char tmp[10];
- sprintf (tmp, "%d", workprefs.win32_rtgvblankrate);
+ TCHAR tmp[10];
+ _stprintf (tmp, L"%d", workprefs.win32_rtgvblankrate);
SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, WM_SETTEXT, 0, (LPARAM)tmp);
}
static INT_PTR CALLBACK MemoryDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
int v;
- char tmp[100];
+ TCHAR tmp[100];
static int recursive = 0;
switch (msg)
pages[MEMORY_ID] = hDlg;
currentpage = MEMORY_ID;
SendDlgItemMessage (hDlg, IDC_RTG_8BIT, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage (hDlg, IDC_RTG_8BIT, CB_ADDSTRING, 0, (LPARAM)"(8bit)");
- SendDlgItemMessage (hDlg, IDC_RTG_8BIT, CB_ADDSTRING, 0, (LPARAM)"8-bit (*)");
+ SendDlgItemMessage (hDlg, IDC_RTG_8BIT, CB_ADDSTRING, 0, (LPARAM)L"(8bit)");
+ SendDlgItemMessage (hDlg, IDC_RTG_8BIT, CB_ADDSTRING, 0, (LPARAM)L"8-bit (*)");
SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"(15/16bit)");
- SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"R5G6B5PC (*)");
- SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"R5G5B5PC");
- SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"R5G6B5");
- SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"R5G5B5");
- SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"B5G6R5PC");
- SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"B5G5R5PC");
+ SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)L"(15/16bit)");
+ SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)L"R5G6B5PC (*)");
+ SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)L"R5G5B5PC");
+ SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)L"R5G6B5");
+ SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)L"R5G5B5");
+ SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)L"B5G6R5PC");
+ SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)L"B5G5R5PC");
SendDlgItemMessage (hDlg, IDC_RTG_24BIT, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage (hDlg, IDC_RTG_24BIT, CB_ADDSTRING, 0, (LPARAM)"(24bit)");
- SendDlgItemMessage (hDlg, IDC_RTG_24BIT, CB_ADDSTRING, 0, (LPARAM)"R8G8B8");
- SendDlgItemMessage (hDlg, IDC_RTG_24BIT, CB_ADDSTRING, 0, (LPARAM)"B8G8R8");
+ SendDlgItemMessage (hDlg, IDC_RTG_24BIT, CB_ADDSTRING, 0, (LPARAM)L"(24bit)");
+ SendDlgItemMessage (hDlg, IDC_RTG_24BIT, CB_ADDSTRING, 0, (LPARAM)L"R8G8B8");
+ SendDlgItemMessage (hDlg, IDC_RTG_24BIT, CB_ADDSTRING, 0, (LPARAM)L"B8G8R8");
SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)"(32bit)");
- SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)"A8R8G8B8");
- SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)"A8B8G8R8");
- SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)"R8G8B8A8");
- SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)"B8G8R8A8 (*)");
+ SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)L"(32bit)");
+ SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)L"A8R8G8B8");
+ SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)L"A8B8G8R8");
+ SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)L"R8G8B8A8");
+ SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)L"B8G8R8A8 (*)");
SendDlgItemMessage (hDlg, IDC_CHIPMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_CHIP_MEM, MAX_CHIP_MEM));
SendDlgItemMessage (hDlg, IDC_FASTMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_FAST_MEM, MAX_FAST_MEM));
SendDlgItemMessage (hDlg, IDC_SLOWMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_SLOW_MEM, MAX_SLOW_MEM));
SendDlgItemMessage (hDlg, IDC_MBMEM1, TBM_SETRANGE, TRUE, MAKELONG (MIN_MB_MEM, MAX_MB_MEM));
SendDlgItemMessage (hDlg, IDC_MBMEM2, TBM_SETRANGE, TRUE, MAKELONG (MIN_MB_MEM, MAX_MB_MEM));
SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_RESETCONTENT, 0, 0);
- WIN32GUI_LoadUIString (IDS_DISABLED, tmp, sizeof tmp);
+ WIN32GUI_LoadUIString (IDS_DISABLED, tmp, sizeof tmp / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)tmp);
- WIN32GUI_LoadUIString (IDS_AUTOMATIC, tmp, sizeof tmp);
+ WIN32GUI_LoadUIString (IDS_AUTOMATIC, tmp, sizeof tmp / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)tmp);
- SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)"4:3");
- SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)"15:9");
- SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)"16:9");
- SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)"16:10");
+ SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)L"4:3");
+ SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)L"15:9");
+ SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)L"16:9");
+ SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)L"16:10");
SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, CB_ADDSTRING, 0, (LPARAM)"Disabled");
- SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, CB_ADDSTRING, 0, (LPARAM)"Chipset");
- SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, CB_ADDSTRING, 0, (LPARAM)"Real");
- SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, CB_ADDSTRING, 0, (LPARAM)"50");
- SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, CB_ADDSTRING, 0, (LPARAM)"60");
- SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, CB_ADDSTRING, 0, (LPARAM)"70");
- SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, CB_ADDSTRING, 0, (LPARAM)"75");
+ SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, CB_ADDSTRING, 0, (LPARAM)L"Disabled");
+ SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, CB_ADDSTRING, 0, (LPARAM)L"Chipset");
+ SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, CB_ADDSTRING, 0, (LPARAM)L"Real");
+ SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, CB_ADDSTRING, 0, (LPARAM)L"50");
+ SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, CB_ADDSTRING, 0, (LPARAM)L"60");
+ SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, CB_ADDSTRING, 0, (LPARAM)L"70");
+ SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, CB_ADDSTRING, 0, (LPARAM)L"75");
case WM_USER:
recursive++;
v = SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, CB_GETLBTEXT, (WPARAM)v, (LPARAM)tmp);
}
} else {
- v = SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, WM_GETTEXT, (WPARAM)sizeof tmp, (LPARAM)tmp);
+ v = SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, WM_GETTEXT, (WPARAM)sizeof tmp / sizeof (TCHAR), (LPARAM)tmp);
}
if (tmp[0])
- workprefs.win32_rtgvblankrate = atol (tmp);
+ workprefs.win32_rtgvblankrate = _tstol (tmp);
break;
}
workprefs.picasso96_modeflags = mask;
return FALSE;
}
-static void addromfiles (UAEREG *fkey, HWND hDlg, DWORD d, char *path, int type)
+static void addromfiles (UAEREG *fkey, HWND hDlg, DWORD d, TCHAR *path, int type)
{
int idx;
- char tmp[MAX_DPATH];
- char tmp2[MAX_DPATH];
- char seltmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
+ TCHAR tmp2[MAX_DPATH];
+ TCHAR seltmp[MAX_DPATH];
struct romdata *rdx;
rdx = scan_single_rom (path);
SendDlgItemMessage(hDlg, d, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage(hDlg, d, CB_ADDSTRING, 0, (LPARAM)"");
+ SendDlgItemMessage(hDlg, d, CB_ADDSTRING, 0, (LPARAM)L"");
idx = 0;
seltmp[0] = 0;
for (;fkey;) {
- DWORD size = sizeof (tmp);
- DWORD size2 = sizeof (tmp2);
+ DWORD size = sizeof (tmp) / sizeof (TCHAR);
+ DWORD size2 = sizeof (tmp2) / sizeof (TCHAR);
if (!regenumstr (fkey, idx, tmp, &size, tmp2, &size2))
break;
- if (strlen (tmp) == 7 || strlen (tmp) == 13) {
+ if (_tcslen (tmp) == 7 || _tcslen (tmp) == 13) {
int group = 0;
int subitem = 0;
- int idx2 = atol (tmp + 4);
- if (strlen (tmp) == 13) {
- group = atol (tmp + 8);
- subitem = atol (tmp + 11);
+ int idx2 = _tstol (tmp + 4);
+ if (_tcslen (tmp) == 13) {
+ group = _tstol (tmp + 8);
+ subitem = _tstol (tmp + 11);
}
if (idx2 >= 0) {
struct romdata *rd = getromdatabyidgroup (idx2, group, subitem);
if (SendDlgItemMessage (hDlg, d, CB_FINDSTRING, (WPARAM)-1, (LPARAM)tmp) < 0)
SendDlgItemMessage(hDlg, d, CB_ADDSTRING, 0, (LPARAM)tmp);
if (rd == rdx)
- strcpy (seltmp, tmp);
+ _tcscpy (seltmp, tmp);
}
}
}
SetDlgItemText(hDlg, d, path);
}
-static void getromfile (HWND hDlg, DWORD d, char *path, int size)
+static void getromfile (HWND hDlg, DWORD d, TCHAR *path, int size)
{
LRESULT val = SendDlgItemMessage (hDlg, d, CB_GETCURSEL, 0, 0L);
if (val == CB_ERR) {
SendDlgItemMessage (hDlg, d, WM_GETTEXT, (WPARAM)size, (LPARAM)path);
} else {
- char tmp1[MAX_DPATH];
+ TCHAR tmp1[MAX_DPATH];
struct romdata *rd;
SendDlgItemMessage (hDlg, d, CB_GETLBTEXT, (WPARAM)val, (LPARAM)tmp1);
path[0] = 0;
if (rd) {
struct romlist *rl = getromlistbyromdata(rd);
if (rd->configname)
- sprintf (path, ":%s", rd->configname);
+ _stprintf (path, L":%s", rd->configname);
else if (rl)
- strncpy (path, rl->path, size);
+ _tcsncpy (path, rl->path, size);
}
}
}
static void values_from_kickstartdlg (HWND hDlg)
{
- getromfile (hDlg, IDC_ROMFILE, workprefs.romfile, sizeof (workprefs.romfile));
- getromfile (hDlg, IDC_ROMFILE2, workprefs.romextfile, sizeof (workprefs.romextfile));
- getromfile (hDlg, IDC_CARTFILE, workprefs.cartfile, sizeof (workprefs.cartfile));
+ getromfile (hDlg, IDC_ROMFILE, workprefs.romfile, sizeof (workprefs.romfile) / sizeof (TCHAR));
+ getromfile (hDlg, IDC_ROMFILE2, workprefs.romextfile, sizeof (workprefs.romextfile) / sizeof (TCHAR));
+ getromfile (hDlg, IDC_CARTFILE, workprefs.cartfile, sizeof (workprefs.cartfile) / sizeof (TCHAR));
}
static void values_to_kickstartdlg (HWND hDlg)
{
UAEREG *fkey;
- fkey = regcreatetree (NULL, "DetectedROMs");
+ fkey = regcreatetree (NULL, L"DetectedROMs");
load_keyring(&workprefs, NULL);
addromfiles (fkey, hDlg, IDC_ROMFILE, workprefs.romfile,
ROMTYPE_KICK | ROMTYPE_KICKCD32);
ew (hDlg, IDC_CARTCHOOSER), FALSE);
ew (hDlg, IDC_FLASHCHOOSER), FALSE);
#endif
- if (!regexiststree (NULL , "DetectedROMs"))
+ if (!regexiststree (NULL , L"DetectedROMs"))
scan_roms (1);
}
-static void kickstartfilebuttons (HWND hDlg, WPARAM wParam, char *path)
+static void kickstartfilebuttons (HWND hDlg, WPARAM wParam, TCHAR *path)
{
switch (LOWORD(wParam))
{
static INT_PTR CALLBACK KickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int recursive;
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
switch (msg)
{
int id = GetDlgCtrlID((HWND)wParam);
if (id == IDC_KICKCHOOSER || id == IDC_ROMCHOOSER2
|| id == IDC_FLASHCHOOSER || id == IDC_CARTCHOOSER) {
- char *s = favoritepopup (hDlg);
+ TCHAR *s = favoritepopup (hDlg);
if (s) {
- char newfile[MAX_DPATH];
- strcpy (newfile, s);
+ TCHAR newfile[MAX_DPATH];
+ _tcscpy (newfile, s);
kickstartfilebuttons (hDlg, id, newfile);
xfree (s);
}
switch (LOWORD (wParam))
{
case IDC_FLASHFILE:
- GetWindowText (GetDlgItem (hDlg, IDC_FLASHFILE), tmp, sizeof (tmp));
- strcpy (workprefs.flashfile, tmp);
+ GetWindowText (GetDlgItem (hDlg, IDC_FLASHFILE), tmp, sizeof (tmp) / sizeof (TCHAR));
+ _tcscpy (workprefs.flashfile, tmp);
break;
case IDC_KICKSHIFTER:
static void misc_kbled (HWND hDlg, int v, int nv)
{
- char *defname = v == IDC_KBLED1 ? "(NumLock)" : v == IDC_KBLED2 ? "(CapsLock)" : "(ScrollLock)";
+ TCHAR *defname = v == IDC_KBLED1 ? L"(NumLock)" : v == IDC_KBLED2 ? L"(CapsLock)" : L"(ScrollLock)";
SendDlgItemMessage (hDlg, v, CB_RESETCONTENT, 0, 0L);
SendDlgItemMessage (hDlg, v, CB_ADDSTRING, 0, (LPARAM)defname);
- SendDlgItemMessage (hDlg, v, CB_ADDSTRING, 0, (LPARAM)"POWER");
- SendDlgItemMessage (hDlg, v, CB_ADDSTRING, 0, (LPARAM)"DF0");
- SendDlgItemMessage (hDlg, v, CB_ADDSTRING, 0, (LPARAM)"DF1");
- SendDlgItemMessage (hDlg, v, CB_ADDSTRING, 0, (LPARAM)"DF2");
- SendDlgItemMessage (hDlg, v, CB_ADDSTRING, 0, (LPARAM)"DF3");
- SendDlgItemMessage (hDlg, v, CB_ADDSTRING, 0, (LPARAM)"HD");
- SendDlgItemMessage (hDlg, v, CB_ADDSTRING, 0, (LPARAM)"CD");
+ SendDlgItemMessage (hDlg, v, CB_ADDSTRING, 0, (LPARAM)L"POWER");
+ SendDlgItemMessage (hDlg, v, CB_ADDSTRING, 0, (LPARAM)L"DF0");
+ SendDlgItemMessage (hDlg, v, CB_ADDSTRING, 0, (LPARAM)L"DF1");
+ SendDlgItemMessage (hDlg, v, CB_ADDSTRING, 0, (LPARAM)L"DF2");
+ SendDlgItemMessage (hDlg, v, CB_ADDSTRING, 0, (LPARAM)L"DF3");
+ SendDlgItemMessage (hDlg, v, CB_ADDSTRING, 0, (LPARAM)L"HD");
+ SendDlgItemMessage (hDlg, v, CB_ADDSTRING, 0, (LPARAM)L"CD");
SendDlgItemMessage (hDlg, v, CB_SETCURSEL, nv, 0);
}
SendDlgItemMessage (hDlg, v, CB_SETCURSEL, pri, 0);
}
-extern char *get_aspi_path(int);
+extern TCHAR *get_aspi_path(int);
static void misc_scsi(HWND hDlg)
{
SendDlgItemMessage (hDlg, IDC_SCSIMODE, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage (hDlg, IDC_SCSIMODE, CB_ADDSTRING, 0, (LPARAM)"SPTI");
- SendDlgItemMessage (hDlg, IDC_SCSIMODE, CB_ADDSTRING, 0, (LPARAM)"SPTI + SCSI SCAN");
+ SendDlgItemMessage (hDlg, IDC_SCSIMODE, CB_ADDSTRING, 0, (LPARAM)L"SPTI");
+ SendDlgItemMessage (hDlg, IDC_SCSIMODE, CB_ADDSTRING, 0, (LPARAM)L"SPTI + SCSI SCAN");
SendDlgItemMessage (hDlg, IDC_SCSIMODE, CB_ADDSTRING, 0, (LPARAM)((get_aspi_path(0)) ? "AdaptecASPI" : "(AdaptecASPI)"));
SendDlgItemMessage (hDlg, IDC_SCSIMODE, CB_ADDSTRING, 0, (LPARAM)((get_aspi_path(1)) ? "NeroASPI" : "(NeroASPI)"));
SendDlgItemMessage (hDlg, IDC_SCSIMODE, CB_ADDSTRING, 0, (LPARAM)((get_aspi_path(2)) ? "FrogASPI" : "(FrogASPI)"));
int i, idx = 0, cnt = 0, lid;
WORD langid = -1;
- if (regqueryint (NULL, "Language", &lid))
+ if (regqueryint (NULL, L"Language", &lid))
langid = (WORD)lid;
SendDlgItemMessage (hDlg, IDC_LANGUAGE, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage (hDlg, IDC_LANGUAGE, CB_ADDSTRING, 0, (LPARAM)"Autodetect");
- SendDlgItemMessage (hDlg, IDC_LANGUAGE, CB_ADDSTRING, 0, (LPARAM)"English (built-in)");
+ SendDlgItemMessage (hDlg, IDC_LANGUAGE, CB_ADDSTRING, 0, (LPARAM)L"Autodetect");
+ SendDlgItemMessage (hDlg, IDC_LANGUAGE, CB_ADDSTRING, 0, (LPARAM)L"English (built-in)");
if (langid == 0)
idx = 1;
cnt = 2;
}
if (v == -2)
langid = -1;
- regsetint (NULL, "Language", langid);
+ regsetint (NULL, L"Language", langid);
FreeLibrary(hUIDLL);
hUIDLL = NULL;
if (langid >= 0)
static void values_to_miscdlg (HWND hDlg)
{
- char txt[100];
+ TCHAR txt[100];
int cw;
if (currentpage == MISC1_ID) {
CheckDlgButton (hDlg, IDC_KBLED_USB, workprefs.win32_kbledmode);
SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)"1");
- SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)"5");
- SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)"10");
- SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)"20");
- SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)"30");
- sprintf (txt, "%d", workprefs.statecapturerate / 50);
+ SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)L"1");
+ SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)L"5");
+ SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)L"10");
+ SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)L"20");
+ SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)L"30");
+ _stprintf (txt, L"%d", workprefs.statecapturerate / 50);
SendDlgItemMessage( hDlg, IDC_STATE_RATE, WM_SETTEXT, 0, (LPARAM)txt);
SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)"5");
- SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)"10");
- SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)"20");
- SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)"50");
- SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)"100");
- sprintf (txt, "%d", workprefs.statecapturebuffersize / (1024 * 1024));
+ SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)L"5");
+ SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)L"10");
+ SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)L"20");
+ SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)L"50");
+ SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)L"100");
+ _stprintf (txt, L"%d", workprefs.statecapturebuffersize / (1024 * 1024));
SendDlgItemMessage( hDlg, IDC_STATE_BUFFERSIZE, WM_SETTEXT, 0, (LPARAM)txt);
misc_scsi(hDlg);
misc_lang(hDlg);
SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)"NonLocalVRAM");
- SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)"DefaultRAM");
- SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)"LocalVRAM");
- SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)"SystemRAM");
+ SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)L"NonLocalVRAM");
+ SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)L"DefaultRAM");
+ SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)L"LocalVRAM");
+ SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)L"SystemRAM");
SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_SETCURSEL, ddforceram, 0);
} else if (currentpage == MISC2_ID) {
static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- char txt[100];
+ TCHAR txt[100];
int v, i;
static int recursive;
case WM_CONTEXTMENU:
if (GetDlgCtrlID((HWND)wParam) == IDC_DOSAVESTATE) {
- char *s = favoritepopup (hDlg);
+ TCHAR *s = favoritepopup (hDlg);
if (s) {
- char path[MAX_DPATH];
- strcpy (path, s);
+ TCHAR path[MAX_DPATH];
+ _tcscpy (path, s);
xfree (s);
if (DiskSelection(hDlg, wParam, 9, &workprefs, path))
- save_state (savestate_fname, "Description!");
+ save_state (savestate_fname, L"Description!");
}
} else if (GetDlgCtrlID((HWND)wParam) == IDC_DOLOADSTATE) {
- char *s = favoritepopup (hDlg);
+ TCHAR *s = favoritepopup (hDlg);
if (s) {
- char path[MAX_DPATH];
- strcpy (path, s);
+ TCHAR path[MAX_DPATH];
+ _tcscpy (path, s);
xfree (s);
if (DiskSelection(hDlg, wParam, 10, &workprefs, path))
savestate_state = STATE_DORESTORE;
misc_getkbled (hDlg, IDC_KBLED3, 2);
break;
case IDC_STATE_RATE:
- getcbn (hDlg, IDC_STATE_RATE, txt, sizeof (txt));
- workprefs.statecapturerate = atol (txt) * 50;
+ getcbn (hDlg, IDC_STATE_RATE, txt, sizeof (txt) / sizeof (TCHAR));
+ workprefs.statecapturerate = _tstol (txt) * 50;
break;
case IDC_STATE_BUFFERSIZE:
- getcbn (hDlg, IDC_STATE_BUFFERSIZE, txt, sizeof (txt));
+ getcbn (hDlg, IDC_STATE_BUFFERSIZE, txt, sizeof (txt) / sizeof (TCHAR));
break;
case IDC_SCSIMODE:
v = SendDlgItemMessage (hDlg, IDC_SCSIMODE, CB_GETCURSEL, 0, 0L);
v = SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_GETCURSEL, 0, 0L);
if (v != CB_ERR) {
ddforceram = v;
- regsetint (NULL, "DirectDraw_Secondary", ddforceram);
+ regsetint (NULL, L"DirectDraw_Secondary", ddforceram);
}
break;
}
break;
case IDC_DOSAVESTATE:
if (DiskSelection(hDlg, wParam, 9, &workprefs, 0))
- save_state (savestate_fname, "Description!");
+ save_state (savestate_fname, L"Description!");
break;
case IDC_DOLOADSTATE:
if (DiskSelection(hDlg, wParam, 10, &workprefs, 0))
static void values_to_cpudlg (HWND hDlg)
{
- char cache[8] = "";
+ TCHAR cache[8] = L"";
int cpu;
SendDlgItemMessage (hDlg, IDC_SPEED, TBM_SETPOS, TRUE, workprefs.m68k_speed <= 0 ? 1 : workprefs.m68k_speed / CYCLE_UNIT );
CheckRadioButton (hDlg, IDC_TRUST0, IDC_TRUST1, trust_ids[workprefs.comptrustbyte]);
SendDlgItemMessage (hDlg, IDC_CACHE, TBM_SETPOS, TRUE, workprefs.cachesize / 1024);
- sprintf (cache, "%d MB", workprefs.cachesize / 1024 );
+ _stprintf (cache, L"%d MB", workprefs.cachesize / 1024 );
SetDlgItemText (hDlg, IDC_CACHETEXT, cache);
CheckDlgButton (hDlg, IDC_NOFLAGS, workprefs.compnf);
return l;
}
-static char *drivesounds;
+static TCHAR *drivesounds;
static void sound_loaddrivesamples (void)
{
WIN32_FIND_DATA fd;
HANDLE h;
- char *p;
+ TCHAR *p;
int len = 0;
- char dirname[1024];
+ TCHAR dirname[1024];
free (drivesounds);
p = drivesounds = 0;
- sprintf (dirname, "%s\\%sfloppysounds\\*.wav", start_path_data, WIN32_PLUGINDIR);
+ _stprintf (dirname, L"%s\\%sfloppysounds\\*.wav", start_path_data, WIN32_PLUGINDIR);
h = FindFirstFile (dirname, &fd);
if (h == INVALID_HANDLE_VALUE) {
- sprintf (dirname, "%s\\uae_data\\*.wav", start_path_data);
+ _stprintf (dirname, L"%s\\uae_data\\*.wav", start_path_data);
h = FindFirstFile (dirname, &fd);
if (h == INVALID_HANDLE_VALUE)
return;
}
for (;;) {
if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
- char *name = fd.cFileName;
- if (strlen (name) > strlen (DS_NAME_CLICK) + 4 && !strncmp (name, DS_NAME_CLICK, strlen (DS_NAME_CLICK))) {
+ TCHAR *name = fd.cFileName;
+ if (_tcslen (name) > _tcslen (DS_NAME_CLICK) + 4 && !_tcsncmp (name, DS_NAME_CLICK, _tcslen (DS_NAME_CLICK))) {
if (p - drivesounds < 1000) {
- char *oldp = p;
+ TCHAR *oldp = p;
len += 2000;
drivesounds = p = realloc (drivesounds, len);
if (oldp) {
do {
- p = p + strlen (p) + 1;
+ p = p + _tcslen (p) + 1;
} while (p[0]);
}
}
- strcpy (p, name + strlen (DS_NAME_CLICK));
- p[strlen (name + strlen (DS_NAME_CLICK)) - 4] = 0;
- p += strlen (p);
+ _tcscpy (p, name + _tcslen (DS_NAME_CLICK));
+ p[_tcslen (name + _tcslen (DS_NAME_CLICK)) - 4] = 0;
+ p += _tcslen (p);
*p++ = 0;
*p = 0;
}
static void update_soundgui (HWND hDlg)
{
int bufsize;
- char txt[20];
+ TCHAR txt[20];
bufsize = exact_log2 (workprefs.sound_maxbsiz / 1024);
- sprintf (txt, "%d", bufsize);
+ _stprintf (txt, L"%d", bufsize);
SetDlgItemText (hDlg, IDC_SOUNDBUFFERMEM, txt);
SendDlgItemMessage( hDlg, IDC_SOUNDVOLUME, TBM_SETPOS, TRUE, 100 - workprefs.sound_volume);
- sprintf (txt, "%d%%", 100 - workprefs.sound_volume);
+ _stprintf (txt, L"%d%%", 100 - workprefs.sound_volume);
SetDlgItemText (hDlg, IDC_SOUNDVOLUME2, txt);
SendDlgItemMessage( hDlg, IDC_SOUNDDRIVEVOLUME, TBM_SETPOS, TRUE, 100 - workprefs.dfxclickvolume);
- sprintf (txt, "%d%%", 100 - workprefs.dfxclickvolume);
+ _stprintf (txt, L"%d%%", 100 - workprefs.dfxclickvolume);
SetDlgItemText (hDlg, IDC_SOUNDDRIVEVOLUME2, txt);
}
int sound_freq = workprefs.sound_freq;
int produce_sound = workprefs.produce_sound;
int stereo = workprefs.sound_stereo;
- char txt[100], txt2[100], *p;
+ TCHAR txt[100], txt2[100], *p;
int i, selected;
LRESULT idx;
workprefs.sound_maxbsiz = DEFAULT_SOUND_MAXB;
SendDlgItemMessage (hDlg, IDC_SOUNDFILTER, CB_RESETCONTENT, 0, 0);
- WIN32GUI_LoadUIString (IDS_SOUND_FILTER_OFF, txt, sizeof (txt));
+ WIN32GUI_LoadUIString (IDS_SOUND_FILTER_OFF, txt, sizeof (txt) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_SOUNDFILTER, CB_ADDSTRING, 0, (LPARAM)txt);
- WIN32GUI_LoadUIString (IDS_SOUND_FILTER_EMULATED, txt, sizeof (txt));
+ WIN32GUI_LoadUIString (IDS_SOUND_FILTER_EMULATED, txt, sizeof (txt) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_SOUNDFILTER, CB_ADDSTRING, 0, (LPARAM)txt);
- WIN32GUI_LoadUIString (IDS_SOUND_FILTER_EMULATED_E, txt, sizeof (txt));
+ WIN32GUI_LoadUIString (IDS_SOUND_FILTER_EMULATED_E, txt, sizeof (txt) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_SOUNDFILTER, CB_ADDSTRING, 0, (LPARAM)txt);
- WIN32GUI_LoadUIString (IDS_SOUND_FILTER_ON_AGA, txt, sizeof (txt));
+ WIN32GUI_LoadUIString (IDS_SOUND_FILTER_ON_AGA, txt, sizeof (txt) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_SOUNDFILTER, CB_ADDSTRING, 0, (LPARAM)txt);
- WIN32GUI_LoadUIString (IDS_SOUND_FILTER_ON_A500, txt, sizeof (txt));
+ WIN32GUI_LoadUIString (IDS_SOUND_FILTER_ON_A500, txt, sizeof (txt) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_SOUNDFILTER, CB_ADDSTRING, 0, (LPARAM)txt);
i = 0;
switch (workprefs.sound_filter)
SendDlgItemMessage (hDlg, IDC_SOUNDFILTER, CB_SETCURSEL, i, 0);
SendDlgItemMessage (hDlg, IDC_SOUNDSTEREO, CB_RESETCONTENT, 0, 0);
- WIN32GUI_LoadUIString (IDS_SOUND_MONO, txt, sizeof (txt));
+ WIN32GUI_LoadUIString (IDS_SOUND_MONO, txt, sizeof (txt) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_SOUNDSTEREO, CB_ADDSTRING, 0, (LPARAM)txt);
- WIN32GUI_LoadUIString (IDS_SOUND_STEREO, txt, sizeof (txt));
+ WIN32GUI_LoadUIString (IDS_SOUND_STEREO, txt, sizeof (txt) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_SOUNDSTEREO, CB_ADDSTRING, 0, (LPARAM)txt);
- WIN32GUI_LoadUIString (IDS_SOUND_STEREO2, txt, sizeof (txt));
+ WIN32GUI_LoadUIString (IDS_SOUND_STEREO2, txt, sizeof (txt) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_SOUNDSTEREO, CB_ADDSTRING, 0, (LPARAM)txt);
- WIN32GUI_LoadUIString (IDS_SOUND_4CHANNEL, txt, sizeof (txt));
+ WIN32GUI_LoadUIString (IDS_SOUND_4CHANNEL, txt, sizeof (txt) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_SOUNDSTEREO, CB_ADDSTRING, 0, (LPARAM)txt);
- WIN32GUI_LoadUIString (IDS_SOUND_CLONED51, txt, sizeof (txt));
+ WIN32GUI_LoadUIString (IDS_SOUND_CLONED51, txt, sizeof (txt) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_SOUNDSTEREO, CB_ADDSTRING, 0, (LPARAM)txt);
- WIN32GUI_LoadUIString (IDS_SOUND_51, txt, sizeof (txt));
+ WIN32GUI_LoadUIString (IDS_SOUND_51, txt, sizeof (txt) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_SOUNDSTEREO, CB_ADDSTRING, 0, (LPARAM)txt);
SendDlgItemMessage (hDlg, IDC_SOUNDSTEREO, CB_SETCURSEL, workprefs.sound_stereo, 0);
SendDlgItemMessage (hDlg, IDC_SOUNDSWAP, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage (hDlg, IDC_SOUNDSWAP, CB_ADDSTRING, 0, (LPARAM)"-");
- WIN32GUI_LoadUIString (IDS_SOUND_SWAP_PAULA, txt, sizeof (txt));
+ SendDlgItemMessage (hDlg, IDC_SOUNDSWAP, CB_ADDSTRING, 0, (LPARAM)L"-");
+ WIN32GUI_LoadUIString (IDS_SOUND_SWAP_PAULA, txt, sizeof (txt) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_SOUNDSWAP, CB_ADDSTRING, 0, (LPARAM)txt);
- WIN32GUI_LoadUIString (IDS_SOUND_SWAP_AHI, txt, sizeof (txt));
+ WIN32GUI_LoadUIString (IDS_SOUND_SWAP_AHI, txt, sizeof (txt) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_SOUNDSWAP, CB_ADDSTRING, 0, (LPARAM)txt);
- WIN32GUI_LoadUIString (IDS_SOUND_SWAP_BOTH, txt, sizeof (txt));
+ WIN32GUI_LoadUIString (IDS_SOUND_SWAP_BOTH, txt, sizeof (txt) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_SOUNDSWAP, CB_ADDSTRING, 0, (LPARAM)txt);
SendDlgItemMessage (hDlg, IDC_SOUNDSWAP, CB_SETCURSEL,
workprefs.sound_stereo_swap_paula + workprefs.sound_stereo_swap_ahi * 2, 0);
SendDlgItemMessage (hDlg, IDC_SOUNDSTEREOSEP, CB_RESETCONTENT, 0, 0);
for (i = 10; i >= 0; i--) {
- sprintf (txt, "%d%%", i * 10);
+ _stprintf (txt, L"%d%%", i * 10);
SendDlgItemMessage (hDlg, IDC_SOUNDSTEREOSEP, CB_ADDSTRING, 0, (LPARAM)txt);
}
SendDlgItemMessage (hDlg, IDC_SOUNDSTEREOSEP, CB_SETCURSEL, 10 - workprefs.sound_stereo_separation, 0);
SendDlgItemMessage (hDlg, IDC_SOUNDSTEREOMIX, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage (hDlg, IDC_SOUNDSTEREOMIX, CB_ADDSTRING, 0, (LPARAM)"-");
+ SendDlgItemMessage (hDlg, IDC_SOUNDSTEREOMIX, CB_ADDSTRING, 0, (LPARAM)L"-");
for (i = 0; i < 10; i++) {
- sprintf (txt, "%d", i + 1);
+ _stprintf (txt, L"%d", i + 1);
SendDlgItemMessage (hDlg, IDC_SOUNDSTEREOMIX, CB_ADDSTRING, 0, (LPARAM)txt);
}
SendDlgItemMessage (hDlg, IDC_SOUNDSTEREOMIX, CB_SETCURSEL,
workprefs.sound_mixed_stereo_delay > 0 ? workprefs.sound_mixed_stereo_delay : 0, 0);
SendDlgItemMessage (hDlg, IDC_SOUNDINTERPOLATION, CB_RESETCONTENT, 0, 0);
- WIN32GUI_LoadUIString (IDS_DISABLED, txt, sizeof (txt));
+ WIN32GUI_LoadUIString (IDS_DISABLED, txt, sizeof (txt) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_SOUNDINTERPOLATION, CB_ADDSTRING, 0, (LPARAM)txt);
- SendDlgItemMessage (hDlg, IDC_SOUNDINTERPOLATION, CB_ADDSTRING, 0, (LPARAM)"Anti");
- SendDlgItemMessage (hDlg, IDC_SOUNDINTERPOLATION, CB_ADDSTRING, 0, (LPARAM)"Sinc");
- SendDlgItemMessage (hDlg, IDC_SOUNDINTERPOLATION, CB_ADDSTRING, 0, (LPARAM)"RH");
- SendDlgItemMessage (hDlg, IDC_SOUNDINTERPOLATION, CB_ADDSTRING, 0, (LPARAM)"Crux");
+ SendDlgItemMessage (hDlg, IDC_SOUNDINTERPOLATION, CB_ADDSTRING, 0, (LPARAM)L"Anti");
+ SendDlgItemMessage (hDlg, IDC_SOUNDINTERPOLATION, CB_ADDSTRING, 0, (LPARAM)L"Sinc");
+ SendDlgItemMessage (hDlg, IDC_SOUNDINTERPOLATION, CB_ADDSTRING, 0, (LPARAM)L"RH");
+ SendDlgItemMessage (hDlg, IDC_SOUNDINTERPOLATION, CB_ADDSTRING, 0, (LPARAM)L"Crux");
SendDlgItemMessage (hDlg, IDC_SOUNDINTERPOLATION, CB_SETCURSEL, workprefs.sound_interpol, 0);
SendDlgItemMessage (hDlg, IDC_SOUNDFREQ, CB_RESETCONTENT, 0, 0);
i = 0;
selected = -1;
while (soundfreqs[i]) {
- sprintf (txt, "%d", soundfreqs[i]);
+ _stprintf (txt, L"%d", soundfreqs[i]);
SendDlgItemMessage (hDlg, IDC_SOUNDFREQ, CB_ADDSTRING, 0, (LPARAM)txt);
i++;
}
- sprintf (txt, "%d", workprefs.sound_freq);
+ _stprintf (txt, L"%d", workprefs.sound_freq);
SendDlgItemMessage (hDlg, IDC_SOUNDFREQ, WM_SETTEXT, 0, (LPARAM)txt);
switch (workprefs.produce_sound)
idx = 0;
SendDlgItemMessage (hDlg, IDC_SOUNDDRIVE, CB_RESETCONTENT, 0, 0);
for (i = 0; i < 4; i++) {
- sprintf (txt, "DF%d:", i);
+ _stprintf (txt, L"DF%d:", i);
SendDlgItemMessage (hDlg, IDC_SOUNDDRIVE, CB_ADDSTRING, 0, (LPARAM)txt);
}
SendDlgItemMessage (hDlg, IDC_SOUNDDRIVE, CB_SETCURSEL, idx, 0);
SendDlgItemMessage (hDlg, IDC_SOUNDDRIVESELECT, CB_RESETCONTENT, 0, 0);
- WIN32GUI_LoadUIString (IDS_DRIVESOUND_NONE, txt, sizeof (txt));
+ WIN32GUI_LoadUIString (IDS_DRIVESOUND_NONE, txt, sizeof (txt) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_SOUNDDRIVESELECT, CB_ADDSTRING, 0, (LPARAM)txt);
- WIN32GUI_LoadUIString (IDS_DRIVESOUND_DEFAULT_A500, txt, sizeof (txt));
+ WIN32GUI_LoadUIString (IDS_DRIVESOUND_DEFAULT_A500, txt, sizeof (txt) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_SOUNDDRIVESELECT, CB_ADDSTRING, 0, (LPARAM)txt);
driveclick_fdrawcmd_detect ();
if (driveclick_pcdrivemask) {
for (i = 0; i < 2; i++) {
- WIN32GUI_LoadUIString (IDS_DRIVESOUND_PC_FLOPPY, txt, sizeof (txt));
- sprintf (txt2, txt, 'A' + i);
+ WIN32GUI_LoadUIString (IDS_DRIVESOUND_PC_FLOPPY, txt, sizeof (txt) / sizeof (TCHAR));
+ _stprintf (txt2, txt, 'A' + i);
SendDlgItemMessage (hDlg, IDC_SOUNDDRIVESELECT, CB_ADDSTRING, 0, (LPARAM)txt2);
}
}
if (p) {
while (p[0]) {
SendDlgItemMessage (hDlg, IDC_SOUNDDRIVESELECT, CB_ADDSTRING, 0, (LPARAM)p);
- p += strlen (p) + 1;
+ p += _tcslen (p) + 1;
}
}
if (workprefs.dfxclick[idx] < 0) {
p = drivesounds;
i = DS_BUILD_IN_SOUNDS + (driveclick_pcdrivemask ? 2 : 0) + 1;
while (p && p[0]) {
- if (!strcmpi (p, workprefs.dfxclickexternal[idx])) {
+ if (!_tcsicmp (p, workprefs.dfxclickexternal[idx])) {
SendDlgItemMessage (hDlg, IDC_SOUNDDRIVESELECT, CB_SETCURSEL, i, 0);
break;
}
i++;
- p += strlen (p) + 1;
+ p += _tcslen (p) + 1;
}
} else {
static void values_from_sounddlg (HWND hDlg)
{
- char txt[10];
+ TCHAR txt[10];
LRESULT idx;
idx = SendDlgItemMessage (hDlg, IDC_SOUNDFREQ, CB_GETCURSEL, 0, 0);
if (idx >= 0) {
workprefs.sound_freq = soundfreqs[idx];
} else {
- SendDlgItemMessage (hDlg, IDC_SOUNDFREQ, WM_GETTEXT, (WPARAM)sizeof (txt), (LPARAM)txt);
- workprefs.sound_freq = atol (txt);
+ SendDlgItemMessage (hDlg, IDC_SOUNDFREQ, WM_GETTEXT, (WPARAM)sizeof (txt) / sizeof (TCHAR), (LPARAM)txt);
+ workprefs.sound_freq = _tstol (txt);
}
if (workprefs.sound_freq < 8000)
workprefs.sound_freq = 8000;
int xtra = driveclick_pcdrivemask ? 2 : 0;
if (res > DS_BUILD_IN_SOUNDS + xtra) {
int j = res - (DS_BUILD_IN_SOUNDS + xtra + 1);
- char *p = drivesounds;
+ TCHAR *p = drivesounds;
while (j-- > 0)
- p += strlen (p) + 1;
+ p += _tcslen (p) + 1;
workprefs.dfxclick[idx] = -1;
- strcpy (workprefs.dfxclickexternal[idx], p);
+ _tcscpy (workprefs.dfxclickexternal[idx], p);
} else {
workprefs.dfxclick[idx] = res;
workprefs.dfxclickexternal[idx][0] = 0;
gotnonds = 1;
}
for (card = 0; card < numdevs; card++) {
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
int type = sound_devices[card].type;
if (gotnonds)
- sprintf (tmp, "%s: %s", type == SOUND_DEVICE_DS ? "DS" : (type == SOUND_DEVICE_AL ? "AL" : "PA"),
+ _stprintf (tmp, L"%s: %s", type == SOUND_DEVICE_DS ? L"DS" : (type == SOUND_DEVICE_AL ? L"AL" : L"PA"),
sound_devices[card].name);
else
- strcpy (tmp, sound_devices[card].name);
+ _tcscpy (tmp, sound_devices[card].name);
SendDlgItemMessage (hDlg, IDC_SOUNDCARDLIST, CB_ADDSTRING, 0, (LPARAM)tmp);
}
if (numdevs == 0)
struct fsvdlg_vals
{
- char volume[MAX_DPATH];
- char device[MAX_DPATH];
- char rootdir[MAX_DPATH];
+ TCHAR volume[MAX_DPATH];
+ TCHAR device[MAX_DPATH];
+ TCHAR rootdir[MAX_DPATH];
int bootpri;
int autoboot;
int donotmount;
int rdb;
};
-static struct fsvdlg_vals empty_fsvdlg = { "", "", "", 0, 1, 1, 1, 0 };
+static struct fsvdlg_vals empty_fsvdlg = { L"", L"", L"", 0, 1, 1, 1, 0 };
static struct fsvdlg_vals current_fsvdlg;
struct hfdlg_vals
{
- char volumename[MAX_DPATH];
- char devicename[MAX_DPATH];
- char filename[MAX_DPATH];
- char fsfilename[MAX_DPATH];
+ TCHAR volumename[MAX_DPATH];
+ TCHAR devicename[MAX_DPATH];
+ TCHAR filename[MAX_DPATH];
+ TCHAR fsfilename[MAX_DPATH];
int sectors;
int reserved;
int surfaces;
int controller;
};
-static struct hfdlg_vals empty_hfdlg = { "", "", "", "", 32, 2, 1, 0, 512, 1, 0, 0, 0, 1, 0 };
+static struct hfdlg_vals empty_hfdlg = { L"", L"", L"", L"", 32, 2, 1, 0, 512, 1, 0, 0, 0, 1, 0 };
static struct hfdlg_vals current_hfdlg;
static int archivehd;
static void volumeselectfile (HWND hDlg)
{
- char directory_path[MAX_DPATH];
- strcpy (directory_path, current_fsvdlg.rootdir);
+ TCHAR directory_path[MAX_DPATH];
+ _tcscpy (directory_path, current_fsvdlg.rootdir);
if (DiskSelection (hDlg, 0, 14, &workprefs, directory_path)) {
- char *s = filesys_createvolname (NULL, directory_path, "Harddrive");
+ TCHAR *s = filesys_createvolname (NULL, directory_path, L"Harddrive");
SetDlgItemText (hDlg, IDC_PATH_NAME, directory_path);
SetDlgItemText (hDlg, IDC_VOLUME_NAME, s);
xfree (s);
static void volumeselectdir (HWND hDlg, int newdir)
{
const GUID volumeguid = { 0x1df05121, 0xcc08, 0x46ea, { 0x80, 0x3f, 0x98, 0x3c, 0x54, 0x88, 0x53, 0x76 } };
- char szTitle[MAX_DPATH];
- char directory_path[MAX_DPATH];
+ TCHAR szTitle[MAX_DPATH];
+ TCHAR directory_path[MAX_DPATH];
- strcpy (directory_path, current_fsvdlg.rootdir);
+ _tcscpy (directory_path, current_fsvdlg.rootdir);
if (!newdir) {
WIN32GUI_LoadUIString (IDS_SELECTFILESYSROOT, szTitle, MAX_DPATH);
if (DirectorySelection (hDlg, &volumeguid, directory_path))
case WM_CONTEXTMENU:
if (GetDlgCtrlID ((HWND)wParam) == IDC_FS_SELECT_FILE) {
- char *s = favoritepopup (hDlg);
+ TCHAR *s = favoritepopup (hDlg);
if (s) {
- strcpy (current_fsvdlg.rootdir, s);
+ _tcscpy (current_fsvdlg.rootdir, s);
xfree (s);
volumeselectfile (hDlg);
}
} else if (GetDlgCtrlID ((HWND)wParam) == IDC_FS_SELECT_DIR) {
- char *s = favoritepopup (hDlg);
+ TCHAR *s = favoritepopup (hDlg);
if (s) {
- strcpy (current_fsvdlg.rootdir, s);
+ _tcscpy (current_fsvdlg.rootdir, s);
xfree (s);
volumeselectdir (hDlg, 1);
}
switch (LOWORD (wParam))
{
case IDC_FS_SELECT_EJECT:
- SetDlgItemText (hDlg, IDC_PATH_NAME, "");
- SetDlgItemText (hDlg, IDC_VOLUME_NAME, "");
+ SetDlgItemText (hDlg, IDC_PATH_NAME, L"");
+ SetDlgItemText (hDlg, IDC_VOLUME_NAME, L"");
CheckDlgButton (hDlg, IDC_FS_RW, TRUE);
ew (hDlg, IDC_FS_RW, TRUE);
archivehd = -1;
break;
}
}
- GetDlgItemText (hDlg, IDC_PATH_NAME, current_fsvdlg.rootdir, sizeof current_fsvdlg.rootdir);
- GetDlgItemText (hDlg, IDC_VOLUME_NAME, current_fsvdlg.volume, sizeof current_fsvdlg.volume);
- GetDlgItemText (hDlg, IDC_VOLUME_DEVICE, current_fsvdlg.device, sizeof current_fsvdlg.device);
+ GetDlgItemText (hDlg, IDC_PATH_NAME, current_fsvdlg.rootdir, sizeof current_fsvdlg.rootdir / sizeof (TCHAR));
+ GetDlgItemText (hDlg, IDC_VOLUME_NAME, current_fsvdlg.volume, sizeof current_fsvdlg.volume / sizeof (TCHAR));
+ GetDlgItemText (hDlg, IDC_VOLUME_DEVICE, current_fsvdlg.device, sizeof current_fsvdlg.device / sizeof (TCHAR));
current_fsvdlg.rw = IsDlgButtonChecked (hDlg, IDC_FS_RW);
current_fsvdlg.bootpri = GetDlgItemInt (hDlg, IDC_VOLUME_BOOTPRI, NULL, TRUE);
current_fsvdlg.autoboot = IsDlgButtonChecked (hDlg, IDC_FS_AUTOBOOT);
static void inithdcontroller (HWND hDlg)
{
SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)"UAE");
- SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)"IDE0");
- SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)"IDE1");
- SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)"IDE2");
- SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)"IDE3");
- SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)"SCSI0");
- SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)"SCSI1");
- SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)"SCSI2");
- SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)"SCSI3");
- SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)"SCSI4");
- SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)"SCSI5");
- SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)"SCSI6");
- SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)"SCSRAM");
+ SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)L"UAE");
+ SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)L"IDE0");
+ SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)L"IDE1");
+ SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)L"IDE2");
+ SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)L"IDE3");
+ SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)L"SCSI0");
+ SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)L"SCSI1");
+ SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)L"SCSI2");
+ SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)L"SCSI3");
+ SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)L"SCSI4");
+ SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)L"SCSI5");
+ SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)L"SCSI6");
+ SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)L"SCSRAM");
SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_SETCURSEL, 0, 0);
}
static void inithardfile (HWND hDlg)
{
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
ew (hDlg, IDC_HF_DOSTYPE, FALSE);
ew (hDlg, IDC_HF_CREATE, FALSE);
inithdcontroller (hDlg);
SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_RESETCONTENT, 0, 0);
- WIN32GUI_LoadUIString (IDS_HF_FS_CUSTOM, tmp, sizeof (tmp));
- SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_ADDSTRING, 0, (LPARAM)"OFS/FFS/RDB");
- SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_ADDSTRING, 0, (LPARAM)"SFS");
+ WIN32GUI_LoadUIString (IDS_HF_FS_CUSTOM, tmp, sizeof (tmp) / sizeof (TCHAR));
+ SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_ADDSTRING, 0, (LPARAM)L"OFS/FFS/RDB");
+ SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_ADDSTRING, 0, (LPARAM)L"SFS");
SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_ADDSTRING, 0, (LPARAM)tmp);
SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_SETCURSEL, 0, 0);
}
static void sethfdostype (HWND hDlg, int idx)
{
if (idx == 1)
- SetDlgItemText (hDlg, IDC_HF_DOSTYPE, "0x53465300");
+ SetDlgItemText (hDlg, IDC_HF_DOSTYPE, L"0x53465300");
else
- SetDlgItemText (hDlg, IDC_HF_DOSTYPE, "");
+ SetDlgItemText (hDlg, IDC_HF_DOSTYPE, L"");
}
static void hardfile_testrdb (HWND hDlg, struct hfdlg_vals *hdf)
{
- void *f = zfile_fopen (hdf->filename, "rb");
- char tmp[8] = { 0 };
+ void *f = zfile_fopen (hdf->filename, L"rb");
+ uae_u8 tmp[8] = { 0 };
if (!f)
return;
zfile_fread (tmp, 1, sizeof (tmp), f);
zfile_fclose (f);
- if (!memcmp (tmp + 2, "CIS", 3))
+ if (!memcmp (tmp + 2, L"CIS", 3))
hdf->controller = HD_CONTROLLER_PCMCIA_SRAM;
- if (!memcmp (tmp, "RDSK\0\0\0", 7)) {
+ if (!memcmp (tmp, L"RDSK\0\0\0", 7)) {
hdf->sectors = 0;
hdf->surfaces = 0;
hdf->reserved = 0;
static uae_u64 bsize;
static uae_u8 id[512];
int blocks, cyls, i;
- char tmp[200], idtmp[9], tmp2[200];
+ TCHAR tmp[200], tmp2[200];
+ TCHAR idtmp[9];
if (force) {
struct hardfiledata hfd;
if (current_hfdlg.blocksize * current_hfdlg.sectors * current_hfdlg.surfaces)
cyls = bsize / (current_hfdlg.blocksize * current_hfdlg.sectors * current_hfdlg.surfaces);
blocks = cyls * (current_hfdlg.sectors * current_hfdlg.surfaces);
- for (i = 0; i < 8; i++) {
- unsigned char c = id[i];
+ for (i = 0; i < sizeof (idtmp) / sizeof (TCHAR) - 1; i++) {
+ TCHAR c = id[i];
if (c < 32 || c > 126)
c = '.';
idtmp[i] = c;
tmp[0] = 0;
if (bsize) {
- sprintf (tmp2, " %s [%02X%02X%02X%02X%02X%02X%02X%02X]", idtmp, id[0], id[1], id[2], id[3], id[4], id[5], id[6], id[7]);
+ _stprintf (tmp2, L" %s [%02X%02X%02X%02X%02X%02X%02X%02X]", idtmp, id[0], id[1], id[2], id[3], id[4], id[5], id[6], id[7]);
if (!cyls || !blocks) {
- sprintf (tmp, "%dMB", bsize / (1024 * 1024));
+ _stprintf (tmp, L"%dMB", bsize / (1024 * 1024));
} else {
- sprintf (tmp, "%u cyls, %u blocks, %.1fMB/%.1fMB",
+ _stprintf (tmp, L"%u cyls, %u blocks, %.1fMB/%.1fMB",
cyls, blocks,
(double)blocks * 1.0 * current_hfdlg.blocksize / (1024.0 * 1024.0),
(double)bsize / (1024.0 * 1024.0));
if (cyls > 65535) {
- sprintf (tmp2, " %4.4s [%02X%02X%02X%02X]", idtmp, id[0], id[1], id[2], id[3]);
- strcat (tmp, " [Too many cyls]");
+ _stprintf (tmp2, L" %4.4s [%02X%02X%02X%02X]", idtmp, id[0], id[1], id[2], id[3]);
+ _tcscat (tmp, L" [Too many cyls]");
}
}
- strcat (tmp, tmp2);
+ _tcscat (tmp, tmp2);
}
SetDlgItemText (hDlg, IDC_HDFINFO, tmp);
}
-static void hardfileselecthdf (HWND hDlg, char *newpath)
+static void hardfileselecthdf (HWND hDlg, TCHAR *newpath)
{
DiskSelection (hDlg, IDC_PATH_NAME, 2, &workprefs, newpath);
- GetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.filename, sizeof current_hfdlg.filename);
+ GetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.filename, sizeof current_hfdlg.filename / sizeof (TCHAR));
inithardfile (hDlg);
hardfile_testrdb (hDlg, ¤t_hfdlg);
updatehdfinfo (hDlg, 1);
}
-static void hardfilecreatehdf (HWND hDlg, char *newpath)
+static void hardfilecreatehdf (HWND hDlg, TCHAR *newpath)
{
LRESULT res;
UINT setting = CalculateHardfileSize (hDlg);
- char dostype[16];
- GetDlgItemText (hDlg, IDC_HF_DOSTYPE, dostype, sizeof (dostype));
+ TCHAR dostype[16];
+ GetDlgItemText (hDlg, IDC_HF_DOSTYPE, dostype, sizeof (dostype) / sizeof (TCHAR));
res = SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_GETCURSEL, 0, 0);
if (res == 0)
dostype[0] = 0;
{
static int recursive = 0;
LRESULT res, posn;
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
switch (msg) {
case WM_INITDIALOG:
case WM_CONTEXTMENU:
if (GetDlgCtrlID ((HWND)wParam) == IDC_SELECTOR) {
- char *s = favoritepopup (hDlg);
+ TCHAR *s = favoritepopup (hDlg);
if (s) {
- char path[MAX_DPATH];
- strcpy (path, s);
+ TCHAR path[MAX_DPATH];
+ _tcscpy (path, s);
xfree (s);
hardfileselecthdf (hDlg, path);
}
} else if (GetDlgCtrlID ((HWND)wParam) == IDC_FILESYS_SELECTOR) {
- char *s = favoritepopup (hDlg);
+ TCHAR *s = favoritepopup (hDlg);
if (s) {
- char path[MAX_DPATH];
- strcpy (path, s);
+ TCHAR path[MAX_DPATH];
+ _tcscpy (path, s);
xfree (s);
DiskSelection (hDlg, IDC_PATH_FILESYS, 12, &workprefs, path);
}
} else if (GetDlgCtrlID ((HWND)wParam) == IDC_HF_CREATE) {
- char *s = favoritepopup (hDlg);
+ TCHAR *s = favoritepopup (hDlg);
if (s) {
- char path[MAX_DPATH];
- strcpy (path, s);
+ TCHAR path[MAX_DPATH];
+ _tcscpy (path, s);
xfree (s);
hardfilecreatehdf (hDlg, path);
}
DiskSelection (hDlg, IDC_PATH_FILESYS, 12, &workprefs, 0);
break;
case IDOK:
- if (strlen (current_hfdlg.filename) == 0) {
- char szMessage[MAX_DPATH];
- char szTitle[MAX_DPATH];
+ if (_tcslen (current_hfdlg.filename) == 0) {
+ TCHAR szMessage[MAX_DPATH];
+ TCHAR szTitle[MAX_DPATH];
WIN32GUI_LoadUIString (IDS_MUSTSELECTFILE, szMessage, MAX_DPATH);
WIN32GUI_LoadUIString (IDS_SETTINGSERROR, szTitle, MAX_DPATH);
MessageBox (hDlg, szMessage, szTitle, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
SetDlgItemInt (hDlg, IDC_SECTORS, 0, FALSE);
SetDlgItemInt (hDlg, IDC_RESERVED, 0, FALSE);
SetDlgItemInt (hDlg, IDC_HEADS, 0, FALSE);
- SetDlgItemText (hDlg, IDC_PATH_FILESYS, "");
- SetDlgItemText (hDlg, IDC_HARDFILE_DEVICE, "");
+ SetDlgItemText (hDlg, IDC_PATH_FILESYS, L"");
+ SetDlgItemText (hDlg, IDC_HARDFILE_DEVICE, L"");
current_hfdlg.sectors = current_hfdlg.reserved = current_hfdlg.surfaces = 0;
current_hfdlg.autoboot = 1;
current_hfdlg.donotmount = 0;
current_hfdlg.surfaces = GetDlgItemInt (hDlg, IDC_HEADS, NULL, FALSE);
current_hfdlg.blocksize = GetDlgItemInt (hDlg, IDC_BLOCKSIZE, NULL, FALSE);
current_hfdlg.bootpri = GetDlgItemInt (hDlg, IDC_HARDFILE_BOOTPRI, NULL, TRUE);
- GetDlgItemText (hDlg, IDC_PATH_NAME, tmp, sizeof tmp);
- if (strcmp (tmp, current_hfdlg.filename)) {
- strcpy (current_hfdlg.filename, tmp);
+ GetDlgItemText (hDlg, IDC_PATH_NAME, tmp, sizeof tmp / sizeof (TCHAR));
+ if (_tcscmp (tmp, current_hfdlg.filename)) {
+ _tcscpy (current_hfdlg.filename, tmp);
updatehdfinfo (hDlg, 1);
}
- GetDlgItemText (hDlg, IDC_PATH_FILESYS, current_hfdlg.fsfilename, sizeof current_hfdlg.fsfilename);
- GetDlgItemText (hDlg, IDC_HARDFILE_DEVICE, current_hfdlg.devicename, sizeof current_hfdlg.devicename);
+ GetDlgItemText (hDlg, IDC_PATH_FILESYS, current_hfdlg.fsfilename, sizeof current_hfdlg.fsfilename / sizeof (TCHAR));
+ GetDlgItemText (hDlg, IDC_HARDFILE_DEVICE, current_hfdlg.devicename, sizeof current_hfdlg.devicename / sizeof (TCHAR));
posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_GETCURSEL, 0, 0);
if (posn != CB_ERR)
current_hfdlg.controller = posn;
index = -1;
for (i = 0; i < hdf_getnumharddrives (); i++) {
SendDlgItemMessage (hDlg, IDC_HARDDRIVE, CB_ADDSTRING, 0, (LPARAM)hdf_getnameharddrive (i, 1, NULL));
- if (!strcmp (current_hfdlg.filename, hdf_getnameharddrive (i, 0, NULL)))
+ if (!_tcscmp (current_hfdlg.filename, hdf_getnameharddrive (i, 0, NULL)))
index = i;
}
if (index >= 0) {
}
}
if (posn != CB_ERR)
- strcpy (current_hfdlg.filename, hdf_getnameharddrive ((int)posn, 0, ¤t_hfdlg.blocksize));
+ _tcscpy (current_hfdlg.filename, hdf_getnameharddrive ((int)posn, 0, ¤t_hfdlg.blocksize));
current_hfdlg.rw = IsDlgButtonChecked (hDlg, IDC_HDF_RW);
posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_GETCURSEL, 0, 0);
if (posn != CB_ERR)
current_hfdlg.blocksize = uci->blocksize;
current_hfdlg.controller = uci->controller;
- strncpy (current_hfdlg.filename, uci->rootdir, (sizeof current_hfdlg.filename) - 1);
- current_hfdlg.filename[(sizeof current_hfdlg.filename) - 1] = '\0';
+ _tcsncpy (current_hfdlg.filename, uci->rootdir, (sizeof current_hfdlg.filename / sizeof (TCHAR)) - 1);
+ current_hfdlg.filename[(sizeof current_hfdlg.filename / sizeof (TCHAR)) - 1] = '\0';
current_hfdlg.fsfilename[0] = 0;
if (uci->filesys) {
- strncpy (current_hfdlg.fsfilename, uci->filesys, (sizeof current_hfdlg.fsfilename) - 1);
- current_hfdlg.fsfilename[(sizeof current_hfdlg.fsfilename) - 1] = '\0';
+ _tcsncpy (current_hfdlg.fsfilename, uci->filesys, (sizeof current_hfdlg.fsfilename / sizeof (TCHAR)) - 1);
+ current_hfdlg.fsfilename[(sizeof current_hfdlg.fsfilename / sizeof (TCHAR)) - 1] = '\0';
}
current_fsvdlg.device[0] = 0;
if (uci->devname) {
- strncpy (current_hfdlg.devicename, uci->devname, (sizeof current_hfdlg.devicename) - 1);
- current_hfdlg.devicename[(sizeof current_hfdlg.devicename) - 1] = '\0';
+ _tcsncpy (current_hfdlg.devicename, uci->devname, (sizeof current_hfdlg.devicename / sizeof (TCHAR)) - 1);
+ current_hfdlg.devicename[(sizeof current_hfdlg.devicename / sizeof (TCHAR)) - 1] = '\0';
}
current_hfdlg.rw = !uci->readonly;
current_hfdlg.bootpri = uci->bootpri;
{
current_hfdlg.controller = uci->controller;
current_hfdlg.rw = !uci->readonly;
- strncpy (current_hfdlg.filename, uci->rootdir, (sizeof current_hfdlg.filename) - 1);
- current_hfdlg.filename[(sizeof current_hfdlg.filename) - 1] = '\0';
+ _tcsncpy (current_hfdlg.filename, uci->rootdir, (sizeof current_hfdlg.filename) / sizeof (TCHAR) - 1);
+ current_hfdlg.filename[(sizeof current_hfdlg.filename) / sizeof (TCHAR) - 1] = '\0';
if (CustomDialogBox (IDD_HARDDRIVE, hDlg, HarddriveSettingsProc)) {
new_harddrive (hDlg, entry);
}
}
else /* Filesystem */
{
- strncpy (current_fsvdlg.rootdir, uci->rootdir, (sizeof current_fsvdlg.rootdir) - 1);
- current_fsvdlg.rootdir[sizeof (current_fsvdlg.rootdir) - 1] = '\0';
- strncpy (current_fsvdlg.volume, uci->volname, (sizeof current_fsvdlg.volume) - 1);
- current_fsvdlg.volume[sizeof (current_fsvdlg.volume) - 1] = '\0';
+ _tcsncpy (current_fsvdlg.rootdir, uci->rootdir, (sizeof current_fsvdlg.rootdir / sizeof (TCHAR)) - 1);
+ current_fsvdlg.rootdir[sizeof (current_fsvdlg.rootdir) / sizeof (TCHAR) - 1] = '\0';
+ _tcsncpy (current_fsvdlg.volume, uci->volname, (sizeof current_fsvdlg.volume / sizeof (TCHAR)) - 1);
+ current_fsvdlg.volume[sizeof (current_fsvdlg.volume) / sizeof (TCHAR) - 1] = '\0';
current_fsvdlg.device[0] = 0;
if (uci->devname) {
- strncpy (current_fsvdlg.device, uci->devname, (sizeof current_fsvdlg.device) - 1);
- current_fsvdlg.device[sizeof (current_fsvdlg.device) - 1] = '\0';
+ _tcsncpy (current_fsvdlg.device, uci->devname, (sizeof current_fsvdlg.device) / sizeof (TCHAR) - 1);
+ current_fsvdlg.device[sizeof (current_fsvdlg.device) / sizeof (TCHAR) - 1] = '\0';
}
current_fsvdlg.rw = !uci->readonly;
current_fsvdlg.bootpri = uci->bootpri;
case IDC_NEW_HD:
memset (¤t_hfdlg, 0, sizeof (current_hfdlg));
if (hdf_init_target () == 0) {
- char tmp[MAX_DPATH];
- WIN32GUI_LoadUIString (IDS_NOHARDDRIVES, tmp, sizeof (tmp));
+ TCHAR tmp[MAX_DPATH];
+ WIN32GUI_LoadUIString (IDS_NOHARDDRIVES, tmp, sizeof (tmp) / sizeof (TCHAR));
gui_message (tmp);
} else {
if (CustomDialogBox (IDD_HARDDRIVE, hDlg, HarddriveSettingsProc))
static void out_floppyspeed (HWND hDlg)
{
- char txt[30];
- char tmp1[MAX_DPATH];
- char tmp2[MAX_DPATH];
+ TCHAR txt[30];
+ TCHAR tmp1[MAX_DPATH];
+ TCHAR tmp2[MAX_DPATH];
- WIN32GUI_LoadUIString (IDS_FLOPPY_COMPATIBLE, tmp1, sizeof (tmp1));
- WIN32GUI_LoadUIString (IDS_FLOPPY_TURBO, tmp2, sizeof (tmp2));
+ WIN32GUI_LoadUIString (IDS_FLOPPY_COMPATIBLE, tmp1, sizeof (tmp1) / sizeof (TCHAR));
+ WIN32GUI_LoadUIString (IDS_FLOPPY_TURBO, tmp2, sizeof (tmp2) / sizeof (TCHAR));
if (workprefs.floppy_speed)
- sprintf (txt, "%d%%%s", workprefs.floppy_speed, workprefs.floppy_speed == 100 ? tmp1 : "");
+ _stprintf (txt, L"%d%%%s", workprefs.floppy_speed, workprefs.floppy_speed == 100 ? tmp1 : L"");
else
- strcpy (txt, tmp2);
+ _tcscpy (txt, tmp2);
SetDlgItemText (hDlg, IDC_FLOPPYSPDTEXT, txt);
}
{
TOOLINFO ti;
int id;
- char tmp[100];
+ TCHAR tmp[100];
if (currentpage == QUICKSTART_ID)
id = floppybuttonsq[num][0];
else
id = floppybuttons[num][0];
- ti.cbSize = sizeof(TOOLINFO);
+ ti.cbSize = sizeof (TOOLINFO);
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
ti.hwnd = hDlg;
ti.hinst = hInst;
SendMessage (ToolTipHWND, TTM_DELTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
if (crc32 == 0)
return;
- sprintf (tmp, "CRC=%08X", crc32);
+ _stprintf (tmp, L"CRC=%08X", crc32);
ti.lpszText = tmp;
SendMessage (ToolTipHWND, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
}
static void addfloppyhistory_2 (HWND hDlg, UAEREG *fkey, int n, int f_text)
{
int i, j;
- char *s;
+ TCHAR *s;
int nn = workprefs.dfxtype[n] + 1;
if (f_text < 0)
SendDlgItemMessage (hDlg, f_text, WM_SETTEXT, 0, (LPARAM)workprefs.df[n]);
i = 0;
while (s = DISK_history_get (i)) {
- char tmpname[MAX_DPATH], tmppath[MAX_DPATH], *p, *p2;
- if (strlen(s) == 0)
+ TCHAR tmpname[MAX_DPATH], tmppath[MAX_DPATH], *p, *p2;
+ if (_tcslen (s) == 0)
break;
i++;
- strcpy (tmppath, s);
- p = tmppath + strlen (tmppath) - 1;
+ _tcscpy (tmppath, s);
+ p = tmppath + _tcslen (tmppath) - 1;
for (j = 0; uae_archive_extensions[j]; j++) {
- p2 = strstr (tmppath, uae_archive_extensions[j]);
+ p2 = _tcsstr (tmppath, uae_archive_extensions[j]);
if (p2) {
p = p2;
break;
break;
p--;
}
- strcpy (tmpname, p + 1);
+ _tcscpy (tmpname, p + 1);
*++p = 0;
if (tmppath[0]) {
- strcat (tmpname, " { ");
- strcat (tmpname, tmppath);
- strcat (tmpname, " }");
+ _tcscat (tmpname, L" { ");
+ _tcscat (tmpname, tmppath);
+ _tcscat (tmpname, L" }");
}
if (f_text >= 0)
SendDlgItemMessage (hDlg, f_text, CB_ADDSTRING, 0, (LPARAM)tmpname);
- if (!strcmp (workprefs.df[n], s)) {
+ if (!_tcscmp (workprefs.df[n], s)) {
if (f_text >= 0)
SendDlgItemMessage (hDlg, f_text, CB_SETCURSEL, i - 1, 0);
}
quickstart_floppy = 2;
else
quickstart_floppy = 1;
- regsetint (NULL, "QuickStartFloppies", quickstart_floppy);
+ regsetint (NULL, L"QuickStartFloppies", quickstart_floppy);
}
}
-static int getfloppybox (HWND hDlg, int f_text, char *out, int maxlen)
+static int getfloppybox (HWND hDlg, int f_text, TCHAR *out, int maxlen)
{
LRESULT val;
- char *p1, *p2, *p;
- char *tmp;
+ TCHAR *p1, *p2, *p;
+ TCHAR *tmp;
int i;
out[0] = 0;
else
SendDlgItemMessage (hDlg, f_text, WM_GETTEXT, (WPARAM)maxlen, (LPARAM)out);
- tmp = xmalloc (maxlen + 1);
- strcpy (tmp, out);
- p1 = strstr(tmp, " { ");
- p2 = strstr(tmp, " }");
+ tmp = xmalloc ((maxlen + 1) * sizeof (TCHAR));
+ _tcscpy (tmp, out);
+ p1 = _tcsstr(tmp, L" { ");
+ p2 = _tcsstr(tmp, L" }");
if (p1 && p2 && p2 > p1) {
*p1 = 0;
- memset (out, 0, maxlen);
- memcpy (out, p1 + 3, p2 - p1 - 3);
- strcat (out, tmp);
+ memset (out, 0, maxlen * sizeof (TCHAR));
+ memcpy (out, p1 + 3, (p2 - p1 - 3) * sizeof (TCHAR));
+ _tcscat (out, tmp);
}
xfree (tmp);
i = 0;
while ((p = DISK_history_get (i))) {
- if (!strcmp (p, out)) {
+ if (!_tcscmp (p, out)) {
DISK_history_add (out, -1);
break;
}
static void getfloppyname (HWND hDlg, int n)
{
int f_text = currentpage == QUICKSTART_ID ? floppybuttonsq[n][0] : floppybuttons[n][0];
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
- if (getfloppybox (hDlg, f_text, tmp, sizeof (tmp))) {
+ if (getfloppybox (hDlg, f_text, tmp, sizeof (tmp) / sizeof (TCHAR))) {
disk_insert (n, tmp);
- strcpy (workprefs.df[n], tmp);
+ _tcscpy (workprefs.df[n], tmp);
}
}
static void deletesaveimage (HWND hDlg, int num)
{
- char *p = DISK_get_saveimagepath (workprefs.df[num]);
+ TCHAR *p = DISK_get_saveimagepath (workprefs.df[num]);
if (zfile_exists (p)) {
DeleteFile (p);
DISK_reinsert (num);
}
}
-static void diskselect (HWND hDlg, WPARAM wParam, struct uae_prefs *p, int drv, char *defaultpath)
+static void diskselect (HWND hDlg, WPARAM wParam, struct uae_prefs *p, int drv, TCHAR *defaultpath)
{
MultiDiskSelection (hDlg, wParam, 0, &workprefs, defaultpath);
disk_insert (0, p->df[0]);
break;
}
if (num >= 0) {
- char *s = favoritepopup (hDlg);
+ TCHAR *s = favoritepopup (hDlg);
if (s) {
int num = id == IDC_DF0QQ ? 0 : 1;
- char tmp[MAX_DPATH];
- strcpy (tmp, s);
+ TCHAR tmp[MAX_DPATH];
+ _tcscpy (tmp, s);
xfree (s);
diskselect (hDlg, id, &workprefs, num, tmp);
}
{
static int recursive = 0;
int i;
- static char diskname[40] = { "empty" };
+ static TCHAR diskname[40] = { L"empty" };
switch (msg)
{
case WM_INITDIALOG:
{
- char ft35dd[20], ft35hd[20], ft525sd[20], ftdis[20], ft35ddescom[20];
+ TCHAR ft35dd[20], ft35hd[20], ft525sd[20], ftdis[20], ft35ddescom[20];
int df0texts[] = { IDC_DF0TEXT, IDC_DF1TEXT, IDC_DF2TEXT, IDC_DF3TEXT, -1 };
- WIN32GUI_LoadUIString (IDS_FLOPPYTYPE35DD, ft35dd, sizeof ft35dd);
- WIN32GUI_LoadUIString (IDS_FLOPPYTYPE35HD, ft35hd, sizeof ft35hd);
- WIN32GUI_LoadUIString (IDS_FLOPPYTYPE525SD, ft525sd, sizeof ft525sd);
- WIN32GUI_LoadUIString (IDS_FLOPPYTYPE35DDESCOM, ft35ddescom, sizeof ft35ddescom);
- WIN32GUI_LoadUIString (IDS_FLOPPYTYPEDISABLED, ftdis, sizeof ftdis);
+ WIN32GUI_LoadUIString (IDS_FLOPPYTYPE35DD, ft35dd, sizeof ft35dd / sizeof (TCHAR));
+ WIN32GUI_LoadUIString (IDS_FLOPPYTYPE35HD, ft35hd, sizeof ft35hd / sizeof (TCHAR));
+ WIN32GUI_LoadUIString (IDS_FLOPPYTYPE525SD, ft525sd, sizeof ft525sd / sizeof (TCHAR));
+ WIN32GUI_LoadUIString (IDS_FLOPPYTYPE35DDESCOM, ft35ddescom, sizeof ft35ddescom / sizeof (TCHAR));
+ WIN32GUI_LoadUIString (IDS_FLOPPYTYPEDISABLED, ftdis, sizeof ftdis / sizeof (TCHAR));
pages[FLOPPY_ID] = hDlg;
if (workprefs.floppy_speed > 0 && workprefs.floppy_speed < 10)
workprefs.floppy_speed = 100;
break;
case IDC_EJECT0:
case IDC_EJECT0Q:
- SetDlgItemText (hDlg, IDC_DF0TEXT, "");
- SetDlgItemText (hDlg, IDC_DF0TEXTQ, "");
+ SetDlgItemText (hDlg, IDC_DF0TEXT, L"");
+ SetDlgItemText (hDlg, IDC_DF0TEXTQ, L"");
workprefs.df[0][0] = 0;
addfloppytype (hDlg, 0);
break;
case IDC_EJECT1:
case IDC_EJECT1Q:
- SetDlgItemText (hDlg, IDC_DF1TEXT, "");
- SetDlgItemText (hDlg, IDC_DF1TEXTQ, "");
+ SetDlgItemText (hDlg, IDC_DF1TEXT, L"");
+ SetDlgItemText (hDlg, IDC_DF1TEXTQ, L"");
workprefs.df[1][0] = 0;
addfloppytype (hDlg, 1);
break;
case IDC_EJECT2:
- SetDlgItemText (hDlg, IDC_DF2TEXT, "");
+ SetDlgItemText (hDlg, IDC_DF2TEXT, L"");
workprefs.df[2][0] = 0;
addfloppytype (hDlg, 2);
break;
case IDC_EJECT3:
- SetDlgItemText (hDlg, IDC_DF3TEXT, "");
+ SetDlgItemText (hDlg, IDC_DF3TEXT, L"");
workprefs.df[3][0] = 0;
addfloppytype (hDlg, 3);
break;
SetDlgItemText (hDlg, IDC_DISKTEXT, workprefs.dfxlist[entry]);
}
-static void addswapperfile (HWND hDlg, int entry, char *newpath)
+static void addswapperfile (HWND hDlg, int entry, TCHAR *newpath)
{
- char path[MAX_DPATH];
+ TCHAR path[MAX_DPATH];
int lastentry = entry;
path[0] = 0;
if (newpath)
- strcpy (path, newpath);
+ _tcscpy (path, newpath);
if (MultiDiskSelection (hDlg, -1, 0, &changed_prefs, path)) {
- char dpath[MAX_DPATH];
+ TCHAR dpath[MAX_DPATH];
loopmulti (path, NULL);
while (loopmulti (path, dpath) && entry < MAX_SPARE_DRIVES) {
- strcpy (workprefs.dfxlist[entry], dpath);
+ _tcscpy (workprefs.dfxlist[entry], dpath);
lastentry = entry;
entry++;
}
{
static int recursive = 0;
static int entry;
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
switch (msg)
{
entry = item;
for (i = 0; (item2 = draggeditems[i]) >= 0 && item2 < MAX_SPARE_DRIVES; i++, item++) {
if (item != item2) {
- char tmp[1000];
- strcpy (tmp, workprefs.dfxlist[item]);
- strcpy (workprefs.dfxlist[item], workprefs.dfxlist[item2]);
- strcpy (workprefs.dfxlist[item2], tmp);
+ TCHAR tmp[1000];
+ _tcscpy (tmp, workprefs.dfxlist[item]);
+ _tcscpy (workprefs.dfxlist[item], workprefs.dfxlist[item2]);
+ _tcscpy (workprefs.dfxlist[item2], tmp);
}
}
InitializeListView(hDlg);
break;
case WM_CONTEXTMENU:
if (GetDlgCtrlID ((HWND)wParam) == IDC_DISKLISTINSERT && entry >= 0) {
- char *s = favoritepopup (hDlg);
+ TCHAR *s = favoritepopup (hDlg);
if (s) {
addswapperfile (hDlg, entry, s);
xfree (s);
int i;
if (workprefs.dfxtype[drv] >= 0 && entry >= 0) {
for (i = 0; i < 4; i++) {
- if (!strcmp (workprefs.df[i], workprefs.dfxlist[entry]))
+ if (!_tcscmp (workprefs.df[i], workprefs.dfxlist[entry]))
workprefs.df[i][0] = 0;
}
- strcpy (workprefs.df[drv], workprefs.dfxlist[entry]);
+ _tcscpy (workprefs.df[drv], workprefs.dfxlist[entry]);
disk_insert (drv, workprefs.df[drv]);
InitializeListView (hDlg);
swapperhili (hDlg, entry);
case IDC_DISKLISTINSERT:
if (entry >= 0) {
- if (getfloppybox (hDlg, IDC_DISKTEXT, tmp, sizeof (tmp))) {
- strcpy (workprefs.dfxlist[entry], tmp);
+ if (getfloppybox (hDlg, IDC_DISKTEXT, tmp, sizeof (tmp) / sizeof (TCHAR))) {
+ _tcscpy (workprefs.dfxlist[entry], tmp);
addfloppyhistory (hDlg);
InitializeListView (hDlg);
swapperhili (hDlg, entry);
break;
case IDC_UP:
if (entry > 0) {
- strcpy (tmp, workprefs.dfxlist[entry - 1]);
- strcpy (workprefs.dfxlist[entry - 1], workprefs.dfxlist[entry]);
- strcpy (workprefs.dfxlist[entry], tmp);
+ _tcscpy (tmp, workprefs.dfxlist[entry - 1]);
+ _tcscpy (workprefs.dfxlist[entry - 1], workprefs.dfxlist[entry]);
+ _tcscpy (workprefs.dfxlist[entry], tmp);
InitializeListView (hDlg);
entry--;
swapperhili (hDlg, entry);
break;
case IDC_DOWN:
if (entry >= 0 && entry < MAX_SPARE_DRIVES - 1) {
- strcpy (tmp, workprefs.dfxlist[entry + 1]);
- strcpy (workprefs.dfxlist[entry + 1], workprefs.dfxlist[entry]);
- strcpy (workprefs.dfxlist[entry], tmp);
+ _tcscpy (tmp, workprefs.dfxlist[entry + 1]);
+ _tcscpy (workprefs.dfxlist[entry + 1], workprefs.dfxlist[entry]);
+ _tcscpy (workprefs.dfxlist[entry], tmp);
InitializeListView (hDlg);
entry++;
swapperhili (hDlg, entry);
static void updatejoyport (HWND hDlg)
{
int i, j;
- char tmp[MAX_DPATH], tmp2[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH];
SetDlgItemInt (hDlg, IDC_INPUTSPEEDM, workprefs.input_mouse_speed, FALSE);
CheckDlgButton (hDlg, IDC_PORT_MOUSETRICK, workprefs.input_magic_mouse);
int idx = i == 0 ? joy0previous : joy1previous;
int id = i == 0 ? IDC_PORT0_JOYS : IDC_PORT1_JOYS;
int v = workprefs.jports[i].id;
- char *p1, *p2;
+ TCHAR *p1, *p2;
SendDlgItemMessage (hDlg, id, CB_RESETCONTENT, 0, 0L);
- SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)"");
- WIN32GUI_LoadUIString (IDS_NONE, tmp, sizeof (tmp) - 3);
- sprintf (tmp2, "<%s>", tmp);
+ SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)L"");
+ WIN32GUI_LoadUIString (IDS_NONE, tmp, sizeof (tmp) / sizeof (TCHAR) - 3);
+ _stprintf (tmp2, L"<%s>", tmp);
SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)tmp2);
- WIN32GUI_LoadUIString (IDS_KEYJOY, tmp, sizeof (tmp));
- strcat (tmp, "\n");
+ WIN32GUI_LoadUIString (IDS_KEYJOY, tmp, sizeof (tmp) / sizeof (TCHAR));
+ _tcscat (tmp, L"\n");
p1 = tmp;
for (;;) {
- p2 = strchr (p1, '\n');
- if (p2 && strlen (p2) > 0) {
+ p2 = _tcschr (p1, '\n');
+ if (p2 && _tcslen (p2) > 0) {
*p2++ = 0;
SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)p1);
total++;
static void values_from_portsdlg (HWND hDlg)
{
int v;
- char tmp[256];
+ TCHAR tmp[256];
BOOL success;
LRESULT item;
item = SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_GETCURSEL, 0, 0L);
if(item != CB_ERR) {
int got = 0;
- strcpy (tmp, workprefs.prtname);
+ _tcscpy (tmp, workprefs.prtname);
if (item > 0) {
item--;
if (item < dwEnumeratedPrinters) {
- strcpy (workprefs.prtname, pInfo[item].pName);
+ _tcscpy (workprefs.prtname, pInfo[item].pName);
got = 1;
} else {
int i;
item -= dwEnumeratedPrinters;
for (i = 0; i < 4; i++) {
if ((paraport_mask & (1 << i)) && item == 0) {
- sprintf (workprefs.prtname, "LPT%d", i + 1);
+ _stprintf (workprefs.prtname, L"LPT%d", i + 1);
got = 1;
break;
}
if (!got)
workprefs.prtname[0] = 0;
#ifdef PARALLEL_PORT
- if (strcmp (workprefs.prtname, tmp))
+ if (_tcscmp (workprefs.prtname, tmp))
closeprinter ();
#endif
}
item = SendDlgItemMessage (hDlg, IDC_SERIAL, CB_GETCURSEL, 0, 0L);
if (item != CB_ERR && item > 0) {
workprefs.use_serial = 1;
- strcpy (workprefs.sername, comports[item - 1].dev);
+ _tcscpy (workprefs.sername, comports[item - 1].dev);
} else {
workprefs.use_serial = 0;
workprefs.sername[0] = 0;
if (IsDlgButtonChecked (hDlg, IDC_UAESERIAL))
workprefs.uaeserial = 1;
- GetDlgItemText (hDlg, IDC_PS_PARAMS, workprefs.ghostscript_parameters, sizeof workprefs.ghostscript_parameters);
+ GetDlgItemText (hDlg, IDC_PS_PARAMS, workprefs.ghostscript_parameters, sizeof workprefs.ghostscript_parameters / sizeof (TCHAR));
v = GetDlgItemInt (hDlg, IDC_PRINTERAUTOFLUSH, &success, FALSE);
if (success)
workprefs.parallel_autoflush_time = v;
if(workprefs.prtname[0]) {
int i, got = 1;
- char tmp[10];
+ TCHAR tmp[10];
result = SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_FINDSTRINGEXACT, -1, (LPARAM)workprefs.prtname);
for (i = 0; i < 4; i++) {
- sprintf (tmp, "LPT%d", i + 1);
- if (!strcmp (tmp, workprefs.prtname)) {
+ _stprintf (tmp, L"LPT%d", i + 1);
+ if (!_tcscmp (tmp, workprefs.prtname)) {
got = 0;
if (paraport_mask & (1 << i))
got = 1;
}
if(result < 0 || got == 0) {
// Warn the user that their printer-port selection is not valid on this machine
- char szMessage[MAX_DPATH];
+ TCHAR szMessage[MAX_DPATH];
WIN32GUI_LoadUIString (IDS_INVALIDPRTPORT, szMessage, MAX_DPATH);
pre_gui_message (szMessage);
// Disable the invalid parallel-port selection
int i;
LRESULT result = -1;
for (i = 0; i < MAX_SERIAL_PORTS && comports[i].name; i++) {
- if (!strcmp (comports[i].dev, workprefs.sername)) {
+ if (!_tcscmp (comports[i].dev, workprefs.sername)) {
result = SendDlgItemMessage (hDlg, IDC_SERIAL, CB_SETCURSEL, i + 1, 0L);
break;
}
}
if(result < 0 && workprefs.sername[0]) {
// Warn the user that their COM-port selection is not valid on this machine
- char szMessage[MAX_DPATH];
+ TCHAR szMessage[MAX_DPATH];
WIN32GUI_LoadUIString (IDS_INVALIDCOMPORT, szMessage, MAX_DPATH);
pre_gui_message (szMessage);
// Select "none" as the COM-port
int i = 1;
while (mask) {
if (mask & 1) {
- char tmp[30];
- sprintf (tmp, "LPT%d", i);
+ TCHAR tmp[30];
+ _stprintf (tmp, L"LPT%d", i);
SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_ADDSTRING, 0, (LPARAM)tmp);
}
i++;
if ((numdevs = midiOutGetNumDevs ()) == 0) {
ew (hDlg, IDC_MIDIOUTLIST, FALSE);
} else {
- char szMidiOut[MAX_DPATH];
+ TCHAR szMidiOut[MAX_DPATH];
WIN32GUI_LoadUIString (IDS_DEFAULTMIDIOUT, szMidiOut, MAX_DPATH);
SendDlgItemMessage (hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)szMidiOut);
for(port = 0; port < numdevs; port++) {
- if (midiOutGetDevCaps (port, &midiOutCaps, sizeof(midiOutCaps)) == MMSYSERR_NOERROR)
+ if (midiOutGetDevCaps (port, &midiOutCaps, sizeof (midiOutCaps)) == MMSYSERR_NOERROR)
SendDlgItemMessage (hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)midiOutCaps.szPname);
}
ew (hDlg, IDC_MIDIOUTLIST, TRUE);
bNoMidiIn = TRUE;
} else {
for(port = 0; port < numdevs; port++) {
- if (midiInGetDevCaps (port, &midiInCaps, sizeof(midiInCaps)) == MMSYSERR_NOERROR)
+ if (midiInGetDevCaps (port, &midiInCaps, sizeof (midiInCaps)) == MMSYSERR_NOERROR)
SendDlgItemMessage (hDlg, IDC_MIDIINLIST, CB_ADDSTRING, 0, (LPARAM)midiInCaps.szPname);
}
}
pages[GAMEPORTS_ID] = hDlg;
currentpage = GAMEPORTS_ID;
SendDlgItemMessage (hDlg, IDC_PORT_TABLET_CURSOR, CB_RESETCONTENT, 0, 0L);
- SendDlgItemMessage (hDlg, IDC_PORT_TABLET_CURSOR, CB_ADDSTRING, 0, (LPARAM)"Show both cursors");
- SendDlgItemMessage (hDlg, IDC_PORT_TABLET_CURSOR, CB_ADDSTRING, 0, (LPARAM)"Show native cursor only");
- SendDlgItemMessage (hDlg, IDC_PORT_TABLET_CURSOR, CB_ADDSTRING, 0, (LPARAM)"Show host cursor only");
+ SendDlgItemMessage (hDlg, IDC_PORT_TABLET_CURSOR, CB_ADDSTRING, 0, (LPARAM)L"Show both cursors");
+ SendDlgItemMessage (hDlg, IDC_PORT_TABLET_CURSOR, CB_ADDSTRING, 0, (LPARAM)L"Show native cursor only");
+ SendDlgItemMessage (hDlg, IDC_PORT_TABLET_CURSOR, CB_ADDSTRING, 0, (LPARAM)L"Show host cursor only");
inputdevice_updateconfig (&workprefs);
enable_for_gameportsdlg (hDlg);
updatejoyport (hDlg);
return FALSE;
}
-static char *eventnames[INPUTEVENT_END];
+static TCHAR *eventnames[INPUTEVENT_END];
static void values_to_inputdlg (HWND hDlg)
{
return FALSE;
}
-static int askinputcustom (HWND hDlg, char *custom, int maxlen, DWORD titleid)
+static int askinputcustom (HWND hDlg, TCHAR *custom, int maxlen, DWORD titleid)
{
HWND hwnd;
- char txt[MAX_DPATH];
+ TCHAR txt[MAX_DPATH];
stringboxdialogactive = 1;
hwnd = CustomCreateDialog (IDD_STRINGBOX, hDlg, StringBoxDialogProc);
TranslateMessage (&msg);
DispatchMessage (&msg);
}
- SendMessage (GetDlgItem (hwnd, IDC_STRINGBOXEDIT), WM_GETTEXT, sizeof txt, (LPARAM)txt);
+ SendMessage (GetDlgItem (hwnd, IDC_STRINGBOXEDIT), WM_GETTEXT, sizeof txt / sizeof (TCHAR), (LPARAM)txt);
}
if (stringboxdialogactive == -1) {
- strcpy (custom, txt);
+ _tcscpy (custom, txt);
return 1;
}
}
static void init_inputdlg_2(HWND hDlg)
{
- char name1[256], name2[256];
- char custom1[MAX_DPATH], tmp1[MAX_DPATH];
+ TCHAR name1[256], name2[256];
+ TCHAR custom1[MAX_DPATH], tmp1[MAX_DPATH];
int cnt, index, af, aftmp;
if (input_selected_widget < 0 || workprefs.input_selected_setting == 0) {
cnt = 2;
while(inputdevice_iterate (input_selected_device, input_selected_widget, name2, &aftmp)) {
free (eventnames[cnt]);
- eventnames[cnt] = strdup (name2);
- if (name1 && !strcmp (name1, name2)) {
+ eventnames[cnt] = my_strdup (name2);
+ if (name1 && !_tcscmp (name1, name2)) {
index = cnt;
af = aftmp;
}
cnt++;
SendDlgItemMessage (hDlg, IDC_INPUTAMIGA, CB_ADDSTRING, 0, (LPARAM)name2);
}
- if (strlen(custom1) > 0)
+ if (_tcslen (custom1) > 0)
index = 1;
if (index >= 0) {
SendDlgItemMessage (hDlg, IDC_INPUTAMIGA, CB_SETCURSEL, index, 0);
static void init_inputdlg (HWND hDlg)
{
int i;
- char buf[100], txt[100];
+ TCHAR buf[100], txt[100];
SendDlgItemMessage (hDlg, IDC_INPUTTYPE, CB_RESETCONTENT, 0, 0L);
- WIN32GUI_LoadUIString (IDS_INPUT_COMPATIBILITY, buf, sizeof (buf));
+ WIN32GUI_LoadUIString (IDS_INPUT_COMPATIBILITY, buf, sizeof (buf) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_INPUTTYPE, CB_ADDSTRING, 0, (LPARAM)buf);
- WIN32GUI_LoadUIString (IDS_INPUT_CUSTOM, buf, sizeof (buf));
+ WIN32GUI_LoadUIString (IDS_INPUT_CUSTOM, buf, sizeof (buf) / sizeof (TCHAR));
for (i = 0; i < 4; i++) {
- sprintf (txt, buf, i + 1);
+ _stprintf (txt, buf, i + 1);
SendDlgItemMessage (hDlg, IDC_INPUTTYPE, CB_ADDSTRING, 0, (LPARAM)txt);
}
SendDlgItemMessage (hDlg, IDC_INPUTCOPYFROM, CB_RESETCONTENT, 0, 0L);
- WIN32GUI_LoadUIString (IDS_INPUT_COPY_DEFAULT, buf, sizeof (buf));
+ WIN32GUI_LoadUIString (IDS_INPUT_COPY_DEFAULT, buf, sizeof (buf) / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_INPUTCOPYFROM, CB_ADDSTRING, 0, (LPARAM)buf);
- WIN32GUI_LoadUIString (IDS_INPUT_COPY_CUSTOM, buf, sizeof (buf));
+ WIN32GUI_LoadUIString (IDS_INPUT_COPY_CUSTOM, buf, sizeof (buf) / sizeof (TCHAR));
for (i = 0; i < 4; i++) {
- sprintf (txt, buf, i + 1);
+ _stprintf (txt, buf, i + 1);
SendDlgItemMessage (hDlg, IDC_INPUTCOPYFROM, CB_ADDSTRING, 0, (LPARAM)txt);
}
SendDlgItemMessage (hDlg, IDC_INPUTAMIGACNT, CB_RESETCONTENT, 0, 0L);
for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) {
- sprintf (buf, "%d", i + 1);
+ _stprintf (buf, L"%d", i + 1);
SendDlgItemMessage (hDlg, IDC_INPUTAMIGACNT, CB_ADDSTRING, 0, (LPARAM)buf);
}
SendDlgItemMessage (hDlg, IDC_INPUTAMIGACNT, CB_SETCURSEL, input_selected_sub_num, 0);
SendDlgItemMessage (hDlg, IDC_INPUTDEVICE, CB_RESETCONTENT, 0, 0L);
for (i = 0; i < inputdevice_get_device_total (IDTYPE_JOYSTICK); i++) {
- SendDlgItemMessage (hDlg, IDC_INPUTDEVICE, CB_ADDSTRING, 0, (LPARAM)inputdevice_get_device_name(IDTYPE_JOYSTICK, i));
+ SendDlgItemMessage (hDlg, IDC_INPUTDEVICE, CB_ADDSTRING, 0, (LPARAM)inputdevice_get_device_name (IDTYPE_JOYSTICK, i));
}
for (i = 0; i < inputdevice_get_device_total (IDTYPE_MOUSE); i++) {
- SendDlgItemMessage (hDlg, IDC_INPUTDEVICE, CB_ADDSTRING, 0, (LPARAM)inputdevice_get_device_name(IDTYPE_MOUSE, i));
+ SendDlgItemMessage (hDlg, IDC_INPUTDEVICE, CB_ADDSTRING, 0, (LPARAM)inputdevice_get_device_name (IDTYPE_MOUSE, i));
}
for (i = 0; i < inputdevice_get_device_total (IDTYPE_KEYBOARD); i++) {
- SendDlgItemMessage (hDlg, IDC_INPUTDEVICE, CB_ADDSTRING, 0, (LPARAM)inputdevice_get_device_name(IDTYPE_KEYBOARD, i));
+ SendDlgItemMessage (hDlg, IDC_INPUTDEVICE, CB_ADDSTRING, 0, (LPARAM)inputdevice_get_device_name (IDTYPE_KEYBOARD, i));
}
input_total_devices = inputdevice_get_device_total (IDTYPE_JOYSTICK) +
inputdevice_get_device_total (IDTYPE_MOUSE) +
static void doinputcustom (HWND hDlg, int newcustom)
{
- char custom1[MAX_DPATH];
+ TCHAR custom1[MAX_DPATH];
int flags;
custom1[0] = 0;
inputdevice_get_mapped_name (input_selected_device, input_selected_widget,
&flags, 0, custom1, input_selected_sub_num);
- if (strlen(custom1) > 0 || newcustom) {
- if (askinputcustom (hDlg, custom1, sizeof custom1, IDS_SB_CUSTOMEVENT)) {
+ if (_tcslen (custom1) > 0 || newcustom) {
+ if (askinputcustom (hDlg, custom1, sizeof custom1 / sizeof (TCHAR), IDS_SB_CUSTOMEVENT)) {
inputdevice_set_mapping (input_selected_device, input_selected_widget,
0, custom1, (flags & IDEV_MAPPED_AUTOFIRE_SET) ? 1 : 0, input_selected_sub_num);
}
if (inputchange && doselect && input_selected_device >= 0 && input_selected_event >= 0) {
int flags;
- char custom[MAX_DPATH];
+ TCHAR custom[MAX_DPATH];
custom[0] = 0;
inputdevice_get_mapped_name (input_selected_device, input_selected_widget,
&flags, 0, custom, input_selected_sub_num);
if (input_selected_event != 1)
custom[0] = 0;
inputdevice_set_mapping (input_selected_device, input_selected_widget,
- eventnames[input_selected_event], strlen(custom) == 0 ? NULL : custom,
+ eventnames[input_selected_event], _tcslen (custom) == 0 ? NULL : custom,
(flags & IDEV_MAPPED_AUTOFIRE_SET) ? 1 : 0, input_selected_sub_num);
update_listview_input (hDlg);
inputdevice_updateconfig (&workprefs);
#if 0
static void input_copy (HWND hDlg)
{
- char buf[2000];
+ TCHAR buf[2000];
inputdevice_acquire (1);
for (;;) {
focus = 1;
static void input_toggleautofire (void)
{
int af, flags, evt;
- char name[256];
- char custom[MAX_DPATH];
+ TCHAR name[256];
+ TCHAR custom[MAX_DPATH];
if (input_selected_device < 0 || input_selected_widget < 0)
return;
evt = inputdevice_get_mapped_name (input_selected_device, input_selected_widget,
static INT_PTR CALLBACK InputDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- char name_buf[MAX_DPATH] = "", desc_buf[128] = "";
- char *posn = NULL;
+ TCHAR name_buf[MAX_DPATH] = L"", desc_buf[128] = L"";
+ TCHAR *posn = NULL;
HWND list;
int dblclick = 0;
NM_LISTVIEW *nmlistview;
ew (hDlg, IDC_FILTERPRESETDELETE, filterpreset_selected > 0 && filterpreset_builtin < 0);
}
-static void makefilter (char *s, int x, int flags)
+static void makefilter (TCHAR *s, int x, int flags)
{
- sprintf (s, "%dx", x);
+ _stprintf (s, L"%dx", x);
if ((flags & (UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32)) == (UAE_FILTER_MODE_16_16 | UAE_FILTER_MODE_32_32)) {
- strcat (s, " (16bit/32bit)");
+ _tcscat (s, L" (16bit/32bit)");
return;
}
if (flags & UAE_FILTER_MODE_16)
- strcat (s, " (16bit)");
+ _tcscat (s, L" (16bit)");
if (flags & UAE_FILTER_MODE_32)
- strcat (s, " (32bit)");
+ _tcscat (s, L" (32bit)");
}
-static char *filtermultnames[] = { "FS", "1/2x", "1x", "2x", "4x", "6x", "8x", NULL };
+static TCHAR *filtermultnames[] = { L"FS", L"1/2x", L"1x", L"2x", L"4x", L"6x", L"8x", NULL };
static int filtermults[] = { 0, 2000, 1000, 500, 250, 167, 125 };
struct filterxtra {
- char *label;
+ TCHAR *label;
int *varw, *varc;
int min, max, step;
};
static struct filterxtra filter_pal_extra[] =
{
- "Brightness", &workprefs.gfx_filter_luminance, &currprefs.gfx_filter_luminance, -1000, 1000, 10,
- "Contrast", &workprefs.gfx_filter_contrast, &currprefs.gfx_filter_contrast, -1000, 1000, 10,
- "Saturation", &workprefs.gfx_filter_saturation, &currprefs.gfx_filter_saturation, -1000, 1000, 10,
- "Gamma", &workprefs.gfx_gamma, &currprefs.gfx_gamma, -1000, 1000, 10,
- "Scanlines", &workprefs.gfx_filter_scanlines, &currprefs.gfx_filter_scanlines, 0, 100, 1,
- "Blurriness", &workprefs.gfx_filter_blur, &currprefs.gfx_filter_blur,0, 2000, 10,
- "Noise", &workprefs.gfx_filter_noise, &currprefs.gfx_filter_noise,0, 100, 10,
+ L"Brightness", &workprefs.gfx_filter_luminance, &currprefs.gfx_filter_luminance, -1000, 1000, 10,
+ L"Contrast", &workprefs.gfx_filter_contrast, &currprefs.gfx_filter_contrast, -1000, 1000, 10,
+ L"Saturation", &workprefs.gfx_filter_saturation, &currprefs.gfx_filter_saturation, -1000, 1000, 10,
+ L"Gamma", &workprefs.gfx_gamma, &currprefs.gfx_gamma, -1000, 1000, 10,
+ L"Scanlines", &workprefs.gfx_filter_scanlines, &currprefs.gfx_filter_scanlines, 0, 100, 1,
+ L"Blurriness", &workprefs.gfx_filter_blur, &currprefs.gfx_filter_blur,0, 2000, 10,
+ L"Noise", &workprefs.gfx_filter_noise, &currprefs.gfx_filter_noise,0, 100, 10,
NULL
};
static struct filterxtra filter_3d_extra[] =
{
- "Scanline transparency", &workprefs.gfx_filter_scanlines, &currprefs.gfx_filter_scanlines, 0, 100, 10,
- "Scanline level", &workprefs.gfx_filter_scanlinelevel, &currprefs.gfx_filter_scanlinelevel, 0, 100, 10,
+ L"Scanline transparency", &workprefs.gfx_filter_scanlines, &currprefs.gfx_filter_scanlines, 0, 100, 10,
+ L"Scanline level", &workprefs.gfx_filter_scanlinelevel, &currprefs.gfx_filter_scanlinelevel, 0, 100, 10,
NULL
};
static int dummy_in, dummy_out;
};
struct filterpreset {
- char *name;
+ TCHAR *name;
int conf[25];
};
static struct filterpreset filterpresets[] =
{
- { "PAL example", 8, 0, 0, 0, 1000, 1000, 0, 0, 50, 0, 0, 1, 1, 0, 0, 0, 10, 0, 0, 0, 300, 30, 0, 0, 0 },
+ { L"PAL example", 8, 0, 0, 0, 1000, 1000, 0, 0, 50, 0, 0, 1, 1, 0, 0, 0, 10, 0, 0, 0, 300, 30, 0, 0, 0 },
{ NULL }
};
static int getfiltermult(HWND hDlg, DWORD dlg)
{
- char tmp[100];
+ TCHAR tmp[100];
LRESULT v = SendDlgItemMessage (hDlg, dlg, CB_GETCURSEL, 0, 0L);
float f;
if (v != CB_ERR)
return filtermults[v];
- SendDlgItemMessage (hDlg, dlg, WM_GETTEXT, (WPARAM)sizeof tmp, (LPARAM)tmp);
- if (!stricmp (tmp, "FS"))
+ SendDlgItemMessage (hDlg, dlg, WM_GETTEXT, (WPARAM)sizeof tmp / sizeof (TCHAR), (LPARAM)tmp);
+ if (!_tcsicmp (tmp, L"FS"))
return 0;
- f = atof (tmp);
+ f = (float)_tstof (tmp);
if (f < 0)
f = 0;
if (f > 9)
}
}
if (!got) {
- char tmp[100];
+ TCHAR tmp[100];
tmp[0] = 0;
if (val > 0)
- sprintf (tmp, "%.2f", 1000.0 / val);
+ _stprintf (tmp, L"%.2f", 1000.0 / val);
SetDlgItemText (hDlg, id, tmp);
}
}
static void values_to_hw3ddlg (HWND hDlg)
{
- char txt[100], tmp[100];
+ TCHAR txt[100], tmp[100];
int i, j, nofilter, fltnum, modenum;
struct uae_filter *uf;
UAEREG *fkey;
(workprefs.gfx_filter_aspect == 16 * 256 + 10) ? 4 : 0, 0);
SendDlgItemMessage (hDlg, IDC_FILTERAUTOSCALE, CB_RESETCONTENT, 0, 0L);
- SendDlgItemMessage (hDlg, IDC_FILTERAUTOSCALE, CB_ADDSTRING, 0, (LPARAM)"Disabled");
- SendDlgItemMessage (hDlg, IDC_FILTERAUTOSCALE, CB_ADDSTRING, 0, (LPARAM)"Automatic scaling");
- SendDlgItemMessage (hDlg, IDC_FILTERAUTOSCALE, CB_ADDSTRING, 0, (LPARAM)"Automatic resize");
+ SendDlgItemMessage (hDlg, IDC_FILTERAUTOSCALE, CB_ADDSTRING, 0, (LPARAM)L"Disabled");
+ SendDlgItemMessage (hDlg, IDC_FILTERAUTOSCALE, CB_ADDSTRING, 0, (LPARAM)L"Automatic scaling");
+ SendDlgItemMessage (hDlg, IDC_FILTERAUTOSCALE, CB_ADDSTRING, 0, (LPARAM)L"Automatic resize");
SendDlgItemMessage (hDlg, IDC_FILTERAUTOSCALE, CB_SETCURSEL, workprefs.gfx_filter_autoscale, 0);
SendDlgItemMessage (hDlg, IDC_FILTERHZ, TBM_SETRANGE, TRUE, MAKELONG (-999, +999));
if (D3D_canshaders ()) {
HANDLE h;
WIN32_FIND_DATA wfd;
- char tmp[MAX_DPATH];
- sprintf (tmp, "%s%sfiltershaders\\direct3d\\*.fx", start_path_exe, WIN32_PLUGINDIR);
+ TCHAR tmp[MAX_DPATH];
+ _stprintf (tmp, L"%s%sfiltershaders\\direct3d\\*.fx", start_path_exe, WIN32_PLUGINDIR);
h = FindFirstFile (tmp, &wfd);
while (h != INVALID_HANDLE_VALUE) {
- char tmp2[100];
- sprintf (tmp2, "D3D: %s", wfd.cFileName);
- tmp2[strlen (tmp2) - 3] = 0;
+ TCHAR tmp2[100];
+ _stprintf (tmp2, L"D3D: %s", wfd.cFileName);
+ tmp2[_tcslen (tmp2) - 3] = 0;
SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_ADDSTRING, 0, (LPARAM)tmp2);
- if (uf->type == UAE_FILTER_DIRECT3D && !strcmp (workprefs.gfx_filtershader, wfd.cFileName))
+ if (uf->type == UAE_FILTER_DIRECT3D && !_tcscmp (workprefs.gfx_filtershader, wfd.cFileName))
fltnum = j;
j++;
if (!FindNextFile (h, &wfd)) {
filter_extra = NULL;
SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_RESETCONTENT, 0, 0L);
if (uf->x[0]) {
- WIN32GUI_LoadUIString (IDS_3D_NO_FILTER, txt, sizeof (txt));
- sprintf (tmp, txt, 16);
+ WIN32GUI_LoadUIString (IDS_3D_NO_FILTER, txt, sizeof (txt) / sizeof (TCHAR));
+ _stprintf (tmp, txt, 16);
SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_ADDSTRING, 0, (LPARAM)tmp);
- WIN32GUI_LoadUIString (IDS_3D_BILINEAR, txt, sizeof (txt));
- sprintf (tmp, txt, 16);
+ WIN32GUI_LoadUIString (IDS_3D_BILINEAR, txt, sizeof (txt) / sizeof (TCHAR));
+ _stprintf (tmp, txt, 16);
SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_ADDSTRING, 0, (LPARAM)tmp);
- WIN32GUI_LoadUIString (IDS_3D_NO_FILTER, txt, sizeof (txt));
- sprintf (tmp, txt, 32);
+ WIN32GUI_LoadUIString (IDS_3D_NO_FILTER, txt, sizeof (txt) / sizeof (TCHAR));
+ _stprintf (tmp, txt, 32);
SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_ADDSTRING, 0, (LPARAM)tmp);
- WIN32GUI_LoadUIString (IDS_3D_BILINEAR, txt, sizeof (txt));
- sprintf (tmp, txt, 32);
+ WIN32GUI_LoadUIString (IDS_3D_BILINEAR, txt, sizeof (txt) / sizeof (TCHAR));
+ _stprintf (tmp, txt, 32);
SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_ADDSTRING, 0, (LPARAM)tmp);
modenum = 4;
filter_extra = filter_3d_extra;
i = j = 0;
while (scanlineratios[i * 2]) {
int sl = scanlineratios[i * 2] * 16 + scanlineratios[i * 2 + 1];
- sprintf (txt, "%d:%d", scanlineratios[i * 2], scanlineratios[i * 2 + 1]);
+ _stprintf (txt, L"%d:%d", scanlineratios[i * 2], scanlineratios[i * 2 + 1]);
if (workprefs.gfx_filter_scanlineratio == sl)
j = i;
SendDlgItemMessage (hDlg, IDC_FILTERSLR, CB_ADDSTRING, 0, (LPARAM)txt);
j = 0;
SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_RESETCONTENT, 0, 0L);
- SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_ADDSTRING, 0, (LPARAM)"");
+ SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_ADDSTRING, 0, (LPARAM)L"");
for (i = 0; filterpresets[i].name; i++) {
- char tmp[MAX_DPATH];
- sprintf(tmp, "* %s", filterpresets[i].name);
+ TCHAR tmp[MAX_DPATH];
+ _stprintf (tmp, L"* %s", filterpresets[i].name);
SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_ADDSTRING, 0, (LPARAM)tmp);
}
- fkey = regcreatetree (NULL, "FilterPresets");
+ fkey = regcreatetree (NULL, L"FilterPresets");
if (fkey) {
int idx = 0;
- char tmp[MAX_DPATH], tmp2[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH];
DWORD size, size2;
for (;;) {
- size = sizeof (tmp);
- size2 = sizeof (tmp2);
+ size = sizeof (tmp) / sizeof (TCHAR);
+ size2 = sizeof (tmp2) / sizeof (TCHAR);
if (!regenumstr (fkey, idx, tmp, &size, tmp2, &size2))
break;
SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_ADDSTRING, 0, (LPARAM)tmp);
static void filter_preset (HWND hDlg, WPARAM wParam)
{
int ok, load, i, builtin, userfilter;
- char tmp1[MAX_DPATH], tmp2[MAX_DPATH];
+ TCHAR tmp1[MAX_DPATH], tmp2[MAX_DPATH];
DWORD outsize;
UAEREG *fkey;
LRESULT item;
load = 0;
ok = 0;
for (builtin = 0; filterpresets[builtin].name; builtin++);
- fkey = regcreatetree (NULL, "FilterPresets");
+ fkey = regcreatetree (NULL, L"FilterPresets");
item = SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_GETCURSEL, 0, 0);
tmp1[0] = 0;
if (item != CB_ERR) {
SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_GETLBTEXT, (WPARAM)item, (LPARAM)tmp1);
} else {
filterpreset_selected = -1;
- SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, WM_GETTEXT, (WPARAM)sizeof tmp1, (LPARAM)tmp1);
+ SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, WM_GETTEXT, (WPARAM)sizeof tmp1 / sizeof (TCHAR), (LPARAM)tmp1);
}
userfilter = 0;
filterpreset_builtin = -1;
}
if (filterpreset_builtin < 0) {
- outsize = sizeof (tmp2);
+ outsize = sizeof (tmp2) / sizeof (TCHAR);
if (tmp1[0] && regquerystr (fkey, tmp1, tmp2, &outsize))
ok = 1;
} else {
- char *p = tmp2;
+ TCHAR *p = tmp2;
for (i = 0; filtervars[i]; i++) {
if (i > 0) {
- strcat (p, ",");
+ _tcscat (p, L",");
p++;
}
- sprintf (p, "%d", filterpresets[filterpreset_builtin].conf[i]);
- p += strlen(p);
+ _stprintf (p, L"%d", filterpresets[filterpreset_builtin].conf[i]);
+ p += _tcslen (p);
}
ok = 1;
}
if (wParam == IDC_FILTERPRESETSAVE && userfilter && fkey) {
- char *p = tmp2;
+ TCHAR *p = tmp2;
for (i = 0; filtervars[i]; i++) {
if (i > 0) {
- strcat (p, ",");
+ _tcscat (p, L",");
p++;
}
- sprintf (p, "%d", *(filtervars[i]));
- p += strlen(p);
+ _stprintf (p, L"%d", *(filtervars[i]));
+ p += _tcslen (p);
}
if (ok == 0) {
tmp1[0] = 0;
- SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, WM_GETTEXT, (WPARAM)sizeof (tmp1), (LPARAM)tmp1);
+ SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, WM_GETTEXT, (WPARAM)sizeof (tmp1) / sizeof (TCHAR), (LPARAM)tmp1);
if (tmp1[0] == 0)
goto end;
}
regdelete (fkey, tmp1);
values_to_hw3ddlg (hDlg);
} else if (wParam == IDC_FILTERPRESETLOAD) {
- char *s = tmp2;
- char *t;
+ TCHAR *s = tmp2;
+ TCHAR *t;
load = 1;
- strcat (s, ",");
- t = strchr (s, ',');
+ _tcscat (s, L",");
+ t = _tcschr (s, ',');
*t++ = 0;
for (i = 0; filtervars[i]; i++) {
- *(filtervars[i]) = atol(s);
+ *(filtervars[i]) = _tstol(s);
if (filtervars2[i])
*(filtervars2[i]) = *(filtervars[i]);
s = t;
- t = strchr (s, ',');
+ t = _tcschr (s, ',');
if (!t)
break;
*t++ = 0;
{
LRESULT item = SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_GETCURSEL, 0, 0L);
if (item != CB_ERR) {
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
int of = workprefs.gfx_filter;
int off = workprefs.gfx_filter_filtermode;
tmp[0] = 0;
item--;
if (item > UAE_FILTER_PAL) {
item = UAE_FILTER_DIRECT3D - 1;
- sprintf (workprefs.gfx_filtershader, "%s.fx", tmp + 5);
+ _stprintf (workprefs.gfx_filtershader, L"%s.fx", tmp + 5);
}
workprefs.gfx_filter = uaefilters[item].type;
item = SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_GETCURSEL, 0, 0L);
{
static int recursive;
LRESULT item;
- char tmp[100];
+ TCHAR tmp[100];
switch (msg)
{
pages[HW3D_ID] = hDlg;
currentpage = HW3D_ID;
SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_RESETCONTENT, 0, 0);
- WIN32GUI_LoadUIString (IDS_DISABLED, tmp, sizeof tmp);
+ WIN32GUI_LoadUIString (IDS_DISABLED, tmp, sizeof tmp / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_ADDSTRING, 0, (LPARAM)tmp);
- SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_ADDSTRING, 0, (LPARAM)"4:3");
- SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_ADDSTRING, 0, (LPARAM)"15:9");
- SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_ADDSTRING, 0, (LPARAM)"16:9");
- SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_ADDSTRING, 0, (LPARAM)"16:10");
+ SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_ADDSTRING, 0, (LPARAM)L"4:3");
+ SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_ADDSTRING, 0, (LPARAM)L"15:9");
+ SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_ADDSTRING, 0, (LPARAM)L"16:9");
+ SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_ADDSTRING, 0, (LPARAM)L"16:10");
enable_for_hw3ddlg (hDlg);
case WM_USER:
#ifdef AVIOUTPUT
static void values_to_avioutputdlg (HWND hDlg)
{
- char tmpstr[256];
+ TCHAR tmpstr[256];
updatewinfsmode (&workprefs);
SetDlgItemText (hDlg, IDC_AVIOUTPUT_FILETEXT, avioutput_filename);
- sprintf (tmpstr, "%d fps", avioutput_fps);
+ _stprintf (tmpstr, L"%d fps", avioutput_fps);
SendMessage (GetDlgItem(hDlg, IDC_AVIOUTPUT_FPS_STATIC), WM_SETTEXT, (WPARAM) 0, (LPARAM) tmpstr);
- sprintf (tmpstr, "Actual: %d x %d", workprefs.gfx_size.width, workprefs.gfx_size.height);
+ _stprintf (tmpstr, L"Actual: %d x %d", workprefs.gfx_size.width, workprefs.gfx_size.height);
SendMessage (GetDlgItem(hDlg, IDC_AVIOUTPUT_DIMENSIONS_STATIC), WM_SETTEXT, (WPARAM) 0, (LPARAM) tmpstr);
switch(avioutput_fps)
static void enable_for_avioutputdlg(HWND hDlg)
{
- char tmp[1000];
+ TCHAR tmp[1000];
#if defined (PROWIZARD)
ew (hDlg, IDC_PROWIZARD, TRUE);
if (full_property_sheet)
}
if (avioutput_audio == AVIAUDIO_WAV) {
- strcpy (tmp, "Wave (internal)");
+ _tcscpy (tmp, L"Wave (internal)");
} else {
- avioutput_audio = AVIOutput_GetAudioCodec (tmp, sizeof tmp);
+ avioutput_audio = AVIOutput_GetAudioCodec (tmp, sizeof tmp / sizeof (TCHAR));
}
if(!avioutput_audio) {
CheckDlgButton (hDlg, IDC_AVIOUTPUT_AUDIO, BST_UNCHECKED);
- WIN32GUI_LoadUIString (IDS_AVIOUTPUT_NOCODEC, tmp, sizeof tmp);
+ WIN32GUI_LoadUIString (IDS_AVIOUTPUT_NOCODEC, tmp, sizeof tmp / sizeof (TCHAR));
}
SetWindowText (GetDlgItem (hDlg, IDC_AVIOUTPUT_AUDIO_STATIC), tmp);
if (avioutput_audio != AVIAUDIO_WAV)
- avioutput_video = AVIOutput_GetVideoCodec (tmp, sizeof tmp);
+ avioutput_video = AVIOutput_GetVideoCodec (tmp, sizeof tmp / sizeof (TCHAR));
if(!avioutput_video) {
CheckDlgButton (hDlg, IDC_AVIOUTPUT_VIDEO, BST_UNCHECKED);
- WIN32GUI_LoadUIString (IDS_AVIOUTPUT_NOCODEC, tmp, sizeof tmp);
+ WIN32GUI_LoadUIString (IDS_AVIOUTPUT_NOCODEC, tmp, sizeof tmp / sizeof (TCHAR));
}
SetWindowText (GetDlgItem (hDlg, IDC_AVIOUTPUT_VIDEO_STATIC), tmp);
static INT_PTR CALLBACK AVIOutputDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int recursive = 0;
- char tmp[1000];
+ TCHAR tmp[1000];
switch(msg)
{
SendDlgItemMessage (hDlg, IDC_AVIOUTPUT_FPS, TBM_SETPOS, TRUE, avioutput_fps);
SendMessage (hDlg, WM_HSCROLL, (WPARAM) NULL, (LPARAM) NULL);
if (!avioutput_filename[0]) {
- fetch_path ("VideoPath", avioutput_filename, sizeof (avioutput_filename));
- strcat (avioutput_filename, "output.avi");
+ fetch_path (L"VideoPath", avioutput_filename, sizeof (avioutput_filename) / sizeof (TCHAR));
+ _tcscat (avioutput_filename, L"output.avi");
}
case WM_USER:
if (avioutput_enabled)
AVIOutput_End ();
if(IsDlgButtonChecked (hDlg, IDC_AVIOUTPUT_AUDIO) == BST_CHECKED) {
- avioutput_audio = AVIOutput_ChooseAudioCodec (hDlg, tmp, sizeof tmp);
+ avioutput_audio = AVIOutput_ChooseAudioCodec (hDlg, tmp, sizeof tmp / sizeof (TCHAR));
enable_for_avioutputdlg (hDlg);
} else {
avioutput_audio = 0;
if (avioutput_enabled)
AVIOutput_End ();
if(IsDlgButtonChecked (hDlg, IDC_AVIOUTPUT_VIDEO) == BST_CHECKED) {
- avioutput_video = AVIOutput_ChooseVideoCodec (hDlg, tmp, sizeof tmp);
+ avioutput_video = AVIOutput_ChooseVideoCodec (hDlg, tmp, sizeof tmp / sizeof (TCHAR));
if (avioutput_audio = AVIAUDIO_WAV)
avioutput_audio = 0;
enable_for_avioutputdlg (hDlg);
ofn.lpfnHook = NULL;
ofn.lpTemplateName = NULL;
ofn.lCustData = 0;
- ofn.lpstrFilter = "Video Clip (*.avi)\0*.avi\0Wave Sound (*.wav)\0";
+ ofn.lpstrFilter = L"Video Clip (*.avi)\0*.avi\0Wave Sound (*.wav)\0";
if(!GetSaveFileName (&ofn))
break;
if (ofn.nFilterIndex == 2) {
avioutput_audio = AVIAUDIO_WAV;
avioutput_video = 0;
- if (strlen (avioutput_filename) > 4 && !stricmp (avioutput_filename + strlen (avioutput_filename) - 4, ".avi"))
- strcpy (avioutput_filename + strlen (avioutput_filename) - 4, ".wav");
+ if (_tcslen (avioutput_filename) > 4 && !_tcsicmp (avioutput_filename + _tcslen (avioutput_filename) - 4, L".avi"))
+ _tcscpy (avioutput_filename + _tcslen (avioutput_filename) - 4, L".wav");
}
break;
}
HTREEITEM tv;
int himg;
int idx;
- const char *help;
+ const TCHAR *help;
HACCEL accel;
int fullpanel;
struct newresource *nres;
{
int i;
TOOLINFO ti;
- char tmp[MAX_DPATH];
- char *p;
+ TCHAR tmp[MAX_DPATH];
+ TCHAR *p;
LRESULT v;
if (GetParent (hwnd) != panelDlg)
}
}
tmp[0] = 0;
- SendMessage (hwnd, WM_GETTEXT, (WPARAM)sizeof (tmp), (LPARAM)tmp);
- p = strchr (tmp, '[');
- if (strlen (tmp) > 0 && p && strlen(p) > 2 && p[1] == ']') {
+ SendMessage (hwnd, WM_GETTEXT, (WPARAM)sizeof (tmp) / sizeof (TCHAR), (LPARAM)tmp);
+ p = _tcschr (tmp, '[');
+ if (_tcslen (tmp) > 0 && p && _tcslen (p) > 2 && p[1] == ']') {
int imageid = 0;
*p++ = 0;
*p++ = 0;
if (p[0] == ' ')
*p++;
if (p[0] == '#')
- imageid = atol (p + 1);
- tmp[strlen(tmp) - 1] = 0;
+ imageid = _tstol (p + 1);
+ tmp[_tcslen (tmp) - 1] = 0;
ti.cbSize = sizeof (TOOLINFO);
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
ti.hwnd = GetParent (hwnd);
}
return 1;
}
- p = strchr (tmp, ']');
- if (strlen (tmp) > 0 && p && strlen(p) > 2 && p[1] == '[') {
+ p = _tcschr (tmp, ']');
+ if (_tcslen (tmp) > 0 && p && _tcslen (p) > 2 && p[1] == '[') {
RECT r;
*p++ = 0;
*p++ = 0;
if (p[0] == ' ')
*p++;
- tmp[strlen(tmp) - 1] = 0;
+ tmp[_tcslen (tmp) - 1] = 0;
SendMessage (hwnd, WM_SETTEXT, 0, (LPARAM)tmp);
ti.cbSize = sizeof (TOOLINFO);
ti.uFlags = TTF_SUBCLASS;
LONG left, top;
left = r.left;
top = r.top;
- regsetint (NULL, "GUIPosX", left);
- regsetint (NULL, "GUIPosY", top);
+ regsetint (NULL, L"GUIPosX", left);
+ regsetint (NULL, L"GUIPosY", top);
}
}
ew (hDlg, IDHELP, FALSE);
static HTREEITEM CreateFolderNode (HWND TVhDlg, int nameid, HTREEITEM parent, int nodeid, int sub)
{
TVINSERTSTRUCT is;
- char txt[100];
+ TCHAR txt[100];
memset (&is, 0, sizeof (is));
is.hInsertAfter = TVI_LAST;
is.hParent = parent;
is.itemex.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- WIN32GUI_LoadUIString (nameid, txt, sizeof (txt));
+ WIN32GUI_LoadUIString (nameid, txt, sizeof (txt) / sizeof (TCHAR));
is.itemex.pszText = txt;
is.itemex.lParam = (LPARAM)(nodeid | (sub << 16));
is.itemex.iImage = C_PAGES;
is.hInsertAfter = TVI_LAST;
is.hParent = parent;
is.itemex.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- is.itemex.pszText = (char*)p->title;
+ is.itemex.pszText = (TCHAR*)p->title;
is.itemex.lParam = (LPARAM)p->idx;
is.itemex.iImage = p->himg;
is.itemex.iSelectedImage = is.itemex.iImage;
if (himl) {
HICON icon;
for (i = 0; i < C_PAGES; i++) {
- icon = LoadIcon (hInst, (LPCSTR)ppage[i].icon);
+ icon = LoadIcon (hInst, (LPCWSTR)ppage[i].icon);
ppage[i].himg = ImageList_AddIcon (himl, icon);
}
icon = LoadIcon (hInst, MAKEINTRESOURCE (IDI_ROOT));
if (owner == NULL)
owner = GetDesktopWindow ();
if (isfullscreen () <= 0) {
- regqueryint (NULL, "GUIPosX", &x);
- regqueryint (NULL, "GUIPosY", &y);
+ regqueryint (NULL, L"GUIPosX", &x);
+ regqueryint (NULL, L"GUIPosY", &y);
} else {
GetWindowRect (owner, &rcOwner);
GetWindowRect (hDlg, &rcDlg);
SetWindowPos (hDlg, HWND_TOP, x, y, 0, 0, SWP_NOSIZE);
}
-static int do_filesys_insert (const char *root)
+static int do_filesys_insert (const TCHAR *root)
{
if (filesys_insert (-1, NULL, root, 0, 0) == 0)
return filesys_media_change (root, 2, NULL);
int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage)
{
int cnt, i, drv, drvdrag, firstdrv, list;
- char file[MAX_DPATH];
+ TCHAR file[MAX_DPATH];
int dfxtext[] = { IDC_DF0TEXT, IDC_DF0TEXTQ, IDC_DF1TEXT, IDC_DF1TEXTQ, IDC_DF2TEXT, -1, IDC_DF3TEXT, -1 };
POINT pt;
RECT r, r2;
struct zfile *z;
int type = -1, zip = 0;
- DragQueryFile (hd, i, file, sizeof (file));
+ DragQueryFile (hd, i, file, sizeof (file) / sizeof (TCHAR));
flags = GetFileAttributes (file);
if (flags & FILE_ATTRIBUTE_DIRECTORY)
type = ZFILE_HDF;
if (type < 0) {
if (currentpage < 0) {
- z = zfile_fopen_nozip (file, "rb");
+ z = zfile_fopen_nozip (file, L"rb");
if (z) {
if (iszip (z))
zip = 1;
}
}
if (!zip) {
- z = zfile_fopen (file, "rb");
+ z = zfile_fopen (file, L"rb");
if (z) {
if (currentpage < 0 && iszip (z)) {
zip = 1;
list = 0;
while (list < MAX_SPARE_DRIVES) {
if (!prefs->dfxlist[list][0]) {
- strcpy (prefs->dfxlist[list], file);
+ _tcscpy (prefs->dfxlist[list], file);
break;
}
list++;
}
}
} else if (currentpage == HARDDISK_ID) {
- add_filesys_config (&workprefs, -1, NULL, "", file, 0,
+ add_filesys_config (&workprefs, -1, NULL, L"", file, 0,
0, 0, 0, 0, 0, NULL, 0, 0);
} else {
- strcpy (workprefs.df[drv], file);
+ _tcscpy (workprefs.df[drv], file);
disk_insert (drv, workprefs.df[drv]);
drv++;
if (drv >= (currentpage == QUICKSTART_ID ? 2 : 4))
case ZFILE_ROM:
if (rd) {
if (rd->type == ROMTYPE_KICK || rd->type == ROMTYPE_KICKCD32)
- strcpy (prefs->romfile, file);
+ _tcscpy (prefs->romfile, file);
if (rd->type == ROMTYPE_EXTCD32 || rd->type == ROMTYPE_EXTCDTV)
- strcpy (prefs->romextfile, file);
+ _tcscpy (prefs->romextfile, file);
if (rd->type == ROMTYPE_AR)
- strcpy (prefs->cartfile, file);
+ _tcscpy (prefs->cartfile, file);
} else {
- strcpy (prefs->romfile, file);
+ _tcscpy (prefs->romfile, file);
}
break;
case ZFILE_HDF:
if (!full_property_sheet && currentpage < 0)
do_filesys_insert (file);
else
- add_filesys_config (&workprefs, -1, NULL, "", file, 0,
+ add_filesys_config (&workprefs, -1, NULL, L"", file, 0,
0, 0, 0, 0, 0, NULL, 0, 0);
} else {
add_filesys_config (&workprefs, -1, NULL, NULL, file, 0,
0, 0, 0, 512, 0, NULL, 0, 0);
break;
case ZFILE_NVR:
- strcpy (prefs->flashfile, file);
+ _tcscpy (prefs->flashfile, file);
break;
case ZFILE_CONFIGURATION:
if (target_cfgfile_load (&workprefs, file, 0, 0)) {
break;
case ZFILE_STATEFILE:
savestate_state = STATE_DORESTORE;
- strcpy (savestate_fname, file);
+ _tcscpy (savestate_fname, file);
ret = 1;
break;
default:
if (currentpage < 0 && !full_property_sheet) {
do_filesys_insert (file);
} else if (currentpage == HARDDISK_ID) {
- add_filesys_config (&workprefs, -1, NULL, "", file, 0,
+ add_filesys_config (&workprefs, -1, NULL, L"", file, 0,
0, 0, 0, 0, 0, NULL, 0, 0);
} else {
rd = scan_arcadia_rom (file, 0);
if (rd) {
if (rd->type == ROMTYPE_ARCADIABIOS)
- strcpy (prefs->romextfile, file);
+ _tcscpy (prefs->romextfile, file);
else if (rd->type == ROMTYPE_ARCADIAGAME)
- strcpy (prefs->cartfile, file);
+ _tcscpy (prefs->cartfile, file);
}
}
break;
doit = 1;
} else if (pBHdr && pBHdr->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) {
DEV_BROADCAST_DEVICEINTERFACE *dbd = (DEV_BROADCAST_DEVICEINTERFACE*)lParam;
- write_log ("%s: %s\n", wParam == DBT_DEVICEREMOVECOMPLETE ? "Removed" : "Inserted",
+ write_log (L"%s: %s\n", wParam == DBT_DEVICEREMOVECOMPLETE ? "Removed" : "Inserted",
dbd->dbcc_name);
if (wParam == DBT_DEVICEREMOVECOMPLETE)
doit = 1;
guiDlg = hDlg;
SendMessage (hDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon (GetModuleHandle (NULL), MAKEINTRESOURCE(IDI_APPICON)));
if (full_property_sheet) {
- char tmp[100];
- WIN32GUI_LoadUIString (IDS_STARTEMULATION, tmp, sizeof (tmp));
+ TCHAR tmp[100];
+ WIN32GUI_LoadUIString (IDS_STARTEMULATION, tmp, sizeof (tmp) / sizeof (TCHAR));
SetWindowText (GetDlgItem (guiDlg, IDOK), tmp);
}
ShowWindow (GetDlgItem(guiDlg, IDC_RESTARTEMU), full_property_sheet ? SW_HIDE : SW_SHOW);
struct newresource *getresource (int tmpl)
{
- char rid[10];
+ TCHAR rid[10];
HRSRC hrsrc;
HGLOBAL res;
HINSTANCE inst = hUIDLL ? hUIDLL : hInst;
struct newresource *nr;
int size;
- sprintf (rid,"#%d", tmpl);
+ _stprintf (rid, L"#%d", tmpl);
hrsrc = FindResource (inst, rid, RT_DIALOG);
if (!hrsrc) {
inst = hInst;
}
static int init_page (int tmpl, int icon, int title,
- INT_PTR (CALLBACK FAR *func) (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam), ACCEL *accels, char *help)
+ INT_PTR (CALLBACK FAR *func) (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam), ACCEL *accels, TCHAR *help)
{
LPTSTR lpstrTitle;
static id = 0;
if (!init_called) {
first = 1;
panelresource = getresource (IDD_PANEL);
- LOADSAVE_ID = init_page (IDD_LOADSAVE, IDI_CONFIGFILE, IDS_LOADSAVE, LoadSaveDlgProc, NULL, "gui/configurations.htm");
- MEMORY_ID = init_page (IDD_MEMORY, IDI_MEMORY, IDS_MEMORY, MemoryDlgProc, NULL, "gui/ram.htm");
- KICKSTART_ID = init_page (IDD_KICKSTART, IDI_MEMORY, IDS_KICKSTART, KickstartDlgProc, NULL, "gui/rom.htm");
- CPU_ID = init_page (IDD_CPU, IDI_CPU, IDS_CPU, CPUDlgProc, NULL, "gui/cpu.htm");
- DISPLAY_ID = init_page (IDD_DISPLAY, IDI_DISPLAY, IDS_DISPLAY, DisplayDlgProc, NULL, "gui/display.htm");
+ LOADSAVE_ID = init_page (IDD_LOADSAVE, IDI_CONFIGFILE, IDS_LOADSAVE, LoadSaveDlgProc, NULL, L"gui/configurations.htm");
+ MEMORY_ID = init_page (IDD_MEMORY, IDI_MEMORY, IDS_MEMORY, MemoryDlgProc, NULL, L"gui/ram.htm");
+ KICKSTART_ID = init_page (IDD_KICKSTART, IDI_MEMORY, IDS_KICKSTART, KickstartDlgProc, NULL, L"gui/rom.htm");
+ CPU_ID = init_page (IDD_CPU, IDI_CPU, IDS_CPU, CPUDlgProc, NULL, L"gui/cpu.htm");
+ DISPLAY_ID = init_page (IDD_DISPLAY, IDI_DISPLAY, IDS_DISPLAY, DisplayDlgProc, NULL, L"gui/display.htm");
#if defined (GFXFILTER)
- HW3D_ID = init_page (IDD_FILTER, IDI_DISPLAY, IDS_FILTER, hw3dDlgProc, NULL, "gui/filter.htm");
+ HW3D_ID = init_page (IDD_FILTER, IDI_DISPLAY, IDS_FILTER, hw3dDlgProc, NULL, L"gui/filter.htm");
#endif
- CHIPSET_ID = init_page (IDD_CHIPSET, IDI_CPU, IDS_CHIPSET, ChipsetDlgProc, NULL, "gui/chipset.htm");
- CHIPSET2_ID = init_page (IDD_CHIPSET2, IDI_CPU, IDS_CHIPSET2, ChipsetDlgProc2, NULL, "gui/chipset.htm");
- SOUND_ID = init_page (IDD_SOUND, IDI_SOUND, IDS_SOUND, SoundDlgProc, NULL, "gui/sound.htm");
- FLOPPY_ID = init_page (IDD_FLOPPY, IDI_FLOPPY, IDS_FLOPPY, FloppyDlgProc, NULL, "gui/floppies.htm");
- DISK_ID = init_page (IDD_DISK, IDI_FLOPPY, IDS_DISK, SwapperDlgProc, SwapperAccel, "gui/disk.htm");
+ CHIPSET_ID = init_page (IDD_CHIPSET, IDI_CPU, IDS_CHIPSET, ChipsetDlgProc, NULL, L"gui/chipset.htm");
+ CHIPSET2_ID = init_page (IDD_CHIPSET2, IDI_CPU, IDS_CHIPSET2, ChipsetDlgProc2, NULL, L"gui/chipset.htm");
+ SOUND_ID = init_page (IDD_SOUND, IDI_SOUND, IDS_SOUND, SoundDlgProc, NULL, L"gui/sound.htm");
+ FLOPPY_ID = init_page (IDD_FLOPPY, IDI_FLOPPY, IDS_FLOPPY, FloppyDlgProc, NULL, L"gui/floppies.htm");
+ DISK_ID = init_page (IDD_DISK, IDI_FLOPPY, IDS_DISK, SwapperDlgProc, SwapperAccel, L"gui/disk.htm");
#ifdef FILESYS
- HARDDISK_ID = init_page (IDD_HARDDISK, IDI_HARDDISK, IDS_HARDDISK, HarddiskDlgProc, HarddiskAccel, "gui/hard-drives.htm");
+ HARDDISK_ID = init_page (IDD_HARDDISK, IDI_HARDDISK, IDS_HARDDISK, HarddiskDlgProc, HarddiskAccel, L"gui/hard-drives.htm");
#endif
- GAMEPORTS_ID = init_page (IDD_GAMEPORTS, IDI_GAMEPORTS, IDS_GAMEPORTS, GamePortsDlgProc, NULL, "gui/gameports.htm");
- IOPORTS_ID = init_page (IDD_IOPORTS, IDI_IOPORTS, IDS_IOPORTS, IOPortsDlgProc, NULL, "gui/ioports.htm");
- INPUT_ID = init_page (IDD_INPUT, IDI_INPUT, IDS_INPUT, InputDlgProc, NULL, "gui/input.htm");
- MISC1_ID = init_page (IDD_MISC1, IDI_MISC1, IDS_MISC1, MiscDlgProc1, NULL, "gui/misc.htm");
- MISC2_ID = init_page (IDD_MISC2, IDI_MISC2, IDS_MISC2, MiscDlgProc2, NULL, "gui/misc2.htm");
+ GAMEPORTS_ID = init_page (IDD_GAMEPORTS, IDI_GAMEPORTS, IDS_GAMEPORTS, GamePortsDlgProc, NULL, L"gui/gameports.htm");
+ IOPORTS_ID = init_page (IDD_IOPORTS, IDI_IOPORTS, IDS_IOPORTS, IOPortsDlgProc, NULL, L"gui/ioports.htm");
+ INPUT_ID = init_page (IDD_INPUT, IDI_INPUT, IDS_INPUT, InputDlgProc, NULL, L"gui/input.htm");
+ MISC1_ID = init_page (IDD_MISC1, IDI_MISC1, IDS_MISC1, MiscDlgProc1, NULL, L"gui/misc.htm");
+ MISC2_ID = init_page (IDD_MISC2, IDI_MISC2, IDS_MISC2, MiscDlgProc2, NULL, L"gui/misc2.htm");
#ifdef AVIOUTPUT
- AVIOUTPUT_ID = init_page (IDD_AVIOUTPUT, IDI_AVIOUTPUT, IDS_AVIOUTPUT, AVIOutputDlgProc, NULL, "gui/output.htm");
+ AVIOUTPUT_ID = init_page (IDD_AVIOUTPUT, IDI_AVIOUTPUT, IDS_AVIOUTPUT, AVIOutputDlgProc, NULL, L"gui/output.htm");
#endif
- PATHS_ID = init_page (IDD_PATHS, IDI_PATHS, IDS_PATHS, PathsDlgProc, NULL, "gui/paths.htm");
- QUICKSTART_ID = init_page (IDD_QUICKSTART, IDI_QUICKSTART, IDS_QUICKSTART, QuickstartDlgProc, NULL, "gui/quickstart.htm");
+ PATHS_ID = init_page (IDD_PATHS, IDI_PATHS, IDS_PATHS, PathsDlgProc, NULL, L"gui/paths.htm");
+ QUICKSTART_ID = init_page (IDD_QUICKSTART, IDI_QUICKSTART, IDS_QUICKSTART, QuickstartDlgProc, NULL, L"gui/quickstart.htm");
ABOUT_ID = init_page (IDD_ABOUT, IDI_ABOUT, IDS_ABOUT, AboutDlgProc, NULL, NULL);
FRONTEND_ID = init_page (IDD_FRONTEND, IDI_QUICKSTART, IDS_FRONTEND, AboutDlgProc, NULL, NULL);
C_PAGES = FRONTEND_ID + 1;
hAccelTable = NULL;
DragAcceptFiles (hwnd, TRUE);
if (first)
- write_log ("Entering GUI idle loop\n");
+ write_log (L"Entering GUI idle loop\n");
scaleresource_setmaxsize (800, 600);
tres = scaleresource (panelresource, hwnd);
{
}
-void gui_disk_image_change (int unitnum, const char *name)
+void gui_disk_image_change (int unitnum, const TCHAR *name)
{
#ifdef RETROPLATFORM
rp_disk_image_change (unitnum, name);
void gui_led (int led, int on)
{
WORD type;
- static char drive_text[NUM_LEDS * 16];
- static char dfx[4][300];
- char *ptr, *tt, *p;
+ static TCHAR drive_text[NUM_LEDS * 16];
+ static TCHAR dfx[4][300];
+ TCHAR *ptr, *tt, *p;
int pos = -1, j;
int writing = 0;
pos = 6 + (led - 1);
ptr = drive_text + pos * 16;
if (gui_data.drive_disabled[led - 1])
- strcpy (ptr, "");
+ _tcscpy (ptr, L"");
else
- sprintf (ptr , "%02d .", gui_data.drive_track[led - 1]);
+ _stprintf (ptr , L"%02d .", gui_data.drive_track[led - 1]);
p = gui_data.df[led - 1];
- j = strlen (p) - 1;
+ j = _tcslen (p) - 1;
if (j < 0)
j = 0;
while (j > 0) {
}
tt = dfx[led - 1];
tt[0] = 0;
- if (strlen (p + j) > 0)
- sprintf (tt, "%s [CRC=%08X]", p + j, gui_data.crc32[led - 1]);
+ if (_tcslen (p + j) > 0)
+ _stprintf (tt, L"%s [CRC=%08X]", p + j, gui_data.crc32[led - 1]);
} else if (led == 0) {
pos = 3;
- ptr = strcpy (drive_text + pos * 16, "Power");
+ ptr = _tcscpy (drive_text + pos * 16, L"Power");
} else if (led == 5) {
pos = 4;
- ptr = strcpy (drive_text + pos * 16, "HD");
+ ptr = _tcscpy (drive_text + pos * 16, L"HD");
} else if (led == 6) {
pos = 5;
- ptr = strcpy (drive_text + pos * 16, "CD");
+ ptr = _tcscpy (drive_text + pos * 16, L"CD");
} else if (led == 7) {
extern int p96vblank;
pos = 2;
ptr = drive_text + pos * 16;
if (picasso_on)
- sprintf (ptr, "%d [%.1f]", p96vblank, (double)(gui_data.fps / 10.0));
+ _stprintf (ptr, L"%d [%.1f]", p96vblank, (double)(gui_data.fps / 10.0));
else
- sprintf (ptr, "FPS: %.1f", (double)(gui_data.fps / 10.0));
+ _stprintf (ptr, L"FPS: %.1f", (double)(gui_data.fps / 10.0));
if (pause_emulation)
- strcpy (ptr, "PAUSED");
+ _tcscpy (ptr, L"PAUSED");
} else if (led == 8) {
pos = 1;
ptr = drive_text + pos * 16;
- sprintf (ptr, "CPU: %.0f%%", (double)((gui_data.idle) / 10.0));
+ _stprintf (ptr, L"CPU: %.0f%%", (double)((gui_data.idle) / 10.0));
} else if (led == 9) {
pos = 0;
ptr = drive_text + pos * 16;
if (gui_data.sndbuf_status < 3) {
- sprintf (ptr, "SND: %+.0f%%", (double)((gui_data.sndbuf) / 10.0));
+ _stprintf (ptr, L"SND: %+.0f%%", (double)((gui_data.sndbuf) / 10.0));
} else {
- strcpy (ptr, "SND: -");
+ _tcscpy (ptr, L"SND: -");
on = 0;
}
}
}
}
-void gui_filename (int num, const char *name)
+void gui_filename (int num, const TCHAR *name)
{
}
return 0;
hr = DirectDraw_FlipToGDISurface ();
if (FAILED (hr))
- write_log ("FlipToGDISurface failed, %s\n", DXError (hr));
+ write_log (L"FlipToGDISurface failed, %s\n", DXError (hr));
*flags |= MB_SETFOREGROUND;
*flags |= MB_TOPMOST;
return 0;
HRESULT hr;
hr = DirectDraw_FlipToGDISurface();
if (FAILED(hr)) {
- write_log ("FlipToGDISurface failed, %s\n", DXError (hr));
+ write_log (L"FlipToGDISurface failed, %s\n", DXError (hr));
return 0;
}
*hwnd = NULL;
*/
}
-int gui_message_multibutton (int flags, const char *format,...)
+int gui_message_multibutton (int flags, const TCHAR *format,...)
{
- char msg[2048];
- char szTitle[MAX_DPATH];
+ TCHAR msg[2048];
+ TCHAR szTitle[MAX_DPATH];
va_list parms;
int flipflop = 0;
int fullscreen = 0;
- int focuso = focus;
+ int focuso = isfocus ();
int mbflags, ret;
HWND hwnd;
ShowWindow (hAmigaWnd, SW_MINIMIZE);
va_start (parms, format);
- vsprintf (msg, format, parms);
+ _vstprintf (msg, format, parms);
va_end (parms);
write_log (msg);
- if (msg[strlen (msg)-1]!='\n')
- write_log ("\n");
+ if (msg[_tcslen (msg) - 1]!='\n')
+ write_log (L"\n");
WIN32GUI_LoadUIString (IDS_ERRORTITLE, szTitle, MAX_DPATH);
ShowWindow (hAmigaWnd, SW_RESTORE);
resume_sound ();
- setmouseactive (focuso);
+ setmouseactive (focuso > 0 ? 1 : 0);
if (ret == IDOK)
return 0;
if (ret == IDYES)
return 0;
}
-void gui_message (const char *format,...)
+void gui_message (const TCHAR *format,...)
{
- char msg[2048];
- char szTitle[MAX_DPATH];
+ TCHAR msg[2048];
+ TCHAR szTitle[MAX_DPATH];
va_list parms;
int flipflop = 0;
int fullscreen = 0;
- int focuso = focus;
+ int focuso = isfocus ();
DWORD flags = MB_OK | MB_TASKMODAL;
HWND hwnd;
va_start (parms, format);
- vsprintf (msg, format, parms);
+ _vstprintf (msg, format, parms);
va_end (parms);
if (full_property_sheet) {
pre_gui_message (msg);
ShowWindow (hAmigaWnd, SW_MINIMIZE);
write_log (msg);
- if (msg[strlen(msg) - 1] != '\n')
- write_log ("\n");
+ if (msg[_tcslen (msg) - 1] != '\n')
+ write_log (L"\n");
WIN32GUI_LoadUIString (IDS_ERRORTITLE, szTitle, MAX_DPATH);
if (!MessageBox (hwnd, msg, szTitle, flags))
- write_log ("MessageBox(%s) failed, err=%d\n", msg, GetLastError());
+ write_log (L"MessageBox(%s) failed, err=%d\n", msg, GetLastError());
if (flipflop)
ShowWindow (hAmigaWnd, SW_RESTORE);
resume_sound ();
- setmouseactive (focuso);
+ setmouseactive (focuso > 0 ? 1 : 0);
}
void gui_message_id (int id)
{
- char msg[MAX_DPATH];
- WIN32GUI_LoadUIString (id, msg, sizeof (msg));
+ TCHAR msg[MAX_DPATH];
+ WIN32GUI_LoadUIString (id, msg, sizeof (msg) / sizeof (TCHAR));
gui_message (msg);
}
-void pre_gui_message (const char *format,...)
+void pre_gui_message (const TCHAR *format,...)
{
- char msg[2048];
- char szTitle[MAX_DPATH];
+ TCHAR msg[2048];
+ TCHAR szTitle[MAX_DPATH];
va_list parms;
va_start (parms, format);
- vsprintf (msg, format, parms);
+ _vstprintf (msg, format, parms);
va_end (parms);
write_log (msg);
- if (msg[strlen (msg)-1]!='\n')
- write_log ("\n");
+ if (msg[_tcslen (msg) - 1] != '\n')
+ write_log (L"\n");
WIN32GUI_LoadUIString (IDS_ERRORTITLE, szTitle, MAX_DPATH);
- strcat (szTitle, BetaStr);
+ _tcscat (szTitle, BetaStr);
MessageBox (guiDlg, msg, szTitle, MB_OK | MB_TASKMODAL | MB_SETFOREGROUND);
}
void notify_user (int msg)
{
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
int c = 0;
c = gettranslation (msg);
gui_message (tmp);
}
-void notify_user_parms (int msg, const char *parms, ...)
+void notify_user_parms (int msg, const TCHAR *parms, ...)
{
- char msgtxt[MAX_DPATH];
- char tmp[MAX_DPATH];
+ TCHAR msgtxt[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
int c = 0;
va_list parms2;
return;
WIN32GUI_LoadUIString (c, tmp, MAX_DPATH);
va_start (parms2, parms);
- vsprintf (msgtxt, tmp, parms2);
+ _vstprintf (msgtxt, tmp, parms2);
gui_message (msgtxt);
- va_end (parms);
+ va_end (parms2);
}
-int translate_message (int msg, char *out)
+int translate_message (int msg, TCHAR *out)
{
msg = gettranslation (msg);
out[0] = 0;
#define CONFIG_LOAD_FULL 3
#define CONFIG_DELETE 4
-void WIN32GUI_LoadUIString (DWORD id, char *string, DWORD dwStringLen);
-extern int DiskSelection (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, char *);
+void WIN32GUI_LoadUIString (DWORD id, TCHAR *string, DWORD dwStringLen);
+extern int DiskSelection (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, TCHAR *);
void InitializeListView (HWND hDlg);
-extern void pre_gui_message (const char*,...);
+extern void pre_gui_message (const TCHAR*,...);
extern void gui_message_id (int id);
int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage);
UAEREG *read_disk_history (void);
extern HWND CustomCreateDialog (int templ, HWND hDlg, DLGPROC proc);
extern INT_PTR CustomDialogBox (int templ, HWND hDlg, DLGPROC proc);
extern struct newresource *getresource(int tmpl);
-extern struct newresource *resourcefont(struct newresource*, char *font, int size);
+extern struct newresource *resourcefont(struct newresource*, TCHAR *font, int size);
#endif
static wchar_t wfont_vista[] = L"Segoe UI";
static wchar_t wfont_xp[] = L"Tahoma";
static wchar_t wfont_old[] = L"MS Sans Serif";
-static char font_vista[] = "Segoe UI";
-static char font_xp[] = "Tahoma";
+static TCHAR font_vista[] = L"Segoe UI";
+static TCHAR font_xp[] = L"Tahoma";
-static BYTE *skiptext(BYTE *s)
+static BYTE *skiptext (BYTE *s)
{
if (s[0] == 0xff && s[1] == 0xff) {
s += 4;
return s;
}
-static BYTE *todword(BYTE *p)
+static BYTE *todword (BYTE *p)
{
while ((LONG_PTR)p & 3)
p++;
return p;
}
-static void modifytemplate(DLGTEMPLATEEX *d, DLGTEMPLATEEX_END *d2, int id, int mult)
+static void modifytemplate (DLGTEMPLATEEX *d, DLGTEMPLATEEX_END *d2, int id, int mult)
{
d->cx = d->cx * mult / 100;
d->cy = d->cy * mult / 100;
}
-static void modifytemplatefont(DLGTEMPLATEEX *d, DLGTEMPLATEEX_END *d2)
+static void modifytemplatefont (DLGTEMPLATEEX *d, DLGTEMPLATEEX_END *d2)
{
wchar_t *p = NULL;
wcscpy (d2->typeface, p);
}
-static void modifyitem(DLGTEMPLATEEX *d, DLGTEMPLATEEX_END *d2, DLGITEMTEMPLATEEX *dt, int id, int mult)
+static void modifyitem (DLGTEMPLATEEX *d, DLGTEMPLATEEX_END *d2, DLGITEMTEMPLATEEX *dt, int id, int mult)
{
dt->cy = dt->cy * mult / 100;
dt->cx = dt->cx * mult / 100;
dt->x = dt->x * mult / 100;
}
-static INT_PTR CALLBACK DummyProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK DummyProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
return FALSE;
}
-struct newresource *scaleresource(struct newresource *res, HWND parent)
+struct newresource *scaleresource (struct newresource *res, HWND parent)
{
DLGTEMPLATEEX *d;
DLGTEMPLATEEX_END *d2;
d = ns->resource;
d2 = ns->resource;
p = (BYTE*)d + sizeof (DLGTEMPLATEEX);
- p = skiptext(p);
- p = skiptext(p);
- p = skiptext(p);
+ p = skiptext (p);
+ p = skiptext (p);
+ p = skiptext (p);
d2 = (DLGTEMPLATEEX_END*)p;
p2 = p;
p2 += sizeof (DLGTEMPLATEEX_END);
- p2 = skiptext(p2);
- p2 = todword(p2);
+ p2 = skiptext (p2);
+ p2 = todword (p2);
- modifytemplatefont(d, d2);
+ modifytemplatefont (d, d2);
p += sizeof (DLGTEMPLATEEX_END);
- p = skiptext(p);
- p = todword(p);
+ p = skiptext (p);
+ p = todword (p);
if (p != p2)
memmove (p, p2, ns->size - (p2 - (BYTE*)ns->resource));
for (i = 0; i < d->cDlgItems; i++) {
dt = (DLGITEMTEMPLATEEX*)p;
- modifyitem(d, d2, dt, ns->tmpl, mult);
+ modifyitem (d, d2, dt, ns->tmpl, mult);
p += sizeof (DLGITEMTEMPLATEEX);
p = skiptext(p);
p = skiptext(p);
p += ((WORD*)p)[0];
p += sizeof (WORD);
- p = todword(p);
+ p = todword (p);
}
ns->width = d->cx;
return ns;
}
-void freescaleresource(struct newresource *ns)
+void freescaleresource (struct newresource *ns)
{
xfree (ns->resource);
xfree (ns);
}
-void scaleresource_setmaxsize(int w, int h)
+void scaleresource_setmaxsize (int w, int h)
{
if (os_vista)
font_vista_ok = 1;
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
AdditionalOptions=""
Optimization="0"
AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep,..\..\prowizard\include,..\tun"
- PreprocessorDefinitions="WINVER=0x0500,_DEBUG,WIN32_IE=0x0700;WIN32;CINTERFACE;COBJMACROS"
+ PreprocessorDefinitions="WINVER=0x0500,_DEBUG,WIN32_IE=0x0700;WIN32;CINTERFACE;COBJMACROS;_CRT_SECURE_NO_WARNINGS"
GeneratePreprocessedFile="0"
KeepComments="false"
ExceptionHandling="0"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
OmitFramePointers="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep,..\..\prowizard\include"
- PreprocessorDefinitions="WINVER=0x0500;NDEBUG;_WIN32_IE=0x0501;WIN32;CINTERFACE;COBJMACROS"
+ PreprocessorDefinitions="WINVER=0x0500;NDEBUG;_WIN32_IE=0x0700;WIN32;CINTERFACE;COBJMACROS"
StringPooling="true"
ExceptionHandling="0"
BasicRuntimeChecks="0"
RelativePath="..\sounddep\sound.c"
>
</File>
+ <File
+ RelativePath="..\unicode.c"
+ >
+ </File>
<File
RelativePath="..\win32.c"
>
+Beta 15:
+
+- WinUAE is now native unicode application (internally all strings are
+ NT native UTF16-LE format instead of 8-bit "ANSI")
+ What does this mean?
+ - lots of breakage possible, size of one byte = size of one character
+ isn't true anymore and finding all cases is difficult. Report all
+ mysterious crashes (they are usually easily duplicated)
+ - Windows<>Amiga directory filesystem character set conversion can
+ be configured (Windows "code page" may not match Amiga charset =
+ "special" characters should work better now. Default is CP 1252 which
+ is functionally identical to Amiga standard ISO-8859-1)
+ - logs and configuration.cache are UTF-8 formatted (UTF-8 is more
+ human readable than UTF-16), "old" charset supported
+ - log window supports unicode now, no more weird characters in
+ (for example) device names containing national characters
+ - configuration files are still in old format (would cause too many
+ problems with old versions and front ends..)
+ - I simply wanted to do this when I dropped 98/ME support but I wasn't
+ ready until now. (also most new Vista+ APIs are unicode only,
+ converting between ansi<>unicode was getting too annoying)
+
+- ACTION_EXAMINE_ALL was quite broken, it always returned full directory
+ entry data (wrong variable used..) Most (all) programs didn't care.
+- "not implemented error" filesystem warning is now shown to user
+ (nobody apparently noticed it in the log = I can never fix it..)
+- directory filesystem >2G files are shown as 2G minus 1 byte (instead
+ of truncating to 32-bit and showing negative or other random sizes),
+ >4G files internally supported
+- directory filesystem ACTION_CHANGE_FILE_POSITION64,
+ ACTION_GET_FILE_POSITION64, ACTION_CHANGE_FILE_SIZE64 and
+ ACTION_GET_FILE_SIZE64 implemented (OS4+ packets but also supported
+ by 68k SFS2)
+- ignore all input events (except activation events or if mousehack
+ is enabled) if no focus and not active (previously only focus was
+ required)
+
Beta 14:
- filter out PortAudio DS and MME drivers (useless duplication only)
GETCONSOLEWINDOW pGetConsoleWindow;
/* Windows 2000 or newer only */
pGetConsoleWindow = (GETCONSOLEWINDOW)GetProcAddress (
- GetModuleHandle ("kernel32.dll"), "GetConsoleWindow");
+ GetModuleHandle (L"kernel32.dll"), "GetConsoleWindow");
if (pGetConsoleWindow)
return pGetConsoleWindow ();
return NULL;
AllocConsole();
stdinput = GetStdHandle (STD_INPUT_HANDLE);
stdoutput = GetStdHandle (STD_OUTPUT_HANDLE);
- SetConsoleMode (stdinput,ENABLE_PROCESSED_INPUT|ENABLE_LINE_INPUT|ENABLE_ECHO_INPUT|ENABLE_PROCESSED_OUTPUT);
+ SetConsoleMode (stdinput, ENABLE_PROCESSED_INPUT|ENABLE_LINE_INPUT|ENABLE_ECHO_INPUT|ENABLE_PROCESSED_OUTPUT);
+ SetConsoleCP (65001);
+ SetConsoleOutputCP (65001);
consoleopen = -1;
reopen_console ();
}
if (consoleopen > 0 || debuggerinitializing)
return;
if (debugger_type < 0) {
- regqueryint (NULL, "DebuggerType", &debugger_type);
+ regqueryint (NULL, L"DebuggerType", &debugger_type);
if (debugger_type <= 0)
debugger_type = 2;
openconsole();
debugger_type = mode;
if (debugger_type != 1 && debugger_type != 2)
debugger_type = 2;
- regsetint (NULL, "DebuggerType", debugger_type);
+ regsetint (NULL, L"DebuggerType", debugger_type);
openconsole ();
}
if (hwnd) {
int newpos = 1;
LONG x, y, w, h;
- if (!regqueryint (NULL, "LoggerPosX", &x))
+ if (!regqueryint (NULL, L"LoggerPosX", &x))
newpos = 0;
- if (!regqueryint (NULL, "LoggerPosY", &y))
+ if (!regqueryint (NULL, L"LoggerPosY", &y))
newpos = 0;
- if (!regqueryint (NULL, "LoggerPosW", &w))
+ if (!regqueryint (NULL, L"LoggerPosW", &w))
newpos = 0;
- if (!regqueryint (NULL, "LoggerPosH", &h))
+ if (!regqueryint (NULL, L"LoggerPosH", &h))
newpos = 0;
if (newpos) {
RECT rc;
if (GetWindowRect (hwnd, &r)) {
r.bottom -= r.top;
r.right -= r.left;
- regsetint (NULL, "LoggerPosX", r.left);
- regsetint (NULL, "LoggerPosY", r.top);
- regsetint (NULL, "LoggerPosW", r.right);
- regsetint (NULL, "LoggerPosH", r.bottom);
+ regsetint (NULL, L"LoggerPosX", r.left);
+ regsetint (NULL, L"LoggerPosY", r.top);
+ regsetint (NULL, L"LoggerPosW", r.right);
+ regsetint (NULL, L"LoggerPosH", r.bottom);
}
}
FreeConsole ();
consoleopen = 0;
}
-static void writeconsole (const char *buffer)
+static void writeconsole (const TCHAR *buffer)
{
DWORD temp;
if (!consoleopen)
openconsole();
if (consoleopen > 0)
- WriteOutput (buffer, strlen(buffer));
+ WriteOutput (buffer, _tcslen(buffer));
else if (consoleopen < 0)
- WriteConsole (stdoutput, buffer, strlen (buffer), &temp,0);
+ WriteConsole (stdoutput, buffer, _tcslen (buffer), &temp,0);
}
-void console_out_f (const char *format,...)
+void console_out_f (const TCHAR *format,...)
{
va_list parms;
- char buffer[WRITE_LOG_BUF_SIZE];
+ TCHAR buffer[WRITE_LOG_BUF_SIZE];
va_start (parms, format);
- _vsnprintf (buffer, WRITE_LOG_BUF_SIZE-1, format, parms);
+ _vsntprintf (buffer, WRITE_LOG_BUF_SIZE - 1, format, parms);
va_end (parms);
openconsole ();
writeconsole (buffer);
}
-void console_out (const char *txt)
+void console_out (const TCHAR *txt)
{
openconsole ();
writeconsole (txt);
}
-int console_get (char *out, int maxlen)
+int console_get (TCHAR *out, int maxlen)
{
*out = 0;
if (consoleopen > 0) {
static int lfdetected = 1;
-static char *writets (void)
+static TCHAR *writets (void)
{
struct tm *t;
struct _timeb tb;
- static char out[100];
- char *p;
- static char lastts[100];
- char curts[100];
+ static TCHAR out[100];
+ TCHAR *p;
+ static TCHAR lastts[100];
+ TCHAR curts[100];
if (bootlogmode)
return NULL;
_ftime(&tb);
t = localtime (&tb.time);
- strftime (curts, sizeof curts, "%Y-%m-%d %H:%M:%S\n", t);
+ _tcsftime (curts, sizeof curts / sizeof (TCHAR), L"%Y-%m-%d %H:%M:%S\n", t);
p = out;
*p = 0;
- if (memcmp (curts, lastts, strlen (curts))) {
- strcat (p, curts);
- p += strlen (p);
- strcpy (lastts, curts);
+ if (!_tcsncmp (curts, lastts, _tcslen (curts))) {
+ _tcscat (p, curts);
+ p += _tcslen (p);
+ _tcscpy (lastts, curts);
}
- strftime (p, sizeof out - (p - out) , "%S-", t);
- p += strlen (p);
- sprintf (p, "%03d", tb.millitm);
- p += strlen (p);
+ _tcsftime (p, sizeof out / sizeof (TCHAR) - (p - out) , L"%S-", t);
+ p += _tcslen (p);
+ _stprintf (p, L"%03d", tb.millitm);
+ p += _tcslen (p);
if (timeframes || vpos > 0 && current_hpos () > 0)
- sprintf (p, " [%d %03dx%03d]", timeframes, current_hpos (), vpos);
- strcat (p, ": ");
+ _stprintf (p, L" [%d %03dx%03d]", timeframes, current_hpos (), vpos);
+ _tcscat (p, L": ");
return out;
}
-void write_dlog (const char *format, ...)
+void write_dlog (const TCHAR *format, ...)
{
int count;
- char buffer[WRITE_LOG_BUF_SIZE];
- char *ts;
+ TCHAR buffer[WRITE_LOG_BUF_SIZE];
+ TCHAR *ts;
va_list parms;
if (!SHOW_CONSOLE && !console_logging && !debugfile)
EnterCriticalSection (&cs);
va_start (parms, format);
- count = _vsnprintf(buffer, WRITE_LOG_BUF_SIZE-1, format, parms);
+ count = _vsntprintf (buffer, WRITE_LOG_BUF_SIZE - 1, format, parms);
ts = writets ();
if (SHOW_CONSOLE || console_logging) {
if (lfdetected && ts)
}
if (debugfile) {
if (lfdetected && ts)
- fprintf (debugfile, ts);
- fprintf (debugfile, buffer);
+ _ftprintf (debugfile, ts);
+ _ftprintf (debugfile, buffer);
}
lfdetected = 0;
- if (strlen (buffer) > 0 && buffer[strlen(buffer) - 1] == '\n')
+ if (_tcslen (buffer) > 0 && buffer[_tcslen(buffer) - 1] == '\n')
lfdetected = 1;
va_end (parms);
LeaveCriticalSection (&cs);
}
-void write_log (const char *format, ...)
+void write_log (const TCHAR *format, ...)
{
int count;
- char buffer[WRITE_LOG_BUF_SIZE], *ts;
+ TCHAR buffer[WRITE_LOG_BUF_SIZE], *ts;
int bufsize = WRITE_LOG_BUF_SIZE;
- char *bufp;
+ TCHAR *bufp;
va_list parms;
- EnterCriticalSection(&cs);
+ EnterCriticalSection (&cs);
va_start(parms, format);
bufp = buffer;
for (;;) {
- count = _vsnprintf(bufp, bufsize - 1, format, parms);
+ count = _vsntprintf (bufp, bufsize - 1, format, parms);
if (count < 0) {
bufsize *= 10;
if (bufp != buffer)
break;
}
bufp[bufsize - 1] = 0;
- if (!memcmp (bufp, "write ",6))
+ if (!_tcsncmp (bufp, L"write ", 6))
bufsize--;
ts = writets ();
if (bufp[0] == '*')
}
if (debugfile) {
if (lfdetected && ts)
- fprintf (debugfile, ts);
- fprintf (debugfile, bufp);
+ _ftprintf (debugfile, ts);
+ _ftprintf (debugfile, bufp);
}
lfdetected = 0;
- if (strlen (bufp) > 0 && bufp[strlen(bufp) - 1] == '\n')
+ if (_tcslen (bufp) > 0 && bufp[_tcslen(bufp) - 1] == '\n')
lfdetected = 1;
va_end (parms);
if (bufp != buffer)
xfree (bufp);
if (always_flush_log)
flush_log ();
- LeaveCriticalSection(&cs);
+ LeaveCriticalSection (&cs);
}
void flush_log (void)
fflush (debugfile);
}
-void f_out (void *f, const char *format, ...)
+void f_out (void *f, const TCHAR *format, ...)
{
int count;
- char buffer[WRITE_LOG_BUF_SIZE];
+ TCHAR buffer[WRITE_LOG_BUF_SIZE];
va_list parms;
va_start (parms, format);
if (f == NULL)
return;
- count = _vsnprintf (buffer, WRITE_LOG_BUF_SIZE - 1, format, parms);
+ count = _vsntprintf (buffer, WRITE_LOG_BUF_SIZE - 1, format, parms);
openconsole ();
writeconsole (buffer);
va_end (parms);
}
-char* buf_out (char *buffer, int *bufsize, const char *format, ...)
+TCHAR* buf_out (TCHAR *buffer, int *bufsize, const TCHAR *format, ...)
{
int count;
va_list parms;
if (buffer == NULL)
return 0;
- count = _vsnprintf (buffer, (*bufsize)-1, format, parms);
+ count = _vsntprintf (buffer, (*bufsize)-1, format, parms);
va_end (parms);
- *bufsize -= strlen (buffer);
- return buffer + strlen (buffer);
+ *bufsize -= _tcslen (buffer);
+ return buffer + _tcslen (buffer);
}
-void *log_open (const char *name, int append, int bootlog)
+void *log_open (const TCHAR *name, int append, int bootlog)
{
FILE *f;
- f = fopen (name, append ? "a" : "wt");
+ f = _tfopen (name, append ? L"a, ccs=UTF-8" : L"wt, ccs=UTF-8");
bootlogmode = bootlog;
if (!cs_init)
InitializeCriticalSection (&cs);
fclose (f);
}
-void jit_abort (const char *format,...)
+void jit_abort (const TCHAR *format,...)
{
static int happened;
int count;
- char buffer[WRITE_LOG_BUF_SIZE];
+ TCHAR buffer[WRITE_LOG_BUF_SIZE];
va_list parms;
va_start (parms, format);
- count = _vsnprintf (buffer, WRITE_LOG_BUF_SIZE - 1, format, parms);
+ count = _vsntprintf (buffer, WRITE_LOG_BUF_SIZE - 1, format, parms);
writeconsole (buffer);
va_end (parms);
if (!happened)
- gui_message ("JIT: Serious error:\n%s", buffer);
+ gui_message (L"JIT: Serious error:\n%s", buffer);
happened = 1;
uae_reset (1);
}
int nr_cpuop_funcs;
struct mnemolookup lookuptab[] = {
- { i_ILLG, "ILLEGAL" },
- { i_OR, "OR" },
- { i_CHK, "CHK" },
- { i_CHK2, "CHK2" },
- { i_AND, "AND" },
- { i_EOR, "EOR" },
- { i_ORSR, "ORSR" },
- { i_ANDSR, "ANDSR" },
- { i_EORSR, "EORSR" },
- { i_SUB, "SUB" },
- { i_SUBA, "SUBA" },
- { i_SUBX, "SUBX" },
- { i_SBCD, "SBCD" },
- { i_ADD, "ADD" },
- { i_ADDA, "ADDA" },
- { i_ADDX, "ADDX" },
- { i_ABCD, "ABCD" },
- { i_NEG, "NEG" },
- { i_NEGX, "NEGX" },
- { i_NBCD, "NBCD" },
- { i_CLR, "CLR" },
- { i_NOT, "NOT" },
- { i_TST, "TST" },
- { i_BTST, "BTST" },
- { i_BCHG, "BCHG" },
- { i_BCLR, "BCLR" },
- { i_BSET, "BSET" },
- { i_CMP, "CMP" },
- { i_CMPM, "CMPM" },
- { i_CMPA, "CMPA" },
- { i_MVPRM, "MVPRM" },
- { i_MVPMR, "MVPMR" },
- { i_MOVE, "MOVE" },
- { i_MOVEA, "MOVEA" },
- { i_MVSR2, "MVSR2" },
- { i_MV2SR, "MV2SR" },
- { i_SWAP, "SWAP" },
- { i_EXG, "EXG" },
- { i_EXT, "EXT" },
- { i_MVMEL, "MVMEL", "MOVEM" },
- { i_MVMLE, "MVMLE", "MOVEM" },
- { i_TRAP, "TRAP" },
- { i_MVR2USP, "MVR2USP" },
- { i_MVUSP2R, "MVUSP2R" },
- { i_NOP, "NOP" },
- { i_RESET, "RESET" },
- { i_RTE, "RTE" },
- { i_RTD, "RTD" },
- { i_LINK, "LINK" },
- { i_UNLK, "UNLK" },
- { i_RTS, "RTS" },
- { i_STOP, "STOP" },
- { i_TRAPV, "TRAPV" },
- { i_RTR, "RTR" },
- { i_JSR, "JSR" },
- { i_JMP, "JMP" },
- { i_BSR, "BSR" },
- { i_Bcc, "Bcc" },
- { i_LEA, "LEA" },
- { i_PEA, "PEA" },
- { i_DBcc, "DBcc" },
- { i_Scc, "Scc" },
- { i_DIVU, "DIVU" },
- { i_DIVS, "DIVS" },
- { i_MULU, "MULU" },
- { i_MULS, "MULS" },
- { i_ASR, "ASR" },
- { i_ASL, "ASL" },
- { i_LSR, "LSR" },
- { i_LSL, "LSL" },
- { i_ROL, "ROL" },
- { i_ROR, "ROR" },
- { i_ROXL, "ROXL" },
- { i_ROXR, "ROXR" },
- { i_ASRW, "ASRW" },
- { i_ASLW, "ASLW" },
- { i_LSRW, "LSRW" },
- { i_LSLW, "LSLW" },
- { i_ROLW, "ROLW" },
- { i_RORW, "RORW" },
- { i_ROXLW, "ROXLW" },
- { i_ROXRW, "ROXRW" },
-
- { i_MOVE2C, "MOVE2C", "MOVEC" },
- { i_MOVEC2, "MOVEC2", "MOVEC" },
- { i_CAS, "CAS" },
- { i_CAS2, "CAS2" },
- { i_MULL, "MULL" },
- { i_DIVL, "DIVL" },
- { i_BFTST, "BFTST" },
- { i_BFEXTU, "BFEXTU" },
- { i_BFCHG, "BFCHG" },
- { i_BFEXTS, "BFEXTS" },
- { i_BFCLR, "BFCLR" },
- { i_BFFFO, "BFFFO" },
- { i_BFSET, "BFSET" },
- { i_BFINS, "BFINS" },
- { i_PACK, "PACK" },
- { i_UNPK, "UNPK" },
- { i_TAS, "TAS" },
- { i_BKPT, "BKPT" },
- { i_CALLM, "CALLM" },
- { i_RTM, "RTM" },
- { i_TRAPcc, "TRAPcc" },
- { i_MOVES, "MOVES" },
- { i_FPP, "FPP" },
- { i_FDBcc, "FDBcc" },
- { i_FScc, "FScc" },
- { i_FTRAPcc, "FTRAPcc" },
- { i_FBcc, "FBcc" },
- { i_FBcc, "FBcc" },
- { i_FSAVE, "FSAVE" },
- { i_FRESTORE, "FRESTORE" },
-
- { i_CINVL, "CINVL" },
- { i_CINVP, "CINVP" },
- { i_CINVA, "CINVA" },
- { i_CPUSHL, "CPUSHL" },
- { i_CPUSHP, "CPUSHP" },
- { i_CPUSHA, "CPUSHA" },
- { i_MOVE16, "MOVE16" },
-
- { i_MMUOP030, "MMUOP030" },
- { i_PFLUSHN, "PFLUSHN" },
- { i_PFLUSH, "PFLUSH" },
- { i_PFLUSHAN, "PFLUSHAN" },
- { i_PFLUSHA, "PFLUSHA" },
-
- { i_PLPAR, "PLPAR" },
- { i_PLPAW, "PLPAW" },
- { i_PTESTR, "PTESTR" },
- { i_PTESTW, "PTESTW" },
-
- { i_LPSTOP, "LPSTOP" },
- { i_ILLG, "" },
+ { i_ILLG, L"ILLEGAL" },
+ { i_OR, L"OR" },
+ { i_CHK, L"CHK" },
+ { i_CHK2, L"CHK2" },
+ { i_AND, L"AND" },
+ { i_EOR, L"EOR" },
+ { i_ORSR, L"ORSR" },
+ { i_ANDSR, L"ANDSR" },
+ { i_EORSR, L"EORSR" },
+ { i_SUB, L"SUB" },
+ { i_SUBA, L"SUBA" },
+ { i_SUBX, L"SUBX" },
+ { i_SBCD, L"SBCD" },
+ { i_ADD, L"ADD" },
+ { i_ADDA, L"ADDA" },
+ { i_ADDX, L"ADDX" },
+ { i_ABCD, L"ABCD" },
+ { i_NEG, L"NEG" },
+ { i_NEGX, L"NEGX" },
+ { i_NBCD, L"NBCD" },
+ { i_CLR, L"CLR" },
+ { i_NOT, L"NOT" },
+ { i_TST, L"TST" },
+ { i_BTST, L"BTST" },
+ { i_BCHG, L"BCHG" },
+ { i_BCLR, L"BCLR" },
+ { i_BSET, L"BSET" },
+ { i_CMP, L"CMP" },
+ { i_CMPM, L"CMPM" },
+ { i_CMPA, L"CMPA" },
+ { i_MVPRM, L"MVPRM" },
+ { i_MVPMR, L"MVPMR" },
+ { i_MOVE, L"MOVE" },
+ { i_MOVEA, L"MOVEA" },
+ { i_MVSR2, L"MVSR2" },
+ { i_MV2SR, L"MV2SR" },
+ { i_SWAP, L"SWAP" },
+ { i_EXG, L"EXG" },
+ { i_EXT, L"EXT" },
+ { i_MVMEL, L"MVMEL", L"MOVEM" },
+ { i_MVMLE, L"MVMLE", L"MOVEM" },
+ { i_TRAP, L"TRAP" },
+ { i_MVR2USP, L"MVR2USP" },
+ { i_MVUSP2R, L"MVUSP2R" },
+ { i_NOP, L"NOP" },
+ { i_RESET, L"RESET" },
+ { i_RTE, L"RTE" },
+ { i_RTD, L"RTD" },
+ { i_LINK, L"LINK" },
+ { i_UNLK, L"UNLK" },
+ { i_RTS, L"RTS" },
+ { i_STOP, L"STOP" },
+ { i_TRAPV, L"TRAPV" },
+ { i_RTR, L"RTR" },
+ { i_JSR, L"JSR" },
+ { i_JMP, L"JMP" },
+ { i_BSR, L"BSR" },
+ { i_Bcc, L"Bcc" },
+ { i_LEA, L"LEA" },
+ { i_PEA, L"PEA" },
+ { i_DBcc, L"DBcc" },
+ { i_Scc, L"Scc" },
+ { i_DIVU, L"DIVU" },
+ { i_DIVS, L"DIVS" },
+ { i_MULU, L"MULU" },
+ { i_MULS, L"MULS" },
+ { i_ASR, L"ASR" },
+ { i_ASL, L"ASL" },
+ { i_LSR, L"LSR" },
+ { i_LSL, L"LSL" },
+ { i_ROL, L"ROL" },
+ { i_ROR, L"ROR" },
+ { i_ROXL, L"ROXL" },
+ { i_ROXR, L"ROXR" },
+ { i_ASRW, L"ASRW" },
+ { i_ASLW, L"ASLW" },
+ { i_LSRW, L"LSRW" },
+ { i_LSLW, L"LSLW" },
+ { i_ROLW, L"ROLW" },
+ { i_RORW, L"RORW" },
+ { i_ROXLW, L"ROXLW" },
+ { i_ROXRW, L"ROXRW" },
+
+ { i_MOVE2C, L"MOVE2C", L"MOVEC" },
+ { i_MOVEC2, L"MOVEC2", L"MOVEC" },
+ { i_CAS, L"CAS" },
+ { i_CAS2, L"CAS2" },
+ { i_MULL, L"MULL" },
+ { i_DIVL, L"DIVL" },
+ { i_BFTST, L"BFTST" },
+ { i_BFEXTU, L"BFEXTU" },
+ { i_BFCHG, L"BFCHG" },
+ { i_BFEXTS, L"BFEXTS" },
+ { i_BFCLR, L"BFCLR" },
+ { i_BFFFO, L"BFFFO" },
+ { i_BFSET, L"BFSET" },
+ { i_BFINS, L"BFINS" },
+ { i_PACK, L"PACK" },
+ { i_UNPK, L"UNPK" },
+ { i_TAS, L"TAS" },
+ { i_BKPT, L"BKPT" },
+ { i_CALLM, L"CALLM" },
+ { i_RTM, L"RTM" },
+ { i_TRAPcc, L"TRAPcc" },
+ { i_MOVES, L"MOVES" },
+ { i_FPP, L"FPP" },
+ { i_FDBcc, L"FDBcc" },
+ { i_FScc, L"FScc" },
+ { i_FTRAPcc, L"FTRAPcc" },
+ { i_FBcc, L"FBcc" },
+ { i_FBcc, L"FBcc" },
+ { i_FSAVE, L"FSAVE" },
+ { i_FRESTORE, L"FRESTORE" },
+
+ { i_CINVL, L"CINVL" },
+ { i_CINVP, L"CINVP" },
+ { i_CINVA, L"CINVA" },
+ { i_CPUSHL, L"CPUSHL" },
+ { i_CPUSHP, L"CPUSHP" },
+ { i_CPUSHA, L"CPUSHA" },
+ { i_MOVE16, L"MOVE16" },
+
+ { i_MMUOP030, L"MMUOP030" },
+ { i_PFLUSHN, L"PFLUSHN" },
+ { i_PFLUSH, L"PFLUSH" },
+ { i_PFLUSHAN, L"PFLUSHAN" },
+ { i_PFLUSHA, L"PFLUSHA" },
+
+ { i_PLPAR, L"PLPAR" },
+ { i_PLPAW, L"PLPAW" },
+ { i_PTESTR, L"PTESTR" },
+ { i_PTESTW, L"PTESTW" },
+
+ { i_LPSTOP, L"LPSTOP" },
+ { i_ILLG, L"" },
};
struct instr *table68k;
return cpu_lev;
}
-static amodes mode_from_str (const char *str)
+static amodes mode_from_str (const TCHAR *str)
{
- if (strncmp (str, "Dreg", 4) == 0) return Dreg;
- if (strncmp (str, "Areg", 4) == 0) return Areg;
- if (strncmp (str, "Aind", 4) == 0) return Aind;
- if (strncmp (str, "Apdi", 4) == 0) return Apdi;
- if (strncmp (str, "Aipi", 4) == 0) return Aipi;
- if (strncmp (str, "Ad16", 4) == 0) return Ad16;
- if (strncmp (str, "Ad8r", 4) == 0) return Ad8r;
- if (strncmp (str, "absw", 4) == 0) return absw;
- if (strncmp (str, "absl", 4) == 0) return absl;
- if (strncmp (str, "PC16", 4) == 0) return PC16;
- if (strncmp (str, "PC8r", 4) == 0) return PC8r;
- if (strncmp (str, "Immd", 4) == 0) return imm;
+ if (_tcsncmp (str, L"Dreg", 4) == 0) return Dreg;
+ if (_tcsncmp (str, L"Areg", 4) == 0) return Areg;
+ if (_tcsncmp (str, L"Aind", 4) == 0) return Aind;
+ if (_tcsncmp (str, L"Apdi", 4) == 0) return Apdi;
+ if (_tcsncmp (str, L"Aipi", 4) == 0) return Aipi;
+ if (_tcsncmp (str, L"Ad16", 4) == 0) return Ad16;
+ if (_tcsncmp (str, L"Ad8r", 4) == 0) return Ad8r;
+ if (_tcsncmp (str, L"absw", 4) == 0) return absw;
+ if (_tcsncmp (str, L"absl", 4) == 0) return absl;
+ if (_tcsncmp (str, L"PC16", 4) == 0) return PC16;
+ if (_tcsncmp (str, L"PC8r", 4) == 0) return PC8r;
+ if (_tcsncmp (str, L"Immd", 4) == 0) return imm;
abort ();
return 0;
}
int variants;
int isjmp = 0;
struct instr_def id;
- const char *opcstr;
+ const TCHAR *opcstr;
int i;
int flaglive = 0, flagdead = 0;
int pos = 0;
int mnp = 0;
int bitno = 0;
- char mnemonic[10];
+ TCHAR mnemonic[10];
wordsizes sz = sz_long;
int srcgather = 0, dstgather = 0;
bitval[bitc] = bitval[bitC];
pos = 0;
- while (opcstr[pos] && !isspace(opcstr[pos])) {
+ while (opcstr[pos] && !_istspace(opcstr[pos])) {
if (opcstr[pos] == '.') {
pos++;
switch (opcstr[pos]) {
mnemonic[mnp] = 0;
/* now, we have read the mnemonic and the size */
- while (opcstr[pos] && isspace(opcstr[pos]))
+ while (opcstr[pos] && _istspace(opcstr[pos]))
pos++;
/* A goto a day keeps the D******a away. */
endofline:
/* now, we have a match */
if (table68k[opc].mnemo != i_ILLG)
- ;//write_log ("Double match: %x: %s\n", opc, opcstr);
+ ;//write_log (L"Double match: %x: %s\n", opc, opcstr);
if (find == -1) {
for (find = 0;; find++) {
- if (strcmp(mnemonic, lookuptab[find].name) == 0) {
+ if (_tcscmp (mnemonic, lookuptab[find].name) == 0) {
table68k[opc].mnemo = lookuptab[find].mnemo;
break;
}
- if (strlen(lookuptab[find].name) == 0)
+ if (_tcslen (lookuptab[find].name) == 0)
abort();
}
}
#include "win32_uaenet.h"
#include "execio.h"
-#define SANA2NAME "uaenet.device"
+#define SANA2NAME L"uaenet.device"
#define MAX_ASYNC_REQUESTS 200
#define MAX_OPEN_DEVICES 20
ROM_netdev_resid = 0,
ROM_netdev_init = 0;
-static char *getdevname (void)
+static TCHAR *getdevname (void)
{
- return "uaenet.device";
+ return L"uaenet.device";
}
struct asyncreq {
{
int i = get_long (request + 24);
if (i < 0 || i >= MAX_OPEN_DEVICES || pdevst[i].inuse == 0) {
- write_log ("%s: corrupt iorequest %08X %d\n", SANA2NAME, request, i);
+ write_log (L"%s: corrupt iorequest %08X %d\n", SANA2NAME, request, i);
return 0;
}
return &pdevst[i];
struct devstruct *dev;
if (!pdev) {
- write_log ("%s close with unknown request %08X!?\n", SANA2NAME, request);
+ write_log (L"%s close with unknown request %08X!?\n", SANA2NAME, request);
return 0;
}
dev = getdevstruct (pdev->unit);
if (!dev) {
- write_log ("%s:%d close with unknown request %08X!?\n", SANA2NAME, pdev->unit, request);
+ write_log (L"%s:%d close with unknown request %08X!?\n", SANA2NAME, pdev->unit, request);
return 0;
}
if (log_net)
- write_log ("%s:%d close, open=%d req=%08X\n", SANA2NAME, pdev->unit, dev->opencnt, request);
+ write_log (L"%s:%d close, open=%d req=%08X\n", SANA2NAME, pdev->unit, dev->opencnt, request);
put_long (request + 24, 0);
dev->opencnt--;
pdev->inuse = 0;
xfree (dev->sysdata);
dev->sysdata = NULL;
write_comm_pipe_u32 (&dev->requests, 0, 1);
- write_log ("%s: opencnt == 0, all instances closed\n", SANA2NAME);
+ write_log (L"%s: opencnt == 0, all instances closed\n", SANA2NAME);
}
put_word (m68k_areg (&context->regs, 6) + 32, get_word (m68k_areg (&context->regs, 6) + 32) - 1);
return 0;
put_byte (ioreq + 31, error);
put_long (ioreq + 32, 0); /* io_device */
if (log_net)
- write_log("-> failed with error %d\n", error);
+ write_log (L"-> failed with error %d\n", error);
return (uae_u32)-1;
}
if (!p)
return 0;
tmp1 = here ();
- calltrap (deftrap2 (uaenet_int_handler, TRAPFLAG_EXTRA_STACK, "uaenet_int_handler"));
+ calltrap (deftrap2 (uaenet_int_handler, TRAPFLAG_EXTRA_STACK, L"uaenet_int_handler"));
put_word (p + 8, 0x020a);
put_long (p + 10, ROM_netdev_resid);
put_long (p + 18, tmp1);
if (!initint(context))
return openfail (ioreq, IOERR_SELFTEST);
if (log_net)
- write_log ("opening %s:%d opencnt=%d ioreq=%08X\n", SANA2NAME, unit, dev->opencnt, ioreq);
+ write_log (L"opening %s:%d opencnt=%d ioreq=%08X\n", SANA2NAME, unit, dev->opencnt, ioreq);
if (get_word (ioreq + 0x12) < IOSTDREQ_SIZE)
return openfail (ioreq, IOERR_BADLENGTH);
if ((flags & SANA2OPF_PROM) && dev->opencnt > 0)
dev->sysdata = NULL;
return openfail (ioreq, IOERR_OPENFAIL);
}
- write_log ("%s: initializing unit %d\n", getdevname (), unit);
+ write_log (L"%s: initializing unit %d\n", getdevname (), unit);
dev->td = pdev->td;
dev->adapter = pdev->td->active;
if (dev->adapter) {
}
}
if (log_net)
- write_log("%s:%d CTB=%08x CFB=%08x PF=%08x\n",
+ write_log (L"%s:%d CTB=%08x CFB=%08x PF=%08x\n",
getdevname(), unit, pdev->copytobuff, pdev->copyfrombuff, pdev->packetfilter);
m68k_dreg (&context->regs, 0) = dev->td->mtu + ETH_HEADER_SIZE + 2;
m68k_dreg (&context->regs, 1) = 1;
struct asyncreq *ar, *ar2;
if (log_net)
- write_log ("%s:%d async request %x added\n", getdevname(), dev->unit, request);
+ write_log (L"%s:%d async request %x added\n", getdevname(), dev->unit, request);
uae_sem_wait (&async_sem);
ar = (struct asyncreq*)xcalloc (sizeof (struct asyncreq), 1);
uae_sem_post (&async_sem);
xfree (ar);
if (log_net)
- write_log ("%s:%d async request %x removed\n", getdevname(), dev->unit, request);
+ write_log (L"%s:%d async request %x removed\n", getdevname(), dev->unit, request);
return 1;
}
prevar = ar;
ar = ar->next;
}
uae_sem_post (&async_sem);
- write_log ("%s:%d async request %x not found for removal!\n", getdevname(), dev->unit, request);
+ write_log (L"%s:%d async request %x not found for removal!\n", getdevname(), dev->unit, request);
return 0;
}
{
struct asyncreq *ar = get_async_request (dev, request, 1);
if (!ar) {
- write_log ("%s:%d: abort async but no request %x found!\n", getdevname(), dev->unit, request);
+ write_log (L"%s:%d: abort async but no request %x found!\n", getdevname(), dev->unit, request);
return;
}
if (log_net)
- write_log ("%s:%d asyncronous request=%08X aborted\n", getdevname(), dev->unit, request);
+ write_log (L"%s:%d asyncronous request=%08X aborted\n", getdevname(), dev->unit, request);
do_abort_async (dev, request);
}
uaecptr request = ar->request;
int command = get_word (request + 28);
if (log_net)
- write_log ("%s:%d CMD=%d async request %x completed\n", getdevname(), dev->unit, command, request);
+ write_log (L"%s:%d CMD=%d async request %x completed\n", getdevname(), dev->unit, command, request);
put_long (request + 32, actual);
put_byte (request + 31, err);
ar->ready = 1;
type = (d[12] << 8) | d[13];
s2p = createreadpacket (dev, d, len);
if (log_net)
- write_log ("<-DST:%02X.%02X.%02X.%02X.%02X.%02X SRC:%02X.%02X.%02X.%02X.%02X.%02X E=%04X L=%d P=%p\n",
+ write_log (L"<-DST:%02X.%02X.%02X.%02X.%02X.%02X SRC:%02X.%02X.%02X.%02X.%02X.%02X E=%04X L=%d P=%p\n",
d[0], d[1], d[2], d[3], d[4], d[5],
d[6], d[7], d[8], d[9], d[10], d[11],
type, len, s2p);
*len = ars2p->s2p->len;
memcpy (d, ars2p->s2p->data, *len);
if (log_net)
- write_log ("->DST:%02X.%02X.%02X.%02X.%02X.%02X SRC:%02X.%02X.%02X.%02X.%02X.%02X E=%04X S=%d\n",
+ write_log (L"->DST:%02X.%02X.%02X.%02X.%02X.%02X SRC:%02X.%02X.%02X.%02X.%02X.%02X E=%04X S=%d\n",
d[0], d[1], d[2], d[3], d[4], d[5],
d[6], d[7], d[8], d[9], d[10], d[11],
packettype, *len);
struct priv_devstruct *pdev = getpdevstruct (request);
if (log_net)
- write_log ("S2: C=%02d T=%04X S=%02X%02X%02X%02X%02X%02X D=%02X%02X%02X%02X%02X%02X L=%d D=%08X SD=%08X BM=%08X\n",
+ write_log (L"S2: C=%02d T=%04X S=%02X%02X%02X%02X%02X%02X D=%02X%02X%02X%02X%02X%02X L=%d D=%08X SD=%08X BM=%08X\n",
command, packettype,
get_byte (srcaddr + 0), get_byte (srcaddr + 1), get_byte (srcaddr + 2), get_byte (srcaddr + 3), get_byte (srcaddr + 4), get_byte (srcaddr + 5),
get_byte (dstaddr + 0), get_byte (dstaddr + 1), get_byte (dstaddr + 2), get_byte (dstaddr + 3), get_byte (dstaddr + 4), get_byte (dstaddr + 5),
dev->flush_timeout_cnt = 0;
dev->flush_timeout = FLUSH_TIMEOUT;
if (log_net)
- write_log ("CMD_FLUSH started %08x\n", request);
+ write_log (L"CMD_FLUSH started %08x\n", request);
uae_sem_wait (&async_sem);
flush (pdev);
uae_sem_post (&async_sem);
}
end:
if (log_net && (io_error || wire_error))
- write_log("-> %d (%d)\n", io_error, wire_error);
+ write_log (L"-> %d (%d)\n", io_error, wire_error);
put_long (request + 32, wire_error);
put_byte (request + 31, io_error);
return async;
put_byte (request + 31, 0);
if (!pdev) {
- write_log ("%s unknown iorequest %08x\n", getdevname (), request);
+ write_log (L"%s unknown iorequest %08x\n", getdevname (), request);
return 0;
}
if (command == NSCMD_DEVICEQUERY) {
put_byte (request + 8, NT_MESSAGE);
if (!pdev) {
- write_log ("%s unknown iorequest (1) %08x\n", getdevname (), request);
+ write_log (L"%s unknown iorequest (1) %08x\n", getdevname (), request);
put_byte (request + 31, 32);
return get_byte (request + 31);
}
dev = getdevstruct (pdev->unit);
if (!dev) {
- write_log ("%s unknown iorequest (2) %08x\n", getdevname (), request);
+ write_log (L"%s unknown iorequest (2) %08x\n", getdevname (), request);
put_byte (request + 31, 32);
return get_byte (request + 31);
}
put_byte (request + 31, 0);
if ((flags & 1) && dev_canquick (dev, request)) {
if (dev_do_io (dev, request, 1))
- write_log ("%s: command %d bug with IO_QUICK\n", SANA2NAME, command);
+ write_log (L"%s: command %d bug with IO_QUICK\n", SANA2NAME, command);
return get_byte (request + 31);
} else {
if (command == CMD_WRITE || command == S2_BROADCAST || command == S2_MULTICAST) {
dev->thread_running = 0;
uae_sem_post (&dev->sync_sem);
uae_sem_post (&change_sem);
- write_log ("%s: dev_thread killed\n", getdevname ());
+ write_log (L"%s: dev_thread killed\n", getdevname ());
return 0;
} else if (get_async_request (dev, request, 1)) {
uae_ReplyMsg (request);
{
uae_u32 base = m68k_dreg (&context->regs,0);
if (log_net)
- write_log ("%s init\n", SANA2NAME);
+ write_log (L"%s init\n", SANA2NAME);
return base;
}
struct devstruct *dev;
if (!pdev) {
- write_log ("%s abortio but no request %08x found!\n", getdevname(), request);
+ write_log (L"%s abortio but no request %08x found!\n", getdevname(), request);
put_byte (request + 31, 32);
return get_byte (request + 31);
}
dev = getdevstruct (pdev->unit);
if (!dev) {
- write_log ("%s (%d) abortio but no request %08x found!\n", getdevname(), pdev->unit, request);
+ write_log (L"%s (%d) abortio but no request %08x found!\n", getdevname(), pdev->unit, request);
put_byte (request + 31, 32);
return get_byte (request + 31);
}
if (log_net)
- write_log ("%s:%d abortio %08x\n", getdevname(), dev->unit, request);
+ write_log (L"%s:%d abortio %08x\n", getdevname(), dev->unit, request);
abort_async (dev, request);
return 0;
}
if (pdev && pdev->tmp == 0) {
if (handleread (ctx, pdev, request, p->data, p->len, command)) {
if (log_net)
- write_log("-> %p Accepted, CMD_READ, REQ=%08X LEN=%d\n", p, request, p->len);
+ write_log (L"-> %p Accepted, CMD_READ, REQ=%08X LEN=%d\n", p, request, p->len);
write_comm_pipe_u32 (&dev->requests, request, 1);
dev->packetsreceived++;
gotit = 1;
pdev->tmp = 1;
} else {
if (log_net)
- write_log("-> %p PacketFilter() rejected, CMD_READ, REQ=%08X LEN=%d\n", p, request, p->len);
+ write_log (L"-> %p PacketFilter() rejected, CMD_READ, REQ=%08X LEN=%d\n", p, request, p->len);
pdev->tmp = -1;
}
}
struct priv_devstruct *pdev = getpdevstruct (request);
if (pdev && pdev->tmp <= 0) {
if (log_net)
- write_log("-> %p Accepted, S2_READORPHAN, REQ=%08X LEN=%d\n", p, request, p->len);
+ write_log (L"-> %p Accepted, S2_READORPHAN, REQ=%08X LEN=%d\n", p, request, p->len);
handleread (ctx, pdev, request, p->data, p->len, command);
write_comm_pipe_u32 (&dev->requests, request, 1);
dev->packetsreceived++;
}
if (!gotit) {
if (log_net)
- write_log ("-> %p packet dropped, LEN=%d\n", p, p->len);
+ write_log (L"-> %p packet dropped, LEN=%d\n", p, p->len);
for (j = 0; j < MAX_OPEN_DEVICES; j++) {
if (pdevst[j].unit == dev->unit) {
if (pdevst[j].tracks[type])
/* do not reply CMD_FLUSH until all other requests are gone */
if (dev->ar->next == NULL) {
if (log_net)
- write_log ("CMD_FLUSH replied %08x\n", request);
+ write_log (L"CMD_FLUSH replied %08x\n", request);
write_comm_pipe_u32 (&dev->requests, request, 1);
uaenet_vsync_requested--;
} else {
if (dev->flush_timeout <= 0) {
dev->flush_timeout = FLUSH_TIMEOUT;
if (dev->flush_timeout_cnt > 1)
- write_log ("WARNING: %s:%d CMD_FLUSH possibly frozen..\n", getdevname(), pdev->unit);
+ write_log (L"WARNING: %s:%d CMD_FLUSH possibly frozen..\n", getdevname(), pdev->unit);
dev->flush_timeout_cnt++;
flush (pdev);
}
struct devstruct *dev;
int unitnum = 0;
- write_log ("%s reset\n", getdevname());
+ write_log (L"%s reset\n", getdevname());
for (i = 0; i < MAX_TOTAL_NET_DEVICES; i++) {
dev = &devst[i];
if (dev->opencnt) {
if (!currprefs.sana2)
return resaddr;
if (log_net)
- write_log ("netdev_startup(0x%x)\n", resaddr);
+ write_log (L"netdev_startup(0x%x)\n", resaddr);
/* Build a struct Resident. This will set up and initialize
* the uaescsi.device */
put_word (resaddr + 0x0, 0x4AFC);
if (!currprefs.sana2)
return;
if (log_net)
- write_log ("netdev_install(): 0x%x\n", here ());
+ write_log (L"netdev_install(): 0x%x\n", here ());
uaenet_close_driver (td);
uaenet_open_driver (td);
ROM_netdev_resname = ds (getdevname());
- ROM_netdev_resid = ds ("UAE net.device 0.2");
- timerdevname = ds ("timer.device");
+ ROM_netdev_resid = ds (L"UAE net.device 0.2");
+ timerdevname = ds (L"timer.device");
/* initcode */
initcode = here ();
- calltrap (deftrap2 (dev_init, TRAPFLAG_EXTRA_STACK, "uaenet.init")); dw (RTS);
+ calltrap (deftrap2 (dev_init, TRAPFLAG_EXTRA_STACK, L"uaenet.init")); dw (RTS);
/* Open */
openfunc = here ();
- calltrap (deftrap2 (dev_open, TRAPFLAG_EXTRA_STACK, "uaenet.open")); dw (RTS);
+ calltrap (deftrap2 (dev_open, TRAPFLAG_EXTRA_STACK, L"uaenet.open")); dw (RTS);
/* Close */
closefunc = here ();
- calltrap (deftrap2 (dev_close, TRAPFLAG_EXTRA_STACK, "uaenet.close")); dw (RTS);
+ calltrap (deftrap2 (dev_close, TRAPFLAG_EXTRA_STACK, L"uaenet.close")); dw (RTS);
/* Expunge */
expungefunc = here ();
- calltrap (deftrap2 (dev_expunge, TRAPFLAG_EXTRA_STACK, "uaenet.expunge")); dw (RTS);
+ calltrap (deftrap2 (dev_expunge, TRAPFLAG_EXTRA_STACK, L"uaenet.expunge")); dw (RTS);
/* BeginIO */
beginiofunc = here ();
- calltrap (deftrap2 (dev_beginio, TRAPFLAG_EXTRA_STACK, "uaenet.beginio")); dw (RTS);
+ calltrap (deftrap2 (dev_beginio, TRAPFLAG_EXTRA_STACK, L"uaenet.beginio")); dw (RTS);
/* AbortIO */
abortiofunc = here ();
- calltrap (deftrap2 (dev_abortio, TRAPFLAG_EXTRA_STACK, "uaenet.abortio")); dw (RTS);
+ calltrap (deftrap2 (dev_abortio, TRAPFLAG_EXTRA_STACK, L"uaenet.abortio")); dw (RTS);
/* FuncTable */
functable = here ();
if (!currprefs.sana2)
return;
if (log_net)
- write_log ("netdev_start_threads()\n");
+ write_log (L"netdev_start_threads()\n");
uae_sem_init (&change_sem, 0, 1);
uae_sem_init (&async_sem, 0, 1);
}
static int savestate_docompress, savestate_specialdump, savestate_nodialogs;
static int replaybuffersize;
-char savestate_fname[MAX_DPATH];
+TCHAR savestate_fname[MAX_DPATH];
static struct staterecord staterecords[MAX_STATERECORDS];
static void state_incompatible_warn (void)
*dst++ = v;
*dstp = dst;
}
-void save_string_func (uae_u8 **dstp, const char *from)
+void save_string_func (uae_u8 **dstp, const TCHAR *from)
{
uae_u8 *dst = *dstp;
- while (from && *from)
- *dst++ = *from++;
+ char *s;
+ s = ua (from);
+ while (s && *s)
+ *dst++ = *s++;
*dst++ = 0;
*dstp = dst;
+ xfree (s);
}
uae_u32 restore_u32_func (uae_u8 **dstp)
*dstp = dst + 1;
return v;
}
-char *restore_string_func (uae_u8 **dstp)
+TCHAR *restore_string_func (uae_u8 **dstp)
{
int len;
uae_u8 v;
uae_u8 *dst = *dstp;
char *top, *to;
+ TCHAR *s;
+
len = strlen(dst) + 1;
top = to = (char*)malloc (len);
do {
*top++ = v;
} while(v);
*dstp = dst;
- return to;
+ s = au (to);
+ xfree (to);
+ return s;
}
/* read and write IFF-style hunks */
-static void save_chunk (struct zfile *f, uae_u8 *chunk, size_t len, char *name, int compress)
+static void save_chunk (struct zfile *f, uae_u8 *chunk, size_t len, TCHAR *name, int compress)
{
uae_u8 tmp[8], *dst;
uae_u8 zero[4]= { 0, 0, 0, 0 };
if (len2)
zfile_fwrite (zero, 1, len2, f);
- write_log ("Chunk '%s' chunk size %d (%d)\n", name, chunklen, len);
+ write_log (L"Chunk '%s' chunk size %d (%d)\n", name, chunklen, len);
}
-static uae_u8 *restore_chunk (struct zfile *f, char *name, size_t *len, size_t *totallen, size_t *filepos)
+static uae_u8 *restore_chunk (struct zfile *f, TCHAR *name, size_t *len, size_t *totallen, size_t *filepos)
{
- uae_u8 tmp[4], dummy[4], *mem, *src;
+ uae_u8 tmp[5], dummy[4], *mem, *src;
uae_u32 flags;
int len2;
*totallen = 0;
/* chunk name */
- zfile_fread (name, 1, 4, f);
- name[4] = 0;
+ zfile_fread (tmp, 1, 4, f);
+ tmp[4] = 0;
+ au_copy (name, 5, tmp);
/* chunk size */
zfile_fread (tmp, 1, 4, f);
src = tmp;
}
/* chunk data. RAM contents will be loaded during the reset phase,
no need to malloc multiple megabytes here. */
- if (strcmp (name, "CRAM") != 0
- && strcmp (name, "BRAM") != 0
- && strcmp (name, "FRAM") != 0
- && strcmp (name, "ZRAM") != 0
- && strcmp (name, "PRAM") != 0
- && strcmp (name, "A3K1") != 0
- && strcmp (name, "A3K2") != 0)
+ if (_tcscmp (name, L"CRAM") != 0
+ && _tcscmp (name, L"BRAM") != 0
+ && _tcscmp (name, L"FRAM") != 0
+ && _tcscmp (name, L"ZRAM") != 0
+ && _tcscmp (name, L"PRAM") != 0
+ && _tcscmp (name, L"A3K1") != 0
+ && _tcscmp (name, L"A3K2") != 0)
{
/* without zeros at the end old state files may not work */
mem = (uae_u8*)calloc (1, *totallen + 32);
static uae_u8 *restore_log (uae_u8 *src)
{
- write_log (src);
- src += strlen(src) + 1;
+ //write_log (src);
+ src += strlen (src) + 1;
return src;
}
static void restore_header (uae_u8 *src)
{
- char *emuname, *emuversion, *description;
+ TCHAR *emuname, *emuversion, *description;
restore_u32 ();
emuname = restore_string ();
emuversion = restore_string ();
description = restore_string ();
- write_log ("Saved with: '%s %s', description: '%s'\n",
+ write_log (L"Saved with: '%s %s', description: '%s'\n",
emuname,emuversion,description);
xfree (description);
xfree (emuversion);
/* restore all subsystems */
-void restore_state (const char *filename)
+void restore_state (const TCHAR *filename)
{
struct zfile *f;
uae_u8 *chunk,*end;
- char name[5];
+ TCHAR name[5];
size_t len, totallen;
size_t filepos, filesize;
int z3num;
chunk = 0;
- f = zfile_fopen (filename, "rb");
+ f = zfile_fopen (filename, L"rb");
if (!f)
goto error;
zfile_fseek (f, 0, SEEK_END);
savestate_init ();
chunk = restore_chunk (f, name, &len, &totallen, &filepos);
- if (!chunk || memcmp (name, "ASF ", 4)) {
- write_log ("%s is not an AmigaStateFile\n",filename);
+ if (!chunk || _tcsncmp (name, L"ASF ", 4)) {
+ write_log (L"%s is not an AmigaStateFile\n", filename);
goto error;
}
savestate_file = f;
for (;;) {
name[0] = 0;
chunk = end = restore_chunk (f, name, &len, &totallen, &filepos);
- write_log ("Chunk '%s' size %d (%d)\n", name, len, totallen);
- if (!strcmp (name, "END ")) {
+ write_log (L"Chunk '%s' size %d (%d)\n", name, len, totallen);
+ if (!_tcscmp (name, L"END ")) {
#ifdef _DEBUG
if (filesize > filepos + 8)
continue;
#endif
break;
}
- if (!strcmp (name, "CRAM")) {
+ if (!_tcscmp (name, L"CRAM")) {
restore_cram (totallen, filepos);
continue;
- } else if (!strcmp (name, "BRAM")) {
+ } else if (!_tcscmp (name, L"BRAM")) {
restore_bram (totallen, filepos);
continue;
- } else if (!strcmp (name, "A3K1")) {
+ } else if (!_tcscmp (name, L"A3K1")) {
restore_a3000lram (totallen, filepos);
continue;
- } else if (!strcmp (name, "A3K2")) {
+ } else if (!_tcscmp (name, L"A3K2")) {
restore_a3000hram (totallen, filepos);
continue;
#ifdef AUTOCONFIG
- } else if (!strcmp (name, "FRAM")) {
+ } else if (!_tcscmp (name, L"FRAM")) {
restore_fram (totallen, filepos);
continue;
- } else if (!strcmp (name, "ZRAM")) {
+ } else if (!_tcscmp (name, L"ZRAM")) {
restore_zram (totallen, filepos, z3num++);
continue;
- } else if (!strcmp (name, "BORO")) {
+ } else if (!_tcscmp (name, L"BORO")) {
restore_bootrom (totallen, filepos);
continue;
#endif
#ifdef PICASSO96
- } else if (!strcmp (name, "PRAM")) {
+ } else if (!_tcscmp (name, L"PRAM")) {
restore_pram (totallen, filepos);
continue;
#endif
- } else if (!strcmp (name, "CPU "))
+ } else if (!_tcscmp (name, L"CPU "))
end = restore_cpu (chunk);
#ifdef FPUEMU
- else if (!strcmp (name, "FPU "))
+ else if (!_tcscmp (name, L"FPU "))
end = restore_fpu (chunk);
#endif
- else if (!strcmp (name, "AGAC"))
+ else if (!_tcscmp (name, L"AGAC"))
end = restore_custom_agacolors (chunk);
- else if (!strcmp (name, "SPR0"))
+ else if (!_tcscmp (name, L"SPR0"))
end = restore_custom_sprite (0, chunk);
- else if (!strcmp (name, "SPR1"))
+ else if (!_tcscmp (name, L"SPR1"))
end = restore_custom_sprite (1, chunk);
- else if (!strcmp (name, "SPR2"))
+ else if (!_tcscmp (name, L"SPR2"))
end = restore_custom_sprite (2, chunk);
- else if (!strcmp (name, "SPR3"))
+ else if (!_tcscmp (name, L"SPR3"))
end = restore_custom_sprite (3, chunk);
- else if (!strcmp (name, "SPR4"))
+ else if (!_tcscmp (name, L"SPR4"))
end = restore_custom_sprite (4, chunk);
- else if (!strcmp (name, "SPR5"))
+ else if (!_tcscmp (name, L"SPR5"))
end = restore_custom_sprite (5, chunk);
- else if (!strcmp (name, "SPR6"))
+ else if (!_tcscmp (name, L"SPR6"))
end = restore_custom_sprite (6, chunk);
- else if (!strcmp (name, "SPR7"))
+ else if (!_tcscmp (name, L"SPR7"))
end = restore_custom_sprite (7, chunk);
- else if (!strcmp (name, "CIAA"))
+ else if (!_tcscmp (name, L"CIAA"))
end = restore_cia (0, chunk);
- else if (!strcmp (name, "CIAB"))
+ else if (!_tcscmp (name, L"CIAB"))
end = restore_cia (1, chunk);
- else if (!strcmp (name, "CHIP"))
+ else if (!_tcscmp (name, L"CHIP"))
end = restore_custom (chunk);
- else if (!strcmp (name, "AUD0"))
+ else if (!_tcscmp (name, L"AUD0"))
end = restore_audio (0, chunk);
- else if (!strcmp (name, "AUD1"))
+ else if (!_tcscmp (name, L"AUD1"))
end = restore_audio (1, chunk);
- else if (!strcmp (name, "AUD2"))
+ else if (!_tcscmp (name, L"AUD2"))
end = restore_audio (2, chunk);
- else if (!strcmp (name, "AUD3"))
+ else if (!_tcscmp (name, L"AUD3"))
end = restore_audio (3, chunk);
- else if (!strcmp (name, "BLIT"))
+ else if (!_tcscmp (name, L"BLIT"))
end = restore_blitter (chunk);
- else if (!strcmp (name, "DISK"))
+ else if (!_tcscmp (name, L"DISK"))
end = restore_floppy (chunk);
- else if (!strcmp (name, "DSK0"))
+ else if (!_tcscmp (name, L"DSK0"))
end = restore_disk (0, chunk);
- else if (!strcmp (name, "DSK1"))
+ else if (!_tcscmp (name, L"DSK1"))
end = restore_disk (1, chunk);
- else if (!strcmp (name, "DSK2"))
+ else if (!_tcscmp (name, L"DSK2"))
end = restore_disk (2, chunk);
- else if (!strcmp (name, "DSK3"))
+ else if (!_tcscmp (name, L"DSK3"))
end = restore_disk (3, chunk);
- else if (!strcmp (name, "KEYB"))
+ else if (!_tcscmp (name, L"KEYB"))
end = restore_keyboard (chunk);
#ifdef AUTOCONFIG
- else if (!strcmp (name, "EXPA"))
+ else if (!_tcscmp (name, L"EXPA"))
end = restore_expansion (chunk);
#endif
- else if (!strcmp (name, "ROM "))
+ else if (!_tcscmp (name, L"ROM "))
end = restore_rom (chunk);
#ifdef PICASSO96
- else if (!strcmp (name, "P96 "))
+ else if (!_tcscmp (name, L"P96 "))
end = restore_p96 (chunk);
#endif
#ifdef ACTION_REPLAY
- else if (!strcmp (name, "ACTR"))
+ else if (!_tcscmp (name, L"ACTR"))
end = restore_action_replay (chunk);
- else if (!strcmp (name, "HRTM"))
+ else if (!_tcscmp (name, L"HRTM"))
end = restore_hrtmon (chunk);
#endif
#ifdef FILESYS
- else if (!strcmp (name, "FSYS"))
+ else if (!_tcscmp (name, L"FSYS"))
end = restore_filesys (chunk);
- else if (!strcmp (name, "FSYC"))
+ else if (!_tcscmp (name, L"FSYC"))
end = restore_filesys_common (chunk);
#endif
#ifdef CD32
- else if (!strcmp (name, "CD32"))
+ else if (!_tcscmp (name, L"CD32"))
end = restore_akiko (chunk);
#endif
- else if (!strcmp (name, "GAYL"))
+ else if (!_tcscmp (name, L"GAYL"))
end = restore_gayle (chunk);
- else if (!strcmp (name, "IDE "))
+ else if (!_tcscmp (name, L"IDE "))
end = restore_ide (chunk);
- else if (!strcmp (name, "CONF"))
+ else if (!_tcscmp (name, L"CONF"))
end = restore_configuration (chunk);
- else if (!strcmp (name, "LOG "))
+ else if (!_tcscmp (name, L"LOG "))
end = restore_log (chunk);
else {
end = chunk + len;
- write_log ("unknown chunk '%s' size %d bytes\n", name, len);
+ write_log (L"unknown chunk '%s' size %d bytes\n", name, len);
}
if (end == NULL)
- write_log ("Chunk '%s', size %d bytes was not accepted!\n",
+ write_log (L"Chunk '%s', size %d bytes was not accepted!\n",
name, len);
else if (len != end - chunk)
- write_log ("Chunk '%s' total size %d bytes but read %d bytes!\n",
+ write_log (L"Chunk '%s' total size %d bytes but read %d bytes!\n",
name, len, end - chunk);
xfree (chunk);
}
}
/* 1=compressed,2=not compressed,3=ram dump,4=audio dump */
-void savestate_initsave (const char *filename, int mode, int nodialogs)
+void savestate_initsave (const TCHAR *filename, int mode, int nodialogs)
{
if (filename == NULL) {
savestate_fname[0] = 0;
savestate_nodialogs = 0;
return;
}
- strcpy (savestate_fname, filename);
+ _tcscpy (savestate_fname, filename);
savestate_docompress = (mode == 1) ? 1 : 0;
savestate_specialdump = (mode == 3) ? 1 : (mode == 4) ? 2 : 0;
savestate_nodialogs = nodialogs;
int len;
dst = save_cram (&len);
- save_chunk (f, dst, len, "CRAM", comp);
+ save_chunk (f, dst, len, L"CRAM", comp);
dst = save_bram (&len);
- save_chunk (f, dst, len, "BRAM", comp);
+ save_chunk (f, dst, len, L"BRAM", comp);
dst = save_a3000lram (&len);
- save_chunk (f, dst, len, "A3K1", comp);
+ save_chunk (f, dst, len, L"A3K1", comp);
dst = save_a3000hram (&len);
- save_chunk (f, dst, len, "A3K2", comp);
+ save_chunk (f, dst, len, L"A3K2", comp);
#ifdef AUTOCONFIG
dst = save_fram (&len);
- save_chunk (f, dst, len, "FRAM", comp);
+ save_chunk (f, dst, len, L"FRAM", comp);
dst = save_zram (&len, 0);
- save_chunk (f, dst, len, "ZRAM", comp);
+ save_chunk (f, dst, len, L"ZRAM", comp);
dst = save_zram (&len, 1);
- save_chunk (f, dst, len, "ZRAM", comp);
+ save_chunk (f, dst, len, L"ZRAM", comp);
dst = save_bootrom (&len);
- save_chunk (f, dst, len, "BORO", comp);
+ save_chunk (f, dst, len, L"BORO", comp);
#endif
#ifdef PICASSO96
dst = save_p96 (&len, 0);
- save_chunk (f, dst, len, "P96 ", 0);
+ save_chunk (f, dst, len, L"P96 ", 0);
dst = save_pram (&len);
- save_chunk (f, dst, len, "PRAM", comp);
+ save_chunk (f, dst, len, L"PRAM", comp);
#endif
}
/* Save all subsystems */
-int save_state (const char *filename, const char *description)
+int save_state (const TCHAR *filename, const TCHAR *description)
{
uae_u8 endhunk[] = { 'E', 'N', 'D', ' ', 0, 0, 0, 8 };
uae_u8 header[1000];
- char tmp[100];
+ TCHAR tmp[100];
uae_u8 *dst;
struct zfile *f;
int len,i;
- char name[5];
+ TCHAR name[5];
int comp = savestate_docompress;
if (!savestate_specialdump && !savestate_nodialogs) {
state_incompatible_warn ();
if (!save_filesys_cando ()) {
- gui_message("Filesystem active. Try again later");
+ gui_message (L"Filesystem active. Try again later");
return -1;
}
}
savestate_nodialogs = 0;
custom_prepare_savestate ();
- f = zfile_fopen (filename, "w+b");
+ f = zfile_fopen (filename, L"w+b");
if (!f)
return 0;
if (savestate_specialdump) {
dst = header;
save_u32 (0);
- save_string ("UAE");
- sprintf (tmp, "%d.%d.%d", UAEMAJOR, UAEMINOR, UAESUBREV);
+ save_string (L"UAE");
+ _stprintf (tmp, L"%d.%d.%d", UAEMAJOR, UAEMINOR, UAESUBREV);
save_string (tmp);
save_string (description);
- save_chunk (f, header, dst-header, "ASF ", 0);
+ save_chunk (f, header, dst-header, L"ASF ", 0);
dst = save_cpu (&len, 0);
- save_chunk (f, dst, len, "CPU ", 0);
+ save_chunk (f, dst, len, L"CPU ", 0);
xfree (dst);
#ifdef FPUEMU
dst = save_fpu (&len,0 );
- save_chunk (f, dst, len, "FPU ", 0);
+ save_chunk (f, dst, len, L"FPU ", 0);
xfree (dst);
#endif
- strcpy(name, "DSKx");
+ _tcscpy(name, L"DSKx");
for (i = 0; i < 4; i++) {
dst = save_disk (i, &len, 0);
if (dst) {
}
}
dst = save_floppy (&len, 0);
- save_chunk (f, dst, len, "DISK", 0);
+ save_chunk (f, dst, len, L"DISK", 0);
xfree (dst);
dst = save_blitter (&len, 0);
- save_chunk (f, dst, len, "BLIT", 0);
+ save_chunk (f, dst, len, L"BLIT", 0);
xfree (dst);
dst = save_custom (&len, 0, 0);
- save_chunk (f, dst, len, "CHIP", 0);
+ save_chunk (f, dst, len, L"CHIP", 0);
xfree (dst);
dst = save_custom_agacolors (&len, 0);
- save_chunk (f, dst, len, "AGAC", 0);
+ save_chunk (f, dst, len, L"AGAC", 0);
xfree (dst);
- strcpy (name, "SPRx");
+ _tcscpy (name, L"SPRx");
for (i = 0; i < 8; i++) {
dst = save_custom_sprite (i, &len, 0);
name[3] = i + '0';
xfree (dst);
}
- strcpy (name, "AUDx");
+ _tcscpy (name, L"AUDx");
for (i = 0; i < 4; i++) {
dst = save_audio (i, &len, 0);
name[3] = i + '0';
}
dst = save_cia (0, &len, 0);
- save_chunk (f, dst, len, "CIAA", 0);
+ save_chunk (f, dst, len, L"CIAA", 0);
xfree (dst);
dst = save_cia (1, &len, 0);
- save_chunk (f, dst, len, "CIAB", 0);
+ save_chunk (f, dst, len, L"CIAB", 0);
xfree (dst);
dst = save_keyboard (&len);
- save_chunk (f, dst, len, "KEYB", 0);
+ save_chunk (f, dst, len, L"KEYB", 0);
xfree (dst);
#ifdef AUTOCONFIG
dst = save_expansion (&len, 0);
- save_chunk (f, dst, len, "EXPA", 0);
+ save_chunk (f, dst, len, L"EXPA", 0);
#endif
save_rams (f, comp);
do {
if (!dst)
break;
- save_chunk (f, dst, len, "ROM ", 0);
+ save_chunk (f, dst, len, L"ROM ", 0);
xfree (dst);
} while ((dst = save_rom (0, &len, 0)));
#ifdef CD32
dst = save_akiko (&len);
- save_chunk (f, dst, len, "CD32", 0);
+ save_chunk (f, dst, len, L"CD32", 0);
xfree (dst);
#endif
#ifdef ACTION_REPLAY
dst = save_action_replay (&len, 0);
- save_chunk (f, dst, len, "ACTR", 1);
+ save_chunk (f, dst, len, L"ACTR", 1);
dst = save_hrtmon (&len, 0);
- save_chunk (f, dst, len, "HRTM", 1);
+ save_chunk (f, dst, len, L"HRTM", 1);
#endif
#ifdef FILESYS
dst = save_filesys_common (&len);
if (dst) {
- save_chunk (f, dst, len, "FSYC", 0);
+ save_chunk (f, dst, len, L"FSYC", 0);
for (i = 0; i < nr_units (); i++) {
dst = save_filesys (i, &len);
if (dst) {
- save_chunk (f, dst, len, "FSYS", 0);
+ save_chunk (f, dst, len, L"FSYS", 0);
xfree (dst);
}
}
#endif
dst = save_gayle(&len);
if (dst) {
- save_chunk (f, dst, len, "GAYL", 0);
+ save_chunk (f, dst, len, L"GAYL", 0);
xfree(dst);
}
for (i = 0; i < 4; i++) {
dst = save_ide (i, &len);
if (dst) {
- save_chunk (f, dst, len, "IDE ", 0);
+ save_chunk (f, dst, len, L"IDE ", 0);
xfree(dst);
}
}
dst = save_configuration (&len);
if (dst) {
- save_chunk (f, dst, len, "CONF", 1);
+ save_chunk (f, dst, len, L"CONF", 1);
xfree(dst);
}
dst = save_log (TRUE, &len);
if (dst) {
- save_chunk (f, dst, len, "LOG ", 1);
+ save_chunk (f, dst, len, L"LOG ", 1);
xfree(dst);
}
zfile_fwrite (endhunk, 1, 8, f);
- write_log ("Save of '%s' complete\n", filename);
+ write_log (L"Save of '%s' complete\n", filename);
zfile_fclose (f);
savestate_state = 0;
return 1;
void savestate_quick (int slot, int save)
{
- int i, len = strlen (savestate_fname);
+ int i, len = _tcslen (savestate_fname);
i = len - 1;
while (i >= 0 && savestate_fname[i] != '_')
i--;
while (i >= 0 && savestate_fname[i] != '.')
i--;
if (i <= 0) {
- write_log ("savestate name skipped '%s'\n", savestate_fname);
+ write_log (L"savestate name skipped '%s'\n", savestate_fname);
return;
}
}
- strcpy (savestate_fname + i, ".uss");
+ _tcscpy (savestate_fname + i, L".uss");
if (slot > 0)
- sprintf (savestate_fname + i, "_%d.uss", slot);
+ _stprintf (savestate_fname + i, L"_%d.uss", slot);
if (save) {
- write_log ("saving '%s'\n", savestate_fname);
+ write_log (L"saving '%s'\n", savestate_fname);
savestate_docompress = 1;
- save_state (savestate_fname, "");
+ save_state (savestate_fname, L"");
} else {
if (!zfile_exists (savestate_fname)) {
- write_log ("staterestore, file '%s' not found\n", savestate_fname);
+ write_log (L"staterestore, file '%s' not found\n", savestate_fname);
return;
}
savestate_state = STATE_DORESTORE;
- write_log ("staterestore starting '%s'\n", savestate_fname);
+ write_log (L"staterestore starting '%s'\n", savestate_fname);
}
}
break;
p = st->cpu + 17 * 4;
pc = restore_u32_func (&p);
- console_out_f ("%d: PC=%08X %c\n", cnt, pc, regs.pc == pc ? '*' : ' ');
+ console_out_f (L"%d: PC=%08X %c\n", cnt, pc, regs.pc == pc ? '*' : ' ');
cnt++;
i--;
if (i < 0)
frameextra = timeframes % currprefs.statecapturerate;
p = st->start;
p2 = st->end;
- write_log ("rewinding from %d\n", replaycounter);
+ write_log (L"rewinding from %d\n", replaycounter);
p = restore_cpu (p);
#ifdef FPUEMU
if (restore_u32_func (&p))
#endif
p += 4;
if (p != p2) {
- gui_message ("reload failure, address mismatch %p != %p", p, p2);
+ gui_message (L"reload failure, address mismatch %p != %p", p, p2);
uae_reset (0);
return;
}
{
uae_u8 *p = *pp;
if (p + len + BS >= replaybuffer + replaybuffersize) {
- //write_log ("capture buffer wrap-around\n");
+ //write_log (L"capture buffer wrap-around\n");
return 1;
}
return 0;
}
i--;
}
- //write_log ("state capture %d (%d bytes)\n", replaycounter, p - p2);
+ //write_log (L"state capture %d (%d bytes)\n", replaycounter, p - p2);
return;
retry:
staterecords[replaycounter].next = replaybuffer;
retrycnt++;
if (retrycnt > 1) {
- write_log ("can't save, too small capture buffer\n");
+ write_log (L"can't save, too small capture buffer\n");
return;
}
goto retry2;
return 0;
}
}
- write_log ("SCSI command %02X, no direction specified (IN?)!\n", sd->cmd[0]);
+ write_log (L"SCSI command %02X, no direction specified (IN?)!\n", sd->cmd[0]);
return -2;
}
{
struct scsi_data *sd;
if (!sys_command_open (DF_SCSI, nativeunit)) {
- write_log ("SCSI: native scsi unit %d failed to open\n", nativeunit);
+ write_log (L"SCSI: native scsi unit %d failed to open\n", nativeunit);
return NULL;
}
sd = (struct scsi_data*)xcalloc(sizeof (struct scsi_data), 1);
{
if (sd->direction) {
if (sd->offset >= SCSI_DATA_BUFFER_SIZE) {
- write_log ("SCSI data buffer overflow!\n");
+ write_log (L"SCSI data buffer overflow!\n");
return 0;
}
sd->buffer[sd->offset++] = b;
} else {
if (sd->offset >= 16) {
- write_log ("SCSI command buffer overflow!\n");
+ write_log (L"SCSI command buffer overflow!\n");
return 0;
}
sd->cmd[sd->offset++] = b;
#define CDDEV_COMMANDS
-#define UAEDEV_SCSI "uaescsi.device"
+#define UAEDEV_SCSI L"uaescsi.device"
#define UAEDEV_SCSI_ID 1
-#define UAEDEV_DISK "uaedisk.device"
+#define UAEDEV_DISK L"uaedisk.device"
#define UAEDEV_DISK_ID 2
#define MAX_ASYNC_REQUESTS 20
return sys_command_info (mode, unitnum, di);
}
-static void io_log (const char *msg, uaecptr request)
+static void io_log (const TCHAR *msg, uaecptr request)
{
if (log_scsi)
- write_log ("%s: %08X %d %08X %d %d io_actual=%d io_error=%d\n",
+ write_log (L"%s: %08X %d %08X %d %d io_actual=%d io_error=%d\n",
msg, request, get_word (request + 28), get_long (request + 40),
get_long (request + 36), get_long (request + 44),
get_long (request + 32), get_byte (request + 31));
{
int i = get_long (request + 24);
if (i < 0 || i >= MAX_OPEN_DEVICES || pdevst[i].inuse == 0) {
- write_log ("uaescsi.device: corrupt iorequest %08X %d\n", request, i);
+ write_log (L"uaescsi.device: corrupt iorequest %08X %d\n", request, i);
return 0;
}
return &pdevst[i];
}
-static char *getdevname (int type)
+static TCHAR *getdevname (int type)
{
switch (type) {
case UAEDEV_SCSI_ID:
case UAEDEV_DISK_ID:
return UAEDEV_DISK;
default:
- return "NULL";
+ return L"NULL";
}
}
return 1;
init_comm_pipe (&dev->requests, 100, 1);
uae_sem_init (&dev->sync_sem, 0, 0);
- uae_start_thread ("uaescsi", dev_thread, dev, NULL);
+ uae_start_thread (L"uaescsi", dev_thread, dev, NULL);
uae_sem_wait (&dev->sync_sem);
return dev->thread_running;
}
return 0;
dev = getdevstruct (pdev->unit);
if (log_scsi)
- write_log ("%s:%d close, req=%08X\n", getdevname (pdev->type), pdev->unit, request);
+ write_log (L"%s:%d close, req=%08X\n", getdevname (pdev->type), pdev->unit, request);
if (!dev)
return 0;
dev_close_3 (dev, pdev);
int i;
if (log_scsi)
- write_log ("opening %s:%d ioreq=%08X\n", getdevname (type), unit, ioreq);
+ write_log (L"opening %s:%d ioreq=%08X\n", getdevname (type), unit, ioreq);
if (get_word (ioreq + 0x12) < IOSTDREQ_SIZE)
return openfail (ioreq, IOERR_BADLENGTH);
if (!dev)
int i;
if (log_scsi)
- write_log ("async request %08x (%d) added\n", request, type);
+ write_log (L"async request %08x (%d) added\n", request, type);
i = 0;
while (i < MAX_ASYNC_REQUESTS) {
if (dev->d_request[i] == request) {
int i = 0;
if (log_scsi)
- write_log ("async request %p removed\n", request);
+ write_log (L"async request %p removed\n", request);
while (i < MAX_ASYNC_REQUESTS) {
if (dev->d_request[i] == request) {
int type = dev->d_request_type[i];
}
i = release_async_request (dev, request);
if (i >= 0 && log_scsi)
- write_log ("asyncronous request=%08X aborted, error=%d\n", request, errcode);
+ write_log (L"asyncronous request=%08X aborted, error=%d\n", request, errcode);
}
static int command_read (int mode, struct devstruct *dev, uaecptr data, uae_u64 offset, uae_u32 length, uae_u32 *io_actual)
switch (command)
{
case CMD_READ:
- //write_log ("CMD_READ %08x %d %d %08x\n", io_data, io_offset, io_length, bmask);
+ //write_log (L"CMD_READ %08x %d %d %08x\n", io_data, io_offset, io_length, bmask);
if (dev->drivetype == INQ_ROMD) {
io_error = command_cd_read (pdev->mode, dev, io_data, io_offset, io_length, &io_actual);
} else {
uae_u32 sdd = get_long (request + 40);
io_error = sys_command_scsi_direct (dev->unitnum, sdd);
if (log_scsi)
- write_log ("scsidev: did io: sdd %p request %p error %d\n", sdd, request, get_byte (request + 31));
+ write_log (L"scsidev: did io: sdd %p request %p error %d\n", sdd, request, get_byte (request + 31));
} else {
io_error = IOERR_NOCMD;
}
}
put_long (request + 32, io_actual);
put_byte (request + 31, io_error);
- io_log ("dev_io",request);
+ io_log (L"dev_io",request);
return async;
}
put_byte (request+31, 0);
if ((flags & 1) && dev_canquick (dev, request)) {
if (dev_do_io (dev, request))
- write_log ("device %s command %d bug with IO_QUICK\n", getdevname (pdev->type), command);
+ write_log (L"device %s command %d bug with IO_QUICK\n", getdevname (pdev->type), command);
return get_byte (request + 31);
} else {
add_async_request (dev, request, ASYNC_REQUEST_TEMP, 0);
uae_ReplyMsg (request);
} else {
if (log_scsi)
- write_log ("%s:%d async request %08X\n", getdevname(0), dev->unitnum, request);
+ write_log (L"%s:%d async request %08X\n", getdevname(0), dev->unitnum, request);
}
uae_sem_post (&change_sem);
}
{
uae_u32 base = m68k_dreg (&context->regs,0);
if (log_scsi)
- write_log ("%s init\n", getdevname (type));
+ write_log (L"%s init\n", getdevname (type));
return base;
}
}
put_byte (request + 31, IOERR_ABORTED);
if (log_scsi)
- write_log ("abortio %s unit=%d, request=%08X\n", getdevname (pdev->type), pdev->unit, request);
+ write_log (L"abortio %s unit=%d, request=%08X\n", getdevname (pdev->type), pdev->unit, request);
abort_async (dev, request, IOERR_ABORTED, 0);
return 0;
}
dev->aunit = unitnum;
unitnum++;
}
- write_log ("%s:%d = '%s'\n", UAEDEV_SCSI, dev->aunit, dev->di.label);
+ write_log (L"%s:%d = '%s'\n", UAEDEV_SCSI, dev->aunit, dev->di.label);
}
dev->di.label[0] = 0;
}
/* Build a struct Resident. This will set up and initialize
* the cd.device */
if (log_scsi)
- write_log ("diskdev_startup(0x%x)\n", resaddr);
+ write_log (L"diskdev_startup(0x%x)\n", resaddr);
put_word (resaddr + 0x0, 0x4AFC);
put_long (resaddr + 0x2, resaddr);
put_long (resaddr + 0x6, resaddr + 0x1A); /* Continue scan here */
if (currprefs.scsi != 1)
return resaddr;
if (log_scsi)
- write_log ("scsidev_startup(0x%x)\n", resaddr);
+ write_log (L"scsidev_startup(0x%x)\n", resaddr);
/* Build a struct Resident. This will set up and initialize
* the uaescsi.device */
put_word (resaddr + 0x0, 0x4AFC);
if (currprefs.scsi != 1)
return;
if (log_scsi)
- write_log ("diskdev_install(): 0x%x\n", here ());
+ write_log (L"diskdev_install(): 0x%x\n", here ());
ROM_diskdev_resname = ds (UAEDEV_DISK);
- ROM_diskdev_resid = ds ("UAE disk.device 0.1");
+ ROM_diskdev_resid = ds (L"UAE disk.device 0.1");
/* initcode */
initcode = here ();
if (currprefs.scsi != 1)
return;
if (log_scsi)
- write_log ("scsidev_install(): 0x%x\n", here ());
+ write_log (L"scsidev_install(): 0x%x\n", here ());
ROM_scsidev_resname = ds (UAEDEV_SCSI);
- ROM_scsidev_resid = ds ("UAE scsi.device 0.2");
+ ROM_scsidev_resid = ds (L"UAE scsi.device 0.2");
/* initcode */
initcode = here ();
if (currprefs.scsi != 1) /* quite useless.. */
return;
if (log_scsi)
- write_log ("scsidev_start_threads()\n");
+ write_log (L"scsidev_start_threads()\n");
uae_sem_init (&change_sem, 0, 1);
}
{
TrapHandler handler; /* Handler function to be invoked for this trap. */
int flags; /* Trap attributes. */
- const char *name; /* For debugging purposes. */
+ const TCHAR *name; /* For debugging purposes. */
uaecptr addr;
};
static void trap_HandleExtendedTrap (TrapHandler, int has_retval);
-uaecptr find_trap (const char *name)
+uaecptr find_trap (const TCHAR *name)
{
int i;
for (i = 0; i < trap_count; i++) {
struct Trap *trap = &traps[i];
- if ((trap->flags & TRAPFLAG_UAERES) && trap->name && !strcmp (trap->name, name))
+ if ((trap->flags & TRAPFLAG_UAERES) && trap->name && !_tcscmp (trap->name, name))
return trap->addr;
}
return 0;
*
* returns trap number of defined trap
*/
-unsigned int define_trap (TrapHandler handler_func, int flags, const char *name)
+unsigned int define_trap (TrapHandler handler_func, int flags, const TCHAR *name)
{
if (trap_count == MAX_TRAPS) {
- write_log ("Ran out of emulator traps\n");
+ write_log (L"Ran out of emulator traps\n");
abort ();
return -1;
} else {
int implicit_rts = (trap->flags & TRAPFLAG_DORET) != 0;
if (trap->name && trap->name[0] != 0 && trace_traps)
- write_log ("TRAP: %s\n", trap->name);
+ write_log (L"TRAP: %s\n", trap->name);
if (trap_num < trap_count) {
}
} else {
- write_log ("Illegal emulator trap %d\n", trap_num);
+ write_log (L"Illegal emulator trap %d\n", trap_num);
}
}
void init_extended_traps (void)
{
m68k_call_trapaddr = here ();
- calltrap (deftrap2 ((TrapHandler)m68k_call_handler, TRAPFLAG_NO_RETVAL, "m68k_call"));
+ calltrap (deftrap2 ((TrapHandler)m68k_call_handler, TRAPFLAG_NO_RETVAL, L"m68k_call"));
m68k_return_trapaddr = here();
- calltrap (deftrap2 ((TrapHandler)m68k_return_handler, TRAPFLAG_NO_RETVAL, "m68k_return"));
+ calltrap (deftrap2 ((TrapHandler)m68k_return_handler, TRAPFLAG_NO_RETVAL, L"m68k_return"));
exit_trap_trapaddr = here();
- calltrap (deftrap2 ((TrapHandler)exit_trap_handler, TRAPFLAG_NO_RETVAL, "exit_trap"));
+ calltrap (deftrap2 ((TrapHandler)exit_trap_handler, TRAPFLAG_NO_RETVAL, L"exit_trap"));
uae_sem_init (&trap_mutex, 0, 1);
}
static struct uae_xcmd *first = NULL;
static struct uae_xcmd *last = NULL;
-static char running = 0;
+static TCHAR running = 0;
static uae_u32 REGPARAM3 uaeexe_server (TrapContext *context) REGPARAM;
/*
loop = here ();
org (UAEEXE_ORG);
- calltrap (deftrapres (uaeexe_server, 0, "uaeexe_server"));
+ calltrap (deftrapres (uaeexe_server, 0, L"uaeexe_server"));
dw (RTS);
org (loop);
}
* to launch the command asynchronously. Please note also that the
* remote cli works better if you've got the fifo-handler installed.
*/
-int uaeexe (const char *cmd)
+int uaeexe (const TCHAR *cmd)
{
struct uae_xcmd *nw;
nw = malloc (sizeof *nw);
if (!nw)
goto NOMEM;
- nw->cmd = malloc (strlen (cmd) + 1);
+ nw->cmd = malloc ((_tcslen (cmd) + 1) * sizeof (TCHAR));
if (!nw->cmd) {
free (nw);
goto NOMEM;
}
- strcpy (nw->cmd, cmd);
+ _tcscpy (nw->cmd, cmd);
nw->prev = last;
nw->next = NULL;
NOMEM:
return UAEEXE_NOMEM;
NORUN:
- write_log ("Remote cli is not running.\n");
+ write_log (L"Remote cli is not running.\n");
return UAEEXE_NOTRUNNING;
}
/*
* returns next command to be executed
*/
-static char *get_cmd (void)
+static TCHAR *get_cmd (void)
{
struct uae_xcmd *cmd;
- char *s;
+ TCHAR *s;
if (!first)
return NULL;
static uae_u32 REGPARAM2 uaeexe_server (TrapContext *context)
{
int len;
- char *cmd;
- char *dst;
+ TCHAR *cmd;
+ char *dst, *s;
if (ARG (0) && !running) {
running = 1;
- write_log ("Remote CLI started.\n");
+ write_log (L"Remote CLI started.\n");
}
cmd = get_cmd ();
return 0;
}
- dst = (char *)get_real_address (ARG (0));
+ dst = (char*)get_real_address (ARG (0));
len = ARG (1);
- strncpy (dst, cmd, len);
- write_log ("Sending '%s' to remote cli\n", cmd);
- free (cmd);
+ s = ua (cmd);
+ strncpy (dst, s, len);
+ write_log (L"Sending '%s' to remote cli\n", cmd);
+ xfree (s);
+ xfree (cmd);
return ARG (0);
}
uae_u8 buffer[IPC_BUFFER_SIZE], outbuf[IPC_BUFFER_SIZE];
int connected, readpending, writepending;
int binary;
- char *outmsg[MAX_OUTMESSAGES];
+ TCHAR *outmsg[MAX_OUTMESSAGES];
int outmessages;
uae_u8 outbin[MAX_OUTMESSAGES][MAX_BINMESSAGE];
int outbinlen[MAX_OUTMESSAGES];
};
-static void parsemessage(char *in, struct uae_prefs *p, char *out, int outsize)
+static void parsemessage(TCHAR *in, struct uae_prefs *p, TCHAR *out, int outsize)
{
out[0] = 0;
- if (!memcmp(in, "CFG ", 4) || !memcmp(in, "EVT ", 4)) {
- char tmpout[256];
+ if (!_tcsncmp (in, L"CFG ", 4) || !_tcsncmp (in, L"EVT ", 4)) {
+ TCHAR tmpout[256];
int index = -1;
int cnt = 0;
in += 4;
for (;;) {
int ret;
tmpout[0] = 0;
- ret = cfgfile_modify (index, in, strlen (in), tmpout, sizeof (tmpout));
+ ret = cfgfile_modify (index, in, _tcslen (in), tmpout, sizeof (tmpout) * sizeof (TCHAR));
index++;
- if (strlen(tmpout) > 0) {
- if (strlen(out) == 0)
- strcat (out, "200 ");
- strncat (out, "\n", outsize);
- strncat (out, tmpout, outsize);
+ if (_tcslen (tmpout) > 0) {
+ if (_tcslen (out) == 0)
+ _tcscat (out, L"200 ");
+ _tcsncat (out, L"\n", outsize);
+ _tcsncat (out, tmpout, outsize);
}
cnt++;
if (ret >= 0)
break;
}
- if (strlen (out) == 0)
- strcat (out, "404");
+ if (_tcslen (out) == 0)
+ _tcscat (out, L"404");
} else {
- strcpy (out, "501");
+ _tcscpy (out, L"501");
}
}
memset(&ipc->ol, 0, sizeof (OVERLAPPED));
ipc->ol.hEvent = ipc->olevent;
if (ConnectNamedPipe(ipc->hipc, &ipc->ol)) {
- write_log ("IPC: ConnectNamedPipe init failed, err=%d\n", GetLastError());
+ write_log (L"IPC: ConnectNamedPipe init failed, err=%d\n", GetLastError());
closeIPC(ipc);
return 0;
}
err = GetLastError();
if (err == ERROR_PIPE_CONNECTED) {
if (SetEvent(ipc->olevent)) {
- write_log ("IPC: ConnectNamedPipe SetEvent failed, err=%d\n", GetLastError());
+ write_log (L"IPC: ConnectNamedPipe SetEvent failed, err=%d\n", GetLastError());
closeIPC(ipc);
return 0;
}
} else if (err != ERROR_IO_PENDING) {
- write_log ("IPC: ConnectNamedPipe failed, err=%d\n", err);
+ write_log (L"IPC: ConnectNamedPipe failed, err=%d\n", err);
closeIPC(ipc);
return 0;
}
ipc->readpending = ipc->writepending = FALSE;
if (ipc->connected) {
if (!DisconnectNamedPipe(ipc->hipc))
- write_log ("IPC: DisconnectNamedPipe failed, err=%d\n", GetLastError());
+ write_log (L"IPC: DisconnectNamedPipe failed, err=%d\n", GetLastError());
ipc->connected = FALSE;
}
}
xfree (ipc);
}
-void *createIPC(const char *name, int binary)
+void *createIPC(const TCHAR *name, int binary)
{
- char tmpname[100];
+ TCHAR tmpname[100];
int cnt = 0;
struct uaeipc *ipc;
ipc->olevent = INVALID_HANDLE_VALUE;
ipc->binary = 1;
while (cnt < 10) {
- sprintf (tmpname, "\\\\.\\pipe\\%s", name);
+ _stprintf (tmpname, L"\\\\.\\pipe\\%s", name);
if (cnt > 0) {
- char *p = tmpname + strlen (tmpname);
- sprintf(p, "_%d", cnt);
+ TCHAR *p = tmpname + _tcslen (tmpname);
+ _stprintf (p, L"_%d", cnt);
}
- ipc->hipc = CreateNamedPipe(tmpname,
+ ipc->hipc = CreateNamedPipe (tmpname,
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED | FILE_FLAG_FIRST_PIPE_INSTANCE,
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE,
1, IPC_BUFFER_SIZE, IPC_BUFFER_SIZE,
NMPWAIT_USE_DEFAULT_WAIT, NULL);
if (ipc->hipc == INVALID_HANDLE_VALUE) {
- DWORD err = GetLastError();
+ DWORD err = GetLastError ();
if (err == ERROR_ALREADY_EXISTS || err == ERROR_PIPE_BUSY) {
cnt++;
continue;
}
break;
}
- write_log ("IPC: Named Pipe '%s' open\n", tmpname);
+ write_log (L"IPC: Named Pipe '%s' open\n", tmpname);
ipc->olevent = CreateEvent(NULL, TRUE, TRUE, NULL);
if (listenIPC(ipc))
return ipc;
return ipc->olevent;
}
-int sendIPC(struct uaeipc *ipc, char *msg)
+int sendIPC(struct uaeipc *ipc, TCHAR *msg)
{
if (ipc->hipc == INVALID_HANDLE_VALUE)
return 0;
memset (&ipc->ol, 0, sizeof (OVERLAPPED));
ipc->ol.hEvent = ipc->olevent;
if (ipc->binary) {
- ok = WriteFile(ipc->hipc, &ipc->outbin[ipc->outmessages][0], ipc->outbinlen[ipc->outmessages], &ret, &ipc->ol);
+ ok = WriteFile (ipc->hipc, &ipc->outbin[ipc->outmessages][0], ipc->outbinlen[ipc->outmessages], &ret, &ipc->ol);
} else {
- ok = WriteFile(ipc->hipc, ipc->outmsg[ipc->outmessages], strlen (ipc->outmsg[ipc->outmessages]) + 1, &ret, &ipc->ol);
+ ok = WriteFile (ipc->hipc, ipc->outmsg[ipc->outmessages], (_tcslen (ipc->outmsg[ipc->outmessages]) + 1) * sizeof (TCHAR), &ret, &ipc->ol);
}
- xfree(ipc->outmsg[ipc->outmessages--]);
- err = GetLastError();
+ xfree (ipc->outmsg[ipc->outmessages--]);
+ err = GetLastError ();
if (!ok && err != ERROR_IO_PENDING) {
- write_log ("IPC: WriteFile() err=%d\n", err);
- resetIPC(ipc);
+ write_log (L"IPC: WriteFile() err=%d\n", err);
+ resetIPC (ipc);
return 0;
}
ipc->writepending = TRUE;
return 1;
}
if (ipc->readpending || ipc->writepending) {
- ok = GetOverlappedResult(ipc->hipc, &ipc->ol, &ret, FALSE);
+ ok = GetOverlappedResult (ipc->hipc, &ipc->ol, &ret, FALSE);
if (!ok) {
- err = GetLastError();
+ err = GetLastError ();
if (err == ERROR_IO_INCOMPLETE)
return 0;
- write_log ("IPC: GetOverlappedResult error %d\n", err);
- resetIPC(ipc);
+ write_log (L"IPC: GetOverlappedResult error %d\n", err);
+ resetIPC (ipc);
return 0;
}
if (!ipc->connected) {
- write_log ("IPC: Pipe connected\n");
+ write_log (L"IPC: Pipe connected\n");
ipc->connected = TRUE;
return 0;
}
}
}
if (!ipc->readpending) {
- ok = ReadFile(ipc->hipc, ipc->buffer, IPC_BUFFER_SIZE, &ret, &ipc->ol);
- err = GetLastError();
+ ok = ReadFile (ipc->hipc, ipc->buffer, IPC_BUFFER_SIZE, &ret, &ipc->ol);
+ err = GetLastError ();
if (!ok) {
if (err == ERROR_IO_PENDING) {
ipc->readpending = TRUE;
return 0;
} else if (err == ERROR_BROKEN_PIPE) {
- write_log ("IPC: IPC client disconnected\n");
+ write_log (L"IPC: IPC client disconnected\n");
} else {
- write_log ("IPC: ReadFile() err=%d\n", err);
+ write_log (L"IPC: ReadFile() err=%d\n", err);
}
- resetIPC(ipc);
+ resetIPC (ipc);
return 0;
}
}
if (ipc->binary) {
} else {
- write_log ("IPC: got message '%s'\n", ipc->buffer);
- parsemessage((char*)ipc->buffer, p, (char*)ipc->outbuf, sizeof ipc->outbuf);
+ write_log (L"IPC: got message '%s'\n", ipc->buffer);
+ parsemessage ((TCHAR*)ipc->buffer, p, (TCHAR*)ipc->outbuf, sizeof ipc->outbuf);
memset (&ipc->ol, 0, sizeof (OVERLAPPED));
ipc->ol.hEvent = ipc->olevent;
- ok = WriteFile(ipc->hipc, ipc->outbuf, strlen ((char*)ipc->outbuf) + 1, &ret, &ipc->ol);
- err = GetLastError();
+ ok = WriteFile (ipc->hipc, ipc->outbuf, strlen ((char*)ipc->outbuf) + 1, &ret, &ipc->ol);
+ err = GetLastError ();
if (!ok && err != ERROR_IO_PENDING) {
- write_log ("IPC: WriteFile() err=%d\n", err);
- resetIPC(ipc);
+ write_log (L"IPC: WriteFile() err=%d\n", err);
+ resetIPC (ipc);
return 0;
}
ipc->writepending = TRUE;
return 1;
}
-int isIPC (const char *pipename)
+int isIPC (const TCHAR *pipename)
{
HANDLE *p;
if (memsize != 0x80000 && memsize != 0x100000 &&
memsize != 0x200000) {
memsize = 0x200000;
- write_log ("Unsupported chipmem size!\n");
+ write_log (L"Unsupported chipmem size!\n");
}
m68k_dreg (regs, 0) = 0;
if (memsize != 0x80000 && memsize != 0x100000 &&
memsize != 0x180000 && memsize != 0x1C0000) {
memsize = 0;
- write_log ("Unsupported bogomem size!\n");
+ write_log (L"Unsupported bogomem size!\n");
}
m68k_dreg (regs, 0) = 0;
if (memsize != 0x100000 && memsize != 0x200000 &&
memsize != 0x400000 && memsize != 0x800000) {
memsize = 0;
- write_log ("Unsupported fastmem size!\n");
+ write_log (L"Unsupported fastmem size!\n");
}
m68k_dreg (regs, 0) = 0;
currprefs.fastmem_size = memsize;
{
int i = 0;
char real_name[256];
+ TCHAR *s;
if (drive > 3)
return 0;
if (i == 255)
return 0; /* ENAMETOOLONG */
- strcpy (changed_prefs.df[drive], real_name);
+ s = au (real_name);
+ _tcscpy (changed_prefs.df[drive], s);
+ xfree (s);
return 1;
}
#endif
}
-/* We simply find the first "text" hunk, get the offset of its actual code segment (20 bytes away)
- * and add that offset to the base address of the object. Now we've got code to execute.
- *
- * @@@ Brian: does anything actually use this yet?
- * @@@ Bernd: Not yet. It needs to get much better. Should spawn off a seperate task to handle the
- * function, and then somehow "signal" the Amiga caller that completion or error has
- * occurred. I don't know how to do that, so right now it is a synchronous call. Yuck!
- * Would be nice to implement jpg decompression functionality for the Amiga which used
- * the UAE Host to do all the work, for example.
- * @@@ Brian: I disabled it to prevent people from starting to use it - if that happens, we're
- * stuck with this.
- */
-static uae_u32 FindFunctionInObject (uae_u8 *objectptr)
-{
- uae_u8 *text_hdr;
- uae_u8 offset;
- text_hdr = (uae_u8 *)strstr ("text", (char *)objectptr);
- if (text_hdr != 0) {
- offset = *(text_hdr + 19);
- return (uae_u32)(objectptr + offset);
- }
- return 0;
-}
#define CREATE_NATIVE_FUNC_PTR uae_u32 (* native_func) (uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, \
uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32)
static int native_dos_op (uae_u32 mode, uae_u32 p1, uae_u32 p2, uae_u32 p3)
{
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
+ char *s;
int v, i;
if (mode)
v = get_native_path (p1, tmp);
if (v)
return v;
- for (i = 0; i <= strlen(tmp) && i < p3 - 1; i++) {
- put_byte (p2 + i, tmp[i]);
+ s = ua (tmp);
+ for (i = 0; i <= strlen (s) && i < p3 - 1; i++) {
+ put_byte (p2 + i, s[i]);
put_byte (p2 + i + 1, 0);
}
+ xfree (s);
return 0;
}
#ifndef UAEGFX_INTERNAL
case 85: return native_dos_op (ARG1, ARG2, ARG3, ARG4);
case 86:
if (valid_address (ARG1, 1))
- write_log ("DBG: %s\n", get_real_address (ARG1));
+ write_log (L"DBG: %s\n", get_real_address (ARG1));
return 1;
}
return 0;
struct regstruct *r = &context->regs;
if (uaelib_debug)
- write_log ("%d: %08x %08x %08x %08x %08x %08x %08x %08x, %08x %08x %08x %08x %08x %08x %08x %08x\n",
+ write_log (L"%d: %08x %08x %08x %08x %08x %08x %08x %08x, %08x %08x %08x %08x %08x %08x %08x %08x\n",
ARG0,
r->regs[0],r->regs[1],r->regs[2],r->regs[3],r->regs[4],r->regs[5],r->regs[6],r->regs[7],
r->regs[8],r->regs[9],r->regs[10],r->regs[11],r->regs[12],r->regs[13],r->regs[14],r->regs[15]);
#ifdef UAEGFX_INTERNAL
if (ARG0 >= 16 && ARG0 <= 39) {
- write_log ("uaelib: obsolete Picasso96 uaelib hook called, call ignored\n");
+ write_log (L"uaelib: obsolete Picasso96 uaelib hook called, call ignored\n");
return 0;
}
#endif
v = uaelib_demux2 (context);
if (uaelib_debug)
- write_log ("=%08x\n", v);
+ write_log (L"=%08x\n", v);
return v;
}
dw ((rtarea_base >> 16) | get_word (rtarea_base + 36));
dw (get_word (rtarea_base + 38) + 12);
#endif
- calltrap (deftrapres (uaelib_demux, 0, "uaelib_demux"));
+ calltrap (deftrapres (uaelib_demux, 0, L"uaelib_demux"));
dw (RTS);
org (a);
}
static uae_u32 REGPARAM2 res_getfunc (TrapContext *ctx)
{
uaecptr funcname = m68k_areg (&ctx->regs, 0);
- char tmp[256];
+ uae_char tmp[256];
+ uae_u32 p;
+ TCHAR *s;
+
if (funcname == 0)
return 0;
strcpyah_safe (tmp, funcname, sizeof tmp);
- return find_trap (tmp);
+ s = au (tmp);
+ p = find_trap (s);
+ xfree (s);
+ return p;
}
static uae_u32 REGPARAM2 res_initcode (TrapContext *ctx)
{
uae_u32 functable, datatable;
uae_u32 initcode, getfunc;
- char tmp[100];
+ TCHAR tmp[100];
- sprintf (tmp, "UAE resource %d.%d.%d", UAEMAJOR, UAEMINOR, UAESUBREV);
- res_name = ds ("uae.resource");
+ _stprintf (tmp, L"UAE resource %d.%d.%d", UAEMAJOR, UAEMINOR, UAESUBREV);
+ res_name = ds (L"uae.resource");
res_id = ds (tmp);
/* initcode */
static struct devstruct devst[MAX_TOTAL_DEVICES];
static uae_sem_t change_sem, async_sem;
-static char *getdevname (void)
+static TCHAR *getdevname (void)
{
- return "uaeserial.device";
+ return L"uaeserial.device";
}
-static void io_log (char *msg, uaecptr request)
+static void io_log (TCHAR *msg, uaecptr request)
{
if (log_uaeserial)
- write_log ("%s: %08X %d %08X %d %d io_actual=%d io_error=%d\n",
+ write_log (L"%s: %08X %d %08X %d %d io_actual=%d io_error=%d\n",
msg, request, get_word (request + 28), get_long (request + 40),
get_long (request + 36), get_long (request + 44),
get_long (request + 32), get_byte (request + 31));
{
init_comm_pipe (&dev->requests, 100, 1);
uae_sem_init (&dev->sync_sem, 0, 0);
- uae_start_thread ("uaeserial", dev_thread, dev, NULL);
+ uae_start_thread (L"uaeserial", dev_thread, dev, NULL);
uae_sem_wait (&dev->sync_sem);
return dev->thread_running;
}
if (!dev)
return 0;
if (log_uaeserial)
- write_log ("%s:%d close, req=%x\n", getdevname(), dev->unit, request);
+ write_log (L"%s:%d close, req=%x\n", getdevname(), dev->unit, request);
dev_close_3 (dev);
put_long (request + 24, 0);
put_word (m68k_areg (&context->regs, 6) + 32, get_word (m68k_areg (&context->regs, 6) + 32) - 1);
rbuffer = get_long (req + io_RBufLen);
v = get_long (req + io_ExtFlags);
if (v) {
- write_log ("UAESER: io_ExtFlags=%08x, not supported\n", v);
+ write_log (L"UAESER: io_ExtFlags=%08x, not supported\n", v);
return 5;
}
baud = get_long (req + io_Baud);
v = get_byte (req + io_SerFlags);
if (v & SERF_EOFMODE) {
- write_log ("UAESER: SERF_EOFMODE not supported\n");
+ write_log (L"UAESER: SERF_EOFMODE not supported\n");
return 5;
}
xonxoff = (v & SERF_XDISABLED) ? 0 : 1;
wbits = get_byte (req + io_WriteLen);
sbits = get_byte (req + io_StopBits);
if ((rbits != 7 && rbits != 8) || (wbits != 7 && wbits != 8) || (sbits != 1 && sbits != 2) || rbits != wbits) {
- write_log ("UAESER: Read=%d, Write=%d, Stop=%d, not supported\n", rbits, wbits, sbits);
+ write_log (L"UAESER: Read=%d, Write=%d, Stop=%d, not supported\n", rbits, wbits, sbits);
return 5;
}
- write_log ("%s:%d BAUD=%d BUF=%d BITS=%d+%d RTSCTS=%d PAR=%d XO=%06X\n",
+ write_log (L"%s:%d BAUD=%d BUF=%d BITS=%d+%d RTSCTS=%d PAR=%d XO=%06X\n",
getdevname(), dev->unit,
baud, rbuffer, rbits, sbits, rtscts, parity, xonxoff);
v = uaeser_setparams (dev->sysdata, baud, rbuffer,
rbits, sbits, rtscts, parity, xonxoff);
if (v) {
- write_log ("->failed\n");
+ write_log (L"->failed\n");
return v;
}
return 0;
return openfail (ioreq, err);
}
if (log_uaeserial)
- write_log ("%s:%d open ioreq=%08X\n", getdevname(), unit, ioreq);
+ write_log (L"%s:%d open ioreq=%08X\n", getdevname(), unit, ioreq);
start_thread (dev);
put_word (m68k_areg (&context->regs, 6) + 32, get_word (m68k_areg (&context->regs, 6) + 32) + 1);
struct asyncreq *ar, *ar2;
if (log_uaeserial)
- write_log ("%s:%d async request %x added\n", getdevname(), dev->unit, request);
+ write_log (L"%s:%d async request %x added\n", getdevname(), dev->unit, request);
uae_sem_wait (&async_sem);
ar = (struct asyncreq*)xcalloc (sizeof (struct asyncreq), 1);
uae_sem_post (&async_sem);
xfree (ar);
if (log_uaeserial)
- write_log ("%s:%d async request %x removed\n", getdevname(), dev->unit, request);
+ write_log (L"%s:%d async request %x removed\n", getdevname(), dev->unit, request);
return 1;
}
prevar = ar;
ar = ar->next;
}
uae_sem_post (&async_sem);
- write_log ("%s:%d async request %x not found for removal!\n", getdevname(), dev->unit, request);
+ write_log (L"%s:%d async request %x not found for removal!\n", getdevname(), dev->unit, request);
return 0;
}
{
struct asyncreq *ar = get_async_request (dev, request, 1);
if (!ar) {
- write_log ("%s:%d: abort async but no request %x found!\n", getdevname(), dev->unit, request);
+ write_log (L"%s:%d: abort async but no request %x found!\n", getdevname(), dev->unit, request);
return;
}
if (log_uaeserial)
- write_log ("%s:%d asyncronous request=%08X aborted\n", getdevname(), dev->unit, request);
+ write_log (L"%s:%d asyncronous request=%08X aborted\n", getdevname(), dev->unit, request);
put_byte (request + 31, IOERR_ABORTED);
put_byte (request + 30, get_byte (request + 30) | 0x20);
write_comm_pipe_u32 (&dev->requests, request, 1);
}
break;
default:
- write_log ("%s:%d incorrect async request %x (cmd=%d) signaled?!", getdevname(), dev->unit, request, command);
+ write_log (L"%s:%d incorrect async request %x (cmd=%d) signaled?!", getdevname(), dev->unit, request, command);
break;
}
if (io_done) {
if (log_uaeserial)
- write_log ("%s:%d async request %x completed\n", getdevname(), dev->unit, request);
+ write_log (L"%s:%d async request %x completed\n", getdevname(), dev->unit, request);
put_long (request + 32, io_actual);
put_byte (request + 31, io_error);
ar->ready = 1;
if (!dev)
return 0;
command = get_word (request + 28);
- io_log ("dev_io_START",request);
+ io_log (L"dev_io_START",request);
switch (command)
{
}
put_long (request + 32, io_actual);
put_byte (request + 31, io_error);
- io_log ("dev_io_END",request);
+ io_log (L"dev_io_END",request);
return async;
}
put_byte (request + 31, 0);
if ((flags & 1) && dev_canquick (dev, request)) {
if (dev_do_io (dev, request, 1))
- write_log ("device %s:%d command %d bug with IO_QUICK\n", getdevname(), dev->unit, command);
+ write_log (L"device %s:%d command %d bug with IO_QUICK\n", getdevname(), dev->unit, command);
return get_byte (request + 31);
} else {
put_byte (request + 30, get_byte (request + 30) & ~1);
{
uae_u32 base = m68k_dreg (&context->regs, 0);
if (log_uaeserial)
- write_log ("%s init\n", getdevname ());
+ write_log (L"%s init\n", getdevname ());
return base;
}
if (!currprefs.uaeserial)
return resaddr;
if (log_uaeserial)
- write_log ("uaeserialdev_startup(0x%x)\n", resaddr);
+ write_log (L"uaeserialdev_startup(0x%x)\n", resaddr);
/* Build a struct Resident. This will set up and initialize
* the serial.device */
put_word (resaddr + 0x0, 0x4AFC);
if (!currprefs.uaeserial)
return;
- ROM_uaeserialdev_resname = ds ("uaeserial.device");
- ROM_uaeserialdev_resid = ds ("UAE serial.device 0.1");
+ ROM_uaeserialdev_resname = ds (L"uaeserial.device");
+ ROM_uaeserialdev_resid = ds (L"UAE serial.device 0.1");
/* initcode */
initcode = here ();
static struct zfile *zlist = 0;
-const char *uae_archive_extensions[] = { "zip", "rar", "7z", "lha", "lzh", "lzx", NULL };
+const TCHAR *uae_archive_extensions[] = { L"zip", L"rar", L"7z", L"lha", L"lzh", L"lzx", NULL };
static struct zfile *zfile_create (void)
{
if (f->f)
fclose (f->f);
if (f->deleteafterclose) {
- unlink (f->name);
- write_log ("deleted temporary file '%s'\n", f->name);
+ _wunlink (f->name);
+ write_log (L"deleted temporary file '%s'\n", f->name);
}
xfree (f->name);
xfree (f->data);
return;
while (l != f) {
if (l == 0) {
- write_log ("zfile: tried to free already freed filehandle!\n");
+ write_log (L"zfile: tried to free already freed filehandle!\n");
return;
}
pl = l;
pl->next = nxt;
}
-static uae_u8 exeheader[]={0x00,0x00,0x03,0xf3,0x00,0x00,0x00,0x00};
-static char *diskimages[] = { "adf", "adz", "ipf", "fdi", "dms", "wrp", "dsq", 0 };
+static uae_u8 exeheader[]={ 0x00,0x00,0x03,0xf3,0x00,0x00,0x00,0x00 };
+static TCHAR *diskimages[] = { L"adf", L"adz", L"ipf", L"fdi", L"dms", L"wrp", L"dsq", 0 };
int zfile_gettype (struct zfile *z)
{
uae_u8 buf[8];
- char *ext;
+ TCHAR *ext;
if (!z || !z->name)
return ZFILE_UNKNOWN;
- ext = strrchr (z->name, '.');
+ ext = _tcsrchr (z->name, '.');
if (ext != NULL) {
int i;
ext++;
if (strcasecmp (ext, diskimages[i]) == 0)
return ZFILE_DISKIMAGE;
}
- if (strcasecmp (ext, "roz") == 0)
+ if (strcasecmp (ext, L"roz") == 0)
return ZFILE_ROM;
- if (strcasecmp (ext, "uss") == 0)
+ if (strcasecmp (ext, L"uss") == 0)
return ZFILE_STATEFILE;
- if (strcasecmp (ext, "rom") == 0)
+ if (strcasecmp (ext, L"rom") == 0)
return ZFILE_ROM;
- if (strcasecmp (ext, "key") == 0)
+ if (strcasecmp (ext, L"key") == 0)
return ZFILE_KEY;
- if (strcasecmp (ext, "nvr") == 0)
+ if (strcasecmp (ext, L"nvr") == 0)
return ZFILE_NVR;
- if (strcasecmp (ext, "uae") == 0)
+ if (strcasecmp (ext, L"uae") == 0)
return ZFILE_CONFIGURATION;
}
memset (buf, 0, sizeof (buf));
if (!memcmp (buf, "DOS", 3))
return ZFILE_HDF;
if (ext != NULL) {
- if (strcasecmp (ext, "hdf") == 0)
+ if (strcasecmp (ext, L"hdf") == 0)
return ZFILE_HDF;
- if (strcasecmp (ext, "hdz") == 0)
+ if (strcasecmp (ext, L"hdz") == 0)
return ZFILE_HDF;
}
return ZFILE_UNKNOWN;
z_stream zs;
int i, size, ret, first;
uae_u8 flags;
- long offset;
- char name[MAX_DPATH];
+ uae_s64 offset;
+ TCHAR name[MAX_DPATH];
uae_u8 buffer[8192];
struct zfile *z2;
uae_u8 b;
- strcpy (name, z->name);
+ _tcscpy (name, z->name);
memset (&zs, 0, sizeof (zs));
memset (header, 0, sizeof (header));
zfile_fread (header, sizeof (header), 1, z);
{
struct zfile *zo;
- zo = zfile_fopen_empty ("zipped.dsq", 1760 * 512);
+ zo = zfile_fopen_empty (L"zipped.dsq", 1760 * 512);
if (zo) {
struct zvolume *zv = archive_directory_lzx (z);
if (zv) {
int ret;
struct zfile *zo;
- zo = zfile_fopen_empty ("undms.adf", 1760 * 512);
+ zo = zfile_fopen_empty (L"undms.adf", 1760 * 512);
if (!zo)
return z;
ret = DMS_Process_File (z, zo, CMD_UNPACK, OPT_VERBOSE, 0, 0);
return z;
}
-const char *uae_ignoreextensions[] =
- { ".gif", ".jpg", ".png", ".xml", ".pdf", ".txt", 0 };
-const char *uae_diskimageextensions[] =
- { ".adf", ".adz", ".ipf", ".fdi", ".exe", ".dms", ".wrp", ".dsq", 0 };
+const TCHAR *uae_ignoreextensions[] =
+ { L".gif", L".jpg", L".png", L".xml", L".pdf", L".txt", 0 };
+const TCHAR *uae_diskimageextensions[] =
+ { L".adf", L".adz", L".ipf", L".fdi", L".exe", L".dms", L".wrp", L".dsq", 0 };
-int zfile_is_ignore_ext (const char *name)
+int zfile_is_ignore_ext (const TCHAR *name)
{
int i;
for (i = 0; uae_ignoreextensions[i]; i++) {
- if (strlen(name) > strlen (uae_ignoreextensions[i]) &&
- !strcasecmp (uae_ignoreextensions[i], name + strlen (name) - strlen (uae_ignoreextensions[i])))
+ if (_tcslen(name) > _tcslen (uae_ignoreextensions[i]) &&
+ !strcasecmp (uae_ignoreextensions[i], name + _tcslen (name) - _tcslen (uae_ignoreextensions[i])))
return 1;
}
return 0;
}
-int zfile_isdiskimage (const char *name)
+int zfile_isdiskimage (const TCHAR *name)
{
int i;
i = 0;
while (uae_diskimageextensions[i]) {
- if (strlen (name) > 3 && !strcasecmp (name + strlen (name) - 4, uae_diskimageextensions[i]))
+ if (_tcslen (name) > 3 && !strcasecmp (name + _tcslen (name) - 4, uae_diskimageextensions[i]))
return 1;
i++;
}
}
-static const char *plugins_7z[] = { "7z", "rar", "zip", "lha", "lzh", "lzx", NULL };
-static const char *plugins_7z_x[] = { "7z", "Rar!", "MK", NULL, NULL, NULL, NULL };
+static const TCHAR *plugins_7z[] = { L"7z", L"rar", L"zip", L"lha", L"lzh", L"lzx", NULL };
+static const TCHAR *plugins_7z_x[] = { L"7z", L"Rar!", L"MK", NULL, NULL, NULL, NULL };
static const int plugins_7z_t[] = { ArchiveFormat7Zip, ArchiveFormatRAR, ArchiveFormatZIP, ArchiveFormatLHA, ArchiveFormatLHA, ArchiveFormatLZX };
int iszip (struct zfile *z)
{
- char *name = z->name;
- char *ext = strrchr (name, '.');
+ TCHAR *name = z->name;
+ TCHAR *ext = _tcsrchr (name, '.');
uae_u8 header[7];
int i;
zfile_fseek (z, 0, SEEK_SET);
zfile_fread (header, sizeof (header), 1, z);
zfile_fseek (z, 0, SEEK_SET);
- if (!strcasecmp (ext, ".zip") && header[0] == 'P' && header[1] == 'K')
+ if (!strcasecmp (ext, L".zip") && header[0] == 'P' && header[1] == 'K')
return ArchiveFormatZIP;
- if (!strcasecmp (ext, ".7z") && header[0] == '7' && header[1] == 'z')
+ if (!strcasecmp (ext, L".7z") && header[0] == '7' && header[1] == 'z')
return ArchiveFormat7Zip;
- if (!strcasecmp (ext, ".rar") && header[0] == 'R' && header[1] == 'a' && header[2] == 'r' && header[3] == '!')
+ if (!strcasecmp (ext, L".rar") && header[0] == 'R' && header[1] == 'a' && header[2] == 'r' && header[3] == '!')
return ArchiveFormatRAR;
- if ((!strcasecmp (ext, ".lha") || !strcasecmp (ext, ".lzh")) && header[2] == '-' && header[3] == 'l' && header[4] == 'h' && header[6] == '-')
+ if ((!strcasecmp (ext, L".lha") || !strcasecmp (ext, L".lzh")) && header[2] == '-' && header[3] == 'l' && header[4] == 'h' && header[6] == '-')
return ArchiveFormatLHA;
- if (!strcasecmp (ext, ".lzx") && header[0] == 'L' && header[1] == 'Z' && header[2] == 'X')
+ if (!strcasecmp (ext, L".lzx") && header[0] == 'L' && header[1] == 'Z' && header[2] == 'X')
return ArchiveFormatLZX;
#if defined(ARCHIVEACCESS)
for (i = 0; plugins_7z_x[i]; i++) {
if (plugins_7z_x[i] && !strcasecmp (ext + 1, plugins_7z[i]) &&
- !memcmp (header, plugins_7z_x[i], strlen (plugins_7z_x[i])))
+ !memcmp (header, plugins_7z_x[i], _tcslen (plugins_7z_x[i])))
return plugins_7z_t[i];
}
#endif
static struct zfile *zuncompress (struct zfile *z, int dodefault)
{
- char *name = z->name;
- char *ext = strrchr (name, '.');
+ TCHAR *name = z->name;
+ TCHAR *ext = _tcsrchr (name, '.');
uae_u8 header[7];
int i;
if (ext != NULL) {
ext++;
- if (strcasecmp (ext, "7z") == 0)
+ if (strcasecmp (ext, L"7z") == 0)
return archive_access_select (z, ArchiveFormat7Zip, dodefault);
- if (strcasecmp (ext, "zip") == 0)
+ if (strcasecmp (ext, L"zip") == 0)
return archive_access_select (z, ArchiveFormatZIP, dodefault);
- if (strcasecmp (ext, "lha") == 0 || strcasecmp (ext, "lzh") == 0)
+ if (strcasecmp (ext, L"lha") == 0 || strcasecmp (ext, L"lzh") == 0)
return archive_access_select (z, ArchiveFormatLHA, dodefault);
- if (strcasecmp (ext, "lzx") == 0)
+ if (strcasecmp (ext, L"lzx") == 0)
return archive_access_select (z, ArchiveFormatLZX, dodefault);
- if (strcasecmp (ext, "rar") == 0)
+ if (strcasecmp (ext, L"rar") == 0)
return archive_access_select (z, ArchiveFormatRAR, dodefault);
- if (strcasecmp (ext, "gz") == 0)
+ if (strcasecmp (ext, L"gz") == 0)
return zfile_gunzip (z);
- if (strcasecmp (ext, "adz") == 0)
+ if (strcasecmp (ext, L"adz") == 0)
return zfile_gunzip (z);
- if (strcasecmp (ext, "roz") == 0)
+ if (strcasecmp (ext, L"roz") == 0)
return zfile_gunzip (z);
- if (strcasecmp (ext, "hdz") == 0)
+ if (strcasecmp (ext, L"hdz") == 0)
return zfile_gunzip (z);
- if (strcasecmp (ext, "dms") == 0)
+ if (strcasecmp (ext, L"dms") == 0)
return dms (z);
- if (strcasecmp (ext, "wrp") == 0)
+ if (strcasecmp (ext, L"wrp") == 0)
return wrp (z);
- if (strcasecmp (ext, "dsq") == 0)
+ if (strcasecmp (ext, L"dsq") == 0)
return dsq (z);
#if defined(ARCHIVEACCESS)
for (i = 0; plugins_7z_x[i]; i++) {
{
uae_u8 *p = singlefile_data;
int size, offset;
- char tmp[256], *s;
+ TCHAR tmp[256], *s;
- strcpy (tmp, l->name);
- s = tmp + strlen (tmp) - 1;
+ _tcscpy (tmp, l->name);
+ s = tmp + _tcslen (tmp) - 1;
while (*s != 0 && *s != '/' && *s != '\\') s--;
if (s > tmp)
s++;
- write_log ("loading from singlefile: '%s'\n", tmp);
+ write_log (L"loading from singlefile: '%s'\n", tmp);
while (*p++);
offset = (p[0] << 24)|(p[1] << 16)|(p[2] << 8)|(p[3] << 0);
p += 4;
if (!strcmpi (tmp, p + 4)) {
l->data = singlefile_data + offset;
l->size = size;
- write_log ("found, size %d\n", size);
+ write_log (L"found, size %d\n", size);
return l;
}
offset += size;
p += 4;
- p += strlen (p) + 1;
+ p += _tcslen (p) + 1;
}
- write_log ("not found\n");
+ write_log (L"not found\n");
return 0;
}
#endif
-struct zfile *zfile_fopen_nozip (const char *name, const char *mode)
+struct zfile *zfile_fopen_nozip (const TCHAR *name, const TCHAR *mode)
{
struct zfile *l;
FILE *f;
if(*name == '\0')
return NULL;
l = zfile_create ();
- l->name = strdup (name);
- f = fopen (name, mode);
+ l->name = my_strdup (name);
+ f = _tfopen (name, mode);
if (!f) {
zfile_fclose (l);
return 0;
}
-static struct zfile *openzip (const char *pname)
+static struct zfile *openzip (const TCHAR *pname)
{
int i, j;
- char v;
- char name[MAX_DPATH];
- char zippath[MAX_DPATH];
+ TCHAR v;
+ TCHAR name[MAX_DPATH];
+ TCHAR zippath[MAX_DPATH];
zippath[0] = 0;
- strcpy (name, pname);
- i = strlen (name) - 2;
+ _tcscpy (name, pname);
+ i = _tcslen (name) - 2;
while (i > 0) {
if (name[i] == '/' || name[i] == '\\' && i > 4) {
v = name[i];
name[i] = 0;
for (j = 0; plugins_7z[j]; j++) {
- int len = strlen (plugins_7z[j]);
+ int len = _tcslen (plugins_7z[j]);
if (name[i - len - 1] == '.' && !strcasecmp (name + i - len, plugins_7z[j])) {
- struct zfile *f = zfile_fopen_nozip (name, "rb");
+ struct zfile *f = zfile_fopen_nozip (name, L"rb");
if (f) {
f->zipname = my_strdup (name + i + 1);
return f;
return 0;
}
-static struct zfile *zfile_fopen_2 (const char *name, const char *mode)
+static struct zfile *zfile_fopen_2 (const TCHAR *name, const TCHAR *mode)
{
struct zfile *l;
FILE *f;
#endif
l = openzip (name);
if (l) {
- if (strcmpi (mode, "rb") && strcmpi (mode, "r")) {
+ if (_tcsicmp (mode, L"rb") && _tcsicmp (mode, L"r")) {
zfile_fclose (l);
return 0;
}
} else {
l = zfile_create ();
- l->name = strdup (name);
- f = fopen (l->name, mode);
+ l->name = my_strdup (name);
+ f = _tfopen (l->name, mode);
if (!f) {
zfile_fclose (l);
return 0;
#ifdef _WIN32
#include "win32.h"
-#define AF "%AMIGAFOREVERDATA%"
+#define AF L"%AMIGAFOREVERDATA%"
-static void manglefilename(char *out, const char *in)
+static void manglefilename (TCHAR *out, const TCHAR *in)
{
out[0] = 0;
- if (!strncasecmp (in, AF, strlen(AF)))
- strcpy (out, start_path_data);
- if ((in[0] == '/' || in[0] == '\\') || (strlen(in) > 3 && in[1] == ':' && in[2] == '\\'))
+ if (!strncasecmp (in, AF, _tcslen (AF)))
+ _tcscpy (out, start_path_data);
+ if ((in[0] == '/' || in[0] == '\\') || (_tcslen(in) > 3 && in[1] == ':' && in[2] == '\\'))
out[0] = 0;
- strcat (out, in);
+ _tcscat (out, in);
}
#else
-static void manglefilename(char *out, const char *in)
+static void manglefilename(TCHAR *out, const TCHAR *in)
{
- strcpy(out, in);
+ _tcscpy(out, in);
}
#endif
-int zfile_zopen (const char *name, zfile_callback zc, void *user)
+int zfile_zopen (const TCHAR *name, zfile_callback zc, void *user)
{
struct zfile *l;
int ztype;
- char path[MAX_DPATH];
+ TCHAR path[MAX_DPATH];
manglefilename (path, name);
- l = zfile_fopen_2 (path, "rb");
+ l = zfile_fopen_2 (path, L"rb");
if (!l)
return 0;
ztype = iszip (l);
/*
* fopen() for a compressed file
*/
-struct zfile *zfile_fopen (const char *name, const char *mode)
+struct zfile *zfile_fopen (const TCHAR *name, const TCHAR *mode)
{
int cnt = 10;
struct zfile *l, *l2;
- char path[MAX_DPATH];
+ TCHAR path[MAX_DPATH];
manglefilename (path, name);
l = zfile_fopen_2 (path, mode);
return nzf;
}
-int zfile_exists (const char *name)
+int zfile_exists (const TCHAR *name)
{
- char fname[2000];
+ TCHAR fname[2000];
struct zfile *f;
- if (strlen (name) == 0)
+ if (_tcslen (name) == 0)
return 0;
manglefilename (fname, name);
f = openzip (fname);
manglefilename (fname, name);
if (!my_existsfile (fname))
return 0;
- f2 = fopen (fname, "rb");
+ f2 = _tfopen (fname, L"rb");
if (!f2)
return 0;
fclose (f2);
return z->data ? 1 : 0;
}
-struct zfile *zfile_fopen_empty (const char *name, int size)
+struct zfile *zfile_fopen_empty (const TCHAR *name, uae_u64 size)
{
struct zfile *l;
l = zfile_create ();
- l->name = name ? strdup (name) : "";
+ l->name = name ? my_strdup (name) : L"";
if (size) {
l->data = xcalloc (size, 1);
l->size = size;
return l;
}
-struct zfile *zfile_fopen_data (const char *name, int size, uae_u8 *data)
+struct zfile *zfile_fopen_data (const TCHAR *name, uae_u64 size, uae_u8 *data)
{
struct zfile *l;
l = zfile_create ();
- l->name = name ? strdup (name) : "";
+ l->name = name ? my_strdup (name) : L"";
l->data = xmalloc (size);
l->size = size;
memcpy (l->data, data, size);
return l;
}
-long zfile_ftell (struct zfile *z)
+uae_s64 zfile_ftell (struct zfile *z)
{
if (z->data)
return z->seek;
- return ftell (z->f);
+ return _ftelli64 (z->f);
}
-int zfile_fseek (struct zfile *z, long offset, int mode)
+uae_s64 zfile_fseek (struct zfile *z, uae_s64 offset, int mode)
{
if (z->data) {
int ret = 0;
}
return ret;
}
- return fseek (z->f, offset, mode);
+ return _fseeki64 (z->f, offset, mode);
}
size_t zfile_fread (void *b, size_t l1, size_t l2,struct zfile *z)
return fwrite (b, l1, l2, z->f);
}
-size_t zfile_fputs (struct zfile *z, char *s)
+size_t zfile_fputs (struct zfile *z, TCHAR *s)
{
- return zfile_fwrite (s, strlen (s), 1, z);
+ char *s2 = ua (s);
+ size_t t;
+ t = zfile_fwrite (s2, strlen (s2), 1, z);
+ xfree (s2);
+ return t;
}
-char *zfile_fgets (char *s, int size, struct zfile *z)
+TCHAR *zfile_fgets (TCHAR *s, int size, struct zfile *z)
{
if (z->data) {
- char *os = s;
+ char s2[MAX_DPATH];
+ char *p = s2;
int i;
for (i = 0; i < size - 1; i++) {
if (z->seek == z->size) {
return NULL;
break;
}
- *s = z->data[z->seek++];
- if (*s == '\n') {
- s++;
+ *p = z->data[z->seek++];
+ if (*p == '\n') {
+ p++;
break;
}
- s++;
+ p++;
}
- *s = 0;
- return os;
+ *p = 0;
+ if (size > strlen (s2) + 1)
+ size = strlen (s2) + 1;
+ au_copy (s, size, s2);
+ return s + size;
} else {
- return fgets (s, size, z->f);
+ char s2[MAX_DPATH];
+ char *s1;
+ s1 = fgets (s2, size, z->f);
+ if (!s1)
+ return NULL;
+ if (size > strlen (s2) + 1)
+ size = strlen (s2) + 1;
+ au_copy (s, size, s2);
+ return s + size;
}
}
return 0;
}
-char *zfile_getdata (struct zfile *z, int offset, int len)
+uae_u8 *zfile_getdata (struct zfile *z, uae_s64 offset, int len)
{
- size_t pos;
+ uae_s64 pos;
uae_u8 *b;
if (len < 0)
len = z->size;
return zs.total_out;
}
-char *zfile_getname (struct zfile *f)
+TCHAR *zfile_getname (struct zfile *f)
{
return f->name;
}
static struct zvolume *zvolume_list;
-static struct znode *znode_alloc (struct znode *parent, const char *name)
+static struct znode *znode_alloc (struct znode *parent, const TCHAR *name)
{
- char fullpath[MAX_DPATH];
+ TCHAR fullpath[MAX_DPATH];
struct znode *zn = xcalloc (sizeof (struct znode), 1);
- sprintf (fullpath,"%s%c%s", parent->fullname, FSDB_DIR_SEPARATOR, name);
+ _stprintf (fullpath, L"%s%c%s", parent->fullname, FSDB_DIR_SEPARATOR, name);
zn->fullname = my_strdup (fullpath);
zn->name = my_strdup (name);
zn->volume = parent->volume;
return zn;
}
-static struct znode *znode_alloc_child (struct znode *parent, const char *name)
+static struct znode *znode_alloc_child (struct znode *parent, const TCHAR *name)
{
struct znode *zn = znode_alloc (parent, name);
zn->parent = parent;
return zn;
}
-static struct znode *znode_alloc_sibling (struct znode *sibling, const char *name)
+static struct znode *znode_alloc_sibling (struct znode *sibling, const TCHAR *name)
{
struct znode *zn = znode_alloc (sibling->parent, name);
}
}
-static struct zvolume *zvolume_alloc_2 (const char *name, struct zfile *z, unsigned int id, void *handle)
+static struct zvolume *zvolume_alloc_2 (const TCHAR *name, struct zfile *z, unsigned int id, void *handle)
{
struct zvolume *zv = xcalloc (sizeof (struct zvolume), 1);
struct znode *root;
- size_t pos;
+ uae_s64 pos;
root = &zv->root;
zv->last = root;
{
return zvolume_alloc_2 (zfile_getname (z), z, id, handle);
}
-struct zvolume *zvolume_alloc_empty (const char *name)
+struct zvolume *zvolume_alloc_empty (const TCHAR *name)
{
return zvolume_alloc_2(name, 0, 0, 0);
}
-static struct zvolume *get_zvolume (const char *path)
+static struct zvolume *get_zvolume (const TCHAR *path)
{
struct zvolume *zv = zvolume_list;
while (zv) {
- char *s = zfile_getname (zv->archive);
- if (strlen (path) >= strlen(s) && !memcmp (path, s, strlen(s)))
+ TCHAR *s = zfile_getname (zv->archive);
+ if (_tcslen (path) >= _tcslen(s) && !memcmp (path, s, _tcslen(s)))
return zv;
zv = zv->next;
}
static struct zvolume *zfile_fopen_archive_ext (struct zfile *zf)
{
struct zvolume *zv = NULL;
- char *ext = strrchr (zfile_getname(zf), '.');
+ TCHAR *ext = _tcsrchr (zfile_getname(zf), '.');
if (ext != NULL) {
ext++;
- if (strcasecmp (ext, "lha") == 0 || strcasecmp (ext, "lzh") == 0)
+ if (strcasecmp (ext, L"lha") == 0 || strcasecmp (ext, L"lzh") == 0)
zv = archive_directory_lha (zf);
- if (strcasecmp (ext, "zip") == 0)
+ if (strcasecmp (ext, L"zip") == 0)
zv = archive_directory_zip (zf);
- if (strcasecmp (ext, "7z") == 0)
+ if (strcasecmp (ext, L"7z") == 0)
zv = archive_directory_7z (zf);
- if (strcasecmp (ext, "lzx") == 0)
+ if (strcasecmp (ext, L"lzx") == 0)
zv = archive_directory_lzx (zf);
- if (strcasecmp (ext, "rar") == 0)
+ if (strcasecmp (ext, L"rar") == 0)
zv = archive_directory_rar (zf);
}
return zv;
return zv;
}
-static struct znode *get_znode (struct zvolume *zv, const char *ppath);
+static struct znode *get_znode (struct zvolume *zv, const TCHAR *ppath);
static int zfile_fopen_archive_recurse (struct zvolume *zv)
{
added = 0;
zn = zv->root.child;
while (zn) {
- char *ext = strrchr (zn->name, '.');
+ TCHAR *ext = _tcsrchr (zn->name, '.');
if (ext && !zn->vchild && zn->isfile) {
for (i = 0; plugins_7z[i]; i++) {
if (!strcasecmp (ext + 1, plugins_7z[i])) {
struct zvolume *zvnew;
struct znode *zndir;
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
- sprintf (tmp, "%s.DIR", zn->fullname + strlen (zv->root.name) + 1);
+ _stprintf (tmp, L"%s.DIR", zn->fullname + _tcslen (zv->root.name) + 1);
zndir = get_znode (zv, tmp);
if (!zndir) {
struct zarchive_info zai = { 0 };
return 0;
}
-static void recursivepath (char *path, struct zvolume *zv)
+static void recursivepath (TCHAR *path, struct zvolume *zv)
{
- char tmp[2] = { FSDB_DIR_SEPARATOR, 0 };
+ TCHAR tmp[2] = { FSDB_DIR_SEPARATOR, 0 };
if (!zv)
return;
recursivepath (path, zv->parent);
- strcat (path, zv->root.fullname);
- strcat (path, tmp);
+ _tcscat (path, zv->root.fullname);
+ _tcscat (path, tmp);
}
-static struct zvolume *prepare_recursive_volume (struct zvolume *zv, const char *path)
+static struct zvolume *prepare_recursive_volume (struct zvolume *zv, const TCHAR *path)
{
struct zfile *zf = NULL;
struct zvolume *zvnew = NULL;
- write_log ("unpacking '%s'\n", path);
+ write_log (L"unpacking '%s'\n", path);
zf = zfile_open_archive (path, 0);
if (!zf)
goto end;
zfile_fclose_archive (zv);
return zvnew;
end:
- write_log ("unpack failed\n");
+ write_log (L"unpack failed\n");
zfile_fclose_archive (zvnew);
zfile_fclose (zf);
return NULL;
}
-static struct znode *get_znode (struct zvolume *zv, const char *ppath)
+static struct znode *get_znode (struct zvolume *zv, const TCHAR *ppath)
{
struct znode *zn;
int prevlen = 0;
- char path[MAX_DPATH];
+ TCHAR path[MAX_DPATH];
if (!zv)
return NULL;
- strcpy (path, ppath);
+ _tcscpy (path, ppath);
zn = &zv->root;
while (zn) {
if (zn->isfile) {
- if (!stricmp (zn->fullname, path))
+ if (!_tcsicmp (zn->fullname, path))
return zn;
} else {
- int len = strlen (zn->fullname);
- if (strlen (path) >= len && (path[len] == 0 || path[len] == FSDB_DIR_SEPARATOR) && !strnicmp (zn->fullname, path, len)) {
+ int len = _tcslen (zn->fullname);
+ if (_tcslen (path) >= len && (path[len] == 0 || path[len] == FSDB_DIR_SEPARATOR) && !_tcsncmp (zn->fullname, path, len)) {
if (path[len] == 0)
return zn;
if (zn->vchild) {
/* jump to separate tree, recursive archives */
struct zvolume *zvdeep = zn->vchild;
- char *p = path + prevlen + 1;
+ TCHAR *p = path + prevlen + 1;
if (zvdeep->archive == NULL) {
zvdeep = prepare_recursive_volume (zvdeep, zn->fullname);
if (!zvdeep) {
- write_log ("failed to unpack '%s'\n", zn->fullname);
+ write_log (L"failed to unpack '%s'\n", zn->fullname);
return NULL;
}
/* replace dummy empty volume with real volume */
if (*p == 0)
return NULL;
p++;
- strcpy (path, zn->volume->root.name);
- memmove (path + strlen (path) + 1, p, strlen (p) + 1);
- path[strlen(path)] = FSDB_DIR_SEPARATOR;
+ _tcscpy (path, zn->volume->root.name);
+ memmove (path + _tcslen (path) + 1, p, _tcslen (p) + 1);
+ path[_tcslen(path)] = FSDB_DIR_SEPARATOR;
} else {
zn = zn->child;
}
}
-static void addvolumesize (struct zvolume *zv, int size)
+static void addvolumesize (struct zvolume *zv, uae_s64 size)
{
- int blocks = (size + 511) / 512;
+ unsigned int blocks = (size + 511) / 512;
if (blocks == 0)
blocks++;
}
}
-struct znode *znode_adddir (struct znode *parent, const char *name, struct zarchive_info *zai)
+struct znode *znode_adddir (struct znode *parent, const TCHAR *name, struct zarchive_info *zai)
{
struct znode *zn;
- char path[MAX_DPATH];
+ TCHAR path[MAX_DPATH];
- sprintf(path, "%s%c%s", parent->fullname, FSDB_DIR_SEPARATOR, name);
+ _stprintf (path, L"%s%c%s", parent->fullname, FSDB_DIR_SEPARATOR, name);
zn = get_znode (parent->volume, path);
if (zn)
return zn;
struct znode *zvolume_adddir_abs (struct zvolume *zv, struct zarchive_info *zai)
{
struct znode *zn2;
- char *path = my_strdup (zai->name);
- char *p, *p2;
+ TCHAR *path = my_strdup (zai->name);
+ TCHAR *p, *p2;
int i;
- if (strlen (path) > 0) {
+ if (_tcslen (path) > 0) {
/* remove possible trailing / or \ */
- char last;
- last = path[strlen (path) - 1];
+ TCHAR last;
+ last = path[_tcslen (path) - 1];
if (last == '/' || last == '\\')
- path[strlen (path) - 1] = 0;
+ path[_tcslen (path) - 1] = 0;
}
zn2 = &zv->root;
p = p2 = path;
{
struct znode *zn, *zn2;
int i;
- char *path = my_strdup (zai->name);
- char *p, *p2;
+ TCHAR *path = my_strdup (zai->name);
+ TCHAR *p, *p2;
zn2 = &zv->root;
p = p2 = path;
return zn;
}
-struct zvolume *zfile_fopen_archive (const char *filename)
+struct zvolume *zfile_fopen_archive (const TCHAR *filename)
{
struct zvolume *zv = NULL;
- struct zfile *zf = zfile_fopen_nozip (filename, "rb");
+ struct zfile *zf = zfile_fopen_nozip (filename, L"rb");
if (!zf)
return NULL;
struct znode *n;
};
-void *zfile_opendir_archive (const char *path)
+void *zfile_opendir_archive (const TCHAR *path)
{
struct zvolume *zv = get_zvolume (path);
struct znode *zn = get_znode (zv, path);
{
xfree (zd);
}
-int zfile_readdir_archive (struct zdirectory *zd, char *out)
+int zfile_readdir_archive (struct zdirectory *zd, TCHAR *out)
{
if (!zd->n)
return 0;
- strcpy (out, zd->n->name);
+ _tcscpy (out, zd->n->name);
zd->n = zd->n->sibling;
return 1;
}
-int zfile_fill_file_attrs_archive (const char *path, int *isdir, int *flags, char **comment)
+int zfile_fill_file_attrs_archive (const TCHAR *path, int *isdir, int *flags, TCHAR **comment)
{
struct zvolume *zv = get_zvolume (path);
struct znode *zn = get_znode (zv, path);
return 1;
}
-int zfile_fs_usage_archive (const char *path, const char *disk, struct fs_usage *fsp)
+int zfile_fs_usage_archive (const TCHAR *path, const TCHAR *disk, struct fs_usage *fsp)
{
struct zvolume *zv = get_zvolume (path);
return 0;
}
-int zfile_stat_archive (const char *path, struct stat *s)
+int zfile_stat_archive (const TCHAR *path, struct _stat64 *s)
{
struct zvolume *zv = get_zvolume (path);
struct znode *zn = get_znode (zv, path);
return 1;
}
-unsigned int zfile_lseek_archive (void *d, unsigned int offset, int whence)
+uae_s64 zfile_lseek_archive (void *d, uae_s64 offset, int whence)
{
if (zfile_fseek (d, offset, whence))
return -1;
/* do nothing, keep file cached */
}
-void *zfile_open_archive (const char *path, int flags)
+void *zfile_open_archive (const TCHAR *path, int flags)
{
struct zvolume *zv = get_zvolume (path);
struct znode *zn = get_znode (zv, path);
return zn->f;
}
-int zfile_exists_archive (const char *path, const char *rel)
+int zfile_exists_archive (const TCHAR *path, const TCHAR *rel)
{
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
struct zvolume *zv;
struct znode *zn;
- sprintf (tmp, "%s%c%s", path, FSDB_DIR_SEPARATOR, rel);
+ _stprintf (tmp, L"%s%c%s", path, FSDB_DIR_SEPARATOR, rel);
zv = get_zvolume (tmp);
zn = get_znode (zv, tmp);
return zn ? 1 : 0;
#include "win32.h"
#endif
-static time_t fromdostime(uae_u32 dd)
+static time_t fromdostime (uae_u32 dd)
{
struct tm tm;
time_t t;
- memset(&tm, 0, sizeof tm);
+
+ memset (&tm, 0, sizeof tm);
tm.tm_hour = (dd >> 11) & 0x1f;
tm.tm_min = (dd >> 5) & 0x3f;
tm.tm_sec = ((dd >> 0) & 0x1f) * 2;
tm.tm_year = ((dd >> 25) & 0x7f) + 80;
tm.tm_mon = ((dd >> 21) & 0x0f) - 1;
tm.tm_mday = (dd >> 16) & 0x1f;
- t = mktime(&tm);
- _tzset();
+ t = mktime (&tm);
+ _tzset ();
t -= _timezone;
return t;
}
-static struct zvolume *getzvolume(struct zfile *zf, unsigned int id)
+static struct zvolume *getzvolume (struct zfile *zf, unsigned int id)
{
struct zvolume *zv;
struct zvolume *zv;
struct znode *zn;
int zipcnt, first, select;
- char tmphist[MAX_DPATH];
+ TCHAR tmphist[MAX_DPATH];
struct zfile *z = NULL;
int we_have_file;
- zv = getzvolume(zf, id);
+ zv = getzvolume (zf, id);
if (!zv)
return zf;
we_have_file = 0;
if (!zn->isfile)
isok = 0;
- if (zfile_is_ignore_ext(zn->fullname))
+ if (zfile_is_ignore_ext (zn->fullname))
isok = 0;
if (isok) {
if (tmphist[0]) {
}
if (first) {
if (zfile_isdiskimage (zn->fullname))
- strcpy (tmphist, zn->fullname);
+ _tcscpy (tmphist, zn->fullname);
} else {
- strcpy (tmphist, zn->fullname);
+ _tcscpy (tmphist, zn->fullname);
DISK_history_add (tmphist, -1);
tmphist[0] = 0;
}
select = 0;
if (!zf->zipname)
select = 1;
- if (zf->zipname && strlen (zn->fullname) >= strlen (zf->zipname) && !strcasecmp (zf->zipname, zn->fullname + strlen (zn->fullname) - strlen (zf->zipname)))
+ if (zf->zipname && _tcslen (zn->fullname) >= _tcslen (zf->zipname) && !strcasecmp (zf->zipname, zn->fullname + _tcslen (zn->fullname) - _tcslen (zf->zipname)))
select = -1;
- if (zf->zipname && zf->zipname[0] == '#' && atol (zf->zipname + 1) == zipcnt)
+ if (zf->zipname && zf->zipname[0] == '#' && _tstol (zf->zipname + 1) == zipcnt)
select = -1;
if (select && !we_have_file) {
- z = archive_getzfile(zn, id);
+ z = archive_getzfile (zn, id);
if (z) {
if (select < 0 || zfile_gettype (z))
we_have_file = 1;
if (!we_have_file) {
- zfile_fclose(z);
+ zfile_fclose (z);
z = NULL;
}
}
DISK_history_add (zfile_getname(zf), -1);
zfile_fclose_archive (zv);
if (z) {
- zfile_fclose(zf);
+ zfile_fclose (zf);
zf = z;
} else if (!dodefault && zf->zipname && zf->zipname[0]) {
- zfile_fclose(zf);
+ zfile_fclose (zf);
zf = NULL;
}
return zf;
zfile_fclose (zf2);
} else {
int ret = zc (zf2, user);
- zfile_fclose(zf2);
+ zfile_fclose (zf2);
if (ret)
break;
}
{
unzFile uz;
unz_file_info file_info;
- char filename_inzip[MAX_DPATH];
struct zvolume *zv;
int err;
return 0;
if (unzGoToFirstFile (uz) != UNZ_OK)
return 0;
- zv = zvolume_alloc(z, ArchiveFormatZIP, uz);
+ zv = zvolume_alloc (z, ArchiveFormatZIP, uz);
for (;;) {
- char c;
+ char filename_inzip2[MAX_DPATH];
+ TCHAR c;
struct zarchive_info zai;
time_t t;
unsigned int dd;
- err = unzGetCurrentFileInfo(uz, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0);
+ TCHAR *filename_inzip;
+
+ err = unzGetCurrentFileInfo (uz, &file_info, filename_inzip2, sizeof (filename_inzip2), NULL, 0, NULL, 0);
if (err != UNZ_OK)
return 0;
+ filename_inzip = au (filename_inzip2);
dd = file_info.dosDate;
- t = fromdostime(dd);
+ t = fromdostime (dd);
memset(&zai, 0, sizeof zai);
zai.name = filename_inzip;
zai.t = t;
- c = filename_inzip[strlen(filename_inzip) - 1];
+ c = filename_inzip[_tcslen (filename_inzip) - 1];
if (c != '/' && c != '\\') {
int err = unzOpenCurrentFile (uz);
if (err == UNZ_OK) {
zn = zvolume_addfile_abs(zv, &zai);
}
} else {
- filename_inzip[strlen(filename_inzip) - 1] = 0;
- zvolume_adddir_abs(zv, &zai);
+ filename_inzip[_tcslen (filename_inzip) - 1] = 0;
+ zvolume_adddir_abs (zv, &zai);
}
+ xfree (filename_inzip);
err = unzGoToNextFile (uz);
if (err != UNZ_OK)
break;
struct zfile *z = NULL;
unzFile uz = zn->volume->handle;
int i, err;
- char tmp[MAX_DPATH];
+ TCHAR tmp[MAX_DPATH];
+ char *s;
- strcpy (tmp, zn->fullname + strlen(zn->volume->root.fullname) + 1);
+ _tcscpy (tmp, zn->fullname + _tcslen(zn->volume->root.fullname) + 1);
if (unzGoToFirstFile (uz) != UNZ_OK)
return 0;
for (i = 0; tmp[i]; i++) {
if (tmp[i] == '\\')
tmp[i] = '/';
}
- if (unzLocateFile (uz, tmp, 1) != UNZ_OK) {
+ s = ua (tmp);
+ if (unzLocateFile (uz, s, 1) != UNZ_OK) {
+ xfree (s);
for (i = 0; tmp[i]; i++) {
if (tmp[i] == '/')
tmp[i] = '\\';
}
- if (unzLocateFile (uz, tmp, 1) != UNZ_OK)
+ s = ua (tmp);
+ if (unzLocateFile (uz, s, 1) != UNZ_OK) {
+ xfree (s);
return 0;
+ }
}
+ xfree (s);
+ s = NULL;
if (unzOpenCurrentFile (uz) != UNZ_OK)
return 0;
z = zfile_fopen_empty (zn->fullname, zn->size);
static ISzAlloc allocImp;
static ISzAlloc allocTempImp;
-static SZ_RESULT SzFileReadImp(void *object, void *buffer, size_t size, size_t *processedSize)
+static SZ_RESULT SzFileReadImp (void *object, void *buffer, size_t size, size_t *processedSize)
{
CFileInStream *s = (CFileInStream *)object;
- size_t processedSizeLoc = zfile_fread(buffer, 1, size, s->zf);
+ size_t processedSizeLoc = zfile_fread (buffer, 1, size, s->zf);
if (processedSize != 0)
*processedSize = processedSizeLoc;
return SZ_OK;
static SZ_RESULT SzFileSeekImp(void *object, CFileSize pos)
{
CFileInStream *s = (CFileInStream *)object;
- int res = zfile_fseek(s->zf, pos, SEEK_SET);
+ int res = zfile_fseek (s->zf, pos, SEEK_SET);
if (res == 0)
return SZ_OK;
return SZE_FAIL;
allocImp.Free = SzFree;
allocTempImp.Alloc = SzAllocTemp;
allocTempImp.Free = SzFreeTemp;
- InitCrcTable();
+ InitCrcTable ();
}
struct SevenZContext
static void archive_close_7z (struct SevenZContext *ctx)
{
- SzArDbExFree(&ctx->db, allocImp.Free);
- allocImp.Free(ctx->outBuffer);
- xfree(ctx);
+ SzArDbExFree (&ctx->db, allocImp.Free);
+ allocImp.Free (ctx->outBuffer);
+ xfree (ctx);
}
struct zvolume *archive_directory_7z (struct zfile *z)
ctx->blockIndex = 0xffffffff;
ctx->archiveStream.InStream.Read = SzFileReadImp;
ctx->archiveStream.InStream.Seek = SzFileSeekImp;
- SzArDbExInit(&ctx->db);
+ SzArDbExInit (&ctx->db);
ctx->archiveStream.zf = z;
- res = SzArchiveOpen(&ctx->archiveStream.InStream, &ctx->db, &allocImp, &allocTempImp);
+ res = SzArchiveOpen (&ctx->archiveStream.InStream, &ctx->db, &allocImp, &allocTempImp);
if (res != SZ_OK) {
- write_log ("7Z: SzArchiveOpen %s returned %d\n", zfile_getname(z), res);
+ write_log (L"7Z: SzArchiveOpen %s returned %d\n", zfile_getname(z), res);
return NULL;
}
- zv = zvolume_alloc(z, ArchiveFormat7Zip, ctx);
+ zv = zvolume_alloc (z, ArchiveFormat7Zip, ctx);
for (i = 0; i < ctx->db.Database.NumFiles; i++) {
CFileItem *f = ctx->db.Database.Files + i;
- char *name = f->Name;
+ TCHAR *name = au (f->Name);
struct zarchive_info zai;
memset(&zai, 0, sizeof zai);
zai.name = name;
zai.size = f->Size;
if (!f->IsDirectory) {
- struct znode *zn = zvolume_addfile_abs(zv, &zai);
+ struct znode *zn = zvolume_addfile_abs (zv, &zai);
zn->offset = i;
}
+ xfree (name);
}
zv->method = ArchiveFormat7Zip;
return zv;
struct SevenZContext *ctx;
ctx = zv->handle;
- res = SzExtract(&ctx->archiveStream.InStream, &ctx->db, zn->offset,
+ res = SzExtract (&ctx->archiveStream.InStream, &ctx->db, zn->offset,
&ctx->blockIndex, &ctx->outBuffer, &ctx->outBufferSize,
&offset, &outSizeProcessed,
&allocImp, &allocTempImp);
z = zfile_fopen_empty (zn->fullname, zn->size);
zfile_fwrite (ctx->outBuffer + offset, zn->size, 1, z);
} else {
- write_log ("7Z: SzExtract %s returned %d\n", zn->fullname, res);
+ write_log (L"7Z: SzExtract %s returned %d\n", zn->fullname, res);
}
return z;
}
static RAROPENARCHIVE pRAROpenArchive;
typedef int (_stdcall* RARREADHEADEREX)(HANDLE,struct RARHeaderDataEx*);
static RARREADHEADEREX pRARReadHeaderEx;
-typedef int (_stdcall* RARPROCESSFILE)(HANDLE,int,char*,char *);
+typedef int (_stdcall* RARPROCESSFILE)(HANDLE,int,char*,char*);
static RARPROCESSFILE pRARProcessFile;
typedef int (_stdcall* RARCLOSEARCHIVE)(HANDLE);
static RARCLOSEARCHIVE pRARCloseArchive;
typedef int (_stdcall* RARGETDLLVERSION)(void);
static RARGETDLLVERSION pRARGetDllVersion;
-static int rar_resetf(struct zfile *z)
+static int rar_resetf (struct zfile *z)
{
- z->f = fopen (z->name, "rb");
+ z->f = _tfopen (z->name, L"rb");
if (!z->f) {
zfile_fclose (z);
return 0;
{
HMODULE rarlib;
- rarlib = WIN32_LoadLibrary("unrar.dll");
+ rarlib = WIN32_LoadLibrary (L"unrar.dll");
if (rarlib) {
pRAROpenArchive = (RAROPENARCHIVE)GetProcAddress (rarlib, "RAROpenArchive");
pRARReadHeaderEx = (RARREADHEADEREX)GetProcAddress (rarlib, "RARReadHeaderEx");
pRARGetDllVersion = (RARGETDLLVERSION)GetProcAddress (rarlib, "RARGetDllVersion");
if (pRAROpenArchive && pRARReadHeaderEx && pRARProcessFile && pRARCloseArchive && pRARSetCallback) {
israr = 1;
- write_log ("unrar.dll version %08X detected and used\n", pRARGetDllVersion ? pRARGetDllVersion() : -1);
+ write_log (L"unrar.dll version %08X detected and used\n", pRARGetDllVersion ? pRARGetDllVersion() : -1);
}
}
return israr < 0 ? 0 : 1;
}
-static int CALLBACK RARCallbackProc(UINT msg,LONG UserData,LONG P1,LONG P2)
+static int CALLBACK RARCallbackProc (UINT msg,LONG UserData,LONG P1,LONG P2)
{
if (msg == UCM_PROCESSDATA) {
- zfile_fwrite((uae_u8*)P1, 1, P2, rarunpackzf);
+ zfile_fwrite ((uae_u8*)P1, 1, P2, rarunpackzf);
return 0;
}
return -1;
};
-static void archive_close_rar(struct RARContext *rc)
+static void archive_close_rar (struct RARContext *rc)
{
xfree(rc);
}
/* wtf? stupid unrar.dll only accept filename as an input.. */
return archive_directory_arcacc (z, ArchiveFormatRAR);
rc = xcalloc (sizeof (struct RARContext), 1);
- zv = zvolume_alloc(z, ArchiveFormatRAR, rc);
+ zv = zvolume_alloc (z, ArchiveFormatRAR, rc);
fclose (z->f); /* bleh, unrar.dll fails to open the archive if it is already open.. */
z->f = NULL;
- rc->OpenArchiveData.ArcName = z->name;
+ rc->OpenArchiveData.ArcName = ua (z->name);
rc->OpenArchiveData.OpenMode = RAR_OM_LIST;
- rc->hArcData = pRAROpenArchive(&rc->OpenArchiveData);
+ rc->hArcData = pRAROpenArchive (&rc->OpenArchiveData);
+ xfree (rc->OpenArchiveData.ArcName);
if (rc->OpenArchiveData.OpenResult != 0) {
xfree(rc);
- if (!rar_resetf(z)) {
- zfile_fclose_archive(zv);
+ if (!rar_resetf (z)) {
+ zfile_fclose_archive (zv);
return NULL;
}
- zfile_fclose_archive(zv);
+ zfile_fclose_archive (zv);
return archive_directory_arcacc (z, ArchiveFormatRAR);
}
- pRARSetCallback(rc->hArcData, RARCallbackProc, 0);
+ pRARSetCallback (rc->hArcData, RARCallbackProc, 0);
cnt = 0;
- while (pRARReadHeaderEx(rc->hArcData, &rc->HeaderData) == 0) {
- char *name = rc->HeaderData.FileName;
+ while (pRARReadHeaderEx (rc->hArcData, &rc->HeaderData) == 0) {
+ TCHAR *name = au (rc->HeaderData.FileName);
struct zarchive_info zai;
struct znode *zn;
memset(&zai, 0, sizeof zai);
zai.name = name;
zai.size = rc->HeaderData.UnpSize;
- zai.t = fromdostime(rc->HeaderData.FileTime);
- zn = zvolume_addfile_abs(zv, &zai);
+ zai.t = fromdostime (rc->HeaderData.FileTime);
+ zn = zvolume_addfile_abs (zv, &zai);
zn->offset = cnt++;
- pRARProcessFile(rc->hArcData, RAR_SKIP, NULL, NULL);
+ pRARProcessFile (rc->hArcData, RAR_SKIP, NULL, NULL);
+ xfree (name);
}
- pRARCloseArchive(rc->hArcData);
+ pRARCloseArchive (rc->hArcData);
zftmp = zfile_fopen_empty (z->name, 0);
zv->archive = zftmp;
zv->method = ArchiveFormatRAR;
uae_u32 attributes;
int IsDir, IsEncrypted;
struct aaFILETIME LastWriteTime;
- char path[FileInArchiveInfoStringSize];
+ TCHAR path[FileInArchiveInfoStringSize];
};
typedef HRESULT (__stdcall *aaReadCallback)(int StreamID, uae_u64 offset, uae_u32 count, void* buf, uae_u32 *processedSize);
typedef HRESULT (__stdcall *aaWriteCallback)(int StreamID, uae_u64 offset, uae_u32 count, const void *buf, uae_u32 *processedSize);
-typedef aaHandle (__stdcall *aapOpenArchive)(aaReadCallback function, int StreamID, uae_u64 FileSize, int ArchiveType, int *result, char *password);
+typedef aaHandle (__stdcall *aapOpenArchive)(aaReadCallback function, int StreamID, uae_u64 FileSize, int ArchiveType, int *result, TCHAR *password);
typedef int (__stdcall *aapGetFileCount)(aaHandle ArchiveHandle);
typedef int (__stdcall *aapGetFileInfo)(aaHandle ArchiveHandle, int FileNum, struct aaFileInArchiveInfo *FileInfo);
typedef int (__stdcall *aapExtract)(aaHandle ArchiveHandle, int FileNum, int StreamID, aaWriteCallback WriteFunc, uae_u64 *written);
{
if (arcacc_mod)
return 1;
- arcacc_mod = WIN32_LoadLibrary ("archiveaccess.dll");
+ arcacc_mod = WIN32_LoadLibrary (L"archiveaccess.dll");
if (!arcacc_mod) {
- write_log ("failed to open archiveaccess.dll ('%s')\n", zfile_getname (zf));
+ write_log (L"failed to open archiveaccess.dll ('%s')\n", zfile_getname (zf));
return 0;
}
aaOpenArchive = (aapOpenArchive) GetProcAddress (arcacc_mod, "aaOpenArchive");
aaExtract = (aapExtract) GetProcAddress (arcacc_mod, "aaExtract");
aaCloseArchive = (aapCloseArchive) GetProcAddress (arcacc_mod, "aaCloseArchive");
if (!aaOpenArchive || !aaGetFileCount || !aaGetFileInfo || !aaExtract || !aaCloseArchive) {
- write_log ("Missing functions in archiveaccess.dll. Old version?\n");
+ write_log (L"Missing functions in archiveaccess.dll. Old version?\n");
arcacc_free ();
return 0;
}
fc = aaGetFileCount (ah);
for (f = 0; f < fc; f++) {
struct aaFileInArchiveInfo fi;
- char *name;
+ TCHAR *name;
struct znode *zn;
struct zarchive_info zai;
/* plain single file */
-static void addfile(struct zvolume *zv, const char *path, uae_u8 *data, int size)
+static void addfile (struct zvolume *zv, const TCHAR *path, uae_u8 *data, int size)
{
struct zarchive_info zai;
struct znode *zn;
struct zfile *z = zfile_fopen_empty (path, size);
- zfile_fwrite(data, size, 1, z);
+ zfile_fwrite (data, size, 1, z);
memset(&zai, 0, sizeof zai);
zai.name = path;
zai.size = size;
- zn = zvolume_addfile_abs(zv, &zai);
+ zn = zvolume_addfile_abs (zv, &zai);
if (zn)
zn->f = z;
else
- zfile_fclose(z);
+ zfile_fclose (z);
}
static uae_u8 exeheader[]={0x00,0x00,0x03,0xf3,0x00,0x00,0x00,0x00};
struct znode *zn;
struct zarchive_info zai;
int i;
- char *filename;
+ TCHAR *filename;
uae_u8 id[8];
- memset(&zai, 0, sizeof zai);
- zv = zvolume_alloc(z, ArchiveFormatPLAIN, NULL);
- for (i = strlen(z->name) - 1; i >= 0; i--) {
+ memset (&zai, 0, sizeof zai);
+ zv = zvolume_alloc (z, ArchiveFormatPLAIN, NULL);
+ for (i = _tcslen (z->name) - 1; i >= 0; i--) {
if (z->name[i] == '\\' || z->name[i] == '/' || z->name[i] == ':') {
i++;
break;
zfile_fseek(z, 0, SEEK_SET);
zfile_fread(id, sizeof id, 1, z);
zfile_fseek(z, 0, SEEK_SET);
- zn = zvolume_addfile_abs(zv, &zai);
+ zn = zvolume_addfile_abs (zv, &zai);
if (!memcmp (id, exeheader, sizeof id)) {
- uae_u8 *data = xmalloc(1 + strlen(filename) + 1 + 2);
- sprintf(data,"\"%s\"\n", filename);
- addfile(zv, "s/startup-sequence", data, strlen(data));
- xfree(data);
+ uae_u8 *data = xmalloc (1 + _tcslen (filename) + 1 + 2);
+ sprintf (data, "\"%s\"\n", filename);
+ addfile (zv, L"s/startup-sequence", data, strlen (data));
+ xfree (data);
}
return zv;
}
struct zfile *z;
z = zfile_fopen_empty (zn->fullname, zn->size);
- zfile_fread(z->data, zn->size, 1, zn->volume->archive);
+ zfile_fread (z->data, zn->size, 1, zn->volume->archive);
return z;
}