-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d6f16aa
commit d6c36be
Showing
4 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
crossfiledialog | ||
bimpy==0.1.1 | ||
mymcplus==3.0.4 | ||
diff-match-patch==20200713 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
|
||
setup( | ||
name='slimseditor', | ||
version='0.0.5', | ||
version='0.0.6', | ||
description='A savegame editor for the Ratchet and Clank games', | ||
author='Maikel Wever', | ||
author_email='[email protected]', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env python3 | ||
|
||
""" | ||
Hexdump by 7hrrAm from https://gist.github.com/7h3rAm/5603718 | ||
Based in part on sbz version from https://gist.github.com/sbz/1080258 | ||
Modified by maikelwever to make ascii printing optional. | ||
""" | ||
|
||
def hexdump(src, length=16, sep='.', print_ascii=True): | ||
""" | ||
>>> print(hexdump('\x01\x02\x03\x04AAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBB')) | ||
00000000: 01 02 03 04 41 41 41 41 41 41 41 41 41 41 41 41 |....AAAAAAAAAAAA| | ||
00000010: 41 41 41 41 41 41 41 41 41 41 41 41 41 41 42 42 |AAAAAAAAAAAAAABB| | ||
00000020: 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 |BBBBBBBBBBBBBBBB| | ||
00000030: 42 42 42 42 42 42 42 42 |BBBBBBBB| | ||
>>> | ||
>>> print(hexdump(b'\x01\x02\x03\x04AAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBB')) | ||
00000000: 01 02 03 04 41 41 41 41 41 41 41 41 41 41 41 41 |....AAAAAAAAAAAA| | ||
00000010: 41 41 41 41 41 41 41 41 41 41 41 41 41 41 42 42 |AAAAAAAAAAAAAABB| | ||
00000020: 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 |BBBBBBBBBBBBBBBB| | ||
00000030: 42 42 42 42 42 42 42 42 |BBBBBBBB| | ||
""" | ||
FILTER = ''.join([(len(repr(chr(x))) == 3) and chr(x) or sep for x in range(256)]) | ||
lines = [] | ||
for c in range(0, len(src), length): | ||
chars = src[c:c+length] | ||
hexstr = ' '.join(["%02x" % ord(x) for x in chars]) if type(chars) is str else ' '.join(['{:02x}'.format(x) for x in chars]) | ||
if len(hexstr) > 24: | ||
hexstr = "%s %s" % (hexstr[:24], hexstr[24:]) | ||
if print_ascii: | ||
printable = ''.join(["%s" % ((ord(x) <= 127 and FILTER[ord(x)]) or sep) for x in chars]) if type(chars) is str else ''.join(['{}'.format((x <= 127 and FILTER[x]) or sep) for x in chars]) | ||
lines.append("%08x: %-*s |%s|" % (c, length*3, hexstr, printable)) | ||
else: | ||
lines.append("%08x: %-*s" % (c, length * 3, hexstr)) | ||
return '\n'.join(lines) | ||
|
||
if __name__ == "__main__": | ||
print(hexdump('\x01\x02\x03\x04AAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBB')) | ||
print(hexdump(b'\x01\x02\x03\x04AAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBB')) |