├── .gitignore ├── README.md ├── bin ├── SC-CL.exe ├── show_help.bat ├── xcompress32.dll └── zlib1.dll ├── include ├── GTAIV │ ├── consts32.h │ ├── natives32.h │ └── natives32Old.h ├── GTAV │ ├── consts32.h │ ├── consts64.h │ ├── constsShared.h │ ├── natives32.h │ └── natives64.h ├── RDR │ ├── consts32.h │ └── natives32.h ├── common.c ├── common.h ├── constants.h ├── intrinsics.h ├── natives.h ├── types.h └── varargs.h └── projects ├── Create SC-CL Project.exe └── example ├── compile project.bat ├── compile.bat ├── example.c ├── example.sln ├── example.vcxproj ├── example.vcxproj.filters └── example.vcxproj.user /.gitignore: -------------------------------------------------------------------------------- 1 | projects/*/.vs/ 2 | projects/*/GTAV/ 3 | projects/*/GTAIV/ 4 | projects/*/GTAIV TBOGT/ 5 | projects/*/GTAIV TLAD/ 6 | projects/*/RDR _SC/ 7 | projects/*/RDR SCO/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SC-CL Sample Project 2 | SC-CL is a Clang Compiler targeted towards Rockstar's scripting format.
3 | This project is a "hello world" sample using SC-CL. 4 | 5 | SC-CL Source 6 | --------------------------------- 7 | https://github.com/NativeFunction/SC-CL 8 | 9 | Supported Targets 10 | --------------------------------- 11 | * Grand Theft Auto 4 12 | * SCO format 13 | * Red Dead Redemption 14 | * SCO format 15 | * XSC format 16 | * CSC format 17 | * Grand Theft Auto 5 18 | * XSC format 19 | * CSC format 20 | * YSC format 21 | 22 | Usage 23 | --------------------------------- 24 | 25 | ```console 26 | USAGE: SC-CL.exe [options] [... ] 27 | 28 | OPTIONS: 29 | 30 | Clang Options: 31 | 32 | -extra-arg= - Additional argument to append to the compiler command line 33 | -extra-arg-before= - Additional argument to prepend to the compiler command line 34 | -p= - Build path 35 | 36 | Compiler Options: 37 | 38 | Choose obfuscation level: (This option is experimental use at your own risk) 39 | -Fs - Obfuscate string table - GTA V Only 40 | -F1 - Enable low obfuscations 41 | -F2 - Enable default obfuscations 42 | -F3 - Enable high obfuscations 43 | -F4 - Enable very high obfuscations 44 | -F5 - Enable max obfuscations 45 | Choose optimization level: 46 | -g - No optimizations, enable debugging 47 | -O1 - Enable trivial optimizations 48 | -O2 - Enable default optimizations 49 | -O3 - Enable expensive optimizations 50 | -emit-asm - Emits the pre compiled ASM representation of the script 51 | -emit-asm-only - Only emits the pre compiled ASM representation of the script 52 | -hvi= - Sets the starting index for host variables to ignore 53 | -hvs= - Sets the amount of host variables to ignore 54 | -n - Disable function names in script output, Enabled when optimisations are turned on 55 | -name= - File name of output script, defaults to input file name 56 | -no-rsc7 - Removes the RSC7 header from the output (GTAV) 57 | -out-dir= - Specify the output directory of the script 58 | -pc-version= - Sets the pc version for use in the native translation table 59 | -platform - Choose target platform: 60 | =X360 - Target Xbox (32 bit, big endian) 61 | =PS3 - Target PS3 (32 bit, big endian) 62 | =PC - Target PC (64 bit, little endian) 63 | -pvi= - Sets the starting index for player variables to ignore 64 | -pvs= - Sets the amount of player variables to ignore 65 | -s - Limits script to one instance on runtime (GTAV | GTAIV) 66 | -target - Choose build target: 67 | =GTAIV - Grand Theft Auto IV (sco output) 68 | =GTAIV_TLAD - Grand Theft Auto IV The Lost and Damned (sco output) 69 | =GTAIV_TBOGT - Grand Theft Auto IV The Ballad of Gay Tony (sco output) 70 | =GTAV - Grand Theft Auto V (#sc output) 71 | =RDR_SCO - Red Dead Redemption (sco output) 72 | =RDR_#SC - Red Dead Redemption (#sc output) 73 | -vcx= - Parses source files out of a vcxproj file to allow for seamless linking in Visual Studio 74 | 75 | General options: 76 | 77 | -stats - Enable statistics output from program (available with Asserts) 78 | 79 | Generic Options: 80 | 81 | -help - Display available options (-help-hidden for more) 82 | -help-list - Display list of available options (-help-list-hidden for more) 83 | -version - Display the version of this program 84 | ``` 85 | -------------------------------------------------------------------------------- /bin/SC-CL.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NativeFunction/SC-CL-SampleProject/58e59fd5f03ece9582e4654470e98c31abd5f45c/bin/SC-CL.exe -------------------------------------------------------------------------------- /bin/show_help.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | SC-CL.exe -help 3 | pause > nul 4 | cls -------------------------------------------------------------------------------- /bin/xcompress32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NativeFunction/SC-CL-SampleProject/58e59fd5f03ece9582e4654470e98c31abd5f45c/bin/xcompress32.dll -------------------------------------------------------------------------------- /bin/zlib1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NativeFunction/SC-CL-SampleProject/58e59fd5f03ece9582e4654470e98c31abd5f45c/bin/zlib1.dll -------------------------------------------------------------------------------- /include/GTAV/constsShared.h: -------------------------------------------------------------------------------- 1 | /*H********************************************************************** 2 | * FILENAME : constsShared.h START DATE : 10 Sept 16 3 | * 4 | * DESCRIPTION : 5 | * Constants to be used with all GTAV targets and platforms of SC-CL. 6 | * 7 | * NOTES : 8 | * This file is part of SC-CL's include library. 9 | * 10 | * LICENSE : 11 | * 12 | * Copyright 2016 SC-CL 13 | * 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions are met: 16 | * 17 | * * Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * 20 | * * Redistributions in binary form must reproduce the above copyright 21 | * notice, this list of conditions and the following disclaimer in the 22 | * documentation and/or other materials provided with the distribution. 23 | * 24 | * * Neither SC-CL nor its contributors may be used to endorse or promote products 25 | * derived from this software without specific prior written permission. 26 | * 27 | * * Redistribution of this software in source or binary forms shall be free 28 | * of all charges or fees to the recipient of this software. 29 | * 30 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 31 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 32 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 33 | * DISCLAIMED. IN NO EVENT SHALL SC-CL BE LIABLE FOR ANY 34 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 35 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 36 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 37 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 39 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | * 41 | * AUTHORS : 42 | * Rocko Tompkins 43 | * Nathan James 44 | *H*/ 45 | #pragma once 46 | 47 | typedef enum RotOrder 48 | { 49 | RotOrder_xyz = 0, 50 | RotOrder_yzx = 1, 51 | RotOrder_zxy = 2, 52 | RotOrder_pry = 2,//pitch:roll:yaw 53 | RotOrder_xzy = 3, 54 | RotOrder_yxz = 4, 55 | RotOrder_zyx = 5, 56 | } RotOrder; 57 | 58 | typedef enum Font 59 | { 60 | Font_Chalet_LondonNineteenSixty, 61 | Font_SignPainter_HouseScript, 62 | Font_RockstarTAG, 63 | Font_GTAVLeaderBoard, 64 | Font_ChaletComprime_CologneSixty, 65 | Font_Chalet_LondonNineteenSixtyNumb, 66 | Font_ChaletComprime_CologneSixty2, 67 | Font_PricedownGTAVInt 68 | } Font; 69 | 70 | typedef enum Hud 71 | { 72 | HUD, 73 | HUD_WANTED_STARS, 74 | HUD_WEAPON_ICON, 75 | HUD_CASH, 76 | HUD_MP_CASH, 77 | HUD_MP_MESSAGE, 78 | HUD_VEHICLE_NAME, 79 | HUD_AREA_NAME, 80 | HUD_VEHICLE_CLASS, 81 | HUD_STREET_NAME, 82 | HUD_HELP_TEXT, 83 | HUD_FLOATING_HELP_TEXT_1, 84 | HUD_FLOATING_HELP_TEXT_2, 85 | HUD_CASH_CHANGE, 86 | HUD_RETICLE, 87 | HUD_SUBTITLE_TEXT, 88 | HUD_RADIO_STATIONS, 89 | HUD_SAVING_GAME, 90 | HUD_GAME_STREAM, 91 | HUD_WEAPON_WHEEL 92 | } Hud; 93 | 94 | typedef enum BlipColors 95 | { 96 | BLIPCOLOR_NONE = 0x0, 97 | BLIPCOLOR_RED = 0x1, 98 | BLIPCOLOR_GREEN = 0x2, 99 | BLIPCOLOR_BLUE = 0x3, 100 | BLIPCOLOR_PLAYER = 0x4, 101 | BLIPCOLOR_YELLOWMISSION = 0x5, 102 | BLIPCOLOR_FRIENDLYVEHICLE = 0x26, 103 | BLIPCOLOR_MICHAEL = 0x2A, 104 | BLIPCOLOR_FRANKLIN = 0x2B, 105 | BLIPCOLOR_TREAVOR = 0x2C, 106 | BLIPCOLOR_REDMISSION = 0x31, 107 | BLIPCOLOR_MISSIONVEHICLE = 0x36, 108 | BLIPCOLOR_REDMISSION2 = 0x3B, 109 | BLIPCOLOR_YELLOWMISSION2 = 0x3C, 110 | BLIPCOLOR_MISSION = 0x42, 111 | BLIPCOLOR_WAYPOINT = 0x53 112 | } BlipColors; 113 | 114 | typedef enum BlipIcons 115 | { 116 | BLIP_CIRCLE = 1, 117 | BLIP_COP = 3, 118 | BLIP_PLAYERARROW = 6, 119 | BLIP_NORTH = 7, 120 | BLIP_WAYPOINT = 8, 121 | BLIP_TRANSLUCENTCIRCLE = 9, 122 | BLIP_COPHELICOPTER = 15, 123 | BLIP_JET = 16, 124 | BLIP_CABLECAR = 36, 125 | BLIP_RACEFLAG = 38, 126 | BLIP_OWNEDPROPERTY = 40, 127 | BLIP_SPEECHBUBLE = 47, 128 | BLIP_SQUAREGARAGE = 50, 129 | BLIP_PILL = 51, 130 | BLIP_CONVIENCESTOREMP = 52, 131 | BLIP_TAXI = 56, 132 | BLIP_CONVIENCESTORE = 59, 133 | BLIP_SHERIF = 60, 134 | BLIP_PARAMEDIC = 61, 135 | BLIP_HELICOPTER = 64, 136 | BLIP_QUESTIONMARK = 66, 137 | BLIP_TRUCK = 67, 138 | BLIP_HOOK = 68, 139 | BLIP_BARBERSHOP = 71, 140 | BLIP_PAYNSPRAY = 72, 141 | BLIP_CLOTHINGSTORE = 73, 142 | BLIP_TATTOOSTORE = 75, 143 | BLIP_MICHAEL = 78, 144 | BLIP_SKULL = 84, 145 | BLIP_SANANDREASFLIGHTSCHOOL = 90, 146 | BLIP_BAR = 93, 147 | BLIP_PARACHUTING = 94, 148 | BLIP_CARWASH = 100, 149 | BLIP_DARTS = 103, 150 | BLIP_GOLF = 109, 151 | BLIP_AMMUNATION = 110, 152 | BLIP_SHOOTINGRANGE = 119, 153 | BLIP_STRIPCLUB = 121, 154 | BLIP_TENNIS = 122, 155 | BLIP_TRIATHLON = 126, 156 | BLIP_OFFROADMOTOATVRACE = 127, 157 | BLIP_SPEECHBUBLE2 = 133, 158 | BLIP_KEY = 134, 159 | BLIP_MOVIES = 135, 160 | BLIP_MUSIC = 136, 161 | BLIP_ASSAULTRIFLE = 150, 162 | BLIP_GRENADE = 152, 163 | BLIP_HEALTH = 153, 164 | BLIP_RPG = 157, 165 | BLIP_SHOTGUN = 158, 166 | BLIP_MAC10 = 159, 167 | BLIP_SNIPERRIFLE = 160, 168 | BLIP_POINTOFINTREST = 162, 169 | BLIP_PASSIVEPLAYER = 163, 170 | BLIP_PLAYERPAUSED = 164, 171 | BLIP_MINIGUN = 173, 172 | BLIP_GRENADELAUNCHER = 174, 173 | BLIP_BODYARMOR = 175, 174 | BLIP_YOGA = 197, 175 | BLIP_CAR = 225, 176 | BLIP_FAIRGROUNDRIDE = 266, 177 | BLIP_SPAGHETTIO = 270, 178 | BLIP_DOGBONE = 273, 179 | BLIP_DEADPLAYER = 274, 180 | BLIP_SIMEON = 293, 181 | BLIP_BOUNTY = 303, 182 | BLIP_MISSION = 304, 183 | BLIP_SURVIVAL = 305, 184 | BLIP_SPECIALCRATE = 306, 185 | BLIP_PLANEVEHICLE = 307, 186 | BLIP_SUBMARINE = 308, 187 | BLIP_DEATHMATCH = 310, 188 | BLIP_ARMWRESTLE = 311, 189 | BLIP_AMMUNATIONWITHRANGE = 313, 190 | BLIP_STUNTPLANETIMETRIAL = 314, 191 | BLIP_STREETRACE = 315, 192 | BLIP_SEARACE = 316, 193 | BLIP_MOTORCYCLE = 348, 194 | BLIP_HOUSEFORSALEMP = 350, 195 | BLIP_AMMODROP = 351, 196 | BLIP_HELIBLADESENEMY = 353, 197 | BLIP_GARAGE = 357, 198 | BLIP_MASKSHOP = 362, 199 | BLIP_GARAGEFORSALE = 369, 200 | BLIP_HELIPADFORSALE = 370, 201 | BLIP_DOCKFORSALE = 371, 202 | BLIP_HELIPADFORSALE2 = 372, 203 | BLIP_OWNEDPROPERTY2 = 374, 204 | BLIP_HOUSEFORSALE = 375, 205 | BLIP_BIKERACE = 376, 206 | BLIP_TEAMDEATHMATCH = 378, 207 | BLIP_VEHICLEDEATHMATCH = 380, 208 | BLIP_PAPARAZZO = 389, 209 | BLIP_BULLSHARKTESTOSTRONE = 403, 210 | BLIP_GANGATTACK = 406, 211 | BLIP_CAPTURE = 408, 212 | BLIP_LASTTEAMSTANDING = 409, 213 | BLIP_BOATVEHICLE = 410, 214 | BLIP_RPLOGO = 416, 215 | BLIP_PLAYERINHOUSE = 417, 216 | BLIP_BOUNTYINHOUSE = 418, 217 | BLIP_AMERICANFLAG = 419, 218 | BLIP_TANK = 421, 219 | BLIP_HELICOPTERBLADES = 422, 220 | BLIP_PLANE = 423, 221 | BLIP_JET2 = 424, 222 | BLIP_INSURGENT = 426, 223 | BLIP_BOAT = 427, 224 | BLIP_HEISTSROOM = 428, 225 | BLIP_DOLLARSIGN = 431, 226 | BLIP_CEOCRATE = 478, 227 | BLIP_BIKERSUPPLIES = 501, 228 | }BlipIcons; 229 | 230 | typedef enum Explosion 231 | { 232 | EXPLOSION_GRENADE, 233 | EXPLOSION_GRENADELAUNCHER, 234 | EXPLOSION_STICKYBOMB, 235 | EXPLOSION_MOLOTOV, 236 | EXPLOSION_ROCKET, 237 | EXPLOSION_TANKSHELL, 238 | EXPLOSION_HI_OCTANE, 239 | EXPLOSION_CAR, 240 | EXPLOSION_PLANE, 241 | EXPLOSION_PETROL_PUMP, 242 | EXPLOSION_BIKE, 243 | EXPLOSION_DIR_STEAM, 244 | EXPLOSION_DIR_FLAME, 245 | EXPLOSION_DIR_WATER_HYDRANT, 246 | EXPLOSION_DIR_GAS_CANISTER, 247 | EXPLOSION_BOAT, 248 | EXPLOSION_SHIP_DESTROY, 249 | EXPLOSION_TRUCK, 250 | EXPLOSION_BULLET, 251 | EXPLOSION_SMOKEGRENADELAUNCHER, 252 | EXPLOSION_SMOKEGRENADE, 253 | EXPLOSION_BZGAS, 254 | EXPLOSION_FLARE, 255 | EXPLOSION_GAS_CANISTER, 256 | EXPLOSION_EXTINGUISHER, 257 | EXPLOSION_PROGRAMMABLEAR, 258 | EXPLOSION_TRAIN, 259 | EXPLOSION_BARREL, 260 | EXPLOSION_PROPANE, 261 | EXPLOSION_BLIMP, 262 | EXPLOSION_DIR_FLAME_EXPLODE, 263 | EXPLOSION_TANKER, 264 | EXPLOSION_PLANE_ROCKET, 265 | EXPLOSION_VEHICLE_BULLET, 266 | EXPLOSION_GAS_TANK, 267 | EXPLOSION_FIREWORK, 268 | EXPLOSION_SNOWBALL, 269 | EXPLOSION_PROXMINE, 270 | EXPLOSION_VALKYRIE_CANNON 271 | } Explosion; 272 | 273 | typedef enum GadgetHash 274 | { 275 | GADGET_NIGHTVISION = 0xA720365C, 276 | GADGET_PARACHUTE = 0xFBAB5776 277 | } GadgetHash; 278 | 279 | typedef enum CarCol 280 | { 281 | CARCOL_METALLIC_BLACK, 282 | CARCOL_METALLIC_GRAPHITE_BLACK, 283 | CARCOL_METALLIC_BLACK_STEAL, 284 | CARCOL_METALLIC_DARK_SILVER, 285 | CARCOL_METALLIC_SILVER, 286 | CARCOL_METALLIC_BLUE_SILVER, 287 | CARCOL_METALLIC_STEEL_GRAY, 288 | CARCOL_METALLIC_SHADOW_SILVER, 289 | CARCOL_METALLIC_STONE_SILVER, 290 | CARCOL_METALLIC_MIDNIGHT_SILVER, 291 | CARCOL_METALLIC_GUN_METAL, 292 | CARCOL_METALLIC_ANTHRACITE_GREY, 293 | CARCOL_MATTE_BLACK, 294 | CARCOL_MATTE_GRAY, 295 | CARCOL_MATTE_LIGHT_GREY, 296 | CARCOL_UTIL_BLACK, 297 | CARCOL_UTIL_BLACK_POLY, 298 | CARCOL_UTIL_DARK_SILVER, 299 | CARCOL_UTIL_SILVER, 300 | CARCOL_UTIL_GUN_METAL, 301 | CARCOL_UTIL_SHADOW_SILVER, 302 | CARCOL_WORN_BLACK, 303 | CARCOL_WORN_GRAPHITE, 304 | CARCOL_WORN_SILVER_GREY, 305 | CARCOL_WORN_SILVER, 306 | CARCOL_WORN_BLUE_SILVER, 307 | CARCOL_WORN_SHADOW_SILVER, 308 | CARCOL_METALLIC_RED, 309 | CARCOL_METALLIC_TORINO_RED, 310 | CARCOL_METALLIC_FORMULA_RED, 311 | CARCOL_METALLIC_BLAZE_RED, 312 | CARCOL_METALLIC_GRACEFUL_RED, 313 | CARCOL_METALLIC_GARNET_RED, 314 | CARCOL_METALLIC_DESERT_RED, 315 | CARCOL_METALLIC_CABERNET_RED, 316 | CARCOL_METALLIC_CANDY_RED, 317 | CARCOL_METALLIC_SUNRISE_ORANGE, 318 | CARCOL_METALLIC_CLASSIC_GOLD, 319 | CARCOL_METALLIC_ORANGE, 320 | CARCOL_MATTE_RED, 321 | CARCOL_MATTE_DARK_RED, 322 | CARCOL_MATTE_ORANGE, 323 | CARCOL_MATTE_YELLOW, 324 | CARCOL_UTIL_RED, 325 | CARCOL_UTIL_BRIGHT_RED, 326 | CARCOL_UTIL_GARNET_RED, 327 | CARCOL_WORN_RED, 328 | CARCOL_WORN_GOLDEN_RED, 329 | CARCOL_WORN_DARK_RED, 330 | CARCOL_METALLIC_DARK_GREEN, 331 | CARCOL_METALLIC_RACING_GREEN, 332 | CARCOL_METALLIC_SEA_GREEN, 333 | CARCOL_METALLIC_OLIVE_GREEN, 334 | CARCOL_METALLIC_GREEN, 335 | CARCOL_METALLIC_GASOLINE_BLUE_GREEN, 336 | CARCOL_MATTE_LIME_GREEN, 337 | CARCOL_UTIL_DARK_GREEN_, 338 | CARCOL_UTIL_GREEN, 339 | CARCOL_WORN_DARK_GREEN, 340 | CARCOL_WORN_GREEN, 341 | CARCOL_WORN_SEA_WASH, 342 | CARCOL_METALLIC_MIDNIGHT_BLUE, 343 | CARCOL_METALLIC_DARK_BLUE, 344 | CARCOL_METALLIC_SAXONY_BLUE, 345 | CARCOL_METALLIC_BLUE, 346 | CARCOL_METALLIC_MARINER_BLUE, 347 | CARCOL_METALLIC_HARBOR_BLUE, 348 | CARCOL_METALLIC_DIAMOND_BLUE, 349 | CARCOL_METALLIC_SURF_BLUE, 350 | CARCOL_METALLIC_NAUTICAL_BLUE, 351 | CARCOL_METALLIC_BRIGHT_BLUE, 352 | CARCOL_METALLIC_PURPLE_BLUE, 353 | CARCOL_METALLIC_SPINNAKER_BLUE, 354 | CARCOL_METALLIC_ULTRA_BLUE, 355 | CARCOL_METALLIC_BRIGHT_BLUE2, 356 | CARCOL_UTIL_DARK_BLUE, 357 | CARCOL_UTIL_MIDNIGHT_BLUE, 358 | CARCOL_UTIL_BLUE, 359 | CARCOL_UTIL_SEA_FOAM_BLUE, 360 | CARCOL_UTIL_LIGHTNING_BLUE, 361 | CARCOL_UTIL_MAUI_BLUE_POLY, 362 | CARCOL_UTIL_BRIGHT_BLUE,//SLATE_BLUE 363 | CARCOL_MATTE_DARK_BLUE, 364 | CARCOL_MATTE_BLUE, 365 | CARCOL_MATTE_MIDNIGHT_BLUE, 366 | CARCOL_WORN_DARK_BLUE, 367 | CARCOL_WORN_BLUE, 368 | CARCOL_WORN_LIGHT_BLUE, 369 | CARCOL_METALLIC_TAXI_YELLOW, 370 | CARCOL_METALLIC_RACE_YELLOW, 371 | CARCOL_METALLIC_BRONZE, 372 | CARCOL_METALLIC_YELLOW_BIRD, 373 | CARCOL_METALLIC_LIME, 374 | CARCOL_METALLIC_CHAMPAGNE, 375 | CARCOL_METALLIC_PUEBLO_BEIGE, 376 | CARCOL_METALLIC_DARK_IVORY, 377 | CARCOL_METALLIC_CHOCO_BROWN, 378 | CARCOL_METALLIC_GOLDEN_BROWN, 379 | CARCOL_METALLIC_LIGHT_BROWN, 380 | CARCOL_METALLIC_STRAW_BEIGE, 381 | CARCOL_METALLIC_MOSS_BROWN, 382 | CARCOL_METALLIC_BISTON_BROWN, 383 | CARCOL_METALLIC_BEECHWOOD, 384 | CARCOL_METALLIC_DARK_BEECHWOOD, 385 | CARCOL_METALLIC_CHOCO_ORANGE, 386 | CARCOL_METALLIC_BEACH_SAND, 387 | CARCOL_METALLIC_SUN_BLEECHED_SAND, 388 | CARCOL_METALLIC_CREAM, 389 | CARCOL_UTIL_BROWN, 390 | CARCOL_UTIL_MEDIUM_BROWN, 391 | CARCOL_UTIL_LIGHT_BROWN, 392 | CARCOL_METALLIC_WHITE, 393 | CARCOL_METALLIC_FROST_WHITE, 394 | CARCOL_WORN_HONEY_BEIGE, 395 | CARCOL_WORN_BROWN, 396 | CARCOL_WORN_DARK_BROWN, 397 | CARCOL_WORN_STRAW_BEIGE, 398 | CARCOL_BRUSHED_STEEL, 399 | CARCOL_BRUSHED_BLACK_STEEL, 400 | CARCOL_BRUSHED_ALUMINIUM, 401 | CARCOL_CHROME, 402 | CARCOL_WORN_OFF_WHITE, 403 | CARCOL_UTIL_OFF_WHITE, 404 | CARCOL_WORN_ORANGE, 405 | CARCOL_WORN_LIGHT_ORANGE, 406 | CARCOL_METALLIC_SECURICOR_GREEN,//PEA_GREEN 407 | CARCOL_WORN_TAXI_YELLOW, 408 | CARCOL_POLICE_CAR_BLUE, 409 | CARCOL_MATTE_GREEN, 410 | CARCOL_MATTE_BROWN, 411 | CARCOL_WORN_ORANGE2, 412 | CARCOL_MATTE_WHITE, 413 | CARCOL_WORN_WHITE, 414 | CARCOL_WORN_OLIVE_ARMY_GREEN, 415 | CARCOL_PURE_WHITE, 416 | CARCOL_HOT_PINK, 417 | CARCOL_SALMON_PINK, 418 | CARCOL_METALLIC_VERMILLION_PINK, 419 | CARCOL_ORANGE, 420 | CARCOL_GREEN, 421 | CARCOL_BLUE,//FLOURESCENT_BLUE 422 | CARCOL_METTALIC_BLACK_BLUE, 423 | CARCOL_METALLIC_BLACK_PURPLE, 424 | CARCOL_METALLIC_BLACK_RED, 425 | CARCOL_HUNTER_GREEN, 426 | CARCOL_METALLIC_PURPLE, 427 | CARCOL_METAILLIC_V_DARK_BLUE, 428 | CARCOL_MODSHOP_BLACK1, 429 | CARCOL_MATTE_PURPLE, 430 | CARCOL_MATTE_DARK_PURPLE, 431 | CARCOL_METALLIC_LAVA_RED, 432 | CARCOL_MATTE_FOREST_GREEN, 433 | CARCOL_MATTE_OLIVE_DRAB, 434 | CARCOL_MATTE_DESERT_BROWN, 435 | CARCOL_MATTE_DESERT_TAN, 436 | CARCOL_MATTE_FOILAGE_GREEN, 437 | CARCOL_DEFAULT_ALLOY_COLOR, 438 | CARCOL_EPSILON_BLUE, 439 | CARCOL_GOLD, 440 | CARCOL_GOLD_SATIN, 441 | CARCOL_GOLD_SPEC 442 | 443 | } CarCol; 444 | 445 | typedef enum CarColARGB 446 | { 447 | CARCOL_ARGB_METALLIC_BLACK = 0xFF080808, 448 | CARCOL_ARGB_METALLIC_GRAPHITE_BLACK = 0xFF0F0F0F, 449 | CARCOL_ARGB_METALLIC_BLACK_STEAL = 0xFF1C1E21, 450 | CARCOL_ARGB_METALLIC_DARK_SILVER = 0xFF292C2E, 451 | CARCOL_ARGB_METALLIC_SILVER = 0xFF5A5E66, 452 | CARCOL_ARGB_METALLIC_BLUE_SILVER = 0xFF777C87, 453 | CARCOL_ARGB_METALLIC_STEEL_GRAY = 0xFF515459, 454 | CARCOL_ARGB_METALLIC_SHADOW_SILVER = 0xFF323B47, 455 | CARCOL_ARGB_METALLIC_STONE_SILVER = 0xFF333333, 456 | CARCOL_ARGB_METALLIC_MIDNIGHT_SILVER = 0xFF1F2226, 457 | CARCOL_ARGB_METALLIC_GUN_METAL = 0xFF23292E, 458 | CARCOL_ARGB_METALLIC_ANTHRACITE_GREY = 0xFF121110, 459 | CARCOL_ARGB_MATTE_BLACK = 0xFF050505, 460 | CARCOL_ARGB_MATTE_GRAY = 0xFF121212, 461 | CARCOL_ARGB_MATTE_LIGHT_GREY = 0xFF2F3233, 462 | CARCOL_ARGB_UTIL_BLACK = 0xFF080808, 463 | CARCOL_ARGB_UTIL_BLACK_POLY = 0xFF121212, 464 | CARCOL_ARGB_UTIL_DARK_SILVER = 0xFF202224, 465 | CARCOL_ARGB_UTIL_SILVER = 0xFF575961, 466 | CARCOL_ARGB_UTIL_GUN_METAL = 0xFF23292E, 467 | CARCOL_ARGB_UTIL_SHADOW_SILVER = 0xFF323B47, 468 | CARCOL_ARGB_WORN_BLACK = 0xFF0F1012, 469 | CARCOL_ARGB_WORN_GRAPHITE = 0xFF212121, 470 | CARCOL_ARGB_WORN_SILVER_GREY = 0xFF5B5D5E, 471 | CARCOL_ARGB_WORN_SILVER = 0xFF888A99, 472 | CARCOL_ARGB_WORN_BLUE_SILVER = 0xFF697187, 473 | CARCOL_ARGB_WORN_SHADOW_SILVER = 0xFF3B4654, 474 | CARCOL_ARGB_METALLIC_RED = 0xFF690000, 475 | CARCOL_ARGB_METALLIC_TORINO_RED = 0xFF8A0B00, 476 | CARCOL_ARGB_METALLIC_FORMULA_RED = 0xFF6B0000, 477 | CARCOL_ARGB_METALLIC_BLAZE_RED = 0xFF611009, 478 | CARCOL_ARGB_METALLIC_GRACEFUL_RED = 0xFF4A0A0A, 479 | CARCOL_ARGB_METALLIC_GARNET_RED = 0xFF470E0E, 480 | CARCOL_ARGB_METALLIC_DESERT_RED = 0xFF380C00, 481 | CARCOL_ARGB_METALLIC_CABERNET_RED = 0xFF26030B, 482 | CARCOL_ARGB_METALLIC_CANDY_RED = 0xFF630012, 483 | CARCOL_ARGB_METALLIC_SUNRISE_ORANGE = 0xFF802800, 484 | CARCOL_ARGB_METALLIC_CLASSIC_GOLD = 0xFF6E4F2D, 485 | CARCOL_ARGB_METALLIC_ORANGE = 0xFFBD4800, 486 | CARCOL_ARGB_MATTE_RED = 0xFF780000, 487 | CARCOL_ARGB_MATTE_DARK_RED = 0xFF360000, 488 | CARCOL_ARGB_MATTE_ORANGE = 0xFFAB3F00, 489 | CARCOL_ARGB_MATTE_YELLOW = 0xFFDE7E00, 490 | CARCOL_ARGB_UTIL_RED = 0xFF520000, 491 | CARCOL_ARGB_UTIL_BRIGHT_RED = 0xFF8C0404, 492 | CARCOL_ARGB_UTIL_GARNET_RED = 0xFF4A1000, 493 | CARCOL_ARGB_WORN_RED = 0xFF592525, 494 | CARCOL_ARGB_WORN_GOLDEN_RED = 0xFF754231, 495 | CARCOL_ARGB_WORN_DARK_RED = 0xFF210804, 496 | CARCOL_ARGB_METALLIC_DARK_GREEN = 0xFF001207, 497 | CARCOL_ARGB_METALLIC_RACING_GREEN = 0xFF001A0B, 498 | CARCOL_ARGB_METALLIC_SEA_GREEN = 0xFF00211E, 499 | CARCOL_ARGB_METALLIC_OLIVE_GREEN = 0xFF1F261E, 500 | CARCOL_ARGB_METALLIC_GREEN = 0xFF003805, 501 | CARCOL_ARGB_METALLIC_GASOLINE_BLUE_GREEN = 0xFF0B4145, 502 | CARCOL_ARGB_MATTE_LIME_GREEN = 0xFF418503, 503 | CARCOL_ARGB_UTIL_DARK_GREEN_ = 0xFF0F1F15, 504 | CARCOL_ARGB_UTIL_GREEN = 0xFF023613, 505 | CARCOL_ARGB_WORN_DARK_GREEN = 0xFF162419, 506 | CARCOL_ARGB_WORN_GREEN = 0xFF2A3625, 507 | CARCOL_ARGB_WORN_SEA_WASH = 0xFF455C56, 508 | CARCOL_ARGB_METALLIC_MIDNIGHT_BLUE = 0xFF000D14, 509 | CARCOL_ARGB_METALLIC_DARK_BLUE = 0xFF001029, 510 | CARCOL_ARGB_METALLIC_SAXONY_BLUE = 0xFF1C2F4F, 511 | CARCOL_ARGB_METALLIC_BLUE = 0xFF001B57, 512 | CARCOL_ARGB_METALLIC_MARINER_BLUE = 0xFF3B4E78, 513 | CARCOL_ARGB_METALLIC_HARBOR_BLUE = 0xFF272D3B, 514 | CARCOL_ARGB_METALLIC_DIAMOND_BLUE = 0xFF95B2DB, 515 | CARCOL_ARGB_METALLIC_SURF_BLUE = 0xFF3E627A, 516 | CARCOL_ARGB_METALLIC_NAUTICAL_BLUE = 0xFF1C3140, 517 | CARCOL_ARGB_METALLIC_BRIGHT_BLUE = 0xFF0055C4, 518 | CARCOL_ARGB_METALLIC_PURPLE_BLUE = 0xFF1A182E, 519 | CARCOL_ARGB_METALLIC_SPINNAKER_BLUE = 0xFF161629, 520 | CARCOL_ARGB_METALLIC_ULTRA_BLUE = 0xFF0E316D, 521 | CARCOL_ARGB_METALLIC_BRIGHT_BLUE2 = 0xFF395A83, 522 | CARCOL_ARGB_UTIL_DARK_BLUE = 0xFF09142E, 523 | CARCOL_ARGB_UTIL_MIDNIGHT_BLUE = 0xFF0F1021, 524 | CARCOL_ARGB_UTIL_BLUE = 0xFF152A52, 525 | CARCOL_ARGB_UTIL_SEA_FOAM_BLUE = 0xFF324654, 526 | CARCOL_ARGB_UTIL_LIGHTNING_BLUE = 0xFF152563, 527 | CARCOL_ARGB_UTIL_MAUI_BLUE_POLY = 0xFF223BA1, 528 | CARCOL_ARGB_UTIL_BRIGHT_BLUE = 0xFF1F1FA1,//SLATE_BLUE 529 | CARCOL_ARGB_MATTE_DARK_BLUE = 0xFF030E2E, 530 | CARCOL_ARGB_MATTE_BLUE = 0xFF0F1E73, 531 | CARCOL_ARGB_MATTE_MIDNIGHT_BLUE = 0xFF001C32, 532 | CARCOL_ARGB_WORN_DARK_BLUE = 0xFF2A3754, 533 | CARCOL_ARGB_WORN_BLUE = 0xA0303C5E, 534 | CARCOL_ARGB_WORN_LIGHT_BLUE = 0xFF3B6796, 535 | CARCOL_ARGB_METALLIC_TAXI_YELLOW = 0xFFF5890F, 536 | CARCOL_ARGB_METALLIC_RACE_YELLOW = 0xFFD9A600, 537 | CARCOL_ARGB_METALLIC_BRONZE = 0xFF4A341B, 538 | CARCOL_ARGB_METALLIC_YELLOW_BIRD = 0xFFA2A827, 539 | CARCOL_ARGB_METALLIC_LIME = 0xFF568F00, 540 | CARCOL_ARGB_METALLIC_CHAMPAGNE = 0xFF57514B, 541 | CARCOL_ARGB_METALLIC_PUEBLO_BEIGE = 0xFF291B06, 542 | CARCOL_ARGB_METALLIC_DARK_IVORY = 0xFF262117, 543 | CARCOL_ARGB_METALLIC_CHOCO_BROWN = 0xFF120D07, 544 | CARCOL_ARGB_METALLIC_GOLDEN_BROWN = 0xFF332111, 545 | CARCOL_ARGB_METALLIC_LIGHT_BROWN = 0xFF3D3023, 546 | CARCOL_ARGB_METALLIC_STRAW_BEIGE = 0xFF5E5343, 547 | CARCOL_ARGB_METALLIC_MOSS_BROWN = 0xFF37382B, 548 | CARCOL_ARGB_METALLIC_BISTON_BROWN = 0xFF221918, 549 | CARCOL_ARGB_METALLIC_BEECHWOOD = 0xFF575036, 550 | CARCOL_ARGB_METALLIC_DARK_BEECHWOOD = 0xFF241309, 551 | CARCOL_ARGB_METALLIC_CHOCO_ORANGE = 0xFF3B1700, 552 | CARCOL_ARGB_METALLIC_BEACH_SAND = 0xFF6E6246, 553 | CARCOL_ARGB_METALLIC_SUN_BLEECHED_SAND = 0xFB998D73, 554 | CARCOL_ARGB_METALLIC_CREAM = 0xFFCFC0A5, 555 | CARCOL_ARGB_UTIL_BROWN = 0xFF1F1709, 556 | CARCOL_ARGB_UTIL_MEDIUM_BROWN = 0xFB3D311D, 557 | CARCOL_ARGB_UTIL_LIGHT_BROWN = 0xFF665847, 558 | CARCOL_ARGB_METALLIC_WHITE = 0xFFF0F0F0, 559 | CARCOL_ARGB_METALLIC_FROST_WHITE = 0xFFB3B9C9, 560 | CARCOL_ARGB_WORN_HONEY_BEIGE = 0xFF615F55, 561 | CARCOL_ARGB_WORN_BROWN = 0xFF241E1A, 562 | CARCOL_ARGB_WORN_DARK_BROWN = 0xFF171413, 563 | CARCOL_ARGB_WORN_STRAW_BEIGE = 0xFF3B372F, 564 | CARCOL_ARGB_BRUSHED_STEEL = 0xFF3B4045, 565 | CARCOL_ARGB_BRUSHED_BLACK_STEEL = 0xFF1A1E21, 566 | CARCOL_ARGB_BRUSHED_ALUMINIUM = 0xFF5E646B, 567 | CARCOL_ARGB_CHROME = 0xFF000000, 568 | CARCOL_ARGB_WORN_OFF_WHITE = 0xFFB0B0B0, 569 | CARCOL_ARGB_UTIL_OFF_WHITE = 0xFF999999, 570 | CARCOL_ARGB_WORN_ORANGE = 0xFFB56519, 571 | CARCOL_ARGB_WORN_LIGHT_ORANGE = 0xFFC45C33, 572 | CARCOL_ARGB_METALLIC_SECURICOR_GREEN = 0xFF47783C,//PEA_GREEN 573 | CARCOL_ARGB_WORN_TAXI_YELLOW = 0xFFBA8425, 574 | CARCOL_ARGB_POLICE_CAR_BLUE = 0xFF2A77A1, 575 | CARCOL_ARGB_MATTE_GREEN = 0xFF243022, 576 | CARCOL_ARGB_MATTE_BROWN = 0xFF6B5F54, 577 | CARCOL_ARGB_WORN_ORANGE2 = 0xFFC96E34, 578 | CARCOL_ARGB_MATTE_WHITE = 0xFFD9D9D9, 579 | CARCOL_ARGB_WORN_WHITE = 0xFFF0F0F0, 580 | CARCOL_ARGB_WORN_OLIVE_ARMY_GREEN = 0xFF3F4228, 581 | CARCOL_ARGB_PURE_WHITE = 0xFFFFFFFF, 582 | CARCOL_ARGB_HOT_PINK = 0xFFB01259, 583 | CARCOL_ARGB_SALMON_PINK = 0x00F69799, 584 | CARCOL_ARGB_METALLIC_VERMILLION_PINK = 0xFF8F2F55, 585 | CARCOL_ARGB_ORANGE = 0x00C26610, 586 | CARCOL_ARGB_GREEN = 0x0069BD45, 587 | CARCOL_ARGB_BLUE = 0x0000AEEF,//FLOURESCENT_BLUE 588 | CARCOL_ARGB_METTALIC_BLACK_BLUE = 0xFF000108, 589 | CARCOL_ARGB_METALLIC_BLACK_PURPLE = 0xFF050008, 590 | CARCOL_ARGB_METALLIC_BLACK_RED = 0xFF080000, 591 | CARCOL_ARGB_HUNTER_GREEN = 0x00565751, 592 | CARCOL_ARGB_METALLIC_PURPLE = 0x00320642, 593 | CARCOL_ARGB_METAILLIC_V_DARK_BLUE = 0xFF00080F, 594 | CARCOL_ARGB_MODSHOP_BLACK1 = 0xFF080808, 595 | CARCOL_ARGB_MATTE_PURPLE = 0x00320642, 596 | CARCOL_ARGB_MATTE_DARK_PURPLE = 0xFF050008, 597 | CARCOL_ARGB_METALLIC_LAVA_RED = 0xFF6B0B00, 598 | CARCOL_ARGB_MATTE_FOREST_GREEN = 0xFF121710, 599 | CARCOL_ARGB_MATTE_OLIVE_DRAB = 0xFF323325, 600 | CARCOL_ARGB_MATTE_DESERT_BROWN = 0xFF3B352D, 601 | CARCOL_ARGB_MATTE_DESERT_TAN = 0xFF706656, 602 | CARCOL_ARGB_MATTE_FOILAGE_GREEN = 0xFF2B302B, 603 | CARCOL_ARGB_DEFAULT_ALLOY_COLOR = 0xFF414347, 604 | CARCOL_ARGB_EPSILON_BLUE = 0xFF6690B5, 605 | CARCOL_ARGB_GOLD = 0xFF47391B, 606 | CARCOL_ARGB_GOLD_SATIN = 0xFF47391B, 607 | CARCOL_ARGB_GOLD_SPEC = 0xFFFFD859 608 | 609 | 610 | } CarColARGB; 611 | 612 | typedef enum LicensePlateLayout{ 613 | LP_FrontAndRear, 614 | LP_Front, 615 | LP_Rear, 616 | LP_None 617 | }LicensePlateLayout; 618 | 619 | typedef enum VehicleClass{ 620 | VC_Compacts, 621 | VC_Sedans, 622 | VC_Suv, 623 | VC_Coupes, 624 | VC_Muscle, 625 | VC_SportClassics, 626 | VC_Sports, 627 | VC_Super, 628 | VC_Motorcycles, 629 | VC_OffRoad, 630 | VC_Industrial, 631 | VC_Utility, 632 | VC_Van, 633 | VC_Cycle, 634 | VC_Boats, 635 | VC_Helicopters, 636 | VC_Planes, 637 | VC_Service, 638 | VC_Emergency, 639 | VC_Military, 640 | VC_Commercial, 641 | VC_Trains 642 | }VehicleClass; 643 | 644 | typedef enum ScaleformButton 645 | { 646 | SFB_ARROW_UP, 647 | SFB_ARROW_DOWN, 648 | SFB_ARROW_LEFT, 649 | SFB_ARROW_RIGHT, 650 | SFB_BUTTON_DPAD_UP, 651 | SFB_BUTTON_DPAD_DOWN, 652 | SFB_BUTTON_DPAD_RIGHT, 653 | SFB_BUTTON_DPAD_LEFT, 654 | SFB_BUTTON_DPAD_BLANK, 655 | SFB_BUTTON_DPAD_ALL, 656 | SFB_BUTTON_DPAD_UP_DOWN, 657 | SFB_BUTTON_DPAD_LEFT_RIGHT, 658 | SFB_BUTTON_LSTICK_UP, 659 | SFB_BUTTON_LSTICK_DOWN, 660 | SFB_BUTTON_LSTICK_LEFT, 661 | SFB_BUTTON_LSTICK_RIGHT, 662 | SFB_BUTTON_LSTICK, 663 | SFB_BUTTON_LSTICK_ALL, 664 | SFB_BUTTON_LSTICK_UP_DOWN, 665 | SFB_BUTTON_LSTICK_LEFT_RIGHT, 666 | SFB_BUTTON_LSTICK_ROTATE, 667 | SFB_BUTTON_RSTICK_UP, 668 | SFB_BUTTON_RSTICK_DOWN, 669 | SFB_BUTTON_RSTICK_LEFT, 670 | SFB_BUTTON_RSTICK_RIGHT, 671 | SFB_BUTTON_RSTICK, 672 | SFB_BUTTON_RSTICK_ALL, 673 | SFB_BUTTON_RSTICK_UP_DOWN, 674 | SFB_BUTTON_RSTICK_LEFT_RIGHT, 675 | SFB_BUTTON_RSTICK_ROTATE, 676 | SFB_BUTTON_A, 677 | SFB_BUTTON_B, 678 | SFB_BUTTON_X, 679 | SFB_BUTTON_Y, 680 | SFB_BUTTON_LB, 681 | SFB_BUTTON_LT, 682 | SFB_BUTTON_RB, 683 | SFB_BUTTON_RT, 684 | SFB_BUTTON_START, 685 | SFB_BUTTON_BACK, 686 | SFB_RED_BOX, 687 | SFB_RED_BOX_1, 688 | SFB_RED_BOX_2, 689 | SFB_RED_BOX_3, 690 | SFB_LOADING_HALF_CIRCLE_LEFT, 691 | SFB_ARROW_UP_DOWN, 692 | SFB_ARROW_LEFT_RIGHT, 693 | SFB_ARROW_ALL, 694 | SFB_LOADING_HALF_CIRCLE_LEFT_2, 695 | SFB_SAVE_HALF_CIRCLE_LEFT, 696 | SFB_LOADING_HALF_CIRCLE_RIGHT 697 | } ScaleformButton; 698 | 699 | typedef enum ScaleformSave 700 | { 701 | SFS_LOADING_CIRCLE_RIGHT = 1, 702 | SFS_SAVE_CIRCLE_LEFT = 4, 703 | SFS_LOADING_CIRCLE_LEFT = 5 704 | } ScaleformSave; 705 | 706 | typedef enum ForceTypes 707 | { 708 | FT_MIN_FORCE = 0, 709 | FT_MAX_FORCE_ROT = 1, 710 | FT_MIN_FORCE_2 = 2, 711 | FT_MAX_FORCE_ROT_2 = 3, //stable, good for custom handling 712 | FT_FORCE_NO_ROT = 4, 713 | FT_FORCE_ROT_PLUS_FORCE = 5 714 | } ForceTypes; 715 | 716 | typedef enum WeaponGroup 717 | { 718 | WG_UNARMED = 2685387236u, 719 | WG_MELEE = 3566412244u, 720 | WG_PISTOL = 416676503u, 721 | WG_SMG = 3337201093u, 722 | WG_ASSAULTRIFLE = 970310034u, 723 | WG_DIGISCANNER = 3539449195u, 724 | WG_FIREEXTINGUISHER = 4257178988u, 725 | WG_MG = 1159398588u, 726 | WG_NIGHTVISION = 3493187224u, 727 | WG_PARACHUTE = 431593103u, 728 | WG_SHOTGUN = 860033945u, 729 | WG_SNIPER = 3082541095u, 730 | WG_STUNGUN = 690389602u, 731 | WG_HEAVY = 2725924767u, 732 | WG_THROWN = 1548507267u, 733 | WG_PETROLCAN = 1595662460u, 734 | } WeaponGroup; 735 | -------------------------------------------------------------------------------- /include/common.c: -------------------------------------------------------------------------------- 1 | /*H********************************************************************** 2 | * FILENAME : common.c START DATE : 10 Sept 16 3 | * 4 | * DESCRIPTION : 5 | * Common functions to be used with all targets and platforms of SC-CL. 6 | * 7 | * NOTES : 8 | * This file is part of SC-CL's include library. 9 | * 10 | * LICENSE : 11 | * 12 | * Copyright 2016 SC-CL 13 | * 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions are met: 16 | * 17 | * * Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * 20 | * * Redistributions in binary form must reproduce the above copyright 21 | * notice, this list of conditions and the following disclaimer in the 22 | * documentation and/or other materials provided with the distribution. 23 | * 24 | * * Neither SC-CL nor its contributors may be used to endorse or promote products 25 | * derived from this software without specific prior written permission. 26 | * 27 | * * Redistribution of this software in source or binary forms shall be free 28 | * of all charges or fees to the recipient of this software. 29 | * 30 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 31 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 32 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 33 | * DISCLAIMED. IN NO EVENT SHALL SC-CL BE LIABLE FOR ANY 34 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 35 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 36 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 37 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 39 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | * 41 | * AUTHORS : 42 | * Rocko Tompkins 43 | * Nathan James 44 | *H*/ 45 | #include "types.h" 46 | #include "constants.h" 47 | #include "natives.h" 48 | #include "intrinsics.h" 49 | 50 | #define GlobalCharBufferD "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" 51 | 52 | char* GlobalCharBuffer = GlobalCharBufferD;//256 53 | 54 | void print(const char* str, int ms) 55 | { 56 | #if TARGET == TARGET_GTAV 57 | BEGIN_TEXT_COMMAND_PRINT("STRING"); 58 | ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(str); 59 | END_TEXT_COMMAND_PRINT(ms, 1); 60 | #elif TARGET == TARGET_RDR 61 | _CLEAR_PRINTS(); 62 | _PRINT_SUBTITLE(str, ms != 0 ? (float)ms / 1000.0f : 0, true, 2, 1, 0, 0, 0); 63 | #elif TARGET == TARGET_GTAIV 64 | CLEAR_PRINTS(); 65 | PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", str, ms, true); 66 | #endif 67 | } 68 | 69 | const char* IntToHex(int val, bool isLowercase) 70 | { 71 | char* hex_str; 72 | if(isLowercase) 73 | hex_str = "0123456789ABCDEF"; 74 | else 75 | hex_str = "0123456789abcdef"; 76 | 77 | byte* bin = (byte*)&val; 78 | 79 | char* str = " "; 80 | 81 | for (int i = 0; i < 4; i++) 82 | { 83 | str[i * 2] = hex_str[(bin[i] >> 4) & 0x0F]; 84 | str[i * 2 + 1] = hex_str[(bin[i]) & 0x0F]; 85 | } 86 | str[8] = 0; 87 | return str; 88 | } 89 | 90 | int HexToInt(const char *hex) 91 | { 92 | uint result = 0; 93 | 94 | while (*hex) 95 | { 96 | if (*hex > 47 && *hex < 58) 97 | result += (*hex - 48); 98 | else if (*hex > 64 && *hex < 71) 99 | result += (*hex - 55); 100 | else if (*hex > 96 && *hex < 103) 101 | result += (*hex - 87); 102 | 103 | if (*++hex) 104 | result <<= 4; 105 | } 106 | 107 | return result; 108 | } 109 | 110 | int IntToBase(int n, int b) 111 | { 112 | int rslt = 0, digitPos = 1; 113 | while (n) 114 | { 115 | rslt += (n%b)*digitPos; 116 | n /= b; 117 | digitPos *= 10; 118 | } 119 | return rslt; 120 | } 121 | 122 | const char* strcatGlobal(const char* str1, const char* str2) 123 | { 124 | //this takes advantage of strings being global 125 | //this returns a static pointer so if you want to use the function again without losing the return you have to strcpy it 126 | 127 | 128 | strcpy((char*)GlobalCharBuffer, str1, 255); 129 | stradd((char*)GlobalCharBuffer, str2, 255); 130 | return (char*)GlobalCharBuffer; 131 | } 132 | 133 | const char* straddiGlobal(const char* str, int i) 134 | { 135 | //this takes advantage of strings being global 136 | //this returns a static pointer so if you want to use the function again without losing the return you have to strcpy it 137 | 138 | strcpy((char*)GlobalCharBuffer, str, 255); 139 | straddi((char*)GlobalCharBuffer, i, 255); 140 | return (char*)GlobalCharBuffer; 141 | } 142 | 143 | const char* itosGlobal(int i) 144 | { 145 | //this takes advantage of strings being global 146 | //this returns a static pointer so if you want to use the function again without losing the return you have to strcpy it 147 | 148 | itos((char*)GlobalCharBuffer, i, 64); 149 | return (char*)GlobalCharBuffer; 150 | } 151 | 152 | void Throw(const char* str) 153 | { 154 | char Buffer[256]; 155 | #if TARGET == TARGET_RDR 156 | strcpy(Buffer, "Exception: ", 255); 157 | #else 158 | strcpy(Buffer, "~r~Exception~s~: ", 255); 159 | #endif 160 | 161 | stradd(Buffer, str, 255); 162 | print(Buffer, 10000); 163 | WAIT(10000); 164 | 165 | #if TARGET == TARGET_GTAV 166 | TERMINATE_THIS_THREAD(); 167 | #else 168 | TERMINATE_THIS_SCRIPT(); 169 | #endif 170 | } 171 | 172 | void Warn(const char* str) 173 | { 174 | char Buffer[256]; 175 | #if TARGET == TARGET_RDR 176 | strcpy(Buffer, "Warning: ", 255); 177 | #else 178 | strcpy(Buffer, "~y~Warning~s~: ", 255); 179 | #endif 180 | 181 | stradd(Buffer, str, 255); 182 | print(Buffer, 5000); 183 | } 184 | 185 | void Error(const char* str) 186 | { 187 | char Buffer[256]; 188 | #if TARGET == TARGET_RDR 189 | strcpy(Buffer, "Error: ", 255); 190 | #else 191 | strcpy(Buffer, "~r~Error~s~: ", 255); 192 | #endif 193 | 194 | stradd(Buffer, str, 255); 195 | print(Buffer, 5000); 196 | } 197 | 198 | int SwapEndian32(int value) 199 | { 200 | return ((((value) & 0xff000000) >> 24) | (((value) & 0x00ff0000) >> 8) | (((value) & 0x0000ff00) << 8) | (((value) & 0x000000ff) << 24)); 201 | } 202 | 203 | short SwapEndian16(short value) 204 | { 205 | return (((value) & 0xff000000) >> 24) | (((value) & 0x00ff0000) >> 8); 206 | } 207 | 208 | int CeilDivInt(uint a, uint b) 209 | { 210 | return a == 0 || b == 0 ? 0 : 1 + ((a - 1) / b); 211 | } 212 | 213 | int DivInt(int a, int b) 214 | { 215 | return a == 0 || b == 0 ? 0 : a / b; 216 | } 217 | 218 | float DivFloat(float a, float b) 219 | { 220 | return a == 0.0f || b == 0.0f ? 0.0f : a / b; 221 | } 222 | 223 | void SetBitAtIndex(int* valuePtr, uint bitIndex, bool bitValue) 224 | { 225 | *valuePtr = *valuePtr ^ ((-bitValue ^ *valuePtr) & (1 << (bitIndex % 32))); 226 | } 227 | 228 | 229 | int ModNegitive(int a, int b) 230 | { 231 | int ret = a % b; 232 | return ret < 0 ? ret + b : ret; 233 | } 234 | 235 | quaternion EulerToQuaternion(vector3 euler) 236 | { 237 | float cosYawOver2 = COS(euler.x * 0.5), 238 | sinYawOver2 = SIN(euler.x * 0.5), 239 | 240 | cosPitchOver2 = COS(euler.y * 0.5), 241 | sinPitchOver2 = SIN(euler.y * 0.5), 242 | 243 | cosRollOver2 = COS(euler.z * 0.5), 244 | sinRollOver2 = SIN(euler.z * 0.5); 245 | 246 | quaternion out = 247 | { 248 | (cosYawOver2 * cosPitchOver2 * cosRollOver2) + (sinYawOver2 * sinPitchOver2 * sinRollOver2), 249 | (cosYawOver2 * cosPitchOver2 * sinRollOver2) - (sinYawOver2 * sinPitchOver2 * cosRollOver2), 250 | (cosYawOver2 * sinPitchOver2 * cosRollOver2) + (sinYawOver2 * cosPitchOver2 * sinRollOver2), 251 | (sinYawOver2 * cosPitchOver2 * cosRollOver2) - (cosYawOver2 * sinPitchOver2 * sinRollOver2) 252 | }; 253 | return out; 254 | } 255 | 256 | vector3 RotationLookAtPoint(vector3 pos, vector3 endPos) 257 | { 258 | vector3 out = 259 | { 260 | ATAN2(pos.y, pos.z), 261 | ATAN2(pos.x * COS(endPos.x), pos.z), 262 | ATAN2(COS(endPos.x), SIN(endPos.x) * SIN(pos.y)) 263 | }; 264 | return out; 265 | } 266 | 267 | #if TARGET == TARGET_RDR 268 | #ifdef _MSC_VER 269 | #define aCOS(number) acosMSC(number) 270 | float acosMSC(float number) 271 | #else 272 | float aCOS(float number) 273 | #endif 274 | { 275 | //this works fine for floats as negitive ints and floats both have msb set 276 | if (reinterpretFloatToInt(number) < 0) 277 | { 278 | number = -number; 279 | return 280 | -((((((( 281 | -0.0187293f * number) 282 | + 0.0742610f) 283 | * number) 284 | - 0.2121144f) 285 | * number) 286 | + 1.5707288f) 287 | * SQRT(1.0 - number)) 288 | + PI; 289 | } 290 | 291 | return 292 | (((((( 293 | -0.0187293f * number) 294 | + 0.0742610f) 295 | * number) 296 | - 0.2121144f) 297 | * number) 298 | + 1.5707288f) 299 | * SQRT(1.0 - number); 300 | 301 | } 302 | #ifdef _MSC_VER 303 | #define aSIN(number) asinMSC(number) 304 | float asinMSC(float number) 305 | #else 306 | float aSIN(float number) 307 | #endif 308 | { 309 | //this works fine for floats as negitive ints and floats both have msb set 310 | if (reinterpretFloatToInt(number) < 0) 311 | { 312 | number = -number; 313 | return 314 | ((((((( 315 | -0.0187293f * number) 316 | + 0.0742610f) 317 | * number) 318 | - 0.2121144f) 319 | * number) 320 | + 1.5707288f) 321 | * SQRT(1.0 - number)) 322 | - 1.57079632; 323 | } 324 | return 325 | -((((((( 326 | -0.0187293f * number) 327 | + 0.0742610f) 328 | * number) 329 | - 0.2121144f) 330 | * number) 331 | + 1.5707288f) 332 | * SQRT(1.0 - number)) 333 | + 1.57079632; 334 | } 335 | #endif 336 | 337 | float StringToFloat(const char* str) 338 | { 339 | float rez = 0, fact = 1; 340 | bool point_seen = false; 341 | str -= 3; 342 | int d = 0, read_char = *str & 0xFF; 343 | 344 | if (read_char == '-') 345 | { 346 | fact = -1; 347 | read_char = *++str & 0xFF; 348 | } 349 | 350 | while (read_char) 351 | { 352 | if (read_char == '.') 353 | { 354 | point_seen = true; 355 | read_char = *++str & 0xFF; 356 | continue; 357 | } 358 | 359 | d = read_char - '0'; 360 | 361 | if (d >= 0 && d <= 9) 362 | { 363 | if (point_seen) 364 | fact /= 10; 365 | rez = rez * 10.0f + (float)d; 366 | } 367 | read_char = *++str & 0xFF; 368 | } 369 | return rez * fact; 370 | } 371 | 372 | //TODO: add these as intrinsics 373 | bool CmpLtU(int a, int b) 374 | { 375 | if (a >= 0 && b >= 0) 376 | return a < b; 377 | else 378 | { 379 | if (a == b) 380 | return false; 381 | 382 | int ltb = ~a & b; 383 | 384 | ltb |= ltb >> 1; 385 | ltb |= ltb >> 2; 386 | ltb |= ltb >> 4; 387 | ltb |= ltb >> 8; 388 | ltb |= ltb >> 16; 389 | return ((a & ~b) & ~ltb) == 0; 390 | } 391 | } 392 | 393 | bool CmpGtU(int a, int b) 394 | { 395 | if (a >= 0 && b >= 0) 396 | return a > b; 397 | else 398 | { 399 | int ltb = ~a & b; 400 | 401 | ltb |= ltb >> 1; 402 | ltb |= ltb >> 2; 403 | ltb |= ltb >> 4; 404 | ltb |= ltb >> 8; 405 | ltb |= ltb >> 16; 406 | 407 | return ((a & ~b) & ~ltb) != 0; 408 | } 409 | } 410 | 411 | int Diff64P(int* x, int* y) 412 | { 413 | int out[2]; 414 | out[0] = (int)x - (int)y; 415 | #if PTRWIDTH == 64 416 | *(int*)((char*)out + 4) = *(int*)((char*)&x + 4) - *(int*)((char*)&y + 4); 417 | if (CmpGtU(out[0], (int)x)) 418 | out[1]--; 419 | #endif 420 | return out[0]; 421 | 422 | } 423 | 424 | int* Sub64P(int* x, int yLeft, int yRight) 425 | { 426 | int out[2]; 427 | out[0] = (int)x - yLeft; 428 | #if PTRWIDTH == 64 429 | *(int*)((char*)out + 4) = *(int*)((char*)&x + 4) - yRight; 430 | if (CmpGtU(out[0], (int)x)) 431 | out[1]--; 432 | #endif 433 | return (int*)out[0]; 434 | } 435 | 436 | int* Add64P(int* x, int yLeft, int yRight) 437 | { 438 | int out[2]; 439 | out[0] = (int)x + yLeft; 440 | #if PTRWIDTH == 64 441 | *(int*)((char*)out + 4) = *(int*)((char*)&x + 4) + yRight; 442 | //if (CmpLtU(out[0], (int)x)) 443 | //out[1]++; 444 | #endif 445 | return (int*)out[0]; 446 | } 447 | 448 | int* Push64P(int LeftMost, int RightMost) 449 | { 450 | #if PTRWIDTH == 64 451 | int out[2]; 452 | out[0] = LeftMost; 453 | *(int*)((char*)out + 4) = RightMost; 454 | return (int*)out[0]; 455 | #else 456 | return (int*)LeftMost; 457 | #endif 458 | } 459 | -------------------------------------------------------------------------------- /include/common.h: -------------------------------------------------------------------------------- 1 | /*H********************************************************************** 2 | * FILENAME : common.h START DATE : 10 Sept 16 3 | * 4 | * DESCRIPTION : 5 | * Common functions to be used with all targets and platforms of SC-CL. 6 | * 7 | * NOTES : 8 | * This file is part of SC-CL's include library. 9 | * 10 | * LICENSE : 11 | * 12 | * Copyright 2016 SC-CL 13 | * 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions are met: 16 | * 17 | * * Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * 20 | * * Redistributions in binary form must reproduce the above copyright 21 | * notice, this list of conditions and the following disclaimer in the 22 | * documentation and/or other materials provided with the distribution. 23 | * 24 | * * Neither SC-CL nor its contributors may be used to endorse or promote products 25 | * derived from this software without specific prior written permission. 26 | * 27 | * * Redistribution of this software in source or binary forms shall be free 28 | * of all charges or fees to the recipient of this software. 29 | * 30 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 31 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 32 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 33 | * DISCLAIMED. IN NO EVENT SHALL SC-CL BE LIABLE FOR ANY 34 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 35 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 36 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 37 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 39 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | * 41 | * AUTHORS : 42 | * Rocko Tompkins 43 | * Nathan James 44 | *H*/ 45 | #pragma once 46 | #include "types.h" 47 | 48 | /// Swaps the endian of a int or short. 49 | /// The value to be swapped. 50 | /// 51 | #define SwapEndian(x) _Generic((x),\ 52 | short int: SwapEndian16(x), unsigned short int: SwapEndian16(x),\ 53 | default: SwapEndian32(x)) 54 | 55 | /// Safely divides a and b to avoid division by zero. 56 | /// The left side value. 57 | /// The right side value. 58 | /// The divided value. 59 | #define SafeDiv(x, y) _Generic((x),\ 60 | float: DivFloat(x, y), double: DivFloat(x, y),\ 61 | default: DivInt(x, y)) 62 | 63 | /// Swaps the endian of a int to a constant value. 64 | /// The value to be swapped. 65 | /// 66 | #define SwapEndian32Const(value) ((((value) & 0xff000000) >> 24) | (((value) & 0x00ff0000) >> 8) | (((value) & 0x0000ff00) << 8) | (((value) & 0x000000ff) << 24)) 67 | 68 | /// Converts degrees to radians. 69 | /// The value to be converted. 70 | /// The value converted to radians. 71 | #define DegreesToRadians(degrees) (degrees * (PI / 180.0f)) 72 | 73 | /// Converts radians to degrees. 74 | /// The value to be converted. 75 | /// The value converted to degrees. 76 | #define RadiansToDegrees(radians) (radians * (180.0f / PI)) 77 | 78 | #if TARGET == TARGET_RDR 79 | #define ftos(flt, precision) _float_to_string(flt, 3, precision) 80 | #else 81 | #define ftos(flt, precision) 82 | #endif 83 | 84 | /// Prints the specified string to the subtitle buffer. 85 | /// The string to be printed. 86 | /// The milliseconds that the string should be printed for. 87 | /// 88 | void print(const char* str, int ms); 89 | 90 | /// Concatinates two strings into one using a global char buffer. 91 | /// The first string to be added to the buffer. 92 | /// The second string to be added to the buffer. 93 | /// The pointer to the global char buffer. 94 | const char* strcatGlobal(const char* str1, const char* str2); 95 | 96 | /// Copies str into the global char buffer then concatinates it with the string representation of i. 97 | /// The string to be added to the buffer. 98 | /// The int to be converted and added to the buffer. 99 | /// The pointer to the global char buffer. 100 | const char* straddiGlobal(const char* str, int i); 101 | 102 | /// Copies the string representation of i into the global char buffer. 103 | /// The int to be converted and copied to the buffer. 104 | /// The pointer to the global char buffer. 105 | const char* itosGlobal(int i); 106 | 107 | /// Prints the string as an exception for 10 seconds then exits the script. 108 | /// The string to be printed. 109 | /// 110 | void Throw(const char* str); 111 | 112 | /// Prints the string as an warning for 5 seconds. 113 | /// The string to be printed. 114 | /// 115 | void Warn(const char* str); 116 | 117 | /// Prints the string as an error for 5 seconds. 118 | /// The string to be printed. 119 | /// 120 | void Error(const char* str); 121 | 122 | /// Swaps the endian of a int. 123 | /// The value to be swapped. 124 | /// 125 | int SwapEndian32(int value); 126 | 127 | /// Swaps the endian of a short. 128 | /// The value to be swapped. 129 | /// 130 | short SwapEndian16(short value); 131 | 132 | /// Divides a and b then rounds up. 133 | /// The left side value. 134 | /// The right side value. 135 | /// The ceiled value. 136 | int CeilDivInt(uint a, uint b); 137 | 138 | /// Safely divides a and b to avoid division by zero. 139 | /// The left side value. 140 | /// The right side value. 141 | /// The divided value. 142 | int DivInt(int a, int b); 143 | 144 | /// Safely divides a and b to avoid division by zero. 145 | /// The left side value. 146 | /// The right side value. 147 | /// The divided value. 148 | float DivFloat(float a, float b); 149 | 150 | /// Converts a string representing a float to a float. 151 | /// The string to convert. 152 | /// The converted float value. 153 | float StringToFloat(const char* str); 154 | 155 | /// Converts a number to a hex string and stores it in a global char buffer. 156 | /// The value to convert. 157 | /// If to convert the hex result to lower case. 158 | /// A pointer to the global char buffer. 159 | const char* IntToHex(int val, bool isLowercase); 160 | 161 | /// Converts a hex string to decimal. 162 | /// Hex string to convert. 163 | /// The decimal result. 164 | int HexToInt(const char* hex); 165 | 166 | /// Converts a base 10 integer to a specified base. 167 | /// The base 10 integer. 168 | /// The base to convert to. 169 | /// The decimal representation of the new base. 170 | int IntToBase(int n, int b); 171 | 172 | /// Sets a bit at the bitIndex of a pointer to the specified value of bitValue. 173 | /// The pointer to the value that will be changed. 174 | /// The bit index of the bit relative to the pointer. 175 | /// The bit value to be set at the index. 176 | /// 177 | void SetBitAtIndex(int* valuePtr, uint bitIndex, bool bitValue); 178 | 179 | /// Preforms a modulo operation an a negative number. 180 | /// The left side value. 181 | /// The right side value. 182 | /// The modulo result. 183 | int ModNegitive(int a, int b); 184 | 185 | /// Converts a euler angle to a quaternion. 186 | /// The euler angle to be converted. 187 | /// The quaternion result. 188 | quaternion EulerToQuaternion(vector3 euler); 189 | 190 | /// Applies slow rotation to a look position eventualy converting it to endPos. 191 | /// The current look position. 192 | /// The end look position. 193 | /// The updated look position. 194 | vector3 RotationLookAtPoint(vector3 pos, vector3 endPos); 195 | 196 | #if TARGET == TARGET_RDR 197 | #ifdef _MSC_VER 198 | /// Returns the principal value of the arc cosine of x, expressed in radians. 199 | /// 200 | /// Value whose arc cosine is computed, in the interval [-1,+1]. 201 | /// If the argument is out of this interval, a domain error occurs. 202 | /// 203 | /// Principal arc cosine of x, in the interval [0,pi] radians. 204 | #define acos(x) acosMSC(x) 205 | float acosMSC(float number) {}; 206 | #else 207 | float acos(float number); 208 | #endif 209 | #ifdef _MSC_VER 210 | /// Returns the principal value of the arc sine of x, expressed in radians. 211 | /// 212 | /// Value whose arc sine is computed, in the interval [-1,+1]. 213 | /// If the argument is out of this interval, a domain error occurs. 214 | /// 215 | /// Principal arc sine of x, in the interval [-pi/2,+pi/2] radians. 216 | #define asin(number) asinMSC(number) 217 | float asinMSC(float number) {}; 218 | #else 219 | float asin(float number); 220 | #endif 221 | #endif 222 | 223 | bool CmpLtU(int a, int b); 224 | bool CmpGtU(int a, int b); 225 | int Diff64P(int* x, int* y); 226 | int* Sub64P(int* x, int yLeft, int yRight); 227 | int* Add64P(int* x, int yLeft, int yRight); 228 | int* Push64P(int LeftMost, int RightMost); -------------------------------------------------------------------------------- /include/constants.h: -------------------------------------------------------------------------------- 1 | /*H********************************************************************** 2 | * FILENAME : constants.h START DATE : 10 Sept 16 3 | * 4 | * DESCRIPTION : 5 | * General constants to be used with all targets and platforms of SC-CL. 6 | * consts.h file controller based on your current target and platform. 7 | * 8 | * NOTES : 9 | * This file is part of SC-CL's include library. 10 | * 11 | * LICENSE : 12 | * 13 | * Copyright 2016 SC-CL 14 | * 15 | * Redistribution and use in source and binary forms, with or without 16 | * modification, are permitted provided that the following conditions are met: 17 | * 18 | * * Redistributions of source code must retain the above copyright 19 | * notice, this list of conditions and the following disclaimer. 20 | * 21 | * * Redistributions in binary form must reproduce the above copyright 22 | * notice, this list of conditions and the following disclaimer in the 23 | * documentation and/or other materials provided with the distribution. 24 | * 25 | * * Neither SC-CL nor its contributors may be used to endorse or promote products 26 | * derived from this software without specific prior written permission. 27 | * 28 | * * Redistribution of this software in source or binary forms shall be free 29 | * of all charges or fees to the recipient of this software. 30 | * 31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 32 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 33 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 34 | * DISCLAIMED. IN NO EVENT SHALL SC-CL BE LIABLE FOR ANY 35 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 36 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 37 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 38 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 39 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 40 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 | * 42 | * AUTHORS : 43 | * Rocko Tompkins 44 | * Nathan James 45 | *H*/ 46 | #pragma once 47 | 48 | #define TRUE 1 49 | #define FALSE 0 50 | #define true 1 51 | #define false 0 52 | #define NULL 0 53 | #define null 0 54 | #define nullptr 0 55 | #define nullstr "" 56 | 57 | #define PI 3.14159265 58 | 59 | #if TARGET == TARGET_RDR 60 | 61 | #include "RDR/consts32.h" 62 | 63 | #elif TARGET == TARGET_GTAV 64 | #include "GTAV/constsShared.h" 65 | 66 | #if PLATFORM == PLATFORM_PC 67 | #include "GTAV/consts64.h" 68 | #else 69 | #include "GTAV/consts32.h" 70 | #endif 71 | 72 | #elif TARGET == TARGET_GTAIV 73 | #include "GTAIV/consts32.h" 74 | #endif -------------------------------------------------------------------------------- /include/intrinsics.h: -------------------------------------------------------------------------------- 1 | /*H********************************************************************** 2 | * FILENAME : intrinsics.h START DATE : 10 Sept 16 3 | * 4 | * DESCRIPTION : 5 | * Intrinsic functions to be used with all targets and platforms of SC-CL. 6 | * 7 | * NOTES : 8 | * This file is part of SC-CL's include library. 9 | * 10 | * LICENSE : 11 | * 12 | * Copyright 2016 SC-CL 13 | * 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions are met: 16 | * 17 | * * Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * 20 | * * Redistributions in binary form must reproduce the above copyright 21 | * notice, this list of conditions and the following disclaimer in the 22 | * documentation and/or other materials provided with the distribution. 23 | * 24 | * * Neither SC-CL nor its contributors may be used to endorse or promote products 25 | * derived from this software without specific prior written permission. 26 | * 27 | * * Redistribution of this software in source or binary forms shall be free 28 | * of all charges or fees to the recipient of this software. 29 | * 30 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 31 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 32 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 33 | * DISCLAIMED. IN NO EVENT SHALL SC-CL BE LIABLE FOR ANY 34 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 35 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 36 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 37 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 39 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | * 41 | * AUTHORS : 42 | * Rocko Tompkins 43 | * Nathan James 44 | *H*/ 45 | #pragma once 46 | #include "types.h" 47 | #include "constants.h" 48 | 49 | //Fix for intellisense nonsense 50 | #ifndef _MSC_VER 51 | /// Defines a function as an intrinsic for use in the compiler. 52 | #define __intrinsic __attribute((intrinsic(false))) 53 | 54 | /// Defines a function as an unsafe intrinsic for use in the compiler. 55 | #define __unsafeIntrinsic __attribute((intrinsic(true))) 56 | 57 | #else 58 | 59 | /// Computes the Jenkins one-at-a-time hash at compile time. 60 | /// String to be hashed. 61 | /// The Jenkins one-at-a-time hash key of the string. 62 | #define hashof(str) 0 63 | 64 | /// Computes the Jenkins one-at-a-time hash at compile time. 65 | /// String to be hashed. 66 | /// The Jenkins one-at-a-time hash key of the string. 67 | #define joaat(str) 0 68 | 69 | /// Defines a function as an intrinsic for use in the compiler. 70 | #define __intrinsic 71 | 72 | /// Defines a function as an unsafe intrinsic for use in the compiler. 73 | #define __unsafeIntrinsic 74 | 75 | #pragma warning( disable : 4391 ) 76 | #pragma warning( disable : 4392 ) 77 | #pragma warning( disable : 4244 ) 78 | #endif 79 | 80 | /// This macro with functional form returns the offset value in bytes of member in the data structure or union type type. 81 | /// A type in which member is a valid member designator. 82 | /// A member of type. 83 | /// A value of type unsigned int with the offset value of member in type. 84 | #define offsetof(type, member) ((uint)&(((type *)0)->member)) 85 | 86 | /// Computes the number of elements in a statically-allocated array 87 | /// The name of an array. 88 | /// The number of elements in the array, expressed as a unsigned int. 89 | #define countof(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x]))))) 90 | 91 | /// Computes the stack size of a type. 92 | /// The name of the type. 93 | /// The stack size of the type, expressed as a unsigned int. 94 | #define stacksizeof(x) ((sizeof(x) + 3) >> 2) 95 | 96 | #pragma region String //{ 97 | /// Sets the first num bytes of the block of memory pointed by ptr to the specified value. 98 | /// Pointer to the block of memory to fill. 99 | /// Value to be set. The value is passed as an int, but the function fills the block of memory using the unsigned char conversion of this value. 100 | /// Number of bytes to be set. 101 | /// 102 | extern __intrinsic void memset(void* ptr, byte value, unsigned int len); 103 | 104 | /// Copies the values of len bytes from the location pointed to by source directly to the memory block pointed to by destination. 105 | /// Pointer to the destination array where the content is to be copied. 106 | /// Pointer to the source of data to be copied. 107 | /// Number of bytes to copy. 108 | /// 109 | extern __intrinsic void memcpy(void* dest, const void* src, unsigned int len); 110 | 111 | /// Copies the string pointed by source into the array pointed by destination, including the terminating null character (and stopping at that point). 112 | /// Pointer to the destination array where the content is to be copied. 113 | /// String to be copied. 114 | /// The length of the dest buffer.This value must be an integer literal in the range of 1 - 255. 115 | /// 116 | extern __intrinsic void strcpy(char* dest, const char* src, const byte destBufferLen); 117 | 118 | /// 119 | /// Appends a copy of the source string to the destination string. 120 | /// The terminating null character in destination is overwritten by the first character of source, 121 | /// and a null-character is included at the end of the new string formed by the concatenation of both in destination. 122 | /// 123 | /// Pointer to the destination array, which should contain a string, and be large enough to contain the concatenated resulting string. 124 | /// String to be appended. This should not overlap destination. 125 | /// The length of the dest buffer.This value must be an integer literal in the range of 1 - 255. 126 | /// 127 | extern __intrinsic void stradd(char* dest, const char* src, const byte destBufferLen); 128 | 129 | /// 130 | /// Appends a integer to the destination string. 131 | /// The terminating null character in destination is overwritten by the first character of the integer conversion, 132 | /// and a null-character is included at the end of the new string formed by the concatenation of both in destination. 133 | /// 134 | /// Pointer to the destination array, which should contain a string, and be large enough to contain the concatenated resulting string. 135 | /// Integer to be appended. 136 | /// The length of the dest buffer.This value must be an integer literal in the range of 1 - 255. 137 | /// 138 | extern __intrinsic void straddi(char* dest, int value, const byte destBufferLen); 139 | 140 | /// Converts a integer to a string. 141 | /// Pointer to the destination array where the content is to be copied. 142 | /// Integer to be copied. 143 | /// The length of the dest buffer.This value must be an integer literal in the range of 1 - 255. 144 | /// 145 | extern __intrinsic void itos(char* dest, int value, const byte destBufferLen); 146 | 147 | /// Copies the null-terminated byte string pointed to by src, including the null terminator, to the character array whose first element is pointed to by dest. 148 | /// Pointer to the character array to write to. 149 | /// Pointer to the null-terminated byte string to copy from. 150 | /// 151 | extern __intrinsic void strcpy_s(char* dest, const char* src); 152 | 153 | /// Appends a copy of the null-terminated byte string pointed to by src to the end of the null-terminated byte string pointed to by dest. 154 | /// Pointer to the null-terminated byte string to append to. 155 | /// Pointer to the null-terminated byte string to copy from. 156 | /// 157 | extern __intrinsic void stradd_s(char* dest, const char* src); 158 | 159 | /// Appends a copy of the null-terminated byte string converted from value to the end of the null-terminated byte string pointed to by dest. 160 | /// Pointer to the null-terminated byte string to append to. 161 | /// Value to be converted to a null-terminated byte string then appended. 162 | /// 163 | extern __intrinsic void straddi_s(char* dest, int value); 164 | 165 | /// Copies the null-terminated byte string converted from value, including the null terminator, to the character array whose first element is pointed to by dest. 166 | /// Pointer to the character array to write to. 167 | /// Value to be converted to a null-terminated byte string then copied. 168 | /// 169 | extern __intrinsic void itos_s(char* dest, int value); 170 | 171 | /// Computes the Jenkins one-at-a-time hash. 172 | /// String to be hashed. 173 | /// The Jenkins one-at-a-time hash key of the string. 174 | extern __intrinsic int getHashKey(const char* str); 175 | 176 | #pragma endregion //} 177 | 178 | #pragma region Misc_Opcodes //{ 179 | /// Gets a variable's index by its name. 180 | /// The variable name to be found.This value must be an string literal. 181 | /// The var index. 182 | extern __intrinsic const uint __varIndex(const char* varName); 183 | 184 | #pragma endregion //} 185 | 186 | #pragma region Math/Conversions //{ 187 | /// Reinterprets a int to a float without type conversion. 188 | /// The integer value to be converted. 189 | /// The integer data now representing an float. 190 | extern __intrinsic float reinterpretIntToFloat(int intValue); 191 | 192 | /// Reinterprets a float to a int without type conversion. 193 | /// The floating-point value to be converted. 194 | /// The floating-point data now representing an int 195 | extern __intrinsic int reinterpretFloatToInt(float floatValue); 196 | 197 | /// Creates a vector3 with all values initialized as the floating-point value. 198 | /// The floating-point value to be set. 199 | /// A vector3 with all values set as the floating-point value 200 | extern __intrinsic vector3 toVector3(float value); 201 | 202 | /// Adds each value of the left vector3 to each value the right vector3. 203 | /// The left side of the operation. 204 | /// The right side of the operation. 205 | /// The addition result of the two vector3s. 206 | extern __intrinsic vector3 vector3Add(vector3 left, vector3 right); 207 | 208 | /// Substacts each value of the left vector3 from each value the right vector3. 209 | /// The left side of the operation. 210 | /// The right side of the operation. 211 | /// The subtraction result of the two vector3s. 212 | extern __intrinsic vector3 vector3Sub(vector3 left, vector3 right); 213 | 214 | /// Multiplies each value of the left vector3 by each value the right vector3. 215 | /// The left side of the operation. 216 | /// The right side of the operation. 217 | /// The multiplication result of the two vector3s. 218 | extern __intrinsic vector3 vector3Mult(vector3 left, vector3 right); 219 | 220 | /// Divides each value of the left vector3 by each value the right vector3. 221 | /// The left side of the operation. 222 | /// The right side of the operation. 223 | /// The division result of the two vector3s. 224 | extern __intrinsic vector3 vector3Div(vector3 left, vector3 right); 225 | 226 | /// Negates each value of the vector3. 227 | /// The vector to be negated. 228 | /// The negation result of the vector3. 229 | extern __intrinsic vector3 vector3Neg(vector3 vector); 230 | 231 | /// Calculates the dot product of two vector3s. 232 | /// The left side of the operation. 233 | /// The right side of the operation. 234 | /// The dot product of the two vector3s. 235 | extern __intrinsic float vector3Dot(vector3 left, vector3 right); 236 | 237 | /// Flattens the height value of the vector3 to 0. 238 | /// The vector to be flattened. 239 | /// The flatten result of the vector3. 240 | extern __intrinsic vector3 vector3Flatten(vector3 vector); 241 | 242 | /// Creates a vector2 with all values initialized as the floating-point value. 243 | /// The floating-point value to be set. 244 | /// A vector2 with all values set as the floating-point value 245 | extern __intrinsic vector2 toVector2(float value); 246 | 247 | /// Adds each value of the left vector2 to each value the right vector2. 248 | /// The left side of the operation. 249 | /// The right side of the operation. 250 | /// The addition result of the two vector2s. 251 | extern __intrinsic vector2 vector2Add(vector2 left, vector2 right); 252 | 253 | /// Substacts each value of the left vector2 from each value the right vector3. 254 | /// The left side of the operation. 255 | /// The right side of the operation. 256 | /// The subtraction result of the two vector2s. 257 | extern __intrinsic vector2 vector2Sub(vector2 left, vector2 right); 258 | 259 | /// Multiplies each value of the left vector2 by each value the right vector3. 260 | /// The left side of the operation. 261 | /// The right side of the operation. 262 | /// The multiplication result of the two vector2s. 263 | extern __intrinsic vector2 vector2Mult(vector2 left, vector2 right); 264 | 265 | /// Divides each value of the left vector2 by each value the right vector3. 266 | /// The left side of the operation. 267 | /// The right side of the operation. 268 | /// The division result of the two vector2s. 269 | extern __intrinsic vector2 vector2Div(vector2 left, vector2 right); 270 | 271 | /// Negates each value of the vector2. 272 | /// The vector to be negated. 273 | /// The negation result of the vector2. 274 | extern __intrinsic vector2 vector2Neg(vector2 vector); 275 | 276 | /// Calculates the dot product of two vector2s. 277 | /// The left side of the operation. 278 | /// The right side of the operation. 279 | /// The dot product of the two vector2s. 280 | extern __intrinsic float vector2Dot(vector2 left, vector2 right); 281 | 282 | /// Converts a vector2 to a vector3 with z initialized as 0. 283 | /// The vector2 to be converted. 284 | /// The vector2 as a vector3 with z initialized as 0. 285 | extern __intrinsic vector3 vector2ToVector3(vector2 vector); 286 | 287 | /// Converts a vector3 to a vector2 with z truncated. 288 | /// The vector3 to be converted. 289 | /// The vector3 as a vector2 with z truncated. 290 | extern __intrinsic vector2 vector3ToVector2(vector3 vector); 291 | 292 | /// Returns the floating-point remainder of numer/denom 293 | /// The Value of the quotient numerator. 294 | /// The Value of the quotient denominator.If denom is zero, the function may either return zero or cause a domain error 295 | /// The remainder of dividing the arguments. 296 | extern __intrinsic float fMod(float numer, float denom); 297 | 298 | /// Tests if the bit at a index of a value is set. 299 | /// The value of the integer to be tested. 300 | /// The bit index to be tested.This value must be an integer literal. 301 | /// The if the bit is set. 302 | extern __intrinsic bool bit_test(int value, const byte bitIndex); 303 | 304 | /// Sets the bit at a index at the address of a value. 305 | /// The address of the value. 306 | /// The bit index to be set.This value must be an integer literal. 307 | /// 308 | extern __intrinsic void bit_set(int* address, const byte bitIndex); 309 | 310 | /// Resets the bit at a index at the address of a value. 311 | /// The address of the value. 312 | /// The bit index to be reset.This value must be an integer literal. 313 | /// 314 | extern __intrinsic void bit_reset(int* address, const byte bitIndex); 315 | 316 | /// Flips the bit at a index at the address of a value. 317 | /// The address of the value. 318 | /// The bit index to be flipped.This value must be an integer literal. 319 | /// 320 | extern __intrinsic void bit_flip(int* address, const byte bitIndex); 321 | 322 | /// Gets the byte at an address in big endian. 323 | /// The address of the value you want to get. 324 | /// The the byte at an address in big endian. 325 | extern __intrinsic unsigned char getByte(void* addr); 326 | 327 | /// Sets the byte at an address. 328 | /// The address of the value you want to set. 329 | /// The value you want to set. 330 | extern __intrinsic void setByte(void* addr, unsigned char value); 331 | #pragma endregion //} 332 | 333 | #pragma region Variables //{ 334 | /// Sets a static variable at a specific index. 335 | /// The index of the static to set.This value must be an integer literal. 336 | /// The value to set the static. 337 | /// 338 | extern __intrinsic void setStaticAtIndex(const uint index, int value); 339 | 340 | /// Gets a static variable at a specific index. 341 | /// The index of the static to get.This value must be an integer literal. 342 | /// The static value. 343 | extern __intrinsic int getStaticAtIndex(const uint index); 344 | 345 | /// Gets the pointer to a static variable at a specific index. 346 | /// The index of the static to get.This value must be an integer literal. 347 | /// The pointer to the static. 348 | extern __intrinsic void* getStaticPtrAtIndex(const uint index); 349 | 350 | /// Sets a global variable at a specific index. 351 | /// The index of the global to set.This value must be an integer literal. 352 | /// The value to set the global. 353 | /// 354 | extern __intrinsic void setGlobalAtIndex(const uint index, int value); 355 | 356 | /// Gets a global variable at a specific index. 357 | /// The index of the global to get.This value must be an integer literal. 358 | /// The global value. 359 | extern __intrinsic int getGlobalAtIndex(const uint index); 360 | 361 | /// Gets the pointer to a global variable at a specific index. 362 | /// The index of the global to get.This value must be an integer literal. 363 | /// The pointer to the global. 364 | extern __intrinsic void* getGlobalPtrAtIndex(const uint index); 365 | 366 | /// Gets the pointer to a variable at a specific index in a array. 367 | /// The pointer to the array. 368 | /// The index of the array item. 369 | /// The array item size.This value must be an integer literal. 370 | /// The pointer to the array item. 371 | extern __intrinsic void* getPtrFromArrayIndex(const void* array, int index, const int arrayItemSize); 372 | 373 | /// Gets the pointer at a immediate index of a pointer. 374 | /// The starting pointer. 375 | /// The immediate index.This value must be an integer literal. 376 | /// The pointer + immIndex * 4. 377 | extern __intrinsic void* getPtrImmIndex(const void* pointer, const int immIndex); 378 | 379 | #pragma endregion //} 380 | 381 | #if PTRWIDTH == 64 382 | #pragma region YSC_Specific //{ 383 | /// Sets the lower 32 bits of a value. 384 | /// The address of the value you want to set. 385 | /// The value to set. 386 | extern __intrinsic void setLoDWord(void* addr, int value); 387 | /// Sets the higher 32 bits of a value. 388 | /// The address of the value you want to set. 389 | /// The value to set. 390 | extern __intrinsic void setHiDWord(void* addr, int value); 391 | /// Gets the lower 32 bits of a value. 392 | /// The address of the value you want to get. 393 | /// The the lower 32 bits of the value. 394 | extern __intrinsic int getLoDWord(void* addr); 395 | /// Gets the higher 32 bits of a value. 396 | /// The address of the value you want to get. 397 | /// The the higher 32 bits of the value. 398 | extern __intrinsic int getHiDWord(void* addr); 399 | #pragma endregion //} 400 | #endif 401 | 402 | #pragma region Custom_ASM //{ 403 | /************************************************************************* 404 | * These perform the operation on the item(or vector) on top of the stack 405 | * This can lead to dangerous behaviour if you aren't sure what is currently on the stack 406 | *************************************************************************/ 407 | 408 | /// Pops multiple items off the stack. 409 | /// The amount of items to pop off.This value must be an integer literal. 410 | /// 411 | extern __unsafeIntrinsic void __popMult(const uint count); 412 | 413 | /// Pushes a vector3 on the stack. 414 | /// The vector3 to be pushed. 415 | /// 416 | extern __unsafeIntrinsic void __pushV(vector3 value); 417 | 418 | /// Pushes a struct on the stack. 419 | /// The struct to be pushed. 420 | /// 421 | extern __unsafeIntrinsic void __pushStruct(void* structure); 422 | 423 | /// Pops a struct off the stack. 424 | /// The struct to be poped. 425 | /// 426 | extern __unsafeIntrinsic void __popStruct(void* structure); 427 | 428 | /// Reverses items on the stack. 429 | /// The amount of items to be reversed.This value must be an integer literal. 430 | /// 431 | extern __unsafeIntrinsic void __rev(const int numItems); 432 | 433 | /// Exchanges two same sized structs on the stack. 434 | /// The size of the struct.This value must be an integer literal. 435 | /// 436 | extern __unsafeIntrinsic void __exch(const int structStackSize); 437 | 438 | /// Gets the top item on the stack as a int. 439 | /// The top item on the stack as a int. 440 | extern __unsafeIntrinsic int __popI(); 441 | 442 | /// Gets the top item on the stack as a float. 443 | /// The top item on the stack as a float. 444 | extern __unsafeIntrinsic float __popF(); 445 | 446 | /// Gets the top 3 items on the stack as a vector3. 447 | /// The top 3 items on the stack as a vector3. 448 | extern __unsafeIntrinsic vector3 __popV(); 449 | 450 | /// Pushes an amount of items from the specified pointer to the stack. 451 | /// The pointer to draw from. 452 | /// The amount of items to push to the stack. 453 | /// 454 | extern __unsafeIntrinsic void __ptrToStack(const void* address, int count); 455 | 456 | /// Pops an amount of items from the stack to the specified pointer. 457 | /// The pointer to place the items. 458 | /// The amount of items to pop from the stack. 459 | /// 460 | extern __unsafeIntrinsic void __ptrFromStack(const void* address, int count); 461 | #pragma endregion //} 462 | 463 | #pragma region ASM //{ 464 | /************************************************************************* 465 | * These perform an operation on the item(or vector) on top of the stack 466 | * This can lead to dangerous behaviour if you aren't sure what is currently on the stack 467 | *************************************************************************/ 468 | 469 | /// 470 | /// Adds specified amount of nops to the script in the interval [0,4096]. 471 | /// Note: GTAIV nops exit the script. 472 | /// 473 | /// The amount of nops to add.This value must be an integer literal. 474 | /// 475 | extern __intrinsic void __nop(const uint count); 476 | /// 477 | /// Pops two items off the stack. (signed int32, signed int32) 478 | /// Performs {(Stack.Top - 1) + Stack.Top} as a signed int32. 479 | /// Pushes one item on the stack. 480 | /// 481 | extern __unsafeIntrinsic void __add(); 482 | /// 483 | /// Pops two items off the stack. (signed int32, signed int32) 484 | /// Performs {(Stack.Top - 1) - Stack.Top} as a signed int32. 485 | /// Pushes one item on the stack. 486 | /// 487 | extern __unsafeIntrinsic void __sub(); 488 | /// 489 | /// Pops two items off the stack. (signed int32, signed int32) 490 | /// Performs {(Stack.Top - 1) * Stack.Top} as a signed int32. 491 | /// Pushes one item on the stack. 492 | /// 493 | extern __unsafeIntrinsic void __mult(); 494 | /// 495 | /// Pops two items off the stack. (signed int32, signed int32) 496 | /// Performs {(Stack.Top - 1) / Stack.Top} as a signed int32. 497 | /// Pushes one item on the stack. 498 | /// 499 | extern __unsafeIntrinsic void __div(); 500 | /// 501 | /// Pops two items off the stack. (signed int32, signed int32) 502 | /// Performs {(Stack.Top - 1) % Stack.Top} as a signed int32. 503 | /// Pushes one item on the stack. 504 | /// 505 | extern __unsafeIntrinsic void __mod(); 506 | /// 507 | /// Pops one item off the stack. (signed int32) 508 | /// Performs {!Stack.Top} as a signed int32. 509 | /// Pushes one item on the stack. 510 | /// 511 | extern __unsafeIntrinsic void __not(); 512 | /// 513 | /// Pops one item off the stack. (signed int32) 514 | /// Performs {-Stack.Top} as a signed int32. 515 | /// Pushes one item on the stack. 516 | /// 517 | extern __unsafeIntrinsic void __neg(); 518 | /// 519 | /// Pops two items off the stack. (signed int32, signed int32) 520 | /// Performs {(Stack.Top - 1) == Stack.Top} as a signed int32. 521 | /// Pushes one item on the stack. 522 | /// 523 | extern __unsafeIntrinsic void __cmpEq(); 524 | /// 525 | /// Pops two items off the stack. (signed int32, signed int32) 526 | /// Performs {(Stack.Top - 1) != Stack.Top} as a signed int32. 527 | /// Pushes one item on the stack. 528 | /// 529 | extern __unsafeIntrinsic void __cmpNe(); 530 | /// 531 | /// Pops two items off the stack. (signed int32, signed int32) 532 | /// Performs {(Stack.Top - 1) > Stack.Top} as a signed int32. 533 | /// Pushes one item on the stack. 534 | /// 535 | extern __unsafeIntrinsic void __cmpGt(); 536 | /// 537 | /// Pops two items off the stack. (signed int32, signed int32) 538 | /// Performs {(Stack.Top - 1) >= Stack.Top} as a signed int32. 539 | /// Pushes one item on the stack. 540 | /// 541 | extern __unsafeIntrinsic void __cmpGe(); 542 | /// 543 | /// Pops two items off the stack. (signed int32, signed int32) 544 | /// Performs {(Stack.Top - 1) < Stack.Top} as a signed int32. 545 | /// Pushes one item on the stack. 546 | /// 547 | extern __unsafeIntrinsic void __cmpLt(); 548 | /// 549 | /// Pops two items off the stack. (signed int32, signed int32) 550 | /// Performs {(Stack.Top - 1) <= Stack.Top} as a signed int32. 551 | /// Pushes one item on the stack. 552 | /// 553 | extern __unsafeIntrinsic void __cmpLe(); 554 | /// 555 | /// Pops two items off the stack. (float, float) 556 | /// Performs {(Stack.Top - 1) + Stack.Top} as a float. 557 | /// Pushes one item on the stack. 558 | /// 559 | extern __unsafeIntrinsic void __addF(); 560 | /// 561 | /// Pops two items off the stack. (float, float) 562 | /// Performs {(Stack.Top - 1) - Stack.Top} as a float. 563 | /// Pushes one item on the stack. 564 | /// 565 | extern __unsafeIntrinsic void __subF(); 566 | /// 567 | /// Pops two items off the stack. (float, float) 568 | /// Performs {(Stack.Top - 1) * Stack.Top} as a float. 569 | /// Pushes one item on the stack. 570 | /// 571 | extern __unsafeIntrinsic void __multF(); 572 | /// 573 | /// Pops two items off the stack. (float, float) 574 | /// Performs {(Stack.Top - 1) / Stack.Top} as a float. 575 | /// Pushes one item on the stack. 576 | /// 577 | extern __unsafeIntrinsic void __divF(); 578 | /// 579 | /// Pops two items off the stack. (float, float) 580 | /// Performs {(Stack.Top - 1) % Stack.Top} as a float. 581 | /// Pushes one item on the stack. 582 | /// 583 | extern __unsafeIntrinsic void __modF(); 584 | /// 585 | /// Pops one item off the stack. (float) 586 | /// Performs {-Stack.Top} as a float. 587 | /// Pushes one item on the stack. 588 | /// 589 | extern __unsafeIntrinsic void __negF(); 590 | /// 591 | /// Pops two items off the stack. (float, float) 592 | /// Performs {(Stack.Top - 1) == Stack.Top} as a float. 593 | /// Pushes one item on the stack. 594 | /// 595 | extern __unsafeIntrinsic void __cmpEqF(); 596 | /// 597 | /// Pops two items off the stack. (float, float) 598 | /// Performs {(Stack.Top - 1) != Stack.Top} as a float. 599 | /// Pushes one item on the stack. 600 | /// 601 | extern __unsafeIntrinsic void __cmpNeF(); 602 | /// 603 | /// Pops two items off the stack. (float, float) 604 | /// Performs {(Stack.Top - 1) > Stack.Top} as a float. 605 | /// Pushes one item on the stack. 606 | /// 607 | extern __unsafeIntrinsic void __cmpGtF(); 608 | /// 609 | /// Pops two items off the stack. (float, float) 610 | /// Performs {(Stack.Top - 1) >= Stack.Top} as a float. 611 | /// Pushes one item on the stack. 612 | /// 613 | extern __unsafeIntrinsic void __cmpGeF(); 614 | /// 615 | /// Pops two items off the stack. (float, float) 616 | /// Performs {(Stack.Top - 1) < Stack.Top} as a float. 617 | /// Pushes one item on the stack. 618 | /// 619 | extern __unsafeIntrinsic void __cmpLtF(); 620 | /// 621 | /// Pops two items off the stack. (float, float) 622 | /// Performs {(Stack.Top - 1) <= Stack.Top} as a float. 623 | /// Pushes one item on the stack. 624 | /// 625 | extern __unsafeIntrinsic void __cmpLeF(); 626 | /// 627 | /// Pops six items off the stack. (float, float, float, float, float, float) 628 | /// Performs {(Stack.Top - 5) + (Stack.Top - 2)} as a float. 629 | /// Performs {(Stack.Top - 4) + (Stack.Top - 1)} as a float. 630 | /// Performs {(Stack.Top - 3) + Stack.Top} as a float. 631 | /// Pushes three items on the stack. 632 | /// 633 | extern __unsafeIntrinsic void __addV(); 634 | /// 635 | /// Pops six items off the stack. (float, float, float, float, float, float) 636 | /// Performs {(Stack.Top - 5) - (Stack.Top - 2)} as a float. 637 | /// Performs {(Stack.Top - 4) - (Stack.Top - 1)} as a float. 638 | /// Performs {(Stack.Top - 3) - Stack.Top} as a float. 639 | /// Pushes three items on the stack. 640 | /// 641 | extern __unsafeIntrinsic void __subV(); 642 | /// 643 | /// Pops six items off the stack. (float, float, float, float, float, float) 644 | /// Performs {(Stack.Top - 5) * (Stack.Top - 2)} as a float. 645 | /// Performs {(Stack.Top - 4) * (Stack.Top - 1)} as a float. 646 | /// Performs {(Stack.Top - 3) * Stack.Top} as a float. 647 | /// Pushes three items on the stack. 648 | /// 649 | extern __unsafeIntrinsic void __multV(); 650 | /// 651 | /// Pops six items off the stack. (float, float, float, float, float, float) 652 | /// Performs {(Stack.Top - 5) / (Stack.Top - 2)} as a float. 653 | /// Performs {(Stack.Top - 4) / (Stack.Top - 1)} as a float. 654 | /// Performs {(Stack.Top - 3) / Stack.Top} as a float. 655 | /// Pushes three items on the stack. 656 | /// 657 | extern __unsafeIntrinsic void __divV(); 658 | /// 659 | /// Pops three items off the stack. (float, float, float) 660 | /// Performs {-(Stack.Top - 2)} as a float. 661 | /// Performs {-(Stack.Top - 1)} as a float. 662 | /// Performs {-Stack.Top} as a float. 663 | /// Pushes three items on the stack. 664 | /// 665 | extern __unsafeIntrinsic void __negV(); 666 | /// 667 | /// Pops two item off the stack. (signed int32, signed int32) 668 | /// Performs {(Stack.Top - 1) & Stack.Top} as a signed int32. 669 | /// Pushes one item on the stack. 670 | /// 671 | extern __unsafeIntrinsic void __and(); 672 | /// 673 | /// Pops two item off the stack. (signed int32, signed int32) 674 | /// Performs {(Stack.Top - 1) | Stack.Top} as a signed int32. 675 | /// Pushes one item on the stack. 676 | /// 677 | extern __unsafeIntrinsic void __or(); 678 | /// 679 | /// Pops two item off the stack. (signed int32, signed int32) 680 | /// Performs {(Stack.Top - 1) ^ Stack.Top} as a signed int32. 681 | /// Pushes one item on the stack. 682 | /// 683 | extern __unsafeIntrinsic void __xor(); 684 | /// 685 | /// Pops one item off the stack. (signed int32) 686 | /// Performs {(float)Stack.Top} as a signed int32. 687 | /// Pushes one item on the stack. 688 | /// 689 | extern __unsafeIntrinsic void __iToF(); 690 | /// 691 | /// Pops one item off the stack. (float) 692 | /// Performs {(int)Stack.Top} as a float. 693 | /// Pushes one item on the stack. 694 | /// 695 | extern __unsafeIntrinsic void __fToI(); 696 | /// 697 | /// Pops one item off the stack. (float) 698 | /// Pushes three items of value Stack.Top on the stack. 699 | /// 700 | extern __unsafeIntrinsic void __fToV(); 701 | /// Pushes two signed int32 values to the stack. 702 | /// The first value to push to the stack.This value must be an integer literal. 703 | /// The second value to push to the stack.This value must be an integer literal. 704 | extern __unsafeIntrinsic void __push2(const int value0, const int value1); 705 | /// Pushes three signed int32 values to the stack. 706 | /// The first value to push to the stack.This value must be an integer literal. 707 | /// The second value to push to the stack.This value must be an integer literal. 708 | /// The third value to push to the stack.This value must be an integer literal. 709 | extern __unsafeIntrinsic void __push3(const int value0, const int value1, const int value2); 710 | /// Pushes one signed int32 value to the stack. 711 | /// The value to push to the stack.This value must be an integer literal. 712 | extern __unsafeIntrinsic void __push(const int value); 713 | /// Pushes one float value to the stack. 714 | /// The value to push to the stack.This value must be an floating-point literal. 715 | extern __unsafeIntrinsic void __pushF(const float value); 716 | /// Pushes a duplicate of Stack.Top to the stack. 717 | extern __unsafeIntrinsic void __dup(); 718 | /// Pops one item off the stack and discards it. 719 | extern __unsafeIntrinsic void __drop(); 720 | /// 721 | /// Pops the amount of items off the stack that the function takes. 722 | /// Calls a native function. 723 | /// 724 | /// The hash relating to the native.This value must be an integer literal. 725 | /// The param count of the native.This value must be an integer literal. 726 | /// The return count of the native.This value must be an integer literal. 727 | extern __unsafeIntrinsic void __callNative(const uint nativeHash, const uint paramCount, const uint returnCount); 728 | /// 729 | /// Pops the amount of items off the stack that the function takes. 730 | /// Calls a native function. 731 | /// 732 | /// The upper 32 bits of the hash relating to the native.This value must be an integer literal. 733 | /// The lower 32 bits of the hash relating to the native.This value must be an integer literal. 734 | /// The param count of the native.This value must be an integer literal. 735 | /// The return count of the native.This value must be an integer literal. 736 | extern __unsafeIntrinsic void __callNativePc(const uint nativeHash64Part1, const uint nativeHash64Part2, const uint paramCount, const uint returnCount); 737 | /// Returns a function. 738 | /// The param count of the function.This value must be an integer literal. 739 | /// The return count of the function.This value must be an integer literal. 740 | extern __unsafeIntrinsic void __return(const uint paramCount, const uint returnCount); 741 | /// 742 | /// Pops one item off the stack. (void*) 743 | /// Performs {*Stack.Top} as a signed int32. 744 | /// Pushes one item on the stack. 745 | /// 746 | extern __unsafeIntrinsic void __pGet(); 747 | /// 748 | /// Pops two items off the stack. (signed int32, void*) 749 | /// Performs {*Stack.Top = (Stack.Top - 1)} as a signed int32. 750 | /// 751 | extern __unsafeIntrinsic void __pSet(); 752 | /// 753 | /// Pops two items off the stack. (void*, signed int32) 754 | /// Performs {*(Stack.Top - 1) = Stack.Top} as a signed int32. 755 | /// Pushes Stack.Top on the stack. 756 | /// 757 | extern __unsafeIntrinsic void __pPeekSet(); 758 | /// 759 | /// Pops two items off the stack. (signed int32, void*) 760 | /// Pushes items at the pointer Stack.Top for (Stack.Top - 1) on the stack. 761 | /// 762 | extern __unsafeIntrinsic void __toStack(); 763 | /// 764 | /// Pops two items off the stack. (signed int32, void*) 765 | /// Pops off items from the stack for (Stack.Top - 1) into the pointer Stack.Top. 766 | /// 767 | extern __unsafeIntrinsic void __fromStack(); 768 | /// 769 | /// Pops two items off the stack. (signed int32, void*) 770 | /// Performs {&Stack.Top[(Stack.Top - 1)]}.> 771 | /// 772 | /// The array item stack size.This value must be an integer literal. 773 | extern __unsafeIntrinsic void __getArrayP(const uint arraySize); 774 | /// 775 | /// Pops two items off the stack. (signed int32, void*) 776 | /// Performs {Stack.Top[(Stack.Top - 1)]}. 777 | /// Pushes one item on the stack. 778 | /// 779 | /// The array item stack size.This value must be an integer literal. 780 | extern __unsafeIntrinsic void __getArray(const uint arraySize); 781 | /// 782 | /// Pops two items off the stack. (signed int32, void*) 783 | /// Performs {&Stack.Top[(Stack.Top - 1)] = (Stack.Top - 2)}. 784 | /// 785 | /// The array item stack size.This value must be an integer literal. 786 | extern __unsafeIntrinsic void __setArray(const uint arraySize); 787 | /// 788 | /// Gets a local functon frame pointer by an index. 789 | /// Pushes the frame pointer on the stack. 790 | /// 791 | /// The index to get the frame at.This value must be an integer literal. 792 | extern __unsafeIntrinsic void __getFrameP(const uint frameIndex); 793 | /// 794 | /// Gets a local functon frame pointer by it's name. 795 | /// Pushes the frame pointer on the stack. 796 | /// 797 | /// The name of the local function frame.This value must be an string literal. 798 | extern __unsafeIntrinsic void __getNamedFrameP(const char* frameName); 799 | /// 800 | /// Gets a local functon frame by an index. 801 | /// Pushes the frame on the stack. 802 | /// 803 | /// The index to get the frame at.This value must be an integer literal. 804 | extern __unsafeIntrinsic void __getFrame(const uint frameIndex); 805 | /// 806 | /// Gets a local functon frame by it's name. 807 | /// Pushes the frame on the stack. 808 | /// 809 | /// The name of the local function frame.This value must be an string literal. 810 | extern __unsafeIntrinsic void __getNamedFrame(const char* frameName); 811 | /// 812 | /// Pops one item off the stack. (signed int32) 813 | /// Sets a local functon frame by an index. 814 | /// 815 | /// The index to set the frame at.This value must be an integer literal. 816 | extern __unsafeIntrinsic void __setFrame(const uint frameIndex); 817 | /// 818 | /// Pops one item off the stack. (signed int32) 819 | /// Sets a local functon frame by it's name. 820 | /// 821 | /// The name of the local function frame.This value must be an string literal. 822 | extern __unsafeIntrinsic void __setNamedFrame(const char* frameName); 823 | /// 824 | /// Gets a static var pointer by an index. 825 | /// Pushes the static var pointer on the stack. 826 | /// 827 | /// The index to get the static at.This value must be an integer literal. 828 | extern __unsafeIntrinsic void __getStaticP(const uint staticIndex); 829 | /// 830 | /// Gets a static var pointer by it's name. 831 | /// Pushes the static var pointer on the stack. 832 | /// 833 | /// The name of the static var.This value must be an string literal. 834 | extern __unsafeIntrinsic void __getNamedStaticP(const char* StaticName); 835 | /// 836 | /// Gets a static var by an index. 837 | /// Pushes the static var on the stack. 838 | /// 839 | /// The index to get the static at.This value must be an integer literal. 840 | extern __unsafeIntrinsic void __getStatic(const uint staticIndex); 841 | /// 842 | /// Gets a static var by it's name. 843 | /// Pushes the static var on the stack. 844 | /// 845 | /// The name of the static var.This value must be an string literal. 846 | extern __unsafeIntrinsic void __getNamedStatic(const char* StaticName); 847 | /// 848 | /// Pops one item off the stack. (signed int32) 849 | /// Sets a static var by an index. 850 | /// 851 | /// The index to set the static at.This value must be an integer literal. 852 | extern __unsafeIntrinsic void __setStatic(const uint staticIndex); 853 | /// 854 | /// Pops one item off the stack. (signed int32) 855 | /// Sets a static var by it's name. 856 | /// 857 | /// The name of the static var.This value must be an string literal. 858 | extern __unsafeIntrinsic void __setNamedStatic(const char* StaticName); 859 | /// 860 | /// Pops one item off the stack. (signed int32) 861 | /// Performs {Stack.Top + value} as a signed int32. 862 | /// Pushes one item on the stack. 863 | /// 864 | /// Right hand side of the math operation.This value must be an integer literal. 865 | extern __unsafeIntrinsic void __addImm(const uint value); 866 | /// 867 | /// Pops one item off the stack. (signed int32) 868 | /// Performs {Stack.Top * value} as a signed int32. 869 | /// Pushes one item on the stack. 870 | /// 871 | /// Right hand side of the math operation.This value must be an integer literal. 872 | extern __unsafeIntrinsic void __multImm(const uint value); 873 | /// 874 | /// Pops one item off the stack. (void*) 875 | /// Performs {Stack.Top + immediate * 4} as a signed int32. 876 | /// Pushes one item on the stack. 877 | /// 878 | /// The immediate value of a pointer.This value must be an integer literal. 879 | extern __unsafeIntrinsic void __getImmP(const uint immediate); 880 | /// 881 | /// Pops one item off the stack. (void*) 882 | /// Performs {*(Stack.Top + immediate * 4)} as a signed int32. 883 | /// Pushes one item on the stack. 884 | /// 885 | /// The immediate value of a pointer.This value must be an integer literal. 886 | extern __unsafeIntrinsic void __getImm(const uint immediate); 887 | /// 888 | /// Pops one item off the stack. (signed int32, void*) 889 | /// Performs {*(Stack.Top + immediate * 4) = (Stack.Top - 1)} as a signed int32. 890 | /// 891 | /// The immediate value of a pointer.This value must be an integer literal. 892 | extern __unsafeIntrinsic void __setImm(const uint immediate); 893 | /// 894 | /// Gets a global var pointer by an index. 895 | /// Pushes the global var pointer on the stack. 896 | /// 897 | /// The index to get the global at.This value must be an integer literal. 898 | extern __unsafeIntrinsic void __getGlobalP(const uint globalIndex); 899 | /// 900 | /// Gets a global var by an index. 901 | /// Pushes the global var on the stack. 902 | /// 903 | /// The index to get the global at.This value must be an integer literal. 904 | extern __unsafeIntrinsic void __getGlobal(const uint globalIndex); 905 | /// 906 | /// Pops one item off the stack. (signed int32) 907 | /// Sets a global var by an index. 908 | /// 909 | /// The index to set the global at.This value must be an integer literal. 910 | extern __unsafeIntrinsic void __setGlobal(const uint globalIndex); 911 | /// 912 | /// Pops one item off the stack. (signed int32) 913 | /// Switchs on Stack.Top to the case. 914 | /// This function must have a label for every case. 915 | /// 916 | /// The case of the switch.This value must be an integer literal. 917 | /// The label of the switch to jump to if Stack.Top == Case.This value must be an string literal. 918 | extern __unsafeIntrinsic void __switch(const int Case, const char* label, ...); 919 | /// 920 | /// Performs {goto label;}. 921 | /// 922 | /// The label to jump to.This value must be an string literal. 923 | extern __unsafeIntrinsic void __jump(const char* label); 924 | /// 925 | /// Pops one item off the stack. (signed int32) 926 | /// Performs {if(Stack.Top) goto label;}. 927 | /// 928 | /// The label to jump to.This value must be an string literal. 929 | extern __unsafeIntrinsic void __jumpFalse(const char* label); 930 | /// 931 | /// Pops two items off the stack. (signed int32, signed int32) 932 | /// Performs {if((Stack.Top - 1) != Stack.Top) goto label;}. 933 | /// 934 | /// The label to jump to.This value must be an string literal. 935 | extern __unsafeIntrinsic void __jumpNE(const char* label); 936 | /// 937 | /// Pops two items off the stack. (signed int32, signed int32) 938 | /// Performs {if((Stack.Top - 1) == Stack.Top) goto label;}. 939 | /// 940 | /// The label to jump to.This value must be an string literal. 941 | extern __unsafeIntrinsic void __jumpEQ(const char* label); 942 | /// 943 | /// Pops two items off the stack. (signed int32, signed int32) 944 | /// Performs {if((Stack.Top - 1) <= Stack.Top) goto label;}. 945 | /// 946 | /// The label to jump to.This value must be an string literal. 947 | extern __unsafeIntrinsic void __jumpLE(const char* label); 948 | /// 949 | /// Pops two items off the stack. (signed int32, signed int32) 950 | /// Performs {if((Stack.Top - 1) < Stack.Top) goto label;}. 951 | /// 952 | /// The label to jump to.This value must be an string literal. 953 | extern __unsafeIntrinsic void __jumpLT(const char* label); 954 | /// 955 | /// Pops two items off the stack. (signed int32, signed int32) 956 | /// Performs {if((Stack.Top - 1) >= Stack.Top) goto label;}. 957 | /// 958 | /// The label to jump to.This value must be an string literal. 959 | extern __unsafeIntrinsic void __jumpGE(const char* label); 960 | /// 961 | /// Pops two items off the stack. (signed int32, signed int32) 962 | /// Performs {if((Stack.Top - 1) > Stack.Top) goto label;}. 963 | /// 964 | /// The label to jump to.This value must be an string literal. 965 | extern __unsafeIntrinsic void __jumpGT(const char* label); 966 | /// 967 | /// Pops the amount of items off the stack that the function takes. 968 | /// Calls a function. 969 | /// 970 | /// The name of the function to call.This value must be an string literal. 971 | extern __unsafeIntrinsic void __call(const char* functionName); 972 | /// Pushes one char* to the stack. 973 | /// The string that will be referenced by the pointer.This value must be an string literal. 974 | extern __unsafeIntrinsic void __pushString(const char* value); 975 | /// 976 | /// Pops one item off the stack. (char*) 977 | /// Performs {joaat(Stack.Top);}. 978 | /// Pushes one item on the stack. 979 | /// 980 | extern __unsafeIntrinsic void __getHash(); 981 | /// 982 | /// Pops two items off the stack. (char*, char*) 983 | /// Copies (Stack.Top - 1) into Stack.Top for strLen bytes or until a 0 was hit in (Stack.Top - 1). 984 | /// 985 | /// The length of the string destination buffer.This value must be an integer literal. 986 | extern __unsafeIntrinsic void __strCopy(const uint strLen); 987 | /// 988 | /// Pops two items off the stack. (signed int32, char*) 989 | /// Copies the string representation of (Stack.Top - 1) into Stack.Top for strLen bytes or until a 0 was hit in (Stack.Top - 1). 990 | /// 991 | /// The length of the string destination buffer.This value must be an integer literal. 992 | extern __unsafeIntrinsic void __iToS(const uint strLen); 993 | /// 994 | /// Pops two items off the stack. (char*, char*) 995 | /// Appends (Stack.Top - 1) into Stack.Top for strLen bytes or until a 0 was hit in (Stack.Top - 1). 996 | /// 997 | /// The length of the string destination buffer.This value must be an integer literal. 998 | extern __unsafeIntrinsic void __strAdd(const uint strLen); 999 | /// 1000 | /// Pops two items off the stack. (signed int32, char*) 1001 | /// appends the string representation of (Stack.Top - 1) into Stack.Top for strLen bytes or until a 0 was hit in (Stack.Top - 1). 1002 | /// 1003 | /// The length of the string destination buffer.This value must be an integer literal. 1004 | extern __unsafeIntrinsic void __strAddI(const uint strLen); 1005 | /// 1006 | /// Pops three items off the stack. (signed int32, signed int32, void*) 1007 | /// Pops off items from the stack for {(Stack.Top - 2) * (Stack.Top - 1) / 4} into the pointer Stack.Top. 1008 | /// 1009 | extern __unsafeIntrinsic void __memCopy(); 1010 | /// 1011 | /// Pops one item off the stack. (void*) then pops the amount of items off the stack that the function takes. 1012 | /// Calls the function at the pointer Stack.Top. 1013 | /// 1014 | extern __unsafeIntrinsic void __pCall(); 1015 | #pragma endregion //} 1016 | 1017 | #undef __intrinsic 1018 | #undef __unsafeIntrinsic 1019 | 1020 | /// Creates a array with the first item as the size. 1021 | /// The type of array to create. 1022 | /// The name of the array to create. 1023 | /// The size of the array to create. 1024 | #define CreateSizedArray(type, name, sizein, ...)\ 1025 | struct SizedArray\ 1026 | {\ 1027 | unsigned int size;\ 1028 | type items[sizein];\ 1029 | } name = {.size = sizein, .items = {__VA_ARGS__}} 1030 | 1031 | /// Gets the size of the sized array. 1032 | /// The pointer to the sized array. 1033 | #define GetSizedArraySize(sizedarr) (*(unsigned int*)sizedarr) 1034 | 1035 | /// Gets an item of the sized array. 1036 | /// The pointer to the sized array. 1037 | /// The type of the sized array. 1038 | /// The index of the sized array item. 1039 | #define GetSizedArrayItem(sizedarr, type, index) (*(type*)((int*)sizedarr + 1 + index)) 1040 | 1041 | /// Converts an array to a sized array. 1042 | /// The pointer to the array. 1043 | /// The pointer to the sized array. 1044 | #define ArrayToSizedArray(arr, sizedarr)\ 1045 | if(sizeof(arr) == sizeof(sizedarr.items))\ 1046 | memcpy(sizedarr.items, arr, countof(arr)); 1047 | 1048 | /// Converts an sized array to a array. 1049 | /// The pointer to the sized array. 1050 | /// The pointer to the array. 1051 | #define SizedArrayToArray(sizedarr, arr)\ 1052 | if(sizeof(arr) == sizeof(sizedarr.items))\ 1053 | memcpy(arr, sizedarr.items, countof(sizedarr.items)); 1054 | 1055 | -------------------------------------------------------------------------------- /include/natives.h: -------------------------------------------------------------------------------- 1 | /*H********************************************************************** 2 | * FILENAME : natives.h START DATE : 10 Sept 16 3 | * 4 | * DESCRIPTION : 5 | * native.h file controller based on your current target and platform. 6 | * 7 | * NOTES : 8 | * This file is part of SC-CL's include library. 9 | * 10 | * LICENSE : 11 | * 12 | * Copyright 2016 SC-CL 13 | * 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions are met: 16 | * 17 | * * Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * 20 | * * Redistributions in binary form must reproduce the above copyright 21 | * notice, this list of conditions and the following disclaimer in the 22 | * documentation and/or other materials provided with the distribution. 23 | * 24 | * * Neither SC-CL nor its contributors may be used to endorse or promote products 25 | * derived from this software without specific prior written permission. 26 | * 27 | * * Redistribution of this software in source or binary forms shall be free 28 | * of all charges or fees to the recipient of this software. 29 | * 30 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 31 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 32 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 33 | * DISCLAIMED. IN NO EVENT SHALL SC-CL BE LIABLE FOR ANY 34 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 35 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 36 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 37 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 39 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | * 41 | * AUTHORS : 42 | * Rocko Tompkins 43 | * Nathan James 44 | *H*/ 45 | #pragma once 46 | 47 | #if TARGET == TARGET_RDR 48 | 49 | #include "RDR/natives32.h" 50 | 51 | #elif TARGET == TARGET_GTAV 52 | 53 | #if PTRWIDTH == 64 54 | #include "GTAV/natives64.h" 55 | #else 56 | #include "GTAV/natives32.h" 57 | #endif 58 | 59 | #elif TARGET == TARGET_GTAIV 60 | 61 | #if PLATFORM == PLATFORM_PC 62 | #include "GTAIV/natives32.h"//1.0.7.0 63 | #else 64 | #include "GTAIV/natives32Old.h"//1.0.4.0 65 | #endif 66 | 67 | #endif -------------------------------------------------------------------------------- /include/types.h: -------------------------------------------------------------------------------- 1 | /*H********************************************************************** 2 | * FILENAME : types.h START DATE : 10 Sept 16 3 | * 4 | * DESCRIPTION : 5 | * Types to be used with all targets and platforms of SC-CL. 6 | * 7 | * NOTES : 8 | * This file is part of SC-CL's include library. 9 | * 10 | * LICENSE : 11 | * 12 | * Copyright 2016 SC-CL 13 | * 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions are met: 16 | * 17 | * * Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * 20 | * * Redistributions in binary form must reproduce the above copyright 21 | * notice, this list of conditions and the following disclaimer in the 22 | * documentation and/or other materials provided with the distribution. 23 | * 24 | * * Neither SC-CL nor its contributors may be used to endorse or promote products 25 | * derived from this software without specific prior written permission. 26 | * 27 | * * Redistribution of this software in source or binary forms shall be free 28 | * of all charges or fees to the recipient of this software. 29 | * 30 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 31 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 32 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 33 | * DISCLAIMED. IN NO EVENT SHALL SC-CL BE LIABLE FOR ANY 34 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 35 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 36 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 37 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 39 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | * 41 | * AUTHORS : 42 | * Rocko Tompkins 43 | * Nathan James 44 | *H*/ 45 | #pragma once 46 | 47 | #ifndef _MSC_VER 48 | #define global(index) __attribute((scriptglobal(index))) 49 | #define noinline __attribute((noinline)) 50 | #define unsafe __attribute((unsafe)) 51 | #else 52 | #define _Generic(x) 0 53 | #define global(index) 54 | #define noinline 55 | #define unsafe 56 | #endif 57 | 58 | #if PLATFORM == PLATFORM_PC && TARGET == TARGET_GTAV 59 | #define int long long 60 | #define float double 61 | #endif 62 | 63 | //calculation range is -2,147,483,648 to 2,147,483,647 64 | //any value above or below that will be automatically cast to a signed int 65 | typedef unsigned int uint; 66 | typedef unsigned char byte; 67 | typedef unsigned char uchar; 68 | typedef unsigned short ushort; 69 | 70 | //Fix for intellisense nonsense 71 | #ifndef _MSC_VER 72 | typedef _Bool bool; 73 | #else 74 | typedef int bool; 75 | #endif 76 | 77 | typedef int Player; 78 | typedef int Entity; 79 | typedef Entity Ped; 80 | typedef Entity Vehicle; 81 | typedef Entity Object; 82 | typedef uint Hash; 83 | typedef int Cam; 84 | typedef int FireId; 85 | typedef int CarGenerator; 86 | typedef int Group; 87 | typedef int Train; 88 | typedef int Pickup; 89 | typedef int Object; 90 | typedef int Weapon; 91 | typedef int Interior; 92 | typedef int Blip; 93 | typedef int Texture; 94 | typedef int TextureDict; 95 | typedef int CoverPoint; 96 | typedef int Camera; 97 | typedef int TaskSequence; 98 | typedef int ColourIndex; 99 | typedef int Sphere; 100 | typedef int ScrHandle; 101 | typedef int DecisionMaker; 102 | typedef int ScriptAny; 103 | typedef int UnkInt; 104 | typedef int Actor; 105 | typedef int Controller; 106 | typedef int Layout; 107 | typedef int Iterator; 108 | typedef int IterationSet; 109 | typedef int GUIWindow; 110 | typedef float Time; 111 | 112 | typedef struct NetworkHandle 113 | { 114 | int data[13]; 115 | } NetworkHandle; 116 | 117 | typedef union vector2 118 | { 119 | struct { float x, y; }; 120 | struct { float width, height; }; 121 | struct { float w, h; }; 122 | float v[2]; 123 | } Point, Size, vector2; 124 | 125 | //GTA Coord Type = Y Depth 126 | //RDR Coord Type = Z Depth 127 | typedef union vector3 128 | { 129 | struct { float x, y, z; }; 130 | float v[3]; 131 | } vector3; 132 | 133 | typedef union quaternion 134 | { 135 | struct { float x, y, z, w; }; 136 | float v[4]; 137 | } quaternion; 138 | 139 | //Color struct where values range from 0 - 255 140 | typedef union RGBA 141 | { 142 | struct 143 | { 144 | union{int red; int r;}; 145 | union{int green; int g;}; 146 | union{int blue; int b;}; 147 | union{int opacity; int alpha; int a;}; 148 | }; 149 | int col[4]; 150 | } RGBA; 151 | 152 | //Color struct where values range from 0 - 255 153 | typedef union RGB 154 | { 155 | struct 156 | { 157 | union{int red; int r;}; 158 | union{int green; int g;}; 159 | union{int blue; int b;}; 160 | }; 161 | int col[3]; 162 | } RGB; 163 | 164 | //Color struct where values range from 0.0 - 1.0 165 | typedef union FloatRGBA 166 | { 167 | struct 168 | { 169 | union{float red; float r;}; 170 | union{float green; float g;}; 171 | union{float blue; float b;}; 172 | union{float opacity; float alpha; float a;}; 173 | }; 174 | float col[4]; 175 | } FloatRGBA; 176 | 177 | //Color struct where values range from 0.0 - 1.0 178 | typedef union FloatRGB 179 | { 180 | struct 181 | { 182 | union{float red; float r;}; 183 | union{float green; float g;}; 184 | union{float blue; float b;}; 185 | }; 186 | float col[3]; 187 | } FloatRGB; 188 | 189 | typedef union flint 190 | { 191 | int Int; 192 | float Float; 193 | } flint; 194 | 195 | typedef union any 196 | { 197 | int Int; 198 | float Float; 199 | bool Bool; 200 | char* CharP; 201 | byte* ByteP; 202 | int* IntP; 203 | float* FloatP; 204 | short* ShortP; 205 | vector3* Vector3P; 206 | quaternion* QuaternionP; 207 | byte ByteArray[4]; 208 | char CharArray[4]; 209 | short ShortArray[2]; 210 | } any; 211 | 212 | typedef enum DataType 213 | { 214 | DT_None, 215 | DT_UInt, 216 | DT_UIntP, 217 | DT_Int, 218 | DT_IntP, 219 | DT_Float, 220 | DT_FloatP, 221 | DT_Bool, 222 | DT_BoolP, 223 | DT_Char, 224 | DT_CharP, 225 | DT_Short, 226 | DT_ShortP, 227 | DT_UShort, 228 | DT_UShortP, 229 | DT_Vector3, 230 | DT_Vector3P, 231 | DT_Vector2, 232 | DT_Vector2P, 233 | DT_Quaternion, 234 | DT_QuaternionP, 235 | DT_FunctionP 236 | } DataType; 237 | 238 | //poor mans constructors 239 | 240 | /// Constructs a any type. 241 | /// The value you want to store. 242 | /// A any type. 243 | #define any(x) (any){x} 244 | 245 | /// Constructs a RGBA type. 246 | /// The red value to be initialized, in the interval [0,255] 247 | /// The green value to be initialized, in the interval [0,255] 248 | /// The blue value to be initialized, in the interval [0,255] 249 | /// The alpha value to be initialized, in the interval [0,255] 250 | /// A RGBA type. 251 | #define RGBA(R, G, B, A) (RGBA){R, G, B, A} 252 | 253 | /// Constructs a RGB type. 254 | /// The red value to be initialized, in the interval [0,255] 255 | /// The green value to be initialized, in the interval [0,255] 256 | /// The blue value to be initialized, in the interval [0,255] 257 | /// A RGB type. 258 | #define RGB(R, G, B) (RGB){R, G, B} 259 | 260 | /// Constructs a FloatRGBA type. 261 | /// The red value to be initialized, in the interval [0.0,1.0] 262 | /// The green value to be initialized, in the interval [0.0,1.0] 263 | /// The blue value to be initialized, in the interval [0.0,1.0] 264 | /// The alpha value to be initialized, in the interval [0.0,1.0] 265 | /// A FloatRGBA type. 266 | #define FloatRGBA(R, G, B, A) (FloatRGBA){R, G, B, A} 267 | 268 | /// Constructs a FloatRGB type. 269 | /// The red value to be initialized, in the interval [0.0,1.0] 270 | /// The green value to be initialized, in the interval [0.0,1.0] 271 | /// The blue value to be initialized, in the interval [0.0,1.0] 272 | /// A FloatRGB type. 273 | #define FloatRGB(R, G, B) (FloatRGB){R, G, B} 274 | 275 | /// Constructs a vector2 Point type. 276 | /// The x axis to be initialized. 277 | /// The y axis to be initialized. 278 | /// A Point type. 279 | #define Point(x, y) (Point){x, y} 280 | 281 | /// Constructs a vector2 Size type. 282 | /// The width to be initialized. 283 | /// The height to be initialized. 284 | /// A Size type. 285 | #define Size(w, h) (Size){w, h} 286 | 287 | /// Constructs a vector2 type. 288 | /// The x axis to be initialized. 289 | /// The y axis to be initialized. 290 | /// A vector2 type. 291 | #define vector2(x, y) (vector2){x, y} 292 | 293 | /// Constructs a vector3 type. 294 | /// The x axis to be initialized. 295 | /// The y axis to be initialized. 296 | /// The z axis to be initialized. 297 | /// A vector3 type. 298 | #define vector3(x, y, z) (vector3){x, y, z} 299 | 300 | /// Constructs a quaternion type. 301 | /// X component of the quaternion. 302 | /// Y component of the quaternion. 303 | /// Z component of the quaternion. 304 | /// W component of the quaternion. 305 | /// A quaternion type. 306 | #define quaternion(x, y, z, w) (quaternion){x, y, z, w} 307 | 308 | typedef void* SizedArray; 309 | 310 | -------------------------------------------------------------------------------- /include/varargs.h: -------------------------------------------------------------------------------- 1 | /*H********************************************************************** 2 | * FILENAME : varargs.h START DATE : 10 Sept 16 3 | * 4 | * DESCRIPTION : 5 | * Provides facilities for stepping through a list of function arguments of 6 | * an unknown number and type. 7 | * 8 | * NOTES : 9 | * This file is part of SC-CL's include library. 10 | * 11 | * The type used in va_arg is supposed to match the actual type 12 | * after default promotions. Thus, va_arg (..., short) is not valid. 13 | * 14 | * LICENSE : 15 | * 16 | * Copyright 2016 SC-CL 17 | * 18 | * Redistribution and use in source and binary forms, with or without 19 | * modification, are permitted provided that the following conditions are met: 20 | * 21 | * * Redistributions of source code must retain the above copyright 22 | * notice, this list of conditions and the following disclaimer. 23 | * 24 | * * Redistributions in binary form must reproduce the above copyright 25 | * notice, this list of conditions and the following disclaimer in the 26 | * documentation and/or other materials provided with the distribution. 27 | * 28 | * * Neither SC-CL nor its contributors may be used to endorse or promote products 29 | * derived from this software without specific prior written permission. 30 | * 31 | * * Redistribution of this software in source or binary forms shall be free 32 | * of all charges or fees to the recipient of this software. 33 | * 34 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 35 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 36 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 37 | * DISCLAIMED. IN NO EVENT SHALL SC-CL BE LIABLE FOR ANY 38 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 39 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 40 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 41 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 42 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 43 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 44 | * 45 | * AUTHORS : 46 | * Rocko Tompkins 47 | * Nathan James 48 | *H*/ 49 | #pragma once 50 | 51 | #ifndef _VA_LIST 52 | #define _VA_LIST 53 | typedef int* va_list; 54 | #endif 55 | 56 | /// 57 | /// Amount of space required in an argument list (ie. the stack) for an 58 | /// argument of type t. 59 | /// 60 | /// The type to be evaluated. 61 | /// 62 | #define __va_argsiz(t) \ 63 | (((sizeof(t) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) 64 | 65 | /// 66 | /// Start variable argument list processing by setting AP to point to the 67 | /// argument after pN. 68 | /// 69 | /// 70 | /// Uninitialized object of type va_list. 71 | /// After the call, it carries the information needed to retrieve the additional arguments using va_arg. 72 | /// If ap has already been passed as first argument to a previous call to va_start or va_copy, it shall be passed to va_end before calling this function. 73 | /// 74 | /// 75 | /// Name of the last named parameter in the function definition. 76 | /// The arguments extracted by subsequent calls to va_arg are those after pN. 77 | /// 78 | /// 79 | #define va_start(ap, pN) \ 80 | ((ap) = (va_list)*(va_list)((char*)(&pN) + __va_argsiz(pN))) 81 | 82 | /// 83 | /// Increment ap to the next argument in the list while returing a 84 | /// pointer to what ap pointed to first, which is of type t. 85 | /// 86 | /// 87 | /// Object of type va_list carrying information about the current retrieval state of a variable argument list. 88 | /// This object shall have been initialized by an initial call to va_start or va_copy and not have been released with va_end. 89 | /// 90 | /// 91 | /// A type name.This type name is used as the type of the expression this macro expands to(i.e., its return type). 92 | /// For a type expression to be suitable for its use with va_arg, it must be such that type* produces a pointer to type. 93 | /// The type shall be compatible with type of the extracted argument(as promoted according to the default argument promotions), 94 | /// or one be the unsigned version of the other, or one be a void pointer and the other some other pointer type. 95 | /// 96 | /// 97 | #define va_arg(ap, t) \ 98 | (((ap) = (va_list)((char*)(ap) + __va_argsiz(t))), \ 99 | *((t*)((char*)(ap) - __va_argsiz(t)))) 100 | 101 | /// 102 | /// Initializes dest as a copy of src (in its current state) 103 | /// 104 | /// 105 | /// Uninitialized object of type va_list. 106 | /// After the call, it carries the information needed to retrieve the same additional arguments as src. 107 | /// If dest has already been passed as first argument to a previous call to va_start or va_copy, it shall be passed to va_end before calling this function. 108 | /// 109 | /// 110 | /// Object of type va_list that already carries information to retrieve additional arguments with va_arg 111 | /// (i.e., it has already been passed as first argument to va_start or va_copy ans has not yet been released with va_end). 112 | /// 113 | /// 114 | #define va_copy(dest, src) ((dest) = (src)) 115 | 116 | /// 117 | /// End processing of variable argument list. In this case we do nothing. 118 | /// 119 | /// 120 | /// Object of type va_list carrying information about the current retrieval state of a variable argument list. 121 | /// This object shall have been initialized by an initial call to va_start or va_copy and not have been released with va_end. 122 | /// 123 | /// 124 | #define va_end(ap) ((void)0) 125 | 126 | /// 127 | /// Gets the variable argument param count from the last argument pN 128 | /// 129 | /// 130 | /// Name of the last named parameter in the function definition. 131 | /// 132 | /// 133 | #define va_count(pN) \ 134 | (*(int*)((char*)(&pN) + __va_argsiz(pN) + sizeof(va_list))) 135 | 136 | /// 137 | /// Gets the variable argument stack count from the last argument pN 138 | /// 139 | /// 140 | /// Name of the last named parameter in the function definition. 141 | /// 142 | /// 143 | #define va_scount(pN) \ 144 | (*(int*)((char*)(&pN) + __va_argsiz(pN) + sizeof(va_list) + sizeof(int))) 145 | 146 | #define __OL_N(number) number, impossible, number 147 | #define __OL_S 1, 0, 1, 148 | #define __OL_CIP(...) , 149 | #define __OL_LP ( 150 | #define __OL_EX(...) __VA_ARGS__ 151 | #define __OL_CH(...) __OL_EX(__OL_LOG __OL_LP __VA_ARGS__ __OL_CIP __VA_ARGS__ __OL_CIP __VA_ARGS__ (), \ 152 | __OL_N(20), __OL_N(19), __OL_N(18), __OL_N(17), __OL_N(16), __OL_N(15), __OL_N(14), __OL_N(13), __OL_N(12), __OL_N(11), __OL_N(10), \ 153 | __OL_N(9), __OL_N(8), __OL_N(7), __OL_N(6), __OL_N(5), __OL_N(4), __OL_N(3), __OL_N(2), __OL_S )) 154 | #define __OL_LOG( \ 155 | arg1, arg1_0, arg1_1, \ 156 | arg2, arg2_0, arg2_1, \ 157 | arg3, arg3_0, arg3_1, \ 158 | arg4, arg4_0, arg4_1, \ 159 | arg5, arg5_0, arg5_1, \ 160 | arg6, arg6_0, arg6_1, \ 161 | arg7, arg7_0, arg7_1, \ 162 | arg8, arg8_0, arg8_1, \ 163 | arg9, arg9_0, arg9_1, \ 164 | arg10, arg10_0, arg10_1, \ 165 | arg11, arg11_0, arg11_1, \ 166 | arg12, arg12_0, arg12_1, \ 167 | arg13, arg13_0, arg13_1, \ 168 | arg14, arg14_0, arg14_1, \ 169 | arg15, arg15_0, arg15_1, \ 170 | arg16, arg16_0, arg16_1, \ 171 | arg17, arg17_0, arg17_1, \ 172 | arg18, arg18_0, arg18_1, \ 173 | arg19, arg19_0, arg19_1, \ 174 | arg20, arg20_0, arg20_1, \ 175 | arg, ...) arg 176 | 177 | #define _OVERLOAD_(name, n) name##n 178 | #define _OVERLOAD(name, n) _OVERLOAD_(name, n) 179 | #define OVERLOAD(func, ...) _OVERLOAD(func, __OL_CH(__VA_ARGS__)) (__VA_ARGS__) 180 | 181 | 182 | -------------------------------------------------------------------------------- /projects/Create SC-CL Project.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NativeFunction/SC-CL-SampleProject/58e59fd5f03ece9582e4654470e98c31abd5f45c/projects/Create SC-CL Project.exe -------------------------------------------------------------------------------- /projects/example/compile project.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | cd %~dp0 3 | :start 4 | echo SC-CL example.c 5 | echo Press ENTER to launch 6 | pause > nul 7 | cls 8 | "../../bin/SC-CL.exe" -platform=X360 -target=GTAV -out-dir="GTAV/X360/bin/" -vcx="example.vcxproj" -- -I "../../include/" 9 | goto start 10 | -------------------------------------------------------------------------------- /projects/example/compile.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | cd %~dp0 3 | :start 4 | echo SC-CL example.c 5 | echo Press ENTER to launch 6 | pause > nul 7 | cls 8 | "../../bin/SC-CL.exe" -platform=X360 -target=GTAV -out-dir="GTAV/X360/bin/" example.c ../../include/common.c -- -I "../../include/" 9 | goto start 10 | -------------------------------------------------------------------------------- /projects/example/example.c: -------------------------------------------------------------------------------- 1 | #include "types.h" 2 | #include "constants.h" 3 | #include "intrinsics.h" 4 | #include "natives.h" 5 | #include "common.h" 6 | 7 | void main() 8 | { 9 | while (true) 10 | { 11 | print("Hello World", 1000); 12 | WAIT(0); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /projects/example/example.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26430.12 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example", "example.vcxproj", "{130629F0-649C-4E82-B00A-590905509FFB}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | GTAIV|Xbox 360 = GTAIV|Xbox 360 11 | GTAIV|Playstation 3 = GTAIV|Playstation 3 12 | GTAIV|PC = GTAIV|PC 13 | GTAIV TLAD|Xbox 360 = GTAIV TLAD|Xbox 360 14 | GTAIV TLAD|Playstation 3 = GTAIV TLAD|Playstation 3 15 | GTAIV TLAD|PC = GTAIV TLAD|PC 16 | GTAIV TBOGT|Xbox 360 = GTAIV TBOGT|Xbox 360 17 | GTAIV TBOGT|Playstation 3 = GTAIV TBOGT|Playstation 3 18 | GTAIV TBOGT|PC = GTAIV TBOGT|PC 19 | RDR SCO|Xbox 360 = RDR SCO|Xbox 360 20 | RDR SCO|Playstation 3 = RDR SCO|Playstation 3 21 | RDR SCO|PC = RDR SCO|PC 22 | RDR _SC|Xbox 360 = RDR _SC|Xbox 360 23 | RDR _SC|Playstation 3 = RDR _SC|Playstation 3 24 | RDR _SC|PC = RDR _SC|PC 25 | GTAV|Xbox 360 = GTAV|Xbox 360 26 | GTAV|Playstation 3 = GTAV|Playstation 3 27 | GTAV|PC = GTAV|PC 28 | EndGlobalSection 29 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 30 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAIV|Xbox 360.ActiveCfg = GTAIV|Win32 31 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAIV|Xbox 360.Build.0 = GTAIV|Win32 32 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAIV|Playstation 3.ActiveCfg = GTAIV|Itanium 33 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAIV|Playstation 3.Build.0 = GTAIV|Itanium 34 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAIV|PC.ActiveCfg = GTAIV|x64 35 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAIV|PC.Build.0 = GTAIV|x64 36 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAIV TLAD|Xbox 360.ActiveCfg = GTAIV TLAD|Win32 37 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAIV TLAD|Xbox 360.Build.0 = GTAIV TLAD|Win32 38 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAIV TLAD|Playstation 3.ActiveCfg = GTAIV TLAD|Itanium 39 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAIV TLAD|Playstation 3.Build.0 = GTAIV TLAD|Itanium 40 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAIV TLAD|PC.ActiveCfg = GTAIV TLAD|x64 41 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAIV TLAD|PC.Build.0 = GTAIV TLAD|x64 42 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAIV TBOGT|Xbox 360.ActiveCfg = GTAIV TBOGT|Win32 43 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAIV TBOGT|Xbox 360.Build.0 = GTAIV TBOGT|Win32 44 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAIV TBOGT|Playstation 3.ActiveCfg = GTAIV TBOGT|Itanium 45 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAIV TBOGT|Playstation 3.Build.0 = GTAIV TBOGT|Itanium 46 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAIV TBOGT|PC.ActiveCfg = GTAIV TBOGT|x64 47 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAIV TBOGT|PC.Build.0 = GTAIV TBOGT|x64 48 | {130629F0-649C-4E82-B00A-590905509FFB}.RDR SCO|Xbox 360.ActiveCfg = RDR SCO|Win32 49 | {130629F0-649C-4E82-B00A-590905509FFB}.RDR SCO|Xbox 360.Build.0 = RDR SCO|Win32 50 | {130629F0-649C-4E82-B00A-590905509FFB}.RDR SCO|Playstation 3.ActiveCfg = RDR SCO|Itanium 51 | {130629F0-649C-4E82-B00A-590905509FFB}.RDR SCO|Playstation 3.Build.0 = RDR SCO|Itanium 52 | {130629F0-649C-4E82-B00A-590905509FFB}.RDR SCO|PC.ActiveCfg = RDR SCO|x64 53 | {130629F0-649C-4E82-B00A-590905509FFB}.RDR _SC|Xbox 360.ActiveCfg = RDR _SC|Win32 54 | {130629F0-649C-4E82-B00A-590905509FFB}.RDR _SC|Xbox 360.Build.0 = RDR _SC|Win32 55 | {130629F0-649C-4E82-B00A-590905509FFB}.RDR _SC|Playstation 3.ActiveCfg = RDR _SC|Itanium 56 | {130629F0-649C-4E82-B00A-590905509FFB}.RDR _SC|Playstation 3.Build.0 = RDR _SC|Itanium 57 | {130629F0-649C-4E82-B00A-590905509FFB}.RDR _SC|PC.ActiveCfg = RDR _SC|x64 58 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAV|Xbox 360.ActiveCfg = GTAV|Win32 59 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAV|Xbox 360.Build.0 = GTAV|Win32 60 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAV|Playstation 3.ActiveCfg = GTAV|Itanium 61 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAV|Playstation 3.Build.0 = GTAV|Itanium 62 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAV|PC.ActiveCfg = GTAV|x64 63 | {130629F0-649C-4E82-B00A-590905509FFB}.GTAV|PC.Build.0 = GTAV|x64 64 | EndGlobalSection 65 | GlobalSection(SolutionProperties) = preSolution 66 | HideSolutionNode = FALSE 67 | EndGlobalSection 68 | EndGlobal 69 | -------------------------------------------------------------------------------- /projects/example/example.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | GTAIV 6 | Itanium 7 | 8 | 9 | GTAIV 10 | Win32 11 | 12 | 13 | GTAIV 14 | x64 15 | 16 | 17 | GTAIV TLAD 18 | Itanium 19 | 20 | 21 | GTAIV TLAD 22 | Win32 23 | 24 | 25 | GTAIV TLAD 26 | x64 27 | 28 | 29 | GTAIV TBOGT 30 | Itanium 31 | 32 | 33 | GTAIV TBOGT 34 | Win32 35 | 36 | 37 | GTAIV TBOGT 38 | x64 39 | 40 | 41 | RDR SCO 42 | Itanium 43 | 44 | 45 | RDR SCO 46 | Win32 47 | 48 | 49 | RDR SCO 50 | x64 51 | 52 | 53 | RDR _SC 54 | Itanium 55 | 56 | 57 | RDR _SC 58 | Win32 59 | 60 | 61 | RDR _SC 62 | x64 63 | 64 | 65 | GTAV 66 | Itanium 67 | 68 | 69 | GTAV 70 | Win32 71 | 72 | 73 | GTAV 74 | x64 75 | 76 | 77 | 78 | {130629F0-649C-4E82-B00A-590905509FFB} 79 | example 80 | 10.0.14393.0 81 | 82 | 83 | 84 | Utility 85 | false 86 | LLVM-vs2014 87 | true 88 | MultiByte 89 | 90 | 91 | Utility 92 | false 93 | LLVM-vs2014 94 | true 95 | MultiByte 96 | 97 | 98 | Utility 99 | false 100 | LLVM-vs2014 101 | true 102 | MultiByte 103 | 104 | 105 | Utility 106 | false 107 | LLVM-vs2014 108 | true 109 | MultiByte 110 | 111 | 112 | Utility 113 | false 114 | LLVM-vs2014 115 | true 116 | MultiByte 117 | 118 | 119 | Utility 120 | false 121 | LLVM-vs2014 122 | true 123 | MultiByte 124 | 125 | 126 | Utility 127 | false 128 | LLVM-vs2014 129 | true 130 | MultiByte 131 | 132 | 133 | Utility 134 | false 135 | LLVM-vs2014 136 | true 137 | MultiByte 138 | 139 | 140 | Utility 141 | false 142 | LLVM-vs2014 143 | true 144 | MultiByte 145 | 146 | 147 | Utility 148 | false 149 | LLVM-vs2014 150 | true 151 | MultiByte 152 | 153 | 154 | Utility 155 | false 156 | LLVM-vs2014 157 | true 158 | MultiByte 159 | 160 | 161 | Utility 162 | false 163 | LLVM-vs2014 164 | true 165 | MultiByte 166 | 167 | 168 | Utility 169 | false 170 | true 171 | MultiByte 172 | LLVM-vs2014 173 | 174 | 175 | Utility 176 | false 177 | true 178 | MultiByte 179 | LLVM-vs2014 180 | 181 | 182 | Utility 183 | false 184 | true 185 | MultiByte 186 | LLVM-vs2014 187 | 188 | 189 | Utility 190 | false 191 | true 192 | MultiByte 193 | LLVM-vs2014 194 | 195 | 196 | Utility 197 | false 198 | true 199 | MultiByte 200 | LLVM-vs2014 201 | 202 | 203 | Utility 204 | false 205 | true 206 | MultiByte 207 | LLVM-vs2014 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | $(SolutionDir)$(Configuration)\X360\ 271 | $(Configuration)\X360\log\ 272 | 273 | 274 | $(SolutionDir)$(Configuration)\X360\ 275 | $(Configuration)\X360\log\ 276 | 277 | 278 | $(SolutionDir)$(Configuration)\X360\ 279 | $(Configuration)\X360\log\ 280 | 281 | 282 | $(SolutionDir)$(Configuration)\X360\ 283 | $(Configuration)\X360\log\ 284 | 285 | 286 | $(SolutionDir)$(Configuration)\X360\ 287 | $(Configuration)\X360\log\ 288 | 289 | 290 | $(SolutionDir)$(Configuration)\X360\ 291 | $(Configuration)\X360\log\ 292 | 293 | 294 | $(SolutionDir)$(Configuration)\PS3\ 295 | $(Configuration)\PS3\log\ 296 | 297 | 298 | $(SolutionDir)$(Configuration)\PS3\ 299 | $(Configuration)\PS3\log\ 300 | 301 | 302 | $(SolutionDir)$(Configuration)\PS3\ 303 | $(Configuration)\PS3\log\ 304 | 305 | 306 | $(SolutionDir)$(Configuration)\PS3\ 307 | $(Configuration)\PS3\log\ 308 | 309 | 310 | $(SolutionDir)$(Configuration)\PS3\ 311 | $(Configuration)\PS3\log\ 312 | 313 | 314 | $(SolutionDir)$(Configuration)\PS3\ 315 | $(Configuration)\PS3\log\ 316 | 317 | 318 | $(SolutionDir)$(Configuration)\PC\ 319 | $(Configuration)\PC\log\ 320 | 321 | 322 | $(SolutionDir)$(Configuration)\PC\ 323 | $(Configuration)\PC\log\ 324 | 325 | 326 | $(SolutionDir)$(Configuration)\PC\ 327 | $(Configuration)\PC\log\ 328 | 329 | 330 | $(SolutionDir)$(Configuration)\PC\ 331 | $(Configuration)\PC\log\ 332 | 333 | 334 | $(SolutionDir)$(Configuration)\PC\ 335 | $(Configuration)\PC\log\ 336 | 337 | 338 | $(SolutionDir)$(Configuration)\PC\ 339 | $(Configuration)\PC\log\ 340 | 341 | 342 | 343 | Level3 344 | MaxSpeed 345 | false 346 | false 347 | false 348 | "../../include/" 349 | 4391;4392;4244;%(DisableSpecificWarnings) 350 | _MBCS;%(PreprocessorDefinitions);ENDIAN_BIG=0;ENDIAN_LITTLE=1;PLATFORM_X360=0;PLATFORM_PS3=1;PLATFORM_PC=2;TARGET_GTAIV=0;TARGET_GTAV=1;TARGET_RDR=2;FILETYPE_XSC=0;FILETYPE_YSC=1;FILETYPE_CSC=2;FILETYPE_SCO=3;SUBTARGET_TBOGT=0;SUBTARGET_TLAD=1;PTRWIDTH=32;TARGET=TARGET_GTAV;FILETYPE=FILETYPE_XSC;PLATFORM=PLATFORM_X360;ENDIAN=ENDIAN_BIG 351 | 352 | 353 | false 354 | false 355 | true 356 | CompileAsC 357 | 358 | 359 | true 360 | true 361 | 362 | 363 | false 364 | 365 | 366 | 367 | 368 | Level3 369 | MaxSpeed 370 | false 371 | false 372 | false 373 | "../../include/" 374 | 4391;4392;4244;%(DisableSpecificWarnings) 375 | _MBCS;%(PreprocessorDefinitions);ENDIAN_BIG=0;ENDIAN_LITTLE=1;PLATFORM_X360=0;PLATFORM_PS3=1;PLATFORM_PC=2;TARGET_GTAIV=0;TARGET_GTAV=1;TARGET_RDR=2;FILETYPE_XSC=0;FILETYPE_YSC=1;FILETYPE_CSC=2;FILETYPE_SCO=3;SUBTARGET_TBOGT=0;SUBTARGET_TLAD=1;PTRWIDTH=32;TARGET=TARGET_GTAIV;FILETYPE=FILETYPE_SCO;PLATFORM=PLATFORM_X360;ENDIAN=ENDIAN_BIG 376 | 377 | 378 | false 379 | false 380 | true 381 | CompileAsC 382 | 383 | 384 | true 385 | true 386 | 387 | 388 | false 389 | 390 | 391 | 392 | 393 | Level3 394 | MaxSpeed 395 | false 396 | false 397 | false 398 | "../../include/" 399 | 4391;4392;4244;%(DisableSpecificWarnings) 400 | _MBCS;%(PreprocessorDefinitions);ENDIAN_BIG=0;ENDIAN_LITTLE=1;PLATFORM_X360=0;PLATFORM_PS3=1;PLATFORM_PC=2;TARGET_GTAIV=0;TARGET_GTAV=1;TARGET_RDR=2;FILETYPE_XSC=0;FILETYPE_YSC=1;FILETYPE_CSC=2;FILETYPE_SCO=3;SUBTARGET_TBOGT=0;SUBTARGET_TLAD=1;PTRWIDTH=32;TARGET=TARGET_GTAIV;SUBTARGET=SUBTARGET_TBOGT;FILETYPE=FILETYPE_SCO;PLATFORM=PLATFORM_X360;ENDIAN=ENDIAN_BIG 401 | 402 | 403 | false 404 | false 405 | true 406 | CompileAsC 407 | 408 | 409 | true 410 | true 411 | 412 | 413 | false 414 | 415 | 416 | 417 | 418 | Level3 419 | MaxSpeed 420 | false 421 | false 422 | false 423 | "../../include/" 424 | 4391;4392;4244;%(DisableSpecificWarnings) 425 | _MBCS;%(PreprocessorDefinitions);ENDIAN_BIG=0;ENDIAN_LITTLE=1;PLATFORM_X360=0;PLATFORM_PS3=1;PLATFORM_PC=2;TARGET_GTAIV=0;TARGET_GTAV=1;TARGET_RDR=2;FILETYPE_XSC=0;FILETYPE_YSC=1;FILETYPE_CSC=2;FILETYPE_SCO=3;SUBTARGET_TBOGT=0;SUBTARGET_TLAD=1;PTRWIDTH=32;TARGET=TARGET_GTAIV;SUBTARGET=SUBTARGET_TLAD;FILETYPE=FILETYPE_SCO;PLATFORM=PLATFORM_X360;ENDIAN=ENDIAN_BIG 426 | 427 | 428 | false 429 | false 430 | true 431 | CompileAsC 432 | 433 | 434 | true 435 | true 436 | 437 | 438 | false 439 | 440 | 441 | 442 | 443 | Level3 444 | MaxSpeed 445 | false 446 | false 447 | false 448 | "../../include/";Include/ 449 | 4391;4392;4244;%(DisableSpecificWarnings) 450 | _MBCS;%(PreprocessorDefinitions);ENDIAN_BIG=0;ENDIAN_LITTLE=1;PLATFORM_X360=0;PLATFORM_PS3=1;PLATFORM_PC=2;TARGET_GTAIV=0;TARGET_GTAV=1;TARGET_RDR=2;FILETYPE_XSC=0;FILETYPE_YSC=1;FILETYPE_CSC=2;FILETYPE_SCO=3;SUBTARGET_TBOGT=0;SUBTARGET_TLAD=1;PTRWIDTH=32;TARGET=TARGET_RDR;FILETYPE=FILETYPE_XSC;PLATFORM=PLATFORM_X360;ENDIAN=ENDIAN_BIG 451 | 452 | 453 | false 454 | false 455 | true 456 | CompileAsC 457 | 458 | 459 | true 460 | true 461 | 462 | 463 | false 464 | 465 | 466 | 467 | 468 | Level3 469 | MaxSpeed 470 | false 471 | false 472 | false 473 | "../../include/" 474 | 4391;4392;4244;%(DisableSpecificWarnings) 475 | _MBCS;%(PreprocessorDefinitions);ENDIAN_BIG=0;ENDIAN_LITTLE=1;PLATFORM_X360=0;PLATFORM_PS3=1;PLATFORM_PC=2;TARGET_GTAIV=0;TARGET_GTAV=1;TARGET_RDR=2;FILETYPE_XSC=0;FILETYPE_YSC=1;FILETYPE_CSC=2;FILETYPE_SCO=3;SUBTARGET_TBOGT=0;SUBTARGET_TLAD=1;PTRWIDTH=32;TARGET=TARGET_RDR;FILETYPE=FILETYPE_SCO;PLATFORM=PLATFORM_X360;ENDIAN=ENDIAN_BIG 476 | 477 | 478 | false 479 | false 480 | true 481 | CompileAsC 482 | 483 | 484 | true 485 | true 486 | 487 | 488 | false 489 | 490 | 491 | 492 | 493 | Level3 494 | MaxSpeed 495 | false 496 | false 497 | false 498 | "../../include/" 499 | 4391;4392;4244;%(DisableSpecificWarnings) 500 | _MBCS;%(PreprocessorDefinitions);ENDIAN_BIG=0;ENDIAN_LITTLE=1;PLATFORM_X360=0;PLATFORM_PS3=1;PLATFORM_PC=2;TARGET_GTAIV=0;TARGET_GTAV=1;TARGET_RDR=2;FILETYPE_XSC=0;FILETYPE_YSC=1;FILETYPE_CSC=2;FILETYPE_SCO=3;SUBTARGET_TBOGT=0;SUBTARGET_TLAD=1;PTRWIDTH=32;TARGET=TARGET_GTAV;__CSC__;PLATFORM=PLATFORM_PS3;ENDIAN=ENDIAN_BIG 501 | 502 | 503 | false 504 | false 505 | true 506 | CompileAsC 507 | 508 | 509 | true 510 | true 511 | 512 | 513 | false 514 | 515 | 516 | 517 | 518 | Level3 519 | MaxSpeed 520 | false 521 | false 522 | false 523 | "../../include/" 524 | 4391;4392;4244;%(DisableSpecificWarnings) 525 | _MBCS;%(PreprocessorDefinitions);ENDIAN_BIG=0;ENDIAN_LITTLE=1;PLATFORM_X360=0;PLATFORM_PS3=1;PLATFORM_PC=2;TARGET_GTAIV=0;TARGET_GTAV=1;TARGET_RDR=2;FILETYPE_XSC=0;FILETYPE_YSC=1;FILETYPE_CSC=2;FILETYPE_SCO=3;SUBTARGET_TBOGT=0;SUBTARGET_TLAD=1;PTRWIDTH=32;TARGET=TARGET_GTAIV;FILETYPE=FILETYPE_SCO;PLATFORM=PLATFORM_PS3;ENDIAN=ENDIAN_BIG 526 | 527 | 528 | false 529 | false 530 | true 531 | CompileAsC 532 | 533 | 534 | true 535 | true 536 | 537 | 538 | false 539 | 540 | 541 | 542 | 543 | Level3 544 | MaxSpeed 545 | false 546 | false 547 | false 548 | "../../include/" 549 | 4391;4392;4244;%(DisableSpecificWarnings) 550 | _MBCS;%(PreprocessorDefinitions);ENDIAN_BIG=0;ENDIAN_LITTLE=1;PLATFORM_X360=0;PLATFORM_PS3=1;PLATFORM_PC=2;TARGET_GTAIV=0;TARGET_GTAV=1;TARGET_RDR=2;FILETYPE_XSC=0;FILETYPE_YSC=1;FILETYPE_CSC=2;FILETYPE_SCO=3;SUBTARGET_TBOGT=0;SUBTARGET_TLAD=1;PTRWIDTH=32;TARGET=TARGET_GTAIV;SUBTARGET=SUBTARGET_TBOGT;FILETYPE=FILETYPE_SCO;PLATFORM=PLATFORM_PS3;ENDIAN=ENDIAN_BIG 551 | 552 | 553 | false 554 | false 555 | true 556 | CompileAsC 557 | 558 | 559 | true 560 | true 561 | 562 | 563 | false 564 | 565 | 566 | 567 | 568 | Level3 569 | MaxSpeed 570 | false 571 | false 572 | false 573 | "../../include/" 574 | 4391;4392;4244;%(DisableSpecificWarnings) 575 | _MBCS;%(PreprocessorDefinitions);ENDIAN_BIG=0;ENDIAN_LITTLE=1;PLATFORM_X360=0;PLATFORM_PS3=1;PLATFORM_PC=2;TARGET_GTAIV=0;TARGET_GTAV=1;TARGET_RDR=2;FILETYPE_XSC=0;FILETYPE_YSC=1;FILETYPE_CSC=2;FILETYPE_SCO=3;SUBTARGET_TBOGT=0;SUBTARGET_TLAD=1;PTRWIDTH=32;TARGET=TARGET_GTAIV;SUBTARGET=SUBTARGET_TLAD;FILETYPE=FILETYPE_SCO;PLATFORM=PLATFORM_PS3;ENDIAN=ENDIAN_BIG 576 | 577 | 578 | false 579 | false 580 | true 581 | CompileAsC 582 | 583 | 584 | true 585 | true 586 | 587 | 588 | false 589 | 590 | 591 | 592 | 593 | Level3 594 | MaxSpeed 595 | false 596 | false 597 | false 598 | "../../include/";Include/ 599 | 4391;4392;4244;%(DisableSpecificWarnings) 600 | _MBCS;%(PreprocessorDefinitions);ENDIAN_BIG=0;ENDIAN_LITTLE=1;PLATFORM_X360=0;PLATFORM_PS3=1;PLATFORM_PC=2;TARGET_GTAIV=0;TARGET_GTAV=1;TARGET_RDR=2;FILETYPE_XSC=0;FILETYPE_YSC=1;FILETYPE_CSC=2;FILETYPE_SCO=3;SUBTARGET_TBOGT=0;SUBTARGET_TLAD=1;PTRWIDTH=32;TARGET=TARGET_RDR;FILETYPE=FILETYPE_CSC;PLATFORM=PLATFORM_PS3;ENDIAN=ENDIAN_BIG 601 | 602 | 603 | false 604 | false 605 | true 606 | CompileAsC 607 | 608 | 609 | true 610 | true 611 | 612 | 613 | false 614 | 615 | 616 | 617 | 618 | Level3 619 | MaxSpeed 620 | false 621 | false 622 | false 623 | "../../include/" 624 | 4391;4392;4244;%(DisableSpecificWarnings) 625 | _MBCS;%(PreprocessorDefinitions);ENDIAN_BIG=0;ENDIAN_LITTLE=1;PLATFORM_X360=0;PLATFORM_PS3=1;PLATFORM_PC=2;TARGET_GTAIV=0;TARGET_GTAV=1;TARGET_RDR=2;FILETYPE_XSC=0;FILETYPE_YSC=1;FILETYPE_CSC=2;FILETYPE_SCO=3;SUBTARGET_TBOGT=0;SUBTARGET_TLAD=1;PTRWIDTH=32;TARGET=TARGET_RDR;FILETYPE=FILETYPE_SCO;PLATFORM=PLATFORM_PS3;ENDIAN=ENDIAN_BIG 626 | 627 | 628 | false 629 | false 630 | true 631 | CompileAsC 632 | 633 | 634 | true 635 | true 636 | 637 | 638 | false 639 | 640 | 641 | 642 | 643 | Level3 644 | MaxSpeed 645 | false 646 | false 647 | false 648 | "../../include/" 649 | 4391;4392;4244;%(DisableSpecificWarnings) 650 | _MBCS;%(PreprocessorDefinitions);ENDIAN_BIG=0;ENDIAN_LITTLE=1;PLATFORM_X360=0;PLATFORM_PS3=1;PLATFORM_PC=2;TARGET_GTAIV=0;TARGET_GTAV=1;TARGET_RDR=2;FILETYPE_XSC=0;FILETYPE_YSC=1;FILETYPE_CSC=2;FILETYPE_SCO=3;SUBTARGET_TBOGT=0;SUBTARGET_TLAD=1;PTRWIDTH=64;TARGET=TARGET_GTAV;FILETYPE=FILETYPE_YSC;PLATFORM=PLATFORM_PC;ENDIAN=ENDIAN_LITTLE 651 | 652 | 653 | false 654 | false 655 | true 656 | CompileAsC 657 | 658 | 659 | true 660 | true 661 | 662 | 663 | false 664 | 665 | 666 | 667 | 668 | Level3 669 | MaxSpeed 670 | false 671 | false 672 | false 673 | "../../include/" 674 | 4391;4392;4244;%(DisableSpecificWarnings) 675 | _MBCS;%(PreprocessorDefinitions);ENDIAN_BIG=0;ENDIAN_LITTLE=1;PLATFORM_X360=0;PLATFORM_PS3=1;PLATFORM_PC=2;TARGET_GTAIV=0;TARGET_GTAV=1;TARGET_RDR=2;FILETYPE_XSC=0;FILETYPE_YSC=1;FILETYPE_CSC=2;FILETYPE_SCO=3;SUBTARGET_TBOGT=0;SUBTARGET_TLAD=1;PTRWIDTH=64;TARGET=TARGET_GTAIV;FILETYPE=FILETYPE_SCO;PLATFORM=PLATFORM_PC;ENDIAN=ENDIAN_LITTLE 676 | 677 | 678 | false 679 | false 680 | true 681 | CompileAsC 682 | 683 | 684 | true 685 | true 686 | 687 | 688 | false 689 | 690 | 691 | 692 | 693 | Level3 694 | MaxSpeed 695 | false 696 | false 697 | false 698 | "../../include/" 699 | 4391;4392;4244;%(DisableSpecificWarnings) 700 | _MBCS;%(PreprocessorDefinitions);ENDIAN_BIG=0;ENDIAN_LITTLE=1;PLATFORM_X360=0;PLATFORM_PS3=1;PLATFORM_PC=2;TARGET_GTAIV=0;TARGET_GTAV=1;TARGET_RDR=2;FILETYPE_XSC=0;FILETYPE_YSC=1;FILETYPE_CSC=2;FILETYPE_SCO=3;SUBTARGET_TBOGT=0;SUBTARGET_TLAD=1;PTRWIDTH=64;TARGET=TARGET_GTAIV;SUBTARGET=SUBTARGET_TBOGT;FILETYPE=FILETYPE_YSC;PLATFORM=PLATFORM_PC;ENDIAN=ENDIAN_LITTLE 701 | 702 | 703 | false 704 | false 705 | true 706 | CompileAsC 707 | 708 | 709 | true 710 | true 711 | 712 | 713 | false 714 | 715 | 716 | 717 | 718 | Level3 719 | MaxSpeed 720 | false 721 | false 722 | false 723 | "../../include/" 724 | 4391;4392;4244;%(DisableSpecificWarnings) 725 | _MBCS;%(PreprocessorDefinitions);ENDIAN_BIG=0;ENDIAN_LITTLE=1;PLATFORM_X360=0;PLATFORM_PS3=1;PLATFORM_PC=2;TARGET_GTAIV=0;TARGET_GTAV=1;TARGET_RDR=2;FILETYPE_XSC=0;FILETYPE_YSC=1;FILETYPE_CSC=2;FILETYPE_SCO=3;SUBTARGET_TBOGT=0;SUBTARGET_TLAD=1;PTRWIDTH=64;TARGET=TARGET_GTAIV;SUBTARGET=SUBTARGET_TLAD;FILETYPE=FILETYPE_YSC;PLATFORM=PLATFORM_PC;ENDIAN=ENDIAN_LITTLE 726 | 727 | 728 | false 729 | false 730 | true 731 | CompileAsC 732 | 733 | 734 | true 735 | true 736 | 737 | 738 | false 739 | 740 | 741 | 742 | 743 | Level3 744 | MaxSpeed 745 | false 746 | false 747 | false 748 | "../../include/";Include/ 749 | 4391;4392;4244;%(DisableSpecificWarnings) 750 | _MBCS;%(PreprocessorDefinitions);ENDIAN_BIG=0;ENDIAN_LITTLE=1;PLATFORM_X360=0;PLATFORM_PS3=1;PLATFORM_PC=2;TARGET_GTAIV=0;TARGET_GTAV=1;TARGET_RDR=2;FILETYPE_XSC=0;FILETYPE_YSC=1;FILETYPE_CSC=2;FILETYPE_SCO=3;SUBTARGET_TBOGT=0;SUBTARGET_TLAD=1;PTRWIDTH=64;TARGET=TARGET_RDR;FILETYPE=FILETYPE_YSC;PLATFORM=PLATFORM_PC;ENDIAN=ENDIAN_LITTLE 751 | 752 | 753 | false 754 | false 755 | true 756 | CompileAsC 757 | 758 | 759 | true 760 | true 761 | 762 | 763 | false 764 | 765 | 766 | 767 | 768 | Level3 769 | MaxSpeed 770 | false 771 | false 772 | false 773 | "../../include/" 774 | 4391;4392;4244;%(DisableSpecificWarnings) 775 | _MBCS;%(PreprocessorDefinitions);ENDIAN_BIG=0;ENDIAN_LITTLE=1;PLATFORM_X360=0;PLATFORM_PS3=1;PLATFORM_PC=2;TARGET_GTAIV=0;TARGET_GTAV=1;TARGET_RDR=2;FILETYPE_XSC=0;FILETYPE_YSC=1;FILETYPE_CSC=2;FILETYPE_SCO=3;SUBTARGET_TBOGT=0;SUBTARGET_TLAD=1;PTRWIDTH=64;TARGET=TARGET_GTAV;FILETYPE=FILETYPE_SCO;PLATFORM=PLATFORM_PC;ENDIAN=ENDIAN_LITTLE 776 | 777 | 778 | false 779 | false 780 | true 781 | CompileAsC 782 | 783 | 784 | true 785 | true 786 | 787 | 788 | false 789 | 790 | 791 | 792 | 793 | "../../bin/SC-CL.exe" -platform=X360 -target=GTAV -out-dir="$(OutDir)bin\\" -snb -vcx="$(ProjectFileName)" -- -I "../../include/" 794 | "../../bin/SC-CL.exe" -platform=PS3 -target=GTAV -out-dir="$(OutDir)bin\\" -snb -vcx="$(ProjectFileName)" -- -I "../../include/" 795 | "../../bin/SC-CL.exe" -platform=PC -target=GTAV -out-dir="$(OutDir)bin\\" -pc-version=944 -snb -vcx="$(ProjectFileName)" -- -I "../../include/" 796 | "../../bin/SC-CL.exe" -platform=X360 -target=GTAIV -out-dir="$(OutDir)bin\\" -s -vcx="$(ProjectFileName)" -- -I "../../include/" 797 | "../../bin/SC-CL.exe" -platform=PS3 -target=GTAIV -out-dir="$(OutDir)bin\\" -s -vcx="$(ProjectFileName)" -- -I "../../include/" 798 | "../../bin/SC-CL.exe" -platform=PC -target=GTAIV -out-dir="$(OutDir)bin\\" -s -vcx="$(ProjectFileName)" -- -I "../../include/" 799 | "../../bin/SC-CL.exe" -platform=X360 -target=GTAIV_TLAD -out-dir="$(OutDir)bin\\" -s -vcx="$(ProjectFileName)" -- -I "../../include/" 800 | "../../bin/SC-CL.exe" -platform=PS3 -target=GTAIV_TLAD -out-dir="$(OutDir)bin\\" -s -vcx="$(ProjectFileName)" -- -I "../../include/" 801 | "../../bin/SC-CL.exe" -platform=PC -target=GTAIV_TLAD -out-dir="$(OutDir)bin\\" -s -vcx="$(ProjectFileName)" -- -I "../../include/" 802 | "../../bin/SC-CL.exe" -platform=X360 -target=GTAIV_TBOGT -out-dir="$(OutDir)bin\\" -s -vcx="$(ProjectFileName)" -- -I "../../include/" 803 | "../../bin/SC-CL.exe" -platform=PS3 -target=GTAIV_TBOGT -out-dir="$(OutDir)bin\\" -s -vcx="$(ProjectFileName)" -- -I "../../include/" 804 | "../../bin/SC-CL.exe" -platform=PC -target=GTAIV_TBOGT -out-dir="$(OutDir)bin\\" -s -vcx="$(ProjectFileName)" -- -I "../../include/" 805 | "../../bin/SC-CL.exe" -platform=X360 -target=RDR_#SC -out-dir="$(OutDir)bin\\" -vcx="$(ProjectFileName)" -- -I "../../include/" 806 | "../../bin/SC-CL.exe" -platform=PS3 -target=RDR_#SC -out-dir="$(OutDir)bin\\" -vcx="$(ProjectFileName)" -- -I "../../include/" 807 | "../../bin/SC-CL.exe" -platform=PC -target=RDR_#SC -out-dir="$(OutDir)bin\\" -vcx="$(ProjectFileName)" -- -I "../../include/" 808 | "../../bin/SC-CL.exe" -platform=X360 -target=RDR_SCO -out-dir="$(OutDir)bin\\" -vcx="$(ProjectFileName)" -- -I "../../include/" 809 | "../../bin/SC-CL.exe" -platform=PS3 -target=RDR_SCO -out-dir="$(OutDir)bin\\" -vcx="$(ProjectFileName)" -- -I "../../include/" 810 | "../../bin/SC-CL.exe" -platform=PC -target=RDR_SCO -out-dir="$(OutDir)bin\\" -vcx="$(ProjectFileName)" -- -I "../../include/" 811 | example.dh%(Outputs) 812 | example.dh%(Outputs) 813 | example.dh%(Outputs) 814 | example.dh%(Outputs) 815 | example.dh%(Outputs) 816 | example.dh%(Outputs) 817 | example.dh%(Outputs) 818 | example.dh%(Outputs) 819 | example.dh%(Outputs) 820 | example.dh%(Outputs) 821 | example.dh%(Outputs) 822 | example.dh%(Outputs) 823 | example.dh%(Outputs) 824 | example.dh%(Outputs) 825 | example.dh%(Outputs) 826 | example.dh%(Outputs) 827 | example.dh%(Outputs) 828 | example.dh%(Outputs) 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | -------------------------------------------------------------------------------- /projects/example/example.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {99bf53d6-378f-413e-b921-40ff6f9d3da1} 6 | 7 | 8 | {819b25ed-b4b1-4046-927c-dccde87a5d1a} 9 | 10 | 11 | {ed7861d1-017e-4050-9c2f-9e77ed20764d} 12 | 13 | 14 | {e81238d2-000a-4c81-808c-b2f7939fab42} 15 | 16 | 17 | {053dd82d-826d-458a-997e-921c5a8208b1} 18 | 19 | 20 | 21 | 22 | {56e85d47-cf3e-47cd-9b83-952caed44f1c} 23 | 24 | 25 | {40e788e5-9ec8-4d99-913f-3f3eb11dba9b} 26 | 27 | 28 | 29 | 30 | include\GTAV 31 | 32 | 33 | include\GTAV 34 | 35 | 36 | include\GTAV 37 | 38 | 39 | include\GTAV 40 | 41 | 42 | include\GTAV 43 | 44 | 45 | include 46 | 47 | 48 | include 49 | 50 | 51 | include 52 | 53 | 54 | include 55 | 56 | 57 | include 58 | 59 | 60 | include\RDR 61 | 62 | 63 | include\RDR 64 | 65 | 66 | include\GTAIV 67 | 68 | 69 | include\GTAIV 70 | 71 | 72 | include\GTAIV 73 | 74 | 75 | include 76 | 77 | 78 | 79 | 80 | include 81 | 82 | 83 | 84 | 85 | Source Files 86 | 87 | 88 | -------------------------------------------------------------------------------- /projects/example/example.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | false 5 | false 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | --------------------------------------------------------------------------------