The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page ASM & Hex Uncompressed and compressed data

Notices
For all updates, view the main page.

Binary ROM Hacking Need a helping hand or just want to talk about binary ROM hacks? Get comments and answers to any ROM Hacking-related problems, questions or thoughts you have here.

Ad Content
Reply
 
Thread Tools
  #1   Link to this post, but load the entire thread.  
Old February 12th, 2017 (5:05 AM).
Froosty's Avatar
Froosty Froosty is offline
The_Learner
 
Join Date: Sep 2014
Location: Somewhere in this world.
Age: 25
Gender: Male
Nature: Brave
Posts: 535
Just wanted to know how the data (especially images) are compressed,

While inserting any uncompressed image into a rom, (The_Hex_Data)
it is simply done with the working with pixel (I know exactly how it works)
.
But for the compressed data, I couldnt get how it is inserted,

Can anyone help me with it....
__________________
My works:
TOOL: TL's Quick Enhancer
TUTORIAL: Fire red habitat editing
TUTORIAL: Fire red Transparent text-box


| |
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old February 12th, 2017 (4:22 PM).
DizzyEgg's Avatar
DizzyEgg DizzyEgg is offline
 
Join Date: Feb 2014
Location: Poland
Age: 25
Gender: Male
Nature: Quiet
Posts: 794
Quote:
Originally Posted by The_learner View Post
Just wanted to know how the data (especially images) are compressed,

While inserting any uncompressed image into a rom, (The_Hex_Data)
it is simply done with the working with pixel (I know exactly how it works)
.
But for the compressed data, I couldnt get how it is inserted,

Can anyone help me with it....
Compression is a way of storing data that makes its size smaller. When you download files with 7zip or rar extensions, they are compressed too. In Pokemon games the only compressed things are images and music.

Example. Let's say you insert an image with 5 pixels that are all red. The hex for it would be, say,
0x10 0x10 0x10 0x10 0x10. (I just made it up to illustrate it).
When we compress it, we get:
0x5 0x10 (0x5 - because we've got 5 pixels and they're all the same 0x10 - because that's our red pixel)
So our data got smaller, yay.
__________________
Support Pokeemerald!

Pokeemerald starter pack:
Emerald Expansion
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old February 13th, 2017 (2:32 AM).
Touched's Avatar
Touched Touched is offline
Resident ASMAGICIAN
 
Join Date: Jul 2014
Gender: Male
Posts: 625
Quote:
Originally Posted by DizzyEgg View Post
Compression is a way of storing data that makes its size smaller. When you download files with 7zip or rar extensions, they are compressed too. In Pokemon games the only compressed things are images and music.

Example. Let's say you insert an image with 5 pixels that are all red. The hex for it would be, say,
0x10 0x10 0x10 0x10 0x10. (I just made it up to illustrate it).
When we compress it, we get:
0x5 0x10 (0x5 - because we've got 5 pixels and they're all the same 0x10 - because that's our red pixel)
So our data got smaller, yay.
This is run-length encoding. I believe he is asking about the specific algorithms involved, not how data is compressed in general. While the GBA does provide BIOS functions for RLE (de)compression the main algorithm used for image compression is LZSS (the official SDK and other literature says LZ77 but that isn't, strictly speaking, correct), which is a variant on the LZ77 algorithm which allows for both uncompressed and decompressed blocks.

The compression is handled by a BIOS function, so it is used by many GBA and NDS games. You can find documentation on the structure of the data output by this function on GBATEK (BIOS decompression functions). If that is too cryptic, there are many open source GBA image extraction/insertion programs (e.g. PGE) you can copy, or you can check one of the tools bundled with pokeruby.
__________________

A Pokemon that is discriminated!
Support squirtle and make it everyone's favourite.
Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old February 13th, 2017 (4:02 AM).
Froosty's Avatar
Froosty Froosty is offline
The_Learner
 
Join Date: Sep 2014
Location: Somewhere in this world.
Age: 25
Gender: Male
Nature: Brave
Posts: 535
Quote:
Originally Posted by DizzyEgg View Post
Compression is a way of storing data that makes its size smaller. When you download files with 7zip or rar extensions, they are compressed too. In Pokemon games the only compressed things are images and music.

Example. Let's say you insert an image with 5 pixels that are all red. The hex for it would be, say,
0x10 0x10 0x10 0x10 0x10. (I just made it up to illustrate it).
When we compress it, we get:
0x5 0x10 (0x5 - because we've got 5 pixels and they're all the same 0x10 - because that's our red pixel)
So our data got smaller, yay.
Thanks for that...


Quote:
Originally Posted by Touched View Post
This is run-length encoding. I believe he is asking about the specific algorithms involved, not how data is compressed in general. While the GBA does provide BIOS functions for RLE (de)compression the main algorithm used for image compression is LZSS (the official SDK and other literature says LZ77 but that isn't, strictly speaking, correct), which is a variant on the LZ77 algorithm which allows for both uncompressed and decompressed blocks.

The compression is handled by a BIOS function, so it is used by many GBA and NDS games. You can find documentation on the structure of the data output by this function on GBATEK (BIOS decompression functions). If that is too cryptic, there are many open source GBA image extraction/insertion programs (e.g. PGE) you can copy, or you can check one of the tools bundled with pokeruby.
Thanks, exactly what I was searching for....
I needed it for my tool ;)
__________________
My works:
TOOL: TL's Quick Enhancer
TUTORIAL: Fire red habitat editing
TUTORIAL: Fire red Transparent text-box


| |
Reply With Quote
Reply

Quick Reply

Join the conversation!

Create an account to post a reply in this thread, participate in other discussions, and more!

Create a PokéCommunity Account
Ad Content

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 9:23 AM.