Last active
May 8, 2024 17:44
-
-
Save aqt/8432b26a7a526e4d61ed13066b129567 to your computer and use it in GitHub Desktop.
Decode/encode save files used by the game The Messenger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
/* | |
If you run the script on an encoded file it will output a decoded file and | |
vise versa, because the action used to encode/decode is identical. The save | |
file format when decoded is plaintext JSON, which you can edit with your | |
favorite text editor. | |
You can find the save file at the following path. Please make a backup of the | |
file before you make any adjustments to it! | |
%userprofile%\AppData\LocalLow\Sabotage Studio\The Messenger\saveGame.txt | |
*/ | |
const fs = require("fs"); | |
if (process.argv.length < 4) { | |
console.log("Required arguments: <inFile> <outFile>"); | |
process.exit(1); | |
} | |
const inFile = process.argv[2]; | |
const outFile = process.argv[3]; | |
function convertFile(inFile, outFile) { | |
const data = fs.readFileSync(inFile, "utf-8").split("\r\n")[0]; | |
let convertedData = ""; | |
for (const char of data) { | |
const charCode = char.charCodeAt(0); | |
const isOdd = charCode % 2; | |
const nudge = isOdd ? -1 : 1; | |
const newCharCode = (charCode ^ 128) + nudge; | |
convertedData += String.fromCharCode(newCharCode); | |
} | |
fs.writeFileSync(outFile, convertedData + "\r\n"); | |
} | |
convertFile(inFile, outFile); |
Hey @aqt thanks a lot for this tutorial. It helped a lot. Ive gotten it to work and I achieved the Achievement.
I wish you the best.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @benxzmn, I will try to be detailed in guiding you as I don't know how much technical knowledge you have.
I recommend downloading this script by right-clicking the "Raw" button in the top right of this page, and choosing "Save Link As...". This way you can be sure you did not miss any letters when copying it. To make the steps easy I also suggest moving the file to the same directory as the game save files, otherwise you need to use the full file paths (instead of just the file names) when running the script.
The script should be run with Node which you will need to download and install.
node
command will then not be recognizedcd "%userprofile%\AppData\LocalLow\Sabotage Studio\The Messenger"
and run the command by pressing the Enter keyboard keynode
the_messenger_save_decoder.js
)saveGame.txt
)saveGameDecoded.txt
, can also besaveGame.txt
to overwrite the file but just to be sure I would recommend against it)node the_messenger_save_decoder.js saveGame.txt saveGameDecoded.txt
. The script reads the first file, and overwrites the second file. If you see any error message when running this command please share itsaveGameDecoded.txt
in a text editor (such as notepad, vs code. Do not use Word or similiar word processors as they may change the file unpredictably), and make your adjustmentsnode the_messenger_save_decoder.js saveGameDecoded.txt saveGame.txt
I have not explored the format beyond decoding it, for example what items have what IDs, so unfortunately I can not advise you on what to change to get certain results. I have only made the adjustment mentioned in the previous comment, which I inferred from the naming of the data.
Hope this will be of use to you!