It is currently 16 Jun 2025, 07:44
   
Text Size

Information pending...

Moderator: CCGHQ Admins

Re: Information pending...

Postby spirolone » 19 Jun 2015, 14:39

Xander9009 wrote:Anyway, does anyone know at least if the profile file works the same way for steam and cracked versions of the game? I can't get it quite yet, but I'm interested in trying to see about adding/removing/modifying decks. Only, I'm afraid that if the deck storage is different between steam and cracked versions, I'd do a bunch of work and it would all be useless once I buy the game, which I'm definitely going to do now that modding it seems so much closer. I may end up actually sticking with 2014, personally, if the 1024 card limit can't be overcome, but we can't really find that out for sure until we can insert a deck directly into the profile, so I think that's the next step for my end of things.

So, if anyone (I think you might be the only one who could confirm either way, spirolone) if the profile works the same or different for steam and cracked versions, then I could go ahead and start on that (and if no one knows, then I might just get started anyway).
I think profile file is the same in every version: I didn't test it personally but my tool for modifying profle file seems to work in any case, and I didn't receive reports about problem with one version...
Regarding 1024 cards limit, I noted that in profile file there are 512 (0x200) bytes reserved for store unlocked cards; in any byte a single card use 4 bits, so I think 1024 is correct limit. I tried to make some changes to enable more cards, but none worked.
Is it really a too low limit?
However, I think I will write a code in Java to start to work on profiles, cause old one is based on Excel VBA (not best platform to work with!)! :oops:
spirolone
Programmer
 
Posts: 190
Joined: 31 Aug 2014, 23:14
Has thanked: 7 times
Been thanked: 107 times

Re: Information pending...

Postby thefiremind » 19 Jun 2015, 16:23

spirolone wrote:Maybe I find a problem: in C# BigInteger ToByteArray returns an array with bytes in little-endian order, instead Java one is filled with bytes in big-endian order!!! #-o
Nice finding... but it turns out that even BigInteger.Parse could need the string in little-endian order, so I don't know exactly where to convert... I'm going by trial and error, and I haven't found the correct sequence of actions for now.

EDIT: Now the constants "n" and "e" seem to contain the same value as in the Java program, but it still doesn't work.
EDIT 2: A step forward: I had forgot to reverse the data array as well when declaring the "c" BigInteger. Now the ZIP file is created, but it's corrupt. The curious thing is that it's only partly corrupt: some files can be extracted, some other files can't.
EDIT 3: OK, the problem was in the "Remove non-data bytes" section. I made it like this now:
Code: Select all
            if ((sbyte)(result[zeroes]) == -0x80)
                zeroes++;
            while ((sbyte)(result[zeroes]) == 0)
                zeroes++;
...and the ZIP file works 100%.
Just out of curiosity: are there alternatives to the signed byte cast? My mistake was to add 128 to the right of the 2 equations (instead of using the cast), which was probably stupid, but was I near a different solution? Not that casting bothers me much, it's just that I rarely have had to do with signed/unsigned problems and I'd like to learn something extra. :)
EDIT 4: I modified the original function so that it returns a stream containing the ZIP file, then made 2 functions calling that one, the first creates the ZIP (as ZedToZip already does), the second extracts the files directly from the stream. It's starting to look like a useful library. 8)
< 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: 722 times

Re: Information pending...

Postby spirolone » 19 Jun 2015, 19:37

thefiremind wrote:OK, the problem was in the "Remove non-data bytes" section. I made it like this now:
Code: Select all
            if ((sbyte)(result[zeroes]) == -0x80)
                zeroes++;
            while ((sbyte)(result[zeroes]) == 0)
                zeroes++;
...and the ZIP file works 100%.
Just out of curiosity: are there alternatives to the signed byte cast? My mistake was to add 128 to the right of the 2 equations (instead of using the cast), which was probably stupid, but was I near a different solution? Not that casting bothers me much, it's just that I rarely have had to do with signed/unsigned problems and I'd like to learn something extra. :)
I was just writing that I also experienced that only some files in Zip archive were corrupted, and it was reason for me to add check on length of result and "Remove non-data bytes" section! Another bug I had was related to minus sign in that -0x80: with unsigned bytes I think it isn't needed and you can simply write "if ((result[zeroes]) == 0x80)"; in "while" statement, then, I think you can simply delete cast. To add 128 doesn't work cause in signed byte first bit is considered negative instead of positive, so that "1000 0000" is -128 instead of 128 and difference is 256... :mrgreen:
spirolone
Programmer
 
Posts: 190
Joined: 31 Aug 2014, 23:14
Has thanked: 7 times
Been thanked: 107 times

Re: Information pending...

Postby spirolone » 19 Jun 2015, 19:41

thefiremind wrote:I modified the original function so that it returns a stream containing the ZIP file, then made 2 functions calling that one, the first creates the ZIP (as ZedToZip already does), the second extracts the files directly from the stream. It's starting to look like a useful library. 8)
Good job, I think it could be usefull! :D
spirolone
Programmer
 
Posts: 190
Joined: 31 Aug 2014, 23:14
Has thanked: 7 times
Been thanked: 107 times

Re: Information pending...

Postby thefiremind » 19 Jun 2015, 19:43

spirolone wrote:with unsigned bytes I think it isn't needed and you can simply write "if ((result[zeroes]) == 0x80)"; in "while" statement, then, I think you can simply delete cast.
Thanks, it worked. :)
< 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: 722 times

Re: Information pending...

Postby spirolone » 22 Jun 2015, 15:56

I wrote a Java class to manage .profile files. I think it contains primitives an editor may need (mainly read/write available cards and decks) and I hope it could be usefull. :mrgreen:
Method "main" is only for testing pourpose: it writes a bin file with "decoded" content of profile, one with numbers of available cards, and shows infos about first deck stored.
Attachments
Profile.zip
(5.4 KiB) Downloaded 356 times
spirolone
Programmer
 
Posts: 190
Joined: 31 Aug 2014, 23:14
Has thanked: 7 times
Been thanked: 107 times

Re: Information pending...

Postby Scion of Darkness » 22 Jun 2015, 20:48

GrovyleXShinyCelebi i dont know if it is just with me, but for some strange reason your wads make my deck editor crash (i do see all the cards), but the zed with modded cards is ok (i did try with skydrow and now with 3dm, and i do have the d3dx9_43.dll installed)
User avatar
Scion of Darkness
 
Posts: 235
Joined: 27 Aug 2012, 13:14
Has thanked: 17 times
Been thanked: 23 times

Re: Information pending...

Postby thefiremind » 23 Jun 2015, 09:22

spirolone wrote:I wrote a Java class to manage .profile files. I think it contains primitives an editor may need (mainly read/write available cards and decks) and I hope it could be usefull. :mrgreen:
Method "main" is only for testing pourpose: it writes a bin file with "decoded" content of profile, one with numbers of available cards, and shows infos about first deck stored.
Nice work as always! But I can't understand what's the meaning of the double array of cards in the deck: what do cards[0] and cards[1] contain exactly?
< 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: 722 times

Re: Information pending...

Postby spirolone » 23 Jun 2015, 15:04

thefiremind wrote:
spirolone wrote:I wrote a Java class to manage .profile files. I think it contains primitives an editor may need (mainly read/write available cards and decks) and I hope it could be usefull. :mrgreen:
Method "main" is only for testing pourpose: it writes a bin file with "decoded" content of profile, one with numbers of available cards, and shows infos about first deck stored.
Nice work as always! But I can't understand what's the meaning of the double array of cards in the deck: what do cards[0] and cards[1] contain exactly?
Sorry, maybe I could write some documentation... :oops:
However, cards[0] contains ID, and card[1] how many cards with that ID are in deck.
spirolone
Programmer
 
Posts: 190
Joined: 31 Aug 2014, 23:14
Has thanked: 7 times
Been thanked: 107 times

Re: Information pending...

Postby thefiremind » 25 Jun 2015, 19:19

I'm converting the Profile class to C# and I encountered another problem: in the profile's cards array I get 1, 2, 3 or 4 for the most part, which is normal. But then I also get 9, 10, 11, 12. It seems an 8 has been added to some of the values.

My readCards function is identical to yours:
Code: Select all
byte[] cards = new byte[1024];
for (int i = 0; i < 512; i++)
{
    cards[2 * i] = (byte)((content[1409 + i] >> 4) & 0x0F);
    cards[2 * i + 1] = (byte)(content[1409 + i] & 0x0F);
}
return cards;
but as always, my byte is an unsigned byte. Is that the reason for the problem? What should I change? I thought about changing the 0x0F mask, but then I wouldn't know what to do with the writeCards function which also uses 0xF0.
< 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: 722 times

Re: Information pending...

Postby spirolone » 25 Jun 2015, 19:54

thefiremind wrote:I'm converting the Profile class to C# and I encountered another problem: in the profile's cards array I get 1, 2, 3 or 4 for the most part, which is normal. But then I also get 9, 10, 11, 12. It seems an 8 has been added to some of the values.

My readCards function is identical to yours:
Code: Select all
byte[] cards = new byte[1024];
for (int i = 0; i < 512; i++)
{
    cards[2 * i] = (byte)((content[1409 + i] >> 4) & 0x0F);
    cards[2 * i + 1] = (byte)(content[1409 + i] & 0x0F);
}
return cards;
but as always, my byte is an unsigned byte. Is that the reason for the problem? What should I change? I thought about changing the 0x0F mask, but then I wouldn't know what to do with the writeCards function which also uses 0xF0.
Don't worry, it's normal: first bit of four is a flag for foil cards. Then, 9 means 1 card but foiled, 10 means 2 and so on...
Actually, I shouldn't know if we had better to separate info about foiled and number of cards. :?
spirolone
Programmer
 
Posts: 190
Joined: 31 Aug 2014, 23:14
Has thanked: 7 times
Been thanked: 107 times

Re: Information pending...

Postby thefiremind » 25 Jun 2015, 20:40

spirolone wrote:Don't worry, it's normal: first bit of four is a flag for foil cards. Then, 9 means 1 card but foiled, 10 means 2 and so on...
Actually, I shouldn't know if we had better to separate info about foiled and number of cards. :?
OK, understood. I'm adding some functions that allow to extract the "real" quantities (I subtract 8 where the original number is 9 or more) and the foiling (a boolean array that is true where the original number is 9 or more). I don't actually know whether they will be useful or not, but better having them than not. :)
< 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: 722 times

Re: Information pending...

Postby Scion of Darkness » 26 Jun 2015, 08:57

Guys, this files aren't mine but i've gathered them to simplify things:

To extract pick Zed file, put in folder and run "Unpack Zed" Batch and extract Zip file from result

To pack, just do your changes and run "Create Zed Batch"

Ps. There is no need to zip files, just is needed the folder that contains Data_xxx\Data_All_Platforms


* Don't forget to Thanks TheFireMind and Spirolone, they made the true hard work here
Attachments
M15 Tools.zip
(17.48 KiB) Downloaded 511 times
User avatar
Scion of Darkness
 
Posts: 235
Joined: 27 Aug 2012, 13:14
Has thanked: 17 times
Been thanked: 23 times

Re: Information pending...

Postby Scion of Darkness » 26 Jun 2015, 09:00

Just reminded something, the batch paths are "C:\Users\David\Downloads\M15\CreateZed\DATA_041.zip"
they need to be edited to reflect the place they are running
User avatar
Scion of Darkness
 
Posts: 235
Joined: 27 Aug 2012, 13:14
Has thanked: 17 times
Been thanked: 23 times

Re: Information pending...

Postby thefiremind » 26 Jun 2015, 09:36

Another question for spirolone: have you discovered what's the maximum number of decks in a profile? I'd like to put a check for it.
< 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: 722 times

PreviousNext

Return to 2015

Who is online

Users browsing this forum: No registered users and 0 guests

cron

Who is online

In total there are 0 users online :: 0 registered, 0 hidden and 0 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 0 guests

Login Form