Merge pull request #636 from fmahnke/cheat-fix

Fixes for updating the cheats list.
This commit is contained in:
thor2016 2023-04-20 21:18:55 -04:00 committed by GitHub
commit 0942d160ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 8 deletions

View File

@ -704,14 +704,10 @@ int GuiCheatsDialog_t::activeCheatListCB(const char *name, uint32 a, uint8 v, in
if (item == NULL)
{
item = new QTreeWidgetItem();
actvCheatList->addTopLevelItem(item);
item = new QTreeWidgetItem(actvCheatList);
}
//item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsUserCheckable );
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemNeverHasChildren);
item->setCheckState(0, s ? Qt::Checked : Qt::Unchecked);
item->setText(0, tr(codeStr));
@ -737,8 +733,6 @@ void GuiCheatsDialog_t::showActiveCheatList(bool redraw)
enaCheats->setChecked(!globalCheatDisabled);
actvCheatRedraw = redraw;
if (redraw)
{
actvCheatList->clear();
@ -746,6 +740,8 @@ void GuiCheatsDialog_t::showActiveCheatList(bool redraw)
actvCheatIdx = 0;
FCEUI_ListCheats(::activeCheatListCB, (void *)this);
actvCheatList->viewport()->update();
}
//----------------------------------------------------------------------------
void GuiCheatsDialog_t::openCheatFile(void)

View File

@ -72,7 +72,6 @@ protected:
int fontCharWidth;
int actvCheatIdx;
bool actvCheatRedraw;
bool pauseWhileActive;
bool wasPausedByCheats;

View File

@ -42,6 +42,7 @@
#include "Qt/config.h"
#include "Qt/keyscan.h"
#include "Qt/fceuWrapper.h"
#include "Qt/CheatsConf.h"
#include "Qt/HexEditor.h"
#include "Qt/GameGenie.h"
@ -278,6 +279,7 @@ void GameGenieDialog_t::addCheatClicked(void)
FCEU_WRAPPER_LOCK();
FCEUI_AddCheat( name.c_str(), a, v, c, 1 );
updateCheatDialog();
FCEU_WRAPPER_UNLOCK();
}