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
050547b8
There was an error fetching the commit references. Please try again later.
Commit
050547b8
authored
6 years ago
by
Zach Hilman
Browse files
Options
Downloads
Patches
Plain Diff
romfs: Implement CreateRomFS
parent
6eada3c5
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/file_sys/romfs.cpp
+17
-3
17 additions, 3 deletions
src/core/file_sys/romfs.cpp
src/core/file_sys/romfs.h
+8
-1
8 additions, 1 deletion
src/core/file_sys/romfs.h
with
25 additions
and
4 deletions
src/core/file_sys/romfs.cpp
+
17
−
3
View file @
050547b8
...
...
@@ -4,8 +4,10 @@
#include
"common/common_types.h"
#include
"common/swap.h"
#include
"core/file_sys/fsmitm_romfsbuild.hpp"
#include
"core/file_sys/romfs.h"
#include
"core/file_sys/vfs.h"
#include
"core/file_sys/vfs_concat.h"
#include
"core/file_sys/vfs_offset.h"
#include
"core/file_sys/vfs_vector.h"
...
...
@@ -98,7 +100,7 @@ void ProcessDirectory(VirtualFile file, std::size_t dir_offset, std::size_t file
}
}
VirtualDir
ExtractRomFS
(
VirtualFile
file
)
{
VirtualDir
ExtractRomFS
(
VirtualFile
file
,
bool
traverse_into_data
)
{
RomFSHeader
header
{};
if
(
file
->
ReadObject
(
&
header
)
!=
sizeof
(
RomFSHeader
))
return
nullptr
;
...
...
@@ -117,9 +119,21 @@ VirtualDir ExtractRomFS(VirtualFile file) {
VirtualDir
out
=
std
::
move
(
root
);
while
(
out
->
GetSubdirectory
(
""
)
!=
nullptr
)
out
=
out
->
GetSubdirectory
(
""
);
while
(
out
->
GetSubdirectories
().
size
()
==
1
&&
out
->
GetFiles
().
size
()
==
0
)
{
if
(
out
->
GetSubdirectories
().
front
()
->
GetName
()
==
"data"
&&
!
traverse_into_data
)
break
;
out
=
out
->
GetSubdirectories
().
front
();
}
return
out
;
}
VirtualFile
CreateRomFS
(
VirtualDir
dir
)
{
if
(
dir
==
nullptr
)
return
nullptr
;
RomFSBuildContext
ctx
{
dir
};
return
ConcatenateFiles
<
0
>
(
ctx
.
Build
(),
dir
->
GetName
());
}
}
// namespace FileSys
This diff is collapsed.
Click to expand it.
src/core/file_sys/romfs.h
+
8
−
1
View file @
050547b8
...
...
@@ -5,6 +5,7 @@
#pragma once
#include
<array>
#include
<map>
#include
"common/common_funcs.h"
#include
"common/common_types.h"
#include
"common/swap.h"
...
...
@@ -12,6 +13,8 @@
namespace
FileSys
{
struct
RomFSHeader
;
struct
IVFCLevel
{
u64_le
offset
;
u64_le
size
;
...
...
@@ -31,6 +34,10 @@ static_assert(sizeof(IVFCHeader) == 0xE0, "IVFCHeader has incorrect size.");
// Converts a RomFS binary blob to VFS Filesystem
// Returns nullptr on failure
VirtualDir
ExtractRomFS
(
VirtualFile
file
);
VirtualDir
ExtractRomFS
(
VirtualFile
file
,
bool
traverse_into_data
=
true
);
// Converts a VFS filesystem into a RomFS binary
// Returns nullptr on failure
VirtualFile
CreateRomFS
(
VirtualDir
dir
);
}
// namespace FileSys
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