Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
Merge pull request #26 from Petschko/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Petschko authored Feb 19, 2021
2 parents 93426d4 + 4bceed2 commit 2f2e3b1
Show file tree
Hide file tree
Showing 20 changed files with 1,370 additions and 115 deletions.
40 changes: 21 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Petschko's RPG-Maker-MV File-Decrypter (Java-Version)
# Petschko's RPG-Maker-MV/MZ File-Decrypter (Java-Version)

## What's that?
This Project is used to decrypt RPG-Maker-MV-Resource-Files that are encrypted with the Build-In-Encryption of the RPG-Maker.
This Project is used to decrypt RPG-Maker-MV/MZ-Resource-Files that are encrypted with the Build-In-Encryption of the RPG-Maker.

This Project is also able to decrypt whole RPG-Directories. It's similar to [my previous Project](https://github.com/Petschko/RPG-Maker-MV-Decrypter) but more comfortable.

### Which Files can be decrypted with this Program?
You can decrypt the Build-In-Encrypted Files from the RPG Maker MV. They usually have the extension `.rpgmvp`, `.rpgmvm` or `.rpgmvo`
You can decrypt the Build-In-Encrypted Files from the RPG Maker MV or MZ. They usually have the extension `.rpgmvp`, `.rpgmvm`, `.rpgmvo`, `.png_`, `.m4a_` or `.ogg_`.

## Requirements
- Java 8 or higher
Expand All @@ -17,7 +17,7 @@ You can decrypt the Build-In-Encrypted Files from the RPG Maker MV. They usually
- Put it where ever you want (Don't forget to extract, if you downloaded the ZIP xP)

## How to use
### The "normal" way
### (Normal) With Graphical interface
- Just double click on the JAR then the Program should start *(If not try the BAT-File - Windows only)*
- Click on the Menu "File" then "Open"
- Browse to the RPG-Maker MV Project which you want decrypt
Expand All @@ -32,17 +32,15 @@ You can decrypt the Build-In-Encrypted Files from the RPG Maker MV. They usually
- You can also check out the "Option"-Menu and check if the settings fit to you =)
- You can find this "Manual" also within the "Info"-Menu

### Start with CMD - For the guys who like it :3
- Go to the Directory where the JAR is
- Type in `java -jar "RPG Maker MV Decrypter.jar" Target-Directory(Req) Destination-Directory(Optional)`
- Example: `java -jar "RPG Maker MV Decrypter.jar" D:\games\Project1\`
- Other Example with Output-Dir: `java -jar "RPG Maker MV Decrypter.jar" D:\games\Project1\ .\myoutputdir`
- The Script will show you which Files are decrypted and where they are saved now
- The Script ends with "Done." Then you're done^^
### Start with CMD - For automation / the guys who like it :3

- Remember that IOS & Linux not have a Drive-Letter nor using the `\ ` as Directory-Separator use `/` instead when you're using Linux/IOS
- Important: If you just Type `java -jar "RPG Maker MV Decrypter.jar"` the Program will start with GUI
- You can also use the Help-Command with `java -jar "RPG Maker MV Decrypter.jar" --help`
In some case it can be useful to do stuff via the commandline. For example you want to mod a game and make it easy for the user to mod it (like they just need to start a .bat/.sh file which does the stuff)

- To see the global help (with all sub-commands) type in `java -jar "RPG Maker MV Decrypter.jar" help`
- To see the detailed help of a specific command type in `java -jar "RPG Maker MV Decrypter.jar" [command] help`
- Example (display decrypt help): `java -jar "RPG Maker MV Decrypter.jar" decrypt help`

For details use and examples how to use it see [CMD Instructions](cmd-instructions.md)

## Motivation behind this
As Art-Creator for the RPG-Maker by myself, it is sometimes hard to figure out, if somebody is using Resources from you *(and may violate the licence like giving no credit or using a Non-Commercial-Resource in a Commercial Game for example)*.
Expand All @@ -53,12 +51,12 @@ Sad for me, more People use the build in Encryption from the RPG-Maker-MV, so th

It can be also useful for Translators, eg when you want to make a Game available for different Regions. *(IMO you should ask the Creator of the Game first! - Sometimes it's not possible...)*

I'm also interested in Encryption in general, so this was a good base to learn, since the MV-Encryption is very weak - But it's great that it is simple, because it will not slow down weak machines! *(See below)*
I'm also interested in Encryption in general, so this was a good base to learn, since the MV-Encryption is very weak - But it's great that's simple, because it will not slow down weak machines! *(See below)*

### Why is the encryption of my Game useless in this case?
Sometimes there is a nice Picture that you may save for yourself. You would even do with without this Decrypter by making a Screenshot (or record the Sound) >.<

So you see there is no need for encryption in RPG-Maker Games... If someone want to get the Files, he will able to get them.
So you see there is no need for encryption in RPG-Maker Games... If someone wants to get the Files, he will able to get them.
You can't encrypt your Files 100%, because the Game has to decrypt them by itself, to display them... (Or Play) - And since you are able to play the Game offline, you have to provide the Decryption Method and the Key.

### But somebody will steal my assets
Expand All @@ -70,9 +68,9 @@ So please DON'T steal stuff, as Artist I know how much time such stuff take, so
This Java-Decrypter is better for whole Directories. It was easier to do it with Java, because you are very limited with JavaScript. (File-Access / Saving etc)
Why Java? - Because I know this Language xP

**Advantages using this in comparision to my previous Project:**
**Advantages using this in comparison to my previous Project:**
- Works with whole Directories
- It detect Encrypted Files by itself
- It detects Encrypted Files by itself
- It Auto-Saves & Rename Decrypted-Files for you!
- It keeps the Directory-Structure
- You can specify an Output-Directory
Expand All @@ -82,7 +80,7 @@ Why Java? - Because I know this Language xP
- Will add a restore Project Function in the future
- You can en/disable the verification of the 16Byte Fake-Header
- If you disable the verification, it will just cut away the Fake-Header aka the first 16 Bytes of the File *(Useful when Decrypter-Signature changes)*
- If you enable the verification it will check if the Files-Header is correct (aka if its a real Encrypted File
- If you enable the verification it will check if the Files-Header is correct (aka if it's a real Encrypted File)

## Be Fair!
You are **not allowed** to use the Decrypted Files (**if its not allowed by the origin Resource-Licence**).
Expand All @@ -92,6 +90,10 @@ You can save them for **Personal-Use only**. If the origin Licence allow use you

**If that's your Project** and you simply lost your Origin-Files, **you have the same rights**, to do stuff with them, **as before** =)

## Donate

If you like this Project and want to thank me may consider to [Donate](https://www.paypal.me/petschko). I appreciate anything, which helps the Project (Pull-Requests, Bug Report etc), these are more worth than Donations but I'm happy for every amount as well. ^.^

## Contact
- E-Mail me if you have questions (no bug reporting please): peter@petschko.org
- You can also tell me you like it or not >.< Of course you can make improvement suggestions if you want
Expand Down
56 changes: 56 additions & 0 deletions cmd-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
I put the detailed Command-Line explanation here since not many people use it and its pretty "long"

Everything what's explained here is also explained in the help-commands within the Program.

# Command explanation

Before we start:
- You only need the params which are marked as __(Req.)__. All other params are optional.
- If a path contains a space use the quotations "" around: `"D:\games\Project with Space\"`
- Remember that IOS & Linux not have a Drive-Letter nor using the `\ ` as Directory-Separator; use `/` instead when you're using Linux/IOS
- Important: If you just Type `java -jar "RPG Maker MV Decrypter.jar"` the Program will start with GUI
- You can also use the Help-Command with `java -jar "RPG Maker MV Decrypter.jar" help`
- The Script ends with "Done." Then you're done.

There exists commands you can use, these are explained here:
- __decrypt__ - Decrypts all Files (Help: `java -jar "RPG Maker MV Decrypter.jar" decrypt help`)
- The Script will decrypt all Files in the target dir
- Simple-Syntax: `java -jar "RPG Maker MV Decrypter.jar" decrypt [(Req.) target path] [output path] [verifyRpgDir (false|true)] [ignoreFakeHeader (true|false)]`
- Full-Syntax: `java -jar "RPG Maker MV Decrypter.jar" decrypt [(Req.) target path] [output path] [verifyRpgDir (false|true)] [ignoreFakeHeader (true|false)] [headerLen (number)] [hsignature] [hversion] [hremain]`
- Example 1: `java -jar "RPG Maker MV Decrypter.jar" decrypt D:\games\Project1\`
- Decrypts the game located in `D:\games\Project1\` and saves files to the output dir of this program
- Example 2: `java -jar "RPG Maker MV Decrypter.jar" decrypt D:\games\Project1\ D:\games\Project1\`
- Decrypts the game located in `D:\games\Project1\` and saves files in the game dir _(preserves structure)_
- Example 3: `java -jar "RPG Maker MV Decrypter.jar" decrypt D:\games\Project1\ D:\games\Project1\ false true d41d8cd98f00b204e9800998ecf8427e`
- Like example 2, just using the Decryption key `d41d8cd98f00b204e9800998ecf8427e`
- You can do more things with `decrypt` please use the help to see more details
- __restore__ - Restores all PNG-Files without a Key (Help: `java -jar "RPG Maker MV Decrypter.jar" restore help`)
- The Script will restore all Files in the target dir _(no key needed)_
- Simple-Syntax: `java -jar "RPG Maker MV Decrypter.jar" restore [(Req.) target path] [output path] [verifyRpgDir (false|true)] [ignoreFakeHeader (true|false)]`
- Full-Syntax: `java -jar "RPG Maker MV Decrypter.jar" restore [(Req.) target path] [output path] [verifyRpgDir (false|true)] [ignoreFakeHeader (true|false)] [headerLen (number)]`
- Example 1: `java -jar "RPG Maker MV Decrypter.jar" restore "C:\my rpg mv game\"`
- Restores all Images in `C:\my rpg mv game\` and saves files to the output dir of this program
- Example 2: `java -jar "RPG Maker MV Decrypter.jar" restore "C:\my rpg mv game\" "C:\my rpg mv game\"`
- Restores all Images in `C:\my rpg mv game\` and saves the restored images also to the game _(preserves structure)_
- Example 3: `java -jar "RPG Maker MV Decrypter.jar" restore "C:\my rpg mv game\" "C:\my rpg mv game\" true false`
- Like Example 2, just adding that the Script should verify it's a RPG-MV/MZ dir and the MV/MZ-Header on the files is correct
- __encrypt__ - Encrypts all Files (Help: `java -jar "RPG Maker MV Decrypter.jar" ecrypt help`)
- This Script (Re-)Encrypts all Files in the target dir
- This Script NEEDs a Key (so it must be either in the Target-dir - `System.json`-File) or given as Parameter
- Simple-Syntax: `java -jar "RPG Maker MV Decrypter.jar" encrypt [(Req.) target path] [output path] [to MV (true|false)] [key (auto|keyValue)]`
- Full-Syntax: `java -jar "RPG Maker MV Decrypter.jar" encrypt [(Req.) target path] [output path] [to MV (true|false)] [key (auto|keyValue)] [headerLen (number)] [hsignature] [hversion] [hremain]`
- Example 1: `java -jar "RPG Maker MV Decrypter.jar" encrypt "C:\my rpg mv game\"`
- Encrypts all resource Files in `C:\my rpg mv game\` to the MV-Format with the detected Key
- Example 2: `java -jar "RPG Maker MV Decrypter.jar" encrypt "C:\my rpg mz game\" output false`
- Encrypts all resource File in `C:\my rpg mz game\` to the output dir of this program in the MZ-Format
- Example 3: `java -jar "RPG Maker MV Decrypter.jar" encrypt "C:\my rpg mz game\" output false d41d8cd98f00b204e9800998ecf8427e`
- Same as Example 2, just using a manual given Key: `d41d8cd98f00b204e9800998ecf8427e`
- You can do more things with `encrypt` please use the help to see more details
- __key__ - Detects and displays the Key (Help: `java -jar "RPG Maker MV Decrypter.jar" key help`)
- This Script shows the Key of the given directory/project
- Simple-Syntax: `java -jar "RPG Maker MV Decrypter.jar" key [(Req.) target path] [ask before image keysearch (true|false)]`
- Full-Syntax: `java -jar "RPG Maker MV Decrypter.jar" key [(Req.) target path] [ask before image keysearch (true|false)] [headerLen (number)]`
- Example 1: `java -jar "RPG Maker MV Decrypter.jar" key "C:\my rpg mv game\"`
- Will do a Key-Search in `C:\my rpg mv game\` and shows the Key if found, if not found it will ask if you want to generate it out of encrypted images
- Example 2: `java -jar "RPG Maker MV Decrypter.jar" key "C:\my rpg mv game\" false`
- Same as Example 1, just don't ask if search on images, it will always do automatically
Binary file modified src/org/petschko/icons/petschko_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions src/org/petschko/lib/File.java
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,22 @@ public static boolean clearDirectory(@NotNull String directoryPath) {
return File.deleteDirectoryOperation(directoryPath, true, false);
}

/**
* Shows if this file can be encrypted
*
* @return - Can file be encrypted
*/
public boolean canBeEncrypted() {
switch(this.extension) {
case "png":
case "m4a":
case "ogg":
return true;
default:
return false;
}
}

/**
* Returns the real Extension of the current fake extension
*
Expand All @@ -538,6 +554,24 @@ public String realExtByFakeExt() {
}
}

/**
* Returns the RPG-MV/MZ Extension of the current extension
*
* @return - Fake File-Extension
*/
public String fakeExtByRealExt(boolean isMV) {
switch(this.extension) {
case "png":
return isMV ? "rpgmvp" : "png_";
case "m4a":
return isMV ? "rpgmvm" : "m4a_";
case "ogg":
return isMV ? "rpgmvo" : "ogg_";
default:
return this.extension;
}
}

/**
* Shows if this file is an Image
*
Expand Down
94 changes: 31 additions & 63 deletions src/org/petschko/rpgmakermv/decrypt/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class App {
private static Boolean useGUI = true;
private static GUI gui;
static String pathToProject;
private static CMD cmd;
static String outputDir;
static Preferences preferences;

Expand All @@ -27,78 +27,47 @@ public class App {
*/
public static void main(String[] args) {
// Check whats given from CMD
if(args.length > 0)
App.processArgs(args);
if(args.length > 0) {
useGUI = false;
cmd = new CMD(args);
}

if(App.useGUI) {
if(useGUI) {
// Use GUI
App.preferences = new Preferences(Config.preferencesFile);
App.outputDir = App.preferences.getConfig(Preferences.lastOutputDir, Config.defaultOutputDir);
App.gui = new GUI();
preferences = new Preferences(Config.preferencesFile);
outputDir = App.preferences.getConfig(Preferences.lastOutputDir, Config.defaultOutputDir);
gui = new GUI();
} else {
// Use Command-Line Version
try {
RPGProject rpgProject = new RPGProject(App.pathToProject, false);
Decrypter decrypter = new Decrypter();

rpgProject.setOutputPath(App.outputDir);
decrypter.setIgnoreFakeHeader(true);
rpgProject.decryptFiles(decrypter);
} catch(Exception e) {
e.printStackTrace();
}

App.exitCMD(0);
cmd.runCMD();
}
}

/**
* Process Command-Line Arguments
* Shows the given message if no GUI is enabled
*
* @param args - Optional Arguments from Command-Line
* @param msg - Message to display
* @param messageStatus - Status of the Message
*/
private static void processArgs(String[] args) {
// Don't use GUI if using Command-Line
App.useGUI = false;

// Show Welcome-Message
System.out.println(Config.programName + " - " + Config.version + " by " + Const.creator + " | Command-Line Version");

// Check if help is needed
if(args[0].equals("help") || args[0].equals("/?") || args[0].equals("--help")) {
App.printHelp();
App.exitCMD(0);
}

// Set Path to Project
App.pathToProject = args[0];
App.showMessage("Set Project-Dir to: \"" + App.pathToProject + "\"");

// Set Output-Dir
try {
App.outputDir = args[1];
} catch(ArrayIndexOutOfBoundsException arEx) {
App.outputDir = Config.defaultOutputDir;
static void showMessage(String msg, int messageStatus) {
String status;

switch(messageStatus) {
case CMD.STATUS_ERROR:
status = "[ERROR]: ";
break;
case CMD.STATUS_WARNING:
status = "[WARN]: ";
break;
case CMD.STATUS_OK:
status = "[SUCCESS]: ";
break;
default:
status = "[INFO]: ";
}

App.showMessage("Set Output-Dir to: \"" + App.outputDir + "\"");
}

/**
* Prints help for Command-Line usage
*/
private static void printHelp() {
System.out.println("Usage: java -jar \"RPG Maker MV Decrypter.jar\" [path to decrypt project] [(optional) output path]");
}

/**
* Exit the Program with a Message
*
* @param status - Exit-Status-Code
*/
private static void exitCMD(int status) {
System.out.println("Done.");
System.exit(status);
if(! App.useGUI)
System.out.println(status + msg);
}

/**
Expand All @@ -107,8 +76,7 @@ private static void exitCMD(int status) {
* @param msg - Message to display
*/
static void showMessage(String msg) {
if(! App.useGUI)
System.out.println(msg);
showMessage(msg, CMD.STATUS_INFO);
}

/**
Expand Down
Loading

0 comments on commit 2f2e3b1

Please sign in to comment.