melchett wrote: ↑Tue Aug 25, 2020 5:29 pm
Not sure yet either - it's clearly capable of running smoothly when it receives the right number of timer events in the queue. I'll compare it to what's happening in Windows when I get a chance.
AFAIK it runs fine on Linux on my Intel desktop so I don't think this is a Linux vs. Windows issue. It will be worth looking at main.c and in particular at:
Code: Select all
void main_setspeed(int speed)
{
log_debug("main: setspeed %d", speed);
if (speed == EMU_SPEED_FULL)
main_start_fullspeed();
else {
al_stop_timer(timer);
fullspeed = FSPEED_NONE;
if (speed != EMU_SPEED_PAUSED) {
if (speed >= NUM_EMU_SPEEDS) {
log_warn("main: speed #%d out of range, defaulting to 100%%", speed);
speed = 4;
}
al_set_timer_speed(timer, emu_speeds[speed].timer_interval);
time_limit = emu_speeds[speed].timer_interval * 2.0;
vid_fskipmax = emu_speeds[speed].fskipmax;
log_debug("main: new speed#%d, timer interval=%g, vid_fskipmax=%d", speed, emu_speeds[speed].timer_interval, vid_fskipmax);
al_start_timer(timer);
}
}
emuspeed = speed;
}
and the table that refers to which is:
Code: Select all
const emu_speed_t emu_speeds[NUM_EMU_SPEEDS] = {
{ "10%", 1.0 / (50.0 * 0.10), 1 },
{ "25%", 1.0 / (50.0 * 0.25), 1 },
{ "50%", 1.0 / (50.0 * 0.50), 1 },
{ "75%", 1.0 / (50.0 * 0.75), 1 },
{ "100%", 1.0 / 50.0, 1 },
{ "150%", 1.0 / (50.0 * 1.50), 2 },
{ "200%", 1.0 / (50.0 * 2.00), 2 },
{ "300%", 1.0 / (50.0 * 3.00), 3 },
{ "400%", 1.0 / (50.0 * 4.00), 4 },
{ "500%", 1.0 / (50.0 * 5.00), 5 }
};
Then look at this:
Code: Select all
static void main_timer(ALLEGRO_EVENT *event)
{
double now = al_get_time();
double delay = now - event->any.timestamp;
if (delay < time_limit) {
...
}
}
So this time_limit is there to make sure that, in the event the host system is too slow to run at the requested speed, timer events don't fill up the Allegro event queue. If the queue becomes full that means no other events, like keypresses etc. get processed. You could experiment with the * 2.0 in main_setspeed and see if changing that helps. The general idea is we want to be able to maintain the right average speed even if the host is temporarily busy doing something else, i.e. we want to distinguish between a case of the host being temporarily busy and just consistently too slow.
I would offer to try this myself but I don't have a Raspberry Pi 4.