hacktools 1.0.0__tar.gz → 1.0.1__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.
Files changed (36) hide show
  1. {hacktools-1.0.0/hacktools.egg-info → hacktools-1.0.1}/PKG-INFO +2 -1
  2. hacktools-1.0.1/hacktools/__init__.py +1 -0
  3. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/c_ext/cmp_cri.c +1 -1
  4. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/c_ext/cmp_lzss.c +2 -2
  5. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/c_ext/cmp_racjin.c +3 -8
  6. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/wii.py +20 -20
  7. {hacktools-1.0.0 → hacktools-1.0.1/hacktools.egg-info}/PKG-INFO +2 -1
  8. {hacktools-1.0.0 → hacktools-1.0.1}/setup.py +1 -0
  9. hacktools-1.0.0/hacktools/__init__.py +0 -1
  10. {hacktools-1.0.0 → hacktools-1.0.1}/LICENSE +0 -0
  11. {hacktools-1.0.0 → hacktools-1.0.1}/MANIFEST.in +0 -0
  12. {hacktools-1.0.0 → hacktools-1.0.1}/README.md +0 -0
  13. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/arch.py +0 -0
  14. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/assets/icon.png +0 -0
  15. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/c_ext/cmp_huff.c +0 -0
  16. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/c_ext/cmp_misc.c +0 -0
  17. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/c_ext/cmp_prs.c +0 -0
  18. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/c_ext/inc.h +0 -0
  19. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/common.py +0 -0
  20. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/cpk.py +0 -0
  21. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/gb.py +0 -0
  22. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/gui.py +0 -0
  23. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/nasm.py +0 -0
  24. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/nds.py +0 -0
  25. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/nitro.py +0 -0
  26. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/ps2.py +0 -0
  27. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/psp.py +0 -0
  28. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/psx.py +0 -0
  29. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools/ws.py +0 -0
  30. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools.egg-info/SOURCES.txt +0 -0
  31. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools.egg-info/dependency_links.txt +0 -0
  32. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools.egg-info/requires.txt +0 -0
  33. {hacktools-1.0.0 → hacktools-1.0.1}/hacktools.egg-info/top_level.txt +0 -0
  34. {hacktools-1.0.0 → hacktools-1.0.1}/pyproject.toml +0 -0
  35. {hacktools-1.0.0 → hacktools-1.0.1}/setup.cfg +0 -0
  36. {hacktools-1.0.0 → hacktools-1.0.1}/tests/test_cmp.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hacktools
3
- Version: 1.0.0
3
+ Version: 1.0.1
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
@@ -10,6 +10,7 @@ Classifier: Programming Language :: Python :: 3.11
10
10
  Classifier: Programming Language :: Python :: 3.12
11
11
  Classifier: Programming Language :: Python :: 3.13
12
12
  Classifier: Programming Language :: Python :: 3.14
13
+ Classifier: Programming Language :: Python :: 3.15
13
14
  Classifier: Operating System :: OS Independent
14
15
  Requires-Python: >=3.10
15
16
  Description-Content-Type: text/markdown
@@ -0,0 +1 @@
1
+ __version__ = "1.0.1"
@@ -38,7 +38,7 @@ static PyObject* compressCRILAYLA(PyObject* module, PyObject* args, PyObject* kw
38
38
  for (; n >= 0x100;)
39
39
  {
40
40
  j = n + 3 + 0x2000;
41
- if (j > srclen)
41
+ if (j > (int)srclen)
42
42
  j = (int)srclen;
43
43
  for (i = n + 3, p = 0; i < j; i++)
44
44
  {
@@ -272,7 +272,7 @@ static PyObject* compressLZ10(PyObject* m, PyObject* args, PyObject* kwargs)
272
272
  int bufferlength = 1;
273
273
  int bufferedblocks = 0;
274
274
  int readbytes = 0;
275
- while (readbytes < inlength)
275
+ while (readbytes < (int)inlength)
276
276
  {
277
277
  // If 8 blocks are buffered, write them and reset the buffer
278
278
  // we can only buffer 8 blocks at a time.
@@ -366,7 +366,7 @@ static PyObject* compressLZ11(PyObject* m, PyObject* args, PyObject* kwargs)
366
366
  int bufferlength = 1;
367
367
  int bufferedblocks = 0;
368
368
  int readbytes = 0;
369
- while (readbytes < inlength)
369
+ while (readbytes < (int)inlength)
370
370
  {
371
371
  // If 8 blocks are buffered, write them and reset the buffer
372
372
  // we can only buffer 8 blocks at a time.
@@ -28,20 +28,15 @@ static PyObject* compressRACJIN(PyObject* module, PyObject* args, PyObject* kwar
28
28
  unsigned int destlen = 0;
29
29
 
30
30
  unsigned int index = 0; //position of an element from the input buffer
31
- unsigned char last_enc_byte = 0;//last encoded byte
31
+ unsigned char last_enc_byte = 0; //last encoded byte
32
32
  unsigned char bit_shift = 0; //shift by bitShift (used to fold codes)
33
+ // PyMem_Calloc already zero-fills the buffers
33
34
  unsigned char* frequencies = PyMem_Calloc(256, sizeof(unsigned char));
34
35
  MALLOC_CHECK(frequencies);
35
- for (int i = 0; i < 256; ++i)
36
- frequencies[i] = 0;
37
36
  unsigned int* seq_indices = PyMem_Calloc(8192, sizeof(unsigned int));
38
37
  MALLOC_CHECK(seq_indices);
39
- for (int i = 0; i < 8192; ++i)
40
- seq_indices[i] = 0;
41
38
  unsigned short* codes = PyMem_Calloc(srclen, sizeof(unsigned short));
42
39
  MALLOC_CHECK(codes);
43
- for (int i = 0; i < srclen; ++i)
44
- codes[i] = 0;
45
40
  unsigned int codeslen = 0;
46
41
 
47
42
  while (index < srclen)
@@ -61,7 +56,7 @@ static PyObject* compressRACJIN(PyObject* module, PyObject* args, PyObject* kwar
61
56
  unsigned short key = freq + last_enc_byte * 32; //0x1F + 0xFF*32 = 8191
62
57
  unsigned int src_index = seq_indices[key];
63
58
  unsigned char matched = 0;
64
- unsigned char max_length = index + 8 < srclen ? 8 : srclen - index;
59
+ unsigned char max_length = index + 8 < srclen ? 8 : (unsigned char)(srclen - index);
65
60
 
66
61
  for (unsigned char offset = 0; offset < max_length; ++offset)
67
62
  {
@@ -22,7 +22,7 @@ def extractARC(infolder: str, outfolder: str) -> None:
22
22
  files = common.getFiles(infolder, ".arc")
23
23
  for file in common.showProgress(files):
24
24
  common.logDebug("Processing", file, "...")
25
- common.execute("wszst EXTRACT " + infolder + file + " -D " + outfolder + file, False)
25
+ common.execute("wszst EXTRACT \"" + infolder + file + "\" -D \"" + outfolder + file + "\"", False)
26
26
  common.logMessage("Done! Extracted", len(files), "files")
27
27
 
28
28
 
@@ -48,7 +48,7 @@ def extractTPL(infolder: str, outfolder: str, splitName: bool = True, flatten: b
48
48
  filename = file[:file.index(".arc/") + 4] + "/" + os.path.basename(file).replace(".tpl", ".png")
49
49
  else:
50
50
  filename = file.replace(".tpl", ".png")
51
- common.execute("wimgt DECODE " + infolder + file + " -D " + outfolder + filename, False)
51
+ common.execute("wimgt DECODE \"" + infolder + file + "\" -D \"" + outfolder + filename + "\"", False)
52
52
  common.logMessage("Done! Extracted", len(files), "files")
53
53
 
54
54
 
@@ -88,7 +88,7 @@ def repackTPL(infolder: str, workfolder: str, outfolder: str) -> None:
88
88
  common.copyFolder(infolder + arcname, outfolder + arcname)
89
89
  arcs.append(arcname)
90
90
  transform = getTPLTransform(infolder + tplfile)
91
- common.execute("wimgt ENCODE " + workfolder + file + " -D " + outfolder + tplfile + " --n-mipmaps 0 --transform " + transform + " --overwrite", False)
91
+ common.execute("wimgt ENCODE \"" + workfolder + file + "\" -D \"" + outfolder + tplfile + "\" --n-mipmaps 0 --transform " + transform + " --overwrite", False)
92
92
  repacked += 1
93
93
  common.logMessage("Done! Repacked", repacked, "files in", len(arcs), "ARC folders")
94
94
 
@@ -108,7 +108,7 @@ def repackARC(workfolder: str, outfolder: str) -> None:
108
108
  arcs.append(os.path.join(root, dir).replace("\\", "/").replace(workfolder, ""))
109
109
  for arc in common.showProgress(arcs):
110
110
  common.logDebug("Processing", arc, "...")
111
- common.execute("wszst CREATE " + workfolder + arc + " -D " + outfolder + arc + " --overwrite", False)
111
+ common.execute("wszst CREATE \"" + workfolder + arc + "\" -D \"" + outfolder + arc + "\" --overwrite", False)
112
112
  common.logMessage("Done! Repacked", len(arcs), "files")
113
113
 
114
114
 
@@ -131,9 +131,9 @@ def extractBREFT(infolder: str, tempfolder: str, outfolder: str) -> None:
131
131
  common.logDebug("Processing", file, "...")
132
132
  outfile = file.split("/")
133
133
  outfile = "/" + outfile[1] + "/" + outfile[3]
134
- common.execute("wszst EXTRACT " + infolder + file + " -D " + tempfolder + outfile, False)
134
+ common.execute("wszst EXTRACT \"" + infolder + file + "\" -D \"" + tempfolder + outfile + "\"", False)
135
135
  for imgfile in os.listdir(tempfolder + outfile + "/files"):
136
- common.execute("wimgt DECODE " + tempfolder + outfile + "/files/" + imgfile + " -D " + outfolder + outfile + "/" + imgfile + ".png", False)
136
+ common.execute("wimgt DECODE \"" + tempfolder + outfile + "/files/" + imgfile + "\" -D \"" + outfolder + outfile + "/" + imgfile + ".png\"", False)
137
137
  common.logMessage("Done! Extracted", len(files), "files")
138
138
 
139
139
 
@@ -156,10 +156,10 @@ def extractBRTEX(infolder: str, tempfolder: str, outfolder: str) -> None:
156
156
  extracted = 0
157
157
  for file in common.showProgress(files):
158
158
  common.logDebug("Processing", file, "...")
159
- common.execute("wszst EXTRACT " + infolder + file + " -D " + tempfolder + file, False)
159
+ common.execute("wszst EXTRACT \"" + infolder + file + "\" -D \"" + tempfolder + file + "\"", False)
160
160
  pltfile = file.replace(".brtex", ".brplt")
161
161
  if os.path.isfile(infolder + pltfile):
162
- common.execute("wszst EXTRACT " + infolder + pltfile + " -D " + tempfolder + pltfile, False)
162
+ common.execute("wszst EXTRACT \"" + infolder + pltfile + "\" -D \"" + tempfolder + pltfile + "\"", False)
163
163
  texfolder = tempfolder + file + "/Textures(NW4R)/"
164
164
  if not os.path.isdir(texfolder):
165
165
  continue
@@ -169,7 +169,7 @@ def extractBRTEX(infolder: str, tempfolder: str, outfolder: str) -> None:
169
169
  palfile = None
170
170
  tplfile = tempfolder + file + "/" + texname + ".tpl"
171
171
  texToTPL(texfolder + texname, tplfile, palfile)
172
- common.execute("wimgt DECODE " + tplfile + " -D " + outfolder + file + "/" + texname + ".png --overwrite", False)
172
+ common.execute("wimgt DECODE \"" + tplfile + "\" -D \"" + outfolder + file + "/" + texname + ".png\" --overwrite", False)
173
173
  os.remove(tplfile)
174
174
  extracted += 1
175
175
  common.logMessage("Done! Extracted", extracted, "textures")
@@ -201,10 +201,10 @@ def repackBRTEX(infolder: str, tempfolder: str, workfolder: str, outfolder: str)
201
201
  if not os.path.isdir(workdir):
202
202
  continue
203
203
  common.logDebug("Processing", file, "...")
204
- common.execute("wszst EXTRACT " + infolder + file + " -D " + tempfolder + file, False)
204
+ common.execute("wszst EXTRACT \"" + infolder + file + "\" -D \"" + tempfolder + file + "\"", False)
205
205
  pltfile = file.replace(".brtex", ".brplt")
206
206
  if os.path.isfile(infolder + pltfile):
207
- common.execute("wszst EXTRACT " + infolder + pltfile + " -D " + tempfolder + pltfile, False)
207
+ common.execute("wszst EXTRACT \"" + infolder + pltfile + "\" -D \"" + tempfolder + pltfile + "\"", False)
208
208
  modified = pltmodified = False
209
209
  for pngname in sorted(os.listdir(workdir)):
210
210
  if not pngname.endswith(".png"):
@@ -219,7 +219,7 @@ def repackBRTEX(infolder: str, tempfolder: str, workfolder: str, outfolder: str)
219
219
  palfile = None
220
220
  tplfile = tempfolder + file + "/" + texname + ".tpl"
221
221
  transform = getTexTransform(texfile, palfile)
222
- common.execute("wimgt ENCODE " + workdir + pngname + " -D " + tplfile + " --n-mipmaps 0 --transform " + transform + " --overwrite", False)
222
+ common.execute("wimgt ENCODE \"" + workdir + pngname + "\" -D \"" + tplfile + "\" --n-mipmaps 0 --transform " + transform + " --overwrite", False)
223
223
  tplToTex(tplfile, texfile, palfile)
224
224
  os.remove(tplfile)
225
225
  textures += 1
@@ -227,10 +227,10 @@ def repackBRTEX(infolder: str, tempfolder: str, workfolder: str, outfolder: str)
227
227
  if palfile is not None:
228
228
  pltmodified = True
229
229
  if modified:
230
- common.execute("wszst CREATE " + tempfolder + file + " -D " + outfolder + file + " --overwrite", False)
230
+ common.execute("wszst CREATE \"" + tempfolder + file + "\" -D \"" + outfolder + file + "\" --overwrite", False)
231
231
  repacked += 1
232
232
  if pltmodified:
233
- common.execute("wszst CREATE " + tempfolder + pltfile + " -D " + outfolder + pltfile + " --overwrite", False)
233
+ common.execute("wszst CREATE \"" + tempfolder + pltfile + "\" -D \"" + outfolder + pltfile + "\" --overwrite", False)
234
234
  common.logMessage("Done!", textures, "textures repacked in", repacked, "BRTEX files")
235
235
 
236
236
 
@@ -245,8 +245,8 @@ def extractBRFNT(infile: str, outfile: str) -> None:
245
245
  if not os.path.isfile(brfnt2tpl):
246
246
  common.logError("brfnt2tpl not found")
247
247
  return
248
- common.execute(brfnt2tpl + " {file}".format(file=infile), False)
249
- common.execute("wimgt DECODE " + infile.replace(".brfnt", ".tpl") + " -D " + outfile, False)
248
+ common.execute("\"{exe}\" \"{file}\"".format(exe=brfnt2tpl, file=infile), False)
249
+ common.execute("wimgt DECODE \"" + infile.replace(".brfnt", ".tpl") + "\" -D \"" + outfile + "\"", False)
250
250
  os.remove(infile.replace(".brfnt", ".tpl"))
251
251
  os.remove(infile.replace(".brfnt", ".vbfta"))
252
252
 
@@ -262,11 +262,11 @@ def repackBRFNT(outfile: str, workfile: str) -> None:
262
262
  if not os.path.isfile(brfnt2tpl):
263
263
  common.logError("brfnt2tpl not found")
264
264
  return
265
- common.execute(brfnt2tpl + " {file}".format(file=outfile), False)
265
+ common.execute("\"{exe}\" \"{file}\"".format(exe=brfnt2tpl, file=outfile), False)
266
266
  tplfile = outfile.replace(".brfnt", ".tpl")
267
267
  tpl = readTPL(tplfile)
268
268
  writeTPL(tplfile, tpl, workfile)
269
- common.execute(brfnt2tpl + " {file}".format(file=outfile.replace(".brfnt", ".tpl")), False)
269
+ common.execute("\"{exe}\" \"{file}\"".format(exe=brfnt2tpl, file=outfile.replace(".brfnt", ".tpl")), False)
270
270
  os.remove(outfile.replace(".brfnt", ".tpl"))
271
271
  os.remove(outfile.replace(".brfnt", ".vbfta"))
272
272
 
@@ -282,7 +282,7 @@ def extractIso(isofile: str, extractfolder: str, workfolder: str = "") -> None:
282
282
  """
283
283
  common.logMessage("Extracting ISO", isofile, "...")
284
284
  common.makeFolder(extractfolder)
285
- common.execute("wit EXTRACT -o {iso} {folder}".format(iso=isofile, folder=extractfolder), False)
285
+ common.execute("wit EXTRACT -o \"{iso}\" \"{folder}\"".format(iso=isofile, folder=extractfolder), False)
286
286
  if workfolder != "":
287
287
  common.copyFolder(extractfolder, workfolder)
288
288
  common.logMessage("Done!")
@@ -300,7 +300,7 @@ def repackIso(isofile: str, isopatch: str, workfolder: str, patchfile: str = "")
300
300
  common.logMessage("Repacking ISO", isopatch, "...")
301
301
  if os.path.isfile(isopatch):
302
302
  os.remove(isopatch)
303
- common.execute("wit COPY {folder} {iso}".format(folder=workfolder, iso=isopatch), False)
303
+ common.execute("wit COPY \"{folder}\" \"{iso}\"".format(folder=workfolder, iso=isopatch), False)
304
304
  common.logMessage("Done!")
305
305
 
306
306
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hacktools
3
- Version: 1.0.0
3
+ Version: 1.0.1
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
@@ -10,6 +10,7 @@ Classifier: Programming Language :: Python :: 3.11
10
10
  Classifier: Programming Language :: Python :: 3.12
11
11
  Classifier: Programming Language :: Python :: 3.13
12
12
  Classifier: Programming Language :: Python :: 3.14
13
+ Classifier: Programming Language :: Python :: 3.15
13
14
  Classifier: Operating System :: OS Independent
14
15
  Requires-Python: >=3.10
15
16
  Description-Content-Type: text/markdown
@@ -51,6 +51,7 @@ setup(
51
51
  "Programming Language :: Python :: 3.12",
52
52
  "Programming Language :: Python :: 3.13",
53
53
  "Programming Language :: Python :: 3.14",
54
+ "Programming Language :: Python :: 3.15",
54
55
  "Operating System :: OS Independent",
55
56
  ],
56
57
  extras_require = {
@@ -1 +0,0 @@
1
- __version__ = "1.0.0"
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