HLE/APT: Added a function to retrieve the titleid of an applet based on the current system region.
The table was taken from the real APT service, but is incomplete due to the sheer amount of data it contains. There's 29 applets with 7 possible titleids. This table should be filled as needed.
This commit is contained in:
parent
191565a1b8
commit
ecb1c6d2a1
1 changed files with 33 additions and 0 deletions
|
@ -83,6 +83,39 @@ struct AppletSlotData {
|
||||||
// Holds data about the concurrently running applets in the system.
|
// Holds data about the concurrently running applets in the system.
|
||||||
static std::array<AppletSlotData, NumAppletSlot> applet_slots = {};
|
static std::array<AppletSlotData, NumAppletSlot> applet_slots = {};
|
||||||
|
|
||||||
|
struct AppletTitleData {
|
||||||
|
// There are two possible applet ids for each applet.
|
||||||
|
std::array<AppletId, 2> applet_ids;
|
||||||
|
|
||||||
|
// There's a specific TitleId per region for each applet.
|
||||||
|
static constexpr size_t NumRegions = 7;
|
||||||
|
std::array<u64, NumRegions> title_ids;
|
||||||
|
};
|
||||||
|
|
||||||
|
static constexpr size_t NumApplets = 29;
|
||||||
|
static constexpr std::array<AppletTitleData, NumApplets> applet_titleids = {{
|
||||||
|
{AppletId::HomeMenu, AppletId::None, 0x4003000008202, 0x4003000008F02, 0x4003000009802,
|
||||||
|
0x4003000008202, 0x400300000A102, 0x400300000A902, 0x400300000B102},
|
||||||
|
{AppletId::SoftwareKeyboard1, AppletId::SoftwareKeyboard2, 0x400300000C002, 0x400300000C802,
|
||||||
|
0x400300000D002, 0x400300000C002, 0x400300000D802, 0x400300000DE02, 0x400300000E402},
|
||||||
|
{AppletId::Error, AppletId::Error2, 0x400300000C502, 0x400300000C502, 0x400300000C502,
|
||||||
|
0x400300000C502, 0x400300000CF02, 0x400300000CF02, 0x400300000CF02},
|
||||||
|
// TODO(Subv): Fill in the rest of the titleids
|
||||||
|
}};
|
||||||
|
|
||||||
|
static u64 GetTitleIdForApplet(AppletId id) {
|
||||||
|
ASSERT_MSG(id != AppletId::None, "Invalid applet id");
|
||||||
|
|
||||||
|
auto itr = std::find_if(applet_titleids.begin(), applet_titleids.end(),
|
||||||
|
[id](const AppletTitleData& data) {
|
||||||
|
return data.applet_ids[0] == id || data.applet_ids[1] == id;
|
||||||
|
});
|
||||||
|
|
||||||
|
ASSERT_MSG(itr != applet_titleids.end(), "Unknown applet id");
|
||||||
|
|
||||||
|
return itr->title_ids[CFG::GetRegionValue()];
|
||||||
|
}
|
||||||
|
|
||||||
// This overload returns nullptr if no applet with the specified id has been started.
|
// This overload returns nullptr if no applet with the specified id has been started.
|
||||||
static AppletSlotData* GetAppletSlotData(AppletId id) {
|
static AppletSlotData* GetAppletSlotData(AppletId id) {
|
||||||
auto GetSlot = [](AppletSlot slot) -> AppletSlotData* {
|
auto GetSlot = [](AppletSlot slot) -> AppletSlotData* {
|
||||||
|
|
Loading…
Reference in a new issue