Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions PS5 NOR Modifier/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ private void throwError(string errmsg)
static SerialPort UARTSerial = new SerialPort();

/// <summary>
/// With thanks to @jjxtra on Github. The code has already been created and there's no need to reinvent the wheel is there?
/// 2-pointer search algorithm based on code by @jjxtra on GitHub.
/// </summary>
#region Hex Code

private static IEnumerable<int> PatternAt(byte[] source, byte[] pattern)
{
for (int i = 0; i < source.Length; i++)
{
if (source.Skip(i).Take(pattern.Length).SequenceEqual(pattern))
if (source.AsSpan(i).StartsWith(pattern))
{
yield return i;
}
Expand Down Expand Up @@ -680,8 +680,8 @@ private void convertToDigitalEditionButton_Click(object sender, EventArgs e)
{
bytes[i] = replace[replaceIndex];
}
File.WriteAllBytes(newFile, bytes);
}
File.WriteAllBytes(newFile, bytes);
}

}
Expand Down Expand Up @@ -716,8 +716,8 @@ private void convertToDigitalEditionButton_Click(object sender, EventArgs e)
{
bytes[i] = replace[replaceIndex];
}
File.WriteAllBytes(newFile, bytes);
}
File.WriteAllBytes(newFile, bytes);
}

}
Expand Down Expand Up @@ -750,8 +750,8 @@ private void convertToDigitalEditionButton_Click(object sender, EventArgs e)
{
bytes[i] = replace[replaceIndex];
}
File.WriteAllBytes(newFile, bytes);
}
File.WriteAllBytes(newFile, bytes);

}
catch(System.ArgumentException ex)
Expand Down Expand Up @@ -783,8 +783,8 @@ private void convertToDigitalEditionButton_Click(object sender, EventArgs e)
{
bytes[i] = replace[replaceIndex];
}
File.WriteAllBytes(newFile, bytes);
}
File.WriteAllBytes(newFile, bytes);

}
catch (System.ArgumentException ex)
Expand Down
18 changes: 9 additions & 9 deletions UART-CL By TheCod3r/UART-CL By TheCod3r/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static IEnumerable<int> PatternAt(byte[] source, byte[] pattern)
{
for (int i = 0; i < source.Length; i++)
{
if (source.Skip(i).Take(pattern.Length).SequenceEqual(pattern))
if (source.AsSpan(i).StartsWith(pattern))
{
yield return i;
}
Expand Down Expand Up @@ -726,8 +726,8 @@ static void RunSubMenu(string appTitle, Dictionary<string, string> regionMap)
{
bytes[i] = replace[replaceIndex];
}
File.WriteAllBytes(pathToDump, bytes);
}
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());
Expand All @@ -738,8 +738,8 @@ static void RunSubMenu(string appTitle, Dictionary<string, string> regionMap)
{
bytes[i] = replace2[replaceIndex];
}
File.WriteAllBytes(pathToDump, bytes);
}
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.");
Expand Down Expand Up @@ -859,8 +859,8 @@ static void RunSubMenu(string appTitle, Dictionary<string, string> regionMap)
{
bytes[i] = replace[replaceIndex];
}
File.WriteAllBytes(pathToDump, bytes);
}
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());
Expand All @@ -871,8 +871,8 @@ static void RunSubMenu(string appTitle, Dictionary<string, string> regionMap)
{
bytes[i] = replace2[replaceIndex];
}
File.WriteAllBytes(pathToDump, bytes);
}
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.");
Expand Down Expand Up @@ -991,8 +991,8 @@ static void RunSubMenu(string appTitle, Dictionary<string, string> regionMap)
{
bytes[i] = replace[replaceIndex];
}
File.WriteAllBytes(pathToDump, bytes);
}
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());
Expand All @@ -1003,8 +1003,8 @@ static void RunSubMenu(string appTitle, Dictionary<string, string> regionMap)
{
bytes[i] = replace2[replaceIndex];
}
File.WriteAllBytes(pathToDump, bytes);
}
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.");
Expand Down Expand Up @@ -1247,8 +1247,8 @@ static void RunSubMenu(string appTitle, Dictionary<string, string> regionMap)
{
bytes[i] = replace[replaceIndex];
}
File.WriteAllBytes(pathToDump, bytes);
}
File.WriteAllBytes(pathToDump, bytes);

System.Console.WriteLine("The new motherboard serial number you entered been saved successfully.");
System.Console.WriteLine("Press Enter to continue...");
Expand Down Expand Up @@ -1373,8 +1373,8 @@ static void RunSubMenu(string appTitle, Dictionary<string, string> regionMap)
{
bytes[i] = replace[replaceIndex];
}
File.WriteAllBytes(pathToDump, bytes);
}
File.WriteAllBytes(pathToDump, bytes);

System.Console.WriteLine("The new console model you chose has been saved successfully.");
System.Console.WriteLine("Press Enter to continue...");
Expand Down