Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
a8c46485
There was an error fetching the commit references. Please try again later.
Commit
a8c46485
authored
10 years ago
by
bunnei
Browse files
Options
Downloads
Patches
Plain Diff
NCCH: Added RomFS loading.
parent
3da2bc68
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/core/loader/ncch.cpp
+28
-1
28 additions, 1 deletion
src/core/loader/ncch.cpp
src/core/loader/ncch.h
+8
-0
8 additions, 0 deletions
src/core/loader/ncch.h
with
36 additions
and
1 deletion
src/core/loader/ncch.cpp
+
28
−
1
View file @
a8c46485
...
...
@@ -178,6 +178,32 @@ const ResultStatus AppLoader_NCCH::LoadSectionExeFS(File::IOFile& file, const ch
return
ResultStatus
::
ErrorNotUsed
;
}
/**
* Reads RomFS of an NCCH file into AppLoader
* @param file Handle to file to read from
* @return ResultStatus result of function
*/
const
ResultStatus
AppLoader_NCCH
::
LoadRomFS
(
File
::
IOFile
&
file
)
{
// Check if the NCCH has a RomFS...
if
(
ncch_header
.
romfs_offset
!=
0
&&
ncch_header
.
romfs_size
!=
0
)
{
u32
romfs_offset
=
ncch_offset
+
(
ncch_header
.
romfs_offset
*
kBlockSize
)
+
0x1000
;
u32
romfs_size
=
(
ncch_header
.
romfs_size
*
kBlockSize
)
-
0x1000
;
INFO_LOG
(
LOADER
,
"RomFS offset: 0x%08X"
,
romfs_offset
);
INFO_LOG
(
LOADER
,
"RomFS size: 0x%08X"
,
romfs_size
);
romfs
.
resize
(
romfs_size
);
file
.
Seek
(
romfs_offset
,
0
);
file
.
ReadBytes
(
&
romfs
[
0
],
romfs_size
);
return
ResultStatus
::
Success
;
}
else
{
NOTICE_LOG
(
LOADER
,
"RomFS unused"
);
}
return
ResultStatus
::
ErrorNotUsed
;
}
/**
* Loads an NCCH file (e.g. from a CCI, or the first NCCH in a CXI)
* @param error_string Pointer to string to put error message if an error has occurred
...
...
@@ -193,7 +219,6 @@ const ResultStatus AppLoader_NCCH::Load() {
File
::
IOFile
file
(
filename
,
"rb"
);
if
(
file
.
IsOpen
())
{
NCCH_Header
ncch_header
;
file
.
ReadBytes
(
&
ncch_header
,
sizeof
(
NCCH_Header
));
// Skip NCSD header and load first NCCH (NCSD is just a container of NCCH files)...
...
...
@@ -237,6 +262,8 @@ const ResultStatus AppLoader_NCCH::Load() {
LoadSectionExeFS
(
file
,
"icon"
,
icon
);
LoadSectionExeFS
(
file
,
"logo"
,
logo
);
LoadRomFS
(
file
);
is_loaded
=
true
;
// Set state to loaded
LoadExec
();
// Load the executable into memory for booting
...
...
This diff is collapsed.
Click to expand it.
src/core/loader/ncch.h
+
8
−
0
View file @
a8c46485
...
...
@@ -168,6 +168,13 @@ private:
const
ResultStatus
LoadSectionExeFS
(
File
::
IOFile
&
file
,
const
char
*
name
,
std
::
vector
<
u8
>&
buffer
);
/**
* Reads RomFS of an NCCH file into AppLoader
* @param file Handle to file to read from
* @return ResultStatus result of function
*/
const
ResultStatus
LoadRomFS
(
File
::
IOFile
&
file
);
/**
* Loads .code section into memory for booting
* @return ResultStatus result of function
...
...
@@ -182,6 +189,7 @@ private:
u32
ncch_offset
;
// Offset to NCCH header, can be 0 or after NCSD header
u32
exefs_offset
;
NCCH_Header
ncch_header
;
ExeFs_Header
exefs_header
;
ExHeader_Header
exheader_header
;
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment