Append a function Applet::GetRegisteredAppletCount()!

This commit is contained in:
JamePeng 2016-04-14 23:52:03 +08:00
parent a69f22e48a
commit 04a2cb01cf
2 changed files with 15 additions and 1 deletions

View File

@ -58,7 +58,7 @@ ResultCode Applet::Create(Service::APT::AppletId id) {
applets[id] = std::make_shared<ErrEula>(id);
break;
default:
LOG_ERROR(Service_APT, "Could not create applet %u", id);
LOG_ERROR(Service_APT, "Could not create applet 0x%08X", id);
// TODO(Subv): Find the right error code
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotSupported, ErrorLevel::Permanent);
}
@ -73,6 +73,17 @@ std::shared_ptr<Applet> Applet::Get(Service::APT::AppletId id) {
return nullptr;
}
u32 GetRegisteredAppletCount() {
u32 registered_count = 0;
for (auto itr = applets.begin(); itr != applets.end(); ++itr) {
if (itr->second != nullptr) {
++registered_count;
}
}
return registered_count;
}
/// Handles updating the current Applet every time it's called.
static void AppletUpdateEvent(u64 applet_id, int cycles_late) {
Service::APT::AppletId id = static_cast<Service::APT::AppletId>(applet_id);

View File

@ -68,6 +68,9 @@ protected:
std::shared_ptr<std::vector<u8>> heap_memory; ///< Heap memory for this Applet
};
//Return the registered applet count
u32 GetRegisteredAppletCount();
/// Returns whether a library applet is currently running
bool IsLibraryAppletRunning();