Yuri Kunde Schlesner 11 лет назад
Родитель
Сommit
a79d21c83e
46 измененных файлов с 54 добавлено и 67 удалено
  1. 1 1
      src/core/hle/service/ac_u.cpp
  2. 1 1
      src/core/hle/service/act_u.cpp
  3. 1 1
      src/core/hle/service/am_app.cpp
  4. 1 1
      src/core/hle/service/am_net.cpp
  5. 1 1
      src/core/hle/service/am_sys.cpp
  6. 1 1
      src/core/hle/service/apt_a.cpp
  7. 1 1
      src/core/hle/service/apt_s.cpp
  8. 1 1
      src/core/hle/service/apt_u.cpp
  9. 1 1
      src/core/hle/service/boss_p.cpp
  10. 1 1
      src/core/hle/service/boss_u.cpp
  11. 1 1
      src/core/hle/service/cam_u.cpp
  12. 1 1
      src/core/hle/service/cecd_s.cpp
  13. 1 1
      src/core/hle/service/cecd_u.cpp
  14. 1 1
      src/core/hle/service/cfg/cfg_i.cpp
  15. 1 1
      src/core/hle/service/cfg/cfg_s.cpp
  16. 1 1
      src/core/hle/service/cfg/cfg_u.cpp
  17. 1 1
      src/core/hle/service/csnd_snd.cpp
  18. 1 1
      src/core/hle/service/dsp_dsp.cpp
  19. 1 1
      src/core/hle/service/err_f.cpp
  20. 1 1
      src/core/hle/service/frd_a.cpp
  21. 1 1
      src/core/hle/service/frd_u.cpp
  22. 1 1
      src/core/hle/service/fs/fs_user.cpp
  23. 1 1
      src/core/hle/service/gsp_gpu.cpp
  24. 1 1
      src/core/hle/service/gsp_lcd.cpp
  25. 1 1
      src/core/hle/service/hid/hid_spvr.cpp
  26. 1 1
      src/core/hle/service/hid/hid_user.cpp
  27. 1 1
      src/core/hle/service/http_c.cpp
  28. 1 1
      src/core/hle/service/ir_rst.cpp
  29. 1 1
      src/core/hle/service/ir_u.cpp
  30. 1 1
      src/core/hle/service/ldr_ro.cpp
  31. 1 1
      src/core/hle/service/mic_u.cpp
  32. 1 1
      src/core/hle/service/ndm_u.cpp
  33. 1 1
      src/core/hle/service/news_s.cpp
  34. 1 1
      src/core/hle/service/news_u.cpp
  35. 1 1
      src/core/hle/service/nim_aoc.cpp
  36. 1 1
      src/core/hle/service/ns_s.cpp
  37. 1 1
      src/core/hle/service/nwm_uds.cpp
  38. 1 1
      src/core/hle/service/pm_app.cpp
  39. 1 1
      src/core/hle/service/ptm_play.cpp
  40. 1 1
      src/core/hle/service/ptm_sysm.cpp
  41. 1 1
      src/core/hle/service/ptm_u.cpp
  42. 9 22
      src/core/hle/service/service.h
  43. 1 1
      src/core/hle/service/soc_u.cpp
  44. 1 1
      src/core/hle/service/srv.cpp
  45. 1 1
      src/core/hle/service/ssl_c.cpp
  46. 1 1
      src/core/hle/service/y2r_u.cpp

+ 1 - 1
src/core/hle/service/ac_u.cpp

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

+ 1 - 1
src/core/hle/service/act_u.cpp

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

+ 1 - 1
src/core/hle/service/am_app.cpp

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

+ 1 - 1
src/core/hle/service/am_net.cpp

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

+ 1 - 1
src/core/hle/service/am_sys.cpp

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

+ 1 - 1
src/core/hle/service/apt_a.cpp

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

+ 1 - 1
src/core/hle/service/apt_s.cpp

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

+ 1 - 1
src/core/hle/service/apt_u.cpp

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

+ 1 - 1
src/core/hle/service/boss_p.cpp

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

+ 1 - 1
src/core/hle/service/boss_u.cpp

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

+ 1 - 1
src/core/hle/service/cam_u.cpp

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

+ 1 - 1
src/core/hle/service/cecd_s.cpp

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

+ 1 - 1
src/core/hle/service/cecd_u.cpp

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

+ 1 - 1
src/core/hle/service/cfg/cfg_i.cpp

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

+ 1 - 1
src/core/hle/service/cfg/cfg_s.cpp

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

+ 1 - 1
src/core/hle/service/cfg/cfg_u.cpp

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

+ 1 - 1
src/core/hle/service/csnd_snd.cpp

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

+ 1 - 1
src/core/hle/service/dsp_dsp.cpp

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

+ 1 - 1
src/core/hle/service/err_f.cpp

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

+ 1 - 1
src/core/hle/service/frd_a.cpp

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

+ 1 - 1
src/core/hle/service/frd_u.cpp

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

+ 1 - 1
src/core/hle/service/fs/fs_user.cpp

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

+ 1 - 1
src/core/hle/service/gsp_gpu.cpp

@@ -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;

+ 1 - 1
src/core/hle/service/gsp_lcd.cpp

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

+ 1 - 1
src/core/hle/service/hid/hid_spvr.cpp

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

+ 1 - 1
src/core/hle/service/hid/hid_user.cpp

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

+ 1 - 1
src/core/hle/service/http_c.cpp

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

+ 1 - 1
src/core/hle/service/ir_rst.cpp

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

+ 1 - 1
src/core/hle/service/ir_u.cpp

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

+ 1 - 1
src/core/hle/service/ldr_ro.cpp

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

+ 1 - 1
src/core/hle/service/mic_u.cpp

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

+ 1 - 1
src/core/hle/service/ndm_u.cpp

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

+ 1 - 1
src/core/hle/service/news_s.cpp

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

+ 1 - 1
src/core/hle/service/news_u.cpp

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

+ 1 - 1
src/core/hle/service/nim_aoc.cpp

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

+ 1 - 1
src/core/hle/service/ns_s.cpp

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

+ 1 - 1
src/core/hle/service/nwm_uds.cpp

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

+ 1 - 1
src/core/hle/service/pm_app.cpp

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

+ 1 - 1
src/core/hle/service/ptm_play.cpp

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

+ 1 - 1
src/core/hle/service/ptm_sysm.cpp

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

+ 1 - 1
src/core/hle/service/ptm_u.cpp

@@ -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);

+ 9 - 22
src/core/hle/service/service.h

@@ -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;
 
 };
 

+ 1 - 1
src/core/hle/service/soc_u.cpp

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

+ 1 - 1
src/core/hle/service/srv.cpp

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

+ 1 - 1
src/core/hle/service/ssl_c.cpp

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

+ 1 - 1
src/core/hle/service/y2r_u.cpp

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