7 Commits

Author SHA1 Message Date
aaeed669df chore: bump ver 2025-04-19 11:46:07 +00:00
7084f40404 fix: improve help pages 2025-04-19 11:44:16 +00:00
f7e9d7d7db docs: rewrite README.md 2025-04-18 19:55:42 +00:00
e87b661f08 feat: onboarding 2025-04-18 15:00:52 +00:00
5d2d407659 chore: update CHANGELOG.md 2025-04-18 06:59:55 +00:00
795e889bd0 fix: better keyboard
* Scale the font as necessary
* Fix CHUNITHM order
* Fix num-unlocked numpad
2025-04-18 06:55:59 +00:00
7071f19877 fix: don't switch primary, for real 2025-04-17 18:43:27 +00:00
28 changed files with 535 additions and 166 deletions

View File

@ -1,3 +1,17 @@
## 0.11.1
- Improved help pages
## 0.11.0
- Added help pages
## 0.10.1
- Fixed the order of cells in the CHUNITHM keyboard
- Fixed numpad bindings with numlock disabled
- Disabled primary monitor cleanup when "don't switch primary monitor" is enabled
## 0.10.0 ## 0.10.0
- Added a global progress bar - Added a global progress bar

View File

@ -1,17 +1,19 @@
# STARTLINER # STARTLINER
A simple and easy to use launcher, configuration tool and mod manager This is a program that seeks to streamline game data configuration, currently supporting O.N.G.E.K.I. and CHUNITHM.
for O.N.G.E.K.I. and CHUNITHM, using [Rainycolor Watercolor](https://rainy.patafour.zip).
STARTLINER is four things:
- a mod installer and updater, powered by [Rainycolor Watercolor](https://rainy.patafour.zip),
- a configuration GUI for segatools,
- a glorified `start.bat` clicker, with automatic monitor setup and rollback,
- [an abstraction allowing data configuration without touching the game directory](https://gitea.tendokyu.moe/akanyan/STARTLINER/wiki/Architecture-details).
STARTLINER's core design principle is to modify, configure and launch games without tampering with them.
This makes it possible to keep data cleaner than ever, and to have several configurations pointing at the same data.
Made with Rust (Tauri) and Vue. Technically multiplatform. Contributions welcome. Made with Rust (Tauri) and Vue. Technically multiplatform. Contributions welcome.
## Features
- [Clean](https://gitea.tendokyu.moe/akanyan/STARTLINER/wiki/Architecture-details) data modding
- Segatools configuration
- Monitor configuration with automatic rollback
- Support for multiple configurations pointing at the same data
## Usage ## Usage
Download a prebuilt binary from [Releases](https://gitea.tendokyu.moe/akanyan/STARTLINER/releases) or build it yourself: Download a prebuilt binary from [Releases](https://gitea.tendokyu.moe/akanyan/STARTLINER/releases) or build it yourself:

View File

@ -0,0 +1,3 @@
If you're stuck on this screen, restart the game.
If the problem persists, <a href="https://gitea.tendokyu.moe/Dniel97/SEGAguide/wiki/FAQ#game-is-stuck-at-checking-distribution-server" target="_blank">check your network configuration</a>

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

8
public/help-finale.md Normal file
View File

@ -0,0 +1,8 @@
You can access this page any time by right-clicking the START button.
Additional resources:
- <a href="https://gitea.tendokyu.moe/Dniel97/SEGAguide/wiki/FAQ" target="_blank">SEGAguide</a>
- <a href="https://two-torial.xyz/" target="_blank">two-torial</a>
## Have fun

View File

@ -0,0 +1,3 @@
You also have to calibrate the lever, or you may get the error 3301.
Go to lever settings (<span class="bg-black text-white">レバー設定</span>), move the lever to both edges, then press "end" (<span class="bg-black text-white">終了</span>) and "save" (<span class="bg-black text-white">保存する</span>).

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

View File

@ -0,0 +1,3 @@
You might get stuck on this screen for several minutes. _This is normal_. The game just takes a long time to load data.
If you install <code>7EVENDAYSHOLIDAYS/LoadBoost</code>, subsequent launches will be much faster.

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

7
public/help-standard.md Normal file
View File

@ -0,0 +1,7 @@
You might get stuck on the following screen:
<div class="p-2 mt-1 mb-1 bg-black text-white">Aグループの基準機から設定を取得</div>
In which case, you should go to the test menu, and in game settings <span class="bg-black text-white">ゲーム設定</span> switch from "follow the standard machine" <span class="bg-black text-white">基準機に従う</span> to "standard machine" <span class="bg-black text-white">基準機</span>.
The test menu can be accessed with %TESTMENU%.

View File

@ -334,8 +334,8 @@ fn open_window(apph: AppHandle) -> anyhow::Result<()> {
let config = apph.config().clone(); let config = apph.config().clone();
tauri::WebviewWindowBuilder::new(&apph, "main", tauri::WebviewUrl::App("index.html".into())) tauri::WebviewWindowBuilder::new(&apph, "main", tauri::WebviewUrl::App("index.html".into()))
.title(format!("STARTLINER {}", config.version.unwrap_or_default())) .title(format!("STARTLINER {}", config.version.unwrap_or_default()))
.inner_size(900f64, 480f64) .inner_size(900f64, 600f64)
.min_inner_size(900f64, 480f64) .min_inner_size(900f64, 600f64)
.build()?; .build()?;
Ok(()) Ok(())

View File

@ -6,14 +6,14 @@ use tauri::{AppHandle, Listener};
#[derive(Clone)] #[derive(Clone)]
pub struct DisplayInfo { pub struct DisplayInfo {
pub primary: String, pub primary: Option<String>,
pub set: Option<DisplaySet>, pub set: Option<DisplaySet>,
} }
impl Default for DisplayInfo { impl Default for DisplayInfo {
fn default() -> Self { fn default() -> Self {
DisplayInfo { DisplayInfo {
primary: "default".to_owned(), primary: None,
set: query_displays().ok(), set: query_displays().ok(),
} }
} }
@ -60,7 +60,7 @@ impl Display {
.ok_or_else(|| anyhow!("Unable to query display settings"))?; .ok_or_else(|| anyhow!("Unable to query display settings"))?;
let res = DisplayInfo { let res = DisplayInfo {
primary: primary.name().to_owned(), primary: if self.dont_switch_primary { None } else { Some(primary.name().to_owned()) },
set: Some(display_set.clone()), set: Some(display_set.clone()),
}; };
@ -132,12 +132,14 @@ impl Display {
let display_set = info.set.as_ref() let display_set = info.set.as_ref()
.ok_or_else(|| anyhow!("Unable to clean up displays: no display set"))?; .ok_or_else(|| anyhow!("Unable to clean up displays: no display set"))?;
if let Some(info_primary) = &info.primary {
let primary = display_set let primary = display_set
.displays() .displays()
.find(|display| display.name() == info.primary) .find(|display| display.name() == info_primary)
.ok_or_else(|| anyhow!("Display {} not found", info.primary))?; .ok_or_else(|| anyhow!("Display {} not found", info_primary))?;
primary.set_primary()?; primary.set_primary()?;
}
display_set.apply()?; display_set.apply()?;
displayz::refresh()?; displayz::refresh()?;

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.10.0", "version": "0.11.1",
"identifier": "zip.patafour.startliner", "identifier": "zip.patafour.startliner",
"build": { "build": {
"beforeDevCommand": "bun run dev", "beforeDevCommand": "bun run dev",

View File

@ -65,7 +65,7 @@ const filePick = async () => {
<template> <template>
<Button v-if="!exists" icon="pi pi-plus" size="small" @click="filePick" /> <Button v-if="!exists" icon="pi pi-plus" size="small" @click="filePick" />
<div v-else> <div class="primitive-base" v-else>
<Button <Button
v-if="exists" v-if="exists"
icon="pi pi-pen-to-square" icon="pi pi-pen-to-square"
@ -102,12 +102,20 @@ const filePick = async () => {
font-family: monospace; font-family: monospace;
white-space: nowrap; white-space: nowrap;
position: fixed; position: fixed;
top: 10vh; top: 50%;
left: 10vw; left: 50%;
height: 80vh; height: 500px;
width: 80vw; width: 800px;
margin-left: -400px;
margin-top: -250px;
z-index: 1000; z-index: 1000;
padding: 20px;
border-radius: 20px;
background-color: #151515; background-color: #151515;
color: #ddd; color: #ddd;
} }
.primitive-base ::-webkit-scrollbar {
display: none;
}
</style> </style>

View File

@ -16,7 +16,7 @@ invoke('get_changelog').then((s) => (changelog.value = s as string));
O.N.G.E.K.I. and CHUNITHM. O.N.G.E.K.I. and CHUNITHM.
<h1>Changelog</h1> <h1>Changelog</h1>
<ScrollPanel style="height: 200px"> <ScrollPanel style="height: 200px">
<div class="changelog"> <div class="markdown">
<vue-markdown-it <vue-markdown-it
:source="changelog" :source="changelog"
:options="{ typographer: true, breaks: true }" :options="{ typographer: true, breaks: true }"
@ -44,13 +44,20 @@ h1 {
font-size: 1.7rem; font-size: 1.7rem;
} }
.changelog h2 { .markdown h3 {
font-size: 1.2rem;
}
.markdown h2 {
font-size: 1.4rem; font-size: 1.4rem;
} }
.changelog ul { .markdown ul {
list-style-type: circle; list-style-type: circle;
} }
.changelog li { .markdown li {
margin-left: 40px; margin-left: 40px;
} }
.markdown a {
text-decoration: underline;
}
</style> </style>

View File

@ -1,6 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import InputText from 'primevue/inputtext'; import InputText from 'primevue/inputtext';
import { fromKeycode, toKeycode } from '../keyboard';
import { usePrfStore } from '../stores'; import { usePrfStore } from '../stores';
import { OngekiButtons } from '../types'; import { OngekiButtons } from '../types';
@ -15,9 +16,51 @@ const handleKey = (
) => { ) => {
event.preventDefault(); event.preventDefault();
const keycode = toKeycode(event.code); let keycode = toKeycode(event.code);
if (keycode !== null && button !== undefined) { if (keycode !== null && button !== undefined) {
const data = prf.current!.data.keyboard!.data as any; const data = prf.current!.data.keyboard!.data as any;
if (event.getModifierState('NumLock') === false) {
switch (event.code) {
case 'NumpadDecimal':
keycode = toKeycode('Delete');
break;
case 'Numpad0':
keycode = toKeycode('Insert');
break;
case 'Numpad1':
keycode = toKeycode('End');
break;
case 'Numpad2':
keycode = toKeycode('ArrowDown');
break;
case 'Numpad3':
keycode = toKeycode('PageDown');
break;
case 'Numpad4':
keycode = toKeycode('ArrowLeft');
break;
case 'Numpad5':
keycode = toKeycode('Clear');
break;
case 'Numpad6':
keycode = toKeycode('ArrowRight');
break;
case 'Numpad7':
keycode = toKeycode('Home');
break;
case 'Numpad8':
keycode = toKeycode('ArrowUp');
break;
case 'Numpad9':
keycode = toKeycode('PageUp');
break;
default:
break;
}
}
if (index !== undefined) { if (index !== undefined) {
data[button][index] = keycode; data[button][index] = keycode;
} else { } else {
@ -75,7 +118,7 @@ const handleMouse = (
} }
}; };
const getKey = (key: keyof OngekiButtons, index?: number) => const getKey = (key: keyof OngekiButtons, index?: number): any =>
computed(() => { computed(() => {
const data = prf.current!.data.keyboard?.data as any; const data = prf.current!.data.keyboard?.data as any;
const keycode = const keycode =
@ -85,147 +128,45 @@ const getKey = (key: keyof OngekiButtons, index?: number) =>
return keycode && fromKeycode(keycode) ? fromKeycode(keycode) : ''; return keycode && fromKeycode(keycode) ? fromKeycode(keycode) : '';
}); });
const KEY_MAP: { [key: number]: string } = { const props = defineProps({
1: 'M1',
2: 'M2',
4: 'M3',
5: 'M4',
6: 'M5',
8: 'Backspace',
9: 'Tab',
13: 'Enter',
19: 'Pause',
20: 'CapsLock',
27: 'Escape',
32: 'Space',
33: 'PageUp',
34: 'PageDown',
35: 'End',
36: 'Home',
37: 'ArrowLeft',
38: 'ArrowUp',
39: 'ArrowRight',
40: 'ArrowDown',
45: 'Insert',
46: 'Delete',
48: 'Digit0',
49: 'Digit1',
50: 'Digit2',
51: 'Digit3',
52: 'Digit4',
53: 'Digit5',
54: 'Digit6',
55: 'Digit7',
56: 'Digit8',
57: 'Digit9',
65: 'KeyA',
66: 'KeyB',
67: 'KeyC',
68: 'KeyD',
69: 'KeyE',
70: 'KeyF',
71: 'KeyG',
72: 'KeyH',
73: 'KeyI',
74: 'KeyJ',
75: 'KeyK',
76: 'KeyL',
77: 'KeyM',
78: 'KeyN',
79: 'KeyO',
80: 'KeyP',
81: 'KeyQ',
82: 'KeyR',
83: 'KeyS',
84: 'KeyT',
85: 'KeyU',
86: 'KeyV',
87: 'KeyW',
88: 'KeyX',
89: 'KeyY',
90: 'KeyZ',
91: 'MetaLeft',
92: 'MetaRight',
93: 'ContextMenu',
96: 'Numpad0',
97: 'Numpad1',
98: 'Numpad2',
99: 'Numpad3',
100: 'Numpad4',
101: 'Numpad5',
102: 'Numpad6',
103: 'Numpad7',
104: 'Numpad8',
105: 'Numpad9',
106: 'NumpadMultiply',
107: 'NumpadAdd',
109: 'NumpadSubtract',
110: 'NumpadDecimal',
111: 'NumpadDivide',
112: 'F1',
113: 'F2',
114: 'F3',
115: 'F4',
116: 'F5',
117: 'F6',
118: 'F7',
119: 'F8',
120: 'F9',
121: 'F10',
122: 'F11',
123: 'F12',
144: 'NumLock',
145: 'ScrollLock',
160: 'ShiftLeft',
161: 'ShiftRight',
162: 'ControlLeft',
163: 'ControlRight',
164: 'AltLeft',
165: 'AltRight',
186: 'Semicolon',
187: 'Equal',
188: 'Comma',
189: 'Minus',
190: 'Period',
191: 'Slash',
192: 'Backquote',
219: 'BracketLeft',
220: 'Backslash',
221: 'BracketRight',
222: 'Quote',
};
const fromKeycode = (keyCode: number): string | null => {
return KEY_MAP[keyCode] ?? null;
};
const toKeycode = (key: string): number | null => {
const res = Object.entries(KEY_MAP).find(([_, v]) => v === key)?.[0];
return res ? parseInt(res) : null;
};
defineProps({
small: Boolean, small: Boolean,
verySmall: Boolean,
tall: Boolean, tall: Boolean,
tooltip: String, tooltip: String,
button: String, button: String,
color: String, color: String,
index: Number, index: Number,
}); });
const modelValue = computed(() => {
return getKey(props.button as keyof OngekiButtons, props.index).value;
});
const fontSize = computed(() => {
if (!props.small) {
return '1rem';
}
const len = modelValue.value.length;
if (len < 5) {
return '1rem';
}
if (len < 7) {
return '0.75rem';
}
return '0.5rem';
});
</script> </script>
<template> <template>
<InputText <InputText
:style="{ :style="{
width: small ? '3em' : '5em', width: small ? '2.8rem' : '5rem',
height: small ? '3em' : tall ? '10em' : '5em', height: small ? '2.8rem' : tall ? '10rem' : '5rem',
fontSize: small ? '0.9em' : '1em', fontSize,
backgroundColor: color, backgroundColor: color,
}" }"
unstyled unstyled
class="text-center buttoninputtext" class="text-center buttoninputtext"
v-tooltip="tooltip" v-tooltip="tooltip ? `${tooltip}: ${modelValue}` : undefined"
@contextmenu.prevent="() => {}" @contextmenu.prevent="() => {}"
@keydown="(ev: KeyboardEvent) => handleKey(button, ev, index)" @keydown="(ev: KeyboardEvent) => handleKey(button, ev, index)"
@mousedown=" @mousedown="
@ -233,7 +174,7 @@ defineProps({
handleMouse(button as keyof OngekiButtons, ev, index) handleMouse(button as keyof OngekiButtons, ev, index)
" "
@focusout="() => (hasClickedM1Once = false)" @focusout="() => (hasClickedM1Once = false)"
:model-value="getKey(button as keyof OngekiButtons, index) as any" :model-value="modelValue"
/> />
</template> </template>
@ -241,5 +182,7 @@ defineProps({
.buttoninputtext { .buttoninputtext {
border-radius: 6px; border-radius: 6px;
border: 1px solid rgba(200, 200, 200, 0.3); border: 1px solid rgba(200, 200, 200, 0.3);
overflow: scroll !important;
text-align: center !important;
} }
</style> </style>

View File

@ -38,7 +38,7 @@ const iconSrc = computed(() => {
<label class="m-3 align-middle text grow z-5 h-50px"> <label class="m-3 align-middle text grow z-5 h-50px">
<div> <div>
<span class="text-lg"> <span class="text-lg">
{{ pkg?.name ?? 'Untitled' }} {{ pkg?.name.replaceAll('_', ' ') ?? 'Untitled' }}
</span> </span>
<span <span
v-if="pkg?.rmt?.deprecated" v-if="pkg?.rmt?.deprecated"

View File

@ -0,0 +1,175 @@
<script setup lang="ts">
import { ComputedRef, computed, onMounted, ref } from 'vue';
import Button from 'primevue/button';
import Carousel from 'primevue/carousel';
import Dialog from 'primevue/dialog';
import { fromKeycode } from '../keyboard';
import { useClientStore, usePrfStore } from '../stores';
import { prettyPrint } from '../util';
import { VueMarkdownIt } from '@f3ve/vue-markdown-it';
const prf = usePrfStore();
const client = useClientStore();
const props = defineProps({
visible: Boolean,
firstTime: Boolean,
onFinish: Function,
});
interface Datum {
text: string;
image: string;
}
const game = computed(() => prf.current?.meta.game);
const processText = (s: string) => {
if (prf.current!.data.keyboard?.data.enabled) {
const testKey = prf.current!.data.keyboard?.data.test;
const readable = fromKeycode(testKey);
if (readable !== null) {
return s.replace(
'%TESTMENU%',
`${readable} or a button on the back of the controller`
);
}
}
return s.replace('%TESTMENU%', 'a button on the back of the controller');
};
const loadPage = async (title: string) => {
return {
text: await (await fetch(`/help-${title}.md`)).text(),
image: `help-${title}.png`,
};
};
let systemProcessing: Datum;
let standardOngeki: Datum;
let standardChunithm: Datum;
let lever: Datum;
let server: Datum;
let finaleOngeki: Datum;
let finaleChunithm: Datum;
const data: ComputedRef<Datum[]> = computed(() => {
const res = [];
switch (prf.current?.meta.game) {
case 'ongeki':
res.push(systemProcessing);
res.push(standardOngeki);
res.push(lever);
res.push(finaleOngeki);
break;
case 'chunithm':
res.push(standardChunithm);
res.push(server);
res.push(finaleChunithm);
break;
default:
break;
}
return res;
});
onMounted(async () => {
[standardOngeki, systemProcessing, lever, server, finaleOngeki] =
await Promise.all([
loadPage('standard'),
loadPage('ongeki-system-processing'),
loadPage('ongeki-lever'),
loadPage('chunithm-server'),
loadPage('finale'),
]);
standardOngeki = {
...standardOngeki,
image: '/help-standard-ongeki.png',
};
standardChunithm = {
...standardOngeki,
image: '/help-standard-chunithm.png',
};
finaleOngeki = {
...finaleOngeki,
image: '/help-finale-ongeki.png',
};
finaleChunithm = {
...finaleOngeki,
image: '/help-finale-chunithm.png',
};
});
const counter = ref(0);
const exitLabel = computed(() => {
return props.firstTime === true && counter.value < data.value.length - 1
? 'Skip'
: 'Close';
});
</script>
<template>
<Dialog
modal
:visible="visible"
:closable="false"
:header="
firstTime
? `It looks like you're running ${game ? prettyPrint(game) : '<game>'} for the first time`
: `${game ? prettyPrint(game) : '<game>'} help`
"
:style="{ width: '760px', scale: client.scaleValue }"
>
<Carousel
:value="data"
:num-visible="1"
:num-scroll="1"
:page="counter"
v-on:update:page="(p) => (counter = p)"
>
<template #item="slotProps">
<div class="md-container markdown">
<vue-markdown-it
:source="processText(slotProps.data?.text)"
:options="{
typographer: true,
breaks: true,
html: true,
}"
/>
</div>
<div
class="border border-surface-200 dark:border-surface-700 rounded m-2"
>
<img :src="slotProps.data.image" />
</div>
</template>
</Carousel>
<div style="width: 100%; text-align: center">
<Button
v-if="counter < data.length - 1"
class="m-auto mr-4"
label="Next"
@click="() => (counter += 1)"
/>
<Button
class="m-auto"
:label="exitLabel"
@click="() => onFinish && onFinish()"
/>
</div>
</Dialog>
</template>
<style lang="css">
.p-dialog ::-webkit-scrollbar {
display: none;
}
.md-container {
height: 9.5rem;
}
</style>

View File

@ -5,10 +5,12 @@ import ContextMenu from 'primevue/contextmenu';
import { useConfirm } from 'primevue/useconfirm'; import { useConfirm } from 'primevue/useconfirm';
import { listen } from '@tauri-apps/api/event'; import { listen } from '@tauri-apps/api/event';
import { getCurrentWindow } from '@tauri-apps/api/window'; import { getCurrentWindow } from '@tauri-apps/api/window';
import Onboarding from './Onboarding.vue';
import { invoke } from '../invoke'; import { invoke } from '../invoke';
import { usePrfStore } from '../stores'; import { useClientStore, usePrfStore } from '../stores';
const prf = usePrfStore(); const prf = usePrfStore();
const client = useClientStore();
const confirmDialog = useConfirm(); const confirmDialog = useConfirm();
type StartStatus = 'ready' | 'preparing' | 'running'; type StartStatus = 'ready' | 'preparing' | 'running';
@ -98,6 +100,7 @@ const menuItems = [
{ {
label: 'Refresh and start', label: 'Refresh and start',
icon: 'pi pi-sync', icon: 'pi pi-sync',
tooltip: 'test',
command: async () => await startline(false, true), command: async () => await startline(false, true),
}, },
{ {
@ -110,6 +113,14 @@ const menuItems = [
icon: 'pi pi-link', icon: 'pi pi-link',
command: createShortcut, command: createShortcut,
}, },
{
label: 'Help',
icon: 'pi pi-question-circle',
command: () => {
onboardingFirstTime.value = false;
onboardingVisible.value = true;
},
},
]; ];
const menu = ref(); const menu = ref();
@ -117,9 +128,38 @@ const showContextMenu = (event: Event) => {
event.preventDefault(); event.preventDefault();
menu.value.show(event); menu.value.show(event);
}; };
const onboardingVisible = ref(false);
const onboardingFirstTime = ref(false);
const tryStart = () => {
const game = prf.current?.meta.game;
if (game !== undefined) {
if (client.onboarded.includes(game)) {
startline(false, false);
} else {
onboardingVisible.value = true;
onboardingFirstTime.value = true;
client.setOnboarded(game);
}
}
};
</script> </script>
<template> <template>
<Onboarding
:visible="onboardingVisible"
:first-time="onboardingFirstTime"
:on-finish="
() => {
onboardingVisible = false;
if (onboardingFirstTime === true) {
startline(false, false);
}
}
"
/>
<ContextMenu ref="menu" :model="menuItems" /> <ContextMenu ref="menu" :model="menuItems" />
<Button <Button
v-if="startStatus === 'ready'" v-if="startStatus === 'ready'"
@ -130,7 +170,7 @@ const showContextMenu = (event: Event) => {
aria-label="start" aria-label="start"
size="small" size="small"
class="m-2.5" class="m-2.5"
@click="startline(false, false)" @click="tryStart"
@contextmenu="showContextMenu" @contextmenu="showContextMenu"
/> />
<Button <Button

View File

@ -124,7 +124,7 @@ const prf = usePrfStore();
<div <div
v-for="idx in Array(16) v-for="idx in Array(16)
.fill(0) .fill(0)
.map((_, i) => 16 - i)" .map((_, i) => 32 - 2 * i - 1)"
> >
<KeyboardKey <KeyboardKey
button="cell" button="cell"
@ -142,7 +142,7 @@ const prf = usePrfStore();
<div <div
v-for="idx in Array(16) v-for="idx in Array(16)
.fill(0) .fill(0)
.map((_, i) => 32 - i)" .map((_, i) => 32 - 2 * i)"
> >
<KeyboardKey <KeyboardKey
button="cell" button="cell"

119
src/keyboard.ts Normal file
View File

@ -0,0 +1,119 @@
const KEY_MAP: { [key: number]: string } = {
1: 'M1',
2: 'M2',
4: 'M3',
5: 'M4',
6: 'M5',
8: 'Backspace',
9: 'Tab',
12: 'Clear',
13: 'Enter',
19: 'Pause',
20: 'CapsLock',
27: 'Escape',
32: 'Space',
33: 'PageUp',
34: 'PageDown',
35: 'End',
36: 'Home',
37: 'ArrowLeft',
38: 'ArrowUp',
39: 'ArrowRight',
40: 'ArrowDown',
45: 'Insert',
46: 'Delete',
48: 'Digit0',
49: 'Digit1',
50: 'Digit2',
51: 'Digit3',
52: 'Digit4',
53: 'Digit5',
54: 'Digit6',
55: 'Digit7',
56: 'Digit8',
57: 'Digit9',
65: 'KeyA',
66: 'KeyB',
67: 'KeyC',
68: 'KeyD',
69: 'KeyE',
70: 'KeyF',
71: 'KeyG',
72: 'KeyH',
73: 'KeyI',
74: 'KeyJ',
75: 'KeyK',
76: 'KeyL',
77: 'KeyM',
78: 'KeyN',
79: 'KeyO',
80: 'KeyP',
81: 'KeyQ',
82: 'KeyR',
83: 'KeyS',
84: 'KeyT',
85: 'KeyU',
86: 'KeyV',
87: 'KeyW',
88: 'KeyX',
89: 'KeyY',
90: 'KeyZ',
91: 'MetaLeft',
92: 'MetaRight',
93: 'ContextMenu',
96: 'Numpad0',
97: 'Numpad1',
98: 'Numpad2',
99: 'Numpad3',
100: 'Numpad4',
101: 'Numpad5',
102: 'Numpad6',
103: 'Numpad7',
104: 'Numpad8',
105: 'Numpad9',
106: 'NumpadMultiply',
107: 'NumpadAdd',
109: 'NumpadSubtract',
110: 'NumpadDecimal',
111: 'NumpadDivide',
112: 'F1',
113: 'F2',
114: 'F3',
115: 'F4',
116: 'F5',
117: 'F6',
118: 'F7',
119: 'F8',
120: 'F9',
121: 'F10',
122: 'F11',
123: 'F12',
144: 'NumLock',
145: 'ScrollLock',
160: 'ShiftLeft',
161: 'ShiftRight',
162: 'ControlLeft',
163: 'ControlRight',
164: 'AltLeft',
165: 'AltRight',
186: 'Semicolon',
187: 'Equal',
188: 'Comma',
189: 'Minus',
190: 'Period',
191: 'Slash',
192: 'Backquote',
219: 'BracketLeft',
220: 'Backslash',
221: 'BracketRight',
222: 'Quote',
};
export const fromKeycode = (keyCode: number): string | null => {
return KEY_MAP[keyCode] ?? null;
};
export const toKeycode = (key: string): number | null => {
const res = Object.entries(KEY_MAP).find(([_, v]) => v === key)?.[0];
return res ? parseInt(res) : null;
};

View File

@ -357,6 +357,10 @@ export const usePrfStore = defineStore('prf', () => {
}; };
}); });
export enum ClientData {
Onboarded,
}
export const useClientStore = defineStore('client', () => { export const useClientStore = defineStore('client', () => {
type ScaleType = 's' | 'm' | 'l' | 'xl'; type ScaleType = 's' | 'm' | 'l' | 'xl';
const scaleFactor: Ref<ScaleType> = ref('s'); const scaleFactor: Ref<ScaleType> = ref('s');
@ -366,16 +370,21 @@ export const useClientStore = defineStore('client', () => {
const enableAutoupdates = ref(true); const enableAutoupdates = ref(true);
const verbose = ref(false); const verbose = ref(false);
const theme: Ref<'light' | 'dark' | 'system'> = ref('system'); const theme: Ref<'light' | 'dark' | 'system'> = ref('system');
const onboarded: Ref<Game[]> = ref([]);
const scaleValue = (value: ScaleType) => const _scaleValue = (value: ScaleType) =>
value === 's' ? 1 : value === 'm' ? 1.25 : value === 'l' ? 1.5 : 2; value === 's' ? 1 : value === 'm' ? 1.25 : value === 'l' ? 1.5 : 2;
const scaleValue = computed(() => {
return _scaleValue(scaleFactor.value);
});
const setScaleFactor = async (value: ScaleType) => { const setScaleFactor = async (value: ScaleType) => {
scaleFactor.value = value; scaleFactor.value = value;
const window = getCurrentWindow(); const window = getCurrentWindow();
const w = Math.floor(scaleValue(value) * 900); const w = Math.floor(_scaleValue(value) * 900);
const h = Math.floor(scaleValue(value) * 480); const h = Math.floor(_scaleValue(value) * 600);
let size = await window.innerSize(); let size = await window.innerSize();
@ -420,6 +429,10 @@ export const useClientStore = defineStore('client', () => {
if (input.theme) { if (input.theme) {
theme.value = input.theme; theme.value = input.theme;
} }
if (input.onboarded) {
onboarded.value = input.onboarded;
}
await setTheme(theme.value); await setTheme(theme.value);
} catch (e) { } catch (e) {
console.error(`Error reading client options: ${e}`); console.error(`Error reading client options: ${e}`);
@ -452,6 +465,7 @@ export const useClientStore = defineStore('client', () => {
h: Math.floor(size.height), h: Math.floor(size.height),
}, },
theme: theme.value, theme: theme.value,
onboarded: onboarded.value,
}) })
); );
}; };
@ -499,6 +513,11 @@ export const useClientStore = defineStore('client', () => {
await save(); await save();
}; };
const setOnboarded = async (game: Game) => {
onboarded.value = [...onboarded.value, game];
await save();
};
getCurrentWindow().onResized(async ({ payload }) => { getCurrentWindow().onResized(async ({ payload }) => {
// For whatever reason this is 0 when minimized // For whatever reason this is 0 when minimized
if (payload.width > 0) { if (payload.width > 0) {
@ -512,8 +531,11 @@ export const useClientStore = defineStore('client', () => {
enableAutoupdates, enableAutoupdates,
verbose, verbose,
theme, theme,
onboarded,
timeout, timeout,
scaleModel, scaleModel,
_scaleValue,
scaleValue,
load, load,
save, save,
queueSave, queueSave,
@ -521,5 +543,6 @@ export const useClientStore = defineStore('client', () => {
setAutoupdates, setAutoupdates,
setVerbose, setVerbose,
setTheme, setTheme,
setOnboarded,
}; };
}); });

View File

@ -63,3 +63,12 @@ export const messageSplit = (message: any) => {
export const shouldPreferDark = () => { export const shouldPreferDark = () => {
return window.matchMedia('(prefers-color-scheme: dark)').matches; return window.matchMedia('(prefers-color-scheme: dark)').matches;
}; };
export const prettyPrint = (game: Game) => {
switch (game) {
case 'ongeki':
return 'O.N.G.E.K.I.';
case 'chunithm':
return 'CHUNITHM';
}
};

View File

@ -1,6 +1,6 @@
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue'; import vue from '@vitejs/plugin-vue';
import tailwindcss from '@tailwindcss/vite'; import tailwindcss from '@tailwindcss/vite';
import { defineConfig } from 'vite';
// @ts-expect-error process is a nodejs global // @ts-expect-error process is a nodejs global
const host = process.env.TAURI_DEV_HOST; const host = process.env.TAURI_DEV_HOST;
@ -30,4 +30,7 @@ export default defineConfig(async () => ({
ignored: ['**/rust/**'], ignored: ['**/rust/**'],
}, },
}, },
build: {
chunkSizeWarningLimit: 1024,
},
})); }));