diff --git a/Makefile b/Makefile index 47e5323..4fd0cc9 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ include $(DEVKITPRO)/libnx/switch_rules #--------------------------------------------------------------------------------- APP_TITLE := Lockpick APP_AUTHOR := shchmue -APP_VERSION := 1.2.3 +APP_VERSION := 1.2.4 TARGET := $(subst $e ,_,$(notdir $(APP_TITLE))) BUILD := build diff --git a/changelog.md b/changelog.md index adc96b4..2f9040b 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,8 @@ # Changelog +## Version 1.2.4 +* Support new emunand FS memory layout +* No longer save header_key if empty + ## Version 1.2.3 * Remove mbedtls dependency in favor of new libnx crypto library * Remove libnx 1.6.0 support since crypto requires later commit diff --git a/source/KeyCollection.cpp b/source/KeyCollection.cpp index 8c23f9a..b86856a 100644 --- a/source/KeyCollection.cpp +++ b/source/KeyCollection.cpp @@ -392,7 +392,6 @@ void KeyCollection::get_memory_keys() { } void KeyCollection::derive_keys() { - header_key = {"header_key", 0x20, {}}; if (header_kek_source.found() && header_key_source.found()) { u8 tempheaderkek[0x10], tempheaderkey[0x20]; splCryptoInitialize(); diff --git a/source/KeyLocation.cpp b/source/KeyLocation.cpp index ca4a513..d53c9dd 100644 --- a/source/KeyLocation.cpp +++ b/source/KeyLocation.cpp @@ -62,7 +62,22 @@ void KeyLocation::get_from_memory(u64 tid, u8 seg_mask) { u32 page_info; u64 addr = 0; + u64 last_text_addr = 0; + // locate "real" .text segment as Atmosphere emuNAND has two + for (;;) { + svcQueryDebugProcessMemory(&mem_info, &page_info, debug_handle, addr); + if ((mem_info.perm & Perm_X) && + ((mem_info.type & 0xff) >= MemType_CodeStatic) && + ((mem_info.type & 0xff) < MemType_Heap)) + { + last_text_addr = mem_info.addr; + } + addr = mem_info.addr + mem_info.size; + if (addr == 0) break; + } + + addr = last_text_addr; for (u8 segment = 1; segment < BIT(3); ) { svcQueryDebugProcessMemory(&mem_info, &page_info, debug_handle, addr);