Skip to content

Commit

Permalink
Compatibility fixes for OS::Window and dynamic library loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
DreamyCecil committed Feb 15, 2024
1 parent 131d219 commit 693a3d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Sources/Engine/Base/ErrorReporting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ void FatalError(const char *strFormat, ...)

#else
// [Cecil] SDL: Destroy the window
SDL_DestroyWindow((SDL_Window *)_hwndMain);
_hwndMain = NULL;
_hwndMain.Destroy();
#endif

// format the message in buffer
Expand Down Expand Up @@ -116,7 +115,7 @@ void WarningMessage(const char *strFormat, ...)

#else
// [Cecil] SDL: Show warning
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, TRANS("Warning"), strBuffer, (SDL_Window *)_hwndMain);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, TRANS("Warning"), strBuffer, _hwndMain);
#endif
}
}
Expand All @@ -138,7 +137,7 @@ void InfoMessage(const char *strFormat, ...)

#else
// [Cecil] SDL: Show information
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, TRANS("Information"), strBuffer, (SDL_Window *)_hwndMain);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, TRANS("Information"), strBuffer, _hwndMain);
#endif
}

Expand Down Expand Up @@ -166,7 +165,7 @@ BOOL YesNoMessage(const char *strFormat, ...)
};

const SDL_MessageBoxData msgbox = {
SDL_MESSAGEBOX_INFORMATION, (SDL_Window *)_hwndMain,
SDL_MESSAGEBOX_INFORMATION, _hwndMain,
TRANS("Question"), strBuffer, SDL_arraysize(aButtons), aButtons, NULL,
};

Expand Down
4 changes: 4 additions & 0 deletions Sources/Engine/OS/DynamicLibraries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ HMODULE OS::LoadLibOrThrow_t(const char *strLibrary) {
HMODULE hLib = OS::LoadLib(strLibrary);

if (hLib == NULL) {
#if SE1_WIN
ThrowF_t(TRANS("Cannot load DLL file '%s':\n%s"), strLibrary, GetWindowsError(GetLastError()));
#else
ThrowF_t(TRANS("Cannot load DLL file '%s':\n%s"), strLibrary, dlerror());
#endif
}

return hLib;
Expand Down
4 changes: 4 additions & 0 deletions Sources/Engine/OS/OS.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ class ENGINE_API OS {

Window(int i = NULL) : pWindow((WndHandle)(size_t)i) {};
Window(size_t i) : pWindow((WndHandle)i) {};
#if !SE1_WIN
Window(long int i) : pWindow((WndHandle)i) {};
#endif

Window(const Window &other) : pWindow(other.pWindow) {};
Window(const WndHandle pSetWindow) : pWindow(pSetWindow) {};

Expand Down

0 comments on commit 693a3d1

Please sign in to comment.