From 3e0277d4167f1b8caa30a68b5b15f5bacee159fa Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 6 Oct 2007 13:01:41 +0300 Subject: [PATCH] imported winuaesrc1450b2.zip --- ar.c | 4 + archivers/wrp/warp.c | 481 +++++++++++++ archivers/wrp/warp.h | 2 + cfgfile.c | 447 ++++++------ custom.c | 16 +- drawing.c | 34 +- expansion.c | 2 + filesys.c | 37 +- include/custom.h | 2 +- include/options.h | 5 + include/sana2.h | 14 + include/zfile.h | 2 + inputdevice.c | 20 +- main.c | 12 +- memory.c | 4 +- od-win32/posixemu.c | 2 +- od-win32/resources/resource | 11 +- od-win32/resources/resource.h | 10 +- od-win32/resources/winuae.rc | 93 ++- od-win32/sysconfig.h | 1 + od-win32/tun.c | 405 +++++++++++ od-win32/tun.h | 50 ++ od-win32/tun_uae.h | 13 + od-win32/win32.c | 81 ++- od-win32/win32.h | 4 +- od-win32/win32_filesys.c | 2 +- od-win32/win32gui.c | 100 ++- od-win32/winuae_msvc/winuae_msvc.8.vcproj | 16 + od-win32/winuae_msvc/winuae_msvc.vcproj | 18 +- od-win32/winuaechangelog.txt | 27 + od-win32/writelog.c | 2 + sana2.c | 783 ++++++++++++++++++++++ scsiemul.c | 101 ++- zfile.c | 39 +- 34 files changed, 2487 insertions(+), 353 deletions(-) create mode 100755 archivers/wrp/warp.c create mode 100755 archivers/wrp/warp.h create mode 100755 include/sana2.h create mode 100755 od-win32/tun.c create mode 100755 od-win32/tun.h create mode 100755 od-win32/tun_uae.h create mode 100755 sana2.c diff --git a/ar.c b/ar.c index 63b53df1..49d11159 100755 --- a/ar.c +++ b/ar.c @@ -1536,6 +1536,10 @@ static int superiv_init(struct romdata *rd, struct zfile *f) hrtmem2_end = 0xf60000; hrtmem2_size = 0x10000; hrtmem_rom = 1; + if (subtype == 70) { + hrtmem_start += 0x60000; + hrtmem_end += 0x60000; + } } else { /* super4 */ hrtmem_start = 0xd00000; hrtmem_size = 0x40000; diff --git a/archivers/wrp/warp.c b/archivers/wrp/warp.c new file mode 100755 index 00000000..2c593a2d --- /dev/null +++ b/archivers/wrp/warp.c @@ -0,0 +1,481 @@ + + +#include +#include +#include +#include + +#include "sysconfig.h" +#include "sysdeps.h" +#include "zfile.h" +#include "crc32.h" + +/* based on http://libxad.cvs.sourceforge.net/libxad/libxad/portable/clients/ by Dirk Stoecker */ + +#define XADERR_ILLEGALDATA 1 +#define XADERR_DECRUNCH 2 +#define XADERR_NOMEMORY 3 + +struct rledata { + uae_u32 rledata; +}; + +struct fout { + struct zfile *zf; + int xio_BitNum; + int xio_BitBuf; + int err; +}; + + +static void putrle (uae_u8 data, struct zfile *out, struct rledata *rled) +{ + int num; + uae_u32 a; + + if (!rled) { + zfile_putc (data, out); + return; + } + a = rled->rledata; + if (a & 0x100) /* was RLE mode */ + { + if (!data || (data == 1 && (a & 0x80000000))) { + a = 0x90; num = 1; + } else { + a &= 0xFF; num = data - 1; + } + } else if (data == 0x90) { + num = 0; a |= 0x100; + } else { + num = 1; a = data; + } + rled->rledata = a; + while (num--) + zfile_putc (a, out); +} + +static uae_u32 xadIOGetBitsLow(struct fout *io, uae_u8 bits) +{ + uae_u32 x; + + io->err = 0; + while(io->xio_BitNum < bits) + { + int v = zfile_getc (io->zf); + if (v == -1) { + io->err = 1; + return 0; + } + io->xio_BitBuf |= v << io->xio_BitNum; + io->xio_BitNum += 8; + } + x = io->xio_BitBuf & ((1<xio_BitBuf >>= bits; + io->xio_BitNum -= bits; + return x; +} + +#define ARCSQSPEOF 256 /* special endfile token */ +#define ARCSQNUMVALS 257 /* 256 data values plus SPEOF */ + +static uae_s32 ARCunsqueeze(struct zfile *in, struct zfile *out, struct rledata *rled) +{ + uae_s32 err = 0; + uae_s32 i, numnodes; + uae_s16 *node; + struct fout io; + + io.zf = in; + io.xio_BitBuf = 0; + io.xio_BitNum = 0; + io.err = 0; + + if((node = (uae_s16 *) xcalloc(2*2*ARCSQNUMVALS, 1))) + { + numnodes = xadIOGetBitsLow(&io, 16); + + if(numnodes < 0 || numnodes >= ARCSQNUMVALS) + err = XADERR_DECRUNCH; + else + { /* initialize for possible empty tree (SPEOF only) */ + node[0] = node[1] = -(ARCSQSPEOF + 1); + + numnodes *= 2; i = 0; + while(i < numnodes && !io.err) /* get decoding tree from file */ + { + node[i++] = xadIOGetBitsLow(&io, 16); + node[i++] = xadIOGetBitsLow(&io, 16); + } + + do + { + /* follow bit stream in tree to a leaf */ + i = 0; + while(i >= 0 && !io.err) + i = node[2*i + xadIOGetBitsLow(&io, 1)]; + + i = -(i + 1); /* decode fake node index to original data value */ + + if(i != ARCSQSPEOF) + putrle (i, out, rled); + } while(i != ARCSQSPEOF); + } + xfree(node); + } + else + err = XADERR_NOMEMORY; + + return err; +} + + + + +#define UCOMPMAXCODE(n) (((uae_u32) 1 << (n)) - 1) +#define UCOMPBITS 16 +#define UCOMPSTACKSIZE 8000 +#define UCOMPFIRST 257 /* first free entry */ +#define UCOMPCLEAR 256 /* table clear output code */ +#define UCOMPINIT_BITS 9 /* initial number of bits/code */ +#define UCOMPBIT_MASK 0x1f +#define UCOMPBLOCK_MASK 0x80 + +struct UCompData { + uae_s16 clear_flg; + uae_u16 n_bits; /* number of bits/code */ + uae_u16 maxbits; /* user settable max # bits/code */ + uae_u32 maxcode; /* maximum code, given n_bits */ + uae_u32 maxmaxcode; + uae_s32 free_ent; + uae_s32 offset; + uae_s32 size; + uae_u16 *tab_prefixof; + uae_u8 *tab_suffixof; + uae_u8 stack[UCOMPSTACKSIZE]; + uae_u8 buf[UCOMPBITS]; + int insize; + struct rledata *rled; +}; + + +/* Read one code from input. If EOF, return -1. */ +static uae_s32 UCompgetcode(struct zfile *in, struct UCompData *cd) +{ + uae_s32 code, r_off, bits; + uae_u8 *bp = cd->buf; + + if(cd->clear_flg > 0 || cd->offset >= cd->size || cd->free_ent > cd->maxcode) + { + /* + * If the next entry will be too big for the current code + * size, then we must increase the size. This implies reading + * a new buffer full, too. + */ + if(cd->free_ent > cd->maxcode) + { + if(++cd->n_bits == cd->maxbits) + cd->maxcode = cd->maxmaxcode; /* won't get any bigger now */ + else + cd->maxcode = UCOMPMAXCODE(cd->n_bits); + } + if(cd->clear_flg > 0) + { + cd->maxcode = UCOMPMAXCODE(cd->n_bits = UCOMPINIT_BITS); + cd->clear_flg = 0; + } + + /* This reads maximum n_bits characters into buf */ + cd->size = 0; + while(cd->size < cd->n_bits) { + int v; + if (cd->insize == 0) + break; + v = zfile_getc (in); + if (v == -1) + break; + cd->insize--; + cd->buf[cd->size++] = v; + } + if(cd->size <= 0) + return -1; + + cd->offset = 0; + /* Round size down to integral number of codes */ + cd->size = (cd->size << 3) - (cd->n_bits - 1); + } + + r_off = cd->offset; + bits = cd->n_bits; + + /* Get to the first byte. */ + bp += (r_off >> 3); + r_off &= 7; + + /* Get first part (low order bits) */ + code = (*bp++ >> r_off); + bits -= (8 - r_off); + r_off = 8 - r_off; /* now, offset into code word */ + + /* Get any 8 bit parts in the middle (<=1 for up to 16 bits). */ + if(bits >= 8) + { + code |= *bp++ << r_off; + r_off += 8; + bits -= 8; + } + + /* high order bits. */ + code |= (*bp & ((1<offset += cd->n_bits; + + return code; +} + +static uae_u32 xadIO_Compress(struct zfile *in, struct zfile *out, int insize, struct rledata *rled, uae_u8 bitinfo) +{ + int err = 0; + struct UCompData *cd; + + if((bitinfo & UCOMPBIT_MASK) < UCOMPINIT_BITS) + return XADERR_ILLEGALDATA; + + if((cd = xcalloc(sizeof(struct UCompData), 1))) + { + int finchar, code, oldcode, incode, blockcomp; + uae_u8 *stackp, *stack, *stackend; + + stackp = stack = cd->stack; + stackend = stack + UCOMPSTACKSIZE; + cd->maxbits = bitinfo & UCOMPBIT_MASK; + blockcomp = bitinfo & UCOMPBLOCK_MASK; + cd->maxmaxcode = 1 << cd->maxbits; + cd->maxcode = UCOMPMAXCODE(cd->n_bits = UCOMPINIT_BITS); + cd->free_ent = blockcomp ? UCOMPFIRST : 256; + cd->insize = insize; + cd->rled = rled; + + if((cd->tab_prefixof = xcalloc(sizeof(uae_u16) * cd->maxmaxcode, 1))) + { + if((cd->tab_suffixof = xcalloc(cd->maxmaxcode, 1))) + { + /* Initialize the first 256 entries in the table. */ + for(code = 255; code >= 0; code--) + cd->tab_suffixof[code] = code; + + if((finchar = oldcode = UCompgetcode(in, cd)) == -1) + err = XADERR_DECRUNCH; + else + { + putrle (finchar, out, cd->rled); /* first code must be 8 bits = uae_u8 */ + + while((code = UCompgetcode(in, cd)) > -1) + { + if((code == UCOMPCLEAR) && blockcomp) + { + for(code = 255; code >= 0; code--) + cd->tab_prefixof[code] = 0; + cd->clear_flg = 1; + cd->free_ent = UCOMPFIRST - 1; + if((code = UCompgetcode(in, cd)) == -1) + break; /* O, untimely death! */ + } + incode = code; + + /* Special case for KwKwK string. */ + if(code >= cd->free_ent) + { + if(code > cd->free_ent) + { + err = XADERR_ILLEGALDATA; + break; + } + *stackp++ = finchar; + code = oldcode; + } + + /* Generate output characters in reverse order */ + while(stackp < stackend && code >= 256) + { + *stackp++ = cd->tab_suffixof[code]; + code = cd->tab_prefixof[code]; + } + if(stackp >= stackend) + { + err = XADERR_ILLEGALDATA; + break; + } + *(stackp++) = finchar = cd->tab_suffixof[code]; + + /* And put them out in forward order */ + do + { + putrle (*(--stackp), out, cd->rled); + } while(stackp > stack); + + /* Generate the new entry. */ + if((code = cd->free_ent) < cd->maxmaxcode) + { + cd->tab_prefixof[code] = (uae_u16) oldcode; + cd->tab_suffixof[code] = finchar; + cd->free_ent = code+1; + } + /* Remember previous code. */ + oldcode = incode; + } + } + xfree (cd->tab_suffixof); + } + else + err = XADERR_NOMEMORY; + xfree(cd->tab_prefixof); + } + else + err = XADERR_NOMEMORY; + xfree(cd); + } + else + err = XADERR_NOMEMORY; + + return err; +} + +static void MakeCRC16(uae_u16 *buf, uae_u16 ID) +{ + uae_u16 i, j, k; + + for(i = 0; i < 256; ++i) + { + k = i; + + for(j = 0; j < 8; ++j) + { + if(k & 1) + k = (k >> 1) ^ ID; + else + k >>= 1; + } + buf[i] = k; + } +} + +static uae_u16 wrpcrc16 (uae_u16 *tab, uae_u8 *buf, int len) +{ + uae_u16 crc = 0; + while (len-- > 0) + crc = tab[(crc ^ *buf++) & 0xFF] ^ (crc >> 8); + return crc; +} + +static int iswrp (uae_u8 *data) +{ + if(data[0] == 'W' && data[1] == 'a' && data[2] == 'r' && data[3] == 'p' + && data[4] == ' ' && data[5] == 'v' && data[6] == '1' && data[7] == '.' + && data[8] == '1' && !data[9] && !data[18] && data[19] <= 3) + return 1; + return 0; +} + +#define COMPBUF 30000 + +struct zfile *unwarp(struct zfile *zf) +{ + int err = 0; + uae_u8 buf[26] = { 0 }; + int algo, side, track; + int pos, dstpos, olddstpos; + uae_u16 crc; + uae_u32 size; + struct zfile *nf = NULL, *tmpf = NULL; + uae_u8 *zero, *data; + int outsize = 11 * 512; + int outsize2 = 11 * (512 + 16); + struct rledata rled; + uae_u16 wrpcrc16table[256]; + + MakeCRC16 (wrpcrc16table, 0xa001); + + zero = xcalloc (outsize2, 1); + olddstpos = 0; + for (;;) { + if (zfile_fread (buf, sizeof buf, 1, zf) == 0) + break; + if (!iswrp (buf)) + break; + if (!nf) { + nf = zfile_fopen_empty ("zipped.wrp", 1760 * 512); + tmpf = zfile_fopen_empty ("tmp", outsize2); + } + track = (buf[10] << 8) | buf[11]; + algo = buf[19]; + side = -1; + if (!memcmp (buf + 12, "BOT\0", 4)) + side = 1; + if (!memcmp (buf + 12, "TOP\0", 4)) + side = 0; + crc = (buf[20] << 8) | buf[21]; + pos = zfile_ftell (zf); + dstpos = -1; + if (side >= 0 && track >= 0 && track <= 79) + dstpos = track * 22 * 512 + (side * 11 * 512); + zfile_fseek (tmpf, 0, SEEK_SET); + zfile_fwrite (zero, outsize2, 1, tmpf); + zfile_fseek (tmpf, 0, SEEK_SET); + size = (buf[22] << 24) | (buf[23] << 16) | (buf[24] << 8) | buf[25]; + err = 0; + memset (&rled, 0, sizeof rled); + + switch (algo) + { + case 1: + if (zfile_getc (zf) != 12) + err = XADERR_ILLEGALDATA; + else + err = xadIO_Compress (zf, tmpf, size - 1, &rled, 12 | UCOMPBLOCK_MASK); + break; + case 2: + err = ARCunsqueeze (zf, tmpf, &rled); + break; + case 0: + case 3: + { + int i; + for (i = 0; i < size; i++) { + uae_u8 v = zfile_getc (zf); + putrle (v, tmpf, algo == 3 ? &rled : NULL); + } + } + break; + default: + write_log ("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); + } 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); + xfree (data); + } + if (dstpos >= 0) { + zfile_fseek (nf, dstpos, SEEK_SET); + data = zfile_getdata (tmpf, 0, outsize); + zfile_fwrite (data, outsize, 1, nf); + } + zfile_fseek (zf, pos + size, SEEK_SET); + } +end: + xfree (zero); + zfile_fclose (tmpf); + if (nf) { + zfile_fclose (zf); + zf = nf; + } + return zf; +} + diff --git a/archivers/wrp/warp.h b/archivers/wrp/warp.h new file mode 100755 index 00000000..e46f7e8f --- /dev/null +++ b/archivers/wrp/warp.h @@ -0,0 +1,2 @@ + +extern struct zfile *unwarp(struct zfile*); diff --git a/cfgfile.c b/cfgfile.c index fd63a89b..6dc021fe 100755 --- a/cfgfile.c +++ b/cfgfile.c @@ -31,6 +31,7 @@ static int config_newfilesystem; static struct strlist *temp_lines; +static struct zfile *default_file; /* @@@ need to get rid of this... just cut part of the manual and print that * as a help text. */ @@ -194,6 +195,19 @@ char *cfgfile_subst_path (const char *path, const char *subst, const char *file) return my_strdup (file); } +static int isdefault (const char *s) +{ + char tmp[MAX_DPATH]; + if (!default_file) + return 0; + zfile_fseek (default_file, 0, SEEK_SET); + while (zfile_fgets (tmp, sizeof tmp, default_file)) { + if (!strcmp (tmp, s)) + return 1; + } + return 0; +} + void cfgfile_write (struct zfile *f, char *format,...) { va_list parms; @@ -205,6 +219,18 @@ void cfgfile_write (struct zfile *f, char *format,...) va_end (parms); } +void cfgfile_dwrite (struct zfile *f, char *format,...) +{ + va_list parms; + char tmp[CONFIG_BLEN]; + + va_start (parms, format); + vsprintf (tmp, format, parms); + if (!isdefault (tmp)) + zfile_fwrite (tmp, 1, strlen (tmp), f); + va_end (parms); +} + void cfgfile_target_write (struct zfile *f, char *format,...) { va_list parms; @@ -218,6 +244,20 @@ void cfgfile_target_write (struct zfile *f, char *format,...) va_end (parms); } +void cfgfile_target_dwrite (struct zfile *f, char *format,...) +{ + va_list parms; + char 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)] = '.'; + if (!isdefault (tmp)) + zfile_fwrite (tmp, 1, strlen (tmp), f); + va_end (parms); +} + static void write_filesys_config (struct uae_prefs *p, const char *unexpanded, const char *default_path, struct zfile *f) { @@ -230,11 +270,16 @@ static void write_filesys_config (struct uae_prefs *p, const char *unexpanded, for (i = 0; i < p->mountitems; i++) { struct uaedev_config_info *uci = &p->mountconfig[i]; char *str; + int bp = uci->bootpri; + if (!uci->autoboot) + bp = -128; + if (uci->donotmount) + 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, uci->bootpri); + uci->devname ? uci->devname : "", uci->volname, str, bp); sprintf (tmp2, "filesystem2=%s", tmp); zfile_fputs (f, tmp2); #if 0 @@ -247,7 +292,7 @@ static void write_filesys_config (struct uae_prefs *p, const char *unexpanded, uci->readonly ? "ro" : "rw", uci->devname ? uci->devname : "", str, uci->sectors, uci->surfaces, uci->reserved, uci->blocksize, - uci->bootpri, uci->filesys ? uci->filesys : "", hdcontrollers[uci->controller]); + bp, uci->filesys ? uci->filesys : "", hdcontrollers[uci->controller]); sprintf (tmp2, "hardfile2=%s", tmp); zfile_fputs (f, tmp2); #if 0 @@ -279,7 +324,7 @@ static void write_compatibility_cpu(struct zfile *f, struct uae_prefs *p) sprintf(tmp, "%d", model); if (model == 68020 && (p->fpu_model == 68881 || p->fpu_model == 68882)) strcat(tmp,"/68881"); - cfgfile_write (f, "cpu_type=%s\n", tmp); + cfgfile_dwrite (f, "cpu_type=%s\n", tmp); } void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) @@ -306,94 +351,99 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) 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, "; host-specific\n"); + target_save_options (f, p); - 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, "; common\n"); + + cfgfile_dwrite (f, "use_gui=%s\n", guimode1[p->start_gui]); + cfgfile_dwrite (f, "use_debugger=%s\n", p->start_debugger ? "true" : "false"); str = cfgfile_subst_path (p->path_rom, UNEXPANDED, p->romfile); - cfgfile_write (f, "kickstart_rom_file=%s\n", str); + cfgfile_dwrite (f, "kickstart_rom_file=%s\n", str); free (str); if (p->romident[0]) - cfgfile_write (f, "kickstart_rom=%s\n", p->romident); + cfgfile_dwrite (f, "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_dwrite (f, "kickstart_ext_rom_file=%s\n", str); free (str); if (p->romextident[0]) - cfgfile_write (f, "kickstart_ext_rom=%s\n", p->romextident); + cfgfile_dwrite (f, "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_dwrite (f, "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_dwrite (f, "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, "kickshifter=%s\n", p->kickshifter ? "true" : "false"); + cfgfile_dwrite (f, "cart=%s\n", p->cartident); + //cfgfile_dwrite (f, "cart_internal=%s\n", cartsmode[p->cart_internal]); + cfgfile_dwrite (f, "kickshifter=%s\n", p->kickshifter ? "true" : "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_dwrite (f, "floppy%d=%s\n", i, str); free (str); - cfgfile_write (f, "floppy%dtype=%d\n", i, p->dfxtype[i]); - cfgfile_write (f, "floppy%dsound=%d\n", i, p->dfxclick[i]); + cfgfile_dwrite (f, "floppy%dtype=%d\n", i, p->dfxtype[i]); + cfgfile_dwrite (f, "floppy%dsound=%d\n", i, p->dfxclick[i]); if (p->dfxclick[i] < 0 && p->dfxclickexternal[i][0]) - cfgfile_write (f, "floppy%dsoundext=%s\n", i, p->dfxclickexternal[i]); + cfgfile_dwrite (f, "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_write (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, "sound_output=%s\n", soundmode1[p->produce_sound]); - cfgfile_write (f, "sound_bits=%d\n", p->sound_bits); - 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, "compforcesettings=%s\n", p->compforcesettings ? "true" : "false"); - 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, "diskimage%d=%s\n", i, p->dfxlist[i]); + } + + cfgfile_dwrite (f, "nr_floppies=%d\n", p->nr_floppies); + cfgfile_dwrite (f, "floppy_speed=%d\n", p->floppy_speed); + cfgfile_dwrite (f, "floppy_volume=%d\n", p->dfxclickvolume); + cfgfile_dwrite (f, "parallel_on_demand=%s\n", p->parallel_demand ? "true" : "false"); + cfgfile_dwrite (f, "serial_on_demand=%s\n", p->serial_demand ? "true" : "false"); + cfgfile_dwrite (f, "serial_hardware_ctsrts=%s\n", p->serial_hwctsrts ? "true" : "false"); + cfgfile_dwrite (f, "serial_direct=%s\n", p->serial_direct ? "true" : "false"); + cfgfile_dwrite (f, "scsi=%s\n", scsimode[p->scsi]); + cfgfile_dwrite (f, "uaeserial=%s\n", p->uaeserial ? "true" : "false"); + cfgfile_dwrite (f, "sana2=%s\n", p->sana2[0] ? p->sana2 : "none"); + + cfgfile_dwrite (f, "sound_output=%s\n", soundmode1[p->produce_sound]); + cfgfile_dwrite (f, "sound_bits=%d\n", p->sound_bits); + cfgfile_dwrite (f, "sound_channels=%s\n", stereomode[p->sound_stereo]); + cfgfile_dwrite (f, "sound_stereo_separation=%d\n", p->sound_stereo_separation); + cfgfile_dwrite (f, "sound_stereo_mixing_delay=%d\n", p->sound_mixed_stereo_delay >= 0 ? p->sound_mixed_stereo_delay : 0); + cfgfile_dwrite (f, "sound_max_buff=%d\n", p->sound_maxbsiz); + cfgfile_dwrite (f, "sound_frequency=%d\n", p->sound_freq); + cfgfile_dwrite (f, "sound_latency=%d\n", p->sound_latency); + cfgfile_dwrite (f, "sound_interpol=%s\n", interpolmode[p->sound_interpol]); + cfgfile_dwrite (f, "sound_filter=%s\n", soundfiltermode1[p->sound_filter]); + cfgfile_dwrite (f, "sound_filter_type=%s\n", soundfiltermode2[p->sound_filter_type]); + cfgfile_dwrite (f, "sound_volume=%d\n", p->sound_volume); + cfgfile_dwrite (f, "sound_auto=%s\n", p->sound_auto ? "yes" : "no"); + cfgfile_dwrite (f, "sound_stereo_swap_paula=%s\n", p->sound_stereo_swap_paula ? "yes" : "no"); + cfgfile_dwrite (f, "sound_stereo_swap_ahi=%s\n", p->sound_stereo_swap_ahi ? "yes" : "no"); + + cfgfile_dwrite (f, "comp_trustbyte=%s\n", compmode[p->comptrustbyte]); + cfgfile_dwrite (f, "comp_trustword=%s\n", compmode[p->comptrustword]); + cfgfile_dwrite (f, "comp_trustlong=%s\n", compmode[p->comptrustlong]); + cfgfile_dwrite (f, "comp_trustnaddr=%s\n", compmode[p->comptrustnaddr]); + cfgfile_dwrite (f, "comp_nf=%s\n", p->compnf ? "true" : "false"); + cfgfile_dwrite (f, "comp_constjump=%s\n", p->comp_constjump ? "true" : "false"); + cfgfile_dwrite (f, "comp_oldsegv=%s\n", p->comp_oldsegv ? "true" : "false"); + + cfgfile_dwrite (f, "comp_flushmode=%s\n", flushmode[p->comp_hardflush]); + cfgfile_dwrite (f, "compforcesettings=%s\n", p->compforcesettings ? "true" : "false"); + cfgfile_dwrite (f, "compfpu=%s\n", p->compfpu ? "true" : "false"); + cfgfile_dwrite (f, "fpu_strict=%s\n", p->fpu_strict ? "true" : "false"); + cfgfile_dwrite (f, "comp_midopt=%s\n", p->comp_midopt ? "true" : "false"); + cfgfile_dwrite (f, "comp_lowopt=%s\n", p->comp_lowopt ? "true" : "false"); + cfgfile_dwrite (f, "avoid_cmov=%s\n", p->avoid_cmov ? "true" : "false" ); + cfgfile_dwrite (f, "avoid_dga=%s\n", p->avoid_dga ? "true" : "false" ); + cfgfile_dwrite (f, "avoid_vid=%s\n", p->avoid_vid ? "true" : "false" ); + cfgfile_dwrite (f, "cachesize=%d\n", p->cachesize); if (p->override_dga_address) - cfgfile_write (f, "override_dga_address=0x%08x\n", p->override_dga_address); + cfgfile_dwrite (f, "override_dga_address=0x%08x\n", p->override_dga_address); for (i = 0; i < 2; i++) { int v = i == 0 ? p->jport0 : p->jport1; @@ -410,41 +460,41 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) sprintf (tmp2, "mouse%d", v - JSEM_MICE); } sprintf (tmp1, "joyport%d=%s\n", i, tmp2); - 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_write (f, "gfx_display=%d\n", p->gfx_display); - 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_lores ? "true" : "false"); - cfgfile_write (f, "gfx_lores_mode=%s\n", loresmode[p->gfx_lores_mode]); - cfgfile_write (f, "gfx_linemode=%s\n", linemode1[p->gfx_linedbl]); - cfgfile_write (f, "gfx_correct_aspect=%s\n", p->gfx_correct_aspect ? "true" : "false"); - 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_dwrite (f, tmp1); + } + + cfgfile_dwrite (f, "bsdsocket_emu=%s\n", p->socket_emu ? "true" : "false"); + + cfgfile_dwrite (f, "synchronize_clock=%s\n", p->tod_hack ? "yes" : "no"); + cfgfile_dwrite (f, "maprom=0x%x\n", p->maprom); + cfgfile_dwrite (f, "parallel_postscript_emulation=%s\n", p->parallel_postscript_emulation ? "yes" : "no"); + cfgfile_dwrite (f, "parallel_postscript_detection=%s\n", p->parallel_postscript_detection ? "yes" : "no"); + cfgfile_dwrite (f, "ghostscript_parameters=%s\n", p->ghostscript_parameters); + cfgfile_dwrite (f, "parallel_autoflush=%d\n", p->parallel_autoflush_time); + + cfgfile_dwrite (f, "gfx_display=%d\n", p->gfx_display); + cfgfile_dwrite (f, "gfx_framerate=%d\n", p->gfx_framerate); + cfgfile_dwrite (f, "gfx_width=%d\n", p->gfx_size_win.width); /* compatibility with old versions */ + cfgfile_dwrite (f, "gfx_height=%d\n", p->gfx_size_win.height); /* compatibility with old versions */ + cfgfile_dwrite (f, "gfx_top_windowed=%d\n", p->gfx_size_win.x); + cfgfile_dwrite (f, "gfx_left_windowed=%d\n", p->gfx_size_win.y); + cfgfile_dwrite (f, "gfx_width_windowed=%d\n", p->gfx_size_win.width); + cfgfile_dwrite (f, "gfx_height_windowed=%d\n", p->gfx_size_win.height); + cfgfile_dwrite (f, "gfx_width_fullscreen=%d\n", p->gfx_size_fs.width); + cfgfile_dwrite (f, "gfx_height_fullscreen=%d\n", p->gfx_size_fs.height); + cfgfile_dwrite (f, "gfx_refreshrate=%d\n", p->gfx_refreshrate); + cfgfile_dwrite (f, "gfx_autoresolution=%d\n", p->gfx_autoresolution); + cfgfile_dwrite (f, "gfx_vsync=%s\n", p->gfx_avsync ? "true" : "false"); + cfgfile_dwrite (f, "gfx_vsync_picasso=%s\n", p->gfx_pvsync ? "true" : "false"); + cfgfile_dwrite (f, "gfx_lores=%s\n", p->gfx_lores ? "true" : "false"); + cfgfile_dwrite (f, "gfx_lores_mode=%s\n", loresmode[p->gfx_lores_mode]); + cfgfile_dwrite (f, "gfx_linemode=%s\n", linemode1[p->gfx_linedbl]); + cfgfile_dwrite (f, "gfx_correct_aspect=%s\n", p->gfx_correct_aspect ? "true" : "false"); + cfgfile_dwrite (f, "gfx_fullscreen_amiga=%s\n", fullmodes[p->gfx_afullscreen]); + cfgfile_dwrite (f, "gfx_fullscreen_picasso=%s\n", fullmodes[p->gfx_pfullscreen]); + cfgfile_dwrite (f, "gfx_center_horizontal=%s\n", centermode1[p->gfx_xcenter]); + cfgfile_dwrite (f, "gfx_center_vertical=%s\n", centermode1[p->gfx_ycenter]); + cfgfile_dwrite (f, "gfx_colour_mode=%s\n", colormode1[p->color_mode]); #ifdef GFXFILTER if (p->gfx_filter > 0) { @@ -453,120 +503,120 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) while (uaefilters[i].name) { uf = &uaefilters[i]; if (uf->type == p->gfx_filter) { - cfgfile_write (f, "gfx_filter=%s\n", uf->cfgname); + cfgfile_dwrite (f, "gfx_filter=%s\n", uf->cfgname); if (uf->type == p->gfx_filter) { if (uf->x[0]) { - cfgfile_write (f, "gfx_filter_mode=%s\n", filtermode1[p->gfx_filter_filtermode]); + cfgfile_dwrite (f, "gfx_filter_mode=%s\n", filtermode1[p->gfx_filter_filtermode]); } else { int mt[4], i = 0; if (uf->x[1]) mt[i++] = 1; if (uf->x[2]) mt[i++] = 2; if (uf->x[3]) mt[i++] = 3; if (uf->x[4]) mt[i++] = 4; - cfgfile_write (f, "gfx_filter_mode=%dx\n", mt[p->gfx_filter_filtermode]); + cfgfile_dwrite (f, "gfx_filter_mode=%dx\n", mt[p->gfx_filter_filtermode]); } } } i++; } } else { - cfgfile_write (f, "gfx_filter=no\n"); - } - - cfgfile_write (f, "gfx_filter_vert_zoom=%d\n", p->gfx_filter_vert_zoom); - cfgfile_write (f, "gfx_filter_horiz_zoom=%d\n", p->gfx_filter_horiz_zoom); - cfgfile_write (f, "gfx_filter_vert_zoom_mult=%d\n", p->gfx_filter_vert_zoom_mult); - cfgfile_write (f, "gfx_filter_horiz_zoom_mult=%d\n", p->gfx_filter_horiz_zoom_mult); - cfgfile_write (f, "gfx_filter_vert_offset=%d\n", p->gfx_filter_vert_offset); - cfgfile_write (f, "gfx_filter_horiz_offset=%d\n", p->gfx_filter_horiz_offset); - cfgfile_write (f, "gfx_filter_scanlines=%d\n", p->gfx_filter_scanlines); - cfgfile_write (f, "gfx_filter_scanlinelevel=%d\n", p->gfx_filter_scanlinelevel); - cfgfile_write (f, "gfx_filter_scanlineratio=%d\n", p->gfx_filter_scanlineratio); - cfgfile_write (f, "gfx_filter_luminance=%d\n", p->gfx_filter_luminance); - cfgfile_write (f, "gfx_filter_contrast=%d\n", p->gfx_filter_contrast); - cfgfile_write (f, "gfx_filter_saturation=%d\n", p->gfx_filter_saturation); - cfgfile_write (f, "gfx_filter_gamma=%d\n", p->gfx_filter_gamma); - cfgfile_write (f, "gfx_filter_blur=%d\n", p->gfx_filter_blur); - cfgfile_write (f, "gfx_filter_noise=%d\n", p->gfx_filter_noise); - - cfgfile_write (f, "gfx_luminance=%d\n", p->gfx_luminance); - cfgfile_write (f, "gfx_contrast=%d\n", p->gfx_contrast); - cfgfile_write (f, "gfx_gamma=%d\n", p->gfx_gamma); + 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_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); #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_write (f, "show_leds=%s\n", p->leds_on_screen ? "true" : "false"); - cfgfile_write (f, "keyboard_leds=numlock:%s,capslock:%s,scrolllock:%s\n", + cfgfile_dwrite (f, "immediate_blits=%s\n", p->immediate_blits ? "true" : "false"); + cfgfile_dwrite (f, "ntsc=%s\n", p->ntscmode ? "true" : "false"); + cfgfile_dwrite (f, "genlock=%s\n", p->genlock ? "true" : "false"); + cfgfile_dwrite (f, "show_leds=%s\n", p->leds_on_screen ? "true" : "false"); + cfgfile_dwrite (f, "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_write (f, "chipset=aga\n"); + cfgfile_dwrite (f, "chipset=aga\n"); else if ((p->chipset_mask & CSMASK_ECS_AGNUS) && (p->chipset_mask & CSMASK_ECS_DENISE)) - cfgfile_write (f, "chipset=ecs\n"); + cfgfile_dwrite (f, "chipset=ecs\n"); else if (p->chipset_mask & CSMASK_ECS_AGNUS) - cfgfile_write (f, "chipset=ecs_agnus\n"); + cfgfile_dwrite (f, "chipset=ecs_agnus\n"); else if (p->chipset_mask & CSMASK_ECS_DENISE) - cfgfile_write (f, "chipset=ecs_denise\n"); + cfgfile_dwrite (f, "chipset=ecs_denise\n"); else - cfgfile_write (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_write (f, "ciaatod=%s\n", ciaatodmode[p->cs_ciaatod]); - cfgfile_write (f, "rtc=%s\n", rtctype[p->cs_rtc]); - //cfgfile_write (f, "chipset_rtc_adjust=%d\n", p->cs_rtc_adjust); - cfgfile_write (f, "ksmirror=%s\n", ksmirrortype[p->cs_ksmirror]); - cfgfile_write (f, "cd32cd=%s\n", p->cs_cd32cd ? "true" : "false"); - cfgfile_write (f, "cd32c2p=%s\n", p->cs_cd32c2p ? "true" : "false"); - cfgfile_write (f, "cd32nvram=%s\n", p->cs_cd32nvram ? "true" : "false"); - cfgfile_write (f, "cdtvcd=%s\n", p->cs_cdtvcd ? "true" : "false"); - cfgfile_write (f, "cdtvram=%s\n", p->cs_cdtvram ? "true" : "false"); - cfgfile_write (f, "cdtvramcard=%d\n", p->cs_cdtvcard); - cfgfile_write (f, "ide=%s\n", p->cs_ide == 1 ? "a600/a1200" : (p->cs_ide == 2 ? "a4000" : "none")); - cfgfile_write (f, "a1000ram=%s\n", p->cs_a1000ram ? "true" : "false"); - cfgfile_write (f, "fatgary=%d\n", p->cs_fatgaryrev); - cfgfile_write (f, "ramsey=%d\n", p->cs_ramseyrev); - cfgfile_write (f, "scsi_cdtv=%s\n", p->cs_cdtvscsi ? "true" : "false"); - cfgfile_write (f, "scsi_a2091=%s\n", p->cs_a2091 ? "true" : "false"); - cfgfile_write (f, "scsi_a4091=%s\n", p->cs_a4091 ? "true" : "false"); - cfgfile_write (f, "scsi_a3000=%s\n", p->cs_mbdmac == 1 ? "true" : "false"); - cfgfile_write (f, "scsi_a4000t=%s\n", p->cs_mbdmac == 2 ? "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, "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 == 0x40000) ? 0 : p->chipmem_size / 0x80000); + cfgfile_dwrite (f, "chipset=ocs\n"); + cfgfile_dwrite (f, "chipset_refreshrate=%d\n", p->chipset_refreshrate); + cfgfile_dwrite (f, "collision_level=%s\n", collmode[p->collision_level]); + + cfgfile_dwrite (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=%s\n", ksmirrortype[p->cs_ksmirror]); + 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, "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, "fastmem_size=%d\n", p->fastmem_size / 0x100000); + cfgfile_dwrite (f, "a3000mem_size=%d\n", p->mbresmem_low_size / 0x100000); + cfgfile_dwrite (f, "mbresmem_size=%d\n", p->mbresmem_high_size / 0x100000); + cfgfile_dwrite (f, "z3mem_size=%d\n", p->z3fastmem_size / 0x100000); + cfgfile_dwrite (f, "z3mem_start=0x%x\n", p->z3fastmem_start); + cfgfile_dwrite (f, "bogomem_size=%d\n", p->bogomem_size / 0x40000); + cfgfile_dwrite (f, "gfxcard_size=%d\n", p->gfxmem_size / 0x100000); + cfgfile_dwrite (f, "chipmem_size=%d\n", (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_dwrite (f, "finegrain_cpu_speed=%d\n", p->m68k_speed); else - cfgfile_write (f, "cpu_speed=%s\n", p->m68k_speed == -1 ? "max" : "real"); + cfgfile_dwrite (f, "cpu_speed=%s\n", p->m68k_speed == -1 ? "max" : "real"); /* do not reorder start */ write_compatibility_cpu(f, p); - cfgfile_write (f, "cpu_model=%d\n", p->cpu_model); + cfgfile_dwrite (f, "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_dwrite (f, "fpu_model=%d\n", p->fpu_model); + cfgfile_dwrite (f, "cpu_compatible=%s\n", p->cpu_compatible ? "true" : "false"); + cfgfile_dwrite (f, "cpu_24bit_addressing=%s\n", p->address_space_24 ? "true" : "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_dwrite (f, "cpu_cycle_exact=%s\n", p->cpu_cycle_exact ? "true" : "false"); + cfgfile_dwrite (f, "blitter_cycle_exact=%s\n", p->blitter_cycle_exact ? "true" : "false"); + cfgfile_dwrite (f, "rtg_nocustom=%s\n", p->picasso96_nocustom ? "true" : "false"); - cfgfile_write (f, "log_illegal_mem=%s\n", p->illegal_mem ? "true" : "false"); + cfgfile_dwrite (f, "log_illegal_mem=%s\n", p->illegal_mem ? "true" : "false"); if (p->catweasel >= 100) - cfgfile_write (f, "catweasel=0x%x\n", p->catweasel); + cfgfile_dwrite (f, "catweasel=0x%x\n", p->catweasel); else - cfgfile_write (f, "catweasel=%d\n", p->catweasel); + cfgfile_dwrite (f, "catweasel=%d\n", p->catweasel); - cfgfile_write (f, "kbd_lang=%s\n", (p->keyboard_lang == KBD_LANG_DE ? "de" + cfgfile_dwrite (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" @@ -575,14 +625,14 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) : p->keyboard_lang == KBD_LANG_IT ? "it" : "FOO")); - cfgfile_write (f, "state_replay=%s\n", p->statecapture ? "yes" : "no"); - cfgfile_write (f, "state_replay_rate=%d\n", p->statecapturerate); - cfgfile_write (f, "state_replay_buffer=%d\n", p->statecapturebuffersize); + 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); #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_dwrite (f, "filesys_no_fsdb=%s\n", p->filesys_no_uaefsdb ? "true" : "false"); #endif write_inputdevice_config (p, f); @@ -1131,7 +1181,8 @@ 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, int secspertrack, int surfaces, int reserved, - int blocksize, int bootpri, char *filesysdir, int hdc, int flags) { + int blocksize, int bootpri, + char *filesysdir, int hdc, int flags) { struct uaedev_config_info *uci; int i; char *s; @@ -1154,6 +1205,12 @@ struct uaedev_config_info *add_filesys_config (struct uae_prefs *p, int index, uci->reserved = reserved; uci->blocksize = blocksize; uci->bootpri = bootpri; + uci->donotmount = 0; + uci->autoboot = 0; + if (bootpri < -128) + uci->donotmount = 1; + else if (bootpri > -127) + uci->autoboot = 1; uci->controller = hdc; strcpy (uci->filesys, filesysdir ? filesysdir : ""); if (!uci->devname[0]) { @@ -1280,6 +1337,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu 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, "sana2", p->sana2, sizeof p->sana2) || 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) @@ -2672,6 +2730,8 @@ void default_prefs (struct uae_prefs *p, int type) { int i; int roms[] = { 6, 7, 8, 9, 10, 14, 5, 4, 3, 2, 1, -1 }; + uae_u8 zero = 0; + struct zfile *f; memset (p, 0, sizeof (*p)); strcpy (p->description, "UAE default configuration"); @@ -2868,6 +2928,15 @@ void default_prefs (struct uae_prefs *p, int type) #endif inputdevice_default_prefs (p); + + zfile_fclose (default_file); + default_file = NULL; + f = zfile_fopen_empty ("configstore", 50000); + if (f) { + cfgfile_save_options (f, p, 0); + zfile_fwrite (&zero, 1, 1, f); + default_file = f; + } } static void buildin_default_prefs_68020 (struct uae_prefs *p) @@ -3309,8 +3378,8 @@ static int bip_super (struct uae_prefs *p, int config, int compa, int romcheck) p->chipmem_size = 0x400000; p->z3fastmem_size = 8 * 1024 * 1024; p->gfxmem_size = 8 * 1024 * 1024; - p->cpu_model = 68060; - p->fpu_model = 68060; + p->cpu_model = 68040; + p->fpu_model = 68040; p->chipset_mask = CSMASK_AGA | CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE; p->cpu_compatible = p->address_space_24 = 0; p->m68k_speed = -1; @@ -3446,7 +3515,7 @@ int built_in_chipset_prefs (struct uae_prefs *p) case CP_CDTV: // CDTV p->cs_rtc = 1; p->cs_cdtvcd = p->cs_cdtvram = 1; - p->cs_df0idhw = 0; + p->cs_df0idhw = 1; p->cs_ksmirror = 0; break; case CP_CD32: // CD32 diff --git a/custom.c b/custom.c index 4c19e33e..33063936 100755 --- a/custom.c +++ b/custom.c @@ -155,7 +155,7 @@ static int REGPARAM3 custom_wput_1 (int, uaecptr, uae_u32, int) REGPARAM; static uae_u16 cregs[256]; -uae_u16 intena,intreq; +uae_u16 intena, intreq, intreqr; uae_u16 dmacon; uae_u16 adkcon; /* used by audio code */ @@ -165,7 +165,7 @@ int maxhpos = MAXHPOS_PAL; int maxvpos = MAXVPOS_PAL; int maxvpos_max = MAXVPOS_PAL; int minfirstline = VBLANK_ENDLINE_PAL; -int vblank_hz = VBLANK_HZ_PAL, fake_vblank_hz, vblank_skip; +int vblank_hz = VBLANK_HZ_PAL, fake_vblank_hz, vblank_skip, doublescan; frame_time_t syncbase; static int fmode; unsigned int beamcon0, new_beamcon0; @@ -2254,6 +2254,7 @@ void init_hz (void) changed_prefs.chipset_refreshrate = abs (currprefs.gfx_refreshrate); } + doublescan = 0; beamcon0 = new_beamcon0; isntsc = beamcon0 & 0x20 ? 0 : 1; if (hack_vpos > 0) { @@ -2296,7 +2297,9 @@ void init_hz (void) minfirstline = maxvpos - 1; sprite_vblank_endline = minfirstline - 2; maxvpos_max = maxvpos; + doublescan = htotal <= MAXHPOS / 2; dumpsync(); + reset_drawing (); } /* limit to sane values */ if (vblank_hz < 10) @@ -2423,7 +2426,7 @@ STATIC_INLINE uae_u16 INTENAR (void) } uae_u16 INTREQR (void) { - return intreq; + return intreqr; } STATIC_INLINE uae_u16 ADKCONR (void) { @@ -2683,6 +2686,7 @@ void INTREQ_0 (uae_u16 v) if (v & (0x80|0x100|0x200|0x400)) audio_update_irq (v); setclr (&intreq, v); + intreqr = intreq; doint (); } @@ -2704,6 +2708,8 @@ void INTREQ_f(uae_u32 data) static void INTREQ_d (uae_u16 v, int d) { + intreqr = intreq; + setclr (&intreqr, v); /* data in intreq is immediately available */ if (!use_eventmode() || v == 0) INTREQ_f(v); else @@ -4432,7 +4438,7 @@ static void hsync_handler (void) notice_interlace_seen (); nextline_how = nln_normal; - if (currprefs.gfx_linedbl) { + if (currprefs.gfx_linedbl && !doublescan) { lineno *= 2; nextline_how = currprefs.gfx_linedbl == 1 ? nln_doubled : nln_nblack; if (bplcon0 & 4) { @@ -5378,7 +5384,7 @@ uae_u8 *restore_custom (uae_u8 *src) dmacon = RW & ~(0x2000|0x4000); /* 096 DMACON */ CLXCON(RW); /* 098 CLXCON */ intena = RW; /* 09A INTENA */ - intreq = RW; /* 09C INTREQ */ + intreq = intreqr = RW; /* 09C INTREQ */ adkcon = RW; /* 09E ADKCON */ for (i = 0; i < 8; i++) bplpt[i] = RL; diff --git a/drawing.c b/drawing.c index 1aa17daa..dbd639cb 100755 --- a/drawing.c +++ b/drawing.c @@ -60,6 +60,8 @@ int direct_rgb; coordinates have a lower resolution (i.e. we're shrinking the image). */ static int res_shift; +static int linedbl, linedbld; + int interlace_seen = 0; #define AUTO_LORES_FRAMES 10 static int can_use_lores = 0, frame_res, frame_res_lace, last_max_ypos; @@ -1135,6 +1137,12 @@ static void init_aspect_maps (void) /* Do nothing if the gfx driver hasn't initialized the screen yet */ return; + linedbld = linedbl = currprefs.gfx_linedbl; + if (doublescan) { + linedbl = 0; + linedbld = 1; + } + if (native2amiga_line_map) free (native2amiga_line_map); if (amiga2aspect_line_map) @@ -1147,13 +1155,13 @@ static void init_aspect_maps (void) if (currprefs.gfx_correct_aspect) native_lines_per_amiga_line = ((double)gfxvidinfo.height * (currprefs.gfx_lores ? 320 : 640) - / (currprefs.gfx_linedbl ? 512 : 256) + / (linedbld ? 512 : 256) / gfxvidinfo.width); else native_lines_per_amiga_line = 1; - maxl = (MAXVPOS + 1) * (currprefs.gfx_linedbl ? 2 : 1); - min_ypos_for_screen = minfirstline << (currprefs.gfx_linedbl ? 1 : 0); + maxl = (MAXVPOS + 1) * (linedbld ? 2 : 1); + min_ypos_for_screen = minfirstline << (linedbl ? 1 : 0); max_drawn_amiga_line = -1; for (i = 0; i < maxl; i++) { int v = (int) ((i - min_ypos_for_screen) * native_lines_per_amiga_line); @@ -1163,12 +1171,12 @@ static void init_aspect_maps (void) v = -1; amiga2aspect_line_map[i] = v; } - if (currprefs.gfx_linedbl) + if (linedbl) max_drawn_amiga_line >>= 1; if (currprefs.gfx_ycenter && !(currprefs.gfx_correct_aspect)) { /* @@@ verify maxvpos vs. MAXVPOS */ - extra_y_adjust = (gfxvidinfo.height - (maxvpos_max << (currprefs.gfx_linedbl ? 1 : 0))) >> 1; + extra_y_adjust = (gfxvidinfo.height - (maxvpos_max << (linedbl ? 1 : 0))) >> 1; if (extra_y_adjust < 0) extra_y_adjust = 0; } @@ -1180,7 +1188,7 @@ static void init_aspect_maps (void) /* Must omit drawing some lines. */ for (i = maxl - 1; i > min_ypos_for_screen; i--) { if (amiga2aspect_line_map[i] == amiga2aspect_line_map[i-1]) { - if (currprefs.gfx_linedbl && (i & 1) == 0 && amiga2aspect_line_map[i+1] != -1) { + if (linedbl && (i & 1) == 0 && amiga2aspect_line_map[i+1] != -1) { /* If only the first line of a line pair would be omitted, * omit the second one instead to avoid problems with line * doubling. */ @@ -1197,7 +1205,7 @@ static void init_aspect_maps (void) if (amiga2aspect_line_map[i] == -1) continue; for (j = amiga2aspect_line_map[i]; j < gfxvidinfo.height && native2amiga_line_map[j] == -1; j++) - native2amiga_line_map[j] = i >> (currprefs.gfx_linedbl ? 1 : 0); + native2amiga_line_map[j] = i >> (linedbl ? 1 : 0); } } @@ -1267,6 +1275,8 @@ static void pfield_expand_dp_bplcon (void) bplplanecnt = dp_for_drawing->nr_planes; bplham = dp_for_drawing->ham_seen; + if (doublescan) + bplres >>= 1; if (bplres > 0) frame_res = 1; if (bplres > 0) @@ -1679,8 +1689,8 @@ static void center_image (void) if (thisframe_y_adjust < minfirstline) thisframe_y_adjust = minfirstline; } - thisframe_y_adjust_real = thisframe_y_adjust << (currprefs.gfx_linedbl ? 1 : 0); - tmp = (maxvpos_max - thisframe_y_adjust) << (currprefs.gfx_linedbl ? 1 : 0); + thisframe_y_adjust_real = thisframe_y_adjust << (linedbl ? 1 : 0); + tmp = (maxvpos_max - thisframe_y_adjust) << (linedbl ? 1 : 0); if (tmp != max_ypos_thisframe) { last_max_ypos = tmp; if (last_max_ypos < 0) @@ -1691,7 +1701,7 @@ static void center_image (void) /* @@@ interlace_seen used to be (bplcon0 & 4), but this is probably * better. */ if (prev_x_adjust != visible_left_border || prev_y_adjust != thisframe_y_adjust) - frame_redraw_necessary |= (interlace_seen && currprefs.gfx_linedbl) ? 2 : 1; + frame_redraw_necessary |= (interlace_seen && linedbl) ? 2 : 1; max_diwstop = 0; min_diwstart = 10000; @@ -1754,7 +1764,7 @@ static void init_drawing_frame (void) if (thisframe_first_drawn_line > thisframe_last_drawn_line) thisframe_last_drawn_line = thisframe_first_drawn_line; - maxline = currprefs.gfx_linedbl ? (maxvpos_max + 1) * 2 + 1 : (maxvpos_max + 1) + 1; + maxline = linedbl ? (maxvpos_max + 1) * 2 + 1 : (maxvpos_max + 1) + 1; maxline++; #ifdef SMART_UPDATE for (i = 0; i < maxline; i++) { @@ -2047,7 +2057,7 @@ static void lightpen_update (void) lightpen_cx = (((lightpen_x + visible_left_border) >> lores_shift) >> 1) + DISPLAY_LEFT_SHIFT - DIW_DDF_OFFSET; lightpen_cy = lightpen_y; - if (currprefs.gfx_linedbl) + if (linedbl) lightpen_cy >>= 1; lightpen_cy += minfirstline; diff --git a/expansion.c b/expansion.c index ce4a0164..42d31892 100755 --- a/expansion.c +++ b/expansion.c @@ -1071,6 +1071,8 @@ int need_uae_boot_rom(void) return 1; if (currprefs.scsi == 1) return 1; + if (currprefs.sana2) + return 1; if (currprefs.win32_outsidemouse) return 1; if (currprefs.gfxmem_size) diff --git a/filesys.c b/filesys.c index 26aa72ce..c0e17de3 100755 --- a/filesys.c +++ b/filesys.c @@ -46,6 +46,7 @@ #include "savestate.h" #include "a2091.h" #include "cdtv.h" +#include "sana2.h" #define TRACING_ENABLED 0 #if TRACING_ENABLED @@ -110,7 +111,7 @@ typedef struct { struct zvolume *zarchive; char *rootdirdiff; /* "diff" file/directory */ int readonly; /* disallow write access? */ - int bootpri; /* boot priority */ + int bootpri; /* boot priority. -128 = no autoboot, -129 = no mount */ int devno; int controller; int wasisempty; /* if true, this unit was created empty */ @@ -355,7 +356,8 @@ static int set_filesys_volume(const char *rootdir, int *flags, int *readonly, in static int set_filesys_unit_1 (int nr, char *devname, char *volname, const char *rootdir, int readonly, int secspertrack, int surfaces, int reserved, - int blocksize, int bootpri, char *filesysdir, int hdc, int flags) + int blocksize, int bootpri, int donotmount, int autoboot, + char *filesysdir, int hdc, int flags) { UnitInfo *ui; int i; @@ -447,7 +449,11 @@ static int set_filesys_unit_1 (int nr, if (filesysdir && filesysdir[0]) ui->filesysdir = my_strdup (filesysdir); ui->readonly = readonly; - if (bootpri < -128) bootpri = -128; + if (!autoboot) + bootpri = -128; + if (donotmount) + bootpri = -129; + if (bootpri < -129) bootpri = -129; if (bootpri > 127) bootpri = 127; ui->bootpri = bootpri; ui->open = 1; @@ -462,18 +468,21 @@ err: static int set_filesys_unit (int nr, char *devname, char *volname, const char *rootdir, int readonly, int secspertrack, int surfaces, int reserved, - int blocksize, int bootpri, char *filesysdir, int hdc, int flags) + int blocksize, int bootpri, int donotmount, int autoboot, + char *filesysdir, int hdc, int flags) { int ret; ret = set_filesys_unit_1 (nr, devname, volname, rootdir, readonly, - secspertrack, surfaces, reserved, blocksize, bootpri, filesysdir, hdc, flags); + secspertrack, surfaces, reserved, blocksize, bootpri, donotmount, autoboot, + filesysdir, hdc, flags); return ret; } static int add_filesys_unit (char *devname, char *volname, const char *rootdir, int readonly, int secspertrack, int surfaces, int reserved, - int blocksize, int bootpri, char *filesysdir, int hdc, int flags) + int blocksize, int bootpri, int donotmount, int autoboot, + char *filesysdir, int hdc, int flags) { int ret; @@ -481,7 +490,8 @@ static int add_filesys_unit (char *devname, char *volname, const char *rootdir, return -1; ret = set_filesys_unit_1 (-1, devname, volname, rootdir, readonly, - secspertrack, surfaces, reserved, blocksize, bootpri, filesysdir, hdc, flags); + secspertrack, surfaces, reserved, blocksize, + bootpri, donotmount, autoboot, filesysdir, hdc, flags); return ret; } @@ -532,7 +542,7 @@ static void initialize_mountinfo(void) if (uci->controller == HD_CONTROLLER_UAE) { idx = set_filesys_unit_1 (-1, uci->devname, uci->ishdf ? NULL : uci->volname, uci->rootdir, uci->readonly, uci->sectors, uci->surfaces, uci->reserved, - uci->blocksize, uci->bootpri, uci->filesys, 0, 0); + uci->blocksize, uci->bootpri, uci->donotmount, uci->autoboot, uci->filesys, 0, 0); if (idx >= 0) { UnitInfo *ui; uci->configoffset = idx; @@ -1062,7 +1072,7 @@ int filesys_media_change (const char *rootdir, int inserted, struct uaedev_confi strcpy (devname, uci->devname); else sprintf (devname, "RDH%d", nr_units()); - nr = add_filesys_unit (devname, volptr, rootdir, 0, 0, 0, 0, 0, 0, NULL, 0, 0); + nr = add_filesys_unit (devname, volptr, rootdir, 0, 0, 0, 0, 0, 0, 0, 1, NULL, 0, 0); if (nr < 0) return 0; if (inserted > 1) @@ -4764,6 +4774,9 @@ static uae_u32 REGPARAM2 filesys_diagentry (TrapContext *context) #ifdef SCSIEMU resaddr = scsidev_startup (resaddr); #endif +#ifdef SANA2 + resaddr = netdev_startup (resaddr); +#endif #ifdef UAESERIAL resaddr = uaeserialdev_startup (resaddr); #endif @@ -5305,6 +5318,10 @@ static uae_u32 REGPARAM2 filesys_dev_storeinfo (TrapContext *context) put_long (parmpacket + 80, 0x444f5300); /* DOS\0 */ if (type == FILESYS_HARDFILE) dofakefilesys (&uip[unit_no], parmpacket); + if (uip[unit_no].bootpri < -127) + m68k_dreg (®s, 7) = m68k_dreg (®s, 7) & ~1; /* do not boot */ + if (uip[unit_no].bootpri < -128) + return -1; /* do not mount */ return type; } @@ -5989,7 +6006,7 @@ uae_u8 *restore_filesys (uae_u8 *src) src = restore_filesys_hardfile(ui, src); if (set_filesys_unit (devno, devname, volname, rootdir, readonly, ui->hf.secspertrack, ui->hf.surfaces, ui->hf.reservedblocks, ui->hf.blocksize, - bootpri, filesysdir[0] ? filesysdir : NULL, 0, 0) < 0) { + bootpri, 0, 1, filesysdir[0] ? filesysdir : NULL, 0, 0) < 0) { write_log ("filesys '%s' failed to restore\n", rootdir); goto end; } diff --git a/include/custom.h b/include/custom.h index cf0ea358..ff03c98c 100755 --- a/include/custom.h +++ b/include/custom.h @@ -106,7 +106,7 @@ extern uae_u16 INTREQR (void); #define VBLANK_HZ_NTSC 60 extern int maxhpos, maxvpos, maxvpos_max, minfirstline, vblank_endline, numscrlines; -extern int vblank_hz, fake_vblank_hz, vblank_skip; +extern int vblank_hz, fake_vblank_hz, vblank_skip, doublescan; extern frame_time_t syncbase; #define NUMSCRLINES (maxvpos+1-minfirstline+1) diff --git a/include/options.h b/include/options.h index a788e1e0..20de59a0 100755 --- a/include/options.h +++ b/include/options.h @@ -58,6 +58,8 @@ struct uaedev_config_info { int ishdf; int readonly; int bootpri; + int autoboot; + int donotmount; char filesys[MAX_DPATH]; int surfaces; int sectors; @@ -180,6 +182,7 @@ struct uae_prefs { int keyboard_leds[3]; int keyboard_leds_in_use; int scsi; + char sana2[256]; int uaeserial; int catweasel; int cpu_idle; @@ -325,7 +328,9 @@ struct uae_prefs { extern char 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 struct uaedev_config_info *add_filesys_config (struct uae_prefs *p, int index, char *devname, char *volname, char *rootdir, int readonly, diff --git a/include/sana2.h b/include/sana2.h new file mode 100755 index 00000000..58787677 --- /dev/null +++ b/include/sana2.h @@ -0,0 +1,14 @@ + /* + * UAE - The Un*x Amiga Emulator + * + * SANAII compatible network driver emulation + * + * (c) 2007 Toni Wilen + */ + +uaecptr netdev_startup (uaecptr resaddr); +void netdev_install (void); +void netdev_reset (void); +void netdev_start_threads (void); + +extern int log_net; diff --git a/include/zfile.h b/include/zfile.h index 4588b4fc..50833701 100755 --- a/include/zfile.h +++ b/include/zfile.h @@ -23,7 +23,9 @@ 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 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 void zfile_exit (void); extern int execute_command (char *); extern int zfile_iscompressed (struct zfile *z); diff --git a/inputdevice.c b/inputdevice.c index 30b18250..cd3858b6 100755 --- a/inputdevice.c +++ b/inputdevice.c @@ -399,7 +399,7 @@ static struct input_queue_struct input_queue[INPUT_QUEUE_SIZE]; static void out_config (struct zfile *f, int id, int num, char *s1, char *s2) { - cfgfile_write (f, "input.%d.%s%d=%s\n", id, s1, num, s2); + cfgfile_dwrite (f, "input.%d.%s%d=%s\n", id, s1, num, s2); //write_log ("-input.%d.%s%d=%s\n", id, s1, num, s2); } @@ -444,7 +444,7 @@ static void write_config (struct zfile *f, int idnum, int devnum, char *name, st if (!isdevice (id)) return; - cfgfile_write (f, "input.%d.%s.%d.disabled=%d\n", idnum, name, devnum, id->enabled ? 0 : 1); + cfgfile_dwrite (f, "input.%d.%s.%d.disabled=%d\n", idnum, name, devnum, id->enabled ? 0 : 1); sprintf (tmp1, "%s.%d.axis.", name, devnum); for (i = 0; i < ID_AXIS_TOTAL; i++) write_config2 (f, idnum, i, ID_AXIS_OFFSET, tmp1, id); @@ -519,7 +519,7 @@ static void write_kbr_config (struct zfile *f, int idnum, int devnum, struct uae sprintf (tmp3, "%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"); + cfgfile_dwrite (f, "input.%d.%s=%s\n", idnum, tmp1, tmp2[0] ? tmp2 : "NULL"); i++; } } @@ -528,13 +528,13 @@ void write_inputdevice_config (struct uae_prefs *p, struct zfile *f) { 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.mouse_speed=%d\n", p->input_mouse_speed); - cfgfile_write (f, "input.autofire=%d\n", p->input_autofire_framecnt); + cfgfile_dwrite (f, "input.config=%d\n", p->input_selected_setting); + cfgfile_dwrite (f, "input.joymouse_speed_analog=%d\n", p->input_joymouse_multiplier); + cfgfile_dwrite (f, "input.joymouse_speed_digital=%d\n", p->input_joymouse_speed); + cfgfile_dwrite (f, "input.joymouse_deadzone=%d\n", p->input_joymouse_deadzone); + cfgfile_dwrite (f, "input.joystick_deadzone=%d\n", p->input_joystick_deadzone); + cfgfile_dwrite (f, "input.mouse_speed=%d\n", p->input_mouse_speed); + cfgfile_dwrite (f, "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]); diff --git a/main.c b/main.c index 8ebe5b23..1d752ac1 100755 --- a/main.c +++ b/main.c @@ -45,6 +45,7 @@ #include "a2091.h" #include "ncr_scsi.h" #include "scsi.h" +#include "sana2.h" #include "blkdev.h" #ifdef USE_SDL @@ -367,6 +368,9 @@ void fixup_prefs (struct uae_prefs *p) p->scsi = 0; p->win32_aspi = 0; #endif +#if !defined (SANA2) + p->sana2 = 0; +#endif #if !defined (UAESERIAL) p->uaeserial = 0; #endif @@ -534,7 +538,10 @@ void reset_all_systems (void) scsidev_reset (); scsidev_start_threads (); #endif - +#ifdef SANA2 + netdev_reset (); + netdev_start_threads (); +#endif #ifdef FILESYS filesys_prepare_reset (); filesys_reset (); @@ -711,6 +718,9 @@ static void real_main2 (int argc, char **argv) scsi_reset (); scsidev_install (); #endif +#ifdef SANA2 + netdev_install (); +#endif #ifdef UAESERIAL uaeserialdev_install (); #endif diff --git a/memory.c b/memory.c index 9cc2c5c6..c417e5d6 100755 --- a/memory.c +++ b/memory.c @@ -116,7 +116,7 @@ struct romdata *getromdatabypath(char *path) return NULL; } -#define NEXT_ROM_ID 70 +#define NEXT_ROM_ID 71 static struct romheader romheaders[] = { { "Freezer Cartridges", 1 }, @@ -225,6 +225,8 @@ static struct romdata roms[] = { 0x83b4b21c, 0xc56ced25,0x506a5aab,0x3fa13813,0x4fc9e5ae,0x0f9d3709 }, { "Freezer: Nordic Power v2.0", 2, 0, 2, 0, "NPOWER\0", 65536, 67, 0, 0, ROMTYPE_NORDIC, 0, 1, 0xa4db2906, 0x0aec68f7,0x25470c89,0x6b699ff4,0x6623dec5,0xc777466e }, + { "Freezer: Nordic Power v3.0", 3, 0, 3, 0, "NPOWER\0", 65536, 70, 0, 0, ROMTYPE_NORDIC, 0, 1, + 0x72850aef, 0x59c91d1f,0xa8f118f9,0x0bdba05a,0x9ae788d7,0x7a6cc7c9 }, { "Freezer: HRTMon v2.30 (built-in)", 0, 0, 0, 0, "HRTMON\0", 0, 63, 0, 0, ROMTYPE_HRTMON, 0, 1, 0xffffffff, 0, 0, 0, 0, 0, "HRTMon" }, diff --git a/od-win32/posixemu.c b/od-win32/posixemu.c index 7260dff7..d05b519e 100755 --- a/od-win32/posixemu.c +++ b/od-win32/posixemu.c @@ -268,7 +268,7 @@ int uae_start_thread_fast (void *(*f)(void *), void *arg, uae_thread_id *tid) return uae_start_thread(NULL, f, arg, tid); } -DWORD_PTR cpu_affinity = 1; +DWORD_PTR cpu_affinity = 1, cpu_paffinity = 1; void uae_set_thread_priority (int pri) { diff --git a/od-win32/resources/resource b/od-win32/resources/resource index 79b1775c..6a57d370 100755 --- a/od-win32/resources/resource +++ b/od-win32/resources/resource @@ -493,12 +493,13 @@ #define IDC_PATH_FILESYS 1376 #define IDC_HARDFILE_DIR_TEXT 1377 #define IDC_HARDFILE_DEVICE_TEXT 1378 -#define IDC_RW 1379 #define IDC_HFRDB 1380 -#define IDC_RW2 1380 #define IDC_RDB 1380 #define IDC_HARDFILE_FILESYS_TEXT 1380 +#define IDC_FS_AUTOBOOT 1380 #define IDC_FILESYS_SELECTOR 1381 +#define IDC_HDF_AUTOBOOT 1382 +#define IDC_HDF_DONOTMOUNT 1383 #define IDC_ROMFILE 1390 #define IDC_KEYFILE 1391 #define IDC_KICKCHOOSER 1392 @@ -669,6 +670,8 @@ #define IDC_MOUSETRICK 1613 #define IDC_AVIOUTPUT_AUDIO 1614 #define IDC_INPUTCOPYFROM 1614 +#define IDC_MOUSETRICK2 1614 +#define IDC_SANA2 1614 #define IDC_AVIOUTPUT_VIDEO_CODEC 1615 #define IDC_INPUTDEVICEDISABLE 1615 #define IDC_AVIOUTPUT_ACTIVATED 1615 @@ -912,7 +915,9 @@ #define IDC_FS_SELECT_FILE 1775 #define IDC_DF2ENABLE 1776 #define IDC_FS_SELECT_EJECT 1776 +#define IDC_FS_RW 1777 #define IDC_DF3ENABLE 1778 +#define IDC_HDF_RW 1778 #define ID__FLOPPYDRIVES 40004 #define ID_FLOPPYDRIVES_DF0 40005 #define ID_ST_CONFIGURATION 40010 @@ -942,7 +947,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 334 #define _APS_NEXT_COMMAND_VALUE 40029 -#define _APS_NEXT_CONTROL_VALUE 1775 +#define _APS_NEXT_CONTROL_VALUE 1779 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index 79b1775c..247d6943 100755 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -493,12 +493,13 @@ #define IDC_PATH_FILESYS 1376 #define IDC_HARDFILE_DIR_TEXT 1377 #define IDC_HARDFILE_DEVICE_TEXT 1378 -#define IDC_RW 1379 #define IDC_HFRDB 1380 -#define IDC_RW2 1380 #define IDC_RDB 1380 #define IDC_HARDFILE_FILESYS_TEXT 1380 +#define IDC_FS_AUTOBOOT 1380 #define IDC_FILESYS_SELECTOR 1381 +#define IDC_HDF_AUTOBOOT 1382 +#define IDC_HDF_DONOTMOUNT 1383 #define IDC_ROMFILE 1390 #define IDC_KEYFILE 1391 #define IDC_KICKCHOOSER 1392 @@ -669,6 +670,7 @@ #define IDC_MOUSETRICK 1613 #define IDC_AVIOUTPUT_AUDIO 1614 #define IDC_INPUTCOPYFROM 1614 +#define IDC_SANA2 1614 #define IDC_AVIOUTPUT_VIDEO_CODEC 1615 #define IDC_INPUTDEVICEDISABLE 1615 #define IDC_AVIOUTPUT_ACTIVATED 1615 @@ -912,7 +914,9 @@ #define IDC_FS_SELECT_FILE 1775 #define IDC_DF2ENABLE 1776 #define IDC_FS_SELECT_EJECT 1776 +#define IDC_FS_RW 1777 #define IDC_DF3ENABLE 1778 +#define IDC_HDF_RW 1778 #define ID__FLOPPYDRIVES 40004 #define ID_FLOPPYDRIVES_DF0 40005 #define ID_ST_CONFIGURATION 40010 @@ -942,7 +946,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 334 #define _APS_NEXT_COMMAND_VALUE 40029 -#define _APS_NEXT_CONTROL_VALUE 1775 +#define _APS_NEXT_CONTROL_VALUE 1779 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index a913b309..d40d236d 100755 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -394,12 +394,12 @@ BEGIN CONTROL "Untrap mouse with middle button",IDC_JULIAN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,15,129,10 CONTROL "Show GUI on startup",IDC_SHOWGUI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,27,120,10 CONTROL "On-screen LEDs",IDC_SHOWLEDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,40,115,10 - CONTROL "uaescsi.device",IDC_SCSIDEVICE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,53,117,10 + CONTROL "uaescsi.device",IDC_SCSIDEVICE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,53,63,10 CONTROL "Don't show taskbar button",IDC_NOTASKBARBUTTON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,66,117,10 CONTROL "bsdsocket.library emulation",IDC_SOCKETS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,15,120,10 CONTROL "Use CTRL-F11 to quit",IDC_CTRLF11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,27,120,10 CONTROL "Don't use RGB overlays",IDC_NOOVERLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,40,120,10 - CONTROL "Synchronize clock",IDC_CLOCKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,66,115,10 + CONTROL "Synchronize clock",IDC_CLOCKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,53,115,10 GROUPBOX "Keyboard LEDs",IDC_STATIC,7,140,85,94 COMBOBOX IDC_KBLED1,22,154,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_KBLED2,22,173,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP @@ -416,21 +416,22 @@ BEGIN RTEXT "Recording buffer (MB):",IDC_STATIC,157,219,83,10,SS_CENTERIMAGE | WS_TABSTOP COMBOBOX IDC_STATE_BUFFERSIZE,248,217,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP CONTROL "Always on top",IDC_ALWAYSONTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,79,117,10 - CONTROL "Catweasel",IDC_CATWEASEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,79,115,10 + CONTROL "Catweasel",IDC_CATWEASEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,66,115,10 CONTROL "USB mode",IDC_KBLED_USB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,216,64,10 - COMBOBOX IDC_SCSIMODE,161,51,104,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_SCSIMODE,92,51,64,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_LANGUAGE,103,121,179,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP GROUPBOX "Language",IDC_STATIC,7,112,285,25 CONTROL "Disable powersaving features",IDC_POWERSAVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,92,120,10 - CONTROL "Magic Mouse",IDC_MOUSETRICK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,92,119,10 + CONTROL "Magic Mouse",IDC_MOUSETRICK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,79,119,10 + CONTROL "uaenet.device",IDC_SANA2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,92,94,10 END -IDD_HARDFILE DIALOGEX 0, 0, 299, 212 +IDD_HARDFILE DIALOGEX 0, 0, 299, 224 STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Hardfile Settings" FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN - GROUPBOX "Settings",IDC_STATIC,10,5,280,113 + GROUPBOX "Settings",IDC_STATIC,10,5,280,127 RTEXT "Path:",IDC_HARDFILE_DIR_TEXT,26,18,22,10 EDITTEXT IDC_PATH_NAME,52,15,213,15,ES_AUTOHSCROLL PUSHBUTTON "...",IDC_SELECTOR,271,15,11,15 @@ -438,30 +439,33 @@ BEGIN EDITTEXT IDC_PATH_FILESYS,52,34,213,15,ES_AUTOHSCROLL PUSHBUTTON "...",IDC_FILESYS_SELECTOR,271,34,11,15 RTEXT "Device:",IDC_HARDFILE_DEVICE_TEXT,17,58,31,10 - EDITTEXT IDC_HARDFILE_DEVICE,52,54,40,15,ES_AUTOHSCROLL - RTEXT "Boot priority:",IDC_HARDFILE_BOOTPRI_TEXT,24,79,44,8 - EDITTEXT IDC_HARDFILE_BOOTPRI,74,75,40,15 - CONTROL "Read/write",IDC_RW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,57,50,10 - PUSHBUTTON "Enable RDB mode",IDC_HDF_RDB,192,55,92,14 - RTEXT "Surfaces:",IDC_SURFACES_TEXT,120,79,30,10 - EDITTEXT IDC_HEADS,155,75,35,15,ES_NUMBER - RTEXT "Reserved:",IDC_RESERVED_TEXT,197,79,35,10 - EDITTEXT IDC_RESERVED,237,75,35,15,ES_NUMBER - RTEXT "Sectors:",IDC_SECTORS_TEXT,120,101,30,10 - EDITTEXT IDC_SECTORS,155,96,35,15,ES_NUMBER - RTEXT "Block size:",IDC_BLOCKSIZE_TEXT,197,101,35,10 - EDITTEXT IDC_BLOCKSIZE,237,96,35,15,ES_NUMBER - GROUPBOX "New hard disk image file",IDC_STATIC,10,120,280,62 - PUSHBUTTON "Create",IDC_HF_CREATE,50,135,80,14 - EDITTEXT IDC_HF_SIZE,146,135,61,15,ES_NUMBER - PUSHBUTTON "OK",IDOK,102,191,50,14 - PUSHBUTTON "Cancel",IDCANCEL,158,191,50,14 - EDITTEXT IDC_HF_DOSTYPE,146,158,61,15 - COMBOBOX IDC_HDF_CONTROLLER,73,97,41,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - RTEXT "DOS type",IDC_STATIC,214,160,32,10,SS_CENTERIMAGE - RTEXT "MB",IDC_STATIC,214,138,13,10,SS_CENTERIMAGE + EDITTEXT IDC_HARDFILE_DEVICE,52,54,66,15,ES_AUTOHSCROLL + RTEXT "Boot priority:",IDC_HARDFILE_BOOTPRI_TEXT,24,94,44,8 + EDITTEXT IDC_HARDFILE_BOOTPRI,74,90,40,15 + CONTROL "Read/write",IDC_HDF_RW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,53,74,64,10 + PUSHBUTTON "Enable RDB mode",IDC_HDF_RDB,174,55,92,14 + RTEXT "Surfaces:",IDC_SURFACES_TEXT,120,94,30,10 + EDITTEXT IDC_HEADS,155,90,35,15,ES_NUMBER + RTEXT "Reserved:",IDC_RESERVED_TEXT,197,94,35,10 + EDITTEXT IDC_RESERVED,237,90,35,15,ES_NUMBER + RTEXT "Sectors:",IDC_SECTORS_TEXT,120,116,30,10 + EDITTEXT IDC_SECTORS,155,111,35,15,ES_NUMBER + RTEXT "Block size:",IDC_BLOCKSIZE_TEXT,197,116,35,10 + EDITTEXT IDC_BLOCKSIZE,237,111,35,15,ES_NUMBER + GROUPBOX "New hard disk image file",IDC_STATIC,10,134,280,62 + PUSHBUTTON "Create",IDC_HF_CREATE,50,149,80,14 + EDITTEXT IDC_HF_SIZE,146,149,61,15,ES_NUMBER + PUSHBUTTON "OK",IDOK,102,205,50,14 + PUSHBUTTON "Cancel",IDCANCEL,158,205,50,14 + EDITTEXT IDC_HF_DOSTYPE,146,172,61,15 + COMBOBOX IDC_HF_TYPE,50,172,80,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_HDF_CONTROLLER,73,112,41,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + RTEXT "DOS type",IDC_STATIC,214,174,32,10,SS_CENTERIMAGE + RTEXT "MB",IDC_STATIC,214,152,13,10,SS_CENTERIMAGE RTEXT "Type:",IDC_STATIC,18,160,25,10,SS_CENTERIMAGE - RTEXT "HD Controller:",IDC_STATIC,13,98,52,10,SS_CENTERIMAGE + RTEXT "HD Controller:",IDC_STATIC,13,113,52,10,SS_CENTERIMAGE + CONTROL "Autoboot",IDC_HDF_AUTOBOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,136,73,53,10 + CONTROL "Do not mount",IDC_HDF_DONOTMOUNT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,217,74,67,10 END IDD_FILESYS DIALOGEX 15, 25, 299, 111 @@ -476,13 +480,14 @@ BEGIN LTEXT "Path:",-1,5,51,44,10 EDITTEXT IDC_PATH_NAME,65,46,227,15,ES_AUTOHSCROLL PUSHBUTTON "Select Directory",IDC_FS_SELECT_DIR,64,66,103,15 - CONTROL "Read/write",IDC_RW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,215,9,75,10 - RTEXT "Boot priority:",IDC_VOLUME_BOOTPRI_TEXT,178,29,59,8 - EDITTEXT IDC_VOLUME_BOOTPRI,261,27,30,15 + CONTROL "Read/write",IDC_FS_RW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,174,7,55,10 + RTEXT "Boot priority:",IDC_VOLUME_BOOTPRI_TEXT,178,28,49,8 + EDITTEXT IDC_VOLUME_BOOTPRI,237,24,30,15 PUSHBUTTON "OK",IDOK,65,91,48,15 PUSHBUTTON "Cancel",IDCANCEL,120,91,48,15 PUSHBUTTON "Select Archive or Plain File",IDC_FS_SELECT_FILE,189,66,103,15 PUSHBUTTON "Eject",IDC_FS_SELECT_EJECT,230,91,62,15 + CONTROL "Autoboot",IDC_FS_AUTOBOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,236,7,53,10 END IDD_SETINFO DIALOGEX 0, 0, 229, 85 @@ -680,7 +685,7 @@ FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN LTEXT "Hard drive:",IDC_STATIC,7,11,35,10 COMBOBOX IDC_HARDDRIVE,49,9,325,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - CONTROL "Read/write",IDC_RW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,51,55,10 + CONTROL "Read/write",IDC_HDF_RW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,51,55,10 DEFPUSHBUTTON "Add hard drive",IDOK,231,48,65,14 PUSHBUTTON "Cancel",IDCANCEL,319,48,54,14 DEFPUSHBUTTON "Create hard disk image file",IDC_HARDDRIVE_IMAGE,49,30,115,14 @@ -813,7 +818,7 @@ CAPTION "Processing..." FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN PUSHBUTTON "Cancel",IDCANCEL,88,40,50,14 - CONTROL "",IDC_PROGRESSBAR,"msctls_progress32",WS_BORDER | 0x1,7,19,215,14 + CONTROL "",IDC_PROGRESSBAR,"msctls_progress32",PBS_SMOOTH | WS_BORDER,7,19,215,14 CTEXT "x",IDC_PROGRESSBAR_TEXT,23,5,187,10,SS_CENTERIMAGE | WS_TABSTOP END @@ -979,6 +984,22 @@ IDR_DRIVE_SPINND_A500_1 WAVE "drive_spinnd.wav" IDB_XARCADE BITMAP "xarcade-winuae.bmp" IDB_LCD160X43 BITMAP "lcd.bmp" +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_HARDFILE, DIALOG + BEGIN + BOTTOMMARGIN, 212 + END +END +#endif // APSTUDIO_INVOKED + + ///////////////////////////////////////////////////////////////////////////// // // String Table @@ -1053,7 +1074,7 @@ BEGIN IDS_SELECTFILESYSROOT "Please select the root directory of the file system..." IDS_DEFAULTMIDIOUT "Default MIDI-Out Device" IDS_CONTRIBUTORS1 "Bernd Schmidt - The Grand-Master\nSam Jordan - Custom-chip, floppy-DMA, etc.\nMathias Ortmann - Original WinUAE Main Guy, BSD Socket support\nBrian King - Picasso96 Support, Integrated GUI for WinUAE, previous WinUAE Main Guy\nToni Wilen - Core updates, WinUAE Main Guy\nGustavo Goedert/Peter Remmers/Michael Sontheimer/Tomi Hakala/Tim Gunn/Nemo Pohle - DOS Port Stuff\nSamuel Devulder/Olaf Barthel/Sam Jordan - Amiga Ports\nKrister Bergman - XFree86 and OS/2 Port\nA. Blanchard/Ernesto Corvi - MacOS Port\nChristian Bauer - BeOS Port\nIan Stephenson - NextStep Port\nPeter Teichmann - Acorn/RiscOS Port\nStefan Reinauer - ZorroII/III AutoConfig, Serial Support\nChristian Schmitt/Chris Hames - Serial Support\nHerman ten Brugge - 68020/68881 Emulation Code\nTauno Taipaleenmaki - Various UAE-Control/UAE-Library Support\nBrett Eden/Tim Gunn/Paolo Besser/Nemo Pohle - Various Docs and Web-Sites\nGeorg Veichtlbauer - Help File coordinator, German GUI\nFulvio Leonardi - Italian translator for WinUAE\n" - IDS_CONTRIBUTORS2 "Bill Panagouleas - Hardware support\nSpecial thanks to Alexander Kneer and Tobias Abt (The Picasso96 Team)\nSteven Weiser - Postscript printing emulation idea and testing.\nPéter Tóth /Balázs Rátkai/Iván Herczeg/András Arató - Hungarian translation.\nKarsten Bock, Gavin Fance, Dirk Trowe and Christoph Meier - Freezer cartridge hardware support." + IDS_CONTRIBUTORS2 "Bill Panagouleas - Hardware support\nSpecial thanks to Alexander Kneer and Tobias Abt (The Picasso96 Team)\nSteven Weiser - Postscript printing emulation idea and testing.\nPéter Tóth /Balázs Rátkai/Iván Herczeg/András Arató - Hungarian translation.\nKarsten Bock, Gavin Fance, Dirk Trowe, Christoph Meier and Christian Schindler - Freezer cartridge hardware support." IDS_INVALIDPRTPORT "The printer you have in this configuration is not valid on this machine.\n" IDS_RESTOREUSS "Restore a WinUAE snapshot file" IDS_USS "WinUAE snapshot files" diff --git a/od-win32/sysconfig.h b/od-win32/sysconfig.h index 2e03c015..ac9969b6 100755 --- a/od-win32/sysconfig.h +++ b/od-win32/sysconfig.h @@ -54,6 +54,7 @@ #define SAVESTATE /* State file support */ #define A2091 /* A590/A2091 SCSI */ #define NCR /* A4000T/A4091 SCSI */ +#define SANA2 /* SANA2 network driver */ #else diff --git a/od-win32/tun.c b/od-win32/tun.c new file mode 100755 index 00000000..f39aba68 --- /dev/null +++ b/od-win32/tun.c @@ -0,0 +1,405 @@ + +/* based on OpenVPN TAP/TUN */ + +#include "sysconfig.h" +#include "sysdeps.h" + +#include + +#include +#include + +#include "tun.h" +#include "tun_uae.h" + +#include "win32.h" + +const struct tap_reg *get_tap_reg (void) +{ + HKEY adapter_key; + LONG status; + DWORD len; + struct tap_reg *first = NULL; + struct tap_reg *last = NULL; + int i = 0; + + status = RegOpenKeyEx( + HKEY_LOCAL_MACHINE, + ADAPTER_KEY, + 0, + KEY_READ, + &adapter_key); + + if (status != ERROR_SUCCESS) + return NULL; + + while (1) + { + char enum_name[256]; + char unit_string[256]; + HKEY unit_key; + char component_id_string[] = "ComponentId"; + char component_id[256]; + char net_cfg_instance_id_string[] = "NetCfgInstanceId"; + char net_cfg_instance_id[256]; + DWORD data_type; + + len = sizeof (enum_name); + status = RegEnumKeyEx( + adapter_key, + i, + enum_name, + &len, + NULL, + NULL, + NULL, + NULL); + if (status == ERROR_NO_MORE_ITEMS) + break; + else if (status != ERROR_SUCCESS) + break; + + _snprintf (unit_string, sizeof(unit_string), "%s\\%s", + ADAPTER_KEY, enum_name); + + status = RegOpenKeyEx( + HKEY_LOCAL_MACHINE, + unit_string, + 0, + KEY_READ, + &unit_key); + + if (status != ERROR_SUCCESS) + ;//write_log ("Error opening registry key: %s\n", unit_string); + else + { + len = sizeof (component_id); + status = RegQueryValueEx( + unit_key, + component_id_string, + NULL, + &data_type, + component_id, + &len); + + if (status != ERROR_SUCCESS || data_type != REG_SZ) + write_log ("Error opening registry key: %s\\%s\n", + unit_string, component_id_string); + else + { + len = sizeof (net_cfg_instance_id); + status = RegQueryValueEx( + unit_key, + net_cfg_instance_id_string, + NULL, + &data_type, + net_cfg_instance_id, + &len); + + if (status == ERROR_SUCCESS && data_type == REG_SZ) + { + if (!strcmp (component_id, TAP_COMPONENT_ID)) + { + struct tap_reg *reg; + reg = xcalloc (sizeof (struct tap_reg), 1); + reg->guid = my_strdup (net_cfg_instance_id); + + /* link into return list */ + if (!first) + first = reg; + if (last) + last->next = reg; + last = reg; + } + } + } + RegCloseKey (unit_key); + } + ++i; + } + + RegCloseKey (adapter_key); + return first; +} + +const struct panel_reg *get_panel_reg (void) +{ + LONG status; + HKEY network_connections_key; + DWORD len; + struct panel_reg *first = NULL; + struct panel_reg *last = NULL; + int i = 0; + + status = RegOpenKeyEx( + HKEY_LOCAL_MACHINE, + NETWORK_CONNECTIONS_KEY, + 0, + KEY_READ, + &network_connections_key); + + if (status != ERROR_SUCCESS) { + write_log ("Error opening registry key: %s\n", NETWORK_CONNECTIONS_KEY); + return NULL; + } + + while (1) + { + char enum_name[256]; + char connection_string[256]; + HKEY connection_key; + char name_data[256]; + DWORD name_type; + const char name_string[] = "Name"; + + len = sizeof (enum_name); + status = RegEnumKeyEx( + network_connections_key, + i, + enum_name, + &len, + NULL, + NULL, + NULL, + NULL); + if (status == ERROR_NO_MORE_ITEMS) + break; + else if (status != ERROR_SUCCESS) { + write_log ("Error enumerating registry subkeys of key: %s\n", + NETWORK_CONNECTIONS_KEY); + break; + } + + _snprintf (connection_string, sizeof(connection_string), + "%s\\%s\\Connection", + NETWORK_CONNECTIONS_KEY, enum_name); + + status = RegOpenKeyEx( + HKEY_LOCAL_MACHINE, + connection_string, + 0, + KEY_READ, + &connection_key); + + if (status != ERROR_SUCCESS) + ; + else + { + len = sizeof (name_data); + status = RegQueryValueEx( + connection_key, + name_string, + NULL, + &name_type, + name_data, + &len); + + if (status != ERROR_SUCCESS || name_type != REG_SZ) + write_log ("Error opening registry key: %s\\%s\\%s\n", + NETWORK_CONNECTIONS_KEY, connection_string, name_string); + else + { + struct panel_reg *reg = xcalloc (sizeof (struct panel_reg), 1); + reg->name = my_strdup (name_data); + reg->guid = my_strdup (enum_name); + + /* link into return list */ + if (!first) + first = reg; + if (last) + last->next = reg; + last = reg; + } + RegCloseKey (connection_key); + } + ++i; + } + + RegCloseKey (network_connections_key); + + return first; +} + +int check_tap_driver (const char *name) +{ + const struct tap_reg *tr; + const struct panel_reg *pr; + + const struct tap_reg *tap_reg = get_tap_reg (); + const struct panel_reg *panel_reg = get_panel_reg (); + /* loop through each TAP-Win32 adapter registry entry */ + for (tr = tap_reg; tr != NULL; tr = tr->next) + { + /* loop through each network connections entry in the control panel */ + for (pr = panel_reg; pr != NULL; pr = pr->next) + { + if (!strcmp (tr->guid, pr->guid)) { + write_log ("TAP-WIN32: '%s' %s\n", pr->name, tr->guid); + } + } + } + return 1; +} + + +static const char *guid_to_name (const char *guid, const struct panel_reg *panel_reg) +{ + const struct panel_reg *pr; + + for (pr = panel_reg; pr != NULL; pr = pr->next) + { + if (guid && !strcmp (pr->guid, guid)) + return pr->name; + } + + return NULL; +} + +/* + * Get an adapter GUID and optional actual_name from the + * registry for the TAP device # = device_number. + */ +static const char * +get_unspecified_device_guid (const int device_number, + char *actual_name, + int actual_name_size, + const struct tap_reg *tap_reg_src, + const struct panel_reg *panel_reg_src) +{ + const struct tap_reg *tap_reg = tap_reg_src; + char actual[256]; + static char ret[256]; + int i; + + /* Make sure we have at least one TAP adapter */ + if (!tap_reg) + return NULL; + + /* Move on to specified device number */ + for (i = 0; i < device_number; i++) + { + tap_reg = tap_reg->next; + if (!tap_reg) + return NULL; + } + + /* Save Network Panel name (if exists) in actual_name */ + if (actual_name) + { + const char *act = guid_to_name (tap_reg->guid, panel_reg_src); + if (act) + sprintf (actual, "%s", act); + else + sprintf (actual, "%s", tap_reg->guid); + } + + /* Save GUID for return value */ + sprintf (ret, "%s", tap_reg->guid); + return ret; +} + +void tap_close_driver (struct tapdata *tc) +{ + if (tc->h != INVALID_HANDLE_VALUE) { + DWORD status = FALSE; + DWORD len; + DeviceIoControl (tc->h, TAP_IOCTL_SET_MEDIA_STATUS, &status, sizeof (status), NULL, 0, &len, NULL); + CloseHandle (tc->h); + } + tc->h = INVALID_HANDLE_VALUE; + tc->active = 0; +} + +static void tap_get_mtu (struct tapdata *tc) +{ + ULONG mtu; + DWORD len; + + tc->mtu = 1500; + if (!DeviceIoControl (tc->h, TAP_IOCTL_GET_MTU, NULL, 0, &mtu, sizeof (mtu), &len, NULL)) + write_log ("TAP: TAP_IOCTL_GET_MTU failed %d\n", GetLastError ()); + else + tc->mtu = mtu; +} + +static void tap_get_mac (struct tapdata *tc) +{ + DWORD len; + + memset (tc->mac, 0, sizeof (tc->mac)); + if (!DeviceIoControl (tc->h, TAP_IOCTL_GET_MAC, NULL, 0, &tc->mac, sizeof (tc->mac), &len, NULL)) + write_log ("TAP: TAP_IOCTL_GET_MAC failed %d\n", GetLastError ()); +} + + +int tap_open_driver (struct tapdata *tc, const char *name) +{ + int device_number = 0; + HANDLE hand; + const struct tap_reg *tap_reg = get_tap_reg (); + const struct panel_reg *panel_reg = get_panel_reg (); + char actual_buffer[256]; + char device_path[256]; + const char *device_guid = NULL; + ULONG info[3] = { 0 }; + DWORD len, status; + + tc->h = INVALID_HANDLE_VALUE; + if (!tap_reg) { + write_log ("No TAP-Win32 adapters found\n"); + return 0; + } + /* Try opening all TAP devices until we find one available */ + while (1) + { + device_guid = get_unspecified_device_guid (device_number, + actual_buffer, + sizeof (actual_buffer), + tap_reg, + panel_reg); + + if (!device_guid) { + write_log ("All TAP-Win32 adapters on this system are currently in use.\n"); + return 0; + } + /* Open Windows TAP-Win32 adapter */ + _snprintf (device_path, sizeof(device_path), "%s%s%s", + USERMODEDEVICEDIR, + device_guid, + TAPSUFFIX); + + hand = CreateFile (device_path, + GENERIC_READ | GENERIC_WRITE, + 0, /* was: FILE_SHARE_READ */ + 0, + OPEN_EXISTING, + FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, + 0 + ); + if (hand != INVALID_HANDLE_VALUE) + break; + write_log ("TAP: couldn't open '%s', err=%d\n", device_path, GetLastError()); + device_number++; + } + if (hand == INVALID_HANDLE_VALUE) + return 0; + tc->h = hand; + + if (DeviceIoControl (tc->h, TAP_IOCTL_GET_VERSION, NULL, 0, &info, sizeof (info), &len, NULL)) + write_log ("TAP-Win32 Driver Version %d.%d %s\n", (int) info[0], (int) info[1], (info[2] ? "(DEBUG)" : "")); + if (!(info[0] == TAP_WIN32_MIN_MAJOR && info[1] >= TAP_WIN32_MIN_MINOR)) { + write_log ("ERROR: TAP-Win32 driver version %d.%d or newer required\n", TAP_WIN32_MIN_MAJOR, TAP_WIN32_MIN_MINOR); + tap_close_driver (tc); + return 0; + } + status = TRUE; + if (!DeviceIoControl (tc->h, TAP_IOCTL_SET_MEDIA_STATUS, &status, sizeof (status), NULL, 0, &len, NULL)) + write_log ("WARNING: The TAP-Win32 driver rejected a TAP_IOCTL_SET_MEDIA_STATUS DeviceIoControl call.\n"); + tap_get_mac (tc); + tap_get_mtu (tc); + tc->active = 1; + return 1; +} + + + diff --git a/od-win32/tun.h b/od-win32/tun.h new file mode 100755 index 00000000..36e118c8 --- /dev/null +++ b/od-win32/tun.h @@ -0,0 +1,50 @@ + +#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}" +#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}" +#define TAP_COMPONENT_ID "tap0901" +#define USERMODEDEVICEDIR "\\\\.\\Global\\" +#define TAPSUFFIX ".tap" +#define TAP_WIN32_MIN_MAJOR 9 +#define TAP_WIN32_MIN_MINOR 1 + +//============= +// TAP IOCTLs +//============= + +#define TAP_CONTROL_CODE(request,method) \ + CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS) + +// Present in 8.1 + +#define TAP_IOCTL_GET_MAC TAP_CONTROL_CODE (1, METHOD_BUFFERED) +#define TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE (2, METHOD_BUFFERED) +#define TAP_IOCTL_GET_MTU TAP_CONTROL_CODE (3, METHOD_BUFFERED) +#define TAP_IOCTL_GET_INFO TAP_CONTROL_CODE (4, METHOD_BUFFERED) +#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE (5, METHOD_BUFFERED) +#define TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE (6, METHOD_BUFFERED) +#define TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE (7, METHOD_BUFFERED) +#define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE (8, METHOD_BUFFERED) +#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE (9, METHOD_BUFFERED) + +// Added in 8.2 + +/* obsoletes TAP_IOCTL_CONFIG_POINT_TO_POINT */ +#define TAP_IOCTL_CONFIG_TUN TAP_CONTROL_CODE (10, METHOD_BUFFERED) + +struct tap_reg +{ + const char *guid; + struct tap_reg *next; +}; + +struct panel_reg +{ + const char *name; + const char *guid; + struct panel_reg *next; +}; + + +const struct tap_reg *get_tap_reg (void); +const struct panel_reg *get_panel_reg (void); + diff --git a/od-win32/tun_uae.h b/od-win32/tun_uae.h new file mode 100755 index 00000000..0d8fa580 --- /dev/null +++ b/od-win32/tun_uae.h @@ -0,0 +1,13 @@ + +struct tapdata +{ + HANDLE h; + int mtu; + uae_u8 mac[6]; + int active; +}; + +int tap_open_driver (struct tapdata *tc, const char *name); +void tap_close_driver (struct tapdata *tc); +int check_tap_driver (const char *name); + diff --git a/od-win32/win32.c b/od-win32/win32.c index 332fd920..6c4c37b3 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -127,7 +127,7 @@ char help_file[MAX_DPATH]; int af_path_2005, af_path_old; extern int harddrive_dangerous, do_rdbdump, aspi_allow_all, no_rawinput; -int log_scsi; +int log_scsi, log_net = 1; DWORD quickstart = 1; static int timeend (void) @@ -1838,6 +1838,7 @@ void target_default_options (struct uae_prefs *p, int type) p->win32_borderless = 0; p->win32_powersavedisabled = 1; p->win32_outsidemouse = 0; + p->sana2[0] = 0; } if (type == 1 || type == 0) { p->win32_uaescsimode = get_aspi(p->win32_uaescsimode); @@ -1850,40 +1851,40 @@ static const char *scsimode[] = { "none", "SPTI", "SPTI+SCSISCAN", "AdaptecASPI" void target_save_options (struct zfile *f, struct uae_prefs *p) { - cfgfile_target_write (f, "middle_mouse=%s\n", p->win32_middle_mouse ? "true" : "false"); - cfgfile_target_write (f, "magic_mouse=%s\n", p->win32_outsidemouse ? "true" : "false"); - cfgfile_target_write (f, "logfile=%s\n", p->win32_logfile ? "true" : "false"); - cfgfile_target_write (f, "map_drives=%s\n", p->win32_automount_drives ? "true" : "false"); - cfgfile_target_write (f, "map_drives_auto=%s\n", p->win32_automount_removable ? "true" : "false"); - cfgfile_target_write (f, "map_cd_drives=%s\n", p->win32_automount_cddrives ? "true" : "false"); - cfgfile_target_write (f, "map_net_drives=%s\n", p->win32_automount_netdrives ? "true" : "false"); + cfgfile_target_dwrite (f, "middle_mouse=%s\n", p->win32_middle_mouse ? "true" : "false"); + cfgfile_target_dwrite (f, "magic_mouse=%s\n", p->win32_outsidemouse ? "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"); serdevtoname(p->sername); - cfgfile_target_write (f, "serial_port=%s\n", p->sername[0] ? p->sername : "none" ); + cfgfile_target_dwrite (f, "serial_port=%s\n", p->sername[0] ? p->sername : "none" ); sernametodev(p->sername); - cfgfile_target_write (f, "parallel_port=%s\n", p->prtname[0] ? p->prtname : "none" ); - - cfgfile_target_write (f, "active_priority=%d\n", priorities[p->win32_active_priority].value); - cfgfile_target_write (f, "inactive_priority=%d\n", priorities[p->win32_inactive_priority].value); - cfgfile_target_write (f, "inactive_nosound=%s\n", p->win32_inactive_nosound ? "true" : "false"); - cfgfile_target_write (f, "inactive_pause=%s\n", p->win32_inactive_pause ? "true" : "false"); - cfgfile_target_write (f, "iconified_priority=%d\n", priorities[p->win32_iconified_priority].value); - cfgfile_target_write (f, "iconified_nosound=%s\n", p->win32_iconified_nosound ? "true" : "false"); - cfgfile_target_write (f, "iconified_pause=%s\n", p->win32_iconified_pause ? "true" : "false"); - - cfgfile_target_write (f, "ctrl_f11_is_quit=%s\n", p->win32_ctrl_F11_is_quit ? "true" : "false"); - cfgfile_target_write (f, "midiout_device=%d\n", p->win32_midioutdev ); - cfgfile_target_write (f, "midiin_device=%d\n", p->win32_midiindev ); - cfgfile_target_write (f, "no_overlay=%s\n", p->win32_no_overlay ? "true" : "false" ); - cfgfile_target_write (f, "borderless=%s\n", p->win32_borderless ? "true" : "false" ); - cfgfile_target_write (f, "uaescsimode=%s\n", scsimode[p->win32_uaescsimode]); - cfgfile_target_write (f, "soundcard=%d\n", p->win32_soundcard ); - cfgfile_target_write (f, "cpu_idle=%d\n", p->cpu_idle); - cfgfile_target_write (f, "notaskbarbutton=%s\n", p->win32_notaskbarbutton ? "true" : "false"); - cfgfile_target_write (f, "always_on_top=%s\n", p->win32_alwaysontop ? "true" : "false"); - cfgfile_target_write (f, "no_recyclebin=%s\n", p->win32_norecyclebin ? "true" : "false"); - cfgfile_target_write (f, "specialkey=0x%x\n", p->win32_specialkey); - cfgfile_target_write (f, "kbledmode=%d\n", p->win32_kbledmode); - cfgfile_target_write (f, "powersavedisabled=%s\n", p->win32_powersavedisabled ? "true" : "false"); + 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, "no_overlay=%s\n", p->win32_no_overlay ? "true" : "false" ); + 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, "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, "kbledmode=%d\n", p->win32_kbledmode); + cfgfile_target_dwrite (f, "powersavedisabled=%s\n", p->win32_powersavedisabled ? "true" : "false"); } @@ -2211,7 +2212,7 @@ static void initpath (char *name, char *path) set_path (name, NULL); } -extern int scan_roms (char*); +extern int scan_roms (int); void read_rom_list (void) { char tmp2[1000]; @@ -2230,7 +2231,7 @@ void read_rom_list (void) return; if (disp == REG_CREATED_NEW_KEY || forceroms) { load_keyring (NULL, NULL); - scan_roms (NULL); + scan_roms (forceroms ? 0 : 1); } forceroms = 0; idx = 0; @@ -2820,7 +2821,7 @@ extern void test (void); extern int screenshotmode, postscript_print_debugging, sound_debug, log_uaeserial; extern int force_direct_catweasel, max_allowed_mman, sound_mode_skip; -extern DWORD_PTR cpu_affinity; +extern DWORD_PTR cpu_affinity, cpu_paffinity; static DWORD_PTR original_affinity; static int getval(char *s) @@ -2951,6 +2952,14 @@ static int process_arg(char **xargv) SetThreadAffinityMask(GetCurrentThread(), cpu_affinity); continue; } + if (!strcmp (arg, "-paffinity")) { + cpu_paffinity = getval (np); + i++; + if (cpu_paffinity == 0) + cpu_paffinity = original_affinity; + SetProcessAffinityMask(GetCurrentProcess(), cpu_paffinity); + continue; + } if (!strcmp (arg, "-datapath")) { i++; strcpy(start_path_data, np); diff --git a/od-win32/win32.h b/od-win32/win32.h index 595e6d66..cce92893 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -15,9 +15,9 @@ #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100) #define GETBDD(x) ((x) % 100) -#define WINUAEBETA 1 +#define WINUAEBETA 2 #define WINUAEPUBLICBETA 1 -#define WINUAEDATE MAKEBD(2007, 9, 29) +#define WINUAEDATE MAKEBD(2007, 10, 6) #define WINUAEEXTRA "" #define WINUAEREV "" diff --git a/od-win32/win32_filesys.c b/od-win32/win32_filesys.c index 3e61affd..b31a8c3a 100755 --- a/od-win32/win32_filesys.c +++ b/od-win32/win32_filesys.c @@ -134,7 +134,7 @@ static void filesys_addexternals(void) strcat(volumepath, "."); else strcat(volumepath, ".."); - add_filesys_unit (devname[0] ? devname : NULL, volumename, volumepath, !rw, 0, 0, 0, 0, -20, 0, 0, 0); + add_filesys_unit (devname[0] ? devname : NULL, volumename, volumepath, !rw, 0, 0, 0, 0, -20, 0, 1, 0, 0, 0); } /* if drivemask */ dwDriveMask >>= 1; } diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index 069e5014..e026dda4 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -80,7 +80,7 @@ #define ARCHIVE_STRING "*.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;" ARCHIVE_STRING "\0" +#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" @@ -670,7 +670,7 @@ static int scan_roms_3(HKEY fkey, char **paths, int offset, char *path) extern int get_rom_path(char *out, int mode); -int scan_roms (void) +int scan_roms (int show) { char path[MAX_DPATH]; static int recursive; @@ -730,7 +730,8 @@ int scan_roms (void) end: read_rom_list (); - show_rom_list (); + if (show) + show_rom_list (); if (fkey) RegCloseKey (fkey); @@ -1127,7 +1128,7 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs p++; WIN32GUI_LoadUIString(IDS_STATEFILE_UNCOMPRESSED, tmp, sizeof(tmp)); strcat(p, tmp); - strcat(p, " (*.uss"); + strcat(p, " (*.uss)"); p += strlen(p) + 1; strcpy(p, "*.uss"); p += strlen(p) + 1; @@ -2907,7 +2908,7 @@ static INT_PTR CALLBACK PathsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM if (DirectorySelection (hDlg, 0, tmp)) { load_keyring(&workprefs, NULL); set_path ("KickstartPath", tmp); - if (!scan_roms ()) + if (!scan_roms (1)) gui_message_id (IDS_ROMSCANNOROMS); values_to_pathsdialog (hDlg); } @@ -3014,7 +3015,7 @@ static INT_PTR CALLBACK PathsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM } break; case IDC_ROM_RESCAN: - scan_roms (); + scan_roms (1); break; case IDC_RESETREGISTRY: resetregistry (); @@ -4755,7 +4756,7 @@ static void init_kickstart (HWND hDlg) ew (hDlg, IDC_FLASHCHOOSER), FALSE); #endif if (RegOpenKeyEx (hWinUAEKey , "DetectedROMs", 0, KEY_READ, &fkey) != ERROR_SUCCESS) - scan_roms (); + scan_roms (1); if (fkey) RegCloseKey (fkey); } @@ -4999,6 +5000,7 @@ static void values_to_miscdlg (HWND hDlg) CheckDlgButton (hDlg, IDC_NOOVERLAY, workprefs.win32_no_overlay); CheckDlgButton (hDlg, IDC_SHOWLEDS, workprefs.leds_on_screen); CheckDlgButton (hDlg, IDC_SCSIDEVICE, workprefs.scsi == 1); + CheckDlgButton (hDlg, IDC_SANA2, workprefs.sana2[0] ? 1 : 0); CheckDlgButton (hDlg, IDC_NOTASKBARBUTTON, workprefs.win32_notaskbarbutton); CheckDlgButton (hDlg, IDC_ALWAYSONTOP, workprefs.win32_alwaysontop); CheckDlgButton (hDlg, IDC_CLOCKSYNC, workprefs.tod_hack); @@ -5175,6 +5177,12 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) workprefs.scsi = IsDlgButtonChecked (hDlg, IDC_SCSIDEVICE) ? 1 : 0; enable_for_miscdlg (hDlg); break; + case IDC_SANA2: + if (IsDlgButtonChecked (hDlg, IDC_SANA2)) + strcpy (workprefs.sana2, "UAE"); + else + workprefs.sana2[0] = 0; + break; case IDC_CLOCKSYNC: workprefs.tod_hack = IsDlgButtonChecked (hDlg, IDC_CLOCKSYNC); break; @@ -5950,11 +5958,13 @@ struct fsvdlg_vals char device[4096]; char rootdir[4096]; int bootpri; + int autoboot; + int donotmount; int rw; int rdb; }; -static struct fsvdlg_vals empty_fsvdlg = { "", "", "", 0, 1, 0 }; +static struct fsvdlg_vals empty_fsvdlg = { "", "", "", 0, 1, 1, 0 }; static struct fsvdlg_vals current_fsvdlg; struct hfdlg_vals @@ -5971,10 +5981,12 @@ struct hfdlg_vals int rw; int rdb; int bootpri; + int donotmount; + int autoboot; int controller; }; -static struct hfdlg_vals empty_hfdlg = { "", "", "", "", 32, 2, 1, 0, 512, 1, 0, 0 }; +static struct hfdlg_vals empty_hfdlg = { "", "", "", "", 32, 2, 1, 0, 512, 1, 0, 0, 0, 1, 0 }; static struct hfdlg_vals current_hfdlg; static int archivehd; @@ -6001,8 +6013,9 @@ static INT_PTR CALLBACK VolumeSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, SetDlgItemInt (hDlg, IDC_VOLUME_BOOTPRI, current_fsvdlg.bootpri, TRUE); if (archivehd) current_fsvdlg.rw = 0; - CheckDlgButton (hDlg, IDC_RW, current_fsvdlg.rw); - ew (hDlg, IDC_RW, !archivehd); + CheckDlgButton (hDlg, IDC_FS_RW, current_fsvdlg.rw); + CheckDlgButton (hDlg, IDC_FS_AUTOBOOT, current_fsvdlg.autoboot); + ew (hDlg, IDC_FS_RW, !archivehd); recursive--; } return TRUE; @@ -6017,8 +6030,8 @@ static INT_PTR CALLBACK VolumeSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, case IDC_FS_SELECT_EJECT: SetDlgItemText (hDlg, IDC_PATH_NAME, ""); SetDlgItemText (hDlg, IDC_VOLUME_NAME, ""); - CheckDlgButton (hDlg, IDC_RW, FALSE); - ew (hDlg, IDC_RW, FALSE); + CheckDlgButton (hDlg, IDC_FS_RW, FALSE); + ew (hDlg, IDC_FS_RW, FALSE); archivehd = -1; break; case IDC_FS_SELECT_FILE: @@ -6028,8 +6041,8 @@ static INT_PTR CALLBACK VolumeSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, SetDlgItemText (hDlg, IDC_PATH_NAME, directory_path); SetDlgItemText (hDlg, IDC_VOLUME_NAME, s); xfree (s); - CheckDlgButton (hDlg, IDC_RW, FALSE); - ew (hDlg, IDC_RW, FALSE); + CheckDlgButton (hDlg, IDC_FS_RW, FALSE); + ew (hDlg, IDC_FS_RW, FALSE); archivehd = 1; } break; @@ -6046,7 +6059,7 @@ static INT_PTR CALLBACK VolumeSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, if ((browse = SHBrowseForFolder (&browse_info)) != NULL) { SHGetPathFromIDList (browse, directory_path); SetDlgItemText (hDlg, IDC_PATH_NAME, directory_path); - ew (hDlg, IDC_RW, TRUE); + ew (hDlg, IDC_FS_RW, TRUE); archivehd = 0; } break; @@ -6061,8 +6074,9 @@ static INT_PTR CALLBACK VolumeSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, 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); - current_fsvdlg.rw = IsDlgButtonChecked (hDlg, IDC_RW); + 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); recursive--; break; } @@ -6076,6 +6090,7 @@ STATIC_INLINE int is_hdf_rdb(void) static void sethardfile (HWND hDlg) { + int rdb = is_hdf_rdb(); SetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.filename); SetDlgItemText (hDlg, IDC_PATH_FILESYS, current_hfdlg.fsfilename); SetDlgItemText (hDlg, IDC_HARDFILE_DEVICE, current_hfdlg.devicename); @@ -6084,8 +6099,12 @@ static void sethardfile (HWND hDlg) SetDlgItemInt (hDlg, IDC_RESERVED, current_hfdlg.reserved, FALSE); SetDlgItemInt (hDlg, IDC_BLOCKSIZE, current_hfdlg.blocksize, FALSE); SetDlgItemInt (hDlg, IDC_HARDFILE_BOOTPRI, current_hfdlg.bootpri, TRUE); - CheckDlgButton (hDlg, IDC_RW, current_hfdlg.rw); - ew (hDlg, IDC_HDF_RDB, !is_hdf_rdb()); + CheckDlgButton (hDlg, IDC_HDF_RW, current_hfdlg.rw); + CheckDlgButton (hDlg, IDC_HDF_AUTOBOOT, current_hfdlg.autoboot); + CheckDlgButton (hDlg, IDC_HDF_DONOTMOUNT, current_hfdlg.donotmount); + ew (hDlg, IDC_HDF_RDB, !rdb); + ew (hDlg, IDC_HDF_AUTOBOOT, !rdb); + ew (hDlg, IDC_HDF_DONOTMOUNT, !rdb); SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_SETCURSEL, current_hfdlg.controller, 0); } @@ -6145,6 +6164,8 @@ static void hardfile_testrdb (HWND hDlg) current_hfdlg.reserved = 0; current_hfdlg.fsfilename[0] = 0; current_hfdlg.bootpri = 0; + current_hfdlg.autoboot = 1; + current_hfdlg.donotmount = 0; current_hfdlg.devicename[0] = 0; sethardfile (hDlg); } @@ -6221,8 +6242,14 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam case IDCANCEL: EndDialog (hDlg, 0); break; - case IDC_RW: - current_hfdlg.rw = IsDlgButtonChecked (hDlg, IDC_RW); + case IDC_HDF_RW: + current_hfdlg.rw = IsDlgButtonChecked (hDlg, IDC_HDF_RW); + break; + case IDC_HDF_AUTOBOOT: + current_hfdlg.autoboot = IsDlgButtonChecked (hDlg, IDC_HDF_AUTOBOOT); + break; + case IDC_HDF_DONOTMOUNT: + current_hfdlg.donotmount = IsDlgButtonChecked (hDlg, IDC_HDF_DONOTMOUNT); break; case IDC_HDF_RDB: SetDlgItemInt (hDlg, IDC_SECTORS, 0, FALSE); @@ -6231,6 +6258,8 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam SetDlgItemText (hDlg, IDC_PATH_FILESYS, ""); SetDlgItemText (hDlg, IDC_HARDFILE_DEVICE, ""); current_hfdlg.sectors = current_hfdlg.reserved = current_hfdlg.surfaces = 0; + current_hfdlg.autoboot = 1; + current_hfdlg.donotmount = 0; sethardfile (hDlg); break; } @@ -6267,12 +6296,12 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara hdf_init (); recursive++; inithdcontroller (hDlg); - CheckDlgButton (hDlg, IDC_RW, current_hfdlg.rw); + CheckDlgButton (hDlg, IDC_HDF_RW, current_hfdlg.rw); SendDlgItemMessage(hDlg, IDC_HARDDRIVE, CB_RESETCONTENT, 0, 0); SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_SETCURSEL, current_hfdlg.controller, 0); ew (hDlg, IDC_HARDDRIVE_IMAGE, FALSE); ew (hDlg, IDOK, FALSE); - ew (hDlg, IDC_RW, FALSE); + ew (hDlg, IDC_HDF_RW, FALSE); ew (hDlg, IDC_HDF_CONTROLLER, FALSE); index = -1; for (i = 0; i < hdf_getnumharddrives(); i++) { @@ -6297,7 +6326,7 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara if (posn >= 0) { ew (hDlg, IDC_HARDDRIVE_IMAGE, TRUE); ew (hDlg, IDOK, TRUE); - ew (hDlg, IDC_RW, TRUE); + ew (hDlg, IDC_HDF_RW, TRUE); ew (hDlg, IDC_HDF_CONTROLLER, TRUE); } } @@ -6317,7 +6346,7 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara } if (posn != CB_ERR) strcpy (current_hfdlg.filename, hdf_getnameharddrive ((int)posn, 0, ¤t_hfdlg.blocksize)); - current_hfdlg.rw = IsDlgButtonChecked (hDlg, IDC_RW); + current_hfdlg.rw = IsDlgButtonChecked (hDlg, IDC_HDF_RW); posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_GETCURSEL, 0, 0); if (posn != CB_ERR) current_hfdlg.controller = posn; @@ -6327,12 +6356,24 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara return FALSE; } +static int tweakbootpri (int bp, int ab, int dnm) +{ + if (dnm) + return -129; + if (!ab) + return -128; + if (bp < -127) + bp = -127; + return bp; +} + static void new_filesys (HWND hDlg, int entry) { struct uaedev_config_info *uci; + int bp = tweakbootpri (current_fsvdlg.bootpri, current_fsvdlg.autoboot, current_fsvdlg.donotmount); uci = add_filesys_config (&workprefs, entry, current_fsvdlg.device, current_fsvdlg.volume, - current_fsvdlg.rootdir, ! current_fsvdlg.rw, 0, 0, 0, 0, current_fsvdlg.bootpri, 0, 0, 0); + current_fsvdlg.rootdir, ! current_fsvdlg.rw, 0, 0, 0, 0, bp, 0, 0, 0); if (uci) filesys_media_change (uci->rootdir, 1, uci); } @@ -6340,12 +6381,13 @@ static void new_filesys (HWND hDlg, int entry) static void new_hardfile (HWND hDlg, int entry) { struct uaedev_config_info *uci; + int bp = tweakbootpri (current_hfdlg.bootpri, current_hfdlg.autoboot, current_hfdlg.donotmount); uci = add_filesys_config (&workprefs, entry, current_hfdlg.devicename, 0, current_hfdlg.filename, ! current_hfdlg.rw, current_hfdlg.sectors, current_hfdlg.surfaces, current_hfdlg.reserved, current_hfdlg.blocksize, - current_hfdlg.bootpri, current_hfdlg.fsfilename, + bp, current_hfdlg.fsfilename, current_hfdlg.controller, 0); if (uci) hardfile_do_disk_change (uci->configoffset, 1); @@ -6416,6 +6458,8 @@ static void harddisk_edit (HWND hDlg) } current_hfdlg.rw = !uci->readonly; current_hfdlg.bootpri = uci->bootpri; + current_hfdlg.autoboot = uci->autoboot; + current_hfdlg.donotmount = uci->donotmount; if (CustomDialogBox(IDD_HARDFILE, hDlg, HardfileSettingsProc)) { new_hardfile (hDlg, entry); @@ -6444,6 +6488,8 @@ static void harddisk_edit (HWND hDlg) } current_fsvdlg.rw = !uci->readonly; current_fsvdlg.bootpri = uci->bootpri; + current_fsvdlg.autoboot = uci->autoboot; + current_fsvdlg.donotmount = uci->donotmount; archivehd = -1; if (CustomDialogBox(IDD_FILESYS, hDlg, VolumeSettingsProc)) { new_filesys (hDlg, entry); diff --git a/od-win32/winuae_msvc/winuae_msvc.8.vcproj b/od-win32/winuae_msvc/winuae_msvc.8.vcproj index 3d5c99fc..13699221 100755 --- a/od-win32/winuae_msvc/winuae_msvc.8.vcproj +++ b/od-win32/winuae_msvc/winuae_msvc.8.vcproj @@ -1369,6 +1369,10 @@ RelativePath="..\sounddep\sound.c" > + + @@ -1771,6 +1775,10 @@ RelativePath="..\..\readcpu.c" > + + @@ -2460,6 +2468,14 @@ > + + + + + + @@ -1765,6 +1769,10 @@ RelativePath="..\..\readcpu.c" > + + @@ -2458,6 +2466,14 @@ Name="xfd" > + + + + =-127) and donotmount (bootpri=-129) + checkboxes to GUI +- Amiga-side dummy Sana2 driver (most commands return bogus errors) + Real communication between Sana2 driver and TAP driver (comes with + OpenVPN, 2.1rc4 or newer required) will be implemented later, + I hope.. current development name is "uaenet.device". +- do not show rom scan results if rom scan was automatic (missing + registry data or new winuae version was detected) +- high end quickstart cpu changed back to 68040 (68060 does not boot + very well without 68060.library..) + + Beta 1: - CDTV and CD32 interrupt handling improved, fixes "Snoopy In The diff --git a/od-win32/writelog.c b/od-win32/writelog.c index f779d276..42a39c58 100755 --- a/od-win32/writelog.c +++ b/od-win32/writelog.c @@ -275,6 +275,8 @@ void write_log (const char *format, ...) va_start(parms, format); count = _vsnprintf(buffer, WRITE_LOG_BUF_SIZE - 1, format, parms); ts = writets(); + if (buffer[0] == '*') + count++; if (SHOW_CONSOLE || console_logging) { if (lfdetected && ts) writeconsole(ts); diff --git a/sana2.c b/sana2.c new file mode 100755 index 00000000..4fdd201b --- /dev/null +++ b/sana2.c @@ -0,0 +1,783 @@ + /* + * UAE - The Un*x Amiga Emulator + * + * SanaII emulation + * + * Copyright 2007 Toni Wilen + * + */ + +#include "sysconfig.h" +#include "sysdeps.h" + +#include "threaddep/thread.h" +#include "options.h" +#include "memory.h" +#include "custom.h" +#include "events.h" +#include "newcpu.h" +#include "autoconf.h" +#include "traps.h" +#include "execlib.h" +#include "native2amiga.h" +#include "blkdev.h" +#include "uae.h" +#include "sana2.h" +#include "tun_uae.h" + +#define SANA2NAME "uaenet.device" + +#define MAX_ASYNC_REQUESTS 20 +#define MAX_OPEN_DEVICES 20 + +#define CMD_READ 2 +#define CMD_WRITE 3 +#define CMD_FLUSH 8 +#define CMD_NONSTD 9 +#define S2_START (CMD_NONSTD) +#define S2_DEVICEQUERY (S2_START+ 0) +#define S2_GETSTATIONADDRESS (S2_START+ 1) +#define S2_CONFIGINTERFACE (S2_START+ 2) +#define S2_ADDMULTICASTADDRESS (S2_START+ 5) +#define S2_DELMULTICASTADDRESS (S2_START+ 6) +#define S2_MULTICAST (S2_START+ 7) +#define S2_BROADCAST (S2_START+ 8) +#define S2_TRACKTYPE (S2_START+ 9) +#define S2_UNTRACKTYPE (S2_START+10) +#define S2_GETTYPESTATS (S2_START+11) +#define S2_GETSPECIALSTATS (S2_START+12) +#define S2_GETGLOBALSTATS (S2_START+13) +#define S2_ONEVENT (S2_START+14) +#define S2_READORPHAN (S2_START+15) +#define S2_ONLINE (S2_START+16) +#define S2_OFFLINE (S2_START+17) + + +#define S2WireType_Ethernet 1 +#define S2WireType_IEEE802 6 + +#define SANA2_MAX_ADDR_BITS (128) +#define SANA2_MAX_ADDR_BYTES ((SANA2_MAX_ADDR_BITS+7)/8) +#define ADDR_SIZE 6 + +#define S2ERR_NO_ERROR 0 /* peachy-keen */ +#define S2ERR_NO_RESOURCES 1 /* resource allocation failure */ +#define S2ERR_BAD_ARGUMENT 3 /* garbage somewhere */ +#define S2ERR_BAD_STATE 4 /* inappropriate state */ +#define S2ERR_BAD_ADDRESS 5 /* who? */ +#define S2ERR_MTU_EXCEEDED 6 /* too much to chew */ +#define S2ERR_NOT_SUPPORTED 8 /* hardware can't support cmd */ +#define S2ERR_SOFTWARE 9 /* software error detected */ +#define S2ERR_OUTOFSERVICE 10 /* driver is OFFLINE */ +#define S2ERR_TX_FAILURE 11 /* Transmission attempt failed */ + +#define S2WERR_GENERIC_ERROR 0 /* no specific info available */ +#define S2WERR_NOT_CONFIGURED 1 /* unit not configured */ +#define S2WERR_UNIT_ONLINE 2 /* unit is currently online */ +#define S2WERR_UNIT_OFFLINE 3 /* unit is currently offline */ +#define S2WERR_ALREADY_TRACKED 4 /* protocol already tracked */ +#define S2WERR_NOT_TRACKED 5 /* protocol not tracked */ +#define S2WERR_BUFF_ERROR 6 /* buff mgt func returned error */ +#define S2WERR_SRC_ADDRESS 7 /* source address problem */ +#define S2WERR_DST_ADDRESS 8 /* destination address problem */ +#define S2WERR_BAD_BROADCAST 9 /* broadcast address problem */ +#define S2WERR_BAD_MULTICAST 10 /* multicast address problem */ +#define S2WERR_MULTICAST_FULL 11 /* multicast address list full */ +#define S2WERR_BAD_EVENT 12 /* unsupported event class */ +#define S2WERR_BAD_STATDATA 13 /* statdata failed sanity check */ +#define S2WERR_IS_CONFIGURED 15 /* attempt to config twice */ +#define S2WERR_NULL_POINTER 16 /* null pointer detected */ +#define S2WERR_TOO_MANY_RETIRES 17 /* tx failed - too many retries */ +#define S2WERR_RCVREL_HDW_ERR 18 /* Driver fixable HW error */ + +#define S2EVENT_ERROR (1L<<0) /* error catch all */ +#define S2EVENT_TX (1L<<1) /* transmitter error catch all */ +#define S2EVENT_RX (1L<<2) /* receiver error catch all */ +#define S2EVENT_ONLINE (1L<<3) /* unit is in service */ +#define S2EVENT_OFFLINE (1L<<4) /* unit is not in service */ +#define S2EVENT_BUFF (1L<<5) /* buff mgt function error */ +#define S2EVENT_HARDWARE (1L<<6) /* hardware error catch all */ +#define S2EVENT_SOFTWARE (1L<<7) /* software error catch all */ + +#define DRIVE_NEWSTYLE 0x4E535459L /* 'NSTY' */ +#define NSCMD_DEVICEQUERY 0x4000 + +#define ASYNC_REQUEST_NONE 0 +#define ASYNC_REQUEST_TEMP 1 + +struct devstruct { + int unitnum, aunit; + int opencnt; + int changenum; + volatile uaecptr d_request[MAX_ASYNC_REQUESTS]; + volatile int d_request_type[MAX_ASYNC_REQUESTS]; + volatile uae_u32 d_request_data[MAX_ASYNC_REQUESTS]; + smp_comm_pipe requests; + uae_thread_id tid; + int thread_running; + uae_sem_t sync_sem; +}; + +struct priv_devstruct { + int inuse; + int unit; + int mode; + int flags; /* OpenDevice() */ + int configured; + int adapter; + uae_u8 mac[ADDR_SIZE]; + struct tapdata *td; + + int packetsreceived; + int packetssent; + int baddata; + int overruns; + int unknowntypesreceived; + int reconfigurations; +}; + +static struct tapdata td; +static struct devstruct devst[MAX_TOTAL_DEVICES]; +static struct priv_devstruct pdevst[MAX_OPEN_DEVICES]; +static uae_u32 nscmd_cmd; +static uae_sem_t change_sem; + +static struct device_info *devinfo (int mode, int unitnum, struct device_info *di) +{ + return sys_command_info (mode, unitnum, di); +} + +static struct devstruct *getdevstruct (int unit) +{ + return &devst[unit]; +} + +static struct priv_devstruct *getpdevstruct (uaecptr request) +{ + int i = get_long (request + 24); + if (i < 0 || i >= MAX_OPEN_DEVICES || pdevst[i].inuse == 0) { + write_log ("%s: corrupt iorequest %08.8X %d\n", SANA2NAME, request, i); + return 0; + } + return &pdevst[i]; +} + +static void *dev_thread (void *devs); +static int start_thread (struct devstruct *dev) +{ + if (dev->thread_running) + return 1; + init_comm_pipe (&dev->requests, 100, 1); + uae_sem_init (&dev->sync_sem, 0, 0); + uae_start_thread (SANA2NAME, dev_thread, dev, &dev->tid); + uae_sem_wait (&dev->sync_sem); + return dev->thread_running; +} + +static void dev_close_3 (struct devstruct *dev, struct priv_devstruct *pdev) +{ + if (!dev->opencnt) return; + dev->opencnt--; + if (!dev->opencnt) { + pdev->inuse = 0; + write_comm_pipe_u32 (&dev->requests, 0, 1); + } +} + +static uae_u32 REGPARAM2 dev_close_2 (TrapContext *context) +{ + uae_u32 request = m68k_areg (&context->regs, 1); + struct priv_devstruct *pdev = getpdevstruct (request); + struct devstruct *dev; + + if (!pdev) + return 0; + dev = getdevstruct (pdev->unit); + if (log_net) + write_log ("%s:%d close, req=%08.8X\n", SANA2NAME, pdev->unit, request); + if (!dev) + return 0; + dev_close_3 (dev, pdev); + put_long (request + 24, 0); + put_word (m68k_areg (&context->regs, 6) + 32, get_word (m68k_areg (&context->regs, 6) + 32) - 1); + return 0; +} + +static uae_u32 REGPARAM2 dev_close (TrapContext *context) +{ + return dev_close_2 (context); +} +static uae_u32 REGPARAM2 diskdev_close (TrapContext *context) +{ + return dev_close_2 (context); +} + +static int openfail (uaecptr ioreq, int error) +{ + put_long (ioreq + 20, -1); + put_byte (ioreq + 31, error); + return (uae_u32)-1; +} + +static uae_u32 REGPARAM2 dev_open_2 (TrapContext *context) +{ + uaecptr ioreq = m68k_areg (&context->regs, 1); + uae_u32 unit = m68k_dreg (&context->regs, 0); + uae_u32 flags = m68k_dreg (&context->regs, 1); + struct devstruct *dev = getdevstruct (unit); + struct priv_devstruct *pdev = 0; + int i; + + if (log_net) + write_log ("opening %s:%d ioreq=%08.8X\n", SANA2NAME, unit, ioreq); + if (!dev) + return openfail (ioreq, 32); /* badunitnum */ + if (!dev->opencnt) { + for (i = 0; i < MAX_OPEN_DEVICES; i++) { + pdev = &pdevst[i]; + if (pdev->inuse == 0) break; + } + pdev->unit = unit; + pdev->flags = flags; + pdev->inuse = 1; + pdev->td = &td; + pdev->adapter = td.active; + put_long (ioreq + 24, pdev - pdevst); + start_thread (dev); + } else { + for (i = 0; i < MAX_OPEN_DEVICES; i++) { + pdev = &pdevst[i]; + if (pdev->inuse && pdev->unit == unit) break; + } + if (i == MAX_OPEN_DEVICES) + return openfail (ioreq, -1); + put_long (ioreq + 24, pdev - pdevst); + } + dev->opencnt++; + + put_word (m68k_areg (&context->regs, 6) + 32, get_word (m68k_areg (&context->regs, 6) + 32) + 1); + put_byte (ioreq + 31, 0); + put_byte (ioreq + 8, 7); + return 0; +} + +static uae_u32 REGPARAM2 dev_open (TrapContext *context) +{ + return dev_open_2 (context); +} +static uae_u32 REGPARAM2 dev_expunge (TrapContext *context) +{ + return 0; +} +static uae_u32 REGPARAM2 diskdev_expunge (TrapContext *context) +{ + return 0; +} + +static int is_async_request (struct devstruct *dev, uaecptr request) +{ + int i = 0; + while (i < MAX_ASYNC_REQUESTS) { + if (dev->d_request[i] == request) return 1; + i++; + } + return 0; +} + +static int add_async_request (struct devstruct *dev, uaecptr request, int type, uae_u32 data) +{ + int i; + +// if (log_net) +// write_log ("%s: async request %08x (%d) added\n", SANA2NAME, request, type); + i = 0; + while (i < MAX_ASYNC_REQUESTS) { + if (dev->d_request[i] == request) { + dev->d_request_type[i] = type; + dev->d_request_data[i] = data; + return 0; + } + i++; + } + i = 0; + while (i < MAX_ASYNC_REQUESTS) { + if (dev->d_request[i] == 0) { + dev->d_request[i] = request; + dev->d_request_type[i] = type; + dev->d_request_data[i] = data; + return 0; + } + i++; + } + return -1; +} + +static int release_async_request (struct devstruct *dev, uaecptr request) +{ + int i = 0; + +// if (log_net) +// write_log ("async request %p removed\n", request); + while (i < MAX_ASYNC_REQUESTS) { + if (dev->d_request[i] == request) { + int type = dev->d_request_type[i]; + dev->d_request[i] = 0; + dev->d_request_data[i] = 0; + dev->d_request_type[i] = 0; + return type; + } + i++; + } + return -1; +} + +static void abort_async (struct devstruct *dev, uaecptr request, int errcode, int type) +{ + int i; + i = 0; + while (i < MAX_ASYNC_REQUESTS) { + if (dev->d_request[i] == request && dev->d_request_type[i] == ASYNC_REQUEST_TEMP) { + /* ASYNC_REQUEST_TEMP = request is processing */ + sleep_millis (10); + i = 0; + continue; + } + i++; + } + i = release_async_request (dev, request); + if (i >= 0 && log_net) + write_log ("%s: asyncronous request=%08.8X aborted, error=%d\n", SANA2NAME, request, errcode); +} + +static int dev_do_io (struct devstruct *dev, uaecptr request) +{ + uae_u32 command = get_word (request + 28); + uae_u32 packettype = get_long (request + 32 + 4); + uaecptr data = get_long (request + 32 + 4 + 4 + SANA2_MAX_ADDR_BYTES * 2 + 4); + uae_u32 datalength = get_long (request + 32 + 4 + 4 + SANA2_MAX_ADDR_BYTES * 2); + uaecptr srcaddr = request + 32 + 4 + 4; + uaecptr dstaddr = request + 32 + 4 + 4 + SANA2_MAX_ADDR_BYTES; + uaecptr statdata = get_long (request + 32 + 4 + 4 + SANA2_MAX_ADDR_BYTES * 2 + 4 + 4); + uaecptr buffermgmt = get_long (request + 32 + 4 + 4 + SANA2_MAX_ADDR_BYTES * 2 + 4 + 4 + 4); + uae_u32 io_error = 0; + uae_u32 wire_error = 0; + int i; + int async = 0; + struct priv_devstruct *pdev = getpdevstruct (request); + + if (!pdev) + return 0; + + write_log ("S2: C=%d T=%d S=%02X%02X%02X%02X%02X%02X D=%02X%02X%02X%02X%02X%02X DAT=%08x LEN=%d STAT=%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), + data, datalength, statdata); + + switch (command) + { + case NSCMD_DEVICEQUERY: + put_long (data + 4, 16); /* size */ + put_word (data + 8, 7); /* NSDEVTYPE_SANA2 */ + put_word (data + 10, 0); + put_long (data + 12, nscmd_cmd); + put_long (data + 32, 16); + break; + + case CMD_READ: + goto offline; + break; + case S2_READORPHAN: + goto offline; + break; + + case CMD_WRITE: + goto offline; + break; + case S2_BROADCAST: + goto offline; + break; + case S2_MULTICAST: + io_error = S2WERR_BAD_MULTICAST; + break; + + case CMD_FLUSH: + break; + + case S2_ADDMULTICASTADDRESS: + break; + case S2_DELMULTICASTADDRESS: + break; + + case S2_DEVICEQUERY: + { + int size = get_long (statdata); + if (size > 30) + size = 30; + put_long (statdata + 4, size); + if (size >= 18) + put_word (statdata + 16, ADDR_SIZE * 8); + if (size >= 22) + put_long (statdata + 18, pdev->td->mtu); + if (size >= 26) + put_long (statdata + 22, 10000000); + if (size >= 30) + put_long (statdata + 26, S2WireType_Ethernet); + } + break; + + case S2_GETTYPESTATS: + io_error = S2ERR_BAD_STATE; + wire_error = S2WERR_NOT_TRACKED; + break; + + case S2_GETGLOBALSTATS: + put_long (statdata + 0, pdev->packetsreceived); + put_long (statdata + 4, pdev->packetssent); + put_long (statdata + 8, pdev->baddata); + put_long (statdata + 12, pdev->overruns); + put_long (statdata + 16, pdev->unknowntypesreceived); + put_long (statdata + 20, pdev->reconfigurations); + break; + + case S2_GETSPECIALSTATS: + put_long (statdata + 1, 0); + break; + + case S2_GETSTATIONADDRESS: + for (i = 0; i < ADDR_SIZE; i++) { + put_byte (srcaddr + i, pdev->td->mac[i]); + put_byte (dstaddr + i, pdev->td->mac[i]); + } + break; + + case S2_CONFIGINTERFACE: + if (pdev->configured) { + io_error = S2ERR_BAD_STATE; + wire_error = S2WERR_IS_CONFIGURED; + } else { + for (i = 0; i < ADDR_SIZE; i++) + pdev->mac[i] = get_byte (srcaddr + i); + pdev->configured = TRUE; + } + break; + + case S2_ONLINE: + if (!pdev->configured) { + io_error = S2ERR_BAD_STATE; + wire_error = S2WERR_NOT_CONFIGURED; + } + if (!pdev->adapter) { + io_error = S2ERR_OUTOFSERVICE; + wire_error = S2WERR_RCVREL_HDW_ERR; + } + if (!io_error) { + pdev->packetsreceived = 0; + pdev->packetssent = 0; + pdev->baddata = 0; + pdev->overruns = 0; + pdev->unknowntypesreceived = 0; + pdev->reconfigurations = 0; + } + break; + + case S2_OFFLINE: + break; + + case S2_ONEVENT: + io_error = S2ERR_NOT_SUPPORTED; + wire_error = S2WERR_BAD_EVENT; + break; + + default: + io_error = -3; + break; + + offline: + io_error = S2ERR_OUTOFSERVICE; + wire_error = S2WERR_UNIT_OFFLINE; + break; + } + put_long (request + 32, wire_error); + put_byte (request + 31, io_error); + return async; +} + +static int dev_can_quick (uae_u32 command) +{ + switch (command) + { + case NSCMD_DEVICEQUERY: + return 1; + } + return 0; +} + +static int dev_canquick (struct devstruct *dev, uaecptr request) +{ + uae_u32 command = get_word (request + 28); + return dev_can_quick (command); +} + +static uae_u32 REGPARAM2 dev_beginio (TrapContext *context) +{ + uae_u32 request = m68k_areg (&context->regs, 1); + uae_u8 flags = get_byte (request + 30); + int command = get_word (request + 28); + struct priv_devstruct *pdev = getpdevstruct (request); + struct devstruct *dev; + + put_byte (request + 8, NT_MESSAGE); + if (!pdev) { + put_byte (request + 31, 32); + return get_byte (request + 31); + } + dev = getdevstruct (pdev->unit); + if (!dev) { + 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)) + write_log ("%s: command %d bug with IO_QUICK\n", SANA2NAME, command); + return get_byte (request + 31); + } else { + add_async_request (dev, request, ASYNC_REQUEST_TEMP, 0); + put_byte (request+30, get_byte (request + 30) & ~1); + write_comm_pipe_u32 (&dev->requests, request, 1); + return 0; + } +} + +static void *dev_thread (void *devs) +{ + struct devstruct *dev = (struct devstruct*)devs; + + uae_set_thread_priority (2); + dev->thread_running = 1; + uae_sem_post (&dev->sync_sem); + for (;;) { + uaecptr request = (uaecptr)read_comm_pipe_u32_blocking (&dev->requests); + uae_sem_wait (&change_sem); + if (!request) { + dev->thread_running = 0; + uae_sem_post (&dev->sync_sem); + uae_sem_post (&change_sem); + return 0; + } else if (dev_do_io (dev, request) == 0) { + put_byte (request + 30, get_byte (request + 30) & ~1); + release_async_request (dev, request); + uae_ReplyMsg (request); + } else { + if (log_net) + write_log ("%s:%d async request %08.8X\n", SANA2NAME, dev->unitnum, request); + } + uae_sem_post (&change_sem); + } + return 0; +} + +static uae_u32 REGPARAM2 dev_init_2 (TrapContext *context) +{ + uae_u32 base = m68k_dreg (&context->regs,0); + if (log_net) + write_log ("%s init\n", SANA2NAME); + return base; +} + +static uae_u32 REGPARAM2 dev_init (TrapContext *context) +{ + return dev_init_2 (context); +} + +static uae_u32 REGPARAM2 dev_abortio (TrapContext *context) +{ + uae_u32 request = m68k_areg (&context->regs, 1); + struct priv_devstruct *pdev = getpdevstruct (request); + struct devstruct *dev; + + if (!pdev) { + put_byte (request + 31, 32); + return get_byte (request + 31); + } + dev = getdevstruct (pdev->unit); + if (!dev) { + put_byte (request + 31, 32); + return get_byte (request + 31); + } + put_byte (request + 31, -2); + if (log_net) + write_log ("%s abortio: unit=%d, request=%08.8X\n", SANA2NAME, pdev->unit, request); + abort_async (dev, request, -2, 0); + return 0; +} + +static void dev_reset (void) +{ + int i, j; + struct devstruct *dev; + int unitnum = 0; + + for (i = 0; i < MAX_TOTAL_DEVICES; i++) { + dev = &devst[i]; + if (dev->opencnt > 0) { + for (j = 0; j < MAX_ASYNC_REQUESTS; j++) { + uaecptr request; + if (request = dev->d_request[i]) + abort_async (dev, request, 0, 0); + } + dev->opencnt = 1; + } + memset (dev, 0, sizeof (struct devstruct)); + dev->unitnum = dev->aunit = -1; + } + for (i = 0; i < MAX_OPEN_DEVICES; i++) + memset (&pdevst[i], 0, sizeof (struct priv_devstruct)); + +} + +static uaecptr ROM_netdev_resname = 0, + ROM_netdev_resid = 0, + ROM_netdev_init = 0; + +uaecptr netdev_startup (uaecptr resaddr) +{ + if (!currprefs.sana2[0]) + return resaddr; + if (log_net) + write_log ("netdev_startup(0x%x)\n", resaddr); + /* Build a struct Resident. This will set up and initialize + * the uaescsi.device */ + put_word (resaddr + 0x0, 0x4AFC); + put_long (resaddr + 0x2, resaddr); + put_long (resaddr + 0x6, resaddr + 0x1A); /* Continue scan here */ + put_word (resaddr + 0xA, 0x8101); /* RTF_AUTOINIT|RTF_COLDSTART; Version 1 */ + put_word (resaddr + 0xC, 0x0305); /* NT_DEVICE; pri 05 */ + put_long (resaddr + 0xE, ROM_netdev_resname); + put_long (resaddr + 0x12, ROM_netdev_resid); + put_long (resaddr + 0x16, ROM_netdev_init); /* calls scsidev_init */ + resaddr += 0x1A; + return resaddr; +} + +void netdev_install (void) +{ + uae_u32 functable, datatable; + uae_u32 initcode, openfunc, closefunc, expungefunc; + uae_u32 beginiofunc, abortiofunc; + + if (!currprefs.sana2[0]) + return; + if (log_net) + write_log ("netdev_install(): 0x%x\n", here ()); + + tap_open_driver (&td, currprefs.sana2); + + ROM_netdev_resname = ds ("uaenet.device"); + ROM_netdev_resid = ds ("UAE net.device 0.1"); + + /* initcode */ + initcode = here (); + calltrap (deftrap (dev_init)); dw (RTS); + + /* Open */ + openfunc = here (); + calltrap (deftrap (dev_open)); dw (RTS); + + /* Close */ + closefunc = here (); + calltrap (deftrap (dev_close)); dw (RTS); + + /* Expunge */ + expungefunc = here (); + calltrap (deftrap (dev_expunge)); dw (RTS); + + /* BeginIO */ + beginiofunc = here (); + calltrap (deftrap (dev_beginio)); + dw (RTS); + + /* AbortIO */ + abortiofunc = here (); + calltrap (deftrap (dev_abortio)); dw (RTS); + + /* FuncTable */ + functable = here (); + dl (openfunc); /* Open */ + dl (closefunc); /* Close */ + dl (expungefunc); /* Expunge */ + dl (EXPANSION_nullfunc); /* Null */ + dl (beginiofunc); /* BeginIO */ + dl (abortiofunc); /* AbortIO */ + dl (0xFFFFFFFFul); /* end of table */ + + /* DataTable */ + datatable = here (); + dw (0xE000); /* INITBYTE */ + dw (0x0008); /* LN_TYPE */ + dw (0x0300); /* NT_DEVICE */ + dw (0xC000); /* INITLONG */ + dw (0x000A); /* LN_NAME */ + dl (ROM_netdev_resname); + dw (0xE000); /* INITBYTE */ + dw (0x000E); /* LIB_FLAGS */ + dw (0x0600); /* LIBF_SUMUSED | LIBF_CHANGED */ + dw (0xD000); /* INITWORD */ + dw (0x0014); /* LIB_VERSION */ + dw (0x0004); /* 0.4 */ + dw (0xD000); /* INITWORD */ + dw (0x0016); /* LIB_REVISION */ + dw (0x0000); /* end of table already ??? */ + dw (0xC000); /* INITLONG */ + dw (0x0018); /* LIB_IDSTRING */ + dl (ROM_netdev_resid); + dw (0x0000); /* end of table */ + + ROM_netdev_init = here (); + dl (0x00000100); /* size of device base */ + dl (functable); + dl (datatable); + dl (initcode); + + nscmd_cmd = here (); + dw (NSCMD_DEVICEQUERY); + dw (CMD_READ); + dw (CMD_WRITE); + dw (CMD_FLUSH); + dw (S2_DEVICEQUERY); + dw (S2_GETSTATIONADDRESS); + dw (S2_CONFIGINTERFACE); + dw (S2_ADDMULTICASTADDRESS); + dw (S2_DELMULTICASTADDRESS); + dw (S2_MULTICAST); + dw (S2_BROADCAST); + dw (S2_TRACKTYPE); + dw (S2_UNTRACKTYPE); + dw (S2_GETTYPESTATS); + dw (S2_GETSPECIALSTATS); + dw (S2_GETGLOBALSTATS); + dw (S2_ONEVENT); + dw (S2_READORPHAN); + dw (S2_ONLINE); + dw (S2_OFFLINE); + dw (0); + +} + +void netdev_start_threads (void) +{ + if (!currprefs.sana2[0]) + return; + if (log_net) + write_log ("netdev_start_threads()\n"); + uae_sem_init (&change_sem, 0, 1); +} + +void netdev_reset (void) +{ + if (!currprefs.sana2[0]) + return; + dev_reset (); + tap_close_driver (&td); +} diff --git a/scsiemul.c b/scsiemul.c index 344f1926..ab3599fa 100755 --- a/scsiemul.c +++ b/scsiemul.c @@ -58,7 +58,7 @@ #define CMD_ADDCHANGEINT 20 #define CMD_REMCHANGEINT 21 #define CMD_GETGEOMETRY 22 - +#define HD_SCSICMD 28 #define CD_INFO 32 #define CD_CONFIG 33 #define CD_TOCMSF 34 @@ -75,6 +75,18 @@ #define CD_ADDFRAMEINT 45 #define CD_REMFRAMEINT 46 +#define TD_READ64 24 +#define TD_WRITE64 25 +#define TD_SEEK64 26 +#define TD_FORMAT64 27 + +#define DRIVE_NEWSTYLE 0x4E535459L /* 'NSTY' */ +#define NSCMD_DEVICEQUERY 0x4000 +#define NSCMD_TD_READ64 0xc000 +#define NSCMD_TD_WRITE64 0xc001 +#define NSCMD_TD_SEEK64 0xc002 +#define NSCMD_TD_FORMAT64 0xc003 + #define ASYNC_REQUEST_NONE 0 #define ASYNC_REQUEST_TEMP 1 #define ASYNC_REQUEST_CHANGEINT 10 @@ -115,7 +127,7 @@ struct priv_devstruct { static struct devstruct devst[MAX_TOTAL_DEVICES]; static struct priv_devstruct pdevst[MAX_OPEN_DEVICES]; - +static uae_u32 nscmd_cmd; static uae_sem_t change_sem; static struct device_info *devinfo (int mode, int unitnum, struct device_info *di) @@ -388,7 +400,7 @@ static void abort_async (struct devstruct *dev, uaecptr request, int errcode, in write_log ("asyncronous request=%08.8X aborted, error=%d\n", request, errcode); } -static int command_read (int mode, struct devstruct *dev, uaecptr data, int offset, int length, uae_u32 *io_actual) +static int command_read (int mode, struct devstruct *dev, uaecptr data, uae_u64 offset, uae_u32 length, uae_u32 *io_actual) { int blocksize = dev->di.bytespersector; uae_u8 *temp; @@ -406,9 +418,9 @@ static int command_read (int mode, struct devstruct *dev, uaecptr data, int offs } return 0; } -static int command_write (int mode, struct devstruct *dev, uaecptr data, int offset, int length, uae_u32 *io_actual) +static int command_write (int mode, struct devstruct *dev, uaecptr data, uae_u64 offset, uae_u32 length, uae_u32 *io_actual) { - int blocksize = dev->di.bytespersector; + uae_u32 blocksize = dev->di.bytespersector; struct device_scsi_info dsi; if (!sys_command_scsi_info(mode, dev->unitnum, &dsi)) @@ -430,12 +442,12 @@ static int command_write (int mode, struct devstruct *dev, uaecptr data, int off return 0; } -static int command_cd_read (int mode, struct devstruct *dev, uaecptr data, int offset, int length, uae_u32 *io_actual) +static int command_cd_read (int mode, struct devstruct *dev, uaecptr data, uae_u64 offset, uae_u32 length, uae_u32 *io_actual) { uae_u8 *temp; - int len, sector; + uae_u32 len, sector; - int startoffset = offset % dev->di.bytespersector; + uae_u32 startoffset = offset % dev->di.bytespersector; offset -= startoffset; sector = offset / dev->di.bytespersector; *io_actual = 0; @@ -475,6 +487,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request) uae_u32 io_actual = get_long (request + 32); // 0x20 uae_u32 io_offset = get_long (request + 44); // 0x2c uae_u32 io_error = 0; + uae_u64 io_offset64; int async = 0; int bmask = dev->di.bytespersector - 1; struct device_info di; @@ -494,6 +507,17 @@ static int dev_do_io (struct devstruct *dev, uaecptr request) else io_error = command_read (pdev->mode, dev, io_data, io_offset, io_length, &io_actual); break; + case TD_READ64: + case NSCMD_TD_READ64: + io_offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32); + if ((io_offset64 & bmask) || (io_length & bmask)) + goto bad_command; + if (dev->drivetype == INQ_ROMD) + io_error = command_cd_read (pdev->mode, dev, io_data, io_offset64, io_length, &io_actual); + else + io_error = command_read (pdev->mode, dev, io_data, io_offset64, io_length, &io_actual); + break; + case CMD_WRITE: if (dev->di.write_protected || dev->drivetype == INQ_ROMD) { io_error = 28; /* writeprotect */ @@ -503,6 +527,18 @@ static int dev_do_io (struct devstruct *dev, uaecptr request) io_error = command_write (pdev->mode, dev, io_data, io_offset, io_length, &io_actual); } break; + case TD_WRITE64: + case NSCMD_TD_WRITE64: + io_offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32); + if (dev->di.write_protected || dev->drivetype == INQ_ROMD) { + io_error = 28; /* writeprotect */ + } else if ((io_offset64 & bmask) || (io_length & bmask)) { + goto bad_command; + } else { + io_error = command_write (pdev->mode, dev, io_data, io_offset64, io_length, &io_actual); + } + break; + case CMD_FORMAT: if (dev->di.write_protected || dev->drivetype == INQ_ROMD) { io_error = 28; /* writeprotect */ @@ -512,6 +548,18 @@ static int dev_do_io (struct devstruct *dev, uaecptr request) io_error = command_write (pdev->mode, dev, io_data, io_offset, io_length, &io_actual); } break; + case TD_FORMAT64: + case NSCMD_TD_FORMAT64: + io_offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32); + if (dev->di.write_protected || dev->drivetype == INQ_ROMD) { + io_error = 28; /* writeprotect */ + } else if ((io_offset64 & bmask) || (io_length & bmask)) { + goto bad_command; + } else { + io_error = command_write (pdev->mode, dev, io_data, io_offset64, io_length, &io_actual); + } + break; + case CMD_UPDATE: case CMD_CLEAR: case CMD_FLUSH: @@ -545,7 +593,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request) case CMD_REMCHANGEINT: release_async_request (dev, request); break; - case 28: /* HD_SCSICMD */ + case HD_SCSICMD: if (dev->allow_scsi && pdev->scsi) { uae_u32 sdd = get_long (request + 40); io_error = sys_command_scsi_direct (dev->unitnum, sdd); @@ -555,6 +603,13 @@ static int dev_do_io (struct devstruct *dev, uaecptr request) io_error = -3; } break; + case NSCMD_DEVICEQUERY: + put_long (io_data + 4, 16); /* size */ + put_word (io_data + 8, 5); /* NSDEVTYPE_TRACKDISK */ + put_word (io_data + 10, 0); + put_long (io_data + 12, nscmd_cmd); + io_actual = 16; + break; default: io_error = -3; break; @@ -963,6 +1018,34 @@ void scsidev_install (void) dl (datatable); dl (initcode); + nscmd_cmd = here (); + dw (NSCMD_DEVICEQUERY); + dw (CMD_RESET); + dw (CMD_READ); + dw (CMD_WRITE); + dw (CMD_UPDATE); + dw (CMD_CLEAR); + dw (CMD_START); + dw (CMD_STOP); + dw (CMD_FLUSH); + dw (CMD_MOTOR); + dw (CMD_SEEK); + dw (CMD_FORMAT); + dw (CMD_REMOVE); + dw (CMD_CHANGENUM); + dw (CMD_CHANGESTATE); + dw (CMD_PROTSTATUS); + dw (CMD_GETDRIVETYPE); + dw (CMD_GETGEOMETRY); + dw (CMD_ADDCHANGEINT); + dw (CMD_REMCHANGEINT); + dw (HD_SCSICMD); + dw (NSCMD_TD_READ64); + dw (NSCMD_TD_WRITE64); + dw (NSCMD_TD_SEEK64); + dw (NSCMD_TD_FORMAT64); + dw (0); + diskdev_install (); } diff --git a/zfile.c b/zfile.c index 3efed15a..8453b521 100755 --- a/zfile.c +++ b/zfile.c @@ -24,6 +24,7 @@ #include "archivers/zip/unzip.h" #include "archivers/dms/pfile.h" +#include "archivers/wrp/warp.h" static struct zfile *zlist = 0; @@ -92,7 +93,7 @@ void zfile_fclose (struct zfile *f) } static uae_u8 exeheader[]={0x00,0x00,0x03,0xf3,0x00,0x00,0x00,0x00}; -static char *diskimages[] = { "adf", "adz", "ipf", "fdi", "dms", "dsq", 0 }; +static char *diskimages[] = { "adf", "adz", "ipf", "fdi", "dms", "wrp", "dsq", 0 }; int zfile_gettype (struct zfile *z) { uae_u8 buf[8]; @@ -225,15 +226,15 @@ static struct zfile *dsq (struct zfile *z) if (zv) { if (zv->root.child) { struct zfile *zi = archive_access_lzx (zv->root.child); - if (zi) { + if (zi && zi->data && zi->size > 1000) { uae_u8 *buf = zi->data; - if (!memcmp (buf, "PKD", 3)) { + if (!memcmp (buf, "PKD\x13", 4) || !memcmp (buf, "PKD\x11", 4)) { int sectors = buf[18]; int heads = buf[15]; int blocks = (buf[6] << 8) | buf[7]; int blocksize = (buf[10] << 8) | buf[11]; if (blocksize == 512 && blocks == 1760 && sectors == 22 && heads == 2) { - int off = 52; + int off = buf[3] == 0x13 ? 52 : 32; int i; for (i = 0; i < blocks / (sectors / heads); i++) { zfile_fwrite (zi->data + off, sectors * blocksize / heads, 1, zo); @@ -253,6 +254,11 @@ static struct zfile *dsq (struct zfile *z) return z; } +static struct zfile *wrp (struct zfile *z) +{ + return unwarp (z); +} + static struct zfile *dms (struct zfile *z) { int ret; @@ -272,7 +278,7 @@ static struct zfile *dms (struct zfile *z) const char *uae_ignoreextensions[] = { ".gif", ".jpg", ".png", ".xml", ".pdf", ".txt", 0 }; const char *uae_diskimageextensions[] = - { ".adf", ".adz", ".ipf", ".fdi", ".exe", ".dms", ".dsq", 0 }; + { ".adf", ".adz", ".ipf", ".fdi", ".exe", ".dms", ".wrp", ".dsq", 0 }; int zfile_is_ignore_ext(const char *name) @@ -367,6 +373,8 @@ static struct zfile *zuncompress (struct zfile *z, int dodefault) return zfile_gunzip (z); if (strcasecmp (ext, "dms") == 0) return dms (z); + if (strcasecmp (ext, "wrp") == 0) + return wrp (z); if (strcasecmp (ext, "dsq") == 0) return dsq (z); #if defined(ARCHIVEACCESS) @@ -739,6 +747,12 @@ char *zfile_fgets(char *s, int size, struct zfile *z) } } +int zfile_putc (int c, struct zfile *z) +{ + uae_u8 b = (uae_u8)c; + return zfile_fwrite (&b, 1, 1, z) ? 1 : -1; +} + int zfile_getc (struct zfile *z) { int out = -1; @@ -756,6 +770,21 @@ int zfile_ferror (struct zfile *z) return 0; } +char *zfile_getdata (struct zfile *z, int offset, int len) +{ + size_t pos; + uae_u8 *b = xmalloc (len); + if (z->data) { + memcpy (b, z->data + offset, len); + } else { + pos = zfile_ftell (z); + zfile_fseek (z, offset, SEEK_SET); + zfile_fread (b, len, 1, z); + zfile_fseek (z, pos, SEEK_SET); + } + return b; +} + int zfile_zuncompress (void *dst, int dstsize, struct zfile *src, int srcsize) { z_stream zs; -- 2.47.3