I found this project while trying to find a way to get the Wii U system language for a homebrew program I'm working on. I assume this project is abandoned, but since I ran across this project trying to solve the problem, maybe making this issue here will help someone who comes along after me.
I had found CCRSysGetLanguage searching through WUT, so I tried googling it to see how to use it, and the only other result was the comment in this project saying it didn't work. However, the comments also mentioned the existence of SCIGetCafeLanguage, but that the RPL was unknown (at least at the time). Looking into this function gave me the answer to how to get the system language without manually parsing the XML file.
I loaded up Hachi (the DS virtual console executable) in a disassembler (Ghidra with a RPX loader plugin) and searched for SCIGetCafeLanguage. The function was present in the program, but was embedded in the program, not imported from a library. I assume this is because the function was part of the official SDK, not the system itself. I looked through the code for the function, and figured out how it works. As it turns out, the function is simply a wrapper around UCReadSysConfig, and you can replicate the function pretty easily. Here's the basic version of how it works, without the error checking, null-character filling, or memory alignment (and using the WUT headers):
#include <coreinit/userconfig.h>
#include <string.h>
uint32_t get_language() {
uint32_t language;
UCSysConfig req;
strcpy(req.name, "cafe.language");
req.access = 0x777;
req.dataType = UC_DATATYPE_UNSIGNED_INT;
req.error = 0;
req.dataSize = sizeof(uint32_t);
req.data = &language;
int32_t uc = UCOpen();
UCReadSysConfig(uc, 1, &req);
UCClose(uc);
return language;
}
The original function also checks that the language value returned is valid (0 <= language < 12), and returns 0xFF if the language is invalid. All together, this seems like a simpler solution than reading the system XML file.
I found this project while trying to find a way to get the Wii U system language for a homebrew program I'm working on. I assume this project is abandoned, but since I ran across this project trying to solve the problem, maybe making this issue here will help someone who comes along after me.
I had found
CCRSysGetLanguagesearching through WUT, so I tried googling it to see how to use it, and the only other result was the comment in this project saying it didn't work. However, the comments also mentioned the existence ofSCIGetCafeLanguage, but that the RPL was unknown (at least at the time). Looking into this function gave me the answer to how to get the system language without manually parsing the XML file.I loaded up Hachi (the DS virtual console executable) in a disassembler (Ghidra with a RPX loader plugin) and searched for
SCIGetCafeLanguage. The function was present in the program, but was embedded in the program, not imported from a library. I assume this is because the function was part of the official SDK, not the system itself. I looked through the code for the function, and figured out how it works. As it turns out, the function is simply a wrapper aroundUCReadSysConfig, and you can replicate the function pretty easily. Here's the basic version of how it works, without the error checking, null-character filling, or memory alignment (and using the WUT headers):The original function also checks that the language value returned is valid (
0 <= language < 12), and returns0xFFif the language is invalid. All together, this seems like a simpler solution than reading the system XML file.