diff --git a/src/dummy.cpp b/src/dummy.cpp index 9ab110ebf..793d5c3f9 100644 --- a/src/dummy.cpp +++ b/src/dummy.cpp @@ -1939,7 +1939,7 @@ void target_default_options(uae_prefs*, int) { static int old_w = -1; static int old_h = -1; -bool target_graphics_buffer_update(int monid) { +bool target_graphics_buffer_update(int monid, bool force) { struct vidbuf_description* avidinfo = &adisplays[monid].gfxvidinfo; struct vidbuffer* vb = avidinfo->drawbuffer.tempbufferinuse ? &avidinfo->tempbuffer : &avidinfo->drawbuffer; diff --git a/uae_src/arcadia.cpp b/uae_src/arcadia.cpp index a0f8b9ad8..a00d063fa 100644 --- a/uae_src/arcadia.cpp +++ b/uae_src/arcadia.cpp @@ -28,6 +28,7 @@ #include "statusline.h" #include "rommgr.h" #include "flashrom.h" +#include "savestate.h" #include "devices.h" #define CUBO_DEBUG 1 @@ -66,6 +67,7 @@ static void multigame (int); int arcadia_flag, arcadia_coin[2]; struct arcadiarom *arcadia_bios, *arcadia_game; +static int arcadia_hsync_cnt; static struct arcadiarom roms[] = { @@ -478,6 +480,11 @@ static void nvram_read (void) static void alg_vsync(void); static void cubo_vsync(void); + +static void arcadia_hsync(void) +{ + arcadia_hsync_cnt++; +} static void arcadia_vsync(void) { if (alg_flag) @@ -526,6 +533,8 @@ int arcadia_map_banks (void) multigame (0); map_banks (&arcadia_boot_bank, 0xf0, 8, 0); device_add_vsync_pre(arcadia_vsync); + device_add_hsync(arcadia_hsync); + arcadia_hsync_cnt = 0; return 1; } @@ -599,6 +608,8 @@ static uae_u8 algmemory[ALG_NVRAM_SIZE]; static int algmemory_modified; static int algmemory_initialized; static int alg_game_id; +static bool alg_picmatic; +static uae_u8 picmatic_io; static void alg_nvram_write (void) { @@ -639,6 +650,9 @@ static uae_u32 REGPARAM2 alg_wget (uaecptr addr) static uae_u32 REGPARAM2 alg_bget (uaecptr addr) { + if (alg_picmatic && (addr & 0xffff0000) == 0xf60000) { + return 0; + } uaecptr addr2 = addr; addr >>= 1; addr &= ALG_NVRAM_MASK; @@ -656,6 +670,12 @@ static void REGPARAM2 alg_wput (uaecptr addr, uae_u32 w) static void REGPARAM2 alg_bput (uaecptr addr, uae_u32 b) { + if (alg_picmatic && (addr & 0xffff0000) == 0xf60000) { + if (!(addr & 0xffff)) { + picmatic_io = b; + } + return; + } uaecptr addr2 = addr; addr >>= 1; addr &= ALG_NVRAM_MASK; @@ -674,20 +694,28 @@ static addrbank alg_ram_bank = { NULL, 65536 }; -static int ld_mode; +static int ld_mode, ld_mode_value; static uae_u32 ld_address, ld_value; +static uae_u32 ld_startaddress, ld_endaddress; +static uae_s32 ld_repcnt, ld_mark; static int ld_direction; +static bool ld_save_restore; #define LD_MODE_SEARCH 1 #define LD_MODE_PLAY 2 #define LD_MODE_STILL 3 #define LD_MODE_STOP 4 +#define LD_MODE_REPEAT 5 +#define LD_MODE_REPEAT2 6 +#define LD_MODE_MARK 7 #define ALG_SER_BUF_SIZE 16 static uae_u8 alg_ser_buf[ALG_SER_BUF_SIZE]; static int ser_buf_offset; static int ld_wait_ack; static int ld_audio; +static bool ld_video; static int ld_vsync; +static int alg_hsync_delay; static void sb(uae_u8 v) { @@ -697,7 +725,7 @@ static void sb(uae_u8 v) } static void ack(void) { - ld_wait_ack = 1; + ld_wait_ack = alg_hsync_delay + 30; sb(0x0a); // ACK } @@ -706,6 +734,38 @@ static void sony_serial_read(uae_u16 w) w &= 0xff; switch (w) { + case 0x26: // Video off + ld_video = false; + ack(); + if (log_ld) + write_log(_T("LD: Video off\n")); + break; + case 0x27: // Video on + ld_video = true; + ack(); + if (log_ld) + write_log(_T("LD: Video on\n")); + break; + case 0x2b: // FWD Step + ld_address++; + getsetpositionvideograb(ld_address); + ld_mode = LD_MODE_STILL; + ld_direction = 0; + ack(); + if (log_ld) + write_log(_T("LD: FWD step\n")); + break; + case 0x2c: // REV Step + if (ld_address) { + ld_address--; + } + getsetpositionvideograb(ld_address); + ld_mode = LD_MODE_STILL; + ld_direction = 0; + ack(); + if (log_ld) + write_log(_T("LD: REV step\n")); + break; case 0x30: // '0' case 0x31: case 0x32: @@ -726,6 +786,7 @@ static void sony_serial_read(uae_u16 w) case 0x3a: // F-PLAY ':' ld_mode = LD_MODE_PLAY; ld_direction = 0; + ld_repcnt = -1; pausevideograb(0); ack(); if (log_ld) @@ -739,23 +800,65 @@ static void sony_serial_read(uae_u16 w) case 0x3f: // STOP '?' pausevideograb(1); ld_direction = 0; + ld_repcnt = -1; ld_mode = LD_MODE_STOP; ack(); if (log_ld) write_log(_T("LD: STOP\n")); break; - case 0x40: // '@' - if (ld_mode == LD_MODE_SEARCH) { + case 0x40: // ENTER '@' + if (ld_mode_value == LD_MODE_MARK) { + ld_mode_value = 0; + ld_mark = ld_value; + ack(); + if (log_ld) { + write_log(_T("LD: SET MARK %d\n"), ld_mark); + } + } else if (ld_mode_value == LD_MODE_REPEAT) { + ld_direction = 0; + ld_endaddress = ld_value; + ld_startaddress = ld_address; + ld_value = 0; + ld_mode_value = LD_MODE_REPEAT2; + ack(); + } else if (ld_mode_value == LD_MODE_REPEAT2) { + ld_repcnt = ld_value; + ld_address = ld_startaddress; + if (ld_startaddress > ld_endaddress) { + ld_direction = -1; + } + ld_mode_value = 0; + ld_mode = LD_MODE_PLAY; + pausevideograb(0); + ack(); + if (log_ld) { + write_log(_T("LD: REPEAT CNT=%d, %d TO %d\n"), ld_repcnt, ld_startaddress, ld_endaddress); + } + } else if (ld_mode_value == LD_MODE_SEARCH) { + uae_s32 endpos = (uae_s32)getdurationvideograb(); ld_address = ld_value; - getsetpositionvideograb(ld_address); + ack(); + if (ld_address > endpos) { + ld_address = endpos; + getsetpositionvideograb(ld_address); + sb(0x06); // NO FRAME NUMBER + } else { + getsetpositionvideograb(ld_address); + sb(0x01); // COMPLETION + } ld_mode = LD_MODE_STILL; + ld_mode_value = 0; ld_direction = 0; - ack(); - sb(0x01); // COMPLETION if (log_ld) write_log(_T("LD: SEARCH %d\n"), ld_value); } break; + case 0x41: // Clear entry + ld_value = 0; + ack(); + if (log_ld) + write_log(_T("LD: CLEAR ENTRY\n"), ld_value); + break; case 0x4a: // R-PLAY 'J' ld_mode = LD_MODE_PLAY; pausevideograb(1); @@ -782,40 +885,48 @@ static void sony_serial_read(uae_u16 w) break; case 0x43: // SEARCH 'C' ack(); - ld_mode = LD_MODE_SEARCH; + ld_mode = LD_MODE_STILL; + ld_mode_value = LD_MODE_SEARCH; ld_direction = 0; pausevideograb(1); ld_value = 0; if (log_ld) write_log(_T("LD: SEARCH\n")); break; + case 0x44: // Repeat 'D' + ack(); + ld_mode_value = LD_MODE_REPEAT; + ld_direction = 0; + pausevideograb(1); + ld_value = 0; + if (log_ld) + write_log(_T("LD: REPEAT\n")); + break; case 0x46: // CH-1 ON 'F' ack(); ld_audio |= 1; - setvolumevideograb(100 - currprefs.sound_volume_genlock); + setchflagsvideograb(ld_audio); if (log_ld) write_log(_T("LD: CH-1 ON\n")); break; case 0x48: // CH-2 ON 'H' ack(); ld_audio |= 2; - setvolumevideograb(100 - currprefs.sound_volume_genlock); + setchflagsvideograb(ld_audio); if (log_ld) write_log(_T("LD: CH-2 ON\n")); break; case 0x47: // CH-1 OFF 'G' ack(); ld_audio &= ~1; - if (!ld_audio) - setvolumevideograb(0); + setchflagsvideograb(ld_audio); if (log_ld) write_log(_T("LD: CH-1 OFF\n")); break; case 0x49: // CH-2 OFF 'I' ack(); ld_audio &= ~2; - if (!ld_audio) - setvolumevideograb(0); + setchflagsvideograb(ld_audio); if (log_ld) write_log(_T("LD: CH-2 OFF\n")); break; @@ -829,9 +940,19 @@ static void sony_serial_read(uae_u16 w) if (log_ld) write_log(_T("LD: INDEX OFF\n")); break; - case 0x56: // CL + case 0x55: // Frame mode 'U' + ack(); + if (log_ld) + write_log(_T("LD: Frame Mode\n")); + break; + case 0x56: // Clear 'V' ld_mode = LD_MODE_STILL; + ld_repcnt = -1; + ld_mark = -1; + ld_mode_value = 0; ld_direction = 0; + ld_video = true; + ld_value = 0; pausevideograb(1); ack(); if (log_ld) @@ -839,7 +960,7 @@ static void sony_serial_read(uae_u16 w) break; case 0x60: // ADDR INQ '`' { - if (isvideograb() && ld_direction == 0) { + if (!ld_save_restore && isvideograb() && ld_direction == 0) { ld_address = (uae_u32)getsetpositionvideograb(-1); } uae_u32 v = ld_address; @@ -857,11 +978,26 @@ static void sony_serial_read(uae_u16 w) sb(0x80); sb(0x00); sb(0x40); - sb((ld_mode == LD_MODE_SEARCH ? 0x02 : 0x00)); + sb((ld_mode_value == LD_MODE_SEARCH ? 0x02 : 0x00) | (ld_mode_value == LD_MODE_REPEAT ? 0x04 : 0x00) | (ld_mode_value ? 0x01 : 0x00) | (ld_mode_value == LD_MODE_REPEAT2 ? 0x20 : 0x00)); sb((ld_mode == LD_MODE_PLAY ? 0x01 : 0x00) | (ld_mode == LD_MODE_STILL ? 0x20 : 0x00) | (ld_mode == LD_MODE_STOP ? 0x40 : 0x00) | (ld_direction < 0 ? 0x80 : 0x00)); if (log_ld > 1) write_log(_T("LD: STATUS INQ\n")); break; + case 0x73: // MARK SET 's' + ld_value = 0; + ld_mode_value = LD_MODE_MARK; + ack(); + if (log_ld) + write_log(_T("LD: MARK SET\n")); + break; + case 0x82: // User Index Off + ack(); + if (log_ld) + write_log(_T("LD: USER INDEX OFF\n")); + break; + default: + write_log(_T("LD: Unemulated command %02x\n"), w); + break; } } @@ -872,9 +1008,23 @@ bool alg_ld_active(void) static void alg_vsync(void) { - ld_wait_ack = 0; ld_vsync++; + if (ld_save_restore) { + if (ld_address == 0 || getsetpositionvideograb(ld_address) > 0) { + ld_save_restore = false; + setchflagsvideograb(ld_audio); + } + if (ld_save_restore) { + return; + } + } + if (ld_mode == LD_MODE_PLAY) { + if (log_ld && (ld_vsync & 63) == 0) { + uae_s64 pos = getsetpositionvideograb(-1); + write_log(_T("LD: frame %lld\n"), pos); + } + pausevideograb(0); if (ld_direction < 0) { if (ld_address > 0) { ld_address -= (-ld_direction); @@ -894,6 +1044,44 @@ static void alg_vsync(void) } } } + if (ld_repcnt >= 0 || ld_mark >= 0) { + uae_s64 f = getsetpositionvideograb(-1); + if (ld_repcnt >= 0) { + if ((ld_direction >= 0 && f >= ld_endaddress) || (ld_direction < 0 && f <= ld_endaddress)) { + if (ld_repcnt > 0) { + ld_repcnt--; + if (ld_repcnt == 0) { + sb(0x01); // Repeat complete + if (log_ld) { + write_log(_T("LD: Repeat complete\n")); + } + ld_repcnt = -1; + } else { + ld_address = ld_startaddress; + getsetpositionvideograb(ld_address); + if (log_ld) { + write_log(_T("LD: Repeat %d from %d\n"), ld_repcnt, ld_startaddress); + } + } + } else { + ld_address = ld_startaddress; + getsetpositionvideograb(ld_address); + if (log_ld) { + write_log(_T("LD: Repeat %d from %d\n"), ld_repcnt, ld_startaddress); + } + } + } + } + if (ld_mark == f || ld_mark == f + 1 || ld_mark == f + 2) { + sb(0x07); // MARK RETURN + if (log_ld) { + write_log(_T("LD: Mark return %d\n"), ld_mark); + } + ld_mark = -1; + } + } + } else { + pausevideograb(1); } if (algmemory_modified > 0) { algmemory_modified--; @@ -907,8 +1095,11 @@ static int sony_serial_write(void) { if (ser_buf_offset > 0) { uae_u16 v = alg_ser_buf[0]; - if (v == 0x0a && ld_wait_ack) - return -1; + if (v == 0x0a) { + if (arcadia_hsync_cnt < ld_wait_ack) { + return -1; + } + } ser_buf_offset--; memmove(alg_ser_buf, alg_ser_buf + 1, ser_buf_offset); return v; @@ -936,12 +1127,19 @@ void ld_serial_read(uae_u16 w) int ld_serial_write(void) { + int v = -1; + if (arcadia_hsync_cnt < alg_hsync_delay) { + return -1; + } if (alg_flag || currprefs.genlock_image == 7) { - return sony_serial_write(); + v = sony_serial_write(); } else if (currprefs.genlock_image == 8) { - return pioneer_serial_write(); + v = pioneer_serial_write(); } - return -1; + if (v >= 0) { + alg_hsync_delay = arcadia_hsync_cnt + 2; + } + return v; } /* @@ -964,11 +1162,24 @@ Port 2: */ static uae_u16 alg_potgo; +static uae_u8 picmatic_parallel; + +uae_u8 alg_parallel_port(uae_u8 drb, uae_u8 v) +{ + picmatic_parallel = v; + //write_log("%02x\n", v); + return v; +} int alg_get_player(uae_u16 potgo) { - // 2nd button output and high = player 2. - return (potgo & 0xc000) == 0xc000 ? 1 : 0; + if (alg_picmatic) { + // Picmatic: parallel port bit 0 set = player 2 + return (picmatic_io & 1) ? 0 : 1; + } else { + // ALG: 2nd button output and high = player 2. + return (potgo & 0xc000) == 0xc000 ? 1 : 0; + } } uae_u16 alg_potgor(uae_u16 potgo) @@ -977,13 +1188,21 @@ uae_u16 alg_potgor(uae_u16 potgo) int ply = alg_get_player(alg_potgo); - potgo |= (0x1000 | 0x0100); - // trigger - if (((alg_flag & 128) && ply == 1) || ((alg_flag & 64) && ply == 0)) - potgo &= ~0x1000; - // right start - if (alg_flag & 8) - potgo &= ~0x0100; + if (alg_picmatic) { + potgo |= (0x1000 | 0x0100 | 0x4000 | 0x0400); + // right trigger + if (alg_flag & 128) + potgo &= ~0x1000; + + } else { + potgo |= (0x1000 | 0x0100); + // trigger + if (((alg_flag & 128) && ply == 1) || ((alg_flag & 64) && ply == 0)) + potgo &= ~0x1000; + // right start + if (alg_flag & 8) + potgo &= ~0x0100; + } return potgo; } @@ -993,34 +1212,74 @@ uae_u16 alg_joydat(int joy, uae_u16 v) return v; int ply = alg_get_player(alg_potgo); v = 0; - if (joy == 0) { - - // left coin - if (alg_flag & 16) - v |= 0x0200; - // right coin - if (alg_flag & 32) - v |= 0x0002; - - // service - if (alg_flag & 2) - v |= (v & 0x0200) ? 0x0000 : 0x0100; - else - v |= (v & 0x0200) ? 0x0100 : 0x0000; - // start - if (alg_flag & 4) - v |= (v & 0x0002) ? 0x0000: 0x0001; - else - v |= (v & 0x0002) ? 0x0001: 0x0000; - } else if (joy == 1) { + if (alg_picmatic) { - // holster - if (((alg_flag & 512) && ply == 0) || ((alg_flag & 256) && ply == 1)) - v |= (v & 0x0200) ? 0x0000 : 0x0100; - else - v |= (v & 0x0200) ? 0x0100 : 0x0000; + if (joy == 0) { + + // coin + if (alg_flag & (16 | 32)) + v |= 0x0002; + + // left start + if (alg_flag & 4) + v |= 0x0200; + + // service + if (alg_flag & 2) + v |= (v & 0x0200) ? 0x0000 : 0x0100; + else + v |= (v & 0x0200) ? 0x0100 : 0x0000; + // right start + if (alg_flag & 8) + v |= (v & 0x0002) ? 0x0000 : 0x0001; + else + v |= (v & 0x0002) ? 0x0001 : 0x0000; + + } else if (joy == 1) { + + // holster + if (alg_flag & 512) + v |= 0x0200; + + // left trigger + if (alg_flag & 64) + v |= 0x0002; + + } + + } else { + + if (joy == 0) { + + // left coin + if (alg_flag & 16) + v |= 0x0200; + // right coin + if (alg_flag & 32) + v |= 0x0002; + + // service + if (alg_flag & 2) + v |= (v & 0x0200) ? 0x0000 : 0x0100; + else + v |= (v & 0x0200) ? 0x0100 : 0x0000; + // left start + if (alg_flag & 4) + v |= (v & 0x0002) ? 0x0000: 0x0001; + else + v |= (v & 0x0002) ? 0x0001: 0x0000; + + } else if (joy == 1) { + + // holster + if (((alg_flag & 512) && ply == 0) || ((alg_flag & 256) && ply == 1)) + v |= (v & 0x0200) ? 0x0000 : 0x0100; + else + v |= (v & 0x0200) ? 0x0100 : 0x0000; + + } } return v; } @@ -1060,7 +1319,9 @@ struct romdata *get_alg_rom(const TCHAR *name) void alg_map_banks(void) { - alg_flag = 1; + if (!savestate_state) { + alg_flag = 1; + } if (!algmemory_initialized) { alg_nvram_read(); algmemory_initialized = 1; @@ -1074,16 +1335,104 @@ void alg_map_banks(void) map_banks(&alg_ram_bank, 0xf7, 1, 0); } alg_game_id = rd->id; + alg_picmatic = rd->id == 198 || rd->id == 301 || rd->id == 302; + if (alg_picmatic) { + map_banks(&alg_ram_bank, 0xf6, 1, 0); + } pausevideograb(1); - ld_audio = 0; - ld_mode = 0; - ld_wait_ack = 0; - ld_direction = 0; - ser_buf_offset = 0; + + currprefs.cs_floppydatapullup = changed_prefs.cs_floppydatapullup = true; device_add_vsync_pre(arcadia_vsync); + device_add_hsync(arcadia_hsync); if (!currprefs.genlock) { currprefs.genlock = changed_prefs.genlock = 1; } + + ld_save_restore = false; + if (savestate_state == STATE_RESTORE) { + if (ld_mode == LD_MODE_PLAY || ld_mode == LD_MODE_STILL) { + ld_save_restore = true; + } + } else { + picmatic_io = 0; + ld_repcnt = -1; + ld_mark = -1; + ld_audio = 0; + ld_video = true; + ld_mode = 0; + ld_wait_ack = 0; + ld_direction = 0; + ser_buf_offset = 0; + alg_hsync_delay = 0; + arcadia_hsync_cnt = 0; + } +} + +uae_u8 *restore_alg(uae_u8 *src) +{ + uae_u32 flags = restore_u32(); + alg_flag = restore_u32(); + ld_value = restore_u32(); + ld_address = restore_u32(); + ld_startaddress = restore_u32(); + ld_endaddress = restore_u32(); + ld_repcnt = restore_u32(); + ld_mark = restore_u32(); + ld_wait_ack = restore_u32(); + alg_hsync_delay = restore_u32(); + arcadia_hsync_cnt = restore_u32(); + ld_audio = restore_u8(); + ld_video = restore_u8(); + ld_mode = restore_u8(); + ld_mode_value = restore_u8(); + ld_direction = restore_u8(); + picmatic_io = restore_u8(); + picmatic_parallel = restore_u8(); + ser_buf_offset = restore_u8(); + for (int i = 0; i < ser_buf_offset; i++) { + alg_ser_buf[i] = restore_u8(); + } + ld_vsync = restore_u32(); + return src; +} + +uae_u8 *save_alg(size_t *len) +{ + uae_u8 *dstbak, *dst; + + if (!alg_flag) + return NULL; + + dstbak = dst = xmalloc(uae_u8, 1000); + save_u32(1); + + uae_u32 addr = (uae_u32)getsetpositionvideograb(-1); + + save_u32(alg_flag); + save_u32(ld_value); + save_u32(addr); + save_u32(ld_startaddress); + save_u32(ld_endaddress); + save_u32(ld_repcnt); + save_u32(ld_mark); + save_u32(ld_wait_ack); + save_u32(alg_hsync_delay); + save_u32(arcadia_hsync_cnt); + save_u8(ld_audio); + save_u8(ld_video); + save_u8(ld_mode); + save_u8(ld_mode_value); + save_u8(ld_direction); + save_u8(picmatic_io); + save_u8(picmatic_parallel); + save_u8(ser_buf_offset); + for (int i = 0; i < ser_buf_offset; i++) { + save_u8(alg_ser_buf[i]); + } + save_u32(ld_vsync); + + *len = dst - dstbak; + return dstbak; } static TCHAR cubo_pic_settings[ROMCONFIG_CONFIGTEXT_LEN]; diff --git a/uae_src/cfgfile.cpp b/uae_src/cfgfile.cpp index fcef36015..37f745172 100644 --- a/uae_src/cfgfile.cpp +++ b/uae_src/cfgfile.cpp @@ -2567,6 +2567,8 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_dwrite_str(f, _T("genlock_video"), p->genlock_video_file); cfgfile_dwrite(f, _T("genlock_mix"), _T("%d"), p->genlock_mix); cfgfile_dwrite(f, _T("genlock_scale"), _T("%d"), p->genlock_scale); + cfgfile_dwrite(f, _T("genlock_offset_x"), _T("%d"), p->genlock_offset_x); + cfgfile_dwrite(f, _T("genlock_offset_y"), _T("%d"), p->genlock_offset_y); if (p->genlock_effects) { tmp[0] = 0; if (p->genlock_effects & (1 << 4)) { @@ -2751,6 +2753,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_dwrite_strarr(f, _T("unmapped_address_space"), unmapped, p->cs_unmapped_space); cfgfile_dwrite_bool(f, _T("memory_pattern"), p->cs_memorypatternfill); cfgfile_dwrite_bool(f, _T("ipl_delay"), p->cs_ipldelay); + cfgfile_dwrite_bool(f, _T("floppydata_pullup"), p->cs_floppydatapullup); cfgfile_dwrite(f, _T("keyboard_handshake"), _T("%d"), currprefs.cs_kbhandshake); cfgfile_dwrite(f, _T("chipset_hacks"), _T("0x%x"), p->cs_hacks); cfgfile_dwrite(f, _T("eclockphase"), _T("%d"), p->cs_eclockphase); @@ -4806,9 +4809,15 @@ struct uaedev_config_data *add_filesys_config (struct uae_prefs *p, int index, s } } uci = getuci (p); + if (!uci) { + return NULL; + } uci->configoffset = -1; uci->unitnum = -1; } else { + if (index >= MAX_FILESYSTEM_UNITS) { + return NULL; + } uci = &p->mountconfig[index]; } if (!uci) @@ -5964,6 +5973,8 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH || cfgfile_intval(option, value, _T("monitoremu_monitor"), &p->monitoremu_mon, 1) || cfgfile_intval(option, value, _T("genlock_scale"), &p->genlock_scale, 1) || cfgfile_intval(option, value, _T("genlock_mix"), &p->genlock_mix, 1) + || cfgfile_intval(option, value, _T("genlock_offset_x"), &p->genlock_offset_x, 1) + || cfgfile_intval(option, value, _T("genlock_offset_y"), &p->genlock_offset_y, 1) || cfgfile_intval(option, value, _T("keyboard_handshake"), &p->cs_kbhandshake, 1) || cfgfile_intval(option, value, _T("eclockphase"), &p->cs_eclockphase, 1) || cfgfile_intval(option, value, _T("chipset_rtc_adjust"), &p->cs_rtc_adjust, 1) @@ -5991,6 +6002,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH || cfgfile_strval(option, value, _T("unmapped_address_space"), &p->cs_unmapped_space, unmapped, 0) || cfgfile_yesno(option, value, _T("memory_pattern"), &p->cs_memorypatternfill) || cfgfile_yesno(option, value, _T("ipl_delay"), &p->cs_ipldelay) + || cfgfile_yesno(option, value, _T("floppydata_pullup"), &p->cs_floppydatapullup) || cfgfile_strval(option, value, _T("ciaa_type"), &p->cs_ciatype[0], ciatype, 0) || cfgfile_strval(option, value, _T("ciab_type"), &p->cs_ciatype[1], ciatype, 0) || cfgfile_strboolval(option, value, _T("comp_flushmode"), &p->comp_hardflush, flushmode, 0) @@ -8497,6 +8509,7 @@ void default_prefs (struct uae_prefs *p, bool reset, int type) p->cs_ciatype[1] = 0; p->cs_memorypatternfill = true; p->cs_ipldelay = false; + p->cs_floppydatapullup = false; for (int i = 0; i < MAX_FILTERDATA; i++) { struct gfx_filterdata *f = &p->gf[i]; @@ -8574,6 +8587,8 @@ void default_prefs (struct uae_prefs *p, bool reset, int type) p->genlock = 0; p->genlock_image = 0; p->genlock_mix = 0; + p->genlock_offset_x = 0; + p->genlock_offset_y = 0; p->ntscmode = 0; p->filesys_limit = 0; p->filesys_max_name = 107; @@ -9409,7 +9424,7 @@ static int bip_arcadia (struct uae_prefs *p, int config, int compa, int romcheck return 1; } -static int bip_alg(struct uae_prefs* p, int config, int compa, int romcheck) +static int bip_alg(struct uae_prefs *p, int config, int compa, int romcheck) { int roms[4], i; struct romlist** rl; @@ -9422,6 +9437,7 @@ static int bip_alg(struct uae_prefs* p, int config, int compa, int romcheck) p->genlock_image = 6; p->floppyslots[0].dfxtype = DRV_NONE; p->floppyslots[1].dfxtype = DRV_NONE; + p->cs_floppydatapullup = true; set_68000_compa(p, compa); p->cs_compatible = CP_A500; built_in_chipset_prefs(p); @@ -9438,6 +9454,11 @@ static int bip_alg(struct uae_prefs* p, int config, int compa, int romcheck) roms[0] = rl[i]->rd->id; roms[1] = -1; configure_rom(p, roms, 0); + const TCHAR *name = rl[i]->rd->name; + p->ntscmode = true; + if (_tcsstr(name, _T("Picmatic"))) { + p->ntscmode = false; + } break; } } diff --git a/uae_src/cia.cpp b/uae_src/cia.cpp index 832221c05..140b8c6ed 100644 --- a/uae_src/cia.cpp +++ b/uae_src/cia.cpp @@ -192,7 +192,7 @@ void cia_adjust_eclock_phase(int diff) //write_log("CIA E-clock phase %d\n", internaleclockphase); } -static void set_eclockphase(void) +void cia_set_eclockphase(void) { if (currprefs.cs_eclocksync == 3) { e_clock_sync = E_CLOCK_SYNC_X; @@ -228,7 +228,7 @@ static evt_t get_e_cycles(void) currprefs.cs_eclocksync = 1; } changed_prefs.cs_eclocksync = currprefs.cs_eclocksync; - set_eclockphase(); + cia_set_eclockphase(); write_log("CIA elock timing mode %d\n", currprefs.cs_eclocksync); blop2 = 0; } @@ -1705,6 +1705,13 @@ static uae_u8 CIA_PBON(struct CIA *c, uae_u8 v) return v; } +#if DONGLE_DEBUG > 0 +static bool notinrom() +{ + return true; +} +#endif + static uae_u8 ReadCIAA(uae_u32 addr, uae_u32 *flags) { struct CIA *c = &cia[0]; @@ -1942,6 +1949,9 @@ static void WriteCIAA(uae_u16 addr, uae_u8 val, uae_u32 *flags) #endif c->prb = val; dongle_cia_write(0, reg, c->drb, val); +#ifdef ARCADIA + alg_parallel_port(c->drb, val); +#endif #ifdef PARALLEL_PORT if (isprinter()) { if (isprinter() > 0) { @@ -2190,7 +2200,7 @@ void CIA_reset(void) CIA_calctimers(); DISK_select_set(cia[1].prb); } - set_eclockphase(); + cia_set_eclockphase(); map_overlay(0); check_led(); #ifdef SERIAL_PORT @@ -2218,11 +2228,13 @@ void dumpcia(void) console_out_f(_T("A: CRA %02x CRB %02x ICR %02x IM %02x TA %04x (%04x) TB %04x (%04x)\n"), a->t[0].cr, a->t[1].cr, a->icr1, a->imask, a->t[0].timer - a->t[0].passed, a->t[0].latch, a->t[1].timer - a->t[1].passed, a->t[1].latch); - console_out_f(_T("TOD %06x (%06x) ALARM %06x %c%c CYC=%016llX\n"), + console_out_f(_T(" PRA %02x PRB %02x DDRA %02x DDRB %02x\n"), a->pra, a->prb, a->dra, a->drb); + console_out_f(_T(" TOD %06x (%06x) ALARM %06x %c%c CYC=%016llX\n"), a->tod, a->tol, a->alarm, a->tlatch ? 'L' : '-', a->todon ? '-' : 'S', get_cycles()); console_out_f(_T("B: CRA %02x CRB %02x ICR %02x IM %02x TA %04x (%04x) TB %04x (%04x)\n"), b->t[0].cr, b->t[1].cr, b->icr1, b->imask, b->t[0].timer - b->t[0].passed, b->t[0].latch, b->t[1].timer - b->t[1].passed, b->t[1].latch); - console_out_f(_T("TOD %06x (%06x) ALARM %06x %c%c\n"), + console_out_f(_T(" PRA %02x PRB %02x DDRA %02x DDRB %02x\n"), b->pra, b->prb, b->dra, b->drb); + console_out_f(_T(" TOD %06x (%06x) ALARM %06x %c%c\n"), b->tod, b->tol, b->alarm, b->tlatch ? 'L' : '-', b->todon ? '-' : 'S'); } diff --git a/uae_src/cpummu.cpp b/uae_src/cpummu.cpp index 15e512a17..b5ca9a3e9 100644 --- a/uae_src/cpummu.cpp +++ b/uae_src/cpummu.cpp @@ -400,15 +400,15 @@ void mmu_bus_error(uaecptr addr, uae_u32 val, int fc, bool write, int size,uae_u if (ismoves) { // MOVES special behavior - int fc2 = write ? regs.dfc : regs.sfc; - if (fc2 == 0 || fc2 == 3 || fc2 == 4 || fc2 == 7) + int old_fc = fc = write ? regs.dfc : regs.sfc; + if ((fc & 3) == 0 || (fc & 3) == 3) { ssw |= MMU_SSW_TT1; - if ((fc2 & 3) != 3) - fc2 &= ~2; + } else if (fc & 2) { + fc = (fc & 4) | 1; + } #if MMUDEBUGMISC > 0 - write_log (_T("040 MMU MOVES fc=%d -> %d\n"), fc, fc2); + write_log (_T("040 MMU MOVES fc=%d -> %d\n"), old_fc, fc); #endif - fc = fc2; } ssw |= fc & MMU_SSW_TM; /* TM = FC */ @@ -518,6 +518,7 @@ void mmu_bus_error(uaecptr addr, uae_u32 val, int fc, bool write, int size,uae_u } + ismoves = false; rmw_cycle = false; locked_rmw_cycle = false; regs.mmu_fault_addr = addr; @@ -656,7 +657,7 @@ static uae_u32 mmu_fill_atc(uaecptr addr, bool super, uae_u32 tag, bool write, s int i; int old_s; - // Always use supervisor mode to access descriptors + // Use supervisor mode to access descriptors (really is fc = 7) old_s = regs.s; regs.s = 1; diff --git a/uae_src/custom.cpp b/uae_src/custom.cpp index 41244e6d6..f9e4dab67 100644 --- a/uae_src/custom.cpp +++ b/uae_src/custom.cpp @@ -6146,7 +6146,7 @@ static void reset_decisions_scanline_start(void) } } - if (!ecs_denise) { + if (!ecs_denise && currprefs.gfx_overscanmode > OVERSCANMODE_OVERSCAN) { if (!ecs_agnus) { if (vb_start_line == 2 + vblank_extraline) { record_color_change2(0, 0, COLOR_CHANGE_BLANK | 1); @@ -7056,9 +7056,9 @@ void compute_framesync(void) set_config_changed(); if (currprefs.monitoremu_mon != 0) { - target_graphics_buffer_update(currprefs.monitoremu_mon); + target_graphics_buffer_update(currprefs.monitoremu_mon, false); } - if (target_graphics_buffer_update(0)) { + if (target_graphics_buffer_update(0, false)) { reset_drawing(); } } @@ -7785,6 +7785,21 @@ static void check_line_enabled(void) line_disabled |= custom_disabled ? 2 : 0; } +void get_mode_blanking_limits(int *phbstop, int *phbstrt, int *pvbstop, int *pvbstrt) +{ + if (new_beamcon0 & BEAMCON0_VARVBEN) { + *pvbstop = vbstop; + *pvbstrt = vbstrt; + *phbstop = hbstop_v; + *phbstrt = hbstrt_v; + } else { + *pvbstop = hardwired_vbstop; + *pvbstrt = hardwired_vbstrt; + *phbstop = (47 << CCK_SHRES_SHIFT) - 7; + *phbstrt = ((maxhpos_short + 8) << CCK_SHRES_SHIFT) - 3; + } +} + static void vb_check(void) { check_line_enabled(); @@ -13014,7 +13029,7 @@ static void hsync_handlerh(bool onvsync) hpos_hsync_extra = 0; estimate_last_fetch_cycle(hpos); - if (vb_end_next_line && !ecs_denise) { + if (vb_end_next_line && !ecs_denise && currprefs.gfx_overscanmode > OVERSCANMODE_OVERSCAN) { record_color_change2(hpos, 0, COLOR_CHANGE_BLANK | 1); } @@ -14331,7 +14346,7 @@ static void hsync_handler(void) events_schedule(); } - if (vpos == maxvpos_display_vsync && !maxvpos_display_vsync_next) { + if (vpos == maxvpos_display_vsync + 1 && !maxvpos_display_vsync_next) { hsync_record_line_state_last(next_lineno, nextline_how, 0); inputdevice_read_msg(true); vsync_display_render(); @@ -14342,7 +14357,7 @@ static void hsync_handler(void) reset_autoscale(); display_vsync_counter++; maxvpos_display_vsync_next = true; - } else if (vpos != maxvpos_display_vsync && maxvpos_display_vsync_next) { + } else if (vpos != maxvpos_display_vsync + 1 && maxvpos_display_vsync_next) { // protect against weird VPOSW writes causing continuous vblanks maxvpos_display_vsync_next = false; } @@ -15403,7 +15418,7 @@ static void REGPARAM2 custom_bput (uaecptr addr, uae_u32 value) if (addr & 1) { rval = value & 0xff; } else { - rval = (value << 8) | (value & 0xFF); + rval = (value << 8) | (value & 0xff); } } else { rval = (value << 8) | (value & 0xff); @@ -15411,11 +15426,11 @@ static void REGPARAM2 custom_bput (uaecptr addr, uae_u32 value) if (currprefs.cs_bytecustomwritebug) { if (addr & 1) - custom_wput (addr & ~1, rval); + custom_wput(addr & ~1, rval | (rval << 8)); else - custom_wput (addr, value << 8); + custom_wput(addr, value << 8); } else { - custom_wput (addr & ~1, rval); + custom_wput(addr & ~1, rval); } } @@ -16360,6 +16375,7 @@ void check_prefs_changed_custom(void) currprefs.chipset_hr = changed_prefs.chipset_hr; init_custom(); } + cia_set_eclockphase(); if (syncchange) { varsync_changed = 2; } diff --git a/uae_src/disk.cpp b/uae_src/disk.cpp index 40d66f65f..7063fdd60 100644 --- a/uae_src/disk.cpp +++ b/uae_src/disk.cpp @@ -4298,9 +4298,11 @@ static void wordsync_detected(bool startup) } } -static void disk_doupdate_read_reallynothing(int floppybits, bool state) +static void disk_doupdate_read_reallynothing(int floppybits) { int speed = get_floppy_speed(); + bool state = currprefs.cs_floppydatapullup; + while (floppybits >= speed) { bool skipbit = false; bool waszero = word == 0; @@ -4337,10 +4339,15 @@ static void disk_doupdate_read_reallynothing(int floppybits, bool state) static void disk_doupdate_read_nothing(int floppybits) { int speed = get_floppy_speed(); + bool state = currprefs.cs_floppydatapullup; while (floppybits >= speed) { bool skipbit = false; word <<= 1; - word |= (uaerand() & 0x1000) ? 1 : 0; + if (state) { + word |= 1; + } else { + word |= (uaerand() & 0x1000) ? 1 : 0; + } doreaddma(); // MSBSYNC if (adkcon & 0x200) { @@ -4795,7 +4802,7 @@ void DISK_update (int tohpos) /* no floppy selected and no DMA */ if ((selected | disabled) == 15) { if (dskdmaen < DSKDMA_WRITE) { - disk_doupdate_read_reallynothing(cycles, false); + disk_doupdate_read_reallynothing(cycles); } else if (dskdmaen == DSKDMA_WRITE) { disk_doupdate_write(cycles, get_floppy_speed()); } diff --git a/uae_src/drawing.cpp b/uae_src/drawing.cpp index 5f7c07bce..d7527380a 100644 --- a/uae_src/drawing.cpp +++ b/uae_src/drawing.cpp @@ -172,6 +172,7 @@ struct spritepixelsbuf { static struct spritepixelsbuf spritepixels_buffer[MAX_PIXELS_PER_LINE]; static struct spritepixelsbuf *spritepixels; static int sprite_first_x, sprite_last_x; +static bool sprite_visibility; #ifdef AGA /* AGA mode color lookup tables */ @@ -480,6 +481,18 @@ void get_custom_topedge (int *xp, int *yp, bool max) } } +void get_screen_blanking_limits(int *hbstop, int *hbstrt, int *vbstop, int *vbstrt) +{ + *vbstop = vblank_bottom_stop; + *vbstrt = vblank_top_start; + + int hblank_left = exthblank ? hblank_left_start : hblank_left_start_hard; + int hblank_right = exthblank ? hblank_right_stop : hblank_right_stop_hard; + + *hbstop = hblank_left - visible_left_border; + *hbstrt = hblank_right - visible_left_border; +} + static void reset_custom_limits(void) { gclow = gcloh = gclox = gcloy = 0; @@ -664,7 +677,7 @@ static void set_hblanking_limits(void) } else if (currprefs.gfx_overscanmode <= OVERSCANMODE_OVERSCAN) { doblank = true; } else if (currprefs.gfx_overscanmode == OVERSCANMODE_BROADCAST) { - hbstrt = (239 << CCK_SHRES_SHIFT) - 3; + hbstrt = ((maxhpos_short + 12) << CCK_SHRES_SHIFT) - 3; doblank = true; } else if (currprefs.gfx_overscanmode >= OVERSCANMODE_ULTRA) { doblank = true; @@ -1769,10 +1782,7 @@ static uae_u8 render_sprites(int pos, int dualpf, uae_u8 apixel, int aga) int *shift_lookup = dualpf ? (bpldualpfpri ? dblpf_ms2 : dblpf_ms1) : dblpf_ms; int maskshift, plfmask; - if (exthblank || exthblank_force) { - return 0; - } - if (extborder && (ce_is_borderblank(colors_for_drawing.extra) || !ce_is_bordersprite(colors_for_drawing.extra))) { + if (!sprite_visibility) { return 0; } @@ -3361,6 +3371,17 @@ static void setbplmode(void) bplmode = CMODE_NORMAL; } +static void set_sprite_visibility(void) +{ + sprite_visibility = true; + if (exthblank || exthblank_force) { + sprite_visibility = false; + } + if (extborder && (ce_is_borderblank(colors_for_drawing.extra) || !ce_is_bordersprite(colors_for_drawing.extra))) { + sprite_visibility = false; + } +} + /* We only save hardware registers during the hardware frame. Now, when * drawing the frame, we expand the data into a slightly more useful * form. */ @@ -3528,6 +3549,7 @@ static void pfield_expand_dp_bplconx (int regno, int v, int hp, int vp) exthblanken = false; exthblank = 0; } + set_sprite_visibility(); return; case 0x208: // forced hblank if (v) { @@ -3638,6 +3660,7 @@ static void do_color_changes(line_draw_func worker_border, line_draw_func worker exthblank = 0; } ehb_enable = true; + set_sprite_visibility(); for (int i = dip_for_drawing->first_color_change; i <= dip_for_drawing->last_color_change; i++) { int regno = curr_color_changes[i].regno; @@ -3793,6 +3816,7 @@ static void do_color_changes(line_draw_func worker_border, line_draw_func worker extborder = false; } } + set_sprite_visibility(); } else if (value & COLOR_CHANGE_BLANK) { if (value & 1) { exthblank = exthblank_set; @@ -3811,6 +3835,7 @@ static void do_color_changes(line_draw_func worker_border, line_draw_func worker colors_for_drawing.extra |= (value & 3) == 2 ? (1 << CE_BORDERSPRITE) : 0; colors_for_drawing.extra |= (value & 5) == 4 ? (1 << CE_BORDERNTRANS) : 0; colors_for_drawing.extra |= (value & 8) == 8 ? (1 << CE_EXTBLANKSET) : 0; + set_sprite_visibility(); } else if (value & COLOR_CHANGE_SHRES_DELAY) { colors_for_drawing.extra &= ~(1 << CE_SHRES_DELAY_SHIFT); colors_for_drawing.extra &= ~(1 << (CE_SHRES_DELAY_SHIFT + 1)); diff --git a/uae_src/include/arcadia.h b/uae_src/include/arcadia.h index f9c0d6cbc..f9e94eddf 100644 --- a/uae_src/include/arcadia.h +++ b/uae_src/include/arcadia.h @@ -33,6 +33,7 @@ extern int alg_get_player(uae_u16); extern uae_u16 alg_potgor(uae_u16); extern uae_u16 alg_joydat(int, uae_u16); extern uae_u8 alg_joystick_buttons(uae_u8, uae_u8, uae_u8); +extern uae_u8 alg_parallel_port(uae_u8, uae_u8); extern struct romdata *get_alg_rom(const TCHAR *name); extern void ld_serial_read(uae_u16 v); diff --git a/uae_src/include/cia.h b/uae_src/include/cia.h index ed2b3ff99..753e4582b 100644 --- a/uae_src/include/cia.h +++ b/uae_src/include/cia.h @@ -22,6 +22,7 @@ extern void CIAB_tod_handler(int); extern void cia_parallelack (void); extern void cia_diskindex (void); extern void cia_adjust_eclock_phase(int); +extern void cia_set_eclockphase(void); extern void dumpcia(void); extern void rethink_cias(void); diff --git a/uae_src/include/custom.h b/uae_src/include/custom.h index 4ba4b8064..8651a6f3d 100644 --- a/uae_src/include/custom.h +++ b/uae_src/include/custom.h @@ -254,6 +254,7 @@ void custom_cpuchange(void); bool bitplane_dma_access(int hpos, int offset); void custom_dumpstate(int); bool get_ras_cas(uaecptr, int*, int*); +void get_mode_blanking_limits(int *phbstop, int *phbstrt, int *pvbstop, int *pvbstrt); #define RGA_PIPELINE_ADJUST 4 #define MAX_CHIPSETSLOTS 256 diff --git a/uae_src/include/drawing.h b/uae_src/include/drawing.h index 921410654..b0e9823cb 100644 --- a/uae_src/include/drawing.h +++ b/uae_src/include/drawing.h @@ -28,7 +28,9 @@ extern int detected_screen_resolution; extern int hsync_end_left_border, denisehtotal; #define AMIGA_WIDTH_MAX (754 / 2) -#define AMIGA_HEIGHT_MAX (576 / 2) +#define AMIGA_HEIGHT_MAX_PAL (576 / 2) +#define AMIGA_HEIGHT_MAX_NTSC (486 / 2) +#define AMIGA_HEIGHT_MAX (AMIGA_HEIGHT_MAX_PAL) // Cycles * 2 from start of scanline to first refresh slot (hsync strobe slot) #define DDF_OFFSET (2 * 4) @@ -383,6 +385,7 @@ extern void allocvidbuffer(int monid, struct vidbuffer *buf, int width, int heig extern void freevidbuffer(int monid, struct vidbuffer *buf); extern void check_prefs_picasso(void); extern int get_vertical_visible_height(bool); +extern void get_screen_blanking_limits(int*, int*, int*, int*); /* Finally, stuff that shouldn't really be shared. */ diff --git a/uae_src/include/filesys.h b/uae_src/include/filesys.h index f8538e805..76e548785 100644 --- a/uae_src/include/filesys.h +++ b/uae_src/include/filesys.h @@ -120,8 +120,6 @@ struct hd_hardfiledata { #define FILESYS_CD 4 #define FILESYS_TAPE 5 -#define MAX_FILESYSTEM_UNITS 50 - struct uaedev_mount_info; extern struct uaedev_mount_info options_mountinfo; diff --git a/uae_src/include/options.h b/uae_src/include/options.h index 900cc6137..06da514a0 100644 --- a/uae_src/include/options.h +++ b/uae_src/include/options.h @@ -171,7 +171,8 @@ struct wh { int special; }; -#define MOUNT_CONFIG_SIZE 30 +#define MOUNT_CONFIG_SIZE 50 +#define MAX_FILESYSTEM_UNITS 50 #define UAEDEV_DIR 0 #define UAEDEV_HDF 1 #define UAEDEV_CD 2 @@ -627,6 +628,7 @@ struct uae_prefs { int genlock_scale; int genlock_aspect; int genlock_effects; + int genlock_offset_x, genlock_offset_y; uae_u64 ecs_genlock_features_colorkey_mask[4]; uae_u8 ecs_genlock_features_plane_mask; bool genlock_alpha; @@ -729,6 +731,7 @@ struct uae_prefs { int cs_denisemodel; bool cs_memorypatternfill; bool cs_ipldelay; + bool cs_floppydatapullup; uae_u32 seed; struct boardromconfig expansionboard[MAX_EXPANSION_BOARDS]; @@ -908,6 +911,7 @@ struct uae_prefs { bool win32_shutdown_notification; bool win32_warn_exit; bool win32_gui_control; + bool win32_videograb_balance; bool right_control_is_right_win_key; #ifdef WITH_SLIRP struct slirp_redir slirp_redirs[MAX_SLIRP_REDIRS]; diff --git a/uae_src/include/savestate.h b/uae_src/include/savestate.h index 4cb470699..6d4d7c2a0 100644 --- a/uae_src/include/savestate.h +++ b/uae_src/include/savestate.h @@ -204,6 +204,9 @@ extern uae_u8 *save_screenshot(int monid, size_t *len); extern uae_u8 *save_cycles(size_t *len, uae_u8 *dstptr); extern uae_u8 *restore_cycles(uae_u8 *src); +extern uae_u8 *save_alg(size_t *len); +extern uae_u8 *restore_alg(uae_u8 *src); + extern void restore_cram(int, size_t); extern void restore_bram(int, size_t); extern void restore_fram(int, size_t, int); diff --git a/uae_src/include/videograb.h b/uae_src/include/videograb.h index 3873664c3..1bfeb1c73 100644 --- a/uae_src/include/videograb.h +++ b/uae_src/include/videograb.h @@ -4,7 +4,9 @@ void uninitvideograb(void); bool getvideograb(long **buffer, int *width, int *height); void pausevideograb(int pause); uae_s64 getsetpositionvideograb(uae_s64 framepos); +uae_s64 getdurationvideograb(void); bool isvideograb(void); bool getpausevideograb(void); void setvolumevideograb(int volume); +void setchflagsvideograb(int chflags); void isvideograb_status(void); diff --git a/uae_src/include/xwin.h b/uae_src/include/xwin.h index 83f19cce9..b726001f1 100644 --- a/uae_src/include/xwin.h +++ b/uae_src/include/xwin.h @@ -56,7 +56,7 @@ extern bool show_screen_maybe(int monid, bool); extern int lockscr(struct vidbuffer*, bool, bool, bool); extern void unlockscr(struct vidbuffer*, int, int); -extern bool target_graphics_buffer_update(int monid); +extern bool target_graphics_buffer_update(int monid, bool force); extern float target_adjust_vblank_hz(int monid, float); extern int target_get_display_scanline(int displayindex); extern void target_spin(int); diff --git a/uae_src/include/zfile.h b/uae_src/include/zfile.h index 92fabf8f3..b7f096911 100644 --- a/uae_src/include/zfile.h +++ b/uae_src/include/zfile.h @@ -119,6 +119,7 @@ extern int zfile_truncate(struct zfile *z, uae_s64 size); #define ZFILE_NVR 7 #define ZFILE_HDFRDB 8 #define ZFILE_CDIMAGE 9 +#define ZFILE_EXECUTABLE 10 extern const TCHAR *uae_archive_extensions[]; extern const TCHAR *uae_ignoreextensions[]; diff --git a/uae_src/inputdevice.cpp b/uae_src/inputdevice.cpp index d31c47d85..6d4472672 100644 --- a/uae_src/inputdevice.cpp +++ b/uae_src/inputdevice.cpp @@ -7467,7 +7467,7 @@ static void compatibility_copy (struct uae_prefs *prefs, bool gameports) break; } } else if (jd->id >= 0) { - joymodes[i][0] = i ? JSEM_MODE_JOYSTICK : JSEM_MODE_WHEELMOUSE; + joymodes[i][j] = i ? JSEM_MODE_JOYSTICK : JSEM_MODE_WHEELMOUSE; joyinputs[i] = i ? ip_joy2 : ip_mouse1; } } diff --git a/uae_src/inputevents.def b/uae_src/inputevents.def index 6d82f849b..2afef57ad 100644 --- a/uae_src/inputevents.def +++ b/uae_src/inputevents.def @@ -419,13 +419,13 @@ DEFEVENT(SPC_ARCADIA_PLAYER2,_T("Arcadia player 2"),AM_K,0,0,AKS_ARCADIAPLY2) DEFEVENT(SPC_ARCADIA_COIN1,_T("Arcadia coin player 1"),AM_K,0,0,AKS_ARCADIACOIN1) DEFEVENT(SPC_ARCADIA_COIN2,_T("Arcadia coin player 2"),AM_K,0,0,AKS_ARCADIACOIN2) -DEFEVENT(SPC_ALG_SERVICE,_T("American Laser Games Service"),AM_K,0,0,AKS_ALGSERVICE) -DEFEVENT(SPC_ALG_LSTART,_T("American Laser Games Left Start"),AM_K,0,0,AKS_ALGLSTART) -DEFEVENT(SPC_ALG_RSTART,_T("American Laser Games Right Start"),AM_K,0,0,AKS_ALGRSTART) -DEFEVENT(SPC_ALG_LCOIN,_T("American Laser Games Left Coin"),AM_K,0,0,AKS_ALGLCOIN) -DEFEVENT(SPC_ALG_RCOIN,_T("American Laser Games Right Coin"),AM_K,0,0,AKS_ALGRCOIN) -DEFEVENT(SPC_ALG_LTRIGGER,_T("American Laser Games Left Trigger"),AM_K,0,0,AKS_ALGLTRIGGER) -DEFEVENT(SPC_ALG_RTRIGGER,_T("American Laser Games Right Trigger"),AM_K,0,0,AKS_ALGRTRIGGER) +DEFEVENT(SPC_ALG_SERVICE,_T("American Laser Games/Picmatic Service"),AM_K,0,0,AKS_ALGSERVICE) +DEFEVENT(SPC_ALG_LSTART,_T("American Laser Games/Picmatic Left Start"),AM_K,0,0,AKS_ALGLSTART) +DEFEVENT(SPC_ALG_RSTART,_T("American Laser Games/Picmatic Right Start"),AM_K,0,0,AKS_ALGRSTART) +DEFEVENT(SPC_ALG_LCOIN,_T("American Laser Games Left Coin/Picmatic Coin"),AM_K,0,0,AKS_ALGLCOIN) +DEFEVENT(SPC_ALG_RCOIN,_T("American Laser Games Right Coin/Picmatic Coin"),AM_K,0,0,AKS_ALGRCOIN) +DEFEVENT(SPC_ALG_LTRIGGER,_T("American Laser Games/Picmatic Left Trigger"),AM_K,0,0,AKS_ALGLTRIGGER) +DEFEVENT(SPC_ALG_RTRIGGER,_T("American Laser Games/Picmatic Right Trigger"),AM_K,0,0,AKS_ALGRTRIGGER) DEFEVENT(SPC_ALG_LHOLSTER,_T("American Laser Games Left Holster"),AM_K,0,0,AKS_ALGLHOLSTER) DEFEVENT(SPC_ALG_RHOLSTER,_T("American Laser Games Right Holster"),AM_K,0,0,AKS_ALGRHOLSTER) diff --git a/uae_src/main.cpp b/uae_src/main.cpp index b2cd3369f..92284345a 100644 --- a/uae_src/main.cpp +++ b/uae_src/main.cpp @@ -884,7 +884,8 @@ static int diskswapper_cb (struct zfile *f, void *vrsd) int *num = (int*)vrsd; if (*num >= MAX_SPARE_DRIVES) return 1; - if (zfile_gettype (f) == ZFILE_DISKIMAGE) { + int type = zfile_gettype(f); + if (type == ZFILE_DISKIMAGE || type == ZFILE_EXECUTABLE) { _tcsncpy (currprefs.dfxlist[*num], zfile_getname (f), 255); (*num)++; } diff --git a/uae_src/memory.cpp b/uae_src/memory.cpp index b6c402364..6f694a0e2 100644 --- a/uae_src/memory.cpp +++ b/uae_src/memory.cpp @@ -2576,7 +2576,12 @@ static void allocate_memory (void) restore_ram (a3000lmem_filepos, a3000lmem_bank.baseaddr); if (a3000hmem_bank.allocated_size > 0) restore_ram (a3000hmem_filepos, a3000hmem_bank.baseaddr); + } +#ifdef ARCADIA + else { + alg_flag = 0; } +#endif #ifdef AGA chipmem_bank_ce2.baseaddr = chipmem_bank.baseaddr; #endif @@ -2965,9 +2970,6 @@ void memory_reset (void) bool gayleorfatgary; highest_ram = 0; -#ifdef ARCADIA - alg_flag = 0; -#endif need_hardreset = false; rom_write_enabled = true; #ifdef JIT diff --git a/uae_src/od-win32/darkmode.cpp b/uae_src/od-win32/darkmode.cpp index 4b6467d6c..158ee604f 100644 --- a/uae_src/od-win32/darkmode.cpp +++ b/uae_src/od-win32/darkmode.cpp @@ -149,7 +149,7 @@ static void GetDarkmodeFontColor(void) constexpr bool CheckBuildNumber(DWORD buildNumber) { - return buildNumber <= 25999; + return buildNumber <= 29999; } void InitDarkMode(int enable) diff --git a/uae_src/od-win32/direct3d11.cpp b/uae_src/od-win32/direct3d11.cpp index 1c61559a6..428bce119 100644 --- a/uae_src/od-win32/direct3d11.cpp +++ b/uae_src/od-win32/direct3d11.cpp @@ -3429,7 +3429,7 @@ static bool xD3D11_initvals(HWND ahwnd, int monid, int w_w, int w_h, int t_w, in d3d->dmultxh = mmulth; d3d->dmultxv = mmultv; if (d3d->m_device) { - target_graphics_buffer_update(monid); + target_graphics_buffer_update(monid, false); } return changed; diff --git a/uae_src/od-win32/keyboard_win32.cpp b/uae_src/od-win32/keyboard_win32.cpp index abc8a5cf8..36ccb22d5 100644 --- a/uae_src/od-win32/keyboard_win32.cpp +++ b/uae_src/od-win32/keyboard_win32.cpp @@ -322,7 +322,7 @@ static int kb_se3[] = { DIK_A, -1, DIK_D, -1, DIK_W, -1, DIK_S, -1, DIK_LMENU, - static int kb_cd32_np[] = { DIK_NUMPAD4, -1, DIK_NUMPAD6, -1, DIK_NUMPAD8, -1, DIK_NUMPAD2, -1, DIK_NUMPAD0, DIK_NUMPAD5, DIK_NUMPAD1, -1, DIK_DECIMAL, DIK_NUMPAD3, -1, DIK_NUMPAD7, -1, DIK_NUMPAD9, -1, DIK_DIVIDE, -1, DIK_SUBTRACT, -1, DIK_MULTIPLY, -1, -1 }; -static int kb_cd32_ck[] = { DIK_LEFT, -1, DIK_RIGHT, -1, DIK_UP, -1, DIK_DOWN, -1, DIK_RCONTROL, -1, DIK_RMENU, -1, DIK_NUMPAD7, -1, DIK_NUMPAD9, -1, DIK_DIVIDE, -1, DIK_SUBTRACT, -1, DIK_MULTIPLY, -1, -1 }; +static int kb_cd32_ck[] = { DIK_LEFT, -1, DIK_RIGHT, -1, DIK_UP, -1, DIK_DOWN, -1, DIK_RCONTROL, DIK_RMENU, DIK_RSHIFT, -1, DIK_NUMPAD7, -1, DIK_NUMPAD9, -1, DIK_DIVIDE, -1, DIK_SUBTRACT, -1, DIK_MULTIPLY, -1, -1 }; static int kb_cd32_se[] = { DIK_A, -1, DIK_D, -1, DIK_W, -1, DIK_S, -1, -1, DIK_LMENU, -1, DIK_LSHIFT, -1, DIK_NUMPAD7, -1, DIK_NUMPAD9, -1, DIK_DIVIDE, -1, DIK_SUBTRACT, -1, DIK_MULTIPLY, -1, -1 }; static int kb_cdtv[] = { DIK_NUMPAD1, -1, DIK_NUMPAD3, -1, DIK_NUMPAD7, -1, DIK_NUMPAD9, -1, -1 }; diff --git a/uae_src/od-win32/resources/winuae.rc b/uae_src/od-win32/resources/winuae.rc index 35e48eac9..297092761 100644 --- a/uae_src/od-win32/resources/winuae.rc +++ b/uae_src/od-win32/resources/winuae.rc @@ -2074,7 +2074,7 @@ END STRINGTABLE BEGIN - IDS_QS_MODELS "A500\nA500+\nA600\nA1000\nA1200\nA3000\nA4000\nCD32\nCDTV\nAmerican Laser Games\nArcadia Multi Select system\nMacrosystem\nExpanded WinUAE example configuration\n" + IDS_QS_MODELS "A500\nA500+\nA600\nA1000\nA1200\nA3000\nA4000\nCD32\nCDTV\nAmerican Laser Games / Picmatic\nArcadia Multi Select system\nMacrosystem\nExpanded WinUAE example configuration\n" IDS_QS_MODEL_A500 "1.3 ROM, OCS, 512 KB Chip + 512 KB Slow RAM (most common)\nThis configuration is capable of running most games and demos produced for first-generation hardware. Only few exceptions need a different configuration (e.g. the oldest games tend to be incompatible with this configuration).\n1.3 ROM, ECS Agnus, 512 KB Chip RAM + 512 KB Slow RAM\nLater hardware revision of the A500. Nearly 100% compatible with the previous configuration.\n1.3 ROM, ECS Agnus, 1 MB Chip RAM\nFew newer games and demos require this configuration.\n1.3 ROM, OCS Agnus, 512 KB Chip RAM\nVery old (e.g. pre-1988) games and demos may require this configuration.\n1.2 ROM, OCS Agnus, 512 KB Chip RAM\nAs available for the A1000, and installed on the first A500 and A2000 series. Some very old programs only work correctly with this configuration. Note: This system ROM version can only boot from floppy disk (no hard disk boot support).\n1.2 ROM, OCS Agnus, 512 KB Chip RAM + 512 KB Slow RAM\nThis configuration adds expansion memory to the first A500 produced. Try this if your game does not work with newer configurations, but works with the previous one. It could add some features to the game, including faster loading times. Note: This system ROM version can only boot from floppy disk (no hard disk boot support)." IDS_QS_MODEL_A500P "Basic non-expanded configuration\nThe A500+ adds an ECS Agnus chip, 1 MB of Chip RAM and a 2.0 ROM to the A500. Many A500 games and demos don't work properly on an A500+.\n2 MB Chip RAM expanded configuration\n\n4 MB Fast RAM expanded configuration\n" IDS_QS_MODEL_A600 "Basic non-expanded configuration\nThe A600 is smaller than the A500+ and has an updated 2.0 ROM.\n2 MB Chip RAM expanded configuration\n\n4 MB Fast RAM expanded configuration\n" @@ -2194,7 +2194,7 @@ BEGIN IDS_SHUTDOWN_NOTIFICATION "Emulation session active" IDS_QUIT_WARNING "Are you sure you want to quit WinUAE?" IDS_UNMAPPED_ADDRESS "Floating\nAll zeros\nAll ones\n" - IDS_GENLOCK_OPTIONS "Noise (built-in)\nTest card (built-in)\nImage file (png)\nVideo file\nCapture device\nAmerican Laser Games LaserDisc Player\nSony LaserDisc Player\nPioneer LaserDisc Player\n" + IDS_GENLOCK_OPTIONS "Noise (built-in)\nTest card (built-in)\nImage file (png)\nVideo file\nCapture device\nAmerican Laser Games/Picmatic LaserDisc Player\nSony LaserDisc Player\nPioneer LaserDisc Player\n" IDS_READONLYCONFIRMATION "Selected configuration file is write protected.\nDo you want to overwrite it?\n%s\n" IDS_SCREEN_NATIVELACE "Native (Interlaced)" diff --git a/uae_src/od-win32/win32.cpp b/uae_src/od-win32/win32.cpp index d5caf0588..57de75e9e 100644 --- a/uae_src/od-win32/win32.cpp +++ b/uae_src/od-win32/win32.cpp @@ -7220,6 +7220,7 @@ static int process_arg (TCHAR *cmdline, TCHAR **xargv, TCHAR ***xargv3) _stprintf (tmp, _T("-cdimage=%s"), f); break; case ZFILE_DISKIMAGE: + case ZFILE_EXECUTABLE: if (fd < 4) _stprintf (tmp, _T("-cfgparam=floppy%d=%s"), fd++, f); break; diff --git a/uae_src/od-win32/win32.h b/uae_src/od-win32/win32.h index 1f5cf9976..5dad4f9bf 100644 --- a/uae_src/od-win32/win32.h +++ b/uae_src/od-win32/win32.h @@ -17,15 +17,15 @@ #define WINUAEPUBLICBETA 1 #define LANG_DLL 1 -#define LANG_DLL_FULL_VERSION_MATCH 1 +#define LANG_DLL_FULL_VERSION_MATCH 0 #if WINUAEPUBLICBETA -#define WINUAEBETA _T("6") +#define WINUAEBETA _T("9") #else #define WINUAEBETA _T("") #endif -#define WINUAEDATE MAKEBD(2024, 1, 27) +#define WINUAEDATE MAKEBD(2024, 2, 12) //#define WINUAEEXTRA _T("AmiKit Preview") //#define WINUAEEXTRA _T("Amiga Forever Edition") diff --git a/uae_src/od-win32/win32_scaler.cpp b/uae_src/od-win32/win32_scaler.cpp index 90fb74ee9..7e535d7c0 100644 --- a/uae_src/od-win32/win32_scaler.cpp +++ b/uae_src/od-win32/win32_scaler.cpp @@ -135,7 +135,7 @@ static void getmanualpos(int monid, int *cxp, int *cyp, int *cwp, int *chp) ch = avidinfo->outbuffer->outheight << (VRES_MAX - currprefs.gfx_vresolution); } else if (currprefs.gfx_overscanmode <= OVERSCANMODE_OVERSCAN) { // keep old version compatiblity - ch = native ? AMIGA_HEIGHT_MAX << VRES_MAX : avidinfo->outbuffer->outheight; + ch = native ? (ispal(NULL) ? AMIGA_HEIGHT_MAX_PAL : AMIGA_HEIGHT_MAX_NTSC) << VRES_MAX : avidinfo->outbuffer->outheight; } else { ch = native ? (maxvpos_display + maxvpos_display_vsync - minfirstline) << VRES_MAX : avidinfo->outbuffer->outheight; } diff --git a/uae_src/od-win32/win32_videograb.cpp b/uae_src/od-win32/win32_videograb.cpp index 16bab06d7..de6692231 100644 --- a/uae_src/od-win32/win32_videograb.cpp +++ b/uae_src/od-win32/win32_videograb.cpp @@ -51,17 +51,20 @@ static CComPtr mediaSeeking; static CComPtr mediaEvent; static CComPtr audio; static bool videoInitialized; -static bool videoPaused; +static int videoPaused; static long *frameBuffer; static long bufferSize; static int videoWidth, videoHeight; +static int audio_chflags, audio_volume; void uninitvideograb(void) { write_log(_T("uninitvideograb\n")); videoInitialized = false; - videoPaused = false; + videoPaused = -1; + audio_chflags = 0; + audio_volume = 0; sampleGrabber.Release(); mediaSeeking.Release(); @@ -311,6 +314,7 @@ bool initvideograb(const TCHAR *filename) hr = filterGraph->QueryInterface(IID_IBasicAudio, (void**)&audio); setvolumevideograb(100 - currprefs.sound_volume_genlock); + setchflagsvideograb(0); hr = filterGraph->QueryInterface(IID_IMediaControl, (void**)&mediaControl); if (FAILED(hr)) { @@ -332,6 +336,16 @@ bool initvideograb(const TCHAR *filename) } } +uae_s64 getdurationvideograb(void) +{ + LONGLONG dura; + HRESULT hr = mediaSeeking->GetDuration(&dura); + if (FAILED(hr)) { + return 0; + } + return dura; +} + uae_s64 getsetpositionvideograb(uae_s64 framepos) { if (!videoInitialized || !mediaSeeking) @@ -351,8 +365,32 @@ uae_s64 getsetpositionvideograb(uae_s64 framepos) hr = mediaSeeking->SetPositions(&pos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning); if (FAILED(hr)) { write_log(_T("SetPositions %lld failed %08x\n"), framepos, hr); + return 0; } - return 0; + return pos; + } +} + +void setchflagsvideograb(int chflags) +{ + if (!audio) + return; + audio_chflags = chflags; + long bal; + if (chflags == 1) { + bal = -10000; + } else if (chflags == 2) { + bal = 10000; + } else { + bal = 0; + } + if (!currprefs.win32_videograb_balance) { + audio->put_Balance(bal); + } + if (chflags) { + setvolumevideograb(audio_volume); + } else if (!chflags) { + audio->put_Volume(0); } } @@ -360,13 +398,17 @@ void setvolumevideograb(int volume) { if (!audio) return; + audio_volume = volume; + if (!audio_chflags) { + volume = 0; + } long vol = (long)(log10((float)volume / 100.0) * 4000.0); audio->put_Volume(vol); } bool getpausevideograb(void) { - return videoPaused != 0; + return videoPaused > 0; } void pausevideograb(int pause) @@ -374,17 +416,19 @@ void pausevideograb(int pause) HRESULT hr; if (!videoInitialized) return; + if (videoPaused == pause) + return; if (pause < 0) { pause = videoPaused ? 0 : 1; } if (pause > 0) { hr = mediaControl->Pause(); if (SUCCEEDED(hr)) - videoPaused = true; + videoPaused = 1; } else if (pause == 0) { hr = mediaControl->Run(); if (SUCCEEDED(hr)) - videoPaused = false; + videoPaused = 0; } } diff --git a/uae_src/od-win32/win32gfx.cpp b/uae_src/od-win32/win32gfx.cpp index b496f397d..2d47b3b3b 100644 --- a/uae_src/od-win32/win32gfx.cpp +++ b/uae_src/od-win32/win32gfx.cpp @@ -2264,6 +2264,8 @@ int check_prefs_changed_gfx(void) c |= currprefs.genlock_mix != changed_prefs.genlock_mix ? (1 | 256) : 0; c |= currprefs.genlock_aspect != changed_prefs.genlock_aspect ? (1 | 256) : 0; c |= currprefs.genlock_scale != changed_prefs.genlock_scale ? (1 | 256) : 0; + c |= currprefs.genlock_offset_x != changed_prefs.genlock_offset_x ? (1 | 256) : 0; + c |= currprefs.genlock_offset_y != changed_prefs.genlock_offset_y ? (1 | 256) : 0; c |= _tcsicmp(currprefs.genlock_image_file, changed_prefs.genlock_image_file) ? (2 | 8) : 0; c |= _tcsicmp(currprefs.genlock_video_file, changed_prefs.genlock_video_file) ? (2 | 8) : 0; @@ -2368,6 +2370,8 @@ int check_prefs_changed_gfx(void) currprefs.genlock_alpha = changed_prefs.genlock_alpha; currprefs.genlock_aspect = changed_prefs.genlock_aspect; currprefs.genlock_scale = changed_prefs.genlock_scale; + currprefs.genlock_offset_x = changed_prefs.genlock_offset_x; + currprefs.genlock_offset_y = changed_prefs.genlock_offset_y; _tcscpy(currprefs.genlock_image_file, changed_prefs.genlock_image_file); _tcscpy(currprefs.genlock_video_file, changed_prefs.genlock_video_file); @@ -2428,7 +2432,7 @@ int check_prefs_changed_gfx(void) } } if (c & 1024) { - target_graphics_buffer_update(mon->monitor_id); + target_graphics_buffer_update(mon->monitor_id, true); } if (c & 512) { reopen_gfx(mon); @@ -3085,7 +3089,7 @@ void gfx_set_picasso_modeinfo(int monid, RGBFTYPE rgbfmt) #ifdef RETROPLATFORM rp_set_hwnd(mon->hAmigaWnd); #endif - target_graphics_buffer_update(monid); + target_graphics_buffer_update(monid, false); } #endif @@ -3846,6 +3850,7 @@ static int create_windows(struct AmigaMonitor *mon) addnotifications (mon->hAmigaWnd, FALSE, FALSE); mon->window_extra_height_bar = sbheight; mon->dpi = getdpiforwindow(mon->hAmigaWnd); + createstatusline(mon->hMainWnd, mon->monitor_id); if (mon->monitor_id) { ShowWindow(mon->hMainWnd, SW_SHOWNOACTIVATE); @@ -4105,7 +4110,6 @@ static BOOL doInit(struct AmigaMonitor *mon) } else if (errv < 0) { modechanged = false; } - target_graphics_buffer_update(mon->monitor_id); updatewinrect(mon, true); } @@ -4116,7 +4120,7 @@ static BOOL doInit(struct AmigaMonitor *mon) display_param_init(mon); createstatusline(mon->hAmigaWnd, mon->monitor_id); } - + target_graphics_buffer_update(mon->monitor_id, false); picasso_refresh(mon->monitor_id); #ifdef RETROPLATFORM @@ -4137,7 +4141,7 @@ static BOOL doInit(struct AmigaMonitor *mon) return ret; } -bool target_graphics_buffer_update(int monid) +bool target_graphics_buffer_update(int monid, bool force) { struct AmigaMonitor *mon = &AMonitors[monid]; struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[monid]; @@ -4158,7 +4162,7 @@ bool target_graphics_buffer_update(int monid) h = vb->outheight; } - if (oldtex_w[monid] == w && oldtex_h[monid] == h && oldtex_rtg[monid] == mon->screen_is_picasso && D3D_alloctexture(mon->monitor_id, -w, -h)) { + if (!force && oldtex_w[monid] == w && oldtex_h[monid] == h && oldtex_rtg[monid] == mon->screen_is_picasso && D3D_alloctexture(mon->monitor_id, -w, -h)) { osk_setup(monid, -2); return false; } diff --git a/uae_src/od-win32/win32gui.cpp b/uae_src/od-win32/win32gui.cpp index 0908a8c08..89e56b77b 100644 --- a/uae_src/od-win32/win32gui.cpp +++ b/uae_src/od-win32/win32gui.cpp @@ -905,9 +905,9 @@ void exit_gui (int ok) { if (!gui_active) return; - if (guiDlg == NULL) - return; - SendMessage (guiDlg, WM_COMMAND, ok ? IDOK : IDCANCEL, 0); + if (guiDlg && hGUIWnd) { + SendMessage (guiDlg, WM_COMMAND, ok ? IDOK : IDCANCEL, 0); + } } static int getcbn (HWND hDlg, int v, TCHAR *out, int maxlen) @@ -12877,6 +12877,8 @@ static void misc_gui_font(HWND hDlg, int fonttype) } else if (fonttype == 2) { if (!full_property_sheet && AMonitors[0].hAmigaWnd) { createstatusline(AMonitors[0].hAmigaWnd, 0); + target_graphics_buffer_update(0, true); + } } } @@ -16345,24 +16347,23 @@ static INT_PTR CALLBACK HarddiskDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPA } break; } - } else { - switch (LOWORD(wParam)) - { - case 10001: - clicked_entry--; - hilitehd (hDlg); - break; - case 10002: - clicked_entry++; + } + switch (LOWORD(wParam)) + { + case 10001: + clicked_entry--; + hilitehd (hDlg); + break; + case 10002: + clicked_entry++; + hilitehd (hDlg); + break; + default: + if (harddiskdlg_button (hDlg, wParam)) { + InitializeListView (hDlg); hilitehd (hDlg); - break; - default: - if (harddiskdlg_button (hDlg, wParam)) { - InitializeListView (hDlg); - hilitehd (hDlg); - } - break; } + break; } break; @@ -17323,8 +17324,9 @@ static void diskswapper_addfile (struct uae_prefs *prefs, const TCHAR *file) struct zfile *zf = zfile_fopen (out, _T("rb"), ZFD_NORMAL); if (zf) { int type = zfile_gettype (zf); - if (type == ZFILE_DISKIMAGE) + if (type == ZFILE_DISKIMAGE || type == ZFILE_EXECUTABLE) { diskswapper_addfile2 (prefs, out); + } zfile_fclose (zf); } } @@ -19036,6 +19038,9 @@ static void CALLBACK timerfunc (HWND hDlg, UINT uMsg, UINT_PTR idEvent, DWORD dw int events[MAX_COMPA_INPUTLIST]; int max = inputdevice_get_compatibility_input (&workprefs, inputmap_port, &mode, events, &axistable); + if (inputmap_remap_counter >= max) { + inputmap_remap_counter = 0; + } int evtnum = events[inputmap_remap_counter]; int type2 = intputdevice_compa_get_eventtype (evtnum, &axistable2); @@ -21996,11 +22001,15 @@ static BOOL CALLBACK childenumproc (HWND hwnd, LPARAM lParam) return 1; } -static void getguisize (HWND hDlg, int *width, int *height) +static void getguisize (HWND hwnd, int *width, int *height) { RECT r; - GetWindowRect (hDlg, &r); + if (!GetWindowRect(hwnd, &r)) { + write_log("getguisize failed! %d\n", GetLastError()); + return; + } + write_log("getguisize got %dx%d - %dx%d = %dx%d\n", r.left, r.top, r.right, r.bottom, r.right - r.left, r.bottom - r.top); *width = (r.right - r.left); *height = (r.bottom - r.top); } @@ -22051,21 +22060,19 @@ static HWND updatePanel (int id, UINT action) hAccelTable = NULL; if (id < 0) { RECT r; - if (GetWindowRect (hDlg, &r)) { - LONG left, top; + if (!gui_fullscreen && IsWindowVisible(hDlg) && !IsIconic(hDlg) && GetWindowRect(hDlg, &r)) { + int left, top; left = r.left; top = r.top; - if (!gui_fullscreen) { - if (full_property_sheet || isfullscreen () == 0) { - regsetint (NULL, _T("GUIPosX"), left); - regsetint (NULL, _T("GUIPosY"), top); - } else if (isfullscreen () < 0) { - regsetint (NULL, _T("GUIPosFWX"), left); - regsetint (NULL, _T("GUIPosFWY"), top); - } else if (isfullscreen () > 0) { - regsetint (NULL, _T("GUIPosFSX"), left); - regsetint (NULL, _T("GUIPosFSY"), top); - } + if (full_property_sheet || isfullscreen () == 0) { + regsetint (NULL, _T("GUIPosX"), left); + regsetint (NULL, _T("GUIPosY"), top); + } else if (isfullscreen () < 0) { + regsetint (NULL, _T("GUIPosFWX"), left); + regsetint (NULL, _T("GUIPosFWY"), top); + } else if (isfullscreen () > 0) { + regsetint (NULL, _T("GUIPosFSX"), left); + regsetint (NULL, _T("GUIPosFSY"), top); } } ew (hDlg, IDHELP, FALSE); @@ -22373,7 +22380,7 @@ static int floppyslot_addfile (struct uae_prefs *prefs, const TCHAR *filepath, c struct zfile *zf = zfile_fopen (out, _T("rb"), ZFD_NORMAL); if (zf) { int type = zfile_gettype (zf); - if (type == ZFILE_DISKIMAGE) { + if (type == ZFILE_DISKIMAGE || type == ZFILE_EXECUTABLE) { drv = floppyslot_addfile2 (prefs, out, drv, firstdrv, maxdrv); if (drv < 0) break; @@ -22536,7 +22543,11 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) type = zfile_gettype (z); if (type == ZFILE_ROM) { rd = getromdatabyzfile (z); - } + } else if (currentpage == QUICKSTART_ID || currentpage == LOADSAVE_ID) { + if (type == ZFILE_UNKNOWN && iszip(z)) { + type = ZFILE_HDF; + } + } // replace with decrunched path but only if // floppy insert and decrunched path is deeper (longer) if (type > 0 && _tcslen(z->name) > _tcslen(file) && drv >= 0) { @@ -22559,7 +22570,7 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) if (drvdrag) { type = ZFILE_DISKIMAGE; - } else if ((zip || harddrive) && type != ZFILE_DISKIMAGE) { + } else if ((zip || harddrive) && type != ZFILE_DISKIMAGE && type != ZFILE_EXECUTABLE) { if (do_filesys_insert (file, cnt)) continue; if (zip) { @@ -22578,6 +22589,7 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) switch (type) { case ZFILE_DISKIMAGE: + case ZFILE_EXECUTABLE: if (currentpage == DISK_ID) { diskswapper_addfile (prefs, file); } else if (currentpage == HARDDISK_ID) { @@ -23066,13 +23078,6 @@ static INT_PTR CALLBACK DialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l return FALSE; } -#if 0 -static ACCEL EmptyAccel[] = { - { FVIRTKEY, VK_UP, 20001 }, { FVIRTKEY, VK_DOWN, 20002 }, - { 0, 0, 0 } -}; -#endif - struct newresource *getresource (int tmpl) { TCHAR rid[20]; @@ -23259,10 +23264,6 @@ static int init_page (int tmpl, int icon, int title, ppage[id].idx = id; ppage[id].accel = NULL; ppage[id].focusid = focusid; -#if 0 - if (!accels) - accels = EmptyAccel; -#endif if (accels) { int i = -1; while (accels[++i].key); @@ -23544,6 +23545,7 @@ static int GetSettings (int all_options, HWND hwnd) freescaleresource(panelresource); scaleresource (panelresource, &maindctx, hwnd, gui_resize_enabled && gui_resize_allowed, gui_fullscreen, workprefs.win32_gui_alwaysontop || workprefs.win32_main_alwaysontop ? WS_EX_TOPMOST : 0, 0); HWND phwnd = hwnd; + hGUIWnd = NULL; if (isfullscreen() == 0) phwnd = 0; if (isfullscreen() > 0 && currprefs.gfx_api > 1) @@ -23558,7 +23560,7 @@ static int GetSettings (int all_options, HWND hwnd) int dh = GetSystemMetrics(SM_CYSCREEN); MSG msg; DWORD v; - int w, h; + int w = 0, h = 0; getguisize (dhwnd, &w, &h); write_log (_T("Got GUI size = %dx%d\n"), w, h); @@ -23689,14 +23691,16 @@ static int GetSettings (int all_options, HWND hwnd) scaleresource_setdefaults(hwnd); gui_size_changed = 10; } -gui_exit: +gui_exit:; + dhwnd = NULL; + hGUIWnd = NULL; freescaleresource(panelresource); if (!gui_size_changed) break; quit_program = 0; } - if (use_gui_control > 0) { + if (use_gui_control > 0 && dhwnd) { KillTimer(dhwnd, 8); } diff --git a/uae_src/od-win32/winuaechangelog.txt b/uae_src/od-win32/winuaechangelog.txt index 4a4e73d2c..33a62dff9 100644 --- a/uae_src/od-win32/winuaechangelog.txt +++ b/uae_src/od-win32/winuaechangelog.txt @@ -1,4 +1,40 @@ +Beta 9: + +- Advanced chipset CIA E-clock mode can be changed on the fly. +- Picmatic Zorton Brothers boot hang fixed. Too long delay in LDP ACK reply. For some reason all other LD games didn't care. Note that LD dump is not (yet?) available. +- Genlock scaling was broken (b7/b8) and only appeared to work if both Amiga and genlock image size was almost identical. +- Genlock video/image was not affected by TV Overscan modes. +- Quickstart "American Laser Games" renamed to "American Laser Games / Picmatic". Quickstart also now automatically enables NTSC if ALG game, disables NTSC if Picmatic game. +- Do not emulate OCS Denise "blanking bug" unless overscan mode Overscan+ or higher. "Blanking bug" lines can appear in some centering modes even in normal Overscan mode and they look too ugly. (Yes, this is correctly emulated but they are usually hidden in overscan) +- 68040 MMU faulting MOVES special case handling fix (Andreas Grabher) +- Advanced chipset panel "Custom register byte write bug" emulation fix. +- Harddrive panel Enter and Delete key shortcuts work again. + +Beta 8: + +- Clicking GamePorts panel remap/test crashed in some situations (remap device, change device type to something that has less events, remap device) +- In some situations GamePorts remap setup (number/type of buttons etc) didn't match selected device type (mouse, joystick, gamepad etc) and changing it did nothing. +- Better vertical positioning of NTSC mode in normal Overscan mode. Previously calculation used PAL max overscan height. Overscan+ and Overscan in NTSC mode now have almost same vertical positioning. + +- LD serial port communication timing adjusted and previously unemulated LD commands implemented (REPEAT and MARK SET). Now Picmatic Marbella Vice lightgun game works. +- ALG/Picmatic LD player always unpaused after exiting GUI, even if it was paused before entering GUI. +- ALG/Picmatic statefile support. Note that complete data is not saved, for example LD and NVRAM paths. Matching config file must be loaded first. +- Picmatic (Marbella Vice) player one/two gun selection implemented. Oddly there are two methods: parallel port first data pin selects gun but it is not used when in gun calibration service menu, only during game play. Other method is IO port at $f60000 which is used both in calibration menu and during game play. (Maybe Picmatic games had different hardware versions?). ALG uses joystick port #2 button #2 pin. +- ALG and Picmatic (Marbella Vice) input events now match. Picmatic games use different hardware and different joystick port pins than ALG, emulation now automatically remaps Picmatic events to matching ALG input events. +- Genlock overlay position relative to Amiga display does not anymore change when display panel settings are changed (lores/hires/double etc). Genlock image position was not correctly centered if genlock image size was (much) larger or (much) smaller than Amiga display size. Do not scale if video height is almost same as Amiga display height (+-8 lines). This fixes ugly horizontal artifacts when odd and even lines get "mixed" mid screen. + +Beta 7: + +- On the fly changing OSD font size didn't update OSD allocated vertical size until mode was changed. +- When opening fullscreen mode, OSD font was generated after texture allocation. Font was correct but OSD led boxes had wrong height. +- Start emulation, minimize window, click notification icon -> forever looping GUI open failures. (because minimized main window was detected as being minimized -> close GUI window. When GUI window was mid construction..) Very old bug. +- In some situations minimized GUI position was saved as current GUI position to registry/ini. +- Some "Fake 60Hz" modes had blank screen (Wings of Death) without Overscan+ or higher overscan mode. +- Drag&drop archive file in Quickstart mode and archive contains more than one executable, don't insert it in DF0:. +- Drag&drop archive file in Quickstart mode with not autodetected contents but it has Amiga executables: insert it as a harddrive. +- Max harddrive limit bumped to 50 (was already 50 in some places but 30 in some others) and check limit properly. +- Quick fix to prevent ALG Marbella Vice boot crash. (Really stupid interrupt code that breaks if LD player answers too quickly.. and also enables disk sync interrupt and crashes if it gets one. This is also worked around). ALG LD player command 0x55 added (Frame Mode), MV requires it. Nothing else tested yet. Beta 6: diff --git a/uae_src/savestate.cpp b/uae_src/savestate.cpp index 90289b534..c44b0ff96 100644 --- a/uae_src/savestate.cpp +++ b/uae_src/savestate.cpp @@ -799,6 +799,10 @@ void restore_state (const TCHAR *filename) end = restore_gayle_ide (chunk); else if (!_tcsncmp (name, _T("CDU"), 3)) end = restore_cd (name[3] - '0', chunk); +#ifdef ARCADIA + else if (!_tcsncmp(name, _T("ALG "), 4)) + end = restore_alg(chunk); +#endif #ifdef A2065 else if (!_tcsncmp (name, _T("2065"), 4)) end = restore_a2065 (chunk); @@ -1117,6 +1121,11 @@ static int save_state_internal (struct zfile *f, const TCHAR *description, int c save_chunk (f, dst, len, _T("CD32"), 0); xfree (dst); #endif +#ifdef ARCADIA + dst = save_alg(&len); + save_chunk(f, dst, len, _T("ALG "), 0); + xfree(dst); +#endif #ifdef CDTV dst = save_cdtv (&len, NULL); save_chunk (f, dst, len, _T("CDTV"), 0); diff --git a/uae_src/specialmonitors.cpp b/uae_src/specialmonitors.cpp index 1ce76a830..497cf8d0d 100755 --- a/uae_src/specialmonitors.cpp +++ b/uae_src/specialmonitors.cpp @@ -2399,7 +2399,7 @@ static bool do_genlock(struct vidbuffer *src, struct vidbuffer *dst, bool double struct vidbuf_description *avidinfo = &adisplays[dst->monitor_id].gfxvidinfo; int y, x, vdbl, hdbl; - int ystart, yend; + int ystart, yend, xstart, xend; int mix1 = 0, mix2 = 0; int genlock_image_pixbytes = 4; @@ -2536,8 +2536,7 @@ static bool do_genlock(struct vidbuffer *src, struct vidbuffer *dst, bool double else hdbl = 2; // lores - ystart = minfirstline; - yend = maxvpos; + get_mode_blanking_limits(&xstart, &xend, &ystart, ¥d); init_noise(); @@ -2548,11 +2547,31 @@ static bool do_genlock(struct vidbuffer *src, struct vidbuffer *dst, bool double uae_u8 amix1 = 255 - (currprefs.genlock_mix > 255 ? 255 : 0); uae_u8 amix2 = 255 - amix1; - int ah = (((yend - ystart) * 2) >> vdbl); - int aw = src->inwidth; + int aw = ((xend - xstart) >> 1); + if (avidinfo->xchange == 1) { + aw *= 2; + } else if (avidinfo->xchange == 4) { + aw /= 2; + } + + int ah = (((yend - ystart) * 2) >> 0); + if (avidinfo->ychange == 2) { + ah /= 2; + } + + if (ah < 16 || aw < 16) { + return false; + } + + int deltax = 65536; + int deltay = 65536; - int deltax = genlock_image_width * 65536 / aw; - int deltay = genlock_image_height * 65536 / ah; + if (abs(genlock_image_width - aw) > 8) { + deltax = genlock_image_width * 65536 / aw; + } + if (abs(genlock_image_height - ah) > 8) { + deltay = genlock_image_height * 65536 / ah; + } deltax -= currprefs.genlock_scale * 256; deltay -= currprefs.genlock_scale * 256; @@ -2561,20 +2580,38 @@ static bool do_genlock(struct vidbuffer *src, struct vidbuffer *dst, bool double int offsety = 0; if (deltax && deltay) { - offsetx = (aw - genlock_image_width * 65536 / deltax) / 2; - offsety = (ah - genlock_image_height * 65536 / deltay) / 2; + offsetx = (aw - (genlock_image_width * 65536 / deltax)) / 2; + offsety = (ah - (genlock_image_height * 65536 / deltay)) / 2; if (currprefs.genlock_aspect) { if (deltax < deltay) { - offsetx = (aw - genlock_image_width * 65536 / deltay) / 2; + offsetx = (aw - (genlock_image_width * 65536 / deltay)) / 2; deltax = deltay; } else { - offsety = (ah - genlock_image_height * 65536 / deltax) / 2; + offsety = (ah - (genlock_image_height * 65536 / deltax)) / 2; deltay = deltax; } } } + int gen_xoffset = 0; + int gen_yoffset = 0; + + if (currprefs.gfx_overscanmode >= OVERSCANMODE_EXTREME) { + gen_xoffset = (xstart / 2) - hsync_end_left_border * 2; + } + gen_yoffset = (ystart - minfirstline) * 2; + + gen_xoffset += currprefs.genlock_offset_x; + gen_yoffset += currprefs.genlock_offset_y; + + int vblank_top_start, vblank_bottom_stop; + int hblank_left_start, hblank_right_stop; + + get_screen_blanking_limits(&hblank_left_start, &hblank_right_stop, &vblank_bottom_stop, &vblank_top_start); + vblank_bottom_stop <<= vdbl; + vblank_top_start <<= vdbl; + uae_u8 r = 0, g = 0, b = 0, a = 0; for (y = ystart; y < yend; y++) { int yoff = (y * 2 + oddlines) - src->yoffset; @@ -2582,13 +2619,15 @@ static bool do_genlock(struct vidbuffer *src, struct vidbuffer *dst, bool double continue; if (yoff >= src->inheight) continue; + if (y * 2 < vblank_top_start || y * 2 >= vblank_bottom_stop) + continue; bool ztoggle = false; uae_u8 *line = src->bufmem + yoff * src->rowbytes; uae_u8 *lineprev = yoff > 0 ? src->bufmem + (yoff - 1) * src->rowbytes : NULL; uae_u8 *dstline = dst->bufmem + ((y * 2 + oddlines) - dst->yoffset) * dst->rowbytes; uae_u8 *line_genlock = row_map_genlock[yoff]; - int gy = ((y * 2 + oddlines) - src->yoffset - offsety) * deltay / 65536; + int gy = ((y * 2 + oddlines) - src->yoffset + offsety - gen_yoffset) * deltay / 65536; if (genlock_image_upsidedown) gy = (genlock_image_height - 1) - gy; uae_u8 *image_genlock = genlock_image + gy * genlock_image_pitch; @@ -2602,6 +2641,8 @@ static bool do_genlock(struct vidbuffer *src, struct vidbuffer *dst, bool double for (x = 0; x < src->inwidth; x++) { uae_u8 *s2 = s + src->rowbytes; uae_u8 *d2 = d + dst->rowbytes; + if (x < hblank_left_start || x >= hblank_right_stop) + continue; if ((!zclken && is_transparent(*s_genlock)) || (zclken && ztoggle)) { a = amix2; if (genlock_error) { @@ -2611,7 +2652,7 @@ static bool do_genlock(struct vidbuffer *src, struct vidbuffer *dst, bool double } else if (genlock_blank) { r = g = b = 0; } else if (genlock_image) { - int gx = (x - offsetx) * deltax / 65536; + int gx = (x + offsetx - gen_xoffset) * deltax / 65536; if (gx >= 0 && gx < genlock_image_width && gy >= 0 && gy < genlock_image_height) { uae_u8 *s_genlock_image = image_genlock + gx * genlock_image_pixbytes; r = s_genlock_image[genlock_image_red_index]; diff --git a/uae_src/zfile.cpp b/uae_src/zfile.cpp index 4b6ac70e9..01aeef9bd 100644 --- a/uae_src/zfile.cpp +++ b/uae_src/zfile.cpp @@ -330,7 +330,7 @@ int zfile_gettype (struct zfile *z) zfile_fread (buf, 8, 1, z); zfile_fseek (z, -8, SEEK_CUR); if (!memcmp (buf, exeheader, sizeof (buf))) - return ZFILE_DISKIMAGE; + return ZFILE_EXECUTABLE; if (!memcmp (buf, "CAPS", 4)) return ZFILE_DISKIMAGE; if (!memcmp (buf, "SCP", 3)) diff --git a/uae_src/zfile_archive.cpp b/uae_src/zfile_archive.cpp index ab5e209e8..acff62c3e 100644 --- a/uae_src/zfile_archive.cpp +++ b/uae_src/zfile_archive.cpp @@ -112,6 +112,7 @@ struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, uns int mask = zf->zfdmask; int canhistory = (mask & ZFD_DISKHISTORY) && !(mask & ZFD_CHECKONLY); int getflag = (mask & ZFD_DELAYEDOPEN) ? FILE_DELAYEDOPEN : 0; + int execnt = 0; if (retcode) *retcode = 0; @@ -125,6 +126,7 @@ struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, uns zv = getzvolume (parent, zf, id); if (!zv) return NULL; +retry:; we_have_file = 0; tmphist[0] = 0; zipcnt = 1; @@ -189,8 +191,24 @@ struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, uns ft = ZFILE_CDIMAGE; } } else { - zt = archive_getzfile (zn, id, getflag); - ft = zfile_gettype (zt); + zt = archive_getzfile(zn, id, getflag); + ft = zfile_gettype(zt); + // if more than 1 exe: do not mount as disk image + if (ft == ZFILE_EXECUTABLE) { + if (execnt < 0) { + ft = ZFILE_UNKNOWN; + zfile_fclose(z); + z = NULL; + zfile_fclose(zt); + zt = NULL; + } else { + if (execnt > 0) { + execnt = -1; + goto retry; + } + execnt++; + } + } } if ((select < 0 || ft) && whf > we_have_file) { if (!zt)