fix dll overrides & add disable UMU
This commit is contained in:
parent
5d5ca345f1
commit
8c6db38fab
12 changed files with 295 additions and 45 deletions
|
|
@ -1235,6 +1235,7 @@ async function openGameConfig(id) {
|
|||
const lockHint = qs('#gc-prefix-lock-hint')
|
||||
if (lockHint) lockHint.style.display = prefixLocked ? '' : 'none'
|
||||
renderOverrides(game.dllOverrides || [])
|
||||
qs('#gc-disable-umu').checked = !!game.disableUmu
|
||||
renderTools()
|
||||
}
|
||||
|
||||
|
|
@ -1257,10 +1258,12 @@ function renderOverrides(overrides) {
|
|||
}
|
||||
}
|
||||
|
||||
// native,builtin first: that is the default a new override row starts on
|
||||
// (load a native DLL when the game has one, fall back to Wine's builtin)
|
||||
const OVERRIDE_OPTIONS = [
|
||||
{ value: 'native,builtin', label: 'native,builtin' },
|
||||
{ value: 'native', label: 'native' },
|
||||
{ value: 'builtin', label: 'builtin' },
|
||||
{ value: 'native,builtin', label: 'native,builtin' },
|
||||
{ value: 'builtin,native', label: 'builtin,native' },
|
||||
{ value: '', label: 'disabled' }
|
||||
]
|
||||
|
|
@ -1274,23 +1277,48 @@ function buildOverrideRow(o) {
|
|||
`
|
||||
row.querySelector('.dll').value = o.dll || ''
|
||||
const selectHost = document.createElement('span')
|
||||
new CustomSelect(selectHost, OVERRIDE_OPTIONS, o.setting || 'native')
|
||||
// a stored empty setting IS the "disabled" choice - a `||` fallback would
|
||||
// turn every disabled override back into the default on reopen
|
||||
new CustomSelect(selectHost, OVERRIDE_OPTIONS, o.setting == null ? 'native,builtin' : o.setting)
|
||||
row.insertBefore(selectHost, row.querySelector('[data-act=del]'))
|
||||
row.querySelector('[data-act=del]').onclick = () => row.remove()
|
||||
return row
|
||||
}
|
||||
|
||||
function addOverrideRow() {
|
||||
qs('#gc-overrides').appendChild(buildOverrideRow({ dll: '', setting: 'native' }))
|
||||
qs('#gc-overrides').appendChild(buildOverrideRow({ dll: '', setting: 'native,builtin' }))
|
||||
const rows = qsa('#gc-overrides .override-row')
|
||||
rows[rows.length - 1].querySelector('.dll').focus()
|
||||
}
|
||||
|
||||
// The setting a guide or a launch option uses ("n", "native,builtin", "d"...)
|
||||
// mapped onto the values this select offers. Unknown text keeps the select's
|
||||
// choice instead of inventing one.
|
||||
function normalizeOverrideSetting(raw) {
|
||||
const v = String(raw || '').trim().toLowerCase().replace(/\s+/g, '')
|
||||
if (!v || v === 'd' || v === 'disabled') return ''
|
||||
if (v === 'n' || v === 'native') return 'native'
|
||||
if (v === 'b' || v === 'builtin') return 'builtin'
|
||||
if (v === 'n,b' || v === 'native,builtin') return 'native,builtin'
|
||||
if (v === 'b,n' || v === 'builtin,native') return 'builtin,native'
|
||||
return null
|
||||
}
|
||||
|
||||
function readOverrides() {
|
||||
return qsa('#gc-overrides .override-row').map(row => ({
|
||||
dll: row.querySelector('.dll').value.trim(),
|
||||
setting: row.querySelector('.custom-select').dataset.value ?? 'native'
|
||||
})).filter(o => o.dll)
|
||||
return qsa('#gc-overrides .override-row').map(row => {
|
||||
let dll = row.querySelector('.dll').value.trim()
|
||||
let setting = row.querySelector('.custom-select').dataset.value ?? 'native,builtin'
|
||||
// "dinput8=native" pasted into the name box is the form every guide uses -
|
||||
// split it here instead of storing a name with '=' that Wine cannot parse
|
||||
const eq = dll.indexOf('=')
|
||||
if (eq > 0) {
|
||||
const pasted = normalizeOverrideSetting(dll.slice(eq + 1))
|
||||
if (pasted !== null) setting = pasted
|
||||
dll = dll.slice(0, eq).trim()
|
||||
}
|
||||
dll = dll.replace(/\.dll$/i, '')
|
||||
return { dll, setting }
|
||||
}).filter(o => o.dll)
|
||||
}
|
||||
|
||||
async function saveGameConfig() {
|
||||
|
|
@ -1322,10 +1350,14 @@ async function saveGameConfig() {
|
|||
wine: selects['gc-wine'].value,
|
||||
prefix,
|
||||
env,
|
||||
dllOverrides: readOverrides()
|
||||
dllOverrides: readOverrides(),
|
||||
disableUmu: qs('#gc-disable-umu').checked
|
||||
}
|
||||
await window.plwl.gamesUpdate(game.id, patch)
|
||||
state.games = await window.plwl.gamesList()
|
||||
// show what was actually stored: a pasted "name=setting" was split and a
|
||||
// .dll suffix stripped, so the rows would otherwise disagree with the file
|
||||
renderOverrides(patch.dllOverrides)
|
||||
toast(t('config.saved'), 'success')
|
||||
if (prefixLockedHint) toast(t('config.prefixLocked'), 'error')
|
||||
if (state.currentView === 'gameconfig') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue