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
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
#![allow(unused, non_upper_case_globals, non_camel_case_types)]
use std::fmt;
use scroll::{ctx::TryFromCtx, Endian};
pub const S_COMPILE: u16 = 0x0001;
pub const S_REGISTER_16t: u16 = 0x0002;
pub const S_CONSTANT_16t: u16 = 0x0003;
pub const S_UDT_16t: u16 = 0x0004;
pub const S_SSEARCH: u16 = 0x0005;
pub const S_END: u16 = 0x0006;
pub const S_SKIP: u16 = 0x0007;
pub const S_CVRESERVE: u16 = 0x0008;
pub const S_OBJNAME_ST: u16 = 0x0009;
pub const S_ENDARG: u16 = 0x000a;
pub const S_COBOLUDT_16t: u16 = 0x000b;
pub const S_MANYREG_16t: u16 = 0x000c;
pub const S_RETURN: u16 = 0x000d;
pub const S_ENTRYTHIS: u16 = 0x000e;
pub const S_BPREL16: u16 = 0x0100;
pub const S_LDATA16: u16 = 0x0101;
pub const S_GDATA16: u16 = 0x0102;
pub const S_PUB16: u16 = 0x0103;
pub const S_LPROC16: u16 = 0x0104;
pub const S_GPROC16: u16 = 0x0105;
pub const S_THUNK16: u16 = 0x0106;
pub const S_BLOCK16: u16 = 0x0107;
pub const S_WITH16: u16 = 0x0108;
pub const S_LABEL16: u16 = 0x0109;
pub const S_CEXMODEL16: u16 = 0x010a;
pub const S_VFTABLE16: u16 = 0x010b;
pub const S_REGREL16: u16 = 0x010c;
pub const S_BPREL32_16t: u16 = 0x0200;
pub const S_LDATA32_16t: u16 = 0x0201;
pub const S_GDATA32_16t: u16 = 0x0202;
pub const S_PUB32_16t: u16 = 0x0203;
pub const S_LPROC32_16t: u16 = 0x0204;
pub const S_GPROC32_16t: u16 = 0x0205;
pub const S_THUNK32_ST: u16 = 0x0206;
pub const S_BLOCK32_ST: u16 = 0x0207;
pub const S_WITH32_ST: u16 = 0x0208;
pub const S_LABEL32_ST: u16 = 0x0209;
pub const S_CEXMODEL32: u16 = 0x020a;
pub const S_VFTABLE32_16t: u16 = 0x020b;
pub const S_REGREL32_16t: u16 = 0x020c;
pub const S_LTHREAD32_16t: u16 = 0x020d;
pub const S_GTHREAD32_16t: u16 = 0x020e;
pub const S_SLINK32: u16 = 0x020f;
pub const S_LPROCMIPS_16t: u16 = 0x0300;
pub const S_GPROCMIPS_16t: u16 = 0x0301;
pub const S_PROCREF_ST: u16 = 0x0400;
pub const S_DATAREF_ST: u16 = 0x0401;
pub const S_ALIGN: u16 = 0x0402;
pub const S_LPROCREF_ST: u16 = 0x0403;
pub const S_OEM: u16 = 0x0404;
pub const S_TI16_MAX: u16 = 0x1000;
pub const S_REGISTER_ST: u16 = 0x1001;
pub const S_CONSTANT_ST: u16 = 0x1002;
pub const S_UDT_ST: u16 = 0x1003;
pub const S_COBOLUDT_ST: u16 = 0x1004;
pub const S_MANYREG_ST: u16 = 0x1005;
pub const S_BPREL32_ST: u16 = 0x1006;
pub const S_LDATA32_ST: u16 = 0x1007;
pub const S_GDATA32_ST: u16 = 0x1008;
pub const S_PUB32_ST: u16 = 0x1009;
pub const S_LPROC32_ST: u16 = 0x100a;
pub const S_GPROC32_ST: u16 = 0x100b;
pub const S_VFTABLE32: u16 = 0x100c;
pub const S_REGREL32_ST: u16 = 0x100d;
pub const S_LTHREAD32_ST: u16 = 0x100e;
pub const S_GTHREAD32_ST: u16 = 0x100f;
pub const S_LPROCMIPS_ST: u16 = 0x1010;
pub const S_GPROCMIPS_ST: u16 = 0x1011;
pub const S_FRAMEPROC: u16 = 0x1012;
pub const S_COMPILE2_ST: u16 = 0x1013;
pub const S_MANYREG2_ST: u16 = 0x1014;
pub const S_LPROCIA64_ST: u16 = 0x1015;
pub const S_GPROCIA64_ST: u16 = 0x1016;
pub const S_LOCALSLOT_ST: u16 = 0x1017;
pub const S_PARAMSLOT_ST: u16 = 0x1018;
pub const S_ANNOTATION: u16 = 0x1019;
pub const S_GMANPROC_ST: u16 = 0x101a;
pub const S_LMANPROC_ST: u16 = 0x101b;
pub const S_RESERVED1: u16 = 0x101c;
pub const S_RESERVED2: u16 = 0x101d;
pub const S_RESERVED3: u16 = 0x101e;
pub const S_RESERVED4: u16 = 0x101f;
pub const S_LMANDATA_ST: u16 = 0x1020;
pub const S_GMANDATA_ST: u16 = 0x1021;
pub const S_MANFRAMEREL_ST: u16 = 0x1022;
pub const S_MANREGISTER_ST: u16 = 0x1023;
pub const S_MANSLOT_ST: u16 = 0x1024;
pub const S_MANMANYREG_ST: u16 = 0x1025;
pub const S_MANREGREL_ST: u16 = 0x1026;
pub const S_MANMANYREG2_ST: u16 = 0x1027;
pub const S_MANTYPREF: u16 = 0x1028;
pub const S_UNAMESPACE_ST: u16 = 0x1029;
pub const S_ST_MAX: u16 = 0x1100;
pub const S_OBJNAME: u16 = 0x1101;
pub const S_THUNK32: u16 = 0x1102;
pub const S_BLOCK32: u16 = 0x1103;
pub const S_WITH32: u16 = 0x1104;
pub const S_LABEL32: u16 = 0x1105;
pub const S_REGISTER: u16 = 0x1106;
pub const S_CONSTANT: u16 = 0x1107;
pub const S_UDT: u16 = 0x1108;
pub const S_COBOLUDT: u16 = 0x1109;
pub const S_MANYREG: u16 = 0x110a;
pub const S_BPREL32: u16 = 0x110b;
pub const S_LDATA32: u16 = 0x110c;
pub const S_GDATA32: u16 = 0x110d;
pub const S_PUB32: u16 = 0x110e;
pub const S_LPROC32: u16 = 0x110f;
pub const S_GPROC32: u16 = 0x1110;
pub const S_REGREL32: u16 = 0x1111;
pub const S_LTHREAD32: u16 = 0x1112;
pub const S_GTHREAD32: u16 = 0x1113;
pub const S_LPROCMIPS: u16 = 0x1114;
pub const S_GPROCMIPS: u16 = 0x1115;
pub const S_COMPILE2: u16 = 0x1116;
pub const S_MANYREG2: u16 = 0x1117;
pub const S_LPROCIA64: u16 = 0x1118;
pub const S_GPROCIA64: u16 = 0x1119;
pub const S_LOCALSLOT: u16 = 0x111a;
pub const S_PARAMSLOT: u16 = 0x111b;
pub const S_LMANDATA: u16 = 0x111c;
pub const S_GMANDATA: u16 = 0x111d;
pub const S_MANFRAMEREL: u16 = 0x111e;
pub const S_MANREGISTER: u16 = 0x111f;
pub const S_MANSLOT: u16 = 0x1120;
pub const S_MANMANYREG: u16 = 0x1121;
pub const S_MANREGREL: u16 = 0x1122;
pub const S_MANMANYREG2: u16 = 0x1123;
pub const S_UNAMESPACE: u16 = 0x1124;
pub const S_PROCREF: u16 = 0x1125;
pub const S_DATAREF: u16 = 0x1126;
pub const S_LPROCREF: u16 = 0x1127;
pub const S_ANNOTATIONREF: u16 = 0x1128;
pub const S_TOKENREF: u16 = 0x1129;
pub const S_GMANPROC: u16 = 0x112a;
pub const S_LMANPROC: u16 = 0x112b;
pub const S_TRAMPOLINE: u16 = 0x112c;
pub const S_MANCONSTANT: u16 = 0x112d;
pub const S_ATTR_FRAMEREL: u16 = 0x112e;
pub const S_ATTR_REGISTER: u16 = 0x112f;
pub const S_ATTR_REGREL: u16 = 0x1130;
pub const S_ATTR_MANYREG: u16 = 0x1131;
pub const S_SEPCODE: u16 = 0x1132;
pub const S_LOCAL_2005: u16 = 0x1133;
pub const S_DEFRANGE_2005: u16 = 0x1134;
pub const S_DEFRANGE2_2005: u16 = 0x1135;
pub const S_SECTION: u16 = 0x1136;
pub const S_COFFGROUP: u16 = 0x1137;
pub const S_EXPORT: u16 = 0x1138;
pub const S_CALLSITEINFO: u16 = 0x1139;
pub const S_FRAMECOOKIE: u16 = 0x113a;
pub const S_DISCARDED: u16 = 0x113b;
pub const S_COMPILE3: u16 = 0x113c;
pub const S_ENVBLOCK: u16 = 0x113d;
pub const S_LOCAL: u16 = 0x113e;
pub const S_DEFRANGE: u16 = 0x113f;
pub const S_DEFRANGE_SUBFIELD: u16 = 0x1140;
pub const S_DEFRANGE_REGISTER: u16 = 0x1141;
pub const S_DEFRANGE_FRAMEPOINTER_REL: u16 = 0x1142;
pub const S_DEFRANGE_SUBFIELD_REGISTER: u16 = 0x1143;
pub const S_DEFRANGE_FRAMEPOINTER_REL_FULL_SCOPE: u16 = 0x1144;
pub const S_DEFRANGE_REGISTER_REL: u16 = 0x1145;
pub const S_LPROC32_ID: u16 = 0x1146;
pub const S_GPROC32_ID: u16 = 0x1147;
pub const S_LPROCMIPS_ID: u16 = 0x1148;
pub const S_GPROCMIPS_ID: u16 = 0x1149;
pub const S_LPROCIA64_ID: u16 = 0x114a;
pub const S_GPROCIA64_ID: u16 = 0x114b;
pub const S_BUILDINFO: u16 = 0x114c;
pub const S_INLINESITE: u16 = 0x114d;
pub const S_INLINESITE_END: u16 = 0x114e;
pub const S_PROC_ID_END: u16 = 0x114f;
pub const S_DEFRANGE_HLSL: u16 = 0x1150;
pub const S_GDATA_HLSL: u16 = 0x1151;
pub const S_LDATA_HLSL: u16 = 0x1152;
pub const S_FILESTATIC: u16 = 0x1153;
pub const S_LOCAL_DPC_GROUPSHARED: u16 = 0x1154;
pub const S_LPROC32_DPC: u16 = 0x1155;
pub const S_LPROC32_DPC_ID: u16 = 0x1156;
pub const S_DEFRANGE_DPC_PTR_TAG: u16 = 0x1157;
pub const S_DPC_SYM_TAG_MAP: u16 = 0x1158;
pub const S_ARMSWITCHTABLE: u16 = 0x1159;
pub const S_CALLEES: u16 = 0x115a;
pub const S_CALLERS: u16 = 0x115b;
pub const S_POGODATA: u16 = 0x115c;
pub const S_INLINESITE2: u16 = 0x115d;
pub const S_HEAPALLOCSITE: u16 = 0x115e;
pub const S_MOD_TYPEREF: u16 = 0x115f;
pub const S_REF_MINIPDB: u16 = 0x1160;
pub const S_PDBMAP: u16 = 0x1161;
pub const S_GDATA_HLSL32: u16 = 0x1162;
pub const S_LDATA_HLSL32: u16 = 0x1163;
pub const S_GDATA_HLSL32_EX: u16 = 0x1164;
pub const S_LDATA_HLSL32_EX: u16 = 0x1165;
pub const S_FASTLINK: u16 = 0x1167;
pub const S_INLINEES: u16 = 0x1168;
#[non_exhaustive]
#[allow(missing_docs)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum CPUType {
Intel8080 = 0x0,
Intel8086 = 0x1,
Intel80286 = 0x2,
Intel80386 = 0x3,
Intel80486 = 0x4,
Pentium = 0x5,
PentiumPro = 0x6,
Pentium3 = 0x7,
MIPS = 0x10,
MIPS16 = 0x11,
MIPS32 = 0x12,
MIPS64 = 0x13,
MIPSI = 0x14,
MIPSII = 0x15,
MIPSIII = 0x16,
MIPSIV = 0x17,
MIPSV = 0x18,
M68000 = 0x20,
M68010 = 0x21,
M68020 = 0x22,
M68030 = 0x23,
M68040 = 0x24,
Alpha = 0x30,
Alpha21164 = 0x31,
Alpha21164A = 0x32,
Alpha21264 = 0x33,
Alpha21364 = 0x34,
PPC601 = 0x40,
PPC603 = 0x41,
PPC604 = 0x42,
PPC620 = 0x43,
PPCFP = 0x44,
PPCBE = 0x45,
SH3 = 0x50,
SH3E = 0x51,
SH3DSP = 0x52,
SH4 = 0x53,
SHMedia = 0x54,
ARM3 = 0x60,
ARM4 = 0x61,
ARM4T = 0x62,
ARM5 = 0x63,
ARM5T = 0x64,
ARM6 = 0x65,
ARM_XMAC = 0x66,
ARM_WMMX = 0x67,
ARM7 = 0x68,
ARM64 = 0x69,
Omni = 0x70,
Ia64 = 0x80,
Ia64_2 = 0x81,
CEE = 0x90,
AM33 = 0xa0,
M32R = 0xb0,
TriCore = 0xc0,
X64 = 0xd0,
EBC = 0xe0,
Thumb = 0xf0,
ARMNT = 0xf4,
D3D11_Shader = 0x100,
}
impl fmt::Display for CPUType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Intel8080 => write!(f, "Intel8080"),
Self::Intel8086 => write!(f, "Intel8086"),
Self::Intel80286 => write!(f, "Intel80286"),
Self::Intel80386 => write!(f, "Intel80386"),
Self::Intel80486 => write!(f, "Intel80486"),
Self::Pentium => write!(f, "Pentium"),
Self::PentiumPro => write!(f, "PentiumPro"),
Self::Pentium3 => write!(f, "Pentium3"),
Self::MIPS => write!(f, "MIPS"),
Self::MIPS16 => write!(f, "MIPS16"),
Self::MIPS32 => write!(f, "MIPS32"),
Self::MIPS64 => write!(f, "MIPS64"),
Self::MIPSI => write!(f, "MIPSI"),
Self::MIPSII => write!(f, "MIPSII"),
Self::MIPSIII => write!(f, "MIPSIII"),
Self::MIPSIV => write!(f, "MIPSIV"),
Self::MIPSV => write!(f, "MIPSV"),
Self::M68000 => write!(f, "M68000"),
Self::M68010 => write!(f, "M68010"),
Self::M68020 => write!(f, "M68020"),
Self::M68030 => write!(f, "M68030"),
Self::M68040 => write!(f, "M68040"),
Self::Alpha => write!(f, "Alpha"),
Self::Alpha21164 => write!(f, "Alpha21164"),
Self::Alpha21164A => write!(f, "Alpha21164A"),
Self::Alpha21264 => write!(f, "Alpha21264"),
Self::Alpha21364 => write!(f, "Alpha21364"),
Self::PPC601 => write!(f, "PPC601"),
Self::PPC603 => write!(f, "PPC603"),
Self::PPC604 => write!(f, "PPC604"),
Self::PPC620 => write!(f, "PPC620"),
Self::PPCFP => write!(f, "PPCFP"),
Self::PPCBE => write!(f, "PPCBE"),
Self::SH3 => write!(f, "SH3"),
Self::SH3E => write!(f, "SH3E"),
Self::SH3DSP => write!(f, "SH3DSP"),
Self::SH4 => write!(f, "SH4"),
Self::SHMedia => write!(f, "SHMedia"),
Self::ARM3 => write!(f, "ARM3"),
Self::ARM4 => write!(f, "ARM4"),
Self::ARM4T => write!(f, "ARM4T"),
Self::ARM5 => write!(f, "ARM5"),
Self::ARM5T => write!(f, "ARM5T"),
Self::ARM6 => write!(f, "ARM6"),
Self::ARM_XMAC => write!(f, "ARM_XMAC"),
Self::ARM_WMMX => write!(f, "ARM_WMMX"),
Self::ARM7 => write!(f, "ARM7"),
Self::ARM64 => write!(f, "ARM64"),
Self::Omni => write!(f, "Omni"),
Self::Ia64 => write!(f, "Ia64"),
Self::Ia64_2 => write!(f, "Ia64_2"),
Self::CEE => write!(f, "CEE"),
Self::AM33 => write!(f, "AM33"),
Self::M32R => write!(f, "M32R"),
Self::TriCore => write!(f, "TriCore"),
Self::X64 => write!(f, "X64"),
Self::EBC => write!(f, "EBC"),
Self::Thumb => write!(f, "Thumb"),
Self::ARMNT => write!(f, "ARMNT"),
Self::D3D11_Shader => write!(f, "D3D11_Shader"),
}
}
}
impl From<u16> for CPUType {
fn from(value: u16) -> Self {
match value {
0x0 => Self::Intel8080,
0x1 => Self::Intel8086,
0x2 => Self::Intel80286,
0x3 => Self::Intel80386,
0x4 => Self::Intel80486,
0x5 => Self::Pentium,
0x6 => Self::PentiumPro,
0x7 => Self::Pentium3,
0x10 => Self::MIPS,
0x11 => Self::MIPS16,
0x12 => Self::MIPS32,
0x13 => Self::MIPS64,
0x14 => Self::MIPSI,
0x15 => Self::MIPSII,
0x16 => Self::MIPSIII,
0x17 => Self::MIPSIV,
0x18 => Self::MIPSV,
0x20 => Self::M68000,
0x21 => Self::M68010,
0x22 => Self::M68020,
0x23 => Self::M68030,
0x24 => Self::M68040,
0x30 => Self::Alpha,
0x31 => Self::Alpha21164,
0x32 => Self::Alpha21164A,
0x33 => Self::Alpha21264,
0x34 => Self::Alpha21364,
0x40 => Self::PPC601,
0x41 => Self::PPC603,
0x42 => Self::PPC604,
0x43 => Self::PPC620,
0x44 => Self::PPCFP,
0x45 => Self::PPCBE,
0x50 => Self::SH3,
0x51 => Self::SH3E,
0x52 => Self::SH3DSP,
0x53 => Self::SH4,
0x54 => Self::SHMedia,
0x60 => Self::ARM3,
0x61 => Self::ARM4,
0x62 => Self::ARM4T,
0x63 => Self::ARM5,
0x64 => Self::ARM5T,
0x65 => Self::ARM6,
0x66 => Self::ARM_XMAC,
0x67 => Self::ARM_WMMX,
0x68 => Self::ARM7,
0x69 => Self::ARM64,
0x70 => Self::Omni,
0x80 => Self::Ia64,
0x81 => Self::Ia64_2,
0x90 => Self::CEE,
0xa0 => Self::AM33,
0xb0 => Self::M32R,
0xc0 => Self::TriCore,
0xd0 => Self::X64,
0xe0 => Self::EBC,
0xf0 => Self::Thumb,
0xf4 => Self::ARMNT,
0x100 => Self::D3D11_Shader,
_ => Self::Intel8080,
}
}
}
impl<'a> TryFromCtx<'a, Endian> for CPUType {
type Error = scroll::Error;
fn try_from_ctx(this: &'a [u8], le: Endian) -> scroll::Result<(Self, usize)> {
u16::try_from_ctx(this, le).map(|(v, l)| (v.into(), l))
}
}
#[non_exhaustive]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum SourceLanguage {
C = 0x00,
Cpp = 0x01,
Fortran = 0x02,
Masm = 0x03,
Pascal = 0x04,
Basic = 0x05,
Cobol = 0x06,
Link = 0x07,
Cvtres = 0x08,
Cvtpgd = 0x09,
CSharp = 0x0a,
VB = 0x0b,
ILAsm = 0x0c,
Java = 0x0d,
JScript = 0x0e,
MSIL = 0x0f,
HLSL = 0x10,
D = 0x44,
}
impl fmt::Display for SourceLanguage {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::C => write!(f, "C"),
Self::Cpp => write!(f, "Cpp"),
Self::Fortran => write!(f, "Fortran"),
Self::Masm => write!(f, "Masm"),
Self::Pascal => write!(f, "Pascal"),
Self::Basic => write!(f, "Basic"),
Self::Cobol => write!(f, "Cobol"),
Self::Link => write!(f, "Link"),
Self::Cvtres => write!(f, "Cvtres"),
Self::Cvtpgd => write!(f, "Cvtpgd"),
Self::CSharp => write!(f, "CSharp"),
Self::VB => write!(f, "VB"),
Self::ILAsm => write!(f, "ILAsm"),
Self::Java => write!(f, "Java"),
Self::JScript => write!(f, "JScript"),
Self::MSIL => write!(f, "MSIL"),
Self::HLSL => write!(f, "HLSL"),
Self::D => write!(f, "D"),
}
}
}
impl From<u8> for SourceLanguage {
fn from(value: u8) -> Self {
match value {
0x00 => Self::C,
0x01 => Self::Cpp,
0x02 => Self::Fortran,
0x03 => Self::Masm,
0x04 => Self::Pascal,
0x05 => Self::Basic,
0x06 => Self::Cobol,
0x07 => Self::Link,
0x08 => Self::Cvtres,
0x09 => Self::Cvtpgd,
0x0a => Self::CSharp,
0x0b => Self::VB,
0x0c => Self::ILAsm,
0x0d => Self::Java,
0x0e => Self::JScript,
0x0f => Self::MSIL,
0x10 => Self::HLSL,
0x44 => Self::D,
_ => Self::Masm,
}
}
}
impl<'a> TryFromCtx<'a, Endian> for SourceLanguage {
type Error = scroll::Error;
fn try_from_ctx(this: &'a [u8], le: Endian) -> scroll::Result<(Self, usize)> {
u8::try_from_ctx(this, le).map(|(v, l)| (v.into(), l))
}
}