1
1
Fork 0
forked from suyu/suyu

Service: Clean-up Interface

This commit is contained in:
Yuri Kunde Schlesner 2015-01-30 16:56:49 -02:00
parent 8779b31fe6
commit a79d21c83e
46 changed files with 54 additions and 67 deletions

View file

@ -53,7 +53,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -18,7 +18,7 @@ namespace ACT_U {
// Interface class
Interface::Interface() {
//Register(FunctionTable, ARRAY_SIZE(FunctionTable));
//Register(FunctionTable);
}
} // namespace

View file

@ -18,7 +18,7 @@ namespace AM_APP {
// Interface class
Interface::Interface() {
//Register(FunctionTable, ARRAY_SIZE(FunctionTable));
//Register(FunctionTable);
}
} // namespace

View file

@ -38,7 +38,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -18,7 +18,7 @@ namespace AM_SYS {
// Interface class
Interface::Interface() {
//Register(FunctionTable, ARRAY_SIZE(FunctionTable));
//Register(FunctionTable);
}
} // namespace

View file

@ -39,7 +39,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -117,7 +117,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -520,7 +520,7 @@ Interface::Interface() {
lock = Kernel::Mutex::Create(false, "APT_U:Lock").MoveFrom();
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -18,7 +18,7 @@ namespace BOSS_P {
// Interface class
Interface::Interface() {
//Register(FunctionTable, ARRAY_SIZE(FunctionTable));
//Register(FunctionTable);
}
} // namespace

View file

@ -19,7 +19,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -18,7 +18,7 @@ namespace CAM_U {
// Interface class
Interface::Interface() {
//Register(FunctionTable, ARRAY_SIZE(FunctionTable));
//Register(FunctionTable);
}
} // namespace

View file

@ -18,7 +18,7 @@ namespace CECD_S {
// Interface class
Interface::Interface() {
//Register(FunctionTable, ARRAY_SIZE(FunctionTable));
//Register(FunctionTable);
}
} // namespace

View file

@ -18,7 +18,7 @@ namespace CECD_U {
// Interface class
Interface::Interface() {
//Register(FunctionTable, ARRAY_SIZE(FunctionTable));
//Register(FunctionTable);
}
} // namespace

View file

@ -104,7 +104,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -92,7 +92,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -186,7 +186,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -29,7 +29,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -206,7 +206,7 @@ Interface::Interface() {
interrupt_event = nullptr;
read_pipe_count = 0;
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -19,7 +19,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -18,7 +18,7 @@ namespace FRD_A {
// Interface class
Interface::Interface() {
//Register(FunctionTable, ARRAY_SIZE(FunctionTable));
//Register(FunctionTable);
}
} // namespace

View file

@ -27,7 +27,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -591,7 +591,7 @@ const FSUserInterface::FunctionInfo FunctionTable[] = {
// Interface class
FSUserInterface::FSUserInterface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace FS

View file

@ -389,7 +389,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
g_interrupt_event = 0;
g_shared_memory = 0;

View file

@ -20,7 +20,7 @@ namespace GSP_LCD {
// Interface class
Interface::Interface() {
//Register(FunctionTable, ARRAY_SIZE(FunctionTable));
//Register(FunctionTable);
}
} // namespace

View file

@ -32,7 +32,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -72,7 +72,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -58,7 +58,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -22,7 +22,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -36,7 +36,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -27,7 +27,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -34,7 +34,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -24,7 +24,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -19,7 +19,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -19,7 +19,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -25,7 +25,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -21,7 +21,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -26,7 +26,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -26,7 +26,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -22,7 +22,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -50,7 +50,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -137,7 +137,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
// Create the SharedExtSaveData archive 0xF000000B and the gamecoin.dat file
// TODO(Subv): In the future we should use the FS service to query this archive
std::string nand_directory = FileUtil::GetUserPath(D_NAND_IDX);

View file

@ -5,11 +5,12 @@
#pragma once
#include <algorithm>
#include <map>
#include <string>
#include <unordered_map>
#include <vector>
#include <boost/container/flat_map.hpp>
#include "common/common.h"
#include "common/string_util.h"
#include "core/mem_map.h"
@ -69,21 +70,6 @@ public:
return "[UNKNOWN SERVICE PORT]";
}
/// Allocates a new handle for the service
Handle CreateHandle(Kernel::Object *obj) {
// TODO(yuriks): Fix error reporting
Handle handle = Kernel::g_handle_table.Create(obj).ValueOr(INVALID_HANDLE);
m_handles.push_back(handle);
return handle;
}
/// Frees a handle from the service
template <class T>
void DeleteHandle(const Handle handle) {
Kernel::g_handle_table.Close(handle);
m_handles.erase(std::remove(m_handles.begin(), m_handles.end(), handle), m_handles.end());
}
ResultVal<bool> SyncRequest() override {
u32* cmd_buff = Kernel::GetCommandBuffer();
auto itr = m_functions.find(cmd_buff[0]);
@ -109,16 +95,17 @@ protected:
/**
* Registers the functions in the service
*/
void Register(const FunctionInfo* functions, int len) {
for (int i = 0; i < len; i++) {
m_functions[functions[i].id] = functions[i];
template <size_t N>
void Register(const FunctionInfo (&functions)[N]) {
m_functions.reserve(N);
for (auto& fn : functions) {
// Usually this array is sorted by id already, so hint to instead at the end
m_functions.emplace_hint(m_functions.cend(), fn.id, fn);
}
}
private:
std::vector<Handle> m_handles;
std::map<u32, FunctionInfo> m_functions;
boost::container::flat_map<u32, FunctionInfo> m_functions;
};

View file

@ -734,7 +734,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
Interface::~Interface() {

View file

@ -63,7 +63,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -22,7 +22,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace

View file

@ -54,7 +54,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
Register(FunctionTable);
}
} // namespace