Skip to content

Commit

Permalink
Working now
Browse files Browse the repository at this point in the history
  • Loading branch information
maxim-zhao committed Dec 14, 2024
1 parent 16fde8a commit 2a6b5ca
Show file tree
Hide file tree
Showing 6 changed files with 326 additions and 231 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Compressors
| apultra | apultra | aPLib (apultra) | [apultra](https://github.com/emmanuel-marty/apultra) aPLib compressor - better compression for the same format |||
| berlinwall | berlinwallcompr | Berlin Wall LZ | Compression from the game [The Berlin Wall](http://www.smspower.org/Games/BerlinWall-GG) |||
| exe | (configurable) | (configurable) | Wraps arbitrary external programs, passing data via files. This is useful if you do not want to implement your algorithm in the form of a DLL. |||
| exomizerv2 | exomizer | Exomizer v2 | [Exomizer](https://bitbucket.org/magli143/exomizer/wiki/Home) v2 compression ⚠ Seems to crash on some inputs |||
| exomizerv3 | exomizer | Exomizer v3 | [Exomizer](https://bitbucket.org/magli143/exomizer/wiki/Home) v3 compression |||
| highschoolkimengumi | hskcompr | High School Kimengumi RLE | Compression from the game [High School! Kimengumi](http://www.smspower.org/Games/HighSchoolKimengumi-SMS) |||
| lemmings | lemmingscompr | Lemmings RLE | Compression from the game [Lemmings](http://www.smspower.org/Games/Lemmings-SMS) |||
| lsb | lsbtilemap | LSB-only tilemap | Least significant byte of tilemap data | ||
Expand Down Expand Up @@ -66,7 +66,7 @@ All size stats are for emitting data direct to VRAM on Master System, using Z80
| aPLib | 303 | 5 | 96% | |||
| aPLib (fast) | 341 | 0 | 96% | 12% |||
| Berlin Wall | 241 | 265 | 74% | 4% |||
| Exomizer v2 (⚠ Broken) | 208 | 156 | | |||
| Exomizer v3 | 289 | 156 | | |||
| High School Kimengumi (unoptimised) | 119 | 4 | 67% | 11% |||
| Lemmings (unoptimised) | 143 | 512 | 65% | 12% |||
| LZ4 | 136 | 0 | 69% | 23% |||
Expand Down
30 changes: 0 additions & 30 deletions benchmark/benchmark-exomizer-v2.sms.asm

This file was deleted.

57 changes: 57 additions & 0 deletions benchmark/benchmark-exomizerv3.sms.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
; { "technology": "Exomizer v3", "extension": "exomizer3" }

.memorymap
defaultslot 0
slotsize $8000
slot 0 $0000
.endme

.rombankmap
bankstotal 2 ; enable SRAM in Emulicious
banksize $8000
banks 2
.endro

.bank 0 slot 0

.define ExomizerToVRAM

.org 0
.ifndef ExomizerToVRAM
; We first decompress to RAM...
ld a, %1000
ld ($fffc),a
; Then use it as our buffer
ld hl,data
ld de,$8000
call deexo
; Then copy to VRAM. Assume de points to the end of the decompressed data
ld a,d
sub $80
ld b,a
ld c,e
xor a
out ($bf),a
ld a,$40
out ($bf),a
ld hl,$8000
-:ld a,(hl)
inc hl
out ($be),a
dec bc
ld a,b
or c
jp nz,-
.else
ld hl,data
ld de,$4000
call deexo
.endif
ret ; ends the test
.block "decompressor"
.define mapbase $c000
.include "../decompressors/Exomizer v3 decompressor.asm"
.endb

data: .incbin "data.exomizer3"
16 changes: 3 additions & 13 deletions compressors/gfxcomp_exomizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,33 +39,23 @@ static int32_t compress(
buf_init(&destinationBuffer);

crunch_options options = CRUNCH_OPTIONS_DEFAULT;
options.flags_proto = 45; // -P
options.flags_proto = 15; // -P
options.flags_notrait = 1; // -T
options.direction_forward = 1;

// Enable logging
G_log_ctx = log_new();
log_set_level(G_log_ctx, LOG_TRACE);
G_log_level = LOG_TRACE;
log_add_output_stream(G_log_ctx, LOG_WARNING, LOG_MAX, nullptr, stdout);
log_add_output_stream(G_log_ctx, LOG_MIN, static_cast<log_level>(LOG_WARNING - 1), nullptr, stderr);

crunch_info info;
crunch(
&sourceBuffer,
0,
&sourceBuffer,
nullptr,
&destinationBuffer,
&options,
&info);
nullptr);

buf_free(&sourceBuffer);

const auto result = Utils::toVector(static_cast<const uint8_t*>(destinationBuffer.data), destinationBuffer.size);
buf_free(&destinationBuffer);

LOG_FREE;

return Utils::copyToDestination(result, pDestination, destinationLength);
}

Expand Down
186 changes: 0 additions & 186 deletions decompressors/Exomizer v2 decompressor.asm

This file was deleted.

Loading

0 comments on commit 2a6b5ca

Please sign in to comment.