- Joined: 16 Jan 2007
- Posts: 16
- Location: Pennsylvania, USA
|
Uncompressing aPLib? - Z88DK
Posted: Thu Sep 28, 2023 10:09 pm
|
So I'm trying to use aPLib to compress my tile and tilemaps but from the examples I've looked at it just loads garbage when I use the aplib_depack function to depack and load the contents.
I wrote this function that returns the contents
unsigned int * DepackTilemap(unsigned int * packed)
{
unsigned int * buff;
aplib_depack(buff, packed);
return buff;
}
Which when used to load the tilemap
set_bkg_map(DepackTilemap(map), 0, -2, dimensions.Width, dimensions.Height);
results in this
How do I get this to work?
|
- Site Admin
- Joined: 19 Oct 1999
- Posts: 14745
- Location: London
|
Posted: Fri Sep 29, 2023 6:47 am
|
You seem to be decompressing into an undefined pointer, I don’t think that’s how it works.
|
- Joined: 05 Sep 2013
- Posts: 3828
- Location: Stockholm, Sweden
|
Posted: Fri Sep 29, 2023 10:05 am
|
you should either depack the tilemap directly to VRAM ( use sms_aplib_depack_vram ) or you should allocate a RAM buffer wide enough to keep the uncompressed data (likely 32*24*2 = 1536 bytes if fullscreen) that you later will transfer to VRAM
|
- Joined: 16 Jan 2007
- Posts: 16
- Location: Pennsylvania, USA
|
Posted: Tue Oct 03, 2023 8:51 pm
|
sverx wrote you should either depack the tilemap directly to VRAM ( use sms_aplib_depack_vram ) or you should allocate a RAM buffer wide enough to keep the uncompressed data (likely 32*24*2 = 1536 bytes if fullscreen) that you later will transfer to VRAM
I tried putting the uncompressed data into an array, when thats passed into the set_bkg_map function the game just keeps reloading a solid color, going black, then flashing the same color. The sprites are never drawn.
|
- Joined: 04 Jul 2010
- Posts: 542
- Location: Angers, France
|
Posted: Wed Oct 04, 2023 5:58 am
|
Better to use ZX (0 or 7) or PSGaiden compressors.
Less ram usage and faster.
Aplib have ± no interest nowadays.
+it will be hard to use this sort of things (compression) for tilemap.
no problem with tiles (loaded before playing), but uncompressing (very compressed) tilemaps or more especially tiles while playing is not a sinecure (it can takes a lot of time)
|
- Joined: 05 Sep 2013
- Posts: 3828
- Location: Stockholm, Sweden
|
Posted: Wed Oct 04, 2023 7:44 am
|
EmOneGarand wrote I tried putting the uncompressed data into an array, when thats passed into the set_bkg_map function the game just keeps reloading a solid color, going black, then flashing the same color. The sprites are never drawn.
you should use some memory viewer in an emulator to see if:
- data is decompressed properly to RAM
- data it copied properly from RAM to VRAM
Both MEKA and Emulicious offer a memory viewer and a debugger.
|