Skip to content

Commit

Permalink
version 1.3.5
Browse files Browse the repository at this point in the history
+ install msi, bat
+ register library dll, ocx
  • Loading branch information
hitman249 committed Apr 14, 2020
1 parent 4886ea5 commit 25408c0
Show file tree
Hide file tree
Showing 12 changed files with 203 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/src/components/Patches/ItemPatch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
</div>

<div class="table-detail item-point__button-block">
<PopupPatch v-if="patch" :patch="patch.patch" ref="popup"/>
<template v-if="!patch.created">
<PopupCommand v-if="patch" :patch="patch.patch" ref="popup"/>
</template>
<PopupPatch v-if="patch" :patch="patch.patch" ref="popup"/>
<PopupRemove v-if="patch" :item="patch"/>
</div>
</div>
Expand Down
35 changes: 34 additions & 1 deletion src/src/components/Patches/PopupCommand.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@
id: action.id,
patches: this.$store.state.patches,
item: {
action: 'build',
action: 'build',
override: 'native',
patch_arch: this.patch.getPatch(),
arch: this.patch.getPatch(),
registry: true,
},
};
},
Expand Down Expand Up @@ -118,6 +122,35 @@
required: true,
relations: 'install:action',
},
'library': {
name: 'Библиотека',
description_title: '',
description: 'Библиотека будет скопирована в папку system32 или syswow64. Форматы: dll, ocx',
type: 'lib_select',
required: true,
relations: 'register:action',
},
'registry': {
name: 'Регистрация',
description_title: '',
description: 'Регистрация библиотеки через механизм regsvr32',
type: 'bool',
required: true,
relations: 'register:action',
},
'arch': {
name: 'Архитектура',
type: 'arch',
required: true,
relations: 'register:action,arch64:patch_arch',
},
'override': {
name: 'Переопределение',
description: '',
type: 'overrides',
required: true,
relations: 'register:action',
},
});
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/src/components/UI/FileSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
{
properties: ['openFile'],
filters: [
{ name: 'Windows Executable Files', extensions: ['exe', 'msi'] },
{ name: 'Windows Executable Files', extensions: ['exe', 'msi', 'bat'] },
{ name: 'All Files', extensions: ['*'] },
],
})
Expand Down
27 changes: 18 additions & 9 deletions src/src/components/UI/FormItems.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@
<OnlySelect v-else-if="has(field, 'commands')" class="m-b-0"
:selected.sync="item[key]"
:items="getCommands()"/>
<OnlySelect v-else-if="has(field, 'overrides')" class="m-b-0"
:selected.sync="item[key]"
:items="getOverrides()"/>
<OnlySelect v-else-if="has(field, 'select')" class="m-b-0"
:selected.sync="item[key]"
:items="field.items"/>
<FileSelect v-else-if="has(field, 'file_select')" :value.sync="item[key]"/>
<LibrarySelect v-else-if="has(field, 'lib_select')" :value.sync="item[key]"/>
<component v-else-if="has(field, 'component')" :is="field.component" v-bind.sync="field.props"/>
<TextField v-else-if="has(field, 'textarea')" :id="key" :value.sync="item[key]"/>
<input v-else-if="has(field, 'password')" :id="key" type="password" class="form-control"
Expand All @@ -61,15 +65,16 @@
</template>

<script>
import action from '../../store/action';
import relations from '../../helpers/relations';
import collects from "../../helpers/collects";
import OnlySelect from './OnlySelect.vue';
import TextField from './TextField.vue';
import InputView from "./InputView.vue";
import Info from "./Info";
import ButtonInfo from "./ButtonInfo";
import FileSelect from "./FileSelect";
import action from '../../store/action';
import relations from '../../helpers/relations';
import collects from "../../helpers/collects";
import OnlySelect from './OnlySelect.vue';
import TextField from './TextField.vue';
import InputView from "./InputView.vue";
import Info from "./Info";
import ButtonInfo from "./ButtonInfo";
import FileSelect from "./FileSelect";
import LibrarySelect from "./LibrarySelect";
export default {
components: {
Expand All @@ -79,6 +84,7 @@
InputView,
ButtonInfo,
FileSelect,
LibrarySelect,
},
props: {
item: Object,
Expand Down Expand Up @@ -151,6 +157,9 @@
getCommands() {
return collects.getToSelect('commands');
},
getOverrides() {
return collects.getToSelect('overrides');
},
},
computed: {
leftClass() {
Expand Down
56 changes: 56 additions & 0 deletions src/src/components/UI/LibrarySelect.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<template>
<div class="bootstrap-filestyle input-group">
<input type="text" class="form-control " placeholder="" disabled="" v-model="file" :title="file">
<span class="group-span-filestyle input-group-btn" @click="open">
<label class="btn btn-default m-b-0">
<span class="buttonText">Выбрать</span>
</label>
</span>
</div>
</template>

<script>
import _ from "lodash";
import action from "../../store/action";
export default {
name: "LibrarySelect",
props: {
value: String,
},
data() {
const { remote } = window.require('electron');
return {
id: action.id,
remote,
file: this.value ? String(this.value) : '',
};
},
mounted() {
},
methods: {
open() {
this.remote.dialog.showOpenDialog(
this.remote.getCurrentWindow(),
{
properties: ['openFile'],
filters: [
{ name: 'Windows Library Files', extensions: ['dll', 'ocx'] },
{ name: 'All Files', extensions: ['*'] },
],
})
.then((result) => {
if (false === result.canceled) {
this.file = _.head(result.filePaths);
this.$emit('update:value', String(this.file));
}
});
}
},
}
</script>

<style lang="less" scoped>
</style>
9 changes: 9 additions & 0 deletions src/src/helpers/collects.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,21 @@ export default class Collects {
static commands = {
build: 'Сохранить изменения',
install: 'Установить приложение',
register: 'Регистрация библиотеки',
winetricks: 'Выполнить команду Winetricks',
cfg: 'Запустить Wine Config',
fm: 'Запустить Wine File Manager',
regedit: 'Запустить Wine Regedit',
};

static overrides = {
'builtin': 'Встроенная (Wine)',
'native': 'Сторонняя (Windows)',
'builtin,native': 'Встроенная, затем сторонняя',
'native,builtin': 'Сторонняя, затем встроенная',
' ': 'Отключить',
};

static getVar(varName) {
return JSON.parse(JSON.stringify(Collects[varName]));
}
Expand Down
10 changes: 8 additions & 2 deletions src/src/helpers/relations.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@
*/
export default class Relations {
static relations = {
require: (value) => {
require: (value) => {
return value;
},
winetricks: (value) => {
return 'winetricks' === value;
},
install: (value) => {
install: (value) => {
return 'install' === value;
},
register: (value) => {
return 'register' === value;
},
arch64: (value) => {
return 'win64' === value;
},
};

/**
Expand Down
7 changes: 7 additions & 0 deletions src/src/modules/patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ export default class Patch {
return _.get(this.config, 'active', true);
}

/**
* @return {string}
*/
getPatch() {
return String(_.get(this.config, 'arch', 'win32'));
}

/**
* @returns {Object}
*/
Expand Down
17 changes: 17 additions & 0 deletions src/src/modules/prefix.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export default class Prefix {
wineDosDevicesDir = '/prefix/dosdevices';
dxvkConfPrefixFile = '/prefix/drive_c/dxvk.conf';
winePrefixInfoDir = '/prefix/drive_c/info';
winePrefixSystem32 = '/prefix/drive_c/windows/system32';
winePrefixSystem64 = '/prefix/drive_c/windows/syswow64';
wineLibFile = '/wine/lib/libwine.so';
buildDir = '/build';

Expand Down Expand Up @@ -344,6 +346,21 @@ export default class Prefix {
};
}

getSystem32() {
if ('win32' === this.getWineArch()) {
return this.getRootDir() + this.winePrefixSystem32;
}

return this.getRootDir() + this.winePrefixSystem64;
}

getSystem64() {
if ('win64' === this.getWineArch()) {
return this.getRootDir() + this.winePrefixSystem32;
}

return '';
}

getBinDir() {
return this.getRootDir() + this.binDir;
Expand Down
2 changes: 1 addition & 1 deletion src/src/modules/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Network from "./network";

export default class Update {

version = '1.3.4';
version = '1.3.5';

/**
* @type {Prefix}
Expand Down
11 changes: 10 additions & 1 deletion src/src/modules/wine.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ export default class Wine {

let filename = this.fs.basename(path);
let logFile = `${this.prefix.getLogsDir()}/${filename}.log`;
let postfix = '';

if (_.endsWith(filename, '.msi')) {
postfix = 'msiexec /i ';
}

if (_.endsWith(filename, '.bat')) {
postfix = 'cmd /c ';
}

if (this.fs.exists(logFile)) {
this.fs.rm(logFile);
Expand All @@ -124,7 +133,7 @@ export default class Wine {
let winePath = Utils.quote(this.prefix.getWineBin());
let cmd = Utils.quote(path);

return (new Command(prefix)).watch(`${winePath} ${cmd}`, (output) => {
return (new Command(prefix)).watch(`${winePath} ${postfix}${cmd}`, (output) => {
this.fs.filePutContents(logFile, output, this.fs.FILE_APPEND);
});
}
Expand Down
43 changes: 41 additions & 2 deletions src/src/store/patches.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default {
return dispatch(action.LOAD);
});
},
[action.RUN]({ commit, dispatch, state }, { patch, item }) {
[action.RUN]({ commit, dispatch }, { patch, item }) {
let promise = Promise.resolve();

commit(action.RUNNING, true);
Expand Down Expand Up @@ -113,6 +113,45 @@ export default {
}));
}

if ('register' === item.action) {
promise = promise.then(() => new Promise((resolve) => {
let wine = window.app.getWine();
let fs = window.app.getFileSystem();
let prefix = window.app.getPrefix();
let filename = fs.basename(item.library).toLowerCase();
let system32 = prefix.getSystem32();
let system64 = prefix.getSystem64();

if (!system64 && 'wine64' === item.arch) {
return resolve();
}

if (!fs.exists(item.library)) {
return resolve();
}

let path = `${system32}/${filename}`;

if ('wine64' === item.arch) {
path = `${system64}/${filename}`;
}

if (fs.exists(path)) {
fs.rm(path);
}

fs.cp(item.library, path);

if (item.registry) {
wine.regsvr32(filename);
}

wine.run('reg', 'add', 'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides', '/v', `*${filename}`, '/d', _.trim(item.override), '/f');

return resolve();
}));
}

promise.then(() => commit(action.RUNNING, false)).then(resolve);
}, 500);
});
Expand All @@ -138,7 +177,7 @@ export default {

return promise;
},
[action.REMOVE]({ commit, dispatch, state }, item) {
[action.REMOVE]({ commit, dispatch }, item) {
if (!item || !item.patch) {
return;
}
Expand Down

0 comments on commit 25408c0

Please sign in to comment.