-
Notifications
You must be signed in to change notification settings - Fork 31
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
Stop using duplicate keys in JSON: take 2 #20
Conversation
The array-style kernel caps look like: "kernel_capabilities": [ { type: "irq_pair", value: [1, 2] }, // ... ] Deprecates duplicate-key style.
You forgot hbloader :p |
Yeah, I used a quick script that used gh search to find all json containing kernel_capabilities, and auto-submit a pr. Not sure whi hbl got missed. I'll do a manual fix I guess |
Alright, I found a better search term that managed to find more repositories with NPDM-JSONs, including nx-hbloader. Going to fix the script and open a few more PRs. |
Yeah OK there was a bug in my script actually. Fixed it, got 4 new PRs. That should be all of them now :). |
Splits service_access into service_host and service_access, both arrays of strings. We output service_host first, as that seems to be what Nintendo is doing - all their NPDMs have service hosts before service accesses.
Added implementation to parse service_access/service_host. It's also implemented in hactool, and all the homebrew PRs got updated. |
That service-list commit only updated npdmtool, not elf2kip. |
KIPs don't have service lists? |
nvm |
Will a release follow shortly after? :P |
Description
Currently, the NPDM-JSON format abuses duplicate keys where it should be using arrays instead. While cJSON supports this, most JSON parsers don't. This is causing issues for me currently when building linkle as serde-json (a deserializer for JSON in rust) doesn't support this. While I could probably fix that issue in serde-json, I think moving to a saner format using JSON arrays is also a good idea.
The main reason why this tool needs fixing, however, is that it makes it impossible to create tools that reason about NPDM-JSON generated by hactool. I've been meaning to create some tools that allows visualizing the interactions between all processes of the switch OS, using the NPDMs, and that is currently not possible without either manually parsing the raw NPDM, or using one of the few, rare JSON parsers that allow duplicate keys. This situation is annoying.
Solution
After debating with SciresM a bit in the RS server, it was decided that
kernel_capabilities
should be changed to an object that takes two keys ("type" and "value"), andservice_access
would be split into two string arrays:service_host
andservice_access
This PR deprecates duplicate-key style. It still allows parsing them though, to give some time for homebrew to migrate. It may get removed in a later PR.
Meta
Associated PR:
I'll also mass-PR fixes to all open source homebrews.