a little bit of polishing

This commit is contained in:
thrust26 2020-05-14 11:12:56 +02:00
parent ea98b7a8d0
commit a6df70db89
9 changed files with 66 additions and 55 deletions

View File

@ -460,8 +460,8 @@ PhysicalKeyboardHandler::EventMappingArray PhysicalKeyboardHandler::DefaultCommo
{Event::VidmodeIncrease, KBDK_EQUALS, MOD3},
{Event::VCenterDecrease, KBDK_PAGEUP, MOD3},
{Event::VCenterIncrease, KBDK_PAGEDOWN, MOD3},
{Event::ScanlineAdjustDecrease, KBDK_PAGEDOWN, KBDM_SHIFT | MOD3},
{Event::ScanlineAdjustIncrease, KBDK_PAGEUP, KBDM_SHIFT | MOD3},
{Event::VSizeAdjustDecrease, KBDK_PAGEDOWN, KBDM_SHIFT | MOD3},
{Event::VSizeAdjustIncrease, KBDK_PAGEUP, KBDM_SHIFT | MOD3},
{Event::VolumeDecrease, KBDK_LEFTBRACKET, MOD3},
{Event::VolumeIncrease, KBDK_RIGHTBRACKET, MOD3},
{Event::SoundToggle, KBDK_RIGHTBRACKET, KBDM_CTRL},

View File

@ -238,7 +238,10 @@ void SoundSDL2::adjustVolume(Int8 direction)
}
// Now show an onscreen message
strval << percent << "%";
if(percent)
strval << percent << "%";
else
strval << "Off";
myOSystem.frameBuffer().showMessage("Volume", strval.str(), percent);
}

View File

@ -35,7 +35,7 @@ CartridgeEnhanced::CartridgeEnhanced(const ByteBuffer& image, size_t size,
void CartridgeEnhanced::install(System& system)
{
// limit banked RAM size to the size of one RAM bank
uInt32 ramSize = myRamBankCount > 0 ? 1 << (myBankShift - 1) : uInt32(myRamSize);
const uInt32 ramSize = myRamBankCount > 0 ? 1 << (myBankShift - 1) : uInt32(myRamSize);
// calculate bank switching and RAM sizes and masks
myBankSize = 1 << myBankShift; // e.g. = 2 ^ 12 = 4K = 0x1000
@ -71,7 +71,7 @@ void CartridgeEnhanced::install(System& system)
access.type = System::PageAccessType::WRITE;
for(uInt16 addr = ROM_OFFSET + myWriteOffset; addr < ROM_OFFSET + myWriteOffset + myRamSize; addr += System::PAGE_SIZE)
{
uInt16 offset = addr & myRamMask;
const uInt16 offset = addr & myRamMask;
access.directPokeBase = &myRAM[offset];
access.romAccessBase = &myRomAccessBase[myWriteOffset + offset];
@ -85,7 +85,7 @@ void CartridgeEnhanced::install(System& system)
access.directPokeBase = nullptr;
for(uInt16 addr = ROM_OFFSET + myReadOffset; addr < ROM_OFFSET + myReadOffset + myRamSize; addr += System::PAGE_SIZE)
{
uInt16 offset = addr & myRamMask;
const uInt16 offset = addr & myRamMask;
access.directPeekBase = &myRAM[offset];
access.romAccessBase = &myRomAccessBase[myReadOffset + offset];
@ -117,7 +117,7 @@ void CartridgeEnhanced::reset()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeEnhanced::peek(uInt16 address)
{
uInt16 peekAddress = address;
const uInt16 peekAddress = address;
// hotspots in TIA range are reacting to pokes only
if (hotspot() >= 0x80)
@ -157,7 +157,7 @@ bool CartridgeEnhanced::poke(uInt16 address, uInt8 value)
if(myRamSize > 0)
{
// Code should never get here (System::PageAccess::directPoke() handles this)
uInt16 pokeAddress = address;
const uInt16 pokeAddress = address;
if(isRamBank(address))
{
@ -193,20 +193,20 @@ bool CartridgeEnhanced::bank(uInt16 bank, uInt16 segment)
{
if(bankLocked()) return false;
uInt16 segmentOffset = segment << myBankShift;
const uInt16 segmentOffset = segment << myBankShift;
if(myRamBankCount == 0 || bank < romBankCount())
{
// Setup ROM bank
uInt16 romBank = bank % romBankCount();
const uInt16 romBank = bank % romBankCount();
// Remember what bank is in this segment
uInt32 bankOffset = myCurrentSegOffset[segment] = romBank << myBankShift;
uInt16 hotspot = this->hotspot();
const uInt32 bankOffset = myCurrentSegOffset[segment] = romBank << myBankShift;
const uInt16 hotspot = this->hotspot();
uInt16 hotSpotAddr;
// Skip extra RAM; if existing it is only mapped into first segment
uInt16 fromAddr = (ROM_OFFSET + segmentOffset + (segment == 0 ? myRomOffset : 0)) & ~System::PAGE_MASK;
const uInt16 fromAddr = (ROM_OFFSET + segmentOffset + (segment == 0 ? myRomOffset : 0)) & ~System::PAGE_MASK;
// for ROMs < 4_KB, the whole address space will be mapped.
uInt16 toAddr = (ROM_OFFSET + segmentOffset + (mySize < 4_KB ? 4_KB : myBankSize)) & ~System::PAGE_MASK;
const uInt16 toAddr = (ROM_OFFSET + segmentOffset + (mySize < 4_KB ? 4_KB : myBankSize)) & ~System::PAGE_MASK;
if(hotspot & 0x1000)
hotSpotAddr = (hotspot & ~System::PAGE_MASK);
@ -217,7 +217,7 @@ bool CartridgeEnhanced::bank(uInt16 bank, uInt16 segment)
// Setup the page access methods for the current bank
for(uInt16 addr = fromAddr; addr < toAddr; addr += System::PAGE_SIZE)
{
uInt32 offset = bankOffset + (addr & myBankMask);
const uInt32 offset = bankOffset + (addr & myBankMask);
if(myDirectPeek && addr != hotSpotAddr)
access.directPeekBase = &myImage[offset];
@ -232,9 +232,9 @@ bool CartridgeEnhanced::bank(uInt16 bank, uInt16 segment)
else
{
// Setup RAM bank
uInt16 ramBank = (bank - romBankCount()) % myRamBankCount;
const uInt16 ramBank = (bank - romBankCount()) % myRamBankCount;
// The RAM banks follow the ROM banks and are half the size of a ROM bank
uInt32 bankOffset = uInt32(mySize) + (ramBank << (myBankShift - 1));
const uInt32 bankOffset = uInt32(mySize) + (ramBank << (myBankShift - 1));
// Remember what bank is in this segment
myCurrentSegOffset[segment] = uInt32(mySize) + (ramBank << myBankShift);
@ -246,7 +246,7 @@ bool CartridgeEnhanced::bank(uInt16 bank, uInt16 segment)
for(uInt16 addr = fromAddr; addr < toAddr; addr += System::PAGE_SIZE)
{
uInt32 offset = bankOffset + (addr & myRamMask);
const uInt32 offset = bankOffset + (addr & myRamMask);
access.directPokeBase = &myRAM[offset - mySize];
access.romAccessBase = &myRomAccessBase[offset];
@ -263,7 +263,7 @@ bool CartridgeEnhanced::bank(uInt16 bank, uInt16 segment)
for(uInt16 addr = fromAddr; addr < toAddr; addr += System::PAGE_SIZE)
{
uInt32 offset = bankOffset + (addr & myRamMask);
const uInt32 offset = bankOffset + (addr & myRamMask);
access.directPeekBase = &myRAM[offset - mySize];
access.romAccessBase = &myRomAccessBase[offset];

View File

@ -534,7 +534,14 @@ void Console::changePhosphor(bool increase)
ostringstream val;
val << blend;
myProperties.set(PropType::Display_PPBlend, val.str());
myOSystem.frameBuffer().showMessage("Phosphor blend", val.str() + "%", blend);
if(blend)
val << "%";
else
{
val.str("");
val << "Off";
}
myOSystem.frameBuffer().showMessage("Phosphor blend", val.str(), blend);
myOSystem.frameBuffer().tiaSurface().enablePhosphor(true, blend);
}
@ -643,7 +650,7 @@ void Console::updateVcenter(Int32 vcenter)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changeScanlineAdjust(bool increase)
void Console::changeVSizeAdjust(bool increase)
{
Int32 newAdjustVSize = myTIA->adjustVSize();

View File

@ -268,7 +268,7 @@ class Console : public Serializable, public ConsoleIO
@param increase Increase if true, else decrease
*/
void changeScanlineAdjust(bool increase = true);
void changeVSizeAdjust(bool increase = true);
/**
Returns the current framerate.

View File

@ -104,7 +104,7 @@ class Event
PreviousPaletteAttribute, NextPaletteAttribute,
PaletteAttributeDecrease, PaletteAttributeIncrease,
ToggleFullScreen, VidmodeDecrease, VidmodeIncrease,
VCenterDecrease, VCenterIncrease, ScanlineAdjustDecrease, ScanlineAdjustIncrease,
VCenterDecrease, VCenterIncrease, VSizeAdjustDecrease, VSizeAdjustIncrease,
OverscanDecrease, OverscanIncrease,
VidmodeStd, VidmodeRGB, VidmodeSVideo, VidModeComposite, VidModeBad, VidModeCustom,

View File

@ -345,7 +345,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
{
// Take care of special events that aren't part of the emulation core
// or need to be preprocessed before passing them on
bool pressed = (value != 0);
const bool pressed = (value != 0);
switch(event)
{
@ -428,12 +428,12 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
if (pressed) myOSystem.console().changeVerticalCenter(true);
return;
case Event::ScanlineAdjustDecrease:
if (pressed) myOSystem.console().changeScanlineAdjust(false);
case Event::VSizeAdjustDecrease:
if (pressed) myOSystem.console().changeVSizeAdjust(false);
return;
case Event::ScanlineAdjustIncrease:
if (pressed) myOSystem.console().changeScanlineAdjust(true);
case Event::VSizeAdjustIncrease:
if (pressed) myOSystem.console().changeVSizeAdjust(true);
return;
case Event::PreviousPaletteAttribute:
@ -592,14 +592,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
case Event::ToggleGrabMouse:
if (pressed && !repeated && !myOSystem.frameBuffer().fullScreen())
{
bool oldState = myOSystem.frameBuffer().grabMouseEnabled();
myOSystem.frameBuffer().toggleGrabMouse();
bool newState = myOSystem.frameBuffer().grabMouseEnabled();
myOSystem.frameBuffer().showMessage(oldState != newState ? myOSystem.frameBuffer().grabMouseEnabled()
? "Grab mouse enabled" : "Grab mouse disabled"
: "Grab mouse not allowed while cursor shown");
}
return;
case Event::ToggleP0Collision:
@ -760,7 +753,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
if (myOSystem.settings().getBool("confirmexit"))
{
StringList msg;
string saveOnExit = myOSystem.settings().getString("saveonexit");
const string saveOnExit = myOSystem.settings().getString("saveonexit");
bool activeTM = myOSystem.settings().getBool(
myOSystem.settings().getBool("dev.settings") ? "dev.timemachine" : "plr.timemachine");
@ -1085,12 +1078,12 @@ void EventHandler::setActionMappings(EventMode mode)
// Fill the EmulActionList with the current key and joystick mappings
for(auto& item: ourEmulActionList)
{
Event::Type event = item.event;
const Event::Type event = item.event;
item.key = "None";
string key = myPKeyHandler->getMappingDesc(event, mode);
#ifdef JOYSTICK_SUPPORT
string joydesc = myPJoyHandler->getMappingDesc(event, mode);
const string joydesc = myPJoyHandler->getMappingDesc(event, mode);
if(joydesc != "")
{
if(key != "")
@ -1107,12 +1100,12 @@ void EventHandler::setActionMappings(EventMode mode)
// Fill the MenuActionList with the current key and joystick mappings
for(auto& item: ourMenuActionList)
{
Event::Type event = item.event;
const Event::Type event = item.event;
item.key = "None";
string key = myPKeyHandler->getMappingDesc(event, mode);
#ifdef JOYSTICK_SUPPORT
string joydesc = myPJoyHandler->getMappingDesc(event, mode);
const string joydesc = myPJoyHandler->getMappingDesc(event, mode);
if(joydesc != "")
{
if(key != "")
@ -1138,7 +1131,7 @@ void EventHandler::setComboMap()
string list = myOSystem.settings().getString("combomap");
replace(list.begin(), list.end(), ':', ' ');
istringstream buf(list);
Int32 version = myOSystem.settings().getInt("event_ver");
const Int32 version = myOSystem.settings().getInt("event_ver");
// Erase the 'combo' array
auto ERASE_ALL = [&]() {
@ -1200,7 +1193,7 @@ void EventHandler::removePhysicalJoystickFromDatabase(const string& name)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool EventHandler::addKeyMapping(Event::Type event, EventMode mode, StellaKey key, StellaMod mod)
{
bool mapped = myPKeyHandler->addMapping(event, mode, key, mod);
const bool mapped = myPKeyHandler->addMapping(event, mode, key, mod);
if(mapped)
setActionMappings(mode);
@ -1213,7 +1206,7 @@ bool EventHandler::addJoyMapping(Event::Type event, EventMode mode,
bool updateMenus)
{
#ifdef JOYSTICK_SUPPORT
bool mapped = myPJoyHandler->addJoyMapping(event, mode, stick, button, axis, adir);
const bool mapped = myPJoyHandler->addJoyMapping(event, mode, stick, button, axis, adir);
if (mapped && updateMenus)
setActionMappings(mode);
@ -1411,7 +1404,7 @@ VariantList EventHandler::getComboList(EventMode /**/) const
VarList::push_back(l, "None", "-1");
for(uInt32 i = 0; i < ourEmulActionList.size(); ++i)
{
Event::Type event = EventHandler::ourEmulActionList[i].event;
const Event::Type event = EventHandler::ourEmulActionList[i].event;
// exclude combos events
if(!(event >= Event::Combo1 && event <= Event::Combo16))
{
@ -1433,7 +1426,7 @@ StringList EventHandler::getComboListForEvent(Event::Type event) const
int combo = event - Event::Combo1;
for(uInt32 i = 0; i < EVENTS_PER_COMBO; ++i)
{
Event::Type e = myComboTable[combo][i];
const Event::Type e = myComboTable[combo][i];
for(uInt32 j = 0; j < ourEmulActionList.size(); ++j)
{
if(EventHandler::ourEmulActionList[j].event == e)
@ -1457,7 +1450,7 @@ void EventHandler::setComboListForEvent(Event::Type event, const StringList& eve
if(event >= Event::Combo1 && event <= Event::Combo16)
{
assert(events.size() == 8);
int combo = event - Event::Combo1;
const int combo = event - Event::Combo1;
for(uInt32 i = 0; i < 8; ++i)
{
uInt32 idx = BSPF::stringToInt(events[i]);
@ -1544,7 +1537,7 @@ int EventHandler::getActionListIndex(int idx, Event::Group group) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Event::Type EventHandler::eventAtIndex(int idx, Event::Group group) const
{
int index = getActionListIndex(idx, group);
const int index = getActionListIndex(idx, group);
if(group == Event::Group::Menu)
{
@ -1565,7 +1558,7 @@ Event::Type EventHandler::eventAtIndex(int idx, Event::Group group) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string EventHandler::actionAtIndex(int idx, Event::Group group) const
{
int index = getActionListIndex(idx, group);
const int index = getActionListIndex(idx, group);
if(group == Event::Group::Menu)
{
@ -1586,7 +1579,7 @@ string EventHandler::actionAtIndex(int idx, Event::Group group) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string EventHandler::keyAtIndex(int idx, Event::Group group) const
{
int index = getActionListIndex(idx, group);
const int index = getActionListIndex(idx, group);
if(group == Event::Group::Menu)
{
@ -1797,8 +1790,8 @@ void EventHandler::setState(EventHandlerState state)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::exitEmulation(bool checkLauncher)
{
string saveOnExit = myOSystem.settings().getString("saveonexit");
bool activeTM = myOSystem.settings().getBool(
const string saveOnExit = myOSystem.settings().getString("saveonexit");
const bool activeTM = myOSystem.settings().getBool(
myOSystem.settings().getBool("dev.settings") ? "dev.timemachine" : "plr.timemachine");
@ -1924,8 +1917,8 @@ EventHandler::EmulActionList EventHandler::ourEmulActionList = { {
{ Event::OverscanIncrease, "Increase overscan in fullscreen mode", "" },
{ Event::VidmodeDecrease, "Previous zoom level", "" },
{ Event::VidmodeIncrease, "Next zoom level", "" },
{ Event::ScanlineAdjustDecrease, "Decrease vertical display size", "" },
{ Event::ScanlineAdjustIncrease, "Increase vertical display size", "" },
{ Event::VSizeAdjustDecrease, "Decrease vertical display size", "" },
{ Event::VSizeAdjustIncrease, "Increase vertical display size", "" },
{ Event::VCenterDecrease, "Move display up", "" },
{ Event::VCenterIncrease, "Move display down", "" },
{ Event::FormatDecrease, "Decrease display format", "" },
@ -2064,7 +2057,7 @@ const Event::EventSet EventHandler::AudioVideoEvents = {
Event::PhosphorDecrease, Event::PhosphorIncrease, Event::TogglePhosphor,
Event::FormatDecrease, Event::FormatIncrease,
Event::VCenterDecrease, Event::VCenterIncrease,
Event::ScanlineAdjustDecrease, Event::ScanlineAdjustIncrease,
Event::VSizeAdjustDecrease, Event::VSizeAdjustIncrease,
Event::OverscanDecrease, Event::OverscanIncrease,
Event::PaletteDecrease, Event::PaletteIncrease,
Event::PreviousVideoMode, Event::NextVideoMode,

View File

@ -1106,9 +1106,14 @@ void FrameBuffer::enableGrabMouse(bool enable)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::toggleGrabMouse()
{
const bool oldState = myGrabMouse;
myGrabMouse = !myGrabMouse;
setCursorState();
myOSystem.settings().setValue("grabmouse", myGrabMouse);
myOSystem.frameBuffer().showMessage(oldState != myGrabMouse ? myGrabMouse
? "Grab mouse enabled" : "Grab mouse disabled"
: "Grab mouse not allowed while cursor shown");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -257,7 +257,10 @@ void TIASurface::setScanlineIntensity(int amount)
myOSystem.settings().setValue("tv.scanlines", intensity);
enableNTSC(ntscEnabled());
buf << intensity << "%";
if(intensity)
buf << intensity << "%";
else
buf << "Off";
myFB.showMessage("Scanline intensity", buf.str(), intensity);
}