Skip to content

Commit c4a4f22

Browse files
committed
Support NTSC-N on GameCube
1 parent efce083 commit c4a4f22

5 files changed

Lines changed: 43 additions & 10 deletions

File tree

include/ogc/video_types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
video_types.h -- support header
44
5-
Copyright (C) 2004 - 2025
5+
Copyright (C) 2004 - 2026
66
Michael Wiedenbauer (shagkur)
77
Dave Murphy (WinterMute)
88
Extrems' Corner.org
@@ -140,6 +140,7 @@ distribution.
140140

141141
#define VI_TVMODE_DEBUG_PAL_INT VI_TVMODE(VI_DEBUG_PAL, VI_INTERLACE)
142142
#define VI_TVMODE_DEBUG_PAL_DS VI_TVMODE(VI_DEBUG_PAL, VI_NON_INTERLACE)
143+
#define VI_TVMODE_DEBUG_PAL_PROG VI_TVMODE(VI_DEBUG_PAL, VI_PROGRESSIVE)
143144

144145

145146
/*!

libmodplay/modplay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ static u32* modplay_getinctab(s32 freq)
146146
if(inc_tabs[curr_tab]) return inc_tabs[curr_tab];
147147

148148
tv = VIDEO_GetCurrentTvMode();
149-
if(tv==VI_PAL) fdivid = 7093789.2/2.0F;
149+
if(tv==VI_PAL || tv==VI_DEBUG_PAL) fdivid = 7093789.2/2.0F;
150150
else fdivid = 7159090.5/2.0F;
151151

152152
inc_tab = (u32*)malloc(sizeof(u32)*4096);

libogc/n64.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ static void N64_RefreshPositionInterrupt(void)
263263
VIDEO_EnablePositionInterrupt(0, VI_MAX_HEIGHT_NTSC - 31, PositionCallback);
264264
return;
265265
case VI_PAL:
266+
case VI_DEBUG_PAL:
266267
VIDEO_EnablePositionInterrupt(0, VI_MAX_HEIGHT_PAL - 32, PositionCallback);
267268
VIDEO_EnablePositionInterrupt(0, VI_MAX_HEIGHT_PAL - 31, PositionCallback);
268269
return;

libogc/si.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ static __inline__ struct _xy* __si_getxy(void)
134134
return xy[0];
135135
break;
136136
case VI_PAL:
137+
case VI_DEBUG_PAL:
137138
return xy[1];
138139
break;
139140
}

libogc/video.c

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,6 +1647,26 @@ static const struct _timing {
16471647
0x017B,
16481648
0x7A,0x019C
16491649
},
1650+
{
1651+
0x06,0x0120,
1652+
0x001E,0x001F,0x0001,0x0000,
1653+
0x0D,0x0C,0x0B,0x0A,
1654+
0x026B,0x026A,0x0269,0x026C,
1655+
0x0271,0x01AD,
1656+
0x40,0x47,0x69,0xA2,
1657+
0x0175,
1658+
0x7A,0x019C
1659+
},
1660+
{
1661+
0x06,0x0120,
1662+
0x001E,0x001E,0x0002,0x0002,
1663+
0x0D,0x0B,0x0D,0x0B,
1664+
0x026B,0x026D,0x026B,0x026D,
1665+
0x0272,0x01AD,
1666+
0x40,0x47,0x69,0xA2,
1667+
0x0175,
1668+
0x7A,0x019C
1669+
},
16501670
{
16511671
0x0A,0x0240,
16521672
0x0044,0x0044,0x0000,0x0000,
@@ -1785,11 +1805,9 @@ static const struct _timing* __gettiming(u32 vimode)
17851805
return &video_timing[1];
17861806
break;
17871807
case VI_TVMODE_PAL_INT:
1788-
case VI_TVMODE_DEBUG_PAL_INT:
17891808
return &video_timing[2];
17901809
break;
17911810
case VI_TVMODE_PAL_DS:
1792-
case VI_TVMODE_DEBUG_PAL_DS:
17931811
return &video_timing[3];
17941812
break;
17951813
case VI_TVMODE_MPAL_INT:
@@ -1806,9 +1824,16 @@ static const struct _timing* __gettiming(u32 vimode)
18061824
case VI_TVMODE_NTSC_3D:
18071825
return &video_timing[7];
18081826
break;
1809-
case VI_TVMODE_PAL_PROG:
1827+
case VI_TVMODE_DEBUG_PAL_INT:
18101828
return &video_timing[8];
18111829
break;
1830+
case VI_TVMODE_DEBUG_PAL_DS:
1831+
return &video_timing[9];
1832+
break;
1833+
case VI_TVMODE_PAL_PROG:
1834+
case VI_TVMODE_DEBUG_PAL_PROG:
1835+
return &video_timing[10];
1836+
break;
18121837
default:
18131838
break;
18141839
}
@@ -2577,7 +2602,7 @@ void* VIDEO_GetCurrentFramebuffer(void)
25772602

25782603
void VIDEO_Init(void)
25792604
{
2580-
u32 level,vimode = 0;
2605+
u32 level,vimode;
25812606
u32 *tvInBootrom = (u32*)0x800000cc;
25822607

25832608
if(video_initialized) return;
@@ -2617,10 +2642,14 @@ void VIDEO_Init(void)
26172642

26182643
HorVer.nonInter = VIDEO_GetScanMode();
26192644
HorVer.tv = _SHIFTR(_viReg[1],8,2);
2620-
if(HorVer.tv==VI_NTSC && (*tvInBootrom==VI_PAL || *tvInBootrom==VI_EURGB60)) HorVer.tv = VI_EURGB60;
2645+
if(HorVer.tv==VI_NTSC) {
2646+
if(*tvInBootrom==VI_PAL) HorVer.tv = VI_EURGB60;
2647+
else if(*tvInBootrom==VI_DEBUG_PAL) HorVer.tv = VI_DEBUG_PAL;
2648+
else if(*tvInBootrom==VI_EURGB60) HorVer.tv = VI_EURGB60;
2649+
}
26212650

2622-
vimode = HorVer.nonInter;
2623-
if(HorVer.tv!=VI_DEBUG) vimode |= (HorVer.tv<<2);
2651+
if(HorVer.tv==VI_DEBUG) vimode = VI_TVMODE(VI_NTSC,HorVer.nonInter);
2652+
else vimode = VI_TVMODE(HorVer.tv,HorVer.nonInter);
26242653
currTiming = __gettiming(vimode);
26252654
currTvMode = HorVer.tv;
26262655

@@ -2959,7 +2988,7 @@ u32 VIDEO_GetCurrentTvMode(void)
29592988

29602989
_CPU_ISR_Disable(level);
29612990
if(currTvMode==VI_PAL) tv = VI_PAL;
2962-
else if(currTvMode==VI_DEBUG_PAL) tv = VI_PAL;
2991+
else if(currTvMode==VI_DEBUG_PAL) tv = VI_DEBUG_PAL;
29632992
else if(currTvMode==VI_EURGB60) tv = VI_EURGB60;
29642993
else if(currTvMode==VI_MPAL) tv = VI_MPAL;
29652994
else tv = VI_NTSC;
@@ -3004,6 +3033,7 @@ f32 VIDEO_GetAspectRatio(void)
30043033
if(height<480) ratio *= 480.0f / (f32)height;
30053034
break;
30063035
case VI_PAL:
3036+
case VI_DEBUG_PAL:
30073037
if(width<704) ratio *= (f32)width / 704.0f;
30083038
if(height<576) ratio *= 576.0f / (f32)height;
30093039
break;

0 commit comments

Comments
 (0)