Skip to content

Commit 5a89c5f

Browse files
committed
Fix id being decoded as an signed integer instead of an unsigned integer. (#660)
1 parent df445b8 commit 5a89c5f

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/debugger/godot3/server_controller.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,15 @@ export class ServerController {
375375
break;
376376
}
377377
case "message:inspect_object": {
378-
const id = BigInt(command.parameters[0]);
378+
let id = BigInt(command.parameters[0]);
379379
const className: string = command.parameters[1];
380380
const properties: any[] = command.parameters[2];
381381

382+
// message:inspect_object returns the id as an unsigned 64 bit integer, but it is decoded as a signed 64 bit integer,
383+
// thus we need to convert it to its equivalent unsigned value here.
384+
if(id < 0)
385+
id = id + BigInt(2) ** BigInt(64);
386+
382387
const rawObject = new RawObject(className);
383388
properties.forEach((prop) => {
384389
rawObject.set(prop[0], prop[5]);

src/debugger/godot4/server_controller.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,15 @@ export class ServerController {
374374
break;
375375
}
376376
case "scene:inspect_object": {
377-
const id = BigInt(command.parameters[0]);
377+
let id = BigInt(command.parameters[0]);
378378
const className: string = command.parameters[1];
379379
const properties: any[] = command.parameters[2];
380380

381+
// message:inspect_object returns the id as an unsigned 64 bit integer, but it is decoded as a signed 64 bit integer,
382+
// thus we need to convert it to its equivalent unsigned value here.
383+
if(id < 0)
384+
id = id + BigInt(2) ** BigInt(64);
385+
381386
const rawObject = new RawObject(className);
382387
properties.forEach((prop) => {
383388
rawObject.set(prop[0], prop[5]);

0 commit comments

Comments
 (0)