This commit is contained in:
Mustafa Tufan 2014-03-19 16:44:31 +02:00
parent 428ab282e0
commit 30865290f9
41 changed files with 2057 additions and 1011 deletions

View File

@ -1,6 +1,6 @@
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = m4 amiga docs CHANGES README
EXTRA_DIST = m4 amiga android debian docs CHANGES README uae_data
SUBDIRS = src

View File

@ -211,6 +211,10 @@ AC_CHECK_SIZEOF(long long, 8)
AC_CHECK_SIZEOF(__int64, 8)
AC_CHECK_SIZEOF(void *)
if test "${ac_cv_c_have_long_double}" = "yes" ; then
AC_CHECK_SIZEOF(long double, 12)
fi
TYPE_SOCKLEN_T
dnl
@ -604,6 +608,7 @@ WANT_COMPATIBLE=yes
WANT_CYCLEEXACT=yes
WANT_CAPS=no
WANT_FDI=yes
WANT_SCP=yes
WANT_ENFORCER=dunno
WANT_CATWEASEL=no
WANT_SERIAL=no
@ -692,9 +697,9 @@ AC_ARG_ENABLE(a2065, AS_HELP_STRING([--enable-a2065], [Enabl
AC_ARG_ENABLE(a2091, AS_HELP_STRING([--enable-a2091], [Enable A2091 SCSI emulation (default no)]), [WANT_A2091=$enableval],[])
AC_ARG_ENABLE(action-replay, AS_HELP_STRING([--enable-action-replay], [Enable Action Replay cartridge emulation (default yes)]), [WANT_ACTION_REPLAY=$enableval],[])
AC_ARG_ENABLE(aga, AS_HELP_STRING([--enable-aga], [Enable AGA chipset emulation (default yes)]), [WANT_AGA=$enableval],[])
AC_ARG_ENABLE(amax, AS_HELP_STRING([--enable-amax], [Enable AMAX support (default no)]), [WANT_AMAX=$enableval],[])
AC_ARG_ENABLE(autoconfig, AS_HELP_STRING([--enable-autoconfig], [Enable emulation of autoconfig devices (default auto)]), [WANT_AUTOCONFIG=$enableval],[])
AC_ARG_ENABLE(audio, AS_HELP_STRING([--enable-audio], [Enable audio output (default auto)]), [WANT_AUDIO=$enableval],[])
AC_ARG_ENABLE(amax, AS_HELP_STRING([--enable-amax], [Enable AMAX support (default no)]), [WANT_AMAX=$enableval],[])
AC_ARG_ENABLE(bsdsock, AS_HELP_STRING([--enable-bsdsock], [Enable bsdsocket.library emulation]), [WANT_BSDSOCK=$enableval],[])
AC_ARG_ENABLE(catweasel, AS_HELP_STRING([--enable-catweasel], [Enable Catweasel support (default no)]), [WANT_CATWEASEL=$enableval],[])
AC_ARG_ENABLE(cdtv, AS_HELP_STRING([--enable-cdtv], [Enable CDTV emulation (default no)]), [WANT_CDTV=$enableval],[])
@ -705,8 +710,8 @@ AC_ARG_ENABLE(debugger, AS_HELP_STRING([--disable-debugger], [Disab
AC_ARG_ENABLE(dga, AS_HELP_STRING([--enable-dga], [X11 version: Use the DGA extension]), [WANT_DGA=$enableval],[])
AC_ARG_ENABLE(drvsnd, AS_HELP_STRING([--enable-drvsnd], [Enable Floppy Drive Sound Emulation (default no)]), [WANT_DRVSND=$enableval],[])
AC_ARG_ENABLE(enforcer, AS_HELP_STRING([--enable-enforcer], [Enable ersatz Enforcer support (default auto)]), [WANT_ENFORCER=$enableval],[])
AC_ARG_ENABLE(fdi, AS_HELP_STRING([--enable-fdi], [Enable FDI support (default yes)]), [WANT_FDI=$enableval],[])
AC_ARG_ENABLE(fpu, AS_HELP_STRING([--enable-fpu], [Enable FPU emulation (default yes)]), [WANT_FPU=$enableval],[])
AC_ARG_ENABLE(fdi, AS_HELP_STRING([--enable-fdi], [Enable FDI support (default yes)]), [WANT_FDI=$enableval],[])
AC_ARG_ENABLE(gayle, AS_HELP_STRING([--enable-gayle], [Enable GAYLE IDE emulation (default no)]), [WANT_GAYLE=$enableval],[])
AC_ARG_ENABLE(gccopt, AS_HELP_STRING([--enable-gccopt], [Enable CPU Specific Optimizations (default no)]), [WANT_OPT=$enableval],[])
AC_ARG_ENABLE(gccdebug, AS_HELP_STRING([--enable-gccdebug], [Enable gcc debugging options (default no)]), [WANT_GGDB=$enableval],[])
@ -716,9 +721,10 @@ AC_ARG_ENABLE(mmu, AS_HELP_STRING([--enable-mmu], [Enabl
AC_ARG_ENABLE(natmem, AS_HELP_STRING([--enable-natmem], [Enable JIT direct memory support (default auto)]), [NATMEM=$enableval],[])
AC_ARG_ENABLE(noflags, AS_HELP_STRING([--enable-noflags], [Enable noflags support in JIT (default no)]), [NOFLAGS=$enableval],[])
AC_ARG_ENABLE(ncr, AS_HELP_STRING([--enable-ncr], [Enable NCR SCSI emulation (default no)]), [WANT_NCR=$enableval],[])
AC_ARG_ENABLE(scsi-device, AS_HELP_STRING([--enable-scsi-device], [Enable emulation of SCSI devices (default no)]), [WANT_SCSIEMU=$enableval],[])
AC_ARG_ENABLE(save-state, AS_HELP_STRING([--disable-save-state], [Disable support for saving state snapshots (default no)]), [WANT_SAVESTATE=$enableval],[])
AC_ARG_ENABLE(serial-port, AS_HELP_STRING([--enable-serial-port], [Enable serial port emulation (default no)]), [WANT_SERIAL=$enableval],[])
AC_ARG_ENABLE(scp, AS_HELP_STRING([--enable-scp], [Enable SCP support (default yes)]), [WANT_SCP=$enableval],[])
AC_ARG_ENABLE(scsi-device, AS_HELP_STRING([--enable-scsi-device], [Enable emulation of SCSI devices (default no)]), [WANT_SCSIEMU=$enableval],[])
AC_ARG_ENABLE(threads, AS_HELP_STRING([--enable-threads], [Enable thread support (default auto)]), [WANT_THREADS=$enableval],[])
AC_ARG_ENABLE(ui, AS_HELP_STRING([--enable-ui], [Use a user interface if possible (default on)]), [WANT_UI=$enableval],[])
AC_ARG_ENABLE(vidmode, AS_HELP_STRING([--enable-vidmode], [X11 version: Use the XF86VidMode extension]), [WANT_VIDMODE=$enableval],[])
@ -841,7 +847,6 @@ if [[ "x$WANT_SDL" != "xno" ]]; then
SDLT2_CFLAGS="-I/Library/Frameworks/SDL2_ttf.framework/Headers -D_REENTRANT"
SDL_LIBS="-framework Cocoa -framework SDL -lobjc"
SAVE_CPPFLAGS=$CPPFLAGS
SAVE_LIBS=$LIBS
LIBS="$SDL_LIBS $LIBS"
@ -1400,7 +1405,7 @@ if [[ "x$WANT_SDL_UI" = "xyes" ]]; then
if [[ "x$OSDEP" = "xod-macosx" ]]; then
GUI_LIBS="${GUI_LIBS} -framework SDL_ttf -framework SDL_image"
GUI_CFLAGS="$SDL_CFLAGS -DSDLI_CFLAGS -DSDLT_CFLAGS"
GUI_CFLAGS="$SDL_CFLAGS $SDLI_CFLAGS $SDLT_CFLAGS"
else
GUI_LIBS="${GUI_LIBS} -lSDL_ttf -lSDL_image"
fi
@ -1843,13 +1848,21 @@ fi
dnl
dnl Check whether FDI support wanted
dnl Check whether FDI (FDI 1.0 and 2.x image) support wanted
dnl
if [[ "x$WANT_FDI" != "xno" ]]; then
UAE_DEFINES="$UAE_DEFINES -DFDI2RAW"
fi
dnl
dnl Check whether SCP (SuperCardPro) support wanted
dnl
if [[ "x$WANT_SCP" != "xno" ]]; then
UAE_DEFINES="$UAE_DEFINES -DSCP"
fi
dnl
dnl Build debugger?
dnl
@ -2140,9 +2153,10 @@ dnl ARM
dnl quick hack for my pcduino v2 -mtufan
if [[ "x$have_armcpu" = "xyes" ]]; then
OPTIMIZED_FLAGS="-O3 -mcpu=arm7 -mtune=arm7 -ffast-math -fomit-frame-pointer -ftracer -fstrict-aliasing"
OPTIMIZED_FLAGS="$OPTIMIZED_FLAGS -mstructure-size-boundary=32 -fexpensive-optimizations"
OPTIMIZED_FLAGS="-O3 -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -ffast-math -fomit-frame-pointer -ftracer -fstrict-aliasing"
OPTIMIZED_FLAGS="$OPTIMIZED_FLAGS -mstructure-size-boundary=32 -fexpensive-optimizations -ftree-vectorize"
OPTIMIZED_FLAGS="$OPTIMIZED_FLAGS -falign-functions=32 -falign-loops -falign-labels -falign-jumps"
OPTIMIZED_FLAGS="$OPTIMIZED_FLAGS -mfpu=neon -mfloat-abi=softfp"
dnl OPTIMIZED_FLAGS="$OPTIMIZED_FLAGS -finline -finline-functions -fno-builtin -funroll-loops -floop-optimize2"
fi
@ -2340,7 +2354,7 @@ if [[ "x$cross_compiling" = "xyes" ]]; then
export LDFLAGS=$LDFLAGS_FOR_BUILD
export LIBS=$LIBS_FOR_BUILD
mkdir -p src/tools
cd src/tools && ../../"$srcdir"/src/tools/configure --cache-file=/dev/null --host=$build --target=$host
cd src/tools && ../../"$srcdir"/src/tools/configure --cache-file=/dev/null --host=$build --target=$host
fi
AC_DEFINE(ECS_DENISE,1,[we want ecs_denise])

View File

@ -11,6 +11,11 @@ if !ANDROID
LIBS += -lpthread
endif
if BUILD_MACOSX_BUNDLE
AM_CFLAGS += -mmacosx-version-min=10.7
AM_CPPFLAGS += -mmacosx-version-min=10.7
endif
if IS_QT
QT_INCPATH = $(shell qmake -query QT_INSTALL_HEADERS)
QT_INSPATH = $(shell qmake -query QT_INSTALL_DATA)
@ -67,11 +72,9 @@ DISTCLEANFILES = \
target.h md-fpp.h
if TARGET_NACL # = Using Native Client/Pepper
bin_PROGRAMS = \
uae
bin_PROGRAMS = uae
else
bin_PROGRAMS = \
uae readdisk make_hdf
bin_PROGRAMS = uae readdisk make_hdf
endif
if BUILD_MACOSX_BUNDLE
@ -83,7 +86,11 @@ if TARGET_BIGENDIAN
genlinetoscr_args = -b
endif
uae_extraLDFLAGS=-fwhole-program
uae_extraLDFLAGS = -fwhole-program
if BUILD_MACOSX_BUNDLE
uae_extraLDFLAGS += -Wno-error=unused-command-line-argument-hard-error-in-future -mmacosx-version-min=10.7
endif
uae$(EXEEXT): $(uae_OBJECTS) $(uae_DEPENDENCIES)
@rm -f uae$(EXEEXT)
@ -184,7 +191,7 @@ uae_SOURCES = \
native2amiga.c disk.c crc32.c savestate.c arcadia.c cdtv.c cd32_fmv.c \
uaeexe.c uaelib.c uaeresource.c uaeserial.c fdi2raw.c hotkeys.c amax.c \
ar.c driveclick.c enforcer.c misc.c uaenet.c a2065.c gayle.c blkdev.c blkdev_cdimage.c scsi.c ncr_scsi.c \
missing.c readcpu.c hrtmon.rom.c events.c calc.c sana2.c \
missing.c readcpu.c hrtmon.rom.c events.c calc.c sana2.c scp.c \
specialmonitors.c gfxboard.c qemuvga/cirrus_vga.c qemuvga/qemuuaeglue.c qemuvga/vga.c qemuvga/lsi53c895a.c
if !TARGET_NACL # Do not include AROS ROM in Native Client.
uae_SOURCES += aros.rom.c

View File

@ -1052,6 +1052,16 @@ static void dmac_start_dma (void)
{
if (!(dmac_cntr & CNTR_PDMD)) { // non-scsi dma
write_comm_pipe_u32 (&requests, 0x0100, 1);
} else {
scsi_dmac_start_dma ();
}
}
static void dmac_stop_dma (void)
{
if (!(dmac_cntr & CNTR_PDMD)) { // non-scsi dma
;
} else {
scsi_dmac_stop_dma ();
}
}
@ -1133,6 +1143,7 @@ void CDTV_hsync_handler (void)
cd_finished = 1;
cd_paused = 0;
//cd_error = 1;
write_log (_T("audio finished\n"));
activate_stch = 1;
}
@ -1242,6 +1253,7 @@ static void cdtv_reset_int (void)
cd_finished = 0;
cd_led = 0;
stch = 1;
frontpanel = 1;
}
static uae_u32 dmac_bget2 (uaecptr addr)
@ -1407,7 +1419,10 @@ static void dmac_bput2 (uaecptr addr, uae_u32 b)
break;
case 0xe2:
case 0xe3:
dmac_dma = 0;
if (dmac_dma) {
dmac_dma = 0;
dmac_stop_dma ();
}
dma_finished = 0;
break;
case 0xe4:
@ -1685,7 +1700,6 @@ void cdtv_free (void)
#ifdef ROMHACK2
extern uae_u8 *extendedkickmemory, *cardmemory;
static void romhack (void)
{
struct zfile *z;
@ -1754,6 +1768,7 @@ void cdtv_init (void)
/* KS autoconfig handles the rest */
map_banks (&dmac_bank, 0xe80000 >> 16, 0x10000 >> 16, 0x10000);
if (!savestate_state) {
cdtv_reset_int ();
configured = 0;
tp_a = tp_b = tp_c = tp_ad = tp_bd = tp_cd = 0;
tp_imask = tp_cr = tp_air = tp_ilatch = 0;
@ -1766,6 +1781,8 @@ void cdtv_init (void)
cdtv_battram_reset ();
open_unit ();
gui_flicker_led (LED_CD, 0, -1);
if (currprefs.cs_cdtvscsi)
init_scsi ();
}
void cdtv_check_banks (void)

View File

@ -141,7 +141,12 @@ static const TCHAR *guimode1[] = { _T("no"), _T("yes"), _T("nowait"), 0 };
static const TCHAR *guimode2[] = { _T("false"), _T("true"), _T("nowait"), 0 };
static const TCHAR *guimode3[] = { _T("0"), _T("1"), _T("nowait"), 0 };
static const TCHAR *csmode[] = { _T("ocs"), _T("ecs_agnus"), _T("ecs_denise"), _T("ecs"), _T("aga"), 0 };
static const TCHAR *linemode[] = { _T("none"), _T("none"), _T("double"), _T("scanlines"), _T("double2"), _T("scanlines2"), _T("double3"), _T("scanlines3"), 0 };
static const TCHAR *linemode[] = {
_T("none"),
_T("double"), _T("scanlines"), _T("scanlines2p"), _T("scanlines3p"),
_T("double2"), _T("scanlines2"), _T("scanlines2p2"), _T("scanlines2p3"),
_T("double3"), _T("scanlines3"), _T("scanlines3p2"), _T("scanlines3p3"),
0 };
static const TCHAR *speedmode[] = { _T("max"), _T("real"), 0 };
static const TCHAR *colormode1[] = { _T("8bit"), _T("15bit"), _T("16bit"), _T("8bit_dither"), _T("4bit_dither"), _T("32bit"), 0 };
static const TCHAR *colormode2[] = { _T("8"), _T("15"), _T("16"), _T("8d"), _T("4d"), _T("32"), 0 };
@ -216,6 +221,7 @@ static const TCHAR *waitblits[] = { _T("disabled"), _T("automatic"), _T("noidleo
static const TCHAR *autoext2[] = { _T("disabled"), _T("copy"), _T("replace"), 0 };
static const TCHAR *leds[] = { _T("power"), _T("df0"), _T("df1"), _T("df2"), _T("df3"), _T("hd"), _T("cd"), _T("fps"), _T("cpu"), _T("snd"), _T("md"), 0 };
static int leds_order[] = { 3, 6, 7, 8, 9, 4, 5, 2, 1, 0, 9 };
static const TCHAR *lacer[] = { _T("off"), _T("i"), _T("p"), 0 };
static const TCHAR *obsolete[] = {
_T("accuracy"), _T("gfx_opengl"), _T("gfx_32bit_blits"), _T("32bit_blits"),
@ -563,16 +569,24 @@ static size_t cfg_write (const void *b, struct zfile *z)
#define UTF8NAME _T(".utf8")
static void cfg_dowrite (struct zfile *f, const TCHAR *option, const TCHAR *value, int d, int target)
static void cfg_dowrite_ext (struct zfile *f, const TCHAR *option, const TCHAR *optionext, const TCHAR *value, int d, int target)
{
char lf = 10;
TCHAR tmp[CONFIG_BLEN];
TCHAR tmp[CONFIG_BLEN], tmpext[CONFIG_BLEN];
const TCHAR *optionp;
char tmpa[CONFIG_BLEN];
char *tmp1, *tmp2;
int utf8;
if (value == NULL)
return;
if (optionext) {
_tcscpy (tmpext, option);
_tcscat (tmpext, optionext);
optionp = tmpext;
} else {
optionp = option;
}
utf8 = 0;
tmp1 = ua (value);
tmp2 = uutf8 (value);
@ -580,14 +594,14 @@ static void cfg_dowrite (struct zfile *f, const TCHAR *option, const TCHAR *valu
utf8 = 1;
if (target)
_stprintf (tmp, _T("%s.%s=%s"), TARGET_NAME, option, value);
_stprintf (tmp, _T("%s.%s=%s"), TARGET_NAME, optionp, value);
else
_stprintf (tmp, _T("%s=%s"), option, value);
_stprintf (tmp, _T("%s=%s"), optionp, value);
if (d && isdefault (tmp))
goto end;
cfg_write (tmp, f);
if (utf8 && !unicode_config) {
char *opt = ua (option);
char *opt = ua (optionp);
if (target) {
char *tna = ua (TARGET_NAME);
sprintf (tmpa, "%s.%s.utf8=%s", tna, opt, tmp2);
@ -603,7 +617,10 @@ end:
xfree (tmp2);
xfree (tmp1);
}
static void cfg_dowrite (struct zfile *f, const TCHAR *option, const TCHAR *value, int d, int target)
{
cfg_dowrite_ext (f, option, NULL, value, d, target);
}
void cfgfile_write_bool (struct zfile *f, const TCHAR *option, bool b)
{
cfg_dowrite (f, option, b ? _T("true") : _T("false"), 0, 0);
@ -1145,6 +1162,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
cfgfile_dwrite_bool (f, _T("magic_mouse"), p->input_magic_mouse);
cfgfile_dwrite_str (f, _T("magic_mousecursor"), magiccursors[p->input_magic_mouse_cursor]);
cfgfile_dwrite_str (f, _T("absolute_mouse"), abspointers[p->input_tablet]);
cfgfile_dwrite_bool (f, _T("tablet_library"), p->tablet_library);
cfgfile_dwrite_bool (f, _T("clipboard_sharing"), p->clipboard_sharing);
cfgfile_dwrite_bool (f, _T("native_code"), p->native_code);
@ -1180,7 +1198,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
cfgfile_write_str (f, _T("gfx_resolution"), lorestype1[p->gfx_resolution]);
cfgfile_write_str (f, _T("gfx_lores_mode"), loresmode[p->gfx_lores_mode]);
cfgfile_write_bool (f, _T("gfx_flickerfixer"), p->gfx_scandoubler);
cfgfile_write_str (f, _T("gfx_linemode"), p->gfx_scanlines >= 2 ? linemode[4 + (p->gfx_scanlines - 2)] : linemode[p->gfx_vresolution * 2 + (p->gfx_scanlines ? 1 : 0)]);
cfgfile_write_str (f, _T("gfx_linemode"), p->gfx_vresolution > 0 ? linemode[p->gfx_iscanlines * 4 + p->gfx_pscanlines + 1] : linemode[0]);
cfgfile_write_str (f, _T("gfx_fullscreen_amiga"), fullmodes[p->gfx_apmode[0].gfx_fullscreen]);
cfgfile_write_str (f, _T("gfx_fullscreen_picasso"), fullmodes[p->gfx_apmode[1].gfx_fullscreen]);
cfgfile_write_str (f, _T("gfx_center_horizontal"), centermode1[p->gfx_xcenter]);
@ -1192,86 +1210,75 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
cfgfile_dwrite (f, _T("gfx_horizontal_tweak"), _T("%d"), p->gfx_extrawidth);
#ifdef GFXFILTER
for (int i = 0; i <MAX_FILTERSHADERS; i++) {
if (p->gfx_filtershader[i][0])
cfgfile_write (f, _T("gfx_filter_pre"), _T("D3D:%s"), p->gfx_filtershader[i]);
if (p->gfx_filtermask[i][0])
cfgfile_write_str (f, _T("gfx_filtermask_pre"), p->gfx_filtermask[i]);
}
for (int i = 0; i <MAX_FILTERSHADERS; i++) {
if (p->gfx_filtershader[i + MAX_FILTERSHADERS][0])
cfgfile_write (f, _T("gfx_filter_post"), _T("D3D:%s"), p->gfx_filtershader[i + MAX_FILTERSHADERS]);
if (p->gfx_filtermask[i + MAX_FILTERSHADERS][0])
cfgfile_write_str (f, _T("gfx_filtermask_post"), p->gfx_filtermask[i + MAX_FILTERSHADERS]);
}
cfgfile_dwrite_str (f, _T("gfx_filter_mask"), p->gfx_filtermask[2 * MAX_FILTERSHADERS]);
{
bool d3dfound = false;
if (p->gfx_filtershader[2 * MAX_FILTERSHADERS][0] && p->gfx_api) {
cfgfile_dwrite (f, _T("gfx_filter"), _T("D3D:%s"), p->gfx_filtershader[2 * MAX_FILTERSHADERS]);
d3dfound = true;
for (int j = 0; j < 2; j++) {
struct gfx_filterdata *gf = &p->gf[j];
const TCHAR *ext = j == 0 ? NULL : _T("_rtg");
for (int i = 0; i <MAX_FILTERSHADERS; i++) {
if (gf->gfx_filtershader[i][0])
cfgfile_write (f, _T("gfx_filter_pre"), ext, _T("D3D:%s"), gf->gfx_filtershader[i]);
if (gf->gfx_filtermask[i][0])
cfgfile_write_str (f, _T("gfx_filtermask_pre"), ext, gf->gfx_filtermask[i]);
}
if (!d3dfound) {
if (p->gfx_filter > 0) {
int i = 0;
struct uae_filter *uf;
while (uaefilters[i].name) {
uf = &uaefilters[i];
if (uf->type == p->gfx_filter) {
cfgfile_dwrite_str (f, _T("gfx_filter"), uf->cfgname);
for (int i = 0; i <MAX_FILTERSHADERS; i++) {
if (gf->gfx_filtershader[i + MAX_FILTERSHADERS][0])
cfgfile_write (f, _T("gfx_filter_post"), ext, _T("D3D:%s"), gf->gfx_filtershader[i + MAX_FILTERSHADERS]);
if (gf->gfx_filtermask[i + MAX_FILTERSHADERS][0])
cfgfile_write_str (f, _T("gfx_filtermask_post"), ext, gf->gfx_filtermask[i + MAX_FILTERSHADERS]);
}
cfgfile_dwrite_str (f, _T("gfx_filter_mask"), ext, gf->gfx_filtermask[2 * MAX_FILTERSHADERS]);
{
bool d3dfound = false;
if (gf->gfx_filtershader[2 * MAX_FILTERSHADERS][0] && p->gfx_api) {
cfgfile_dwrite (f, _T("gfx_filter"), ext, _T("D3D:%s"), gf->gfx_filtershader[2 * MAX_FILTERSHADERS]);
d3dfound = true;
}
if (!d3dfound) {
if (gf->gfx_filter > 0) {
int i = 0;
struct uae_filter *uf;
while (uaefilters[i].name) {
uf = &uaefilters[i];
if (uf->type == gf->gfx_filter) {
cfgfile_dwrite_str (f, _T("gfx_filter"), ext, uf->cfgname);
}
i++;
}
i++;
} else {
cfgfile_dwrite (f, _T("gfx_filter"), ext, _T("no"));
}
} else {
cfgfile_dwrite (f, _T("gfx_filter"), _T("no"));
}
}
cfgfile_dwrite_str (f, _T("gfx_filter_mode"), ext, filtermode2[gf->gfx_filter_filtermode]);
cfgfile_dwrite (f, _T("gfx_filter_vert_zoomf"), ext, _T("%f"), gf->gfx_filter_vert_zoom);
cfgfile_dwrite (f, _T("gfx_filter_horiz_zoomf"), ext, _T("%f"), gf->gfx_filter_horiz_zoom);
cfgfile_dwrite (f, _T("gfx_filter_vert_zoom_multf"), ext, _T("%f"), gf->gfx_filter_vert_zoom_mult);
cfgfile_dwrite (f, _T("gfx_filter_horiz_zoom_multf"), ext, _T("%f"), gf->gfx_filter_horiz_zoom_mult);
cfgfile_dwrite (f, _T("gfx_filter_vert_offsetf"), ext, _T("%f"), gf->gfx_filter_vert_offset);
cfgfile_dwrite (f, _T("gfx_filter_horiz_offsetf"), ext, _T("%f"), gf->gfx_filter_horiz_offset);
cfgfile_dwrite (f, _T("gfx_filter_scanlines"), ext, _T("%d"), gf->gfx_filter_scanlines);
cfgfile_dwrite (f, _T("gfx_filter_scanlinelevel"), ext, _T("%d"), gf->gfx_filter_scanlinelevel);
cfgfile_dwrite (f, _T("gfx_filter_scanlineratio"), ext, _T("%d"), gf->gfx_filter_scanlineratio);
cfgfile_dwrite (f, _T("gfx_filter_luminance"), ext, _T("%d"), gf->gfx_filter_luminance);
cfgfile_dwrite (f, _T("gfx_filter_contrast"), ext, _T("%d"), gf->gfx_filter_contrast);
cfgfile_dwrite (f, _T("gfx_filter_saturation"), ext, _T("%d"), gf->gfx_filter_saturation);
cfgfile_dwrite (f, _T("gfx_filter_gamma"), ext, _T("%d"), gf->gfx_filter_gamma);
cfgfile_dwrite (f, _T("gfx_filter_blur"), ext, _T("%d"), gf->gfx_filter_blur);
cfgfile_dwrite (f, _T("gfx_filter_noise"), ext, _T("%d"), gf->gfx_filter_noise);
cfgfile_dwrite_bool (f, _T("gfx_filter_bilinear"), ext, gf->gfx_filter_bilinear != 0);
cfgfile_dwrite (f, _T("gfx_filter_keep_autoscale_aspect"), ext, _T("%d"), gf->gfx_filter_keep_autoscale_aspect);
cfgfile_dwrite_str (f, _T("gfx_filter_keep_aspect"), ext, aspects[gf->gfx_filter_keep_aspect]);
cfgfile_dwrite_str (f, _T("gfx_filter_autoscale"), ext, autoscale[gf->gfx_filter_autoscale]);
cfgfile_dwrite (f, _T("gfx_filter_aspect_ratio"), ext, _T("%d:%d"),
gf->gfx_filter_aspect >= 0 ? (gf->gfx_filter_aspect / ASPECTMULT) : -1,
gf->gfx_filter_aspect >= 0 ? (gf->gfx_filter_aspect & (ASPECTMULT - 1)) : -1);
if (gf->gfx_filteroverlay[0]) {
cfgfile_dwrite (f, _T("gfx_filter_overlay"), ext, _T("%s%s"),
gf->gfx_filteroverlay, _tcschr (gf->gfx_filteroverlay, ',') ? _T(",") : _T(""));
}
}
cfgfile_dwrite_str (f, _T("gfx_filter_mode"), filtermode2[p->gfx_filter_filtermode]);
cfgfile_dwrite (f, _T("gfx_filter_vert_zoomf"), _T("%f"), p->gfx_filter_vert_zoom);
cfgfile_dwrite (f, _T("gfx_filter_horiz_zoomf"), _T("%f"), p->gfx_filter_horiz_zoom);
cfgfile_dwrite (f, _T("gfx_filter_vert_zoom_multf"), _T("%f"), p->gfx_filter_vert_zoom_mult);
cfgfile_dwrite (f, _T("gfx_filter_horiz_zoom_multf"), _T("%f"), p->gfx_filter_horiz_zoom_mult);
cfgfile_dwrite (f, _T("gfx_filter_vert_offsetf"), _T("%f"), p->gfx_filter_vert_offset);
cfgfile_dwrite (f, _T("gfx_filter_horiz_offsetf"), _T("%f"), p->gfx_filter_horiz_offset);
cfgfile_dwrite (f, _T("gfx_filter_scanlines"), _T("%d"), p->gfx_filter_scanlines);
cfgfile_dwrite (f, _T("gfx_filter_scanlinelevel"), _T("%d"), p->gfx_filter_scanlinelevel);
cfgfile_dwrite (f, _T("gfx_filter_scanlineratio"), _T("%d"), p->gfx_filter_scanlineratio);
cfgfile_dwrite (f, _T("gfx_filter_luminance"), _T("%d"), p->gfx_filter_luminance);
cfgfile_dwrite (f, _T("gfx_filter_contrast"), _T("%d"), p->gfx_filter_contrast);
cfgfile_dwrite (f, _T("gfx_filter_saturation"), _T("%d"), p->gfx_filter_saturation);
cfgfile_dwrite (f, _T("gfx_filter_gamma"), _T("%d"), p->gfx_filter_gamma);
cfgfile_dwrite (f, _T("gfx_filter_blur"), _T("%d"), p->gfx_filter_blur);
cfgfile_dwrite (f, _T("gfx_filter_noise"), _T("%d"), p->gfx_filter_noise);
cfgfile_dwrite_bool (f, _T("gfx_filter_bilinear"), p->gfx_filter_bilinear != 0);
cfgfile_dwrite (f, _T("gfx_filter_keep_autoscale_aspect"), _T("%d"), p->gfx_filter_keep_autoscale_aspect);
cfgfile_dwrite_str (f, _T("gfx_filter_keep_aspect"), aspects[p->gfx_filter_keep_aspect]);
cfgfile_dwrite_str (f, _T("gfx_filter_autoscale"), autoscale[p->gfx_filter_autoscale]);
cfgfile_dwrite (f, _T("gfx_filter_aspect_ratio"), _T("%d:%d"),
p->gfx_filter_aspect >= 0 ? (p->gfx_filter_aspect / ASPECTMULT) : -1,
p->gfx_filter_aspect >= 0 ? (p->gfx_filter_aspect & (ASPECTMULT - 1)) : -1);
cfgfile_dwrite (f, _T("gfx_luminance"), _T("%d"), p->gfx_luminance);
cfgfile_dwrite (f, _T("gfx_contrast"), _T("%d"), p->gfx_contrast);
cfgfile_dwrite (f, _T("gfx_gamma"), _T("%d"), p->gfx_gamma);
if (p->gfx_filteroverlay[0]) {
cfgfile_dwrite (f, _T("gfx_filter_overlay"), _T("%s%s"),
p->gfx_filteroverlay, _tcschr (p->gfx_filteroverlay, ',') ? _T(",") : _T(""));
#if 0
cfgfile_dwrite (f, _T("gfx_filter_overlay"), _T("%s,%d%s:%d%s:%d%s:%d%s:%d%%"),
p->gfx_filteroverlay,
p->gfx_filteroverlay_pos.x >= -24000 ? p->gfx_filteroverlay_pos.x : -p->gfx_filteroverlay_pos.x - 30000,
p->gfx_filteroverlay_pos.x >= -24000 ? _T("") : _T("%"),
p->gfx_filteroverlay_pos.y >= -24000 ? p->gfx_filteroverlay_pos.y : -p->gfx_filteroverlay_pos.y - 30000,
p->gfx_filteroverlay_pos.y >= -24000 ? _T("") : _T("%"),
p->gfx_filteroverlay_pos.width >= -24000 ? p->gfx_filteroverlay_pos.width : -p->gfx_filteroverlay_pos.width - 30000,
p->gfx_filteroverlay_pos.width >= -24000 ? _T("") : _T("%"),
p->gfx_filteroverlay_pos.height >= -24000 ? p->gfx_filteroverlay_pos.height : -p->gfx_filteroverlay_pos.height - 30000,
p->gfx_filteroverlay_pos.height >= -24000 ? _T("") : _T("%"),
p->gfx_filteroverlay_overscan
);
#endif
}
cfgfile_dwrite (f, _T("gfx_center_horizontal_position"), _T("%d"), p->gfx_xcenter_pos);
cfgfile_dwrite (f, _T("gfx_center_vertical_position"), _T("%d"), p->gfx_ycenter_pos);
@ -1530,22 +1537,47 @@ int cfgfile_doubleval (const TCHAR *option, const TCHAR *value, const TCHAR *nam
return 1;
}
int cfgfile_floatval (const TCHAR *option, const TCHAR *value, const TCHAR *name, float *location)
int cfgfile_floatval_ext (const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, float *location)
{
int base = 10;
TCHAR *endptr;
if (name != NULL && _tcscmp (option, name) != 0)
if (name == NULL)
return 0;
if (nameext) {
TCHAR tmp[MAX_DPATH];
_tcscpy (tmp, name);
_tcscat (tmp, nameext);
if (_tcscmp (tmp, option) != 0)
return 0;
} else {
if (_tcscmp (option, name) != 0)
return 0;
}
*location = (float)_tcstod (value, &endptr);
return 1;
}
int cfgfile_floatval (const TCHAR *option, const TCHAR *value, const TCHAR *name, float *location)
{
return cfgfile_floatval_ext (option, NULL, value, name, location);
}
int cfgfile_intval_unsigned (const TCHAR *option, const TCHAR *value, const TCHAR *name, unsigned int *location, int scale)
int cfgfile_intval_real (const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, unsigned int *location, int scale)
{
int base = 10;
TCHAR *endptr;
if (name != NULL && _tcscmp (option, name) != 0)
TCHAR tmp[MAX_DPATH];
if (name == NULL)
return 0;
if (nameext) {
_tcscpy (tmp, name);
_tcscat (tmp, nameext);
if (_tcscmp (tmp, option) != 0)
return 0;
} else {
if (_tcscmp (option, name) != 0)
return 0;
}
/* I guess octal isn't popular enough to worry about here... */
if (value[0] == '0' && _totupper (value[1]) == 'X')
value += 2, base = 16;
@ -1560,27 +1592,49 @@ int cfgfile_intval_unsigned (const TCHAR *option, const TCHAR *value, const TCHA
*location = 1;
return 1;
}
write_log (_T("Option '%s' requires a numeric argument but got '%s'\n"), option, value);
write_log (_T("Option '%s' requires a numeric argument but got '%s'\n"), nameext ? tmp : option, value);
return -1;
}
return 1;
}
int cfgfile_intval_unsigned (const TCHAR *option, const TCHAR *value, const TCHAR *name, unsigned int *location, int scale)
{
return cfgfile_intval_real (option, value, name, NULL, location, scale);
}
int cfgfile_intval (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, int scale)
{
unsigned int v = 0;
int r = cfgfile_intval_unsigned (option, value, name, &v, scale);
int r = cfgfile_intval_real (option, value, name, NULL, &v, scale);
if (!r)
return 0;
*location = (int)v;
return r;
}
int cfgfile_intval_ext (const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, int *location, int scale)
{
unsigned int v = 0;
int r = cfgfile_intval_real (option, value, name, nameext, &v, scale);
if (!r)
return 0;
*location = (int)v;
return r;
}
int cfgfile_strval (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, const TCHAR *table[], int more)
int cfgfile_strval_ext (const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, int *location, const TCHAR *table[], int more)
{
int val;
if (name != NULL && _tcscmp (option, name) != 0)
TCHAR tmp[MAX_DPATH];
if (name == NULL)
return 0;
if (nameext) {
_tcscpy (tmp, name);
_tcscat (tmp, nameext);
if (_tcscmp (tmp, option) != 0)
return 0;
} else {
if (_tcscmp (option, name) != 0)
return 0;
}
val = match_string (table, value);
if (val == -1) {
if (more)
@ -1590,13 +1644,17 @@ int cfgfile_strval (const TCHAR *option, const TCHAR *value, const TCHAR *name,
} else if (!strcasecmp (value, _T("no")) || !strcasecmp (value, _T("false"))) {
val = 0;
} else {
write_log (_T("Unknown value ('%s') for option '%s'.\n"), value, option);
write_log (_T("Unknown value ('%s') for option '%s'.\n"), value, nameext ? tmp : option);
return -1;
}
}
*location = val;
return 1;
}
int cfgfile_strval (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, const TCHAR *table[], int more)
{
return cfgfile_strval_ext (option, value, name, NULL, location, table, more);
}
int cfgfile_strboolval (const TCHAR *option, const TCHAR *value, const TCHAR *name, bool *location, const TCHAR *table[], int more)
{
@ -1615,6 +1673,23 @@ int cfgfile_string (const TCHAR *option, const TCHAR *value, const TCHAR *name,
location[maxsz - 1] = '\0';
return 1;
}
int cfgfile_string_ext (const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, TCHAR *location, int maxsz)
{
if (nameext) {
TCHAR tmp[MAX_DPATH];
_tcscpy (tmp, name);
_tcscat (tmp, nameext);
if (_tcscmp (tmp, option) != 0)
return 0;
} else {
if (_tcscmp (option, name) != 0)
return 0;
}
_tcsncpy (location, value, maxsz - 1);
location[maxsz - 1] = '\0';
return 1;
}
int cfgfile_path_mp (const TCHAR *option, const TCHAR *value, const TCHAR *name, TCHAR *location, int maxsz, struct multipath *mp)
{
@ -1931,36 +2006,16 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
|| cfgfile_intval (option, value, _T("gfx_center_horizontal_size"), &p->gfx_xcenter_size, 1)
|| cfgfile_intval (option, value, _T("gfx_center_vertical_size"), &p->gfx_ycenter_size, 1)
#ifdef GFXFILTER
|| cfgfile_floatval (option, value, _T("gfx_filter_vert_zoomf"), &p->gfx_filter_vert_zoom)
|| cfgfile_floatval (option, value, _T("gfx_filter_horiz_zoomf"), &p->gfx_filter_horiz_zoom)
|| cfgfile_floatval (option, value, _T("gfx_filter_vert_zoom_multf"), &p->gfx_filter_vert_zoom_mult)
|| cfgfile_floatval (option, value, _T("gfx_filter_horiz_zoom_multf"), &p->gfx_filter_horiz_zoom_mult)
|| cfgfile_floatval (option, value, _T("gfx_filter_vert_offsetf"), &p->gfx_filter_vert_offset)
|| cfgfile_floatval (option, value, _T("gfx_filter_horiz_offsetf"), &p->gfx_filter_horiz_offset)
|| cfgfile_intval (option, value, _T("gfx_filter_scanlines"), &p->gfx_filter_scanlines, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_scanlinelevel"), &p->gfx_filter_scanlinelevel, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_scanlineratio"), &p->gfx_filter_scanlineratio, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_luminance"), &p->gfx_filter_luminance, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_contrast"), &p->gfx_filter_contrast, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_saturation"), &p->gfx_filter_saturation, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_gamma"), &p->gfx_filter_gamma, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_blur"), &p->gfx_filter_blur, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_noise"), &p->gfx_filter_noise, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_bilinear"), &p->gfx_filter_bilinear, 1)
|| cfgfile_intval (option, value, _T("gfx_luminance"), &p->gfx_luminance, 1)
|| cfgfile_intval (option, value, _T("gfx_contrast"), &p->gfx_contrast, 1)
|| cfgfile_intval (option, value, _T("gfx_gamma"), &p->gfx_gamma, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_keep_autoscale_aspect"), &p->gfx_filter_keep_autoscale_aspect, 1)
|| cfgfile_intval (option, value, _T("gfx_horizontal_tweak"), &p->gfx_extrawidth, 1)
|| cfgfile_string (option, value, _T("gfx_filter_mask"), p->gfx_filtermask[2 * MAX_FILTERSHADERS], sizeof p->gfx_filtermask[2 * MAX_FILTERSHADERS] / sizeof (TCHAR))
|| cfgfile_intval (option, value, _T("filesys_max_size"), &p->filesys_limit, 1)
|| cfgfile_intval (option, value, _T("filesys_max_name_length"), &p->filesys_max_name, 1)
|| cfgfile_intval (option, value, _T("filesys_max_file_size"), &p->filesys_max_file_size, 1)
|| cfgfile_intval (option, value, _T("gfx_luminance"), &p->gfx_luminance, 1)
|| cfgfile_intval (option, value, _T("gfx_contrast"), &p->gfx_contrast, 1)
|| cfgfile_intval (option, value, _T("gfx_gamma"), &p->gfx_gamma, 1)
|| cfgfile_floatval (option, value, _T("rtg_vert_zoom_multf"), &p->rtg_vert_zoom_mult)
|| cfgfile_floatval (option, value, _T("rtg_horiz_zoom_multf"), &p->rtg_horiz_zoom_mult)
#endif
|| cfgfile_intval (option, value, _T("gfx_horizontal_tweak"), &p->gfx_extrawidth, 1)
#ifdef DRIVESOUND
|| cfgfile_intval (option, value, _T("floppy0sound"), &p->floppyslots[0].dfxclick, 1)
|| cfgfile_intval (option, value, _T("floppy1sound"), &p->floppyslots[1].dfxclick, 1)
@ -2005,6 +2060,7 @@ cfgfile_path (option, value, _T("floppy0soundext"), p->floppyslots[0].dfxclickex
|| cfgfile_yesno (option, value, _T("headless"), &p->headless)
|| cfgfile_yesno (option, value, _T("clipboard_sharing"), &p->clipboard_sharing)
|| cfgfile_yesno (option, value, _T("native_code"), &p->native_code)
|| cfgfile_yesno (option, value, _T("tablet_library"), &p->tablet_library)
|| cfgfile_yesno (option, value, _T("bsdsocket_emu"), &p->socket_emu))
return 1;
@ -2031,13 +2087,40 @@ cfgfile_path (option, value, _T("floppy0soundext"), p->floppyslots[0].dfxclickex
|| cfgfile_strval (option, value, _T("gfx_color_mode"), &p->color_mode, colormode2, 0)
|| cfgfile_strval (option, value, _T("gfx_max_horizontal"), &p->gfx_max_horizontal, maxhoriz, 0)
|| cfgfile_strval (option, value, _T("gfx_max_vertical"), &p->gfx_max_vertical, maxvert, 0)
|| cfgfile_strval (option, value, _T("gfx_filter_autoscale"), &p->gfx_filter_autoscale, autoscale, 0)
|| cfgfile_strval (option, value, _T("gfx_api"), &p->gfx_api, filterapi, 0)
|| cfgfile_strval (option, value, _T("magic_mousecursor"), &p->input_magic_mouse_cursor, magiccursors, 0)
|| cfgfile_strval (option, value, _T("gfx_filter_keep_aspect"), &p->gfx_filter_keep_aspect, aspects, 0)
|| cfgfile_strval (option, value, _T("absolute_mouse"), &p->input_tablet, abspointers, 0))
return 1;
#ifdef GFXFILTER
for (int j = 0; j < 2; j++) {
struct gfx_filterdata *gf = &p->gf[j];
const TCHAR *ext = j == 0 ? NULL : _T("_rtg");
if (cfgfile_strval (option, value, _T("gfx_filter_autoscale"), ext, &gf->gfx_filter_autoscale, autoscale, 0)
|| cfgfile_strval (option, value, _T("gfx_filter_keep_aspect"), ext, &gf->gfx_filter_keep_aspect, aspects, 0))
return 1;
if (cfgfile_floatval (option, value, _T("gfx_filter_vert_zoomf"), ext, &gf->gfx_filter_vert_zoom)
|| cfgfile_floatval (option, value, _T("gfx_filter_horiz_zoomf"), ext, &gf->gfx_filter_horiz_zoom)
|| cfgfile_floatval (option, value, _T("gfx_filter_vert_zoom_multf"), ext, &gf->gfx_filter_vert_zoom_mult)
|| cfgfile_floatval (option, value, _T("gfx_filter_horiz_zoom_multf"), ext, &gf->gfx_filter_horiz_zoom_mult)
|| cfgfile_floatval (option, value, _T("gfx_filter_vert_offsetf"), ext, &gf->gfx_filter_vert_offset)
|| cfgfile_floatval (option, value, _T("gfx_filter_horiz_offsetf"), ext, &gf->gfx_filter_horiz_offset)
|| cfgfile_intval (option, value, _T("gfx_filter_scanlines"), ext, &gf->gfx_filter_scanlines, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_scanlinelevel"), ext, &gf->gfx_filter_scanlinelevel, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_scanlineratio"), ext, &gf->gfx_filter_scanlineratio, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_luminance"), ext, &gf->gfx_filter_luminance, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_contrast"), ext, &gf->gfx_filter_contrast, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_saturation"), ext, &gf->gfx_filter_saturation, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_gamma"), ext, &gf->gfx_filter_gamma, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_blur"), ext, &gf->gfx_filter_blur, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_noise"), ext, &gf->gfx_filter_noise, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_bilinear"), ext, &gf->gfx_filter_bilinear, 1)
|| cfgfile_intval (option, value, _T("gfx_filter_keep_autoscale_aspect"), ext, &gf->gfx_filter_keep_autoscale_aspect, 1)
|| cfgfile_string (option, value, _T("gfx_filter_mask"), ext, gf->gfx_filtermask[2 * MAX_FILTERSHADERS], sizeof gf->gfx_filtermask[2 * MAX_FILTERSHADERS] / sizeof (TCHAR)))
return 1;
}
#endif
if (_tcscmp (option, _T("gfx_width_windowed")) == 0) {
if (!_tcscmp (value, _T("native"))) {
p->gfx_size_win.width = 0;
@ -2118,13 +2201,13 @@ cfgfile_path (option, value, _T("floppy0soundext"), p->floppyslots[0].dfxclickex
if (_tcscmp (option, _T("gfx_linemode")) == 0) {
int v;
p->gfx_vresolution = VRES_DOUBLE;
p->gfx_scanlines = 0;
p->gfx_pscanlines = 0;
p->gfx_iscanlines = 0;
if (cfgfile_strval (option, value, _T("gfx_linemode"), &v, linemode, 0)) {
if (v >= 4) {
p->gfx_scanlines = (v - 4) + 2;
} else {
p->gfx_scanlines = v & 1;
p->gfx_vresolution = v / 2;
if (v > 0) {
p->gfx_iscanlines = (v - 1) / 4;
p->gfx_pscanlines = (v - 1) % 4;
p->gfx_vresolution = 1;
}
}
return 1;
@ -2208,159 +2291,135 @@ cfgfile_path (option, value, _T("floppy0soundext"), p->floppyslots[0].dfxclickex
}
#ifdef GFXFILTER
if (_tcscmp (option, _T("gfx_filter_overlay")) == 0) {
TCHAR *s = _tcschr (value, ',');
p->gfx_filteroverlay_overscan = 0;
p->gfx_filteroverlay_pos.x = 0;
p->gfx_filteroverlay_pos.y = 0;
p->gfx_filteroverlay_pos.width = 0;
p->gfx_filteroverlay_pos.height = 0;
if (s)
*s = 0;
while (s) {
*s++ = 0;
p->gfx_filteroverlay_overscan = _tstol (s);
s = _tcschr (s, ':');
if (!s)
break;
#if 0
p->gfx_filteroverlay_pos.x = _tstol (s);
s = _tcschr (s, ',');
if (!s)
break;
if (s[-1] == '%')
p->gfx_filteroverlay_pos.x = -30000 - p->gfx_filteroverlay_pos.x;
*s++ = 0;
p->gfx_filteroverlay_pos.y = _tstol (s);
s = _tcschr (s, ',');
if (!s)
break;
if (s[-1] == '%')
p->gfx_filteroverlay_pos.y = -30000 - p->gfx_filteroverlay_pos.y;
*s++ = 0;
p->gfx_filteroverlay_pos.width = _tstol (s);
s = _tcschr (s, ',');
if (!s)
break;
if (s[-1] == '%')
p->gfx_filteroverlay_pos.width = -30000 - p->gfx_filteroverlay_pos.width;
*s++ = 0;
p->gfx_filteroverlay_pos.height = _tstol (s);
s = _tcschr (s, ',');
if (!s)
break;
if (s[-1] == '%')
p->gfx_filteroverlay_pos.height = -30000 - p->gfx_filteroverlay_pos.height;
*s++ = 0;
p->gfx_filteroverlay_overscan = _tstol (s);
TCHAR *s2 = _tcschr (s, ',');
if (s2)
*s2 = 0;
#endif
break;
}
_tcsncpy (p->gfx_filteroverlay, value, sizeof p->gfx_filteroverlay / sizeof (TCHAR) - 1);
p->gfx_filteroverlay[sizeof p->gfx_filteroverlay / sizeof (TCHAR) - 1] = 0;
return 1;
}
if (_tcscmp (option, _T("gfx_filtermask_pre")) == 0 || _tcscmp (option, _T("gfx_filtermask_post")) == 0) {
if (_tcscmp (option, _T("gfx_filtermask_pre")) == 0) {
for (int i = 0; i < MAX_FILTERSHADERS; i++) {
if (p->gfx_filtermask[i][0] == 0) {
_tcscpy (p->gfx_filtermask[i], value);
for (int j = 0; j < 2; j++) {
struct gfx_filterdata *gf = &p->gf[j];
if ((j == 0 && _tcscmp (option, _T("gfx_filter_overlay")) == 0) || (j == 1 && _tcscmp (option, _T("gfx_filter_overlay_rtg")) == 0)) {
TCHAR *s = _tcschr (value, ',');
gf->gfx_filteroverlay_overscan = 0;
gf->gfx_filteroverlay_pos.x = 0;
gf->gfx_filteroverlay_pos.y = 0;
gf->gfx_filteroverlay_pos.width = 0;
gf->gfx_filteroverlay_pos.height = 0;
if (s)
*s = 0;
while (s) {
*s++ = 0;
gf->gfx_filteroverlay_overscan = _tstol (s);
s = _tcschr (s, ':');
if (!s)
break;
}
}
} else {
for (int i = 0; i < MAX_FILTERSHADERS; i++) {
if (p->gfx_filtermask[i + MAX_FILTERSHADERS][0] == 0) {
_tcscpy (p->gfx_filtermask[i + MAX_FILTERSHADERS], value);
break;
}
break;
}
_tcsncpy (gf->gfx_filteroverlay, value, sizeof gf->gfx_filteroverlay / sizeof (TCHAR) - 1);
gf->gfx_filteroverlay[sizeof gf->gfx_filteroverlay / sizeof (TCHAR) - 1] = 0;
return 1;
}
return 1;
}
if (_tcscmp (option, _T("gfx_filter_pre")) == 0 || _tcscmp (option, _T("gfx_filter_post")) == 0) {
TCHAR *s = _tcschr (value, ':');
if (s) {
*s++ = 0;
if (!_tcscmp (value, _T("D3D"))) {
p->gfx_api = 1;
if (_tcscmp (option, _T("gfx_filter_pre")) == 0) {
for (int i = 0; i < MAX_FILTERSHADERS; i++) {
if (p->gfx_filtershader[i][0] == 0) {
_tcscpy (p->gfx_filtershader[i], s);
break;
}
if ((j == 0 && (_tcscmp (option, _T("gfx_filtermask_pre")) == 0 || _tcscmp (option, _T("gfx_filtermask_post")) == 0)) ||
(j == 1 && (_tcscmp (option, _T("gfx_filtermask_pre_rtg")) == 0 || _tcscmp (option, _T("gfx_filtermask_post_rtg")) == 0))) {
if (_tcscmp (option, _T("gfx_filtermask_pre")) == 0 || _tcscmp (option, _T("gfx_filtermask_pre_rtg")) == 0) {
for (int i = 0; i < MAX_FILTERSHADERS; i++) {
if (gf->gfx_filtermask[i][0] == 0) {
_tcscpy (gf->gfx_filtermask[i], value);
break;
}
} else {
for (int i = 0; i < MAX_FILTERSHADERS; i++) {
if (p->gfx_filtershader[i + MAX_FILTERSHADERS][0] == 0) {
_tcscpy (p->gfx_filtershader[i + MAX_FILTERSHADERS], s);
break;
}
} else {
for (int i = 0; i < MAX_FILTERSHADERS; i++) {
if (gf->gfx_filtermask[i + MAX_FILTERSHADERS][0] == 0) {
_tcscpy (gf->gfx_filtermask[i + MAX_FILTERSHADERS], value);
break;
}
}
}
return 1;
}
if ((j == 0 && (_tcscmp (option, _T("gfx_filter_pre")) == 0 || _tcscmp (option, _T("gfx_filter_post")) == 0)) ||
(j == 1 && (_tcscmp (option, _T("gfx_filter_pre_rtg")) == 0 || _tcscmp (option, _T("gfx_filter_post_rtg")) == 0))) {
TCHAR *s = _tcschr (value, ':');
if (s) {
*s++ = 0;
if (!_tcscmp (value, _T("D3D"))) {
p->gfx_api = 1;
if (_tcscmp (option, _T("gfx_filter_pre")) == 0) {
for (int i = 0; i < MAX_FILTERSHADERS; i++) {
if (gf->gfx_filtershader[i][0] == 0) {
_tcscpy (gf->gfx_filtershader[i], s);
break;
}
}
} else {
for (int i = 0; i < MAX_FILTERSHADERS; i++) {
if (gf->gfx_filtershader[i + MAX_FILTERSHADERS][0] == 0) {
_tcscpy (gf->gfx_filtershader[i + MAX_FILTERSHADERS], s);
break;
}
}
}
}
}
return 1;
}
return 1;
}
if (_tcscmp (option, _T("gfx_filter")) == 0) {
TCHAR *s = _tcschr (value, ':');
p->gfx_filter = 0;
if (s) {
*s++ = 0;
if (!_tcscmp (value, _T("D3D"))) {
p->gfx_api = 1;
_tcscpy (p->gfx_filtershader[2 * MAX_FILTERSHADERS], s);
for (int i = 0; i < 2 * MAX_FILTERSHADERS; i++) {
if (!_tcsicmp (p->gfx_filtershader[i], s)) {
p->gfx_filtershader[i][0] = 0;
p->gfx_filtermask[i][0] = 0;
if ((j == 0 && _tcscmp (option, _T("gfx_filter")) == 0) || (j == 1 && _tcscmp (option, _T("gfx_filter_rtg")) == 0)) {
TCHAR *s = _tcschr (value, ':');
gf->gfx_filter = 0;
if (s) {
*s++ = 0;
if (!_tcscmp (value, _T("D3D"))) {
p->gfx_api = 1;
_tcscpy (gf->gfx_filtershader[2 * MAX_FILTERSHADERS], s);
for (int i = 0; i < 2 * MAX_FILTERSHADERS; i++) {
if (!_tcsicmp (gf->gfx_filtershader[i], s)) {
gf->gfx_filtershader[i][0] = 0;
gf->gfx_filtermask[i][0] = 0;
}
}
}
}
}
if (!_tcscmp (value, _T("direct3d"))) {
p->gfx_api = 1; // forwards compatibiity
} else {
int i = 0;
while(uaefilters[i].name) {
if (!_tcscmp (uaefilters[i].cfgname, value)) {
p->gfx_filter = uaefilters[i].type;
break;
if (!_tcscmp (value, _T("direct3d"))) {
p->gfx_api = 1; // forwards compatibiity
} else {
int i = 0;
while(uaefilters[i].name) {
if (!_tcscmp (uaefilters[i].cfgname, value)) {
gf->gfx_filter = uaefilters[i].type;
break;
}
i++;
}
i++;
}
return 1;
}
return 1;
}
if (_tcscmp (option, _T("gfx_filter_mode")) == 0) {
cfgfile_strval (option, value, _T("gfx_filter_mode"), &p->gfx_filter_filtermode, filtermode2, 0);
return 1;
}
if (cfgfile_string (option, value, _T("gfx_filter_aspect_ratio"), tmpbuf, sizeof tmpbuf / sizeof (TCHAR))) {
int v1, v2;
TCHAR *s;
p->gfx_filter_aspect = -1;
v1 = _tstol (tmpbuf);
s = _tcschr (tmpbuf, ':');
if (s) {
v2 = _tstol (s + 1);
if (v1 < 0 || v2 < 0)
p->gfx_filter_aspect = -1;
else if (v1 == 0 || v2 == 0)
p->gfx_filter_aspect = 0;
else
p->gfx_filter_aspect = v1 * ASPECTMULT + v2;
if (j == 0 && _tcscmp (option, _T("gfx_filter_mode")) == 0) {
cfgfile_strval (option, value, _T("gfx_filter_mode"), &gf->gfx_filter_filtermode, filtermode2, 0);
return 1;
}
if (j == 1 && _tcscmp (option, _T("gfx_filter_mode_rtg")) == 0) {
cfgfile_strval (option, value, _T("gfx_filter_mode_rtg"), &gf->gfx_filter_filtermode, filtermode2, 0);
return 1;
}
if ((j == 0 && cfgfile_string (option, value, _T("gfx_filter_aspect_ratio"), tmpbuf, sizeof tmpbuf / sizeof (TCHAR))) ||
(j == 1 && cfgfile_string (option, value, _T("gfx_filter_aspect_ratio_rtg"), tmpbuf, sizeof tmpbuf / sizeof (TCHAR)))) {
int v1, v2;
TCHAR *s;
gf->gfx_filter_aspect = -1;
v1 = _tstol (tmpbuf);
s = _tcschr (tmpbuf, ':');
if (s) {
v2 = _tstol (s + 1);
if (v1 < 0 || v2 < 0)
gf->gfx_filter_aspect = -1;
else if (v1 == 0 || v2 == 0)
gf->gfx_filter_aspect = 0;
else
gf->gfx_filter_aspect = v1 * ASPECTMULT + v2;
}
return 1;
}
return 1;
}
#endif
@ -3457,7 +3516,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH
|| cfgfile_yesno (option, value, _T("comp_lowopt"), &p->comp_lowopt)
#endif
|| 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_write_protect"), &p->floppy_read_only)
|| cfgfile_yesno (option, value, _T("uae_hide_autoconfig"), &p->uae_hide_autoconfig)
|| cfgfile_yesno (option, value, _T("uaeserial"), &p->uaeserial))
return 1;
@ -4280,8 +4339,8 @@ static void parse_gfx_specs (struct uae_prefs *p, const TCHAR *spec)
p->gfx_xcenter = _tcschr (x2, 'x') != 0 ? 1 : _tcschr (x2, 'X') != 0 ? 2 : 0;
p->gfx_ycenter = _tcschr (x2, 'y') != 0 ? 1 : _tcschr (x2, 'Y') != 0 ? 2 : 0;
p->gfx_vresolution = _tcschr (x2, 'd') != 0 ? VRES_DOUBLE : VRES_NONDOUBLE;
p->gfx_scanlines = _tcschr (x2, 'D') != 0;
if (p->gfx_scanlines)
p->gfx_pscanlines = _tcschr (x2, 'D') != 0;
if (p->gfx_pscanlines)
p->gfx_vresolution = VRES_DOUBLE;
p->gfx_apmode[0].gfx_fullscreen = _tcschr (x2, 'a') != 0;
p->gfx_apmode[1].gfx_fullscreen = _tcschr (x2, 'p') != 0;
@ -5087,10 +5146,10 @@ void default_prefs (struct uae_prefs *p, int type)
p->config_hardware_path[0] = 0;
p->config_host_path[0] = 0;
p->gfx_scandoubler = 0;
p->start_gui = 1;
p->gfx_scandoubler = false;
p->start_gui = true;
#ifdef DEBUGGER
p->start_debugger = 0;
p->start_debugger = false;
#endif
p->all_lines = 0;
@ -5270,20 +5329,23 @@ void default_prefs (struct uae_prefs *p, int type)
p->cs_ciatodbug = false;
#ifdef GFXFILTER
p->gfx_filter = 0;
for (int i = 0; i <= 2 * MAX_FILTERSHADERS; i++) {
p->gfx_filtershader[i][0] = 0;
p->gfx_filtermask[i][0] = 0;
for (int i = APMODE_NATIVE; i <= APMODE_RTG; i++) {
struct gfx_filterdata *f = &p->gf[i];
f->gfx_filter = 0;
f->gfx_filter_scanlineratio = (1 << 4) | 1;
for (int j = 0; j <= 2 * MAX_FILTERSHADERS; j++) {
f->gfx_filtershader[i][0] = 0;
f->gfx_filtermask[i][0] = 0;
}
f->gfx_filter_horiz_zoom_mult = 1.0;
f->gfx_filter_vert_zoom_mult = 1.0;
f->gfx_filter_bilinear = 0;
f->gfx_filter_filtermode = 0;
f->gfx_filter_keep_aspect = 0;
f->gfx_filter_autoscale = AUTOSCALE_STATIC_AUTO;
f->gfx_filter_keep_autoscale_aspect = false;
f->gfx_filteroverlay_overscan = 0;
}
p->gfx_filter_horiz_zoom_mult = 1.0;
p->gfx_filter_vert_zoom_mult = 1.0;
p->gfx_filter_bilinear = 0;
p->gfx_filter_filtermode = 0;
p->gfx_filter_scanlineratio = (1 << 4) | 1;
p->gfx_filter_keep_aspect = 0;
p->gfx_filter_autoscale = AUTOSCALE_STATIC_AUTO;
p->gfx_filter_keep_autoscale_aspect = false;
p->gfx_filteroverlay_overscan = 0;
#endif
p->rtg_horiz_zoom_mult = 1.0;
@ -5377,6 +5439,7 @@ void default_prefs (struct uae_prefs *p, int type)
#endif
p->input_tablet = TABLET_OFF;
p->tablet_library = false;
p->input_magic_mouse = 0;
p->input_magic_mouse_cursor = 0;

View File

@ -27,7 +27,8 @@ void consolehook_config (struct uae_prefs *p)
p->produce_sound = 0;
p->gfx_resolution = 0;
p->gfx_vresolution = 0;
p->gfx_scanlines = false;
p->gfx_iscanlines = 0;
p->gfx_pscanlines = 0;
p->gfx_framerate = 10;
p->immediate_blits = 1;
p->collision_level = 0;

View File

@ -53,6 +53,7 @@ int mmu_atc_ways;
int mmu040_movem;
uaecptr mmu040_movem_ea;
uae_u32 mmu040_move16[4];
static void mmu_dump_ttr(const TCHAR * label, uae_u32 ttr)
{
@ -272,6 +273,7 @@ void mmu_bus_error(uaecptr addr, int fc, bool write, int size, bool rmw, uae_u32
}
ssw |= fc & MMU_SSW_TM; /* TM = FC */
switch (size) {
case sz_byte:
ssw |= MMU_SSW_SIZE_B;
@ -282,17 +284,27 @@ void mmu_bus_error(uaecptr addr, int fc, bool write, int size, bool rmw, uae_u32
case sz_long:
ssw |= MMU_SSW_SIZE_L;
break;
case 16: // MOVE16
ssw |= MMU_SSW_SIZE_L; // ??
ssw |= MMU_SSW_TT0;
write_log (_T("040 MMU MOVE16 FAULT!\n"));
break;
}
regs.wb3_status = write ? 0x80 | (ssw & 0x7f) : 0;
regs.wb2_status = 0;
if (!write)
ssw |= MMU_SSW_RW;
if (size == 16) { // MOVE16
ssw |= MMU_SSW_SIZE_L; // ?? maybe MMU_SSW_SIZE_CL?
ssw |= MMU_SSW_TT0;
regs.mmu_effective_addr &= ~15;
if (write) {
// clear normal writeback if MOVE16 write
regs.wb3_status &= ~0x80;
// wb2 = cacheline size writeback
regs.wb2_status = 0x80 | MMU_SSW_SIZE_CL | (ssw & 0x1f);
regs.wb2_address = regs.mmu_effective_addr;
write_log (_T("040 MMU MOVE16 WRITE FAULT!\n"));
}
}
if (mmu040_movem) {
ssw |= MMU_SSW_CM;
regs.mmu_effective_addr = mmu040_movem_ea;
@ -954,6 +966,39 @@ void REGPARAM2 dfc_put_byte(uaecptr addr, uae_u8 val)
ismoves = false;
}
void mmu_get_move16(uaecptr addr, uae_u32 *v, bool data, int size)
{
struct mmu_atc_line *cl;
addr &= ~15;
for (int i = 0; i < 4; i++) {
uaecptr addr2 = addr + i * 4;
// addr,super,data
if ((!regs.mmu_enabled) || (mmu_match_ttr(addr2,regs.s != 0,data,false)!=TTR_NO_MATCH))
v[i] = phys_get_long(addr2);
else if (likely(mmu_lookup(addr2, data, false, &cl)))
v[i] = phys_get_long(mmu_get_real_address(addr2, cl));
else
v[i] = mmu_get_long_slow(addr2, regs.s != 0, data, size, false, cl);
}
}
void mmu_put_move16(uaecptr addr, uae_u32 *val, bool data, int size)
{
struct mmu_atc_line *cl;
addr &= ~15;
for (int i = 0; i < 4; i++) {
uaecptr addr2 = addr + i * 4;
// addr,super,data
if ((!regs.mmu_enabled) || (mmu_match_ttr_write(addr2,regs.s != 0,data,val[i],size,false)==TTR_OK_MATCH))
phys_put_long(addr2,val[i]);
else if (likely(mmu_lookup(addr2, data, true, &cl)))
phys_put_long(mmu_get_real_address(addr2, cl), val[i]);
else
mmu_put_long_slow(addr2, val[i], regs.s != 0, data, size, false, cl);
}
}
void REGPARAM2 mmu_op_real(uae_u32 opcode, uae_u16 extra)
{
bool super = (regs.dfc & 4) != 0;

View File

@ -3364,9 +3364,10 @@ static void finish_decisions (void)
if (changed) {
thisline_changed = 1;
*dp = thisline_decision;
} else
} else {
/* The only one that may differ: */
dp->ctable = thisline_decision.ctable;
}
/* leave free space for possible extra color changes at the end of line */
next_color_change += (HBLANK_OFFSET + 1) / 2;
@ -3758,6 +3759,10 @@ void compute_framesync (void)
gfxvidinfo.outheight = gfxvidinfo.height_allocated;
memset (line_decisions, 0, sizeof line_decisions);
memset (line_drawinfo, 0, sizeof line_drawinfo);
for (int i = 0; i < sizeof (line_decisions) / sizeof *line_decisions; i++) {
line_decisions[i].plfleft = -1;
}
compute_vsynctime ();
@ -3874,7 +3879,7 @@ void init_hz_fullinit (bool fullinit)
maxvpos_nom = maxvpos;
maxvpos_display = maxvpos;
equ_vblank_endline = -1;
doublescan = htotal <= 164 ? 1 : 0;
doublescan = htotal <= 164 && vtotal >= 350 ? 1 : 0;
programmedmode = true;
varsync_changed = true;
vpos_count = maxvpos_nom;
@ -7499,20 +7504,28 @@ static void hsync_handler_post (bool onvsync)
nextline_how = nln_normal;
if (doflickerfix () && interlace_seen > 0) {
lineno *= 2;
} else if ((doublescan <= 0 || interlace_seen > 0) && currprefs.gfx_vresolution && currprefs.gfx_scanlines >= 2) {
} else if (!interlace_seen && doublescan <= 0 && currprefs.gfx_vresolution && currprefs.gfx_pscanlines > 1) {
lineno *= 2;
if (timeframes & 1) {
lineno++;
nextline_how = currprefs.gfx_pscanlines == 3 ? nln_lower_black_always : nln_lower_black;
} else {
nextline_how = currprefs.gfx_pscanlines == 3 ? nln_upper_black_always : nln_upper_black;
}
} else if ((doublescan <= 0 || interlace_seen > 0) && currprefs.gfx_vresolution && currprefs.gfx_iscanlines) {
lineno *= 2;
nextline_how = currprefs.gfx_vresolution > VRES_NONDOUBLE && (currprefs.gfx_scanlines & 1) == 0 ? nln_doubled : nln_nblack;
if (interlace_seen) {
if (!lof_current) {
lineno++;
nextline_how = nln_lower_black;
nextline_how = currprefs.gfx_iscanlines == 2 ? nln_lower_black_always : nln_lower_black;
} else {
nextline_how = nln_upper_black;
nextline_how = currprefs.gfx_iscanlines == 2 ? nln_upper_black_always : nln_upper_black;
}
} else {
nextline_how = currprefs.gfx_vresolution > VRES_NONDOUBLE && currprefs.gfx_pscanlines == 1 ? nln_nblack : nln_doubled;
}
} else if (currprefs.gfx_vresolution && (doublescan <= 0 || interlace_seen > 0)) {
lineno *= 2;
nextline_how = currprefs.gfx_vresolution > VRES_NONDOUBLE && currprefs.gfx_scanlines == 0 ? nln_doubled : nln_nblack;
if (interlace_seen) {
if (!lof_current) {
lineno++;
@ -7520,6 +7533,8 @@ static void hsync_handler_post (bool onvsync)
} else {
nextline_how = nln_upper;
}
} else {
nextline_how = currprefs.gfx_vresolution > VRES_NONDOUBLE && currprefs.gfx_pscanlines == 1 ? nln_nblack : nln_doubled;
}
}
prev_lineno = next_lineno;
@ -9084,11 +9099,11 @@ void check_prefs_changed_custom (void)
init_custom ();
}
#ifdef GFXFILTER
currprefs.gfx_filter_horiz_zoom = changed_prefs.gfx_filter_horiz_zoom;
currprefs.gfx_filter_vert_zoom = changed_prefs.gfx_filter_vert_zoom;
currprefs.gfx_filter_horiz_offset = changed_prefs.gfx_filter_horiz_offset;
currprefs.gfx_filter_vert_offset = changed_prefs.gfx_filter_vert_offset;
currprefs.gfx_filter_scanlines = changed_prefs.gfx_filter_scanlines;
currprefs.gf[0].gfx_filter_horiz_zoom = changed_prefs.gf[0].gfx_filter_horiz_zoom;
currprefs.gf[0].gfx_filter_vert_zoom = changed_prefs.gf[0].gfx_filter_vert_zoom;
currprefs.gf[0].gfx_filter_horiz_offset = changed_prefs.gf[0].gfx_filter_horiz_offset;
currprefs.gf[0].gfx_filter_vert_offset = changed_prefs.gf[0].gfx_filter_vert_offset;
currprefs.gf[0].gfx_filter_scanlines = changed_prefs.gf[0].gfx_filter_scanlines;
#endif
}

View File

@ -43,6 +43,9 @@ int disk_debug_track = -1;
#ifdef CAPS
#include "caps.h"
#endif
#ifdef SCP
#include "scp.h"
#endif
#include "crc32.h"
#include "inputdevice.h"
#include "amax.h"
@ -156,7 +159,7 @@ typedef struct {
#define DRIVE_ID_35HD 0xAAAAAAAA
#define DRIVE_ID_525SD 0x55555555 /* 40 track 5.25 drive , kickstart does not recognize this */
typedef enum { ADF_NONE = -1, ADF_NORMAL, ADF_EXT1, ADF_EXT2, ADF_FDI, ADF_IPF, ADF_CATWEASEL, ADF_PCDOS, ADF_KICK, ADF_SKICK } drive_filetype;
typedef enum { ADF_NONE = -1, ADF_NORMAL, ADF_EXT1, ADF_EXT2, ADF_FDI, ADF_IPF, ADF_SCP, ADF_CATWEASEL, ADF_PCDOS, ADF_KICK, ADF_SKICK } drive_filetype;
typedef struct {
struct zfile *diskfile;
struct zfile *writediskfile;
@ -208,6 +211,8 @@ typedef struct {
#else
int catweasel;
int amax;
int lastdataacesstrack;
int lastrev;
#endif
} drive;
@ -622,6 +627,11 @@ static void drive_image_free (drive *drv)
case ADF_IPF:
#ifdef CAPS
caps_unloadimage (drv - floppy);
#endif
break;
case ADF_SCP:
#ifdef SCP
scp_close (drv - floppy);
#endif
break;
case ADF_FDI:
@ -686,6 +696,7 @@ static void reset_drive (int num)
drv->idbit = 0;
drv->drive_id = 0;
drv->drive_id_scnt = 0;
drv->lastdataacesstrack = -1;
disabled &= ~(1 << num);
if (currprefs.floppyslots[num].dfxtype < 0)
disabled |= 1 << num;
@ -934,6 +945,10 @@ static bool diskfile_iswriteprotect (struct uae_prefs *p, const TCHAR *fname, in
*needwritefile = 1;
return wrprot2;
}
if (strncmp ((uae_char*) buffer, "SCP", 3) == 0) {
*needwritefile = 1;
return wrprot2;
}
if (strncmp ((uae_char*) buffer, "Formatted Disk Image file", 25) == 0) {
*needwritefile = 1;
return wrprot2;
@ -968,7 +983,7 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR
{
uae_u8 buffer[2 + 2 + 4 + 4];
trackid *tid;
#ifdef CAPS
#if defined(CAPS) || defined(SCP)
int num_tracks;
#endif
int size;
@ -1045,6 +1060,17 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR
drv->num_tracks = num_tracks;
drv->filetype = ADF_IPF;
#endif
#ifdef SCP
} else if (strncmp ((char*)buffer, "SCP", 3) == 0) {
drv->wrprot = true;
if (!scp_open (drv->diskfile, drv - floppy, &num_tracks)) {
zfile_fclose (drv->diskfile);
drv->diskfile = 0;
return 0;
}
drv->num_tracks = num_tracks;
drv->filetype = ADF_SCP;
#endif
#ifdef FDI2RAW
} else if ( (drv->fdi = fdi2raw_header (drv->diskfile)) ) {
@ -1729,6 +1755,8 @@ static void drive_fill_bigbuf (drive * drv, int force)
{
int tr = drv->cyl * 2 + side;
trackid *ti = drv->trackdata + tr;
bool retrytrack;
int rev = -1;
if ((!drv->diskfile && !drv->catweasel) || tr >= drv->num_tracks) {
track_reset (drv);
@ -1748,6 +1776,9 @@ static void drive_fill_bigbuf (drive * drv, int force)
drv->skipoffset = -1;
drv->revolutions = 1;
retrytrack = drv->lastdataacesstrack == drv->cyl * 2 + side;
//write_log (_T("%d:%d %d\n"), drv->cyl, side, retrytrack);
if (drv->writediskfile && drv->writetrackdata[tr].bitlen > 0) {
int i;
trackid *wti = &drv->writetrackdata[tr];
@ -1776,7 +1807,13 @@ static void drive_fill_bigbuf (drive * drv, int force)
} else if (drv->filetype == ADF_IPF) {
#ifdef CAPS
caps_loadtrack (drv->bigmfmbuf, drv->tracktiming, drv - floppy, tr, &drv->tracklen, &drv->multi_revolution, &drv->skipoffset);
caps_loadtrack (drv->bigmfmbuf, drv->tracktiming, drv - floppy, tr, &drv->tracklen, &drv->multi_revolution, &drv->skipoffset, &drv->lastrev, retrytrack);
#endif
} else if (drv->filetype == ADF_SCP) {
#ifdef SCP
scp_loadtrack (drv->bigmfmbuf, drv->tracktiming, drv - floppy, tr, &drv->tracklen, &drv->multi_revolution, &drv->skipoffset, &drv->lastrev, retrytrack);
#endif
} else if (drv->filetype == ADF_FDI) {
@ -2928,7 +2965,12 @@ static void fetchnextrevolution (drive *drv)
{
case ADF_IPF:
#ifdef CAPS
caps_loadrevolution (drv->bigmfmbuf, drv - floppy, drv->cyl * 2 + side, &drv->tracklen);
caps_loadrevolution (drv->bigmfmbuf, drv->tracktiming, drv - floppy, drv->cyl * 2 + side, &drv->tracklen, &drv->lastrev);
#endif
break;
case ADF_SCP:
#ifdef SCP
scp_loadrevolution (drv->bigmfmbuf, drv - floppy, drv->tracktiming, &drv->tracklen);
#endif
break;
case ADF_FDI:
@ -2954,14 +2996,16 @@ void DISK_handler (uae_u32 data)
event2_remevent (ev2_disk);
DISK_update (disk_sync_cycle);
if (flag & (DISK_REVOLUTION << 0))
fetchnextrevolution (&floppy[0]);
if (flag & (DISK_REVOLUTION << 1))
fetchnextrevolution (&floppy[1]);
if (flag & (DISK_REVOLUTION << 2))
fetchnextrevolution (&floppy[2]);
if (flag & (DISK_REVOLUTION << 3))
fetchnextrevolution (&floppy[3]);
if (!dskdmaen) {
if (flag & (DISK_REVOLUTION << 0))
fetchnextrevolution (&floppy[0]);
if (flag & (DISK_REVOLUTION << 1))
fetchnextrevolution (&floppy[1]);
if (flag & (DISK_REVOLUTION << 2))
fetchnextrevolution (&floppy[2]);
if (flag & (DISK_REVOLUTION << 3))
fetchnextrevolution (&floppy[3]);
}
if (flag & DISK_WORDSYNC)
INTREQ (0x8000 | 0x1000);
if (flag & DISK_INDEXSYNC) {
@ -3052,13 +3096,14 @@ static void updatetrackspeed (drive *drv, int mfmpos)
{
if (dskdmaen < DSKDMA_WRITE) {
int t = drv->tracktiming[mfmpos / 8];
drv->trackspeed = get_floppy_speed2 (drv) * t / 1000;
if (drv->trackspeed < 700 || drv->trackspeed > 3000) {
int ts = get_floppy_speed2 (drv) * t / 1000;
if (ts < 700 || ts > 3000) {
static int warned;
warned++;
if (warned < 50)
write_log (_T("corrupted trackspeed value %d\n"), drv->trackspeed);
drv->trackspeed = 1000;
write_log (_T("corrupted trackspeed value %d %d (%d/%d)\n"), t, ts, mfmpos, drv->tracklen);
} else {
drv->trackspeed = ts;
}
}
}
@ -3076,13 +3121,17 @@ static void disk_doupdate_predict (int startcycle)
continue;
if (selected & (1 << dr))
continue;
int mfmpos = drv->mfmpos;
if (drv->tracktiming[0])
updatetrackspeed (drv, mfmpos);
int diskevent_flag = 0;
uae_u32 tword = word;
int countcycle = startcycle + (drv->floppybitcounter % drv->trackspeed);
int mfmpos = drv->mfmpos;
//int diff = drv->floppybitcounter % drv->trackspeed;
int countcycle = startcycle; // + (diff ? drv->trackspeed - diff : 0);
while (countcycle < (maxhpos << 8)) {
if (drv->tracktiming[0])
updatetrackspeed (drv, mfmpos);
countcycle += drv->trackspeed;
if (dskdmaen != DSKDMA_WRITE || (dskdmaen == DSKDMA_WRITE && !dma_enable)) {
tword <<= 1;
if (!drive_empty (drv)) {
@ -3096,7 +3145,7 @@ static void disk_doupdate_predict (int startcycle)
}
mfmpos++;
mfmpos %= drv->tracklen;
if (mfmpos == 0)
if (mfmpos == 0 && !dskdmaen)
diskevent_flag |= DISK_REVOLUTION << (drv - floppy);
if (mfmpos == drv->indexoffset)
diskevent_flag |= DISK_INDEXSYNC;
@ -3114,7 +3163,6 @@ static void disk_doupdate_predict (int startcycle)
}
if (diskevent_flag)
break;
countcycle += drv->trackspeed;
}
if (drv->tracktiming[0])
updatetrackspeed (drv, drv->mfmpos);
@ -3207,7 +3255,6 @@ static void disk_doupdate_read (drive * drv, int floppybits)
mfmbuf[7] = 0x4444;
*/
while (floppybits >= drv->trackspeed) {
int oldmfmpos = drv->mfmpos;
if (drv->tracktiming[0])
updatetrackspeed (drv, drv->mfmpos);
word <<= 1;
@ -3218,6 +3265,10 @@ static void disk_doupdate_read (drive * drv, int floppybits)
word |= getonebit (drv->bigmfmbuf, drv->mfmpos);
}
//write_log (_T("%08X bo=%d so=%d mfmpos=%d dma=%d\n"), (word & 0xffffff), bitoffset, syncoffset, drv->mfmpos, dma_enable);
if (doreaddma () < 0) {
word >>= 1;
return;
}
drv->mfmpos++;
drv->mfmpos %= drv->tracklen;
if (drv->mfmpos == drv->indexoffset) {
@ -3230,9 +3281,10 @@ static void disk_doupdate_read (drive * drv, int floppybits)
drv->mfmpos += disk_jitter;
drv->mfmpos %= drv->tracklen;
}
if (doreaddma () < 0) {
drv->mfmpos = oldmfmpos;
return;
if (drv->mfmpos == 0) {
fetchnextrevolution (drv);
if (drv->tracktiming[0])
updatetrackspeed (drv, drv->mfmpos);
}
if ((bitoffset & 7) == 7) {
dskbytr_val = word & 0xff;
@ -3280,13 +3332,13 @@ uae_u16 DSKBYTR (int hpos)
if (disk_debug_logging > 1)
write_log (_T("DSKBYTR=%04X hpos=%d\n"), v, hpos);
#ifdef DEBUGGER
if (disk_debug_mode & DISK_DEBUG_PIO) {
int dr;
for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
drive *drv = &floppy[dr];
if (drv->motoroff)
continue;
if (!(selected & (1 << dr))) {
for (int dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
drive *drv = &floppy[dr];
if (drv->motoroff)
continue;
if (!(selected & (1 << dr))) {
drv->lastdataacesstrack = drv->cyl * 2 + side;
if (disk_debug_mode & DISK_DEBUG_PIO) {
if (disk_debug_track < 0 || disk_debug_track == 2 * drv->cyl + side) {
disk_dma_debugmsg ();
write_log (_T("DSKBYTR=%04X\n"), v);
@ -3302,9 +3354,9 @@ uae_u16 DSKBYTR (int hpos)
static void DISK_start (void)
{
unsigned int dr;
int dr, i;
for (unsigned int i = 0; i < 3; i++)
for (i = 0; i < 3; i++)
fifo_inuse[i] = false;
fifo_filled = 0;
for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
@ -3313,6 +3365,10 @@ static void DISK_start (void)
int tr = drv->cyl * 2 + side;
trackid *ti = drv->trackdata + tr;
if (dskdmaen == DSKDMA_READ) {
drv->lastdataacesstrack = drv->cyl * 2 + side;
}
if (dskdmaen == DSKDMA_WRITE) {
drv->tracklen = longwritemode ? FLOPPY_WRITE_MAXLEN : FLOPPY_WRITE_LEN * drv->ddhd * 8 * 2;
drv->trackspeed = get_floppy_speed ();
@ -4038,6 +4094,7 @@ uae_u8 *restore_disk2 (int num,uae_u8 *src)
if (m & 2)
drv->tracktiming[j] = restore_u16 ();
}
drv->revolutions = restore_u16 ();
}
return src;
}
@ -4097,6 +4154,7 @@ uae_u8 *save_disk2 (int num, int *len, uae_u8 *dstptr)
if (drv->tracktiming[0])
save_u16 (drv->tracktiming[j]);
}
save_u16 (drv->revolutions);
*len = dst - dstbak;
return dstbak;

View File

@ -92,7 +92,7 @@ static int linedbl, linedbld;
int interlace_seen = 0;
#define AUTO_LORES_FRAMES 10
static int can_use_lores = 0, frame_res, frame_res_lace;
static int resolution_count[RES_MAX + 1];
static int resolution_count[RES_MAX + 1], lines_count;
static bool center_reset;
/* Lookup tables for dual playfields. The dblpf_*1 versions are for the case
@ -775,7 +775,7 @@ static void pfield_init_linetoscr (bool border)
// Sprite hpos don't include DIW_DDF_OFFSET and can appear 1 lores pixel
// before first bitplane pixel appears.
// This means "bordersprite" condition is possible under OCS/ECS too. Argh!
if (dip_for_drawing->nr_sprites) {
if (dip_for_drawing->nr_sprites && !colors_for_drawing.borderblank) {
/* bordersprite off or not supported: sprites are visible until diw_end */
if (playfield_end < linetoscr_diw_end && hblank_right_stop > playfield_end) {
playfield_end = linetoscr_diw_end;
@ -789,7 +789,7 @@ static void pfield_init_linetoscr (bool border)
}
#ifdef AGA
if (dp_for_drawing->bordersprite_seen && dip_for_drawing->nr_sprites) {
if (dp_for_drawing->bordersprite_seen && !colors_for_drawing.borderblank && dip_for_drawing->nr_sprites) {
int min = visible_right_border, max = visible_left_border, i;
for (i = 0; i < dip_for_drawing->nr_sprites; i++) {
int x;
@ -822,7 +822,7 @@ static void pfield_init_linetoscr (bool border)
int first_x = sprite_first_x;
int last_x = sprite_last_x;
if (first_x < last_x) {
if (dp_for_drawing->bordersprite_seen) {
if (dp_for_drawing->bordersprite_seen && !colors_for_drawing.borderblank) {
if (first_x > visible_left_border)
first_x = visible_left_border;
if (last_x < visible_right_border)
@ -1528,6 +1528,11 @@ static void pfield_do_linetoscr (int start, int stop, bool blank)
// left or right AGA border sprite
static void pfield_do_linetoscr_bordersprite_aga (int start, int stop, bool blank)
{
if (blank) {
pfield_do_fill_line (start, stop, blank);
return;
}
if (res_shift == 0) {
switch (gfxvidinfo.pixbytes) {
case 2: src_pixel = linetoscr_16_aga_spronly (LTPARMS); break;
@ -2299,7 +2304,10 @@ static void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos)
dp_for_drawing = line_decisions + lineno;
dip_for_drawing = curr_drawinfo + lineno;
resolution_count[dp_for_drawing->bplres]++;
if (dp_for_drawing->plfleft >= 0) {
lines_count++;
resolution_count[dp_for_drawing->bplres]++;
}
switch (linestate[lineno])
{
@ -2345,8 +2353,10 @@ static void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos)
break;
}
#if 0
if (border && dp_for_drawing->plfleft < -1)
border = -1; // interlace mode missing odd line = blank
border = -1; // blank last "missing" line
#endif
dh = dh_line;
xlinebuffer = gfxvidinfo.linemem;
@ -2387,7 +2397,7 @@ static void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos)
if (dip_for_drawing->nr_sprites) {
int i;
#ifdef AGA
if (colors_for_drawing.bordersprite && dp_for_drawing->bordersprite_seen)
if (colors_for_drawing.bordersprite && dp_for_drawing->bordersprite_seen && !colors_for_drawing.borderblank)
clear_bitplane_border_aga ();
#endif
@ -2402,7 +2412,7 @@ static void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos)
}
#ifdef AGA
if (dip_for_drawing->nr_sprites && colors_for_drawing.bordersprite && dp_for_drawing->bordersprite_seen)
if (dip_for_drawing->nr_sprites && colors_for_drawing.bordersprite && !colors_for_drawing.borderblank && dp_for_drawing->bordersprite_seen)
do_color_changes (pfield_do_linetoscr_bordersprite_aga, pfield_do_linetoscr, lineno);
else
#endif
@ -2422,7 +2432,6 @@ static void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos)
if (dip_for_drawing->nr_sprites)
pfield_erase_hborder_sprites ();
} else if (border > 0) {
// border > 0: top or bottom border
bool dosprites = false;
@ -2430,7 +2439,7 @@ static void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos)
adjust_drawing_colors (dp_for_drawing->ctable, 0);
#ifdef AGA /* this makes things complex.. */
if (dp_for_drawing->bordersprite_seen && dip_for_drawing->nr_sprites) {
if (dp_for_drawing->bordersprite_seen && !colors_for_drawing.borderblank && dip_for_drawing->nr_sprites) {
dosprites = true;
pfield_expand_dp_bplcon ();
pfield_init_linetoscr (true);
@ -2488,8 +2497,9 @@ static void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos)
} else {
// top or bottom blanking region
int tmp = hposblank;
hposblank = colors_for_drawing.borderblank;
hposblank = 1;
fill_line ();
do_flush_line (gfx_ypos);
hposblank = tmp;
@ -2503,7 +2513,7 @@ static void center_image (void)
int prev_y_adjust = thisframe_y_adjust;
int w = gfxvidinfo.inwidth;
if (currprefs.gfx_xcenter && !currprefs.gfx_filter_autoscale && max_diwstop > 0) {
if (currprefs.gfx_xcenter && !currprefs.gf[0].gfx_filter_autoscale && max_diwstop > 0) {
if (max_diwstop - min_diwstart < w && currprefs.gfx_xcenter == 2)
/* Try to center. */
@ -2547,7 +2557,7 @@ static void center_image (void)
visible_right_border = max_diwlastword;
thisframe_y_adjust = minfirstline;
if (currprefs.gfx_ycenter && thisframe_first_drawn_line >= 0 && !currprefs.gfx_filter_autoscale) {
if (currprefs.gfx_ycenter && thisframe_first_drawn_line >= 0 && !currprefs.gf[0].gfx_filter_autoscale) {
if (thisframe_last_drawn_line - thisframe_first_drawn_line < max_drawn_amiga_line && currprefs.gfx_ycenter == 2)
thisframe_y_adjust = (thisframe_last_drawn_line - thisframe_first_drawn_line - max_drawn_amiga_line) / 2 + thisframe_first_drawn_line;
@ -2566,7 +2576,7 @@ static void center_image (void)
/* Make sure the value makes sense */
if (thisframe_y_adjust + max_drawn_amiga_line > maxvpos + maxvpos / 2)
thisframe_y_adjust = maxvpos + maxvpos / 2 - max_drawn_amiga_line;
thisframe_y_adjust = maxvpos + maxvpos / 2 - max_drawn_amiga_line;
if (thisframe_y_adjust < 0)
thisframe_y_adjust = 0;
@ -2593,7 +2603,7 @@ static void init_drawing_frame (void)
int i, maxline;
static int frame_res_old;
if (currprefs.gfx_autoresolution) {
if (currprefs.gfx_autoresolution && lines_count > 0) {
int frame_res_detected;
int frame_res_lace_detected = frame_res_lace;
@ -2611,7 +2621,7 @@ static void init_drawing_frame (void)
if (currprefs.gfx_autoresolution == 1)
frame_res_detected = largest_res;
else if (largest_count * 100 / maxvpos >= currprefs.gfx_autoresolution)
else if (largest_count * 100 / lines_count >= currprefs.gfx_autoresolution)
frame_res_detected = largest_count_res;
else
frame_res_detected = largest_count_res - 1;
@ -2626,7 +2636,7 @@ static void init_drawing_frame (void)
struct wh *dst = currprefs.gfx_apmode[0].gfx_fullscreen ? &changed_prefs.gfx_size_fs : &changed_prefs.gfx_size_win;
while (m < 3 * 2) {
struct wh *src = currprefs.gfx_apmode[0].gfx_fullscreen ? &currprefs.gfx_size_fs_xtra[m] : &currprefs.gfx_size_win_xtra[m];
if ((src->width > 0 && src->height > 0) || (currprefs.gfx_api || currprefs.gfx_filter > 0)) {
if ((src->width > 0 && src->height > 0) || (currprefs.gfx_api || currprefs.gf[0].gfx_filter > 0)) {
int nr = m >> 1;
int nl = (m & 1) == 0 ? 0 : 1;
int nr_o = nr;
@ -2681,6 +2691,7 @@ static void init_drawing_frame (void)
}
for (int i = 0; i <= RES_MAX; i++)
resolution_count[i] = 0;
lines_count = 0;
frame_res = -1;
frame_res_lace = 0;
@ -2752,7 +2763,7 @@ void putpixel (uae_u8 *buf, int bpp, int x, xcolnr c8, int opaq)
case 4:
{
int i;
if (1 || opaq || currprefs.gfx_filter == 0) {
if (1 || opaq || currprefs.gf[0].gfx_filter == 0) {
uae_u32 *p = (uae_u32*)buf + x;
*p = c8;
} else {
@ -3102,7 +3113,7 @@ bool vsync_handle_check (void)
void vsync_handle_redraw (int long_field, int lof_changed, uae_u16 bplcon0p, uae_u16 bplcon3p)
{
last_redraw_point++;
if (lof_changed || interlace_seen <= 0 || (currprefs.gfx_scanlines >= 2 && interlace_seen > 0) || last_redraw_point >= 2 || long_field || doublescan < 0) {
if (lof_changed || interlace_seen <= 0 || (currprefs.gfx_iscanlines && interlace_seen > 0) || last_redraw_point >= 2 || long_field || doublescan < 0) {
last_redraw_point = 0;
if (framecnt == 0)
@ -3186,25 +3197,23 @@ void hsync_record_line_state (int lineno, enum nln_how how, int changed)
|| state[1] == LINE_AS_PREVIOUS)
state[1] = LINE_DECIDED; //LINE_BLACK;
break;
case nln_lower_black_always:
state[1] = LINE_BLACK;
*state = LINE_DECIDED;
break;
case nln_lower_black:
if (currprefs.gfx_scanlines >= 4) {
state[1] = LINE_BLACK;
*state = LINE_DECIDED;
} else {
changed += state[0] != LINE_DONE;
state[1] = LINE_DONE;
*state = changed ? LINE_DECIDED : LINE_DONE;
}
changed += state[0] != LINE_DONE;
state[1] = LINE_DONE;
*state = changed ? LINE_DECIDED : LINE_DONE;
break;
case nln_upper_black_always:
*state = LINE_DECIDED;
state[-1] = LINE_BLACK;
break;
case nln_upper_black:
if (currprefs.gfx_scanlines >= 4) {
*state = LINE_DECIDED;
state[-1] = LINE_BLACK;
} else {
changed += state[0] != LINE_DONE;
*state = changed ? LINE_DECIDED : LINE_DONE;
state[-1] = LINE_DONE;
}
changed += state[0] != LINE_DONE;
*state = changed ? LINE_DECIDED : LINE_DONE;
state[-1] = LINE_DONE;
break;
}
}

View File

@ -433,7 +433,7 @@ static uae_u32 REGPARAM2 chipmem_lget2 (uaecptr addr)
if (ISILLEGAL_LONG (addr))
{
enforcer_display_hit (_T("LONG READ from"),m68k_getpc(),addr);
enforcer_display_hit (_T("LONG READ from"), m68k_getpc (), addr);
if (enforcermode & 1)
set_special (SPCFLAG_TRAP);
}
@ -450,7 +450,7 @@ static uae_u32 REGPARAM2 chipmem_wget2(uaecptr addr)
if (ISILLEGAL_WORD (addr))
{
enforcer_display_hit (_T("WORD READ from"),m68k_getpc(),addr);
enforcer_display_hit (_T("WORD READ from"), m68k_getpc (), addr);
if (enforcermode & 1)
set_special (SPCFLAG_TRAP);
}
@ -464,7 +464,7 @@ static uae_u32 REGPARAM2 chipmem_bget2 (uaecptr addr)
if (ISILLEGAL_BYTE (addr))
{
enforcer_display_hit (_T("BYTE READ from"),m68k_getpc(),addr);
enforcer_display_hit (_T("BYTE READ from"), m68k_getpc (), addr);
if (enforcermode & 1)
set_special (SPCFLAG_TRAP);
}
@ -482,7 +482,7 @@ static void REGPARAM2 chipmem_lput2 (uaecptr addr, uae_u32 l)
if (ISILLEGAL_LONG (addr))
{
enforcer_display_hit (_T("LONG WRITE to"),m68k_getpc(),addr);
enforcer_display_hit (_T("LONG WRITE to"), m68k_getpc (), addr);
if (enforcermode & 1)
if (addr != 0x100)
set_special (SPCFLAG_TRAP);
@ -502,7 +502,7 @@ static void REGPARAM2 chipmem_wput2 (uaecptr addr, uae_u32 w)
if (ISILLEGAL_WORD (addr))
{
enforcer_display_hit (_T("WORD WRITE to"),m68k_getpc(),addr);
enforcer_display_hit (_T("WORD WRITE to"), m68k_getpc (), addr);
if (enforcermode & 1)
set_special (SPCFLAG_TRAP);
}
@ -518,7 +518,7 @@ static void REGPARAM2 chipmem_bput2 (uaecptr addr, uae_u32 b)
if (ISILLEGAL_BYTE (addr))
{
enforcer_display_hit (_T("BYTE WRITE to"),m68k_getpc(),addr);
enforcer_display_hit (_T("BYTE WRITE to"), m68k_getpc (), addr);
if (enforcermode & 1)
set_special (SPCFLAG_TRAP);
}
@ -544,7 +544,7 @@ static uae_u8 * REGPARAM2 chipmem_xlate2 (uaecptr addr)
static uae_u32 REGPARAM2 dummy_lget2 (uaecptr addr)
{
special_mem_r;
enforcer_display_hit (_T("LONG READ from"),m68k_getpc(), addr);
enforcer_display_hit (_T("LONG READ from"), m68k_getpc (), addr);
if (enforcermode & 1) {
set_special (SPCFLAG_TRAP);
return 0;
@ -564,12 +564,12 @@ static uae_u32 REGPARAM2 dummy_wget2 (uaecptr addr)
if (addr >= 0x00F10000 && addr <= 0x00F7FFFF) {
if (!warned_JIT_0xF10000) {
warned_JIT_0xF10000 = 1;
enforcer_display_hit (_T("LONG READ from"),m68k_getpc(),addr);
enforcer_display_hit (_T("LONG READ from"), m68k_getpc (), addr);
}
return 0;
}
#endif
enforcer_display_hit (_T("WORD READ from"),m68k_getpc(),addr);
enforcer_display_hit (_T("WORD READ from"), m68k_getpc (), addr);
if (enforcermode & 1) {
set_special (SPCFLAG_TRAP);
return 0;
@ -580,7 +580,7 @@ static uae_u32 REGPARAM2 dummy_wget2 (uaecptr addr)
static uae_u32 REGPARAM2 dummy_bget2 (uaecptr addr)
{
special_mem_r;
enforcer_display_hit (_T("BYTE READ from"),m68k_getpc(),addr);
enforcer_display_hit (_T("BYTE READ from"), m68k_getpc (), addr);
if (enforcermode & 1) {
set_special (SPCFLAG_TRAP);
return 0;
@ -591,7 +591,7 @@ static uae_u32 REGPARAM2 dummy_bget2 (uaecptr addr)
static void REGPARAM2 dummy_lput2 (uaecptr addr, uae_u32 l)
{
special_mem_w;
enforcer_display_hit (_T("LONG WRITE to"),m68k_getpc(),addr);
enforcer_display_hit (_T("LONG WRITE to"), m68k_getpc (), addr);
if (enforcermode & 1) {
set_special (SPCFLAG_TRAP);
return;
@ -601,7 +601,7 @@ static void REGPARAM2 dummy_lput2 (uaecptr addr, uae_u32 l)
static void REGPARAM2 dummy_wput2 (uaecptr addr, uae_u32 w)
{
special_mem_w;
enforcer_display_hit (_T("WORD WRITE to"),m68k_getpc(),addr);
enforcer_display_hit (_T("WORD WRITE to"), m68k_getpc (), addr);
if (enforcermode & 1) {
set_special (SPCFLAG_TRAP);
return;
@ -611,7 +611,7 @@ static void REGPARAM2 dummy_wput2 (uaecptr addr, uae_u32 w)
static void REGPARAM2 dummy_bput2 (uaecptr addr, uae_u32 b)
{
special_mem_w;
enforcer_display_hit (_T("BYTE WRITE to"),m68k_getpc(),addr);
enforcer_display_hit (_T("BYTE WRITE to"), m68k_getpc (), addr);
if (enforcermode & 1) {
set_special (SPCFLAG_TRAP);
return;
@ -622,7 +622,7 @@ static void REGPARAM2 dummy_bput2 (uaecptr addr, uae_u32 b)
static int REGPARAM2 dummy_check2 (uaecptr addr, uae_u32 size)
{
special_mem_r;
enforcer_display_hit (_T("CHECK from "),m68k_getpc(),addr);
enforcer_display_hit (_T("CHECK from "), m68k_getpc (), addr);
return 0;
}
#endif //0

934
src/fpp.c

File diff suppressed because it is too large Load Diff

View File

@ -5033,12 +5033,15 @@ static void gen_opcode (unsigned long int opcode)
printf ("\tuae_u32 v[4];\n");
genamode (curi, curi->smode, "srcreg", curi->size, "mems", 0, 2, 0);
genamode (curi, curi->dmode, "dstreg", curi->size, "memd", 0, 2, 0);
printf ("\tmemsa &= ~15;\n");
printf ("\tmemda &= ~15;\n");
if (using_mmu >= 68040) {
if (using_mmu == 68040) {
printf ("\tget_move16_mmu (memsa, mmu040_move16);\n");
printf ("\tput_move16_mmu (memda, mmu040_move16);\n");
} else if (using_mmu == 68060) {
printf ("\tget_move16_mmu (memsa, v);\n");
printf ("\tput_move16_mmu (memda, v);\n");
} else {
printf ("\tmemsa &= ~15;\n");
printf ("\tmemda &= ~15;\n");
printf ("\tv[0] = %s (memsa);\n", srcl);
printf ("\tv[1] = %s (memsa + 4);\n", srcl);
printf ("\tv[2] = %s (memsa + 8);\n", srcl);

View File

@ -30,6 +30,8 @@
#include "gui.h"
#include "picasso96.h"
#define MAX_COLOR_MODES 5
#define SCODE_CB_UP 103 /* Cursor key block. */
#define SCODE_CB_LEFT 105
#define SCODE_CB_RIGHT 106

View File

@ -160,7 +160,7 @@ static void video_calc_gammatable (void)
con = ((float)(currprefs.gfx_contrast + 1000)) / 1000.0f;
gam = ((float)(1000 - currprefs.gfx_gamma)) / 1000.0f;
lf = 64 * currprefs.gfx_filter_blur / 1000;
lf = 64 * currprefs.gf[picasso_on].gfx_filter_blur / 1000;
hf = 256 - lf * 2;
for (i = 0; i < (256 * 3); i++) {
@ -181,7 +181,7 @@ static void video_calc_gammatable (void)
#if 0
static uae_u32 limit256 (double v)
{
v = v * (double)(currprefs.gfx_filter_contrast + 1000) / 1000.0 + currprefs.gfx_filter_luminance / 10.0;
v = v * (double)(currprefs.gf[picasso_on].gfx_filter_contrast + 1000) / 1000.0 + currprefs.gf[picasso_on].gfx_filter_luminance / 10.0;
if (v < 0)
v = 0;
if (v > 255)
@ -190,7 +190,7 @@ static uae_u32 limit256 (double v)
}
static uae_u32 limit256rb (double v)
{
v *= (double)(currprefs.gfx_filter_saturation + 1000) / 1000.0;
v *= (double)(currprefs.gf[picasso_on].gfx_filter_saturation + 1000) / 1000.0;
if (v < -128)
v = -128;
if (v > 127)

View File

@ -1014,7 +1014,7 @@ static BOOL wasFullscreen = NO; // used by ensureNotFullscreen() and restoreFull
}
if (menuAction == @selector(changeGfxLineMode:)) {
v = changed_prefs.gfx_scanlines;
v = changed_prefs.gfx_iscanlines;
if (v == tag) [menuItem setState:NSOnState];
else [menuItem setState:NSOffState];
}
@ -1780,7 +1780,7 @@ static BOOL wasFullscreen = NO; // used by ensureNotFullscreen() and restoreFull
// gfx - line mode
- (void)changeGfxLineMode:(id)sender
{
changed_prefs.gfx_scanlines = [((NSMenuItem*)sender) tag];
changed_prefs.gfx_iscanlines = [((NSMenuItem*)sender) tag];
config_changed = 1;
}

View File

@ -188,8 +188,8 @@ void gui_exit (void){
void gui_display (int shortcut){
// void* stor = display ? malloc(display->h * display->pitch) : 0;
// if(stor) memcpy(stor, display->pixels, display->h * display->pitch);
void* stor = display ? malloc(display->h * display->pitch) : 0;
if (stor) memcpy(stor, display->pixels, display->h * display->pitch);
if (tmpSDLScreen == NULL) {
tmpSDLScreen = SDL_DisplayFormat(display);
@ -431,11 +431,11 @@ void gui_display (int shortcut){
SDL_Delay(20);
} //while done
// if(stor) {
// memcpy(display->pixels, stor, display->h * display->pitch);
// free(stor);
if (stor) {
memcpy(display->pixels, stor, display->h * display->pitch);
free(stor);
SDL_Flip(display);
// }
}
SDL_EnableKeyRepeat(0, 0); /* disable keyrepeat again */
// return menu_exitcode;
@ -444,12 +444,12 @@ void gui_display (int shortcut){
void write_text (int x, int y, const char* txt) {
char txtbuf[45];
size_t l = strlen(txt);
if(l > 44) {
memcpy(txtbuf, txt, 20);
memcpy(txtbuf + 20, "...", 3);
memcpy(txtbuf + 23, txt + l - 20, 21);
if (l > 44) {
memcpy (txtbuf, txt, 20);
memcpy (txtbuf + 20, "...", 3);
memcpy (txtbuf + 23, txt + l - 20, 21);
} else {
strcpy(txtbuf, txt);
strcpy (txtbuf, txt);
}
SDL_Surface* pText_Surface = TTF_RenderText_Solid(amiga_font, txtbuf, text_color);
@ -459,7 +459,7 @@ void write_text (int x, int y, const char* txt) {
rect.h = pText_Surface->h;
SDL_BlitSurface (pText_Surface,NULL,tmpSDLScreen,&rect);
SDL_FreeSurface(pText_Surface);
SDL_FreeSurface (pText_Surface);
}
void blit_image (SDL_Surface* img, int x, int y) {
@ -496,6 +496,25 @@ void gui_flicker_led (int led, int unitnum, int status)
void gui_led (int led, int on)
{
if (led >= LED_DF0 && led <= LED_DF3) {
//_stprintf (ptr , _T("%02d"), gui_data.drive_track[led - 1]);
} else if (led == LED_POWER) {
} else if (led == LED_HD) {
} else if (led == LED_CD) {
} else if (led == LED_FPS) {
/*double fps = (double)gui_data.fps / 10.0;
extern double p96vblank;
if (fps > 999.9)
fps = 999.9;
if (picasso_on)
_stprintf (ptr, _T("%.1f [%.1f]"), p96vblank, fps);
else
_stprintf (ptr, _T("FPS: %.1f"), fps);*/
} else if (led == LED_CPU) {
//_stprintf (ptr, _T("CPU: %.0f%%"), (double)((gui_data.idle) / 10.0));
} else if (led == LED_SND && gui_data.drive_disabled[3]) {
} else if (led == LED_MD) {
}
}
void gui_filename (int num, const char *name)

View File

@ -47,6 +47,7 @@ extern int mmu060_state;
extern int mmu040_movem;
extern uaecptr mmu040_movem_ea;
extern uae_u32 mmu040_move16[4];
extern bool mmu_pagesize_8k;
extern uae_u16 mmu_opcode;
@ -384,20 +385,8 @@ static ALWAYS_INLINE uaecptr mmu_get_real_address(uaecptr addr, struct mmu_atc_l
return cl->phys | (addr & mmu_pagemask);
}
static ALWAYS_INLINE void mmu_get_move16(uaecptr addr, uae_u32 *v, bool data, int size)
{
struct mmu_atc_line *cl;
for (int i = 0; i < 4; i++) {
uaecptr addr2 = addr + i * 4;
// addr,super,data
if ((!regs.mmu_enabled) || (mmu_match_ttr(addr2,regs.s != 0,data,false)!=TTR_NO_MATCH))
v[i] = phys_get_long(addr2);
else if (likely(mmu_lookup(addr2, data, false, &cl)))
v[i] = phys_get_long(mmu_get_real_address(addr2, cl));
else
v[i] = mmu_get_long_slow(addr2, regs.s != 0, data, size, false, cl);
}
}
extern void mmu_get_move16(uaecptr addr, uae_u32 *v, bool data, int size);
extern void mmu_put_move16(uaecptr addr, uae_u32 *val, bool data, int size);
static ALWAYS_INLINE uae_u32 mmu_get_long(uaecptr addr, bool data, int size, bool rmw)
{
@ -450,21 +439,6 @@ static ALWAYS_INLINE void mmu_put_long(uaecptr addr, uae_u32 val, bool data, int
mmu_put_long_slow(addr, val, regs.s != 0, data, size, rmw, cl);
}
static ALWAYS_INLINE void mmu_put_move16(uaecptr addr, uae_u32 *val, bool data, int size)
{
struct mmu_atc_line *cl;
for (int i = 0; i < 4; i++) {
uaecptr addr2 = addr + i * 4;
// addr,super,data
if ((!regs.mmu_enabled) || (mmu_match_ttr_write(addr2,regs.s != 0,data,val[i],size,false)==TTR_OK_MATCH))
phys_put_long(addr2,val[i]);
else if (likely(mmu_lookup(addr2, data, true, &cl)))
phys_put_long(mmu_get_real_address(addr2, cl), val[i]);
else
mmu_put_long_slow(addr2, val[i], regs.s != 0, data, size, false, cl);
}
}
static ALWAYS_INLINE void mmu_put_word(uaecptr addr, uae_u16 val, bool data, int size, bool rmw)
{
struct mmu_atc_line *cl;

View File

@ -266,7 +266,9 @@ enum nln_how {
/* This line normal, next one black. */
nln_nblack,
nln_upper_black,
nln_lower_black
nln_lower_black,
nln_upper_black_always,
nln_lower_black_always
};
extern void hsync_record_line_state (int lineno, enum nln_how, int changed);
@ -308,4 +310,3 @@ STATIC_INLINE void toggle_inhibit_frame (int bit)
inhibit_frame ^= 1 << bit;
}

View File

@ -6,6 +6,7 @@
* Conversion routines for hosts with unknown floating point format.
*
* Copyright 1996 Herman ten Brugge
* Modified 2005 Peter Keunecke
*/
#define FPCR_ROUNDING_MODE 0x00000030
@ -19,49 +20,63 @@
#define FPCR_PRECISION_DOUBLE 0x00000080
#define FPCR_PRECISION_EXTENDED 0x00000000
static double twoto32 = 4294967296.0;
#ifndef HAVE_to_single
#define HAVE_to_single
STATIC_INLINE double to_single (uae_u32 value)
{
double frac;
union {
float f;
uae_u32 u;
} val;
if ((value & 0x7fffffff) == 0)
return (0.0);
frac = (double) ((value & 0x7fffff) | 0x800000) / 8388608.0;
if (value & 0x80000000)
frac = -frac;
return (ldexp (frac, ((value >> 23) & 0xff) - 127));
val.u = value;
return val.f;
}
#endif
#ifndef HAVE_from_single
#define HAVE_from_single
STATIC_INLINE uae_u32 from_single (double src)
{
int expon;
uae_u32 tmp;
double frac;
union {
float f;
uae_u32 u;
} val;
if (src == 0.0)
return 0;
if (src < 0) {
tmp = 0x80000000;
src = -src;
} else {
tmp = 0;
}
frac = frexp (src, &expon);
frac += 0.5 / 16777216.0;
if (frac >= 1.0) {
frac /= 2.0;
expon++;
}
return (tmp | (((expon + 127 - 1) & 0xff) << 23) |
(((int) (frac * 16777216.0)) & 0x7fffff));
val.f = (float) src;
return val.u;
}
#endif
#ifndef HAVE_to_double
#define HAVE_to_double
STATIC_INLINE double to_double(uae_u32 wrd1, uae_u32 wrd2)
{
union {
double d;
uae_u32 u[2];
} val;
val.u[0] = wrd2; // little endian
val.u[1] = wrd1;
return val.d;
}
#endif
#ifndef HAVE_from_double
#define HAVE_from_double
STATIC_INLINE void from_double(double src, uae_u32 * wrd1, uae_u32 * wrd2)
{
uae_u32 *longarray = (uae_u32 *)&src;
*wrd1 = longarray[1]; // little endian
*wrd2 = longarray[0];
}
#endif
static const double twoto32 = 4294967296.0;
#ifndef HAVE_to_exten
#define HAVE_to_exten
STATIC_INLINE void to_exten(fpdata *fpd, uae_u32 wrd1, uae_u32 wrd2, uae_u32 wrd3)
{
double frac;
@ -78,16 +93,17 @@ STATIC_INLINE void to_exten(fpdata *fpd, uae_u32 wrd1, uae_u32 wrd2, uae_u32 wrd
frac = ((double)wrd2 + ((double)wrd3 / twoto32)) / 2147483648.0;
if (wrd1 & 0x80000000)
frac = -frac;
fpd->fp = ldexp (frac, ((wrd1 >> 16) & 0x7fff) - 16383);
}
#endif
#ifndef HAVE_from_exten
#define HAVE_from_exten
STATIC_INLINE void from_exten(fpdata *fpd, uae_u32 * wrd1, uae_u32 * wrd2, uae_u32 * wrd3)
{
int expon;
double frac;
fptype v;
#ifdef USE_SOFT_LONG_DOUBLE
if (fpd->fpx) {
@ -97,20 +113,21 @@ STATIC_INLINE void from_exten(fpdata *fpd, uae_u32 * wrd1, uae_u32 * wrd2, uae_u
} else
#endif
{
if (fpd->fp == 0.0) {
v = fpd->fp;
if (v == 0.0) {
*wrd1 = 0;
*wrd2 = 0;
*wrd3 = 0;
return;
}
if (fpd->fp < 0) {
if (v < 0) {
*wrd1 = 0x80000000;
fpd->fp = -fpd->fp;
v = -v;
} else {
*wrd1 = 0;
}
frac = frexp (fpd->fp, &expon);
frac= 0.5 / (twoto32 * twoto32);
frac = frexp (v, &expon);
frac += 0.5 / (twoto32 * twoto32);
if (frac >= 1.0) {
frac /= 2.0;
expon++;
@ -121,48 +138,3 @@ STATIC_INLINE void from_exten(fpdata *fpd, uae_u32 * wrd1, uae_u32 * wrd2, uae_u
}
}
#endif
#ifndef HAVE_to_double
STATIC_INLINE double to_double(uae_u32 wrd1, uae_u32 wrd2)
{
double frac;
if ((wrd1 & 0x7fffffff) == 0 && wrd2 == 0)
return 0.0;
frac = (double) ((wrd1 & 0xfffff) | 0x100000) / 1048576.0 +
(double) wrd2 / 4503599627370496.0;
if (wrd1 & 0x80000000)
frac = -frac;
return ldexp (frac, ((wrd1 >> 20) & 0x7ff) - 1023);
}
#endif
#ifndef HAVE_from_double
STATIC_INLINE void from_double(double src, uae_u32 * wrd1, uae_u32 * wrd2)
{
int expon;
int tmp;
double frac;
if (src == 0.0) {
*wrd1 = 0;
*wrd2 = 0;
return;
}
if (src < 0) {
*wrd1 = 0x80000000;
src = -src;
} else {
*wrd1 = 0;
}
frac = frexp (src, &expon);
frac += 0.5 / 9007199254740992.0;
if (frac >= 1.0) {
frac /= 2.0;
expon++;
}
tmp = (uae_u32) (frac * 2097152.0);
*wrd1 |= (((expon + 1023 - 1) & 0x7ff) << 20) | (tmp & 0xfffff);
*wrd2 = (uae_u32) (frac * 9007199254740992.0 - tmp * 4294967296.0);
}
#endif

View File

@ -56,13 +56,13 @@ typedef int m68k_exception;
#define MMU_FSLW_LK 0x02000000
#define MMU_FSLW_R 0x01000000
#define MMU_FSLW_W 0x00800000
#define MMU_FSLW_SIZE_L 0x00000000 /* Note: wrong in mc68060 manual! */
#define MMU_FSLW_SIZE_B 0x00200000
#define MMU_FSLW_SIZE_W 0x00400000
#define MMU_FSLW_SIZE_D 0x00600000
#define MMU_FSLW_SIZE_L 0x00000000 /* Note: wrong in mc68060 manual! */
#define MMU_FSLW_SIZE_B 0x00200000
#define MMU_FSLW_SIZE_W 0x00400000
#define MMU_FSLW_SIZE_D 0x00600000
#define MMU_FSLW_TT 0x00180000
#define MMU_FSLW_TT_N 0x00000000 /* Normal access */
#define MMU_FSLW_TT_16 0x00080000 /* MOVE16 */
#define MMU_FSLW_TT_N 0x00000000 /* Normal access */
#define MMU_FSLW_TT_16 0x00080000 /* MOVE16 */
#define MMU_FSLW_TM 0x00070000 /* = function code */
#define MMU_FSLW_IO 0x00008000
#define MMU_FSLW_PBE 0x00004000
@ -85,9 +85,10 @@ typedef int m68k_exception;
#define MMU_SSW_TT1 0x0010
#define MMU_SSW_TT0 0x0008
#define MMU_SSW_SIZE 0x0060
#define MMU_SSW_SIZE_B 0x0020
#define MMU_SSW_SIZE_W 0x0040
#define MMU_SSW_SIZE_L 0x0000
#define MMU_SSW_SIZE_B 0x0020
#define MMU_SSW_SIZE_W 0x0040
#define MMU_SSW_SIZE_L 0x0000
#define MMU_SSW_SIZE_CL 0x0060
#define MMU_SSW_RW 0x0100
#define MMU_SSW_LK 0x0200
#define MMU_SSW_ATC 0x0400

View File

@ -71,10 +71,6 @@ extern void REGPARAM3 op_unimpl (uae_u16) REGPARAM;
typedef uae_u8 flagtype;
#ifdef FPUEMU
/* You can set this to long double to be more accurate. However, the
resulting alignment issues will cost a lot of performance in some
apps */
#define USE_LONG_DOUBLE 0
#if USE_LONG_DOUBLE
typedef long double fptype;
@ -171,9 +167,13 @@ struct regstruct
#ifdef FPUEMU
fpdata fp[8];
fpdata fp_result;
uae_u32 fp_result_status;
uae_u32 fpcr, fpsr, fpiar;
uae_u32 fpsr_highbyte;
uae_u32 fpu_state;
uae_u32 fpu_exp_state;
fpdata exp_src1, exp_src2;
uae_u32 exp_pack[3];
uae_u16 exp_opcode, exp_extra, exp_type;
bool fp_exception;
#endif
#ifndef CPUEMU_68000_ONLY
@ -183,8 +183,9 @@ struct regstruct
uae_u32 mmu_fslw;
uae_u32 mmu_fault_addr, mmu_effective_addr;
uae_u16 mmu_ssw;
uae_u32 wb2_address;
uae_u32 wb3_data;
uae_u16 wb3_status;
uae_u8 wb3_status, wb2_status;
int mmu_enabled;
int mmu_page_size;
#endif

View File

@ -268,6 +268,31 @@ struct apmode
#ifndef HAS_UAE_PREFS_STRUCT
# define HAS_UAE_PREFS_STRUCT 1
#endif // HAS_UAEPREFS_STRUCT
struct gfx_filterdata
{
int gfx_filter;
TCHAR gfx_filtershader[2 * MAX_FILTERSHADERS + 1][MAX_DPATH];
TCHAR gfx_filtermask[2 * MAX_FILTERSHADERS + 1][MAX_DPATH];
TCHAR gfx_filteroverlay[MAX_DPATH];
struct wh gfx_filteroverlay_pos;
int gfx_filteroverlay_overscan;
int gfx_filter_scanlines;
int gfx_filter_scanlineratio;
int gfx_filter_scanlinelevel;
float gfx_filter_horiz_zoom, gfx_filter_vert_zoom;
float gfx_filter_horiz_zoom_mult, gfx_filter_vert_zoom_mult;
float gfx_filter_horiz_offset, gfx_filter_vert_offset;
int gfx_filter_filtermode;
int gfx_filter_bilinear;
int gfx_filter_noise, gfx_filter_blur;
int gfx_filter_saturation, gfx_filter_luminance, gfx_filter_contrast, gfx_filter_gamma;
int gfx_filter_keep_aspect, gfx_filter_aspect;
int gfx_filter_autoscale;
int gfx_filter_keep_autoscale_aspect;
};
struct uae_prefs {
struct strlist *all_lines;
@ -354,7 +379,7 @@ struct uae_prefs {
int gfx_resolution;
int gfx_vresolution;
int gfx_lores_mode;
int gfx_scanlines;
int gfx_pscanlines, gfx_iscanlines;
int gfx_xcenter, gfx_ycenter;
int gfx_xcenter_pos, gfx_ycenter_pos;
int gfx_xcenter_size, gfx_ycenter_size;
@ -366,25 +391,7 @@ struct uae_prefs {
int gfx_extrawidth;
bool lightboost_strobo;
int gfx_filter;
TCHAR gfx_filtershader[2 * MAX_FILTERSHADERS + 1][MAX_DPATH];
TCHAR gfx_filtermask[2 * MAX_FILTERSHADERS + 1][MAX_DPATH];
TCHAR gfx_filteroverlay[MAX_DPATH];
struct wh gfx_filteroverlay_pos;
int gfx_filteroverlay_overscan;
int gfx_filter_scanlines;
int gfx_filter_scanlineratio;
int gfx_filter_scanlinelevel;
float gfx_filter_horiz_zoom, gfx_filter_vert_zoom;
float gfx_filter_horiz_zoom_mult, gfx_filter_vert_zoom_mult;
float gfx_filter_horiz_offset, gfx_filter_vert_offset;
int gfx_filter_filtermode;
int gfx_filter_bilinear;
int gfx_filter_noise, gfx_filter_blur;
int gfx_filter_saturation, gfx_filter_luminance, gfx_filter_contrast, gfx_filter_gamma;
int gfx_filter_keep_aspect, gfx_filter_aspect;
int gfx_filter_autoscale;
int gfx_filter_keep_autoscale_aspect;
struct gfx_filterdata gf[2];
float rtg_horiz_zoom_mult;
float rtg_vert_zoom_mult;
@ -603,6 +610,7 @@ struct uae_prefs {
int input_autofire_linecnt;
int input_mouse_speed;
int input_tablet;
bool tablet_library;
bool input_magic_mouse;
int input_magic_mouse_cursor;
int input_keyboard_type;
@ -675,6 +683,7 @@ 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);
extern int cfgfile_searchconfig(const TCHAR *in, int index, TCHAR *out, int outsize);
extern uae_u32 cfgfile_uaelib (int mode, uae_u32 name, uae_u32 dst, uae_u32 maxlen);
extern uae_u32 cfgfile_uaelib_modify (uae_u32 mode, uae_u32 parms, uae_u32 size, uae_u32 out, uae_u32 outsize);
extern uae_u32 cfgfile_modify (uae_u32 index, TCHAR *parms, uae_u32 size, TCHAR *out, uae_u32 outsize);
@ -704,85 +713,6 @@ extern void machdep_free (void);
#define __unix
#endif
#define MAX_COLOR_MODES 5
/* #define NEED_TO_DEBUG_BADLY */
#if !defined(USER_PROGRAMS_BEHAVE)
#define USER_PROGRAMS_BEHAVE 0
#endif
/* Some memsets which know that they can safely overwrite some more memory
* at both ends and use that knowledge to align the pointers. */
#define QUADRUPLIFY(c) (((c) | ((c) << 8)) | (((c) | ((c) << 8)) << 16))
/* When you call this routine, bear in mind that it rounds the bounds and
* may need some padding for the array. */
#define fuzzy_memset(p, c, o, l) fuzzy_memset_1 ((p), QUADRUPLIFY (c), (o) & ~3, ((l) + 4) >> 2)
STATIC_INLINE void fuzzy_memset_1 (void *p, uae_u32 c, int offset, int len)
{
uae_u32 *p2 = (uae_u32 *)((TCHAR *)p + offset);
int a = len & 7;
len >>= 3;
switch (a) {
case 7: p2--; goto l1;
case 6: p2-=2; goto l2;
case 5: p2-=3; goto l3;
case 4: p2-=4; goto l4;
case 3: p2-=5; goto l5;
case 2: p2-=6; goto l6;
case 1: p2-=7; goto l7;
case 0: if (!--len) return; break;
}
for (;;) {
p2[0] = c;
l1:
p2[1] = c;
l2:
p2[2] = c;
l3:
p2[3] = c;
l4:
p2[4] = c;
l5:
p2[5] = c;
l6:
p2[6] = c;
l7:
p2[7] = c;
if (!len)
break;
len--;
p2 += 8;
}
}
/* This one knows it will never be asked to clear more than 32 bytes. Make sure you call this with a
constant for the length. */
#define fuzzy_memset_le32(p, c, o, l) fuzzy_memset_le32_1 ((p), QUADRUPLIFY (c), (o) & ~3, ((l) + 7) >> 2)
STATIC_INLINE void fuzzy_memset_le32_1 (void *p, uae_u32 c, int offset, int len)
{
uae_u32 *p2 = (uae_u32 *)((TCHAR *)p + offset);
switch (len) {
case 9: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; p2[6] = c; p2[7] = c; p2[8] = c; break;
case 8: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; p2[6] = c; p2[7] = c; break;
case 7: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; p2[6] = c; break;
case 6: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; break;
case 5: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; break;
case 4: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; break;
case 3: p2[0] = c; p2[1] = c; p2[2] = c; break;
case 2: p2[0] = c; p2[1] = c; break;
case 1: p2[0] = c; break;
case 0: break;
default: printf("Hit the programmer.\n"); break;
}
}
#if defined TARGET_AMIGAOS && defined(__GNUC__)
#include "od-amiga/amiga-kludges.h"
#endif

9
src/include/scp.h Normal file
View File

@ -0,0 +1,9 @@
//int scp_open(struct zfile *zf, int drv, int *num_tracks);
void scp_close(int drv);
int scp_loadtrack(
uae_u16 *mfmbuf, uae_u16 *tracktiming, int drv,
int track, int *tracklength, int *multirev,
int *gapoffset, int *nextrev, bool setrev);
void scp_loadrevolution(
uae_u16 *mfmbuf, int drv, uae_u16 *tracktiming,
int *tracklength);

View File

@ -0,0 +1,8 @@
uaecptr tabletlib_startup (uaecptr resaddr);
void tabletlib_install (void);
extern void tabletlib_tablet (int x, int y, int z,
int pressure, uae_u32 buttonbits, int inproximity,
int ax, int ay, int az);
extern void tabletlib_tablet_info (int maxx, int maxy, int maxz, int maxax, int maxay, int maxaz, int xres, int yres);

View File

@ -72,6 +72,9 @@ extern uae_u32 uaerand (void);
// 32 = vsync
int inputdevice_logging = 0;
#ifdef WITH_TABLETLIBRARY
extern int tablet_log;
#endif
#define COMPA_RESERVED_FLAGS ID_FLAG_INVERT
@ -1383,9 +1386,23 @@ void inputdevice_tablet (int x, int y, int z, int pressure, uae_u32 buttonbits,
if (!memcmp (tmp, p + MH_START, MH_END - MH_START))
return;
#ifdef WITH_TABLETLIBRARY
if (tablet_log & 1) {
static int obuttonbits, oinproximity;
if (inproximity != oinproximity || buttonbits != obuttonbits) {
obuttonbits = buttonbits;
oinproximity = inproximity;
write_log (_T("TABLET: B=%08x P=%d\n"), buttonbits, inproximity);
}
}
if (tablet_log & 2) {
write_log (_T("TABLET: X=%d Y=%d Z=%d AX=%d AY=%d AZ=%d\n"), x, y, z, ax, ay, az);
}
#endif // WITH_TABLETLIBRARY
p[MH_E] = 0xc0 | 2;
p[MH_CNT]++;
#endif
#endif // FILESYS
}
void inputdevice_tablet_info (int maxx, int maxy, int maxz, int maxax, int maxay, int maxaz, int xres, int yres)
@ -1417,7 +1434,7 @@ void inputdevice_tablet_info (int maxx, int maxy, int maxz, int maxax, int maxay
p[MH_MAXAY + 1] = maxay;
p[MH_MAXAZ] = maxaz >> 8;
p[MH_MAXAZ + 1] = maxaz;
#endif
#endif // FILESYS
}
@ -1438,7 +1455,7 @@ static void inputdevice_mh_abs (int x, int y, uae_u32 buttonbits)
x -= mouseoffset_x + 1;
y -= mouseoffset_y + 2;
//write_log (_T("%dx%d %08x\n"), x, y, buttonbits);
//write_log (_T("%04dx%04d %08x\n"), x, y, buttonbits);
p[MH_ABSX] = x >> 8;
p[MH_ABSX + 1] = x;
@ -1455,7 +1472,15 @@ static void inputdevice_mh_abs (int x, int y, uae_u32 buttonbits)
p[MH_E] = 0xc0 | 1;
p[MH_CNT]++;
tablet_data = 1;
#endif
#ifdef WITH_TABLETLIBRARY
if (inputdevice_is_tablet () <= 0) {
tabletlib_tablet_info (1000, 1000, 0, 0, 0, 0, 1000, 1000);
tabletlib_tablet (x, y, 0, 0, buttonbits, -1, 0, 0, 0);
}
#endif // WITH_TABLETLIBRARY
#endif // FILESYS
}
#ifdef FILESYS

View File

@ -59,6 +59,7 @@
#include "gfxboard.h"
#include "misc.h"
#include "keyboard.h"
#include "tabletlibrary.h"
#ifdef RETROPLATFORM
#include "rp.h"
#endif
@ -249,14 +250,13 @@ void fixup_prefs_dimensions (struct uae_prefs *prefs)
if (ap->gfx_backbuffers >= 2)
ap->gfx_vflip = -1;
}
}
if (prefs->gfx_filter == 0 && ((prefs->gfx_filter_autoscale && !prefs->gfx_api) || (prefs->gfx_apmode[0].gfx_vsyncmode))) {
prefs->gfx_filter = 1;
}
if (prefs->gfx_filter == 0 && prefs->monitoremu) {
error_log (_T("A2024 and Graffiti require at least null filter enabled."));
prefs->gfx_filter = 1;
if (prefs->gf[i].gfx_filter == 0 && ((prefs->gf[i].gfx_filter_autoscale && !prefs->gfx_api) || (prefs->gfx_apmode[APMODE_NATIVE].gfx_vsyncmode))) {
prefs->gf[i].gfx_filter = 1;
}
if (i == 0 && prefs->gf[i].gfx_filter == 0 && prefs->monitoremu) {
error_log (_T("A2024 and Graffiti require at least null filter enabled."));
prefs->gf[i].gfx_filter = 1;
}
}
}
@ -1065,6 +1065,12 @@ void virtualdevice_init (void)
#if defined (BSDSOCKET)
bsdlib_install ();
#endif
#ifdef WITH_UAENATIVE
uaenative_install ();
#endif
#ifdef WITH_TABLETLIBRARY
tabletlib_install ();
#endif
}
static int real_main2 (int argc, TCHAR **argv)
@ -1144,7 +1150,6 @@ static int real_main2 (int argc, TCHAR **argv)
#endif
fixup_prefs (&currprefs);
#ifdef RETROPLATFORM
rp_fixup_options (&currprefs);
#endif

View File

@ -35,13 +35,10 @@
#include "misc.h"
#include "zfile.h"
#include "gfxboard.h"
#include <sys/mman.h>
extern uae_u8 *natmem_offset, *natmem_offset_end;
#ifdef USE_MAPPED_MEMORY
#include <sys/mman.h>
#endif
bool canbang;
int candirect = -1;
static bool rom_write_enabled;

View File

@ -1303,20 +1303,27 @@ uae_u32 getlocaltime (void)
return 0;
}
/*
#ifndef HAVE_ISINF
int isinf (double x)
{
const int nClass = _fpclass (x);
int result;
if (nClass == _FPCLASS_NINF || nClass == _FPCLASS_PINF)
result = 1;
else
result = 0;
return result;
}
#ifndef isnan
#define isnan(x) \
(sizeof (x) == sizeof (long double) ? isnan_ld (x) \
: sizeof (x) == sizeof (double) ? isnan_d (x) \
: isnan_f (x))
static inline int isnan_f (float x) { return x != x; }
static inline int isnan_d (double x) { return x != x; }
static inline int isnan_ld (long double x) { return x != x; }
#endif
#ifndef isinf
#define isinf(x) \
(sizeof (x) == sizeof (long double) ? isinf_ld (x) \
: sizeof (x) == sizeof (double) ? isinf_d (x) \
: isinf_f (x))
static inline int isinf_f (float x) { return !isnan (x) && isnan (x - x); }
static inline int isinf_d (double x) { return !isnan (x) && isnan (x - x); }
static inline int isinf_ld (long double x) { return !isnan (x) && isnan (x - x); }
#endif
*/
//fsdb_mywin
bool my_issamevolume(const TCHAR *path1, const TCHAR *path2, TCHAR *path)

View File

@ -2075,24 +2075,37 @@ static void Exception_build_stack_frame (uae_u32 oldpc, uae_u32 currpc, uae_u32
x_put_long (m68k_areg (regs, 7), oldpc);
break;
case 0x7: // access error stack frame (68040)
for (i = 0 ; i < 7 ; i++) {
for (i = 3; i >= 0; i--) {
// WB1D/PD0,PD1,PD2,PD3
m68k_areg (regs, 7) -= 4;
x_put_long (m68k_areg (regs, 7), 0);
}
x_put_long (m68k_areg (regs, 7), mmu040_move16[i]);
}
m68k_areg (regs, 7) -= 4;
x_put_long (m68k_areg (regs, 7), regs.wb3_data);
x_put_long (m68k_areg (regs, 7), 0); // WB1A
m68k_areg (regs, 7) -= 4;
x_put_long (m68k_areg (regs, 7), 0); // WB2D
m68k_areg (regs, 7) -= 4;
x_put_long (m68k_areg (regs, 7), regs.mmu_fault_addr);
x_put_long (m68k_areg (regs, 7), regs.wb2_address); // WB2A
m68k_areg (regs, 7) -= 4;
x_put_long (m68k_areg (regs, 7), regs.wb3_data); // WB3D
m68k_areg (regs, 7) -= 4;
x_put_long (m68k_areg (regs, 7), regs.mmu_fault_addr);
m68k_areg (regs, 7) -= 2;
x_put_long (m68k_areg (regs, 7), regs.mmu_fault_addr); // WB3A
m68k_areg (regs, 7) -= 4;
x_put_long (m68k_areg (regs, 7), regs.mmu_fault_addr); // FA
m68k_areg (regs, 7) -= 2;
x_put_word (m68k_areg (regs, 7), 0);
m68k_areg (regs, 7) -= 2;
x_put_word (m68k_areg (regs, 7), 0);
x_put_word (m68k_areg (regs, 7), regs.wb2_status);
regs.wb2_status = 0;
m68k_areg (regs, 7) -= 2;
x_put_word (m68k_areg (regs, 7), regs.wb3_status);
regs.wb3_status = 0;
m68k_areg (regs, 7) -= 2;
m68k_areg (regs, 7) -= 2;
x_put_word (m68k_areg (regs, 7), ssw);
m68k_areg (regs, 7) -= 4;
x_put_long (m68k_areg (regs, 7), regs.mmu_effective_addr);

View File

@ -6,9 +6,6 @@
* Copyright 1996 Bernd Schmidt
*/
#undef USE_MAPPED_MEMORY
#undef CAN_MAP_MEMORY
#define OS_WITHOUT_MEMORY_MANAGEMENT
#ifndef SAVE_MEMORY

View File

@ -6,9 +6,6 @@
* Copyright 1996 Bernd Schmidt
*/
#undef USE_MAPPED_MEMORY
#undef CAN_MAP_MEMORY
/* Don't need to set execute permission on the
* compiler cache for BeOS. */
#define COMPILER_CACHE_NEEDS_NO_MPROTECT

View File

@ -6,6 +6,3 @@
* Copyright 1996 Bernd Schmidt
*/
#undef USE_MAPPED_MEMORY
#undef CAN_MAP_MEMORY

View File

@ -6,10 +6,3 @@
* Copyright 1996 Bernd Schmidt
*/
#undef USE_MAPPED_MEMORY
#if USER_PROGRAMS_BEHAVE > 0
#define USE_MAPPED_MEMORY
#endif
#define CAN_MAP_MEMORY

View File

@ -6,10 +6,3 @@
* Copyright 1996 Bernd Schmidt
*/
#undef USE_MAPPED_MEMORY
#if USER_PROGRAMS_BEHAVE > 0
#define USE_MAPPED_MEMORY
#endif
#define CAN_MAP_MEMORY

View File

@ -177,6 +177,7 @@ void portio_list_add(PortioList *piolist,
uint32_t addr);
void portio_list_del(PortioList *piolist);
typedef struct IORangeOps IORangeOps;
typedef struct IORange {
@ -193,6 +194,7 @@ struct IORangeOps {
void (*destructor)(IORange *iorange);
};
typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data);
typedef uint32_t (IOPortReadFunc)(void *opaque, uint32_t address);
@ -226,13 +228,12 @@ void qemu_register_reset(QEMUResetHandler *func, void *opaque);
typedef struct CirrusVGAState CirrusVGAState;
typedef void (*cirrus_bitblt_rop_t) (CirrusVGAState *s,
uint8_t * dst, const uint8_t * src,
int dstpitch, int srcpitch,
int bltwidth, int bltheight);
uint8_t * dst, const uint8_t * src,
int dstpitch, int srcpitch,
int bltwidth, int bltheight);
typedef void (*cirrus_fill_t)(CirrusVGAState *s,
uint8_t *dst, int dst_pitch, int width, int height);
struct CirrusVGAState {
VGACommonState vga;

294
src/scp.c Normal file
View File

@ -0,0 +1,294 @@
/*
*
* Support for reading .SCP (Supercard Pro) disk flux dumps.
*
* By Keir Fraser in 2014.
*
* This file is free and unencumbered software released into the public domain.
* For more information, please refer to <http://unlicense.org/>
*/
#include "sysconfig.h"
#include "sysdeps.h"
#include "scp.h"
#include "zfile.h"
#include "gui.h"
#include "uae.h"
#include <stdint.h>
#ifdef __APPLE__
#include "machine/endian.h"
#else
#include "endian.h"
#endif
static uint16_t be16toh(uint16_t v)
{
return (v << 8) | (v >> 8);
}
static uint32_t le32toh(uint32_t v)
{
return v;
}
#ifndef min
#define min(a,b) (((a)<(b))?(a):(b))
#endif
#define MAX_REVS 5
enum pll_mode {
PLL_fixed_clock, /* Fixed clock, snap phase to flux transitions. */
PLL_variable_clock, /* Variable clock, snap phase to flux transitions. */
PLL_authentic /* Variable clock, do not snap phase to flux transition. */
};
struct scpdrive {
struct zfile *zf;
/* Current track number. */
unsigned int track;
/* Raw track data. */
uint16_t *dat;
unsigned int datsz;
unsigned int revs; /* stored disk revolutions */
unsigned int dat_idx; /* current index into dat[] */
unsigned int index_pos; /* next index offset */
unsigned int nr_index;
unsigned int index_off[MAX_REVS]; /* data offsets of each index */
/* Accumulated read latency in nanosecs. */
uint64_t latency;
/* Flux-based streams: Authentic emulation of FDC PLL behaviour? */
enum pll_mode pll_mode;
/* Flux-based streams. */
int flux; /* Nanoseconds to next flux reversal */
int clock, clock_centre; /* Clock base value in nanoseconds */
unsigned int clocked_zeros;
};
static struct scpdrive drive[4];
#define CLOCK_CENTRE 2000 /* 2000ns = 2us */
#define CLOCK_MAX_ADJ 10 /* +/- 10% adjustment */
#define CLOCK_MIN(_c) (((_c) * (100 - CLOCK_MAX_ADJ)) / 100)
#define CLOCK_MAX(_c) (((_c) * (100 + CLOCK_MAX_ADJ)) / 100)
#define SCK_NS_PER_TICK (25u)
int scp_open(struct zfile *zf, int drv, int *num_tracks)
{
struct scpdrive *d = &drive[drv];
uint8_t header[0x10] = { 0 };
scp_close(drv);
zfile_fread(header, sizeof(header), 1, zf);
if (memcmp(header, "SCP", 3) != 0) {
write_log(_T("SCP file header missing\n"));
return 0;
}
if (header[5] == 0) {
write_log(_T("SCP file has invalid revolution count (%u)\n"), header[5]);
return 0;
}
if (header[9] != 0 && header[9] != 16) {
write_log(_T("SCP file has unsupported bit cell time width (%u)\n"),
header[9]);
return 0;
}
d->zf = zf;
d->revs = min((int)header[5], MAX_REVS);
*num_tracks = header[7] + 1;
return 1;
}
void scp_close(int drv)
{
struct scpdrive *d = &drive[drv];
if (!d->revs)
return;
xfree(d->dat);
memset(d, 0, sizeof(*d));
}
int scp_loadtrack(
uae_u16 *mfmbuf, uae_u16 *tracktiming, int drv,
int track, int *tracklength, int *multirev,
int *gapoffset, int *nextrev, bool setrev)
{
struct scpdrive *d = &drive[drv];
uint8_t trk_header[4];
uint32_t longwords[3];
unsigned int rev, trkoffset[MAX_REVS];
uint32_t hdr_offset, tdh_offset;
*multirev = 1;
*gapoffset = -1;
xfree(d->dat);
d->dat = NULL;
d->datsz = 0;
hdr_offset = 0x10 + track*sizeof(uint32_t);
zfile_fseek(d->zf, hdr_offset, SEEK_SET);
zfile_fread(longwords, sizeof(uint32_t), 1, d->zf);
tdh_offset = le32toh(longwords[0]);
zfile_fseek(d->zf, tdh_offset, SEEK_SET);
zfile_fread(trk_header, sizeof(trk_header), 1, d->zf);
if (memcmp(trk_header, "TRK", 3) != 0)
return 0;
if (trk_header[3] != track)
return 0;
for (rev = 0 ; rev < d->revs ; rev++) {
zfile_fread(longwords, sizeof(longwords), 1, d->zf);
trkoffset[rev] = tdh_offset + le32toh(longwords[2]);
d->index_off[rev] = le32toh(longwords[1]);
d->datsz += d->index_off[rev];
}
d->dat = xmalloc(uint16_t, d->datsz * sizeof(d->dat[0]));
d->datsz = 0;
for (rev = 0 ; rev < d->revs ; rev++) {
zfile_fseek(d->zf, trkoffset[rev], SEEK_SET);
zfile_fread(&d->dat[d->datsz],
d->index_off[rev] * sizeof(d->dat[0]), 1,
d->zf);
d->datsz += d->index_off[rev];
d->index_off[rev] = d->datsz;
}
d->track = track;
d->pll_mode = PLL_authentic;
d->dat_idx = 0;
d->index_pos = d->index_off[0];
d->clock = d->clock_centre = CLOCK_CENTRE;
d->nr_index = 0;
d->flux = 0;
d->clocked_zeros = 0;
scp_loadrevolution(mfmbuf, drv, tracktiming, tracklength);
return 1;
}
static int scp_next_flux(struct scpdrive *d)
{
uint32_t val = 0, flux, t;
for (;;) {
if (d->dat_idx >= d->index_pos) {
uint32_t rev = d->nr_index++ % d->revs;
d->index_pos = d->index_off[rev];
d->dat_idx = rev ? d->index_off[rev-1] : 0;
return -1;
}
t = be16toh(d->dat[d->dat_idx++]);
if (t == 0) { /* overflow */
val += 0x10000;
continue;
}
val += t;
break;
}
flux = val * SCK_NS_PER_TICK;
return (int)flux;
}
static int flux_next_bit(struct scpdrive *d)
{
int new_flux;
while (d->flux < (d->clock/2)) {
if ((new_flux = scp_next_flux(d)) == -1)
return -1;
d->flux += new_flux;
d->clocked_zeros = 0;
}
d->latency += d->clock;
d->flux -= d->clock;
if (d->flux >= (d->clock/2)) {
d->clocked_zeros++;
return 0;
}
if (d->pll_mode != PLL_fixed_clock) {
/* PLL: Adjust clock frequency according to phase mismatch. */
if ((d->clocked_zeros >= 1) && (d->clocked_zeros <= 3)) {
/* In sync: adjust base clock by 10% of phase mismatch. */
int diff = d->flux / (int)(d->clocked_zeros + 1);
d->clock += diff / 10;
} else {
/* Out of sync: adjust base clock towards centre. */
d->clock += (d->clock_centre - d->clock) / 10;
}
/* Clamp the clock's adjustment range. */
d->clock = max(CLOCK_MIN(d->clock_centre),
min(CLOCK_MAX(d->clock_centre), d->clock));
} else {
d->clock = d->clock_centre;
}
/* Authentic PLL: Do not snap the timing window to each flux transition. */
new_flux = (d->pll_mode == PLL_authentic) ? d->flux / 2 : 0;
d->latency += d->flux - new_flux;
d->flux = new_flux;
return 1;
}
void scp_loadrevolution(
uae_u16 *mfmbuf, int drv, uae_u16 *tracktiming,
int *tracklength)
{
struct scpdrive *d = &drive[drv];
uint64_t prev_latency;
uint32_t av_latency;
unsigned int i, j;
int b;
d->latency = prev_latency = 0;
for (i = 0; (b = flux_next_bit(d)) != -1; i++) {
if ((i & 15) == 0)
mfmbuf[i>>4] = 0;
if (b)
mfmbuf[i>>4] |= 0x8000u >> (i&15);
if ((i & 7) == 7) {
tracktiming[i>>3] = d->latency - prev_latency;
prev_latency = d->latency;
}
}
if (i & 7)
tracktiming[i>>3] = ((d->latency - prev_latency) * 8) / (i & 7);
av_latency = prev_latency / (i>>3);
for (j = 0; j < (i+7)>>3; j++)
tracktiming[j] = ((uint32_t)tracktiming[j] * 1000u) / av_latency;
*tracklength = i;
}

View File

@ -340,6 +340,9 @@
/* The size of `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* The size of `long double', as computed by sizeof. */
#undef SIZEOF_LONG_DOUBLE
/* The size of `long long', as computed by sizeof. */
#undef SIZEOF_LONG_LONG

239
src/tabletlibrary.c Normal file
View File

@ -0,0 +1,239 @@
/*
* UAE - The Un*x Amiga Emulator
*
* tablet.library
*
*/
#ifdef WITH_TABLETLIBRARY
#include "sysconfig.h"
#include "sysdeps.h"
#include "options.h"
#include "memory.h"
#include "custom.h"
#include "newcpu.h"
#include "traps.h"
#include "autoconf.h"
#include "execlib.h"
#include "tabletlibrary.h"
static uaecptr lib_init, lib_name, lib_id, base;
static uaecptr tablettags;
#define TAGS_SIZE (12 * 4)
static int tablet_x, tablet_y, tablet_resx, tablet_resy;
static int tablet_pressure, tablet_buttonbits, tablet_inproximity;
static int tablet_maxx, tablet_maxy, tablet_maxz;
static int ksversion;
void tabletlib_tablet (int x, int y, int z, int pressure, uae_u32 buttonbits, int inproximity, int ax, int ay, int az)
{
tablet_x = x;
tablet_y = y;
tablet_pressure = pressure;
tablet_buttonbits = buttonbits;
tablet_inproximity = inproximity;
}
void tabletlib_tablet_info (int maxx, int maxy, int maxz, int maxax, int maxay, int maxaz, int xres, int yres)
{
tablet_maxx = maxx;
tablet_maxy = maxy;
tablet_resx = xres;
tablet_resy = yres;
}
static void filltags (uaecptr tabletdata)
{
uaecptr p = tablettags;
if (!p)
return;
put_word (tabletdata + 0, 0);
put_word (tabletdata + 2, 0);
put_long (tabletdata + 4, tablet_x);
put_long (tabletdata + 8, tablet_y);
put_long (tabletdata + 12, tablet_maxx);
put_long (tabletdata + 16, tablet_maxy);
// pressure
put_long (p, 0x8003a000 + 6);
p += 4;
put_long (p, tablet_pressure);
p += 4;
// buttonbits
put_long (p, 0x8003a000 + 7);
p += 4;
put_long (p, tablet_buttonbits);
p += 4;
// resolutionx
put_long (p, 0x8003a000 + 9);
p += 4;
put_long (p, tablet_resx);
p += 4;
// resolutiony
put_long (p, 0x8003a000 + 10);
p += 4;
put_long (p, tablet_resy);
p += 4;
if (tablet_inproximity == 0) {
// inproximity
put_long (p, 0x8003a000 + 8);
p += 4;
put_long (p, 0);
p += 4;
}
put_long (p, 0);
}
static uae_u32 REGPARAM2 lib_initcode (TrapContext *ctx)
{
base = m68k_dreg (regs, 0);
tablettags = base + SIZEOF_LIBRARY;
tablet_inproximity = -1;
tablet_x = tablet_y = 0;
tablet_buttonbits = tablet_pressure = 0;
ksversion = get_word (m68k_areg (regs, 6) + 20);
return base;
}
static uae_u32 REGPARAM2 lib_openfunc (TrapContext *ctx)
{
put_word (m68k_areg (regs, 6) + 32, get_word (m68k_areg (regs, 6) + 32) + 1);
return m68k_areg (regs, 6);
}
static uae_u32 REGPARAM2 lib_closefunc (TrapContext *ctx)
{
put_word (m68k_areg (regs, 6) + 32, get_word (m68k_areg (regs, 6) + 32) - 1);
return 0;
}
static uae_u32 REGPARAM2 lib_expungefunc (TrapContext *context)
{
return 0;
}
static uae_u32 REGPARAM2 lib_allocfunc (TrapContext *context)
{
uae_u32 tags = m68k_areg (regs, 0);
uae_u32 mem;
m68k_dreg (regs, 0) = 24;
m68k_dreg (regs, 1) = 65536 + 1;
mem = CallLib (context, get_long (4), -0xC6); /* AllocMem */
if (!mem)
return 0;
put_long (mem + 20, tablettags);
filltags (mem);
return mem;
}
static uae_u32 REGPARAM2 lib_freefunc (TrapContext *context)
{
m68k_areg (regs, 1) = m68k_areg (regs, 0);
m68k_dreg (regs, 0) = 24;
CallLib(context, get_long (4), -0xD2);
return 0;
}
static uae_u32 REGPARAM2 lib_dofunc (TrapContext *context)
{
uaecptr im = m68k_areg (regs, 0);
uaecptr td = m68k_areg (regs, 1);
filltags (td);
if (ksversion < 39)
return 1;
td = get_long (im + 52);
if (!td)
return 1;
return 1;
}
static uae_u32 REGPARAM2 lib_unkfunc (TrapContext *context)
{
write_log (_T("tablet.library unknown function called\n"));
return 0;
}
uaecptr tabletlib_startup (uaecptr resaddr)
{
if (!currprefs.tablet_library)
return resaddr;
put_word (resaddr + 0x0, 0x4AFC);
put_long (resaddr + 0x2, resaddr);
put_long (resaddr + 0x6, resaddr + 0x1A); /* Continue scan here */
put_word (resaddr + 0xA, 0x8127); /* RTF_AUTOINIT|RTF_COLDSTART; Version 1 */
put_word (resaddr + 0xC, 0x0900); /* NT_LIBRARY; pri 00 */
put_long (resaddr + 0xE, lib_name);
put_long (resaddr + 0x12, lib_id);
put_long (resaddr + 0x16, lib_init);
resaddr += 0x1A;
return resaddr;
}
void tabletlib_install (void)
{
uae_u32 functable, datatable;
uae_u32 initcode, openfunc, closefunc, expungefunc;
uae_u32 allocfunc, freefunc, dofunc, unkfunc;
TCHAR tmp[100];
if (!currprefs.tablet_library)
return;
_stprintf (tmp, _T("UAE tablet.library %d.%d.%d"), UAEMAJOR, UAEMINOR, UAESUBREV);
lib_name = ds (_T("tablet.library"));
lib_id = ds (tmp);
initcode = here ();
calltrap (deftrap (lib_initcode)); dw (RTS);
openfunc = here ();
calltrap (deftrap (lib_openfunc)); dw (RTS);
closefunc = here ();
calltrap (deftrap (lib_closefunc)); dw (RTS);
expungefunc = here ();
calltrap (deftrap (lib_expungefunc)); dw (RTS);
allocfunc = here ();
calltrap (deftrap2 (lib_allocfunc, TRAPFLAG_EXTRA_STACK, _T("tablet_alloc"))); dw (RTS);
freefunc = here ();
calltrap (deftrap2 (lib_freefunc, TRAPFLAG_EXTRA_STACK, _T("tablet_free"))); dw (RTS);
dofunc = here ();
calltrap (deftrap (lib_dofunc)); dw (RTS);
unkfunc = here ();
calltrap (deftrap (lib_unkfunc)); dw (RTS);
/* FuncTable */
functable = here ();
dl (openfunc);
dl (closefunc);
dl (expungefunc);
dl (EXPANSION_nullfunc);
dl (allocfunc);
dl (freefunc);
dl (dofunc);
dl (0xFFFFFFFF); /* end of table */
/* DataTable */
datatable = here ();
dw (0xE000); /* INITBYTE */
dw (0x0008); /* LN_TYPE */
dw (0x0900); /* NT_LIBRARY */
dw (0xC000); /* INITLONG */
dw (0x000A); /* LN_NAME */
dl (lib_name);
dw (0xE000); /* INITBYTE */
dw (0x000E); /* LIB_FLAGS */
dw (0x0600); /* LIBF_SUMUSED | LIBF_CHANGED */
dw (0xD000); /* INITWORD */
dw (0x0027); /* LIB_VERSION */
dw (UAEMAJOR);
dw (0xD000); /* INITWORD */
dw (0x0016); /* LIB_REVISION */
dw (UAEMINOR);
dw (0xC000); /* INITLONG */
dw (0x0018); /* LIB_IDSTRING */
dl (lib_id);
dw (0x0000); /* end of table */
lib_init = here ();
dl (SIZEOF_LIBRARY + TAGS_SIZE); /* size of lib base */
dl (functable);
dl (datatable);
dl (initcode);
}
#endif // WITH_TABLETLIBRARY

View File

@ -25,6 +25,8 @@
#include "memory_uae.h"
#include "audio.h"
#define MAX_COLOR_MODES 5
#define MAX_MENU_HEIGHT 15
#define OPTION_COLUMN 3
#define MENU_COL_OFFSET -2

View File

@ -279,7 +279,7 @@ static bool checkwrite (struct zfile *zf, int *retcode)
static uae_u8 exeheader[]={ 0x00,0x00,0x03,0xf3,0x00,0x00,0x00,0x00 };
static TCHAR *diskimages[] = { _T("adf"), _T("adz"), _T("ipf"), _T("fdi"), _T("dms"), _T("wrp"), _T("dsq"), 0 };
static TCHAR *diskimages[] = { _T("adf"), _T("adz"), _T("ipf"), _T("scp"), _T("fdi"), _T("dms"), _T("wrp"), _T("dsq"), 0 };
int zfile_gettype (struct zfile *z)
{
@ -316,6 +316,16 @@ int zfile_gettype (struct zfile *z)
zfile_fseek (z, -8, SEEK_CUR);
if (!memcmp (buf, exeheader, sizeof (buf)))
return ZFILE_DISKIMAGE;
if (!memcmp (buf, "CAPS", 4))
return ZFILE_DISKIMAGE;
if (!memcmp (buf, "SCP", 3))
return ZFILE_DISKIMAGE;
if (!memcmp (buf, "UAE--ADF", 8))
return ZFILE_DISKIMAGE;
if (!memcmp (buf, "UAE-1ADF", 8))
return ZFILE_DISKIMAGE;
if (!memcmp (buf, "Formatte", 89))
return ZFILE_DISKIMAGE;
if (!memcmp (buf, "RDSK", 4))
return ZFILE_HDFRDB;
if (!memcmp (buf, "DOS", 3)) {
@ -923,7 +933,7 @@ static struct zfile *ipf (struct zfile *z, int index, int *retcode)
for (i = 0; i < tracks; i++) {
uae_u8 *buf, *p;
int mrev, gapo;
caps_loadtrack (mfm, NULL, 0, i, &len, &mrev, &gapo);
caps_loadtrack (mfm, NULL, 0, i, &len, &mrev, &gapo, NULL, true);
//write_log (_T("%d: %d %d %d\n"), i, mrev, gapo, len);
len /= 8;
buf = p = xmalloc (uae_u8, len);
@ -1206,7 +1216,7 @@ end:
const TCHAR *uae_ignoreextensions[] =
{ _T(".gif"), _T(".jpg"), _T(".png"), _T(".xml"), _T(".pdf"), _T(".txt"), 0 };
const TCHAR *uae_diskimageextensions[] =
{ _T(".adf"), _T(".adz"), _T(".ipf"), _T(".fdi"), _T(".exe"), _T(".dms"), _T(".wrp"), _T(".dsq"), 0 };
{ _T(".adf"), _T(".adz"), _T(".ipf"), _T(".scp"), _T(".fdi"), _T(".exe"), _T(".dms"), _T(".wrp"), _T(".dsq"), 0 };
int zfile_is_ignore_ext (const TCHAR *name)
{