mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-23 01:57:29 +00:00
Patch mismatch methods
This commit is contained in:
parent
660de918a3
commit
e2ca45cc76
2 changed files with 46 additions and 5 deletions
6
modern/__generated__/makiInterfaces.ts
generated
6
modern/__generated__/makiInterfaces.ts
generated
|
|
@ -258,7 +258,7 @@ export interface Wac extends MakiObject {
|
|||
show(): void;
|
||||
hide(): void;
|
||||
isvisible(): boolean;
|
||||
onnotify(notifstr: string, a: number, b: number): void;
|
||||
onnotify(command: string, param: string, a: number, b: number): number;
|
||||
onshow(): void;
|
||||
onhide(): void;
|
||||
setstatusbar(onoff: boolean): void;
|
||||
|
|
@ -731,7 +731,7 @@ export interface GuiList extends GuiObject {
|
|||
setminimumsize(size: number): void;
|
||||
getwantautodeselect(): number;
|
||||
setwantautodeselect(want: number): void;
|
||||
onsetvisible(show: number): void;
|
||||
onsetvisible(show: boolean): void;
|
||||
setautosort(dosort: number): void;
|
||||
setfontsize(size: number): number;
|
||||
getfontsize(): number;
|
||||
|
|
@ -798,7 +798,7 @@ export interface GuiTree extends GuiObject {
|
|||
onmousewheelup(clicked: number, lines: number): number;
|
||||
onmousewheeldown(clicked: number, lines: number): number;
|
||||
oncontextmenu(x: number, y: number): number;
|
||||
onchar(c: number): number;
|
||||
onchar(c: string): number;
|
||||
onitemrecvdrop(item: TreeItem): void;
|
||||
onlabelchange(item: TreeItem): void;
|
||||
onitemselected(item: TreeItem): void;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,17 @@
|
|||
const std = require("./std.json");
|
||||
|
||||
const NAME_TO_DEF = {};
|
||||
|
||||
Object.values(std).forEach(value => {
|
||||
NAME_TO_DEF[value.name] = value;
|
||||
});
|
||||
|
||||
function getMethod(className, methodName) {
|
||||
return NAME_TO_DEF[className].functions.find(({ name }) => {
|
||||
return name === methodName;
|
||||
});
|
||||
}
|
||||
|
||||
// Between myself and the author of the decompiler, a number of manual tweaks
|
||||
// have been made to our current object definitions. This function recreates
|
||||
// those tweaks so we can have an apples to apples comparison.
|
||||
|
|
@ -10,13 +22,42 @@ const std = require("./std.json");
|
|||
* > The std.mi has this set as void, but we checked in Winamp and confirmed it
|
||||
* > returns 0/1
|
||||
*/
|
||||
std["5D0C5BB67DE14b1fA70F8D1659941941"].functions[5].result = "boolean";
|
||||
getMethod("Timer", "isRunning").result = "boolean";
|
||||
|
||||
/*
|
||||
* From Object.pm
|
||||
*
|
||||
* > note, std.mi does not have this parameter!
|
||||
*/
|
||||
std.B4DCCFFF81FE4bcc961B720FD5BE0FFF.functions[0].parameters[0][1] = "onoff";
|
||||
getMethod("ToggleButton", "onToggle").parameters[0][1] = "onoff";
|
||||
|
||||
// Some methods are not compatible with the type signature of their parent class
|
||||
getMethod("GuiTree", "onChar").parameters[0][0] = "string";
|
||||
getMethod("GuiList", "onSetVisible").parameters[0][0] = "boolean";
|
||||
|
||||
// I'm not sure how to get these to match
|
||||
getMethod("Wac", "onNotify").parameters = getMethod(
|
||||
"Object",
|
||||
"onNotify"
|
||||
).parameters;
|
||||
getMethod("Wac", "onNotify").result = "number";
|
||||
|
||||
/*
|
||||
|
||||
Here's the error we get without that patch:
|
||||
|
||||
modern/__generated__/makiInterfaces.ts:254:18 - error TS2430: Interface 'Wac' incorrectly extends interface 'MakiObject'.
|
||||
Types of property 'onnotify' are incompatible.
|
||||
Type '(notifstr: string, a: number, b: number) => void' is not assignable to type '(command: string, param: string, a: number, b: number) => number'.
|
||||
Types of parameters 'a' and 'param' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
|
||||
254 export interface Wac extends MakiObject {
|
||||
~~~
|
||||
|
||||
|
||||
Found 1 error.
|
||||
|
||||
*/
|
||||
|
||||
module.exports = std;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue