feat: chusanApp.exe patching

This commit is contained in:
2025-04-13 18:15:41 +00:00
parent 6270fce05f
commit 4247e19996
18 changed files with 406 additions and 187 deletions

View File

@ -78,7 +78,6 @@ const iconSrc = computed(() => {
</span>
<span
v-if="
hasFeature(pkg, Feature.Mempatcher) ||
hasFeature(pkg, Feature.GameDLL) ||
hasFeature(pkg, Feature.AmdDLL)
"

View File

@ -3,37 +3,53 @@ import InputNumber from 'primevue/inputnumber';
import ToggleSwitch from 'primevue/toggleswitch';
import OptionRow from './OptionRow.vue';
import { usePrfStore } from '../stores';
import { Patch } from '@/types';
const prf = usePrfStore();
const toggleUnary = (key: string, val: boolean) => {
if (val) {
prf.current!.data.patches[key] = 'Enabled';
prf.current!.data.patches[key] = 'enabled';
} else {
delete prf.current!.data.patches[key];
}
};
const setNumber = (key: string, val: number) => {
if (val) {
prf.current!.data.patches[key] = { number: val };
} else {
delete prf.current!.data.patches[key];
}
};
defineProps({
id: String,
name: String,
tooltip: String,
type: String,
defaultValue: Number,
patch: Object as () => Patch,
});
</script>
<template>
<OptionRow :title="name" :tooltip="tooltip" :greytext="id">
<OptionRow
:title="patch?.name"
:tooltip="patch?.tooltip"
:greytext="patch?.id"
>
<ToggleSwitch
v-if="type === undefined"
:model-value="prf.current!.data.patches[id!] !== undefined"
@update:model-value="(v: boolean) => toggleUnary(id!, v)"
v-if="patch?.type === undefined"
:model-value="prf.current!.data.patches[patch!.id!] !== undefined"
@update:model-value="(v: boolean) => toggleUnary(patch!.id!, v)"
/>
<InputNumber
v-else
v-else-if="patch?.type === 'number'"
class="number-input"
:placeholder="(defaultValue ?? 0).toString()"
:model-value="
(prf.current!.data.patches[patch!.id!] as { number: number })
?.number
"
@update:model-value="(v: number) => setNumber(patch!.id!, v)"
:min="patch?.min"
:max="patch?.max"
:placeholder="(patch?.default ?? 0).toString()"
/>
</OptionRow>
</template>

View File

@ -39,11 +39,7 @@ const errorMessage =
<PatchEntry
v-if="gamePatches !== null"
v-for="p in gamePatches"
:id="p.id"
:title="p.name"
:tooltip="p.tooltip"
:type="p.type"
:default-value="p.default"
:patch="p"
/>
<div v-if="gamePatches === null">Loading...</div>
<div v-if="gamePatches !== null && gamePatches.length === 0">
@ -54,11 +50,7 @@ const errorMessage =
<PatchEntry
v-if="amdPatches !== null"
v-for="p in amdPatches"
:id="p.id"
:title="p.name"
:tooltip="p.tooltip"
:type="p.type"
:default-value="p.default"
:patch="p"
/>
<div v-if="gamePatches === null">Loading...</div>
<div v-if="amdPatches !== null && amdPatches.length === 0">

View File

@ -6,13 +6,14 @@ import OptionCategory from '../OptionCategory.vue';
import OptionRow from '../OptionRow.vue';
import { usePrfStore } from '../../stores';
ToggleSwitch;
const prf = usePrfStore();
</script>
<template>
<OptionCategory title="Keyboard">
<OptionRow title="Enable">
<ToggleSwitch v-model="prf.current!.data.keyboard!.data.enabled" />
</OptionRow>
<OptionRow
title="Lever mode"
v-if="prf.current!.data.keyboard!.game === 'Ongeki'"
@ -28,7 +29,6 @@ const prf = usePrfStore();
option-value="value"
/>
</OptionRow>
<OptionRow v-if="prf.current!.data.keyboard!.game === 'Chunithm'" />
<div
:style="`position: relative; height: ${prf.current!.data.keyboard!.game === 'Ongeki' ? 400 : 250}px`"
>

View File

@ -40,7 +40,7 @@ export type Status =
| 'Unchecked'
| 'Unsupported'
| {
OK: Feature;
OK: [Feature, String, String];
};
export type Game = 'ongeki' | 'chunithm';
@ -59,7 +59,7 @@ export interface ProfileData {
mu3_ini: Mu3IniConfig | undefined;
keyboard: KeyboardConfig | undefined;
patches: {
[key: string]: 'Enabled' | { Number: number } | { Hex: Int8Array };
[key: string]: 'enabled' | { number: number } | { hex: Int8Array };
};
}
@ -112,6 +112,7 @@ export interface Mu3IniConfig {
export interface OngekiButtons {
use_mouse: boolean;
enabled: boolean;
coin: number;
svc: number;
test: number;
@ -128,6 +129,7 @@ export interface OngekiButtons {
}
export interface ChunithmButtons {
enabled: boolean;
coin: number;
svc: number;
test: number;
@ -164,4 +166,6 @@ export interface Patch {
tooltip: string;
type: undefined | 'number';
default: number;
min: number;
max: number;
}

View File

@ -52,7 +52,7 @@ export const hasFeature = (pkg: Package | undefined, feature: Feature) => {
pkg.loc !== null &&
pkg.loc !== undefined &&
typeof pkg.loc?.status !== 'string' &&
pkg.loc.status.OK & feature
pkg.loc.status.OK[0] & feature
);
};