-
Notifications
You must be signed in to change notification settings - Fork 8
/
bgi_config.py
48 lines (39 loc) · 1.94 KB
/
bgi_config.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
# BGI version configurations
# These can possibly differ between different BGI games. Modify/add as necessary.
# no header
ver000 = {
'HDR_SIZE' : 0x0, # base header size
'HDRAS_POS': None, # offset of additional header data size (set to None if not used)
'STR_TYPE': 0x3, # string type identifier
'FILE_TYPE': 0x7F, # file type identifier
'TEXT_FCN': 0x140, # function id for text command (set to None if not used)
'BKLG_FCN': 0x143, # function id for backlog text command (set to None if not used)
'RUBY_FCN': 0x14B, # function id for ruby command (set to None if not used)
'NAME_POS': 0x24, # offset of TXT_FCN from name argument
'TEXT_POS': 0x2C, # offset of TXT_FCN from text argument
'RUBYK_POS': 0x14, # offset of RUBY_FCN from kanji argument
'RUBYF_POS': 0x0C, # offset or RUBY_FCN from furigana argument
'BKLG_POS': 0x0C, # offset of BKLG_FCN from text argument
}
# header beginning with "BurikoCompiledScriptVer1.00"
ver100 = {
'HDR_SIZE': 0x1C, # base header size
'HDRAS_POS': 0x1C, # offset of additional header data size (set to None if not used)
'STR_TYPE': 0x3, # string type identifier
'FILE_TYPE': 0x7F, # file type identifier
'TEXT_FCN': 0x140, # function id for text command (set to None if not used)
'BKLG_FCN': 0x143, # function id for backlog text command (set to None if not used)
'RUBY_FCN': 0x14B, # function id for ruby command (set to None if not used)
'NAME_POS': 0x0C, # offset of TXT_FCN from name argument
'TEXT_POS': 0x04, # offset of TXT_FCN from text argument
'RUBYK_POS': 0x04, # offset of RUBY_FCN from kanji argument
'RUBYF_POS': 0x0C, # offset or RUBY_FCN from furigana argument
'BKLG_POS': 0x0C, # offset of BKLG_FCN from text argument
}
# select which version based on known header string
def get_config(data):
if data.startswith(b'BurikoCompiledScriptVer1.00\x00'):
config = ver100
else:
config = ver000
return config