puae 2.3.1

parent b7de61b2
...@@ -35,6 +35,10 @@ static int delayed[MAX_TOTAL_SCSI_DEVICES]; ...@@ -35,6 +35,10 @@ static int delayed[MAX_TOTAL_SCSI_DEVICES];
static uae_sem_t unitsem[MAX_TOTAL_SCSI_DEVICES]; static uae_sem_t unitsem[MAX_TOTAL_SCSI_DEVICES];
static int unitsem_cnt[MAX_TOTAL_SCSI_DEVICES]; static int unitsem_cnt[MAX_TOTAL_SCSI_DEVICES];
static TCHAR newimagefiles[MAX_TOTAL_SCSI_DEVICES][256];
static int imagechangetime[MAX_TOTAL_SCSI_DEVICES];
static bool cdimagefileinuse[MAX_TOTAL_SCSI_DEVICES], wasopen[MAX_TOTAL_SCSI_DEVICES];
/* convert minutes, seconds and frames -> logical sector number */ /* convert minutes, seconds and frames -> logical sector number */
int msf2lsn (int msf) int msf2lsn (int msf)
{ {
...@@ -449,11 +453,18 @@ void blkdev_cd_change (int unitnum, const TCHAR *name) ...@@ -449,11 +453,18 @@ void blkdev_cd_change (int unitnum, const TCHAR *name)
void device_func_reset (void) void device_func_reset (void)
{ {
unsigned int i;
for (i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) {
wasopen[i] = false;
waspaused[i] = false;
imagechangetime[i] = 0;
cdimagefileinuse[i] = false;
newimagefiles[i][0] = 0;
}
} }
int device_func_init (int flags) int device_func_init (int flags)
{ {
device_func_reset ();
blkdev_fix_prefs (&currprefs); blkdev_fix_prefs (&currprefs);
install_driver (flags); install_driver (flags);
return 1; return 1;
...@@ -485,12 +496,6 @@ void blkdev_exitgui (void) ...@@ -485,12 +496,6 @@ void blkdev_exitgui (void)
} }
} }
static TCHAR newimagefiles[MAX_TOTAL_SCSI_DEVICES][256];
static int imagechangetime[MAX_TOTAL_SCSI_DEVICES];
static bool cdimagefileinuse[MAX_TOTAL_SCSI_DEVICES], wasopen[MAX_TOTAL_SCSI_DEVICES];
static void check_changes (int unitnum) static void check_changes (int unitnum)
{ {
bool changed = false; bool changed = false;
...@@ -1070,6 +1075,19 @@ static int addtocentry (uae_u8 **dstp, int *len, int point, int newpoint, int ms ...@@ -1070,6 +1075,19 @@ static int addtocentry (uae_u8 **dstp, int *len, int point, int newpoint, int ms
return -1; return -1;
} }
static int scsiemudrv (int unitnum, uae_u8 *cmd)
{
if (failunit (unitnum))
return -1;
if (!getsem (unitnum))
return 0;
int v = 0;
if (device_func[unitnum]->scsiemu)
v = device_func[unitnum]->scsiemu (unitnum, cmd);
freesem (unitnum);
return v;
}
static int scsi_read_cd (int unitnum, uae_u8 *cmd, uae_u8 *data, struct device_info *di) static int scsi_read_cd (int unitnum, uae_u8 *cmd, uae_u8 *data, struct device_info *di)
{ {
int msf = cmd[0] == 0xb9; int msf = cmd[0] == 0xb9;
...@@ -1452,6 +1470,7 @@ static int scsi_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len, ...@@ -1452,6 +1470,7 @@ static int scsi_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
break; break;
case 0x1b: // START/STOP case 0x1b: // START/STOP
sys_command_cd_stop (unitnum); sys_command_cd_stop (unitnum);
scsiemudrv (unitnum, cmdbuf);
scsi_len = 0; scsi_len = 0;
break; break;
case 0x1e: // PREVENT/ALLOW MEDIA REMOVAL case 0x1e: // PREVENT/ALLOW MEDIA REMOVAL
...@@ -1777,6 +1796,10 @@ uae_u8 *save_cd (int num, int *len) ...@@ -1777,6 +1796,10 @@ uae_u8 *save_cd (int num, int *len)
if (!currprefs.cdslots[num].inuse || num >= MAX_TOTAL_SCSI_DEVICES) if (!currprefs.cdslots[num].inuse || num >= MAX_TOTAL_SCSI_DEVICES)
return NULL; return NULL;
#ifdef CD32
if (!currprefs.cs_cd32cd && !currprefs.cs_cdtvcd && !currprefs.scsi)
return NULL;
#endif
dstbak = dst = xmalloc (uae_u8, 4 + 256 + 4 + 4); dstbak = dst = xmalloc (uae_u8, 4 + 256 + 4 + 4);
save_u32 (4); save_u32 (4);
save_string (currprefs.cdslots[num].name); save_string (currprefs.cdslots[num].name);
......
...@@ -1519,7 +1519,7 @@ static int parse_image (struct cdunit *cdu, const TCHAR *img) ...@@ -1519,7 +1519,7 @@ static int parse_image (struct cdunit *cdu, const TCHAR *img)
} }
if (!cdu->tracks) { if (!cdu->tracks) {
uae_u64 siz = zfile_size (zcue); uae_u64 siz = zfile_size (zcue);
if (siz >= 16384 && (siz % 2048) == 0 || (siz % 2352) == 0) { if (siz >= 16384 && ((siz % 2048) == 0 || (siz % 2352) == 0)) {
struct cdtoc *t = &cdu->toc[0]; struct cdtoc *t = &cdu->toc[0];
cdu->tracks = 1; cdu->tracks = 1;
t->ctrl = 4; t->ctrl = 4;
...@@ -1528,12 +1528,15 @@ static int parse_image (struct cdunit *cdu, const TCHAR *img) ...@@ -1528,12 +1528,15 @@ static int parse_image (struct cdunit *cdu, const TCHAR *img)
t->handle = zcue; t->handle = zcue;
t->size = (siz % 2048) == 0 ? 2048 : 2352; t->size = (siz % 2048) == 0 ? 2048 : 2352;
t->filesize = siz; t->filesize = siz;
write_log ("CUE: plain CD image mounted!\n"); write_log ("CD: plain CD image mounted!\n");
cdu->toc[1].address = t->address + t->filesize / t->size; cdu->toc[1].address = t->address + t->filesize / t->size;
zcue = NULL; zcue = NULL;
} }
} }
if (!cdu->tracks)
write_log ("CD: couldn't mount '%s'!\n", img);
for (i = 0; i <= cdu->tracks; i++) { for (i = 0; i <= cdu->tracks; i++) {
struct cdtoc *t = &cdu->toc[i]; struct cdtoc *t = &cdu->toc[i];
uae_u32 msf = lsn2msf (t->address); uae_u32 msf = lsn2msf (t->address);
......
...@@ -1849,7 +1849,7 @@ uae_u8 *save_cia (int num, int *len, uae_u8 *dstptr) ...@@ -1849,7 +1849,7 @@ uae_u8 *save_cia (int num, int *len, uae_u8 *dstptr)
save_u8 (b); save_u8 (b);
b = (num ? ciabalarm : ciaaalarm); /* alarm LO */ b = (num ? ciabalarm : ciaaalarm); /* alarm LO */
save_u8 (b); save_u8 (b);
b = (num ? ciabalarm >> 8 : ciaaalarm >> 8); /* alarm MED */ b = (num ? ciabalarm >> 8 : ciaaalarm >> 8);/* alarm MED */
save_u8 (b); save_u8 (b);
b = (num ? ciabalarm >> 16 : ciaaalarm >> 16); /* alarm HI */ b = (num ? ciabalarm >> 16 : ciaaalarm >> 16); /* alarm HI */
save_u8 (b); save_u8 (b);
......
...@@ -2668,7 +2668,6 @@ void vsync_handle_redraw (int long_frame, int lof_changed) ...@@ -2668,7 +2668,6 @@ void vsync_handle_redraw (int long_frame, int lof_changed)
#ifdef SAVESTATE #ifdef SAVESTATE
if (!savestate_state) { if (!savestate_state) {
if (currprefs.quitstatefile[0]) { if (currprefs.quitstatefile[0]) {
write_log ("Draw: Save_State");
savestate_initsave (currprefs.quitstatefile, 1, 1, true); savestate_initsave (currprefs.quitstatefile, 1, 1, true);
save_state (currprefs.quitstatefile, ""); save_state (currprefs.quitstatefile, "");
} }
......
...@@ -1063,7 +1063,7 @@ static void expamem_init_z3fastmem_2 (addrbank *bank, uae_u32 start, uae_u32 siz ...@@ -1063,7 +1063,7 @@ static void expamem_init_z3fastmem_2 (addrbank *bank, uae_u32 start, uae_u32 siz
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));
expamem_write (0x04, 3); expamem_write (0x04, currprefs.maprom ? 3 : 83);
expamem_write (0x10, uae_id >> 8); expamem_write (0x10, uae_id >> 8);
expamem_write (0x14, uae_id & 0xff); expamem_write (0x14, uae_id & 0xff);
......
...@@ -60,7 +60,7 @@ extern char *validatedevicename (char *s); ...@@ -60,7 +60,7 @@ extern char *validatedevicename (char *s);
extern char *validatevolumename (char *s); extern char *validatevolumename (char *s);
int filesys_insert (int nr, TCHAR *volume, const TCHAR *rootdir, bool readonly, int flags); int filesys_insert (int nr, TCHAR *volume, const TCHAR *rootdir, bool readonly, int flags);
int filesys_eject(int nr); int filesys_eject (int nr);
int filesys_media_change (const char *rootdir, int inserted, struct uaedev_config_info *uci); int filesys_media_change (const char *rootdir, int inserted, struct uaedev_config_info *uci);
extern char *filesys_createvolname (const char *volname, const char *rootdir, const char *def); extern char *filesys_createvolname (const char *volname, const char *rootdir, const char *def);
......
...@@ -38,6 +38,10 @@ ...@@ -38,6 +38,10 @@
#define ERROR_NO_DISK 226 #define ERROR_NO_DISK 226
#define ERROR_NO_MORE_ENTRIES 232 #define ERROR_NO_MORE_ENTRIES 232
#define ERROR_NOT_IMPLEMENTED 236 #define ERROR_NOT_IMPLEMENTED 236
#define ERROR_RECORD_NOT_LOCKED 240
#define ERROR_LOCK_COLLISION 241
#define ERROR_LOCK_TIMEOUT 242
#define ERROR_UNLOCK_ERROR 243
#define A_FIBF_HIDDEN (1<<7) #define A_FIBF_HIDDEN (1<<7)
#define A_FIBF_SCRIPT (1<<6) #define A_FIBF_SCRIPT (1<<6)
......
...@@ -7,7 +7,8 @@ typedef unsigned long u32; ...@@ -7,7 +7,8 @@ typedef unsigned long u32;
extern void S2X_refresh (void); extern void S2X_refresh (void);
extern void S2X_render (void); extern void S2X_render (void);
extern void S2X_init (int dw, int dh, int aw, int ah, int mult, int ad, int dd); extern void S2X_init (int dw, int dh, int aw, int ah, int ad, int dd);
extern void S2X_reset (void);
extern void S2X_free (void); extern void S2X_free (void);
extern int S2X_getmult (void); extern int S2X_getmult (void);
...@@ -47,12 +48,14 @@ typedef int bool; ...@@ -47,12 +48,14 @@ typedef int bool;
#define UAE_FILTER_NULL 1 #define UAE_FILTER_NULL 1
#define UAE_FILTER_SCALE2X 2 #define UAE_FILTER_SCALE2X 2
#define UAE_FILTER_HQ 3 #define UAE_FILTER_HQ2X 3
#define UAE_FILTER_SUPEREAGLE 4 #define UAE_FILTER_HQ3X 4
#define UAE_FILTER_SUPER2XSAI 5 #define UAE_FILTER_HQ4X 5
#define UAE_FILTER_2XSAI 6 #define UAE_FILTER_SUPEREAGLE 6
#define UAE_FILTER_PAL 7 #define UAE_FILTER_SUPER2XSAI 7
#define UAE_FILTER_LAST 7 #define UAE_FILTER_2XSAI 8
#define UAE_FILTER_PAL 9
#define UAE_FILTER_LAST 9
#define UAE_FILTER_MODE_16 16 #define UAE_FILTER_MODE_16 16
#define UAE_FILTER_MODE_16_16 16 #define UAE_FILTER_MODE_16_16 16
...@@ -66,7 +69,7 @@ struct uae_filter ...@@ -66,7 +69,7 @@ struct uae_filter
{ {
int type, yuv, intmul; int type, yuv, intmul;
char *name, *cfgname; char *name, *cfgname;
int x[6]; int flags;
}; };
extern struct uae_filter uaefilters[]; extern struct uae_filter uaefilters[];
......
...@@ -24,4 +24,3 @@ static int td_pos = (TD_RIGHT|TD_BOTTOM); ...@@ -24,4 +24,3 @@ static int td_pos = (TD_RIGHT|TD_BOTTOM);
#define STATUSLINE_TARGET 0x80 #define STATUSLINE_TARGET 0x80
extern void draw_status_line_single (uae_u8 *buf, int bpp, int y, int totalwidth, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha); extern void draw_status_line_single (uae_u8 *buf, int bpp, int y, int totalwidth, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha);
...@@ -27,6 +27,11 @@ extern void target_addtorecent (const TCHAR*, int); ...@@ -27,6 +27,11 @@ extern void target_addtorecent (const TCHAR*, int);
extern void target_run (void); extern void target_run (void);
extern void target_quit (void); extern void target_quit (void);
extern bool get_plugin_path (TCHAR *out, int size, const TCHAR *path); extern bool get_plugin_path (TCHAR *out, int size, const TCHAR *path);
extern void stripslashes (TCHAR *p);
extern void fixtrailing (TCHAR *p);
extern void fullpath (TCHAR *path, int size);
extern void getpathpart (TCHAR *outpath, int size, const TCHAR *inpath);
extern void getfilepart (TCHAR *out, int size, const TCHAR *path);
extern int quit_program; extern int quit_program;
extern bool console_emulation; extern bool console_emulation;
......
...@@ -1921,7 +1921,7 @@ static void Exception_ce000 (int nr) ...@@ -1921,7 +1921,7 @@ static void Exception_ce000 (int nr)
x_put_word (m68k_areg (regs, 7) + 0, mode); x_put_word (m68k_areg (regs, 7) + 0, mode);
x_put_word (m68k_areg (regs, 7) + 2, last_fault_for_exception_3 >> 16); x_put_word (m68k_areg (regs, 7) + 2, last_fault_for_exception_3 >> 16);
x_do_cycles (2 * cpucycleunit); x_do_cycles (2 * cpucycleunit);
write_log ("Exception %d (%x) at %x -> %x!\n", nr, last_addr_for_exception_3, currpc, get_long (4 * nr)); write_log ("Exception CE %d (%x) at %x -> %x!\n", nr, last_addr_for_exception_3, currpc, get_long (4 * nr));
goto kludge_me_do; goto kludge_me_do;
} }
m68k_areg (regs, 7) -= 6; m68k_areg (regs, 7) -= 6;
...@@ -2218,7 +2218,7 @@ static void Exception_normal (int nr) ...@@ -2218,7 +2218,7 @@ static void Exception_normal (int nr)
m68k_areg (regs, 7) -= 2; m68k_areg (regs, 7) -= 2;
x_put_word (m68k_areg (regs, 7), 0xb000 + nr * 4); x_put_word (m68k_areg (regs, 7), 0xb000 + nr * 4);
} }
write_log ("Exception %d (%x) at %x -> %x!\n", nr, regs.instruction_pc, currpc, x_get_long (regs.vbr + 4*nr)); write_log ("Exception 20 %d (%x) at %x -> %x!\n", nr, regs.instruction_pc, currpc, x_get_long (regs.vbr + 4*nr));
} else if (nr ==5 || nr == 6 || nr == 7 || nr == 9) { } else if (nr ==5 || nr == 6 || nr == 7 || nr == 9) {
m68k_areg (regs, 7) -= 4; m68k_areg (regs, 7) -= 4;
x_put_long (m68k_areg (regs, 7), regs.instruction_pc); x_put_long (m68k_areg (regs, 7), regs.instruction_pc);
...@@ -2253,7 +2253,7 @@ static void Exception_normal (int nr) ...@@ -2253,7 +2253,7 @@ static void Exception_normal (int nr)
x_put_word (m68k_areg (regs, 7) + 6, last_op_for_exception_3); x_put_word (m68k_areg (regs, 7) + 6, last_op_for_exception_3);
x_put_word (m68k_areg (regs, 7) + 8, regs.sr); x_put_word (m68k_areg (regs, 7) + 8, regs.sr);
x_put_long (m68k_areg (regs, 7) + 10, last_addr_for_exception_3); x_put_long (m68k_areg (regs, 7) + 10, last_addr_for_exception_3);
write_log ("Exception %d (%x) at %x -> %x!\n", nr, last_fault_for_exception_3, currpc, x_get_long (regs.vbr + 4*nr)); write_log ("Exception 00 %d (%x) at %x -> %x!\n", nr, last_fault_for_exception_3, currpc, x_get_long (regs.vbr + 4*nr));
goto kludge_me_do; goto kludge_me_do;
} }
} }
...@@ -2894,7 +2894,7 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode) ...@@ -2894,7 +2894,7 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode)
if ((opcode & 0xF000) == 0xF000) { if ((opcode & 0xF000) == 0xF000) {
if (warned < 20) { if (warned < 20) {
write_log ("B-Trap %x at %x (%p)\n", opcode, pc, regs.pc_p); //write_log ("B-Trap %x at %x (%p)\n", opcode, pc, regs.pc_p);
warned++; warned++;
} }
Exception (0xB); Exception (0xB);
...@@ -2903,7 +2903,7 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode) ...@@ -2903,7 +2903,7 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode)
} }
if ((opcode & 0xF000) == 0xA000) { if ((opcode & 0xF000) == 0xA000) {
if (warned < 20) { if (warned < 20) {
write_log ("A-Trap %x at %x (%p)\n", opcode, pc, regs.pc_p); //write_log ("A-Trap %x at %x (%p)\n", opcode, pc, regs.pc_p);
warned++; warned++;
} }
Exception (0xA); Exception (0xA);
...@@ -2911,7 +2911,7 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode) ...@@ -2911,7 +2911,7 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode)
return 4; return 4;
} }
if (warned < 20) { if (warned < 20) {
write_log ("Illegal instruction: %04x at %08X -> %08X\n", opcode, pc, get_long (regs.vbr + 0x10)); //write_log ("Illegal instruction: %04x at %08X -> %08X\n", opcode, pc, get_long (regs.vbr + 0x10));
warned++; warned++;
//activate_debugger(); //activate_debugger();
} }
...@@ -3505,6 +3505,7 @@ static void m68k_run_1_ce (void) ...@@ -3505,6 +3505,7 @@ static void m68k_run_1_ce (void)
cputrace.cyclecounter = cputrace.cyclecounter_pre = cputrace.cyclecounter_post = 0; cputrace.cyclecounter = cputrace.cyclecounter_pre = cputrace.cyclecounter_post = 0;
cputrace.readcounter = cputrace.writecounter = 0; cputrace.readcounter = cputrace.writecounter = 0;
} }
if (inputrecord_debug & 4) { if (inputrecord_debug & 4) {
if (input_record > 0) if (input_record > 0)
inprec_recorddebug_cpu (1); inprec_recorddebug_cpu (1);
...@@ -3831,6 +3832,7 @@ static void m68k_run_2ce (void) ...@@ -3831,6 +3832,7 @@ static void m68k_run_2ce (void)
cputrace.cyclecounter = cputrace.cyclecounter_pre = cputrace.cyclecounter_post = 0; cputrace.cyclecounter = cputrace.cyclecounter_pre = cputrace.cyclecounter_post = 0;
cputrace.readcounter = cputrace.writecounter = 0; cputrace.readcounter = cputrace.writecounter = 0;
} }
if (inputrecord_debug & 4) { if (inputrecord_debug & 4) {
if (input_record > 0) if (input_record > 0)
inprec_recorddebug_cpu (1); inprec_recorddebug_cpu (1);
...@@ -4049,6 +4051,7 @@ void m68k_go (int may_quit) ...@@ -4049,6 +4051,7 @@ void m68k_go (int may_quit)
if (changed_prefs.inprecfile[0] && input_record) if (changed_prefs.inprecfile[0] && input_record)
inprec_prepare_record (savestate_fname[0] ? savestate_fname : NULL); inprec_prepare_record (savestate_fname[0] ? savestate_fname : NULL);
set_cpu_tracer (false); set_cpu_tracer (false);
#ifdef DEBUGGER #ifdef DEBUGGER
......
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