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
12ebc8d9
There was an error fetching the commit references. Please try again later.
Commit
12ebc8d9
authored
1 year ago
by
Liam
Browse files
Options
Downloads
Patches
Plain Diff
set: return version info from system archive
parent
2e760a98
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/system_archive/system_version.cpp
+4
-0
4 additions, 0 deletions
src/core/file_sys/system_archive/system_version.cpp
src/core/hle/service/set/set_sys.cpp
+30
-19
30 additions, 19 deletions
src/core/hle/service/set/set_sys.cpp
with
34 additions
and
19 deletions
src/core/file_sys/system_archive/system_version.cpp
+
4
−
0
View file @
12ebc8d9
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include
"common/logging/log.h"
#include
"core/file_sys/system_archive/system_version.h"
#include
"core/file_sys/vfs_vector.h"
#include
"core/hle/api_version.h"
...
...
@@ -12,6 +13,9 @@ std::string GetLongDisplayVersion() {
}
VirtualDir
SystemVersion
()
{
LOG_WARNING
(
Common_Filesystem
,
"called - Using hardcoded firmware version '{}'"
,
GetLongDisplayVersion
());
VirtualFile
file
=
std
::
make_shared
<
VectorVfsFile
>
(
std
::
vector
<
u8
>
(
0x100
),
"file"
);
file
->
WriteObject
(
HLE
::
ApiVersion
::
HOS_VERSION_MAJOR
,
0
);
file
->
WriteObject
(
HLE
::
ApiVersion
::
HOS_VERSION_MINOR
,
1
);
...
...
This diff is collapsed.
Click to expand it.
src/core/hle/service/set/set_sys.cpp
+
30
−
19
View file @
12ebc8d9
...
...
@@ -5,8 +5,13 @@
#include
"common/logging/log.h"
#include
"common/settings.h"
#include
"common/string_util.h"
#include
"core/core.h"
#include
"core/file_sys/content_archive.h"
#include
"core/file_sys/errors.h"
#include
"core/file_sys/system_archive/system_version.h"
#include
"core/file_sys/nca_metadata.h"
#include
"core/file_sys/registered_cache.h"
#include
"core/file_sys/romfs.h"
#include
"core/file_sys/system_archive/system_archive.h"
#include
"core/hle/service/filesystem/filesystem.h"
#include
"core/hle/service/ipc_helpers.h"
#include
"core/hle/service/set/set.h"
...
...
@@ -22,18 +27,30 @@ enum class GetFirmwareVersionType {
Version2
,
};
void
GetFirmwareVersionImpl
(
HLERequestContext
&
ctx
,
GetFirmwareVersionType
type
)
{
LOG_WARNING
(
Service_SET
,
"called - Using hardcoded firmware version '{}'"
,
FileSys
::
SystemArchive
::
GetLongDisplayVersion
());
void
GetFirmwareVersionImpl
(
Core
::
System
&
system
,
HLERequestContext
&
ctx
,
GetFirmwareVersionType
type
)
{
ASSERT_MSG
(
ctx
.
GetWriteBufferSize
()
==
0x100
,
"FirmwareVersion output buffer must be 0x100 bytes in size!"
);
// Instead of using the normal procedure of checking for the real system archive and if it
// doesn't exist, synthesizing one, I feel that that would lead to strange bugs because a
// used is using a really old or really new SystemVersion title. The synthesized one ensures
// consistence (currently reports as 5.1.0-0.0)
const
auto
archive
=
FileSys
::
SystemArchive
::
SystemVersion
();
constexpr
u64
FirmwareVersionSystemDataId
=
0x0100000000000809
;
auto
&
fsc
=
system
.
GetFileSystemController
();
// Attempt to load version data from disk
const
FileSys
::
RegisteredCache
*
bis_system
{};
std
::
unique_ptr
<
FileSys
::
NCA
>
nca
{};
FileSys
::
VirtualDir
romfs
{};
bis_system
=
fsc
.
GetSystemNANDContents
();
if
(
bis_system
)
{
nca
=
bis_system
->
GetEntry
(
FirmwareVersionSystemDataId
,
FileSys
::
ContentRecordType
::
Data
);
}
if
(
nca
)
{
romfs
=
FileSys
::
ExtractRomFS
(
nca
->
GetRomFS
());
}
if
(
!
romfs
)
{
romfs
=
FileSys
::
ExtractRomFS
(
FileSys
::
SystemArchive
::
SynthesizeSystemArchive
(
FirmwareVersionSystemDataId
));
}
const
auto
early_exit_failure
=
[
&
ctx
](
std
::
string_view
desc
,
Result
code
)
{
LOG_ERROR
(
Service_SET
,
"General failure while attempting to resolve firmware version ({})."
,
...
...
@@ -42,13 +59,7 @@ void GetFirmwareVersionImpl(HLERequestContext& ctx, GetFirmwareVersionType type)
rb
.
Push
(
code
);
};
if
(
archive
==
nullptr
)
{
early_exit_failure
(
"The system version archive couldn't be synthesized."
,
FileSys
::
ERROR_FAILED_MOUNT_ARCHIVE
);
return
;
}
const
auto
ver_file
=
archive
->
GetFile
(
"file"
);
const
auto
ver_file
=
romfs
->
GetFile
(
"file"
);
if
(
ver_file
==
nullptr
)
{
early_exit_failure
(
"The system version archive didn't contain the file 'file'."
,
FileSys
::
ERROR_INVALID_ARGUMENT
);
...
...
@@ -87,12 +98,12 @@ void SET_SYS::SetLanguageCode(HLERequestContext& ctx) {
void
SET_SYS
::
GetFirmwareVersion
(
HLERequestContext
&
ctx
)
{
LOG_DEBUG
(
Service_SET
,
"called"
);
GetFirmwareVersionImpl
(
ctx
,
GetFirmwareVersionType
::
Version1
);
GetFirmwareVersionImpl
(
system
,
ctx
,
GetFirmwareVersionType
::
Version1
);
}
void
SET_SYS
::
GetFirmwareVersion2
(
HLERequestContext
&
ctx
)
{
LOG_DEBUG
(
Service_SET
,
"called"
);
GetFirmwareVersionImpl
(
ctx
,
GetFirmwareVersionType
::
Version2
);
GetFirmwareVersionImpl
(
system
,
ctx
,
GetFirmwareVersionType
::
Version2
);
}
void
SET_SYS
::
GetAccountSettings
(
HLERequestContext
&
ctx
)
{
...
...
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