This repository has been archived by the owner on Jul 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
formatex.inc
576 lines (483 loc) · 19.1 KB
/
formatex.inc
1
2
3
4
5
6
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
// formatex.inc by Slice
#include <a_samp>
#if defined FORMATEX_INC
#endinput
#endif
#define FORMATEX_INC
#if defined FORMAT_EXTRA_TAGS
#define FORMAT_TAGS _, PlayerText3D, Text, Text3D, Menu, DB, DBResult, File, Float, FORMAT_EXTRA_TAGS
#else
#define FORMAT_TAGS _, PlayerText3D, Text, Text3D, Menu, DB, DBResult, File, Float
#endif
#if !defined FORMAT_BUFFER_SIZE
#define FORMAT_BUFFER_SIZE 2048
#endif
#if !defined FORMAT_PRINT_BUFFER_SIZE
#define FORMAT_PRINT_BUFFER_SIZE 512
#endif
#if !defined FORMAT_CUSTOM_SPEC_BUFFER_SIZE
#define FORMAT_CUSTOM_SPEC_BUFFER_SIZE 512
#endif
#if !defined FORMAT_REPLACE_NATIVES
#define FORMAT_REPLACE_NATIVES true
#endif
#define FormatSpecifier<'%1'>(%2[%3],%4) FMAT@1:F@%1(%2[FORMAT_CUSTOM_SPEC_BUFFER_SIZE],FMAT@2:___unused,%4)
#define FMAT@2:___unused,%1[ %1[
#define FMAT@1:%1(%2) forward %1(%2); public %1(%2)
static stock
gs_CustomFormatFunctions[127] = {-1, ...},
bool:gs_bIsInitialized = false
;
forward __fmt_funcinc();
public __fmt_funcinc() {
new szOutput[1];
format(szOutput, 0, "");
}
static stock InitializeFormatSpecifiers() {
new
szFunctionName[4 char] = !"F@_",
iIndex,
iFunctionAddress
;
gs_bIsInitialized = true;
for (new c = '@'; c <= 'z'; c++) {
// Skip the chars that can't be used in function names
if (c == 'Z' + 1)
c = '_';
else if (c == '_' + 1)
c = 'a';
szFunctionName{2} = c;
// Get the function's address if it exists
if (-1 != (iIndex = funcidx(szFunctionName))) {
#emit LCTRL 1
#emit NEG
#emit MOVE.alt
#emit ADD.C 32
#emit STOR.S.pri iFunctionAddress
#emit LREF.S.pri iFunctionAddress
#emit ADD
#emit LOAD.S.alt iIndex
#emit SHL.C.alt 3
#emit ADD
#emit STOR.S.pri iFunctionAddress
#emit LREF.S.pri iFunctionAddress
#emit STOR.S.pri iFunctionAddress
gs_CustomFormatFunctions[c] = iFunctionAddress;
}
}
}
stock formatex(szOutput[], iLength = sizeof(szOutput), const szFormatString[], {FORMAT_TAGS}:...) {
static
s_szBuffer[FORMAT_BUFFER_SIZE],
bool:s_bIsInCustomSpecifier = false
;
// If formatex is called inside a custom specifier, the original "format" will be used
// to prevent having s_szBuffer overwritten. Specifiers shouldn't depend on other specifiers, anyway.
if (s_bIsInCustomSpecifier) {
new
iNumArgs,
i
;
#emit LOAD.S.pri 8
#emit STOR.S.pri iNumArgs
#emit SHR.C.pri 2
#emit STOR.S.pri i
while (--i >= 0) {
#emit LOAD.S.pri i
#emit SHL.C.pri 2
#emit ADD.C 12
#emit MOVE.alt
#emit LCTRL 5
#emit ADD
#emit LOAD.I
#emit PUSH.pri
}
#emit LOAD.S.pri iNumArgs
#emit PUSH.pri
#emit MOVE.alt
#emit SYSREQ.C format
#emit CONST.pri 4
#emit ADD
#emit MOVE.alt
#emit LCTRL 4
#emit ADD
#emit SCTRL 4
} else {
new
iPos = -1,
iArg = 12 + (3 * 4),
iArgCount,
iAddress,
iArgValue,
aiArgs[128],
i
;
if (!gs_bIsInitialized)
InitializeFormatSpecifiers();
iLength = min(FORMAT_BUFFER_SIZE, iLength);
s_szBuffer[0] = 0;
strunpack(s_szBuffer, szFormatString);
while (-1 != (iPos = strfind(s_szBuffer, !"%", _, ++iPos))) {
while (s_szBuffer[++iPos]) {
// Look for custom formats
if (1 <= s_szBuffer[iPos] < sizeof(gs_CustomFormatFunctions) && gs_CustomFormatFunctions[s_szBuffer[iPos]] != -1) {
new
iFunc = gs_CustomFormatFunctions[s_szBuffer[iPos]]
;
static
s_szCustomFormatBuffer[FORMAT_CUSTOM_SPEC_BUFFER_SIZE]
;
strdel(s_szBuffer, iPos - 1, iPos + 1);
s_szCustomFormatBuffer[0] = 0;
#emit LCTRL 5
#emit LOAD.S.alt iArg
#emit ADD
#emit LOAD.I
#emit MOVE.alt
#emit LOAD.I
#emit PUSH.pri
#emit PUSH.alt
iArg += 4;
s_bIsInCustomSpecifier = true;
#emit PUSH.C s_szCustomFormatBuffer
#emit PUSH.C 12
#emit LCTRL 6
#emit ADD.C 28
#emit PUSH.pri
#emit LOAD.S.pri iFunc
#emit SCTRL 6
s_bIsInCustomSpecifier = false;
strins(s_szBuffer, s_szCustomFormatBuffer, iPos - 1);
break;
}
switch (s_szBuffer[iPos]) {
// Handled by the original format function
case '*', 'i', 'd', 'x', 'h', 'c', 's', 'f', 'b', 'q': {
// Get the argument address and save it for later
#emit LCTRL 5
#emit LOAD.S.alt iArg
#emit ADD
#emit LOAD.I
#emit STOR.S.pri iAddress
#emit MOVE.pri
#emit ADD.C 4
#emit STOR.S.pri iArg
aiArgs[iArgCount++] = iAddress;
if (s_szBuffer[iPos] == '*')
continue;
break;
}
// Unsigned numbers
case 'u': {
new
szBuffer[11]
;
#emit LCTRL 5
#emit LOAD.S.alt iArg
#emit ADD
#emit LOAD.I
#emit LOAD.I
#emit STOR.S.pri iArgValue
#emit MOVE.pri
#emit ADD.C 4
#emit STOR.S.pri iArg
strdel(s_szBuffer, iPos - 1, iPos + 1);
if (!iArgValue) {
strins(s_szBuffer, "0", iPos - 1);
} else {
new
j = sizeof(szBuffer) - 1
;
while (iArgValue) {
// szBuffer[--i]
#emit ADDR.alt szBuffer // alt = *szBuffer
#emit LOAD.S.pri j // pri = i
#emit DEC.pri // pri -= 1
#emit STOR.S.pri j // i = pri
#emit IDXADDR // pri = alt + i * 4
#emit PUSH.pri // Store pri for later
// Now do an unsigned divide on uValue then use both the quotient and remainder!
#emit LOAD.S.pri iArgValue // pri = uValue
#emit CONST.alt 10
#emit UDIV // pri = uValue / 10; alt = uValue % 10
#emit STOR.S.pri iArgValue // uValue = pri
#emit CONST.pri '0'
#emit ADD // pri = '0' + (uValue % 10)
#emit POP.alt // alt = szBuffer[i]
#emit STOR.I // szBuffer[i] = pri
}
strins(s_szBuffer, szBuffer[j], iPos - 1);
}
}
case '0' .. '9', ' ', '.':
continue;
case '%':
break;
default: {
break;
}
}
}
}
i = iArgCount;
// Push the arguments we stored above
while (--i >= 0) {
#emit ADDR.alt aiArgs
#emit LOAD.S.pri i
#emit LIDX
#emit PUSH.pri
#emit STOR.S.pri iAddress
}
// New format specifier
#emit PUSH.C s_szBuffer
// Max length
#emit PUSH.S iLength
// Output string
#emit PUSH.S szOutput
// Argument count
#emit LOAD.S.pri iArgCount
#emit SHL.C.pri 2
#emit ADD.C 12
#emit PUSH.pri
// Save the argument count for later
#emit MOVE.alt
// Call format (duh)
#emit SYSREQ.C format
// Add 4 to the argument count
#emit CONST.pri 4
#emit ADD
#emit MOVE.alt
// Remove <argument count> from the stack
#emit LCTRL 4
#emit ADD
#emit SCTRL 4
}
// Return in case anyone uses it
return 1;
}
stock printfex(const szFormatString[], {FORMAT_TAGS}:...) {
const
iBufferSize = FORMAT_PRINT_BUFFER_SIZE
;
static
s_szBuffer[FORMAT_PRINT_BUFFER_SIZE]
;
new
iNumArgs = numargs(),
i = iNumArgs - 1
;
while (--i >= 0) {
#emit LOAD.S.pri i
#emit SHL.C.pri 2
#emit ADD.C 16
#emit MOVE.alt
#emit LCTRL 5
#emit ADD
#emit LOAD.I
#emit PUSH.pri
}
#emit PUSH.S szFormatString
#emit PUSH.C iBufferSize
#emit PUSH.C s_szBuffer
#emit LOAD.S.pri iNumArgs
#emit SHL.C.pri 2
#emit ADD.C 8
#emit PUSH.pri
#emit LCTRL 6
#emit ADD.C 28
#emit PUSH.pri
#emit CONST.pri formatex
#emit SCTRL 6
print(s_szBuffer);
}
#if !defined FORMAT_NO_DEFAULT_SPECIFIERS
// -----------------------------------------------------------------------------------------------------
// Specifiers
// -----------------------------------------------------------------------------------------------------
#if !defined FORMAT_NO_DEFAULT_SPECIFIER_C
// Inline color
FormatSpecifier<'C'>(output[], color) {
format(output, sizeof(output), "{%06x}", color >>> 8);
}
#endif
#if !defined FORMAT_NO_DEFAULT_SPECIFIER_p
// Fallback value for the “p” specifier
#if !defined FORMAT_FALLBACK_p
#define FORMAT_FALLBACK_p "<UNKNOWN>"
#endif
// Player name
FormatSpecifier<'p'>(output[], playerid) {
if (0 <= playerid < GetMaxPlayers() && IsPlayerConnected(playerid))
GetPlayerName(playerid, output, sizeof(output));
else
strcat(output, #FORMAT_FALLBACK_p);
}
#endif
#if !defined FORMAT_NO_DEFAULT_SPECIFIER_P
// Fallback value for the “P” specifier
#if !defined FORMAT_FALLBACK_P
#define FORMAT_FALLBACK_P "{FFFFFF}<UNKNOWN>"
#endif
// Player name and color
FormatSpecifier<'P'>(output[], playerid) {
if (0 <= playerid < GetMaxPlayers() && IsPlayerConnected(playerid)) {
format(output, sizeof(output), "{%06x}", GetPlayerColor(playerid) >>> 8);
GetPlayerName(playerid, output[8], sizeof(output) - 8);
} else
strcat(output, #FORMAT_FALLBACK_P);
}
#endif
#if !defined FORMAT_NO_DEFAULT_SPECIFIER_W
// Fallback value for the “W” specifier
#if !defined FORMAT_FALLBACK_W
#define FORMAT_FALLBACK_W "<UNKNOWN>"
#endif
// Weapon name
FormatSpecifier<'W'>(output[], weapon) {
static const
s_WeaponNames[][] = {
{!"Fists" }, {!"Brass Knuckles" }, {!"Golf club" }, // 0, 1, 2
{!"Nightstick" }, {!"Knife" }, {!"Baseball Bat" }, // 3, 4, 5
{!"Shovel" }, {!"Pool Cue" }, {!"Katana" }, // 6, 7, 8
{!"Chainsaw" }, {!"Purple Dildo" }, {!"Dildo" }, // 9, 10, 11
{!"Vibrator" }, {!"Silver Vibrator" }, {!"Flowers" }, // 12, 13, 14
{!"Cane" }, {!"Grenade" }, {!"Tear Gas" }, // 15, 16, 17
{!"Molotov Cocktail" }, {!"" }, {!"" }, // 18, ,
{!"" }, {!"9mm" }, {!"Silenced 9mm" }, // , 22, 23
{!"Desert Eagle" }, {!"Shotgun" }, {!"Sawnoff Shotgun" }, // 24, 25, 26
{!"Combat Shotgun" }, {!"Micro Uzi" }, {!"MP5" }, // 27, 28, 29
{!"AK-47" }, {!"M4" }, {!"Tec-9" }, // 30, 31, 32
{!"Country Rifle" }, {!"Sniper Rifle" }, {!"RPG" }, // 33, 34, 35
{!"HS Rocket" }, {!"Flamethrower" }, {!"Minigun" }, // 36, 37, 38
{!"Satchel Charge" }, {!"Detonator" }, {!"Spraycan" }, // 39, 40, 41
{!"Fire Extinguisher" }, {!"Camera" }, {!"Nightvision Goggles" }, // 42, 43, 44
{!"Thermal Goggles" }, {!"Parachute" }, {!"Fake Pistol" }, // 45, 46, 47
{!"" }, {!"Vehicle" }, {!"Helikill" }, // , 49, 50
{!"Explosion" }, {!"" }, {!"Drown" }, // 51, , 53
{!"Collision" }, {!"Splat" }, {!"Unknown" } // 54, 55, 56
}
;
if (0 <= weapon < sizeof(s_WeaponNames))
strcat(output, s_WeaponNames[weapon]);
else
strcat(output, #FORMAT_FALLBACK_W);
}
#endif
#if !defined FORMAT_NO_DEFAULT_SPECIFIER_w
// Fallback value for the “w” specifier
#if !defined FORMAT_FALLBACK_w
#define FORMAT_FALLBACK_w "<UNKNOWN>"
#endif
// Weapon name, lower-case singular (for sentences)
FormatSpecifier<'w'>(output[], weapon) {
static const
s_WeaponNamesLowercaseSingular[][] = {
{!"fists" }, {!"brass knuckles" }, {!"a golfclub" }, // 0, 1, 2
{!"a nightstick" }, {!"a knife" }, {!"a baseball bat" }, // 3, 4, 5
{!"a shovel" }, {!"a pool cue" }, {!"a katana" }, // 6, 7, 8
{!"a chainsaw" }, {!"a purple dildo" }, {!"a dildo" }, // 9, 10, 11
{!"a vibrator" }, {!"a silver vibrator" }, {!"flowers" }, // 12, 13, 14
{!"a cane" }, {!"a grenade" }, {!"tear gas" }, // 15, 16, 17
{!"a molotov cocktail" }, {!"" }, {!"" }, // 18, ,
{!"" }, {!"a 9mm" }, {!"a silenced 9mm"}, // , 22, 23
{!"a desert eagle" }, {!"a shotgun" }, {!"swanoff shotgun" }, // 24, 25, 26
{!"a combat shotgun" }, {!"a micro uzi" }, {!"an mp5" }, // 27, 28, 29
{!"an ak-47" }, {!"an m4" }, {!"a tec-9" }, // 30, 31, 32
{!"a country rifle" }, {!"a sniper rifle" }, {!"an rpg" }, // 33, 34, 35
{!"a hs rpg" }, {!"a flamethrower" }, {!"a minigun" }, // 36, 37, 38
{!"a satchel charge" }, {!"a detonator" }, {!"a spraycan" }, // 39, 40, 41
{!"a fire extinguisher" }, {!"a camera" }, {!"nightvision" }, // 42, 43, 44
{!"an infrared" }, {!"a parachute" }, {!"a fake pistol" }, // 45, 46, 47
{!"" }, {!"a vehicle" }, {!"a helikill" }, // , 49, 50
{!"an explosion" }, {!"" }, {!"drowning" }, // 51, , 53
{!"a collision" }, {!"a splat" }, {!"something unknown"} // 54, 55, 56
}
;
if (0 <= weapon < sizeof(s_WeaponNamesLowercaseSingular))
strcat(output, s_WeaponNamesLowercaseSingular[weapon]);
else
strcat(output, #FORMAT_FALLBACK_w);
}
#endif
#if !defined FORMAT_NO_DEFAULT_SPECIFIER_v
// Fallback value for the “v” specifier
#if !defined FORMAT_FALLBACK_v
#define FORMAT_FALLBACK_v "<UNKNOWN>"
#endif
// Vehicle name
FormatSpecifier<'v'>(output[], modelid) {
static const
s_VehicleNames[][] = {
{!"Landstalker" }, {!"Bravura" }, {!"Buffalo" }, {!"Linerunner" },
{!"Perrenial" }, {!"Sentinel" }, {!"Dumper" }, {!"Firetruck" },
{!"Trashmaster" }, {!"Stretch" }, {!"Manana" }, {!"Infernus" },
{!"Voodoo" }, {!"Pony" }, {!"Mule" }, {!"Cheetah" },
{!"Ambulance" }, {!"Leviathan" }, {!"Moonbeam" }, {!"Esperanto" },
{!"Taxi" }, {!"Washington" }, {!"Bobcat" }, {!"Mr Whoopee" },
{!"BF Injection" }, {!"Hunter" }, {!"Premier" }, {!"Enforcer" },
{!"Securicar" }, {!"Banshee" }, {!"Predator" }, {!"Bus" },
{!"Rhino" }, {!"Barracks" }, {!"Hotknife" }, {!"Trailer 1" },
{!"Previon" }, {!"Coach" }, {!"Cabbie" }, {!"Stallion" },
{!"Rumpo" }, {!"RC Bandit" }, {!"Romero" }, {!"Packer" },
{!"Monster" }, {!"Admiral" }, {!"Squalo" }, {!"Seasparrow" },
{!"Pizzaboy" }, {!"Tram" }, {!"Trailer 2" }, {!"Turismo" },
{!"Speeder" }, {!"Reefer" }, {!"Tropic" }, {!"Flatbed" },
{!"Yankee" }, {!"Caddy" }, {!"Solair" }, {!"Berkley's RC Van" },
{!"Skimmer" }, {!"PCJ-600" }, {!"Faggio" }, {!"Freeway" },
{!"RC Baron" }, {!"RC Raider" }, {!"Glendale" }, {!"Oceanic" },
{!"Sanchez" }, {!"Sparrow" }, {!"Patriot" }, {!"Quad" },
{!"Coastguard" }, {!"Dinghy" }, {!"Hermes" }, {!"Sabre" },
{!"Rustler" }, {!"ZR-350" }, {!"Walton" }, {!"Regina" },
{!"Comet" }, {!"BMX" }, {!"Burrito" }, {!"Camper" },
{!"Marquis" }, {!"Baggage" }, {!"Dozer" }, {!"Maverick" },
{!"News Chopper" }, {!"Rancher" }, {!"FBI Rancher" }, {!"Virgo" },
{!"Greenwood" }, {!"Jetmax" }, {!"Hotring" }, {!"Sandking" },
{!"Blista Compact" }, {!"Police Maverick" }, {!"Boxville" }, {!"Benson" },
{!"Mesa" }, {!"RC Goblin" }, {!"Hotring Racer A" }, {!"Hotring Racer B" },
{!"Bloodring Banger" }, {!"Rancher" }, {!"Super GT" }, {!"Elegant" },
{!"Journey" }, {!"Bike" }, {!"Mountain Bike" }, {!"Beagle" },
{!"Cropdust" }, {!"Stunt" }, {!"Tanker" }, {!"Roadtrain" },
{!"Nebula" }, {!"Majestic" }, {!"Buccaneer" }, {!"Shamal" },
{!"Hydra" }, {!"FCR-900" }, {!"NRG-500" }, {!"HPV1000" },
{!"Cement Truck" }, {!"Tow Truck" }, {!"Fortune" }, {!"Cadrona" },
{!"FBI Truck" }, {!"Willard" }, {!"Forklift" }, {!"Tractor" },
{!"Combine" }, {!"Feltzer" }, {!"Remington" }, {!"Slamvan" },
{!"Blade" }, {!"Freight" }, {!"Streak" }, {!"Vortex" },
{!"Vincent" }, {!"Bullet" }, {!"Clover" }, {!"Sadler" },
{!"Firetruck LA" }, {!"Hustler" }, {!"Intruder" }, {!"Primo" },
{!"Cargobob" }, {!"Tampa" }, {!"Sunrise" }, {!"Merit" },
{!"Utility" }, {!"Nevada" }, {!"Yosemite" }, {!"Windsor" },
{!"Monster A" }, {!"Monster B" }, {!"Uranus" }, {!"Jester" },
{!"Sultan" }, {!"Stratum" }, {!"Elegy" }, {!"Raindance" },
{!"RC Tiger" }, {!"Flash" }, {!"Tahoma" }, {!"Savanna" },
{!"Bandito" }, {!"Freight Flat" }, {!"Streak Carriage" }, {!"Kart" },
{!"Mower" }, {!"Duneride" }, {!"Sweeper" }, {!"Broadway" },
{!"Tornado" }, {!"AT-400" }, {!"DFT-30" }, {!"Huntley" },
{!"Stafford" }, {!"BF-400" }, {!"Newsvan" }, {!"Tug" },
{!"Trailer 3" }, {!"Emperor" }, {!"Wayfarer" }, {!"Euros" },
{!"Hotdog" }, {!"Club" }, {!"Freight Carriage" }, {!"Trailer 3" },
{!"Andromada" }, {!"Dodo" }, {!"RC Cam" }, {!"Launch" },
{!"Police Car (LSPD)"}, {!"Police Car (SFPD)"}, {!"Police Car (LVPD)"}, {!"Police Ranger" },
{!"Picador" }, {!"S.W.A.T. Van" }, {!"Alpha" }, {!"Phoenix" },
{!"Glendale" }, {!"Sadler" }, {!"Luggage Trailer A"}, {!"Luggage Trailer B"},
{!"Stair Trailer" }, {!"Boxville" }, {!"Farm Plow" }, {!"Utility Trailer" }
}
;
if (0 <= (modelid -= 400) < sizeof(s_VehicleNames))
strcat(output, s_VehicleNames[modelid]);
else
strcat(output, #FORMAT_FALLBACK_v);
}
#endif
#if !defined FORMAT_NO_DEFAULT_SPECIFIER_X
// Unsigned 4-byte hex
FormatSpecifier<'X'>(output[], value) {
format(output, sizeof(output), "%02x%06x", value >>> 24, value & 0xFFFFFF);
}
#endif
#endif // FORMAT_NO_DEFAULT_SPECIFIERS
// Do this last so the specifiers always use the native function
#if FORMAT_REPLACE_NATIVES
#define format formatex
#define printf printfex
#endif