Elliot Nunn
cfc55b63f0
Merge Max's code for System 7 resource compression
2019-01-11 13:45:24 +08:00
Elliot Nunn
969493be9f
Prepare for merge into macresources
2019-01-11 13:45:06 +08:00
Elliot Nunn
7b9d12cc74
Simplify the syntax denoting compression
2019-01-10 13:05:28 +08:00
Elliot Nunn
b7739a449b
Stop polluting stdout.
2018-12-16 10:07:08 +08:00
Elliot Nunn
08b64758d4
Format as git package.
2018-12-16 10:07:01 +08:00
Maxim Poliakovski
5449528a2d
Merge pull request #1 from elliotnunn/master
...
Wrap a neat API around it
2018-12-13 14:25:06 +01:00
Elliot Nunn
e9f9154dff
Squash bugs found testing compression
2018-12-13 16:41:20 +08:00
Elliot Nunn
fbdb8eb61a
Ditch FakeResDecompress in preparation for Max's
2018-12-13 16:05:11 +08:00
Elliot Nunn
c752c70c6a
Add simple tests (run ./pytest).
2018-12-13 12:51:56 +08:00
Elliot Nunn
ddfb909212
Replace testbed with a friendly API.
...
The GetEncoding function will allow macresources to cheaply and simply
determine resource encoding without committing to a time-consuming
extraction.
2018-12-13 12:51:56 +08:00
Elliot Nunn
eacebc8320
Let functions create/parse their own res header.
2018-12-13 12:51:56 +08:00
Elliot Nunn
7f14013fa3
Bugfix: use 'append' method for extra byte.
2018-12-13 12:51:53 +08:00
Maxim Poliakovski
2f94e88cec
Rename GreggDecompress.py to GreggBits.py.
...
That's because both compression and decompression are supported for now.
2018-12-11 17:15:24 +01:00
Maxim Poliakovski
6c81808433
Implement a compressor for GreggBits scheme.
2018-12-11 17:12:06 +01:00
Elliot Nunn
29982335a6
Neaten bad-compression case
2018-12-11 17:31:17 +08:00
Elliot Nunn
931529bc7c
Revise error model
...
The problem is this: a user might want to edit a resource compressed
using an unknown algorithm. This should fail by default, because after
all, the resource is garbage. But the expert user (say Daniel wrote a
new algo) might know better, and set the expand_err_ok attribute on a
Resource object before accessing and editing its data attribute.
2018-12-11 17:18:41 +08:00
Elliot Nunn
5a318f78ef
Expand > extract
2018-12-11 16:06:20 +08:00
Elliot Nunn
408ff20637
Miscellany
2018-12-11 15:50:14 +08:00
Elliot Nunn
3e2f151b6e
Fix Rez codegen
2018-12-11 15:50:14 +08:00
Elliot Nunn
bbc88c54a9
Cache the compressed form of a resource
...
This can be used to defer time-consuming decompression of a compressed
resource, until the user actually asks for the decompressed form by
accessing the Resource.data attribute. Even when decompression is
requested, keep the cache and associate it with the hash of the
decompressed data, so that very time-consuming recompression can be
avoided while the Resource.data attribute is not changed.
This should be transparent to the user, who only cares about the
always-decompressed Resource.data attribute, and maybe the
Resource.compression_format attribute at a stretch. Note that it is safe
to change Resource.compression_format: it will never corrupt data.
2018-12-11 15:50:14 +08:00
Elliot Nunn
640ece9c1d
Create compress/extract stubs
2018-12-11 15:50:14 +08:00
Elliot Nunn
01c8adb82f
Make rount-tripping properties clearer
2018-12-11 15:50:09 +08:00
Elliot Nunn
57bd293326
Roundtrip fix: tabs etc in resource names
2018-12-09 13:32:53 +08:00
Elliot Nunn
b21a7a4595
Correctly document non-DeRez-like options
2018-12-09 13:19:49 +08:00
Elliot Nunn
ad96f756d2
Keep fake header out-of-channel
2018-12-09 12:53:15 +08:00
Maxim Poliakovski
0d8c1f3013
Fix table formatting of the previous commit.
2018-12-04 14:54:56 +01:00
Maxim Poliakovski
7e27775825
Initial commit.
2018-12-04 14:44:09 +01:00
Elliot Nunn
bda55a52b2
Support compressed resources
2018-11-10 18:05:43 +08:00
Elliot Nunn
f0ba2cba57
Add hack to save the header into a resource
2018-11-09 20:55:06 +08:00
Elliot Nunn
6187243466
Allow arbitrary resource alignment
2018-10-24 11:27:45 +08:00
Elliot Nunn
a515b88c7f
Make the Python "wheel" work right
2018-10-23 20:11:11 +08:00
Elliot Nunn
0be371a99b
Add a gitignore!
2018-10-23 20:10:49 +08:00
Elliot Nunn
e55c2ee7d7
Roundtrip fix: Rez is very cautious about */
2018-10-23 20:10:38 +08:00
Elliot Nunn
9cbc8a1bc4
Roundtrip fix: empty name is different to no name
2018-10-23 20:09:45 +08:00
Elliot Nunn
73009e7aa9
Stop trying to sort resources
...
Definitely didn't match Rez's behaviour
2018-10-23 19:15:58 +08:00
Elliot Nunn
ea2048c509
Finish renaming package
2018-10-23 19:15:18 +08:00
Elliot Nunn
56d16589e1
Initial commit (works, not documented)
2018-10-21 18:43:26 +08:00