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
libretro-minivmac
Commits
b48c030a
Commit
b48c030a
authored
Jan 25, 2022
by
Vladimir Serbinenko
Browse files
Use libretro pacing rather than real time for pacing
parent
171854c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
libretro/libretro-core.c
View file @
b48c030a
...
...
@@ -35,6 +35,7 @@ void retro_poll_event(int joyon);
void
retro_key_up
(
int
key
);
void
retro_key_down
(
int
key
);
void
retro_loop
(
void
);
void
retro_init_time
(
void
);
/* Variables */
#ifdef _WIN32
...
...
@@ -626,6 +627,8 @@ bool retro_load_game(const struct retro_game_info *info)
update_variables
();
retro_init_time
();
app_init
();
memset
(
SNDBUF
,
0
,
1024
*
2
*
2
);
...
...
minivmac/src/OSGLUERETRO.c
View file @
b48c030a
...
...
@@ -36,10 +36,14 @@
#include "MYOSGLUE.h"
#include "STRCONST.h"
#include "DATE2SEC.h"
extern
char
RETRO_ROM
[
512
];
extern
char
RETRO_DIR
[
512
];
LOCALVAR
ui5b
TimeDelta
;
LOCALVAR
int64_t
current_us
;
/* Forward declarations */
void
DoEmulateOneTick
(
void
);
blnr
InitEmulation
(
void
);
...
...
@@ -1156,9 +1160,21 @@ GLOBALOSGLUPROC DoneWithDrawingForTick(void)
}
void
retro_init_time
(
void
)
{
time_t
Current_Time
;
struct
tm
*
s
;
(
void
)
time
(
&
Current_Time
);
s
=
localtime
(
&
Current_Time
);
TimeDelta
=
Date2MacSeconds
(
s
->
tm_sec
,
s
->
tm_min
,
s
->
tm_hour
,
s
->
tm_mday
,
1
+
s
->
tm_mon
,
1900
+
s
->
tm_year
);
}
//retro loop
void
retro_loop
(
void
)
{
current_us
+=
1000000
/
60
;
if
(
DSKLOAD
==
1
)
{
(
void
)
Sony_Insert1
(
RPATH
,
falseblnr
);
...
...
@@ -1170,15 +1186,8 @@ void retro_loop(void)
if
(
ForceMacOff
)
return
;
RunOnEndOfSixtieth
();
DoEmulateExtraTime
();
#if 0
if (0/*CurSpeedStopped*/)
return;//WaitForTheNextEvent();
DoEmulateExtraTime();
RunOnEndOfSixtieth();
#endif
}
GLOBALOSGLUPROC
WaitForNextTick
(
void
)
{
}
...
...
@@ -1188,13 +1197,9 @@ GLOBALOSGLUPROC WaitForNextTick(void) { }
LOCALVAR
ui5b
TrueEmulatedTime
=
0
;
LOCALVAR
ui5b
CurEmulatedTime
=
0
;
#include "DATE2SEC.h"
#define TicksPerSecond 1000000
LOCALVAR
blnr
HaveTimeDelta
=
falseblnr
;
LOCALVAR
ui5b
TimeDelta
;
LOCALVAR
ui5b
NewMacDateInSeconds
;
LOCALVAR
ui5b
LastTimeSec
;
...
...
@@ -1202,28 +1207,9 @@ LOCALVAR ui5b LastTimeUsec;
LOCALPROC
GetCurrentTicks
(
void
)
{
struct
timeval
t
;
gettimeofday
(
&
t
,
NULL
);
if
(
!
HaveTimeDelta
)
{
time_t
Current_Time
;
struct
tm
*
s
;
(
void
)
time
(
&
Current_Time
);
s
=
localtime
(
&
Current_Time
);
TimeDelta
=
Date2MacSeconds
(
s
->
tm_sec
,
s
->
tm_min
,
s
->
tm_hour
,
s
->
tm_mday
,
1
+
s
->
tm_mon
,
1900
+
s
->
tm_year
)
-
t
.
tv_sec
;
#if 0 /* how portable is this ? */
CurMacDelta = ((ui5b)(s->tm_gmtoff) & 0x00FFFFFF)
| ((s->tm_isdst ? 0x80 : 0) << 24);
#endif
HaveTimeDelta
=
trueblnr
;
}
NewMacDateInSeconds
=
t
.
tv_sec
+
TimeDelta
;
LastTimeSec
=
(
ui5b
)
t
.
tv_sec
;
LastTimeUsec
=
(
ui5b
)
t
.
tv_usec
;
LastTimeSec
=
current_us
/
1000000
;
LastTimeUsec
=
current_us
%
1000000
;
NewMacDateInSeconds
=
TimeDelta
+
LastTimeSec
;
}
#define MyInvTimeStep 16626
/* TicksPerSecond / 60.14742 */
...
...
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