diff --git a/extern/include/python/cpython/pydebug.h b/extern/include/python/cpython/pydebug.h index f6ebd99..9bf12bb 100644 --- a/extern/include/python/cpython/pydebug.h +++ b/extern/include/python/cpython/pydebug.h @@ -13,7 +13,12 @@ Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_InspectFlag; Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_OptimizeFlag; Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_NoSiteFlag; Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_BytesWarningFlag; +#if defined(__MINGW32__) +PyAPI_FUNC(int*) M2_GetPyFrozenFlagPtr(void); +#define Py_FrozenFlag (*M2_GetPyFrozenFlagPtr()) +#else Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_FrozenFlag; +#endif Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_IgnoreEnvironmentFlag; Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_DontWriteBytecodeFlag; Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_NoUserSiteDirectory; diff --git a/extern/include/python/python.h b/extern/include/python/python.h new file mode 100644 index 0000000..84f935a --- /dev/null +++ b/extern/include/python/python.h @@ -0,0 +1,2 @@ +#pragma once +#include "Python.h" diff --git a/extern/library/DirectX/CMakeLists.txt b/extern/library/DirectX/CMakeLists.txt index c220a9c..19c0e5d 100644 --- a/extern/library/DirectX/CMakeLists.txt +++ b/extern/library/DirectX/CMakeLists.txt @@ -1,3 +1,7 @@ add_library(DirectX INTERFACE) target_include_directories(DirectX INTERFACE "${CMAKE_SOURCE_DIR}/extern/include") -target_link_libraries(DirectX INTERFACE "${CMAKE_CURRENT_LIST_DIR}/d3d9.lib" "${CMAKE_CURRENT_LIST_DIR}/d3dx9.lib" "${CMAKE_CURRENT_LIST_DIR}/dinput8.lib" "${CMAKE_CURRENT_LIST_DIR}/dxguid.lib") +if(MSVC) + target_link_libraries(DirectX INTERFACE "${CMAKE_CURRENT_LIST_DIR}/d3d9.lib" "${CMAKE_CURRENT_LIST_DIR}/d3dx9.lib" "${CMAKE_CURRENT_LIST_DIR}/dinput8.lib" "${CMAKE_CURRENT_LIST_DIR}/dxguid.lib") +else() + target_link_libraries(DirectX INTERFACE "${CMAKE_CURRENT_LIST_DIR}/d3d9.lib" "${CMAKE_CURRENT_LIST_DIR}/d3dx9.lib" "${CMAKE_CURRENT_LIST_DIR}/dinput8.lib") +endif() diff --git a/extern/library/Python/CMakeLists.txt b/extern/library/Python/CMakeLists.txt index d157ed5..e6956e0 100644 --- a/extern/library/Python/CMakeLists.txt +++ b/extern/library/Python/CMakeLists.txt @@ -1,7 +1,15 @@ add_library(Python INTERFACE) target_include_directories(Python INTERFACE "${CMAKE_SOURCE_DIR}/extern/include") -target_link_libraries(Python INTERFACE - "${CMAKE_CURRENT_LIST_DIR}/python314_static.lib" - pathcch - bcrypt -) +if(MSVC) + target_link_libraries(Python INTERFACE + "${CMAKE_CURRENT_LIST_DIR}/python314_static.lib" + pathcch + bcrypt + ) +else() + target_link_libraries(Python INTERFACE + "${CMAKE_CURRENT_LIST_DIR}/libpython314.dll.a" + pathcch + bcrypt + ) +endif() diff --git a/src/AudioLib/CMakeLists.txt b/src/AudioLib/CMakeLists.txt index 8bc7cd8..bb64730 100644 --- a/src/AudioLib/CMakeLists.txt +++ b/src/AudioLib/CMakeLists.txt @@ -1,5 +1,11 @@ file(GLOB_RECURSE FILE_SOURCES "*.h" "*.c" "*.cpp") +foreach(_source IN LISTS FILE_SOURCES) + if(IS_SYMLINK "${_source}") + list(REMOVE_ITEM FILE_SOURCES "${_source}") + endif() +endforeach() + add_library(AudioLib STATIC ${FILE_SOURCES}) target_link_libraries(AudioLib diff --git a/src/Discord/CMakeLists.txt b/src/Discord/CMakeLists.txt index 2949030..4cf2cf4 100644 --- a/src/Discord/CMakeLists.txt +++ b/src/Discord/CMakeLists.txt @@ -1,5 +1,11 @@ file(GLOB_RECURSE FILE_SOURCES "*.h" "*.c" "*.cpp") +foreach(_source IN LISTS FILE_SOURCES) + if(IS_SYMLINK "${_source}") + list(REMOVE_ITEM FILE_SOURCES "${_source}") + endif() +endforeach() + add_library(Discord STATIC ${FILE_SOURCES}) # target_link_libraries(Discord diff --git a/src/DumpProto/CMakeLists.txt b/src/DumpProto/CMakeLists.txt index 3171f98..878041b 100644 --- a/src/DumpProto/CMakeLists.txt +++ b/src/DumpProto/CMakeLists.txt @@ -1,5 +1,11 @@ file(GLOB_RECURSE FILE_SOURCES "*.h" "*.c" "*.cpp") +foreach(_source IN LISTS FILE_SOURCES) + if(IS_SYMLINK "${_source}") + list(REMOVE_ITEM FILE_SOURCES "${_source}") + endif() +endforeach() + # Use tea.cpp from EterBase instead of maintaining a local copy list(APPEND FILE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../EterBase/tea.cpp") diff --git a/src/EffectLib/CMakeLists.txt b/src/EffectLib/CMakeLists.txt index e085726..27f0b0c 100644 --- a/src/EffectLib/CMakeLists.txt +++ b/src/EffectLib/CMakeLists.txt @@ -1,5 +1,11 @@ file(GLOB_RECURSE FILE_SOURCES "*.h" "*.c" "*.cpp") +foreach(_source IN LISTS FILE_SOURCES) + if(IS_SYMLINK "${_source}") + list(REMOVE_ITEM FILE_SOURCES "${_source}") + endif() +endforeach() + add_library(EffectLib STATIC ${FILE_SOURCES}) target_link_libraries(EffectLib diff --git a/src/EterBase/CMakeLists.txt b/src/EterBase/CMakeLists.txt index 41b4b04..7779d83 100644 --- a/src/EterBase/CMakeLists.txt +++ b/src/EterBase/CMakeLists.txt @@ -1,5 +1,11 @@ file(GLOB_RECURSE FILE_SOURCES "*.h" "*.c" "*.cpp") +foreach(_source IN LISTS FILE_SOURCES) + if(IS_SYMLINK "${_source}") + list(REMOVE_ITEM FILE_SOURCES "${_source}") + endif() +endforeach() + add_library(EterBase STATIC ${FILE_SOURCES}) target_link_libraries(EterBase diff --git a/src/EterBase/Debug.h b/src/EterBase/Debug.h index f4df674..63c1ac8 100644 --- a/src/EterBase/Debug.h +++ b/src/EterBase/Debug.h @@ -19,7 +19,6 @@ extern void Tracenf(const char* c_szFormat, ...); extern void Tracef(const char* c_szFormat, ...); extern void TraceError(const char* c_szFormat, ...); extern void TraceErrorWithoutEnter(const char* c_szFormat, ...); -// MR-11: Separate packet dump log from the main log file extern void TempTrace(const char* c_szMsg, bool errType = false); extern void TempTracef(const char* c_szFormat, bool errType = false, ...); extern void TempTracen(const char* c_szMsg, bool errType = false); @@ -27,13 +26,12 @@ extern void TempTracenf(const char* c_szFormat, bool errType = false, ...); extern void PacketDump(const char* c_szMsg); extern void PacketDumpf(const char* c_szFormat, ...); -// MR-11: -- END OF -- Separate packet dump log from the main log file -extern void LogBox(const char* c_szMsg, const char * c_szCaption = NULL, HWND hWnd = NULL); +extern void LogBox(const char* c_szMsg, const char* c_szCaption = NULL, HWND hWnd = NULL); extern void LogBoxf(const char* c_szMsg, ...); extern void LogFile(const char* c_szMsg); -extern void LogFilef(const char * c_szMessage, ...); +extern void LogFilef(const char* c_szMessage, ...); extern void OpenConsoleWindow(void); extern void CloseConsoleWindow(); extern void SetupLog(void); @@ -43,12 +41,12 @@ extern void CloseLogFile(); extern HWND g_PopupHwnd; -#define CHECK_RETURN(flag, string) \ - if (flag) \ - { \ - LogBox(string); \ - return; \ - } \ +#define CHECK_RETURN(flag, string) \ + if (flag) \ + { \ + LogBox(string); \ + return; \ + } #endif diff --git a/src/EterBase/Singleton.h b/src/EterBase/Singleton.h index 23da6ae..ffd2767 100644 --- a/src/EterBase/Singleton.h +++ b/src/EterBase/Singleton.h @@ -3,83 +3,80 @@ #include -template class CSingleton -{ - static T * ms_singleton; - -public: +template class CSingleton +{ + static T* ms_singleton; + +public: CSingleton() - { + { assert(!ms_singleton); - intptr_t offset = (intptr_t) (T*) 1 - (intptr_t) (CSingleton *) (T*) 1; - ms_singleton = (T*) ((intptr_t) this + offset); - } + intptr_t offset = (intptr_t)(T*)1 - (intptr_t)(CSingleton*)(T*)1; + ms_singleton = (T*)((intptr_t)this + offset); + } virtual ~CSingleton() - { + { assert(ms_singleton); - ms_singleton = 0; + ms_singleton = 0; } - __forceinline static T & Instance() + __forceinline static T& Instance() { assert(ms_singleton); return (*ms_singleton); } - __forceinline static T * InstancePtr() - { + __forceinline static T* InstancePtr() + { return (ms_singleton); } - __forceinline static T & instance() + __forceinline static T& instance() { assert(ms_singleton); return (*ms_singleton); } }; -template T * CSingleton ::ms_singleton = 0; +template T* CSingleton::ms_singleton = 0; -// -// singleton for non-hungarian -// template class singleton -{ - static T * ms_singleton; - -public: +{ + static T* ms_singleton; + +public: singleton() - { + { assert(!ms_singleton); - intptr_t offset = (intptr_t) (T*) 1 - (intptr_t) (singleton *) (T*) 1; - ms_singleton = (T*) ((intptr_t) this + offset); - } + intptr_t offset = (intptr_t)(T*)1 - (intptr_t)(singleton*)(T*)1; + ms_singleton = (T*)((intptr_t)this + offset); + } virtual ~singleton() - { + { assert(ms_singleton); - ms_singleton = 0; + ms_singleton = 0; } - __forceinline static T & Instance() + __forceinline static T& Instance() { assert(ms_singleton); return (*ms_singleton); } - __forceinline static T * InstancePtr() - { + __forceinline static T* InstancePtr() + { return (ms_singleton); } - __forceinline static T & instance() + __forceinline static T& instance() { assert(ms_singleton); return (*ms_singleton); } }; -template T * singleton ::ms_singleton = 0; +template T* singleton::ms_singleton = 0; #endif diff --git a/src/EterBase/error.cpp b/src/EterBase/error.cpp index b408f23..7f3a877 100644 --- a/src/EterBase/error.cpp +++ b/src/EterBase/error.cpp @@ -80,6 +80,7 @@ LONG __stdcall EterExceptionFilter(_EXCEPTION_POINTERS* pExceptionInfo) fprintf(fException, "rcx: 0x%016llx\trdx: 0x%016llx\n", context.Rcx, context.Rdx); fprintf(fException, "rsi: 0x%016llx\trdi: 0x%016llx\n", context.Rsi, context.Rdi); fprintf(fException, "rbp: 0x%016llx\trsp: 0x%016llx\n", context.Rbp, context.Rsp); + fprintf(fException, "rip: 0x%016llx\n", context.Rip); fprintf(fException, "\n"); /* diff --git a/src/EterGrnLib/CMakeLists.txt b/src/EterGrnLib/CMakeLists.txt index 4840d1c..8c0477e 100644 --- a/src/EterGrnLib/CMakeLists.txt +++ b/src/EterGrnLib/CMakeLists.txt @@ -1,5 +1,11 @@ file(GLOB_RECURSE FILE_SOURCES "*.h" "*.c" "*.cpp") +foreach(_source IN LISTS FILE_SOURCES) + if(IS_SYMLINK "${_source}") + list(REMOVE_ITEM FILE_SOURCES "${_source}") + endif() +endforeach() + add_library(EterGrnLib STATIC ${FILE_SOURCES}) target_link_libraries(EterGrnLib diff --git a/src/EterImageLib/CMakeLists.txt b/src/EterImageLib/CMakeLists.txt index eecd886..35b2e03 100644 --- a/src/EterImageLib/CMakeLists.txt +++ b/src/EterImageLib/CMakeLists.txt @@ -1,5 +1,11 @@ file(GLOB_RECURSE FILE_SOURCES "*.h" "*.c" "*.cpp") +foreach(_source IN LISTS FILE_SOURCES) + if(IS_SYMLINK "${_source}") + list(REMOVE_ITEM FILE_SOURCES "${_source}") + endif() +endforeach() + add_library(EterImageLib STATIC ${FILE_SOURCES}) target_link_libraries(EterImageLib diff --git a/src/EterLib/CMakeLists.txt b/src/EterLib/CMakeLists.txt index 7754d8b..27ed458 100644 --- a/src/EterLib/CMakeLists.txt +++ b/src/EterLib/CMakeLists.txt @@ -1,5 +1,11 @@ file(GLOB_RECURSE FILE_SOURCES "*.h" "*.c" "*.cpp") +foreach(_source IN LISTS FILE_SOURCES) + if(IS_SYMLINK "${_source}") + list(REMOVE_ITEM FILE_SOURCES "${_source}") + endif() +endforeach() + add_library(EterLib STATIC ${FILE_SOURCES}) target_link_libraries(EterLib diff --git a/src/EterLib/IME.cpp b/src/EterLib/IME.cpp index aaebce4..8bfd21f 100644 --- a/src/EterLib/IME.cpp +++ b/src/EterLib/IME.cpp @@ -5,6 +5,7 @@ #include "msctf.h" #include #include +#include #include #define COUNTOF(a) ( sizeof( a ) / sizeof( ( a )[0] ) ) @@ -66,6 +67,12 @@ enum { IMEUI_STATE_OFF, IMEUI_STATE_ON, IMEUI_STATE_ENGLISH }; #define LCID_INVARIANT MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) +#if defined(__MINGW32__) && !defined(__ITfReadingInformationUIElement_INTERFACE_DEFINED__) +#define M2_HAS_TSF_UIELEMENT_EXT 0 +#else +#define M2_HAS_TSF_UIELEMENT_EXT 1 +#endif + wchar_t s_aszIndicator[5][3] = { L"En", @@ -179,8 +186,10 @@ protected: LONG _cRef; }; +#if M2_HAS_TSF_UIELEMENT_EXT static void MakeReadingInformationString(ITfReadingInformationUIElement* preading); static void MakeCandidateStrings(ITfCandidateListUIElement* pcandidate); +#endif static ITfUIElement* GetUIElement(DWORD dwUIElementId); static BOOL GetCompartments( ITfCompartmentMgr** ppcm, ITfCompartment** ppTfOpenMode, ITfCompartment** ppTfConvMode ); static BOOL SetupCompartmentSinks( BOOL bResetOnly = FALSE, ITfCompartment* pTfOpenMode = NULL, ITfCompartment* ppTfConvMode = NULL ); @@ -1475,7 +1484,7 @@ DWORD CIME::GetImeId( UINT uIndex ) return ms_adwId[uIndex]; hklPrev = hkl; - DWORD dwLang = ((DWORD)hkl & 0xffff); + DWORD dwLang = (static_cast(reinterpret_cast(hkl)) & 0xffff); if ( ms_bUILessMode && GETLANG() == LANG_CHT ) { // In case of Vista, artifitial value is returned so that it's not considered as older IME. @@ -1734,7 +1743,7 @@ void CIME::CheckToggleState() /* Check Toggle State */ bool bIme = ImmIsIME( ms_hklCurrent ) != 0 - && ( ( 0xF0000000 & (DWORD)ms_hklCurrent ) == 0xE0000000 ); // Hack to detect IME correctly. When IME is running as TIP, ImmIsIME() returns true for CHT US keyboard. + && ((0xF0000000u & static_cast(reinterpret_cast(ms_hklCurrent))) == 0xE0000000u); // Hack to detect IME correctly. When IME is running as TIP, ImmIsIME() returns true for CHT US keyboard. ms_bChineseIME = ( GETPRIMLANG() == LANG_CHINESE ) && bIme; HIMC himc; @@ -1897,6 +1906,7 @@ STDAPI CTsfUiLessMode::CUIElementSink::BeginUIElement(DWORD dwUIElementId, BOOL if (!pElement) return E_INVALIDARG; +#if M2_HAS_TSF_UIELEMENT_EXT ITfReadingInformationUIElement *preading = NULL; ITfCandidateListUIElement *pcandidate = NULL; *pbShow = FALSE; @@ -1922,6 +1932,9 @@ STDAPI CTsfUiLessMode::CUIElementSink::BeginUIElement(DWORD dwUIElementId, BOOL CIME::ms_pEvent->OnOpenCandidateList(); pcandidate->Release(); } +#else + *pbShow = FALSE; +#endif pElement->Release(); return S_OK; @@ -1933,6 +1946,7 @@ STDAPI CTsfUiLessMode::CUIElementSink::UpdateUIElement(DWORD dwUIElementId) if (!pElement) return E_INVALIDARG; +#if M2_HAS_TSF_UIELEMENT_EXT ITfReadingInformationUIElement *preading = NULL; ITfCandidateListUIElement *pcandidate = NULL; @@ -1956,6 +1970,7 @@ STDAPI CTsfUiLessMode::CUIElementSink::UpdateUIElement(DWORD dwUIElementId) CIME::ms_pEvent->OnOpenCandidateList(); pcandidate->Release(); } +#endif pElement->Release(); return S_OK; @@ -1973,6 +1988,7 @@ STDAPI CTsfUiLessMode::CUIElementSink::EndUIElement(DWORD dwUIElementId) //OutputDebugStringW(bstrDesc); //OutputDebugStringW(L"\n"); +#if M2_HAS_TSF_UIELEMENT_EXT ITfReadingInformationUIElement *preading = NULL; if (SUCCEEDED(pElement->QueryInterface(__uuidof(ITfReadingInformationUIElement), (void **)&preading))) { @@ -1988,6 +2004,7 @@ STDAPI CTsfUiLessMode::CUIElementSink::EndUIElement(DWORD dwUIElementId) CIME::CloseCandidateList(); pcandidate->Release(); } +#endif pElement->Release(); return S_OK; @@ -1995,6 +2012,11 @@ STDAPI CTsfUiLessMode::CUIElementSink::EndUIElement(DWORD dwUIElementId) void CTsfUiLessMode::UpdateImeState(BOOL bResetCompartmentEventSink) { +#if defined(__MINGW32__) + (void)bResetCompartmentEventSink; + CIME::ms_dwImeState = CIME::ms_bChineseIME ? IMEUI_STATE_ENGLISH : IMEUI_STATE_OFF; + return; +#else ITfCompartmentMgr* pcm; ITfCompartment* pTfOpenMode = NULL; ITfCompartment* pTfConvMode = NULL; @@ -2026,6 +2048,7 @@ void CTsfUiLessMode::UpdateImeState(BOOL bResetCompartmentEventSink) pTfConvMode->Release(); pcm->Release(); } +#endif } STDAPI CTsfUiLessMode::CUIElementSink::OnActivated(DWORD dwProfileType, LANGID langid, REFCLSID clsid, REFGUID catid, @@ -2053,6 +2076,7 @@ STDAPI CTsfUiLessMode::CUIElementSink::OnChange(REFGUID rguid) return S_OK; } +#if M2_HAS_TSF_UIELEMENT_EXT void CTsfUiLessMode::MakeReadingInformationString(ITfReadingInformationUIElement* preading) { UINT cchMax; @@ -2164,6 +2188,7 @@ void CTsfUiLessMode::MakeCandidateStrings(ITfCandidateListUIElement* pcandidate) free(IndexList); } } +#endif ITfUIElement* CTsfUiLessMode::GetUIElement(DWORD dwUIElementId) { diff --git a/src/EterLocale/CMakeLists.txt b/src/EterLocale/CMakeLists.txt index 1d42d88..25db50c 100644 --- a/src/EterLocale/CMakeLists.txt +++ b/src/EterLocale/CMakeLists.txt @@ -1,5 +1,11 @@ file(GLOB_RECURSE FILE_SOURCES "*.h" "*.c" "*.cpp") +foreach(_source IN LISTS FILE_SOURCES) + if(IS_SYMLINK "${_source}") + list(REMOVE_ITEM FILE_SOURCES "${_source}") + endif() +endforeach() + add_library(EterLocale STATIC ${FILE_SOURCES}) target_link_libraries(EterLocale diff --git a/src/EterPythonLib/CMakeLists.txt b/src/EterPythonLib/CMakeLists.txt index 91b68b9..ca0ece9 100644 --- a/src/EterPythonLib/CMakeLists.txt +++ b/src/EterPythonLib/CMakeLists.txt @@ -1,5 +1,11 @@ file(GLOB_RECURSE FILE_SOURCES "*.h" "*.c" "*.cpp") +foreach(_source IN LISTS FILE_SOURCES) + if(IS_SYMLINK "${_source}") + list(REMOVE_ITEM FILE_SOURCES "${_source}") + endif() +endforeach() + add_library(EterPythonLib STATIC ${FILE_SOURCES}) target_link_libraries(EterPythonLib diff --git a/src/EterPythonLib/PythonGridSlotWindow.cpp b/src/EterPythonLib/PythonGridSlotWindow.cpp index d1f848d..046da9d 100644 --- a/src/EterPythonLib/PythonGridSlotWindow.cpp +++ b/src/EterPythonLib/PythonGridSlotWindow.cpp @@ -55,10 +55,12 @@ void CGridSlotWindow::OnRenderPickingSlot() for (std::list::iterator itor = SlotList.begin(); itor != SlotList.end(); ++itor) { TSlot * pSlot = *itor; + const LONG slotRight = m_rect.left + pSlot->ixPosition + static_cast(pSlot->byxPlacedItemSize) * ITEM_WIDTH; + const LONG slotBottom = m_rect.top + pSlot->iyPosition + static_cast(pSlot->byxPlacedItemSize) * ITEM_HEIGHT; Rect.left = std::min(Rect.left, m_rect.left + pSlot->ixPosition); Rect.top = std::min(Rect.top, m_rect.top + pSlot->iyPosition); - Rect.right = std::max(Rect.right, m_rect.left + pSlot->ixPosition + pSlot->byxPlacedItemSize*ITEM_WIDTH); - Rect.bottom = std::max(Rect.bottom, m_rect.top + pSlot->iyPosition + pSlot->byxPlacedItemSize*ITEM_HEIGHT); + Rect.right = std::max(Rect.right, slotRight); + Rect.bottom = std::max(Rect.bottom, slotBottom); } CPythonGraphic::Instance().RenderBar2d(Rect.left, Rect.top, Rect.right, Rect.bottom); diff --git a/src/GameLib/CMakeLists.txt b/src/GameLib/CMakeLists.txt index 9ac33f8..dc8fc08 100644 --- a/src/GameLib/CMakeLists.txt +++ b/src/GameLib/CMakeLists.txt @@ -1,5 +1,11 @@ file(GLOB_RECURSE FILE_SOURCES "*.h" "*.c" "*.cpp") +foreach(_source IN LISTS FILE_SOURCES) + if(IS_SYMLINK "${_source}") + list(REMOVE_ITEM FILE_SOURCES "${_source}") + endif() +endforeach() + add_library(GameLib STATIC ${FILE_SOURCES}) target_link_libraries(GameLib diff --git a/src/GameLib/FlyTarget.h b/src/GameLib/FlyTarget.h index c1d80cf..29a09cd 100644 --- a/src/GameLib/FlyTarget.h +++ b/src/GameLib/FlyTarget.h @@ -1,5 +1,6 @@ #pragma once +class CFlyTarget; class IFlyTargetableObject { @@ -77,4 +78,3 @@ inline void IFlyTargetableObject::ClearFlyTargeter() } m_FlyTargeterSet.clear(); } - diff --git a/src/GameLib/MapBase.h b/src/GameLib/MapBase.h index 39d8cf5..15cd088 100644 --- a/src/GameLib/MapBase.h +++ b/src/GameLib/MapBase.h @@ -24,7 +24,7 @@ class CMapBase : public CScreen virtual float GetHeight(float fx, float fy) = 0; virtual void OnBeginEnvironment() = 0; // 렌더링 할 때 불려지며 여기서 Environment에 관련 있는 것들을 셋팅 한다. - virtual void ApplyLight(DWORD dwVersion, const D3DLIGHT9& c_rkLight) = 0; + virtual void ApplyLight(ULONG_PTR dwVersion, const D3DLIGHT9& c_rkLight) = 0; protected: virtual void OnRender() = 0; diff --git a/src/GameLib/MapManager.cpp b/src/GameLib/MapManager.cpp index 2bc620b..71f2fef 100644 --- a/src/GameLib/MapManager.cpp +++ b/src/GameLib/MapManager.cpp @@ -254,7 +254,7 @@ void CMapManager::BeginEnvironment() { ms_lpd3dDevice->LightEnable(0, TRUE); - rkMap.ApplyLight((DWORD)mc_pcurEnvironmentData, mc_pcurEnvironmentData->DirLights[ENV_DIRLIGHT_BACKGROUND]); + rkMap.ApplyLight(reinterpret_cast(mc_pcurEnvironmentData), mc_pcurEnvironmentData->DirLights[ENV_DIRLIGHT_BACKGROUND]); } else ms_lpd3dDevice->LightEnable(0, FALSE); @@ -658,4 +658,3 @@ void CMapManager::__LoadMapInfoVector() return; } - diff --git a/src/GameLib/MapOutdoor.h b/src/GameLib/MapOutdoor.h index 9039814..411f0ce 100644 --- a/src/GameLib/MapOutdoor.h +++ b/src/GameLib/MapOutdoor.h @@ -99,7 +99,7 @@ class CMapOutdoor : public CMapBase bool LoadSetting(const char * c_szFileName); - void ApplyLight(DWORD dwVersion, const D3DLIGHT9& c_rkLight); + void ApplyLight(ULONG_PTR dwVersion, const D3DLIGHT9& c_rkLight); void SetEnvironmentScreenFilter(); void SetEnvironmentSkyBox(); void SetEnvironmentLensFlare(); @@ -577,7 +577,7 @@ class CMapOutdoor : public CMapBase IDirect3DVertexBuffer9* m_pkVBNone[NONE_VB_NUM]; DWORD m_dwSplatPos; DWORD m_dwNonePos; - DWORD m_dwLightVersion; + ULONG_PTR m_dwLightVersion; } m_kSTPD; struct SoftwareTransformPatch_SRenderState { diff --git a/src/GameLib/MapOutdoorRender.cpp b/src/GameLib/MapOutdoorRender.cpp index 23b2d07..85b8106 100644 --- a/src/GameLib/MapOutdoorRender.cpp +++ b/src/GameLib/MapOutdoorRender.cpp @@ -129,7 +129,7 @@ void CMapOutdoor::__RenderTerrain_AppendPatch(const D3DXVECTOR3& c_rv3Center, fl m_PatchVector.push_back(std::make_pair(fDistance, lPatchNum)); } -void CMapOutdoor::ApplyLight(DWORD dwVersion, const D3DLIGHT9& c_rkLight) +void CMapOutdoor::ApplyLight(ULONG_PTR dwVersion, const D3DLIGHT9& c_rkLight) { m_kSTPD.m_dwLightVersion=dwVersion; STATEMANAGER.SetLight(0, &c_rkLight); diff --git a/src/PRTerrainLib/CMakeLists.txt b/src/PRTerrainLib/CMakeLists.txt index 2fbe71f..56e885c 100644 --- a/src/PRTerrainLib/CMakeLists.txt +++ b/src/PRTerrainLib/CMakeLists.txt @@ -1,5 +1,11 @@ file(GLOB_RECURSE FILE_SOURCES "*.h" "*.c" "*.cpp") +foreach(_source IN LISTS FILE_SOURCES) + if(IS_SYMLINK "${_source}") + list(REMOVE_ITEM FILE_SOURCES "${_source}") + endif() +endforeach() + add_library(PRTerrainLib STATIC ${FILE_SOURCES}) target_link_libraries(PRTerrainLib diff --git a/src/PackLib/CMakeLists.txt b/src/PackLib/CMakeLists.txt index 1f9ff6b..dfd8477 100644 --- a/src/PackLib/CMakeLists.txt +++ b/src/PackLib/CMakeLists.txt @@ -1,5 +1,11 @@ file(GLOB_RECURSE FILE_SOURCES CONFIGURE_DEPENDS "*.h" "*.c" "*.cpp") +foreach(_source IN LISTS FILE_SOURCES) + if(IS_SYMLINK "${_source}") + list(REMOVE_ITEM FILE_SOURCES "${_source}") + endif() +endforeach() + add_library(PackLib STATIC ${FILE_SOURCES}) target_link_libraries(PackLib diff --git a/src/PackLib/PackManager.cpp b/src/PackLib/PackManager.cpp index ed52b0d..6b36c94 100644 --- a/src/PackLib/PackManager.cpp +++ b/src/PackLib/PackManager.cpp @@ -163,6 +163,7 @@ bool CPackManager::GetFileWithPool(std::string_view path, TPackFile& result, CBu } } + RecordPackProfileLoad( "disk", "", @@ -212,6 +213,10 @@ void CPackManager::NormalizePath(std::string_view in, std::string& out) const if (in[i] == '\\') out[i] = '/'; else - out[i] = static_cast(std::tolower(in[i])); + out[i] = static_cast(std::tolower(static_cast(in[i]))); } + + static constexpr std::string_view kDrivePrefix = "d:/"; + if (out.rfind(kDrivePrefix, 0) == 0) + out.erase(0, kDrivePrefix.size()); } diff --git a/src/PackMaker/CMakeLists.txt b/src/PackMaker/CMakeLists.txt index 2ec40df..3615d42 100644 --- a/src/PackMaker/CMakeLists.txt +++ b/src/PackMaker/CMakeLists.txt @@ -1,5 +1,11 @@ file(GLOB_RECURSE FILE_SOURCES "*.h" "*.c" "*.cpp") +foreach(_source IN LISTS FILE_SOURCES) + if(IS_SYMLINK "${_source}") + list(REMOVE_ITEM FILE_SOURCES "${_source}") + endif() +endforeach() + add_executable(PackMaker ${FILE_SOURCES}) set_target_properties(PackMaker PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin diff --git a/src/PythonModules/CMakeLists.txt b/src/PythonModules/CMakeLists.txt index f9f4071..1a04660 100644 --- a/src/PythonModules/CMakeLists.txt +++ b/src/PythonModules/CMakeLists.txt @@ -1,4 +1,10 @@ file(GLOB_RECURSE FILE_SOURCES CONFIGURE_DEPENDS "*.h" "*.c" "*.cpp") +foreach(_source IN LISTS FILE_SOURCES) + if(IS_SYMLINK "${_source}") + list(REMOVE_ITEM FILE_SOURCES "${_source}") + endif() +endforeach() + add_library(PythonModules STATIC ${FILE_SOURCES}) GroupSourcesByFolder(PythonModules) diff --git a/src/PythonModules/frozen_modules.c b/src/PythonModules/frozen_modules.c index 5875307..681ecfb 100644 --- a/src/PythonModules/frozen_modules.c +++ b/src/PythonModules/frozen_modules.c @@ -1,6 +1,10 @@ /* Auto-generated by Tools/freeze/generate_legacy_frozen.py */ #include +#if defined(_WIN32) +#include +#endif + extern unsigned char M___future__[]; extern unsigned char M___main__[]; extern unsigned char M__collections_abc[]; @@ -673,5 +677,15 @@ const struct _frozen _PyImport_FrozenModules[] = { void InitStandardPythonModules() { +#if defined(__MINGW32__) + HMODULE python = GetModuleHandleA("python314.dll"); + if (python) { + const struct _frozen **frozen_modules = (const struct _frozen **)GetProcAddress(python, "PyImport_FrozenModules"); + if (frozen_modules) { + *frozen_modules = _PyImport_FrozenModules; + } + } +#else PyImport_FrozenModules = _PyImport_FrozenModules; +#endif } diff --git a/src/ScriptLib/CMakeLists.txt b/src/ScriptLib/CMakeLists.txt index 36049b3..21c77a2 100644 --- a/src/ScriptLib/CMakeLists.txt +++ b/src/ScriptLib/CMakeLists.txt @@ -1,4 +1,10 @@ -file(GLOB_RECURSE FILE_SOURCES "*.h" "*.c" "*.cpp") +file(GLOB_RECURSE FILE_SOURCES CONFIGURE_DEPENDS "*.h" "*.c" "*.cpp") + +foreach(_source IN LISTS FILE_SOURCES) + if(IS_SYMLINK "${_source}") + list(REMOVE_ITEM FILE_SOURCES "${_source}") + endif() +endforeach() add_library(ScriptLib STATIC ${FILE_SOURCES}) diff --git a/src/ScriptLib/PyFrozenFlagShim.cpp b/src/ScriptLib/PyFrozenFlagShim.cpp new file mode 100644 index 0000000..aa0e7c1 --- /dev/null +++ b/src/ScriptLib/PyFrozenFlagShim.cpp @@ -0,0 +1,36 @@ +#include +#include + +extern "C" int* M2_GetPyFrozenFlagPtr(void) +{ + static int fallback_flag = 0; + + HMODULE python = GetModuleHandleA("python314.dll"); + if (!python) { + return &fallback_flag; + } + + FARPROC proc = GetProcAddress(python, "Py_FrozenFlag"); + if (!proc) { + return &fallback_flag; + } + + return reinterpret_cast(proc); +} + +extern "C" PyObject* M2_GetPyNonePtr(void) +{ + static PyObject* fallback_none = nullptr; + + HMODULE python = GetModuleHandleA("python314.dll"); + if (!python) { + return fallback_none; + } + + FARPROC proc = GetProcAddress(python, "_Py_NoneStruct"); + if (!proc) { + return fallback_none; + } + + return reinterpret_cast(proc); +} diff --git a/src/ScriptLib/PythonUtils.cpp b/src/ScriptLib/PythonUtils.cpp index 47e3e3d..02ac8cc 100644 --- a/src/ScriptLib/PythonUtils.cpp +++ b/src/ScriptLib/PythonUtils.cpp @@ -10,6 +10,8 @@ bool __PyCallClassMemberFunc_ByCString(PyObject* poClass, const char* c_szFunc, bool __PyCallClassMemberFunc_ByPyString(PyObject* poClass, PyObject* poFuncName, PyObject* poArgs, PyObject** poRet); bool __PyCallClassMemberFunc(PyObject* poClass, PyObject* poFunc, PyObject* poArgs, PyObject** poRet); +extern "C" PyObject* M2_GetPyNonePtr(void); + PyObject * Py_BadArgument() { PyErr_BadArgument(); @@ -36,13 +38,14 @@ PyObject * Py_BuildException(const char * c_pszErr, ...) PyObject * Py_BuildNone() { - Py_INCREF(Py_None); - return Py_None; + PyObject* pyNone = M2_GetPyNonePtr(); + Py_INCREF(pyNone); + return pyNone; } void Py_ReleaseNone() { - Py_DECREF(Py_None); + Py_DECREF(M2_GetPyNonePtr()); } bool PyTuple_GetObject(PyObject* poArgs, int pos, PyObject** ret) @@ -111,7 +114,7 @@ bool PyTuple_GetFloat(PyObject* poArgs, int pos, float* ret) if (!poItem) return false; - *ret = float(PyFloat_AsDouble(poItem)); + *ret = static_cast(PyFloat_AsDouble(poItem)); return true; } @@ -119,7 +122,7 @@ bool PyTuple_GetByte(PyObject* poArgs, int pos, unsigned char* ret) { int val; bool result = PyTuple_GetInteger(poArgs,pos,&val); - *ret = unsigned char(val); + *ret = static_cast(val); return result; } @@ -127,7 +130,7 @@ bool PyTuple_GetInteger(PyObject* poArgs, int pos, unsigned char* ret) { int val; bool result = PyTuple_GetInteger(poArgs,pos,&val); - *ret = unsigned char(val); + *ret = static_cast(val); return result; } @@ -135,7 +138,7 @@ bool PyTuple_GetInteger(PyObject* poArgs, int pos, WORD* ret) { int val; bool result = PyTuple_GetInteger(poArgs,pos,&val); - *ret = WORD(val); + *ret = static_cast(val); return result; } @@ -452,4 +455,4 @@ bool __PyCallClassMemberFunc(PyObject* poClass, PyObject * poFunc, PyObject* poA Py_DECREF(poFunc); Py_XDECREF(poArgs); return true; -} \ No newline at end of file +} diff --git a/src/SpeedTreeLib/CMakeLists.txt b/src/SpeedTreeLib/CMakeLists.txt index 51288e7..548aa0f 100644 --- a/src/SpeedTreeLib/CMakeLists.txt +++ b/src/SpeedTreeLib/CMakeLists.txt @@ -1,5 +1,23 @@ file(GLOB_RECURSE FILE_SOURCES "*.h" "*.c" "*.cpp") +foreach(_source IN LISTS FILE_SOURCES) + if(IS_SYMLINK "${_source}") + list(REMOVE_ITEM FILE_SOURCES "${_source}") + endif() +endforeach() + +if(MSVC) + list(REMOVE_ITEM FILE_SOURCES + "${CMAKE_CURRENT_SOURCE_DIR}/SpeedTreeStubs.cpp" + ) +else() + list(REMOVE_ITEM FILE_SOURCES + "${CMAKE_CURRENT_SOURCE_DIR}/SpeedTreeForest.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/SpeedTreeForestDirectX.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/SpeedTreeWrapper.cpp" + ) +endif() + add_library(SpeedTreeLib STATIC ${FILE_SOURCES}) target_link_libraries(SpeedTreeLib diff --git a/src/SphereLib/CMakeLists.txt b/src/SphereLib/CMakeLists.txt index 1a576a0..39619dc 100644 --- a/src/SphereLib/CMakeLists.txt +++ b/src/SphereLib/CMakeLists.txt @@ -1,5 +1,11 @@ file(GLOB_RECURSE FILE_SOURCES "*.h" "*.c" "*.cpp") +foreach(_source IN LISTS FILE_SOURCES) + if(IS_SYMLINK "${_source}") + list(REMOVE_ITEM FILE_SOURCES "${_source}") + endif() +endforeach() + add_library(SphereLib STATIC ${FILE_SOURCES}) # target_link_libraries(SphereLib diff --git a/src/UserInterface/CMakeLists.txt b/src/UserInterface/CMakeLists.txt index 2772db1..5c449ff 100644 --- a/src/UserInterface/CMakeLists.txt +++ b/src/UserInterface/CMakeLists.txt @@ -1,13 +1,29 @@ file(GLOB_RECURSE FILE_SOURCES "*.h" "*.c" "*.cpp") +foreach(_source IN LISTS FILE_SOURCES) + if(IS_SYMLINK "${_source}") + list(REMOVE_ITEM FILE_SOURCES "${_source}") + endif() +endforeach() + +list(APPEND FILE_SOURCES "${CMAKE_SOURCE_DIR}/src/UserInterface/GUIDKeyCompat.cpp") + add_executable(UserInterface WIN32 ${FILE_SOURCES} ${CMAKE_SOURCE_DIR}/src/UserInterface/UserInterface.rc) -set_target_properties(UserInterface PROPERTIES LINK_FLAGS "/level='requireAdministrator' /uiAccess='false'" +set_target_properties(UserInterface PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin OUTPUT_NAME_DEBUG "Metin2_Debug" OUTPUT_NAME_RELEASE "Metin2_Release" OUTPUT_NAME_RELWITHDEBINFO "Metin2_RelWithDebInfo" ) +if(MSVC) + set_target_properties(UserInterface PROPERTIES LINK_FLAGS "/level='requireAdministrator' /uiAccess='false'") +endif() + +target_include_directories(UserInterface PRIVATE + $<$:${CMAKE_SOURCE_DIR}/src/UserInterface> +) + target_link_libraries(UserInterface AudioLib Discord @@ -25,6 +41,7 @@ target_link_libraries(UserInterface SpeedTreeLib SphereLib PackLib + EterLib lzo2 libzstd_static @@ -32,17 +49,23 @@ target_link_libraries(UserInterface DirectX Granny - SpeedTree + $<$:SpeedTree> Python WebView ws2_32 + imm32 + winmm strmiids amstrmid dmoguids - ddraw version - Dbghelp + $<$:Dbghelp> + $<$>:dbghelp> + EterImageLib + AudioLib + PythonModules + EterBase ) GroupSourcesByFolder(UserInterface) \ No newline at end of file diff --git a/src/UserInterface/MarkImage.cpp b/src/UserInterface/MarkImage.cpp index 7c38b55..4e98101 100644 --- a/src/UserInterface/MarkImage.cpp +++ b/src/UserInterface/MarkImage.cpp @@ -6,11 +6,11 @@ #include #if !defined(_MSC_VER) -#include #include "crc32.h" -#include "lzo_manager.h" -#include "minilzo.h" -#define CLZO LZOManager +#include "EterBase/CRC32.h" +#define sys_err TraceError +#define sys_log Tracenf +#define thecore_memcpy memcpy #else #define sys_err TraceError #define sys_log //(n, format, ...) Tracenf(format, __VA_ARGS__) diff --git a/src/UserInterface/MarkManager.cpp b/src/UserInterface/MarkManager.cpp index b726b00..f496a4f 100644 --- a/src/UserInterface/MarkManager.cpp +++ b/src/UserInterface/MarkManager.cpp @@ -2,11 +2,15 @@ #include #include "MarkManager.h" -#if _MSC_VER < 1200 +#if defined(_MSC_VER) && _MSC_VER < 1200 #include "crc32.h" #else #define sys_err TraceError +#if defined(_MSC_VER) #define sys_log // (n, format, ...) Tracenf(format, __VA_ARGS__) +#else +#define sys_log Tracenf +#endif #define thecore_memcpy memcpy #define itertype(cont) typeof((cont).begin()) #endif diff --git a/src/UserInterface/MovieMan.cpp b/src/UserInterface/MovieMan.cpp index 10d0f1a..114c12d 100644 --- a/src/UserInterface/MovieMan.cpp +++ b/src/UserInterface/MovieMan.cpp @@ -2,6 +2,29 @@ #include "MovieMan.h" #include "PythonApplication.h" +#if !defined(_MSC_VER) + +void CMovieMan::ClearToBlack() +{ +} + +void CMovieMan::PlayLogo(const char *pcszName) +{ + (void)pcszName; +} + +void CMovieMan::PlayIntro() +{ +} + +BOOL CMovieMan::PlayTutorial(LONG nIdx) +{ + (void)nIdx; + return FALSE; +} + +#else + // 2007-08-19, nuclei // add following files to the [Project Settings-Linker-Input] // DEBUG: ../dshow/strmbasd.lib ../dshow/dmoguids.lib ddraw.lib @@ -688,3 +711,5 @@ HRESULT CMovieMan::BuildFilterGraphManually( // } //} //#endif + +#endif diff --git a/src/UserInterface/PythonApplication.cpp b/src/UserInterface/PythonApplication.cpp index 1681b99..48f91a2 100644 --- a/src/UserInterface/PythonApplication.cpp +++ b/src/UserInterface/PythonApplication.cpp @@ -728,7 +728,10 @@ bool CPythonApplication::Process() m_dwFaceAccCount += dwCurFaceCount; m_dwFaceAccTime += m_dwCurRenderTime; - m_fFaceSpd=(m_dwFaceAccCount/m_dwFaceAccTime); + if (m_dwFaceAccTime != 0) + m_fFaceSpd = static_cast(m_dwFaceAccCount) / static_cast(m_dwFaceAccTime); + else + m_fFaceSpd = 0.0f; // °Å¸® ÀÚµ¿ Á¶Àý if (-1 == m_iForceSightRange) diff --git a/src/UserInterface/PythonApplicationLogo.cpp b/src/UserInterface/PythonApplicationLogo.cpp index 26b9046..092bf07 100644 --- a/src/UserInterface/PythonApplicationLogo.cpp +++ b/src/UserInterface/PythonApplicationLogo.cpp @@ -1,6 +1,24 @@ #include "StdAfx.h" #include "PythonApplication.h" +#ifndef IID_ISampleGrabber +DEFINE_GUID(IID_ISampleGrabber, 0x6b652fff, 0x11fe, 0x4fce, 0x92, 0xad, 0x02, 0x66, 0xb5, 0xd7, 0xc7, 0x8f); +DEFINE_GUID(CLSID_SampleGrabber, 0xc1f400a0, 0x3f08, 0x11d3, 0x9f, 0x0b, 0x00, 0x60, 0x08, 0x03, 0x9e, 0x37); + +MIDL_INTERFACE("6B652FFF-11FE-4fce-92AD-0266B5D7C78F") +ISampleGrabber : public IUnknown +{ +public: + virtual HRESULT STDMETHODCALLTYPE SetOneShot(WINBOOL OneShot) = 0; + virtual HRESULT STDMETHODCALLTYPE SetMediaType(const AM_MEDIA_TYPE* pType) = 0; + virtual HRESULT STDMETHODCALLTYPE GetConnectedMediaType(AM_MEDIA_TYPE* pType) = 0; + virtual HRESULT STDMETHODCALLTYPE SetBufferSamples(WINBOOL BufferThem) = 0; + virtual HRESULT STDMETHODCALLTYPE GetCurrentBuffer(LONG* pBufferSize, LONG* pBuffer) = 0; + virtual HRESULT STDMETHODCALLTYPE GetCurrentSample(IMediaSample** ppSample) = 0; + virtual HRESULT STDMETHODCALLTYPE SetCallback(IUnknown* pCallback, LONG WhichMethodToCallback) = 0; +}; +#endif + static bool bInitializedLogo = false; int CPythonApplication::OnLogoOpen(char* szName) diff --git a/src/UserInterface/PythonApplicationWebPage.cpp b/src/UserInterface/PythonApplicationWebPage.cpp index e7f7543..f7d0f50 100644 --- a/src/UserInterface/PythonApplicationWebPage.cpp +++ b/src/UserInterface/PythonApplicationWebPage.cpp @@ -1,6 +1,8 @@ #include "StdAfx.h" #include "PythonApplication.h" +#if defined(_MSC_VER) + #undef C8 #include #include @@ -118,3 +120,29 @@ void CPythonApplication::HideWebPage() else SetCursorMode(CURSOR_MODE_HARDWARE); } + +#else + +bool CPythonApplication::IsWebPageMode() +{ + return false; +} + +void CPythonApplication::ShowWebPage(const char* c_szURL, const RECT& c_rcWebPage) +{ + TraceError("WebView2 is not available in this build"); +} + +void CPythonApplication::MoveWebPage(const RECT& c_rcWebPage) +{ +} + +void CPythonApplication::HideWebPage() +{ + if (m_pySystem.IsSoftwareCursor()) + SetCursorMode(CURSOR_MODE_SOFTWARE); + else + SetCursorMode(CURSOR_MODE_HARDWARE); +} + +#endif diff --git a/src/UserInterface/PythonNetworkStreamPhaseGame.cpp b/src/UserInterface/PythonNetworkStreamPhaseGame.cpp index b4b2ab4..880a47c 100644 --- a/src/UserInterface/PythonNetworkStreamPhaseGame.cpp +++ b/src/UserInterface/PythonNetworkStreamPhaseGame.cpp @@ -843,7 +843,7 @@ void CPythonNetworkStream::__ConvertEmpireText(DWORD dwEmpireID, char* szText) { if (pbText[0]>=0xb0 && pbText[0]<=0xc8 && pbText[1]>=0xa1 && pbText[1]<=0xfe) { - uHanPos=(pbText[0]-0xb0)*(0xfe-0xa1+1)+(pbText[1]-0xa1); + uHanPos = (pbText[0] - 0xb0) * (0xfe - 0xa1 + 1) + (pbText[1] - 0xa1); pbText[0]=rkTextConvTable.aacHan[uHanPos][0]; pbText[1]=rkTextConvTable.aacHan[uHanPos][1]; } diff --git a/src/UserInterface/PythonNetworkStreamPhaseLoading.cpp b/src/UserInterface/PythonNetworkStreamPhaseLoading.cpp index 3addc87..466703d 100644 --- a/src/UserInterface/PythonNetworkStreamPhaseLoading.cpp +++ b/src/UserInterface/PythonNetworkStreamPhaseLoading.cpp @@ -58,7 +58,7 @@ bool CPythonNetworkStream::LoadConvertTable(DWORD dwEmpireID, const char* c_szFi return false; DWORD dwEngCount=26; - DWORD dwHanCount=(0xc8-0xb0+1)*(0xfe-0xa1+1); + DWORD dwHanCount = (0xc8 - 0xb0 + 1) * (0xfe - 0xa1 + 1); DWORD dwHanSize=dwHanCount*2; DWORD dwFileSize=dwEngCount*2+dwHanSize; diff --git a/src/UserInterface/UserInterface.cpp b/src/UserInterface/UserInterface.cpp index a15abd0..9a290a6 100644 --- a/src/UserInterface/UserInterface.cpp +++ b/src/UserInterface/UserInterface.cpp @@ -27,8 +27,12 @@ #include "EterLib/FontManager.h" extern "C" { +#if defined(__MINGW32__) + int _fltused = 0; +#else extern int _fltused; FILE __iob_func[3] = { *stdin, *stdout, *stderr }; +#endif volatile int _AVOID_FLOATING_POINT_LIBRARY_BUG = _fltused; __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; diff --git a/src/UserInterface/UserInterface.rc b/src/UserInterface/UserInterface.rc index 6570c76..c952810 100644 --- a/src/UserInterface/UserInterface.rc +++ b/src/UserInterface/UserInterface.rc @@ -9,7 +9,7 @@ // Generated from the TEXTINCLUDE 2 resource. // // #include "afxres.h" -#include +#include ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -70,19 +70,19 @@ END // Cursor // -IDC_CURSOR_NORMAL CURSOR "Cursors\\cursor.cur" -IDC_CURSOR_CHAIR CURSOR "Cursors\\cursor_chair.cur" -IDC_CURSOR_DOOR CURSOR "Cursors\\cursor_door.cur" -IDC_CURSOR_NO CURSOR "Cursors\\cursor_no.cur" -IDC_CURSOR_PICK CURSOR "Cursors\\cursor_pick.cur" -IDC_CURSOR_TALK CURSOR "Cursors\\cursor_talk.cur" -IDC_CURSOR_ATTACK CURSOR "Cursors\\cursor_attack.cur" -IDC_CURSOR_BUY CURSOR "Cursors\\cursor_buy.cur" -IDC_CURSOR_SELL CURSOR "Cursors\\cursor_sell.cur" -IDC_CURSOR_CAMERA_ROTATE CURSOR "Cursors\\cursor_camera_rotate.cur" -IDC_CURSOR_HSIZE CURSOR "Cursors\\cursor_hsize.cur" -IDC_CURSOR_VSIZE CURSOR "Cursors\\cursor_vsize.cur" -IDC_CURSOR_HVSIZE CURSOR "Cursors\\cursor_hvsize.cur" +IDC_CURSOR_NORMAL CURSOR "Cursors/cursor.cur" +IDC_CURSOR_CHAIR CURSOR "Cursors/cursor_chair.cur" +IDC_CURSOR_DOOR CURSOR "Cursors/cursor_door.cur" +IDC_CURSOR_NO CURSOR "Cursors/cursor_no.cur" +IDC_CURSOR_PICK CURSOR "Cursors/cursor_pick.cur" +IDC_CURSOR_TALK CURSOR "Cursors/cursor_talk.cur" +IDC_CURSOR_ATTACK CURSOR "Cursors/cursor_attack.cur" +IDC_CURSOR_BUY CURSOR "Cursors/cursor_buy.cur" +IDC_CURSOR_SELL CURSOR "Cursors/cursor_sell.cur" +IDC_CURSOR_CAMERA_ROTATE CURSOR "Cursors/cursor_camera_rotate.cur" +IDC_CURSOR_HSIZE CURSOR "Cursors/cursor_hsize.cur" +IDC_CURSOR_VSIZE CURSOR "Cursors/cursor_vsize.cur" +IDC_CURSOR_HVSIZE CURSOR "Cursors/cursor_hvsize.cur" ///////////////////////////////////////////////////////////////////////////// // diff --git a/toolchains/linux-mingw64.cmake b/toolchains/linux-mingw64.cmake index 78cc944..2118a28 100644 --- a/toolchains/linux-mingw64.cmake +++ b/toolchains/linux-mingw64.cmake @@ -1,10 +1,17 @@ -# Cross-compile for Windows x86_64 from Linux using MinGW + LLD. set(CMAKE_SYSTEM_NAME Windows) set(CMAKE_SYSTEM_PROCESSOR x86_64) -set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) +get_filename_component(_TOOLCHAIN_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY) + +set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) -set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) +set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) +set(CMAKE_LINKER "${_TOOLCHAIN_DIR}/mingw-lld-bin/x86_64-w64-mingw32-ld" CACHE FILEPATH "" FORCE) + +set(_MINGW_LLD_FLAGS "-B${_TOOLCHAIN_DIR}/mingw-lld-bin -fuse-ld=lld") +set(CMAKE_EXE_LINKER_FLAGS "${_MINGW_LLD_FLAGS}" CACHE STRING "" FORCE) +set(CMAKE_SHARED_LINKER_FLAGS "${_MINGW_LLD_FLAGS}" CACHE STRING "" FORCE) +set(CMAKE_MODULE_LINKER_FLAGS "${_MINGW_LLD_FLAGS}" CACHE STRING "" FORCE) set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) @@ -12,6 +19,4 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) -set(CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=lld") -set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=lld") -set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fuse-ld=lld") +set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)