mirror of
https://github.com/DarkMatterCore/nxdumptool.git
synced 2024-11-09 12:11:44 +00:00
Reduce memory footprint + hardcode system title names.
Also increased the USB timeout again, since 1 second seems to be too low for gamecard transfers. Big thanks to Whovian for helping me format that long system title list.
This commit is contained in:
parent
158e424b96
commit
62366327ee
5 changed files with 379 additions and 16 deletions
|
@ -215,7 +215,8 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
u8 *buf = NULL;
|
u8 *buf = NULL;
|
||||||
|
|
||||||
u64 base_tid = (u64)0x01004AB00A260000; // ACNH 0x01006F8002326000 | Smash 0x01006A800016E000 | Dark Souls 0x01004AB00A260000 | BotW 0x01007EF00011E000 | Untitled Goose Game 0x010082400BCC6000
|
// ACNH 0x01006F8002326000 | Smash 0x01006A800016E000 | Dark Souls 0x01004AB00A260000 | BotW 0x01007EF00011E000 | Untitled Goose Game 0x010082400BCC6000 | SMO 0x0100000000010000
|
||||||
|
u64 base_tid = (u64)0x0100000000010000;
|
||||||
u64 update_tid = titleGetPatchIdByApplicationId(base_tid);
|
u64 update_tid = titleGetPatchIdByApplicationId(base_tid);
|
||||||
|
|
||||||
TitleInfo *base_title_info = NULL, *update_title_info = NULL;
|
TitleInfo *base_title_info = NULL, *update_title_info = NULL;
|
||||||
|
@ -265,13 +266,15 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
consolePrint("title info succeeded\n");
|
consolePrint("title info succeeded\n");
|
||||||
|
|
||||||
if (!ncaInitializeContext(base_nca_ctx, base_title_info->storage_id, 0, titleGetContentInfoByTypeAndIdOffset(base_title_info, NcmContentType_Program, 0), &base_tik))
|
if (!ncaInitializeContext(base_nca_ctx, base_title_info->storage_id, (base_title_info->storage_id == NcmStorageId_GameCard ? GameCardHashFileSystemPartitionType_Secure : 0), \
|
||||||
|
titleGetContentInfoByTypeAndIdOffset(base_title_info, NcmContentType_Program, 0), &base_tik))
|
||||||
{
|
{
|
||||||
consolePrint("nca initialize base ctx failed\n");
|
consolePrint("nca initialize base ctx failed\n");
|
||||||
goto out2;
|
goto out2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ncaInitializeContext(update_nca_ctx, update_title_info->storage_id, 0, titleGetContentInfoByTypeAndIdOffset(update_title_info, NcmContentType_Program, 0), &update_tik))
|
if (!ncaInitializeContext(update_nca_ctx, update_title_info->storage_id, (update_title_info->storage_id == NcmStorageId_GameCard ? GameCardHashFileSystemPartitionType_Secure : 0), \
|
||||||
|
titleGetContentInfoByTypeAndIdOffset(update_title_info, NcmContentType_Program, 0), &update_tik))
|
||||||
{
|
{
|
||||||
consolePrint("nca initialize update ctx failed\n");
|
consolePrint("nca initialize update ctx failed\n");
|
||||||
goto out2;
|
goto out2;
|
||||||
|
|
379
source/title.c
379
source/title.c
|
@ -24,6 +24,13 @@
|
||||||
|
|
||||||
#define NS_APPLICATION_RECORD_LIMIT 4096
|
#define NS_APPLICATION_RECORD_LIMIT 4096
|
||||||
|
|
||||||
|
/* Type definitions. */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
u64 title_id;
|
||||||
|
char name[32];
|
||||||
|
} SystemTitleName;
|
||||||
|
|
||||||
/* Global variables. */
|
/* Global variables. */
|
||||||
|
|
||||||
static Mutex g_titleMutex = 0;
|
static Mutex g_titleMutex = 0;
|
||||||
|
@ -40,6 +47,301 @@ static NcmContentStorage g_ncmStorageGameCard = {0}, g_ncmStorageEmmcSystem = {0
|
||||||
static TitleInfo *g_titleInfo = NULL;
|
static TitleInfo *g_titleInfo = NULL;
|
||||||
static u32 g_titleInfoCount = 0, g_titleInfoGameCardStartIndex = 0, g_titleInfoGameCardCount = 0;
|
static u32 g_titleInfoCount = 0, g_titleInfoGameCardStartIndex = 0, g_titleInfoGameCardCount = 0;
|
||||||
|
|
||||||
|
/* Info retrieved from https://switchbrew.org/wiki/Title_list. */
|
||||||
|
/* Titles bundled with the kernel are excluded. */
|
||||||
|
static const SystemTitleName g_systemTitles[] = {
|
||||||
|
/* System modules. */
|
||||||
|
/* Meta + Program NCAs. */
|
||||||
|
{ 0x0100000000000006, "usb" },
|
||||||
|
{ 0x0100000000000007, "tma" },
|
||||||
|
{ 0x0100000000000008, "boot2" },
|
||||||
|
{ 0x0100000000000009, "settings" },
|
||||||
|
{ 0x010000000000000A, "bus" },
|
||||||
|
{ 0x010000000000000B, "bluetooth" },
|
||||||
|
{ 0x010000000000000C, "bcat" },
|
||||||
|
{ 0x010000000000000D, "dmnt" },
|
||||||
|
{ 0x010000000000000E, "friends" },
|
||||||
|
{ 0x010000000000000F, "nifm" },
|
||||||
|
{ 0x0100000000000010, "ptm" },
|
||||||
|
{ 0x0100000000000011, "shell" },
|
||||||
|
{ 0x0100000000000012, "bsdsockets" },
|
||||||
|
{ 0x0100000000000013, "hid" },
|
||||||
|
{ 0x0100000000000014, "audio" },
|
||||||
|
{ 0x0100000000000015, "LogManager" },
|
||||||
|
{ 0x0100000000000016, "wlan" },
|
||||||
|
{ 0x0100000000000017, "cs" },
|
||||||
|
{ 0x0100000000000018, "ldn" },
|
||||||
|
{ 0x0100000000000019, "nvservices" },
|
||||||
|
{ 0x010000000000001A, "pcv" },
|
||||||
|
{ 0x010000000000001B, "ppc" },
|
||||||
|
{ 0x010000000000001C, "nvnflinger" },
|
||||||
|
{ 0x010000000000001D, "pcie" },
|
||||||
|
{ 0x010000000000001E, "account" },
|
||||||
|
{ 0x010000000000001F, "ns" },
|
||||||
|
{ 0x0100000000000020, "nfc" },
|
||||||
|
{ 0x0100000000000021, "psc" },
|
||||||
|
{ 0x0100000000000022, "capsrv" },
|
||||||
|
{ 0x0100000000000023, "am" },
|
||||||
|
{ 0x0100000000000024, "ssl" },
|
||||||
|
{ 0x0100000000000025, "nim" },
|
||||||
|
{ 0x0100000000000026, "cec" },
|
||||||
|
{ 0x0100000000000027, "tspm" },
|
||||||
|
{ 0x0100000000000029, "lbl" },
|
||||||
|
{ 0x010000000000002A, "btm" },
|
||||||
|
{ 0x010000000000002B, "erpt" },
|
||||||
|
{ 0x010000000000002C, "time" },
|
||||||
|
{ 0x010000000000002D, "vi" },
|
||||||
|
{ 0x010000000000002E, "pctl" },
|
||||||
|
{ 0x010000000000002F, "npns" },
|
||||||
|
{ 0x0100000000000030, "eupld" },
|
||||||
|
{ 0x0100000000000031, "glue" },
|
||||||
|
{ 0x0100000000000032, "eclct" },
|
||||||
|
{ 0x0100000000000033, "es" },
|
||||||
|
{ 0x0100000000000034, "fatal" },
|
||||||
|
{ 0x0100000000000035, "grc" },
|
||||||
|
{ 0x0100000000000036, "creport" },
|
||||||
|
{ 0x0100000000000037, "ro" },
|
||||||
|
{ 0x0100000000000038, "profiler" },
|
||||||
|
{ 0x0100000000000039, "sdb" },
|
||||||
|
{ 0x010000000000003A, "migration" },
|
||||||
|
{ 0x010000000000003B, "jit" },
|
||||||
|
{ 0x010000000000003C, "jpegdec" },
|
||||||
|
{ 0x010000000000003D, "safemode" },
|
||||||
|
{ 0x010000000000003E, "olsc" },
|
||||||
|
{ 0x010000000000003F, "dt" },
|
||||||
|
{ 0x0100000000000040, "nd" },
|
||||||
|
{ 0x0100000000000041, "ngct" },
|
||||||
|
{ 0x0100000000000042, "pgl" },
|
||||||
|
|
||||||
|
/* System data archives. */
|
||||||
|
/* Meta + Data NCAs. */
|
||||||
|
{ 0x0100000000000800, "CertStore" },
|
||||||
|
{ 0x0100000000000801, "ErrorMessage" },
|
||||||
|
{ 0x0100000000000802, "MiiModel" },
|
||||||
|
{ 0x0100000000000803, "BrowserDll" },
|
||||||
|
{ 0x0100000000000804, "Help" },
|
||||||
|
{ 0x0100000000000805, "SharedFont" },
|
||||||
|
{ 0x0100000000000806, "NgWord" },
|
||||||
|
{ 0x0100000000000807, "SsidList" },
|
||||||
|
{ 0x0100000000000808, "Dictionary" },
|
||||||
|
{ 0x0100000000000809, "SystemVersion" },
|
||||||
|
{ 0x010000000000080A, "AvatarImage" },
|
||||||
|
{ 0x010000000000080B, "LocalNews" },
|
||||||
|
{ 0x010000000000080C, "Eula" },
|
||||||
|
{ 0x010000000000080D, "UrlBlackList" },
|
||||||
|
{ 0x010000000000080E, "TimeZoneBinary" },
|
||||||
|
{ 0x010000000000080F, "CertStoreCruiser" },
|
||||||
|
{ 0x0100000000000810, "FontNintendoExtension" },
|
||||||
|
{ 0x0100000000000811, "FontStandard" },
|
||||||
|
{ 0x0100000000000812, "FontKorean" },
|
||||||
|
{ 0x0100000000000813, "FontChineseTraditional" },
|
||||||
|
{ 0x0100000000000814, "FontChineseSimple" },
|
||||||
|
{ 0x0100000000000815, "FontBfcpx" },
|
||||||
|
{ 0x0100000000000816, "SystemUpdate" },
|
||||||
|
{ 0x0100000000000818, "FirmwareDebugSettings" },
|
||||||
|
{ 0x0100000000000819, "BootImagePackage" },
|
||||||
|
{ 0x010000000000081A, "BootImagePackageSafe" },
|
||||||
|
{ 0x010000000000081B, "BootImagePackageExFat" },
|
||||||
|
{ 0x010000000000081C, "BootImagePackageExFatSafe" },
|
||||||
|
{ 0x010000000000081D, "FatalMessage" },
|
||||||
|
{ 0x010000000000081E, "ControllerIcon" },
|
||||||
|
{ 0x010000000000081F, "PlatformConfigIcosa" },
|
||||||
|
{ 0x0100000000000820, "PlatformConfigCopper" },
|
||||||
|
{ 0x0100000000000821, "PlatformConfigHoag" },
|
||||||
|
{ 0x0100000000000822, "ControllerFirmware" },
|
||||||
|
{ 0x0100000000000823, "NgWord2" },
|
||||||
|
{ 0x0100000000000824, "PlatformConfigIcosaMariko" },
|
||||||
|
{ 0x0100000000000825, "ApplicationBlackList" },
|
||||||
|
{ 0x0100000000000826, "RebootlessSystemUpdateVersion" },
|
||||||
|
{ 0x0100000000000827, "ContentActionTable" },
|
||||||
|
{ 0x0100000000000828, "FunctionBlackList" },
|
||||||
|
{ 0x0100000000000830, "NgWordT" },
|
||||||
|
|
||||||
|
/* System applets. */
|
||||||
|
/* Meta + Program NCAs. */
|
||||||
|
{ 0x0100000000001000, "qlaunch" },
|
||||||
|
{ 0x0100000000001001, "auth" },
|
||||||
|
{ 0x0100000000001002, "cabinet" },
|
||||||
|
{ 0x0100000000001003, "controller" },
|
||||||
|
{ 0x0100000000001004, "dataErase" },
|
||||||
|
{ 0x0100000000001005, "error" },
|
||||||
|
{ 0x0100000000001006, "netConnect" },
|
||||||
|
{ 0x0100000000001007, "playerSelect" },
|
||||||
|
{ 0x0100000000001008, "swkbd" },
|
||||||
|
{ 0x0100000000001009, "miiEdit" },
|
||||||
|
{ 0x010000000000100A, "web" },
|
||||||
|
{ 0x010000000000100B, "shop" },
|
||||||
|
{ 0x010000000000100C, "overlayDisp" },
|
||||||
|
{ 0x010000000000100D, "photoViewer" },
|
||||||
|
{ 0x010000000000100E, "set" },
|
||||||
|
{ 0x010000000000100F, "offlineWeb" },
|
||||||
|
{ 0x0100000000001010, "loginShare" },
|
||||||
|
{ 0x0100000000001011, "wifiWebAuth" },
|
||||||
|
{ 0x0100000000001012, "starter" },
|
||||||
|
{ 0x0100000000001013, "myPage" },
|
||||||
|
{ 0x0100000000001014, "PlayReport" },
|
||||||
|
{ 0x0100000000001015, "MaintenanceMenu" },
|
||||||
|
{ 0x010000000000101A, "gift" },
|
||||||
|
{ 0x010000000000101B, "DummyECApplet" },
|
||||||
|
{ 0x010000000000101C, "userMigration" },
|
||||||
|
{ 0x010000000000101D, "EncounterSys" },
|
||||||
|
{ 0x0100000000001020, "story" },
|
||||||
|
{ 0x0100000000001023, "statistics" },
|
||||||
|
{ 0x0100000000001033, "promotion" },
|
||||||
|
{ 0x0100000000001038, "sample" },
|
||||||
|
{ 0x0100000000001FFF, "EndOceanProgramId" },
|
||||||
|
|
||||||
|
/* System debug applets. */
|
||||||
|
{ 0x0100000000002000, "A2BoardFunction" },
|
||||||
|
{ 0x0100000000002001, "A3Wireless" },
|
||||||
|
{ 0x0100000000002002, "C1LcdAndKey" },
|
||||||
|
{ 0x0100000000002003, "C2UsbHpmic" },
|
||||||
|
{ 0x0100000000002004, "C3Aging" },
|
||||||
|
{ 0x0100000000002005, "C4SixAxis" },
|
||||||
|
{ 0x0100000000002006, "C5Wireless" },
|
||||||
|
{ 0x0100000000002007, "C7FinalCheck" },
|
||||||
|
{ 0x010000000000203F, "AutoCapture" },
|
||||||
|
{ 0x0100000000002040, "DevMenuCommandSystem" },
|
||||||
|
{ 0x0100000000002041, "recovery" },
|
||||||
|
{ 0x0100000000002042, "DevMenuSystem" },
|
||||||
|
{ 0x0100000000002044, "HB-TBIntegrationTest" },
|
||||||
|
{ 0x010000000000204D, "BackupSaveData" },
|
||||||
|
{ 0x010000000000204E, "A4BoardCalWriti" },
|
||||||
|
{ 0x0100000000002054, "RepairSslCertificate" },
|
||||||
|
{ 0x0100000000002055, "GameCardWriter" },
|
||||||
|
{ 0x0100000000002056, "UsbPdTestTool" },
|
||||||
|
{ 0x0100000000002057, "RepairDeletePctl" },
|
||||||
|
{ 0x0100000000002058, "RepairBackup" },
|
||||||
|
{ 0x0100000000002059, "RepairRestore" },
|
||||||
|
{ 0x010000000000205A, "RepairAccountTransfer" },
|
||||||
|
{ 0x010000000000205B, "RepairAutoNetworkUpdater" },
|
||||||
|
{ 0x010000000000205C, "RefurbishReset" },
|
||||||
|
{ 0x010000000000205D, "RepairAssistCup" },
|
||||||
|
{ 0x010000000000205E, "RepairPairingCutter" },
|
||||||
|
{ 0x0100000000002064, "DevMenu" },
|
||||||
|
{ 0x0100000000002065, "DevMenuApp" },
|
||||||
|
{ 0x0100000000002066, "GetGameCardAsicInfo" },
|
||||||
|
{ 0x0100000000002068, "NfpDebugToolSystem" },
|
||||||
|
{ 0x0100000000002069, "AlbumSynchronizer" },
|
||||||
|
{ 0x0100000000002071, "SnapShotDumper" },
|
||||||
|
{ 0x0100000000002073, "DevMenuSystemApp" },
|
||||||
|
{ 0x0100000000002099, "DevOverlayDisp" },
|
||||||
|
{ 0x010000000000209A, "NandVerifier" },
|
||||||
|
{ 0x010000000000209B, "GpuCoreDumper" },
|
||||||
|
{ 0x010000000000209C, "TestApplication" },
|
||||||
|
{ 0x010000000000209E, "HelloWorld" },
|
||||||
|
{ 0x01000000000020A0, "XcieWriter" },
|
||||||
|
{ 0x01000000000020A1, "GpuOverrunNotifier" },
|
||||||
|
{ 0x01000000000020C8, "NfpDebugTool" },
|
||||||
|
{ 0x01000000000020CA, "NoftWriter" },
|
||||||
|
{ 0x01000000000020D0, "BcatSystemDebugTool" },
|
||||||
|
{ 0x01000000000020D1, "DevSafeModeUpdater" },
|
||||||
|
{ 0x01000000000020D3, "ControllerConnectionAnalyzer" },
|
||||||
|
{ 0x01000000000020D4, "DevKitUpdater" },
|
||||||
|
{ 0x01000000000020D6, "RepairTimeReviser" },
|
||||||
|
{ 0x01000000000020D7, "RepairReinitializeFuelGauge" },
|
||||||
|
{ 0x01000000000020DA, "RepairAbortMigration" },
|
||||||
|
{ 0x01000000000020DC, "RepairShowDeviceId" },
|
||||||
|
{ 0x01000000000020DD, "RepairSetCycleCountReliability" },
|
||||||
|
{ 0x01000000000020E0, "Interface" },
|
||||||
|
{ 0x01000000000020E1, "AlbumDownloader" },
|
||||||
|
{ 0x01000000000020E3, "FuelGaugeDumper" },
|
||||||
|
{ 0x01000000000020E4, "UnsafeExtract" },
|
||||||
|
{ 0x01000000000020E5, "UnsafeEngrave" },
|
||||||
|
{ 0x01000000000020EE, "BluetoothSettingTool" },
|
||||||
|
{ 0x01000000000020F0, "ApplicationInstallerRomfs" },
|
||||||
|
{ 0x0100000000002100, "DevMenuLotcheckDownloader" },
|
||||||
|
{ 0x0100000000002101, "DevMenuCommand" },
|
||||||
|
{ 0x0100000000002102, "ExportPartition" },
|
||||||
|
{ 0x0100000000002103, "SystemInitializer" },
|
||||||
|
{ 0x0100000000002104, "SystemUpdaterHostFs" },
|
||||||
|
{ 0x0100000000002105, "WriteToStorage" },
|
||||||
|
{ 0x0100000000002106, "CalWriter" },
|
||||||
|
{ 0x0100000000002107, "SettingsManager" },
|
||||||
|
{ 0x0100000000002109, "testBuildSystemIris" },
|
||||||
|
{ 0x010000000000210A, "SystemUpdater" },
|
||||||
|
{ 0x010000000000210B, "nvnflinger_util" },
|
||||||
|
{ 0x010000000000210C, "ControllerFirmwareUpdater" },
|
||||||
|
{ 0x010000000000210D, "testBuildSystemNintendoWare" },
|
||||||
|
{ 0x0100000000002110, "TestSaveDataCreator" },
|
||||||
|
{ 0x0100000000002111, "C9LcdSpker" },
|
||||||
|
{ 0x0100000000002114, "RankTurn" },
|
||||||
|
{ 0x0100000000002116, "BleTestTool" },
|
||||||
|
{ 0x010000000000211A, "PreinstallAppWriter" },
|
||||||
|
{ 0x010000000000211C, "ControllerSerialFlashTool" },
|
||||||
|
{ 0x010000000000211D, "ControllerFlashWriter" },
|
||||||
|
{ 0x0100000000002120, "ControllerTestApp" },
|
||||||
|
{ 0x0100000000002121, "HidInspectionTool" },
|
||||||
|
{ 0x0100000000002124, "BatteryCyclesEditor" },
|
||||||
|
{ 0x0100000000002125, "UsbFirmwareUpdater" },
|
||||||
|
{ 0x0100000000002126, "PalmaSerialCodeTool" },
|
||||||
|
{ 0x0100000000002127, "renderdoccmd" },
|
||||||
|
{ 0x0100000000002128, "HidInspectionToolProd" },
|
||||||
|
{ 0x010000000000212C, "ExhibitionMenu" },
|
||||||
|
{ 0x010000000000212F, "ExhibitionSaveData" },
|
||||||
|
{ 0x0100000000002130, "LuciaConverter" },
|
||||||
|
{ 0x0100000000002133, "CalDumper" },
|
||||||
|
{ 0x0100000000002134, "AnalogStickEvaluationTool" },
|
||||||
|
|
||||||
|
/* System debug modules. */
|
||||||
|
{ 0x0100000000003002, "DummyProcess" },
|
||||||
|
{ 0x0100000000003003, "DebugMonitor0" },
|
||||||
|
{ 0x0100000000003004, "SystemHelloWorld" },
|
||||||
|
|
||||||
|
/* Target tools. */
|
||||||
|
{ 0x1000000000000001, "SystemInitializer" },
|
||||||
|
{ 0x1000000000000004, "CalWriter" },
|
||||||
|
{ 0x1000000000000005, "DevMenuCommand" },
|
||||||
|
{ 0x1000000000000006, "SettingsManager" },
|
||||||
|
{ 0x1000000000000007, "ApplicationLauncer" },
|
||||||
|
{ 0x100000000000000B, "SnapShotDumper" },
|
||||||
|
{ 0x100000000000000C, "SystemUpdater" },
|
||||||
|
{ 0x100000000000000E, "ControllerFirmwareUpdater" },
|
||||||
|
|
||||||
|
/* Factory system modules. */
|
||||||
|
{ 0x010000000000B120, "nvdbgsvc" },
|
||||||
|
{ 0x010000000000B14A, "manu" },
|
||||||
|
{ 0x010000000000B14B, "ManuUsbLoopBack" },
|
||||||
|
{ 0x010000000000B1B8, "DevFwdbgHbPackage" },
|
||||||
|
{ 0x010000000000B1B9, "DevFwdbgUsbPackage" },
|
||||||
|
{ 0x010000000000B1BA, "ProdFwdbgPackage" },
|
||||||
|
{ 0x010000000000B22A, "scs" },
|
||||||
|
{ 0x010000000000B22B, "ControllerFirmwareDebug" },
|
||||||
|
{ 0x010000000000B240, "htc" },
|
||||||
|
{ 0x010000000000C600, "BdkSample01" },
|
||||||
|
{ 0x010000000000C601, "BdkSample02" },
|
||||||
|
{ 0x010000000000C602, "BdkSample03" },
|
||||||
|
{ 0x010000000000C603, "BdkSample04" },
|
||||||
|
{ 0x010000000000D609, "dmnt.gen2" },
|
||||||
|
|
||||||
|
/* System applications. */
|
||||||
|
{ 0x01008BB00013C000, "flog" },
|
||||||
|
{ 0x0100069000078000, "RetailInteractiveDisplayMenu" },
|
||||||
|
{ 0x010000B003486000, "AudioUsbMicDebugTool" },
|
||||||
|
{ 0x0100458001E04000, "BcatTestApp01" },
|
||||||
|
{ 0x0100F910020F8000, "BcatTestApp02" },
|
||||||
|
{ 0x0100B7D0020FC000, "BcatTestApp03" },
|
||||||
|
{ 0x0100132002100000, "BcatTestApp04" },
|
||||||
|
{ 0x0100935002116000, "BcatTestApp05" },
|
||||||
|
{ 0x0100DA4002130000, "BcatTestApp06" },
|
||||||
|
{ 0x0100B0F002104000, "BcatTestApp07" },
|
||||||
|
{ 0x010051E002132000, "BcatTestApp08" },
|
||||||
|
{ 0x01004CB0015C8000, "BcatTestApp09" },
|
||||||
|
{ 0x01009720015CA000, "BcatTestApp10" },
|
||||||
|
{ 0x01002F20015C6000, "BcatTestApp11" },
|
||||||
|
{ 0x0100204001F90000, "BcatTestApp12" },
|
||||||
|
{ 0x0100060001F92000, "BcatTestApp13" },
|
||||||
|
{ 0x0100C26001F94000, "BcatTestApp14" },
|
||||||
|
{ 0x0100462001F96000, "BcatTestApp15" },
|
||||||
|
{ 0x01005C6001F98000, "BcatTestApp16" },
|
||||||
|
{ 0x010070000E3C0000, "EncounterUsr" },
|
||||||
|
{ 0x010086000E49C000, "EncounterUsrDummy" },
|
||||||
|
{ 0x0100810002D5A000, "ShopMonitaringTool" },
|
||||||
|
{ 0x010023D002B98000, "DeltaStress" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static const u32 g_systemTitlesCount = MAX_ELEMENTS(g_systemTitles);
|
||||||
|
|
||||||
/* Function prototypes. */
|
/* Function prototypes. */
|
||||||
|
|
||||||
NX_INLINE void titleFreeApplicationMetadata(void);
|
NX_INLINE void titleFreeApplicationMetadata(void);
|
||||||
|
@ -48,6 +350,7 @@ NX_INLINE void titleFreeTitleInfo(void);
|
||||||
NX_INLINE TitleApplicationMetadata *titleFindApplicationMetadataByTitleId(u64 title_id);
|
NX_INLINE TitleApplicationMetadata *titleFindApplicationMetadataByTitleId(u64 title_id);
|
||||||
|
|
||||||
static bool titleRetrieveApplicationMetadataFromNsRecords(void);
|
static bool titleRetrieveApplicationMetadataFromNsRecords(void);
|
||||||
|
static bool titleGenerateMetadataEntriesForSystemTitles(void);
|
||||||
static bool titleRetrieveApplicationMetadataByTitleId(u64 title_id, TitleApplicationMetadata *out);
|
static bool titleRetrieveApplicationMetadataByTitleId(u64 title_id, TitleApplicationMetadata *out);
|
||||||
|
|
||||||
static bool titleOpenNcmDatabases(void);
|
static bool titleOpenNcmDatabases(void);
|
||||||
|
@ -91,6 +394,13 @@ bool titleInitialize(void)
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Generate application metadata entries for system titles, since we can't retrieve their names via ns. */
|
||||||
|
if (!titleGenerateMetadataEntriesForSystemTitles())
|
||||||
|
{
|
||||||
|
LOGFILE("Failed to generate application metadata for system titles!");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
/* Open eMMC System, eMMC User and SD card ncm databases. */
|
/* Open eMMC System, eMMC User and SD card ncm databases. */
|
||||||
if (!titleOpenNcmDatabases())
|
if (!titleOpenNcmDatabases())
|
||||||
{
|
{
|
||||||
|
@ -166,13 +476,14 @@ bool titleInitialize(void)
|
||||||
|
|
||||||
if (g_titleInfo[i].app_metadata)
|
if (g_titleInfo[i].app_metadata)
|
||||||
{
|
{
|
||||||
fprintf(title_infos_txt, "Application Name: %s\r\n", g_titleInfo[i].app_metadata->lang_entry.name);
|
if (strlen(g_titleInfo[i].app_metadata->lang_entry.name)) fprintf(title_infos_txt, "Application Name: %s\r\n", g_titleInfo[i].app_metadata->lang_entry.name);
|
||||||
fprintf(title_infos_txt, "Application Author: %s\r\n", g_titleInfo[i].app_metadata->lang_entry.author);
|
if (strlen(g_titleInfo[i].app_metadata->lang_entry.author)) fprintf(title_infos_txt, "Application Author: %s\r\n", g_titleInfo[i].app_metadata->lang_entry.author);
|
||||||
fprintf(title_infos_txt, "JPEG Icon Size: 0x%X\r\n", g_titleInfo[i].app_metadata->icon_size);
|
if (g_titleInfo[i].app_metadata->icon_size) fprintf(title_infos_txt, "JPEG Icon Size: 0x%X\r\n", g_titleInfo[i].app_metadata->icon_size);
|
||||||
|
|
||||||
if (g_titleInfo[i].app_metadata->icon_size)
|
if (g_titleInfo[i].app_metadata->icon)
|
||||||
{
|
{
|
||||||
sprintf(icon_path, "sdmc:/records/%016lX.jpg", g_titleInfo[i].app_metadata->title_id);
|
sprintf(icon_path, "sdmc:/records/%016lX.jpg", g_titleInfo[i].app_metadata->title_id);
|
||||||
|
|
||||||
icon_jpg = fopen(icon_path, "wb");
|
icon_jpg = fopen(icon_path, "wb");
|
||||||
if (icon_jpg)
|
if (icon_jpg)
|
||||||
{
|
{
|
||||||
|
@ -341,6 +652,11 @@ NX_INLINE void titleFreeApplicationMetadata(void)
|
||||||
{
|
{
|
||||||
if (g_appMetadata)
|
if (g_appMetadata)
|
||||||
{
|
{
|
||||||
|
for(u32 i = 0; i < g_appMetadataCount; i++)
|
||||||
|
{
|
||||||
|
if (g_appMetadata[i].icon) free(g_appMetadata[i].icon);
|
||||||
|
}
|
||||||
|
|
||||||
free(g_appMetadata);
|
free(g_appMetadata);
|
||||||
g_appMetadata = NULL;
|
g_appMetadata = NULL;
|
||||||
}
|
}
|
||||||
|
@ -378,9 +694,6 @@ NX_INLINE TitleApplicationMetadata *titleFindApplicationMetadataByTitleId(u64 ti
|
||||||
|
|
||||||
static bool titleRetrieveApplicationMetadataFromNsRecords(void)
|
static bool titleRetrieveApplicationMetadataFromNsRecords(void)
|
||||||
{
|
{
|
||||||
/* Return right away if application metadata has already been retrieved. */
|
|
||||||
if (g_appMetadata || g_appMetadataCount) return true;
|
|
||||||
|
|
||||||
Result rc = 0;
|
Result rc = 0;
|
||||||
|
|
||||||
NsApplicationRecord *app_records = NULL;
|
NsApplicationRecord *app_records = NULL;
|
||||||
|
@ -467,6 +780,37 @@ end:
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool titleGenerateMetadataEntriesForSystemTitles(void)
|
||||||
|
{
|
||||||
|
TitleApplicationMetadata *tmp_app_metadata = NULL;
|
||||||
|
|
||||||
|
/* Reallocate application metadata buffer */
|
||||||
|
tmp_app_metadata = realloc(g_appMetadata, (g_appMetadataCount + g_systemTitlesCount) * sizeof(TitleApplicationMetadata));
|
||||||
|
if (!tmp_app_metadata)
|
||||||
|
{
|
||||||
|
LOGFILE("Failed to reallocate application metadata buffer! (%u %s).", g_appMetadataCount + g_systemTitlesCount, (g_appMetadataCount + g_systemTitlesCount) > 1 ? "entries" : "entry");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_appMetadata = tmp_app_metadata;
|
||||||
|
tmp_app_metadata = 0;
|
||||||
|
|
||||||
|
/* Clear new application metadata buffer area. */
|
||||||
|
memset(g_appMetadata + g_appMetadataCount, 0, g_systemTitlesCount * sizeof(TitleApplicationMetadata));
|
||||||
|
|
||||||
|
/* Fill new application metadata entries. */
|
||||||
|
for(u32 i = 0; i < g_systemTitlesCount; i++)
|
||||||
|
{
|
||||||
|
g_appMetadata[g_appMetadataCount + i].title_id = g_systemTitles[i].title_id;
|
||||||
|
sprintf(g_appMetadata[g_appMetadataCount + i].lang_entry.name, g_systemTitles[i].name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update application metadata count. */
|
||||||
|
g_appMetadataCount += g_systemTitlesCount;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static bool titleRetrieveApplicationMetadataByTitleId(u64 title_id, TitleApplicationMetadata *out)
|
static bool titleRetrieveApplicationMetadataByTitleId(u64 title_id, TitleApplicationMetadata *out)
|
||||||
{
|
{
|
||||||
if (!g_nsAppControlData || !title_id || !out)
|
if (!g_nsAppControlData || !title_id || !out)
|
||||||
|
@ -479,6 +823,9 @@ static bool titleRetrieveApplicationMetadataByTitleId(u64 title_id, TitleApplica
|
||||||
u64 write_size = 0;
|
u64 write_size = 0;
|
||||||
NacpLanguageEntry *lang_entry = NULL;
|
NacpLanguageEntry *lang_entry = NULL;
|
||||||
|
|
||||||
|
u32 icon_size = 0;
|
||||||
|
u8 *icon = NULL;
|
||||||
|
|
||||||
/* Retrieve ns application control data. */
|
/* Retrieve ns application control data. */
|
||||||
rc = nsGetApplicationControlData(NsApplicationControlSource_Storage, title_id, g_nsAppControlData, sizeof(NsApplicationControlData), &write_size);
|
rc = nsGetApplicationControlData(NsApplicationControlSource_Storage, title_id, g_nsAppControlData, sizeof(NsApplicationControlData), &write_size);
|
||||||
if (R_FAILED(rc))
|
if (R_FAILED(rc))
|
||||||
|
@ -501,6 +848,20 @@ static bool titleRetrieveApplicationMetadataByTitleId(u64 title_id, TitleApplica
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get icon. */
|
||||||
|
icon_size = (u32)(write_size - sizeof(NacpStruct));
|
||||||
|
if (icon_size)
|
||||||
|
{
|
||||||
|
icon = malloc(icon_size);
|
||||||
|
if (!icon)
|
||||||
|
{
|
||||||
|
LOGFILE("Error allocating memory for the icon buffer! (0x%X).", icon_size);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(icon, g_nsAppControlData->icon, icon_size);
|
||||||
|
}
|
||||||
|
|
||||||
/* Copy data. */
|
/* Copy data. */
|
||||||
out->title_id = title_id;
|
out->title_id = title_id;
|
||||||
|
|
||||||
|
@ -508,8 +869,8 @@ static bool titleRetrieveApplicationMetadataByTitleId(u64 title_id, TitleApplica
|
||||||
utilsTrimString(out->lang_entry.name);
|
utilsTrimString(out->lang_entry.name);
|
||||||
utilsTrimString(out->lang_entry.author);
|
utilsTrimString(out->lang_entry.author);
|
||||||
|
|
||||||
out->icon_size = (write_size - sizeof(NacpStruct));
|
out->icon_size = icon_size;
|
||||||
memcpy(out->icon, g_nsAppControlData->icon, sizeof(g_nsAppControlData->icon));
|
out->icon = icon;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ typedef struct {
|
||||||
u64 title_id; ///< Title ID from the application this data belongs to.
|
u64 title_id; ///< Title ID from the application this data belongs to.
|
||||||
NacpLanguageEntry lang_entry; ///< UTF-8 strings in the console language.
|
NacpLanguageEntry lang_entry; ///< UTF-8 strings in the console language.
|
||||||
u32 icon_size; ///< JPEG icon size.
|
u32 icon_size; ///< JPEG icon size.
|
||||||
u8 icon[0x20000]; ///< JPEG icon data.
|
u8 *icon; ///< JPEG icon data.
|
||||||
} TitleApplicationMetadata;
|
} TitleApplicationMetadata;
|
||||||
|
|
||||||
/// Retrieved using ncm databases.
|
/// Retrieved using ncm databases.
|
||||||
|
@ -51,7 +51,7 @@ typedef struct {
|
||||||
NcmContentInfo *content_infos; ///< Content info entries from this title.
|
NcmContentInfo *content_infos; ///< Content info entries from this title.
|
||||||
u64 title_size; ///< Total title size.
|
u64 title_size; ///< Total title size.
|
||||||
char title_size_str[32]; ///< Total title size string.
|
char title_size_str[32]; ///< Total title size string.
|
||||||
TitleApplicationMetadata *app_metadata; ///< Only available for applications.
|
TitleApplicationMetadata *app_metadata; ///< Only available for system titles and applications.
|
||||||
|
|
||||||
|
|
||||||
/* Pointers to patches / AOC? */
|
/* Pointers to patches / AOC? */
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#define USB_CMD_HEADER_MAGIC 0x4E584454 /* "NXDT". */
|
#define USB_CMD_HEADER_MAGIC 0x4E584454 /* "NXDT". */
|
||||||
|
|
||||||
#define USB_TRANSFER_ALIGNMENT 0x1000 /* 4 KiB. */
|
#define USB_TRANSFER_ALIGNMENT 0x1000 /* 4 KiB. */
|
||||||
#define USB_TRANSFER_TIMEOUT 1 /* 1 second. */
|
#define USB_TRANSFER_TIMEOUT 3 /* 3 seconds. */
|
||||||
|
|
||||||
/* Type definitions. */
|
/* Type definitions. */
|
||||||
|
|
||||||
|
|
1
todo.txt
1
todo.txt
|
@ -20,7 +20,6 @@ todo:
|
||||||
bktr: filelist generation functions (wrappers for romfs filelist generation functions)
|
bktr: filelist generation functions (wrappers for romfs filelist generation functions)
|
||||||
|
|
||||||
title: linked lists for patch / aoc info?
|
title: linked lists for patch / aoc info?
|
||||||
title: hardcode names for system titles
|
|
||||||
title: more functions for title lookup (filters, patches / aoc, etc.)
|
title: more functions for title lookup (filters, patches / aoc, etc.)
|
||||||
title: more functions for content lookup (based on id?)
|
title: more functions for content lookup (based on id?)
|
||||||
title: find a nice way to deal with orphan content
|
title: find a nice way to deal with orphan content
|
||||||
|
|
Loading…
Reference in a new issue