Skip to content

Commit

Permalink
Float read support
Browse files Browse the repository at this point in the history
  • Loading branch information
SindreVatnaland committed Oct 15, 2023
1 parent 521574f commit a1caab6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dolphin-memory-reader",
"version": "0.2.1",
"version": "0.2.2",
"description": "Node module that can read memory from the Dolphin Emulator",
"main": "dist/index.js",
"scripts": {
Expand Down
8 changes: 8 additions & 0 deletions src/dolphin_mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ enum ByteSize {
U8 = 8,
U16 = 16,
U32 = 32,
U32Float = 33,
}

struct DolphinMemoryFinderWindows;
Expand Down Expand Up @@ -302,6 +303,13 @@ impl DolphinMemoryJs {
None => return cx.throw_error(READ_ERROR_MESSAGE),
}
}
ByteSize::U32Float => {
let value = memory.read::<f32>(address);
match value {
Some(value_js) => cx.number(value_js),
None => return cx.throw_error(READ_ERROR_MESSAGE),
}
}
};

Ok(memory_value)
Expand Down
1 change: 1 addition & 0 deletions src/node/types/enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export enum ByteSize {
U8 = 8,
U16 = 16,
U32 = 32,
U32Float = 33,
}

0 comments on commit a1caab6

Please sign in to comment.