mirror of
https://github.com/libretro/Mesen.git
synced 2025-01-31 22:01:52 +00:00
Cheats: UI rework, added import options for Nestopia/FCEUX formats + export option in a Nestopia-compatible format
This commit is contained in:
parent
d46b6a3fa7
commit
c099fdcd18
@ -26,7 +26,7 @@ namespace Mesen.GUI.Config
|
||||
public Byte Value;
|
||||
public Byte CompareValue;
|
||||
public bool UseCompareValue;
|
||||
public bool IsRelativeAddress;
|
||||
public bool IsRelativeAddress = true;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
@ -67,17 +67,19 @@ namespace Mesen.GUI.Config
|
||||
{
|
||||
InteropEmu.CheatClear();
|
||||
|
||||
string crc = InteropEmu.GetRomInfo().GetCrcString();
|
||||
int cheatCount = 0;
|
||||
foreach(CheatInfo cheat in ConfigManager.Config.Cheats.Where(c => c.GameCrc == crc)) {
|
||||
if(cheat.Enabled) {
|
||||
cheat.ApplyCheat();
|
||||
cheatCount++;
|
||||
if(!ConfigManager.Config.DisableAllCheats) {
|
||||
string crc = InteropEmu.GetRomInfo().GetPrgCrcString();
|
||||
int cheatCount = 0;
|
||||
foreach(CheatInfo cheat in ConfigManager.Config.Cheats.Where(c => c.GameCrc == crc)) {
|
||||
if(cheat.Enabled) {
|
||||
cheat.ApplyCheat();
|
||||
cheatCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(cheatCount > 0) {
|
||||
InteropEmu.DisplayMessage("Cheats", cheatCount > 1 ? "CheatsApplied" : "CheatApplied", cheatCount.ToString());
|
||||
if(cheatCount > 0) {
|
||||
InteropEmu.DisplayMessage("Cheats", cheatCount > 1 ? "CheatsApplied" : "CheatApplied", cheatCount.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace Mesen.GUI.Config
|
||||
public List<RecentItem> RecentFiles;
|
||||
public List<VsConfigInfo> VsConfig;
|
||||
public List<CheatInfo> Cheats;
|
||||
public bool ShowOnlyCheatsForCurrentGame;
|
||||
public bool DisableAllCheats;
|
||||
public NesModel Region;
|
||||
public ClientConnectionInfo ClientConnectionInfo;
|
||||
public ServerInfo ServerInfo;
|
||||
|
@ -8,6 +8,7 @@
|
||||
<Message ID="FilterRom">All supported formats (*.nes, *.zip, *.7z, *.nsf, *.nsfe, *.fds, *.unf)|*.NES;*.ZIP;*.7z;*.FDS;*.NSF;*.NSFE;*.UNF|NES Roms (*.nes, *.unf)|*.NES;*.UNF|Famicom Disk System Roms (*.fds)|*.FDS|NSF files (*.nsf, *.nsfe)|*.nsf;*.nsfe|ZIP Archives (*.zip)|*.ZIP|7-Zip Archives (*.7z)|*.7z|All (*.*)|*.*</Message>
|
||||
<Message ID="FilterRomIps">All supported formats (*.nes, *.zip, *.7z, *.fds, *.nsf, *.nsfe, *.unf, *.ips)|*.NES;*.ZIP;*.7z;*.IPS;*.FDS;*.NSF;*.NSFE;*.UNF|NES Roms (*.nes, *.unf)|*.NES;*.UNF|Famicom Disk System Roms (*.fds)|*.FDS|NSF files (*.nsf, *.nsfe)|*.nsf;*.nsfe|ZIP Archives (*.zip)|*.ZIP|7-Zip Archives (*.7z)|*.7z|IPS Patches (*.ips)|*.IPS|All (*.*)|*.*</Message>
|
||||
<Message ID="FilterTest">Test files (*.mtp)|*.mtp|All (*.*)|*.*</Message>
|
||||
<Message ID="FilterCheat">All supported formats (*.cht, *.xml)|*.cht;*.xml</Message>
|
||||
|
||||
<Message ID="Resume">Resume</Message>
|
||||
<Message ID="Pause">Pause</Message>
|
||||
@ -44,6 +45,10 @@
|
||||
<Message ID="Net45NotFound">The Microsoft .NET Framework 4.5 could not be found. Please download and install the latest version of the .NET Framework from Microsoft's website and try again.</Message>
|
||||
|
||||
<Message ID="GoogleDriveIntegrationError">Mesen could not connect to your Google Drive account - please try again.</Message>
|
||||
|
||||
<Message ID="InvalidCheatFile">The selected file ({0}) is not a valid cheat file.</Message>
|
||||
<Message ID="InvalidXmlFile">The selected file ({0}) is not a valid XML file.</Message>
|
||||
<Message ID="NoMatchingCheats">The selected cheat file ({0}) contains no cheats that match the selected game.</Message>
|
||||
</Messages>
|
||||
<Enums>
|
||||
<Enum ID="ControllerType">
|
||||
|
@ -318,16 +318,36 @@
|
||||
<Control ID="btnOK">OK</Control>
|
||||
<Control ID="btnCancel">CAncelar</Control>
|
||||
</Form>
|
||||
<Form ID="frmCheatImport" Title="Import Cheats">
|
||||
<Control ID="grpImportOptions">Import Options</Control>
|
||||
<Control ID="lblCheatFile">Cheat File:</Control>
|
||||
<Control ID="lblGame">Juego:</Control>
|
||||
<Control ID="btnBrowseCheat">Buscar...</Control>
|
||||
<Control ID="btnBrowseGame">Buscar...</Control>
|
||||
<Control ID="btnImport">Import</Control>
|
||||
<Control ID="btnCancel">Cancelar</Control>
|
||||
</Form>
|
||||
<Form ID="frmCheatList" Title="Lista de trucos">
|
||||
<Control ID="tabCheats">Trucos</Control>
|
||||
<Control ID="chkCurrentGameOnly">Mostrar sólo los trucos para el juego actual</Control>
|
||||
<Control ID="btnAddCheat">Añadir un truco</Control>
|
||||
<Control ID="btnDelete">Eliminar</Control>
|
||||
<Control ID="btnDeleteCheat">Eliminar los trucos seleccionados</Control>
|
||||
<Control ID="btnDeleteGameCheats">Delete all cheats for selected game</Control>
|
||||
<Control ID="mnuAddCheat">Añadir truco</Control>
|
||||
<Control ID="mnuDeleteGameCheats">Eliminar</Control>
|
||||
<Control ID="mnuDeleteCheat">Eliminar</Control>
|
||||
<Control ID="colGameName">Juego</Control>
|
||||
<Control ID="colCheatName">Nombre del truco</Control>
|
||||
<Control ID="colCode">Truco</Control>
|
||||
<Control ID="btnImport">Import</Control>
|
||||
<Control ID="btnExport">Export</Control>
|
||||
<Control ID="btnExportAllCheats">All cheats</Control>
|
||||
<Control ID="btnExportGame">Selected Game</Control>
|
||||
<Control ID="mnuExportGame">Export</Control>
|
||||
<Control ID="btnExportSelectedCheats">Selected Cheats</Control>
|
||||
<Control ID="mnuExportSelectedCheats">Export</Control>
|
||||
<Control ID="chkDisableCheats">Disable all cheats</Control>
|
||||
<Control ID="btnOK">OK</Control>
|
||||
<Control ID="btnCancel">Cancelar</Control>
|
||||
</Form>
|
||||
@ -379,6 +399,7 @@
|
||||
<Message ID="FilterRom">Todos los formatos soportados (*.nes, *.zip, *.7z, *.fds, *.nsf, *.nsfe, *.unf)|*.NES;*.ZIP;*.7z;*.FDS;*.NSF;*.NSFE;*.UNF|Roms de NES (*.nes, *.unf)|*.NES;*.UNF|Roms de Famicom Disk System (*.fds)|*.FDS|Archivos NSF (*.nsf, *.nsfe)|*.NSF;*.NSFE|Archivos ZIP (*.zip)|*.ZIP|Archivos 7-Zip (*.7z)|*.7z|Todos los archivos (*.*)|*.*</Message>
|
||||
<Message ID="FilterRomIps">Todos los formatos soportados (*.nes, *.zip, *.7z, *.fds, *.nsf, *.nsfe, *.unf, *.ips)|*.NES;*.ZIP;*.7z;*.IPS;*.FDS;*.NSF;*.NSFE;*.UNF|Roms de NES(*.nes, *.unf)|*.NES;*.UNF|Roms de Famicom Disk System (*.fds)|*.FDS|Archivos NSF (*.nsf, *.nsfe)|*.NSF;*.NSFE|Archivos ZIP (*.zip)|*.ZIP|Archivos 7-Zip (*.7z)|*.7z|Archivos IPS (*.ips)|*.IPS|Todos los archivos (*.*)|*.*</Message>
|
||||
<Message ID="FilterTest">Archivos de test (*.mtp)|*.mtp|Todos los archivos (*.*)|*.*</Message>
|
||||
<Message ID="FilterCheat">Todos los formatos soportados (*.cht, *.xml)|*.cht;*.xml</Message>
|
||||
|
||||
<Message ID="Resume">Continuar</Message>
|
||||
<Message ID="Pause">Pausa</Message>
|
||||
@ -415,6 +436,10 @@
|
||||
<Message ID="Net45NotFound">El Microsoft .NET Framework 4.5 no se ha encontrado. Por favor, descargue la versión más reciente de .NET Framework desde el sitio de Microsoft y vuelva a intentarlo.</Message>
|
||||
|
||||
<Message ID="GoogleDriveIntegrationError">Mesen no fue capaz de conectarse a su cuenta de Google Drive, por favor inténtelo de nuevo.</Message>
|
||||
|
||||
<Message ID="InvalidCheatFile">The selected file ({0}) is not a valid cheat file.</Message>
|
||||
<Message ID="InvalidXmlFile">The selected file ({0}) is not a valid XML file.</Message>
|
||||
<Message ID="NoMatchingCheats">The selected cheat file ({0}) contains no cheats that match the selected game.</Message>
|
||||
</Messages>
|
||||
<Enums>
|
||||
<Enum ID="ControllerType">
|
||||
|
@ -318,16 +318,35 @@
|
||||
<Control ID="btnOK">OK</Control>
|
||||
<Control ID="btnCancel">Annuler</Control>
|
||||
</Form>
|
||||
<Form ID="frmCheatImport" Title="Importer des codes">
|
||||
<Control ID="grpImportOptions">Options de l'import</Control>
|
||||
<Control ID="lblCheatFile">Fichier de codes :</Control>
|
||||
<Control ID="lblGame">Jeu :</Control>
|
||||
<Control ID="btnBrowseCheat">Parcourir...</Control>
|
||||
<Control ID="btnBrowseGame">Parcourir...</Control>
|
||||
<Control ID="btnImport">Importer</Control>
|
||||
<Control ID="btnCancel">Annuler</Control>
|
||||
</Form>
|
||||
<Form ID="frmCheatList" Title="Liste de codes">
|
||||
<Control ID="tabCheats">Codes</Control>
|
||||
<Control ID="chkCurrentGameOnly">Afficher uniquement les codes pour le jeu en cours</Control>
|
||||
<Control ID="btnAddCheat">Ajouter un code</Control>
|
||||
<Control ID="btnDelete">Effacer</Control>
|
||||
<Control ID="btnDeleteCheat">Effacer les codes sélectionnés</Control>
|
||||
<Control ID="btnDeleteGameCheats">Effacer les codes du jeu sélectionné</Control>
|
||||
<Control ID="mnuAddCheat">Ajouter un code</Control>
|
||||
<Control ID="mnuDeleteGameCheats">Effacer</Control>
|
||||
<Control ID="mnuDeleteCheat">Effacer</Control>
|
||||
<Control ID="colGameName">Jeu</Control>
|
||||
<Control ID="colCheatName">Nom du code</Control>
|
||||
<Control ID="colCode">Code</Control>
|
||||
<Control ID="btnImport">Importer</Control>
|
||||
<Control ID="btnExport">Exporter</Control>
|
||||
<Control ID="btnExportAllCheats">Exporter tous les codes</Control>
|
||||
<Control ID="btnExportGame">Exporter les codes du jeu sélectionné</Control>
|
||||
<Control ID="mnuExportGame">Exporter</Control>
|
||||
<Control ID="btnExportSelectedCheats">Exporter les codes sélectionnés</Control>
|
||||
<Control ID="mnuExportSelectedCheats">Exporter</Control>
|
||||
<Control ID="chkDisableCheats">Désactiver tous les codes</Control>
|
||||
<Control ID="btnOK">OK</Control>
|
||||
<Control ID="btnCancel">Annuler</Control>
|
||||
</Form>
|
||||
@ -379,6 +398,7 @@
|
||||
<Message ID="FilterRom">Tous les formats supportés (*.nes, *.zip, *.7z, *.fds, *.nsf, *.nsfe, *.unf)|*.NES;*.ZIP;*.7z;*.FDS;*.NSF;*.NSFE;*.UNF|Roms de NES (*.nes, *.unf)|*.NES;*.UNF|Roms du Famicom Disk System (*.fds)|*.FDS|Fichiers NSF (*.nsf, *.nsfe)|*.NSF;*.NSFE|Fichiers ZIP (*.zip)|*.ZIP|Fichiers 7-Zip (*.7z)|*.7z|Tous les fichiers (*.*)|*.*</Message>
|
||||
<Message ID="FilterRomIps">Tous les formats supportés (*.nes, *.zip, *.7z, *.fds, *.nsf, *.nsfe, *.unf, *.ips)|*.NES;*.ZIP;*.7z;*.IPS;*.FDS;*.NSF;*.NSFE;*.UNF|Roms de NES (*.nes, *.unf)|*.NES;*.UNF|Roms du Famicom Disk System (*.fds)|*.FDS|Fichiers NSF (*.nsf, *.nsfe)|*.NSF;*.NSFE|Fichiers ZIP (*.zip)|*.ZIP|Fichiers 7-Zip (*.7z)|*.7z|Fichiers IPS (*.ips)|*.IPS|Tous les fichiers (*.*)|*.*</Message>
|
||||
<Message ID="FilterTest">Fichiers de test (*.mtp)|*.mtp|Tous les fichiers (*.*)|*.*</Message>
|
||||
<Message ID="FilterCheat">Tous les formats supportés (*.cht, *.xml)|*.cht;*.xml</Message>
|
||||
|
||||
<Message ID="Resume">Continuer</Message>
|
||||
<Message ID="Pause">Pause</Message>
|
||||
@ -415,6 +435,10 @@
|
||||
<Message ID="Net45NotFound">Le .NET Framework 4.5 de Microsoft n'a pas été trouvé. Veuillez télécharger la plus récente version du .NET Framework à partir du site de Microsoft et essayer à nouveau.</Message>
|
||||
|
||||
<Message ID="GoogleDriveIntegrationError">Mesen n'a pas été en mesure de se connecter à votre compte Google Drive, veuillez essayer à nouveau.</Message>
|
||||
|
||||
<Message ID="InvalidCheatFile">Le fichier sélectionné ({0}) n'est pas un fichier de codes valide.</Message>
|
||||
<Message ID="InvalidXmlFile">Le fichier sélectionné ({0}) n'est pas un fichier XML valide.</Message>
|
||||
<Message ID="NoMatchingCheats">Le fichier sélectionné ({0}) ne contient aucun code correspondant au jeu sélectionné.</Message>
|
||||
</Messages>
|
||||
<Enums>
|
||||
<Enum ID="ControllerType">
|
||||
|
@ -315,16 +315,35 @@
|
||||
<Control ID="btnOK">OK</Control>
|
||||
<Control ID="btnCancel">キャンセル</Control>
|
||||
</Form>
|
||||
<Form ID="frmCheatImport" Title="インポート">
|
||||
<Control ID="grpImportOptions">インポート設定</Control>
|
||||
<Control ID="lblCheatFile">チートコードファイル:</Control>
|
||||
<Control ID="lblGame">ゲーム:</Control>
|
||||
<Control ID="btnBrowseCheat">参照...</Control>
|
||||
<Control ID="btnBrowseGame">参照...</Control>
|
||||
<Control ID="btnImport">インポート</Control>
|
||||
<Control ID="btnCancel">キャンセル</Control>
|
||||
</Form>
|
||||
<Form ID="frmCheatList" Title="チートコード">
|
||||
<Control ID="tabCheats">チートコード</Control>
|
||||
<Control ID="chkCurrentGameOnly">プレイ中のゲームのコードのみ表示する</Control>
|
||||
<Control ID="btnAddCheat">コード追加</Control>
|
||||
<Control ID="btnDelete">削除</Control>
|
||||
<Control ID="btnDeleteCheat">選択中のコードを削除</Control>
|
||||
<Control ID="btnDeleteGameCheats">選択中のコードを削除</Control>
|
||||
<Control ID="mnuAddCheat">コード追加</Control>
|
||||
<Control ID="mnuDeleteGameCheats">削除</Control>
|
||||
<Control ID="mnuDeleteCheat">削除</Control>
|
||||
<Control ID="colGameName">ゲーム</Control>
|
||||
<Control ID="colCheatName">コード名</Control>
|
||||
<Control ID="colCode">コード</Control>
|
||||
<Control ID="btnImport">インポート</Control>
|
||||
<Control ID="btnExport">エクスポート</Control>
|
||||
<Control ID="btnExportAllCheats">全てのコードをエクスポートする</Control>
|
||||
<Control ID="btnExportGame">選択中のゲームのコードをエクスポートする</Control>
|
||||
<Control ID="mnuExportGame">エクスポート</Control>
|
||||
<Control ID="btnExportSelectedCheats">選択中のコードをエクスポートする</Control>
|
||||
<Control ID="mnuExportSelectedCheats">エクスポート</Control>
|
||||
<Control ID="chkDisableCheats">チートコード機能を無効にする</Control>
|
||||
<Control ID="btnOK">OK</Control>
|
||||
<Control ID="btnCancel">キャンセル</Control>
|
||||
</Form>
|
||||
@ -371,7 +390,8 @@
|
||||
<Message ID="FilterRom">対応するすべてのファイル (*.nes, *.zip, *.7z, *.fds, *.nsf, *.nsfe, *.unf)|*.NES;*.ZIP;*.FDS;*.7z;*.NSF;*.NSFE;*.UNF|ファミコンゲーム (*.nes, *.unf)|*.NES;*.UNF|ファミコンディスクシステムのゲーム (*.fds)|*.FDS|NSFファイル (*.nsf, *.nsfe)|*.NSF;*.NSFE|ZIPファイル (*.zip)|*.ZIP|7-Zipファイル (*.7z)|*.7z|すべてのファイル (*.*)|*.*</Message>
|
||||
<Message ID="FilterRomIps">対応するすべてのファイル (*.nes, *.zip, *.7z, *.fds, *.nsf, *.nsfe, *.unf, *.ips)|*.NES;*.ZIP;*.7z;*.IPS;*.FDS;*.NSF;*.NSFE;*.UNF|ファミコンゲーム (*.nes, *.unf)|*.NES;*.UNF|ファミコンディスクシステムのゲーム (*.fds)|*.FDS|NSFファイル (*.nsf, *.nsfe)|*.NSF;*.NSFE|ZIPファイル (*.zip)|*.ZIP|7-Zipファイル (*.7z)|*.7z|IPSファイル (*.ips)|*.IPS|すべてのファイル (*.*)|*.*</Message>
|
||||
<Message ID="FilterTest">テストファイル (*.mtp)|*.mtp|すべてのファイル (*.*)|*.*</Message>
|
||||
|
||||
<Message ID="FilterCheat">対応するすべてのファイル (*.cht, *.xml)|*.cht;*.xml</Message>
|
||||
|
||||
<Message ID="Resume">再開</Message>
|
||||
<Message ID="Pause">ポーズ</Message>
|
||||
<Message ID="StartServer">サーバを起動する</Message>
|
||||
@ -407,6 +427,10 @@
|
||||
<Message ID="Net45NotFound">Microsoft .NET Framework 4.5はインストールされていないため、Mesenは起動できません。Microsoft .NET Frameworkの最新版をMicrosoftのサイトからダウンロードして、インストールしてください。</Message>
|
||||
|
||||
<Message ID="GoogleDriveIntegrationError">MesenはGoogle Driveにアクセス出来ませんでした。</Message>
|
||||
|
||||
<Message ID="InvalidCheatFile">このファイル({0})にはチートコードを見つかりませんでした。</Message>
|
||||
<Message ID="InvalidXmlFile">このファイル({0})はXMLファイルではないため読めませんでした.</Message>
|
||||
<Message ID="NoMatchingCheats">このファイル({0})に選択されたゲームに該当するチートコードを見つかりませんでした。</Message>
|
||||
</Messages>
|
||||
<Enums>
|
||||
<Enum ID="ControllerType">
|
||||
|
@ -318,16 +318,36 @@
|
||||
<Control ID="btnOK">OK</Control>
|
||||
<Control ID="btnCancel">Отмена</Control>
|
||||
</Form>
|
||||
<Form ID="frmCheatImport" Title="Import Cheats">
|
||||
<Control ID="grpImportOptions">Import Options</Control>
|
||||
<Control ID="lblCheatFile">Cheat File:</Control>
|
||||
<Control ID="lblGame">Игра:</Control>
|
||||
<Control ID="btnBrowseCheat">Выбрать...</Control>
|
||||
<Control ID="btnBrowseGame">Выбрать...</Control>
|
||||
<Control ID="btnImport">Import</Control>
|
||||
<Control ID="btnCancel">Отмена</Control>
|
||||
</Form>
|
||||
<Form ID="frmCheatList" Title="Читы">
|
||||
<Control ID="tabCheats">Читы</Control>
|
||||
<Control ID="chkCurrentGameOnly">Показывать читы только для текущей игры</Control>
|
||||
<Control ID="btnAddCheat">Добавить чит</Control>
|
||||
<Control ID="btnDelete">Удалить</Control>
|
||||
<Control ID="btnDeleteCheat">Удалить выбранные читы</Control>
|
||||
<Control ID="btnDeleteGameCheats">Delete all cheats for selected game</Control>
|
||||
<Control ID="mnuAddCheat">Добавить чит</Control>
|
||||
<Control ID="mnuDeleteGameCheats">Удалить</Control>
|
||||
<Control ID="mnuDeleteCheat">Удалить</Control>
|
||||
<Control ID="colGameName">Игра</Control>
|
||||
<Control ID="colCheatName">Описание чита</Control>
|
||||
<Control ID="colCode">Код</Control>
|
||||
<Control ID="btnImport">Import</Control>
|
||||
<Control ID="btnExport">Export</Control>
|
||||
<Control ID="btnExportAllCheats">All cheats</Control>
|
||||
<Control ID="btnExportGame">Selected Game</Control>
|
||||
<Control ID="mnuExportGame">Export</Control>
|
||||
<Control ID="btnExportSelectedCheats">Selected Cheats</Control>
|
||||
<Control ID="mnuExportSelectedCheats">Export</Control>
|
||||
<Control ID="chkDisableCheats">Disable all cheats</Control>
|
||||
<Control ID="btnOK">OK</Control>
|
||||
<Control ID="btnCancel">Отмена</Control>
|
||||
</Form>
|
||||
@ -379,6 +399,7 @@
|
||||
<Message ID="FilterRom">Все поддерживаемые форматы (*.nes, *.zip, *.7z, *.nsf, *.nsfe, *.fds, *.unf)|*.NES;*.ZIP;*.7z;*.FDS;*.NSF;*.NSFE;*.UNF|NES Roms (*.nes, *.unf)|*.NES;*.UNF|Famicom Disk System Roms (*.fds)|*.FDS|NSF files (*.nsf, *.nsfe)|*.nsf;*.nsfe|ZIP Archives (*.zip)|*.ZIP|7-Zip Archives (*.7z)|*.7z|All (*.*)|*.*</Message>
|
||||
<Message ID="FilterRomIps">Все поддерживаемые форматы (*.nes, *.zip, *.7z, *.fds, *.nsf, *.nsfe, *.unf, *.ips)|*.NES;*.ZIP;*.7z;*.IPS;*.FDS;*.NSF;*.NSFE;*.UNF|NES Roms (*.nes, *.unf)|*.NES;*.UNF|Famicom Disk System Roms (*.fds)|*.FDS|NSF files (*.nsf, *.nsfe)|*.nsf;*.nsfe|ZIP Archives (*.zip)|*.ZIP|7-Zip Archives (*.7z)|*.7z|IPS Patches (*.ips)|*.IPS|All (*.*)|*.*</Message>
|
||||
<Message ID="FilterTest">Test files (*.mtp)|*.mtp|All (*.*)|*.*</Message>
|
||||
<Message ID="FilterCheat">Все поддерживаемые форматы (*.cht, *.xml)|*.cht;*.xml</Message>
|
||||
|
||||
<Message ID="Resume">Продолжить</Message>
|
||||
<Message ID="Pause">Пауза</Message>
|
||||
@ -415,6 +436,10 @@
|
||||
<Message ID="Net45NotFound">Microsoft .NET Framework 4.5 не найден. Пожалуйста загрузите и установите последнюю версию .NET Framework с сайта Microsoft и попробуйте снова.</Message>
|
||||
|
||||
<Message ID="GoogleDriveIntegrationError">Mesen не смог подключиться к вашему аккаунту Google Drive - попробуйте ещё раз.</Message>
|
||||
|
||||
<Message ID="InvalidCheatFile">The selected file ({0}) is not a valid cheat file.</Message>
|
||||
<Message ID="InvalidXmlFile">The selected file ({0}) is not a valid XML file.</Message>
|
||||
<Message ID="NoMatchingCheats">The selected cheat file ({0}) contains no cheats that match the selected game.</Message>
|
||||
</Messages>
|
||||
<Enums>
|
||||
<Enum ID="ControllerType">
|
||||
|
68
GUI.NET/Forms/Cheats/FceuxCheatLoader.cs
Normal file
68
GUI.NET/Forms/Cheats/FceuxCheatLoader.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Mesen.GUI.Config;
|
||||
|
||||
namespace Mesen.GUI.Forms.Cheats
|
||||
{
|
||||
class FceuxCheatLoader
|
||||
{
|
||||
public static List<CheatInfo> Load(string filename, string gameName, string gameCrc)
|
||||
{
|
||||
List<CheatInfo> cheats = new List<CheatInfo>();
|
||||
|
||||
foreach(string cheatLine in File.ReadAllLines(filename)) {
|
||||
try {
|
||||
string[] data = cheatLine.Split(':');
|
||||
|
||||
if(data.Length >= 3) {
|
||||
string address = null;
|
||||
string value = null;
|
||||
string compare = null;
|
||||
string description = null;
|
||||
|
||||
if(data[0] == "C" || data[0] == "S" || data[0] == "CS" || data[0] == "SC" || string.IsNullOrWhiteSpace(data[0])) {
|
||||
address = data[1];
|
||||
value = data[2];
|
||||
compare = data[0].Contains("C") ? data[3] : null;
|
||||
description = data[0].Contains("C") ? data[4] : data[3];
|
||||
} else {
|
||||
address = data[0];
|
||||
value = data[1];
|
||||
description = data[2];
|
||||
}
|
||||
|
||||
var cheat = new CheatInfo();
|
||||
cheat.GameCrc = gameCrc;
|
||||
cheat.GameName = gameName;
|
||||
cheat.CheatName = description;
|
||||
cheat.Enabled = false;
|
||||
|
||||
cheat.CheatType = CheatType.Custom;
|
||||
cheat.IsRelativeAddress = true;
|
||||
cheat.Address = HexToInt(address);
|
||||
cheat.Value = (byte)HexToInt(value);
|
||||
if(compare != null) {
|
||||
cheat.CompareValue = (byte)HexToInt(compare);
|
||||
cheat.UseCompareValue = true;
|
||||
}
|
||||
cheats.Add(cheat);
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
return cheats;
|
||||
}
|
||||
|
||||
private static UInt32 HexToInt(string hex)
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(hex)) {
|
||||
return 0;
|
||||
} else {
|
||||
return UInt32.Parse(hex.Trim().Replace("$", "").Replace("0x", ""), System.Globalization.NumberStyles.HexNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
42
GUI.NET/Forms/Cheats/MesenCheatExporter.cs
Normal file
42
GUI.NET/Forms/Cheats/MesenCheatExporter.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using Mesen.GUI.Config;
|
||||
|
||||
namespace Mesen.GUI.Forms.Cheats
|
||||
{
|
||||
class MesenCheatExporter
|
||||
{
|
||||
public static void Export(string filename, IEnumerable<CheatInfo> cheats)
|
||||
{
|
||||
//Exports to an XML format compatible with Nestopia's, but with an extra flag (isPrgOffset)
|
||||
string xml = "<cheats MesenCheatFile=\"true\" version=\"1.0\">";
|
||||
|
||||
foreach(CheatInfo cheat in cheats) {
|
||||
string enabled = cheat.Enabled ? "1" : "0";
|
||||
string gameCrc = "0x" + cheat.GameCrc;
|
||||
string address = "0x" + cheat.Address.ToString("X4");
|
||||
string value = "0x" + cheat.Value.ToString("X2");
|
||||
string compare = "0x" + cheat.CompareValue.ToString("X2");
|
||||
string genie = cheat.GameGenieCode;
|
||||
string rocky = cheat.ProActionRockyCode.ToString("X8");
|
||||
|
||||
string genieTag = cheat.CheatType == CheatType.GameGenie ? $"<genie>{genie}</genie>" : "";
|
||||
string rockyTag = cheat.CheatType == CheatType.ProActionRocky ? $"<rocky>{rocky}</rocky>" : "";
|
||||
string customTags = cheat.CheatType == CheatType.Custom ? $"<address>{address}</address><value>{value}</value><compare>{compare}</compare>" : "";
|
||||
|
||||
string prgAddress = !cheat.IsRelativeAddress ? "<isPrgOffset>true</isPrgOffset>" : "";
|
||||
|
||||
xml += $"<cheat enabled=\"{enabled}\" game=\"{gameCrc}\" gameName=\"{cheat.GameName}\">{genieTag}{rockyTag}{customTags}{prgAddress}<description>{cheat.CheatName}</description></cheat>";
|
||||
}
|
||||
xml += "</cheats>";
|
||||
|
||||
XmlDocument xmlDoc = new XmlDocument();
|
||||
xmlDoc.LoadXml(xml);
|
||||
xmlDoc.Save(filename);
|
||||
}
|
||||
}
|
||||
}
|
107
GUI.NET/Forms/Cheats/NestopiaCheatLoader.cs
Normal file
107
GUI.NET/Forms/Cheats/NestopiaCheatLoader.cs
Normal file
@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using Mesen.GUI.Config;
|
||||
|
||||
namespace Mesen.GUI.Forms.Cheats
|
||||
{
|
||||
class NestopiaCheatLoader
|
||||
{
|
||||
public static bool IsMesenCheatFile(string filename)
|
||||
{
|
||||
try {
|
||||
XmlDocument xml = new XmlDocument();
|
||||
xml.Load(filename);
|
||||
XmlNode node = xml.SelectSingleNode("/cheats");
|
||||
return node != null && node.Attributes["MesenCheatFile"] != null && node.Attributes["MesenCheatFile"].Value == "true";
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<CheatInfo> Load(string filepath, string gameName, string gameCrc)
|
||||
{
|
||||
try {
|
||||
List<CheatInfo> cheats = new List<CheatInfo>();
|
||||
|
||||
XmlDocument xml = new XmlDocument();
|
||||
xml.Load(filepath);
|
||||
bool validFile = false;
|
||||
bool hasMatchingCheats = false;
|
||||
foreach(XmlNode node in xml.SelectNodes("/cheats/cheat")) {
|
||||
try {
|
||||
if(node.Attributes["game"] != null) {
|
||||
validFile = true;
|
||||
var nodeGameName = node.Attributes["gameName"]?.Value;
|
||||
if(nodeGameName != null && string.IsNullOrWhiteSpace(gameCrc) || node.Attributes["game"].Value.Contains(gameCrc)) {
|
||||
hasMatchingCheats = true;
|
||||
var crc = node.Attributes["game"].Value.Replace("0x", "").ToUpper();
|
||||
var genie = node.SelectSingleNode("genie");
|
||||
var rocky = node.SelectSingleNode("rocky");
|
||||
var description = node.SelectSingleNode("description");
|
||||
var address = node.SelectSingleNode("address");
|
||||
var value = node.SelectSingleNode("value");
|
||||
var compare = node.SelectSingleNode("compare");
|
||||
bool isPrgOffset = node.SelectSingleNode("isPrgOffset")?.Value == "true";
|
||||
|
||||
var cheat = new CheatInfo();
|
||||
cheat.GameCrc = crc;
|
||||
cheat.GameName = nodeGameName ?? gameName;
|
||||
cheat.CheatName = description?.InnerXml;
|
||||
cheat.Enabled = node.Attributes["enabled"] != null && node.Attributes["enabled"].Value == "1" ? true : false;
|
||||
if(genie != null) {
|
||||
cheat.CheatType = CheatType.GameGenie;
|
||||
cheat.GameGenieCode = genie.InnerText.ToUpper();
|
||||
} else if(rocky != null) {
|
||||
cheat.CheatType = CheatType.ProActionRocky;
|
||||
cheat.ProActionRockyCode = HexToInt(rocky.InnerText);
|
||||
} else {
|
||||
cheat.CheatType = CheatType.Custom;
|
||||
cheat.IsRelativeAddress = !isPrgOffset;
|
||||
cheat.Address = HexToInt(address?.InnerText);
|
||||
cheat.Value = (byte)HexToInt(value?.InnerText);
|
||||
if(compare != null) {
|
||||
cheat.CompareValue = (byte)HexToInt(compare.InnerText);
|
||||
cheat.UseCompareValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
cheats.Add(cheat);
|
||||
}
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
|
||||
if(!validFile) {
|
||||
//Valid xml file, but invalid content
|
||||
MesenMsgBox.Show("InvalidCheatFile", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error, Path.GetFileName(filepath));
|
||||
return null;
|
||||
} else if(!hasMatchingCheats) {
|
||||
//Valid cheat file, but no cheats match selected game
|
||||
MesenMsgBox.Show("NoMatchingCheats", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error, Path.GetFileName(filepath));
|
||||
return null;
|
||||
} else {
|
||||
return cheats;
|
||||
}
|
||||
} catch {
|
||||
//Invalid xml file
|
||||
MesenMsgBox.Show("InvalidXmlFile", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error, Path.GetFileName(filepath));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static UInt32 HexToInt(string hex)
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(hex)) {
|
||||
return 0;
|
||||
} else {
|
||||
return UInt32.Parse(hex.Trim().Replace("$", "").Replace("0x", ""), System.Globalization.NumberStyles.HexNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -29,13 +29,6 @@ namespace Mesen.GUI.Forms.Cheats
|
||||
|
||||
_gameCrc = cheat.GameCrc;
|
||||
|
||||
if(string.IsNullOrWhiteSpace(cheat.GameName)) {
|
||||
RomInfo romInfo = InteropEmu.GetRomInfo();
|
||||
_gameCrc = romInfo.GetCrcString();
|
||||
((CheatInfo)Entity).GameName = romInfo.GetRomName();
|
||||
txtGameName.Text = ((CheatInfo)Entity).GameName;
|
||||
}
|
||||
|
||||
radGameGenie.Tag = CheatType.GameGenie;
|
||||
radProActionRocky.Tag = CheatType.ProActionRocky;
|
||||
radCustom.Tag = CheatType.Custom;
|
||||
@ -76,7 +69,7 @@ namespace Mesen.GUI.Forms.Cheats
|
||||
int archiveFileIndex = -1;
|
||||
if(frmSelectRom.SelectRom(romPath, ref archiveFileIndex)) {
|
||||
RomInfo romInfo = InteropEmu.GetRomInfo(romPath, archiveFileIndex);
|
||||
_gameCrc = romInfo.GetCrcString();
|
||||
_gameCrc = romInfo.GetPrgCrcString();
|
||||
if(_gameCrc != null) {
|
||||
((CheatInfo)Entity).GameName = Path.GetFileNameWithoutExtension(romInfo.RomName);
|
||||
txtGameName.Text = ((CheatInfo)Entity).GameName;
|
||||
|
223
GUI.NET/Forms/Cheats/frmCheatImport.Designer.cs
generated
Normal file
223
GUI.NET/Forms/Cheats/frmCheatImport.Designer.cs
generated
Normal file
@ -0,0 +1,223 @@
|
||||
namespace Mesen.GUI.Forms.Cheats
|
||||
{
|
||||
partial class frmCheatImport
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if(disposing && (components != null)) {
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.grpImportOptions = new System.Windows.Forms.GroupBox();
|
||||
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.lblGame = new System.Windows.Forms.Label();
|
||||
this.txtGameName = new System.Windows.Forms.TextBox();
|
||||
this.btnBrowseGame = new System.Windows.Forms.Button();
|
||||
this.lblCheatFile = new System.Windows.Forms.Label();
|
||||
this.txtCheatFile = new System.Windows.Forms.TextBox();
|
||||
this.btnBrowseCheat = new System.Windows.Forms.Button();
|
||||
this.baseConfigPanel = new System.Windows.Forms.Panel();
|
||||
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.btnImport = new System.Windows.Forms.Button();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.grpImportOptions.SuspendLayout();
|
||||
this.tableLayoutPanel2.SuspendLayout();
|
||||
this.baseConfigPanel.SuspendLayout();
|
||||
this.flowLayoutPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// grpImportOptions
|
||||
//
|
||||
this.grpImportOptions.Controls.Add(this.tableLayoutPanel2);
|
||||
this.grpImportOptions.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.grpImportOptions.Location = new System.Drawing.Point(0, 0);
|
||||
this.grpImportOptions.Name = "grpImportOptions";
|
||||
this.grpImportOptions.Size = new System.Drawing.Size(371, 80);
|
||||
this.grpImportOptions.TabIndex = 1;
|
||||
this.grpImportOptions.TabStop = false;
|
||||
this.grpImportOptions.Text = "Import Options";
|
||||
//
|
||||
// tableLayoutPanel2
|
||||
//
|
||||
this.tableLayoutPanel2.ColumnCount = 3;
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel2.Controls.Add(this.lblGame, 0, 1);
|
||||
this.tableLayoutPanel2.Controls.Add(this.txtGameName, 1, 1);
|
||||
this.tableLayoutPanel2.Controls.Add(this.btnBrowseGame, 2, 1);
|
||||
this.tableLayoutPanel2.Controls.Add(this.lblCheatFile, 0, 0);
|
||||
this.tableLayoutPanel2.Controls.Add(this.txtCheatFile, 1, 0);
|
||||
this.tableLayoutPanel2.Controls.Add(this.btnBrowseCheat, 2, 0);
|
||||
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 16);
|
||||
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
|
||||
this.tableLayoutPanel2.RowCount = 3;
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel2.Size = new System.Drawing.Size(365, 61);
|
||||
this.tableLayoutPanel2.TabIndex = 0;
|
||||
//
|
||||
// lblGame
|
||||
//
|
||||
this.lblGame.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.lblGame.AutoSize = true;
|
||||
this.lblGame.Location = new System.Drawing.Point(3, 37);
|
||||
this.lblGame.Name = "lblGame";
|
||||
this.lblGame.Size = new System.Drawing.Size(38, 13);
|
||||
this.lblGame.TabIndex = 0;
|
||||
this.lblGame.Text = "Game:";
|
||||
//
|
||||
// txtGameName
|
||||
//
|
||||
this.txtGameName.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.txtGameName.Location = new System.Drawing.Point(66, 32);
|
||||
this.txtGameName.Name = "txtGameName";
|
||||
this.txtGameName.ReadOnly = true;
|
||||
this.txtGameName.Size = new System.Drawing.Size(229, 20);
|
||||
this.txtGameName.TabIndex = 2;
|
||||
//
|
||||
// btnBrowseGame
|
||||
//
|
||||
this.btnBrowseGame.AutoSize = true;
|
||||
this.btnBrowseGame.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.btnBrowseGame.Location = new System.Drawing.Point(301, 32);
|
||||
this.btnBrowseGame.Name = "btnBrowseGame";
|
||||
this.btnBrowseGame.Size = new System.Drawing.Size(61, 23);
|
||||
this.btnBrowseGame.TabIndex = 4;
|
||||
this.btnBrowseGame.Text = "Browse...";
|
||||
this.btnBrowseGame.UseVisualStyleBackColor = true;
|
||||
this.btnBrowseGame.Click += new System.EventHandler(this.btnBrowseGame_Click);
|
||||
//
|
||||
// lblCheatFile
|
||||
//
|
||||
this.lblCheatFile.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.lblCheatFile.AutoSize = true;
|
||||
this.lblCheatFile.Location = new System.Drawing.Point(3, 8);
|
||||
this.lblCheatFile.Name = "lblCheatFile";
|
||||
this.lblCheatFile.Size = new System.Drawing.Size(57, 13);
|
||||
this.lblCheatFile.TabIndex = 1;
|
||||
this.lblCheatFile.Text = "Cheat File:";
|
||||
//
|
||||
// txtCheatFile
|
||||
//
|
||||
this.txtCheatFile.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.txtCheatFile.Location = new System.Drawing.Point(66, 3);
|
||||
this.txtCheatFile.Name = "txtCheatFile";
|
||||
this.txtCheatFile.ReadOnly = true;
|
||||
this.txtCheatFile.Size = new System.Drawing.Size(229, 20);
|
||||
this.txtCheatFile.TabIndex = 3;
|
||||
//
|
||||
// btnBrowseCheat
|
||||
//
|
||||
this.btnBrowseCheat.AutoSize = true;
|
||||
this.btnBrowseCheat.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.btnBrowseCheat.Location = new System.Drawing.Point(301, 3);
|
||||
this.btnBrowseCheat.Name = "btnBrowseCheat";
|
||||
this.btnBrowseCheat.Size = new System.Drawing.Size(61, 23);
|
||||
this.btnBrowseCheat.TabIndex = 5;
|
||||
this.btnBrowseCheat.Text = "Browse...";
|
||||
this.btnBrowseCheat.UseVisualStyleBackColor = true;
|
||||
this.btnBrowseCheat.Click += new System.EventHandler(this.btnBrowseCheat_Click);
|
||||
//
|
||||
// baseConfigPanel
|
||||
//
|
||||
this.baseConfigPanel.Controls.Add(this.flowLayoutPanel1);
|
||||
this.baseConfigPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.baseConfigPanel.Location = new System.Drawing.Point(0, 81);
|
||||
this.baseConfigPanel.Name = "baseConfigPanel";
|
||||
this.baseConfigPanel.Size = new System.Drawing.Size(371, 29);
|
||||
this.baseConfigPanel.TabIndex = 2;
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnImport);
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnCancel);
|
||||
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.flowLayoutPanel1.Location = new System.Drawing.Point(206, 0);
|
||||
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(165, 29);
|
||||
this.flowLayoutPanel1.TabIndex = 2;
|
||||
//
|
||||
// btnImport
|
||||
//
|
||||
this.btnImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnImport.Location = new System.Drawing.Point(3, 3);
|
||||
this.btnImport.Name = "btnImport";
|
||||
this.btnImport.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnImport.TabIndex = 1;
|
||||
this.btnImport.Text = "Import";
|
||||
this.btnImport.UseVisualStyleBackColor = true;
|
||||
this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnCancel.Location = new System.Drawing.Point(84, 3);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnCancel.TabIndex = 0;
|
||||
this.btnCancel.Text = "Cancel";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
||||
//
|
||||
// frmCheatImport
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.btnCancel;
|
||||
this.ClientSize = new System.Drawing.Size(371, 110);
|
||||
this.Controls.Add(this.baseConfigPanel);
|
||||
this.Controls.Add(this.grpImportOptions);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Name = "frmCheatImport";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Import Cheats";
|
||||
this.grpImportOptions.ResumeLayout(false);
|
||||
this.tableLayoutPanel2.ResumeLayout(false);
|
||||
this.tableLayoutPanel2.PerformLayout();
|
||||
this.baseConfigPanel.ResumeLayout(false);
|
||||
this.flowLayoutPanel1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.GroupBox grpImportOptions;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
|
||||
private System.Windows.Forms.TextBox txtCheatFile;
|
||||
private System.Windows.Forms.TextBox txtGameName;
|
||||
private System.Windows.Forms.Label lblGame;
|
||||
private System.Windows.Forms.Label lblCheatFile;
|
||||
private System.Windows.Forms.Button btnBrowseGame;
|
||||
private System.Windows.Forms.Button btnBrowseCheat;
|
||||
protected System.Windows.Forms.Panel baseConfigPanel;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||
protected System.Windows.Forms.Button btnImport;
|
||||
protected System.Windows.Forms.Button btnCancel;
|
||||
}
|
||||
}
|
107
GUI.NET/Forms/Cheats/frmCheatImport.cs
Normal file
107
GUI.NET/Forms/Cheats/frmCheatImport.cs
Normal file
@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
using Mesen.GUI.Config;
|
||||
|
||||
namespace Mesen.GUI.Forms.Cheats
|
||||
{
|
||||
public partial class frmCheatImport : BaseForm
|
||||
{
|
||||
private string _gameCrc = "";
|
||||
private string _gameName = "";
|
||||
private string _cheatFile = null;
|
||||
private bool _isMesenCheatFile = false;
|
||||
|
||||
public List<CheatInfo> ImportedCheats { get; internal set; }
|
||||
|
||||
public frmCheatImport()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
UpdateImportButton();
|
||||
|
||||
RomInfo romInfo = InteropEmu.GetRomInfo();
|
||||
_gameCrc = romInfo.GetPrgCrcString();
|
||||
_gameName = romInfo.GetRomName();
|
||||
txtGameName.Text = _gameName;
|
||||
}
|
||||
|
||||
private void UpdateImportButton()
|
||||
{
|
||||
btnImport.Enabled = !string.IsNullOrWhiteSpace(_cheatFile) && (!string.IsNullOrWhiteSpace(_gameName) || _isMesenCheatFile);
|
||||
}
|
||||
|
||||
private void LoadGame(string romPath)
|
||||
{
|
||||
int archiveFileIndex = -1;
|
||||
if(frmSelectRom.SelectRom(romPath, ref archiveFileIndex)) {
|
||||
RomInfo romInfo = InteropEmu.GetRomInfo(romPath, archiveFileIndex);
|
||||
_gameCrc = romInfo.GetPrgCrcString();
|
||||
_gameName = romInfo.GetRomName();
|
||||
txtGameName.Text = _gameName;
|
||||
UpdateImportButton();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnBrowseGame_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Filter = ResourceHelper.GetMessage("FilterRom");
|
||||
if(ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
|
||||
LoadGame(ofd.FileName);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnBrowseCheat_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Filter = ResourceHelper.GetMessage("FilterCheat");
|
||||
if(ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
|
||||
_cheatFile = ofd.FileName;
|
||||
_isMesenCheatFile = NestopiaCheatLoader.IsMesenCheatFile(_cheatFile);
|
||||
if(_isMesenCheatFile) {
|
||||
txtGameName.Text = "";
|
||||
_gameName = "";
|
||||
_gameCrc = "";
|
||||
}
|
||||
txtCheatFile.Text = Path.GetFileName(_cheatFile);
|
||||
UpdateImportButton();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(File.Exists(_cheatFile)) {
|
||||
switch(Path.GetExtension(_cheatFile).ToLowerInvariant().Substring(1)) {
|
||||
default:
|
||||
case "xml":
|
||||
ImportedCheats = NestopiaCheatLoader.Load(_cheatFile, _gameName, _gameCrc);
|
||||
break;
|
||||
|
||||
case "cht":
|
||||
ImportedCheats = FceuxCheatLoader.Load(_cheatFile, _gameName, _gameCrc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(ImportedCheats != null) {
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
123
GUI.NET/Forms/Cheats/frmCheatImport.resx
Normal file
123
GUI.NET/Forms/Cheats/frmCheatImport.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
322
GUI.NET/Forms/Cheats/frmCheatList.Designer.cs
generated
322
GUI.NET/Forms/Cheats/frmCheatList.Designer.cs
generated
@ -29,33 +29,55 @@ namespace Mesen.GUI.Forms.Cheats
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmCheatList));
|
||||
this.tabMain = new System.Windows.Forms.TabControl();
|
||||
this.tabCheats = new System.Windows.Forms.TabPage();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.chkCurrentGameOnly = new System.Windows.Forms.CheckBox();
|
||||
this.lstCheats = new Mesen.GUI.Controls.MyListView();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.lstGameList = new System.Windows.Forms.ListView();
|
||||
this.colGameName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.contextMenuGames = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.mnuDeleteGameCheats = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuExportGame = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.lstCheats = new Mesen.GUI.Controls.MyListView();
|
||||
this.colCheatName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.colCode = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.contextMenuCheats = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.mnuAddCheat = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuDeleteCheat = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.btnAddCheat = new System.Windows.Forms.Button();
|
||||
this.btnDeleteCheat = new System.Windows.Forms.Button();
|
||||
this.mnuExportSelectedCheats = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsCheatActions = new System.Windows.Forms.ToolStrip();
|
||||
this.btnAddCheat = new System.Windows.Forms.ToolStripButton();
|
||||
this.btnDelete = new System.Windows.Forms.ToolStripSplitButton();
|
||||
this.btnDeleteCheat = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.btnDeleteGameCheats = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.btnImport = new System.Windows.Forms.ToolStripButton();
|
||||
this.btnExport = new System.Windows.Forms.ToolStripSplitButton();
|
||||
this.btnExportAllCheats = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.btnExportGame = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.btnExportSelectedCheats = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.chkDisableCheats = new System.Windows.Forms.CheckBox();
|
||||
this.baseConfigPanel.SuspendLayout();
|
||||
this.tabMain.SuspendLayout();
|
||||
this.tabCheats.SuspendLayout();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.contextMenuGames.SuspendLayout();
|
||||
this.contextMenuCheats.SuspendLayout();
|
||||
this.flowLayoutPanel2.SuspendLayout();
|
||||
this.tsCheatActions.SuspendLayout();
|
||||
this.tableLayoutPanel2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// baseConfigPanel
|
||||
//
|
||||
this.baseConfigPanel.Location = new System.Drawing.Point(0, 226);
|
||||
this.baseConfigPanel.Size = new System.Drawing.Size(443, 29);
|
||||
this.baseConfigPanel.Controls.Add(this.chkDisableCheats);
|
||||
this.baseConfigPanel.Location = new System.Drawing.Point(0, 257);
|
||||
this.baseConfigPanel.Size = new System.Drawing.Size(616, 29);
|
||||
this.baseConfigPanel.Controls.SetChildIndex(this.chkDisableCheats, 0);
|
||||
//
|
||||
// tabMain
|
||||
//
|
||||
@ -65,7 +87,7 @@ namespace Mesen.GUI.Forms.Cheats
|
||||
this.tabMain.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.tabMain.Name = "tabMain";
|
||||
this.tabMain.SelectedIndex = 0;
|
||||
this.tabMain.Size = new System.Drawing.Size(443, 226);
|
||||
this.tabMain.Size = new System.Drawing.Size(616, 257);
|
||||
this.tabMain.TabIndex = 0;
|
||||
//
|
||||
// tabCheats
|
||||
@ -74,55 +96,111 @@ namespace Mesen.GUI.Forms.Cheats
|
||||
this.tabCheats.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabCheats.Name = "tabCheats";
|
||||
this.tabCheats.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabCheats.Size = new System.Drawing.Size(435, 200);
|
||||
this.tabCheats.Size = new System.Drawing.Size(608, 231);
|
||||
this.tabCheats.TabIndex = 0;
|
||||
this.tabCheats.Text = "Cheats";
|
||||
this.tabCheats.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 2;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.chkCurrentGameOnly, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.lstCheats, 0, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 0, 1);
|
||||
this.tableLayoutPanel1.ColumnCount = 1;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel1.Controls.Add(this.splitContainer1, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.tsCheatActions, 0, 0);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 3;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowCount = 2;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(429, 194);
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(602, 225);
|
||||
this.tableLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// chkCurrentGameOnly
|
||||
// splitContainer1
|
||||
//
|
||||
this.chkCurrentGameOnly.AutoSize = true;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.chkCurrentGameOnly, 2);
|
||||
this.chkCurrentGameOnly.Location = new System.Drawing.Point(3, 3);
|
||||
this.chkCurrentGameOnly.Name = "chkCurrentGameOnly";
|
||||
this.chkCurrentGameOnly.Size = new System.Drawing.Size(208, 17);
|
||||
this.chkCurrentGameOnly.TabIndex = 0;
|
||||
this.chkCurrentGameOnly.Text = "Only show cheats for the current game";
|
||||
this.chkCurrentGameOnly.UseVisualStyleBackColor = true;
|
||||
this.chkCurrentGameOnly.CheckedChanged += new System.EventHandler(this.chkCurrentGameOnly_CheckedChanged);
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(3, 26);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.lstGameList);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.lstCheats);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(596, 196);
|
||||
this.splitContainer1.SplitterDistance = 213;
|
||||
this.splitContainer1.TabIndex = 5;
|
||||
//
|
||||
// lstGameList
|
||||
//
|
||||
this.lstGameList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.colGameName});
|
||||
this.lstGameList.ContextMenuStrip = this.contextMenuGames;
|
||||
this.lstGameList.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lstGameList.FullRowSelect = true;
|
||||
this.lstGameList.GridLines = true;
|
||||
this.lstGameList.HideSelection = false;
|
||||
this.lstGameList.Location = new System.Drawing.Point(0, 0);
|
||||
this.lstGameList.MultiSelect = false;
|
||||
this.lstGameList.Name = "lstGameList";
|
||||
this.lstGameList.Size = new System.Drawing.Size(213, 196);
|
||||
this.lstGameList.Sorting = System.Windows.Forms.SortOrder.Ascending;
|
||||
this.lstGameList.TabIndex = 2;
|
||||
this.lstGameList.UseCompatibleStateImageBehavior = false;
|
||||
this.lstGameList.View = System.Windows.Forms.View.Details;
|
||||
this.lstGameList.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.lstGameList_ColumnClick);
|
||||
this.lstGameList.SelectedIndexChanged += new System.EventHandler(this.lstGameList_SelectedIndexChanged);
|
||||
//
|
||||
// colGameName
|
||||
//
|
||||
this.colGameName.Name = "colGameName";
|
||||
this.colGameName.Text = "Game";
|
||||
this.colGameName.Width = 180;
|
||||
//
|
||||
// contextMenuGames
|
||||
//
|
||||
this.contextMenuGames.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.mnuDeleteGameCheats,
|
||||
this.mnuExportGame});
|
||||
this.contextMenuGames.Name = "contextMenuCheats";
|
||||
this.contextMenuGames.Size = new System.Drawing.Size(132, 48);
|
||||
//
|
||||
// mnuDeleteGameCheats
|
||||
//
|
||||
this.mnuDeleteGameCheats.Enabled = false;
|
||||
this.mnuDeleteGameCheats.Image = global::Mesen.GUI.Properties.Resources.Close;
|
||||
this.mnuDeleteGameCheats.Name = "mnuDeleteGameCheats";
|
||||
this.mnuDeleteGameCheats.ShortcutKeys = System.Windows.Forms.Keys.Delete;
|
||||
this.mnuDeleteGameCheats.Size = new System.Drawing.Size(131, 22);
|
||||
this.mnuDeleteGameCheats.Text = "Delete";
|
||||
this.mnuDeleteGameCheats.Click += new System.EventHandler(this.btnDeleteGameCheats_Click);
|
||||
//
|
||||
// mnuExportGame
|
||||
//
|
||||
this.mnuExportGame.Enabled = false;
|
||||
this.mnuExportGame.Image = global::Mesen.GUI.Properties.Resources.Export;
|
||||
this.mnuExportGame.Name = "mnuExportGame";
|
||||
this.mnuExportGame.Size = new System.Drawing.Size(131, 22);
|
||||
this.mnuExportGame.Text = "Export";
|
||||
this.mnuExportGame.Click += new System.EventHandler(this.btnExportGame_Click);
|
||||
//
|
||||
// lstCheats
|
||||
//
|
||||
this.lstCheats.CheckBoxes = true;
|
||||
this.lstCheats.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.colGameName,
|
||||
this.colCheatName,
|
||||
this.colCode});
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.lstCheats, 2);
|
||||
this.lstCheats.ContextMenuStrip = this.contextMenuCheats;
|
||||
this.lstCheats.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lstCheats.FullRowSelect = true;
|
||||
this.lstCheats.Location = new System.Drawing.Point(3, 55);
|
||||
this.lstCheats.GridLines = true;
|
||||
this.lstCheats.HideSelection = false;
|
||||
this.lstCheats.Location = new System.Drawing.Point(0, 0);
|
||||
this.lstCheats.Name = "lstCheats";
|
||||
this.lstCheats.Size = new System.Drawing.Size(423, 136);
|
||||
this.lstCheats.Size = new System.Drawing.Size(379, 196);
|
||||
this.lstCheats.TabIndex = 1;
|
||||
this.lstCheats.UseCompatibleStateImageBehavior = false;
|
||||
this.lstCheats.View = System.Windows.Forms.View.Details;
|
||||
@ -130,34 +208,30 @@ namespace Mesen.GUI.Forms.Cheats
|
||||
this.lstCheats.SelectedIndexChanged += new System.EventHandler(this.lstCheats_SelectedIndexChanged);
|
||||
this.lstCheats.DoubleClick += new System.EventHandler(this.lstCheats_DoubleClick);
|
||||
//
|
||||
// colGameName
|
||||
//
|
||||
this.colGameName.Name = "colGameName";
|
||||
this.colGameName.Text = "Game";
|
||||
this.colGameName.Width = 98;
|
||||
//
|
||||
// colCheatName
|
||||
//
|
||||
this.colCheatName.Name = "colCheatName";
|
||||
this.colCheatName.Text = "Cheat Name";
|
||||
this.colCheatName.Width = 110;
|
||||
this.colCheatName.Width = 250;
|
||||
//
|
||||
// colCode
|
||||
//
|
||||
this.colCode.Name = "colCode";
|
||||
this.colCode.Text = "Code";
|
||||
this.colCode.Width = 142;
|
||||
this.colCode.Width = 100;
|
||||
//
|
||||
// contextMenuCheats
|
||||
//
|
||||
this.contextMenuCheats.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.mnuAddCheat,
|
||||
this.mnuDeleteCheat});
|
||||
this.mnuDeleteCheat,
|
||||
this.mnuExportSelectedCheats});
|
||||
this.contextMenuCheats.Name = "contextMenuCheats";
|
||||
this.contextMenuCheats.Size = new System.Drawing.Size(160, 70);
|
||||
//
|
||||
// mnuAddCheat
|
||||
//
|
||||
this.mnuAddCheat.Image = ((System.Drawing.Image)(resources.GetObject("mnuAddCheat.Image")));
|
||||
this.mnuAddCheat.Name = "mnuAddCheat";
|
||||
this.mnuAddCheat.ShortcutKeys = System.Windows.Forms.Keys.Insert;
|
||||
this.mnuAddCheat.Size = new System.Drawing.Size(159, 22);
|
||||
@ -167,47 +241,116 @@ namespace Mesen.GUI.Forms.Cheats
|
||||
// mnuDeleteCheat
|
||||
//
|
||||
this.mnuDeleteCheat.Enabled = false;
|
||||
this.mnuDeleteCheat.Image = global::Mesen.GUI.Properties.Resources.Close;
|
||||
this.mnuDeleteCheat.Name = "mnuDeleteCheat";
|
||||
this.mnuDeleteCheat.ShortcutKeys = System.Windows.Forms.Keys.Delete;
|
||||
this.mnuDeleteCheat.Size = new System.Drawing.Size(159, 22);
|
||||
this.mnuDeleteCheat.Text = "Delete";
|
||||
this.mnuDeleteCheat.Click += new System.EventHandler(this.mnuDeleteCheat_Click);
|
||||
this.mnuDeleteCheat.Click += new System.EventHandler(this.btnDeleteCheat_Click);
|
||||
//
|
||||
// flowLayoutPanel2
|
||||
// mnuExportSelectedCheats
|
||||
//
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.flowLayoutPanel2, 2);
|
||||
this.flowLayoutPanel2.Controls.Add(this.btnAddCheat);
|
||||
this.flowLayoutPanel2.Controls.Add(this.btnDeleteCheat);
|
||||
this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 23);
|
||||
this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
|
||||
this.flowLayoutPanel2.Size = new System.Drawing.Size(429, 29);
|
||||
this.flowLayoutPanel2.TabIndex = 3;
|
||||
this.mnuExportSelectedCheats.Enabled = false;
|
||||
this.mnuExportSelectedCheats.Image = global::Mesen.GUI.Properties.Resources.Export;
|
||||
this.mnuExportSelectedCheats.Name = "mnuExportSelectedCheats";
|
||||
this.mnuExportSelectedCheats.Size = new System.Drawing.Size(159, 22);
|
||||
this.mnuExportSelectedCheats.Text = "Export";
|
||||
this.mnuExportSelectedCheats.Click += new System.EventHandler(this.btnExportSelectedCheats_Click);
|
||||
//
|
||||
// tsCheatActions
|
||||
//
|
||||
this.tsCheatActions.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.btnAddCheat,
|
||||
this.btnDelete,
|
||||
this.btnImport,
|
||||
this.btnExport});
|
||||
this.tsCheatActions.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow;
|
||||
this.tsCheatActions.Location = new System.Drawing.Point(0, 0);
|
||||
this.tsCheatActions.Name = "tsCheatActions";
|
||||
this.tsCheatActions.Size = new System.Drawing.Size(602, 23);
|
||||
this.tsCheatActions.TabIndex = 6;
|
||||
this.tsCheatActions.Text = "toolStrip1";
|
||||
//
|
||||
// btnAddCheat
|
||||
//
|
||||
this.btnAddCheat.AutoSize = true;
|
||||
this.btnAddCheat.Location = new System.Drawing.Point(3, 3);
|
||||
this.btnAddCheat.Image = ((System.Drawing.Image)(resources.GetObject("btnAddCheat.Image")));
|
||||
this.btnAddCheat.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.btnAddCheat.Name = "btnAddCheat";
|
||||
this.btnAddCheat.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnAddCheat.TabIndex = 2;
|
||||
this.btnAddCheat.Size = new System.Drawing.Size(49, 20);
|
||||
this.btnAddCheat.Text = "Add Cheat";
|
||||
this.btnAddCheat.UseVisualStyleBackColor = true;
|
||||
this.btnAddCheat.Click += new System.EventHandler(this.mnuAddCheat_Click);
|
||||
//
|
||||
// btnDelete
|
||||
//
|
||||
this.btnDelete.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.btnDeleteCheat,
|
||||
this.btnDeleteGameCheats});
|
||||
this.btnDelete.Image = global::Mesen.GUI.Properties.Resources.Close;
|
||||
this.btnDelete.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.btnDelete.Name = "btnDelete";
|
||||
this.btnDelete.Size = new System.Drawing.Size(72, 20);
|
||||
this.btnDelete.Text = "Delete";
|
||||
this.btnDelete.ButtonClick += new System.EventHandler(this.btnDelete_ButtonClick);
|
||||
//
|
||||
// btnDeleteCheat
|
||||
//
|
||||
this.btnDeleteCheat.AutoSize = true;
|
||||
this.btnDeleteCheat.Enabled = false;
|
||||
this.btnDeleteCheat.Location = new System.Drawing.Point(84, 3);
|
||||
this.btnDeleteCheat.Name = "btnDeleteCheat";
|
||||
this.btnDeleteCheat.Size = new System.Drawing.Size(129, 23);
|
||||
this.btnDeleteCheat.TabIndex = 3;
|
||||
this.btnDeleteCheat.Text = "Delete Selected Cheats";
|
||||
this.btnDeleteCheat.UseVisualStyleBackColor = true;
|
||||
this.btnDeleteCheat.Size = new System.Drawing.Size(256, 22);
|
||||
this.btnDeleteCheat.Text = "Delete selected cheats";
|
||||
this.btnDeleteCheat.Click += new System.EventHandler(this.btnDeleteCheat_Click);
|
||||
//
|
||||
// btnDeleteGameCheats
|
||||
//
|
||||
this.btnDeleteGameCheats.Name = "btnDeleteGameCheats";
|
||||
this.btnDeleteGameCheats.Size = new System.Drawing.Size(256, 22);
|
||||
this.btnDeleteGameCheats.Text = "Delete all cheats for selected game";
|
||||
this.btnDeleteGameCheats.Click += new System.EventHandler(this.btnDeleteGameCheats_Click);
|
||||
//
|
||||
// btnImport
|
||||
//
|
||||
this.btnImport.Image = global::Mesen.GUI.Properties.Resources.Import;
|
||||
this.btnImport.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.btnImport.Name = "btnImport";
|
||||
this.btnImport.Size = new System.Drawing.Size(63, 20);
|
||||
this.btnImport.Text = "Import";
|
||||
this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
|
||||
//
|
||||
// btnExport
|
||||
//
|
||||
this.btnExport.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.btnExportAllCheats,
|
||||
this.btnExportGame,
|
||||
this.btnExportSelectedCheats});
|
||||
this.btnExport.Image = global::Mesen.GUI.Properties.Resources.Export;
|
||||
this.btnExport.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.btnExport.Name = "btnExport";
|
||||
this.btnExport.Size = new System.Drawing.Size(72, 20);
|
||||
this.btnExport.Text = "Export";
|
||||
this.btnExport.ButtonClick += new System.EventHandler(this.btnExport_ButtonClick);
|
||||
//
|
||||
// btnExportAllCheats
|
||||
//
|
||||
this.btnExportAllCheats.Name = "btnExportAllCheats";
|
||||
this.btnExportAllCheats.Size = new System.Drawing.Size(157, 22);
|
||||
this.btnExportAllCheats.Text = "All Cheats";
|
||||
this.btnExportAllCheats.Click += new System.EventHandler(this.btnExportAllCheats_Click);
|
||||
//
|
||||
// btnExportGame
|
||||
//
|
||||
this.btnExportGame.Name = "btnExportGame";
|
||||
this.btnExportGame.Size = new System.Drawing.Size(157, 22);
|
||||
this.btnExportGame.Text = "Selected Game";
|
||||
this.btnExportGame.Click += new System.EventHandler(this.btnExportGame_Click);
|
||||
//
|
||||
// btnExportSelectedCheats
|
||||
//
|
||||
this.btnExportSelectedCheats.Enabled = false;
|
||||
this.btnExportSelectedCheats.Name = "btnExportSelectedCheats";
|
||||
this.btnExportSelectedCheats.Size = new System.Drawing.Size(157, 22);
|
||||
this.btnExportSelectedCheats.Text = "Selected Cheats";
|
||||
this.btnExportSelectedCheats.Click += new System.EventHandler(this.btnExportSelectedCheats_Click);
|
||||
//
|
||||
// tableLayoutPanel2
|
||||
//
|
||||
this.tableLayoutPanel2.ColumnCount = 1;
|
||||
@ -219,27 +362,45 @@ namespace Mesen.GUI.Forms.Cheats
|
||||
this.tableLayoutPanel2.RowCount = 2;
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel2.Size = new System.Drawing.Size(443, 226);
|
||||
this.tableLayoutPanel2.Size = new System.Drawing.Size(616, 257);
|
||||
this.tableLayoutPanel2.TabIndex = 2;
|
||||
//
|
||||
// chkDisableCheats
|
||||
//
|
||||
this.chkDisableCheats.AutoSize = true;
|
||||
this.chkDisableCheats.Location = new System.Drawing.Point(7, 7);
|
||||
this.chkDisableCheats.Name = "chkDisableCheats";
|
||||
this.chkDisableCheats.Size = new System.Drawing.Size(109, 17);
|
||||
this.chkDisableCheats.TabIndex = 3;
|
||||
this.chkDisableCheats.Text = "Disable all cheats";
|
||||
this.chkDisableCheats.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// frmCheatList
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(443, 255);
|
||||
this.ClientSize = new System.Drawing.Size(616, 286);
|
||||
this.Controls.Add(this.tableLayoutPanel2);
|
||||
this.MinimumSize = new System.Drawing.Size(632, 324);
|
||||
this.Name = "frmCheatList";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Cheats";
|
||||
this.Controls.SetChildIndex(this.baseConfigPanel, 0);
|
||||
this.Controls.SetChildIndex(this.tableLayoutPanel2, 0);
|
||||
this.baseConfigPanel.ResumeLayout(false);
|
||||
this.baseConfigPanel.PerformLayout();
|
||||
this.tabMain.ResumeLayout(false);
|
||||
this.tabCheats.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.contextMenuGames.ResumeLayout(false);
|
||||
this.contextMenuCheats.ResumeLayout(false);
|
||||
this.flowLayoutPanel2.ResumeLayout(false);
|
||||
this.flowLayoutPanel2.PerformLayout();
|
||||
this.tsCheatActions.ResumeLayout(false);
|
||||
this.tsCheatActions.PerformLayout();
|
||||
this.tableLayoutPanel2.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
@ -250,17 +411,30 @@ namespace Mesen.GUI.Forms.Cheats
|
||||
private System.Windows.Forms.TabControl tabMain;
|
||||
private System.Windows.Forms.TabPage tabCheats;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.CheckBox chkCurrentGameOnly;
|
||||
private MyListView lstCheats;
|
||||
private System.Windows.Forms.ColumnHeader colGameName;
|
||||
private System.Windows.Forms.ColumnHeader colCheatName;
|
||||
private System.Windows.Forms.ColumnHeader colCode;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuCheats;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuAddCheat;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuDeleteCheat;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
|
||||
private System.Windows.Forms.Button btnAddCheat;
|
||||
private System.Windows.Forms.Button btnDeleteCheat;
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.ToolStrip tsCheatActions;
|
||||
private System.Windows.Forms.ToolStripButton btnAddCheat;
|
||||
private System.Windows.Forms.ToolStripButton btnImport;
|
||||
private System.Windows.Forms.CheckBox chkDisableCheats;
|
||||
private System.Windows.Forms.ListView lstGameList;
|
||||
private System.Windows.Forms.ColumnHeader colGameName;
|
||||
private System.Windows.Forms.ToolStripSplitButton btnDelete;
|
||||
private System.Windows.Forms.ToolStripMenuItem btnDeleteCheat;
|
||||
private System.Windows.Forms.ToolStripMenuItem btnDeleteGameCheats;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuGames;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuDeleteGameCheats;
|
||||
private System.Windows.Forms.ToolStripSplitButton btnExport;
|
||||
private System.Windows.Forms.ToolStripMenuItem btnExportAllCheats;
|
||||
private System.Windows.Forms.ToolStripMenuItem btnExportGame;
|
||||
private System.Windows.Forms.ToolStripMenuItem btnExportSelectedCheats;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuExportSelectedCheats;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuExportGame;
|
||||
}
|
||||
}
|
@ -14,48 +14,120 @@ namespace Mesen.GUI.Forms.Cheats
|
||||
{
|
||||
public partial class frmCheatList : BaseConfigForm
|
||||
{
|
||||
private List<CheatInfo> Cheats { get { return ConfigManager.Config.Cheats; } }
|
||||
private GameInfo _selectedItem = null;
|
||||
|
||||
public frmCheatList()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
chkCurrentGameOnly.Checked = ConfigManager.Config.ShowOnlyCheatsForCurrentGame;
|
||||
if(!chkCurrentGameOnly.Checked) {
|
||||
UpdateCheatList();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
Location = new Point(Owner.Location.X + (Owner.Width - Width) / 2, Owner.Location.Y + (Owner.Height - Height) / 2);
|
||||
chkDisableCheats.Checked = ConfigManager.Config.DisableAllCheats;
|
||||
UpdateGameList();
|
||||
}
|
||||
|
||||
|
||||
protected override void UpdateConfig()
|
||||
{
|
||||
ConfigManager.Config.ShowOnlyCheatsForCurrentGame = chkCurrentGameOnly.Checked;
|
||||
ConfigManager.Config.DisableAllCheats = chkDisableCheats.Checked;
|
||||
}
|
||||
|
||||
private void UpdateGameList(string gameCrc = null)
|
||||
{
|
||||
RomInfo romInfo = InteropEmu.GetRomInfo();
|
||||
Dictionary<string, string> nameByCrc = new Dictionary<string, string>();
|
||||
if(!string.IsNullOrWhiteSpace(romInfo.RomName)) {
|
||||
nameByCrc[romInfo.GetPrgCrcString()] = romInfo.GetRomName();
|
||||
}
|
||||
foreach(CheatInfo cheat in this.Cheats) {
|
||||
if(!nameByCrc.ContainsKey(cheat.GameCrc)) {
|
||||
nameByCrc[cheat.GameCrc] = cheat.GameName;
|
||||
}
|
||||
}
|
||||
|
||||
lstGameList.Items.Clear();
|
||||
List<GameInfo> gameList = new List<GameInfo>();
|
||||
foreach(KeyValuePair<string, string> kvp in nameByCrc) {
|
||||
gameList.Add(new GameInfo { Text = kvp.Value, Crc = kvp.Key });
|
||||
}
|
||||
lstGameList.Items.AddRange(gameList.ToArray());
|
||||
|
||||
if(lstGameList.Items.Count > 0) {
|
||||
if(gameCrc == null) {
|
||||
if(_selectedItem == null && !string.IsNullOrWhiteSpace(romInfo.RomName)) {
|
||||
gameCrc = romInfo.GetPrgCrcString();
|
||||
} else {
|
||||
gameCrc = _selectedItem?.Crc;
|
||||
}
|
||||
}
|
||||
|
||||
_selectedItem = null;
|
||||
|
||||
if(gameCrc != null) {
|
||||
foreach(GameInfo info in lstGameList.Items) {
|
||||
if(info.Crc == gameCrc) {
|
||||
_selectedItem = info;
|
||||
info.Selected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(_selectedItem == null && lstGameList.Items.Count > 0) {
|
||||
_selectedItem = (GameInfo)lstGameList.Items[0];
|
||||
lstGameList.Items[0].Selected = true;
|
||||
}
|
||||
} else {
|
||||
_selectedItem = null;
|
||||
}
|
||||
|
||||
btnDeleteGameCheats.Enabled = mnuDeleteGameCheats.Enabled = btnExportGame.Enabled = mnuExportGame.Enabled = _selectedItem != null;
|
||||
|
||||
UpdateCheatList();
|
||||
}
|
||||
|
||||
private void UpdateCheatList()
|
||||
{
|
||||
string crc32 = InteropEmu.GetRomInfo().GetCrcString();
|
||||
lstCheats.Sorting = SortOrder.Ascending;
|
||||
lstCheats.Items.Clear();
|
||||
foreach(CheatInfo cheat in ConfigManager.Config.Cheats) {
|
||||
if(!chkCurrentGameOnly.Checked || cheat.GameCrc == crc32) {
|
||||
ListViewItem item = lstCheats.Items.Add(cheat.GameName);
|
||||
item.SubItems.AddRange(new string[] { cheat.CheatName, cheat.ToString() });
|
||||
item.Tag = cheat;
|
||||
item.Checked = cheat.Enabled;
|
||||
if(_selectedItem != null) {
|
||||
string crc32 = _selectedItem.Crc;
|
||||
foreach(CheatInfo cheat in this.Cheats) {
|
||||
if(cheat.GameCrc == crc32) {
|
||||
ListViewItem item = lstCheats.Items.Add(cheat.CheatName);
|
||||
item.SubItems.Add(cheat.ToString());
|
||||
item.Tag = cheat;
|
||||
item.Checked = cheat.Enabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void lstGameList_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(lstGameList.SelectedItems.Count > 0) {
|
||||
_selectedItem = (GameInfo)lstGameList.SelectedItems[0];
|
||||
UpdateCheatList();
|
||||
}
|
||||
}
|
||||
|
||||
private void lstGameList_ColumnClick(object sender, ColumnClickEventArgs e)
|
||||
{
|
||||
lstGameList.Sorting = lstGameList.Sorting == SortOrder.Ascending ? SortOrder.Descending : SortOrder.Ascending;
|
||||
}
|
||||
|
||||
private void mnuAddCheat_Click(object sender, EventArgs e)
|
||||
{
|
||||
CheatInfo newCheat = new CheatInfo();
|
||||
CheatInfo newCheat = new CheatInfo {
|
||||
GameCrc = _selectedItem?.Crc,
|
||||
GameName = _selectedItem?.Text
|
||||
};
|
||||
|
||||
frmCheat frm = new frmCheat(newCheat);
|
||||
if(frm.ShowDialog() == DialogResult.OK) {
|
||||
ConfigManager.Config.Cheats.Add(newCheat);
|
||||
UpdateCheatList();
|
||||
AddCheats(new List<CheatInfo>() { newCheat });
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +136,7 @@ namespace Mesen.GUI.Forms.Cheats
|
||||
if(lstCheats.SelectedItems.Count == 1) {
|
||||
frmCheat frm = new frmCheat((CheatInfo)lstCheats.SelectedItems[0].Tag);
|
||||
if(frm.ShowDialog() == DialogResult.OK) {
|
||||
UpdateCheatList();
|
||||
UpdateGameList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -76,25 +148,19 @@ namespace Mesen.GUI.Forms.Cheats
|
||||
}
|
||||
}
|
||||
|
||||
private void chkCurrentGameOnly_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
UpdateCheatList();
|
||||
}
|
||||
|
||||
private void lstCheats_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
bool enableDelete = lstCheats.SelectedItems.Count > 0;
|
||||
mnuDeleteCheat.Enabled = enableDelete;
|
||||
btnDeleteCheat.Enabled = enableDelete;
|
||||
bool enableActions = lstCheats.SelectedItems.Count > 0;
|
||||
mnuDeleteCheat.Enabled = btnDeleteCheat.Enabled = mnuExportSelectedCheats.Enabled = btnExportSelectedCheats.Enabled = enableActions;
|
||||
}
|
||||
|
||||
private void DeleteSelectedCheats()
|
||||
{
|
||||
foreach(var item in lstCheats.SelectedItems) {
|
||||
CheatInfo cheat = ((ListViewItem)item).Tag as CheatInfo;
|
||||
ConfigManager.Config.Cheats.Remove(cheat);
|
||||
foreach(ListViewItem item in lstCheats.SelectedItems) {
|
||||
CheatInfo cheat = item.Tag as CheatInfo;
|
||||
this.Cheats.Remove(cheat);
|
||||
}
|
||||
UpdateCheatList();
|
||||
UpdateGameList();
|
||||
}
|
||||
|
||||
private void btnDeleteCheat_Click(object sender, EventArgs e)
|
||||
@ -102,9 +168,88 @@ namespace Mesen.GUI.Forms.Cheats
|
||||
DeleteSelectedCheats();
|
||||
}
|
||||
|
||||
private void mnuDeleteCheat_Click(object sender, EventArgs e)
|
||||
private void btnDeleteGameCheats_Click(object sender, EventArgs e)
|
||||
{
|
||||
DeleteSelectedCheats();
|
||||
foreach(var item in lstCheats.Items) {
|
||||
CheatInfo cheat = ((ListViewItem)item).Tag as CheatInfo;
|
||||
this.Cheats.Remove(cheat);
|
||||
}
|
||||
UpdateGameList();
|
||||
}
|
||||
|
||||
private void btnImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
var frm = new frmCheatImport();
|
||||
frm.FormClosing += (o, evt) => {
|
||||
if(frm.DialogResult == DialogResult.OK && frm.ImportedCheats != null) {
|
||||
AddCheats(frm.ImportedCheats);
|
||||
}
|
||||
};
|
||||
frm.ShowDialog(sender, this);
|
||||
}
|
||||
|
||||
private void AddCheats(List<CheatInfo> cheats)
|
||||
{
|
||||
if(cheats.Count > 0) {
|
||||
HashSet<string> existingCheats = new HashSet<string>();
|
||||
foreach(CheatInfo cheat in this.Cheats) {
|
||||
existingCheats.Add(cheat.GameCrc + cheat.ToString());
|
||||
}
|
||||
|
||||
foreach(CheatInfo cheat in cheats) {
|
||||
if(!existingCheats.Contains(cheat.GameCrc + cheat.ToString())) {
|
||||
this.Cheats.Add(cheat);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateGameList(cheats[0].GameCrc);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnDelete_ButtonClick(object sender, EventArgs e)
|
||||
{
|
||||
btnDelete.ShowDropDown();
|
||||
}
|
||||
|
||||
private void ExportCheats(IEnumerable<CheatInfo> cheats, string defaultFilename)
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.AddExtension = true;
|
||||
sfd.FileName = defaultFilename;
|
||||
sfd.Filter = "XML (*.xml)|*.xml";
|
||||
|
||||
if(sfd.ShowDialog() == DialogResult.OK) {
|
||||
MesenCheatExporter.Export(sfd.FileName, cheats);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnExportAllCheats_Click(object sender, EventArgs e)
|
||||
{
|
||||
ExportCheats(this.Cheats, "MesenCheats.xml");
|
||||
}
|
||||
|
||||
private void btnExport_ButtonClick(object sender, EventArgs e)
|
||||
{
|
||||
btnExport.ShowDropDown();
|
||||
}
|
||||
|
||||
private void btnExportGame_Click(object sender, EventArgs e)
|
||||
{
|
||||
ExportCheats(this.Cheats.Where((c) => c.GameCrc == _selectedItem.Crc), _selectedItem.Text + "_Cheats.xml");
|
||||
}
|
||||
|
||||
private void btnExportSelectedCheats_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<CheatInfo> cheats = new List<CheatInfo>();
|
||||
foreach(ListViewItem item in lstCheats.SelectedItems) {
|
||||
cheats.Add(item.Tag as CheatInfo);
|
||||
}
|
||||
ExportCheats(cheats, _selectedItem.Text + "_Cheats.xml");
|
||||
}
|
||||
}
|
||||
|
||||
public class GameInfo : ListViewItem
|
||||
{
|
||||
public string Crc;
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,32 @@
|
||||
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="contextMenuGames.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>400, 17</value>
|
||||
</metadata>
|
||||
<metadata name="contextMenuCheats.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>107, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="mnuAddCheat.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMK0KCsAAAACFSURBVDhPpZDR
|
||||
DYAgDET50An8dRjWczHWqlQ5bOqBEC95ooW+EoOI/OJ6xBjlC5e3oBXsuTNcoKsFNcS8cwGL3yvfXKCr
|
||||
hdVKnQtG0hVgQgucyeGCiXABJjE0y7FVcuZvoI1r2tsCOxFo7GQIwNAN0OiZEgA0girogVhBzvMPRrGT
|
||||
75qEE3LcyzzdiXihAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="tsCheatActions.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>267, 17</value>
|
||||
</metadata>
|
||||
<data name="btnAddCheat.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACKSURBVDhPrY3LDYAwDEN7gAm4MkzXYzHWAgXyGlMoH4kn
|
||||
WZTEdtIv5JyXJykeC2qDwk49HgvUpGIGvD0WqKmm3tm/xwJM9lVdzUweC2z4ltsCLrSEx2MBy7d4LND2
|
||||
loxuGoo8uoPhCQv289gu0IvI0MsUoENBC4K1PhUggqgU3Am0YAt+5XQ5pbQCv1TxCMUky/oAAAAASUVO
|
||||
RK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
@ -136,6 +136,9 @@ namespace Mesen.GUI.Forms
|
||||
((Control)ctrl).Text = controlNode.InnerText;
|
||||
} else if(ctrl is ToolStripItem) {
|
||||
((ToolStripItem)ctrl).Text = controlNode.InnerText;
|
||||
if(((ToolStripItem)ctrl).DisplayStyle != ToolStripItemDisplayStyle.Image) {
|
||||
((ToolStripItem)ctrl).ToolTipText = "";
|
||||
}
|
||||
} else if(ctrl is ColumnHeader) {
|
||||
((ColumnHeader)ctrl).Text = controlNode.InnerText;
|
||||
}
|
||||
@ -150,6 +153,10 @@ namespace Mesen.GUI.Forms
|
||||
if(((ListView)ctrl).ContextMenuStrip != null) {
|
||||
ApplyResources(baseNode, ((ListView)ctrl).ContextMenuStrip.Items);
|
||||
}
|
||||
} else if(ctrl is ToolStrip) {
|
||||
ApplyResources(baseNode, ((ToolStrip)ctrl).Items);
|
||||
} else if(ctrl is ToolStripSplitButton) {
|
||||
ApplyResources(baseNode, ((ToolStripSplitButton)ctrl).DropDownItems);
|
||||
} else if(ctrl is Control) {
|
||||
ApplyResources(baseNode, ((Control)ctrl).Controls);
|
||||
} else if(ctrl is ToolStripMenuItem) {
|
||||
|
@ -165,14 +165,14 @@ namespace Mesen.GUI.Forms
|
||||
Version oldVersion = new Version(ConfigManager.Config.MesenVersion);
|
||||
if(oldVersion < newVersion) {
|
||||
//Upgrade
|
||||
if(oldVersion.Major == 0 && oldVersion.Minor <= 2) {
|
||||
//Version 0.3.0+
|
||||
if(oldVersion <= new Version("0.4.1")) {
|
||||
//Version 0.4.1-
|
||||
//Remove all old cheats (Game matching/CRC logic has been changed and no longer compatible)
|
||||
ConfigManager.Config.Cheats = new List<CheatInfo>();
|
||||
}
|
||||
|
||||
if(oldVersion.Major == 0 && oldVersion.Minor <= 3 && (oldVersion.Build == 0 || oldVersion.Minor <= 2)) {
|
||||
//Version 0.3.1+
|
||||
if(oldVersion <= new Version("0.3.0")) {
|
||||
//Version 0.3.0-
|
||||
//Remove all old VS system config to make sure the new defaults are used
|
||||
ConfigManager.Config.VsConfig = new List<VsConfigInfo>();
|
||||
}
|
||||
@ -1041,11 +1041,9 @@ namespace Mesen.GUI.Forms
|
||||
private void mnuCheats_Click(object sender, EventArgs e)
|
||||
{
|
||||
frmCheatList frm = new frmCheatList();
|
||||
frm.Show(sender, this);
|
||||
frm.FormClosed += (object a, FormClosedEventArgs b) => {
|
||||
frm = null;
|
||||
if(frm.ShowDialog(sender, this) == DialogResult.OK) {
|
||||
CheatInfo.ApplyCheats();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private void mnuInput_Click(object sender, EventArgs e)
|
||||
|
@ -374,12 +374,21 @@
|
||||
<Compile Include="Forms\BaseConfigForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Cheats\FceuxCheatLoader.cs" />
|
||||
<Compile Include="Forms\Cheats\frmCheat.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Cheats\frmCheat.Designer.cs">
|
||||
<DependentUpon>frmCheat.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Cheats\frmCheatImport.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Cheats\frmCheatImport.Designer.cs">
|
||||
<DependentUpon>frmCheatImport.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Cheats\MesenCheatExporter.cs" />
|
||||
<Compile Include="Forms\Cheats\NestopiaCheatLoader.cs" />
|
||||
<Compile Include="Forms\Config\ctrlDipSwitch.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
@ -592,6 +601,9 @@
|
||||
<EmbeddedResource Include="Forms\Cheats\frmCheat.resx">
|
||||
<DependentUpon>frmCheat.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Cheats\frmCheatImport.resx">
|
||||
<DependentUpon>frmCheatImport.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Config\ctrlDipSwitch.resx">
|
||||
<DependentUpon>ctrlDipSwitch.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@ -740,15 +752,17 @@
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Icon.ico" />
|
||||
<None Include="Resources\Import.png" />
|
||||
<None Include="Resources\Export.png" />
|
||||
<None Include="Resources\NsfBackground.png" />
|
||||
<None Include="Resources\PrevTrack.png" />
|
||||
<None Include="Resources\NextTrack.png" />
|
||||
<None Include="Resources\LogWindow.png" />
|
||||
<None Include="Resources\format-justify-fill.png" />
|
||||
<None Include="Resources\Record.png" />
|
||||
<None Include="Resources\microphone.png" />
|
||||
<None Include="Resources\DownArrow.png" />
|
||||
<None Include="Resources\accept.png" />
|
||||
<None Include="Resources\Add.png" />
|
||||
<Content Include="Resources\coins.png" />
|
||||
<None Include="Resources\DipSwitches.png" />
|
||||
<None Include="Resources\MesenIcon.png" />
|
||||
@ -779,7 +793,6 @@
|
||||
<None Include="Resources\Close.png" />
|
||||
<None Include="Resources\PreviousArrow.png" />
|
||||
<None Include="Resources\NextArrow.png" />
|
||||
<None Include="Resources\MesenIcon.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
@ -680,6 +680,11 @@ namespace Mesen.GUI
|
||||
{
|
||||
return this.Crc32.ToString("X8");
|
||||
}
|
||||
|
||||
public string GetPrgCrcString()
|
||||
{
|
||||
return this.PrgCrc32.ToString("X8");
|
||||
}
|
||||
};
|
||||
|
||||
public struct InteropBreakpoint
|
||||
|
30
GUI.NET/Properties/Resources.Designer.cs
generated
30
GUI.NET/Properties/Resources.Designer.cs
generated
@ -70,6 +70,16 @@ namespace Mesen.GUI.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Add {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Add", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
@ -170,6 +180,16 @@ namespace Mesen.GUI.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Export {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Export", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
@ -220,6 +240,16 @@ namespace Mesen.GUI.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Import {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Import", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
@ -223,4 +223,13 @@
|
||||
<data name="PrevTrack" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\PrevTrack.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Add" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Export" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Export.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Import" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Import.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
GUI.NET/Resources/Add.png
Normal file
BIN
GUI.NET/Resources/Add.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 264 B |
BIN
GUI.NET/Resources/Export.png
Normal file
BIN
GUI.NET/Resources/Export.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 237 B |
BIN
GUI.NET/Resources/Import.png
Normal file
BIN
GUI.NET/Resources/Import.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 218 B |
Loading…
x
Reference in New Issue
Block a user