mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 17:12:25 -05:00
Properly detect mac < 10.4 and use NS api instead. Therefore 10.3 is now minimum supported macOS version
This commit is contained in:
parent
40971873a6
commit
6b8cff6111
4 changed files with 37 additions and 15 deletions
|
@ -15,7 +15,7 @@ It **does not** work with 'modern/premium' Minecraft servers.
|
|||
|
||||
#### Requirements
|
||||
* Windows: 2000 or later. (Windows 98 with KernelEx also *technically* works)
|
||||
* macOS: macOS 10.5 or later. (Can be compiled to work with 10.4 though)
|
||||
* macOS: macOS 10.5 or later. (Can be compiled to work with 10.3/10.4 though)
|
||||
* Linux: libcurl and libopenal.
|
||||
|
||||
**Note:** When running from within VirtualBox, disable Mouse Integration, otherwise the camera will not work propery.
|
||||
|
|
|
@ -171,7 +171,7 @@ static void WaterAnimation_Tick(void) {
|
|||
*#########################################################################################################################*/
|
||||
struct AnimationData {
|
||||
TextureLoc texLoc; /* Tile (not pixel) coordinates in terrain.png */
|
||||
cc_uint16 frameX, frameY; /* Top left pixel coordinates of start frame in animatons.png */
|
||||
cc_uint16 frameX, frameY; /* Top left pixel coordinates of start frame in animations.png */
|
||||
cc_uint16 frameSize; /* Size of each frame in pixel coordinates */
|
||||
cc_uint16 state; /* Current animation frame index */
|
||||
cc_uint16 statesCount; /* Total number of animation frames */
|
||||
|
@ -314,7 +314,7 @@ static void Animations_Validate(void) {
|
|||
/* However, 'usewateranim' and 'uselavaanim' files should always disable use */
|
||||
/* of custom water/lava animations, even when they exist in animations.png */
|
||||
if (data.texLoc == LAVA_TEX_LOC && !alwaysLavaAnim) useLavaAnim = false;
|
||||
if (data.texLoc == WATER_TEX_LOC && !alwaysWaterAnim) useWaterAnim = false;
|
||||
if (data.texLoc == WATER_TEX_LOC && !alwaysWaterAnim) useWaterAnim = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
32
src/Logger.c
32
src/Logger.c
|
@ -1,6 +1,5 @@
|
|||
#include "Logger.h"
|
||||
#include "Platform.h"
|
||||
#include "Chat.h"
|
||||
#include "Window.h"
|
||||
#include "Funcs.h"
|
||||
#include "Stream.h"
|
||||
|
@ -29,6 +28,10 @@
|
|||
#include <signal.h>
|
||||
#include <sys/ucontext.h>
|
||||
#endif
|
||||
#ifdef CC_BUILD_OSX
|
||||
/* Need this to detect macOS < 10.4, and switch to NS* api instead if so */
|
||||
#include <AvailabilityMacros.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
|
@ -254,6 +257,24 @@ void Logger_Backtrace(String* trace, void* ctx) {
|
|||
/* need to define __USE_GNU for dladdr */
|
||||
#define __USE_GNU
|
||||
#endif
|
||||
|
||||
#if defined MAC_OS_X_VERSION_MIN_REQUIRED && (MAC_OS_X_VERSION_MIN_REQUIRED < 1040)
|
||||
#include <mach-o/dyld.h>
|
||||
|
||||
static void DumpFrame(String* trace, void* addr) {
|
||||
String str; char strBuffer[384];
|
||||
const char* name = NULL;
|
||||
NSModule module;
|
||||
|
||||
String_InitArray(str, strBuffer);
|
||||
module = NSModuleForSymbol(addr);
|
||||
if (module) name = NSNameOfModule(module);
|
||||
|
||||
PrintFrame(&str, (cc_uintptr)addr, 0, name, NULL);
|
||||
String_AppendString(trace, &str);
|
||||
Logger_Log(&str);
|
||||
}
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#undef __USE_GNU
|
||||
|
||||
|
@ -270,6 +291,7 @@ static void DumpFrame(String* trace, void* addr) {
|
|||
String_AppendString(trace, &str);
|
||||
Logger_Log(&str);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined CC_BUILD_ANDROID
|
||||
/* android's bionic libc doesn't provide backtrace (execinfo.h) */
|
||||
|
@ -288,12 +310,12 @@ void Logger_Backtrace(String* trace, void* ctx) {
|
|||
String_AppendConst(trace, _NL);
|
||||
}
|
||||
#elif defined CC_BUILD_OSX
|
||||
/* backtrace is only available on OSX since 10.5 */
|
||||
/* backtrace is only available on macOS since 10.5 */
|
||||
void Logger_Backtrace(String* trace, void* ctx) {
|
||||
void* addrs[40];
|
||||
unsigned i, frames;
|
||||
/* See lldb/tools/debugserver/source/MacOSX/stack_logging.h */
|
||||
/* backtrace uses this internally too, and exists since OSX 10.1 */
|
||||
/* backtrace uses this internally too, and exists since macOS 10.1 */
|
||||
extern void thread_stack_pcs(void** buffer, unsigned max, unsigned* nb);
|
||||
|
||||
thread_stack_pcs(addrs, 40, &frames);
|
||||
|
@ -400,7 +422,7 @@ static void PrintRegisters(String* str, void* ctx) {
|
|||
#endif
|
||||
}
|
||||
#elif defined CC_BUILD_OSX && __DARWIN_UNIX03
|
||||
/* See /usr/include/mach/i386/_structs.h (OSX 10.5+) */
|
||||
/* See /usr/include/mach/i386/_structs.h (macOS 10.5+) */
|
||||
static void PrintRegisters(String* str, void* ctx) {
|
||||
mcontext_t r = ((ucontext_t*)ctx)->uc_mcontext;
|
||||
#if defined __i386__
|
||||
|
@ -420,7 +442,7 @@ static void PrintRegisters(String* str, void* ctx) {
|
|||
#endif
|
||||
}
|
||||
#elif defined CC_BUILD_OSX
|
||||
/* See /usr/include/mach/i386/thread_status.h (OSX 10.4) */
|
||||
/* See /usr/include/mach/i386/thread_status.h (macOS 10.4) */
|
||||
static void PrintRegisters(String* str, void* ctx) {
|
||||
mcontext_t r = ((ucontext_t*)ctx)->uc_mcontext;
|
||||
#if defined __i386__
|
||||
|
|
|
@ -38,7 +38,7 @@ const cc_result ReturnCode_FileNotFound = ERROR_FILE_NOT_FOUND;
|
|||
const cc_result ReturnCode_SocketInProgess = WSAEINPROGRESS;
|
||||
const cc_result ReturnCode_SocketWouldBlock = WSAEWOULDBLOCK;
|
||||
#elif defined CC_BUILD_POSIX
|
||||
/* POSIX can be shared between Linux/BSD/OSX */
|
||||
/* POSIX can be shared between Linux/BSD/macOS */
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -1404,8 +1404,8 @@ cc_bool DynamicLib_DescribeError(String* dst) {
|
|||
void* DynamicLib_Load2(const String* path) { return NULL; }
|
||||
void* DynamicLib_Get2(void* lib, const char* name) { return NULL; }
|
||||
cc_bool DynamicLib_DescribeError(String* dst) { return false; }
|
||||
#elif defined CC_BUILD_OSX && __ppc__
|
||||
/* TODO: Only do it for macOS < 10.4 */
|
||||
#elif defined MAC_OS_X_VERSION_MIN_REQUIRED && (MAC_OS_X_VERSION_MIN_REQUIRED < 1040)
|
||||
/* Really old mac OS versions don't have the dlopen/dlsym API */
|
||||
const String DynamicLib_Ext = String_FromConst(".dylib");
|
||||
|
||||
void* DynamicLib_Load2(const String* path) {
|
||||
|
@ -1606,17 +1606,17 @@ static void Platform_InitPosix(void) {
|
|||
/* So writing to closed socket doesn't raise SIGPIPE */
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
/* Assume stopwatch is in nanoseconds */
|
||||
/* Some platforms (e.g. OSX) override this */
|
||||
/* Some platforms (e.g. macOS) override this */
|
||||
sw_freqDiv = 1000;
|
||||
}
|
||||
void Platform_Free(void) { }
|
||||
|
||||
cc_result Platform_Encrypt(const void* data, int len, cc_uint8** enc, int* encLen) {
|
||||
/* TODO: Is there a similar API for OSX/Linux? */
|
||||
/* TODO: Is there a similar API for macOS/Linux? */
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
cc_result Platform_Decrypt(const void* data, int len, String* dst) {
|
||||
/* TODO: Is there a similar API for OSX/Linux? */
|
||||
/* TODO: Is there a similar API for macOS/Linux? */
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
@ -1650,7 +1650,7 @@ void Platform_Init(void) {
|
|||
|
||||
/* NOTE: Call as soon as possible, otherwise can't click on dialog boxes. */
|
||||
GetCurrentProcess(&psn);
|
||||
/* NOTE: TransformProcessType is OSX 10.3 or later */
|
||||
/* NOTE: TransformProcessType is macOS 10.3 or later */
|
||||
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
||||
}
|
||||
#elif defined CC_BUILD_WEB
|
||||
|
|
Loading…
Reference in a new issue