mirror of https://github.com/snes9xgit/snes9x.git
Qt: Add unworking cheats window.
This commit is contained in:
parent
9dbb36ead0
commit
ea28e6d0d9
45
cheats.h
45
cheats.h
|
@ -7,17 +7,20 @@
|
||||||
#ifndef _CHEATS_H_
|
#ifndef _CHEATS_H_
|
||||||
#define _CHEATS_H_
|
#define _CHEATS_H_
|
||||||
|
|
||||||
#include "port.h"
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
using bool8 = uint8_t;
|
||||||
|
|
||||||
struct SCheat
|
struct SCheat
|
||||||
{
|
{
|
||||||
uint32 address;
|
uint32_t address;
|
||||||
uint8 byte;
|
uint8_t byte;
|
||||||
uint8 saved_byte;
|
uint8_t saved_byte;
|
||||||
bool8 conditional;
|
bool8 conditional;
|
||||||
bool8 cond_true;
|
bool8 cond_true;
|
||||||
uint8 cond_byte;
|
uint8_t cond_byte;
|
||||||
bool8 enabled;
|
bool8 enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -32,14 +35,14 @@ struct SCheatData
|
||||||
{
|
{
|
||||||
std::vector<struct SCheatGroup> group;
|
std::vector<struct SCheatGroup> group;
|
||||||
bool8 enabled;
|
bool8 enabled;
|
||||||
uint8 CWRAM[0x20000];
|
uint8_t CWRAM[0x20000];
|
||||||
uint8 CSRAM[0x80000];
|
uint8_t CSRAM[0x80000];
|
||||||
uint8 CIRAM[0x2000];
|
uint8_t CIRAM[0x2000];
|
||||||
uint8 *RAM;
|
uint8_t *RAM;
|
||||||
uint8 *FillRAM;
|
uint8_t *FillRAM;
|
||||||
uint8 *SRAM;
|
uint8_t *SRAM;
|
||||||
uint32 ALL_BITS[0x32000 >> 5];
|
uint32_t ALL_BITS[0x32000 >> 5];
|
||||||
uint8 CWatchRAM[0x32000];
|
uint8_t CWatchRAM[0x32000];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Watch
|
struct Watch
|
||||||
|
@ -47,7 +50,7 @@ struct Watch
|
||||||
bool on;
|
bool on;
|
||||||
int size;
|
int size;
|
||||||
int format;
|
int format;
|
||||||
uint32 address;
|
uint32_t address;
|
||||||
char buf[12];
|
char buf[12];
|
||||||
char desc[32];
|
char desc[32];
|
||||||
};
|
};
|
||||||
|
@ -74,12 +77,12 @@ extern SCheatData Cheat;
|
||||||
extern Watch watches[16];
|
extern Watch watches[16];
|
||||||
|
|
||||||
int S9xAddCheatGroup(const std::string &name, const std::string &cheat);
|
int S9xAddCheatGroup(const std::string &name, const std::string &cheat);
|
||||||
int S9xModifyCheatGroup(uint32 index, const std::string &name, const std::string &cheat);
|
int S9xModifyCheatGroup(uint32_t index, const std::string &name, const std::string &cheat);
|
||||||
void S9xEnableCheatGroup(uint32 index);
|
void S9xEnableCheatGroup(uint32_t index);
|
||||||
void S9xDisableCheatGroup(uint32 index);
|
void S9xDisableCheatGroup(uint32_t index);
|
||||||
void S9xDeleteCheats(void);
|
void S9xDeleteCheats(void);
|
||||||
std::string S9xCheatGroupToText(uint32 index);
|
std::string S9xCheatGroupToText(uint32_t index);
|
||||||
void S9xDeleteCheatGroup(uint32 index);
|
void S9xDeleteCheatGroup(uint32_t index);
|
||||||
bool8 S9xLoadCheatFile(const std::string &filename);
|
bool8 S9xLoadCheatFile(const std::string &filename);
|
||||||
bool8 S9xSaveCheatFile(const std::string &filename);
|
bool8 S9xSaveCheatFile(const std::string &filename);
|
||||||
void S9xUpdateCheatsInMemory(void);
|
void S9xUpdateCheatsInMemory(void);
|
||||||
|
@ -92,8 +95,8 @@ void S9xInitCheatData (void);
|
||||||
void S9xInitWatchedAddress (void);
|
void S9xInitWatchedAddress (void);
|
||||||
void S9xStartCheatSearch (SCheatData *);
|
void S9xStartCheatSearch (SCheatData *);
|
||||||
void S9xSearchForChange (SCheatData *, S9xCheatComparisonType, S9xCheatDataSize, bool8, bool8);
|
void S9xSearchForChange (SCheatData *, S9xCheatComparisonType, S9xCheatDataSize, bool8, bool8);
|
||||||
void S9xSearchForValue (SCheatData *, S9xCheatComparisonType, S9xCheatDataSize, uint32, bool8, bool8);
|
void S9xSearchForValue (SCheatData *, S9xCheatComparisonType, S9xCheatDataSize, uint32_t, bool8, bool8);
|
||||||
void S9xSearchForAddress (SCheatData *, S9xCheatComparisonType, S9xCheatDataSize, uint32, bool8);
|
void S9xSearchForAddress (SCheatData *, S9xCheatComparisonType, S9xCheatDataSize, uint32_t, bool8);
|
||||||
void S9xOutputCheatSearchResults (SCheatData *);
|
void S9xOutputCheatSearchResults (SCheatData *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -146,6 +146,7 @@ list(APPEND QT_GUI_SOURCES
|
||||||
src/FoldersPanel.cpp
|
src/FoldersPanel.cpp
|
||||||
src/SDLInputManager.cpp
|
src/SDLInputManager.cpp
|
||||||
src/ShaderParametersDialog.cpp
|
src/ShaderParametersDialog.cpp
|
||||||
|
src/CheatsDialog.cpp
|
||||||
src/SoftwareScalers.cpp
|
src/SoftwareScalers.cpp
|
||||||
src/EmuCanvasQt.cpp
|
src/EmuCanvasQt.cpp
|
||||||
src/EmuCanvasOpenGL.cpp
|
src/EmuCanvasOpenGL.cpp
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
#include "CheatsDialog.hpp"
|
||||||
|
|
||||||
|
static const auto desired_flags = Qt::ItemFlag::ItemIsUserCheckable |
|
||||||
|
Qt::ItemFlag::ItemIsEnabled |
|
||||||
|
Qt::ItemFlag::ItemIsSelectable |
|
||||||
|
Qt::ItemFlag::ItemIsDragEnabled;
|
||||||
|
|
||||||
|
CheatsDialog::CheatsDialog(QWidget *parent, EmuApplication *app_)
|
||||||
|
: app(app_), QDialog(parent)
|
||||||
|
{
|
||||||
|
setupUi(this);
|
||||||
|
show();
|
||||||
|
|
||||||
|
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||||
|
item->setFlags(desired_flags);
|
||||||
|
item->setCheckState(0, Qt::CheckState::Checked);
|
||||||
|
item->setText(1, "Invincibility");
|
||||||
|
item->setText(2, "dd32-6dad");
|
||||||
|
|
||||||
|
treeWidget_cheats->insertTopLevelItem(0, item);
|
||||||
|
item = new QTreeWidgetItem();
|
||||||
|
item->setFlags(desired_flags);
|
||||||
|
item->setCheckState(0, Qt::CheckState::Checked);
|
||||||
|
item->setText(1, "Torzx");
|
||||||
|
item->setText(2, "7e0fff:ff\n7e0ff7:ff");
|
||||||
|
treeWidget_cheats->insertTopLevelItem(1, item);
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
#include "ui_CheatsDialog.h"
|
||||||
|
|
||||||
|
class EmuApplication;
|
||||||
|
|
||||||
|
class CheatsDialog : public QDialog, public Ui_Dialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CheatsDialog(QWidget *parent, EmuApplication *app);
|
||||||
|
|
||||||
|
EmuApplication *app;
|
||||||
|
};
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Dialog</class>
|
||||||
|
<widget class="QDialog" name="Dialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>466</width>
|
||||||
|
<height>399</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Code:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEdit_description"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Description:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEdit_code"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_add">
|
||||||
|
<property name="text">
|
||||||
|
<string>Add</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_update">
|
||||||
|
<property name="text">
|
||||||
|
<string>Update</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_remove">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_remove_all">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove All</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_check_database">
|
||||||
|
<property name="text">
|
||||||
|
<string>Check Database</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTreeWidget" name="treeWidget_cheats">
|
||||||
|
<property name="rootIsDecorated">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="itemsExpandable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Enabled</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Description</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Code</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>lineEdit_description</tabstop>
|
||||||
|
<tabstop>lineEdit_code</tabstop>
|
||||||
|
<tabstop>pushButton_add</tabstop>
|
||||||
|
<tabstop>pushButton_update</tabstop>
|
||||||
|
<tabstop>pushButton_remove</tabstop>
|
||||||
|
<tabstop>pushButton_remove_all</tabstop>
|
||||||
|
<tabstop>pushButton_check_database</tabstop>
|
||||||
|
</tabstops>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -17,7 +17,8 @@
|
||||||
#include "EmuCanvasVulkan.hpp"
|
#include "EmuCanvasVulkan.hpp"
|
||||||
#include "EmuCanvasOpenGL.hpp"
|
#include "EmuCanvasOpenGL.hpp"
|
||||||
#include "EmuCanvasQt.hpp"
|
#include "EmuCanvasQt.hpp"
|
||||||
#include "src/ShaderParametersDialog.hpp"
|
#include "CheatsDialog.hpp"
|
||||||
|
#include "ShaderParametersDialog.hpp"
|
||||||
#undef KeyPress
|
#undef KeyPress
|
||||||
|
|
||||||
static EmuSettingsWindow *g_emu_settings_window = nullptr;
|
static EmuSettingsWindow *g_emu_settings_window = nullptr;
|
||||||
|
@ -260,6 +261,14 @@ void EmuMainWindow::createWidgets()
|
||||||
});
|
});
|
||||||
core_actions.push_back(hard_reset_item);
|
core_actions.push_back(hard_reset_item);
|
||||||
|
|
||||||
|
emulation_menu->addSeparator();
|
||||||
|
|
||||||
|
auto cheats_item = emulation_menu->addAction(tr("&Cheats"));
|
||||||
|
connect(cheats_item, &QAction::triggered, [&] {
|
||||||
|
auto cheats_dialog = new CheatsDialog(this, app);
|
||||||
|
});
|
||||||
|
core_actions.push_back(cheats_item);
|
||||||
|
|
||||||
menuBar()->addMenu(emulation_menu);
|
menuBar()->addMenu(emulation_menu);
|
||||||
|
|
||||||
// View Menu
|
// View Menu
|
||||||
|
|
Loading…
Reference in New Issue