Compare commits
3
Commits
6c8d08e618
..
v0.3.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7f7cb6afa | ||
|
|
99ae5b9eda | ||
|
|
5570955bc5 |
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@valknar/vpinball-wasm",
|
"name": "@valknar/vpinball-wasm",
|
||||||
"version": "0.2.0",
|
"version": "0.3.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@valknar/vpinball-wasm",
|
"name": "@valknar/vpinball-wasm",
|
||||||
"version": "0.2.0",
|
"version": "0.3.1",
|
||||||
"license": "SEE LICENSE IN LICENSE",
|
"license": "SEE LICENSE IN LICENSE",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^5.6.0"
|
"typescript": "^5.6.0"
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@valknar/vpinball-wasm",
|
"name": "@valknar/vpinball-wasm",
|
||||||
"version": "0.3.0",
|
"version": "0.3.1",
|
||||||
"description": "Visual Pinball's engine compiled to WebAssembly - real .vpx tables, real VBScript, WebGL2 rendering, in the browser",
|
"description": "Visual Pinball's engine compiled to WebAssembly - real .vpx tables, real VBScript, WebGL2 rendering, in the browser",
|
||||||
"license": "SEE LICENSE IN LICENSE",
|
"license": "SEE LICENSE IN LICENSE",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
diff --git a/src/cpuexec.c b/src/cpuexec.c
|
diff --git a/src/cpuexec.c b/src/cpuexec.c
|
||||||
index ca7401f..0bfcbe7 100644
|
index 07db6a1..19da31a 100644
|
||||||
--- a/src/cpuexec.c
|
--- a/src/cpuexec.c
|
||||||
+++ b/src/cpuexec.c
|
+++ b/src/cpuexec.c
|
||||||
@@ -466,6 +466,65 @@ void cpu_run(void)
|
@@ -466,6 +466,78 @@ void cpu_run(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,6 +29,19 @@ index ca7401f..0bfcbe7 100644
|
|||||||
+ once it has fully quit (cpu_post_run() has already been invoked). */
|
+ once it has fully quit (cpu_post_run() has already been invoked). */
|
||||||
+int cpu_run_emscripten_step(void)
|
+int cpu_run_emscripten_step(void)
|
||||||
+{
|
+{
|
||||||
|
+ /* usrintrf.c's per-frame video update contains a "while (g_fPause) {
|
||||||
|
+ ...; draw_screen(); ... }" busy-wait (see the VPINMAME/LIBPINMAME
|
||||||
|
+ branch around updatescreen()) that assumes a real OS thread will
|
||||||
|
+ later flip g_fPause back to 0 from outside it. We're single-threaded
|
||||||
|
+ here, so entering that loop at all would spin forever burning 100%
|
||||||
|
+ CPU with no way out - nothing else can ever run to clear the flag.
|
||||||
|
+ Skip cpu_timeslice() (and therefore that loop) entirely while paused;
|
||||||
|
+ the emulation simply doesn't advance until Controller.Pause is set
|
||||||
|
+ back to False and this function is called again next frame. */
|
||||||
|
+ extern int g_fPause;
|
||||||
|
+ if (g_fPause)
|
||||||
|
+ return 1;
|
||||||
|
+
|
||||||
+ const double frame_target = timer_get_time() + (1.0 / 60.0);
|
+ const double frame_target = timer_get_time() + (1.0 / 60.0);
|
||||||
+
|
+
|
||||||
+ while (!time_to_quit && !time_to_reset && timer_get_time() < frame_target)
|
+ while (!time_to_quit && !time_to_reset && timer_get_time() < frame_target)
|
||||||
@@ -68,41 +81,6 @@ index ca7401f..0bfcbe7 100644
|
|||||||
|
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
@@ -943,6 +1002,34 @@ void time_fence_exit()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+#elif defined(__EMSCRIPTEN__)
|
|
||||||
+
|
|
||||||
+// No cross-thread wait primitive is used here: this build is single-threaded
|
|
||||||
+// (see vpinball-wasm's README on why pthreads/SharedArrayBuffer are out of
|
|
||||||
+// scope), and time_fence is purely an *optional* external-clock-sync feature
|
|
||||||
+// (mirrored by Controller.TimeFence in controller.vbs) - reporting it as
|
|
||||||
+// unsupported just means the emulator paces itself on its own internal
|
|
||||||
+// timing instead of syncing to the host's clock, which is what every other
|
|
||||||
+// platform this library runs on outside of this fence do anyway.
|
|
||||||
+int time_fence_is_supported()
|
|
||||||
+{
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void time_fence_post()
|
|
||||||
+{
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int time_fence_wait(double secs)
|
|
||||||
+{
|
|
||||||
+ (void)secs;
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void time_fence_exit()
|
|
||||||
+{
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
#else
|
|
||||||
|
|
||||||
#include <semaphore.h>
|
|
||||||
diff --git a/src/libpinmame/libpinmame.cpp b/src/libpinmame/libpinmame.cpp
|
diff --git a/src/libpinmame/libpinmame.cpp b/src/libpinmame/libpinmame.cpp
|
||||||
index 6966d77..755d762 100644
|
index 6966d77..755d762 100644
|
||||||
--- a/src/libpinmame/libpinmame.cpp
|
--- a/src/libpinmame/libpinmame.cpp
|
||||||
|
|||||||
Reference in New Issue
Block a user