Skip to content

Commit 9a0abbe

Browse files
authored
Add 800px mode for New 3DS models (#18380)
* Update 800x240 mode for n3DS models - Backported 800x240 display settings from libctru - Removed/renamed old 800x240 display functionality - Readded menu option for non-2DS models * replace bannertool.exe with a working version * Update ctr_defines.h * Fix missed rename
1 parent 9f45a4a commit 9a0abbe

3 files changed

Lines changed: 18 additions & 23 deletions

File tree

gfx/drivers/ctr_gfx.c

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ typedef struct ctr_video
192192
bool keep_aspect;
193193
bool should_resize;
194194
bool msg_rendering_enabled;
195-
bool supports_parallax_disable;
195+
bool supports_wide_display;
196196
bool enable_3d;
197197
bool p3d_event_pending;
198198
bool ppf_event_pending;
@@ -831,18 +831,15 @@ static INLINE void ctr_check_3D_slider(ctr_video_t* ctr, ctr_video_mode_enum vid
831831

832832
GSPGPU_FlushDataCache(ctr->frame_coords, 3 * sizeof(ctr_vertex_t));
833833

834-
if (ctr->supports_parallax_disable)
835-
ctr_set_parallax_layer(true);
836834
ctr->enable_3d = true;
837835
}
838836
break;
839837
case CTR_VIDEO_MODE_2D_400X240:
840838
case CTR_VIDEO_MODE_2D_800X240:
841-
if (ctr->supports_parallax_disable)
839+
if (ctr->supports_wide_display)
842840
{
843841
ctr->video_mode = video_mode;
844-
ctr_set_parallax_layer(false);
845-
ctr->enable_3d = true;
842+
ctr->enable_3d = false;
846843
}
847844
else
848845
{
@@ -853,8 +850,6 @@ static INLINE void ctr_check_3D_slider(ctr_video_t* ctr, ctr_video_mode_enum vid
853850
case CTR_VIDEO_MODE_2D:
854851
default:
855852
ctr->video_mode = CTR_VIDEO_MODE_2D;
856-
if (ctr->supports_parallax_disable)
857-
ctr_set_parallax_layer(false);
858853
ctr->enable_3d = false;
859854
break;
860855
}
@@ -1722,8 +1717,6 @@ static void ctr_lcd_aptHook(APT_HookType hook, void* param)
17221717
gfxTopRightFramebuffers[
17231718
ctr->current_buffer_top], 400 * 240 * 3);
17241719
}
1725-
if (ctr->supports_parallax_disable)
1726-
ctr_set_parallax_layer(*(float*)0x1FF81080 != 0.0);
17271720
ctr_set_bottom_screen_enable(true, ctr->bottom_is_idle);
17281721
save_state_to_file(ctr);
17291722
break;
@@ -1954,7 +1947,7 @@ static void* ctr_init(const video_info_t* video,
19541947
* (i.e. these are the only platforms that can use
19551948
* CTR_VIDEO_MODE_2D_400X240 and CTR_VIDEO_MODE_2D_800X240) */
19561949
CFGU_GetSystemModel(&device_model); /* (0 = O3DS, 1 = O3DSXL, 2 = N3DS, 3 = 2DS, 4 = N3DSXL, 5 = N2DSXL) */
1957-
ctr->supports_parallax_disable = (device_model == 0) || (device_model == 1);
1950+
ctr->supports_wide_display = device_model != 3;
19581951

19591952
refresh_rate = (32730.0 * 8192.0) / 4481134.0;
19601953

@@ -2448,14 +2441,16 @@ static bool ctr_frame(void* data, const void* frame,
24482441

24492442
#ifdef USE_CTRULIB_2
24502443
u32 *buf0, *buf1, *bottom;
2451-
u32 stride;
2444+
u32 stride = 240 * 3;
2445+
u8 bit5, bit6;
24522446

24532447
buf0 = (u32*)gfxTopLeftFramebuffers[ctr->current_buffer_top];
24542448

24552449
if (ctr->video_mode == CTR_VIDEO_MODE_2D_800X240)
24562450
{
2457-
buf1 = (u32*)(gfxTopLeftFramebuffers[ctr->current_buffer_top] + 240 * 3);
2458-
stride = 240 * 3 * 2;
2451+
buf1 = buf0;
2452+
bit5 = false;
2453+
bit6 = false;
24592454
}
24602455
else
24612456
{
@@ -2464,13 +2459,14 @@ static bool ctr_frame(void* data, const void* frame,
24642459
else
24652460
buf1 = buf0;
24662461

2467-
stride = 240 * 3;
2462+
bit5 = (ctr->enable_3d != 0);
2463+
bit6 = 1^bit5;
24682464
}
24692465

2470-
u8 bit5 = (ctr->enable_3d != 0);
2466+
24712467

24722468
gspPresentBuffer(GFX_TOP, ctr->current_buffer_top, buf0, buf1,
2473-
stride, (1<<8)|((1^bit5)<<6)|((bit5)<<5)|GSP_BGR8_OES);
2469+
stride, (1<<8)|((bit6)<<6)|((bit5)<<5)|GSP_BGR8_OES);
24742470

24752471
#ifndef CONSOLE_LOG
24762472
if (ctr->refresh_bottom_menu)
@@ -2490,13 +2486,13 @@ static bool ctr_frame(void* data, const void* frame,
24902486
active_framebuf = ctr->current_buffer_top;
24912487
topFramebufferInfo.
24922488
framebuf0_vaddr = (u32*)gfxTopLeftFramebuffers[ctr->current_buffer_top];
2489+
topFramebufferInfo.
2490+
framebuf_widthbytesize = 240 * 3;
24932491

24942492
if (ctr->video_mode == CTR_VIDEO_MODE_2D_800X240)
24952493
{
24962494
topFramebufferInfo.
24972495
framebuf1_vaddr = (u32*)(gfxTopLeftFramebuffers[ctr->current_buffer_top] + 240 * 3);
2498-
topFramebufferInfo.
2499-
framebuf_widthbytesize = 240 * 3 * 2;
25002496
}
25012497
else
25022498
{
@@ -2507,11 +2503,10 @@ static bool ctr_frame(void* data, const void* frame,
25072503
topFramebufferInfo.
25082504
framebuf1_vaddr = topFramebufferInfo.framebuf0_vaddr;
25092505

2510-
topFramebufferInfo.
2511-
framebuf_widthbytesize = 240 * 3;
25122506
}
25132507

2514-
u8 bit5 = (ctr->enable_3d != 0);
2508+
u8 bit5 = (ctr->enable_3d != 0) & (ctr->video_mode != CTR_VIDEO_MODE_2D_800X240);
2509+
u8 bit6 = (1^bit5) & (ctr->video_mode != CTR_VIDEO_MODE_2D_800X240);
25152510
topFramebufferInfo.format = (1<<8)|((1^bit5)<<6)|((bit5)<<5)|GSP_BGR8_OES;
25162511
topFramebufferInfo.
25172512
framebuf_dispselect = ctr->current_buffer_top;

menu/menu_setting.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20853,7 +20853,7 @@ static bool setting_append_list(
2085320853
(*list)[list_info->index - 1].get_string_representation =
2085420854
&setting_get_string_representation_uint_video_3ds_display_mode;
2085520855
menu_settings_list_current_add_range(list, list_info, 0,
20856-
CTR_VIDEO_MODE_LAST - (((device_model == 0) || (device_model == 1)) ? 1 : 3),
20856+
CTR_VIDEO_MODE_LAST - ((device_model != 3) ? 1 : 3),
2085720857
1, true, true);
2085820858
}
2085920859

pkg/ctr/tools/bannertool.exe

-3.06 MB
Binary file not shown.

0 commit comments

Comments
 (0)