Remove Forced 4:3

This commit is contained in:
Agent X 2024-06-01 13:12:01 -04:00
parent b25fe89b41
commit 54de3b689a
13 changed files with 45 additions and 81 deletions

View File

@ -500,12 +500,6 @@ void render_game(void) {
}
}
if (use_forced_4by3()) {
gDPSetFillColor(gDisplayListHead++, GPACK_RGBA5551(0, 0, 0, 1));
gDPFillRectangle(gDisplayListHead++, GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(0), 0, 0, SCREEN_HEIGHT);
gDPFillRectangle(gDisplayListHead++, SCREEN_WIDTH, 0, GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(0), SCREEN_HEIGHT);
}
D_8032CE74 = NULL;
D_8032CE78 = NULL;
}

View File

@ -168,10 +168,8 @@ void clear_viewport(Vp *viewport, s32 color) {
s16 vpLrx = (viewport->vp.vtrans[0] + viewport->vp.vscale[0]) / 4 - 2;
s16 vpLry = (viewport->vp.vtrans[1] + viewport->vp.vscale[1]) / 4 - 2;
if (!use_forced_4by3()) {
vpUlx = GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(vpUlx);
vpLrx = GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(SCREEN_WIDTH - vpLrx);
}
vpUlx = GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(vpUlx);
vpLrx = GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(SCREEN_WIDTH - vpLrx);
gDPPipeSync(gDisplayListHead++);

View File

@ -304,18 +304,6 @@ void render_hud_power_meter(void) {
#define HUD_TOP_Y 209
#endif
bool use_forced_4by3(void) {
return configForce4By3 && !gDjuiInMainMenu;
}
s32 gfx_dimensions_rect_from_left_edge(s32 v) {
return use_forced_4by3() ? v : GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(v);
}
s32 gfx_dimensions_rect_from_right_edge(s32 v) {
return use_forced_4by3() ? SCREEN_WIDTH - v : GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(v);
}
void render_hud_icon(Vtx *vtx, const u8 *texture, u32 fmt, u32 siz, s32 texW, s32 texH, s32 x, s32 y, s32 w, s32 h, s32 tileX, s32 tileY, s32 tileW, s32 tileH) {
create_dl_ortho_matrix();
if (!vtx) {
@ -347,9 +335,9 @@ void render_hud_icon(Vtx *vtx, const u8 *texture, u32 fmt, u32 siz, s32 texW, s3
*/
void render_hud_mario_lives(void) {
gDPSetEnvColor(gDisplayListHead++, 0xFF, 0xFF, 0xFF, 0xFF);
render_hud_icon(NULL, gMarioState->character->hudHeadTexture.texture, G_IM_FMT_RGBA, G_IM_SIZ_16b, 16, 16, gfx_dimensions_rect_from_left_edge(22), HUD_TOP_Y + 16, 16, 16, 0, 0, 16, 16);
print_text(gfx_dimensions_rect_from_left_edge(38), HUD_TOP_Y, "*"); // 'X' glyph
print_text_fmt_int(gfx_dimensions_rect_from_left_edge(54), HUD_TOP_Y, "%d", gHudDisplay.lives);
render_hud_icon(NULL, gMarioState->character->hudHeadTexture.texture, G_IM_FMT_RGBA, G_IM_SIZ_16b, 16, 16, GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(22), HUD_TOP_Y + 16, 16, 16, 0, 0, 16, 16);
print_text(GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(38), HUD_TOP_Y, "*"); // 'X' glyph
print_text_fmt_int(GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(54), HUD_TOP_Y, "%d", gHudDisplay.lives);
}
/**
@ -373,12 +361,12 @@ void render_hud_cap_timer(void) {
s32 capSeconds = (capTimer + 29) / 30;
const u8 **capIcons = sHudCapIcons[capFlags];
gDPSetEnvColor(gDisplayListHead++, 0xFF, 0xFF, 0xFF, 0xFF);
render_hud_icon(NULL, capIcons[0], G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 32, gfx_dimensions_rect_from_left_edge(22), HUD_TOP_Y - 4, 5, 16, 0, 0, 10, 32);
render_hud_icon(NULL, capIcons[1], G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 32, gfx_dimensions_rect_from_left_edge(27), HUD_TOP_Y - 4, 3, 16, 10, 0, 6, 32);
render_hud_icon(NULL, capIcons[2], G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 32, gfx_dimensions_rect_from_left_edge(30), HUD_TOP_Y - 4, 3, 16, 16, 0, 6, 32);
render_hud_icon(NULL, capIcons[3], G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 32, gfx_dimensions_rect_from_left_edge(33), HUD_TOP_Y - 4, 5, 16, 22, 0, 10, 32);
print_text(gfx_dimensions_rect_from_left_edge(38), HUD_TOP_Y - 20, "*"); // 'X' glyph
print_text_fmt_int(gfx_dimensions_rect_from_left_edge(54), HUD_TOP_Y - 20, "%d", capSeconds);
render_hud_icon(NULL, capIcons[0], G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 32, GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(22), HUD_TOP_Y - 4, 5, 16, 0, 0, 10, 32);
render_hud_icon(NULL, capIcons[1], G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 32, GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(27), HUD_TOP_Y - 4, 3, 16, 10, 0, 6, 32);
render_hud_icon(NULL, capIcons[2], G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 32, GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(30), HUD_TOP_Y - 4, 3, 16, 16, 0, 6, 32);
render_hud_icon(NULL, capIcons[3], G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 32, GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(33), HUD_TOP_Y - 4, 5, 16, 22, 0, 10, 32);
print_text(GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(38), HUD_TOP_Y - 20, "*"); // 'X' glyph
print_text_fmt_int(GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(54), HUD_TOP_Y - 20, "%d", capSeconds);
}
}
}
@ -435,7 +423,7 @@ void render_hud_red_coins_and_secrets_radar(void) {
};
struct Object *redCoin = obj_get_nearest_object_with_behavior_id(m->marioObj, id_bhvRedCoin);
if (redCoin) {
render_hud_radar(m, redCoin, sRedCoinTextures[(gGlobalTimer / 2) % 4], G_IM_FMT_IA, G_IM_SIZ_16b, 32, 32, gfx_dimensions_rect_from_left_edge(24), y, 0, 0, 32, 32, 0xFF, 0x00, 0x00);
render_hud_radar(m, redCoin, sRedCoinTextures[(gGlobalTimer / 2) % 4], G_IM_FMT_IA, G_IM_SIZ_16b, 32, 32, GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(24), y, 0, 0, 32, 32, 0xFF, 0x00, 0x00);
y += 30;
}
}
@ -444,7 +432,7 @@ void render_hud_red_coins_and_secrets_radar(void) {
if (gLevelValues.hudSecretsRadar) {
struct Object *secret = obj_get_nearest_object_with_behavior_id(m->marioObj, id_bhvHiddenStarTrigger);
if (secret) {
render_hud_radar(m, secret, texture_hud_char_S, G_IM_FMT_RGBA, G_IM_SIZ_16b, 16, 16, gfx_dimensions_rect_from_left_edge(24), y, 0, 0, 14, 16, 0xFF, 0xFF, 0xFF);
render_hud_radar(m, secret, texture_hud_char_S, G_IM_FMT_RGBA, G_IM_SIZ_16b, 16, 16, GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(24), y, 0, 0, 14, 16, 0xFF, 0xFF, 0xFF);
y += 30;
}
}
@ -484,11 +472,11 @@ void render_hud_stars(void) {
showX = 1;
}
print_text(gfx_dimensions_rect_from_right_edge(HUD_STARS_X), HUD_TOP_Y, "-"); // 'Star' glyph
print_text(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(HUD_STARS_X), HUD_TOP_Y, "-"); // 'Star' glyph
if (showX == 1) {
print_text(gfx_dimensions_rect_from_right_edge(HUD_STARS_X) + 16, HUD_TOP_Y, "*"); // 'X' glyph
print_text(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(HUD_STARS_X) + 16, HUD_TOP_Y, "*"); // 'X' glyph
}
print_text_fmt_int((showX * 14) + gfx_dimensions_rect_from_right_edge(HUD_STARS_X - 16),
print_text_fmt_int((showX * 14) + GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(HUD_STARS_X - 16),
HUD_TOP_Y, "%d", gHudDisplay.stars);
}
@ -519,13 +507,13 @@ void render_hud_timer(void) {
#ifdef VERSION_EU
switch (eu_get_language()) {
case LANGUAGE_ENGLISH:
print_text(gfx_dimensions_rect_from_right_edge(150), 185, "TIME");
print_text(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(150), 185, "TIME");
break;
case LANGUAGE_FRENCH:
print_text(gfx_dimensions_rect_from_right_edge(155), 185, "TEMPS");
print_text(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(155), 185, "TEMPS");
break;
case LANGUAGE_GERMAN:
print_text(gfx_dimensions_rect_from_right_edge(150), 185, "ZEIT");
print_text(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(150), 185, "ZEIT");
break;
}
#endif
@ -534,14 +522,14 @@ void render_hud_timer(void) {
timerFracSecs = ((timerValFrames - (timerMins * 1800) - (timerSecs * 30)) & 0xFFFF) / 3;
#ifndef VERSION_EU
print_text(gfx_dimensions_rect_from_right_edge(150), 185, "TIME");
print_text(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(150), 185, "TIME");
#endif
print_text_fmt_int(gfx_dimensions_rect_from_right_edge(91), 185, "%0d", timerMins);
print_text_fmt_int(gfx_dimensions_rect_from_right_edge(71), 185, "%02d", timerSecs);
print_text_fmt_int(gfx_dimensions_rect_from_right_edge(37), 185, "%d", timerFracSecs);
print_text_fmt_int(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(91), 185, "%0d", timerMins);
print_text_fmt_int(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(71), 185, "%02d", timerSecs);
print_text_fmt_int(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(37), 185, "%d", timerFracSecs);
gSPDisplayList(gDisplayListHead++, dl_hud_img_begin);
render_hud_tex_lut(gfx_dimensions_rect_from_right_edge(81), 32, (*hudLUT)[GLYPH_APOSTROPHE]);
render_hud_tex_lut(gfx_dimensions_rect_from_right_edge(46), 32, (*hudLUT)[GLYPH_DOUBLE_QUOTE]);
render_hud_tex_lut(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(81), 32, (*hudLUT)[GLYPH_APOSTROPHE]);
render_hud_tex_lut(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(46), 32, (*hudLUT)[GLYPH_DOUBLE_QUOTE]);
gSPDisplayList(gDisplayListHead++, dl_hud_img_end);
}
@ -567,7 +555,7 @@ void render_hud_camera_status(void) {
s32 y;
cameraLUT = segmented_to_virtual(&main_hud_camera_lut);
x = gfx_dimensions_rect_from_right_edge(54);
x = GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(54);
y = 205;
if (sCameraHUD.status == CAM_STATUS_NONE) {

View File

@ -27,10 +27,6 @@ enum CameraHUDLut {
extern u8 gOverrideHideHud;
bool use_forced_4by3(void);
s32 gfx_dimensions_rect_from_left_edge(s32 v);
s32 gfx_dimensions_rect_from_right_edge(s32 v);
void render_hud_icon(Vtx *vtx, const u8 *texture, u32 fmt, u32 siz, s32 texW, s32 texH, s32 x, s32 y, s32 w, s32 h, s32 tileX, s32 tileY, s32 tileW, s32 tileH);
s16 get_hud_camera_status(void);

View File

@ -2442,7 +2442,7 @@ void render_pause_red_coins(void) {
if (gCurrentArea->numRedCoins == 8) {
u8 collected = gCurrentArea->numRedCoins - count_objects_with_behavior(bhvRedCoin);
for (s32 x = 0; x < collected; x++) {
print_animated_red_coin(gfx_dimensions_rect_from_right_edge(30) - x * 20, 16);
print_animated_red_coin(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(30) - x * 20, 16);
}
return;
}

View File

@ -357,13 +357,11 @@ Gfx *render_cannon_circle_base(void) {
make_vertex(verts, 2, SCREEN_WIDTH, SCREEN_HEIGHT, -1, 1152, 192, 0, 0, 0, 255);
make_vertex(verts, 3, 0, SCREEN_HEIGHT, -1, -1152, 192, 0, 0, 0, 255);
if (!use_forced_4by3()) {
// Render black rectangles outside the 4:3 area.
make_vertex(verts, 4, GFX_DIMENSIONS_FROM_LEFT_EDGE(0), 0, -1, 0, 0, 0, 0, 0, 255);
make_vertex(verts, 5, GFX_DIMENSIONS_FROM_RIGHT_EDGE(0), 0, -1, 0, 0, 0, 0, 0, 255);
make_vertex(verts, 6, GFX_DIMENSIONS_FROM_RIGHT_EDGE(0), SCREEN_HEIGHT, -1, 0, 0, 0, 0, 0, 255);
make_vertex(verts, 7, GFX_DIMENSIONS_FROM_LEFT_EDGE(0), SCREEN_HEIGHT, -1, 0, 0, 0, 0, 0, 255);
}
// render black rectangles outside the 4:3 area.
make_vertex(verts, 4, GFX_DIMENSIONS_FROM_LEFT_EDGE(0), 0, -1, 0, 0, 0, 0, 0, 255);
make_vertex(verts, 5, GFX_DIMENSIONS_FROM_RIGHT_EDGE(0), 0, -1, 0, 0, 0, 0, 0, 255);
make_vertex(verts, 6, GFX_DIMENSIONS_FROM_RIGHT_EDGE(0), SCREEN_HEIGHT, -1, 0, 0, 0, 0, 0, 255);
make_vertex(verts, 7, GFX_DIMENSIONS_FROM_LEFT_EDGE(0), SCREEN_HEIGHT, -1, 0, 0, 0, 0, 0, 255);
gSPDisplayList(g++, dl_proj_mtx_fullscreen);
gDPSetCombineMode(g++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
@ -375,12 +373,10 @@ Gfx *render_cannon_circle_base(void) {
gSPDisplayList(g++, dl_draw_quad_verts_0123);
gSPTexture(g++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF);
if (!use_forced_4by3()) {
gDPSetCombineMode(g++, G_CC_SHADE, G_CC_SHADE);
gSPVertexNonGlobal(g++, VIRTUAL_TO_PHYSICAL(verts + 4), 4, 4);
gSP2Triangles(g++, 4, 0, 3, 0, 4, 3, 7, 0);
gSP2Triangles(g++, 1, 5, 6, 0, 1, 6, 2, 0);
}
gDPSetCombineMode(g++, G_CC_SHADE, G_CC_SHADE);
gSPVertexNonGlobal(g++, VIRTUAL_TO_PHYSICAL(verts + 4), 4, 4);
gSP2Triangles(g++, 4, 0, 3, 0, 4, 3, 7, 0);
gSP2Triangles(g++, 1, 5, 6, 0, 1, 6, 2, 0);
gSPDisplayList(g++, dl_screen_transition_end);
gSPEndDisplayList(g);

View File

@ -271,14 +271,12 @@ void *create_skybox_ortho_matrix(s8 player) {
gBackgroundSkyboxMtx = mtx;
}
if (!use_forced_4by3()) {
f32 half_width = (4.0f / 3.0f) / GFX_DIMENSIONS_ASPECT_RATIO * SCREEN_WIDTH / 2;
f32 center = (sSkyBoxInfo[player].scaledX + SCREEN_WIDTH / 2);
if (half_width < SCREEN_WIDTH / 2) {
// A wider screen than 4:3
left = center - half_width;
right = center + half_width;
}
f32 half_width = (4.0f / 3.0f) / GFX_DIMENSIONS_ASPECT_RATIO * SCREEN_WIDTH / 2;
f32 center = (sSkyBoxInfo[player].scaledX + SCREEN_WIDTH / 2);
if (half_width < SCREEN_WIDTH / 2) {
// A wider screen than 4:3
left = center - half_width;
right = center + half_width;
}
if (mtx != NULL) {

View File

@ -84,7 +84,6 @@ unsigned int configFiltering = 2; // 0 = Nearest, 1 = Bilin
bool configShowFPS = false;
bool configUncappedFramerate = false;
unsigned int configFrameLimit = 60;
bool configForce4By3 = false;
unsigned int configInterpolationMode = 1;
unsigned int configDrawDistance = 4;
// sound settings
@ -196,7 +195,6 @@ static const struct ConfigOption options[] = {
{.name = "show_fps", .type = CONFIG_TYPE_BOOL, .boolValue = &configShowFPS},
{.name = "uncapped_framerate", .type = CONFIG_TYPE_BOOL, .boolValue = &configUncappedFramerate},
{.name = "frame_limit", .type = CONFIG_TYPE_UINT, .uintValue = &configFrameLimit},
{.name = "force_4by3", .type = CONFIG_TYPE_BOOL, .boolValue = &configForce4By3},
{.name = "interpolation_mode", .type = CONFIG_TYPE_UINT, .uintValue = &configInterpolationMode},
{.name = "coop_draw_distance", .type = CONFIG_TYPE_UINT, .uintValue = &configDrawDistance},
// sound settings

View File

@ -36,7 +36,6 @@ extern unsigned int configFiltering;
extern bool configShowFPS;
extern bool configUncappedFramerate;
extern unsigned int configFrameLimit;
extern bool configForce4By3;
extern unsigned int configInterpolationMode;
extern unsigned int configDrawDistance;
// sound settings

View File

@ -90,7 +90,7 @@ void ctx_profiler_update_counters(void) {
if ((c < '0' || c > '9') && (c < 'A' || c > 'Z')) c = ' ';
text[j] = c;
}
print_text(gfx_dimensions_rect_from_left_edge(4), y, text);
print_text(GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(4), y, text);
y -= 18;
}
}

View File

@ -71,7 +71,7 @@ static void djui_hud_position_translate(f32* x, f32* y) {
if (sResolution == RESOLUTION_DJUI) {
djui_gfx_position_translate(x, y);
} else {
*x = gfx_dimensions_rect_from_left_edge(0) + *x;
*x = GFX_DIMENSIONS_FROM_LEFT_EDGE(0) + *x;
*y = SCREEN_HEIGHT - *y;
}
}

View File

@ -61,9 +61,6 @@ void djui_panel_display_create(struct DjuiBase* caller) {
{
djui_checkbox_create(body, DLANG(DISPLAY, FULLSCREEN), &configWindow.fullscreen, djui_panel_display_apply);
djui_checkbox_create(body, DLANG(DISPLAY, FORCE_4BY3), &configForce4By3, djui_panel_display_apply);
djui_checkbox_create(body, DLANG(DISPLAY, SHOW_FPS), &configShowFPS, NULL);
djui_checkbox_create(body, DLANG(DISPLAY, VSYNC), &configWindow.vsync, djui_panel_display_apply);
djui_checkbox_create(body, DLANG(DISPLAY, UNCAPPED_FRAMERATE), &configUncappedFramerate, djui_panel_display_uncapped_change);

View File

@ -76,7 +76,7 @@ void lua_profiler_update_counters(void) {
if ((c < '0' || c > '9') && (c < 'A' || c > 'Z')) c = ' ';
text[j] = c;
}
print_text(gfx_dimensions_rect_from_left_edge(4), y, text);
print_text(GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(4), y, text);
}
}