Menu

CDAudio proxy version status (Jul 04, 2020)

2020-07-04
2020-10-20
  • dippy dipper

    dippy dipper - 2020-07-04

    Current version of the stand alone CDAudio proxy is based on Dxwnd v2_05_08 (including dwplay.dll). Below is a list of improvements in Dxwnd CD audio emulation since then.

    v2.05.51
    add: [mciwrapper.cpp] added RESERVEMCIDEVICE flag
    
    v2.05.50
    fix: [winmm.cpp] fixed routing of MCI messages to CD audio emulation, now based on the effective virtual device ID opened by MCI_OPEN and until MCI_CLOSE. Fixes "Gooch Grundy's X-Decathlon".
    
    v2.05.47
    fix: [mciwrapper.cpp] in mciSendString wrapper, handling of "open path ..." command strings in case the path refers to a fake device. Fixes movie play in "Goman" with fake CD device.
    
    v2.05.42
    fix: [mciwrapper.cpp] handling of mciSendString tsmf secret hex format. Fixes "Disney's Hercules" CD sound emulation
    fix: [mciwrapper.cpp] handling of mciSendString "status cdaudio ready" command. Fixes "Disney's Hercules" CD sound emulation
    fix: [mciwrapper.cpp] handling of mciSendString plain "open cdaudio" command. Fixes "Fighting Force" CD sound emulation
    
    v2.05.38
    fix: [mciplayer.cpp] MCI_NOTIFY message sent on MCI_PAUSE/STOP events only when requested by MCI_NOTIFY
    fix: [mciwrapper.cpp] mciSendString "play" and "seek" commands directed to CD emulation only for "cdaudio" device or alias. Fixes "play" command of midi files in "3-D Ultra Pinball Creep Nights".
    
    v2.05.37
    add: [mciwrapper.cpp] added hexdump log for mciSendMessage argument
    fix: [mciplayer.cpp] added handling of MCI_NOTIFY request on MCI_PAUSE/STOP events. Fixes "Jimmy Whites 2 Cueball" CD tracks play.
    
    v2.05.36
    fix: [mciwrapper.cpp] fixed handling of MCI_SYSINFO message. Fixes CD sound emulation in "Interstate 76" and "Interstate 76 Nitro Pack".
    
    v2.05.33
    fix: [mciwrapper.cpp] when paused, MCI_PLAY with no track specification is made equivalent to a MCI_RESUME. Fixes "O.D.T. Escape ... or Die Trying" CD sound resume
    
    v2.05.32
    fix: [mciwrapper.cpp] fack CD returns default "fakecd". Fixes "Sentinel Returns" CD audio.
    fix: [winmm.cpp] default device id for NOZEROAUXDEVID is now 0xBEEF again.
    
    v2.05.31
    fix: [mciwrapper.cpp] fixed STRETCHMOVIE for mciSendCommand activated movies. Fixes "Three Dirty Dwarves" movie.
    
    v2.05.30
    fix: [mciwrapper.cpp] cleared MCI_MCIAVI_PLAY_FULLSCREEN and MCI_MCIAVI_PLAY_FULLBY2 flags in MCI_PLAY in window mode. Fixes "Three Dirty Dwarfs" fullscreen movie.
    fix: [mciwrapper.cpp] fixed prototype of mciSendCommand
    
    v2.05.28
    add: [winmm.cpp] NOZEROAUXDEVID flag. Fixes "Tie Fighter 95" audio
    
    v2.05.26
    fix: fixed mci logic: MCI_CLOSE no longer stops playing audio tracks. Fixes "Mad Trax" that issues MCI_PLAY and MCI_CLOSE in sequence.
    
    v2.05.25
    fix: mci wrapper using a correct fake device id for CDAudio aux device. Thanks to UCyborg. Fixes "Interstate '76"
    
    v2.05.24
    fix: [player.cpp] fixed play loop ending for .wav audio format to avoid crash at end of track
    
    v2.05.20
    fix: [dr_flac.h] included up-to-date dr_flac release v0.11.10 - 2019-06-26
    fix: [player.cpp] fixed bug in dxwplay.dll crashing at the end of a flac track play.
    
    v2.05.18
    fix: [player.cpp] support for Linux/Wine 16 bit flac/wav samples, enlarged buffers.
    fix: [player.cpp] fflush on logging, no log loss upon crash.
    
    v2.05.15
    fix: [winmm.cpp] fix waveOutOpen wrapper crashing while trying to log a NULL ptr
    
    v2.05.12
    add: [winmm.cpp] "Fix default MCI Id" (FIXDEFAULTMCIID) flag to fix the legacy default device id 0xFFFF to 0xFFFFFFFF after WinME. Fixes SpyCraft midi/wave operations.
    add: [winmm.cpp] more MCI tracing wrappers for debug logging
    
    v2.05.11
    add: [mciwrapper.cpp] log messages for msiSendString return code/string for 2 commands
    fix: [mciwrapper.cpp] correct return string for msiSendString  "status cdaudio position" in TMSF mode. Fixes "The House of the Dead" audio resume
    
    v2.05.09
    add: cd changer first release
    fix: [player.cpp] fixed bug in virtual audio CD emulation for .flac files initialization
    
     
  • gho

    gho - 2020-08-05

    Here an archive with the dll & sources aligned to last release v2.04.54 (actually, this release od DxWnd isn't released yet ...).
    Would someone help me to test it? I'm running without a good testbed.

     
    • dippy dipper

      dippy dipper - 2020-08-11

      This new version is missing the logic to make sure VirtualCDAudioDeviceId is never zero. So several games will be mute.

       
      • dippy dipper

        dippy dipper - 2020-08-11

        Testing with "Civ2 Test of Time" I tried forcing "VirtualCDAudioDeviceId = 1" but it did not work.

        Then I noticed there is still "#define MAGIC_DEVICEID 0xBEEF" in mciplayer.h so I edited line 1309 in mciwrapper.cpp to this:

        //parms->wDeviceID = VirtualCDAudioDeviceId;
        parms->wDeviceID = MAGIC_DEVICEID;

        That worked but is probably not the ideal solution.

         
  • dippy dipper

    dippy dipper - 2020-08-11

    Also someone was asking for an option to disable winmm.log creation.

    OutTrace.cpp with logging toggle:

    #define  _CRT_SECURE_NO_WARNINGS
    
    #include "windows.h"
    #include "stdio.h"
    #include "varargs.h"
    
    #define DXWMAXLOGSIZE 4096
    
    void OutTrace(const char *format, ...)
    {
        BOOL WINMMLOGGING = GetPrivateProfileInt("winmm", "logging", 1, ".\\winmm.ini");
    
        if (WINMMLOGGING) {
            va_list al;
            static FILE *fp=NULL; // GHO: thread safe???
            char sBuf[DXWMAXLOGSIZE+1];
    
            if (fp == NULL) {
                fp = fopen(".\\winmm.log", "w+");
                if(fp == NULL) return;
            }
    
            va_start(al, format);
            vsprintf_s(sBuf, DXWMAXLOGSIZE, format, al);
            sBuf[DXWMAXLOGSIZE]=0; // just in case of log truncation
            va_end(al);
            fputs(sBuf, fp);
            fflush(fp);
        }
    }
    

    Plus a new "logging = 1" option in winmm.ini...

     
  • gho

    gho - 2020-08-17

    Again, mostly untested but working with "Imperialism" and "Corum III", in attach a new release that is even ahead of the last published in DxWnd.
    winmm2.rar: proxy winmm.dll + sample configuration file winmm.ini. The file is empty, but the comments hopefully work as documentation.
    cdaudioproxy2.rar: full sources

    These are the news:
    1) added the ReserveMCIId trick. It can be enabled with reservemciid=1 and requires the file dxwnd.wav to lock a mci id.
    2) added the magicid trick. Since in so many cases we regret the old 0xBEEF falue that made things working, setting magicid=1 enables this old trick. (do not set reservemciid in this case)
    3) added the log flag to enable logging. BEWARE: it's "log", not "logging".
    4) fixed some incongruencies about MCI_INFO default values. Now, unless specified differently, they all return the default string "fakecd".
    5) added a (c)copyright line in the log with version string. Mostly useful to be sure what release produced the logs.

    I'm also going to bring some minor fix back to DxWnd.

     

    Last edit: gho 2020-08-17
  • dippy dipper

    dippy dipper - 2020-08-17

    Seems to work fine. A couple of small suggestions:

    • I would put "magicid" on by default. I think there are way more games that need it than those that do not like it.

    • winmm.ini could be autogenerated if not found (code for example in winmm.cpp):

    FILE *fh;
    errno_t err;
    err = fopen_s( &fh, "winmm.ini", "r" );
    if( err == 0 ){
        fclose(fh);
        }
        else{
        err = fopen_s( &fh, "winmm.ini", "w+" );
        }
        if( err == 0 ){
        fprintf(fh,
        "[winmm]\n"
        "\n"
        "#log, 0-1, 1: enables logging, default:0\n"
        "#log=0\n"
        "\n"
        "#volume, range 0-100, default 100\n"
        "#volume=100\n"
        "\n"
        "#repeat, 0-1, 1:enable AUTO-REPEAT, default:0\n"
        "#repeat=0\n"
        "\n"
        "#pause, 0-1, 1:enable PAUSE capability, default:0\n"
        "#pause=0\n"
        "\n"
        "#cdrompresent: 0-1, 1: forces CD detection in the CD caddy also when there are no audio tracks\n"
        "#default: 0\n"
        "#cdrompresent=0\n"
        "\n"
        "#hack: 0-1, 1: enables ./Music/mcihack.txt configuration file\n"
        "#for mcihack.txt see dxwnd help pages\n"
        "#hack=0\n"
        "\n"
        "#magicid: 0-1, 1:forces using the 'impossible' value 0xBEEF, default:1\n"
        "#magicid=1\n"
        "\n"
        "#reservemciid: 0-1, 1:enables reservation of a genuine mci id got by opening dxwnd.wav\n"
        "#default=0. beware: if enabled, requires a dxwnd.wav file in the program folder\n"
        "#reservemciid=0\n");
        fclose(fh);
        }
        else{
        fclose(fh);
        }
    
     

    Last edit: dippy dipper 2020-08-17
  • gho

    gho - 2020-08-19

    About the MciId set to 0, you were awfully right: I forgot one essential part of code that is within dxhook.cpp in the procedre HookInit():

        if(dxw.dwFlags8 & VIRTUALCDAUDIO) {
            // auxGetNumDevs is hot-hooked, so pauxGetNumDevs should be set here.
            // the return of pauxGetNumDevs could be zero!
            // the device ids start from 0, so VirtualCDAudioDeviceId must be n -1 +1 = n.
            if(pauxGetNumDevs) dxw.VirtualCDAudioDeviceId = (*pauxGetNumDevs)();
            // v2.05.36: pretend there's ALWAYS a first device id = 0 for the audio mixer
            if (dxw.VirtualCDAudioDeviceId == 0) dxw.VirtualCDAudioDeviceId = 1;
            OutTraceDW("Fake CDAudio DevId=%d\n", dxw.VirtualCDAudioDeviceId);
            // ghogho
        }
    

    In here DxWnd initializes the CDaudio MciId to a value depending on the number of available aux devices, skipping the value 0 in any case. Probably also this piece of code is wrong, but at least it ensures that there's no overlapping on the MciId value 0.
    I think I'll take your suggestion to set MscId to 0xBEEF by default and use the "reservemciid" flag to make a real device MCI_OPEN on the wav file, this at least on the winmm wrpper. I start to doubt if such a thing should be made also on the full DxWnd tool.

    About the auto-builded winmm.ini, I don't think it's a good idea, at least at this stage: any change to the wrapper should be made twice. Also, the usage of GetPrivateProfice calls to read the file will require that only the non-default values should be written in winmm.ini, so writing that file would be a very easy operation. A maybe better idea, instead, would be to auto-generate the dxwnd.wav file to be sure that the "reservemciid" would always work.

     
  • gho

    gho - 2020-08-19

    Here's the patched version. Fixes:
    1) no more MciId = 0. the default is now 0xBEEF
    2) in case you set "reservemciid = 1" the file winmm.wav is created automatically

    The archive has all within, sources & winmm.dll + sample winmm.ini

     
  • gho

    gho - 2020-08-20

    I uploaded the new stuff (source & libs) in the download area, naming the release 2.05.56 because of the derivation from DxWnd v2.05.55, plus a few enhancements.
    In particular, this release auto-generates the file winmm.wav (used as dxwnd.wav to reserve a MciId value) in case it doesn't exists.
    Please, let me know if anything went wrong because my testing capability is currently rather low....

     
  • gho

    gho - 2020-08-20

    I uploaded the new stuff (source & libs) in the download area, naming the release 2.05.56 because of the derivation from DxWnd v2.05.55, plus a few enhancements.
    In particular, this release auto-generates the file winmm.wav (used as dxwnd.wav to reserve a MciId value) in case it doesn't exists.
    Please, let me know if anything went wrong because my testing capability is currently rather low....

     
  • gho

    gho - 2020-08-22

    Maybe I got it: the culprit could be the "renderer" field. If you run the game in fullscreen mode, the "DirectX / renderer" selector should be moved to "none". If it stays on the default value "primary surface" the problem happens.
    You can fix your configuration this way, while I'm trying to figure out why the "primary surface" renderer is not working as it should in any case.

     

    Last edit: gho 2020-08-22
  • gho

    gho - 2020-08-27

    New leaked release that should fix the "Asghan" sound emulation. Still some alignment should be done, but soon enough it will be moved to download area.

     
  • RebellByte

    RebellByte - 2020-10-03

    Would an update be possible with the new audio fixes/changes of the new dxwnd version ? That would be great, thanks in advance

     
    • gho

      gho - 2020-10-03

      Sure. Is there anything that would interest you in particular? I think the most notable change is the CD audio volume mapped to the mixer channels, but maybe you meant something else?

       
  • RebellByte

    RebellByte - 2020-10-03

    Yes, exactly that. Hopefully the CD volume control will work for Twisted Metal 2 in the options.

     
    • gho

      gho - 2020-10-03

      Here it is. I'm having some trouble testing it on my copy of TM2, would you mind to try it yourself and report?
      Please, remember that the proxy should work exactly as before unless you add this line to the winmm.ini file:

      emulatecdmixer=1
      

      if things are not fully satisfactory, better add also this one and post here the winmm.log file that you will find on the game folder after the experiment:

      log=1
      
       
  • RebellByte

    RebellByte - 2020-10-03

    Mixer control (CD Volume) doesn't working

     

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.