Skip to content

Commit

Permalink
Update to version 0.9.32.1-WIP - http://forum.fobby.net/index.php?t=m…
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed Mar 26, 2014
1 parent 0704ba6 commit 51e80d4
Show file tree
Hide file tree
Showing 14 changed files with 299 additions and 109 deletions.
33 changes: 33 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
NOTE: 0.9.32.x is a (mostly) simple-bugfix-backport branch from mainline

-- 0.9.32.1-WIP: --

November 23, 2013:
PCE_FAST: Fixed a potential crash after a garbage/corrupted ROM image is loaded.

PCE, PCE_FAST: Don't generate a command error if a track number too high is specified via CD commands 0xD8 and/or 0xD9; instead,
treat it as if the leadout track was specified. I'm not certain if this is correct behavior as per the actual system, but
that'll have to wait until I'm able to run some tests. Fixes a startup lockup in "Star Mobile".

Lynx: Added emulation of Lynx 2 stereo audio registers, based on patches submitted by "sage".

NES: Reworked some real/floating-point setting's minimum and maximum value strings to try to work around a reported
issue with the settings parsing code.

PCE: During HES playback initialization, the second emulated VDC's registers are now initialized properly so that the
emulation event system isn't overtaxed(which drove up CPU usage considerably during HES playback).

PSX: Improved DualShock emulation accuracy per tests on a DualShock; rumble now works in "Final Fantasy 8", and possibly
other games where rumble was previously non-working.

Reworked how joystick/gamepad rumble is handled on Linux, to perform better and hopefully not cause kernel panics
anymore(or at least not so often as the old code did).

PSX: Removed an unnecessary and borked memset() statement from mdec.cpp.

Added a very simple double-precision floating-point range test to tests.cpp.

Compile with "-fno-aggressive-loop-optimizations", if the option is detected to be supported by the compiler. I don't
particularly trust that new optimization in gcc 4.8.x.


-- 0.9.32-WIP: --

September 12, 2013:
Expand Down
66 changes: 65 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -4336,7 +4336,7 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
#
# Avoid trailing and leading zeroes in the decimal version components to avoid confusing not-so-learned people.
#
MEDNAFEN_VERSION='0.9.32-WIP'
MEDNAFEN_VERSION='0.9.32.1-WIP'
MEDNAFEN_VERSION_NUMERIC=0x000932

ac_aux_dir=
Expand Down Expand Up @@ -23635,6 +23635,70 @@ case ".$var" in
esac


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking OPTIMIZER_FLAGS for gcc -fno-aggressive-loop-optimizations" >&5
$as_echo_n "checking OPTIMIZER_FLAGS for gcc -fno-aggressive-loop-optimizations... " >&6; }
if ${ax_cv_cflags_gcc_option__fno_aggressive_loop_optimizations+:} false; then :
$as_echo_n "(cached) " >&6
else
ax_cv_cflags_gcc_option__fno_aggressive_loop_optimizations="no, unknown"

ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu

ac_save_CFLAGS="$CFLAGS"
for ac_arg in "-pedantic -Werror % -fno-aggressive-loop-optimizations" "-pedantic % -fno-aggressive-loop-optimizations %% no, obsolete" #
do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

int
main ()
{
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ax_cv_cflags_gcc_option__fno_aggressive_loop_optimizations=`echo $ac_arg | sed -e 's,.*% *,,'`; break
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
CFLAGS="$ac_save_CFLAGS"
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu


fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cflags_gcc_option__fno_aggressive_loop_optimizations" >&5
$as_echo "$ax_cv_cflags_gcc_option__fno_aggressive_loop_optimizations" >&6; }
var=$ax_cv_cflags_gcc_option__fno_aggressive_loop_optimizations
case ".$var" in
.ok|.ok,*) ;;
.|.no|.no,*) ;;
*)
if echo " $OPTIMIZER_FLAGS " | grep " $var " 2>&1 >/dev/null
then { { $as_echo "$as_me:${as_lineno-$LINENO}: : OPTIMIZER_FLAGS does contain \$var"; } >&5
(: OPTIMIZER_FLAGS does contain $var) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
else { { $as_echo "$as_me:${as_lineno-$LINENO}: : OPTIMIZER_FLAGS=\"\$OPTIMIZER_FLAGS \$var\""; } >&5
(: OPTIMIZER_FLAGS="$OPTIMIZER_FLAGS $var") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
OPTIMIZER_FLAGS="$OPTIMIZER_FLAGS $var"
fi
;;
esac

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking OPTIMIZER_FLAGS for gcc -fomit-frame-pointer" >&5
$as_echo_n "checking OPTIMIZER_FLAGS for gcc -fomit-frame-pointer... " >&6; }
if ${ax_cv_cflags_gcc_option__fomit_frame_pointer+:} false; then :
Expand Down
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ AC_CONFIG_MACRO_DIR([m4])
#
# Avoid trailing and leading zeroes in the decimal version components to avoid confusing not-so-learned people.
#
MEDNAFEN_VERSION='0.9.32-WIP'
MEDNAFEN_VERSION='0.9.32.1-WIP'
MEDNAFEN_VERSION_NUMERIC=0x000932

AC_CANONICAL_HOST
Expand Down Expand Up @@ -100,6 +100,7 @@ dnl
AX_CFLAGS_GCC_OPTION([-fno-fast-math], OPTIMIZER_FLAGS)
AX_CFLAGS_GCC_OPTION([-fno-unsafe-math-optimizations], OPTIMIZER_FLAGS)

AX_CFLAGS_GCC_OPTION([-fno-aggressive-loop-optimizations], OPTIMIZER_FLAGS)
AX_CFLAGS_GCC_OPTION([-fomit-frame-pointer], OPTIMIZER_FLAGS)
AX_CFLAGS_GCC_OPTION([-finline-limit=6000], OPTIMIZER_FLAGS)
AX_CFLAGS_GCC_OPTION([--param large-function-growth=800], OPTIMIZER_FLAGS)
Expand Down
14 changes: 2 additions & 12 deletions src/cdrom/scsicd-pce-commands.inc
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,8 @@ static void DoNEC_PCE_SAPSP(const uint8 *cdb)

if(!track)
track = 1;
else if(track == toc.last_track + 1)
else if(track >= toc.last_track + 1)
track = 100;
else if(track > toc.last_track)
{
CommandCCError(SENSEKEY_ILLEGAL_REQUEST, NSE_END_OF_VOLUME);
return;
}
new_read_sec_start = toc.tracks[track].lba;
}
break;
Expand Down Expand Up @@ -103,13 +98,8 @@ static void DoNEC_PCE_SAPEP(const uint8 *cdb)

if(!track)
track = 1;
else if(track == toc.last_track + 1)
else if(track >= toc.last_track + 1)
track = 100;
else if(track > toc.last_track)
{
CommandCCError(SENSEKEY_ILLEGAL_REQUEST, NSE_END_OF_VOLUME);
return;
}
new_read_sec_end = toc.tracks[track].lba;
}
break;
Expand Down
46 changes: 7 additions & 39 deletions src/drivers/Joystick_Linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ void Joystick_Linux::InitFF(void)

Joystick_Linux::~Joystick_Linux()
{
if(rumble_supported)
SetRumble(0, 0);

if(jsdev_fd != -1)
{
close(jsdev_fd);
Expand All @@ -259,62 +262,27 @@ Joystick_Linux::~Joystick_Linux()

void Joystick_Linux::SetRumble(uint8 weak_intensity, uint8 strong_intensity)
{
// "Type 0" can cause the rumble motors to be off when they really shouldn't be and can make the rumble effect less stable.
// So we'll go with "type 1", and resolve any possible bug reports on a case-by-case basis.
// (Note that "type 0" and "type 1" have no greater meaning, they're just names I use in Mednafen for the different upload and play strategies here ;))
#define RUMBLIES_UPDATE_TYPE 1

if(rumble_supported)
{
uint32 scaled_weak = weak_intensity * 65535 /*32767*/ / 255;
uint32 scaled_strong = strong_intensity * 65535/*32767*/ / 255;
struct ff_effect old_rumble;
#if RUMBLIES_UPDATE_TYPE == 0
input_event stop_play[2];
#else
uint32 scaled_weak = weak_intensity * (65535 / 255);
uint32 scaled_strong = strong_intensity * (65535 / 255);
input_event play;
#endif

memcpy(&old_rumble, &current_rumble, sizeof(ff_effect));
current_rumble.id = -1;
current_rumble.u.rumble.weak_magnitude = scaled_weak;
current_rumble.u.rumble.strong_magnitude = scaled_strong;

if(ioctl(evdev_fd, EVIOCSFF, &current_rumble) == -1)
{
// Restore.
printf("EEK: %m\n");
memcpy(&current_rumble, &old_rumble, sizeof(ff_effect));
printf("EVIOCSFF failed: %m\n");
return;
}

#if RUMBLIES_UPDATE_TYPE == 0
stop_play[0].type = EV_FF;
stop_play[0].code = old_rumble.id;
stop_play[0].value = 0;

stop_play[1].type = EV_FF;
stop_play[1].code = current_rumble.id;
stop_play[1].value = 1;
memset(&play, 0, sizeof(play));

if(old_rumble.id == -1)
{
write(evdev_fd, (const void *)&stop_play[1], sizeof(stop_play[1]));
}
else
{
write(evdev_fd, (const void *)&stop_play, sizeof(stop_play));
ioctl(evdev_fd, EVIOCRMFF, (void *)(intptr_t)old_rumble.id);
}
#else
play.type = EV_FF;
play.code = current_rumble.id;
play.value = 1;
write(evdev_fd, (const void *)&play, sizeof(play));

if(old_rumble.id != -1)
ioctl(evdev_fd, EVIOCRMFF, (void *)(intptr_t)old_rumble.id);
#endif
}
}

Expand Down
Loading

0 comments on commit 51e80d4

Please sign in to comment.