bgbennyboy / Dinky-Explorer

An explorer/viewer/dumper tool for games using the Dinky engine. That's Return to Monkey Island, Thimbleweed Park and Delores.
35 stars 3 forks source link

Modifying files in the pack / patch RtMI's .dinky script file #14

Closed JanFrederick00 closed 1 year ago

JanFrederick00 commented 1 year ago

I'm not sure if this is useful to many others, but I think it would be a nice addition.

What I did:

As an example, I have written a "simple" patch file to bypass the main-method's checks for the debug mode and thus enable all of the command line options (--testertron, --soaktron, --jumptron, --checkreachable)

{
    "title": "Enable debug command line options",
    "author": "JanFrederick",
    "description": "Re-activates the debug command-line options --testertron=roomname, --jumptron and --soaktron. Also adds a Log message on startup stating that the game's files have been modified.",
    "function_patches": [
        {
            "script": "Boot.dinky",
            "function": "main",
            "patches": [    
                {
                    "type": "add_local",
                    "index": 150,
                    "value": 1,
                    "valuetype": "int",
                },
                {
                    "type": "replace_instruction",
                    "index": 216,
                    "value": "POP",
                    "old_value": "JUMP_TOPTRUE 7",
                },  
                {
                    "type": "replace_instruction",
                    "index": 217,
                    "value": "JUMP 105"
                },  
                {
                    "type": "replace_instruction",
                    "index": 323,
                    "value": "PUSH_CONST 150",
                    "old_value": "PUSH_GLOBAL 83"
                },
                { 
                    "type": "add_local",
                    "value": "This game's scripts have been modified.",
                    "index": 151
                },  
                {
                    "type": "insert_instructions",
                    "index": 0,
                    "value": "PUSH_CONST 15 \nPUSH_CONST 151\n PUSH_VAR 17\n CALL 2"
                }
            ]
        }
    ]   
}

This patch also writes a message into the "Log.txt" file on startup.

Future improvements:

It would be nice if someone other than me could review this request as I changed quite a few files.

JanFrederick00 commented 1 year ago

I have added a GUI to create/edit patch files. This PR is obsolete.