Skip to content

Commit

Permalink
fix: support for SDBEGINS and SDBEGINSQ ops, now we correctly decompi…
Browse files Browse the repository at this point in the history
…le wallet v5

Fixes #19
  • Loading branch information
i582 committed Jan 17, 2025
1 parent 3948087 commit cb6c86f
Show file tree
Hide file tree
Showing 6 changed files with 392 additions and 11 deletions.
4 changes: 2 additions & 2 deletions reference/opcodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ opcodes:
SDSUBSTR:
SDBEGINSX:
SDBEGINSXQ:
SDBEGINS:
SDBEGINSQ:
SDBEGINS: ["int"]
SDBEGINSQ: ["int"]
SCUTFIRST:
SSKIPFIRST:
SCUTLAST:
Expand Down
6 changes: 3 additions & 3 deletions src/codepage/opcodes.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ export type OpCodeWithArgs =
| { code: 'PLDSLICE', args: [number] }
| { code: 'LDSLICEQ', args: [number] }
| { code: 'PLDSLICEQ', args: [number] }
| { code: 'SDBEGINS', args: [number] }
| { code: 'SDBEGINSQ', args: [number] }
| { code: 'PLDREFIDX', args: [number] }
| { code: 'CALLXARGS', args: [number, number] }
| { code: 'JMPXARGS', args: [number] }
Expand Down Expand Up @@ -309,8 +311,6 @@ export type OpCodeNoArgs =
| { code: 'SDSUBSTR' }
| { code: 'SDBEGINSX' }
| { code: 'SDBEGINSXQ' }
| { code: 'SDBEGINS' }
| { code: 'SDBEGINSQ' }
| { code: 'SCUTFIRST' }
| { code: 'SSKIPFIRST' }
| { code: 'SCUTLAST' }
Expand Down Expand Up @@ -682,4 +682,4 @@ export type OpCodeNoArgs =
| { code: 'CHASHIX' }
| { code: 'CDEPTHIX' };

export type OpCode = OpCodeWithArgs | OpCodeNoArgs;
export type OpCode = OpCodeWithArgs | OpCodeNoArgs;
17 changes: 12 additions & 5 deletions src/codepage/opcodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -623,10 +623,17 @@ CP0Auto.insertHex('d723', 16, { code: 'SDSKIPLAST' });
CP0Auto.insertHex('d724', 16, { code: 'SDSUBSTR' });
// 14099712 (DUMMY)
CP0Auto.insertHex('d726', 16, { code: 'SDBEGINSX' });
CP0Auto.insertHex('d727', 16, { code: 'SDBEGINSXQ' });
CP0Auto.insertHex('d728', 13, (slice) => {
let args = slice.loadUint(8);
return { code: 'SDBEGINS', args: [args] };
CP0Auto.insertHex('d72C', 16, (slice) => {
let len = slice.loadUint(8);
return { code: 'SDBEGINS', args: [len] };
});
CP0Auto.insertHex('D728', 16, (slice) => {
let len = slice.loadUint(8);
return { code: 'SDBEGINS', args: [len] };
});
CP0Auto.insertHex('d72E', 16, (slice) => {
let len = slice.loadUint(8);
return { code: 'SDBEGINSQ', args: [len] };
});
CP0Auto.insertHex('d730', 16, { code: 'SCUTFIRST' });
CP0Auto.insertHex('d731', 16, { code: 'SSKIPFIRST' });
Expand Down Expand Up @@ -1273,4 +1280,4 @@ function skipSubslice(slice: Slice, bits: number, refs?: number) {
for (let i = 0; i < (refs || 0); i++) {
slice.loadRef();
}
}
}
Loading

0 comments on commit cb6c86f

Please sign in to comment.