vgmrips / vgmtools

A collection of tools for the VGM file format
GNU General Public License v2.0
123 stars 18 forks source link

vgm_cmp error for using DCSG VGM #11

Closed denjhang closed 3 years ago

denjhang commented 3 years ago

vgm_cmp.zip These files in the compressed package cannot be compressed using vgm_cmp.

ValleyBell commented 3 years ago

hmm ... it gets confused by the lack of EoF command in those files.

How did you manage to create such files?

EDIT: What happens is, that it processes data from [beginning ... EOF offset] - or until the EOF command occours, whatever comes first. In pass 1, the file gets smaller, but it doesn't set its internal EOF offset so the new size. So in pass 2 it processes data beyond the end of the file. This happens only when there is no EOF command, as the EOF command would cause it to correctly stop processing.

denjhang commented 3 years ago

I used the wav2psg provided in a post on the sms power! forum more than ten years ago for conversion wav to psg.zip .

ValleyBell commented 3 years ago

Okay, interesting.

Anyway, a675dd892357146d90a8cb6fc27a87d7d28ec6ae fixes the crash. It doesn't really "fix" the files though (i.e. they will still lack the EOF offset) and it seems to eat up the last wait command in the file.

denjhang commented 3 years ago

So how do I add EOF to the vgm?

ValleyBell commented 3 years ago

You add a byte 66 with a hex editor to the end of the file. Then you increase the "EOF offset" in the VGM header (offset 0x04..0x07) by 1.