From 6678780ef6dbb5e4d85af506f0c3c5894e537ba8 Mon Sep 17 00:00:00 2001 From: Persephone Bubblegum-Holiday Date: Mon, 26 May 2025 19:21:00 -0700 Subject: [PATCH] full 3 stage bit map and 256 bit conversion --- PC2Converter/PC2Converter/MainForm.cs | 31 ++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/PC2Converter/PC2Converter/MainForm.cs b/PC2Converter/PC2Converter/MainForm.cs index 296aa21..af76e5d 100644 --- a/PC2Converter/PC2Converter/MainForm.cs +++ b/PC2Converter/PC2Converter/MainForm.cs @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Diagnostics; +using System.Numerics; using System.IO; using Eto.Forms; @@ -65,6 +66,24 @@ namespace PC2Converter /* chuck e. */ new int[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 } }; + int[] FS_RAE3stBitMap = { + 1, 9, 10, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 17, 18, 19, 14, 15, 16, 20, 36, 37, + 185, 176, 177, 181, 182, 183, 184, 178, 179, 180, 173, 175, 174, 168, 170, 169, 186, 187, 188, + 45, 41, 42, 43, 44, 54, 55, 51, 52, 53, 57, 59, 58, 60, 61, 62, + 166, 151, 152, 153, 156, 157, 158, 161, 162, 163, 164, 154, 155, 159, 160, 165, + 30, 23, 24, 26, 27, 28, 29, 25, 21, 22, 33, 35, 34, 31, 32, 63, 64, + 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 189, 190, 194, 211, 212, 213, + 167, 191, 192, 193, 171, 172, 48, + 39, 38, 47, 46, 49, 50, + 88, 86, 85, 82, 242, 84, 83, 81, 238, 239, 240, 87, + 93, 94, 91, 92, 89, 90, + 229, 228, 227, 226, 224, 223, 221, 219, 218, 217, 216, 222, + 235, 232, 231, 234, 236, 237, 233, 242, 243, + 67, 68, 69, 66, 71, 72, 73, + 78, 77, 76, 79, 80, + 220, 244, 245, 225, 230, 241 + }; + int[] CyberRosettaInvertedBits = { 2, 8, 181, 169, 41, 59, 58, 151, 158, 26, 35, 31 }; int[] RAE3stAPSDescrambleTable = { 10, 11, 0, 1, 2, 3, 4, 12, 13, 5, 6, 7, 8, 9, 14, 15}; @@ -346,9 +365,9 @@ namespace PC2Converter return; } - if (FullStage) + if (FullStage && (string)OutputTypeSelector.SelectedKey != "UST 256 Bits (Full RAE/3st)") { - MessageBox.Show("Fatal: Full Stage mode is not supported at this time."); + MessageBox.Show("Fatal: Full Stage mode is not supported for cybers and studio c at this time."); return; } @@ -417,6 +436,7 @@ namespace PC2Converter break; case "UST 256 Bits (Full RAE/3st)": bitsCount = 256; + targetBits = FS_RAE3stBitMap; break; case "UST 256 Bits (Full Cybers Rosetta)": bitsCount = 256; @@ -440,10 +460,10 @@ namespace PC2Converter List writeOut = new List(); foreach (BitArray bits in rshwBits) { - int frameByte = 0; + BigInteger frameByte = 0; for (int i = 0; i < targetBits.Length; i++) { - if (bits.Get(targetBits[i])) frameByte += 1 << i; + if (bits.Get(targetBits[i])) frameByte += BigInteger.Pow(2, i); } writeOut.Add(frameByte.ToString($"X{(bitsCount/4).ToString()}")); } @@ -451,11 +471,12 @@ namespace PC2Converter byte[] audioOut = file.audioData; if ((bool)CompressAudioCheckBox.Checked) { + MessageBox.Show("press ok to start compressing audio"); if (File.Exists("tmp.mp3")) File.Delete("tmp.mp3"); File.WriteAllBytes("tmp.wav", audioOut); Process ffmpegProcess = new Process(); ffmpegProcess.StartInfo.FileName = "ffmpeg"; - ffmpegProcess.StartInfo.Arguments = "-i tmp.wav -c:a mp3 -b:a 128 tmp.mp3"; + ffmpegProcess.StartInfo.Arguments = "-i tmp.wav -c:a mp3 -b:a 128k tmp.mp3"; ffmpegProcess.Start(); ffmpegProcess.WaitForExit(); audioOut = File.ReadAllBytes("tmp.mp3");