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,699
    Likes Received:
    1,152
    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. Nekohime1989

    Nekohime1989 'Monks Are Awesome' Veteran

    Messages:
    342
    Likes Received:
    155
    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,699
    Likes Received:
    1,152
    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,835
    Likes Received:
    2,483
    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,291
    Likes Received:
    1,262
    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,699
    Likes Received:
    1,152
    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 Raze: The Rakuen Zero's Guardian! Veteran

    Messages:
    729
    Likes Received:
    258
    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,699
    Likes Received:
    1,152
    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 Raze: The Rakuen Zero's Guardian! Veteran

    Messages:
    729
    Likes Received:
    258
    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,699
    Likes Received:
    1,152
    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 Raze: The Rakuen Zero's Guardian! Veteran

    Messages:
    729
    Likes Received:
    258
    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,699
    Likes Received:
    1,152
    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 Raze: The Rakuen Zero's Guardian! Veteran

    Messages:
    729
    Likes Received:
    258
    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
    #34
  15. AceOfAces_Mod

    AceOfAces_Mod Engineering to infinity! Veteran

    Messages:
    1,699
    Likes Received:
    1,152
    First Language:
    Greek
    Primarily Uses:
    RMVXA
    I've released a new update for the tool (it will arrive on the Microsoft Store soon).

    Core
    • Updated Newtonsoft.Json to 12.0.2.
    UI
    Changelog
    • Fixed a bug where the settings wouldn't be re-enabled after a failure.
    • Fixed a bug where the JSON editor would fill the icon location in the HTML file location text box instead of the icon location text box.
    • Improved the presentation of the output text.
    CLI
    Changelog
    • Improved the presentation of the text.
     
    #35
  16. AceOfAces_Mod

    AceOfAces_Mod Engineering to infinity! Veteran

    Messages:
    1,699
    Likes Received:
    1,152
    First Language:
    Greek
    Primarily Uses:
    RMVXA
    Hello everyone!

    I released a new version of the tool (both of the UI and command-line version). Both of them will see performance improvements.

    Changelog:
    Common
    - Ported over to .NET Core 3.
    - Compiled with Ahead-Of-Time compilation.

    UI
    - Improved High DPI support.

    CLI
    - Added Greek Translation.
    - Sight text cleanup.
    - Reduced space consumption (except the UI version, due to crashes caused by the PublishTrimmed option).
     
    #36
    Dreadshadow likes this.
  17. AceOfAces_Mod

    AceOfAces_Mod Engineering to infinity! Veteran

    Messages:
    1,699
    Likes Received:
    1,152
    First Language:
    Greek
    Primarily Uses:
    RMVXA
    Another update to the tool. This has some extra fixes and improvements.

    Common
    • Technical improvements.
    • New compression system.
    • Slight to moderate performance improvements.
    UI
    • Improved error messages.
    • The taskbar will now show progress.
    • Slight tweaks.
    CLI
    • The CLI will throw a warning if the –PackageApp flag is active and the –ReleaseMode flag isn’t included.
    • Added the –CompressionSafeMode flag to use the old system.
     
    #37
    kaukusaki likes this.
  18. HintonR

    HintonR Veteran Veteran

    Messages:
    194
    Likes Received:
    25
    First Language:
    English
    Primarily Uses:
    RMMV
    Hi there.

    Question about NWJS and upgrading. I'm currently working on a project I started in 1.5.1 and cannot upgrade due to compatibility issues with some plugins. Will it be okay if I just copy/paste a newer version of NWJS -- or will that break my current project.

    Also, for clarification -- when I deployed a cooked project using this -- It is not clear to me about the can only run on that version and that platform. Meaning only people with the same specs of my computer as of deployment will able to run the game or... what did you mean about that (I understand non-cross-platform) but Windows to Windows, for example -- I run Windows 10. So it will not run on other Windows versions?

    Thanks
     
    #38
  19. AceOfAces_Mod

    AceOfAces_Mod Engineering to infinity! Veteran

    Messages:
    1,699
    Likes Received:
    1,152
    First Language:
    Greek
    Primarily Uses:
    RMVXA
    @HintonR ,
    For the upgrade question, you can use a newer version of nwjs. The only reason to worry about compatibility issues is if you are using NodeJS scripts. If you are only using MV plugins, it shouldn't be a problem.

    For the Windows compatibility question, it will work in older versions of Windows.
     
    #39
    HintonR likes this.
  20. Poryg

    Poryg Dark Lord of the Castle of Javascreeps Veteran

    Messages:
    3,922
    Likes Received:
    9,900
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    If you update nwjs on MV 1.5.1, the playtest button won't work though and you will need to playtest manually every time.
     
    #40
    HintonR likes this.

Share This Page