This commit is contained in:
SpikeHD
2022-09-04 14:20:36 -07:00
parent 1c27ae172e
commit 484cd36565
3 changed files with 25 additions and 14 deletions

View File

@@ -113,18 +113,24 @@ export default class ServerLaunchSection extends React.Component<IProps, IState>
const gameVersion = await getGameVersion()
console.log(gameVersion)
if(gameVersion == null) {
alert('Game version could not be determined. Please make sure you have the game correctly selected and try again.')
if (gameVersion == null) {
alert(
'Game version could not be determined. Please make sure you have the game correctly selected and try again.'
)
return
}
if(gameVersion?.major == 2 && gameVersion?.minor < 8) {
alert('Game version is too old for metadata patching. Please disable metadata patching in the settings and try again.')
if (gameVersion?.major == 2 && gameVersion?.minor < 8) {
alert(
'Game version is too old for metadata patching. Please disable metadata patching in the settings and try again.'
)
return
}
if(gameVersion?.major == 3 && gameVersion?.minor >= 1) {
alert('Game version is too new for metadata patching. Please disable metadata patching in the settings to launch the game.\nNOTE: You will require a UA patch to play the game.')
if (gameVersion?.major == 3 && gameVersion?.minor >= 1) {
alert(
'Game version is too new for metadata patching. Please disable metadata patching in the settings to launch the game.\nNOTE: You will require a UA patch to play the game.'
)
return
}

View File

@@ -38,22 +38,24 @@ export async function getGameDataFolder() {
}
export async function getGameVersion() {
const GameData = await getGameDataFolder();
const GameData = await getGameDataFolder()
if (!GameData) {
return null
}
const settings = JSON.parse(await invoke('read_file', {
path: GameData + '\\StreamingAssets\\asb_settings.json',
}))
const settings = JSON.parse(
await invoke('read_file', {
path: GameData + '\\StreamingAssets\\asb_settings.json',
})
)
const versionRaw = settings.variance.split('.');
const versionRaw = settings.variance.split('.')
const version = {
major: parseInt(versionRaw[0]),
minor: parseInt(versionRaw[1].split('_')[0]),
release: parseInt(versionRaw[1].split('_')[1]),
}
return version;
return version
}