hacktools 0.38.5__tar.gz → 0.38.7__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.5/hacktools.egg-info → hacktools-0.38.7}/PKG-INFO +3 -2
- hacktools-0.38.7/hacktools/__init__.py +1 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools/common.py +25 -2
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools/nds.py +1 -1
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools/nitro.py +1 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools/psp.py +1 -1
- {hacktools-0.38.5 → hacktools-0.38.7/hacktools.egg-info}/PKG-INFO +3 -2
- hacktools-0.38.5/hacktools/__init__.py +0 -1
- {hacktools-0.38.5 → hacktools-0.38.7}/LICENSE +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/MANIFEST.in +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/README.md +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools/arch.py +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools/assets/icon.png +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools/c_ext/cmp_cri.c +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools/c_ext/cmp_lzss.c +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools/c_ext/cmp_misc.c +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools/c_ext/cmp_racjin.c +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools/c_ext/inc.h +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools/compression.py +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools/cpk.py +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools/gb.py +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools/gui.py +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools/nasm.py +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools/psx.py +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools/wii.py +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools/ws.py +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools.egg-info/SOURCES.txt +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools.egg-info/dependency_links.txt +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools.egg-info/requires.txt +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/hacktools.egg-info/top_level.txt +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/setup.cfg +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/setup.py +0 -0
- {hacktools-0.38.5 → hacktools-0.38.7}/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.7
|
|
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.7"
|
|
@@ -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
|
|
|
@@ -1021,7 +1044,7 @@ def extractBinaryStrings(infile, binranges, func=detectEncodedString, encoding="
|
|
|
1021
1044
|
check = func(f, encoding)
|
|
1022
1045
|
if check != "":
|
|
1023
1046
|
if check not in strings:
|
|
1024
|
-
logDebug("Found string at", pos)
|
|
1047
|
+
logDebug("Found string", check, "at", toHex(pos))
|
|
1025
1048
|
strings.append(check)
|
|
1026
1049
|
positions.append([pos])
|
|
1027
1050
|
else:
|
|
@@ -1082,7 +1105,7 @@ def repackBinaryStrings(section, infile, outfile, binranges, freeranges=None, re
|
|
|
1082
1105
|
else:
|
|
1083
1106
|
# Add this to the freeranges
|
|
1084
1107
|
freeranges.append([pos, endpos])
|
|
1085
|
-
logDebug("Adding new
|
|
1108
|
+
logDebug("Adding new freerange", toHex(pos), toHex(endpos))
|
|
1086
1109
|
range = None
|
|
1087
1110
|
rangelen = 0
|
|
1088
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.7
|
|
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.5"
|
|
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
|
|
File without changes
|