From 0c59e6265f7d7bc451f79b886b09dd0bf9e937de Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Tue, 29 Jan 2019 21:40:39 -0500
Subject: [PATCH] service/btdrv: Update function tables

Updates function tables based off information provided by SwitchBrew.
---
 src/core/hle/service/btdrv/btdrv.cpp | 147 ++++++++++++++++++---------
 1 file changed, 101 insertions(+), 46 deletions(-)

diff --git a/src/core/hle/service/btdrv/btdrv.cpp b/src/core/hle/service/btdrv/btdrv.cpp
index 5704ca0aba..59ef603e19 100644
--- a/src/core/hle/service/btdrv/btdrv.cpp
+++ b/src/core/hle/service/btdrv/btdrv.cpp
@@ -19,16 +19,16 @@ public:
     explicit Bt() : ServiceFramework{"bt"} {
         // clang-format off
         static const FunctionInfo functions[] = {
-            {0, nullptr, "Unknown0"},
-            {1, nullptr, "Unknown1"},
-            {2, nullptr, "Unknown2"},
-            {3, nullptr, "Unknown3"},
-            {4, nullptr, "Unknown4"},
-            {5, nullptr, "Unknown5"},
-            {6, nullptr, "Unknown6"},
-            {7, nullptr, "Unknown7"},
-            {8, nullptr, "Unknown8"},
-            {9, &Bt::RegisterEvent, "RegisterEvent"},
+            {0, nullptr, "LeClientReadCharacteristic"},
+            {1, nullptr, "LeClientReadDescriptor"},
+            {2, nullptr, "LeClientWriteCharacteristic"},
+            {3, nullptr, "LeClientWriteDescriptor"},
+            {4, nullptr, "LeClientRegisterNotification"},
+            {5, nullptr, "LeClientDeregisterNotification"},
+            {6, nullptr, "SetLeResponse"},
+            {7, nullptr, "LeSendIndication"},
+            {8, nullptr, "GetLeEventInfo"},
+            {9, &Bt::RegisterBleEvent, "RegisterBleEvent"},
         };
         // clang-format on
         RegisterHandlers(functions);
@@ -39,7 +39,7 @@ public:
     }
 
 private:
-    void RegisterEvent(Kernel::HLERequestContext& ctx) {
+    void RegisterBleEvent(Kernel::HLERequestContext& ctx) {
         LOG_WARNING(Service_BTM, "(STUBBED) called");
 
         IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -55,11 +55,11 @@ public:
     explicit BtDrv() : ServiceFramework{"btdrv"} {
         // clang-format off
         static const FunctionInfo functions[] = {
-            {0, nullptr, "Unknown"},
-            {1, nullptr, "Init"},
-            {2, nullptr, "Enable"},
-            {3, nullptr, "Disable"},
-            {4, nullptr, "CleanupAndShutdown"},
+            {0, nullptr, "InitializeBluetoothDriver"},
+            {1, nullptr, "InitializeBluetooth"},
+            {2, nullptr, "EnableBluetooth"},
+            {3, nullptr, "DisableBluetooth"},
+            {4, nullptr, "CleanupBluetooth"},
             {5, nullptr, "GetAdapterProperties"},
             {6, nullptr, "GetAdapterProperty"},
             {7, nullptr, "SetAdapterProperty"},
@@ -70,36 +70,91 @@ public:
             {12, nullptr, "CancelBond"},
             {13, nullptr, "PinReply"},
             {14, nullptr, "SspReply"},
-            {15, nullptr, "Unknown2"},
-            {16, nullptr, "InitInterfaces"},
-            {17, nullptr, "HidHostInterface_Connect"},
-            {18, nullptr, "HidHostInterface_Disconnect"},
-            {19, nullptr, "HidHostInterface_SendData"},
-            {20, nullptr, "HidHostInterface_SendData2"},
-            {21, nullptr, "HidHostInterface_SetReport"},
-            {22, nullptr, "HidHostInterface_GetReport"},
-            {23, nullptr, "HidHostInterface_WakeController"},
-            {24, nullptr, "HidHostInterface_AddPairedDevice"},
-            {25, nullptr, "HidHostInterface_GetPairedDevice"},
-            {26, nullptr, "HidHostInterface_CleanupAndShutdown"},
-            {27, nullptr, "Unknown3"},
-            {28, nullptr, "ExtInterface_SetTSI"},
-            {29, nullptr, "ExtInterface_SetBurstMode"},
-            {30, nullptr, "ExtInterface_SetZeroRetran"},
-            {31, nullptr, "ExtInterface_SetMcMode"},
-            {32, nullptr, "ExtInterface_StartLlrMode"},
-            {33, nullptr, "ExtInterface_ExitLlrMode"},
-            {34, nullptr, "ExtInterface_SetRadio"},
-            {35, nullptr, "ExtInterface_SetVisibility"},
-            {36, nullptr, "Unknown4"},
-            {37, nullptr, "Unknown5"},
-            {38, nullptr, "HidHostInterface_GetLatestPlr"},
-            {39, nullptr, "ExtInterface_GetPendingConnections"},
-            {40, nullptr, "HidHostInterface_GetChannelMap"},
-            {41, nullptr, "SetIsBluetoothBoostEnabled"},
-            {42, nullptr, "GetIsBluetoothBoostEnabled"},
-            {43, nullptr, "SetIsBluetoothAfhEnabled"},
-            {44, nullptr, "GetIsBluetoothAfhEnabled"},
+            {15, nullptr, "GetEventInfo"},
+            {16, nullptr, "InitializeHid"},
+            {17, nullptr, "HidConnect"},
+            {18, nullptr, "HidDisconnect"},
+            {19, nullptr, "HidSendData"},
+            {20, nullptr, "HidSendData2"},
+            {21, nullptr, "HidSetReport"},
+            {22, nullptr, "HidGetReport"},
+            {23, nullptr, "HidWakeController"},
+            {24, nullptr, "HidAddPairedDevice"},
+            {25, nullptr, "HidGetPairedDevice"},
+            {26, nullptr, "CleanupHid"},
+            {27, nullptr, "HidGetEventInfo"},
+            {28, nullptr, "ExtSetTsi"},
+            {29, nullptr, "ExtSetBurstMode"},
+            {30, nullptr, "ExtSetZeroRetran"},
+            {31, nullptr, "ExtSetMcMode"},
+            {32, nullptr, "ExtStartLlrMode"},
+            {33, nullptr, "ExtExitLlrMode"},
+            {34, nullptr, "ExtSetRadio"},
+            {35, nullptr, "ExtSetVisibility"},
+            {36, nullptr, "ExtSetTbfcScan"},
+            {37, nullptr, "RegisterHidReportEvent"},
+            {38, nullptr, "HidGetReportEventInfo"},
+            {39, nullptr, "GetLatestPlr"},
+            {40, nullptr, "ExtGetPendingConnections"},
+            {41, nullptr, "GetChannelMap"},
+            {42, nullptr, "EnableBluetoothBoostSetting"},
+            {43, nullptr, "IsBluetoothBoostSettingEnabled"},
+            {44, nullptr, "EnableBluetoothAfhSetting"},
+            {45, nullptr, "IsBluetoothAfhSettingEnabled"},
+            {46, nullptr, "InitializeBluetoothLe"},
+            {47, nullptr, "EnableBluetoothLe"},
+            {48, nullptr, "DisableBluetoothLe"},
+            {49, nullptr, "CleanupBluetoothLe"},
+            {50, nullptr, "SetLeVisibility"},
+            {51, nullptr, "SetLeConnectionParameter"},
+            {52, nullptr, "SetLeDefaultConnectionParameter"},
+            {53, nullptr, "SetLeAdvertiseData"},
+            {54, nullptr, "SetLeAdvertiseParameter"},
+            {55, nullptr, "StartLeScan"},
+            {56, nullptr, "StopLeScan"},
+            {57, nullptr, "AddLeScanFilterCondition"},
+            {58, nullptr, "DeleteLeScanFilterCondition"},
+            {59, nullptr, "DeleteLeScanFilter"},
+            {60, nullptr, "ClearLeScanFilters"},
+            {61, nullptr, "EnableLeScanFilter"},
+            {62, nullptr, "RegisterLeClient"},
+            {63, nullptr, "UnregisterLeClient"},
+            {64, nullptr, "UnregisterLeClientAll"},
+            {65, nullptr, "LeClientConnect"},
+            {66, nullptr, "LeClientCancelConnection"},
+            {67, nullptr, "LeClientDisconnect"},
+            {68, nullptr, "LeClientGetAttributes"},
+            {69, nullptr, "LeClientDiscoverService"},
+            {70, nullptr, "LeClientConfigureMtu"},
+            {71, nullptr, "RegisterLeServer"},
+            {72, nullptr, "UnregisterLeServer"},
+            {73, nullptr, "LeServerConnect"},
+            {74, nullptr, "LeServerDisconnect"},
+            {75, nullptr, "CreateLeService"},
+            {76, nullptr, "StartLeService"},
+            {77, nullptr, "AddLeCharacteristic"},
+            {78, nullptr, "AddLeDescriptor"},
+            {79, nullptr, "GetLeCoreEventInfo"},
+            {80, nullptr, "LeGetFirstCharacteristic"},
+            {81, nullptr, "LeGetNextCharacteristic"},
+            {82, nullptr, "LeGetFirstDescriptor"},
+            {83, nullptr, "LeGetNextDescriptor"},
+            {84, nullptr, "RegisterLeCoreDataPath"},
+            {85, nullptr, "UnregisterLeCoreDataPath"},
+            {86, nullptr, "RegisterLeHidDataPath"},
+            {87, nullptr, "UnregisterLeHidDataPath"},
+            {88, nullptr, "RegisterLeDataPath"},
+            {89, nullptr, "UnregisterLeDataPath"},
+            {90, nullptr, "LeClientReadCharacteristic"},
+            {91, nullptr, "LeClientReadDescriptor"},
+            {92, nullptr, "LeClientWriteCharacteristic"},
+            {93, nullptr, "LeClientWriteDescriptor"},
+            {94, nullptr, "LeClientRegisterNotification"},
+            {95, nullptr, "LeClientDeregisterNotification"},
+            {96, nullptr, "GetLeHidEventInfo"},
+            {97, nullptr, "RegisterBleHidEvent"},
+            {98, nullptr, "SetLeScanParameter"},
+            {256, nullptr, "GetIsManufacturingMode"}
         };
         // clang-format on