Last active
April 24, 2016 14:38
-
-
Save shonumi/8c519ec8d9ccc4638c33 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* D.S. Baxter | |
* Febuary 12th, 2016 | |
======================================== | |
= DMG/GBC screen stretching on the GBA = | |
======================================== | |
GBA hardware has the ability to stretch the final image drawn on-screen when running DMG or GBC games. On applicable hardware (e.g. not the Micro, nor the "fat" or lite DS), the L and R triggers toggle this feature on and off respectively. The default mode is to display the DMG/GBC image in the middle of the GBA screen with black borders. The dimensions are as follows: | |
Top and bottom borders (240x8 pixels, or 30x1 tiles) | |
Left and right borders (40x160 pixels, or 5x20 tiles) | |
DMG/GBC screen (160x144 pixels, or 20x18 tiles) | |
Technically, the original DMG/GBC screen has an offset of (40, 8). Once the player toggles stretching, the above dimensions change: | |
Top and bottom borders (240x8 pixels, or 30x1 tiles) | |
Left and right borders (Not Applicable) | |
DMG/GBC screen (240x144 pixels, or 30x18 tiles) | |
The DMG/GBC screen completely stretches to the left and right ends of the screen. No vertical stretching occurs; the black bars still exist at the top and the bottom. Horizontal stretching follows a simple formula. For every 2 pixels from the original 160x144 image, a third pixel is generated by blending them together. This third pixel is then placed between the two original pixels. For example, imagine Pixel A and Pixel B represent original pixels from the 160x144 image. Pixel C is the result of blending the two of them. The GBA will produce A-C-B when stretching DMG and GBC games. | |
This method of stretching acts on the present 160x144 image generated by the DMG/GBC game, that is to say, scrolling the background, window, or OBJs can produce minor inconsistencies depending on where a tile is rendered to the screen. Generally, these inconsistencies affect the blending seen around edges. For example, in the first level of Super Mario Land, the trunks of the trees in the background are only 1 pixel wide. When stretching, the blended edge will switch from the left to the right depending on its current position due to scrolling. However, these inconsistencies are barely visible under the best circumstances, and almost impossible to detect during actual gameplay. | |
Currently, the blending formula is unknown. It may be something as simple as averaging Pixel A and Pixel B. If A and B are the same color, they will not produce a different color, however. |
See https://github.com/AntonioND/gba-switch-to-gbc as well.
Oops, super late reply, but better now than never ;)
I figured the scaling was done by the existing GBA LCD hardware features. What I'd love to find out specifically (for science) what are the exact values for BG2 affine parameters and SFX stuff.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The GBA uses the GBA graphics ASIC even while in GB mode. It has to be using the nearest neighbor affine scaling+color effects crap.