-
Notifications
You must be signed in to change notification settings - Fork 3
/
storyflag.py
115 lines (111 loc) · 9.85 KB
/
storyflag.py
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
storyflag_mapping_table = [
0xFF00,0xFF00,0xFF00,0x0040,0x0050,0x0060,0x0070,0x0080,0x0090,0x00A0,0x00B0,0x00C0,0x00D0,0x00E0,0x00F0,0x0100,
0x0110,0x0120,0x0030,0x0130,0x0140,0x0150,0x0160,0x0170,0x0180,0x0190,0x01A0,0x01B0,0x01C0,0x01D0,0x01E0,0x01F0,
0x0200,0x0210,0x0220,0x0230,0x0240,0x0630,0x0640,0x0650,0x0660,0x0470,0x0730,0x0740,0x0750,0x0760,0x0770,0x0780,
0x0790,0x07A0,0x0250,0x0260,0x0270,0x0280,0x0290,0x02A0,0x02B0,0x02C0,0x02D0,0x0320,0x02F0,0x0300,0x0310,0x02E0,
0x0330,0x0340,0x0350,0x0360,0x0370,0x0380,0x04E0,0x0670,0x0850,0x0860,0x08B0,0x08C0,0x08D0,0x08E0,0x08F0,0x0900,
0x0910,0x0920,0x0930,0x0870,0x0880,0x0890,0x08A0,0x0A90,0x0AA0,0x0AB0,0x0B70,0x0C00,0x0C10,0x0C20,0x0C30,0x0C40,
0x0C50,0x0C60,0x0C70,0x0C80,0x0390,0x03A0,0x03B0,0x03C0,0x03D0,0x03E0,0x03F0,0x0400,0x0410,0x0420,0x0430,0x0940,
0x0950,0x0960,0x0970,0x0980,0x0990,0x09A0,0x09B0,0x09C0,0x09D0,0x09E0,0x09F0,0x0A00,0x0A10,0x0A20,0x0A30,0x0A40,
0x0A50,0x0A60,0x0680,0x0690,0x06A0,0x06B0,0x06C0,0x06D0,0x06E0,0x06F0,0x0700,0x0710,0x0720,0x0A80,0x0B80,0x0B90,
0x0BA0,0x0BB0,0x0BC0,0x0BD0,0x0BE0,0x0BF0,0x0440,0x7F05,0x0460,0x0450,0x0480,0x0490,0x04A0,0x04B0,0x04C0,0x04D0,
0x04F0,0x0500,0x0510,0x0520,0x0530,0x0540,0x0550,0x0560,0x0570,0x0580,0x0590,0x05A0,0x05B0,0x05C0,0x05D0,0x05E0,
0x05F0,0x0600,0x0610,0x0620,0x07B0,0x07C0,0x07D0,0x07E0,0x07F0,0x0800,0x0810,0x0820,0x0830,0x0840,0x0A70,0x7F62,
0x7E0F,0x7D0F,0x0AC0,0x0AD0,0x0AE0,0x0AF0,0x0B00,0x0B10,0x0B20,0x0B30,0x0B40,0x0B50,0x0B60,0x0C90,0x0CA0,0x0CB0,
0x0CC0,0x0CD0,0x0CE0,0x0CF0,0x0D00,0x0D10,0x0D20,0x7F95,0x0D30,0x7C03,0x0D40,0x0D50,0x0D60,0x0D70,0x0D80,0x0D90,
0x0DA0,0x0DC0,0x0DB0,0x0DD0,0x0DE0,0x0DF0,0x0E00,0x0E10,0x0E20,0x0E30,0x0E40,0x0E50,0x0E60,0x0E70,0x0E80,0x0E90,
0x0EA0,0x0EB0,0x0EC0,0x0ED0,0x0EE0,0x0EF0,0x0F00,0x0F10,0x0F20,0x0F30,0x0F40,0x0F50,0x0F60,0x0F70,0x0F80,0x0F90,
0x0FA0,0x0FB0,0x0FC0,0x0FD0,0x0FE0,0x0FF0,0x1000,0x1010,0x1020,0x1030,0x1040,0x1050,0x1060,0x1070,0x1080,0x1090,
0x10A0,0x10B0,0x10C0,0x10D0,0x10E0,0x10F0,0x1100,0x1110,0x1120,0x1130,0x1140,0x1150,0x1160,0x1170,0x1180,0x1190,
0x11A0,0x11B0,0x11C0,0x11D0,0x11E0,0x11F0,0x1200,0x1210,0x1220,0x1230,0x1240,0x1250,0x1260,0x1270,0x1280,0x1290,
0x12A0,0x12B0,0x12C0,0x12D0,0x12E0,0x7C43,0x7C85,0x7B06,0x7B73,0x7A05,0x7A66,0x7BB3,0x7905,0x7966,0x7803,0x7845,
0x7706,0x12F0,0x1300,0x1310,0x1320,0x1330,0x1340,0x1350,0x1360,0x1370,0x1380,0x1390,0x7CE1,0xFF00,0xFF00,0xFF00,
0xFF00,0xFF00,0xFF00,0xFF00,0x13A0,0x13B0,0x13C0,0x13D0,0x13E0,0x13F0,0x1400,0x1410,0x1420,0x1430,0x1440,0x1450,
0x1460,0x1470,0x14A0,0x1490,0x1480,0x14B0,0x14C0,0x14D0,0x14E0,0x14F0,0x1500,0x1510,0x1520,0x1530,0x1540,0x1550,
0x1560,0x1570,0x1580,0x1590,0x15A0,0x15B0,0x15C0,0x15D0,0x15E0,0x15F0,0x1600,0x1610,0x19E0,0x19F0,0x1A00,0x1A10,
0x1A20,0x1A30,0x1A40,0x1A50,0x1A60,0x1A70,0x1A80,0x1A90,0x1AA0,0x1AB0,0x1AC0,0x1AF0,0x1B50,0x1B70,0x1B80,0x1C70,
0x1C80,0x1620,0x1630,0x1640,0x1650,0x1660,0x1670,0x1680,0x1690,0x16A0,0x16B0,0x16C0,0x16D0,0x16E0,0x16F0,0x1700,
0x1710,0x1720,0x1730,0x1740,0x1750,0x1760,0x1770,0x1780,0x1790,0x17A0,0x17B0,0x17C0,0x17D0,0x17E0,0x17F0,0x1800,
0x1810,0x1820,0x1830,0x1840,0x1850,0x1860,0x1870,0x1880,0x1890,0x18A0,0x18B0,0x18C0,0x18D0,0x18E0,0x18F0,0x1900,
0x1910,0x1920,0x1930,0x1940,0x1950,0x1960,0x1970,0x1980,0x1990,0x19A0,0x19B0,0x19C0,0x19D0,0x1AD0,0x1AE0,0x1B00,
0x1B10,0x1B20,0x1B30,0x1B40,0x1B60,0x1B90,0x1BA0,0x1BB0,0x1BC0,0x1BD0,0x1BE0,0x1BF0,0x1C00,0x1C10,0x1C20,0x1C30,
0x1C40,0x1C50,0x1C60,0x1C90,0x1CA0,0x1CB0,0x1CC0,0x1CD0,0x1CE0,0x1CF0,0x1D00,0x1D10,0x1D20,0x1D30,0x1D40,0x1D50,
0x1D60,0x1D70,0x1D80,0x1D90,0x1DA0,0x1DB0,0x1DC0,0x1DD0,0x7603,0x7645,0x7506,0x1DE0,0x1DF0,0x1E30,0x1E40,0x1E50,
0x1E60,0x76A3,0x7575,0x7406,0x7473,0x7305,0x7366,0x1E00,0x1E10,0x1E20,0x1E70,0x1E80,0x1E90,0x1EA0,0x1EB0,0x1EC0,
0x1ED0,0x1EE0,0x1EF0,0x1F00,0x1F10,0x6D05,0x7205,0x7266,0x6D65,0x7145,0x7006,0x71A5,0x7075,0x6F06,0x6F75,0x6E05,
0x6E66,0x1F20,0x1F30,0x1F40,0x1F50,0x1F60,0x1F70,0x1F80,0x1F90,0x1FA0,0x1FB0,0x1FC0,0x1FD0,0x1FE0,0x1FF0,0x2000,
0x2010,0x2020,0x2030,0x74B3,0x7AD1,0x2040,0x2050,0x2060,0x2070,0x2080,0x2090,0x20A0,0x20B0,0x20C0,0x20D0,0x20E0,
0x20F0,0x2100,0x2110,0x2120,0x2130,0x2140,0x2150,0x2160,0x6C05,0x6C65,0x6B06,0x6B75,0x6A05,0x6A66,0x6905,0x6965,
0x6806,0x6875,0x6705,0x6766,0x6605,0x6665,0x6506,0x6575,0x6405,0x6466,0x6305,0x6365,0x6206,0x6275,0x6105,0x6166,
0x6005,0x6065,0x5F06,0x5F75,0x5E05,0x5E66,0x5D05,0x5D65,0x5C06,0x5C75,0x5B05,0x5B66,0x5A05,0x5A65,0x5906,0x5975,
0x5805,0x5866,0x550D,0x570D,0x2170,0x2180,0x2190,0x7103,0x21A0,0x21B0,0x21C0,0x21D0,0x21E0,0x21F0,0x2200,0x2210,
0x5604,0x2220,0x2230,0x2240,0x2250,0x2260,0x2270,0x2280,0x2290,0x22A0,0x22B0,0x22C0,0x79D1,0x22D0,0x6DC3,0x78A1,
0x22E0,0x22F0,0x2300,0x2310,0x2320,0x2330,0x2340,0x2350,0x2360,0x2370,0x2380,0x2390,0x23A0,0x23B0,0x23C0,0x78C2,
0x2490,0x24A0,0x24B0,0x24C0,0x24D0,0x24E0,0x2580,0x2590,0x23D0,0x23E0,0x23F0,0x2400,0x2410,0x2420,0x2430,0x2440,
0x2450,0x2460,0x2470,0x2480,0x7771,0x24F0,0x2500,0x2510,0x2520,0x2530,0x2540,0x2550,0x2560,0x2570,0x25A0,0x25B0,
0x25C0,0x25D0,0x25E0,0x7791,0x77B1,0x25F0,0x2600,0x2610,0x2620,0x2630,0x2640,0x2650,0x2660,0x2670,0x2680,0x2690,
0x26A0,0x5656,0x5405,0x26B0,0x26C0,0x26D0,0x26E0,0x26F0,0x2700,0x2710,0x2720,0x2730,0x2740,0x2750,0x2760,0x2770,
0x2780,0x2790,0x27A0,0x27B0,0x27C0,0x27D0,0x27E0,0x27F0,0x2800,0x2810,0x2820,0x2830,0x2840,0x2850,0x2860,0xFF00,
0x2880,0x2890,0x28A0,0x28B0,0x28C0,0x28D0,0x28E0,0x28F0,0x2900,0x2910,0x2920,0x2930,0x2940,0x2950,0x2960,0x2970,
0x2980,0x2990,0x29A0,0x29B0,0x29C0,0x29D0,0x29E0,0x29F0,0x2A00,0x2A10,0x2A20,0x2A30,0x2A40,0x2A50,0x2A60,0x2A70,
0x2A80,0x2A90,0x2AA0,0x2AB0,0x2AC0,0x2AD0,0x2AE0,0x2AF0,0x2B00,0x2B10,0x2B20,0x2B30,0x2B40,0x2B50,0x2B60,0x2B70,
0x2B80,0x2B90,0x2BA0,0x2BB0,0x2BC0,0x2BD0,0x2BE0,0x2BF0,0x2C00,0x2C10,0x2C20,0x2C30,0x2C40,0x2C50,0x2C60,0x2C70,
0x2C80,0x2C90,0x2CA0,0x2CB0,0x2CC0,0x2CD0,0x2CE0,0x2CF0,0x2D00,0x2D10,0x2D20,0x2D30,0x2D40,0x2D50,0x2D60,0x2D70,
0x2D80,0x2D90,0x2DA0,0x2DB0,0x2DC0,0x2DD0,0x2DE0,0x2DF0,0x77D1,0x2E00,0x2E10,0x2E20,0x2E30,0x2E40,0x76E1,0x2E50,
0x2E60,0x2E70,0x2E80,0x2E90,0x2EA0,0x2EB0,0x2EC0,0x2ED0,0x2EE0,0x2EF0,0x2F00,0x2F10,0x2F20,0x2F30,0x2F40,0x2F50,
0x2F60,0x2F70,0x2F80,0x2F90,0x2FA0,0x2FB0,0x2FC0,0x2FD0,0x2FE0,0x2FF0,0x3000,0x3010,0x3020,0x3030,0x3040,0x3050,
0x3060,0x3070,0x3080,0x3090,0x30A0,0x30B0,0x30C0,0x30D0,0x30E0,0x30F0,0x3100,0x3110,0x3120,0x3130,0x3140,0x3150,
0x3160,0x3170,0x3180,0x3190,0x31A0,0x31B0,0x31C0,0x31D0,0x31E0,0x31F0,0x3200,0x3210,0x3220,0x3230,0x3240,0x3250,
0x3260,0x3270,0x3280,0x3290,0x32A0,0x32B0,0x32C0,0x32D0,0x32E0,0x32F0,0x3300,0x3310,0x3320,0x3330,0x3340,0x3350,
0x3360,0x3370,0x3380,0x3390,0x33A0,0x33B0,0x33C0,0x33D0,0x33E0,0x33F0,0x3400,0x3410,0x3420,0x3430,0x3440,0x3450,
0x3460,0x3470,0x3480,0x3490,0x34A0,0x34B0,0x34C0,0x34D0,0x34E0,0x34F0,0x3500,0x3510,0x3520,0x3530,0x3540,0x3550,
0x3560,0x3570,0x3580,0x3590,0x35A0,0x35B0,0x35C0,0x35D0,0x35E0,0x35F0,0x3600,0x3610,0x3620,0x3630,0x3640,0x3650,
0x3660,0x3670,0x3680,0x3690,0x36A0,0x36B0,0x36C0,0x36D0,0x36E0,0x36F0,0x3700,0x3710,0x3720,0x3730,0x3740,0x3750,
0x3760,0x3770,0x3780,0x3790,0x37A0,0x37B0,0x37C0,0x37D0,0x37E0,0x37F0,0x3800,0x3810,0x3820,0x3830,0x3840,0x3850,
0x3860,0x3870,0x3880,0x3890,0x38A0,0x38B0,0x38C0,0x38D0,0x38E0,0x38F0,0x3900,0x3910,0x3920,0x3930,0x3940,0x3950,
0x3960,0x3970,0x3980,0x3990,0x39A0,0x39B0,0x39C0,0x39D0,0x39E0,0x39F0,0x3A00,0x3A10,0x3A20,0x3A30,0x3A40,0x3A50,
0x3A60,0x3A70,0x3A80,0x3A90,0x3AA0,0x3AB0,0x3AC0,0x3AD0,0x3AE0,0x3AF0,0x3B00,0x3B10,0x3B20,0x3B30,0x3B40,0x3B50,
0x3B60,0x3B70,0x3B80,0x3B90,0x3BA0,0x3BB0,0x3BC0,0x3BD0,0x3BE0,0x3BF0,0x3C00,0x3C10,0x3C20,0x3C30,0x3C40,0x3C50,
0x3C60,0x3C70,0x3C80,0x3C90,0x3CA0,0x3CB0,0x3CC0,0x3CD0,0x3CE0,0x3CF0,0x3D00,0x3D10,0x3D20,0x3D30,0x3D40,0x5464,
0x3D60,0x3D70,0x3D80,0x3D90,0x3DA0,0x3DB0,0x3DC0,0x3DD0,0x3DE0,0x3DF0,0x3E00,0x3E10,0x3E20,0x3E30,0x3E40,0x3E50,
0x3E60,0x3E70,0x3E80,0x3E90,0x3EA0,0x3EB0,0x3EC0,0x3ED0,0x3EE0,0x3EF0,0x3F00,0x3F10,0x3F20,0x3F30,0x3F40,0x3F50,
0x3F60,0x3F70,0x3F80,0x3F90,0x3FA0,0x3FB0,0x3FC0,0x3FD0,0x3FE0,0x3FF0,0x4000,0x4010,0x4020,0x4030,0x4040,0x4050,
0x4060,0x4070,0x4080,0x4090,0x40A0,0x40B0,0x40C0,0x40D0,0x40E0,0x40F0,0x4100,0x4110,0x4120,0x4130,0x4140,0x4150,
0x4160,0x4170,0x4180,0x4190,0x41A0,0x41B0,0x41C0,0x41D0,0x41E0,0x41F0,0x4200,0x4210,0x4220,0x4230,0x4240,0x4250,
0x4260,0x4270,0x4280,0x4290,0x42A0,0x42B0,0x42C0,0x42D0,0x42E0,0x42F0,0x4300,0x4310,0x4320,0x4330,0x4340,0x4350,
0x4360,0x4370,0x4380,0x4390,0x43A0,0x43B0,0x43C0,0x43D0,0x43E0,0x3D50,0x43F0,0x4410,0x4420,0x4430,0x4440,0x4450,
0x4460]
def flagid_to_spreadsheet(us, flagid):
base = 0x805A9AD8 if us else 0x805ACD58
mapping = storyflag_mapping_table[flagid]
if mapping == 0xFF00:
return '-'
if mapping % 0x10 != 0:
assert (mapping // 0x1000) in (0x5,0x6,0x7)
return '(not implemented yet -- %04X)'%mapping
x = mapping // 0x10
return '%08X 0x%02X'%((base+x//8)^1,1<<(x%8))
if __name__ == "__main__":
'''
print(flagid_to_spreadsheet(False,341))
print(flagid_to_spreadsheet(False,342))
print(flagid_to_spreadsheet(False,486))
print()
print(flagid_to_spreadsheet(False,13))
print(flagid_to_spreadsheet(False,175))
print(flagid_to_spreadsheet(False,704))
print()
print(flagid_to_spreadsheet(True,341))
print(flagid_to_spreadsheet(True,342))
print(flagid_to_spreadsheet(True,486))
print()
print(flagid_to_spreadsheet(True,13))
print(flagid_to_spreadsheet(True,175))
print(flagid_to_spreadsheet(True,704))
print()
print(flagid_to_spreadsheet(True,0xB))
'''
f2=open('storyflags.txt','w')
for i in range(len(storyflag_mapping_table)):
f2.write('Story Flag #%d (0x%04X) - JP %s / US %s\n' % (i,i,flagid_to_spreadsheet(False,i),flagid_to_spreadsheet(True,i)))
f2.close()