there's这个Eoscripten端口的DosBox(一个Dos模拟器)允许在浏览器中运行旧的dos软件。现在我想要实现的是创建某种内存扫描程序,允许调整dosbox中的一些内存值。我查看了Google Chrome配置文件标签,它显示DosBox创建了一个看起来像整个程序内存的大型UInt数组,但我不知道如何访问它。
有什么想法吗?提前谢谢!
答案 0 :(得分:1)
Emscripten的默认设置将Module
对象放在页面的全局范围内,该对象包含充当程序内存的数组缓冲区的各种视图。例如,
Module.HEAPU8
是Uint8Array
视图。查看使用Emscripten的https://archive.org/details/msdos_Prince_of_Persia_1990控制台,完整列表为:
Module.HEAP16
Module.HEAP32
Module.HEAPF32
Module.HEAPF64
Module.HEAPU8
Module.HEAPU16
Module.HEAPU32
答案 1 :(得分:0)
仅供参考,以下是我用过的扫描仪代码
class MemoryScanner {
constructor(target) {
this.set = new Set();
this.target = target;
}
search(value) {
let target = this.target, length = target.length, set = this.set;
for (let i = 0; i < length; i++) {
if (target[i] === value) {
set.add(i);
}
}
}
search2(value1, value2) {
let target = this.target, length = target.length, set = this.set;
for (let i = 0; i < length; i++) {
if (target[i] === value1 && target[i + 1] === value2) {
set.add(i);
}
}
}
search4(value1, value2, value3, value4) {
let target = this.target, length = target.length, set = this.set;
for (let i = 0; i < length; i++) {
if (target[i + 0] === value1 &&
target[i + 1] === value2 &&
target[i + 2] === value3 &&
target[i + 3] === value4) {
set.add(i);
}
}
}
search8(value1, value2, value3, value4, value5, value6, value7, value8) {
let target = this.target, length = target.length, set = this.set;
for (let i = 0; i < length; i++) {
if (target[i + 0] === value1 &&
target[i + 1] === value2 &&
target[i + 2] === value3 &&
target[i + 3] === value4 &&
target[i + 4] === value5 &&
target[i + 5] === value6 &&
target[i + 6] === value7 &&
target[i + 7] === value8) {
set.add(i);
}
}
}
intersect(value) {
let target = this.target, length = target.length, set = this.set;
for (let index of this.set) {
if (target[index] !== value) {
set.delete(index)
}
}
}
intersect2(value1, value2) {
let target = this.target, length = target.length, set = this.set;
for (let index of this.set) {
if (target[index] !== value1 || target[index + 1] !== value2) {
set.delete(index)
}
}
}
intersect4(value1, value2, value3, value4) {
let target = this.target, length = target.length, set = this.set;
for (let index of this.set) {
if (target[index + 0] !== value1 ||
target[index + 1] !== value2 ||
target[index + 2] !== value3 ||
target[index + 3] !== value4) {
set.delete(index)
}
}
}
intersect8(value1, value2, value3, value4, value5, value6, value7, value8) {
let target = this.target, length = target.length, set = this.set;
for (let index of this.set) {
if (target[index + 0] !== value1 ||
target[index + 1] !== value2 ||
target[index + 2] !== value3 ||
target[index + 3] !== value4 ||
target[index + 4] !== value5 ||
target[index + 5] !== value6 ||
target[index + 6] !== value7 ||
target[index + 7] !== value8) {
set.delete(index)
}
}
}
}