通过DMA读取指定地址的整数 - DmaReadInt
函数简介
通过 DMA 读取指定地址的整数值。支持多种整数类型和 CE 地址格式。(高级版功能,普通版无法使用)
接口名称
DmaReadInt
DLL调用
int64_t OLA_CALL_TYPE DmaReadInt(int64_t instance, int64_t deviceId, int32_t pid, OLA_STRING_INPUT addr, int32_t type);
参数定义:
instance(长整型数): OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。deviceId(长整型数): 设备IDpid(整型数): 进程 PIDaddr(字符串): 地址,支持 CE 数据格式type(整型数): 整数类型
示例:
// 读取 32 位有符号整数
int64_t value = DmaReadInt(instance, deviceId, 1234, "0x400000", 0);
printf("32位有符号整数: %lld\n", value);
// 读取 16 位有符号整数
int64_t value2 = DmaReadInt(instance, deviceId, 1234, "0x400010", 1);
printf("16位有符号整数: %lld\n", value2);
// 读取 64 位整数
int64_t value3 = DmaReadInt(instance, deviceId, 1234, "0x400020", 3);
printf("64位整数: %lld\n", value3);
// 读取 32 位无符号整数
int64_t value4 = DmaReadInt(instance, deviceId, 1234, "0x400030", 4);
printf("32位无符号整数: %lld\n", value4);
// 使用 CE 格式地址
int64_t value5 = DmaReadInt(instance, deviceId, 1234, "[<Game.exe>+1234]+8+4", 0);
printf("CE格式地址读取: %lld\n", value5);
返回值
长整型数:
返回读取到的整数值(64 位)
参数说明
type(整数类型):
- 0: 32 位有符号
- 1: 16 位有符号
- 2: 8 位有符号
- 3: 64 位
- 4: 32 位无符号
- 5: 16 位无符号
- 6: 8 位无符号
addr(地址):
- 支持十六进制格式:
0x400000 - 支持 CE 格式:
[[[<module>+offset1]+offset2]+offset3] - 支持模块相对地址:
<Game.exe>+1234+8+4
应用场景
- 读取游戏数据
- 内存分析
- 动态地址解析
相关接口
- DmaReadIntAddr - 直接地址读取
- DmaReadFloat - 读取浮点数
- DmaReadDouble - 读取双精度浮点数
