1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-22 10:16:39 +00:00

RomFS done.

Modifications method still missing though.
This commit is contained in:
Pablo Curiel 2020-04-27 19:30:35 -04:00
parent efe76093e4
commit 278142fd22
5 changed files with 27 additions and 3 deletions

View file

@ -271,6 +271,25 @@ int main(int argc, char *argv[])
printf("romfs get file entry by path success: %s | %p\n", romfs_file_entry->name, romfs_file_entry);
consoleUpdate(NULL);
if (romfsReadFileEntryData(&romfs_ctx, romfs_file_entry, buf, romfs_file_entry->size, 0))
{
printf("romfs read file entry success\n");
consoleUpdate(NULL);
tmp_file = fopen("sdmc:/nxdt_test/mscorlib.dll-resources.dat", "wb");
if (tmp_file)
{
fwrite(buf, 1, romfs_file_entry->size, tmp_file);
fclose(tmp_file);
tmp_file = NULL;
printf("romfs file entry data saved\n");
} else {
printf("romfs file entry data not saved\n");
}
} else {
printf("romfs read file entry failed\n");
}

View file

@ -302,6 +302,7 @@ void ncaFreeCryptoBuffer(void);
bool ncaInitializeContext(NcaContext *out, u8 storage_id, NcmContentStorage *ncm_storage, u8 hfs_partition_type, const NcmPackagedContentInfo *content_info, Ticket *tik);
/// Reads raw encrypted data from a NCA using an input context, previously initialized by ncaInitializeContext().
/// Input offset must be relative to the start of the NCA content file.
bool ncaReadContentFile(NcaContext *ctx, void *out, u64 read_size, u64 offset);
/// Reads decrypted data from a NCA FS section using an input context.

View file

@ -50,7 +50,7 @@ typedef struct {
typedef struct {
u64 hash_block_offset; ///< New hash block offset (relative to the start of the NCA content file).
u64 hash_block_size; ///< New hash block size.
u64 hash_block_size; ///< New hash block size (aligned to the AES block size from the NCA FS section).
u8 *hash_block; ///< New hash block contents.
u64 data_block_offset; ///< New data block offset (relative to the start of the NCA content file).
u64 data_block_size; ///< New data block size (aligned to the NcaHierarchicalSha256 block size).
@ -69,9 +69,11 @@ NX_INLINE void pfsFreeContext(PartitionFileSystemContext *ctx)
}
/// Reads raw partition data using a partition FS context.
/// Input offset must be relative to the start of the partition FS.
bool pfsReadPartitionData(PartitionFileSystemContext *ctx, void *out, u64 read_size, u64 offset);
/// Reads data from a previously retrieved PartitionFileSystemEntry using a partition FS context.
/// Input offset must be relative to the start of the partition FS entry.
bool pfsReadEntryData(PartitionFileSystemContext *ctx, PartitionFileSystemEntry *fs_entry, void *out, u64 read_size, u64 offset);
/// Generates modified + encrypted hash and data blocks using a partition FS context + entry information. Both blocks are ready to be used to replace NCA content data during writing operations.

View file

@ -115,9 +115,11 @@ NX_INLINE void romfsFreeContext(RomFileSystemContext *ctx)
}
/// Reads raw filesystem data using a RomFS context.
/// Input offset must be relative to the start of the RomFS.
bool romfsReadFileSystemData(RomFileSystemContext *ctx, void *out, u64 read_size, u64 offset);
/// Reads data from a previously retrieved RomFileSystemFileEntry using a RomFS context.
/// Input offset must be relative to the start of the RomFS file entry.
bool romfsReadFileEntryData(RomFileSystemContext *ctx, RomFileSystemFileEntry *file_entry, void *out, u64 read_size, u64 offset);
/// Calculates the extracted RomFS size.

View file

@ -215,7 +215,7 @@ static bool servicesClkGetServiceType(void *arg)
if (!strlen(info->name) || strncmp(info->name, "clk", 3) != 0 || info->init_func != NULL || info->close_func != NULL) return false;
/* Determine which service needs to be used to control hardware clock rates, depending on the system version */
/* This may either be pcv (sysver lower than 8.0.0) or clkrst (sysver equal or greater than 8.0.0) */
/* This may either be pcv (sysver lower than 8.0.0) or clkrst (sysver equal to or greater than 8.0.0) */
g_clkSvcUsePcv = hosversionBefore(8, 0, 0);
/* Fill service info */
@ -233,7 +233,7 @@ static bool servicesSplCryptoCheckAvailability(void *arg)
ServicesInfoEntry *info = (ServicesInfoEntry*)arg;
if (!strlen(info->name) || strncmp(info->name, "spl:mig", 7) != 0 || info->init_func == NULL || info->close_func == NULL) return false;
/* Check if spl:mig is available (sysver equal or greater than 4.0.0) */
/* Check if spl:mig is available (sysver equal to or greater than 4.0.0) */
return !hosversionBefore(4, 0, 0);
}