Relaunch on game crash, log udon exceptions

This commit is contained in:
Natsumi
2023-03-23 02:26:12 +13:00
parent 2060e0e3de
commit 11f1f8063e
6 changed files with 194 additions and 77 deletions

View File

@@ -5026,6 +5026,7 @@ speechSynthesis.getVoices();
API.currentUser.$online_for = '';
API.currentUser.$offline_for = Date.now();
this.autoVRChatCacheManagement();
this.checkIfGameCrashed();
this.ipcTimeout = 0;
}
this.lastLocationReset();
@@ -9197,7 +9198,8 @@ speechSynthesis.getVoices();
if (
this.debugGameLog &&
gameLog.type !== 'photon-id' &&
gameLog.type !== 'api-request'
gameLog.type !== 'api-request' &&
gameLog.type !== 'udon-exception'
) {
console.log('gameLog:', gameLog);
}
@@ -9525,6 +9527,15 @@ speechSynthesis.getVoices();
this.isGameNoVR = true;
configRepository.setBool('isGameNoVR', this.isGameNoVR);
break;
case 'udon-exception':
console.log('UdonException', gameLog.data);
// var entry = {
// created_at: gameLog.dt,
// type: 'Event',
// data: gameLog.data
// };
// database.addGamelogEventToDatabase(entry);
break;
}
if (entry) {
this.queueGameLogNoty(entry);
@@ -13060,6 +13071,9 @@ speechSynthesis.getVoices();
$app.data.autoSweepVRChatCache = configRepository.getBool(
'VRCX_autoSweepVRChatCache'
);
$app.data.relaunchVRChatAfterCrash = configRepository.getBool(
'VRCX_relaunchVRChatAfterCrash'
);
$app.data.vrcQuitFix = configRepository.getBool('VRCX_vrcQuitFix');
$app.data.vrBackgroundEnabled = configRepository.getBool(
'VRCX_vrBackgroundEnabled'
@@ -13180,6 +13194,10 @@ speechSynthesis.getVoices();
'VRCX_autoSweepVRChatCache',
this.autoSweepVRChatCache
);
configRepository.setBool(
'VRCX_relaunchVRChatAfterCrash',
this.relaunchVRChatAfterCrash
);
configRepository.setBool('VRCX_vrcQuitFix', this.vrcQuitFix);
configRepository.setBool(
'VRCX_vrBackgroundEnabled',
@@ -17738,9 +17756,29 @@ speechSynthesis.getVoices();
args.push('--no-vr');
}
if (vrcLaunchPathOverride) {
AppApi.StartGameFromPath(vrcLaunchPathOverride, args.join(' '));
AppApi.StartGameFromPath(
vrcLaunchPathOverride,
args.join(' ')
).then((result) => {
if (!result) {
this.$message({
message:
'Failed to launch VRChat, invalid custom path set',
type: 'error'
});
} else {
this.$message({
message: 'VRChat launched',
type: 'success'
});
}
});
} else {
AppApi.StartGame(args.join(' '));
this.$message({
message: 'VRChat launched',
type: 'success'
});
}
D.visible = false;
};
@@ -20689,6 +20727,28 @@ speechSynthesis.getVoices();
}
};
$app.methods.checkIfGameCrashed = function () {
if (!this.relaunchVRChatAfterCrash) {
return;
}
var lastLocation = this.lastLocation.location;
AppApi.VrcClosedGracefully().then((result) => {
console.log(result, lastLocation);
if (result || !this.isRealInstance(lastLocation)) {
return;
}
var entry = {
created_at: new Date().toJSON(),
type: 'Event',
data: 'VRChat crashed, attempting to rejoin last instance'
};
database.addGamelogEventToDatabase(entry);
this.queueGameLogNoty(entry);
this.addGameLog(entry);
this.launchGame(lastLocation);
});
};
$app.data.VRChatUsedCacheSize = '';
$app.data.VRChatTotalCacheSize = '';
$app.data.VRChatCacheSizeLoading = false;