Optimizing now optimized, Linux accommodations
This commit is contained in:
parent
f185dc072e
commit
d98bb4ff70
3 changed files with 26 additions and 17 deletions
|
@ -71,7 +71,12 @@ class SettingsWindow(QtWidgets.QDialog):
|
|||
|
||||
def setup_ui(self):
|
||||
self.setObjectName("Dialog")
|
||||
self.setFixedSize(300, 210)
|
||||
|
||||
if sys.platform == "win32":
|
||||
self.setFixedSize(300, 210)
|
||||
else:
|
||||
self.setFixedSize(370, 210)
|
||||
|
||||
self.setModal(True)
|
||||
icon = QtGui.QIcon()
|
||||
icon.addPixmap(QtGui.QPixmap(resource_path(os.path.join("bin", "icon.ico"))), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
|
@ -79,7 +84,12 @@ class SettingsWindow(QtWidgets.QDialog):
|
|||
|
||||
#Buttonbox
|
||||
self.buttonBox = QtWidgets.QDialogButtonBox(self)
|
||||
self.buttonBox.setFixedSize(280, 30)
|
||||
|
||||
if sys.platform == "win32":
|
||||
self.buttonBox.setFixedSize(280, 30)
|
||||
else:
|
||||
self.buttonBox.setFixedSize(350, 30)
|
||||
|
||||
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok)
|
||||
self.buttonBox.setObjectName("buttonBox")
|
||||
|
|
13
dolreader.py
13
dolreader.py
|
@ -1,7 +1,7 @@
|
|||
from io import BytesIO
|
||||
|
||||
import tools
|
||||
from fileutils import *
|
||||
from fileutils import read_uint32, write_uint32, align_byte_size
|
||||
|
||||
class UnmappedAddressError(Exception): pass
|
||||
class SectionCountFullError(Exception): pass
|
||||
|
@ -9,7 +9,7 @@ class AddressOutOfRangeError(Exception): pass
|
|||
|
||||
class DolFile(object):
|
||||
|
||||
class SectionType():
|
||||
class SectionType:
|
||||
Text = 0
|
||||
Data = 1
|
||||
|
||||
|
@ -64,7 +64,7 @@ class DolFile(object):
|
|||
return "Nintendo DOL format executable for the Wii and Gamecube"
|
||||
|
||||
# Internal function for
|
||||
def resolve_address(self, gcAddr) -> tuple:
|
||||
def resolve_address(self, gcAddr: int) -> tuple:
|
||||
""" Returns the data of the section that houses the given address\n
|
||||
UnmappedAddressError is raised when the address is unmapped """
|
||||
|
||||
|
@ -77,7 +77,7 @@ class DolFile(object):
|
|||
|
||||
raise UnmappedAddressError(f"Unmapped address: 0x{gcAddr:X}")
|
||||
|
||||
def seek_nearest_unmapped(self, gcAddr, buffer=0) -> int:
|
||||
def seek_nearest_unmapped(self, gcAddr: int, buffer=0) -> int:
|
||||
'''Returns the nearest unmapped address (greater) if the given address is already taken by data'''
|
||||
|
||||
for _, address, size, _, _ in self.textSections:
|
||||
|
@ -316,10 +316,7 @@ class DolFile(object):
|
|||
self.seek(bAddr)
|
||||
|
||||
ppc = read_uint32(self)
|
||||
conditional = False
|
||||
|
||||
if (ppc >> 24) & 0xFF < 0x48:
|
||||
conditional = True
|
||||
conditional = (ppc >> 24) & 0xFF < 0x48
|
||||
|
||||
if conditional is True:
|
||||
if (ppc & 0x8000):
|
||||
|
|
16
kernel.py
16
kernel.py
|
@ -48,10 +48,9 @@ class GCT(object):
|
|||
or codetype.startswith(b'\x18') or codetype.startswith(b'\x18')):
|
||||
return 0x16
|
||||
|
||||
elif (codetype.startswith(b'\xC2') or codetype.startswith(b'\xC4')
|
||||
or codetype.startswith(b'\xC3') or codetype.startswith(b'\xC5')
|
||||
or codetype.startswith(b'\xD2') or codetype.startswith(b'\xD4')
|
||||
or codetype.startswith(b'\xD3') or codetype.startswith(b'\xD5')):
|
||||
elif (codetype.startswith(b'\xC0') or codetype.startswith(b'\xC2') or codetype.startswith(b'\xC4')
|
||||
or codetype.startswith(b'\xC3') or codetype.startswith(b'\xC5') or codetype.startswith(b'\xD2')
|
||||
or codetype.startswith(b'\xD4') or codetype.startswith(b'\xD3') or codetype.startswith(b'\xD5')):
|
||||
return 0x8 + (int.from_bytes(info, byteorder='big', signed=False) << 3)
|
||||
|
||||
elif (codetype.startswith(b'\xF2') or codetype.startswith(b'\xF3')
|
||||
|
@ -68,10 +67,13 @@ class GCT(object):
|
|||
codelist = b'\x00\xD0\xC0\xDE'*2
|
||||
skipcodes = 0
|
||||
|
||||
with open(os.path.join(os.path.expanduser("~"), "Desktop", "suss.gct"), "wb") as suss:
|
||||
suss.write(self.codeList.getbuffer())
|
||||
|
||||
self.codeList.seek(8)
|
||||
while codetype := self.codeList.read(4):
|
||||
info = self.codeList.read(4)
|
||||
address = 0x80000000 | (int.from_bytes(codetype, byteorder='big', signed=False) & 0x01FFFFFF)
|
||||
address = 0x80000000 | (int.from_bytes(codetype, byteorder='big', signed=False) & 0x1FFFFFF)
|
||||
try:
|
||||
if skipcodes <= 0:
|
||||
if (codetype.startswith(b'\x00') or codetype.startswith(b'\x01')
|
||||
|
@ -153,7 +155,7 @@ class GCT(object):
|
|||
elif (codetype.startswith(b'\xC6') or codetype.startswith(b'\xC7')
|
||||
or codetype.startswith(b'\xC6') or codetype.startswith(b'\xC7')):
|
||||
dolFile.seek(address)
|
||||
dolFile.insert_branch(int.from_bytes(info, byteorder='big', signed=False), dolFile.tell())
|
||||
dolFile.insert_branch(int.from_bytes(info, byteorder='big', signed=False), address)
|
||||
continue
|
||||
|
||||
if codetype.hex().startswith('2') or codetype.hex().startswith('3'):
|
||||
|
@ -166,7 +168,7 @@ class GCT(object):
|
|||
codelist += b'\xF0\x00\x00\x00\x00\x00\x00\x00'
|
||||
break
|
||||
|
||||
self.codeList.seek(-8, 1)*5
|
||||
self.codeList.seek(-8, 1)
|
||||
|
||||
length = GCT.determine_codelength(codetype, info)
|
||||
while length > 0:
|
||||
|
|
Reference in a new issue