Page 1 of 6

Shandalar

PostPosted: 05 Mar 2009, 11:51
by Snacko
I was thinking this might need a need topic.
I will post all my findings in here then most likely move it to the wiki.

To begin with Shandalar is running on tape and glue! I didn't even realize how broken it is before I started debugging it.
First:
HINTS.TXT
Has wrong ids for the cards, now you might know why you didn't see some of the combo hints ever!

Second:
CONCISE.CSV
You would think this is your standard 3 row csv with the ID at the first column. Wrong! The first column isn't used at all and the rows are read in the same order as they appear in the executable. This leads us to 2 bugs, first the order doesn't match! so you get cards values for the wrong cards. Second, the file has only 511 cards in while there are 722 cards defined which means other cards get the default values of 0 for the 2nd row and -1 for the 3rd row. I don't know what these values are used for but it can't be a good thing :)


Will post some more as those bugs appear, and yes they do quite often.

Re: Shandalar

PostPosted: 05 Mar 2009, 13:35
by Bog Wraith
Making this a sticky for now, until it moves to the wiki.

This is such an important part of ManaLink that has never been addressed before. It's got a whole lotta people excited about the potential inclusion of all that has/will be done into the Shandalar module.

Many of us are saying our prayers before we go to bed every night, hoping for this to happen! [-o<

Re: Shandalar

PostPosted: 05 Mar 2009, 16:02
by Huggybaby
Snacko, when might you make a fixed version available for testing? I wonder if playtesting a fixed version will reveal that those bugs were left in for some strange reason? 8-[

I know now how the second guy to lay eyes on the dead sea scrolls must have felt.

Re: Shandalar

PostPosted: 05 Mar 2009, 16:24
by Snacko
I got one that doesn't change anything except move the cards to a new location in the exe.
It seems to work 100%, I can upload this one, but not much of testing can be done in there.

There are quite many checks in the exe like

Load some file.
Read it and apply (we don't care if it's malformed as long as it looks ok)
We read something that doesn't make sense (not defined card), so we discard it.
Everything seems to work just fine!

Re: Shandalar

PostPosted: 05 Mar 2009, 20:52
by Snacko
Shandalar seems to be working, I can even get Dummies into my deck :P
Currently there seems to be a problem with the randomiser as it get's the Dummies as well.

Re: Shandalar

PostPosted: 06 Mar 2009, 13:24
by Snacko
Got it working, not everything is patched, but new cards seems to pop up in Towns/Starting Deck/Events.
Haven't got a crash yet but who knows maybe if you add cards with ids over 1500 it might start crashing, but I already know where to fix it.

http://www.mediafire.com/download.php?gmjflizunge

The file has currently 10000 card spaces.
The first card starts at virtual address 0x991000.
The card count is at virtual address 0xA40C7F.
This says how many cards from the last one won't be given (ex. Dummies, Tokens, Special FX cards, etc) or used in the events.
0057EB75 2D 87240000 SUB EAX,2487
All the special cards have to be added at the back.
Once you add a normal playable card you need to modify the above value ex. 1 card added
0057EB75 2D 87240000 SUB EAX,2486

The extra space is non executable and can be used for variables only (there are some tables which depend on the number of cards which I haven't remapped to the new memory region yet, still it doesn't crash yet!)
New cards should most liekly be added via a dll, however the functions addresses can and most likely are different between Magic.exe and Shandalar.exe.
If the new cards are written with yasm this could be easyly fixable via remapping once macro and not touching the card logic ex.
%define Phase [0xFFFFF]
%define TapCard 0xFF00FF

cmp Phase, Upkeep
push CardID
call TapCard
to
%define Phase [0xAAAAA]
%define TapCard 0xAA00AA

cmp Phase, Upkeep
push CardID
call TapCard

Re: Shandalar

PostPosted: 06 Mar 2009, 13:45
by Huggybaby
Snap! Thanks Snacko me boy!

Re: Shandalar

PostPosted: 06 Mar 2009, 14:00
by Bog Wraith
Man, I'm going to download this right away and start exploring.

Awesome Snacko, I knew this place would have a 8) HUGE impact on our beloved ManaLink!
------------------------------------------------------------------------------------------------------------------
EDIT

Unfortunately, after trying this for quite awhile, on two different installs of the game, I've yet to see one new card in Shandalar!

I went from village to village, city to city, got the free cards in the lairs, completed quests to have a choice for cards, traded amulets for cards etc...

I've seen nothing new at all.

Re: Shandalar

PostPosted: 07 Mar 2009, 14:31
by Snacko
That is good (if you didn't have any crashes) as I haven't added any new cards in the distributed version. I feel that the old way of adding cards isn't exactly fully proper so I would opt for coded dll or possibly the hand coded dll(has to be a separate one).

Re: Shandalar

PostPosted: 07 Mar 2009, 16:16
by Bog Wraith
I was mistaken then, sorry.
I thought we were supposed to see some of the new cards within Shandalar.

As for stability, the game seems to be running normally. I will continue to test it by continuing my quest to finish it after facing Arzakon!

Re: Shandalar

PostPosted: 08 Mar 2009, 21:30
by Snacko
I got some cards coded but it seems I need to edit Cards1.dat for them to show up ingame stay tuned.
Here's and example how cards can be coded to be ManaLink and Shandalar compatible at the same time!

Re: Shandalar

PostPosted: 08 Mar 2009, 21:40
by Bog Wraith
Better & better Snacko!

Meanwhile I have continued to play with your .exe and the stability is rock solid!

This new info about coding for both Shandalar and the main game simultaneously has tremendous implications for the whole ManaLink project.

I again remain very hopeful and excited about the prospects! :)

Re: Shandalar

PostPosted: 08 Mar 2009, 21:53
by Snacko
If there is something like dat2csv it would be helpful, after all someone must have converted the cards.dat to the csv format. You didn't type it all the first time, did you ?
I got the 10 shocklands from guild pact ready for testing after I mange to edit the Cards1.dat.

Re: Shandalar

PostPosted: 09 Mar 2009, 22:48
by EviL_CLonE
Googling I found this:

http://www.tek.com/ja/products/Measurem ... t2csv.html

I have ABSOLUTLY NO IDEA about how does this work... I have opened the file in the same folder as the cards.dat file, and 4 or 5 files were created... maybe one of them is the "translation"

Re: Shandalar

PostPosted: 09 Mar 2009, 23:21
by Bog Wraith
I had my first game crash today and it happened multiple times against the same creature I was dueling.

It was when I dueled the Nether Fiend. I never got a chance to get the crash report as of yet because the game kept closing, but I will try to get myself in duels with this creature again to see if I can get it.

Snacko, is there anything else info wise I need to get you to report on this crash if it reoccurs?