encrypt_archive

Function encrypt_archive 

Source
pub fn encrypt_archive(
    archive_entries: &[ArchiveEntry],
    engine: Engine,
) -> Vec<u8> 
Expand description

A convenience function to encrypt an archive in a single call.

This is a wrapper around Decrypter::encrypt with automatic initialization.

§Parameters

  • archive_entries: Entries to pack into the archive.
  • engine: Engine that defines output archive format.

§Returns

  • Vec<u8> representing the archive.

§Example

use rpgmad_lib::{encrypt_archive, ArchiveEntry, Engine};
use std::{fs::{read, write}, borrow::Cow};

let archive_entries = [ArchiveEntry {
    path: Cow::Borrowed(b"Graphics/Tilesets/Tileset1.png"),
    data: read("Graphics/Tilesets/Tileset1.png").unwrap()
}];
let archive_data = encrypt_archive(&archive_entries, Engine::VXAce);
write("./Game.rgss3a", archive_data).unwrap();