Resolved a couple bool/int comparision compiler warnings. Fixed Qt GUI crash when setting 4 score settings without a ROM loaded.

This commit is contained in:
mjbudd77 2021-03-19 21:37:27 -04:00
parent bc3b156cf5
commit 2f097ff4b3
5 changed files with 30 additions and 5 deletions

View File

@ -1000,7 +1000,7 @@ void GamePadConfDialog_t::updatePeriodic(void)
}
}
int fourScore;
bool fourScore = false;
g_config->getOption("SDL.FourScore", &fourScore);
if (fourScore != efs_chkbox->isChecked())
{

View File

@ -557,7 +557,7 @@ void InputConfDialog_t::updatePeriodic(void)
{
bool updateNeeded = false;
int tmpCurInputType[3], tmpUsrInputType[3];
int fourScoreValue;
bool fourScoreValue = false;
for (int i = 0; i < 3; i++)
{

View File

@ -447,6 +447,23 @@ Config::getOption(const std::string &name,
return 0;
}
int
Config::getOption(const std::string &name,
bool *value) const
{
std::map<std::string, int>::const_iterator opt_i;
// confirm that the option exists
opt_i = _intOptMap.find(name);
if(opt_i == _intOptMap.end()) {
return -1;
}
// get the option
(*value) = opt_i->second ? true : false;
return 0;
}
int
Config::getOption(const std::string &name,
double *value) const

View File

@ -69,6 +69,7 @@ public:
int getOption(const std::string &, std::string *) const;
int getOption(const std::string &, const char **) const;
int getOption(const std::string &, int *) const;
int getOption(const std::string &, bool *) const;
int getOption(const std::string &, double *) const;
/**

View File

@ -486,9 +486,16 @@ static void SetInputStuff(int port)
switch(joyports[port].type)
{
case SI_GAMEPAD:
if(GameInfo->type==GIT_VSUNI){
joyports[port].driver = &GPCVS;
} else {
if (GameInfo)
{
if (GameInfo->type==GIT_VSUNI){
joyports[port].driver = &GPCVS;
} else {
joyports[port].driver= &GPC;
}
}
else
{
joyports[port].driver= &GPC;
}
break;