mgba icon indicating copy to clipboard operation
mgba copied to clipboard

Aspect ratio (widescreen) hack

Open Margen67 opened this issue 4 years ago • 4 comments

mGBA already has resolution scaling, so adding widescreen hacks like bsnes-hd, especially for 3D/Mode7 games would be nice.

I actually managed to do this for 2D games, but there are drawbacks. Details below: By changing the following you can expand the screen beyond the normal boundaries, but it only goes up to 255 pixels without further changes: https://github.com/mgba-emu/mgba/blob/ba6e34fd9039abb2a015e20449a3d47fa6b6f986/include/mgba/gba/interface.h#L17 For more than 255 pixels you must change uint8_t to uint16_t: https://github.com/mgba-emu/mgba/blob/ba6e34fd9039abb2a015e20449a3d47fa6b6f986/include/mgba/internal/gba/renderers/video-software.h#L73 https://github.com/mgba-emu/mgba/blob/ba6e34fd9039abb2a015e20449a3d47fa6b6f986/include/mgba/internal/gba/video.h#L103-L104 This causes artifacting with the software renderer: but can be hacked around by also expanding the height: https://github.com/mgba-emu/mgba/blob/ba6e34fd9039abb2a015e20449a3d47fa6b6f986/include/mgba/gba/interface.h#L18 uncropped: cropped: Keep in mind there is another limit: ~65335 total pixels. Amounts higher than this will crash the emulator once you load a rom. While you can use OpenGL, it's pretty much useless since you can't center the screen.

You can also expand original/color game boy games, but it isn't as notable since it's doable with WideGB or Goomba: https://github.com/mgba-emu/mgba/blob/ba6e34fd9039abb2a015e20449a3d47fa6b6f986/include/mgba/internal/gb/video.h#L20-L21

Margen67 avatar Dec 02 '20 09:12 Margen67

the GB hack is way more interesting than the GBA one, which already has quasi-WS resolution

I think with a way of centering the screen like Goomba had would make a nice hack to have as an option.

eadmaster avatar Jan 30 '22 19:01 eadmaster

Would you mind sharing your build (for a resolution of something like 320x200)?

perguto avatar May 31 '23 15:05 perguto

it seems like GBARunner2 on a DSi can already somewhat render outside of the native resolution.

https://github.com/mgba-emu/mgba/assets/124319511/c746c624-571d-429e-b0da-5e9ed0d7f5e3

you can see the guy at the bottom of the screen appear and actually walk around when the 'center mask' is disabled

user18081972 avatar Jun 26 '23 17:06 user18081972

I like to mention, that this could solve the perspective issue of SNES ports:

https://youtu.be/xurqNOafU6Y

ShalokShalom avatar Jul 03 '23 19:07 ShalokShalom