CRYPTARK

CRYPTARK

Not enough ratings
Fix Achievements Guide
By Imperial
THIS GUIDE IS NOW DEPRECATED: THE DEVS USED MY CODE NEARLY 1:1.

WARNING: This guide is not for the faint of heart; it requires modifying the game's code via a decompiler. There ius a lot of room for mistakes to be made.
   
Award
Favorite
Favorited
Unfavorite
Step 0: Downloading dnSpy
DnSpy is a C#/Visual Basic/MSIL decompiler, able to edit compiled versions of games written in those languages. The original creator of dnSpy ceased development, but it is being maintained under the new repository dnSpyEx, which holds improved functionality and is more secure. Cryptark is a 32-bit game, so it is recommended to download the 32-bit version of dnSpy. However, the 64-bit version of dnSpy should work just as well.

Go to the link https://github.com/dnSpyEx/dnSpy/releases/tag/v6.4.1, and download either the 32-bit or 64-bit version of dnSpy. Do not download the .netframework or Source Code zips. Extract the zip once complete.
Step 1: Mounting the executable into dnSpy
Open dnSpy.exe. Then, go to the game's directory and drag the game's executable "Cryptark.exe" into the section entitled "Assembly Explorer" in dnSpy. This should automatically populate with every referenced .dll.

Unfortunately, the game has a strange way of integrating with the steamworks API. In order to get C# function references (required to be able to compile the changes we are going to make), you must use merge the Steamworks-CS.dll with the Cryptark assembly. To do this, right-click Cryptark in the Assembly Explorer window. Click the button entitled "Merge with Assembly...", and select from your game's install folder the file entitled "Steamworks-CS.dll". You must then save the module, either by clicking the floppy disc image at the top, or going to "File" and pressing "Save Module". A standard Ctrl+S will not work here.
Step 2: Enabling Achievement Handler
This is the tricky part. Small mistakes in this section will cause issues, so make sure to follow these instructions carefully.

First, expand the "Medusa" namespace. It should be around the 7th item down the list under Cryptark.exe in the Assembly Explorer.

Navigate to the "Program" script. Within the "using" statement's curly brackets, before the function call "start.Run();", right click on the empty space, and click "Edit Method (C#)...". write the following function call:
Steamworks.Steam.Initialize();
Then, click "Compile" in the bottom right.

You're half-way done! This edit was required in order to ensure that the steam API is initialized. Otherwise, the next edit would cause illegal memory access errors, and the game would immediately crash upon obtaining any achievements.

This next edit is a bit more complicated. Go the the "ScreenManager" script, and scroll down to line ~298, where it says "string achiID = artifactClass.AchiID;". Right click the empty space, and again click "Edit Method (C#)...". After the aforementioned line, write the following four lines:
if (!Steamworks.Steam.Stats.HasEarnedAchievement(achiID))
{
Steamworks.Steam.Stats.SetAchievement(achiID);
}

Don't worry about indentation, C# is a compiled language with end-of-line markers, so it is purely aesthetic. Click "Compile" in the bottom right again.

Now save the file, but not how you normally would; because each script is an individual file, using Ctrl+S will save the individual script you have open. Instead, either click the floppy disc sprite towards the top of the screen, or click File in the top left, and then click "Save Module", clicking "OK" when the window pops up. Ignore any settings therein, or any errors after pressing the OK button.
Additional Notes:
  • It is important to follow the placement of code exactly. Any deviation could lead to errors or unintended circumstances.
  • You will only earn achievements on steam AFTER closing the game. Changing this behavior would require more code, which'd only make the guide more complicated.
11 Comments
Imperial  [author] 19 Jul, 2024 @ 5:57pm 
None, anymore. The developers updated the game using the code featured here. I just left it up as legacy.
TooCoolP1g 19 Jul, 2024 @ 11:12am 
whats the point of doing this?
Mr. Pickles 5 Jan, 2024 @ 9:41pm 
123
Imperial  [author] 9 Dec, 2023 @ 12:51pm 
How are you able to launch with an outdated depot? Either way, on any depot younger than Nov. 8th it is unnecessary to follow the guide, because the devs implemented the same thing I outline how to do here. Anything older and you would still have to follow the guide to get achievements, but who knows, the devs might've changed how it works internally and made older versions not work for achievements.
Rebo0t 9 Dec, 2023 @ 8:03am 
I am getting a bunch of errors doing this now, even using an older depot. Should it be like that or did they fix it?
RisingSpirit 4 Nov, 2023 @ 12:20am 
Thank you for figuring this out! If you want a less invasive method, someone found that the "fna-unstable" beta also gives out achievements (I got DOS errors at startup, but it still eventually ran). The only catch is that you have to reach the achievement conditions again; it does not remember them from before switching.

https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=3070919958
Imperial  [author] 31 Oct, 2023 @ 2:32pm 
I got a Trojan:Win32/AgentTesla!ml warning when developing this, because I tried sending the exe to myself across the internet. I assume you mean on the cryptark executable, in which case I'd just recommend verifying the files and trying again. Likely a false positive, but if you're worried just run a full scan with whatever AV you use.
Arcs1 31 Oct, 2023 @ 1:47pm 
getting the Trojan:Script/Wacatac.B!ml notification from windows defender
Jäger 30 Oct, 2023 @ 9:38am 
123
Imperial  [author] 28 Oct, 2023 @ 6:40pm 
Ah yeah; Implementing a section for already unlocked artifacts is definitely achievable, I'll try to write something up in the future for that. Secondly, I forgot to add the namespace reference before the calls, as I was copying it from my already completed work, which the compiler already optimized. Oops. Should be fixed now. Thanks for the heads up!