This commit is contained in:
thrust26 2017-10-17 19:07:28 +02:00
commit 631a8c1567
8 changed files with 27 additions and 14 deletions

View File

@ -53,7 +53,7 @@ CXXFLAGS+= -Wall -Wextra -Wno-unused-parameter -Wno-ignored-qualifiers
ifdef HAVE_GCC ifdef HAVE_GCC
CXXFLAGS+= -Wno-multichar -Wunused -fno-rtti -Woverloaded-virtual -Wnon-virtual-dtor -std=c++14 CXXFLAGS+= -Wno-multichar -Wunused -fno-rtti -Woverloaded-virtual -Wnon-virtual-dtor -std=c++14
endif endif
ifdef HAVE_CLANG ifdef CLANG_WARNINGS
CXXFLAGS+= -Weverything -Wno-c++17-extensions -Wno-c++98-compat -Wno-c++98-compat-pedantic \ CXXFLAGS+= -Weverything -Wno-c++17-extensions -Wno-c++98-compat -Wno-c++98-compat-pedantic \
-Wno-double-promotion -Wno-switch-enum -Wno-conversion -Wno-covered-switch-default \ -Wno-double-promotion -Wno-switch-enum -Wno-conversion -Wno-covered-switch-default \
-Wno-inconsistent-missing-destructor-override \ -Wno-inconsistent-missing-destructor-override \

8
configure vendored
View File

@ -414,12 +414,16 @@ if test "$have_clang" = yes; then
cxx_version="$cxx_version, bad" cxx_version="$cxx_version, bad"
cxx_verc_fail=yes cxx_verc_fail=yes
fi fi
# Only clang >= 5.0 supports extra warnings
if [ $clang_major -ge 5 ]; then
_make_def_CLANG_WARNINGS='CLANG_WARNINGS = 1'
fi
fi fi
CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS"
_make_def_HAVE_GCC3='HAVE_GCC3 = 1' _make_def_HAVE_GCC3='HAVE_GCC3 = 1'
add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP' add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP'
_make_def_HAVE_GCC='HAVE_GCC = 1' _make_def_HAVE_GCC='HAVE_GCC = 1'
_make_def_HAVE_CLANG='HAVE_CLANG = 1'
echo "$cxx_version" echo "$cxx_version"
elif test "$have_gcc" = yes; then elif test "$have_gcc" = yes; then
@ -817,7 +821,7 @@ PROFILE := $_build_profile
$_make_def_HAVE_GCC $_make_def_HAVE_GCC
$_make_def_HAVE_GCC3 $_make_def_HAVE_GCC3
$_make_def_HAVE_CLANG $_make_def_CLANG_WARNINGS
INCLUDES += $INCLUDES INCLUDES += $INCLUDES
OBJS += $OBJS OBJS += $OBJS

View File

@ -28,7 +28,7 @@
#include "StateManager.hxx" #include "StateManager.hxx"
#define STATE_HEADER "05000303state" #define STATE_HEADER "05000304state"
// #define MOVIE_HEADER "03030000movie" // #define MOVIE_HEADER "03030000movie"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -244,7 +244,7 @@ void Console::autodetectYStart()
YStartDetector ystartDetector; YStartDetector ystartDetector;
ystartDetector.setLayout(myDisplayFormat == "PAL" ? FrameLayout::pal : FrameLayout::ntsc); ystartDetector.setLayout(myDisplayFormat == "PAL" ? FrameLayout::pal : FrameLayout::ntsc);
myTIA->setFrameManager(&ystartDetector); myTIA->setFrameManager(&ystartDetector);
mySystem->reset(); mySystem->reset(true);
for (int i = 0; i < 80; i++) myTIA->update(); for (int i = 0; i < 80; i++) myTIA->update();

View File

@ -69,7 +69,7 @@ void PaddleReader::update(double value, double timestamp, ConsoleTiming consoleT
setConsoleTiming(consoleTiming); setConsoleTiming(consoleTiming);
} }
if (value != myValue) { // FIXME - warning on 'no-float-equal' if (value != myValue) {
myValue = value; myValue = value;
if (myValue < 0) { if (myValue < 0) {

View File

@ -162,7 +162,6 @@ void FrameManager::setState(FrameManager::State state)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// TODO: kill this with fire once frame manager refactoring is complete
void FrameManager::onLayoutChange() void FrameManager::onLayoutChange()
{ {
switch (layout()) switch (layout())

View File

@ -18,9 +18,10 @@
#include "JitterEmulation.hxx" #include "JitterEmulation.hxx"
enum Metrics: uInt32 { enum Metrics: uInt32 {
framesForStableHeight = 2, framesForStableHeight = 2,
minDeltaForJitter = 3, framesUntilDestabilization = 10,
maxJitter = 50 minDeltaForJitter = 3,
maxJitter = 50
}; };
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -32,27 +33,32 @@ JitterEmulation::JitterEmulation() :
void JitterEmulation::reset() void JitterEmulation::reset()
{ {
myLastFrameScanlines = 0; myLastFrameScanlines = 0;
myStableFrameFinalLines = 0; myStableFrameFinalLines = -1;
myStableFrames = 0; myStableFrames = 0;
myStabilizationCounter = 0; myStabilizationCounter = 0;
myDestabilizationCounter = 0;
myJitter = 0; myJitter = 0;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void JitterEmulation::frameComplete(uInt32 scanlineCount) void JitterEmulation::frameComplete(uInt32 scanlineCount)
{ {
if (scanlineCount != myStableFrameFinalLines) { if (Int32(scanlineCount) != myStableFrameFinalLines) {
if (myDestabilizationCounter++ > Metrics::framesUntilDestabilization) myStableFrameFinalLines = -1;
if (scanlineCount == myLastFrameScanlines) { if (scanlineCount == myLastFrameScanlines) {
if (++myStabilizationCounter >= Metrics::framesForStableHeight) { if (++myStabilizationCounter >= Metrics::framesForStableHeight) {
if (myStableFrameFinalLines > 0) updateJitter(scanlineCount - myStableFrameFinalLines); if (myStableFrameFinalLines > 0) updateJitter(scanlineCount - myStableFrameFinalLines);
myStableFrameFinalLines = scanlineCount; myStableFrameFinalLines = scanlineCount;
myDestabilizationCounter = 0;
} }
} }
else myStabilizationCounter = 0; else myStabilizationCounter = 0;
} }
else myDestabilizationCounter = 0;
myLastFrameScanlines = scanlineCount; myLastFrameScanlines = scanlineCount;
@ -65,7 +71,7 @@ void JitterEmulation::updateJitter(Int32 scanlineDifference)
{ {
if (uInt32(abs(scanlineDifference)) < Metrics::minDeltaForJitter) return; if (uInt32(abs(scanlineDifference)) < Metrics::minDeltaForJitter) return;
Int32 jitter = std::min<Int32>(jitter, Metrics::maxJitter); Int32 jitter = std::min<Int32>(scanlineDifference, Metrics::maxJitter);
jitter = std::max<Int32>(jitter, -myYStart); jitter = std::max<Int32>(jitter, -myYStart);
if (jitter > 0) jitter += myJitterFactor; if (jitter > 0) jitter += myJitterFactor;
@ -84,6 +90,7 @@ bool JitterEmulation::save(Serializer& out) const
out.putInt(myStableFrameFinalLines); out.putInt(myStableFrameFinalLines);
out.putInt(myStableFrames); out.putInt(myStableFrames);
out.putInt(myStabilizationCounter); out.putInt(myStabilizationCounter);
out.putInt(myDestabilizationCounter);
out.putInt(myJitter); out.putInt(myJitter);
out.putInt(myJitterFactor); out.putInt(myJitterFactor);
out.putInt(myYStart); out.putInt(myYStart);
@ -108,6 +115,7 @@ bool JitterEmulation::load(Serializer& in)
myStableFrameFinalLines = in.getInt(); myStableFrameFinalLines = in.getInt();
myStableFrames = in.getInt(); myStableFrames = in.getInt();
myStabilizationCounter = in.getInt(); myStabilizationCounter = in.getInt();
myDestabilizationCounter = in.getInt();
myJitter = in.getInt(); myJitter = in.getInt();
myJitterFactor = in.getInt(); myJitterFactor = in.getInt();
myYStart = in.getInt(); myYStart = in.getInt();

View File

@ -58,12 +58,14 @@ class JitterEmulation: public Serializable {
uInt32 myLastFrameScanlines; uInt32 myLastFrameScanlines;
uInt32 myStableFrameFinalLines; Int32 myStableFrameFinalLines;
uInt32 myStableFrames; uInt32 myStableFrames;
uInt32 myStabilizationCounter; uInt32 myStabilizationCounter;
uInt32 myDestabilizationCounter;
Int32 myJitter; Int32 myJitter;
Int32 myJitterFactor; Int32 myJitterFactor;