cleanup _MSC_VER usage

This commit is contained in:
Random06457 2022-05-02 23:27:01 +09:00
commit 6d2fd046bf
10 changed files with 18 additions and 18 deletions

View file

@ -10,7 +10,7 @@
#include "ZFile.h" #include "ZFile.h"
#include "ZTexture.h" #include "ZTexture.h"
#if !defined(_MSC_VER) && !defined(__CYGWIN__) #ifdef __linux__
#include <csignal> #include <csignal>
#include <cstdlib> #include <cstdlib>
#include <ctime> #include <ctime>
@ -58,7 +58,7 @@ int ExtractFunc(int workerID, int fileListSize, std::string fileListItem, ZFileM
volatile int numWorkersLeft = 0; volatile int numWorkersLeft = 0;
#if !defined(_MSC_VER) && !defined(__CYGWIN__) #ifdef __linux__
#define ARRAY_COUNT(arr) (sizeof(arr) / sizeof(arr[0])) #define ARRAY_COUNT(arr) (sizeof(arr) / sizeof(arr[0]))
void ErrorHandler(int sig) void ErrorHandler(int sig)
{ {
@ -216,7 +216,7 @@ int main(int argc, char* argv[])
} }
else if (arg == "-eh") // Enable Error Handler else if (arg == "-eh") // Enable Error Handler
{ {
#if !defined(_MSC_VER) && !defined(__CYGWIN__) #ifdef __linux__
signal(SIGSEGV, ErrorHandler); signal(SIGSEGV, ErrorHandler);
signal(SIGABRT, ErrorHandler); signal(SIGABRT, ErrorHandler);
#else #else

View file

@ -144,7 +144,7 @@ namespace Ship {
bool Archive::AddFile(const std::string& path, uintptr_t fileData, DWORD dwFileSize) { bool Archive::AddFile(const std::string& path, uintptr_t fileData, DWORD dwFileSize) {
HANDLE hFile; HANDLE hFile;
#ifdef _MSC_VER #ifdef _WIN32
SYSTEMTIME sysTime; SYSTEMTIME sysTime;
GetSystemTime(&sysTime); GetSystemTime(&sysTime);
FILETIME t; FILETIME t;
@ -310,12 +310,12 @@ namespace Ship {
bool Archive::LoadMainMPQ(bool enableWriting, bool genCRCMap) { bool Archive::LoadMainMPQ(bool enableWriting, bool genCRCMap) {
HANDLE mpqHandle = NULL; HANDLE mpqHandle = NULL;
#ifdef _MSC_VER #ifdef _WIN32
std::wstring wfullPath = std::filesystem::absolute(MainPath).wstring(); std::wstring wfullPath = std::filesystem::absolute(MainPath).wstring();
#endif #endif
std::string fullPath = std::filesystem::absolute(MainPath).string(); 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)) { if (!SFileOpenArchive(wfullPath.c_str(), 0, enableWriting ? 0 : MPQ_OPEN_READ_ONLY, &mpqHandle)) {
#else #else
if (!SFileOpenArchive(fullPath.c_str(), 0, enableWriting ? 0 : MPQ_OPEN_READ_ONLY, &mpqHandle)) { 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(); std::wstring wPath = std::filesystem::absolute(path).wstring();
#ifdef _MSC_VER #ifdef _WIN32
if (!SFileOpenArchive(wPath.c_str(), 0, MPQ_OPEN_READ_ONLY, &patchHandle)) { if (!SFileOpenArchive(wPath.c_str(), 0, MPQ_OPEN_READ_ONLY, &patchHandle)) {
#else #else
if (!SFileOpenArchive(fullPath.c_str(), 0, MPQ_OPEN_READ_ONLY, &patchHandle)) { 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()); SPDLOG_ERROR("({}) Failed to open patch mpq file {} while applying to {}.", GetLastError(), path.c_str(), MainPath.c_str());
return false; return false;
} }
#ifdef _MSC_VER #ifdef _WIN32
if (!SFileOpenPatchArchive(mainMPQ, wPath.c_str(), "", 0)) { if (!SFileOpenPatchArchive(mainMPQ, wPath.c_str(), "", 0)) {
#else #else
if (!SFileOpenPatchArchive(mainMPQ, fullPath.c_str(), "", 0)) { if (!SFileOpenPatchArchive(mainMPQ, fullPath.c_str(), "", 0)) {

View file

@ -54,7 +54,7 @@ namespace Ship {
if (!ResMan->DidLoadSuccessfully()) if (!ResMan->DidLoadSuccessfully())
{ {
#ifdef _MSC_VER #ifdef _WIN32
MessageBox(NULL, L"Main OTR file not found!", L"Uh oh", MB_OK); MessageBox(NULL, L"Main OTR file not found!", L"Uh oh", MB_OK);
#else #else
SPDLOG_ERROR("Main OTR file not found!"); SPDLOG_ERROR("Main OTR file not found!");

View file

@ -210,7 +210,7 @@ static map<int, FBInfo> framebuffers;
static set<pair<float, float>> get_pixel_depth_pending; static set<pair<float, float>> get_pixel_depth_pending;
static map<pair<float, float>, uint16_t> get_pixel_depth_cached; static map<pair<float, float>, uint16_t> get_pixel_depth_cached;
#ifdef _MSC_VER #ifdef _WIN32
// TODO: Properly implement for MSVC // TODO: Properly implement for MSVC
static unsigned long get_time(void) static unsigned long get_time(void)
{ {

View file

@ -23,7 +23,7 @@
#include "gfx_window_manager_api.h" #include "gfx_window_manager_api.h"
#include "gfx_screen_config.h" #include "gfx_screen_config.h"
#ifdef _MSC_VER #ifdef _WIN32
#include <WTypesbase.h> #include <WTypesbase.h>
#endif #endif
#include <time.h> #include <time.h>

View file

@ -243,7 +243,7 @@ namespace Ship {
std::shared_ptr<ResourcePromise> ResourceMgr::LoadResourceAsync(std::string FilePath) { std::shared_ptr<ResourcePromise> ResourceMgr::LoadResourceAsync(std::string FilePath) {
// todo: what? // todo: what?
#ifdef _MSC_VER #ifdef _WIN32
StringHelper::ReplaceOriginal(FilePath, "/", "\\"); StringHelper::ReplaceOriginal(FilePath, "/", "\\");
#else #else
StringHelper::ReplaceOriginal(FilePath, "\\", "/"); StringHelper::ReplaceOriginal(FilePath, "\\", "/");

View file

@ -674,7 +674,7 @@ namespace SohImGui {
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0));
ImGui::Begin("Debug Stats", nullptr, ImGuiWindowFlags_None); ImGui::Begin("Debug Stats", nullptr, ImGuiWindowFlags_None);
#ifdef _MSC_VER #ifdef _WIN32
ImGui::Text("Platform: Windows"); ImGui::Text("Platform: Windows");
#else #else
ImGui::Text("Platform: Linux"); ImGui::Text("Platform: Linux");

View file

@ -11,7 +11,7 @@
#include "Blob.h" #include "Blob.h"
#include "Matrix.h" #include "Matrix.h"
#include "AudioPlayer.h" #include "AudioPlayer.h"
#ifdef _MSC_VER #ifdef _WIN32
#include "WasapiAudioPlayer.h" #include "WasapiAudioPlayer.h"
#else #else
#include "SDLAudioPlayer.h" #include "SDLAudioPlayer.h"
@ -401,7 +401,7 @@ namespace Ship {
} }
void Window::SetAudioPlayer() { void Window::SetAudioPlayer() {
#ifdef _MSC_VER #ifdef _WIN32
APlayer = std::make_shared<WasapiAudioPlayer>(); APlayer = std::make_shared<WasapiAudioPlayer>();
#else #else
APlayer = std::make_shared<SDLAudioPlayer>(); APlayer = std::make_shared<SDLAudioPlayer>();

View file

@ -23,7 +23,7 @@ void SetWindowManager(struct GfxWindowManagerAPI** WmApi, struct GfxRenderingAPI
#ifdef ENABLE_OPENGL #ifdef ENABLE_OPENGL
*RenderingApi = &gfx_opengl_api; *RenderingApi = &gfx_opengl_api;
#if defined(__linux__) #if defined(__linux__)
// MERGETODO: // LINUX_TODO:
// *WmApi = &gfx_glx; // *WmApi = &gfx_glx;
*WmApi = &gfx_sdl; *WmApi = &gfx_sdl;
#else #else

View file

@ -14,7 +14,7 @@
#include "Enhancements/gameconsole.h" #include "Enhancements/gameconsole.h"
#include <ultra64/gbi.h> #include <ultra64/gbi.h>
#include <Animation.h> #include <Animation.h>
#ifdef _MSC_VER #ifdef _WIN32
#include <Windows.h> #include <Windows.h>
#else #else
#include <time.h> #include <time.h>
@ -77,7 +77,7 @@ extern "C" void InitOTR() {
Debug_Init(); Debug_Init();
} }
#ifdef _MSC_VER #ifdef _WIN32
extern "C" uint64_t GetFrequency() { extern "C" uint64_t GetFrequency() {
LARGE_INTEGER nFreq; LARGE_INTEGER nFreq;