Sharing some code I wrote to help with debugging homebrew apps.
I'm new to homebrew dev, so still figuring out libnx. Someone could probably tell me how there's a much better way to do this, but here's what I've got.
A bunch of libnx calls return a Result code which is just some numbers that you need to look up on dev kit pro wiki.
So save time trying to lookup error codes, I have some code to just print the error string to console.
Added a build flag to enable it since it's a ton of strings that will bloat the app size.
so basically the idea is you would compile with -DENABLE_ERROR_CODE_PRINTS
Then write something like:
And it would print something like:
The top message would be printed even if the flag is disabled
The bottom message is the lookup, so is only compiled in with the build flag
I'm new to homebrew dev, so still figuring out libnx. Someone could probably tell me how there's a much better way to do this, but here's what I've got.
A bunch of libnx calls return a Result code which is just some numbers that you need to look up on dev kit pro wiki.
So save time trying to lookup error codes, I have some code to just print the error string to console.
Added a build flag to enable it since it's a ton of strings that will bloat the app size.
so basically the idea is you would compile with -DENABLE_ERROR_CODE_PRINTS
Then write something like:
Code:
Result result = someLibnxApiCall();
if (R_FAILED(result)) {
ERROR_RESULT_PRINT(result)
}
Code:
Error: 0x0E01 Module ID: 1, Module Description: 7
Message: Session count exceeded
The bottom message is the lookup, so is only compiled in with the build flag
Attachments
Last edited by dangarbri,