hacktools 0.38.4__tar.gz → 0.38.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hacktools-0.38.4 → hacktools-0.38.6}/LICENSE +1 -1
- {hacktools-0.38.4/hacktools.egg-info → hacktools-0.38.6}/PKG-INFO +3 -2
- hacktools-0.38.6/hacktools/__init__.py +1 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools/common.py +30 -3
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools/nds.py +1 -1
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools/nitro.py +1 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools/psp.py +1 -1
- {hacktools-0.38.4 → hacktools-0.38.6/hacktools.egg-info}/PKG-INFO +3 -2
- hacktools-0.38.4/hacktools/__init__.py +0 -1
- {hacktools-0.38.4 → hacktools-0.38.6}/MANIFEST.in +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/README.md +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools/arch.py +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools/assets/icon.png +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools/c_ext/cmp_cri.c +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools/c_ext/cmp_lzss.c +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools/c_ext/cmp_misc.c +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools/c_ext/cmp_racjin.c +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools/c_ext/inc.h +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools/compression.py +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools/cpk.py +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools/gb.py +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools/gui.py +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools/nasm.py +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools/psx.py +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools/wii.py +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools/ws.py +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools.egg-info/SOURCES.txt +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools.egg-info/dependency_links.txt +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools.egg-info/requires.txt +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/hacktools.egg-info/top_level.txt +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/setup.cfg +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/setup.py +0 -0
- {hacktools-0.38.4 → hacktools-0.38.6}/tests/test_cmp.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: hacktools
|
|
3
|
-
Version: 0.38.
|
|
3
|
+
Version: 0.38.6
|
|
4
4
|
Summary: A set of utilities and tools for rom hacking and translations.
|
|
5
5
|
Home-page: https://github.com/Illidanz/hacktools
|
|
6
6
|
Author: Illidan
|
|
@@ -52,6 +52,7 @@ Dynamic: classifier
|
|
|
52
52
|
Dynamic: description
|
|
53
53
|
Dynamic: description-content-type
|
|
54
54
|
Dynamic: home-page
|
|
55
|
+
Dynamic: license-file
|
|
55
56
|
Dynamic: provides-extra
|
|
56
57
|
Dynamic: requires-python
|
|
57
58
|
Dynamic: summary
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.38.6"
|
|
@@ -504,7 +504,7 @@ def logDebug(*messages):
|
|
|
504
504
|
|
|
505
505
|
def logWarning(*messages):
|
|
506
506
|
message = " ".join(str(x) for x in messages)
|
|
507
|
-
logging.debug("[WARNING]" + message)
|
|
507
|
+
logging.debug("[WARNING] " + message)
|
|
508
508
|
|
|
509
509
|
|
|
510
510
|
def logError(*messages):
|
|
@@ -759,10 +759,12 @@ class TranslationFile:
|
|
|
759
759
|
|
|
760
760
|
def preloadLookup(self, comments="#"):
|
|
761
761
|
self.lookup = {}
|
|
762
|
+
self.offlookup = {}
|
|
762
763
|
self.chartot = 0
|
|
763
764
|
self.transtot = 0
|
|
764
765
|
for file in self.files:
|
|
765
766
|
for unit in self.files[file][0]:
|
|
767
|
+
self.offlookup[int(unit.attrib["id"])] = unit[0].text
|
|
766
768
|
self.chartot += len(unit[0].text)
|
|
767
769
|
if unit[1].text is not None and unit[1].text != "":
|
|
768
770
|
if comments in unit[1].text:
|
|
@@ -770,6 +772,13 @@ class TranslationFile:
|
|
|
770
772
|
self.lookup[unit[0].text] = unit[1].text
|
|
771
773
|
self.transtot += len(unit[0].text)
|
|
772
774
|
|
|
775
|
+
def preloadOffsets(self):
|
|
776
|
+
self.offsets = {}
|
|
777
|
+
for file in self.files:
|
|
778
|
+
self.offsets[file] = []
|
|
779
|
+
for unit in self.files[file][0]:
|
|
780
|
+
self.offsets[file].append(int(unit.attrib["id"]))
|
|
781
|
+
|
|
773
782
|
def getEntry(self, text, filename, offset):
|
|
774
783
|
stroffset = str(offset)
|
|
775
784
|
if filename in self.files:
|
|
@@ -786,6 +795,19 @@ class TranslationFile:
|
|
|
786
795
|
return self.lookup[text]
|
|
787
796
|
return ""
|
|
788
797
|
|
|
798
|
+
def setEntry(self, text, filename, offset, newtext):
|
|
799
|
+
stroffset = str(offset)
|
|
800
|
+
if filename in self.files:
|
|
801
|
+
# Try to match offset
|
|
802
|
+
for unit in self.files[filename][0]:
|
|
803
|
+
if unit.attrib["id"] == stroffset:
|
|
804
|
+
unit[1].text = newtext
|
|
805
|
+
return
|
|
806
|
+
# Try to match string
|
|
807
|
+
for unit in self.files[filename][0]:
|
|
808
|
+
if unit[0].text == text:
|
|
809
|
+
unit[1].text = newtext
|
|
810
|
+
|
|
789
811
|
def hasFile(self, filename):
|
|
790
812
|
return filename in self.files
|
|
791
813
|
|
|
@@ -802,6 +824,7 @@ class TranslationFile:
|
|
|
802
824
|
xmlstr = ET.tostring(self.root, encoding="unicode", xml_declaration=True)
|
|
803
825
|
# Change this to match what Weblate does
|
|
804
826
|
xmlstr = xmlstr.replace("<target />", "<target/>") + "\n"
|
|
827
|
+
xmlstr = xmlstr.replace("<?xml version='1.0' encoding='utf-8'?>", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
|
|
805
828
|
with codecs.open(filename, "w", "utf-8") as f:
|
|
806
829
|
f.write(xmlstr)
|
|
807
830
|
|
|
@@ -1001,6 +1024,10 @@ def writeEncodedString(f, s, maxlen=0, encoding="shift_jis", zerobytes=1):
|
|
|
1001
1024
|
i += 2
|
|
1002
1025
|
x += 1
|
|
1003
1026
|
if zerobytes > 0:
|
|
1027
|
+
if zerobytes > 1:
|
|
1028
|
+
if maxlen > 0 and i+1 > maxlen:
|
|
1029
|
+
return -1
|
|
1030
|
+
i += zerobytes - 1
|
|
1004
1031
|
f.writeZero(zerobytes)
|
|
1005
1032
|
return i
|
|
1006
1033
|
|
|
@@ -1017,7 +1044,7 @@ def extractBinaryStrings(infile, binranges, func=detectEncodedString, encoding="
|
|
|
1017
1044
|
check = func(f, encoding)
|
|
1018
1045
|
if check != "":
|
|
1019
1046
|
if check not in strings:
|
|
1020
|
-
logDebug("Found string at", pos)
|
|
1047
|
+
logDebug("Found string", check, "at", toHex(pos))
|
|
1021
1048
|
strings.append(check)
|
|
1022
1049
|
positions.append([pos])
|
|
1023
1050
|
else:
|
|
@@ -1078,7 +1105,7 @@ def repackBinaryStrings(section, infile, outfile, binranges, freeranges=None, re
|
|
|
1078
1105
|
else:
|
|
1079
1106
|
# Add this to the freeranges
|
|
1080
1107
|
freeranges.append([pos, endpos])
|
|
1081
|
-
logDebug("Adding new
|
|
1108
|
+
logDebug("Adding new freerange", toHex(pos), toHex(endpos))
|
|
1082
1109
|
range = None
|
|
1083
1110
|
rangelen = 0
|
|
1084
1111
|
for c in newsjis:
|
|
@@ -149,7 +149,7 @@ def repackBIN(binrange, freeranges=[], readfunc=common.detectEncodedString, writ
|
|
|
149
149
|
chartot, transtot = common.getSectionPercentage(section)
|
|
150
150
|
else:
|
|
151
151
|
section = common.TranslationFile(binfile)
|
|
152
|
-
section.preloadLookup()
|
|
152
|
+
section.preloadLookup(comments)
|
|
153
153
|
if type(binrange) == tuple:
|
|
154
154
|
binrange = [binrange]
|
|
155
155
|
notfound = common.repackBinaryStrings(section, binin, binout, binrange, freeranges, readfunc, writefunc, encoding, pointerstart, injectstart, fallbackf, injectfallback, sectionname, preformat, postformat)
|
|
@@ -87,7 +87,7 @@ class UMDFile():
|
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
def repackUMD(umdfile, umdpatch, workfolder, patchfile="", sectorpadding=1):
|
|
90
|
-
common.logMessage("Repacking UMD", umdpatch, "...")
|
|
90
|
+
common.logMessage("Repacking ISO/UMD", umdpatch, "...")
|
|
91
91
|
allfiles = common.getFiles(workfolder)
|
|
92
92
|
isofiles = []
|
|
93
93
|
with common.Stream(umdfile, "rb") as fin:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: hacktools
|
|
3
|
-
Version: 0.38.
|
|
3
|
+
Version: 0.38.6
|
|
4
4
|
Summary: A set of utilities and tools for rom hacking and translations.
|
|
5
5
|
Home-page: https://github.com/Illidanz/hacktools
|
|
6
6
|
Author: Illidan
|
|
@@ -52,6 +52,7 @@ Dynamic: classifier
|
|
|
52
52
|
Dynamic: description
|
|
53
53
|
Dynamic: description-content-type
|
|
54
54
|
Dynamic: home-page
|
|
55
|
+
Dynamic: license-file
|
|
55
56
|
Dynamic: provides-extra
|
|
56
57
|
Dynamic: requires-python
|
|
57
58
|
Dynamic: summary
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.38.4"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|