- fixed `constants.patchUri` property processing;
  added `constants.getPatchUri` method which will return a URI to the patch
  based on the source you use
  It also fixes an issue with game's patch applying
- fixed an error message with unexisting `fps_config.ini` deletion
- updated launcher pictures in readme
This commit is contained in:
Observer KRypt0n_ 2021-12-15 16:35:01 +02:00
parent 4befc9faa0
commit 41792ad35b
No known key found for this signature in database
GPG key ID: DC5D4EC1303465DA
8 changed files with 29 additions and 13 deletions

View file

@ -14,7 +14,7 @@
| Game version | Launcher version | Patch version |
| :---: | :---: | :---: |
| 2.3.0 | 1.9.0 | 2.3.0 stable ✅ |
| 2.3.0 | 1.9.1 | 2.3.0 stable ✅ |
We have our own [An Anime Game](https://discord.gg/ck37X6UWBp) discord server where you can ask any questions

View file

@ -1,6 +1,6 @@
{
"name": "an-anime-game-launcher",
"version": "1.9.0",
"version": "1.9.1",
"description": "An Anime Game Linux Launcher",
"author": "Nikita Podvirnyy <suimin.tu.mu.ga.mi@gmail.com>",
"contributors": [

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 547 KiB

After

Width:  |  Height:  |  Size: 438 KiB

View file

@ -91,6 +91,12 @@ type DXVK = {
recommendable: boolean
};
type PatchInfo = {
version: string,
state: 'testing' | 'stable',
source: 'origin' | 'additional'
};
export default class LauncherLib
{
public static get version(): string|null
@ -222,7 +228,7 @@ export default class LauncherLib
* Get patch's state and version from the repository
* @returns information about the patch, or null if repository is not available
*/
public static async getPatchInfo(source: 'origin' | 'additional' = 'origin'): Promise<{ version: string, state: 'testing' | 'stable' }|null>
public static async getPatchInfo(source: 'origin' | 'additional' = 'origin'): Promise<PatchInfo|null>
{
return new Promise(resolve => {
this.getData().then(async (data) => {
@ -249,7 +255,8 @@ export default class LauncherLib
resolve({
version: gameLatest,
state: patch.body.includes('#echo "If you would like to test this patch, modify this script and remove the line below this one."') ?
'stable' : 'testing'
'stable' : 'testing',
source: source
});
})
.catch((error: Error) => {
@ -278,7 +285,8 @@ export default class LauncherLib
{
resolve({
version: data.game.diffs[0].version,
state: 'stable'
state: 'stable',
source: source
});
}
});
@ -306,7 +314,8 @@ export default class LauncherLib
{
resolve({
version: data.game.diffs[0].version,
state: 'stable'
state: 'stable',
source: source
});
}
});
@ -442,11 +451,11 @@ export default class LauncherLib
public static patchGame(onData: (data: string) => void): Promise<boolean>
{
return new Promise((resolve) => {
this.getPatchInfo().then(pathInfo => {
this.getPatchInfo().then((pathInfo) => {
if (pathInfo === null)
resolve(false);
else Tools.downloadFile(constants.patchUri, path.join(constants.launcherDir, 'patch.zip')).then(() => {
else Tools.downloadFile(constants.getPatchUri(pathInfo.source), path.join(constants.launcherDir, 'patch.zip')).then(() => {
Tools.unzip(path.join(constants.launcherDir, 'patch.zip'), constants.launcherDir).then(() => {
// Delete zip file and assign patch directory.
fs.unlinkSync(path.join(constants.launcherDir, 'patch.zip'));
@ -502,7 +511,7 @@ export default class LauncherLib
});
});
});
})
});
});
});
}

View file

@ -122,7 +122,8 @@ export default class LauncherUI
{
patchInfo = {
version: LauncherLib.getConfig('patch.version'),
state: LauncherLib.getConfig('patch.state')
state: LauncherLib.getConfig('patch.state'),
source: 'origin'
};
ipcRenderer.send('notification', {

View file

@ -55,8 +55,6 @@ export default class constants
public static readonly versionsUri: string = `${this.uri.api}/resource?key=gcStgarh&launcher_id=10`;
public static readonly backgroundUri: string = `${this.uri.api}/content?filter_adv=true&launcher_id=10&key=gcStgarh&language=`;
public static readonly patchUri: string = `${this.uri.patch}/archive/master.zip`;
public static readonly runnersUri: string = `${this.uri.launcher}/raw/main/runners.json`;
public static readonly dxvksUri: string = `${this.uri.launcher}/raw/main/dxvks.json`;
@ -99,4 +97,9 @@ export default class constants
{
return path.join(this.gameDir, `${this.placeholders.uppercase.first + this.placeholders.uppercase.second}_Data`, 'StreamingAssets', 'Audio', 'GeneratedSoundBanks', 'Windows');
}
public static getPatchUri(source: 'origin' | 'additional'): string
{
return `${this.uri.patch[source]}/archive/master.zip`;
}
}

View file

@ -348,7 +348,10 @@ $(() => {
if (LauncherLib.getConfig('fpsunlock') && !$('#fps-unlocker').hasClass('checkbox-active') && fs.existsSync(constants.fpsunlockerDir))
{
fs.rmdirSync(constants.fpsunlockerDir, { recursive: true });
fs.rmSync(path.join(constants.gameDir, 'fps_config.ini'));
fs.rmSync(path.join(constants.gameDir, 'fps_config.ini'), {
throwIfNoEntry: false
});
}
else if (!LauncherLib.getConfig('fpsunlock') && $('#fps-unlocker').hasClass('checkbox-active') && !fs.existsSync(constants.fpsunlockerDir))