From be12560248cda86d9f17f84e82bb35ae3785b2f1 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 28 Jul 2024 10:18:01 -0700 Subject: [PATCH] SDL3 fixes (#31) --- ISLE/isleapp.cpp | 8 +++----- LEGO1/omni/src/system/mxsemaphore.cpp | 2 +- LEGO1/omni/src/system/mxthread.cpp | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index f365a6db..fcab82fb 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -179,8 +179,8 @@ MxS32 IsleApp::SetupLegoOmni() GetProfileStringA("LEGO Island", "MediaPath", "", mediaPath, sizeof(mediaPath)); // [library:window] For now, get the underlying Windows HWND to pass into Omni - HWND hwnd = - (HWND) SDL_GetProperty(SDL_GetWindowProperties(m_windowHandle), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL); + HWND hwnd = (HWND + ) SDL_GetPointerProperty(SDL_GetWindowProperties(m_windowHandle), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL); #ifdef COMPAT_MODE MxS32 failure; @@ -512,7 +512,6 @@ MxResult IsleApp::SetupWindow() // FUNCTION: ISLE 0x4028d0 void IsleApp::LoadConfig() { - char* basePath = SDL_GetBasePath(); char* prefPath = SDL_GetPrefPath("isledecomp", "isle"); char* iniConfig; if (m_iniPath) { @@ -528,7 +527,7 @@ void IsleApp::LoadConfig() dictionary* dict = iniparser_load(iniConfig); - const char* hdPath = iniparser_getstring(dict, "isle:diskpath", basePath); + const char* hdPath = iniparser_getstring(dict, "isle:diskpath", SDL_GetBasePath()); m_hdPath = new char[strlen(hdPath) + 1]; strcpy(m_hdPath, hdPath); MxOmni::SetHD(m_hdPath); @@ -581,7 +580,6 @@ void IsleApp::LoadConfig() iniparser_freedict(dict); delete[] iniConfig; SDL_free(prefPath); - SDL_free(basePath); } // FUNCTION: ISLE 0x402c20 diff --git a/LEGO1/omni/src/system/mxsemaphore.cpp b/LEGO1/omni/src/system/mxsemaphore.cpp index edeb0f60..a4db127b 100644 --- a/LEGO1/omni/src/system/mxsemaphore.cpp +++ b/LEGO1/omni/src/system/mxsemaphore.cpp @@ -35,5 +35,5 @@ void MxSemaphore::Wait() void MxSemaphore::Release() { // [library:synchronization] Removed release count since only 1 is ever requested - SDL_PostSemaphore(m_semaphore); + SDL_SignalSemaphore(m_semaphore); } diff --git a/LEGO1/omni/src/system/mxthread.cpp b/LEGO1/omni/src/system/mxthread.cpp index 79c52459..2f6c1814 100644 --- a/LEGO1/omni/src/system/mxthread.cpp +++ b/LEGO1/omni/src/system/mxthread.cpp @@ -28,8 +28,8 @@ MxResult MxThread::Start(MxS32 p_stack, MxS32 p_flag) if (m_semaphore.Init(0, 1) == SUCCESS) { const SDL_PropertiesID props = SDL_CreateProperties(); - SDL_SetProperty(props, SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER, (void*) MxThread::ThreadProc); - SDL_SetProperty(props, SDL_PROP_THREAD_CREATE_USERDATA_POINTER, this); + SDL_SetPointerProperty(props, SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER, (void*) MxThread::ThreadProc); + SDL_SetPointerProperty(props, SDL_PROP_THREAD_CREATE_USERDATA_POINTER, this); SDL_SetNumberProperty(props, SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER, p_stack << 2); if ((m_thread = SDL_CreateThreadWithProperties(props))) {