ricklupton/rmscene

enabling debug dumping-as-json mode for v6 files

adq opened this issue · 8 comments

adq commented

If you set SCENE_FILE_V6_DEBUG=1 prior to running xochitl will start dumping the rm files as json files for debug when it saves them - it'll output in journalctl what the filenames are.

If you wanna enable this persistently:

[Unit]
Description=reMarkable main application
StartLimitIntervalSec=600
StartLimitBurst=4
OnFailure=remarkable-fail.service
After=home.mount
Wants=rm-sync.service

[Service]
ExecStart=/usr/bin/xochitl --system
Restart=on-failure
WatchdogSec=60
Environment="SCENE_FILE_V6_DEBUG=1"

[Install]
WantedBy=multi-user.target

Super interesting! Do you have an example of what such a file looks like? I don't have access to my ReMarkable at the moment since it's bricked :x

adq commented

Sorry to hear that!

I'll get a sample one together soon, but they can be pretty huge. Its the entire file in plain JSON format. For example here's block type 13:

    "SceneInfo": {
        "backgroundVisible": {
            "timestamp": "0:0",
            "value": 1
        },
        "currentLayer": {
            "timestamp": "1:1892",
            "value": "0:11"
        },
        "rootDocumentVisible": {
            "timestamp": "1:1887",
            "value": 1
        }
    },

and block type 8:

        {
            "CrdtTombstoneItem": {
                "deletedLength": 20,
                "id": "1:43",
                "left": "1:42",
                "parentId": "0:11",
                "right": "0:0"
            }
        },

patches incoming :D

Oh my

Did you discover this debugging flag yourself? It's stupidly useful for what we're doing here 😅😅

I did a bit of digging a while ago, even went as far as downloading ghidra and even getting a book on it.. but I felt it was a bit much given my other responsibilities.. glad to see there are other people digging!

adq commented

yeah, just found it this afternoon! I'd spotted there were some interesting strings which were clearly tracing from functions about "writing scene files out as JSON" so I went poking about.. and there it was!

Awesome! You should really share this discovery in the remarkable discord!

adq commented

Good plan: done!

Here's a simple sample of the RM file and its matching json file.

2584527c-7667-4b1c-994c-ae70215653e4.rm.gz
2584527c-7667-4b1c-994c-ae70215653e4.rm.tmp.json.gz

@adq that's great! Thanks for sharing and for the patches.

I've added a link to this issue in the README and so will close it here.