13
13
14
14
#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
15
15
16
+ #include < SDL.h>
17
+
16
18
#ifdef WIN32
17
19
#include < windows.h>
18
20
#include < process.h>
@@ -96,7 +98,7 @@ static bool g_bSystemRelaunch = false;
96
98
static char szMasterCDFolder[_MAX_PATH];
97
99
98
100
#ifdef WIN32
99
- static HMODULE g_hSystemHandle=NULL ;
101
+ static void * g_hSystemHandle=NULL ;
100
102
#define DLL_SYSTEM " CrySystem.dll"
101
103
#define DLL_GAME " CryGame.dll"
102
104
#endif
@@ -645,7 +647,9 @@ InvokeExternalConfigTool()
645
647
// ////////////////////////////////////////////////////////////////////////
646
648
bool RunGame (HINSTANCE hInstance,const char *sCmdLine )
647
649
{
648
- InvokeExternalConfigTool ();
650
+ SDL_Init (SDL_INIT_EVERYTHING);
651
+
652
+ // InvokeExternalConfigTool();
649
653
650
654
HWND hWnd=NULL ;
651
655
// initialize the system
@@ -673,26 +677,27 @@ bool RunGame(HINSTANCE hInstance,const char *sCmdLine)
673
677
#ifndef _XBOX
674
678
// ///////////////////////////////////////////////////
675
679
// ///////////////////////////////////////////////////
676
- if (!hWnd && !RegisterWindow (hInstance))
677
- {
678
- if (!hWnd && RegisterWindow (hInstance))
679
- {
680
- MessageBox (0 , " Cannot Register Window\n " , " Error" , MB_OK | MB_DEFAULT_DESKTOP_ONLY);
681
- return false ;
682
- }
683
- }
684
-
685
- g_hSystemHandle = LoadLibrary (DLL_SYSTEM);
680
+ // if (!hWnd && !RegisterWindow(hInstance))
681
+ // {
682
+ // if (!hWnd && RegisterWindow(hInstance))
683
+ // {
684
+ // MessageBox(0, "Cannot Register Window\n", "Error", MB_OK | MB_DEFAULT_DESKTOP_ONLY);
685
+ // return false;
686
+ // }
687
+ // }
688
+
689
+ g_hSystemHandle = SDL_LoadObject (DLL_SYSTEM);
686
690
if (!g_hSystemHandle)
687
691
{
688
- DWORD dwLastError = GetLastError ();
692
+ string errorStr = " CrySystem.dll Loading Failed:\n " ;
693
+ errorStr += SDL_GetError ();
694
+
695
+ SDL_ShowSimpleMessageBox (SDL_MESSAGEBOX_ERROR, " FarCry Error" , errorStr.c_str (), nullptr );
689
696
690
- MessageBox ( NULL ,(" CrySystem.dll Loading Failed:\n " + TryFormatWinError (dwLastError)).c_str ()," FarCry Error" ,MB_OK|MB_ICONERROR );
691
697
return false ;
692
698
}
693
699
694
- PFNCREATESYSTEMINTERFACE pfnCreateSystemInterface =
695
- (PFNCREATESYSTEMINTERFACE)::GetProcAddress ( g_hSystemHandle," CreateSystemInterface" );
700
+ PFNCREATESYSTEMINTERFACE pfnCreateSystemInterface = (PFNCREATESYSTEMINTERFACE)SDL_LoadFunction ( g_hSystemHandle," CreateSystemInterface" );
696
701
697
702
// Initialize with instance and window handles.
698
703
sip.hInstance = hInstance;
@@ -704,7 +709,7 @@ bool RunGame(HINSTANCE hInstance,const char *sCmdLine)
704
709
g_pISystem = pfnCreateSystemInterface ( sip );
705
710
if (!g_pISystem)
706
711
{
707
- MessageBox ( NULL , " CreateSystemInterface Failed " , " FarCry Error " ,MB_OK|MB_ICONERROR );
712
+ SDL_ShowSimpleMessageBox (SDL_MESSAGEBOX_ERROR, " FarCry Error " , " CreateSystemInterface Failed " , nullptr );
708
713
return false ;
709
714
}
710
715
#else
@@ -746,7 +751,7 @@ bool RunGame(HINSTANCE hInstance,const char *sCmdLine)
746
751
747
752
if (!g_pISystem->CreateGame ( ip ))
748
753
{
749
- MessageBox ( NULL , " CreateGame Failed: CryGame.dll" ," FarCry Error " ,MB_OK|MB_ICONERROR );
754
+ SDL_ShowSimpleMessageBox ( SDL_MESSAGEBOX_ERROR, " FarCry Error " , " CreateGame Failed: CryGame.dll" , nullptr );
750
755
return false ;
751
756
}
752
757
@@ -848,7 +853,8 @@ bool RunGame(HINSTANCE hInstance,const char *sCmdLine)
848
853
*/
849
854
850
855
if (!bRelaunch)
851
- ::FreeLibrary (g_hSystemHandle);
856
+ SDL_UnloadObject (g_hSystemHandle);
857
+
852
858
g_hSystemHandle= NULL ;
853
859
854
860
if (hWnd)
0 commit comments