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
fd3806fd
There was an error fetching the commit references. Please try again later.
Commit
fd3806fd
authored
7 years ago
by
shinyquagsire23
Browse files
Options
Downloads
Patches
Plain Diff
loader: Use NPDM information when loading NSOs
parent
2b28fd78
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/deconstructed_rom_directory.cpp
+13
-4
13 additions, 4 deletions
src/core/loader/deconstructed_rom_directory.cpp
src/core/loader/deconstructed_rom_directory.h
+2
-0
2 additions, 0 deletions
src/core/loader/deconstructed_rom_directory.h
with
15 additions
and
4 deletions
src/core/loader/deconstructed_rom_directory.cpp
+
13
−
4
View file @
fd3806fd
...
@@ -53,6 +53,7 @@ AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileUti
...
@@ -53,6 +53,7 @@ AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileUti
FileType
AppLoader_DeconstructedRomDirectory
::
IdentifyType
(
FileUtil
::
IOFile
&
file
,
FileType
AppLoader_DeconstructedRomDirectory
::
IdentifyType
(
FileUtil
::
IOFile
&
file
,
const
std
::
string
&
filepath
)
{
const
std
::
string
&
filepath
)
{
bool
is_main_found
{};
bool
is_main_found
{};
bool
is_npdm_found
{};
bool
is_rtld_found
{};
bool
is_rtld_found
{};
bool
is_sdk_found
{};
bool
is_sdk_found
{};
...
@@ -67,6 +68,9 @@ FileType AppLoader_DeconstructedRomDirectory::IdentifyType(FileUtil::IOFile& fil
...
@@ -67,6 +68,9 @@ FileType AppLoader_DeconstructedRomDirectory::IdentifyType(FileUtil::IOFile& fil
// Verify filename
// Verify filename
if
(
Common
::
ToLower
(
virtual_name
)
==
"main"
)
{
if
(
Common
::
ToLower
(
virtual_name
)
==
"main"
)
{
is_main_found
=
true
;
is_main_found
=
true
;
}
else
if
(
Common
::
ToLower
(
virtual_name
)
==
"main.npdm"
)
{
is_npdm_found
=
true
;
return
true
;
}
else
if
(
Common
::
ToLower
(
virtual_name
)
==
"rtld"
)
{
}
else
if
(
Common
::
ToLower
(
virtual_name
)
==
"rtld"
)
{
is_rtld_found
=
true
;
is_rtld_found
=
true
;
}
else
if
(
Common
::
ToLower
(
virtual_name
)
==
"sdk"
)
{
}
else
if
(
Common
::
ToLower
(
virtual_name
)
==
"sdk"
)
{
...
@@ -83,14 +87,14 @@ FileType AppLoader_DeconstructedRomDirectory::IdentifyType(FileUtil::IOFile& fil
...
@@ -83,14 +87,14 @@ FileType AppLoader_DeconstructedRomDirectory::IdentifyType(FileUtil::IOFile& fil
}
}
// We are done if we've found and verified all required NSOs
// We are done if we've found and verified all required NSOs
return
!
(
is_main_found
&&
is_rtld_found
&&
is_sdk_found
);
return
!
(
is_main_found
&&
is_npdm_found
&&
is_rtld_found
&&
is_sdk_found
);
};
};
// Search the directory recursively, looking for the required modules
// Search the directory recursively, looking for the required modules
const
std
::
string
directory
=
filepath
.
substr
(
0
,
filepath
.
find_last_of
(
"/
\\
"
))
+
DIR_SEP
;
const
std
::
string
directory
=
filepath
.
substr
(
0
,
filepath
.
find_last_of
(
"/
\\
"
))
+
DIR_SEP
;
FileUtil
::
ForeachDirectoryEntry
(
nullptr
,
directory
,
callback
);
FileUtil
::
ForeachDirectoryEntry
(
nullptr
,
directory
,
callback
);
if
(
is_main_found
&&
is_rtld_found
&&
is_sdk_found
)
{
if
(
is_main_found
&&
is_npdm_found
&&
is_rtld_found
&&
is_sdk_found
)
{
return
FileType
::
DeconstructedRomDirectory
;
return
FileType
::
DeconstructedRomDirectory
;
}
}
...
@@ -108,9 +112,13 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(
...
@@ -108,9 +112,13 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(
process
=
Kernel
::
Process
::
Create
(
"main"
);
process
=
Kernel
::
Process
::
Create
(
"main"
);
const
std
::
string
directory
=
filepath
.
substr
(
0
,
filepath
.
find_last_of
(
"/
\\
"
))
+
DIR_SEP
;
const
std
::
string
npdm_path
=
directory
+
DIR_SEP
+
"main.npdm"
;
metadata
.
Load
(
npdm_path
);
metadata
.
Print
();
// Load NSO modules
// Load NSO modules
VAddr
next_load_addr
{
Memory
::
PROCESS_IMAGE_VADDR
};
VAddr
next_load_addr
{
Memory
::
PROCESS_IMAGE_VADDR
};
const
std
::
string
directory
=
filepath
.
substr
(
0
,
filepath
.
find_last_of
(
"/
\\
"
))
+
DIR_SEP
;
for
(
const
auto
&
module
:
{
"rtld"
,
"main"
,
"subsdk0"
,
"subsdk1"
,
"subsdk2"
,
"subsdk3"
,
for
(
const
auto
&
module
:
{
"rtld"
,
"main"
,
"subsdk0"
,
"subsdk1"
,
"subsdk2"
,
"subsdk3"
,
"subsdk4"
,
"subsdk5"
,
"subsdk6"
,
"subsdk7"
,
"sdk"
})
{
"subsdk4"
,
"subsdk5"
,
"subsdk6"
,
"subsdk7"
,
"sdk"
})
{
const
std
::
string
path
=
directory
+
DIR_SEP
+
module
;
const
std
::
string
path
=
directory
+
DIR_SEP
+
module
;
...
@@ -127,7 +135,8 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(
...
@@ -127,7 +135,8 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(
process
->
address_mappings
=
default_address_mappings
;
process
->
address_mappings
=
default_address_mappings
;
process
->
resource_limit
=
process
->
resource_limit
=
Kernel
::
ResourceLimit
::
GetForCategory
(
Kernel
::
ResourceLimitCategory
::
APPLICATION
);
Kernel
::
ResourceLimit
::
GetForCategory
(
Kernel
::
ResourceLimitCategory
::
APPLICATION
);
process
->
Run
(
Memory
::
PROCESS_IMAGE_VADDR
,
48
,
Kernel
::
DEFAULT_STACK_SIZE
);
process
->
Run
(
Memory
::
PROCESS_IMAGE_VADDR
,
metadata
.
GetMainThreadPriority
(),
metadata
.
GetMainThreadStackSize
());
// Find the RomFS by searching for a ".romfs" file in this directory
// Find the RomFS by searching for a ".romfs" file in this directory
filepath_romfs
=
FindRomFS
(
directory
);
filepath_romfs
=
FindRomFS
(
directory
);
...
...
This diff is collapsed.
Click to expand it.
src/core/loader/deconstructed_rom_directory.h
+
2
−
0
View file @
fd3806fd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#include
<string>
#include
<string>
#include
"common/common_types.h"
#include
"common/common_types.h"
#include
"core/file_sys/program_metadata.h"
#include
"core/hle/kernel/kernel.h"
#include
"core/hle/kernel/kernel.h"
#include
"core/loader/loader.h"
#include
"core/loader/loader.h"
...
@@ -41,6 +42,7 @@ public:
...
@@ -41,6 +42,7 @@ public:
private
:
private
:
std
::
string
filepath_romfs
;
std
::
string
filepath_romfs
;
std
::
string
filepath
;
std
::
string
filepath
;
FileSys
::
ProgramMetadata
metadata
;
};
};
}
// namespace Loader
}
// namespace Loader
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