Page 5 of 6

Re: Re-Enable Achievements...

Posted: Sun Aug 23, 2020 10:48 pm
by cnflrpngrkn
I foolishly started with solutions earlier in the thread instead of the latest ones. The byte for me is pictured here (found by searching for "command" to find the chat log, then scrolling up, and choosing the "01" in the same-ish location as the above solution). Version 1.0.0.
byte.png
byte.png (52.01 KiB) Viewed 10709 times

Re: Re-Enable Achievements...

Posted: Wed Sep 09, 2020 2:39 pm
by 3ap
cnflrpngrkn wrote:
Sun Aug 23, 2020 10:48 pm
I foolishly started with solutions earlier in the thread instead of the latest ones. The byte for me is pictured here (found by searching for "command" to find the chat log, then scrolling up, and choosing the "01" in the same-ish location as the above solution). Version 1.0.0.
byte.png
Thank you, it works for me. Version 1.0.0 (build 54889, win64, steam).
I found the chat log, scrolled up until I saw the first non-printable characters, found there "FF FF 00 01 00 01" and changed it to "FF FF 00 00 00 01".
change.png
change.png (67.25 KiB) Viewed 10484 times

Re: Re-Enable Achievements...

Posted: Sun Oct 25, 2020 6:11 pm
by MPeti1
In a vanilla test map specifically made to find out how to do this I was able to find that string, with it following the command that I typed then.
Interestingly, in that case it was (FF FF FF FF FF FF FF) FF 00 00 01 00, and not FF 00 01 01. Flipping that bit to 00 made the game throw an error. There was near a bit later a 00 01 01 00, but flipping any or both of these 2 bits to 00 resulted in different errors.
It surprised me that Factorio printed a somewhat detailed error message in these cases, instead of just printing a generic error. Some of them were bad allocation, some index error, and something with id 256 not existing, but I don't remember precisely enough because it was already half an our ago.

But the real question is about my main map: what if I can't find "command-ran" in the level.dat of my save? I use HxD, and of course used the search in test-string mode. I wasn't able to find even the command that I ran like in your examples and my test map, could this be because I used /sc?
I used it when I was trying out the new mod global variables viewer, and it gave me this command to run. I thought I restored the save after trying it, but I was wrong, and just now ~60 hours or more later I noticed
It is a modded map in 1.0.0.

Edit:
I've tried to replace 01 to 00 in all occasions when I found this sequence: FF FF FF FF FF FF FF FF 00 01, but it wasn't successful.
There were 9 occasions, 2 of which resulted in "Corrupt map: unknown tile 0.", and other 7 in the map being loaded, but AAI Signal Transmission crashing because of trying to enumerate an int

Re: Re-Enable Achievements...

Posted: Sun Oct 25, 2020 8:41 pm
by MPeti1
I don't seem to find a solution. /sc seems to make this considerably harder, because there won't be any "command-ran"s.
Anyway, If some of you have the time, I would appreciate if you could take a look at my save. Nauvis as a string can't be found at the beginning of a "surface section" (I call it this way because I found other surfaces from Space Exploration in a very similar structure below), but I think it would be at around 00076E10 because of similarities between the test save, like the "è?ÍÌÌÌÌÌÜ?š™™™™™á?", the "?.333333ë?", and the "ð?{.®Gáz”?":

test save nauvis surface header:
test save - nauvis surface header?
test save - nauvis surface header?
1.png (4.29 KiB) Viewed 10072 times
1.png

main save nauvis surface header:
main save - nauvis surface header?
main save - nauvis surface header?
2.png (4.5 KiB) Viewed 10072 times
2.png

After the part that is "aligned" by those chars at the sides of the lines, one file continues with me running the command (at 00077650),
test save - nauvis surface later?
test save - nauvis surface later?
3.png (12.79 KiB) Viewed 10072 times
3.png

and the other with randomness (at 0B3C7C40):
main save - nauvis surface later?
main save - nauvis surface later?
4.png (8.06 KiB) Viewed 10072 times
4.png

Re: Re-Enable Achievements...

Posted: Sun Nov 22, 2020 1:07 pm
by Lloydimus
3ap wrote:
Wed Sep 09, 2020 2:39 pm
cnflrpngrkn wrote:
Sun Aug 23, 2020 10:48 pm
I foolishly started with solutions earlier in the thread instead of the latest ones. The byte for me is pictured here (found by searching for "command" to find the chat log, then scrolling up, and choosing the "01" in the same-ish location as the above solution). Version 1.0.0.
byte.png
Thank you, it works for me. Version 1.0.0 (build 54889, win64, steam).
I found the chat log, scrolled up until I saw the first non-printable characters, found there "FF FF 00 01 00 01" and changed it to "FF FF 00 00 00 01".

change.png
You saved my life, thank you very much

Re: Re-Enable Achievements...

Posted: Sat Nov 28, 2020 10:43 pm
by tobsn
Hello i have a problem. i can't find the save files. where should they be stored?

Re: Re-Enable Achievements...

Posted: Sun Nov 29, 2020 1:39 am
by SWSe
tobsn wrote:
Sat Nov 28, 2020 10:43 pm
Hello i have a problem. i can't find the save files. where should they be stored?
This depends on your system and how you've installed it. Probably in %appdata%/Factorio/saves
The wiki lists all possible places here: https://wiki.factorio.com/Application_d ... #Locations

Re: Re-Enable Achievements...

Posted: Sun Nov 29, 2020 9:41 am
by tobsn
Thanks have found it. But I don't know what exactly I should look for in Level.dat, can anyone tell me that right now?

I am confused

Re: Re-Enable Achievements...

Posted: Sun Nov 29, 2020 8:55 pm
by Hersh
Factorio 1.0 - With mods + Multiplayer

As I had typed the command and kept playing for days, it was impossible to find the bit responsible for disabling the achievements, I only found it after typing the same command on the console and saving the map again, so I searched for "command" and found the responsible bits.

Image

Re: Re-Enable Achievements...

Posted: Mon Dec 07, 2020 11:21 am
by Furuchi
Hello, can someone help me and enable achievements for this save? I tried pretty much everything I saw on this post but couldn't make it work. Version 1.1.5
https://drive.google.com/file/d/1r_irPR ... sp=sharing

Re: Re-Enable Achievements...

Posted: Fri Dec 11, 2020 2:37 pm
by MPeti1
Hersh wrote:
Sun Nov 29, 2020 8:55 pm
Factorio 1.0 - With mods + Multiplayer

As I had typed the command and kept playing for days, it was impossible to find the bit responsible for disabling the achievements, I only found it after typing the same command on the console and saving the map again, so I searched for "command" and found the responsible bits.

Image
You are the hero! This way I was able to fix it, thank you!

This is my example, it's Factorio 1.0.0 with lot's of mods:

The point is that when you run the command, (and then save,) and search for 'command' in the (level.dat) file, the first result will be the last time you ran a command. You need to look a few lines above that for a sequence of 'ÿ'-s in the text view (FF-s if you look on the hex view), and after those you'll probably find a sequence of '00 01 00' in the hex view. you'll need to select the 01, change it to 00, save the file, and put it back in the zip of the save, overwriting the old level.dat file.
2020_12_11_15_43_15_Greenshot.png
2020_12_11_15_43_15_Greenshot.png (188.56 KiB) Viewed 9444 times
Some technical details:

I've executed the command that I think I've ran when I forgot to load an earlier save. It's hard to say for sure, because the command history of the console (that you can access with pressing the up and down arrows on the keyboard while the console is open) is stored globally, and not separated for every save, and so there were commands too that I've used in other saves.
Anyway, judging from the structure, I'm not sure if you need to use the exact same command.

Also, turns out old chat messages are maybe not stored indefinitely in the save file, and that's why I wasn't able to find the string 'command-ran'?
I think, from a technical point, the 'command used' bit is just a little before where the 'visible chat history' begins. And because that section stores the chat in reverse order, if you run a command and you search for it, you will find where the section begins, and then it's easy to find the bit in question: we had already known that the bit is after a couple of FF's and a 00, and now we also know that it's very close to the beginning of the chat history, and how we can find that.

Re: Re-Enable Achievements...

Posted: Mon Mar 29, 2021 4:17 am
by roygbiv
level.dat no longer exists and it appears it's now a series of compressed files with a number appended on the end.

Anyone know the format of these and how to reconstruct level.dat?

Re: Re-Enable Achievements...

Posted: Thu Apr 08, 2021 5:08 pm
by darkdex52
I can confirm that level.dat isn't a file in savegame zips anymore. Anyone knows how to enable Steam achievements with mods in the latest version?

Re: Re-Enable Achievements...

Posted: Wed Jul 14, 2021 7:33 pm
by pawelzwronek
I've made small tool to unpack compressed(zlib) .datX files. The hot byte is located in one of the last of many of .datX files.

1. Extract savegame zip
2. Go to https://pawelzwronek.github.io/factorio-save-unpack/
3. Use Unpack command and select one of the last of .datX files
4. Save unpacked file
5. Open it with HxD or any other hex-editor
6. Search for horizontal_flow string. If found use MPeti1 instruction above to clear the hot byte. I've noticed that factorio also set another byte, when you use /editor command. This byte is next to the hot one.
7. Save modified file and pack it with Pack command on the page.
8. Replace original .datX file and done. You can load the game directly from unpacked gavegame folder or compress it back to zip.

Re: Re-Enable Achievements...

Posted: Sat Jul 24, 2021 1:50 pm
by keht
My search string was FF FF 00 01 00 for the game v1.1.36.

1. Unpack your save zip (on my PC it is located in c:\Users\keht\AppData\Roaming\Factorio\saves\). Make sure you have a backup!
2. Find a lot of 'level.datX' files
3. Starting from the last file do:
- Using the tool provided by pawelzwronek (thanks a lot!) unpack the file
- Search for FF FF 00 01 00 using any hex editor (I used HxD)
- If you are unlucky, try with the next file
- If you have found the pattern:
-- Change 01 to 00
-- Pack the changed file using the tool
-- Pack everything to zip
-- Done!

In my case, the patter was in file #39 (I have 40 files in total)
Image

Re: Re-Enable Achievements...

Posted: Wed Aug 25, 2021 2:29 pm
by E_Laren
@pawelzwronek

Thanks for writing that utility at https://pawelzwronek.github.io/factorio-save-unpack/ but I'm getting a "incorrect header check" when I try any of my saved games. Did the 1.1.38 version break it?

Re: Re-Enable Achievements...

Posted: Wed Aug 25, 2021 8:45 pm
by azesmbog
My achievements were broken many centuries ago, probably back in version 0.18, not through my fault, but because several hundred thousand biters just got stuck on the map and did not move. Then, a few years later, it was repaired, but then they had to be destroyed with a script, and the UPS immediately increased by +8, then it was a lot.
Special achievements were not needed, but since there is already such a wonderful utility, why not give it a try.
keht wrote:
Sat Jul 24, 2021 1:50 pm
In my case, the patter was in file #39 (I have 40 files in total)
40 files is very little :)
I first tried on someone else's save,
out of 127 files, the desired one was found in 124 files, only 4 files had to be rechecked.
Then I decided to fix my save.
There were only 6998 files, and it took much longer to search from the end. Only after checking 16 files was the text string "command-ran" found in file number 6982
Voila!
Game version 1.1.35

@pawelzwronek
Thanks for writing that utility !!!

Re: Re-Enable Achievements...

Posted: Fri Oct 29, 2021 6:55 pm
by xpodo
Was save files changed? i cannot find the string in any file. I even tried to look into code but it seems even coding is different.

Re: Re-Enable Achievements...

Posted: Sun Nov 07, 2021 1:26 pm
by CodenBeast
keht wrote:
Sat Jul 24, 2021 1:50 pm
My search string was FF FF 00 01 00 for the game v1.1.36.

1. Unpack your save zip (on my PC it is located in c:\Users\keht\AppData\Roaming\Factorio\saves\). Make sure you have a backup!
2. Find a lot of 'level.datX' files
3. Starting from the last file do:
- Using the tool provided by pawelzwronek (thanks a lot!) unpack the file
- Search for FF FF 00 01 00 using any hex editor (I used HxD)
- If you are unlucky, try with the next file
- If you have found the pattern:
-- Change 01 to 00
-- Pack the changed file using the tool
-- Pack everything to zip
-- Done!

In my case, the patter was in file #39 (I have 40 files in total)
Image
Ive tried this method with my save file and i found the pattern in one of them.(155 out of 157) I changed FF FF 00 01 00 to FF FF 00 00 00. But the achievements are still disabled. Any ideas?

Re: Re-Enable Achievements...

Posted: Mon Dec 13, 2021 6:48 am
by JacobC1921
Alrighty, Just got this working on the latest version for myself (1.1.49) on steam.

Also made an account just for this, so you're welcome....

What you will require:
HxD
Pawelzwroneks Factorio savegame .datX unpacker/packer
A Factorio save

Step 1: Getting the tools
Download HxD from above, and open up Pawelzwroneks GitHub page, go to %appdata%/Factorio/saves (or wherever your saves are located) and make a backup of the world. Mine is called caydog.zip, so I copied caydog.zip to caydog_BACKUP.zip. Move the original zip to your desktop or somewhere without clutter, I suggest making your own folder. Simply unzip the world, you should have a folder with the name of your world inside, then inside that, heaps of level.datXX files depending on how long you've played.

Step 2: Unpacking
Heres the annoying step, you're gonna want to go back to the Github page, click the "Choose File" button after "Unpack", and select your level.dat0 file. This will download a new file with a randomly generated name. Rename the file that was downloaded to something like "level.dat0u" for ease. Now do this with every level.datXX file in that directory. Personally, after 30Hrs of in-game, I had 20 level.datXX's all up (level.dat0->level.dat19). You should now have the same amount of level.datXXu's as level.datXX's in the original folder.

Step 3: HxD
Open up HxD, then drag all of the level.datXXu files into the main screen, it should open them all up in different tabs. You're going to want to find (CTRL+F) for a Text-string called "command-ran". As long as you haven't been cheating this whole entire time, there should only be a few files that return results. For ANY file that managed to find the string "command-ran", you want to move it to a separate directory, these are the files we're going to be patching. Delete all of the level.datXXu files that didn't find the string, theyre no help to us. Personally, I had one file (level.dat18u), which made it easier, but you may have more.

Step 4: Patching
Now that you have all of the files in a directory, your want to open them all up in HxD again, then do a Hex-values search for "FF FF 00 01 00". Now on the left side, you need to change it from "FF FF 00 01 00" to "FF FF 00 00 00", by replacing the 1 with a 0. Rinse and repeat for all the files. Click File > Save All, the close HxD. In the directory, you should see all of the level.datXXu files, as well as level.datXXu.bak files, just delete the .bak files, they're not needed.

Step 5: Re-packing
Head on back to Pawelzwroneks GitHub page, then next to Pack, click Choose file, you're gonna want to choose all of those level.datXXu files that we just edited, you'll have to change the .bin at the bottom of the file chooser to all files to see them. Do the rename thing again, this time removing the trailing u character. For instance if you uploaded a level.dat19u, you should rename the downloaded file to level.dat19. Once you have all of these re-downloaded, jump to the next step.

Step 6: Finalizing
Well this is exciting, final step!
Take all of those downloaded files, and find where you extracted your save to for the first time, where you originally got the level.datXX files from. You're just going to cut and paste the downloaded ones into there. Make sure to replace (obviously) when prompted. Then go up a directory, select your world name, zip it any way you want (I use 7-zip, so simply right click the folder > 7-Zip > Add to archive), and move it back to your factorio saves location. Double check by opening up the zip file, that it contains a single folder, with your world name, and multiple files and directories inside that. Launch factorio, and see if you can open your world! If so congratulations, you got achievements back, now stop cheating!

Step 7: If corrupt
If it says something about the world being corrupt, or if it just doesn't open, go back, re-read this tutorial, try it again. If it doesnt work a second time, then maybe its been patched idk. To revert your world back to normal, simply delete the .zip you made, then rename your *_ BACKUP.zip file back to normal.

Hope this helps!