-
Notifications
You must be signed in to change notification settings - Fork 108
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
validate_mempak() => always -3 (bad or unformatted) #326
Comments
Can you provide a dump of Controller Pak data (32 KiB .MPK file) for any one which gives you a -3? |
@bryc |
@bryc |
Hi, just now had some time to look into it. I'm not really good with C, but I know a lot about MPK file format, so I can maybe help narrow the problem: First of all, your MPK data is fully valid, so the problem must be the code. I checked
Now I checked the code, and I can confirm it's doing the validation logic correctly, i.e. the math. So what this means is, if the data supplied is actually valid (which it should be), these errors shouldn't happen. This makes me wonder if somehow the MPK data isn't being read into I think it would help to create a hex dump on screen (or console?), of what Related functions:
Or you could hard-code data[256] = {
0x81, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B,
0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF,
0x05, 0x1A, 0x5F, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0xFF,
0x66, 0x25, 0x99, 0xCD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0x05, 0x1A, 0x5F, 0x13, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0x01, 0xFF, 0x66, 0x25, 0x99, 0xCD, 0xFF, 0xFF, 0xFF, 0xFF,
0x05, 0x1A, 0x5F, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0xFF,
0x66, 0x25, 0x99, 0xCD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0x05, 0x1A, 0x5F, 0x13, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0x01, 0xFF, 0x66, 0x25, 0x99, 0xCD, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
}; Other than that, that's all I got. |
Thanks for your investigations. I can fork this repo and change the code. But I actually dont know how to get the change into my Altra64 dev build docker image. I think I have to edit the setup-docker.sh and change these lines to my fork:
But then every change in libdragon will take ~1h to build the docker image again. |
You shouldn't need to build the toolchain everytime you change something in the library if you configure things correctly. Even if you download the repository fresh everytime, docker |
Ok thanks for your answer. But I even dont know how to edit things (in my case libdragon\mempak.c and controller.c) inside my docker image that was generated via github actions. Im still a rookie regardings docker and github. Do you know how to do that? |
I suggest building the libdragon example instead and try to verify the data without altra64. The instructions at https://github.com/DragonMinded/libdragon are very helpful in general but we can help if you need any assistance. |
I actually try to figure out why the "show Mempak" function in Altra64 doesnt work for me and my two original Controller Paks (NUS-004). The functionality is 1:1 copied from the [mptest.c] https://github.com/DragonMinded/libdragon/blob/trunk/examples/mptest/mptest.c) except Altra only search for mempaks on port 0. I can backup the data or format the mempak without any problems. And I can see the contents with saturnus Mempak Tool. Even @ariahiro64 have problems with it.
I checked the Mempak content (header) of my mempak and its 1:1 the same as format_mempak() writes in it.
The text was updated successfully, but these errors were encountered: