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
a0055192
There was an error fetching the commit references. Please try again later.
Commit
a0055192
authored
5 years ago
by
Zach Hilman
Browse files
Options
Downloads
Patches
Plain Diff
patch_manager: Update cheat parsing for new VM
parent
c6becfc9
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/patch_manager.cpp
+17
-12
17 additions, 12 deletions
src/core/file_sys/patch_manager.cpp
src/core/file_sys/patch_manager.h
+3
-3
3 additions, 3 deletions
src/core/file_sys/patch_manager.h
with
20 additions
and
15 deletions
src/core/file_sys/patch_manager.cpp
+
17
−
12
View file @
a0055192
...
...
@@ -22,6 +22,7 @@
#include
"core/hle/service/filesystem/filesystem.h"
#include
"core/loader/loader.h"
#include
"core/loader/nso.h"
#include
"core/memory/cheat_engine.h"
#include
"core/settings.h"
namespace
FileSys
{
...
...
@@ -247,9 +248,10 @@ bool PatchManager::HasNSOPatch(const std::array<u8, 32>& build_id_) const {
return
!
CollectPatches
(
patch_dirs
,
build_id
).
empty
();
}
static
std
::
optional
<
CheatList
>
ReadCheatFileFromFolder
(
const
Core
::
System
&
system
,
u64
title_id
,
const
std
::
array
<
u8
,
0x20
>&
build_id_
,
const
VirtualDir
&
base_path
,
bool
upper
)
{
namespace
{
std
::
optional
<
std
::
vector
<
Memory
::
CheatEntry
>>
ReadCheatFileFromFolder
(
const
Core
::
System
&
system
,
u64
title_id
,
const
std
::
array
<
u8
,
0x20
>&
build_id_
,
const
VirtualDir
&
base_path
,
bool
upper
)
{
const
auto
build_id_raw
=
Common
::
HexToString
(
build_id_
,
upper
);
const
auto
build_id
=
build_id_raw
.
substr
(
0
,
sizeof
(
u64
)
*
2
);
const
auto
file
=
base_path
->
GetFile
(
fmt
::
format
(
"{}.txt"
,
build_id
));
...
...
@@ -267,12 +269,15 @@ static std::optional<CheatList> ReadCheatFileFromFolder(const Core::System& syst
return
std
::
nullopt
;
}
TextCheatParser
parser
;
return
parser
.
Parse
(
system
,
data
);
Memory
::
TextCheatParser
parser
;
return
parser
.
Parse
(
system
,
std
::
string_view
(
reinterpret_cast
<
const
char
*
const
>
(
data
.
data
()),
data
.
size
()));
}
std
::
vector
<
CheatList
>
PatchManager
::
CreateCheatList
(
const
Core
::
System
&
system
,
const
std
::
array
<
u8
,
32
>&
build_id_
)
const
{
}
// Anonymous namespace
std
::
vector
<
Memory
::
CheatEntry
>
PatchManager
::
CreateCheatList
(
const
Core
::
System
&
system
,
const
std
::
array
<
u8
,
32
>&
build_id_
)
const
{
const
auto
load_dir
=
Core
::
System
::
GetInstance
().
GetFileSystemController
().
GetModificationLoadRoot
(
title_id
);
if
(
load_dir
==
nullptr
)
{
...
...
@@ -284,20 +289,20 @@ std::vector<CheatList> PatchManager::CreateCheatList(const Core::System& system,
std
::
sort
(
patch_dirs
.
begin
(),
patch_dirs
.
end
(),
[](
const
VirtualDir
&
l
,
const
VirtualDir
&
r
)
{
return
l
->
GetName
()
<
r
->
GetName
();
});
std
::
vector
<
CheatList
>
out
;
out
.
reserve
(
patch_dirs
.
size
());
std
::
vector
<
Memory
::
CheatEntry
>
out
;
for
(
const
auto
&
subdir
:
patch_dirs
)
{
auto
cheats_dir
=
subdir
->
GetSubdirectory
(
"cheats"
);
if
(
cheats_dir
!=
nullptr
)
{
auto
res
=
ReadCheatFileFromFolder
(
system
,
title_id
,
build_id_
,
cheats_dir
,
true
);
if
(
res
.
has_value
())
{
out
.
push_back
(
std
::
move
(
*
res
));
std
::
copy
(
res
->
begin
(),
res
->
end
(),
std
::
back_inserter
(
out
));
continue
;
}
res
=
ReadCheatFileFromFolder
(
system
,
title_id
,
build_id_
,
cheats_dir
,
false
);
if
(
res
.
has_value
())
out
.
push_back
(
std
::
move
(
*
res
));
if
(
res
.
has_value
())
{
std
::
copy
(
res
->
begin
(),
res
->
end
(),
std
::
back_inserter
(
out
));
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/core/file_sys/patch_manager.h
+
3
−
3
View file @
a0055192
...
...
@@ -8,9 +8,9 @@
#include
<memory>
#include
<string>
#include
"common/common_types.h"
#include
"core/file_sys/cheat_engine.h"
#include
"core/file_sys/nca_metadata.h"
#include
"core/file_sys/vfs.h"
#include
"core/memory/dmnt_cheat_types.h"
namespace
Core
{
class
System
;
...
...
@@ -51,8 +51,8 @@ public:
bool
HasNSOPatch
(
const
std
::
array
<
u8
,
0x20
>&
build_id
)
const
;
// Creates a CheatList object with all
std
::
vector
<
CheatList
>
CreateCheatList
(
const
Core
::
System
&
system
,
const
std
::
array
<
u8
,
0x20
>&
build_id
)
const
;
std
::
vector
<
Memory
::
CheatEntry
>
CreateCheatList
(
const
Core
::
System
&
system
,
const
std
::
array
<
u8
,
0x20
>&
build_id
)
const
;
// Currently tracked RomFS patches:
// - Game Updates
...
...
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