@@ -299,6 +299,43 @@ void Sys_CreateMainWindowClass(){
299299 }
300300}
301301
302+ void Sys_LoadModules (HINSTANCE hInstance ){
303+ HINSTANCE base ;
304+ FARPROC proc ;
305+ int i , copylen ;
306+ char moduledir [1024 ];
307+ char mss32path [1024 ];
308+ char miles32path [1024 ];
309+ static qboolean loaded = qfalse ;
310+ char * find ;
311+
312+ if (loaded == qtrue )
313+ return ;
314+
315+ copylen = GetModuleFileNameA (hInstance , moduledir , sizeof (moduledir ));
316+
317+ if (copylen < 1 || strrchr (moduledir , '\\' ) == NULL )
318+ {
319+ Q_strncpyz (miles32path , "miles32.dll" , sizeof (miles32path ));
320+ } else {
321+ find = strrchr (moduledir , '\\' );
322+ * find = '\0' ;
323+ Com_sprintf (miles32path , sizeof (miles32path ), "%s\\miles32.dll" , moduledir );
324+ }
325+
326+
327+ base = LoadLibraryA (miles32path );
328+
329+ if (!base ){
330+ preInitError ("Error loading module mss32.dll\n" );
331+ }
332+ proc = GetProcAddress (base , "_AIL_set_DirectSound_HWND@8" );
333+ if (!proc )
334+ preInitError ("No entry point for procedure _AIL_set_DirectSound_HWND\n" );
335+
336+ mss .AIL_set_DirectSound_HWND_int = (void * )proc ;
337+ }
338+
302339//================================================================
303340
304341static char exeFilename [ MAX_STRING_CHARS ] = { 0 };
@@ -643,6 +680,8 @@ __declspec( dllexport ) int CALLBACK WinMain( HINSTANCE hInstance, HINSTANCE hPr
643680
644681 Sys_InitLocalization ();
645682
683+ Sys_LoadModules (hInstance );
684+
646685 Com_sprintf (UPDATE_VERSION , sizeof (UPDATE_VERSION ), "%s" , UPDATE_VERSION_NUM );
647686
648687 if (!strstr (lpCmdLine , "allowdupe" ) && !strstr (lpCmdLine , "dedicated" ) && !strstr (lpCmdLine , "installupdatefiles" ) && !strstr (lpCmdLine , "ui_playerProfileAlreadyChosen" ))
0 commit comments