summaryrefslogtreecommitdiff
path: root/platform/windows/os_windows.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/windows/os_windows.cpp')
-rw-r--r--platform/windows/os_windows.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index e3af82b629..22294005f6 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -929,7 +929,7 @@ typedef enum _SHC_PROCESS_DPI_AWARENESS {
SHC_PROCESS_PER_MONITOR_DPI_AWARE = 2
} SHC_PROCESS_DPI_AWARENESS;
-void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
+Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
main_loop = NULL;
outside = true;
@@ -975,7 +975,7 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
if (!RegisterClassExW(&wc)) {
MessageBox(NULL, "Failed To Register The Window Class.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
- return; // Return
+ return ERR_UNAVAILABLE;
}
pre_fs_valid = true;
@@ -1045,7 +1045,7 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
RECT rect;
if (!GetClientRect(hWnd, &rect)) {
MessageBoxW(NULL, L"Window Creation Error.", L"ERROR", MB_OK | MB_ICONEXCLAMATION);
- return; // Return FALSE
+ return ERR_UNAVAILABLE;
};
video_mode.width = rect.right;
video_mode.height = rect.bottom;
@@ -1063,7 +1063,7 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
NULL, NULL, hInstance, NULL);
if (!hWnd) {
MessageBoxW(NULL, L"Window Creation Error.", L"ERROR", MB_OK | MB_ICONEXCLAMATION);
- return; // Return FALSE
+ return ERR_UNAVAILABLE;
}
};
@@ -1127,6 +1127,8 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
SetForegroundWindow(hWnd); // Slightly Higher Priority
SetFocus(hWnd); // Sets Keyboard Focus To
}
+
+ return OK;
}
void OS_Windows::set_clipboard(const String &p_text) {
@@ -1631,6 +1633,13 @@ void OS_Windows::_update_window_style(bool repaint) {
Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
+ String path = p_path;
+
+ if (!FileAccess::exists(path)) {
+ //this code exists so gdnative can load .dll files from within the executable path
+ path = get_executable_path().get_base_dir().plus_file(p_path.get_file());
+ }
+
typedef DLL_DIRECTORY_COOKIE(WINAPI * PAddDllDirectory)(PCWSTR);
typedef BOOL(WINAPI * PRemoveDllDirectory)(DLL_DIRECTORY_COOKIE);
@@ -1641,10 +1650,10 @@ Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_han
DLL_DIRECTORY_COOKIE cookie;
if (p_also_set_library_path && has_dll_directory_api) {
- cookie = add_dll_directory(p_path.get_base_dir().c_str());
+ cookie = add_dll_directory(path.get_base_dir().c_str());
}
- p_library_handle = (void *)LoadLibraryExW(p_path.c_str(), NULL, (p_also_set_library_path && has_dll_directory_api) ? LOAD_LIBRARY_SEARCH_DEFAULT_DIRS : 0);
+ p_library_handle = (void *)LoadLibraryExW(path.c_str(), NULL, (p_also_set_library_path && has_dll_directory_api) ? LOAD_LIBRARY_SEARCH_DEFAULT_DIRS : 0);
if (p_also_set_library_path && has_dll_directory_api) {
remove_dll_directory(cookie);