Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
supersonicAI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container 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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dmath010
supersonicAI
Commits
fbf14957
Commit
fbf14957
authored
7 years ago
by
Vicki Pfau
Browse files
Options
Downloads
Patches
Plain Diff
retro: Expose cheats
parent
18899e6f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/retro.cpp
+13
-0
13 additions, 0 deletions
src/retro.cpp
with
13 additions
and
0 deletions
src/retro.cpp
+
13
−
0
View file @
fbf14957
...
...
@@ -22,6 +22,7 @@ using namespace Retro;
struct
PyGameData
;
struct
PyRetroEmulator
{
Retro
::
Emulator
m_re
;
int
m_cheats
=
0
;
PyRetroEmulator
(
const
string
&
rom_path
)
{
if
(
Emulator
::
isLoaded
())
{
throw
std
::
runtime_error
(
"Cannot create multiple emulator instances per process"
);
...
...
@@ -91,6 +92,16 @@ struct PyRetroEmulator {
}
}
void
addCheat
(
const
string
&
code
)
{
m_re
.
setCheat
(
m_cheats
,
true
,
code
.
c_str
());
++
m_cheats
;
}
void
clearCheats
()
{
m_re
.
clearCheats
();
m_cheats
=
0
;
}
void
configureData
(
PyGameData
&
data
);
static
bool
loadCoreInfo
(
const
string
&
json
)
{
return
Retro
::
loadCoreInfo
(
json
);
...
...
@@ -309,6 +320,8 @@ PYBIND11_MODULE(_retro, m) {
.
def
(
"get_audio_rate"
,
&
PyRetroEmulator
::
getAudioRate
)
.
def
(
"get_resolution"
,
&
PyRetroEmulator
::
getResolution
)
.
def
(
"configure_data"
,
&
PyRetroEmulator
::
configureData
)
.
def
(
"add_cheat"
,
&
PyRetroEmulator
::
addCheat
)
.
def
(
"clear_cheats"
,
&
PyRetroEmulator
::
clearCheats
)
.
def_static
(
"load_core_info"
,
&
PyRetroEmulator
::
loadCoreInfo
);
py
::
class_
<
PyMemoryView
>
(
m
,
"Memory"
)
...
...
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