Improved Wii aspect ratio significantly

This commit is contained in:
2026-04-17 23:49:39 -05:00
parent 1dd2efa182
commit 2451d73a7c
11 changed files with 122 additions and 43 deletions
@@ -8,6 +8,7 @@
#include "display/framebuffer/framebuffer.h"
#include "display/display.h"
#include "assert/assert.h"
#include "system/systemdolphin.h"
errorret_t frameBufferInitBackBufferDolphin(void) {
errorOk();
@@ -15,16 +16,29 @@ errorret_t frameBufferInitBackBufferDolphin(void) {
uint32_t frameBufferGetWidthDolphin(const framebufferdolphin_t *framebuffer) {
assertNotNull(framebuffer, "Cannot get width of NULL framebuffer.");
return DISPLAY.screenMode->fbWidth;
}
uint32_t frameBufferGetHeightDolphin(const framebufferdolphin_t *framebuffer) {
assertNotNull(framebuffer, "Cannot get height of NULL framebuffer.");
return DISPLAY.screenMode->efbHeight;
}
float_t frameBufferGetAspectDolphin(const framebufferdolphin_t *framebuffer) {
assertNotNull(framebuffer, "Cannot get aspect of NULL framebuffer.");
switch(systemGetAspectRatioDolphin()) {
case CONF_ASPECT_16_9:
return 16.0f / 9.0f;
case CONF_ASPECT_4_3:
return 4.0f / 3.0f;
default:
return (
(float_t)DISPLAY.screenMode->fbWidth /
(float_t)DISPLAY.screenMode->efbHeight
);
}
}
errorret_t frameBufferBindDolphin(framebufferdolphin_t *framebuffer) {
assertNotNull(framebuffer, "Cannot bind NULL framebuffer.");
assertTrue(
@@ -38,6 +38,15 @@ uint32_t frameBufferGetWidthDolphin(const framebufferdolphin_t *framebuffer);
*/
uint32_t frameBufferGetHeightDolphin(const framebufferdolphin_t *framebuffer);
/**
* Gets the aspect ratio of the framebuffer. (Dolphin implementation). Taking
* the Wii aspect setting into consideration.
*
* @param framebuffer The framebuffer to get the aspect ratio of.
* @return The aspect ratio of the framebuffer.
*/
float_t frameBufferGetAspectDolphin(const framebufferdolphin_t *framebuffer);
/**
* Binds the framebuffer for rendering. (Dolphin implementation).
*
@@ -13,5 +13,6 @@ typedef framebufferdolphin_t framebufferplatform_t;
#define frameBufferPlatformInitBackBuffer frameBufferInitBackBufferDolphin
#define frameBufferPlatformGetWidth frameBufferGetWidthDolphin
#define frameBufferPlatformGetHeight frameBufferGetHeightDolphin
#define frameBufferPlatformGetAspect frameBufferGetAspectDolphin
#define frameBufferPlatformBind frameBufferBindDolphin
#define frameBufferPlatformClear frameBufferClearDolphin
#define frameBufferPlatformClear frameBufferClearDolphin
@@ -228,12 +228,13 @@ errorret_t shaderUpdateMVPDolphin() {
// Set Model/View Matrix
if(mvDirt) {
guMtxConcat(
SHADER_BOUND->matrixView,
SHADER_BOUND->matrixModel,
SHADER_BOUND->matrixModelView
);
GX_LoadPosMtxImm(SHADER_BOUND->matrixModelView, GX_PNMTX0);
// guMtxConcat(
// SHADER_BOUND->matrixView,
// SHADER_BOUND->matrixModel,
// SHADER_BOUND->matrixModelView
// );
// GX_LoadPosMtxImm(SHADER_BOUND->matrixModelView, GX_PNMTX0);
GX_LoadPosMtxImm(SHADER_BOUND->matrixView, GX_PNMTX0);
}
SHADER_BOUND->dirtyMatrix = 0;
@@ -255,7 +256,7 @@ void shaderMat4ToMtx(const mat4 inGlmMatrix, Mtx outGXMatrix) {
assertNotNull(inGlmMatrix, "Input matrix cannot be null");
assertNotNull(outGXMatrix, "Output matrix cannot be null");
for(int row = 0; row < 3; ++row) {
for(int row = 0; row < 4; ++row) {// Can perhaps be 3.
for(int col = 0; col < 4; ++col) {
outGXMatrix[row][col] = inGlmMatrix[col][row];
}
+8
View File
@@ -16,4 +16,12 @@ errorret_t systemInitDolphin(void) {
systemdialogtype_t systemGetActiveDialogTypeDolphin(void) {
return SYSTEM_DIALOG_TYPE_NONE;
}
int32_t systemGetAspectRatioDolphin(void) {
return CONF_GetAspectRatio();
}
int32_t systemGetLanguageDolphin(void) {
return CONF_GetLanguage();
}
+26 -1
View File
@@ -20,4 +20,29 @@ errorret_t systemInitDolphin(void);
*
* @return Currently open system dialog type.
*/
systemdialogtype_t systemGetActiveDialogTypeDolphin(void);
systemdialogtype_t systemGetActiveDialogTypeDolphin(void);
/**
* Returns either CONF_ASPECT_4_3 or CONF_ASPECT_16_9 depending on the aspect
* ratio of the system. I do believe that Gamecube will only ever return 4:3.
*
* Refer to;
* https://github.com/devkitPro/libogc/blob/20d90e944b83c8991538e88b00b1e5f309428e85/gc/ogc/conf.h#L190
*
* @return Aspect ratio of the system.
*/
int32_t systemGetAspectRatioDolphin(void);
/**
* Returns the language the system is set to. This is used for things like
* locale management, to try to match the system language if possible.
*
* Refer to;
* https://github.com/devkitPro/libogc/blob/20d90e944b83c8991538e88b00b1e5f309428e85/gc/ogc/conf.h#L190
*
* @return System language.
*/
int32_t systemGetLanguageDolphin(void);
// There's actually a tonne more things Wii can return, this is it for now
// though.