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
2eb9143e
Verified
Commit
2eb9143e
authored
1 year ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
chore: better lib structure
parent
56cab617
No related branches found
No related tags found
1 merge request
!29
Support for Libretro
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontends/libretro/src/lib.rs
+18
-55
18 additions, 55 deletions
frontends/libretro/src/lib.rs
with
18 additions
and
55 deletions
frontends/libretro/src/lib.rs
+
18
−
55
View file @
2eb9143e
#![allow(clippy::uninlined_format_args)]
use
std
::
os
::
raw
::{
c_char
,
c_uint
,
c_void
};
use
std
::
os
::
raw
::{
c_char
,
c_uint
};
const
RETRO_API_VERSION
:
u32
=
1
;
#[repr(C)]
pub
struct
r
etro
_s
ystem
_i
nfo
{
pub
struct
R
etro
S
ystem
I
nfo
{
pub
library_name
:
*
const
c_char
,
pub
library_version
:
*
const
c_char
,
pub
valid_extensions
:
*
const
c_char
,
...
...
@@ -13,53 +13,19 @@ pub struct retro_system_info {
pub
block_extract
:
bool
,
}
#[repr(C)]
pub
struct
retro_game_geometry
{
pub
base_width
:
u32
,
pub
base_height
:
u32
,
pub
max_width
:
u32
,
pub
max_height
:
u32
,
pub
aspect_ratio
:
f32
,
}
#[repr(C)]
pub
struct
retro_system_timing
{
pub
fps
:
f64
,
pub
sample_rate
:
f64
,
}
#[repr(C)]
pub
struct
retro_system_api
{
pub
retro_api_version
:
u32
,
pub
retro_get_system_info
:
extern
"C"
fn
(
*
mut
retro_system_info
),
pub
retro_set_environment
:
extern
"C"
fn
(
extern
"C"
fn
(
u32
,
*
const
c_void
),
*
const
c_void
),
pub
retro_set_video_refresh
:
extern
"C"
fn
(
extern
"C"
fn
()),
pub
retro_set_audio_sample
:
extern
"C"
fn
(
extern
"C"
fn
(
i16
)),
pub
retro_set_audio_sample_batch
:
extern
"C"
fn
(
extern
"C"
fn
(
*
const
i16
,
usize
)),
pub
retro_set_input_poll
:
extern
"C"
fn
(
extern
"C"
fn
()),
pub
retro_set_input_state
:
extern
"C"
fn
(
extern
"C"
fn
(
u32
,
u32
,
u16
,
i16
)
->
i16
),
// Add other Libretro core functions here as needed
#[no_mangle]
pub
extern
"C"
fn
retro_init
()
{
println!
(
"retro_init()"
);
}
#[no_mangle]
pub
extern
"C"
fn
retro_get_system_info
(
info
:
*
mut
retro_system_info
)
{
println!
(
"retro_get_system_info"
);
unsafe
{
(
*
info
)
.library_name
=
"Boytacean
\0
"
.as_ptr
()
as
*
const
c_char
;
(
*
info
)
.library_version
=
"v0.9.6
\0
"
.as_ptr
()
as
*
const
c_char
;
(
*
info
)
.valid_extensions
=
"gb|gbc
\0
"
.as_ptr
()
as
*
const
c_char
;
(
*
info
)
.need_fullpath
=
false
;
(
*
info
)
.block_extract
=
false
;
}
pub
extern
"C"
fn
retro_deinit
()
{
println!
(
"retro_deinit()"
);
}
#[no_mangle]
pub
extern
"C"
fn
retro_set_environment
(
_callback
:
extern
"C"
fn
(
u32
,
*
const
c_void
),
_data
:
*
const
c_void
,
)
{
// Set any environment variables or configuration options here if needed
// For example, you might handle system RAM allocation using this function
pub
extern
"C"
fn
retro_reset
()
{
println!
(
"retro_reset()"
);
}
#[no_mangle]
...
...
@@ -69,16 +35,13 @@ pub extern "C" fn retro_api_version() -> c_uint {
}
#[no_mangle]
pub
extern
"C"
fn
retro_init
()
{
println!
(
"retro_init()"
);
}
#[no_mangle]
pub
extern
"C"
fn
retro_deinit
()
{
println!
(
"retro_deinit()"
);
}
#[no_mangle]
pub
extern
"C"
fn
retro_reset
()
{
println!
(
"retro_reset()"
);
pub
extern
"C"
fn
retro_get_system_info
(
info
:
*
mut
RetroSystemInfo
)
{
println!
(
"retro_get_system_info"
);
unsafe
{
(
*
info
)
.library_name
=
"Boytacean
\0
"
.as_ptr
()
as
*
const
c_char
;
(
*
info
)
.library_version
=
"v0.9.6
\0
"
.as_ptr
()
as
*
const
c_char
;
(
*
info
)
.valid_extensions
=
"gb|gbc
\0
"
.as_ptr
()
as
*
const
c_char
;
(
*
info
)
.need_fullpath
=
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