Not signed in (Sign In)

Welcome, Guest

Want to take part in these discussions? If you have an account, sign in now.

If you don't have an account, apply for one now.

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

    •  
      CommentAuthorvalvet
    • CommentTimeJul 5th 2006 edited
     
    Hello.

    I've been trying to read some data from the DBC files using a simple memory reader. I'm just not sure why I can't get results. Some files are working fine like Languages.dbc, but when using a file like GameObjectDisplayInfo.dbc I get weird data back. I might be doing it wrong, which I think is the case. I hope BBCode workes.

    This is what I'm using.


    /*
    1 Signature String (4-bytes) string, always 'WDBC'
    2 Records Integer (4-bytes) number of records in the file
    3 Fields Integer (4-bytes) number of fields per record
    4 Record Size Integer (4-bytes) Fields*FieldSize (FieldSize is usually 4, but not always)
    5 String Block Size Integer (4-bytes) Size of the string block
    */
    int nPtr = Memory.ReadInteger(Convert.ToInt32("0xC01AF4", 16));
    int nRecords = Memory.ReadInteger(Convert.ToInt32("0xC01AF4", 16) + 4);
    int nRows = Memory.ReadInteger(Convert.ToInt32("0xC01AF4", 16) + 8);
    int nLastEntry = Memory.ReadInteger(Convert.ToInt32("0xC01AF4", 16) + 12); // Last entry?

    // 1625 records for GameObjectDisplayInfo.dbc
    Console.WriteLine("nRecords: " + nRecords);

    // We foreach through nRecords using "i" as our "id" entry.
    for (int i = 0; i < nRecords; i++)
    {
    // * 4 would the first row? I'm unable to find an actual row count.
    int nRow = Memory.ReadInteger(nRows + i * 4);

    // 48 is record size as per:
    // http://www.hackwow.com/wiki/GameObjectDisplayInfo.dbc
    int nField = Memory.ReadInteger(nRow + 48 * 4);

    Console.WriteLine("Field: " + Memory.ReadString(nField, 128));
    }


    Outputs as follow:


    nRecords: 1625
    Field:
    Field:
    Field: Scorpid Worker
    Field: 0
    Field: LumberPile
    Field:
    Field: Mottled Boar
    Field:
    Field:
    ..


    What puzzles me is that when doing:


    Memory.ReadInteger(Convert.ToInt32("0xC01AF4", 16) + 4);


    I get the record count of the file fine (1625 in case of GameObjectDisplayInfo.dbc), but acording to the header that's posted, doing +8 should give you number of fields per record? Reading +8 returns a pointer to somewhere in my case, can't quite figure it out.

    The address itself C01AF4 is pointing to the start of the file.


    .text:0053A4B7 mov ecx, offset dword_C01AF4 <-
    .text:0053A4BC call sub_53FB10


    Apreciate any tips.