读取存储在内存位置的值

1 投票
1 回答
555 浏览
提问于 2025-04-17 21:34

我有一个.dat文件,我认为它存储了在advmame中的高分,这个文件叫hiscore.dat。根据我的理解,虽然我可能错了,这个.dat文件里记录了游戏的名字和该游戏高分的内存地址:

foogame:  ;******foo game
0:6105:9e:10:10
0:7661:1:10:10
0:7641:1:00:00
0:7621:1:00:00
0:7601:1:07:07
0:75e1:1:06:06
0:75c1:1:05:05
0:75a1:1:00:00

在Python中,有没有办法读取这些内存地址存储的值呢?

编辑 - 根据文件顶部的说明:

;This file should be in the same directory of MAME.EXE .
;
;This file can be edited with a text editor, but keep the same format:
; all fields are separated by a colon (:)
; <gamename>:
; <cpu>:<address>:<length>:<value to wait for
; in the first byte/word>:<value to wait for in the last byte/word>
; [repeat the above as many times as necessary]

关于hiscore.dat的一些额外信息:

关于mame的hiscore.dat的信息

A hiscore.dat file is needed so your modified version of MAME will read to know which memory addresses contain the high scores for supported games. 

1 个回答

1

MAME是一个模拟器,用来模拟各种在街机游戏系统中使用的计算机。文中提到的“内存地址”其实是指模拟机器的内存地址,而不是你自己电脑的内存。虽然有可能通过你操作系统的调试工具在MAME运行游戏时查看它的内存,并找到模拟系统的内存(然后查找游戏的高分),但我觉得这样做会麻烦得多,不太值得。

实际上,你提供的“信息”链接显示,highscores.dat的主要作用是告诉MAME如何在运行的游戏中找到高分,这样它就能为你保存这些高分(我想是保存到其他文件中)。这个链接讲述了作者在应用一个补丁来实现这个保存功能时的经历。

撰写回答