-should have fixed all video problems now, using custom video

files based on libogc svn r4902 instead of the current libogc
ones, using the best of both :P
This commit is contained in:
fix94.1 2012-06-13 20:30:35 +00:00
parent adb0fcb17b
commit e4bb926948
10 changed files with 3238 additions and 258 deletions

View File

@ -8,6 +8,7 @@
#include "fileOps.h" #include "fileOps.h"
#include "utils.h" #include "utils.h"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"
#include "loader/video_sys.h"
#define SRAM_ENGLISH 0 #define SRAM_ENGLISH 0
#define SRAM_GERMAN 1 #define SRAM_GERMAN 1
@ -23,13 +24,11 @@ DML_CFG *DMLCfg = NULL;
void GC_SetVideoMode(u8 videomode) void GC_SetVideoMode(u8 videomode)
{ {
syssram *sram; syssram *sram = __SYS_LockSram();
sram = __SYS_LockSram();
void *m_frameBuf;
static GXRModeObj *rmode; static GXRModeObj *rmode;
int memflag = 0; int memflag = 0;
if((VIDEO_HaveComponentCable() && (CONF_GetProgressiveScan() > 0)) || videomode > 3) if((CUSTOM_VIDEO_HaveComponentCable() && (CONF_GetProgressiveScan() > 0)) || videomode > 3)
sram->flags |= 0x80; //set progressive flag sram->flags |= 0x80; //set progressive flag
else else
sram->flags &= 0x7F; //clear progressive flag sram->flags &= 0x7F; //clear progressive flag
@ -47,19 +46,19 @@ void GC_SetVideoMode(u8 videomode)
} }
if(videomode == 1) if(videomode == 1)
rmode = &TVPal528IntDf; rmode = &CUSTOM_TVPal528IntDf;
else if(videomode == 2) else if(videomode == 2)
rmode = &TVNtsc480IntDf; rmode = &CUSTOM_TVNtsc480IntDf;
else if(videomode == 3) else if(videomode == 3)
{ {
rmode = &TVEurgb60Hz480IntDf; rmode = &CUSTOM_TVEurgb60Hz480IntDf;
memflag = 5; memflag = 5;
} }
else if(videomode == 4) else if(videomode == 4)
rmode = &TVNtsc480Prog; rmode = &CUSTOM_TVNtsc480Prog;
else if(videomode == 5) else if(videomode == 5)
{ {
rmode = &TVEurgb60Hz480Prog; rmode = &CUSTOM_TVEurgb60Hz480Prog;
memflag = 5; memflag = 5;
} }
@ -71,17 +70,16 @@ void GC_SetVideoMode(u8 videomode)
DCFlushRange((void *)(0x800000CC), 4); DCFlushRange((void *)(0x800000CC), 4);
ICInvalidateRange((void *)(0x800000CC), 4); ICInvalidateRange((void *)(0x800000CC), 4);
VIDEO_Configure(rmode); /* Set video mode */
m_frameBuf = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode)); if (rmode != 0)
CUSTOM_VIDEO_Configure(rmode);
VIDEO_ClearFrameBuffer(rmode, m_frameBuf, COLOR_BLACK); /* Setup video */
VIDEO_SetNextFramebuffer(m_frameBuf); CUSTOM_VIDEO_SetBlack(TRUE);
CUSTOM_VIDEO_Flush();
VIDEO_SetBlack(TRUE); CUSTOM_VIDEO_WaitVSync();
VIDEO_Flush(); if(rmode->viTVMode & VI_NON_INTERLACE)
VIDEO_WaitVSync(); CUSTOM_VIDEO_WaitVSync();
if(rmode->viTVMode&VI_NON_INTERLACE)
VIDEO_WaitVSync();
} }
u8 get_wii_language() u8 get_wii_language()

View File

@ -104,32 +104,22 @@ void CVideo::setAA(u8 aa, bool alpha, int width, int height)
} }
} }
extern GXRModeObj TVPal574IntDfScale;
void CVideo::init(void) void CVideo::init(void)
{ {
VIDEO_Init(); CUSTOM_VIDEO_Init();
VIDEO_SetBlack(TRUE); CUSTOM_VIDEO_SetBlack(TRUE);
m_wide = CONF_GetAspectRatio() == CONF_ASPECT_16_9; m_wide = CONF_GetAspectRatio() == CONF_ASPECT_16_9;
m_rmode = VIDEO_GetPreferredMode(NULL); m_rmode = CUSTOM_VIDEO_GetPreferredMode(NULL);
u32 type = CONF_GetVideo(); u32 type = CONF_GetVideo();
m_rmode->viWidth = m_wide ? 700 : 672; m_rmode->viWidth = m_wide ? 700 : 672;
if(m_rmode == &TVPal576IntDfScale) if(m_rmode == &CUSTOM_TVPal574IntDfScale)
{
m_rmode = &TVPal574IntDfScale; //We may get some problems otherwise
VIDEO_Configure(m_rmode);
VIDEO_Flush();
m_rmode = &TVPal576IntDfScale;
VIDEO_Configure(m_rmode);
VIDEO_Flush();
m_50hz = true; m_50hz = true;
}
else else
m_50hz = false; m_50hz = false;
//CONF_VIDEO_NTSC and CONF_VIDEO_MPAL and m_rmode TVEurgb60Hz480IntDf are the same max height and width. //CONF_CUSTOM_VIDEO_NTSC and CONF_CUSTOM_VIDEO_MPAL and m_rmode CUSTOM_TVEurgb60Hz480IntDf are the same max height and width.
if (type == CONF_VIDEO_PAL && m_rmode != &TVEurgb60Hz480IntDf) if (type == CONF_VIDEO_PAL && m_rmode != &CUSTOM_TVEurgb60Hz480IntDf)
{ {
m_rmode->viHeight = VI_MAX_HEIGHT_PAL; m_rmode->viHeight = VI_MAX_HEIGHT_PAL;
m_rmode->viXOrigin = (VI_MAX_WIDTH_PAL - m_rmode->viWidth) / 2; m_rmode->viXOrigin = (VI_MAX_WIDTH_PAL - m_rmode->viWidth) / 2;
@ -148,8 +138,8 @@ void CVideo::init(void)
m_frameBuf[0] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(m_rmode)); m_frameBuf[0] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(m_rmode));
m_frameBuf[1] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(m_rmode)); m_frameBuf[1] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(m_rmode));
VIDEO_Configure(m_rmode); CUSTOM_VIDEO_Configure(m_rmode);
VIDEO_Flush(); CUSTOM_VIDEO_Flush();
m_curFB = 0; m_curFB = 0;
m_fifo = MEM1_memalign(32, DEFAULT_FIFO_SIZE); m_fifo = MEM1_memalign(32, DEFAULT_FIFO_SIZE);
memset(m_fifo, 0, DEFAULT_FIFO_SIZE); memset(m_fifo, 0, DEFAULT_FIFO_SIZE);
@ -178,11 +168,11 @@ void CVideo::init(void)
GX_SetZCompLoc(GX_ENABLE); GX_SetZCompLoc(GX_ENABLE);
setup2DProjection(); setup2DProjection();
_clearScreen(); _clearScreen();
VIDEO_SetBlack(FALSE); CUSTOM_VIDEO_SetBlack(FALSE);
VIDEO_Flush(); CUSTOM_VIDEO_Flush();
VIDEO_WaitVSync(); CUSTOM_VIDEO_WaitVSync();
if(m_rmode->viTVMode & VI_NON_INTERLACE) if(m_rmode->viTVMode & VI_NON_INTERLACE)
VIDEO_WaitVSync(); CUSTOM_VIDEO_WaitVSync();
m_stencil = MEM1_memalign(32, CVideo::_stencilWidth * CVideo::_stencilHeight); m_stencil = MEM1_memalign(32, CVideo::_stencilWidth * CVideo::_stencilHeight);
memset(m_stencil, 0, CVideo::_stencilWidth * CVideo::_stencilHeight); memset(m_stencil, 0, CVideo::_stencilWidth * CVideo::_stencilHeight);
@ -190,8 +180,8 @@ void CVideo::init(void)
void CVideo::_clearScreen() void CVideo::_clearScreen()
{ {
VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[0], COLOR_BLACK); CUSTOM_VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[0], COLOR_BLACK);
VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[1], COLOR_BLACK); CUSTOM_VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[1], COLOR_BLACK);
render(); render();
render(); render();
} }
@ -247,8 +237,8 @@ void CVideo::cleanup(void)
gprintf("Cleaning up video...\n"); gprintf("Cleaning up video...\n");
_clearScreen(); _clearScreen();
VIDEO_SetBlack(TRUE); CUSTOM_VIDEO_SetBlack(TRUE);
VIDEO_Flush(); CUSTOM_VIDEO_Flush();
GX_DrawDone(); GX_DrawDone();
GX_AbortFrame(); GX_AbortFrame();
@ -469,9 +459,9 @@ void CVideo::render(void)
GX_SetColorUpdate(GX_TRUE); GX_SetColorUpdate(GX_TRUE);
GX_CopyDisp(MEM_K1_TO_K0(m_frameBuf[m_curFB]), GX_TRUE); GX_CopyDisp(MEM_K1_TO_K0(m_frameBuf[m_curFB]), GX_TRUE);
DCFlushRange(m_frameBuf[m_curFB], 2 * m_rmode->fbWidth * m_rmode->xfbHeight); DCFlushRange(m_frameBuf[m_curFB], 2 * m_rmode->fbWidth * m_rmode->xfbHeight);
VIDEO_SetNextFramebuffer(m_frameBuf[m_curFB]); CUSTOM_VIDEO_SetNextFramebuffer(m_frameBuf[m_curFB]);
VIDEO_Flush(); CUSTOM_VIDEO_Flush();
VIDEO_WaitVSync(); CUSTOM_VIDEO_WaitVSync();
m_curFB ^= 1; m_curFB ^= 1;
GX_InvalidateTexAll(); GX_InvalidateTexAll();
} }
@ -528,7 +518,7 @@ void CVideo::_showWaitMessages(CVideo *m)
waitFrames = frames; waitFrames = frames;
} }
waitFrames--; waitFrames--;
VIDEO_WaitVSync(); CUSTOM_VIDEO_WaitVSync();
} }
if (m->m_useWiiLight) if (m->m_useWiiLight)
wiiLightOff(); wiiLightOff();

View File

@ -8,6 +8,7 @@
#include "smartptr.hpp" #include "smartptr.hpp"
#include "vector.hpp" #include "vector.hpp"
#include "texture.hpp" #include "texture.hpp"
#include "video_sys.h"
using namespace std; using namespace std;

View File

@ -67,12 +67,12 @@ void __Disc_SetLowMem()
memcpy((void *)Online_Check, (void *)Disc_ID, 4); memcpy((void *)Online_Check, (void *)Disc_ID, 4);
} }
GXRModeObj * __Disc_SelectVMode(u8 videoselected, u64 chantitle) GXRModeObj *__Disc_SelectVMode(u8 videoselected, u64 chantitle)
{ {
vmode = VIDEO_GetPreferredMode(0); vmode = CUSTOM_VIDEO_GetPreferredMode(0);
/* Get video mode configuration */ /* Get video mode configuration */
bool progressive = (CONF_GetProgressiveScan() > 0) && VIDEO_HaveComponentCable(); bool progressive = (CONF_GetProgressiveScan() > 0) && CUSTOM_VIDEO_HaveComponentCable();
/* Select video mode register */ /* Select video mode register */
switch (CONF_GetVideo()) switch (CONF_GetVideo())
@ -81,7 +81,7 @@ GXRModeObj * __Disc_SelectVMode(u8 videoselected, u64 chantitle)
if (CONF_GetEuRGB60() > 0) if (CONF_GetEuRGB60() > 0)
{ {
vmode_reg = VI_EURGB60; vmode_reg = VI_EURGB60;
vmode = progressive ? &TVNtsc480Prog : &TVEurgb60Hz480IntDf; vmode = progressive ? &CUSTOM_TVNtsc480Prog : &CUSTOM_TVEurgb60Hz480IntDf;
} }
else else
vmode_reg = VI_PAL; vmode_reg = VI_PAL;
@ -118,7 +118,7 @@ GXRModeObj * __Disc_SelectVMode(u8 videoselected, u64 chantitle)
if (CONF_GetVideo() != CONF_VIDEO_PAL) if (CONF_GetVideo() != CONF_VIDEO_PAL)
{ {
vmode_reg = VI_PAL; vmode_reg = VI_PAL;
vmode = progressive ? &TVNtsc480Prog : &TVNtsc480IntDf; vmode = progressive ? &CUSTOM_TVNtsc480Prog : &CUSTOM_TVNtsc480IntDf;
} }
break; break;
// NTSC // NTSC
@ -128,28 +128,28 @@ GXRModeObj * __Disc_SelectVMode(u8 videoselected, u64 chantitle)
if (CONF_GetVideo() != CONF_VIDEO_NTSC) if (CONF_GetVideo() != CONF_VIDEO_NTSC)
{ {
vmode_reg = VI_NTSC; vmode_reg = VI_NTSC;
vmode = progressive ? &TVEurgb60Hz480Prog : &TVEurgb60Hz480IntDf; vmode = progressive ? &CUSTOM_TVEurgb60Hz480Prog : &CUSTOM_TVEurgb60Hz480IntDf;
} }
break; break;
} }
break; break;
case 1: // PAL50 case 1: // PAL50
vmode = &TVPal528IntDf; vmode = &CUSTOM_TVPal528IntDf;
vmode_reg = vmode->viTVMode >> 2; vmode_reg = vmode->viTVMode >> 2;
break; break;
case 2: // PAL60 case 2: // PAL60
vmode = progressive ? &TVEurgb60Hz480Prog : &TVEurgb60Hz480IntDf; vmode = progressive ? &CUSTOM_TVEurgb60Hz480Prog : &CUSTOM_TVEurgb60Hz480IntDf;
vmode_reg = progressive ? vmode->viTVMode >> 2 : vmode->viTVMode >> 2; vmode_reg = progressive ? vmode->viTVMode >> 2 : vmode->viTVMode >> 2;
break; break;
case 3: // NTSC case 3: // NTSC
vmode = progressive ? &TVNtsc480Prog : &TVNtsc480IntDf; vmode = progressive ? &CUSTOM_TVNtsc480Prog : &CUSTOM_TVNtsc480IntDf;
vmode_reg = vmode->viTVMode >> 2; vmode_reg = vmode->viTVMode >> 2;
break; break;
case 4: // AUTO PATCH TO SYSTEM case 4: // AUTO PATCH TO SYSTEM
case 5: // SYSTEM case 5: // SYSTEM
break; break;
case 6: // PROGRESSIVE 480P(NTSC + PATCH ALL) case 6: // PROGRESSIVE 480P(NTSC + PATCH ALL)
vmode = &TVNtsc480Prog; vmode = &CUSTOM_TVNtsc480Prog;
vmode_reg = vmode->viTVMode >> 2; vmode_reg = vmode->viTVMode >> 2;
break; break;
default: default:
@ -168,14 +168,14 @@ void __Disc_SetVMode(void)
/* Set video mode */ /* Set video mode */
if (disc_vmode != 0) if (disc_vmode != 0)
VIDEO_Configure(disc_vmode); CUSTOM_VIDEO_Configure(disc_vmode);
/* Setup video */ /* Setup video */
VIDEO_SetBlack(TRUE); CUSTOM_VIDEO_SetBlack(TRUE);
VIDEO_Flush(); CUSTOM_VIDEO_Flush();
VIDEO_WaitVSync(); CUSTOM_VIDEO_WaitVSync();
if(disc_vmode->viTVMode & VI_NON_INTERLACE) if(disc_vmode->viTVMode & VI_NON_INTERLACE)
VIDEO_WaitVSync(); CUSTOM_VIDEO_WaitVSync();
} }
void __Disc_SetTime(void) void __Disc_SetTime(void)

2793
source/loader/video_sys.c Normal file

File diff suppressed because it is too large Load Diff

205
source/loader/video_sys.h Normal file
View File

@ -0,0 +1,205 @@
/*-------------------------------------------------------------
video.h -- VIDEO subsystem
Copyright (C) 2004
Michael Wiedenbauer (shagkur)
Dave Murphy (WinterMute)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you
must not claim that you wrote the original software. If you use
this software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
-------------------------------------------------------------*/
#ifndef __VIDEO_SYS_H__
#define __VIDEO_SYS_H__
/*!
* \file video.h
* \brief VIDEO subsystem
*
*/
#include <gctypes.h>
#include "video_types.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*!
* \typedef void (*VIRetraceCallback)(u32 retraceCnt)
* \brief function pointer typedef for the user's retrace callback
* \param[in] retraceCnt current retrace count
*/
typedef void (*VIRetraceCallback)(u32 retraceCnt);
typedef void (*VIPositionCallback)(u32 posX,u32 posY);
void* CUSTOM_VIDEO_GetNextFramebuffer();
void* CUSTOM_VIDEO_GetCurrentFramebuffer();
/*!
* \fn void CUSTOM_VIDEO_Init()
* \brief Initializes the VIDEO subsystem. This call should be done in the early stages of your main()
*
* \return none
*/
void CUSTOM_VIDEO_Init();
/*!
* \fn void CUSTOM_VIDEO_Flush()
* \brief Flush the shadow registers to the drivers video registers.
*
* \return none
*/
void CUSTOM_VIDEO_Flush();
/*!
* \fn void CUSTOM_VIDEO_SetBlack(bool black)
* \brief Blackout the VIDEO interface.
*
* \param[in] black Boolean flag to determine whether to blackout the VI or not.
*
* \return none
*/
void CUSTOM_VIDEO_SetBlack(bool black);
/*!
* \fn u32 CUSTOM_VIDEO_GetNextField()
* \brief Get the next field in DS mode.
*
* \return \ref vi_fielddef "field"
*/
u32 CUSTOM_VIDEO_GetNextField();
/*!
* \fn u32 CUSTOM_VIDEO_GetCurrentLine()
* \brief Get current video line
*
* \return linenumber
*/
u32 CUSTOM_VIDEO_GetCurrentLine();
/*!
* \fn u32 CUSTOM_VIDEO_GetCurrentTvMode()
* \brief Get current configured TV mode
*
* \return \ref vi_standardtypedef "tvmode"
*/
u32 CUSTOM_VIDEO_GetCurrentTvMode();
/*!
* \fn void CUSTOM_VIDEO_Configure(GXRModeObj *rmode)
* \brief Configure the VI with the given render mode object
*
* \param[in] rmode pointer to the video/render mode \ref gxrmode_obj "configuration".
*
* \return none
*/
void CUSTOM_VIDEO_Configure(GXRModeObj *rmode);
u32 CUSTOM_VIDEO_GetFrameBufferSize(GXRModeObj *rmode);
/*!
* \fn void CUSTOM_VIDEO_ClearFrameBuffer(GXRModeObj *rmode,void *fb,u32 color)
* \brief Clear the given framebuffer.
*
* \param[in] rmode pointer to a GXRModeObj, specifying the mode.
* \param[in] fb pointer to the startaddress of the framebuffer to clear.
* \param[in] color YUYUV value to use for clearing.
*
* \return none
*/
void CUSTOM_VIDEO_ClearFrameBuffer(GXRModeObj *rmode,void *fb,u32 color);
/*!
* \fn void CUSTOM_VIDEO_WaitVSync(void)
* \brief Wait on the next vertical retrace
*
* \return none
*/
void CUSTOM_VIDEO_WaitVSync(void);
/*!
* \fn void CUSTOM_VIDEO_SetNextFramebuffer(void *fb)
* \brief Set the framebuffer for the next VI register update.
*
* \return none
*/
void CUSTOM_VIDEO_SetNextFramebuffer(void *fb);
/*!
* \fn void CUSTOM_VIDEO_SetNextRightFramebuffer(void *fb)
* \brief Set the right framebuffer for the next VI register update. This is used for 3D Gloves for instance.
*
* \return none
*/
void CUSTOM_VIDEO_SetNextRightFramebuffer(void *fb);
/*!
* \fn VIRetraceCallback CUSTOM_VIDEO_SetPreRetraceCallback(VIRetraceCallback callback)
* \brief Set the Pre-Retrace callback function. This function is called within the video interrupt handler before the VI registers will be updated.
*
* \param[in] callback pointer to the callback function which is called at pre-retrace.
*
* \return Old pre-retrace callback or NULL
*/
VIRetraceCallback CUSTOM_VIDEO_SetPreRetraceCallback(VIRetraceCallback callback);
/*!
* \fn VIRetraceCallback CUSTOM_VIDEO_SetPostRetraceCallback(VIRetraceCallback callback)
* \brief Set the Post-Retrace callback function. This function is called within the video interrupt handler after the VI registers are updated.
*
* \param[in] callback pointer to the callback function which is called at post-retrace.
*
* \return Old post-retrace callback or NULL
*/
VIRetraceCallback CUSTOM_VIDEO_SetPostRetraceCallback(VIRetraceCallback callback);
/*!
* \fn u32 CUSTOM_VIDEO_HaveComponentCable(void)
* \brief Check for a component cable. This function returns 1 when a Component (YPbPr) cable is connected.
*
* \return 1 if a component cable is connected, 0 otherwise
*/
u32 CUSTOM_VIDEO_HaveComponentCable(void);
GXRModeObj * CUSTOM_VIDEO_GetPreferredMode(GXRModeObj *mode);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

135
source/loader/video_types.h Normal file
View File

@ -0,0 +1,135 @@
/*-------------------------------------------------------------
video_types.h -- support header
Copyright (C) 2004
Michael Wiedenbauer (shagkur)
Dave Murphy (WinterMute)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you
must not claim that you wrote the original software. If you use
this software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
-------------------------------------------------------------*/
#ifndef __VIDEO_TYPES_SYS_H__
#define __VIDEO_TYPES_SYS_H__
#undef VI_MAX_HEIGHT_PAL
/*!
\file video_types.h
\brief support header
*/
#include <gctypes.h>
#define VI_DISPLAY_PIX_SZ 2 /*!< multiplier to get real pixel size in bytes */
#define VI_INTERLACE 0 /*!< Video mode INTERLACED. */
#define VI_NON_INTERLACE 1 /*!< Video mode NON INTERLACED */
#define VI_PROGRESSIVE 2 /*!< Video mode PROGRESSIVE. Special mode for higher quality */
#define VI_NTSC 0 /*!< Video standard used in North America and Japan */
#define VI_PAL 1 /*!< Video standard used in Europe */
#define VI_MPAL 2 /*!< Video standard, similar to NTSC, used in Brazil */
#define VI_DEBUG 3 /*!< Video standard, for debugging purpose, used in North America and Japan. Special decoder needed */
#define VI_DEBUG_PAL 4 /*!< Video standard, for debugging purpose, used in Europe. Special decoder needed */
#define VI_EURGB60 5 /*!< RGB 60Hz, 480 lines mode (same timing and aspect ratio as NTSC) used in Europe */
#define VI_XFBMODE_SF 0
#define VI_XFBMODE_DF 1
#define VI_FIELD_ABOVE 1 /*!< Upper field in DS mode */
#define VI_FIELD_BELOW 0 /*!< Lower field in DS mode */
// Maximum screen space
#define VI_MAX_WIDTH_NTSC 720
#define VI_MAX_HEIGHT_NTSC 480
#define VI_MAX_WIDTH_PAL 720
#define VI_MAX_HEIGHT_PAL 574
#define VI_MAX_WIDTH_MPAL 720
#define VI_MAX_HEIGHT_MPAL 480
#define VI_MAX_WIDTH_EURGB60 VI_MAX_WIDTH_NTSC
#define VI_MAX_HEIGHT_EURGB60 VI_MAX_HEIGHT_NTSC
#define VI_TVMODE(fmt, mode) ( ((fmt) << 2) + (mode) )
#define VI_TVMODE_NTSC_INT VI_TVMODE(VI_NTSC, VI_INTERLACE)
#define VI_TVMODE_NTSC_DS VI_TVMODE(VI_NTSC, VI_NON_INTERLACE)
#define VI_TVMODE_NTSC_PROG VI_TVMODE(VI_NTSC, VI_PROGRESSIVE)
#define VI_TVMODE_NTSC_PROG_DS VI_TVMODE(VI_NTSC, (VI_PROGRESSIVE|VI_NON_INTERLACE))
#define VI_TVMODE_PAL_INT VI_TVMODE(VI_PAL, VI_INTERLACE)
#define VI_TVMODE_PAL_DS VI_TVMODE(VI_PAL, VI_NON_INTERLACE)
#define VI_TVMODE_EURGB60_INT VI_TVMODE(VI_EURGB60, VI_INTERLACE)
#define VI_TVMODE_EURGB60_DS VI_TVMODE(VI_EURGB60, VI_NON_INTERLACE)
#define VI_TVMODE_EURGB60_PROG VI_TVMODE(VI_EURGB60, VI_PROGRESSIVE)
#define VI_TVMODE_EURGB60_PROG_DS VI_TVMODE(VI_EURGB60, (VI_PROGRESSIVE|VI_NON_INTERLACE))
#define VI_TVMODE_MPAL_INT VI_TVMODE(VI_MPAL, VI_INTERLACE)
#define VI_TVMODE_MPAL_DS VI_TVMODE(VI_MPAL, VI_NON_INTERLACE)
#define VI_TVMODE_DEBUG_INT VI_TVMODE(VI_DEBUG, VI_INTERLACE)
#define VI_TVMODE_DEBUG_PAL_INT VI_TVMODE(VI_DEBUG_PAL, VI_INTERLACE)
#define VI_TVMODE_DEBUG_PAL_DS VI_TVMODE(VI_DEBUG_PAL, VI_NON_INTERLACE)
extern GXRModeObj CUSTOM_TVNtsc240Ds; /*!< Video and render mode configuration for 240 lines,singlefield NTSC mode */
extern GXRModeObj CUSTOM_TVNtsc240DsAa; /*!< Video and render mode configuration for 240 lines,singlefield,antialiased NTSC mode */
extern GXRModeObj CUSTOM_TVNtsc240Int; /*!< Video and render mode configuration for 240 lines,interlaced NTSC mode */
extern GXRModeObj CUSTOM_TVNtsc240IntAa; /*!< Video and render mode configuration for 240 lines,interlaced,antialiased NTSC mode */
extern GXRModeObj CUSTOM_TVNtsc480Int; /*!< Video and render mode configuration for 480 lines,interlaced NTSC mode */
extern GXRModeObj CUSTOM_TVNtsc480IntDf; /*!< Video and render mode configuration for 480 lines,interlaced,doublefield NTSC mode */
extern GXRModeObj CUSTOM_TVNtsc480IntAa; /*!< Video and render mode configuration for 480 lines,interlaced,doublefield,antialiased NTSC mode */
extern GXRModeObj CUSTOM_TVNtsc480Prog; /*!< Video and render mode configuration for 480 lines,progressive,singlefield NTSC mode */
extern GXRModeObj CUSTOM_TVNtsc480ProgSoft;
extern GXRModeObj CUSTOM_TVNtsc480ProgAa;
extern GXRModeObj CUSTOM_TVMpal480IntDf; /*!< Video and render mode configuration for 480 lines,interlaced,doublefield,antialiased MPAL mode */
extern GXRModeObj CUSTOM_TVMpal480IntAa;
extern GXRModeObj CUSTOM_TVMpal480Prog;
extern GXRModeObj CUSTOM_TVMpal240Ds;
extern GXRModeObj CUSTOM_TVMpal240DsAa;
extern GXRModeObj CUSTOM_TVPal264Ds; /*!< Video and render mode configuration for 264 lines,singlefield PAL mode */
extern GXRModeObj CUSTOM_TVPal264DsAa; /*!< Video and render mode configuration for 264 lines,singlefield,antialiased PAL mode */
extern GXRModeObj CUSTOM_TVPal264Int; /*!< Video and render mode configuration for 264 lines,interlaced PAL mode */
extern GXRModeObj CUSTOM_TVPal264IntAa; /*!< Video and render mode configuration for 264 lines,interlaced,antialiased PAL mode */
extern GXRModeObj CUSTOM_TVPal524IntAa; /*!< Video and render mode configuration for 524 lines,interlaced,antialiased PAL mode */
extern GXRModeObj CUSTOM_TVPal528Int; /*!< Video and render mode configuration for 528 lines,interlaced,antialiased PAL mode */
extern GXRModeObj CUSTOM_TVPal528IntDf; /*!< Video and render mode configuration for 264 lines,interlaced,doublefield antialiased PAL mode */
extern GXRModeObj CUSTOM_TVPal574IntDfScale;
extern GXRModeObj CUSTOM_TVPal528Prog;
extern GXRModeObj CUSTOM_TVPal528ProgSoft;
extern GXRModeObj CUSTOM_TVPal528ProgUnknown;
extern GXRModeObj CUSTOM_TVEurgb60Hz240Ds;
extern GXRModeObj CUSTOM_TVEurgb60Hz240DsAa;
extern GXRModeObj CUSTOM_TVEurgb60Hz240Int;
extern GXRModeObj CUSTOM_TVEurgb60Hz240IntAa;
extern GXRModeObj CUSTOM_TVEurgb60Hz480Int;
extern GXRModeObj CUSTOM_TVEurgb60Hz480IntDf;
extern GXRModeObj CUSTOM_TVEurgb60Hz480IntAa;
extern GXRModeObj CUSTOM_TVEurgb60Hz480Prog;
extern GXRModeObj CUSTOM_TVEurgb60Hz480ProgSoft;
extern GXRModeObj CUSTOM_TVEurgb60Hz480ProgAa;
#endif

View File

@ -1,168 +1,29 @@
// Inspired by WiiPower's "video toy", but simpler // Inspired by WiiPower's "video toy", but simpler
#include "videopatch.h" #include "videopatch.h"
#include "video_types.h"
#include <string.h> #include <string.h>
#define ARRAY_SIZE(a) (sizeof a / sizeof a[0]) #define ARRAY_SIZE(a) (sizeof a / sizeof a[0])
extern GXRModeObj TVNtsc480Int;
GXRModeObj TVPal528Prog =
{
6, // viDisplayMode
640, // fbWidth
528, // efbHeight
528, // xfbHeight
(VI_MAX_WIDTH_PAL - 640)/2, // viXOrigin
(VI_MAX_HEIGHT_PAL - 528)/2, // viYOrigin
640, // viWidth
528, // viHeight
VI_XFBMODE_SF, // xFBmode
GX_FALSE, // field_rendering
GX_FALSE, // aa
// sample points arranged in increasing Y order
{
{6,6},{6,6},{6,6}, // pix 0, 3 sample points, 1/12 units, 4 bits each
{6,6},{6,6},{6,6}, // pix 1
{6,6},{6,6},{6,6}, // pix 2
{6,6},{6,6},{6,6} // pix 3
},
// vertical filter[7], 1/64 units, 6 bits each
{
0, // line n-1
0, // line n-1
21, // line n
22, // line n
21, // line n
0, // line n+1
0 // line n+1
}
};
GXRModeObj TVPal528ProgSoft =
{
6, // viDisplayMode
640, // fbWidth
528, // efbHeight
528, // xfbHeight
(VI_MAX_WIDTH_PAL - 640)/2, // viXOrigin
(VI_MAX_HEIGHT_PAL - 528)/2, // viYOrigin
640, // viWidth
528, // viHeight
VI_XFBMODE_SF, // xFBmode
GX_FALSE, // field_rendering
GX_FALSE, // aa
// sample points arranged in increasing Y order
{
{6,6},{6,6},{6,6}, // pix 0, 3 sample points, 1/12 units, 4 bits each
{6,6},{6,6},{6,6}, // pix 1
{6,6},{6,6},{6,6}, // pix 2
{6,6},{6,6},{6,6} // pix 3
},
// vertical filter[7], 1/64 units, 6 bits each
{
8, // line n-1
8, // line n-1
10, // line n
12, // line n
10, // line n
8, // line n+1
8 // line n+1
}
};
GXRModeObj TVPal528ProgUnknown =
{
6, // viDisplayMode
640, // fbWidth
264, // efbHeight
524, // xfbHeight
(VI_MAX_WIDTH_PAL - 640)/2, // viXOrigin
(VI_MAX_HEIGHT_PAL - 528)/2, // viYOrigin
640, // viWidth
524, // viHeight
VI_XFBMODE_SF, // xFBmode
GX_FALSE, // field_rendering
GX_TRUE, // aa
// sample points arranged in increasing Y order
{
{3,2},{9,6},{3,10}, // pix 0, 3 sample points, 1/12 units, 4 bits each
{3,2},{9,6},{3,10}, // pix 1
{9,2},{3,6},{9,10}, // pix 2
{9,2},{3,6},{9,10} // pix 3
},
// vertical filter[7], 1/64 units, 6 bits each
{
4, // line n-1
8, // line n-1
12, // line n
16, // line n
12, // line n
8, // line n+1
4 // line n+1
}
};
GXRModeObj TVPal574IntDfScale =
{
VI_TVMODE_PAL_INT, // viDisplayMode
640, // fbWidth
480, // efbHeight
574, // xfbHeight
(VI_MAX_WIDTH_PAL - 640)/2, // viXOrigin
(VI_MAX_HEIGHT_PAL - 574)/2, // viYOrigin
640, // viWidth
574, // viHeight
VI_XFBMODE_DF, // xFBmode
GX_FALSE, // field_rendering
GX_FALSE, // aa
// sample points arranged in increasing Y order
{
{6,6},{6,6},{6,6}, // pix 0, 3 sample points, 1/12 units, 4 bits each
{6,6},{6,6},{6,6}, // pix 1
{6,6},{6,6},{6,6}, // pix 2
{6,6},{6,6},{6,6} // pix 3
},
// vertical filter[7], 1/64 units, 6 bits each
{
8, // line n-1
8, // line n-1
10, // line n
12, // line n
10, // line n
8, // line n+1
8 // line n+1
}
};
static const GXRModeObj *g_vidmodes[] = { static const GXRModeObj *g_vidmodes[] = {
&TVNtsc480Int, &CUSTOM_TVNtsc480Int,
&TVNtsc480IntDf, &CUSTOM_TVNtsc480IntDf,
&TVNtsc480Prog, &CUSTOM_TVNtsc480Prog,
&TVPal528Int, &CUSTOM_TVPal528Int,
&TVPal528IntDf, &CUSTOM_TVPal528IntDf,
&TVPal528Prog, &CUSTOM_TVPal528Prog,
&TVPal528ProgSoft, &CUSTOM_TVPal528ProgSoft,
&TVPal528ProgUnknown, &CUSTOM_TVPal528ProgUnknown,
&TVMpal480IntDf, &CUSTOM_TVMpal480IntDf,
&TVMpal480Prog, &CUSTOM_TVMpal480Prog,
&TVEurgb60Hz480Int, &CUSTOM_TVEurgb60Hz480Int,
&TVEurgb60Hz480IntDf, &CUSTOM_TVEurgb60Hz480IntDf,
&TVEurgb60Hz480Prog &CUSTOM_TVEurgb60Hz480Prog
}; };
// Level : // Level :
@ -204,47 +65,47 @@ static void patch_videomode(GXRModeObj* mode1, GXRModeObj* mode2)
} }
static GXRModeObj* PAL2NTSC[]={ static GXRModeObj* PAL2NTSC[]={
&TVMpal480IntDf, &TVNtsc480IntDf, &CUSTOM_TVMpal480IntDf, &CUSTOM_TVNtsc480IntDf,
&TVPal264Ds, &TVNtsc240Ds, &CUSTOM_TVPal264Ds, &CUSTOM_TVNtsc240Ds,
&TVPal264DsAa, &TVNtsc240DsAa, &CUSTOM_TVPal264DsAa, &CUSTOM_TVNtsc240DsAa,
&TVPal264Int, &TVNtsc240Int, &CUSTOM_TVPal264Int, &CUSTOM_TVNtsc240Int,
&TVPal264IntAa, &TVNtsc240IntAa, &CUSTOM_TVPal264IntAa, &CUSTOM_TVNtsc240IntAa,
&TVPal524IntAa, &TVNtsc480IntAa, &CUSTOM_TVPal524IntAa, &CUSTOM_TVNtsc480IntAa,
&TVPal528Int, &TVNtsc480IntAa, &CUSTOM_TVPal528Int, &CUSTOM_TVNtsc480IntAa,
&TVPal528IntDf, &TVNtsc480IntDf, &CUSTOM_TVPal528IntDf, &CUSTOM_TVNtsc480IntDf,
&TVPal574IntDfScale, &TVNtsc480IntDf, &CUSTOM_TVPal574IntDfScale, &CUSTOM_TVNtsc480IntDf,
&TVEurgb60Hz240Ds, &TVNtsc240Ds, &CUSTOM_TVEurgb60Hz240Ds, &CUSTOM_TVNtsc240Ds,
&TVEurgb60Hz240DsAa, &TVNtsc240DsAa, &CUSTOM_TVEurgb60Hz240DsAa, &CUSTOM_TVNtsc240DsAa,
&TVEurgb60Hz240Int, &TVNtsc240Int, &CUSTOM_TVEurgb60Hz240Int, &CUSTOM_TVNtsc240Int,
&TVEurgb60Hz240IntAa, &TVNtsc240IntAa, &CUSTOM_TVEurgb60Hz240IntAa, &CUSTOM_TVNtsc240IntAa,
&TVEurgb60Hz480Int, &TVNtsc480IntAa, &CUSTOM_TVEurgb60Hz480Int, &CUSTOM_TVNtsc480IntAa,
&TVEurgb60Hz480IntDf, &TVNtsc480IntDf, &CUSTOM_TVEurgb60Hz480IntDf, &CUSTOM_TVNtsc480IntDf,
&TVEurgb60Hz480IntAa, &TVNtsc480IntAa, &CUSTOM_TVEurgb60Hz480IntAa, &CUSTOM_TVNtsc480IntAa,
&TVEurgb60Hz480Prog, &TVNtsc480Prog, &CUSTOM_TVEurgb60Hz480Prog, &CUSTOM_TVNtsc480Prog,
&TVEurgb60Hz480ProgSoft,&TVNtsc480Prog, &CUSTOM_TVEurgb60Hz480ProgSoft,&CUSTOM_TVNtsc480Prog,
&TVEurgb60Hz480ProgAa, &TVNtsc480Prog, &CUSTOM_TVEurgb60Hz480ProgAa, &CUSTOM_TVNtsc480Prog,
0,0 0,0
}; };
static GXRModeObj* NTSC2PAL[]={ static GXRModeObj* NTSC2PAL[]={
&TVNtsc240Ds, &TVPal264Ds, &CUSTOM_TVNtsc240Ds, &CUSTOM_TVPal264Ds,
&TVNtsc240DsAa, &TVPal264DsAa, &CUSTOM_TVNtsc240DsAa, &CUSTOM_TVPal264DsAa,
&TVNtsc240Int, &TVPal264Int, &CUSTOM_TVNtsc240Int, &CUSTOM_TVPal264Int,
&TVNtsc240IntAa, &TVPal264IntAa, &CUSTOM_TVNtsc240IntAa, &CUSTOM_TVPal264IntAa,
&TVNtsc480IntDf, &TVPal528IntDf, &CUSTOM_TVNtsc480IntDf, &CUSTOM_TVPal528IntDf,
&TVNtsc480IntAa, &TVPal524IntAa, &CUSTOM_TVNtsc480IntAa, &CUSTOM_TVPal524IntAa,
&TVNtsc480Prog, &TVPal528IntDf, &CUSTOM_TVNtsc480Prog, &CUSTOM_TVPal528IntDf,
0,0 0,0
}; };
static GXRModeObj* NTSC2PAL60[]={ static GXRModeObj* NTSC2PAL60[]={
&TVNtsc240Ds, &TVEurgb60Hz240Ds, &CUSTOM_TVNtsc240Ds, &CUSTOM_TVEurgb60Hz240Ds,
&TVNtsc240DsAa, &TVEurgb60Hz240DsAa, &CUSTOM_TVNtsc240DsAa, &CUSTOM_TVEurgb60Hz240DsAa,
&TVNtsc240Int, &TVEurgb60Hz240Int, &CUSTOM_TVNtsc240Int, &CUSTOM_TVEurgb60Hz240Int,
&TVNtsc240IntAa, &TVEurgb60Hz240IntAa, &CUSTOM_TVNtsc240IntAa, &CUSTOM_TVEurgb60Hz240IntAa,
&TVNtsc480IntDf, &TVEurgb60Hz480IntDf, &CUSTOM_TVNtsc480IntDf, &CUSTOM_TVEurgb60Hz480IntDf,
&TVNtsc480IntAa, &TVEurgb60Hz480IntAa, &CUSTOM_TVNtsc480IntAa, &CUSTOM_TVEurgb60Hz480IntAa,
&TVNtsc480Prog, &TVEurgb60Hz480Prog, &CUSTOM_TVNtsc480Prog, &CUSTOM_TVEurgb60Hz480Prog,
0,0 0,0
}; };

View File

@ -2,8 +2,8 @@
#define _VIDEOPATCH_H_ #define _VIDEOPATCH_H_
#include <gccore.h> #include <gccore.h>
#include "video_sys.h"
void patchVideoModes(void *dst, u32 len, int vidMode, GXRModeObj *vmode, int patchVidModes); void patchVideoModes(void *dst, u32 len, int vidMode, GXRModeObj *vmode, int patchVidModes);
#endif // !defined(_VIDEOPATCH_H_) #endif // !defined(_VIDEOPATCH_H_)

View File

@ -2196,19 +2196,16 @@ void CMenu::_stopSounds(void)
// Fade out sounds // Fade out sounds
int fade_rate = m_cfg.getInt("GENERAL", "music_fade_rate", 8); int fade_rate = m_cfg.getInt("GENERAL", "music_fade_rate", 8);
if (!MusicPlayer::Instance()->IsStopped()) if(!MusicPlayer::Instance()->IsStopped())
{ {
while (MusicPlayer::Instance()->GetVolume() > 0 || m_gameSound.GetVolume() > 0) while(MusicPlayer::Instance()->GetVolume() > 0 || m_gameSound.GetVolume() > 0)
{ {
MusicPlayer::Instance()->Tick(true); MusicPlayer::Instance()->Tick(true);
if(m_gameSound.GetVolume() > 0)
if (m_gameSound.GetVolume() > 0)
m_gameSound.SetVolume(m_gameSound.GetVolume() < fade_rate ? 0 : m_gameSound.GetVolume() - fade_rate); m_gameSound.SetVolume(m_gameSound.GetVolume() < fade_rate ? 0 : m_gameSound.GetVolume() - fade_rate);
CUSTOM_VIDEO_WaitVSync();
VIDEO_WaitVSync();
} }
} }
m_btnMgr.stopSounds(); m_btnMgr.stopSounds();
m_cf.stopSound(); m_cf.stopSound();