Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/346.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 读取存储在内存位置的值_Python_Linux - Fatal编程技术网

Python 读取存储在内存位置的值

Python 读取存储在内存位置的值,python,linux,Python,Linux,我有一个.dat文件,它(我相信)在名为hiscore.dat的文件中存储了advmame中的高分。据我所知,.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中,有没有办法读

我有一个.dat文件,它(我相信)在名为
hiscore.dat
的文件中存储了
advmame
中的高分。据我所知,.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]

MAME是用于街机游戏系统的各种计算机的仿真器。该文件中引用的“内存地址”是模拟机器内存中的地址,而不是您自己的系统内存中的地址。虽然可以在MAME运行游戏时使用操作系统的调试挂钩来窥探它的内存,并在内存中找到模拟系统的内存(然后在模拟内存中查找游戏的高分),但我怀疑这会带来更多的麻烦


事实上,遵循您提供的“信息”链接表明,
highscores.dat
的全部意义在于告诉MAME如何在正在运行的游戏中找到高分,以便它可以为您保存它们(我想是保存到其他文件中)。该链接是关于作者申请保存分数的经验。

我非常怀疑该文件是否存储了分数的存储位置-内存是一个临时存储系统,在计算机重新启动或游戏关闭后不会被保存。你确定这些值本身不是高分吗?我严重怀疑内存地址是否存储在文件中。当游戏结束时,存储在该地址中的内容将被简单地删除。我站在怀疑者的立场上:-)但有时尝试更快,无论如何,使用ctypes模块直接读取内存来查看此答案。就像我说的,“我相信”和“我可能错了”,你们可能都是对的该数据的实际分数和首字母是多少?
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.