Page 2 of 6

Re: Shandalar

PostPosted: 10 Mar 2009, 09:39
by Snacko
Get a save file right before the battle and I'll see why it crashes.

Re: Shandalar

PostPosted: 10 Mar 2009, 10:02
by mathusalem
EviL_CLonE wrote: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"
I tried it and as far as I know it didn't make any CSV. This gismo is a mistery, and the "how to use" readme file is no help

Re: Shandalar

PostPosted: 10 Mar 2009, 10:09
by Snacko
Probably will need to write my own decompiler for the dat file. The structure seems pretty much the same as the ManaLink one with slight differences.

Re: Shandalar

PostPosted: 10 Mar 2009, 13:23
by Bog Wraith
Snacko wrote:Get a save file right before the battle and I'll see why it crashes.
Ok, next time I will save the game just before I enter the Duel with a Nether Fiend. I'll PM you when I have one and send it to you.

Re: Shandalar

PostPosted: 10 Mar 2009, 15:41
by Huggybaby
EviL_CLonE wrote: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"
There is zero chance that Tektronix dat files and Microprose dat files are the same. :|

Re: Shandalar

PostPosted: 10 Mar 2009, 17:58
by Snacko
Already got the Cards1.dat loading routine decompiled, now just need to translate the pseudo code. I'll probably code the export / import tool in python.
Code: Select all
size_t __cdecl sub_4424B0(char *Filename)
{
  size_t result; // eax@2
  FILE *v2; // eax@1
  FILE *File; // [sp+80Ch] [bp-4h]@1
  size_t DstBuf; // [sp+804h] [bp-Ch]@3
  signed int v5; // [sp+808h] [bp-8h]@5
  signed int v6; // [sp+7FCh] [bp-14h]@15
  signed int v7; // [sp+7F8h] [bp-18h]@20
  signed int v8; // [sp+408h] [bp-408h]@25
  int v9; // [sp+404h] [bp-40Ch]@27
  char *v10; // [sp+7F4h] [bp-1Ch]@27
  char Source[1000]; // [sp+40Ch] [bp-404h]@33
  signed int v12; // [sp+14h] [bp-7FCh]@37
  int v13; // [sp+10h] [bp-800h]@39
  char *v14; // [sp+400h] [bp-410h]@39
  _BYTE v15[1000]; // [sp+18h] [bp-7F8h]@45
  signed int v16; // [sp+Ch] [bp-804h]@49

  v2 = fopen(Filename, "rb");
  File = v2;
  if ( v2 )
  {
    fread(&Count, 4u, 1u, File);
    fread(&DstBuf, 4u, 1u, File);
    dword_7BEAFC = malloc(DstBuf);
    if ( dword_7BEAFC )
    {
      fread(&dword_8E44A0, 0x98u, Count, File);
      fread(dword_7BEAFC, 1u, DstBuf, File);
      fclose(File);
      v5 = 0;
      while ( v5 < (signed int)Count )
      {
        lParam[38 * v5] += (LPARAM)dword_7BEAFC;
        dword_8E44A8[38 * v5] += (int)dword_7BEAFC;
        dword_8E44BC[38 * v5] += (int)dword_7BEAFC;
        (&Str1)[152 * v5] = (char *)((_DWORD)dword_7BEAFC + (_DWORD)(&Str1)[152 * v5]);
        (&dword_8E4518)[152 * v5] = (char *)((_DWORD)dword_7BEAFC + (_DWORD)(&dword_8E4518)[152 * v5]);
        if ( !strcmpi((&Str1)[152 * v5], "None") )
          (&Str1)[152 * v5] = (char *)&unk_58397C;
        if ( !strcmpi((&dword_8E4518)[152 * v5], "None") || !strcmpi((&dword_8E4518)[152 * v5], "Blank") )
          (&dword_8E4518)[152 * v5] = (char *)&unk_583990;
        dword_8E44E0[38 * v5] = (int)*(&off_5843F0 + dword_8E44E0[38 * v5]);
        if ( !dword_8E44E4[38 * v5] )
          dword_8E44E4[38 * v5] = 1;
        ++v5;
      }
      v6 = 0;
      while ( v6 < (signed int)Count )
      {
        if ( LOBYTE(dword_8E44AC[38 * v6]) & 0x40 )
          dword_8E44AC[38 * v6] = 128;
        ++v6;
      }
      v7 = 0;
      while ( (signed int)Count > v7 )
      {
        if ( byte_8E44C8[152 * v7] == 17 )
          byte_8E44C8[152 * v7] = 10;
        ++v7;
      }
      v8 = 0;
      while ( (signed int)Count > v8 )
      {
        v9 = 0;
        v10 = (&Str1)[152 * v8];
        while ( *v10 )
        {
          if ( (*v10 != 92 || *(v10 + 1) != 92) && (*v10 != 92 || *(v10 + 1) != 110) )
          {
            Source[v9++] = *v10;
          }
          else
          {
            ++v10;
            Source[v9++] = 10;
          }
          ++v10;
        }
        Source[v9] = 0;
        strcpy((&Str1)[152 * v8++], Source);
      }
      v12 = 0;
      while ( (signed int)Count > v12 )
      {
        v13 = 0;
        v14 = (&dword_8E4518)[152 * v12];
        while ( *v14 )
        {
          if ( (*v14 != 92 || *(v14 + 1) != 92) && (*v14 != 92 || *(v14 + 1) != 110) )
          {
            v15[v13++] = *v14;
          }
          else
          {
            ++v14;
            v15[v13++] = 10;
          }
          ++v14;
        }
        v15[v13] = 0;
        strcpy((&dword_8E4518)[152 * v12++], v15);
      }
      v16 = 0;
      while ( (signed int)Count > v16 )
      {
        dword_8E44FC[38 * v16] = 0;
        stru_8E4534[38 * v16++] = 0;
      }
      dword_8F8C24 = 40;
      dword_8E49BC = 2;
      dword_8E4E7C = 32;
      dword_8E5044 = 2;
      dword_8E520C = 16;
      dword_8E52A4 = 4;
      dword_8E57FC = 16;
      dword_8E5894 = 2;
      dword_8E592C = 4;
      dword_8E59C4 = 8;
      dword_8E5A5C = 16;
      dword_8E5AF4 = 32;
      dword_8E6344 = 32;
      dword_8E63DC = 4;
      dword_8E676C = 8;
      dword_8E6804 = 2;
      dword_8E7514 = 2;
      dword_8E805C = 32;
      dword_8E8354 = 8;
      dword_8E8E04 = 16;
      dword_8E90FC = 32;
      dword_8E994C = 2;
      dword_8E99E4 = 8;
      dword_8F49A4 = 4;
      dword_904A24 = 2;
      dword_8EACE4 = 2;
      dword_8EB95C = 32;
      dword_8EBB24 = 4;
      dword_8EBBBC = 16;
      dword_9014B4 = 32;
      dword_8ED24C = 48;
      dword_8F1D1C = 4;
      dword_8ED4AC = 2;
      dword_8ED674 = 4;
      dword_8ED70C = 2;
      dword_903E44 = 2;
      dword_8EED04 = 2;
      dword_8EED9C = 32;
      dword_8EEFFC = 8;
      dword_8EF32C = 2;
      dword_8E495C = 8;
      dword_8E5374 = 2;
      dword_8E54A4 = 16;
      dword_8EFAE4 = 16;
      dword_8E5FEC = 48;
      dword_8E72EC = 2;
      dword_8E7844 = 32;
      dword_8E7D9C = 8;
      dword_8E81C4 = 16;
      dword_90718C = 16;
      dword_8F42BC = 4;
      dword_8E909C = 4;
      dword_8E94C4 = 2;
      dword_8E95F4 = 2;
      dword_8F0F14 = 4;
      dword_8E9AB4 = 8;
      dword_8E9C7C = 8;
      dword_8E9E44 = 4;
      dword_8FF01C = 2;
      dword_904A5C = 2;
      dword_8EAC84 = 2;
      dword_8EB3A4 = 4;
      dword_8EC6A4 = 4;
      dword_901584 = 4;
      dword_8EC904 = 8;
      dword_905B94 = 2;
      dword_8EDB6C = 4;
      dword_8EE28C = 16;
      dword_8EF1FC = 2;
      dword_8F502C = 16;
      dword_8F8AF4 = 2;
      dword_8EC1AC = 2;
      dword_8E7DFC = 16;
      dword_8F3644 = 4;
      dword_8F3C34 = 8;
      dword_8F48AC = 8;
      dword_8F4A74 = 4;
      dword_8F522C = 4;
      dword_8F535C = 4;
      dword_8E4A8C = 18;
      dword_8E4C54 = 10;
      dword_8EB56C = 48;
      dword_8EC314 = 40;
      dword_8EC574 = 34;
      dword_8EC73C = 2;
      dword_8ED44C = 24;
      dword_8EDAD4 = 12;
      dword_8EDC04 = 36;
      dword_8EDE64 = 6;
      dword_8EE324 = 20;
      dword_8E7E34 = 16;
      dword_8FAB04 = 16;
      dword_8FAC34 = 16;
      dword_8FE6FC = 16;
      dword_8FF66C = 32;
      dword_903A1C = 2;
      dword_8F0DAC = 16;
      dword_8FA6DC = 2;
      dword_8F009C = 2;
      dword_8F230C = 32;
      dword_8FDFDC = 32;
      dword_8F17C4 = 4;
      dword_901BD4 = 4;
      dword_8F93DC = 32;
      dword_8F9CC4 = 48;
      dword_8FCCDC = 18;
      dword_8F0BE4 = 8;
      dword_8F23A4 = 32;
      dword_8FDC4C = 16;
      dword_8FB5B4 = 16;
      dword_8F11D4 = 32;
      dword_8FB094 = 4;
      dword_8FA384 = 8;
      dword_9010C4 = 32;
      dword_8F8CF4 = 8;
      dword_8FEDBC = 16;
      dword_907354 = 4;
      dword_8F04FC = 8;
      dword_8FF6A4 = 16;
      dword_90303C = 4;
      dword_9079DC = 4;
      dword_8F003C = 16;
      dword_8F0C1C = 8;
      dword_8FF4DC = 2;
      dword_901DD4 = 32;
      dword_8F29CC = 4;
      dword_8EF6BC = 16;
      dword_8FB5EC = 4;
      dword_8F0A54 = 16;
      dword_8F2C2C = 10;
      result = Count;
    }
    else
    {
      fclose(File);
      result = 0;
    }
  }
  else
  {
    result = 0;
  }
  return result;
}

Re: Shandalar

PostPosted: 10 Mar 2009, 23:29
by gmzombie
wow awesome man

Re: Shandalar

PostPosted: 11 Mar 2009, 13:01
by hip63
Ok, I'm keeping my eye on this thread. I was about to add the new Shandalar.exe to the New Magic CD-rom I'm working on until I saw Bog Wraith's issue. But this does sound like something that needs to be added to the CD when it's ready.

BTW - @Bog Wraith, I fixed those issues you reported on the new CD and I've added the recent updates posted here in the last few days. :)

hip63 :P

Re: Shandalar

PostPosted: 12 Mar 2009, 00:51
by Bog Wraith
ok Hip, good to know.

I am still testing the build and there are a few anomalies, but nothing show stopping so far apart from what you now have addressed.

I will continue to test it and report.
When you have a newer build for us to test, PM Huggy & I with the link and we'll go get and test it! 8)

Re: Shandalar

PostPosted: 15 Mar 2009, 09:17
by Dominixux
Hi guys,

There is a bug in Shandalar. Something is wrong with a face maker, but the game runs fine, until...
What is the bug?
Bug: when duel started and I got damage from a creature (only human player) and image icon for preventing damage is shown then game crashes.
Same bug appears when you try to flip over your face in duel or you have card with text "select target player".

I think, this appears because when you start shandalar, face maker does not appear,
there is an error: text.c line 131: File fonts.cv could not be opened:EXITING.

Why I suspect in face maker is because, as I remember, face maker need to appear after you choose game's difficult (wizzard) and player color (black). :)

I assume that this is not difficult to solve but who knows.

Does anyone's game have this bug or just mine? :)

See ya :)

EDIT: I have Manalink update from 2009-03-11. Does Shandalar from this update work? :)

Re: Shandalar

PostPosted: 15 Mar 2009, 09:27
by Snacko
I get to see the face maker just fine, maybe the package you got is missing some of the fonts there should be 8 total (*.ttf).

Re: Shandalar

PostPosted: 15 Mar 2009, 17:57
by gmzombie
hey Snacko how is the code going for the cards1.dat just curious?

Re: Shandalar

PostPosted: 15 Mar 2009, 18:29
by Snacko
I didn't have much time to look at the output but this is what I got so far.
http://www.mediafire.com/download.php?ur2ynzmvhy3
The bShandalar.csv has the binary values grouped by 4bytes (can be wrong as they might be some 1-2byte fields).
The other file has the strings which aren't parsed correctly but show an overall overview how they're layed out.
Currently the project is put on hold, but I'll look into it when I got time.
Any comments and remarks on the 1st file bShandalar.csv should be posted, because if the structure and meaning of those fields is known the rest will be really easy.

Re: Shandalar

PostPosted: 15 Mar 2009, 18:39
by gmzombie
im assuming the csv2dat file we have now will convert that back to the cards1.dat? that kinda made my brain hurt looking at the b shandalar one lol..or maybe its just the hangover. anyways im assuming that the .cat in the cardart folder is the one for shandalar. there looks to be alot of work here but im wondering if the current engine can be inported to the game or if the game is intertwined with the engine so it would have to be rewritten?

Re: Shandalar

PostPosted: 15 Mar 2009, 20:24
by Snacko
The current csv2dat might be incompatible with the shandalar cards format so I dunno.
As for the card art I also can't say yet, getting cards to show up even without art will be the first big step.