Skip to content

Commit 226cf78

Browse files
committed
Added s2 support for project files
1 parent 3eb7c99 commit 226cf78

File tree

1 file changed

+52
-42
lines changed

1 file changed

+52
-42
lines changed

development/sonlvl.js

Lines changed: 52 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,25 @@
33
const { readFileSync } = require('fs');
44
const { join } = require('path');
55

6-
const base = __dirname + '/../../flex2_test/s1disasm/SonLVL INI Files/';
7-
const format = 'Sonic 1.js';
8-
const projectName = 'Sonic 1';
6+
const base = __dirname + '/../../flex2_test/s2disasm/SonLVL INI Files/';
7+
const format = 'Sonic 2.js';
8+
const projectName = 'Sonic 2';
99
const defaultCmp = 'Nemesis';
1010
const folders = [
1111
'obj.ini',
12-
'objGHZ.ini',
13-
'objLZ.ini',
14-
'objMZ.ini',
15-
'objSBZ.ini',
16-
'objSLZ.ini',
17-
'objSYZ.ini',
12+
'objARZ.ini',
13+
'objMCZ.ini',
14+
'objCNZ.ini',
15+
'objMTZ.ini',
16+
'objCPZ.ini',
17+
'objOOZ.ini',
18+
'objDEZ.ini',
19+
'objSCZ.ini',
20+
'objEHZ.ini',
21+
'objWFZ.ini',
1822
];
1923
const basePalette = [
20-
{ path: 'palette/Sonic.bin', length: 1 }
24+
{ path: 'art/palettes/SonicAndTails.bin', length: 1 }
2125
];
2226
const pathMod = (str) => str.slice(3).replace(/&/g, '&').replace(/\|.+/, '');
2327

@@ -63,7 +67,44 @@ folders.forEach(filename => {
6367

6468
const ini = readFileSync(join(base, filename), 'utf8');
6569
parseINI(ini).forEach(obj => {
66-
if (obj.codefile) {
70+
if (obj.mapasm) {
71+
obj.map = obj.mapasm
72+
}
73+
if (obj.dplcasm) {
74+
obj.dplc = obj.dplcasm;
75+
}
76+
if (obj.art && obj.map) {
77+
const flexObj = {
78+
name: obj.name || '???',
79+
palettes,
80+
format,
81+
art: {
82+
path: pathMod(obj.art),
83+
compression: defaultCmp,
84+
offset: 0,
85+
},
86+
mappings: {
87+
path: pathMod(obj.map),
88+
label: '',
89+
},
90+
dplcs: {
91+
enabled: false,
92+
path: '',
93+
label: '',
94+
},
95+
};
96+
97+
if (obj.dplc) {
98+
flexObj.dplcs.enabled = true;
99+
flexObj.dplcs.path = pathMod(obj.dplc);
100+
}
101+
102+
if (obj.artcmp) {
103+
flexObj.art.compression = obj.artcmp;
104+
}
105+
106+
folder.children.push(flexObj);
107+
} else if (obj.codefile) {
67108
const cs = readFileSync(join(base, obj.codefile), 'utf8');
68109
const flexObj = {
69110
name: '???',
@@ -110,37 +151,6 @@ folders.forEach(filename => {
110151
flexObj.mappings.path = pathMod(map[2]);
111152
}
112153

113-
folder.children.push(flexObj);
114-
} else if (obj.art && obj.mapasm) {
115-
const flexObj = {
116-
name: obj.name || '???',
117-
palettes,
118-
format,
119-
art: {
120-
path: pathMod(obj.art),
121-
compression: defaultCmp,
122-
offset: 0,
123-
},
124-
mappings: {
125-
path: pathMod(obj.mapasm),
126-
label: '',
127-
},
128-
dplcs: {
129-
enabled: false,
130-
path: '',
131-
label: '',
132-
},
133-
};
134-
135-
if (obj.dplcasm) {
136-
flexObj.dplcs.enabled = true;
137-
flexObj.dplcs.path = pathMod(obj.dplcasm);
138-
}
139-
140-
if (obj.artcmp) {
141-
flexObj.art.compression = obj.artcmp;
142-
}
143-
144154
folder.children.push(flexObj);
145155
}
146156
})

0 commit comments

Comments
 (0)