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
10812f84
There was an error fetching the commit references. Please try again later.
Commit
10812f84
authored
6 years ago
by
Zach Hilman
Browse files
Options
Downloads
Patches
Plain Diff
game_list: Populate control data from installed NAND
parent
e5504a06
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/yuzu/game_list.cpp
+34
-30
34 additions, 30 deletions
src/yuzu/game_list.cpp
src/yuzu/main.cpp
+1
-1
1 addition, 1 deletion
src/yuzu/main.cpp
with
35 additions
and
31 deletions
src/yuzu/game_list.cpp
+
34
−
30
View file @
10812f84
...
@@ -403,6 +403,28 @@ void GameList::RefreshGameDirectory() {
...
@@ -403,6 +403,28 @@ void GameList::RefreshGameDirectory() {
}
}
}
}
static
void
GetMetadataFromControlNCA
(
const
std
::
shared_ptr
<
FileSys
::
NCA
>&
nca
,
std
::
vector
<
u8
>&
icon
,
std
::
string
&
name
)
{
const
auto
control_dir
=
FileSys
::
ExtractRomFS
(
nca
->
GetRomFS
());
if
(
control_dir
==
nullptr
)
return
;
const
auto
nacp_file
=
control_dir
->
GetFile
(
"control.nacp"
);
if
(
nacp_file
==
nullptr
)
return
;
FileSys
::
NACP
nacp
(
nacp_file
);
name
=
nacp
.
GetApplicationName
();
FileSys
::
VirtualFile
icon_file
=
nullptr
;
for
(
const
auto
&
language
:
FileSys
::
LANGUAGE_NAMES
)
{
icon_file
=
control_dir
->
GetFile
(
"icon_"
+
std
::
string
(
language
)
+
".dat"
);
if
(
icon_file
!=
nullptr
)
{
icon
=
icon_file
->
ReadAllBytes
();
break
;
}
}
}
void
GameListWorker
::
AddFstEntriesToGameList
(
const
std
::
string
&
dir_path
,
unsigned
int
recursion
)
{
void
GameListWorker
::
AddFstEntriesToGameList
(
const
std
::
string
&
dir_path
,
unsigned
int
recursion
)
{
const
auto
usernand
=
Service
::
FileSystem
::
GetUserNANDContents
();
const
auto
usernand
=
Service
::
FileSystem
::
GetUserNANDContents
();
const
auto
installed_games
=
usernand
->
ListEntriesFilter
(
FileSys
::
TitleType
::
Application
,
const
auto
installed_games
=
usernand
->
ListEntriesFilter
(
FileSys
::
TitleType
::
Application
,
...
@@ -421,22 +443,8 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
...
@@ -421,22 +443,8 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
const
auto
&
control
=
const
auto
&
control
=
usernand
->
GetEntry
(
game
.
title_id
,
FileSys
::
ContentRecordType
::
Control
);
usernand
->
GetEntry
(
game
.
title_id
,
FileSys
::
ContentRecordType
::
Control
);
if
(
control
!=
nullptr
)
{
if
(
control
!=
nullptr
)
const
auto
control_dir
=
FileSys
::
ExtractRomFS
(
control
->
GetRomFS
());
GetMetadataFromControlNCA
(
control
,
icon
,
name
);
const
auto
nacp_file
=
control_dir
->
GetFile
(
"control.nacp"
);
FileSys
::
NACP
nacp
(
nacp_file
);
name
=
nacp
.
GetApplicationName
();
FileSys
::
VirtualFile
icon_file
=
nullptr
;
for
(
const
auto
&
language
:
FileSys
::
LANGUAGE_NAMES
)
{
icon_file
=
control_dir
->
GetFile
(
"icon_"
+
std
::
string
(
language
)
+
".dat"
);
if
(
icon_file
!=
nullptr
)
{
icon
=
icon_file
->
ReadAllBytes
();
break
;
}
}
}
emit
EntryReady
({
emit
EntryReady
({
new
GameListItemPath
(
new
GameListItemPath
(
FormatGameName
(
file
->
GetFullPath
()),
icon
,
QString
::
fromStdString
(
name
),
FormatGameName
(
file
->
GetFullPath
()),
icon
,
QString
::
fromStdString
(
name
),
...
@@ -450,6 +458,15 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
...
@@ -450,6 +458,15 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
boost
::
container
::
flat_map
<
u64
,
std
::
shared_ptr
<
FileSys
::
NCA
>>
nca_control_map
;
boost
::
container
::
flat_map
<
u64
,
std
::
shared_ptr
<
FileSys
::
NCA
>>
nca_control_map
;
const
auto
control_data
=
usernand
->
ListEntriesFilter
(
FileSys
::
TitleType
::
Application
,
FileSys
::
ContentRecordType
::
Control
);
for
(
const
auto
&
entry
:
control_data
)
{
const
auto
nca
=
usernand
->
GetEntry
(
entry
);
if
(
nca
!=
nullptr
)
nca_control_map
.
insert_or_assign
(
entry
.
title_id
,
nca
);
}
const
auto
nca_control_callback
=
const
auto
nca_control_callback
=
[
this
,
&
nca_control_map
](
u64
*
num_entries_out
,
const
std
::
string
&
directory
,
[
this
,
&
nca_control_map
](
u64
*
num_entries_out
,
const
std
::
string
&
directory
,
const
std
::
string
&
virtual_name
)
->
bool
{
const
std
::
string
&
virtual_name
)
->
bool
{
...
@@ -503,20 +520,7 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
...
@@ -503,20 +520,7 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
// Use from metadata pool.
// Use from metadata pool.
if
(
nca_control_map
.
find
(
program_id
)
!=
nca_control_map
.
end
())
{
if
(
nca_control_map
.
find
(
program_id
)
!=
nca_control_map
.
end
())
{
const
auto
nca
=
nca_control_map
[
program_id
];
const
auto
nca
=
nca_control_map
[
program_id
];
const
auto
control_dir
=
FileSys
::
ExtractRomFS
(
nca
->
GetRomFS
());
GetMetadataFromControlNCA
(
nca
,
icon
,
name
);
const
auto
nacp_file
=
control_dir
->
GetFile
(
"control.nacp"
);
FileSys
::
NACP
nacp
(
nacp_file
);
name
=
nacp
.
GetApplicationName
();
FileSys
::
VirtualFile
icon_file
=
nullptr
;
for
(
const
auto
&
language
:
FileSys
::
LANGUAGE_NAMES
)
{
icon_file
=
control_dir
->
GetFile
(
"icon_"
+
std
::
string
(
language
)
+
".dat"
);
if
(
icon_file
!=
nullptr
)
{
icon
=
icon_file
->
ReadAllBytes
();
break
;
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/yuzu/main.cpp
+
1
−
1
View file @
10812f84
...
@@ -682,7 +682,7 @@ void GMainWindow::OnMenuInstallToNAND() {
...
@@ -682,7 +682,7 @@ void GMainWindow::OnMenuInstallToNAND() {
}
}
if
(
index
>=
5
)
if
(
index
>=
5
)
index
+=
0x
80
;
index
+=
0x
7B
;
if
(
Service
::
FileSystem
::
GetUserNANDContents
()
->
InstallEntry
(
if
(
Service
::
FileSystem
::
GetUserNANDContents
()
->
InstallEntry
(
nca
,
static_cast
<
FileSys
::
TitleType
>
(
index
)))
{
nca
,
static_cast
<
FileSys
::
TitleType
>
(
index
)))
{
...
...
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