Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
San Andreas Save template for the 010 Editor. This multi-platform template can parse most PC, PS2 and Mobile save files for GTA: San Andreas.
/* --------------------------------------
GTA: SA Save File 010 template
Revision: 03/07/08
Based on GTA: SA save format article from:
www.gtamodding.com/index.php?title=GTA_SA_Saves
Credits go to CyQ, pdescobar, OrionSR and everyone who contributed in this article.
by Seemann
www.sannybuilder.com
September 6, 2017 Update by OrionSR
* Template updated with current info
* Support added for PS2 and Mobile saves
* Task analysis by Nick007J
New "Companion" topic on GTAForums specific to San Andreas save files.
http://gtaforums.com/topic/893779-san-andreas-save-file-companion/
-------------------------------------- */
// START ADDITIONAL FILES --------------------------------------------------------------------------------------
/*
//------------------------------------------------------------------------ Start
//--- 010 Editor v3.0 Script File
//
// File: SaveCheckSum.1sc
// Author: Seemann, I think
// Revision: Comments added by OrionSR
// Purpose: Required script to fix the checksum of edited saves
//--------------------------------------
WriteUInt(FileSize()-4, Checksum(CHECKSUM_BYTE, 0, FileSize()-4));
//------------------------------------------------------------------------ End
*/
// END ADDITIONAL FILES ----------------------------------------------------------------------------------------
// START SAVE TYPE COMMENTS ------------------------------------------------------------------------------------
Printf("\n\n=================================================================================| SAVE TYPE COMMENTS |====");
//--Game Version--//
// File Size //
Printf("\nFile Size: \t%u\t", FileSize());
if (FileSize() == 202752) Printf("San Andreas PC/PS2\t");
if (FileSize() == 195000) Printf("San Andreas Mobile 1.06+ standard\t");
if (FileSize() == 260000) Printf("San Andreas Mobile 1.06+ Mission Save\t");
if (FileSize() == 325000) Printf("San Andreas Mobile 1.06+ Check.325 Save\t");
if (FileSize() == 390000) Printf("San Andreas Mobile 1.06+ Checkpoint Save\t");
//--Game Version--//
// File Format //
Printf("\nOffset to Block1:\t");
if (ReadString(317, 5) == "BLOCK") Printf("13Dh\tSA PC Standard\t");
if (ReadString(433, 5) == "BLOCK") Printf("1B1h\tSA Mobile v1.06+\t");
if (ReadString(333, 5) == "BLOCK") Printf("14Dh\tSA PS2 US/EU \t");
if (ReadString(433, 5) == "BLOCK") Printf("SA PS2 Japan \t");
//---EXE Version--//
// FileID //
local int fileID = 0;
fileID = ReadInt(5);
Printf("\nFile ID: \t%x\t", fileID);
if (fileID == 35da8175h) Printf("SA PC v1 Unmodified\t");
if (fileID == 65f3e583h) Printf("SA PC v1 Modified\t");
if (fileID == 9a6ebe58h) Printf("SA PC v1.01 Unmodified\t");
if (fileID == 9345765eh) Printf("SA PC v1.01 Modified\t");
if (fileID == 4245982710) Printf("SA PC v2 Unmodified\t"); //fd148df6h
if (fileID == 5d31cc22h) Printf("SA PC v2 (German)\t");
if (fileID == 4245982710) Printf("SA PS2 v2 (Greatest Hits)\t"); //fd148df6h
if (fileID == 641ddc4ch) Printf("SA PS2 v1 (Original Edition)\t");
if (fileID == 147728c3h) Printf("SA Mobile v1.06+\t");
if (fileID == 4245982710) Printf("SA Mobile v1.05-\t"); //fd148df6h
if (fileID == 1) Printf("Unknown SA TTDISA\t");
//-Script Version-//
// Size of Main //
Printf("\nSize of Main:\t");
if (ReadInt(46424) == 2F662h) Printf("2F662h\tSA PCv1 Scripts\t");
if (ReadInt(46424) == 2F64Dh) Printf("2F64Dh\tSA PCv2 Scripts\t");
if (ReadInt(46400) == 2FF1Bh) Printf("2FF1Bh\tSA PS2 v1 Scripts\t");
if (ReadInt(46424) == 2FFEAh) Printf("2FF1Bh\tSA PS2 v2 Scripts\t");
if (ReadInt(51944) == 40065h) Printf("40065h\tSA Mobile Scripts w/1.06+ offset\t");
if (ReadInt(52454) == 40065h) Printf("40065h\tSA Mobile Scripts w/1.05- offset\t");
if (ReadInt(46904) == 3003Ch) Printf("3003Ch\tSA PC TTDISA Scripts\t");
if (ReadInt(46384) == 2FF1Bh) Printf("2FF1Bh\tSA PC Hot Coffee v2.01 Scripts\t");
if (ReadInt(46516) == 2FC86h) Printf("2FF1Bh\tSA PS2 Japan Scripts\t");
//--Mobile Type--//
// pointers? //
local uint pClue = 0;
pClue = ReadUInt(51994);
Printf("\nMobile Type:\t%x\t", pClue);
if (FileSize() == 195000 && pClue > 50000000h) Printf("SA Android Pointers?\t");
if (FileSize() == 195000 && pClue < 10000000h) Printf("SA iOS Pointers?\t");
if (FileSize() == 195000 && pClue >= 10000000h && pClue <= 50000000h) Printf("Unidentified SA Pointers\t");
Printf("\n===========================================================================================================\n\n");
// END SAVE TYPE COMMENTS --------------------------------------------------------------------------------------
// START TEMPLATE ENUMS ----------------------------------------------------------------------------------------
//#include <SAS.enum.bt>
//***************************************************************************************
enum <DWORD> eCarID {
landstal = 400, bravura, buffalo, linerun, peren, sentinel, dumper, firetruk, trash, stretch,
manana, infernus, voodoo, pony, mule, cheetah, ambulan, leviathn, moonbeam, esperant,
taxi, washing, bobcat, mrwhoop, bfinject, hunter, premier, enforcer, securica, banshee,
predator, bus, rhino, barracks, hotknife, artict1, previon, coach, cabbie, stallion,
rumpo, rcbandit, romero, packer, monster, admiral, squalo, seaspar, pizzaboy, tram,
artict2, turismo, speeder, reefer, tropic, flatbed, yankee, caddy, solair, topfun,
skimmer, pcj600, faggio, freeway, rcbaron, rcraider, glendale, oceanic, sanchez, sparrow,
patriot, quadbike, coastg, dinghy, hermes, sabre, rustler, zr350, walton, regina,
comet, bmx, burrito, camper, marquis, baggage, dozer, maverick, vcnmav, rancher,
fbiranch, virgo, greenwoo, jetmax, hotring, sandking, blistac, polmav, boxville, benson,
mesa, rcgoblin, hotrina, hotrinb, bloodra, rnchlure, supergt, elegant, journey, bike,
mtbike, beagle, cropdust, stunt, petro, rdtrain, nebula, majestic, buccanee, shamal,
hydra, fcr900, nrg500, copbike, cement, towtruck, fortune, cadrona, fbitruck, willard,
forklift, tractor, combine, feltzer, remingtn, slamvan, blade, freight, streak, vortex,
vincent, bullet, clover, sadler, firela, hustler, intruder, primo, cargobob, tampa,
sunrise, merit, utility, nevada, yosemite, windsor, monstera, monsterb, uranus, jester,
sultan, stratum, elegy, raindanc, rctiger, flash, tahoma, savanna, bandito, freiflat,
streakc, kart, mower, duneride, sweeper, broadway, tornado, at400, dft30, huntley,
stafford, bf400, newsvan, tug, petrotr, emperor, wayfarer, euros, hotdog, club,
freibox, artict3, androm, dodo, rccam, launch, copcarla, copcarsf, copcarvg, copcarru,
picador, swatvan, alpha, phoenix, glenshit, sadlshit, bagboxa, bagboxb, tugstair, boxburg,
farmtr1, utiltr1
};
enum <WORD> eVehID {
Landstal = 400, Bravura, Buffalo, Lineruner, Perenial, Sentinel, Dumper, Firetruck, TrashMastr, Stretch,
Manana, Infernus, Voodoo, Pony, Mule, Cheetah, Ambulance, Leviathan, Moonbeam, Esperant,
Taxi, Washington, Bobcat, MrWhoopie, BFInjection, Hunter, Premier, Enforcer, Securicar, Banshee,
Predator, Bus, Rhino, Barracks, Hotknife, Artict1, Previon, Coach, Cabbie, Stallion,
Rumpo, RCBandit, Romero, Packer, Monster, Admiral, Squalo, Seaspar, Pizzaboy, Tram,
Artict2, Turismo, Speeder, Reefer, Tropic, Flatbed, Yankee, Caddy, Solair, Topfun,
Skimmer, PCJ600, Faggio, Freeway, RCBaron, RCRaider, Glendale, Oceanic, Sanchez, Sparrow,
Patriot, Quadbike, Coastgaurd, Dinghy, Hermes, Sabre, Rustler, ZR350, Walton, Regina,
Comet, BMX, Burrito, Camper, Narquis, Baggage, Dozer, Maverick, VCNMaverick, Rancher,
FBIRancher, Virgo, Greenwood, Jetmax, Hotring, Sandking, BlistaCompact, PoliceMaverick, Boxville, Benson,
Mesa, RCGoblin, HotrinA, HotrinB, BloodrA, RnchLure, SuperGT, Elegant, Journey, Bike,
MtBike, Beagle, CropDuster, Stunt, Petro, RoadTrain, Nebula, Majestic, Buccanee, Shamal,
Hydra, FCR900, NRG500, HPV1000, Cement, TowTruck, Fortune, Cadrona, FBITruck, Willard,
Forklift, Tractor, Combine, Feltzer, Remington, Slamvan, Blade, Freight, Streak, Vortex,
Vincent, Bullet, Clover, Sadler, FireLA, Hustler, Intruder, Primo, Cargobob, Tampa,
Sunrise, Merit, Utility, Nevada, Yosemite, Windsor, MonsterA, MonsterB, Uranus, Jester,
Sultan, Stratum, Elegy, Raindance, RCTiger, Flash, Tahoma, Savanna, Bandito, FreightFlat,
StreakCarriage, Kart, Mower, Dune, Sweeper, Broadway, Tornado, AT400, DFT30, Huntley,
Stafford, BF400, Newsvan, Tug, PetroTrailer, Emperor, Wayfarer, Euros, Hotdog, Club,
FreightBox, Artict3, Andromada, Dodo, RCCam, Launch, CopcarLA, CopcarSF, CopcarVG, PoliceRanger,
Picador, SwatVan, Alpha, Phoenix, GlenShit, SadlShit, BagboxA, BagboxB, TugStair, BoxBurg,
FarmTrailer, UtilityTrailer
};
enum WeaponNum {
Unarmed = 0, BrassKnuckles, // Group 1
GolfClub = 2, NiteStick, Knife, Bat, Shovel, PoolCue, Katana, Chainsaw, // Group 2
Colt45 = 22, Silenced, DesertEagle, // Group 3
Shotgun = 25, Sawnoff, Spaz, // Group 4
MicoSMG = 28, SMG, Tec9 = 32, // Group 5
AK47 = 30, M4, // Group 6
CuntGun = 33, Sniper, // Group 7
RPG = 35, Heatseeker, Flame, Minigun, // Group 8
Grenade = 16, TearGas, Molotov, Satchel = 39, // Group 9
Spraycan = 41, FireEx, Camera, // Group 10
Dildo1 = 10, Dildo2, Vibe1, Vibe2, Flowers, Cane, // Group 11
NVgoggles = 44, IRgoggles, Parachute, // Group 12
Detonator = 40 // Group 13
};
enum <WORD> ePickupID {
_PurpleDildo = 321, _WhiteDildo = 322, _LongVibrator = 323,
_Vibrator = 324, _Flowers = 325, _Cane = 326,
_CellPhone = 330, _BrassKnuckles = 331,
_GolfClub = 333, _NightStick = 334, _CombatKnife = 335, _BaseballBat = 336,
_Shovel = 337, _PoolCue = 338, _Katana = 339, _Chainsaw = 341,
_FragGrenade = 342, _TearGasGrenade = 343, _MolotovCocktail = 344, _SatchelCharges = 363,
_Colt45 = 346, _SilencedPistol = 347, _DesertEagle = 348,
_PumpAction = 349, _SawnOff = 350, _SPAZ12 = 351,
_MP5 = 353, _Mac10 = 352, _Tec9 = 372,
_HydraFlare = 354,
_AK47 = 355, _M4 = 356,
_CountryRifle = 357, _SniperRifle = 358,
_RocketLauncher=359, _HeatSeeking = 360, _Flamethrower = 361, _Minigun = 362,
_Detonator = 364,
_SprayPaint = 365, _Extinguisher = 366, _Camera = 367,
_NVGoggles = 368, _IRGoggles = 369, _Parachute = 371,
_Jetpack = 370,
_Briefcase = 1210, _Money = 1212, _Information = 1239,
_Health = 1240, _Adrenaline = 1241, _Armor = 1242, _Bribe = 1247,
_Gta3Logo = 1248, _GreyBomb = 1252, _PhotoOp = 1253, _Rampage = 1254,
_BlueHouse = 1272, _GreenHouse = 1273, _Dollar = 1274, _BlueTshirt = 1275,
_Tiki = 1276, _SaveDisk = 1277, _DrugBundle = 1279,
_TwoPlayerRampage = 1313, _TwoSkullsIcon = 1313, _TwoPlayer = 1314,
_Corona = 1316, _Checkpoint = 1317, _WhiteArrow = 1318,
_MoneyBag = 1550, _EnexDiamond = 1559, _PizzaBox = 1582, _MaddDoggsRhymeBook = 2894
};
enum <byte> ePickupType {
None = 0,
unPickupInShop = 1, // III/VC legacy, can't pickup
PickupOnStreet = 2, // 30sec respawn, IPL default, shared ammo picked up
PickupOnce = 3, // standard, no respawn
FastTimeout = 4, // 20sec, dropped weapons, shared ammo picked up, no respawn
SlowTimeout = 5, // 2min, dropped jetpacks, gangwar health and armor, no respawn
unCollectable = 6, // III/VC legacy, hidden package? can't pickup
OutOfStock = 7, // darkened model, can't pickup
MoneyTimeout = 8, // 30sec, no respawn
VehicleMineA = 9, // 10 sec delay if in vehicle and in range, no respawn
vehicleMineB = 10, // seems the same as above
NauticalMineA = 11, // falls to float, 10 sec delay if in range, no respawn
nauticalMineB = 12, // seems the same as above
FloatingPackage = 13, // falls slowly to float, vehicle pickup, no respawn
VehiclePackage = 14, // vehicle pickup, no respawn
StandardPickup = 15, // standard, 6min respawn, 5min for bribes
AssetRevenue = 16,
PropertyLocked = 17,
PropertyForSale = 18,
MoneyOnce = 19, // no respawn
SnapshotPickup = 20, // no respawn
TwoPlayerPickup = 21,
OnceWithAmmo = 22, // shared ammo picked up
wontPickup = 23
};
enum <WORD> eVehicleMods {
spl_b_mar_m = 1000, spl_b_bab_m = 1001, spl_b_bar_m = 1002, spl_b_mab_m = 1003, bnt_b_sc_m = 1004, bnt_b_sc_l = 1005, rf_b_sc_r = 1006,
wg_l_b_ssk = 1007, Nitro5 = 1008, Nitro2 = 1009, Nitro10 = 1010, bnt_b_sc_p_m = 1011, bnt_b_sc_p_l = 1012, lgt_b_rspt = 1013,
spl_b_bar_l = 1014, spl_b_bbr_l = 1015, spl_b_bbr_m = 1016, wg_r_b_ssk = 1017, exh_b_ts = 1018, exh_b_t = 1019, exh_b_l = 1020,
exh_b_m = 1021, exh_b_s = 1022, spl_b_bbb_m = 1023, lgt_b_sspt = 1024, Offroad = 1025, wg_l_a_s = 1026, wg_r_a_s = 1027,
exh_a_s = 1028, exh_c_s = 1029, wg_r_c_s = 1030, wg_l_c_s = 1031, rf_a_s = 1032, rf_c_s = 1033, exh_a_l = 1034,
rf_c_l = 1035, wg_l_a_l = 1036, exh_c_l = 1037, rf_a_l = 1038, wg_l_c_l = 1039, wg_r_a_l = 1040, wg_r_c_l = 1041,
wg_l_lr_br1 = 1042, exh_lr_br2 = 1043, exh_lr_br1 = 1044, exh_c_f = 1045, exh_a_f = 1046, wg_l_a_f = 1047, wg_l_c_f = 1048,
spl_a_f_r = 1049, spl_c_f_r = 1050, wg_r_a_f = 1051, wg_r_c_f = 1052, rf_c_f = 1053, rf_a_f = 1054, rf_a_st = 1055,
wg_l_a_st = 1056, wg_l_c_st = 1057, spl_a_st_r = 1058, exh_c_st = 1059, spl_c_st_r = 1060, rf_c_st = 1061, wg_r_a_st = 1062,
wg_r_c_st = 1063, exh_a_st = 1064, exh_a_j = 1065, exh_c_j = 1066, rf_a_j = 1067, rf_c_j = 1068, wg_l_a_j = 1069,
wg_l_c_j = 1070, wg_r_a_j = 1071, wg_r_c_j = 1072, Shadow = 1073, Mega = 1074, Rimshine = 1075, Wires = 1076,
Classic = 1077, Twist = 1078, Cutter = 1079, Switch = 1080, Grove = 1081, Import = 1082, Dollar = 1083,
Trance = 1084, Atomic = 1085, Stereo = 1086, Hydralics = 1087, rf_a_u = 1088, exh_c_u = 1089, wg_l_a_u = 1090,
rf_c_u = 1091, exh_a_u = 1092, wg_l_c_u = 1093, wg_r_a_u = 1094, wg_r_c_u = 1095, Ahab = 1096, Virtual = 1097,
Access = 1098, wg_r_lr_br1 = 1099, misc_c_lr_rem1= 1100, wg_r_lr_rem1 = 1101, wg_r_lr_sv = 1102, rf_lr_bl2 = 1103, exh_lr_bl1 = 1104,
exh_lr_bl2 = 1105, wg_l_lr_rem2 = 1106, wg_r_lr_bl1 = 1107, wg_l_lr_bl1 = 1108, bbb_lr_slv1 = 1109, bbb_lr_slv2 = 1110, bnt_lr_slv1 = 1111,
bnt_lr_slv2 = 1112, exh_lr_slv1 = 1113, exh_lr_slv2 = 1114, fbb_lr_slv1 = 1115, fbb_lr_slv2 = 1116, fbmp_lr_slv1 = 1117, wg_l_lr_slv1 = 1118,
wg_l_lr_slv2 = 1119, wg_r_lr_slv1 = 1120, wg_r_lr_slv2 = 1121, wg_l_lr_rem1 = 1122, misc_c_lr_rem2 = 1123, wg_r_lr_rem2 = 1124, misc_c_lr_rem3 = 1125,
exh_lr_rem1 = 1126, exh_lr_rem2 = 1127, rf_lr_bl1 = 1128, exh_lr_sv1 = 1129, rf_lr_sv1 = 1130, rf_lr_sv2 = 1131, exh_lr_sv2 = 1132,
wg_l_lr_sv = 1133, wg_l_lr_t1 = 1134, exh_lr_t2 = 1135, exh_lr_t1 = 1136, wg_r_lr_t1 = 1137, spl_a_s_b = 1138, spl_c_s_b = 1139,
rbmp_c_s = 1140, rbmp_a_s = 1141, bntr_b_ov = 1142, bntl_b_ov = 1143, bntr_b_sq = 1144, bntl_b_sq = 1145, spl_c_l_b = 1146,
spl_a_l_b = 1147, rbmp_c_l = 1148, rbmp_a_l = 1149, rbmp_a_f = 1150, rbmp_c_f = 1151, fbmp_c_f = 1152, fbmp_a_f = 1153,
rbmp_a_st = 1154, fbmp_a_st = 1155, rbmp_c_st = 1156, fbmp_c_st = 1157, spl_c_j_b = 1158, rbmp_a_j = 1159, fbmp_a_j = 1160,
rbmp_c_j = 1161, spl_a_j_b = 1162, spl_c_u_b = 1163, spl_a_u_b = 1164, fbmp_c_u = 1165, fbmp_a_u = 1166, rbmp_c_u = 1167,
rbmp_a_u = 1168, fbmp_a_s = 1169, fbmp_c_s = 1170, fbmp_a_l = 1171, fbmp_c_l = 1172, fbmp_c_j = 1173, fbmp_lr_br1 = 1174,
fbmp_lr_br2 = 1175, rbmp_lr_br1 = 1176, rbmp_lr_br2 = 1177, rbmp_lr_rem2 = 1178, fbmp_lr_rem1 = 1179, rbmp_lr_rem1 = 1180, fbmp_lr_bl2 = 1181,
fbmp_lr_bl1 = 1182, rbmp_lr_bl2 = 1183, rbmp_lr_bl1 = 1184, fbmp_lr_rem2 = 1185, rbmp_lr_sv2 = 1186, rbmp_lr_sv1 = 1187, fbmp_lr_sv2 = 1188,
fbmp_lr_sv1 = 1189, fbmp_lr_t2 = 1190, fbmp_lr_t1 = 1191, rbmp_lr_t1 = 1192, rbmp_lr_t2 = 1193
};
enum <ubyte> eCarCols {
black_, white_, police_car_blue_, cherry_red_, midnight_blue_, temple_curtain_purple_, taxi_yellow_, striking_blue_, light_blue_grey_,
hoods_, saxony_blue_poly_, concord_blue_poly_, jasper_green_poly_, pewter_gray_poly_, frost_white_, silver_stone_poly_1, rio_red_,
torino_red_pearl_, formula_red_, honey_beige_poly_, mariner_blue_, blaze_red_, classic_red_, winning_silver_poly_, steel_gray_poly_1,
shadow_silver_poly_, silver_stone_poly_2, warm_grey_mica_, harbor_blue_poly_, porcelain_silver_poly_, mellow_burgundy_, graceful_red_mica_,
currant_blue_poly_, gray_poly_, arctic_white_, anthracite_gray_poly_, black_poly_, dark_green_poly_, seafoam_poly_, diamond_blue_poly_,
biston_brown_poly_, desert_taupe_poly_, garnet_red_poly_, desert_red_, green_1, cabernet_red_poly_, light_ivory_, pueblo_beige_,
smoke_silver_poly_, astra_silver_poly_, ascot_gray_, agate_green_, petrol_blue_green_poly_, surf_blue_, nautical_blue_poly_, woodrose_poly_,
crystal_blue_poly_, bisque_frost_poly_, currant_red_solid_, lt_crystal_blue_poly_, lt_titanium_poly_, race_yellow_solid_,
brt_currant_red_poly_, clear_crystal_blue_frost_poly_, silver_poly_1, pastel_alabaster_, mid_currant_red_poly_, med_regatta_blue_poly_,
oxford_white_solid_, alabaster_solid_, elec_currant_red_poly_, spinnaker_blue_solid_, dk_titanium_poly_, pastel_alabaster_solid_,
med_cabernet_solid_, twilight_blue_poly_, titanium_frost_poly_, sandalwood_frost_poly_, wild_strawberry_poly_, ultra_blue_poly_,
vermilion_solid_, med_sandalwood_poly_, med_red_solid_, deep_jewel_green_, med_woodrose_poly_, vermillion_solid_, green_2, bright_blue_poly_1,
bright_red_1, lt_champagne_poly_, silver_poly_2, steel_blue_poly_, medium_gray_poly_, arctic_pearl_, nassau_blue_poly_, med_sapphire_blue_poly_,
silver_poly_3, lt_sapphire_blue_poly_1, malachite_poly_, flax_, med_maui_blue_poly_, dk_sapphire_blue_poly_, copper_beige_, bright_blue_poly_2,
med_flax_, med_gray_poly_, bright_blue_poly_3, lt_driftwood_poly_, blue_, steel_gray_poly_2, lt_beechwood_poly_, slate_gray_,
lt_sapphire_blue_poly_2, dk_beechwood_poly_, torch_red_, bright_red_2, med_sapphire_blue_firemist_, med_garnet_red_poly_, white_diamond_pearl_,
dk_sable_poly_, antelope_beige_, brilliant_red_poly_1, gun_metal_poly_, med_beechwood_poly_, brilliant_red_poly_2, bright_blue_poly_4, pink_,
random_ = 255
};
enum <ubyte> eBlipIcons {
SmallSquare, LargeSquare, PlayerPosition, Arrow, North, Airport, AmmuNation, Barber, BigSmoke, Docks, BurgerShot, Bulldozer,
Catalina, CesarViapando, Chicken, CarlJohnson, Crash, Dinner, Emmet, EnemyAttack, Fire, Girlfriend, Hospital, LocoSyndicate,
MaddDogg, Mafia, MCStrap, TuningShop, OGLoc, Pizza, Police, PropForSale, PropLocked, Race, Ryder, SaveDisk, School, Unknown,
Sweet, Tattoo, TheTruth, PlayerTarget, Toreno, Triads, TriadsCasino, Clothes, Woozie, Zero, Disco, Bar, Restaurant, Truck,
Robbery, StreetRace, Gym, Car, Light, Runway, AztecasGang, BallasGang, VagosGang, RifaGang, GroveGang, PayNSpray
};
enum <DWORD> ePedType {Player1, Player2, PlayerNetwork, PlayerUnused, Civmale, Civfemale, Cop,
Gang_1, Gang_2, Gang_3, Gang_4, Gang_5, Gang_6, Gang_7, Gang_8, Gang_9, Gang_10, Dealer,
Medic, Fireman, Criminal, Bum, Prostitute, Special,
Mission1, Mission2, Mission3, Mission4, Mission5, Mission6, Mission7, Mission8
};
enum <byte> ePopCycle {Business, Desert, Entertainment, Countryside, Residential_Rich, Residential_Average,
Residential_Poor, Gangland, Beach, Shopping, Park, Industry, Entertainment_Busy, Shopping_Busy,
Shopping_Posh, Residential_Rich_Secluded, Airport_, Golf_Club, Out_Of_Town_Factory, Airport_Runway};
enum <byte> eMonths {Jan = 1, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec };
enum <byte> eWeekdays {Mon, Tue, Wed, Thur, Fri, Sat, Sun};
enum <byte> eRadio {Emergency_Band, Playback_FM, KROSE, KDST, Bounce, SFUR, Radio_Los_Santos,
Radio_X, CSR, KJAH_West, Master_Sounds, WCTR, User_Track_Player, Radio_Off};
enum <byte> eBombType {NoBombs, FiveSecondDetonator, IgnitionUnarmed, RemoteDetonator, IgnitionArmed = 5};
enum <byte> eWeaponGroup {Disarmed, Melee, Handguns, Shotguns, Uzis, Assault, Rifles, Heavy, Thrown, Equipment, Gift, Other, Detonation};
enum <byte> eObjectType {Unbreakable = 1, Breakable, ComplexBreakable, NonBreakable};
enum <ubyte> eBlipColor {Red, Green, Cyan, White, Yellow, purple, cyan, FriendFoe, Destination};
enum <WORD> eBlipType {None_, VehicleBlip, ActorBlip, ObjectBlip, DestinationBlip, ContactBlip, SpotlightBlip, PickupBlip, AirstripBlip};
enum <byte> eByteFlags {Disabled = 0, Enabled = 1};
enum <WORD> eWordFlags {_Disabled = 0, _Enabled = 1};
enum <DWORD> eIntFlags {Disabled_ = 0, Enabled_ = 1};
enum <byte> eGangs {_Ballas, _GroveSt, _Vagos, _Rifa, _DaNang, _Mafia, _Triad, _Aztecas, _Gang9, _Gang10};
//***************************************************************************************
// END TEMPLATE ENUMS ------------------------------------------------------------------------------------------
// START LOCAL VARIABLE TABLE ----------------------------------------------------------------------------------
// Template Variables
local int isPC = 0; // reworked so everything defaults to PC settings if other checks fail
local int isMobile = 0; // one of many types of mobile saves
local int isPS2 = 0; // unique rules for PS2
local int isWideChar = 0; // wide character save name fields for Mobile and PS2J
local int isSlot10 = 0; // recheck use
//local int isCheckpointSave = 0; // replaced by isMissionSave
local int isMissionThread = 0; // recheck use
local int isMissionSave = 0; // need local var standard
local int is_train = 0; // vehicle exception
local int no_damageManager = 0; // some vehicles don't have a damage manager
// SAVE TYPE ADJUSTMENTS
//if (ReadString(317, 5) == "BLOCK") isPC = 1;
if (ReadString(333, 5) == "BLOCK") isPS2 = 1;
if (ReadInt(46516) == 2FC86h) isPS2 = 1, isWideChar = 1; // isPS2J = 1
if (FileSize() == 195000) isMobile = 1, isWideChar = 1;
if (FileSize() == 260000) isSlot10 = 1, isMobile = 1, isWideChar = 1;
if (FileSize() == 325000) isMissionSave = 1, isMobile = 1, isWideChar = 1;
if (FileSize() == 390000) isMissionSave = 1, isMobile = 1, isWideChar = 1;
if (isPS2 != 1 && isMobile != 1) isPC = 1; // defaults to PC
// Standard limits
local int maxLocals = 32;
local int maxBlips = 175;
local int radio_messages = 128;
local int nModels = 26316;
local int nStations = 14;
// mobile limits adjustment
if (isMobile == 1) {
maxLocals = 40,
maxBlips = 250;
}
// PS2 limits adjustments
if (isPS2 == 1) {
radio_messages = 124,
nModels = 20006,
nStations = 13;
}
// END LOCAL VARIABLE TABLE ------------------------------------------------------------------------------------
// START COMMON STRUCTS ----------------------------------------------------------------------------------------
// SUB-STRUCTS **********************************************************************************
struct RwV3D {
float X,Y,Z;
};
struct RGBA {
byte red <format=hex>, green <format=hex>, blue <format=hex>, alpha <format=hex>;
};
struct RGBAblip {
eBlipColor alpha <format=hex,comment="Color code or alpha for RGB colors">;
byte blue <format=hex>, green <format=hex>, red <format=hex>;
};
struct Vec4 {
float X;
float Y;
float Z;
int dummy;
};
struct CMatrix {
Vec4 right;
Vec4 forward;
Vec4 up;
Vec4 pos;
};
// MOBILE STRUCTS *******************************************************************************
struct DamageManager {
float state0;
int state1;
int state2;
int state3;
int state4;
int state5;
};
struct Passengers {
int chunk36;
int chunk37;
int chunk38;
int chunk39;
int chunk40;
int chunk41;
int chunk42;
int chunk43;
};
struct tVehicle {
int handle;
eCarID modelID;
int size;
CMatrix matrix;
// RwV3D pos;
// uint chunk18 <format=hex>;
int chunk19;
int chunk20;
eRadio radio;
eCarCols primaryColor;
eCarCols secondaryColor;
eCarCols tertiaryColor;
eCarCols quaternaryColor;
ubyte _align;
WORD alarmState;
int nPassengers;
float wheelState;
float gasPedalState;
float breakPedalState;
int vehicleFlagsA <format=hex>;
int vehicleFlagsB <format=hex>;
float health;
int doorLock;
ubyte physicalFlagA <format=hex>;
ubyte physicalFlagB <format=hex>;
ubyte immunities <format=hex>;
ubyte physicalFlagD <format=hex>;
float mass;
float turnmass;
float buoyancy;
//EXCEPTIONS
no_damageManager = 0, is_train = 0; // reset
//Bikes
if (modelID == 581 // bf400
|| modelID == 523 // copbike
|| modelID == 462 // faggio
|| modelID == 521 // fcr900
|| modelID == 463 // freeway
|| modelID == 522 // nrg500
|| modelID == 461 // pcj600
|| modelID == 448 // pizzaboy
|| modelID == 468 // sanchez
|| modelID == 586 // wayfarer
) no_damageManager = 1;
//Bicycles
if (modelID == 509 // bike
|| modelID == 481 // bmx
|| modelID == 510 // mtbike
) no_damageManager = 1;
//Boats
if (modelID == 472 // coastg
|| modelID == 473 // dinghy
|| modelID == 493 // jetmax
|| modelID == 595 // launch
|| modelID == 484 // marquis
|| modelID == 430 // predator
|| modelID == 453 // reefer
|| modelID == 452 // speeder
|| modelID == 446 // squalo
|| modelID == 454 // tropic
) no_damageManager = 1;
//Trains
if (modelID == 590 // freibox
|| modelID == 569 // freiflat
|| modelID == 537 // freight
|| modelID == 538 // streak
|| modelID == 570 // streakc
|| modelID == 449 // tram
) no_damageManager = 1, is_train = 1;
if (is_train == 1) {
struct train {
ubyte bMissionTrain;
byte bDisableMissionTrains;
}info;
}
if (no_damageManager != 1) DamageManager damagedState;
int driverHandle <format=hex>;
Passengers pedHandle;
};
// MOBILE TASK STRUCTS **************************************************************************
struct tScriptSequenceTask {
byte bUsed;
char __gap1[1];
WORD nIndex;
};
struct CPointRoute {
int nNumPoints;
RwV3D vPoints[8];
};
struct CPatrolRoute {
char unk[420];
};
struct tTask {
int nTaskType;
switch (nTaskType) {
case 0: //CTaskSimplePlayerOnFoot
break;
case 202: //CTaskSimplePause
int nPauseTime;
break;
case 203: //CTaskSimpleStandStill
break;
case 204: //CTaskSimpleSetStayInSamePlace
char unk_8;
break;
case 208: //CTaskComplexFallAndGetUp
int nAnimId;
int nAssocId;
int unk_20;
break;
case 211: //CTaskComplexJump
int unk_12;
break;
case 212: //CTaskSimpleDie
break;
case 217: //CTaskComplexDie
int unk_12;
int unk_16;
int unk_20;
int unk_24;
int unk_28;
int unk_36;
break;
case 219: //CTaskSimpleTired
int unk_12;
break;
case 223: //CTaskComplexSitDownThenIdleThenStandUp
int unk_12;
char unk_16;
char unk_17;
break;
case 240: //CTaskComplexInAirAndLand
char unk_12;
char unk_13;
break;
case 243: //CTaskComplexBeInGroup
int pedHandle;
int unk_12;
char unk_16;
break;
case 244: //CTaskComplexSequence
break;
case 267: //CTaskComplexClimb
break;
case 269: //CTaskSimpleTriggerLookAt
int targetPedHandle;
int unk_12;
int unk_16;
RwV3D unk_20;
char unk_32;
int unk_36;
int unk_40;
char bHasEntityTarget;
char unk_45;
break;
case 271: //CTaskSimpleSetCharDecisionMaker
int unk_8;
break;
case 275: //CTaskComplexUseSequence
int unk_12;
int unk_16;
int unk_20;
break;
case 276: //CTaskSimpleSetKindaStayInSamePlace
char bFlags;
break;
case 306: //CTaskSimpleAffectSecondaryBehaviour
break;
case 310: //CTaskComplexGoPickUpEntity
int targetEntityType;
if (targetEntityType == 2 || targetEntityType == 3 || targetEntityType == 4) int entityHandle;
int unk_44;
break;
case 401: //CTaskSimpleRunNamedAnim
char animName[24];
char animBlock[16];
int unk_92;
float unk_56;
int unk_64;
break;
case 412: //CTaskSimpleCower
break;
case 415: //CTaskSimpleDuck
char unk_36;
short unk_12;
short unk_14;
break;
case 420: //CTaskSimpleUseAtm
break;
case 421: //CTaskSimpleScratchHead
break;
case 422: //CTaskSimpleLookAbout
int unk_32;
break;
case 504: //CTaskComplexEvasiveDiveAndGetUp
int vehicleHandle;
int unk_16;
RwV3D unk_20;
char unk_32;
break;
case 513: //CTaskComplexDiveFromAttachedEntityAndGetUp
int unk_16;
break;
case 704: //CTaskComplexLeaveCar
int vehicleHandle;
int unk_16;
int unk_20;
char unk_24;
char unk_25;
break;
case 706: //CTaskComplexLeaveCarAndFlee
int vehicleHandle;
RwV3D target;
int unk_16;
int unk_32;
char unk_36;
break;
case 709: //CTaskSimpleCarDrive
int vehicleHandle;
break;
case 710: //CTaskComplexDriveToPoint
int vehicleHandle;
RwV3D target;
int unk_16;
int unk_48;
int unk_20;
int unk_52;
int unk_24;
break;
case 711: //CTaskComplexCarDriveWander
int vehicleHandle;
int unk_24;
int unk_16;
break;
case 712: //CTaskComplexEnterCarAsPassengerTimed
int targetVehicleHandle;
break;
case 713: //CTaskComplexEnterCarAsDriverTimed
int targetVehicleHandle;
break;
case 714: //CTaskComplexLeaveAnyCar
int unk_12;
char unk_16;
char unk_17;
break;
case 720: //CTaskComplexShuffleSeats
int vehicleHandle;
break;
case 721: //CTaskComplexDrivePointRoute
int vehicleHandle;
CPointRoute pointRoute;
float unk_20;
int unk_24;
int unk_28;
float unk_32;
int unk_36;
break;
case 723: //CTaskSimpleCarSetTempAction
int vehicleHandle;
int unk_96;
int unk_100;
break;
case 724: //CTaskComplexCarDriveMission
int vehicleHandle;
int targetEntityType;
if (targetEntityType == 2 || targetEntityType == 3 || targetEntityType == 4) int targetEntityHandle;
int unk_40;
break;
case 811: //CTaskSimpleCarSetPedInAsPassenger
break;
case 812: //CTaskSimpleCarSetPedInAsDriver
break;
case 901: //CTaskComplexGoToPointShooting
int unk_12;
RwV3D unk_vec32;
int targetType;
if (targetType == 2 || targetType == 3 || targetType == 4) int targetHandle;
RwV3D unk_vec20;
float unk_44;
float unk_48;
break;
case 902: //CTaskSimpleAchieveHeading
float unk_8;
float unk_12;
float unk_16;
break;
case 903: //CTaskComplexGoToPointAndStandStill
int unk_12;
RwV3D vTarget;
int unk_28;
int unk_32;
break;
case 905: //CTaskComplexFollowPointRoute
int unk_20;
CPointRoute route;
int unk_12;
int unk_24;
int unk_28;
char unk_fl40_1;
char unk_fl40_2;
char unk_fl40_3;
break;
case 906: //CTaskComplexFollowNodeRoute
int unk_24;
RwV3D unk_12;
float unk_28;
float unk_32;
float unk_36;
int flag_76_0;
int unk_60;
int flag_76_3;
break;
case 907: //CTaskComplexSeekEntity
Printf("This task isn't expected to be analyzed here\n");
break;
case 908: //CTaskComplexFleePoint
break;
case 909: //CTaskComplexFleeEntity
break;
case 911: //CTaskComplexSmartFleeEntity
int entityType;
if (entityType == 2 || entityType == 3 || entityType == 4) int entityHandle;
break;
case 912: //CTaskComplexWander
break;
case 918: //CTaskComplexGoToPointAnyMeans
RwV3D target;
int unk_24;
float unk_28;
int unk_vehicleHandle;
int unk_36;
break;
case 920: //CTaskComplexTurnToFaceEntityOrCoord
int targetEntityType;
if (targetEntityType == 2 || targetEntityType == 3) int targetEntityHandle;
char unk_16;
RwV3D targetPos;
break;
case 924: //CTaskComplexGoToPointAiming
int unk_12;
int unk_entityType;
if (unk_entityType == 2 || unk_entityType == 3 || unk_entityType == 4) int unk_entityHandle;
RwV3D unk_20;
RwV3D unk_32;
break;
case 927: //CTaskComplexFleeAnyMeans
int unk_entityType;
if (unk_entityType == 2 || unk_entityType == 3 || unk_entityType == 4) int unk_entityHandle;
char unk_64;
float unk_32;
int unk_28;
int unk_68;
int unk_72;
float unk_76;
int unk_40;
float unk_44;
break;
case 931: //CTaskComplexFollowPatrolRoute
short unk_16;
CPatrolRoute patrolRoute;
short unk_12;
float unk_20;
float unk_24;
break;
case 933: //CTaskComplexSeekEntityAiming
int targetEntityType;
if (targetEntityType == 2 || targetEntityType == 3 || targetEntityType == 4) int targetEntityHandle;
float unk_16;
float unk_20;
break;
case 936: //CTaskComplexFollowPedFootsteps
break;
case 1000: //CTaskComplexKillPedOnFoot
int pedHandle;
break;
case 1003: //CTaskComplexDestroyCar
int targetHandle;
int unk_20;
int unk_24;
int unk_28;
break;
case 1020: //CTaskSimpleGunControl
int unk_entityType;
if (unk_entityType == 2 || unk_entityType == 3) int unk_entityHandle;
RwV3D unk_vec16;
RwV3D unk_vec28;
break;
case 1022: //CTaskSimpleGangDriveBy
int unk_entityType;
if (unk_entityType == 2 || unk_entityType == 3) int unk_entityHandle;
RwV3D unk_56;
int unk_32;
char unk_19;
char unk_18;
char unk_10;
break;
case 1033: //CTaskSimpleSetCharIgnoreWeaponRangeFlag
break;
case 1101: //CTaskComplexArrestPed
break;
case 1203: //CTaskComplexPartnerGreet
break;
case 1204: //CTaskComplexPartnerChat
int nParnterHandle;
char commandSource[32];
char unk_88;
float unk_60;
char unk_91;
char unk_114;
char unk_115;
RwV3D unk_64;
break;
case 1208: //CTaskComplexWalkAlongsidePed
break;
case 1210: //CTaskComplexSignalAtPed
break;
case 1301: //CTaskSimpleTogglePedThreatScanner
char unk_8;
char unk_9;
char unk_10;
break;
case 1303: //CTaskSimpleJetpack
RwV3D unk_72;
float unk_84;
int unk_88;
int unk_entityType;
if (unk_entityType == 2 || unk_entityType == 3 || unk_entityType == 4) int unk_entityHandle;
break;
case 1304: //CTaskSimpleSwim
int unk_pedHandle;
RwV3D unk_20;
break;
case 1306: //CTaskSimpleDuckToggle
int unk_8;
break;
case 1600: //CTaskComplexUseMobilePhone
int unk_12;
break;
default:
Printf("unknown type: %d\n", nTaskType);
}
};
struct tTaskComplexSeekEntity {
int nTemplateClass;
int nTaskType;
int entityType;
if (entityType == 2 || entityType == 3 || entityType == 4) int entityHandle;
};
struct tTaskShell {
int nType;
if (nType == 907)
{
tTaskComplexSeekEntity task;
}
else if (nType != -1)
{
tTask task;
}
};
struct tTaskSequence {
tTaskShell tasks[8]<optimize=false>;
};
struct tEvent {
int nEvent;
if (nEvent == 32) tTask eventTask;
};
struct tPedIntelligence {
int nHandle;
if (nHandle != -1){
int nTasks;
if (nTasks > 0) tTaskShell tasks[5]<optimize=false>;
tEvent events[16]<optimize=false>;
}
};
struct tPedGroup {
int unk_ref;
char unk_4;
int unk;
int leader_ref;
int members_ref[8];
};
struct tPedGroups {
char pedGroupActive[8];
char pedGroupReferenceIndex[8];
local int i = 0;
for (i = 0; i < 8; i++){
if (pedGroupActive[i]) tPedGroup pedGroup;
}
};
struct COnscreenTimerEntry {
int m_nOffset;
char m_abName[10];
char m_abString[42];
char field_56;
char m_bRequireBeeps;
char gap_58[2];
int m_nBeepLimit;
};
struct COnscreenCounterEntry {
int m_nOffset1;
int m_nOffset2;
char m_abName[10];
short field_18;
char m_abTempString[38];
char field_58;
char field_59;
char field_60;
char field_61;
char field_62;
char m_bFlashOnDisplay;
char m_nColourID;
char gap_65[3];
};
struct tPedScriptedTaskRecord {
int nCommandId;
if (nCommandId != -1){
int nStatus;
int nPedHandle;
tEvent event;
}
};
struct CAEMissionAudio {
RwV3D m_vecPos;
int m_pPhysical<format=hex>;
int m_pSound<format=hex>;
int m_eEvent;
int m_eBank;
int m_nSound;
};
struct tEntityWaitingForBrain {
int nType;
if (nType != 0) int handle;
short wID;
};
struct CDecision {
int taskTypes[6];
unsigned char responseChances[24];
unsigned char typeFlags[12];
};
struct CDecisionMaker {
CDecision m_asDecisions[41];
};
struct CDecisionMakerTypes {
int unk_0;
CDecisionMaker m_asDecisionMakers[20];
char unk_49204[384];
CDecisionMaker field_49588;
CDecisionMaker field_52048;
CDecisionMaker field_54508;
CDecisionMaker field_56968;
CDecisionMaker field_59428;
};
// STAMDARD STRUCTS *****************************************************************************
struct gameTime {
eMonths month;
byte monthDay;
byte hour, minute;
};
struct tExternalScriptTrigger {
short index;
byte attachType;
byte type;
int status;
float radius;
short modelID;
short priority;
int unknown;
};
struct tThread {
short index;
/* Script Thread */
if (isMobile==1) int streamedScriptIndex <format=hex>;
if (index < 0) {
isMissionThread = 1;
byte missionCode[69000];
DWORD localvar[1024];
}
int pNext <format=hex>, pPrev <format=hex>;
char name[8];
int baseIP <format=hex>;
int currentIP <format=hex>;
int returnStack[8] <format=hex>;
short stackID;
short __gap1;
int locals[maxLocals];
int timers[2];
byte isActive;
byte ifResult;
byte usesMissionCleanup;
byte isExternal;
byte overridesTextbox;
byte scriptAttachType;
byte unknown3[2];
int wakeupTime;
short ifNumber;
byte notFlag;
byte WBcheckActive;
byte isWantedBusted;
byte unknown4[3];
int skipScenePos;
byte isMission;
byte __gap[3];
/* Relative Addresses */
int relativeIP <format=hex>;
int relativeReturnStack[8] <format=hex>;
};
struct tHandlingFlags {
/*1st*/ eIntFlags _1G_Boost:1; eIntFlags _2G_Boost:1; eIntFlags NPC_Anti_Roll:1; eIntFlags NPC_Neutral_Handl:1;
/*2nd*/ eIntFlags No_Handbrake:1; eIntFlags Steer_Rearwheels:1; eIntFlags HB_Rearwheel_Steer:1; eIntFlags Alt_Steer_Opt:1;
/*3rd*/ eIntFlags Wheel_F_Narrow2:1; eIntFlags Wheel_F_Narrow:1; eIntFlags Wheel_F_Wide:1; eIntFlags Wheel_F_Wide2:1;
/*4th*/ eIntFlags Wheel_R_Narrow2:1; eIntFlags Wheel_R_Narrow:1; eIntFlags Wheel_R_Wide:1; eIntFlags Wheel_R_Wide2:1;
/*5th*/ eIntFlags Hydraulic_Geom:1; eIntFlags Hydraulic_Inst:1; eIntFlags Hydraulic_None:1; eIntFlags NOS_Inst:1;
/*6th*/ eIntFlags Offroad_Ability:1; eIntFlags Offroad_Ability2:1; eIntFlags Halogen_Lights:1; eIntFlags Proc_Rearwheel_1st:1;
/*7th*/ eIntFlags Use_MaxSP_Limit:1; eIntFlags Low_Rider:1; eIntFlags Street_Racer:2;
/*8th*/ eIntFlags Swinging_Chassis:4;
};
struct tCarFlags {
eByteFlags BulletProof : 1; eByteFlags FireProof : 1; eByteFlags ExplosionProof : 1; eByteFlags CollisionProof : 1;
eByteFlags MeleeProof : 1; eByteFlags BassBoost : 1; eByteFlags Hydraulics : 1; eByteFlags Nitrous : 1;
};
struct tGarageVehiclesTown {
struct tGarageVehicle {
RwV3D pos;
tHandlingFlags HandlingFlags<format=hex>;
tCarFlags CarFlags<format=binary>;
byte unknown1;
eVehID modelID;
eVehicleMods vehicleMods[15];
eCarCols colors[4];
eRadio radioStation;
byte vehicleVariation[2];
eBombType bombType;
byte paintJob;
byte nNitrous;
ubyte vecRotation[3];
byte align;
} vehicle[20];
};
struct tPickupFlags {
eByteFlags UsedPickup : 1; eByteFlags droppedPickup : 1; eByteFlags switchedPickup : 1; eByteFlags CollectedPickup : 1;
eByteFlags PropertyLocked : 1; eByteFlags PropertyForSale : 3;
};
struct tPickup {
float assetValue;
DWORD pObject<format=hex>;
DWORD maxAssetValue;
DWORD _timer;
WORD pos[3];/*all multiplied by 8*/;
WORD assetRate;
ePickupID modelID;
WORD index;
ePickupType type;
tPickupFlags flags<format=binary>;
byte __gap[2];
};
struct tWeapon {
WeaponNum type;
DWORD _state;
DWORD unknown_ammo;
DWORD ammo;
DWORD _shots;
byte unknown[8];
};
struct PlayerExt {
DWORD _size2<format=hex>;
int chaos;
byte wantedLevel;
byte __gap3[3];
DWORD texturesCRC[28]<format=hex>;
float fat, muscle;
eWeaponGroup WeaponGroup <comment="Overrides WeaponGroup for tPed struct">;
byte __gap4[3];
if (isMobile==1) float MoveBlendRatio;
};
struct tPed {
DWORD handle;
int modelID;
ePedType PedType;
if (modelID >= 290 && modelID <= 299) char modelName[9];
DWORD _size1<format=hex>;
RwV3D pos;
if (isMobile==1) uint unknown_mobileP<format=hex>;
float health, armor;
tWeapon weapons[13];
byte ref;
eWeaponGroup WeaponGroup <comment="Change Player's WeaponGroup in extention">;
byte unknown;
byte __gap1;
if (isMobile==1) byte unknownmobile1[12];
int unknown_enex;
byte unknown_melee1;
byte unknown_melee2;
byte __gap2[2];
if (isMobile==1) byte unknownmobile2[8];
if (PedType == 0) PlayerExt extend <optimize=false>;
};
struct tObject {
DWORD handle;
int modelID;
DWORD _size;
RwV3D pos;
byte pos_right[3];
byte pos_top[3];
int unknownModel0;
int unknownModel1;
byte unknown[6];
int entityFlags;
int unknownModel2;
int objectFlags;
eObjectType objectType;
byte colDamageEffect;
byte cStoredColDamageEffect;
byte physicalFlags;
if (isMobile==1) WORD unknownMobile1;
if (isMobile==1) WORD unknownMobile2;
};
struct tGarageFlags {
eWordFlags IsDoorOpen : 8;
eWordFlags usedModShop : 1;
eWordFlags InactiveDoor : 1;
eWordFlags usedPnS : 1;
eWordFlags SmallDoor : 1;
eWordFlags UpAndInDoor : 1;
eWordFlags CameraFollowsPlayer : 1;
eWordFlags IsDoorClosed : 1;
eWordFlags GirlfriendPnS : 1;
};
struct tGarage {
byte type;
tGarageFlags GarageFlags;
byte __gap1;
float llX, llY;
float zFloor;
float rotQuaternion[4]; /*Rx, Ry, Rz, Rw*/
float zCeiling;
float width; /* dimension parallel to door in xy plane */
float depth; /* dimension parallel to door in xy plane */
float minX, maxX;
float minY, manY;
float doorState; /* 1 - is open */
float _door_timer;
char garageName[8];
WORD unknown; /* Possibly Original Type */
byte __gap2[2];
};
struct tRestart {
RwV3D location;
float angle;
int town;
};
struct tBlipFlags {
eWordFlags BrightColors : 1;
eWordFlags Allocated : 1;
eWordFlags LongDistance : 1;
eWordFlags IsFriendly : 1;
eWordFlags WithoutEntity : 2;
eWordFlags IsThreat : 1;
eWordFlags IsFriend : 1;
eWordFlags MarkEntity : 1;
eWordFlags OnRadar : 1;
};
struct tRadar {
RGBAblip color;
DWORD entityHandle;
RwV3D pos;
WORD blipCounter;
WORD __gap1;
float radius;
WORD size;
WORD __gap2;
DWORD enexOrdinal;
eBlipIcons iconID;
tBlipFlags Flags;
eBlipType Type : 6;
byte __gap3;
};
struct tZoneInfo {
char name[8];
char zoneGxt[8];
short x1, y1, z1;
short x2, y2, z2;
WORD id;
byte type;
byte island;
};
struct tEthnicFlags {
eByteFlags BlackPeds : 1;
eByteFlags WhitePeds : 1;
eByteFlags AsianPeds : 1;
eByteFlags HispanicPeds : 5;
};
struct tZonePop {
byte gangDensity[10];
byte dealerDensity;
RGBA color;
ePopCycle PopCycle;
tEthnicFlags EthnicFlags;
};
struct tCarGenerator {
WORD index;
eVehID modelID;
eCarCols colors[2];
WORD x,y,z;
byte angle;
byte alarmChance;
byte lockChance;
byte unused_cargenflag : 1;
eByteFlags Force_Spawn : 2;
eByteFlags Player_Owned : 5;
WORD unknown1;
WORD unusedDelay;
WORD __gap1;
DWORD timer;
short unknown2;
short nCarsToGenerate;
byte iplStream;
byte allocated;
WORD __gap2;
};
struct tblockHeader {
SetBackColor(cDkGreen);
SetForeColor(cWhite);
char Sig[5];
SetBackColor(cNone);
SetForeColor(cNone);
if(Sig != "BLOCK")
{
Warning("Not a valid BLOCK signature");
return -1;
}
};
//***************************************************************************************
//***************************************************************************************
// END COMMON STRUCTS -----------------------------------------------------------------------------------------
//*******************************************************************************************************************
//*******************************************************************************************************************
// START OF SAVE TEMPLATE -------------------------------------------------------------------------------------
// Block 0: Simple Vars
tblockHeader header <hidden=true>;
struct tBlock00 {
uint version <format=hex>;
if (isWideChar==1)
wchar_t saveName[100];
else
char saveName[100];
byte missionPack;
byte __gap1[3];
uint currentTown;
RwV3D cameraPos;
uint gameMinuteLength;
int weatherTimer;
gameTime currentTime;
eWeekdays weekday;
gameTime timeCopy;
byte booltimeCopy;
WORD padMode;
byte boolHasEverCheated;
byte __gap2[3];
DWORD globalTimer;
float gamespeed;
float frameDeltaTime;
float _ticktime;
DWORD nFramesProcessed;
short previousWeatherID;
short currentWeatherID;
short forcedWeatherID;
WORD __gap3;
DWORD weatherInterpolationValue;
DWORD weatherTypeInList;
float amountOfRain;
int vehicleCamView;
int onFootCamView;
int currentInterior;
byte invertLook;
byte __gap4[3];
DWORD _originalInteriorColor<format=hex>;
byte colorToggleState;
byte __gap5[3];
DWORD colorInterpolationValue;
DWORD colorWeatherID;
DWORD currentWaterConfig;
byte bRiotFlag;
byte unknownRiot;
WORD __gap6;
DWORD maxWantedLevel, maxChaos;
byte isFrenchLang;
byte isGermanLang;
byte censorFlag;
byte __gap7;
DWORD unknownA[11] <format=hex>;
byte __gap8;
byte cinematicCamHelpLeft;
struct SYSTEMTIME {
WORD wYear, wMonth, wDayOfWeek, wDay, wHour, wMinute, wSecond, wMilliseconds;
} systemTime;
DWORD targetMarkerHandle<format=hex>;
if (isMobile==1) byte _unknown15[14];
if (isPC==1) byte _unknown15[2];
if (isPS2==1) byte _unknown15[18];
byte boolVehicleStealingHelpShown;
byte boolAllTaxisWithNitro;
byte boolProstitutesPayYou;
if (isMobile==1) byte _gap9[5];
if (isPC==1) byte _gap9;
if (isPS2==1) byte _gap9;
} SimpleVars;
// Block 1: Script
tblockHeader header <hidden=true>;
struct tBlock01 {
int varSpaceSize;
int globalVar[varSpaceSize/4];
tExternalScriptTrigger trigger[70];
int onMissionFlagOffset;
int lastMissionTime;
struct tStaticReplacement {
DWORD type; /*always 2*/
int handle;
int newModelID, oldModelID;
} staticReplacement[25];
struct tInvisibleObject {
int type, handle;
} invisibleObject[20];
int disabledCarparkingModels[20];
struct tLodAssignment {
int objHandle, lodHandle;
} LodAssignment[10];
struct tScriptAssignment {
int actorModelID;
char scriptName[8];
DWORD unknown[2];
} ScriptAssignment[8];
byte unknown1, unknown2;
int scmMainSize;
int largestMissionSize;
int missionsNumber;
int highestLocalVariable;
int nRunningThreads;
if (isMobile == 1) int SaveGameStateType;
struct Running {
tThread thread[nRunningThreads] <optimize=false>;
} threads;
if (isMobile == 1) {
WORD resourcesCount; // nRecords
struct tResourceManager {
struct tResource {
WORD index;
WORD scriptIndex;
int resourceID;
WORD type;
if (type == 2 && resourceID >= 290 && 299 >= resourceID) {
int length;
char specialModelName[length];
}
} Resource[resourcesCount] <optimize=false>;
} ResourceManager;
int isOddJob;
if (isMissionThread == 1 && isOddJob != 1) {
char missionText[8];
int missionReplaySetting;
}
}
} Script;
// Block 2: Pools
tblockHeader header <hidden=true>;
struct tBlock02 {
int nPeds;
struct Ped {
tPed peds[nPeds] <optimize=false>;
} Pool;
if (isMobile==1) {
int nVehicles;
struct Mission {
tVehicle vehicles[nVehicles]<optimize=false>;
} Vehicles;
int playerVehicleHandle1;
int cameraTargetEntityType;
int cameraTargetHandle;
int playerVehicleHandle2;
}
if (isMissionSave == 1 ){
//CPools::SavePedTasks
tScriptSequenceTask sSequenceTasks[64];
byte bIsSequenceTaskOpen[64];
struct Task {
tTaskSequence nSequenceTasks[64]<optimize=false>;
} Sequences;
int nPedInts;
struct Pedestrian {
tPedIntelligence pedint[nPedInts]<optimize=false>;
} Intelligence;
//CPedGroups::Save
tPedGroups pedGroups;
//CDecisionMakerTypes::Save
char decisionMakerIsActive[20];
short decisionMakerReferenceIndex[20];
char decisionMakerTypes[20];
CDecisionMakerTypes decisionMaker;
//COnscreenTimer::Save
COnscreenTimerEntry timer;
COnscreenCounterEntry counters[4];
//CPedScriptedTaskRecord::Save
struct Scripted {
tPedScriptedTaskRecord scriptedTasks[128]<optimize=false>;
} Tasks;
//CAudioEngine::Save
CAEMissionAudio missionAudio[4];
//SaveSomeStaticSettings
float carDensityMultiplier;
char bAllowEmergencyServicesToBeCreated;
float pedDensityMultiplier;
}
int nObjects;
tObject objects[nObjects] <optimize=true>;
if (isMissionSave == 1){
char bDontCreateRandomGangMembers;
char bOnlyCreateRandomGangMembers;
struct Waiting_For {
tEntityWaitingForBrain entitiesWaitingForBrain[150]<optimize=false>;
} Brains;
}
} Pools;
// Block 3: Garages
tblockHeader header <hidden=true>;
struct tBlock03 {
int nGarages;
byte freeBombs, freeResprays;
byte respraysDisabled;
DWORD _unusedCarsCollected;
DWORD _unusedBankVansCollected;
DWORD _unusedPoliceCarsCollected;
DWORD _unusedCarTypesCollected[4];
DWORD timeGarageHelpShown;
tGarageVehiclesTown GrgCar[4];
tGarage Garage[nGarages];
} Garages;
// Block 4: Game Logic
tblockHeader header <hidden=true>;
struct tBlock04 {
int nAfterDeathStartPoints;
byte boolLoseStuffAfterWasted, boolLoseStuffAfterBusted;
byte gameState;
DWORD timeOfEvent;
if (nAfterDeathStartPoints > 0) struct tAfterDeathStart {
RwV3D pos;
float angle;
} point[nAfterDeathStartPoints];
} GameLogic;
// Block 5: Paths
tblockHeader header <hidden=true>;
struct tBlock05 {
int nEntries;
struct tBlock5Chunk {
float unknown[6];
byte flags[4];
} chunks[nEntries];
} Paths;
// Block 6: Pickups
tblockHeader header <hidden=true>;
struct tBlock06 {
tPickup pickups[620];
WORD nPickupsPickedUp;
byte weaponPickupMessageCounter;
DWORD pickupsPickedUpHandles[20]<format=hex>;
} Pickups;
// Block 7: Phone Info (UNUSED)
tblockHeader header <hidden=true>;
struct tBlock07_Unused {
} PhoneInfo;
// Block 8: Restart locations
tblockHeader header <hidden=true>;
struct tBlock08 {
WORD nWastedRestarts;
tRestart wastedRestarts[nWastedRestarts];
WORD nBustedRestarts;
tRestart bustedRestarts[nBustedRestarts];
byte overrideRestart;
RwV3D overrideRestartPos;
byte fadeInAfterDeath;
byte fadeInAfterArrest;
RwV3D overrideHospitalPos;
float overrideHospitalRadius;
float overrideHospitalheading;
RwV3D overridePolicePos;
float overridePoliceRadius;
float overridePoliceheading;
} RestartLocations;
// Block 9: Radar Blips
tblockHeader header <hidden=true>;
struct tBlock09 {
tRadar blip[maxBlips];
} RadarBlips;
// Block 10: Zones
tblockHeader header <hidden=true>;
struct tBlock10 {
int currentTown;
WORD nZoneInfo1Entries;
WORD nZonePopEntries;
WORD nZoneInfo2Entries;
tZoneInfo zoneInfo1[nZoneInfo1Entries];
tZonePop zonePop[nZonePopEntries];
tZoneInfo zoneInfo2[nZoneInfo2Entries];
byte boolMapFogFlags[100];
int nOpenedMapSectors;
} Zones;
// Block 11: Gangs Info
tblockHeader header <hidden=true>;
struct tBlock11 {
struct tGangInfo {
int unusedPedOverride;
WeaponNum weaponID[3];
} gangID[10];
} GangInfo;
// Block 12: Car Generators
tblockHeader header <hidden=true>;
struct tBlock12 {
int nCarGenerators;
byte unknown1;
byte unknown2;
tCarGenerator carGenerators[nCarGenerators];
int nNumplatesUsed;
struct tNumplate {
int carGeneratorIndex;
char numplate[8];
byte unknown[4];
} numplates[15];
} CarGenerators;
// Block 13: Ped Generators (UNUSED)
tblockHeader header <hidden=true>;
struct tBlock13_Unused {
} PedGenerators;
// Block 14: Audio Script Object (UNUSED)
tblockHeader header <hidden=true>;
struct tBlock14_Unused {
} AudioScriptObject;
// Block 15: Player Data
tblockHeader header <hidden=true>;
struct tBlock15 {
DWORD _size;
int money;
WORD unknown1;
byte boolWBflag;
byte __gap1;
float unknown2;
int moneyOnScreen;
byte unknown3;
byte __gap2[3];
int hiddenPackagesLeft;
int totalHiddenPackages;
byte boolInfiniteRun;
byte boolFastReload;
byte boolFireProof;
ubyte maxHealth;
ubyte maxArmor;
byte boolFreeBustedOnce;
byte boolFreeWastedOnce;
byte boolEnableDriveby;
byte unknown4;
byte __gap3;
WORD unknown5;
} PlayerData;
// Block 16: Stats
tblockHeader header <hidden=true>;
struct tBlock16 {
float fStats[82];
int iStats[223];
DWORD nPedsKilled[32];
char lastMission[8];
DWORD nStationPlayed[14];
DWORD nMissionAttempts[100];
byte bStatMessageDisplayed[radio_messages];
} Stats;
// Block 17: Set Pieces
tblockHeader header <hidden=true>;
struct tBlock17 {
int setPiecesUsed;
struct tPoint
{
WORD x,y;
};
struct tSetPieces
{
DWORD lastActivationTime;
tPoint zonePoint1, zonePoint2;
tPoint policeVehicleAStart;
tPoint policeVehicleADirection;
tPoint policeVehicleBStart;
tPoint policeVehicleBDirection;
byte triggerType;
byte __gap[3];
} setPiece[210];
} SetPieces;
// Block 18: Models
tblockHeader header <hidden=true>;
struct tBlock18 {
byte flags[nModels];
} Models;
// Block 19: Ped Relationships
tblockHeader header <hidden=true>;
struct tBlock19 {
struct tPedRelationships
{
DWORD respect<format=binary>;
DWORD like<format=binary>;
DWORD _ignore<format=binary>;
DWORD dislike<format=binary>;
DWORD hate<format=binary>;
} pedGroup[32];
} PedRelationships;
// Block 20: Tags
tblockHeader header <hidden=true>;
struct tBlock20 {
int nTags;
byte tagsPaintStatus[nTags];
} Tags;
// Block 21: IPL
tblockHeader header <hidden=true>;
struct tBlock21 {
int nIPLs; /* unused? */
byte boolIPLFlags[255];
} IPL;
// Block 22: Shopping
tblockHeader header <hidden=true>;
struct tBlock22 {
int nEntries;
struct tblock22Chunk
{
byte unknown[8];
} entries[nEntries];
int nUnknown;
byte unknownFlags[nUnknown];
} Shopping;
// Block 23: Gang Wars
tblockHeader header <hidden=true>;
struct tBlock23 {
DWORD _size<format=hex>;
byte boolEnableGangWars;
byte __gap1[3];
DWORD currentWarStage;
DWORD timeLastStageStarted;
int indexZonePop;
int indexZoneInfo;
RwV3D warStartPos;
DWORD warGangID1;
DWORD warGangID2;
DWORD gangStrength;
DWORD unknown_time;
int _hoodUnderAttackStage;
int _nextAttackTime;
RwV3D warZoneCenter;
int _hoodAttackNotifyTime;
DWORD _hoodAttackMarkerHandle;
byte unknown4;
byte __gap2[3];
if (isMobile==1) byte unknown3mobile[7];
float previousTurfsUnderControl;
float currentTurfsUnderControl;
if (isMobile==1) byte unknown4mobile;
} GangWars;
// Block 24: Unique Stunt Jumps
tblockHeader header <hidden=true>;
struct tBlock24 {
int nUSJ;
struct tUSJ
{
RwV3D startZone[2];
RwV3D landZone[2];
RwV3D cameraCoords;
int reward;
byte boolIsUSJDone, boolIsUSJFound;
byte __gap[2];
} jumps[nUSJ];
} USJ;
// Block 25: ENEX
tblockHeader header <hidden=true>;
struct tBlock25 {
int nEntries;
WORD index[nEntries];
local int EnexFlag, i;
for(i, EnexFlag = 0; i < 500; i++)
{
struct tENEX
{
INT16 origin;
if (origin == -1)
{
EnexFlag = 1;
break;
};
INT16 doorFlags<format = hex>;
INT16 destination;
};
tENEX data;
if (EnexFlag) break;
}
if (!EnexFlag) WORD unknown; //need or not?
} ENEX;
// Block 26: Radio Data
tblockHeader header <hidden=true>;
struct tBlock26 {
struct tStationInfo
{
byte unknown1[20];
int unknown2[8];
int unknown3[40];
int unknown4[15];
} stations[nStations];
byte stat181 <comment="Cities Unlocked">;
byte stat327 <comment="Learning to Fly">;
byte stat328 <comment="The Meat Business">;
byte stat329 <comment="St. Mark's Bistro">;
byte stat318 <comment="Local Liquor Store">;
byte stat320 <comment="Monster">;
byte stat330 <comment="Interdiction">;
byte stat331 <comment="Learning to Fly">;
byte stat332 <comment="Black Project">;
byte stat333 <comment="Green Goo">;
byte stat311 <comment="Mike Toreno">;
byte stat323 <comment="Green Sabre">;
byte stat308 <comment="Vertical Bird">;
byte stat310 <comment="OG Loc">;
byte stat335 <comment="Riot">;
byte stat336 <comment="555 We Tip">;
byte stat337 <comment="House Party">;
byte stat302 <comment="Drive-Thru">;
byte stat338 <comment="Are you going to San Fierro?">;
byte stat339 <comment="High Noon">;
byte stat340 <comment="The Green Sabre">;
byte stat341 <comment="First Date">;
byte stat342 <comment="Farewell My Love">;
ubyte monthDayWhenUpdated;
ubyte hourWhenUpdated;
ubyte hoursToUpdate;
ubyte _updateFlag;
ubyte lastUpdatedFlagNumber;
} RadioData;
// Block 27: Colored Entry Markers
tblockHeader header <hidden=true>;
struct tBlock27 {
struct tCEMarkers
{
int status;
RwV3D pos;
DWORD colorR, colorG, colorB;
} marker[5];
} CEmarkers;
// CheckSum
FSeek(FileSize()-4);
//BigEndian();
DWORD checkSum <format=hex>; //todo; checksum recalc; use SaveCheckSum.1sc
Printf("\n===========================================================================================================\n\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.