mirror of https://github.com/stella-emu/stella.git
Second pass at fixes for suggestions from clang-tidy.
This commit is contained in:
parent
faf7e8b775
commit
fc0a8c91a8
|
@ -51,7 +51,7 @@ bool BankRomCheat::disable()
|
||||||
myOSystem.console().cartridge().bank(bank);
|
myOSystem.console().cartridge().bank(bank);
|
||||||
|
|
||||||
for(int i = 0; i < count; ++i)
|
for(int i = 0; i < count; ++i)
|
||||||
myOSystem.console().cartridge().patch(address + i, savedRom[i]);
|
myOSystem.console().cartridge().patch(address + i, savedRom[i]);
|
||||||
|
|
||||||
myOSystem.console().cartridge().bank(oldBank);
|
myOSystem.console().cartridge().bank(oldBank);
|
||||||
|
|
||||||
|
|
|
@ -133,9 +133,9 @@ void CheatCodeDialog::loadConfig()
|
||||||
myCheatList->setList(l, b);
|
myCheatList->setList(l, b);
|
||||||
|
|
||||||
// Redraw the list, auto-selecting the first item if possible
|
// Redraw the list, auto-selecting the first item if possible
|
||||||
myCheatList->setSelected(l.size() > 0 ? 0 : -1);
|
myCheatList->setSelected(!l.empty() ? 0 : -1);
|
||||||
|
|
||||||
const bool enabled = (list.size() > 0);
|
const bool enabled = !list.empty();
|
||||||
myEditButton->setEnabled(enabled);
|
myEditButton->setEnabled(enabled);
|
||||||
myRemoveButton->setEnabled(enabled);
|
myRemoveButton->setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ void CheatCodeDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
{
|
{
|
||||||
const string& name = myCheatInput->getResult(0);
|
const string& name = myCheatInput->getResult(0);
|
||||||
const string& code = myCheatInput->getResult(1);
|
const string& code = myCheatInput->getResult(1);
|
||||||
if(instance().cheat().isValidCode(code))
|
if(CheatManager::isValidCode(code))
|
||||||
{
|
{
|
||||||
myCheatInput->close();
|
myCheatInput->close();
|
||||||
instance().cheat().add(name, code);
|
instance().cheat().add(name, code);
|
||||||
|
@ -250,7 +250,7 @@ void CheatCodeDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
const string& code = myCheatInput->getResult(1);
|
const string& code = myCheatInput->getResult(1);
|
||||||
const bool enable = myCheatList->getSelectedState();
|
const bool enable = myCheatList->getSelectedState();
|
||||||
const int idx = myCheatList->getSelected();
|
const int idx = myCheatList->getSelected();
|
||||||
if(instance().cheat().isValidCode(code))
|
if(CheatManager::isValidCode(code))
|
||||||
{
|
{
|
||||||
myCheatInput->close();
|
myCheatInput->close();
|
||||||
instance().cheat().add(name, code, enable, idx);
|
instance().cheat().add(name, code, enable, idx);
|
||||||
|
@ -273,7 +273,7 @@ void CheatCodeDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
{
|
{
|
||||||
const string& name = myCheatInput->getResult(0);
|
const string& name = myCheatInput->getResult(0);
|
||||||
const string& code = myCheatInput->getResult(1);
|
const string& code = myCheatInput->getResult(1);
|
||||||
if(instance().cheat().isValidCode(code))
|
if(CheatManager::isValidCode(code))
|
||||||
{
|
{
|
||||||
myCheatInput->close();
|
myCheatInput->close();
|
||||||
instance().cheat().addOneShot(name, code);
|
instance().cheat().addOneShot(name, code);
|
||||||
|
|
|
@ -272,11 +272,11 @@ void CheatManager::loadCheats(const string& md5sum)
|
||||||
// Set up any cheatcodes that was on the command line
|
// Set up any cheatcodes that was on the command line
|
||||||
// (and remove the key from the settings, so they won't get set again)
|
// (and remove the key from the settings, so they won't get set again)
|
||||||
const string& cheats = myOSystem.settings().getString("cheat");
|
const string& cheats = myOSystem.settings().getString("cheat");
|
||||||
if(cheats != "")
|
if(!cheats.empty())
|
||||||
myOSystem.settings().setValue("cheat", "");
|
myOSystem.settings().setValue("cheat", "");
|
||||||
|
|
||||||
const auto& iter = myCheatMap.find(md5sum);
|
const auto& iter = myCheatMap.find(md5sum);
|
||||||
if(iter == myCheatMap.end() && cheats == "")
|
if(iter == myCheatMap.end() && cheats.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Remember the cheats for this ROM
|
// Remember the cheats for this ROM
|
||||||
|
@ -311,7 +311,7 @@ void CheatManager::saveCheats(const string& md5sum)
|
||||||
myCheatMap.erase(iter);
|
myCheatMap.erase(iter);
|
||||||
|
|
||||||
// Add new entry only if there are any cheats defined
|
// Add new entry only if there are any cheats defined
|
||||||
if(cheats.str() != "")
|
if(!cheats.str().empty())
|
||||||
myCheatMap.emplace(md5sum, cheats.str());
|
myCheatMap.emplace(md5sum, cheats.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@ void CheatManager::saveCheats(const string& md5sum)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool CheatManager::isValidCode(const string& code) const
|
bool CheatManager::isValidCode(const string& code)
|
||||||
{
|
{
|
||||||
for(const auto c: code)
|
for(const auto c: code)
|
||||||
if(!isxdigit(c))
|
if(!isxdigit(c))
|
||||||
|
|
|
@ -121,7 +121,7 @@ class CheatManager
|
||||||
/**
|
/**
|
||||||
Checks if a code is valid.
|
Checks if a code is valid.
|
||||||
*/
|
*/
|
||||||
bool isValidCode(const string& code) const;
|
static bool isValidCode(const string& code);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -97,8 +97,7 @@ void FBBackendSDL2::queryHardware(vector<Common::Size>& fullscreenRes,
|
||||||
s << "Supported video modes (" << numModes << ") for display " << i
|
s << "Supported video modes (" << numModes << ") for display " << i
|
||||||
<< " (" << SDL_GetDisplayName(i) << "):";
|
<< " (" << SDL_GetDisplayName(i) << "):";
|
||||||
|
|
||||||
string lastRes = "";
|
string lastRes;
|
||||||
|
|
||||||
for(int m = 0; m < numModes; ++m)
|
for(int m = 0; m < numModes; ++m)
|
||||||
{
|
{
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
|
@ -428,7 +427,7 @@ bool FBBackendSDL2::createRenderer()
|
||||||
if(myRenderer)
|
if(myRenderer)
|
||||||
SDL_DestroyRenderer(myRenderer);
|
SDL_DestroyRenderer(myRenderer);
|
||||||
|
|
||||||
if(video != "")
|
if(!video.empty())
|
||||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER, video.c_str());
|
SDL_SetHint(SDL_HINT_RENDER_DRIVER, video.c_str());
|
||||||
|
|
||||||
myRenderer = SDL_CreateRenderer(myWindow, -1, renderFlags);
|
myRenderer = SDL_CreateRenderer(myWindow, -1, renderFlags);
|
||||||
|
@ -567,7 +566,7 @@ unique_ptr<FBSurface> FBBackendSDL2::createSurface(
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void FBBackendSDL2::readPixels(uInt8* pixels, size_t pitch,
|
void FBBackendSDL2::readPixels(uInt8* buffer, size_t pitch,
|
||||||
const Common::Rect& rect) const
|
const Common::Rect& rect) const
|
||||||
{
|
{
|
||||||
ASSERT_MAIN_THREAD;
|
ASSERT_MAIN_THREAD;
|
||||||
|
@ -576,7 +575,7 @@ void FBBackendSDL2::readPixels(uInt8* pixels, size_t pitch,
|
||||||
r.x = rect.x(); r.y = rect.y();
|
r.x = rect.x(); r.y = rect.y();
|
||||||
r.w = rect.w(); r.h = rect.h();
|
r.w = rect.w(); r.h = rect.h();
|
||||||
|
|
||||||
SDL_RenderReadPixels(myRenderer, &r, 0, pixels, static_cast<int>(pitch));
|
SDL_RenderReadPixels(myRenderer, &r, 0, buffer, static_cast<int>(pitch));
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -131,7 +131,7 @@ void FSNodeZIP::setFlags(const string& zipfile, const string& virtualpath,
|
||||||
_shortPath = _realNode->getShortPath();
|
_shortPath = _realNode->getShortPath();
|
||||||
|
|
||||||
// Is a file component present?
|
// Is a file component present?
|
||||||
if(_virtualPath.size() != 0)
|
if(!_virtualPath.empty())
|
||||||
{
|
{
|
||||||
_path += ("/" + _virtualPath);
|
_path += ("/" + _virtualPath);
|
||||||
_shortPath += ("/" + _virtualPath);
|
_shortPath += ("/" + _virtualPath);
|
||||||
|
@ -190,7 +190,7 @@ bool FSNodeZIP::getChildren(AbstractFSList& myList, ListMode mode) const
|
||||||
{
|
{
|
||||||
// First strip off the leading directory
|
// First strip off the leading directory
|
||||||
const string& curr = name.substr(
|
const string& curr = name.substr(
|
||||||
_virtualPath == "" ? 0 : _virtualPath.size()+1);
|
_virtualPath.empty() ? 0 : _virtualPath.size()+1);
|
||||||
// cerr << " curr: " << curr << endl;
|
// cerr << " curr: " << curr << endl;
|
||||||
// Only add sub-directory entries once
|
// Only add sub-directory entries once
|
||||||
const auto pos = curr.find_first_of("/\\");
|
const auto pos = curr.find_first_of("/\\");
|
||||||
|
@ -203,7 +203,7 @@ bool FSNodeZIP::getChildren(AbstractFSList& myList, ListMode mode) const
|
||||||
for(const auto& dir: dirs)
|
for(const auto& dir: dirs)
|
||||||
{
|
{
|
||||||
// Prepend previous path
|
// Prepend previous path
|
||||||
const string& vpath = _virtualPath != "" ? _virtualPath + "/" + dir : dir;
|
const string& vpath = !_virtualPath.empty() ? _virtualPath + "/" + dir : dir;
|
||||||
myList.emplace_back(new FSNodeZIP(_zipFile, vpath, _realNode, 0, true));
|
myList.emplace_back(new FSNodeZIP(_zipFile, vpath, _realNode, 0, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ bool FSNodeZIP::getChildren(AbstractFSList& myList, ListMode mode) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
size_t FSNodeZIP::read(ByteBuffer& image, size_t) const
|
size_t FSNodeZIP::read(ByteBuffer& buffer, size_t) const
|
||||||
{
|
{
|
||||||
switch(_error)
|
switch(_error)
|
||||||
{
|
{
|
||||||
|
@ -234,24 +234,24 @@ size_t FSNodeZIP::read(ByteBuffer& image, size_t) const
|
||||||
found = name == _virtualPath;
|
found = name == _virtualPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
return found ? myZipHandler->decompress(image) : 0;
|
return found ? myZipHandler->decompress(buffer) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
size_t FSNodeZIP::read(stringstream& image) const
|
size_t FSNodeZIP::read(stringstream& buffer) const
|
||||||
{
|
{
|
||||||
// For now, we just read into a buffer and store in the stream
|
// For now, we just read into a buffer and store in the stream
|
||||||
// TODO: maybe there's a more efficient way to do this?
|
// TODO: maybe there's a more efficient way to do this?
|
||||||
ByteBuffer buffer;
|
ByteBuffer read_buf;
|
||||||
const size_t size = read(buffer, 0);
|
const size_t size = read(read_buf, 0);
|
||||||
if(size > 0)
|
if(size > 0)
|
||||||
image.write(reinterpret_cast<char*>(buffer.get()), size);
|
buffer.write(reinterpret_cast<char*>(read_buf.get()), size);
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
size_t FSNodeZIP::write(const ByteBuffer& buffer, size_t size) const
|
size_t FSNodeZIP::write(const ByteBuffer& buffer, size_t) const
|
||||||
{
|
{
|
||||||
// TODO: Not yet implemented
|
// TODO: Not yet implemented
|
||||||
throw runtime_error("ZIP file not writable");
|
throw runtime_error("ZIP file not writable");
|
||||||
|
@ -267,7 +267,7 @@ size_t FSNodeZIP::write(const stringstream& buffer) const
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
AbstractFSNodePtr FSNodeZIP::getParent() const
|
AbstractFSNodePtr FSNodeZIP::getParent() const
|
||||||
{
|
{
|
||||||
if(_virtualPath == "")
|
if(_virtualPath.empty())
|
||||||
return _realNode ? _realNode->getParent() : nullptr;
|
return _realNode ? _realNode->getParent() : nullptr;
|
||||||
|
|
||||||
const char* start = _path.c_str();
|
const char* start = _path.c_str();
|
||||||
|
|
|
@ -63,9 +63,9 @@ class FSNodeZIP : public AbstractFSNode
|
||||||
bool getChildren(AbstractFSList& list, ListMode mode) const override;
|
bool getChildren(AbstractFSList& list, ListMode mode) const override;
|
||||||
AbstractFSNodePtr getParent() const override;
|
AbstractFSNodePtr getParent() const override;
|
||||||
|
|
||||||
size_t read(ByteBuffer& buffer, size_t size) const override;
|
size_t read(ByteBuffer& buffer, size_t) const override;
|
||||||
size_t read(stringstream& buffer) const override;
|
size_t read(stringstream& buffer) const override;
|
||||||
size_t write(const ByteBuffer& buffer, size_t size) const override;
|
size_t write(const ByteBuffer& buffer, size_t) const override;
|
||||||
size_t write(const stringstream& buffer) const override;
|
size_t write(const stringstream& buffer) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -85,7 +85,7 @@ Int16 HighScoresManager::peek(uInt16 addr) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
const json HighScoresManager::properties(const Properties& props) const
|
json HighScoresManager::properties(const Properties& props)
|
||||||
{
|
{
|
||||||
const string& property = props.get(PropType::Cart_Highscore);
|
const string& property = props.get(PropType::Cart_Highscore);
|
||||||
|
|
||||||
|
@ -95,7 +95,6 @@ const json HighScoresManager::properties(const Properties& props) const
|
||||||
return json::parse(property);
|
return json::parse(property);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
json HighScoresManager::properties(json& jprops) const
|
json HighScoresManager::properties(json& jprops) const
|
||||||
{
|
{
|
||||||
|
@ -114,7 +113,6 @@ json HighScoresManager::properties(json& jprops) const
|
||||||
return jprops = properties(props);
|
return jprops = properties(props);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool HighScoresManager::enabled() const
|
bool HighScoresManager::enabled() const
|
||||||
{
|
{
|
||||||
|
@ -124,12 +122,11 @@ bool HighScoresManager::enabled() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt32 HighScoresManager::numVariations(const json& jprops) const
|
uInt32 HighScoresManager::numVariations(const json& jprops)
|
||||||
{
|
{
|
||||||
return min(getPropInt(jprops, VARIATIONS_COUNT, DEFAULT_VARIATION), MAX_VARIATIONS);
|
return min(getPropInt(jprops, VARIATIONS_COUNT, DEFAULT_VARIATION), MAX_VARIATIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool HighScoresManager::get(const Properties& props, uInt32& numVariationsR,
|
bool HighScoresManager::get(const Properties& props, uInt32& numVariationsR,
|
||||||
ScoresProps& info) const
|
ScoresProps& info) const
|
||||||
|
@ -159,7 +156,7 @@ bool HighScoresManager::get(const Properties& props, uInt32& numVariationsR,
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void HighScoresManager::set(Properties& props, uInt32 numVariations,
|
void HighScoresManager::set(Properties& props, uInt32 numVariations,
|
||||||
const ScoresProps& info) const
|
const ScoresProps& info)
|
||||||
{
|
{
|
||||||
json jprops = json::object();
|
json jprops = json::object();
|
||||||
|
|
||||||
|
@ -207,85 +204,79 @@ void HighScoresManager::set(Properties& props, uInt32 numVariations,
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt32 HighScoresManager::numDigits(const json& jprops) const
|
uInt32 HighScoresManager::numDigits(const json& jprops)
|
||||||
{
|
{
|
||||||
return min(getPropInt(jprops, SCORE_DIGITS, DEFAULT_DIGITS), MAX_SCORE_DIGITS);
|
return min(getPropInt(jprops, SCORE_DIGITS, DEFAULT_DIGITS), MAX_SCORE_DIGITS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt32 HighScoresManager::trailingZeroes(const json& jprops) const
|
uInt32 HighScoresManager::trailingZeroes(const json& jprops)
|
||||||
{
|
{
|
||||||
return min(getPropInt(jprops, SCORE_TRAILING_ZEROES, DEFAULT_TRAILING), MAX_TRAILING);
|
return min(getPropInt(jprops, SCORE_TRAILING_ZEROES, DEFAULT_TRAILING), MAX_TRAILING);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool HighScoresManager::scoreBCD(const json& jprops) const
|
bool HighScoresManager::scoreBCD(const json& jprops)
|
||||||
{
|
{
|
||||||
return getPropBool(jprops, SCORE_BCD, DEFAULT_SCORE_BCD);
|
return getPropBool(jprops, SCORE_BCD, DEFAULT_SCORE_BCD);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool HighScoresManager::scoreInvert(const json& jprops) const
|
bool HighScoresManager::scoreInvert(const json& jprops)
|
||||||
{
|
{
|
||||||
return getPropBool(jprops, SCORE_INVERTED, DEFAULT_SCORE_REVERSED);
|
return getPropBool(jprops, SCORE_INVERTED, DEFAULT_SCORE_REVERSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool HighScoresManager::varBCD(const json& jprops) const
|
bool HighScoresManager::varBCD(const json& jprops)
|
||||||
{
|
{
|
||||||
return getPropBool(jprops, VARIATIONS_BCD, DEFAULT_VARS_BCD);
|
return getPropBool(jprops, VARIATIONS_BCD, DEFAULT_VARS_BCD);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool HighScoresManager::varZeroBased(const json& jprops) const
|
bool HighScoresManager::varZeroBased(const json& jprops)
|
||||||
{
|
{
|
||||||
return getPropBool(jprops, VARIATIONS_ZERO_BASED, DEFAULT_VARS_ZERO_BASED);
|
return getPropBool(jprops, VARIATIONS_ZERO_BASED, DEFAULT_VARS_ZERO_BASED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
const string HighScoresManager::specialLabel(const json& jprops) const
|
string HighScoresManager::specialLabel(const json& jprops)
|
||||||
{
|
{
|
||||||
return getPropStr(jprops, SPECIAL_LABEL);
|
return getPropStr(jprops, SPECIAL_LABEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool HighScoresManager::specialBCD(const json& jprops) const
|
bool HighScoresManager::specialBCD(const json& jprops)
|
||||||
{
|
{
|
||||||
return getPropBool(jprops, SPECIAL_BCD, DEFAULT_SPECIAL_BCD);
|
return getPropBool(jprops, SPECIAL_BCD, DEFAULT_SPECIAL_BCD);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool HighScoresManager::specialZeroBased(const json& jprops) const
|
bool HighScoresManager::specialZeroBased(const json& jprops)
|
||||||
{
|
{
|
||||||
return getPropBool(jprops, SPECIAL_ZERO_BASED, DEFAULT_SPECIAL_ZERO_BASED);
|
return getPropBool(jprops, SPECIAL_ZERO_BASED, DEFAULT_SPECIAL_ZERO_BASED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
const string HighScoresManager::notes(const json& jprops) const
|
string HighScoresManager::notes(const json& jprops)
|
||||||
{
|
{
|
||||||
return getPropStr(jprops, NOTES);
|
return getPropStr(jprops, NOTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt16 HighScoresManager::varAddress(const json& jprops) const
|
uInt16 HighScoresManager::varAddress(const json& jprops)
|
||||||
{
|
{
|
||||||
return getPropAddr(jprops, VARIATIONS_ADDRESS, DEFAULT_ADDRESS);
|
return getPropAddr(jprops, VARIATIONS_ADDRESS, DEFAULT_ADDRESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt16 HighScoresManager::specialAddress(const json& jprops) const
|
uInt16 HighScoresManager::specialAddress(const json& jprops)
|
||||||
{
|
{
|
||||||
return getPropAddr(jprops, SPECIAL_ADDRESS, DEFAULT_ADDRESS);
|
return getPropAddr(jprops, SPECIAL_ADDRESS, DEFAULT_ADDRESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt32 HighScoresManager::numAddrBytes(Int32 digits, Int32 trailing) const
|
uInt32 HighScoresManager::numAddrBytes(const json& jprops)
|
||||||
{
|
|
||||||
return (digits - trailing + 1) / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
uInt32 HighScoresManager::numAddrBytes(const json& jprops) const
|
|
||||||
{
|
{
|
||||||
return numAddrBytes(numDigits(jprops), trailingZeroes(jprops));
|
return numAddrBytes(numDigits(jprops), trailingZeroes(jprops));
|
||||||
}
|
}
|
||||||
|
@ -299,7 +290,7 @@ Int32 HighScoresManager::numVariations() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
const string HighScoresManager::specialLabel() const
|
string HighScoresManager::specialLabel() const
|
||||||
{
|
{
|
||||||
json jprops;
|
json jprops;
|
||||||
|
|
||||||
|
@ -379,7 +370,7 @@ Int32 HighScoresManager::score() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
const string HighScoresManager::formattedScore(Int32 score, Int32 width) const
|
string HighScoresManager::formattedScore(Int32 score, Int32 width) const
|
||||||
{
|
{
|
||||||
if(score <= 0)
|
if(score <= 0)
|
||||||
return "";
|
return "";
|
||||||
|
@ -403,6 +394,7 @@ const string HighScoresManager::formattedScore(Int32 score, Int32 width) const
|
||||||
return buf.str();
|
return buf.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string HighScoresManager::md5Props() const
|
string HighScoresManager::md5Props() const
|
||||||
{
|
{
|
||||||
json jprops;
|
json jprops;
|
||||||
|
@ -425,6 +417,7 @@ string HighScoresManager::md5Props() const
|
||||||
return MD5::hash(buf.str());
|
return MD5::hash(buf.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool HighScoresManager::scoreInvert() const
|
bool HighScoresManager::scoreInvert() const
|
||||||
{
|
{
|
||||||
json jprops;
|
json jprops;
|
||||||
|
@ -455,7 +448,7 @@ Int32 HighScoresManager::special() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
const string HighScoresManager::notes() const
|
string HighScoresManager::notes() const
|
||||||
{
|
{
|
||||||
json jprops;
|
json jprops;
|
||||||
|
|
||||||
|
@ -463,7 +456,8 @@ const string HighScoresManager::notes() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Int32 HighScoresManager::convert(Int32 val, uInt32 maxVal, bool isBCD, bool zeroBased) const
|
Int32 HighScoresManager::convert(Int32 val, uInt32 maxVal, bool isBCD,
|
||||||
|
bool zeroBased)
|
||||||
{
|
{
|
||||||
//maxVal += zeroBased ? 0 : 1;
|
//maxVal += zeroBased ? 0 : 1;
|
||||||
maxVal -= zeroBased ? 1 : 0;
|
maxVal -= zeroBased ? 1 : 0;
|
||||||
|
@ -487,29 +481,28 @@ Int32 HighScoresManager::convert(Int32 val, uInt32 maxVal, bool isBCD, bool zero
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool HighScoresManager::getPropBool(const json& jprops, const string& key,
|
bool HighScoresManager::getPropBool(const json& jprops, const string& key,
|
||||||
bool defVal) const
|
bool defVal)
|
||||||
{
|
{
|
||||||
return jprops.contains(key) ? jprops.at(key).get<bool>() : defVal;
|
return jprops.contains(key) ? jprops.at(key).get<bool>() : defVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt32 HighScoresManager::getPropInt(const json& jprops, const string& key,
|
uInt32 HighScoresManager::getPropInt(const json& jprops, const string& key,
|
||||||
uInt32 defVal) const
|
uInt32 defVal)
|
||||||
{
|
{
|
||||||
return jprops.contains(key) ? jprops.at(key).get<uInt32>() : defVal;
|
return jprops.contains(key) ? jprops.at(key).get<uInt32>() : defVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
const string HighScoresManager::getPropStr(const json& jprops, const string& key,
|
string HighScoresManager::getPropStr(const json& jprops, const string& key,
|
||||||
const string& defVal) const
|
const string& defVal)
|
||||||
{
|
{
|
||||||
return jprops.contains(key) ? jprops.at(key).get<string>() : defVal;
|
return jprops.contains(key) ? jprops.at(key).get<string>() : defVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt16 HighScoresManager::getPropAddr(const json& jprops, const string& key,
|
uInt16 HighScoresManager::getPropAddr(const json& jprops, const string& key,
|
||||||
uInt16 defVal) const
|
uInt16 defVal)
|
||||||
{
|
{
|
||||||
const string str = getPropStr(jprops, key);
|
const string str = getPropStr(jprops, key);
|
||||||
|
|
||||||
|
@ -517,7 +510,7 @@ uInt16 HighScoresManager::getPropAddr(const json& jprops, const string& key,
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
const HSM::ScoreAddresses HighScoresManager::getPropScoreAddr(const json& jprops) const
|
HSM::ScoreAddresses HighScoresManager::getPropScoreAddr(const json& jprops)
|
||||||
{
|
{
|
||||||
ScoreAddresses scoreAddr{};
|
ScoreAddresses scoreAddr{};
|
||||||
|
|
||||||
|
@ -544,7 +537,7 @@ const HSM::ScoreAddresses HighScoresManager::getPropScoreAddr(const json& jprops
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt16 HighScoresManager::fromHexStr(const string& addr) const
|
uInt16 HighScoresManager::fromHexStr(const string& addr)
|
||||||
{
|
{
|
||||||
string naked = addr;
|
string naked = addr;
|
||||||
|
|
||||||
|
@ -555,7 +548,7 @@ uInt16 HighScoresManager::fromHexStr(const string& addr) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Int32 HighScoresManager::fromBCD(uInt8 bcd) const
|
Int32 HighScoresManager::fromBCD(uInt8 bcd)
|
||||||
{
|
{
|
||||||
// verify if score is legit
|
// verify if score is legit
|
||||||
if ((bcd & 0xF0) >= 0xA0 || (bcd & 0xF) >= 0xA)
|
if ((bcd & 0xF0) >= 0xA0 || (bcd & 0xF) >= 0xA)
|
||||||
|
|
|
@ -112,8 +112,8 @@ class HighScoresManager
|
||||||
/**
|
/**
|
||||||
Set the highscore data of game's properties
|
Set the highscore data of game's properties
|
||||||
*/
|
*/
|
||||||
void set(Properties& props, uInt32 numVariations,
|
static void set(Properties& props, uInt32 numVariations,
|
||||||
const HSM::ScoresProps& info) const;
|
const HSM::ScoresProps& info);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Calculate the score from given parameters
|
Calculate the score from given parameters
|
||||||
|
@ -125,24 +125,26 @@ class HighScoresManager
|
||||||
|
|
||||||
// Convert the given value, using only the maximum bits required by maxVal
|
// Convert the given value, using only the maximum bits required by maxVal
|
||||||
// and adjusted for BCD and zero based data
|
// and adjusted for BCD and zero based data
|
||||||
Int32 convert(Int32 val, uInt32 maxVal, bool isBCD, bool zeroBased) const;
|
static Int32 convert(Int32 val, uInt32 maxVal, bool isBCD, bool zeroBased);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Calculate the number of bytes for one player's score from given parameters
|
Calculate the number of bytes for one player's score from given parameters
|
||||||
|
|
||||||
@return The number of score address bytes
|
@return The number of score address bytes
|
||||||
*/
|
*/
|
||||||
uInt32 numAddrBytes(Int32 digits, Int32 trailing) const;
|
static uInt32 numAddrBytes(Int32 digits, Int32 trailing) {
|
||||||
|
return (digits - trailing + 1) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
// Retrieve current values (using game's properties)
|
// Retrieve current values (using game's properties)
|
||||||
Int32 numVariations() const;
|
Int32 numVariations() const;
|
||||||
const string specialLabel() const;
|
string specialLabel() const;
|
||||||
Int32 variation() const;
|
Int32 variation() const;
|
||||||
Int32 score() const;
|
Int32 score() const;
|
||||||
const string formattedScore(Int32 score, Int32 width = -1) const;
|
string formattedScore(Int32 score, Int32 width = -1) const;
|
||||||
bool scoreInvert() const;
|
bool scoreInvert() const;
|
||||||
Int32 special() const;
|
Int32 special() const;
|
||||||
const string notes() const;
|
string notes() const;
|
||||||
|
|
||||||
// Get md5 property definition checksum
|
// Get md5 property definition checksum
|
||||||
string md5Props() const;
|
string md5Props() const;
|
||||||
|
@ -150,8 +152,8 @@ class HighScoresManager
|
||||||
// Peek into memory
|
// Peek into memory
|
||||||
Int16 peek(uInt16 addr) const;
|
Int16 peek(uInt16 addr) const;
|
||||||
|
|
||||||
void loadHighScores(HSM::ScoresData& scores);
|
void loadHighScores(HSM::ScoresData& data);
|
||||||
void saveHighScores(HSM::ScoresData& scores) const;
|
void saveHighScores(HSM::ScoresData& data) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const string VARIATIONS_COUNT;
|
static const string VARIATIONS_COUNT;
|
||||||
|
@ -198,53 +200,53 @@ class HighScoresManager
|
||||||
Int32 variation(uInt16 addr, bool varBCD, bool zeroBased, uInt32 numVariations) const;
|
Int32 variation(uInt16 addr, bool varBCD, bool zeroBased, uInt32 numVariations) const;
|
||||||
|
|
||||||
// Get individual highscore info from properties
|
// Get individual highscore info from properties
|
||||||
uInt32 numVariations(const json& jprops) const;
|
static uInt32 numVariations(const json& jprops);
|
||||||
uInt16 varAddress(const json& jprops) const;
|
static uInt16 varAddress(const json& jprops);
|
||||||
uInt16 specialAddress(const json& jprops) const;
|
static uInt16 specialAddress(const json& jprops);
|
||||||
uInt32 numDigits(const json& jprops) const;
|
static uInt32 numDigits(const json& jprops);
|
||||||
uInt32 trailingZeroes(const json& jprops) const;
|
static uInt32 trailingZeroes(const json& jprops);
|
||||||
bool scoreBCD(const json& jprops) const;
|
static bool scoreBCD(const json& jprops);
|
||||||
bool scoreInvert(const json& jprops) const;
|
static bool scoreInvert(const json& jprops);
|
||||||
bool varBCD(const json& jprops) const;
|
static bool varBCD(const json& jprops);
|
||||||
bool varZeroBased(const json& jprops) const;
|
static bool varZeroBased(const json& jprops);
|
||||||
const string specialLabel(const json& jprops) const;
|
static string specialLabel(const json& jprops);
|
||||||
bool specialBCD(const json& jprops) const;
|
static bool specialBCD(const json& jprops);
|
||||||
bool specialZeroBased(const json& jprops) const;
|
static bool specialZeroBased(const json& jprops);
|
||||||
const string notes(const json& jprops) const;
|
static string notes(const json& jprops);
|
||||||
|
|
||||||
// Calculate the number of bytes for one player's score from property parameters
|
// Calculate the number of bytes for one player's score from property parameters
|
||||||
uInt32 numAddrBytes(const json& jprops) const;
|
static uInt32 numAddrBytes(const json& jprops);
|
||||||
|
|
||||||
// Get properties
|
// Get properties
|
||||||
const json properties(const Properties& props) const;
|
static json properties(const Properties& props);
|
||||||
json properties(json& jprops) const;
|
json properties(json& jprops) const;
|
||||||
|
|
||||||
// Get value from highscore properties for given key
|
// Get value from highscore properties for given key
|
||||||
bool getPropBool(const json& jprops, const string& key,
|
static bool getPropBool(const json& jprops, const string& key,
|
||||||
bool defVal = false) const;
|
bool defVal = false);
|
||||||
uInt32 getPropInt(const json& jprops, const string& key,
|
static uInt32 getPropInt(const json& jprops, const string& key,
|
||||||
uInt32 defVal = 0) const;
|
uInt32 defVal = 0);
|
||||||
const string getPropStr(const json& jprops, const string& key,
|
static string getPropStr(const json& jprops, const string& key,
|
||||||
const string& defVal = "") const;
|
const string& defVal = "");
|
||||||
uInt16 getPropAddr(const json& jprops, const string& key,
|
static uInt16 getPropAddr(const json& jprops, const string& key,
|
||||||
uInt16 defVal = 0) const;
|
uInt16 defVal = 0);
|
||||||
const HSM::ScoreAddresses getPropScoreAddr(const json& jprops) const;
|
static HSM::ScoreAddresses getPropScoreAddr(const json& jprops);
|
||||||
|
|
||||||
uInt16 fromHexStr(const string& addr) const;
|
static uInt16 fromHexStr(const string& addr);
|
||||||
Int32 fromBCD(uInt8 bcd) const;
|
static Int32 fromBCD(uInt8 bcd);
|
||||||
string hash(const HSM::ScoresData& data) const;
|
string hash(const HSM::ScoresData& data) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Loads the current high scores for this game and variation from the given JSON object.
|
Loads the current high scores for this game and variation from the given JSON object.
|
||||||
|
|
||||||
@param hsData The JSON to parse
|
@param hsData The JSON to parse
|
||||||
@param scores The loaded high score data
|
@param data The loaded high score data
|
||||||
|
|
||||||
@return The result of the load. True on success, false on failure.
|
@return The result of the load. True on success, false on failure.
|
||||||
*/
|
*/
|
||||||
bool load(const json& hsData, HSM::ScoresData& scores);
|
static bool load(const json& hsData, HSM::ScoresData& data);
|
||||||
|
|
||||||
void clearHighScores(HSM::ScoresData& data);
|
static void clearHighScores(HSM::ScoresData& data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Reference to the osystem object
|
// Reference to the osystem object
|
||||||
|
|
|
@ -77,7 +77,7 @@ class JPGLibrary
|
||||||
@param filename The filename to load the JPG image
|
@param filename The filename to load the JPG image
|
||||||
@param metaData The meta data of the JPG image
|
@param metaData The meta data of the JPG image
|
||||||
*/
|
*/
|
||||||
void readMetaData(const string& filename, VariantList& metaData);
|
static void readMetaData(const string& filename, VariantList& metaData);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
|
|
|
@ -112,7 +112,7 @@ bool JoyMap::check(const EventMode mode, const int button,
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string JoyMap::getDesc(const Event::Type event, const JoyMapping& mapping) const
|
string JoyMap::getDesc(const Event::Type event, const JoyMapping& mapping)
|
||||||
{
|
{
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ string JoyMap::getEventMappingDesc(int stick, const Event::Type event, const Eve
|
||||||
{
|
{
|
||||||
if (_event == event && _mapping.mode == mode)
|
if (_event == event && _mapping.mode == mode)
|
||||||
{
|
{
|
||||||
if(buf.str() != "")
|
if(!buf.str().empty())
|
||||||
buf << ", ";
|
buf << ", ";
|
||||||
buf << "C" << stick << getDesc(event, _mapping);
|
buf << "C" << stick << getDesc(event, _mapping);
|
||||||
}
|
}
|
||||||
|
@ -193,26 +193,26 @@ json JoyMap::saveMapping(const EventMode mode) const
|
||||||
std::vector<MapType> sortedMap(myMap.begin(), myMap.end());
|
std::vector<MapType> sortedMap(myMap.begin(), myMap.end());
|
||||||
|
|
||||||
std::sort(sortedMap.begin(), sortedMap.end(),
|
std::sort(sortedMap.begin(), sortedMap.end(),
|
||||||
[](const MapType& a, const MapType& b)
|
[](const MapType& a, const MapType& b)
|
||||||
{
|
{
|
||||||
// Event::Type first
|
// Event::Type first
|
||||||
if(a.first.button != b.first.button)
|
if(a.first.button != b.first.button)
|
||||||
return a.first.button < b.first.button;
|
return a.first.button < b.first.button;
|
||||||
|
|
||||||
if(a.first.axis != b.first.axis)
|
if(a.first.axis != b.first.axis)
|
||||||
return a.first.axis < b.first.axis;
|
return a.first.axis < b.first.axis;
|
||||||
|
|
||||||
if(a.first.adir != b.first.adir)
|
if(a.first.adir != b.first.adir)
|
||||||
return a.first.adir < b.first.adir;
|
return a.first.adir < b.first.adir;
|
||||||
|
|
||||||
if(a.first.hat != b.first.hat)
|
if(a.first.hat != b.first.hat)
|
||||||
return a.first.hat < b.first.hat;
|
return a.first.hat < b.first.hat;
|
||||||
|
|
||||||
if(a.first.hdir != b.first.hdir)
|
if(a.first.hdir != b.first.hdir)
|
||||||
return a.first.hdir < b.first.hdir;
|
return a.first.hdir < b.first.hdir;
|
||||||
|
|
||||||
return a.second < b.second;
|
return a.second < b.second;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
json eventMappings = json::array();
|
json eventMappings = json::array();
|
||||||
|
|
|
@ -122,10 +122,10 @@ class JoyMap
|
||||||
void eraseEvent(const Event::Type event, const EventMode mode);
|
void eraseEvent(const Event::Type event, const EventMode mode);
|
||||||
/** clear all mappings for a modes */
|
/** clear all mappings for a modes */
|
||||||
// void clear() { myMap.clear(); }
|
// void clear() { myMap.clear(); }
|
||||||
size_t size() { return myMap.size(); }
|
size_t size() const { return myMap.size(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
string getDesc(const Event::Type event, const JoyMapping& mapping) const;
|
static string getDesc(const Event::Type event, const JoyMapping& mapping);
|
||||||
|
|
||||||
struct JoyHash {
|
struct JoyHash {
|
||||||
size_t operator()(const JoyMapping& m)const {
|
size_t operator()(const JoyMapping& m)const {
|
||||||
|
|
|
@ -135,7 +135,7 @@ bool KeyMap::check(const EventMode mode, const int key, const int mod) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string KeyMap::getDesc(const Mapping& mapping) const
|
string KeyMap::getDesc(const Mapping& mapping)
|
||||||
{
|
{
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
#if defined(BSPF_MACOS) || defined(MACOS_KEYS)
|
#if defined(BSPF_MACOS) || defined(MACOS_KEYS)
|
||||||
|
@ -184,7 +184,7 @@ string KeyMap::getDesc(const Mapping& mapping) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string KeyMap::getDesc(const EventMode mode, const int key, const int mod) const
|
string KeyMap::getDesc(const EventMode mode, const int key, const int mod)
|
||||||
{
|
{
|
||||||
return getDesc(Mapping(mode, key, mod));
|
return getDesc(Mapping(mode, key, mod));
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ string KeyMap::getEventMappingDesc(const Event::Type event, const EventMode mode
|
||||||
{
|
{
|
||||||
if (_event == event && _mapping.mode == mode)
|
if (_event == event && _mapping.mode == mode)
|
||||||
{
|
{
|
||||||
if(buf.str() != "")
|
if(!buf.str().empty())
|
||||||
buf << ", ";
|
buf << ", ";
|
||||||
buf << getDesc(_mapping);
|
buf << getDesc(_mapping);
|
||||||
}
|
}
|
||||||
|
@ -336,7 +336,7 @@ void KeyMap::eraseEvent(const Event::Type event, const EventMode mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
KeyMap::Mapping KeyMap::convertMod(const Mapping& mapping) const
|
KeyMap::Mapping KeyMap::convertMod(const Mapping& mapping)
|
||||||
{
|
{
|
||||||
Mapping m = mapping;
|
Mapping m = mapping;
|
||||||
|
|
||||||
|
|
|
@ -79,8 +79,8 @@ class KeyMap
|
||||||
bool check(const EventMode mode, const int key, const int mod) const;
|
bool check(const EventMode mode, const int key, const int mod) const;
|
||||||
|
|
||||||
/** Get mapping description */
|
/** Get mapping description */
|
||||||
string getDesc(const Mapping& mapping) const;
|
static string getDesc(const Mapping& mapping);
|
||||||
string getDesc(const EventMode mode, const int key, const int mod) const;
|
static string getDesc(const EventMode mode, const int key, const int mod);
|
||||||
|
|
||||||
/** Get the mapping description(s) for given event and mode */
|
/** Get the mapping description(s) for given event and mode */
|
||||||
string getEventMappingDesc(const Event::Type event, const EventMode mode) const;
|
string getEventMappingDesc(const Event::Type event, const EventMode mode) const;
|
||||||
|
@ -104,7 +104,7 @@ class KeyMap
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//** Convert modifiers */
|
//** Convert modifiers */
|
||||||
Mapping convertMod(const Mapping& mapping) const;
|
static Mapping convertMod(const Mapping& mapping);
|
||||||
|
|
||||||
struct KeyHash {
|
struct KeyHash {
|
||||||
size_t operator()(const Mapping& m) const {
|
size_t operator()(const Mapping& m) const {
|
||||||
|
|
|
@ -129,7 +129,7 @@ MouseControl::MouseControl(Console& console, const string& mode)
|
||||||
Paddles::setDigitalPaddleRange(m_range);
|
Paddles::setDigitalPaddleRange(m_range);
|
||||||
|
|
||||||
// If the mouse isn't used at all, we still need one item in the list
|
// If the mouse isn't used at all, we still need one item in the list
|
||||||
if(myModeList.size() == 0)
|
if(myModeList.empty())
|
||||||
myModeList.emplace_back("Mouse not used for current controllers");
|
myModeList.emplace_back("Mouse not used for current controllers");
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -73,7 +73,7 @@ class MouseControl
|
||||||
void addLeftControllerModes(bool noswap);
|
void addLeftControllerModes(bool noswap);
|
||||||
void addRightControllerModes(bool noswap);
|
void addRightControllerModes(bool noswap);
|
||||||
void addPaddleModes(int lport, int rport, int lname, int rname);
|
void addPaddleModes(int lport, int rport, int lname, int rname);
|
||||||
bool controllerSupportsMouse(Controller& controller);
|
static bool controllerSupportsMouse(Controller& controller);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Properties& myProps;
|
const Properties& myProps;
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "Logger.hxx"
|
|
||||||
#include "OSystem.hxx"
|
#include "OSystem.hxx"
|
||||||
#include "Console.hxx"
|
#include "Console.hxx"
|
||||||
#include "Joystick.hxx"
|
#include "Joystick.hxx"
|
||||||
|
@ -298,7 +297,7 @@ bool PhysicalJoystickHandler::mapStelladaptors(const string& saport, int ID)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool PhysicalJoystickHandler::hasStelladaptors() const
|
bool PhysicalJoystickHandler::hasStelladaptors() const
|
||||||
{
|
{
|
||||||
for(auto& [_id, _joyptr] : mySticks)
|
for(const auto& [_id, _joyptr] : mySticks)
|
||||||
{
|
{
|
||||||
// remove previously added emulated ports
|
// remove previously added emulated ports
|
||||||
const size_t pos = _joyptr->name.find(" (emulates ");
|
const size_t pos = _joyptr->name.find(" (emulates ");
|
||||||
|
@ -332,7 +331,7 @@ void PhysicalJoystickHandler::setDefaultAction(int stick,
|
||||||
{
|
{
|
||||||
// if there is no existing mapping for the event and
|
// if there is no existing mapping for the event and
|
||||||
// the default mapping for the event is unused, set default key for event
|
// the default mapping for the event is unused, set default key for event
|
||||||
if(j->joyMap.getEventMapping(map.event, mode).size() == 0 &&
|
if(j->joyMap.getEventMapping(map.event, mode).empty() &&
|
||||||
!j->joyMap.check(mode, map.button, map.axis, map.adir, map.hat, map.hdir))
|
!j->joyMap.check(mode, map.button, map.axis, map.adir, map.hat, map.hdir))
|
||||||
{
|
{
|
||||||
if (map.hat == JOY_CTRL_NONE)
|
if (map.hat == JOY_CTRL_NONE)
|
||||||
|
@ -353,8 +352,8 @@ void PhysicalJoystickHandler::setDefaultAction(int stick,
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void PhysicalJoystickHandler::setStickDefaultMapping(int stick, Event::Type event,
|
void PhysicalJoystickHandler::setStickDefaultMapping(
|
||||||
EventMode mode, bool updateDefaults)
|
int stick, Event::Type event, EventMode mode, bool updateDefaults)
|
||||||
{
|
{
|
||||||
const PhysicalJoystickPtr j = joy(stick);
|
const PhysicalJoystickPtr j = joy(stick);
|
||||||
|
|
||||||
|
@ -617,7 +616,8 @@ void PhysicalJoystickHandler::enableMapping(const Event::Type event, EventMode m
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
EventMode PhysicalJoystickHandler::getEventMode(const Event::Type event, const EventMode mode) const
|
EventMode PhysicalJoystickHandler::getEventMode(const Event::Type event,
|
||||||
|
const EventMode mode)
|
||||||
{
|
{
|
||||||
if(mode == EventMode::kEmulationMode)
|
if(mode == EventMode::kEmulationMode)
|
||||||
{
|
{
|
||||||
|
@ -641,35 +641,35 @@ EventMode PhysicalJoystickHandler::getEventMode(const Event::Type event, const E
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool PhysicalJoystickHandler::isJoystickEvent(const Event::Type event) const
|
bool PhysicalJoystickHandler::isJoystickEvent(const Event::Type event)
|
||||||
{
|
{
|
||||||
return LeftJoystickEvents.find(event) != LeftJoystickEvents.end()
|
return LeftJoystickEvents.find(event) != LeftJoystickEvents.end()
|
||||||
|| RightJoystickEvents.find(event) != RightJoystickEvents.end();
|
|| RightJoystickEvents.find(event) != RightJoystickEvents.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool PhysicalJoystickHandler::isPaddleEvent(const Event::Type event) const
|
bool PhysicalJoystickHandler::isPaddleEvent(const Event::Type event)
|
||||||
{
|
{
|
||||||
return LeftPaddlesEvents.find(event) != LeftPaddlesEvents.end()
|
return LeftPaddlesEvents.find(event) != LeftPaddlesEvents.end()
|
||||||
|| RightPaddlesEvents.find(event) != RightPaddlesEvents.end();
|
|| RightPaddlesEvents.find(event) != RightPaddlesEvents.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool PhysicalJoystickHandler::isKeyboardEvent(const Event::Type event) const
|
bool PhysicalJoystickHandler::isKeyboardEvent(const Event::Type event)
|
||||||
{
|
{
|
||||||
return LeftKeyboardEvents.find(event) != LeftKeyboardEvents.end()
|
return LeftKeyboardEvents.find(event) != LeftKeyboardEvents.end()
|
||||||
|| RightKeyboardEvents.find(event) != RightKeyboardEvents.end();
|
|| RightKeyboardEvents.find(event) != RightKeyboardEvents.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool PhysicalJoystickHandler::isDrivingEvent(const Event::Type event) const
|
bool PhysicalJoystickHandler::isDrivingEvent(const Event::Type event)
|
||||||
{
|
{
|
||||||
return LeftDrivingEvents.find(event) != LeftDrivingEvents.end()
|
return LeftDrivingEvents.find(event) != LeftDrivingEvents.end()
|
||||||
|| RightDrivingEvents.find(event) != RightDrivingEvents.end();
|
|| RightDrivingEvents.find(event) != RightDrivingEvents.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool PhysicalJoystickHandler::isCommonEvent(const Event::Type event) const
|
bool PhysicalJoystickHandler::isCommonEvent(const Event::Type event)
|
||||||
{
|
{
|
||||||
return !(isJoystickEvent(event) || isPaddleEvent(event) || isKeyboardEvent(event) || isDrivingEvent(event));
|
return !(isJoystickEvent(event) || isPaddleEvent(event) || isKeyboardEvent(event) || isDrivingEvent(event));
|
||||||
}
|
}
|
||||||
|
@ -732,9 +732,9 @@ string PhysicalJoystickHandler::getMappingDesc(Event::Type event, EventMode mode
|
||||||
if(_joyptr)
|
if(_joyptr)
|
||||||
{
|
{
|
||||||
//Joystick mapping / labeling
|
//Joystick mapping / labeling
|
||||||
if(_joyptr->joyMap.getEventMapping(event, evMode).size())
|
if(!_joyptr->joyMap.getEventMapping(event, evMode).empty())
|
||||||
{
|
{
|
||||||
if(buf.str() != "")
|
if(!buf.str().empty())
|
||||||
buf << ", ";
|
buf << ", ";
|
||||||
buf << _joyptr->joyMap.getEventMappingDesc(_id, event, evMode);
|
buf << _joyptr->joyMap.getEventMappingDesc(_id, event, evMode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ class PhysicalJoystickHandler
|
||||||
bool remove(const string& name);
|
bool remove(const string& name);
|
||||||
bool mapStelladaptors(const string& saport, int ID = -1);
|
bool mapStelladaptors(const string& saport, int ID = -1);
|
||||||
bool hasStelladaptors() const;
|
bool hasStelladaptors() const;
|
||||||
void setDefaultMapping(Event::Type type, EventMode mode);
|
void setDefaultMapping(Event::Type event, EventMode mode);
|
||||||
|
|
||||||
/** define mappings for current controllers */
|
/** define mappings for current controllers */
|
||||||
void defineControllerMappings(const Controller::Type type, Controller::Jack port);
|
void defineControllerMappings(const Controller::Type type, Controller::Jack port);
|
||||||
|
@ -150,7 +150,7 @@ class PhysicalJoystickHandler
|
||||||
void addToDatabase(const PhysicalJoystickPtr& stick);
|
void addToDatabase(const PhysicalJoystickPtr& stick);
|
||||||
|
|
||||||
// Set default mapping for given joystick when no mappings already exist
|
// Set default mapping for given joystick when no mappings already exist
|
||||||
void setStickDefaultMapping(int stick, Event::Type type, EventMode mode,
|
void setStickDefaultMapping(int stick, Event::Type event, EventMode mode,
|
||||||
bool updateDefaults = false);
|
bool updateDefaults = false);
|
||||||
|
|
||||||
friend ostream& operator<<(ostream& os, const PhysicalJoystickHandler& jh);
|
friend ostream& operator<<(ostream& os, const PhysicalJoystickHandler& jh);
|
||||||
|
@ -180,13 +180,13 @@ class PhysicalJoystickHandler
|
||||||
bool updateDefaults = false);
|
bool updateDefaults = false);
|
||||||
|
|
||||||
/** returns the event's controller mode */
|
/** returns the event's controller mode */
|
||||||
EventMode getEventMode(const Event::Type event, const EventMode mode) const;
|
static EventMode getEventMode(const Event::Type event, const EventMode mode);
|
||||||
/** Checks event type. */
|
/** Checks event type. */
|
||||||
bool isJoystickEvent(const Event::Type event) const;
|
static bool isJoystickEvent(const Event::Type event);
|
||||||
bool isPaddleEvent(const Event::Type event) const;
|
static bool isPaddleEvent(const Event::Type event);
|
||||||
bool isKeyboardEvent(const Event::Type event) const;
|
static bool isKeyboardEvent(const Event::Type event);
|
||||||
bool isDrivingEvent(const Event::Type event) const;
|
static bool isDrivingEvent(const Event::Type event);
|
||||||
bool isCommonEvent(const Event::Type event) const;
|
static bool isCommonEvent(const Event::Type event);
|
||||||
|
|
||||||
void enableCommonMappings();
|
void enableCommonMappings();
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ void PhysicalKeyboardHandler::setDefaultKey(EventMapping map, Event::Type event,
|
||||||
{
|
{
|
||||||
// if there is no existing mapping for the event and
|
// if there is no existing mapping for the event and
|
||||||
// the default mapping for the event is unused, set default key for event
|
// the default mapping for the event is unused, set default key for event
|
||||||
if (myKeyMap.getEventMapping(map.event, mode).size() == 0 &&
|
if (myKeyMap.getEventMapping(map.event, mode).empty() &&
|
||||||
!isMappingUsed(mode, map))
|
!isMappingUsed(mode, map))
|
||||||
{
|
{
|
||||||
addMapping(map.event, mode, map.key, static_cast<StellaMod>(map.mod));
|
addMapping(map.event, mode, map.key, static_cast<StellaMod>(map.mod));
|
||||||
|
@ -249,7 +249,8 @@ void PhysicalKeyboardHandler::defineControllerMappings(
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
EventMode PhysicalKeyboardHandler::getMode(const Properties& properties, const PropType propType)
|
EventMode PhysicalKeyboardHandler::getMode(const Properties& properties,
|
||||||
|
const PropType propType)
|
||||||
{
|
{
|
||||||
const string& propName = properties.get(propType);
|
const string& propName = properties.get(propType);
|
||||||
|
|
||||||
|
@ -403,7 +404,7 @@ void PhysicalKeyboardHandler::enableMapping(const Event::Type event,
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
EventMode PhysicalKeyboardHandler::getEventMode(const Event::Type event,
|
EventMode PhysicalKeyboardHandler::getEventMode(const Event::Type event,
|
||||||
const EventMode mode) const
|
const EventMode mode)
|
||||||
{
|
{
|
||||||
if (mode == EventMode::kEmulationMode)
|
if (mode == EventMode::kEmulationMode)
|
||||||
{
|
{
|
||||||
|
@ -427,7 +428,7 @@ EventMode PhysicalKeyboardHandler::getEventMode(const Event::Type event,
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool PhysicalKeyboardHandler::isJoystickEvent(const Event::Type event) const
|
bool PhysicalKeyboardHandler::isJoystickEvent(const Event::Type event)
|
||||||
{
|
{
|
||||||
return LeftJoystickEvents.find(event) != LeftJoystickEvents.end()
|
return LeftJoystickEvents.find(event) != LeftJoystickEvents.end()
|
||||||
|| QTJoystick3Events.find(event) != QTJoystick3Events.end()
|
|| QTJoystick3Events.find(event) != QTJoystick3Events.end()
|
||||||
|
@ -436,7 +437,7 @@ bool PhysicalKeyboardHandler::isJoystickEvent(const Event::Type event) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool PhysicalKeyboardHandler::isPaddleEvent(const Event::Type event) const
|
bool PhysicalKeyboardHandler::isPaddleEvent(const Event::Type event)
|
||||||
{
|
{
|
||||||
return LeftPaddlesEvents.find(event) != LeftPaddlesEvents.end()
|
return LeftPaddlesEvents.find(event) != LeftPaddlesEvents.end()
|
||||||
|| QTPaddles3Events.find(event) != QTPaddles3Events.end()
|
|| QTPaddles3Events.find(event) != QTPaddles3Events.end()
|
||||||
|
@ -445,21 +446,21 @@ bool PhysicalKeyboardHandler::isPaddleEvent(const Event::Type event) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool PhysicalKeyboardHandler::isDrivingEvent(const Event::Type event) const
|
bool PhysicalKeyboardHandler::isDrivingEvent(const Event::Type event)
|
||||||
{
|
{
|
||||||
return LeftDrivingEvents.find(event) != LeftDrivingEvents.end()
|
return LeftDrivingEvents.find(event) != LeftDrivingEvents.end()
|
||||||
|| RightDrivingEvents.find(event) != RightDrivingEvents.end();
|
|| RightDrivingEvents.find(event) != RightDrivingEvents.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool PhysicalKeyboardHandler::isKeyboardEvent(const Event::Type event) const
|
bool PhysicalKeyboardHandler::isKeyboardEvent(const Event::Type event)
|
||||||
{
|
{
|
||||||
return LeftKeyboardEvents.find(event) != LeftKeyboardEvents.end()
|
return LeftKeyboardEvents.find(event) != LeftKeyboardEvents.end()
|
||||||
|| RightKeyboardEvents.find(event) != RightKeyboardEvents.end();
|
|| RightKeyboardEvents.find(event) != RightKeyboardEvents.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool PhysicalKeyboardHandler::isCommonEvent(const Event::Type event) const
|
bool PhysicalKeyboardHandler::isCommonEvent(const Event::Type event)
|
||||||
{
|
{
|
||||||
return !(isJoystickEvent(event) || isPaddleEvent(event) || isKeyboardEvent(event));
|
return !(isJoystickEvent(event) || isPaddleEvent(event) || isKeyboardEvent(event));
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,10 +48,12 @@ class PhysicalKeyboardHandler
|
||||||
|
|
||||||
void loadSerializedMappings(const string& serializedMappings, EventMode mode);
|
void loadSerializedMappings(const string& serializedMappings, EventMode mode);
|
||||||
|
|
||||||
void setDefaultMapping(Event::Type type, EventMode mode, bool updateDefaults = false);
|
void setDefaultMapping(Event::Type event, EventMode mode,
|
||||||
|
bool updateDefaults = false);
|
||||||
|
|
||||||
/** define mappings for current controllers */
|
/** define mappings for current controllers */
|
||||||
void defineControllerMappings(const Controller::Type type, Controller::Jack port,
|
void defineControllerMappings(const Controller::Type type,
|
||||||
|
Controller::Jack port,
|
||||||
const Properties& properties);
|
const Properties& properties);
|
||||||
/** enable mappings for emulation mode */
|
/** enable mappings for emulation mode */
|
||||||
void enableEmulationMappings();
|
void enableEmulationMappings();
|
||||||
|
@ -100,13 +102,13 @@ class PhysicalKeyboardHandler
|
||||||
EventMode mode = EventMode::kEmulationMode, bool updateDefaults = false);
|
EventMode mode = EventMode::kEmulationMode, bool updateDefaults = false);
|
||||||
|
|
||||||
/** returns the event's controller mode */
|
/** returns the event's controller mode */
|
||||||
EventMode getEventMode(const Event::Type event, const EventMode mode) const;
|
static EventMode getEventMode(const Event::Type event, const EventMode mode);
|
||||||
/** Checks event type. */
|
/** Checks event type. */
|
||||||
bool isJoystickEvent(const Event::Type event) const;
|
static bool isJoystickEvent(const Event::Type event);
|
||||||
bool isPaddleEvent(const Event::Type event) const;
|
static bool isPaddleEvent(const Event::Type event);
|
||||||
bool isKeyboardEvent(const Event::Type event) const;
|
static bool isKeyboardEvent(const Event::Type event);
|
||||||
bool isDrivingEvent(const Event::Type event) const;
|
static bool isDrivingEvent(const Event::Type event);
|
||||||
bool isCommonEvent(const Event::Type event) const;
|
static bool isCommonEvent(const Event::Type event);
|
||||||
|
|
||||||
void enableCommonMappings();
|
void enableCommonMappings();
|
||||||
|
|
||||||
|
@ -114,9 +116,9 @@ class PhysicalKeyboardHandler
|
||||||
void enableMapping(const Event::Type event, EventMode mode);
|
void enableMapping(const Event::Type event, EventMode mode);
|
||||||
|
|
||||||
/** return event mode for given property */
|
/** return event mode for given property */
|
||||||
EventMode getMode(const Properties& properties, const PropType propType);
|
static EventMode getMode(const Properties& properties, const PropType propType);
|
||||||
/** return event mode for given controller type */
|
/** return event mode for given controller type */
|
||||||
EventMode getMode(const Controller::Type type);
|
static EventMode getMode(const Controller::Type type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OSystem& myOSystem;
|
OSystem& myOSystem;
|
||||||
|
|
|
@ -382,20 +382,20 @@ void PNGLibrary::takeSnapshot(uInt32 number)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool PNGLibrary::allocateStorage(size_t w, size_t h)
|
bool PNGLibrary::allocateStorage(size_t width, size_t height)
|
||||||
{
|
{
|
||||||
// Create space for the entire image (3 bytes per pixel in RGB format)
|
// Create space for the entire image (3 bytes per pixel in RGB format)
|
||||||
const size_t req_buffer_size = w * h * 3;
|
const size_t req_buffer_size = width * height * 3;
|
||||||
if(req_buffer_size > ReadInfo.buffer.capacity())
|
if(req_buffer_size > ReadInfo.buffer.capacity())
|
||||||
ReadInfo.buffer.reserve(req_buffer_size * 1.5);
|
ReadInfo.buffer.reserve(req_buffer_size * 1.5);
|
||||||
|
|
||||||
const size_t req_row_size = h;
|
const size_t req_row_size = height;
|
||||||
if(req_row_size > ReadInfo.row_pointers.capacity())
|
if(req_row_size > ReadInfo.row_pointers.capacity())
|
||||||
ReadInfo.row_pointers.reserve(req_row_size * 1.5);
|
ReadInfo.row_pointers.reserve(req_row_size * 1.5);
|
||||||
|
|
||||||
ReadInfo.width = static_cast<png_uint_32>(w);
|
ReadInfo.width = static_cast<png_uint_32>(width);
|
||||||
ReadInfo.height = static_cast<png_uint_32>(h);
|
ReadInfo.height = static_cast<png_uint_32>(height);
|
||||||
ReadInfo.pitch = static_cast<png_uint_32>(w * 3);
|
ReadInfo.pitch = static_cast<png_uint_32>(width * 3);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,8 @@ class PNGLibrary
|
||||||
runtime_error is thrown containing a more detailed
|
runtime_error is thrown containing a more detailed
|
||||||
error message.
|
error message.
|
||||||
*/
|
*/
|
||||||
void loadImage(const string& filename, FBSurface& surface, VariantList& metaData);
|
void loadImage(const string& filename, FBSurface& surface,
|
||||||
|
VariantList& metaData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Save the current FrameBuffer image to a PNG file. Note that in most
|
Save the current FrameBuffer image to a PNG file. Note that in most
|
||||||
|
@ -78,9 +79,9 @@ class PNGLibrary
|
||||||
otherwise a runtime_error is thrown containing a
|
otherwise a runtime_error is thrown containing a
|
||||||
more detailed error message.
|
more detailed error message.
|
||||||
*/
|
*/
|
||||||
void saveImage(const string& filename, const FBSurface& surface,
|
static void saveImage(const string& filename, const FBSurface& surface,
|
||||||
const Common::Rect& rect = Common::Rect{},
|
const Common::Rect& rect = Common::Rect{},
|
||||||
const VariantList& metaData = VariantList{});
|
const VariantList& metaData = VariantList{});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Called at regular intervals, and used to determine whether a
|
Called at regular intervals, and used to determine whether a
|
||||||
|
@ -149,10 +150,10 @@ class PNGLibrary
|
||||||
dependent on the given dimensions. If memory has been previously
|
dependent on the given dimensions. If memory has been previously
|
||||||
allocated and it can accommodate the given dimensions, it is used directly.
|
allocated and it can accommodate the given dimensions, it is used directly.
|
||||||
|
|
||||||
@param iwidth The width of the PNG image
|
@param width The width of the PNG image
|
||||||
@param iheight The height of the PNG image
|
@param height The height of the PNG image
|
||||||
*/
|
*/
|
||||||
bool allocateStorage(size_t iwidth, size_t iheight);
|
static bool allocateStorage(size_t width, size_t height);
|
||||||
|
|
||||||
/** The actual method which saves a PNG image.
|
/** The actual method which saves a PNG image.
|
||||||
|
|
||||||
|
@ -162,9 +163,9 @@ class PNGLibrary
|
||||||
@param height The height of the PNG image
|
@param height The height of the PNG image
|
||||||
@param metaData The meta data to add to the PNG image
|
@param metaData The meta data to add to the PNG image
|
||||||
*/
|
*/
|
||||||
void saveImageToDisk(std::ofstream& out, const vector<png_bytep>& rows,
|
static void saveImageToDisk(std::ofstream& out, const vector<png_bytep>& rows,
|
||||||
size_t width, size_t height,
|
size_t width, size_t height,
|
||||||
const VariantList& metaData);
|
const VariantList& metaData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Load the PNG data from 'ReadInfo' into the FBSurface. The surface
|
Load the PNG data from 'ReadInfo' into the FBSurface. The surface
|
||||||
|
@ -177,21 +178,25 @@ class PNGLibrary
|
||||||
/**
|
/**
|
||||||
Write PNG tEXt chunks to the image.
|
Write PNG tEXt chunks to the image.
|
||||||
*/
|
*/
|
||||||
void writeMetaData(const png_structp png_ptr, png_infop info_ptr,
|
static void writeMetaData(const png_structp png_ptr, png_infop info_ptr,
|
||||||
const VariantList& metaData);
|
const VariantList& metaData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Read PNG tEXt chunks from the image.
|
Read PNG tEXt chunks from the image.
|
||||||
*/
|
*/
|
||||||
void readMetaData(const png_structp png_ptr, png_infop info_ptr,
|
static void readMetaData(const png_structp png_ptr, png_infop info_ptr,
|
||||||
VariantList& metaData);
|
VariantList& metaData);
|
||||||
|
|
||||||
/** PNG library callback functions */
|
/** PNG library callback functions */
|
||||||
static void png_read_data(const png_structp ctx, png_bytep area, png_size_t size);
|
static void png_read_data(const png_structp ctx, png_bytep area,
|
||||||
static void png_write_data(const png_structp ctx, png_bytep area, png_size_t size);
|
png_size_t size);
|
||||||
|
static void png_write_data(const png_structp ctx, png_bytep area,
|
||||||
|
png_size_t size);
|
||||||
static void png_io_flush(const png_structp ctx);
|
static void png_io_flush(const png_structp ctx);
|
||||||
[[noreturn]] static void png_user_warn(const png_structp ctx, png_const_charp str);
|
[[noreturn]] static void png_user_warn(const png_structp ctx,
|
||||||
[[noreturn]] static void png_user_error(const png_structp ctx, png_const_charp str);
|
png_const_charp str);
|
||||||
|
[[noreturn]] static void png_user_error(const png_structp ctx,
|
||||||
|
png_const_charp str);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
|
|
|
@ -44,7 +44,7 @@ PaletteHandler::PaletteType PaletteHandler::toPaletteType(const string& name) co
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string PaletteHandler::toPaletteName(PaletteType type) const
|
string PaletteHandler::toPaletteName(PaletteType type)
|
||||||
{
|
{
|
||||||
const string SETTING_NAMES[int(PaletteType::NumTypes)] = {
|
const string SETTING_NAMES[int(PaletteType::NumTypes)] = {
|
||||||
SETTING_STANDARD, SETTING_Z26, SETTING_USER, SETTING_CUSTOM
|
SETTING_STANDARD, SETTING_Z26, SETTING_USER, SETTING_CUSTOM
|
||||||
|
@ -341,7 +341,7 @@ void PaletteHandler::setPalette()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
PaletteArray PaletteHandler::adjustedPalette(const PaletteArray& palette)
|
PaletteArray PaletteHandler::adjustedPalette(const PaletteArray& palette) const
|
||||||
{
|
{
|
||||||
PaletteArray destPalette{0};
|
PaletteArray destPalette{0};
|
||||||
// Constants for saturation and gray scale calculation
|
// Constants for saturation and gray scale calculation
|
||||||
|
@ -443,7 +443,7 @@ void PaletteHandler::loadUserPalette()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void PaletteHandler::generateCustomPalette(ConsoleTiming timing)
|
void PaletteHandler::generateCustomPalette(ConsoleTiming timing) const
|
||||||
{
|
{
|
||||||
constexpr int NUM_CHROMA = 16;
|
constexpr int NUM_CHROMA = 16;
|
||||||
constexpr int NUM_LUMA = 8;
|
constexpr int NUM_LUMA = 8;
|
||||||
|
@ -572,7 +572,8 @@ void PaletteHandler::adjustHueSaturation(int& R, int& G, int& B, float H, float
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
PaletteHandler::vector2d PaletteHandler::rotate(const PaletteHandler::vector2d& vec, float angle) const
|
PaletteHandler::vector2d
|
||||||
|
PaletteHandler::rotate(const PaletteHandler::vector2d& vec, float angle)
|
||||||
{
|
{
|
||||||
const float r = angle * BSPF::PI_f / 180;
|
const float r = angle * BSPF::PI_f / 180;
|
||||||
|
|
||||||
|
@ -581,14 +582,15 @@ PaletteHandler::vector2d PaletteHandler::rotate(const PaletteHandler::vector2d&
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
PaletteHandler::vector2d PaletteHandler::scale(const PaletteHandler::vector2d& vec, float factor) const
|
PaletteHandler::vector2d
|
||||||
|
PaletteHandler::scale(const PaletteHandler::vector2d& vec, float factor)
|
||||||
{
|
{
|
||||||
return PaletteHandler::vector2d(vec.x * factor, vec.y * factor);
|
return PaletteHandler::vector2d(vec.x * factor, vec.y * factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
float PaletteHandler::dotProduct(const PaletteHandler::vector2d& vec1,
|
float PaletteHandler::dotProduct(const PaletteHandler::vector2d& vec1,
|
||||||
const PaletteHandler::vector2d& vec2) const
|
const PaletteHandler::vector2d& vec2)
|
||||||
{
|
{
|
||||||
return vec1.x * vec2.x + vec1.y * vec2.y;
|
return vec1.x * vec2.x + vec1.y * vec2.y;
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ class PaletteHandler
|
||||||
|
|
||||||
@return The palette's settings name
|
@return The palette's settings name
|
||||||
*/
|
*/
|
||||||
string toPaletteName(PaletteType type) const;
|
static string toPaletteName(PaletteType type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Display current adjustable with gauge bar message
|
Display current adjustable with gauge bar message
|
||||||
|
@ -208,16 +208,16 @@ class PaletteHandler
|
||||||
|
|
||||||
@param timing Use NTSC or PAL phase shift and generate according palette
|
@param timing Use NTSC or PAL phase shift and generate according palette
|
||||||
*/
|
*/
|
||||||
void generateCustomPalette(ConsoleTiming timing);
|
void generateCustomPalette(ConsoleTiming timing) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create new palette by applying palette adjustments on given palette.
|
Create new palette by applying palette adjustments on given palette.
|
||||||
|
|
||||||
@param source The palette which should be adjusted
|
@param palette The palette which should be adjusted
|
||||||
|
|
||||||
@return An adjusted palette
|
@return An adjusted palette
|
||||||
*/
|
*/
|
||||||
PaletteArray adjustedPalette(const PaletteArray& source);
|
PaletteArray adjustedPalette(const PaletteArray& palette) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Adjust hue and saturation for given RGB values.
|
Adjust hue and saturation for given RGB values.
|
||||||
|
@ -228,22 +228,22 @@ class PaletteHandler
|
||||||
@param H The hue adjustment value
|
@param H The hue adjustment value
|
||||||
@param S The saturation
|
@param S The saturation
|
||||||
*/
|
*/
|
||||||
void adjustHueSaturation(int& R, int& G, int& B, float H, float S);
|
static void adjustHueSaturation(int& R, int& G, int& B, float H, float S);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Rotate a 2D vector.
|
Rotate a 2D vector.
|
||||||
*/
|
*/
|
||||||
vector2d rotate(const vector2d& vec, float angle) const;
|
static vector2d rotate(const vector2d& vec, float angle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Scale a 2D vector.
|
Scale a 2D vector.
|
||||||
*/
|
*/
|
||||||
vector2d scale(const vector2d& vec, float factor) const;
|
static vector2d scale(const vector2d& vec, float factor);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the dot product of two 2D vectors.
|
Get the dot product of two 2D vectors.
|
||||||
*/
|
*/
|
||||||
float dotProduct(const vector2d& vec1, const vector2d& vec2) const;
|
static float dotProduct(const vector2d& vec1, const vector2d& vec2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Loads a user-defined palette file (from OSystem::paletteFile), filling the
|
Loads a user-defined palette file (from OSystem::paletteFile), filling the
|
||||||
|
|
|
@ -70,9 +70,8 @@ json PhysicalJoystick::getMap() const
|
||||||
|
|
||||||
mapping["name"] = name;
|
mapping["name"] = name;
|
||||||
|
|
||||||
for (auto& mode: {
|
for (const auto& mode: {
|
||||||
EventMode::kMenuMode, EventMode::kJoystickMode, EventMode::kPaddlesMode, EventMode::kKeyboardMode,
|
EventMode::kMenuMode, EventMode::kJoystickMode, EventMode::kPaddlesMode, EventMode::kKeyboardMode, EventMode::kDrivingMode, EventMode::kCommonMode
|
||||||
EventMode::kDrivingMode, EventMode::kCommonMode
|
|
||||||
})
|
})
|
||||||
mapping[jsonName(mode)] = joyMap.saveMapping(mode);
|
mapping[jsonName(mode)] = joyMap.saveMapping(mode);
|
||||||
|
|
||||||
|
@ -153,7 +152,7 @@ void PhysicalJoystick::eraseEvent(Event::Type event, EventMode mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void PhysicalJoystick::getValues(const string& list, IntArray& map) const
|
void PhysicalJoystick::getValues(const string& list, IntArray& map)
|
||||||
{
|
{
|
||||||
map.clear();
|
map.clear();
|
||||||
istringstream buf(list);
|
istringstream buf(list);
|
||||||
|
|
|
@ -76,7 +76,7 @@ class PhysicalJoystick
|
||||||
JoyMap joyMap;
|
JoyMap joyMap;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void getValues(const string& list, IntArray& map) const;
|
static void getValues(const string& list, IntArray& map);
|
||||||
|
|
||||||
friend ostream& operator<<(ostream& os, const PhysicalJoystick& s) {
|
friend ostream& operator<<(ostream& os, const PhysicalJoystick& s) {
|
||||||
os << " ID: " << s.ID << ", name: " << s.name << ", numaxis: " << s.numAxes
|
os << " ID: " << s.ID << ", name: " << s.name << ", numaxis: " << s.numAxes
|
||||||
|
|
|
@ -137,12 +137,12 @@ bool SoundSDL2::openDevice()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void SoundSDL2::setEnabled(bool state)
|
void SoundSDL2::setEnabled(bool enable)
|
||||||
{
|
{
|
||||||
myAudioSettings.setEnabled(state);
|
myAudioSettings.setEnabled(enable);
|
||||||
if (myAudioQueue) myAudioQueue->ignoreOverflows(!state);
|
if (myAudioQueue) myAudioQueue->ignoreOverflows(!enable);
|
||||||
|
|
||||||
Logger::debug(state ? "SoundSDL2::setEnabled(true)" :
|
Logger::debug(enable ? "SoundSDL2::setEnabled(true)" :
|
||||||
"SoundSDL2::setEnabled(false)");
|
"SoundSDL2::setEnabled(false)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,10 @@
|
||||||
#include "Logger.hxx"
|
#include "Logger.hxx"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class buffers log events and logs them after a certain time window has expired.
|
* This class buffers log events and logs them after a certain time window has
|
||||||
* The timout increases after every log line by a factor of two until a maximum is reached.
|
* expired. The timout increases after every log line by a factor of two until
|
||||||
* If no events are reported, the window size decreases again.
|
* a maximum is reached. If no events are reported, the window size decreases
|
||||||
|
* again.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class StaggeredLogger
|
class StaggeredLogger
|
||||||
|
@ -46,7 +47,7 @@ class StaggeredLogger
|
||||||
|
|
||||||
void _log();
|
void _log();
|
||||||
|
|
||||||
void onTimerExpired(uInt32 timerId);
|
void onTimerExpired(uInt32 timerCallbackId);
|
||||||
|
|
||||||
void startInterval();
|
void startInterval();
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ class ThreadDebuggingHelper {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
[[noreturn]] void fail(const string& message);
|
[[noreturn]] static void fail(const string& message);
|
||||||
|
|
||||||
ThreadDebuggingHelper() = default;
|
ThreadDebuggingHelper() = default;
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,7 @@
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
TimerManager::TimerManager()
|
TimerManager::TimerManager()
|
||||||
: nextId{no_timer + 1},
|
: nextId{no_timer + 1}
|
||||||
queue()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -281,7 +281,7 @@ int main(int ac, char* av[])
|
||||||
{
|
{
|
||||||
attachConsole();
|
attachConsole();
|
||||||
Logger::debug("Displaying usage");
|
Logger::debug("Displaying usage");
|
||||||
theOSystem->settings().usage();
|
Settings::usage();
|
||||||
freeConsole();
|
freeConsole();
|
||||||
return Cleanup();
|
return Cleanup();
|
||||||
}
|
}
|
||||||
|
@ -294,15 +294,15 @@ int main(int ac, char* av[])
|
||||||
// If not, use the built-in ROM launcher. In this case, we enter 'launcher'
|
// If not, use the built-in ROM launcher. In this case, we enter 'launcher'
|
||||||
// mode and let the main event loop take care of opening a new console/ROM.
|
// mode and let the main event loop take care of opening a new console/ROM.
|
||||||
FSNode romnode(romfile);
|
FSNode romnode(romfile);
|
||||||
if(romfile == "" || romnode.isDirectory())
|
if(romfile.empty() || romnode.isDirectory())
|
||||||
{
|
{
|
||||||
Logger::debug("Attempting to use ROM launcher ...");
|
Logger::debug("Attempting to use ROM launcher ...");
|
||||||
bool launcherOpened = romfile != "" ?
|
bool launcherOpened = !romfile.empty() ?
|
||||||
theOSystem->createLauncher(romnode.getPath()) : theOSystem->createLauncher();
|
theOSystem->createLauncher(romnode.getPath()) : theOSystem->createLauncher();
|
||||||
if(!launcherOpened)
|
if(!launcherOpened)
|
||||||
{
|
{
|
||||||
Logger::debug("Launcher could not be started, showing usage");
|
Logger::debug("Launcher could not be started, showing usage");
|
||||||
theOSystem->settings().usage();
|
Settings::usage();
|
||||||
return Cleanup();
|
return Cleanup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -333,7 +333,7 @@ int main(int ac, char* av[])
|
||||||
|
|
||||||
#ifdef DEBUGGER_SUPPORT
|
#ifdef DEBUGGER_SUPPORT
|
||||||
// Set up any breakpoint that was on the command line
|
// Set up any breakpoint that was on the command line
|
||||||
if(localOpts["break"].toString() != "")
|
if(!localOpts["break"].toString().empty())
|
||||||
{
|
{
|
||||||
Debugger& dbg = theOSystem->debugger();
|
Debugger& dbg = theOSystem->debugger();
|
||||||
uInt16 bp = uInt16(dbg.stringToValue(localOpts["break"].toString()));
|
uInt16 bp = uInt16(dbg.stringToValue(localOpts["break"].toString()));
|
||||||
|
|
|
@ -27,7 +27,7 @@ class KeyValueRepositoryConfigfile : public KeyValueRepositoryFile<KeyValueRepos
|
||||||
using KeyValueRepositoryFile<KeyValueRepositoryConfigfile>::load;
|
using KeyValueRepositoryFile<KeyValueRepositoryConfigfile>::load;
|
||||||
using KeyValueRepositoryFile<KeyValueRepositoryConfigfile>::save;
|
using KeyValueRepositoryFile<KeyValueRepositoryConfigfile>::save;
|
||||||
|
|
||||||
explicit KeyValueRepositoryConfigfile(const FSNode& node);
|
explicit KeyValueRepositoryConfigfile(const FSNode& file);
|
||||||
|
|
||||||
static std::map<string, Variant> load(istream& in);
|
static std::map<string, Variant> load(istream& in);
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ std::map<string, Variant> KeyValueRepositoryPropertyFile::load(istream& in)
|
||||||
if(!in) return map;
|
if(!in) return map;
|
||||||
|
|
||||||
// A null key signifies the end of the property list
|
// A null key signifies the end of the property list
|
||||||
if(key == "")
|
if(key.empty())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Get the value associated with this property
|
// Get the value associated with this property
|
||||||
|
@ -111,7 +111,7 @@ std::map<string, Variant> KeyValueRepositoryPropertyFile::load(istream& in)
|
||||||
bool KeyValueRepositoryPropertyFile::save(ostream& out,
|
bool KeyValueRepositoryPropertyFile::save(ostream& out,
|
||||||
const std::map<string, Variant>& values)
|
const std::map<string, Variant>& values)
|
||||||
{
|
{
|
||||||
for (auto& [key, value]: values) {
|
for (const auto& [key, value]: values) {
|
||||||
writeQuotedString(out, key);
|
writeQuotedString(out, key);
|
||||||
out.put(' ');
|
out.put(' ');
|
||||||
writeQuotedString(out, value.toString());
|
writeQuotedString(out, value.toString());
|
||||||
|
|
|
@ -45,7 +45,7 @@ bool CompositeKeyValueRepositorySqlite::has(const string& key)
|
||||||
try {
|
try {
|
||||||
(*myStmtCountSet)
|
(*myStmtCountSet)
|
||||||
.reset()
|
.reset()
|
||||||
.bind(1, key.c_str());
|
.bind(1, key);
|
||||||
|
|
||||||
if (!myStmtCountSet->step())
|
if (!myStmtCountSet->step())
|
||||||
throw SqliteError("count failed");
|
throw SqliteError("count failed");
|
||||||
|
@ -68,7 +68,7 @@ void CompositeKeyValueRepositorySqlite::remove(const string& key)
|
||||||
try {
|
try {
|
||||||
(*myStmtDeleteSet)
|
(*myStmtDeleteSet)
|
||||||
.reset()
|
.reset()
|
||||||
.bind(1, key.c_str())
|
.bind(1, key)
|
||||||
.step();
|
.step();
|
||||||
|
|
||||||
myStmtDelete->reset();
|
myStmtDelete->reset();
|
||||||
|
@ -153,9 +153,9 @@ SqliteStatement& CompositeKeyValueRepositorySqlite::ProxyRepository::stmtInsert(
|
||||||
) {
|
) {
|
||||||
return (*myRepo.myStmtInsert)
|
return (*myRepo.myStmtInsert)
|
||||||
.reset()
|
.reset()
|
||||||
.bind(1, myKey.c_str())
|
.bind(1, myKey)
|
||||||
.bind(2, key.c_str())
|
.bind(2, key)
|
||||||
.bind(3, value.c_str());
|
.bind(3, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -163,7 +163,7 @@ SqliteStatement& CompositeKeyValueRepositorySqlite::ProxyRepository::stmtSelect(
|
||||||
{
|
{
|
||||||
return (*myRepo.myStmtSelect)
|
return (*myRepo.myStmtSelect)
|
||||||
.reset()
|
.reset()
|
||||||
.bind(1, myKey.c_str());
|
.bind(1, myKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -172,8 +172,8 @@ SqliteStatement& CompositeKeyValueRepositorySqlite::ProxyRepository::stmtDelete(
|
||||||
myRepo.myStmtDelete->reset();
|
myRepo.myStmtDelete->reset();
|
||||||
|
|
||||||
return (*myRepo.myStmtDelete)
|
return (*myRepo.myStmtDelete)
|
||||||
.bind(1, myKey.c_str())
|
.bind(1, myKey)
|
||||||
.bind(2, key.c_str());
|
.bind(2, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -181,8 +181,8 @@ SqliteStatement& CompositeKeyValueRepositorySqlite::ProxyRepository::stmtSelectO
|
||||||
{
|
{
|
||||||
return (*myRepo.myStmtSelectOne)
|
return (*myRepo.myStmtSelectOne)
|
||||||
.reset()
|
.reset()
|
||||||
.bind(1, myKey.c_str())
|
.bind(1, myKey)
|
||||||
.bind(2, key.c_str());
|
.bind(2, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -190,8 +190,8 @@ SqliteStatement& CompositeKeyValueRepositorySqlite::ProxyRepository::stmtCount(c
|
||||||
{
|
{
|
||||||
return (*myRepo.myStmtCount)
|
return (*myRepo.myStmtCount)
|
||||||
.reset()
|
.reset()
|
||||||
.bind(1, myKey.c_str())
|
.bind(1, myKey)
|
||||||
.bind(2, key.c_str());
|
.bind(2, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -34,8 +34,8 @@ SqliteStatement& KeyValueRepositorySqlite::stmtInsert(const string& key, const s
|
||||||
{
|
{
|
||||||
return (*myStmtInsert)
|
return (*myStmtInsert)
|
||||||
.reset()
|
.reset()
|
||||||
.bind(1, key.c_str())
|
.bind(1, key)
|
||||||
.bind(2, value.c_str());
|
.bind(2, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -50,7 +50,7 @@ SqliteStatement& KeyValueRepositorySqlite::stmtDelete(const string& key)
|
||||||
{
|
{
|
||||||
return (*myStmtDelete)
|
return (*myStmtDelete)
|
||||||
.reset()
|
.reset()
|
||||||
.bind(1, key.c_str());
|
.bind(1, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -58,7 +58,7 @@ SqliteStatement& KeyValueRepositorySqlite::stmtCount(const string& key)
|
||||||
{
|
{
|
||||||
return (*myStmtCount)
|
return (*myStmtCount)
|
||||||
.reset()
|
.reset()
|
||||||
.bind(1, key.c_str());
|
.bind(1, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -66,7 +66,7 @@ SqliteStatement& KeyValueRepositorySqlite::stmtSelectOne(const string& key)
|
||||||
{
|
{
|
||||||
return (*myStmtSelectOne)
|
return (*myStmtSelectOne)
|
||||||
.reset()
|
.reset()
|
||||||
.bind(1, key.c_str());
|
.bind(1, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -105,7 +105,7 @@ Int32 SqliteDatabase::getUserVersion() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void SqliteDatabase::setUserVersion(Int32 version)
|
void SqliteDatabase::setUserVersion(Int32 version) const
|
||||||
{
|
{
|
||||||
SqliteStatement(*this, "PRAGMA user_version = %i", static_cast<int>(version))
|
SqliteStatement(*this, "PRAGMA user_version = %i", static_cast<int>(version))
|
||||||
.step();
|
.step();
|
||||||
|
|
|
@ -42,7 +42,7 @@ class SqliteDatabase
|
||||||
void exec(const string& sql, T arg1, Ts... args);
|
void exec(const string& sql, T arg1, Ts... args);
|
||||||
|
|
||||||
Int32 getUserVersion() const;
|
Int32 getUserVersion() const;
|
||||||
void setUserVersion(Int32 version);
|
void setUserVersion(Int32 version) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ void StellaDb::initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
const string StellaDb::databaseFileName() const
|
string StellaDb::databaseFileName() const
|
||||||
{
|
{
|
||||||
return myDb ? FSNode(myDb->fileName()).getShortPath() : "[failed]";
|
return myDb ? FSNode(myDb->fileName()).getShortPath() : "[failed]";
|
||||||
}
|
}
|
||||||
|
@ -190,8 +190,11 @@ void StellaDb::importOldPropset(const FSNode& node)
|
||||||
while (true) {
|
while (true) {
|
||||||
auto props = KeyValueRepositoryPropertyFile::load(in);
|
auto props = KeyValueRepositoryPropertyFile::load(in);
|
||||||
|
|
||||||
if (props.size() == 0) break;
|
if (props.empty())
|
||||||
if ((props.find("Cart.MD5") == props.end()) || props["Cart.MD5"].toString() == "") continue;
|
break;
|
||||||
|
if ((props.find("Cart.MD5") == props.end()) ||
|
||||||
|
props["Cart.MD5"].toString().empty())
|
||||||
|
continue;
|
||||||
|
|
||||||
myPropertyRepository->get(props["Cart.MD5"].toString())->save(props);
|
myPropertyRepository->get(props["Cart.MD5"].toString())->save(props);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,21 +27,25 @@
|
||||||
class StellaDb
|
class StellaDb
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
StellaDb(const string& databaseDirectory, const string& databaseName);
|
StellaDb(const string& databaseDirectory, const string& databaseName);
|
||||||
|
|
||||||
void initialize();
|
void initialize();
|
||||||
|
|
||||||
KeyValueRepositoryAtomic& settingsRepository() const { return *mySettingsRepository; }
|
KeyValueRepositoryAtomic& settingsRepository() const {
|
||||||
CompositeKeyValueRepository& propertyRepository() const { return *myPropertyRepository; }
|
return *mySettingsRepository;
|
||||||
CompositeKeyValueRepositoryAtomic& highscoreRepository() const { return *myHighscoreRepository; }
|
}
|
||||||
|
CompositeKeyValueRepository& propertyRepository() const {
|
||||||
|
return *myPropertyRepository;
|
||||||
|
}
|
||||||
|
CompositeKeyValueRepositoryAtomic& highscoreRepository() const {
|
||||||
|
return *myHighscoreRepository;
|
||||||
|
}
|
||||||
|
|
||||||
const string databaseFileName() const;
|
string databaseFileName() const;
|
||||||
|
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void initializeDb();
|
void initializeDb();
|
||||||
void importOldSettings();
|
void importOldSettings();
|
||||||
void importStellarc(const FSNode& node);
|
void importStellarc(const FSNode& node);
|
||||||
|
@ -51,7 +55,6 @@ class StellaDb
|
||||||
void migrate();
|
void migrate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
string myDatabaseDirectory;
|
string myDatabaseDirectory;
|
||||||
string myDatabaseName;
|
string myDatabaseName;
|
||||||
|
|
||||||
|
|
|
@ -187,10 +187,10 @@ class AtariNTSC
|
||||||
0.9563F, 0.6210F, -0.2721F, -0.6474F, -1.1070F, 1.7046F
|
0.9563F, 0.6210F, -0.2721F, -0.6474F, -1.1070F, 1.7046F
|
||||||
};
|
};
|
||||||
|
|
||||||
void init(init_t& impl, const Setup& setup);
|
static void init(init_t& impl, const Setup& setup);
|
||||||
void initFilters(init_t& impl, const Setup& setup);
|
static void initFilters(init_t& impl, const Setup& setup);
|
||||||
// Generate pixel at all burst phases and column alignments
|
// Generate pixel at all burst phases and column alignments
|
||||||
void genKernel(init_t& impl, float y, float i, float q, uInt32* out);
|
static void genKernel(init_t& impl, float y, float i, float q, uInt32* out);
|
||||||
|
|
||||||
// Begins outputting row and starts two pixels. First pixel will be cut
|
// Begins outputting row and starts two pixels. First pixel will be cut
|
||||||
// off a bit. Use atari_ntsc_black for unused pixels.
|
// off a bit. Use atari_ntsc_black for unused pixels.
|
||||||
|
|
|
@ -139,7 +139,7 @@ void NTSCFilter::loadConfig(const Settings& settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void NTSCFilter::saveConfig(Settings& settings) const
|
void NTSCFilter::saveConfig(Settings& settings)
|
||||||
{
|
{
|
||||||
// Save adjustables for custom mode
|
// Save adjustables for custom mode
|
||||||
settings.setValue("tv.sharpness", myCustomSetup.sharpness);
|
settings.setValue("tv.sharpness", myCustomSetup.sharpness);
|
||||||
|
@ -150,7 +150,7 @@ void NTSCFilter::saveConfig(Settings& settings) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void NTSCFilter::getAdjustables(Adjustable& adjustable, Preset preset) const
|
void NTSCFilter::getAdjustables(Adjustable& adjustable, Preset preset)
|
||||||
{
|
{
|
||||||
switch(preset)
|
switch(preset)
|
||||||
{
|
{
|
||||||
|
@ -181,7 +181,7 @@ void NTSCFilter::setCustomAdjustables(const Adjustable& adjustable)
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void NTSCFilter::convertToAdjustable(Adjustable& adjustable,
|
void NTSCFilter::convertToAdjustable(Adjustable& adjustable,
|
||||||
const AtariNTSC::Setup& setup) const
|
const AtariNTSC::Setup& setup)
|
||||||
{
|
{
|
||||||
adjustable.sharpness = scaleTo100(setup.sharpness);
|
adjustable.sharpness = scaleTo100(setup.sharpness);
|
||||||
adjustable.resolution = scaleTo100(setup.resolution);
|
adjustable.resolution = scaleTo100(setup.resolution);
|
||||||
|
|
|
@ -80,12 +80,12 @@ class NTSCFilter
|
||||||
// Get adjustables for the given preset
|
// Get adjustables for the given preset
|
||||||
// Values will be scaled to 0 - 100 range, independent of how
|
// Values will be scaled to 0 - 100 range, independent of how
|
||||||
// they're actually stored internally
|
// they're actually stored internally
|
||||||
void getAdjustables(Adjustable& adjustable, Preset preset) const;
|
static void getAdjustables(Adjustable& adjustable, Preset preset);
|
||||||
|
|
||||||
// Set custom adjustables to given values
|
// Set custom adjustables to given values
|
||||||
// Values will be scaled to 0 - 100 range, independent of how
|
// Values will be scaled to 0 - 100 range, independent of how
|
||||||
// they're actually stored internally
|
// they're actually stored internally
|
||||||
void setCustomAdjustables(const Adjustable& adjustable);
|
static void setCustomAdjustables(const Adjustable& adjustable);
|
||||||
|
|
||||||
// The following methods cycle through each custom adjustable
|
// The following methods cycle through each custom adjustable
|
||||||
// They are used in conjunction with the increase/decrease
|
// They are used in conjunction with the increase/decrease
|
||||||
|
@ -101,8 +101,8 @@ class NTSCFilter
|
||||||
string& text, string& valueText, Int32& newValue);
|
string& text, string& valueText, Int32& newValue);
|
||||||
|
|
||||||
// Load and save NTSC-related settings
|
// Load and save NTSC-related settings
|
||||||
void loadConfig(const Settings& settings);
|
static void loadConfig(const Settings& settings);
|
||||||
void saveConfig(Settings& settings) const;
|
static void saveConfig(Settings& settings);
|
||||||
|
|
||||||
// Perform Blargg filtering on input buffer, place results in
|
// Perform Blargg filtering on input buffer, place results in
|
||||||
// output buffer
|
// output buffer
|
||||||
|
@ -125,8 +125,8 @@ class NTSCFilter
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Convert from atari_ntsc_setup_t values to equivalent adjustables
|
// Convert from atari_ntsc_setup_t values to equivalent adjustables
|
||||||
void convertToAdjustable(Adjustable& adjustable,
|
static void convertToAdjustable(Adjustable& adjustable,
|
||||||
const AtariNTSC::Setup& setup) const;
|
const AtariNTSC::Setup& setup);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// The NTSC object
|
// The NTSC object
|
||||||
|
|
|
@ -110,7 +110,8 @@ BreakpointMap::BreakpointList BreakpointMap::getBreakpoints() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
BreakpointMap::Breakpoint BreakpointMap::convertBreakpoint(const Breakpoint& breakpoint)
|
BreakpointMap::Breakpoint BreakpointMap::convertBreakpoint(
|
||||||
|
const Breakpoint& breakpoint)
|
||||||
{
|
{
|
||||||
if(breakpoint.bank == ANY_BANK)
|
if(breakpoint.bank == ANY_BANK)
|
||||||
return Breakpoint(breakpoint.addr, ANY_BANK);
|
return Breakpoint(breakpoint.addr, ANY_BANK);
|
||||||
|
|
|
@ -90,7 +90,7 @@ class BreakpointMap
|
||||||
size_t size() const { return myMap.size(); }
|
size_t size() const { return myMap.size(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Breakpoint convertBreakpoint(const Breakpoint& breakpoint);
|
static Breakpoint convertBreakpoint(const Breakpoint& breakpoint);
|
||||||
|
|
||||||
struct BreakpointHash {
|
struct BreakpointHash {
|
||||||
size_t operator()(const Breakpoint& bp) const {
|
size_t operator()(const Breakpoint& bp) const {
|
||||||
|
|
|
@ -232,7 +232,7 @@ string CartDebug::toString()
|
||||||
|
|
||||||
for(uInt32 j = 0; j < bytesPerLine; ++j)
|
for(uInt32 j = 0; j < bytesPerLine; ++j)
|
||||||
{
|
{
|
||||||
buf << myDebugger.invIfChanged(state.ram[i+j], oldstate.ram[i+j]) << " ";
|
buf << Debugger::invIfChanged(state.ram[i+j], oldstate.ram[i+j]) << " ";
|
||||||
|
|
||||||
if(j == 0x07) buf << " ";
|
if(j == 0x07) buf << " ";
|
||||||
}
|
}
|
||||||
|
@ -379,7 +379,7 @@ bool CartDebug::fillDisassemblyList(BankInfo& info, Disassembly& disassembly,
|
||||||
disassembly.list.clear();
|
disassembly.list.clear();
|
||||||
addrToLineList.clear();
|
addrToLineList.clear();
|
||||||
// An empty address list means that DiStella can't do a disassembly
|
// An empty address list means that DiStella can't do a disassembly
|
||||||
if(info.addressList.size() == 0)
|
if(info.addressList.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
disassembly.fieldwidth = 24 + myLabelLength;
|
disassembly.fieldwidth = 24 + myLabelLength;
|
||||||
|
@ -832,7 +832,7 @@ string CartDebug::loadListFile()
|
||||||
|
|
||||||
getline(in, line);
|
getline(in, line);
|
||||||
|
|
||||||
if(!in.good() || line == "" || line[0] == '-')
|
if(!in.good() || line.empty() || line[0] == '-')
|
||||||
continue;
|
continue;
|
||||||
else // Search for constants
|
else // Search for constants
|
||||||
{
|
{
|
||||||
|
@ -1133,7 +1133,7 @@ string CartDebug::saveDisassembly(string path)
|
||||||
disassembleBank(bank);
|
disassembleBank(bank);
|
||||||
|
|
||||||
// An empty address list means that DiStella can't do a disassembly
|
// An empty address list means that DiStella can't do a disassembly
|
||||||
if(info.addressList.size() == 0)
|
if(info.addressList.empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
buf << "\n\n;***********************************************************\n"
|
buf << "\n\n;***********************************************************\n"
|
||||||
|
@ -1165,7 +1165,7 @@ string CartDebug::saveDisassembly(string path)
|
||||||
const DisassemblyTag& tag = dt;
|
const DisassemblyTag& tag = dt;
|
||||||
|
|
||||||
// Add label (if any)
|
// Add label (if any)
|
||||||
if(tag.label != "")
|
if(!tag.label.empty())
|
||||||
buf << ALIGN(4) << (tag.label) << "\n";
|
buf << ALIGN(4) << (tag.label) << "\n";
|
||||||
buf << " ";
|
buf << " ";
|
||||||
|
|
||||||
|
@ -1377,7 +1377,7 @@ string CartDebug::saveDisassembly(string path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(myReserved.Label.size() > 0)
|
if(!myReserved.Label.empty())
|
||||||
{
|
{
|
||||||
out << "\n\n;-----------------------------------------------------------\n"
|
out << "\n\n;-----------------------------------------------------------\n"
|
||||||
<< "; Non Locatable Labels\n"
|
<< "; Non Locatable Labels\n"
|
||||||
|
@ -1386,7 +1386,7 @@ string CartDebug::saveDisassembly(string path)
|
||||||
out << ALIGN(16) << iter.second << "= $" << iter.first << "\n";
|
out << ALIGN(16) << iter.second << "= $" << iter.first << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(myUserLabels.size() > 0)
|
if(!myUserLabels.empty())
|
||||||
{
|
{
|
||||||
out << "\n\n;-----------------------------------------------------------\n"
|
out << "\n\n;-----------------------------------------------------------\n"
|
||||||
<< "; User Defined Labels\n"
|
<< "; User Defined Labels\n"
|
||||||
|
@ -1561,7 +1561,7 @@ void CartDebug::getCompletions(const char* in, StringList& completions) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
CartDebug::AddrType CartDebug::addressType(uInt16 addr) const
|
CartDebug::AddrType CartDebug::addressType(uInt16 addr)
|
||||||
{
|
{
|
||||||
// Determine the type of address to access the correct list
|
// Determine the type of address to access the correct list
|
||||||
// These addresses were based on (and checked against) Kroko's 2600 memory
|
// These addresses were based on (and checked against) Kroko's 2600 memory
|
||||||
|
@ -1643,7 +1643,7 @@ void CartDebug::accessTypeAsString(ostream& buf, uInt16 addr) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Device::AccessType CartDebug::accessTypeAbsolute(Device::AccessFlags flags) const
|
Device::AccessType CartDebug::accessTypeAbsolute(Device::AccessFlags flags)
|
||||||
{
|
{
|
||||||
if(flags & Device::CODE)
|
if(flags & Device::CODE)
|
||||||
return Device::CODE;
|
return Device::CODE;
|
||||||
|
@ -1670,7 +1670,7 @@ Device::AccessType CartDebug::accessTypeAbsolute(Device::AccessFlags flags) cons
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CartDebug::AccessTypeAsString(ostream& buf, Device::AccessType type) const
|
void CartDebug::AccessTypeAsString(ostream& buf, Device::AccessType type)
|
||||||
{
|
{
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
|
@ -1689,7 +1689,7 @@ void CartDebug::AccessTypeAsString(ostream& buf, Device::AccessType type) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CartDebug::AccessTypeAsString(ostream& buf, Device::AccessFlags flags) const
|
void CartDebug::AccessTypeAsString(ostream& buf, Device::AccessFlags flags)
|
||||||
{
|
{
|
||||||
if(flags)
|
if(flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,7 +66,7 @@ class CartDebug : public DebuggerSystem
|
||||||
|
|
||||||
// Determine 'type' of address (ie, what part of the system accessed)
|
// Determine 'type' of address (ie, what part of the system accessed)
|
||||||
enum class AddrType { TIA, IO, ZPRAM, ROM };
|
enum class AddrType { TIA, IO, ZPRAM, ROM };
|
||||||
AddrType addressType(uInt16 addr) const;
|
static AddrType addressType(uInt16 addr);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CartDebug(Debugger& dbg, Console& console, const OSystem& osystem);
|
CartDebug(Debugger& dbg, Console& console, const OSystem& osystem);
|
||||||
|
@ -260,13 +260,13 @@ class CartDebug : public DebuggerSystem
|
||||||
Methods used by the command parser for tab-completion
|
Methods used by the command parser for tab-completion
|
||||||
In this case, return completions from the equate list(s)
|
In this case, return completions from the equate list(s)
|
||||||
*/
|
*/
|
||||||
void getCompletions(const char* in, StringList& list) const;
|
void getCompletions(const char* in, StringList& completions) const;
|
||||||
|
|
||||||
// Convert given address to corresponding access type and append to buf
|
// Convert given address to corresponding access type and append to buf
|
||||||
void accessTypeAsString(ostream& buf, uInt16 addr) const;
|
void accessTypeAsString(ostream& buf, uInt16 addr) const;
|
||||||
|
|
||||||
// Convert access enum type to corresponding string and append to buf
|
// Convert access enum type to corresponding string and append to buf
|
||||||
void AccessTypeAsString(ostream& buf, Device::AccessType type) const;
|
static void AccessTypeAsString(ostream& buf, Device::AccessType type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using AddrToLineList = std::map<uInt16, int>;
|
using AddrToLineList = std::map<uInt16, int>;
|
||||||
|
@ -330,11 +330,11 @@ class CartDebug : public DebuggerSystem
|
||||||
void getBankDirectives(ostream& buf, const BankInfo& info) const;
|
void getBankDirectives(ostream& buf, const BankInfo& info) const;
|
||||||
|
|
||||||
// Get access enum type from 'flags', taking precendence into account
|
// Get access enum type from 'flags', taking precendence into account
|
||||||
Device::AccessType accessTypeAbsolute(Device::AccessFlags flags) const;
|
static Device::AccessType accessTypeAbsolute(Device::AccessFlags flags);
|
||||||
|
|
||||||
// Convert all access types in 'flags' to corresponding string and
|
// Convert all access types in 'flags' to corresponding string and
|
||||||
// append to buf
|
// append to buf
|
||||||
void AccessTypeAsString(ostream& buf, Device::AccessFlags flags) const;
|
static void AccessTypeAsString(ostream& buf, Device::AccessFlags flags);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const OSystem& myOSystem;
|
const OSystem& myOSystem;
|
||||||
|
|
|
@ -218,13 +218,13 @@ TrapArray& Debugger::writeTraps() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
const string Debugger::run(const string& command)
|
string Debugger::run(const string& command)
|
||||||
{
|
{
|
||||||
return myParser->run(command);
|
return myParser->run(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
const string Debugger::invIfChanged(int reg, int oldReg)
|
string Debugger::invIfChanged(int reg, int oldReg)
|
||||||
{
|
{
|
||||||
string ret;
|
string ret;
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ int Debugger::trace()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool Debugger::setBreakPoint(uInt16 addr, uInt8 bank, uInt32 flags)
|
bool Debugger::setBreakPoint(uInt16 addr, uInt8 bank, uInt32 flags) const
|
||||||
{
|
{
|
||||||
if(checkBreakPoint(addr, bank))
|
if(checkBreakPoint(addr, bank))
|
||||||
return false;
|
return false;
|
||||||
|
@ -371,7 +371,7 @@ bool Debugger::setBreakPoint(uInt16 addr, uInt8 bank, uInt32 flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool Debugger::clearBreakPoint(uInt16 addr, uInt8 bank)
|
bool Debugger::clearBreakPoint(uInt16 addr, uInt8 bank) const
|
||||||
{
|
{
|
||||||
if(!checkBreakPoint(addr, bank))
|
if(!checkBreakPoint(addr, bank))
|
||||||
return false;
|
return false;
|
||||||
|
@ -381,13 +381,13 @@ bool Debugger::clearBreakPoint(uInt16 addr, uInt8 bank)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool Debugger::checkBreakPoint(uInt16 addr, uInt8 bank)
|
bool Debugger::checkBreakPoint(uInt16 addr, uInt8 bank) const
|
||||||
{
|
{
|
||||||
return breakPoints().check(addr, bank);
|
return breakPoints().check(addr, bank);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool Debugger::toggleBreakPoint(uInt16 addr, uInt8 bank)
|
bool Debugger::toggleBreakPoint(uInt16 addr, uInt8 bank) const
|
||||||
{
|
{
|
||||||
if(checkBreakPoint(addr, bank))
|
if(checkBreakPoint(addr, bank))
|
||||||
clearBreakPoint(addr, bank);
|
clearBreakPoint(addr, bank);
|
||||||
|
@ -398,53 +398,53 @@ bool Debugger::toggleBreakPoint(uInt16 addr, uInt8 bank)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Debugger::addReadTrap(uInt16 t)
|
void Debugger::addReadTrap(uInt16 t) const
|
||||||
{
|
{
|
||||||
readTraps().initialize();
|
readTraps().initialize();
|
||||||
readTraps().add(t);
|
readTraps().add(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Debugger::addWriteTrap(uInt16 t)
|
void Debugger::addWriteTrap(uInt16 t) const
|
||||||
{
|
{
|
||||||
writeTraps().initialize();
|
writeTraps().initialize();
|
||||||
writeTraps().add(t);
|
writeTraps().add(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Debugger::addTrap(uInt16 t)
|
void Debugger::addTrap(uInt16 t) const
|
||||||
{
|
{
|
||||||
addReadTrap(t);
|
addReadTrap(t);
|
||||||
addWriteTrap(t);
|
addWriteTrap(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Debugger::removeReadTrap(uInt16 t)
|
void Debugger::removeReadTrap(uInt16 t) const
|
||||||
{
|
{
|
||||||
readTraps().initialize();
|
readTraps().initialize();
|
||||||
readTraps().remove(t);
|
readTraps().remove(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Debugger::removeWriteTrap(uInt16 t)
|
void Debugger::removeWriteTrap(uInt16 t) const
|
||||||
{
|
{
|
||||||
writeTraps().initialize();
|
writeTraps().initialize();
|
||||||
writeTraps().remove(t);
|
writeTraps().remove(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Debugger::removeTrap(uInt16 t)
|
void Debugger::removeTrap(uInt16 t) const
|
||||||
{
|
{
|
||||||
removeReadTrap(t);
|
removeReadTrap(t);
|
||||||
removeWriteTrap(t);
|
removeWriteTrap(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool Debugger::readTrap(uInt16 t)
|
bool Debugger::readTrap(uInt16 t) const
|
||||||
{
|
{
|
||||||
return readTraps().isInitialized() && readTraps().isSet(t);
|
return readTraps().isInitialized() && readTraps().isSet(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool Debugger::writeTrap(uInt16 t)
|
bool Debugger::writeTrap(uInt16 t) const
|
||||||
{
|
{
|
||||||
return writeTraps().isInitialized() && writeTraps().isSet(t);
|
return writeTraps().isInitialized() && writeTraps().isSet(t);
|
||||||
}
|
}
|
||||||
|
@ -700,13 +700,13 @@ uInt16 Debugger::unwindStates(const uInt16 numStates, string& message)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Debugger::clearAllBreakPoints()
|
void Debugger::clearAllBreakPoints() const
|
||||||
{
|
{
|
||||||
breakPoints().clear();
|
breakPoints().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Debugger::clearAllTraps()
|
void Debugger::clearAllTraps() const
|
||||||
{
|
{
|
||||||
readTraps().clearAll();
|
readTraps().clearAll();
|
||||||
writeTraps().clearAll();
|
writeTraps().clearAll();
|
||||||
|
@ -829,7 +829,7 @@ bool Debugger::delFunction(const string& name)
|
||||||
const Expression& Debugger::getFunction(const string& name) const
|
const Expression& Debugger::getFunction(const string& name) const
|
||||||
{
|
{
|
||||||
const auto& iter = myFunctions.find(name);
|
const auto& iter = myFunctions.find(name);
|
||||||
return iter != myFunctions.end() ? *(iter->second.get()) : EmptyExpression;
|
return iter != myFunctions.end() ? *(iter->second) : EmptyExpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -840,13 +840,13 @@ const string& Debugger::getFunctionDef(const string& name) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
const Debugger::FunctionDefMap Debugger::getFunctionDefMap() const
|
Debugger::FunctionDefMap Debugger::getFunctionDefMap() const
|
||||||
{
|
{
|
||||||
return myFunctionDefs;
|
return myFunctionDefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string Debugger::builtinHelp() const
|
string Debugger::builtinHelp()
|
||||||
{
|
{
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
size_t c_maxlen = 0, i_maxlen = 0;
|
size_t c_maxlen = 0, i_maxlen = 0;
|
||||||
|
|
|
@ -111,13 +111,13 @@ class Debugger : public DialogContainer
|
||||||
|
|
||||||
bool addFunction(const string& name, const string& def,
|
bool addFunction(const string& name, const string& def,
|
||||||
Expression* exp, bool builtin = false);
|
Expression* exp, bool builtin = false);
|
||||||
bool isBuiltinFunction(const string& name);
|
static bool isBuiltinFunction(const string& name);
|
||||||
bool delFunction(const string& name);
|
bool delFunction(const string& name);
|
||||||
const Expression& getFunction(const string& name) const;
|
const Expression& getFunction(const string& name) const;
|
||||||
|
|
||||||
const string& getFunctionDef(const string& name) const;
|
const string& getFunctionDef(const string& name) const;
|
||||||
const FunctionDefMap getFunctionDefMap() const;
|
FunctionDefMap getFunctionDefMap() const;
|
||||||
string builtinHelp() const;
|
static string builtinHelp();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Methods used by the command parser for tab-completion
|
Methods used by the command parser for tab-completion
|
||||||
|
@ -168,33 +168,33 @@ class Debugger : public DialogContainer
|
||||||
Returns true if successfully set
|
Returns true if successfully set
|
||||||
*/
|
*/
|
||||||
bool setBreakPoint(uInt16 addr, uInt8 bank = ANY_BANK,
|
bool setBreakPoint(uInt16 addr, uInt8 bank = ANY_BANK,
|
||||||
uInt32 flags = 0);
|
uInt32 flags = 0) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Clears a breakpoint.
|
Clears a breakpoint.
|
||||||
|
|
||||||
Returns true if successfully cleared
|
Returns true if successfully cleared
|
||||||
*/
|
*/
|
||||||
bool clearBreakPoint(uInt16 addr, uInt8 bank);
|
bool clearBreakPoint(uInt16 addr, uInt8 bank) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Toggles a breakpoint
|
Toggles a breakpoint
|
||||||
|
|
||||||
Returns new state of breakpoint
|
Returns new state of breakpoint
|
||||||
*/
|
*/
|
||||||
bool toggleBreakPoint(uInt16 addr, uInt8 bank);
|
bool toggleBreakPoint(uInt16 addr, uInt8 bank) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Checks for a breakpoint.
|
Checks for a breakpoint.
|
||||||
|
|
||||||
Returns true if existing, else false
|
Returns true if existing, else false
|
||||||
*/
|
*/
|
||||||
bool checkBreakPoint(uInt16 addr, uInt8 bank);
|
bool checkBreakPoint(uInt16 addr, uInt8 bank) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Run the debugger command and return the result.
|
Run the debugger command and return the result.
|
||||||
*/
|
*/
|
||||||
const string run(const string& command);
|
string run(const string& command);
|
||||||
|
|
||||||
string autoExec(StringList* history);
|
string autoExec(StringList* history);
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ class Debugger : public DialogContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Invert given input if it differs from its previous value */
|
/** Invert given input if it differs from its previous value */
|
||||||
const string invIfChanged(int reg, int oldReg);
|
static string invIfChanged(int reg, int oldReg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This is used when we want the debugger from a class that can't
|
This is used when we want the debugger from a class that can't
|
||||||
|
@ -261,7 +261,7 @@ class Debugger : public DialogContainer
|
||||||
Device::AccessFlags getAccessFlags(uInt16 addr) const;
|
Device::AccessFlags getAccessFlags(uInt16 addr) const;
|
||||||
void setAccessFlags(uInt16 addr, Device::AccessFlags flags);
|
void setAccessFlags(uInt16 addr, Device::AccessFlags flags);
|
||||||
|
|
||||||
uInt32 getBaseAddress(uInt32 addr, bool read);
|
static uInt32 getBaseAddress(uInt32 addr, bool read);
|
||||||
|
|
||||||
bool patchROM(uInt16 addr, uInt8 value);
|
bool patchROM(uInt16 addr, uInt8 value);
|
||||||
|
|
||||||
|
@ -315,17 +315,17 @@ class Debugger : public DialogContainer
|
||||||
uInt16 rewindStates(const uInt16 numStates, string& message);
|
uInt16 rewindStates(const uInt16 numStates, string& message);
|
||||||
uInt16 unwindStates(const uInt16 numStates, string& message);
|
uInt16 unwindStates(const uInt16 numStates, string& message);
|
||||||
|
|
||||||
void clearAllBreakPoints();
|
void clearAllBreakPoints() const;
|
||||||
|
|
||||||
void addReadTrap(uInt16 t);
|
void addReadTrap(uInt16 t) const;
|
||||||
void addWriteTrap(uInt16 t);
|
void addWriteTrap(uInt16 t) const;
|
||||||
void addTrap(uInt16 t);
|
void addTrap(uInt16 t) const;
|
||||||
void removeReadTrap(uInt16 t);
|
void removeReadTrap(uInt16 t) const;
|
||||||
void removeWriteTrap(uInt16 t);
|
void removeWriteTrap(uInt16 t) const;
|
||||||
void removeTrap(uInt16 t);
|
void removeTrap(uInt16 t) const;
|
||||||
bool readTrap(uInt16 t);
|
bool readTrap(uInt16 t) const;
|
||||||
bool writeTrap(uInt16 t);
|
bool writeTrap(uInt16 t) const;
|
||||||
void clearAllTraps();
|
void clearAllTraps() const;
|
||||||
void log(const string& triggerMsg);
|
void log(const string& triggerMsg);
|
||||||
|
|
||||||
// Set a bunch of RAM locations at once
|
// Set a bunch of RAM locations at once
|
||||||
|
|
|
@ -25,9 +25,7 @@
|
||||||
#include "ControlLowLevel.hxx"
|
#include "ControlLowLevel.hxx"
|
||||||
#include "TIADebug.hxx"
|
#include "TIADebug.hxx"
|
||||||
#include "TiaOutputWidget.hxx"
|
#include "TiaOutputWidget.hxx"
|
||||||
#include "DebuggerParser.hxx"
|
|
||||||
#include "YaccParser.hxx"
|
#include "YaccParser.hxx"
|
||||||
#include "M6502.hxx"
|
|
||||||
#include "Expression.hxx"
|
#include "Expression.hxx"
|
||||||
#include "FSNode.hxx"
|
#include "FSNode.hxx"
|
||||||
#include "OSystem.hxx"
|
#include "OSystem.hxx"
|
||||||
|
@ -177,7 +175,7 @@ void DebuggerParser::outputCommandError(const string& errorMsg, int command)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// Completion-related stuff:
|
// Completion-related stuff:
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void DebuggerParser::getCompletions(const char* in, StringList& completions) const
|
void DebuggerParser::getCompletions(const char* in, StringList& completions)
|
||||||
{
|
{
|
||||||
// cerr << "Attempting to complete \"" << in << "\"" << endl;
|
// cerr << "Attempting to complete \"" << in << "\"" << endl;
|
||||||
for(const auto& c: commands)
|
for(const auto& c: commands)
|
||||||
|
@ -309,7 +307,7 @@ string DebuggerParser::showWatches()
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
for(uInt32 i = 0; i < myWatches.size(); ++i)
|
for(uInt32 i = 0; i < myWatches.size(); ++i)
|
||||||
{
|
{
|
||||||
if(myWatches[i] != "")
|
if(!myWatches[i].empty())
|
||||||
{
|
{
|
||||||
// Clear the args, since we're going to pass them to eval()
|
// Clear the args, since we're going to pass them to eval()
|
||||||
argStrings.clear();
|
argStrings.clear();
|
||||||
|
@ -337,7 +335,7 @@ bool DebuggerParser::getArgs(const string& command, string& verb)
|
||||||
ParseState state = ParseState::IN_COMMAND;
|
ParseState state = ParseState::IN_COMMAND;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
const size_t length = command.length();
|
const size_t length = command.length();
|
||||||
string curArg = "";
|
string curArg;
|
||||||
verb = "";
|
verb = "";
|
||||||
|
|
||||||
argStrings.clear();
|
argStrings.clear();
|
||||||
|
@ -390,14 +388,14 @@ bool DebuggerParser::getArgs(const string& command, string& verb)
|
||||||
while(i < length);
|
while(i < length);
|
||||||
|
|
||||||
// Take care of the last argument, if there is one
|
// Take care of the last argument, if there is one
|
||||||
if(curArg != "")
|
if(!curArg.empty())
|
||||||
argStrings.push_back(curArg);
|
argStrings.push_back(curArg);
|
||||||
|
|
||||||
argCount = static_cast<uInt32>(argStrings.size());
|
argCount = static_cast<uInt32>(argStrings.size());
|
||||||
|
|
||||||
for(uInt32 arg = 0; arg < argCount; ++arg)
|
for(uInt32 arg = 0; arg < argCount; ++arg)
|
||||||
{
|
{
|
||||||
if(!YaccParser::parse(argStrings[arg].c_str()))
|
if(!YaccParser::parse(argStrings[arg]))
|
||||||
{
|
{
|
||||||
unique_ptr<Expression> expr(YaccParser::getResult());
|
unique_ptr<Expression> expr(YaccParser::getResult());
|
||||||
args.push_back(expr->evaluate());
|
args.push_back(expr->evaluate());
|
||||||
|
@ -545,8 +543,8 @@ string DebuggerParser::eval()
|
||||||
{
|
{
|
||||||
string rlabel = debugger.cartDebug().getLabel(args[i], true);
|
string rlabel = debugger.cartDebug().getLabel(args[i], true);
|
||||||
string wlabel = debugger.cartDebug().getLabel(args[i], false);
|
string wlabel = debugger.cartDebug().getLabel(args[i], false);
|
||||||
const bool validR = rlabel != "" && rlabel[0] != '$',
|
const bool validR = !rlabel.empty() && rlabel[0] != '$',
|
||||||
validW = wlabel != "" && wlabel[0] != '$';
|
validW = !wlabel.empty() && wlabel[0] != '$';
|
||||||
if(validR && validW)
|
if(validR && validW)
|
||||||
{
|
{
|
||||||
if(rlabel == wlabel)
|
if(rlabel == wlabel)
|
||||||
|
@ -587,7 +585,7 @@ void DebuggerParser::listTraps(bool listCond)
|
||||||
commandResult << (listCond ? "trapifs:" : "traps:") << endl;
|
commandResult << (listCond ? "trapifs:" : "traps:") << endl;
|
||||||
for(uInt32 i = 0; i < names.size(); ++i)
|
for(uInt32 i = 0; i < names.size(); ++i)
|
||||||
{
|
{
|
||||||
const bool hasCond = names[i] != "";
|
const bool hasCond = !names[i].empty();
|
||||||
if(hasCond == listCond)
|
if(hasCond == listCond)
|
||||||
{
|
{
|
||||||
commandResult << Base::toString(i) << ": ";
|
commandResult << Base::toString(i) << ": ";
|
||||||
|
@ -619,23 +617,23 @@ string DebuggerParser::trapStatus(const Trap& trap)
|
||||||
string lblb = debugger.cartDebug().getLabel(trap.begin, !trap.write);
|
string lblb = debugger.cartDebug().getLabel(trap.begin, !trap.write);
|
||||||
string lble = debugger.cartDebug().getLabel(trap.end, !trap.write);
|
string lble = debugger.cartDebug().getLabel(trap.end, !trap.write);
|
||||||
|
|
||||||
if(lblb != "") {
|
if(!lblb.empty()) {
|
||||||
result << " (";
|
result << " (";
|
||||||
result << lblb;
|
result << lblb;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(trap.begin != trap.end)
|
if(trap.begin != trap.end)
|
||||||
{
|
{
|
||||||
if(lble != "")
|
if(!lble.empty())
|
||||||
{
|
{
|
||||||
if (lblb != "")
|
if(!lblb.empty())
|
||||||
result << " ";
|
result << " ";
|
||||||
else
|
else
|
||||||
result << " (";
|
result << " (";
|
||||||
result << lble;
|
result << lble;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lblb != "" || lble != "")
|
if(!lblb.empty() || !lble.empty())
|
||||||
result << ")";
|
result << ")";
|
||||||
|
|
||||||
return result.str();
|
return result.str();
|
||||||
|
@ -647,7 +645,7 @@ string DebuggerParser::saveScriptFile(string file)
|
||||||
stringstream out;
|
stringstream out;
|
||||||
Debugger::FunctionDefMap funcs = debugger.getFunctionDefMap();
|
Debugger::FunctionDefMap funcs = debugger.getFunctionDefMap();
|
||||||
for(const auto& [name, cmd]: funcs)
|
for(const auto& [name, cmd]: funcs)
|
||||||
if (!debugger.isBuiltinFunction(name))
|
if (!Debugger::isBuiltinFunction(name))
|
||||||
out << "function " << name << " {" << cmd << "}" << endl;
|
out << "function " << name << " {" << cmd << "}" << endl;
|
||||||
|
|
||||||
for(const auto& w: myWatches)
|
for(const auto& w: myWatches)
|
||||||
|
@ -669,7 +667,7 @@ string DebuggerParser::saveScriptFile(string file)
|
||||||
{
|
{
|
||||||
const bool read = myTraps[i]->read,
|
const bool read = myTraps[i]->read,
|
||||||
write = myTraps[i]->write,
|
write = myTraps[i]->write,
|
||||||
hasCond = names[i] != "";
|
hasCond = !names[i].empty();
|
||||||
|
|
||||||
if(read && write)
|
if(read && write)
|
||||||
out << "trap";
|
out << "trap";
|
||||||
|
@ -744,7 +742,7 @@ void DebuggerParser::executeDirective(Device::AccessType type)
|
||||||
const bool result = debugger.cartDebug().addDirective(type, args[0], args[1]);
|
const bool result = debugger.cartDebug().addDirective(type, args[0], args[1]);
|
||||||
|
|
||||||
commandResult << (result ? "added " : "removed ");
|
commandResult << (result ? "added " : "removed ");
|
||||||
debugger.cartDebug().AccessTypeAsString(commandResult, type);
|
CartDebug::AccessTypeAsString(commandResult, type);
|
||||||
commandResult << " directive on range $"
|
commandResult << " directive on range $"
|
||||||
<< hex << args[0] << " $" << hex << args[1];
|
<< hex << args[0] << " $" << hex << args[1];
|
||||||
debugger.rom().invalidate();
|
debugger.rom().invalidate();
|
||||||
|
@ -873,7 +871,7 @@ void DebuggerParser::executeBreak()
|
||||||
// "breakIf"
|
// "breakIf"
|
||||||
void DebuggerParser::executeBreakIf()
|
void DebuggerParser::executeBreakIf()
|
||||||
{
|
{
|
||||||
int res = YaccParser::parse(argStrings[0].c_str());
|
int res = YaccParser::parse(argStrings[0]);
|
||||||
if(res == 0)
|
if(res == 0)
|
||||||
{
|
{
|
||||||
string condition = argStrings[0];
|
string condition = argStrings[0];
|
||||||
|
@ -1273,7 +1271,7 @@ void DebuggerParser::executeDump()
|
||||||
DebuggerDialog* dlg = debugger.myDialog;
|
DebuggerDialog* dlg = debugger.myDialog;
|
||||||
BrowserDialog::show(dlg, "Save Dump as", path.str(),
|
BrowserDialog::show(dlg, "Save Dump as", path.str(),
|
||||||
BrowserDialog::Mode::FileSave,
|
BrowserDialog::Mode::FileSave,
|
||||||
[this, dlg, outStr, resultStr]
|
[dlg, outStr, resultStr]
|
||||||
(bool OK, const FSNode& node)
|
(bool OK, const FSNode& node)
|
||||||
{
|
{
|
||||||
if(OK)
|
if(OK)
|
||||||
|
@ -1352,7 +1350,7 @@ void DebuggerParser::executeFunction()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int res = YaccParser::parse(argStrings[1].c_str());
|
int res = YaccParser::parse(argStrings[1]);
|
||||||
if(res == 0)
|
if(res == 0)
|
||||||
{
|
{
|
||||||
debugger.addFunction(argStrings[0], argStrings[1], YaccParser::getResult());
|
debugger.addFunction(argStrings[0], argStrings[1], YaccParser::getResult());
|
||||||
|
@ -1388,7 +1386,7 @@ void DebuggerParser::executeHelp()
|
||||||
commandResult << setw(static_cast<int>(clen)) << right << c.cmdString
|
commandResult << setw(static_cast<int>(clen)) << right << c.cmdString
|
||||||
<< " - " << c.description << endl;
|
<< " - " << c.description << endl;
|
||||||
|
|
||||||
commandResult << debugger.builtinHelp();
|
commandResult << Debugger::builtinHelp();
|
||||||
}
|
}
|
||||||
else // get help for specific command
|
else // get help for specific command
|
||||||
{
|
{
|
||||||
|
@ -1567,7 +1565,7 @@ void DebuggerParser::executeListBreaks()
|
||||||
|
|
||||||
StringList conds = debugger.m6502().getCondBreakNames();
|
StringList conds = debugger.m6502().getCondBreakNames();
|
||||||
|
|
||||||
if(conds.size() > 0)
|
if(!conds.empty())
|
||||||
{
|
{
|
||||||
if(count)
|
if(count)
|
||||||
commandResult << endl;
|
commandResult << endl;
|
||||||
|
@ -1579,7 +1577,7 @@ void DebuggerParser::executeListBreaks()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(commandResult.str() == "")
|
if(commandResult.str().empty())
|
||||||
commandResult << "no breakpoints set";
|
commandResult << "no breakpoints set";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1599,7 +1597,7 @@ void DebuggerParser::executeListFunctions()
|
||||||
{
|
{
|
||||||
const Debugger::FunctionDefMap& functions = debugger.getFunctionDefMap();
|
const Debugger::FunctionDefMap& functions = debugger.getFunctionDefMap();
|
||||||
|
|
||||||
if(functions.size() > 0)
|
if(!functions.empty())
|
||||||
for(const auto& [name, cmd]: functions)
|
for(const auto& [name, cmd]: functions)
|
||||||
commandResult << name << " -> " << cmd << endl;
|
commandResult << name << " -> " << cmd << endl;
|
||||||
else
|
else
|
||||||
|
@ -1613,7 +1611,7 @@ void DebuggerParser::executeListSaveStateIfs()
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
|
|
||||||
StringList conds = debugger.m6502().getCondSaveStateNames();
|
StringList conds = debugger.m6502().getCondSaveStateNames();
|
||||||
if(conds.size() > 0)
|
if(!conds.empty())
|
||||||
{
|
{
|
||||||
commandResult << "saveStateIf:" << endl;
|
commandResult << "saveStateIf:" << endl;
|
||||||
for(uInt32 i = 0; i < conds.size(); ++i)
|
for(uInt32 i = 0; i < conds.size(); ++i)
|
||||||
|
@ -1623,7 +1621,7 @@ void DebuggerParser::executeListSaveStateIfs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(commandResult.str() == "")
|
if(commandResult.str().empty())
|
||||||
commandResult << "no savestateifs defined";
|
commandResult << "no savestateifs defined";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1639,11 +1637,11 @@ void DebuggerParser::executeListTraps()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (names.size() > 0)
|
if(!names.empty())
|
||||||
{
|
{
|
||||||
bool trapFound = false, trapifFound = false;
|
bool trapFound = false, trapifFound = false;
|
||||||
for(const auto& name: names)
|
for(const auto& name: names)
|
||||||
if(name == "")
|
if(name.empty())
|
||||||
trapFound = true;
|
trapFound = true;
|
||||||
else
|
else
|
||||||
trapifFound = true;
|
trapifFound = true;
|
||||||
|
@ -1705,7 +1703,7 @@ void DebuggerParser::executeN()
|
||||||
// "palette"
|
// "palette"
|
||||||
void DebuggerParser::executePalette()
|
void DebuggerParser::executePalette()
|
||||||
{
|
{
|
||||||
commandResult << debugger.tiaDebug().palette();
|
commandResult << TIADebug::palette();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -2087,7 +2085,7 @@ void DebuggerParser::executeSaveState()
|
||||||
// "saveStateIf"
|
// "saveStateIf"
|
||||||
void DebuggerParser::executeSaveStateIf()
|
void DebuggerParser::executeSaveStateIf()
|
||||||
{
|
{
|
||||||
int res = YaccParser::parse(argStrings[0].c_str());
|
int res = YaccParser::parse(argStrings[0]);
|
||||||
if(res == 0)
|
if(res == 0)
|
||||||
{
|
{
|
||||||
string condition = argStrings[0];
|
string condition = argStrings[0];
|
||||||
|
@ -2130,7 +2128,7 @@ void DebuggerParser::executeStep()
|
||||||
// "stepWhile"
|
// "stepWhile"
|
||||||
void DebuggerParser::executeStepWhile()
|
void DebuggerParser::executeStepWhile()
|
||||||
{
|
{
|
||||||
int res = YaccParser::parse(argStrings[0].c_str());
|
int res = YaccParser::parse(argStrings[0]);
|
||||||
if(res != 0) {
|
if(res != 0) {
|
||||||
commandResult << red("invalid expression");
|
commandResult << red("invalid expression");
|
||||||
return;
|
return;
|
||||||
|
@ -2256,10 +2254,10 @@ void DebuggerParser::executeTraps(bool read, bool write, const string& command,
|
||||||
}
|
}
|
||||||
|
|
||||||
// base addresses of mirrors
|
// base addresses of mirrors
|
||||||
const uInt32 beginRead = debugger.getBaseAddress(begin, true);
|
const uInt32 beginRead = Debugger::getBaseAddress(begin, true);
|
||||||
const uInt32 endRead = debugger.getBaseAddress(end, true);
|
const uInt32 endRead = Debugger::getBaseAddress(end, true);
|
||||||
const uInt32 beginWrite = debugger.getBaseAddress(begin, false);
|
const uInt32 beginWrite = Debugger::getBaseAddress(begin, false);
|
||||||
const uInt32 endWrite = debugger.getBaseAddress(end, false);
|
const uInt32 endWrite = Debugger::getBaseAddress(end, false);
|
||||||
stringstream conditionBuf;
|
stringstream conditionBuf;
|
||||||
|
|
||||||
// parenthesize provided and address range condition(s) (begin)
|
// parenthesize provided and address range condition(s) (begin)
|
||||||
|
@ -2289,7 +2287,7 @@ void DebuggerParser::executeTraps(bool read, bool write, const string& command,
|
||||||
|
|
||||||
const string condition = conditionBuf.str();
|
const string condition = conditionBuf.str();
|
||||||
|
|
||||||
int res = YaccParser::parse(condition.c_str());
|
int res = YaccParser::parse(condition);
|
||||||
if(res == 0)
|
if(res == 0)
|
||||||
{
|
{
|
||||||
// duplicates will remove each other
|
// duplicates will remove each other
|
||||||
|
@ -2334,7 +2332,7 @@ void DebuggerParser::executeTraps(bool read, bool write, const string& command,
|
||||||
// wrapper function for trap(if)/trapRead(if)/trapWrite(if) commands
|
// wrapper function for trap(if)/trapRead(if)/trapWrite(if) commands
|
||||||
void DebuggerParser::executeTrapRW(uInt32 addr, bool read, bool write, bool add)
|
void DebuggerParser::executeTrapRW(uInt32 addr, bool read, bool write, bool add)
|
||||||
{
|
{
|
||||||
switch(debugger.cartDebug().addressType(addr))
|
switch(CartDebug::addressType(addr))
|
||||||
{
|
{
|
||||||
case CartDebug::AddrType::TIA:
|
case CartDebug::AddrType::TIA:
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,7 +42,7 @@ class DebuggerParser
|
||||||
|
|
||||||
/** Given a substring, determine matching substrings from the list
|
/** Given a substring, determine matching substrings from the list
|
||||||
of available commands. Used in the debugger prompt for tab-completion */
|
of available commands. Used in the debugger prompt for tab-completion */
|
||||||
void getCompletions(const char* in, StringList& list) const;
|
static void getCompletions(const char* in, StringList& completions);
|
||||||
|
|
||||||
/** Evaluate the given expression using operators, current base, etc */
|
/** Evaluate the given expression using operators, current base, etc */
|
||||||
int decipher_arg(const string& str);
|
int decipher_arg(const string& str);
|
||||||
|
@ -65,8 +65,8 @@ class DebuggerParser
|
||||||
bool validateArgs(int cmd);
|
bool validateArgs(int cmd);
|
||||||
string eval();
|
string eval();
|
||||||
string saveScriptFile(string file);
|
string saveScriptFile(string file);
|
||||||
void saveDump(const FSNode& node, const stringstream& out,
|
static void saveDump(const FSNode& node, const stringstream& out,
|
||||||
ostringstream& result);
|
ostringstream& result);
|
||||||
const string& cartName() const;
|
const string& cartName() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -80,7 +80,7 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
|
||||||
// multi-byte instruction, then we make note of that address for reference
|
// multi-byte instruction, then we make note of that address for reference
|
||||||
//
|
//
|
||||||
// However, we only do this for labels pointing to ROM (above $1000)
|
// However, we only do this for labels pointing to ROM (above $1000)
|
||||||
if (myDbg.addressType(k + myOffset) == CartDebug::AddrType::ROM) {
|
if (CartDebug::addressType(k + myOffset) == CartDebug::AddrType::ROM) {
|
||||||
reservedLabel.str("");
|
reservedLabel.str("");
|
||||||
reservedLabel << "L" << Base::HEX4 << (k + myOffset);
|
reservedLabel << "L" << Base::HEX4 << (k + myOffset);
|
||||||
myReserved.Label.emplace(k + myOffset, reservedLabel.str());
|
myReserved.Label.emplace(k + myOffset, reservedLabel.str());
|
||||||
|
@ -944,7 +944,7 @@ DiStella::AddressType DiStella::mark(uInt32 address, uInt16 mask, bool directive
|
||||||
|
|
||||||
// Check for equates before ROM/ZP-RAM accesses, because the original logic
|
// Check for equates before ROM/ZP-RAM accesses, because the original logic
|
||||||
// of Distella assumed either equates or ROM; it didn't take ZP-RAM into account
|
// of Distella assumed either equates or ROM; it didn't take ZP-RAM into account
|
||||||
const CartDebug::AddrType type = myDbg.addressType(address);
|
const CartDebug::AddrType type = CartDebug::addressType(address);
|
||||||
if(type == CartDebug::AddrType::TIA) {
|
if(type == CartDebug::AddrType::TIA) {
|
||||||
return AddressType::TIA;
|
return AddressType::TIA;
|
||||||
}
|
}
|
||||||
|
@ -1003,18 +1003,18 @@ bool DiStella::checkBits(uInt16 address, uInt16 mask, uInt16 notMask, bool useDe
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool DiStella::check_range(uInt16 beg, uInt16 end) const
|
bool DiStella::check_range(uInt16 start, uInt16 end) const
|
||||||
{
|
{
|
||||||
if (beg > end) {
|
if (start > end) {
|
||||||
cerr << "Beginning of range greater than end: start = " << std::hex << beg
|
cerr << "Beginning of range greater than end: start = " << std::hex << start
|
||||||
<< ", end = " << std::hex << end << endl;
|
<< ", end = " << std::hex << end << endl;
|
||||||
return false;
|
return false;
|
||||||
} else if (beg > myAppData.end + myOffset) {
|
} else if (start > myAppData.end + myOffset) {
|
||||||
cerr << "Beginning of range out of range: start = " << std::hex << beg
|
cerr << "Beginning of range out of range: start = " << std::hex << start
|
||||||
<< ", range = " << std::hex << (myAppData.end + myOffset) << endl;
|
<< ", range = " << std::hex << (myAppData.end + myOffset) << endl;
|
||||||
return false;
|
return false;
|
||||||
} else if (beg < myOffset) {
|
} else if (start < myOffset) {
|
||||||
cerr << "Beginning of range out of range: start = " << std::hex << beg
|
cerr << "Beginning of range out of range: start = " << std::hex << start
|
||||||
<< ", offset = " << std::hex << myOffset << endl;
|
<< ", offset = " << std::hex << myOffset << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -377,29 +377,29 @@ string RiotDebug::toString()
|
||||||
const auto& oldstate = static_cast<const RiotState&>(getOldState());
|
const auto& oldstate = static_cast<const RiotState&>(getOldState());
|
||||||
|
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
buf << "280/SWCHA(R)=" << myDebugger.invIfChanged(state.SWCHA_R, oldstate.SWCHA_R)
|
buf << "280/SWCHA(R)=" << Debugger::invIfChanged(state.SWCHA_R, oldstate.SWCHA_R)
|
||||||
<< " 280/SWCHA(W)=" << myDebugger.invIfChanged(state.SWCHA_W, oldstate.SWCHA_W)
|
<< " 280/SWCHA(W)=" << Debugger::invIfChanged(state.SWCHA_W, oldstate.SWCHA_W)
|
||||||
<< " 281/SWACNT=" << myDebugger.invIfChanged(state.SWACNT, oldstate.SWACNT)
|
<< " 281/SWACNT=" << Debugger::invIfChanged(state.SWACNT, oldstate.SWACNT)
|
||||||
<< endl
|
<< endl
|
||||||
<< "282/SWCHB(R)=" << myDebugger.invIfChanged(state.SWCHB_R, oldstate.SWCHB_R)
|
<< "282/SWCHB(R)=" << Debugger::invIfChanged(state.SWCHB_R, oldstate.SWCHB_R)
|
||||||
<< " 282/SWCHB(W)=" << myDebugger.invIfChanged(state.SWCHB_W, oldstate.SWCHB_W)
|
<< " 282/SWCHB(W)=" << Debugger::invIfChanged(state.SWCHB_W, oldstate.SWCHB_W)
|
||||||
<< " 283/SWBCNT=" << myDebugger.invIfChanged(state.SWBCNT, oldstate.SWBCNT)
|
<< " 283/SWBCNT=" << Debugger::invIfChanged(state.SWBCNT, oldstate.SWBCNT)
|
||||||
<< endl
|
<< endl
|
||||||
|
|
||||||
// These are squirrely: some symbol files will define these as
|
// These are squirrely: some symbol files will define these as
|
||||||
// 0x284-0x287. Doesn't actually matter, these registers repeat
|
// 0x284-0x287. Doesn't actually matter, these registers repeat
|
||||||
// every 16 bytes.
|
// every 16 bytes.
|
||||||
<< "294/TIM1T=" << myDebugger.invIfChanged(state.TIM1T, oldstate.TIM1T)
|
<< "294/TIM1T=" << Debugger::invIfChanged(state.TIM1T, oldstate.TIM1T)
|
||||||
<< " 295/TIM8T=" << myDebugger.invIfChanged(state.TIM8T, oldstate.TIM8T)
|
<< " 295/TIM8T=" << Debugger::invIfChanged(state.TIM8T, oldstate.TIM8T)
|
||||||
<< " 296/TIM64T=" << myDebugger.invIfChanged(state.TIM64T, oldstate.TIM64T)
|
<< " 296/TIM64T=" << Debugger::invIfChanged(state.TIM64T, oldstate.TIM64T)
|
||||||
<< " 297/T1024T=" << myDebugger.invIfChanged(state.T1024T, oldstate.T1024T)
|
<< " 297/T1024T=" << Debugger::invIfChanged(state.T1024T, oldstate.T1024T)
|
||||||
<< endl
|
<< endl
|
||||||
|
|
||||||
<< "0x284/INTIM=" << myDebugger.invIfChanged(state.INTIM, oldstate.INTIM)
|
<< "0x284/INTIM=" << Debugger::invIfChanged(state.INTIM, oldstate.INTIM)
|
||||||
<< " 285/TIMINT=" << myDebugger.invIfChanged(state.TIMINT, oldstate.TIMINT)
|
<< " 285/TIMINT=" << Debugger::invIfChanged(state.TIMINT, oldstate.TIMINT)
|
||||||
<< " Timer_Clocks=" << myDebugger.invIfChanged(state.TIMCLKS, oldstate.TIMCLKS)
|
<< " Timer_Clocks=" << Debugger::invIfChanged(state.TIMCLKS, oldstate.TIMCLKS)
|
||||||
<< " INTIM_Clocks=" << myDebugger.invIfChanged(state.INTIMCLKS, oldstate.INTIMCLKS)
|
<< " INTIM_Clocks=" << Debugger::invIfChanged(state.INTIMCLKS, oldstate.INTIMCLKS)
|
||||||
<< " Divider=" << myDebugger.invIfChanged(state.TIMDIV, oldstate.TIMDIV)
|
<< " Divider=" << Debugger::invIfChanged(state.TIMDIV, oldstate.TIMDIV)
|
||||||
<< endl
|
<< endl
|
||||||
|
|
||||||
<< "Left/P0diff: " << diffP0String() << " Right/P1diff: " << diffP1String()
|
<< "Left/P0diff: " << diffP0String() << " Right/P1diff: " << diffP1String()
|
||||||
|
|
|
@ -995,7 +995,7 @@ shared_ptr<DelayQueueIterator> TIADebug::delayQueueIterator() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string TIADebug::colorSwatch(uInt8 c) const
|
string TIADebug::colorSwatch(uInt8 c)
|
||||||
{
|
{
|
||||||
string ret;
|
string ret;
|
||||||
|
|
||||||
|
@ -1019,7 +1019,7 @@ string TIADebug::audFreq1()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string TIADebug::audFreq(uInt8 dist, uInt8 div)
|
string TIADebug::audFreq(uInt8 dist, uInt8 div) const
|
||||||
{
|
{
|
||||||
static constexpr uInt16 dist_div[16] = {
|
static constexpr uInt16 dist_div[16] = {
|
||||||
1, 15, 465, 465, 2, 2, 31, 31,
|
1, 15, 465, 465, 2, 2, 31, 31,
|
||||||
|
@ -1154,7 +1154,7 @@ string TIADebug::debugColors() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string TIADebug::palette() const
|
string TIADebug::palette()
|
||||||
{
|
{
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ class TIADebug : public DebuggerSystem
|
||||||
void saveOldState() override;
|
void saveOldState() override;
|
||||||
string toString() override;
|
string toString() override;
|
||||||
string debugColors() const;
|
string debugColors() const;
|
||||||
string palette() const;
|
static string palette();
|
||||||
|
|
||||||
// TIA byte (or part of a byte) registers
|
// TIA byte (or part of a byte) registers
|
||||||
uInt8 nusiz0(int newVal = -1);
|
uInt8 nusiz0(int newVal = -1);
|
||||||
|
@ -185,14 +185,18 @@ class TIADebug : public DebuggerSystem
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Display a color patch for color at given index in the palette */
|
/** Display a color patch for color at given index in the palette */
|
||||||
string colorSwatch(uInt8 c) const;
|
static string colorSwatch(uInt8 c);
|
||||||
|
|
||||||
string audFreq(uInt8 dist, uInt8 div);
|
string audFreq(uInt8 dist, uInt8 div) const;
|
||||||
string stringOnly(const string& value, bool changed = false);
|
static string stringOnly(const string& value, bool changed = false);
|
||||||
string decWithLabel(const string& label, uInt16 value, bool changed = false, uInt16 width = 3);
|
static string decWithLabel(const string& label, uInt16 value,
|
||||||
string hexWithLabel(const string& label, uInt16 value, bool changed = false, uInt16 width = 2);
|
bool changed = false, uInt16 width = 3);
|
||||||
string binWithLabel(const string& label, uInt16 value, bool changed = false);
|
static string hexWithLabel(const string& label, uInt16 value,
|
||||||
string boolWithLabel(const string& label, bool value, bool changed = false);
|
bool changed = false, uInt16 width = 2);
|
||||||
|
static string binWithLabel(const string& label, uInt16 value,
|
||||||
|
bool changed = false);
|
||||||
|
static string boolWithLabel(const string& label, bool value,
|
||||||
|
bool changed = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TiaState myState;
|
TiaState myState;
|
||||||
|
|
|
@ -126,6 +126,3 @@ void BoosterWidget::handleCommand(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
constexpr std::array<Controller::DigitalPin, 5> BoosterWidget::ourPinNo;
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ CartridgeE7Widget::CartridgeE7Widget(
|
||||||
void CartridgeE7Widget::initialize(GuiObject* boss,
|
void CartridgeE7Widget::initialize(GuiObject* boss,
|
||||||
const CartridgeE7& cart, const ostringstream& info)
|
const CartridgeE7& cart, const ostringstream& info)
|
||||||
{
|
{
|
||||||
const uInt32 size = cart.romBankCount() * cart.BANK_SIZE;
|
const uInt32 size = cart.romBankCount() * CartridgeE7::BANK_SIZE;
|
||||||
|
|
||||||
constexpr int xpos = 2;
|
constexpr int xpos = 2;
|
||||||
int ypos = addBaseInformation(size, "M Network", info.str(), 15) + myLineHeight;
|
int ypos = addBaseInformation(size, "M Network", info.str(), 15) + myLineHeight;
|
||||||
|
@ -148,7 +148,7 @@ string CartridgeE7Widget::bankState()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt32 CartridgeE7Widget::internalRamSize()
|
uInt32 CartridgeE7Widget::internalRamSize()
|
||||||
{
|
{
|
||||||
return myCart.RAM_SIZE;
|
return CartridgeE7::RAM_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -52,9 +52,10 @@ class CartridgeE7Widget : public CartDebugWidget
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initialize(GuiObject* boss, const CartridgeE7& cart, const ostringstream& info);
|
void initialize(GuiObject* boss, const CartridgeE7& cart,
|
||||||
|
const ostringstream& info);
|
||||||
const char* getSpotLower(int idx);
|
const char* getSpotLower(int idx);
|
||||||
const char* getSpotUpper(int idx);
|
static const char* getSpotUpper(int idx);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void saveOldState() override;
|
void saveOldState() override;
|
||||||
|
|
|
@ -384,7 +384,7 @@ uInt32 CartridgeEnhancedWidget::internalRamRPort(int start)
|
||||||
string CartridgeEnhancedWidget::internalRamDescription()
|
string CartridgeEnhancedWidget::internalRamDescription()
|
||||||
{
|
{
|
||||||
ostringstream desc;
|
ostringstream desc;
|
||||||
string indent = "";
|
string indent;
|
||||||
|
|
||||||
if(myCart.ramBankCount())
|
if(myCart.ramBankCount())
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,7 +65,7 @@ class CartRamWidget : public Widget, public CommandSender
|
||||||
InternalRamWidget(GuiObject* boss, const GUI::Font& lfont,
|
InternalRamWidget(GuiObject* boss, const GUI::Font& lfont,
|
||||||
const GUI::Font& nfont,
|
const GUI::Font& nfont,
|
||||||
int x, int y, int w, int h,
|
int x, int y, int w, int h,
|
||||||
CartDebugWidget& cartDebug);
|
CartDebugWidget& dbg);
|
||||||
~InternalRamWidget() override = default;
|
~InternalRamWidget() override = default;
|
||||||
string getLabel(int addr) const override;
|
string getLabel(int addr) const override;
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,7 @@
|
||||||
CartridgeWDWidget::CartridgeWDWidget(
|
CartridgeWDWidget::CartridgeWDWidget(
|
||||||
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
||||||
int x, int y, int w, int h, CartridgeWD& cart)
|
int x, int y, int w, int h, CartridgeWD& cart)
|
||||||
: CartridgeEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart),
|
: CartridgeEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart)
|
||||||
myCartWD{cart}
|
|
||||||
{
|
{
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
@ -46,7 +45,7 @@ string CartridgeWDWidget::description()
|
||||||
string CartridgeWDWidget::hotspotStr(int bank, int segment, bool prefix)
|
string CartridgeWDWidget::hotspotStr(int bank, int segment, bool prefix)
|
||||||
{
|
{
|
||||||
ostringstream info;
|
ostringstream info;
|
||||||
const CartridgeWD::BankOrg banks = myCartWD.ourBankOrg[bank];
|
const CartridgeWD::BankOrg banks = CartridgeWD::ourBankOrg[bank];
|
||||||
|
|
||||||
info << "(" << (prefix ? "hotspot " : "")
|
info << "(" << (prefix ? "hotspot " : "")
|
||||||
<< "$" << Common::Base::HEX1 << (myCart.hotspot() + bank) << ") ["
|
<< "$" << Common::Base::HEX1 << (myCart.hotspot() + bank) << ") ["
|
||||||
|
|
|
@ -31,9 +31,6 @@ class CartridgeWDWidget : public CartridgeEnhancedWidget
|
||||||
CartridgeWD& cart);
|
CartridgeWD& cart);
|
||||||
~CartridgeWDWidget() override = default;
|
~CartridgeWDWidget() override = default;
|
||||||
|
|
||||||
private:
|
|
||||||
CartridgeWD& myCartWD;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
string manufacturer() override { return "Wickstead Design"; }
|
string manufacturer() override { return "Wickstead Design"; }
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ class DataGridRamWidget : public DataGridWidget
|
||||||
const GUI::Font& font,
|
const GUI::Font& font,
|
||||||
int x, int y, int cols, int rows,
|
int x, int y, int cols, int rows,
|
||||||
int colchars, int bits,
|
int colchars, int bits,
|
||||||
Common::Base::Fmt format = Common::Base::Fmt::_DEFAULT,
|
Common::Base::Fmt base = Common::Base::Fmt::_DEFAULT,
|
||||||
bool useScrollbar = false);
|
bool useScrollbar = false);
|
||||||
~DataGridRamWidget() override = default;
|
~DataGridRamWidget() override = default;
|
||||||
|
|
||||||
|
|
|
@ -308,7 +308,7 @@ void DataGridWidget::handleMouseWheel(int x, int y, int direction)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
int DataGridWidget::findItem(int x, int y)
|
int DataGridWidget::findItem(int x, int y) const
|
||||||
{
|
{
|
||||||
int row = (y - 1) / _rowHeight;
|
int row = (y - 1) / _rowHeight;
|
||||||
if(row >= _rows) row = _rows - 1;
|
if(row >= _rows) row = _rows - 1;
|
||||||
|
@ -759,8 +759,8 @@ void DataGridWidget::endEditMode()
|
||||||
enableEditMode(false);
|
enableEditMode(false);
|
||||||
|
|
||||||
// Update the both the string representation and the real data
|
// Update the both the string representation and the real data
|
||||||
if(editString().size() > 0 && !(editString()[0] == '$' ||
|
if(!editString().empty() && !(editString()[0] == '$' ||
|
||||||
editString()[0] == '#' || editString()[0] == '\\'))
|
editString()[0] == '#' || editString()[0] == '\\'))
|
||||||
{
|
{
|
||||||
switch(_base)
|
switch(_base)
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,7 +43,7 @@ class DataGridWidget : public EditableWidget
|
||||||
DataGridWidget(GuiObject* boss, const GUI::Font& font,
|
DataGridWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
int x, int y, int cols, int rows,
|
int x, int y, int cols, int rows,
|
||||||
int colchars, int bits,
|
int colchars, int bits,
|
||||||
Common::Base::Fmt format = Common::Base::Fmt::_DEFAULT,
|
Common::Base::Fmt base = Common::Base::Fmt::_DEFAULT,
|
||||||
bool useScrollbar = false);
|
bool useScrollbar = false);
|
||||||
~DataGridWidget() override = default;
|
~DataGridWidget() override = default;
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ class DataGridWidget : public EditableWidget
|
||||||
protected:
|
protected:
|
||||||
void drawWidget(bool hilite) override;
|
void drawWidget(bool hilite) override;
|
||||||
|
|
||||||
int findItem(int x, int y);
|
int findItem(int x, int y) const;
|
||||||
|
|
||||||
void startEditMode() override;
|
void startEditMode() override;
|
||||||
void endEditMode() override;
|
void endEditMode() override;
|
||||||
|
|
|
@ -39,7 +39,8 @@ DelayQueueWidget::DelayQueueWidget(
|
||||||
_w = 20 * font.getMaxCharWidth() + 6;
|
_w = 20 * font.getMaxCharWidth() + 6;
|
||||||
_h = static_cast<int>(myLines.size() * font.getLineHeight() + 6);
|
_h = static_cast<int>(myLines.size() * font.getLineHeight() + 6);
|
||||||
|
|
||||||
for (auto&& line : myLines) line = "";
|
for (auto&& line : myLines)
|
||||||
|
line = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -50,7 +51,7 @@ void DelayQueueWidget::loadConfig() {
|
||||||
using Common::Base;
|
using Common::Base;
|
||||||
for (auto&& line : myLines) {
|
for (auto&& line : myLines) {
|
||||||
if (!delayQueueIterator->isValid()) {
|
if (!delayQueueIterator->isValid()) {
|
||||||
if(line != "")
|
if(!line.empty())
|
||||||
{
|
{
|
||||||
setDirty();
|
setDirty();
|
||||||
line = "";
|
line = "";
|
||||||
|
|
|
@ -126,6 +126,3 @@ void Joy2BPlusWidget::handleCommand(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
constexpr std::array<Controller::DigitalPin, 5> Joy2BPlusWidget::ourPinNo;
|
|
||||||
|
|
|
@ -140,7 +140,8 @@ void PointingDeviceWidget::setGrayCodeV()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void PointingDeviceWidget::setValue(DataGridWidget* grayValue, const int index, const int direction)
|
void PointingDeviceWidget::setValue(DataGridWidget* grayValue,
|
||||||
|
const int index, const int direction)
|
||||||
{
|
{
|
||||||
const uInt8 grayCode = getGrayCodeTable(index, direction);
|
const uInt8 grayCode = getGrayCodeTable(index, direction);
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ class PointingDeviceWidget : public ControllerWidget
|
||||||
|
|
||||||
void setGrayCodeH();
|
void setGrayCodeH();
|
||||||
void setGrayCodeV();
|
void setGrayCodeV();
|
||||||
void setValue(DataGridWidget* greyValue, const int index, const int direction);
|
void setValue(DataGridWidget* grayValue, const int index, const int direction);
|
||||||
|
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
PointingDeviceWidget() = delete;
|
PointingDeviceWidget() = delete;
|
||||||
|
|
|
@ -583,7 +583,7 @@ void PromptWidget::historyAdd(const string& entry)
|
||||||
void PromptWidget::addToHistory(const char* str)
|
void PromptWidget::addToHistory(const char* str)
|
||||||
{
|
{
|
||||||
// Do not add duplicates, remove old duplicate
|
// Do not add duplicates, remove old duplicate
|
||||||
if(_history.size())
|
if(!_history.empty())
|
||||||
{
|
{
|
||||||
int i = _historyIndex;
|
int i = _historyIndex;
|
||||||
const int historyEnd = _historyIndex % _history.size();
|
const int historyEnd = _historyIndex % _history.size();
|
||||||
|
@ -618,7 +618,7 @@ void PromptWidget::addToHistory(const char* str)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool PromptWidget::historyScroll(int direction)
|
bool PromptWidget::historyScroll(int direction)
|
||||||
{
|
{
|
||||||
if(_history.size() == 0)
|
if(_history.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// add current input temporarily to history
|
// add current input temporarily to history
|
||||||
|
@ -695,7 +695,7 @@ bool PromptWidget::execute()
|
||||||
}
|
}
|
||||||
else if(result == "_NO_PROMPT")
|
else if(result == "_NO_PROMPT")
|
||||||
return true;
|
return true;
|
||||||
else if(result != "")
|
else if(!result.empty())
|
||||||
print(result + "\n");
|
print(result + "\n");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -741,7 +741,7 @@ bool PromptWidget::autoComplete(int direction)
|
||||||
|
|
||||||
if(lastDelimPos == -1)
|
if(lastDelimPos == -1)
|
||||||
// no delimiters, do only command completion:
|
// no delimiters, do only command completion:
|
||||||
instance().debugger().parser().getCompletions(_inputStr, list);
|
DebuggerParser::getCompletions(_inputStr, list);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const size_t strLen = len - lastDelimPos - 1;
|
const size_t strLen = len - lastDelimPos - 1;
|
||||||
|
@ -750,7 +750,7 @@ bool PromptWidget::autoComplete(int direction)
|
||||||
{
|
{
|
||||||
// Special case for 'help' command
|
// Special case for 'help' command
|
||||||
if(BSPF::startsWithIgnoreCase(_inputStr, "help"))
|
if(BSPF::startsWithIgnoreCase(_inputStr, "help"))
|
||||||
instance().debugger().parser().getCompletions(_inputStr + lastDelimPos + 1, list);
|
DebuggerParser::getCompletions(_inputStr + lastDelimPos + 1, list);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// we got a delimiter, so this must be a label or a function
|
// we got a delimiter, so this must be a label or a function
|
||||||
|
@ -762,7 +762,7 @@ bool PromptWidget::autoComplete(int direction)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if(list.size() < 1)
|
if(list.empty())
|
||||||
return false;
|
return false;
|
||||||
sort(list.begin(), list.end());
|
sort(list.begin(), list.end());
|
||||||
|
|
||||||
|
|
|
@ -288,7 +288,7 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||||
case kSValEntered:
|
case kSValEntered:
|
||||||
{
|
{
|
||||||
const string& result = doSearch(myInputBox->getResult());
|
const string& result = doSearch(myInputBox->getResult());
|
||||||
if(result != "")
|
if(!result.empty())
|
||||||
myInputBox->setMessage(result);
|
myInputBox->setMessage(result);
|
||||||
else
|
else
|
||||||
myInputBox->close();
|
myInputBox->close();
|
||||||
|
@ -298,7 +298,7 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||||
case kCValEntered:
|
case kCValEntered:
|
||||||
{
|
{
|
||||||
const string& result = doCompare(myInputBox->getResult());
|
const string& result = doCompare(myInputBox->getResult());
|
||||||
if(result != "")
|
if(!result.empty())
|
||||||
myInputBox->setMessage(result);
|
myInputBox->setMessage(result);
|
||||||
else
|
else
|
||||||
myInputBox->close();
|
myInputBox->close();
|
||||||
|
@ -543,7 +543,7 @@ void RamWidget::showSearchResults()
|
||||||
// Only update the search results for the bank currently being shown
|
// Only update the search results for the bank currently being shown
|
||||||
BoolArray temp;
|
BoolArray temp;
|
||||||
const uInt32 start = myCurrentRamBank * myPageSize;
|
const uInt32 start = myCurrentRamBank * myPageSize;
|
||||||
if(mySearchState.size() == 0 || start > mySearchState.size())
|
if(mySearchState.empty() || start > mySearchState.size())
|
||||||
{
|
{
|
||||||
for(uInt32 i = 0; i < myPageSize; ++i)
|
for(uInt32 i = 0; i < myPageSize; ++i)
|
||||||
temp.push_back(false);
|
temp.push_back(false);
|
||||||
|
|
|
@ -521,8 +521,9 @@ void RiotWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
ControllerWidget* RiotWidget::addControlWidget(GuiObject* boss, const GUI::Font& font,
|
ControllerWidget*
|
||||||
int x, int y, Controller& controller)
|
RiotWidget::addControlWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
|
int x, int y, Controller& controller)
|
||||||
{
|
{
|
||||||
switch(controller.type())
|
switch(controller.type())
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,8 @@ class RiotWidget : public Widget, public CommandSender
|
||||||
~RiotWidget() override = default;
|
~RiotWidget() override = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ControllerWidget* addControlWidget(GuiObject* boss, const GUI::Font& font,
|
static ControllerWidget* addControlWidget(
|
||||||
|
GuiObject* boss, const GUI::Font& font,
|
||||||
int x, int y, Controller& controller);
|
int x, int y, Controller& controller);
|
||||||
|
|
||||||
void handleConsole();
|
void handleConsole();
|
||||||
|
|
|
@ -658,7 +658,7 @@ void RomListWidget::startEditMode()
|
||||||
if (isEditable() && !_editMode && _selectedItem >= 0)
|
if (isEditable() && !_editMode && _selectedItem >= 0)
|
||||||
{
|
{
|
||||||
// Does this line represent an editable area?
|
// Does this line represent an editable area?
|
||||||
if(myDisasm->list[_selectedItem].bytes == "")
|
if(myDisasm->list[_selectedItem].bytes.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_editMode = true;
|
_editMode = true;
|
||||||
|
|
|
@ -117,7 +117,7 @@ void TiaOutputWidget::saveSnapshot(int execDepth, const string& execPrefix,
|
||||||
string message = "Snapshot saved";
|
string message = "Snapshot saved";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
instance().png().saveImage(sspath.str(), s, rect);
|
PNGLibrary::saveImage(sspath.str(), s, rect);
|
||||||
}
|
}
|
||||||
catch(const runtime_error& e)
|
catch(const runtime_error& e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,7 @@ void ToggleWidget::handleMouseUp(int x, int y, MouseButton b, int clickCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
int ToggleWidget::findItem(int x, int y)
|
int ToggleWidget::findItem(int x, int y) const
|
||||||
{
|
{
|
||||||
int row = (y - 1) / _rowHeight;
|
int row = (y - 1) / _rowHeight;
|
||||||
if(row >= _rows) row = _rows - 1;
|
if(row >= _rows) row = _rows - 1;
|
||||||
|
|
|
@ -70,7 +70,7 @@ class ToggleWidget : public Widget, public CommandSender
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void drawWidget(bool hilite) override = 0;
|
void drawWidget(bool hilite) override = 0;
|
||||||
int findItem(int x, int y);
|
int findItem(int x, int y) const;
|
||||||
|
|
||||||
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
|
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
|
||||||
void handleMouseUp(int x, int y, MouseButton b, int clickCount) override;
|
void handleMouseUp(int x, int y, MouseButton b, int clickCount) override;
|
||||||
|
|
|
@ -177,7 +177,7 @@ int const_to_int(char* ch)
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// special methods that get Cart RAM/ROM internal state
|
// special methods that get Cart RAM/ROM internal state
|
||||||
CartMethod getCartSpecial(char* ch)
|
CartMethod getCartSpecial(const char* ch)
|
||||||
{
|
{
|
||||||
if(BSPF::equalsIgnoreCase(ch, "_bank"))
|
if(BSPF::equalsIgnoreCase(ch, "_bank"))
|
||||||
return &CartDebug::getPCBank;
|
return &CartDebug::getPCBank;
|
||||||
|
@ -196,7 +196,7 @@ CartMethod getCartSpecial(char* ch)
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// special methods that get e.g. CPU registers
|
// special methods that get e.g. CPU registers
|
||||||
CpuMethod getCpuSpecial(char* ch)
|
CpuMethod getCpuSpecial(const char* ch)
|
||||||
{
|
{
|
||||||
if(BSPF::equalsIgnoreCase(ch, "a"))
|
if(BSPF::equalsIgnoreCase(ch, "a"))
|
||||||
return &CpuDebug::a;
|
return &CpuDebug::a;
|
||||||
|
@ -230,7 +230,7 @@ CpuMethod getCpuSpecial(char* ch)
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// special methods that get RIOT internal state
|
// special methods that get RIOT internal state
|
||||||
RiotMethod getRiotSpecial(char* ch)
|
RiotMethod getRiotSpecial(const char* ch)
|
||||||
{
|
{
|
||||||
if(BSPF::equalsIgnoreCase(ch, "_timWrapRead"))
|
if(BSPF::equalsIgnoreCase(ch, "_timWrapRead"))
|
||||||
return &RiotDebug::timWrappedOnRead;
|
return &RiotDebug::timWrappedOnRead;
|
||||||
|
@ -248,7 +248,7 @@ RiotMethod getRiotSpecial(char* ch)
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// special methods that get TIA internal state
|
// special methods that get TIA internal state
|
||||||
TiaMethod getTiaSpecial(char* ch)
|
TiaMethod getTiaSpecial(const char* ch)
|
||||||
{
|
{
|
||||||
if(BSPF::equalsIgnoreCase(ch, "_scan"))
|
if(BSPF::equalsIgnoreCase(ch, "_scan"))
|
||||||
return &TIADebug::scanlines;
|
return &TIADebug::scanlines;
|
||||||
|
|
|
@ -36,10 +36,10 @@ namespace YaccParser
|
||||||
int parse(const string& in);
|
int parse(const string& in);
|
||||||
int const_to_int(char* ch);
|
int const_to_int(char* ch);
|
||||||
|
|
||||||
CartMethod getCartSpecial(char* ch);
|
CartMethod getCartSpecial(const char* ch);
|
||||||
CpuMethod getCpuSpecial(char* ch);
|
CpuMethod getCpuSpecial(const char* ch);
|
||||||
RiotMethod getRiotSpecial(char* ch);
|
RiotMethod getRiotSpecial(const char* ch);
|
||||||
TiaMethod getTiaSpecial(char* ch);
|
TiaMethod getTiaSpecial(const char* ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -276,17 +276,6 @@ void CartridgeAR::initializeROM()
|
||||||
myImage[(RAM_SIZE) + BANK_SIZE - 1] = 0xF8;
|
myImage[(RAM_SIZE) + BANK_SIZE - 1] = 0xF8;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
uInt8 CartridgeAR::checksum(const uInt8* s, uInt16 length)
|
|
||||||
{
|
|
||||||
uInt8 sum = 0;
|
|
||||||
|
|
||||||
for(uInt32 i = 0; i < length; ++i)
|
|
||||||
sum += s[i];
|
|
||||||
|
|
||||||
return sum;
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CartridgeAR::loadIntoRAM(uInt8 load)
|
void CartridgeAR::loadIntoRAM(uInt8 load)
|
||||||
{
|
{
|
||||||
|
|
|
@ -187,7 +187,13 @@ class CartridgeAR : public Cartridge
|
||||||
bool bankConfiguration(uInt8 configuration);
|
bool bankConfiguration(uInt8 configuration);
|
||||||
|
|
||||||
// Compute the sum of the array of bytes
|
// Compute the sum of the array of bytes
|
||||||
uInt8 checksum(const uInt8* s, uInt16 length);
|
static uInt8 checksum(const uInt8* s, uInt16 length) {
|
||||||
|
uInt8 sum = 0;
|
||||||
|
for(uInt32 i = 0; i < length; ++i)
|
||||||
|
sum += s[i];
|
||||||
|
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
|
||||||
// Load the specified load into SC RAM
|
// Load the specified load into SC RAM
|
||||||
void loadIntoRAM(uInt8 load);
|
void loadIntoRAM(uInt8 load);
|
||||||
|
|
|
@ -72,10 +72,10 @@
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
unique_ptr<Cartridge> CartCreator::create(const FSNode& file,
|
unique_ptr<Cartridge> CartCreator::create(const FSNode& file,
|
||||||
const ByteBuffer& image, size_t size, string& md5,
|
const ByteBuffer& image, size_t size, string& md5,
|
||||||
const string& propertiesType, Settings& settings)
|
const string& dtype, Settings& settings)
|
||||||
{
|
{
|
||||||
unique_ptr<Cartridge> cartridge;
|
unique_ptr<Cartridge> cartridge;
|
||||||
Bankswitch::Type type = Bankswitch::nameToType(propertiesType),
|
Bankswitch::Type type = Bankswitch::nameToType(dtype),
|
||||||
detectedType = type;
|
detectedType = type;
|
||||||
string id;
|
string id;
|
||||||
|
|
||||||
|
|
|
@ -430,16 +430,12 @@ bool CartDetector::isProbably4KSC(const ByteBuffer& image, size_t size)
|
||||||
{
|
{
|
||||||
// We check if the first 256 bytes are identical *and* if there's
|
// We check if the first 256 bytes are identical *and* if there's
|
||||||
// an "SC" signature for one of our larger SC types at 1FFA.
|
// an "SC" signature for one of our larger SC types at 1FFA.
|
||||||
|
|
||||||
const uInt8 first = image[0];
|
const uInt8 first = image[0];
|
||||||
for(uInt32 i = 1; i < 256; ++i)
|
for(uInt32 i = 1; i < 256; ++i)
|
||||||
if(image[i] != first)
|
if(image[i] != first)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if((image[size-6]=='S') && (image[size-5]=='C'))
|
return (image[size-6] == 'S') && (image[size-5] == 'C');
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -31,20 +31,20 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
static constexpr uInt8 LO_JUMP_BYTE(uInt16 b) {
|
constexpr uInt8 LO_JUMP_BYTE(uInt16 b) {
|
||||||
return b & 0xff;
|
return b & 0xff;
|
||||||
}
|
}
|
||||||
static constexpr uInt8 HI_JUMP_BYTE(uInt16 b) {
|
constexpr uInt8 HI_JUMP_BYTE(uInt16 b) {
|
||||||
return ((b & 0xff00) >> 8) | 0x10;
|
return ((b & 0xff00) >> 8) | 0x10;
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr uInt8 COLOR_BLUE = 0x9A;
|
constexpr uInt8 COLOR_BLUE = 0x9A;
|
||||||
// static constexpr uInt8 COLOR_WHITE = 0x0E;
|
// constexpr uInt8 COLOR_WHITE = 0x0E;
|
||||||
|
|
||||||
static constexpr uInt8 OSD_FRAMES = 180;
|
constexpr uInt8 OSD_FRAMES = 180;
|
||||||
static constexpr int BACK_SECONDS = 10;
|
constexpr int BACK_SECONDS = 10;
|
||||||
|
|
||||||
static constexpr int TITLE_CYCLES = 1000000;
|
constexpr int TITLE_CYCLES = 1000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include "Booster.hxx"
|
#include "Booster.hxx"
|
||||||
#include "Cart.hxx"
|
#include "Cart.hxx"
|
||||||
#include "Control.hxx"
|
#include "Control.hxx"
|
||||||
#include "Cart.hxx"
|
|
||||||
#include "CartCM.hxx"
|
#include "CartCM.hxx"
|
||||||
#include "Driving.hxx"
|
#include "Driving.hxx"
|
||||||
#include "Event.hxx"
|
#include "Event.hxx"
|
||||||
|
@ -161,7 +160,7 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
|
||||||
myDevSettingsHandler = make_unique<DevSettingsHandler>(myOSystem);
|
myDevSettingsHandler = make_unique<DevSettingsHandler>(myOSystem);
|
||||||
|
|
||||||
// Auto-detect NTSC/PAL mode if it's requested
|
// Auto-detect NTSC/PAL mode if it's requested
|
||||||
string autodetected = "";
|
string autodetected;
|
||||||
myDisplayFormat = myProperties.get(PropType::Display_Format);
|
myDisplayFormat = myProperties.get(PropType::Display_Format);
|
||||||
|
|
||||||
if (myDisplayFormat == "AUTO")
|
if (myDisplayFormat == "AUTO")
|
||||||
|
@ -296,9 +295,9 @@ void Console::autodetectFrameLayout(bool reset)
|
||||||
for(int i = 0; i < 20; ++i)
|
for(int i = 0; i < 20; ++i)
|
||||||
myTIA->update();
|
myTIA->update();
|
||||||
|
|
||||||
frameLayoutDetector.simulateInput(*myRiot, myOSystem.eventHandler(), true);
|
FrameLayoutDetector::simulateInput(*myRiot, myOSystem.eventHandler(), true);
|
||||||
myTIA->update();
|
myTIA->update();
|
||||||
frameLayoutDetector.simulateInput(*myRiot, myOSystem.eventHandler(), false);
|
FrameLayoutDetector::simulateInput(*myRiot, myOSystem.eventHandler(), false);
|
||||||
|
|
||||||
for(int i = 0; i < 40; ++i)
|
for(int i = 0; i < 40; ++i)
|
||||||
myTIA->update();
|
myTIA->update();
|
||||||
|
@ -441,8 +440,7 @@ void Console::setFormat(uInt32 format, bool force)
|
||||||
if(!force && myCurrentFormat == format)
|
if(!force && myCurrentFormat == format)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string saveformat, message;
|
string saveformat, message, autodetected;
|
||||||
string autodetected = "";
|
|
||||||
|
|
||||||
myCurrentFormat = format;
|
myCurrentFormat = format;
|
||||||
switch(myCurrentFormat)
|
switch(myCurrentFormat)
|
||||||
|
|
|
@ -45,10 +45,10 @@ Controller::Type ControllerDetector::detectType(
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string ControllerDetector::detectName(const ByteBuffer& image, size_t size,
|
string ControllerDetector::detectName(const ByteBuffer& image, size_t size,
|
||||||
const Controller::Type controller, const Controller::Jack port,
|
const Controller::Type type, const Controller::Jack port,
|
||||||
const Settings& settings)
|
const Settings& settings)
|
||||||
{
|
{
|
||||||
return Controller::getName(detectType(image, size, controller, port, settings));
|
return Controller::getName(detectType(image, size, type, port, settings));
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -34,15 +34,15 @@ class ControllerDetector
|
||||||
/**
|
/**
|
||||||
Detects the controller type at the given port if no controller is provided.
|
Detects the controller type at the given port if no controller is provided.
|
||||||
|
|
||||||
@param image A reference to the ROM image
|
@param image A reference to the ROM image
|
||||||
@param size The size of the ROM image
|
@param size The size of the ROM image
|
||||||
@param controller The provided controller type of the ROM image
|
@param type The provided controller type of the ROM image
|
||||||
@param port The port to be checked
|
@param port The port to be checked
|
||||||
@param settings A reference to the various settings (read-only)
|
@param settings A reference to the various settings (read-only)
|
||||||
@return The detected controller type
|
@return The detected controller type
|
||||||
*/
|
*/
|
||||||
static Controller::Type detectType(const ByteBuffer& image, size_t size,
|
static Controller::Type detectType(const ByteBuffer& image, size_t size,
|
||||||
const Controller::Type controller, const Controller::Jack port,
|
const Controller::Type type, const Controller::Jack port,
|
||||||
const Settings& settings);
|
const Settings& settings);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -128,7 +128,7 @@ class EmulationWorker
|
||||||
/**
|
/**
|
||||||
Log a fatal error to cerr and throw a runtime exception.
|
Log a fatal error to cerr and throw a runtime exception.
|
||||||
*/
|
*/
|
||||||
[[noreturn]] void fatal(const string& message);
|
[[noreturn]] static void fatal(const string& message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -270,7 +270,7 @@ void EventHandler::poll(uInt64 time)
|
||||||
myOSystem.state().update();
|
myOSystem.state().update();
|
||||||
|
|
||||||
#ifdef CHEATCODE_SUPPORT
|
#ifdef CHEATCODE_SUPPORT
|
||||||
for(auto& cheat: myOSystem.cheat().perFrame())
|
for(const auto& cheat: myOSystem.cheat().perFrame())
|
||||||
cheat->evaluate();
|
cheat->evaluate();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -392,6 +392,7 @@ void EventHandler::handleSystemEvent(SystemEvent e, int, int)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
// NOLINTNEXTLINE (readability-function-size)
|
||||||
void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
||||||
{
|
{
|
||||||
// Take care of special events that aren't part of the emulation core
|
// Take care of special events that aren't part of the emulation core
|
||||||
|
@ -1548,7 +1549,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
||||||
msg.push_back("");
|
msg.push_back("");
|
||||||
msg.push_back("You will lose all your progress.");
|
msg.push_back("You will lose all your progress.");
|
||||||
}
|
}
|
||||||
myOSystem.messageMenu().setMessage("Exit Emulation", msg, true);
|
MessageMenu::setMessage("Exit Emulation", msg, true);
|
||||||
enterMenuMode(EventHandlerState::MESSAGEMENU);
|
enterMenuMode(EventHandlerState::MESSAGEMENU);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1913,15 +1914,15 @@ void EventHandler::setActionMappings(EventMode mode)
|
||||||
|
|
||||||
#ifdef JOYSTICK_SUPPORT
|
#ifdef JOYSTICK_SUPPORT
|
||||||
const string joydesc = myPJoyHandler->getMappingDesc(event, mode);
|
const string joydesc = myPJoyHandler->getMappingDesc(event, mode);
|
||||||
if(joydesc != "")
|
if(!joydesc.empty())
|
||||||
{
|
{
|
||||||
if(key != "")
|
if(!key.empty())
|
||||||
key += ", ";
|
key += ", ";
|
||||||
key += joydesc;
|
key += joydesc;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(key != "")
|
if(!key.empty())
|
||||||
item.key = key;
|
item.key = key;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1935,15 +1936,15 @@ void EventHandler::setActionMappings(EventMode mode)
|
||||||
|
|
||||||
#ifdef JOYSTICK_SUPPORT
|
#ifdef JOYSTICK_SUPPORT
|
||||||
const string joydesc = myPJoyHandler->getMappingDesc(event, mode);
|
const string joydesc = myPJoyHandler->getMappingDesc(event, mode);
|
||||||
if(joydesc != "")
|
if(!joydesc.empty())
|
||||||
{
|
{
|
||||||
if(key != "")
|
if(!key.empty())
|
||||||
key += ", ";
|
key += ", ";
|
||||||
key += joydesc;
|
key += joydesc;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(key != "")
|
if(!key.empty())
|
||||||
item.key = key;
|
item.key = key;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2035,7 +2036,7 @@ json EventHandler::convertLegacyComboMapping(string list)
|
||||||
events.push_back(Event::Type(event));
|
events.push_back(Event::Type(event));
|
||||||
}
|
}
|
||||||
// only store if there are any NoType events
|
// only store if there are any NoType events
|
||||||
if(events.size())
|
if(!events.empty())
|
||||||
{
|
{
|
||||||
json combo;
|
json combo;
|
||||||
|
|
||||||
|
@ -2173,7 +2174,7 @@ void EventHandler::saveComboMapping()
|
||||||
events.push_back(Event::Type(event));
|
events.push_back(Event::Type(event));
|
||||||
}
|
}
|
||||||
// only store if there are any NoType events
|
// only store if there are any NoType events
|
||||||
if(events.size())
|
if(!events.empty())
|
||||||
{
|
{
|
||||||
json combo;
|
json combo;
|
||||||
|
|
||||||
|
@ -2186,7 +2187,7 @@ void EventHandler::saveComboMapping()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
StringList EventHandler::getActionList(EventMode mode) const
|
StringList EventHandler::getActionList(EventMode mode)
|
||||||
{
|
{
|
||||||
StringList l;
|
StringList l;
|
||||||
switch(mode)
|
switch(mode)
|
||||||
|
@ -2206,10 +2207,8 @@ StringList EventHandler::getActionList(EventMode mode) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
StringList EventHandler::getActionList(Event::Group group) const
|
StringList EventHandler::getActionList(Event::Group group)
|
||||||
{
|
{
|
||||||
StringList l;
|
|
||||||
|
|
||||||
switch(group)
|
switch(group)
|
||||||
{
|
{
|
||||||
case Event::Group::Menu:
|
case Event::Group::Menu:
|
||||||
|
@ -2252,12 +2251,13 @@ StringList EventHandler::getActionList(Event::Group group) const
|
||||||
return getActionList(ComboEvents);
|
return getActionList(ComboEvents);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return l; // ToDo
|
return {}; // ToDo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
StringList EventHandler::getActionList(const Event::EventSet& events, EventMode mode) const
|
StringList EventHandler::getActionList(const Event::EventSet& events,
|
||||||
|
EventMode mode)
|
||||||
{
|
{
|
||||||
StringList l;
|
StringList l;
|
||||||
|
|
||||||
|
@ -2286,7 +2286,7 @@ StringList EventHandler::getActionList(const Event::EventSet& events, EventMode
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
VariantList EventHandler::getComboList() const
|
VariantList EventHandler::getComboList()
|
||||||
{
|
{
|
||||||
// For now, this only works in emulation mode
|
// For now, this only works in emulation mode
|
||||||
VariantList l;
|
VariantList l;
|
||||||
|
@ -2355,7 +2355,7 @@ void EventHandler::setComboListForEvent(Event::Type event, const StringList& eve
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
int EventHandler::getEmulActionListIndex(int idx, const Event::EventSet& events) const
|
int EventHandler::getEmulActionListIndex(int idx, const Event::EventSet& events)
|
||||||
{
|
{
|
||||||
// idx = index into intersection set of 'events' and 'ourEmulActionList'
|
// idx = index into intersection set of 'events' and 'ourEmulActionList'
|
||||||
// ordered by 'ourEmulActionList'!
|
// ordered by 'ourEmulActionList'!
|
||||||
|
@ -2383,7 +2383,7 @@ int EventHandler::getEmulActionListIndex(int idx, const Event::EventSet& events)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
int EventHandler::getActionListIndex(int idx, Event::Group group) const
|
int EventHandler::getActionListIndex(int idx, Event::Group group)
|
||||||
{
|
{
|
||||||
switch(group)
|
switch(group)
|
||||||
{
|
{
|
||||||
|
@ -2432,7 +2432,7 @@ int EventHandler::getActionListIndex(int idx, Event::Group group) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Event::Type EventHandler::eventAtIndex(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);
|
||||||
|
|
||||||
|
@ -2453,7 +2453,7 @@ Event::Type EventHandler::eventAtIndex(int idx, Event::Group group) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string EventHandler::actionAtIndex(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);
|
||||||
|
|
||||||
|
@ -2474,7 +2474,7 @@ string EventHandler::actionAtIndex(int idx, Event::Group group) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string EventHandler::keyAtIndex(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);
|
||||||
|
|
||||||
|
@ -2527,7 +2527,7 @@ void EventHandler::changeMouseControllerMode(int direction)
|
||||||
string usemouse = myOSystem.settings().getString("usemouse");
|
string usemouse = myOSystem.settings().getString("usemouse");
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(auto& mode : MODES)
|
for(const auto& mode : MODES)
|
||||||
{
|
{
|
||||||
if(mode == usemouse)
|
if(mode == usemouse)
|
||||||
{
|
{
|
||||||
|
|
|
@ -160,11 +160,11 @@ class EventHandler
|
||||||
Send an event directly to the event handler.
|
Send an event directly to the event handler.
|
||||||
These events cannot be remapped.
|
These events cannot be remapped.
|
||||||
|
|
||||||
@param type The event
|
@param event The event
|
||||||
@param value The value to use for the event
|
@param value The value to use for the event
|
||||||
@param repeated Repeated key (true) or first press/release (false)
|
@param repeated Repeated key (true) or first press/release (false)
|
||||||
*/
|
*/
|
||||||
void handleEvent(Event::Type type, Int32 value = 1, bool repeated = false);
|
void handleEvent(Event::Type event, Int32 value = 1, bool repeated = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Handle events that must be processed each time a new console is
|
Handle events that must be processed each time a new console is
|
||||||
|
@ -174,8 +174,8 @@ class EventHandler
|
||||||
|
|
||||||
bool frying() const { return myFryingFlag; }
|
bool frying() const { return myFryingFlag; }
|
||||||
|
|
||||||
StringList getActionList(Event::Group group) const;
|
static StringList getActionList(Event::Group group);
|
||||||
VariantList getComboList() const;
|
static VariantList getComboList();
|
||||||
|
|
||||||
/** Used to access the list of events assigned to a specific combo event. */
|
/** Used to access the list of events assigned to a specific combo event. */
|
||||||
StringList getComboListForEvent(Event::Type event) const;
|
StringList getComboListForEvent(Event::Type event) const;
|
||||||
|
@ -205,9 +205,9 @@ class EventHandler
|
||||||
return myPKeyHandler->getMappingDesc(event, mode);
|
return myPKeyHandler->getMappingDesc(event, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
Event::Type eventAtIndex(int idx, Event::Group group) const;
|
static Event::Type eventAtIndex(int idx, Event::Group group);
|
||||||
string actionAtIndex(int idx, Event::Group group) const;
|
static string actionAtIndex(int idx, Event::Group group);
|
||||||
string keyAtIndex(int idx, Event::Group group) const;
|
static string keyAtIndex(int idx, Event::Group group);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Bind a key to an event/action and regenerate the mapping array(s).
|
Bind a key to an event/action and regenerate the mapping array(s).
|
||||||
|
@ -427,14 +427,15 @@ class EventHandler
|
||||||
void handleSystemEvent(SystemEvent e, int data1 = 0, int data2 = 0);
|
void handleSystemEvent(SystemEvent e, int data1 = 0, int data2 = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Add the given joystick to the list of physical joysticks available to the handler.
|
Add the given joystick to the list of physical joysticks available to
|
||||||
|
the handler.
|
||||||
*/
|
*/
|
||||||
void addPhysicalJoystick(const PhysicalJoystickPtr& stick);
|
void addPhysicalJoystick(const PhysicalJoystickPtr& joy);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Remove physical joystick at the current index.
|
Remove physical joystick with the givem id.
|
||||||
*/
|
*/
|
||||||
void removePhysicalJoystick(int index);
|
void removePhysicalJoystick(int id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Define event groups
|
// Define event groups
|
||||||
|
@ -459,11 +460,12 @@ class EventHandler
|
||||||
static nlohmann::json convertLegacyComboMapping(string list);
|
static nlohmann::json convertLegacyComboMapping(string list);
|
||||||
void saveComboMapping();
|
void saveComboMapping();
|
||||||
|
|
||||||
StringList getActionList(EventMode mode) const;
|
static StringList getActionList(EventMode mode);
|
||||||
StringList getActionList(const Event::EventSet& events, EventMode mode = EventMode::kEmulationMode) const;
|
static StringList getActionList(const Event::EventSet& events,
|
||||||
|
EventMode mode = EventMode::kEmulationMode);
|
||||||
// returns the action array index of the index in the provided group
|
// returns the action array index of the index in the provided group
|
||||||
int getEmulActionListIndex(int idx, const Event::EventSet& events) const;
|
static int getEmulActionListIndex(int idx, const Event::EventSet& events);
|
||||||
int getActionListIndex(int idx, Event::Group group) const;
|
static int getActionListIndex(int idx, Event::Group group);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Structure used for action menu items
|
// Structure used for action menu items
|
||||||
|
|
|
@ -298,7 +298,7 @@ void FBSurface::frameRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void FBSurface::splitString(const GUI::Font& font, const string& s, int w,
|
void FBSurface::splitString(const GUI::Font& font, const string& s, int w,
|
||||||
string& left, string& right) const
|
string& left, string& right)
|
||||||
{
|
{
|
||||||
#ifdef GUI_SUPPORT
|
#ifdef GUI_SUPPORT
|
||||||
uInt32 pos = 0;
|
uInt32 pos = 0;
|
||||||
|
@ -334,12 +334,6 @@ void FBSurface::splitString(const GUI::Font& font, const string& s, int w,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
bool FBSurface::isWhiteSpace(const char c) const
|
|
||||||
{
|
|
||||||
return string(" ,.;:+-*/\\'([\n").find(c) != string::npos;
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
int FBSurface::drawString(const GUI::Font& font, const string& s,
|
int FBSurface::drawString(const GUI::Font& font, const string& s,
|
||||||
int x, int y, int w, int h,
|
int x, int y, int w, int h,
|
||||||
|
|
|
@ -267,8 +267,8 @@ class FBSurface
|
||||||
@param left The left part of the split string
|
@param left The left part of the split string
|
||||||
@param right The right part of the split string
|
@param right The right part of the split string
|
||||||
*/
|
*/
|
||||||
void splitString(const GUI::Font& font, const string& s, int w,
|
static void splitString(const GUI::Font& font, const string& s, int w,
|
||||||
string& left, string& right) const;
|
string& left, string& right);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The rendering attributes that can be modified for this texture.
|
The rendering attributes that can be modified for this texture.
|
||||||
|
@ -403,7 +403,9 @@ class FBSurface
|
||||||
@param c Character to check
|
@param c Character to check
|
||||||
@return True if whitespace character
|
@return True if whitespace character
|
||||||
*/
|
*/
|
||||||
bool isWhiteSpace(const char c) const;
|
static bool isWhiteSpace(const char c) {
|
||||||
|
return string(" ,.;:+-*/\\'([\n").find(c) != string::npos;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uInt32* myPixels{nullptr}; // NOTE: MUST be set in child classes
|
uInt32* myPixels{nullptr}; // NOTE: MUST be set in child classes
|
||||||
|
|
|
@ -206,7 +206,7 @@ void FrameBuffer::setupFonts()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
FontDesc FrameBuffer::getFontDesc(const string& name) const
|
FontDesc FrameBuffer::getFontDesc(const string& name)
|
||||||
{
|
{
|
||||||
if(name == "small")
|
if(name == "small")
|
||||||
return GUI::consoleDesc; // 8x13
|
return GUI::consoleDesc; // 8x13
|
||||||
|
|
|
@ -324,7 +324,7 @@ class FrameBuffer
|
||||||
|
|
||||||
@return The description of the font
|
@return The description of the font
|
||||||
*/
|
*/
|
||||||
FontDesc getFontDesc(const string& name) const;
|
static FontDesc getFontDesc(const string& name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -164,7 +164,7 @@ GlobalKeyHandler::Group GlobalKeyHandler::getGroup() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool GlobalKeyHandler::isJoystick(const Controller& controller) const
|
bool GlobalKeyHandler::isJoystick(const Controller& controller)
|
||||||
{
|
{
|
||||||
return controller.type() == Controller::Type::Joystick
|
return controller.type() == Controller::Type::Joystick
|
||||||
|| controller.type() == Controller::Type::BoosterGrip
|
|| controller.type() == Controller::Type::BoosterGrip
|
||||||
|
@ -175,7 +175,7 @@ bool GlobalKeyHandler::isJoystick(const Controller& controller) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool GlobalKeyHandler::isPaddle(const Controller& controller) const
|
bool GlobalKeyHandler::isPaddle(const Controller& controller)
|
||||||
{
|
{
|
||||||
return controller.type() == Controller::Type::Paddles
|
return controller.type() == Controller::Type::Paddles
|
||||||
|| controller.type() == Controller::Type::PaddlesIAxDr
|
|| controller.type() == Controller::Type::PaddlesIAxDr
|
||||||
|
@ -186,7 +186,7 @@ bool GlobalKeyHandler::isPaddle(const Controller& controller) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool GlobalKeyHandler::isTrackball(const Controller& controller) const
|
bool GlobalKeyHandler::isTrackball(const Controller& controller)
|
||||||
{
|
{
|
||||||
return controller.type() == Controller::Type::AmigaMouse
|
return controller.type() == Controller::Type::AmigaMouse
|
||||||
|| controller.type() == Controller::Type::AtariMouse
|
|| controller.type() == Controller::Type::AtariMouse
|
||||||
|
@ -283,7 +283,7 @@ bool GlobalKeyHandler::skipDebugSetting() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
const GlobalKeyHandler::Function GlobalKeyHandler::cycleSetting(int direction)
|
GlobalKeyHandler::Function GlobalKeyHandler::cycleSetting(int direction)
|
||||||
{
|
{
|
||||||
bool skip = false;
|
bool skip = false;
|
||||||
|
|
||||||
|
|
|
@ -167,17 +167,21 @@ class GlobalKeyHandler
|
||||||
// Get group based on given setting
|
// Get group based on given setting
|
||||||
Group getGroup() const;
|
Group getGroup() const;
|
||||||
// Cycle settings using given direction (can be 0)
|
// Cycle settings using given direction (can be 0)
|
||||||
const Function cycleSetting(int direction);
|
Function cycleSetting(int direction);
|
||||||
// Get adjustment function and if it is repeated
|
// Get adjustment function and if it is repeated
|
||||||
SettingData getSettingData(const Setting setting) const;
|
SettingData getSettingData(const Setting setting) const;
|
||||||
|
|
||||||
PhysicalJoystickHandler& joyHandler() const { return myOSystem.eventHandler().joyHandler(); }
|
PhysicalJoystickHandler& joyHandler() const {
|
||||||
PhysicalKeyboardHandler& keyHandler() const { return myOSystem.eventHandler().keyHandler(); }
|
return myOSystem.eventHandler().joyHandler();
|
||||||
|
}
|
||||||
|
PhysicalKeyboardHandler& keyHandler() const {
|
||||||
|
return myOSystem.eventHandler().keyHandler();
|
||||||
|
}
|
||||||
|
|
||||||
// Check if controller type is used (skips related input settings if not)
|
// Check if controller type is used (skips related input settings if not)
|
||||||
bool isJoystick(const Controller& controller) const;
|
static bool isJoystick(const Controller& controller);
|
||||||
bool isPaddle(const Controller& controller) const;
|
static bool isPaddle(const Controller& controller);
|
||||||
bool isTrackball(const Controller& controller) const;
|
static bool isTrackball(const Controller& controller);
|
||||||
|
|
||||||
// Check if a currently non-relevant adjustment can be skipped
|
// Check if a currently non-relevant adjustment can be skipped
|
||||||
bool skipAVSetting() const;
|
bool skipAVSetting() const;
|
||||||
|
|
|
@ -55,7 +55,8 @@ Keyboard::Keyboard(Jack jack, const Event& event, const System& system)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Keyboard::ColumnState Keyboard::processColumn(const Event::Type buttons[]) {
|
Keyboard::ColumnState Keyboard::processColumn(const Event::Type buttons[])
|
||||||
|
{
|
||||||
static constexpr DigitalPin signals[] =
|
static constexpr DigitalPin signals[] =
|
||||||
{DigitalPin::One, DigitalPin::Two, DigitalPin::Three, DigitalPin::Four};
|
{DigitalPin::One, DigitalPin::Two, DigitalPin::Three, DigitalPin::Four};
|
||||||
|
|
||||||
|
@ -69,8 +70,11 @@ Keyboard::ColumnState Keyboard::processColumn(const Event::Type buttons[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
AnalogReadout::Connection Keyboard::columnStateToAnalogSignal(ColumnState state) const {
|
AnalogReadout::Connection
|
||||||
switch (state) {
|
Keyboard::columnStateToAnalogSignal(ColumnState state)
|
||||||
|
{
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
case ColumnState::gnd:
|
case ColumnState::gnd:
|
||||||
return AnalogReadout::connectToGround();
|
return AnalogReadout::connectToGround();
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ class Keyboard : public Controller
|
||||||
private:
|
private:
|
||||||
ColumnState processColumn(const Event::Type buttons[]);
|
ColumnState processColumn(const Event::Type buttons[]);
|
||||||
|
|
||||||
AnalogReadout::Connection columnStateToAnalogSignal(ColumnState state) const;
|
static AnalogReadout::Connection columnStateToAnalogSignal(ColumnState state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Pre-compute the events we care about based on given port
|
// Pre-compute the events we care about based on given port
|
||||||
|
|
|
@ -210,7 +210,7 @@ void KidVid::setNextSong()
|
||||||
{
|
{
|
||||||
if(myFileOpened)
|
if(myFileOpened)
|
||||||
{
|
{
|
||||||
myBeep = (ourSongPositions[myFilePointer] & 0x80) ? false : true;
|
myBeep = (ourSongPositions[myFilePointer] & 0x80) == 0;
|
||||||
|
|
||||||
const uInt8 temp = ourSongPositions[myFilePointer] & 0x7f;
|
const uInt8 temp = ourSongPositions[myFilePointer] & 0x7f;
|
||||||
mySharedData = (temp < 10);
|
mySharedData = (temp < 10);
|
||||||
|
|
|
@ -121,7 +121,7 @@ inline uInt8 M6502::peek(uInt16 address, Device::AccessFlags flags)
|
||||||
if(myReadTraps.isInitialized() && myReadTraps.isSet(address)
|
if(myReadTraps.isInitialized() && myReadTraps.isSet(address)
|
||||||
&& (myGhostReadsTrap || flags != DISASM_NONE))
|
&& (myGhostReadsTrap || flags != DISASM_NONE))
|
||||||
{
|
{
|
||||||
myLastPeekBaseAddress = myDebugger->getBaseAddress(myLastPeekAddress, true); // mirror handling
|
myLastPeekBaseAddress = Debugger::getBaseAddress(myLastPeekAddress, true); // mirror handling
|
||||||
const int cond = evalCondTraps();
|
const int cond = evalCondTraps();
|
||||||
if(cond > -1)
|
if(cond > -1)
|
||||||
{
|
{
|
||||||
|
@ -157,7 +157,7 @@ inline void M6502::poke(uInt16 address, uInt8 value, Device::AccessFlags flags)
|
||||||
#ifdef DEBUGGER_SUPPORT
|
#ifdef DEBUGGER_SUPPORT
|
||||||
if(myWriteTraps.isInitialized() && myWriteTraps.isSet(address))
|
if(myWriteTraps.isInitialized() && myWriteTraps.isSet(address))
|
||||||
{
|
{
|
||||||
myLastPokeBaseAddress = myDebugger->getBaseAddress(myLastPokeAddress, false); // mirror handling
|
myLastPokeBaseAddress = Debugger::getBaseAddress(myLastPokeAddress, false); // mirror handling
|
||||||
const int cond = evalCondTraps();
|
const int cond = evalCondTraps();
|
||||||
if(cond > -1)
|
if(cond > -1)
|
||||||
{
|
{
|
||||||
|
@ -188,9 +188,9 @@ inline void M6502::handleHalt()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void M6502::execute(uInt64 number, DispatchResult& result)
|
void M6502::execute(uInt64 cycles, DispatchResult& result)
|
||||||
{
|
{
|
||||||
_execute(number, result);
|
_execute(cycles, result);
|
||||||
|
|
||||||
#ifdef DEBUGGER_SUPPORT
|
#ifdef DEBUGGER_SUPPORT
|
||||||
// Debugger hack: this ensures that stepping a "STA WSYNC" will actually end at the
|
// Debugger hack: this ensures that stepping a "STA WSYNC" will actually end at the
|
||||||
|
@ -208,16 +208,17 @@ void M6502::execute(uInt64 number, DispatchResult& result)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool M6502::execute(uInt64 number)
|
bool M6502::execute(uInt64 cycles)
|
||||||
{
|
{
|
||||||
DispatchResult result;
|
DispatchResult result;
|
||||||
|
|
||||||
execute(number, result);
|
execute(cycles, result);
|
||||||
|
|
||||||
return result.isSuccess();
|
return result.isSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
// NOLINTNEXTLINE (readability-function-size)
|
||||||
inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
|
inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
|
||||||
{
|
{
|
||||||
myExecutionStatus = 0;
|
myExecutionStatus = 0;
|
||||||
|
@ -682,7 +683,7 @@ const StringList& M6502::getCondTrapNames() const
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void M6502::updateStepStateByInstruction()
|
void M6502::updateStepStateByInstruction()
|
||||||
{
|
{
|
||||||
myStepStateByInstruction = myCondBreaks.size() || myCondSaveStates.size() ||
|
myStepStateByInstruction =
|
||||||
myTrapConds.size();
|
!myCondBreaks.empty() || !myCondSaveStates.empty() || !myTrapConds.empty();
|
||||||
}
|
}
|
||||||
#endif // DEBUGGER_SUPPORT
|
#endif // DEBUGGER_SUPPORT
|
||||||
|
|
|
@ -114,10 +114,10 @@ class M6502 : public Serializable
|
||||||
is executed, someone stops execution, or an error occurs. Answers
|
is executed, someone stops execution, or an error occurs. Answers
|
||||||
true iff execution stops normally.
|
true iff execution stops normally.
|
||||||
|
|
||||||
@param cycles Indicates the number of cycles to execute. Not that the actual
|
@param cycles Indicates the number of cycles to execute. Not that the
|
||||||
granularity of the CPU is instructions, so this is only accurate up to
|
actual granularity of the CPU is instructions, so this
|
||||||
a couple of cycles
|
is only accurate up to a couple of cycles
|
||||||
@param result A DispatchResult object that will transport the result
|
@param result A DispatchResult object that will transport the result
|
||||||
*/
|
*/
|
||||||
void execute(uInt64 cycles, DispatchResult& result);
|
void execute(uInt64 cycles, DispatchResult& result);
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue