trying to sync rc1

parent e63e410c
...@@ -603,6 +603,8 @@ STATIC_INLINE int ar3a (uaecptr addr, uae_u8 b, int writing) ...@@ -603,6 +603,8 @@ STATIC_INLINE int ar3a (uaecptr addr, uae_u8 b, int writing)
return 0; return 0;
} }
static void action_replay_chipwrite (void);
void REGPARAM2 chipmem_lput_actionreplay1 (uaecptr addr, uae_u32 l) void REGPARAM2 chipmem_lput_actionreplay1 (uaecptr addr, uae_u32 l)
{ {
uae_u32 *m; uae_u32 *m;
...@@ -619,7 +621,7 @@ void REGPARAM2 chipmem_wput_actionreplay1 (uaecptr addr, uae_u32 w) ...@@ -619,7 +621,7 @@ void REGPARAM2 chipmem_wput_actionreplay1 (uaecptr addr, uae_u32 w)
addr -= chipmem_start & chipmem_mask; addr -= chipmem_start & chipmem_mask;
addr &= chipmem_mask; addr &= chipmem_mask;
if (addr == 0x62 && !is_ar_pc_in_rom()) if (addr == 0x60 && !is_ar_pc_in_rom())
action_replay_chipwrite (); action_replay_chipwrite ();
m = (uae_u16 *)(chipmemory + addr); m = (uae_u16 *)(chipmemory + addr);
do_put_mem_word (m, w); do_put_mem_word (m, w);
......
...@@ -32,8 +32,10 @@ static void install_driver (int flags) ...@@ -32,8 +32,10 @@ static void install_driver (int flags)
device_func[DF_IOCTL] = NULL; device_func[DF_IOCTL] = NULL;
device_func[DF_SCSI] = &devicefunc_win32_aspi; device_func[DF_SCSI] = &devicefunc_win32_aspi;
if (devicefunc_cdimage.openbus (0)) { if (devicefunc_cdimage.openbus (flags)) {
device_func[DF_IOCTL] = &devicefunc_cdimage; device_func[DF_IOCTL] = &devicefunc_cdimage;
device_func[DF_SCSI] = NULL;
return;
} }
#ifdef WINDDK #ifdef WINDDK
if (!device_func[DF_IOCTL]) if (!device_func[DF_IOCTL])
...@@ -85,18 +87,24 @@ static void install_driver (int flags) ...@@ -85,18 +87,24 @@ static void install_driver (int flags)
int sys_command_open (int mode, int unitnum) int sys_command_open (int mode, int unitnum)
{ {
if (mode == DF_SCSI || !have_ioctl) if (mode == DF_SCSI || !have_ioctl) {
if (device_func[DF_SCSI] == NULL)
return 0;
return device_func[DF_SCSI]->opendev (unitnum); return device_func[DF_SCSI]->opendev (unitnum);
else } else {
return device_func[DF_IOCTL]->opendev (unitnum); return device_func[DF_IOCTL]->opendev (unitnum);
}
} }
void sys_command_close (int mode, int unitnum) void sys_command_close (int mode, int unitnum)
{ {
if (mode == DF_SCSI || !have_ioctl) if (mode == DF_SCSI || !have_ioctl) {
if (device_func[DF_SCSI] == NULL)
return;
device_func[DF_SCSI]->closedev (unitnum); device_func[DF_SCSI]->closedev (unitnum);
else } else {
device_func[DF_IOCTL]->closedev (unitnum); device_func[DF_IOCTL]->closedev (unitnum);
}
} }
void device_func_reset (void) void device_func_reset (void)
...@@ -114,9 +122,13 @@ int device_func_init (int flags) ...@@ -114,9 +122,13 @@ int device_func_init (int flags)
have_ioctl = 1; have_ioctl = 1;
else else
have_ioctl = 0; have_ioctl = 0;
if (flags & DEVICE_TYPE_ALLOWEMU)
oflags |= DEVICE_TYPE_ALLOWEMU;
if (device_func[DF_SCSI])
support_scsi = device_func[DF_SCSI]->openbus (oflags) ? 1 : 0; support_scsi = device_func[DF_SCSI]->openbus (oflags) ? 1 : 0;
oflags |= 1 << INQ_ROMD;
if (have_ioctl) if (have_ioctl)
support_ioctl = device_func[DF_IOCTL]->openbus (1 << INQ_ROMD) ? 1 : 0; support_ioctl = device_func[DF_IOCTL]->openbus (oflags) ? 1 : 0;
write_log ("support_scsi = %d support_ioctl = %d\n", support_scsi, support_ioctl); write_log ("support_scsi = %d support_ioctl = %d\n", support_scsi, support_ioctl);
return (support_scsi ? (1 << DF_SCSI) : 0) | (support_ioctl ? (1 << DF_IOCTL) : 0); return (support_scsi ? (1 << DF_SCSI) : 0) | (support_ioctl ? (1 << DF_IOCTL) : 0);
} }
......
...@@ -214,7 +214,7 @@ static const TCHAR *obsolete[] = { ...@@ -214,7 +214,7 @@ static const TCHAR *obsolete[] = {
"kickstart_key_file", "fast_copper", "sound_adjust", "kickstart_key_file", "fast_copper", "sound_adjust",
"serial_hardware_dtrdsr", "gfx_filter_upscale", "serial_hardware_dtrdsr", "gfx_filter_upscale",
"gfx_correct_aspect", "gfx_autoscale", "parallel_sampler", "parallel_ascii_emulation", "gfx_correct_aspect", "gfx_autoscale", "parallel_sampler", "parallel_ascii_emulation",
"avoid_vid", "avoid_dga", "avoid_vid", "avoid_dga", "z3chipmem_size",
NULL NULL
}; };
...@@ -642,6 +642,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) ...@@ -642,6 +642,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
cfgfile_write (f, "floppy_speed", "%d", p->floppy_speed); cfgfile_write (f, "floppy_speed", "%d", p->floppy_speed);
#ifdef DRIVESOUND #ifdef DRIVESOUND
cfgfile_write (f, "floppy_volume", "%d", p->dfxclickvolume); cfgfile_write (f, "floppy_volume", "%d", p->dfxclickvolume);
cfgfile_dwrite (f, "floppy_channel_mask", "0x%x", p->dfxclickchannelmask);
#endif #endif
cfgfile_write_bool (f, "parallel_on_demand", p->parallel_demand); cfgfile_write_bool (f, "parallel_on_demand", p->parallel_demand);
cfgfile_write_bool (f, "serial_on_demand", p->serial_demand); cfgfile_write_bool (f, "serial_on_demand", p->serial_demand);
...@@ -882,11 +883,11 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) ...@@ -882,11 +883,11 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
cfgfile_write (f, "mbresmem_size", "%d", p->mbresmem_high_size / 0x100000); cfgfile_write (f, "mbresmem_size", "%d", p->mbresmem_high_size / 0x100000);
cfgfile_write (f, "z3mem_size", "%d", p->z3fastmem_size / 0x100000); cfgfile_write (f, "z3mem_size", "%d", p->z3fastmem_size / 0x100000);
cfgfile_write (f, "z3mem2_size", "%d", p->z3fastmem2_size / 0x100000); cfgfile_write (f, "z3mem2_size", "%d", p->z3fastmem2_size / 0x100000);
cfgfile_write (f, "z3chipmem_size", "%d", p->z3chipmem_size / 0x100000);
cfgfile_write (f, "z3mem_start", "0x%x", p->z3fastmem_start); cfgfile_write (f, "z3mem_start", "0x%x", p->z3fastmem_start);
cfgfile_write (f, "bogomem_size", "%d", p->bogomem_size / 0x40000); cfgfile_write (f, "bogomem_size", "%d", p->bogomem_size / 0x40000);
cfgfile_write (f, "gfxcard_size", "%d", p->gfxmem_size / 0x100000); cfgfile_write (f, "gfxcard_size", "%d", p->gfxmem_size / 0x100000);
cfgfile_write (f, "chipmem_size", "%d", p->chipmem_size == 0x20000 ? -1 : (p->chipmem_size == 0x40000 ? 0 : p->chipmem_size / 0x80000)); cfgfile_write (f, "chipmem_size", "%d", p->chipmem_size == 0x20000 ? -1 : (p->chipmem_size == 0x40000 ? 0 : p->chipmem_size / 0x80000));
cfgfile_dwrite (f, "megachipmem_size", "%d", p->z3chipmem_size / 0x100000);
if (p->m68k_speed > 0) if (p->m68k_speed > 0)
cfgfile_write (f, "finegrain_cpu_speed", "%d", p->m68k_speed); cfgfile_write (f, "finegrain_cpu_speed", "%d", p->m68k_speed);
...@@ -957,10 +958,11 @@ int cfgfile_yesno2 (const TCHAR *option, const TCHAR *value, const TCHAR *name, ...@@ -957,10 +958,11 @@ int cfgfile_yesno2 (const TCHAR *option, const TCHAR *value, const TCHAR *name,
|| strcasecmp (value, "true") == 0 || strcasecmp (value, "t") == 0) || strcasecmp (value, "true") == 0 || strcasecmp (value, "t") == 0)
*location = 1; *location = 1;
else if (strcasecmp (value, "no") == 0 || strcasecmp (value, "n") == 0 else if (strcasecmp (value, "no") == 0 || strcasecmp (value, "n") == 0
|| strcasecmp (value, "false") == 0 || strcasecmp (value, "f") == 0) || strcasecmp (value, "false") == 0 || strcasecmp (value, "f") == 0
|| strcasecmp (value, "0") == 0)
*location = 0; *location = 0;
else { else {
write_log ("Option `%s' requires a value of either `yes' or `no'.\n", option); write_log ("Option `%s' requires a value of either `yes' or `no' (was '%s').\n", option, value);
return -1; return -1;
} }
return 1; return 1;
...@@ -1251,8 +1253,10 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) ...@@ -1251,8 +1253,10 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
} }
} }
if (cfgfile_path (option, value, "cdimage0", p->cdimagefile, sizeof p->cdimagefile / sizeof (TCHAR))) if (cfgfile_path (option, value, "cdimage0", p->cdimagefile, sizeof p->cdimagefile / sizeof (TCHAR))) {
p->cdimagefileuse = true;
return 1; return 1;
}
if (cfgfile_intval (option, value, "sound_frequency", &p->sound_freq, 1)) { if (cfgfile_intval (option, value, "sound_frequency", &p->sound_freq, 1)) {
/* backwards compatibility */ /* backwards compatibility */
...@@ -1314,6 +1318,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) ...@@ -1314,6 +1318,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
|| cfgfile_intval (option, value, "floppy2sound", &p->dfxclick[2], 1) || cfgfile_intval (option, value, "floppy2sound", &p->dfxclick[2], 1)
|| cfgfile_intval (option, value, "floppy3sound", &p->dfxclick[3], 1) || cfgfile_intval (option, value, "floppy3sound", &p->dfxclick[3], 1)
#endif #endif
|| cfgfile_intval (option, value, "floppy_channel_mask", &p->dfxclickchannelmask, 1)
|| cfgfile_intval (option, value, "floppy_volume", &p->dfxclickvolume, 1)) || cfgfile_intval (option, value, "floppy_volume", &p->dfxclickvolume, 1))
return 1; return 1;
...@@ -1931,6 +1936,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, TCHAR *option, TCHAR *va ...@@ -1931,6 +1936,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, TCHAR *option, TCHAR *va
|| cfgfile_intval (option, value, "mbresmem_size", &p->mbresmem_high_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, "z3mem_size", &p->z3fastmem_size, 0x100000)
|| cfgfile_intval (option, value, "z3mem2_size", &p->z3fastmem2_size, 0x100000) || cfgfile_intval (option, value, "z3mem2_size", &p->z3fastmem2_size, 0x100000)
|| cfgfile_intval (option, value, "megachipmem_size", &p->z3chipmem_size, 0x100000)
|| cfgfile_intval (option, value, "z3mem_start", &p->z3fastmem_start, 1) || cfgfile_intval (option, value, "z3mem_start", &p->z3fastmem_start, 1)
|| cfgfile_intval (option, value, "bogomem_size", &p->bogomem_size, 0x40000) || cfgfile_intval (option, value, "bogomem_size", &p->bogomem_size, 0x40000)
|| cfgfile_intval (option, value, "gfxcard_size", &p->gfxmem_size, 0x100000) || cfgfile_intval (option, value, "gfxcard_size", &p->gfxmem_size, 0x100000)
...@@ -3605,6 +3611,13 @@ void default_prefs (struct uae_prefs *p, int type) ...@@ -3605,6 +3611,13 @@ void default_prefs (struct uae_prefs *p, int type)
strcpy (p->cartfile, ""); strcpy (p->cartfile, "");
#endif #endif
prefs_set_attr ("rom_path", strdup_path_expand (TARGET_ROM_PATH));
prefs_set_attr ("floppy_path", strdup_path_expand (TARGET_FLOPPY_PATH));
prefs_set_attr ("hardfile_path", strdup_path_expand (TARGET_HARDFILE_PATH));
#ifdef SAVESTATE
prefs_set_attr ("savestate_path", strdup_path_expand (TARGET_SAVESTATE_PATH));
#endif
_tcscpy (p->path_rom, "./"); _tcscpy (p->path_rom, "./");
_tcscpy (p->path_floppy, "./"); _tcscpy (p->path_floppy, "./");
_tcscpy (p->path_hardfile, "./"); _tcscpy (p->path_hardfile, "./");
......
...@@ -1082,10 +1082,16 @@ static void illg_init (void) ...@@ -1082,10 +1082,16 @@ static void illg_init (void)
memset (illgdebug + 0xe00000, 1, 512 * 1024); /* CD32 ext ROM */ memset (illgdebug + 0xe00000, 1, 512 * 1024); /* CD32 ext ROM */
} }
#endif #endif
if (currprefs.cs_ksmirror_e0)
memset (illgdebug + 0xe00000, 1, 512 * 1024);
if (currprefs.cs_ksmirror_a8)
memset (illgdebug + 0xa80000, 1, 2 * 512 * 1024);
#ifdef FILESYS #ifdef FILESYS
if (uae_boot_rom) /* filesys "rom" */ if (uae_boot_rom) /* filesys "rom" */
memset (illgdebug + rtarea_base, 1, 0x10000); memset (illgdebug + rtarea_base, 1, 0x10000);
#endif #endif
if (currprefs.cs_ide > 0)
memset (illgdebug + 0xdd0000, 3, 65536);
} }
/* add special custom register check here */ /* add special custom register check here */
...@@ -1130,7 +1136,7 @@ static void illg_debug_do (uaecptr addr, int rwi, int size, uae_u32 val) ...@@ -1130,7 +1136,7 @@ static void illg_debug_do (uaecptr addr, int rwi, int size, uae_u32 val)
} }
} }
STATIC_INLINE uae_u8 debug_mem_off (uaecptr addr) STATIC_INLINE int debug_mem_off (uaecptr addr)
{ {
return munge24 (addr) >> 16; return munge24 (addr) >> 16;
} }
...@@ -1728,15 +1734,26 @@ static void writeintomem (const char **c) ...@@ -1728,15 +1734,26 @@ static void writeintomem (const char **c)
uae_u32 addr = 0; uae_u32 addr = 0;
uae_u32 val = 0; uae_u32 val = 0;
char cc; char cc;
int len = 1;
ignore_ws (c); ignore_ws(c);
addr = readhex (c); addr = readhex (c);
ignore_ws (c); ignore_ws(c);
val = readhex (c); val = readhex (c);
if (val > 0xffff) { if (val > 0xffff)
len = 4;
else if (val > 0xff)
len = 2;
else
len = 1;
if (more_params (c)) {
ignore_ws (c);
len = readint (c);
}
if (len == 4) {
put_long (addr, val); put_long (addr, val);
cc = 'L'; cc = 'L';
} else if (val > 0xff) { } else if (len == 2) {
put_word (addr, val); put_word (addr, val);
cc = 'W'; cc = 'W';
} else { } else {
...@@ -1755,12 +1772,13 @@ static uae_u8 *dump_xlate (uae_u32 addr) ...@@ -1755,12 +1772,13 @@ static uae_u8 *dump_xlate (uae_u32 addr)
static void memory_map_dump_2 (int log) static void memory_map_dump_2 (int log)
{ {
int i, j, max, im; bool imold;
int i, j, max;
addrbank *a1 = mem_banks[0]; addrbank *a1 = mem_banks[0];
char txt[256]; char txt[256];
im = currprefs.illegal_mem; imold = currprefs.illegal_mem;
currprefs.illegal_mem = 0; currprefs.illegal_mem = false;
max = currprefs.address_space_24 ? 256 : 65536; max = currprefs.address_space_24 ? 256 : 65536;
j = 0; j = 0;
for (i = 0; i < max + 1; i++) { for (i = 0; i < max + 1; i++) {
...@@ -1824,7 +1842,7 @@ static void memory_map_dump_2 (int log) ...@@ -1824,7 +1842,7 @@ static void memory_map_dump_2 (int log)
a1 = a2; a1 = a2;
} }
} }
currprefs.illegal_mem = im; currprefs.illegal_mem = imold;
} }
void memory_map_dump (void) void memory_map_dump (void)
{ {
...@@ -2334,18 +2352,22 @@ static void debug_1 (void) ...@@ -2334,18 +2352,22 @@ static void debug_1 (void)
break; break;
} }
case 'e': dump_custom_regs (); break; case 'e': dump_custom_regs (); break;
case 'r': if (more_params (&inptr)) case 'r':
{
if (more_params(&inptr))
m68k_modify (&inptr); m68k_modify (&inptr);
else else
m68k_dumpstate (stdout, &nextpc); m68k_dumpstate (stdout, &nextpc);
}
break; break;
//case 'D': deepcheatsearch (&inptr); break;
case 'C': cheatsearch (&inptr); break; case 'C': cheatsearch (&inptr); break;
case 'W': writeintomem (&inptr); break; case 'W': writeintomem (&inptr); break;
case 'w': memwatch (&inptr); break; case 'w': memwatch (&inptr); break;
case 'S': savemem (&inptr); break; case 'S': savemem (&inptr); break;
case 's': case 's':
if (*inptr == 'c') { if (*inptr == 'c') {
// screenshot (1, 1); ;//screenshot (1, 1);
} else if (*inptr == 'm') { } else if (*inptr == 'm') {
next_char (&inptr); next_char (&inptr);
if (more_params (&inptr)) if (more_params (&inptr))
...@@ -2539,19 +2561,23 @@ void debug (void) ...@@ -2539,19 +2561,23 @@ void debug (void)
if (!memwatch_triggered) { if (!memwatch_triggered) {
if (do_skip) { if (do_skip) {
uae_u32 pc = munge24 (m68k_getpc ()); uae_u32 pc;
uae_u16 opcode = (currprefs.cpu_compatible || currprefs.cpu_cycle_exact) ? regs.ir : get_word (pc); uae_u16 opcode;
int bp = 0; int bp = 0;
pc = munge24 (m68k_getpc ());
opcode = (currprefs.cpu_compatible || currprefs.cpu_cycle_exact) ? regs.ir : get_word (pc);
for (i = 0; i < BREAKPOINT_TOTAL; i++) { for (i = 0; i < BREAKPOINT_TOTAL; i++) {
if (!bpnodes[i].enabled) if (!bpnodes[i].enabled)
continue; continue;
if (bpnodes[i].addr == pc) { if (bpnodes[i].addr == pc) {
bp = 1; bp = 1;
console_out ("Breakpoint at %8.8X\n", pc); console_out (L"Breakpoint at %08X\n", pc);
break; break;
} }
} }
if (skipaddr_doskip) { if (skipaddr_doskip) {
if (skipaddr_start == pc) if (skipaddr_start == pc)
bp = 1; bp = 1;
...@@ -2571,6 +2597,13 @@ void debug (void) ...@@ -2571,6 +2597,13 @@ void debug (void)
bp = 1; bp = 1;
} }
} }
if (sr_bpmask || sr_bpvalue) {
MakeSR ();
if ((regs.sr & sr_bpmask) == sr_bpvalue) {
console_out ("SR breakpoint\n");
bp = 1;
}
}
if (!bp) { if (!bp) {
set_special (SPCFLAG_BRK); set_special (SPCFLAG_BRK);
return; return;
...@@ -2601,14 +2634,7 @@ void debug (void) ...@@ -2601,14 +2634,7 @@ void debug (void)
#ifdef SAVESTATE #ifdef SAVESTATE
debug_rewind = 0; debug_rewind = 0;
processptr = 0; processptr = 0;
#if 0
if (!currprefs.statecapture) {
changed_prefs.statecapture = currprefs.statecapture = 1;
savestate_init ();
}
#endif #endif
#endif
debug_1 (); debug_1 ();
#ifdef SAVESTATE #ifdef SAVESTATE
......
...@@ -1291,7 +1291,7 @@ static void drive_motor (drive * drv, bool off) ...@@ -1291,7 +1291,7 @@ static void drive_motor (drive * drv, bool off)
#endif #endif
} }
static void read_floppy_data (struct zfile *diskfile, trackid *tid, int offset, void *dst, int len) static void read_floppy_data (struct zfile *diskfile, trackid *tid, int offset, uae_u8 *dst, int len)
{ {
if (len == 0) if (len == 0)
return; return;
...@@ -1300,7 +1300,7 @@ static void read_floppy_data (struct zfile *diskfile, trackid *tid, int offset, ...@@ -1300,7 +1300,7 @@ static void read_floppy_data (struct zfile *diskfile, trackid *tid, int offset,
} }
/* Megalomania does not like zero MFM words... */ /* Megalomania does not like zero MFM words... */
static void mfmcode (uae_u16 *mfm, unsigned int words) static void mfmcode (uae_u16 * mfm, unsigned int words)
{ {
uae_u32 lastword = 0; uae_u32 lastword = 0;
while (words--) { while (words--) {
......
...@@ -343,16 +343,28 @@ void driveclick_mix (uae_s16 *sndbuffer, int size, int channelmask) ...@@ -343,16 +343,28 @@ void driveclick_mix (uae_s16 *sndbuffer, int size, int channelmask)
uae_s16 s = clickbuffer[i]; uae_s16 s = clickbuffer[i];
if (channelmask & 1) if (channelmask & 1)
sndbuffer[0] = limit (((sndbuffer[0] + s) * 2) / 3); sndbuffer[0] = limit (((sndbuffer[0] + s) * 2) / 3);
else
sndbuffer[0] = sndbuffer[0] * 2 / 3;
if (channelmask & 2) if (channelmask & 2)
sndbuffer[1] = limit (((sndbuffer[1] + s) * 2) / 3); sndbuffer[1] = limit (((sndbuffer[1] + s) * 2) / 3);
else
sndbuffer[1] = sndbuffer[1] * 2 / 3;
if (channelmask & 4) if (channelmask & 4)
sndbuffer[2] = limit (((sndbuffer[2] + s) * 2) / 3); sndbuffer[2] = limit (((sndbuffer[2] + s) * 2) / 3);
else
sndbuffer[2] = sndbuffer[2] * 2 / 3;
if (channelmask & 8) if (channelmask & 8)
sndbuffer[3] = limit (((sndbuffer[3] + s) * 2) / 3); sndbuffer[3] = limit (((sndbuffer[3] + s) * 2) / 3);
else
sndbuffer[3] = sndbuffer[3] * 2 / 3;
if (channelmask & 16) if (channelmask & 16)
sndbuffer[4] = limit (((sndbuffer[4] + s) * 2) / 3); sndbuffer[4] = limit (((sndbuffer[4] + s) * 2) / 3);
else
sndbuffer[4] = sndbuffer[4] * 2 / 3;
if (channelmask & 32) if (channelmask & 32)
sndbuffer[5] = limit (((sndbuffer[5] + s) * 2) / 3); sndbuffer[5] = limit (((sndbuffer[5] + s) * 2) / 3);
else
sndbuffer[5] = sndbuffer[5] * 2 / 3;
sndbuffer += 6; sndbuffer += 6;
} }
break; break;
...@@ -361,12 +373,20 @@ void driveclick_mix (uae_s16 *sndbuffer, int size, int channelmask) ...@@ -361,12 +373,20 @@ void driveclick_mix (uae_s16 *sndbuffer, int size, int channelmask)
uae_s16 s = clickbuffer[i]; uae_s16 s = clickbuffer[i];
if (channelmask & 1) if (channelmask & 1)
sndbuffer[0] = limit (((sndbuffer[0] + s) * 2) / 3); sndbuffer[0] = limit (((sndbuffer[0] + s) * 2) / 3);
else
sndbuffer[0] = sndbuffer[0] * 2 / 3;
if (channelmask & 2) if (channelmask & 2)
sndbuffer[1] = limit (((sndbuffer[1] + s) * 2) / 3); sndbuffer[1] = limit (((sndbuffer[1] + s) * 2) / 3);
else
sndbuffer[1] = sndbuffer[1] * 2 / 3;
if (channelmask & 4) if (channelmask & 4)
sndbuffer[2] = limit (((sndbuffer[2] + s) * 2) / 3); sndbuffer[2] = limit (((sndbuffer[2] + s) * 2) / 3);
else
sndbuffer[2] = sndbuffer[2] * 2 / 3;
if (channelmask & 8) if (channelmask & 8)
sndbuffer[3] = limit (((sndbuffer[3] + s) * 2) / 3); sndbuffer[3] = limit (((sndbuffer[3] + s) * 2) / 3);
else
sndbuffer[3] = sndbuffer[3] * 2 / 3;
sndbuffer += 4; sndbuffer += 4;
} }
break; break;
...@@ -375,8 +395,12 @@ void driveclick_mix (uae_s16 *sndbuffer, int size, int channelmask) ...@@ -375,8 +395,12 @@ void driveclick_mix (uae_s16 *sndbuffer, int size, int channelmask)
uae_s16 s = clickbuffer[i]; uae_s16 s = clickbuffer[i];
if (channelmask & 1) if (channelmask & 1)
sndbuffer[0] = limit (((sndbuffer[0] + s) * 2) / 3); sndbuffer[0] = limit (((sndbuffer[0] + s) * 2) / 3);
else
sndbuffer[0] = sndbuffer[0] * 2 / 3;
if (channelmask & 2) if (channelmask & 2)
sndbuffer[1] = limit (((sndbuffer[1] + s) * 2) / 3); sndbuffer[1] = limit (((sndbuffer[1] + s) * 2) / 3);
else
sndbuffer[1] = sndbuffer[1] * 2 / 3;
sndbuffer += 2; sndbuffer += 2;
} }
break; break;
......
/* /*
* UAE - The Un*x Amiga Emulator * UAE - The Un*x Amiga Emulator
* *
* AutoConfig (tm) Expansions (ZorroII/III) * AutoConfig (tm) Expansions (ZorroII/III)
...@@ -354,7 +354,7 @@ static void REGPARAM2 expamem_bput (uaecptr addr, uae_u32 value) ...@@ -354,7 +354,7 @@ static void REGPARAM2 expamem_bput (uaecptr addr, uae_u32 value)
break; break;
case 0x4c: case 0x4c:
write_log (" Card %d (Zorro%s) had no success.\n", ecard + 1, expamem_type () == 0xc0 ? "II" : "III"); write_log (" Card %d (Zorro%s) had no success.\n", ecard + 1, expamem_type () == 0xc0 ? L"II" : L"III");
++ecard; ++ecard;
if (ecard < cardno) if (ecard < cardno)
(*card_init[ecard]) (); (*card_init[ecard]) ();
...@@ -589,7 +589,7 @@ static void expamem_init_catweasel (void) ...@@ -589,7 +589,7 @@ static void expamem_init_catweasel (void)
catweasel_mask = (cwc.type >= CATWEASEL_TYPE_MK3) ? 0xffff : 0x1ffff; catweasel_mask = (cwc.type >= CATWEASEL_TYPE_MK3) ? 0xffff : 0x1ffff;
expamem_init_clear(); expamem_init_clear ();
expamem_write (0x00, (cwc.type >= CATWEASEL_TYPE_MK3 ? Z2_MEM_64KB : Z2_MEM_128KB) | zorroII); expamem_write (0x00, (cwc.type >= CATWEASEL_TYPE_MK3 ? Z2_MEM_64KB : Z2_MEM_128KB) | zorroII);
...@@ -919,7 +919,7 @@ static void expamem_init_fastcard (void) ...@@ -919,7 +919,7 @@ static void expamem_init_fastcard (void)
uae_u16 mid = (currprefs.cs_a2091 || currprefs.uae_hide) ? commodore : uae_id; uae_u16 mid = (currprefs.cs_a2091 || currprefs.uae_hide) ? commodore : uae_id;
uae_u8 pid = (currprefs.cs_a2091 || currprefs.uae_hide) ? commodore_a2091_ram : 1; uae_u8 pid = (currprefs.cs_a2091 || currprefs.uae_hide) ? commodore_a2091_ram : 1;
expamem_init_clear(); expamem_init_clear ();
if (allocated_fastmem == 0x100000) if (allocated_fastmem == 0x100000)
expamem_write (0x00, Z2_MEM_1MB + add_memory + zorroII); expamem_write (0x00, Z2_MEM_1MB + add_memory + zorroII);
else if (allocated_fastmem == 0x200000) else if (allocated_fastmem == 0x200000)
...@@ -1038,7 +1038,7 @@ static void expamem_map_z3fastmem_2 (addrbank *bank, uaecptr *startp, uae_u32 si ...@@ -1038,7 +1038,7 @@ static void expamem_map_z3fastmem_2 (addrbank *bank, uaecptr *startp, uae_u32 si
static void expamem_map_z3fastmem (void) static void expamem_map_z3fastmem (void)
{ {
expamem_map_z3fastmem_2 (&z3fastmem_bank, &z3fastmem_start, currprefs.z3fastmem_size, allocated_z3fastmem, 0); expamem_map_z3fastmem_2 (&z3fastmem_bank, &z3fastmem_start, currprefs.z3fastmem_size, allocated_z3fastmem, 0);
} }
static void expamem_map_z3fastmem2 (void) static void expamem_map_z3fastmem2 (void)
{ {
expamem_map_z3fastmem_2 (&z3fastmem2_bank, &z3fastmem2_start, currprefs.z3fastmem2_size, allocated_z3fastmem2, 0); expamem_map_z3fastmem_2 (&z3fastmem2_bank, &z3fastmem2_start, currprefs.z3fastmem2_size, allocated_z3fastmem2, 0);
...@@ -1058,7 +1058,7 @@ static void expamem_init_z3fastmem_2 (addrbank *bank, uae_u32 start, uae_u32 siz ...@@ -1058,7 +1058,7 @@ static void expamem_init_z3fastmem_2 (addrbank *bank, uae_u32 start, uae_u32 siz
: allocated == 0x20000000 ? Z2_MEM_512MB : allocated == 0x20000000 ? Z2_MEM_512MB
: Z2_MEM_1GB); : Z2_MEM_1GB);
expamem_init_clear(); expamem_init_clear ();
expamem_write (0x00, add_memory | zorroIII | code); expamem_write (0x00, add_memory | zorroIII | code);
expamem_write (0x08, care_addr | no_shutup | force_z3 | (allocated > 0x800000 ? ext_size : Z3_MEM_AUTO)); expamem_write (0x08, care_addr | no_shutup | force_z3 | (allocated > 0x800000 ? ext_size : Z3_MEM_AUTO));
...@@ -1123,7 +1123,7 @@ static void expamem_init_gfxcard (void) ...@@ -1123,7 +1123,7 @@ static void expamem_init_gfxcard (void)
: allocated_gfxmem == 0x800000 ? Z3_MEM_8MB : allocated_gfxmem == 0x800000 ? Z3_MEM_8MB
: 0); : 0);
expamem_init_clear(); expamem_init_clear ();
expamem_write (0x00, zorroIII | code); expamem_write (0x00, zorroIII | code);
expamem_write (0x08, care_addr | no_shutup | force_z3 | ext_size | subsize); expamem_write (0x08, care_addr | no_shutup | force_z3 | ext_size | subsize);
...@@ -1387,7 +1387,7 @@ static void expamem_init_a4091 (void) ...@@ -1387,7 +1387,7 @@ static void expamem_init_a4091 (void)
#endif #endif
} }
void p96memstart(void) void p96memstart (void)
{ {
/* make sure there is always empty space between Z3 and P96 RAM */ /* make sure there is always empty space between Z3 and P96 RAM */
p96ram_start = currprefs.z3fastmem_start + ((currprefs.z3fastmem_size + currprefs.z3fastmem2_size + currprefs.z3chipmem_size + 0xffffff) & ~0xffffff); p96ram_start = currprefs.z3fastmem_start + ((currprefs.z3fastmem_size + currprefs.z3fastmem2_size + currprefs.z3chipmem_size + 0xffffff) & ~0xffffff);
...@@ -1421,7 +1421,7 @@ void expamem_reset (void) ...@@ -1421,7 +1421,7 @@ void expamem_reset (void)
write_log ("Kickstart version is below 1.3! Disabling autoconfig devices.\n"); write_log ("Kickstart version is below 1.3! Disabling autoconfig devices.\n");
do_mount = 0; do_mount = 0;
} }
if (need_uae_boot_rom() == 0) if (need_uae_boot_rom () == 0)
do_mount = 0; do_mount = 0;
if (fastmemory != NULL) { if (fastmemory != NULL) {
card_init[cardno] = expamem_init_fastcard; card_init[cardno] = expamem_init_fastcard;
...@@ -1585,7 +1585,7 @@ void expansion_cleanup (void) ...@@ -1585,7 +1585,7 @@ void expansion_cleanup (void)
#endif #endif
} }
void expansion_clear(void) void expansion_clear (void)
{ {
if (fastmemory) if (fastmemory)
memset (fastmemory, 0, allocated_fastmem); memset (fastmemory, 0, allocated_fastmem);
......
...@@ -250,9 +250,9 @@ FSIN_chip_done ...@@ -250,9 +250,9 @@ FSIN_chip_done
move.w #$FF80,d0 move.w #$FF80,d0
bsr.w getrtbase bsr.w getrtbase
jsr (a0) ; d1 = size, a1 = start address jsr (a0) ; d1 = size, a1 = start address
beq.s FSIN_fchip_done
move.l a1,a0 move.l a1,a0
move.l d1,d0 move.l d1,d0
beq.s FSIN_fchip_done
move.l d4,d1 move.l d4,d1
moveq #-5,d2 moveq #-5,d2
lea fchipname(pc),a1 lea fchipname(pc),a1
......
/* /*
* UAE - The Un*x Amiga Emulator * UAE - The Un*x Amiga Emulator
* *
* Unix file system handler for AmigaDOS * Unix file system handler for AmigaDOS
...@@ -237,7 +237,7 @@ static void close_filesys_unit (UnitInfo *uip) ...@@ -237,7 +237,7 @@ static void close_filesys_unit (UnitInfo *uip)
uip->open = 0; uip->open = 0;
} }
static UnitInfo *getuip(struct uae_prefs *p, int index) static UnitInfo *getuip (struct uae_prefs *p, int index)
{ {
if (index < 0) if (index < 0)
return NULL; return NULL;
...@@ -2428,11 +2428,11 @@ static uaecptr make_lock (Unit *unit, uae_u32 uniq, long mode) ...@@ -2428,11 +2428,11 @@ static uaecptr make_lock (Unit *unit, uae_u32 uniq, long mode)
#define NOTIFY_CODE 0x1234 #define NOTIFY_CODE 0x1234
#ifndef TARGET_AMIGAOS #ifndef TARGET_AMIGAOS
# define NRF_SEND_MESSAGE 1 #define NRF_SEND_MESSAGE 1
# define NRF_SEND_SIGNAL 2 #define NRF_SEND_SIGNAL 2
# define NRF_WAIT_REPLY 8 #define NRF_WAIT_REPLY 8
# define NRF_NOTIFY_INITIAL 16 #define NRF_NOTIFY_INITIAL 16
# define NRF_MAGIC (1 << 31) #define NRF_MAGIC (1 << 31)
#endif #endif
static void notify_send (Unit *unit, Notify *n) static void notify_send (Unit *unit, Notify *n)
...@@ -2457,7 +2457,7 @@ static void notify_check (Unit *unit, a_inode *a) ...@@ -2457,7 +2457,7 @@ static void notify_check (Unit *unit, a_inode *a)
int hash = notifyhash (a->aname); int hash = notifyhash (a->aname);
for (n = unit->notifyhash[hash]; n; n = n->next) { for (n = unit->notifyhash[hash]; n; n = n->next) {
uaecptr nr = n->notifyrequest; uaecptr nr = n->notifyrequest;
if (same_aname(n->partname, a->aname)) { if (same_aname (n->partname, a->aname)) {
int err; int err;
a_inode *a2 = find_aino (unit, 0, n->fullname, &err); a_inode *a2 = find_aino (unit, 0, n->fullname, &err);
if (err == 0 && a == a2) if (err == 0 && a == a2)
...@@ -2468,7 +2468,7 @@ static void notify_check (Unit *unit, a_inode *a) ...@@ -2468,7 +2468,7 @@ static void notify_check (Unit *unit, a_inode *a)
hash = notifyhash (a->parent->aname); hash = notifyhash (a->parent->aname);
for (n = unit->notifyhash[hash]; n; n = n->next) { for (n = unit->notifyhash[hash]; n; n = n->next) {
uaecptr nr = n->notifyrequest; uaecptr nr = n->notifyrequest;
if (same_aname(n->partname, a->parent->aname)) { if (same_aname (n->partname, a->parent->aname)) {
int err; int err;
a_inode *a2 = find_aino (unit, 0, n->fullname, &err); a_inode *a2 = find_aino (unit, 0, n->fullname, &err);
if (err == 0 && a->parent == a2) if (err == 0 && a->parent == a2)
...@@ -4422,7 +4422,7 @@ static void ...@@ -4422,7 +4422,7 @@ static void
if (err == 0 && SetFileDate (a->nname, (struct DateStamp *) date) == DOSFALSE) if (err == 0 && SetFileDate (a->nname, (struct DateStamp *) date) == DOSFALSE)
err = IoErr (); err = IoErr ();
#else #else
ut.actime = ut.modtime = put_time(get_long (date), get_long (date + 4), get_long (date + 8)); ut.actime = ut.modtime = put_time (get_long (date), get_long (date + 4),get_long (date + 8));
a = find_aino (unit, lock, bstr (unit, name), &err); a = find_aino (unit, lock, bstr (unit, name), &err);
if (err == 0 && utime (a->nname, &ut) == -1) if (err == 0 && utime (a->nname, &ut) == -1)
err = dos_errno (); err = dos_errno ();
......
...@@ -22,9 +22,9 @@ ...@@ -22,9 +22,9 @@
db(0x22); db(0x4e); db(0x20); db(0x08); db(0x30); db(0x7c); db(0xff); db(0xb8); db(0x22); db(0x4e); db(0x20); db(0x08); db(0x30); db(0x7c); db(0xff); db(0xb8);
db(0x4e); db(0xae); db(0xfe); db(0x5c); db(0x61); db(0x00); db(0x11); db(0xfe); db(0x4e); db(0xae); db(0xfe); db(0x5c); db(0x61); db(0x00); db(0x11); db(0xfe);
db(0x61); db(0x00); db(0x15); db(0xb0); db(0x4c); db(0xdf); db(0x7e); db(0xff); db(0x61); db(0x00); db(0x15); db(0xb0); db(0x4c); db(0xdf); db(0x7e); db(0xff);
db(0x4e); db(0x75); db(0x4e); db(0xae); db(0x08); db(0x00); db(0x00); db(0x02); db(0x4e); db(0x75); db(0x00); db(0x00); db(0x08); db(0x00); db(0x00); db(0x02);
db(0x67); db(0x06); db(0x4e); db(0xb9); db(0x00); db(0xf0); db(0x00); db(0x00); db(0x67); db(0x06); db(0x4e); db(0xb9); db(0x00); db(0xf0); db(0x00); db(0x00);
db(0x4e); db(0xf9); db(0x00); db(0xf0); db(0x00); db(0x00); db(0x28); db(0x40); db(0x4e); db(0xf9); db(0x00); db(0xf0); db(0x00); db(0x00); db(0x00); db(0x00);
db(0x48); db(0xe7); db(0xff); db(0xfe); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x48); db(0xe7); db(0xff); db(0xfe); db(0x2c); db(0x78); db(0x00); db(0x04);
db(0x30); db(0x3c); db(0xff); db(0xfc); db(0x61); db(0x00); db(0x0b); db(0xaa); db(0x30); db(0x3c); db(0xff); db(0xfc); db(0x61); db(0x00); db(0x0b); db(0xaa);
db(0x2a); db(0x50); db(0x43); db(0xfa); db(0x16); db(0xf3); db(0x70); db(0x24); db(0x2a); db(0x50); db(0x43); db(0xfa); db(0x16); db(0xf3); db(0x70); db(0x24);
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
db(0x00); db(0x20); db(0x00); db(0x00); db(0x90); db(0x88); db(0x65); db(0x08); db(0x00); db(0x20); db(0x00); db(0x00); db(0x90); db(0x88); db(0x65); db(0x08);
db(0x67); db(0x06); db(0x93); db(0xc9); db(0x4e); db(0xae); db(0xfd); db(0x96); db(0x67); db(0x06); db(0x93); db(0xc9); db(0x4e); db(0xae); db(0xfd); db(0x96);
db(0x30); db(0x3c); db(0xff); db(0x80); db(0x61); db(0x00); db(0x0a); db(0xea); db(0x30); db(0x3c); db(0xff); db(0x80); db(0x61); db(0x00); db(0x0a); db(0xea);
db(0x4e); db(0x90); db(0x67); db(0x10); db(0x20); db(0x49); db(0x20); db(0x01); db(0x4e); db(0x90); db(0x20); db(0x49); db(0x20); db(0x01); db(0x67); db(0x0c);
db(0x22); db(0x04); db(0x74); db(0xfb); db(0x43); db(0xfa); db(0x16); db(0x4f); db(0x22); db(0x04); db(0x74); db(0xfb); db(0x43); db(0xfa); db(0x16); db(0x4f);
db(0x4e); db(0xae); db(0xfd); db(0x96); db(0x41); db(0xfa); db(0x15); db(0xc6); db(0x4e); db(0xae); db(0xfd); db(0x96); db(0x41); db(0xfa); db(0x15); db(0xc6);
db(0x43); db(0xfa); db(0x00); db(0x54); db(0x70); db(0x0a); db(0x61); db(0x00); db(0x43); db(0xfa); db(0x00); db(0x54); db(0x70); db(0x0a); db(0x61); db(0x00);
......
...@@ -1358,18 +1358,14 @@ void handle_events (void) ...@@ -1358,18 +1358,14 @@ void handle_events (void)
keycode = rEvent.key.keysym.sym; keycode = rEvent.key.keysym.sym;
DEBUG_LOG ("Event: key %d %s\n", keycode, state ? "down" : "up"); DEBUG_LOG ("Event: key %d %s\n", keycode, state ? "down" : "up");
write_log ("Event: key %d %s -- ", keycode, state ? "down" : "up");
if ((ievent = match_hotkey_sequence (keycode, state))) { if ((ievent = match_hotkey_sequence (keycode, state))) {
write_log ("HOT %d\n", ievent);
DEBUG_LOG ("Hotkey event: %d\n", ievent); DEBUG_LOG ("Hotkey event: %d\n", ievent);
handle_hotkey_event (ievent, state); handle_hotkey_event (ievent, state);
} else { } else {
if (currprefs.map_raw_keys) { if (currprefs.map_raw_keys) {
write_log ("RAW\n");
inputdevice_translatekeycode (0, keycode, state); inputdevice_translatekeycode (0, keycode, state);
} else { } else {
write_log ("SYM\n");
inputdevice_do_keyboard (keysym2amiga (keycode), state); inputdevice_do_keyboard (keysym2amiga (keycode), state);
} }
} }
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#define DEVICE_TYPE_ANY 1 #define DEVICE_TYPE_ANY 1
#define DEVICE_TYPE_SCSI 2 #define DEVICE_TYPE_SCSI 2
#define DEVICE_TYPE_ALLOWEMU 0x100
#define DF_SCSI 0 #define DF_SCSI 0
#define DF_IOCTL 1 #define DF_IOCTL 1
......
...@@ -302,6 +302,7 @@ struct uae_prefs { ...@@ -302,6 +302,7 @@ struct uae_prefs {
TCHAR amaxromfile[MAX_DPATH]; TCHAR amaxromfile[MAX_DPATH];
TCHAR a2065name[MAX_DPATH]; TCHAR a2065name[MAX_DPATH];
TCHAR cdimagefile[MAX_DPATH]; TCHAR cdimagefile[MAX_DPATH];
bool cdimagefileuse;
TCHAR quitstatefile[MAX_DPATH]; TCHAR quitstatefile[MAX_DPATH];
#ifndef WIN32 #ifndef WIN32
char scsi_device[256]; char scsi_device[256];
...@@ -510,7 +511,7 @@ extern int cfgfile_parse_option (struct uae_prefs *p, TCHAR *option, TCHAR *valu ...@@ -510,7 +511,7 @@ extern int cfgfile_parse_option (struct uae_prefs *p, TCHAR *option, TCHAR *valu
extern int cfgfile_get_description (const TCHAR *filename, TCHAR *description, TCHAR *hostlink, TCHAR *hardwarelink, int *type); extern int cfgfile_get_description (const TCHAR *filename, TCHAR *description, TCHAR *hostlink, TCHAR *hardwarelink, int *type);
extern void cfgfile_show_usage (void); 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 (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_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, TCHAR *parms, uae_u32 size, TCHAR *out, uae_u32 outsize); extern uae_u32 cfgfile_modify (uae_u32 index, TCHAR *parms, uae_u32 size, TCHAR *out, uae_u32 outsize);
extern void cfgfile_addcfgparam (TCHAR *); extern void cfgfile_addcfgparam (TCHAR *);
......
...@@ -13,6 +13,7 @@ void scsidev_install (void); ...@@ -13,6 +13,7 @@ void scsidev_install (void);
void scsidev_reset (void); void scsidev_reset (void);
void scsidev_start_threads (void); void scsidev_start_threads (void);
int scsi_do_disk_change (int device_id, int insert); int scsi_do_disk_change (int device_id, int insert);
int scsi_do_disk_device_change (void);
extern int log_scsi; extern int log_scsi;
......
...@@ -4706,9 +4706,6 @@ void inputdevice_get_eventname (const struct inputevent *ie, TCHAR *out) ...@@ -4706,9 +4706,6 @@ void inputdevice_get_eventname (const struct inputevent *ie, TCHAR *out)
{ {
if (!out) if (!out)
return; return;
if (ie->allow_mask == AM_K)
_stprintf (out, "%s (0x%02X)", ie->name, ie->data);
else
_tcscpy (out, ie->name); _tcscpy (out, ie->name);
} }
......
/* /*
* UAE - The Un*x Amiga Emulator * UAE - The Un*x Amiga Emulator
* *
* scsi.device emulation * scsi.device emulation
...@@ -87,8 +87,8 @@ static void io_log (const TCHAR *msg, uaecptr request) ...@@ -87,8 +87,8 @@ static void io_log (const TCHAR *msg, uaecptr request)
{ {
if (log_scsi) if (log_scsi)
write_log ("%s: %08X %d %08X %d %d io_actual=%d io_error=%d\n", write_log ("%s: %08X %d %08X %d %d io_actual=%d io_error=%d\n",
msg, request,get_word (request + 28),get_long (request + 40), msg, request, get_word (request + 28), get_long (request + 40),
get_long (request + 36),get_long (request + 44), get_long (request + 36), get_long (request + 44),
get_long (request + 32), get_byte (request + 31)); get_long (request + 32), get_byte (request + 31));
} }
...@@ -289,14 +289,17 @@ int scsiemul_switchscsi (TCHAR *name) ...@@ -289,14 +289,17 @@ int scsiemul_switchscsi (TCHAR *name)
dev = NULL; dev = NULL;
for (j = 0; j < 2; j++) { for (j = 0; j < 2; j++) {
int mode = j == 0 ? DF_SCSI : DF_IOCTL; int mode = j == 0 ? DF_SCSI : DF_IOCTL;
device_func_init (j == 0 ? DEVICE_TYPE_SCSI : DEVICE_TYPE_ANY); if (!(device_func_init (j == 0 ? DEVICE_TYPE_SCSI : DEVICE_TYPE_ANY) & (1 << mode)))
continue;
if (devst[0].di.media_inserted < 0)
devst[0].di.media_inserted = 0;
i = 0; i = 0;
while (i < MAX_TOTAL_DEVICES && dev == NULL) { while (i < MAX_TOTAL_DEVICES && dev == NULL) {
discsi = 0; discsi = 0;
if (sys_command_open (mode, i)) { if (sys_command_open (mode, i)) {
discsi = sys_command_info (mode, i, &discsi2); discsi = sys_command_info (mode, i, &discsi2);
if (discsi && discsi->type == INQ_ROMD) { if (discsi && discsi->type == INQ_ROMD) {
if (!_tcsicmp (currprefs.cdimagefile, discsi->label) || j) { if (!_tcsicmp (currprefs.cdimagefile, discsi->label)) {
dev = &devst[0]; dev = &devst[0];
dev->unitnum = i; dev->unitnum = i;
dev->allow_scsi = j == 0 ? 1 : 0; dev->allow_scsi = j == 0 ? 1 : 0;
...@@ -309,6 +312,10 @@ int scsiemul_switchscsi (TCHAR *name) ...@@ -309,6 +312,10 @@ int scsiemul_switchscsi (TCHAR *name)
struct priv_devstruct *pdev = &pdevst[dev->aunit]; struct priv_devstruct *pdev = &pdevst[dev->aunit];
setpdev (pdev, dev); setpdev (pdev, dev);
} }
if (dev->di.media_inserted) {
dev->di.media_inserted = 0;
scsi_do_disk_change (dev->di.id, 1);
}
} }
} }
if (devst[0].opencnt == 0) if (devst[0].opencnt == 0)
...@@ -317,11 +324,50 @@ int scsiemul_switchscsi (TCHAR *name) ...@@ -317,11 +324,50 @@ int scsiemul_switchscsi (TCHAR *name)
i++; i++;
} }
if (dev) if (dev)
return i; return dev->unitnum;
}
return -1;
}
static int scsiemul_switchemu (const TCHAR *name)
{
struct devstruct *dev = NULL;
struct device_info *discsi, discsi2;
if (!device_func_init (DEVICE_TYPE_ANY | DEVICE_TYPE_ALLOWEMU))
return -1;
if (sys_command_open (DF_IOCTL, 0)) {
if (discsi = sys_command_info (DF_IOCTL, 0, &discsi2)) {
dev = &devst[0];
dev->unitnum = 0;
dev->allow_scsi = 0;
dev->allow_ioctl = 1;
dev->drivetype = discsi->type;
memcpy (&dev->di, discsi, sizeof (struct device_info));
dev->iscd = 1;
write_log ("IMG_EMU (%s) mounted as uaescsi.device:0\n", name);
if (dev->aunit >= 0) {
struct priv_devstruct *pdev = &pdevst[dev->aunit];
setpdev (pdev, dev);
}
dev->di.media_inserted = 0;
}
if (devst[0].opencnt == 0)
sys_command_close (DF_IOCTL, 0);
return 0;
} }
return -1; return -1;
} }
int scsi_do_disk_device_change (void)
{
int ret = scsiemul_switchscsi (currprefs.cdimagefile);
if (ret < 0) {
scsiemul_switchemu (currprefs.cdimagefile);
}
return ret;
}
// device_id = -1 and insert==0 -> all medias going away
int scsi_do_disk_change (int device_id, int insert) int scsi_do_disk_change (int device_id, int insert)
{ {
int i, j, ret; int i, j, ret;
...@@ -330,19 +376,17 @@ int scsi_do_disk_change (int device_id, int insert) ...@@ -330,19 +376,17 @@ int scsi_do_disk_change (int device_id, int insert)
if (!change_sem) if (!change_sem)
return ret; return ret;
uae_sem_wait (&change_sem); uae_sem_wait (&change_sem);
if (device_id < 0 && insert) {
ret = scsiemul_switchscsi (currprefs.cdimagefile);
if (ret < 0)
goto end;
}
for (i = 0; i < MAX_TOTAL_DEVICES; i++) { for (i = 0; i < MAX_TOTAL_DEVICES; i++) {
struct devstruct *dev = &devst[i]; struct devstruct *dev = &devst[i];
if (dev->di.id == device_id || (device_id < 0 && i == 0)) { if (dev->di.id == device_id || (device_id < 0 && i == 0)) {
ret = i; ret = i;
if ((dev->di.media_inserted > 0 && insert == 0) || (dev->di.media_inserted <= 0 && insert)) {
if (dev->aunit >= 0) { if (dev->aunit >= 0) {
struct priv_devstruct *pdev = &pdevst[dev->aunit]; struct priv_devstruct *pdev = &pdevst[dev->aunit];
devinfo (pdev->mode, dev->unitnum, &dev->di); devinfo (pdev->mode, dev->unitnum, &dev->di);
} }
if (device_id < 0 && insert == 0)
dev->di.media_inserted = -1; // stay away!
dev->changenum++; dev->changenum++;
j = 0; j = 0;
while (j < MAX_ASYNC_REQUESTS) { while (j < MAX_ASYNC_REQUESTS) {
...@@ -355,7 +399,7 @@ int scsi_do_disk_change (int device_id, int insert) ...@@ -355,7 +399,7 @@ int scsi_do_disk_change (int device_id, int insert)
uae_Cause (dev->changeint); uae_Cause (dev->changeint);
} }
} }
end: }
uae_sem_post (&change_sem); uae_sem_post (&change_sem);
return ret; return ret;
} }
...@@ -522,13 +566,13 @@ static int dev_do_io (struct devstruct *dev, uaecptr request) ...@@ -522,13 +566,13 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
if (!pdev) if (!pdev)
return 0; return 0;
command = get_word (request+28); command = get_word (request + 28);
switch (command) switch (command)
{ {
case CMD_READ: case CMD_READ:
//write_log ("CMD_READ %08x %d %d %08x\n", io_data, io_offset, io_length, bmask); //write_log ("CMD_READ %08x %d %d %08x\n", io_data, io_offset, io_length, bmask);
if (!dev->di.media_inserted) if (dev->di.media_inserted <= 0)
goto no_media; goto no_media;
if (dev->drivetype == INQ_ROMD) { if (dev->drivetype == INQ_ROMD) {
io_error = command_cd_read (pdev->mode, dev, io_data, io_offset, io_length, &io_actual); io_error = command_cd_read (pdev->mode, dev, io_data, io_offset, io_length, &io_actual);
...@@ -542,7 +586,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request) ...@@ -542,7 +586,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
break; break;
case TD_READ64: case TD_READ64:
case NSCMD_TD_READ64: case NSCMD_TD_READ64:
if (!dev->di.media_inserted) if (dev->di.media_inserted <= 0)
goto no_media; goto no_media;
io_offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32); io_offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32);
if ((io_offset64 & bmask) || bmask == 0 || io_data == 0) if ((io_offset64 & bmask) || bmask == 0 || io_data == 0)
...@@ -556,7 +600,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request) ...@@ -556,7 +600,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
break; break;
case CMD_WRITE: case CMD_WRITE:
if (!dev->di.media_inserted) if (dev->di.media_inserted <= 0)
goto no_media; goto no_media;
if (dev->di.write_protected || dev->drivetype == INQ_ROMD) { if (dev->di.write_protected || dev->drivetype == INQ_ROMD) {
io_error = 28; /* writeprotect */ io_error = 28; /* writeprotect */
...@@ -570,7 +614,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request) ...@@ -570,7 +614,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
break; break;
case TD_WRITE64: case TD_WRITE64:
case NSCMD_TD_WRITE64: case NSCMD_TD_WRITE64:
if (!dev->di.media_inserted) if (dev->di.media_inserted <= 0)
goto no_media; goto no_media;
io_offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32); io_offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32);
if (dev->di.write_protected || dev->drivetype == INQ_ROMD) { if (dev->di.write_protected || dev->drivetype == INQ_ROMD) {
...@@ -585,7 +629,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request) ...@@ -585,7 +629,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
break; break;
case CMD_FORMAT: case CMD_FORMAT:
if (!dev->di.media_inserted) if (dev->di.media_inserted <= 0)
goto no_media; goto no_media;
if (dev->di.write_protected || dev->drivetype == INQ_ROMD) { if (dev->di.write_protected || dev->drivetype == INQ_ROMD) {
io_error = 28; /* writeprotect */ io_error = 28; /* writeprotect */
...@@ -599,7 +643,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request) ...@@ -599,7 +643,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
break; break;
case TD_FORMAT64: case TD_FORMAT64:
case NSCMD_TD_FORMAT64: case NSCMD_TD_FORMAT64:
if (!dev->di.media_inserted) if (dev->di.media_inserted <= 0)
goto no_media; goto no_media;
io_offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32); io_offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32);
if (dev->di.write_protected || dev->drivetype == INQ_ROMD) { if (dev->di.write_protected || dev->drivetype == INQ_ROMD) {
...@@ -628,7 +672,11 @@ static int dev_do_io (struct devstruct *dev, uaecptr request) ...@@ -628,7 +672,11 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
io_actual = dev->changenum; io_actual = dev->changenum;
break; break;
case CMD_CHANGESTATE: case CMD_CHANGESTATE:
io_actual = devinfo (pdev->mode, dev->unitnum, &dev->di)->media_inserted ? 0 : 1; if (dev->di.media_inserted >= 0) {
io_actual = devinfo (pdev->mode, dev->unitnum, &dev->di)->media_inserted > 0 ? 0 : 1;
} else {
io_actual = 1;
}
break; break;
case CMD_PROTSTATUS: case CMD_PROTSTATUS:
io_actual = devinfo (pdev->mode, dev->unitnum, &dev->di)->write_protected ? -1 : 0; io_actual = devinfo (pdev->mode, dev->unitnum, &dev->di)->write_protected ? -1 : 0;
...@@ -637,7 +685,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request) ...@@ -637,7 +685,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
io_actual = dev->drivetype; io_actual = dev->drivetype;
break; break;
case CMD_GETNUMTRACKS: case CMD_GETNUMTRACKS:
if (!dev->di.media_inserted) if (dev->di.media_inserted <= 0)
goto no_media; goto no_media;
io_actual = dev->di.cylinders; io_actual = dev->di.cylinders;
break; break;
...@@ -645,7 +693,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request) ...@@ -645,7 +693,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
{ {
struct device_info *di; struct device_info *di;
di = devinfo (pdev->mode, dev->unitnum, &dev->di); di = devinfo (pdev->mode, dev->unitnum, &dev->di);
if (!di->media_inserted) if (di->media_inserted <= 0)
goto no_media; goto no_media;
put_long (io_data + 0, di->bytespersector); put_long (io_data + 0, di->bytespersector);
put_long (io_data + 4, di->sectorspertrack * di->trackspercylinder * di->cylinders); put_long (io_data + 4, di->sectorspertrack * di->trackspercylinder * di->cylinders);
...@@ -734,7 +782,7 @@ static uae_u32 REGPARAM2 dev_beginio (TrapContext *context) ...@@ -734,7 +782,7 @@ static uae_u32 REGPARAM2 dev_beginio (TrapContext *context)
struct priv_devstruct *pdev = getpdevstruct (request); struct priv_devstruct *pdev = getpdevstruct (request);
struct devstruct *dev; struct devstruct *dev;
put_byte (request+8, NT_MESSAGE); put_byte (request + 8, NT_MESSAGE);
if (!pdev) { if (!pdev) {
put_byte (request + 31, 32); put_byte (request + 31, 32);
return get_byte (request + 31); return get_byte (request + 31);
...@@ -744,14 +792,14 @@ static uae_u32 REGPARAM2 dev_beginio (TrapContext *context) ...@@ -744,14 +792,14 @@ static uae_u32 REGPARAM2 dev_beginio (TrapContext *context)
put_byte (request + 31, 32); put_byte (request + 31, 32);
return get_byte (request + 31); return get_byte (request + 31);
} }
put_byte (request+31, 0); put_byte (request + 31, 0);
if ((flags & 1) && dev_canquick (dev, request)) { if ((flags & 1) && dev_canquick (dev, request)) {
if (dev_do_io (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 ("device %s command %d bug with IO_QUICK\n", getdevname (pdev->type), command);
return get_byte (request + 31); return get_byte (request + 31);
} else { } else {
add_async_request (dev, request, ASYNC_REQUEST_TEMP, 0); add_async_request (dev, request, ASYNC_REQUEST_TEMP, 0);
put_byte (request+30, get_byte (request + 30) & ~1); put_byte (request + 30, get_byte (request + 30) & ~1);
write_comm_pipe_u32 (&dev->requests, request, 1); write_comm_pipe_u32 (&dev->requests, request, 1);
return 0; return 0;
} }
...@@ -853,21 +901,32 @@ static void dev_reset (void) ...@@ -853,21 +901,32 @@ static void dev_reset (void)
for (i = 0; i < MAX_OPEN_DEVICES; i++) for (i = 0; i < MAX_OPEN_DEVICES; i++)
memset (&pdevst[i], 0, sizeof (struct priv_devstruct)); memset (&pdevst[i], 0, sizeof (struct priv_devstruct));
if (currprefs.cdimagefile[0]) { int didswitch = -1;
scsiemul_switchscsi (currprefs.cdimagefile); if (currprefs.cdimagefile[0] || currprefs.cdimagefileuse)
} else { didswitch = scsiemul_switchscsi (currprefs.cdimagefile);
if (didswitch < 0) {
device_func_init (DEVICE_TYPE_SCSI); device_func_init (DEVICE_TYPE_SCSI);
i = j = 0; i = j = 0;
while (i < MAX_TOTAL_DEVICES) { while (i < MAX_TOTAL_DEVICES) {
int mode = -1;
dev = &devst[i]; dev = &devst[i];
discsi = 0; discsi = 0;
if (sys_command_open (DF_SCSI, j)) { if (sys_command_open (DF_SCSI, j)) {
discsi = sys_command_info (DF_SCSI, j, &discsi2); dev->allow_scsi = 1;
sys_command_close (DF_SCSI, j); mode = DF_SCSI;
}
if (!dev->allow_scsi) {
if (sys_command_open (DF_IOCTL, j)) {
dev->allow_ioctl = 1;
mode = DF_IOCTL;
}
}
if (mode >= 0) {
discsi = sys_command_info (mode, j, &discsi2);
sys_command_close (mode, j);
} }
if (discsi) { if (discsi) {
dev->unitnum = j; dev->unitnum = j;
dev->allow_scsi = 1;
dev->drivetype = discsi->type; dev->drivetype = discsi->type;
memcpy (&dev->di, discsi, sizeof (struct device_info)); memcpy (&dev->di, discsi, sizeof (struct device_info));
if (discsi->type == INQ_ROMD) if (discsi->type == INQ_ROMD)
......
...@@ -4,7 +4,7 @@ running configure, to aid debugging if configure makes a mistake. ...@@ -4,7 +4,7 @@ running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was It was created by configure, which was
generated by GNU Autoconf 2.65. Invocation command line was generated by GNU Autoconf 2.65. Invocation command line was
$ ./configure --disable-option-checking --prefix=/usr/local --with-sdl --with-sdl-gl --with-sdl-gfx --with-sdl-sound --with-caps --with-gayle --enable-drvsnd --enable-amax --enable-cd32 --enable-scsi-device --disable-jit --cache-file=/dev/null --srcdir=. $ ./configure --disable-option-checking --prefix=/usr/local --with-sdl --with-sdl-gl --with-sdl-gfx --with-alsa --with-caps --with-gayle --enable-drvsnd --enable-amax --enable-cd32 --enable-scsi-device --cache-file=/dev/null --srcdir=.
## --------- ## ## --------- ##
## Platform. ## ## Platform. ##
...@@ -445,7 +445,7 @@ configure:4344: $? = 0 ...@@ -445,7 +445,7 @@ configure:4344: $? = 0
configure:4344: result: yes configure:4344: result: yes
configure:4350: checking for _doprnt configure:4350: checking for _doprnt
configure:4350: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5 configure:4350: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/ccLbz9UG.o: In function `main': /tmp/cc4HIdmv.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:67: undefined reference to `_doprnt' /home/gnostic/puaex/src/tools/conftest.c:67: undefined reference to `_doprnt'
collect2: ld returned 1 exit status collect2: ld returned 1 exit status
configure:4350: $? = 1 configure:4350: $? = 1
...@@ -533,7 +533,7 @@ configure:4364: $? = 0 ...@@ -533,7 +533,7 @@ configure:4364: $? = 0
configure:4364: result: yes configure:4364: result: yes
configure:4364: checking for strcmpi configure:4364: checking for strcmpi
configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5 configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/cc9bDtRS.o: In function `main': /tmp/cc8gAlpK.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `strcmpi' /home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `strcmpi'
collect2: ld returned 1 exit status collect2: ld returned 1 exit status
configure:4364: $? = 1 configure:4364: $? = 1
...@@ -613,7 +613,7 @@ configure: failed program was: ...@@ -613,7 +613,7 @@ configure: failed program was:
configure:4364: result: no configure:4364: result: no
configure:4364: checking for stricmp configure:4364: checking for stricmp
configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5 configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/ccXCfhuX.o: In function `main': /tmp/ccuLVxdI.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `stricmp' /home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `stricmp'
collect2: ld returned 1 exit status collect2: ld returned 1 exit status
configure:4364: $? = 1 configure:4364: $? = 1
......
...@@ -438,7 +438,7 @@ $config_links ...@@ -438,7 +438,7 @@ $config_links
Report bugs to the package provider." Report bugs to the package provider."
ac_cs_config="'--disable-option-checking' '--prefix=/usr/local' '--with-sdl' '--with-sdl-gl' '--with-sdl-gfx' '--with-sdl-sound' '--with-caps' '--with-gayle' '--enable-drvsnd' '--enable-amax' '--enable-cd32' '--enable-scsi-device' '--disable-jit' '--cache-file=/dev/null' '--srcdir=.'" ac_cs_config="'--disable-option-checking' '--prefix=/usr/local' '--with-sdl' '--with-sdl-gl' '--with-sdl-gfx' '--with-alsa' '--with-caps' '--with-gayle' '--enable-drvsnd' '--enable-amax' '--enable-cd32' '--enable-scsi-device' '--cache-file=/dev/null' '--srcdir=.'"
ac_cs_version="\ ac_cs_version="\
config.status config.status
configured by ./configure, generated by GNU Autoconf 2.65, configured by ./configure, generated by GNU Autoconf 2.65,
...@@ -522,7 +522,7 @@ if $ac_cs_silent; then ...@@ -522,7 +522,7 @@ if $ac_cs_silent; then
fi fi
if $ac_cs_recheck; then if $ac_cs_recheck; then
set X '/bin/bash' './configure' '--disable-option-checking' '--prefix=/usr/local' '--with-sdl' '--with-sdl-gl' '--with-sdl-gfx' '--with-sdl-sound' '--with-caps' '--with-gayle' '--enable-drvsnd' '--enable-amax' '--enable-cd32' '--enable-scsi-device' '--disable-jit' '--cache-file=/dev/null' '--srcdir=.' $ac_configure_extra_args --no-create --no-recursion set X '/bin/bash' './configure' '--disable-option-checking' '--prefix=/usr/local' '--with-sdl' '--with-sdl-gl' '--with-sdl-gfx' '--with-alsa' '--with-caps' '--with-gayle' '--enable-drvsnd' '--enable-amax' '--enable-cd32' '--enable-scsi-device' '--cache-file=/dev/null' '--srcdir=.' $ac_configure_extra_args --no-create --no-recursion
shift shift
$as_echo "running CONFIG_SHELL=/bin/bash $*" >&6 $as_echo "running CONFIG_SHELL=/bin/bash $*" >&6
CONFIG_SHELL='/bin/bash' CONFIG_SHELL='/bin/bash'
......
...@@ -288,7 +288,7 @@ static uae_u32 emulib_Debug (void) ...@@ -288,7 +288,7 @@ static uae_u32 emulib_Debug (void)
} }
#define CREATE_NATIVE_FUNC_PTR uae_u32 (* native_func)( uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, \ #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) uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32)
#define SET_NATIVE_FUNC(x) 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, uae_u32))(x) #define SET_NATIVE_FUNC(x) 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, uae_u32))(x)
#define CALL_NATIVE_FUNC( d1,d2,d3,d4,d5,d6,d7,a1,a2,a3,a4,a5,a6 ) if(native_func) native_func( d1,d2,d3,d4,d5,d6,d7,a1,a2,a3,a4,a5,a6 ) #define CALL_NATIVE_FUNC( d1,d2,d3,d4,d5,d6,d7,a1,a2,a3,a4,a5,a6 ) if(native_func) native_func( d1,d2,d3,d4,d5,d6,d7,a1,a2,a3,a4,a5,a6 )
...@@ -315,12 +315,12 @@ static uae_u32 REGPARAM2 emulib_ExecuteNativeCode (void) ...@@ -315,12 +315,12 @@ static uae_u32 REGPARAM2 emulib_ExecuteNativeCode (void)
uae_u8* object_UAM = NULL; uae_u8* object_UAM = NULL;
CREATE_NATIVE_FUNC_PTR; CREATE_NATIVE_FUNC_PTR;
if( get_mem_bank( object_AAM ).check( object_AAM, 1 ) ) if (get_mem_bank(object_AAM).check (object_AAM, 1))
object_UAM = get_mem_bank( object_AAM).xlateaddr( object_AAM ); object_UAM = get_mem_bank (object_AAM).xlateaddr (object_AAM);
if (object_UAM) { if (object_UAM) {
SET_NATIVE_FUNC( FindFunctionInObject( object_UAM ) ); SET_NATIVE_FUNC (FindFunctionInObject (object_UAM));
CALL_NATIVE_FUNC( d1, d2, d3, d4, d5, d6, d7, a1, a2, a3, a4, a5, a6); CALL_NATIVE_FUNC (d1, d2, d3, d4, d5, d6, d7, a1, a2, a3, a4, a5, a6);
} }
return 1; return 1;
#endif #endif
......
/* /*
* UAE - The Un*x Amiga Emulator * UAE - The Un*x Amiga Emulator
* *
* routines to handle compressed file automatically * routines to handle compressed file automatically
...@@ -240,7 +240,7 @@ static void removeext (TCHAR *s, TCHAR *ext) ...@@ -240,7 +240,7 @@ static void removeext (TCHAR *s, TCHAR *ext)
s[_tcslen (s) - _tcslen (ext)] = 0; s[_tcslen (s) - _tcslen (ext)] = 0;
} }
static uae_u8 exeheader[]={0x00,0x00,0x03,0xf3,0x00,0x00,0x00,0x00}; static uae_u8 exeheader[]={ 0x00,0x00,0x03,0xf3,0x00,0x00,0x00,0x00 };
static TCHAR *diskimages[] = { "adf", "adz", "ipf", "fdi", "dms", "wrp", "dsq", 0 }; static TCHAR *diskimages[] = { "adf", "adz", "ipf", "fdi", "dms", "wrp", "dsq", 0 };
int zfile_gettype (struct zfile *z) int zfile_gettype (struct zfile *z)
...@@ -276,7 +276,7 @@ int zfile_gettype (struct zfile *z) ...@@ -276,7 +276,7 @@ int zfile_gettype (struct zfile *z)
memset (buf, 0, sizeof (buf)); memset (buf, 0, sizeof (buf));
zfile_fread (buf, 8, 1, z); zfile_fread (buf, 8, 1, z);
zfile_fseek (z, -8, SEEK_CUR); zfile_fseek (z, -8, SEEK_CUR);
if (!memcmp (buf, exeheader, sizeof(buf))) if (!memcmp (buf, exeheader, sizeof (buf)))
return ZFILE_DISKIMAGE; return ZFILE_DISKIMAGE;
if (!memcmp (buf, "RDSK", 4)) if (!memcmp (buf, "RDSK", 4))
return ZFILE_HDFRDB; return ZFILE_HDFRDB;
...@@ -1401,7 +1401,7 @@ static FILE *openzip (char *name, char *zippath) ...@@ -1401,7 +1401,7 @@ static FILE *openzip (char *name, char *zippath)
#ifdef SINGLEFILE #ifdef SINGLEFILE
extern uae_u8 singlefile_data[]; extern uae_u8 singlefile_data[];
static struct zfile *zfile_opensinglefile (struct zfile *l) static struct zfile *zfile_opensinglefile(struct zfile *l)
{ {
uae_u8 *p = singlefile_data; uae_u8 *p = singlefile_data;
int size, offset; int size, offset;
...@@ -1445,7 +1445,7 @@ struct zfile *zfile_fopen (const char *name, const char *mode, int mask) ...@@ -1445,7 +1445,7 @@ struct zfile *zfile_fopen (const char *name, const char *mode, int mask)
FILE *f; FILE *f;
char zipname[1000]; char zipname[1000];
if( *name == '\0' ) if(*name == '\0')
return NULL; return NULL;
l = zfile_create (NULL); l = zfile_create (NULL);
l->name = strdup (name); l->name = strdup (name);
...@@ -1821,8 +1821,8 @@ int zfile_zcompress (struct zfile *f, void *src, int size) ...@@ -1821,8 +1821,8 @@ int zfile_zcompress (struct zfile *f, void *src, int size)
while (v == Z_OK) { while (v == Z_OK) {
zs.next_out = outbuf; zs.next_out = outbuf;
zs.avail_out = sizeof (outbuf); zs.avail_out = sizeof (outbuf);
v = deflate(&zs, Z_NO_FLUSH | Z_FINISH); v = deflate (&zs, Z_NO_FLUSH | Z_FINISH);
if (sizeof(outbuf) - zs.avail_out > 0) if (sizeof (outbuf) - zs.avail_out > 0)
zfile_fwrite (outbuf, 1, sizeof (outbuf) - zs.avail_out, f); zfile_fwrite (outbuf, 1, sizeof (outbuf) - zs.avail_out, f);
} }
deflateEnd (&zs); deflateEnd (&zs);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment