Cheats config improvements for Qt GUI. Added global cheat enable/disable hotkey functionality. Added code to raise and set focus on cheat dialog when attempting to open it when it is already opened. Add code to update/refresh cheat dialog when loading a new ROM.
This commit is contained in:
parent
6b8387b849
commit
319b365787
|
@ -52,6 +52,9 @@ void openCheatDialog(QWidget *parent)
|
||||||
{
|
{
|
||||||
if (win != NULL)
|
if (win != NULL)
|
||||||
{
|
{
|
||||||
|
win->activateWindow();
|
||||||
|
win->raise();
|
||||||
|
win->setFocus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
win = new GuiCheatsDialog_t(parent);
|
win = new GuiCheatsDialog_t(parent);
|
||||||
|
@ -198,6 +201,18 @@ GuiCheatsDialog_t::GuiCheatsDialog_t(QWidget *parent)
|
||||||
|
|
||||||
vbox1->addLayout(hbox);
|
vbox1->addLayout(hbox);
|
||||||
|
|
||||||
|
hbox = new QHBoxLayout();
|
||||||
|
lbl = new QLabel(tr("Type:"));
|
||||||
|
typeEntry = new QComboBox();
|
||||||
|
typeEntry->addItem(tr("0: Periodic Set (Every Frame)"), 0 );
|
||||||
|
typeEntry->addItem(tr("1: Substitute/Freeze"), 1 );
|
||||||
|
typeEntry->setCurrentIndex(1);
|
||||||
|
|
||||||
|
hbox->addWidget(lbl,1);
|
||||||
|
hbox->addWidget(typeEntry,10);
|
||||||
|
|
||||||
|
vbox1->addLayout(hbox);
|
||||||
|
|
||||||
hbox = new QHBoxLayout();
|
hbox = new QHBoxLayout();
|
||||||
|
|
||||||
addCheatBtn = new QPushButton(tr("Add"));
|
addCheatBtn = new QPushButton(tr("Add"));
|
||||||
|
@ -435,6 +450,8 @@ GuiCheatsDialog_t::GuiCheatsDialog_t(QWidget *parent)
|
||||||
|
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
|
modCheatBtn->setDefault(true);
|
||||||
|
|
||||||
connect(srchResetBtn, SIGNAL(clicked(void)), this, SLOT(resetSearchCallback(void)));
|
connect(srchResetBtn, SIGNAL(clicked(void)), this, SLOT(resetSearchCallback(void)));
|
||||||
connect(knownValBtn, SIGNAL(clicked(void)), this, SLOT(knownValueCallback(void)));
|
connect(knownValBtn, SIGNAL(clicked(void)), this, SLOT(knownValueCallback(void)));
|
||||||
connect(eqValBtn, SIGNAL(clicked(void)), this, SLOT(equalValueCallback(void)));
|
connect(eqValBtn, SIGNAL(clicked(void)), this, SLOT(equalValueCallback(void)));
|
||||||
|
@ -719,6 +736,8 @@ void GuiCheatsDialog_t::showActiveCheatList(bool redraw)
|
||||||
{
|
{
|
||||||
win = this;
|
win = this;
|
||||||
|
|
||||||
|
enaCheats->setChecked(!globalCheatDisabled);
|
||||||
|
|
||||||
actvCheatRedraw = redraw;
|
actvCheatRedraw = redraw;
|
||||||
|
|
||||||
if (redraw)
|
if (redraw)
|
||||||
|
@ -871,6 +890,7 @@ void GuiCheatsDialog_t::addActvCheat(void)
|
||||||
uint32 a = 0;
|
uint32 a = 0;
|
||||||
uint8 v = 0;
|
uint8 v = 0;
|
||||||
int c = -1;
|
int c = -1;
|
||||||
|
int t = 1;
|
||||||
std::string name, cmpStr;
|
std::string name, cmpStr;
|
||||||
|
|
||||||
a = strtoul(cheatAddrEntry->displayText().toStdString().c_str(), NULL, 16);
|
a = strtoul(cheatAddrEntry->displayText().toStdString().c_str(), NULL, 16);
|
||||||
|
@ -890,8 +910,10 @@ void GuiCheatsDialog_t::addActvCheat(void)
|
||||||
|
|
||||||
name = cheatNameEntry->text().toStdString();
|
name = cheatNameEntry->text().toStdString();
|
||||||
|
|
||||||
|
t = typeEntry->currentData().toInt();
|
||||||
|
|
||||||
FCEU_WRAPPER_LOCK();
|
FCEU_WRAPPER_LOCK();
|
||||||
FCEUI_AddCheat(name.c_str(), a, v, c, 1);
|
FCEUI_AddCheat(name.c_str(), a, v, c, t);
|
||||||
FCEU_WRAPPER_UNLOCK();
|
FCEU_WRAPPER_UNLOCK();
|
||||||
|
|
||||||
showActiveCheatList(true);
|
showActiveCheatList(true);
|
||||||
|
@ -921,6 +943,7 @@ void GuiCheatsDialog_t::deleteActvCheat(void)
|
||||||
cheatAddrEntry->setText(tr(""));
|
cheatAddrEntry->setText(tr(""));
|
||||||
cheatValEntry->setText(tr(""));
|
cheatValEntry->setText(tr(""));
|
||||||
cheatCmpEntry->setText(tr(""));
|
cheatCmpEntry->setText(tr(""));
|
||||||
|
typeEntry->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void GuiCheatsDialog_t::updateCheatParameters(void)
|
void GuiCheatsDialog_t::updateCheatParameters(void)
|
||||||
|
@ -969,6 +992,8 @@ void GuiCheatsDialog_t::updateCheatParameters(void)
|
||||||
|
|
||||||
//printf("Name: %s \n", name.c_str() );
|
//printf("Name: %s \n", name.c_str() );
|
||||||
|
|
||||||
|
type = typeEntry->currentData().toInt();
|
||||||
|
|
||||||
FCEU_WRAPPER_LOCK();
|
FCEU_WRAPPER_LOCK();
|
||||||
|
|
||||||
FCEUI_SetCheat(row, &name, a, v, c, s, type);
|
FCEUI_SetCheat(row, &name, a, v, c, s, type);
|
||||||
|
@ -1022,6 +1047,8 @@ void GuiCheatsDialog_t::actvCheatItemClicked(QTreeWidgetItem *item, int column)
|
||||||
}
|
}
|
||||||
|
|
||||||
cheatNameEntry->setText(tr(name.c_str()));
|
cheatNameEntry->setText(tr(name.c_str()));
|
||||||
|
|
||||||
|
typeEntry->setCurrentIndex(type);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void GuiCheatsDialog_t::globalEnableCheats(int state)
|
void GuiCheatsDialog_t::globalEnableCheats(int state)
|
||||||
|
|
|
@ -67,6 +67,7 @@ protected:
|
||||||
QLineEdit *neValEntry;
|
QLineEdit *neValEntry;
|
||||||
QLineEdit *grValEntry;
|
QLineEdit *grValEntry;
|
||||||
QLineEdit *ltValEntry;
|
QLineEdit *ltValEntry;
|
||||||
|
QComboBox *typeEntry;
|
||||||
QFont font;
|
QFont font;
|
||||||
|
|
||||||
int fontCharWidth;
|
int fontCharWidth;
|
||||||
|
|
|
@ -862,6 +862,7 @@ void consoleWin_t::initHotKeys(void)
|
||||||
connect( Hotkeys[ HK_TOGGLE_BG ].getShortcut(), SIGNAL(activated()), this, SLOT(toggleBackground(void)) );
|
connect( Hotkeys[ HK_TOGGLE_BG ].getShortcut(), SIGNAL(activated()), this, SLOT(toggleBackground(void)) );
|
||||||
connect( Hotkeys[ HK_TOGGLE_FG ].getShortcut(), SIGNAL(activated()), this, SLOT(toggleForeground(void)) );
|
connect( Hotkeys[ HK_TOGGLE_FG ].getShortcut(), SIGNAL(activated()), this, SLOT(toggleForeground(void)) );
|
||||||
connect( Hotkeys[ HK_FKB_ENABLE ].getShortcut(), SIGNAL(activated()), this, SLOT(toggleFamKeyBrdEnable(void)) );
|
connect( Hotkeys[ HK_FKB_ENABLE ].getShortcut(), SIGNAL(activated()), this, SLOT(toggleFamKeyBrdEnable(void)) );
|
||||||
|
connect( Hotkeys[ HK_TOGGLE_ALL_CHEATS ].getShortcut(), SIGNAL(activated()), this, SLOT(toggleGlobalCheatEnable(void)) );
|
||||||
|
|
||||||
connect( Hotkeys[ HK_SAVE_STATE_0 ].getShortcut(), SIGNAL(activated()), this, SLOT(saveState0(void)) );
|
connect( Hotkeys[ HK_SAVE_STATE_0 ].getShortcut(), SIGNAL(activated()), this, SLOT(saveState0(void)) );
|
||||||
connect( Hotkeys[ HK_SAVE_STATE_1 ].getShortcut(), SIGNAL(activated()), this, SLOT(saveState1(void)) );
|
connect( Hotkeys[ HK_SAVE_STATE_1 ].getShortcut(), SIGNAL(activated()), this, SLOT(saveState1(void)) );
|
||||||
|
@ -3173,6 +3174,20 @@ void consoleWin_t::toggleFamKeyBrdEnable(void)
|
||||||
toggleFamilyKeyboardFunc();
|
toggleFamilyKeyboardFunc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int globalCheatDisabled;
|
||||||
|
|
||||||
|
void consoleWin_t::toggleGlobalCheatEnable(void)
|
||||||
|
{
|
||||||
|
FCEU_WRAPPER_LOCK();
|
||||||
|
FCEUI_GlobalToggleCheat(globalCheatDisabled);
|
||||||
|
FCEU_WRAPPER_UNLOCK();
|
||||||
|
|
||||||
|
g_config->setOption("SDL.CheatsDisabled", globalCheatDisabled);
|
||||||
|
g_config->save();
|
||||||
|
|
||||||
|
updateCheatDialog();
|
||||||
|
}
|
||||||
|
|
||||||
void consoleWin_t::warnAmbiguousShortcut( QShortcut *shortcut)
|
void consoleWin_t::warnAmbiguousShortcut( QShortcut *shortcut)
|
||||||
{
|
{
|
||||||
char stmp[256];
|
char stmp[256];
|
||||||
|
|
|
@ -415,6 +415,7 @@ class consoleWin_t : public QMainWindow
|
||||||
void toggleBackground(void);
|
void toggleBackground(void);
|
||||||
void toggleForeground(void);
|
void toggleForeground(void);
|
||||||
void toggleFamKeyBrdEnable(void);
|
void toggleFamKeyBrdEnable(void);
|
||||||
|
void toggleGlobalCheatEnable(void);
|
||||||
void saveState0(void);
|
void saveState0(void);
|
||||||
void saveState1(void);
|
void saveState1(void);
|
||||||
void saveState2(void);
|
void saveState2(void);
|
||||||
|
|
|
@ -83,6 +83,9 @@ int getHotKeyConfig( int i, const char **nameOut, const char **keySeqOut, const
|
||||||
case HK_CHEAT_MENU:
|
case HK_CHEAT_MENU:
|
||||||
name = "CheatMenu"; keySeq = ""; title = "Open Cheat Window"; group = "Tools";
|
name = "CheatMenu"; keySeq = ""; title = "Open Cheat Window"; group = "Tools";
|
||||||
break;
|
break;
|
||||||
|
case HK_TOGGLE_ALL_CHEATS:
|
||||||
|
name = "ToggleCheats"; keySeq = ""; title = "Toggle Global Cheat Enable"; group = "Tools";
|
||||||
|
break;
|
||||||
case HK_BIND_STATE:
|
case HK_BIND_STATE:
|
||||||
name = "BindState"; keySeq = ""; title = "Bind Save State to Movie"; group = "Movie";
|
name = "BindState"; keySeq = ""; title = "Bind Save State to Movie"; group = "Movie";
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -53,7 +53,7 @@ enum HOTKEY {
|
||||||
// Display
|
// Display
|
||||||
HK_TOGGLE_FG, HK_TOGGLE_BG, HK_TOGGLE_INPUT_DISPLAY, HK_LAG_COUNTER_DISPLAY,
|
HK_TOGGLE_FG, HK_TOGGLE_BG, HK_TOGGLE_INPUT_DISPLAY, HK_LAG_COUNTER_DISPLAY,
|
||||||
|
|
||||||
HK_CHEAT_MENU, HK_LOAD_LUA,
|
HK_CHEAT_MENU, HK_TOGGLE_ALL_CHEATS, HK_LOAD_LUA,
|
||||||
HK_MUTE_CAPTURE,
|
HK_MUTE_CAPTURE,
|
||||||
HK_FA_LAG_SKIP,
|
HK_FA_LAG_SKIP,
|
||||||
HK_VOLUME_DOWN, HK_VOLUME_UP,
|
HK_VOLUME_DOWN, HK_VOLUME_UP,
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include "Qt/unix-netplay.h"
|
#include "Qt/unix-netplay.h"
|
||||||
#include "Qt/AviRecord.h"
|
#include "Qt/AviRecord.h"
|
||||||
#include "Qt/HexEditor.h"
|
#include "Qt/HexEditor.h"
|
||||||
|
#include "Qt/CheatsConf.h"
|
||||||
#include "Qt/SymbolicDebug.h"
|
#include "Qt/SymbolicDebug.h"
|
||||||
#include "Qt/CodeDataLogger.h"
|
#include "Qt/CodeDataLogger.h"
|
||||||
#include "Qt/ConsoleDebugger.h"
|
#include "Qt/ConsoleDebugger.h"
|
||||||
|
@ -352,6 +353,8 @@ int LoadGame(const char *path, bool silent)
|
||||||
|
|
||||||
debugSymbolTable.loadGameSymbols();
|
debugSymbolTable.loadGameSymbols();
|
||||||
|
|
||||||
|
updateCheatDialog();
|
||||||
|
|
||||||
CDLoggerROMChanged();
|
CDLoggerROMChanged();
|
||||||
|
|
||||||
int state_to_load;
|
int state_to_load;
|
||||||
|
|
Loading…
Reference in New Issue