fix: keyboard unbinding and IR fixes

This commit is contained in:
2025-04-29 19:59:21 +00:00
parent 0add9200a6
commit 14a65eb5bb
7 changed files with 44 additions and 7 deletions

View File

@ -1,3 +1,8 @@
## 0.18.1
- Keys can now be unbinded with Esc
- Fixed CHUNITHM IR behavior on actual keyboards
## 0.18.0 ## 0.18.0
- Added new grouping options to the package list - Added new grouping options to the package list

View File

@ -117,12 +117,16 @@ impl Keyboard {
} }
} }
Keyboard::Chunithm(kb) => { Keyboard::Chunithm(kb) => {
let mut enabled_ir = false;
if kb.enabled { if kb.enabled {
for (i, cell) in kb.cell.iter().enumerate() { for (i, cell) in kb.cell.iter().enumerate() {
ini.with_section(Some("slider")).set(format!("cell{}", i + 1), cell.to_string()); ini.with_section(Some("slider")).set(format!("cell{}", i + 1), cell.to_string());
} }
for (i, ir) in kb.ir.iter().enumerate() { for (i, ir) in kb.ir.iter().enumerate() {
ini.with_section(Some("ir")).set(format!("ir{}", i + 1), ir.to_string()); ini.with_section(Some("ir")).set(format!("ir{}", i + 1), (*ir).to_string());
if i > 0 && *ir != 0 {
enabled_ir = true;
}
} }
ini.with_section(Some("io3")) ini.with_section(Some("io3"))
.set("test", kb.test.to_string()) .set("test", kb.test.to_string())
@ -140,8 +144,13 @@ impl Keyboard {
.set("service", "0") .set("service", "0")
.set("coin", "0"); .set("coin", "0");
} }
ini.with_section(Some("io3")) if enabled_ir {
.set("ir", "0"); ini.with_section(Some("io3"))
.set("ir", "0");
} else {
ini.with_section(Some("io3"))
.set("ir", kb.ir[0].to_string());
}
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"$schema": "https://schema.tauri.app/config/2", "$schema": "https://schema.tauri.app/config/2",
"productName": "STARTLINER", "productName": "STARTLINER",
"version": "0.18.0", "version": "0.18.1",
"identifier": "zip.patafour.startliner", "identifier": "zip.patafour.startliner",
"build": { "build": {
"beforeDevCommand": "bun run dev", "beforeDevCommand": "bun run dev",

View File

@ -4,6 +4,9 @@ import InputText from 'primevue/inputtext';
import { fromKeycode, toKeycode } from '../keyboard'; import { fromKeycode, toKeycode } from '../keyboard';
import { usePrfStore } from '../stores'; import { usePrfStore } from '../stores';
import { OngekiButtons } from '../types'; import { OngekiButtons } from '../types';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const prf = usePrfStore(); const prf = usePrfStore();
@ -61,6 +64,10 @@ const handleKey = (
} }
} }
if (event.code === 'Escape') {
keycode = 0;
}
if (index !== undefined) { if (index !== undefined) {
data[button][index] = keycode; data[button][index] = keycode;
} else { } else {
@ -160,13 +167,24 @@ const fontSize = computed(() => {
<InputText <InputText
:style="{ :style="{
width: small ? '2.8rem' : '5rem', width: small ? '2.8rem' : '5rem',
height: small ? '2.8rem' : tall ? '10rem' : '5rem', height:
small && tall
? '5rem'
: small
? '2.8rem'
: tall
? '10rem'
: '5rem',
fontSize, fontSize,
backgroundColor: color, backgroundColor: color,
}" }"
unstyled unstyled
class="text-center buttoninputtext" class="text-center buttoninputtext"
v-tooltip="tooltip ? `${tooltip}: ${modelValue}` : undefined" v-tooltip="
tooltip
? `${tooltip}: ${modelValue} ${tooltip.startsWith('ir') ? `\n${t('cfg.keyboard.irTooltip')}` : ''}`
: undefined
"
@contextmenu.prevent="() => {}" @contextmenu.prevent="() => {}"
@keydown="(ev: KeyboardEvent) => handleKey(button, ev, index)" @keydown="(ev: KeyboardEvent) => handleKey(button, ev, index)"
@mousedown=" @mousedown="

View File

@ -95,7 +95,7 @@ const prf = usePrfStore();
</div> </div>
</div> </div>
<div v-if="prf.current?.meta.game === 'chunithm'"> <div v-if="prf.current?.meta.game === 'chunithm'">
<div class="absolute left-1/2 top-1/5"> <div class="absolute left-9/17 top-1/12">
<div <div
class="flex flex-row flex-nowrap gap-2 self-center w-full" class="flex flex-row flex-nowrap gap-2 self-center w-full"
> >
@ -108,6 +108,7 @@ const prf = usePrfStore();
button="ir" button="ir"
:index="idx - 1" :index="idx - 1"
:tooltip="`ir${idx}`" :tooltip="`ir${idx}`"
tall
small small
color="rgba(0, 255, 0, 0.2)" color="rgba(0, 255, 0, 0.2)"
/> />

View File

@ -189,6 +189,8 @@ export default {
'Only applicable if the IO module is set to segatools built-in (keyboard) or a compatible third-party module (like mu3io.NET)', 'Only applicable if the IO module is set to segatools built-in (keyboard) or a compatible third-party module (like mu3io.NET)',
leverMode: 'Lever mode', leverMode: 'Lever mode',
mouse: 'Mouse', mouse: 'Mouse',
irTooltip:
'When playing on an actual keyboard, only bind ir1; leave the rest unbound',
}, },
wine: { wine: {
prefix: 'Wine prefix', prefix: 'Wine prefix',

View File

@ -229,6 +229,8 @@ export default {
'Dotyczy tylko wtedy, gdy moduł IO jest ustawiony na wbudowaną emulację lub zgodny moduł (np. mu3io.NET)', 'Dotyczy tylko wtedy, gdy moduł IO jest ustawiony na wbudowaną emulację lub zgodny moduł (np. mu3io.NET)',
leverMode: 'Tryb wajchy', leverMode: 'Tryb wajchy',
mouse: 'Mysz', mouse: 'Mysz',
irTooltip:
'Jeśli grasz na klawiaturze, ustaw tylko ir1; pozostałe zostaw wyłączone',
}, },
wine: { wine: {
prefix: 'Wine prefix', prefix: 'Wine prefix',