Skip to content

Commit

Permalink
mgba: tentative fix for unlimited fps (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
avivace committed Dec 10, 2024
1 parent 284ddf1 commit 43a8b38
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions mgba.js
Original file line number Diff line number Diff line change
Expand Up @@ -5543,11 +5543,17 @@ var mGBA = (function () {
},
requestAnimationFrame: function (func) {
if (typeof requestAnimationFrame === "function") {
requestAnimationFrame(func);
return;
var now = Date.now();
if (Browser.nextRAF === 0) {
Browser.nextRAF = now + 1e3 / 60;
} else {
while (now + 2 >= Browser.nextRAF) {
Browser.nextRAF += 1e3 / 60;
}
}
var delay = Math.max(Browser.nextRAF - now, 0);
setTimeout(func, delay);
}
var RAF = Browser.fakeRequestAnimationFrame;
RAF(func);
},
safeCallback: function (func) {
return function () {
Expand Down
2 changes: 1 addition & 1 deletion pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ let stats_data = useFetch(stats_url).data;
</div>
</div>
<div class="col-12 lg:col-3 xl:col-3"></div>

<div class="col-12 lg:col-6 xl:col-4">
<div class="card mb-0">
<div class="flex justify-content-between mb-6">
Expand Down

0 comments on commit 43a8b38

Please sign in to comment.