Commit c3c13e54 authored by mtufan's avatar mtufan

puae 2.3.3

parent 6e19a21f
PUAE 2.3.2 beta series
PUAE 2.3.3 beta series
============
PUAE tries to continue where E-UAE left off..
PUAE versioning is based on the merged WinUAE version..
......
......@@ -6,7 +6,7 @@ dnl Updated and generally mauled 2008-2011 Mustafa Tufan
dnl
AC_PREREQ(2.55)
AC_INIT(PUAE, 2.3.2, mustafa.tufan@gmail.com, puae)
AC_INIT(PUAE, 2.3.3, mustafa.tufan@gmail.com, puae)
AC_CONFIG_SRCDIR([bootstrap.sh])
AM_CONFIG_HEADER([src/sysconfig.h])
AC_CANONICAL_TARGET
......
......@@ -950,11 +950,22 @@ static uae_u32 REGPARAM2 dmac_lgeti (uaecptr addr)
v = (dmac_wgeti(addr) << 16) | dmac_wgeti(addr + 2);
return v;
}
static int REGPARAM2 dmac_check (uaecptr addr, uae_u32 size)
{
return 1;
}
static uae_u8 *REGPARAM2 dmac_xlate (uaecptr addr)
{
addr &= rom_mask;
addr += rombank * rom_size;
return rom + addr;
}
addrbank dmaca2091_bank = {
dmac_lget, dmac_wget, dmac_bget,
dmac_lput, dmac_wput, dmac_bput,
default_xlate, default_check, NULL, "A2091/A590",
dmac_xlate, dmac_check, NULL, "A2091/A590",
dmac_lgeti, dmac_wgeti, ABFLAG_IO
};
......@@ -1349,13 +1360,16 @@ void a2091_init (void)
rd = rl->rd;
z = read_rom (&rd);
if (z) {
int slotsize = 65536;
write_log ("A590/A2091 BOOT ROM %d.%d ", rd->ver, rd->rev);
rom_size = rd->size;
rom = xmalloc (uae_u8, rom_size);
rom = xmalloc (uae_u8, slotsize);
if (rl->rd->id == 56)
rombankswitcher = 1;
zfile_fread (rom, rom_size, 1, z);
zfile_fclose (z);
for (int i = 1; i < slotsize / rom_size; i++)
memcpy (rom + i * rom_size, rom, rom_size);
rom_mask = rom_size - 1;
}
} else {
......
......@@ -188,6 +188,7 @@ static const TCHAR *joyaf[] = { "none", "normal", "toggle", 0 };
static const TCHAR *epsonprinter[] = { "none", "ascii", "epson_matrix_9pin", "epson_matrix_24pin", "epson_matrix_48pin", 0 };
static const TCHAR *aspects[] = { "none", "vga", "tv", 0 };
static const TCHAR *vsyncmodes[] = { "false", "true", "autoswitch", 0 };
static const TCHAR *vsyncmodes2[] = { "normal", "busywait", 0 };
static const TCHAR *filterapi[] = { "directdraw", "direct3d", 0 };
static const TCHAR *dongles[] =
{
......@@ -779,7 +780,9 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
cfgfile_write_bool (f, "gfx_autoresolution", p->gfx_autoresolution);
cfgfile_write (f, "gfx_backbuffers", "%d", p->gfx_backbuffers);
cfgfile_write_str (f, "gfx_vsync", vsyncmodes[p->gfx_avsync]);
cfgfile_write_str (f, "gfx_vsyncmode", vsyncmodes2[p->gfx_avsyncmode]);
cfgfile_write_str (f, "gfx_vsync_picasso", vsyncmodes[p->gfx_pvsync]);
cfgfile_write_str (f, "gfx_vsyncmode_picasso", vsyncmodes2[p->gfx_pvsyncmode]);
cfgfile_write_bool (f, "gfx_lores", p->gfx_resolution == 0);
cfgfile_write_str (f, "gfx_resolution", lorestype1[p->gfx_resolution]);
cfgfile_write_str (f, "gfx_lores_mode", loresmode[p->gfx_lores_mode]);
......@@ -869,7 +872,57 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
cfgfile_dwrite (f, "chipset","ecs_denise");
else
cfgfile_dwrite (f, "chipset", "ocs");
cfgfile_write (f, "chipset_refreshrate", "%d", p->chipset_refreshrate);
if (p->chipset_refreshrate > 0)
cfgfile_write (f, "chipset_refreshrate", "%d", p->chipset_refreshrate);
for (i = 0; i < MAX_CHIPSET_REFRESH_TOTAL; i++) {
if (p->cr[i].rate <= 0)
continue;
struct chipset_refresh *cr = &p->cr[i];
_stprintf (tmp, "%f", cr->rate);
TCHAR *s = tmp + _tcslen (tmp);
if (cr->label[0] > 0 && i < MAX_CHIPSET_REFRESH)
s += _stprintf (s, ",t=%s", cr->label);
if (cr->horiz > 0)
s += _stprintf (s, ",h=%d", cr->horiz);
if (cr->vert > 0)
s += _stprintf (s, ",v=%d", cr->vert);
if (cr->locked)
_tcscat (s, ",locked");
if (cr->ntsc > 0)
_tcscat (s, ",ntsc");
else if (cr->ntsc == 0)
_tcscat (s, ",pal");
if (cr->lace > 0)
_tcscat (s, ",lace");
else if (cr->lace == 0)
_tcscat (s, ",nlace");
if (cr->framelength > 0)
_tcscat (s, ",lof");
else if (cr->framelength == 0)
_tcscat (s, ",shf");
if (cr->vsync > 0)
_tcscat (s, ",vsync");
else if (cr->vsync == 0)
_tcscat (s, ",nvsync");
if (cr->commands[0]) {
_tcscat (s, ",");
_tcscat (s, cr->commands);
unsigned int j;
for (j = 0; j < _tcslen (s); j++) {
if (s[j] == '\n')
s[j] = ',';
}
s[_tcslen (s) - 1] = 0;
}
if (i == CHIPSET_REFRESH_PAL)
cfgfile_dwrite (f, "displaydata_pal", tmp);
else if (i == CHIPSET_REFRESH_NTSC)
cfgfile_dwrite (f, "displaydata_ntsc", tmp);
else
cfgfile_dwrite (f, "displaydata", tmp);
}
cfgfile_write_str (f, "collision_level", collmode[p->collision_level]);
cfgfile_write_str(f, "chipset_compatible", cscompa[p->cs_compatible]);
......@@ -1521,10 +1574,16 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
return 1;
return cfgfile_yesno (option, value, "gfx_vsync_picasso", &p->gfx_pvsync);
}
if (cfgfile_strval (option, value, "gfx_vsyncmode", &p->gfx_avsyncmode, vsyncmodes2, 0))
return 1;
if (cfgfile_strval (option, value, "gfx_vsyncmode_picasso", &p->gfx_pvsyncmode, vsyncmodes2, 0))
return 1;
if (cfgfile_yesno (option, value, "show_leds", &vb)) {
if (vb)
p->leds_on_screen |= STATUSLINE_CHIPSET;
else
p->leds_on_screen &= ~STATUSLINE_CHIPSET;
return 1;
}
if (cfgfile_yesno (option, value, "show_leds_rtg", &vb)) {
......@@ -1797,6 +1856,95 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
return 1;
}
if (_tcscmp (option, "displaydata") == 0 || _tcscmp (option, "displaydata_pal") == 0 || _tcscmp (option, "displaydata_ntsc") == 0) {
_tcsncpy (tmpbuf, value, sizeof tmpbuf / sizeof (TCHAR) - 1);
tmpbuf[sizeof tmpbuf / sizeof (TCHAR) - 1] = '\0';
int vert = -1, horiz = -1, lace = -1, ntsc = -1, framelength = -1, vsync = -1;
int locked = 0;
double rate = -1;
TCHAR cmd[MAX_DPATH], label[16] = { 0 };
TCHAR *tmpp = tmpbuf;
TCHAR *end = tmpbuf + _tcslen (tmpbuf);
cmd[0] = 0;
for (;;) {
TCHAR *next = _tcschr (tmpp, ',');
TCHAR *equals = _tcschr (tmpp, '=');
if (!next)
next = end;
if (equals == NULL || equals > next)
equals = NULL;
else
equals++;
*next = 0;
if (rate < 0)
rate = _tstof (tmpp);
else if (!_tcsnicmp (tmpp, "v=", 2))
vert = _tstol (equals);
else if (!_tcsnicmp (tmpp, "h=", 2))
horiz = _tstol (equals);
else if (!_tcsnicmp (tmpp, "t=", 2))
_tcsncpy (label, equals, sizeof label / sizeof (TCHAR) - 1);
else if (equals) {
if (_tcslen (cmd) + _tcslen (tmpp) + 2 < sizeof (cmd) / sizeof(TCHAR)) {
_tcscat (cmd, tmpp);
_tcscat (cmd, "\n");
}
}
if (!_tcsnicmp (tmpp, "locked", 4))
locked = 1;
if (!_tcsnicmp (tmpp, "nlace", 5))
lace = 0;
if (!_tcsnicmp (tmpp, "lace", 4))
lace = 1;
if (!_tcsnicmp (tmpp, "nvsync", 5))
vsync = 0;
if (!_tcsnicmp (tmpp, "vsync", 4))
vsync = 1;
if (!_tcsnicmp (tmpp, "ntsc", 4))
ntsc = 1;
if (!_tcsnicmp (tmpp, "pal", 3))
ntsc = 0;
if (!_tcsnicmp (tmpp, "lof", 3))
framelength = 1;
if (!_tcsnicmp (tmpp, "shf", 3))
framelength = 0;
tmpp = next;
if (tmpp >= end)
break;
tmpp++;
}
if (rate > 0) {
for (i = 0; i < MAX_CHIPSET_REFRESH; i++) {
if (_tcscmp (option, "displaydata_pal") == 0) {
i = CHIPSET_REFRESH_PAL;
p->cr[i].rate = -1;
_tcscpy (label, "PAL");
} else if (_tcscmp (option, "displaydata_ntsc") == 0) {
i = CHIPSET_REFRESH_NTSC;
p->cr[i].rate = -1;
_tcscpy (label, "NTSC");
}
if (p->cr[i].rate <= 0) {
p->cr[i].horiz = horiz;
p->cr[i].vert = vert;
p->cr[i].lace = lace;
p->cr[i].ntsc = ntsc;
p->cr[i].vsync = vsync;
p->cr[i].locked = locked != 0;
p->cr[i].framelength = framelength;
p->cr[i].rate = rate;
_tcscpy (p->cr[i].commands, cmd);
_tcscpy (p->cr[i].label, label);
break;
}
}
}
return 1;
}
return 0;
}
......@@ -2598,6 +2746,24 @@ static void cfgfile_parse_separated_line (struct uae_prefs *p, TCHAR *line1b, TC
}
}
void cfgfile_parse_lines (struct uae_prefs *p, const TCHAR *lines, int type)
{
TCHAR *buf = my_strdup (lines);
TCHAR *t = buf;
for (;;) {
if (_tcslen (t) == 0)
break;
TCHAR *t2 = _tcschr (t, '\n');
if (t2)
*t2 = 0;
cfgfile_parse_line (p, t, type);
if (!t2)
break;
t = t2 + 1;
}
xfree (buf);
}
void cfgfile_parse_line (struct uae_prefs *p, TCHAR *line, int type)
{
TCHAR line1b[CONFIG_BLEN], line2b[CONFIG_BLEN];
......@@ -3756,7 +3922,7 @@ void default_prefs (struct uae_prefs *p, int type)
p->gfx_max_vertical = VRES_DOUBLE;
p->color_mode = 2;
p->gfx_blackerthanblack = 0;
p->gfx_backbuffers = 2;
p->gfx_backbuffers = 1;
#ifdef USE_X11_GFX
p->x11_use_low_bandwidth = 0;
......@@ -3918,6 +4084,33 @@ void default_prefs (struct uae_prefs *p, int type)
blkdev_default_prefs (p);
#endif
p->cr_selected = -1;
struct chipset_refresh *cr;
for (i = 0; i < MAX_CHIPSET_REFRESH_TOTAL; i++) {
cr = &p->cr[i];
cr->rate = -1;
}
cr = &p->cr[CHIPSET_REFRESH_PAL];
cr->horiz = -1;
cr->vert = -1;
cr->lace = -1;
cr->vsync = - 1;
cr->framelength = -1;
cr->rate = 50.0;
cr->ntsc = 0;
cr->locked = false;
_tcscpy (cr->label, "PAL");
cr = &p->cr[CHIPSET_REFRESH_NTSC];
cr->horiz = -1;
cr->vert = -1;
cr->lace = -1;
cr->vsync = - 1;
cr->framelength = -1;
cr->rate = 60.0;
cr->ntsc = 1;
cr->locked = false;
_tcscpy (cr->label, "NTSC");
zfile_fclose (default_file);
default_file = NULL;
f = zfile_fopen_empty (NULL, "configstore", 100000);
......
......@@ -1651,6 +1651,36 @@ STATIC_INLINE int one_fetch_cycle (int pos, int ddfstop_to_test, int dma, int fm
}
}
static void update_fetch_x (int hpos, int fm)
{
int pos;
if (nodraw ())
return;
unsigned int i;
pos = last_fetch_hpos;
update_toscr_planes ();
for (i = 0; i < 8; i++)
fetched[i] = bplxdat[i];
beginning_of_plane_block (hpos, fm);
for (; pos < hpos; pos++) {
toscr_nbits += 2 << toscr_res;
if (toscr_nbits > 16) {
uae_abort ("toscr_nbits > 16 (%d)", toscr_nbits);
toscr_nbits = 0;
}
if (toscr_nbits == 16)
flush_display (fm);
}
flush_display (fm);
bpl1dat_written = 0;
}
STATIC_INLINE void update_fetch (int until, int fm)
{
int pos;
......@@ -1778,6 +1808,9 @@ STATIC_INLINE void decide_fetch (int hpos)
#endif
default: uae_abort ("fetchmode corrupt");
}
} else if (0 && bpl1dat_written) {
// "pio" mode display
update_fetch_x (hpos, fetchmode);
}
maybe_check (hpos);
last_fetch_hpos = hpos;
......@@ -2504,6 +2537,7 @@ static void finish_decisions (void)
decide_diw (hpos);
decide_line (hpos);
decide_fetch (hpos);
finish_final_fetch (hpos, fetchmode);
record_color_change2 (hsyncstartpos, 0xffff, 0);
if (thisline_decision.plfleft != -1 && thisline_decision.plflinelen == -1) {
......@@ -2677,9 +2711,9 @@ static int islinetoggle (void)
static int isvsync (void)
{
if (currprefs.gfx_afullscreen != GFX_FULLSCREEN || picasso_on || !currprefs.gfx_avsync)
if (picasso_on || !currprefs.gfx_avsync || (currprefs.gfx_avsync == 0 && !currprefs.gfx_afullscreen))
return 0;
return currprefs.gfx_avsync;
return currprefs.gfx_avsyncmode == 0 ? 1 : -1;
}
int vsynctime_orig;
......@@ -2736,22 +2770,15 @@ int current_maxvpos (void)
/* set PAL/NTSC or custom timing variables */
void init_hz_fullinit (bool fullinit)
{
int isntsc;
int isntsc, islace;
int odbl = doublescan, omaxvpos = maxvpos;
double ovblank = vblank_hz;
int hzc = 0;
unsigned int i;
if (fullinit)
vpos_count = vpos_count_prev = 0;
if (vsync_switchmode (-1, 0))
currprefs.gfx_avsync = changed_prefs.gfx_avsync = vsync_switchmode (-1, 0) ? 2 : 0;
if (!isvsync () && (DBLEQU (currprefs.chipset_refreshrate, 50) && !currprefs.ntscmode) ||
(DBLEQU (currprefs.chipset_refreshrate, 60) && currprefs.ntscmode)) {
currprefs.chipset_refreshrate = changed_prefs.chipset_refreshrate = 0.0;
}
doublescan = 0;
if ((beamcon0 & 0xA0) != (new_beamcon0 & 0xA0))
hzc = 1;
......@@ -2761,6 +2788,7 @@ void init_hz_fullinit (bool fullinit)
}
beamcon0 = new_beamcon0;
isntsc = (beamcon0 & 0x20) ? 0 : 1;
islace = (bplcon0 & 4) ? 1 : 0;
if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS))
isntsc = currprefs.ntscmode ? 1 : 0;
if (!isntsc) {
......@@ -2837,16 +2865,49 @@ void init_hz_fullinit (bool fullinit)
eventtab[ev_hsync].evtime = get_cycles () + HSYNCTIME;
events_schedule ();
if (hzc) {
interlace_seen = (bplcon0 & 4) ? 1 : 0;
interlace_seen = islace;
reset_drawing ();
}
if ((DBLEQU (vblank_hz, 50) || DBLEQU (vblank_hz, 60)) && isvsync () == 2) {
if (getvsyncrate (currprefs.gfx_refreshrate) != vblank_hz)
vsync_switchmode (vblank_hz, currprefs.gfx_refreshrate);
}
if (isvsync ()) {
changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate = abs (currprefs.gfx_refreshrate);
}
for (i = 0; i < MAX_CHIPSET_REFRESH_TOTAL; i++) {
struct chipset_refresh *cr = &currprefs.cr[i];
if ((cr->horiz < 0 || cr->horiz == maxhpos) &&
(cr->vert < 0 || cr->vert == maxvpos_nom) &&
(cr->ntsc < 0 || (cr->ntsc > 0 && isntsc) || (cr->ntsc == 0 && !isntsc)) &&
(cr->lace < 0 || (cr->lace > 0 && islace) || (cr->lace == 0 && !islace)) &&
(cr->framelength < 0 || (cr->framelength > 0 && lof_store) || (cr->framelength == 0 && !lof_store)) &&
(cr->vsync < 0 || (cr->vsync > 0 && isvsync ()) || (cr->vsync == 0 && !isvsync ()))) {
double v = -1;
if (isvsync ()) {
if (i == CHIPSET_REFRESH_PAL || i == CHIPSET_REFRESH_NTSC) {
if ((abs (vblank_hz - 50) < 1 || abs (vblank_hz - 60) < 1) && currprefs.gfx_avsync == 2 && currprefs.gfx_afullscreen > 0) {
vsync_switchmode (vblank_hz > 55 ? 60 : 50);
}
}
if (isvsync () < 0) {
double v2;
changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate = cr->rate;
v2 = vblank_calibrate (cr->locked);
if (!cr->locked)
v = v2;
}
} else {
if (cr->locked == true)
v = cr->rate;
else
v = vblank_hz;
}
if (v < 0)
v = cr->rate;
if (v > 0) {
changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate = v;
cfgfile_parse_lines (&changed_prefs, cr->commands, -1);
}
break;
}
}
maxvpos_total = (currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? 2047 : 511;
if (maxvpos_total > MAXVPOS)
maxvpos_total = MAXVPOS;
......@@ -2872,7 +2933,7 @@ void init_hz_fullinit (bool fullinit)
//inputdevice_tablet_strobe ();
write_log ("%s mode%s%s V=%.4fHz H=%0.4fHz (%dx%d+%d)\n",
isntsc ? "NTSC" : "PAL",
(bplcon0 & 4) ? " interlaced" : "",
islace ? " laced" : "",
doublescan > 0 ? " dblscan" : "",
vblank_hz, vblank_hz * maxvpos_nom,
maxhpos, maxvpos, lof_store ? 1 : 0);
......@@ -2951,7 +3012,7 @@ void init_custom (void)
update_mirrors();
create_cycle_diagram_table ();
reset_drawing ();
init_hz_full ();
init_hz ();
calcdiw ();
}
......@@ -4982,9 +5043,16 @@ static void framewait (void)
{
frame_time_t curr_time;
frame_time_t start;
int vs = isvsync ();
if (isvsync ()) {
if (vs > 0) {
vsyncmintime = vsynctime;
update_screen ();
return;
} else if (vs < 0) {
vsyncmintime = vsynctime;
vsync_busywait ();
update_screen ();
return;
}
for (;;) {
......@@ -4993,6 +5061,7 @@ static void framewait (void)
break;
uae_msleep (2);
}
update_screen ();
curr_time = start = uae_gethrtime ();
while (rpt_vsync () < 0);
curr_time = uae_gethrtime ();
......@@ -5108,6 +5177,7 @@ static void vsync_handler_post (void)
if ((long int)(curr_time - vsyncmintime) > 0 || rpt_did_reset)
vsyncmintime = curr_time + vsynctime;
rpt_did_reset = 0;
update_screen ();
} else if (rpt_available) {
framewait ();
}
......@@ -5115,11 +5185,15 @@ static void vsync_handler_post (void)
} else {
if (rpt_available && currprefs.m68k_speed == 0) {
framewait ();
} else {
update_screen ();
}
}
#endif
} else {
} else if (currprefs.m68k_speed == 0) {
framewait ();
} else {
update_screen ();
}
gui_handle_events ();
......@@ -7115,13 +7189,9 @@ void check_prefs_changed_custom (void)
currprefs.cs_slowmemisfast = changed_prefs.cs_slowmemisfast;
if (currprefs.chipset_mask != changed_prefs.chipset_mask ||
currprefs.gfx_avsync != changed_prefs.gfx_avsync ||
currprefs.gfx_pvsync != changed_prefs.gfx_pvsync ||
currprefs.picasso96_nocustom != changed_prefs.picasso96_nocustom ||
currprefs.ntscmode != changed_prefs.ntscmode) {
currprefs.picasso96_nocustom = changed_prefs.picasso96_nocustom;
currprefs.gfx_avsync = changed_prefs.gfx_avsync;
currprefs.gfx_pvsync = changed_prefs.gfx_pvsync;
currprefs.chipset_mask = changed_prefs.chipset_mask;
if (currprefs.ntscmode != changed_prefs.ntscmode) {
currprefs.ntscmode = changed_prefs.ntscmode;
......
......@@ -5859,7 +5859,7 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke
for (;;) {
if (fileblock == -1) {
if (!fsnode)
write_log ("RDB: required FS %08X not in FileSystem.resource or in RDB\n", dostype);
write_log ("RDB: FS %08X not in FileSystem.resource or in RDB\n", dostype);
goto error;
}
if (!legalrdbblock (uip, fileblock)) {
......@@ -5873,7 +5873,8 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke
goto error;
}
fileblock = rl (buf + 16);
if ((dostype >> 8) == (rl (buf + 32) >> 8))
uae_u32 rdbdostype = rl (buf + 32);
if (((dostype >> 8) == (rdbdostype >> 8) && (dostype != 0x444f5300 && (dostype & 0xffffff00) == 0x444f5300)) || (dostype == rdbdostype))
break;
}
newversion = (buf[36] << 8) | buf[37];
......
......@@ -175,6 +175,7 @@ struct ide_hdf
int num;
int type;
int blocksize;
int maxtransferstate;
};
static struct ide_hdf *idedrive[4];
......@@ -549,7 +550,7 @@ static int get_nsec (int lba48)
else
return ide_nsector == 0 ? 256 : ide_nsector;
}
static void dec_nsec (int lba48, int v)
static int dec_nsec (int lba48, int v)
{
if (lba48) {
uae_u16 nsec;
......@@ -557,8 +558,10 @@ static void dec_nsec (int lba48, int v)
ide_nsector -= v;
ide_nsector2 = nsec >> 8;
ide_nsector = nsec & 0xff;
return (ide_nsector2 << 8) | ide_nsector;
} else {
ide_nsector -= v;
return ide_nsector;
}
}
......@@ -600,6 +603,28 @@ static void put_lbachs (struct ide_hdf *ide, uae_u64 lba, unsigned int cyl, unsi
}
}
static void check_maxtransfer (int state)
{
if (state == 1) {
// transfer was started
if (ide->maxtransferstate < 2 && ide_nsector == 0) {
ide->maxtransferstate = 1;
} else if (ide->maxtransferstate == 2) {
// second transfer was started (part of split)
write_log ("IDE maxtransfer check detected split >256 block transfer\n");
ide->maxtransferstate = 0;
} else {
ide->maxtransferstate = 0;
}
} else if (state == 2) {
// address was read
if (ide->maxtransferstate == 1)
ide->maxtransferstate++;
else
ide->maxtransferstate = 0;
}
}
static void ide_read_sectors (int flags)
{
unsigned int cyl, head, sec, nsec;
......@@ -611,6 +636,7 @@ static void ide_read_sectors (int flags)
ide_fail ();
return;
}
check_maxtransfer(1);
gui_flicker_led (LED_HD, ide->num, 1);
nsec = get_nsec (lba48);
get_lbachs (ide, &lba, &cyl, &head, &sec, lba48);
......@@ -639,6 +665,7 @@ static void ide_write_sectors (int flags)
ide_fail ();
return;
}
check_maxtransfer(1);
gui_flicker_led (LED_HD, ide->num, 2);
nsec = get_nsec (lba48);
get_lbachs (ide, &lba, &cyl, &head, &sec, lba48);
......@@ -718,7 +745,10 @@ static void ide_do_command (uae_u8 cmd)
static uae_u16 ide_get_data (void)
{
int irq = 0;
unsigned int cyl, head, sec, nsec;
uae_u64 lba;
bool irq = false;
bool last = false;
uae_u16 v;
if (IDE_LOG > 4)
......@@ -730,12 +760,10 @@ static uae_u16 ide_get_data (void)
return 0xffff;
return 0;
}
nsec = 0;
if (ide->data_offset == 0 && ide->data_size >= 0) {
unsigned int cyl, head, sec, nsec;
uae_u64 lba;
nsec = get_nsec (ide->lba48);
get_lbachs (ide, &lba, &cyl, &head, &sec, ide->lba48);
nsec = get_nsec (ide->lba48);
if (nsec * ide->blocksize > ide->hdhfd.size - lba * ide->blocksize)
nsec = (ide->hdhfd.size - lba * ide->blocksize) / ide->blocksize;
if (nsec <= 0) {
......@@ -746,8 +774,8 @@ static uae_u16 ide_get_data (void)
if (nsec > ide->data_multi)
nsec = ide->data_multi;
hdf_read (&ide->hdhfd.hfd, ide->secbuf, lba * ide->blocksize, nsec * ide->blocksize);
put_lbachs (ide, lba, cyl, head, sec, nsec, ide->lba48);
dec_nsec (ide->lba48, nsec);
if (!dec_nsec (ide->lba48, nsec))
last = true;
if (IDE_LOG > 1)
write_log ("IDE%d read, read %d bytes to buffer\n", ide->num, nsec * ide->blocksize);
}
......@@ -768,13 +796,16 @@ static uae_u16 ide_get_data (void)
if (IDE_LOG > 1)
write_log ("IDE%d read finished\n", ide->num);
}
if (nsec) {
put_lbachs (ide, lba, cyl, head, sec, last ? nsec - 1 : nsec, ide->lba48);
}
if (irq) {
ide_interrupt ();
}
return v;
}
static void ide_write_drive (void)
static void ide_write_drive (bool last)
{
unsigned int cyl, head, sec, nsec;
uae_u64 lba;
......@@ -784,7 +815,7 @@ static void ide_write_drive (void)
return;
get_lbachs (ide, &lba, &cyl, &head, &sec, ide->lba48);
hdf_write (&ide->hdhfd.hfd, ide->secbuf, lba * ide->blocksize, ide->data_offset);
put_lbachs (ide, lba, cyl, head, sec, nsec, ide->lba48);
put_lbachs (ide, lba, cyl, head, sec, last ? nsec - 1 : sec, ide->lba48);
dec_nsec (ide->lba48, nsec);
if (IDE_LOG > 1)
write_log ("IDE%d write interrupt, %d bytes written\n", ide->num, ide->data_offset);
......@@ -806,15 +837,15 @@ static void ide_put_data (uae_u16 v)
ide->secbuf[ide->data_offset + 0] = v >> 8;
ide->data_offset += 2;
ide->data_size -= 2;
if (((ide->data_offset % ide->blocksize) == 0) && ((ide->data_offset / ide->blocksize) % ide->data_multi) == 0) {
irq = 1;
ide_write_drive ();
}
if (ide->data_size == 0) {
ide_write_drive ();
irq = 1;
ide_write_drive (true);
ide->status &= ~IDE_STATUS_DRQ;
if (IDE_LOG > 1)
write_log ("IDE%d write finished\n", ide->num);
} else if (((ide->data_offset % ide->blocksize) == 0) && ((ide->data_offset / ide->blocksize) % ide->data_multi) == 0) {
irq = 1;
ide_write_drive (false);
}
if (irq)
ide_interrupt ();
......@@ -897,6 +928,7 @@ static uae_u32 ide_read (uaecptr addr)
v = ide_sector2;
else
v = ide_sector;
check_maxtransfer (2);
break;
case IDE_LCYL:
if (ide_devcon & 0x80)
......
......@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>PUAE 2.3.2</string>
<string>PUAE 2.3.3</string>
</property>
<widget class="QWidget" name="centralWidget">
<widget class="QTabWidget" name="tab_main">
......
......@@ -168,7 +168,7 @@ void regstatus (void)
int reginitializeinit (const char *ppath)
{
QSettings settings("PUAE", "2.3.2");
QSettings settings("PUAE", "2.3.3");
settings.beginGroup("Warning");
settings.setValue("info1", "This is unsupported file. Compatibility between versions is not guaranteed.");
......
......@@ -9,7 +9,7 @@
#define UAEMAJOR 2
#define UAEMINOR 3
#define UAESUBREV 2
#define UAESUBREV 3
typedef enum { KBD_LANG_US, KBD_LANG_DK, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT, KBD_LANG_ES, KBD_LANG_FI, KBD_LANG_TR } KbdLang;
......@@ -144,6 +144,24 @@ enum { CP_GENERIC = 1, CP_CDTV, CP_CD32, CP_A500, CP_A500P, CP_A600, CP_A1000,
#define AUTOSCALE_CENTER 6
#define AUTOSCALE_MANUAL 7 // use gfx_xcenter_pos and gfx_ycenter_pos
#define MAX_CHIPSET_REFRESH 10
#define MAX_CHIPSET_REFRESH_TOTAL (MAX_CHIPSET_REFRESH + 2)
#define CHIPSET_REFRESH_PAL (MAX_CHIPSET_REFRESH + 0)
#define CHIPSET_REFRESH_NTSC (MAX_CHIPSET_REFRESH + 1)
struct chipset_refresh
{
bool locked;
int horiz;
int vert;
int lace;
int ntsc;
int vsync;
int framelength;
double rate;
TCHAR label[16];
TCHAR commands[256];
};
struct uae_prefs {
struct strlist *all_lines;
......@@ -225,6 +243,7 @@ struct uae_prefs {
bool gfx_scandoubler;
int gfx_refreshrate;
int gfx_avsync, gfx_pvsync;
int gfx_avsyncmode, gfx_pvsyncmode;
int gfx_resolution;
int gfx_vresolution;
int gfx_lores_mode;
......@@ -265,6 +284,8 @@ struct uae_prefs {
bool ntscmode;
bool genlock;
double chipset_refreshrate;
struct chipset_refresh cr[MAX_CHIPSET_REFRESH + 2];
int cr_selected;
int collision_level;
int leds_on_screen;
struct wh osd_pos;
......@@ -550,6 +571,7 @@ extern void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type
extern int cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink, int userconfig);
extern int cfgfile_save (struct uae_prefs *p, const TCHAR *filename, int);
extern void cfgfile_parse_line (struct uae_prefs *p, TCHAR *, int);
extern void cfgfile_parse_lines (struct uae_prefs *p, const TCHAR *, int);
extern int cfgfile_parse_option (struct uae_prefs *p, TCHAR *option, TCHAR *value, int);
extern int cfgfile_get_description (const TCHAR *filename, TCHAR *description, TCHAR *hostlink, TCHAR *hardwarelink, int *type);
extern void cfgfile_show_usage (void);
......
......@@ -19,7 +19,7 @@
#define UAEMAJOR 2
#define UAEMINOR 3
#define UAESUBREV 2
#define UAESUBREV 3
#define UAEVERSION (256*65536L*UAEMAJOR + 65536L*UAEMINOR + UAESUBREV)
......
......@@ -16,7 +16,9 @@ extern xcolnr xcolors_16[4096];
extern xcolnr xcolors_32[4096];
extern uae_u32 p96_rgbx16[65536];
extern bool vsync_switchmode (int, int);
extern bool vsync_switchmode (int);
extern bool vsync_busywait (void);
extern double vblank_calibrate (bool);
extern void doflashscreen (void);
extern int flashscreen;
......
......@@ -3055,7 +3055,7 @@ static int getoldport (struct uae_input_device *id)
return -1;
}
static int switchdevice (struct uae_input_device *id, int num, int button)
static int switchdevice (struct uae_input_device *id, int num, bool buttonmode)
{
int i, j;
int ismouse = 0;
......@@ -3066,8 +3066,6 @@ static int switchdevice (struct uae_input_device *id, int num, int button)
if (num >= 4)
return 0;
if (!button)
return 0;
for (i = 0; i < MAX_INPUT_DEVICES; i++) {
if (id == &joysticks[i]) {
name = idev[IDTYPE_JOYSTICK].get_uniquename (i);
......@@ -3090,8 +3088,12 @@ static int switchdevice (struct uae_input_device *id, int num, int button)
}
if (!name)
return 0;
if (num == 0 && otherbuttonpressed)
newport = newport ? 0 : 1;
if (buttonmode) {
if (num == 0 && otherbuttonpressed)
newport = newport ? 0 : 1;
} else {
newport = num ? 1 : 0;
}
if (currprefs.input_selected_setting == GAMEPORT_INPUT_SETTINGS) {
if ((num == 0 || num == 1) && currprefs.jports[newport].id != JPORT_CUSTOM) {
int om = jsem_ismouse (num, &currprefs);
......@@ -3198,6 +3200,7 @@ static void process_custom_event (struct uae_input_device *id, int offset, int s
static void setbuttonstateall (struct uae_input_device *id, struct uae_input_device2 *id2, int button, int state)
{
static frame_time_t switchdevice_timeout;
int i;
uae_u32 mask = 1 << button;
uae_u32 omask = id2->buttonmask & mask;
......@@ -3208,8 +3211,15 @@ static void setbuttonstateall (struct uae_input_device *id, struct uae_input_dev
if (input_play)
return;
if (!id->enabled) {
if (state)
switchdevice (id, button, 1);
frame_time_t t = read_processor_time ();
if (state) {
switchdevice_timeout = t;
} else {
int port = button;
if (t - switchdevice_timeout >= syncbase) // 1s
port ^= 1;
switchdevice (id, port, true);
}
return;
}
if (button >= ID_BUTTON_TOTAL)
......@@ -5737,7 +5747,7 @@ int inputdevice_joyport_config (struct uae_prefs *p, TCHAR *value, int portnum,
break;
case 0:
{
int start = JPORT_NONE, got = 0, max = 0;
int start = JPORT_NONE, got = 0, max = -1;
TCHAR *pp = 0;
if (_tcsncmp (value, "kbd", 3) == 0) {
start = JSEM_KBDLAYOUT;
......@@ -5761,7 +5771,7 @@ int inputdevice_joyport_config (struct uae_prefs *p, TCHAR *value, int portnum,
start = JPORT_CUSTOM;
}
if (got) {
if (pp) {
if (pp && max != 0) {
int v = _tstol (pp);
if (start >= 0) {
if (start == JSEM_KBDLAYOUT && v > 0)
......
......@@ -30,6 +30,7 @@
#include "clipboard.h"
#include "fsdb.h"
#include "debug.h"
#include "sleep.h"
#define TRUE 1
#define FALSE 0
......@@ -68,6 +69,10 @@ static struct winuae_currentmode *currentmode = &currentmodestruct;
static int serial_period_hsyncs, serial_period_hsync_counter;
static int data_in_serdatr; /* new data received */
//win32gfx.cpp
static double remembered_vblank;
static int vblankbase;
// dinput
int rawkeyboard = -1;
static bool rawinput_enabled_mouse, rawinput_enabled_keyboard;
......@@ -1355,3 +1360,113 @@ int D3D_goodenough (void)
void update_debug_info(void)
{
}
//win32gfx.cpp
void update_screen (void)
{
//
}
double vblank_calibrate (bool waitonly)
{
frame_time_t t1, t2;
double tsum, tsum2, tval, tfirst;
int maxcnt, maxtotal, total, cnt, tcnt2;
if (remembered_vblank > 0)
return remembered_vblank;
if (waitonly) {
vblankbase = (syncbase / currprefs.chipset_refreshrate) * 3 / 4;
remembered_vblank = -1;
return -1;
}
/*
th = GetCurrentThread ();
int oldpri = GetThreadPriority (th);
SetThreadPriority (th, THREAD_PRIORITY_HIGHEST);
dummythread_die = -1;
dummy_counter = 0;
_beginthread (&dummythread, 0, 0);
sleep_millis (100);
maxtotal = 10;
maxcnt = maxtotal;
tsum2 = 0;
tcnt2 = 0;
for (maxcnt = 0; maxcnt < maxtotal; maxcnt++) {
total = 10;
tsum = 0;
cnt = total;
for (cnt = 0; cnt < total; cnt++) {
if (!waitvblankstate (true))
return -1;
if (!waitvblankstate (false))
return -1;
if (!waitvblankstate (true))
return -1;
t1 = read_processor_time ();
if (!waitvblankstate (false))
return -1;
if (!waitvblankstate (true))
return -1;
t2 = read_processor_time ();
tval = (double)syncbase / (t2 - t1);
if (cnt == 0)
tfirst = tval;
if (abs (tval - tfirst) > 1) {
write_log (L"very unstable vsync! %.6f vs %.6f, retrying..\n", tval, tfirst);
break;
}
tsum2 += tval;
tcnt2++;
if (abs (tval - tfirst) > 0.1) {
write_log (L"unstable vsync! %.6f vs %.6f\n", tval, tfirst);
break;
}
tsum += tval;
}
if (cnt >= total)
break;
}
dummythread_die = 0;
SetThreadPriority (th, oldpri);
if (maxcnt >= maxtotal) {
tsum = tsum2 / tcnt2;
write_log (L"unstable vsync reporting, using average value\n");
} else {
tsum /= total;
}
if (tsum >= 85)
tsum /= 2;
vblankbase = (syncbase / tsum) * 3 / 4;
write_log (L"VSync calibration: %.6fHz\n", tsum);
remembered_vblank = tsum;
return tsum;
*/
return -1;
}
bool vsync_busywait (void)
{
bool v;
static frame_time_t prevtime;
if (currprefs.turbo_emulation)
return true;
while (uae_gethrtime () - prevtime < vblankbase)
uae_msleep (1);
v = false;
/*
if (currprefs.gfx_api) {
v = D3D_vblank_busywait ();
} else {
v = DirectDraw_vblank_busywait ();
}
*/
if (v) {
prevtime = uae_gethrtime ();
return true;
}
return false;
}
......@@ -580,8 +580,12 @@ static void picasso_trigger_vblank (void)
static int isvsync (void)
{
return currprefs.gfx_pfullscreen && currprefs.gfx_pvsync;
}
if (currprefs.gfx_pfullscreen && currprefs.gfx_pvsync)
return 1;
if (currprefs.gfx_pvsync && currprefs.gfx_pvsyncmode)
return -1;
return 0;
}
void picasso_handle_vsync (void)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment