mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
Merge pull request #5245 from TheTophatDemon/fix-odin-js-loadcstring
Fix odin.js loadCstring to use pointer address correctly.
This commit is contained in:
@@ -110,16 +110,12 @@ class WasmMemoryInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadCstring(ptr) {
|
loadCstring(ptr) {
|
||||||
return this.loadCstringDirect(this.loadPtr(ptr));
|
if (ptr == 0) {
|
||||||
}
|
|
||||||
|
|
||||||
loadCstringDirect(start) {
|
|
||||||
if (start == 0) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
let len = 0;
|
let len = 0;
|
||||||
for (; this.mem.getUint8(start+len) != 0; len += 1) {}
|
for (; this.mem.getUint8(ptr+len) != 0; len += 1) {}
|
||||||
return this.loadString(start, len);
|
return this.loadString(ptr, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
storeU8(addr, value) { this.mem.setUint8 (addr, value); }
|
storeU8(addr, value) { this.mem.setUint8 (addr, value); }
|
||||||
|
|||||||
Reference in New Issue
Block a user