[add] first

This commit is contained in:
2023-10-08 10:24:48 +08:00
commit b1ae0510a9
1048 changed files with 3254361 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
#pragma once
#include <stddef.h>
#include <stdint.h>
typedef void* (*allocate_func)(size_t size);
#if defined(__cplusplus)
extern "C"
{
#endif
void register_allocator(allocate_func allocator);
#if defined(__cplusplus)
}
#endif
#if defined(__cplusplus)
#include <string>
#include <vector>
class Allocator
{
public:
static void* Allocate(size_t size);
static char* CopyToAllocatedStringBuffer(const std::string& input);
static char* CopyToAllocatedStringBuffer(const char* input);
static void CopyStringVectorToNullTerminatedArray(const std::vector<std::string>& input, void*** output);
static void CopyDataVectorToNullTerminatedArray(const std::vector<void*>& input, void*** output, int32_t elementSize);
};
#endif

View File

@@ -0,0 +1,102 @@
#pragma once
#include "il2cpp-config-platforms.h"
#include <stdint.h>
#include "Baselib.h"
#include "C/Baselib_Atomic_TypeSafe.h"
inline void UnityPalFullMemoryBarrier()
{
Baselib_atomic_thread_fence_seq_cst();
}
inline int32_t UnityPalAdd(int32_t* location1, int32_t value)
{
return Baselib_atomic_fetch_add_32_seq_cst(location1, value) + value;
}
#if IL2CPP_ENABLE_INTERLOCKED_64_REQUIRED_ALIGNMENT
inline int64_t UnityPalAdd64(int64_t* location1, int64_t value)
{
return Baselib_atomic_fetch_add_64_seq_cst(location1, value) + value;
}
#endif
inline int32_t UnityPalIncrement(int32_t* value)
{
return Baselib_atomic_fetch_add_32_seq_cst(value, 1) + 1;
}
#if IL2CPP_ENABLE_INTERLOCKED_64_REQUIRED_ALIGNMENT
inline int64_t UnityPalIncrement64(int64_t* value)
{
return Baselib_atomic_fetch_add_64_seq_cst(value, 1) + 1;
}
#endif
inline int32_t UnityPalDecrement(int32_t* value)
{
return Baselib_atomic_fetch_add_32_seq_cst(value, -1) - 1;
}
#if IL2CPP_ENABLE_INTERLOCKED_64_REQUIRED_ALIGNMENT
inline int64_t UnityPalDecrement64(int64_t* value)
{
return Baselib_atomic_fetch_add_64_seq_cst(value, -1) - 1;
}
#endif
inline int32_t UnityPalCompareExchange(int32_t* dest, int32_t exchange, int32_t comparand)
{
Baselib_atomic_compare_exchange_strong_32_seq_cst_seq_cst(dest, &comparand, exchange);
return comparand;
}
inline int64_t UnityPalCompareExchange64(int64_t* dest, int64_t exchange, int64_t comparand)
{
Baselib_atomic_compare_exchange_strong_64_seq_cst_seq_cst(dest, &comparand, exchange);
return comparand;
}
inline void* UnityPalCompareExchangePointer(void* volatile* dest, void* exchange, void* comparand)
{
Baselib_atomic_compare_exchange_strong_ptr_seq_cst_seq_cst((intptr_t*)dest, (intptr_t*)&comparand, (intptr_t)exchange);
return comparand;
}
inline int32_t UnityPalExchange(int32_t* dest, int32_t exchange)
{
return Baselib_atomic_exchange_32_seq_cst(dest, exchange);
}
#if IL2CPP_ENABLE_INTERLOCKED_64_REQUIRED_ALIGNMENT
inline int64_t UnityPalExchange64(int64_t* dest, int64_t exchange)
{
return Baselib_atomic_exchange_64_seq_cst(dest, exchange);
}
#endif
inline void* UnityPalExchangePointer(void* volatile* dest, void* exchange)
{
return (void*)Baselib_atomic_exchange_ptr_seq_cst((intptr_t*)dest, (intptr_t)exchange);
}
inline int64_t UnityPalRead64(int64_t* addr)
{
return Baselib_atomic_fetch_add_64_seq_cst(addr, 0);
}
inline intptr_t UnityPalReadPtrVal(intptr_t* addr)
{
return Baselib_atomic_fetch_add_ptr_seq_cst(addr, 0);
}
inline int32_t UnityPalLoadRelaxed(const int32_t* addr)
{
return Baselib_atomic_load_32_relaxed(addr);
}

View File

@@ -0,0 +1,45 @@
#pragma once
#if defined(__cplusplus)
#include "os/COM.h"
typedef Il2CppGuid UnityPalIl2CppGuid;
typedef Il2CppIUnknown UnityPalIl2CppIUnknown;
typedef Il2CppVariant UnityPalIl2CppVariant;
typedef Il2CppSafeArray UnityPalIl2CppSafeArray;
typedef Il2CppSafeArrayBound UnityPalIl2CppSafeArrayBound;
#else
typedef struct UnityPalIl2CppGuid UnityPalIl2CppGuid;
typedef struct UnityPalIl2CppIUnknown UnityPalIl2CppIUnknown;
typedef struct UnityPalIl2CppVariant UnityPalIl2CppVariant;
typedef struct UnityPalIl2CppSafeArray UnityPalIl2CppSafeArray;
typedef struct UnityPalIl2CppSafeArrayBound UnityPalIl2CppSafeArrayBound;
#endif
#if defined(__cplusplus)
extern "C"
{
#endif
il2cpp_hresult_t UnityPalCOMCreateInstance(const UnityPalIl2CppGuid& clsid, UnityPalIl2CppIUnknown** object);
il2cpp_hresult_t UnityPalCOMCreateFreeThreadedMarshaler(UnityPalIl2CppIUnknown* outer, UnityPalIl2CppIUnknown** marshal);
void UnityPalCOMVariantInit(UnityPalIl2CppVariant* variant);
il2cpp_hresult_t UnityPalCOMVariantClear(UnityPalIl2CppVariant* variant);
UnityPalIl2CppSafeArray* UnityPalCOMSafeArrayCreate(uint16_t type, uint32_t dimension_count, UnityPalIl2CppSafeArrayBound* bounds);
il2cpp_hresult_t UnityPalCOMSafeArrayDestroy(UnityPalIl2CppSafeArray* safeArray);
il2cpp_hresult_t UnityPalCOMSafeArrayAccessData(UnityPalIl2CppSafeArray* safeArray, void** data);
il2cpp_hresult_t UnityPalCOMSafeArrayUnaccessData(UnityPalIl2CppSafeArray* safeArray);
il2cpp_hresult_t UnityPalCOMSafeArrayGetVartype(UnityPalIl2CppSafeArray* safeArray, uint16_t* type);
uint32_t UnityPalCOMSafeArrayGetDim(UnityPalIl2CppSafeArray* safeArray);
il2cpp_hresult_t UnityPalCOMSafeArrayGetLBound(UnityPalIl2CppSafeArray* safeArray, uint32_t dimention, int32_t* bound);
il2cpp_hresult_t UnityPalCOMSafeArrayGetUBound(UnityPalIl2CppSafeArray* safeArray, uint32_t dimention, int32_t* bound);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,28 @@
#pragma once
#include <stdint.h>
#include "Mutex-c-api.h"
#if defined(__cplusplus)
#include "os/ConditionVariable.h"
typedef il2cpp::os::ConditionVariable UnityPalConditionVariable;
#else
typedef struct UnityPalConditionVariable UnityPalConditionVariable;
#endif
#if defined(__cplusplus)
extern "C"
{
#endif
UnityPalConditionVariable* UnityPalConditionVariableNew();
void UnityPalConditionVariableDelete(UnityPalConditionVariable* object);
int UnityPalConditionVariableWait(UnityPalConditionVariable* object, UnityPalFastMutex* lock);
int UnityPalConditionVariableTimedWait(UnityPalConditionVariable* object, UnityPalFastMutex* lock, uint32_t timeout_ms);
void UnityPalConditionVariableBroadcast(UnityPalConditionVariable* object);
void UnityPalConditionVariableSignal(UnityPalConditionVariable* object);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,17 @@
#pragma once
#include <stdint.h>
#if defined(__cplusplus)
extern "C"
{
#endif
int32_t UnityPalConsoleInternalKeyAvailable(int32_t ms_timeout);
int32_t UnityPalConsoleSetBreak(int32_t wantBreak);
int32_t UnityPalConsoleSetEcho(int32_t wantEcho);
int32_t UnityPalConsoleTtySetup(const char* keypadXmit, const char* teardown, uint8_t* control_characters, int32_t** size);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,14 @@
#pragma once
#include <stdint.h>
#if defined(__cplusplus)
extern "C"
{
#endif
void* UnityPalCpuInfoCreate();
int32_t UnityPalCpuInfoUsage(void* previous);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,20 @@
#pragma once
#include <stdint.h>
#if defined(__cplusplus)
extern "C"
{
#endif
void* UnityPalGetCryptographyProvider();
int32_t UnityPalOpenCryptographyProvider();
void UnityPalReleaseCryptographyProvider(void* provider);
int32_t UnityPalCryptographyFillBufferWithRandomBytes(void* provider, uint32_t length, unsigned char* data);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,14 @@
#pragma once
#include <stdint.h>
#if defined(__cplusplus)
extern "C"
{
#endif
int32_t UnityPalIsDebuggerPresent();
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,40 @@
#pragma once
#include "Error-c-api.h"
#include <stdint.h>
#if defined(__cplusplus)
#include "os/Directory.h"
typedef il2cpp::os::Directory::FindHandle UnityPalFindHandle;
#else
typedef struct UnityPalFindHandle UnityPalFindHandle;
#endif
#if defined(__cplusplus)
extern "C"
{
#endif
const char* UnityPalDirectoryGetCurrent(int* error);
int32_t UnityPalDirectorySetCurrent(const char* path, int* error);
int32_t UnityPalDirectoryCreate(const char* path, int *error);
int32_t UnityPalDirectoryRemove(const char* path, int *error);
void UnityPalDirectoryGetFileSystemEntries(const char* path, const char* pathWithPattern, int32_t attrs, int32_t mask, int* error, char*** entries, int32_t* numEntries);
UnityPalFindHandle* UnityPalDirectoryFindHandleNew(const char* searchPathWithPattern);
void UnityPalDirectoryFindHandleDelete(UnityPalFindHandle* object);
int32_t UnityPalDirectoryCloseOSHandle(UnityPalFindHandle* object);
void* UnityPalDirectoryGetOSHandle(UnityPalFindHandle* object);
UnityPalErrorCode UnityPalDirectoryFindFirstFile(UnityPalFindHandle* findHandle, const char* searchPathWithPattern, char** resultFileName, int32_t* resultAttributes);
UnityPalErrorCode UnityPalDirectoryFindNextFile(UnityPalFindHandle* findHandle, char** resultFileName, int32_t* resultAttributes);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,19 @@
#pragma once
#include <stdint.h>
#if defined(__cplusplus)
extern "C"
{
#endif
char* UnityPalGetOsUserName();
char* UnityPalGetMachineName();
char* UnityPalGetEnvironmentVariable(const char* name);
void UnityPalSetEnvironmentVariable(const char* name, const char* value);
char* UnityPalGetHomeDirectory();
int32_t UnityPalGetProcessorCount();
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,27 @@
#pragma once
#include <stdint.h>
#if defined(__cplusplus)
#include "os/Error.h"
typedef il2cpp::os::ErrorCode UnityPalErrorCode;
#else
typedef int32_t UnityPalErrorCode;
#endif
#if defined(__cplusplus)
extern "C"
{
#endif
UnityPalErrorCode UnityPalGetLastError();
void UnityPalSetLastError(UnityPalErrorCode code);
int32_t UnityPalSuccess(UnityPalErrorCode code);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,37 @@
#pragma once
#include "Error-c-api.h"
#include "WaitStatus-c-api.h"
#if defined(__cplusplus)
#include "os/Event.h"
typedef il2cpp::os::Event UnityPalEvent;
typedef il2cpp::os::EventHandle UnityPalEventHandle;
#else
typedef struct UnityPalEvent UnityPalEvent;
typedef struct UnityPalEventHandle UnityPalEventHandle;
#endif
#if defined(__cplusplus)
extern "C"
{
#endif
UnityPalEvent* UnityPalEventNew(int32_t manualReset, int32_t signaled);
void UnityPalEventDelete(UnityPalEvent* event);
UnityPalErrorCode UnityPalEventSet(UnityPalEvent* event);
UnityPalErrorCode UnityPalEventReset(UnityPalEvent* event);
UnityPalWaitStatus UnityPalEventWait(UnityPalEvent* event, int32_t interruptible);
UnityPalWaitStatus UnityPalEventWaitMs(UnityPalEvent* event, uint32_t ms, int32_t interruptible);
UnityPalEventHandle* UnityPalEventHandleNew(UnityPalEvent* Event);
void UnityPalEventHandleDelete(UnityPalEventHandle* Event);
int32_t UnityPalEventHandleWait(UnityPalEventHandle* handle);
int32_t UnityPalEventHandleWaitMs(UnityPalEventHandle* handle, uint32_t ms);
void UnityPalEventHandleSignal(UnityPalEventHandle* handle);
UnityPalEvent* UnityPalEventHandleGet(UnityPalEventHandle* handle);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,64 @@
#pragma once
#include "OSGlobalEnums.h"
#if defined(__cplusplus)
#include "os/ErrorCodes.h"
#include "os/File.h"
typedef il2cpp::os::FileHandle UnityPalFileHandle;
#else
typedef struct UnityPalFileHandle UnityPalFileHandle;
#endif //__cplusplus
typedef struct
{
char* name;
int32_t attributes;
int64_t length;
int64_t creation_time;
int64_t last_access_time;
int64_t last_write_time;
} UnityPalFileStat;
#if defined(__cplusplus)
extern "C"
{
#endif
int32_t UnityPalIsatty(UnityPalFileHandle* fileHandle);
UnityPalFileHandle* UnityPalGetStdInput();
UnityPalFileHandle* UnityPalGetStdOutput();
UnityPalFileHandle* UnityPalGetStdError();
int32_t UnityPalCreatePipe(UnityPalFileHandle** read_handle, UnityPalFileHandle** write_handle);
int32_t UnityPalCreatePipe_with_error(UnityPalFileHandle** read_handle, UnityPalFileHandle** write_handle, int* error);
FileType UnityPalGetFileType(UnityPalFileHandle* handle);
UnityPalFileAttributes UnityPalGetFileAttributes(const char* path, int* error);
int32_t UnityPalSetFileAttributes(const char* path, UnityPalFileAttributes attributes, int* error);
int32_t UnityPalGetFileStat(const char* path, UnityPalFileStat * stat, int* error);
int32_t UnityPalCopyFile(const char* src, const char* dest, int32_t overwrite, int* error);
int32_t UnityPalMoveFile(const char* src, const char* dest, int* error);
int32_t UnityPalDeleteFile(const char* path, int *error);
int32_t UnityPalReplaceFile(const char* sourceFileName, const char* destinationFileName, const char* destinationBackupFileName, int32_t ignoreMetadataErrors, int* error);
UnityPalFileHandle* UnityPalOpen(const char* path, int openMode, int accessMode, int shareMode, int options, int *error);
int32_t UnityPalClose(UnityPalFileHandle* handle, int *error);
int32_t UnityPalSetFileTime(UnityPalFileHandle* handle, int64_t creation_time, int64_t last_access_time, int64_t last_write_time, int* error);
int64_t UnityPalGetLength(UnityPalFileHandle* handle, int *error);
int32_t UnityPalSetLength(UnityPalFileHandle* handle, int64_t length, int *error);
int32_t UnityPalTruncate(UnityPalFileHandle* handle, int *error);
int64_t UnityPalSeek(UnityPalFileHandle* handle, int64_t offset, int origin, int *error);
int UnityPalRead(UnityPalFileHandle* handle, char *dest, int count, int *error);
int32_t UnityPalWrite(UnityPalFileHandle* handle, const char* buffer, int count, int *error);
int32_t UnityPalFlush(UnityPalFileHandle* handle, int* error);
void UnityPalLock(UnityPalFileHandle* handle, int64_t position, int64_t length, int* error);
void UnityPalUnlock(UnityPalFileHandle* handle, int64_t position, int64_t length, int* error);
int32_t UnityPalDuplicateHandle(UnityPalFileHandle* source_process_handle, UnityPalFileHandle* source_handle, UnityPalFileHandle* target_process_handle,
UnityPalFileHandle** target_handle, int access, int inherit, int options, int* error);
int32_t UnityPalIsExecutable(const char* filename);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,26 @@
#pragma once
#include "WaitStatus-c-api.h"
#include <stddef.h>
#if defined(__cplusplus)
#include "os/Handle.h"
typedef il2cpp::os::Handle UnityPalHandle;
#else
typedef struct UnityPalHandle UnityPalHandle;
#endif
#if defined(__cplusplus)
extern "C"
{
#endif
void UnityPalHandleDestroy(UnityPalHandle* handle);
UnityPalWaitStatus UnityPalHandleWait(UnityPalHandle* handle, int32_t interruptible);
UnityPalWaitStatus UnityPalHandleWaitMs(UnityPalHandle* handle, uint32_t ms, int32_t interruptible);
UnityPalWaitStatus UnityPalHandleSignalAndWait(UnityPalHandle* toSignal, UnityPalHandle* toWait, uint32_t ms, int32_t interruptible);
UnityPalWaitStatus UnityPalWaitForMultipleHandles(UnityPalHandle** handles, size_t numberOfHandlers, int32_t waitAll, uint32_t ms, int32_t interruptible);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,22 @@
#pragma once
#if defined(__cplusplus)
#include "os/LibraryLoader.h"
typedef Il2CppMethodPointer UnityPalMethodPointer;
#else
typedef void (*UnityPalMethodPointer)();
#endif
#if defined(__cplusplus)
extern "C"
{
#endif
void* UnityPalLibraryLoaderLoadDynamicLibrary(const char* nativeDynamicLibrary, int flags);
void UnityPalLibraryLoaderCleanupLoadedLibraries();
UnityPalMethodPointer UnityPalLibraryLoaderGetFunctionPointer(void* dynamicLibrary, const char* functionName);
int32_t UnityPalLibraryLoaderCloseLoadedLibrary(void** dynamicLibrary);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,14 @@
#pragma once
#if defined(__cplusplus)
extern "C"
{
#endif
void UnityPalLocaleInitialize();
void UnityPalLocaleUnInitialize();
char* UnityPalGetLocale();
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,16 @@
#pragma once
#include <stddef.h>
#if defined(__cplusplus)
extern "C"
{
#endif
void* UnityPalAlignedAlloc(size_t size, size_t alignment);
void* UnityPalAlignedReAlloc(void* memory, size_t newSize, size_t alignment);
void UnityPalAlignedFree(void* memory);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,18 @@
#pragma once
#include "File-c-api.h"
#if defined(__cplusplus)
extern "C"
{
#endif
void* UnityPalMemoryMappedFileMap(UnityPalFileHandle* file);
void UnityPalMemoryMappedFileUnmap(void* address);
void* UnityPalMemoryMappedFileMapWithParams(UnityPalFileHandle* file, int64_t length, int64_t offset);
void UnityPalMemoryMappedFileUnmapWithParams(void* address, int64_t length);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,16 @@
#pragma once
#include "os/c-api/Error-c-api.h"
#include "os/c-api/Messages-c-api.h"
#if defined(__cplusplus)
extern "C"
{
#endif
char* UnityPalMessagesFromCode(UnityPalErrorCode code);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,44 @@
#pragma once
#if defined(__cplusplus)
#include "os/Mutex.h"
#include "os/WaitStatus.h"
typedef il2cpp::os::Mutex UnityPalMutex;
typedef il2cpp::os::MutexHandle UnityPalMutexHandle;
typedef il2cpp::os::FastMutex UnityPalFastMutex;
typedef il2cpp::os::FastMutexImpl UnityPalFastMutexImpl;
#else
typedef struct UnityPalMutex UnityPalMutex;
typedef struct UnityPalMutexHandle UnityPalMutexHandle;
typedef struct UnityPalFastMutex UnityPalFastMutex;
typedef struct UnityPalFastMutexImpl UnityPalFastMutexImpl;
#endif
#if defined(__cplusplus)
extern "C"
{
#endif
UnityPalMutex* UnityPalMutexNew(int32_t initiallyOwned);
void UnityPalMutexDelete(UnityPalMutex* mutex);
void UnityPalMutexLock(UnityPalMutex* mutex, int32_t interruptible);
int32_t UnityPalMutexTryLock(UnityPalMutex* mutex, uint32_t milliseconds, int32_t interruptible);
void UnityPalMutexUnlock(UnityPalMutex* mutex);
UnityPalMutexHandle* UnityPalMutexHandleNew(UnityPalMutex* mutex);
void UnityPalMutexHandleDelete(UnityPalMutexHandle* mutex);
int32_t UnityPalMutexHandleWait(UnityPalMutexHandle* handle);
int32_t UnityPalMutexHandleWaitMs(UnityPalMutexHandle* handle, uint32_t ms);
void UnityPalMutexHandleSignal(UnityPalMutexHandle* handle);
UnityPalMutex* UnityPalMutexHandleGet(UnityPalMutexHandle* handle);
UnityPalFastMutex* UnityPalFastMutexNew();
void UnityPalFastMutexDelete(UnityPalFastMutex* fastMutex);
void UnityPalFastMutexLock(UnityPalFastMutex* fastMutex);
void UnityPalFastMutexUnlock(UnityPalFastMutex* fastMutex);
UnityPalFastMutexImpl* UnityPalFastMutexGetImpl(UnityPalFastMutex* fastMutex);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,18 @@
#pragma once
#include <stdint.h>
#include "os/c-api/Process_c_api.h"
#if defined(__cplusplus)
extern "C"
{
#endif
int32_t UnityPalNativeCloseProcess(UnityPalProcessHandle* handle);
int32_t UnityPalNativeGetExitCodeProcess(UnityPalProcessHandle* handle, int32_t* exitCode);
int32_t UnityPalNativeGetCurrentProcessId();
UnityPalProcessHandle* UnityPalNativeGetCurrentProcess();
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,77 @@
#pragma once
typedef enum
{
kFileTypeUnknown = 0x0000,
kFileTypeDisk = 0x0001,
kFileTypeChar = 0x0002,
kFileTypePipe = 0x0003,
kFileTypeRemote = 0x8000
} FileType;
typedef enum
{
kFileAttributeReadOnly = 0x00000001,
kFileAttributeHidden = 0x00000002,
kFileAttributeSystem = 0x00000004,
kFileAttributeDirectory = 0x00000010,
kFileAttributeArchive = 0x00000020,
kFileAttributeDevice = 0x00000040,
kFileAttributeNormal = 0x00000080,
kFileAttributeTemporary = 0x00000100,
kFileAttributeSparse_file = 0x00000200,
kFileAttributeReparse_point = 0x00000400,
kFileAttributeCompressed = 0x00000800,
kFileAttributeOffline = 0x00001000,
kFileAttributeNot_content_indexed = 0x00002000,
kFileAttributeEncrypted = 0x00004000,
kFileAttributeVirtual = 0x00010000,
kFileAttributeInternalMonoExecutable = 0x80000000 // Only used internally by Mono
} UnityPalFileAttributes;
typedef enum
{
kFileAccessRead = 0x01,
kFileAccessWrite = 0x02,
kFileAccessExecute = 0x04,
kFileAccessReadWrite = kFileAccessRead | kFileAccessWrite,
kFileAccessReadWriteExecute = kFileAccessRead | kFileAccessWrite | kFileAccessExecute
} FileAccess;
typedef enum
{
kFileModeCreateNew = 1,
kFileModeCreate = 2,
kFileModeOpen = 3,
kFileModeOpenOrCreate = 4,
kFileModeTruncate = 5,
kFileModeAppend = 6
} FileMode;
typedef enum
{
kFileShareNone = 0x0,
kFileShareRead = 0x01,
kFileShareWrite = 0x02,
kFileShareReadWrite = kFileShareRead | kFileShareWrite,
kFileShareDelete = 0x04
} FileShare;
typedef enum
{
kFileOptionsNone = 0,
kFileOptionsTemporary = 1, // Internal. See note in System.IO.FileOptions
kFileOptionsEncrypted = 0x4000,
kFileOptionsDeleteOnClose = 0x4000000,
kFileOptionsSequentialScan = 0x8000000,
kFileOptionsRandomAccess = 0x10000000,
kFileOptionsAsynchronous = 0x40000000,
kFileOptionsWriteThrough = 0x80000000
} FileOptions;
typedef enum
{
kFileSeekOriginBegin = 0,
kFileSeekOriginCurrent = 1,
kFileSeekOriginEnd = 2
} SeekOrigin;

View File

@@ -0,0 +1,18 @@
#pragma once
#include <stdint.h>
#if defined(__cplusplus)
extern "C"
{
#endif
char* UnityPalGetExecutablePath();
char* UnityPalGetTempPath();
int32_t UnityPalIsAbsolutePath(const char* path);
char* UnityPalBasename(const char* path);
char* UnityPalDirectoryName(const char* path);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,25 @@
#pragma once
#if defined(__cplusplus)
typedef il2cpp::os::ProcessHandle UnityPalProcessHandle;
#else
typedef struct UnityPalProcessHandle UnityPalProcessHandle;
#endif
#if defined(__cplusplus)
extern "C"
{
#endif
int UnityPalGetCurrentProcessId();
UnityPalProcessHandle* UnityPalGetProcess(int processId);
void UnityPalFreeProcess(UnityPalProcessHandle* handle);
const char* UnityPalGetProcessName(UnityPalProcessHandle* handle);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,35 @@
#pragma once
#include "WaitStatus-c-api.h"
#if defined(__cplusplus)
#include "os/Semaphore.h"
typedef il2cpp::os::Semaphore UnityPalSemaphore;
typedef il2cpp::os::SemaphoreHandle UnityPalSemaphoreHandle;
#else
typedef struct UnityPalSemaphore UnityPalSemaphore;
typedef struct UnityPalSemaphoreHandle UnityPalSemaphoreHandle;
#endif
#if defined(__cplusplus)
extern "C"
{
#endif
UnityPalSemaphore* UnityPalSemaphoreNew(int32_t initialValue, int32_t maximumValue);
void UnityPalSemaphoreDelete(UnityPalSemaphore* semaphore);
int32_t UnityPalSemaphorePost(UnityPalSemaphore* semaphore, int32_t releaseCount, int32_t* previousCount);
UnityPalWaitStatus UnityPalSemaphoreWait(UnityPalSemaphore* semaphore, int32_t interruptible);
UnityPalWaitStatus UnityPalSemaphoreWaitMs(UnityPalSemaphore* semaphore, uint32_t ms, int32_t interruptible);
UnityPalSemaphoreHandle* UnityPalSemaphoreHandleNew(UnityPalSemaphore* semaphore);
void UnityPalSemaphoreHandleDelete(UnityPalSemaphoreHandle* handle);
int32_t UnityPalSemaphoreHandleWait(UnityPalSemaphoreHandle* handle);
int32_t UnityPalSemaphoreHandleWaitMs(UnityPalSemaphoreHandle* handle, uint32_t ms);
void UnityPalSemaphoreHandleSignal(UnityPalSemaphoreHandle* handle);
UnityPalSemaphore* UnityPalSemaphoreHandleGet(UnityPalSemaphoreHandle* handle);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,24 @@
#pragma once
#include <stdint.h>
#include "WaitStatus-c-api.h"
#if defined(__cplusplus)
#include "os/Socket.h"
#else
#endif //__cplusplus
#if defined(__cplusplus)
extern "C"
{
#endif
UnityPalWaitStatus UnityPalGetHostByName(const char* host, char** name, int32_t* family, char*** aliases, void*** address_list, int32_t* address_size);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#if defined(__cplusplus)
extern "C"
{
#endif
void* UnityPalSystemCertificatesOpenSystemRootStore();
int UnityPalSystemCertificatesEnumSystemCertificates(void* certStore, void** iter, int *format, int* size, void** data);
void UnityPalSystemCertificatesCloseSystemRootStore(void* cStore);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,27 @@
#pragma once
#include <stdint.h>
#if defined(__cplusplus)
#include "os/Thread.h"
typedef il2cpp::os::Thread::ThreadId UnityPalThreadId;
#else
typedef size_t UnityPalThreadId;
#endif //__cplusplus
#if defined(__cplusplus)
extern "C"
{
#endif
void UnityPalThreadInitialize();
void UnityPalSleep(uint32_t milliseconds);
UnityPalThreadId UnityPalGetCurrentThreadId();
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,28 @@
#pragma once
#include "os/c-api/Error-c-api.h"
#if defined(__cplusplus)
#include "os/ThreadLocalValue.h"
typedef il2cpp::os::ThreadLocalValue UnityPalThreadLocalValue;
#else
typedef struct UnityPalThreadLocalValue UnityPalThreadLocalValue;
#endif
#if defined(__cplusplus)
extern "C"
{
#endif
UnityPalThreadLocalValue* UnityPalThreadLocalValueNew();
void UnityPalThreadLocalValueDelete(UnityPalThreadLocalValue* object);
UnityPalErrorCode UnityPalThreadLocalValueSetValue(UnityPalThreadLocalValue* object, void* value);
UnityPalErrorCode UnityPalThreadLocalValueGetValue(UnityPalThreadLocalValue* object, void** value);
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,19 @@
#pragma once
#include "il2cpp-config-platforms.h"
#include <stdint.h>
#if defined(__cplusplus)
extern "C"
{
#endif
uint32_t UnityPalGetTicksMillisecondsMonotonic();
int64_t STDCALL UnityPalGetTicks100NanosecondsMonotonic();
int64_t UnityPalGetTicks100NanosecondsDateTime();
int64_t STDCALL UnityPalGetSystemTimeAsFileTime();
#if defined(__cplusplus)
}
#endif

View File

@@ -0,0 +1,14 @@
#pragma once
// This should match MonoW32HandleWaitRet in the Mono code.
#define MAXIMUM_WAIT_OBJECTS 64
typedef enum
{
kWaitStatusSuccess = 0,
kWaitStatusAbandoned = kWaitStatusSuccess + MAXIMUM_WAIT_OBJECTS,
kWaitStatusAlerted = -1,
kWaitStatusTimeout = -2,
kWaitStatusFailure = -3,
} UnityPalWaitStatus;

View File

@@ -0,0 +1,16 @@
#pragma once
#include "os/c-api/il2cpp-config-platforms.h"
#if !defined(IL2CPP_EXPORT)
#ifdef _MSC_VER
# include <malloc.h>
# define IL2CPP_EXPORT __declspec(dllexport)
# define IL2CPP_IMPORT __declspec(dllimport)
#elif IL2CPP_TARGET_PSP2 || IL2CPP_TARGET_PS4
# define IL2CPP_EXPORT __declspec(dllexport)
# define IL2CPP_IMPORT __declspec(dllimport)
#else
# define IL2CPP_EXPORT __attribute__ ((visibility ("default")))
# define IL2CPP_IMPORT
#endif
#endif

View File

@@ -0,0 +1,410 @@
#pragma once
#include <stddef.h> // ptrdiff_t
#if defined(__aarch64__) && defined(__arm__)
#error We assume both __aarch64__ and __arm__ cannot be defined at tha same time.
#endif
#if defined(__aarch64__) || defined(_M_ARM64)
#define IL2CPP_TARGET_ARM64 1
#define IL2CPP_TARGET_ARMV7 0
#elif defined(__arm__)
#define IL2CPP_TARGET_ARM64 0
#define IL2CPP_TARGET_ARMV7 1
#else
#define IL2CPP_TARGET_ARM64 0
#define IL2CPP_TARGET_ARMV7 0
#endif
#if defined(__arm64e__) && defined(__PTRAUTH_INTRINSICS__)
#define IL2CPP_TARGET_ARM64E 1
#else
#define IL2CPP_TARGET_ARM64E 0
#endif
#if defined(__x86_64__) || defined(_M_X64)
#define IL2CPP_TARGET_X64 1
#define IL2CPP_TARGET_X86 0
#elif defined(__i386__) || defined(_M_IX86)
#define IL2CPP_TARGET_X64 0
#define IL2CPP_TARGET_X86 1
#else
#define IL2CPP_TARGET_X64 0
#define IL2CPP_TARGET_X86 0
#endif
#if defined(EMBEDDED_LINUX)
#define IL2CPP_TARGET_EMBEDDED_LINUX 1
#endif
// Large executables on ARM64 and ARMv7 can cause linker errors.
// Specifically, the arm instruction set limits the range a branch can
// take (e.g. 128MB on ARM64). Normally, the linker will insert branch
// islands to bridge gaps larger than the maximum branch range. However,
// branch islands only work within a section, not across sections. So if
// IL2CPP puts managed code into a specific section of the binary, branch
// isalnds won't work. That means that proejcts with a large executable
// size may fail to link.
//
// Set the define IL2CPP_LARGE_EXECUTABLE_ARM_WORKAROUND to a value of 1
// work around this issue.
//
// The cost of this define is in correctness of managed stack traces.
// With this define enabled, managed stack traces maybe not be correct
// in some cases, because the stack trace generation code must use
// fuzzy heuristics to detemine if a given instrion pointer is in a
// managed method.
#if IL2CPP_TARGET_EMBEDDED_LINUX && IL2CPP_TARGET_ARMV7
// currently on EmbeddedLinux stack unwinding doesn't work properly when using custom code sections on ARMv7
// as a result processing exceptions from managed code and resolving managed stack traces doesn't work
#ifndef IL2CPP_LARGE_EXECUTABLE_ARM_WORKAROUND
#define IL2CPP_LARGE_EXECUTABLE_ARM_WORKAROUND 1
#endif
#endif
#if IL2CPP_TARGET_ARM64 || IL2CPP_TARGET_ARMV7
#ifndef IL2CPP_LARGE_EXECUTABLE_ARM_WORKAROUND
#define IL2CPP_LARGE_EXECUTABLE_ARM_WORKAROUND 0
#endif
#endif
#define IL2CPP_BINARY_SECTION_NAME "il2cpp"
#if defined(SN_TARGET_PSP2)
#define IL2CPP_TARGET_PSP2 1
#define _UNICODE 1
#define UNICODE 1
#include "il2cpp-config-psp2.h"
#elif defined(SN_TARGET_ORBIS)
#define IL2CPP_TARGET_PS4 1
#define _UNICODE 1
#define UNICODE 1
#define IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS 1
#define IL2CPP_METHOD_ATTR __attribute__((section(IL2CPP_BINARY_SECTION_NAME)))
#elif defined(_MSC_VER)
#define IL2CPP_TARGET_WINDOWS 1
#if IL2CPP_LARGE_EXECUTABLE_ARM_WORKAROUND
#define IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS 0
#else
#define IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS !IL2CPP_MONO_DEBUGGER
#endif
#define IL2CPP_PLATFORM_SUPPORTS_DEBUGGER_PRESENT 1
#if IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS
#define IL2CPP_METHOD_ATTR __declspec(code_seg (IL2CPP_BINARY_SECTION_NAME))
#endif
#if defined(_XBOX_ONE)
#define IL2CPP_TARGET_XBOXONE 1
#define IL2CPP_PLATFORM_SUPPORTS_DEBUGGER_PRESENT 1
#define IL2CPP_ENABLE_PLATFORM_THREAD_AFFINTY 1
#elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
#define IL2CPP_TARGET_WINRT 1
#define IL2CPP_PLATFORM_SUPPORTS_SYSTEM_CERTIFICATES 1
#elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)
#define IL2CPP_TARGET_WINDOWS_GAMES 1
#define IL2CPP_PLATFORM_SUPPORTS_SYSTEM_CERTIFICATES 1
#define IL2CPP_ENABLE_PLATFORM_THREAD_AFFINTY 1
#elif (IL2CPP_CUSTOM_PLATFORM)
#else
#define IL2CPP_TARGET_WINDOWS_DESKTOP 1
#define IL2CPP_PLATFORM_SUPPORTS_SYSTEM_CERTIFICATES 1
#define IL2CPP_PLATFORM_SUPPORTS_CPU_INFO 1
// Windows 7 is the min OS we support, so we cannot link newer APIs
#define NTDDI_VERSION 0x06010000
#define _WIN32_WINNT 0x0601
#define WINVER 0x0601
#endif
#define _UNICODE 1
#define UNICODE 1
#define STRICT 1
#elif defined(__APPLE__)
#define IL2CPP_TARGET_DARWIN 1
#define IL2CPP_PLATFORM_SUPPORTS_CPU_INFO 1
#define IL2CPP_PLATFORM_SUPPORTS_TIMEZONEINFO 1
#include "TargetConditionals.h"
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR || TARGET_OS_TV || TARGET_TVOS_SIMULATOR
#define IL2CPP_TARGET_IOS 1
#define IL2CPP_PLATFORM_SUPPORTS_CPU_INFO 1
#else
#define IL2CPP_TARGET_OSX 1
#define IL2CPP_PLATFORM_SUPPORTS_SYSTEM_CERTIFICATES 1
#endif
#if IL2CPP_LARGE_EXECUTABLE_ARM_WORKAROUND
#define IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS 0
#else
#define IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS (!(IL2CPP_TARGET_IOS && IL2CPP_TARGET_ARMV7) && !IL2CPP_MONO_DEBUGGER)
#endif
#if IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS
#define IL2CPP_METHOD_ATTR __attribute__((section ("__TEXT," IL2CPP_BINARY_SECTION_NAME ",regular,pure_instructions")))
#endif
// because it's android based, __ANDROID__ is *also* defined on Lumin.
// so we need to check for that *before* we check __ANDROID__ to avoid false
// positives.
#elif defined(LUMIN)
#define IL2CPP_ENABLE_PLATFORM_THREAD_RENAME 1
#define IL2CPP_TARGET_LUMIN 1
#define IL2CPP_PLATFORM_OVERRIDES_STD_FILE_HANDLES 1
#define IL2CPP_PLATFORM_SUPPORTS_TIMEZONEINFO 1
#define IL2CPP_USE_GENERIC_DEBUG_LOG 0
#define IL2CPP_SUPPORTS_PROCESS 1
#elif defined(__ANDROID__)
#define IL2CPP_TARGET_ANDROID 1
#define IL2CPP_PLATFORM_SUPPORTS_TIMEZONEINFO 1
#define IL2CPP_ENABLE_PLATFORM_THREAD_RENAME 1
#if IL2CPP_LARGE_EXECUTABLE_ARM_WORKAROUND
#define IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS 0
#else
#define IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS !IL2CPP_MONO_DEBUGGER
#endif
#define IL2CPP_PLATFORM_DISABLE_LIBC_PINVOKE 1
#if IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS
#define IL2CPP_METHOD_ATTR __attribute__((section(IL2CPP_BINARY_SECTION_NAME)))
#endif
#elif defined(__EMSCRIPTEN__)
#define IL2CPP_TARGET_JAVASCRIPT 1
#define IL2CPP_PLATFORM_SUPPORTS_CPU_INFO 1
#elif defined(__linux__)
#define IL2CPP_TARGET_LINUX 1
#define IL2CPP_PLATFORM_SUPPORTS_CPU_INFO 1
#define IL2CPP_PLATFORM_SUPPORTS_SYSTEM_CERTIFICATES 1
#if IL2CPP_LARGE_EXECUTABLE_ARM_WORKAROUND
#define IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS 0
#else
#define IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS !IL2CPP_MONO_DEBUGGER
#endif
#if IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS
#define IL2CPP_METHOD_ATTR __attribute__((section(IL2CPP_BINARY_SECTION_NAME)))
#endif
#elif defined(NN_PLATFORM_CTR)
#define IL2CPP_TARGET_N3DS 1
#elif defined(NN_BUILD_TARGET_PLATFORM_NX)
#define IL2CPP_TARGET_SWITCH 1
#include "il2cpp-config-switch.h"
#elif IL2CPP_TARGET_CUSTOM
// defined handled externally
#else
#error please define your target platform
#endif
#if IL2CPP_TARGET_PS5
#define IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS 1
#define IL2CPP_METHOD_ATTR __attribute__((section(IL2CPP_BINARY_SECTION_NAME)))
#endif
#ifndef IL2CPP_TARGET_WINDOWS
#define IL2CPP_TARGET_WINDOWS 0
#endif
#ifndef IL2CPP_TARGET_WINDOWS_DESKTOP
#define IL2CPP_TARGET_WINDOWS_DESKTOP 0
#endif
#ifndef IL2CPP_TARGET_WINDOWS_GAMES
#define IL2CPP_TARGET_WINDOWS_GAMES 0
#endif
#ifndef IL2CPP_TARGET_WINRT
#define IL2CPP_TARGET_WINRT 0
#endif
#ifndef IL2CPP_TARGET_XBOXONE
#define IL2CPP_TARGET_XBOXONE 0
#endif
#ifndef IL2CPP_TARGET_DARWIN
#define IL2CPP_TARGET_DARWIN 0
#endif
#ifndef IL2CPP_TARGET_IOS
#define IL2CPP_TARGET_IOS 0
#endif
#ifndef IL2CPP_TARGET_OSX
#define IL2CPP_TARGET_OSX 0
#endif
#ifndef IL2CPP_TARGET_ANDROID
#define IL2CPP_TARGET_ANDROID 0
#endif
#ifndef IL2CPP_TARGET_JAVASCRIPT
#define IL2CPP_TARGET_JAVASCRIPT 0
#endif
#ifndef IL2CPP_TARGET_LINUX
#define IL2CPP_TARGET_LINUX 0
#endif
#ifndef IL2CPP_TARGET_N3DS
#define IL2CPP_TARGET_N3DS 0
#endif
#ifndef IL2CPP_TARGET_PS4
#define IL2CPP_TARGET_PS4 0
#endif
#ifndef IL2CPP_TARGET_PSP2
#define IL2CPP_TARGET_PSP2 0
#endif
#ifndef IL2CPP_TARGET_SWITCH
#define IL2CPP_TARGET_SWITCH 0
#endif
#ifndef IL2CPP_TARGET_LUMIN
#define IL2CPP_TARGET_LUMIN 0
#endif
#ifndef IL2CPP_TARGET_EMBEDDED_LINUX
#define IL2CPP_TARGET_EMBEDDED_LINUX 0
#endif
#ifndef IL2CPP_TARGET_POSIX
#define IL2CPP_TARGET_POSIX (IL2CPP_TARGET_DARWIN || IL2CPP_TARGET_JAVASCRIPT || IL2CPP_TARGET_LINUX || IL2CPP_TARGET_ANDROID || IL2CPP_TARGET_PS4 || IL2CPP_TARGET_PSP2 || IL2CPP_TARGET_LUMIN)
#endif
#define RUNTIME_TINY (IL2CPP_TINY && !IL2CPP_MONO_DEBUGGER)
#define IL2CPP_TINY_DEBUGGER (IL2CPP_TINY && IL2CPP_MONO_DEBUGGER)
#define IL2CPP_IL2CPP_TINY_SUPPORT_THREADS IL2CPP_TINY && IL2CPP_TINY_DEBUGGER
#define IL2CPP_IL2CPP_TINY_SUPPORT_SOCKETS IL2CPP_TINY && IL2CPP_TINY_DEBUGGER
#ifndef IL2CPP_SUPPORT_THREADS
#define IL2CPP_SUPPORT_THREADS ((!IL2CPP_TARGET_JAVASCRIPT || IL2CPP_TINY_DEBUGGER) && (!IL2CPP_TINY || IL2CPP_IL2CPP_TINY_SUPPORT_THREADS))
#endif
#ifndef IL2CPP_SUPPORT_SOCKETS
#define IL2CPP_SUPPORT_SOCKETS (!IL2CPP_TINY || IL2CPP_IL2CPP_TINY_SUPPORT_SOCKETS)
#endif
#ifndef IL2CPP_PLATFORM_OVERRIDES_STD_FILE_HANDLES
#define IL2CPP_PLATFORM_OVERRIDES_STD_FILE_HANDLES 0
#endif
#ifndef IL2CPP_PLATFORM_SUPPORTS_SYSTEM_CERTIFICATES
#define IL2CPP_PLATFORM_SUPPORTS_SYSTEM_CERTIFICATES 0
#endif
#ifndef IL2CPP_PLATFORM_SUPPORTS_TIMEZONEINFO
#define IL2CPP_PLATFORM_SUPPORTS_TIMEZONEINFO 0
#endif
#ifndef IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS
#define IL2CPP_PLATFORM_SUPPORTS_CUSTOM_SECTIONS 0
#endif
#ifndef IL2CPP_DEBUG
#define IL2CPP_DEBUG 0
#endif
#ifndef IL2CPP_PLATFORM_SUPPORTS_CPU_INFO
#define IL2CPP_PLATFORM_SUPPORTS_CPU_INFO 0
#endif
#ifndef IL2CPP_PLATFORM_SUPPORTS_DEBUGGER_PRESENT
#define IL2CPP_PLATFORM_SUPPORTS_DEBUGGER_PRESENT 0
#endif
#ifndef IL2CPP_PLATFORM_DISABLE_LIBC_PINVOKE
#define IL2CPP_PLATFORM_DISABLE_LIBC_PINVOKE 0
#endif
#ifndef IL2CPP_PLATFORM_SUPPORTS_BACKTRACE_CALL
#define IL2CPP_PLATFORM_SUPPORTS_BACKTRACE_CALL !IL2CPP_TARGET_WINDOWS && !IL2CPP_TARGET_ANDROID && !IL2CPP_TARGET_LUMIN && !IL2CPP_TARGET_PS4 && !IL2CPP_TARGET_PS5
#endif //IL2CPP_PLATFORM_SUPPORTS_BACKTRACE_CALL
#ifndef IL2CPP_SUPPORT_SOCKETS_POSIX_API
#define IL2CPP_SUPPORT_SOCKETS_POSIX_API 0
#endif
#define IL2CPP_USE_STD_THREAD 0
#define IL2CPP_THREADS_STD IL2CPP_USE_STD_THREAD
#define IL2CPP_THREADS_PTHREAD (!IL2CPP_THREADS_STD && IL2CPP_TARGET_POSIX)
#define IL2CPP_THREADS_WIN32 (!IL2CPP_THREADS_STD && IL2CPP_TARGET_WINDOWS)
#define IL2CPP_THREADS_N3DS (!IL2CPP_THREADS_STD && IL2CPP_TARGET_N3DS)
#define IL2CPP_THREADS_PS4 (!IL2CPP_THREADS_STD && IL2CPP_TARGET_PS4)
#define IL2CPP_THREADS_PSP2 (!IL2CPP_THREADS_STD && IL2CPP_TARGET_PSP2)
#define IL2CPP_THREADS_SWITCH (!IL2CPP_THREADS_STD && IL2CPP_TARGET_SWITCH)
// Set to 1 to use the baselib based version of the FastReaderReaderWriterLock
// Use if the baselib::Lock implementation on the platform is faster than the il2cpp::os based version
#ifndef IL2CPP_USE_BASELIB_FAST_READER_RWL
#define IL2CPP_USE_BASELIB_FAST_READER_RWL 0
#endif
#define IL2CPP_THREAD_HAS_CPU_SET IL2CPP_TARGET_POSIX && !IL2CPP_THREADS_PS4
// Not supported on TINY because it doesn't support synchronization context
// Not supported on no runtime because it needs to call back into the runtime!
#define IL2CPP_HAS_OS_SYNCHRONIZATION_CONTEXT (IL2CPP_TARGET_WINDOWS) && !IL2CPP_TINY && !RUNTIME_NONE && !IL2CPP_TARGET_WINDOWS_GAMES
/* Trigger assert if 'ptr' is not aligned to 'alignment'. */
#define ASSERT_ALIGNMENT(ptr, alignment) \
IL2CPP_ASSERT((((ptrdiff_t) ptr) & (alignment - 1)) == 0 && "Unaligned pointer!")
#if defined(_MSC_VER)
#if defined(_M_X64) || defined(_M_ARM64)
#define IL2CPP_SIZEOF_VOID_P 8
#elif defined(_M_IX86) || defined(_M_ARM)
#define IL2CPP_SIZEOF_VOID_P 4
#else
#error invalid windows architecture
#endif
#elif defined(__GNUC__) || defined(__SNC__)
#if defined(__x86_64__)
#define IL2CPP_SIZEOF_VOID_P 8
#elif defined(__i386__)
#define IL2CPP_SIZEOF_VOID_P 4
#elif defined(__EMSCRIPTEN__)
#define IL2CPP_SIZEOF_VOID_P 4
#elif defined(__arm__)
#define IL2CPP_SIZEOF_VOID_P 4
#elif defined(__arm64__) || defined(__aarch64__)
#define IL2CPP_SIZEOF_VOID_P 8
#else
#error invalid windows architecture
#endif
#else
#error please define your target architecture size
#endif
#ifndef IL2CPP_USE_GENERIC_CRASH_HELPERS
#define IL2CPP_USE_GENERIC_CRASH_HELPERS (!IL2CPP_TARGET_WINDOWS && !IL2CPP_TARGET_POSIX)
#endif
#ifndef IL2CPP_SUPPORTS_CONSOLE_EXTENSION
#define IL2CPP_SUPPORTS_CONSOLE_EXTENSION IL2CPP_TARGET_ANDROID
#endif
#define IL2CPP_COMPILER_MSVC (IL2CPP_TARGET_WINDOWS || IL2CPP_TARGET_XBOXONE)
#if IL2CPP_COMPILER_MSVC
#ifndef STDCALL
#define STDCALL __stdcall
#endif
#ifndef CDECL
#define CDECL __cdecl
#endif
#ifndef FASTCALL
#define FASTCALL __fastcall
#endif
#ifndef THISCALL
#define THISCALL __thiscall
#endif
#else
#define STDCALL
#define CDECL
#define FASTCALL
#define THISCALL
#endif

View File

@@ -0,0 +1,9 @@
#pragma once
#if IL2CPP_TARGET_PS4
#define FILE_PATH_PREFIX "/app0/"
#else
#define FILE_PATH_PREFIX
#endif
#define CURRENT_DIRECTORY(filename) FILE_PATH_PREFIX filename