resonance-data-columba 1.1.42 → 1.1.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resonance-data-columba",
3
- "version": "1.1.42",
3
+ "version": "1.1.44",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "keywords": [],
@@ -21,6 +21,7 @@
21
21
  "build": "pnpm parse && tsup src/index.ts --dts",
22
22
  "prepare-build-columba": "ts-node ./src/change-package-name-for-columba-build.ts",
23
23
  "build-columba": "tsup src/columbabuild.ts --dts",
24
- "test": "exit 0"
24
+ "test": "exit 0",
25
+ "unpackconfig": "python ./rsns-depack/binary/analyse.py"
25
26
  }
26
27
  }
@@ -0,0 +1,189 @@
1
+ import os
2
+ import json
3
+ import struct
4
+ import shutil
5
+
6
+
7
+ def read_byte(buf):
8
+ return buf.read(1)[0]
9
+
10
+
11
+ def read_bool(buf):
12
+ return struct.unpack("?", buf.read(1))[0]
13
+
14
+
15
+ def read_int(buf):
16
+ return struct.unpack("i", buf.read(4))[0]
17
+
18
+
19
+ def read_long(buf):
20
+ return struct.unpack("q", buf.read(8))[0]
21
+
22
+
23
+ def read_float(buf):
24
+ return struct.unpack("f", buf.read(4))[0]
25
+
26
+
27
+ def read_double(buf):
28
+ return struct.unpack("d", buf.read(8))[0]
29
+
30
+
31
+ def readstr_size(buf, size=-1):
32
+ size = size if size > 0 else read_byte(buf)
33
+ if size == 0:
34
+ return "", 0
35
+ add_size = 0
36
+ bt = read_byte(buf)
37
+ if bt < 32:
38
+ size += 128 * (bt - 1)
39
+ add_size += 1
40
+ else:
41
+ buf.seek(-1, 1)
42
+ return buf.read(size).decode(), size + add_size
43
+
44
+
45
+ def readstr(buf, size=-1):
46
+ return readstr_size(buf, size)[0]
47
+
48
+
49
+ def read_str_pool(buf):
50
+ pool = {}
51
+ size = read_int(buf)
52
+ read_size = 0
53
+ while read_size < size:
54
+ pool[read_size], str_len = readstr_size(buf)
55
+ read_size += str_len + 1
56
+ return pool
57
+
58
+
59
+ def read_dynamic(buf, t, str_pool):
60
+ if t == 0 or t == 6:
61
+ return read_int(buf)
62
+ elif t == 1:
63
+ return read_double(buf)
64
+ elif t == 2:
65
+ return read_long(buf)
66
+ elif t == 3:
67
+ return read_bool(buf)
68
+ elif t == 7 or t == 8:
69
+ return read_array_info(buf, str_pool)
70
+ elif t == 15:
71
+ return read_long(buf)
72
+ elif t == 99:
73
+ return read_property_map(buf, str_pool)
74
+ else:
75
+ return str_pool[read_int(buf)]
76
+
77
+
78
+ def read_array_item(buf, str_pool):
79
+ read_int(buf) # size
80
+ num = read_int(buf)
81
+ items = []
82
+ for _ in range(0, num):
83
+ items.append(read_ca_property(buf, str_pool))
84
+
85
+
86
+ def read_array_info(buf, str_pool):
87
+ read_int(buf) # size
88
+ t = read_byte(buf)
89
+ num = read_int(buf)
90
+ items = []
91
+ for _ in range(0, num):
92
+ items.append(read_dynamic(buf, t, str_pool))
93
+ return items
94
+
95
+
96
+ def read_single_bin(buf, str_pool):
97
+ read_int(buf) # size
98
+ return {
99
+ "meta": read_meta_section(f),
100
+ "menu": read_menu_section(f, str_pool),
101
+ "data": read_data_section(f, str_pool),
102
+ }
103
+
104
+
105
+ def read_meta_section(buf):
106
+ read_int(buf) # size
107
+ return {
108
+ "author": readstr(buf),
109
+ "date": read_long(buf),
110
+ "etc": readstr(buf),
111
+ }
112
+
113
+
114
+ def read_ca_index(buf, str_pool):
115
+ assert read_int(buf) == 12 # size
116
+ return {
117
+ "id": read_int(buf),
118
+ "idCN": str_pool[read_int(buf)],
119
+ "index": read_int(buf),
120
+ }
121
+
122
+
123
+ def read_menu_section(buf, str_pool):
124
+ read_int(buf) # size
125
+ num = read_int(buf)
126
+ menu = {}
127
+ for _ in range(0, num):
128
+ ca = read_ca_index(buf, str_pool)
129
+ index = ca["index"]
130
+ ca.pop("index")
131
+ menu[index] = ca
132
+ return menu
133
+
134
+
135
+ def read_ca_property(buf, str_pool):
136
+ read_int(buf) # size
137
+ key = str_pool[read_int(buf)]
138
+ t = read_byte(buf)
139
+ return key, read_dynamic(buf, t, str_pool)
140
+
141
+
142
+ def read_property_map(buf, str_pool):
143
+ read_int(buf) # size
144
+ num = read_int(buf)
145
+ props = {}
146
+ for _ in range(0, num):
147
+ prop = read_ca_property(buf, str_pool)
148
+ props[prop[0]] = prop[1]
149
+ return props
150
+
151
+
152
+ def read_data_section(buf, str_pool):
153
+ read_int(buf) # size
154
+ num = read_int(buf)
155
+ data = []
156
+ for _ in range(0, num):
157
+ data.append(read_property_map(buf, str_pool))
158
+ return data
159
+
160
+ def init_path(path):
161
+ if os.path.exists(path):
162
+ shutil.rmtree(path)
163
+ os.makedirs(path)
164
+
165
+ src_path = os.path.abspath("D:\\Program Files\\BlueStacks_nxt\\Engine\\UserData\\SharedFolder\\BinaryConfig")
166
+ out_path = os.path.abspath("Data")
167
+
168
+ init_path(out_path)
169
+
170
+ for file_name in os.listdir(src_path):
171
+ if os.path.splitext(file_name)[1] == '':
172
+ continue
173
+ with open(os.path.join(src_path, file_name), "rb") as f:
174
+ try:
175
+ result = {}
176
+ result["version"] = read_byte(f)
177
+ result["hash"] = readstr(f)
178
+ str_pool = read_str_pool(f)
179
+ result["str_pool"] = str_pool
180
+ result.update(read_single_bin(f, str_pool))
181
+ dump_data = result["data"]
182
+ print("ok:", file_name)
183
+ except Exception as e:
184
+ print("err:", file_name)
185
+ dump_data = {"error": str(e)}
186
+ with open(
187
+ os.path.join(out_path, os.path.splitext(file_name)[0] + ".json"), "w", encoding="utf-8"
188
+ ) as f:
189
+ json.dump(dump_data, f, ensure_ascii=False, indent=2)
@@ -0,0 +1,11 @@
1
+ python patch_lua.py
2
+
3
+ Get-ChildItem -Path .\patch -File -Recurse | ForEach-Object {
4
+ Write-Output $_.FullName.Substring($PWD.Path.Length + 6)
5
+ $parent = 'patch\' + $_.Directory.FullName.Substring($PWD.Path.Length + 6)
6
+ mkdir -p $parent -ErrorAction SilentlyContinue
7
+ $outPath = 'patch\' + $_.FullName.Substring($PWD.Path.Length + 6)
8
+ java -jar .\unluac.jar -o $outPath $_.FullName
9
+ }
10
+
11
+ python patch_lua_uni.py
@@ -0,0 +1,24 @@
1
+ import os
2
+ import shutil
3
+
4
+ src_path = os.path.abspath("src")
5
+ out_path = os.path.abspath("patch")
6
+
7
+ if os.path.exists(out_path):
8
+ shutil.rmtree(out_path)
9
+ shutil.copytree(src_path, out_path)
10
+
11
+ for root, dirs, files in os.walk(out_path):
12
+ for file_name in files:
13
+ fpath = os.path.join(root, file_name)
14
+ if os.path.splitext(file_name)[1] == '':
15
+ os.remove(fpath)
16
+ continue
17
+ with open(fpath, "rb") as f:
18
+ data = f.read()
19
+ with open(fpath, "wb") as f:
20
+ f.write(data[:5])
21
+ f.write(b"\x00")
22
+ f.write(data[6:14])
23
+ f.write(b"\x04")
24
+ f.write(data[14:])
@@ -0,0 +1,20 @@
1
+ import os
2
+ import re
3
+
4
+ src_path = os.path.abspath("out")
5
+
6
+
7
+ for root, dirs, files in os.walk(src_path):
8
+ for file_name in files:
9
+ print(os.path.join(root, file_name))
10
+ with open(os.path.join(root, file_name), "r", encoding="utf-8") as f:
11
+ content = f.read()
12
+ content = re.sub(
13
+ r"\\(\d\d\d)\\(\d\d\d)\\(\d\d\d)",
14
+ lambda match: bytes(
15
+ [int(match.group(1)), int(match.group(2)), int(match.group(3))]
16
+ ).decode(),
17
+ content,
18
+ )
19
+ with open(os.path.join(root, file_name), "w", encoding="utf-8") as f:
20
+ f.write(content)
Binary file