mirror of https://github.com/stella-emu/stella.git
Fixed various warnings in code.
- removed unused variables - in RewindManager, convert cycles to Int32 rather than Int64; although they are defined as 64-bit from the TIA, we only care about differences here, and the difference will never be larger than a 32-bit can hold.
This commit is contained in:
parent
21bcf8211b
commit
76b3ff02b3
|
@ -116,7 +116,7 @@ void RewindManager::compressStates()
|
|||
#if 0
|
||||
myStateList.removeFirst(); // remove the oldest state file
|
||||
#else
|
||||
bool debugMode = myOSystem.eventHandler().state() == EventHandler::S_DEBUGGER;
|
||||
//bool debugMode = myOSystem.eventHandler().state() == EventHandler::S_DEBUGGER;
|
||||
// TODO: let user control these:
|
||||
const double DENSITY = 1.15; // exponential growth of cycle intervals
|
||||
const uInt32 STEP_STATES = 60; // single step rewind length
|
||||
|
@ -171,7 +171,7 @@ void RewindManager::compressStates()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string RewindManager::getMessage(RewindState& state)
|
||||
{
|
||||
Int64 diff = myOSystem.console().tia().cycles() - state.cycle;
|
||||
Int32 diff = Int32(myOSystem.console().tia().cycles() - state.cycle);
|
||||
stringstream message;
|
||||
|
||||
message << (diff >= 0 ? "Rewind" : "Unwind") << " " << getUnitString(diff);
|
||||
|
@ -183,18 +183,19 @@ string RewindManager::getMessage(RewindState& state)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string RewindManager::getUnitString(Int64 cycles)
|
||||
string RewindManager::getUnitString(Int32 cycles)
|
||||
{
|
||||
const Int64 scanlines = std::max(myOSystem.console().tia().scanlinesLastFrame(), 240u);
|
||||
const Int32 scanlines = std::max(myOSystem.console().tia().scanlinesLastFrame(), 240u);
|
||||
const bool isNTSC = scanlines <= 285; // TODO: replace magic number
|
||||
const Int64 NTSC_FREQ = 1193182; // ~76*262*60
|
||||
const Int64 PAL_FREQ = 1182298; // ~76*312*50
|
||||
const Int64 freq = isNTSC ? NTSC_FREQ : PAL_FREQ; // = cycles/second
|
||||
const Int32 NTSC_FREQ = 1193182; // ~76*262*60
|
||||
const Int32 PAL_FREQ = 1182298; // ~76*312*50
|
||||
const Int32 freq = isNTSC ? NTSC_FREQ : PAL_FREQ; // = cycles/second
|
||||
|
||||
// TODO: do we need hours here? don't think so
|
||||
const Int32 NUM_UNITS = 5;
|
||||
const string UNIT_NAMES[NUM_UNITS] = { "cycle", "scanline", "frame", "second", "minute" };
|
||||
const Int64 UNIT_CYCLES[NUM_UNITS + 1] = { 1, 76, 76 * scanlines, freq, freq * 60, (Int64)1 << 63 };
|
||||
const Int32 UNIT_CYCLES[NUM_UNITS + 1] = { 1, 76, 76 * scanlines, freq,
|
||||
freq * 60, 1 << 31 };
|
||||
|
||||
stringstream result;
|
||||
Int32 i;
|
||||
|
|
|
@ -73,7 +73,7 @@ class RewindManager
|
|||
/**
|
||||
Convert the cycles into a unit string.
|
||||
*/
|
||||
string getUnitString(Int64 cycles);
|
||||
string getUnitString(Int32 cycles);
|
||||
|
||||
private:
|
||||
// Maximum number of states to save
|
||||
|
|
|
@ -544,7 +544,7 @@ uInt16 Debugger::windStates(uInt16 states, bool unwind, string& message)
|
|||
winds++;
|
||||
else
|
||||
break;
|
||||
message = r.getUnitString(myOSystem.console().tia().cycles() - startCycles);
|
||||
message = r.getUnitString(Int32(myOSystem.console().tia().cycles() - startCycles));
|
||||
|
||||
lockBankswitchState();
|
||||
|
||||
|
|
|
@ -43,15 +43,13 @@
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
DeveloperDialog::DeveloperDialog(OSystem& osystem, DialogContainer& parent,
|
||||
const GUI::Font& font, int max_w, int max_h)
|
||||
: Dialog(osystem, parent),
|
||||
myMaxWidth(max_w),
|
||||
myMaxHeight(max_h)
|
||||
: Dialog(osystem, parent)
|
||||
{
|
||||
const int VGAP = 4;
|
||||
const int lineHeight = font.getLineHeight(),
|
||||
fontWidth = font.getMaxCharWidth(),
|
||||
buttonHeight = font.getLineHeight() + 4;
|
||||
int xpos, ypos, tabID;
|
||||
int xpos, ypos;
|
||||
|
||||
// Set real dimensions
|
||||
_w = std::min(53 * fontWidth + 10, max_w);
|
||||
|
@ -81,7 +79,6 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
|
|||
const int VGAP = 4;
|
||||
int ypos = VBORDER;
|
||||
int lineHeight = font.getLineHeight();
|
||||
int fontWidth = font.getMaxCharWidth(), fontHeight = font.getFontHeight();
|
||||
WidgetArray wid;
|
||||
VariantList items;
|
||||
int tabID = myTab->addTab(" Emulation ");
|
||||
|
@ -268,7 +265,7 @@ void DeveloperDialog::addStatesTab(const GUI::Font& font)
|
|||
const int VGAP = 4;
|
||||
int ypos = VBORDER;
|
||||
int lineHeight = font.getLineHeight();
|
||||
int fontWidth = font.getMaxCharWidth(), fontHeight = font.getFontHeight();
|
||||
int fontHeight = font.getFontHeight();
|
||||
WidgetArray wid;
|
||||
int tabID = myTab->addTab("States");
|
||||
|
||||
|
@ -348,7 +345,6 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font)
|
|||
fontHeight = font.getFontHeight(),
|
||||
lineHeight = font.getLineHeight();
|
||||
int xpos, ypos, pwidth;
|
||||
ButtonWidget* b;
|
||||
const GUI::Size& ds = instance().frameBuffer().desktopSize();
|
||||
|
||||
xpos = HBORDER;
|
||||
|
@ -702,7 +698,7 @@ void DeveloperDialog::saveConfig()
|
|||
double diff = cycleSum - horizon;
|
||||
//cerr << "factor " << factor << ", diff " << diff << endl;
|
||||
// exit loop if result is close enough
|
||||
if(abs(diff) < horizon * 1E-5)
|
||||
if(std::abs(diff) < horizon * 1E-5)
|
||||
break;
|
||||
// define new boundary
|
||||
if(cycleSum < horizon)
|
||||
|
@ -965,10 +961,10 @@ void DeveloperDialog::handleRewind()
|
|||
void DeveloperDialog::handleSize()
|
||||
{
|
||||
bool found = false;
|
||||
uInt64 size = myStateSizeWidget->getValue();
|
||||
uInt64 uncompressed = myUncompressedWidget->getValue();
|
||||
uInt64 interval = myStateIntervalWidget->getValue();
|
||||
uInt64 horizon = myStateHorizonWidget->getValue();
|
||||
uInt32 size = myStateSizeWidget->getValue();
|
||||
uInt32 uncompressed = myUncompressedWidget->getValue();
|
||||
uInt32 interval = myStateIntervalWidget->getValue();
|
||||
uInt32 horizon = myStateHorizonWidget->getValue();
|
||||
Int32 i;
|
||||
|
||||
myStateSizeLabelWidget->setValue(size);
|
||||
|
@ -1002,8 +998,8 @@ void DeveloperDialog::handleSize()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DeveloperDialog::handleUncompressed()
|
||||
{
|
||||
uInt64 size = myStateSizeWidget->getValue();
|
||||
uInt64 uncompressed = myUncompressedWidget->getValue();
|
||||
uInt32 size = myStateSizeWidget->getValue();
|
||||
uInt32 uncompressed = myUncompressedWidget->getValue();
|
||||
|
||||
myUncompressedLabelWidget->setValue(myUncompressedWidget->getValue());
|
||||
if(uncompressed > size)
|
||||
|
@ -1017,10 +1013,10 @@ void DeveloperDialog::handleUncompressed()
|
|||
void DeveloperDialog::handleInterval()
|
||||
{
|
||||
bool found = false;
|
||||
uInt64 size = myStateSizeWidget->getValue();
|
||||
uInt64 uncompressed = myUncompressedWidget->getValue();
|
||||
uInt64 interval = myStateIntervalWidget->getValue();
|
||||
uInt64 horizon = myStateHorizonWidget->getValue();
|
||||
uInt32 size = myStateSizeWidget->getValue();
|
||||
uInt32 uncompressed = myUncompressedWidget->getValue();
|
||||
uInt32 interval = myStateIntervalWidget->getValue();
|
||||
uInt32 horizon = myStateHorizonWidget->getValue();
|
||||
Int32 i;
|
||||
|
||||
myStateIntervalLabelWidget->setLabel(INTERVALS[interval]);
|
||||
|
@ -1055,10 +1051,10 @@ void DeveloperDialog::handleInterval()
|
|||
void DeveloperDialog::handleHorizon()
|
||||
{
|
||||
bool found = false;
|
||||
uInt64 size = myStateSizeWidget->getValue();
|
||||
uInt64 uncompressed = myUncompressedWidget->getValue();
|
||||
uInt64 interval = myStateIntervalWidget->getValue();
|
||||
uInt64 horizon = myStateHorizonWidget->getValue();
|
||||
uInt32 size = myStateSizeWidget->getValue();
|
||||
uInt32 uncompressed = myUncompressedWidget->getValue();
|
||||
uInt32 interval = myStateIntervalWidget->getValue();
|
||||
uInt32 horizon = myStateHorizonWidget->getValue();
|
||||
Int32 i;
|
||||
|
||||
myStateHorizonLabelWidget->setLabel(HORIZONS[horizon]);
|
||||
|
|
|
@ -145,8 +145,6 @@ class DeveloperDialog : public Dialog
|
|||
PopUpWidget* myDebuggerFontStyle;
|
||||
#endif
|
||||
|
||||
// Maximum width and height for this dialog
|
||||
int myMaxWidth, myMaxHeight;
|
||||
bool mySettings;
|
||||
// Emulator sets
|
||||
bool myFrameStats[2];
|
||||
|
|
Loading…
Reference in New Issue