Open astronautlevel2 opened 8 years ago
this is because of how lpp-3ds works with regions.
int System.getRegion(void) - Get console region (1 = USA, 2 = EUR, Other = JPN).
especially given that ninjhax 2.x recently got KOR support, something should probably be done about this.
Ok. At the very least we should proper check for JPN somehow and if it fails default to Not Supported. If lpp-3ds gets support for KOR add it for both O3DS and N3DS units. In regards to China and Taiwan regions (the 2 remaining) they seem to only have O3DS anyways.
a way to check for region would be to like, maybe check if a certain title ID is installed, if the region comes out to be not USA or EUR.
given how lpp-3ds lists CIAs, you can check unique ID of NAND titles I guess.
CVer:
000173
USA
000171
EUR
000172
JPN
000174
CHN
000175
KOR
000176
TWN
@astronautlevel2 yeah, I figured using "Other" as JPN would probably not work very well given that we have more regions. @shinji257 Yeah, I will.
@ihaveamac Thanks, will use that when I get time.
In the meantime, I'll edit the README to warn people who could potentially try this.
So, Big Red Menu has an example of listCIA, and it has this.
{"CVer","N/A",0x00017102},
{"CVer","N/A",0x00017202},
{"CVer","N/A",0x00017302},
{"CVer","N/A",0x00017402},
{"CVer","N/A",0x00017502},
{"CVer","N/A",0x00017602}
I'm not sure how listCIA works, never used it, so I'll read BRM for a while.
you probably want to add the "02" to the end if needed, but it's not usually part of the original TID format (00040000XXXXXX00).
@ihaveamac all right. Now I'm trying to figure out how to check if a CIA is installed with listCIA.
Stuff from LPP lua_pushstring(L, "unique_id"); lua_pushinteger(L, (TitleIDs[i-1].uniqueid)); lua_settable(L, -3); lua_pushstring(L, "mediatype"); lua_pushinteger(L, 1); lua_settable(L, -3); lua_pushstring(L, "platform"); lua_pushinteger(L, (TitleIDs[i-1].platform)); lua_settable(L, -3); u64 id = TitleIDs[i-1].uniqueid | ((u64)TitleIDs[i-1].category << 32) | ((u64)TitleIDs[i-1].platform << 48); char product_id[16]; AM_GetTitleProductCode(MEDIATYPE_SD, id, product_id); lua_pushstring(L, "product_id"); lua_pushstring(L, product_id); lua_settable(L, -3); lua_pushstring(L, "access_id"); lua_pushinteger(L, i); lua_settable(L, -3); lua_pushstring(L, "version"); lua_pushinteger(L, entries[i-1].version); lua_settable(L, -3); lua_pushstring(L, "size"); lua_pushinteger(L, entries[i-1].size); lua_settable(L, -3); lua_pushstring(L, "category");
you can probably go through the table that System.listCIA()
returns.
cialist = System.listCIA()
for k, v in pairs(cialist) do
something(v.unique_id)
something(v.mediatype) -- returns 2 if NAND I think, 1 is SDMC
end
@ihaveamac Do I really need to check the mediatype? After all, if a CIA with that unique ID exists, it'll be that region, and it'd never be installed to SDMC anyway, right? Or do I need to look for it with the mediatype as well? Anyway, I'm going to sleep, can't read anything else today, brain is dead. I'll continue looking into this tomorrow.
it might be a good idea just in case it happens to be installed to SDMC, to stop any potential errors. it's not much (just add v.mediatype == 2
somewhere)
@ihaveamac Anyway, it might be my dead-tired brain, but I can't make heads or tails of parts of this. I'm going to sleep after writing this.
I have the unique_id. I want to know if there is a certain title installed to NAND with that unique ID.
I can barely read the code, will continue tomorrow, but atm I'm not figuring it out.
g n8
@ihaveamac Finally, I've managed to take a look at frankenupdater again. I still can't get the region check through CIA to work though. I probably got it wrong in the latest script. It's the "newregioncheck()" function, which probably doesn't make any sense.
If the console isn't EUR or USA, it's assumed to be JPN. This leaves 3 remaining regions which aren't accounted for.
Either these regions should have support added, or the JPN region should be moved from an "else" statement into another "if" and the else statement should return region unsupported.