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
flycast
Commits
6ed9a936
Commit
6ed9a936
authored
Mar 06, 2021
by
Libretro-Admin
Browse files
Optimize retro_run
parent
b4dae963
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/libretro/libretro.cpp
View file @
6ed9a936
...
...
@@ -1182,37 +1182,38 @@ static void update_variables(bool first_startup)
void
retro_run
(
void
)
{
bool
fastforward
=
false
;
bool
updated
=
false
;
if
(
environ_cb
(
RETRO_ENVIRONMENT_GET_FASTFORWARDING
,
&
fastforward
)
&&
settings
.
rend
.
ThreadedRendering
)
settings
.
aica
.
LimitFPS
=
!
fastforward
;
if
(
environ_cb
(
RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE
,
&
updated
)
&&
updated
)
update_variables
(
false
);
refresh_devices
(
false
);
if
(
devices_need_refresh
)
refresh_devices
(
false
);
#if !defined(TARGET_NO_THREADS)
if
(
settings
.
rend
.
ThreadedRendering
)
{
// On the first call, we start the emulator thread
if
(
first_run
)
{
emu_thread
.
Start
();
first_run
=
false
;
}
bool
fastforward
=
false
;
if
(
environ_cb
(
RETRO_ENVIRONMENT_GET_FASTFORWARDING
,
&
fastforward
))
settings
.
aica
.
LimitFPS
=
!
fastforward
;
// On the first call, we start the emulator thread
if
(
first_run
)
{
emu_thread
.
Start
();
first_run
=
false
;
}
poll_cb
();
poll_cb
();
if
(
settings
.
pvr
.
rend
==
0
||
settings
.
pvr
.
rend
==
3
)
glsm_ctl
(
GLSM_CTL_STATE_BIND
,
NULL
);
if
(
settings
.
pvr
.
rend
==
0
||
settings
.
pvr
.
rend
==
3
)
glsm_ctl
(
GLSM_CTL_STATE_BIND
,
NULL
);
// Render
is_dupe
=
!
rend_single_frame
();
// Render
is_dupe
=
!
rend_single_frame
();
if
(
settings
.
pvr
.
rend
==
0
||
settings
.
pvr
.
rend
==
3
)
glsm_ctl
(
GLSM_CTL_STATE_UNBIND
,
NULL
);
if
(
settings
.
pvr
.
rend
==
0
||
settings
.
pvr
.
rend
==
3
)
glsm_ctl
(
GLSM_CTL_STATE_UNBIND
,
NULL
);
}
else
#endif
...
...
@@ -2034,7 +2035,8 @@ bool retro_load_game(const struct retro_game_info *game)
if
(
naomi_cart_GetRotation
()
==
3
)
rotation
=
rotate_screen
?
0
:
1
;
environ_cb
(
RETRO_ENVIRONMENT_SET_ROTATION
,
&
rotation
);
refresh_devices
(
true
);
if
(
devices_need_refresh
)
refresh_devices
(
true
);
return
true
;
}
...
...
@@ -2355,31 +2357,28 @@ void retro_set_controller_port_device(unsigned in_port, unsigned device)
static
void
refresh_devices
(
bool
first_startup
)
{
if
(
devices_need_refresh
)
{
devices_need_refresh
=
false
;
set_input_descriptors
();
devices_need_refresh
=
false
;
set_input_descriptors
();
if
(
!
first_startup
)
{
if
(
settings
.
System
==
DC_PLATFORM_DREAMCAST
)
maple_ReconnectDevices
();
if
(
!
first_startup
)
{
if
(
settings
.
System
==
DC_PLATFORM_DREAMCAST
)
maple_ReconnectDevices
();
if
(
rumble
.
set_rumble_state
)
{
for
(
int
i
=
0
;
i
<
MAPLE_PORTS
;
i
++
)
{
rumble
.
set_rumble_state
(
i
,
RETRO_RUMBLE_STRONG
,
0
);
rumble
.
set_rumble_state
(
i
,
RETRO_RUMBLE_WEAK
,
0
);
}
}
}
else
{
mcfg_DestroyDevices
();
mcfg_CreateDevices
();
}
}
if
(
rumble
.
set_rumble_state
)
{
for
(
int
i
=
0
;
i
<
MAPLE_PORTS
;
i
++
)
{
rumble
.
set_rumble_state
(
i
,
RETRO_RUMBLE_STRONG
,
0
);
rumble
.
set_rumble_state
(
i
,
RETRO_RUMBLE_WEAK
,
0
);
}
}
}
else
{
mcfg_DestroyDevices
();
mcfg_CreateDevices
();
}
}
// API version (to detect version mismatch)
...
...
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