Change DXVK format

This commit is contained in:
Maroxy 2021-12-22 00:07:38 +01:00
parent fe3cff78ad
commit d2c46c95bf
No known key found for this signature in database
GPG key ID: F4B27EADB21E3021
4 changed files with 76 additions and 68 deletions

View file

@ -1,57 +1,37 @@
[
{
"version": "1.9.2",
"uri": "https://github.com/doitsujin/dxvk/releases/download/v1.9.2/dxvk-1.9.2.tar.gz",
"recommended": true
},
{
"version": "1.9.1",
"uri": "https://github.com/doitsujin/dxvk/releases/download/v1.9.1/dxvk-1.9.1.tar.gz",
"recommended": true
},
{
"version": "1.9",
"uri": "https://github.com/doitsujin/dxvk/releases/download/v1.9/dxvk-1.9.tar.gz",
"recommended": true
},
{
"version": "1.8.1",
"uri": "https://github.com/doitsujin/dxvk/releases/download/v1.8.1/dxvk-1.8.1.tar.gz",
"recommended": true
},
{
"version": "1.8",
"uri": "https://github.com/doitsujin/dxvk/releases/download/v1.8/dxvk-1.8.tar.gz",
"recommended": true
},
{
"version": "1.7.3",
"uri": "https://github.com/doitsujin/dxvk/releases/download/v1.7.3/dxvk-1.7.3.tar.gz",
"recommended": false
},
{
"version": "1.7.2",
"uri": "https://github.com/doitsujin/dxvk/releases/download/v1.7.2/dxvk-1.7.2.tar.gz",
"recommended": false
},
{
"version": "1.7.1",
"uri": "https://github.com/doitsujin/dxvk/releases/download/v1.7.1/dxvk-1.7.1.tar.gz",
"recommended": false
},
{
"version": "1.7",
"uri": "https://github.com/doitsujin/dxvk/releases/download/v1.7/dxvk-1.7.tar.gz",
"recommended": false
},
{
"version": "1.6.1",
"uri": "https://github.com/doitsujin/dxvk/releases/download/v1.6.1/dxvk-1.6.1.tar.gz",
"recommended": false
},
{
"version": "1.6",
"uri": "https://github.com/doitsujin/dxvk/releases/download/v1.6/dxvk-1.6.tar.gz",
"recommended": false
"title": "DXVK",
"versions": [
{
"version": "1.9.2",
"title": "DXVK 1.9.2",
"uri": "https://github.com/doitsujin/dxvk/releases/download/v1.9.2/dxvk-1.9.2.tar.gz",
"recommended": true
},
{
"version": "1.9.1",
"title": "DXVK 1.9.1",
"uri": "https://github.com/doitsujin/dxvk/releases/download/v1.9.1/dxvk-1.9.1.tar.gz",
"recommended": true
},
{
"version": "1.9",
"title": "DXVK 1.9",
"uri": "https://github.com/doitsujin/dxvk/releases/download/v1.9/dxvk-1.9.tar.gz",
"recommended": true
},
{
"version": "1.8.1",
"title": "DXVK 1.8.1",
"uri": "https://github.com/doitsujin/dxvk/releases/download/v1.8.1/dxvk-1.8.1.tar.gz",
"recommended": true
},
{
"version": "1.8",
"title": "DXVK 1.8",
"uri": "https://github.com/doitsujin/dxvk/releases/download/v1.8/dxvk-1.8.tar.gz",
"recommended": true
}
]
}
]

View file

@ -35,6 +35,14 @@ const app = Vue.createApp({
stream.unpackFinish(() => console.log('Unpacking finished'));
});*/
/*dxvk.download('1.9.2').then((stream) => {
stream.downloadStart(() => console.log('Downloading started'));
stream.downloadFinish(() => console.log('Downloading finished'));
stream.unpackStart(() => console.log('Unpacking started'));
stream.unpackFinish(() => console.log('Unpacking finished'));
});*/
/*Archive.unpack('Audio_English(US)_2.3.0.zip', 'tmp').then((stream) => {
stream.progress((current, total) => {
console.log(`${Math.round(current / total * 100)}%`);

View file

@ -1,4 +1,7 @@
import type { DXVK as TDXVK } from './types/DXVK';
import type {
DXVKTable,
DXVK as TDXVK
} from './types/DXVK';
import Constants from './Constants';
import AbstractInstaller from './AbstractInstaller';
@ -18,27 +21,36 @@ export default class DXVK
/**
* Get DXVKs list
*/
public static get(): Promise<TDXVK[]>
public static get(): Promise<DXVKTable[]>
{
return new Promise((resolve) => {
Constants.paths.dxvks.then(async (dxvksDir: string) => {
let list: TDXVK[] = JSON.parse(await Neutralino.filesystem.readFile(`${Constants.paths.app}/public/dxvks.json`));
let list: DXVKTable[] = JSON.parse(await Neutralino.filesystem.readFile(`${Constants.paths.app}/public/newdxvks.json`));
const installed: { entry: string, type: string }[] = await Neutralino.filesystem.readDirectory(dxvksDir);
let dxvks: TDXVK[] = [];
let dxvks: DXVKTable[] = [];
list.forEach((dxvk) => {
let inst = false;
list.forEach((family) => {
let newFamily: DXVKTable = {
title: family.title,
versions: []
};
for (let dir of installed)
inst ||= dir.entry == `dxvk-${dxvk.version}`;
family.versions.forEach((dxvk) => {
let inst = false;
dxvks.push({
...dxvk,
for (let dir of installed)
inst ||= dir.entry == `dxvk-${dxvk.version}`;
installed: inst
newFamily.versions.push({
...dxvk,
installed: inst
});
});
dxvks.push(newFamily);
});
resolve(dxvks);
@ -61,9 +73,11 @@ export default class DXVK
{
let foundDXVK = null;
(await this.get()).forEach((currDxvk) => {
if (currDxvk.version == dxvk)
foundDXVK = currDxvk;
(await this.get()).forEach((family) => {
family.versions.forEach((DXVK) => {
if (DXVK.version == dxvk)
foundDXVK = DXVK;
});
});
resolve(foundDXVK === null ? null : new Stream(foundDXVK));

View file

@ -1,8 +1,14 @@
type DXVK = {
title: string;
version: string;
uri: string;
recommended: boolean;
installed: boolean;
};
export type { DXVK };
type DXVKTable = {
title: string;
versions: DXVK[];
};
export type { DXVKTable, DXVK };