From: Toni Wilen Date: Fri, 13 Jun 2008 13:57:16 +0000 (+0300) Subject: imported winuaesrc1500b23.zip X-Git-Tag: 2100~143 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=44fad7afb5f0765a2f32a18dea038ed2bb14103e;p=francis%2Fwinuae.git imported winuaesrc1500b23.zip --- diff --git a/audio.c b/audio.c index 9a2350af..24780cc4 100755 --- a/audio.c +++ b/audio.c @@ -1086,7 +1086,7 @@ static void setirq (int nr) { #ifdef DEBUG_AUDIO if (debugchannel (nr)) - write_log ("SETIRQ %d %08.8X\n", nr, M68K_GETPC); + write_log ("SETIRQ %d %08X\n", nr, M68K_GETPC); #endif INTREQ (0x8000 | (0x80 << nr)); } @@ -1118,7 +1118,7 @@ static void state23 (struct audio_channel_data *cdp) do_samplerip(cdp); #ifdef DEBUG_AUDIO if (debugchannel (cdp - audio_channel)) - write_log ("Channel %d looped, LC=%08.8X LEN=%d\n", cdp - audio_channel, cdp->pt, cdp->wlen); + write_log ("Channel %d looped, LC=%08X LEN=%d\n", cdp - audio_channel, cdp->pt, cdp->wlen); #endif } else { cdp->wlen = (cdp->wlen - 1) & 0xFFFF; @@ -1604,7 +1604,7 @@ void audio_hsync (int dmaaction) do_samplerip(cdp); #ifdef DEBUG_AUDIO if (debugchannel (nr)) - write_log ("%d:>5: LEN=%d PT=%08.8X\n", nr, cdp->wlen, cdp->pt); + write_log ("%d:>5: LEN=%d PT=%08X\n", nr, cdp->wlen, cdp->pt); #endif } cdp->dat2 = chipmem_agnus_wget (cdp->pt); @@ -1622,7 +1622,7 @@ void audio_hsync (int dmaaction) if (cdp->dmaen != chan_ena) { #ifdef DEBUG_AUDIO if (debugchannel (nr)) - write_log ("AUD%dDMA %d->%d (%d) LEN=%d/%d %08.8X\n", nr, cdp->dmaen, chan_ena, + write_log ("AUD%dDMA %d->%d (%d) LEN=%d/%d %08X\n", nr, cdp->dmaen, chan_ena, cdp->state, cdp->wlen, cdp->len, M68K_GETPC); #endif cdp->dmaen = chan_ena; @@ -1645,7 +1645,7 @@ void AUDxDAT (int nr, uae_u16 v) #ifdef DEBUG_AUDIO if (debugchannel (nr)) - write_log ("AUD%dDAT: %04.4X STATE=%d IRQ=%d %08.8X\n", nr, + write_log ("AUD%dDAT: %04X STATE=%d IRQ=%d %08X\n", nr, v, cdp->state, isirq(nr) ? 1 : 0, M68K_GETPC); #endif audio_activate(); @@ -1675,7 +1675,7 @@ void AUDxLCH (int nr, uae_u16 v) audio_channel[nr].lc = (audio_channel[nr].lc & 0xffff) | ((uae_u32)v << 16); #ifdef DEBUG_AUDIO if (debugchannel (nr)) - write_log ("AUD%dLCH: %04.4X %08.8X\n", nr, v, M68K_GETPC); + write_log ("AUD%dLCH: %04X %08X\n", nr, v, M68K_GETPC); #endif } @@ -1686,7 +1686,7 @@ void AUDxLCL (int nr, uae_u16 v) audio_channel[nr].lc = (audio_channel[nr].lc & ~0xffff) | (v & 0xFFFE); #ifdef DEBUG_AUDIO if (debugchannel (nr)) - write_log ("AUD%dLCL: %04.4X %08.8X\n", nr, v, M68K_GETPC); + write_log ("AUD%dLCL: %04X %08X\n", nr, v, M68K_GETPC); #endif } @@ -1702,7 +1702,7 @@ void AUDxPER (int nr, uae_u16 v) if (per < maxhpos * CYCLE_UNIT / 2 && currprefs.produce_sound < 3) per = maxhpos * CYCLE_UNIT / 2; else if (per < 4 * CYCLE_UNIT) - /* smaller value would cause extremely high cpu usage */ + /* smaller values would cause extremely high cpu usage */ per = 4 * CYCLE_UNIT; if (audio_channel[nr].per == PERIOD_MAX - 1 && per != PERIOD_MAX - 1) { @@ -1716,7 +1716,7 @@ void AUDxPER (int nr, uae_u16 v) audio_channel[nr].per = per; #ifdef DEBUG_AUDIO if (debugchannel (nr)) - write_log ("AUD%dPER: %d %08.8X\n", nr, v, M68K_GETPC); + write_log ("AUD%dPER: %d %08X\n", nr, v, M68K_GETPC); #endif } @@ -1727,7 +1727,7 @@ void AUDxLEN (int nr, uae_u16 v) audio_channel[nr].len = v; #ifdef DEBUG_AUDIO if (debugchannel (nr)) - write_log ("AUD%dLEN: %d %08.8X\n", nr, v, M68K_GETPC); + write_log ("AUD%dLEN: %d %08X\n", nr, v, M68K_GETPC); #endif } @@ -1743,7 +1743,7 @@ void AUDxVOL (int nr, uae_u16 v) #endif #ifdef DEBUG_AUDIO if (debugchannel (nr)) - write_log ("AUD%dVOL: %d %08.8X\n", nr, v2, M68K_GETPC); + write_log ("AUD%dVOL: %d %08X\n", nr, v2, M68K_GETPC); #endif } @@ -1762,7 +1762,7 @@ void audio_update_irq (uae_u16 v) if ((1 << i) & DEBUG_CHANNEL_MASK) { uae_u16 mask = 0x80 << i; if ((v2 & mask) != (v3 & mask)) - write_log ("AUD%dINTREQ %d->%d %08.8X\n", i, !!(v3 & mask), !!(v2 & mask), M68K_GETPC); + write_log ("AUD%dINTREQ %d->%d %08X\n", i, !!(v3 & mask), !!(v2 & mask), M68K_GETPC); } } #endif @@ -1780,7 +1780,7 @@ void audio_update_adkmasks (void) if ((prevcon & 0xff) != (adkcon & 0xff)) { audio_activate(); #ifdef DEBUG_AUDIO - write_log ("ADKCON=%02.2x %08.8X\n", adkcon & 0xff, M68K_GETPC); + write_log ("ADKCON=%02x %08X\n", adkcon & 0xff, M68K_GETPC); #endif prevcon = adkcon; } diff --git a/custom.c b/custom.c index 3433ae1a..4bddd2eb 100755 --- a/custom.c +++ b/custom.c @@ -1671,7 +1671,7 @@ static void record_color_change (int hpos, int regno, unsigned long value) static void record_register_change (int hpos, int regno, unsigned long value) { - magic_centering (regno, value, vpos); + //magic_centering (regno, value, vpos); if (regno == 0x100) { if (passed_plfstop >= 3) return; @@ -3111,7 +3111,7 @@ static void BPL1MOD (int hpos, uae_u16 v) return; decide_line (hpos); decide_fetch (hpos); - magic_centering (0x108, v, vpos); + //magic_centering (0x108, v, vpos); bpl1mod = v; } @@ -3122,7 +3122,7 @@ static void BPL2MOD (int hpos, uae_u16 v) return; decide_line (hpos); decide_fetch (hpos); - magic_centering (0x10a, v, vpos); + //magic_centering (0x10a, v, vpos); bpl2mod = v; } @@ -3180,7 +3180,7 @@ static void DDFSTRT (int hpos, uae_u16 v) ddfstrt_old_vpos = vpos; ddfstrt = v; calcdiw (); - magic_centering (0x92, v, vpos); + //magic_centering (0x92, v, vpos); if (ddfstop > 0xD4 && (ddfstrt & 4) == 4) { static int last_warned; last_warned = (last_warned + 1) & 4095; @@ -3201,7 +3201,7 @@ static void DDFSTOP (int hpos, uae_u16 v) decide_blitter (hpos); ddfstop = v; calcdiw (); - magic_centering (0x94, v, vpos); + //magic_centering (0x94, v, vpos); if (fetch_state != fetch_not_started) estimate_last_fetch_cycle (hpos); if (ddfstop > 0xD4 && (ddfstrt & 4) == 4) { @@ -3216,7 +3216,7 @@ static void FMODE (uae_u16 v) { if (! (currprefs.chipset_mask & CSMASK_AGA)) v = 0; - magic_centering (0x1fc, v, vpos); + //magic_centering (0x1fc, v, vpos); ddf_change = vpos; fmode = v; sprite_width = GET_SPRITEWIDTH (fmode); @@ -4366,7 +4366,7 @@ static void fpscounter (void) static void vsync_handler (void) { - magic_centering (0, 0, 0); + //magic_centering (0, 0, 0); fpscounter (); if (!isvsync () @@ -4396,6 +4396,8 @@ static void vsync_handler (void) } } #endif + } else { + framewait (); } if (bogusframe > 0) @@ -4640,7 +4642,7 @@ static void hsync_handler (void) } } else { #endif - is_lastline = vpos + 1 == maxvpos + (lof == 0 ? 0 : 1) && currprefs.m68k_speed == -1 && ! rpt_did_reset; + is_lastline = vpos + 1 == maxvpos + (lof == 0 ? 0 : 1) && currprefs.m68k_speed == -1; #ifdef JIT } #endif diff --git a/disk.c b/disk.c index 082a15b5..7b921e8a 100755 --- a/disk.c +++ b/disk.c @@ -2424,7 +2424,7 @@ static void disk_doupdate_write (drive * drv, int floppybits) floppy[dr].mfmpos %= drv->tracklen; } } - if ((dmacon & 0x210) == 0x210 && dskdmaen == 3 && dsklength > 0) { + if ((dmacon & 0x210) == 0x210 && dskdmaen == 3 && dsklength > 0 && !(adkcon &0x400)) { bitoffset++; bitoffset &= 15; if (!bitoffset) { @@ -2494,7 +2494,7 @@ static void disk_doupdate_predict (drive * drv, int startcycle) else tword |= getonebit (drv->bigmfmbuf, mfmpos); } - if ((tword & 0xffff) == dsksync) + if ((tword & 0xffff) == dsksync && dsksync != 0) diskevent_flag |= DISK_WORDSYNC; } mfmpos++; @@ -2783,7 +2783,8 @@ void DISK_update (int tohpos) drv->floppybitcounter %= drv->trackspeed; continue; } - drive_fill_bigbuf (drv, 0); + if (drv->diskfile) + drive_fill_bigbuf (drv, 0); drv->mfmpos %= drv->tracklen; } didread = 0; diff --git a/enforcer.c b/enforcer.c index 8415c3bd..baf95f39 100755 --- a/enforcer.c +++ b/enforcer.c @@ -11,6 +11,7 @@ #include "sysconfig.h" #include "sysdeps.h" +#include "options.h" #include "memory.h" #include "custom.h" #include "newcpu.h" diff --git a/filesys.c b/filesys.c index d22ff9e4..624d5386 100755 --- a/filesys.c +++ b/filesys.c @@ -3526,7 +3526,7 @@ action_read (Unit *unit, dpacket packet) if (size > filesize) size = filesize; - buf = (char *)malloc(size); + buf = xmalloc (size); if (!buf) { PUT_PCK_RES1 (packet, -1); PUT_PCK_RES2 (packet, ERROR_NO_FREE_STORE); diff --git a/hardfile.c b/hardfile.c index 693d4626..9747e670 100755 --- a/hardfile.c +++ b/hardfile.c @@ -1067,7 +1067,7 @@ static uae_u32 hardfile_do_io (struct hardfiledata *hfd, struct hardfileprivdata error = handle_scsi (request, hfd); } else { /* we don't want users trashing their "partition" hardfiles with hdtoolbox */ error = IOERR_NOCMD; - write_log ("UAEHF: HD_SCSICMD tried on regular HDF, unit %d", unit); + write_log ("UAEHF: HD_SCSICMD tried on regular HDF, unit %d\n", unit); } break; diff --git a/include/events_jit.h b/include/events_jit.h index edcb0a22..9a5157d9 100755 --- a/include/events_jit.h +++ b/include/events_jit.h @@ -3,6 +3,7 @@ /* Let's see whether hiding this away somewhere where the compiler can't see it will cure it of its silly urge to mis-optimize the comparison */ extern long int diff32(frame_time_t x, frame_time_t y); +extern int pissoff_value; STATIC_INLINE void events_schedule (void) { @@ -61,7 +62,7 @@ STATIC_INLINE void do_cycles_slow (unsigned long cycles_to_add) if (v > (int)syncbase || v < -((int)syncbase)) vsyncmintime = rpt; if (v < 0) { - pissoff = 3000 * CYCLE_UNIT; + pissoff = pissoff_value * CYCLE_UNIT; return; } } diff --git a/include/zfile.h b/include/zfile.h index b1a4c960..3a2ea729 100755 --- a/include/zfile.h +++ b/include/zfile.h @@ -12,6 +12,7 @@ struct zvolume; typedef int (*zfile_callback)(struct zfile*, void*); extern struct zfile *zfile_fopen (const char *, const char *); +extern struct zfile *zfile_fopen_nozip (const char *, const char *); extern struct zfile *zfile_fopen_empty (const char *name, int size); extern struct zfile *zfile_fopen_data (const char *name, int size, uae_u8 *data); extern int zfile_exists (const char *name); @@ -48,6 +49,7 @@ extern int iszip (struct zfile *z); #define ZFILE_HDF 5 #define ZFILE_STATEFILE 6 #define ZFILE_NVR 7 +#define ZFILE_HDFRDB 8 extern const char *uae_archive_extensions[]; extern const char *uae_ignoreextensions[]; diff --git a/memory.c b/memory.c index 9fbfe651..54a20379 100755 --- a/memory.c +++ b/memory.c @@ -225,7 +225,7 @@ static struct romdata roms[] = { ALTROMPN(17, 1, 1, 262144, ROMTYPE_EVEN, "391657-01", 0x0ca94f70,0xb3806eda,0xcb3362fc,0x16a154ce,0x1eeec5bf,0x5bc24789) ALTROMPN(17, 1, 2, 262144, ROMTYPE_ODD , "391658-01", 0xdfe03120,0xcd7a706c,0x431b04d8,0x7814d3a2,0xd8b39710,0x0cf44c0c) { "KS ROM v3.X (A4000)(Cloanto)", 3, 10, 45, 57, "A4000\0", 524288, 46, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL, - 0x08b69382, 0x81D3AEA3,0x0DB7FBBB,0x4AFEE41C,0x21C5ED66,0x2B70CA53 }, + 0x3ac99edc, 0x3cbfc9e1,0xfe396360,0x157bd161,0xde74fc90,0x1abee7ec }, { "CD32 KS ROM v3.1", 3, 1, 40, 60, "CD32\0", 524288, 18, 1, 0, ROMTYPE_KICKCD32, 0, 0, NULL, 0x1e62d4a5, 0x3525BE88,0x87F79B59,0x29E017B4,0x2380A79E,0xDFEE542D }, @@ -578,56 +578,6 @@ struct rom_key { static struct rom_key keyring[ROM_KEY_NUM]; -int decode_cloanto_rom_do (uae_u8 *mem, int size, int real_size) -{ - int cnt, t, i, keysize; - uae_u8 *key; - - for (i = ROM_KEY_NUM - 1; i >= 0; i--) { - keysize = keyring[i].size; - key = keyring[i].key; - if (!key) - continue; - for (t = cnt = 0; cnt < size; cnt++, t = (t + 1) % keysize) { - mem[cnt] ^= key[t]; - if (real_size == cnt + 1) - t = keysize - 1; - } - if ((mem[2] == 0x4e && mem[3] == 0xf9) || (mem[0] == 0x11 && (mem[1] == 0x11 || mem[1] == 0x14))) - return 1; - if (mem[0] == 0xd0 && mem[1] == 0x00 && mem[2] == 0x50 && mem[3] == 0x00) /* fmv */ - return 1; - for (t = cnt = 0; cnt < size; cnt++, t = (t + 1) % keysize) { - mem[cnt] ^= key[t]; - if (real_size == cnt + 1) - t = keysize - 1; - } - } - return 0; -} - -static int decode_rekick_rom_do (uae_u8 *mem, int size, int real_size) -{ - uae_u32 d1 = 0xdeadfeed, d0; - int i; - - for (i = 0; i < size / 8; i++) { - d0 = ((mem[i * 8 + 0] << 24) | (mem[i * 8 + 1] << 16) | (mem[i * 8 + 2] << 8) | mem[i * 8 + 3]); - d1 = d1 ^ d0; - mem[i * 8 + 0] = d1 >> 24; - mem[i * 8 + 1] = d1 >> 16; - mem[i * 8 + 2] = d1 >> 8; - mem[i * 8 + 3] = d1; - d1 = ((mem[i * 8 + 4] << 24) | (mem[i * 8 + 5] << 16) | (mem[i * 8 + 6] << 8) | mem[i * 8 + 7]); - d0 = d0 ^ d1; - mem[i * 8 + 4] = d0 >> 24; - mem[i * 8 + 5] = d0 >> 16; - mem[i * 8 + 6] = d0 >> 8; - mem[i * 8 + 7] = d0; - } - return 1; -} - static void addkey (uae_u8 *key, int size, const char *name) { int i; @@ -787,23 +737,6 @@ void free_keyring (void) memset(keyring, 0, sizeof (struct rom_key) * ROM_KEY_NUM); } -static int decode_rom (uae_u8 *mem, int size, int mode, int real_size) -{ - if (mode == 1) { - if (!decode_cloanto_rom_do (mem, size, real_size)) { - #ifndef SINGLEFILE - notify_user (NUMSG_NOROMKEY); - #endif - return 0; - } - return 1; - } else if (mode == 2) { - decode_rekick_rom_do (mem, size, real_size); - return 1; - } - return 0; -} - struct romdata *getromdatabyname (char *name) { char tmp[MAX_PATH]; @@ -880,7 +813,7 @@ static struct romdata *checkromdata (uae_u8 *sha1, int size, uae_u32 mask) while (roms[i].name) { if (!notcrc32(roms[i].crc32) && roms[i].size >= size) { if (roms[i].type & mask) { - if (!cmpsha1(sha1, &roms[i])) + if (!cmpsha1 (sha1, &roms[i])) return &roms[i]; } } @@ -889,6 +822,83 @@ static struct romdata *checkromdata (uae_u8 *sha1, int size, uae_u32 mask) return NULL; } +int decode_cloanto_rom_do (uae_u8 *mem, int size, int real_size) +{ + int cnt, t, i; + + for (i = ROM_KEY_NUM - 1; i >= 0; i--) { + uae_u8 sha1[SHA1_SIZE]; + struct romdata *rd; + int keysize = keyring[i].size; + uae_u8 *key = keyring[i].key; + if (!key) + continue; + for (t = cnt = 0; cnt < size; cnt++, t = (t + 1) % keysize) { + mem[cnt] ^= key[t]; + if (real_size == cnt + 1) + t = keysize - 1; + } + if ((mem[2] == 0x4e && mem[3] == 0xf9) || (mem[0] == 0x11 && (mem[1] == 0x11 || mem[1] == 0x14))) { + cloanto_rom = 1; + return 1; + } + get_sha1 (mem, size, sha1); + rd = checkromdata (sha1, size, -1); + if (rd) { + if (rd->cloanto) + cloanto_rom = 1; + return 1; + } + if (i == 0) + break; + for (t = cnt = 0; cnt < size; cnt++, t = (t + 1) % keysize) { + mem[cnt] ^= key[t]; + if (real_size == cnt + 1) + t = keysize - 1; + } + } + return 0; +} + +static int decode_rekick_rom_do (uae_u8 *mem, int size, int real_size) +{ + uae_u32 d1 = 0xdeadfeed, d0; + int i; + + for (i = 0; i < size / 8; i++) { + d0 = ((mem[i * 8 + 0] << 24) | (mem[i * 8 + 1] << 16) | (mem[i * 8 + 2] << 8) | mem[i * 8 + 3]); + d1 = d1 ^ d0; + mem[i * 8 + 0] = d1 >> 24; + mem[i * 8 + 1] = d1 >> 16; + mem[i * 8 + 2] = d1 >> 8; + mem[i * 8 + 3] = d1; + d1 = ((mem[i * 8 + 4] << 24) | (mem[i * 8 + 5] << 16) | (mem[i * 8 + 6] << 8) | mem[i * 8 + 7]); + d0 = d0 ^ d1; + mem[i * 8 + 4] = d0 >> 24; + mem[i * 8 + 5] = d0 >> 16; + mem[i * 8 + 6] = d0 >> 8; + mem[i * 8 + 7] = d0; + } + return 1; +} + +static int decode_rom (uae_u8 *mem, int size, int mode, int real_size) +{ + if (mode == 1) { + if (!decode_cloanto_rom_do (mem, size, real_size)) { + #ifndef SINGLEFILE + notify_user (NUMSG_NOROMKEY); + #endif + return 0; + } + return 1; + } else if (mode == 2) { + decode_rekick_rom_do (mem, size, real_size); + return 1; + } + return 0; +} + struct romdata *getromdatabydata (uae_u8 *rom, int size) { uae_u8 sha1[SHA1_SIZE]; @@ -897,7 +907,7 @@ struct romdata *getromdatabydata (uae_u8 *rom, int size) struct romdata *ret = NULL; if (size > 11 && !memcmp (rom, "AMIROMTYPE1", 11)) { - uae_u8 *tmpbuf = (uae_u8*)xmalloc (size); + uae_u8 *tmpbuf = xmalloc (size); int tmpsize = size - 11; memcpy (tmpbuf, rom + 11, tmpsize); decode_rom (tmpbuf, tmpsize, 1, tmpsize); @@ -941,7 +951,7 @@ struct romdata *getromdatabyzfile (struct zfile *f) pos = zfile_ftell (f); zfile_fseek (f, 0, SEEK_END); size = zfile_ftell (f); - p = (uae_u8*)xmalloc (size); + p = xmalloc (size); if (!p) return 0; memset (p, 0, size); @@ -2393,7 +2403,7 @@ static int read_rom_file (uae_u8 *buf, struct romdata *rd) return 0; addkeydir (rl->path); zfile_fread (tmp, sizeof tmp, 1, zf); - if (!memcmp (tmp, "AMIROMTYPE1", 11) != 0) { + if (!memcmp (tmp, "AMIROMTYPE1", sizeof tmp)) { zfile_fread (buf, rd->size, 1, zf); decode_cloanto_rom_do (buf, rd->size, rd->size); } else { @@ -2544,18 +2554,19 @@ struct zfile *read_rom_name (const char *filename) } f = zfile_fopen (filename, "rb"); if (f) { - char tmp[11]; + uae_u8 tmp[11]; zfile_fread (tmp, sizeof tmp, 1, f); - if (!memcmp (tmp, "AMIROMTYPE1", 11) != 0) { + if (!memcmp (tmp, "AMIROMTYPE1", sizeof tmp)) { struct zfile *df; int size; uae_u8 *buf; + addkeydir (filename); zfile_fseek (f, 0, SEEK_END); size = zfile_ftell (f) - sizeof tmp; zfile_fseek (f, sizeof tmp, SEEK_SET); buf = xmalloc (size); - df = zfile_fopen_empty ("tmp.rom", size); zfile_fread (buf, size, 1, f); + df = zfile_fopen_empty ("tmp.rom", size); decode_cloanto_rom_do (buf, size, size); zfile_fwrite (buf, size, 1, df); zfile_fclose (f); @@ -2563,21 +2574,19 @@ struct zfile *read_rom_name (const char *filename) zfile_fseek (df, 0, SEEK_SET); f = df; } else { - zfile_fseek (f, -sizeof tmp, SEEK_CUR); + zfile_fseek (f, -((int)sizeof tmp), SEEK_CUR); } } return f; } static char *kickstring = "exec.library"; -static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksum, int *cloanto_rom, int noalias) +static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksum, int noalias) { unsigned char buffer[20]; int i, j, oldpos; int cr = 0, kickdisk = 0; - if (cloanto_rom) - *cloanto_rom = 0; if (size < 0) { zfile_fseek (f, 0, SEEK_END); size = zfile_ftell (f) & ~0x3ff; @@ -2597,12 +2606,10 @@ static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksu } else if (strncmp ((char *)buffer, "AMIROMTYPE1", 11) != 0) { zfile_fseek (f, oldpos, SEEK_SET); } else { + cloanto_rom = 1; cr = 1; } - if (cloanto_rom) - *cloanto_rom = cr; - i = zfile_fread (mem, 1, size, f); if (kickdisk && i > 262144) i = 262144; @@ -2684,7 +2691,7 @@ static int load_extendedkickstart (void) extendedkickmem_bank.baseaddr = extendedkickmemory; break; } - read_kickstart (f, extendedkickmemory, extendedkickmem_size, 0, 0, 1); + read_kickstart (f, extendedkickmemory, extendedkickmem_size, 0, 1); extendedkickmem_mask = extendedkickmem_size - 1; zfile_fclose (f); return 1; @@ -2787,10 +2794,12 @@ static void patch_kick (void) static int load_kickstart (void) { - struct zfile *f = read_rom_name (currprefs.romfile); + struct zfile *f; char tmprom[MAX_DPATH], tmprom2[MAX_DPATH]; int patched = 0; + cloanto_rom = 0; + f = read_rom_name (currprefs.romfile); strcpy (tmprom, currprefs.romfile); if (f == NULL) { sprintf (tmprom2, "%s%s", start_path_data, currprefs.romfile); @@ -2815,7 +2824,7 @@ static int load_kickstart (void) } } addkeydir (currprefs.romfile); - if( f == NULL ) { /* still no luck */ + if (f == NULL) { /* still no luck */ #if defined(AMIGA)||defined(__POS__) #define USE_UAE_ERSATZ "USE_UAE_ERSATZ" if( !getenv(USE_UAE_ERSATZ)) @@ -2857,7 +2866,7 @@ static int load_kickstart (void) extpos = 0; zfile_fseek (f, kspos, SEEK_SET); } - size = read_kickstart (f, kickmemory, maxsize, 1, &cloanto_rom, 0); + size = read_kickstart (f, kickmemory, maxsize, 1, 0); if (size == 0) goto err; kickmem_mask = size - 1; @@ -2874,7 +2883,7 @@ static int load_kickstart (void) } extendedkickmem_bank.baseaddr = extendedkickmemory; zfile_fseek (f, extpos, SEEK_SET); - read_kickstart (f, extendedkickmemory, extendedkickmem_size, 0, 0, 1); + read_kickstart (f, extendedkickmemory, extendedkickmem_size, 0, 1); extendedkickmem_mask = extendedkickmem_size - 1; } if (filesize > 524288 * 2) { @@ -2882,9 +2891,9 @@ static int load_kickstart (void) extendedkickmemory2 = mapped_malloc (extendedkickmem2_size, "rom_a8"); extendedkickmem2_bank.baseaddr = extendedkickmemory2; zfile_fseek (f, extpos + 524288, SEEK_SET); - read_kickstart (f, extendedkickmemory2, 524288, 0, 0, 1); + read_kickstart (f, extendedkickmemory2, 524288, 0, 1); zfile_fseek (f, extpos + 524288 * 2, SEEK_SET); - read_kickstart (f, extendedkickmemory2 + 524288, 524288, 0, 0, 1); + read_kickstart (f, extendedkickmemory2 + 524288, 524288, 0, 1); extendedkickmem2_mask = extendedkickmem2_size - 1; } } diff --git a/newcpu.c b/newcpu.c index dbed1ec8..ee6991a5 100755 --- a/newcpu.c +++ b/newcpu.c @@ -36,8 +36,6 @@ extern uae_u8* compiled_code; #include /* For faster cycles handling */ signed long pissoff = 0; -/* Counter for missed vsyncmintime deadlines */ -int gonebad = 0; #else /* Need to have these somewhere */ static void build_comp (void) {} diff --git a/od-win32/cloanto/RetroPlatformGuestIPC.c b/od-win32/cloanto/RetroPlatformGuestIPC.c index cf55ff65..8a652a03 100755 --- a/od-win32/cloanto/RetroPlatformGuestIPC.c +++ b/od-win32/cloanto/RetroPlatformGuestIPC.c @@ -7,7 +7,7 @@ : License version 2 as published by the Free Software Foundation. Authors : os, mcb Created : 2007-08-24 15:28:48 - Updated : 2008-02-03 06:49:00 + Updated : 2008-06-10 13:42:00 Comment : RP Player interprocess communication functions (guest side) Note : Can be compiled both in Unicode and Multibyte projects *****************************************************************************/ @@ -176,6 +176,31 @@ BOOL RPSendMessage(UINT uMessage, WPARAM wParam, LPARAM lParam, return TRUE; } +/***************************************************************************** + Name : RPPostMessage + Arguments : UINT uMessage - + : WPARAM wParam - + : LPARAM lParam - + : const RPGUESTINFO *pInfo - + Return : BOOL - + Authors : os + Created : 2008-06-10 13:30:34 + Comment : the guest calls this function to post messages to the host + (unlike RPSendMessage(), this function sends messages + in asynchronous fashion and cannot be used to post messages which require + a reply from the host and/or messages which include additional data) + *****************************************************************************/ + +BOOL RPPostMessage(UINT uMessage, WPARAM wParam, LPARAM lParam, const RPGUESTINFO *pInfo) +{ + if (!pInfo) + return FALSE; + if (!pInfo->hHostMessageWindow) + return FALSE; + + return PostMessage(pInfo->hHostMessageWindow, uMessage, wParam, lParam); +} + /***************************************************************************** Name : RegisterWndClass Arguments : LPCTSTR pszClassName - diff --git a/od-win32/cloanto/RetroPlatformGuestIPC.h b/od-win32/cloanto/RetroPlatformGuestIPC.h index 3f5b184f..ed12b6b4 100755 --- a/od-win32/cloanto/RetroPlatformGuestIPC.h +++ b/od-win32/cloanto/RetroPlatformGuestIPC.h @@ -7,7 +7,7 @@ : License version 2 as published by the Free Software Foundation. Authors : os Created : 2007-08-24 15:29:26 - Updated : 2008-02-03 06:49:00 + Updated : 2008-06-10 13:42:00 Comment : RP Player interprocess communication include file (guest side) *****************************************************************************/ @@ -46,6 +46,7 @@ extern "C" { HRESULT RPInitializeGuest(RPGUESTINFO *pInfo, HINSTANCE hInstance, LPCTSTR pszHostInfo, RPGUESTMSGFN pfnMsgFunction, LPARAM lMsgFunctionParam); void RPUninitializeGuest(RPGUESTINFO *pInfo); BOOL RPSendMessage(UINT uMessage, WPARAM wParam, LPARAM lParam, LPCVOID pData, DWORD dwDataSize, const RPGUESTINFO *pInfo, LRESULT *plResult); +BOOL RPPostMessage(UINT uMessage, WPARAM wParam, LPARAM lParam, const RPGUESTINFO *pInfo); #ifdef __cplusplus } // ... extern "C" diff --git a/od-win32/dinput.c b/od-win32/dinput.c index c4b520dd..219fb864 100755 --- a/od-win32/dinput.c +++ b/od-win32/dinput.c @@ -544,7 +544,7 @@ static void handle_rawinput_2 (RAWINPUT *raw) break; } #ifdef DI_DEBUG2 - write_log ("HANDLE=%08.8x %04.4x %04.4x %04.4x %08.8x %3d %3d %08.8x M=%d\n", + write_log ("HANDLE=%08x %04x %04x %04x %08x %3d %3d %08x M=%d\n", raw->header.hDevice, rm->usFlags, rm->usButtonFlags, @@ -729,7 +729,7 @@ static void sortobjects (struct didata *did, int *mappings, int *sort, char **na if (num > 0) { write_log ("%s (GUID=%s):\n", did->name, outGUID (&did->guid)); for (i = 0; i < num; i++) - write_log ("%02.2X %0.03d '%s' (%d,%d)\n", mappings[i], mappings[i], names[i], sort[i], types ? types[i] : -1); + write_log ("%02X %03d '%s' (%d,%d)\n", mappings[i], mappings[i], names[i], sort[i], types ? types[i] : -1); } #endif } @@ -772,18 +772,28 @@ static int makesort_mouse (const GUID *g, int *dwofs) static BOOL CALLBACK EnumObjectsCallback (const DIDEVICEOBJECTINSTANCE* pdidoi, VOID *pContext) { struct didata *did = pContext; - int i = 0; + int i; char tmp[100]; if (pdidoi->dwType & DIDFT_AXIS) { + int sort = 0; if (did->axles >= MAX_MAPPINGS) return DIENUM_CONTINUE; did->axismappings[did->axles] = pdidoi->dwOfs; did->axisname[did->axles] = my_strdup (pdidoi->tszName); if (did->type == DID_JOYSTICK) - did->axissort[did->axles] = makesort_joy (&pdidoi->guidType, &did->axismappings[did->axles]); + sort = makesort_joy (&pdidoi->guidType, &did->axismappings[did->axles]); else if (did->type == DID_MOUSE) - did->axissort[did->axles] = makesort_mouse (&pdidoi->guidType, &did->axismappings[did->axles]); + sort = makesort_mouse (&pdidoi->guidType, &did->axismappings[did->axles]); + if (sort < 0) { + for (i = 0; i < did->axles; i++) { + if (did->axissort[i] == sort) { + write_log ("ignored duplicate '%s'\n", pdidoi->tszName); + return DIENUM_CONTINUE; + } + } + } + did->axissort[did->axles] = sort; did->axles++; } if (pdidoi->dwType & DIDFT_POV) { @@ -863,7 +873,7 @@ static BOOL CALLBACK di_enumcallback (LPCDIDEVICEINSTANCE lpddi, LPVOID *dd) #ifdef DI_DEBUG write_log ("I=%s ", outGUID (&lpddi->guidInstance)); write_log ("P=%s\n", outGUID (&lpddi->guidProduct)); - write_log ("'%s' '%s' %08.8X [%s]\n", lpddi->tszProductName, lpddi->tszInstanceName, lpddi->dwDevType, typetxt); + write_log ("'%s' '%s' %08X [%s]\n", lpddi->tszProductName, lpddi->tszInstanceName, lpddi->dwDevType, typetxt); #endif if (did == di_mouse) { @@ -1277,7 +1287,7 @@ static int get_kb_widget_first (int kb, int type) static int get_kb_widget_type (int kb, int num, char *name, uae_u32 *code) { if (name) - sprintf (name, "[%02.2X] %s", di_keyboard[kb].buttonmappings[num], di_keyboard[kb].buttonname[num]); + sprintf (name, "[%02X] %s", di_keyboard[kb].buttonmappings[num], di_keyboard[kb].buttonname[num]); if (code) *code = di_keyboard[kb].buttonmappings[num]; return IDEV_WIDGET_KEY; @@ -1499,7 +1509,7 @@ static int refresh_kb (LPDIRECTINPUTDEVICE8 lpdi, int num) continue; if (kc[i] & 0x80) kc[i] = 1; else kc[i] = 0; if (kc[i] != di_keycodes[num][i]) { - write_log ("%02.2X -> %d\n", i, kc[i]); + write_log ("%02X -> %d\n", i, kc[i]); di_keycodes[num][i] = kc[i]; my_kbd_handler (num, i, kc[i]); } diff --git a/od-win32/direct3d.c b/od-win32/direct3d.c index 2c8c3c01..62a9f03b 100755 --- a/od-win32/direct3d.c +++ b/od-win32/direct3d.c @@ -451,7 +451,7 @@ static void BlitRect (LPDIRECT3DDEVICE9 dev, LPDIRECT3DTEXTURE9 src, tin_ = internal window size twidth/theight = texture size */ -#if 1 +#if 0 static void calc (float *xp, float *yp, float *sxp, float *syp) { float xm ,ym; @@ -479,6 +479,18 @@ static void calc (float *xp, float *yp, float *sxp, float *syp) int xm, ym; int fx, fy; float x, y, sx, sy; + float multx, multy; + + multx = (currprefs.gfx_filter_horiz_zoom + 1000.0) / 1000.; + if (currprefs.gfx_filter_horiz_zoom_mult) + multx *= 1000.0 / currprefs.gfx_filter_horiz_zoom_mult; + else + multx *= (float)window_w / tin_w; + multy = (currprefs.gfx_filter_vert_zoom + 1000.0) / 1000.; + if (currprefs.gfx_filter_vert_zoom_mult) + multy *= 1000.0 / currprefs.gfx_filter_vert_zoom_mult; + else + multy *= (float)window_h / tin_h; xm = 2 >> currprefs.gfx_resolution; ym = currprefs.gfx_linedbl ? 1 : 2; @@ -498,8 +510,8 @@ static void calc (float *xp, float *yp, float *sxp, float *syp) fy = (tin_h * ym - window_h) / 2; x = (float)(window_w * currprefs.gfx_filter_horiz_offset / 1000.0); y = (float)(window_h * currprefs.gfx_filter_vert_offset / 1000.0); - sx = x + (float)(twidth * window_w / tin_w) * ((currprefs.gfx_filter_horiz_zoom + 1000) / 1000.0); - sy = y + (float)(theight * window_h / tin_h) * ((currprefs.gfx_filter_vert_zoom + 1000) / 1000.0); + sx = x + (float)(twidth * window_w / tin_w) * multx; + sy = y + (float)(theight * window_h / tin_h) * multy; x -= fx; y -= fy; sx += 2 * fx; sy += 2 * fy; *xp = x; *yp = y; diff --git a/od-win32/dxwrap.c b/od-win32/dxwrap.c index 3427c08f..48f6c42e 100755 --- a/od-win32/dxwrap.c +++ b/od-win32/dxwrap.c @@ -12,7 +12,8 @@ struct ddstuff dxdata; static int flipinterval_supported = 1; -int ddforceram = 0; +int ddforceram = DDFORCED_DEFAULT; +int useoverlay = 0; HRESULT DirectDraw_GetDisplayMode (void) { @@ -303,7 +304,26 @@ HRESULT DirectDraw_CreateMainSurface (int width, int height) ddrval = IDirectDraw7_CreateSurface (dxdata.maindd, &desc, &dxdata.primary, NULL); } } else { - ddrval = IDirectDraw7_CreateSurface (dxdata.maindd, &desc, &dxdata.primary, NULL); + if (useoverlay && DirectDraw_GetCurrentDepth () == 32) { + DDPIXELFORMAT of; + DWORD dwDDSColor; + memset (&of, 0, sizeof (of)); + of.dwRGBBitCount = 16; + of.dwRBitMask = 0xF800; + of.dwGBitMask = 0x07E0; + of.dwBBitMask = 0x001F; + desc.ddsCaps.dwCaps = DDSCAPS_OVERLAY | DDSCAPS_PRIMARYSURFACE; + desc.ddpfPixelFormat = of; + dxdata.overlayfx.dwSize = sizeof (DDOVERLAYFX); + dxdata.overlayflags = DDOVER_SHOW | DDOVER_DDFX | DDOVER_KEYDESTOVERRIDE; + dwDDSColor = 0xff00ff; + dxdata.overlayfx.dckDestColorkey.dwColorSpaceLowValue = dwDDSColor; + dxdata.overlayfx.dckDestColorkey.dwColorSpaceHighValue = dwDDSColor; + ddrval = IDirectDraw7_CreateSurface (dxdata.maindd, &desc, &dxdata.primary, NULL); + dxdata.isoverlay = 1; + } else { + ddrval = IDirectDraw7_CreateSurface (dxdata.maindd, &desc, &dxdata.primary, NULL); + } } if (FAILED (ddrval)) { write_log ("IDirectDraw7_CreateSurface: %s\n", DXError (ddrval)); @@ -817,6 +837,7 @@ void DirectDraw_Release (void) { if (!dxdata.ddinit) return; + dxdata.isoverlay = 0; dxdata.islost = 0; dxdata.ddinit = 0; freemainsurface (); diff --git a/od-win32/dxwrap.h b/od-win32/dxwrap.h index 515e0710..7413df30 100755 --- a/od-win32/dxwrap.h +++ b/od-win32/dxwrap.h @@ -5,6 +5,7 @@ #include "ddraw.h" extern int ddforceram; +extern int useoverlay; struct ddstuff { @@ -16,6 +17,8 @@ struct ddstuff LPDIRECTDRAWCLIPPER dclip; LPDIRECTDRAWSURFACE7 primary, secondary, flipping[2]; LPDIRECTDRAWPALETTE palette; + DDOVERLAYFX overlayfx; + DWORD overlayflags; int fsmodeset, backbuffers; int width, height, depth, freq; int swidth, sheight; @@ -26,7 +29,7 @@ struct ddstuff HWND hwnd; int maxwidth, maxheight; uae_u32 colorkey; - int islost; + int islost, isoverlay; LPDIRECTDRAWSURFACE7 cursorsurface1; LPDIRECTDRAWSURFACE7 cursorsurface2; diff --git a/od-win32/opengl.c b/od-win32/opengl.c index 0d9e550a..c58506cb 100755 --- a/od-win32/opengl.c +++ b/od-win32/opengl.c @@ -463,10 +463,10 @@ void OGL_resize (int width, int height) static void OGL_dorender (int newtex) { uae_u8 *data = gfxvidinfo.bufmem; - float x1, y1, x2, y2, xm, ym; - RECT sr, dr; + float x1, y1, x2, y2; -#if 1 +#if 0 + RECT sr, dr; getfilterrect2 (&sr, &dr, w_width, w_height, t_width, t_height, 1, t_width, t_height); xm = (float)required_texture_size / t_width; ym = (float)required_texture_size / t_height; @@ -480,6 +480,14 @@ static void OGL_dorender (int newtex) #else double fx, fy, xm, ym; + float multx, multy; + + multx = (currprefs.gfx_filter_horiz_zoom + 1000.0) / 1000.; + if (currprefs.gfx_filter_horiz_zoom_mult) + multx *= 1000.0 / currprefs.gfx_filter_horiz_zoom_mult; + multy = (currprefs.gfx_filter_vert_zoom + 1000.0) / 1000.; + if (currprefs.gfx_filter_vert_zoom_mult) + multy *= 1000.0 / currprefs.gfx_filter_vert_zoom_mult; xm = 2 >> currprefs.gfx_resolution; ym = currprefs.gfx_linedbl ? 1 : 2; @@ -500,8 +508,8 @@ static void OGL_dorender (int newtex) x1 = (float)(w_width * currprefs.gfx_filter_horiz_offset / 1000.0); y1 = (float)(w_height * currprefs.gfx_filter_vert_offset / 1000.0); - x2 = x1 + (float)((required_texture_size * w_width / t_width) * (currprefs.gfx_filter_horiz_zoom + 1000) / 1000.0); - y2 = y1 + (float)((required_texture_size * w_height / t_height) * (currprefs.gfx_filter_vert_zoom + 1000)/ 1000.0); + x2 = x1 + (float)((required_texture_size * w_width / t_width) * multx); + y2 = y1 + (float)((required_texture_size * w_height / t_height) * multy); x1 -= fx; y1 -= fy; x2 += 2 * fx; y2 += 2 * fy; diff --git a/od-win32/rp.c b/od-win32/rp.c index ce161265..3119a52a 100755 --- a/od-win32/rp.c +++ b/od-win32/rp.c @@ -211,6 +211,35 @@ static int port_insert (int num, const char *name) } } +static BOOL RPPostMessagex(UINT uMessage, WPARAM wParam, LPARAM lParam, const RPGUESTINFO *pInfo) +{ + BOOL v = FALSE; + static int cnt; + int ncnt; + int dolog = log_rp; + + if (!pInfo) { + write_log ("RPPOST: pInfo == NULL!\n"); + return FALSE; + } + if (uMessage == RPIPCGM_DEVICESEEK) + dolog = 0; + recursive++; + cnt++; + ncnt = cnt; + if (dolog) + write_log ("RPPOST_%d->\n", ncnt); + v = RPPostMessage (uMessage, wParam, lParam, pInfo); + recursive--; + if (dolog) { + write_log ("RPPOST_%d(%s [%d], %08x, %08x)\n", ncnt, + getmsg (uMessage), uMessage - WM_APP, wParam, lParam); + if (v == FALSE) + write_log("ERROR %d\n", GetLastError ()); + } + return v; +} + static BOOL RPSendMessagex (UINT uMessage, WPARAM wParam, LPARAM lParam, LPCVOID pData, DWORD dwDataSize, const RPGUESTINFO *pInfo, LRESULT *plResult) { @@ -597,10 +626,11 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM char *s = ua ((WCHAR*)pData); DWORD ret = FALSE; if (s == NULL) { - savestate_initsave (NULL, 0, 0); + savestate_initsave (NULL, 0, TRUE); return 1; } if (vpos == 0) { + savestate_initsave ("", 1, TRUE); save_state (s, "AF2008"); ret = 1; } else { @@ -867,7 +897,7 @@ void rp_floppy_track (int floppy, int track) { if (!cando ()) return; - RPSendMessagex (RPIPCGM_DEVICESEEK, MAKEWORD (RP_DEVICE_FLOPPY, floppy), track, NULL, 0, &guestinfo, NULL); + RPPostMessagex (RPIPCGM_DEVICESEEK, MAKEWORD (RP_DEVICE_FLOPPY, floppy), track, &guestinfo); } void rp_update_leds (int led, int onoff, int write) @@ -885,8 +915,8 @@ void rp_update_leds (int led, int onoff, int write) case 2: case 3: case 4: - RPSendMessage (RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICE_FLOPPY, led - 1), - MAKELONG (onoff ? -1 : 0, write ? RP_DEVICEACTIVITY_WRITE : RP_DEVICEACTIVITY_READ) , NULL, 0, &guestinfo, NULL); + RPPostMessagex (RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICE_FLOPPY, led - 1), + MAKELONG (onoff ? -1 : 0, write ? RP_DEVICEACTIVITY_WRITE : RP_DEVICEACTIVITY_READ) , &guestinfo); break; } } @@ -898,8 +928,8 @@ void rp_hd_activity (int num, int onoff, int write) if (num < 0) return; if (onoff) - RPSendMessage (RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICE_HD, num), - MAKELONG (200, write ? RP_DEVICEACTIVITY_WRITE : RP_DEVICEACTIVITY_READ), NULL, 0, &guestinfo, NULL); + RPPostMessagex (RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICE_HD, num), + MAKELONG (200, write ? RP_DEVICEACTIVITY_WRITE : RP_DEVICEACTIVITY_READ), &guestinfo); } void rp_cd_activity (int num, int onoff) @@ -913,8 +943,8 @@ void rp_cd_activity (int num, int onoff) RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICE_CD, cd_mask, NULL, 0, &guestinfo, NULL); } if (onoff) { - RPSendMessage (RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICE_CD, num), - MAKELONG (200, RP_DEVICEACTIVITY_READ), NULL, 0, &guestinfo, NULL); + RPPostMessage (RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICE_CD, num), + MAKELONG (200, RP_DEVICEACTIVITY_READ), &guestinfo); } } diff --git a/od-win32/sounddep/sound.c b/od-win32/sounddep/sound.c index d76c5e82..4b31cfc9 100755 --- a/od-win32/sounddep/sound.c +++ b/od-win32/sounddep/sound.c @@ -82,7 +82,7 @@ int setup_sound (void) static int isvsync(void) { - return (currprefs.gfx_avsync && currprefs.gfx_afullscreen) ? 1 : 0; + return currprefs.gfx_avsync && currprefs.gfx_afullscreen; } int scaled_sample_evtime_orig; @@ -93,7 +93,7 @@ void update_sound (int freq) freq = lastfreq; lastfreq = freq; if (have_sound) { - if (isvsync() || currprefs.chipset_refreshrate) { + if (isvsync () || currprefs.chipset_refreshrate) { if (currprefs.ntscmode) scaled_sample_evtime_orig = (unsigned long)(MAXHPOS_NTSC * MAXVPOS_NTSC * freq * CYCLE_UNIT + obtainedfreq - 1) / obtainedfreq; else diff --git a/od-win32/win32.c b/od-win32/win32.c index 3fbcc364..1772ae31 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -76,6 +76,7 @@ extern int harddrive_dangerous, do_rdbdump, aspi_allow_all, no_rawinput; int log_scsi, log_net, uaelib_debug; +int pissoff_value = 10000; extern FILE *debugfile; extern int console_logging; @@ -1273,7 +1274,7 @@ void handle_events (void) manual_painting_needed++; gui_fps (0, 0); } - if (PeekMessage (&msg, 0, 0, 0, PM_REMOVE)) { + while (PeekMessage (&msg, 0, 0, 0, PM_REMOVE)) { TranslateMessage (&msg); DispatchMessage (&msg); } @@ -2206,13 +2207,13 @@ void set_path (char *name, char *path) if (!strcmp (name, "KickstartPath")) { DWORD v = GetFileAttributes (tmp); if (v == INVALID_FILE_ATTRIBUTES || !(v & FILE_ATTRIBUTE_DIRECTORY)) - get_rom_path(tmp, 0); + get_rom_path (tmp, 0); if ((af_path_2005 & 1) && path_type == PATH_TYPE_NEWAF) { - get_rom_path(tmp, 1); + get_rom_path (tmp, 1); } else if ((af_path_2005 & 2) && path_type == PATH_TYPE_AMIGAFOREVERDATA) { - get_rom_path(tmp, 2); + get_rom_path (tmp, 2); } else if (af_path_old && path_type == PATH_TYPE_OLDAF) { - get_rom_path(tmp, 3); + get_rom_path (tmp, 3); } } fixtrailing (tmp); @@ -2728,13 +2729,23 @@ static void getstartpaths (void) } strcpy (tmp, start_path_exe); - strcat (tmp, "..\\shared\\rom\\rom.key"); + strcat (tmp, "..\\system\\rom\\rom.key"); v = GetFileAttributes (tmp); if (v != INVALID_FILE_ATTRIBUTES) { af_path_old = 1; strcpy (xstart_path_old, start_path_exe); - strcat (xstart_path_old, "..\\shared\\"); + strcat (xstart_path_old, "..\\system\\"); strcpy (start_path_af, xstart_path_old); + } else { + strcpy (tmp, start_path_exe); + strcat (tmp, "..\\shared\\rom\\rom.key"); + v = GetFileAttributes (tmp); + if (v != INVALID_FILE_ATTRIBUTES) { + af_path_old = 1; + strcpy (xstart_path_old, start_path_exe); + strcat (xstart_path_old, "..\\shared\\"); + strcpy (start_path_af, xstart_path_old); + } } p = getenv ("AMIGAFOREVERDATA"); @@ -2760,13 +2771,21 @@ static void getstartpaths (void) strcat (tmp, "WinUAE"); v = GetFileAttributes (tmp); if (v == INVALID_FILE_ATTRIBUTES || (v & FILE_ATTRIBUTE_DIRECTORY)) { + char *p; strcpy (xstart_path_new1, tmp2); strcat (xstart_path_new1, "WinUAE\\"); strcpy (xstart_path_uae, start_path_exe); strcpy (start_path_new1, xstart_path_new1); - strcat(tmp2, "System"); - if (isfilesindir (tmp2)) + p = tmp2 + strlen (tmp2); + strcpy (p, "System"); + if (isfilesindir (tmp2)) { af_path_2005 |= 1; + } else { + strcpy (p, "Shared"); + if (isfilesindir (tmp2)) { + af_path_2005 |= 1; + } + } } } } @@ -2800,10 +2819,17 @@ static void getstartpaths (void) if (af_path_2005 & 2) { strcpy (tmp, xstart_path_new2); strcat (tmp, "system\\rom"); - if (isfilesindir (tmp)) + if (isfilesindir (tmp)) { path_type = PATH_TYPE_AMIGAFOREVERDATA; - else - path_type = PATH_TYPE_NEWWINUAE; + } else { + strcpy (tmp, xstart_path_new2); + strcat (tmp, "shared\\rom"); + if (isfilesindir (tmp)) { + path_type = PATH_TYPE_AMIGAFOREVERDATA; + } else { + path_type = PATH_TYPE_NEWWINUAE; + } + } strcpy (start_path_data, xstart_path_new2); } } @@ -2998,6 +3024,11 @@ static int process_arg(char **xargv) minidumpmode = getval (np); continue; } + if (!strcmp (arg, "-jitevent")) { + i++; + pissoff_value = getval (np); + continue; + } #ifdef RETROPLATFORM if (!strcmp (arg, "-rphost")) { i++; diff --git a/od-win32/win32.h b/od-win32/win32.h index 1579e92d..f16d33d1 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 22 +#define WINUAEBETA 23 #define WINUAEPUBLICBETA 1 -#define WINUAEDATE MAKEBD(2008, 6, 5) +#define WINUAEDATE MAKEBD(2008, 6, 13) #define WINUAEEXTRA "" #define WINUAEREV "" diff --git a/od-win32/win32gfx.c b/od-win32/win32gfx.c index ed0d6f5d..065e129a 100755 --- a/od-win32/win32gfx.c +++ b/od-win32/win32gfx.c @@ -87,6 +87,7 @@ struct winuae_currentmode { int frequency; int initdone; int fullfill; + int vsync; LPPALETTEENTRY pal; }; @@ -682,7 +683,7 @@ uae_u8 *gfx_lock_picasso (void) if (!DirectDraw_SurfaceLock ()) return 0; picasso_vidinfo.rowbytes = DirectDraw_GetSurfacePitch (); - return (uae_u8*)DirectDraw_GetSurfacePointer (); + return DirectDraw_GetSurfacePointer (); } /* For the DX_Invalidate() and gfx_unlock_picasso() functions */ @@ -763,15 +764,20 @@ static void update_gfxparams (void) { updatewinfsmode (&currprefs); #ifdef PICASSO96 + currentmode->vsync = 0; if (screen_is_picasso && !scalepicasso) { currentmode->current_width = picasso96_state.Width; currentmode->current_height = picasso96_state.Height; currentmode->frequency = abs (currprefs.gfx_refreshrate > default_freq ? currprefs.gfx_refreshrate : default_freq); + if (currprefs.gfx_pvsync) + currentmode->vsync = 1; } else { #endif currentmode->current_width = currprefs.gfx_size.width; currentmode->current_height = currprefs.gfx_size.height; currentmode->frequency = abs (currprefs.gfx_refreshrate); + if (currprefs.gfx_avsync) + currentmode->vsync = 1; #ifdef PICASSO96 } #endif @@ -787,6 +793,8 @@ static void update_gfxparams (void) if (pbits >= 8) currentmode->current_depth = pbits; } + if (useoverlay && currentmode->current_depth > 16) + currentmode->current_depth = 16; currentmode->amiga_width = currentmode->current_width; currentmode->amiga_height = currentmode->current_height; } @@ -1250,8 +1258,6 @@ static int reopen (int full) currprefs.gfx_pvsync = changed_prefs.gfx_pvsync; currprefs.gfx_refreshrate = changed_prefs.gfx_refreshrate; - - if (!quick) return 1; @@ -1290,7 +1296,7 @@ static int modeswitchneeded (struct winuae_currentmode *wc) if (currentmode->current_width != wc->current_width || currentmode->current_height != wc->current_height || currentmode->current_depth != wc->current_depth) - return -1; + return -1; } } else if (isfullscreen () == 0) { /* windowed to windowed */ @@ -1759,6 +1765,8 @@ static void updatemodes (void) currentmode->flags = flags; if (flags & DM_SWSCALE) currentmode->fullfill = 1; + if (useoverlay && currentmode->current_depth > 16) + currentmode->current_depth = 16; } static BOOL doInit (void) @@ -1916,7 +1924,7 @@ static BOOL doInit (void) picasso_vidinfo.depth = currentmode->current_depth; #endif - if ((currentmode->flags & DM_DDRAW) && !(currentmode->flags & (DM_D3D | DM_SWSCALE))) { + if ((currentmode->flags & DM_DDRAW) && !(currentmode->flags & (DM_D3D | DM_SWSCALE | DM_OPENGL))) { ; diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index da263698..6070c8a7 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -672,8 +672,8 @@ static struct romdata *scan_single_rom_2 (struct zfile *f) return 0; zfile_fread (rombuf, 1, size, f); if (cl > 0) { - if (decode_cloanto_rom_do (rombuf, size, size)) - cl = 0; + decode_cloanto_rom_do (rombuf, size, size); + cl = 0; } if (!cl) { rd = getromdatabydata (rombuf, size); @@ -963,10 +963,10 @@ int scan_roms (int show) for (i = 0; i < MAX_ROM_PATHS; i++) paths[i] = NULL; for (;;) { - keys = get_keyring(); + keys = get_keyring (); fetch_path ("KickstartPath", path, sizeof path); cnt += scan_roms_3 (fkey, paths, path); - if (1) { + if (TRUE) { for(i = 0; i < MAX_ROM_PATHS; i++) { ret = get_rom_path (path, i); if (ret < 0) @@ -988,7 +988,7 @@ int scan_roms (int show) scan_roms_3 (fkey, paths, workprefs.path_rom); for (i = 0; i < MAX_ROM_PATHS; i++) - xfree(paths[i]); + xfree (paths[i]); fkey2 = regcreatetree (NULL, "DetectedROMS"); if (fkey2) { @@ -5449,7 +5449,6 @@ static INT_PTR CALLBACK MemoryDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA case WM_COMMAND: { - uae_u32 mask = workprefs.picasso96_modeflags; if (recursive > 0) break; recursive++; @@ -5463,6 +5462,7 @@ static INT_PTR CALLBACK MemoryDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA break; } if (HIWORD (wParam) == CBN_SELENDOK || HIWORD (wParam) == CBN_KILLFOCUS || HIWORD (wParam) == CBN_EDITCHANGE) { + uae_u32 mask = workprefs.picasso96_modeflags; switch (LOWORD (wParam)) { case IDC_RTG_8BIT: @@ -5516,9 +5516,9 @@ static INT_PTR CALLBACK MemoryDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA } break; } + workprefs.picasso96_modeflags = mask; + values_to_memorydlg (hDlg); } - workprefs.picasso96_modeflags = mask; - values_to_memorydlg (hDlg); recursive--; } break; @@ -8724,13 +8724,13 @@ static void values_from_portsdlg (HWND hDlg) #endif } - workprefs.win32_midioutdev = SendDlgItemMessage(hDlg, IDC_MIDIOUTLIST, CB_GETCURSEL, 0, 0); + workprefs.win32_midioutdev = SendDlgItemMessage (hDlg, IDC_MIDIOUTLIST, CB_GETCURSEL, 0, 0); workprefs.win32_midioutdev -= 2; if( bNoMidiIn) { workprefs.win32_midiindev = -1; } else { - workprefs.win32_midiindev = SendDlgItemMessage(hDlg, IDC_MIDIINLIST, CB_GETCURSEL, 0, 0); + workprefs.win32_midiindev = SendDlgItemMessage (hDlg, IDC_MIDIINLIST, CB_GETCURSEL, 0, 0); } ew (hDlg, IDC_MIDIINLIST, workprefs.win32_midioutdev < -1 ? FALSE : TRUE); @@ -8770,7 +8770,7 @@ static void values_to_portsdlg (HWND hDlg) if(workprefs.prtname[0]) { int i, got = 1; char tmp[10]; - result = SendDlgItemMessage(hDlg, IDC_PRINTERLIST, CB_FINDSTRINGEXACT, -1, (LPARAM)workprefs.prtname); + result = SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_FINDSTRINGEXACT, -1, (LPARAM)workprefs.prtname); for (i = 0; i < 4; i++) { sprintf (tmp, "LPT%d", i + 1); if (!strcmp (tmp, workprefs.prtname)) { @@ -8783,30 +8783,30 @@ static void values_to_portsdlg (HWND hDlg) if(result < 0 || got == 0) { // Warn the user that their printer-port selection is not valid on this machine char szMessage[MAX_DPATH]; - WIN32GUI_LoadUIString(IDS_INVALIDPRTPORT, szMessage, MAX_DPATH); + WIN32GUI_LoadUIString (IDS_INVALIDPRTPORT, szMessage, MAX_DPATH); pre_gui_message (szMessage); // Disable the invalid parallel-port selection workprefs.prtname[0] = 0; result = 0; } } - SetDlgItemInt(hDlg, IDC_PRINTERAUTOFLUSH, workprefs.parallel_autoflush_time, FALSE); - CheckDlgButton(hDlg, IDC_PSPRINTER, workprefs.parallel_postscript_emulation); - CheckDlgButton(hDlg, IDC_PSPRINTERDETECT, workprefs.parallel_postscript_detection); - SetDlgItemText(hDlg, IDC_PS_PARAMS, workprefs.ghostscript_parameters); + SetDlgItemInt (hDlg, IDC_PRINTERAUTOFLUSH, workprefs.parallel_autoflush_time, FALSE); + CheckDlgButton (hDlg, IDC_PSPRINTER, workprefs.parallel_postscript_emulation); + CheckDlgButton (hDlg, IDC_PSPRINTERDETECT, workprefs.parallel_postscript_detection); + SetDlgItemText (hDlg, IDC_PS_PARAMS, workprefs.ghostscript_parameters); - SendDlgItemMessage(hDlg, IDC_PRINTERLIST, CB_SETCURSEL, result, 0); - SendDlgItemMessage(hDlg, IDC_MIDIOUTLIST, CB_SETCURSEL, workprefs.win32_midioutdev + 2, 0); + SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_SETCURSEL, result, 0); + SendDlgItemMessage (hDlg, IDC_MIDIOUTLIST, CB_SETCURSEL, workprefs.win32_midioutdev + 2, 0); if (!bNoMidiIn && workprefs.win32_midiindev >= 0) - SendDlgItemMessage(hDlg, IDC_MIDIINLIST, CB_SETCURSEL, workprefs.win32_midiindev, 0); + SendDlgItemMessage (hDlg, IDC_MIDIINLIST, CB_SETCURSEL, workprefs.win32_midiindev, 0); else - SendDlgItemMessage(hDlg, IDC_MIDIINLIST, CB_SETCURSEL, 0, 0); + SendDlgItemMessage (hDlg, IDC_MIDIINLIST, CB_SETCURSEL, 0, 0); ew (hDlg, IDC_MIDIINLIST, workprefs.win32_midioutdev < -1 ? FALSE : TRUE); - CheckDlgButton(hDlg, IDC_UAESERIAL, workprefs.uaeserial); - CheckDlgButton(hDlg, IDC_SER_SHARED, workprefs.serial_demand); - CheckDlgButton(hDlg, IDC_SER_CTSRTS, workprefs.serial_hwctsrts); - CheckDlgButton(hDlg, IDC_SER_DIRECT, workprefs.serial_direct); + CheckDlgButton (hDlg, IDC_UAESERIAL, workprefs.uaeserial); + CheckDlgButton (hDlg, IDC_SER_SHARED, workprefs.serial_demand); + CheckDlgButton (hDlg, IDC_SER_CTSRTS, workprefs.serial_hwctsrts); + CheckDlgButton (hDlg, IDC_SER_DIRECT, workprefs.serial_direct); if(!workprefs.sername[0]) { SendDlgItemMessage (hDlg, IDC_SERIAL, CB_SETCURSEL, 0, 0L); @@ -8866,12 +8866,12 @@ static void init_portsdlg (HWND hDlg) if(!pInfo) { int flags = PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS; DWORD needed = 0; - EnumPrinters(flags, NULL, 1, (LPBYTE)pInfo, 0, &needed, &dwEnumeratedPrinters); + EnumPrinters (flags, NULL, 1, (LPBYTE)pInfo, 0, &needed, &dwEnumeratedPrinters); if (needed > 0) { DWORD size = needed; pInfo = xcalloc (1, size); dwEnumeratedPrinters = 0; - EnumPrinters(flags, NULL, 1, (LPBYTE)pInfo, size, &needed, &dwEnumeratedPrinters); + EnumPrinters (flags, NULL, 1, (LPBYTE)pInfo, size, &needed, &dwEnumeratedPrinters); } if (dwEnumeratedPrinters == 0) { xfree (pInfo); @@ -8993,13 +8993,13 @@ static char *eventnames[INPUTEVENT_END]; static void values_to_inputdlg (HWND hDlg) { - SendDlgItemMessage(hDlg, IDC_INPUTTYPE, CB_SETCURSEL, workprefs.input_selected_setting, 0); - SendDlgItemMessage(hDlg, IDC_INPUTDEVICE, CB_SETCURSEL, input_selected_device, 0); - SetDlgItemInt(hDlg, IDC_INPUTDEADZONE, workprefs.input_joystick_deadzone, FALSE); - SetDlgItemInt(hDlg, IDC_INPUTAUTOFIRERATE, workprefs.input_autofire_framecnt, FALSE); - SetDlgItemInt(hDlg, IDC_INPUTSPEEDD, workprefs.input_joymouse_speed, FALSE); - SetDlgItemInt(hDlg, IDC_INPUTSPEEDA, workprefs.input_joymouse_multiplier, FALSE); - SetDlgItemInt(hDlg, IDC_INPUTSPEEDM, workprefs.input_mouse_speed, FALSE); + SendDlgItemMessage (hDlg, IDC_INPUTTYPE, CB_SETCURSEL, workprefs.input_selected_setting, 0); + SendDlgItemMessage (hDlg, IDC_INPUTDEVICE, CB_SETCURSEL, input_selected_device, 0); + SetDlgItemInt (hDlg, IDC_INPUTDEADZONE, workprefs.input_joystick_deadzone, FALSE); + SetDlgItemInt (hDlg, IDC_INPUTAUTOFIRERATE, workprefs.input_autofire_framecnt, FALSE); + SetDlgItemInt (hDlg, IDC_INPUTSPEEDD, workprefs.input_joymouse_speed, FALSE); + SetDlgItemInt (hDlg, IDC_INPUTSPEEDA, workprefs.input_joymouse_multiplier, FALSE); + SetDlgItemInt (hDlg, IDC_INPUTSPEEDM, workprefs.input_mouse_speed, FALSE); CheckDlgButton (hDlg, IDC_INPUTDEVICEDISABLE, (!input_total_devices || inputdevice_get_device_status (input_selected_device)) ? BST_CHECKED : BST_UNCHECKED); } @@ -10764,30 +10764,45 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) for (i = 0; i < cnt; i++) { struct romdata *rd = NULL; struct zfile *z; - int type = -1; + int type = -1, zip = 0; DragQueryFile (hd, i, file, sizeof (file)); flags = GetFileAttributes (file); if (flags & FILE_ATTRIBUTE_DIRECTORY) type = ZFILE_HDF; if (type < 0) { - z = zfile_fopen (file, "rb"); - if (z) { - type = zfile_gettype (z); - rd = getromdatabyzfile (z); - zfile_fclose (z); - z = NULL; + if (currentpage < 0) { + z = zfile_fopen_nozip (file, "rb"); + if (z) { + if (iszip (z)) + zip = 1; + zfile_fclose (z); + } + } + if (!zip) { + z = zfile_fopen (file, "rb"); + if (z) { + if (currentpage < 0 && iszip (z)) { + zip = 1; + } else { + type = zfile_gettype (z); + if (type == ZFILE_ROM) + rd = getromdatabyzfile (z); + } + zfile_fclose (z); + z = NULL; + } } } - if (currentpage < 0 && i == 0) { - if (do_filesys_insert (file)) - continue; + if (zip) { + do_filesys_insert (file); + continue; } switch (type) { - case ZFILE_DISKIMAGE: + case ZFILE_DISKIMAGE: if (currentpage == DISK_ID) { list = 0; while (list < MAX_SPARE_DRIVES) { @@ -10844,6 +10859,10 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) 32, 1, 2, 512, 0, NULL, 0, 0); } break; + case ZFILE_HDFRDB: + add_filesys_config (&workprefs, -1, NULL, NULL, file, 0, + 0, 0, 0, 512, 0, NULL, 0, 0); + break; case ZFILE_NVR: strcpy (prefs->flashfile, file); break; diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 71e992a7..e537cb00 100755 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,21 @@ +Beta 23: + +- OGL/D3D fixed but uses old scaling method (update after 1.5) +- AF2008 ROM scanner detection problems really fixed +- JIT timing change test (perhaps faster CPU without other + side-effects..), added command line parameter -jitevent + current default 10000, old was 3000. Experiment if interested.. +- default display buffer setting changed to "DefaultRAM" (which + is same as in 1.4.6 and older, can cause too much confusion + if new version even in non-Picasso96 mode is much slower than + old version due to weird display drivers) +- disk write does not start if wordsync is enabled +- improved rare heavy CPU usage situation when sync word=0 + without disk inserted +- improved dragndrop file type autodetection +- ignore duplicate directinput joystick axis indexes + Beta 22: (To do: OGL/D3D scaling options. bleh.) - AF2008 non-KS/extended ROMs didn't decrypt properly @@ -9,8 +26,8 @@ Beta 22: (To do: OGL/D3D scaling options. bleh.) - Action Replay 3 v3.09 even/odd ROM checksums added (roms dumped, thanks to Jope for adding ROM sockets to my AR3). First four bytes, io-addresses that can't be dumped using software dump method, are - 0x50 0x00 0x00 0x00 (how boring..) -- possible fix for slow GUI Memory-panel + 0x50 0x00 0x00 0x00. (how boring..) +- possible fix for sluggish GUI Memory-panel Beta 21: diff --git a/od-win32/writelog.c b/od-win32/writelog.c index 54c96346..87854960 100755 --- a/od-win32/writelog.c +++ b/od-win32/writelog.c @@ -4,6 +4,7 @@ #include #include +#include "options.h" #include "custom.h" #include "events.h" #include "debug.h" diff --git a/savestate.c b/savestate.c index 014cacb6..250382f8 100755 --- a/savestate.c +++ b/savestate.c @@ -81,7 +81,7 @@ static int replaybuffersize; char savestate_fname[MAX_DPATH]; static struct staterecord staterecords[MAX_STATERECORDS]; -static void state_incompatible_warn(void) +static void state_incompatible_warn (void) { static int warned; int dowarn = 0; diff --git a/zfile.c b/zfile.c index 077e577e..129816de 100755 --- a/zfile.c +++ b/zfile.c @@ -121,16 +121,20 @@ int zfile_gettype (struct zfile *z) return ZFILE_NVR; if (strcasecmp (ext, "uae") == 0) return ZFILE_CONFIGURATION; - if (strcasecmp (ext, "hdf") == 0) - return ZFILE_HDF; - if (strcasecmp (ext, "hdz") == 0) - return ZFILE_HDF; } memset (buf, 0, sizeof (buf)); zfile_fread (buf, 8, 1, z); zfile_fseek (z, -8, SEEK_CUR); if (!memcmp (buf, exeheader, sizeof(buf))) return ZFILE_DISKIMAGE; + if (!memcmp (buf, "RDSK", 4)) + return ZFILE_HDFRDB; + if (ext != NULL) { + if (strcasecmp (ext, "hdf") == 0) + return ZFILE_HDF; + if (strcasecmp (ext, "hdz") == 0) + return ZFILE_HDF; + } return ZFILE_UNKNOWN; } @@ -442,7 +446,7 @@ static struct zfile *zfile_opensinglefile(struct zfile *l) } #endif -static struct zfile *zfile_fopen_nozip (const char *name, const char *mode) +struct zfile *zfile_fopen_nozip (const char *name, const char *mode) { struct zfile *l; FILE *f; @@ -635,9 +639,8 @@ struct zfile *zfile_fopen_empty (const char *name, int size) l = zfile_create (); l->name = name ? strdup (name) : ""; if (size) { - l->data = xmalloc (size); + l->data = xcalloc (size, 1); l->size = size; - memset (l->data, 0, size); } else { l->data = xcalloc (1, 1); l->size = 0;