This commit is contained in:
Toni Wilen 2012-08-14 18:11:20 +03:00
parent ff85569f00
commit 2048239216
20 changed files with 408 additions and 216 deletions

View File

@ -724,6 +724,9 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
cfgfile_write_bool (f, _T("sound_auto"), p->sound_auto);
cfgfile_write_bool (f, _T("sound_stereo_swap_paula"), p->sound_stereo_swap_paula);
cfgfile_write_bool (f, _T("sound_stereo_swap_ahi"), p->sound_stereo_swap_ahi);
cfgfile_dwrite (f, _T("sampler_frequency"), _T("%d"), p->sampler_freq);
cfgfile_dwrite (f, _T("sampler_buffer"), _T("%d"), p->sampler_buffer);
cfgfile_dwrite_bool (f, _T("sampler_stereo"), p->sampler_stereo);
cfgfile_write_str (f, _T("comp_trustbyte"), compmode[p->comptrustbyte]);
cfgfile_write_str (f, _T("comp_trustword"), compmode[p->comptrustword]);
@ -1033,6 +1036,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
cfgfile_write (f, _T("gfxcard_size"), _T("%d"), p->rtgmem_size / 0x100000);
cfgfile_write_str (f, _T("gfxcard_type"), rtgtype[p->rtgmem_type]);
cfgfile_write_bool (f, _T("gfxcard_hardware_vblank"), p->rtg_hardwareinterrupt);
cfgfile_write_bool (f, _T("gfxcard_hardware_sprite"), p->rtg_hardwaresprite);
cfgfile_write (f, _T("chipmem_size"), _T("%d"), p->chipmem_size == 0x20000 ? -1 : (p->chipmem_size == 0x40000 ? 0 : p->chipmem_size / 0x80000));
cfgfile_dwrite (f, _T("megachipmem_size"), _T("%d"), p->z3chipmem_size / 0x100000);
@ -1041,7 +1045,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
} else {
cfgfile_write_str (f, _T("cpu_speed"), p->m68k_speed < 0 ? _T("max") : _T("real"));
}
cfgfile_write (f, _T("cpu_throttle"), _T("%d"), p->m68k_speed_throttle);
cfgfile_write (f, _T("cpu_throttle"), _T("%.1f"), p->m68k_speed_throttle);
/* do not reorder start */
write_compatibility_cpu(f, p);
@ -1093,6 +1097,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
write_filesys_config (p, f);
if (p->filesys_no_uaefsdb)
cfgfile_write_bool (f, _T("filesys_no_fsdb"), p->filesys_no_uaefsdb);
cfgfile_dwrite (f, _T("filesys_max_size"), _T("%d"), p->filesys_limit);
#endif
write_inputdevice_config (p, f);
}
@ -1487,6 +1492,8 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
|| cfgfile_intval (option, value, _T("sound_volume_cd"), &p->sound_volume_cd, 1)
|| cfgfile_intval (option, value, _T("sound_stereo_separation"), &p->sound_stereo_separation, 1)
|| cfgfile_intval (option, value, _T("sound_stereo_mixing_delay"), &p->sound_mixed_stereo_delay, 1)
|| cfgfile_intval (option, value, _T("sampler_frequency"), &p->sampler_freq, 1)
|| cfgfile_intval (option, value, _T("sampler_buffer"), &p->sampler_buffer, 1)
|| cfgfile_intval (option, value, _T("gfx_framerate"), &p->gfx_framerate, 1)
|| cfgfile_intval (option, value, _T("gfx_width_windowed"), &p->gfx_size_win.width, 1)
@ -1529,6 +1536,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
|| cfgfile_intval (option, value, _T("gfx_contrast"), &p->gfx_contrast, 1)
|| cfgfile_intval (option, value, _T("gfx_gamma"), &p->gfx_gamma, 1)
|| cfgfile_string (option, value, _T("gfx_filter_mask"), p->gfx_filtermask, sizeof p->gfx_filtermask / sizeof (TCHAR))
|| cfgfile_intval (option, value, _T("filesys_max_size"), &p->filesys_limit, 1)
#endif
|| cfgfile_intval (option, value, _T("floppy0sound"), &p->floppyslots[0].dfxclick, 1)
@ -1549,6 +1557,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
return 1;
if (cfgfile_yesno (option, value, _T("use_debugger"), &p->start_debugger)
|| cfgfile_yesno (option, value, _T("sampler_stereo"), &p->sampler_stereo)
|| cfgfile_yesno (option, value, _T("sound_auto"), &p->sound_auto)
|| cfgfile_yesno (option, value, _T("sound_stereo_swap_paula"), &p->sound_stereo_swap_paula)
|| cfgfile_yesno (option, value, _T("sound_stereo_swap_ahi"), &p->sound_stereo_swap_ahi)
@ -1680,14 +1689,14 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
while (s) {
if (!_tcschr (s, ':'))
break;
p->osd_pos.x = _tstof (s) * 10.0;
p->osd_pos.x = (int)(_tstof (s) * 10.0);
s = _tcschr (s, ':');
if (!s)
break;
if (s[-1] == '%')
p->osd_pos.x += 30000;
s++;
p->osd_pos.y = _tstof (s) * 10.0;
p->osd_pos.y = (int)(_tstof (s) * 10.0);
s += _tcslen (s);
if (s[-1] == '%')
p->osd_pos.y += 30000;
@ -2533,6 +2542,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH
|| cfgfile_yesno (option, value, _T("agnus_bltbusybug"), &p->cs_agnusbltbusybug)
|| cfgfile_yesno (option, value, _T("fastmem_autoconfig"), &p->fastmem_autoconfig)
|| cfgfile_yesno (option, value, _T("gfxcard_hardware_vblank"), &p->rtg_hardwareinterrupt)
|| cfgfile_yesno (option, value, _T("gfxcard_hardware_sprite"), &p->rtg_hardwaresprite)
|| cfgfile_yesno (option, value, _T("kickshifter"), &p->kickshifter)
|| cfgfile_yesno (option, value, _T("ntsc"), &p->ntscmode)
@ -2556,6 +2566,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH
|| cfgfile_yesno (option, value, _T("comp_lowopt"), &p->comp_lowopt)
|| cfgfile_yesno (option, value, _T("rtg_nocustom"), &p->picasso96_nocustom)
|| cfgfile_yesno (option, value, _T("floppy_write_protected"), &p->floppy_read_only)
|| cfgfile_yesno (option, value, _T("floppy_auto_extended_adf"), &p->floppy_auto_ext2)
|| cfgfile_yesno (option, value, _T("uaeserial"), &p->uaeserial))
return 1;
@ -2736,7 +2747,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH
p->m68k_speed *= CYCLE_UNIT;
return 1;
}
if (cfgfile_intval (option, value, _T("cpu_throttle"), &p->m68k_speed_throttle, 1)) {
if (cfgfile_doubleval (option, value, _T("cpu_throttle"), &p->m68k_speed_throttle)) {
return 1;
}
if (cfgfile_intval (option, value, _T("finegrain_cpu_speed"), &p->m68k_speed, 1)) {
@ -4131,6 +4142,9 @@ void default_prefs (struct uae_prefs *p, int type)
p->sound_filter = FILTER_SOUND_EMUL;
p->sound_filter_type = 0;
p->sound_auto = 1;
p->sampler_stereo = false;
p->sampler_buffer = 0;
p->sampler_freq = 0;
p->comptrustbyte = 0;
p->comptrustword = 0;
@ -4278,6 +4292,7 @@ void default_prefs (struct uae_prefs *p, int type)
p->chipset_mask = CSMASK_ECS_AGNUS;
p->genlock = 0;
p->ntscmode = 0;
p->filesys_limit = 0;
p->fastmem_size = 0x00000000;
p->fastmem2_size = 0x00000000;
@ -4508,7 +4523,7 @@ static void set_68020_compa (struct uae_prefs *p, int compa, int cd32)
/* 0: cycle-exact
* 1: more compatible
* 2: no more compatible, no 100% sound
* 3: no more compatible, immediate blits, no 100% sound
* 3: no more compatible, waiting blits, no 100% sound
*/
static void set_68000_compa (struct uae_prefs *p, int compa)
@ -4525,7 +4540,6 @@ static void set_68000_compa (struct uae_prefs *p, int compa)
p->cpu_compatible = 0;
break;
case 3:
p->immediate_blits = 1;
p->produce_sound = 2;
p->cpu_compatible = 0;
break;
@ -4543,7 +4557,6 @@ static int bip_a3000 (struct uae_prefs *p, int config, int compa, int romcheck)
else
roms[0] = 59;
roms[1] = -1;
p->immediate_blits = 1;
p->bogomem_size = 0;
p->chipmem_size = 0x200000;
p->cpu_model = 68030;
@ -4572,7 +4585,7 @@ static int bip_a4000 (struct uae_prefs *p, int config, int compa, int romcheck)
roms[2] = 13;
roms[3] = 12;
roms[4] = -1;
p->immediate_blits = 1;
p->bogomem_size = 0;
p->chipmem_size = 0x200000;
p->mbresmem_low_size = 8 * 1024 * 1024;
@ -4604,7 +4617,7 @@ static int bip_a4000t (struct uae_prefs *p, int config, int compa, int romcheck)
roms[1] = 31;
roms[2] = 13;
roms[3] = -1;
p->immediate_blits = 1;
p->bogomem_size = 0;
p->chipmem_size = 0x200000;
p->mbresmem_low_size = 8 * 1024 * 1024;
@ -4959,7 +4972,7 @@ int built_in_prefs (struct uae_prefs *p, int model, int config, int compa, int r
v = bip_super (p, config, compa, romcheck);
break;
}
if (p->cpu_model >= 68020 || !p->cpu_cycle_exact)
if ((p->cpu_model >= 68020 || !p->cpu_cycle_exact) && !p->immediate_blits)
p->waiting_blits = 1;
return v;
}

View File

@ -250,6 +250,7 @@ static bool bpl1dat_written, bpl1dat_early, bpl1dat_written_at_least_once;
static uae_s16 bpl1mod, bpl2mod;
static uaecptr prevbpl[2][MAXVPOS][8];
static uaecptr bplpt[8], bplptx[8];
static bool brdblank_prevframe[MAXVPOS];
/*static int blitcount[256]; blitter debug */
@ -891,6 +892,15 @@ static bool isehb (uae_u16 bplcon0, uae_u16 bplcon2)
return bplehb;
}
static bool isbrdblank (uae_u16 bplcon0, uae_u16 bplcon3)
{
#ifdef ECS_DENISE
return (currprefs.chipset_mask & CSMASK_ECS_DENISE) && (bplcon0 & 1) && (bplcon3 & 0x20);
#else
return false;
#endif
}
// OCS/ECS, lores, 7 planes = 4 "real" planes + BPL5DAT and BPL6DAT as static 5th and 6th plane
STATIC_INLINE int isocs7planes (void)
{
@ -2041,8 +2051,11 @@ static void record_register_change (int hpos, int regno, uae_u16 value)
if (value & 0x800)
thisline_decision.ham_seen = 1;
thisline_decision.ehb_seen = isehb (value, bplcon2);
thisline_decision.brdblank_seen = isbrdblank (value, bplcon3);
} else if (regno == 0x104) { // BPLCON2
thisline_decision.ehb_seen = isehb (value, bplcon2);
thisline_decision.ehb_seen = isehb (bplcon0, value);
} else if (regno == 0x106) { // BPLCON3
thisline_decision.brdblank_seen = isbrdblank (bplcon0, value);
}
record_color_change (hpos, regno + 0x1000, value);
}
@ -2644,6 +2657,12 @@ static void finish_decisions (void)
changed = 1;
}
/* if last frame's brdblank was different = mark line changed */
if (brdblank_prevframe[vpos] != thisline_decision.brdblank_seen) {
changed = 1;
brdblank_prevframe[vpos] = thisline_decision.brdblank_seen;
}
if (changed) {
thisline_changed = 1;
*dp = thisline_decision;
@ -2689,6 +2708,7 @@ static void reset_decisions (void)
thisline_decision.plflinelen = -1;
thisline_decision.ham_seen = !! (bplcon0 & 0x800);
thisline_decision.ehb_seen = !! isehb (bplcon0, bplcon2);
thisline_decision.brdblank_seen = !! isbrdblank (bplcon0, bplcon3);
thisline_decision.ham_at_start = !! (bplcon0 & 0x800);
/* decided_res shouldn't be touched before it's initialized by decide_line(). */
@ -2783,7 +2803,7 @@ void compute_vsynctime (void)
if (currprefs.turbo_emulation)
vsynctimebase = vsynctimebase_orig = 1;
else
vsynctimebase = vsynctimebase_orig = syncbase / fake_vblank_hz;
vsynctimebase = vsynctimebase_orig = (int)(syncbase / fake_vblank_hz);
#if 0
if (!picasso_on) {
updatedisplayarea ();
@ -2881,7 +2901,7 @@ void compute_framesync (void)
if (isvsync_chipset ()) {
if (cr->index == CHIPSET_REFRESH_PAL || cr->index == CHIPSET_REFRESH_NTSC) {
if ((fabs (vblank_hz - 50) < 1 || fabs (vblank_hz - 60) < 1 || fabs (vblank_hz - 100) < 1 || fabs (vblank_hz - 120) < 1) && currprefs.gfx_apmode[0].gfx_vsync == 2 && currprefs.gfx_apmode[0].gfx_fullscreen > 0) {
vsync_switchmode (vblank_hz);
vsync_switchmode ((int)vblank_hz);
}
}
if (isvsync_chipset () < 0) {
@ -3791,7 +3811,7 @@ void set_picasso_hack_rate (int hz)
if (!picasso_on)
return;
vpos_count = 0;
p96refresh_active = maxvpos_stored * vblank_hz_stored / hz;
p96refresh_active = (int)(maxvpos_stored * vblank_hz_stored / hz);
if (!currprefs.cs_ciaatod)
changed_prefs.cs_ciaatod = currprefs.cs_ciaatod = currprefs.ntscmode ? 2 : 1;
if (p96refresh_active > 0) {
@ -4392,6 +4412,8 @@ static void checkautoscalecol0 (void)
return;
if (vpos < 20)
return;
if (isbrdblank (bplcon0, bplcon3))
return;
// autoscale if copper changes COLOR00 on top or bottom of screen
if (vpos >= minfirstline) {
int vpos2 = autoscale_bordercolors ? minfirstline : vpos;
@ -5480,7 +5502,7 @@ static bool framewait (void)
if (val > vsynctimebase * 2 / 3)
val = vsynctimebase * 2 / 3;
max = (vsynctimebase - val) * (1000 + currprefs.m68k_speed_throttle) / 1000;
max = (int)((vsynctimebase - val) * (1000.0 + currprefs.m68k_speed_throttle) / 1000.0);
if (max < 1)
max = 1;
@ -5618,7 +5640,7 @@ static bool framewait (void)
if ((int)curr_time - (int)vsyncwaittime > 0 && (int)curr_time - (int)vsyncwaittime < vstb / 2)
adjust += curr_time - vsyncwaittime;
adjust += clockadjust;
max = vstb * (1000 + currprefs.m68k_speed_throttle) / 1000 - adjust;
max = (int)(vstb * (1000.0 + currprefs.m68k_speed_throttle) / 1000.0 - adjust);
vsyncwaittime = curr_time + vstb - adjust;
vsyncmintime = curr_time;

View File

@ -2036,6 +2036,8 @@ static int drive_write_ext2 (uae_u16 *bigmfmbuf, struct zfile *diskfile, trackid
return 1;
}
static void drive_write_data (drive * drv);
static bool convert_adf_to_ext2 (drive *drv)
{
TCHAR name[MAX_DPATH];
@ -2047,16 +2049,26 @@ static bool convert_adf_to_ext2 (drive *drv)
_tcscpy (name, currprefs.floppyslots[drv - floppy].df);
if (!name[0])
return false;
_tcscat (name, _T(".extended.adf"));
if (!disk_creatediskfile (name, 1, hd ? DRV_35_HD : DRV_35_DD, NULL, false, false, currprefs.floppyslots[drv - floppy].df))
TCHAR *p = _tcsrchr (name, '.');
if (!p)
p = name + _tcslen (name);
_tcscpy (p, _T(".extended.adf"));
if (!disk_creatediskfile (name, 1, hd ? DRV_35_HD : DRV_35_DD, NULL, false, false, drv->diskfile))
return false;
f = zfile_fopen (name, _T("rb"), 0);
if (!f)
return false;
_tcscpy (currprefs.floppyslots[drv - floppy].df, name);
_tcscpy (changed_prefs.floppyslots[drv - floppy].df, name);
zfile_fclose (drv->diskfile);
drv->diskfile = f;
read_header_ext2 (drv->diskfile, drv->trackdata, &drv->num_tracks, &drv->ddhd);
drv->filetype = ADF_EXT2;
read_header_ext2 (drv->diskfile, drv->trackdata, &drv->num_tracks, &drv->ddhd);
drive_write_data (drv);
#ifdef RETROPLATFORM
rp_disk_image_change (drv - &floppy[0], name, false);
#endif
drive_fill_bigbuf (drv, 1);
return true;
@ -2080,10 +2092,7 @@ static void drive_write_data (drive * drv)
case ADF_NORMAL:
if (drive_write_adf_amigados (drv)) {
if (currprefs.floppy_auto_ext2) {
if (convert_adf_to_ext2 (drv)) {
drive_write_data (drv);
return;
}
convert_adf_to_ext2 (drv);
} else {
static int warned;
if (!warned)
@ -2176,14 +2185,15 @@ static void floppy_get_rootblock (uae_u8 *dst, int block, const TCHAR *disk_name
/* type: 0=regular, 1=ext2adf */
/* adftype: 0=DD,1=HD,2=DD PC,3=HD PC,4=525SD */
bool disk_creatediskfile (const TCHAR *name, int type, drive_type adftype, const TCHAR *disk_name, bool ffs, bool bootable, const TCHAR *copyfrom)
bool disk_creatediskfile (const TCHAR *name, int type, drive_type adftype, const TCHAR *disk_name, bool ffs, bool bootable, struct zfile *copyfrom)
{
int size = 32768;
struct zfile *f, *sf;
struct zfile *f;
int i, l, file_size, tracks, track_len, sectors;
uae_u8 *chunk = NULL;
int ddhd = 1;
bool ok = false;
uae_u64 pos;
if (type == 1)
tracks = 2 * 83;
@ -2206,9 +2216,8 @@ bool disk_creatediskfile (const TCHAR *name, int type, drive_type adftype, const
}
if (copyfrom) {
sf = zfile_fopen (copyfrom, _T("rb"), 0);
if (!sf)
return false;
pos = zfile_ftell (copyfrom);
zfile_fseek (copyfrom, 0, SEEK_SET);
}
f = zfile_fopen (name, _T("wb"), 0);
@ -2250,14 +2259,14 @@ bool disk_creatediskfile (const TCHAR *name, int type, drive_type adftype, const
for (i = 0; i < tracks; i++) {
uae_u8 tmp[3 * 4];
memcpy (tmp, rawtrack, sizeof rawtrack);
if (dodos || sf)
if (dodos || copyfrom)
memcpy (tmp, dostrack, sizeof dostrack);
zfile_fwrite (tmp, sizeof tmp, 1, f);
}
for (i = 0; i < tracks; i++) {
memset (chunk, 0, size);
if (sf) {
zfile_fread (chunk, 11 * ddhd, 512, sf);
if (copyfrom) {
zfile_fread (chunk, 11 * ddhd, 512, copyfrom);
} else {
if (dodos) {
if (i == 0)
@ -2273,7 +2282,8 @@ bool disk_creatediskfile (const TCHAR *name, int type, drive_type adftype, const
}
xfree (chunk);
zfile_fclose (f);
zfile_fclose (sf);
if (copyfrom)
zfile_fseek (copyfrom, pos, SEEK_SET);
if (f)
DISK_history_add (name, -1, HISTORY_FLOPPY, TRUE);
return ok;

View File

@ -85,7 +85,6 @@ static int linedbl, linedbld;
int interlace_seen = 0;
#define AUTO_LORES_FRAMES 10
static int can_use_lores = 0, frame_res, frame_res_lace, last_max_ypos;
static uae_u16 bplcon0_store, bplcon3_store;
/* Lookup tables for dual playfields. The dblpf_*1 versions are for the case
that playfield 1 has the priority, dbplpf_*2 are used if playfield 2 has
@ -220,7 +219,7 @@ static int bplres;
static int plf1pri, plf2pri, bplxor;
static uae_u32 plf_sprite_mask;
static int sbasecol[2] = { 16, 16 };
static bool brdsprt, brdblank, brdblank_changed;
static bool brdsprt, brdblank;
static int hposblank;
bool picasso_requested_on;
@ -765,6 +764,7 @@ STATIC_INLINE xcolnr getbgc (bool blank)
return xcolors[0x00f];
else if (brdblank)
return xcolors[0x880];
//return colors_for_drawing.acolors[0];
return xcolors[0xf0f];
#endif
return (blank || brdblank || hposblank) ? 0 : colors_for_drawing.acolors[0];
@ -1928,6 +1928,15 @@ STATIC_INLINE void do_flush_screen (struct vidbuffer *vb, int start, int stop)
flush_screen (vb, 0, 0); /* vsync mode */
}
STATIC_INLINE void getbrdblank (void)
{
#ifdef ECS_DENISE
brdblank = dp_for_drawing->brdblank_seen;
#else
brdblank = false;
#endif
}
/* We only save hardware registers during the hardware frame. Now, when
* drawing the frame, we expand the data into a slightly more useful
* form. */
@ -1944,6 +1953,7 @@ static void pfield_expand_dp_bplcon (void)
issprites = dip_for_drawing->nr_sprites;
#ifdef ECS_DENISE
ecsshres = bplres == RES_SUPERHIRES && (currprefs.chipset_mask & CSMASK_ECS_DENISE) && !(currprefs.chipset_mask & CSMASK_AGA);
getbrdblank ();
#endif
plf1pri = dp_for_drawing->bplcon2 & 7;
@ -1981,16 +1991,6 @@ static bool isham (uae_u16 bplcon0)
return 0;
}
static void isbrdblank (void)
{
#ifdef ECS_DENISE
bool brdblank_2 = (currprefs.chipset_mask & CSMASK_ECS_DENISE) && (bplcon0_store & 1) && (bplcon3_store & 0x20);
if (brdblank_2 != brdblank)
brdblank_changed = true;
brdblank = brdblank_2;
#endif
}
static void pfield_expand_dp_bplconx (int regno, int v)
{
if (regno == 0xffff) {
@ -2005,8 +2005,6 @@ static void pfield_expand_dp_bplconx (int regno, int v)
dp_for_drawing->bplres = GET_RES_DENISE (v);
dp_for_drawing->nr_planes = GET_PLANES (v);
dp_for_drawing->ham_seen = isham (v);
bplcon0_store = v;
isbrdblank ();
break;
case 0x104:
dp_for_drawing->bplcon2 = v;
@ -2014,8 +2012,6 @@ static void pfield_expand_dp_bplconx (int regno, int v)
#ifdef ECS_DENISE
case 0x106:
dp_for_drawing->bplcon3 = v;
bplcon3_store = v;
isbrdblank ();
break;
#endif
#ifdef AGA
@ -2179,6 +2175,7 @@ static void pfield_draw_line (struct vidbuffer *vb, int lineno, int gfx_ypos, in
if (xlinebuffer == 0)
xlinebuffer = row_map[gfx_ypos], dh = dh_buf;
xlinebuffer -= linetoscr_x_adjust_bytes;
getbrdblank ();
if (border == 0) {
@ -2771,17 +2768,6 @@ void finish_drawing_frame (void)
if (!didflush)
do_flush_screen (vb, first_drawn_line, last_drawn_line);
#ifdef ECS_DENISE
if (brdblank_changed) {
last_max_ypos = max_ypos_thisframe;
for (i = 0; i < sizeof linestate / sizeof *linestate; i++)
linestate[i] = LINE_UNDECIDED;
notice_screen_contents_lost ();
brdblank_changed = false;
}
#endif
}
void hardware_line_completed (int lineno)
@ -2901,11 +2887,6 @@ void vsync_handle_redraw (int long_frame, int lof_changed, uae_u16 bplcon0p, uae
flush_screen (gfxvidinfo.inbuffer, 0, 0); /* vsync mode */
}
/* check borderblank here because bplcon0 or especially bplcon3 may only be written once outside of displayable area */
bplcon0_store = bplcon0p;
bplcon3_store = bplcon3p;
isbrdblank ();
gui_flicker_led (-1, 0, 0);
#ifdef AVIOUTPUT
if (!picasso_on)

View File

@ -2598,13 +2598,15 @@ static void
int ret, err = ERROR_NO_FREE_STORE;
int blocksize, nr;
uae_u32 dostype;
bool fs = false;
blocksize = 1204;
blocksize = 512;
/* not FFS because it is not understood by WB1.x C:Info */
dostype = DISK_TYPE_DOS;
nr = unit->unit;
if (unit->volflags & MYVOLUMEINFO_ARCHIVE) {
ret = zfile_fs_usage_archive (unit->ui.rootdir, 0, &fsu);
fs = true;
} else if (unit->volflags & MYVOLUMEINFO_CDFS) {
struct isofs_info ii;
ret = isofs_mediainfo (unit->ui.cdfs_superblock, &ii) ? 0 : 1;
@ -2616,6 +2618,7 @@ static void
ret = get_fs_usage (unit->ui.rootdir, 0, &fsu);
if (ret)
err = dos_errno ();
fs = true;
}
if (ret != 0) {
PUT_PCK_RES1 (packet, DOS_FALSE);
@ -2637,7 +2640,14 @@ static void
put_long (info + 24, -1); /* ID_NO_DISK_PRESENT */
put_long (info + 28, 0);
} else {
put_long (info + 12, fsu.fsu_blocks ); /* numblocks */
if (fs && currprefs.filesys_limit) {
if (fsu.fsu_blocks > (uae_u64)currprefs.filesys_limit * 1024 / blocksize) {
uae_u32 oldblocks = fsu.fsu_blocks;
fsu.fsu_blocks = (uae_u32)((uae_u64)currprefs.filesys_limit * 1024 / blocksize);
fsu.fsu_bavail = (uae_u32)((uae_u64)fsu.fsu_bavail * fsu.fsu_blocks / oldblocks);
}
}
put_long (info + 12, fsu.fsu_blocks); /* numblocks */
put_long (info + 16, fsu.fsu_blocks - fsu.fsu_bavail); /* inuse */
put_long (info + 24, dostype); /* disk type */
put_long (info + 28, unit->volume >> 2); /* volume node */
@ -6620,7 +6630,7 @@ static uae_u32 REGPARAM2 filesys_dev_storeinfo (TrapContext *context)
put_long (parmpacket + 80, DISK_TYPE_DOS); /* DOS\0 */
if (type == FILESYS_VIRTUAL) {
put_long (parmpacket + 4, fsdevname);
put_long (parmpacket + 20, 1024 >> 2); /* longwords per block */
put_long (parmpacket + 20, 512 >> 2); /* longwords per block */
put_long (parmpacket + 28, 15); /* heads */
put_long (parmpacket + 32, 1); /* sectors per block */
put_long (parmpacket + 36, 127); /* sectors per track */

View File

@ -29,7 +29,7 @@ extern void DISK_hsync (void);
extern void DISK_reset (void);
extern int disk_getwriteprotect (struct uae_prefs *p, const TCHAR *name);
extern int disk_setwriteprotect (struct uae_prefs *p, int num, const TCHAR *name, bool writeprotected);
extern bool disk_creatediskfile (const TCHAR *name, int type, drive_type adftype, const TCHAR *disk_name, bool ffs, bool bootable, const TCHAR *copyfrom);
extern bool disk_creatediskfile (const TCHAR *name, int type, drive_type adftype, const TCHAR *disk_name, bool ffs, bool bootable, struct zfile *copyfrom);
extern void dumpdisk (void);
extern int DISK_history_add (const TCHAR *name, int idx, int type, int donotcheck);
extern TCHAR *DISK_history_get (int idx, int type);

View File

@ -224,6 +224,7 @@ struct decision {
uae_u8 nr_planes;
uae_u8 bplres;
bool ehb_seen;
bool brdblank_seen;
bool ham_seen;
bool ham_at_start;
};

View File

@ -234,6 +234,10 @@ struct uae_prefs {
bool sound_stereo_swap_ahi;
bool sound_auto;
int sampler_freq;
int sampler_buffer;
bool sampler_stereo;
int comptrustbyte;
int comptrustword;
int comptrustlong;
@ -327,6 +331,7 @@ struct uae_prefs {
uae_u32 maprom;
int turbo_emulation;
bool headless;
int filesys_limit;
int cs_compatible;
int cs_ciaatod;
@ -386,7 +391,7 @@ struct uae_prefs {
struct multipath path_cd;
int m68k_speed;
int m68k_speed_throttle;
double m68k_speed_throttle;
int cpu_model;
int mmu_model;
int cpu060_revision;
@ -409,6 +414,7 @@ struct uae_prefs {
uae_u32 mbresmem_high_size;
uae_u32 rtgmem_size;
bool rtg_hardwareinterrupt;
bool rtg_hardwaresprite;
int rtgmem_type;
uae_u32 custom_memory_addrs[MAX_CUSTOM_MEMORY_ADDRS];
uae_u32 custom_memory_sizes[MAX_CUSTOM_MEMORY_ADDRS];
@ -441,6 +447,8 @@ struct uae_prefs {
bool win32_powersavedisabled;
bool win32_minimize_inactive;
int win32_statusbar;
bool win32_start_minimized;
bool win32_start_uncaptured;
int win32_active_capture_priority;
bool win32_active_nocapture_pause;

View File

@ -1129,9 +1129,9 @@ static void update_68k_cycles (void)
cycles_mult = 0;
if (currprefs.m68k_speed >= 0 && !currprefs.cpu_cycle_exact) {
if (currprefs.m68k_speed_throttle < 0) {
cycles_mult = CYCLES_DIV * 1000 / (1000 + currprefs.m68k_speed_throttle);
cycles_mult = (unsigned long)(CYCLES_DIV * 1000 / (1000 + currprefs.m68k_speed_throttle));
} else if (currprefs.m68k_speed_throttle > 0) {
cycles_mult = CYCLES_DIV * 1000 / (1000 + currprefs.m68k_speed_throttle);
cycles_mult = (unsigned long)(CYCLES_DIV * 1000 / (1000 + currprefs.m68k_speed_throttle));
}
}
if (currprefs.m68k_speed == 0 && currprefs.cpu_model >= 68020) {

View File

@ -2443,14 +2443,14 @@ static void D3D_showframe2 (bool dowait)
sleep_millis (1);
continue;
} else if (hr == S_PRESENT_OCCLUDED) {
;
; //write_log (_T("S_PRESENT_OCCLUDED\n"));
} else if (hr == S_PRESENT_MODE_CHANGED) {
// In most cases mode actually didn't change but
// D3D is just being stupid and not accepting
// all modes that DirectDraw does accept,
// for example interlaced or EDS_RAWMODE modes!
//devicelost = 1;
;
; //write_log (_T("S_PRESENT_MODE_CHANGED\n"));
} else if (FAILED (hr)) {
write_log (_T("%s: Present() %s\n"), D3DHEAD, D3D_ErrorString (hr));
if (hr == D3DERR_DEVICELOST || hr == S_PRESENT_MODE_CHANGED) {

View File

@ -2205,7 +2205,7 @@ static void inituaegfx (uaecptr ABI)
write_log (_T("P96: Blitter disabled in devs:monitors/uaegfx!\n"));
flags |= BIF_BLITTER | BIF_NOMEMORYMODEMIX;
flags &= ~BIF_HARDWARESPRITE;
if (currprefs.gfx_api && D3D_goodenough () > 0 && USE_HARDWARESPRITE) {
if (currprefs.gfx_api && D3D_goodenough () > 0 && USE_HARDWARESPRITE && currprefs.rtg_hardwaresprite) {
hwsprite = 1;
flags |= BIF_HARDWARESPRITE;
write_log (_T("P96: Hardware sprite support enabled\n"));

View File

@ -442,7 +442,6 @@
#define IDC_CONTRIBUTORS 1124
#define IDC_BLACKER_THAN_BLACK 1170
#define IDC_BLITIMM 1174
#define IDC_BLITIMM2 1175
#define IDC_BLITWAIT 1175
#define IDC_LORES 1176
#define IDC_RATE2BOX 1177
@ -642,6 +641,7 @@
#define IDC_WIDTHTEXT 1512
#define IDC_WINDOWEDTEXT 1512
#define IDC_PORT2_TEST 1512
#define IDC_MAPDRIVES_LIMIT 1512
#define IDC_HEIGHTTEXT 1513
#define IDC_PORT3_TEST 1513
#define IDC_SETTINGSTEXT 1514
@ -1065,6 +1065,7 @@
#define IDC_RTG_BUFFERCNT 1795
#define IDC_RTG_VBINTERRUPT 1796
#define IDC_INPUTMAPLIST 1797
#define IDC_RTG_HWSPRITE 1797
#define IDC_PORT1_REMAP 1798
#define IDC_PORT0_REMAP 1799
#define IDC_PORT2_REMAP 1800
@ -1081,6 +1082,7 @@
#define IDC_RTG_DISPLAYSELECT 1809
#define IDC_MISCLIST 1810
#define IDC_STATENAME 1811
#define IDC_SAMPLER_STEREO 1812
#define ID__FLOPPYDRIVES 40004
#define ID_FLOPPYDRIVES_DF0 40005
#define ID_ST_CONFIGURATION 40010

View File

@ -293,25 +293,28 @@ STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
EXSTYLE WS_EX_CONTEXTHELP
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
CONTROL "List1",IDC_VOLUMELIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,5,0,290,130
PUSHBUTTON "Add &Directory or Archive...",IDC_NEW_FS,10,135,103,15
PUSHBUTTON "Add &Hardfile...",IDC_NEW_HF,130,135,74,15
PUSHBUTTON "Add Ha&rd Drive...",IDC_NEW_HD,220,135,75,15
PUSHBUTTON "Remove",IDC_REMOVE,235,155,60,15
PUSHBUTTON "&Properties",IDC_EDIT,235,172,60,15
CONTROL "Add PC drives at startup",IDC_MAPDRIVES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,154,100,10
CONTROL "Disable UAEFSDB-support",IDC_NOUAEFSDB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,154,119,10
CONTROL "Don't use Windows Recycle Bin",IDC_NORECYCLEBIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,166,121,10
CONTROL "Include network drives..",IDC_MAPDRIVES_NET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,178,101,10
CONTROL "CDFS automount CD/DVD drives",IDC_MAPDRIVES_CD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,190,160,10
CONTROL "Automount removable drives",IDC_MAPDRIVES_AUTO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,178,115,10
CONTROL "List1",IDC_VOLUMELIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,5,0,290,116
PUSHBUTTON "Add &Directory or Archive...",IDC_NEW_FS,10,121,103,15
PUSHBUTTON "Add &Hardfile...",IDC_NEW_HF,130,121,74,15
PUSHBUTTON "Add Ha&rd Drive...",IDC_NEW_HD,220,121,75,15
PUSHBUTTON "Remove",IDC_REMOVE,235,141,60,15
PUSHBUTTON "&Properties",IDC_EDIT,235,158,60,15
CONTROL "Add PC drives at startup",IDC_MAPDRIVES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,140,100,10
CONTROL "Disable UAEFSDB-support",IDC_NOUAEFSDB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,140,119,10
CONTROL "Don't use Windows Recycle Bin",IDC_NORECYCLEBIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,152,121,10
CONTROL "Include network drives..",IDC_MAPDRIVES_NET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,164,101,10
CONTROL "CDFS automount CD/DVD drives",IDC_MAPDRIVES_CD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,176,136,10
CONTROL "Automount removable drives [] Windows side insert or removal will immediately mount/remove it on Amiga side.",IDC_MAPDRIVES_AUTO,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,164,115,10
CONTROL "Include removable drives..",IDC_MAPDRIVES_REMOVABLE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,166,100,10
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,152,100,10
COMBOBOX IDC_CD_TEXT,5,224,289,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Eject",IDC_CD_EJECT,265,204,30,15
PUSHBUTTON "Select image file",IDC_CD_SELECT,90,204,98,15
COMBOBOX IDC_CD_TYPE,194,205,63,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "CD drive/image",IDC_STATIC,5,206,70,10,SS_CENTERIMAGE
CONTROL "Limit size of directory drives to 1G [] Workaround for example old installers that calculate free space incorrectly if drive is large.",IDC_MAPDRIVES_LIMIT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,188,136,10
END
IDD_SOUND DIALOGEX 0, 0, 300, 237
@ -381,11 +384,11 @@ BEGIN
PUSHBUTTON "Save As...",IDC_SAVE,175,225,44,15
END
IDD_IOPORTS DIALOGEX 0, 0, 300, 228
IDD_IOPORTS DIALOGEX 0, 0, 305, 245
STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
GROUPBOX "Parallel Port",IDC_STATIC,5,2,291,105
GROUPBOX "Parallel Port",IDC_STATIC,5,2,291,120
RTEXT "Printer:",IDC_STATIC,12,15,25,15,SS_CENTERIMAGE
COMBOBOX IDC_PRINTERLIST,49,15,232,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Flush print job",IDC_FLUSHPRINTER,114,51,58,12
@ -393,24 +396,25 @@ BEGIN
EDITTEXT IDC_PRINTERAUTOFLUSH,255,50,25,12,ES_NUMBER
RTEXT "Type:",IDC_STATIC,15,33,21,15,SS_CENTERIMAGE
EDITTEXT IDC_PS_PARAMS,114,67,167,12,ES_AUTOHSCROLL
GROUPBOX "Serial Port",IDC_STATIC,4,110,292,48
COMBOBOX IDC_SERIAL,49,122,232,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Shared",IDC_SER_SHARED,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,15,141,48,12
CONTROL "RTS/CTS",IDC_SER_CTSRTS,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,75,141,55,12
RTEXT "Out:",IDC_MIDI,10,172,19,15,SS_CENTERIMAGE
COMBOBOX IDC_MIDIOUTLIST,36,173,108,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "In:",IDC_MIDI2,150,171,22,15,SS_CENTERIMAGE
COMBOBOX IDC_MIDIINLIST,181,173,108,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Serial Port",IDC_STATIC,4,124,292,48
COMBOBOX IDC_SERIAL,49,136,232,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Shared",IDC_SER_SHARED,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,15,155,48,12
CONTROL "RTS/CTS",IDC_SER_CTSRTS,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,75,155,55,12
RTEXT "Out:",IDC_MIDI,10,186,19,15,SS_CENTERIMAGE
COMBOBOX IDC_MIDIOUTLIST,36,187,108,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "In:",IDC_MIDI2,150,185,22,15,SS_CENTERIMAGE
COMBOBOX IDC_MIDIINLIST,181,187,108,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Direct []Use when emulating serial-link games on two PCs running WinUAE",IDC_SER_DIRECT,
"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,135,141,65,12
CONTROL "uaeserial.device",IDC_UAESERIAL,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,200,141,78,12
"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,135,155,65,12
CONTROL "uaeserial.device",IDC_UAESERIAL,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,200,155,78,12
COMBOBOX IDC_PRINTERTYPELIST,49,33,232,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Ghostscript extra parameters:",IDC_STATIC,10,66,102,15,SS_CENTERIMAGE
GROUPBOX "MIDI",IDC_STATIC,5,161,291,34,BS_LEFT
GROUPBOX "Protection Dongle",IDC_STATIC,5,197,292,30,BS_LEFT
COMBOBOX IDC_DONGLELIST,50,208,232,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Sampler:",IDC_STATIC,12,84,31,15,SS_CENTERIMAGE
COMBOBOX IDC_SAMPLERLIST,49,85,232,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "MIDI",IDC_STATIC,5,175,291,34,BS_LEFT
GROUPBOX "Protection Dongle",IDC_STATIC,5,212,292,31,BS_LEFT
COMBOBOX IDC_DONGLELIST,50,223,232,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Sampler:",IDC_STATIC,12,85,31,15,SS_CENTERIMAGE
COMBOBOX IDC_SAMPLERLIST,49,86,232,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Stereo sampler",IDC_SAMPLER_STEREO,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,205,104,75,12
END
IDD_GAMEPORTS DIALOGEX 0, 0, 300, 246
@ -606,25 +610,25 @@ BEGIN
GROUPBOX "Options",IDC_STATIC,168,11,114,111
CONTROL "Immediate Blitter [] Faster but less compatible blitter emulation.",IDC_BLITIMM,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,179,27,96,10
CONTROL "Cycle-exact [] The most compatible A500 emulation mode. Very fast PC recommended.",IDC_CYCLEEXACT,
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,179,53,100,10
GROUPBOX "Collision Level",IDC_STATIC,14,128,267,48
CONTROL "None [] Collision hardware emulation disabled.",IDC_COLLISION0,
"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,37,144,59,10
CONTROL "Sprites only [] Emulate only sprite vs. sprite collisions.",IDC_COLLISION1,
"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,37,160,62,10
"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,37,159,62,10
CONTROL "Sprites and Sprites vs. Playfield [] Recommended collision emulation level.",IDC_COLLISION2,
"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,100,144,161,10
CONTROL "Full [] 100% collision hardware emulation. Only very few games need this option. Slowest.",IDC_COLLISION3,
"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,100,160,119,10
"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,100,159,119,10
CONTROL "Genlock connected [] Allow boot sequence to detect genlock. Genlock is not emulated.",IDC_GENLOCK,
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,179,66,100,10
COMBOBOX IDC_CS_EXT,100,80,49,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Chipset Extra",IDC_STATIC,25,79,52,15,SS_CENTERIMAGE
COMBOBOX IDC_MONITOREMU,178,102,98,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "External display hardware:",IDC_STATIC,174,82,100,15,SS_CENTERIMAGE
CONTROL "Wait for Blitter [] Pauses the CPU if blitter is active and CPU attempted to modify blitter registers.",IDC_BLITWAIT,
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,179,53,100,10
COMBOBOX IDC_CS_EXT,100,101,49,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Chipset Extra",IDC_STATIC,25,100,52,15,SS_CENTERIMAGE
COMBOBOX IDC_MONITOREMU,178,87,98,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "External display hardware:",IDC_STATIC,174,67,100,15,SS_CENTERIMAGE
CONTROL "Wait for Blitter [] Compatibility hack for programs that don't wait for the blitter correctly, causing graphics corruption if CPU is too fast.",IDC_BLITWAIT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,179,40,96,10
CONTROL "Cycle-exact [] The most compatible A500/A1200 emulation mode. Very fast PC recommended.",IDC_CYCLEEXACT,
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,35,80,100,10
END
IDD_CHIPSET2 DIALOGEX 0, 65490, 300, 247
@ -1033,7 +1037,8 @@ BEGIN
CTEXT "Color modes:",IDC_STATIC,215,9,62,10,SS_CENTERIMAGE
COMBOBOX IDC_RTG_DISPLAYSELECT,11,106,279,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
CONTROL "Hardware vertical blank interrupt",IDC_RTG_VBINTERRUPT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,89,162,10
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,89,142,10
CONTROL "Hardware sprite emulation",IDC_RTG_HWSPRITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,185,89,102,10
END
IDD_INPUTMAP DIALOGEX 0, 0, 300, 240
@ -1239,6 +1244,8 @@ BEGIN
IDD_IOPORTS, DIALOG
BEGIN
RIGHTMARGIN, 300
BOTTOMMARGIN, 240
END
IDD_GAMEPORTS, DIALOG
@ -1263,7 +1270,6 @@ BEGIN
IDD_CHIPSET, DIALOG
BEGIN
BOTTOMMARGIN, 165
END
IDD_CHIPSET2, DIALOG

View File

@ -1617,25 +1617,6 @@ void close_sound (void)
have_sound = 0;
}
int init_sound (void)
{
gui_data.sndbuf_status = 3;
gui_data.sndbuf = 0;
if (!sound_available)
return 0;
if (currprefs.produce_sound <= 1)
return 0;
if (have_sound)
return 1;
if (!open_sound ())
return 0;
sdp->paused = 1;
driveclick_reset ();
reset_sound ();
resume_sound ();
return 1;
}
void pause_sound (void)
{
if (sdp->paused)
@ -1661,6 +1642,31 @@ void reset_sound (void)
clearbuffer (sdp);
}
int init_sound (void)
{
bool started = false;
gui_data.sndbuf_status = 3;
gui_data.sndbuf = 0;
if (!sound_available)
return 0;
if (currprefs.produce_sound <= 1)
return 0;
if (have_sound)
return 1;
if (!open_sound ())
return 0;
sdp->paused = 1;
driveclick_reset ();
reset_sound ();
resume_sound ();
if (!started &&
(currprefs.win32_start_minimized && currprefs.win32_iconified_nosound ||
currprefs.win32_start_uncaptured && currprefs.win32_inactive_nosound))
pause_sound ();
started = true;
return 1;
}
static void disable_sound (void)
{
close_sound ();

View File

@ -157,6 +157,7 @@ static int sound_closed;
static int recapture;
static int focus;
int mouseactive;
int minimized;
static int mm_timerres;
static int timermode, timeon;
@ -482,6 +483,17 @@ void setpaused (int priority)
#endif
}
void setminimized (void)
{
minimized = 1;
set_inhibit_frame (IHF_WINDOWHIDDEN);
}
void unsetminimized (void)
{
minimized = 0;
clear_inhibit_frame (IHF_WINDOWHIDDEN);
}
static int showcursor;
extern TCHAR config_filename[256];
@ -693,9 +705,6 @@ static void winuae_active (HWND hWnd, int minimized)
pri = &priorities[currprefs.win32_active_capture_priority];
setpriority (pri);
if (!avioutput_video) {
clear_inhibit_frame (IHF_WINDOWHIDDEN);
}
if (sound_closed) {
if (sound_closed < 0) {
resumesoundpaused ();
@ -770,9 +779,6 @@ static void winuae_inactive (HWND hWnd, int minimized)
setsoundpaused ();
sound_closed = -1;
}
if (!avioutput_video) {
set_inhibit_frame (IHF_WINDOWHIDDEN);
}
} else if (mouseactive) {
if (currprefs.win32_active_nocapture_pause) {
setpaused (2);
@ -951,7 +957,7 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
HDC hDC;
int mx, my;
int istablet = (GetMessageExtraInfo () & 0xFFFFFF00) == 0xFF515700;
static int mm, minimized, recursive, ignoremousemove;
static int mm, recursive, ignoremousemove;
static bool ignorelbutton;
#if MSGDEBUG > 1
@ -974,13 +980,16 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
case WM_SETFOCUS:
winuae_active (hWnd, minimized);
minimized = 0;
unsetminimized ();
dx_check ();
break;
case WM_ACTIVATE:
//write_log (_T("active %d\n"), LOWORD(wParam));
if (LOWORD (wParam) == WA_INACTIVE) {
minimized = HIWORD (wParam) ? 1 : 0;
if (HIWORD (wParam))
setminimized ();
else
unsetminimized ();
winuae_inactive (hWnd, minimized);
}
dx_check ();
@ -2856,6 +2865,8 @@ void target_fixup_options (struct uae_prefs *p)
if (depth) {
p->color_mode = p->color_mode == 5 ? 2 : 5;
}
if (p->rtg_hardwaresprite && !p->gfx_api)
p->rtg_hardwaresprite = false;
}
void target_default_options (struct uae_prefs *p, int type)
@ -2874,6 +2885,8 @@ void target_default_options (struct uae_prefs *p, int type)
p->win32_soundcard = 0;
p->win32_samplersoundcard = -1;
p->win32_minimize_inactive = 0;
p->win32_start_minimized = false;
p->win32_start_uncaptured = false;
p->win32_active_capture_priority = 1;
//p->win32_active_nocapture_priority = 1;
p->win32_inactive_priority = 2;
@ -2898,6 +2911,7 @@ void target_default_options (struct uae_prefs *p, int type)
p->win32_rtgallowscaling = 0;
p->win32_rtgscaleaspectratio = -1;
p->win32_rtgvblankrate = 0;
p->rtg_hardwaresprite = true;
p->win32_commandpathstart[0] = 0;
p->win32_commandpathend[0] = 0;
p->win32_statusbar = 1;
@ -2962,6 +2976,8 @@ void target_save_options (struct zfile *f, struct uae_prefs *p)
cfgfile_target_dwrite_bool (f, _T("iconified_nosound"), p->win32_iconified_nosound);
cfgfile_target_dwrite_bool (f, _T("iconified_pause"), p->win32_iconified_pause);
cfgfile_target_dwrite_bool (f, _T("inactive_iconify"), p->win32_minimize_inactive);
cfgfile_target_dwrite_bool (f, _T("start_iconified"), p->win32_start_minimized);
cfgfile_target_dwrite_bool (f, _T("start_not_captured"), p->win32_start_uncaptured);
cfgfile_target_dwrite_bool (f, _T("ctrl_f11_is_quit"), p->win32_ctrl_F11_is_quit);
@ -3225,6 +3241,12 @@ int target_parse_option (struct uae_prefs *p, const TCHAR *option, const TCHAR *
if (cfgfile_yesno (option, value, _T("inactive_iconify"), &p->win32_minimize_inactive))
return 1;
if (cfgfile_yesno (option, value, _T("start_iconified"), &p->win32_start_minimized))
return 1;
if (cfgfile_yesno (option, value, _T("start_not_captured"), &p->win32_start_uncaptured))
return 1;
if (cfgfile_string (option, value, _T("serial_port"), &p->sername[0], 256)) {
sernametodev (p->sername);
if (p->sername[0])

View File

@ -19,8 +19,8 @@
#define LANG_DLL 1
//#define WINUAEBETA _T("")
#define WINUAEBETA _T("11")
#define WINUAEDATE MAKEBD(2012, 8, 10)
#define WINUAEBETA _T("12")
#define WINUAEDATE MAKEBD(2012, 8, 14)
#define WINUAEEXTRA _T("")
//#define WINUAEEXTRA _T("AmiKit Preview")
#define WINUAEREV _T("")
@ -36,6 +36,7 @@ extern int in_sizemove;
extern int manual_painting_needed;
extern int manual_palette_refresh_needed;
extern int mouseactive;
extern int minimized;
extern int ignore_messages_all;
extern void *globalipc, *serialipc;
@ -66,6 +67,8 @@ extern uae_u32 OSDEP_minimize_uae (void);
extern void resumepaused (int priority);
extern void setpaused (int priority);
extern void unsetminimized (void);
extern void setminimized (void);
void finishjob (void);
void init_colors (void);

View File

@ -930,7 +930,7 @@ bool render_screen (bool immediate)
bool v = false;
render_ok = false;
if (picasso_on || dx_islost ())
if (minimized || picasso_on || dx_islost ())
return render_ok;
flushymin = 0;
flushymax = currentmode->amiga_height;
@ -1454,6 +1454,7 @@ static void update_gfxparams (void)
static int open_windows (int full)
{
static bool started = false;
int ret, i;
changevblankthreadmode (VBLANKTH_IDLE);
@ -1494,14 +1495,29 @@ static int open_windows (int full)
return ret;
}
setpriority (&priorities[currprefs.win32_active_capture_priority]);
if (!rp_isactive () && full)
setmouseactive (-1);
for (i = 0; i < NUM_LEDS; i++)
gui_led (i, 0);
gui_fps (0, 0, 0);
inputdevice_acquire (TRUE);
bool startactive = started || (!started && !currprefs.win32_start_uncaptured && !currprefs.win32_start_minimized);
bool startpaused = !started && ((currprefs.win32_start_minimized && currprefs.win32_iconified_pause) || (currprefs.win32_start_uncaptured && currprefs.win32_inactive_pause));
bool startminimized = !started && currprefs.win32_start_minimized;
if (!rp_isactive () && full && startactive)
setmouseactive (-1);
if (startactive) {
setpriority (&priorities[currprefs.win32_active_capture_priority]);
for (i = 0; i < NUM_LEDS; i++)
gui_led (i, 0);
gui_fps (0, 0, 0);
inputdevice_acquire (TRUE);
} else if (startminimized) {
setpriority (&priorities[currprefs.win32_iconified_priority]);
setminimized ();
} else {
setpriority (&priorities[currprefs.win32_inactive_priority]);
}
if (startpaused)
setpaused (1);
started = true;
return ret;
}
@ -1734,9 +1750,8 @@ int check_prefs_changed_gfx (void)
return 1;
}
if (currprefs.win32_norecyclebin != changed_prefs.win32_norecyclebin) {
currprefs.win32_norecyclebin = changed_prefs.win32_norecyclebin;
}
currprefs.win32_norecyclebin = changed_prefs.win32_norecyclebin;
currprefs.filesys_limit = changed_prefs.filesys_limit;
if (currprefs.win32_logfile != changed_prefs.win32_logfile) {
currprefs.win32_logfile = changed_prefs.win32_logfile;
@ -1790,8 +1805,10 @@ int check_prefs_changed_gfx (void)
return 1;
}
if (currprefs.win32_samplersoundcard != changed_prefs.win32_samplersoundcard) {
if (currprefs.win32_samplersoundcard != changed_prefs.win32_samplersoundcard ||
currprefs.sampler_stereo != changed_prefs.sampler_stereo) {
currprefs.win32_samplersoundcard = changed_prefs.win32_samplersoundcard;
currprefs.sampler_stereo = changed_prefs.sampler_stereo;
sampler_free ();
}
@ -3358,7 +3375,7 @@ fail:
static int create_windows_2 (void)
{
static int firstwindow = 1;
static bool firstwindow = true;
int dxfs = currentmode->flags & (DM_DX_FULLSCREEN);
int d3dfs = currentmode->flags & (DM_D3D_FULLSCREEN);
int fsw = currentmode->flags & (DM_W_FULLSCREEN);
@ -3587,13 +3604,13 @@ static int create_windows_2 (void)
createblankwindows ();
if (hMainWnd != hAmigaWnd) {
if (!currprefs.headless && !rp_isactive ())
ShowWindow (hMainWnd, firstwindow ? SW_SHOWDEFAULT : SW_SHOWNORMAL);
ShowWindow (hMainWnd, firstwindow ? (currprefs.win32_start_minimized ? SW_SHOWMINIMIZED : SW_SHOWDEFAULT) : SW_SHOWNORMAL);
UpdateWindow (hMainWnd);
}
if (!currprefs.headless && !rp_isactive ())
ShowWindow (hAmigaWnd, firstwindow ? SW_SHOWDEFAULT : SW_SHOWNORMAL);
ShowWindow (hAmigaWnd, SW_SHOWNORMAL);
UpdateWindow (hAmigaWnd);
firstwindow = 0;
firstwindow = false;
return 1;
}

View File

@ -3580,7 +3580,6 @@ struct miscentry
static struct miscentry misclist[] = {
{ 0, 1, _T("Untrap = middle button"), &workprefs.win32_middle_mouse },
{ 0, 1, _T("Minimize when focus is lost"), &workprefs.win32_minimize_inactive },
{ 0, 0, _T("Show GUI on startup"), &workprefs.start_gui },
{ 0, 1, _T("Use CTRL-F11 to quit"), &workprefs.win32_ctrl_F11_is_quit },
{ 0, 1, _T("Don't show taskbar button"), &workprefs.win32_notaskbarbutton },
@ -3596,6 +3595,10 @@ static struct miscentry misclist[] = {
{ 0, 0, _T("Create winuaelog.txt log"), &workprefs.win32_logfile },
{ 0, 0, _T("Log illegal memory accesses"), &workprefs.illegal_mem },
{ 0, 0, _T("Blank unused displays"), &workprefs.win32_blankmonitors },
{ 0, 0, _T("Start mouse uncaptured"), &workprefs.win32_start_uncaptured },
{ 0, 0, _T("Start minimized"), &workprefs.win32_start_minimized },
{ 0, 1, _T("Minimize when focus is lost"), &workprefs.win32_minimize_inactive },
{ 0, NULL }
};
@ -6680,19 +6683,26 @@ static void enable_for_memorydlg (HWND hDlg)
ew (hDlg, IDC_RTG_VBLANKRATE, rtg2);
ew (hDlg, IDC_RTG_BUFFERCNT, rtg2);
ew (hDlg, IDC_RTG_DISPLAYSELECT, rtg2);
ew (hDlg, IDC_RTG_VBINTERRUPT, rtg2);
if (!workprefs.gfx_api) {
workprefs.rtg_hardwaresprite = false;
CheckDlgButton (hDlg, IDC_RTG_HWSPRITE, FALSE);
}
ew (hDlg, IDC_RTG_HWSPRITE, rtg2 && workprefs.gfx_api);
}
extern uae_u32 natmem_size;
static void setmax32bitram (HWND hDlg)
{
TCHAR tmp[100];
uae_u32 size;
uae_u32 size, rtgz3size;
rtgz3size = workprefs.rtgmem_type ? workprefs.rtgmem_size : 0;
size = workprefs.z3fastmem_size + workprefs.z3fastmem2_size +
workprefs.z3chipmem_size + workprefs.rtgmem_size;
workprefs.z3chipmem_size + rtgz3size;
if (workprefs.z3chipmem_size && workprefs.z3fastmem_size)
size += 16 * 1024 * 1024;
if ((workprefs.z3fastmem_size || workprefs.z3chipmem_size) && workprefs.rtgmem_size)
if ((workprefs.z3fastmem_size || workprefs.z3chipmem_size) && rtgz3size)
size += 16 * 1024 * 1024;
_stprintf (tmp, L"Total configured 32-bit RAM: %dM, reserved: %dM",
@ -6895,6 +6905,7 @@ static void values_to_memorydlg (HWND hDlg)
CheckDlgButton (hDlg, IDC_RTG_SCALE_ALLOW, workprefs.win32_rtgallowscaling);
CheckDlgButton (hDlg, IDC_RTG_MATCH_DEPTH, workprefs.win32_rtgmatchdepth);
CheckDlgButton (hDlg, IDC_RTG_VBINTERRUPT, workprefs.rtg_hardwareinterrupt);
CheckDlgButton (hDlg, IDC_RTG_HWSPRITE, workprefs.rtg_hardwaresprite);
SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_SETCURSEL,
(workprefs.win32_rtgscaleaspectratio == 0) ? 0 :
@ -7151,6 +7162,9 @@ static INT_PTR CALLBACK ExpansionDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP
case IDC_RTG_VBINTERRUPT:
workprefs.rtg_hardwareinterrupt = ischecked (hDlg, IDC_RTG_VBINTERRUPT);
break;
case IDC_RTG_HWSPRITE:
workprefs.rtg_hardwaresprite = ischecked (hDlg, IDC_RTG_HWSPRITE);
break;
case IDC_SOCKETS:
workprefs.socket_emu = ischecked (hDlg, IDC_SOCKETS);
break;
@ -8119,8 +8133,8 @@ static void values_to_cpudlg (HWND hDlg)
TCHAR buffer[8] = _T("");
int cpu;
SendDlgItemMessage (hDlg, IDC_SPEED, TBM_SETPOS, TRUE, workprefs.m68k_speed_throttle / 100);
_stprintf (buffer, _T("%+d%%"), workprefs.m68k_speed_throttle / 10);
SendDlgItemMessage (hDlg, IDC_SPEED, TBM_SETPOS, TRUE, (int)(workprefs.m68k_speed_throttle / 100));
_stprintf (buffer, _T("%+d%%"), (int)(workprefs.m68k_speed_throttle / 10));
SetDlgItemText (hDlg, IDC_CPUTEXT, buffer);
CheckDlgButton (hDlg, IDC_COMPATIBLE, workprefs.cpu_compatible);
CheckDlgButton (hDlg, IDC_COMPATIBLE24, workprefs.address_space_24);
@ -9665,6 +9679,10 @@ static int harddiskdlg_button (HWND hDlg, WPARAM wParam)
workprefs.win32_automount_cddrives = ischecked (hDlg, IDC_MAPDRIVES_CD);
break;
case IDC_MAPDRIVES_LIMIT:
workprefs.filesys_limit = ischecked (hDlg, IDC_MAPDRIVES_LIMIT) ? 950 * 1024 : 0;
break;
case IDC_MAPDRIVES_NET:
workprefs.win32_automount_netdrives = ischecked (hDlg, IDC_MAPDRIVES_NET);
break;
@ -9738,6 +9756,7 @@ static INT_PTR CALLBACK HarddiskDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPA
CheckDlgButton (hDlg, IDC_MAPDRIVES_REMOVABLE, workprefs.win32_automount_removabledrives);
CheckDlgButton (hDlg, IDC_NOUAEFSDB, workprefs.filesys_no_uaefsdb);
CheckDlgButton (hDlg, IDC_NORECYCLEBIN, workprefs.win32_norecyclebin);
CheckDlgButton (hDlg, IDC_MAPDRIVES_LIMIT, workprefs.filesys_limit != 0);
addfloppyhistory_2 (hDlg, 0, IDC_CD_TEXT, HISTORY_CD);
addcdtype (hDlg, IDC_CD_TYPE);
InitializeListView (hDlg);
@ -10852,6 +10871,7 @@ static void enable_for_portsdlg (HWND hDlg)
}
ew (hDlg, IDC_PRINTERLIST, isprinter);
ew (hDlg, IDC_SAMPLERLIST, issampler);
ew (hDlg, IDC_SAMPLER_STEREO, issampler && workprefs.win32_samplersoundcard >= 0);
ew (hDlg, IDC_PRINTERAUTOFLUSH, isprinter);
ew (hDlg, IDC_PRINTERTYPELIST, isprinter);
ew (hDlg, IDC_FLUSHPRINTER, isprinteropen () && isprinter ? TRUE : FALSE);
@ -11067,6 +11087,9 @@ static void values_from_portsdlg (HWND hDlg)
if (item > 0)
workprefs.prtname[0] = 0;
}
workprefs.sampler_stereo = false;
if (ischecked (hDlg, IDC_SAMPLER_STEREO))
workprefs.sampler_stereo = true;
item = SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_GETCURSEL, 0, 0L);
if(item != CB_ERR) {
@ -11146,6 +11169,7 @@ static void values_to_portsdlg (HWND hDlg)
int idx;
SendDlgItemMessage (hDlg, IDC_SAMPLERLIST, CB_SETCURSEL, workprefs.win32_samplersoundcard + 1, 0);
CheckDlgButton (hDlg, IDC_SAMPLER_STEREO, workprefs.sampler_stereo);
result = 0;
if(workprefs.prtname[0]) {
@ -11530,7 +11554,7 @@ static INT_PTR CALLBACK IOPortsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
if (isprinter ()) {
closeprinter ();
}
} else if (wParam == IDC_UAESERIAL || wParam == IDC_SER_SHARED || wParam == IDC_SER_DIRECT || wParam == IDC_SER_CTSRTS || wParam == IDC_PRINTERAUTOFLUSH) {
} else if (wParam == IDC_UAESERIAL || wParam == IDC_SER_SHARED || wParam == IDC_SER_DIRECT || wParam == IDC_SER_CTSRTS || wParam == IDC_PRINTERAUTOFLUSH || wParam == IDC_SAMPLER_STEREO) {
values_from_portsdlg (hDlg);
} else {
if (HIWORD (wParam) == CBN_SELCHANGE) {
@ -12671,7 +12695,7 @@ static struct filterxtra filter_pal_extra[] =
static struct filterxtra filter_3d_extra[] =
{
_T("Point/Bilinear"), &workprefs.gfx_filter_bilinear, &currprefs.gfx_filter_bilinear, 0, 1, 1,
_T("Scanline transparency"), &workprefs.gfx_filter_scanlines, &currprefs.gfx_filter_scanlines, 0, 100, 10,
_T("Scanline opacity"), &workprefs.gfx_filter_scanlines, &currprefs.gfx_filter_scanlines, 0, 100, 10,
_T("Scanline level"), &workprefs.gfx_filter_scanlinelevel, &currprefs.gfx_filter_scanlinelevel, 0, 100, 10,
NULL
};

View File

@ -1,6 +1,25 @@
- restore only single input target to default.
- Moved cycle-exact option to Chipset group in GUI. Other options are minor options/hacks, CE is not.
- Do not enable wait for blit if immediate blitter is enabled in quickstart mode.
- Added RTG hardware sprite (mouse cursor) enable/disable option. Enabled by default if D3D mode. Was always enabled
previously if D3D mode.
- GUI Memory panel 32-bit RAM size information text incorrectly included Z2 mode RTG memory.
- Added directory harddrive limit option to Harddrives panel. When enabled, all directory harddrives size is faked
to ~950M with free space relative to original size (for example 500G HD with 100G free = 950M HD with 950*100/500=190M free)
This hack is workaround for installers that think drive is full or have negative free space if drive is larger than 2G (32-bit overflow).
Can be changed on the fly. Edit configuration file manually if you want custom limit size. Also virtual fake block size changed
from 1024 to 512. More compatible with KS1.x dos commands that seem to use hardcoded 512 block sizes when calculating disk size.
- cpu_throttle configuration entry also accepts decimal values.
- Added Start minimized and Start mouse uncaptured Misc panel options.
- In minimized mode D3D/DirectDraw display updates are also now completely stopped.
- ECS Denise/AGA border blanking handling rewritten again. (Brian the Lion borders are black again)
- Ignore color 0 (background) writes if borderblank is currently enabled when deciding autoscale start vertical
coordinate. (Brian the Lion)
- Parallel port audio sampler emulation partially rewritten, it actually sounds correct now, mono/stereo option added.
AudioMaster IV confirmed working. Very pointless feature.
Beta 11:
- END special qualifier didn't work when combined with other qualifiers, some END + shortcuts leaked key presses to emulated

View File

@ -21,15 +21,14 @@
#include "win32.h"
#define SAMPLESIZE 4
#define RECORDBUFFER 10000
#define SAMPLEBUFFER 2000
static LPDIRECTSOUNDCAPTURE lpDS2r = NULL;
static LPDIRECTSOUNDCAPTUREBUFFER lpDSBprimary2r = NULL;
static LPDIRECTSOUNDCAPTUREBUFFER lpDSB2r = NULL;
static int inited;
static uae_u8 *samplebuffer;
static int samplerate = 44100;
static int sampleframes;
static int recordbufferframes;
static float clockspersample;
static int vsynccnt;
static int safepos;
@ -40,6 +39,13 @@ static int capture_init (void)
HRESULT hr;
DSCBUFFERDESC sound_buffer_rec;
WAVEFORMATEX wavfmt;
TCHAR *name;
int samplerate = 44100;
if (currprefs.sampler_freq)
samplerate = currprefs.sampler_freq;
name = record_devices[currprefs.win32_samplersoundcard]->name;
wavfmt.wFormatTag = WAVE_FORMAT_PCM;
wavfmt.nChannels = 2;
@ -49,30 +55,36 @@ static int capture_init (void)
wavfmt.nAvgBytesPerSec = wavfmt.nBlockAlign * wavfmt.nSamplesPerSec;
wavfmt.cbSize = 0;
clockspersample = sampler_evtime / samplerate;
sampleframes = (samplerate + 49) / 50;
recordbufferframes = 16384;
if (currprefs.sampler_buffer)
recordbufferframes = currprefs.sampler_buffer;
hr = DirectSoundCaptureCreate (&record_devices[currprefs.win32_samplersoundcard]->guid, &lpDS2r, NULL);
if (FAILED (hr)) {
write_log (_T("SAMPLER: DirectSoundCaptureCreate() failure: %s\n"), DXError (hr));
write_log (_T("SAMPLER: DirectSoundCaptureCreate('%s') failure: %s\n"), name, DXError (hr));
return 0;
}
memset (&sound_buffer_rec, 0, sizeof (DSCBUFFERDESC));
sound_buffer_rec.dwSize = sizeof (DSCBUFFERDESC);
sound_buffer_rec.dwBufferBytes = RECORDBUFFER * SAMPLESIZE;
sound_buffer_rec.dwBufferBytes = recordbufferframes * SAMPLESIZE;
sound_buffer_rec.lpwfxFormat = &wavfmt;
sound_buffer_rec.dwFlags = 0 ;
hr = lpDS2r->CreateCaptureBuffer (&sound_buffer_rec, &lpDSB2r, NULL);
if (FAILED (hr)) {
write_log (_T("SAMPLER: CreateCaptureSoundBuffer() failure: %s\n"), DXError(hr));
write_log (_T("SAMPLER: CreateCaptureSoundBuffer('%s') failure: %s\n"), name, DXError(hr));
return 0;
}
hr = lpDSB2r->Start (DSCBSTART_LOOPING);
if (FAILED (hr)) {
write_log (_T("SAMPLER: DirectSoundCaptureBuffer_Start failed: %s\n"), DXError (hr));
write_log (_T("SAMPLER: DirectSoundCaptureBuffer_Start('%s') failed: %s\n"), name, DXError (hr));
return 0;
}
samplebuffer = xcalloc (uae_u8, SAMPLEBUFFER * SAMPLESIZE);
write_log (_T("SAMPLER: Parallel port sampler initialized\n"));
samplebuffer = xcalloc (uae_u8, sampleframes * SAMPLESIZE);
write_log (_T("SAMPLER: Parallel port sampler initialized, CPS=%f, '%s'\n"), clockspersample, name);
return 1;
}
@ -96,19 +108,24 @@ static int oldoffset;
uae_u8 sampler_getsample (int channel)
{
HRESULT hr;
static DWORD cap_pos;
#if 0
int cur_pos;
static int cap_pos;
static float diffsample;
DWORD t, cur_pos;
#endif
static double doffset_offset;
HRESULT hr;
DWORD pos;
DWORD t;
void *p1, *p2;
DWORD len1, len2;
evt cycles;
int sample, samplecnt;
double doffset;
int offset;
int sample, samplecnt, diff;
// if (channel)
// return 0;
channel = 0;
if (!currprefs.sampler_stereo)
channel = 0;
if (!inited) {
if (!capture_init ()) {
@ -118,19 +135,22 @@ uae_u8 sampler_getsample (int channel)
inited = 1;
oldcycles = get_cycles ();
oldoffset = -1;
doffset_offset = 0;
#if 0
diffsample = 0;
safepos = -RECORDBUFFER / 10 * SAMPLESIZE;
hr = lpDSB2r->GetCurrentPosition (&t, &cap_pos);
safepos = -recordbufferframes / 10 * SAMPLESIZE;
hr = lpDSB2r->GetCurrentPosition (&t, &pos);
cap_pos = pos;
cap_pos += safepos;
if (cap_pos >= 10 * RECORDBUFFER * SAMPLESIZE)
cap_pos += RECORDBUFFER * SAMPLESIZE;
if (cap_pos >= RECORDBUFFER * SAMPLESIZE)
cap_pos -= RECORDBUFFER * SAMPLESIZE;
if (cap_pos < 0)
cap_pos += recordbufferframes * SAMPLESIZE;
if (cap_pos >= recordbufferframes * SAMPLESIZE)
cap_pos -= recordbufferframes * SAMPLESIZE;
if (FAILED (hr)) {
sampler_free ();
return 0;
}
clockspersample = sampler_evtime / samplerate;
#endif
}
if (clockspersample < 1)
return 0;
@ -139,34 +159,52 @@ uae_u8 sampler_getsample (int channel)
vsynccnt = 0;
sample = 0;
samplecnt = 0;
cycles = get_cycles () - oldcycles;
float cps = clockspersample + diffsample;
offset = (cycles + cps - 1) / cps;
if (oldoffset < 0 || offset >= SAMPLEBUFFER || offset < 0) {
if (oldoffset >= 0 && offset >= SAMPLEBUFFER) {
while (oldoffset < SAMPLEBUFFER) {
cycles = (int)get_cycles () - (int)oldcycles;
doffset = doffset_offset + cycles / clockspersample;
offset = (int)doffset;
if (oldoffset < 0 || offset >= sampleframes || offset < 0) {
if (offset >= sampleframes) {
doffset -= offset;
doffset_offset = doffset;
}
if (oldoffset >= 0 && offset >= sampleframes) {
while (oldoffset < sampleframes) {
sample += sbuf[oldoffset * SAMPLESIZE / 2 + channel];
oldoffset++;
samplecnt++;
}
}
hr = lpDSB2r->Lock (cap_pos, SAMPLEBUFFER * SAMPLESIZE, &p1, &len1, &p2, &len2, 0);
if (FAILED (hr))
hr = lpDSB2r->GetCurrentPosition (&t, &pos);
hr = lpDSB2r->Lock (t, sampleframes * SAMPLESIZE, &p1, &len1, &p2, &len2, 0);
if (FAILED (hr)) {
write_log (_T("SAMPLER: Lock() failed %x\n"), hr);
return 0;
}
memcpy (samplebuffer, p1, len1);
if (p2)
memcpy (samplebuffer + len1, p2, len2);
lpDSB2r->Unlock (p1, len1, p2, len2);
cap_pos += SAMPLEBUFFER * SAMPLESIZE;
hr = lpDSB2r->GetCurrentPosition (&t, &cur_pos);
#if 0
cap_pos = t;
cap_pos += sampleframes * SAMPLESIZE;
if (cap_pos < 0)
cap_pos += RECORDBUFFER * SAMPLESIZE;
if (cap_pos >= RECORDBUFFER * SAMPLESIZE)
cap_pos -= RECORDBUFFER * SAMPLESIZE;
hr = lpDSB2r->GetCurrentPosition (&t, &pos);
cur_pos = pos;
if (FAILED (hr))
return 0;
cur_pos += safepos;
if (cur_pos >= 10 * RECORDBUFFER * SAMPLESIZE)
if (cur_pos < 0)
cur_pos += RECORDBUFFER * SAMPLESIZE;
if (cur_pos >= RECORDBUFFER * SAMPLESIZE)
cur_pos -= RECORDBUFFER * SAMPLESIZE;
int diff;
if (cur_pos >= cap_pos)
diff = cur_pos - cap_pos;
else
@ -176,35 +214,44 @@ uae_u8 sampler_getsample (int channel)
diff /= SAMPLESIZE;
int diff2 = 100 * diff / (RECORDBUFFER / 2);
#if 0
diffsample = -pow (diff2 < 0 ? -diff2 : diff2, 3.1);
if (diff2 < 0)
diffsample = -diffsample;
#endif
// write_log (_T("%d:%.1f\n"), diff, diffsample);
write_log (_T("%d\n"), diff);
cap_pos += SAMPLEBUFFER * SAMPLESIZE;
if (cap_pos < 0)
cap_pos += RECORDBUFFER * SAMPLESIZE;
if (cap_pos >= RECORDBUFFER * SAMPLESIZE)
cap_pos -= RECORDBUFFER * SAMPLESIZE;
write_log (_T("CAP=%05d CUR=%05d (%-05d) OFF=%05d %f\n"),
cap_pos / SAMPLESIZE, cur_pos / SAMPLESIZE, (cap_pos - cur_pos) / SAMPLESIZE, offset, doffset_offset);
#endif
if (offset < 0)
offset = 0;
if (offset >= SAMPLEBUFFER)
offset -= SAMPLEBUFFER;
if (offset >= sampleframes)
offset -= sampleframes;
oldoffset = 0;
oldcycles = get_cycles ();
}
while (oldoffset <= offset) {
sample += sbuf[oldoffset * SAMPLESIZE / 2 + channel];
samplecnt++;
oldoffset++;
}
oldoffset = offset;
if (samplecnt > 0)
sample /= samplecnt;
return (sample / 256) - 128;
#if 1
/* yes, not 256, without this max recording volume would still be too quiet on my sound cards */
sample /= 128;
if (sample < -128)
sample = 0;
else if (sample > 127)
sample = 127;
return (uae_u8)(sample - 128);
#else
return (Uae_u8)((sample / 256) - 128);
#endif
}
int sampler_init (void)
@ -225,6 +272,7 @@ void sampler_vsync (void)
{
if (!inited)
return;
vsynccnt++;
if (vsynccnt > 1) {
oldcycles = get_cycles ();