From 2fc5c88068e3dea2612c182ff300511aa2954242 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Sun, 1 Mar 2020 15:03:34 +1100 Subject: [PATCH] Added xactengine-initial patchset --- patches/patchinstall.sh | 60 + .../0001-include-Add-xact3.idl.patch | 580 ++++++ ...-xaudio2-Add-support-for-xactengine3.patch | 1824 +++++++++++++++++ ...Support-older-XACT3Engine-interfaces.patch | 41 + ...Engine-Initialize-return-valid-error.patch | 39 + ...Engine-CreateSoundBank-return-correc.patch | 93 + ...ys-return-S_OK-in-IXACT34Cue-Destroy.patch | 32 + ...udio2_7-Dont-cast-interface-pointers.patch | 123 ++ ...ude-Add-XACTNOTIFICATIONTYPE_-values.patch | 45 + ...-unwrap-structure-based-of-it-s-type.patch | 120 ++ ...Correct-callback-to-windows-function.patch | 78 + ...xaudio2_7-Initial-IXACT3Engine-tests.patch | 133 ++ ...o2_7-Trace-FAudio-version-being-used.patch | 26 + ...o2_7-Trace-FAudio-version-being-used.patch | 26 + ...-include-Add-XACTENGINE_-error-codes.patch | 66 + .../0015-include-Add-XACT-defines.patch | 67 + .../0016-xaudio2_7-tests-Add-more-tests.patch | 217 ++ patches/xactengine-initial/definition | 6 + 18 files changed, 3576 insertions(+) create mode 100644 patches/xactengine-initial/0001-include-Add-xact3.idl.patch create mode 100644 patches/xactengine-initial/0002-xaudio2-Add-support-for-xactengine3.patch create mode 100644 patches/xactengine-initial/0003-xaudio2_7-Support-older-XACT3Engine-interfaces.patch create mode 100644 patches/xactengine-initial/0004-xaudio2_7-IXACT3Engine-Initialize-return-valid-error.patch create mode 100644 patches/xactengine-initial/0005-xaudio2_7-IXACT3Engine-CreateSoundBank-return-correc.patch create mode 100644 patches/xactengine-initial/0006-xaudio2_7-Always-return-S_OK-in-IXACT34Cue-Destroy.patch create mode 100644 patches/xactengine-initial/0007-xaudio2_7-Dont-cast-interface-pointers.patch create mode 100644 patches/xactengine-initial/0008-include-Add-XACTNOTIFICATIONTYPE_-values.patch create mode 100644 patches/xactengine-initial/0009-xaudio2_7-unwrap-structure-based-of-it-s-type.patch create mode 100644 patches/xactengine-initial/0010-xaudio2_7-Correct-callback-to-windows-function.patch create mode 100644 patches/xactengine-initial/0011-xaudio2_7-Initial-IXACT3Engine-tests.patch create mode 100644 patches/xactengine-initial/0012-xaudio2_7-Trace-FAudio-version-being-used.patch create mode 100644 patches/xactengine-initial/0013-xaudio2_7-Trace-FAudio-version-being-used.patch create mode 100644 patches/xactengine-initial/0014-include-Add-XACTENGINE_-error-codes.patch create mode 100644 patches/xactengine-initial/0015-include-Add-XACT-defines.patch create mode 100644 patches/xactengine-initial/0016-xaudio2_7-tests-Add-more-tests.patch create mode 100644 patches/xactengine-initial/definition diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index cb0c682ac..8e1dbfa69 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -355,6 +355,7 @@ patch_enable_all () enable_ws2_32_getaddrinfo="$1" enable_ws2_32_getsockopt="$1" enable_wtsapi32_EnumerateProcesses="$1" + enable_xactengine_initial="$1" } # Enable or disable a specific patchset @@ -1177,6 +1178,9 @@ patch_enable () wtsapi32-EnumerateProcesses) enable_wtsapi32_EnumerateProcesses="$2" ;; + xactengine-initial) + enable_xactengine_initial="$2" + ;; *) return 1 ;; @@ -7284,6 +7288,62 @@ if test "$enable_wtsapi32_EnumerateProcesses" -eq 1; then ) >> "$patchlist" fi +# Patchset xactengine-initial +# | +# | This patchset fixes the following Wine bugs: +# | * [#31476] Support Bully Scholarship Edition xactengine3_1.dll. +# | * [#38615] DSA: Drakensang Demo fails on IXACTEngine::Initialize +# | * [#41030] Pac-Man Museum requires xactengine3_7 +# | * [#41045] Captain Morgane requires xactengine3_4 +# | * [#48684] BlazBlue: Calamity Trigger requires for xactengine 3.3 interface. +# | +# | Modified files: +# | * configure.ac, dlls/xactengine3_0/Makefile.in, dlls/xactengine3_0/xactengine3_0.spec, dlls/xactengine3_1/Makefile.in, +# | dlls/xactengine3_1/xactengine3_1.spec, dlls/xactengine3_2/Makefile.in, dlls/xactengine3_2/xactengine3_2.spec, +# | dlls/xactengine3_3/Makefile.in, dlls/xactengine3_3/xactengine3_3.spec, dlls/xactengine3_4/Makefile.in, +# | dlls/xactengine3_4/xactengine3_4.spec, dlls/xactengine3_5/Makefile.in, dlls/xactengine3_5/xactengine3_5.spec, +# | dlls/xactengine3_6/Makefile.in, dlls/xactengine3_6/xactengine3_6.spec, dlls/xactengine3_7/Makefile.in, +# | dlls/xactengine3_7/xactengine3_7.spec, dlls/xaudio2_7/Makefile.in, dlls/xaudio2_7/tests/Makefile.in, +# | dlls/xaudio2_7/tests/globals.xgs, dlls/xaudio2_7/tests/rsrc.rc, dlls/xaudio2_7/tests/xact.c, +# | dlls/xaudio2_7/tests/xaudio2.c, dlls/xaudio2_7/xact_classes.idl, dlls/xaudio2_7/xact_dll.c, dlls/xaudio2_7/xaudio_dll.c, +# | include/Makefile.in, include/xact3.idl, include/xact3wb.h +# | +if test "$enable_xactengine_initial" -eq 1; then + patch_apply xactengine-initial/0001-include-Add-xact3.idl.patch + patch_apply xactengine-initial/0002-xaudio2-Add-support-for-xactengine3.patch + patch_apply xactengine-initial/0003-xaudio2_7-Support-older-XACT3Engine-interfaces.patch + patch_apply xactengine-initial/0004-xaudio2_7-IXACT3Engine-Initialize-return-valid-error.patch + patch_apply xactengine-initial/0005-xaudio2_7-IXACT3Engine-CreateSoundBank-return-correc.patch + patch_apply xactengine-initial/0006-xaudio2_7-Always-return-S_OK-in-IXACT34Cue-Destroy.patch + patch_apply xactengine-initial/0007-xaudio2_7-Dont-cast-interface-pointers.patch + patch_apply xactengine-initial/0008-include-Add-XACTNOTIFICATIONTYPE_-values.patch + patch_apply xactengine-initial/0009-xaudio2_7-unwrap-structure-based-of-it-s-type.patch + patch_apply xactengine-initial/0010-xaudio2_7-Correct-callback-to-windows-function.patch + patch_apply xactengine-initial/0011-xaudio2_7-Initial-IXACT3Engine-tests.patch + patch_apply xactengine-initial/0012-xaudio2_7-Trace-FAudio-version-being-used.patch + patch_apply xactengine-initial/0013-xaudio2_7-Trace-FAudio-version-being-used.patch + patch_apply xactengine-initial/0014-include-Add-XACTENGINE_-error-codes.patch + patch_apply xactengine-initial/0015-include-Add-XACT-defines.patch + patch_apply xactengine-initial/0016-xaudio2_7-tests-Add-more-tests.patch + ( + printf '%s\n' '+ { "Ethan Lee", "include: Add xact3.idl.", 1 },'; + printf '%s\n' '+ { "Ethan Lee", "xaudio2: Add support for xactengine3.", 1 },'; + printf '%s\n' '+ { "Alistair Leslie-Hughes", "xaudio2_7: Support older XACT3Engine interfaces.", 1 },'; + printf '%s\n' '+ { "Alistair Leslie-Hughes", "xaudio2_7: IXACT3Engine Initialize return valid error code.", 1 },'; + printf '%s\n' '+ { "Alistair Leslie-Hughes", "xaudio2_7: IXACT3Engine CreateSoundBank return correct HRESULT values.", 1 },'; + printf '%s\n' '+ { "Alistair Leslie-Hughes", "xaudio2_7: Always return S_OK in IXACT34Cue Destroy.", 1 },'; + printf '%s\n' '+ { "Alistair Leslie-Hughes", "xaudio2_7: Dont cast interface pointers.", 1 },'; + printf '%s\n' '+ { "Alistair Leslie-Hughes", "include: Add XACTNOTIFICATIONTYPE_* values.", 1 },'; + printf '%s\n' '+ { "Alistair Leslie-Hughes", "xaudio2_7: Unwrap structure based of it'\''s type.", 1 },'; + printf '%s\n' '+ { "Alistair Leslie-Hughes", "xaudio2_7: Correct callback to windows function.", 1 },'; + printf '%s\n' '+ { "Alistair Leslie-Hughes", "xaudio2_7: Initial IXACT3Engine tests.", 1 },'; + printf '%s\n' '+ { "Alistair Leslie-Hughes", "xaudio2_7: Trace FAudio version being used.", 1 },'; + printf '%s\n' '+ { "Alistair Leslie-Hughes", "include: Add XACTENGINE_* error codes.", 1 },'; + printf '%s\n' '+ { "Alistair Leslie-Hughes", "include: Add XACT defines.", 1 },'; + printf '%s\n' '+ { "Alistair Leslie-Hughes", "xaudio2_7/tests: Add more tests.", 1 },'; + ) >> "$patchlist" +fi + if test "$enable_patchlist" -eq 1; then diff --git a/patches/xactengine-initial/0001-include-Add-xact3.idl.patch b/patches/xactengine-initial/0001-include-Add-xact3.idl.patch new file mode 100644 index 000000000..5dd31d228 --- /dev/null +++ b/patches/xactengine-initial/0001-include-Add-xact3.idl.patch @@ -0,0 +1,580 @@ +From fa4b6d66242136e922620295da4a22a7431d17fe Mon Sep 17 00:00:00 2001 +From: Ethan Lee +Date: Wed, 22 Jan 2020 00:12:10 +0000 +Subject: [PATCH] include: Add xact3.idl + +Signed-off-by: Alistair Leslie-Hughes +--- + include/Makefile.in | 1 + + include/xact3.idl | 533 ++++++++++++++++++++++++++++++++++++++++++++ + include/xact3wb.h | 2 + + 3 files changed, 536 insertions(+) + create mode 100644 include/xact3.idl + +diff --git a/include/Makefile.in b/include/Makefile.in +index ce0f6fc433..faba1622d9 100644 +--- a/include/Makefile.in ++++ b/include/Makefile.in +@@ -784,6 +784,7 @@ SOURCES = \ + wtypes.idl \ + wuapi.idl \ + x3daudio.h \ ++ xact3.idl \ + xact3wb.h \ + xapo.idl \ + xapofx.h \ +diff --git a/include/xact3.idl b/include/xact3.idl +new file mode 100644 +index 0000000000..c49718ff39 +--- /dev/null ++++ b/include/xact3.idl +@@ -0,0 +1,533 @@ ++/* ++ * Copyright (c) 2018 Ethan Lee for CodeWeavers ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA ++ */ ++ ++import "unknwn.idl"; ++import "xaudio2.idl"; ++ ++import "xact3wb.h"; ++ ++[ ++ uuid(bcc782bc-6492-4c22-8c35-f5d72fe73c6e) ++] ++coclass XACTEngine ++{ ++} ++ ++interface IXACT3Engine; ++interface IXACT3SoundBank; ++interface IXACT3WaveBank; ++interface IXACT3Cue; ++interface IXACT3Wave; ++ ++typedef WORD XACTCATEGORY; ++typedef BYTE XACTCHANNEL; ++typedef WORD XACTINDEX; ++typedef BYTE XACTINSTANCELIMIT; ++typedef BYTE XACTLOOPCOUNT; ++typedef BYTE XACTNOTIFICATIONTYPE; ++typedef SHORT XACTPITCH; ++typedef LONG XACTTIME; ++typedef WORD XACTVARIABLEINDEX; ++typedef FLOAT XACTVARIABLEVALUE; ++typedef BYTE XACTVARIATIONWEIGHT; ++typedef FLOAT XACTVOLUME; ++ ++#define XACT_RENDERER_ID_LENGTH 0xff ++#define XACT_RENDERER_NAME_LENGTH 0xff ++#define XACT_CUE_NAME_LENGTH 0xff ++ ++cpp_quote("#ifndef WAVEBANK_ENTRYNAME_LENGTH") ++#define WAVEBANK_ENTRYNAME_LENGTH 64 ++cpp_quote("#endif") ++ ++typedef struct XACT_RENDERER_DETAILS ++{ ++ WCHAR rendererID[XACT_RENDERER_ID_LENGTH]; ++ WCHAR displayName[XACT_RENDERER_NAME_LENGTH]; ++ BOOL defaultDevice; ++} XACT_RENDERER_DETAILS; ++ ++typedef BOOL (__stdcall *XACT_READFILE_CALLBACK)( ++ HANDLE hFile, ++ LPVOID lpBuffer, ++ DWORD nNumberOfBytesRead, ++ LPDWORD lpNumberOfBytesRead, ++ void* lpOverlapped ++); ++typedef BOOL (__stdcall *XACT_GETOVERLAPPEDRESULT_CALLBACK)( ++ HANDLE hFile, ++ void* lpOverlapped, ++ LPDWORD lpNumberOfBytesTransferred, ++ BOOL bWait ++); ++typedef struct XACT_FILEIO_CALLBACKS ++{ ++ XACT_READFILE_CALLBACK readFileCallback; ++ XACT_GETOVERLAPPEDRESULT_CALLBACK getOverlappedResultCallback; ++} XACT_FILEIO_CALLBACKS; ++ ++typedef struct XACT_STREAMING_PARAMETERS ++{ ++ HANDLE file; ++ DWORD offset; ++ DWORD flags; ++ WORD packetSize; ++} XACT_STREAMING_PARAMETERS; ++ ++typedef struct XACT_WAVE_PROPERTIES ++{ ++ char friendlyName[WAVEBANK_ENTRYNAME_LENGTH]; ++ WAVEBANKMINIWAVEFORMAT format; ++ DWORD durationInSamples; ++ WAVEBANKSAMPLEREGION loopRegion; ++ BOOL streaming; ++} XACT_WAVE_PROPERTIES; ++ ++cpp_quote("#if 0") ++typedef struct XACT_WAVE_INSTANCE_PROPERTIES ++{ ++ XACT_WAVE_PROPERTIES waveProperties; /* properties is a keyword for midl */ ++ BOOL backgroundMusic; ++} XACT_WAVE_INSTANCE_PROPERTIES; ++cpp_quote("#endif") ++ ++cpp_quote("typedef struct XACT_WAVE_INSTANCE_PROPERTIES") ++cpp_quote("{") ++cpp_quote(" XACT_WAVE_PROPERTIES properties;") ++cpp_quote(" BOOL backgroundMusic;") ++cpp_quote("} XACT_WAVE_INSTANCE_PROPERTIES;") ++ ++typedef struct XACT_CUE_PROPERTIES ++{ ++ char friendlyName[XACT_CUE_NAME_LENGTH]; ++ BOOL interactive; ++ XACTINDEX iaVariableIndex; ++ XACTINDEX numVariations; ++ XACTINSTANCELIMIT maxInstances; ++ XACTINSTANCELIMIT currentInstances; ++} XACT_CUE_PROPERTIES; ++ ++typedef struct XACT_TRACK_PROPERTIES ++{ ++ XACTTIME duration; ++ XACTINDEX numVariations; ++ XACTCHANNEL numChannels; ++ XACTINDEX waveVariation; ++ XACTLOOPCOUNT loopCount; ++} XACT_TRACK_PROPERTIES; ++ ++typedef struct XACT_VARIATION_PROPERTIES ++{ ++ XACTINDEX index; ++ XACTVARIATIONWEIGHT weight; ++ XACTVARIABLEVALUE iaVariableMin; ++ XACTVARIABLEVALUE iaVariableMax; ++ BOOL linger; ++} XACT_VARIATION_PROPERTIES; ++ ++typedef struct XACT_SOUND_PROPERTIES ++{ ++ XACTCATEGORY category; ++ BYTE priority; ++ XACTPITCH pitch; ++ XACTVOLUME volume; ++ XACTINDEX numTracks; ++ XACT_TRACK_PROPERTIES arrTrackProperties[1]; ++} XACT_SOUND_PROPERTIES; ++ ++typedef struct XACT_SOUND_VARIATION_PROPERTIES ++{ ++ XACT_VARIATION_PROPERTIES variationProperties; ++ XACT_SOUND_PROPERTIES soundProperties; ++} XACT_SOUND_VARIATION_PROPERTIES; ++ ++typedef struct XACT_CUE_INSTANCE_PROPERTIES ++{ ++ DWORD allocAttributes; ++ XACT_CUE_PROPERTIES cueProperties; ++ XACT_SOUND_VARIATION_PROPERTIES activeVariationProperties; ++} XACT_CUE_INSTANCE_PROPERTIES; ++ ++cpp_quote("#include ") ++ ++typedef struct XACT_NOTIFICATION_DESCRIPTION ++{ ++ XACTNOTIFICATIONTYPE type; ++ BYTE flags; ++ IXACT3SoundBank *pSoundBank; ++ IXACT3WaveBank *pWaveBank; ++ IXACT3Cue *pCue; ++ IXACT3Wave *pWave; ++ XACTINDEX cueIndex; ++ XACTINDEX waveIndex; ++ void* pvContext; ++} XACT_NOTIFICATION_DESCRIPTION; ++ ++typedef struct XACT_NOTIFICATION_CUE ++{ ++ XACTINDEX cueIndex; ++ IXACT3SoundBank *pSoundBank; ++ IXACT3Cue *pCue; ++} XACT_NOTIFICATION_CUE; ++ ++typedef struct XACT_NOTIFICATION_MARKER ++{ ++ XACTINDEX cueIndex; ++ IXACT3SoundBank *pSoundBank; ++ IXACT3Cue *pCue; ++ DWORD marker; ++} XACT_NOTIFICATION_MARKER; ++ ++typedef struct XACT_NOTIFICATION_SOUNDBANK ++{ ++ IXACT3SoundBank *pSoundBank; ++} XACT_NOTIFICATION_SOUNDBANK; ++ ++typedef struct XACT_NOTIFICATION_WAVEBANK ++{ ++ IXACT3WaveBank *pWaveBank; ++} XACT_NOTIFICATION_WAVEBANK; ++ ++typedef struct XACT_NOTIFICATION_VARIABLE ++{ ++ XACTINDEX cueIndex; ++ IXACT3SoundBank *pSoundBank; ++ IXACT3Cue *pCue; ++ XACTVARIABLEINDEX variableIndex; ++ XACTVARIABLEVALUE variableValue; ++ BOOL local; ++} XACT_NOTIFICATION_VARIABLE; ++ ++typedef struct XACT_NOTIFICATION_GUI ++{ ++ DWORD reserved; ++} XACT_NOTIFICATION_GUI; ++ ++typedef struct XACT_NOTIFICATION_WAVE ++{ ++ IXACT3WaveBank *pWaveBank; ++ XACTINDEX waveIndex; ++ XACTINDEX cueIndex; ++ IXACT3SoundBank *pSoundBank; ++ IXACT3Cue *pCue; ++ IXACT3Wave *pWave; ++} XACT_NOTIFICATION_WAVE; ++ ++typedef struct XACT_NOTIFICATION ++{ ++ XACTNOTIFICATIONTYPE type; ++ LONG timeStamp; ++ PVOID pvContext; ++ union ++ { ++ XACT_NOTIFICATION_CUE cue; ++ XACT_NOTIFICATION_MARKER marker; ++ XACT_NOTIFICATION_SOUNDBANK soundBank; ++ XACT_NOTIFICATION_WAVEBANK waveBank; ++ XACT_NOTIFICATION_VARIABLE variable; ++ XACT_NOTIFICATION_GUI gui; ++ XACT_NOTIFICATION_WAVE wave; ++ } DUMMYUNIONNAME; ++} XACT_NOTIFICATION; ++ ++typedef void (__stdcall *XACT_NOTIFICATION_CALLBACK)( ++ const XACT_NOTIFICATION *pNotification ++); ++ ++typedef struct XACT_RUNTIME_PARAMETERS ++{ ++ DWORD lookAheadTime; ++ void* pGlobalSettingsBuffer; ++ DWORD globalSettingsBufferSize; ++ DWORD globalSettingsFlags; ++ DWORD globalSettingsAllocAttributes; ++ XACT_FILEIO_CALLBACKS fileIOCallbacks; ++ XACT_NOTIFICATION_CALLBACK fnNotificationCallback; ++ LPCWSTR pRendererID; ++ IXAudio2 *pXAudio2; ++ IXAudio2MasteringVoice *pMasteringVoice; ++} XACT_RUNTIME_PARAMETERS; ++ ++ ++cpp_quote("#include ") ++ ++static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUEDESTROYED = 4; ++static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_SOUNDBANKDESTROYED = 6; ++static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEBANKDESTROYED = 7; ++static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEDESTROYED = 16; ++ ++[ ++ object, ++ local, ++ uuid(b1ee676a-d9cd-4d2a-89a8-fa53eb9e480b), ++] ++interface IXACT3Engine : IUnknown ++{ ++ HRESULT GetRendererCount(XACTINDEX *pnRendererCount); ++ ++ HRESULT GetRendererDetails( ++ XACTINDEX nRendererIndex, ++ XACT_RENDERER_DETAILS *pRendererDetails); ++ ++ HRESULT GetFinalMixFormat(WAVEFORMATEXTENSIBLE *pFinalMixFormat); ++ ++ HRESULT Initialize(const XACT_RUNTIME_PARAMETERS *pParams); ++ ++ HRESULT ShutDown(); ++ ++ HRESULT DoWork(); ++ ++ HRESULT CreateSoundBank( ++ const void* pvBuffer, ++ DWORD dwSize, ++ DWORD dwFlags, ++ DWORD dwAllocAttributes, ++ IXACT3SoundBank **ppSoundBank); ++ ++ HRESULT CreateInMemoryWaveBank( ++ const void* pvBuffer, ++ DWORD dwSize, ++ DWORD dwFlags, ++ DWORD dwAllocAttributes, ++ IXACT3WaveBank **ppWaveBank); ++ ++ HRESULT CreateStreamingWaveBank( ++ const XACT_STREAMING_PARAMETERS *pParms, ++ IXACT3WaveBank **ppWaveBank); ++ ++ HRESULT PrepareWave( ++ DWORD dwFlags, ++ LPCSTR szWavePath, ++ WORD wStreamingPacketSize, ++ DWORD dwAlignment, ++ DWORD dwPlayOffset, ++ XACTLOOPCOUNT nLoopCount, ++ IXACT3Wave **ppWave); ++ ++ HRESULT PrepareInMemoryWave( ++ DWORD dwFlags, ++ WAVEBANKENTRY entry, ++ DWORD *pdwSeekTable, ++ BYTE *pbWaveData, ++ DWORD dwPlayOffset, ++ XACTLOOPCOUNT nLoopCount, ++ IXACT3Wave **ppWave); ++ ++ HRESULT PrepareStreamingWave( ++ DWORD dwFlags, ++ WAVEBANKENTRY entry, ++ XACT_STREAMING_PARAMETERS streamingParams, ++ DWORD dwAlignment, ++ DWORD *pdwSeekTable, ++ DWORD dwPlayOffset, ++ XACTLOOPCOUNT nLoopCount, ++ IXACT3Wave **ppWave); ++ ++ HRESULT RegisterNotification( ++ const XACT_NOTIFICATION_DESCRIPTION *pNotificationDesc); ++ ++ HRESULT UnRegisterNotification( ++ const XACT_NOTIFICATION_DESCRIPTION *pNotificationDesc); ++ ++ XACTCATEGORY GetCategory( ++ LPCSTR szFriendlyName); ++ ++ HRESULT Stop(XACTCATEGORY nCategory, DWORD dwFlags); ++ ++ HRESULT SetVolume(XACTCATEGORY nCategory, XACTVOLUME nVolume); ++ ++ HRESULT Pause(XACTCATEGORY nCategory, BOOL fPause); ++ ++ XACTVARIABLEINDEX GetGlobalVariableIndex(LPCSTR szFriendlyName); ++ ++ HRESULT SetGlobalVariable( ++ XACTVARIABLEINDEX nIndex, ++ XACTVARIABLEVALUE nValue); ++ ++ HRESULT GetGlobalVariable( ++ XACTVARIABLEINDEX nIndex, ++ XACTVARIABLEVALUE *nValue); ++} ++ ++[ ++ object, ++ local ++] ++interface IXACT3SoundBank ++{ ++ XACTINDEX GetCueIndex(LPCSTR szFriendlyName); ++ ++ HRESULT GetNumCues(XACTINDEX *pnNumCues); ++ ++ HRESULT GetCueProperties( ++ XACTINDEX nCueIndex, ++ XACT_CUE_PROPERTIES *pProperties); ++ ++ HRESULT Prepare( ++ XACTINDEX nCueIndex, ++ DWORD dwFlags, ++ XACTTIME timeOffset, ++ IXACT3Cue **ppCue); ++ ++ HRESULT Play( ++ XACTINDEX nCueIndex, ++ DWORD dwFlags, ++ XACTTIME timeOffset, ++ IXACT3Cue **ppCue); ++ ++ HRESULT Stop(XACTINDEX nCueIndex, DWORD dwFlags); ++ ++ HRESULT Destroy(); ++ ++ HRESULT GetState(DWORD *pdwState); ++} ++ ++[ ++ object, ++ local ++] ++interface IXACT3WaveBank ++{ ++ HRESULT Destroy(); ++ ++ HRESULT GetNumWaves(XACTINDEX *pnNumWaves); ++ ++ XACTINDEX GetWaveIndex(LPCSTR szFriendlyName); ++ ++ HRESULT GetWaveProperties( ++ XACTINDEX nWaveIndex, ++ XACT_WAVE_PROPERTIES *pWaveProperties); ++ ++ HRESULT Prepare( ++ XACTINDEX nWaveIndex, ++ DWORD dwFlags, ++ DWORD dwPlayOffset, ++ XACTLOOPCOUNT nLoopCount, ++ IXACT3Wave **ppWave); ++ ++ HRESULT Play( ++ XACTINDEX nWaveIndex, ++ DWORD dwFlags, ++ DWORD dwPlayOffset, ++ XACTLOOPCOUNT nLoopCount, ++ IXACT3Wave **ppWave); ++ ++ HRESULT Stop(XACTINDEX nWaveIndex, DWORD dwFlags); ++ ++ HRESULT GetState(DWORD *pdwState); ++} ++ ++[ ++ object, ++ local ++] ++interface IXACT34Cue ++{ ++ HRESULT Play(); ++ ++ HRESULT Stop(DWORD dwFlags); ++ ++ HRESULT GetState(DWORD *pdwState); ++ ++ HRESULT Destroy(); ++ ++ HRESULT SetMatrixCoefficients( ++ UINT32 uSrcChannelCount, ++ UINT32 uDstChannelCount, ++ float *pMatrixCoefficients); ++ ++ XACTVARIABLEINDEX GetVariableIndex(LPCSTR szFriendlyName); ++ ++ HRESULT SetVariable(XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue); ++ ++ HRESULT GetVariable( ++ XACTVARIABLEINDEX nIndex, ++ XACTVARIABLEVALUE *nValue); ++ ++ HRESULT Pause(BOOL fPause); ++ ++ HRESULT GetProperties(XACT_CUE_INSTANCE_PROPERTIES **ppProperties); ++} ++ ++[ ++ object, ++ local ++] ++interface IXACT3Cue ++{ ++ HRESULT Play(); ++ ++ HRESULT Stop(DWORD dwFlags); ++ ++ HRESULT GetState(DWORD *pdwState); ++ ++ HRESULT Destroy(); ++ ++ HRESULT SetMatrixCoefficients( ++ UINT32 uSrcChannelCount, ++ UINT32 uDstChannelCount, ++ float *pMatrixCoefficients); ++ ++ XACTVARIABLEINDEX GetVariableIndex(LPCSTR szFriendlyName); ++ ++ HRESULT SetVariable(XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue); ++ ++ HRESULT GetVariable( ++ XACTVARIABLEINDEX nIndex, ++ XACTVARIABLEVALUE *nValue); ++ ++ HRESULT Pause(BOOL fPause); ++ ++ HRESULT GetProperties(XACT_CUE_INSTANCE_PROPERTIES **ppProperties); ++ ++ HRESULT SetOutputVoices(const XAUDIO2_VOICE_SENDS *pSendList); ++ ++ HRESULT SetOutputVoiceMatrix( ++ IXAudio2Voice *pDestinationVoice, ++ UINT32 SourceChannels, ++ UINT32 DestinationChannels, ++ const float *pLevelMatrix); ++} ++ ++[ ++ object, ++ local ++] ++interface IXACT3Wave ++{ ++ HRESULT Destroy(); ++ ++ HRESULT Play(); ++ ++ HRESULT Stop(DWORD dwFlags); ++ ++ HRESULT Pause(BOOL fPause); ++ ++ HRESULT GetState(DWORD *pdwState); ++ ++ HRESULT SetPitch(XACTPITCH pitch); ++ ++ HRESULT SetVolume(XACTVOLUME volume); ++ ++ HRESULT SetMatrixCoefficients( ++ UINT32 uSrcChannelCount, ++ UINT32 uDstChannelCount, ++ float *pMatrixCoefficients); ++ ++ HRESULT GetProperties(XACT_WAVE_INSTANCE_PROPERTIES *pProperties); ++} +diff --git a/include/xact3wb.h b/include/xact3wb.h +index b4c5a53d40..130efc9745 100644 +--- a/include/xact3wb.h ++++ b/include/xact3wb.h +@@ -18,6 +18,8 @@ + #ifndef __XACT3WB_H__ + #define __XACT3WB_H__ + ++#define WAVEBANK_ENTRYNAME_LENGTH 64 ++ + typedef union WAVEBANKMINIWAVEFORMAT + { + struct +-- +2.25.1 + diff --git a/patches/xactengine-initial/0002-xaudio2-Add-support-for-xactengine3.patch b/patches/xactengine-initial/0002-xaudio2-Add-support-for-xactengine3.patch new file mode 100644 index 000000000..c796c2cfd --- /dev/null +++ b/patches/xactengine-initial/0002-xaudio2-Add-support-for-xactengine3.patch @@ -0,0 +1,1824 @@ +From 4ed706183e0d82b3d60ccba9564d4b05d2441049 Mon Sep 17 00:00:00 2001 +From: Ethan Lee +Date: Wed, 13 Nov 2019 12:13:45 -0500 +Subject: [PATCH] xaudio2: Add support for xactengine3 + +v2: Remove references to IXAudio2/IXAudio2Voice internals + +v3: Uses 0x030* for the version. + #if out xact_dll.c from the xaudio solution. + Use a static ClassFactory interface. + +Signed-off-by: Ethan Lee +--- + configure.ac | 16 + + dlls/xactengine3_0/Makefile.in | 12 + + dlls/xactengine3_0/xactengine3_0.spec | 4 + + dlls/xactengine3_1/Makefile.in | 12 + + dlls/xactengine3_1/xactengine3_1.spec | 4 + + dlls/xactengine3_2/Makefile.in | 12 + + dlls/xactengine3_2/xactengine3_2.spec | 4 + + dlls/xactengine3_3/Makefile.in | 12 + + dlls/xactengine3_3/xactengine3_3.spec | 4 + + dlls/xactengine3_4/Makefile.in | 12 + + dlls/xactengine3_4/xactengine3_4.spec | 4 + + dlls/xactengine3_5/Makefile.in | 12 + + dlls/xactengine3_5/xactengine3_5.spec | 4 + + dlls/xactengine3_6/Makefile.in | 12 + + dlls/xactengine3_6/xactengine3_6.spec | 4 + + dlls/xactengine3_7/Makefile.in | 12 + + dlls/xactengine3_7/xactengine3_7.spec | 4 + + dlls/xaudio2_7/Makefile.in | 5 +- + dlls/xaudio2_7/xact_classes.idl | 93 ++ + dlls/xaudio2_7/xact_dll.c | 1387 +++++++++++++++++++++++++ + 20 files changed, 1628 insertions(+), 1 deletion(-) + create mode 100644 dlls/xactengine3_0/Makefile.in + create mode 100644 dlls/xactengine3_0/xactengine3_0.spec + create mode 100644 dlls/xactengine3_1/Makefile.in + create mode 100644 dlls/xactengine3_1/xactengine3_1.spec + create mode 100644 dlls/xactengine3_2/Makefile.in + create mode 100644 dlls/xactengine3_2/xactengine3_2.spec + create mode 100644 dlls/xactengine3_3/Makefile.in + create mode 100644 dlls/xactengine3_3/xactengine3_3.spec + create mode 100644 dlls/xactengine3_4/Makefile.in + create mode 100644 dlls/xactengine3_4/xactengine3_4.spec + create mode 100644 dlls/xactengine3_5/Makefile.in + create mode 100644 dlls/xactengine3_5/xactengine3_5.spec + create mode 100644 dlls/xactengine3_6/Makefile.in + create mode 100644 dlls/xactengine3_6/xactengine3_6.spec + create mode 100644 dlls/xactengine3_7/Makefile.in + create mode 100644 dlls/xactengine3_7/xactengine3_7.spec + create mode 100644 dlls/xaudio2_7/xact_classes.idl + create mode 100644 dlls/xaudio2_7/xact_dll.c + +diff --git a/configure.ac b/configure.ac +index 47d2b750c0..1feca3c8e0 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1917,6 +1917,14 @@ then + enable_x3daudio1_5=${enable_x3daudio1_5:-no} + enable_x3daudio1_6=${enable_x3daudio1_6:-no} + enable_x3daudio1_7=${enable_x3daudio1_7:-no} ++ enable_xactengine3_0=${enable_xactengine3_0:-no} ++ enable_xactengine3_1=${enable_xactengine3_1:-no} ++ enable_xactengine3_2=${enable_xactengine3_2:-no} ++ enable_xactengine3_3=${enable_xactengine3_3:-no} ++ enable_xactengine3_4=${enable_xactengine3_4:-no} ++ enable_xactengine3_5=${enable_xactengine3_5:-no} ++ enable_xactengine3_6=${enable_xactengine3_6:-no} ++ enable_xactengine3_7=${enable_xactengine3_7:-no} + enable_xapofx1_1=${enable_xapofx1_1:-no} + enable_xapofx1_2=${enable_xapofx1_2:-no} + enable_xapofx1_3=${enable_xapofx1_3:-no} +@@ -3845,6 +3853,14 @@ WINE_CONFIG_MAKEFILE(dlls/x3daudio1_4) + WINE_CONFIG_MAKEFILE(dlls/x3daudio1_5) + WINE_CONFIG_MAKEFILE(dlls/x3daudio1_6) + WINE_CONFIG_MAKEFILE(dlls/x3daudio1_7) ++WINE_CONFIG_MAKEFILE(dlls/xactengine3_0) ++WINE_CONFIG_MAKEFILE(dlls/xactengine3_1) ++WINE_CONFIG_MAKEFILE(dlls/xactengine3_2) ++WINE_CONFIG_MAKEFILE(dlls/xactengine3_3) ++WINE_CONFIG_MAKEFILE(dlls/xactengine3_4) ++WINE_CONFIG_MAKEFILE(dlls/xactengine3_5) ++WINE_CONFIG_MAKEFILE(dlls/xactengine3_6) ++WINE_CONFIG_MAKEFILE(dlls/xactengine3_7) + WINE_CONFIG_MAKEFILE(dlls/xapofx1_1) + WINE_CONFIG_MAKEFILE(dlls/xapofx1_2) + WINE_CONFIG_MAKEFILE(dlls/xapofx1_3) +diff --git a/dlls/xactengine3_0/Makefile.in b/dlls/xactengine3_0/Makefile.in +new file mode 100644 +index 0000000000..0353039913 +--- /dev/null ++++ b/dlls/xactengine3_0/Makefile.in +@@ -0,0 +1,12 @@ ++EXTRADEFS = -DXACT3_VER=0x0300 ++MODULE = xactengine3_0.dll ++IMPORTS = advapi32 ole32 user32 uuid ++PARENTSRC = ../xaudio2_7 ++EXTRALIBS = $(FAUDIO_LIBS) ++EXTRAINCL = $(FAUDIO_CFLAGS) ++ ++C_SRCS = \ ++ xact_dll.c \ ++ xaudio_allocator.c ++ ++IDL_SRCS = xact_classes.idl +diff --git a/dlls/xactengine3_0/xactengine3_0.spec b/dlls/xactengine3_0/xactengine3_0.spec +new file mode 100644 +index 0000000000..b16365d0c9 +--- /dev/null ++++ b/dlls/xactengine3_0/xactengine3_0.spec +@@ -0,0 +1,4 @@ ++@ stdcall -private DllCanUnloadNow() ++@ stdcall -private DllGetClassObject(ptr ptr ptr) ++@ stdcall -private DllRegisterServer() ++@ stdcall -private DllUnregisterServer() +diff --git a/dlls/xactengine3_1/Makefile.in b/dlls/xactengine3_1/Makefile.in +new file mode 100644 +index 0000000000..b065b92d9a +--- /dev/null ++++ b/dlls/xactengine3_1/Makefile.in +@@ -0,0 +1,12 @@ ++EXTRADEFS = -DXACT3_VER=0x0301 ++MODULE = xactengine3_1.dll ++IMPORTS = advapi32 ole32 user32 uuid ++PARENTSRC = ../xaudio2_7 ++EXTRALIBS = $(FAUDIO_LIBS) ++EXTRAINCL = $(FAUDIO_CFLAGS) ++ ++C_SRCS = \ ++ xact_dll.c \ ++ xaudio_allocator.c ++ ++IDL_SRCS = xact_classes.idl +diff --git a/dlls/xactengine3_1/xactengine3_1.spec b/dlls/xactengine3_1/xactengine3_1.spec +new file mode 100644 +index 0000000000..b16365d0c9 +--- /dev/null ++++ b/dlls/xactengine3_1/xactengine3_1.spec +@@ -0,0 +1,4 @@ ++@ stdcall -private DllCanUnloadNow() ++@ stdcall -private DllGetClassObject(ptr ptr ptr) ++@ stdcall -private DllRegisterServer() ++@ stdcall -private DllUnregisterServer() +diff --git a/dlls/xactengine3_2/Makefile.in b/dlls/xactengine3_2/Makefile.in +new file mode 100644 +index 0000000000..6e4e065534 +--- /dev/null ++++ b/dlls/xactengine3_2/Makefile.in +@@ -0,0 +1,12 @@ ++EXTRADEFS = -DXACT3_VER=0x0302 ++MODULE = xactengine3_2.dll ++IMPORTS = advapi32 ole32 user32 uuid ++PARENTSRC = ../xaudio2_7 ++EXTRALIBS = $(FAUDIO_LIBS) ++EXTRAINCL = $(FAUDIO_CFLAGS) ++ ++C_SRCS = \ ++ xact_dll.c \ ++ xaudio_allocator.c ++ ++IDL_SRCS = xact_classes.idl +diff --git a/dlls/xactengine3_2/xactengine3_2.spec b/dlls/xactengine3_2/xactengine3_2.spec +new file mode 100644 +index 0000000000..b16365d0c9 +--- /dev/null ++++ b/dlls/xactengine3_2/xactengine3_2.spec +@@ -0,0 +1,4 @@ ++@ stdcall -private DllCanUnloadNow() ++@ stdcall -private DllGetClassObject(ptr ptr ptr) ++@ stdcall -private DllRegisterServer() ++@ stdcall -private DllUnregisterServer() +diff --git a/dlls/xactengine3_3/Makefile.in b/dlls/xactengine3_3/Makefile.in +new file mode 100644 +index 0000000000..a8eebc03b2 +--- /dev/null ++++ b/dlls/xactengine3_3/Makefile.in +@@ -0,0 +1,12 @@ ++EXTRADEFS = -DXACT3_VER=0x0303 ++MODULE = xactengine3_3.dll ++IMPORTS = advapi32 ole32 user32 uuid ++PARENTSRC = ../xaudio2_7 ++EXTRALIBS = $(FAUDIO_LIBS) ++EXTRAINCL = $(FAUDIO_CFLAGS) ++ ++C_SRCS = \ ++ xact_dll.c \ ++ xaudio_allocator.c ++ ++IDL_SRCS = xact_classes.idl +diff --git a/dlls/xactengine3_3/xactengine3_3.spec b/dlls/xactengine3_3/xactengine3_3.spec +new file mode 100644 +index 0000000000..b16365d0c9 +--- /dev/null ++++ b/dlls/xactengine3_3/xactengine3_3.spec +@@ -0,0 +1,4 @@ ++@ stdcall -private DllCanUnloadNow() ++@ stdcall -private DllGetClassObject(ptr ptr ptr) ++@ stdcall -private DllRegisterServer() ++@ stdcall -private DllUnregisterServer() +diff --git a/dlls/xactengine3_4/Makefile.in b/dlls/xactengine3_4/Makefile.in +new file mode 100644 +index 0000000000..967acb7bcc +--- /dev/null ++++ b/dlls/xactengine3_4/Makefile.in +@@ -0,0 +1,12 @@ ++EXTRADEFS = -DXACT3_VER=0x0304 ++MODULE = xactengine3_4.dll ++IMPORTS = advapi32 ole32 user32 uuid ++PARENTSRC = ../xaudio2_7 ++EXTRALIBS = $(FAUDIO_LIBS) ++EXTRAINCL = $(FAUDIO_CFLAGS) ++ ++C_SRCS = \ ++ xact_dll.c \ ++ xaudio_allocator.c ++ ++IDL_SRCS = xact_classes.idl +diff --git a/dlls/xactengine3_4/xactengine3_4.spec b/dlls/xactengine3_4/xactengine3_4.spec +new file mode 100644 +index 0000000000..b16365d0c9 +--- /dev/null ++++ b/dlls/xactengine3_4/xactengine3_4.spec +@@ -0,0 +1,4 @@ ++@ stdcall -private DllCanUnloadNow() ++@ stdcall -private DllGetClassObject(ptr ptr ptr) ++@ stdcall -private DllRegisterServer() ++@ stdcall -private DllUnregisterServer() +diff --git a/dlls/xactengine3_5/Makefile.in b/dlls/xactengine3_5/Makefile.in +new file mode 100644 +index 0000000000..16e8b00b5e +--- /dev/null ++++ b/dlls/xactengine3_5/Makefile.in +@@ -0,0 +1,12 @@ ++EXTRADEFS = -DXACT3_VER=0x0305 ++MODULE = xactengine3_5.dll ++IMPORTS = advapi32 ole32 user32 uuid ++PARENTSRC = ../xaudio2_7 ++EXTRALIBS = $(FAUDIO_LIBS) ++EXTRAINCL = $(FAUDIO_CFLAGS) ++ ++C_SRCS = \ ++ xact_dll.c \ ++ xaudio_allocator.c ++ ++IDL_SRCS = xact_classes.idl +diff --git a/dlls/xactengine3_5/xactengine3_5.spec b/dlls/xactengine3_5/xactengine3_5.spec +new file mode 100644 +index 0000000000..b16365d0c9 +--- /dev/null ++++ b/dlls/xactengine3_5/xactengine3_5.spec +@@ -0,0 +1,4 @@ ++@ stdcall -private DllCanUnloadNow() ++@ stdcall -private DllGetClassObject(ptr ptr ptr) ++@ stdcall -private DllRegisterServer() ++@ stdcall -private DllUnregisterServer() +diff --git a/dlls/xactengine3_6/Makefile.in b/dlls/xactengine3_6/Makefile.in +new file mode 100644 +index 0000000000..d226331aaf +--- /dev/null ++++ b/dlls/xactengine3_6/Makefile.in +@@ -0,0 +1,12 @@ ++EXTRADEFS = -DXACT3_VER=0x0306 ++MODULE = xactengine3_6.dll ++IMPORTS = advapi32 ole32 user32 uuid ++PARENTSRC = ../xaudio2_7 ++EXTRALIBS = $(FAUDIO_LIBS) ++EXTRAINCL = $(FAUDIO_CFLAGS) ++ ++C_SRCS = \ ++ xact_dll.c \ ++ xaudio_allocator.c ++ ++IDL_SRCS = xact_classes.idl +diff --git a/dlls/xactengine3_6/xactengine3_6.spec b/dlls/xactengine3_6/xactengine3_6.spec +new file mode 100644 +index 0000000000..b16365d0c9 +--- /dev/null ++++ b/dlls/xactengine3_6/xactengine3_6.spec +@@ -0,0 +1,4 @@ ++@ stdcall -private DllCanUnloadNow() ++@ stdcall -private DllGetClassObject(ptr ptr ptr) ++@ stdcall -private DllRegisterServer() ++@ stdcall -private DllUnregisterServer() +diff --git a/dlls/xactengine3_7/Makefile.in b/dlls/xactengine3_7/Makefile.in +new file mode 100644 +index 0000000000..080bc8a13b +--- /dev/null ++++ b/dlls/xactengine3_7/Makefile.in +@@ -0,0 +1,12 @@ ++EXTRADEFS = -DXACT3_VER=0x0307 ++MODULE = xactengine3_7.dll ++IMPORTS = advapi32 ole32 user32 uuid ++PARENTSRC = ../xaudio2_7 ++EXTRALIBS = $(FAUDIO_LIBS) ++EXTRAINCL = $(FAUDIO_CFLAGS) ++ ++C_SRCS = \ ++ xact_dll.c \ ++ xaudio_allocator.c ++ ++IDL_SRCS = xact_classes.idl +diff --git a/dlls/xactengine3_7/xactengine3_7.spec b/dlls/xactengine3_7/xactengine3_7.spec +new file mode 100644 +index 0000000000..b16365d0c9 +--- /dev/null ++++ b/dlls/xactengine3_7/xactengine3_7.spec +@@ -0,0 +1,4 @@ ++@ stdcall -private DllCanUnloadNow() ++@ stdcall -private DllGetClassObject(ptr ptr ptr) ++@ stdcall -private DllRegisterServer() ++@ stdcall -private DllUnregisterServer() +diff --git a/dlls/xaudio2_7/Makefile.in b/dlls/xaudio2_7/Makefile.in +index 294f841b01..f27ce9f87e 100644 +--- a/dlls/xaudio2_7/Makefile.in ++++ b/dlls/xaudio2_7/Makefile.in +@@ -7,9 +7,12 @@ EXTRAINCL = $(FAUDIO_CFLAGS) + C_SRCS = \ + compat.c \ + x3daudio.c \ ++ xact_dll.c \ + xapo.c \ + xapofx.c \ + xaudio_allocator.c \ + xaudio_dll.c + +-IDL_SRCS = xaudio_classes.idl ++IDL_SRCS = \ ++ xact_classes.idl \ ++ xaudio_classes.idl +diff --git a/dlls/xaudio2_7/xact_classes.idl b/dlls/xaudio2_7/xact_classes.idl +new file mode 100644 +index 0000000000..89418dbe1a +--- /dev/null ++++ b/dlls/xaudio2_7/xact_classes.idl +@@ -0,0 +1,93 @@ ++/* ++ * COM Classes for xactengine ++ * ++ * Copyright 2018 Ethan Lee for CodeWeavers ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA ++ */ ++ ++#pragma makedep register ++ ++#if XACT3_VER == 0x0307 ++[ ++ helpstring("XACT3 Class"), ++ threading(both), ++ uuid(bcc782bc-6492-4c22-8c35-f5d72fe73c6e) ++] ++coclass XACTEngine37 { interface IXACT37Engine; } ++#endif /* XACT3_VER == 0x0307 */ ++ ++#if XACT3_VER == 0x0306 ++[ ++ helpstring("XACT3.6 Class"), ++ threading(both), ++ uuid(248d8a3b-6256-44d3-a018-2ac96c459f47) ++] ++coclass XACTEngine36 { interface IXACT37Engine; } ++#endif /* XACT3_VER == 0x0306 */ ++ ++#if XACT3_VER == 0x0305 ++[ ++ helpstring("XACT3.5 Class"), ++ threading(both), ++ uuid(074b110f-7f58-4743-aea5-12f15b5074ed) ++] ++coclass XACTEngine35 { interface IXACT37Engine; } ++#endif /* XACT3_VER == 0x0305 */ ++ ++#if XACT3_VER == 0x0304 ++[ ++ helpstring("XACT3.4 Class"), ++ threading(both), ++ uuid(0977d092-2d95-4e43-8d42-9ddcc2545ed5) ++] ++coclass XACTEngine34 { interface IXACT37Engine; } ++#endif /* XACT3_VER == 0x0304 */ ++ ++#if XACT3_VER == 0x0303 ++[ ++ helpstring("XACT3.3 Class"), ++ threading(both), ++ uuid(94c1affa-66e7-4961-9521-cfdef3128d4f) ++] ++coclass XACTEngine33 { interface IXACT37Engine; } ++#endif /* XACT3_VER == 0x0303 */ ++ ++#if XACT3_VER == 0x0302 ++[ ++ helpstring("XACT3.2 Class"), ++ threading(both), ++ uuid(d3332f02-3dd0-4de9-9aec-20d85c4111b6) ++] ++coclass XACTEngine32 { interface IXACT32Engine; } ++#endif /* XACT3_VER == 0x0302 */ ++ ++#if XACT3_VER == 0x0301 ++[ ++ helpstring("XACT3.1 Class"), ++ threading(both), ++ uuid(962f5027-99be-4692-a468-85802cf8de61) ++] ++coclass XACTEngine31 { interface IXACT32Engine; } ++#endif /* XACT3_VER == 0x0301 */ ++ ++#if XACT3_VER == 0x0300 ++[ ++ helpstring("XACT3.0 Class"), ++ threading(both), ++ uuid(3b80ee2a-b0f5-4780-9e30-90cb39685b03) ++] ++coclass XACTEngine30 { interface IXACT30Engine; } ++#endif /* XACT3_VER == 0x0300 */ +diff --git a/dlls/xaudio2_7/xact_dll.c b/dlls/xaudio2_7/xact_dll.c +new file mode 100644 +index 0000000000..07f866606d +--- /dev/null ++++ b/dlls/xaudio2_7/xact_dll.c +@@ -0,0 +1,1387 @@ ++/* ++ * Copyright (c) 2018 Ethan Lee for CodeWeavers ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA ++ */ ++#ifdef XACT3_VER ++ ++#include "config.h" ++ ++#include ++ ++#define NONAMELESSUNION ++#define COBJMACROS ++ ++#include "xaudio_private.h" ++ ++#include "initguid.h" ++#include "xact3.h" ++#include "xact_classes.h" ++ ++#include "rpcproxy.h" ++#include "wine/debug.h" ++ ++#include ++ ++WINE_DEFAULT_DEBUG_CHANNEL(xact3); ++ ++static HINSTANCE instance; ++ ++BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, void *pReserved) ++{ ++ TRACE("(%p, %d, %p)\n", hinstDLL, reason, pReserved); ++ ++ switch (reason) ++ { ++ case DLL_PROCESS_ATTACH: ++ instance = hinstDLL; ++ DisableThreadLibraryCalls( hinstDLL ); ++ break; ++ } ++ return TRUE; ++} ++ ++HRESULT WINAPI DllCanUnloadNow(void) ++{ ++ return S_FALSE; ++} ++ ++HRESULT WINAPI DllRegisterServer(void) ++{ ++ TRACE("\n"); ++ return __wine_register_resources(instance); ++} ++ ++HRESULT WINAPI DllUnregisterServer(void) ++{ ++ TRACE("\n"); ++ return __wine_unregister_resources(instance); ++} ++ ++typedef struct _XACT3CueImpl { ++ IXACT3Cue IXACT3Cue_iface; ++#if XACT3_VER <= 0x0304 ++ IXACT34Cue IXACT34Cue_iface; ++#endif ++ ++ FACTCue *fact_cue; ++} XACT3CueImpl; ++ ++typedef struct _XACT3WaveImpl { ++ IXACT3Wave IXACT3Wave_iface; ++ ++ FACTWave *fact_wave; ++} XACT3WaveImpl; ++ ++typedef struct _XACT3SoundBankImpl { ++ IXACT3SoundBank IXACT3SoundBank_iface; ++ ++ FACTSoundBank *fact_soundbank; ++} XACT3SoundBankImpl; ++ ++typedef struct _XACT3WaveBankImpl { ++ IXACT3WaveBank IXACT3WaveBank_iface; ++ ++ FACTWaveBank *fact_wavebank; ++} XACT3WaveBankImpl; ++ ++typedef struct _XACT3EngineImpl { ++ IXACT3Engine IXACT3Engine_iface; ++ ++ FACTAudioEngine *fact_engine; ++ ++ XACT_READFILE_CALLBACK pReadFile; ++ XACT_GETOVERLAPPEDRESULT_CALLBACK pGetOverlappedResult; ++} XACT3EngineImpl; ++ ++typedef struct wrap_readfile_struct { ++ XACT3EngineImpl *engine; ++ HANDLE file; ++} wrap_readfile_struct; ++ ++static int32_t FACTCALL wrap_readfile( ++ void* hFile, ++ void* lpBuffer, ++ uint32_t nNumberOfBytesRead, ++ uint32_t *lpNumberOfBytesRead, ++ FACTOverlapped *lpOverlapped ++) { ++ wrap_readfile_struct *wrap = (wrap_readfile_struct*) hFile; ++ return wrap->engine->pReadFile(wrap->file, lpBuffer, nNumberOfBytesRead, ++ lpNumberOfBytesRead, lpOverlapped); ++} ++ ++static int32_t FACTCALL wrap_getoverlappedresult( ++ void* hFile, ++ FACTOverlapped *lpOverlapped, ++ uint32_t *lpNumberOfBytesTransferred, ++ int32_t bWait ++) { ++ wrap_readfile_struct *wrap = (wrap_readfile_struct*) hFile; ++ return wrap->engine->pGetOverlappedResult(wrap->file, lpOverlapped, ++ lpNumberOfBytesTransferred, bWait); ++} ++ ++static inline XACT3CueImpl *impl_from_IXACT3Cue(IXACT3Cue *iface) ++{ ++ return CONTAINING_RECORD(iface, XACT3CueImpl, IXACT3Cue_iface); ++} ++ ++static HRESULT WINAPI IXACT3CueImpl_Play(IXACT3Cue *iface) ++{ ++ XACT3CueImpl *This = impl_from_IXACT3Cue(iface); ++ ++ TRACE("(%p)\n", iface); ++ ++ return FACTCue_Play(This->fact_cue); ++} ++ ++static HRESULT WINAPI IXACT3CueImpl_Stop(IXACT3Cue *iface, DWORD dwFlags) ++{ ++ XACT3CueImpl *This = impl_from_IXACT3Cue(iface); ++ ++ TRACE("(%p)->(%u)\n", iface, dwFlags); ++ ++ return FACTCue_Stop(This->fact_cue, dwFlags); ++} ++ ++static HRESULT WINAPI IXACT3CueImpl_GetState(IXACT3Cue *iface, DWORD *pdwState) ++{ ++ XACT3CueImpl *This = impl_from_IXACT3Cue(iface); ++ ++ TRACE("(%p)->(%p)\n", iface, pdwState); ++ ++ return FACTCue_GetState(This->fact_cue, pdwState); ++} ++ ++static HRESULT WINAPI IXACT3CueImpl_Destroy(IXACT3Cue *iface) ++{ ++ XACT3CueImpl *This = impl_from_IXACT3Cue(iface); ++ HRESULT hr; ++ ++ TRACE("(%p)\n", iface); ++ ++ hr = FACTCue_Destroy(This->fact_cue); ++ HeapFree(GetProcessHeap(), 0, This); ++ return hr; ++} ++ ++static HRESULT WINAPI IXACT3CueImpl_SetMatrixCoefficients(IXACT3Cue *iface, ++ UINT32 uSrcChannelCount, UINT32 uDstChannelCount, ++ float *pMatrixCoefficients) ++{ ++ XACT3CueImpl *This = impl_from_IXACT3Cue(iface); ++ ++ TRACE("(%p)->(%u, %u, %p)\n", iface, uSrcChannelCount, uDstChannelCount, ++ pMatrixCoefficients); ++ ++ return FACTCue_SetMatrixCoefficients(This->fact_cue, uSrcChannelCount, ++ uDstChannelCount, pMatrixCoefficients); ++} ++ ++static XACTVARIABLEINDEX WINAPI IXACT3CueImpl_GetVariableIndex(IXACT3Cue *iface, ++ PCSTR szFriendlyName) ++{ ++ XACT3CueImpl *This = impl_from_IXACT3Cue(iface); ++ ++ TRACE("(%p)->(%s)\n", iface, szFriendlyName); ++ ++ return FACTCue_GetVariableIndex(This->fact_cue, szFriendlyName); ++} ++ ++static HRESULT WINAPI IXACT3CueImpl_SetVariable(IXACT3Cue *iface, ++ XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue) ++{ ++ XACT3CueImpl *This = impl_from_IXACT3Cue(iface); ++ ++ TRACE("(%p)->(%u, %f)\n", iface, nIndex, nValue); ++ ++ return FACTCue_SetVariable(This->fact_cue, nIndex, nValue); ++} ++ ++static HRESULT WINAPI IXACT3CueImpl_GetVariable(IXACT3Cue *iface, ++ XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE *nValue) ++{ ++ XACT3CueImpl *This = impl_from_IXACT3Cue(iface); ++ ++ TRACE("(%p)->(%u, %p)\n", iface, nIndex, nValue); ++ ++ return FACTCue_GetVariable(This->fact_cue, nIndex, nValue); ++} ++ ++static HRESULT WINAPI IXACT3CueImpl_Pause(IXACT3Cue *iface, BOOL fPause) ++{ ++ XACT3CueImpl *This = impl_from_IXACT3Cue(iface); ++ ++ TRACE("(%p)->(%u)\n", iface, fPause); ++ ++ return FACTCue_Pause(This->fact_cue, fPause); ++} ++ ++static HRESULT WINAPI IXACT3CueImpl_GetProperties(IXACT3Cue *iface, ++ XACT_CUE_INSTANCE_PROPERTIES **ppProperties) ++{ ++ XACT3CueImpl *This = impl_from_IXACT3Cue(iface); ++ FACTCueInstanceProperties *fProps; ++ HRESULT hr; ++ ++ TRACE("(%p)->(%p)\n", iface, ppProperties); ++ ++ hr = FACTCue_GetProperties(This->fact_cue, &fProps); ++ if(FAILED(hr)) ++ return hr; ++ ++ *ppProperties = (XACT_CUE_INSTANCE_PROPERTIES*) fProps; ++ return hr; ++} ++ ++static HRESULT WINAPI IXACT3CueImpl_SetOutputVoices(IXACT3Cue *iface, ++ const XAUDIO2_VOICE_SENDS *pSendList) ++{ ++ XACT3CueImpl *This = impl_from_IXACT3Cue(iface); ++ FIXME("(%p): stub!\n", This); ++ return S_OK; ++} ++ ++static HRESULT WINAPI IXACT3CueImpl_SetOutputVoiceMatrix(IXACT3Cue *iface, ++ IXAudio2Voice *pDestinationVoice, UINT32 SourceChannels, ++ UINT32 DestinationChannels, const float *pLevelMatrix) ++{ ++ XACT3CueImpl *This = impl_from_IXACT3Cue(iface); ++ FIXME("(%p): stub!\n", This); ++ return S_OK; ++} ++ ++static const IXACT3CueVtbl XACT3Cue_Vtbl = ++{ ++ IXACT3CueImpl_Play, ++ IXACT3CueImpl_Stop, ++ IXACT3CueImpl_GetState, ++ IXACT3CueImpl_Destroy, ++ IXACT3CueImpl_SetMatrixCoefficients, ++ IXACT3CueImpl_GetVariableIndex, ++ IXACT3CueImpl_SetVariable, ++ IXACT3CueImpl_GetVariable, ++ IXACT3CueImpl_Pause, ++ IXACT3CueImpl_GetProperties, ++ IXACT3CueImpl_SetOutputVoices, ++ IXACT3CueImpl_SetOutputVoiceMatrix ++}; ++ ++#if XACT3_VER <= 0x0304 ++static inline XACT3CueImpl *impl_from_IXACT34Cue(IXACT34Cue *iface) ++{ ++ return CONTAINING_RECORD(iface, XACT3CueImpl, IXACT34Cue_iface); ++} ++ ++static HRESULT WINAPI IXACT34CueImpl_Play(IXACT34Cue *iface) ++{ ++ XACT3CueImpl *This = impl_from_IXACT34Cue(iface); ++ ++ TRACE("(%p)\n", iface); ++ ++ return FACTCue_Play(This->fact_cue); ++} ++ ++static HRESULT WINAPI IXACT34CueImpl_Stop(IXACT34Cue *iface, DWORD dwFlags) ++{ ++ XACT3CueImpl *This = impl_from_IXACT34Cue(iface); ++ ++ TRACE("(%p)->(%u)\n", iface, dwFlags); ++ ++ return FACTCue_Stop(This->fact_cue, dwFlags); ++} ++ ++static HRESULT WINAPI IXACT34CueImpl_GetState(IXACT34Cue *iface, DWORD *pdwState) ++{ ++ XACT3CueImpl *This = impl_from_IXACT34Cue(iface); ++ ++ TRACE("(%p)->(%p)\n", iface, pdwState); ++ ++ return FACTCue_GetState(This->fact_cue, pdwState); ++} ++ ++static HRESULT WINAPI IXACT34CueImpl_Destroy(IXACT34Cue *iface) ++{ ++ XACT3CueImpl *This = impl_from_IXACT34Cue(iface); ++ HRESULT hr; ++ ++ TRACE("(%p)\n", iface); ++ ++ hr = FACTCue_Destroy(This->fact_cue); ++ HeapFree(GetProcessHeap(), 0, This); ++ return hr; ++} ++ ++static HRESULT WINAPI IXACT34CueImpl_SetMatrixCoefficients(IXACT34Cue *iface, ++ UINT32 uSrcChannelCount, UINT32 uDstChannelCount, ++ float *pMatrixCoefficients) ++{ ++ XACT3CueImpl *This = impl_from_IXACT34Cue(iface); ++ ++ TRACE("(%p)->(%u, %u, %p)\n", iface, uSrcChannelCount, uDstChannelCount, ++ pMatrixCoefficients); ++ ++ return FACTCue_SetMatrixCoefficients(This->fact_cue, uSrcChannelCount, ++ uDstChannelCount, pMatrixCoefficients); ++} ++ ++static XACTVARIABLEINDEX WINAPI IXACT34CueImpl_GetVariableIndex(IXACT34Cue *iface, ++ PCSTR szFriendlyName) ++{ ++ XACT3CueImpl *This = impl_from_IXACT34Cue(iface); ++ ++ TRACE("(%p)->(%s)\n", iface, szFriendlyName); ++ ++ return FACTCue_GetVariableIndex(This->fact_cue, szFriendlyName); ++} ++ ++static HRESULT WINAPI IXACT34CueImpl_SetVariable(IXACT34Cue *iface, ++ XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue) ++{ ++ XACT3CueImpl *This = impl_from_IXACT34Cue(iface); ++ ++ TRACE("(%p)->(%u, %f)\n", iface, nIndex, nValue); ++ ++ return FACTCue_SetVariable(This->fact_cue, nIndex, nValue); ++} ++ ++static HRESULT WINAPI IXACT34CueImpl_GetVariable(IXACT34Cue *iface, ++ XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE *nValue) ++{ ++ XACT3CueImpl *This = impl_from_IXACT34Cue(iface); ++ ++ TRACE("(%p)->(%u, %p)\n", iface, nIndex, nValue); ++ ++ return FACTCue_GetVariable(This->fact_cue, nIndex, nValue); ++} ++ ++static HRESULT WINAPI IXACT34CueImpl_Pause(IXACT34Cue *iface, BOOL fPause) ++{ ++ XACT3CueImpl *This = impl_from_IXACT34Cue(iface); ++ ++ TRACE("(%p)->(%u)\n", iface, fPause); ++ ++ return FACTCue_Pause(This->fact_cue, fPause); ++} ++ ++static HRESULT WINAPI IXACT34CueImpl_GetProperties(IXACT34Cue *iface, ++ XACT_CUE_INSTANCE_PROPERTIES **ppProperties) ++{ ++ XACT3CueImpl *This = impl_from_IXACT34Cue(iface); ++ FACTCueInstanceProperties *fProps; ++ HRESULT hr; ++ ++ TRACE("(%p)->(%p)\n", iface, ppProperties); ++ ++ hr = FACTCue_GetProperties(This->fact_cue, &fProps); ++ if(FAILED(hr)) ++ return hr; ++ ++ *ppProperties = (XACT_CUE_INSTANCE_PROPERTIES*) fProps; ++ return hr; ++} ++ ++static const IXACT34CueVtbl XACT34Cue_Vtbl = ++{ ++ IXACT34CueImpl_Play, ++ IXACT34CueImpl_Stop, ++ IXACT34CueImpl_GetState, ++ IXACT34CueImpl_Destroy, ++ IXACT34CueImpl_SetMatrixCoefficients, ++ IXACT34CueImpl_GetVariableIndex, ++ IXACT34CueImpl_SetVariable, ++ IXACT34CueImpl_GetVariable, ++ IXACT34CueImpl_Pause, ++ IXACT34CueImpl_GetProperties ++}; ++#endif ++ ++static inline XACT3WaveImpl *impl_from_IXACT3Wave(IXACT3Wave *iface) ++{ ++ return CONTAINING_RECORD(iface, XACT3WaveImpl, IXACT3Wave_iface); ++} ++ ++static HRESULT WINAPI IXACT3WaveImpl_Destroy(IXACT3Wave *iface) ++{ ++ XACT3WaveImpl *This = impl_from_IXACT3Wave(iface); ++ HRESULT hr; ++ ++ TRACE("(%p)\n", This); ++ ++ hr = FACTWave_Destroy(This->fact_wave); ++ HeapFree(GetProcessHeap(), 0, This); ++ return hr; ++} ++ ++static HRESULT WINAPI IXACT3WaveImpl_Play(IXACT3Wave *iface) ++{ ++ XACT3WaveImpl *This = impl_from_IXACT3Wave(iface); ++ ++ TRACE("(%p)\n", This); ++ ++ return FACTWave_Play(This->fact_wave); ++} ++ ++static HRESULT WINAPI IXACT3WaveImpl_Stop(IXACT3Wave *iface, DWORD dwFlags) ++{ ++ XACT3WaveImpl *This = impl_from_IXACT3Wave(iface); ++ ++ TRACE("(%p)->(0x%x)\n", This, dwFlags); ++ ++ return FACTWave_Stop(This->fact_wave, dwFlags); ++} ++ ++static HRESULT WINAPI IXACT3WaveImpl_Pause(IXACT3Wave *iface, BOOL fPause) ++{ ++ XACT3WaveImpl *This = impl_from_IXACT3Wave(iface); ++ ++ TRACE("(%p)->(%u)\n", This, fPause); ++ ++ return FACTWave_Pause(This->fact_wave, fPause); ++} ++ ++static HRESULT WINAPI IXACT3WaveImpl_GetState(IXACT3Wave *iface, DWORD *pdwState) ++{ ++ XACT3WaveImpl *This = impl_from_IXACT3Wave(iface); ++ ++ TRACE("(%p)->(%p)\n", This, pdwState); ++ ++ return FACTWave_GetState(This->fact_wave, pdwState); ++} ++ ++static HRESULT WINAPI IXACT3WaveImpl_SetPitch(IXACT3Wave *iface, XACTPITCH pitch) ++{ ++ XACT3WaveImpl *This = impl_from_IXACT3Wave(iface); ++ ++ TRACE("(%p)->(%d)\n", This, pitch); ++ ++ return FACTWave_SetPitch(This->fact_wave, pitch); ++} ++ ++static HRESULT WINAPI IXACT3WaveImpl_SetVolume(IXACT3Wave *iface, XACTVOLUME volume) ++{ ++ XACT3WaveImpl *This = impl_from_IXACT3Wave(iface); ++ ++ TRACE("(%p)->(%f)\n", This, volume); ++ ++ return FACTWave_SetVolume(This->fact_wave, volume); ++} ++ ++static HRESULT WINAPI IXACT3WaveImpl_SetMatrixCoefficients(IXACT3Wave *iface, ++ UINT32 uSrcChannelCount, UINT32 uDstChannelCount, ++ float *pMatrixCoefficients) ++{ ++ XACT3WaveImpl *This = impl_from_IXACT3Wave(iface); ++ ++ TRACE("(%p)->(%u, %u, %p)\n", This, uSrcChannelCount, uDstChannelCount, ++ pMatrixCoefficients); ++ ++ return FACTWave_SetMatrixCoefficients(This->fact_wave, uSrcChannelCount, ++ uDstChannelCount, pMatrixCoefficients); ++} ++ ++static HRESULT WINAPI IXACT3WaveImpl_GetProperties(IXACT3Wave *iface, ++ XACT_WAVE_INSTANCE_PROPERTIES *pProperties) ++{ ++ XACT3WaveImpl *This = impl_from_IXACT3Wave(iface); ++ ++ TRACE("(%p)->(%p)\n", This, pProperties); ++ ++ return FACTWave_GetProperties(This->fact_wave, ++ (FACTWaveInstanceProperties*) pProperties); ++} ++ ++static const IXACT3WaveVtbl XACT3Wave_Vtbl = ++{ ++ IXACT3WaveImpl_Destroy, ++ IXACT3WaveImpl_Play, ++ IXACT3WaveImpl_Stop, ++ IXACT3WaveImpl_Pause, ++ IXACT3WaveImpl_GetState, ++ IXACT3WaveImpl_SetPitch, ++ IXACT3WaveImpl_SetVolume, ++ IXACT3WaveImpl_SetMatrixCoefficients, ++ IXACT3WaveImpl_GetProperties ++}; ++ ++static inline XACT3SoundBankImpl *impl_from_IXACT3SoundBank(IXACT3SoundBank *iface) ++{ ++ return CONTAINING_RECORD(iface, XACT3SoundBankImpl, IXACT3SoundBank_iface); ++} ++ ++static XACTINDEX WINAPI IXACT3SoundBankImpl_GetCueIndex(IXACT3SoundBank *iface, ++ PCSTR szFriendlyName) ++{ ++ XACT3SoundBankImpl *This = impl_from_IXACT3SoundBank(iface); ++ ++ TRACE("(%p)->(%s)\n", This, szFriendlyName); ++ ++ return FACTSoundBank_GetCueIndex(This->fact_soundbank, szFriendlyName); ++} ++ ++static HRESULT WINAPI IXACT3SoundBankImpl_GetNumCues(IXACT3SoundBank *iface, ++ XACTINDEX *pnNumCues) ++{ ++ XACT3SoundBankImpl *This = impl_from_IXACT3SoundBank(iface); ++ ++ TRACE("(%p)->(%p)\n", This, pnNumCues); ++ ++ return FACTSoundBank_GetNumCues(This->fact_soundbank, pnNumCues); ++} ++ ++static HRESULT WINAPI IXACT3SoundBankImpl_GetCueProperties(IXACT3SoundBank *iface, ++ XACTINDEX nCueIndex, XACT_CUE_PROPERTIES *pProperties) ++{ ++ XACT3SoundBankImpl *This = impl_from_IXACT3SoundBank(iface); ++ ++ TRACE("(%p)->(%u, %p)\n", This, nCueIndex, pProperties); ++ ++ return FACTSoundBank_GetCueProperties(This->fact_soundbank, nCueIndex, ++ (FACTCueProperties*) pProperties); ++} ++ ++static HRESULT WINAPI IXACT3SoundBankImpl_Prepare(IXACT3SoundBank *iface, ++ XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, ++ IXACT3Cue** ppCue) ++{ ++ XACT3SoundBankImpl *This = impl_from_IXACT3SoundBank(iface); ++ XACT3CueImpl *cue; ++ FACTCue *fcue; ++ HRESULT hr; ++ ++ TRACE("(%p)->(%u, 0x%x, %u, %p)\n", This, nCueIndex, dwFlags, timeOffset, ++ ppCue); ++ ++ hr = FACTSoundBank_Prepare(This->fact_soundbank, nCueIndex, dwFlags, ++ timeOffset, &fcue); ++ if(FAILED(hr)) ++ return hr; ++ ++ cue = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cue)); ++ if (!cue){ ++ FACTCue_Destroy(fcue); ++ ERR("Failed to allocate XACT3CueImpl!"); ++ return hr; ++ } ++ ++ cue->IXACT3Cue_iface.lpVtbl = &XACT3Cue_Vtbl; ++#if XACT3_VER <= 0x0304 ++ cue->IXACT34Cue_iface.lpVtbl = &XACT34Cue_Vtbl; ++#endif ++ cue->fact_cue = fcue; ++#if XACT3_VER <= 0x0304 ++ *ppCue = (IXACT3Cue*)&cue->IXACT34Cue_iface; ++#else ++ *ppCue = (IXACT3Cue*)&cue->IXACT3Cue_iface; ++#endif ++ ++ TRACE("Created Cue: %p\n", cue); ++ ++ return hr; ++} ++ ++static HRESULT WINAPI IXACT3SoundBankImpl_Play(IXACT3SoundBank *iface, ++ XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, ++ IXACT3Cue** ppCue) ++{ ++ XACT3SoundBankImpl *This = impl_from_IXACT3SoundBank(iface); ++ XACT3CueImpl *cue; ++ FACTCue *fcue; ++ HRESULT hr; ++ ++ TRACE("(%p)->(%u, 0x%x, %u, %p)\n", This, nCueIndex, dwFlags, timeOffset, ++ ppCue); ++ ++ /* If the application doesn't want a handle, don't generate one at all. ++ * Let the engine handle that memory instead. ++ * -flibit ++ */ ++ if (ppCue == NULL){ ++ hr = FACTSoundBank_Play(This->fact_soundbank, nCueIndex, dwFlags, ++ timeOffset, NULL); ++ }else{ ++ hr = FACTSoundBank_Play(This->fact_soundbank, nCueIndex, dwFlags, ++ timeOffset, &fcue); ++ if(FAILED(hr)) ++ return hr; ++ ++ cue = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cue)); ++ if (!cue){ ++ FACTCue_Destroy(fcue); ++ ERR("Failed to allocate XACT3CueImpl!"); ++ return hr; ++ } ++ ++ cue->IXACT3Cue_iface.lpVtbl = &XACT3Cue_Vtbl; ++#if XACT3_VER <= 0x0304 ++ cue->IXACT34Cue_iface.lpVtbl = &XACT34Cue_Vtbl; ++#endif ++ cue->fact_cue = fcue; ++#if XACT3_VER <= 0x0304 ++ *ppCue = (IXACT3Cue*)&cue->IXACT34Cue_iface; ++#else ++ *ppCue = (IXACT3Cue*)&cue->IXACT3Cue_iface; ++#endif ++ cue->fact_cue = fcue; ++ *ppCue = (IXACT3Cue*)cue; ++ } ++ ++ return hr; ++} ++ ++static HRESULT WINAPI IXACT3SoundBankImpl_Stop(IXACT3SoundBank *iface, ++ XACTINDEX nCueIndex, DWORD dwFlags) ++{ ++ XACT3SoundBankImpl *This = impl_from_IXACT3SoundBank(iface); ++ ++ TRACE("(%p)->(%u)\n", This, dwFlags); ++ ++ return FACTSoundBank_Stop(This->fact_soundbank, nCueIndex, dwFlags); ++} ++ ++static HRESULT WINAPI IXACT3SoundBankImpl_Destroy(IXACT3SoundBank *iface) ++{ ++ XACT3SoundBankImpl *This = impl_from_IXACT3SoundBank(iface); ++ HRESULT hr; ++ ++ TRACE("(%p)\n", This); ++ ++ hr = FACTSoundBank_Destroy(This->fact_soundbank); ++ HeapFree(GetProcessHeap(), 0, This); ++ return hr; ++} ++ ++static HRESULT WINAPI IXACT3SoundBankImpl_GetState(IXACT3SoundBank *iface, ++ DWORD *pdwState) ++{ ++ XACT3SoundBankImpl *This = impl_from_IXACT3SoundBank(iface); ++ ++ TRACE("(%p)->(%p)\n", This, pdwState); ++ ++ return FACTSoundBank_GetState(This->fact_soundbank, pdwState); ++} ++ ++static const IXACT3SoundBankVtbl XACT3SoundBank_Vtbl = ++{ ++ IXACT3SoundBankImpl_GetCueIndex, ++ IXACT3SoundBankImpl_GetNumCues, ++ IXACT3SoundBankImpl_GetCueProperties, ++ IXACT3SoundBankImpl_Prepare, ++ IXACT3SoundBankImpl_Play, ++ IXACT3SoundBankImpl_Stop, ++ IXACT3SoundBankImpl_Destroy, ++ IXACT3SoundBankImpl_GetState ++}; ++ ++static inline XACT3WaveBankImpl *impl_from_IXACT3WaveBank(IXACT3WaveBank *iface) ++{ ++ return CONTAINING_RECORD(iface, XACT3WaveBankImpl, IXACT3WaveBank_iface); ++} ++ ++static HRESULT WINAPI IXACT3WaveBankImpl_Destroy(IXACT3WaveBank *iface) ++{ ++ XACT3WaveBankImpl *This = impl_from_IXACT3WaveBank(iface); ++ HRESULT hr; ++ ++ TRACE("(%p)\n", This); ++ ++ hr = FACTWaveBank_Destroy(This->fact_wavebank); ++ HeapFree(GetProcessHeap(), 0, This); ++ return hr; ++} ++ ++static HRESULT WINAPI IXACT3WaveBankImpl_GetNumWaves(IXACT3WaveBank *iface, ++ XACTINDEX *pnNumWaves) ++{ ++ XACT3WaveBankImpl *This = impl_from_IXACT3WaveBank(iface); ++ ++ TRACE("(%p)->(%p)\n", This, pnNumWaves); ++ ++ return FACTWaveBank_GetNumWaves(This->fact_wavebank, pnNumWaves); ++} ++ ++static XACTINDEX WINAPI IXACT3WaveBankImpl_GetWaveIndex(IXACT3WaveBank *iface, ++ PCSTR szFriendlyName) ++{ ++ XACT3WaveBankImpl *This = impl_from_IXACT3WaveBank(iface); ++ ++ TRACE("(%p)->(%s)\n", This, szFriendlyName); ++ ++ return FACTWaveBank_GetWaveIndex(This->fact_wavebank, szFriendlyName); ++} ++ ++static HRESULT WINAPI IXACT3WaveBankImpl_GetWaveProperties(IXACT3WaveBank *iface, ++ XACTINDEX nWaveIndex, XACT_WAVE_PROPERTIES *pWaveProperties) ++{ ++ XACT3WaveBankImpl *This = impl_from_IXACT3WaveBank(iface); ++ ++ TRACE("(%p)->(%u, %p)\n", This, nWaveIndex, pWaveProperties); ++ ++ return FACTWaveBank_GetWaveProperties(This->fact_wavebank, nWaveIndex, ++ (FACTWaveProperties*) pWaveProperties); ++} ++ ++static HRESULT WINAPI IXACT3WaveBankImpl_Prepare(IXACT3WaveBank *iface, ++ XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, ++ XACTLOOPCOUNT nLoopCount, IXACT3Wave** ppWave) ++{ ++ XACT3WaveBankImpl *This = impl_from_IXACT3WaveBank(iface); ++ XACT3WaveImpl *wave; ++ FACTWave *fwave; ++ HRESULT hr; ++ ++ TRACE("(%p)->(0x%x, %u, 0x%x, %u, %p)\n", This, nWaveIndex, dwFlags, ++ dwPlayOffset, nLoopCount, ppWave); ++ ++ hr = FACTWaveBank_Prepare(This->fact_wavebank, nWaveIndex, dwFlags, ++ dwPlayOffset, nLoopCount, &fwave); ++ if(FAILED(hr)) ++ return hr; ++ ++ wave = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*wave)); ++ if (!wave){ ++ FACTWave_Destroy(fwave); ++ ERR("Failed to allocate XACT3WaveImpl!"); ++ return hr; ++ } ++ ++ wave->IXACT3Wave_iface.lpVtbl = &XACT3Wave_Vtbl; ++ wave->fact_wave = fwave; ++ *ppWave = (IXACT3Wave*)wave; ++ ++ TRACE("Created Wave: %p\n", wave); ++ ++ return hr; ++} ++ ++static HRESULT WINAPI IXACT3WaveBankImpl_Play(IXACT3WaveBank *iface, ++ XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, ++ XACTLOOPCOUNT nLoopCount, IXACT3Wave** ppWave) ++{ ++ XACT3WaveBankImpl *This = impl_from_IXACT3WaveBank(iface); ++ XACT3WaveImpl *wave; ++ FACTWave *fwave; ++ HRESULT hr; ++ ++ TRACE("(%p)->(0x%x, %u, 0x%x, %u, %p)\n", This, nWaveIndex, dwFlags, dwPlayOffset, ++ nLoopCount, ppWave); ++ ++ /* If the application doesn't want a handle, don't generate one at all. ++ * Let the engine handle that memory instead. ++ * -flibit ++ */ ++ if (ppWave == NULL){ ++ hr = FACTWaveBank_Play(This->fact_wavebank, nWaveIndex, dwFlags, ++ dwPlayOffset, nLoopCount, NULL); ++ }else{ ++ hr = FACTWaveBank_Play(This->fact_wavebank, nWaveIndex, dwFlags, ++ dwPlayOffset, nLoopCount, &fwave); ++ if(FAILED(hr)) ++ return hr; ++ ++ wave = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*wave)); ++ if (!wave){ ++ FACTWave_Destroy(fwave); ++ ERR("Failed to allocate XACT3WaveImpl!"); ++ return hr; ++ } ++ ++ wave->IXACT3Wave_iface.lpVtbl = &XACT3Wave_Vtbl; ++ wave->fact_wave = fwave; ++ *ppWave = (IXACT3Wave*)wave; ++ } ++ ++ return hr; ++} ++ ++static HRESULT WINAPI IXACT3WaveBankImpl_Stop(IXACT3WaveBank *iface, ++ XACTINDEX nWaveIndex, DWORD dwFlags) ++{ ++ XACT3WaveBankImpl *This = impl_from_IXACT3WaveBank(iface); ++ ++ TRACE("(%p)->(%u, %u)\n", This, nWaveIndex, dwFlags); ++ ++ return FACTWaveBank_Stop(This->fact_wavebank, nWaveIndex, dwFlags); ++} ++ ++static HRESULT WINAPI IXACT3WaveBankImpl_GetState(IXACT3WaveBank *iface, ++ DWORD *pdwState) ++{ ++ XACT3WaveBankImpl *This = impl_from_IXACT3WaveBank(iface); ++ ++ TRACE("(%p)->(%p)\n", This, pdwState); ++ ++ return FACTWaveBank_GetState(This->fact_wavebank, pdwState); ++} ++ ++static const IXACT3WaveBankVtbl XACT3WaveBank_Vtbl = ++{ ++ IXACT3WaveBankImpl_Destroy, ++ IXACT3WaveBankImpl_GetNumWaves, ++ IXACT3WaveBankImpl_GetWaveIndex, ++ IXACT3WaveBankImpl_GetWaveProperties, ++ IXACT3WaveBankImpl_Prepare, ++ IXACT3WaveBankImpl_Play, ++ IXACT3WaveBankImpl_Stop, ++ IXACT3WaveBankImpl_GetState ++}; ++ ++static inline XACT3EngineImpl *impl_from_IXACT3Engine(IXACT3Engine *iface) ++{ ++ return CONTAINING_RECORD(iface, XACT3EngineImpl, IXACT3Engine_iface); ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_QueryInterface(IXACT3Engine *iface, ++ REFIID riid, void **ppvObject) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ ++ TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObject); ++ ++ if(IsEqualGUID(riid, &IID_IUnknown) || ++ IsEqualGUID(riid, &IID_IXACT3Engine)){ ++ *ppvObject = &This->IXACT3Engine_iface; ++ } ++ else ++ *ppvObject = NULL; ++ ++ if (*ppvObject){ ++ IUnknown_AddRef((IUnknown*)*ppvObject); ++ return S_OK; ++ } ++ ++ FIXME("(%p)->(%s,%p), not found\n", This, debugstr_guid(riid), ppvObject); ++ ++ return E_NOINTERFACE; ++} ++ ++static ULONG WINAPI IXACT3EngineImpl_AddRef(IXACT3Engine *iface) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ ULONG ref = FACTAudioEngine_AddRef(This->fact_engine); ++ TRACE("(%p)->(): Refcount now %u\n", This, ref); ++ return ref; ++} ++ ++static ULONG WINAPI IXACT3EngineImpl_Release(IXACT3Engine *iface) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ ULONG ref = FACTAudioEngine_Release(This->fact_engine); ++ ++ TRACE("(%p)->(): Refcount now %u\n", This, ref); ++ ++ if (!ref) ++ HeapFree(GetProcessHeap(), 0, This); ++ return ref; ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_GetRendererCount(IXACT3Engine *iface, ++ XACTINDEX *pnRendererCount) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ ++ TRACE("(%p)->(%p)\n", This, pnRendererCount); ++ ++ return FACTAudioEngine_GetRendererCount(This->fact_engine, pnRendererCount); ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_GetRendererDetails(IXACT3Engine *iface, ++ XACTINDEX nRendererIndex, XACT_RENDERER_DETAILS *pRendererDetails) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ ++ TRACE("(%p)->(%d, %p)\n", This, nRendererIndex, pRendererDetails); ++ ++ return FACTAudioEngine_GetRendererDetails(This->fact_engine, ++ nRendererIndex, (FACTRendererDetails*) pRendererDetails); ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_GetFinalMixFormat(IXACT3Engine *iface, ++ WAVEFORMATEXTENSIBLE *pFinalMixFormat) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ ++ TRACE("(%p)->(%p)\n", This, pFinalMixFormat); ++ ++ return FACTAudioEngine_GetFinalMixFormat(This->fact_engine, ++ (FAudioWaveFormatExtensible*) pFinalMixFormat); ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_Initialize(IXACT3Engine *iface, ++ const XACT_RUNTIME_PARAMETERS *pParams) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ FACTRuntimeParameters params; ++ ++ TRACE("(%p)->(%p)\n", This, pParams); ++ ++ memcpy(¶ms, pParams, sizeof(FACTRuntimeParameters)); ++ ++ /* FIXME: pXAudio2 and pMasteringVoice are pointers to ++ * IXAudio2/IXAudio2MasteringVoice objects. FACT wants pointers to ++ * FAudio/FAudioMasteringVoice objects. In Wine's XAudio2 implementation, we ++ * actually have them available, but only if you access their internal data. ++ * For now we can just force these pointers to NULL, as XACT simply ++ * generates its own engine and endpoint in that situation. These parameters ++ * are mostly an optimization for games with multiple XACT3Engines that want ++ * a single engine running everything. ++ * -flibit ++ */ ++ if (pParams->pXAudio2 != NULL){ ++ FIXME("pXAudio2 parameter not supported! Falling back to NULL"); ++ params.pXAudio2 = NULL; ++ ++ if (pParams->pMasteringVoice != NULL){ ++ FIXME("pXAudio2 parameter not supported! Falling back to NULL"); ++ params.pMasteringVoice = NULL; ++ } ++ } ++ ++ /* Force Windows I/O, do NOT use the FACT default! */ ++ This->pReadFile = (XACT_READFILE_CALLBACK) ++ pParams->fileIOCallbacks.readFileCallback; ++ This->pGetOverlappedResult = (XACT_GETOVERLAPPEDRESULT_CALLBACK) ++ pParams->fileIOCallbacks.getOverlappedResultCallback; ++ if (This->pReadFile == NULL) ++ This->pReadFile = (XACT_READFILE_CALLBACK) ReadFile; ++ if (This->pGetOverlappedResult == NULL) ++ This->pGetOverlappedResult = (XACT_GETOVERLAPPEDRESULT_CALLBACK) ++ GetOverlappedResult; ++ params.fileIOCallbacks.readFileCallback = wrap_readfile; ++ params.fileIOCallbacks.getOverlappedResultCallback = wrap_getoverlappedresult; ++ ++ return FACTAudioEngine_Initialize(This->fact_engine, ¶ms); ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_ShutDown(IXACT3Engine *iface) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ ++ TRACE("(%p)\n", This); ++ ++ return FACTAudioEngine_ShutDown(This->fact_engine); ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_DoWork(IXACT3Engine *iface) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ ++ TRACE("(%p)\n", This); ++ ++ return FACTAudioEngine_DoWork(This->fact_engine); ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_CreateSoundBank(IXACT3Engine *iface, ++ const void* pvBuffer, DWORD dwSize, DWORD dwFlags, ++ DWORD dwAllocAttributes, IXACT3SoundBank **ppSoundBank) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ XACT3SoundBankImpl *sb; ++ FACTSoundBank *fsb; ++ HRESULT hr; ++ ++ TRACE("(%p)->(%p, %u, 0x%x, 0x%x, %p)\n", This, pvBuffer, dwSize, dwFlags, ++ dwAllocAttributes, ppSoundBank); ++ ++ hr = FACTAudioEngine_CreateSoundBank(This->fact_engine, pvBuffer, dwSize, ++ dwFlags, dwAllocAttributes, &fsb); ++ if(FAILED(hr)) ++ return hr; ++ ++ sb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*sb)); ++ if (!sb){ ++ FACTSoundBank_Destroy(fsb); ++ ERR("Failed to allocate XACT3SoundBankImpl!"); ++ return hr; ++ } ++ ++ sb->IXACT3SoundBank_iface.lpVtbl = &XACT3SoundBank_Vtbl; ++ sb->fact_soundbank = fsb; ++ *ppSoundBank = (IXACT3SoundBank*)sb; ++ ++ TRACE("Created SoundBank: %p\n", sb); ++ ++ return hr; ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_CreateInMemoryWaveBank(IXACT3Engine *iface, ++ const void* pvBuffer, DWORD dwSize, DWORD dwFlags, ++ DWORD dwAllocAttributes, IXACT3WaveBank **ppWaveBank) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ XACT3WaveBankImpl *wb; ++ FACTWaveBank *fwb; ++ HRESULT hr; ++ ++ TRACE("(%p)->(%p, %u, 0x%x, 0x%x, %p)\n", This, pvBuffer, dwSize, dwFlags, ++ dwAllocAttributes, ppWaveBank); ++ ++ hr = FACTAudioEngine_CreateInMemoryWaveBank(This->fact_engine, pvBuffer, ++ dwSize, dwFlags, dwAllocAttributes, &fwb); ++ if(FAILED(hr)) ++ return hr; ++ ++ wb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*wb)); ++ if (!wb){ ++ FACTWaveBank_Destroy(fwb); ++ ERR("Failed to allocate XACT3WaveBankImpl!"); ++ return hr; ++ } ++ ++ wb->IXACT3WaveBank_iface.lpVtbl = &XACT3WaveBank_Vtbl; ++ wb->fact_wavebank = fwb; ++ *ppWaveBank = (IXACT3WaveBank*)wb; ++ ++ TRACE("Created in-memory WaveBank: %p\n", wb); ++ ++ return hr; ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_CreateStreamingWaveBank(IXACT3Engine *iface, ++ const XACT_STREAMING_PARAMETERS *pParms, ++ IXACT3WaveBank **ppWaveBank) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ FACTStreamingParameters fakeParms; ++ wrap_readfile_struct *fake; ++ XACT3WaveBankImpl *wb; ++ FACTWaveBank *fwb; ++ HRESULT hr; ++ ++ TRACE("(%p)->(%p, %p)\n", This, pParms, ppWaveBank); ++ ++ /* We have to wrap the file to fix up the callbacks! */ ++ fake = (wrap_readfile_struct*) CoTaskMemAlloc( ++ sizeof(wrap_readfile_struct)); ++ fake->engine = This; ++ fake->file = pParms->file; ++ fakeParms.file = fake; ++ fakeParms.flags = pParms->flags; ++ fakeParms.offset = pParms->offset; ++ fakeParms.packetSize = pParms->packetSize; ++ ++ hr = FACTAudioEngine_CreateStreamingWaveBank(This->fact_engine, &fakeParms, ++ &fwb); ++ if(FAILED(hr)) ++ return hr; ++ ++ wb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*wb)); ++ if (!wb){ ++ FACTWaveBank_Destroy(fwb); ++ ERR("Failed to allocate XACT3WaveBankImpl!"); ++ return hr; ++ } ++ ++ wb->IXACT3WaveBank_iface.lpVtbl = &XACT3WaveBank_Vtbl; ++ wb->fact_wavebank = fwb; ++ *ppWaveBank = (IXACT3WaveBank*)wb; ++ ++ TRACE("Created streaming WaveBank: %p\n", wb); ++ ++ return hr; ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_PrepareWave(IXACT3Engine *iface, ++ DWORD dwFlags, PCSTR szWavePath, WORD wStreamingPacketSize, ++ DWORD dwAlignment, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, ++ IXACT3Wave **ppWave) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ FIXME("(%p): stub!\n", This); ++ return S_OK; ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_PrepareInMemoryWave(IXACT3Engine *iface, ++ DWORD dwFlags, WAVEBANKENTRY entry, DWORD *pdwSeekTable, ++ BYTE *pbWaveData, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, ++ IXACT3Wave **ppWave) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ FIXME("(%p): stub!\n", This); ++ return S_OK; ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_PrepareStreamingWave(IXACT3Engine *iface, ++ DWORD dwFlags, WAVEBANKENTRY entry, ++ XACT_STREAMING_PARAMETERS streamingParams, DWORD dwAlignment, ++ DWORD *pdwSeekTable, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, ++ IXACT3Wave **ppWave) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ FIXME("(%p): stub!\n", This); ++ return S_OK; ++} ++ ++static inline void unwrap_notificationdesc(FACTNotificationDescription *fd, ++ const XACT_NOTIFICATION_DESCRIPTION *xd) ++{ ++ /* We have to unwrap the FACT object first! */ ++ fd->type = xd->type; ++ fd->flags = xd->flags; ++ fd->cueIndex = xd->cueIndex; ++ fd->waveIndex = xd->waveIndex; ++ fd->pvContext = xd->pvContext; ++ ++ if (xd->pCue != NULL) ++ fd->pCue = ((XACT3CueImpl*) xd->pCue)->fact_cue; ++ else ++ fd->pCue = NULL; ++ ++ if (xd->pSoundBank != NULL) ++ fd->pSoundBank = ((XACT3SoundBankImpl*) xd->pSoundBank)->fact_soundbank; ++ else ++ fd->pSoundBank = NULL; ++ ++ if (xd->pWaveBank != NULL) ++ fd->pWaveBank = ((XACT3WaveBankImpl*) xd->pWaveBank)->fact_wavebank; ++ else ++ fd->pWaveBank = NULL; ++ ++ if (xd->pWave != NULL) ++ fd->pWave = ((XACT3WaveImpl*) xd->pWave)->fact_wave; ++ else ++ fd->pWave = NULL; ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_RegisterNotification(IXACT3Engine *iface, ++ const XACT_NOTIFICATION_DESCRIPTION *pNotificationDesc) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ FACTNotificationDescription fdesc; ++ ++ TRACE("(%p)->(%p)\n", This, pNotificationDesc); ++ ++ unwrap_notificationdesc(&fdesc, pNotificationDesc); ++ return FACTAudioEngine_RegisterNotification(This->fact_engine, &fdesc); ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_UnRegisterNotification(IXACT3Engine *iface, ++ const XACT_NOTIFICATION_DESCRIPTION *pNotificationDesc) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ FACTNotificationDescription fdesc; ++ ++ TRACE("(%p)->(%p)\n", This, pNotificationDesc); ++ ++ unwrap_notificationdesc(&fdesc, pNotificationDesc); ++ return FACTAudioEngine_UnRegisterNotification(This->fact_engine, &fdesc); ++} ++ ++static XACTCATEGORY WINAPI IXACT3EngineImpl_GetCategory(IXACT3Engine *iface, ++ PCSTR szFriendlyName) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ ++ TRACE("(%p)->(%s)\n", This, szFriendlyName); ++ ++ return FACTAudioEngine_GetCategory(This->fact_engine, szFriendlyName); ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_Stop(IXACT3Engine *iface, ++ XACTCATEGORY nCategory, DWORD dwFlags) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ ++ TRACE("(%p)->(%u, 0x%x)\n", This, nCategory, dwFlags); ++ ++ return FACTAudioEngine_Stop(This->fact_engine, nCategory, dwFlags); ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_SetVolume(IXACT3Engine *iface, ++ XACTCATEGORY nCategory, XACTVOLUME nVolume) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ ++ TRACE("(%p)->(%u, %f)\n", This, nCategory, nVolume); ++ ++ return FACTAudioEngine_SetVolume(This->fact_engine, nCategory, nVolume); ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_Pause(IXACT3Engine *iface, ++ XACTCATEGORY nCategory, BOOL fPause) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ ++ TRACE("(%p)->(%u, %u)\n", This, nCategory, fPause); ++ ++ return FACTAudioEngine_Pause(This->fact_engine, nCategory, fPause); ++} ++ ++static XACTVARIABLEINDEX WINAPI IXACT3EngineImpl_GetGlobalVariableIndex( ++ IXACT3Engine *iface, PCSTR szFriendlyName) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ ++ TRACE("(%p)->(%s)\n", This, szFriendlyName); ++ ++ return FACTAudioEngine_GetGlobalVariableIndex(This->fact_engine, ++ szFriendlyName); ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_SetGlobalVariable(IXACT3Engine *iface, ++ XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ ++ TRACE("(%p)->(%u, %f)\n", This, nIndex, nValue); ++ ++ return FACTAudioEngine_SetGlobalVariable(This->fact_engine, nIndex, nValue); ++} ++ ++static HRESULT WINAPI IXACT3EngineImpl_GetGlobalVariable(IXACT3Engine *iface, ++ XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE *nValue) ++{ ++ XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); ++ ++ TRACE("(%p)->(%u, %p)\n", This, nIndex, nValue); ++ ++ return FACTAudioEngine_GetGlobalVariable(This->fact_engine, nIndex, nValue); ++} ++ ++static const IXACT3EngineVtbl XACT3Engine_Vtbl = ++{ ++ IXACT3EngineImpl_QueryInterface, ++ IXACT3EngineImpl_AddRef, ++ IXACT3EngineImpl_Release, ++ IXACT3EngineImpl_GetRendererCount, ++ IXACT3EngineImpl_GetRendererDetails, ++ IXACT3EngineImpl_GetFinalMixFormat, ++ IXACT3EngineImpl_Initialize, ++ IXACT3EngineImpl_ShutDown, ++ IXACT3EngineImpl_DoWork, ++ IXACT3EngineImpl_CreateSoundBank, ++ IXACT3EngineImpl_CreateInMemoryWaveBank, ++ IXACT3EngineImpl_CreateStreamingWaveBank, ++ IXACT3EngineImpl_PrepareWave, ++ IXACT3EngineImpl_PrepareInMemoryWave, ++ IXACT3EngineImpl_PrepareStreamingWave, ++ IXACT3EngineImpl_RegisterNotification, ++ IXACT3EngineImpl_UnRegisterNotification, ++ IXACT3EngineImpl_GetCategory, ++ IXACT3EngineImpl_Stop, ++ IXACT3EngineImpl_SetVolume, ++ IXACT3EngineImpl_Pause, ++ IXACT3EngineImpl_GetGlobalVariableIndex, ++ IXACT3EngineImpl_SetGlobalVariable, ++ IXACT3EngineImpl_GetGlobalVariable ++}; ++ ++static HRESULT WINAPI XACT3CF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppobj) ++{ ++ if(IsEqualGUID(riid, &IID_IUnknown) || ++ IsEqualGUID(riid, &IID_IClassFactory)) ++ { ++ *ppobj = iface; ++ return S_OK; ++ } ++ ++ *ppobj = NULL; ++ WARN("(%p)->(%s, %p): interface not found\n", iface, debugstr_guid(riid), ppobj); ++ return E_NOINTERFACE; ++} ++ ++static ULONG WINAPI XACT3CF_AddRef(IClassFactory *iface) ++{ ++ return 2; ++} ++ ++static ULONG WINAPI XACT3CF_Release(IClassFactory *iface) ++{ ++ return 1; ++} ++ ++static HRESULT WINAPI XACT3CF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, ++ REFIID riid, void **ppobj) ++{ ++ HRESULT hr; ++ XACT3EngineImpl *object; ++ ++ TRACE("(%p)->(%p,%s,%p)\n", iface, pOuter, debugstr_guid(riid), ppobj); ++ ++ *ppobj = NULL; ++ ++ if(pOuter) ++ return CLASS_E_NOAGGREGATION; ++ ++ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); ++ if(!object) ++ return E_OUTOFMEMORY; ++ ++ object->IXACT3Engine_iface.lpVtbl = &XACT3Engine_Vtbl; ++ ++ FACTCreateEngineWithCustomAllocatorEXT( ++ 0, ++ &object->fact_engine, ++ XAudio_Internal_Malloc, ++ XAudio_Internal_Free, ++ XAudio_Internal_Realloc ++ ); ++ ++ hr = IXACT3Engine_QueryInterface(&object->IXACT3Engine_iface, riid, ppobj); ++ if(FAILED(hr)){ ++ HeapFree(GetProcessHeap(), 0, object); ++ return hr; ++ } ++ ++ TRACE("Created XACT version 0x%04x: %p\n", XACT3_VER, object); ++ ++ return hr; ++} ++ ++static HRESULT WINAPI XACT3CF_LockServer(IClassFactory *iface, BOOL dolock) ++{ ++ TRACE("(%p)->(%d): stub!\n", iface, dolock); ++ return S_OK; ++} ++ ++static const IClassFactoryVtbl XACT3CF_Vtbl = ++{ ++ XACT3CF_QueryInterface, ++ XACT3CF_AddRef, ++ XACT3CF_Release, ++ XACT3CF_CreateInstance, ++ XACT3CF_LockServer ++}; ++ ++static IClassFactory XACTFactory = { &XACT3CF_Vtbl }; ++ ++HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv) ++{ ++ TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); ++ ++#if XACT3_VER == 0x0300 ++ if (IsEqualGUID(rclsid, &CLSID_XACTEngine30)) ++#elif XACT3_VER == 0x0301 ++ if (IsEqualGUID(rclsid, &CLSID_XACTEngine31)) ++#elif XACT3_VER == 0x0302 ++ if (IsEqualGUID(rclsid, &CLSID_XACTEngine32)) ++#elif XACT3_VER == 0x0303 ++ if (IsEqualGUID(rclsid, &CLSID_XACTEngine33)) ++#elif XACT3_VER == 0x0304 ++ if (IsEqualGUID(rclsid, &CLSID_XACTEngine34)) ++#elif XACT3_VER == 0x0305 ++ if (IsEqualGUID(rclsid, &CLSID_XACTEngine35)) ++#elif XACT3_VER == 0x0306 ++ if (IsEqualGUID(rclsid, &CLSID_XACTEngine36)) ++#elif XACT3_VER == 0x0307 ++ if (IsEqualGUID(rclsid, &CLSID_XACTEngine37)) ++#endif ++ return IClassFactory_QueryInterface(&XACTFactory, riid, ppv); ++ ++ return CLASS_E_CLASSNOTAVAILABLE; ++} ++ ++#endif +-- +2.25.1 + diff --git a/patches/xactengine-initial/0003-xaudio2_7-Support-older-XACT3Engine-interfaces.patch b/patches/xactengine-initial/0003-xaudio2_7-Support-older-XACT3Engine-interfaces.patch new file mode 100644 index 000000000..7bc12d80f --- /dev/null +++ b/patches/xactengine-initial/0003-xaudio2_7-Support-older-XACT3Engine-interfaces.patch @@ -0,0 +1,41 @@ +From c7189e9d48079b0f3993ed8de8f774f3e0a7a97e Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Tue, 7 Jan 2020 22:14:49 +1100 +Subject: [PATCH] xaudio2_7: Support older XACT3Engine interfaces + +--- + dlls/xaudio2_7/xact_dll.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/dlls/xaudio2_7/xact_dll.c b/dlls/xaudio2_7/xact_dll.c +index 07f866606d..91e3ef0afd 100644 +--- a/dlls/xaudio2_7/xact_dll.c ++++ b/dlls/xaudio2_7/xact_dll.c +@@ -39,6 +39,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(xact3); + + static HINSTANCE instance; + ++#if XACT3_VER >= 0x0301 && XACT3_VER <= 0x304 ++DEFINE_GUID(IID_IXACT3Engine301, 0xe72c1b9a, 0xd717, 0x41c0, 0x81, 0xa6, 0x50, 0xeb, 0x56, 0xe8, 0x06, 0x49); ++#endif ++ + BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, void *pReserved) + { + TRACE("(%p, %d, %p)\n", hinstDLL, reason, pReserved); +@@ -852,7 +856,12 @@ static HRESULT WINAPI IXACT3EngineImpl_QueryInterface(IXACT3Engine *iface, + TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObject); + + if(IsEqualGUID(riid, &IID_IUnknown) || +- IsEqualGUID(riid, &IID_IXACT3Engine)){ ++#if XACT3_VER >= 0x0301 && XACT3_VER <= 0x304 ++ IsEqualGUID(riid, &IID_IXACT3Engine301) ++#else ++ IsEqualGUID(riid, &IID_IXACT3Engine) ++#endif ++ ){ + *ppvObject = &This->IXACT3Engine_iface; + } + else +-- +2.25.1 + diff --git a/patches/xactengine-initial/0004-xaudio2_7-IXACT3Engine-Initialize-return-valid-error.patch b/patches/xactengine-initial/0004-xaudio2_7-IXACT3Engine-Initialize-return-valid-error.patch new file mode 100644 index 000000000..80017aaf7 --- /dev/null +++ b/patches/xactengine-initial/0004-xaudio2_7-IXACT3Engine-Initialize-return-valid-error.patch @@ -0,0 +1,39 @@ +From 3ad019171933268538e16f5ab14e0f7b5f4be5e2 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Wed, 8 Jan 2020 08:33:02 +1100 +Subject: [PATCH] xaudio2_7: IXACT3Engine Initialize return valid error code + +FACTAudioEngine_Initialize returns a uint32_t type, so we need to +convert to a valid HRESULT value. +--- + dlls/xaudio2_7/xact_dll.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/dlls/xaudio2_7/xact_dll.c b/dlls/xaudio2_7/xact_dll.c +index 91e3ef0afd..1f580519d4 100644 +--- a/dlls/xaudio2_7/xact_dll.c ++++ b/dlls/xaudio2_7/xact_dll.c +@@ -934,6 +934,7 @@ static HRESULT WINAPI IXACT3EngineImpl_Initialize(IXACT3Engine *iface, + { + XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); + FACTRuntimeParameters params; ++ UINT ret; + + TRACE("(%p)->(%p)\n", This, pParams); + +@@ -972,7 +973,11 @@ static HRESULT WINAPI IXACT3EngineImpl_Initialize(IXACT3Engine *iface, + params.fileIOCallbacks.readFileCallback = wrap_readfile; + params.fileIOCallbacks.getOverlappedResultCallback = wrap_getoverlappedresult; + +- return FACTAudioEngine_Initialize(This->fact_engine, ¶ms); ++ ret = FACTAudioEngine_Initialize(This->fact_engine, ¶ms); ++ if (ret != 0) ++ FIXME("FACTAudioEngine_Initialize returned %d\n", ret); ++ ++ return !ret ? S_OK : E_FAIL; + } + + static HRESULT WINAPI IXACT3EngineImpl_ShutDown(IXACT3Engine *iface) +-- +2.25.1 + diff --git a/patches/xactengine-initial/0005-xaudio2_7-IXACT3Engine-CreateSoundBank-return-correc.patch b/patches/xactengine-initial/0005-xaudio2_7-IXACT3Engine-CreateSoundBank-return-correc.patch new file mode 100644 index 000000000..9adb96104 --- /dev/null +++ b/patches/xactengine-initial/0005-xaudio2_7-IXACT3Engine-CreateSoundBank-return-correc.patch @@ -0,0 +1,93 @@ +From 2335980b1a1e36ce475a99b08498747021b5284c Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Wed, 8 Jan 2020 10:39:02 +1100 +Subject: [PATCH] xaudio2_7: IXACT3Engine CreateSoundBank return correct + HRESULT values. + +--- + dlls/xaudio2_7/xact_dll.c | 28 ++++++++++++++++------------ + 1 file changed, 16 insertions(+), 12 deletions(-) + +diff --git a/dlls/xaudio2_7/xact_dll.c b/dlls/xaudio2_7/xact_dll.c +index 1f580519d4..9cec216002 100644 +--- a/dlls/xaudio2_7/xact_dll.c ++++ b/dlls/xaudio2_7/xact_dll.c +@@ -1005,21 +1005,23 @@ static HRESULT WINAPI IXACT3EngineImpl_CreateSoundBank(IXACT3Engine *iface, + XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); + XACT3SoundBankImpl *sb; + FACTSoundBank *fsb; +- HRESULT hr; ++ UINT ret; + + TRACE("(%p)->(%p, %u, 0x%x, 0x%x, %p)\n", This, pvBuffer, dwSize, dwFlags, + dwAllocAttributes, ppSoundBank); + +- hr = FACTAudioEngine_CreateSoundBank(This->fact_engine, pvBuffer, dwSize, ++ ret = FACTAudioEngine_CreateSoundBank(This->fact_engine, pvBuffer, dwSize, + dwFlags, dwAllocAttributes, &fsb); +- if(FAILED(hr)) +- return hr; ++ if (ret != 0) { ++ ERR("Failed to CreateInMemoryWaveBank: %d\n", ret); ++ return E_FAIL; ++ } + + sb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*sb)); + if (!sb){ + FACTSoundBank_Destroy(fsb); + ERR("Failed to allocate XACT3SoundBankImpl!"); +- return hr; ++ return E_OUTOFMEMORY; + } + + sb->IXACT3SoundBank_iface.lpVtbl = &XACT3SoundBank_Vtbl; +@@ -1028,7 +1030,7 @@ static HRESULT WINAPI IXACT3EngineImpl_CreateSoundBank(IXACT3Engine *iface, + + TRACE("Created SoundBank: %p\n", sb); + +- return hr; ++ return S_OK; + } + + static HRESULT WINAPI IXACT3EngineImpl_CreateInMemoryWaveBank(IXACT3Engine *iface, +@@ -1038,21 +1040,23 @@ static HRESULT WINAPI IXACT3EngineImpl_CreateInMemoryWaveBank(IXACT3Engine *ifac + XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); + XACT3WaveBankImpl *wb; + FACTWaveBank *fwb; +- HRESULT hr; ++ UINT ret; + + TRACE("(%p)->(%p, %u, 0x%x, 0x%x, %p)\n", This, pvBuffer, dwSize, dwFlags, + dwAllocAttributes, ppWaveBank); + +- hr = FACTAudioEngine_CreateInMemoryWaveBank(This->fact_engine, pvBuffer, ++ ret = FACTAudioEngine_CreateInMemoryWaveBank(This->fact_engine, pvBuffer, + dwSize, dwFlags, dwAllocAttributes, &fwb); +- if(FAILED(hr)) +- return hr; ++ if (ret != 0) { ++ ERR("Failed to CreateInMemoryWaveBank: %d\n", ret); ++ return E_FAIL; ++ } + + wb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*wb)); + if (!wb){ + FACTWaveBank_Destroy(fwb); + ERR("Failed to allocate XACT3WaveBankImpl!"); +- return hr; ++ return E_OUTOFMEMORY; + } + + wb->IXACT3WaveBank_iface.lpVtbl = &XACT3WaveBank_Vtbl; +@@ -1061,7 +1065,7 @@ static HRESULT WINAPI IXACT3EngineImpl_CreateInMemoryWaveBank(IXACT3Engine *ifac + + TRACE("Created in-memory WaveBank: %p\n", wb); + +- return hr; ++ return S_OK; + } + + static HRESULT WINAPI IXACT3EngineImpl_CreateStreamingWaveBank(IXACT3Engine *iface, +-- +2.25.1 + diff --git a/patches/xactengine-initial/0006-xaudio2_7-Always-return-S_OK-in-IXACT34Cue-Destroy.patch b/patches/xactengine-initial/0006-xaudio2_7-Always-return-S_OK-in-IXACT34Cue-Destroy.patch new file mode 100644 index 000000000..3241d56d5 --- /dev/null +++ b/patches/xactengine-initial/0006-xaudio2_7-Always-return-S_OK-in-IXACT34Cue-Destroy.patch @@ -0,0 +1,32 @@ +From 94df3565a9109176ee936416804f325b5fde9627 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Wed, 8 Jan 2020 12:34:53 +1100 +Subject: [PATCH] xaudio2_7: Always return S_OK in IXACT34Cue Destroy + +--- + dlls/xaudio2_7/xact_dll.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/dlls/xaudio2_7/xact_dll.c b/dlls/xaudio2_7/xact_dll.c +index 9cec216002..2bf6eaf374 100644 +--- a/dlls/xaudio2_7/xact_dll.c ++++ b/dlls/xaudio2_7/xact_dll.c +@@ -320,13 +320,12 @@ static HRESULT WINAPI IXACT34CueImpl_GetState(IXACT34Cue *iface, DWORD *pdwState + static HRESULT WINAPI IXACT34CueImpl_Destroy(IXACT34Cue *iface) + { + XACT3CueImpl *This = impl_from_IXACT34Cue(iface); +- HRESULT hr; + + TRACE("(%p)\n", iface); + +- hr = FACTCue_Destroy(This->fact_cue); ++ FACTCue_Destroy(This->fact_cue); + HeapFree(GetProcessHeap(), 0, This); +- return hr; ++ return S_OK; + } + + static HRESULT WINAPI IXACT34CueImpl_SetMatrixCoefficients(IXACT34Cue *iface, +-- +2.25.1 + diff --git a/patches/xactengine-initial/0007-xaudio2_7-Dont-cast-interface-pointers.patch b/patches/xactengine-initial/0007-xaudio2_7-Dont-cast-interface-pointers.patch new file mode 100644 index 000000000..bab69ccff --- /dev/null +++ b/patches/xactengine-initial/0007-xaudio2_7-Dont-cast-interface-pointers.patch @@ -0,0 +1,123 @@ +From 28886253b9ea693b42b4e89325c4643a1c8baca4 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Wed, 8 Jan 2020 20:51:09 +1100 +Subject: [PATCH] xaudio2_7: Dont cast interface pointers + +--- + dlls/xaudio2_7/xact_dll.c | 51 ++++++++++++++++++++++++++------------- + 1 file changed, 34 insertions(+), 17 deletions(-) + +diff --git a/dlls/xaudio2_7/xact_dll.c b/dlls/xaudio2_7/xact_dll.c +index 2bf6eaf374..6ed67c3a67 100644 +--- a/dlls/xaudio2_7/xact_dll.c ++++ b/dlls/xaudio2_7/xact_dll.c +@@ -763,7 +763,7 @@ static HRESULT WINAPI IXACT3WaveBankImpl_Prepare(IXACT3WaveBank *iface, + + wave->IXACT3Wave_iface.lpVtbl = &XACT3Wave_Vtbl; + wave->fact_wave = fwave; +- *ppWave = (IXACT3Wave*)wave; ++ *ppWave = &wave->IXACT3Wave_iface; + + TRACE("Created Wave: %p\n", wave); + +@@ -804,7 +804,9 @@ static HRESULT WINAPI IXACT3WaveBankImpl_Play(IXACT3WaveBank *iface, + + wave->IXACT3Wave_iface.lpVtbl = &XACT3Wave_Vtbl; + wave->fact_wave = fwave; +- *ppWave = (IXACT3Wave*)wave; ++ *ppWave = &wave->IXACT3Wave_iface; ++ ++ TRACE("Created Wave: %p\n", wave); + } + + return hr; +@@ -1025,7 +1027,7 @@ static HRESULT WINAPI IXACT3EngineImpl_CreateSoundBank(IXACT3Engine *iface, + + sb->IXACT3SoundBank_iface.lpVtbl = &XACT3SoundBank_Vtbl; + sb->fact_soundbank = fsb; +- *ppSoundBank = (IXACT3SoundBank*)sb; ++ *ppSoundBank = &sb->IXACT3SoundBank_iface; + + TRACE("Created SoundBank: %p\n", sb); + +@@ -1060,7 +1062,7 @@ static HRESULT WINAPI IXACT3EngineImpl_CreateInMemoryWaveBank(IXACT3Engine *ifac + + wb->IXACT3WaveBank_iface.lpVtbl = &XACT3WaveBank_Vtbl; + wb->fact_wavebank = fwb; +- *ppWaveBank = (IXACT3WaveBank*)wb; ++ *ppWaveBank = &wb->IXACT3WaveBank_iface; + + TRACE("Created in-memory WaveBank: %p\n", wb); + +@@ -1104,7 +1106,7 @@ static HRESULT WINAPI IXACT3EngineImpl_CreateStreamingWaveBank(IXACT3Engine *ifa + + wb->IXACT3WaveBank_iface.lpVtbl = &XACT3WaveBank_Vtbl; + wb->fact_wavebank = fwb; +- *ppWaveBank = (IXACT3WaveBank*)wb; ++ *ppWaveBank = &wb->IXACT3WaveBank_iface; + + TRACE("Created streaming WaveBank: %p\n", wb); + +@@ -1145,7 +1147,11 @@ static HRESULT WINAPI IXACT3EngineImpl_PrepareStreamingWave(IXACT3Engine *iface, + static inline void unwrap_notificationdesc(FACTNotificationDescription *fd, + const XACT_NOTIFICATION_DESCRIPTION *xd) + { ++ memset(fd, 0, sizeof(*fd)); + /* We have to unwrap the FACT object first! */ ++ ++ FIXME("Type %d\n", xd->type); ++ + fd->type = xd->type; + fd->flags = xd->flags; + fd->cueIndex = xd->cueIndex; +@@ -1153,24 +1159,35 @@ static inline void unwrap_notificationdesc(FACTNotificationDescription *fd, + fd->pvContext = xd->pvContext; + + if (xd->pCue != NULL) +- fd->pCue = ((XACT3CueImpl*) xd->pCue)->fact_cue; +- else +- fd->pCue = NULL; ++ { ++ XACT3CueImpl *cur = impl_from_IXACT3Cue(xd->pCue); ++ if (cur) ++ fd->pCue = cur->fact_cue; ++ } + + if (xd->pSoundBank != NULL) +- fd->pSoundBank = ((XACT3SoundBankImpl*) xd->pSoundBank)->fact_soundbank; +- else +- fd->pSoundBank = NULL; ++ { ++ XACT3SoundBankImpl *sound = impl_from_IXACT3SoundBank(xd->pSoundBank); ++ if (sound) ++ fd->pSoundBank = sound->fact_soundbank; ++ } + + if (xd->pWaveBank != NULL) +- fd->pWaveBank = ((XACT3WaveBankImpl*) xd->pWaveBank)->fact_wavebank; +- else +- fd->pWaveBank = NULL; ++ { ++ XACT3WaveBankImpl *bank = impl_from_IXACT3WaveBank(xd->pWaveBank); ++ if (bank) ++ fd->pWaveBank = bank->fact_wavebank; ++ } + + if (xd->pWave != NULL) +- fd->pWave = ((XACT3WaveImpl*) xd->pWave)->fact_wave; +- else +- fd->pWave = NULL; ++ { ++ XACT3WaveImpl *wave = impl_from_IXACT3Wave(xd->pWave); ++ FIXME("Wave %p\n", wave); ++ if (wave) ++ { ++ fd->pWave = wave->fact_wave; ++ } ++ } + } + + static HRESULT WINAPI IXACT3EngineImpl_RegisterNotification(IXACT3Engine *iface, +-- +2.25.1 + diff --git a/patches/xactengine-initial/0008-include-Add-XACTNOTIFICATIONTYPE_-values.patch b/patches/xactengine-initial/0008-include-Add-XACTNOTIFICATIONTYPE_-values.patch new file mode 100644 index 000000000..8b4e91feb --- /dev/null +++ b/patches/xactengine-initial/0008-include-Add-XACTNOTIFICATIONTYPE_-values.patch @@ -0,0 +1,45 @@ +From 5975c1051ef759adc1f8303fde7e3b60b0535ff7 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Thu, 9 Jan 2020 08:30:23 +1100 +Subject: [PATCH] include: Add XACTNOTIFICATIONTYPE_* values + +--- + include/xact3.idl | 22 ++++++++++++++++++---- + 1 file changed, 18 insertions(+), 4 deletions(-) + +diff --git a/include/xact3.idl b/include/xact3.idl +index c49718ff39..e05f476cb9 100644 +--- a/include/xact3.idl ++++ b/include/xact3.idl +@@ -266,10 +266,24 @@ typedef struct XACT_RUNTIME_PARAMETERS + + cpp_quote("#include ") + +-static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUEDESTROYED = 4; +-static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_SOUNDBANKDESTROYED = 6; +-static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEBANKDESTROYED = 7; +-static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEDESTROYED = 16; ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUEPREPARED = 1;") ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUEPLAY = 2;") ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUESTOP = 3;") ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUEDESTROYED = 4;") ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_MARKER = 5;") ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_SOUNDBANKDESTROYED = 6;") ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEBANKDESTROYED = 7;") ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_LOCALVARIABLECHANGED = 8;") ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_GLOBALVARIABLECHANGED = 9;") ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_GUICONNECTED = 10;") ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_GUIDISCONNECTED = 11;") ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEPREPARED = 12;") ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEPLAY = 13;") ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVESTOP = 14;") ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVELOOPED = 15;") ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEDESTROYED = 16;") ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEBANKPREPARED = 17;") ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEBANKSTREAMING_INVALIDCONTENT = 18;") + + [ + object, +-- +2.25.1 + diff --git a/patches/xactengine-initial/0009-xaudio2_7-unwrap-structure-based-of-it-s-type.patch b/patches/xactengine-initial/0009-xaudio2_7-unwrap-structure-based-of-it-s-type.patch new file mode 100644 index 000000000..149c2663d --- /dev/null +++ b/patches/xactengine-initial/0009-xaudio2_7-unwrap-structure-based-of-it-s-type.patch @@ -0,0 +1,120 @@ +From 259e956699ed667257c575a68c97d9eca2320d3d Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Thu, 9 Jan 2020 09:06:01 +1100 +Subject: [PATCH] xaudio2_7: unwrap structure based of it's type. + +--- + dlls/xaudio2_7/xact_dll.c | 68 +++++++++++++++++++++++++++++++++++---- + 1 file changed, 61 insertions(+), 7 deletions(-) + +diff --git a/dlls/xaudio2_7/xact_dll.c b/dlls/xaudio2_7/xact_dll.c +index 6ed67c3a67..92434a7084 100644 +--- a/dlls/xaudio2_7/xact_dll.c ++++ b/dlls/xaudio2_7/xact_dll.c +@@ -1144,42 +1144,96 @@ static HRESULT WINAPI IXACT3EngineImpl_PrepareStreamingWave(IXACT3Engine *iface, + return S_OK; + } + ++enum { NOTIFY_SoundBank = 0x01, ++ NOTIFY_WaveBank = 0x02, ++ NOTIFY_Cue = 0x04, ++ NOTIFY_Wave = 0x08, ++ NOTIFY_cueIndex = 0x10, ++ NOTIFY_waveIndex = 0x20 }; ++ + static inline void unwrap_notificationdesc(FACTNotificationDescription *fd, + const XACT_NOTIFICATION_DESCRIPTION *xd) + { ++ DWORD flags = 0; + memset(fd, 0, sizeof(*fd)); + /* We have to unwrap the FACT object first! */ + +- FIXME("Type %d\n", xd->type); ++ TRACE("Type %d\n", xd->type); ++ switch (xd->type) ++ { ++ /* Supports None */ ++ case (int)XACTNOTIFICATIONTYPE_GLOBALVARIABLECHANGED: ++ case (int)XACTNOTIFICATIONTYPE_GUICONNECTED: ++ case (int)XACTNOTIFICATIONTYPE_GUIDISCONNECTED: ++ break; ++ ++ /* Supports SoundBank, Cue index, Cue instance */ ++ case (int)XACTNOTIFICATIONTYPE_CUEPREPARED: ++ case (int)XACTNOTIFICATIONTYPE_CUEPLAY: ++ case (int)XACTNOTIFICATIONTYPE_CUESTOP: ++ case (int)XACTNOTIFICATIONTYPE_CUEDESTROYED: ++ case (int)XACTNOTIFICATIONTYPE_MARKER: ++ case (int)XACTNOTIFICATIONTYPE_LOCALVARIABLECHANGED: ++ flags = NOTIFY_SoundBank | NOTIFY_cueIndex | NOTIFY_Cue; ++ break; ++ ++ /* Supports WaveBank */ ++ case (int)XACTNOTIFICATIONTYPE_WAVEBANKDESTROYED: ++ case (int)XACTNOTIFICATIONTYPE_WAVEBANKPREPARED: ++ case (int)XACTNOTIFICATIONTYPE_WAVEBANKSTREAMING_INVALIDCONTENT: ++ flags = NOTIFY_WaveBank; ++ break; ++ ++ /* Supports NOTIFY_SoundBank */ ++ case (int)XACTNOTIFICATIONTYPE_SOUNDBANKDESTROYED: ++ flags = NOTIFY_SoundBank; ++ break; ++ ++ /* Supports WaveBank, Wave index, Wave instance */ ++ case (int)XACTNOTIFICATIONTYPE_WAVEPREPARED: ++ case (int)XACTNOTIFICATIONTYPE_WAVEDESTROYED: ++ flags = NOTIFY_WaveBank | NOTIFY_waveIndex | NOTIFY_Wave; ++ break; ++ ++ /* Supports SoundBank, SoundBank, Cue index, Cue instance, WaveBank, Wave instance */ ++ case (int)XACTNOTIFICATIONTYPE_WAVEPLAY: ++ case (int)XACTNOTIFICATIONTYPE_WAVESTOP: ++ case (int)XACTNOTIFICATIONTYPE_WAVELOOPED: ++ flags = NOTIFY_SoundBank | NOTIFY_cueIndex | NOTIFY_Cue | NOTIFY_WaveBank | NOTIFY_Wave; ++ break; ++ }; + + fd->type = xd->type; + fd->flags = xd->flags; +- fd->cueIndex = xd->cueIndex; +- fd->waveIndex = xd->waveIndex; + fd->pvContext = xd->pvContext; + +- if (xd->pCue != NULL) ++ if (flags & NOTIFY_cueIndex) ++ fd->cueIndex = xd->cueIndex; ++ if (flags & NOTIFY_waveIndex) ++ fd->waveIndex = xd->waveIndex; ++ ++ if (flags & NOTIFY_Cue && xd->pCue != NULL) + { + XACT3CueImpl *cur = impl_from_IXACT3Cue(xd->pCue); + if (cur) + fd->pCue = cur->fact_cue; + } + +- if (xd->pSoundBank != NULL) ++ if (flags & NOTIFY_SoundBank && xd->pSoundBank != NULL) + { + XACT3SoundBankImpl *sound = impl_from_IXACT3SoundBank(xd->pSoundBank); + if (sound) + fd->pSoundBank = sound->fact_soundbank; + } + +- if (xd->pWaveBank != NULL) ++ if (flags & NOTIFY_WaveBank && xd->pWaveBank != NULL) + { + XACT3WaveBankImpl *bank = impl_from_IXACT3WaveBank(xd->pWaveBank); + if (bank) + fd->pWaveBank = bank->fact_wavebank; + } + +- if (xd->pWave != NULL) ++ if (flags & NOTIFY_Wave && xd->pWave != NULL) + { + XACT3WaveImpl *wave = impl_from_IXACT3Wave(xd->pWave); + FIXME("Wave %p\n", wave); +-- +2.25.1 + diff --git a/patches/xactengine-initial/0010-xaudio2_7-Correct-callback-to-windows-function.patch b/patches/xactengine-initial/0010-xaudio2_7-Correct-callback-to-windows-function.patch new file mode 100644 index 000000000..667235fcf --- /dev/null +++ b/patches/xactengine-initial/0010-xaudio2_7-Correct-callback-to-windows-function.patch @@ -0,0 +1,78 @@ +From 885782f9e28d085b0d1b14e80ae4f9d440537f2b Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Tue, 14 Jan 2020 08:30:00 +1100 +Subject: [PATCH] xaudio2_7: Correct callback to windows function. + +The unix library cannot directly call the windows callback +due to calling conventions. +--- + dlls/xaudio2_7/xact_dll.c | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +diff --git a/dlls/xaudio2_7/xact_dll.c b/dlls/xaudio2_7/xact_dll.c +index 92434a7084..dfe74cebc2 100644 +--- a/dlls/xaudio2_7/xact_dll.c ++++ b/dlls/xaudio2_7/xact_dll.c +@@ -108,6 +108,7 @@ typedef struct _XACT3EngineImpl { + + XACT_READFILE_CALLBACK pReadFile; + XACT_GETOVERLAPPEDRESULT_CALLBACK pGetOverlappedResult; ++ XACT_NOTIFICATION_CALLBACK notification_callback; + } XACT3EngineImpl; + + typedef struct wrap_readfile_struct { +@@ -930,6 +931,25 @@ static HRESULT WINAPI IXACT3EngineImpl_GetFinalMixFormat(IXACT3Engine *iface, + (FAudioWaveFormatExtensible*) pFinalMixFormat); + } + ++static void FACTCALL fact_notification_cb(const FACTNotification *pNotification) ++{ ++ XACT3EngineImpl *engine = (XACT3EngineImpl *)pNotification->pvContext; ++ ++ /* Older versions of FAudio don't pass through the context */ ++ if (!engine) ++ { ++ WARN("Notification context is NULL\n"); ++ return; ++ } ++ ++ if (pNotification->type == XACTNOTIFICATIONTYPE_SOUNDBANKDESTROYED) ++ { ++ FIXME("Callback XACTNOTIFICATIONTYPE_SOUNDBANKDESTROYED\n"); ++ } ++ else ++ FIXME("Unsupported callback type %d\n", pNotification->type); ++} ++ + static HRESULT WINAPI IXACT3EngineImpl_Initialize(IXACT3Engine *iface, + const XACT_RUNTIME_PARAMETERS *pParams) + { +@@ -973,6 +993,9 @@ static HRESULT WINAPI IXACT3EngineImpl_Initialize(IXACT3Engine *iface, + GetOverlappedResult; + params.fileIOCallbacks.readFileCallback = wrap_readfile; + params.fileIOCallbacks.getOverlappedResultCallback = wrap_getoverlappedresult; ++ params.fnNotificationCallback = fact_notification_cb; ++ ++ This->notification_callback = (XACT_NOTIFICATION_CALLBACK)pParams->fnNotificationCallback; + + ret = FACTAudioEngine_Initialize(This->fact_engine, ¶ms); + if (ret != 0) +@@ -1253,6 +1276,7 @@ static HRESULT WINAPI IXACT3EngineImpl_RegisterNotification(IXACT3Engine *iface, + TRACE("(%p)->(%p)\n", This, pNotificationDesc); + + unwrap_notificationdesc(&fdesc, pNotificationDesc); ++ fdesc.pvContext = This; + return FACTAudioEngine_RegisterNotification(This->fact_engine, &fdesc); + } + +@@ -1265,6 +1289,7 @@ static HRESULT WINAPI IXACT3EngineImpl_UnRegisterNotification(IXACT3Engine *ifac + TRACE("(%p)->(%p)\n", This, pNotificationDesc); + + unwrap_notificationdesc(&fdesc, pNotificationDesc); ++ fdesc.pvContext = This; + return FACTAudioEngine_UnRegisterNotification(This->fact_engine, &fdesc); + } + +-- +2.25.1 + diff --git a/patches/xactengine-initial/0011-xaudio2_7-Initial-IXACT3Engine-tests.patch b/patches/xactengine-initial/0011-xaudio2_7-Initial-IXACT3Engine-tests.patch new file mode 100644 index 000000000..5ba1465f7 --- /dev/null +++ b/patches/xactengine-initial/0011-xaudio2_7-Initial-IXACT3Engine-tests.patch @@ -0,0 +1,133 @@ +From 88e7f19d0ae49fca34d50fbe9c73e8fd0425e964 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Tue, 14 Jan 2020 13:42:48 +1100 +Subject: [PATCH] xaudio2_7: Initial IXACT3Engine tests + +Signed-off-by: Alistair Leslie-Hughes +--- + dlls/xaudio2_7/tests/Makefile.in | 1 + + dlls/xaudio2_7/tests/xact.c | 88 ++++++++++++++++++++++++++++++++ + dlls/xaudio2_7/tests/xaudio2.c | 2 +- + 3 files changed, 90 insertions(+), 1 deletion(-) + create mode 100644 dlls/xaudio2_7/tests/xact.c + +diff --git a/dlls/xaudio2_7/tests/Makefile.in b/dlls/xaudio2_7/tests/Makefile.in +index ba56d94a1f..ecd728d659 100644 +--- a/dlls/xaudio2_7/tests/Makefile.in ++++ b/dlls/xaudio2_7/tests/Makefile.in +@@ -2,4 +2,5 @@ TESTDLL = xaudio2_7.dll + IMPORTS = ole32 + + C_SRCS = \ ++ xact.c \ + xaudio2.c +diff --git a/dlls/xaudio2_7/tests/xact.c b/dlls/xaudio2_7/tests/xact.c +new file mode 100644 +index 0000000000..afe8e4d83a +--- /dev/null ++++ b/dlls/xaudio2_7/tests/xact.c +@@ -0,0 +1,88 @@ ++/* ++ * Copyright (c) 2020 Alistair Leslie-Hughes ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA ++ */ ++ ++#include ++#include ++ ++#define COBJMACROS ++#include "wine/test.h" ++ ++#include "xact3.h" ++ ++#include "initguid.h" ++DEFINE_GUID(IID_IXACT3Engine301, 0xe72c1b9a, 0xd717, 0x41c0, 0x81, 0xa6, 0x50, 0xeb, 0x56, 0xe8, 0x06, 0x49); ++ ++struct xact_interfaces ++{ ++ REFGUID clsid; ++ REFIID iid; ++ HRESULT expected; ++ BOOL todo; ++} xact_interfaces[] = ++{ ++ {&CLSID_XACTEngine30, &IID_IXACT3Engine301, E_NOINTERFACE, TRUE }, ++ {&CLSID_XACTEngine30, &IID_IXACT3Engine, E_NOINTERFACE, TRUE }, ++ ++ /* Version 3.1 to 3.4 use the same inteface */ ++ {&CLSID_XACTEngine31, &IID_IXACT3Engine301, S_OK }, ++ {&CLSID_XACTEngine32, &IID_IXACT3Engine301, S_OK }, ++ {&CLSID_XACTEngine33, &IID_IXACT3Engine301, S_OK }, ++ {&CLSID_XACTEngine34, &IID_IXACT3Engine301, S_OK }, ++ ++ /* Version 3.5 to 3.7 use the same inteface */ ++ {&CLSID_XACTEngine35, &IID_IXACT3Engine301, E_NOINTERFACE }, ++ {&CLSID_XACTEngine35, &IID_IXACT3Engine, S_OK }, ++ ++ {&CLSID_XACTEngine36, &IID_IXACT3Engine301, E_NOINTERFACE }, ++ {&CLSID_XACTEngine36, &IID_IXACT3Engine, S_OK }, ++ ++ {&CLSID_XACTEngine37, &IID_IXACT3Engine301, E_NOINTERFACE }, ++ {&CLSID_XACTEngine37, &IID_IXACT3Engine, S_OK }, ++ {&CLSID_XACTEngine37, &IID_IUnknown, S_OK }, ++}; ++ ++static void test_interfaces(void) ++{ ++ IUnknown *unk; ++ HRESULT hr; ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(xact_interfaces); i++) ++ { ++ hr = CoCreateInstance(xact_interfaces[i].clsid, NULL, CLSCTX_INPROC_SERVER, ++ xact_interfaces[i].iid, (void**)&unk); ++ if (hr == REGDB_E_CLASSNOTREG || (hr != xact_interfaces[i].expected && ++ xact_interfaces[i].todo)) ++ { ++ trace("%d not registered. Skipping\n", wine_dbgstr_guid(xact_interfaces[i].clsid) ); ++ continue; ++ } ++ ok(hr == xact_interfaces[i].expected, "%d, Unexpected value 0x%08x\n", i, hr); ++ if (hr == S_OK) ++ IUnknown_Release(unk); ++ } ++} ++ ++START_TEST(xact) ++{ ++ CoInitialize(NULL); ++ ++ test_interfaces(); ++ ++ CoUninitialize(); ++} +diff --git a/dlls/xaudio2_7/tests/xaudio2.c b/dlls/xaudio2_7/tests/xaudio2.c +index f2bffdf29f..05b1dc3aba 100644 +--- a/dlls/xaudio2_7/tests/xaudio2.c ++++ b/dlls/xaudio2_7/tests/xaudio2.c +@@ -22,7 +22,7 @@ + #define COBJMACROS + #include "wine/test.h" + #include "initguid.h" +-#include "xaudio2.h" ++#include "xact3.h" + #include "xaudio2fx.h" + #include "xapo.h" + #include "xapofx.h" +-- +2.25.1 + diff --git a/patches/xactengine-initial/0012-xaudio2_7-Trace-FAudio-version-being-used.patch b/patches/xactengine-initial/0012-xaudio2_7-Trace-FAudio-version-being-used.patch new file mode 100644 index 000000000..51afc3533 --- /dev/null +++ b/patches/xactengine-initial/0012-xaudio2_7-Trace-FAudio-version-being-used.patch @@ -0,0 +1,26 @@ +From 0b54c7d231cc8ba9cde2bd5cda542ec61ba86fdf Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Tue, 14 Jan 2020 15:47:43 +1100 +Subject: [PATCH] xaudio2_7: Trace FAudio version being used + +Signed-off-by: Alistair Leslie-Hughes +--- + dlls/xaudio2_7/xact_dll.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/dlls/xaudio2_7/xact_dll.c b/dlls/xaudio2_7/xact_dll.c +index dfe74cebc2..4c576d87ba 100644 +--- a/dlls/xaudio2_7/xact_dll.c ++++ b/dlls/xaudio2_7/xact_dll.c +@@ -52,6 +52,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, void *pReserved) + case DLL_PROCESS_ATTACH: + instance = hinstDLL; + DisableThreadLibraryCalls( hinstDLL ); ++ ++ TRACE("Using FAudio version %d\n", FAudioLinkedVersion() ); + break; + } + return TRUE; +-- +2.25.1 + diff --git a/patches/xactengine-initial/0013-xaudio2_7-Trace-FAudio-version-being-used.patch b/patches/xactengine-initial/0013-xaudio2_7-Trace-FAudio-version-being-used.patch new file mode 100644 index 000000000..e20b25f75 --- /dev/null +++ b/patches/xactengine-initial/0013-xaudio2_7-Trace-FAudio-version-being-used.patch @@ -0,0 +1,26 @@ +From 9b14a6c11c5d720682965f0dc92c3f3a5d92a345 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Tue, 14 Jan 2020 15:47:15 +1100 +Subject: [PATCH] xaudio2_7: Trace FAudio version being used + +Signed-off-by: Alistair Leslie-Hughes +--- + dlls/xaudio2_7/xaudio_dll.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/dlls/xaudio2_7/xaudio_dll.c b/dlls/xaudio2_7/xaudio_dll.c +index a87e0124d3..ae18a72e2b 100644 +--- a/dlls/xaudio2_7/xaudio_dll.c ++++ b/dlls/xaudio2_7/xaudio_dll.c +@@ -90,6 +90,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, void *pReserved) + case DLL_PROCESS_ATTACH: + instance = hinstDLL; + DisableThreadLibraryCalls( hinstDLL ); ++ ++ TRACE("Using FAudio version %d\n", FAudioLinkedVersion() ); + break; + } + return TRUE; +-- +2.25.1 + diff --git a/patches/xactengine-initial/0014-include-Add-XACTENGINE_-error-codes.patch b/patches/xactengine-initial/0014-include-Add-XACTENGINE_-error-codes.patch new file mode 100644 index 000000000..f967cd7c6 --- /dev/null +++ b/patches/xactengine-initial/0014-include-Add-XACTENGINE_-error-codes.patch @@ -0,0 +1,66 @@ +From 554e9f407e5e722c88b703be987c3ac30dc6a41c Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Thu, 16 Jan 2020 13:46:14 +1100 +Subject: [PATCH] include: Add XACTENGINE_* error codes + +--- + include/xact3.idl | 46 ++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 46 insertions(+) + +diff --git a/include/xact3.idl b/include/xact3.idl +index e05f476cb9..87fd2e86f5 100644 +--- a/include/xact3.idl ++++ b/include/xact3.idl +@@ -545,3 +545,49 @@ interface IXACT3Wave + + HRESULT GetProperties(XACT_WAVE_INSTANCE_PROPERTIES *pProperties); + } ++ ++cpp_quote("#define FACILITY_XACTENGINE 0xAC7") ++cpp_quote("#define XACTENGINEERROR(n) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_XACTENGINE, n)") ++ ++cpp_quote("#define XACTENGINE_E_OUTOFMEMORY E_OUTOFMEMORY") ++cpp_quote("#define XACTENGINE_E_INVALIDARG E_INVALIDARG") ++cpp_quote("#define XACTENGINE_E_NOTIMPL E_NOTIMPL") ++cpp_quote("#define XACTENGINE_E_FAIL E_FAIL") ++ ++cpp_quote("#define XACTENGINE_E_ALREADYINITIALIZED XACTENGINEERROR(0x001)") ++cpp_quote("#define XACTENGINE_E_NOTINITIALIZED XACTENGINEERROR(0x002)") ++cpp_quote("#define XACTENGINE_E_EXPIRED XACTENGINEERROR(0x003)") ++cpp_quote("#define XACTENGINE_E_NONOTIFICATIONCALLBACK XACTENGINEERROR(0x004)") ++cpp_quote("#define XACTENGINE_E_NOTIFICATIONREGISTERED XACTENGINEERROR(0x005)") ++cpp_quote("#define XACTENGINE_E_INVALIDUSAGE XACTENGINEERROR(0x006)") ++cpp_quote("#define XACTENGINE_E_INVALIDDATA XACTENGINEERROR(0x007)") ++cpp_quote("#define XACTENGINE_E_INSTANCELIMITFAILTOPLAY XACTENGINEERROR(0x008)") ++cpp_quote("#define XACTENGINE_E_NOGLOBALSETTINGS XACTENGINEERROR(0x009)") ++cpp_quote("#define XACTENGINE_E_INVALIDVARIABLEINDEX XACTENGINEERROR(0x00a)") ++cpp_quote("#define XACTENGINE_E_INVALIDCATEGORY XACTENGINEERROR(0x00b)") ++cpp_quote("#define XACTENGINE_E_INVALIDCUEINDEX XACTENGINEERROR(0x00c)") ++cpp_quote("#define XACTENGINE_E_INVALIDWAVEINDEX XACTENGINEERROR(0x00d)") ++cpp_quote("#define XACTENGINE_E_INVALIDTRACKINDEX XACTENGINEERROR(0x00e)") ++cpp_quote("#define XACTENGINE_E_INVALIDSOUNDOFFSETORINDEX XACTENGINEERROR(0x00f)") ++cpp_quote("#define XACTENGINE_E_READFILE XACTENGINEERROR(0x010)") ++cpp_quote("#define XACTENGINE_E_UNKNOWNEVENT XACTENGINEERROR(0x011)") ++cpp_quote("#define XACTENGINE_E_INCALLBACK XACTENGINEERROR(0x012)") ++cpp_quote("#define XACTENGINE_E_NOWAVEBANK XACTENGINEERROR(0x013)") ++cpp_quote("#define XACTENGINE_E_SELECTVARIATION XACTENGINEERROR(0x014)") ++cpp_quote("#define XACTENGINE_E_MULTIPLEAUDITIONENGINES XACTENGINEERROR(0x015)") ++cpp_quote("#define XACTENGINE_E_WAVEBANKNOTPREPARED XACTENGINEERROR(0x016)") ++cpp_quote("#define XACTENGINE_E_NORENDERER XACTENGINEERROR(0x017)") ++cpp_quote("#define XACTENGINE_E_INVALIDENTRYCOUNT XACTENGINEERROR(0x018)") ++cpp_quote("#define XACTENGINE_E_SEEKTIMEBEYONDCUEEND XACTENGINEERROR(0x019)") ++cpp_quote("#define XACTENGINE_E_SEEKTIMEBEYONDWAVEEND XACTENGINEERROR(0x01a)") ++cpp_quote("#define XACTENGINE_E_NOFRIENDLYNAMES XACTENGINEERROR(0x01b)") ++ ++cpp_quote("#define XACTENGINE_E_AUDITION_WRITEFILE XACTENGINEERROR(0x101)") ++cpp_quote("#define XACTENGINE_E_AUDITION_NOSOUNDBANK XACTENGINEERROR(0x102)") ++cpp_quote("#define XACTENGINE_E_AUDITION_INVALIDRPCINDEX XACTENGINEERROR(0x103)") ++cpp_quote("#define XACTENGINE_E_AUDITION_MISSINGDATA XACTENGINEERROR(0x104)") ++cpp_quote("#define XACTENGINE_E_AUDITION_UNKNOWNCOMMAND XACTENGINEERROR(0x105)") ++cpp_quote("#define XACTENGINE_E_AUDITION_INVALIDDSPINDEX XACTENGINEERROR(0x106)") ++cpp_quote("#define XACTENGINE_E_AUDITION_MISSINGWAVE XACTENGINEERROR(0x107)") ++cpp_quote("#define XACTENGINE_E_AUDITION_CREATEDIRECTORYFAILED XACTENGINEERROR(0x108)") ++cpp_quote("#define XACTENGINE_E_AUDITION_INVALIDSESSION XACTENGINEERROR(0x109)") +-- +2.25.1 + diff --git a/patches/xactengine-initial/0015-include-Add-XACT-defines.patch b/patches/xactengine-initial/0015-include-Add-XACT-defines.patch new file mode 100644 index 000000000..061a5b994 --- /dev/null +++ b/patches/xactengine-initial/0015-include-Add-XACT-defines.patch @@ -0,0 +1,67 @@ +From ccb258005d6e7c6be189ef19c7919caea0502336 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Sat, 18 Jan 2020 18:45:24 +1100 +Subject: [PATCH] include: Add XACT defines + +--- + include/xact3.idl | 37 +++++++++++++++++++++++++++++++++++++ + 1 file changed, 37 insertions(+) + +diff --git a/include/xact3.idl b/include/xact3.idl +index 87fd2e86f5..c193ecf831 100644 +--- a/include/xact3.idl ++++ b/include/xact3.idl +@@ -21,6 +21,9 @@ import "xaudio2.idl"; + + import "xact3wb.h"; + ++cpp_quote("#include ") ++cpp_quote("#include ") ++ + [ + uuid(bcc782bc-6492-4c22-8c35-f5d72fe73c6e) + ] +@@ -285,6 +288,40 @@ cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEDESTROYED + cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEBANKPREPARED = 17;") + cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEBANKSTREAMING_INVALIDCONTENT = 18;") + ++cpp_quote("static const XACTTIME XACTTIME_MIN = INT_MIN;") ++cpp_quote("static const XACTTIME XACTTIME_MAX = INT_MAX;") ++cpp_quote("static const XACTTIME XACTTIME_INFINITE = INT_MAX;") ++cpp_quote("static const XACTINSTANCELIMIT XACTINSTANCELIMIT_INFINITE = 0xff;") ++cpp_quote("static const XACTINSTANCELIMIT XACTINSTANCELIMIT_MIN = 0x00;") ++cpp_quote("static const XACTINSTANCELIMIT XACTINSTANCELIMIT_MAX = 0xfe;") ++cpp_quote("static const XACTINDEX XACTINDEX_MIN = 0x00;") ++cpp_quote("static const XACTINDEX XACTINDEX_MAX = 0xfffe;") ++cpp_quote("static const XACTINDEX XACTINDEX_INVALID = 0xffff;") ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_MIN = 0x00;") ++cpp_quote("static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_MAX = 0xff;") ++cpp_quote("static const XACTVARIABLEVALUE XACTVARIABLEVALUE_MIN = -FLT_MAX;") ++cpp_quote("static const XACTVARIABLEVALUE XACTVARIABLEVALUE_MAX = FLT_MAX;") ++cpp_quote("static const XACTVARIABLEINDEX XACTVARIABLEINDEX_MIN = 0x0000;") ++cpp_quote("static const XACTVARIABLEINDEX XACTVARIABLEINDEX_MAX = 0xfffe;") ++cpp_quote("static const XACTVARIABLEINDEX XACTVARIABLEINDEX_INVALID = 0xffff;") ++cpp_quote("static const XACTCATEGORY XACTCATEGORY_MIN = 0x0;") ++cpp_quote("static const XACTCATEGORY XACTCATEGORY_MAX = 0xfffe;") ++cpp_quote("static const XACTCATEGORY XACTCATEGORY_INVALID = 0xffff;") ++cpp_quote("static const XACTCHANNEL XACTCHANNEL_MIN = 0;") ++cpp_quote("static const XACTCHANNEL XACTCHANNEL_MAX = 0xff;") ++cpp_quote("static const XACTPITCH XACTPITCH_MIN = -1200;") ++cpp_quote("static const XACTPITCH XACTPITCH_MAX = 1200;") ++cpp_quote("static const XACTPITCH XACTPITCH_MIN_TOTAL = -2400;") ++cpp_quote("static const XACTPITCH XACTPITCH_MAX_TOTAL = 2400;") ++cpp_quote("static const XACTVOLUME XACTVOLUME_MIN = 0.0f;") ++cpp_quote("static const XACTVOLUME XACTVOLUME_MAX = 16777216.0f;") ++cpp_quote("static const XACTVARIABLEVALUE XACTPARAMETERVALUE_MIN = -FLT_MAX;") ++cpp_quote("static const XACTVARIABLEVALUE XACTPARAMETERVALUE_MAX = FLT_MAX;") ++cpp_quote("static const XACTLOOPCOUNT XACTLOOPCOUNT_MIN = 0x00;") ++cpp_quote("static const XACTLOOPCOUNT XACTLOOPCOUNT_MAX = 0xfe;") ++cpp_quote("static const XACTLOOPCOUNT XACTLOOPCOUNT_INFINITE = 0xff;") ++cpp_quote("static const DWORD XACTWAVEALIGNMENT_MIN = 2048;") ++ + [ + object, + local, +-- +2.25.1 + diff --git a/patches/xactengine-initial/0016-xaudio2_7-tests-Add-more-tests.patch b/patches/xactengine-initial/0016-xaudio2_7-tests-Add-more-tests.patch new file mode 100644 index 000000000..b9b8a2141 --- /dev/null +++ b/patches/xactengine-initial/0016-xaudio2_7-tests-Add-more-tests.patch @@ -0,0 +1,217 @@ +From 26d4f62fcf18beb2ffc6b5bdd55b058b375f5c54 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Sat, 18 Jan 2020 18:50:34 +1100 +Subject: [PATCH] xaudio2_7/tests: Add more tests + +--- + dlls/xaudio2_7/tests/Makefile.in | 5 +- + dlls/xaudio2_7/tests/globals.xgs | Bin 0 -> 440 bytes + dlls/xaudio2_7/tests/rsrc.rc | 22 +++++++ + dlls/xaudio2_7/tests/xact.c | 99 ++++++++++++++++++++++++++----- + 4 files changed, 111 insertions(+), 15 deletions(-) + create mode 100644 dlls/xaudio2_7/tests/globals.xgs + create mode 100644 dlls/xaudio2_7/tests/rsrc.rc + +diff --git a/dlls/xaudio2_7/tests/Makefile.in b/dlls/xaudio2_7/tests/Makefile.in +index ecd728d659..1bb39cc562 100644 +--- a/dlls/xaudio2_7/tests/Makefile.in ++++ b/dlls/xaudio2_7/tests/Makefile.in +@@ -1,6 +1,9 @@ + TESTDLL = xaudio2_7.dll +-IMPORTS = ole32 ++IMPORTS = ole32 x3daudio1_7 + + C_SRCS = \ + xact.c \ + xaudio2.c ++ ++RC_SRCS = \ ++ rsrc.rc +diff --git a/dlls/xaudio2_7/tests/globals.xgs b/dlls/xaudio2_7/tests/globals.xgs +new file mode 100644 +index 0000000000000000000000000000000000000000..37bd75b44d64fdf0862ba41c5548ec140f6607e6 +GIT binary patch +literal 440 +zcmZ8cF;2rk5FFb;L=nLwsF0vai3CxsL@7cLMuL*V*@R0jXUjgf$Uoo@e1L`@Af=?E +z-~&8>iq5R>EJ(Q1&d!YXR&zIlsDF$@e3d63Q8j;i_ksW|?DKVJ#BIT~;`-!jd%zLb +zH}h-m)%sztc3%9-GGL7bdyU7f4FAOKyuTsZZmjbPbb2hxQ)iTCyY)*e4$QC_W68qX +zjKPuo#&H4buxwgv+0X-(+zEw{rlL>=qav3vd<6d%0Uox0J@?-kFW5q6*F0E!wD`oh +zgJ;Xni)F8%q0WuaG3DqQBjUxCToNuxk;uvNaVAL{VPvAadZq|rlBSBX3u)r}C>Ba& +Sh*F}-cp4>zo* + #include ++#include ++#include + + #define COBJMACROS + #include "wine/test.h" + + #include "xact3.h" ++#include "x3daudio.h" + + #include "initguid.h" +-DEFINE_GUID(IID_IXACT3Engine301, 0xe72c1b9a, 0xd717, 0x41c0, 0x81, 0xa6, 0x50, 0xeb, 0x56, 0xe8, 0x06, 0x49); ++DEFINE_GUID(IID_IXACT3Engine31, 0xe72c1b9a, 0xd717, 0x41c0, 0x81, 0xa6, 0x50, 0xeb, 0x56, 0xe8, 0x06, 0x49); ++ ++DEFINE_GUID(CLSID_XACTEngine30, 0x3b80ee2a, 0xb0f5, 0x4780, 0x9e,0x30, 0x90,0xcb,0x39,0x68,0x5b,0x03); ++DEFINE_GUID(CLSID_XACTEngine31, 0x962f5027, 0x99be, 0x4692, 0xa4,0x68, 0x85,0x80,0x2c,0xf8,0xde,0x61); ++DEFINE_GUID(CLSID_XACTEngine32, 0xd3332f02, 0x3dd0, 0x4de9, 0x9a,0xec, 0x20,0xd8,0x5c,0x41,0x11,0xb6); ++DEFINE_GUID(CLSID_XACTEngine33, 0x94c1affa, 0x66e7, 0x4961, 0x95,0x21, 0xcf,0xde,0xf3,0x12,0x8d,0x4f); ++DEFINE_GUID(CLSID_XACTEngine34, 0x0977d092, 0x2d95, 0x4e43, 0x8d,0x42, 0x9d,0xdc,0xc2,0x54,0x5e,0xd5); ++DEFINE_GUID(CLSID_XACTEngine35, 0x074b110f, 0x7f58, 0x4743, 0xae,0xa5, 0x12,0xf1,0x5b,0x50,0x74,0xed); ++DEFINE_GUID(CLSID_XACTEngine36, 0x248d8a3b, 0x6256, 0x44d3, 0xa0,0x18, 0x2a,0xc9,0x6c,0x45,0x9f,0x47); + + struct xact_interfaces + { +@@ -35,25 +46,25 @@ struct xact_interfaces + BOOL todo; + } xact_interfaces[] = + { +- {&CLSID_XACTEngine30, &IID_IXACT3Engine301, E_NOINTERFACE, TRUE }, +- {&CLSID_XACTEngine30, &IID_IXACT3Engine, E_NOINTERFACE, TRUE }, ++ {&CLSID_XACTEngine30, &IID_IXACT3Engine31, E_NOINTERFACE, TRUE }, ++ {&CLSID_XACTEngine30, &IID_IXACT3Engine, E_NOINTERFACE, TRUE }, + + /* Version 3.1 to 3.4 use the same inteface */ +- {&CLSID_XACTEngine31, &IID_IXACT3Engine301, S_OK }, +- {&CLSID_XACTEngine32, &IID_IXACT3Engine301, S_OK }, +- {&CLSID_XACTEngine33, &IID_IXACT3Engine301, S_OK }, +- {&CLSID_XACTEngine34, &IID_IXACT3Engine301, S_OK }, ++ {&CLSID_XACTEngine31, &IID_IXACT3Engine31, S_OK }, ++ {&CLSID_XACTEngine32, &IID_IXACT3Engine31, S_OK }, ++ {&CLSID_XACTEngine33, &IID_IXACT3Engine31, S_OK }, ++ {&CLSID_XACTEngine34, &IID_IXACT3Engine31, S_OK }, + + /* Version 3.5 to 3.7 use the same inteface */ +- {&CLSID_XACTEngine35, &IID_IXACT3Engine301, E_NOINTERFACE }, +- {&CLSID_XACTEngine35, &IID_IXACT3Engine, S_OK }, ++ {&CLSID_XACTEngine35, &IID_IXACT3Engine31, E_NOINTERFACE }, ++ {&CLSID_XACTEngine35, &IID_IXACT3Engine, S_OK }, + +- {&CLSID_XACTEngine36, &IID_IXACT3Engine301, E_NOINTERFACE }, +- {&CLSID_XACTEngine36, &IID_IXACT3Engine, S_OK }, ++ {&CLSID_XACTEngine36, &IID_IXACT3Engine31, E_NOINTERFACE }, ++ {&CLSID_XACTEngine36, &IID_IXACT3Engine, S_OK }, + +- {&CLSID_XACTEngine37, &IID_IXACT3Engine301, E_NOINTERFACE }, +- {&CLSID_XACTEngine37, &IID_IXACT3Engine, S_OK }, +- {&CLSID_XACTEngine37, &IID_IUnknown, S_OK }, ++ {&CLSID_XACTEngine, &IID_IXACT3Engine31, E_NOINTERFACE }, ++ {&CLSID_XACTEngine, &IID_IXACT3Engine, S_OK }, ++ {&CLSID_XACTEngine, &IID_IUnknown, S_OK }, + }; + + static void test_interfaces(void) +@@ -78,11 +89,71 @@ static void test_interfaces(void) + } + } + ++static void test_global_properties(void) ++{ ++ HRESULT hr; ++ IXACT3Engine *engine; ++ XACTVARIABLEINDEX index; ++ XACTVARIABLEVALUE value; ++ HRSRC res; ++ void *ptr; ++ XACT_RUNTIME_PARAMETERS xparams = {0}; ++ WAVEFORMATEXTENSIBLE format; ++ X3DAUDIO_HANDLE instance = {0}; ++ ++ hr = CoCreateInstance(&CLSID_XACTEngine, NULL, CLSCTX_INPROC_SERVER, &IID_IXACT3Engine, (void**)&engine); ++ ++ if (FAILED(hr)) ++ { ++ win_skip("IXACT3Engine Unsupported.\n"); ++ return; ++ } ++ ++ index = IXACT3Engine_GetGlobalVariableIndex(engine, "SpeedOfSound"); ++ ok(index == XACTVARIABLEINDEX_INVALID , "Found variable 0x%08x\n", index); ++ ++ res = FindResourceW(NULL, L"globals.xgs", (LPCWSTR)RT_RCDATA); ++ ++ ptr = LockResource(LoadResource(GetModuleHandleA(NULL), res)); ++ ++ xparams.lookAheadTime = 250; ++ xparams.globalSettingsBufferSize = SizeofResource( GetModuleHandleA(NULL), res); ++ xparams.pGlobalSettingsBuffer = ptr; ++ hr = IXACT3Engine_Initialize(engine, &xparams); ++ ok(hr == S_OK || ++ hr == XAUDIO2_E_INVALID_CALL /* Vista */, "got 0x%08x\n", hr); ++ if (FAILED(hr)) ++ goto end; ++ ++ index = IXACT3Engine_GetGlobalVariableIndex(engine, "SpeedOfSound"); ++ ok(index != XACTVARIABLEINDEX_INVALID, "Failed to find variable %d\n", index); ++ ++ value = 0.1f; ++ hr = IXACT3Engine_GetGlobalVariable(engine, index, &value); ++ ok(hr == S_OK, "got 0x%08x\n", hr); ++ ok(value == 0.0f, "got %f\n", value); ++ ++ hr = IXACT3Engine_GetFinalMixFormat(engine, &format); ++ ok(hr == S_OK, "got 0x%08x\n", hr); ++ ++ /* Invalid SpeedOfSound value */ ++ X3DAudioInitialize(format.dwChannelMask, value, instance); ++ ok(instance[0] != 0, "got 0x%08x\n", instance[0]); ++ ++ hr = IXACT3Engine_GetGlobalVariable(engine, index, &value); ++ ok(hr == S_OK, "got 0x%08x\n", hr); ++ ok(value == 0.0f, "got %f\n", value); ++ ++end: ++ IXACT3Engine_Release(engine); ++} ++ + START_TEST(xact) + { + CoInitialize(NULL); + + test_interfaces(); ++ test_global_properties(); + + CoUninitialize(); + } +-- +2.25.1 + diff --git a/patches/xactengine-initial/definition b/patches/xactengine-initial/definition new file mode 100644 index 000000000..caa598048 --- /dev/null +++ b/patches/xactengine-initial/definition @@ -0,0 +1,6 @@ +Fixes: [31476] Support Bully Scholarship Edition xactengine3_1.dll. +Fixes: [38615] DSA: Drakensang Demo fails on IXACTEngine::Initialize +Fixes: [41030] Pac-Man Museum requires xactengine3_7 +Fixes: [41045] Captain Morgane requires xactengine3_4 +Fixes: [48684] BlazBlue: Calamity Trigger requires for xactengine 3.3 interface. +