mirror of
				https://github.com/Virtual-World-RE/NeoGF.git
				synced 2025-11-04 01:40:30 +01:00 
			
		
		
		
	Update doltool.py
This commit is contained in:
		@@ -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}")
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user