mirror of
https://github.com/blueskythlikesclouds/SonicAudioTools.git
synced 2024-11-24 07:00:11 +01:00
Fix UTF table decryptor
This commit is contained in:
parent
72cc15b402
commit
b31d8b6f3e
42
README.md
42
README.md
@ -1,29 +1,33 @@
|
|||||||
# Sonic Audio Tools
|
# Sonic Audio Tools
|
||||||
Tools for editing CriMw / CriWare file formats. (CSB / CPK / ACB / AWB)
|
A set of tools to modify CRIWARE file formats.
|
||||||
## Releases
|
|
||||||
[On the AppVeyor page.](https://ci.appveyor.com/project/blueskythlikesclouds/sonicaudiotools/build/artifacts)
|
# Releases
|
||||||
AppVeyor builds every commit automatically, so you can get the executables from the link above.
|
You can get the latest executables on the [AppVeyor page.](https://ci.appveyor.com/project/blueskythlikesclouds/sonicaudiotools/build/artifacts)
|
||||||
Stable builds are planned to be published [here.](https://github.com/blueskythlikesclouds/SonicAudioTools/releases)
|
Stable builds are planned to be published [here.](https://github.com/blueskythlikesclouds/SonicAudioTools/releases)
|
||||||
|
|
||||||
## Building
|
# Building
|
||||||
If you still wish to build the solution yourself, this is what you should do:
|
If you still wish to build the solution yourself, this is what you should do:
|
||||||
1. Clone from [GitHub](https://github.com/blueskythlikesclouds/SonicAudioTools.git) `git clone https://github.com/blueskythlikesclouds/SonicAudioTools.git`
|
1. Clone from [GitHub](https://github.com/blueskythlikesclouds/SonicAudioTools.git) `git clone https://github.com/blueskythlikesclouds/SonicAudioTools.git`
|
||||||
2. Open the solution in Visual Studio. (Visual Studio 2017 or later is required.)
|
2. Open the solution in Visual Studio. (Visual Studio 2017 or later is required.)
|
||||||
3. Install the missing NuGet packages.
|
3. Install the missing NuGet packages.
|
||||||
4. Build the solution.
|
4. Build the solution.
|
||||||
|
|
||||||
## Projects
|
# Projects
|
||||||
To see more information about projects, visit the [wiki](https://github.com/blueskythlikesclouds/SonicAudioTools/wiki).
|
If you wish to see more detailed information about the projects, visit the [wiki](https://github.com/blueskythlikesclouds/SonicAudioTools/wiki) page.
|
||||||
### [Sonic Audio Library](https://github.com/blueskythlikesclouds/SonicAudioTools/tree/master/Source/SonicAudioLib)
|
|
||||||
Main class library of the solution. Contains classes for IO and file formats.
|
|
||||||
### [ACB Editor](https://github.com/blueskythlikesclouds/SonicAudioTools/tree/master/Source/AcbEditor)
|
|
||||||
Audio data replacer for ACB / AWB files. Supports really old ACB files as well, which stored CPK files instead of currently used AWB files. Usage is explained in the program.
|
|
||||||
NOTE: It doesn't extract cue names so every audio will have its id on extracted file name.
|
|
||||||
### [CSB Builder](https://github.com/blueskythlikesclouds/SonicAudioTools/tree/master/Source/CsbBuilder)
|
|
||||||
CSB file importer/builder. Allows you to fully edit CSB files, preview your changes, add/remove cues, etc.
|
|
||||||
### [CSB Editor](https://github.com/blueskythlikesclouds/SonicAudioTools/tree/master/Source/CsbEditor)
|
|
||||||
Audio data replacer for CSB / CPK files. It works like ACB Editor and is a lot simpler than CSB Builder.
|
|
||||||
|
|
||||||
## License
|
## [Sonic Audio Library](https://github.com/blueskythlikesclouds/SonicAudioTools/tree/master/Source/SonicAudioLib)
|
||||||
Sonic Audio Tools uses the MIT license, meaning you're able to use and modify the code freely, as long as you include the copyright notice.
|
This is the main library of the solution. Contains classes for IO and file formats.
|
||||||
For more details, see [LICENSE](https://github.com/blueskythlikesclouds/SonicAudioTools/blob/master/LICENSE)
|
|
||||||
|
## [ACB Editor](https://github.com/blueskythlikesclouds/SonicAudioTools/tree/master/Source/AcbEditor)
|
||||||
|
This tool allows you to edit the audio content of an ACB file.
|
||||||
|
A more advanced version like CSB Builder is planned to be made soon.
|
||||||
|
|
||||||
|
## [CSB Builder](https://github.com/blueskythlikesclouds/SonicAudioTools/tree/master/Source/CsbBuilder)
|
||||||
|
This tool allows you to create or edit CSB files. You can do things like adding/removing cues, editing real-time sound parameters, and more.
|
||||||
|
|
||||||
|
## [CSB Editor](https://github.com/blueskythlikesclouds/SonicAudioTools/tree/master/Source/CsbEditor)
|
||||||
|
This tool allows you to edit the audio content of a CSB file.
|
||||||
|
It works like ACB Editor, and it is a lot simpler to use than CSB Builder.
|
||||||
|
|
||||||
|
# License
|
||||||
|
See [LICENSE](https://github.com/blueskythlikesclouds/SonicAudioTools/blob/master/LICENSE) for details.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
@ -65,13 +65,13 @@ namespace SonicAudioLib.CriMw
|
|||||||
{
|
{
|
||||||
public static void FindKeys(byte[] signature, out uint xor, out uint xorMultiplier)
|
public static void FindKeys(byte[] signature, out uint xor, out uint xorMultiplier)
|
||||||
{
|
{
|
||||||
for (byte x = 0; x <= byte.MaxValue; x++)
|
for (int x = 0; x < 0x100; x++)
|
||||||
{
|
{
|
||||||
// Find XOR using first byte
|
// Find XOR using first byte
|
||||||
if ((signature[0] ^ x) == CriTableHeader.SignatureBytes[0])
|
if ((signature[0] ^ (byte)x) == CriTableHeader.SignatureBytes[0])
|
||||||
{
|
{
|
||||||
// Matched the first byte, try finding the multiplier with the second byte
|
// Matched the first byte, try finding the multiplier with the second byte
|
||||||
for (byte m = 0; m <= byte.MaxValue; m++)
|
for (int m = 0; m < 0x100; m++)
|
||||||
{
|
{
|
||||||
// Matched the second byte, now make sure the other bytes match as well
|
// Matched the second byte, now make sure the other bytes match as well
|
||||||
if ((signature[1] ^ (byte)(x * m)) == CriTableHeader.SignatureBytes[1])
|
if ((signature[1] ^ (byte)(x * m)) == CriTableHeader.SignatureBytes[1])
|
||||||
@ -81,7 +81,7 @@ namespace SonicAudioLib.CriMw
|
|||||||
bool allMatches = true;
|
bool allMatches = true;
|
||||||
for (int i = 2; i < 4; i++)
|
for (int i = 2; i < 4; i++)
|
||||||
{
|
{
|
||||||
_x *= m;
|
_x = (byte)(_x * m);
|
||||||
|
|
||||||
if ((signature[i] ^ _x) != CriTableHeader.SignatureBytes[i])
|
if ((signature[i] ^ _x) != CriTableHeader.SignatureBytes[i])
|
||||||
{
|
{
|
||||||
@ -93,8 +93,8 @@ namespace SonicAudioLib.CriMw
|
|||||||
// All matches, return the xor and multiplier
|
// All matches, return the xor and multiplier
|
||||||
if (allMatches)
|
if (allMatches)
|
||||||
{
|
{
|
||||||
xor = x;
|
xor = (uint)x;
|
||||||
xorMultiplier = m;
|
xorMultiplier = (uint)m;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ namespace SonicAudioLib.CriMw
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new InvalidDataException("'@UTF' signature could not be found.");
|
throw new InvalidDataException("'@UTF' signature could not be found. Your file might be corrupted.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Mask(Stream source, Stream destination, long length, uint xor, uint xorMultiplier)
|
public static void Mask(Stream source, Stream destination, long length, uint xor, uint xorMultiplier)
|
||||||
|
Loading…
Reference in New Issue
Block a user