2021-12-22 01:28:58 +03:00
|
|
|
import Configs from './Configs';
|
|
|
|
|
2021-12-21 22:41:26 +03:00
|
|
|
declare const Neutralino;
|
2021-12-28 14:27:29 +03:00
|
|
|
declare const NL_CWD;
|
2021-12-21 22:41:26 +03:00
|
|
|
|
2021-12-22 01:28:58 +03:00
|
|
|
class Prefix
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Current prefix directory
|
|
|
|
*
|
|
|
|
* @default "~/.local/share/anime-game-launcher/game"
|
|
|
|
*/
|
|
|
|
public static get current(): Promise<string>
|
|
|
|
{
|
|
|
|
return new Promise(async (resolve) => resolve(await Configs.get('prefix') as string));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Default prefix directory
|
|
|
|
*
|
|
|
|
* @default "~/.local/share/anime-game-launcher/game"
|
|
|
|
*/
|
|
|
|
public static get default(): Promise<string>
|
|
|
|
{
|
|
|
|
return new Promise(async (resolve) => resolve(`${await Paths.launcherDir}/game`));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Change prefix directory
|
|
|
|
*
|
2021-12-27 17:36:54 +03:00
|
|
|
* @returns promise that indicates that the prefix path has been changed in config
|
2021-12-22 01:28:58 +03:00
|
|
|
*/
|
|
|
|
public static set(location: string): Promise<void>
|
|
|
|
{
|
|
|
|
return Configs.set('prefix', location);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-21 19:58:33 +03:00
|
|
|
class Paths
|
2021-12-21 00:39:20 +03:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Directory where the launcher's executable stored
|
|
|
|
*/
|
2021-12-28 14:27:29 +03:00
|
|
|
public static readonly appDir: string = NL_CWD;
|
2021-12-21 00:39:20 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Shaders directory
|
|
|
|
*
|
2021-12-22 01:28:58 +03:00
|
|
|
* @default "[constants.paths.app]/public/shaders"
|
2021-12-21 00:39:20 +03:00
|
|
|
*/
|
2021-12-22 01:28:58 +03:00
|
|
|
public static readonly shadersDir: string = `${this.appDir}/public/shaders`;
|
2021-12-21 00:39:20 +03:00
|
|
|
|
2021-12-25 17:09:46 +03:00
|
|
|
/**
|
|
|
|
* Locales directory
|
|
|
|
*
|
|
|
|
* @default "[constants.paths.app]/public/locales"
|
|
|
|
*/
|
|
|
|
public static readonly localesDir: string = `${this.appDir}/public/locales`;
|
|
|
|
|
2021-12-21 00:39:20 +03:00
|
|
|
/**
|
|
|
|
* Launcher data directory
|
|
|
|
*
|
2021-12-22 01:28:58 +03:00
|
|
|
* @default "~/.local/share/anime-game-launcher"
|
2021-12-21 00:39:20 +03:00
|
|
|
*/
|
2021-12-22 01:28:58 +03:00
|
|
|
public static get launcherDir(): Promise<string>
|
2021-12-21 00:39:20 +03:00
|
|
|
{
|
|
|
|
return new Promise(async (resolve) => resolve(`${await Neutralino.os.getPath('data')}/anime-game-launcher`));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Runners directory
|
|
|
|
*
|
2021-12-22 01:28:58 +03:00
|
|
|
* @default "~/.local/share/anime-game-launcher/runners"
|
2021-12-21 00:39:20 +03:00
|
|
|
*/
|
2021-12-22 01:28:58 +03:00
|
|
|
public static get runnersDir(): Promise<string>
|
2021-12-21 00:39:20 +03:00
|
|
|
{
|
2021-12-22 01:28:58 +03:00
|
|
|
return new Promise(async (resolve) => resolve(`${await this.launcherDir}/runners`));
|
2021-12-21 00:39:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DXVKs directory
|
|
|
|
*
|
2021-12-22 01:28:58 +03:00
|
|
|
* @default "~/.local/share/anime-game-launcher/dxvks"
|
2021-12-21 00:39:20 +03:00
|
|
|
*/
|
2021-12-22 01:28:58 +03:00
|
|
|
public static get dxvksDir(): Promise<string>
|
2021-12-21 00:39:20 +03:00
|
|
|
{
|
2021-12-22 01:28:58 +03:00
|
|
|
return new Promise(async (resolve) => resolve(`${await this.launcherDir}/dxvks`));
|
2021-12-21 00:39:20 +03:00
|
|
|
}
|
2021-11-28 22:11:06 +03:00
|
|
|
|
2021-12-21 19:58:33 +03:00
|
|
|
/**
|
|
|
|
* Config file
|
|
|
|
*
|
2021-12-24 15:23:45 +03:00
|
|
|
* @default "~/.local/share/anime-game-launcher/config.yaml"
|
2021-12-21 19:58:33 +03:00
|
|
|
*/
|
|
|
|
public static get config(): Promise<string>
|
|
|
|
{
|
2021-12-24 15:23:45 +03:00
|
|
|
return new Promise(async (resolve) => resolve(`${await this.launcherDir}/config.yaml`));
|
2021-12-21 19:58:33 +03:00
|
|
|
}
|
|
|
|
|
2021-12-23 17:07:35 +03:00
|
|
|
/**
|
|
|
|
* Cache file
|
|
|
|
*
|
|
|
|
* @default "~/.local/share/anime-game-launcher/cache.json"
|
|
|
|
*/
|
|
|
|
public static get cache(): Promise<string>
|
|
|
|
{
|
|
|
|
return new Promise(async (resolve) => resolve(`${await this.launcherDir}/cache.json`));
|
|
|
|
}
|
|
|
|
|
2021-12-22 01:28:58 +03:00
|
|
|
public static readonly prefix = Prefix;
|
2021-12-21 00:39:20 +03:00
|
|
|
|
2021-12-22 01:28:58 +03:00
|
|
|
/**
|
|
|
|
* Game directory
|
|
|
|
*
|
|
|
|
* @default "~/.local/share/anime-game-launcher/game/drive_c/Program Files/[An Anime Game]"
|
|
|
|
*
|
2021-12-24 15:41:17 +03:00
|
|
|
* @returns "[constants.paths.prefix.current]/drive_c/Program Files/[An Anime Game]"
|
2021-12-22 01:28:58 +03:00
|
|
|
*/
|
|
|
|
public static get gameDir(): Promise<string>
|
|
|
|
{
|
|
|
|
return new Promise(async (resolve) => resolve(`${await this.prefix.current}/drive_c/Program Files/${constants.placeholders.uppercase.full}`));
|
|
|
|
}
|
2021-12-21 00:39:20 +03:00
|
|
|
|
2021-12-22 01:28:58 +03:00
|
|
|
/**
|
|
|
|
* Game data directory
|
|
|
|
*
|
|
|
|
* @default "~/.local/share/anime-game-launcher/game/drive_c/Program Files/[An Anime Game]/[An Anime Game]_Data"
|
|
|
|
*
|
|
|
|
* @returns "[constants.paths.gameDir]/[An Anime Game]_Data"
|
|
|
|
*/
|
|
|
|
public static get gameDataDir(): Promise<string>
|
|
|
|
{
|
|
|
|
return new Promise(async (resolve) => resolve(`${await this.gameDir}/${constants.placeholders.uppercase.first + constants.placeholders.uppercase.second}_Data`));
|
|
|
|
}
|
2021-12-21 00:39:20 +03:00
|
|
|
|
2021-12-22 01:28:58 +03:00
|
|
|
/**
|
|
|
|
* Game voice data directory
|
|
|
|
*
|
|
|
|
* @default "~/.local/share/anime-game-launcher/game/drive_c/Program Files/[An Anime Game]/[An Anime Game]_Data/StreamingAssets/Audio/GeneratedSoundBanks/Windows"
|
|
|
|
*
|
|
|
|
* @returns "[constants.paths.gameDataDir]/StreamingAssets/Audio/GeneratedSoundBanks/Windows"
|
|
|
|
*/
|
|
|
|
public static get voiceDir(): Promise<string>
|
|
|
|
{
|
|
|
|
return new Promise(async (resolve) => resolve(`${await this.gameDataDir}/StreamingAssets/Audio/GeneratedSoundBanks/Windows`));
|
|
|
|
}
|
2021-12-21 00:39:20 +03:00
|
|
|
}
|
2021-11-01 13:46:10 +03:00
|
|
|
|
2021-11-16 21:20:24 +03:00
|
|
|
export default class constants
|
2021-11-01 13:46:10 +03:00
|
|
|
{
|
2021-11-01 15:50:48 +03:00
|
|
|
public static readonly placeholders = {
|
2021-11-01 14:01:28 +03:00
|
|
|
uppercase:
|
|
|
|
{
|
2021-12-22 01:28:58 +03:00
|
|
|
first: atob('R2Vuc2hpbg=='),
|
|
|
|
second: atob('SW1wYWN0'),
|
|
|
|
full: atob('R2Vuc2hpbiBJbXBhY3Q='),
|
|
|
|
company: atob('bWlIb1lv')
|
2021-11-01 14:01:28 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
lowercase:
|
|
|
|
{
|
2021-12-22 01:28:58 +03:00
|
|
|
first: atob('Z2Vuc2hpbg=='),
|
|
|
|
company: atob('bWlob3lv')
|
2021-11-01 14:01:28 +03:00
|
|
|
}
|
2021-11-01 13:46:10 +03:00
|
|
|
};
|
|
|
|
|
2021-11-01 15:50:48 +03:00
|
|
|
public static readonly uri = {
|
|
|
|
api: `https://sdk-os-static.${this.placeholders.lowercase.company}.com/hk4e_global/mdk/launcher/api`,
|
2021-12-07 13:48:04 +03:00
|
|
|
patch: {
|
|
|
|
origin: 'https://notabug.org/Krock/dawn',
|
|
|
|
additional: 'https://dev.kaifa.ch/Maroxy/dawn'
|
|
|
|
},
|
2021-11-27 20:49:36 +03:00
|
|
|
launcher: 'https://gitlab.com/KRypt0n_/an-anime-game-launcher',
|
2021-11-01 15:50:48 +03:00
|
|
|
telemetry: [
|
|
|
|
`log-upload-os.${this.placeholders.lowercase.company}.com`,
|
|
|
|
'overseauspider.yuanshen.com'
|
2021-11-25 22:40:54 +03:00
|
|
|
],
|
|
|
|
winetricks: 'https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks'
|
2021-11-01 15:50:48 +03:00
|
|
|
};
|
|
|
|
|
2021-11-24 18:14:41 +03:00
|
|
|
// TODO: cache drops at that dates instead of the 7 days period
|
|
|
|
/*public static readonly cacheDropDates = [
|
|
|
|
new Date('November 24, 2021').getTime(), // 2.3.0 half 1 release
|
|
|
|
new Date('December 15, 2021').getTime(), // 2.3.0 half 2 release
|
|
|
|
new Date('January 5, 2022').getTime() // 2.4.0 half 1 release
|
|
|
|
];*/
|
|
|
|
|
2021-12-21 19:58:33 +03:00
|
|
|
public static readonly paths = Paths;
|
2021-11-01 13:46:10 +03:00
|
|
|
|
2021-11-01 15:50:48 +03:00
|
|
|
public static readonly versionsUri: string = `${this.uri.api}/resource?key=gcStgarh&launcher_id=10`;
|
2021-11-25 17:48:29 +03:00
|
|
|
public static readonly backgroundUri: string = `${this.uri.api}/content?filter_adv=true&launcher_id=10&key=gcStgarh&language=`;
|
2021-11-01 13:46:10 +03:00
|
|
|
|
2021-12-24 22:05:58 +03:00
|
|
|
/**
|
|
|
|
* Get a URI to the specified patch repository archive
|
|
|
|
*/
|
2021-12-15 17:35:01 +03:00
|
|
|
public static getPatchUri(source: 'origin' | 'additional'): string
|
|
|
|
{
|
|
|
|
return `${this.uri.patch[source]}/archive/master.zip`;
|
2021-12-22 01:28:58 +03:00
|
|
|
}
|
2021-11-01 13:46:10 +03:00
|
|
|
}
|