RPG Maker MV Cook Tool

Discussion in 'Useful Development Tools' started by AceOfAces_Mod, Sep 26, 2018.

  1. AceOfAces_Mod

    AceOfAces_Mod Engineering to infinity! Veteran

    Messages:
    1,683
    Likes Received:
    1,119
    First Language:
    Greek
    Primarily Uses:
    RMVXA
    Another small update has arrived:

    UI
    Changelog

    - Added a tool to edit the nwjs' package.json file.
    - Added the option to adjust the compression level.

    CLI
    Changelog:

    - Added the command line argument --SetCompressionLevel to adjust the compression level (0 = Optimal, 1 = Fastest, 2 = NoCompression).
    -Slight performance improvements thanks to .NET Core's tiered compilation.
     
    #21
  2. Rachnera

    Rachnera Caffeinated Spider Veteran

    Messages:
    181
    Likes Received:
    56
    First Language:
    English
    Primarily Uses:
    RMMV
    Does this work only with Javascript, or with other directories too?
    Such as the overlay directory for orange overlay?
     
    #22
  3. AceOfAces_Mod

    AceOfAces_Mod Engineering to infinity! Veteran

    Messages:
    1,683
    Likes Received:
    1,119
    First Language:
    Greek
    Primarily Uses:
    RMVXA
    @Rachnera , this only works with Javascript files. Since plugin and script calls are stored on the Data folder, you'll need to obfuscate the JSON files or embed them to the Javascript files. For audio and image files, use the Deployment menu to encrypt them.
     
    #23
  4. Fhntop

    Fhntop Villager Member

    Messages:
    28
    Likes Received:
    22
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    Hey! This is pretty cool!
    I've just found out about this so I'm a bit too late and made my own script for compiling but yours seems way more complete.
    I saw on your video tutorial that you take the encryptionKey from System.json and edit the Decrypter object so as to hide it from prying eyes, which I find as a stroke of genius xD
    I may be talking nonsense here but isn't it possible that someone edits index.html and adds their own script tag with their sneaky js and then access Decrypter._encryptionKey?
    Thinking about this maybe it's best to change decryptArrayBuffer and hardcode the key there
    Decrypter.decryptArrayBuffer = function(arrayBuffer) {
    if (!arrayBuffer) return null;
    var header = new Uint8Array(arrayBuffer, 0, this._headerlength);

    var i;
    var ref = this.SIGNATURE + this.VER + this.REMAIN;
    var refBytes = new Uint8Array(16);
    for (i = 0; i < this._headerlength; i++) {
    refBytes = parseInt("0x" + ref.substr(i * 2, 2), 16);
    }
    for (i = 0; i < this._headerlength; i++) {
    if (header !== refBytes) {
    throw new Error("Header is wrong");
    }
    }

    arrayBuffer = this.cutArrayHeader(arrayBuffer, Decrypter._headerlength);
    var view = new DataView(arrayBuffer);



    //this.readEncryptionkey();
    var key = "encryption key here";



    if (arrayBuffer) {
    var byteArray = new Uint8Array(arrayBuffer);
    for (i = 0; i < this._headerlength; i++) {


    //byteArray = byteArray ^ parseInt(Decrypter._encryptionKey, 16);
    byteArray = byteArray ^ parseInt(key, 16);


    view.setUint8(i, byteArray);
    }
    }

    return arrayBuffer;
    };


    Then again, I haven't tested if it's possible to gain access to the encryption key like this but I thought it was best to say it.
     
    #24
  5. Dreadshadow

    Dreadshadow Lv 38 Tech Magician Moderator

    Messages:
    3,470
    Likes Received:
    2,215
    First Language:
    Greek
    Primarily Uses:
    RMMV
    [​IMG]
    This is fantastic!
     
    #25
    atoms and AceOfAces_Mod like this.
  6. Tuomo L

    Tuomo L Oldbie Veteran

    Messages:
    2,270
    Likes Received:
    1,224
    Location:
    Finland!
    First Language:
    Finnish
    Primarily Uses:
    RMMV
    The new update broke it, my compiled games boot into a black screen and nothing happens. Tried both normal optimization and no compression and still black screen.
     
    #26
  7. AceOfAces_Mod

    AceOfAces_Mod Engineering to infinity! Veteran

    Messages:
    1,683
    Likes Received:
    1,119
    First Language:
    Greek
    Primarily Uses:
    RMVXA
    This is weird... I checked the latest version and it worked for me. Is the deployed project set up right? If you can, can you show me the dev console's output? You'll need to run the deployed game on the SDK version of nwjs.
     
    #27
  8. Eliaquim

    Eliaquim Veteran Veteran

    Messages:
    391
    Likes Received:
    92
    Location:
    Brazil - Rio de Janeiro
    First Language:
    Portuguese - Br
    Primarily Uses:
    RMMV
    Hi @AceOfAces_Mod !
    I'm just trying your tool right now. Does this works with mobile deployments?
    Also, whats the difference of the Compression level?
     
    #28
  9. AceOfAces_Mod

    AceOfAces_Mod Engineering to infinity! Veteran

    Messages:
    1,683
    Likes Received:
    1,119
    First Language:
    Greek
    Primarily Uses:
    RMVXA
    Hey, @Eliaquim .

    1. The tool doesn't work with games that are deployed to mobile. The compiler coming with nwjs SDK (which my tool wraps around) is designed to only work on Desktop.
    2. The --SetCompression command line argument adjusts the compression applied to the archive when the game files are compressed (setting the --CompressProject argument as well, which creates an archive named package.nw). It follows .NET Standard's API setting. So:

    - Optimal is compressing the archive as best as possible, but it takes the longest to decompress.
    - Fastest compresses the archive quickly but the space savings are smaller. Although it's faster to decompress than the optimal compression.
    - No Compression doesn't apply compression to the archive at all. It's like you've never compressed it. This provides the fastest decompression but the archive will be just as big as the project before compressing it to an archive.

    Now, which compression you'll choose which is up to you. If nwjs sees the package.nw, it will decompress it to a temporary folder before starting the game (on Windows, at least), which will cause some delay at startup. The more compression is applied, the more time it takes to start the game up.
     
    #29
    Eliaquim likes this.
  10. Eliaquim

    Eliaquim Veteran Veteran

    Messages:
    391
    Likes Received:
    92
    Location:
    Brazil - Rio de Janeiro
    First Language:
    Portuguese - Br
    Primarily Uses:
    RMMV
    Thank you for your answer!
    I managed to make it work. However, I have a problem. When I try to test any game by the rpg maker mv editor it shows me this warning:
    [​IMG]

    "An error has occurred in your profile

    Your profile can not be used because it is from a newer version of NW.js. Some resources may not be available. Specify another profile directory or use a newer version of NW.js."

    Even so, I can make it work. But there are two errors ocurring:
    1 - The image has a small black bar on the sides. Really small.
    2 - This plugin no longer works. It enabled me to add some lights on the map inside the editor, now it does not open anymore.
    https://forums.rpgmakerweb.com/index.php?threads/lighting-and-time-editor-continued.86409/

    I had already had this problem when I upgraded nwjs following this post:

    https://forums.rpgmakerweb.com/inde...upgrade-nwjs-and-chromium-67-68-64bits.96908/

    But, to fix the problem, i have to format my computer.
    I though that the changes will be only applied to the project itself, but applied to all =/
    I don't want you to solve the problems, because i figure it out that i only have to rollback to the older version of nwjs.
    How can i do that?
     
    #30
  11. AceOfAces_Mod

    AceOfAces_Mod Engineering to infinity! Veteran

    Messages:
    1,683
    Likes Received:
    1,119
    First Language:
    Greek
    Primarily Uses:
    RMVXA
    Did you happen to run the game (deployed or not) with a newer version of nwjs? That's the most likely scenario. nwjs profiles aren't backward compatible with older versions. It's an easy fix: Windows Key + R -> type %localappdata% -> Click OK. -> Delete the folder named after the "name" variable in the game's package.json file.
     
    #31
    Eliaquim likes this.
  12. Eliaquim

    Eliaquim Veteran Veteran

    Messages:
    391
    Likes Received:
    92
    Location:
    Brazil - Rio de Janeiro
    First Language:
    Portuguese - Br
    Primarily Uses:
    RMMV
    Yes, i run the game with the newer version of nwjs that i download here to use with yout tool:
    https://nwjs.io
    When I saw the black bars, I suspected that it was the same problem that had happened to me before. So to confirm I opened other projects and the warning appeared.

    I manage to do what you say "Windows Key + R -> type %localappdata%"
    But i don't understando the other part you say abut the "name". Here what happens when i click OK after the command %localappdata%:
    [​IMG]
     
    #32
  13. AceOfAces_Mod

    AceOfAces_Mod Engineering to infinity! Veteran

    Messages:
    1,683
    Likes Received:
    1,119
    First Language:
    Greek
    Primarily Uses:
    RMVXA
    [​IMG]

    On the game's folder, there's a file named package.json. Open that file and look for a variable like the one on the photo above. The folder should be named like this (or if you added / on the variable, it will have the first section.

    Looking at the image you uploaded, deleting the "KADOKAWA" folder should do it.
     
    #33
    Eliaquim likes this.
  14. Eliaquim

    Eliaquim Veteran Veteran

    Messages:
    391
    Likes Received:
    92
    Location:
    Brazil - Rio de Janeiro
    First Language:
    Portuguese - Br
    Primarily Uses:
    RMMV
    This is my package.json
    [​IMG]

    I'm not understanding about this "variable". I did not find anything in package.json.
    I do not know the name of this folder that I should delete.

    I also delete the KADOKAWA folder, but the problem persisted = /

    [EDIT] I type process.versions in the F8 and look what is showing:
    [​IMG]

    [EDIT: Solved it.] - Manage to solve the problem with this post:
    https://forums.rpgmakerweb.com/inde...urred-during-playtest-game-play-nw-js.103824/
     
    Last edited: Apr 16, 2019 at 7:33 AM
    #34

Share This Page