Skip to content

Commit 5c994a5

Browse files
committed
Update README.md
1 parent de8f3b4 commit 5c994a5

File tree

1 file changed

+38
-11
lines changed

1 file changed

+38
-11
lines changed

README.md

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,63 @@
11
# rpgm-archive-decrypter-lib
22

3-
Library for decrypting RPG Maker `rgss` archives.
3+
**BLAZINGLY** :fire: fast and tiny library for decrypting RPG Maker XP/VX/VXAce `.rgssad`/`.rgss2a`/`.rgss3a` archives.
44

5-
Used in [rpgm-archive-decrypter](https://github.com/savannstm/rpgm-archive-decrypter).
5+
This project essentially is a rewrite of uuksu's [RPGMakerDecrypter](https://github.com/uuksu/RPGMakerDecrypter) in Rust as a library, but it also implements archive encryption.
6+
7+
And since it's implemented in Rust 🦀🦀🦀, it's also very tiny, clean, and performant.
8+
9+
Used in my [rpgm-archive-decrypter](https://github.com/savannstm/rpgm-archive-decrypter) CLI tool.
610

711
## Example
812

9-
```rust
13+
### Decrypt
14+
15+
```rust no_run
1016
use rpgmad_lib::{Decrypter, decrypt_archive};
11-
use std::path::PathBuf;
17+
use std::{path::PathBuf, fs::{read, write, create_dir_all}};
1218

13-
let archive_content: Vec<u8> = std::fs::read("C:/Game/Game.rgss3a").unwrap();
19+
let archive_content: Vec<u8> = read("C:/Game/Game.rgss3a").unwrap();
1420

1521
// Using Decrypter struct
1622
let mut decrypter = Decrypter::new();
17-
let decrypted_files = decrypter.decrypt(&archive_content).unwrap();
23+
let decrypted_entries = decrypter.decrypt(&archive_content).unwrap();
1824

1925
// Using function
20-
let decrypted_files = decrypt_archive(&archive_content).unwrap();
26+
let decrypted_entries = decrypt_archive(&archive_content).unwrap();
2127

22-
for file in decrypted_files {
23-
let path = String::from_utf8_lossy(&file.path);
28+
for entry in decrypted_entries {
29+
let path = String::from_utf8_lossy(&entry.path);
2430
let output_path = PathBuf::from("C:/Game").join(path.as_ref());
2531

2632
if let Some(parent) = output_path.parent() {
27-
std::fs::create_dir_all(parent).unwrap();
33+
create_dir_all(parent).unwrap();
2834
}
2935

30-
std::fs::write(output_path, file.content).unwrap();
36+
write(output_path, entry.data).unwrap();
3137
}
3238
```
3339

40+
### Encrypt
41+
42+
```rust no_run
43+
use rpgmad_lib::{Decrypter, encrypt_archive, ArchiveEntry, Engine};
44+
use std::{fs::{read, write}, borrow::Cow};
45+
46+
let archive_entries = [ArchiveEntry {
47+
path: Cow::Borrowed(b"Graphics/Tilesets/Tileset1.png"),
48+
data: read("Graphics/Tilesets/Tileset1.png").unwrap()
49+
}];
50+
51+
// Using Decrypter struct
52+
let mut decrypter = Decrypter::new();
53+
let archive_data = decrypter.encrypt(&archive_entries, Engine::VXAce);
54+
55+
// Using function
56+
let archive_data = encrypt_archive(&archive_entries, Engine::VXAce);
57+
58+
write("./Game.rgss3a", archive_data).unwrap();
59+
```
60+
3461
## License
3562

3663
Project is licensed under WTFPL.

0 commit comments

Comments
 (0)