beerpsi-x/patchers/_types.ts
2024-10-27 02:44:51 +07:00

138 lines
2.7 KiB
TypeScript

type BemaniBasePatch = {
name: string;
tooltip?: string;
danger?: string;
};
export type BemaniStandardPatch = BemaniBasePatch & {
type: undefined;
patches: {
offset: number;
on: number[];
off: number[];
}[];
};
export type BemaniUnionPatch = BemaniBasePatch & {
type: "union";
offset: number;
patches: {
name: string;
patch: number[];
}[];
};
export type BemaniNumberPatch = BemaniBasePatch & {
type: "number";
offset: number;
size: number;
min?: number;
max?: number;
};
export type BemaniDynamicStringPatch = BemaniBasePatch & {
type: "dynamic";
mode?: "all";
target: "string";
patches: {
off: string;
on: string;
}[];
};
export type BemaniDynamicPatch = BemaniBasePatch & {
type: "dynamic";
mode?: "all";
target: undefined;
patches: {
off: (number | "XX")[];
on: (number | "XX")[];
}[];
};
export type BemaniHexPatch = BemaniBasePatch & {
type: "hex";
offset: number;
off: number[];
};
export type BemaniPatch =
| BemaniStandardPatch
| BemaniUnionPatch
| BemaniNumberPatch
| BemaniDynamicPatch
| BemaniDynamicStringPatch
| BemaniHexPatch;
export type BemaniPatcherArgs = {
fname: string;
description: string;
patches: BemaniPatch[];
};
export type SpiceBasePatch = {
type: string;
name: string;
description: string;
gameCode: string;
};
export type SpiceMemoryPatch = SpiceBasePatch & {
type: "memory";
patches: {
offset: number;
dllName: string;
dataDisabled: string;
dataEnabled: string;
}[];
};
export type SpiceNumberPatch = SpiceBasePatch & {
type: "number";
patch: {
dllName: string;
offset: number;
min: number;
max: number;
size: number;
};
};
export type SpiceUnionPatch = SpiceBasePatch & {
type: "union";
patches: {
name: string;
patch: {
dllName: string;
data: string;
offset: number;
};
}[];
};
export type SpiceSignaturePatch = SpiceBasePatch & {
type: "signature";
signature: string;
replacement: string;
dllName: string;
/**
* The offset to start searching for the signature.
*/
offset?: number | string;
/**
* The number of matches to get before returning a result.
*/
usage?: number | string;
};
export type SpiceMetaPatch = {
gameCode: string;
version: string;
lastUpdated: string;
source: string;
};
export type SpicePatch = SpiceMemoryPatch | SpiceNumberPatch | SpiceUnionPatch | SpiceSignaturePatch;