Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
boytacean
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
João Magalhães
boytacean
Commits
707da981
Verified
Commit
707da981
authored
1 year ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
fix: libretro issue with global info buffers
parent
d1fdbc0c
No related branches found
No related tags found
1 merge request
!31
System state save
Pipeline
#3277
failed
1 year ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontends/libretro/src/lib.rs
+22
-2
22 additions, 2 deletions
frontends/libretro/src/lib.rs
with
22 additions
and
2 deletions
frontends/libretro/src/lib.rs
+
22
−
2
View file @
707da981
...
@@ -29,9 +29,25 @@ use std::{
...
@@ -29,9 +29,25 @@ use std::{
slice
::
from_raw_parts
,
slice
::
from_raw_parts
,
};
};
/// Represents the information about the LibRetro extension
/// to be used in a static context. Handles strings at the
/// byte buffer level and also at the C string level.
struct
LibRetroInfo
{
name
:
&
'static
str
,
version
:
&
'static
str
,
name_s
:
String
,
version_s
:
String
}
static
mut
EMULATOR
:
Option
<
GameBoy
>
=
None
;
static
mut
EMULATOR
:
Option
<
GameBoy
>
=
None
;
static
mut
KEY_STATES
:
Option
<
HashMap
<
RetroJoypad
,
bool
>>
=
None
;
static
mut
KEY_STATES
:
Option
<
HashMap
<
RetroJoypad
,
bool
>>
=
None
;
static
mut
FRAME_BUFFER
:
[
u32
;
FRAME_BUFFER_SIZE
]
=
[
0x00
;
FRAME_BUFFER_SIZE
];
static
mut
FRAME_BUFFER
:
[
u32
;
FRAME_BUFFER_SIZE
]
=
[
0x00
;
FRAME_BUFFER_SIZE
];
static
mut
INFO
:
LibRetroInfo
=
LibRetroInfo
{
name
:
""
,
version
:
""
,
name_s
:
String
::
new
(),
version_s
:
String
::
new
()
};
static
mut
PENDING_CYCLES
:
u32
=
0_u32
;
static
mut
PENDING_CYCLES
:
u32
=
0_u32
;
...
@@ -154,6 +170,10 @@ pub extern "C" fn retro_init() {
...
@@ -154,6 +170,10 @@ pub extern "C" fn retro_init() {
unsafe
{
unsafe
{
EMULATOR
=
Some
(
GameBoy
::
new
(
None
));
EMULATOR
=
Some
(
GameBoy
::
new
(
None
));
KEY_STATES
=
Some
(
HashMap
::
new
());
KEY_STATES
=
Some
(
HashMap
::
new
());
INFO
.name_s
=
format!
(
"{}
\0
"
,
Info
::
name
());
INFO
.name
=
INFO
.name_s
.as_str
();
INFO
.version_s
=
format!
(
"v{}
\0
"
,
Info
::
version
());
INFO
.version
=
INFO
.version_s
.as_str
();
}
}
}
}
...
@@ -175,8 +195,8 @@ pub extern "C" fn retro_reset() {
...
@@ -175,8 +195,8 @@ pub extern "C" fn retro_reset() {
#[no_mangle]
#[no_mangle]
pub
unsafe
extern
"C"
fn
retro_get_system_info
(
info
:
*
mut
RetroSystemInfo
)
{
pub
unsafe
extern
"C"
fn
retro_get_system_info
(
info
:
*
mut
RetroSystemInfo
)
{
debugln!
(
"retro_get_system_info()"
);
debugln!
(
"retro_get_system_info()"
);
(
*
info
)
.library_name
=
format!
(
"{}
\0
"
,
Info
::
name
())
.as_ptr
()
as
*
const
c_char
;
(
*
info
)
.library_name
=
INFO
.
name
.as_ptr
()
as
*
const
c_char
;
(
*
info
)
.library_version
=
format!
(
"v{}
\0
"
,
Info
::
version
())
.as_ptr
()
as
*
const
c_char
;
(
*
info
)
.library_version
=
INFO
.
version
.as_ptr
()
as
*
const
c_char
;
(
*
info
)
.valid_extensions
=
"gb|gbc
\0
"
.as_ptr
()
as
*
const
c_char
;
(
*
info
)
.valid_extensions
=
"gb|gbc
\0
"
.as_ptr
()
as
*
const
c_char
;
(
*
info
)
.need_fullpath
=
false
;
(
*
info
)
.need_fullpath
=
false
;
(
*
info
)
.block_extract
=
false
;
(
*
info
)
.block_extract
=
false
;
...
...
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