From 6d2fd046bf7b60f281a815ce1423348bb768a016 Mon Sep 17 00:00:00 2001 From: Random06457 <28494085+Random06457@users.noreply.github.com> Date: Mon, 2 May 2022 23:27:01 +0900 Subject: [PATCH] cleanup _MSC_VER usage --- ZAPDTR/ZAPD/Main.cpp | 6 +++--- libultraship/libultraship/Archive.cpp | 10 +++++----- libultraship/libultraship/GlobalCtx2.cpp | 2 +- libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp | 2 +- libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp | 2 +- libultraship/libultraship/ResourceMgr.cpp | 2 +- libultraship/libultraship/SohImGuiImpl.cpp | 2 +- libultraship/libultraship/Window.cpp | 4 ++-- libultraship/libultraship/WindowShim.cpp | 2 +- soh/soh/OTRGlobals.cpp | 4 ++-- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/ZAPDTR/ZAPD/Main.cpp b/ZAPDTR/ZAPD/Main.cpp index 3fc209a8c..95f161f0a 100644 --- a/ZAPDTR/ZAPD/Main.cpp +++ b/ZAPDTR/ZAPD/Main.cpp @@ -10,7 +10,7 @@ #include "ZFile.h" #include "ZTexture.h" -#if !defined(_MSC_VER) && !defined(__CYGWIN__) +#ifdef __linux__ #include #include #include @@ -58,7 +58,7 @@ int ExtractFunc(int workerID, int fileListSize, std::string fileListItem, ZFileM volatile int numWorkersLeft = 0; -#if !defined(_MSC_VER) && !defined(__CYGWIN__) +#ifdef __linux__ #define ARRAY_COUNT(arr) (sizeof(arr) / sizeof(arr[0])) void ErrorHandler(int sig) { @@ -216,7 +216,7 @@ int main(int argc, char* argv[]) } else if (arg == "-eh") // Enable Error Handler { - #if !defined(_MSC_VER) && !defined(__CYGWIN__) +#ifdef __linux__ signal(SIGSEGV, ErrorHandler); signal(SIGABRT, ErrorHandler); #else diff --git a/libultraship/libultraship/Archive.cpp b/libultraship/libultraship/Archive.cpp index e6f35cd12..67ec8831a 100644 --- a/libultraship/libultraship/Archive.cpp +++ b/libultraship/libultraship/Archive.cpp @@ -144,7 +144,7 @@ namespace Ship { bool Archive::AddFile(const std::string& path, uintptr_t fileData, DWORD dwFileSize) { HANDLE hFile; -#ifdef _MSC_VER +#ifdef _WIN32 SYSTEMTIME sysTime; GetSystemTime(&sysTime); FILETIME t; @@ -310,12 +310,12 @@ namespace Ship { bool Archive::LoadMainMPQ(bool enableWriting, bool genCRCMap) { HANDLE mpqHandle = NULL; -#ifdef _MSC_VER +#ifdef _WIN32 std::wstring wfullPath = std::filesystem::absolute(MainPath).wstring(); #endif std::string fullPath = std::filesystem::absolute(MainPath).string(); -#ifdef _MSC_VER +#ifdef _WIN32 if (!SFileOpenArchive(wfullPath.c_str(), 0, enableWriting ? 0 : MPQ_OPEN_READ_ONLY, &mpqHandle)) { #else if (!SFileOpenArchive(fullPath.c_str(), 0, enableWriting ? 0 : MPQ_OPEN_READ_ONLY, &mpqHandle)) { @@ -353,7 +353,7 @@ namespace Ship { std::wstring wPath = std::filesystem::absolute(path).wstring(); -#ifdef _MSC_VER +#ifdef _WIN32 if (!SFileOpenArchive(wPath.c_str(), 0, MPQ_OPEN_READ_ONLY, &patchHandle)) { #else if (!SFileOpenArchive(fullPath.c_str(), 0, MPQ_OPEN_READ_ONLY, &patchHandle)) { @@ -361,7 +361,7 @@ namespace Ship { SPDLOG_ERROR("({}) Failed to open patch mpq file {} while applying to {}.", GetLastError(), path.c_str(), MainPath.c_str()); return false; } -#ifdef _MSC_VER +#ifdef _WIN32 if (!SFileOpenPatchArchive(mainMPQ, wPath.c_str(), "", 0)) { #else if (!SFileOpenPatchArchive(mainMPQ, fullPath.c_str(), "", 0)) { diff --git a/libultraship/libultraship/GlobalCtx2.cpp b/libultraship/libultraship/GlobalCtx2.cpp index d1fd57875..5ce59f5ab 100644 --- a/libultraship/libultraship/GlobalCtx2.cpp +++ b/libultraship/libultraship/GlobalCtx2.cpp @@ -54,7 +54,7 @@ namespace Ship { if (!ResMan->DidLoadSuccessfully()) { -#ifdef _MSC_VER +#ifdef _WIN32 MessageBox(NULL, L"Main OTR file not found!", L"Uh oh", MB_OK); #else SPDLOG_ERROR("Main OTR file not found!"); diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp index 53d778e21..ec27f33c3 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp @@ -210,7 +210,7 @@ static map framebuffers; static set> get_pixel_depth_pending; static map, uint16_t> get_pixel_depth_cached; -#ifdef _MSC_VER +#ifdef _WIN32 // TODO: Properly implement for MSVC static unsigned long get_time(void) { diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp index 8af0912d8..e80097c81 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp @@ -23,7 +23,7 @@ #include "gfx_window_manager_api.h" #include "gfx_screen_config.h" -#ifdef _MSC_VER +#ifdef _WIN32 #include #endif #include diff --git a/libultraship/libultraship/ResourceMgr.cpp b/libultraship/libultraship/ResourceMgr.cpp index 7bad99143..85dec9886 100644 --- a/libultraship/libultraship/ResourceMgr.cpp +++ b/libultraship/libultraship/ResourceMgr.cpp @@ -243,7 +243,7 @@ namespace Ship { std::shared_ptr ResourceMgr::LoadResourceAsync(std::string FilePath) { // todo: what? -#ifdef _MSC_VER +#ifdef _WIN32 StringHelper::ReplaceOriginal(FilePath, "/", "\\"); #else StringHelper::ReplaceOriginal(FilePath, "\\", "/"); diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index c66323d9d..5d8c0ea2a 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -674,7 +674,7 @@ namespace SohImGui { ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); ImGui::Begin("Debug Stats", nullptr, ImGuiWindowFlags_None); -#ifdef _MSC_VER +#ifdef _WIN32 ImGui::Text("Platform: Windows"); #else ImGui::Text("Platform: Linux"); diff --git a/libultraship/libultraship/Window.cpp b/libultraship/libultraship/Window.cpp index 1cdc2bf86..b9ebd2cbb 100644 --- a/libultraship/libultraship/Window.cpp +++ b/libultraship/libultraship/Window.cpp @@ -11,7 +11,7 @@ #include "Blob.h" #include "Matrix.h" #include "AudioPlayer.h" -#ifdef _MSC_VER +#ifdef _WIN32 #include "WasapiAudioPlayer.h" #else #include "SDLAudioPlayer.h" @@ -401,7 +401,7 @@ namespace Ship { } void Window::SetAudioPlayer() { -#ifdef _MSC_VER +#ifdef _WIN32 APlayer = std::make_shared(); #else APlayer = std::make_shared(); diff --git a/libultraship/libultraship/WindowShim.cpp b/libultraship/libultraship/WindowShim.cpp index 85af587c1..4469c5c29 100644 --- a/libultraship/libultraship/WindowShim.cpp +++ b/libultraship/libultraship/WindowShim.cpp @@ -23,7 +23,7 @@ void SetWindowManager(struct GfxWindowManagerAPI** WmApi, struct GfxRenderingAPI #ifdef ENABLE_OPENGL *RenderingApi = &gfx_opengl_api; #if defined(__linux__) - // MERGETODO: + // LINUX_TODO: // *WmApi = &gfx_glx; *WmApi = &gfx_sdl; #else diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index fd0a0eeba..70806da14 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -14,7 +14,7 @@ #include "Enhancements/gameconsole.h" #include #include -#ifdef _MSC_VER +#ifdef _WIN32 #include #else #include @@ -77,7 +77,7 @@ extern "C" void InitOTR() { Debug_Init(); } -#ifdef _MSC_VER +#ifdef _WIN32 extern "C" uint64_t GetFrequency() { LARGE_INTEGER nFreq;