From: Toni Wilen Date: Sun, 16 Jan 2005 09:39:38 +0000 (+0200) Subject: imported winuaesrc1000b1.zip X-Git-Tag: 2100~321 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=432c015a4b2fdc83ac38633b763c849bc6005b58;p=francis%2Fwinuae.git imported winuaesrc1000b1.zip --- diff --git a/arcadia.c b/arcadia.c new file mode 100755 index 00000000..5fbec9ba --- /dev/null +++ b/arcadia.c @@ -0,0 +1,420 @@ + /* + * UAE - The Un*x Amiga Emulator + * + * Arcadia emulation + * + * Copyright 2005 Toni Wilen + * + */ + +#include "sysconfig.h" +#include "sysdeps.h" + +#include "config.h" +#include "options.h" +#include "uae.h" +#include "memory.h" +#include "custom.h" +#include "newcpu.h" +#include "debug.h" +#include "arcadia.h" +#include "zfile.h" + +/* supported roms (mame 0.90) + * + * - ar_airh + * - ar_bowl + * - ar_fast + * - ar_ldrb + * - ar_ldrba + * - ar_ninj + * - ar_rdwr + * - ar_sdwr (crashes. bad dump?) + * - ar_spot + * - ar_sprg + * - ar_xeon + * + */ + +int arcadia_flag, arcadia_coin[2]; +struct arcadiarom *arcadia_rom; + +static char arcadia_path[MAX_DPATH]; + +static struct arcadiarom roms[] = { + { "ar_airh.zip", "scpa211", "airh_", 1, 5, 0, 2, 4, 7, 6, 1, 3, 0x98f564 }, + { "ar_bowl.zip", "scpa211", "bowl_", 1, 7, 6, 0, 1, 2, 3, 4, 5, 0x98f564 }, + { "ar_dart.zip", "scpa211", "dart_", 1, 4, 0, 7, 6, 3, 1, 2, 5, 0x98f564 }, + { "ar_fast.zip", "scpav3_0.1", "fastv28.", 0, 7, 6, 5, 4, 3, 2, 1, 0, 0x9902bc }, + { "ar_ldrb.zip", "scpa211", "lbg240", 0, 7, 6, 5, 4, 3, 2, 1, 0, 0x98f564 }, + { "ar_ldrba.zip", "ar_ldrb.zip/scpa211", "ldrb_", 1, 2, 3, 4, 1, 0, 7, 5, 6, 0x98f564 }, + { "ar_ninj.zip", "scpa211", "ninj_", 1, 1, 6, 5, 7, 4, 2, 0, 3, 0x98f564 }, + { "ar_rdwr.zip", "scpa211", "rdwr_", 1, 3, 1, 6, 4, 0, 5, 2, 7, 0x98f564 }, + { "ar_sdwr.zip", "scpa211", "sdwr_", 1, 6, 3, 4, 5, 2, 1, 0, 7, 0x98f564 }, + { "ar_spot.zip", "spotv3.0", "spotv2.", 0, 7, 6, 5, 4, 3, 2, 1, 0, 0x9902bc }, + { "ar_sprg.zip", "scpa211", "sprg_", 1, 4, 7, 3, 0, 6, 5, 2, 1, 0x98f564 }, + { "ar_xeon.zip", "scpa211", "xeon_", 1, 3, 1, 2, 4, 0, 5, 6, 7, 0x98f564 }, + { NULL, NULL, NULL } +}; + +static uae_u8 *arbmemory; +#define arb_start 0x800000 +#define arb_mask 0x1fffff +#define allocated_arbmemory 0x200000 + +#define nvram_offset 0x1fc000 +#define bios_offset 0x180000 +#define NVRAM_SIZE 0x4000 + +static int nvwrite; + +static int load_rom8 (char *xpath, uae_u8 *mem, int isbin) +{ + struct zfile *zf; + char path[MAX_DPATH]; + int i; + uae_u8 *tmp = xmalloc (131072); + char *bin = isbin ? ".bin" : ""; + + memset (tmp, 0, 131072); + sprintf (path, "%sh%s", xpath, bin); + zf = zfile_fopen (path, "rb"); + if (!zf) + goto end; + if (zfile_fread (tmp, 65536, 1, zf) == 0) + goto end; + zfile_fclose (zf); + sprintf (path, "%sl%s", xpath, bin); + zf = zfile_fopen (path, "rb"); + if (!zf) + goto end; + if (zfile_fread (tmp + 65536, 65536, 1, zf) == 0) + goto end; + zfile_fclose (zf); + for (i = 0; i < 65536; i++) { + mem[i * 2 + 0] = tmp[i]; + mem[i * 2 + 1] = tmp[i + 65536]; + } + xfree (tmp); + return 1; + end: + xfree (tmp); + return 0; +} + +static struct arcadiarom *is_arcadia (char *xpath) +{ + char path[MAX_DPATH], *p; + struct arcadiarom *rom = NULL; + int i; + + strcpy (path, xpath); + p = path; + for (i = strlen (xpath) - 1; i > 0; i--) { + if (path[i] == '\\' || path[i] == '/') { + path[i++] = 0; + p = path + i; + break; + } + } + for (i = 0; roms[i].name; i++) { + if (!strcmpi (p, roms[i].name)) { + rom = &roms[i]; + break; + } + } + if (!rom) + return 0; + return rom; +} + +static int load_roms (char *xpath, struct arcadiarom *rom) +{ + char path[MAX_DPATH], path2[MAX_DPATH]; + int i; + + i = 0; + strcpy (path2, xpath); + if (strchr (rom->bios, '/')) { + char *p = path2 + strlen (path2) - 1; + while (p > path2) { + if (p[0] == '\\' || p[0] == '/') { + *p = 0; + break; + } + p--; + } + if (p == path2) + *p = 0; + } + sprintf (path, "%s/%s", path2, rom->bios); + if (!load_rom8 (path, arbmemory + bios_offset, 0)) { + write_log ("Arcadia: bios load failed ('%s')\n", path); + return 0; + } + write_log ("Arcadia: bios '%s' loaded\n", path); + for (;;) { + sprintf (path, "%s/%s%d", xpath, rom->rom, i + 1); + if (!load_rom8 (path, arbmemory + 2 * 65536 * i, rom->bin)) { + if (i == 0) + write_log ("Arcadia: game rom load failed ('%s')\n", path); + break; + } + i++; + } + if (i == 0) + return 0; + write_log ("Arcadia: game rom loaded\n"); + return 1; +} + +static uae_u8 bswap (uae_u8 v,int b7,int b6,int b5,int b4,int b3,int b2,int b1,int b0) +{ + uae_u8 b = 0; + + b |= ((v >> b7) & 1) << 7; + b |= ((v >> b6) & 1) << 6; + b |= ((v >> b5) & 1) << 5; + b |= ((v >> b4) & 1) << 4; + b |= ((v >> b3) & 1) << 3; + b |= ((v >> b2) & 1) << 2; + b |= ((v >> b1) & 1) << 1; + b |= ((v >> b0) & 1) << 0; + return b; +} + +static void decrypt_roms (struct arcadiarom *rom) +{ + int i, j; + + for (i = 1; i < 0x20000; i += 2) + arbmemory[i] = bswap (arbmemory[i], + rom->b7,rom->b6,rom->b5,rom->b4,rom->b3,rom->b2,rom->b1,rom->b0); + for (i = 1; i < 0x20000; i += 2) { + j = i + bios_offset; + arbmemory[j] = bswap (arbmemory[j],6,1,0,2,3,4,5,7); + } + if (!strcmp (rom->name, "ar_dart.zip")) + arbmemory[1] = 0xfc; +} + +uae_u32 REGPARAM2 aab_bget (uaecptr addr) +{ + return 0; +} + +static uae_u32 REGPARAM2 aab_wget (uaecptr addr) +{ + uae_u32 v; +#ifdef JIT + special_mem |= S_READ; +#endif + v = (aab_bget (addr) << 8) | aab_bget (addr + 1); + return v; +} + +static uae_u32 REGPARAM2 aab_lget (uaecptr addr) +{ + uae_u32 v; +#ifdef JIT + special_mem |= S_READ; +#endif + v = (aab_bget (addr) << 24) | (aab_bget (addr + 1) << 16) | + (aab_bget (addr + 2) << 8) | (aab_bget (addr + 3)); + return v; +} + +static void REGPARAM2 aab_lput (uaecptr addr, uae_u32 l) +{ +#ifdef JIT + special_mem |= S_WRITE; +#endif +} +static void REGPARAM2 aab_wput (uaecptr addr, uae_u32 w) +{ +#ifdef JIT + special_mem |= S_WRITE; +#endif +} +static void REGPARAM2 aab_bput (uaecptr addr, uae_u32 b) +{ +#ifdef JIT + special_mem |= S_WRITE; +#endif +} + +addrbank arcadia_autoconfig_bank = { + aab_lget, aab_wget, aab_bget, + aab_lput, aab_wput, aab_bput, + default_xlate, default_check, NULL +}; + +static uae_u32 REGPARAM2 arb_lget (uaecptr addr) +{ + uae_u32 *m; + + addr -= arb_start & arb_mask; + addr &= arb_mask; + m = (uae_u32 *)(arbmemory + addr); + return do_get_mem_long (m); +} +uae_u32 REGPARAM2 arb_wget (uaecptr addr) +{ + uae_u16 *m; + + addr -= arb_start & arb_mask; + addr &= arb_mask; + m = (uae_u16 *)(arbmemory + addr); + return do_get_mem_word (m); +} +uae_u32 REGPARAM2 arb_bget (uaecptr addr) +{ + addr -= arb_start & arb_mask; + addr &= arb_mask; + return arbmemory[addr]; +} + +void REGPARAM2 arb_lput (uaecptr addr, uae_u32 l) +{ + uae_u32 *m; + + addr -= arb_start & arb_mask; + addr &= arb_mask; + if (addr >= nvram_offset) { + m = (uae_u32 *)(arbmemory + addr); + do_put_mem_long (m, l); + nvwrite++; + } +} + +void REGPARAM2 arb_wput (uaecptr addr, uae_u32 w) +{ + uae_u16 *m; + + addr -= arb_start & arb_mask; + addr &= arb_mask; + if (addr >= nvram_offset) { + m = (uae_u16 *)(arbmemory + addr); + do_put_mem_word (m, w); + nvwrite++; + } +} + +void REGPARAM2 arb_bput (uaecptr addr, uae_u32 b) +{ + addr -= arb_start & arb_mask; + addr &= arb_mask; + if (addr >= nvram_offset) { + arbmemory[addr] = b; + nvwrite++; + } +} + +int REGPARAM2 arb_check (uaecptr addr, uae_u32 size) +{ + addr -= arb_start & arb_mask; + addr &= arb_mask; + return (addr + size) <= allocated_arbmemory; +} + +uae_u8 REGPARAM2 *arb_xlate (uaecptr addr) +{ + addr -= arb_start & arb_mask; + addr &= arb_mask; + return arbmemory + addr; +} + +addrbank arcadia_rom_bank = { + arb_lget, arb_wget, arb_bget, + arb_lput, arb_wput, arb_bput, + default_xlate, default_check, NULL +}; + +int is_arcadia_rom (char *path) +{ + strcpy (arcadia_path, path); + arcadia_rom = is_arcadia (path); + return arcadia_rom ? 1 : 0; +} + +static void nvram_write (void) +{ + struct zfile *f = zfile_fopen (currprefs.flashfile, "rb+"); + if (!f) { + f = zfile_fopen (currprefs.flashfile, "wb"); + if (!f) + return; + } + zfile_fwrite (arbmemory + nvram_offset, NVRAM_SIZE, 1, f); + zfile_fclose (f); +} + +static void nvram_read (void) +{ + struct zfile *f; + + f = zfile_fopen (currprefs.flashfile, "rb"); + memset (arbmemory + nvram_offset, 0, NVRAM_SIZE); + if (!f) + return; + zfile_fread (arbmemory + nvram_offset, NVRAM_SIZE, 1, f); + zfile_fclose (f); +} + +void arcadia_unmap (void) +{ + xfree (arbmemory); + arbmemory = NULL; + arcadia_rom = NULL; +} + +int arcadia_map_banks (void) +{ + if (!arcadia_rom) + return 0; + arbmemory = xmalloc (allocated_arbmemory); + memset (arbmemory, 0, allocated_arbmemory); + if (!load_roms (arcadia_path, arcadia_rom)) { + arcadia_unmap (); + return 0; + } + decrypt_roms (arcadia_rom); + nvram_read (); + map_banks (&arcadia_rom_bank, arb_start >> 16, + allocated_arbmemory >> 16, 0); + return 1; +} + +void arcadia_vsync (void) +{ + static int cnt; + + cnt--; + if (cnt > 0) + return; + cnt = 50; + if (!nvwrite) + return; + nvram_write (); + nvwrite = 0; +} + +uae_u8 arcadia_parport (int port, uae_u8 pra, uae_u8 dra) +{ + uae_u8 v; + + v = (pra & dra) | (dra ^ 0xff); + if (port) { + if (dra & 1) + arcadia_coin[0] = arcadia_coin[1] = 0; + return 0; + } + v = 0; + v |= (arcadia_flag & 1) ? 0 : 2; + v |= (arcadia_flag & 2) ? 0 : 4; + v |= (arcadia_flag & 4) ? 0 : 8; + v |= (arcadia_coin[0] & 3) << 4; + v |= (arcadia_coin[1] & 3) << 6; + return v; +} + diff --git a/audio.c b/audio.c index e836e1e1..3c1be73c 100755 --- a/audio.c +++ b/audio.c @@ -306,10 +306,10 @@ void sample16ss_handler (void) data2 &= audio_channel[2].adk_mask; data3 &= audio_channel[3].adk_mask; - PUT_SOUND_WORD (data1 << 2); PUT_SOUND_WORD (data0 << 2); - PUT_SOUND_WORD (data2 << 2); + PUT_SOUND_WORD (data1 << 2); PUT_SOUND_WORD (data3 << 2); + PUT_SOUND_WORD (data2 << 2); check_sound_buffers (); } @@ -334,14 +334,14 @@ void sample16s_handler (void) { uae_u32 data = SBASEVAL16(1) + data0; FINISH_DATA (data, 16, 1); - put_sound_word_right (data); + put_sound_word_left (data); } data1 += data2; { uae_u32 data = SBASEVAL16(1) + data1; FINISH_DATA (data, 16, 1); - put_sound_word_left (data); + put_sound_word_right (data); } check_sound_buffers (); @@ -413,13 +413,13 @@ void sample16si_crux_handler (void) { uae_u32 data = SBASEVAL16(1) + data0; FINISH_DATA (data, 16, 1); - put_sound_word_right (data); + put_sound_word_left (data); } { uae_u32 data = SBASEVAL16(1) + data1; FINISH_DATA (data, 16, 1); - put_sound_word_left (data); + put_sound_word_right (data); } check_sound_buffers (); } @@ -471,13 +471,13 @@ void sample16si_rh_handler (void) { uae_u32 data = SBASEVAL16(1) + data0; FINISH_DATA (data, 16, 1); - put_sound_word_right (data); + put_sound_word_left (data); } { uae_u32 data = SBASEVAL16(1) + data1; FINISH_DATA (data, 16, 1); - put_sound_word_left (data); + put_sound_word_right (data); } check_sound_buffers (); } diff --git a/catweasel.c b/catweasel.c index e35370b3..ac67d333 100755 --- a/catweasel.c +++ b/catweasel.c @@ -104,6 +104,7 @@ void catweasel_free (void) if (!currprefs.catweasel_io) return; ioport_free (); + cwc.type = 0; } #define outb(v,port) ioport_write(port,v) diff --git a/cfgfile.c b/cfgfile.c index 479e3f74..6e70ef3e 100755 --- a/cfgfile.c +++ b/cfgfile.c @@ -26,6 +26,7 @@ #include "gui.h" #include "newcpu.h" #include "zfile.h" +#include "filesys.h" #define CONFIG_BLEN 2560 @@ -423,7 +424,7 @@ static void save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_write (f, "state_replay_buffer=%d\n", p->statecapturebuffersize); #ifdef FILESYS - write_filesys_config (currprefs.mountinfo, UNEXPANDED, p->path_hardfile, f); + write_filesys_config (&currprefs, currprefs.mountinfo, UNEXPANDED, p->path_hardfile, f); if (p->filesys_no_uaefsdb) cfgfile_write (f, "filesys_no_fsdb=%s\n", p->filesys_no_uaefsdb ? "true" : "false"); #endif @@ -997,7 +998,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu tmpp = 0; #ifdef FILESYS tmpp = add_filesys_unit (currprefs.mountinfo, 0, aname, str, ro, secs, - heads, reserved, bs, 0, 0); + heads, reserved, bs, 0, 0, 0); #endif free (str); if (tmpp) @@ -1075,7 +1076,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu tmpp = 0; #ifdef FILESYS tmpp = add_filesys_unit (currprefs.mountinfo, dname, aname, str, ro, secs, - heads, reserved, bs, bp, fs); + heads, reserved, bs, bp, fs, 0); #endif free (str); if (tmpp) @@ -1353,6 +1354,7 @@ int cfgfile_load (struct uae_prefs *p, const char *filename, int *type, int igno end: recursive--; fixup_prefs (p); + write_log ("%s\n", p->romfile); return v; } @@ -1542,7 +1544,7 @@ static void parse_filesys_spec (int readonly, char *spec) #endif s2 = 0; #ifdef FILESYS - s2 = add_filesys_unit (currprefs.mountinfo, 0, buf, s2, readonly, 0, 0, 0, 0, 0, 0); + s2 = add_filesys_unit (currprefs.mountinfo, 0, buf, s2, readonly, 0, 0, 0, 0, 0, 0, 0); #endif if (s2) write_log ("%s\n", s2); @@ -1574,7 +1576,7 @@ static void parse_hardfile_spec (char *spec) *x4++ = '\0'; x4 = 0; #ifdef FILESYS - x4 = add_filesys_unit (currprefs.mountinfo, 0, 0, x4, 0, atoi (x0), atoi (x1), atoi (x2), atoi (x3), 0, 0); + x4 = add_filesys_unit (currprefs.mountinfo, 0, 0, x4, 0, atoi (x0), atoi (x1), atoi (x2), atoi (x3), 0, 0, 0); #endif if (x4) write_log ("%s\n", x4); @@ -2304,9 +2306,7 @@ void default_prefs (struct uae_prefs *p, int type) p->statecapturerate = 5 * 50; p->statecapture = 0; -#ifdef FILESYS - p->mountinfo = alloc_mountinfo (); -#endif + p->mountinfo = &options_mountinfo; #ifdef UAE_MINI default_prefs_mini (p, 0); @@ -2336,7 +2336,7 @@ static void buildin_default_host_prefs (struct uae_prefs *p) static void buildin_default_prefs (struct uae_prefs *p) { free_mountinfo (currprefs.mountinfo); - currprefs.mountinfo = p->mountinfo = alloc_mountinfo (); + p->mountinfo = currprefs.mountinfo = changed_prefs.mountinfo = &options_mountinfo; buildin_default_host_prefs (p); @@ -2640,6 +2640,12 @@ int build_in_prefs (struct uae_prefs *p, int model, int config, int compa, int r case 6: v = bip_cdtv (p, config, compa, romcheck); break; + case 7: + v = bip_a500 (p, 3, compa, romcheck); + p->nr_floppies = 0; + p->dfxtype[0] = -1; + p->dfxtype[1] = -1; + break; case 10: v = bip_super (p, config, compa, romcheck); break; diff --git a/cia.c b/cia.c index cf1cd574..9b5cdd3c 100755 --- a/cia.c +++ b/cia.c @@ -29,10 +29,9 @@ #include "zfile.h" #include "ar.h" #include "parallel.h" -#ifdef CD32 #include "akiko.h" -#endif #include "debug.h" +#include "arcadia.h" //#define CIA_DEBUG_R //#define CIA_DEBUG_W @@ -485,6 +484,10 @@ static uae_u8 ReadCIAA (unsigned int addr) uae_u8 v; parallel_direct_read_data (&v); tmp = v; +#ifdef ARCADIA + } else if (arcadia_rom) { + tmp = arcadia_parport (0, ciaaprb, ciaadrb); +#endif } else { tmp = handle_parport_joystick (0, ciaaprb, ciaadrb); } @@ -680,6 +683,10 @@ static void WriteCIAA (uae_u16 addr,uae_u8 val) doprinter (val); } else if (isprinter() < 0) { parallel_direct_write_data (val, ciaadrb); +#ifdef ARCADIA + } else if (arcadia_rom) { + arcadia_parport (1, ciaaprb, ciaadrb); +#endif } cia_parallelack (); #endif @@ -691,11 +698,16 @@ static void WriteCIAA (uae_u16 addr,uae_u8 val) #endif ciaadra = val; bfe001_change (); break; case 3: + ciaadrb = val; #ifdef DONGLE_DEBUG if (notinrom ()) write_log ("BFE301 W %02.2X %s\n", val, debuginfo(0)); #endif - ciaadrb = val; break; +#ifdef ARCADIA + if (arcadia_rom) + arcadia_parport (1, ciaaprb, ciaadrb); +#endif + break; case 4: CIA_update (); ciaala = (ciaala & 0xff00) | val; diff --git a/custom.c b/custom.c index c6196c86..12772c50 100755 --- a/custom.c +++ b/custom.c @@ -3507,6 +3507,7 @@ static int isagnus[]= { 1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0, /* 32 0xa0 - 0xde /* BPLxPTH/BPLxPTL */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 16 */ + /* BPLCON0-3,BPLMOD1-2 */ 0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0, /* 16 */ /* SPRxPTH/SPRxPTL */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 16 */ diff --git a/debug.c b/debug.c index 64c16045..de406db8 100755 --- a/debug.c +++ b/debug.c @@ -181,6 +181,25 @@ static int more_params (char **c) return (**c) != 0; } +static int next_string (char **c, char *out, int max) +{ + char *p = out; + + *p = 0; + while (**c != 0) { + if (**c == 32) { + ignore_ws (c); + return strlen (out); + } + *p++ = next_char (c); + *p = 0; + max--; + if (max <= 1) + break; + } + return strlen (out); +} + static uae_u32 nextaddr (uae_u32 addr) { if (addr == 0xffffffff) { @@ -1187,16 +1206,21 @@ static int staterecorder (char **cc) static void m68k_modify (char **inptr) { - char c1, c2; uae_u32 v; + char parm[10]; + char c1, c2; - c1 = toupper (next_char (inptr)); - if (!more_params (inptr)) - return; - c2 = toupper (next_char (inptr)); - if (c2 < '0' || c2 > '7') + if (!next_string (inptr, parm, sizeof (parm))) return; - c2 -= '0'; + for (v = 0; parm[v]; v++) + parm[v] = toupper (parm[v]); + c1 = toupper (parm[0]); + c2 = toupper (parm[1]); + if (c1 == 'A' || c1 == 'D' || c1 == 'P') { + if (!isdigit (c2)) + return; + c2 -= '0'; + } v = readhex (inptr); if (c1 == 'A') regs.regs[8 + c2] = v; @@ -1206,6 +1230,24 @@ static void m68k_modify (char **inptr) regs.irc = v; else if (c1 == 'P' && c2 == 1) regs.ir = v; + else if (!strcmp (parm, "VBR")) + regs.vbr = v; + else if (!strcmp (parm, "USP")) { + regs.usp = v; + MakeFromSR (); + } else if (!strcmp (parm, "ISP")) { + regs.isp = v; + MakeFromSR (); + } else if (!strcmp (parm, "MSP")) { + regs.msp = v; + MakeFromSR (); + } else if (!strcmp (parm, "SR")) { + regs.sr = v; + MakeFromSR (); + } else if (!strcmp (parm, "CCR")) { + regs.sr = (regs.sr & ~15) | (v & 15); + MakeFromSR (); + } } static void debug_1 (void) @@ -1239,7 +1281,13 @@ static void debug_1 (void) case 'W': writeintomem (&inptr); break; case 'w': memwatch (&inptr); break; case 'S': savemem (&inptr); break; - case 's': searchmem (&inptr); break; + case 's': + if (more_params(&inptr) && next_char(&inptr) == 'c') { + screenshot (1); + } else { + searchmem (&inptr); + } + break; case 'd': { uae_u32 daddr; diff --git a/driveclick.c b/driveclick.c index 972987cf..8bdfa829 100755 --- a/driveclick.c +++ b/driveclick.c @@ -78,19 +78,19 @@ static int loadsample (char *path, struct drvsample *ds) } zfile_fseek (f, 0, SEEK_END); size = zfile_ftell (f); - buf = malloc (size); + buf = xmalloc (size); zfile_fseek (f, 0, SEEK_SET); zfile_fread (buf, size, 1, f); zfile_fclose (f); ds->len = size; ds->p = decodewav (buf, &ds->len); - free (buf); + xfree (buf); return 1; } static void freesample (struct drvsample *s) { - free (s->p); + xfree (s->p); s->p = 0; } @@ -105,7 +105,7 @@ static void processclicks(struct drvsample *ds) } for(n = 0; n < ds->len; n++) { uae_s16 smp = ds->p[n]; - if ((smp > 0x6ff0) && (nClick < CLICK_TRACKS)) { + if (smp > 0x6ff0 && nClick < CLICK_TRACKS) { ds->indexes[nClick] = n - 128; ds->lengths[nClick] = 2800; nClick ++; @@ -152,17 +152,24 @@ void driveclick_init(void) for (j = 0; j < CLICK_TRACKS; j++) drvs[i][DS_CLICK].lengths[j] = drvs[i][DS_CLICK].len; } else if (currprefs.dfxclick[i] == -1) { - sprintf (tmp, "%suae_data%cdrive_click_%s", start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]); + for (j = 0; j < CLICK_TRACKS; j++) + drvs[i][DS_CLICK].lengths[j] = drvs[i][DS_CLICK].len; + sprintf (tmp, "%suae_data%cdrive_click_%s", + start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]); v = loadsample (tmp, &drvs[i][DS_CLICK]); if (v) processclicks (&drvs[i][DS_CLICK]); - sprintf (tmp, "%suae_data%cdrive_spin_%s", start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]); + sprintf (tmp, "%suae_data%cdrive_spin_%s", + start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]); v += loadsample (tmp, &drvs[i][DS_SPIN]); - sprintf (tmp, "%suae_data%cdrive_spinnd_%s", start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]); + sprintf (tmp, "%suae_data%cdrive_spinnd_%s", + start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]); v += loadsample (tmp, &drvs[i][DS_SPINND]); - sprintf (tmp, "%suae_data%cdrive_startup_%s", start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]); + sprintf (tmp, "%suae_data%cdrive_startup_%s", + start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]); v += loadsample (tmp, &drvs[i][DS_START]); - sprintf (tmp, "%suae_data%cdrive_snatch_%s", start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]); + sprintf (tmp, "%suae_data%cdrive_snatch_%s", + start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]); v += loadsample (tmp, &drvs[i][DS_SNATCH]); } if (v == 0) { @@ -187,7 +194,7 @@ void driveclick_init(void) void driveclick_reset (void) { - free (clickbuffer); + xfree (clickbuffer); clickbuffer = xmalloc (sndbufsize); sample_step = (freq << DS_SHIFT) / currprefs.sound_freq; } @@ -201,7 +208,7 @@ void driveclick_free (void) freesample (&drvs[i][j]); } memset (drvs, 0, sizeof (drvs)); - free (clickbuffer); + xfree (clickbuffer); clickbuffer = 0; click_initialized = 0; } diff --git a/expansion.c b/expansion.c index 1005bf11..8deb712e 100755 --- a/expansion.c +++ b/expansion.c @@ -24,6 +24,7 @@ #include "zfile.h" #include "catweasel.h" #include "cdtv.h" +#include "arcadia.h" #define MAX_EXPANSION_BOARDS 8 @@ -762,6 +763,118 @@ static void expamem_init_fastcard (void) /* ********************************************************** */ +#ifdef ARCADIA + +static uae_u8 *arcadiaboot; +static uae_u32 arcadia_start; + +static uae_u32 REGPARAM2 arcadia_lget (uaecptr addr) +{ + uae_u8 *m; +#ifdef JIT + special_mem |= S_READ; +#endif + addr -= arcadia_start & 65535; + addr &= 65535; + m = arcadiaboot + addr; + return do_get_mem_long ((uae_u32 *)m); +} + +static uae_u32 REGPARAM2 arcadia_wget (uaecptr addr) +{ + uae_u8 *m; +#ifdef JIT + special_mem |= S_READ; +#endif + addr -= arcadia_start & 65535; + addr &= 65535; + m = arcadiaboot + addr; + return do_get_mem_word ((uae_u16 *)m); +} + +static uae_u32 REGPARAM2 arcadia_bget (uaecptr addr) +{ +#ifdef JIT + special_mem |= S_READ; +#endif + addr -= arcadia_start & 65535; + addr &= 65535; + return arcadiaboot[addr]; +} + +static void REGPARAM2 arcadia_lput (uaecptr addr, uae_u32 l) +{ +#ifdef JIT + special_mem |= S_WRITE; +#endif + write_log ("arcadia_lput called PC=%p\n", m68k_getpc()); +} + +static void REGPARAM2 arcadia_wput (uaecptr addr, uae_u32 w) +{ +#ifdef JIT + special_mem |= S_WRITE; +#endif + write_log ("arcadia_wput called PC=%p\n", m68k_getpc()); +} + +static void REGPARAM2 arcadia_bput (uaecptr addr, uae_u32 b) +{ +#ifdef JIT + special_mem |= S_WRITE; +#endif +} + +static addrbank arcadia_bank = { + arcadia_lget, arcadia_wget, arcadia_bget, + arcadia_lput, arcadia_wput, arcadia_bput, + default_xlate, default_check, NULL +}; + +static void expamem_map_arcadia (void) +{ + arcadia_start = ((expamem_hi | (expamem_lo >> 4)) << 16); + write_log ("Arcadia initialized @%08.8X\n", arcadia_start); + map_banks (&arcadia_bank, arcadia_start >> 16, 1, 0); +} + +static void expamem_init_arcadia (void) +{ + expamem_init_clear(); + expamem_write (0x00, zorroII | Z2_MEM_2MB | rom_card); + + expamem_write (0x04, 1); + expamem_write (0x08, no_shutup); + + expamem_write (0x10, 0x07); + expamem_write (0x14, 0x70); + + expamem_write (0x18, 0x00); /* ser.no. Byte 0 */ + expamem_write (0x1c, 0x00); /* ser.no. Byte 1 */ + expamem_write (0x20, 0x00); /* ser.no. Byte 2 */ + expamem_write (0x24, 0x01); /* ser.no. Byte 3 */ + + expamem_write (0x28, 0x10); /* Rom-Offset hi */ + expamem_write (0x2c, 0x00); /* ROM-Offset lo */ + + expamem_write (0x40, 0x00); /* Ctrl/Statusreg.*/ + + expamem[0x1000] = 0x90; + expamem[0x1001] = 0x00; + expamem[0x1002] = 0x01; + expamem[0x1003] = 0x06; + expamem[0x1004] = 0x01; + expamem[0x1005] = 0x00; + + /* Call DiagEntry */ + do_put_mem_word ((uae_u16 *)(expamem + 0x1100), 0x4EF9); /* JMP */ + do_put_mem_long ((uae_u32 *)(expamem + 0x1102), arcadia_rom->boot); + + memcpy (arcadiaboot, expamem, 0x2000); +} + +#endif + /* * Filesystem device */ @@ -1047,6 +1160,12 @@ void expamem_reset (void) if (nr_units (currprefs.mountinfo) == 0) do_mount = 0; +#ifdef ARCADIA + if (arcadia_rom) { + card_init[cardno] = expamem_init_arcadia; + card_map[cardno++] = expamem_map_arcadia; + } +#endif if (fastmemory != NULL) { card_init[cardno] = expamem_init_fastcard; card_map[cardno++] = expamem_map_fastcard; @@ -1105,7 +1224,10 @@ void expansion_init (void) exit (0); } filesys_bank.baseaddr = (uae_u8*)filesysory; - +#ifdef ARCADIA + arcadiaboot = mapped_malloc (0x10000, "arcadia"); + arcadia_bank.baseaddr = arcadiaboot; +#endif } void expansion_cleanup (void) diff --git a/filesys.c b/filesys.c index 072582f1..7ac480bb 100755 --- a/filesys.c +++ b/filesys.c @@ -102,6 +102,7 @@ typedef struct { int readonly; /* disallow write access? */ int bootpri; /* boot priority */ int devno; + int automounted; /* don't save to config if set */ struct hardfiledata hf; @@ -129,7 +130,8 @@ struct uaedev_mount_info { UnitInfo ui[MAX_FILESYSTEM_UNITS]; }; -static struct uaedev_mount_info *current_mountinfo; +static struct uaedev_mount_info current_mountinfo; +struct uaedev_mount_info options_mountinfo; int nr_units (struct uaedev_mount_info *mountinfo) { @@ -175,7 +177,7 @@ static void close_filesys_unit (UnitInfo *uip) char *get_filesys_unit (struct uaedev_mount_info *mountinfo, int nr, char **devname, char **volname, char **rootdir, int *readonly, int *secspertrack, int *surfaces, int *reserved, - int *cylinders, uae_u64 *size, int *blocksize, int *bootpri, char **filesysdir) + int *cylinders, uae_u64 *size, int *blocksize, int *bootpri, char **filesysdir, int *flags) { UnitInfo *uip = mountinfo->ui + nr; @@ -198,6 +200,7 @@ char *get_filesys_unit (struct uaedev_mount_info *mountinfo, int nr, *blocksize = uip->hf.blocksize; *size = uip->hf.size; *bootpri = uip->bootpri; + *flags = uip->automounted ? FILESYS_FLAG_DONOTSAVE : 0; if (filesysdir) *filesysdir = uip->filesysdir ? my_strdup (uip->filesysdir) : 0; return 0; @@ -206,7 +209,7 @@ char *get_filesys_unit (struct uaedev_mount_info *mountinfo, int nr, static char *set_filesys_unit_1 (struct uaedev_mount_info *mountinfo, int nr, char *devname, char *volname, char *rootdir, int readonly, int secspertrack, int surfaces, int reserved, - int blocksize, int bootpri, char *filesysdir) + int blocksize, int bootpri, char *filesysdir, int flags) { UnitInfo *ui = mountinfo->ui + nr; static char errmsg[1024]; @@ -222,6 +225,7 @@ static char *set_filesys_unit_1 (struct uaedev_mount_info *mountinfo, int nr, ui->hf.handle = 0; ui->bootpri = 0; ui->filesysdir = 0; + ui->automounted = flags & FILESYS_FLAG_DONOTSAVE; if (volname != 0) { int flags; @@ -277,14 +281,14 @@ static char *set_filesys_unit_1 (struct uaedev_mount_info *mountinfo, int nr, char *set_filesys_unit (struct uaedev_mount_info *mountinfo, int nr, char *devname, char *volname, char *rootdir, int readonly, int secspertrack, int surfaces, int reserved, - int blocksize, int bootpri, char *filesysdir) + int blocksize, int bootpri, char *filesysdir, int flags) { char *result; UnitInfo ui = mountinfo->ui[nr]; hdf_close (&ui.hf); result = set_filesys_unit_1 (mountinfo, nr, devname, volname, rootdir, readonly, - secspertrack, surfaces, reserved, blocksize, bootpri, filesysdir); + secspertrack, surfaces, reserved, blocksize, bootpri, filesysdir, flags); if (result) mountinfo->ui[nr] = ui; else @@ -296,7 +300,7 @@ char *set_filesys_unit (struct uaedev_mount_info *mountinfo, int nr, char *add_filesys_unit (struct uaedev_mount_info *mountinfo, char *devname, char *volname, char *rootdir, int readonly, int secspertrack, int surfaces, int reserved, - int blocksize, int bootpri, char *filesysdir) + int blocksize, int bootpri, char *filesysdir, int flags) { char *retval; int nr = mountinfo->num_units; @@ -307,7 +311,7 @@ char *add_filesys_unit (struct uaedev_mount_info *mountinfo, mountinfo->num_units++; retval = set_filesys_unit_1 (mountinfo, nr, devname, volname, rootdir, readonly, - secspertrack, surfaces, reserved, blocksize, bootpri, filesysdir); + secspertrack, surfaces, reserved, blocksize, bootpri, filesysdir, flags); if (retval) mountinfo->num_units--; return retval; @@ -366,7 +370,7 @@ int sprintf_filesys_unit (struct uaedev_mount_info *mountinfo, char *buffer, int return 0; } -void write_filesys_config (struct uaedev_mount_info *mountinfo, +void write_filesys_config (struct uae_prefs *p, struct uaedev_mount_info *mountinfo, const char *unexpanded, const char *default_path, struct zfile *f) { UnitInfo *uip = mountinfo->ui; @@ -374,7 +378,15 @@ void write_filesys_config (struct uaedev_mount_info *mountinfo, char tmp[MAX_DPATH]; for (i = 0; i < mountinfo->num_units; i++) { + int dosave = 1; char *str; + +#ifdef _WIN32 + if (p->win32_automount_drives && uip[i].automounted) + dosave = 0; +#endif + if (!dosave) + continue; str = cfgfile_subst_path (default_path, unexpanded, uip[i].rootdir); if (uip[i].volname != 0) { sprintf (tmp, "filesystem2=%s,%s:%s:%s,%d\n", uip[i].readonly ? "ro" : "rw", @@ -392,19 +404,10 @@ void write_filesys_config (struct uaedev_mount_info *mountinfo, } } -struct uaedev_mount_info *alloc_mountinfo (void) -{ - struct uaedev_mount_info *info; - info = malloc (sizeof *info); - memset (info, 0, sizeof *info); - info->num_units = 0; - return info; -} - -struct uaedev_mount_info *dup_mountinfo (struct uaedev_mount_info *mip) +static void dup_mountinfo (struct uaedev_mount_info *mip, struct uaedev_mount_info *mip_d) { int i; - struct uaedev_mount_info *i2 = alloc_mountinfo (); + struct uaedev_mount_info *i2 = mip_d; memcpy (i2, mip, sizeof *i2); @@ -419,7 +422,6 @@ struct uaedev_mount_info *dup_mountinfo (struct uaedev_mount_info *mip) if (uip->hf.handle) hdf_dup (&uip->hf, uip->hf.handle); } - return i2; } void free_mountinfo (struct uaedev_mount_info *mip) @@ -429,13 +431,13 @@ void free_mountinfo (struct uaedev_mount_info *mip) return; for (i = 0; i < mip->num_units; i++) close_filesys_unit (mip->ui + i); - xfree (mip); + mip->num_units = 0; } struct hardfiledata *get_hardfile_data (int nr) { - UnitInfo *uip = current_mountinfo->ui; - if (nr < 0 || nr >= current_mountinfo->num_units || uip[nr].volname != 0) + UnitInfo *uip = current_mountinfo.ui; + if (nr < 0 || nr >= current_mountinfo.num_units || uip[nr].volname != 0) return 0; return &uip[nr].hf; } @@ -1324,24 +1326,24 @@ static uae_u32 startup_handler (void) if (s) *s = '\0'; - for (i = 0; i < current_mountinfo->num_units; i++) { + for (i = 0; i < current_mountinfo.num_units; i++) { /* Hardfile volume name? */ - if (current_mountinfo->ui[i].volname == 0) + if (current_mountinfo.ui[i].volname == 0) continue; - if (current_mountinfo->ui[i].startup == arg2) + if (current_mountinfo.ui[i].startup == arg2) break; } - if (i == current_mountinfo->num_units - || !my_existsdir (current_mountinfo->ui[i].rootdir)) + if (i == current_mountinfo.num_units + || !my_existsdir (current_mountinfo.ui[i].rootdir)) { write_log ("Failed attempt to mount device\n", devname); put_long (pkt + dp_Res1, DOS_FALSE); put_long (pkt + dp_Res2, ERROR_DEVICE_NOT_MOUNTED); return 1; } - uinfo = current_mountinfo->ui + i; + uinfo = current_mountinfo.ui + i; unit = startup_create_unit (uinfo); unit->volflags = uinfo->volflags; @@ -3174,7 +3176,7 @@ static uae_sem_t singlethread_int_sem; static uae_u32 exter_int_helper (void) { - UnitInfo *uip = current_mountinfo->ui; + UnitInfo *uip = current_mountinfo.ui; uaecptr port; static int unit_no; @@ -3271,7 +3273,7 @@ static uae_u32 exter_int_helper (void) * Take care not to dereference self for units that didn't have their * startup packet sent. */ for (;;) { - if (unit_no >= current_mountinfo->num_units) + if (unit_no >= current_mountinfo.num_units) return 0; if (uip[unit_no].self != 0 @@ -3468,7 +3470,7 @@ static void init_filesys_diagentry (void) do_put_mem_long ((uae_u32 *)(filesysory + 0x2100), EXPANSION_explibname); do_put_mem_long ((uae_u32 *)(filesysory + 0x2104), filesys_configdev); do_put_mem_long ((uae_u32 *)(filesysory + 0x2108), EXPANSION_doslibname); - do_put_mem_long ((uae_u32 *)(filesysory + 0x210c), current_mountinfo->num_units); + do_put_mem_long ((uae_u32 *)(filesysory + 0x210c), current_mountinfo.num_units); native2amiga_startup(); } @@ -3479,9 +3481,10 @@ void filesys_start_threads (void) if (savestate_state == STATE_RESTORE) init_filesys_diagentry (); - current_mountinfo = currprefs.mountinfo; - uip = current_mountinfo->ui; - for (i = 0; i < current_mountinfo->num_units; i++) { + free_mountinfo (¤t_mountinfo); + dup_mountinfo (&options_mountinfo, ¤t_mountinfo); + uip = current_mountinfo.ui; + for (i = 0; i < current_mountinfo.num_units; i++) { UnitInfo *ui = &uip[i]; ui->unit_pipe = 0; ui->back_pipe = 0; @@ -3491,7 +3494,7 @@ void filesys_start_threads (void) ui->self = 0; } #ifdef UAE_FILESYS_THREADS - if (is_hardfile (current_mountinfo, i) == FILESYS_VIRTUAL) { + if (is_hardfile (¤t_mountinfo, i) == FILESYS_VIRTUAL) { ui->unit_pipe = (smp_comm_pipe *)xmalloc (sizeof (smp_comm_pipe)); ui->back_pipe = (smp_comm_pipe *)xmalloc (sizeof (smp_comm_pipe)); init_comm_pipe (uip[i].unit_pipe, 100, 3); @@ -3506,7 +3509,7 @@ void filesys_start_threads (void) void filesys_cleanup (void) { - current_mountinfo = 0; + free_mountinfo (¤t_mountinfo); } void filesys_reset (void) @@ -3515,7 +3518,7 @@ void filesys_reset (void) /* We get called once from customreset at the beginning of the program * before filesys_start_threads has been called. Survive that. */ - if (current_mountinfo == 0 || savestate_state == STATE_RESTORE) + if (savestate_state == STATE_RESTORE) return; for (u = units; u; u = u1) { @@ -3545,11 +3548,11 @@ void filesys_prepare_reset (void) Unit *u; int i; - if (!current_mountinfo || savestate_state == STATE_RESTORE) + if (savestate_state == STATE_RESTORE) return; - uip = current_mountinfo->ui; + uip = current_mountinfo.ui; #ifdef UAE_FILESYS_THREADS - for (i = 0; i < current_mountinfo->num_units; i++) { + for (i = 0; i < current_mountinfo.num_units; i++) { if (uip[i].unit_pipe != 0) { uae_sem_init (&uip[i].reset_sync_sem, 0, 0); uip[i].reset_state = FS_GO_DOWN; @@ -3650,10 +3653,10 @@ static uae_u32 filesys_dev_bootfilesys (void) uaecptr fsres = get_long (parmpacket + PP_FSRES); uaecptr fsnode; uae_u32 dostype, dostype2; - UnitInfo *uip = current_mountinfo->ui; + UnitInfo *uip = current_mountinfo.ui; int no = m68k_dreg (regs, 6); int unit_no = no & 65535; - int type = is_hardfile (current_mountinfo, unit_no); + int type = is_hardfile (¤t_mountinfo, unit_no); if (type == FILESYS_VIRTUAL) return 0; @@ -3680,7 +3683,7 @@ static uae_u32 filesys_dev_remember (void) int no = m68k_dreg (regs, 6); int unit_no = no & 65535; int sub_no = no >> 16; - UnitInfo *uip = ¤t_mountinfo->ui[unit_no]; + UnitInfo *uip = ¤t_mountinfo.ui[unit_no]; int i; uaecptr devicenode = m68k_areg (regs, 3); uaecptr parmpacket = m68k_areg (regs, 1); @@ -4029,22 +4032,22 @@ static void get_new_device (int type, uaecptr parmpacket, char **devname, uaecpt } *devname_amiga = ds (device_dupfix (get_long (parmpacket + PP_EXPLIB), buffer)); if (type == FILESYS_VIRTUAL) - write_log ("FS: mounted virtual unit %s (%s)\n", buffer, current_mountinfo->ui[unit_no].rootdir); + write_log ("FS: mounted virtual unit %s (%s)\n", buffer, current_mountinfo.ui[unit_no].rootdir); else write_log ("FS: mounted HDF unit %s (%04.4x-%08.8x, %s)\n", buffer, - (uae_u32)(current_mountinfo->ui[unit_no].hf.size >> 32), - (uae_u32)(current_mountinfo->ui[unit_no].hf.size), - current_mountinfo->ui[unit_no].rootdir); + (uae_u32)(current_mountinfo.ui[unit_no].hf.size >> 32), + (uae_u32)(current_mountinfo.ui[unit_no].hf.size), + current_mountinfo.ui[unit_no].rootdir); } /* Fill in per-unit fields of a parampacket */ static uae_u32 filesys_dev_storeinfo (void) { - UnitInfo *uip = current_mountinfo->ui; + UnitInfo *uip = current_mountinfo.ui; int no = m68k_dreg (regs, 6); int unit_no = no & 65535; int sub_no = no >> 16; - int type = is_hardfile (current_mountinfo, unit_no); + int type = is_hardfile (¤t_mountinfo, unit_no); uaecptr parmpacket = m68k_areg (regs, 0); if (type == FILESYS_HARDFILE_RDB || type == FILESYS_HARDDRIVE) { @@ -4434,10 +4437,10 @@ uae_u8 *save_filesys (int num, int *len) { uae_u8 *dstbak, *dst; UnitInfo *ui; - int type = is_hardfile (current_mountinfo, num); + int type = is_hardfile (¤t_mountinfo, num); dstbak = dst = malloc (10000); - ui = ¤t_mountinfo->ui[num]; + ui = ¤t_mountinfo.ui[num]; save_u32 (1); /* version */ save_u32 (ui->devno); save_u16 (type); @@ -4465,7 +4468,7 @@ uae_u8 *restore_filesys (uae_u8 *src) if (restore_u32 () != 1) return src; devno = restore_u32 (); - if (devno >= current_mountinfo->num_units) + if (devno >= current_mountinfo.num_units) return src; type = restore_u16 (); rootdir = restore_string (); @@ -4474,12 +4477,12 @@ uae_u8 *restore_filesys (uae_u8 *src) filesysdir = restore_string (); bootpri = restore_u8 (); readonly = restore_u8 (); - if (set_filesys_unit (current_mountinfo, devno, devname, volname, rootdir, readonly, - 0, 0, 0, 0, bootpri, filesysdir[0] ? filesysdir : NULL)) { + if (set_filesys_unit (¤t_mountinfo, devno, devname, volname, rootdir, readonly, + 0, 0, 0, 0, bootpri, filesysdir[0] ? filesysdir : NULL, 0)) { write_log ("filesys '%s' failed to restore\n", rootdir); goto end; } - ui = ¤t_mountinfo->ui[devno]; + ui = ¤t_mountinfo.ui[devno]; ui->startup = restore_u32 (); filesys_configdev = restore_u32 (); if (type == FILESYS_VIRTUAL) diff --git a/gencpu.c b/gencpu.c index c63707cd..f052168e 100755 --- a/gencpu.c +++ b/gencpu.c @@ -383,7 +383,7 @@ static void sync_m68k_pc (void) /* getv == 1: fetch data; getv != 0: check for odd address. If movem != 0, * the calling routine handles Apdi and Aipi modes. * gb-- movem == 2 means the same thing but for a MOVE16 instruction */ -static void genamode (amodes mode, char *reg, wordsizes size, char *name, int getv, int movem, int flags) +static void genamode2 (amodes mode, char *reg, wordsizes size, char *name, int getv, int movem, int flags, int e3fudge) { char namea[100]; int m68k_pc_offset_last = m68k_pc_offset; @@ -562,10 +562,8 @@ static void genamode (amodes mode, char *reg, wordsizes size, char *name, int ge if ((using_prefetch || using_ce) && using_exception_3 && getv != 0 && size != sz_byte) { printf ("\tif (%sa & 1) {\n", name); - if (using_prefetch || using_ce) - printf ("\t\texception3 (opcode, m68k_getpc() + %d, %sa);\n", m68k_pc_offset + 2, name); - else - printf ("\t\texception3 (opcode, m68k_getpc() + %d, %sa);\n", m68k_pc_offset_last, name); + printf ("\t\texception3 (opcode, m68k_getpc() + %d, %sa);\n", + m68k_pc_offset_last + e3fudge, name); printf ("\t\tgoto %s;\n", endlabelstr); printf ("\t}\n"); need_endlabel = 1; @@ -621,6 +619,17 @@ static void genamode (amodes mode, char *reg, wordsizes size, char *name, int ge } } +static void genamode (amodes mode, char *reg, wordsizes size, char *name, int getv, int movem, int flags) +{ + genamode2 (mode, reg, size, name, getv, movem, flags, 0); +} +/* +static void genamode_e3 (amodes mode, char *reg, wordsizes size, char *name, int getv, int movem, int flags, int e3fudge) +{ + genamode2 (mode, reg, size, name, getv, movem, flags, e3fudge); +} +*/ + static void genastore_2 (char *from, amodes mode, char *reg, wordsizes size, char *to, int store_dir) { switch (mode) { diff --git a/include/akiko.h b/include/akiko.h index 8be20657..ca9d61fa 100755 --- a/include/akiko.h +++ b/include/akiko.h @@ -11,3 +11,5 @@ extern int cd32_enabled; extern void akiko_entergui (void); extern void akiko_exitgui (void); extern void AKIKO_hsync_handler (void); + +extern int cd32_enabled; diff --git a/include/arcadia.h b/include/arcadia.h new file mode 100755 index 00000000..67add0ec --- /dev/null +++ b/include/arcadia.h @@ -0,0 +1,26 @@ + +#ifdef ARCADIA + +extern addrbank arcadia_autoconfig_bank; +extern addrbank arcadia_fast_bank; +extern addrbank arcadia_bios_bank; +extern addrbank arcadia_rom_bank; + +extern void arcadia_init (void); +extern int is_arcadia_rom (char *path); +extern int arcadia_map_banks (void); +extern void arcadia_unmap (void); +extern void arcadia_vsync (void); +extern uae_u8 arcadia_parport (int port, uae_u8 pra, uae_u8 dra); + +struct arcadiarom { + char *name, *bios, *rom; + int bin; + int b7, b6, b5, b4, b3, b2, b1, b0; + uae_u32 boot; +}; + +extern struct arcadiarom *arcadia_rom; +extern int arcadia_flag, arcadia_coin[2]; + +#endif \ No newline at end of file diff --git a/include/autoconf.h b/include/autoconf.h index ab4e21c9..df846319 100755 --- a/include/autoconf.h +++ b/include/autoconf.h @@ -47,23 +47,22 @@ extern int is_hardfile (struct uaedev_mount_info *mountinfo, int unit_no); extern char *set_filesys_unit (struct uaedev_mount_info *mountinfo, int, char *devname, char *volname, char *rootdir, int readonly, int secs, int surfaces, int reserved, - int blocksize, int bootpri, char *filesysdir); + int blocksize, int bootpri, char *filesysdir, int flags); extern char *add_filesys_unit (struct uaedev_mount_info *mountinfo, char *devname, char *volname, char *rootdir, int readonly, int secs, int surfaces, int reserved, - int blocksize, int bootpri, char *filesysdir); + int blocksize, int bootpri, char *filesysdir, int flags); extern char *get_filesys_unit (struct uaedev_mount_info *mountinfo, int nr, char **devname, char **volame, char **rootdir, int *readonly, int *secspertrack, int *surfaces, int *reserved, - int *cylinders, uae_u64 *size, int *blocksize, int *bootpri, char **filesysdir); + int *cylinders, uae_u64 *size, int *blocksize, int *bootpri, char **filesysdir, int *flags); extern int kill_filesys_unit (struct uaedev_mount_info *mountinfo, int); extern int move_filesys_unit (struct uaedev_mount_info *mountinfo, int nr, int to); extern int sprintf_filesys_unit (struct uaedev_mount_info *mountinfo, char *buffer, int num); -extern void write_filesys_config (struct uaedev_mount_info *mountinfo, const char *unexpanded, +extern void write_filesys_config (struct uae_prefs *p, struct uaedev_mount_info *mountinfo, const char *unexpanded, const char *defaultpath, struct zfile *f); -extern struct uaedev_mount_info *alloc_mountinfo (void); -extern struct uaedev_mount_info *dup_mountinfo (struct uaedev_mount_info *); +extern void dup_mountinfo (struct uaedev_mount_info *, struct uaedev_mount_info *); extern void free_mountinfo (struct uaedev_mount_info *); extern void filesys_reset (void); diff --git a/include/filesys.h b/include/filesys.h index 7aee9c57..92026273 100755 --- a/include/filesys.h +++ b/include/filesys.h @@ -37,9 +37,12 @@ struct hardfiledata { #define FILESYS_HARDFILE_RDB 2 #define FILESYS_HARDDRIVE 3 +#define FILESYS_FLAG_DONOTSAVE 1 + #define MAX_FILESYSTEM_UNITS 30 struct uaedev_mount_info; +extern struct uaedev_mount_info options_mountinfo; extern struct hardfiledata *get_hardfile_data (int nr); #define FILESYS_MAX_BLOCKSIZE 2048 diff --git a/include/inputdevice.h b/include/inputdevice.h index d9766c41..8e4ab38c 100755 --- a/include/inputdevice.h +++ b/include/inputdevice.h @@ -134,7 +134,7 @@ extern void indicator_leds (int num, int state); extern void warpmode (int mode); extern void pausemode (int mode); -extern void inputdevice_add_inputcode (int code); +extern void inputdevice_add_inputcode (int code, int state); extern void inputdevice_handle_inputcode (void); #define JSEM_KBDLAYOUT 0 diff --git a/include/keyboard.h b/include/keyboard.h index c5c19ea2..c09676c3 100755 --- a/include/keyboard.h +++ b/include/keyboard.h @@ -148,5 +148,6 @@ enum aks { AKS_ENTERGUI = 0x200, AKS_SCREENSHOT, AKS_FREEZEBUTTON, AKS_STATESAVEQUICK9, AKS_STATERESTOREQUICK9, AKS_STATESAVEDIALOG, AKS_STATERESTOREDIALOG, AKS_DECREASEREFRESHRATE, - AKS_INCREASEREFRESHRATE + AKS_INCREASEREFRESHRATE, + AKS_ARCADIADIAGNOSTICS, AKS_ARCADIAPLY1, AKS_ARCADIAPLY2, AKS_ARCADIACOIN1, AKS_ARCADIACOIN2 }; diff --git a/include/memory.h b/include/memory.h index a244ce83..0c1cb86a 100755 --- a/include/memory.h +++ b/include/memory.h @@ -242,6 +242,7 @@ extern void decode_cloanto_rom_do (uae_u8 *mem, int size, int real_size, uae_u8 #define ROMTYPE_EXTCDTV 8 #define ROMTYPE_AR 16 #define ROMTYPE_KEY 32 +#define ROMTYPE_ARCADIA 64 struct romdata { char *name; @@ -258,6 +259,7 @@ extern struct romdata *getromdatabycrc (uae_u32 crc32); extern struct romdata *getromdatabydata (uae_u8 *rom, int size); extern struct romdata *getromdatabyid (int id); extern struct romdata *getromdatabyzfile (struct zfile *f); +extern struct romdata *getarcadiarombyname (char *name); extern void getromname (struct romdata*, char*); extern struct romdata *getromdatabyname (char*); extern void romlist_add (char *path, struct romdata *rd); diff --git a/include/options.h b/include/options.h index d5a280ca..96143c53 100755 --- a/include/options.h +++ b/include/options.h @@ -7,9 +7,9 @@ * Copyright 1995-2001 Bernd Schmidt */ -#define UAEMAJOR 0 -#define UAEMINOR 9 -#define UAESUBREV 92 +#define UAEMAJOR 1 +#define UAEMINOR 0 +#define UAESUBREV 0 typedef enum { KBD_LANG_US, KBD_LANG_DK, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT, KBD_LANG_ES } KbdLang; diff --git a/inputdevice.c b/inputdevice.c index 26f93682..a828129d 100755 --- a/inputdevice.c +++ b/inputdevice.c @@ -41,6 +41,7 @@ #include "disk.h" #include "sound.h" #include "savestate.h" +#include "arcadia.h" #define DIR_LEFT 1 #define DIR_RIGHT 2 @@ -822,7 +823,6 @@ int getjoystate (int joy) v &= ~0x0303; v |= bot | (right << 1) | (top << 8) | (left << 9); } -// write_log ("%d:%d:%04.4X %p\n",vpos,joy,v,m68k_getpc()); #ifdef DONGLE_DEBUG if (notinrom ()) write_log ("JOY%dDAT %04.4X %s\n", joy, v, debuginfo (0)); @@ -869,6 +869,8 @@ static uae_u8 parconvert (uae_u8 v, int jd, int shift) return v; } + + /* io-pins floating: dir=1 -> return data, dir=0 -> always return 1 */ uae_u8 handle_parport_joystick (int port, uae_u8 pra, uae_u8 dra) { @@ -1145,11 +1147,12 @@ static void queue_input_event (int event, int state, int max, int framecnt, int } static uae_u8 keybuf[256]; -static int inputcode_pending; +static int inputcode_pending, inputcode_pending_state; -void inputdevice_add_inputcode (int code) +void inputdevice_add_inputcode (int code, int state) { inputcode_pending = code; + inputcode_pending_state = state; } void inputdevice_do_keyboard (int code, int state) @@ -1166,19 +1169,47 @@ void inputdevice_do_keyboard (int code, int state) //write_log("Amiga key %02.2X %d\n", key & 0x7f, key >> 7); return; } - if (state == 0) - return; - inputdevice_add_inputcode (code); + inputdevice_add_inputcode (code, state); } void inputdevice_handle_inputcode (void) { int code = inputcode_pending; + int state = inputcode_pending_state; inputcode_pending = 0; if (code == 0) return; if (vpos != 0) write_log ("inputcode=%d but vpos = %d", code, vpos); + +#ifdef ARCADIA + switch (code) + { + case AKS_ARCADIADIAGNOSTICS: + arcadia_flag &= ~1; + arcadia_flag |= state ? 1 : 0; + break; + case AKS_ARCADIAPLY1: + arcadia_flag &= ~4; + arcadia_flag |= state ? 4 : 0; + break; + case AKS_ARCADIAPLY2: + arcadia_flag &= ~2; + arcadia_flag |= state ? 2 : 0; + break; + case AKS_ARCADIACOIN1: + if (state) + arcadia_coin[0]++; + break; + case AKS_ARCADIACOIN2: + if (state) + arcadia_coin[1]++; + break; + } +#endif + + if (!state) + return; switch (code) { case AKS_ENTERGUI: @@ -1440,6 +1471,10 @@ void inputdevice_vsync (void) inputdevice_handle_inputcode (); if (ievent_alive > 0) ievent_alive--; +#ifdef ARCADIA + if (arcadia_rom) + arcadia_vsync (); +#endif } void inputdevice_reset (void) diff --git a/inputevents.def b/inputevents.def index 98841b05..21e13c68 100755 --- a/inputevents.def +++ b/inputevents.def @@ -279,3 +279,8 @@ DEFEVENT(SPC_TOGGLEFULLSCREEN,"Toggle windowed/fullscreen",AM_K,0,0,AKS_TOGGLEFU DEFEVENT(SPC_DECREASE_REFRESHRATE,"Decrease emulation speed",AM_K,0,0,AKS_DECREASEREFRESHRATE) DEFEVENT(SPC_INCREASE_REFRESHRARE,"Increase emulation speed",AM_K,0,0,AKS_INCREASEREFRESHRATE) +DEFEVENT(SPC_ARCADIA_DIAGNOSTICS,"Arcadia diagnostics dip switch",AM_K,0,0,AKS_ARCADIADIAGNOSTICS) +DEFEVENT(SPC_ARCADIA_PLAYER1,"Arcadia player 1",AM_K,0,0,AKS_ARCADIAPLY1) +DEFEVENT(SPC_ARCADIA_PLAYER2,"Arcadia player 2",AM_K,0,0,AKS_ARCADIAPLY2) +DEFEVENT(SPC_ARCADIA_COIN1,"Arcadia coin player 1",AM_K,0,0,AKS_ARCADIACOIN1) +DEFEVENT(SPC_ARCADIA_COIN2,"Arcadia coin player 2",AM_K,0,0,AKS_ARCADIACOIN2) diff --git a/main.c b/main.c index 07538192..1b01ca29 100755 --- a/main.c +++ b/main.c @@ -39,6 +39,7 @@ #include "scsidev.h" #include "akiko.h" #include "savestate.h" +#include "filesys.h" #ifdef USE_SDL #include "SDL.h" @@ -91,7 +92,6 @@ void discard_prefs (struct uae_prefs *p, int type) #ifdef FILESYS filesys_cleanup (); free_mountinfo (p->mountinfo); - p->mountinfo = alloc_mountinfo (); #endif } @@ -405,7 +405,6 @@ static void parse_cmdline (int argc, char **argv) } else { #ifdef FILESYS free_mountinfo (currprefs.mountinfo); - currprefs.mountinfo = alloc_mountinfo (); #endif target_cfgfile_load (&currprefs, argv[++i], -1, 1); } @@ -558,7 +557,6 @@ static void real_main2 (int argc, char **argv) if (restart_config[0]) { #ifdef FILESYS free_mountinfo (currprefs.mountinfo); - currprefs.mountinfo = alloc_mountinfo (); #endif default_prefs (&currprefs, 0); fixup_prefs (&currprefs); @@ -599,9 +597,7 @@ static void real_main2 (int argc, char **argv) restart_program = 0; if (! no_gui) { int err = gui_init (); - struct uaedev_mount_info *mi = currprefs.mountinfo; currprefs = changed_prefs; - currprefs.mountinfo = mi; if (err == -1) { write_log ("Failed to initialize the GUI\n"); } else if (err == -2) { @@ -687,6 +683,8 @@ static void real_main2 (int argc, char **argv) void real_main (int argc, char **argv) { + free_mountinfo (&options_mountinfo); + currprefs.mountinfo = changed_prefs.mountinfo = &options_mountinfo; restart_program = 1; fetch_configurationpath (restart_config, sizeof (restart_config)); strcat (restart_config, OPTIONSFILENAME); diff --git a/memory.c b/memory.c index 9ca36e1b..65e5c111 100755 --- a/memory.c +++ b/memory.c @@ -24,6 +24,8 @@ #include "crc32.h" #include "gui.h" #include "cdtv.h" +#include "akiko.h" +#include "arcadia.h" #include "enforcer.h" #ifdef JIT @@ -35,10 +37,6 @@ int special_mem; int ersatzkickfile; -#ifdef CD32 -extern int cd32_enabled; -#endif - uae_u32 allocated_chipmem; uae_u32 allocated_fastmem; uae_u32 allocated_bogomem; @@ -130,9 +128,40 @@ static struct romdata roms[] = { { "Action Replay Mk II v2.14", 0, 0, 0x49650e4f, 131072, 28, 0, 0, ROMTYPE_AR }, { "Action Replay Mk III v3.09", 0, 0, 0x0ed9b5aa, 262144, 29, 0, 0, ROMTYPE_AR }, { "Action Replay Mk III v3.17", 0, 0, 0xc8a16406, 262144, 30, 0, 0, ROMTYPE_AR }, + + { "SportTime Table Hockey\0ar_airh", 0, 0, 0, 0, 33, 0, 0, ROMTYPE_ARCADIA }, + { "SportTime Bowling\0ar_bowl", 0, 0, 0, 0, 34, 0, 0, ROMTYPE_ARCADIA }, + { "World Darts\0ar_dart", 0, 0, 0, 0, 35, 0, 0, ROMTYPE_ARCADIA }, + { "Magic Johnson's Fast Break\0ar_fast", 0, 0, 0, 0, 36, 0, 0, ROMTYPE_ARCADIA }, + { "Leader Board Golf\0ar_ldrb", 0, 0, 0, 0, 37, 0, 0, ROMTYPE_ARCADIA }, + { "Leader Board Golf (alt)\0ar_ldrba", 0, 0, 0, 0, 38, 0, 0, ROMTYPE_ARCADIA }, + { "Ninja Mission\0ar_ninj", 0, 0, 0, 0, 39, 0, 0, ROMTYPE_ARCADIA }, + { "Road Wars\0ar_rdwr", 0, 0, 0, 0, 40, 0, 0, ROMTYPE_ARCADIA }, + { "Sidewinder\0ar_sdwr", 0, 0, 0, 0, 41, 0, 0, ROMTYPE_ARCADIA }, + { "Cool Spot\0ar_spot", 0, 0, 0, 0, 42, 0, 0, ROMTYPE_ARCADIA }, + { "Space Ranger\0ar_sprg", 0, 0, 0, 0, 43, 0, 0, ROMTYPE_ARCADIA }, + { "Xenon\0ar_xeon", 0, 0, 0, 0, 44, 0, 0, ROMTYPE_ARCADIA }, + { 0 } }; +struct romdata *getarcadiarombyname (char *name) +{ + int i; + for (i = 0; roms[i].name; i++) { + if (roms[i].type == ROMTYPE_ARCADIA) { + char *p = roms[i].name; + p = p + strlen (p) + 1; + if (strlen (name) >= strlen (p) + 4) { + char *p2 = name + strlen (name) - strlen (p) - 4; + if (!memcmp (p, p2, strlen (p)) && !memcmp (p2 + strlen (p2) - 4, ".zip", 4)) + return &roms[i]; + } + } + } + return NULL; +} + void decode_cloanto_rom_do (uae_u8 *mem, int size, int real_size, uae_u8 *key, int keysize) { long cnt, t; @@ -306,10 +335,14 @@ struct romdata *getromdatabyzfile (struct zfile *f) void getromname (struct romdata *rd, char *name) { - strcpy (name, rd->name); + name[0] = 0; + if (rd->type == ROMTYPE_ARCADIA) + strcat (name, "Arcadia "); + strcat (name, rd->name); if (rd->revision) sprintf (name + strlen (name), " rev %d.%d", rd->version, rd->revision); - sprintf (name + strlen (name), " (%dk)", (rd->size + 1023) / 1024); + if (rd->size > 0) + sprintf (name + strlen (name), " (%dk)", (rd->size + 1023) / 1024); } addrbank *mem_banks[MEMORY_BANKS]; @@ -1847,7 +1880,21 @@ void memory_reset (void) map_banks (&kickmem_bank, 0xE0, 8, 0); } +#ifdef ARCADIA + is_arcadia_rom (currprefs.cartfile); + if (arcadia_rom) { + if (strcmp (currprefs.cartfile, changed_prefs.cartfile) != 0) { + memcpy (currprefs.cartfile, changed_prefs.cartfile, sizeof currprefs.cartfile); + arcadia_unmap (); + } + arcadia_map_banks (); + } +#endif + #ifdef ACTION_REPLAY +#ifdef ARCADIA + if (!arcadia_rom) { +#endif action_replay_memory_reset(); #ifdef ACTION_REPLAY_HRTMON hrtmon_map_banks(); @@ -1858,6 +1905,9 @@ void memory_reset (void) action_replay_map_banks(); #endif #endif +#ifdef ARCADIA + } +#endif #endif } @@ -1922,6 +1972,9 @@ void memory_cleanup (void) #ifdef ACTION_REPLAY action_replay_cleanup(); #endif + #ifdef ARCADIA + arcadia_unmap (); + #endif } void map_banks (addrbank *bank, int start, int size, int realsize) diff --git a/od-win32/bsdsock.c b/od-win32/bsdsock.c index 196920c2..9e337c06 100755 --- a/od-win32/bsdsock.c +++ b/od-win32/bsdsock.c @@ -2076,10 +2076,12 @@ static unsigned int __stdcall thread_get(void *index2) for (;;) { WaitForSingleObject(hGetEvents[index],INFINITE); - - if ((args = threadGetargs[index]) != NULL) + if (threadGetargs[index] == -1) + { + threadGetargs[index] = NULL; + } + if ((args = threadGetargs[index]) != NULL ) { - sb = (struct socketbase *)*args; if (args[1] == 0) { // gethostbyname or gethostbyaddr @@ -2256,7 +2258,14 @@ void host_gethostbynameaddr(SB, uae_u32 name, uae_u32 namelen, long addrtype) args[4] = addrtype; args[5] = (uae_u32) &buf[0]; - for (i = 0; i < MAX_GET_THREADS; i++) if (hGetThreads[i] && !threadGetargs[i]) break; + for (i = 0; i < MAX_GET_THREADS; i++) + { + if (threadGetargs[i] == -1) + { + threadGetargs[i] = 0; + } + if (hGetThreads[i] && !threadGetargs[i]) break; + } if (i >= MAX_GET_THREADS) { @@ -2376,8 +2385,14 @@ void host_getprotobyname(SB, uae_u32 name) args[2] = name; args[5] = (uae_u32) &buf[0]; - for (i = 0; i < MAX_GET_THREADS; i++) if (hGetThreads[i] && !threadGetargs[i]) break; - + for (i = 0; i < MAX_GET_THREADS; i++) + { + if (threadGetargs[i] == -1) + { + threadGetargs[i] = 0; + } + if (hGetThreads[i] && !threadGetargs[i]) break; + } if (i >= MAX_GET_THREADS) { for (i = 0; i < MAX_GET_THREADS; i++) @@ -2496,8 +2511,14 @@ void host_getservbynameport(SB, uae_u32 nameport, uae_u32 proto, uae_u32 type) args[4] = type; args[5] = (uae_u32) &buf[0]; - for (i = 0; i < MAX_GET_THREADS; i++) if (hGetThreads[i] && !threadGetargs[i]) break; - + for (i = 0; i < MAX_GET_THREADS; i++) + { + if (threadGetargs[i] == -1) + { + threadGetargs[i] = 0; + } + if (hGetThreads[i] && !threadGetargs[i]) break; + } if (i >= MAX_GET_THREADS) { for (i = 0; i < MAX_GET_THREADS; i++) diff --git a/od-win32/caps/caps_win32.c b/od-win32/caps/caps_win32.c index 6b7aaafd..9b170c60 100755 --- a/od-win32/caps/caps_win32.c +++ b/od-win32/caps/caps_win32.c @@ -198,8 +198,8 @@ int caps_loadtrack (uae_u16 *mfmbuf, uae_u16 *tracktiming, int drv, int track, i tracktiming[i] = (uae_u16)ci.timebuf[i]; } #if 0 - write_log ("caps: drive:%d track:%d len:%d flakey:%d multi:%d timing:%d type:%d\n", - drv, track, len, *multirev, ci.trackcnt, ci.timelen, type); + write_log ("caps: drive:%d track:%d len:%d multi:%d timing:%d type:%d overlap:%d\n", + drv, track, len, *multirev, ci.timelen, type, ci.overlap); #endif return 1; } diff --git a/od-win32/dxwrap.c b/od-win32/dxwrap.c index 96ffc264..fbe763cd 100755 --- a/od-win32/dxwrap.c +++ b/od-win32/dxwrap.c @@ -2022,11 +2022,11 @@ HRESULT DirectDraw_GetDC( HDC *hdc, surface_type_e surface ) { HRESULT result = ~DD_OK; if( surface == primary_surface ) - result = IDirectDrawSurface7_GetDC( DirectDrawState.primary.surface, hdc ); + result = IDirectDrawSurface7_GetDC (DirectDrawState.primary.surface, hdc); else if (surface == overlay_surface) - result = IDirectDrawSurface7_GetDC( DirectDrawState.overlay.surface, hdc ); + result = IDirectDrawSurface7_GetDC (DirectDrawState.overlay.surface, hdc); else if (surface == secondary_surface) - result = IDirectDrawSurface7_GetDC( DirectDrawState.secondary.surface, hdc ); + result = IDirectDrawSurface7_GetDC (DirectDrawState.secondary.surface, hdc); return result; } diff --git a/od-win32/keyboard_win32.c b/od-win32/keyboard_win32.c index a5cfdd7b..54d71536 100755 --- a/od-win32/keyboard_win32.c +++ b/od-win32/keyboard_win32.c @@ -38,6 +38,8 @@ #include "ahidsound.h" #include "savestate.h" #include "sound.h" +#include "akiko.h" +#include "arcadia.h" extern void screenshot(int); @@ -53,6 +55,7 @@ static struct uae_input_device_kbr_default keytrans[] = { { DIK_F3, INPUTEVENT_KEY_F3 }, { DIK_F4, INPUTEVENT_KEY_F4 }, { DIK_F5, INPUTEVENT_KEY_F5 }, + { DIK_F6, INPUTEVENT_KEY_F6 }, { DIK_F7, INPUTEVENT_KEY_F7 }, { DIK_F8, INPUTEVENT_KEY_F8 }, @@ -210,8 +213,40 @@ int getcapslock (void) return capslockstate; } +#ifdef ARCADIA + +static int handlearcadia (int scancode, int state) +{ + int e = 0; + if (!arcadia_rom) + return 0; + switch (scancode) + { + case DIK_F2: + e = INPUTEVENT_SPC_ARCADIA_DIAGNOSTICS; + break; + case DIK_1: + e = INPUTEVENT_SPC_ARCADIA_PLAYER1; + break; + case DIK_2: + e = INPUTEVENT_SPC_ARCADIA_PLAYER2; + break; + case DIK_5: + e = INPUTEVENT_SPC_ARCADIA_COIN1; + break; + case DIK_6: + e = INPUTEVENT_SPC_ARCADIA_COIN2; + break; + } + if (!e) + return 0; + handle_input_event (e, state, 1, 0); + return 1; +} + +#endif + #ifdef CD32 -extern int cd32_enabled; static int handlecd32 (int scancode, int state) { @@ -400,7 +435,7 @@ void my_kbd_handler (int keyboard, int scancode, int newstate) } } if (code) { - inputdevice_add_inputcode (code); + inputdevice_add_inputcode (code, 1); return; } if (endpressed ()) @@ -417,6 +452,10 @@ void my_kbd_handler (int keyboard, int scancode, int newstate) #ifdef CD32 if (handlecd32 (scancode, newstate)) return; +#endif +#ifdef ARCADIA + if (handlearcadia (scancode, newstate)) + return; #endif } inputdevice_translatekeycode (keyboard, scancode, newstate); diff --git a/od-win32/picasso96_win.c b/od-win32/picasso96_win.c index d7cec734..4c001958 100755 --- a/od-win32/picasso96_win.c +++ b/od-win32/picasso96_win.c @@ -2235,7 +2235,8 @@ STATIC_INLINE int BlitRectHelper( void ) * If we have a destination RenderInfo, then we've been called from picasso_BlitRectNoMaskComplete() * and we need to put the results on the screen from the frame-buffer. */ - if (dstri == NULL) + //if (dstri == NULL) + if (dstri->Memory == ri->Memory) { if( mask != 0xFF && Bpp > 1 ) { @@ -2652,8 +2653,8 @@ uae_u32 picasso_BlitTemplate (void) uae_u8 *tmpl_base; uae_u32 result = 0; - if (W * H <= 2500) - return 0; +// if (W * H <= 2500) +// return 0; special_mem|=picasso_is_special_read|picasso_is_special; #ifdef LOCK_UNLOCK_MADNESS diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index 7ab0f037..5f1192a5 100755 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -251,6 +251,7 @@ #define IDS_QS_MODEL_CD32 1006 #define IDS_QS_MODEL_CDTV 1007 #define IDS_QS_MODEL_UAE 1008 +#define IDS_QS_MODEL_ARCADIA 1009 #define IDC_RESOLUTION 1021 #define IDC_SERIAL 1022 #define IDC_REFRESHRATE 1022 @@ -623,7 +624,6 @@ #define IDC_MAPROM 1609 #define IDC_AVIOUTPUT_FILETEXT 1610 #define IDC_INPUTDEVICETEXT 1610 -#define IDC_NOTASKBARBUTTON2 1610 #define IDC_ALWAYSONTOP 1610 #define IDC_AVIOUTPUT_FILE 1611 #define IDC_INPUTLIST 1611 @@ -729,6 +729,8 @@ #define IDC_SOUNDCARD 1650 #define IDC_CS_SOUND0 1650 #define IDC_UPBM 1650 +#define IDC_DISKLISTREMOVE2 1650 +#define IDC_DISKLISTINSERT 1650 #define IDC_SOUNDCARDLIST 1651 #define IDC_CS_SOUND1 1651 #define IDC_SOUNDFREQ 1652 @@ -800,6 +802,7 @@ #define IDC_HF_TYPE 1696 #define IDC_PRINTERAUTOFLUSH 1697 #define IDC_PRINTERAUTOFLUSHTXT 1698 +#define IDC_DISKTEXT 1699 #define ID__FLOPPYDRIVES 40004 #define ID_FLOPPYDRIVES_DF0 40005 #define ID_ST_CONFIGURATION 40010 @@ -820,7 +823,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 247 #define _APS_NEXT_COMMAND_VALUE 40021 -#define _APS_NEXT_CONTROL_VALUE 1699 +#define _APS_NEXT_CONTROL_VALUE 1700 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 725ca54c..3bdb1820 100755 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -525,31 +525,31 @@ BEGIN 80,15 END -IDD_MISC1 DIALOGEX 0, 0, 300, 223 +IDD_MISC1 DIALOGEX 0, 0, 300, 219 STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN GROUPBOX "Advanced:",IDC_STATIC,8,4,285,103 CONTROL "Middle-Mouse-Button --> ALT-TAB",IDC_JULIAN,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,29,21,120,10 + BS_AUTOCHECKBOX | WS_TABSTOP,29,19,120,10 CONTROL "Show GUI on startup",IDC_SHOWGUI,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,29,36,120,10 + BS_AUTOCHECKBOX | WS_TABSTOP,29,34,120,10 CONTROL "On-Screen LEDs",IDC_SHOWLEDS,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,29,51,115,10 + WS_TABSTOP,29,49,115,10 CONTROL "UAEscsi.device",IDC_SCSIDEVICE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,29,66,117,10 + WS_TABSTOP,29,64,117,10 CONTROL "Don't show Taskbar button",IDC_NOTASKBARBUTTON,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,29,80,117,10 + BS_AUTOCHECKBOX | WS_TABSTOP,29,78,117,10 CONTROL "BSDsocket.library emulation",IDC_SOCKETS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,159,21,120,10 + BS_AUTOCHECKBOX | WS_TABSTOP,159,19,120,10 CONTROL "Use CTRL-F11 to quit",IDC_CTRLF11,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,159,36,120,10 + BS_AUTOCHECKBOX | WS_TABSTOP,159,34,120,10 CONTROL "Don't use RGB overlays",IDC_NOOVERLAY,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,159,51,120,10 + BS_AUTOCHECKBOX | WS_TABSTOP,159,49,120,10 CONTROL "Use ASPI SCSI layer",IDC_ASPI,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,159,66,115,10 + WS_TABSTOP,159,64,115,10 CONTROL "Syncronize clock",IDC_CLOCKSYNC,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,159,80,115,10 + BS_AUTOCHECKBOX | WS_TABSTOP,159,78,115,10 GROUPBOX "Keyboard LEDs:",IDC_STATIC,7,110,85,73 COMBOBOX IDC_KBLED1,22,123,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP @@ -563,7 +563,7 @@ BEGIN HIDC_CREATELOGFILE CONTROL "Illegal mem accesses",IDC_ILLEGAL,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,189,120,80,10 - GROUPBOX "State files:",IDC_STATIC,98,137,195,83 + GROUPBOX "State files:",IDC_STATIC,98,137,195,78 PUSHBUTTON "Load state...",IDC_DOLOADSTATE,105,156,49,14 PUSHBUTTON "Save state...",IDC_DOSAVESTATE,106,182,49,14 CONTROL "Enable state recording",IDC_STATE_CAPTURE,"Button", @@ -577,7 +577,7 @@ BEGIN COMBOBOX IDC_STATE_BUFFERSIZE,248,191,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP CONTROL "Always on top",IDC_ALWAYSONTOP,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,29,94,117,10 + WS_TABSTOP,29,92,117,10 END IDD_HARDFILE DIALOGEX 0, 0, 299, 212 @@ -873,8 +873,11 @@ FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN CONTROL "",IDC_DISKLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | - LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,4,6,292,211 - PUSHBUTTON "Remove disk image",IDC_DISKLISTREMOVE,98,223,93,15 + LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,4,6,292,196 + PUSHBUTTON "Remove disk image",IDC_DISKLISTREMOVE,153,223,93,15 + COMBOBOX IDC_DISKTEXT,3,205,293,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | + WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Insert disk image",IDC_DISKLISTINSERT,38,223,93,15 END IDD_PANEL DIALOGEX 0, 0, 420, 278 @@ -1041,8 +1044,8 @@ IDI_PATHS ICON "paths.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,9,92,0 - PRODUCTVERSION 0,9,92,0 + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -1058,12 +1061,12 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "WinUAE" - VALUE "FileVersion", "0.9.92" + VALUE "FileVersion", "1.0.0" VALUE "InternalName", "WinUAE" - VALUE "LegalCopyright", "© 1996-2004 under the GNU Public License (GPL)" + VALUE "LegalCopyright", "© 1996-2005 under the GNU Public License (GPL)" VALUE "OriginalFilename", "WinUAE.exe" VALUE "ProductName", "WinUAE" - VALUE "ProductVersion", "0.9.92" + VALUE "ProductVersion", "1.0.0" END END BLOCK "VarFileInfo" @@ -1435,7 +1438,7 @@ END STRINGTABLE BEGIN - IDS_QS_MODELS "Amiga 500 / Amiga 2000\nAmiga 500+\nAmiga 600\nAmiga 1000\nAmiga 1200\nCD32\nCDTV (CDROM emulation not yet working)\nExpanded UAE example configuration" + IDS_QS_MODELS "Amiga 500 / Amiga 2000\nAmiga 500+\nAmiga 600\nAmiga 1000\nAmiga 1200\nCD32\nCDTV (CDROM emulation not yet working)\nArcadia Multi Select system\nExpanded UAE example configuration" IDS_QS_MODEL_A500 "KS 1.3, OCS Agnus, 0.5M Chip + 0.5M Slow (most common)\nThis configuration is capable of running most games and demos ever produced for the first Amiga line. Only few exceptions need different configuration. Oldest Amiga games tend to be incompatible with this configuration.\nKS 1.3, ECS Agnus, 0.5M Chip + 0.5M Slow\nLater hardware revision of Amiga 500. Nearly 100% compatible with previous configuration.\nKS 1.3, ECS Agnus, 1.0M Chip\nFew newer games and demos require this configuration.\nKS 1.3, OCS Agnus, 0.5M Chip\nVery old (~1987 and older) games and demos may require this configuration.\nKS 1.2, OCS Agnus, 0.5M Chip\nThe first Amiga 500 produced had this configuration. Some very old programs only work correctly with this configuration. NOTE: This configuration cannot boot the Amiga OS installed on an emulated HD.\nKS 1.2, OCS Agnus, 0.5M Chip + 0.5M Slow\nThis configuration adds expansion memory to the first Amiga 500 ever produced. Try this if your game do not work with newer configurations but works with the previous one. It could add some features to the game and faster game loading. NOTE: This configuration cannot boot the Amiga OS installed on an emulated HD." IDS_QS_MODEL_A500P "Basic non-expanded configuration\nA500+ is basically an Amiga 500 with ECS Agnus, 1MB of Chip RAM and Kickstart 2.0 ROM. Many Amiga 500 games and demos won't work properly on an Amiga 500+.\n2M Chip RAM expanded configuration\n\n4M Fast RAM expanded configuration\n" IDS_QS_MODEL_A600 "Basic non-expanded configuration\nA600 is basically smaller Amiga 500+ with updated Kickstart 2.0 ROM.\n2M Chip RAM expanded configuration\n\n4M Fast RAM expanded configuration\n" @@ -1448,6 +1451,7 @@ END STRINGTABLE BEGIN IDS_QS_MODEL_UAE "High-end expanded configuration" + IDS_QS_MODEL_ARCADIA "Arcadia\nArcadia Multi Select system is arcade platform developed by Arcadia and Mastertronic. It is based on an Amiga 500 mainboard with ROM cage attached to expansion port. Arcadia ROM files go to ""Cartridge ROM File"" in ROM-panel." END #endif // English (U.S.) resources diff --git a/od-win32/sysconfig.h b/od-win32/sysconfig.h index 8669dff0..9d06418c 100755 --- a/od-win32/sysconfig.h +++ b/od-win32/sysconfig.h @@ -44,6 +44,7 @@ #define FDI2RAW /* FDI 1.0 and 2.0 image support */ #define AVIOUTPUT /* Avioutput support */ #define PROWIZARD /* Pro-Wizard module ripper */ +#define ARCADIA /* Arcadia arcade system */ #else diff --git a/od-win32/win32.c b/od-win32/win32.c index 7e4190a8..5341f564 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -2171,8 +2171,10 @@ __asm{ #ifdef _DEBUG { int tmp = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); + //tmp &= 0xffff; tmp |= _CRTDBG_CHECK_ALWAYS_DF; tmp |= _CRTDBG_CHECK_CRT_DF; + //tmp |=_CRTDBG_CHECK_EVERY_16_DF; //tmp |= _CRTDBG_DELAY_FREE_MEM_DF; _CrtSetDbgFlag(tmp); } diff --git a/od-win32/win32.h b/od-win32/win32.h index 0f90c9fc..a004f9ae 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -21,8 +21,8 @@ extern int manual_painting_needed; extern int manual_palette_refresh_needed; extern int mouseactive, focus; extern int ignore_messages_all; -#define WINUAEBETA 0 -#define WINUAEBETASTR "" +#define WINUAEBETA 1 +#define WINUAEBETASTR " Beta 1" extern void my_kbd_handler (int, int, int); extern void clearallkeys(void); diff --git a/od-win32/win32_filesys.c b/od-win32/win32_filesys.c index c1b1a7a9..46fc90e0 100755 --- a/od-win32/win32_filesys.c +++ b/od-win32/win32_filesys.c @@ -123,7 +123,7 @@ void filesys_init( void ) else strcat( volumepath, ".." ); - result = add_filesys_unit (currprefs.mountinfo, 0, volumename, volumepath, 0, 0, 0, 0, 0, 0, 0); + result = add_filesys_unit (currprefs.mountinfo, 0, volumename, volumepath, 0, 0, 0, 0, 0, 0, 0, FILESYS_FLAG_DONOTSAVE); if( result ) write_log ("%s\n", result); } diff --git a/od-win32/win32gfx.c b/od-win32/win32gfx.c index f4785daa..e61eccae 100755 --- a/od-win32/win32gfx.c +++ b/od-win32/win32gfx.c @@ -1595,7 +1595,7 @@ int graphics_init (void) int graphics_setup (void) { - if( !DirectDraw_Start (NULL) ) + if (!DirectDraw_Start (NULL)) return 0; DirectDraw_Release(); #ifdef PICASSO96 diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index e1e4a9c3..8bdd57d7 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -130,7 +130,6 @@ void exit_gui (int ok) return; if (guiDlg == NULL) return; - write_log ("exit_gui %d\n", ok); SendMessage (guiDlg, WM_COMMAND, ok ? IDOK : IDCANCEL, 0); } @@ -346,14 +345,18 @@ static struct romdata *scan_single_rom (char *path, uae_u8 *keybuf, int keysize) return scan_single_rom_2 (z, keybuf, keysize); } +static void addrom (HKEY fkey, struct romdata *rd, char *name) +{ + char tmp[MAX_DPATH]; + sprintf (tmp, "ROM%02d", rd->id); + RegSetValueEx (fkey, tmp, 0, REG_SZ, (CONST BYTE *)name, strlen (name) + 1); +} + static int scan_rom_2 (struct zfile *f, struct romscandata *rsd) { struct romdata *rd = scan_single_rom_2 (f, rsd->keybuf, rsd->keysize); if (rd) { - char tmp[MAX_DPATH]; - char *name = zfile_getname (f); - sprintf (tmp, "ROM%02d", rd->id); - RegSetValueEx (rsd->fkey, tmp, 0, REG_SZ, (CONST BYTE *)name, strlen (name) + 1); + addrom (rsd->fkey, rd, zfile_getname (f)); rsd->got = 1; } return 1; @@ -362,6 +365,14 @@ static int scan_rom_2 (struct zfile *f, struct romscandata *rsd) static int scan_rom (char *path, HKEY fkey, uae_u8 *keybuf, int keysize) { struct romscandata rsd = { keybuf, keysize, fkey, 0 }; + struct romdata *rd; + + rd = getarcadiarombyname (path); + if (rd) { + addrom (fkey, rd, path); + return 1; + } + zfile_zopen (path, scan_rom_2, &rsd); return rsd.got; } @@ -471,6 +482,16 @@ static void show_rom_list (void) if (ok) strcat (p, avail); else strcat (p, unavail); p1 = p2; +#if 0 + /* Arcadia */ + p2 = strchr (p1, '\n'); + if (!p2) goto end; + *p2++= 0; strcat (p, p1); strcat (p, ": "); + roms[0] = 5; roms[1] = -1; + if (listrom (roms)) strcat (p, avail); else strcat (p, unavail); + p1 = p2; +#endif + pre_gui_message (p); end: free (p); @@ -588,12 +609,9 @@ int target_cfgfile_load (struct uae_prefs *p, char *filename, int type, int isde cfgfile_get_description (fname, NULL, NULL, NULL, &type); } if (type == 0 || type == 1) { - if (p->mountinfo == currprefs.mountinfo) - currprefs.mountinfo = 0; discard_prefs (p, 0); #ifdef FILESYS free_mountinfo (currprefs.mountinfo); - currprefs.mountinfo = alloc_mountinfo (); #endif } type2 = type; @@ -714,10 +732,7 @@ void gui_display( int shortcut ) static void prefs_to_gui (struct uae_prefs *p) { workprefs = *p; - strcpy (workprefs.path_rom, "roms\\"); updatewinfsmode (&workprefs); - /* Could also duplicate unknown lines, but no need - we never - modify those. */ #if 0 #ifdef _DEBUG if (workprefs.gfx_framerate < 5) @@ -728,12 +743,9 @@ static void prefs_to_gui (struct uae_prefs *p) static void gui_to_prefs (void) { - struct uaedev_mount_info *mi = currprefs.mountinfo; /* Always copy our prefs to changed_prefs, ... */ - //free_mountinfo (workprefs.mountinfo); changed_prefs = workprefs; updatewinfsmode (&changed_prefs); - currprefs.mountinfo = mi; } int DirectorySelection(HWND hDlg, int flag, char *path) @@ -1696,8 +1708,10 @@ void InitializeListView (HWND hDlg) if (j < 0) j = 0; while (j > 0) { - if (tmp2[j - 1] == '\\' || tmp2[j - 1] == '/') - break; + if ((tmp2[j - 1] == '\\' || tmp2[j - 1] == '/')) { + if (!(j >= 5 && (tmp2[j - 5] == '.' || tmp2[j - 4] == '.'))) + break; + } j--; } ListView_SetItemText (list, result, 1, tmp2 + j); @@ -1730,7 +1744,7 @@ void InitializeListView (HWND hDlg) failure = get_filesys_unit (currprefs.mountinfo, i, &devname, &volname, &rootdir, &readonly, &secspertrack, &surfaces, &reserved, - &cylinders, &size, &blocksize, &bootpri, 0); + &cylinders, &size, &blocksize, &bootpri, 0, 0); type = is_hardfile (currprefs.mountinfo, i); if (size >= 1024 * 1024 * 1024) @@ -2651,7 +2665,7 @@ static struct amigamodels amodels[] = { { 3, IDS_QS_MODEL_A1200 }, // "Amiga 1200" { 3, IDS_QS_MODEL_CD32 }, // "CD32" { 4, IDS_QS_MODEL_CDTV }, // "CDTV" - { 0, 0 }, + { 4, IDS_QS_MODEL_ARCADIA }, // "Arcadia" { 0, 0 }, { 0, 0 }, { 1, IDS_QS_MODEL_UAE }, // "Expanded UAE example configuration" @@ -2683,8 +2697,10 @@ static void quickstarthost (HWND hDlg, char *name) int type = CONFIG_TYPE_HOST; char tmp[MAX_DPATH]; - if (getconfigstorefrompath (name, tmp, CONFIG_TYPE_HOST)) - cfgfile_load (&workprefs, tmp, &type, 1); + if (getconfigstorefrompath (name, tmp, CONFIG_TYPE_HOST)) { + if (cfgfile_load (&workprefs, tmp, &type, 1)) + workprefs.start_gui = 1; + } } static void init_quickstartdlg_tooltip (HWND hDlg, char *tt) @@ -4015,7 +4031,7 @@ static void values_to_kickstartdlg (HWND hDlg) keybuf = load_keyfile (&workprefs, NULL, &keysize); addromfiles (fkey, hDlg, IDC_ROMFILE, workprefs.romfile, keybuf, keysize, ROMTYPE_KICK | ROMTYPE_KICKCD32); addromfiles (fkey, hDlg, IDC_ROMFILE2, workprefs.romextfile, keybuf, keysize, ROMTYPE_EXTCD32 | ROMTYPE_EXTCDTV); - addromfiles (fkey, hDlg, IDC_CARTFILE, workprefs.cartfile, keybuf, keysize, ROMTYPE_AR); + addromfiles (fkey, hDlg, IDC_CARTFILE, workprefs.cartfile, keybuf, keysize, ROMTYPE_AR | ROMTYPE_ARCADIA); free_keyfile (keybuf); if (fkey) RegCloseKey (fkey); @@ -5347,7 +5363,7 @@ static void new_filesys (HWND hDlg) const char *result; result = add_filesys_unit (currprefs.mountinfo, current_fsvdlg.device, current_fsvdlg.volume, - current_fsvdlg.rootdir, ! current_fsvdlg.rw, 0, 0, 0, 0, current_fsvdlg.bootpri, 0); + current_fsvdlg.rootdir, ! current_fsvdlg.rw, 0, 0, 0, 0, current_fsvdlg.bootpri, 0, 0); if (result) MessageBox (hDlg, result, "Bad directory", MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND); @@ -5361,7 +5377,7 @@ static void new_hardfile (HWND hDlg) current_hfdlg.filename, ! current_hfdlg.rw, current_hfdlg.sectors, current_hfdlg.surfaces, current_hfdlg.reserved, current_hfdlg.blocksize, - current_hfdlg.bootpri, current_hfdlg.fsfilename); + current_hfdlg.bootpri, current_hfdlg.fsfilename, 0); if (result) MessageBox (hDlg, result, "Bad hardfile", MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND); @@ -5373,7 +5389,7 @@ static void new_harddrive (HWND hDlg) result = add_filesys_unit (currprefs.mountinfo, 0, 0, current_hfdlg.filename, ! current_hfdlg.rw, 0, 0, - 0, current_hfdlg.blocksize, 0, 0); + 0, current_hfdlg.blocksize, 0, 0, 0); if (result) MessageBox (hDlg, result, "Bad harddrive", MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND); @@ -5408,7 +5424,7 @@ static void harddisk_edit (HWND hDlg) failure = get_filesys_unit (currprefs.mountinfo, entry, &devname, &volname, &rootdir, &readonly, &secspertrack, &surfaces, &reserved, &cylinders, &size, - &blocksize, &bootpri, &filesys); + &blocksize, &bootpri, &filesys, 0); type = is_hardfile( currprefs.mountinfo, entry ); if( type == FILESYS_HARDFILE || type == FILESYS_HARDFILE_RDB ) @@ -5438,7 +5454,7 @@ static void harddisk_edit (HWND hDlg) const char *result; result = set_filesys_unit (currprefs.mountinfo, 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); + current_hfdlg.reserved, current_hfdlg.blocksize, current_hfdlg.bootpri, current_hfdlg.fsfilename, 0); if (result) MessageBox (hDlg, result, "Bad hardfile", MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND); @@ -5454,7 +5470,7 @@ static void harddisk_edit (HWND hDlg) const char *result; result = set_filesys_unit (currprefs.mountinfo, entry, 0, 0, current_hfdlg.filename, ! current_hfdlg.rw, 0, 0, - 0, current_hfdlg.blocksize, current_hfdlg.bootpri, 0); + 0, current_hfdlg.blocksize, current_hfdlg.bootpri, 0, 0); if (result) MessageBox (hDlg, result, "Bad harddrive", MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND); @@ -5476,7 +5492,7 @@ static void harddisk_edit (HWND hDlg) if (DialogBox( hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDD_FILESYS), hDlg, VolumeSettingsProc)) { const char *result; result = set_filesys_unit (currprefs.mountinfo, entry, current_fsvdlg.device, current_fsvdlg.volume, - current_fsvdlg.rootdir, ! current_fsvdlg.rw, 0, 0, 0, 0, current_fsvdlg.bootpri, 0); + current_fsvdlg.rootdir, ! current_fsvdlg.rw, 0, 0, 0, 0, current_fsvdlg.bootpri, 0, 0); if (result) MessageBox (hDlg, result, "Bad hardfile", MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND); @@ -5740,13 +5756,42 @@ static void floppytooltip (HWND hDlg, int num, uae_u32 crc32) SendMessage (ToolTipHWND, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); } -static void addfloppytype (HWND hDlg, int n) +static void addfloppyhistory (HWND hDlg, HKEY fkey, int n, int f_text) { - int nn = workprefs.dfxtype[n] + 1; - int state, i, chk; + int i; char *s; - HKEY fkey; char tmp[1000]; + int nn = workprefs.dfxtype[n] + 1; + + if (f_text < 0) + return; + SendDlgItemMessage(hDlg, f_text, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage(hDlg, f_text, WM_SETTEXT, 0, (LPARAM)workprefs.df[n]); + i = 0; + while (s = DISK_history_get (i)) { + i++; + if (strlen (s) == 0) + continue; + if (f_text >= 0) + SendDlgItemMessage (hDlg, f_text, CB_ADDSTRING, 0, (LPARAM)s); + if (fkey) { + sprintf (tmp, "Image%02d", i); + RegSetValueEx (fkey, tmp, 0, REG_SZ, (CONST BYTE *)s, strlen(s) + 1); + } + if (!strcmp (workprefs.df[n], s)) { + if (f_text >= 0) + SendDlgItemMessage (hDlg, f_text, CB_SETCURSEL, i - 1, 0); + } + if (nn <= 0) + break; + } +} + +static void addfloppytype (HWND hDlg, int n) +{ + int state, chk; + HKEY fkey; + int nn = workprefs.dfxtype[n] + 1; int f_text = floppybuttons[n][0]; int f_drive = floppybuttons[n][1]; @@ -5788,28 +5833,8 @@ static void addfloppytype (HWND hDlg, int n) fkey = read_disk_history (); - if (f_text >= 0) { - SendDlgItemMessage(hDlg, f_text, CB_RESETCONTENT, 0, 0); - SendDlgItemMessage(hDlg, f_text, WM_SETTEXT, 0, (LPARAM)workprefs.df[n]); - } - i = 0; - while (s = DISK_history_get (i)) { - i++; - if (strlen (s) == 0) - continue; - if (f_text >= 0) - SendDlgItemMessage (hDlg, f_text, CB_ADDSTRING, 0, (LPARAM)s); - if (fkey) { - sprintf (tmp, "Image%02d", i); - RegSetValueEx (fkey, tmp, 0, REG_SZ, (CONST BYTE *)s, strlen(s) + 1); - } - if (!strcmp (workprefs.df[n], s)) { - if (f_text >= 0) - SendDlgItemMessage (hDlg, f_text, CB_SETCURSEL, i - 1, 0); - } - if (nn <= 0) - break; - } + addfloppyhistory (hDlg, fkey, n, f_text); + if (fkey) RegCloseKey (fkey); } @@ -5825,28 +5850,34 @@ static void getfloppytype (HWND hDlg, int n) } } -static void getfloppyname (HWND hDlg, int n) +static int getfloppybox (HWND hDlg, int f_text, char *out, int maxlen) { int val; - int f_text = currentpage == QUICKSTART_ID ? floppybuttonsq[n][0] : floppybuttons[n][0]; - char tmp[1000]; - tmp[0] = 0; + out[0] = 0; val = SendDlgItemMessage (hDlg, f_text, CB_GETCURSEL, 0, 0L); if (val == CB_ERR) { - SendDlgItemMessage (hDlg, f_text, WM_GETTEXT, (WPARAM)sizeof (tmp), (LPARAM)tmp); + SendDlgItemMessage (hDlg, f_text, WM_GETTEXT, (WPARAM)maxlen, (LPARAM)out); } else { - val = SendDlgItemMessage (hDlg, f_text, CB_GETLBTEXT, (WPARAM)val, (LPARAM)tmp); + val = SendDlgItemMessage (hDlg, f_text, CB_GETLBTEXT, (WPARAM)val, (LPARAM)out); if (val != CB_ERR && val > 0) { - if (tmp[0]) { + if (out[0]) { /* add to top of list */ - DISK_history_add (tmp, -1); + DISK_history_add (out, -1); } } else { - tmp[0] = 0; + out[0] = 0; } } - if (tmp[0]) { + return out[0] ? 1 : 0; +} + +static void getfloppyname (HWND hDlg, int n) +{ + int f_text = currentpage == QUICKSTART_ID ? floppybuttonsq[n][0] : floppybuttons[n][0]; + char tmp[1000]; + + if (getfloppybox (hDlg, f_text, tmp, sizeof (tmp))) { disk_insert (n, tmp); strcpy (workprefs.df[n], tmp); } @@ -6087,10 +6118,11 @@ static ACCEL SwapperAccel[] = { { 0, 0, 0 } }; -static void swapperhili (int entry) +static void swapperhili (HWND hDlg, int entry) { ListView_SetItemState (cachedlist, entry, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); + SetDlgItemText (hDlg, IDC_DISKTEXT, workprefs.dfxlist[entry]); } static void addswapperfile (HWND hDlg, int entry) @@ -6104,7 +6136,7 @@ static void addswapperfile (HWND hDlg, int entry) entry++; } InitializeListView (hDlg); - swapperhili (entry); + swapperhili (hDlg, entry); } } @@ -6113,6 +6145,7 @@ static BOOL CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM static int recursive = 0; static int entry; char tmp[MAX_DPATH]; + HKEY fkey; switch (msg) { @@ -6120,8 +6153,12 @@ static BOOL CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM pages[DISK_ID] = hDlg; currentpage = DISK_ID; InitializeListView(hDlg); + fkey = read_disk_history (); + addfloppyhistory (hDlg, fkey, 0, IDC_DISKTEXT); + if (fkey) + RegCloseKey (fkey); entry = 0; - swapperhili (entry); + swapperhili (hDlg, entry); break; case WM_LBUTTONUP: { @@ -6139,7 +6176,7 @@ static BOOL CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM } } InitializeListView(hDlg); - swapperhili (entry); + swapperhili (hDlg, entry); return TRUE; } xfree (draggeditems); @@ -6174,25 +6211,25 @@ static BOOL CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM case 10019: case 10020: entry = LOWORD (wParam) - 10001; - swapperhili (entry); + swapperhili (hDlg, entry); break; case 10101: if (entry > 0) { entry--; - swapperhili (entry); + swapperhili (hDlg, entry); } break; case 10102: if (entry >= 0 && entry < MAX_SPARE_DRIVES - 1) { entry++; - swapperhili (entry); + swapperhili (hDlg, entry); } break; case 10103: case 10104: disk_swap (entry, 1); InitializeListView (hDlg); - swapperhili (entry); + swapperhili (hDlg, entry); break; case 10201: case 10202: @@ -6211,7 +6248,7 @@ static BOOL CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM strcpy (workprefs.df[drv], workprefs.dfxlist[entry]); disk_insert (drv, workprefs.df[drv]); InitializeListView (hDlg); - swapperhili (entry); + swapperhili (hDlg, entry); } } break; @@ -6223,7 +6260,7 @@ static BOOL CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM int drv = LOWORD (wParam) - 10201; disk_eject (drv); InitializeListView (hDlg); - swapperhili (entry); + swapperhili (hDlg, entry); } break; case 10209: @@ -6232,11 +6269,19 @@ static BOOL CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM } break; + case IDC_DISKLISTINSERT: + if (entry >= 0 && getfloppybox (hDlg, IDC_DISKTEXT, tmp, sizeof (tmp))) { + strcpy (workprefs.dfxlist[entry], tmp); + InitializeListView (hDlg); + swapperhili (hDlg, entry); + } + break; + case IDC_DISKLISTREMOVE: if (entry >= 0) { workprefs.dfxlist[entry][0] = 0; InitializeListView (hDlg); - swapperhili (entry); + swapperhili (hDlg, entry); } break; case IDC_UP: @@ -6246,7 +6291,7 @@ static BOOL CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM strcpy (workprefs.dfxlist[entry], tmp); InitializeListView (hDlg); entry--; - swapperhili (entry); + swapperhili (hDlg, entry); } break; case IDC_DOWN: @@ -6256,7 +6301,7 @@ static BOOL CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM strcpy (workprefs.dfxlist[entry], tmp); InitializeListView (hDlg); entry++; - swapperhili (entry); + swapperhili (hDlg, entry); } break; } @@ -6284,11 +6329,12 @@ static BOOL CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM if (col == 2) { if (disk_swap (entry, 0)) InitializeListView (hDlg); - swapperhili (entry); + swapperhili (hDlg, entry); } else if (col == 1) { if (dblclick) addswapperfile (hDlg, entry); } + SetDlgItemText (hDlg, IDC_DISKTEXT, workprefs.dfxlist[entry]); } break; } diff --git a/od-win32/winuae_msvc/winuae_msvc.vcproj b/od-win32/winuae_msvc/winuae_msvc.vcproj index f93cba54..6c7b6fb9 100755 --- a/od-win32/winuae_msvc/winuae_msvc.vcproj +++ b/od-win32/winuae_msvc/winuae_msvc.vcproj @@ -128,6 +128,7 @@ OutputFile="d:\amiga\winuae.exe" LinkIncremental="1" SuppressStartupBanner="TRUE" + AdditionalLibraryDirectories="" DelayLoadDLLs="setupapi.dll" GenerateDebugInformation="TRUE" ProgramDatabaseFile=".\Release/winuae.pdb" @@ -442,6 +443,9 @@ + + diff --git a/od-win32/writelog.c b/od-win32/writelog.c index 91c7dfd2..690ad750 100755 --- a/od-win32/writelog.c +++ b/od-win32/writelog.c @@ -73,7 +73,7 @@ void write_dlog (const char *format, ...) openconsole(); WriteConsole(stdoutput,buffer,strlen(buffer),&numwritten,0); } - if( debugfile ) { + if (debugfile) { fprintf( debugfile, buffer ); fflush (debugfile); } @@ -92,8 +92,8 @@ void write_log (const char *format, ...) openconsole(); WriteConsole(stdoutput,buffer,strlen(buffer),&numwritten,0); } - if( debugfile ) { - fprintf( debugfile, buffer ); + if (debugfile) { + fprintf (debugfile, buffer); fflush (debugfile); } va_end (parms); diff --git a/zfile.c b/zfile.c index a5a20062..06997c5e 100755 --- a/zfile.c +++ b/zfile.c @@ -674,7 +674,7 @@ static struct zfile *unzip (struct zfile *z) } zipcnt++; err = unzGoToNextFile (uz); - if (err != UNZ_OK) + if (err != UNZ_OK) break; } if (zf) {