diff --git a/.vs/RMDEC/v16/.suo b/.vs/RMDEC/v16/.suo index a278c71..f43cfe8 100644 Binary files a/.vs/RMDEC/v16/.suo and b/.vs/RMDEC/v16/.suo differ diff --git a/RMDEC/MVProject.cs b/RMDEC/MVProject.cs index 19c4075..c70291b 100644 --- a/RMDEC/MVProject.cs +++ b/RMDEC/MVProject.cs @@ -131,10 +131,13 @@ namespace RMDEC private static byte[] guessKey(string path) // Incase you think your smart { + bool useOgg = false; string[] mzPngs = Directory.GetFiles(path, "*._png", SearchOption.AllDirectories); string[] mvPngs = Directory.GetFiles(path, "*.rpgmvp", SearchOption.AllDirectories); string[] mzM4as = Directory.GetFiles(path, "*._m4a", SearchOption.AllDirectories); string[] mvM4as = Directory.GetFiles(path, "*.rpgmvm", SearchOption.AllDirectories); + string[] mzOggs = Directory.GetFiles(path, "*._ogg", SearchOption.AllDirectories); + string[] mvOggs = Directory.GetFiles(path, "*.rpgmvo", SearchOption.AllDirectories); List files = new List(); files.AddRange(mzPngs); @@ -144,7 +147,23 @@ namespace RMDEC files.AddRange(mvM4as); if (files.Count <= 0) - return new byte[0x10]; + { + if(mzOggs.Length > 0 || mvOggs.Length > 0) // still encryted audio? + { + files.AddRange(mzOggs); + files.AddRange(mvOggs); + useOgg = true; + } + else + { + return new byte[0x10]; + } + } + + byte[] pngHeader = new byte[0x10] { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52 }; + byte[] m4aHeader = new byte[0x10] { 0x00, 0x00, 0x00, 0x20, 0x66, 0x74, 0x79, 0x70, 0x4D, 0x34, 0x41, 0x20, 0x00, 0x00, 0x00, 0x00 }; + byte[] oggHeader = new byte[0x10] { 0x4F, 0x67, 0x67, 0x53, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF }; + Random rng = new Random(); int index = rng.Next(0, files.Count); @@ -154,12 +173,16 @@ namespace RMDEC FileStream fs = File.OpenRead(file); fs.Seek(0x10, SeekOrigin.Begin); fs.Read(encryptedHeader, 0x00, 0x10); + if (useOgg) + { + fs.Seek(0x58, SeekOrigin.Begin); + oggHeader[0x0E] = (byte)fs.ReadByte(); + oggHeader[0x0F] = (byte)fs.ReadByte(); + } fs.Close(); string filetype = Path.GetExtension(file).ToLower(); - byte[] pngHeader = new byte[0x10] { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52 }; - byte[] m4aHeader = new byte[0x10] { 0x00, 0x00, 0x00, 0x20, 0x66, 0x74, 0x79, 0x70, 0x4D, 0x34, 0x41, 0x20, 0x00, 0x00, 0x00, 0x00 }; - + if (filetype == "._png" || filetype == ".rpgmvp") { byte[] key = RMProject.Xor(encryptedHeader, pngHeader); if(!tryKey(path, key)) @@ -183,7 +206,18 @@ namespace RMDEC return key; } } - // OGG Header is not 0x10 bytes unfortunately. + else if (filetype == "._ogg" || filetype == ".rpgmvo") + { + byte[] key = RMProject.Xor(encryptedHeader, oggHeader); + if (!tryKey(path, key)) + { + throw new Exception("Cannot find key (ITS TOO STRONG!)"); + } + else + { + return key; + } + } throw new Exception("Cannot find key (ITS TOO STRONG!)"); }