Service: Clean-up Interface
This commit is contained in:
		| @@ -53,7 +53,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -18,7 +18,7 @@ namespace ACT_U { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     //Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     //Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -18,7 +18,7 @@ namespace AM_APP { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     //Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     //Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -38,7 +38,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -18,7 +18,7 @@ namespace AM_SYS { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     //Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     //Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -39,7 +39,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -117,7 +117,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -520,7 +520,7 @@ Interface::Interface() { | ||||
|  | ||||
|     lock = Kernel::Mutex::Create(false, "APT_U:Lock").MoveFrom(); | ||||
|  | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -18,7 +18,7 @@ namespace BOSS_P { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     //Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     //Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -19,7 +19,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -18,7 +18,7 @@ namespace CAM_U { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     //Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     //Register(FunctionTable); | ||||
| } | ||||
|      | ||||
| } // namespace | ||||
|   | ||||
| @@ -18,7 +18,7 @@ namespace CECD_S { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     //Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     //Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -18,7 +18,7 @@ namespace CECD_U { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     //Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     //Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -104,7 +104,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -92,7 +92,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -186,7 +186,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -29,7 +29,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -206,7 +206,7 @@ Interface::Interface() { | ||||
|     interrupt_event = nullptr; | ||||
|     read_pipe_count = 0; | ||||
|  | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -19,7 +19,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -18,7 +18,7 @@ namespace FRD_A { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     //Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     //Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -27,7 +27,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -591,7 +591,7 @@ const FSUserInterface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| FSUserInterface::FSUserInterface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace FS | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -20,7 +20,7 @@ namespace GSP_LCD { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     //Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     //Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -32,7 +32,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|      | ||||
| } // namespace | ||||
|   | ||||
| @@ -72,7 +72,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -58,7 +58,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -22,7 +22,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -36,7 +36,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -27,7 +27,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -34,7 +34,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -24,7 +24,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -19,7 +19,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -19,7 +19,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -25,7 +25,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -21,7 +21,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -26,7 +26,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -26,7 +26,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -22,7 +22,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|      | ||||
| } // namespace | ||||
|   | ||||
| @@ -50,7 +50,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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; | ||||
|  | ||||
| }; | ||||
|  | ||||
|   | ||||
| @@ -734,7 +734,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| Interface::~Interface() { | ||||
|   | ||||
| @@ -63,7 +63,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -22,7 +22,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|  | ||||
| } // namespace | ||||
|   | ||||
| @@ -54,7 +54,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||
| // Interface class | ||||
|  | ||||
| Interface::Interface() { | ||||
|     Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||||
|     Register(FunctionTable); | ||||
| } | ||||
|      | ||||
| } // namespace | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Yuri Kunde Schlesner
					Yuri Kunde Schlesner