Skip to content

Instantly share code, notes, and snippets.

@angavrilov
Created January 6, 2012 10:33
Show Gist options
  • Save angavrilov/1570030 to your computer and use it in GitHub Desktop.
Save angavrilov/1570030 to your computer and use it in GitHub Desktop.
job_item.unk1 to items.other vector mapping
my %lines;
my %switches;
my %jumps;
while (<>) {
$jumps{hex $1}{hex $2}++ if (/^n([0-9a-f]+)\s+->\s+n([0-9a-f]+)/);
if (/^n([0-9a-f]+)\s+->\s+n([0-9a-f]+)\s+\[label=\"([0-9,-]+)\"/) {
$switches{hex $1}{$3} = hex $2;
} elsif (/^n([0-9a-f]+)\s+\[label=\".*?\\nmov\s+eax,0x([0-9a-fA-F]+)\\l/) {
my ($addr, $str) = ($1, $2);
$lines{hex $addr} = $str . ' ('. (hex($str)-0x940b1fc)/12 .')';
}
}
for my $switch (sort { $a <=> $b } keys %switches) {
my %cases = %{$switches{$switch}};
printf "0x%08x:\n", $switch;
for my $case (sort { $a <=> $b } keys %cases) {
my $tgt = $cases{$case};
my @rtgt = keys %{$jumps{$tgt}||{}};
printf " %10s: 0x%08x %s -> %s\n",
$case, $tgt, $lines{$tgt}||'?',
join(',',map{sprintf('%08x',$_);}@rtgt);
}
}
0x083dddd0:
0,14,124-125: 0x083dda90 940b1f0 (-1) -> 083ddaa0 <- default in general
1: 0x083de78d 940b1fc (0) -> 083ddaa0
2: 0x083de7a1 940b208 (1) -> 083ddaa0
3: 0x083de783 940b214 (2) -> 083ddaa0
4: 0x083dec47 940b220 (3) -> 083ddaa0
5: 0x083dec3d 940b22c (4) -> 083ddaa0
6: 0x083dec33 940b238 (5) -> 083ddaa0
7: 0x083dec29 940b244 (6) -> 083ddaa0
8: 0x083dec1f 940b250 (7) -> 083ddaa0
9: 0x083dec15 940b25c (8) -> 083ddaa0
10: 0x083dec0b 940b268 (9) -> 083ddaa0
11: 0x083dec01 940b274 (10) -> 083ddaa0
12: 0x083debf7 940b280 (11) -> 083ddaa0
13: 0x083debed 940b28c (12) -> 083ddaa0
15: 0x083debe3 940b2a4 (14) -> 083ddaa0
16: 0x083debd9 940b2b0 (15) -> 083ddaa0
17: 0x083debcf 940b2bc (16) -> 083ddaa0
18: 0x083debc5 940b2c8 (17) -> 083ddaa0
19: 0x083debbb 940b2d4 (18) -> 083ddaa0
20: 0x083debb1 940b2e0 (19) -> 083ddaa0
21: 0x083deba7 940b2ec (20) -> 083ddaa0
22: 0x083deb9d 940b2f8 (21) -> 083ddaa0
23: 0x083deb93 940b304 (22) -> 083ddaa0
24: 0x083deb89 940b310 (23) -> 083ddaa0
25: 0x083deb7f 940b31c (24) -> 083ddaa0
26: 0x083deb75 940b328 (25) -> 083ddaa0
27: 0x083deb6b 940b334 (26) -> 083ddaa0
28: 0x083deb61 940b340 (27) -> 083ddaa0
29: 0x083deb57 940b34c (28) -> 083ddaa0
30: 0x083deb4d 940b358 (29) -> 083ddaa0
31: 0x083deb43 940b364 (30) -> 083ddaa0
32: 0x083deb39 940b370 (31) -> 083ddaa0
33: 0x083deb2f 940b37c (32) -> 083ddaa0
34: 0x083deb25 940b388 (33) -> 083ddaa0
35: 0x083deb1b 940b394 (34) -> 083ddaa0
36: 0x083deb11 940b3a0 (35) -> 083ddaa0
37: 0x083deb07 940b3ac (36) -> 083ddaa0
38: 0x083deafd 940b3b8 (37) -> 083ddaa0
39: 0x083deaf3 940b3c4 (38) -> 083ddaa0
40: 0x083deae9 940b3d0 (39) -> 083ddaa0
41: 0x083deadf 940b3dc (40) -> 083ddaa0
42: 0x083dead5 940b3e8 (41) -> 083ddaa0
43: 0x083deacb 940b3f4 (42) -> 083ddaa0
44: 0x083deac1 940b400 (43) -> 083ddaa0
45: 0x083deab7 940b40c (44) -> 083ddaa0
46: 0x083deaad 940b418 (45) -> 083ddaa0
47: 0x083deaa3 940b424 (46) -> 083ddaa0
48: 0x083dea99 940b430 (47) -> 083ddaa0
49: 0x083dea8f 940b43c (48) -> 083ddaa0
50: 0x083dea85 940b454 (50) -> 083ddaa0
51: 0x083dea7b 940b460 (51) -> 083ddaa0
52: 0x083dea71 940b46c (52) -> 083ddaa0
53: 0x083dea67 940b478 (53) -> 083ddaa0
54: 0x083dea5d 940b484 (54) -> 083ddaa0
55: 0x083dea53 940b490 (55) -> 083ddaa0
56: 0x083dea49 940b49c (56) -> 083ddaa0
57: 0x083dea3f 940b4a8 (57) -> 083ddaa0
58: 0x083dea35 940b4b4 (58) -> 083ddaa0
59: 0x083dea2b 940b4c0 (59) -> 083ddaa0
60: 0x083dea21 940b4d8 (61) -> 083ddaa0
61: 0x083dea17 940b4e4 (62) -> 083ddaa0
62: 0x083dea0d 940b4f0 (63) -> 083ddaa0
63: 0x083dea03 940b4fc (64) -> 083ddaa0
64: 0x083de9f9 940b508 (65) -> 083ddaa0
65: 0x083de9ef 940b514 (66) -> 083ddaa0
66: 0x083de9e5 940b520 (67) -> 083ddaa0
67: 0x083de9db 940b52c (68) -> 083ddaa0
68: 0x083de9d1 940b538 (69) -> 083ddaa0
69: 0x083de9c7 940b544 (70) -> 083ddaa0
70: 0x083de9bd 940b550 (71) -> 083ddaa0
71: 0x083de9b3 940b55c (72) -> 083ddaa0
72: 0x083de9a9 940b568 (73) -> 083ddaa0
73: 0x083de99f 940b574 (74) -> 083ddaa0
74: 0x083de995 940b580 (75) -> 083ddaa0
75: 0x083de98b 940b58c (76) -> 083ddaa0
76: 0x083de981 940b598 (77) -> 083ddaa0
77: 0x083de977 940b5a4 (78) -> 083ddaa0
78: 0x083de96d 940b5b0 (79) -> 083ddaa0
79: 0x083de963 940b5bc (80) -> 083ddaa0
80: 0x083de959 940b5c8 (81) -> 083ddaa0
81: 0x083de94f 940b5d4 (82) -> 083ddaa0
82: 0x083de945 940b5e0 (83) -> 083ddaa0
83: 0x083de93b 940b5ec (84) -> 083ddaa0
84: 0x083de931 940b5f8 (85) -> 083ddaa0
85: 0x083de927 940b604 (86) -> 083ddaa0
86: 0x083de91d 940b610 (87) -> 083ddaa0
87: 0x083de913 940b7d8 (125) -> 083ddaa0
88: 0x083de909 940b7e4 (126) -> 083ddaa0
89: 0x083de8ff 940b7f0 (127) -> 083ddaa0
90: 0x083de8f5 940b61c (88) -> 083ddaa0
91: 0x083de8eb 940b628 (89) -> 083ddaa0
92: 0x083de8e1 940b634 (90) -> 083ddaa0
93: 0x083de8d7 940b640 (91) -> 083ddaa0
94: 0x083de8cd 940b64c (92) -> 083ddaa0
95: 0x083de8c3 940b658 (93) -> 083ddaa0
96: 0x083de8b9 940b664 (94) -> 083ddaa0
97: 0x083de8af 940b670 (95) -> 083ddaa0
98: 0x083de8a5 940b67c (96) -> 083ddaa0
99: 0x083de89b 940b688 (97) -> 083ddaa0
100: 0x083de891 940b694 (98) -> 083ddaa0
101: 0x083de887 940b6a0 (99) -> 083ddaa0
102: 0x083de87d 940b6ac (100) -> 083ddaa0
103: 0x083de873 940b6b8 (101) -> 083ddaa0
104: 0x083de869 940b6c4 (102) -> 083ddaa0
105: 0x083de85f 940b6d0 (103) -> 083ddaa0
106: 0x083de855 940b6dc (104) -> 083ddaa0
107: 0x083de84b 940b6e8 (105) -> 083ddaa0
108: 0x083de841 940b6f4 (106) -> 083ddaa0
109: 0x083de837 940b70c (108) -> 083ddaa0
110: 0x083de82d 940b718 (109) -> 083ddaa0
111: 0x083de823 940b724 (110) -> 083ddaa0
112: 0x083de819 940b730 (111) -> 083ddaa0
113: 0x083de80f 940b73c (112) -> 083ddaa0
114: 0x083de805 940b748 (113) -> 083ddaa0
115: 0x083de7fb 940b754 (114) -> 083ddaa0
116: 0x083de7f1 940b760 (115) -> 083ddaa0
117: 0x083de7e7 940b76c (116) -> 083ddaa0
118: 0x083de7dd 940b778 (117) -> 083ddaa0
119: 0x083de7d3 940b784 (118) -> 083ddaa0
120: 0x083de7c9 940b790 (119) -> 083ddaa0
121: 0x083de7bf 940b79c (120) -> 083ddaa0
122: 0x083de7b5 940b7a8 (121) -> 083ddaa0
123: 0x083de7ab 940b7b4 (122) -> 083ddaa0
126: 0x083de797 940b700 (107) -> 083ddaa0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment