Jump to content


Photo

How is woldata.key and game's serial combined?


  • Please log in to reply
1 reply to this topic

#1 XJDHDR

XJDHDR

    New Conscript

  • Members
  • Pip
  • 2 posts

Posted 08 January 2019 - 08:14 AM

I just want to know how exactly the serial and woldata.key are combined together to form the encoded serial stored in the registry for RA2 (and vice versa)? I ask because I recently noticed that Emperor: Battle for Dune appears to use the same mechanism for it's serial in the registry. I also noticed there is a program available to manipulate RA2's serial here: https://files.zzattack.org/index.php?dir=ra2

I would like to try my hand at making a similar program for E:BfD.

 

Thanks for any help anyone can provide.



#2 XJDHDR

XJDHDR

    New Conscript

  • Members
  • Pip
  • 2 posts

Posted 16 January 2019 - 08:06 AM

I managed to get a bit of info by sending a PM to zzattack. He can't remember exactly how they are combined but believes that "a super simple encoding" is used and pointed me towards this source code written by @Olaf : https://github.com/OlafvdSpek/xcc/blob/master/XWIS%20Client/dlg_serials.cpp

 

Unfortunately, C++ code is a bit beyond my depth. As far as I can tell, line 70 looks like what I'm looking for but I'm still trying to decipher what exactly is going on.

serial[j] = (serial[j] + s.data()[i] + 2) % 10 + '0';

Can anyone help me figure this out? Please and thank you!

 

Edit: From what I can tell, the function iterates through each number in the serial and woldata.key file and transforms the serial one number at a time until it reaches the end of the woldata number. It takes the number at position J in the Serial variable, adds the number at position I in woldata then adds 2. It then takes the sum of these numbers, divides by 10 and keeps only the remainder and then it adds '0'.

I think the main bit I'm having trouble with is the '0' at the end which is added to what the rest of the calculation spits out. I have no idea what this is supposed to do. I'm also a bit confused about how one is able to perform math operations on individual characters in the "serial" variable when that variable was initialized as a string. I also haven't been able to find any info on what "Cvirtual_binary" a few lines earlier is.


Edited by XJDHDR, 18 January 2019 - 05:40 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users