Re-Enable Achievements...

Post all other topics which do not belong to any other category.
Coolshrimp
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat Oct 30, 2021 7:42 pm
Contact:

Re: Re-Enable Achievements...

Post by Coolshrimp »

feel free to test out the tool it will now patch and enable achievements again thanks for your code it works on my saves hope it works for the rest of you.

https://github.com/coolshrimp/Factorio- ... erver-Tool

Image
jakeroxs
Manual Inserter
Manual Inserter
Posts: 4
Joined: Mon Oct 28, 2024 11:08 pm
Contact:

Re: Re-Enable Achievements...

Post by jakeroxs »

xrobau wrote: Mon Nov 04, 2024 2:01 am
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
This doesn't appear to work when purely enabling the editor. There is no 'command-ran' when simply starting a new game and then /editor.
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.

Edit:
Definitely why it's not working for me, did the same and started a new game, did a console command to disable achievements, ran tool, achievements re-enabled.

Ran /editor to disable achievements, ran tool, error message I posted before, reloaded game and achievements still disabled (as expected), resaved game, re ran tool and no error, achievements still disabled.

For fun I then tried on the same save to run a command that would have disabled achievements thinking maybe it was a separate flag that could clear up both, reran tool and no error message but achievements still disabled.

So it definitely appears that /editor is somehow differently stored in the save for achievement disabling :(
sneednman
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sat Nov 16, 2024 6:00 pm
Contact:

Re: Re-Enable Achievements...

Post by sneednman »

I just wanted to say Pain12345's tool still works for patching, however I had to re-run a command in order for it to work. If it's not working for any of you, try re-running a new command, saving your world, and then running the tool as this fixed my issue.
xevioni
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sat Aug 03, 2024 5:48 am
Contact:

Re: Re-Enable Achievements...

Post by xevioni »

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.

Image

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...
jakeroxs
Manual Inserter
Manual Inserter
Posts: 4
Joined: Mon Oct 28, 2024 11:08 pm
Contact:

Re: Re-Enable Achievements...

Post by jakeroxs »

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.

Image

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...
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.

Edit: With lots of trial and error, and some modifications to the program Rainson12 wrote, I was able to find which .dat file I needed to hexedit to get this working.

Ultimately I found that because I ran /editor before running any other commands, command-ran was not found in my save so it couldn't find the right place, so I adjusted it to look for 'horizontal_flow' per your comment, then searched backwards for the hex string FFFFFFFFFFFFFFFF, found what looked to be the right section per your screenshot, adjusted the values to 00 and seems like achievements are enabled in the save!
TheCherry
Burner Inserter
Burner Inserter
Posts: 13
Joined: Fri Jan 18, 2019 10:00 am
Contact:

Re: Re-Enable Achievements...

Post by TheCherry »

I made a patcher too. Its catch the cases with editor, cheat and command.
Works for 2.0.21

https://github.com/dakiba/factorio_achi ... _space_age

EDIT: Sadly its seems to catch only local save games. We play on a dedicated server and use forces (the pvp scenario, but just for teams and bases). Chat messages are not recorded in the level.dat files there ... I see no way to find that important byte ....
KnightDemons
Manual Inserter
Manual Inserter
Posts: 1
Joined: Thu Dec 05, 2024 10:52 am
Contact:

Re: Re-Enable Achievements...

Post by KnightDemons »

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
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. 8-)
User avatar
louanbastos
Manual Inserter
Manual Inserter
Posts: 2
Joined: Tue Dec 24, 2024 9:31 pm
Contact:

Re: Re-Enable Achievements...

Post by louanbastos »

Image
Image
Image
Image
Image

There are some achievements that are locked by time or with other requirements, it would be interesting to have a way to reactivate these achievements and if possible set a longer time or remove that time.

Is there any mod/program/script that fixes and resets this?
naibudeshinu
Manual Inserter
Manual Inserter
Posts: 1
Joined: Thu Jan 16, 2025 8:17 pm
Contact:

Re: Re-Enable Achievements...

Post by naibudeshinu »

xrobau wrote: Mon Nov 04, 2024 2:01 am
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
This doesn't appear to work when purely enabling the editor. There is no 'command-ran' when simply starting a new game and then /editor.

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?
So after some digging I was able to re-enable my achievements after using both commands and running /editor

As discussed above, you are suppose to find 16 consecutive F's and flip the 1 to a zero but for me, I had a different line of code as shown here. What I found out was that the leftmost "1" was for the editor flag and the right-most "1" was for command flag. I tested this by flipping them and saw that my achievements were either disabled because "commands were used" or "map editor was used". So if you have used both like me, you will have to flip the first two one's in that sequence.

Image

I tried this on two fresh saves and the sequence was the same.This might be different for others but it took a little bit of testing to finally restore my save. Hope this helps.
Attachments
yo.png
yo.png (64.58 KiB) Viewed 212 times
Post Reply

Return to “General discussion”