Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 9ef845a

Browse files
committed
winwtricks autocomplete, optimize game speed
1 parent fa91817 commit 9ef845a

11 files changed

Lines changed: 190 additions & 24 deletions

File tree

src/src/components/Patches/ItemPatch.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@
2121
</tr>
2222
<tr>
2323
<td>{{ $t('labels.arch') }}</td>
24-
<td><span>{{getArch()}}</span></td>
24+
<td>
25+
<span>{{getArch()}}</span>
26+
<span v-if="patch.arch !== wine.status.arch" class="m-l-10 label label-danger">
27+
{{ $t('labels.incompatible') }}
28+
</span>
29+
</td>
2530
</tr>
2631
<tr>
2732
<td>{{ $t('labels.folder') }}</td>
@@ -65,6 +70,11 @@
6570
props: {
6671
patch: Object,
6772
},
73+
data() {
74+
return {
75+
wine: this.$store.state.wine,
76+
};
77+
},
6878
methods: {
6979
getArch() {
7080
return Collects.arch[this.patch.arch];

src/src/components/UI/InputAutocomplete.vue

Lines changed: 126 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
<template>
2-
<div class="btn-group pull-left">
3-
<input ref="input" type="text" :id="id" class="form-control" v-model="input" autocomplete="off"
2+
<div class="btn-group input-group pull-left">
3+
<input ref="input" type="text" class="form-control" v-model="input" autocomplete="off"
44
@keydown.down="keyDown" @keydown.up="keyUp" @keydown.enter="keyEnter" @blur="blur">
55

6-
<ul v-if="isItems" class="dropdown-menu drop-menu-right show" @mouseenter="focusIn" @mouseleave="focusOut">
7-
<li v-for="(title, i) in items" :class="{active: i === index}" :key="i">
8-
<a @click="onClick(i)" onclick="return false">{{title}}</a>
9-
</li>
10-
</ul>
6+
<label v-if="all" class="btn btn-default button" @click="getAll">
7+
<span class="buttonText">...</span>
8+
</label>
9+
10+
<div class="dropdown-items show" :class="{hidden: !isItems}">
11+
<div :id="id" class="ul" @mouseenter="focusIn" @mouseleave="focusOut">
12+
<div class="li" v-for="(item, i) in items" :class="{active: i === index}" :key="i">
13+
<a @click="onClick(i)" onclick="return false" :title="item.description">
14+
{{item.name}} <br><small>{{item.description}}</small>
15+
</a>
16+
</div>
17+
</div>
18+
</div>
1119
</div>
1220
</template>
1321

@@ -17,9 +25,11 @@
1725
export default {
1826
components: {},
1927
props: {
20-
value: String,
21-
fetch: Function,
22-
timeout: Number,
28+
value: String,
29+
fetch: Function,
30+
fetchAll: Function,
31+
timeout: Number,
32+
all: Boolean,
2333
},
2434
name: 'InputAutocomplete',
2535
data() {
@@ -38,16 +48,45 @@
3848
if (this.fetch && this.input && this.input.trim()) {
3949
this.fetch(this.input).then((items) => {
4050
if (items && items.length > 0) {
41-
this.$set(this, 'items', _.chunk(_.uniq([this.input].concat(items)), 7)[0]);
51+
this.$set(this, 'items', _.chunk(_.uniq([{
52+
name: this.input,
53+
description: ''
54+
}].concat(items)), 5)[0]);
4255
}
4356
});
4457
}
45-
}, this.timeout || 100),
58+
}, this.timeout || 300),
4659
};
4760
},
4861
mounted() {
4962
},
5063
methods: {
64+
bindScroll() {
65+
$(`#${this.id}`).slimScroll({
66+
height: '233px',
67+
position: 'right',
68+
size: "5px",
69+
color: '#98a6ad',
70+
wheelStep: 3,
71+
});
72+
},
73+
unbindScroll() {
74+
let scroll = $(`#${this.id}`);
75+
scroll.slimScroll({ destroy: true });
76+
scroll[0].style.height = 'auto';
77+
},
78+
getAll() {
79+
if (this.fetchAll) {
80+
this.$refs.input.focus();
81+
this.$set(this, 'index', 0);
82+
this.$set(this, 'dropMenuFocus', false);
83+
this.$set(this, 'items', [this.$t('labels.loading')]);
84+
this.$nextTick(() => this.bindScroll());
85+
this.fetchAll().then((items) => {
86+
this.$set(this, 'items', items);
87+
});
88+
}
89+
},
5190
keyEnter() {
5291
this.entered = true;
5392
@@ -72,6 +111,7 @@
72111
event.preventDefault();
73112
},
74113
onClick(index) {
114+
this.unbindScroll();
75115
this.entered = true;
76116
this.setFromIndex(index);
77117
},
@@ -93,7 +133,7 @@
93133
},
94134
setFromIndex(index = null) {
95135
if (null !== index) {
96-
this.$set(this, 'input', this.items[index]);
136+
this.$set(this, 'input', this.items[index].name);
97137
}
98138
this.reset();
99139
},
@@ -119,6 +159,7 @@
119159
this.$emit('update:value', value);
120160
this.reset();
121161
this.fetchDebounce();
162+
this.unbindScroll();
122163
},
123164
value(value) {
124165
this.$set(this, 'input', value);
@@ -131,12 +172,82 @@
131172
<style lang="less" scoped>
132173
.btn-group {
133174
width: 100%;
175+
176+
input[type="text"] {
177+
display: inline-block;
178+
width: calc(100% - 45px);
179+
}
180+
}
181+
182+
.button {
183+
float: none;
184+
height: 36px;
185+
width: 45px;
186+
overflow: hidden;
187+
border-radius: 3px !important;
188+
border-top-left-radius: 0 !important;
189+
border-bottom-left-radius: 0 !important;
190+
}
191+
192+
/* Dropdown */
193+
.dropdown-items {
194+
display: block;
195+
position: absolute;
196+
width: 100%;
197+
padding: 4px 0;
198+
background-color: #5f6b77;
199+
transition: all 300ms ease;
200+
-moz-transition: all 300ms ease;
201+
-webkit-transition: all 300ms ease;
202+
-o-transition: all 300ms ease;
203+
-ms-transition: all 300ms ease;
204+
border: 0;
205+
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
206+
border-radius: 3px;
207+
top: calc(100% + 2px);
208+
z-index: 2;
134209
}
135210
136-
.dropdown-menu {
211+
.li, .li a {
212+
display: block;
137213
width: 100%;
214+
cursor: default;
215+
}
216+
217+
.dropdown-items .li a {
218+
padding: 6px 20px;
219+
color: rgba(255, 255, 255, 0.5);
220+
font-weight: 900;
221+
222+
small {
223+
font-weight: 100;
224+
}
225+
}
226+
227+
.dropdown-items .li a:hover {
228+
background-color: rgba(255, 255, 255, 0.1);
229+
color: #ffffff !important;
230+
}
231+
232+
.dropdown-items .divider {
233+
background-color: #98a6ad;
234+
}
235+
236+
.dropdown-items .active a,
237+
.dropdown-items .active a:hover,
238+
.dropdown-items .active a:focus,
239+
.dropdown-items .li a:focus,
240+
.dropdown-items .li a:hover {
241+
background-color: rgba(255, 255, 255, 0.1);
242+
color: #ffffff !important;
243+
}
244+
245+
.dropup .dropdown-items {
246+
box-shadow: 0px -1px 5px 0 rgba(0, 0, 0, 0.26);
247+
}
138248
139-
li > a {
249+
.dropdown-items .ul {
250+
.li a {
140251
white-space: nowrap;
141252
text-overflow: ellipsis;
142253
overflow: hidden;

src/src/components/UI/InputWinetricks.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<InputAutocomplete :value.sync="input" :fetch="fetch"/>
2+
<InputAutocomplete :value.sync="input" :fetch="fetch" :fetchAll="fetchAll" :all="true"/>
33
</template>
44

55
<script>
@@ -23,9 +23,12 @@
2323
methods: {
2424
fetch(q) {
2525
return window.app.getWine().winetricksAllList().then((items) => {
26-
return items.filter(name => name.includes(q));
26+
return items.filter(item => item.name.includes(q));
2727
});
28-
}
28+
},
29+
fetchAll() {
30+
return window.app.getWine().winetricksAllList();
31+
},
2932
},
3033
computed: {},
3134
watch: {

src/src/locales/en.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export default {
5353
'select': 'Select',
5454
'create': 'Create',
5555
'more': 'More',
56+
'incompatible': 'incompatible',
5657
},
5758
menu: {
5859
'games': 'Games',

src/src/locales/ru.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export default {
5353
'select': 'Выбрать',
5454
'create': 'Создать',
5555
'more': 'Ещё',
56+
'incompatible': 'несовместим',
5657
},
5758
menu: {
5859
'games': 'Игры',
@@ -269,7 +270,7 @@ export default {
269270
Автор не несет никакой ответственности за данное программное обеспечение.
270271
Продолжая использовать это программное обеспечение вы автоматически соглашаетесь с выше указанными условиями.
271272
`,
272-
'donate': 'Поддержать проект',
273+
'donate': 'Поддержать проект',
273274
},
274275
help: {
275276
html: `

src/src/modules/command.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,26 @@ export default class Command {
338338
}
339339
}
340340

341+
let driver = window.app.getDriver();
342+
343+
if (driver.getVersion().driver === 'nvidia') {
344+
let cache = this.prefix.getCacheDir() + '/GL_shader_cache';
345+
346+
if (!this.prefix.fs.exists(cache)) {
347+
this.prefix.fs.mkdir(cache);
348+
}
349+
350+
exported['__NV_PRIME_RENDER_OFFLOAD'] = 1;
351+
exported['__GLX_VENDOR_LIBRARY_NAME'] = 'nvidia';
352+
exported['__GL_SYNC_TO_VBLANK'] = 0;
353+
exported['__GL_SHADER_DISK_CACHE_PATH'] = cache;
354+
exported['__GL_SHADER_DISK_CACHE_SIZE'] = 512 * 1024 * 1024;
355+
exported['__GL_THREADED_OPTIMIZATIONS'] = 1;
356+
} else {
357+
exported['vblank_mode'] = 0;
358+
exported['mesa_glthread'] = 'true';
359+
}
360+
341361
let configExports = this.config.getConfigExports();
342362

343363
Object.keys(configExports).forEach((field) => {

src/src/modules/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@ export default class Config {
184184
app: {
185185
path: 'The Super Game',
186186
exe: 'Game.exe',
187-
arguments: '-language=russian',
187+
arguments: '',
188188
prefix_cmd: '',
189189
name: 'The Super Game: Deluxe Edition',
190-
description: 'Game description',
190+
description: '',
191191
version: '1.0.0',
192192
sort: 500,
193193
time: 0,

src/src/modules/system.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ export default class System {
7171
*/
7272
linux: null,
7373

74+
/**
75+
* @type {boolean|null}
76+
*/
77+
futex: null,
78+
7479
/**
7580
* @type {number|null}
7681
*/
@@ -335,6 +340,19 @@ export default class System {
335340
return this.values.linux;
336341
}
337342

343+
/**
344+
* @returns {boolean}
345+
*/
346+
isFutex() {
347+
if (null !== this.values.futex) {
348+
return this.values.futex;
349+
}
350+
351+
this.values.futex = Boolean(this.command.run('cat /proc/kallsyms | grep futex_wait_multiple'));
352+
353+
return this.values.futex;
354+
}
355+
338356
/**
339357
* @returns {string}
340358
*/

src/src/modules/update.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const fs = require('fs');
88

99
export default class Update {
1010

11-
version = '1.4.22';
11+
version = '1.4.23';
1212

1313
/**
1414
* @type {string}

src/src/modules/wine.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,8 @@ export default class Wine {
357357
winetricksAllList() {
358358
let log = this.prefix.getLogsDir() + `/winetricks-list-all.log`;
359359

360-
const find = () => [...this.fs.fileGetContents(log).matchAll(/^(?!=|\[| sh )(.+?) /gm)].map(n => n[1]);
360+
const find = () => [...this.fs.fileGetContents(log).matchAll(/^(?!=|\[| sh )(.+?) +(.*)/gm)]
361+
.map(n => ({name: n[1].trim(), description: n[2].trim()}));
361362

362363
if (this.fs.exists(log)) {
363364
return Promise.resolve(find());

0 commit comments

Comments
 (0)