From 9d58a1be8b8ed3ebad7a5798506ff30168bb3f91 Mon Sep 17 00:00:00 2001 From: Ty Lamontagne Date: Fri, 16 Sep 2022 20:56:40 -0400 Subject: [PATCH] Revert "BiosTools: Allow BIOS region patching" This reverts commit a4dcaa7c149c80442e4087ff497561764d04001a. --- pcsx2-qt/Settings/BIOSSettingsWidget.cpp | 7 ----- pcsx2-qt/Settings/BIOSSettingsWidget.ui | 33 ++------------------ pcsx2/Config.h | 3 -- pcsx2/Pcsx2Config.cpp | 4 --- pcsx2/ps2/BiosTools.cpp | 39 ++++++++---------------- pcsx2/ps2/BiosTools.h | 19 +----------- 6 files changed, 16 insertions(+), 89 deletions(-) diff --git a/pcsx2-qt/Settings/BIOSSettingsWidget.cpp b/pcsx2-qt/Settings/BIOSSettingsWidget.cpp index 7b2a80363d..67d940d937 100644 --- a/pcsx2-qt/Settings/BIOSSettingsWidget.cpp +++ b/pcsx2-qt/Settings/BIOSSettingsWidget.cpp @@ -36,13 +36,9 @@ BIOSSettingsWidget::BIOSSettingsWidget(SettingsDialog* dialog, QWidget* parent) m_ui.setupUi(this); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.fastBoot, "EmuCore", "EnableFastBoot", true); - SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.patchRegion, "EmuCore", "PatchBios", false); - SettingWidgetBinder::BindWidgetToEnumSetting(sif, m_ui.regionComboBox, "EmuCore", "PatchRegion", BiosZoneStrings, BiosZoneBytes, BiosZoneBytes[0]); SettingWidgetBinder::BindWidgetToFolderSetting(sif, m_ui.searchDirectory, m_ui.browseSearchDirectory, m_ui.openSearchDirectory, m_ui.resetSearchDirectory, "Folders", "Bios", Path::Combine(EmuFolders::DataRoot, "bios")); - dialog->registerWidgetHelp(m_ui.patchRegion, tr("Patch Region"), tr("Unchecked"), - tr("Patches the BIOS region byte in ROM. Not recommended unless you really know what you're doing.")); dialog->registerWidgetHelp(m_ui.fastBoot, tr("Fast Boot"), tr("Checked"), tr("Patches the BIOS to skip the console's boot animation.")); @@ -51,9 +47,6 @@ BIOSSettingsWidget::BIOSSettingsWidget(SettingsDialog* dialog, QWidget* parent) connect(m_ui.searchDirectory, &QLineEdit::textChanged, this, &BIOSSettingsWidget::refreshList); connect(m_ui.refresh, &QPushButton::clicked, this, &BIOSSettingsWidget::refreshList); connect(m_ui.fileList, &QTreeWidget::currentItemChanged, this, &BIOSSettingsWidget::listItemChanged); - - connect(m_ui.patchRegion, &QCheckBox::clicked, this, [&] { m_ui.regionComboBox->setEnabled(m_ui.patchRegion->isChecked()); }); - m_ui.regionComboBox->setEnabled(m_ui.patchRegion->isChecked()); } BIOSSettingsWidget::~BIOSSettingsWidget() diff --git a/pcsx2-qt/Settings/BIOSSettingsWidget.ui b/pcsx2-qt/Settings/BIOSSettingsWidget.ui index 24abd272fc..8f9ca565e4 100644 --- a/pcsx2-qt/Settings/BIOSSettingsWidget.ui +++ b/pcsx2-qt/Settings/BIOSSettingsWidget.ui @@ -7,7 +7,7 @@ 0 0 618 - 439 + 408 @@ -134,41 +134,14 @@ Options and Patches - - - - - Patch Region - - - - + + Fast Boot - - - - false - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - diff --git a/pcsx2/Config.h b/pcsx2/Config.h index 03fa9e90f4..0832a08837 100644 --- a/pcsx2/Config.h +++ b/pcsx2/Config.h @@ -959,7 +959,6 @@ struct Pcsx2Config #endif // when enabled uses BOOT2 injection, skipping sony bios splashes UseBOOT2Injection : 1, - PatchBios : 1, BackupSavestate : 1, SavestateZstdCompression : 1, // enables simulated ejection of memory cards when loading savestates @@ -994,8 +993,6 @@ struct Pcsx2Config FilenameOptions BaseFilenames; - std::string PatchRegion; - // Memorycard options - first 2 are default slots, last 6 are multitap 1 and 2 // slots (3 each) McdOptions Mcd[8]; diff --git a/pcsx2/Pcsx2Config.cpp b/pcsx2/Pcsx2Config.cpp index 59671190fb..2d4ab942fe 100644 --- a/pcsx2/Pcsx2Config.cpp +++ b/pcsx2/Pcsx2Config.cpp @@ -1073,8 +1073,6 @@ void Pcsx2Config::LoadSave(SettingsWrapper& wrap) #endif SettingsWrapBitBool(ConsoleToStdio); SettingsWrapBitBool(HostFs); - SettingsWrapBitBool(PatchBios); - SettingsWrapEntry(PatchRegion); SettingsWrapBitBool(BackupSavestate); SettingsWrapBitBool(SavestateZstdCompression); @@ -1225,8 +1223,6 @@ void Pcsx2Config::CopyConfig(const Pcsx2Config& cfg) EnableNoInterlacingPatches = cfg.EnableNoInterlacingPatches; EnableRecordingTools = cfg.EnableRecordingTools; UseBOOT2Injection = cfg.UseBOOT2Injection; - PatchBios = cfg.PatchBios; - PatchRegion = cfg.PatchRegion; BackupSavestate = cfg.BackupSavestate; SavestateZstdCompression = cfg.SavestateZstdCompression; McdEnableEjection = cfg.McdEnableEjection; diff --git a/pcsx2/ps2/BiosTools.cpp b/pcsx2/ps2/BiosTools.cpp index a2573dc4ee..e136c38e9d 100644 --- a/pcsx2/ps2/BiosTools.cpp +++ b/pcsx2/ps2/BiosTools.cpp @@ -57,7 +57,6 @@ std::string BiosDescription; std::string BiosZone; std::string BiosPath; BiosDebugInformation CurrentBiosInformation; -s64 BiosRegionOffset = 0; static bool LoadBiosVersion(std::FILE* fp, u32& version, std::string& description, u32& region, std::string& zone) { @@ -92,25 +91,19 @@ static bool LoadBiosVersion(std::FILE* fp, u32& version, std::string& descriptio switch (romver[4]) { // clang-format off - case 'T': region = 0; break; - case 'X': region = 1; break; - case 'J': region = 2; break; - case 'A': region = 3; break; - case 'E': region = 4; break; - case 'H': region = 5; break; - case 'P': region = 6; break; - case 'C': region = 7; break; + case 'T': zone = "T10K"; region = 0; break; + case 'X': zone = "Test"; region = 1; break; + case 'J': zone = "Japan"; region = 2; break; + case 'A': zone = "USA"; region = 3; break; + case 'E': zone = "Europe"; region = 4; break; + case 'H': zone = "HK"; region = 5; break; + case 'P': zone = "Free"; region = 6; break; + case 'C': zone = "China"; region = 7; break; // clang-format on - } - - if (region <= 7) - { - zone = BiosZoneStrings[region]; - } - else - { - zone.clear(); - zone += romver[4]; + default: + zone.clear(); + zone += romver[4]; + break; } char vermaj[3] = {romver[0], romver[1], 0}; @@ -127,7 +120,6 @@ static bool LoadBiosVersion(std::FILE* fp, u32& version, std::string& descriptio version = strtol(vermaj, (char**)NULL, 0) << 8; version |= strtol(vermin, (char**)NULL, 0); foundRomVer = true; - BiosRegionOffset = fileOffset; Console.WriteLn("Bios Found: %s", description.c_str()); } @@ -295,13 +287,6 @@ bool LoadBIOS() ChecksumIt(BiosChecksum, eeMem->ROM); BiosPath = std::move(path); - // Patch the region - if (EmuConfig.PatchBios) - { - eeMem->ROM[BiosRegionOffset + 4] = EmuConfig.PatchRegion[0]; - Console.WriteLn("Patching ROM with region code %c", EmuConfig.PatchRegion[0]); - } - #ifndef PCSX2_CORE Console.SetTitle(StringUtil::StdStringFromFormat("Running BIOS (%s v%u.%u)", BiosZone.c_str(), BiosVersion >> 8, BiosVersion & 0xff).c_str()); diff --git a/pcsx2/ps2/BiosTools.h b/pcsx2/ps2/BiosTools.h index 6d8edbd7a5..60173bb998 100644 --- a/pcsx2/ps2/BiosTools.h +++ b/pcsx2/ps2/BiosTools.h @@ -28,24 +28,6 @@ struct BiosDebugInformation u32 threadListAddr; }; -// The following two arrays are used for Qt -[[maybe_unused]] static const char* BiosZoneStrings[] { - "T10K", - "Test", - "Japan", - "USA", - "Europe", - "HK", - "Free", - "China", - nullptr -}; - -[[maybe_unused]] static const char* BiosZoneBytes[] -{ - "T", "X", "J", "A", "E", "H", "P", "C", nullptr -}; - extern BiosDebugInformation CurrentBiosInformation; extern u32 BiosVersion; // Used by CDVD extern u32 BiosRegion; // Used by CDVD @@ -59,3 +41,4 @@ extern std::string BiosPath; extern bool LoadBIOS(); extern bool IsBIOS(const char* filename, u32& version, std::string& description, u32& region, std::string& zone); extern bool IsBIOSAvailable(const std::string& full_path); +