Skip to content

Commit

Permalink
Fix id being decoded as an signed integer instead of an unsigned inte…
Browse files Browse the repository at this point in the history
…ger. (#660)
  • Loading branch information
zarstensen committed Jun 5, 2024
1 parent df445b8 commit 5a89c5f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/debugger/godot3/server_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,15 @@ export class ServerController {
break;
}
case "message:inspect_object": {
const id = BigInt(command.parameters[0]);
let id = BigInt(command.parameters[0]);
const className: string = command.parameters[1];
const properties: any[] = command.parameters[2];

// message:inspect_object returns the id as an unsigned 64 bit integer, but it is decoded as a signed 64 bit integer,
// thus we need to convert it to its equivalent unsigned value here.
if(id < 0)
id = id + BigInt(2) ** BigInt(64);

const rawObject = new RawObject(className);
properties.forEach((prop) => {
rawObject.set(prop[0], prop[5]);
Expand Down
7 changes: 6 additions & 1 deletion src/debugger/godot4/server_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,15 @@ export class ServerController {
break;
}
case "scene:inspect_object": {
const id = BigInt(command.parameters[0]);
let id = BigInt(command.parameters[0]);
const className: string = command.parameters[1];
const properties: any[] = command.parameters[2];

// message:inspect_object returns the id as an unsigned 64 bit integer, but it is decoded as a signed 64 bit integer,
// thus we need to convert it to its equivalent unsigned value here.
if(id < 0)
id = id + BigInt(2) ** BigInt(64);

const rawObject = new RawObject(className);
properties.forEach((prop) => {
rawObject.set(prop[0], prop[5]);
Expand Down

0 comments on commit 5a89c5f

Please sign in to comment.