-lets use libogc svn r4902 again, sure the new libogc got some

nice additions but its just too unstable for wiiflow
This commit is contained in:
fix94.1 2012-06-14 15:27:57 +00:00
parent 4c34695ec4
commit ec69ecb55f
18 changed files with 294 additions and 3368 deletions

View File

@ -326,13 +326,3 @@ u8 *GetDol(u64 title, u32 bootcontent)
gprintf("Failed!\n");
return NULL;
}
s32 WiiFlow_LaunchTitle(u64 titleID)
{
u32 numviews;
STACK_ALIGN(tikview,views,4,32);
ES_GetNumTicketViews(titleID, &numviews);
ES_GetTicketViews(titleID, views, numviews);
return ES_LaunchTitle(titleID, &views[0]);
}

View File

@ -18,8 +18,6 @@ u8 *GetDol(u64 title, u32 bootcontent);
bool Identify(u64 titleid, u32 *ios);
bool Identify_GenerateTik(signed_blob **outbuf, u32 *outlen);
s32 WiiFlow_LaunchTitle(u64 titleID);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -8,7 +8,6 @@
#include "fileOps.h"
#include "utils.h"
#include "memory/mem2.hpp"
#include "loader/video_sys.h"
#define SRAM_ENGLISH 0
#define SRAM_GERMAN 1
@ -25,17 +24,17 @@ DML_CFG *DMLCfg = NULL;
void GC_SetVideoMode(u8 videomode)
{
syssram *sram = __SYS_LockSram();
static GXRModeObj *rmode;
int memflag = 0;
static GXRModeObj *vmode;
int vmode_reg = 0;
if((CUSTOM_VIDEO_HaveComponentCable() && (CONF_GetProgressiveScan() > 0)) || videomode > 3)
if((VIDEO_HaveComponentCable() && (CONF_GetProgressiveScan() > 0)) || videomode > 3)
sram->flags |= 0x80; //set progressive flag
else
sram->flags &= 0x7F; //clear progressive flag
if(videomode == 1 || videomode == 3 || videomode == 5)
{
memflag = 1;
vmode_reg = 1;
sram->flags |= 0x01; // Set bit 0 to set the video mode to PAL
sram->ntd |= 0x40; //set pal60 flag
}
@ -46,40 +45,39 @@ void GC_SetVideoMode(u8 videomode)
}
if(videomode == 1)
rmode = &CUSTOM_TVPal528IntDf;
vmode = &TVPal528IntDf;
else if(videomode == 2)
rmode = &CUSTOM_TVNtsc480IntDf;
vmode = &TVNtsc480IntDf;
else if(videomode == 3)
{
rmode = &CUSTOM_TVEurgb60Hz480IntDf;
memflag = 5;
vmode = &TVEurgb60Hz480IntDf;
vmode_reg = 5;
}
else if(videomode == 4)
rmode = &CUSTOM_TVNtsc480Prog;
vmode = &TVNtsc480Prog;
else if(videomode == 5)
{
rmode = &CUSTOM_TVEurgb60Hz480Prog;
memflag = 5;
vmode = &TVNtsc480Prog;
vmode_reg = 5;
}
__SYS_UnlockSram(1); // 1 -> write changes
while(!__SYS_SyncSram());
/* Set video mode to PAL or NTSC */
*(vu32*)0x800000CC = memflag;
/* Set video mode register */
*(vu32 *)0x800000CC = vmode_reg;
DCFlushRange((void *)(0x800000CC), 4);
ICInvalidateRange((void *)(0x800000CC), 4);
/* Set video mode */
if (rmode != 0)
CUSTOM_VIDEO_Configure(rmode);
if(vmode != 0)
VIDEO_Configure(vmode);
/* Setup video */
CUSTOM_VIDEO_SetBlack(TRUE);
CUSTOM_VIDEO_Flush();
CUSTOM_VIDEO_WaitVSync();
if(rmode->viTVMode & VI_NON_INTERLACE)
CUSTOM_VIDEO_WaitVSync();
VIDEO_SetBlack(TRUE);
VIDEO_Flush();
VIDEO_WaitVSync();
if(vmode->viTVMode & VI_NON_INTERLACE)
VIDEO_WaitVSync();
}
u8 get_wii_language()

View File

@ -168,10 +168,6 @@ bool InitGecko()
USBGeckoOutput();
tmpfilebuffer = (char*)MEM2_alloc(filebuffer + 1 * sizeof(char));
if(tmpfilebuffer != NULL)
memset(tmpfilebuffer, 0, sizeof(tmpfilebuffer));
#ifdef sd_write_log
WriteToSD = true;
#endif
@ -185,3 +181,10 @@ bool InitGecko()
else
return false;
}
void AllocSDGeckoBuffer()
{
tmpfilebuffer = (char*)MEM2_alloc(filebuffer + 1 * sizeof(char));
if(tmpfilebuffer != NULL)
memset(tmpfilebuffer, 0, sizeof(tmpfilebuffer));
}

View File

@ -15,6 +15,7 @@ extern "C" {
void gprintf(const char *format, ...);
void ghexdump(void *d, int len);
bool InitGecko();
void AllocSDGeckoBuffer();
void ClearLogBuffer();
#ifdef __cplusplus

View File

@ -106,20 +106,22 @@ void CVideo::setAA(u8 aa, bool alpha, int width, int height)
void CVideo::init(void)
{
CUSTOM_VIDEO_Init();
CUSTOM_VIDEO_SetBlack(TRUE);
VIDEO_Init();
VIDEO_SetBlack(TRUE);
m_wide = CONF_GetAspectRatio() == CONF_ASPECT_16_9;
m_rmode = CUSTOM_VIDEO_GetPreferredMode(NULL);
m_rmode = VIDEO_GetPreferredMode(NULL);
u32 type = CONF_GetVideo();
m_rmode->viWidth = m_wide ? 700 : 672;
if(m_rmode == &CUSTOM_TVPal574IntDfScale)
m_50hz = false;
if(m_rmode == &TVPal528IntDf)
{
m_rmode= &TVPal574IntDfScale;
m_50hz = true;
else
m_50hz = false;
}
m_rmode->viWidth = m_wide ? 700 : 672;
//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 != &CUSTOM_TVEurgb60Hz480IntDf)
//CONF_VIDEO_NTSC and CONF_VIDEO_MPAL and m_rmode TVEurgb60Hz480IntDf are the same max height and width.
if (type == CONF_VIDEO_PAL && m_rmode != &TVEurgb60Hz480IntDf)
{
m_rmode->viHeight = VI_MAX_HEIGHT_PAL;
m_rmode->viXOrigin = (VI_MAX_WIDTH_PAL - m_rmode->viWidth) / 2;
@ -138,8 +140,8 @@ void CVideo::init(void)
m_frameBuf[0] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(m_rmode));
m_frameBuf[1] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(m_rmode));
CUSTOM_VIDEO_Configure(m_rmode);
CUSTOM_VIDEO_Flush();
VIDEO_Configure(m_rmode);
VIDEO_Flush();
m_curFB = 0;
m_fifo = MEM1_memalign(32, DEFAULT_FIFO_SIZE);
memset(m_fifo, 0, DEFAULT_FIFO_SIZE);
@ -168,11 +170,11 @@ void CVideo::init(void)
GX_SetZCompLoc(GX_ENABLE);
setup2DProjection();
_clearScreen();
CUSTOM_VIDEO_SetBlack(FALSE);
CUSTOM_VIDEO_Flush();
CUSTOM_VIDEO_WaitVSync();
VIDEO_SetBlack(FALSE);
VIDEO_Flush();
VIDEO_WaitVSync();
if(m_rmode->viTVMode & VI_NON_INTERLACE)
CUSTOM_VIDEO_WaitVSync();
VIDEO_WaitVSync();
m_stencil = MEM1_memalign(32, CVideo::_stencilWidth * CVideo::_stencilHeight);
memset(m_stencil, 0, CVideo::_stencilWidth * CVideo::_stencilHeight);
@ -180,8 +182,8 @@ void CVideo::init(void)
void CVideo::_clearScreen()
{
CUSTOM_VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[0], COLOR_BLACK);
CUSTOM_VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[1], COLOR_BLACK);
VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[0], COLOR_BLACK);
VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[1], COLOR_BLACK);
render();
render();
}
@ -237,8 +239,8 @@ void CVideo::cleanup(void)
gprintf("Cleaning up video...\n");
_clearScreen();
CUSTOM_VIDEO_SetBlack(TRUE);
CUSTOM_VIDEO_Flush();
VIDEO_SetBlack(TRUE);
VIDEO_Flush();
GX_DrawDone();
GX_AbortFrame();
@ -459,9 +461,9 @@ void CVideo::render(void)
GX_SetColorUpdate(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);
CUSTOM_VIDEO_SetNextFramebuffer(m_frameBuf[m_curFB]);
CUSTOM_VIDEO_Flush();
CUSTOM_VIDEO_WaitVSync();
VIDEO_SetNextFramebuffer(m_frameBuf[m_curFB]);
VIDEO_Flush();
VIDEO_WaitVSync();
m_curFB ^= 1;
GX_InvalidateTexAll();
}
@ -518,7 +520,7 @@ void CVideo::_showWaitMessages(CVideo *m)
waitFrames = frames;
}
waitFrames--;
CUSTOM_VIDEO_WaitVSync();
VIDEO_WaitVSync();
}
if (m->m_useWiiLight)
wiiLightOff();

View File

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

View File

@ -36,7 +36,6 @@ u32 appentrypoint;
static u32 *buffer = (u32 *)0x93000000;
static u8 *diskid = (u8 *)0x80000000;
GXRModeObj *disc_vmode = NULL;
GXRModeObj *vmode = NULL;
u32 vmode_reg = 0;
u8 vidmode_selected = 0;
@ -69,93 +68,55 @@ void __Disc_SetLowMem()
GXRModeObj *__Disc_SelectVMode(u8 videoselected, u64 chantitle)
{
vmode = CUSTOM_VIDEO_GetPreferredMode(0);
vmode = VIDEO_GetPreferredMode(NULL);
/* Get video mode configuration */
bool progressive = (CONF_GetProgressiveScan() > 0) && CUSTOM_VIDEO_HaveComponentCable();
/* Select video mode register */
switch (CONF_GetVideo())
{
case CONF_VIDEO_PAL:
if (CONF_GetEuRGB60() > 0)
{
vmode_reg = VI_EURGB60;
vmode = progressive ? &CUSTOM_TVNtsc480Prog : &CUSTOM_TVEurgb60Hz480IntDf;
}
else
vmode_reg = VI_PAL;
break;
case CONF_VIDEO_MPAL:
vmode_reg = VI_MPAL;
break;
case CONF_VIDEO_NTSC:
vmode_reg = VI_NTSC;
break;
}
bool progressive = (CONF_GetProgressiveScan() > 0) && VIDEO_HaveComponentCable();
char Region;
if(chantitle != 0)
Region = ((u32)(chantitle) & 0xFFFFFFFF) % 256;
else Region = diskid[3];
else
Region = diskid[3];
switch (videoselected)
/* Select video mode */
switch(Region)
{
case 0: // DEFAULT (DISC/GAME)
/* Select video mode */
switch (Region)
{
case 'W':
break; // Don't overwrite wiiware video modes.
// PAL
case 'D':
case 'F':
case 'P':
case 'X':
case 'Y':
if (CONF_GetVideo() != CONF_VIDEO_PAL)
{
vmode_reg = VI_PAL;
vmode = progressive ? &CUSTOM_TVNtsc480Prog : &CUSTOM_TVNtsc480IntDf;
}
break;
// NTSC
case 'E':
case 'J':
default:
if (CONF_GetVideo() != CONF_VIDEO_NTSC)
{
vmode_reg = VI_NTSC;
vmode = progressive ? &CUSTOM_TVEurgb60Hz480Prog : &CUSTOM_TVEurgb60Hz480IntDf;
}
break;
}
case 'W':
break; // Don't overwrite wiiware video modes.
// PAL
case 'D':
case 'F':
case 'P':
case 'X':
case 'Y':
vmode_reg = VI_PAL;
if(CONF_GetVideo() != CONF_VIDEO_PAL)
vmode = progressive ? &TVNtsc480Prog : &TVNtsc480IntDf;
break;
case 1: // PAL50
vmode = &CUSTOM_TVPal528IntDf;
vmode_reg = vmode->viTVMode >> 2;
break;
case 2: // PAL60
vmode = progressive ? &CUSTOM_TVEurgb60Hz480Prog : &CUSTOM_TVEurgb60Hz480IntDf;
vmode_reg = progressive ? vmode->viTVMode >> 2 : vmode->viTVMode >> 2;
break;
case 3: // NTSC
vmode = progressive ? &CUSTOM_TVNtsc480Prog : &CUSTOM_TVNtsc480IntDf;
vmode_reg = vmode->viTVMode >> 2;
break;
case 4: // AUTO PATCH TO SYSTEM
case 5: // SYSTEM
break;
case 6: // PROGRESSIVE 480P(NTSC + PATCH ALL)
vmode = &CUSTOM_TVNtsc480Prog;
vmode_reg = vmode->viTVMode >> 2;
// NTSC
case 'E':
case 'J':
vmode_reg = VI_NTSC;
if(CONF_GetVideo() != CONF_VIDEO_NTSC)
vmode = progressive ? &TVNtsc480Prog : &TVPal528IntDf;
break;
default:
break;
}
disc_vmode = vmode;
if(videoselected)
{
if(videoselected == 1) //PAL50
vmode = &TVPal528IntDf;
else if(videoselected == 2) //PAL60
vmode = &TVEurgb60Hz480IntDf;
else if(videoselected == 3) //NTSC
vmode = &TVNtsc480IntDf;
else
vmode = &TVNtsc480Prog;
vmode_reg = vmode->viTVMode >> 2;
}
return vmode;
}
@ -167,15 +128,15 @@ void __Disc_SetVMode(void)
DCFlushRange((void *)(0x800000CC), 4);
/* Set video mode */
if (disc_vmode != 0)
CUSTOM_VIDEO_Configure(disc_vmode);
if(vmode != 0)
VIDEO_Configure(vmode);
/* Setup video */
CUSTOM_VIDEO_SetBlack(TRUE);
CUSTOM_VIDEO_Flush();
CUSTOM_VIDEO_WaitVSync();
if(disc_vmode->viTVMode & VI_NON_INTERLACE)
CUSTOM_VIDEO_WaitVSync();
VIDEO_SetBlack(TRUE);
VIDEO_Flush();
VIDEO_WaitVSync();
if(vmode->viTVMode & VI_NON_INTERLACE)
VIDEO_WaitVSync();
}
void __Disc_SetTime(void)

View File

@ -111,10 +111,10 @@ void Sys_Exit(void)
IOS_ReloadIOS(254);
//else
if(WiiFlow_LaunchTitle(HBC_108) < 0)
if(WiiFlow_LaunchTitle(HBC_HAXX) < 0)
if(WiiFlow_LaunchTitle(HBC_JODI) < 0)
WiiFlow_LaunchTitle(0x100000002LL); //SYS_ResetSystem doesnt work properly with new libogc
if(WII_LaunchTitle(HBC_108) < 0)
if(WII_LaunchTitle(HBC_HAXX) < 0)
if(WII_LaunchTitle(HBC_JODI) < 0)
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
}
void __Sys_ResetCallback(void)
@ -137,25 +137,5 @@ void Sys_Init(void)
void Sys_LoadMenu(void)
{
/* Return to the Wii system menu */
WiiFlow_LaunchTitle(0x100000002LL); //SYS_ResetSystem doesnt work properly with new libogc
}
void __dsp_shutdown(void)
{
u32 tick;
_dspReg[5] = (DSPCR_DSPRESET|DSPCR_HALT);
_dspReg[27] &= ~0x8000;
while(_dspReg[5]&0x400);
while(_dspReg[5]&0x200);
_dspReg[5] = (DSPCR_DSPRESET|DSPCR_DSPINT|DSPCR_ARINT|DSPCR_AIINT|DSPCR_HALT);
_dspReg[0] = 0;
while((_SHIFTL(_dspReg[2],16,16)|(_dspReg[3]&0xffff))&0x80000000);
tick = gettick();
while((gettick()-tick)<44);
_dspReg[5] |= DSPCR_RES;
while(_dspReg[5]&DSPCR_RES);
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
}

View File

@ -1,3 +1,4 @@
#ifndef _SYS_H_
#define _SYS_H_
@ -20,17 +21,6 @@ extern "C" {
#define EXIT_TO_DISABLE 4
#define EXIT_TO_BOOTMII 5
// DSPCR bits
#define DSPCR_DSPRESET 0x0800 // Reset DSP
#define DSPCR_DSPINT 0x0080 // * interrupt active (RWC)
#define DSPCR_ARINT 0x0020
#define DSPCR_AIINT 0x0008
#define DSPCR_HALT 0x0004 // halt DSP
#define DSPCR_RES 0x0001 // reset DSP
#define _SHIFTL(v, s, w) \
((u32) (((u32)(v) & ((0x01 << (w)) - 1)) << (s)))
/* Prototypes */
void Sys_Init(void);
void Sys_LoadMenu(void);
@ -38,7 +28,6 @@ bool Sys_Exiting(void);
void Sys_Test(void);
void Sys_Exit(void);
void Sys_ExitTo(int);
void __dsp_shutdown(void);
void Open_Inputs(void);
void Close_Inputs(void);

File diff suppressed because it is too large Load Diff

View File

@ -1,205 +0,0 @@
/*-------------------------------------------------------------
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

View File

@ -1,135 +0,0 @@
/*-------------------------------------------------------------
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,29 +1,169 @@
// Inspired by WiiPower's "video toy", but simpler
#include "videopatch.h"
#include "video_types.h"
#include <string.h>
#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 TVMpal480Prog =
{
10, // viDisplayMode
640, // fbWidth
480, // efbHeight
480, // xfbHeight
(VI_MAX_WIDTH_NTSC - 640)/2, // viXOrigin
(VI_MAX_HEIGHT_NTSC - 480)/2, // viYOrigin
640, // viWidth
480, // 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
}
};
static const GXRModeObj *g_vidmodes[] = {
&CUSTOM_TVNtsc480Int,
&CUSTOM_TVNtsc480IntDf,
&CUSTOM_TVNtsc480Prog,
&TVNtsc480Int,
&TVNtsc480IntDf,
&TVNtsc480Prog,
&CUSTOM_TVPal528Int,
&CUSTOM_TVPal528IntDf,
&CUSTOM_TVPal528Prog,
&CUSTOM_TVPal528ProgSoft,
&CUSTOM_TVPal528ProgUnknown,
&TVPal528Int,
&TVPal528IntDf,
&TVPal528Prog,
&TVPal528ProgSoft,
&TVPal528ProgUnknown,
&CUSTOM_TVMpal480IntDf,
&CUSTOM_TVMpal480Prog,
&TVMpal480IntDf,
&TVMpal480Prog,
&CUSTOM_TVEurgb60Hz480Int,
&CUSTOM_TVEurgb60Hz480IntDf,
&CUSTOM_TVEurgb60Hz480Prog
&TVEurgb60Hz480Int,
&TVEurgb60Hz480IntDf,
&TVEurgb60Hz480Prog
};
// Level :
@ -65,47 +205,47 @@ static void patch_videomode(GXRModeObj* mode1, GXRModeObj* mode2)
}
static GXRModeObj* PAL2NTSC[]={
&CUSTOM_TVMpal480IntDf, &CUSTOM_TVNtsc480IntDf,
&CUSTOM_TVPal264Ds, &CUSTOM_TVNtsc240Ds,
&CUSTOM_TVPal264DsAa, &CUSTOM_TVNtsc240DsAa,
&CUSTOM_TVPal264Int, &CUSTOM_TVNtsc240Int,
&CUSTOM_TVPal264IntAa, &CUSTOM_TVNtsc240IntAa,
&CUSTOM_TVPal524IntAa, &CUSTOM_TVNtsc480IntAa,
&CUSTOM_TVPal528Int, &CUSTOM_TVNtsc480IntAa,
&CUSTOM_TVPal528IntDf, &CUSTOM_TVNtsc480IntDf,
&CUSTOM_TVPal574IntDfScale, &CUSTOM_TVNtsc480IntDf,
&CUSTOM_TVEurgb60Hz240Ds, &CUSTOM_TVNtsc240Ds,
&CUSTOM_TVEurgb60Hz240DsAa, &CUSTOM_TVNtsc240DsAa,
&CUSTOM_TVEurgb60Hz240Int, &CUSTOM_TVNtsc240Int,
&CUSTOM_TVEurgb60Hz240IntAa, &CUSTOM_TVNtsc240IntAa,
&CUSTOM_TVEurgb60Hz480Int, &CUSTOM_TVNtsc480IntAa,
&CUSTOM_TVEurgb60Hz480IntDf, &CUSTOM_TVNtsc480IntDf,
&CUSTOM_TVEurgb60Hz480IntAa, &CUSTOM_TVNtsc480IntAa,
&CUSTOM_TVEurgb60Hz480Prog, &CUSTOM_TVNtsc480Prog,
&CUSTOM_TVEurgb60Hz480ProgSoft,&CUSTOM_TVNtsc480Prog,
&CUSTOM_TVEurgb60Hz480ProgAa, &CUSTOM_TVNtsc480Prog,
&TVMpal480IntDf, &TVNtsc480IntDf,
&TVPal264Ds, &TVNtsc240Ds,
&TVPal264DsAa, &TVNtsc240DsAa,
&TVPal264Int, &TVNtsc240Int,
&TVPal264IntAa, &TVNtsc240IntAa,
&TVPal524IntAa, &TVNtsc480IntAa,
&TVPal528Int, &TVNtsc480IntAa,
&TVPal528IntDf, &TVNtsc480IntDf,
&TVPal574IntDfScale, &TVNtsc480IntDf,
&TVEurgb60Hz240Ds, &TVNtsc240Ds,
&TVEurgb60Hz240DsAa, &TVNtsc240DsAa,
&TVEurgb60Hz240Int, &TVNtsc240Int,
&TVEurgb60Hz240IntAa, &TVNtsc240IntAa,
&TVEurgb60Hz480Int, &TVNtsc480IntAa,
&TVEurgb60Hz480IntDf, &TVNtsc480IntDf,
&TVEurgb60Hz480IntAa, &TVNtsc480IntAa,
&TVEurgb60Hz480Prog, &TVNtsc480Prog,
&TVEurgb60Hz480ProgSoft,&TVNtsc480Prog,
&TVEurgb60Hz480ProgAa, &TVNtsc480Prog,
0,0
};
static GXRModeObj* NTSC2PAL[]={
&CUSTOM_TVNtsc240Ds, &CUSTOM_TVPal264Ds,
&CUSTOM_TVNtsc240DsAa, &CUSTOM_TVPal264DsAa,
&CUSTOM_TVNtsc240Int, &CUSTOM_TVPal264Int,
&CUSTOM_TVNtsc240IntAa, &CUSTOM_TVPal264IntAa,
&CUSTOM_TVNtsc480IntDf, &CUSTOM_TVPal528IntDf,
&CUSTOM_TVNtsc480IntAa, &CUSTOM_TVPal524IntAa,
&CUSTOM_TVNtsc480Prog, &CUSTOM_TVPal528IntDf,
&TVNtsc240Ds, &TVPal264Ds,
&TVNtsc240DsAa, &TVPal264DsAa,
&TVNtsc240Int, &TVPal264Int,
&TVNtsc240IntAa, &TVPal264IntAa,
&TVNtsc480IntDf, &TVPal528IntDf,
&TVNtsc480IntAa, &TVPal524IntAa,
&TVNtsc480Prog, &TVPal528IntDf,
0,0
};
static GXRModeObj* NTSC2PAL60[]={
&CUSTOM_TVNtsc240Ds, &CUSTOM_TVEurgb60Hz240Ds,
&CUSTOM_TVNtsc240DsAa, &CUSTOM_TVEurgb60Hz240DsAa,
&CUSTOM_TVNtsc240Int, &CUSTOM_TVEurgb60Hz240Int,
&CUSTOM_TVNtsc240IntAa, &CUSTOM_TVEurgb60Hz240IntAa,
&CUSTOM_TVNtsc480IntDf, &CUSTOM_TVEurgb60Hz480IntDf,
&CUSTOM_TVNtsc480IntAa, &CUSTOM_TVEurgb60Hz480IntAa,
&CUSTOM_TVNtsc480Prog, &CUSTOM_TVEurgb60Hz480Prog,
&TVNtsc240Ds, &TVEurgb60Hz240Ds,
&TVNtsc240DsAa, &TVEurgb60Hz240DsAa,
&TVNtsc240Int, &TVEurgb60Hz240Int,
&TVNtsc240IntAa, &TVEurgb60Hz240IntAa,
&TVNtsc480IntDf, &TVEurgb60Hz480IntDf,
&TVNtsc480IntAa, &TVEurgb60Hz480IntAa,
&TVNtsc480Prog, &TVNtsc480Prog,
0,0
};

View File

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

View File

@ -36,6 +36,7 @@ extern "C"
int main(int argc, char **argv)
{
__exception_setreload(5);
geckoinit = InitGecko();
// Init video
CVideo vid;
@ -44,7 +45,7 @@ int main(int argc, char **argv)
MEM2_init(49); //Thats everything we can get anyways
vid.waitMessage(0.2f);
geckoinit = InitGecko();
AllocSDGeckoBuffer();
gprintf(" \nWelcome to %s (%s-r%s)!\nThis is the debug output.\n", APP_NAME, APP_VERSION, SVN_REV);
char *gameid = NULL;

View File

@ -488,7 +488,6 @@ void CMenu::cleanup(bool ios_reload)
DeviceHandler::DestroyInstance();
m_vid.cleanup();
wiiLightOff();
__dsp_shutdown();
}
if (!ios_reload)
@ -2203,7 +2202,7 @@ void CMenu::_stopSounds(void)
MusicPlayer::Instance()->Tick(true);
if(m_gameSound.GetVolume() > 0)
m_gameSound.SetVolume(m_gameSound.GetVolume() < fade_rate ? 0 : m_gameSound.GetVolume() - fade_rate);
CUSTOM_VIDEO_WaitVSync();
VIDEO_WaitVSync();
}
}
m_btnMgr.stopSounds();

View File

@ -764,7 +764,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
DML_New_WriteOptions();
WII_Initialize();
if(WiiFlow_LaunchTitle(0x100000100LL) < 0)
if(WII_LaunchTitle(0x100000100LL) < 0)
Sys_LoadMenu();
}
@ -795,7 +795,6 @@ void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments)
Close_Inputs();
m_vid.cleanup();
wiiLightOff();
__dsp_shutdown();
LoadHomebrew(filepath);
DeviceHandler::DestroyInstance();
@ -1072,7 +1071,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
if(forwarder)
{
WII_Initialize();
if (WiiFlow_LaunchTitle(hdr->hdr.chantitle) < 0)
if(WII_LaunchTitle(hdr->hdr.chantitle) < 0)
Sys_LoadMenu();
}