feat(deps): Replace the Bink SDK and Miles SDK stubs with runtime loaders - #3272
Conversation
PR Summary by QodoRuntime-load Bink and Miles DLLs after working-directory setup
AI Description
Diagram
High-Level Assessment
Files changed (22)
|
Code Review by Qodo
1.
|
|
| Filename | Overview |
|---|---|
| Dependencies/Bink/BinkLoader.cpp | Implements reference-counted runtime loading and fallback forwarding for the Bink API. |
| Dependencies/Miles/MilesLoader.cpp | Implements runtime export resolution and neutral fallbacks for the Miles API surface. |
| Core/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp | Integrates Miles loading with audio-device startup and balances the acquisition during shutdown. |
| Core/GameEngineDevice/Source/VideoDevice/Bink/BinkVideoPlayer.cpp | Loads Bink during video initialization and releases the loader reference during deinitialization. |
| Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp | Integrates the Miles runtime loader with the WWAudio object lifecycle. |
| CMakeLists.txt | Replaces generated SDK-stub setup with the new Bink and Miles loader subdirectories. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
App[Game or WWAudio initialization] --> Loader{Runtime loader}
Loader -->|LoadLibrary succeeds| DLL[Bink or Miles DLL]
DLL --> API[Forward API calls]
Loader -->|DLL unavailable| Fallback[Neutral fallback behavior]
Fallback --> Disabled[Video or audio remains disabled]
API --> Teardown[Paired unload during teardown]
Disabled --> Teardown
Reviews (3): Last reviewed commit: "refactor(miles): Fix the written primiti..." | Re-trigger Greptile
OmniBlade
left a comment
There was a problem hiding this comment.
Looks fairly straight forward, just one question on refcounting.
…(#3272) The Bink SDK stub was linked as an import library, so binkw32.dll had to be resolvable while the process image was still loading, long before WinMain and therefore long before the command line was parsed. That is why -setCwd could not point a build at a retail installation: the working directory it selects is set far too late to influence how the library is found. BinkLoader loads binkw32.dll explicitly once BinkVideoPlayer is initialized, at which point the working directory is final. The Bink functions declared in bink.h are now ordinary functions that forward to the matching export of the loaded module, so no call site changes. An unresolved function returns the same neutral value the stub library returned, which means a missing binkw32.dll disables video playback instead of preventing the game from starting. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…er (#3272) The Miles SDK stub was linked as an import library, so mss32.dll had to be resolvable while the process image was still loading, long before WinMain and therefore long before the command line was parsed. That is why -setCwd could not point a build at a retail installation: the working directory it selects is set far too late to influence how the library is found. MilesLoader loads mss32.dll explicitly once the audio device is opened, at which point the working directory is final. The Miles functions declared in mss/mss.h are now ordinary functions that forward to the matching export of the loaded module, so no call site changes. An unresolved function returns the same neutral value the stub library returned, which means a missing mss32.dll turns audio off instead of preventing the game from starting. Nine declarations were dropped along the way, because the retail mss32.dll does not export them and nothing has called them since they were replaced by their volume_pan counterparts: AIL_sample_volume, AIL_set_sample_volume, AIL_sample_pan, AIL_set_sample_pan and the four stream equivalents, plus AIL_open_stream_by_sample. The MSS_auto_cleanup hook was dropped as well, because its atexit handler would have called AIL_shutdown after the module was already freed. All 92 remaining exports were verified to resolve against the retail mss32.dll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… call sites; no ABI changes (#3272)
875e5e9 to
c795f10
Compare
…3272) The Bink SDK stub was linked as an import library, so binkw32.dll had to be resolvable while the process image was still loading, long before WinMain and therefore long before the command line was parsed. That is why -setCwd could not point a build at a retail installation: the working directory it selects is set far too late to influence how the library is found. BinkLoader loads binkw32.dll explicitly once BinkVideoPlayer is initialized, at which point the working directory is final. The Bink functions declared in bink.h are now ordinary functions that forward to the matching export of the loaded module, so no call site changes. An unresolved function returns the same neutral value the stub library returned, which means a missing binkw32.dll disables video playback instead of preventing the game from starting. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…er (#3272) The Miles SDK stub was linked as an import library, so mss32.dll had to be resolvable while the process image was still loading, long before WinMain and therefore long before the command line was parsed. That is why -setCwd could not point a build at a retail installation: the working directory it selects is set far too late to influence how the library is found. MilesLoader loads mss32.dll explicitly once the audio device is opened, at which point the working directory is final. The Miles functions declared in mss/mss.h are now ordinary functions that forward to the matching export of the loaded module, so no call site changes. An unresolved function returns the same neutral value the stub library returned, which means a missing mss32.dll turns audio off instead of preventing the game from starting. Nine declarations were dropped along the way, because the retail mss32.dll does not export them and nothing has called them since they were replaced by their volume_pan counterparts: AIL_sample_volume, AIL_set_sample_volume, AIL_sample_pan, AIL_set_sample_pan and the four stream equivalents, plus AIL_open_stream_by_sample. The MSS_auto_cleanup hook was dropped as well, because its atexit handler would have called AIL_shutdown after the module was already freed. All 92 remaining exports were verified to resolve against the retail mss32.dll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Merge with Rebase
This change has 3 commits:
It uses the original Bink and Miles stubs from OmniBlade as the base and built around it.
The benefit of this approach is that
AI use
This change was mostly a one-shot generation with Claude Opus 5. I just cleaned up the comments and cleaned up a few minor things. But overall it looked very solid to begin with.
TODO