Expand description
§rpgm-archive-decrypter-lib
BLAZINGLY :fire: fast and tiny library for decrypting RPG Maker XP/VX/VXAce .rgssad/.rgss2a/.rgss3a archives.
This project essentially is a rewrite of uuksu’s RPGMakerDecrypter in Rust as a library, but it also implements archive encryption, and can be run in no_std environments.
And since it’s implemented in Rust 🦀🦀🦀, it’s also very tiny, clean, and performant.
Used in my rpgm-archive-decrypter CLI tool and RPGMTranslate.
§Example
§Decrypt
use rpgmad_lib::{Decrypter};
use std::{path::PathBuf, fs::{read, write, create_dir_all}};
let mut archive_content: Vec<u8> = read("C:/Game/Game.rgss3a").unwrap();
let mut decrypter = Decrypter::new();
let decrypted_entries = decrypter.decrypt(&mut archive_content).unwrap();
for entry in decrypted_entries {
let path = String::from_utf8_lossy(&entry.path);
let output_path = PathBuf::from("C:/Game").join(path.as_ref());
if let Some(parent) = output_path.parent() {
create_dir_all(parent).unwrap();
}
write(output_path, entry.data).unwrap();
}§Encrypt
use rpgmad_lib::{Decrypter, ArchiveEntry, Engine};
use std::{fs::{read, write}, borrow::Cow};
let data = read("Graphics/Tilesets/Tileset1.png").unwrap();
let archive_entries = [ArchiveEntry {
path: b"Graphics/Tilesets/Tileset1.png",
data: &data
}];
let mut decrypter = Decrypter::new();
let encrypted_buffer_size = Decrypter::encrypted_buffer_size(&archive_entries, Engine::VXAce);
let mut archive_buffer = Vec::new();
archive_buffer.resize(encrypted_buffer_size, 0);
decrypter.encrypt(&archive_entries, Engine::VXAce, &mut archive_buffer);
write("./Game.rgss3a", archive_buffer).unwrap();§Features
default- default feature enables the usage ofstd. If you’re using this crate in ano_stdenvironment for some reason, you need to disable default feature.serde- enables serde serialization/deserialization forErrortype.
§Support
Me, the maintainer of this project, is a poor college student from Eastern Europe.
If you could, please consider supporting us through:
Even if you don’t, it’s fine. We’ll continue to do as we right now.
§License
Project is licensed under WTFPL.
Structs§
- Archive
Entry - Struct representing decrypted file.
- Decrypter
- A struct responsible for decrypting and extracting files from encrypted game archives.