-
-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
request: VGM pattern #180
Comments
I think a lot of pattern-writers are/were beginners once! I'd suggest taking a look at some other simple patterns to learn how it works and modify it as you go. I was able to make a basic one with no prior experience other than the documentation and the existing pattern files. |
I looked at the specification for VGM and that's a fairly complex format. For what purpose do you need the ImHex pattern? |
Exactly what you say: it's complex and i want to learn it using a pattern for imhex. |
To me the format looks fairly straight forward. It's just large. As an example, I'd start like this: #include <type/magic.pat>
struct Header {
type::Magic<"Vgm "> ident;
u32 eofOffset;
u32 version;
// ...
};
struct VGM {
Header header;
}:
VGM vgm @ 0x00; |
The complexity of the format far surpasses the complexity of the concepts needed to write a pattern in general. The absolute best way to learn a complex format is to write the pattern for it so that you learn all the intricacies of how the data is stored.
Emphasis should be placed in the 'To me' part. To me a simple format is one I can read once and have a mental image of it. I couldn't do that with this one. But I second the recommendation. Learning the basics of pattern language is not difficult at all but rather easy instead. |
Hey! I've been working on the general layout of this pattern for a few days and I've posted the result here as a GitHub Gist. It's got quite a few problems, so I'm not going to PR it in. Here are a few problems:
|
it shouldn't be too hard to implement your own decoding based on what you said. the one the imhex defines works on 8 bits per char and you want to use 4 bits instead. this is the code it uses. can it be modified to handle the particular packed version you want to use? struct BCD<auto Digits> {
u8 bytes[Digits];
} [[sealed, format_read("type::impl::format_bcd")]];
fn format_bcd(ref auto bcd) {
str result;
for (u32 i = 0, i < sizeof(bcd.bytes), i += 1) {
u8 byte = bcd.bytes[i];
if (byte >= 10)
return "Invalid";
result += std::format("{}", byte);
}
return result;
}; I don't understand what the problem is with bits 30 and 31. All you mention is that it is not being read. To read any bit usually one creates a mask to and ( As for the last problem I'm not sure what the error message means, there is no variable named |
@paxcut I've been using this file for testing - you should just be able to get it by clicking the 'Donload' button (no, that's not a typo). I might just leave the dual-chip and chip selection bits, since they aren't essential to decoding the file. As for the packed BCD situation, it would probably require a bit of a different approach, since I'd have to use bitfields instead of |
Hi
I would like to request a VGM pattern (video game music)
You can see the header here
https://vgmrips.net/wiki/VGM_Specification
I'm a total beginner and can't make this myself :(
I hope somebody can create this pattern (for latest VGM version)
The text was updated successfully, but these errors were encountered: