From e24c20f9e713983faddd168079f0b1a178198e60 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Sat, 24 Feb 2018 15:39:30 -0500 Subject: [PATCH] Added Nro prefix to Asset in nro.h + updated romfs_dev for this. --- nx/include/switch/nro.h | 14 +++++++------- nx/source/runtime/devices/romfs_dev.c | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/nx/include/switch/nro.h b/nx/include/switch/nro.h index 75876f0e..f2c9dfb6 100644 --- a/nx/include/switch/nro.h +++ b/nx/include/switch/nro.h @@ -8,8 +8,8 @@ #define NROHEADER_MAGICNUM 0x304f524e -#define ASSETHEADER_MAGICNUM 0x54455341 -#define ASSETHEADER_VERSION 0 +#define NROASSETHEADER_MAGICNUM 0x54455341 +#define NROASSETHEADER_VERSION 0 /// Entry for each segment in the codebin. typedef struct { @@ -41,14 +41,14 @@ typedef struct { typedef struct { u64 offset; u64 size; -} AssetSection; +} NroAssetSection; /// Custom asset header. typedef struct { u32 magic; u32 version; - AssetSection icon; - AssetSection nacp; - AssetSection romfs; -} AssetHeader; + NroAssetSection icon; + NroAssetSection nacp; + NroAssetSection romfs; +} NroAssetHeader; diff --git a/nx/source/runtime/devices/romfs_dev.c b/nx/source/runtime/devices/romfs_dev.c index 5bfd3497..3ea64416 100644 --- a/nx/source/runtime/devices/romfs_dev.c +++ b/nx/source/runtime/devices/romfs_dev.c @@ -213,14 +213,14 @@ Result romfsMount(struct romfs_mount **p) romfsInitMtime(mount); NroHeader hdr; - AssetHeader asset_header; + NroAssetHeader asset_header; if (!_romfs_read_chk(mount, sizeof(NroStart), &hdr, sizeof(hdr))) goto _fail0; if (hdr.Magic != NROHEADER_MAGICNUM) goto _fail0; if (!_romfs_read_chk(mount, hdr.size, &asset_header, sizeof(asset_header))) goto _fail0; - if (asset_header.magic != ASSETHEADER_MAGICNUM - || asset_header.version > ASSETHEADER_VERSION + if (asset_header.magic != NROASSETHEADER_MAGICNUM + || asset_header.version > NROASSETHEADER_VERSION || asset_header.romfs.offset == 0 || asset_header.romfs.size == 0) goto _fail0;