CPCWiki forum

General Category => Programming => Topic started by: Targhan on 20:50, 10 February 21

Title: Extract data from SNApshot
Post by: Targhan on 20:50, 10 February 21
I don't want to reinvent the wheel: is there a command line tool (win+linux if possible) to extract the data from a SNApshot?
Something like:
snaExtract <input sna> <start> <length> output.bin ?

Thanks!
Title: Re: Extract data from SNApshot
Post by: redbox on 21:09, 10 February 21
A SNApshot is just the binary data plus a header:

https://cpctech.cpc-live.com/docs/snapshot.html
Title: Re: Extract data from SNApshot
Post by: roudoudou on 21:18, 10 February 21
Quote from: Targhan on 20:50, 10 February 21
I don't want to reinvent the wheel: is there a command line tool (win+linux if possible) to extract the data from a SNApshot?
Something like:
snaExtract <input sna> <start> <length> output.bin ?

Thanks!


Not yet but i planned an INCSNA directive...
Title: Re: Extract data from SNApshot
Post by: Targhan on 23:24, 10 February 21
Quote from: redbox on 21:09, 10 February 21A SNApshot is just the binary data plus a header:
Yes, I know that already. But it can be more subtle: there can be potential chunks after. Anyway, I just wanted to know if someone had a ready-made tool.
Title: Re: Extract data from SNApshot
Post by: redbox on 01:17, 11 February 21
Quote from: Targhan on 23:24, 10 February 21
Yes, I know that already. But it can be more subtle: there can be potential chunks after.

You could do it in Python to get the command line syntax you're after.

f = open('filename.sna', 'rb')
f.seek(255) # skip 255 bytes
rest = f.read() # read the rest


Python also has the bytes and bytearray manipulation built-in which would be useful.

Title: Re: Extract data from SNApshot
Post by: Targhan on 09:21, 11 February 21
Quote from: redbox on 01:17, 11 February 21You could do it in Python
My thoughts exactly :). Such a great language.
Title: Re: Extract data from SNApshot
Post by: roudoudou on 15:40, 11 February 21

last version of snapshot contains crunched chunks so that's not that easy
Title: Re: Extract data from SNApshot
Post by: Targhan on 16:52, 11 February 21
Quote from: roudoudou on 15:40, 11 February 21
last version of snapshot contains crunched chunks so that's not that easy
But fortunately, I am generating them via Ramlaid's tool, and it does not compact the data.
Title: Re: Extract data from SNApshot
Post by: redbox on 17:13, 11 February 21
Quote from: Targhan on 16:52, 11 February 21But fortunately, I am generating them via Ramlaid's tool, and it does not compact the data.

WinAPE also lets you choose if the data is compressed or uncompressed.

Targhan, is there any way of importing a YM dump into Arkos Tracker?
Title: Re: Extract data from SNApshot
Post by: Targhan on 17:55, 11 February 21
Quote from: redbox on 17:13, 11 February 21Targhan, is there any way of importing a YM dump into Arkos Tracker?

You should ask this in another thread :). No, it would be meaningless or too hard to convert to a real song. However, you can drag'n'drop it to the YM Analyzer and hack some sounds from it.
Title: Re: Extract data from SNApshot
Post by: redbox on 18:17, 11 February 21
Quote from: Targhan on 17:55, 11 February 21However, you can drag'n'drop it to the YM Analyzer and hack some sounds from it.

Do you have a link to this please?
Title: Re: Extract data from SNApshot
Post by: Targhan on 18:20, 11 February 21
Quote from: redbox on 18:17, 11 February 21Do you have a link to this please
It's inside AT2 itself. Tools > YM Analyzer.
Powered by SMFPacks Menu Editor Mod