Skip to content

Commit baaf1a8

Browse files
committed
s3k sonic read complete ?
1 parent ae9ca24 commit baaf1a8

File tree

5 files changed

+35
-27
lines changed

5 files changed

+35
-27
lines changed

TODO

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ BUFFER
2626

2727
// formats to support
2828

29-
/* https://github.com/Ralakimus/sonic-cd-r11a-disassembly */
30-
/* http://info.sonicretro.org/Disassemblies */
31-
// s3k sonic
3229
// kid chameleon
3330
// crackers
3431
// chaotix
32+
// s3k sonic saving
3533
// streets of rage
3634
// plane mappings / snap to
3735
// github issues
36+
/* https://github.com/Ralakimus/sonic-cd-r11a-disassembly */
37+
/* http://info.sonicretro.org/Disassemblies */
3838

3939
ROADMAP
4040
custom mapping formats / screen mappings format (!) ->

app/components/file/file-object.js

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,17 @@ const compressionList = Object.keys(compressionFormats);
2323

2424
export const FileObject = observer(({ obj }) => {
2525
scripts.length; // react to script updates
26+
const script = obj.format && runScript(obj.format);
2627

2728
const { isAbsolute } = obj; // set in store/workspace
2829

2930
const mappingsASM = extname(obj.mappings.path) === '.asm';
3031
const dplcsASM = extname(obj.dplcs.path) === '.asm';
3132
const linesLeft = obj.palettes.reduce((a, c) => a - c.length, 4);
3233

34+
const scriptDPLCs = script && !script.error && script.hasDPLCs;
3335
const toggleDPLCs = () => (obj.dplcs.enabled = !obj.dplcs.enabled);
3436

35-
const script = obj.format && runScript(obj.format);
3637

3738
function ioWrap(filePath, setError, e, cb) {
3839
setError();
@@ -143,7 +144,7 @@ export const FileObject = observer(({ obj }) => {
143144
}
144145

145146
function saveDPLCs(e) {
146-
ioWrap(obj.dplcs.path, setMappingError, e, async (path) => {
147+
ioWrap(obj.dplcs.path, setDPLCError, e, async (path) => {
147148
const dplcs = script.writeDPLCs(environment.dplcs);
148149
if (dplcs.error) throw dplcs.error;
149150
if (!dplcsASM) {
@@ -269,28 +270,32 @@ export const FileObject = observer(({ obj }) => {
269270
</div>
270271
)}
271272

272-
<div className="menu-item" onClick={toggleDPLCs}>
273-
<Item>DPLCs Enabled</Item>
274-
<Checkbox checked={obj.dplcs.enabled} readOnly />
275-
</div>
276-
{obj.dplcs.enabled && (
273+
{scriptDPLCs && (
277274
<>
278-
<div className="menu-item">
279-
<Item color="red">DPLCs</Item>
280-
<SaveLoad load={loadDPLCs} save={saveDPLCs} />
275+
<div className="menu-item" onClick={toggleDPLCs}>
276+
<Item>DPLCs Enabled</Item>
277+
<Checkbox checked={obj.dplcs.enabled} readOnly />
281278
</div>
282-
<ErrorMsg error={dplcError} />
283-
<FileInput
284-
label="Mappings"
285-
store={obj.dplcs}
286-
accessor="path"
287-
absolute={isAbsolute}
288-
/>
289-
{dplcsASM && (
290-
<div className="menu-item">
291-
<Item>ASM Label</Item>
292-
<Input store={obj.dplcs} accessor="label" />
293-
</div>
279+
{obj.dplcs.enabled && (
280+
<>
281+
<div className="menu-item">
282+
<Item color="red">DPLCs</Item>
283+
<SaveLoad load={loadDPLCs} save={saveDPLCs} />
284+
</div>
285+
<ErrorMsg error={dplcError} />
286+
<FileInput
287+
label="Mappings"
288+
store={obj.dplcs}
289+
accessor="path"
290+
absolute={isAbsolute}
291+
/>
292+
{dplcsASM && (
293+
<div className="menu-item">
294+
<Item>ASM Label</Item>
295+
<Input store={obj.dplcs} accessor="label" />
296+
</div>
297+
)}
298+
</>
294299
)}
295300
</>
296301
)}

app/formats/scripts/debug.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { environment } from '#store/environment';
99
const inspect = (obj) => util.inspect(toJS(obj));
1010

1111
class MapLogger {
12-
@observable enabled = true;
12+
@observable enabled = false;
1313
@observable log = [];
1414
@observable queue = [];
1515
@action msg = (...objs) => {

app/formats/scripts/run-script.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,9 @@ export default catchFunc((file) => {
286286

287287
return {
288288
readMappings,
289-
readDPLCs,
290289
writeMappings,
290+
hasDPLCs: !!dplcArgs[0],
291+
readDPLCs,
291292
writeDPLCs,
292293
};
293294
});

scripts/Sonic 3&K Sonic.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ mappings([
3434
});
3535
},
3636
({ sprite }) => {
37+
throw new Error('convert to S3K Player instead');
3738
write(dc.w, sprite.length);
3839
return ({ mapping }) => {
3940
// top
@@ -68,6 +69,7 @@ dplcs([
6869
});
6970
},
7071
({ sprite }) => {
72+
throw new Error('convert to S3K Player instead');
7173
write(dc.w, sprite.length);
7274
return ({ mapping }) => {
7375
write(nybble, mapping.size - 1);

0 commit comments

Comments
 (0)