Revert "BiosTools: Allow BIOS region patching"

This reverts commit a4dcaa7c14.
This commit is contained in:
Ty Lamontagne 2022-09-16 20:56:40 -04:00 committed by refractionpcsx2
parent 4be34d3cf1
commit 9d58a1be8b
6 changed files with 16 additions and 89 deletions

View File

@ -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()

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>618</width>
<height>439</height>
<height>408</height>
</rect>
</property>
<property name="windowTitle">
@ -134,41 +134,14 @@
<property name="title">
<string>Options and Patches</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<widget class="QCheckBox" name="patchRegion">
<property name="text">
<string>Patch Region</string>
</property>
</widget>
</item>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="fastBoot">
<property name="text">
<string>Fast Boot</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="regionComboBox">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>

View File

@ -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];

View File

@ -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;

View File

@ -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());

View File

@ -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);