{
uae_u8 *p;
uae_u32 size;
+ int i;
if (!ismedia())
return -1;
cd_motor = 1;
out[0] = cdrom_toc[2];
- out[1] = cdrom_toc[3];
+ i = (cdrom_toc[0] << 8) | (cdrom_toc[1] << 0);
+ i -= 2 + 11;
+ i /= 11;
+ p = cdrom_toc + 4 + i * 11;
+ out[1] = p[3];
p = cdrom_toc + 4 + 2 * 11;
size = ((p[8] << 16) | (p[9] << 8) | p[10]);
out[2] = size >> 16;
static void *dev_thread (void *p)
{
write_log("CDTV: CD thread started\n");
+ thread_alive = 1;
for (;;) {
uae_u32 b = read_comm_pipe_u32_blocking (&requests);
int first = -1;
int cdtvunit = -1, audiounit = -1;
- if (unitnum >= 0)
+ if (unitnum >= 0) {
+ cdaudiostop();
sys_command_close (DF_IOCTL, unitnum);
- cdtv_reset();
+ }
unitnum = -1;
+ cdtv_reset();
if (!device_func_init(DEVICE_TYPE_ANY)) {
write_log ("no CDROM support\n");
return;
return v;
}
+void cdtv_free (void)
+{
+ if (thread_alive > 0) {
+ write_comm_pipe_u32 (&requests, 0xffff, 1);
+ while (thread_alive > 0)
+ sleep_millis(10);
+ }
+ thread_alive = 0;
+ cdaudiostop ();
+ if (unitnum >= 0)
+ sys_command_close(DF_IOCTL, unitnum);
+ unitnum = -1;
+ configured = 0;
+}
-void dmac_init (void)
+void cdtv_init (void)
{
if (!thread_alive) {
uae_thread_id tid;
init_comm_pipe (&requests, 100, 1);
uae_start_thread ("cdtv", dev_thread, NULL, &tid);
+ while (!thread_alive)
+ sleep_millis(10);
}
configured = 0;
allocate_expamem ();
if (currprefs.cs_cdtvcd)
- dmac_init ();
+ cdtv_init ();
/* check if Kickstart version is below 1.3 */
if (! ersatzkickfile && kickstart_version
struct hardfiledata *get_hardfile_data (int nr)
{
UnitInfo *uip = mountinfo.ui;
- if (nr < 0 || uip[nr].open == 0 || uip[nr].volname != 0)
+ if (nr < 0 || nr >= MAX_FILESYSTEM_UNITS || uip[nr].open == 0 || uip[nr].volname != 0)
return 0;
return &uip[nr].hf;
}
}
static uaecptr
-action_dup_lock_2 (Unit *unit, dpacket packet, uaecptr lock)
+action_dup_lock_2 (Unit *unit, dpacket packet, uae_u32 uniq)
{
uaecptr out;
a_inode *a;
- TRACE(("ACTION_DUP_LOCK(0x%lx)\n", lock));
- DUMPLOCK(unit, lock);
- if (!lock) {
- PUT_PCK_RES1 (packet, 0);
- return 0;
- }
- a = lookup_aino (unit, get_long (lock + 4));
+ a = lookup_aino (unit, uniq);
if (a == 0) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_OBJECT_NOT_AROUND);
action_dup_lock (Unit *unit, dpacket packet)
{
uaecptr lock = GET_PCK_ARG1 (packet) << 2;
- action_dup_lock_2 (unit, packet, lock);
+ TRACE(("ACTION_DUP_LOCK(0x%lx)\n", lock));
+ if (!lock) {
+ PUT_PCK_RES1 (packet, 0);
+ return;
+ }
+ action_dup_lock_2 (unit, packet, get_long(lock + 4));
+}
+
+
+static void
+action_lock_from_fh (Unit *unit, dpacket packet)
+{
+ uaecptr out;
+ Key *k = lookup_key (unit, GET_PCK_ARG1 (packet));
+ TRACE(("ACTION_COPY_DIR_FH(0x%lx)\n", GET_PCK_ARG1 (packet)));
+ if (k == 0) {
+ PUT_PCK_RES1 (packet, DOS_FALSE);
+ return;
+ }
+ out = action_dup_lock_2 (unit, packet, k->aino->uniq);
}
/* convert time_t to/from AmigaDOS time */
-const int secs_per_day = 24 * 60 * 60;
-const int diff = (8 * 365 + 2) * (24 * 60 * 60);
+static const int secs_per_day = 24 * 60 * 60;
+static const int diff = (8 * 365 + 2) * (24 * 60 * 60);
static void
get_time (time_t t, long* days, long* mins, long* ticks)
if (create)
fsdb_set_file_attrs (aino);
- put_long (fh+36, k->uniq);
+ put_long (fh + 36, k->uniq);
if (create == 2)
aino->elock = 1;
else
PUT_PCK_RES1 (packet, DOS_TRUE);
}
-static void
-action_lock_from_fh (Unit *unit, dpacket packet)
-{
- uaecptr out;
- Key *k = lookup_key (unit, GET_PCK_ARG1 (packet));
- //write_log("lock_from_fh %x\n", k);
- if (k == 0) {
- PUT_PCK_RES1 (packet, DOS_FALSE);
- return;
- }
- out = action_dup_lock_2 (unit, packet, make_lock (unit, k->aino->uniq, -2));
- //write_log("=%x\n", out);
-}
-
static void
action_fh_from_lock (Unit *unit, dpacket packet)
{
mode_t openmode;
int mode;
- TRACE(("ACTION_FH_FROM_LOCK(0x%lx,0x%lx)\n",fh,lock));
+ TRACE(("ACTION_FH_FROM_LOCK(0x%lx,0x%lx)\n", fh, lock));
DUMPLOCK(unit,lock);
if (!lock) {
extern addrbank dmac_bank;
-extern void dmac_init (void);
+extern void cdtv_init (void);
+extern void cdtv_free (void);
extern void CDTV_hsync_handler(void);
extern void cdtv_entergui (void);
#include "scsidev.h"
#include "uaeserial.h"
#include "akiko.h"
+#include "cdtv.h"
#include "savestate.h"
#include "filesys.h"
#include "parallel.h"
#ifdef SERIAL_PORT
serial_exit ();
#endif
+#ifdef CDTV
+ cdtv_free ();
+#endif
#ifdef CD32
akiko_free ();
#endif
}
}
}
- return kickmem_xlate (0); /* So we don't crash. */
+ return kickmem_xlate (2); /* So we don't crash. */
}
/* Address banks */
exception_debug (nr);
MakeSR(regs);
- if (nr == 3)
- activate_debugger();
-
if (!regs->s) {
regs->usp = m68k_areg(regs, 7);
if (currprefs.cpu_level >= 2)
void cpureset (void)
{
- customreset ();
-#if 0
+ uaecptr pc;
+ uaecptr ksboot = 0xf80002 - 2; /* -2 = RESET hasn't increased PC yet */
uae_u16 ins;
- if (currprefs.cpu_level == 0 && (currprefs.cpu_compatible || currprefs.cpu_cycle_exact)) {
+
+ if (currprefs.cpu_compatible || currprefs.cpu_cycle_exact) {
+ customreset ();
+ return;
+ }
+ pc = m68k_getpc(®s);
+ if (pc >= currprefs.chipmem_size) {
+ addrbank *b = &get_mem_bank(pc);
+ if (b->check(pc, 2 + 2)) {
+ /* We have memory, hope for the best.. */
+ customreset ();
+ return;
+ }
+ write_log("M68K RESET PC=%x, rebooting..\n", pc);
customreset ();
+ m68k_setpc (®s, ksboot);
return;
}
- ins = get_word (m68k_getpc(®s) + 2);
+ /* panic, RAM is going to disappear under PC */
+ ins = get_word (pc + 2);
if ((ins & ~7) == 0x4ed0) {
int reg = ins & 7;
uae_u32 addr = m68k_areg (®s, reg);
- write_log ("reset/jmp (ax) combination emulated\n");
+ write_log ("reset/jmp (ax) combination emulated -> %x\n", addr);
customreset ();
if (addr < 0x80000)
addr += 0xf80000;
- m68k_setpc (®s, addr);
+ m68k_setpc (®s, addr - 2);
+ return;
}
-#endif
+ write_log("M68K RESET PC=%x, rebooting..\n", pc);
+ customreset ();
+ m68k_setpc (®s, ksboot);
}
MCI_GENERIC_PARMS gp = { 0 };
ciw->playend = -1;
- if (ciw->mciid) {
+ 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));
#endif
#define LOCK_UNLOCK_MADNESS //need for 7 times faster linedraw
#define PIXEL_LOCK //and scrollable screens
-#define MAXFLUSHPIXEL 3200 //pixel draw in a lock
+#define MAXFLUSHPIXEL 2000 //pixel draw in a lock
static void flushpixels(void);
#ifdef P96TRACING_ENABLED
#define P96TRACE(x) do { write_log x; } while(0)
unsigned foo;
struct thparms *thp;
- if (name)
- write_log("Thread '%s' started\n", name);
thp = malloc (sizeof (struct thparms));
thp->f = f;
thp->arg = arg;
hThread = (HANDLE)_beginthreadex(NULL, 0, thread_init, thp, 0, &foo);
*tid = hThread;
- if (hThread)
+ if (hThread) {
SetThreadPriority (hThread, THREAD_PRIORITY_ABOVE_NORMAL);
- else
+ if (name)
+ write_log("Thread '%s' started (%d)\n", name, foo);
+ } else {
result = 0;
+ write_log("Thread '%s' failed to start!?\n", name ? name : "<unknown>");
+ }
return result;
}
#define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
#define GETBDD(x) ((x) % 100)
-#define WINUAEBETA 7
+#define WINUAEBETA 8
#define WINUAEPUBLICBETA 1
-#define WINUAEDATE MAKEBD(2007, 2, 17)
+#define WINUAEDATE MAKEBD(2007, 2, 24)
#define IHF_WINDOWHIDDEN 6
#define NORMAL_WINDOW_STYLE (WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU)
+Beta 8: (RC 1)
+
+- uaehf.device unit >=30 crash fixed
+- CDTV CD audio will be stopped when exiting/reseting
+- correct CDTV CD number of tracks returned in ASPI-mode
+- re-added and fixed special case handling for 68k reset-instruction
+ when more compatible CPU setting is not enabled
+- filesystem ACTION_COPY_DIR_FH packet memory (lock) leak fixed
+
Beta 7: (possible bug fixes and small tweaks left)
- Picasso96 graphics problems really fixed