From d3cc781bf625e5e09ccc5bceb3e2fc790328d299 Mon Sep 17 00:00:00 2001 From: plutoo Date: Mon, 26 Feb 2018 02:10:49 +0100 Subject: [PATCH] Stylefix for nro --- nx/include/switch/nro.h | 30 +++++++++++++-------------- nx/source/runtime/devices/romfs_dev.c | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/nx/include/switch/nro.h b/nx/include/switch/nro.h index f2c9dfb6..53e7c270 100644 --- a/nx/include/switch/nro.h +++ b/nx/include/switch/nro.h @@ -6,35 +6,35 @@ #pragma once -#define NROHEADER_MAGICNUM 0x304f524e +#define NROHEADER_MAGIC 0x304f524e -#define NROASSETHEADER_MAGICNUM 0x54455341 +#define NROASSETHEADER_MAGIC 0x54455341 #define NROASSETHEADER_VERSION 0 /// Entry for each segment in the codebin. typedef struct { - u32 FileOff; - u32 Size; -} NsoSegment; + u32 file_off; + u32 size; +} NroSegment; /// Offset 0x0 in the NRO. typedef struct { u32 unused; - u32 modOffset; - u8 Padding[8]; + u32 mod_offset; + u8 padding[8]; } NroStart; /// This follows NroStart, the actual nro-header. typedef struct { - u32 Magic; - u32 Unk1; + u32 magic; + u32 unk1; u32 size; - u32 Unk2; - NsoSegment Segments[3]; - u32 bssSize; - u32 Unk3; - u8 BuildId[0x20]; - u8 Padding[0x20]; + u32 unk2; + NroSegment segments[3]; + u32 bss_size; + u32 unk3; + u8 build_id[0x20]; + u8 padding[0x20]; } NroHeader; /// Custom asset section. diff --git a/nx/source/runtime/devices/romfs_dev.c b/nx/source/runtime/devices/romfs_dev.c index 3ea64416..5e7a7899 100644 --- a/nx/source/runtime/devices/romfs_dev.c +++ b/nx/source/runtime/devices/romfs_dev.c @@ -216,10 +216,10 @@ Result romfsMount(struct romfs_mount **p) NroAssetHeader asset_header; if (!_romfs_read_chk(mount, sizeof(NroStart), &hdr, sizeof(hdr))) goto _fail0; - if (hdr.Magic != NROHEADER_MAGICNUM) goto _fail0; + if (hdr.magic != NROHEADER_MAGIC) goto _fail0; if (!_romfs_read_chk(mount, hdr.size, &asset_header, sizeof(asset_header))) goto _fail0; - if (asset_header.magic != NROASSETHEADER_MAGICNUM + if (asset_header.magic != NROASSETHEADER_MAGIC || asset_header.version > NROASSETHEADER_VERSION || asset_header.romfs.offset == 0 || asset_header.romfs.size == 0)