mirror of
https://github.com/Virtual-World-RE/NeoGF.git
synced 2024-11-15 08:45:33 +01:00
Update doltool.py
This commit is contained in:
parent
c10625b378
commit
dd3d42461e
|
@ -3,7 +3,7 @@ import logging
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
__version__ = "0.0.4"
|
__version__ = "0.0.5"
|
||||||
__author__ = "rigodron, algoflash, GGLinnk"
|
__author__ = "rigodron, algoflash, GGLinnk"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__status__ = "developpement"
|
__status__ = "developpement"
|
||||||
|
@ -126,14 +126,14 @@ class Dol:
|
||||||
def resolve_img2virtual(self, offset:int):
|
def resolve_img2virtual(self, offset:int):
|
||||||
memory_address = None
|
memory_address = None
|
||||||
for section_info in self.__sections_info:
|
for section_info in self.__sections_info:
|
||||||
if section_info[0] == 0: continue
|
if not section_info[3]: continue
|
||||||
if offset >= section_info[0] and offset < section_info[0] + section_info[2]:
|
if offset >= section_info[0] and offset < section_info[0] + section_info[2]:
|
||||||
return section_info[1] + offset - section_info[0]
|
return section_info[1] + offset - section_info[0]
|
||||||
raise InvalidImgOffsetError(f"Not found: {offset:08x}")
|
raise InvalidImgOffsetError(f"Not found: {offset:08x}")
|
||||||
# Resolve a virtual memory address to a dol absolute offset
|
# Resolve a virtual memory address to a dol absolute offset
|
||||||
def resolve_virtual2img(self, address:int):
|
def resolve_virtual2img(self, address:int):
|
||||||
for section_info in self.__sections_info:
|
for section_info in self.__sections_info:
|
||||||
if section_info[0] == 0: continue
|
if not section_info[3]: continue
|
||||||
if address >= section_info[1] and address < section_info[1] + section_info[2]:
|
if address >= section_info[1] and address < section_info[1] + section_info[2]:
|
||||||
return section_info[0] + address - section_info[1]
|
return section_info[0] + address - section_info[1]
|
||||||
raise InvalidVirtualAddressError(f"Not found in dol initial segments: {address:08x}")
|
raise InvalidVirtualAddressError(f"Not found in dol initial segments: {address:08x}")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user