Menu

CDA Emulation: what's going on with Interstate 76?

gho
2023-09-18
2025-05-11
1 2 3 .. 6 > >> (Page 1 of 6)
  • gho

    gho - 2023-09-18

    I'm trying to understand what's wrong with CDA in this game. I believe we fixed the CDA in some past release, but now I can't get it working, and honestly weird things are happening.
    Let's start from the beginning:
    The game is on 2 disks, the CD1 is an installer disk and CD2 is a mixed audio disk with some mission data and 16 audio tracks that you can easily rip with freac.
    The game patched with the gold patch for accelerated cards can work with DxWnd, but only if CDA emulation is off (DxWnd option "No emulation"). Of course, in this way you can hear no CD audio tracks.
    I tried then to run the game with the CD mounted on Win11, again it works but because the mci system doesn't support CDA and again no audio can be heard. Here the log that shows what happens:

    mciSendCommandA: IDDevice=0x0000 msg=0x803(MCI_OPEN) flags=0x2000(MCI_OPEN_TYPE)
    mciSendCommand>>: MCI_OPEN cb=0x80002 devid=0x14 devtype=CDAudio elementname= alias=
    mciSendCommandA: ERROR res=0x10a(CANNOT_LOAD_DRIVER)
    

    The curious thing happens if I try to enable the DxWnd CDA emulation: the game stops and tells to insert the CD2, no matter if I use a real or fake CD drive. It seems that the CDA emulation triggers some error condition and blocks the game. So, in short, no CD = game working, CDA emulation = game stops!

    Here someone could help: probably on a WinXP or Win98 it should be possible to run the game with the CD mounted and the Audio tracks working. Could you run the game for me with no CDA emulation, log flags for "Sound" + "Debug" and capture a log session that would indicate what the game is expecting to see?

    @Huh @Dippy dipper: maybe you remember better than me this game situation? In case, I can provide a private copy of my RIP ...

     

    Last edit: gho 2023-09-18
    • huh

      huh - 2023-09-18

      I can make a log in XP if you send me a PM with the necessary files.

       
      • gho

        gho - 2023-09-18

        Damn, 4share put size limitations on the files. Can you download the CD images (2 files, about 600 MB) directly from old-games.ru? I'll try to pack the necessary updates.

        Update: it will be sufficient the only CD2 file, 400 MB in .mds/.mdf format

         

        Last edit: gho 2023-09-18
  • BEEN_Nath_58

    BEEN_Nath_58 - 2023-09-18

    maybe you remember better than me this game situation?

    Maybe I remember better too... let me see

     
  • BEEN_Nath_58

    BEEN_Nath_58 - 2023-09-18

    2.90 it was. I got from my notes

     
  • BEEN_Nath_58

    BEEN_Nath_58 - 2023-09-18

    Anyways heres the file requested

     
  • gho

    gho - 2023-09-18

    @Huh:
    instructions:
    Unpack the archive on a game folder (link sent through PM)
    create there a cd folder
    copy the content of the whole CD2 to cd (if you want to use fake CD) or keep the CD mounted on drive E:
    Use the attached profile. The CDA emulation is disabled, the audio should come from the CD2.

    BEWARE: the game saves the CD drive letter somewhere and my wiles only work with CD2 mounted on drive E:\ !!!

     

    Last edit: gho 2023-09-18
    • huh

      huh - 2023-09-18

      Unfortunately, file cannot be downloaded without logging into a social network account.
      I have CD2.
      Can you save it on ulozto.net?
      Or anywhere else where I don't have to log in/register.

       

      Last edit: huh 2023-09-18
      • gho

        gho - 2023-09-18

        Later, this evening ...

         
  • BEEN_Nath_58

    BEEN_Nath_58 - 2023-09-18

    @ghotik didn't my log work for. you?

     
  • gho

    gho - 2023-09-18

    I'm about to move and drive for a while, but I got BEEN_Nath_58 logs and I see I spotted the clue, here:

    mciSendCommand>>: MCI_CLOSE cb=0x13f4bc
    mciSendCommand<<: MCI_CLOSE cb=0x13f4bc
    mciSendCommandA: IDDevice=0x0000 msg=0x810(MCI_SYSINFO) flags=0x100(MCI_SYSINFO_QUANTITY)
    mciSendCommand>>: MCI_SYSINFO(QUANTITY) cb=0 retsize=0x4 retbuf=0 number=0 devtype=0x204(CD_AUDIO)
    mciSendCommand<<: MCI_SYSINFO(QUANTITY) cb=0 retsize=0x4 retbuf=1 number=0 devtype=0x204(CD_AUDIO)
    

    the game closes the MCI session with MCI_CLOSE and the next statement gets the answer. This perhaps does not happen on Win11, after you close you should re-open the MCI session, or not?...
    Where did you got the log? I'm not sure that Win10/11 behave this way, or maybe we got it wrong, the mci system is supposed to answer to MCI_SYSINFO also when the mci session is closed!
    Sounds quite interesting, there's some refinement needed into our CDA emulator!!!

     

    Last edit: gho 2023-09-18
    • BEEN_Nath_58

      BEEN_Nath_58 - 2023-09-18

      Windows XP as you asked. Without enabling CD emulation.

      Game worked fine upto 2.05.89

       
  • dippy dipper

    dippy dipper - 2023-09-18

    Game worked fine upto 2.05.89

    The only change in Dxwnd 2.05.90 mciwrapper.cpp is this one:

    if(detour) {
        if((mciEmu.dwDevID == 0xFFF0) && (uMsg != MCI_OPEN)){
            OutTraceSND("%s: MCI session closed!\n", ApiRef);
            return MCIERR_INVALID_DEVICE_ID; 
        }
    

    Unless you mean that 2.05.88 is the last one that worked?

    mci system is supposed to answer to MCI_SYSINFO also when the mci session is closed!

    Certainly there are mci commands that can be run without opening the device.

     

    Last edit: dippy dipper 2023-09-18
  • gho

    gho - 2023-09-18

    I fixed it now this way (see the MCI_SYSINFO in the if condition):

            if(detour) {
                // v2.05.99: when MCI session is closed, you can still send MCI_OPEN and MCI_SYSINFO
                // Needed for "Interstate 76" ???
                if((mciEmu.dwDevID == 0xFFF0) && (uMsg != MCI_OPEN) && (uMsg != MCI_SYSINFO)){
                    OutTraceSND("%s: MCI session closed!\n", ApiRef);
                    return MCIERR_INVALID_DEVICE_ID; 
                }
    

    The game likes it, it goes much further ahead, but still complain about a missing CD2. There must be something else, but the fix seems correct.

     

    Last edit: gho 2023-09-18
    • huh

      huh - 2023-09-18

      I installed the game in WinXP, but I didn't give any patches, the game hangs in the menu. Interesting that I saw some links to 4share that didn't need any login, maybe this can be set up? I still don't have your files.
      Be careful about running commands after "close cdaudio". Some commands can be run after "close cdaudio", but running others is illegal and leads to unexpected behavior.
      I once posted a post on this topic here, I'll find it.

       
  • huh

    huh - 2023-09-18

    OK, I have your files, .... I'll try tomorrow to see if I have the same log as @BEEN_Nath_58.
    Here is my old post.
    https://sourceforge.net/p/dxwnd/discussion/general/thread/0d852410/?limit=25&page=60#1866
    That time I tried some commands after "close cdaudio". As you can see the results were unexpected. Of course, this doesn't mean that any command won't work, I'm just urging caution.

    Update:
    Interesting, now I found out, that I've tried this game before in Win7 and according to what I can see, some FakeCD audio changes had to be made in version 2.05.87 for this game.

    Update2:
    If I look in my log (with mounted CD2), the game detects the number and position of all the tracks, maybe it needs a mcihack. I think I saw also the status mode for track 0 here (stop), but I must have been mistaken, the log has already been overwritten with a newer one.

     

    Last edit: huh 2023-09-18
  • dippy dipper

    dippy dipper - 2023-09-18

    v2.05.99: when MCI session is closed, you can still send MCI_OPEN and MCI_SYSINFO

    For sure you can also send MCI_STATUS and MCI_INFO without opening the device.

    edit:
    I don't have my PCem setup to verify this on Win9x and I am currently stuck with a Linux system so I can not verify with Win10 either. But I seem to remember that MCI_SET and MCI_SEEK for cdaudio will also succeed without throwing an error even if the device was not opened. In addition you should also be able to auto open a device with a simple MCI_PLAY command. It might be that the only MCI command that will throw an error is if you call MCI_CLOSE on a device that is already closed.

    edit2:
    Well maybe not so sure. Could be a difference between the mciSendString and mciSendCommand behaviour.

     

    Last edit: dippy dipper 2023-09-19
  • gho

    gho - 2023-09-18

    To make tests, you can use this .rc3 release that has in practice only this tiny fix to the mci logic, but is enough to bypass one check and fail (maybe) a little later.
    In effect, I double-checked all mci messages and apparently this .rc3 release is behaving very well until it stops for the CD check. But I wonder if the reason now is some mci oddity or perhaps some other event that we didn't notice yet. Or maybe it will just work on your machines?

     
  • gho

    gho - 2023-09-18

    @Huh

    If I look in my log (with mounted CD2), the game detects the number and position of all the tracks, maybe it needs a mcihack.

    This part is puzzling. Maybe you are right, but the thing is not so obvious. The game sets TMSF format, a format for which the beginning of track n is .... n (that is, 00 frames + 00 seconds + 00 minutes after track n) . So, you can see a funny loop where the game does this:
    question: where does the track 1 start?
    answer: it starts at position 1
    question: where does the track 2 start?
    answer: it starts at position 2
    question: where does the track 3 start?
    answer: it starts at position 3
    ...

    And if you look at BEEN_Nath_58 log file, you can see that this is exactly what the game expects, no tricks it seems.

     
  • BEEN_Nath_58

    BEEN_Nath_58 - 2023-09-19

    To make tests, you can use this .rc3 release that has in practice only this tiny fix to the mci logic, but is enough to bypass one check and fail (maybe) a little later.

    There is only one difference: the CDaudio doesn't work at all now. It gets bypassed completely

     
  • huh

    huh - 2023-09-19

    @gho
    I tried it this morning and the music played for me with rc3 in Win7. However, CD2 was required later. I see 3 errors in spystudio, is it possible that there is a problem with FakeCD (F:)?

    i76.exe 9728    10160   msvcrt.dll  OpenFile    F:\cutscene Access: Read Synchronize DesiredAccess: FILE_READ_DATA | SYNCHRONIZE ShareMode: FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE Options: FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT | FILE_OPEN_FOR_BACKUP_INTENT    OBJECT_PATH_NOT_FOUND   
    
    i76.exe 9728    10160   dxwnd.dll   OpenFile    F:  Access: Synchronize DesiredAccess: SYNCHRONIZE Options: FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT | FILE_OPEN_FOR_BACKUP_INTENT    OBJECT_PATH_NOT_FOUND   
    
    i76.exe 9728    10160   dxwnd.dll   OpenFile    F:  Access: Synchronize DesiredAccess: SYNCHRONIZE Options: FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT | FILE_OPEN_FOR_BACKUP_INTENT    OBJECT_PATH_NOT_FOUND
    
     
  • gho

    gho - 2023-09-19

    I doubt that there could be so many mci commands working after MCI_CLOSE because this message releases the mci session handle, so any further command wouldn't know on what device it would work. MC_OPEN must work by definition (it initialized the device handle) and MCI_SYSINFO refers to the system as a whole, so it can be ok. MCI_STATUS could perhaps work in all cases where it queries a global status condition, but that would depend on the status item. If you have two CD devices, both closed, how could an mci command know to which it should refer?
    Anyway, we know that mci is full of surprises, so if you can find any other command that works somehow after the MCI_CLOSE operation, I would fix the emulation.

     
    • huh

      huh - 2023-09-19

      I don't know if I expressed myself correctly with spystudio, I meant FakeCD not CD Audio emualation . And yes, as you can see in my link to my old post above, some commands aftrer close cdaudio still work but give unexpected behavior, so I wouldn't change anything else yet (except MCI_SYSINFO).

       

      Last edit: huh 2023-09-19
      • gho

        gho - 2023-09-19

        yes, I was commenting the post above ...

         
    • dippy dipper

      dippy dipper - 2023-09-19

      I doubt that there could be so many mci commands working after MCI_CLOSE because this message releases the mci session handle, so any further command wouldn't know on what device it would work. MC_OPEN must work by definition (it initialized the device handle) and MCI_SYSINFO refers to the system as a whole, so it can be ok.

      You maybe right. I remember that mciSendString takes surprisingly many strings without actually requiring the use of "open cdaudio" first and does not throw an error. So you could for example use "set cdaudio time format tmsf" and it would succeed without giving an error message. (Not that it's useful as it does not remember the "tmsf" format if you then open the device with "open cdaudio".) BUT this may not be directly comparable to using the mciSendCommand fucntion.

      For mciSendCommand the MS Docs say:
      The MCI_SYSINFO command retrieves information about MCI devices. MCI supports this command directly rather than passing it to the device.
      https://learn.microsoft.com/en-us/windows/win32/multimedia/mci-sysinfo
      So it may be the only special case when mciSendCommand function is used where the device does not need to be opened first.

      If you have two CD devices, both closed, how could an mci command know to which it should refer?

      Again if I remember correctly MCI is quite stupid in this regard and always picks the first optical drive letter. So you could never use cdaudio from anything but the first drive in the drive letter order.

       
1 2 3 .. 6 > >> (Page 1 of 6)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.