- fixed main window flickering at start
- added environmental variables manager
- moved common styles to the basic.sass file
- added excess files deletion when game's update comes
- updated project logo
This commit is contained in:
Observer KRypt0n_ 2021-11-01 10:10:51 +02:00
parent 40e985cd97
commit 01035d7f25
No known key found for this signature in database
GPG key ID: DC5D4EC1303465DA
16 changed files with 279 additions and 28 deletions

16
.gitignore vendored
View file

@ -1,11 +1,15 @@
node_modules
dist
public/css/*
!public/css/hint.min.css
!public/css/layout.min.css
public/js
repository-pics/logo.xcf
package-lock.json
yarn.lock
wineprefix-installation.log
public/css/index.css
public/css/settings.css
public/css/analytics.css
public/css/components.css
public/js
repository-pics/logo.xcf
deletefiles.txt

View file

@ -10,7 +10,7 @@
| Game version | Launcher version | Patch version |
| :---: | :---: | :---: |
| 2.2.0 | 1.0.0 | 2.2.0 stable ✅ |
| 2.2.0 | 1.1.0 | 2.2.0 stable ✅ |
Download from [Releases](https://notabug.org/nobody/an-anime-game-launcher/releases)
@ -70,9 +70,9 @@ npm start
### ➤ To 2.0.0 release
* Add runners environmental variables manager
* <s>Add runners environmental variables manager</s> *(1.1.0)*
* <s>Add outdated files deletion when new game's update releases</s> *(1.1.0)*
* Set default wine version to download so the wine install requirement is no longer needed.
* Add outdated files deletion when new game's update releases
* Add voice packs support
* Add Patch category in settings menu with
- Always participate in patches testing

View file

@ -76,10 +76,12 @@ function createWindow ()
},
icon: path.join(__dirname, 'public', 'images', 'icons', '64x64.png'),
autoHideMenuBar: true,
resizable: false
resizable: false,
show: false
});
mainWindow.loadFile(path.join(__dirname, 'public', 'html', 'index.html'));
mainWindow.once('ready-to-show', mainWindow.show);
// open URLs in Browser instead of an pop-up in electron app.
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
@ -111,9 +113,9 @@ app.whenReady().then(() => {
mainWindow.webContents.send('change-lang', { 'lang': args.lang });
});
ipcMain.on('updateVP', (event, args) => {
/*ipcMain.on('updateVP', (event, args) => {
mainWindow.webContents.send('updateVP', { 'oldvp': args.oldvp });
});
});*/
ipcMain.on('rpc-toggle', () => mainWindow.webContents.send('rpc-toggle'));
});

View file

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

View file

@ -21,6 +21,7 @@
<div class="menu-item menu-item-active" anchor="general" i18id="GeneralSettings">General</div>
<div class="menu-item" anchor="runners" i18id="WineVersion">Wine version</div>
<div class="menu-item" anchor="dxvks" i18id="DXVK">DXVK</div>
<div class="menu-item" anchor="environment">Environment</div>
</div>
<div class="settings">
@ -90,6 +91,24 @@
<div class="list" id="dxvk-list"></div>
</div>
<div class="settings-item" id="environment">
<h2>Environmental variables</h2>
<div class="properties-list" id="env-list">
<table>
<tr>
<th>Name</th>
<th>Value</th>
</tr>
</table>
<div class="properties-list-buttons">
<button class="button" id="add">Add</button>
<button class="button" id="delete">Delete</button>
</div>
</div>
</div>
</div>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 670 KiB

After

Width:  |  Height:  |  Size: 669 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 109 KiB

View file

@ -1,6 +1,6 @@
body
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif
@import "basic"
body
padding: 32px 64px
.header

18
src/sass/basic.sass Normal file
View file

@ -0,0 +1,18 @@
body
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif
margin: 0
padding: 0
::-webkit-scrollbar
width: 10px
::-webkit-scrollbar-track
background: #f1f1f1
::-webkit-scrollbar-thumb
background: #888
border-radius: 8px
::-webkit-scrollbar-thumb:hover
background: #555

View file

@ -3,6 +3,79 @@ $light2: #eff2ff
$primary: #657ef8
$secondary: #e1e7ff
/* Editable list of properties */
.properties-list
table
width: 100%
border-spacing: 0
$cell-height: 40px
$padding-v: 4px
$padding-h: 8px
tr
height: $cell-height
cursor: pointer
&:hover
background-color: $light
td:nth-of-type(1),
th:nth-of-type(1)
width: 60%
th,
td
border-bottom: 1px solid $light
&:not(:last-child)
border-right: 1px solid $light
td
span
display: block
width: calc(100% - 2 * $padding-h)
height: calc($cell-height - 2 * $padding-h)
margin: auto
input
display: none
width: calc(100% - 2 * $padding-h)
height: calc($cell-height - 2 * $padding-h)
background-color: $light2
font-size: 15px
margin: auto
border: unset
outline: none
.selected
background-color: $light2 !important
input
display: block
span
display: none
.properties-list-buttons
width: 100%
margin-top: 16px
display: inline-flex
justify-content: flex-end
.button:not(:last-child)
margin-right: 8px
/* List of buttons */
.list-item

View file

@ -1,6 +1,5 @@
body
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif
@import "basic"
#info
position: absolute

View file

@ -1,9 +1,6 @@
body
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif
@import "basic"
margin: 0
padding: 0
body
background-color: rgb(245, 246, 251)
.menu

View file

@ -49,7 +49,7 @@ $(() => {
});
// FIXME
ipcRenderer.on('updateVP', (event: void, remotedata: any) => {
/*ipcRenderer.on('updateVP', (event: void, remotedata: any) => {
Genshinlib.getData().then(data => {
LauncherUI.initProgressBar();
@ -99,7 +99,7 @@ $(() => {
})
});
});
});
});*/
Tools.getGitTags('https://notabug.org/nobody/an-anime-game-launcher').then (tags => {
if (tags.filter(entry => semver.gt(entry.tag, launcher_version)).length > 0)
@ -237,7 +237,8 @@ $(() => {
cwd: Genshinlib.gameDir,
env: {
...process.env,
WINEPREFIX: Genshinlib.prefixDir
WINEPREFIX: Genshinlib.prefixDir,
...Genshinlib.getConfig('env')
}
}, (err: any, stdout: any, stderr: any) => {
console.log(`%c> Game closed`, 'font-size: 16px');
@ -355,6 +356,16 @@ $(() => {
}).then(() => {
fs.unlinkSync(path.join(Genshinlib.launcherDir, voicePack.name));
// If this update has excess files we should delete them
if (fs.existsSync(path.join(Genshinlib.gameDir, 'deletefiles.txt')))
{
let deleteFiles = fs.readFileSync(path.join(Genshinlib.gameDir, 'deletefiles.txt'));
deleteFiles.split(/\r\n|\r|\n/).forEach((file: string) => {
fs.unlinkSync(path.join(Genshinlib.gameDir, file.trim()));
});
}
Genshinlib.updateConfig('version', data.game.latest.version);
// Patch available

View file

@ -28,7 +28,15 @@ const config = new store ({
// Version of the game we asked about analytics last time,
// or null if user said don't ask him again
analytics: '0'
analytics: '0',
// Environement variables
env: {
DXVK_ASYNC: '1',
WINEESYNC: '1',
WINE_FULLSCREEN_FSR: '1',
WINE_FULLSCREEN_FSR_STRENGTH: '3'
}
}
});
@ -51,7 +59,7 @@ export class Genshinlib
{
public static readonly launcherDir: string = path.join(os.homedir(), '.local', 'share', 'anime-game-launcher');
public static readonly prefixDir: string = path.join(this.launcherDir, 'game');
public static readonly prefixDir: string = path.join(this.launcherDir, 'game'); // TODO: rename every game's name entry to something like below
public static readonly gameDir: string = path.join(this.prefixDir, 'drive_c', 'Program Files', Buffer.from('R2Vuc2hpbiBJbXBhY3Q=', 'base64').toString('utf-8'));
public static readonly runnersDir: string = path.join(this.launcherDir, 'runners');
public static readonly dxvksDir: string = path.join(this.launcherDir, 'dxvks');
@ -102,6 +110,11 @@ export class Genshinlib
return config.set(property, value);
}
public static deleteConfig (property: string)
{
return config.delete(property);
}
public static async getData (): Promise<any>
{
return new Promise((resolve, reject) => {

View file

@ -50,4 +50,86 @@ $(() => {
});
}
});
/**
* properties-list
*/
let propsRowSelect = (e: any) => {
let item = $(e.target);
while (!item.is('tr'))
item = item.parent();
if ($(item.children()[0]).is('td'))
{
$('.properties-list tr').removeClass('selected');
item.addClass('selected');
}
};
$('.properties-list tr').on('click', propsRowSelect);
let propsInputsOnChange = (e: any) => {
let item = $(e.target),
td = item.parent(),
td2 = td.siblings().first();
// property name
if (td.index() == 0)
{
$('.properties-list').trigger('propertyNameChanged', {
name: {
before: td.find('span').text(),
after: item.val()
},
value: td2.find('input').val()
});
}
// property value
else
{
$('.properties-list').trigger('propertyValueChanged', {
name: td2.find('input').val(),
value: {
before: td.find('span').text(),
after: item.val()
}
});
}
// @ts-expect-error
td.find('span').text(item.val());
};
$('.properties-list input').on('change', propsInputsOnChange);
$('.properties-list .button#add').on('click', (e) => {
let newRow = $(`<tr>
<td>
<span></span>
<input>
</td>
<td>
<span></span>
<input>
</td>
</tr>`);
newRow.on('click', propsRowSelect);
newRow.find('input').on('change', propsInputsOnChange);
newRow.appendTo($(e.target).parent().parent().find('table'));
});
$('.properties-list .button#delete').on('click', (e) => {
$('.properties-list tr.selected').each((i, el) => {
$('.properties-list').trigger('propertyDeleted', {
name: $(el).find('input').first().val()
});
$(el).remove();
});
});
});

View file

@ -72,6 +72,39 @@ $(() => {
else console.log('VP can\' be changed to the already set language');
});*/
$('#env-list').on('propertyNameChanged', (e, data) => {
if (data.value != '')
Genshinlib.updateConfig(`env.${data.name.after}`, data.value);
if (data.name.before != '')
Genshinlib.deleteConfig(`env.${data.name.before}`);
});
$('#env-list').on('propertyValueChanged', (e, data) => {
if (data.name != '')
Genshinlib.updateConfig(`env.${data.name}`, data.value.after);
});
$('#env-list').on('propertyDeleted', (e, data) => {
if (data.name != '')
Genshinlib.deleteConfig(`env.${data.name}`);
});
let env = Genshinlib.getConfig('env');
Object.keys(env).forEach((property: string) => {
$('#env-list .button#add')[0]!.click();
let value = env[property];
let td = $('#env-list tr').last().children();
td.first().find('input').val(property);
td.first().find('span').text(property);
td.last().find('input').val(value);
td.last().find('span').text(value);
});
let activeRunner = Genshinlib.getConfig('runner');
Genshinlib.getRunners().then(runners => {