diff --git a/.gitignore b/.gitignore index 53bfc9878..85454ab20 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,6 @@ xcuserdata profile *.moved-aside DerivedData -.idea/ *.hmap emulator.xccheckout reicast.xccheckout @@ -67,8 +66,11 @@ ant.properties # Android Studio .gradle -.idea *.iml .externalNativeBuild gradle.properties shell/android-studio/reicast/src/main/assets/build + +# JetBrains IDES +.idea/ +cmake-build-*/ diff --git a/core/archive/archive.cpp b/core/archive/archive.cpp index 1bef0f2a4..d6bb78ef3 100644 --- a/core/archive/archive.cpp +++ b/core/archive/archive.cpp @@ -20,8 +20,8 @@ */ #include "archive.h" -#include "7zArchive.h" #ifndef _MSC_VER +#include "7zArchive.h" #include "ZipArchive.h" #endif diff --git a/core/build.h b/core/build.h index f3e06236e..1de5b73ab 100755 --- a/core/build.h +++ b/core/build.h @@ -211,9 +211,6 @@ #elif defined(TARGET_GCW0) #define HOST_OS OS_LINUX #define HOST_CPU CPU_MIPS -#elif defined(TARGET_EMSCRIPTEN) - #define HOST_OS OS_LINUX - #define HOST_CPU CPU_GENERIC #elif defined(TARGET_IPHONE) #define HOST_OS OS_DARWIN #define HOST_CPU CPU_ARM @@ -283,7 +280,7 @@ #endif #ifndef FEAT_HAS_NIXPROF - #if HOST_OS != OS_WINDOWS + #ifndef _WIN32 #define FEAT_HAS_NIXPROF 1 #endif #endif @@ -314,7 +311,7 @@ #define COMPILER_VC_OR_CLANG_WIN32 ((BUILD_COMPILER == COMPILER_VC) || (BUILD_COMPILER == COMPILER_CLANG) && HOST_OS == OS_WINDOWS) -#if BUILD_COMPILER!=COMPILER_VC +#ifndef _MSC_VER #define ATTR_USED __attribute__((used)) #define ATTR_UNUSED __attribute__((used)) #else diff --git a/core/deps/coreio/coreio.cpp b/core/deps/coreio/coreio.cpp index 67e70d801..4f73716cc 100644 --- a/core/deps/coreio/coreio.cpp +++ b/core/deps/coreio/coreio.cpp @@ -83,7 +83,7 @@ size_t HTTP_GET(string host, int port,string path, size_t offs, size_t len, void static bool init = false; if (!init) { -#if HOST_OS == OS_WINDOWS +#ifdef _WIN32 static WSADATA wsaData; if (WSAStartup(MAKEWORD(2, 0), &wsaData) != 0) die("WSAStartup fail"); @@ -104,7 +104,7 @@ size_t HTTP_GET(string host, int port,string path, size_t offs, size_t len, void if (connect(sock, (struct sockaddr *) &serveraddr, sizeof(serveraddr)) < 0) return -1; -#if HOST_OS == OS_WINDOWS +#ifdef _WIN32 BOOL v = TRUE; #else int v = 1; @@ -177,7 +177,7 @@ _data: _cleanup: //disconnect -#if HOST_OS == OS_WINDOWS +#ifdef _WIN32 closesocket(sock); #else close(sock); diff --git a/core/deps/imgui/imconfig.h b/core/deps/imgui/imconfig.h index 161e35864..6430e66e9 100644 --- a/core/deps/imgui/imconfig.h +++ b/core/deps/imgui/imconfig.h @@ -72,7 +72,7 @@ namespace ImGui } */ -#ifdef _ANDROID +#ifdef __ANDROID__ #include #define LOG_TAG "flycast" diff --git a/core/deps/imgui/imgui.h b/core/deps/imgui/imgui.h index ae923668a..96fcdf22b 100644 --- a/core/deps/imgui/imgui.h +++ b/core/deps/imgui/imgui.h @@ -63,7 +63,7 @@ Index of this file: #include #define IM_ASSERT(_EXPR) assert(_EXPR) // You can override the default assert handler by editing imconfig.h #endif -#if (defined(__clang__) || defined(__GNUC__)) && !defined(_ANDROID) +#if (defined(__clang__) || defined(__GNUC__)) && !defined(__ANDROID__) #define IM_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT+1))) // Apply printf-style warnings to user functions. #define IM_FMTLIST(FMT) __attribute__((format(printf, FMT, 0))) #else diff --git a/core/deps/vixl/platform-vixl.h b/core/deps/vixl/platform-vixl.h index b59e536d8..65f90ee3c 100644 --- a/core/deps/vixl/platform-vixl.h +++ b/core/deps/vixl/platform-vixl.h @@ -35,7 +35,7 @@ extern "C" { #define VIXL_CODE_BUFFER_MALLOC //#define VIXL_DEBUG -#if defined(_ANDROID) && defined(VIXL_DEBUG) +#if defined(__ANDROID__) && defined(VIXL_DEBUG) #include #ifdef printf diff --git a/core/emitter/x86_op_encoder.h b/core/emitter/x86_op_encoder.h index f2228c40c..e3523a523 100644 --- a/core/emitter/x86_op_encoder.h +++ b/core/emitter/x86_op_encoder.h @@ -60,7 +60,7 @@ #include "build.h" -#if BUILD_COMPILER == COMPILER_GCC +#ifdef __GNUC__ #define __fastcall BALLZZ!! #endif diff --git a/core/hw/aica/dsp_arm64.cpp b/core/hw/aica/dsp_arm64.cpp index dfd48de24..aaa6b8d91 100644 --- a/core/hw/aica/dsp_arm64.cpp +++ b/core/hw/aica/dsp_arm64.cpp @@ -99,7 +99,7 @@ public: Mov(ADRS_REG, 0); Ldr(MDEC_CT, dsp_operand(&DSP->regs.MDEC_CT)); -#ifndef _ANDROID +#ifndef __ANDROID__ Instruction* instr_cur = GetBuffer()->GetEndAddress(); DEBUG_LOG(AICA_ARM, "DSP PROLOGUE"); Disassemble(instr_start, instr_cur); @@ -356,7 +356,7 @@ public: Add(w1, w1, w2); Str(w1, mem_operand); } -#ifndef _ANDROID +#ifndef __ANDROID__ instr_cur = GetBuffer()->GetEndAddress(); DEBUG_LOG(AICA_ARM, "DSP STEP %d: %04x %04x %04x %04x", step, mpro[0], mpro[1], mpro[2], mpro[3]); Disassemble(instr_start, instr_cur); @@ -378,7 +378,7 @@ public: Ldp(x19, x20, MemOperand(sp, 80)); Ldp(x29, x30, MemOperand(sp, 96, PostIndex)); Ret(); -#ifndef _ANDROID +#ifndef __ANDROID__ instr_cur = GetBuffer()->GetEndAddress(); DEBUG_LOG(AICA_ARM, "DSP EPILOGUE"); Disassemble(instr_start, instr_cur); @@ -534,7 +534,7 @@ void dsp_step() dsp_recompile(); } -#ifdef _ANDROID +#ifdef __ANDROID__ ((void (*)())&dsp.DynCode)(); #endif } diff --git a/core/hw/aica/sgc_if.cpp b/core/hw/aica/sgc_if.cpp index eaa98fde0..e6a10d752 100755 --- a/core/hw/aica/sgc_if.cpp +++ b/core/hw/aica/sgc_if.cpp @@ -1215,7 +1215,7 @@ void AICA_Sample32() mxlr[i*2+1] += oRight; } } -#if HOST_OS==OS_WINDOWS +#ifdef _WIN32 samples_gen += sg; #endif //OK , generated all Channels , now DSP/ect + final mix ;p diff --git a/core/hw/arm7/arm7.cpp b/core/hw/arm7/arm7.cpp index 240eec847..3bc809422 100644 --- a/core/hw/arm7/arm7.cpp +++ b/core/hw/arm7/arm7.cpp @@ -601,7 +601,7 @@ u8* icPtr; u8* ICache; extern const u32 ICacheSize=1024*1024; -#if HOST_OS == OS_WINDOWS +#ifdef _WIN32 u8 ARM7_TCB[ICacheSize+4096]; #elif HOST_OS == OS_LINUX @@ -650,7 +650,7 @@ void armv_prof(OpType opt,u32 op,u32 flg); extern "C" void arm_dispatch(); extern "C" void arm_exit(); extern "C" void DYNACALL -#if BUILD_COMPILER == COMPILER_GCC +#ifdef __GNUC__ // Avoid inlining / duplicating / whatever __attribute__ ((optimize(0))) #endif @@ -690,7 +690,7 @@ u32 DYNACALL DoMemOp(u32 addr,u32 data) } //findfirstset -- used in LDM/STM handling -#if HOST_CPU==CPU_X86 && BUILD_COMPILER != COMPILER_GCC +#if HOST_CPU==CPU_X86 && !defined(__GNUC__) #include u32 findfirstset(u32 v) @@ -2083,7 +2083,7 @@ void FlushCache() #if HOST_CPU == CPU_X86 -#if HOST_OS == OS_WINDOWS +#ifdef _WIN32 #include #endif diff --git a/core/hw/mem/_vmem.cpp b/core/hw/mem/_vmem.cpp index 07be68087..cd060a9d7 100644 --- a/core/hw/mem/_vmem.cpp +++ b/core/hw/mem/_vmem.cpp @@ -444,7 +444,7 @@ bool vmem_4gb_space; static VMemType vmemstatus; void* malloc_pages(size_t size) { -#if HOST_OS == OS_WINDOWS +#ifdef _WIN32 return _aligned_malloc(size, PAGE_SIZE); #elif defined(_ISOC11_SOURCE) return aligned_alloc(PAGE_SIZE, size); @@ -694,7 +694,7 @@ void _vmem_enable_mmu(bool enable) void _vmem_protect_vram(u32 addr, u32 size) { addr &= VRAM_MASK; - if (!mmu_enabled()) + if (!mmu_enabled() || !_nvmem_4gb_space()) { mem_region_lock(virt_ram_base + 0x04000000 + addr, size); // P0 //mem_region_lock(virt_ram_base + 0x06000000 + addr, size); // P0 - mirror @@ -728,7 +728,7 @@ void _vmem_protect_vram(u32 addr, u32 size) void _vmem_unprotect_vram(u32 addr, u32 size) { addr &= VRAM_MASK; - if (!mmu_enabled()) + if (!mmu_enabled() || !_nvmem_4gb_space()) { mem_region_unlock(virt_ram_base + 0x04000000 + addr, size); // P0 //mem_region_unlock(virt_ram_base + 0x06000000 + addr, size); // P0 - mirror diff --git a/core/hw/mem/vmem32.cpp b/core/hw/mem/vmem32.cpp index 95f170aa5..4f1686047 100644 --- a/core/hw/mem/vmem32.cpp +++ b/core/hw/mem/vmem32.cpp @@ -31,7 +31,7 @@ #include /* For O_* constants */ #include #include -#ifdef _ANDROID +#ifdef __ANDROID__ #include #endif #endif diff --git a/core/hw/modem/dns.cpp b/core/hw/modem/dns.cpp index 95c8657c4..00512b54a 100644 --- a/core/hw/modem/dns.cpp +++ b/core/hw/modem/dns.cpp @@ -20,7 +20,7 @@ */ #include "types.h" -#if BUILD_COMPILER!=COMPILER_VC && (BUILD_COMPILER!=COMPILER_CLANG || !defined(WIN32)) +#if !defined(_MSC_VER) && (BUILD_COMPILER!=COMPILER_CLANG || !defined(WIN32)) #include #include diff --git a/core/hw/naomi/naomi_cart.cpp b/core/hw/naomi/naomi_cart.cpp index e3ad4e451..c0939451c 100644 --- a/core/hw/naomi/naomi_cart.cpp +++ b/core/hw/naomi/naomi_cart.cpp @@ -37,7 +37,7 @@ Cartridge *CurrentCartridge; bool bios_loaded = false; -#if HOST_OS == OS_WINDOWS +#ifdef _WIN32 typedef HANDLE fd_t; #define INVALID_FD INVALID_HANDLE_VALUE #else @@ -348,7 +348,7 @@ static void naomi_cart_LoadZip(const char *filename) } } -#if HOST_OS == OS_WINDOWS +#ifdef _WIN32 #define CloseFile(f) CloseHandle(f) #else #define CloseFile(f) close(f) @@ -513,7 +513,7 @@ void naomi_cart_LoadRom(const char* file) RomCacheMap[i] = INVALID_FD; continue; } -#if HOST_OS == OS_WINDOWS +#ifdef _WIN32 RomCache = CreateFile(t, FILE_READ_ACCESS, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); #else RomCache = open(t, O_RDONLY); @@ -526,7 +526,7 @@ void naomi_cart_LoadRom(const char* file) break; } -#if HOST_OS == OS_WINDOWS +#ifdef _WIN32 // Windows doesn't allow mapping a read-only file to a memory area larger than the file size BY_HANDLE_FILE_INFORMATION file_info; GetFileInformationByHandle(RomCache, &file_info); diff --git a/core/hw/pvr/Renderer_if.cpp b/core/hw/pvr/Renderer_if.cpp index dc40cf4d5..2177e8f92 100644 --- a/core/hw/pvr/Renderer_if.cpp +++ b/core/hw/pvr/Renderer_if.cpp @@ -528,7 +528,7 @@ void rend_start_render() max_mvo=max(max_mvo,ctx->rend.global_param_mvo.used()); max_modt=max(max_modt,ctx->rend.modtrig.used()); -#if HOST_OS==OS_WINDOWS && 0 +#if defined(_WIN32) && 0 printf("max: idx: %d, vtx: %d, op: %d, pt: %d, tr: %d, mvo: %d, modt: %d, ov: %d\n", max_idx, max_vtx, max_op, max_pt, max_tr, max_mvo, max_modt, ovrn); #endif if (QueueRender(ctx)) @@ -555,7 +555,7 @@ void rend_start_render() void rend_end_render() { #if 1 //also disabled the printf, it takes quite some time ... - #if HOST_OS!=OS_WINDOWS && !(defined(_ANDROID) || defined(TARGET_PANDORA)) + #if !defined(_WIN32) && !(defined(__ANDROID__) || defined(TARGET_PANDORA)) //too much console spam. //TODO: how about a counter? //if (!re.state) printf("Render > Extended time slice ...\n"); diff --git a/core/hw/sh4/dyna/blockmanager.cpp b/core/hw/sh4/dyna/blockmanager.cpp index 44f60320a..9fa34c74e 100644 --- a/core/hw/sh4/dyna/blockmanager.cpp +++ b/core/hw/sh4/dyna/blockmanager.cpp @@ -264,7 +264,7 @@ void bm_Reset() static void bm_LockPage(u32 addr) { addr = addr & (RAM_MASK - PAGE_MASK); - if (!mmu_enabled()) + if (!mmu_enabled() || !_nvmem_4gb_space()) mem_region_lock(virt_ram_base + 0x0C000000 + addr, PAGE_SIZE); if (_nvmem_4gb_space()) { @@ -277,7 +277,7 @@ static void bm_LockPage(u32 addr) static void bm_UnlockPage(u32 addr) { addr = addr & (RAM_MASK - PAGE_MASK); - if (!mmu_enabled()) + if (!mmu_enabled() || !_nvmem_4gb_space()) mem_region_unlock(virt_ram_base + 0x0C000000 + addr, PAGE_SIZE); if (_nvmem_4gb_space()) { @@ -608,7 +608,7 @@ bool bm_RamWriteAccess(void *p) return false; } u32 addr = (u8*)p - virt_ram_base; - if (mmu_enabled() && (addr & 0x80000000) == 0) + if (mmu_enabled() && _nvmem_4gb_space() && (addr & 0x80000000) == 0) // If mmu enabled, let vmem32 manage user space // shouldn't be necessary since it's called first return false; diff --git a/core/hw/sh4/dyna/driver.cpp b/core/hw/sh4/dyna/driver.cpp index 180f37e5c..01c216e0b 100644 --- a/core/hw/sh4/dyna/driver.cpp +++ b/core/hw/sh4/dyna/driver.cpp @@ -24,7 +24,7 @@ #if FEAT_SHREC != DYNAREC_NONE u8 SH4_TCB[CODE_SIZE + TEMP_CODE_SIZE + 4096] -#if HOST_OS == OS_WINDOWS || FEAT_SHREC != DYNAREC_JIT +#if defined(_WIN32) || FEAT_SHREC != DYNAREC_JIT ; #elif HOST_OS == OS_LINUX __attribute__((section(".text"))); diff --git a/core/hw/sh4/dyna/shil_canonical.h b/core/hw/sh4/dyna/shil_canonical.h index 556e446c1..0405bf44c 100644 --- a/core/hw/sh4/dyna/shil_canonical.h +++ b/core/hw/sh4/dyna/shil_canonical.h @@ -7,7 +7,7 @@ d) Cookies (if you're really lucky) */ -#if HOST_CPU == CPU_ARM && !defined(_ANDROID) && 0 +#if HOST_CPU == CPU_ARM && !defined(__ANDROID__) && 0 //FIXME: Fix extern function support on shil, or remove these extern "C" void ftrv_asm(float* fd,float* fn, float* fm); extern "C" f32 fipr_asm(float* fn, float* fm); diff --git a/core/hw/sh4/modules/wince.h b/core/hw/sh4/modules/wince.h index 472d6834c..1de81cf15 100644 --- a/core/hw/sh4/modules/wince.h +++ b/core/hw/sh4/modules/wince.h @@ -227,8 +227,10 @@ static const char *wince_methods[][256] = { }, }; +#ifdef TRACE_WINCE_SYSCALLS extern u32 unresolved_ascii_string; extern u32 unresolved_unicode_string; +#endif static inline std::string get_unicode_string(u32 addr) { @@ -238,7 +240,9 @@ static inline std::string get_unicode_string(u32 addr) u16 c; if (!read_mem16(addr, c)) { +#ifdef TRACE_WINCE_SYSCALLS unresolved_unicode_string = addr; +#endif return "(page fault)"; } if (c == 0) @@ -256,7 +260,9 @@ static inline std::string get_ascii_string(u32 addr) u8 c; if (!read_mem8(addr++, c)) { +#ifdef TRACE_WINCE_SYSCALLS unresolved_ascii_string = addr; +#endif return "(page fault)"; } if (c == 0) diff --git a/core/hw/sh4/sh4_core_regs.cpp b/core/hw/sh4/sh4_core_regs.cpp index f65bf0e90..0e7c230d9 100644 --- a/core/hw/sh4/sh4_core_regs.cpp +++ b/core/hw/sh4/sh4_core_regs.cpp @@ -69,7 +69,7 @@ void SetFloatStatusReg() old_dn=fpscr.DN ; //Correct rounding is required by some games (SOTB, etc) -#if BUILD_COMPILER == COMPILER_VC +#ifdef _MSC_VER if (fpscr.RM == 1) //if round to 0 , set the flag _controlfp(_RC_CHOP, _MCW_RC); else diff --git a/core/imgread/common.cpp b/core/imgread/common.cpp index 4a070ec2e..1deafb870 100644 --- a/core/imgread/common.cpp +++ b/core/imgread/common.cpp @@ -4,7 +4,7 @@ Disc* chd_parse(const wchar* file); Disc* gdi_parse(const wchar* file); Disc* cdi_parse(const wchar* file); Disc* cue_parse(const wchar* file); -#if HOST_OS==OS_WINDOWS +#ifdef _WIN32 Disc* ioctl_parse(const wchar* file); #endif @@ -17,7 +17,7 @@ Disc*(*drivers[])(const wchar* path)= gdi_parse, cdi_parse, cue_parse, -#if HOST_OS==OS_WINDOWS +#ifdef _WIN32 ioctl_parse, #endif 0 diff --git a/core/imgread/gdi.cpp b/core/imgread/gdi.cpp index 40c73feb6..3fc4a1731 100644 --- a/core/imgread/gdi.cpp +++ b/core/imgread/gdi.cpp @@ -7,7 +7,7 @@ string normalize_path_separator(string path) { -#if HOST_OS == OS_WINDOWS +#ifdef _WIN32 std::replace(path.begin(), path.end(), '/', '\\'); #endif @@ -19,7 +19,7 @@ string normalize_path_separator(string path) string OS_dirname(string file) { file = normalize_path_separator(file); - #if HOST_OS == OS_WINDOWS + #ifdef _WIN32 const char sep = '\\'; #else const char sep = '/'; diff --git a/core/imgread/ioctl.cpp b/core/imgread/ioctl.cpp index 9dfd66b43..75e2c7eed 100644 --- a/core/imgread/ioctl.cpp +++ b/core/imgread/ioctl.cpp @@ -1,6 +1,6 @@ #include "types.h" -#if HOST_OS==OS_WINDOWS +#ifdef _WIN32 #include "common.h" #include diff --git a/core/khronos/GL3/gl3w.c b/core/khronos/GL3/gl3w.c index 8b33df835..99955fb26 100644 --- a/core/khronos/GL3/gl3w.c +++ b/core/khronos/GL3/gl3w.c @@ -76,7 +76,7 @@ static void *get_proc(const char *proc) CFRelease(procname); return res; } -#elif defined(_ANDROID) +#elif defined(__ANDROID__) #include #include diff --git a/core/khronos/GL4/gl3w.c b/core/khronos/GL4/gl3w.c index 2a30bcf2e..0fe40a9f0 100644 --- a/core/khronos/GL4/gl3w.c +++ b/core/khronos/GL4/gl3w.c @@ -88,7 +88,7 @@ static GL3WglProc get_proc(const char *proc) *(void **)(&res) = dlsym(libgl, proc); return res; } -#elif defined(_ANDROID) +#elif defined(__ANDROID__) #include #include diff --git a/core/linux-dist/main.cpp b/core/linux-dist/main.cpp index f9d2ce56b..9df25aa45 100644 --- a/core/linux-dist/main.cpp +++ b/core/linux-dist/main.cpp @@ -14,10 +14,6 @@ #include "log/LogManager.h" #include -#if defined(TARGET_EMSCRIPTEN) - #include -#endif - #if defined(SUPPORT_DISPMANX) #include "linux-dist/dispmanx.h" #endif @@ -110,10 +106,6 @@ void os_SetupInput() void UpdateInputState(u32 port) { - #if defined(TARGET_EMSCRIPTEN) - return; - #endif - #if defined(USE_JOYSTICK) input_joystick_handle(joystick_fd, port); #endif @@ -375,14 +367,10 @@ int main(int argc, wchar* argv[]) if (reicast_init(argc, argv)) die("Reicast initialization failed\n"); - #if !defined(TARGET_EMSCRIPTEN) - #if FEAT_HAS_NIXPROF - install_prof_handler(1); - #endif - rend_thread(NULL); - #else - emscripten_set_main_loop(&dc_run, 100, false); + #if FEAT_HAS_NIXPROF + install_prof_handler(1); #endif + rend_thread(NULL); #ifdef TARGET_PANDORA clean_exit(0); @@ -406,12 +394,7 @@ int get_mic_data(u8* buffer) { return 0; } void os_DebugBreak() { - #if !defined(TARGET_EMSCRIPTEN) - raise(SIGTRAP); - #else - ERROR_LOG(COMMON, "DEBUGBREAK!"); - exit(-1); - #endif + raise(SIGTRAP); } diff --git a/core/linux-dist/x11.cpp b/core/linux-dist/x11.cpp index 5865dd007..40e274333 100644 --- a/core/linux-dist/x11.cpp +++ b/core/linux-dist/x11.cpp @@ -570,12 +570,6 @@ void x11_window_set_text(const char* text) } } -void x11_gl_context_destroy() -{ - glXMakeCurrent((Display*)x11_disp, None, NULL); - glXDestroyContext((Display*)x11_disp, (GLXContext)x11_glc); -} - void x11_window_destroy() { destroy_empty_cursor(); diff --git a/core/linux/common.cpp b/core/linux/common.cpp index bb14b4666..6be32ae6a 100644 --- a/core/linux/common.cpp +++ b/core/linux/common.cpp @@ -15,7 +15,7 @@ #include #include #include -#if !defined(TARGET_BSD) && !defined(_ANDROID) && !defined(TARGET_IPHONE) && !defined(TARGET_EMSCRIPTEN) && !defined(TARGET_OSX) && !defined(TARGET_OSX_X64) +#if !defined(TARGET_BSD) && !defined(__ANDROID__) && !defined(TARGET_IPHONE) && !defined(TARGET_OSX) && !defined(TARGET_OSX_X64) #include #include #endif @@ -175,7 +175,7 @@ void enable_runfast() } void linux_fix_personality() { - #if !defined(TARGET_BSD) && !defined(_ANDROID) && !defined(TARGET_OS_MAC) && !defined(TARGET_EMSCRIPTEN) + #if !defined(TARGET_BSD) && !defined(__ANDROID__) && !defined(TARGET_OS_MAC) DEBUG_LOG(BOOT, "Personality: %08X", personality(0xFFFFFFFF)); personality(~READ_IMPLIES_EXEC & personality(0xFFFFFFFF)); DEBUG_LOG(BOOT, "Updated personality: %08X", personality(0xFFFFFFFF)); @@ -183,7 +183,7 @@ void linux_fix_personality() { } void linux_rpi2_init() { -#if !defined(TARGET_BSD) && !defined(_ANDROID) && !defined(TARGET_EMSCRIPTEN) && defined(TARGET_VIDEOCORE) +#if !defined(TARGET_BSD) && !defined(__ANDROID__) && defined(TARGET_VIDEOCORE) void* handle; void (*rpi_bcm_init)(void); diff --git a/core/linux/context.cpp b/core/linux/context.cpp index c39fa72d5..29f47b039 100644 --- a/core/linux/context.cpp +++ b/core/linux/context.cpp @@ -1,6 +1,6 @@ #include "context.h" -#if defined(_ANDROID) +#if defined(__ANDROID__) #include #else #if HOST_OS == OS_DARWIN diff --git a/core/linux/posix_vmem.cpp b/core/linux/posix_vmem.cpp index 4d9c3f9bd..cec92ebcd 100644 --- a/core/linux/posix_vmem.cpp +++ b/core/linux/posix_vmem.cpp @@ -17,7 +17,7 @@ #define MAP_NOSYNC 0 //missing from linux :/ -- could be the cause of android slowness ? #endif -#ifdef _ANDROID +#ifdef __ANDROID__ #include #ifndef ASHMEM_DEVICE #define ASHMEM_DEVICE "/dev/ashmem" @@ -41,7 +41,7 @@ int ashmem_create_region(const char *name, size_t size) { return fd; } -#endif // #ifdef _ANDROID +#endif // #ifdef __ANDROID__ bool mem_region_lock(void *start, size_t len) { @@ -106,7 +106,7 @@ bool mem_region_unmap_file(void *start, size_t len) // Allocates memory via a fd on shmem/ahmem or even a file on disk static int allocate_shared_filemem(unsigned size) { int fd = -1; - #if defined(_ANDROID) + #if defined(__ANDROID__) // Use Android's specific shmem stuff. fd = ashmem_create_region(0, size); #else diff --git a/core/log/ConsoleListenerDroid.cpp b/core/log/ConsoleListenerDroid.cpp index d840e5bef..276683515 100644 --- a/core/log/ConsoleListenerDroid.cpp +++ b/core/log/ConsoleListenerDroid.cpp @@ -1,7 +1,7 @@ // Copyright 2015 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. -#ifdef _ANDROID +#ifdef __ANDROID__ #include @@ -43,4 +43,4 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS level, const char* text) __android_log_write(logLevel, LOG_TAG, text); } -#endif // _ANDROID +#endif // __ANDROID__ diff --git a/core/log/ConsoleListenerNix.cpp b/core/log/ConsoleListenerNix.cpp index afd861627..52b04be58 100644 --- a/core/log/ConsoleListenerNix.cpp +++ b/core/log/ConsoleListenerNix.cpp @@ -1,7 +1,7 @@ // Copyright 2015 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. -#if !defined(_WIN32) && !defined(_ANDROID) +#if !defined(_WIN32) && !defined(__ANDROID__) #include #include @@ -64,4 +64,4 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS level, const char* text) darw_printf("%s%.*s%s", color_attr, text_size, trimmed_text, reset_attr); #endif } -#endif // !_WIN32 && !_ANDROID +#endif // !_WIN32 && !__ANDROID__ diff --git a/core/log/StringUtil.h b/core/log/StringUtil.h index abfe6028b..611d8da9f 100644 --- a/core/log/StringUtil.h +++ b/core/log/StringUtil.h @@ -11,7 +11,7 @@ constexpr u32 CODEPAGE_WINDOWS_1252 = 1252; #include #endif -#if !defined(_WIN32) && !defined(ANDROID) && !defined(__HAIKU__) && !defined(__OpenBSD__) +#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) static locale_t GetCLocale() { static locale_t c_locale = newlocale(LC_ALL_MASK, "C", nullptr); @@ -52,11 +52,11 @@ bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list ar c_locale = _create_locale(LC_ALL, "C"); writtenCount = _vsnprintf_l(out, outsize, format, c_locale, args); #else -#if !defined(ANDROID) && !defined(__HAIKU__) && !defined(__OpenBSD__) +#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) locale_t previousLocale = uselocale(GetCLocale()); #endif writtenCount = vsnprintf(out, outsize, format, args); -#if !defined(ANDROID) && !defined(__HAIKU__) && !defined(__OpenBSD__) +#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) uselocale(previousLocale); #endif #endif @@ -84,7 +84,7 @@ std::string StringFromFormatV(const char* format, va_list args) std::string temp = buf; delete[] buf; #else -#if !defined(ANDROID) && !defined(__HAIKU__) && !defined(__OpenBSD__) +#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) locale_t previousLocale = uselocale(GetCLocale()); #endif if (vasprintf(&buf, format, args) < 0) @@ -93,7 +93,7 @@ std::string StringFromFormatV(const char* format, va_list args) buf = nullptr; } -#if !defined(ANDROID) && !defined(__HAIKU__) && !defined(__OpenBSD__) +#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) uselocale(previousLocale); #endif diff --git a/core/nullDC.cpp b/core/nullDC.cpp index 22c457250..0a9e0d373 100755 --- a/core/nullDC.cpp +++ b/core/nullDC.cpp @@ -41,7 +41,7 @@ static bool disable_vmem32_game; cThread emu_thread(&dc_run, NULL); -#if HOST_OS==OS_WINDOWS +#ifdef _WIN32 #include #endif @@ -54,7 +54,7 @@ cThread emu_thread(&dc_run, NULL); **/ int64_t get_time_usec(void) { -#if HOST_OS==OS_WINDOWS +#ifdef _WIN32 static LARGE_INTEGER freq; LARGE_INTEGER count; @@ -65,7 +65,7 @@ int64_t get_time_usec(void) if (!QueryPerformanceCounter(&count)) return 0; return count.QuadPart * 1000000 / freq.QuadPart; -#elif defined(_POSIX_MONOTONIC_CLOCK) || defined(__QNX__) || defined(ANDROID) || defined(__MACH__) || HOST_OS==OS_LINUX +#elif defined(_POSIX_MONOTONIC_CLOCK) || defined(__QNX__) || defined(__ANDROID__) || defined(__MACH__) || HOST_OS==OS_LINUX struct timespec tv = {0}; if (clock_gettime(CLOCK_MONOTONIC, &tv) < 0) return 0; @@ -649,7 +649,7 @@ void InitSettings() settings.dispmanx.Keep_Aspect = true; #endif -#if (HOST_OS != OS_LINUX || defined(_ANDROID) || defined(TARGET_PANDORA)) +#if (HOST_OS != OS_LINUX || defined(__ANDROID__) || defined(TARGET_PANDORA)) settings.aica.BufferSize = 2048; #else settings.aica.BufferSize = 1024; @@ -746,7 +746,7 @@ void LoadSettings(bool game_specific) settings.dispmanx.Keep_Aspect = cfgLoadBool(game_specific ? cfgGetGameId() : "dispmanx", "maintain_aspect", settings.dispmanx.Keep_Aspect); #endif -#if (HOST_OS != OS_LINUX || defined(_ANDROID) || defined(TARGET_PANDORA)) +#if (HOST_OS != OS_LINUX || defined(__ANDROID__) || defined(TARGET_PANDORA)) settings.aica.BufferSize=2048; #else settings.aica.BufferSize=1024; @@ -899,7 +899,7 @@ void SaveSettings() GamepadDevice::SaveMaplePorts(); -#ifdef _ANDROID +#ifdef __ANDROID__ void SaveAndroidSettings(); SaveAndroidSettings(); #endif diff --git a/core/oslib/audiobackend_directsound.cpp b/core/oslib/audiobackend_directsound.cpp index b9f47ff5d..aa1460836 100644 --- a/core/oslib/audiobackend_directsound.cpp +++ b/core/oslib/audiobackend_directsound.cpp @@ -1,5 +1,5 @@ #include "oslib/audiostream.h" -#if HOST_OS==OS_WINDOWS +#ifdef _WIN32 #include "oslib.h" #include #include diff --git a/core/oslib/audiobackend_pulseaudio.cpp b/core/oslib/audiobackend_pulseaudio.cpp index 16c0295c2..43b06b65f 100644 --- a/core/oslib/audiobackend_pulseaudio.cpp +++ b/core/oslib/audiobackend_pulseaudio.cpp @@ -23,8 +23,9 @@ static void pulseaudio_init() static u32 pulseaudio_push(void* frame, u32 samples, bool wait) { if (pa_simple_write(pulse_stream, frame, (size_t) samples*4, NULL) < 0) { - WARN_LOG(AUDIO, stderr, "PulseAudio: pa_simple_write() failed!"); + WARN_LOG(AUDIO, "PulseAudio: pa_simple_write() failed!"); } + return 0; } static void pulseaudio_term() { @@ -32,7 +33,7 @@ static void pulseaudio_term() { { // Make sure that every single sample was played if (pa_simple_drain(pulse_stream, NULL) < 0) { - WARN_LOG(AUDIO, stderr, "PulseAudio: pa_simple_drain() failed!"); + WARN_LOG(AUDIO, "PulseAudio: pa_simple_drain() failed!"); } pa_simple_free(pulse_stream); } diff --git a/core/oslib/oslib.h b/core/oslib/oslib.h index 8e5e9e433..8edd1c4db 100644 --- a/core/oslib/oslib.h +++ b/core/oslib/oslib.h @@ -9,13 +9,13 @@ void os_CreateWindow(); void os_SetupInput(); void WriteSample(s16 right, s16 left); -#if BUILD_COMPILER==COMPILER_VC +#ifdef _MSC_VER #include #endif u32 static INLINE bitscanrev(u32 v) { -#if (BUILD_COMPILER==COMPILER_GCC) +#ifdef __GNUC__ return 31-__builtin_clz(v); #else unsigned long rv; diff --git a/core/profiler/profiler.cpp b/core/profiler/profiler.cpp index bcdd03f2b..98671eb7e 100644 --- a/core/profiler/profiler.cpp +++ b/core/profiler/profiler.cpp @@ -91,7 +91,7 @@ void prof_periodical() //for (u32 i=0;i // for cache flushing. #endif @@ -71,7 +71,7 @@ void CacheFlush(void* code, void* pEnd) #elif !defined(ARMCC) void CacheFlush(void* code, void* pEnd) { -#if !defined(_ANDROID) && HOST_OS!=OS_DARWIN +#if !defined(__ANDROID__) && HOST_OS!=OS_DARWIN __clear_cache((void*)code, pEnd); #else void* start=code; diff --git a/core/rec-x64/msvc.asm b/core/rec-x64/msvc.asm index 4562cbdd2..1cb881b36 100644 --- a/core/rec-x64/msvc.asm +++ b/core/rec-x64/msvc.asm @@ -4,7 +4,7 @@ SH4_TIMESLICE = 448 CPU_RUNNING = 135266148 PC = 135266120 -EXTERN bm_GetCode2: PROC +EXTERN bm_GetCodeByVAddr: PROC EXTERN UpdateSystem_INTC: PROC EXTERN cycle_counter: dword EXTERN p_sh4rcb: qword @@ -33,7 +33,7 @@ run_loop: slice_loop: mov rax, qword ptr [p_sh4rcb] mov ecx, dword ptr[PC + rax] - call bm_GetCode2 + call bm_GetCodeByVAddr call rax mov ecx, dword ptr [cycle_counter] test ecx, ecx diff --git a/core/rec-x64/rec_x64.cpp b/core/rec-x64/rec_x64.cpp index 3cc8810d3..a9647b7c7 100644 --- a/core/rec-x64/rec_x64.cpp +++ b/core/rec-x64/rec_x64.cpp @@ -321,7 +321,7 @@ public: BlockCompiler(u8 *code_ptr) : Xbyak::CodeGenerator(emit_FreeSpace(), code_ptr), regalloc(this) { - #if HOST_OS == OS_WINDOWS + #ifdef _WIN32 call_regs.push_back(ecx); call_regs.push_back(edx); call_regs.push_back(r8d); diff --git a/core/rec-x86/rec_x86_asm.cpp b/core/rec-x86/rec_x86_asm.cpp index 0d7161980..c05faee1e 100644 --- a/core/rec-x86/rec_x86_asm.cpp +++ b/core/rec-x86/rec_x86_asm.cpp @@ -4,7 +4,7 @@ #include "rec_x86_ngen.h" -#if HOST_OS == OS_WINDOWS +#ifdef _WIN32 naked void ngen_LinkBlock_Shared_stub() { diff --git a/core/rec-x86/rec_x86_driver.cpp b/core/rec-x86/rec_x86_driver.cpp index 3ddc6832b..033941f2a 100644 --- a/core/rec-x86/rec_x86_driver.cpp +++ b/core/rec-x86/rec_x86_driver.cpp @@ -36,7 +36,7 @@ void DetectCpuFeatures() { if (detected) return; detected=true; - #if BUILD_COMPILER == COMPILER_VC + #ifdef _MSC_VER #include int info[4]; __cpuid(info, 1); @@ -710,7 +710,7 @@ void gen_hande(u32 w, u32 sz, u32 mode) { //General - #if HOST_OS != OS_WINDOWS + #ifndef _WIN32 //maintain 16 byte alignment x86e->Emit(op_sub32, ESP, 12); #endif @@ -722,7 +722,7 @@ void gen_hande(u32 w, u32 sz, u32 mode) } else { - #if HOST_OS == OS_WINDOWS + #ifdef _WIN32 //on linux, we have scratch space on esp x86e->Emit(op_sub32,ESP,8); #endif @@ -741,7 +741,7 @@ void gen_hande(u32 w, u32 sz, u32 mode) x86e->Emit(op_movd_xmm_from_r32,XMM1,EDX); } } - #if HOST_OS != OS_WINDOWS + #ifndef _WIN32 //maintain 16 byte alignment if ((sz == SZ_64F) && w == 1) { x86e->Emit(op_add32, ESP, 4); diff --git a/core/rec-x86/rec_x86_ngen.h b/core/rec-x86/rec_x86_ngen.h index d68b5fc01..00de0111a 100644 --- a/core/rec-x86/rec_x86_ngen.h +++ b/core/rec-x86/rec_x86_ngen.h @@ -14,7 +14,7 @@ void ngen_opcode(RuntimeBlockInfo* block, shil_opcode* op,x86_block* x86e, bool staging, bool optimise); -#if BUILD_COMPILER == COMPILER_GCC +#ifdef __GNUC__ extern "C" { #endif @@ -29,7 +29,7 @@ void ngen_mainloop(void* cntx); void DYNACALL ngen_blockcheckfail(u32 addr); void DYNACALL ngen_blockcheckfail2(u32 addr); -#if BUILD_COMPILER == COMPILER_GCC +#ifdef __GNUC__ } #endif diff --git a/core/rend/gles/gles.cpp b/core/rend/gles/gles.cpp index 126a8ce7c..aa87742f5 100644 --- a/core/rend/gles/gles.cpp +++ b/core/rend/gles/gles.cpp @@ -30,7 +30,7 @@ int fbdev = -1; #define GL_MAJOR_VERSION 0x821B #endif #endif -#ifdef _ANDROID +#ifdef __ANDROID__ #include // requires ndk r5 or newer #endif #include "deps/libpng/png.h" @@ -583,7 +583,7 @@ static void do_swap_automation() return false; } } -#ifdef _ANDROID +#ifdef __ANDROID__ EGLint format; if (!eglGetConfigAttrib(gl.setup.display, config, EGL_NATIVE_VISUAL_ID, &format)) { @@ -707,7 +707,7 @@ static void do_swap_automation() return; created_context = false; eglMakeCurrent(gl.setup.display, NULL, NULL, EGL_NO_CONTEXT); -#if HOST_OS == OS_WINDOWS +#ifdef _WIN32 ReleaseDC((HWND)gl.setup.native_wind,(HDC)gl.setup.native_disp); #else if (gl.setup.context != NULL) @@ -721,13 +721,13 @@ static void do_swap_automation() close( fbdev ); fbdev=-1; #endif -#endif // !OS_WINDOWS +#endif // !_WIN32 gl.setup.context = EGL_NO_CONTEXT; gl.setup.surface = EGL_NO_SURFACE; gl.setup.display = EGL_NO_DISPLAY; } -#elif HOST_OS == OS_WINDOWS && !defined(USE_SDL) +#elif defined(_WIN32) && !defined(USE_SDL) #define WGL_DRAW_TO_WINDOW_ARB 0x2001 #define WGL_ACCELERATION_ARB 0x2003 #define WGL_SWAP_METHOD_ARB 0x2007 @@ -1247,7 +1247,7 @@ void gl_load_osd_resources() gl.OSD_SHADER.scale = glGetUniformLocation(gl.OSD_SHADER.program, "scale"); glUniform1i(glGetUniformLocation(gl.OSD_SHADER.program, "tex"), 0); //bind osd texture to slot 0 -#ifdef _ANDROID +#ifdef __ANDROID__ int w, h; if (osd_tex == 0) osd_tex = loadPNG(get_readonly_data_path(DATA_PATH "buttons.png"), w, h); @@ -1403,7 +1403,7 @@ void UpdateFogTexture(u8 *fog_table, GLenum texture_slot, GLint fog_image_format extern u16 kcode[4]; extern u8 rt[4],lt[4]; -#if defined(_ANDROID) +#if defined(__ANDROID__) extern float vjoy_pos[14][8]; #else @@ -1428,7 +1428,7 @@ float vjoy_pos[14][8]= {96,320,64,64}, //ANALOG_POINT {1} }; -#endif // !_ANDROID +#endif // !__ANDROID__ static List osd_vertices; static bool osd_vertices_overrun; @@ -1507,7 +1507,7 @@ static void osd_gen_vertices() void OSD_DRAW(bool clear_screen) { -#ifdef _ANDROID +#ifdef __ANDROID__ if (osd_tex == 0) gl_load_osd_resources(); if (osd_tex != 0) @@ -2055,7 +2055,7 @@ bool RenderFrame() glBufferData(GL_ARRAY_BUFFER, pvrrc.verts.bytes(), pvrrc.verts.head(), GL_STREAM_DRAW); upload_vertex_indices(); } - #if HOST_OS==OS_WINDOWS + #ifdef _WIN32 //Sleep(40); //to test MT stability #endif diff --git a/core/rend/gles/gles.h b/core/rend/gles/gles.h index 46fea628c..87a27e0d6 100755 --- a/core/rend/gles/gles.h +++ b/core/rend/gles/gles.h @@ -3,7 +3,7 @@ #include #include "rend/rend.h" -#if (defined(GLES) && HOST_OS != OS_DARWIN && !defined(USE_SDL)) || defined(_ANDROID) +#if (defined(GLES) && HOST_OS != OS_DARWIN && !defined(USE_SDL)) || defined(__ANDROID__) #define USE_EGL #include #include diff --git a/core/rend/gui.cpp b/core/rend/gui.cpp index 3e92f928a..8abaf6048 100644 --- a/core/rend/gui.cpp +++ b/core/rend/gui.cpp @@ -121,7 +121,7 @@ void gui_init() ImGui::GetStyle().ItemSpacing = ImVec2(8, 8); // from 8,4 ImGui::GetStyle().ItemInnerSpacing = ImVec2(4, 6); // from 4,4 //ImGui::GetStyle().WindowRounding = 0; -#ifdef _ANDROID +#ifdef __ANDROID__ ImGui::GetStyle().GrabMinSize = 20.0f; // from 10 ImGui::GetStyle().ScrollbarSize = 24.0f; // from 16 ImGui::GetStyle().TouchExtraPadding = ImVec2(1, 1); // from 0,0 @@ -183,7 +183,7 @@ void ImGui_Impl_NewFrame() io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX); else io.MousePos = ImVec2(real_x, real_y); -#ifdef _ANDROID +#ifdef __ANDROID__ // Put the "mouse" outside the screen one frame after a touch up // This avoids buttons and the like to stay selected if ((mo_buttons & 0xf) == 0xf) @@ -809,7 +809,7 @@ static void gui_display_settings() { ImGui::AlignTextToFramePadding(); ImGui::Text("%s", get_writable_config_path("").c_str()); -#ifdef _ANDROID +#ifdef __ANDROID__ ImGui::SameLine(ImGui::GetContentRegionAvailWidth() - ImGui::CalcTextSize("Change").x - ImGui::GetStyle().FramePadding.x); if (ImGui::Button("Change")) gui_state = Onboarding; @@ -923,7 +923,7 @@ static void gui_display_settings() controller_mapping_popup(gamepad); -#ifdef _ANDROID +#ifdef __ANDROID__ if (gamepad->is_virtual_gamepad()) { if (ImGui::Button("Edit")) @@ -1247,7 +1247,7 @@ static void gui_display_settings() ImGui::Checkbox("Force Windows CE", &settings.dreamcast.ForceWindowsCE); ImGui::SameLine(); ShowHelpMarker("Enable full MMU emulation and other Windows CE settings"); -#ifndef _ANDROID +#ifndef __ANDROID ImGui::Checkbox("Serial Console", &settings.debug.SerialConsole); ImGui::SameLine(); ShowHelpMarker("Dump the Dreamcast serial console to stdout"); @@ -1298,7 +1298,7 @@ static void gui_display_settings() #endif ); ImGui::Text("Operating System: %s", -#ifdef _ANDROID +#ifdef __ANDROID__ "Android" #elif HOST_OS == OS_LINUX "Linux" @@ -1308,7 +1308,7 @@ static void gui_display_settings() #else "OSX" #endif -#elif HOST_OS == OS_WINDOWS +#elif defined(_WIN32) "Windows" #else "Unknown" @@ -1320,7 +1320,7 @@ static void gui_display_settings() ImGui::Text("Renderer: %s", (const char *)glGetString(GL_RENDERER)); ImGui::Text("Version: %s", (const char *)glGetString(GL_VERSION)); } -#ifdef _ANDROID +#ifdef __ANDROID__ ImGui::Separator(); if (ImGui::Button("Send Logs")) { void android_send_logs(); @@ -1344,7 +1344,7 @@ static void gui_display_settings() settings.dynarec.Enable = (bool)dynarec_enabled; } -#ifdef _ANDROID +#ifdef __ANDROID__ static std::string current_library_path("/storage/emulated/0/Download"); #else static std::string current_library_path("/home/raph/RetroPie/roms/dreamcast/"); @@ -1563,7 +1563,7 @@ void gui_display_ui() case VJoyEdit: break; case VJoyEditCommands: -#ifdef _ANDROID +#ifdef __ANDROID__ gui_display_vjoy_commands(screen_width, screen_height, scaling); #endif break; diff --git a/core/rend/gui_android.cpp b/core/rend/gui_android.cpp index 5aff13ec7..fd5f1ee48 100644 --- a/core/rend/gui_android.cpp +++ b/core/rend/gui_android.cpp @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with reicast. If not, see . */ -#ifdef _ANDROID +#ifdef __ANDROID__ #include "gui_android.h" #include "gui.h" @@ -65,4 +65,4 @@ void gui_display_vjoy_commands(int screen_width, int screen_height, float scalin ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData(), false); } -#endif // _ANDROID +#endif // __ANDROID__ diff --git a/core/rend/gui_util.cpp b/core/rend/gui_util.cpp index 36ca09565..de5f7ca13 100644 --- a/core/rend/gui_util.cpp +++ b/core/rend/gui_util.cpp @@ -55,7 +55,7 @@ void select_directory_popup(const char *prompt, float scaling, StringCallback ca { if (select_current_directory.empty()) { -#if defined(_ANDROID) +#if defined(__ANDROID__) const char *home = getenv("REICAST_HOME"); if (home != NULL) { @@ -69,7 +69,7 @@ void select_directory_popup(const char *prompt, float scaling, StringCallback ca const char *home = getenv("HOME"); if (home != NULL) select_current_directory = home; -#elif HOST_OS == OS_WINDOWS +#elif defined(_WIN32) const char *home = getenv("HOMEPATH"); const char *home_drive = getenv("HOMEDRIVE"); if (home != NULL) @@ -117,7 +117,7 @@ void select_directory_popup(const char *prompt, float scaling, StringCallback ca select_subfolders.push_back(std::string(1, (char)('A' + i)) + ":\\"); } else -#elif _ANDROID +#elif __ANDROID__ if (select_current_directory == PSEUDO_ROOT) { error_message = "Storage Locations"; @@ -179,7 +179,7 @@ void select_directory_popup(const char *prompt, float scaling, StringCallback ca } } closedir(dir); -#if defined(_WIN32) || defined(_ANDROID) +#if defined(_WIN32) || defined(__ANDROID__) if (!dotdot_seen) select_subfolders.push_back(".."); #endif @@ -231,14 +231,14 @@ void select_directory_popup(const char *prompt, float scaling, StringCallback ca child_path += native_separator; #endif } -#ifdef _ANDROID +#ifdef __ANDROID__ if (access(child_path.c_str(), R_OK) != 0) child_path = PSEUDO_ROOT; #endif } else { -#if defined(_WIN32) || defined(_ANDROID) +#if defined(_WIN32) || defined(__ANDROID__) if (path == PSEUDO_ROOT) child_path = name; else diff --git a/core/rend/soft/softrend.cpp b/core/rend/soft/softrend.cpp index 741f38d19..b324d3f1d 100644 --- a/core/rend/soft/softrend.cpp +++ b/core/rend/soft/softrend.cpp @@ -35,7 +35,7 @@ u32 decoded_colors[3][65536]; DECL_ALIGN(32) u32 render_buffer[MAX_RENDER_PIXELS * 2]; //Color + depth DECL_ALIGN(32) u32 pixels[MAX_RENDER_PIXELS]; -#if HOST_OS != OS_WINDOWS +#ifndef _WIN32 struct RECT { int left, top, right, bottom; @@ -811,7 +811,7 @@ static void Rendtriangle(PolyParam* pp, int vertex_offset, const Vertex &v1, con } } -#if HOST_OS == OS_WINDOWS +#ifdef _WIN32 BITMAPINFOHEADER bi = { sizeof(BITMAPINFOHEADER), 0, 0, 1, 32, BI_RGB }; #endif @@ -897,7 +897,7 @@ struct softrend : Renderer return !is_rtt; } -#if HOST_OS == OS_WINDOWS +#ifdef _WIN32 HWND hWnd; HBITMAP hBMP = 0, holdBMP; HDC hmem; @@ -910,7 +910,7 @@ struct softrend : Renderer u8 ushuffle[] = { 0x0E, 0x80, 0x0E, 0x80, 0x0E, 0x80, 0x0E, 0x80, 0x06, 0x80, 0x06, 0x80, 0x06, 0x80, 0x06, 0x80}; memcpy(&shuffle_alpha, ushuffle, sizeof(shuffle_alpha)); -#if HOST_OS == OS_WINDOWS +#ifdef _WIN32 hWnd = (HWND)libPvr_GetRenderTarget(); bi.biWidth = 640; @@ -1150,7 +1150,7 @@ struct softrend : Renderer } virtual void Term() { -#if HOST_OS == OS_WINDOWS +#ifdef _WIN32 if (hBMP) { DeleteObject(SelectObject(hmem, holdBMP)); DeleteDC(hmem); @@ -1174,7 +1174,7 @@ struct softrend : Renderer #define SHUFFL(v) v // #define SHUFFL(v) shuffle_pixel(v) - #if HOST_OS == OS_WINDOWS + #ifdef _WIN32 #define FLIP_Y 479 - #else #define FLIP_Y @@ -1192,7 +1192,7 @@ struct softrend : Renderer } } -#if HOST_OS == OS_WINDOWS +#ifdef _WIN32 SetDIBits(hmem, hBMP, 0, 480, pixels, (BITMAPINFO*)&bi, DIB_RGB_COLORS); RECT clientRect; diff --git a/core/stdclass.cpp b/core/stdclass.cpp index 0f97e4ac8..7bb5d782c 100644 --- a/core/stdclass.cpp +++ b/core/stdclass.cpp @@ -161,7 +161,7 @@ bool make_directory(const string& path) // Thread & related platform dependant code #if !defined(HOST_NO_THREADS) -#if HOST_OS==OS_WINDOWS +#ifdef _WIN32 void cThread::Start() { verify(hThread == NULL); hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)entry, param, 0, NULL); @@ -191,7 +191,7 @@ void cThread::WaitToEnd() { #endif -#if HOST_OS==OS_WINDOWS +#ifdef _WIN32 cResetEvent::cResetEvent() { hEvent = CreateEvent( NULL, // default security attributes diff --git a/core/stdclass.h b/core/stdclass.h index c44763b59..9f1a6c50e 100644 --- a/core/stdclass.h +++ b/core/stdclass.h @@ -4,14 +4,14 @@ #include #include -#if HOST_OS!=OS_WINDOWS +#ifndef _WIN32 #include #else #include #endif -#ifdef _ANDROID +#ifdef __ANDROID__ #include #undef PAGE_MASK #define PAGE_MASK (PAGE_SIZE-1) @@ -171,7 +171,7 @@ private: ThreadEntryFP* entry; void* param; public : - #if HOST_OS==OS_WINDOWS + #ifdef _WIN32 HANDLE hThread; #else pthread_t *hThread; @@ -191,7 +191,7 @@ typedef void* EVENTHANDLE; class cResetEvent { private: -#if HOST_OS==OS_WINDOWS +#ifdef _WIN32 EVENTHANDLE hEvent; #else pthread_mutex_t mutx; @@ -211,7 +211,7 @@ public : class cMutex { private: -#if HOST_OS==OS_WINDOWS +#ifdef _WIN32 CRITICAL_SECTION cs; #else pthread_mutex_t mutx; @@ -221,7 +221,7 @@ public : bool state; cMutex() { -#if HOST_OS==OS_WINDOWS +#ifdef _WIN32 InitializeCriticalSection(&cs); #else pthread_mutex_init ( &mutx, NULL); @@ -229,7 +229,7 @@ public : } ~cMutex() { -#if HOST_OS==OS_WINDOWS +#ifdef _WIN32 DeleteCriticalSection(&cs); #else pthread_mutex_destroy(&mutx); @@ -237,7 +237,7 @@ public : } void Lock() { -#if HOST_OS==OS_WINDOWS +#ifdef _WIN32 EnterCriticalSection(&cs); #else pthread_mutex_lock(&mutx); @@ -245,7 +245,7 @@ public : } bool TryLock() { -#if HOST_OS==OS_WINDOWS +#ifdef _WIN32 return TryEnterCriticalSection(&cs); #else return pthread_mutex_trylock(&mutx)==0; @@ -253,7 +253,7 @@ public : } void Unlock() { -#if HOST_OS==OS_WINDOWS +#ifdef _WIN32 LeaveCriticalSection(&cs); #else pthread_mutex_unlock(&mutx); diff --git a/core/types.h b/core/types.h index 35f6913dc..036fa6ac8 100644 --- a/core/types.h +++ b/core/types.h @@ -2,7 +2,7 @@ #include "build.h" -#if BUILD_COMPILER==COMPILER_VC +#ifdef _MSC_VER #define DECL_ALIGN(x) __declspec(align(x)) #else #ifndef __forceinline @@ -17,7 +17,7 @@ #if HOST_CPU == CPU_X86 - #if BUILD_COMPILER==COMPILER_VC + #ifdef _MSC_VER #define DYNACALL __fastcall #else //android defines fastcall as regparm(3), it doesn't work for us @@ -28,7 +28,7 @@ #define DYNACALL #endif -#if BUILD_COMPILER==COMPILER_VC +#ifdef _MSC_VER #ifdef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES #undef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES #endif @@ -49,7 +49,7 @@ -#if BUILD_COMPILER==COMPILER_VC +#ifdef _MSC_VER //SHUT UP M$ COMPILER !@#!@$# #ifdef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES #undef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES @@ -288,7 +288,7 @@ int darw_printf(const wchar* Text,...); using namespace std; //used for asm-olny functions -#if defined(X86) && COMPILER_VC==BUILD_COMPILER +#if defined(X86) && defined(_MSC_VER) #define naked __declspec( naked ) #else #define naked __attribute__((naked)) @@ -297,13 +297,13 @@ using namespace std; #define INLINE __forceinline //no inline -- fixme -#if BUILD_COMPILER == COMPILER_VC +#ifdef _MSC_VER #define NOINLINE __declspec(noinline) #else #define NOINLINE __attribute__ ((noinline)) #endif -#if BUILD_COMPILER == COMPILER_VC +#ifdef _MSC_VER #define likely(x) x #define unlikely(x) x #else @@ -701,7 +701,7 @@ inline bool is_u16(u32 v) { return (u16)v==(u32)v; } static inline void do_nada(...) { } -#ifdef _ANDROID +#ifdef __ANDROID__ #include #ifdef printf