Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Uncompressing aPLib? - Z88DK

Reply to topic
Author Message
  • Joined: 16 Jan 2007
  • Posts: 16
  • Location: Pennsylvania, USA
Reply with quote
Uncompressing aPLib? - Z88DK
Post 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?
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14745
  • Location: London
Reply with quote
Post 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.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3828
  • Location: Stockholm, Sweden
Reply with quote
Post 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
  View user's profile Send private message Visit poster's website
  • Joined: 16 Jan 2007
  • Posts: 16
  • Location: Pennsylvania, USA
Reply with quote
Post 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.
  View user's profile Send private message
  • Joined: 04 Jul 2010
  • Posts: 542
  • Location: Angers, France
Reply with quote
Post 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)
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3828
  • Location: Stockholm, Sweden
Reply with quote
Post 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.
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!