openvibers/source.openvibe.games Commits
Diagnose client JS world-load crash + local-test improvements
Changes
@@@ -76,6 +76,7 @@ static const char *s_OpenVibeModes[] ="deathrun","fortwars","traitortown",++ "sandbox",};static bool OV_IsModeAllowed( const char *pszMode )@@@ -95,6 +96,7 @@ static const char *OV_LocalConnectForMode( const char *pszMode )if ( !Q_stricmp( pszMode, "deathrun" ) ) return "127.0.0.1:27017";if ( !Q_stricmp( pszMode, "fortwars" ) ) return "127.0.0.1:27018";if ( !Q_stricmp( pszMode, "traitortown" ) ) return "127.0.0.1:27019";++ if ( !Q_stricmp( pszMode, "sandbox" ) ) return "127.0.0.1:27020";return "127.0.0.1:27015";}@@@ -207,6 +207,7 @@ int ovjs_eval(OVJSCore *c, const char *code, const char *filename)static int OVJS_LoadFile(OVJSCore *c, const char *path){if (!c->host || !c->host->readFile) return 0;++ if (c->host->log) { char b[256]; snprintf(b, sizeof(b), "core: loading %s", path); c->host->log(b); }char *code = c->host->readFile(path);if (!code) {if (c->host->warn) {@@@ -250,8 +251,14 @@ static void OVJS_RegisterBindings(OVJSCore *c)JS_FreeValue(c->ctx, global);}++static void OVJS_Trace(const OVJSHost *host, const char *msg)++{++ if (host && host->log) host->log(msg);++}++OVJSCore *ovjs_create(const OVJSHost *host, int isServerRealm, const char *mode){++ OVJS_Trace(host, "core: ovjs_create begin");OVJSCore *c = (OVJSCore *)calloc(1, sizeof(OVJSCore));if (!c) return NULL;c->host = host;@@@ -262,15 +269,23 @@ OVJSCore *ovjs_create(const OVJSHost *host, int isServerRealm, const char *mode)c->rt = JS_NewRuntime();if (!c->rt) { free(c); return NULL; }JS_SetMemoryLimit(c->rt, 32 * 1024 * 1024);-- JS_SetMaxStackSize(c->rt, 1024 * 1024);++ /* Keep well under the OS thread stack (Windows main thread ~1MB): if the JS++ * recursion limit exceeds the real C stack, deep calls overflow and crash++ * the process instead of raising a catchable JS error. */++ JS_SetMaxStackSize(c->rt, 256 * 1024);++ OVJS_Trace(host, "core: runtime created");c->ctx = JS_NewContext(c->rt);if (!c->ctx) { JS_FreeRuntime(c->rt); free(c); return NULL; }JS_SetContextOpaque(c->ctx, c);++ OVJS_Trace(host, "core: context created");OVJS_RegisterBindings(c);-- if (!OVJS_LoadCoreFiles(c)) { ovjs_destroy(c); return NULL; }++ OVJS_Trace(host, "core: bindings registered");++ if (!OVJS_LoadCoreFiles(c)) { OVJS_Trace(host, "core: LoadCoreFiles FAILED"); ovjs_destroy(c); return NULL; }++ OVJS_Trace(host, "core: core files loaded");OVJS_LoadGamemode(c);++ OVJS_Trace(host, "core: gamemode loaded — create done");return c;}@@@ -26,6 +26,14 @@ if [ "${1:-}" != "" ] && [ "${2:-}" != "" ]; thenCONNECT_ARGS="+connect $1:$2"fi++# Load straight into a local listen-server world (bypasses the dedicated-server++# travel/token flow) for reliable local testing and crash reproduction:++# OPENVIBE_STARTUP_MAP=ov_hub tools/run-client-proton-x64.sh++STARTUP_MAP_ARGS=""++if [ -n "${OPENVIBE_STARTUP_MAP:-}" ]; then++ STARTUP_MAP_ARGS="+map ${OPENVIBE_STARTUP_MAP}"++fi++echo "Launching OpenVibe: Source via Proton..."echo " Game: $GAME_DIR"echo " Proton: $GE_PROTON"@@@ -67,4 +75,4 @@ exec "$GE_PROTON/proton" waitforexitandrun \+exec openvibe_proton_stability.cfg \+con_logfile openvibe_proton_console.log \+exec openvibe_proton_client.cfg \-- $CONNECT_ARGS++ $CONNECT_ARGS $STARTUP_MAP_ARGS
@@ -76,6 +76,7 @@ static const char *s_OpenVibeModes[] =
@@ -76,6 +76,7 @@ static const char *s_OpenVibeModes[] =
"deathrun",
"deathrun",
"fortwars",
"fortwars",
"traitortown",
"traitortown",
+ "sandbox",
};
};
static bool OV_IsModeAllowed( const char *pszMode )
static bool OV_IsModeAllowed( const char *pszMode )
@@ -95,6 +96,7 @@ static const char *OV_LocalConnectForMode( const char *pszMode )
@@ -95,6 +96,7 @@ static const char *OV_LocalConnectForMode( const char *pszMode )
if ( !Q_stricmp( pszMode, "deathrun" ) ) return "127.0.0.1:27017";
if ( !Q_stricmp( pszMode, "deathrun" ) ) return "127.0.0.1:27017";
if ( !Q_stricmp( pszMode, "fortwars" ) ) return "127.0.0.1:27018";
if ( !Q_stricmp( pszMode, "fortwars" ) ) return "127.0.0.1:27018";
if ( !Q_stricmp( pszMode, "traitortown" ) ) return "127.0.0.1:27019";
if ( !Q_stricmp( pszMode, "traitortown" ) ) return "127.0.0.1:27019";
+ if ( !Q_stricmp( pszMode, "sandbox" ) ) return "127.0.0.1:27020";
return "127.0.0.1:27015";
return "127.0.0.1:27015";
}
}
@@ -207,6 +207,7 @@ int ovjs_eval(OVJSCore *c, const char *code, const char *filename)
@@ -207,6 +207,7 @@ int ovjs_eval(OVJSCore *c, const char *code, const char *filename)
static int OVJS_LoadFile(OVJSCore *c, const char *path)
static int OVJS_LoadFile(OVJSCore *c, const char *path)
{
{
if (!c->host || !c->host->readFile) return 0;
if (!c->host || !c->host->readFile) return 0;
+ if (c->host->log) { char b[256]; snprintf(b, sizeof(b), "core: loading %s", path); c->host->log(b); }
char *code = c->host->readFile(path);
char *code = c->host->readFile(path);
if (!code) {
if (!code) {
if (c->host->warn) {
if (c->host->warn) {
@@ -250,8 +251,14 @@ static void OVJS_RegisterBindings(OVJSCore *c)
@@ -250,8 +251,14 @@ static void OVJS_RegisterBindings(OVJSCore *c)
JS_FreeValue(c->ctx, global);
JS_FreeValue(c->ctx, global);
}
}
+static void OVJS_Trace(const OVJSHost *host, const char *msg)
+{
+ if (host && host->log) host->log(msg);
+}
+
OVJSCore *ovjs_create(const OVJSHost *host, int isServerRealm, const char *mode)
OVJSCore *ovjs_create(const OVJSHost *host, int isServerRealm, const char *mode)
{
{
+ OVJS_Trace(host, "core: ovjs_create begin");
OVJSCore *c = (OVJSCore *)calloc(1, sizeof(OVJSCore));
OVJSCore *c = (OVJSCore *)calloc(1, sizeof(OVJSCore));
if (!c) return NULL;
if (!c) return NULL;
c->host = host;
c->host = host;
@@ -262,15 +269,23 @@ OVJSCore *ovjs_create(const OVJSHost *host, int isServerRealm, const char *mode)
@@ -262,15 +269,23 @@ OVJSCore *ovjs_create(const OVJSHost *host, int isServerRealm, const char *mode)
c->rt = JS_NewRuntime();
c->rt = JS_NewRuntime();
if (!c->rt) { free(c); return NULL; }
if (!c->rt) { free(c); return NULL; }
JS_SetMemoryLimit(c->rt, 32 * 1024 * 1024);
JS_SetMemoryLimit(c->rt, 32 * 1024 * 1024);
- JS_SetMaxStackSize(c->rt, 1024 * 1024);
+ /* Keep well under the OS thread stack (Windows main thread ~1MB): if the JS
+ * recursion limit exceeds the real C stack, deep calls overflow and crash
+ * the process instead of raising a catchable JS error. */
+ JS_SetMaxStackSize(c->rt, 256 * 1024);
+ OVJS_Trace(host, "core: runtime created");
c->ctx = JS_NewContext(c->rt);
c->ctx = JS_NewContext(c->rt);
if (!c->ctx) { JS_FreeRuntime(c->rt); free(c); return NULL; }
if (!c->ctx) { JS_FreeRuntime(c->rt); free(c); return NULL; }
JS_SetContextOpaque(c->ctx, c);
JS_SetContextOpaque(c->ctx, c);
+ OVJS_Trace(host, "core: context created");
OVJS_RegisterBindings(c);
OVJS_RegisterBindings(c);
- if (!OVJS_LoadCoreFiles(c)) { ovjs_destroy(c); return NULL; }
+ OVJS_Trace(host, "core: bindings registered");
+ if (!OVJS_LoadCoreFiles(c)) { OVJS_Trace(host, "core: LoadCoreFiles FAILED"); ovjs_destroy(c); return NULL; }
+ OVJS_Trace(host, "core: core files loaded");
OVJS_LoadGamemode(c);
OVJS_LoadGamemode(c);
+ OVJS_Trace(host, "core: gamemode loaded — create done");
return c;
return c;
}
}
@@ -26,6 +26,14 @@ if [ "${1:-}" != "" ] && [ "${2:-}" != "" ]; then
@@ -26,6 +26,14 @@ if [ "${1:-}" != "" ] && [ "${2:-}" != "" ]; then
CONNECT_ARGS="+connect $1:$2"
CONNECT_ARGS="+connect $1:$2"
fi
fi
+# Load straight into a local listen-server world (bypasses the dedicated-server
+# travel/token flow) for reliable local testing and crash reproduction:
+# OPENVIBE_STARTUP_MAP=ov_hub tools/run-client-proton-x64.sh
+STARTUP_MAP_ARGS=""
+if [ -n "${OPENVIBE_STARTUP_MAP:-}" ]; then
+ STARTUP_MAP_ARGS="+map ${OPENVIBE_STARTUP_MAP}"
+fi
+
echo "Launching OpenVibe: Source via Proton..."
echo "Launching OpenVibe: Source via Proton..."
echo " Game: $GAME_DIR"
echo " Game: $GAME_DIR"
echo " Proton: $GE_PROTON"
echo " Proton: $GE_PROTON"
@@ -67,4 +75,4 @@ exec "$GE_PROTON/proton" waitforexitandrun \
@@ -67,4 +75,4 @@ exec "$GE_PROTON/proton" waitforexitandrun \
+exec openvibe_proton_stability.cfg \
+exec openvibe_proton_stability.cfg \
+con_logfile openvibe_proton_console.log \
+con_logfile openvibe_proton_console.log \
+exec openvibe_proton_client.cfg \
+exec openvibe_proton_client.cfg \
- $CONNECT_ARGS
+ $CONNECT_ARGS $STARTUP_MAP_ARGS