https://github.com/coolshrimp/Factorio- ... erver-Tool
![Image](https://forums.factorio.com/images/ext/ad91abf619d66d57b4dca5c0859a1829.png)
Ha that might be what it wasn't working for me, I have so far only enabled the editor as we had vastly underestimated what was needed to go to a new planet and tp'd myself back to nauvis, RIP first space platform.xrobau wrote: Mon Nov 04, 2024 2:01 amThis doesn't appear to work when purely enabling the editor. There is no 'command-ran' when simply starting a new game and then /editor.Pain12345 wrote: Thu Oct 31, 2024 5:22 pm I wrote a small Console application to patch the save game: https://github.com/Rainson12/FactorioSa ... hievements
Nice, I will see if I can get this working, I resigned myself to just using CE to re-enable the achievements every time I launch the game, which works a bit oddly sometimes.xevioni wrote: Fri Nov 22, 2024 12:25 pm I'm far from an expert in this stuff, but the above replies were immensely helpful in building my solution.
I hold a 25MB save with 120 or so hours in it, so I was kinda desperate to re-enable achievements.
Here's what I've found so far:
- The marker is a set of 1 byte booleans that are either 0x00 or 0x01 depending on their state. The command marker comes before the map editor marker, but they are always together it seems.
- After a certain amount of bytes (16 or less, roughly), two pairs of 8 byte sequences of just 0xFF occur. In older saves, they probably won't be right next to each other, but in newer saves, they likely WILL be.
- You can enable the map editor flag while disabling the command flag.
Here's a little printout from a program I was making to try and automate this process (especially the ZLib decoding/ZIP repackaging).
Most of the above images don't have a 0x01 0x00 0x01 sequence like this (I think). My program latched onto the Red byte, but it's irrelevant.
The green byte is the critical 'Command' flag that needs to be disabled. I just hardcoded the offset from the Red in my program, and it re-enables achievements just fine.
The blue byte, of course, is the map editor flag. And yeah, I set it to 0x01 and it changed the achievements disabled message to fit.
You can also see the 'command-run' text near the bottom of the range, which is the first thing my program latches onto.
- It first searches for the ASCII pattern 'command-ran' (although 'horizontal_flow' works too, it's just farther away, about 1,100 to 1,200 bytes away, this seems to be useful in the case of Map Editor).
- Then, it searches backward TWICE to find the 8-byte 0xFF sequences. It accounts for the possibility that they might be touching each other (like in the case above).
- Then, it looks for the first 0x01 byte. I don't know enough about it's possible offset or patterns, so this is where me hardcoding in the behavior came in handy.
I hope this comes in a little handy; I don't know whether I'd want to publish a specific program or anything as the critical section is really case-by-case. If you know what you're doing, it would be a shortcut for a solution, but if you don't know what you're doing - the above text is more helpful than my code.
This message will be edited later on IF I end up publishing something. Assuming I can edit my posts...
Thank you for this. I kept trying to fix the files on my own but it wasn't undoing anything in the save. (I just was using /c game.player.force.rechart() to update map for Solid Ore Colors in Map View mod but I guess that's a 'cheat' command.) Ran the console app and Boom Boom Boom Boom. Like I never disabled achievements.Pain12345 wrote: Thu Oct 31, 2024 5:22 pm I wrote a small Console application to patch the save game: https://github.com/Rainson12/FactorioSa ... hievements
It will
1. unzip the savegame
2. decompress all .dat files
3. screen the unzipped files for occurrence of "command-ran"
4. patch the 01 closest to the found occurrence by searching for "00 00 00 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF" binary pattern
5. pack the dat file again
6. Backing up original save file
7. Creating new save file by zipping everything again
8. Cleaning up the temporary folder
So after some digging I was able to re-enable my achievements after using both commands and running /editorxrobau wrote: Mon Nov 04, 2024 2:01 amThis doesn't appear to work when purely enabling the editor. There is no 'command-ran' when simply starting a new game and then /editor.Pain12345 wrote: Thu Oct 31, 2024 5:22 pm I wrote a small Console application to patch the save game: https://github.com/Rainson12/FactorioSa ... hievements
There IS 'editor-will-disable-achievements', which has '00000001000100000000000a0a00000000ffffffffffff' a fair way back from it, but that's not the 6/7 byte offset you have in your script. Where did you get those numbers from, out of curiosity?