mirror of
https://git.sanhost.net/sanasol/hytale-f2p.git
synced 2026-02-26 06:41:47 -03:00
MacOs build crash on game launch and server not botting
This commit is contained in:
@@ -693,8 +693,8 @@ async function launchGame(playerName = 'Player', progressCallback, javaPathOverr
|
|||||||
}
|
}
|
||||||
|
|
||||||
const configuredJava = (javaPathOverride !== undefined && javaPathOverride !== null
|
const configuredJava = (javaPathOverride !== undefined && javaPathOverride !== null
|
||||||
? javaPathOverride
|
? javaPathOverride
|
||||||
: loadJavaPath() || '').trim();
|
: loadJavaPath() || '').trim();
|
||||||
let javaBin = null;
|
let javaBin = null;
|
||||||
|
|
||||||
if (configuredJava) {
|
if (configuredJava) {
|
||||||
@@ -737,6 +737,73 @@ async function launchGame(playerName = 'Player', progressCallback, javaPathOverr
|
|||||||
throw new Error(`Game client missing. Tried: ${attempted}`);
|
throw new Error(`Game client missing. Tried: ${attempted}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// macOS: Remove quarantine and ad-hoc sign binaries to prevent SIGABRT crashes
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
try {
|
||||||
|
const appBundle = path.join(gameLatest, 'Client', 'Hytale.app');
|
||||||
|
const serverDir = path.join(gameLatest, 'Server');
|
||||||
|
|
||||||
|
// Helper to remove quarantine and sign a path
|
||||||
|
const signPath = async (targetPath, deep = false) => {
|
||||||
|
await execAsync(`xattr -cr "${targetPath}"`).catch(() => {});
|
||||||
|
const deepFlag = deep ? '--deep ' : '';
|
||||||
|
await execAsync(`codesign --force ${deepFlag}--sign - "${targetPath}"`).catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Sign app bundle or client binary
|
||||||
|
if (fs.existsSync(appBundle)) {
|
||||||
|
await signPath(appBundle, true);
|
||||||
|
console.log('Signed macOS app bundle');
|
||||||
|
} else {
|
||||||
|
await signPath(path.dirname(clientPath), true);
|
||||||
|
console.log('Signed macOS client binary');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sign Java runtime
|
||||||
|
if (javaBin && fs.existsSync(javaBin)) {
|
||||||
|
// Navigate from bin/java up to the JRE bundle root (contains Contents/)
|
||||||
|
let jreRoot = path.dirname(path.dirname(javaBin));
|
||||||
|
if (jreRoot.endsWith('Home')) {
|
||||||
|
jreRoot = path.dirname(path.dirname(jreRoot));
|
||||||
|
}
|
||||||
|
await signPath(jreRoot, true);
|
||||||
|
await signPath(javaBin, false);
|
||||||
|
console.log('Signed Java runtime');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sign server directory native libraries
|
||||||
|
if (fs.existsSync(serverDir)) {
|
||||||
|
await execAsync(`xattr -cr "${serverDir}"`).catch(() => {});
|
||||||
|
await execAsync(`find "${serverDir}" -type f -perm +111 -exec codesign --force --sign - {} \\;`).catch(() => {});
|
||||||
|
console.log('Signed server binaries');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create java wrapper script that adds --disable-sentry flag for server launches
|
||||||
|
if (javaBin && fs.existsSync(javaBin)) {
|
||||||
|
const javaWrapperPath = path.join(path.dirname(javaBin), 'java-wrapper');
|
||||||
|
const wrapperScript = `#!/bin/bash
|
||||||
|
# Java wrapper for macOS - adds --disable-sentry to fix Sentry hang issue
|
||||||
|
REAL_JAVA="${javaBin}"
|
||||||
|
ARGS=("$@")
|
||||||
|
for i in "\${!ARGS[@]}"; do
|
||||||
|
if [[ "\${ARGS[$i]}" == *"HytaleServer.jar"* ]]; then
|
||||||
|
ARGS=("\${ARGS[@]:0:$((i+1))}" "--disable-sentry" "\${ARGS[@]:$((i+1))}")
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
exec "$REAL_JAVA" "\${ARGS[@]}"
|
||||||
|
`;
|
||||||
|
fs.writeFileSync(javaWrapperPath, wrapperScript, { mode: 0o755 });
|
||||||
|
await signPath(javaWrapperPath, false);
|
||||||
|
console.log('Created java wrapper with --disable-sentry fix');
|
||||||
|
javaBin = javaWrapperPath;
|
||||||
|
}
|
||||||
|
} catch (signError) {
|
||||||
|
console.log('Notice: macOS signing step failed:', signError.message);
|
||||||
|
console.log('The game may still launch if Gatekeeper allows it');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const uuid = getUuidForUser(playerName);
|
const uuid = getUuidForUser(playerName);
|
||||||
const args = [
|
const args = [
|
||||||
'--app-dir', gameLatest,
|
'--app-dir', gameLatest,
|
||||||
|
|||||||
Reference in New Issue
Block a user