mirror of https://github.com/stella-emu/stella.git
Move frame manager to dedicated subdir, remove all external deps on it.
This commit is contained in:
parent
1677ecae12
commit
246b5e7596
1
Makefile
1
Makefile
|
@ -95,6 +95,7 @@ MODULES := $(MODULES)
|
|||
MODULES += \
|
||||
src/emucore \
|
||||
src/emucore/tia \
|
||||
src/emucore/tia/frame-manager \
|
||||
src/gui \
|
||||
src/common \
|
||||
src/common/tv_filters
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#include "CommandMenu.hxx"
|
||||
#include "Serializable.hxx"
|
||||
#include "Version.hxx"
|
||||
#include "FrameManager.hxx"
|
||||
#include "TIAConstants.hxx"
|
||||
#include "FrameLayout.hxx"
|
||||
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
|
@ -121,7 +121,7 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
|
|||
bool fastscbios = myOSystem.settings().getBool("fastscbios");
|
||||
myOSystem.settings().setValue("fastscbios", true);
|
||||
|
||||
uInt8 initialGarbageFrames = FrameManager::initialGarbageFrames();
|
||||
uInt8 initialGarbageFrames = TIAConstants::initialGarbageFrames;
|
||||
uInt8 linesPAL = 0;
|
||||
uInt8 linesNTSC = 0;
|
||||
|
||||
|
@ -580,7 +580,7 @@ void Console::changeYStart(int direction)
|
|||
|
||||
if(direction == +1) // increase YStart
|
||||
{
|
||||
if(ystart >= FrameManager::maxYStart)
|
||||
if(ystart >= TIAConstants::maxYStart)
|
||||
{
|
||||
myOSystem.frameBuffer().showMessage("YStart at maximum");
|
||||
return;
|
||||
|
@ -589,7 +589,7 @@ void Console::changeYStart(int direction)
|
|||
}
|
||||
else if(direction == -1) // decrease YStart
|
||||
{
|
||||
if(ystart == FrameManager::minYStart-1)
|
||||
if(ystart == TIAConstants::minYStart-1)
|
||||
{
|
||||
myOSystem.frameBuffer().showMessage("YStart at minimum");
|
||||
return;
|
||||
|
@ -601,7 +601,7 @@ void Console::changeYStart(int direction)
|
|||
|
||||
ostringstream val;
|
||||
val << ystart;
|
||||
if(ystart == FrameManager::minYStart-1)
|
||||
if(ystart == TIAConstants::minYStart-1)
|
||||
myOSystem.frameBuffer().showMessage("YStart autodetected");
|
||||
else
|
||||
{
|
||||
|
@ -610,7 +610,7 @@ void Console::changeYStart(int direction)
|
|||
// We've reached the auto-detect value, so reset
|
||||
myOSystem.frameBuffer().showMessage("YStart " + val.str() + " (Auto)");
|
||||
val.str("");
|
||||
val << FrameManager::minYStart-1;
|
||||
val << TIAConstants::minYStart-1;
|
||||
}
|
||||
else
|
||||
myOSystem.frameBuffer().showMessage("YStart " + val.str());
|
||||
|
@ -630,7 +630,7 @@ void Console::changeHeight(int direction)
|
|||
if(direction == +1) // increase Height
|
||||
{
|
||||
height++;
|
||||
if(height > FrameManager::maxViewableHeight || height > dheight)
|
||||
if(height > TIAConstants::maxViewableHeight || height > dheight)
|
||||
{
|
||||
myOSystem.frameBuffer().showMessage("Height at maximum");
|
||||
return;
|
||||
|
@ -639,7 +639,7 @@ void Console::changeHeight(int direction)
|
|||
else if(direction == -1) // decrease Height
|
||||
{
|
||||
height--;
|
||||
if(height < FrameManager::minViewableHeight) height = 0;
|
||||
if(height < TIAConstants::minViewableHeight) height = 0;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
@ -659,10 +659,10 @@ void Console::setTIAProperties()
|
|||
{
|
||||
uInt32 ystart = atoi(myProperties.get(Display_YStart).c_str());
|
||||
if(ystart != 0)
|
||||
ystart = BSPF::clamp(ystart, FrameManager::minYStart, FrameManager::maxYStart);
|
||||
ystart = BSPF::clamp(ystart, TIAConstants::minYStart, TIAConstants::maxYStart);
|
||||
uInt32 height = atoi(myProperties.get(Display_Height).c_str());
|
||||
if(height != 0)
|
||||
height = BSPF::clamp(height, FrameManager::minViewableHeight, FrameManager::maxViewableHeight);
|
||||
height = BSPF::clamp(height, TIAConstants::minViewableHeight, TIAConstants::maxViewableHeight);
|
||||
|
||||
myTIA->autodetectLayout(false);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace GUI {
|
|||
#include "Variant.hxx"
|
||||
#include "FBSurface.hxx"
|
||||
#include "TIASurface.hxx"
|
||||
#include "FrameManager.hxx"
|
||||
#include "TIAConstants.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
// Return values for initialization of framebuffer window
|
||||
|
@ -132,7 +132,7 @@ class FrameBuffer
|
|||
{
|
||||
public:
|
||||
enum {
|
||||
kTIAMinW = 320u, kTIAMinH = FrameManager::minViewableHeight,
|
||||
kTIAMinW = 320u, kTIAMinH = TIAConstants::minViewableHeight,
|
||||
kFBMinW = 640u, kFBMinH = 480u
|
||||
};
|
||||
|
||||
|
|
|
@ -25,10 +25,10 @@ class FrameBuffer;
|
|||
class FBSurface;
|
||||
class VideoMode;
|
||||
|
||||
#include "FrameManager.hxx"
|
||||
#include "Rect.hxx"
|
||||
#include "NTSCFilter.hxx"
|
||||
#include "bspf.hxx"
|
||||
#include "TIAConstants.hxx"
|
||||
|
||||
/**
|
||||
This class is basically a wrapper around all things related to rendering
|
||||
|
@ -165,9 +165,9 @@ class TIASurface
|
|||
};
|
||||
Filter myFilter;
|
||||
|
||||
enum TIAConstants {
|
||||
enum {
|
||||
kTIAW = 160,
|
||||
kTIAH = FrameManager::frameBufferHeight,
|
||||
kTIAH = TIAConstants::frameBufferHeight,
|
||||
kScanH = kTIAH*2
|
||||
};
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "Control.hxx"
|
||||
#include "Paddles.hxx"
|
||||
#include "DelayQueueIteratorImpl.hxx"
|
||||
#include "TIAConstants.hxx"
|
||||
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
#include "CartDebug.hxx"
|
||||
|
@ -155,7 +156,7 @@ void TIA::reset()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIA::frameReset()
|
||||
{
|
||||
memset(myFramebuffer, 0, 160 * FrameManager::frameBufferHeight);
|
||||
memset(myFramebuffer, 0, 160 * TIAConstants::frameBufferHeight);
|
||||
myAutoFrameEnabled = mySettings.getInt("framerate") <= 0;
|
||||
enableColorLoss(mySettings.getBool("colorloss"));
|
||||
}
|
||||
|
@ -750,7 +751,7 @@ bool TIA::saveDisplay(Serializer& out) const
|
|||
{
|
||||
try
|
||||
{
|
||||
out.putByteArray(myFramebuffer, 160*FrameManager::frameBufferHeight);
|
||||
out.putByteArray(myFramebuffer, 160*TIAConstants::frameBufferHeight);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
|
@ -767,7 +768,7 @@ bool TIA::loadDisplay(Serializer& in)
|
|||
try
|
||||
{
|
||||
// Reset frame buffer pointer and data
|
||||
in.getByteArray(myFramebuffer, 160*FrameManager::frameBufferHeight);
|
||||
in.getByteArray(myFramebuffer, 160*TIAConstants::frameBufferHeight);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
|
|
|
@ -25,9 +25,10 @@
|
|||
#include "Device.hxx"
|
||||
#include "Serializer.hxx"
|
||||
#include "TIATypes.hxx"
|
||||
#include "TIAConstants.hxx"
|
||||
#include "DelayQueue.hxx"
|
||||
#include "DelayQueueIterator.hxx"
|
||||
#include "FrameManager.hxx"
|
||||
#include "frame-manager/FrameManager.hxx"
|
||||
#include "FrameLayout.hxx"
|
||||
#include "Background.hxx"
|
||||
#include "Playfield.hxx"
|
||||
|
@ -489,7 +490,7 @@ class TIA : public Device
|
|||
LatchedInput myInput1;
|
||||
|
||||
// Pointer to the internal color-index-based frame buffer
|
||||
uInt8 myFramebuffer[160 * FrameManager::frameBufferHeight];
|
||||
uInt8 myFramebuffer[160 * TIAConstants::frameBufferHeight];
|
||||
|
||||
bool myTIAPinsDriven;
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef TIA_CONSTANTS_HXX
|
||||
#define TIA_CONSTANTS_HXX
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
||||
namespace TIAConstants {
|
||||
|
||||
constexpr uInt32 frameBufferHeight = 320;
|
||||
constexpr uInt32 minYStart = 1, maxYStart = 64;
|
||||
constexpr uInt32 minViewableHeight = 210, maxViewableHeight = 256;
|
||||
constexpr uInt32 initialGarbageFrames = 10;
|
||||
|
||||
}
|
||||
|
||||
#endif // TIA_CONSTANTS_HXX
|
|
@ -34,7 +34,7 @@ enum Metrics: uInt32 {
|
|||
visibleOverscan = 20,
|
||||
maxUnderscan = 10,
|
||||
tvModeDetectionTolerance = 20,
|
||||
initialGarbageFrames = 10,
|
||||
initialGarbageFrames = TIAConstants::initialGarbageFrames,
|
||||
framesForModeConfirmation = 5,
|
||||
minStableFrames = 10,
|
||||
maxStabilizationFrames = 20,
|
||||
|
@ -50,12 +50,6 @@ inline static uInt32 vsyncLimit(bool autodetect) {
|
|||
return autodetect ? maxLinesVsyncDuringAutodetect : maxLinesVsync;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 FrameManager::initialGarbageFrames()
|
||||
{
|
||||
return Metrics::initialGarbageFrames;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
FrameManager::FrameManager()
|
||||
: myLayout(FrameLayout::pal),
|
|
@ -23,6 +23,7 @@
|
|||
#include "VblankManager.hxx"
|
||||
#include "Serializable.hxx"
|
||||
#include "FrameLayout.hxx"
|
||||
#include "TIAConstants.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
class FrameManager : public Serializable
|
||||
|
@ -37,8 +38,6 @@ class FrameManager : public Serializable
|
|||
|
||||
public:
|
||||
|
||||
static uInt8 initialGarbageFrames();
|
||||
|
||||
void setHandlers(
|
||||
callback frameStartCallback,
|
||||
callback frameCompletionCallback,
|
||||
|
@ -101,11 +100,6 @@ class FrameManager : public Serializable
|
|||
bool jitterEnabled() const { return myJitterEnabled; }
|
||||
void enableJitter(bool enabled);
|
||||
|
||||
public:
|
||||
static constexpr uInt32 frameBufferHeight = 320;
|
||||
static constexpr uInt32 minYStart = 1, maxYStart = 64;
|
||||
static constexpr uInt32 minViewableHeight = 210, maxViewableHeight = 256;
|
||||
|
||||
private:
|
||||
|
||||
enum State {
|
|
@ -0,0 +1,11 @@
|
|||
MODULE := src/emucore/tia/frame-manager
|
||||
|
||||
MODULE_OBJS := \
|
||||
src/emucore/tia/frame-manager/FrameManager.o \
|
||||
src/emucore/tia/frame-manager/VblankManager.o
|
||||
|
||||
MODULE_DIRS += \
|
||||
src/emucore/tia/frame-manager
|
||||
|
||||
# Include common rules
|
||||
include $(srcdir)/common.rules
|
|
@ -2,7 +2,6 @@ MODULE := src/emucore/tia
|
|||
|
||||
MODULE_OBJS := \
|
||||
src/emucore/tia/TIA.o \
|
||||
src/emucore/tia/FrameManager.o \
|
||||
src/emucore/tia/Playfield.o \
|
||||
src/emucore/tia/DrawCounterDecodes.o \
|
||||
src/emucore/tia/Missile.o \
|
||||
|
@ -10,8 +9,7 @@ MODULE_OBJS := \
|
|||
src/emucore/tia/Ball.o \
|
||||
src/emucore/tia/Background.o \
|
||||
src/emucore/tia/LatchedInput.o \
|
||||
src/emucore/tia/PaddleReader.o \
|
||||
src/emucore/tia/VblankManager.o
|
||||
src/emucore/tia/PaddleReader.o
|
||||
|
||||
MODULE_DIRS += \
|
||||
src/emucore/tia
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "Props.hxx"
|
||||
#include "PropsSet.hxx"
|
||||
#include "TabWidget.hxx"
|
||||
#include "FrameManager.hxx"
|
||||
#include "TIAConstants.hxx"
|
||||
#include "Widget.hxx"
|
||||
|
||||
#include "GameInfoDialog.hxx"
|
||||
|
@ -321,8 +321,8 @@ GameInfoDialog::GameInfoDialog(
|
|||
|
||||
myYStart = new SliderWidget(myTab, font, xpos+lwidth, ypos, 8*fontWidth, lineHeight,
|
||||
"", 0, kYStartChanged);
|
||||
myYStart->setMinValue(FrameManager::minYStart-1);
|
||||
myYStart->setMaxValue(FrameManager::maxYStart);
|
||||
myYStart->setMinValue(TIAConstants::minYStart-1);
|
||||
myYStart->setMaxValue(TIAConstants::maxYStart);
|
||||
wid.push_back(myYStart);
|
||||
myYStartLabel = new StaticTextWidget(myTab, font, xpos+lwidth+myYStart->getWidth() + 4,
|
||||
ypos+1, 5*fontWidth, fontHeight, "", kTextAlignLeft);
|
||||
|
@ -333,8 +333,8 @@ GameInfoDialog::GameInfoDialog(
|
|||
"Height", kTextAlignLeft);
|
||||
myHeight = new SliderWidget(myTab, font, xpos+lwidth, ypos, 8*fontWidth, lineHeight,
|
||||
"", 0, kHeightChanged);
|
||||
myHeight->setMinValue(FrameManager::minViewableHeight-1);
|
||||
myHeight->setMaxValue(FrameManager::maxViewableHeight);
|
||||
myHeight->setMinValue(TIAConstants::minViewableHeight-1);
|
||||
myHeight->setMaxValue(TIAConstants::maxViewableHeight);
|
||||
wid.push_back(myHeight);
|
||||
myHeightLabel = new StaticTextWidget(myTab, font, xpos+lwidth+myHeight->getWidth() + 4,
|
||||
ypos+1, 5*fontWidth, fontHeight, "", kTextAlignLeft);
|
||||
|
@ -599,14 +599,14 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
}
|
||||
|
||||
case kYStartChanged:
|
||||
if(myYStart->getValue() == FrameManager::minYStart-1)
|
||||
if(myYStart->getValue() == TIAConstants::minYStart-1)
|
||||
myYStartLabel->setLabel("Auto");
|
||||
else
|
||||
myYStartLabel->setValue(myYStart->getValue());
|
||||
break;
|
||||
|
||||
case kHeightChanged:
|
||||
if(myHeight->getValue() == FrameManager::minViewableHeight-1)
|
||||
if(myHeight->getValue() == TIAConstants::minViewableHeight-1)
|
||||
myHeightLabel->setLabel("Auto");
|
||||
else
|
||||
myHeightLabel->setValue(myHeight->getValue());
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "OSystem.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "TIAConstants.hxx"
|
||||
|
||||
#include "RomInfoWidget.hxx"
|
||||
|
||||
|
@ -28,8 +29,8 @@ RomInfoWidget::RomInfoWidget(GuiObject* boss, const GUI::Font& font,
|
|||
: Widget(boss, font, x, y, w, h),
|
||||
mySurfaceIsValid(false),
|
||||
myHaveProperties(false),
|
||||
myAvail(w > 400 ? GUI::Size(640, FrameManager::maxViewableHeight*2) :
|
||||
GUI::Size(320, FrameManager::maxViewableHeight))
|
||||
myAvail(w > 400 ? GUI::Size(640, TIAConstants::maxViewableHeight*2) :
|
||||
GUI::Size(320, TIAConstants::maxViewableHeight))
|
||||
{
|
||||
_flags = WIDGET_ENABLED;
|
||||
_bgcolor = _bgcolorhi = kWidColor;
|
||||
|
@ -76,7 +77,7 @@ void RomInfoWidget::parseProperties()
|
|||
// only draw certain parts of it
|
||||
if(mySurface == nullptr)
|
||||
{
|
||||
mySurface = instance().frameBuffer().allocateSurface(320*2, FrameManager::maxViewableHeight*2);
|
||||
mySurface = instance().frameBuffer().allocateSurface(320*2, TIAConstants::maxViewableHeight*2);
|
||||
mySurface->attributes().smoothing = true;
|
||||
mySurface->applyAttributes();
|
||||
|
||||
|
|
Loading…
Reference in New Issue