It is currently 04 Jun 2024, 03:01
   
Text Size

Modding Sealed decks and card unlocks

New decks and cards for Stainless Games' release

Moderator: CCGHQ Admins

Modding Sealed decks and card unlocks

Postby Puggity » 27 Jun 2013, 19:10

I haven't figured out a solution yet, but here's what I know.

The card unlocks and deck lists are stored in a profile file found in the Steam/userdata/<some number>/213850/remote directory.

There are two files: <some number>.profile and hash.file.

The profile can be edited with a hex editor to alter the cards unlocked, but upon running the game, it fails the hash check and it starts you over with a blank profile. Though it is polite enough to create a backup of the one it throws out.

It does this even with the modded d3dx9_43.dll in the game directory.

I tried running the profile through some common hashes and didn't get any matches.

But there's another angle to try. The game uses the same seed every time you unwrap your boosters for a particular slot so that you can't just wipe the data and redraw until you get exactly what you want. So what is the seed? Changing my Steam profile name didn't change my draws. It might use Steam account name, Steam ID or something else. I've been trying to scan and patch memory addresses for those values, but so far, I haven't been able to change the seed.
Puggity
 
Posts: 2
Joined: 27 Jun 2013, 18:42
Has thanked: 3 times
Been thanked: 0 time

Re: Modding Sealed decks and card unlocks

Postby RiiakShiNal » 27 Jun 2013, 21:36

If you hex edit the profile without updating the hash then of course it will fail the hash check when you start up.

This is the hash function used for DotP 2013 & DotP 2014 (written in C#):
Hash Function | Open
Code: Select all
      private UInt32 MtGHash(byte[] abytData)
      {
         UInt32 nHash = 0x811C9DC5;
         for (int i = 0; i < abytData.Length; i++)
         {
            nHash *= 0x1000193;
            nHash ^= abytData[i];
         }
         return nHash;
      }
Note that abytData is a byte array containing the entire Profile.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Modding Sealed decks and card unlocks

Postby Rick » 27 Jun 2013, 23:11

That hash is 32-bit FNV-1.
gibbed
Rick
Programmer
 
Posts: 40
Joined: 18 Jun 2011, 03:39
Has thanked: 0 time
Been thanked: 56 times

Re: Modding Sealed decks and card unlocks

Postby RiiakShiNal » 27 Jun 2013, 23:43

Rick wrote:That hash is 32-bit FNV-1.
Thank you, I did not know the name of that hashing function.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Modding Sealed decks and card unlocks

Postby Puggity » 28 Jun 2013, 00:00

Thank you. :) But what would I use to run that on the modded profile?
Puggity
 
Posts: 2
Joined: 27 Jun 2013, 18:42
Has thanked: 3 times
Been thanked: 0 time

Re: Modding Sealed decks and card unlocks

Postby RiiakShiNal » 28 Jun 2013, 02:07

Well you could put it into a simple command line program to create the hash when you drop a profile on it like this:
Code: Select all
using System;
using System.IO;
using System.Text;

namespace CreateHash
{
   class Program
   {
      private static UInt32 FNV1Hash(byte[] abytData)
      {
         UInt32 nHash = 0x811C9DC5;
         for (int i = 0; i < abytData.Length; i++)
         {
            nHash *= 0x1000193;
            nHash ^= abytData[i];
         }
         return nHash;
      }

      static void Main(string[] args)
      {
         if (args.Length == 1)
         {
            if (File.Exists(args[0]))
            {
               using (FileStream fsInput = File.OpenRead(args[0]))
               {
                  byte[] abytData = new byte[fsInput.Length];
                  fsInput.Read(abytData, 0, (int)fsInput.Length);
                  UInt32 unHash = FNV1Hash(abytData);
                  using (BinaryWriter bwOutput = new BinaryWriter(File.Create("hash.file")))
                  {
                     bwOutput.Write(unHash);
                  }
               }
            }
         }
      }
   }
}
Or you could make something super-complicated that runs as a service and when it notices that a profile and hash are mismatched it automatically generates a new hash, but that just seems like too much work to me.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Modding Sealed decks and card unlocks

Postby thefiremind » 28 Jun 2013, 08:56

I made a program that computes hash.file from the DotP2013 profile, but I don't know if DotP2014 profiles have the same size constraint. If you want to check it out, it's here:
viewtopic.php?f=99&t=8025
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Modding Sealed decks and card unlocks

Postby RiiakShiNal » 28 Jun 2013, 11:53

No, the size of 2014 profiles is different (mine is 21,558 bytes rather than the 2013 size of 4,292 bytes).

Looking at the code though your program should still work though it will give the "non-standard file length" warning each time. Your code also has more checks and feedback than what I just threw together. Though after looking at your code it has a couple of problems:
Code: Select all
   // free memory
   delete bytes;

...

   // free memory
   delete result;
Is wrong and should be (using delete on an allocated array is undefined in standard C++):
Code: Select all
   // free memory
   delete[] bytes;

...

   // free memory
   delete[] result;
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Modding Sealed decks and card unlocks

Postby cookiezeater » 30 Jun 2013, 11:17

I played with profiles a bit. Should i put sealed deck editing tutorial here on the forums?
cookiezeater
 
Posts: 14
Joined: 28 Jun 2013, 03:54
Has thanked: 4 times
Been thanked: 9 times

Re: Modding Sealed decks and card unlocks

Postby FrankJeager » 30 Jun 2013, 11:34

Thank you cookiezeater.
Maybe you could put your tutorial on the wiki instead or in the documentation subsection ?
FrankJeager
 
Posts: 5
Joined: 30 Jun 2013, 11:32
Has thanked: 10 times
Been thanked: 1 time

Re: Modding Sealed decks and card unlocks

Postby cookiezeater » 30 Jun 2013, 11:42

FrankJeager wrote:Thank you cookiezeater.
Maybe you could put your tutorial on the wiki instead or in the documentation subsection ?
I'm not really good at english, so maybe someone else will put it on the wiki for me. Tutorial is a bit messy, but these who know a bit about hex editing, will understand it.
http://www.slightlymagic.net/forum/viewtopic.php?f=62&t=10971 My post
cookiezeater
 
Posts: 14
Joined: 28 Jun 2013, 03:54
Has thanked: 4 times
Been thanked: 9 times


Return to Magic: The Gathering - Duels of the Planeswalkers

Who is online

Users browsing this forum: No registered users and 11 guests


Who is online

In total there are 11 users online :: 0 registered, 0 hidden and 11 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 11 guests

Login Form