Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
beetle-psx-libretro
Commits
31ef976a
Unverified
Commit
31ef976a
authored
Apr 16, 2022
by
Libretro-Admin
Committed by
GitHub
Apr 16, 2022
Browse files
Merge pull request #846 from sonninnos/led-interface
Add libretro LED interface
parents
88929ae9
96f7d0fb
Pipeline
#102581
passed with stage
in 4 minutes and 8 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
libretro.cpp
View file @
31ef976a
...
...
@@ -1916,6 +1916,30 @@ void lightrec_free_mmap()
}
#endif
/* HAVE_LIGHTREC */
/* LED interface */
static
retro_set_led_state_t
led_state_cb
=
NULL
;
static
unsigned
int
retro_led_state
[
2
]
=
{
0
};
static
void
retro_led_interface
(
void
)
{
/* 0: Power
* 1: CD */
unsigned
int
led_state
[
2
]
=
{
0
};
unsigned
int
l
=
0
;
led_state
[
0
]
=
(
!
Running
)
?
1
:
0
;
led_state
[
1
]
=
(
PSX_CDC
->
DriveStatus
>
0
)
?
1
:
0
;
for
(
l
=
0
;
l
<
sizeof
(
led_state
)
/
sizeof
(
led_state
[
0
]);
l
++
)
{
if
(
retro_led_state
[
l
]
!=
led_state
[
l
])
{
retro_led_state
[
l
]
=
led_state
[
l
];
led_state_cb
(
l
,
led_state
[
l
]);
}
}
}
/* Forward declarations, required for disk control
* 'set initial disk' functionality */
static
unsigned
disk_get_num_images
(
void
);
...
...
@@ -4809,6 +4833,9 @@ void retro_run(void)
MEDNAFEN_CORE_GEOMETRY_MAX_W
<<
(
2
+
upscale_shift
));
}
/* LED interface */
retro_led_interface
();
video_frames
++
;
audio_frames
+=
spec
.
SoundBufSize
;
...
...
@@ -4873,6 +4900,7 @@ unsigned retro_api_version(void)
void
retro_set_environment
(
retro_environment_t
cb
)
{
struct
retro_vfs_interface_info
vfs_iface_info
;
struct
retro_led_interface
led_interface
;
environ_cb
=
cb
;
libretro_supports_option_categories
=
false
;
...
...
@@ -4884,7 +4912,11 @@ void retro_set_environment(retro_environment_t cb)
if
(
environ_cb
(
RETRO_ENVIRONMENT_GET_VFS_INTERFACE
,
&
vfs_iface_info
))
filestream_vfs_init
(
&
vfs_iface_info
);
input_set_env
(
cb
);
environ_cb
(
RETRO_ENVIRONMENT_GET_LED_INTERFACE
,
&
led_interface
);
if
(
led_interface
.
set_led_state
)
led_state_cb
=
led_interface
.
set_led_state
;
input_set_env
(
cb
);
rsx_intf_set_environment
(
cb
);
}
...
...
mednafen/psx/cdc.h
View file @
31ef976a
...
...
@@ -40,6 +40,9 @@ class PS_CDC
void
GetCDAudio
(
int32
samples
[
2
],
const
unsigned
freq
);
CD_Audio_Buffer
AudioBuffer
;
#ifdef __LIBRETRO__
int
DriveStatus
;
#endif
private:
CDIF
*
Cur_CDIF
;
...
...
@@ -152,7 +155,9 @@ class PS_CDC
DS_READING
,
DS_RESETTING
};
#ifndef __LIBRETRO__
int
DriveStatus
;
#endif
int
StatusAfterSeek
;
bool
Forward
;
bool
Backward
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment