Registration Code (Part 1): w%kQ6
Registration Code (Part 2): b<#$1[*(cw~
In order to register on this forum, you must use the codes above. Combine them into one code (copy paste).

Annoying problem reading the options table :(

Topics regarding the new upcoming ARPG Grim Dawn.
Post Reply
User avatar
immorrr
Posts: 110
Joined: Fri Mar 27, 2015 2:21 pm
Location: Germany

Annoying problem reading the options table :(

Post by immorrr » Sun Nov 01, 2015 7:52 pm

I wanted to read the current state of a users option for "Cloud Saving" since this would help me to prevent some often asked questions about my trainer.
I could quickly find some kind of structure for all the available options, the only option i am not able to get a valid ptr is for the "Cloud Saving State" :evil:

I did found some ptr which seems to be working, at least for me (couldnt test it any further). But this ptrpath is A: quite iff the main structure and B: looks really squishy...
If anyone around here might have an idea or could provide me with some other information how to solve this, i would really appreciate any help!
I am attaching a CE File where you can find the ptrpath / structure i am using to read the games optionstates to this post.

Thanks in advance!
Attachments
GD_Opt.rar
My current Options Table. [CE File]
(3.85 KiB) Downloaded 78 times
User avatar
atom0s
Site Admin
Posts: 403
Joined: Sun Jan 04, 2015 11:23 pm
Location: 127.0.0.1
Contact:

Re: Annoying problem reading the options table :(

Post by atom0s » Mon Nov 02, 2015 4:16 am

Are you using the legit Steam version of the game? Using this table yields invalid pointers for the whole table for me.

For me:

Looking inside of Engine.dll there is:
int __thiscall GAME::Options::Load(int, char *)

Which calls:
char __thiscall sub_10130300(char *this, int a2, char a3)

In here we have a loop that loads each of the options from the options file. This function loads the options.txt file located in the folder:
C:\User\Documents\My Games\Grim Dawn\Settings\options.txt

The options descriptions can be seen on the left with their value on the right. Cloud Saving is one of the options marked as 'cloudSaving'.
This value is handled as a boolean (true/false).

This function is called like this:

Code: Select all

001EF371 - 52                    - push edx
001EF372 - 8D 8B D8010000        - lea ecx,[ebx+000001D8]
001EF378 - FF 15 74923300        - call dword ptr ["grim dawn.std::_Mutex::_Mutex"+1C626] { ->Engine.GAME::Options::Load }
Debugging these, I came up with a base pointer for the allocated options object at:
[GAME::gEngine] + 0x290

From there I debugged the options array functions and found that cloudSave was being altered via:
[[[[GAME::gEngine] + 0x290]+0x90]+0]


Mileage may vary and this may not be a reliable address to use. Just a quick summary from looking at it.
Derp~
Need a great web host? Check out: AnHonestHost.com


Donations can be made via Paypal:
https://www.paypal.me/atom0s
User avatar
atom0s
Site Admin
Posts: 403
Joined: Sun Jan 04, 2015 11:23 pm
Location: 127.0.0.1
Contact:

Re: Annoying problem reading the options table :(

Post by atom0s » Mon Nov 02, 2015 4:25 am

Here are the two methods used to calculate the value:

Code: Select all

  {
    v32 = *(const char **)v33;
    v31 = v9;
    v12 = sub_101315C0((int)&v40, *(_DWORD *)(v7 + 4), v5 + 144);
    sub_1002B350(v12, (char)v32);
  }
  
  
int __userpurge sub_101315C0@<eax>(int result@<eax>, unsigned int a2@<ecx>, int a3)
{
  int v3; // edx@1

  v3 = *(_DWORD *)a3;
  if ( (a2 & 0x80000000) != 0 && a2 )
  {
    *(_DWORD *)result = -4 - 4 * ((-1 - a2) >> 5) + v3;
    *(_DWORD *)(result + 4) = a2 & 0x1F;
  }
  else
  {
    *(_DWORD *)result = v3 + 4 * (a2 >> 5);
    *(_DWORD *)(result + 4) = a2 & 0x1F;
  }
  return result;
}


int __userpurge sub_1002B350@<eax>(int result@<eax>, char a2)
{
  int v2; // edx@1
  signed int v3; // esi@1

  v2 = *(_DWORD *)result;
  v3 = 1 << *(_DWORD *)(result + 4);
  if ( a2 )
    *(_DWORD *)v2 |= v3;
  else
    *(_DWORD *)v2 &= ~v3;
  return result;
}
Derp~
Need a great web host? Check out: AnHonestHost.com


Donations can be made via Paypal:
https://www.paypal.me/atom0s
User avatar
immorrr
Posts: 110
Joined: Fri Mar 27, 2015 2:21 pm
Location: Germany

Re: Annoying problem reading the options table :(

Post by immorrr » Mon Nov 02, 2015 4:44 am

atom0s wrote:Are you using the legit Steam version of the game? Using this table yields invalid pointers for the whole table for me.
Yes i am! :P
atom0s wrote:Debugging these, I came up with a base pointer for the allocated options object at:
[GAME::gEngine] + 0x290

From there I debugged the options array functions and found that cloudSave was being altered via:
[[[[GAME::gEngine] + 0x290]+0x90]+0]
That is exactly the table i am using :)
I was just to stopid to try some 4byte values since i couldnt imagine this cuz for all the other options they are using byte/float ^^

Anyways, you've pointed me exactly into the right direction and my problem is already solved!
Thanks alot for your effort, you rock!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest