nurpax / petmate

PETSCII editor with Electron/React/Redux
MIT License
178 stars 14 forks source link

c1541js needs offset feature to be usable #182

Closed ByteProject closed 4 years ago

ByteProject commented 4 years ago

In its current state, c1541js writes directory art .json files only at the beginning of the .D64 directory structure. That makes the tool unusable for automated release builds, where you'd want to append a generic directory art at the very end of the .D64 file. Provided that the necessary number of files are already on disk, c1541js needs an offset feature, so that you may direct it to write the contents of the dirart.json file starting for example at file 7, leaving entries 1-6 on the .D64 file completely untouched. I've provided an example of a directory art file which you may use for testing it being appended at the end of a given D64 directory structure.

puddle_dirart.json.zip

nurpax commented 4 years ago

This change just got released on npm as c1541 v0.4.0. Update with npm -g i c1541.

Add --dest-offset and --dest-length options

Allow writing the input dirart rows into some specified
destination row in destination .d64 file.  Previous
behavior (and new default) was to write the rows
starting from the first row.

Also add --dest-length (defaults to length of source art)
which can be used to select fewer lines from source art.

Example use:

c1541 --dest-offset 10 --json foo.json source.d64 out.d64

This will overwrite source.d64 dir entry names starting at
row index 10.  (offset is zero base indexed)

For nurpax/petmate#182

Hopefully this gets the job done.

Adding or removing new dir entries into a d64 file is something that I didn't want to do in this tool. Mainly because the current "just overwrite some bytes at known offsets" is dead easy to implement correctly, whereas actually creating entries and maybe new sectors in a D64 file is much more complicated.. and since VICE has c1541, I wanted to punt the hard stuff on that tool. :)

ByteProject commented 4 years ago

Thank you so much! As already confirmed on Twitter ---> this is working wonderful now! Thanks for your kind support. Cheers!