diff --git a/.gitignore b/.gitignore
index 0d160db..22ec668 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-## Ignore Visual Studio temporary files, build results, and
+## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from `dotnet new gitignore`
@@ -37,6 +37,7 @@ mono_crash.*
# Visual Studio 2015/2017 cache/options directory
**/.vs/
+
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
diff --git a/PS5 NOR Modifier Standalone.zip b/PS5 NOR Modifier Standalone.zip
deleted file mode 100644
index aa007f1..0000000
Binary files a/PS5 NOR Modifier Standalone.zip and /dev/null differ
diff --git a/PS5 NOR Modifier.sln b/PS5 NOR Modifier.sln
deleted file mode 100644
index 1cfcbf0..0000000
--- a/PS5 NOR Modifier.sln
+++ /dev/null
@@ -1,31 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.3.32901.215
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PS5 NOR Modifier", "PS5 NOR Modifier\PS5 NOR Modifier.csproj", "{BBBF9E78-9480-436A-92F1-B5B8943BCDEF}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|x86 = Debug|x86
- Release|Any CPU = Release|Any CPU
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {BBBF9E78-9480-436A-92F1-B5B8943BCDEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {BBBF9E78-9480-436A-92F1-B5B8943BCDEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {BBBF9E78-9480-436A-92F1-B5B8943BCDEF}.Debug|x86.ActiveCfg = Debug|x86
- {BBBF9E78-9480-436A-92F1-B5B8943BCDEF}.Debug|x86.Build.0 = Debug|x86
- {BBBF9E78-9480-436A-92F1-B5B8943BCDEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {BBBF9E78-9480-436A-92F1-B5B8943BCDEF}.Release|Any CPU.Build.0 = Release|Any CPU
- {BBBF9E78-9480-436A-92F1-B5B8943BCDEF}.Release|x86.ActiveCfg = Release|x86
- {BBBF9E78-9480-436A-92F1-B5B8943BCDEF}.Release|x86.Build.0 = Release|x86
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {406F6CF1-EBE8-4A32-86BA-26B4FEDF751B}
- EndGlobalSection
-EndGlobal
diff --git a/PS5 NOR Modifier/App.config b/PS5 NOR Modifier/App.config
deleted file mode 100644
index 9c3d200..0000000
--- a/PS5 NOR Modifier/App.config
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/PS5 NOR Modifier/Form1.Designer.cs b/PS5 NOR Modifier/Form1.Designer.cs
deleted file mode 100644
index 3889d30..0000000
--- a/PS5 NOR Modifier/Form1.Designer.cs
+++ /dev/null
@@ -1,843 +0,0 @@
-namespace PS5_NOR_Modifier
-{
- partial class Form1
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
- this.label1 = new System.Windows.Forms.Label();
- this.pictureBox1 = new System.Windows.Forms.PictureBox();
- this.label2 = new System.Windows.Forms.Label();
- this.pictureBox2 = new System.Windows.Forms.PictureBox();
- this.label4 = new System.Windows.Forms.Label();
- this.label5 = new System.Windows.Forms.Label();
- this.fileLocationBox = new System.Windows.Forms.TextBox();
- this.browseFileButton = new System.Windows.Forms.Button();
- this.label6 = new System.Windows.Forms.Label();
- this.label7 = new System.Windows.Forms.Label();
- this.label9 = new System.Windows.Forms.Label();
- this.label10 = new System.Windows.Forms.Label();
- this.serialNumber = new System.Windows.Forms.Label();
- this.modelInfo = new System.Windows.Forms.Label();
- this.fileSizeInfo = new System.Windows.Forms.Label();
- this.statusStrip1 = new System.Windows.Forms.StatusStrip();
- this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
- this.label8 = new System.Windows.Forms.Label();
- this.boardVariant = new System.Windows.Forms.Label();
- this.label11 = new System.Windows.Forms.Label();
- this.convertToDigitalEditionButton = new System.Windows.Forms.Button();
- this.boardVariantSelectionBox = new System.Windows.Forms.ComboBox();
- this.label12 = new System.Windows.Forms.Label();
- this.label13 = new System.Windows.Forms.Label();
- this.serialNumberTextbox = new System.Windows.Forms.TextBox();
- this.label14 = new System.Windows.Forms.Label();
- this.boardModelSelectionBox = new System.Windows.Forms.ComboBox();
- this.label15 = new System.Windows.Forms.Label();
- this.label16 = new System.Windows.Forms.Label();
- this.macAddressInfo = new System.Windows.Forms.Label();
- this.LANMacAddressInfo = new System.Windows.Forms.Label();
- this.label18 = new System.Windows.Forms.Label();
- this.moboSerialInfo = new System.Windows.Forms.Label();
- this.label19 = new System.Windows.Forms.Label();
- this.label17 = new System.Windows.Forms.Label();
- this.wifiMacAddressTextbox = new System.Windows.Forms.TextBox();
- this.lanMacAddressTextbox = new System.Windows.Forms.TextBox();
- this.label20 = new System.Windows.Forms.Label();
- this.tabControl1 = new System.Windows.Forms.TabControl();
- this.tabPage1 = new System.Windows.Forms.TabPage();
- this.tabPage2 = new System.Windows.Forms.TabPage();
- this.btnSendCommand = new System.Windows.Forms.Button();
- this.txtCustomCommand = new System.Windows.Forms.TextBox();
- this.label24 = new System.Windows.Forms.Label();
- this.chkUseOffline = new System.Windows.Forms.CheckBox();
- this.btnDownloadDatabase = new System.Windows.Forms.Button();
- this.btnRefreshPorts = new System.Windows.Forms.Button();
- this.button3 = new System.Windows.Forms.Button();
- this.txtUARTOutput = new System.Windows.Forms.TextBox();
- this.label22 = new System.Windows.Forms.Label();
- this.btnClearErrorCodes = new System.Windows.Forms.Button();
- this.label21 = new System.Windows.Forms.Label();
- this.button1 = new System.Windows.Forms.Button();
- this.comboComPorts = new System.Windows.Forms.ComboBox();
- this.btnDisconnectCom = new System.Windows.Forms.Button();
- this.btnConnectCom = new System.Windows.Forms.Button();
- this.label3 = new System.Windows.Forms.Label();
- this.label23 = new System.Windows.Forms.Label();
- this.label25 = new System.Windows.Forms.Label();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
- this.statusStrip1.SuspendLayout();
- this.tabControl1.SuspendLayout();
- this.tabPage1.SuspendLayout();
- this.tabPage2.SuspendLayout();
- this.SuspendLayout();
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(8, 84);
- this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(768, 45);
- this.label1.TabIndex = 0;
- this.label1.Text = resources.GetString("label1.Text");
- this.label1.Click += new System.EventHandler(this.label1_Click);
- //
- // pictureBox1
- //
- this.pictureBox1.Image = global::PS5_NOR_Modifier.Properties.Resources.PS5_Nor_Logo;
- this.pictureBox1.Location = new System.Drawing.Point(8, 7);
- this.pictureBox1.Margin = new System.Windows.Forms.Padding(2);
- this.pictureBox1.Name = "pictureBox1";
- this.pictureBox1.Size = new System.Drawing.Size(117, 75);
- this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
- this.pictureBox1.TabIndex = 1;
- this.pictureBox1.TabStop = false;
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Font = new System.Drawing.Font("Segoe UI", 22F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
- this.label2.Location = new System.Drawing.Point(140, 7);
- this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(277, 41);
- this.label2.TabIndex = 2;
- this.label2.Text = "PS5 NOR Modifier";
- //
- // pictureBox2
- //
- this.pictureBox2.Image = global::PS5_NOR_Modifier.Properties.Resources.Paypal_128;
- this.pictureBox2.Location = new System.Drawing.Point(8, 459);
- this.pictureBox2.Margin = new System.Windows.Forms.Padding(2);
- this.pictureBox2.Name = "pictureBox2";
- this.pictureBox2.Size = new System.Drawing.Size(45, 38);
- this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
- this.pictureBox2.TabIndex = 4;
- this.pictureBox2.TabStop = false;
- this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click);
- //
- // label4
- //
- this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(65, 459);
- this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(702, 30);
- this.label4.TabIndex = 5;
- this.label4.Text = resources.GetString("label4.Text");
- this.label4.Click += new System.EventHandler(this.label4_Click);
- //
- // label5
- //
- this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(5, 3);
- this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(102, 15);
- this.label5.TabIndex = 6;
- this.label5.Text = "Select NOR Dump";
- //
- // fileLocationBox
- //
- this.fileLocationBox.Location = new System.Drawing.Point(5, 20);
- this.fileLocationBox.Margin = new System.Windows.Forms.Padding(2);
- this.fileLocationBox.Name = "fileLocationBox";
- this.fileLocationBox.Size = new System.Drawing.Size(717, 23);
- this.fileLocationBox.TabIndex = 7;
- //
- // browseFileButton
- //
- this.browseFileButton.Location = new System.Drawing.Point(727, 19);
- this.browseFileButton.Margin = new System.Windows.Forms.Padding(2);
- this.browseFileButton.Name = "browseFileButton";
- this.browseFileButton.Size = new System.Drawing.Size(78, 20);
- this.browseFileButton.TabIndex = 8;
- this.browseFileButton.Text = "Browse";
- this.browseFileButton.UseVisualStyleBackColor = true;
- this.browseFileButton.Click += new System.EventHandler(this.browseFileButton_Click);
- //
- // label6
- //
- this.label6.AutoSize = true;
- this.label6.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
- this.label6.Location = new System.Drawing.Point(5, 49);
- this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(87, 15);
- this.label6.TabIndex = 9;
- this.label6.Text = "Dump Results:";
- //
- // label7
- //
- this.label7.AutoSize = true;
- this.label7.Location = new System.Drawing.Point(5, 72);
- this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(85, 15);
- this.label7.TabIndex = 10;
- this.label7.Text = "Serial Number:";
- //
- // label9
- //
- this.label9.AutoSize = true;
- this.label9.Location = new System.Drawing.Point(5, 159);
- this.label9.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(66, 15);
- this.label9.TabIndex = 12;
- this.label9.Text = "PS5 Model:";
- //
- // label10
- //
- this.label10.AutoSize = true;
- this.label10.Location = new System.Drawing.Point(5, 189);
- this.label10.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(51, 15);
- this.label10.TabIndex = 13;
- this.label10.Text = "File Size:";
- //
- // serialNumber
- //
- this.serialNumber.AutoSize = true;
- this.serialNumber.Location = new System.Drawing.Point(124, 72);
- this.serialNumber.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.serialNumber.Name = "serialNumber";
- this.serialNumber.Size = new System.Drawing.Size(16, 15);
- this.serialNumber.TabIndex = 14;
- this.serialNumber.Text = "...";
- //
- // modelInfo
- //
- this.modelInfo.AutoSize = true;
- this.modelInfo.Location = new System.Drawing.Point(124, 159);
- this.modelInfo.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.modelInfo.Name = "modelInfo";
- this.modelInfo.Size = new System.Drawing.Size(16, 15);
- this.modelInfo.TabIndex = 16;
- this.modelInfo.Text = "...";
- //
- // fileSizeInfo
- //
- this.fileSizeInfo.AutoSize = true;
- this.fileSizeInfo.Location = new System.Drawing.Point(124, 189);
- this.fileSizeInfo.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.fileSizeInfo.Name = "fileSizeInfo";
- this.fileSizeInfo.Size = new System.Drawing.Size(16, 15);
- this.fileSizeInfo.TabIndex = 17;
- this.fileSizeInfo.Text = "...";
- //
- // statusStrip1
- //
- this.statusStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
- this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.toolStripStatusLabel1});
- this.statusStrip1.Location = new System.Drawing.Point(0, 535);
- this.statusStrip1.Name = "statusStrip1";
- this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 10, 0);
- this.statusStrip1.Size = new System.Drawing.Size(847, 22);
- this.statusStrip1.TabIndex = 18;
- this.statusStrip1.Text = "statusStrip1";
- //
- // toolStripStatusLabel1
- //
- this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
- this.toolStripStatusLabel1.Size = new System.Drawing.Size(135, 17);
- this.toolStripStatusLabel1.Text = "Status: Waiting for input";
- //
- // label8
- //
- this.label8.AutoSize = true;
- this.label8.Location = new System.Drawing.Point(5, 130);
- this.label8.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(80, 15);
- this.label8.TabIndex = 20;
- this.label8.Text = "Board Variant:";
- //
- // boardVariant
- //
- this.boardVariant.AutoSize = true;
- this.boardVariant.Location = new System.Drawing.Point(124, 130);
- this.boardVariant.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.boardVariant.Name = "boardVariant";
- this.boardVariant.Size = new System.Drawing.Size(16, 15);
- this.boardVariant.TabIndex = 21;
- this.boardVariant.Text = "...";
- //
- // label11
- //
- this.label11.AutoSize = true;
- this.label11.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
- this.label11.Location = new System.Drawing.Point(393, 49);
- this.label11.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(84, 15);
- this.label11.TabIndex = 22;
- this.label11.Text = "Modify Values";
- //
- // convertToDigitalEditionButton
- //
- this.convertToDigitalEditionButton.Location = new System.Drawing.Point(655, 221);
- this.convertToDigitalEditionButton.Margin = new System.Windows.Forms.Padding(2);
- this.convertToDigitalEditionButton.Name = "convertToDigitalEditionButton";
- this.convertToDigitalEditionButton.Size = new System.Drawing.Size(150, 46);
- this.convertToDigitalEditionButton.TabIndex = 23;
- this.convertToDigitalEditionButton.Text = "Save New\r\nBIOS Information";
- this.convertToDigitalEditionButton.UseVisualStyleBackColor = true;
- this.convertToDigitalEditionButton.Click += new System.EventHandler(this.convertToDigitalEditionButton_Click);
- //
- // boardVariantSelectionBox
- //
- this.boardVariantSelectionBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.boardVariantSelectionBox.FormattingEnabled = true;
- this.boardVariantSelectionBox.Items.AddRange(new object[] {
- "CFI-1000A",
- "CFI-1000A01",
- "CFI-1000B",
- "CFI-1002A",
- "CFI-1008A",
- "CFI-1014A",
- "CFI-1015A",
- "CFI-1015B",
- "CFI-1016A",
- "CFI-1018A",
- "CFI-1100A01",
- "CFI-1102A",
- "CFI-1108A",
- "CFI-1109A",
- "CFI-1114A",
- "CFI-1115A",
- "CFI-1116A",
- "CFI-1118A",
- "CFI-1208A",
- "CFI-1215A",
- "CFI-1216A",
- "DFI-T1000AA",
- "DFI-D1000AA"});
- this.boardVariantSelectionBox.Location = new System.Drawing.Point(507, 98);
- this.boardVariantSelectionBox.Margin = new System.Windows.Forms.Padding(2);
- this.boardVariantSelectionBox.Name = "boardVariantSelectionBox";
- this.boardVariantSelectionBox.Size = new System.Drawing.Size(298, 23);
- this.boardVariantSelectionBox.TabIndex = 29;
- //
- // label12
- //
- this.label12.AutoSize = true;
- this.label12.Location = new System.Drawing.Point(393, 72);
- this.label12.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label12.Name = "label12";
- this.label12.Size = new System.Drawing.Size(85, 15);
- this.label12.TabIndex = 30;
- this.label12.Text = "Serial Number:";
- //
- // label13
- //
- this.label13.AutoSize = true;
- this.label13.Location = new System.Drawing.Point(393, 100);
- this.label13.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label13.Name = "label13";
- this.label13.Size = new System.Drawing.Size(80, 15);
- this.label13.TabIndex = 31;
- this.label13.Text = "Board Variant:";
- //
- // serialNumberTextbox
- //
- this.serialNumberTextbox.Location = new System.Drawing.Point(507, 70);
- this.serialNumberTextbox.Margin = new System.Windows.Forms.Padding(2);
- this.serialNumberTextbox.Name = "serialNumberTextbox";
- this.serialNumberTextbox.Size = new System.Drawing.Size(298, 23);
- this.serialNumberTextbox.TabIndex = 32;
- //
- // label14
- //
- this.label14.AutoSize = true;
- this.label14.Location = new System.Drawing.Point(393, 129);
- this.label14.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label14.Name = "label14";
- this.label14.Size = new System.Drawing.Size(66, 15);
- this.label14.TabIndex = 33;
- this.label14.Text = "PS5 Model:";
- //
- // boardModelSelectionBox
- //
- this.boardModelSelectionBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.boardModelSelectionBox.FormattingEnabled = true;
- this.boardModelSelectionBox.Items.AddRange(new object[] {
- "Digital Edition",
- "Disc Edition"});
- this.boardModelSelectionBox.Location = new System.Drawing.Point(507, 127);
- this.boardModelSelectionBox.Margin = new System.Windows.Forms.Padding(2);
- this.boardModelSelectionBox.Name = "boardModelSelectionBox";
- this.boardModelSelectionBox.Size = new System.Drawing.Size(298, 23);
- this.boardModelSelectionBox.TabIndex = 34;
- //
- // label15
- //
- this.label15.AutoSize = true;
- this.label15.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
- this.label15.Location = new System.Drawing.Point(65, 495);
- this.label15.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label15.Name = "label15";
- this.label15.Size = new System.Drawing.Size(387, 21);
- this.label15.TabIndex = 35;
- this.label15.Text = "This project is sponsored by www.consolefix.shop";
- this.label15.Click += new System.EventHandler(this.label15_Click);
- //
- // label16
- //
- this.label16.AutoSize = true;
- this.label16.Location = new System.Drawing.Point(5, 221);
- this.label16.Name = "label16";
- this.label16.Size = new System.Drawing.Size(104, 15);
- this.label16.TabIndex = 36;
- this.label16.Text = "WiFi Mac Address:";
- //
- // macAddressInfo
- //
- this.macAddressInfo.AutoSize = true;
- this.macAddressInfo.Location = new System.Drawing.Point(124, 221);
- this.macAddressInfo.Name = "macAddressInfo";
- this.macAddressInfo.Size = new System.Drawing.Size(16, 15);
- this.macAddressInfo.TabIndex = 37;
- this.macAddressInfo.Text = "...";
- //
- // LANMacAddressInfo
- //
- this.LANMacAddressInfo.AutoSize = true;
- this.LANMacAddressInfo.Location = new System.Drawing.Point(124, 252);
- this.LANMacAddressInfo.Name = "LANMacAddressInfo";
- this.LANMacAddressInfo.Size = new System.Drawing.Size(16, 15);
- this.LANMacAddressInfo.TabIndex = 39;
- this.LANMacAddressInfo.Text = "...";
- //
- // label18
- //
- this.label18.AutoSize = true;
- this.label18.Location = new System.Drawing.Point(5, 252);
- this.label18.Name = "label18";
- this.label18.Size = new System.Drawing.Size(104, 15);
- this.label18.TabIndex = 38;
- this.label18.Text = "LAN Mac Address:";
- //
- // moboSerialInfo
- //
- this.moboSerialInfo.AutoSize = true;
- this.moboSerialInfo.Location = new System.Drawing.Point(124, 101);
- this.moboSerialInfo.Name = "moboSerialInfo";
- this.moboSerialInfo.Size = new System.Drawing.Size(16, 15);
- this.moboSerialInfo.TabIndex = 41;
- this.moboSerialInfo.Text = "...";
- //
- // label19
- //
- this.label19.AutoSize = true;
- this.label19.Location = new System.Drawing.Point(5, 101);
- this.label19.Name = "label19";
- this.label19.Size = new System.Drawing.Size(111, 15);
- this.label19.TabIndex = 40;
- this.label19.Text = "Motherboard Serial:";
- //
- // label17
- //
- this.label17.AutoSize = true;
- this.label17.Location = new System.Drawing.Point(393, 159);
- this.label17.Name = "label17";
- this.label17.Size = new System.Drawing.Size(108, 15);
- this.label17.TabIndex = 42;
- this.label17.Text = "WiFi MAC Address:";
- //
- // wifiMacAddressTextbox
- //
- this.wifiMacAddressTextbox.Enabled = false;
- this.wifiMacAddressTextbox.Location = new System.Drawing.Point(507, 156);
- this.wifiMacAddressTextbox.Name = "wifiMacAddressTextbox";
- this.wifiMacAddressTextbox.Size = new System.Drawing.Size(298, 23);
- this.wifiMacAddressTextbox.TabIndex = 43;
- //
- // lanMacAddressTextbox
- //
- this.lanMacAddressTextbox.Enabled = false;
- this.lanMacAddressTextbox.Location = new System.Drawing.Point(507, 185);
- this.lanMacAddressTextbox.Name = "lanMacAddressTextbox";
- this.lanMacAddressTextbox.Size = new System.Drawing.Size(298, 23);
- this.lanMacAddressTextbox.TabIndex = 44;
- //
- // label20
- //
- this.label20.AutoSize = true;
- this.label20.Location = new System.Drawing.Point(393, 188);
- this.label20.Name = "label20";
- this.label20.Size = new System.Drawing.Size(104, 15);
- this.label20.TabIndex = 45;
- this.label20.Text = "LAN Mac Address:";
- //
- // tabControl1
- //
- this.tabControl1.Controls.Add(this.tabPage1);
- this.tabControl1.Controls.Add(this.tabPage2);
- this.tabControl1.Location = new System.Drawing.Point(12, 132);
- this.tabControl1.Name = "tabControl1";
- this.tabControl1.SelectedIndex = 0;
- this.tabControl1.Size = new System.Drawing.Size(821, 311);
- this.tabControl1.TabIndex = 46;
- //
- // tabPage1
- //
- this.tabPage1.Controls.Add(this.label5);
- this.tabPage1.Controls.Add(this.label20);
- this.tabPage1.Controls.Add(this.fileLocationBox);
- this.tabPage1.Controls.Add(this.lanMacAddressTextbox);
- this.tabPage1.Controls.Add(this.browseFileButton);
- this.tabPage1.Controls.Add(this.wifiMacAddressTextbox);
- this.tabPage1.Controls.Add(this.label6);
- this.tabPage1.Controls.Add(this.label17);
- this.tabPage1.Controls.Add(this.label7);
- this.tabPage1.Controls.Add(this.moboSerialInfo);
- this.tabPage1.Controls.Add(this.label9);
- this.tabPage1.Controls.Add(this.label19);
- this.tabPage1.Controls.Add(this.label10);
- this.tabPage1.Controls.Add(this.LANMacAddressInfo);
- this.tabPage1.Controls.Add(this.serialNumber);
- this.tabPage1.Controls.Add(this.label18);
- this.tabPage1.Controls.Add(this.modelInfo);
- this.tabPage1.Controls.Add(this.macAddressInfo);
- this.tabPage1.Controls.Add(this.fileSizeInfo);
- this.tabPage1.Controls.Add(this.label16);
- this.tabPage1.Controls.Add(this.label8);
- this.tabPage1.Controls.Add(this.boardVariant);
- this.tabPage1.Controls.Add(this.boardModelSelectionBox);
- this.tabPage1.Controls.Add(this.label11);
- this.tabPage1.Controls.Add(this.label14);
- this.tabPage1.Controls.Add(this.convertToDigitalEditionButton);
- this.tabPage1.Controls.Add(this.serialNumberTextbox);
- this.tabPage1.Controls.Add(this.boardVariantSelectionBox);
- this.tabPage1.Controls.Add(this.label13);
- this.tabPage1.Controls.Add(this.label12);
- this.tabPage1.Location = new System.Drawing.Point(4, 24);
- this.tabPage1.Name = "tabPage1";
- this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
- this.tabPage1.Size = new System.Drawing.Size(813, 283);
- this.tabPage1.TabIndex = 0;
- this.tabPage1.Text = "NOR Modifier";
- this.tabPage1.UseVisualStyleBackColor = true;
- //
- // tabPage2
- //
- this.tabPage2.Controls.Add(this.label25);
- this.tabPage2.Controls.Add(this.btnSendCommand);
- this.tabPage2.Controls.Add(this.txtCustomCommand);
- this.tabPage2.Controls.Add(this.label24);
- this.tabPage2.Controls.Add(this.chkUseOffline);
- this.tabPage2.Controls.Add(this.btnDownloadDatabase);
- this.tabPage2.Controls.Add(this.btnRefreshPorts);
- this.tabPage2.Controls.Add(this.button3);
- this.tabPage2.Controls.Add(this.txtUARTOutput);
- this.tabPage2.Controls.Add(this.label22);
- this.tabPage2.Controls.Add(this.btnClearErrorCodes);
- this.tabPage2.Controls.Add(this.label21);
- this.tabPage2.Controls.Add(this.button1);
- this.tabPage2.Controls.Add(this.comboComPorts);
- this.tabPage2.Controls.Add(this.btnDisconnectCom);
- this.tabPage2.Controls.Add(this.btnConnectCom);
- this.tabPage2.Controls.Add(this.label3);
- this.tabPage2.Location = new System.Drawing.Point(4, 24);
- this.tabPage2.Name = "tabPage2";
- this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
- this.tabPage2.Size = new System.Drawing.Size(813, 283);
- this.tabPage2.TabIndex = 1;
- this.tabPage2.Text = "UART Communication";
- this.tabPage2.UseVisualStyleBackColor = true;
- //
- // btnSendCommand
- //
- this.btnSendCommand.Location = new System.Drawing.Point(732, 125);
- this.btnSendCommand.Name = "btnSendCommand";
- this.btnSendCommand.Size = new System.Drawing.Size(75, 23);
- this.btnSendCommand.TabIndex = 16;
- this.btnSendCommand.Text = "Send";
- this.btnSendCommand.UseVisualStyleBackColor = true;
- this.btnSendCommand.Click += new System.EventHandler(this.btnSendCommand_Click);
- //
- // txtCustomCommand
- //
- this.txtCustomCommand.Location = new System.Drawing.Point(610, 96);
- this.txtCustomCommand.Name = "txtCustomCommand";
- this.txtCustomCommand.Size = new System.Drawing.Size(197, 23);
- this.txtCustomCommand.TabIndex = 15;
- this.txtCustomCommand.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtCustomCommand_KeyPress);
- //
- // label24
- //
- this.label24.AutoSize = true;
- this.label24.Location = new System.Drawing.Point(610, 78);
- this.label24.Name = "label24";
- this.label24.Size = new System.Drawing.Size(186, 15);
- this.label24.TabIndex = 14;
- this.label24.Text = "Send custom command via UART:";
- //
- // chkUseOffline
- //
- this.chkUseOffline.AutoSize = true;
- this.chkUseOffline.Location = new System.Drawing.Point(472, 47);
- this.chkUseOffline.Name = "chkUseOffline";
- this.chkUseOffline.Size = new System.Drawing.Size(132, 19);
- this.chkUseOffline.TabIndex = 13;
- this.chkUseOffline.Text = "Use offline database";
- this.chkUseOffline.UseVisualStyleBackColor = true;
- //
- // btnDownloadDatabase
- //
- this.btnDownloadDatabase.Location = new System.Drawing.Point(310, 44);
- this.btnDownloadDatabase.Name = "btnDownloadDatabase";
- this.btnDownloadDatabase.Size = new System.Drawing.Size(156, 23);
- this.btnDownloadDatabase.TabIndex = 12;
- this.btnDownloadDatabase.Text = "Download Error Database";
- this.btnDownloadDatabase.UseVisualStyleBackColor = true;
- this.btnDownloadDatabase.Click += new System.EventHandler(this.btnDownloadDatabase_Click);
- //
- // btnRefreshPorts
- //
- this.btnRefreshPorts.Location = new System.Drawing.Point(515, 13);
- this.btnRefreshPorts.Name = "btnRefreshPorts";
- this.btnRefreshPorts.Size = new System.Drawing.Size(89, 23);
- this.btnRefreshPorts.TabIndex = 11;
- this.btnRefreshPorts.Text = "Refresh Ports";
- this.btnRefreshPorts.UseVisualStyleBackColor = true;
- this.btnRefreshPorts.Click += new System.EventHandler(this.btnRefreshPorts_Click);
- //
- // button3
- //
- this.button3.Location = new System.Drawing.Point(448, 254);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(156, 23);
- this.button3.TabIndex = 10;
- this.button3.Text = "Clear Output Window";
- this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // txtUARTOutput
- //
- this.txtUARTOutput.Location = new System.Drawing.Point(73, 78);
- this.txtUARTOutput.Multiline = true;
- this.txtUARTOutput.Name = "txtUARTOutput";
- this.txtUARTOutput.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
- this.txtUARTOutput.Size = new System.Drawing.Size(531, 170);
- this.txtUARTOutput.TabIndex = 9;
- //
- // label22
- //
- this.label22.AutoSize = true;
- this.label22.Location = new System.Drawing.Point(6, 78);
- this.label22.Name = "label22";
- this.label22.Size = new System.Drawing.Size(48, 15);
- this.label22.TabIndex = 8;
- this.label22.Text = "Output:";
- //
- // btnClearErrorCodes
- //
- this.btnClearErrorCodes.Location = new System.Drawing.Point(186, 44);
- this.btnClearErrorCodes.Name = "btnClearErrorCodes";
- this.btnClearErrorCodes.Size = new System.Drawing.Size(118, 23);
- this.btnClearErrorCodes.TabIndex = 7;
- this.btnClearErrorCodes.Text = "Clear Error Codes";
- this.btnClearErrorCodes.UseVisualStyleBackColor = true;
- this.btnClearErrorCodes.Click += new System.EventHandler(this.btnClearErrorCodes_Click);
- //
- // label21
- //
- this.label21.AutoSize = true;
- this.label21.Location = new System.Drawing.Point(6, 48);
- this.label21.Name = "label21";
- this.label21.Size = new System.Drawing.Size(52, 15);
- this.label21.TabIndex = 6;
- this.label21.Text = "Options:";
- //
- // button1
- //
- this.button1.Location = new System.Drawing.Point(73, 44);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(107, 23);
- this.button1.TabIndex = 5;
- this.button1.Text = "Get Error Codes";
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // comboComPorts
- //
- this.comboComPorts.FormattingEnabled = true;
- this.comboComPorts.Location = new System.Drawing.Point(73, 13);
- this.comboComPorts.Name = "comboComPorts";
- this.comboComPorts.Size = new System.Drawing.Size(274, 23);
- this.comboComPorts.TabIndex = 4;
- //
- // btnDisconnectCom
- //
- this.btnDisconnectCom.Location = new System.Drawing.Point(434, 13);
- this.btnDisconnectCom.Name = "btnDisconnectCom";
- this.btnDisconnectCom.Size = new System.Drawing.Size(75, 23);
- this.btnDisconnectCom.TabIndex = 3;
- this.btnDisconnectCom.Text = "Disconnect";
- this.btnDisconnectCom.UseVisualStyleBackColor = true;
- this.btnDisconnectCom.Click += new System.EventHandler(this.btnDisconnectCom_Click);
- //
- // btnConnectCom
- //
- this.btnConnectCom.Location = new System.Drawing.Point(353, 12);
- this.btnConnectCom.Name = "btnConnectCom";
- this.btnConnectCom.Size = new System.Drawing.Size(75, 23);
- this.btnConnectCom.TabIndex = 2;
- this.btnConnectCom.Text = "Connect";
- this.btnConnectCom.UseVisualStyleBackColor = true;
- this.btnConnectCom.Click += new System.EventHandler(this.btnConnectCom_Click);
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(6, 16);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(61, 15);
- this.label3.TabIndex = 0;
- this.label3.Text = "Com Port:";
- //
- // label23
- //
- this.label23.AutoSize = true;
- this.label23.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point);
- this.label23.Location = new System.Drawing.Point(193, 48);
- this.label23.Name = "label23";
- this.label23.Size = new System.Drawing.Size(215, 15);
- this.label23.TabIndex = 47;
- this.label23.Text = "and UART stuff too... BwE can SUCK IT!";
- //
- // label25
- //
- this.label25.AutoSize = true;
- this.label25.Location = new System.Drawing.Point(610, 151);
- this.label25.Name = "label25";
- this.label25.Size = new System.Drawing.Size(198, 105);
- this.label25.TabIndex = 17;
- this.label25.Text = resources.GetString("label25.Text");
- //
- // Form1
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.White;
- this.ClientSize = new System.Drawing.Size(847, 557);
- this.Controls.Add(this.label23);
- this.Controls.Add(this.tabControl1);
- this.Controls.Add(this.label15);
- this.Controls.Add(this.statusStrip1);
- this.Controls.Add(this.label4);
- this.Controls.Add(this.pictureBox2);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.pictureBox1);
- this.Controls.Add(this.label1);
- this.Margin = new System.Windows.Forms.Padding(2);
- this.Name = "Form1";
- this.Text = "PS5 NOR Modifier";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
- this.Load += new System.EventHandler(this.Form1_Load);
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
- this.statusStrip1.ResumeLayout(false);
- this.statusStrip1.PerformLayout();
- this.tabControl1.ResumeLayout(false);
- this.tabPage1.ResumeLayout(false);
- this.tabPage1.PerformLayout();
- this.tabPage2.ResumeLayout(false);
- this.tabPage2.PerformLayout();
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private Label label1;
- private PictureBox pictureBox1;
- private Label label2;
- private PictureBox pictureBox2;
- private Label label4;
- private Label label5;
- private TextBox fileLocationBox;
- private Button browseFileButton;
- private Label label6;
- private Label label7;
- private Label label9;
- private Label label10;
- private Label serialNumber;
- private Label modelInfo;
- private Label fileSizeInfo;
- private StatusStrip statusStrip1;
- private ToolStripStatusLabel toolStripStatusLabel1;
- private Label label8;
- private Label boardVariant;
- private Label label11;
- private Button convertToDigitalEditionButton;
- private ComboBox boardVariantSelectionBox;
- private Label label12;
- private Label label13;
- private TextBox serialNumberTextbox;
- private Label label14;
- private ComboBox boardModelSelectionBox;
- private Label label15;
- private Label label16;
- private Label macAddressInfo;
- private Label LANMacAddressInfo;
- private Label label18;
- private Label moboSerialInfo;
- private Label label19;
- private Label label17;
- private TextBox wifiMacAddressTextbox;
- private TextBox lanMacAddressTextbox;
- private Label label20;
- private TabControl tabControl1;
- private TabPage tabPage1;
- private TabPage tabPage2;
- private Button button3;
- private TextBox txtUARTOutput;
- private Label label22;
- private Button btnClearErrorCodes;
- private Label label21;
- private Button button1;
- private ComboBox comboComPorts;
- private Button btnDisconnectCom;
- private Button btnConnectCom;
- private Label label3;
- private Button btnRefreshPorts;
- private Label label23;
- private Button btnDownloadDatabase;
- private CheckBox chkUseOffline;
- private Button btnSendCommand;
- private TextBox txtCustomCommand;
- private Label label24;
- private Label label25;
- }
-}
\ No newline at end of file
diff --git a/PS5 NOR Modifier/Form1.cs b/PS5 NOR Modifier/Form1.cs
deleted file mode 100644
index 8f6dec8..0000000
--- a/PS5 NOR Modifier/Form1.cs
+++ /dev/null
@@ -1,1159 +0,0 @@
-using System.Diagnostics;
-using System.Globalization;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Windows.Forms;
-using System.IO.Ports;
-using System;
-using System.Threading;
-using System.Collections.Generic;
-using static System.Windows.Forms.LinkLabel;
-using static System.Windows.Forms.VisualStyles.VisualStyleElement;
-using System.Net;
-using System.Xml;
-using System.Security.Policy;
-
-namespace PS5_NOR_Modifier
-{
- public partial class Form1 : Form
- {
-
- public Form1()
- {
- InitializeComponent();
- }
-
- static string CalculateChecksum(string str)
- {
- int sum = 0;
- foreach (char c in str)
- {
- sum += (int)c;
- }
- return str + ":" + (sum & 0xFF).ToString("X2");
- }
-
- private void throwError(string errmsg)
- {
- MessageBox.Show(errmsg, "An Error Has Occurred", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
-
- // We want this app to work offline, so let's declare where the local "offline" database will be stored
- string localDatabaseFile = "errorDB.xml";
-
- static SerialPort UARTSerial = new SerialPort();
-
- ///
- /// With thanks to @jjxtra on Github. The code has already been created and there's no need to reinvent the wheel is there?
- ///
- #region Hex Code
-
- private static IEnumerable PatternAt(byte[] source, byte[] pattern)
- {
- for (int i = 0; i < source.Length; i++)
- {
- if (source.Skip(i).Take(pattern.Length).SequenceEqual(pattern))
- {
- yield return i;
- }
- }
- }
-
- private static byte[] ConvertHexStringToByteArray(string hexString)
- {
- if (hexString.Length % 2 != 0)
- {
- throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, "The binary key cannot have an odd number of digits: {0}", hexString));
- }
-
- byte[] data = new byte[hexString.Length / 2];
- for (int index = 0; index < data.Length; index++)
- {
- string byteValue = hexString.Substring(index * 2, 2);
- data[index] = byte.Parse(byteValue, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
- }
-
- return data;
- }
-
- #endregion
-
- private void Form1_Load(object sender, EventArgs e)
- {
- // Upon first launch, we need to get a list of COM ports available for UART
- string[] ports = SerialPort.GetPortNames();
- comboComPorts.Items.Clear();
- comboComPorts.Items.AddRange(ports);
- comboComPorts.SelectedIndex = 0;
- btnConnectCom.Enabled = true;
- btnDisconnectCom.Enabled = false;
- }
-
- // Declare offsets to detect console version
- long offsetOne = 0x1c7010;
- long offsetTwo = 0x1c7030;
- long WiFiMacOffset = 0x1C73C0;
- string? WiFiMacValue = null;
- long LANMacOffset = 0x1C4020;
- string? LANMacValue = null;
- string? offsetOneValue = null;
- string? offsetTwoValue = null;
- long serialOffset = 0x1c7210;
- string? serialValue = null;
- long variantOffset = 0x1c7226;
- string? variantValue = null;
- long moboSerialOffset = 0x1C7200;
- string? moboSerialValue = null;
-
- private async Task DownloadDatabaseAsync()
- {
- // Define the URL
- string url = "http://uartcodes.com/xml.php"; // Update with your URL
-
- // Define the file path to save the XML
-
- try
- {
- // Create a WebClient instance
- using (HttpClient client = new())
- {
- // Download the XML data from the URL
- string xmlData = await client.GetStringAsync(url);
-
- // Create an XmlDocument instance and load the XML data
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.LoadXml(xmlData);
-
- // Save the XML data to a file
- xmlDoc.Save(localDatabaseFile);
-
- MessageBox.Show("The most recent offline database has been updated successfully.", "Offline Database Updated!", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine("Error: " + ex.Message);
- }
- }
-
- ///
- /// We need to be able to send the error code we received from the console and fetch an XML result back from the server
- /// Once we have a result from the server, parse the XML data and output it in an easy to understand format for the user
- ///
- ///
- ///
- async Task ParseErrorsAsync(string ErrorCode)
- {
- // If the user has opted to parse errors with an offline database, run the parse offline function
- if (chkUseOffline.Checked == true)
- {
- return ParseErrorsOffline(ErrorCode);
- }
- else
- {
- // The user wants to use the online version. Proceed at will
-
- // Define the URL with the error code parameter
- string url = "http://uartcodes.com/xml.php?errorCode=" + ErrorCode;
-
- string results = "";
-
- try
- {
- string response = "";
- // Create a WebClient instance to send the request
- using (HttpClient client = new())
- {
- // Send the request and retrieve the response as a string
- response = await client.GetStringAsync(url);
- }
- // Load the XML response into an XmlDocument
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.LoadXml(response);
-
-
- // Get the root node
- XmlNode? root = xmlDoc.DocumentElement;
- if (root is null) {
- throw new Exception("Error reading the file");
- }
-
- // Check if the root node is
- if (root.Name == "errorCodes")
- {
- // Loop through each errorCode node
- foreach (XmlNode errorCodeNode in root.ChildNodes)
- {
- // Check if the node is
- if (errorCodeNode.Name == "errorCode")
- {
- // Get ErrorCode and Description
- string errorCode = errorCodeNode.SelectSingleNode("ErrorCode")?.InnerText ?? "";
- string description = errorCodeNode.SelectSingleNode("Description")?.InnerText??"";
-
- // Output the results
- results = "Error code: "
- + errorCode
- + Environment.NewLine
- + "Description: "
- + description;
- }
- }
- }
- else
- {
- results = "Error code: "
- + ErrorCode
- + Environment.NewLine
- + "An error occurred while fetching a result for this error. Please try again!";
- }
- }
- catch (Exception ex)
- {
- results = "Error code: "
- + ErrorCode
- + Environment.NewLine
- + ex.Message;
- }
- return results;
- }
- }
-
- string ParseErrorsOffline(string errorCode)
- {
- string results = "";
-
- try
- {
- // Check if the XML file exists
- if (File.Exists(localDatabaseFile))
- {
- // Load the XML file
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.Load(localDatabaseFile);
-
- // Get the root node
- XmlNode? root = xmlDoc.DocumentElement;
- if (root is null) return results;
-
- // Check if the root node is
- if (root.Name == "errorCodes")
- {
- // Loop through each errorCode node
- foreach (XmlNode errorCodeNode in root.ChildNodes)
- {
- // Check if the node is
- if (errorCodeNode.Name == "errorCode")
- {
- // Get ErrorCode and Description
- string errorCodeValue = errorCodeNode.SelectSingleNode("ErrorCode")?.InnerText??"";
- string description = errorCodeNode.SelectSingleNode("Description")?.InnerText??"";
-
- // Check if the current error code matches the requested error code
- if (errorCodeValue == errorCode)
- {
- // Output the results
- results = "Error code: " + errorCodeValue + Environment.NewLine + "Description: " + description;
- break; // Exit the loop after finding the matching error code
- }
- }
- }
- }
- else
- {
- results = "Error: Invalid XML database file. Please reconfigure the application, redownload the offline database, or uncheck the option to use the offline database.";
- }
- }
- else
- {
- results = "Error: Local XML file not found.";
- }
- }
- catch (Exception ex)
- {
- results = "Error: " + ex.Message;
- }
-
- return results;
- }
-
- string HexStringToString(string hexString)
- {
- if (hexString == null || (hexString.Length & 1) == 1)
- {
- throw new ArgumentException();
- }
- var sb = new StringBuilder();
- for (var i = 0; i < hexString.Length; i += 2)
- {
- var hexChar = hexString.Substring(i, 2);
- sb.Append((char)Convert.ToByte(hexChar, 16));
- }
- return sb.ToString();
- }
-
- ///
- /// Lauinches a URL in a new window using the default browser...
- ///
- /// The URL you want to launch
- private void OpenUrl(string url)
- {
- try
- {
- Process.Start(url);
- }
- catch
- {
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- url = url.Replace("&", "^&");
- Process.Start(new ProcessStartInfo(url) { UseShellExecute = true });
- }
- else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
- {
- Process.Start("xdg-open", url);
- }
- else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
- {
- Process.Start("open", url);
- }
- else
- {
- throw;
- }
- }
- }
-
- private void ResetAppFields()
- {
- fileLocationBox.Text = "";
- serialNumber.Text = "...";
- boardVariant.Text = "...";
- modelInfo.Text = "...";
- fileSizeInfo.Text = "...";
- serialNumberTextbox.Text = "";
- toolStripStatusLabel1.Text = "Status: Waiting for input";
- }
-
- #region Donations
-
- ///
- /// If you modify this app, please leave my credits in, otherwise a little kitten will cry!
- ///
- ///
- ///
- private void label4_Click(object sender, EventArgs e)
- {
- OpenUrl("https://www.streamelements.com/thecod3r/tip");
- }
-
- private void pictureBox2_Click(object sender, EventArgs e)
- {
- OpenUrl("https://www.streamelements.com/thecod3r/tip");
- }
-
-
- #endregion
-
- private void browseFileButton_Click(object sender, EventArgs e)
- {
- OpenFileDialog fileDialogBox = new OpenFileDialog();
- fileDialogBox.Title = "Open NOR BIN File";
- fileDialogBox.Filter = "PS5 BIN Files|*.bin";
-
- if (fileDialogBox.ShowDialog() == DialogResult.OK)
- {
- if(fileDialogBox.CheckFileExists == false)
- {
- throwError("The file you selected could not be found. Please check the file exists and is a valid BIN file.");
- }
- else
- {
- if(!fileDialogBox.SafeFileName.EndsWith(".bin"))
- {
- throwError("The file you selected is not a valid. Please ensure the file you are choosing is a correct BIN file and try again.");
- }
- else
- {
- // Let's load simple information first, before loading BIN specific data
- fileLocationBox.Text = "";
- // Get the path selected and print it into the path box
- string selectedPath = fileDialogBox.FileName;
- toolStripStatusLabel1.Text = "Status: Selected file " + selectedPath;
- fileLocationBox.Text = selectedPath;
-
- // Get file length and show in bytes and MB
- long length = new System.IO.FileInfo(selectedPath).Length;
- fileSizeInfo.Text = length.ToString() + " bytes (" + length / 1024 / 1024 + "MB)";
-
- #region Extract PS5 Version
-
- try
- {
- BinaryReader reader = new BinaryReader(new FileStream(fileDialogBox.FileName, FileMode.Open));
- //Set the position of the reader
- reader.BaseStream.Position = offsetOne;
- //Read the offset
- offsetOneValue = BitConverter.ToString(reader.ReadBytes(12)).Replace("-", null);
- reader.Close();
- }
- catch
- {
- // Obviously this value is invalid, so null the value and move on
- offsetOneValue = null;
- }
-
- try
- {
- BinaryReader reader = new BinaryReader(new FileStream(fileDialogBox.FileName, FileMode.Open));
- //Set the position of the reader
- reader.BaseStream.Position = offsetOne;
- //Read the offset
- offsetTwoValue = BitConverter.ToString(reader.ReadBytes(12)).Replace("-", null);
- reader.Close();
- }
- catch
- {
- // Obviously this value is invalid, so null the value and move on
- offsetTwoValue = null;
- }
-
-
- if(offsetOneValue?.Contains("22020101")??false)
- {
- modelInfo.Text = "Disc Edition";
- }
- else
- {
- if(offsetTwoValue?.Contains("22030101") ?? false)
- {
- modelInfo.Text = "Digital Edition";
- }
- else
- {
- modelInfo.Text = "Unknown";
- }
- }
-
- #endregion
-
- #region Extract Motherboard Serial Number
-
- try
- {
- BinaryReader reader = new BinaryReader(new FileStream(fileDialogBox.FileName, FileMode.Open));
- //Set the position of the reader
- reader.BaseStream.Position = moboSerialOffset;
- //Read the offset
- moboSerialValue = BitConverter.ToString(reader.ReadBytes(16)).Replace("-", null);
- reader.Close();
- }
- catch
- {
- // Obviously this value is invalid, so null the value and move on
- moboSerialValue = null;
- }
-
-
-
- if(moboSerialValue != null)
- {
- moboSerialInfo.Text = HexStringToString(moboSerialValue);
- }
- else
- {
- moboSerialInfo.Text = "Unknown";
- }
-
- #endregion
-
- #region Extract Board Serial Number
-
- try
- {
- BinaryReader reader = new BinaryReader(new FileStream(fileDialogBox.FileName, FileMode.Open));
- //Set the position of the reader
- reader.BaseStream.Position = serialOffset;
- //Read the offset
- serialValue = BitConverter.ToString(reader.ReadBytes(17)).Replace("-", null);
- reader.Close();
- }
- catch
- {
- // Obviously this value is invalid, so null the value and move on
- serialValue = null;
- }
-
-
-
- if (serialValue != null)
- {
- serialNumber.Text = HexStringToString(serialValue);
- serialNumberTextbox.Text = HexStringToString(serialValue);
-
- }
- else
- {
- serialNumber.Text = "Unknown";
- }
-
- #endregion
-
- #region Extract WiFi Mac Address
-
- try
- {
- BinaryReader reader = new BinaryReader(new FileStream(fileDialogBox.FileName, FileMode.Open));
- //Set the position of the reader
- reader.BaseStream.Position = WiFiMacOffset;
- //Read the offset
- WiFiMacValue = BitConverter.ToString(reader.ReadBytes(6));
- reader.Close();
- }
- catch
- {
- // Obviously this value is invalid, so null the value and move on
- WiFiMacValue = null;
- }
-
- if (WiFiMacValue != null)
- {
- macAddressInfo.Text = WiFiMacValue;
- wifiMacAddressTextbox.Text = WiFiMacValue;
- }
- else
- {
- macAddressInfo.Text = "Unknown";
- wifiMacAddressTextbox.Text = "";
- }
-
- #endregion
-
- #region Extract LAN Mac Address
-
- try
- {
- BinaryReader reader = new BinaryReader(new FileStream(fileDialogBox.FileName, FileMode.Open));
- //Set the position of the reader
- reader.BaseStream.Position = LANMacOffset;
- //Read the offset
- LANMacValue = BitConverter.ToString(reader.ReadBytes(6));
- reader.Close();
- }
- catch
- {
- // Obviously this value is invalid, so null the value and move on
- LANMacValue = null;
- }
-
- if (LANMacValue != null)
- {
- LANMacAddressInfo.Text = LANMacValue;
- lanMacAddressTextbox.Text = LANMacValue;
- }
- else
- {
- LANMacAddressInfo.Text = "Unknown";
- lanMacAddressTextbox.Text = "";
- }
-
- #endregion
-
- #region Extract Board Variant
-
- try
- {
- BinaryReader reader = new BinaryReader(new FileStream(fileDialogBox.FileName, FileMode.Open));
- //Set the position of the reader
- reader.BaseStream.Position = variantOffset;
- //Read the offset
- variantValue = BitConverter.ToString(reader.ReadBytes(19)).Replace("-", null).Replace("FF", null);
- reader.Close();
- }
- catch
- {
- // Obviously this value is invalid, so null the value and move on
- variantValue = null;
- }
-
-
-
- if (variantValue != null)
- {
- boardVariant.Text = HexStringToString(variantValue);
- }
- else
- {
- boardVariant.Text = "Unknown";
- }
-
- boardVariant.Text += boardVariant.Text switch {
- _ when boardVariant.Text.EndsWith("00A") || boardVariant.Text.EndsWith("00B") => " - Japan",
- _ when boardVariant.Text.EndsWith("01A") || boardVariant.Text.EndsWith("01B") ||
- boardVariant.Text.EndsWith("15A") || boardVariant.Text.EndsWith("15B") => " - US, Canada, (North America)",
- _ when boardVariant.Text.EndsWith("02A") || boardVariant.Text.EndsWith("02B") => " - Australia / New Zealand, (Oceania)",
- _ when boardVariant.Text.EndsWith("03A") || boardVariant.Text.EndsWith("03B") => " - United Kingdom / Ireland",
- _ when boardVariant.Text.EndsWith("04A") || boardVariant.Text.EndsWith("04B") => " - Europe / Middle East / Africa",
- _ when boardVariant.Text.EndsWith("05A") || boardVariant.Text.EndsWith("05B") => " - South Korea",
- _ when boardVariant.Text.EndsWith("06A") || boardVariant.Text.EndsWith("06B") => " - Southeast Asia / Hong Kong",
- _ when boardVariant.Text.EndsWith("07A") || boardVariant.Text.EndsWith("07B") => " - Taiwan",
- _ when boardVariant.Text.EndsWith("08A") || boardVariant.Text.EndsWith("08B") => " - Russia, Ukraine, India, Central Asia",
- _ when boardVariant.Text.EndsWith("09A") || boardVariant.Text.EndsWith("09B") => " - Mainland China",
- _ when boardVariant.Text.EndsWith("11A") || boardVariant.Text.EndsWith("11B") ||
- boardVariant.Text.EndsWith("14A") || boardVariant.Text.EndsWith("14B")
- => " - Mexico, Central America, South America",
- _ when boardVariant.Text.EndsWith("16A") || boardVariant.Text.EndsWith("16B") => " - Europe / Middle East / Africa",
- _ when boardVariant.Text.EndsWith("18A") || boardVariant.Text.EndsWith("18B") => " - Singapore, Korea, Asia",
- _=> " - Unknown Region"
- };
- #endregion
- }
- }
- }
- }
-
- private void convertToDigitalEditionButton_Click(object sender, EventArgs e)
- {
-
- string fileNameToLookFor = "";
- bool errorShownAlready = false;
-
- if (modelInfo.Text == "" || modelInfo.Text == "...")
- {
- // No valid BIN file seems to have been selected
- throwError("Please select a valid BIOS file first...");
- errorShownAlready = true;
- }
- else
- {
- if(boardModelSelectionBox.Text == "")
- {
- throwError("Please select a valid board model before saving new BIOS information!");
- errorShownAlready = true;
- }
- else
- {
- if(boardVariantSelectionBox.Text == "")
- {
- throwError("Please select a valid board variant before saving new BIOS information!");
- errorShownAlready = true;
- }
- else
- {
- SaveFileDialog saveBox = new SaveFileDialog();
- saveBox.Title = "Save NOR BIN File";
- saveBox.Filter = "PS5 BIN Files|*.bin";
-
- if (saveBox.ShowDialog() == DialogResult.OK)
- {
- // First create a copy of the old BIOS file
- byte[] existingFile = File.ReadAllBytes(fileLocationBox.Text);
- string newFile = saveBox.FileName;
-
- File.WriteAllBytes(newFile, existingFile);
-
- fileNameToLookFor = saveBox.FileName;
-
- #region Set the new model info
- if (modelInfo.Text == "Disc Edition")
- {
- try
- {
-
- if (boardModelSelectionBox.Text == "Digital Edition")
-
- {
-
- byte[] find = ConvertHexStringToByteArray(Regex.Replace("22020101", "0x|[ ,]", string.Empty).Normalize().Trim());
- byte[] replace = ConvertHexStringToByteArray(Regex.Replace("22030101", "0x|[ ,]", string.Empty).Normalize().Trim());
- if (find.Length != replace.Length)
- {
- throwError("The length of the old hex value does not match the length of the new hex value!");
- errorShownAlready = true;
- }
- byte[] bytes = File.ReadAllBytes(newFile);
- foreach (int index in PatternAt(bytes, find))
- {
- for (int i = index, replaceIndex = 0; i < bytes.Length && replaceIndex < replace.Length; i++, replaceIndex++)
- {
- bytes[i] = replace[replaceIndex];
- }
- File.WriteAllBytes(newFile, bytes);
- }
- }
-
- }
- catch
- {
- throwError("An error occurred while saving your BIOS file");
- errorShownAlready = true;
- }
- }
- else
- {
- if(modelInfo.Text == "Digital Edition")
- {
- try
- {
-
- if (boardModelSelectionBox.Text == "Disc Edition")
-
- {
-
- byte[] find = ConvertHexStringToByteArray(Regex.Replace("22030101", "0x|[ ,]", string.Empty).Normalize().Trim());
- byte[] replace = ConvertHexStringToByteArray(Regex.Replace("22020101", "0x|[ ,]", string.Empty).Normalize().Trim());
- if (find.Length != replace.Length)
- {
- throwError("The length of the old hex value does not match the length of the new hex value!");
- errorShownAlready = true;
- }
- byte[] bytes = File.ReadAllBytes(newFile);
- foreach (int index in PatternAt(bytes, find))
- {
- for (int i = index, replaceIndex = 0; i < bytes.Length && replaceIndex < replace.Length; i++, replaceIndex++)
- {
- bytes[i] = replace[replaceIndex];
- }
- File.WriteAllBytes(newFile, bytes);
- }
- }
-
- }
- catch
- {
- throwError("An error occurred while saving your BIOS file");
- errorShownAlready = true;
- }
- }
- }
- #endregion
-
- #region Set the new board variant
-
- try
- {
- byte[] oldVariant = Encoding.UTF8.GetBytes(boardVariant.Text);
- string oldVariantHex = Convert.ToHexString(oldVariant);
-
- byte[] newVariantSelection = Encoding.UTF8.GetBytes(boardVariantSelectionBox.Text);
- string newVariantHex = Convert.ToHexString(newVariantSelection);
-
- byte[] find = ConvertHexStringToByteArray(Regex.Replace(oldVariantHex, "0x|[ ,]", string.Empty).Normalize().Trim());
- byte[] replace = ConvertHexStringToByteArray(Regex.Replace(newVariantHex, "0x|[ ,]", string.Empty).Normalize().Trim());
-
- byte[] bytes = File.ReadAllBytes(newFile);
- foreach (int index in PatternAt(bytes, find))
- {
- for (int i = index, replaceIndex = 0; i < bytes.Length && replaceIndex < replace.Length; i++, replaceIndex++)
- {
- bytes[i] = replace[replaceIndex];
- }
- File.WriteAllBytes(newFile, bytes);
- }
-
- }
- catch(System.ArgumentException ex)
- {
- throwError(ex.Message.ToString());
- errorShownAlready = true;
- }
-
- #endregion
-
- #region Change Serial Number
-
- try
- {
-
- byte[] oldSerial = Encoding.UTF8.GetBytes(serialNumber.Text);
- string oldSerialHex = Convert.ToHexString(oldSerial);
-
- byte[] newSerial = Encoding.UTF8.GetBytes(serialNumberTextbox.Text);
- string newSerialHex = Convert.ToHexString(newSerial);
-
- byte[] find = ConvertHexStringToByteArray(Regex.Replace(oldSerialHex, "0x|[ ,]", string.Empty).Normalize().Trim());
- byte[] replace = ConvertHexStringToByteArray(Regex.Replace(newSerialHex, "0x|[ ,]", string.Empty).Normalize().Trim());
-
- byte[] bytes = File.ReadAllBytes(newFile);
- foreach (int index in PatternAt(bytes, find))
- {
- for (int i = index, replaceIndex = 0; i < bytes.Length && replaceIndex < replace.Length; i++, replaceIndex++)
- {
- bytes[i] = replace[replaceIndex];
- }
- File.WriteAllBytes(newFile, bytes);
- }
-
- }
- catch (System.ArgumentException ex)
- {
- throwError(ex.Message.ToString());
- errorShownAlready = true;
- }
-
- #endregion
- }
- else
- {
- throwError("Save operation cancelled!");
- errorShownAlready = true;
- }
- }
- }
- }
-
- if(File.Exists(fileNameToLookFor) && errorShownAlready == false)
- {
- // Reset everything and show message
- ResetAppFields();
- MessageBox.Show("A new BIOS file was successfully created. Please load the new BIOS file to verify the information you entered before installing onto your motherboard. Remember this software was created by TheCod3r with nothing but love. Why not show some love back by dropping me a small donation to say thanks ;).", "All done!", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
-
- }
-
- private void label15_Click(object sender, EventArgs e)
- {
- OpenUrl("https://www.consolefix.shop");
- }
-
- private void label1_Click(object sender, EventArgs e)
- {
-
- }
-
- private void btnRefreshPorts_Click(object sender, EventArgs e)
- {
- // When the "refresh ports" button is pressed, we need to refresh the list of available COM ports for UART
- string[] ports = SerialPort.GetPortNames();
- comboComPorts.Items.Clear();
- comboComPorts.Items.AddRange(ports);
- comboComPorts.SelectedIndex = 0;
- btnConnectCom.Enabled = true;
- btnDisconnectCom.Enabled = false;
- }
-
- private void btnConnectCom_Click(object sender, EventArgs e)
- {
- // Let's try and connect to the UART reader
- btnConnectCom.Enabled = false;
-
- if (comboComPorts.Text != "")
- {
-
- try
- {
- // Set port to selected port
- UARTSerial.PortName = comboComPorts.Text;
- // Set the BAUD rate to 115200
- UARTSerial.BaudRate = 115200;
- // Enable RTS
- UARTSerial.RtsEnable = true;
- // Open the COM port
- UARTSerial.Open();
- btnDisconnectCom.Enabled = true;
- toolStripStatusLabel1.Text = "Connected to UART via COM port " + comboComPorts.Text + " at a BAUD rate of 115200.";
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "An error occurred...", MessageBoxButtons.OK, MessageBoxIcon.Error);
- btnConnectCom.Enabled = true;
- btnDisconnectCom.Enabled = false;
- toolStripStatusLabel1.Text = "Could not connect to UART. Please try again!";
- }
-
- }
- else
- {
- MessageBox.Show("Please select a COM port from the ports list to establish a connection.", "An error occurred...", MessageBoxButtons.OK, MessageBoxIcon.Error);
- btnConnectCom.Enabled = true;
- btnDisconnectCom.Enabled = false;
- toolStripStatusLabel1.Text = "Could not connect to UART. Please try again!";
- }
- }
-
- private void btnDisconnectCom_Click(object sender, EventArgs e)
- {
- // Let's close the COM port
- try
- {
- if(UARTSerial.IsOpen == true)
- {
- UARTSerial.Close();
- btnConnectCom.Enabled = true;
- btnDisconnectCom.Enabled = false;
- toolStripStatusLabel1.Text = "Disconnected from UART...";
- }
- }
- catch(Exception ex)
- {
- MessageBox.Show(ex.Message, "An error occurred...", MessageBoxButtons.OK, MessageBoxIcon.Error);
- toolStripStatusLabel1.Text = "An error occurred while disconnecting from UART. Please try again...";
- }
- }
-
- ///
- /// Read error codes from UART
- ///
- ///
- ///
- private async void button1_Click(object sender, EventArgs e)
- {
- // Let's read the error codes from UART
- txtUARTOutput.Text = "";
-
- if (UARTSerial.IsOpen == true)
- {
- try
- {
-
- List UARTLines = new();
-
- for (var i = 0; i <= 10; i++)
- {
- var command = $"errlog {i}";
- var checksum = CalculateChecksum(command);
- UARTSerial.WriteLine(checksum);
- do
- {
- var line = UARTSerial.ReadLine();
- if (!string.Equals($"{command}:{checksum:X2}", line, StringComparison.InvariantCultureIgnoreCase))
- {
- UARTLines.Add(line);
- }
- } while (UARTSerial.BytesToRead != 0);
-
- foreach (var l in UARTLines)
- {
- var split = l.Split(' ');
- if (!split.Any()) continue;
- switch (split[0])
- {
- case "NG":
- break;
- case "OK":
- var errorCode = split[2];
- // Now that the error code has been isolated from the rest of the junk sent by the system
- // let's check it against the database. The error server will need to return XML results
- string errorResult = await ParseErrorsAsync(errorCode);
- if (!txtUARTOutput.Text.Contains(errorResult))
- {
- txtUARTOutput.AppendText(errorResult + Environment.NewLine);
- }
- break;
- }
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "An error occurred...", MessageBoxButtons.OK, MessageBoxIcon.Error);
- toolStripStatusLabel1.Text = "An error occurred while reading error codes from UART. Please try again...";
- }
- }
- else
- {
- MessageBox.Show("Please connect to UART before attempting to read the error codes.", "An error occurred...", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
-
- // If the app is closed before UART is terminated, we need to at least try to close the COM port gracefully first
- private void Form1_FormClosing(object sender, FormClosingEventArgs e)
- {
- if(UARTSerial.IsOpen == true)
- {
- try
- {
- UARTSerial.Close();
- }
- catch(Exception ex)
- {
- MessageBox.Show(ex.Message, "An error occurred...", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
-
- }
-
- ///
- /// Clear the UART output window
- ///
- ///
- ///
- private void button3_Click(object sender, EventArgs e)
- {
- txtUARTOutput.Text = "";
- }
-
- ///
- /// When the user clicks on the download error database button, show a confirmation first and then if they click yes,
- /// continue to download the latest database from the update server
- ///
- ///
- ///
- private async void btnDownloadDatabase_Click(object sender, EventArgs e)
- {
- DialogResult result = MessageBox.Show("Downloading the error database will overwrite any existing offline database you currently have. Are you sure you would like to do this?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
-
- // Check if user wants to proceed
- if (result == DialogResult.Yes)
- {
- // Call the function to download and save the XML data
- await DownloadDatabaseAsync();
- }
- else
- {
- // Do nothing. The user cancelled the request// The user cancelled
- }
- }
-
- ///
- /// The user can clear the error codes from the console if required but let's make sure they actually want to do
- /// that by showing a confirmation dialog first. If the click yes, send the UART command and wipe the codes from
- /// the console. This action cannot be undone!
- ///
- ///
- ///
- private void btnClearErrorCodes_Click(object sender, EventArgs e)
- {
- DialogResult result = MessageBox.Show("This will clear error codes from the console by sending the \"errlog clear\" command. Are you sure you would like to proceed? This action cannot be undone!", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
-
- if(result == DialogResult.Yes)
- {
- // Let's read the error codes from UART
- txtUARTOutput.Text = "";
-
- if (UARTSerial.IsOpen == true)
- {
- try
- {
-
- List UARTLines = new();
-
- var command = "errlog clear";
- var checksum = CalculateChecksum(command);
- UARTSerial.WriteLine(checksum);
- do
- {
- var line = UARTSerial.ReadLine();
- if (!string.Equals($"{command}:{checksum:X2}", line, StringComparison.InvariantCultureIgnoreCase))
- {
- UARTLines.Add(line);
- }
- } while (UARTSerial.BytesToRead != 0);
-
- foreach (var l in UARTLines)
- {
- var split = l.Split(' ');
- if (!split.Any()) continue;
- switch (split[0])
- {
- case "NG":
- if (!txtUARTOutput.Text.Contains("FAIL"))
- {
- txtUARTOutput.AppendText("Response: FAIL" + Environment.NewLine + "Information: An error occurred while clearing the error logs from the system. Please try again...");
- }
- break;
- case "OK":
- if (!txtUARTOutput.Text.Contains("SUCCESS"))
- {
- txtUARTOutput.AppendText("Response: SUCCESS" + Environment.NewLine + "Information: All error codes cleared successfully");
- }
- break;
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "An error occurred...", MessageBoxButtons.OK, MessageBoxIcon.Error);
- toolStripStatusLabel1.Text = "An error occurred while attempting to send a UART command. Please try again...";
- }
- }
- else
- {
- MessageBox.Show("Please connect to UART before attempting to send commands.", "An error occurred...", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- else
- {
- // Do nothing. The user cancelled the request
- }
- }
-
- ///
- /// Sometimes the user might want to send a custom command. Let them do that here!
- ///
- ///
- ///
- private void btnSendCommand_Click(object sender, EventArgs e)
- {
- if (txtCustomCommand.Text != "")
- {
- // Let's read the error codes from UART
- txtUARTOutput.Text = "";
-
- if (UARTSerial.IsOpen == true)
- {
- try
- {
-
- List UARTLines = new();
-
- var checksum = CalculateChecksum(txtCustomCommand.Text);
- UARTSerial.WriteLine(checksum);
- do
- {
- var line = UARTSerial.ReadLine();
- if (!string.Equals($"{txtCustomCommand.Text}:{checksum:X2}", line, StringComparison.InvariantCultureIgnoreCase))
- {
- UARTLines.Add(line);
- }
- } while (UARTSerial.BytesToRead != 0);
-
- foreach (var l in UARTLines)
- {
- var split = l.Split(' ');
- if (!split.Any()) continue;
- switch (split[0])
- {
- case "NG":
- txtUARTOutput.Text = "ERROR: " + l;
- break;
- case "OK":
- txtUARTOutput.Text = "SUCCESS: " + l;
- break;
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "An error occurred...", MessageBoxButtons.OK, MessageBoxIcon.Error);
- toolStripStatusLabel1.Text = "An error occurred while reading error codes from UART. Please try again...";
- }
- }
- else
- {
- MessageBox.Show("Please connect to UART before attempting to send commands.", "An error occurred...", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- else
- {
- MessageBox.Show("Please enter a command to send via UART.", "An error occurred...", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
-
- ///
- /// If the user presses the enter key while using the custom command box, handle it by programmatically pressing the
- /// send button. This is more of a convenience thing really!
- ///
- ///
- ///
- private void txtCustomCommand_KeyPress(object sender, KeyPressEventArgs e)
- {
- if(e.KeyChar == (char)Keys.Enter)
- {
- btnSendCommand.PerformClick();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/PS5 NOR Modifier/Form1.resx b/PS5 NOR Modifier/Form1.resx
deleted file mode 100644
index 0184f73..0000000
--- a/PS5 NOR Modifier/Form1.resx
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- The PS5 NOR modifier is a Windows GUI tool created by TheCod3r to make rewriting NOR flash rom files quickly and easily.
-TheCod3r is a hardware technician and amatuer software developer who spends a lot of time on research and development for the PS5,
-Xbox Series consoles etc. Remember that this takes time, so if you find any value in my software, please consider supporting me with a donation.
-
-
- Please consider supporting my work and time with a small donation. Your contribution will make my wallet happy and help feed my
-coffee addiction! Click here to donate to me. Even a dollar helps :) Don't forget to subscribe to me on YouTube too!
-
-
- 17, 17
-
-
- You can send custom commands
-with UART using this feature. Note
-that any command entered here
-will return unparsed results. Please
-also be sure to know what you are
-doing as sending unsafe commands
-can damage your device.
-
-
\ No newline at end of file
diff --git a/PS5 NOR Modifier/PS5 NOR Modifier.csproj b/PS5 NOR Modifier/PS5 NOR Modifier.csproj
deleted file mode 100644
index 811a503..0000000
--- a/PS5 NOR Modifier/PS5 NOR Modifier.csproj
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-
- WinExe
- net6.0-windows
- PS5_NOR_Modifier
- enable
- true
- enable
- HardwareChip.ico
- x86
- PS5 NOR Modifier
- AnyCPU;x86
-
-
-
- none
-
-
-
- none
-
-
-
- none
-
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
- True
- True
- Resources.resx
-
-
- True
- True
- Settings.settings
-
-
-
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
-
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
-
-
\ No newline at end of file
diff --git a/PS5 NOR Modifier/PS5 NOR Modifier.csproj.user b/PS5 NOR Modifier/PS5 NOR Modifier.csproj.user
deleted file mode 100644
index 834d222..0000000
--- a/PS5 NOR Modifier/PS5 NOR Modifier.csproj.user
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
- <_LastSelectedProfileId>C:\Users\TheCod3r\source\repos\PS5 NOR Modifier\PS5 NOR Modifier\Properties\PublishProfiles\FolderProfile.pubxml
-
-
-
- Form
-
-
-
\ No newline at end of file
diff --git a/PS5 NOR Modifier/Program.cs b/PS5 NOR Modifier/Program.cs
deleted file mode 100644
index 62a6e6b..0000000
--- a/PS5 NOR Modifier/Program.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-namespace PS5_NOR_Modifier
-{
- internal static class Program
- {
- ///
- /// The main entry point for the application.
- ///
- [STAThread]
- static void Main()
- {
- // To customize application configuration such as set high DPI settings or default font,
- // see https://aka.ms/applicationconfiguration.
- ApplicationConfiguration.Initialize();
- Application.Run(new Form1());
- }
- }
-}
\ No newline at end of file
diff --git a/PS5 NOR Modifier/Properties/PublishProfiles/FolderProfile.pubxml b/PS5 NOR Modifier/Properties/PublishProfiles/FolderProfile.pubxml
deleted file mode 100644
index 8c1dc20..0000000
--- a/PS5 NOR Modifier/Properties/PublishProfiles/FolderProfile.pubxml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
- Release
- Any CPU
- C:\Users\TheCod3r\Desktop\PS5 NOR Modifier
- FileSystem
- <_TargetId>Folder
- net6.0-windows
- win-x86
- false
- true
- false
-
-
\ No newline at end of file
diff --git a/PS5 NOR Modifier/Properties/PublishProfiles/FolderProfile.pubxml.user b/PS5 NOR Modifier/Properties/PublishProfiles/FolderProfile.pubxml.user
deleted file mode 100644
index a40d0bc..0000000
--- a/PS5 NOR Modifier/Properties/PublishProfiles/FolderProfile.pubxml.user
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- True|2023-05-10T11:19:20.3633657Z;False|2023-05-10T01:35:13.6002955+01:00;False|2023-05-10T01:35:01.1172801+01:00;False|2023-05-10T01:34:49.3492673+01:00;False|2023-05-10T01:34:40.0941220+01:00;
-
-
-
\ No newline at end of file
diff --git a/PS5 NOR Modifier/Properties/Resources.Designer.cs b/PS5 NOR Modifier/Properties/Resources.Designer.cs
deleted file mode 100644
index fa40e31..0000000
--- a/PS5 NOR Modifier/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace PS5_NOR_Modifier.Properties {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PS5_NOR_Modifier.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Paypal_128 {
- get {
- object obj = ResourceManager.GetObject("Paypal-128", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap Paypal_32 {
- get {
- object obj = ResourceManager.GetObject("Paypal-32", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap PS5_Nor_Logo {
- get {
- object obj = ResourceManager.GetObject("PS5 Nor Logo", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
- }
-}
diff --git a/PS5 NOR Modifier/Properties/Resources.resx b/PS5 NOR Modifier/Properties/Resources.resx
deleted file mode 100644
index bc90e9c..0000000
--- a/PS5 NOR Modifier/Properties/Resources.resx
+++ /dev/null
@@ -1,130 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
-
- ..\Resources\Paypal-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\Resources\PS5 Nor Logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\Resources\Paypal-128.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
\ No newline at end of file
diff --git a/PS5 NOR Modifier/Properties/Settings.Designer.cs b/PS5 NOR Modifier/Properties/Settings.Designer.cs
deleted file mode 100644
index d6493b3..0000000
--- a/PS5 NOR Modifier/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace PS5_NOR_Modifier.Properties {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default {
- get {
- return defaultInstance;
- }
- }
- }
-}
diff --git a/PS5 NOR Modifier/Properties/Settings.settings b/PS5 NOR Modifier/Properties/Settings.settings
deleted file mode 100644
index 15034e7..0000000
--- a/PS5 NOR Modifier/Properties/Settings.settings
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/PS5Lib/Editions.cs b/PS5Lib/Editions.cs
new file mode 100644
index 0000000..73daf04
--- /dev/null
+++ b/PS5Lib/Editions.cs
@@ -0,0 +1,10 @@
+namespace PS5Lib;
+
+// TODO: Add support for PS5 Pro (assuming that's stored here)
+public enum Editions
+{
+ Disc,
+ Digital,
+ Slim,
+ Unknown,
+}
\ No newline at end of file
diff --git a/PS5Lib/NORData.cs b/PS5Lib/NORData.cs
new file mode 100644
index 0000000..a6be2bb
--- /dev/null
+++ b/PS5Lib/NORData.cs
@@ -0,0 +1,202 @@
+using System.Text;
+
+namespace PS5Lib;
+
+public class NORData(string path)
+{
+ private static readonly Dictionary Regions = new()
+ {
+ { "00", "Japan" },
+ { "01", "US, Canada, (North America)" },
+ { "15", "US, Canada, (North America)" },
+ { "02", "Australia / New Zealand, (Oceania)" },
+ { "03", "United Kingdom / Ireland" },
+ { "04", "Europe / Middle East / Africa" },
+ { "05", "South Korea" },
+ { "06", "Southeast Asia / Hong Kong" },
+ { "07", "Taiwan" },
+ { "08", "Russia, Ukraine, India, Central Asia" },
+ { "09", "Mainland China" },
+ { "11", "Mexico, Central America, South America" },
+ { "14", "Mexico, Central America, South America" },
+ { "16", "Europe / Middle East / Africa" },
+ { "18", "Singapore, Korea, Asia" }
+ };
+
+ private enum DataFormat
+ {
+ String,
+ Hex
+ }
+
+ private readonly byte[] _data = File.ReadAllBytes(path);
+ public string Path => path;
+
+ private string? NORFormatModelCode => GetData(Offsets.Model, 4, DataFormat.Hex);
+
+ ///
+ /// Gets or sets the edition of the PS5.
+ ///
+ public Editions Edition
+ {
+ get
+ {
+ return NORFormatModelCode switch
+ {
+ "22010101" => Editions.Slim,
+ "22020101" => Editions.Disc,
+ "22030101" => Editions.Digital,
+ _ => Editions.Unknown
+ };
+ }
+ set
+ {
+ if (value == Editions.Unknown)
+ return;
+
+ byte[] replace = [0x22, (byte)(value == Editions.Disc ? 0x02 : 0x03), 0x01, 0x01];
+
+ Array.Copy(replace, 0, _data, Offsets.Model, replace.Length);
+ }
+ }
+
+ ///
+ /// Gets the Wi-Fi MAC address of the PS5.
+ ///
+ public string WiFiMAC
+ {
+ get
+ {
+ string? val = GetData(Offsets.WiFiMAC, 6, DataFormat.Hex);
+ return val == null
+ ? "Unknown"
+ : string.Join("", val.Select((c, i) => i % 2 == 0 ? $"{c}" : $"{c}-"))[..^1];
+ }
+ }
+
+ ///
+ /// Gets the MAC address of the PS5's first Ethernet port.
+ ///
+ public string Ethernet1MAC
+ {
+ get
+ {
+ string? val = GetData(Offsets.Ethernet1MAC, 6, DataFormat.Hex);
+ return val == null
+ ? "Unknown"
+ : string.Join("", val.Select((c, i) => i % 2 == 0 ? $"{c}" : $"{c}-"))[..^1];
+ }
+ }
+
+ ///
+ /// Gets the MAC address of the PS5's second Ethernet port, if present. Otherwise, FF-FF-FF-FF-FF-FF.
+ /// This should be Ethernet1Mac + 1.
+ ///
+ public string Ethernet2MAC
+ {
+ get
+ {
+ string? val = GetData(Offsets.Ethernet2MAC, 6, DataFormat.Hex);
+ return val == null
+ ? "Unknown"
+ : string.Join("", val.Select((c, i) => i % 2 == 0 ? $"{c}" : $"{c}-"))[..^1];
+ }
+ }
+
+ ///
+ /// Gets or sets the product serial number of the PS5.
+ ///
+ public string Serial
+ {
+ get => GetData(Offsets.Serial, 16, DataFormat.String) ?? "Unknown";
+ set
+ {
+ byte[] bytes = Encoding.UTF8.GetBytes(value);
+
+ Array.Copy(new byte[16], 0, _data, Offsets.Serial, bytes.Length);
+ Array.Copy(bytes, 0, _data, Offsets.Serial, bytes.Length);
+ }
+ }
+
+ ///
+ /// Gets or sets the SKU identifier of the PS5.
+ ///
+ public string? SKUModel
+ {
+ get
+ {
+ try
+ {
+ byte[] variantBytes = _data[Offsets.SKUModel..(Offsets.SKUModel + 19)].Where(b => b != 0xFF).ToArray();
+ return Encoding.UTF8.GetString(variantBytes).Split(' ')[0];
+ }
+ catch
+ {
+ return null;
+ }
+ }
+ set
+ {
+ if (value == null)
+ return;
+
+ // this is stupid, because i'm almost certain that this doesn't work for all models, but it's what the old
+ // code did (or, more accurately, what it *would have* done, had it actually *worked*), and i don't know how
+ // to make it right, so i'm leaving it as is for now.
+ byte[] bytes = Encoding.UTF8.GetBytes(value);
+ Array.Copy(bytes, 0, _data, Offsets.SKUModel + 10, bytes.Length);
+ }
+ }
+
+ ///
+ /// Gets the SKU of the PS5, plus the region, e.g. "CFI-1015A - US, Canada, (North America)".
+ ///
+ public string? SKUInfo
+ {
+ get
+ {
+ string? variant = SKUModel;
+ return variant == null
+ ? null
+ : $"{variant} - {Regions.GetValueOrDefault(variant[^3..^1], "Unknown Region")}";
+ }
+ }
+
+ ///
+ /// Gets or sets the serial number of the PS5's motherboard.
+ ///
+ public string MoboSerial
+ {
+ get => GetData(Offsets.MoboSerial, 16, DataFormat.String) ?? "Unknown";
+ set
+ {
+ byte[] bytes = Encoding.UTF8.GetBytes(value);
+
+ Array.Copy(new byte[16], 0, _data, Offsets.MoboSerial, bytes.Length);
+ Array.Copy(bytes, 0, _data, Offsets.MoboSerial, bytes.Length);
+ }
+ }
+
+ private string? GetData(int offset, int length, DataFormat format)
+ {
+ try
+ {
+ byte[] bytes = _data[offset..(offset + length)];
+ return format == DataFormat.String
+ ? Encoding.UTF8.GetString(bytes)
+ : BitConverter.ToString(bytes).Replace("-", null);
+ }
+ catch
+ {
+ return null;
+ }
+ }
+
+ // ReSharper disable once ParameterHidesPrimaryConstructorParameter
+ public void Save(string path)
+ {
+ using FileStream stream = new(path, FileMode.Create);
+ stream.Write(_data, 0, _data.Length);
+ stream.Close();
+ }
+}
\ No newline at end of file
diff --git a/PS5Lib/Offsets.cs b/PS5Lib/Offsets.cs
new file mode 100644
index 0000000..37ca648
--- /dev/null
+++ b/PS5Lib/Offsets.cs
@@ -0,0 +1,12 @@
+namespace PS5Lib;
+
+public static class Offsets
+{
+ public const int Model = 0x1c7010;
+ public const int WiFiMAC = 0x1C73C0;
+ public const int Ethernet1MAC = 0x1C4020;
+ public const int Ethernet2MAC = 0x1C4026;
+ public const int Serial = 0x1c7210;
+ public const int SKUModel = 0x1c7230;
+ public const int MoboSerial = 0x1C7200;
+}
\ No newline at end of file
diff --git a/PS5Lib/PS5Lib.csproj b/PS5Lib/PS5Lib.csproj
new file mode 100644
index 0000000..25d6765
--- /dev/null
+++ b/PS5Lib/PS5Lib.csproj
@@ -0,0 +1,19 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+ ..\PS5NORModifier\bin\Debug\net9.0\runtimes\win\lib\net8.0\System.IO.Ports.dll
+
+
+
+
diff --git a/PS5Lib/UART.cs b/PS5Lib/UART.cs
new file mode 100644
index 0000000..7fbb994
--- /dev/null
+++ b/PS5Lib/UART.cs
@@ -0,0 +1,276 @@
+using System.IO.Ports;
+using System.Xml;
+
+namespace PS5Lib;
+
+public class UART
+{
+ public const string DatabaseFileName = "errorDB.xml";
+ private const string DatabaseUrl = "https://uartcodes.com/xml.php";
+
+ private readonly SerialPort _uartSerial = new();
+ public bool UseOfflineDB { get; set; }
+ public bool IsConnected => _uartSerial.IsOpen;
+
+ private static string CalculateChecksum(string str)
+ {
+ int sum = str.Aggregate(0, (current, c) => current + c);
+ return str + ":" + (sum & 0xFF).ToString("X2");
+ }
+
+ ///
+ /// Gets the description of an error code from the XML file.
+ ///
+ /// The error code to look up.
+ /// The description of the error code, or an error message if the file is not found or invalid.
+ public static string ParseErrorsOffline(string errorCode)
+ {
+ try
+ {
+ if (!File.Exists(DatabaseFileName))
+ return "Error: Local XML file not found.";
+
+ XmlDocument xmlDoc = new();
+ xmlDoc.Load(DatabaseFileName);
+
+ XmlNode? errorNode = xmlDoc.SelectSingleNode($"//errorCode[ErrorCode='{errorCode}']");
+ XmlNode? descriptionNode = errorNode?.SelectSingleNode("Description");
+
+ if (descriptionNode == null)
+ return "Error: Invalid XML database file. Please re-download the offline database or use the online database.";
+
+ string description = descriptionNode.InnerText;
+ return $"Error code: {errorCode}\n" +
+ $"Description: {description}";
+ }
+ catch (Exception ex)
+ {
+ return $"Error: {ex}\n" +
+ "Is the database present and valid?";
+ }
+ }
+
+ ///
+ /// Gets the description of an error code from the online database at .
+ ///
+ /// The error code to look up.
+ /// The description of the error code, or an error message if an error occurred.
+ public static async Task ParseErrorsOnline(string error)
+ {
+ string url = $"{DatabaseUrl}?errorCode={error}";
+
+ try
+ {
+ string response;
+ using (HttpClient client = new())
+ {
+ response = await client.GetStringAsync(url);
+ }
+
+ XmlDocument xmlDoc = new();
+ xmlDoc.LoadXml(response);
+
+ XmlNode? description = xmlDoc.SelectSingleNode("errorCodes/errorCode/Description");
+ if (description == null)
+ {
+ return $"Error code: {error}\n" +
+ "An error occurred while fetching a result for this error. Please try again!";
+ }
+
+ return $"Error code: {error}\n" +
+ $"Description: {description.InnerText}";
+ }
+ catch (Exception ex)
+ {
+ return $"Error code: {error}\n" +
+ $"{ex}";
+ }
+ }
+
+ ///
+ /// Downloads the error database from and saves it to the local file system.
+ ///
+ public static async Task DownloadErrorDB()
+ {
+ string xmlData;
+ using (HttpClient client = new())
+ {
+ xmlData = await client.GetStringAsync(DatabaseUrl);
+ }
+
+ XmlDocument xmlDoc = new();
+ xmlDoc.LoadXml(xmlData);
+
+ xmlDoc.Save(DatabaseFileName);
+ }
+
+ public void Connect(string portName, int baudRate = 115200)
+ {
+ if (_uartSerial.IsOpen)
+ return;
+
+ _uartSerial.PortName = portName;
+ _uartSerial.BaudRate = baudRate;
+ _uartSerial.RtsEnable = true;
+ _uartSerial.Open();
+ }
+
+ public void Disconnect()
+ {
+ if (_uartSerial.IsOpen)
+ _uartSerial.Close();
+ }
+
+ ///
+ /// Sends errlog clear to the UART device and returns the result.
+ ///
+ /// The result of the command, or an error message if an error occurred.
+ /// True if the command was sent successfully, false otherwise.
+ public bool ClearErrorLog(out string result)
+ {
+ bool success = SendCommand("errlog clear", out var results);
+
+ if (!success)
+ {
+ result = results[0];
+ return false;
+ }
+
+ result = "";
+ foreach (string[] split in results.Select(l => l.Split(' ')).Where(split => split.Length != 0))
+ {
+ switch (split[0])
+ {
+ case "NG":
+ result += "Response: FAIL" + Environment.NewLine +
+ "Information: An error occurred while clearing the error logs from the system. Please try again..." + Environment.NewLine +
+ split[0];
+
+ break;
+ case "OK":
+ result += "Response: SUCCESS" + Environment.NewLine +
+ "Information: All error codes cleared successfully" + Environment.NewLine +
+ split[0];
+
+ break;
+ }
+ }
+
+ return true;
+ }
+
+ ///
+ /// Gets the error log from the UART device.
+ ///
+ /// The page number to retrieve.
+ /// Whether to filter out duplicate errors.
+ /// A tuple containing a success flag and a list of error messages.
+ public async Task<(bool success, List errors)> GetErrorLog(int page, bool hideDuplicates = false)
+ {
+ bool success = SendCommand($"errlog {page}", out var results);
+
+ if (!success)
+ return (false, results);
+
+ if (hideDuplicates)
+ {
+ results = results.Distinct().ToList();
+ }
+
+ List errors = [];
+ foreach (string[] split in results.Select(l => l.Split(' ')).Where(split => split.Length != 0))
+ {
+ switch (split[0])
+ {
+ case "NG":
+ break;
+ case "OK":
+ string errorCode = split[2];
+ string errorResult;
+ if (errorCode.StartsWith("FFFFFF"))
+ errorResult = $"No error displayed ({errorCode})";
+ else
+ errorResult = UseOfflineDB
+ ? ParseErrorsOffline(errorCode)
+ : await ParseErrorsOnline(errorCode);
+
+ errors.Add(errorResult + Environment.NewLine);
+ break;
+ }
+ }
+ return (true, errors);
+
+ }
+
+ ///
+ /// Sends an arbitrary command to the UART device and returns the result.
+ /// If an error occurs, the result will be the error message.
+ ///
+ /// The command to send.
+ /// The result of the command, or an error message if an error occurred.
+ /// True if the command was sent successfully, false otherwise.
+ public bool SendArbitraryCommand(string command, out string result)
+ {
+ bool success = SendCommand(command, out var results);
+
+ if (!success)
+ {
+ result = results[0];
+ return false;
+ }
+
+ result = "";
+ foreach (string l in results)
+ {
+ string[] split = l.Split(' ');
+ if (split.Length == 0) continue;
+
+ result += split[0] switch
+ {
+ "NG" => "ERROR: " + l,
+ "OK" => "SUCCESS: " + l,
+ _ => l
+ } + Environment.NewLine;
+ }
+ return true;
+ }
+
+ ///
+ /// Sends a command to the UART device and returns the result.
+ /// If an error occurs, the result will contain one item, the error message.
+ ///
+ /// The command to send.
+ /// The result of the command, or an error message if an error occurred.
+ /// True if the command was sent successfully, false otherwise.
+ private bool SendCommand(string command, out List result)
+ {
+ if (!_uartSerial.IsOpen)
+ {
+ result = [ "Please connect to UART before attempting to send commands." ];
+ return false;
+ }
+
+ try
+ {
+ result = [];
+ string checksum = CalculateChecksum(command);
+
+ _uartSerial.WriteLine(checksum);
+ do
+ {
+ string? line = _uartSerial.ReadLine();
+ if (!string.Equals($"{command}:{checksum}", line, StringComparison.InvariantCultureIgnoreCase))
+ {
+ result.Add(line);
+ }
+ } while (_uartSerial.BytesToRead != 0);
+
+ return true;
+ }
+ catch (Exception ex)
+ {
+ result = [ $"Error: {ex}" ];
+ return false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/PS5NORModifier.sln b/PS5NORModifier.sln
new file mode 100644
index 0000000..0b9f979
--- /dev/null
+++ b/PS5NORModifier.sln
@@ -0,0 +1,51 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.3.32901.215
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PS5NORModifier", "PS5NORModifier\PS5NORModifier.csproj", "{BBBF9E78-9480-436A-92F1-B5B8943BCDEF}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UART-CL_By_TheCod3r", "UART-CL_By_TheCod3r\UART-CL_By_TheCod3r.csproj", "{0438F03C-BC9A-4F8E-88F3-CDAF252487C2}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PS5Lib", "PS5Lib\PS5Lib.csproj", "{AF657D71-B71E-4066-A312-91E5C797361E}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {BBBF9E78-9480-436A-92F1-B5B8943BCDEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BBBF9E78-9480-436A-92F1-B5B8943BCDEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BBBF9E78-9480-436A-92F1-B5B8943BCDEF}.Debug|x86.ActiveCfg = Debug|x86
+ {BBBF9E78-9480-436A-92F1-B5B8943BCDEF}.Debug|x86.Build.0 = Debug|x86
+ {BBBF9E78-9480-436A-92F1-B5B8943BCDEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BBBF9E78-9480-436A-92F1-B5B8943BCDEF}.Release|Any CPU.Build.0 = Release|Any CPU
+ {BBBF9E78-9480-436A-92F1-B5B8943BCDEF}.Release|x86.ActiveCfg = Release|x86
+ {BBBF9E78-9480-436A-92F1-B5B8943BCDEF}.Release|x86.Build.0 = Release|x86
+ {0438F03C-BC9A-4F8E-88F3-CDAF252487C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0438F03C-BC9A-4F8E-88F3-CDAF252487C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0438F03C-BC9A-4F8E-88F3-CDAF252487C2}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {0438F03C-BC9A-4F8E-88F3-CDAF252487C2}.Debug|x86.Build.0 = Debug|Any CPU
+ {0438F03C-BC9A-4F8E-88F3-CDAF252487C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0438F03C-BC9A-4F8E-88F3-CDAF252487C2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0438F03C-BC9A-4F8E-88F3-CDAF252487C2}.Release|x86.ActiveCfg = Release|Any CPU
+ {0438F03C-BC9A-4F8E-88F3-CDAF252487C2}.Release|x86.Build.0 = Release|Any CPU
+ {AF657D71-B71E-4066-A312-91E5C797361E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AF657D71-B71E-4066-A312-91E5C797361E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AF657D71-B71E-4066-A312-91E5C797361E}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {AF657D71-B71E-4066-A312-91E5C797361E}.Debug|x86.Build.0 = Debug|Any CPU
+ {AF657D71-B71E-4066-A312-91E5C797361E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AF657D71-B71E-4066-A312-91E5C797361E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AF657D71-B71E-4066-A312-91E5C797361E}.Release|x86.ActiveCfg = Release|Any CPU
+ {AF657D71-B71E-4066-A312-91E5C797361E}.Release|x86.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {406F6CF1-EBE8-4A32-86BA-26B4FEDF751B}
+ EndGlobalSection
+EndGlobal
diff --git a/PS5NORModifier.sln.DotSettings b/PS5NORModifier.sln.DotSettings
new file mode 100644
index 0000000..8f8b2ab
--- /dev/null
+++ b/PS5NORModifier.sln.DotSettings
@@ -0,0 +1,10 @@
+
+ DB
+ LAN
+ LANMAC
+ MAC
+ NOR
+ UART
+ WLAN
+ True
+
\ No newline at end of file
diff --git a/PS5NORModifier/App.axaml b/PS5NORModifier/App.axaml
new file mode 100644
index 0000000..fa57a8a
--- /dev/null
+++ b/PS5NORModifier/App.axaml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/PS5NORModifier/App.cs b/PS5NORModifier/App.cs
new file mode 100644
index 0000000..4531b6b
--- /dev/null
+++ b/PS5NORModifier/App.cs
@@ -0,0 +1,25 @@
+using Avalonia;
+using Avalonia.Controls.ApplicationLifetimes;
+using Avalonia.Markup.Xaml;
+
+namespace PS5NORModifier;
+
+public partial class App : Avalonia.Application
+{
+ public static MainWindow MainWindow;
+ public override void Initialize()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+
+ public override void OnFrameworkInitializationCompleted()
+ {
+ if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+ {
+ MainWindow = new();
+ desktop.MainWindow = MainWindow;
+ }
+
+ base.OnFrameworkInitializationCompleted();
+ }
+}
\ No newline at end of file
diff --git a/PS5 NOR Modifier/Resources/PS5 Nor Logo.png b/PS5NORModifier/Assets/PS5 Nor Logo.png
similarity index 100%
rename from PS5 NOR Modifier/Resources/PS5 Nor Logo.png
rename to PS5NORModifier/Assets/PS5 Nor Logo.png
diff --git a/PS5 NOR Modifier/Resources/Paypal-128.png b/PS5NORModifier/Assets/Paypal-128.png
similarity index 100%
rename from PS5 NOR Modifier/Resources/Paypal-128.png
rename to PS5NORModifier/Assets/Paypal-128.png
diff --git a/PS5 NOR Modifier/Resources/Paypal-32.png b/PS5NORModifier/Assets/Paypal-32.png
similarity index 100%
rename from PS5 NOR Modifier/Resources/Paypal-32.png
rename to PS5NORModifier/Assets/Paypal-32.png
diff --git a/PS5NORModifier/DialogContents.axaml b/PS5NORModifier/DialogContents.axaml
new file mode 100644
index 0000000..23cefad
--- /dev/null
+++ b/PS5NORModifier/DialogContents.axaml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
diff --git a/PS5NORModifier/DialogContents.axaml.cs b/PS5NORModifier/DialogContents.axaml.cs
new file mode 100644
index 0000000..27eb0ea
--- /dev/null
+++ b/PS5NORModifier/DialogContents.axaml.cs
@@ -0,0 +1,40 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+using DialogHostAvalonia;
+using Button = Avalonia.Controls.Button;
+
+namespace PS5NORModifier;
+
+public partial class DialogContents : Avalonia.Controls.UserControl
+{
+ public DialogContents(DialogHost host, string message, string title, params string[] buttons)
+ {
+ InitializeComponent();
+ Title.Content = title;
+ Text.Text = message;
+ for (var i = 0; i < buttons.Length; i++)
+ {
+ string name = buttons[i];
+ Button button = new()
+ {
+ Content = name,
+ Classes = { "DialogButton" },
+ Padding = new(4, 2),
+ CommandParameter = name
+ };
+
+ if (i == 0 && i == buttons.Length - 1)
+ button.Margin = new(0, 2, 0, 0);
+ else if (i == 0)
+ button.Margin = new(0, 2, 2, 0);
+ else if (i == buttons.Length - 1)
+ button.Margin = new(2, 2, 0, 0);
+ else
+ button.Margin = new(2, 2, 2, 0);
+
+ button.Click += (sender, e) => { host.CloseDialogCommand.Execute(name); };
+ Buttons.Children.Add(button);
+ }
+ }
+}
\ No newline at end of file
diff --git a/PS5 NOR Modifier/HardwareChip.ico b/PS5NORModifier/HardwareChip.ico
similarity index 100%
rename from PS5 NOR Modifier/HardwareChip.ico
rename to PS5NORModifier/HardwareChip.ico
diff --git a/PS5NORModifier/MainWindow.axaml b/PS5NORModifier/MainWindow.axaml
new file mode 100644
index 0000000..d5459ae
--- /dev/null
+++ b/PS5NORModifier/MainWindow.axaml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+ The PS5 NOR modifier is a cross-platform GUI tool created by TheCod3r to make rewriting NOR flash rom files quick and easy. TheCod3r is a hardware technician and amateur software developer who spends a lot of time on research and development for the PS5, Xbox Series consoles, etc. Remember that this takes time, so if you find any value in my software, please consider supporting me with a donation.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Please consider supporting my work and time with a small donation. Your contribution will make my wallet happy and help feed my coffee addiction!
+
+
+
+ Even a dollar helps :) Don't forget to subscribe to me on YouTube, too!
+
+
+ This project is sponsored by
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PS5NORModifier/MainWindow.axaml.cs b/PS5NORModifier/MainWindow.axaml.cs
new file mode 100644
index 0000000..f5438e8
--- /dev/null
+++ b/PS5NORModifier/MainWindow.axaml.cs
@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.IO.Ports;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Input;
+using Avalonia.Interactivity;
+using Avalonia.Markup.Xaml;
+using Avalonia.Platform.Storage;
+using DialogHostAvalonia;
+using Label = Avalonia.Controls.Label;
+
+namespace PS5NORModifier;
+
+public partial class MainWindow : Window
+{
+ // I don't like this
+ public static MainWindow Instance;
+ public MainWindow()
+ {
+ Instance = this;
+ InitializeComponent();
+ UartCommunication.RefreshComPorts();
+ }
+
+ private void SponsorLink_OnClick(object? sender, RoutedEventArgs e)
+ {
+ Process.Start(new ProcessStartInfo("https://www.consolefix.shop")
+ {
+ UseShellExecute = true
+ });
+ }
+
+ private void DonateLink_OnClick(object? sender, RoutedEventArgs e)
+ {
+ Process.Start(new ProcessStartInfo("https://streamelements.com/thecod3r/tip")
+ {
+ UseShellExecute = true
+ });
+ }
+
+ private void PayPalLink_OnClick(object? sender, RoutedEventArgs e)
+ {
+ Process.Start(new ProcessStartInfo("https://streamelements.com/thecod3r/tip")
+ {
+ UseShellExecute = true
+ });
+ }
+
+ internal void ShowError(string error)
+ {
+ DialogHost.Show(new DialogContents(Dialog, error, "An error occurred.", "OK"), Dialog);
+ }
+
+ internal void SetStatus(string status)
+ {
+ StatusLabel.Content = status;
+ }
+}
\ No newline at end of file
diff --git a/PS5NORModifier/NORModifier.axaml b/PS5NORModifier/NORModifier.axaml
new file mode 100644
index 0000000..4f57877
--- /dev/null
+++ b/PS5NORModifier/NORModifier.axaml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/PS5NORModifier/NORModifier.axaml.cs b/PS5NORModifier/NORModifier.axaml.cs
new file mode 100644
index 0000000..36a6253
--- /dev/null
+++ b/PS5NORModifier/NORModifier.axaml.cs
@@ -0,0 +1,209 @@
+using System;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Interactivity;
+using Avalonia.Markup.Xaml;
+using Avalonia.Platform.Storage;
+using PS5Lib;
+
+namespace PS5NORModifier;
+
+public partial class NORModifier : UserControl
+{
+ private NORData? _norData;
+
+ private readonly string[] _models =
+ [
+ "Disc Edition",
+ "Digital Edition"
+ ];
+
+
+ // TODO: I'd like to create a custom class for this that contains all the SKUs and their model-specific data. I'll do that later...
+ // Sourced from https://www.psdevwiki.com/ps5/SKU_Models
+ private readonly List _boardVariants =
+ [
+ // General Schema:
+ // `${Audience}-${IsNonRetail ? {NonRetailFlavor} : ""}${Chassis}${Revision}${ModelSpecifier}`
+
+ // Audience: CFI = Consumer, DFI = DevKit or TestKit
+ // NonRetailFlavor: D = DevKit, T = TestKit
+ // Chassis: 1 = PS5 Fat, 2 = PS5 Slim, 7 = PS5 Pro
+ // Revision: 0 = First Revision, 1 = Second Revision, 2 = Third Revision, 3 = Fourth Revision, ...
+ // ModelSpecifier: Model specific identifier. Not entirely consistent, and the schema changes with the PS5 Pro. Usually ends with "A", "B", "AB"...
+
+ // PS5 FAT (Rev0)
+ "CFI-1000A",
+ "CFI-1000A01",
+ "CFI-1000B",
+ "CFI-1002A",
+ "CFI-1008A",
+ "CFI-1014A",
+ "CFI-1015A",
+ "CFI-1015B",
+ "CFI-1016A", // Ratchet & Clank: Rift Apart Limited Edition
+ "CFI-1018A",
+
+ // PS5 FAT (Rev1)
+ "CFI-1100A01",
+ "CFI-1102A",
+ "CFI-1108A",
+ "CFI-1109A",
+ "CFI-1114A",
+ "CFI-1115A",
+ "CFI-1116A", // Horizon Forbidden West Limited Edition
+ "CFI-1118A",
+
+ // PS5 FAT (Rev2)
+ "CFI-1208A",
+ "CFI-1215A",
+ "CFI-1216A", // Call of Duty Modern Warfare II Limited Edition
+
+ // PS5 Slim (Rev0)
+ "CFI-2000AB",
+ "CFI-2002A",
+ "CFI-2002B",
+ "CFI-2015AB",
+ "CFI-2016",
+ "CFI-2018AB",
+
+ // PS5 Pro (Rev0)
+ "CFI-7000 B01",
+ "CFI-7002 B01",
+ "CFI-7014 B01",
+ "CFI-7019 B01",
+ "CFI-7020 B01",
+ "CFI-7021 B01",
+ "CFI-7022 B01",
+
+ // Non-Retail Models!
+ "DFI-T1000AA", // TestKit
+ "DFI-D1000AA" // DevKit
+ ];
+ public NORModifier()
+ {
+ InitializeComponent();
+ BoardVariantIn.ItemsSource = _boardVariants;
+ PS5ModelIn.ItemsSource = _models;
+ }
+
+ private async void BrowseButton_OnClick(object? sender, RoutedEventArgs e)
+ {
+ var mainWindow = MainWindow.Instance;
+ var files = await mainWindow.StorageProvider.OpenFilePickerAsync(new()
+ {
+ Title = "Open NOR BIN File",
+ AllowMultiple = false,
+ FileTypeFilter = new List
+ {
+ new("PS5 BIN Files")
+ {
+ Patterns = new List { "*.bin" }
+ }
+ }
+ });
+
+ if (files.Count == 0)
+ return;
+
+ IStorageFile file = files[0];
+ string norPath = Uri.UnescapeDataString(file.Path.AbsolutePath);
+ if (!File.Exists(norPath))
+ {
+ mainWindow.ShowError("The file you selected could not be found. Please check the file exists and is a valid BIN file.");
+ return;
+ }
+
+ if(!file.Name.EndsWith(".bin", StringComparison.InvariantCultureIgnoreCase))
+ {
+ mainWindow.ShowError("You did not select a .bin file. Please ensure the file you are choosing is a correct BIN file and try again.");
+ return;
+ }
+
+ mainWindow.SetStatus("Status: Selected file " + norPath);
+ NORDumpPath.Text = norPath;
+
+ long length = new FileInfo(norPath).Length;
+ FileSizeOut.Content = length + " bytes (" + length / 1024 / 1024 + " MiB)";
+
+ _norData = new(norPath);
+
+ Editions edition = _norData.Edition;
+ PS5ModelOut.Content = edition + " Edition";
+ PS5ModelIn.SelectedItem = edition == Editions.Unknown ? null : edition + " Edition";
+
+ string serial = _norData.Serial;
+ SerialNumberOut.Content = serial;
+ SerialNumberIn.Text = serial;
+
+ string wifiMac = _norData.WiFiMAC;
+ WiFiMACAddressOut.Content = wifiMac;
+ WiFiMACAddressIn.Text = wifiMac;
+
+ string lanMac = _norData.Ethernet1MAC;
+ LANMACAddressOut.Content = lanMac;
+ LANMACAddressIn.Text = lanMac;
+
+ MotherboardSerialOut.Content = _norData.MoboSerial;
+ MotherboardSerialIn.Text = _norData.MoboSerial;
+
+ BoardVariantOut.Content = _norData.SKUInfo;
+ BoardVariantIn.SelectedValue = _norData.SKUModel;
+ }
+
+ private async void SaveButton_OnClick(object? sender, RoutedEventArgs e)
+ {
+ var mainWindow = MainWindow.Instance;
+ if (!File.Exists(_norData?.Path))
+ {
+ mainWindow.ShowError("Please select a valid BIOS file first.");
+ return;
+ }
+ if (PS5ModelIn.SelectedValue == null)
+ {
+ mainWindow.ShowError("Please select a valid board model before saving new BIOS information!");
+ return;
+ }
+ if (BoardVariantIn.SelectedValue == null)
+ {
+ mainWindow.ShowError("Please select a valid board variant before saving new BIOS information!");
+ return;
+ }
+ if (string.IsNullOrEmpty(SerialNumberIn.Text))
+ {
+ mainWindow.ShowError("Please enter a valid serial number before saving new BIOS information!");
+ return;
+ }
+ if (string.IsNullOrEmpty(MotherboardSerialIn.Text))
+ {
+ mainWindow.ShowError("Please enter a valid motherboard serial number before saving new BIOS information!");
+ return;
+ }
+
+ IStorageFile? file = await mainWindow.StorageProvider.SaveFilePickerAsync(new()
+ {
+ Title = "Save NOR BIN File",
+ SuggestedStartLocation = await mainWindow.StorageProvider.TryGetFolderFromPathAsync(NORDumpPath.Text),
+ SuggestedFileName = "bios.bin",
+ FileTypeChoices =
+ [
+ new("PS5 BIN Files")
+ {
+ Patterns = [ "*.bin" ]
+ }
+ ]
+ });
+
+ if (file == null)
+ return;
+
+ string filePath = Uri.UnescapeDataString(file.Path.AbsolutePath);
+
+ _norData.Edition = (Editions)PS5ModelIn.SelectedIndex;
+ _norData.SKUModel = BoardVariantIn.SelectedValue.ToString() ?? null;
+ _norData.Serial = SerialNumberIn.Text;
+ _norData.MoboSerial = MotherboardSerialIn.Text;
+
+ _norData.Save(filePath);
+ }
+}
\ No newline at end of file
diff --git a/PS5NORModifier/PS5NORModifier.csproj b/PS5NORModifier/PS5NORModifier.csproj
new file mode 100644
index 0000000..366aedd
--- /dev/null
+++ b/PS5NORModifier/PS5NORModifier.csproj
@@ -0,0 +1,69 @@
+
+
+
+ Exe
+ net8.0
+ PS5NORModifier
+ enable
+ enable
+ HardwareChip.ico
+ x64
+ PS5 NOR Modifier
+ AnyCPU;x64
+ preview
+
+
+
+ full
+
+
+
+ full
+
+
+
+ full
+ true
+
+
+
+ full
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ App.axaml
+
+
+ NORModifier.axaml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/PS5NORModifier/Program.cs b/PS5NORModifier/Program.cs
new file mode 100644
index 0000000..91e600b
--- /dev/null
+++ b/PS5NORModifier/Program.cs
@@ -0,0 +1,20 @@
+using Avalonia;
+
+namespace PS5NORModifier;
+
+class Program
+{
+ // Initialization code. Don't use any Avalonia, third-party APIs or any
+ // SynchronizationContext-reliant code before AppMain is called: things aren't initialized
+ // yet and stuff might break.
+ [STAThread]
+ public static void Main(string[] args) => BuildAvaloniaApp()
+ .StartWithClassicDesktopLifetime(args);
+
+ // Avalonia configuration, don't remove; also used by visual designer.
+ public static AppBuilder BuildAvaloniaApp()
+ => AppBuilder.Configure()
+ .UsePlatformDetect()
+ .WithInterFont()
+ .LogToTrace();
+}
\ No newline at end of file
diff --git a/PS5NORModifier/UARTCommunication.axaml b/PS5NORModifier/UARTCommunication.axaml
new file mode 100644
index 0000000..b39050b
--- /dev/null
+++ b/PS5NORModifier/UARTCommunication.axaml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Use offline database
+
+
+
+
+
+
+
+
+
+ You can send custom commands with UART using this feature. Note that any command entered here will return unparsed results. Please also be sure to know what you are doing as sending unsafe commands can damage your device.
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/PS5NORModifier/UARTCommunication.axaml.cs b/PS5NORModifier/UARTCommunication.axaml.cs
new file mode 100644
index 0000000..265a49f
--- /dev/null
+++ b/PS5NORModifier/UARTCommunication.axaml.cs
@@ -0,0 +1,195 @@
+using System.IO.Ports;
+using System.Xml;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Controls.ApplicationLifetimes;
+using Avalonia.Interactivity;
+using Avalonia.Markup.Xaml;
+using DialogHostAvalonia;
+using PS5Lib;
+
+namespace PS5NORModifier;
+
+public partial class UARTCommunication : UserControl
+{
+ private readonly UART _uart;
+ public UARTCommunication()
+ {
+ InitializeComponent();
+ _uart = new();
+ }
+
+ internal void RefreshComPorts()
+ {
+ var mainWindow = MainWindow.Instance;
+ string[] ports = SerialPort.GetPortNames();
+ if (ports == null || ports.Length == 0)
+ {
+ mainWindow.ShowError("No available COM ports were detected.");
+ return;
+ }
+
+ ComPorts.Items.Clear();
+ foreach (string port in ports)
+ {
+ ComPorts.Items.Add(port);
+ }
+ ComPorts.SelectedIndex = 0;
+ ConnectComButton.IsEnabled = true;
+ DisconnectComButton.IsEnabled = false;
+ }
+
+ private void RefreshComButton_OnClick(object? sender, RoutedEventArgs e)
+ {
+ RefreshComPorts();
+ }
+
+ private void ClearOutputButton_OnClick(object? sender, RoutedEventArgs e)
+ {
+ OutputText.Text = "";
+ }
+
+ private void SendCustomCommandButton_OnClick(object? sender, RoutedEventArgs e)
+ {
+ var mainWindow = MainWindow.Instance;
+ if (string.IsNullOrEmpty(CustomCommand.Text))
+ {
+ mainWindow.ShowError("Please enter a command to send via UART.");
+ return;
+ }
+
+ bool success = _uart.SendArbitraryCommand(CustomCommand.Text, out string result);
+
+ if (success)
+ {
+ OutputText.Text += result + Environment.NewLine;
+ }
+ else
+ {
+ mainWindow.ShowError(result);
+ mainWindow.SetStatus("An error occurred while sending the command. Please try again.");
+ }
+ }
+
+ private void ConnectComButton_OnClick(object? sender, RoutedEventArgs e)
+ {
+ var mainWindow = MainWindow.Instance;
+ var selectedPort = (string?)ComPorts.SelectedItem;
+ if (string.IsNullOrEmpty(selectedPort))
+ {
+ mainWindow.ShowError("Please select a COM port from the ports list to establish a connection.");
+ mainWindow.SetStatus("Could not connect to UART. Please try again!");
+ return;
+ }
+
+ try
+ {
+ _uart.Connect(selectedPort);
+
+ DisconnectComButton.IsEnabled = true;
+ ConnectComButton.IsEnabled = false;
+ mainWindow.SetStatus($"Connected to UART via COM port {selectedPort} at a BAUD rate of 115200.");
+ }
+ catch (Exception ex)
+ {
+ mainWindow.ShowError(ex.ToString());
+ mainWindow.SetStatus("Could not connect to UART. Please try again!");
+ }
+ }
+
+ private void DisconnectComButton_OnClick(object? sender, RoutedEventArgs e)
+ {
+ var mainWindow = MainWindow.Instance;
+ try
+ {
+ _uart.Disconnect();
+
+ ConnectComButton.IsEnabled = true;
+ DisconnectComButton.IsEnabled = false;
+ mainWindow.SetStatus("Disconnected from UART.");
+ }
+ catch(Exception ex)
+ {
+ mainWindow.ShowError(ex.ToString());
+ mainWindow.SetStatus("An error occurred while disconnecting from UART. Please try again.");
+ }
+ }
+ private async void GetErrorCodesButton_OnClick(object? sender, RoutedEventArgs e)
+ {
+ var mainWindow = MainWindow.Instance;
+ for (int i = 0; i <= 10; i++)
+ {
+ var result = await _uart.GetErrorLog(i);
+
+ if (!result.success)
+ {
+ mainWindow.ShowError(string.Join(Environment.NewLine, result.errors));
+ mainWindow.SetStatus($"An error occurred while reading error codes from UART, at page {i}. Please try again.");
+ return;
+ }
+
+ OutputText.Text += result.errors + Environment.NewLine;
+ }
+ }
+
+ private async void ClearErrorCodesButton_OnClick(object? sender, RoutedEventArgs e)
+ {
+ var mainWindow = MainWindow.Instance;
+ DialogHost dialog = mainWindow.Dialog;
+ var response = (string?)await DialogHost.Show(new DialogContents(dialog,
+ "This will clear error codes from the console by sending the \"errlog clear\" command." +
+ "Are you sure you would like to proceed? This action cannot be undone!",
+ "Are you sure?",
+ "No", "Yes"),
+ dialog);
+
+ if (response != "Yes")
+ return;
+
+ bool success = _uart.ClearErrorLog(out string result);
+ if (success)
+ {
+ OutputText.Text += result + Environment.NewLine;
+ mainWindow.SetStatus("Error codes cleared successfully.");
+ }
+ else
+ {
+ mainWindow.ShowError(result);
+ mainWindow.SetStatus("An error occurred while clearing error codes. Please try again.");
+ }
+ }
+
+ private async void DownloadErrorDBButton_OnClick(object? sender, RoutedEventArgs e)
+ {
+ var mainWindow = MainWindow.Instance;
+ DialogHost dialog = mainWindow.Dialog;
+ var result = (string?)await DialogHost.Show(new DialogContents(dialog,
+ "Downloading the error database will overwrite any existing offline database you currently have. Are you sure you would like to do this?",
+ "Are you sure?",
+ "No", "Yes"),
+ dialog);
+
+ if (result != "Yes")
+ return;
+
+ try
+ {
+ await UART.DownloadErrorDB();
+
+ await DialogHost.Show(new DialogContents(dialog,
+ "The offline database has been updated successfully.",
+ "Offline Database Updated!",
+ "OK"));
+ }
+ catch (Exception ex)
+ {
+ mainWindow.ShowError(ex.ToString());
+ mainWindow.SetStatus("An error occurred while downloading the offline database. Please try again.");
+ }
+ }
+
+ private void UseOfflineDB_OnIsCheckedChanged(object? sender, RoutedEventArgs e)
+ {
+ _uart.UseOfflineDB = UseOfflineDB.IsChecked == true;
+ }
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 6781d07..9a4a083 100644
--- a/README.md
+++ b/README.md
@@ -2,10 +2,10 @@ Help contribute to the project with a donation: https://www.streamelements.com/t
News update: This project will continue soon. We've just aquired the domain "uart.codes" and I'm in the process of building a team and a roadmap to really take this project places it's never seen!
-The PS5 NOR Modifier is a Windows GUI based application making it easier for people to modify the NOR file for their PlayStation 5 console. This is especially useful if you need to generate a NOR file for your console to replace a corrupt or faulty NOR.
+The PS5 NOR Modifier is a GUI based application that makes it easier for one to modify the NOR file for their PlayStation 5 console. This is especially useful if you need to generate a NOR file for your console to replace a corrupt or faulty NOR.
-Download compiled versions under the releases section
+Download compiled versions under the releases section.

@@ -13,8 +13,6 @@ Download compiled versions under the releases section

-If you just want to use the software, download the standalone ZIP
-
Some symptoms that your NOR is corrupt or faulty:
1. No power at all. The console draws 8ma of current or 0ma of current when connecting to a bench power supply
2. 3 beeps of death. The console beeps 3 times when you plug in the main power chord
@@ -29,7 +27,7 @@ Features:
3. Change serial number on NOR file
4. Change version flags (disc edition or digital edition)
5. Read motherboard serial
-6. Read WiFi MAC address
+6. Read Wi-Fi MAC address
7. Read LAN MAC address
UART Features:
@@ -43,14 +41,10 @@ UART Features:
System Requirements:
-Operating system: Windows 7, 8, 10, 11
-
-Hard Drive: 5MB
-
-Memory: 128MB
+Operating system: Windows 10, 11, Linux, macOS
-CPU: Any X86 or X64 based CPU
+CPU: Any X86- or X64-based CPU
-Software: Microsoft .NET 6.0 Desktop Runtime (v6.0.29)
+Software: Microsoft .NET 8.0 Desktop Runtime
Internet connection when using online
diff --git a/Screenshot1.png b/Screenshot1.png
index c112d90..0cf116e 100644
Binary files a/Screenshot1.png and b/Screenshot1.png differ
diff --git a/Screenshot2.png b/Screenshot2.png
index a3923c0..46727e4 100644
Binary files a/Screenshot2.png and b/Screenshot2.png differ
diff --git a/Screenshot3.png b/Screenshot3.png
index 1c96e28..33a8771 100644
Binary files a/Screenshot3.png and b/Screenshot3.png differ
diff --git a/UART-CL By TheCod3r/UART-CL By TheCod3r.sln b/UART-CL By TheCod3r/UART-CL By TheCod3r.sln
deleted file mode 100644
index 9ba637f..0000000
--- a/UART-CL By TheCod3r/UART-CL By TheCod3r.sln
+++ /dev/null
@@ -1,25 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.3.32901.215
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UART-CL By TheCod3r", "UART-CL By TheCod3r\UART-CL By TheCod3r.csproj", "{8B5DA648-23A0-4C54-A0D2-F6B5E326F308}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {8B5DA648-23A0-4C54-A0D2-F6B5E326F308}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {8B5DA648-23A0-4C54-A0D2-F6B5E326F308}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {8B5DA648-23A0-4C54-A0D2-F6B5E326F308}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {8B5DA648-23A0-4C54-A0D2-F6B5E326F308}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {BAD6A308-3F90-4873-A39E-365E07239E9B}
- EndGlobalSection
-EndGlobal
diff --git a/UART-CL By TheCod3r/UART-CL By TheCod3r/Program.cs b/UART-CL By TheCod3r/UART-CL By TheCod3r/Program.cs
deleted file mode 100644
index aa87133..0000000
--- a/UART-CL By TheCod3r/UART-CL By TheCod3r/Program.cs
+++ /dev/null
@@ -1,1894 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.Threading;
-using System.Drawing;
-using System.IO;
-using System.IO.Ports;
-using Colorful;
-using System.Net;
-using System.Management;
-using System.Xml;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Globalization;
-
-#region Reminders (remove before publishing)
-// Add check inside sub menu to confirm that the selected .bin file is a valid PS5 dump
-#endregion
-
-// Set the name of the application
-string appTitle = "UART-CL by TheCod3r";
-
-bool showMenu = false;
-
-// Set the application title
-System.Console.Title = appTitle;
-
-#region Checksum generation
-static string CalculateChecksum(string str)
-{
- // Math stuff. I don't understand it either!
- int sum = 0;
- foreach (char c in str)
- {
- sum += (int)c;
- }
- return str + ":" + (sum & 0xFF).ToString("X2");
-}
-#endregion
-
-#region Hex conversions
-static string HexStringToString(string hexString)
-{
- if (hexString == null || (hexString.Length & 1) == 1)
- {
- throw new ArgumentException();
- }
- var sb = new StringBuilder();
- for (var i = 0; i < hexString.Length; i += 2)
- {
- var hexChar = hexString.Substring(i, 2);
- sb.Append((char)Convert.ToByte(hexChar, 16));
- }
- return sb.ToString();
-}
-
-static IEnumerable PatternAt(byte[] source, byte[] pattern)
-{
- for (int i = 0; i < source.Length; i++)
- {
- if (source.Skip(i).Take(pattern.Length).SequenceEqual(pattern))
- {
- yield return i;
- }
- }
-}
-
-static byte[] ConvertHexStringToByteArray(string hexString)
-{
- if (hexString.Length % 2 != 0)
- {
- throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, "The binary key cannot have an odd number of digits: {0}", hexString));
- }
-
- byte[] data = new byte[hexString.Length / 2];
- for (int index = 0; index < data.Length; index++)
- {
- string byteValue = hexString.Substring(index * 2, 2);
- data[index] = Convert.ToByte(byteValue, 16); // Parse hex string directly
- }
-
- return data;
-}
-#endregion
-
-#region Error parsing (via XML database)
-
-// When fetching errors from the PS5 we want to be able to convert the received codes into readable text to make it easier
-// for the user to understand what the problem is. By the time this function is called we should have an up to date XML
-// database to compare error codes with.
-static string ParseErrors(string errorCode)
-{
- string results = "";
-
- try
- {
- // Check if the XML file exists
- if (File.Exists("errorDB.xml"))
- {
- // Load the XML file
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.Load("errorDB.xml");
-
- // Get the root node
- XmlNode root = xmlDoc.DocumentElement;
-
- // Check if the root node is
- if (root.Name == "errorCodes")
- {
- // No error was found in the database
- if (root.ChildNodes.Count == 0)
- {
- results = "No result found for error code " + errorCode;
- }
- else
- {
- // Loop through each errorCode node
- foreach (XmlNode errorCodeNode in root.ChildNodes)
- {
- // Check if the node is
- if (errorCodeNode.Name == "errorCode")
- {
- // Get ErrorCode and Description
- string errorCodeValue = errorCodeNode.SelectSingleNode("ErrorCode").InnerText;
- string description = errorCodeNode.SelectSingleNode("Description").InnerText;
-
- // Check if the current error code matches the requested error code
- if (errorCodeValue == errorCode)
- {
- // Output the results
- results = "Error code: " + errorCodeValue + Environment.NewLine + "Description: " + description;
- break; // Exit the loop after finding the matching error code
- }
- }
- }
- }
- }
- else
- {
- results = "Error: Invalid XML database file. Please reconfigure the application, redownload the offline database, or uncheck the option to use the offline database.";
- }
- }
- else
- {
- results = "Error: Local XML file not found.";
- }
- }
- catch (Exception ex)
- {
- results = "Error: " + ex.Message;
- }
-
- return results;
-}
-
-#endregion
-
-#region Obtian the friendly name of the available COM ports
-static string GetFriendlyName(string portName)
-{
- // Declare the friendly name variable for later use
- string friendlyName = portName;
- // We'll wrap this in a try loop simply because this isn't available on all platforms
- try
- {
- // This is basically an SQL query. Let's search for the details of the ports based on the port name
- // Again, this is just for Windows based devices
- using (var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PnPEntity WHERE Name LIKE '%" + portName + "%'"))
- {
- // Loop through and output the friendly name
- foreach (var port in searcher.Get())
- {
- friendlyName = port["Name"].ToString();
- }
- }
- }
- // Catch errors. This would probably only happen on Linux systems
- catch(Exception ex)
- {
- // If there is an error, we'll just declare that we don't know the name of the port
- friendlyName = "Unknown Port Name";
- }
- // Send the friendly name (or unknown port name string) back to the main code for output
- return friendlyName;
-}
-#endregion
-
-#region Console header
-static void ShowHeader()
-{
- // This is the header.
- System.Console.Clear();
- Colorful.Console.WriteAscii("UART-CL v1.0.0.0");
- Colorful.Console.WriteAscii("by TheCod3r");
- System.Console.WriteLine("");
- System.Console.WriteLine("");
- System.Console.WriteLine("UART-CL is a command line UART tool to assist in the diagnosis and repair of PlayStation 5 consoles using UART.");
- System.Console.WriteLine("For more information on how to connect to UART you can use the options below or read the ReadMe.");
- System.Console.WriteLine("");
-}
-#endregion
-
-#region Check if error database exists
-// Let's check and see if the database exists. If not, download it!
-if (!System.IO.File.Exists("errorDB.xml"))
-{
- ShowHeader();
- System.Console.WriteLine("Downloading latest database file. Please wait...");
-
- bool success = DownloadDatabase("http://uartcodes.com/xml.php", "errorDB.xml");
-
- if (success)
- {
- System.Console.WriteLine("Database downloaded successfully...");
- showMenu = true;
- }
- else
- {
- System.Console.WriteLine("Could not download the latest database file. Please ensure you're connected to the internet!");
- Environment.Exit(0);
- }
-}
-else
-{
- // The database file exists. Continue to the main menu
- showMenu = true;
-}
-#endregion
-
-#region URL Handling
-
-// Let's create a function that will allow us to download the latest version of the database if we have access to the internet.
-static bool DownloadDatabase(string url, string savePath)
-{
- using (WebClient client = new WebClient())
- {
- try
- {
- client.DownloadFile(url, savePath);
- return true;
- }
- catch (Exception ex)
- {
- return false;
- }
- }
-}
-
-// Function to open a new URL in the default browser
-static void OpenUrl(string url)
-{
- // Let's wait two seconds first
- Thread.Sleep(2000);
- // Wrap this in a try loop so we don't get any unexpected crashes
- try
- {
- Process.Start(new ProcessStartInfo
- {
- FileName = url,
- UseShellExecute = true
- });
- }
- catch (Exception ex)
- {
- // Catch any errors and let the user know
- System.Console.WriteLine($"Error opening URL: {ex.Message}");
- }
-}
-
-#endregion
-
-#region Map suffixes to regions (for console variant)
-// Define a dictionary to map suffixes to regions
-Dictionary regionMap = new Dictionary
-{
- { "00A", "Japan" },
- { "00B", "Japan" },
- { "01A", "US, Canada, (North America)" },
- { "01B", "US, Canada, (North America)" },
- { "15A", "US, Canada, (North America)" },
- { "15B", "US, Canada, (North America)" },
- { "02A", "Australia / New Zealand, (Oceania)" },
- { "02B", "Australia / New Zealand, (Oceania)" },
- { "03A", "United Kingdom / Ireland" },
- { "03B", "United Kingdom / Ireland" },
- { "04A", "Europe / Middle East / Africa" },
- { "04B", "Europe / Middle East / Africa" },
- { "05A", "South Korea" },
- { "05B", "South Korea" },
- { "06A", "Southeast Asia / Hong Kong" },
- { "06B", "Southeast Asia / Hong Kong" },
- { "07A", "Taiwan" },
- { "07B", "Taiwan" },
- { "08A", "Russia, Ukraine, India, Central Asia" },
- { "08B", "Russia, Ukraine, India, Central Asia" },
- { "09A", "Mainland China" },
- { "09B", "Mainland China" },
- { "11A", "Mexico, Central America, South America" },
- { "11B", "Mexico, Central America, South America" },
- { "14A", "Mexico, Central America, South America" },
- { "14B", "Mexico, Central America, South America" },
- { "16A", "Europe / Middle East / Africa" },
- { "16B", "Europe / Middle East / Africa" },
- { "18A", "Singapore, Korea, Asia" },
- { "18B", "Singapore, Korea, Asia" }
-};
-#endregion
-
-#region Display main menu
-// Show the menu if showMenu is set to true
-while (showMenu)
-{
- showMenu = MainMenu(appTitle, regionMap);
-}
-#endregion
-
-#region Display sub menu for working with BIOS files
-static void RunSubMenu(string appTitle, Dictionary regionMap)
-{
- string pathToDump = "";
- bool subMenuRunning = true;
-
- while (subMenuRunning)
- {
- // Check to see if we are working with a file. If so, add it to the app title so the user is aware...
- if(!string.IsNullOrEmpty(pathToDump))
- {
- System.Console.Title = appTitle + " - Working with file: " + pathToDump;
- }
-
- System.Console.ForegroundColor = ConsoleColor.Blue;
- System.Console.WriteLine("In order to work with a BIOS dump file, you will need to load it into memory first.");
- System.Console.WriteLine("Be sure to choose a file to work with by choosing option 1 before choosing any other option...");
- System.Console.ResetColor();
- System.Console.WriteLine("");
- System.Console.ForegroundColor = ConsoleColor.Red;
- System.Console.WriteLine("Choose an option:");
- System.Console.ResetColor();
- System.Console.ForegroundColor = ConsoleColor.Green;
- System.Console.WriteLine("1. Load a BIOS dump (.bin)");
- System.Console.ResetColor();
- System.Console.WriteLine("2. View BIOS information");
- System.Console.WriteLine("3. Convert to Digital edition");
- System.Console.WriteLine("4. Convert to Disc edition");
- System.Console.WriteLine("5. Convert to Slim edition");
- System.Console.WriteLine("6. Change serial number");
- System.Console.WriteLine("7. Change motherboard serial number");
- System.Console.WriteLine("8. Change console model number");
- System.Console.WriteLine("X. Return to previous menu");
- System.Console.Write("\nEnter your choice: ");
- switch (System.Console.ReadLine())
- {
- #region Load a dump file
- case "1":
- System.Console.WriteLine("In order to work with a BIOS file, you must first choose a file to work with.");
- System.Console.WriteLine("This needs to be a valid .bin file containing your BIOS dump file.");
- System.Console.WriteLine("You will need to know the full file path of your .bin file in order to continue.");
- System.Console.WriteLine();
-
- string userInput;
- do
- {
- System.Console.Write("Enter the full file path (type 'exit' to quit): ");
- userInput = System.Console.ReadLine().Trim(); // Trim to remove any leading/trailing whitespace
-
- if (string.IsNullOrWhiteSpace(userInput))
- {
- System.Console.WriteLine("Invalid input. File path cannot be blank.");
- }
- else if (userInput.Equals("exit", StringComparison.OrdinalIgnoreCase))
- {
- // User wants to return to the sub-menu
- break; // Exit the current method and return to the sub-menu
- }
- else if (!File.Exists(userInput))
- {
- System.Console.WriteLine("The file path you entered does not exist. Please enter the path to a valid .bin file.");
- }
- else if (Path.GetExtension(userInput) != ".bin")
- {
- System.Console.WriteLine("The file you provided is not a .bin file. Please enter a valid .bin file path.");
- }
- else
- {
- // User provided a valid .bin file path, you can proceed with it
- pathToDump = userInput;
- long length = new System.IO.FileInfo(pathToDump).Length;
- System.Console.WriteLine("Selected file: " + pathToDump + " - File Size: " + length.ToString() + " bytes (" + length / 1024 / 1024 + "MB)");
- Thread.Sleep(1000);
- break; // Exit the loop
- }
- } while (true);
- break;
- #endregion
- #region View BIOS information
- case "2":
- // First check to confirm that we've selected a file to work with
- if(!string.IsNullOrEmpty(pathToDump)) // If the pathToDump string isn't empty or null, we can try and work with it
- {
- // Let's try and get some information from the .bin file
- long lengthBytes = new System.IO.FileInfo(pathToDump).Length; // File size of the .bin file in bytes
- long lengthMB = lengthBytes / 1024 / 1024; // File size of the .bin file in MB
-
- // First, declare some variables to store for later use
- string PS5Version;
- string ConsoleModelInfo;
- string ModelInfo;
- string ConsoleSerialNumber;
- string MotherboardSerialNumber;
- string ConsoleModel;
- string WiFiMac;
- string LANMac;
-
- // Set the offsets of the BIN file
- long offsetOne = 0x1c7010;
- long offsetTwo = 0x1c7030;
- long serialOffset = 0x1c7210;
- long variantOffset = 0x1c7226;
- long moboSerialOffset = 0x1C7200;
- long WiFiMacOffset = 0x1C73C0;
- long LANMacOffset = 0x1C4020;
-
- // Declare the offset values (set them to null for now)
- string offsetOneValue = null;
- string offsetTwoValue = null;
- string serialValue = null;
- string variantValue = null;
- string moboSerialValue = null;
- string WiFiMacValue = null;
- string LANMacValue = null;
-
- #region Get PS5 version
- try
- {
- BinaryReader reader = new BinaryReader(new FileStream(pathToDump, FileMode.Open));
- //Set the position of the reader
- reader.BaseStream.Position = offsetOne;
- //Read the offset
- offsetOneValue = BitConverter.ToString(reader.ReadBytes(12)).Replace("-", null);
- reader.Close();
- }
- catch
- {
- // Obviously this value is invalid, so null the value and move on
- offsetOneValue = null;
- }
-
- try
- {
- BinaryReader reader = new BinaryReader(new FileStream(pathToDump, FileMode.Open));
- //Set the position of the reader
- reader.BaseStream.Position = offsetOne;
- //Read the offset
- offsetTwoValue = BitConverter.ToString(reader.ReadBytes(12)).Replace("-", null);
- reader.Close();
- }
- catch
- {
- // Obviously this value is invalid, so null the value and move on
- offsetTwoValue = null;
- }
-
- if (offsetOneValue.Contains("22020101"))
- {
- PS5Version = "Disc Edition";
- }
- else if (offsetTwoValue.Contains("22030101"))
- {
- PS5Version = "Digital Edition";
- }
- else if (offsetOneValue.Contains("22010101") || offsetTwoValue.Contains("22010101"))
- {
- PS5Version = "Slim Edition";
- }
- else
- {
- PS5Version = "Unknown Model";
- }
- #endregion
-
- #region Get console model and region
- try
- {
- using (BinaryReader reader = new BinaryReader(new FileStream(pathToDump, FileMode.Open)))
- {
- reader.BaseStream.Position = variantOffset;
- variantValue = BitConverter.ToString(reader.ReadBytes(19)).Replace("-", null).Replace("FF", null);
- }
- }
- catch
- {
- // Catch any exceptions and ignore, setting variantValue to null
- }
-
- ConsoleModelInfo = HexStringToString(variantValue);
-
- string region = "Unknown Region";
- if (ConsoleModelInfo != null && ConsoleModelInfo.Length >= 3)
- {
- string suffix = ConsoleModelInfo.Substring(ConsoleModelInfo.Length - 3);
- if (regionMap.ContainsKey(suffix))
- {
- region = regionMap[suffix];
- }
- }
-
- ModelInfo = HexStringToString(variantValue) + " - " + region;
- #endregion
-
- #region Get Console Serial Number
-
- try
- {
- BinaryReader reader = new BinaryReader(new FileStream(pathToDump, FileMode.Open));
- //Set the position of the reader
- reader.BaseStream.Position = serialOffset;
- //Read the offset
- serialValue = BitConverter.ToString(reader.ReadBytes(17)).Replace("-", null);
- reader.Close();
- }
- catch
- {
- // Obviously this value is invalid, so null the value and move on
- serialValue = null;
- }
-
-
-
- if (serialValue != null)
- {
- ConsoleSerialNumber = HexStringToString(serialValue);
- ConsoleSerialNumber = HexStringToString(serialValue);
-
- }
- else
- {
- ConsoleSerialNumber = "Unknown S/N";
- }
-
- #endregion
-
- #region Get Motherboard Serial Number
-
- try
- {
- BinaryReader reader = new BinaryReader(new FileStream(pathToDump, FileMode.Open));
- //Set the position of the reader
- reader.BaseStream.Position = moboSerialOffset;
- //Read the offset
- moboSerialValue = BitConverter.ToString(reader.ReadBytes(16)).Replace("-", null);
- reader.Close();
- }
- catch
- {
- // Obviously this value is invalid, so null the value and move on
- moboSerialValue = null;
- }
-
-
-
- if (moboSerialValue != null)
- {
- MotherboardSerialNumber = HexStringToString(moboSerialValue);
- }
- else
- {
- MotherboardSerialNumber = "Unknown S/N";
- }
-
- #endregion
-
- #region Extract WiFi Mac Address
-
- try
- {
- BinaryReader reader = new BinaryReader(new FileStream(pathToDump, FileMode.Open));
- //Set the position of the reader
- reader.BaseStream.Position = WiFiMacOffset;
- //Read the offset
- WiFiMacValue = BitConverter.ToString(reader.ReadBytes(6));
- reader.Close();
- }
- catch
- {
- // Obviously this value is invalid, so null the value and move on
- WiFiMacValue = null;
- }
-
- if (WiFiMacValue != null)
- {
- WiFiMac = WiFiMacValue;
- }
- else
- {
- WiFiMac = "Unknown Mac Address";
- }
-
- #endregion
-
- #region Extract LAN Mac Address
-
- try
- {
- BinaryReader reader = new BinaryReader(new FileStream(pathToDump, FileMode.Open));
- //Set the position of the reader
- reader.BaseStream.Position = LANMacOffset;
- //Read the offset
- LANMacValue = BitConverter.ToString(reader.ReadBytes(6));
- reader.Close();
- }
- catch
- {
- // Obviously this value is invalid, so null the value and move on
- LANMacValue = null;
- }
-
- if (LANMacValue != null)
- {
- LANMac = LANMacValue;
- }
- else
- {
- LANMac = "Unknown Mac Address";
- }
-
- #endregion
-
- #region Start show data for the BIOS dump
- // Start showing the data we've found to the user
- System.Console.WriteLine("File size: " + lengthBytes + " bytes (" + lengthMB + "MB)"); // The file size of the .bin file
- System.Console.WriteLine("PS5 Version: " + PS5Version); // Show the version info (disc/digital/slim)
- System.Console.WriteLine("Console Model: " + ModelInfo); // Show the console variant (CFI-XXXX)
- System.Console.WriteLine("Console Serial Number: " + ConsoleSerialNumber); // Show the serial number. This serial is the one the disc drive would use
- System.Console.WriteLine("Motherboard Serial Number: " + MotherboardSerialNumber); // Show the serial number to the motherboard. This is different to the console serial
- System.Console.WriteLine("WiFi Mac Address: " + WiFiMac); // WiFi mac address
- System.Console.WriteLine("LAN Mac Address: " + LANMac); // LAN mac address
- // Just a blank line
- System.Console.WriteLine("");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- #endregion
- break;
- }
- else
- {
- // No file has been selected. Let the user know
- System.Console.ForegroundColor = ConsoleColor.Red;
- System.Console.WriteLine("You must select a .bin file to read before proceeding. Please select a valid .bin file and try again.");
- System.Console.ResetColor();
- System.Console.WriteLine("");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- break;
- }
- #endregion
- #region Convert to "Digital" edition
- case "3":
- // First check to confirm that we've selected a file to work with
- if (!string.IsNullOrEmpty(pathToDump)) // If the pathToDump string isn't empty or null, we can try and work with it
- {
- bool confirmed = false;
- while (!confirmed)
- {
- System.Console.ForegroundColor = ConsoleColor.Blue;
- System.Console.WriteLine("Are you sure you want to set the console as \"Digital\" edition?");
- System.Console.ResetColor();
-
- System.Console.WriteLine("Type 'yes' to confirm or 'no' to cancel.");
-
- string changeConfirmation = System.Console.ReadLine().Trim().ToLower();
-
- // Check user input
- if (changeConfirmation == "yes")
- {
- string PS5Version; // String to store the PS5 version
-
- // Declare offsets to obtain current version info
- long offsetOne = 0x1c7010;
- long offsetTwo = 0x1c7030;
- string offsetOneValue = null;
- string offsetTwoValue = null;
-
- // Get PS5 version
- try
- {
- using (BinaryReader reader = new BinaryReader(new FileStream(pathToDump, FileMode.Open)))
- {
- reader.BaseStream.Position = offsetOne;
- offsetOneValue = BitConverter.ToString(reader.ReadBytes(4)).Replace("-", string.Empty);
-
- reader.BaseStream.Position = offsetTwo;
- offsetTwoValue = BitConverter.ToString(reader.ReadBytes(4)).Replace("-", string.Empty);
- }
- }
- catch (Exception ex)
- {
- // Handle any exceptions that occur while reading the file
- System.Console.WriteLine("Error reading the binary file: " + ex.Message);
- System.Console.WriteLine("Please try again! Press Enter to continue...");
- System.Console.ReadLine();
- confirmed = true;
- break;
- }
-
- if (offsetOneValue.Contains("22030101") || offsetTwoValue.Contains("22030101"))
- {
- // The BIOS file already contains digital edition flags
- System.Console.WriteLine("The .bin file you're working with is already a digital edition. No changes are needed.");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
-
- confirmed = true;
- break;
- }
- else
- {
- // Modify the values to set the file as "Digital Edition"
- try
- {
- byte[] find = ConvertHexStringToByteArray(Regex.Replace("22010101", "0x|[ ,]", string.Empty).Normalize().Trim());
- byte[] replace = ConvertHexStringToByteArray(Regex.Replace("22030101", "0x|[ ,]", string.Empty).Normalize().Trim());
-
- byte[] bytes = File.ReadAllBytes(pathToDump);
- foreach (int index in PatternAt(bytes, find))
- {
- for (int i = index, replaceIndex = 0; i < bytes.Length && replaceIndex < replace.Length; i++, replaceIndex++)
- {
- bytes[i] = replace[replaceIndex];
- }
- File.WriteAllBytes(pathToDump, bytes);
- }
-
- byte[] find2 = ConvertHexStringToByteArray(Regex.Replace("22020101", "0x|[ ,]", string.Empty).Normalize().Trim());
- byte[] replace2 = ConvertHexStringToByteArray(Regex.Replace("22030101", "0x|[ ,]", string.Empty).Normalize().Trim());
-
- foreach (int index in PatternAt(bytes, find2))
- {
- for (int i = index, replaceIndex = 0; i < bytes.Length && replaceIndex < replace.Length; i++, replaceIndex++)
- {
- bytes[i] = replace2[replaceIndex];
- }
- File.WriteAllBytes(pathToDump, bytes);
- }
-
- System.Console.WriteLine("Your BIOS file has been updated successfully. The new .bin file will now report to");
- System.Console.WriteLine("the PlayStation 5 as a 'digital edition' console.");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- confirmed = true;
- break;
- }
- catch (Exception ex)
- {
- // Handle any exceptions that occur while writing to the file
- System.Console.WriteLine("Error updating the binary file: " + ex.Message);
- System.Console.WriteLine("Please try again! Press Enter to continue...");
- System.Console.ReadLine();
- confirmed = true;
- break;
- }
- }
- }
- else if (changeConfirmation == "no")
- {
- // User cancelled. Break the loop and go back to the menu!
- confirmed = true;
- break;
- }
- else
- {
- System.Console.WriteLine("Invalid input. Please type 'yes' to confirm or 'no' to cancel.");
- }
- }
- }
- else
- {
- // No file has been selected. Let the user know
- System.Console.ForegroundColor = ConsoleColor.Red;
- System.Console.WriteLine("You must select a .bin file to read before proceeding. Please select a valid .bin file and try again.");
- System.Console.ResetColor();
- System.Console.WriteLine("");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- break;
- }
- break;
-
- #endregion
- #region Convert to "Disc" edition
- case "4":
- // First check to confirm that we've selected a file to work with
- if (!string.IsNullOrEmpty(pathToDump)) // If the pathToDump string isn't empty or null, we can try and work with it
- {
- bool confirmed = false;
- while (!confirmed)
- {
- System.Console.ForegroundColor = ConsoleColor.Blue;
- System.Console.WriteLine("Are you sure you want to set the console as \"Disc\" edition?");
- System.Console.ResetColor();
-
- System.Console.WriteLine("Type 'yes' to confirm or 'no' to cancel.");
-
- string changeConfirmation = System.Console.ReadLine().Trim().ToLower();
-
- // Check user input
- if (changeConfirmation == "yes")
- {
- string PS5Version; // String to store the PS5 version
-
- // Declare offsets to obtain current version info
- long offsetOne = 0x1c7010;
- long offsetTwo = 0x1c7030;
- string offsetOneValue = null;
- string offsetTwoValue = null;
-
- // Get PS5 version
- try
- {
- using (BinaryReader reader = new BinaryReader(new FileStream(pathToDump, FileMode.Open)))
- {
- reader.BaseStream.Position = offsetOne;
- offsetOneValue = BitConverter.ToString(reader.ReadBytes(4)).Replace("-", string.Empty);
-
- reader.BaseStream.Position = offsetTwo;
- offsetTwoValue = BitConverter.ToString(reader.ReadBytes(4)).Replace("-", string.Empty);
- }
- }
- catch (Exception ex)
- {
- // Handle any exceptions that occur while reading the file
- System.Console.WriteLine("Error reading the binary file: " + ex.Message);
- System.Console.WriteLine("Please try again! Press Enter to continue...");
- System.Console.ReadLine();
- confirmed = true;
- break;
- }
-
- if (offsetOneValue.Contains("22020101") || offsetTwoValue.Contains("22020101"))
- {
- // The BIOS file already contains disc edition flags
- System.Console.WriteLine("The .bin file you're working with is already a disc edition. No changes are needed.");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
-
- confirmed = true;
- break;
- }
- else
- {
- // Modify the values to set the file as "Disc Edition"
- try
- {
- byte[] find = ConvertHexStringToByteArray(Regex.Replace("22010101", "0x|[ ,]", string.Empty).Normalize().Trim());
- byte[] replace = ConvertHexStringToByteArray(Regex.Replace("22020101", "0x|[ ,]", string.Empty).Normalize().Trim());
-
- byte[] bytes = File.ReadAllBytes(pathToDump);
- foreach (int index in PatternAt(bytes, find))
- {
- for (int i = index, replaceIndex = 0; i < bytes.Length && replaceIndex < replace.Length; i++, replaceIndex++)
- {
- bytes[i] = replace[replaceIndex];
- }
- File.WriteAllBytes(pathToDump, bytes);
- }
-
- byte[] find2 = ConvertHexStringToByteArray(Regex.Replace("22030101", "0x|[ ,]", string.Empty).Normalize().Trim());
- byte[] replace2 = ConvertHexStringToByteArray(Regex.Replace("22020101", "0x|[ ,]", string.Empty).Normalize().Trim());
-
- foreach (int index in PatternAt(bytes, find2))
- {
- for (int i = index, replaceIndex = 0; i < bytes.Length && replaceIndex < replace.Length; i++, replaceIndex++)
- {
- bytes[i] = replace2[replaceIndex];
- }
- File.WriteAllBytes(pathToDump, bytes);
- }
-
- System.Console.WriteLine("Your BIOS file has been updated successfully. The new .bin file will now report to");
- System.Console.WriteLine("the PlayStation 5 as a 'disc edition' console.");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- confirmed = true;
- break;
- }
- catch (Exception ex)
- {
- // Handle any exceptions that occur while writing to the file
- System.Console.WriteLine("Error updating the binary file: " + ex.Message);
- System.Console.WriteLine("Please try again! Press Enter to continue...");
- System.Console.ReadLine();
- confirmed = true;
- break;
- }
- }
- }
- else if (changeConfirmation == "no")
- {
- // User cancelled. Break the loop and go back to the menu!
- confirmed = true;
- break;
- }
- else
- {
- System.Console.WriteLine("Invalid input. Please type 'yes' to confirm or 'no' to cancel.");
- }
- }
- }
- else
- {
- // No file has been selected. Let the user know
- System.Console.ForegroundColor = ConsoleColor.Red;
- System.Console.WriteLine("You must select a .bin file to read before proceeding. Please select a valid .bin file and try again.");
- System.Console.ResetColor();
- System.Console.WriteLine("");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- break;
- }
- break;
- #endregion
- #region Convert to "Slim" edition
- case "5":
- // First check to confirm that we've selected a file to work with
- if (!string.IsNullOrEmpty(pathToDump)) // If the pathToDump string isn't empty or null, we can try and work with it
- {
- bool confirmed = false;
- while (!confirmed)
- {
- System.Console.ForegroundColor = ConsoleColor.Blue;
- System.Console.WriteLine("Are you sure you want to set the console as \"Slim\" edition?");
- System.Console.ResetColor();
-
- System.Console.WriteLine("Type 'yes' to confirm or 'no' to cancel.");
-
- string changeConfirmation = System.Console.ReadLine().Trim().ToLower();
-
- // Check user input
- if (changeConfirmation == "yes")
- {
- string PS5Version; // String to store the PS5 version
-
- // Declare offsets to obtain current version info
- long offsetOne = 0x1c7010;
- long offsetTwo = 0x1c7030;
- string offsetOneValue = null;
- string offsetTwoValue = null;
-
- // Get PS5 version
- try
- {
- using (BinaryReader reader = new BinaryReader(new FileStream(pathToDump, FileMode.Open)))
- {
- reader.BaseStream.Position = offsetOne;
- offsetOneValue = BitConverter.ToString(reader.ReadBytes(4)).Replace("-", string.Empty);
-
- reader.BaseStream.Position = offsetTwo;
- offsetTwoValue = BitConverter.ToString(reader.ReadBytes(4)).Replace("-", string.Empty);
- }
- }
- catch (Exception ex)
- {
- // Handle any exceptions that occur while reading the file
- System.Console.WriteLine("Error reading the binary file: " + ex.Message);
- System.Console.WriteLine("Please try again! Press Enter to continue...");
- System.Console.ReadLine();
- confirmed = true;
- break;
- }
-
- if (offsetOneValue.Contains("22010101") || offsetTwoValue.Contains("22010101"))
- {
- // The BIOS file already contains slim edition flags
- System.Console.WriteLine("The .bin file you're working with is already a slim edition. No changes are needed.");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
-
- confirmed = true;
- break;
- }
- else
- {
- // Modify the values to set the file as "Slim Edition"
- try
- {
- byte[] find = ConvertHexStringToByteArray(Regex.Replace("22020101", "0x|[ ,]", string.Empty).Normalize().Trim());
- byte[] replace = ConvertHexStringToByteArray(Regex.Replace("22010101", "0x|[ ,]", string.Empty).Normalize().Trim());
-
- byte[] bytes = File.ReadAllBytes(pathToDump);
- foreach (int index in PatternAt(bytes, find))
- {
- for (int i = index, replaceIndex = 0; i < bytes.Length && replaceIndex < replace.Length; i++, replaceIndex++)
- {
- bytes[i] = replace[replaceIndex];
- }
- File.WriteAllBytes(pathToDump, bytes);
- }
-
- byte[] find2 = ConvertHexStringToByteArray(Regex.Replace("22030101", "0x|[ ,]", string.Empty).Normalize().Trim());
- byte[] replace2 = ConvertHexStringToByteArray(Regex.Replace("22010101", "0x|[ ,]", string.Empty).Normalize().Trim());
-
- foreach (int index in PatternAt(bytes, find2))
- {
- for (int i = index, replaceIndex = 0; i < bytes.Length && replaceIndex < replace.Length; i++, replaceIndex++)
- {
- bytes[i] = replace2[replaceIndex];
- }
- File.WriteAllBytes(pathToDump, bytes);
- }
-
- System.Console.WriteLine("Your BIOS file has been updated successfully. The new .bin file will now report to");
- System.Console.WriteLine("the PlayStation 5 as a 'slim edition' console.");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- confirmed = true;
- break;
- }
- catch (Exception ex)
- {
- // Handle any exceptions that occur while writing to the file
- System.Console.WriteLine("Error updating the binary file: " + ex.Message);
- System.Console.WriteLine("Please try again! Press Enter to continue...");
- System.Console.ReadLine();
- confirmed = true;
- break;
- }
- }
- }
- else if (changeConfirmation == "no")
- {
- // User cancelled. Break the loop and go back to the menu!
- confirmed = true;
- break;
- }
- else
- {
- System.Console.WriteLine("Invalid input. Please type 'yes' to confirm or 'no' to cancel.");
- }
- }
- }
- else
- {
- // No file has been selected. Let the user know
- System.Console.ForegroundColor = ConsoleColor.Red;
- System.Console.WriteLine("You must select a .bin file to read before proceeding. Please select a valid .bin file and try again.");
- System.Console.ResetColor();
- System.Console.WriteLine("");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- break;
- }
- break;
- #endregion
- #region Change serial number
- case "6":
- if (!string.IsNullOrEmpty(pathToDump)) // If the pathToDump string isn't empty or null, we can try and work with it
- {
- // Create a true false to allow us to loop until the user changes the serial or cancels the operation
- bool jobDone = false;
-
- while (!jobDone)
- {
- // Set the serial number offset and value
- long serialOffset = 0x1c7210;
- string oldSerial = null;
- try
- {
- using (BinaryReader reader = new BinaryReader(new FileStream(pathToDump, FileMode.Open)))
- {
- //Set the position of the reader
- reader.BaseStream.Position = serialOffset;
- //Read the offset
- oldSerial = Encoding.UTF8.GetString(reader.ReadBytes(17));
- }
- }
- catch
- {
- // Obviously this value is invalid, so null the value and move on
- oldSerial = null;
- }
-
- bool newSerialValid = false;
- while (!newSerialValid)
- {
- System.Console.ForegroundColor = ConsoleColor.Blue;
- System.Console.WriteLine("Enter the new serial number you would like to save (type 'exit' to exit): ");
- System.Console.ResetColor();
-
- string newSerial = System.Console.ReadLine().Trim();
-
- if (newSerial == "")
- {
- // The serial number is blank
- System.Console.WriteLine("Invalid serial number entered. The new serial should be characters and letters.");
- }
- else if (newSerial == oldSerial)
- {
- System.Console.WriteLine("The new serial number matches the old serial number. Please enter a different value and try again...");
- }
- else if (newSerial == "exit")
- {
- jobDone = true;
- break;
- }
- else
- {
- try
- {
- byte[] existingFile;
- using (BinaryReader reader = new BinaryReader(new FileStream(pathToDump, FileMode.Open)))
- {
- // Get the contents of the dump into memory
- existingFile = reader.ReadBytes((int)reader.BaseStream.Length);
- }
-
- byte[] oldSerialBytes = Encoding.UTF8.GetBytes(oldSerial);
- byte[] newSerialBytes = Encoding.UTF8.GetBytes(newSerial);
-
- // Ensure the new serial number is either padded or truncated to fit 17 characters
- byte[] newSerialBytesPadded = new byte[17];
- Array.Copy(newSerialBytes, newSerialBytesPadded, Math.Min(newSerialBytes.Length, 17));
-
- // Find the index of the old serial number in the file
- int index = PatternAt(existingFile, oldSerialBytes).FirstOrDefault();
-
- if (index != -1)
- {
- // Replace the old serial number with the new one
- for (int i = 0; i < newSerialBytesPadded.Length; i++)
- {
- existingFile[index + i] = newSerialBytesPadded[i];
- }
-
- // Write modified bytes back to the file
- using (BinaryWriter writer = new BinaryWriter(new FileStream(pathToDump, FileMode.Create)))
- {
- writer.Write(existingFile);
- }
-
- System.Console.WriteLine("SUCCESS: The new serial number has been updated successfully. Press enter to continue...");
- System.Console.ReadLine();
- jobDone = true;
- break;
- }
- else
- {
- System.Console.WriteLine("Failed to find the old serial number in the file. Aborting...");
- jobDone = true;
- }
- }
- catch (System.ArgumentException ex)
- {
- // Something went wrong. Notify the user
- System.Console.ForegroundColor = ConsoleColor.Red;
- System.Console.WriteLine("An error occurred while attempting to make changes to your dump file. Please try again.");
- System.Console.ResetColor();
- }
- }
- }
- }
- }
- else
- {
- // No file has been selected. Let the user know
- System.Console.ForegroundColor = ConsoleColor.Red;
- System.Console.WriteLine("You must select a .bin file to read before proceeding. Please select a valid .bin file and try again.");
- System.Console.ResetColor();
- System.Console.WriteLine("");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- break;
- }
- break;
- #endregion
- #region Change motherboard serial number
- case "7":
- if (!string.IsNullOrEmpty(pathToDump)) // If the pathToDump string isn't empty or null, we can try and work with it
- {
- // Declare variables to store console serial
- long moboOffset = 0x1C7200;
- string moboValue = null;
- string MotherboardSerial;
-
- try
- {
- using (BinaryReader reader = new BinaryReader(new FileStream(pathToDump, FileMode.Open)))
- {
- reader.BaseStream.Position = moboOffset;
- moboValue = BitConverter.ToString(reader.ReadBytes(16)).Replace("-", null);
- }
- }
- catch
- {
- // Catch any exceptions and ignore, setting MotherboardSerial to null
- }
-
- MotherboardSerial = HexStringToString(moboValue);
-
- if (!string.IsNullOrEmpty(moboValue) != null && !string.IsNullOrEmpty(MotherboardSerial))
- {
- // Create a loop to prevent the app from returning to the main menu
- bool isDone = false;
- while (!isDone)
- {
- // Show the current motherboard serial to the user
- System.Console.ForegroundColor = ConsoleColor.Blue;
- System.Console.WriteLine("Current motherboard serial: " + MotherboardSerial);
- System.Console.ResetColor();
-
- // Ask the user to enter the new serial number
- System.Console.WriteLine("Please enter a new motherboard serial number (type 'exit' to go back): ");
-
- string newSerial = System.Console.ReadLine();
-
- if (string.IsNullOrEmpty(newSerial))
- {
- // The user did not enter a valid string
- System.Console.WriteLine("Please enter a valid model number to continue...");
- }
- else if (newSerial.Length != 16)
- {
- // The entered serial number is an invalid length
- System.Console.WriteLine("The new motherboard serial you entered is invalid. The motherboard serial should be exactly 16 characters in length.");
- }
- else if (newSerial == "exit")
- {
- // The user wants to exit this menu
- isDone = true;
- break;
- }
- else
- {
- // Everything seems OK. Now we can change the serial number
- try
- {
- byte[] oldSerial = Encoding.UTF8.GetBytes(MotherboardSerial);
- string oldSerialHex = Convert.ToHexString(oldSerial);
-
- byte[] newSerialBytes = Encoding.UTF8.GetBytes(newSerial);
- string newSerialHex = Convert.ToHexString(newSerialBytes);
-
- byte[] find = ConvertHexStringToByteArray(Regex.Replace(oldSerialHex, "0x|[ ,]", string.Empty).Normalize().Trim());
- byte[] replace = ConvertHexStringToByteArray(Regex.Replace(newSerialHex, "0x|[ ,]", string.Empty).Normalize().Trim());
-
- byte[] bytes = File.ReadAllBytes(pathToDump);
- foreach (int index in PatternAt(bytes, find))
- {
- for (int i = index, replaceIndex = 0; i < bytes.Length && replaceIndex < replace.Length; i++, replaceIndex++)
- {
- bytes[i] = replace[replaceIndex];
- }
- File.WriteAllBytes(pathToDump, bytes);
- }
-
- System.Console.WriteLine("The new motherboard serial number you entered been saved successfully.");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- isDone = true;
- break;
-
- }
- catch (System.ArgumentException ex)
- {
- System.Console.WriteLine("An error occurred while writing to the BIOS dump. Please try again..." + ex.Message);
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- isDone = true;
- break;
- }
- }
- }
- }
- else
- {
- // No file has been selected. Let the user know
- System.Console.ForegroundColor = ConsoleColor.Red;
- System.Console.WriteLine("Could not parse your selected .bin file. Please ensure your selected file is a valid PlayStation 5 file and try again.");
- System.Console.ResetColor();
- System.Console.WriteLine("");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- break;
- }
-
- }
- else
- {
- // No file has been selected. Let the user know
- System.Console.ForegroundColor = ConsoleColor.Red;
- System.Console.WriteLine("You must select a .bin file to read before proceeding. Please select a valid .bin file and try again.");
- System.Console.ResetColor();
- System.Console.WriteLine("");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- break;
- }
- break;
- #endregion
- #region Change console model
- case "8":
-
- if (!string.IsNullOrEmpty(pathToDump)) // If the pathToDump string isn't empty or null, we can try and work with it
- {
- // Declare variables to store console model
- long variantOffset = 0x1c7226;
- string variantValue = null;
- string ConsoleModel;
-
- try
- {
- using (BinaryReader reader = new BinaryReader(new FileStream(pathToDump, FileMode.Open)))
- {
- reader.BaseStream.Position = variantOffset;
- variantValue = BitConverter.ToString(reader.ReadBytes(19)).Replace("-", null).Replace("FF", null);
- }
- }
- catch
- {
- // Catch any exceptions and ignore, setting variantValue to null
- }
-
- ConsoleModel = HexStringToString(variantValue);
-
- if(!string.IsNullOrEmpty(variantValue) != null && !string.IsNullOrEmpty(ConsoleModel))
- {
- // Create a loop to prevent the app from returning to the main menu
- bool isDone = false;
- while (!isDone)
- {
- // Show the current model to the user
- System.Console.ForegroundColor = ConsoleColor.Blue;
- System.Console.WriteLine("Current model: " + ConsoleModel);
- System.Console.ResetColor();
-
- // Ask the user to enter the new model
- System.Console.WriteLine("Please enter the model you would like to set your dump file to (type 'exit' to go back): ");
-
- string newModel = System.Console.ReadLine();
-
- if (string.IsNullOrEmpty(newModel))
- {
- // The user did not enter a valid string
- System.Console.WriteLine("Please enter a valid model number to continue...");
- } else if (newModel.Length < 9)
- {
- // The entered model is an invalid length
- System.Console.WriteLine("The new model you entered is invalid. The model should be 9 characters long starting with 'CFI-', followed by 4 numbers and a letter.");
- }else if (!newModel.StartsWith("CFI-"))
- {
- System.Console.WriteLine("The new model you entered is invalid. The model should be 9 characters long starting with 'CFI-', followed by 4 numbers and a letter.");
- }else if (newModel == "exit")
- {
- // The user wants to exit this menu
- isDone = true;
- break;
- }
- else
- {
- // Everything seems OK. Now we can change the model
- try
- {
- byte[] oldModel = Encoding.UTF8.GetBytes(ConsoleModel);
- string oldModelHex = Convert.ToHexString(oldModel);
-
- byte[] newModelBytes = Encoding.UTF8.GetBytes(newModel);
- string newModelHex = Convert.ToHexString(newModelBytes);
-
- byte[] find = ConvertHexStringToByteArray(Regex.Replace(oldModelHex, "0x|[ ,]", string.Empty).Normalize().Trim());
- byte[] replace = ConvertHexStringToByteArray(Regex.Replace(newModelHex, "0x|[ ,]", string.Empty).Normalize().Trim());
-
- byte[] bytes = File.ReadAllBytes(pathToDump);
- foreach (int index in PatternAt(bytes, find))
- {
- for (int i = index, replaceIndex = 0; i < bytes.Length && replaceIndex < replace.Length; i++, replaceIndex++)
- {
- bytes[i] = replace[replaceIndex];
- }
- File.WriteAllBytes(pathToDump, bytes);
- }
-
- System.Console.WriteLine("The new console model you chose has been saved successfully.");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- isDone = true;
- break;
-
- }
- catch (System.ArgumentException ex)
- {
- System.Console.WriteLine("An error occurred while writing to the BIOS dump. Please try again..." + ex.Message);
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- isDone = true;
- break;
- }
- }
- }
- }
- else
- {
- // No file has been selected. Let the user know
- System.Console.ForegroundColor = ConsoleColor.Red;
- System.Console.WriteLine("Could not parse your selected .bin file. Please ensure your selected file is a valid PlayStation 5 file and try again.");
- System.Console.ResetColor();
- System.Console.WriteLine("");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- break;
- }
-
- }
- else
- {
- // No file has been selected. Let the user know
- System.Console.ForegroundColor = ConsoleColor.Red;
- System.Console.WriteLine("You must select a .bin file to read before proceeding. Please select a valid .bin file and try again.");
- System.Console.ResetColor();
- System.Console.WriteLine("");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- break;
- }
- break;
- #endregion
- #region Exit sub menu
- // I put two cases here for the exit option, one for capital "X" and one for lower case.
- case "X":
- // We should reset the app title first!
- System.Console.Title = appTitle;
- subMenuRunning = false;
- break;
- case "x":
- // We should reset the app title first!
- System.Console.Title = appTitle;
- subMenuRunning = false;
- break;
- #endregion
- }
- }
-
-}
- #endregion
-
-#region Main
-static bool MainMenu(string appTitle, Dictionary regionMap)
-{
-
- System.Console.Clear();
- ShowHeader();
- System.Console.ForegroundColor = ConsoleColor.Red;
- System.Console.WriteLine("Choose an option:");
- System.Console.ResetColor();
- System.Console.WriteLine("1. Get error codes from PS5");
- System.Console.WriteLine("2. Clear error codes on PS5");
- System.Console.WriteLine("3. Enter custom UART command");
- System.Console.WriteLine("4. BIOS Dump Tools");
- System.Console.WriteLine("5. View readme guide");
- // Thanks for leaving this here!
- System.Console.ForegroundColor = ConsoleColor.Green;
- System.Console.WriteLine("6. Buy TheCod3r a coffee");
- System.Console.ResetColor();
- System.Console.WriteLine("7. Update error database");
- System.Console.WriteLine("X. Exit application");
- System.Console.ForegroundColor = ConsoleColor.Red;
- System.Console.Write("\nEnter your choice: ");
- System.Console.ResetColor();
-
- #region Menu Options
- switch (System.Console.ReadLine())
- {
- #region Get Error Codes From PS5
- case "1":
- // Declare a variable to store the selected COM port
- string selectedPort;
- // Declare a string array for a list of available port names
- string[] ports = SerialPort.GetPortNames();
-
- // No COM ports found. Let the user know and go back to the main menu
- if (ports.Length == 0)
- {
- System.Console.WriteLine("No communication devices were found on this system.");
- System.Console.WriteLine("Please insert a UART compatible device and try again.");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- return true;
- }
-
- // Devices were found. Iterate through and present them in the form of a menu
- System.Console.WriteLine("Available devices:");
- for (int i = 0; i < ports.Length; i++)
- {
- string friendlyName = GetFriendlyName(ports[i]);
- System.Console.WriteLine($"{i + 1}. {ports[i]} - {friendlyName}");
- }
-
- // Declare an integer for the index of the selected port
- int selectedPortIndex;
- // Add each port to the ports array
- do
- {
- System.Console.WriteLine("");
- System.Console.Write("Enter the number of the COM port you want to use: ");
- } while (!int.TryParse(System.Console.ReadLine(), out selectedPortIndex) || selectedPortIndex < 1 || selectedPortIndex > ports.Length);
-
- // Get the selected port and store it inside the selectedPort string
- selectedPort = ports[selectedPortIndex - 1];
-
- // Select and lock the chosen device
- SerialPort serialPort = new SerialPort(selectedPort);
- // Configure settings for the selected device
- serialPort.BaudRate = 115200; // The PS5 requires a BAUD rate of 115200
- serialPort.RtsEnable = true; // We need to enable ready to send (RTS) mode
- // Now we can get a list of error codes. We're going to wrap this in a try loop to prevent unexpected crashes
- try
- {
- // Open the selected port for use
- serialPort.Open();
- // Let's display the selected port (change the color to blue) so the user is aware of what device is in use
- System.Console.ForegroundColor = ConsoleColor.Blue;
- System.Console.WriteLine("Selected port: " + GetFriendlyName(selectedPort));
- // Reset the foreground color to default before proceeding
- System.Console.ResetColor();
-
- // Let's start grabbing error codes from the PS5
- int loopLimit = 10;
- // Create a list to store error codes in
- List UARTLines = new();
-
- // When grabbing error codes, we want to grab the first 10 errors from the system. Let's create a loop
- for (var i = 0; i <= loopLimit; i++)
- {
- // Create a command variable depending on what number we're at in the loop (where "i" is the current number)
- var command = $"errlog {i}";
- // Add the checksum to the command
- var checksum = CalculateChecksum(command);
- // Send the current command to the UART device
- serialPort.WriteLine(checksum);
-
- // Read the UART response
- var line = serialPort.ReadLine();
-
- // Ensure we have a valid response, then add it to the errors list
- if (!string.Equals($"{command}:{checksum:X2}", line, StringComparison.InvariantCultureIgnoreCase))
- {
- if (!line.Contains("errlog"))
- {
- // Let's make sure we haven't already added the same error code to the error list
- // This way we only show each error code once and keep the output window clean
- if (!UARTLines.Contains(line))
- {
- UARTLines.Add(line);
- }
- }
- }
- }
-
- // Now let's iterate through the lines and show them to the user
- foreach (var l in UARTLines)
- {
- var split = l.Split(' ');
- if (!split.Any()) continue;
- switch (split[0])
- {
- case "NG":
- break;
- case "OK":
- var errorCode = split[2];
- if (errorCode.StartsWith("FFFFFF"))
- {
- // The returned code is blank
- System.Console.ForegroundColor = ConsoleColor.Blue;
- System.Console.WriteLine("No error displayed");
- System.Console.ResetColor();
- }
- else
- {
- // Now that the error code has been isolated from the rest of the junk sent by the system
- // let's check it against the database. The error database will need to return XML results
- System.Console.ForegroundColor = ConsoleColor.Green;
- string errorResult = ParseErrors(errorCode);
- System.Console.WriteLine(errorResult);
- System.Console.ResetColor();
- }
- break;
- default:
- break;
- }
- }
-
- // Wait for user input
- System.Console.WriteLine("");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
-
- // Before exiting, close and free up the selected device
- serialPort.Close();
- }
- catch (Exception ex)
- {
- System.Console.WriteLine("An error occurred while connecting to your selected device.");
- System.Console.WriteLine("Error details:");
- System.Console.WriteLine(ex.Message);
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- }
-
- return true;
- #endregion
- #region Clear UART codes
- case "2":
- // Declare a string array for a list of available port names
- ports = SerialPort.GetPortNames();
-
- // No COM ports found. Let the user know and go back to the main menu
- if (ports.Length == 0)
- {
- System.Console.WriteLine("No communication devices were found on this system.");
- System.Console.WriteLine("Please insert a UART compatible device and try again.");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- return true;
- }
-
- // Devices were found. Iterate through and present them in the form of a menu
- System.Console.WriteLine("Available devices:");
- for (int i = 0; i < ports.Length; i++)
- {
- string friendlyName = GetFriendlyName(ports[i]);
- System.Console.WriteLine($"{i + 1}. {ports[i]} - {friendlyName}");
- }
-
- // Add each port to the ports array
- do
- {
- System.Console.WriteLine("");
- System.Console.Write("Enter the number of the COM port you want to use: ");
- } while (!int.TryParse(System.Console.ReadLine(), out selectedPortIndex) || selectedPortIndex < 1 || selectedPortIndex > ports.Length);
-
- // Get the selected port and store it inside the selectedPort string
- selectedPort = ports[selectedPortIndex - 1];
-
- // Select and lock the chosen device
- serialPort = new SerialPort(selectedPort);
- // Configure settings for the selected device
- serialPort.BaudRate = 115200; // The PS5 requires a BAUD rate of 115200
- serialPort.RtsEnable = true; // We need to enable ready to send (RTS) mode
- // Now we can wipe the error codes. We're going to wrap this in a try loop to prevent unexpected crashes
- try
- {
- // Open the selected port for use
- serialPort.Open();
- // Let's display the selected port (change the color to blue) so the user is aware of what device is in use
- System.Console.ForegroundColor = ConsoleColor.Blue;
- System.Console.WriteLine("Selected port: " + GetFriendlyName(selectedPort));
- // Reset the foreground color to default before proceeding
- System.Console.ResetColor();
-
- var checksum = CalculateChecksum("errlog clear");
- serialPort.WriteLine(checksum);
-
- List UARTLines = new();
-
- do
- {
- var line = serialPort.ReadLine();
- UARTLines.Add(line);
- } while (serialPort.BytesToRead != 0);
-
- foreach (var l in UARTLines)
- {
- System.Console.WriteLine(l);
- }
-
- System.Console.WriteLine("Press Enter to continue...");
-
- // Job done. Continue
- System.Console.ReadLine();
-
- // Before exiting, close and free up the selected device
- serialPort.Close();
- }
- catch (Exception ex)
- {
- System.Console.WriteLine("An error occurred while connecting to your selected device.");
- System.Console.WriteLine("Error details:");
- System.Console.WriteLine(ex.Message);
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- }
- return true;
- #endregion
- #region Custom UART command
- case "3":
- // Declare a string array for a list of available port names
- ports = SerialPort.GetPortNames();
-
- // No COM ports found. Let the user know and go back to the main menu
- if (ports.Length == 0)
- {
- System.Console.WriteLine("No communication devices were found on this system.");
- System.Console.WriteLine("Please insert a UART compatible device and try again.");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- return true;
- }
-
- // Devices were found. Iterate through and present them in the form of a menu
- System.Console.WriteLine("Available devices:");
- for (int i = 0; i < ports.Length; i++)
- {
- string friendlyName = GetFriendlyName(ports[i]);
- System.Console.WriteLine($"{i + 1}. {ports[i]} - {friendlyName}");
- }
-
- // Add each port to the ports array
- do
- {
- System.Console.WriteLine("");
- System.Console.Write("Enter the number of the COM port you want to use: ");
- } while (!int.TryParse(System.Console.ReadLine(), out selectedPortIndex) || selectedPortIndex < 1 || selectedPortIndex > ports.Length);
-
- // Get the selected port and store it inside the selectedPort string
- selectedPort = ports[selectedPortIndex - 1];
-
- // Select and lock the chosen device
- serialPort = new SerialPort(selectedPort);
- // Configure settings for the selected device
- serialPort.BaudRate = 115200; // The PS5 requires a BAUD rate of 115200
- serialPort.RtsEnable = true; // We need to enable ready to send (RTS) mode
-
- // Now we can run the custom command. We're going to wrap this in a try loop to prevent unexpected crashes
- try
- {
- // Open the selected port for use
- serialPort.Open();
- // Let's display the selected port (change the color to blue) so the user is aware of what device is in use
- System.Console.ForegroundColor = ConsoleColor.Blue;
- System.Console.WriteLine("Selected port: " + GetFriendlyName(selectedPort));
- // Reset the foreground color to default before proceeding
- System.Console.ResetColor();
-
- while (true) // Loop until user provides a valid command or 'exit'
- {
- // Ask the user for their custom UART command
- System.Console.Write("Please enter a custom command to send (type exit to quit): ");
- // Get the command which the user entered
- string UARTCommand = System.Console.ReadLine();
-
- // If the user types exit, we want to return to the main menu
- if (UARTCommand == "exit")
- {
- break; // Exit the while loop and return to the main menu
- }
- else if (!string.IsNullOrEmpty(UARTCommand)) // If the command is not empty or null
- {
- var checksum = CalculateChecksum(UARTCommand);
- serialPort.WriteLine(checksum);
-
- List UARTLines = new();
-
- do
- {
- var line = serialPort.ReadLine();
- UARTLines.Add(line);
- } while (serialPort.BytesToRead != 0);
-
- foreach (var l in UARTLines)
- {
- System.Console.WriteLine(l);
- }
-
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- }
- else
- {
- // The user didn't type anything. We need to ask them to type their command again!
- System.Console.WriteLine("Please enter a valid command.");
- }
- }
-
- // Before exiting, close and free up the selected device
- serialPort.Close();
- }
- catch (Exception ex)
- {
- System.Console.WriteLine("An error occurred while connecting to your selected device.");
- System.Console.WriteLine("Error details:");
- System.Console.WriteLine(ex.Message);
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- }
- return true;
- #endregion
- #region BIOS Dump Tools (Sub Menu)
- case "4":
- // This is a sub menu for working with BIOS files. IMO it's not very elegant to have sub menus but at least this way
- // we don't have to use different apps for working with BIOS files...
-
- RunSubMenu(appTitle, regionMap);
- return true;
- #endregion
- #region Launch readme
- case "5":
- System.Console.WriteLine("UARL-CL is designed with simplicity in mind. This command line application makes it quick and easy");
- System.Console.WriteLine("to obtain error codes from your PlayStation 5 console.");
- System.Console.WriteLine("UART stands for Universal Asynchronous Receiver-Transmitter. UART allows you to send and receive commands");
- System.Console.WriteLine("to any compatible serial communications device.");
- System.Console.WriteLine();
- System.Console.WriteLine("The PlayStation 5 has UART functionality built in. Unfortunately Sony don't make it easy to understand what");
- System.Console.WriteLine("is happening with the machine when you request error codes, which is why this application exists. UART-CL is");
- System.Console.WriteLine("a command-line spin off to the PS5 NOR and UART tool for Windows, which allows you to communicate via serial");
- System.Console.WriteLine("to your PlayStation 5. You can grab error codes from the system at the click of a button (well, a few clicks)");
- System.Console.WriteLine("and the software will automatically check the error codes received and attempt to convert them into plain text.");
- System.Console.WriteLine("This is done by splitting the error codes up into useful sections and then comparing those error codes against a");
- System.Console.WriteLine("database of codes collected by the repair community. If the code exists in the database, the application will");
- System.Console.WriteLine("automatically grab the error details and output them for you on the screen so you can figure out your next move.");
- System.Console.WriteLine("");
- System.Console.WriteLine("Where does the database come from?");
- System.Console.WriteLine("The database is downloaded on first launch from uartcodes.com/xml.php. The download page is hosted by \"TheCod3r\"");
- System.Console.WriteLine("for free and is simply a PHP script which fetches all known error codes from the uartcodes.com database and converts");
- System.Console.WriteLine("them into an XML document. An XML document makes it quick and easy to work with and it's a more elegant solution to");
- System.Console.WriteLine("provide a database which doesn't rely on an internet connection. It can also be updated whenever you like, free of charge.");
- System.Console.WriteLine("");
- System.Console.WriteLine("How do I use this to fix my PS5?");
- System.Console.WriteLine("You'll need a compatible serial communication (UART) device first of all. Most devices that have a transmit, receive, and");
- System.Console.WriteLine("ground pin and that can provide 3.3v instead of 5v should work, and you can buy one for a few bucks on eBay, Amazon or AliExpress.");
- System.Console.WriteLine("");
- System.Console.WriteLine("Once you have a compatible device, you'll need to:");
- System.Console.WriteLine("Solder the transmit pin on the device to the receive pin on the PS5.");
- System.Console.WriteLine("Solder the receive pin on the device to the transmit pin on the PS5.");
- System.Console.WriteLine("Solder ground on the device to ground on the PS5.");
- System.Console.WriteLine("Connect the PS5 power chord to the PS5 power supply (do not turn on the console)");
- System.Console.WriteLine("Use this software and select either option 1, 2 or 3 to run commands.");
- System.Console.WriteLine("Choose your device from the list of available devices.");
- System.Console.WriteLine("Let the software do the rest. Then working out a plan for the actual repair is up to you. We can't do everything ;)");
- System.Console.WriteLine("");
- System.Console.WriteLine("As a personal note from myself (TheCod3r). I want to thank you for trusting my software. I'm an electronics technician primarily");
- System.Console.WriteLine("and I write code for fun (ironic since my name is TheCod3r, I know!). I would also like to thank the following people for inspiring me:");
- System.Console.WriteLine("");
- System.Console.WriteLine("Louis Rossmann, FightToRepair.org, Jessa Jones (iPad Rehab), Andy-Man (PS5 Wee Tools), my YouTube viewers, my Patreon supporters and my mom!");
- System.Console.WriteLine("");
- System.Console.WriteLine("#FuckBwE");
- System.Console.WriteLine("Be sure to use the hashtag. It really pisses him off!");
-
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- return true;
- #endregion
- #region Buy me a coffee
- case "6":
- // Thanks for buying me a coffee :)
- System.Console.WriteLine("Thanks for buying me a coffee. I'll redirect you in your default browser...");
- OpenUrl("https://www.streamelements.com/thecod3r/tip");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- return true;
- #endregion
- #region Update XML database
- case "7":
- System.Console.WriteLine("Downloading latest database file. Please wait...");
-
- bool success = DownloadDatabase("http://uartcodes.com/xml.php", "errorDB.xml");
-
- if (success)
- {
- System.Console.WriteLine("Database downloaded successfully...");
- System.Console.WriteLine("Press Enter to continue...");
- }
- else
- {
- System.Console.WriteLine("Could not download the latest database file. Please ensure you're connected to the internet!");
- System.Console.WriteLine("Press Enter to continue...");
- }
- System.Console.ReadLine();
- return true;
- default:
- System.Console.WriteLine("Invalid choice. Please try again.");
- System.Console.WriteLine("Press Enter to continue...");
- System.Console.ReadLine();
- return true;
- #endregion
- #region Exit Application
- case "X":
- // Run the exit environment command to close the application
- Environment.Exit(0);
- return true;
- case "x":
- // Run the exit environment command to close the application
- Environment.Exit(0);
- return true;
- #endregion
- }
- #endregion
-}
-#endregion
\ No newline at end of file
diff --git a/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/ClickOnceProfile.pubxml b/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/ClickOnceProfile.pubxml
deleted file mode 100644
index bd9b02b..0000000
--- a/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/ClickOnceProfile.pubxml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
- 2
- 1.1.0.*
- True
- Release
- True
- False
- true
- True
- Disk
- True
- False
- True
- False
- Any CPU
- UART-CL
- bin\Release\net6.0\publish\
- bin\Release\net6.0\publish\
- TheCod3r
- ClickOnce
- False
- True
- win-x64
- True
- (none)
- False
- net6.0
- False
- Foreground
- False
- Publish.html
- True|2024-04-28T21:23:14.6592026Z;
-
-
\ No newline at end of file
diff --git a/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/ClickOnceProfile.pubxml.user b/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/ClickOnceProfile.pubxml.user
deleted file mode 100644
index 06d5275..0000000
--- a/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/ClickOnceProfile.pubxml.user
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- True|2024-04-28T21:28:11.6019250Z;True|2024-04-28T22:23:14.6592026+01:00;
-
-
-
\ No newline at end of file
diff --git a/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/FolderProfile.pubxml b/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/FolderProfile.pubxml
deleted file mode 100644
index 6a06ec5..0000000
--- a/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/FolderProfile.pubxml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
- Release
- Any CPU
- bin\Release\net6.0\publish\linux-x64\
- FileSystem
- <_TargetId>Folder
- net6.0
- linux-x64
- true
- true
- false
-
-
\ No newline at end of file
diff --git a/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/FolderProfile.pubxml.user b/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/FolderProfile.pubxml.user
deleted file mode 100644
index 49493e8..0000000
--- a/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/FolderProfile.pubxml.user
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/FolderProfile1.pubxml b/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/FolderProfile1.pubxml
deleted file mode 100644
index 6a06ec5..0000000
--- a/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/FolderProfile1.pubxml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
- Release
- Any CPU
- bin\Release\net6.0\publish\linux-x64\
- FileSystem
- <_TargetId>Folder
- net6.0
- linux-x64
- true
- true
- false
-
-
\ No newline at end of file
diff --git a/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/FolderProfile1.pubxml.user b/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/FolderProfile1.pubxml.user
deleted file mode 100644
index 95a4630..0000000
--- a/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/FolderProfile1.pubxml.user
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- True|2024-04-28T21:03:32.2559262Z;True|2024-04-27T00:21:15.8137671+01:00;
-
-
-
\ No newline at end of file
diff --git a/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/FolderProfile2.pubxml b/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/FolderProfile2.pubxml
deleted file mode 100644
index 34d5e59..0000000
--- a/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/FolderProfile2.pubxml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
- Release
- Any CPU
- bin\Release\net6.0\publish\
- FileSystem
- <_TargetId>Folder
-
-
\ No newline at end of file
diff --git a/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/FolderProfile2.pubxml.user b/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/FolderProfile2.pubxml.user
deleted file mode 100644
index 2dd8787..0000000
--- a/UART-CL By TheCod3r/UART-CL By TheCod3r/Properties/PublishProfiles/FolderProfile2.pubxml.user
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
diff --git a/UART-CL By TheCod3r/UART-CL By TheCod3r/UART-CL By TheCod3r.csproj.user b/UART-CL By TheCod3r/UART-CL By TheCod3r/UART-CL By TheCod3r.csproj.user
deleted file mode 100644
index 3ef4fb8..0000000
--- a/UART-CL By TheCod3r/UART-CL By TheCod3r/UART-CL By TheCod3r.csproj.user
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- <_LastSelectedProfileId>C:\Users\TheCod3r\source\repos\UART-CL By TheCod3r\UART-CL By TheCod3r\Properties\PublishProfiles\ClickOnceProfile.pubxml
-
-
\ No newline at end of file
diff --git a/UART-CL_By_TheCod3r/Menus/BIOSMenu.cs b/UART-CL_By_TheCod3r/Menus/BIOSMenu.cs
new file mode 100644
index 0000000..31f71b8
--- /dev/null
+++ b/UART-CL_By_TheCod3r/Menus/BIOSMenu.cs
@@ -0,0 +1,306 @@
+using PS5Lib;
+
+namespace UART_CL;
+
+public class BIOSMenu : Menu
+{
+ private NORData? _norData = null;
+
+ public BIOSMenu()
+ {
+ Title = "Edit BIOS";
+ Description = "In order to work with a BIOS dump file, you will need to load it into memory first.\n" +
+ "Be sure to choose a file to work with by choosing option 1 before choosing any other option.";
+ Items =
+ [
+ new MenuItem
+ {
+ Name = "Load a BIOS dump (.bin)",
+ Color = ConsoleColor.Green,
+ Action = LoadBIOS
+ },
+ new MenuItem
+ {
+ Name = "View BIOS Information",
+ Action = ViewBIOS
+ },
+ new MenuItem
+ {
+ Name = "Convert to Digital edition",
+ Action = () => ChangeEdition(Editions.Digital)
+ },
+ new MenuItem
+ {
+ Name = "Convert to Disc edition",
+ Action = () => ChangeEdition(Editions.Disc)
+ },
+ new MenuItem
+ {
+ Name = "Convert to Slim edition",
+ Action = () => ChangeEdition(Editions.Slim)
+ },
+ new MenuItem
+ {
+ Name = "Change serial number",
+ Action = ChangeSerial
+ },
+ new MenuItem
+ {
+ Name = "Change motherboard serial number",
+ Action = ChangeMoboSerial
+ },
+ new MenuItem
+ {
+ Name = "Change console model number",
+ Action = ChangeModel
+ },
+ ];
+ }
+
+ private bool NorNull()
+ {
+ if (_norData != null) return false;
+ Console.ForegroundColor = ConsoleColor.Red;
+ Console.WriteLine("You must select a .bin file to read before proceeding. Please select a valid .bin file and try again.");
+ Console.ResetColor();
+ return true;
+ }
+
+ private bool ChangeModel()
+ {
+ if (NorNull())
+ return true;
+
+ while (true)
+ {
+ Console.ForegroundColor = ConsoleColor.Blue;
+ Console.WriteLine($"Current model: {_norData.SKUModel}");
+ Console.ResetColor();
+
+ Console.WriteLine(
+ "Please enter the model you would like to set your dump file to (type 'exit' to go back): ");
+
+ string newModel = (Console.ReadLine() ?? string.Empty).Trim();
+
+ if (string.IsNullOrEmpty(newModel))
+ {
+ Console.WriteLine("Invalid model entered. The new model should be like CFI-XXXXX.");
+ }
+ else if (newModel.Length < 9)
+ {
+ Console.WriteLine(
+ "The new model you entered is invalid. The model should be 9 characters long.");
+ }
+ else if (!newModel.StartsWith("CFI-"))
+ {
+ Console.WriteLine(
+ "The new model you entered is invalid. The model should start with 'CFI-', followed by 4 numbers and a letter.");
+ }
+ else if (newModel == "exit")
+ {
+ break;
+ }
+ else
+ {
+ try
+ {
+ _norData.SKUModel = newModel;
+ Console.WriteLine("The new console model you chose has been saved successfully."); break;
+ }
+ catch (Exception ex)
+ {
+ Console.ForegroundColor = ConsoleColor.Red;
+ Console.WriteLine(
+ $"An error occurred while attempting to make changes to your dump file. Please try again. {ex}");
+ Console.ResetColor();
+ }
+ }
+ }
+
+ return true;
+ }
+
+ private bool ChangeMoboSerial()
+ {
+ if (NorNull())
+ return true;
+
+ string oldSerial = _norData.MoboSerial;
+
+ while (true)
+ {
+ Console.ForegroundColor = ConsoleColor.Blue;
+ Console.WriteLine("Enter the new motherboard serial number you would like to save (type 'exit' to exit): ");
+ Console.ResetColor();
+
+ string newSerial = (Console.ReadLine() ?? string.Empty).Trim();
+
+ if (string.IsNullOrEmpty(newSerial))
+ {
+ Console.WriteLine("Invalid serial number entered. The new serial should be numbers and letters.");
+ }
+ else if (newSerial == oldSerial)
+ {
+ Console.WriteLine(
+ "The new serial number matches the old serial number. Please enter a different value and try again.");
+ }
+ else if (newSerial == "exit")
+ {
+ break;
+ }
+ else
+ {
+ try
+ {
+ _norData.MoboSerial = newSerial;
+ Console.WriteLine("SUCCESS: The new motherboard serial number has been updated successfully.");
+ break;
+ }
+ catch (Exception ex)
+ {
+ Console.ForegroundColor = ConsoleColor.Red;
+ Console.WriteLine(
+ $"An error occurred while attempting to make changes to your dump file. Please try again. {ex}");
+ Console.ResetColor();
+ }
+ }
+ }
+
+ return true;
+ }
+
+ private bool ChangeSerial()
+ {
+ if (NorNull())
+ return true;
+
+ string oldSerial = _norData.Serial;
+
+ while (true)
+ {
+ Console.ForegroundColor = ConsoleColor.Blue;
+ Console.WriteLine("Enter the new serial number you would like to save (type 'exit' to exit): ");
+ Console.ResetColor();
+
+ string newSerial = (Console.ReadLine() ?? string.Empty).Trim();
+
+ if (string.IsNullOrEmpty(newSerial))
+ {
+ Console.WriteLine("Invalid serial number entered. The new serial should be numbers and letters.");
+ }
+ else if (newSerial == oldSerial)
+ {
+ Console.WriteLine(
+ "The new serial number matches the old serial number. Please enter a different value and try again.");
+ }
+ else if (newSerial == "exit")
+ {
+ break;
+ }
+ else
+ {
+ try
+ {
+ _norData.Serial = newSerial;
+ Console.WriteLine("SUCCESS: The new serial number has been updated successfully.");
+ break;
+ }
+ catch (Exception ex)
+ {
+ Console.ForegroundColor = ConsoleColor.Red;
+ Console.WriteLine(
+ $"An error occurred while attempting to make changes to your dump file. Please try again. {ex}");
+ Console.ResetColor();
+ }
+ }
+ }
+
+ return true;
+ }
+
+ private bool ChangeEdition(Editions edition)
+ {
+ if (NorNull())
+ return true;
+
+ if (_norData.Edition == edition)
+ {
+ Console.WriteLine($"The .bin file you're working with is already a {edition} edition. No changes are needed.");
+ return true;
+ }
+
+ try
+ {
+ _norData.Edition = edition;
+ Console.WriteLine("Your BIOS file has been updated successfully. The new .bin file " +
+ $"will now report to the PlayStation 5 as a '{edition} edition' console.");
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("An error occurred while converting to digital edition, please try again: \n" + ex);
+ }
+
+ return true;
+ }
+
+ private bool ViewBIOS()
+ {
+ if (NorNull())
+ return true;
+
+ long lengthBytes = new FileInfo(_norData.Path).Length;
+ long lengthMiB = lengthBytes / 1024 / 1024;
+
+ Console.WriteLine("File size: " + lengthBytes + " bytes (" + lengthMiB + " MiB)");
+ Console.WriteLine("PS5 Version: " + _norData.Edition); // Show the version info (disc/digital/slim)
+ Console.WriteLine("Console Model: " + _norData.SKUModel); // Show the console variant (CFI-XXXX)
+ Console.WriteLine("Console Serial Number: " + _norData.Serial); // Show the serial number. This serial is the one the disc drive would use
+ Console.WriteLine("Motherboard Serial Number: " + _norData.MoboSerial); // Show the serial number to the motherboard. This is different to the console serial
+ Console.WriteLine("WiFi Mac Address: " + _norData.WiFiMAC);
+ Console.WriteLine("Ethernet 1 Mac Address: " + _norData.Ethernet1MAC);
+
+ return true;
+ }
+
+ private bool LoadBIOS()
+ {
+ Console.WriteLine("In order to work with a BIOS file, you must first choose a file to work with.");
+ Console.WriteLine("This needs to be a valid .bin file containing your BIOS dump file.");
+ Console.WriteLine("You will need to know the full file path of your .bin file in order to continue.");
+ Console.WriteLine();
+
+ while (true)
+ {
+ Console.Write("Enter the full file path (type 'exit' to quit): ");
+ string userInput = Console.ReadLine().Trim();
+
+ if (string.IsNullOrWhiteSpace(userInput))
+ {
+ Console.WriteLine("Invalid input. File path cannot be blank.");
+ }
+ else if (userInput.Equals("exit", StringComparison.OrdinalIgnoreCase))
+ {
+ break;
+ }
+ else if (!File.Exists(userInput))
+ {
+ Console.WriteLine(
+ "The file path you entered does not exist. Please enter the path to a valid .bin file.");
+ }
+ else if (!Path.GetExtension(userInput).Equals(".bin", StringComparison.CurrentCultureIgnoreCase))
+ {
+ Console.WriteLine("The file you provided is not a .bin file. Please enter a valid .bin file path.");
+ }
+ else
+ {
+ long length = new FileInfo(userInput).Length;
+ Console.WriteLine("Selected file: " + userInput + " - File Size: " + length + " bytes (" +
+ length / 1024 / 1024 + " MiB)");
+ _norData = new(userInput);
+ break;
+ }
+ }
+
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/UART-CL_By_TheCod3r/Menus/Menu.cs b/UART-CL_By_TheCod3r/Menus/Menu.cs
new file mode 100644
index 0000000..4481718
--- /dev/null
+++ b/UART-CL_By_TheCod3r/Menus/Menu.cs
@@ -0,0 +1,100 @@
+namespace UART_CL;
+
+public abstract class Menu
+{
+ public List