diff --git a/ldn_mitm/ldn_mitm.json b/ldn_mitm/ldn_mitm.json index 38d6f2a..66a31a2 100644 --- a/ldn_mitm/ldn_mitm.json +++ b/ldn_mitm/ldn_mitm.json @@ -67,7 +67,8 @@ "svcGetDebugThreadContext": "0x67", "svcQueryDebugProcessMemory": "0x69", "svcReadDebugProcessMemory": "0x6a", - "svcGetDebugThreadParam": "0x6d" + "svcGetDebugThreadParam": "0x6d", + "svcManageNamedPort": "0x71" } } ] diff --git a/ldn_mitm/source/ldnmitm_main.cpp b/ldn_mitm/source/ldnmitm_main.cpp index fba7045..2dc1d9b 100644 --- a/ldn_mitm/source/ldnmitm_main.cpp +++ b/ldn_mitm/source/ldnmitm_main.cpp @@ -139,7 +139,7 @@ int main(int argc, char **argv) /* Create ldn:u mitm. */ AddMitmServerToManager(server_manager, "ldn:u", 1); - server_manager->AddWaitable(new ServiceServer("ldnmitm", 1)); + server_manager->AddWaitable(new ManagedPortServer("ldnmitm:cfg", 1)); /* Loop forever, servicing our services. */ server_manager->Process(); diff --git a/ldnmitm_config/Makefile b/ldnmitm_config/Makefile index 0012a50..5893486 100644 --- a/ldnmitm_config/Makefile +++ b/ldnmitm_config/Makefile @@ -8,7 +8,7 @@ TOPDIR ?= $(CURDIR) include $(DEVKITPRO)/libnx/switch_rules GITREV := $(shell git rev-parse HEAD 2>/dev/null | cut -c1-8) -VERSION := v1.0.0 +VERSION := v1.1.0 ifneq ($(strip $(GITREV)),) VERSION := $(VERSION)-$(GITREV) endif diff --git a/ldnmitm_config/source/ldn.c b/ldnmitm_config/source/ldn.c index ca86515..773d1cf 100644 --- a/ldnmitm_config/source/ldn.c +++ b/ldnmitm_config/source/ldn.c @@ -211,39 +211,10 @@ Result ldnCreateUserLocalCommunicationService(Service* s, UserLocalCommunication return rc; } -Result ldnMitmGetConfig(Service* s, LdnMitmConfigService *out) { - IpcCommand c; - ipcInitialize(&c); - - struct { - u64 magic; - u64 cmd_id; - } *raw; - - raw = serviceIpcPrepareHeader(s, &c, sizeof(*raw)); - - raw->magic = SFCI_MAGIC; - raw->cmd_id = 65000; - - Result rc = serviceIpcDispatch(s); - - if (R_SUCCEEDED(rc)) { - IpcParsedCommand r; - struct { - u64 magic; - u64 result; - } *resp; - - serviceIpcParse(s, &r, sizeof(*resp)); - resp = r.Raw; - - rc = resp->result; - - if (R_SUCCEEDED(rc)) { - serviceCreateSubservice(&out->s, s, &r, 0); - } - } - +Result ldnMitmGetConfig(LdnMitmConfigService *out) { + Handle handle; + Result rc = svcConnectToNamedPort(&handle, "ldnmitm:cfg"); + serviceCreate(&out->s, handle); return rc; } diff --git a/ldnmitm_config/source/ldn.h b/ldnmitm_config/source/ldn.h index 7864660..ee8896b 100644 --- a/ldnmitm_config/source/ldn.h +++ b/ldnmitm_config/source/ldn.h @@ -131,7 +131,7 @@ Result ldnMitmGetLogging(LdnMitmConfigService *s, u32 *enabled); Result ldnMitmSetLogging(LdnMitmConfigService *s, u32 enabled); Result ldnMitmGetEnabled(LdnMitmConfigService *s, u32 *enabled); Result ldnMitmSetEnabled(LdnMitmConfigService *s, u32 enabled); -Result ldnMitmGetConfig(Service* s, LdnMitmConfigService *out); +Result ldnMitmGetConfig(LdnMitmConfigService *out); void NetworkInfo2NetworkConfig(NetworkInfo* info, NetworkConfig* out); void NetworkInfo2SecurityParameter(NetworkInfo* info, SecurityParameter* out); diff --git a/ldnmitm_config/source/main.cpp b/ldnmitm_config/source/main.cpp index 4a1297e..99aa0d9 100644 --- a/ldnmitm_config/source/main.cpp +++ b/ldnmitm_config/source/main.cpp @@ -6,7 +6,6 @@ #include "test.h" #define MODULEID 0x233 -static Service g_ldnSrv; static LdnMitmConfigService g_ldnConfig; Result saveLogToFile() { @@ -21,7 +20,6 @@ Result saveLogToFile() { } void cleanup() { - serviceClose(&g_ldnSrv); serviceClose(&g_ldnConfig.s); } @@ -115,13 +113,10 @@ int main() { gfxInitDefault(); consoleInit(NULL); - Result rc = smGetService(&g_ldnSrv, "ldn:u"); + Result rc = ldnMitmGetConfig(&g_ldnConfig); if (R_FAILED(rc)) { - die("failed to get service ldn:u"); - } - rc = ldnMitmGetConfig(&g_ldnSrv, &g_ldnConfig); - if (R_FAILED(rc)) { - die("ldn_mitm is not loaded or too old(requires ldn_mitm > v1.0)"); + printf("error code: %x\n", rc); + die("ldn_mitm is not loaded or too old(requires ldn_mitm >= v1.1.1)"); } reprint();