Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#224 Daggerfall fails to work with AMD64 Builds

0.63
closed
5
2012-09-07
2005-04-11
Brian Hill
No

With the AMD64 Native version of DOSBox, attempting to
run Daggerfall results in an Internal Error with an
error message stating that the program cannot access
data in either Dagger.snd or ARCH3D.bsa. This occurs
with both the Daggerfall Demos as well as the Full
Version and in both 64-bit 0.63 and CVS.

Debug output does not provide much useful information
though I haven't had time to use some of the more
advanced debugging options, I only glanced at the debug
output. The game will crash upon selecting a province
your character is from; a time normally a sound is played.

The same Daggerfall install runs fine on 32-bit
versions of DOSBox.

Discussion

1 2 > >> (Page 1 of 2)
  • Brian Hill
    Brian Hill
    2005-04-11

    Logged In: YES
    user_id=373610

    By the way, I am running Gentoo Linux AMD64 2005.0 and the
    other games that I have tried (Descent, Dark Ages) work fine.

     
  • Brian Hill
    Brian Hill
    2005-04-12

    Logged In: YES
    user_id=373610

    I ran the debugger some more tonight and this is what it
    outputs right before the game crashes.

    105397569: FILES:file open command 0 file
    c:\dagdemo\arena2\map100i0.img
    105452384: MOUSE:Set sensitivity used with 49 49
    105468357: PIC:0 mask D9
    105468365: PIT:PIT 0 Timer at 90.00 Hz mode 3
    105468369: PIC:0 mask D8
    105468411: PIC:0 mask D9
    105468649: PIC:0 mask D8
    105469892: PIC:0 mask D9
    105469900: PIT:PIT 0 Timer at 18.21 Hz mode 3
    105469904: PIC:0 mask D8
    105469945: PIC:0 mask D9
    105470154: PIC:0 mask D8
    105470247: PIC:0 mask F8
    105470257: SBLASTER:DMA masked,stopping output, left 1357
    105470327: PIC:0 mask F8
    105472159: DOSMISC:DOS:Multiplex Unhandled call 1600
    105472660: DOSMISC:DOS:Multiplex Unhandled call 1600
    105482083: PIC:0 mask FC
    106531424: MISC:MPU-401:Reset FF
    110731845: PIC:0 mask F8
    110732163: CPU:Illegal Unhandled Interrupt Called A
    110759133: PIC:0 mask F9
    110759162: PIC:0 mask F9
    110759675: PIT:PIT 0 Timer set without new control word
    110759675: PIT:PIT 0 Timer at 18.21 Hz mode 3
    110759679: PIC:0 mask F8
    110759708: PIC:0 mask F8
    110773880: INT10:Set Video Mode 3
    110773880: VGA:Blinking 8
    111191646: FILES:file open command 0 file
    C:\DAGDEMO\ARENA2\BETHESDA.INF
    111191900: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111191915: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111191930: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111191945: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111191960: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111191975: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111191990: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111192005: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111192020: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111192035: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111192050: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111192065: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111192080: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111192095: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111192110: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111192125: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111192140: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111192155: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111192170: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111192185: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111192200: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111192215: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111192230: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111192245: DOSMISC:DOS:Multiplex Unhandled call 4A10
    111194241: VGA:H total 100, V Total 449
    111194241: VGA:H D End 80, V D End 400
    111194241: VGA:Width 640, Height 400, fps 70.086304
    111194241: VGA:normal width, normal height aspect 1.000000

     
  • Peter Veenstra
    Peter Veenstra
    2005-04-12

    Logged In: YES
    user_id=535630

    hmm I would suspect an fileposition errror.
    you might want to check for fseek and friends to check if
    they behave correctly.

     
  • Brian Hill
    Brian Hill
    2005-04-12

    Logged In: YES
    user_id=373610

    How would I check to see if fseek is working?

     
  • Peter Veenstra
    Peter Veenstra
    2005-04-13

    Logged In: YES
    user_id=535630

    in the file drive_local.cpp in src/dos around line 429 you
    notice an

    if 0

    try enabeling it and remove the line below the #endif

    -----now-----

    if 0

        fpos_t temppos;
        fgetpos(fhandle,&temppos);
        Bit32u * fake_pos=(Bit32u*)&temppos;
        *pos=*fake_pos;
    

    endif

        *pos=(Bit32u)ftell(fhandle);
    

    ----try---------

    if 1

        fpos_t temppos;
        fgetpos(fhandle,&temppos);
        Bit32u * fake_pos=(Bit32u*)&temppos;
        *pos=*fake_pos;
    

    endif

    // *pos=(Bit32u)ftell(fhandle);

     
  • Brian Hill
    Brian Hill
    2005-04-13

    Logged In: YES
    user_id=373610

    I tried that and I'm still getting the same error.

     
  • Peter Veenstra
    Peter Veenstra
    2005-04-13

    Logged In: YES
    user_id=535630

    hmm I would need the full logfile inorder to see what might
    be wrong.

    if you use the debug version you can create a new configfile
    file.
    that one has extra entries in it.
    one of the entries is logfile=
    set it to a reasonable file.

    If you could do it for the 32 and 64 bits version.
    if something nice occurs I will provide you with some
    instructions to get huge amount of relevant log messages (by
    adding some log messages to dos core).

     
  • Brian Hill
    Brian Hill
    2005-04-13

    Logged In: YES
    user_id=373610

    For some reason dosbox wasn't recognizing the logfile=
    command. perhaps I put it in the wrong section.

    I redirected stdio to a file however with debug mode enabled
    so it should provide similar information.

    I do not currently have a 32-bit binary with debug mode
    enabled. If you could provide one I could run debug on it as
    well.

     
  • Brian Hill
    Brian Hill
    2005-04-13

    Debug Log (64-bit)

     
    Attachments
  • Peter Veenstra
    Peter Veenstra
    2005-04-14

    Logged In: YES
    user_id=535630

    I will try to find the Demo as well. as I run a 32 bit
    version of dosbox.

    There are some odd things in there I want to see wether this
    game is really this odd. (as it opens the same file many
    times. it makes little sense. (at least to me)

     
  • Peter Veenstra
    Peter Veenstra
    2005-04-15

    Logged In: YES
    user_id=535630

    Allright. We need to synchronise our copies.
    Please select for sound and sound effects =>no sound
    restart dosbox
    start game
    click away demo screens
    new game
    black marsh
    male
    (always choose the fastest options).
    till you get ingame
    exit that game.

    in your dosbox.conf you need the following lines:
    [dosbox]
    memsize=32
    [log]
    logfile=/tmp/debug64.log
    [cpu]
    cycles=5000
    [dos]
    ems=false

    apply this patch on src/dos/dos.cpp
    Post the resulting logfile here. I made a log file using the
    32 bits version of dosbox and the latest cvs myself.
    Index: dos.cpp
    ===================================================================
    RCS file: /cvsroot/dosbox/dosbox/src/dos/dos.cpp,v
    retrieving revision 1.83
    diff -u -r1.83 dos.cpp
    --- dos.cpp 25 Mar 2005 12:06:48 -0000 1.83
    +++ dos.cpp 15 Apr 2005 14:46:11 -0000
    @@ -47,7 +47,7 @@
    DOS_PSP psp(dos.psp());
    psp.SetStack(RealMake(SegValue(ss),reg_sp-18));
    }
    -
    + LOG_MSG("int 21 call %X",reg_ax);
    char name1[DOSNAMEBUF+1];
    char name2[DOSNAMEBUF+1];
    switch (reg_ah) {

     
  • Brian Hill
    Brian Hill
    2005-04-15

    Logged In: YES
    user_id=373610

    I can't select Black Mark as the game crashes as soon as you
    select a provience at the new character screen.

    I have attached the latest log file.

     
  • Brian Hill
    Brian Hill
    2005-04-15

    Logged In: YES
    user_id=373610

    Well for some reason Sourceforge doesn't want to let me
    upload it so you can get it at this URL :

    http://catclub.dnip.net/damicatz/debug64.log

     
  • Peter Veenstra
    Peter Veenstra
    2005-04-18

    Logged In: YES
    user_id=535630

    Well we have some small difference but I don't think it will
    matter.
    you seem to have (or not have) a arena2\berthesa.inf (or
    something like that..)

    I will attach my log as well.

    The last actions before your crash:
    3 fileseeks and one read.

    ----A new patch------------
    Index: dos.cpp
    ===================================================================
    RCS file: /cvsroot/dosbox/dosbox/src/dos/dos.cpp,v
    retrieving revision 1.83
    diff -u -r1.83 dos.cpp
    --- dos.cpp 25 Mar 2005 12:06:48 -0000 1.83
    +++ dos.cpp 18 Apr 2005 20:19:25 -0000
    @@ -47,7 +47,7 @@
    DOS_PSP psp(dos.psp());
    psp.SetStack(RealMake(SegValue(ss),reg_sp-18));
    }
    -
    + LOG_MSG("int 21 call %X",reg_ax);
    char name1[DOSNAMEBUF+1];
    char name2[DOSNAMEBUF+1];
    switch (reg_ah) {
    @@ -461,6 +461,7 @@
    if (DOS_CloseFile(reg_bx)) {
    CALLBACK_SCF(false);
    } else {
    + LOG_MSG("close failed %X",dos.errorcode);
    reg_ax=dos.errorcode;
    CALLBACK_SCF(true);
    }
    @@ -473,6 +474,7 @@

    MEM_BlockWrite(SegPhys(ds)+reg_dx,dos_copybuf,toread);
    reg_ax=toread;
    CALLBACK_SCF(false);
    + LOG_MSG("read in %X out
    %X",reg_cx,reg_ax);
    } else {
    reg_ax=dos.errorcode;
    CALLBACK_SCF(true);
    @@ -505,9 +507,11 @@
    case 0x42: /
    LSEEK Set current file position
    /
    {
    Bit32u pos=(reg_cx<<16) + reg_dx;
    + LOG_MSG("seek cx=%X dx=%X
    pos=%X",reg_cx,reg_dx,pos);
    if (DOS_SeekFile(reg_bx,&pos,reg_al)) {
    reg_dx=(Bit16u)(pos >> 16);
    reg_ax=(Bit16u)(pos & 0xFFFF);
    + LOG_MSG("succes: dx=%X ax=%X
    pos=%X",reg_dx,reg_ax,pos);
    CALLBACK_SCF(false);
    } else {
    reg_ax=dos.errorcode;
    -----------The rest the same-----------------------

     
  • Brian Hill
    Brian Hill
    2005-04-18

    Logged In: YES
    user_id=373610

    I added the patch, however for some reason it wasn't logging
    to the log file like the config file said it should so I did
    a redirected output again.

    http://catclub.dnip.net/damicatz/debug2.txt

    You'll have to ignore some of the random things about bob
    and such as I was doing some of my own testing but it
    shouldn't affect your patch as it was all using cout.

    RealSetVec is returning what appears to be an abnormally
    high value, I marked it in the log with messages surrounded
    by ** after the line in question. I'm not a DOS/Assembler
    coder so perhaps this is normal but 3355509121 seems large.

     
  • Peter Veenstra
    Peter Veenstra
    2005-04-19

    Logged In: YES
    user_id=535630

    it would appear that you didn't compile dosbox with the
    debugger enabled. I really need it as It is very hard to
    compare the logfiles this way. You can leave your own
    debugging messages in it. But without the additional logging
    information provided by the debugger I don't have enough
    information.

    The sequence:
    9519
    0x25 called
    /
    3
    576 Reg_AL
    3 ds
    576 Reg_DX
    Hello Random Seperator
    3355443776 RealSetVec Returns This


    is allready in the shutdown process you can see the shutdown
    process by this:
    int 21 3eXX
    in a loop (which is the closure of all open files.
    in my proper shutdown it reads:
    int 21 call 3E07
    int 21 call 3E00
    int 21 call 3E08
    int 21 call 3E09
    int 21 call 3E0A
    int 21 call 3E0B

    (as does it yours after the error. quoting from the first
    debug.txt


    122872688: FILES:file open command 0 file
    c:\dagdemo2\arena2\map100i0.img
    int 21 call 4400
    int 21 call 4201
    int 21 call 4202
    int 21 call 4200
    int 21 call 3F41
    int 21 call 3E0D
    int 21 call 3E07
    int 21 call 3E00
    int 21 call 3E08
    int 21 call 3E09
    int 21 call 3E0A
    int 21 call 3E0B


    The 3E0D is normal.
    But then it decides to shutdown. so something above this is
    the problem. Hence I added information
    to
    int 21 call 4201
    int 21 call 4202
    int 21 call 4200
    int 21 call 3F41
    those calls. But without the debuggerlog I have a very hard
    time figuring out which file it used.

    The value is indeed a bit large. To make me understand it
    could you post the changes you made ?

    I will attach my debug log

     
  • Peter Veenstra
    Peter Veenstra
    2005-04-19

    my debug log with the changes in it.

     
    Attachments
  • Brian Hill
    Brian Hill
    2005-04-19

    Logged In: YES
    user_id=373610

    Ok I re-compiled it again with debug support. That must have
    been turned off when I re-ran the configure script.

    http://catclub.dnip.net/damicatz/debug642.log

    As for the RealSetVec stuff I just added did this in dos.cpp
    around line 333:

    case 0x25: / Set Interrupt Vector /
    cout << "0x25 called" << endl;
    cout << reg_al << endl;
    cout << ds << endl;
    cout << reg_dx << endl;
    cout << RealMakeSeg(ds,reg_dx) << endl;

    RealSetVec(reg_al,RealMakeSeg(ds,reg_dx));
    break;

     
  • Brian Hill
    Brian Hill
    2005-04-19

    Logged In: YES
    user_id=373610

    Ok I re-compiled it again with debug support. That must have
    been turned off when I re-ran the configure script.

    http://catclub.dnip.net/damicatz/debug642.log

    As for the RealSetVec stuff I just added did this in dos.cpp
    around line 333:

    case 0x25: / Set Interrupt Vector /
    cout << "0x25 called" << endl;
    cout << reg_al << endl;
    cout << ds << endl;
    cout << reg_dx << endl;
    cout << RealMakeSeg(ds,reg_dx) << endl;

    RealSetVec(reg_al,RealMakeSeg(ds,reg_dx));
    break;

     
  • Peter Veenstra
    Peter Veenstra
    2005-04-19

    Logged In: YES
    user_id=535630

    what struck my eye was that in the int1 picture the
    fseek is clearly present.

    seek cx=FFFX ax=XXXX pos=FFFXXXXX
    this is really tricky. I checked it out.
    dos wants the input variant to a 32 bit signed number
    and the output to be 32 unsigned number

    We do it both times 32 bit unsigned.
    the FFFFEXXXX is a negative number as far as I know
    so it's setting the filepointer back. (but maybe there the
    32/64 bit stuff kicks in).
    but the resulting pos seems to fine so it's indeed a bit odd.
    anyway we know in which area to look. I will try to create a
    patch
    that logs reads (and the reason why it fails) extensively.

    I noticed that it fails continously if a seek with a high
    number (or negative number) is done (the reads afterwards).

    http://www.delorie.com/djgpp/doc/rbinter/id/10/28.html

     
  • Brian Hill
    Brian Hill
    2005-04-19

    Logged In: YES
    user_id=373610

    Again I don't know much about DOS but perhaps this is odd as
    well :

    In various places my log will say :
    read in 936 out 0

    And on yours it'll say
    read in 936 out 936.

    or some other value. But for some reason my version is
    outputting stuff to 0.

     
  • Peter Veenstra
    Peter Veenstra
    2005-04-20

    Logged In: YES
    user_id=535630

    Yes the reading of 0 samples is indeed what is causing the
    problems.

    for reference:
    27143532 Apr 14 11:12 ARCH3D.BSA

    My guess with that seek was that the seek was causing the
    read problems. Anyway an additional patch. Should be used
    together with the old one.

    Index: drive_local.cpp

    RCS file: /cvsroot/dosbox/dosbox/src/dos/drive_local.cpp,v
    retrieving revision 1.56
    diff -u -r1.56 drive_local.cpp
    --- drive_local.cpp 25 Mar 2005 09:11:08 -0000 1.56
    +++ drive_local.cpp 20 Apr 2005 19:48:26 -0000
    @@ -392,9 +392,13 @@

    //TODO Maybe use fflush, but that seemed to fuck up in visual c
    bool localFile::Read(Bit8u * data,Bit16u * size) {
    - if (last_action==WRITE)
    fseek(fhandle,ftell(fhandle),SEEK_SET);
    + if (last_action==WRITE)
    {fseek(fhandle,ftell(fhandle),SEEK_SET); LOG_MSG("la=write");}
    last_action=READ;
    size=fread(data,1,size,fhandle);
    + if((*size)==0){
    + LOG_MSG("error: %X",ferror(fhandle));
    + LOG_MSG("eof: %X",feof(fhandle));
    + }
    return true;
    };

    @@ -420,8 +424,11 @@
    //TODO Give some doserrorcode;
    return false;//ERROR
    }
    - int ret=fseek(fhandle,pos,seektype);
    + LOG_MSG("before %X",ftell(fhandle));
    + int
    ret=fseek(fhandle,
    reinterpret_cast<Bit32s*>(pos),seektype);
    + LOG_MSG("afterwards %X error %X"
    ,ftell(fhandle),ferror(fhandle));
    if (ret!=0) {
    + LOG_MSG("UUUUUUUUUUUUUUUUUUUUUUUUUUUUSED!");
    // Out of file range, pretend everythings ok
    // and move file pointer top end of file...
    ?! (Black Thorne)
    fseek(fhandle,0,SEEK_END);


    As you can see I put it in a small reinterpret cast. Feel
    free to remove it. but I think it might solve the problem.
    So if it works please test once without it. But if it still
    fails just attach the logfile in that case.

    fseek(fhandle,reinterpret_cast<Bit32s*>(pos),seektype);
    used to be
    fseek(fhandle,
    pos,seektype);

     
  • Brian Hill
    Brian Hill
    2005-04-20

    Logged In: YES
    user_id=373610

    I applied the patch and was able to play the game with it.
    After taking it back off the game did not work again.

    Will test it with sound now.

    Log of working game :
    http://catclub.dnip.net/damicatz/logworks.txt

     
1 2 > >> (Page 1 of 2)