mirror of
				https://github.com/VCMP-SqMod/SqMod.git
				synced 2025-11-04 00:07:19 +01:00 
			
		
		
		
	Further file shuffling and finally builds.
This commit is contained in:
		@@ -32,10 +32,13 @@ endif()
 | 
				
			|||||||
if (UNIX)
 | 
					if (UNIX)
 | 
				
			||||||
	set(CMAKE_POSITION_INDEPENDENT_CODE ON)
 | 
						set(CMAKE_POSITION_INDEPENDENT_CODE ON)
 | 
				
			||||||
endif()
 | 
					endif()
 | 
				
			||||||
 | 
					# Include VCMP library
 | 
				
			||||||
 | 
					add_subdirectory(vcmp)
 | 
				
			||||||
# Include Squirrel library
 | 
					# Include Squirrel library
 | 
				
			||||||
add_subdirectory(squirrel)
 | 
					add_subdirectory(squirrel)
 | 
				
			||||||
# Include Squat library
 | 
					# Include Squat library
 | 
				
			||||||
add_subdirectory(sqrat)
 | 
					add_subdirectory(sqrat)
 | 
				
			||||||
# Global include directories
 | 
					# Include SDK library
 | 
				
			||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 | 
					add_subdirectory(sdk)
 | 
				
			||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
 | 
					# Include Module library
 | 
				
			||||||
 | 
					add_subdirectory(source)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										12
									
								
								sdk/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								sdk/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					# Create the SqSDK library
 | 
				
			||||||
 | 
					add_library(SqSDK STATIC 
 | 
				
			||||||
 | 
						include/SqConfSDK.h
 | 
				
			||||||
 | 
						include/SqAPI.h
 | 
				
			||||||
 | 
						include/SqMod.h
 | 
				
			||||||
 | 
						SqMod.cpp
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					# Library includes
 | 
				
			||||||
 | 
					target_include_directories(SqSDK PRIVATE ${CMAKE_CURRENT_LIST_DIR})
 | 
				
			||||||
 | 
					target_include_directories(SqSDK PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
 | 
				
			||||||
 | 
					# Link to required libraries
 | 
				
			||||||
 | 
					target_link_libraries(SqSDK PRIVATE VCMP Squirrel)
 | 
				
			||||||
							
								
								
									
										365
									
								
								sdk/include/SqConfSDK.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										365
									
								
								sdk/include/SqConfSDK.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,365 @@
 | 
				
			|||||||
 | 
					#ifndef _SQMODBASE_HPP_
 | 
				
			||||||
 | 
					#define _SQMODBASE_HPP_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#include <sqconfig.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#include <cstddef>
 | 
				
			||||||
 | 
					#include <cassert>
 | 
				
			||||||
 | 
					#include <string>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * ARCHITECTURE IDENTIFIERS
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SQMOD_ARCH_ID_UNKNOWN     0
 | 
				
			||||||
 | 
					#define SQMOD_ARCH_ID_32_BIT      1
 | 
				
			||||||
 | 
					#define SQMOD_ARCH_ID_64_BIT      2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * PLATFORM IDENTIFIERS
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SQMOD_PLAT_ID_UNKNOWN     0
 | 
				
			||||||
 | 
					#define SQMOD_PLAT_ID_WINDOWS     1
 | 
				
			||||||
 | 
					#define SQMOD_PLAT_ID_LINUX       2
 | 
				
			||||||
 | 
					#define SQMOD_PLAT_ID_MACOS       3
 | 
				
			||||||
 | 
					#define SQMOD_PLAT_ID_UNIX        4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * OS IDENTIFICATION
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(_WIN32) || defined(__WIN32__) || defined(_WIN) || defined(__WIN__)
 | 
				
			||||||
 | 
					    // Windows x32
 | 
				
			||||||
 | 
					    #define SQMOD_OS_WINDOWS
 | 
				
			||||||
 | 
					    #define SQMOD_OS_32
 | 
				
			||||||
 | 
					    #define SQMOD_OS_WINDOWS32
 | 
				
			||||||
 | 
					    #define SQMOD_ARCHITECTURE 1
 | 
				
			||||||
 | 
					    #define SQMOD_PLATFORM 1
 | 
				
			||||||
 | 
					#elif defined(_WIN64) || defined(__WIN64__)
 | 
				
			||||||
 | 
					    // Windows x64
 | 
				
			||||||
 | 
					    #define SQMOD_OS_WINDOWS
 | 
				
			||||||
 | 
					    #define SQMOD_OS_64
 | 
				
			||||||
 | 
					    #define SQMOD_OS_WINDOWS64
 | 
				
			||||||
 | 
					    #define SQMOD_ARCHITECTURE 2
 | 
				
			||||||
 | 
					    #define SQMOD_PLATFORM 1
 | 
				
			||||||
 | 
					#elif defined(linux) || defined(__linux) || defined(__linux__)
 | 
				
			||||||
 | 
					    // Linux
 | 
				
			||||||
 | 
					    #define SQMOD_OS_LINUX
 | 
				
			||||||
 | 
					    #if __GNUC__
 | 
				
			||||||
 | 
					        #if __x86_64__ || __ppc64__
 | 
				
			||||||
 | 
					            #define SQMOD_OS_64
 | 
				
			||||||
 | 
					            #define SQMOD_OS_LINUX64
 | 
				
			||||||
 | 
					             #define SQMOD_ARCHITECTURE 2
 | 
				
			||||||
 | 
					            #define SQMOD_PLATFORM 2
 | 
				
			||||||
 | 
					        #else
 | 
				
			||||||
 | 
					            #define SQMOD_OS_32
 | 
				
			||||||
 | 
					            #define SQMOD_OS_LINUX32
 | 
				
			||||||
 | 
					             #define SQMOD_ARCHITECTURE 1
 | 
				
			||||||
 | 
					            #define SQMOD_PLATFORM 2
 | 
				
			||||||
 | 
					        #endif
 | 
				
			||||||
 | 
					    #endif
 | 
				
			||||||
 | 
					#elif defined(__APPLE__) || defined(__MACH__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)
 | 
				
			||||||
 | 
					    // MacOS
 | 
				
			||||||
 | 
					    #define SQMOD_OS_MACOS
 | 
				
			||||||
 | 
					    #if __GNUC__
 | 
				
			||||||
 | 
					        #if __x86_64__ || __ppc64__
 | 
				
			||||||
 | 
					            #define SQMOD_OS_64
 | 
				
			||||||
 | 
					            #define SQMOD_OS_MACOS64
 | 
				
			||||||
 | 
					              #define SQMOD_ARCHITECTURE 2
 | 
				
			||||||
 | 
					            #define SQMOD_PLATFORM 3
 | 
				
			||||||
 | 
					        #else
 | 
				
			||||||
 | 
					            #define SQMOD_OS_32
 | 
				
			||||||
 | 
					            #define SQMOD_OS_MACOS32
 | 
				
			||||||
 | 
					              #define SQMOD_ARCHITECTURE 1
 | 
				
			||||||
 | 
					            #define SQMOD_PLATFORM 3
 | 
				
			||||||
 | 
					        #endif
 | 
				
			||||||
 | 
					    #endif
 | 
				
			||||||
 | 
					#elif defined(__unix) || defined(__unix__)
 | 
				
			||||||
 | 
					    // Unix
 | 
				
			||||||
 | 
					    #define SQMOD_OS_UNIX
 | 
				
			||||||
 | 
					    #if __GNUC__
 | 
				
			||||||
 | 
					        #if __x86_64__ || __ppc64__
 | 
				
			||||||
 | 
					            #define SQMOD_OS_64
 | 
				
			||||||
 | 
					            #define SQMOD_OS_UNIX64
 | 
				
			||||||
 | 
					               #define SQMOD_ARCHITECTURE 2
 | 
				
			||||||
 | 
					            #define SQMOD_PLATFORM 4
 | 
				
			||||||
 | 
					        #else
 | 
				
			||||||
 | 
					            #define SQMOD_OS_32
 | 
				
			||||||
 | 
					            #define SQMOD_OS_UNIX32
 | 
				
			||||||
 | 
					               #define SQMOD_ARCHITECTURE 1
 | 
				
			||||||
 | 
					            #define SQMOD_PLATFORM 4
 | 
				
			||||||
 | 
					        #endif
 | 
				
			||||||
 | 
					    #endif
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					    // Unsupported system
 | 
				
			||||||
 | 
					    #error This operating system is not supported by the Squirrel Module
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef SQMOD_ARCHITECTURE
 | 
				
			||||||
 | 
					     #define SQMOD_ARCHITECTURE 0
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef SQMOD_PLATFORM
 | 
				
			||||||
 | 
					     #define SQMOD_PLATFORM 0
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * SQUIRREL FORWARD DECLARATIONS
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern "C" {
 | 
				
			||||||
 | 
					    typedef struct tagSQObject SQObject;
 | 
				
			||||||
 | 
					    struct SQVM;
 | 
				
			||||||
 | 
					    typedef struct SQVM* HSQUIRRELVM;
 | 
				
			||||||
 | 
					    typedef SQObject HSQOBJECT;
 | 
				
			||||||
 | 
					} /*extern "C"*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * SQRAT FORWARD DECLARATIONS
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Sqrat {
 | 
				
			||||||
 | 
					    class Array;
 | 
				
			||||||
 | 
					    class Object;
 | 
				
			||||||
 | 
					    class Table;
 | 
				
			||||||
 | 
					    class Function;
 | 
				
			||||||
 | 
					} // Namespace:: Sqrat
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * FUNDAMENTAL DATATYPES
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace SqMod {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**< 8 bits integer types */
 | 
				
			||||||
 | 
					typedef char                        Int8, I8;
 | 
				
			||||||
 | 
					typedef unsigned char               Uint8, U8;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**< 16 bits integer types */
 | 
				
			||||||
 | 
					typedef short                       Int16, I16;
 | 
				
			||||||
 | 
					typedef unsigned short              Uint16, U16;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**< 32 bits integer types */
 | 
				
			||||||
 | 
					typedef int                         Int32, I32;
 | 
				
			||||||
 | 
					typedef unsigned int                Uint32, U32;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**< 64 bits integer types */
 | 
				
			||||||
 | 
					#if defined(_MSC_VER)
 | 
				
			||||||
 | 
					    typedef __int64                 Int64, I64;
 | 
				
			||||||
 | 
					    typedef unsigned __int64        Uint64, U64;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					    typedef long long               Int64, I64;
 | 
				
			||||||
 | 
					    typedef unsigned long long      Uint64, U64;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**< integer type */
 | 
				
			||||||
 | 
					#ifdef SQMOD_LONG
 | 
				
			||||||
 | 
					    typedef Int64                   Int, Integer;
 | 
				
			||||||
 | 
					    typedef Uint64                  Uint, Uinteger, UnisgnedInteger;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					    typedef Int32                   Int, Integer;
 | 
				
			||||||
 | 
					    typedef Uint32                  Uint, Uinteger, UnisgnedInteger;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**< long integer type */
 | 
				
			||||||
 | 
					typedef long                        LongI;
 | 
				
			||||||
 | 
					typedef unsigned long               Ulong;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**< 32 bits float types */
 | 
				
			||||||
 | 
					typedef float                       Float32, Real32, F32;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**< 64 bits float types */
 | 
				
			||||||
 | 
					typedef double                      Float64, Real64, F64;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**< boolean type */
 | 
				
			||||||
 | 
					typedef Uint8                       Boolean;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**< character type */
 | 
				
			||||||
 | 
					typedef bool                        BoolT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**< character types */
 | 
				
			||||||
 | 
					typedef char                        CharT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**< user type */
 | 
				
			||||||
 | 
					typedef void *                      VoidP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**< size type */
 | 
				
			||||||
 | 
					typedef Uint32                      SizeT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * STRING TYPE
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef std::basic_string<SQChar>   String;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef char *                      CStr;
 | 
				
			||||||
 | 
					typedef const char *                CCStr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef SQChar *                    SStr;
 | 
				
			||||||
 | 
					typedef const SQChar *              CSStr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * SHORT SQUIRREL TYPENAMES
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef SQUnsignedInteger32         SQUint32;
 | 
				
			||||||
 | 
					typedef SQUnsignedInteger           SQUint;
 | 
				
			||||||
 | 
					typedef SQInteger                   SQInt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					using namespace Sqrat;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * Squirrel compatible stl string.
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef std::basic_string< SQChar > String;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * FORWARD DECLARATIONS
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					} // Namespace:: SqMod
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * OS SPECIFFIC OPTIONS
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(SQMOD_OS_WINDOWS)
 | 
				
			||||||
 | 
					    #define SQMOD_DIRSEP_CHAR   '\\'
 | 
				
			||||||
 | 
					    #define SQMOD_DIRSEP_STR    "\\"
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					    #define SQMOD_DIRSEP_CHAR   '/'
 | 
				
			||||||
 | 
					    #define SQMOD_DIRSEP_STR    "/"
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * SYMBOL EXPORTING
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(_MSC_VER)
 | 
				
			||||||
 | 
					    #define SQMOD_EXPORT          __declspec(dllexport)
 | 
				
			||||||
 | 
					    #define SQMOD_IMPORT          __declspec(dllimport)
 | 
				
			||||||
 | 
					#elif defined(__GNUC__)
 | 
				
			||||||
 | 
					    #define SQMOD_EXPORT          __declspec(dllexport)
 | 
				
			||||||
 | 
					    #define SQMOD_IMPORT          __declspec(dllimport)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(__cplusplus)
 | 
				
			||||||
 | 
					    #define SQMOD_EXTERN_C        extern "C"
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					    #define SQMOD_EXTERN_C        /* */
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(_MSC_VER)
 | 
				
			||||||
 | 
					    #define SQMOD_API_EXPORT      extern "C" __declspec(dllexport)
 | 
				
			||||||
 | 
					#elif defined(__GNUC__)
 | 
				
			||||||
 | 
					    #define SQMOD_API_EXPORT      extern "C"
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					    #define SQMOD_API_EXPORT      extern "C"
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * CALLING CONVENTIONS
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(_MSC_VER)
 | 
				
			||||||
 | 
					    #define SQMOD_STDCALL         __stdcall
 | 
				
			||||||
 | 
					    #define SQMOD_CDECL           __cdecl
 | 
				
			||||||
 | 
					    #define SQMOD_FASTCALL        __fastcall
 | 
				
			||||||
 | 
					#elif defined(__GNUC__)
 | 
				
			||||||
 | 
					    #define SQMOD_STDCALL         __attribute__((stdcall))
 | 
				
			||||||
 | 
					    #define SQMOD_CDECL           /* */
 | 
				
			||||||
 | 
					    #define SQMOD_FASTCALL        __attribute__((fastcall))
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * FUNCTION INLINING
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(_MSC_VER)
 | 
				
			||||||
 | 
					    #define SQMOD_FORCEINLINE    __forceinline
 | 
				
			||||||
 | 
					#elif defined(__GNUC__)
 | 
				
			||||||
 | 
					    #define SQMOD_FORCEINLINE    inline
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * ATTRIBUTES
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					#if defined(__GNUC__) && __GNUC__ >= 7
 | 
				
			||||||
 | 
					 #define SQ_FALL_THROUGH __attribute__ ((fallthrough))
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					 #define SQ_FALL_THROUGH ((void)0)
 | 
				
			||||||
 | 
					#endif // __GNUC__ >= 7
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * LOGGING LOCATION
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SQMOD_TRUESTRINGIZE(x) #x
 | 
				
			||||||
 | 
					#define SQMOD_STRINGIZEWRAP(x) SQMOD_TRUESTRINGIZE(x)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(_DEBUG) || defined(SQMOD_EXCEPTLOC)
 | 
				
			||||||
 | 
					    #define SQMOD_MSGLOC(m) (m " =>[" __FILE__ ":" SQMOD_STRINGIZEWRAP(__LINE__) "] ")
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					    #define SQMOD_MSGLOC(m) (m)
 | 
				
			||||||
 | 
					#endif // _DEBUG
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * EXCEPTION THROWING
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(_DEBUG) || defined(SQMOD_EXCEPTLOC)
 | 
				
			||||||
 | 
					    #define STHROW(e, m, ...) throw e(m " =>[" __FILE__ ":" SQMOD_STRINGIZEWRAP(__LINE__) "] ", ##__VA_ARGS__)
 | 
				
			||||||
 | 
					    #define STHROWF(m, ...) SqThrowF(m " =>[" __FILE__ ":" SQMOD_STRINGIZEWRAP(__LINE__) "] ", ##__VA_ARGS__)
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					    #define STHROW(e, m, ...) throw e(m, ##__VA_ARGS__)
 | 
				
			||||||
 | 
					    #define STHROWF(m, ...) SqThrowF(m, ##__VA_ARGS__)
 | 
				
			||||||
 | 
					#endif // _DEBUG
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * VARIOUS DEFINES
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SQMOD_DECL_UNUSED_VAR(t, n, v) t n = v; (void)(n)
 | 
				
			||||||
 | 
					#define SQMOD_UNUSED_VAR(n) (void)(n)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define VALID_ENTITY(e) (e >= 0)
 | 
				
			||||||
 | 
					#define INVALID_ENTITY(e) (e < 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define VALID_ENTITYEX(e, m) ((e >= 0) && (e < m))
 | 
				
			||||||
 | 
					#define INVALID_ENTITYEX(e, m) ((e < 0) || (e >= m))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define VALID_ENTITYGET(e) ((e >= 0) ? e : -1)
 | 
				
			||||||
 | 
					#define VALID_ENTITYGETEX(e, m) ((e >= 0) && (e < m) ? e : -1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define VALID_VEHCOL(e) ((e >= 0) && (e <= 94))
 | 
				
			||||||
 | 
					#define INVALID_VEHCOL(e) ((e < 0) && (e > 94))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * COLOR PACKING
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SQMOD_PACK_RGB(r, g, b) static_cast< Uint32 >(r << 16 | g << 8 | b)
 | 
				
			||||||
 | 
					#define SQMOD_PACK_RGBA(r, g, b, a) static_cast< Uint32 >(r << 24 | g << 16 | b << 8 | a)
 | 
				
			||||||
 | 
					#define SQMOD_PACK_ARGB(a, r, g, b) static_cast< Uint32 >(a << 24 | r << 16 | g << 8 | b)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SQMOD_PACK_RGB_TO_RGBA(r, g, b) static_cast< Uint32 >(r << 24 | g << 16 | b << 8 | 0)
 | 
				
			||||||
 | 
					#define SQMOD_PACK_RGB_TO_ARGB(r, g, b) static_cast< Uint32 >(0 << 24 | r << 16 | g << 8 | b)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * GENERAL RESPONSES
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SQMOD_SUCCESS     1
 | 
				
			||||||
 | 
					#define SQMOD_FAILURE     0
 | 
				
			||||||
 | 
					#define SQMOD_UNKNOWN     -1
 | 
				
			||||||
 | 
					#define SQMOD_TRUE        1
 | 
				
			||||||
 | 
					#define SQMOD_FALSE       0
 | 
				
			||||||
 | 
					#define SQMOD_NULL        NULL
 | 
				
			||||||
 | 
					#define SQMOD_BLANK       0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif // _SQMODBASE_HPP_
 | 
				
			||||||
							
								
								
									
										1151
									
								
								shared/ModBase.hpp
									
									
									
									
									
								
							
							
						
						
									
										1151
									
								
								shared/ModBase.hpp
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,5 +1,7 @@
 | 
				
			|||||||
 | 
					# Include third-party libraries
 | 
				
			||||||
 | 
					add_subdirectory(Vendor)
 | 
				
			||||||
# Create the Squirrel module
 | 
					# Create the Squirrel module
 | 
				
			||||||
add_library(SquirrelModule MODULE
 | 
					add_library(SqModule MODULE
 | 
				
			||||||
	SqBase.hpp
 | 
						SqBase.hpp
 | 
				
			||||||
	Main.cpp
 | 
						Main.cpp
 | 
				
			||||||
	Register.cpp
 | 
						Register.cpp
 | 
				
			||||||
@@ -7,7 +9,6 @@ add_library(SquirrelModule MODULE
 | 
				
			|||||||
	Logger.cpp Logger.hpp
 | 
						Logger.cpp Logger.hpp
 | 
				
			||||||
	Base/DynArg.hpp
 | 
						Base/DynArg.hpp
 | 
				
			||||||
	Base/AABB.cpp Base/AABB.hpp
 | 
						Base/AABB.cpp Base/AABB.hpp
 | 
				
			||||||
	Base/Algo.cpp Base/Algo.hpp
 | 
					 | 
				
			||||||
	Base/Buffer.cpp Base/Buffer.hpp
 | 
						Base/Buffer.cpp Base/Buffer.hpp
 | 
				
			||||||
	Base/Circle.cpp Base/Circle.hpp
 | 
						Base/Circle.cpp Base/Circle.hpp
 | 
				
			||||||
	Base/Color3.cpp Base/Color3.hpp
 | 
						Base/Color3.cpp Base/Color3.hpp
 | 
				
			||||||
@@ -67,33 +68,37 @@ add_library(SquirrelModule MODULE
 | 
				
			|||||||
	Misc/Vehicle.cpp Misc/Vehicle.hpp
 | 
						Misc/Vehicle.cpp Misc/Vehicle.hpp
 | 
				
			||||||
	Misc/Weapon.cpp Misc/Weapon.hpp
 | 
						Misc/Weapon.cpp Misc/Weapon.hpp
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					# Link to base libraries
 | 
				
			||||||
 | 
					target_link_libraries(SqModule VCMP Squirrel Sqrat SqSDK)
 | 
				
			||||||
 | 
					# Link to third-party libraries
 | 
				
			||||||
 | 
					target_link_libraries(SqModule SimpleINI HashLib B64Lib AES256Lib WhirlpoolLib TinyDir)
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
if(FORCE_32BIT_BIN)
 | 
					if(FORCE_32BIT_BIN)
 | 
				
			||||||
	set_target_properties(SquirrelModule PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
 | 
						set_target_properties(SqModule PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
 | 
				
			||||||
endif()
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
 | 
					if(CMAKE_SIZEOF_VOID_P EQUAL 8)
 | 
				
			||||||
	target_compile_definitions(SquirrelModule PRIVATE _SQ64)
 | 
						target_compile_definitions(SqModule PRIVATE _SQ64)
 | 
				
			||||||
endif()
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set_target_properties(SquirrelModule PROPERTIES PREFIX "")
 | 
					set_target_properties(SqModule PROPERTIES PREFIX "")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if(WIN32)
 | 
					if(WIN32)
 | 
				
			||||||
	if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT FORCE_32BIT_BIN)
 | 
						if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT FORCE_32BIT_BIN)
 | 
				
			||||||
		set_target_properties(SquirrelModule PROPERTIES OUTPUT_NAME "mod_squirrel_64")
 | 
							set_target_properties(SqModule PROPERTIES OUTPUT_NAME "mod_squirrel_64")
 | 
				
			||||||
	else()
 | 
						else()
 | 
				
			||||||
		set_target_properties(SquirrelModule PROPERTIES OUTPUT_NAME "mod_squirrel_32")
 | 
							set_target_properties(SqModule PROPERTIES OUTPUT_NAME "mod_squirrel_32")
 | 
				
			||||||
	endif()
 | 
						endif()
 | 
				
			||||||
else()
 | 
					else(WIN32)
 | 
				
			||||||
	if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT FORCE_32BIT_BIN)
 | 
						if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT FORCE_32BIT_BIN)
 | 
				
			||||||
		set_target_properties(SquirrelModule PROPERTIES OUTPUT_NAME "mod_squirrel_64")
 | 
							set_target_properties(SqModule PROPERTIES OUTPUT_NAME "mod_squirrel_64")
 | 
				
			||||||
	else()
 | 
						else()
 | 
				
			||||||
		set_target_properties(SquirrelModule PROPERTIES OUTPUT_NAME "mod_squirrel_32")
 | 
							set_target_properties(SqModule PROPERTIES OUTPUT_NAME "mod_squirrel_32")
 | 
				
			||||||
	endif()
 | 
						endif()
 | 
				
			||||||
endif(32)
 | 
					endif(WIN32)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
target_include_directories(SquirrelModule PRIVATE ${CMAKE_CURRENT_LIST_DIR})
 | 
					target_include_directories(SqModule PRIVATE ${CMAKE_CURRENT_LIST_DIR})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if(WIN32)
 | 
					if(WIN32)
 | 
				
			||||||
  target_link_libraries(SquirrelModule wsock32 ws2_32)
 | 
					  target_link_libraries(SqModule wsock32 ws2_32)
 | 
				
			||||||
endif()
 | 
					endif()
 | 
				
			||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
// ------------------------------------------------------------------------------------------------
 | 
					// ------------------------------------------------------------------------------------------------
 | 
				
			||||||
#include "Base/Algo.hpp"
 | 
					#include "Misc/Algo.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ------------------------------------------------------------------------------------------------
 | 
					// ------------------------------------------------------------------------------------------------
 | 
				
			||||||
#include "Entity/Blip.hpp"
 | 
					#include "Entity/Blip.hpp"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,5 +3,3 @@ add_library(AES256Lib STATIC include/aes256.h aes256.cpp)
 | 
				
			|||||||
# Configure include folders
 | 
					# Configure include folders
 | 
				
			||||||
target_include_directories(AES256Lib PRIVATE ${CMAKE_CURRENT_LIST_DIR})
 | 
					target_include_directories(AES256Lib PRIVATE ${CMAKE_CURRENT_LIST_DIR})
 | 
				
			||||||
target_include_directories(AES256Lib PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
 | 
					target_include_directories(AES256Lib PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
 | 
				
			||||||
# Configure build options
 | 
					 | 
				
			||||||
target_compile_definitions(AES256Lib PRIVATE )
 | 
					 | 
				
			||||||
@@ -1,7 +1,5 @@
 | 
				
			|||||||
# Create the B64Lib library
 | 
					# Create the B64Lib library
 | 
				
			||||||
add_library(B64Lib STATIC include/b64.h decode.c decode.c)
 | 
					add_library(B64Lib STATIC include/b64.h decode.c encode.c)
 | 
				
			||||||
# Configure include folders
 | 
					# Configure include folders
 | 
				
			||||||
target_include_directories(B64Lib PRIVATE ${CMAKE_CURRENT_LIST_DIR})
 | 
					target_include_directories(B64Lib PRIVATE ${CMAKE_CURRENT_LIST_DIR})
 | 
				
			||||||
target_include_directories(B64Lib PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
 | 
					target_include_directories(B64Lib PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
 | 
				
			||||||
# Configure build options
 | 
					 | 
				
			||||||
target_compile_definitions(B64Lib PRIVATE )
 | 
					 | 
				
			||||||
							
								
								
									
										6
									
								
								source/Vendor/CMakeLists.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								source/Vendor/CMakeLists.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					add_subdirectory(SimpleIni)
 | 
				
			||||||
 | 
					add_subdirectory(AES256)
 | 
				
			||||||
 | 
					add_subdirectory(B64)
 | 
				
			||||||
 | 
					add_subdirectory(Hash)
 | 
				
			||||||
 | 
					add_subdirectory(TinyDir)
 | 
				
			||||||
 | 
					add_subdirectory(Whirlpool)
 | 
				
			||||||
@@ -13,5 +13,7 @@ add_library(HashLib STATIC
 | 
				
			|||||||
# Configure include folders
 | 
					# Configure include folders
 | 
				
			||||||
target_include_directories(HashLib PRIVATE ${CMAKE_CURRENT_LIST_DIR})
 | 
					target_include_directories(HashLib PRIVATE ${CMAKE_CURRENT_LIST_DIR})
 | 
				
			||||||
target_include_directories(HashLib PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
 | 
					target_include_directories(HashLib PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
 | 
				
			||||||
# Configure build options
 | 
					# Make sure headers are available on MinGW
 | 
				
			||||||
target_compile_definitions(HashLib PRIVATE )
 | 
					if (MINGW)
 | 
				
			||||||
 | 
						target_include_directories(HashLib PRIVATE ${CMAKE_CURRENT_LIST_DIR}/mingwinc)
 | 
				
			||||||
 | 
					endif(MINGW)
 | 
				
			||||||
							
								
								
									
										14
									
								
								source/Vendor/Hash/mingwinc/endian.h
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								source/Vendor/Hash/mingwinc/endian.h
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					#ifndef _ENDIAN_H_
 | 
				
			||||||
 | 
					#define _ENDIAN_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(__MINGW32__) || defined(__MINGW64__)
 | 
				
			||||||
 | 
					    // Workaround for MinGW and it's lack of <endian.h> file
 | 
				
			||||||
 | 
					    #define __BYTE_ORDER    __BYTE_ORDER__
 | 
				
			||||||
 | 
					    #define __LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
 | 
				
			||||||
 | 
					    #define __BIG_ENDIAN    __ORDER_BIG_ENDIAN__
 | 
				
			||||||
 | 
					#elif !defined(_MSC_VER)
 | 
				
			||||||
 | 
					    // Just include the system file
 | 
				
			||||||
 | 
					    #include <endian.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif // _ENDIAN_H_
 | 
				
			||||||
							
								
								
									
										9
									
								
								source/Vendor/SimpleIni/CMakeLists.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								source/Vendor/SimpleIni/CMakeLists.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					# Create the SimpleINI library
 | 
				
			||||||
 | 
					add_library(SimpleINI STATIC
 | 
				
			||||||
 | 
						include/ConvertUTF.h
 | 
				
			||||||
 | 
						include/SimpleIni.h
 | 
				
			||||||
 | 
						ConvertUTF.cpp
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					# Configure include folders
 | 
				
			||||||
 | 
					target_include_directories(SimpleINI PRIVATE ${CMAKE_CURRENT_LIST_DIR})
 | 
				
			||||||
 | 
					target_include_directories(SimpleINI PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
 | 
				
			||||||
							
								
								
									
										6
									
								
								source/Vendor/TinyDir/CMakeLists.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								source/Vendor/TinyDir/CMakeLists.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					# Create the TinyDir library
 | 
				
			||||||
 | 
					add_library(TinyDir INTERFACE)
 | 
				
			||||||
 | 
					# Library includes
 | 
				
			||||||
 | 
					target_include_directories(TinyDir INTERFACE ${CMAKE_CURRENT_LIST_DIR})
 | 
				
			||||||
 | 
					# Add it's sources
 | 
				
			||||||
 | 
					target_sources(TinyDir INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/tinydir.h)
 | 
				
			||||||
@@ -3,11 +3,9 @@ add_library(WhirlpoolLib STATIC
 | 
				
			|||||||
	include/ustd.h
 | 
						include/ustd.h
 | 
				
			||||||
	include/whirlpool.h
 | 
						include/whirlpool.h
 | 
				
			||||||
	byte_order.h byte_order.c
 | 
						byte_order.h byte_order.c
 | 
				
			||||||
	whirlpool.c.c
 | 
						whirlpool.c
 | 
				
			||||||
	whirlpool_sbox.c
 | 
						whirlpool_sbox.c
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
# Configure include folders
 | 
					# Configure include folders
 | 
				
			||||||
target_include_directories(WhirlpoolLib PRIVATE ${CMAKE_CURRENT_LIST_DIR})
 | 
					target_include_directories(WhirlpoolLib PRIVATE ${CMAKE_CURRENT_LIST_DIR})
 | 
				
			||||||
target_include_directories(WhirlpoolLib PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
 | 
					target_include_directories(WhirlpoolLib PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
 | 
				
			||||||
# Configure build options
 | 
					 | 
				
			||||||
target_compile_definitions(WhirlpoolLib PRIVATE )
 | 
					 | 
				
			||||||
@@ -7,8 +7,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
 | 
				
			|||||||
	#target_compile_options(Sqrat PRIVATE -w
 | 
						#target_compile_options(Sqrat PRIVATE -w
 | 
				
			||||||
	#)
 | 
						#)
 | 
				
			||||||
endif()
 | 
					endif()
 | 
				
			||||||
# Configure build options
 | 
					 | 
				
			||||||
target_compile_definitions(Sqrat INTERFACE GARBAGE_COLLECTOR=1)
 | 
					 | 
				
			||||||
# Library includes
 | 
					# Library includes
 | 
				
			||||||
target_include_directories(Sqrat INTERFACE ${CMAKE_CURRENT_LIST_DIR})
 | 
					target_include_directories(Sqrat INTERFACE ${CMAKE_CURRENT_LIST_DIR})
 | 
				
			||||||
target_include_directories(Sqrat INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
 | 
					target_include_directories(Sqrat INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										10
									
								
								vcmp/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								vcmp/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					# Create the VCMP library
 | 
				
			||||||
 | 
					add_library(VCMP INTERFACE)
 | 
				
			||||||
 | 
					# Library includes
 | 
				
			||||||
 | 
					target_include_directories(VCMP INTERFACE ${CMAKE_CURRENT_LIST_DIR})
 | 
				
			||||||
 | 
					# Add it's sources
 | 
				
			||||||
 | 
					target_sources(VCMP INTERFACE
 | 
				
			||||||
 | 
						${CMAKE_CURRENT_SOURCE_DIR}/vcmp.h
 | 
				
			||||||
 | 
						${CMAKE_CURRENT_SOURCE_DIR}/vcmp20.h
 | 
				
			||||||
 | 
						${CMAKE_CURRENT_SOURCE_DIR}/vcmp21.h
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
							
								
								
									
										7
									
								
								vcmp/vcmp.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								vcmp/vcmp.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					// Choose which SDK to use
 | 
				
			||||||
 | 
					#ifdef VCMP_SDK_2_1
 | 
				
			||||||
 | 
						#include "vcmp21.h"
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
						#include "vcmp20.h"
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		Reference in New Issue
	
	Block a user