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
5ad1aa8b
There was an error fetching the commit references. Please try again later.
Commit
5ad1aa8b
authored
10 years ago
by
Mathieu Vaillancourt
Browse files
Options
Downloads
Patches
Plain Diff
Add a quick way to load Launcher.dat files
parent
bf025ed0
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.cpp
+54
-0
54 additions, 0 deletions
src/core/loader.cpp
src/core/loader.h
+6
-5
6 additions, 5 deletions
src/core/loader.h
with
60 additions
and
5 deletions
src/core/loader.cpp
+
54
−
0
View file @
5ad1aa8b
...
...
@@ -11,6 +11,8 @@
#include
"core/file_sys/directory_file_system.h"
#include
"core/elf/elf_reader.h"
#include
"core/mem_map.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
/// Loads an extracted CXI from a directory
...
...
@@ -66,6 +68,52 @@ bool Load_ELF(std::string &filename) {
return
true
;
}
/// Loads a Launcher DAT file
bool
Load_DAT
(
std
::
string
&
filename
)
{
std
::
string
full_path
=
filename
;
std
::
string
path
,
file
,
extension
;
SplitPath
(
ReplaceAll
(
full_path
,
"
\\
"
,
"/"
),
&
path
,
&
file
,
&
extension
);
#if EMU_PLATFORM == PLATFORM_WINDOWS
path
=
ReplaceAll
(
path
,
"/"
,
"
\\
"
);
#endif
File
::
IOFile
f
(
filename
,
"rb"
);
if
(
f
.
IsOpen
())
{
u64
size
=
f
.
GetSize
();
u8
*
buffer
=
new
u8
[
size
];
f
.
ReadBytes
(
buffer
,
size
);
/**
* (mattvail) We shouldn't really support this type of file
* but for the sake of making it easier... we'll temporarily/hackishly
* allow it. No sense in making a proper reader for this.
*/
u32
entrypoint
=
0x080c3ee0
;
// write to same entrypoint as elf
u32
payload_offset
=
0x6F4
;
const
u8
*
src
=
&
buffer
[
payload_offset
];
u8
*
dst
=
Memory
::
GetPointer
(
entrypoint
);
u32
srcSize
=
size
-
payload_offset
;
//just load everything...
u32
*
s
=
(
u32
*
)
src
;
u32
*
d
=
(
u32
*
)
dst
;
for
(
int
j
=
0
;
j
<
(
int
)(
srcSize
+
3
)
/
4
;
j
++
)
{
*
d
++
=
(
*
s
++
);
}
Core
::
g_app_core
->
SetPC
(
entrypoint
);
delete
[]
buffer
;
}
else
{
return
false
;
}
f
.
Close
();
return
true
;
}
namespace
Loader
{
bool
IsBootableDirectory
()
{
...
...
@@ -97,6 +145,9 @@ FileType IdentifyFile(std::string &filename) {
else
if
(
!
strcasecmp
(
extension
.
c_str
(),
".elf"
))
{
return
FILETYPE_CTR_ELF
;
// TODO(bunnei): Do some filetype checking :p
}
else
if
(
!
strcasecmp
(
extension
.
c_str
(),
".dat"
))
{
return
FILETYPE_LAUNCHER_DAT
;
}
else
if
(
!
strcasecmp
(
extension
.
c_str
(),
".zip"
))
{
return
FILETYPE_ARCHIVE_ZIP
;
}
...
...
@@ -127,6 +178,9 @@ bool LoadFile(std::string &filename, std::string *error_string) {
case
FILETYPE_CTR_ELF
:
return
Load_ELF
(
filename
);
case
FILETYPE_LAUNCHER_DAT
:
return
Load_DAT
(
filename
);
case
FILETYPE_DIRECTORY_CXI
:
return
LoadDirectory_CXI
(
filename
);
...
...
This diff is collapsed.
Click to expand it.
src/core/loader.h
+
6
−
5
View file @
5ad1aa8b
...
...
@@ -11,12 +11,13 @@
namespace
Loader
{
enum
FileType
{
FILETYPE_ERROR
,
FILETYPE_ERROR
,
FILETYPE_CTR_CCI
,
FILETYPE_CTR_CIA
,
FILETYPE_CTR_CXI
,
FILETYPE_CTR_ELF
,
FILETYPE_CTR_CCI
,
FILETYPE_CTR_CIA
,
FILETYPE_CTR_CXI
,
FILETYPE_CTR_ELF
,
FILETYPE_LAUNCHER_DAT
,
FILETYPE_DIRECTORY_CXI
,
...
...
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