Enable Ironman mode achievements and still use mods and ruler designer in Crusader Kings II

[Update] This investigation was made on CK2 v2.1.6. The steps below can still be applied to current versions, but memory addresses will be different. For people looking for a quick cheat, here is the Cheat Engine file for the latest CK2 (v2.3.2).

In my earlier post I explained how to alter the ruler designer in Crusader Kings 2 to remove the age restrictions. Many have pointed out that there are mods that already do this or that add new traits that can be picked up to just decrease the age. These discussions led me to think that the only advantage to my method is that, with a bit of extra tweaking, we could enable Iron Mode with achievements even if the ruler designer has been used. I sort of successfully tested this hypothesis and went a step further than that. The result is a pretty impressive. With this simple hack, everyone can now turn on the Ironman mode and have the Steam achievements enabled.

Nota bene, in my last post I did not research for alternatives that could achieve the same thing. I was simply not interested in that. Manipulating the game as I did was almost the entire interest that I had on the subject. The same applies to this post. I do not know and I honestly haven’t searched for alternative methods that allow someone to play with mods (and ruler designer) with achievements enabled.

I will do two things in this post. First, I will show you the quickest steps needed to achieve this in CK2 v2.1.6 by using the same Cheat Engine application. You can use any other memory hacker for this. Lastly, I will detail the steps I took in my investigation to reach to this solution, knowledge that will help you achieve similar things with any other game. Let’s dig in.

Quick steps on how to enable this in CK2 v2.1.6

1. Launch the game with your mods of choice.

2. Launch your memory hacker of choice and open the CKII process.

3. Look at the 4-byte value stored at 0x019F3F90. Copy that value. (This is a memory pointer).

4. Add 0x42 to that value (the memory pointer). The result will be the memory address of a value that tells the game if achievements are disabled or not.

5. Set to 1 the value stored at the memory address calculated in the previous step. If you click the Finish button in the ruler designer, you will have to set this value back to 1. Alternatively, some memory hackers allow you to “freeze” the value, so you only set it once to 1, freeze it, and no longer need to care about it. Or in other words, if the Ironmode button is not a green check mark, this value is zero and needs to be modified back to 1 to get the green check button.

For those of you using Cheat Engine, the program allows you to manually add a pointer directly, simplifying steps 3 to 5 . Simply click on “Add address manually” and select the following things as pictured below:

cheatenginepointer

Alternatively, you can just download and open this file (for v2.1.6) or this file (for v2.3.2) in Cheat Engine. The full steps would be:

1. Open the game and Cheat Engine (CE).

2. In CE, go to File -> Open Process and choose CK2game.exe from the list.

3. In CE, go to File -> Open File to open the file you just downloaded. You will now see an entry in the list of addresses, like in the picture below. The description will be “Enable Achievements in Ironman Mode”.

4. For that new entry, double click on its value (under the Value column). It will be either 0 or 1, and you need to set it to 1.

5. For the same entry, click on the check-box in the Active column to have it checked.

6. You can now play your game with achievements enabled. CE should look like this:

cheatengineironmode3

This method has a chance to not work with future versions of the game, but that is unlikely since the pointer is stored in a global variable. Nonetheless, the next section explains how to correctly determine the right pointer regardless of the game version.

How did you find this out?

I needed a starting point. It appears that the game has a variable that says if the Ironman mode is selected or not. By simply searching for zeroes and ones after enabling and disabling the Ironman mode back and forth, I found the memory address of that variable. Then I set a memory access breakpoint on it to see which code reads or writes to that variable. By doing this and then toggling the Ironman mode once again, I find where the relevant code interested in this variable is. Surely, the logic on whether to enable or disable achievements has to be somewhere in that code. The steps I took thus far were very similar to the methods described in my previous post about hacking the ruler designer.

Once I had set that access breakpoint it started being hit about every second. It turns out that there is a UI thread running this code again and again, constantly checking if the Ironman mode should be enabled or not, and then updating the button seen on-screen to reflect that choice. Here is where the breakpoint is triggered and how the code looks like.


cheatengineironmode1

As you can see from the comments I wrote, if the user wanted to enable Ironman mode, there is an extra check that determines if achievements should be enabled or not. If achievements should be enabled (there’s no game alteration) then “push 01” instruction is executed, otherwise “push 03” instruction is executed. To understand what these are, think of the Ironman mode button as a tri-state checkbox, or a button that has 3 states. These “push”-es that you are seeing are simply updating that button state. Here is the mapping between pushed values and states:

1- Ironman mode enabled, with achievements

2- Ironman mode disabled

3- Ironman mode enabled, without achievements

Now, as a simple exercise, you can modify the “push 03” instruction to “push 02” and notice how the Ironman mode button will never say that achievements are not enabled, even if you are using mods or if you just designed a new ruler. However, this change doesn’t REALLY enable achievements, it just forces that button to look differently. If you start the game, you will not receive any achievement.

But this is more than a good starting point. We can see the function call above (“call 00E71640”) that checks if achievements should be enabled or not. Maybe we can find something in there, some common code or variables that are used in other parts of the game to tell if achievements should really be enabled or not. But before looking at the function, do notice that we can now easily get the address of the variable that tells if achievements should be enabled or not. The code above uses instruction “cmp [eax+42],bl” to test that value, so [eax+42] is the address we want. 0x42 is a static value, but EAX is not. EAX is returned by the function call previously mentioned, the one we’re going to look at right now.

cheatengineironmode2

Well, well, well, aren’t we lucky? This function straight away assigns EAX a static address and doesn’t modify it thereafter. “mov eax,[019F3F90]”, this is where the magical number from the previous section comes from. This is obviously a pointer to a global structure used throughout the game, and the global variable that indicates achievements are enabled or not is stored at offset 0x42 in this structure, based on the code we saw in the previous function. At this point, we really got lucky. We do not need to dig through the code anymore to see how and where that value is determined and modified. We can simply set that value ourselves every time it changes, which is not frequently. From my observations, this variable is modified by the game once when the game is launched, when it checks if there are any mods running, and secondly, this value is modified by the game once more whenever we click the “Finish” button in the ruler designer. To alter the game behavior, we simply need to override this value after the game sets it, which is what the “quick steps” section above is describing.

The solution we found is good enough. There may be some other triggers in the game code that will modify this variable throughout the game, but I haven’t found one yet, and it is also unlikely. What I have not tested is using a cheat command, as they are disabled in Ironman mode anyway. If the game would constantly update this value, or not even store it in memory, but simply compute it on demand, then we would have needed to dig a lot more into the code that actually performs these checks. But that’s not the case.

In the future the pointer may change, but since we already found all the relevant functions we need, we can just search for the assembly code in those functions to quickly find them and then look at the new pointer address. From CE this can be done from the Memory Viewer and then clicking on Search -> Find assembly code.

What could be done next? I guess I will be looking into enabling the console in Ironman mode (and still earn achievements when used).

-Marcel

Advertisements

91 comments

  1. maitrecarotte

    Well, thank you very much, but could you please make a slightly more detailed tutorial for those who haven’t used CE once?

    • Marcel

      I have updated that section with easier steps for CE. In matter of fact, I uploaded a file that you can open in your CE to quickly enable the hack. Just follow the instructions, and let me know if you have more questions. Thank you for reading.

      • maitrecarotte

        Well, I apologize for bothering you, but it doesn’t seem to work for me now. The funny thing is it was working (well, to the point where I could activate the thing in CE and change the value; I couldn’t test if it works as intended as I didn’t have a fast achievement to try out), but it doesn’t now. Here’s what happens: http://imgur.com/hH740xw . I have no idea what changed. I tried verifying game cache and reinstalling it, I am 100% confident I’m following every step of your easiest instruction but the issue is there. Any tips?

      • Marcel

        I have verified that it still works with the latest Steam version (2.1.6). It looks to me that you opened the process in CE then restarted the game which essentially created a new process, so the memory that CE tries to read is no longer accessible (hence the ?? question marks). I would make sure to re-open the process in CE whenever you restart the game.

      • Mark Wisdom

        When trying to use the 2.3.2 file (after opening the .exe file) it loads the file but trying to click the icon to activate the cheat doesn’t do anything but make a “ding” sound saying something isn’t working right. Not sure what I’m doing wrong

      • math

        i cant get it to work no matter which method i use when i open the file it switches to physical memory or something, and i cant figure out how to get anything in the left window or the bottom one.

    • robert_nuckoles

      I did some modding with RTW II but me trying to follow this it might have well been in Mandarin. Any way you could update the file to work for 2.3?

    • Chris

      Can you do a tutorial on hacking the new defensive pacts gamerule? I’m not really a cheater but I started this game on 2.5.2 so I need a way to change the gamerule in ironman after the game’s been started

  2. Bibliofile

    Great Scott, I love you. You seem to ignore my professions of love, but I still love you.

    For 2.2, change the cheat entry of the table to:

    0
    “Achievements Enabled in Ironman Mode”

    80000008
    Byte
    01C422D0

    42

    And if anyone ever needs to change it again, the trick is looking for the opcode esp, 04 and eax, ebx. It’s the first result. Unlike the global variable, (IT LIES TO US) this shouldn’t change. It’s an instruction, so it’s not bound to memory.

    • Bibliofile

      The brackets disappear like magic…
      After Description “Achievements Enabled in Ironman Mode”, write (instead of the blank line shown in the previous post) in the bracket (which is after Description and Before Color in the cheat table):

      LastState Value=”1″ Activated=”0″ RealAddress=”30512C82″

  3. Ticondrius

    I am using CKII version 2.2 (VR WO) (Steam) and CE 6.4
    I’ve been at this most of the day. Trying to find the value myself results in a list of about 7 memory addresses. None show the pointer behavior the above tells me to look for, and they all toggle between 1 and 0 every time I click the Ironman button. When I try to create an entry with the modifications from the comments, I cannot change the value from “??” nor can I activate the line. Trying to enter the last comment’s corrections results in a series of loading errors on the line where I added {LastState Value=”1″ Activated=”0″ RealAddress=”30512C82″}.

    Can anyone help me figure this out? While a straight up CT file would be nice, I’d like to know how to find the address in the future as well.

    • Marcel

      I have updated the post with a CE file for version v2.3.2.

      Alternatively, in the future, open the Memory Viewer in CE and Search -> “Find assembly code” and type in the instructions you see in one of the pictures to find those functions.

  4. James

    Could someone who knows how to do this upload a file for the latest version? I get lost one he starts using memory viewer. Never needed to see this much coding before.

  5. Gurluas

    A better tutorial for this would indeed be appreciated, that or a file for the last patch!

  6. robert_nuckoles

    mods are selected, on ck main menu before launching and tried main menu of the game and when I add the file you uploaded the cheat table is not going into cheat engine. I took a screen shot but I cant upload it anywhere

    • robert_nuckoles

      err I did open process from main menu of game with the DLC/MOD tabs and from the main menu after launching the game I mean, and open file with the cheat table and the cheat engine 6.4 did not update

      if you choose you can email me at robert.nuckoles@gmail.com

      • Marcel

        I just verified with CE 6.4 and it has no trouble in opening my file. Alternatively, you can manually add a new pointer in the list with address 00CD27D8 and offset 42 (follow the steps described in the blog post). Also make sure you open the game process and not the game launcher process.

  7. robert_nuckoles

    I moved the .CT to the 6.4 folder, and when I opened it from there it put the table but it will not let me click the box and when I change the value to 1 from “??” it does not save. but i followed the steps and have no idea what i am doing or not doing.

    I am using 6.4, run CE, run the game, alt tab, choose the game, then the CT

  8. robert_nuckoles

    I went thru the mods and got rid of some, and now it is working so somewhere there must have been a conflict i guess thanks for the help and the CT!

    • robert_nuckoles

      -well I got the table to load I am going after a semi-quick cheevo to see if it updates

      • robert_nuckoles

        I got this to work once last week, i have not changed the mods i am using but it is doing the same thing as before. I load CE, then the game to the main menu with the single player, load game etc buttons. alt tab add the game, then the file you made and it will not let me change the value from ?? to 1 or click the box to turn it on. i uninstalled CE and deleted your file, redid both tried again and the same thing happened. what am i doing wrong to make this not work?

  9. The Honorable Don K

    So I can not figure this out. I start the game up as per usual. Then start CE 6.4. I load the game then the table 2.3.2. The table loads then all I get is ??. The address bar reads P->00000042. Not sure if that helps..

  10. The Honorable Don K


    I deleted it to see if it would work, and it did. Then I tested if the mod was the problem and reinstalled it, Same ??. SO I guess it’s the mod.

    • Marcel

      Looks like some mods are messing up the pointer. In that case, you have to do this in CE after opening my file:
      – open Memory Viewer
      – go to Search -> Find assembly code
      – in the ‘From’ box type 0. Leave the ‘To’ box unchanged (FFFFFFFF). In the big box, type the code: mov [eax+40],00010100
      – after you hit Scan, a result should show up. Double click it. This will select that line of code in the Memory Viewer.
      – below this line of code, there’s another like this: mov [],eax
      – copy that and use it as the address of the “Enable achievements in Ironman mode” list item in the main window. To do this, double click on that item under the Address column and paste it in the most bottom box (above the Add Offset button)

      • Marcin

        Thanks! Just when I gave up all hope I found it in the comments, works fine even with all my mods on, thanks a lot again!

  11. Anonymous

    Didn’t work I Tried to use this just have dlc downloaded including
    military orders unit pack
    ruler designer
    old gods
    republic way of life
    When I Try to change ?? to 1 in the cheat table it will just go back to question marks

    • Marcel

      [copy pasted from above]
      Looks like some mods are messing up the pointer. In that case, you have to do this in CE after opening my file:
      – open Memory Viewer
      – go to Search -> Find assembly code
      – in the ‘From’ box type 0. Leave the ‘To’ box unchanged (FFFFFFFF). In the big box, type the code: mov [eax+40],00010100
      – after you hit Scan, a result should show up. Double click it. This will select that line of code in the Memory Viewer.
      – below this line of code, there’s another like this: mov [],eax
      – copy that and use it as the address of the “Enable achievements in Ironman mode” list item in the main window. To do this, double click on that item under the Address column and paste it in the most bottom box (above the Add Offset button)

      • robert_nuckoles

        I have been running this scan for ages for mov [eax+40], 00010100

        how long should it take?

      • anon

        FWIW, I couldn’t find anything searching for “mov [eax+40],00010100”, but I immediately found it using a wildcard, searching for “*,000101000”.

  12. Mark Wisdom

    I am just having no luck getting either this or the other one (hack ruler designer) to work =/
    I keep getting a ??? value and it doesn’t let me try to activate the script you made, and I get a “ding” sound and it doesn’t let me change the ??? value or activate the script. I tried changing the pointer with what you said about digging through the assembly code but wasn’t able to get that to work either, tried copying and replacing the pointer with various bits of data from the indicated line of assembly code, but nothing worked. Any ideas?

  13. Schattenlampe

    Didn’t work for me aswell. However I was able to follow the instructions thus finding the value, but only in offline mode -> no achievements 😦
    In online mode the memory changing the button is ‘missing’.

  14. Jacek

    Hello Marcel.
    First of all, great guide.

    I have a question though, is it possible to load previously started ironman game (with mods and achivements) as normal game, edit some stuff with console, save and then use your method again to revert back to playing ironman with mods and achievements? If yes, could you tell me how.

    I am no programmer, so I have no idea if that’s possible but I would love to fix one tiny bug is ruining my current game with console 🙂

  15. mighty dog

    Been trying this now for the last day or so but just cannot find the right starting point, end up with about 11 addresses but none are leading to the right point. and that’s using both 1 and 0 on both enabling and disabling ironman, annoying as I have managed to do the ruler designer fine.
    Also seem unable to open the edit file unless from scratch and its then just giving me an FF value.

    So any tips would be appreciated or an awesome update would be great, cheers.

  16. asbo

    Thanks for this. I’ve tried to do the same for Europa Universalis IV, its annoying that you can’t get achievements on imported CK2 games, but most of this is way over my head. Any chance you could figure it out for EU4?

  17. H11T

    Apologies, I was on a Mod. Without mods you put for the pointer address

    “CK2game.exe”+1038EC0
    42 for the offset

  18. Reo

    Rather enjoy the article but they’ve complicated up the process again on 2.6.2

    When I do the search for the assembly code I get multiple returns and each one has multiple mov commands under it that share similar values to one another. Quite a pain in the arse but thank you for the tutorial I will keep working on it on my end but I am still a novice.

    Thank you for the Tutorial.

  19. sys

    How we change this one ?

    <?xml version="1.0" encoding="utf-8"?>
    <CheatTable CheatEngineTableVersion="24">
      <CheatEntries>
        <CheatEntry>
          <ID>0</ID>
          <Description>"Enable Achievements in Ironman Mode"</Description>
          <LastState Value="1" Activated="1" RealAddress="35C6970A"/>
          <VariableType>Byte</VariableType>
          <Address>0220588C</Address>
          <Offsets>
            <Offset>36</Offset>
          </Offsets>
        </CheatEntry>
      </CheatEntries>
      <UserdefinedSymbols/>
    </CheatTable>
    
    
    • H Con

      2.7.2? The latest released version is 2.7.1, and the pointer for that is CK2game.exe+E8D390. If you’re talking about that open beta which is a different 2.7.1 (I don’t know what it changes), the pointer is CK2game.exe+00E9D390. Offset is +36.

  20. anonymous doe

    The achievements are still disabled after using the ruler designer and changing the value to 1 so i don’t see what it would work for. The whole idea was to be able to use the Ruler Designer with achievements to begin with.

  21. dada

    could the issue be that now you get an event/popup for ironman after game start instead of a button to click?

    • e479

      CK2game.exe+EFA8F0. Offset: +36
      Set value to 0 (from 1)
      To enable achievements after use of ruler designer.
      Version 2.8.1.1

      • R237

        It doesn’t seem to work with mods, does it change the address with those?

      • e479

        You need two CK2game.exe+EFA8D0 pointers:
        Offset: +36, value 0 – for ruler designer
        Offset: +37, value 1 – for mods

      • R237

        Thanks for that!
        Activating both or either deactivates the “Steam must be active” requirement for achievements.
        And setting the mods one to 1 changes the ruler designer offset value to 256

  22. Drio98

    Hello, it’s my first time using CE, i put the current address (EFA8F0+37) to use mods and still have the achievements enabled but it’s not working and i’m not getting any achievement… can someone explain me how to do it? thank you

  23. Luxor

    Hi – I’ve managed to get this to work however when I load up the save achievements are again disabled – anyone know a fix for this?

    • e479

      Every time you load a save you need to enable them once again (by this method), the message about disabled achievements will be shown anyway, but it’s ok and doesn’t matter.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s