code cleanup, moved some global/static variables to static/local

This commit is contained in:
ekeeke31 2009-01-14 16:32:35 +00:00
parent cba98b8cd6
commit 7bc7ae83dc
10 changed files with 291 additions and 332 deletions

View File

@ -57,7 +57,7 @@
#define PCDROM 4096
#define PMOUSE 8192
int peripherals;
uint16 peripherals;
uint16 realchecksum;
ROMINFO rominfo;
@ -161,7 +161,7 @@ PERIPHERALINFO peripheralinfo[14] = {
* softdev - New Checksum Calculation
eke-eke: fixed
*/
uint16 GetRealChecksum (uint8 *rom, int length)
static uint16 GetRealChecksum (uint8 *rom, int length)
{
int i;
uint16 checksum = 0;
@ -174,56 +174,12 @@ uint16 GetRealChecksum (uint8 *rom, int length)
return checksum;
}
/****************************************************************************
* getcompany
*
* Try to determine which company made this rom
*
* Ok, for some reason there's no standard for this.
* It seems that there can be pretty much anything you like following the
* copyright (C) symbol!
****************************************************************************/
int getcompany ()
{
char *s;
int i;
char company[10];
for (i = 3; i < 8; i++) company[i - 3] = rominfo.copyright[i];
company[5] = 0;
/** OK, first look for a hyphen
* Capcom use T-12 for example
*/
s = strstr (company, "-");
if (s != NULL)
{
s++;
strcpy (company, s);
}
/** Strip any trailing spaces **/
for (i = strlen (company) - 1; i >= 0; i--)
if (company[i] == 32) company[i] = 0;
if (strlen (company) == 0) return MAXCOMPANY - 1;
for (i = 0; i < MAXCOMPANY - 1; i++)
{
if (!(strncmp (company, companyinfo[i].companyid, strlen (company)))) return i;
}
return MAXCOMPANY - 1;
}
/***************************************************************************
* getrominfo
*
* Pass a pointer to the ROM base address.
***************************************************************************/
void getrominfo (char *romheader)
static void getrominfo (char *romheader)
{
int i,j;
@ -289,72 +245,10 @@ void getrominfo (char *romheader)
}
}
/* 05/05/2006: new region detection routine (taken from GENS sourcecode) */
void set_region ()
{
/* country codes used to differentiate region */
/* 0001 = japan ntsc (1) */
/* 0010 = japan pal (2) */
/* 0100 = usa (4) */
/* 1000 = europe (8) */
int country = 0;
int i = 0;
char c;
/* reading header to find the country */
if (!strnicmp(rominfo.country, "eur", 3)) country |= 8;
else if (!strnicmp(rominfo.country, "usa", 3)) country |= 4;
else if (!strnicmp(rominfo.country, "jap", 3)) country |= 1;
else for(i = 0; i < 4; i++)
{
c = toupper((int)rominfo.country[i]);
if (c == 'U') country |= 4;
else if (c == 'J') country |= 1;
else if (c == 'E') country |= 8;
else if (c < 16) country |= c;
else if ((c >= '0') && (c <= '9')) country |= c - '0';
else if ((c >= 'A') && (c <= 'F')) country |= c - 'A' + 10;
}
/* automatic detection */
/* setting region */
/* this is used by IO register */
if (country & 4) region_code = REGION_USA;
else if (country & 1) region_code = REGION_JAPAN_NTSC;
else if (country & 8) region_code = REGION_EUROPE;
else if (country & 2) region_code = REGION_JAPAN_PAL;
else region_code = REGION_USA;
/* some games need specific REGION setting */
if (((strstr(rominfo.product,"T-45033") != NULL) && (rominfo.checksum == 0x0F81)) || /* Alisia Dragon (E) */
(strstr(rominfo.product,"T-69046-50") != NULL)) /* On Dal Jang Goon (Korea) */
{
/* need PAL settings */
region_code = REGION_EUROPE;
}
else if ((realchecksum == 0x532e) && (strstr(rominfo.product,"1011-00") != NULL))
{
/* On Dal Jang Goon (Korea) needs JAP region code */
region_code = REGION_JAPAN_NTSC;
}
/* Force region setting */
if (config.region_detect == 1) region_code = REGION_USA;
else if (config.region_detect == 2) region_code = REGION_EUROPE;
else if (config.region_detect == 3) region_code = REGION_JAPAN_NTSC;
else if (config.region_detect == 4) region_code = REGION_JAPAN_PAL;
/* set cpu/vdp speed: PAL or NTSC */
if ((region_code == REGION_EUROPE) || (region_code == REGION_JAPAN_PAL)) vdp_pal = 1;
else vdp_pal = 0;
}
/* SMD (interleaved) rom support */
static uint8 block[0x4000];
void deinterleave_block (uint8 * src)
static void deinterleave_block (uint8 * src)
{
int i;
memcpy (block, src, 0x4000);
@ -434,3 +328,107 @@ int load_rom(char *filename)
return(1);
}
/* 05/05/2006: new region detection routine (taken from GENS sourcecode) */
void set_region ()
{
/* country codes used to differentiate region */
/* 0001 = japan ntsc (1) */
/* 0010 = japan pal (2) */
/* 0100 = usa (4) */
/* 1000 = europe (8) */
int country = 0;
int i = 0;
char c;
/* reading header to find the country */
if (!strnicmp(rominfo.country, "eur", 3)) country |= 8;
else if (!strnicmp(rominfo.country, "usa", 3)) country |= 4;
else if (!strnicmp(rominfo.country, "jap", 3)) country |= 1;
else for(i = 0; i < 4; i++)
{
c = toupper((int)rominfo.country[i]);
if (c == 'U') country |= 4;
else if (c == 'J') country |= 1;
else if (c == 'E') country |= 8;
else if (c < 16) country |= c;
else if ((c >= '0') && (c <= '9')) country |= c - '0';
else if ((c >= 'A') && (c <= 'F')) country |= c - 'A' + 10;
}
/* automatic detection */
/* setting region */
/* this is used by IO register */
if (country & 4) region_code = REGION_USA;
else if (country & 1) region_code = REGION_JAPAN_NTSC;
else if (country & 8) region_code = REGION_EUROPE;
else if (country & 2) region_code = REGION_JAPAN_PAL;
else region_code = REGION_USA;
/* some games need specific REGION setting */
if (((strstr(rominfo.product,"T-45033") != NULL) && (rominfo.checksum == 0x0F81)) || /* Alisia Dragon (E) */
(strstr(rominfo.product,"T-69046-50") != NULL)) /* On Dal Jang Goon (Korea) */
{
/* need PAL settings */
region_code = REGION_EUROPE;
}
else if ((realchecksum == 0x532e) && (strstr(rominfo.product,"1011-00") != NULL))
{
/* On Dal Jang Goon (Korea) needs JAP region code */
region_code = REGION_JAPAN_NTSC;
}
/* Force region setting */
if (config.region_detect == 1) region_code = REGION_USA;
else if (config.region_detect == 2) region_code = REGION_EUROPE;
else if (config.region_detect == 3) region_code = REGION_JAPAN_NTSC;
else if (config.region_detect == 4) region_code = REGION_JAPAN_PAL;
/* set cpu/vdp speed: PAL or NTSC */
if ((region_code == REGION_EUROPE) || (region_code == REGION_JAPAN_PAL)) vdp_pal = 1;
else vdp_pal = 0;
}
/****************************************************************************
* getcompany
*
* Try to determine which company made this rom
*
* Ok, for some reason there's no standard for this.
* It seems that there can be pretty much anything you like following the
* copyright (C) symbol!
****************************************************************************/
int getcompany ()
{
char *s;
int i;
char company[10];
for (i = 3; i < 8; i++) company[i - 3] = rominfo.copyright[i];
company[5] = 0;
/** OK, first look for a hyphen
* Capcom use T-12 for example
*/
s = strstr (company, "-");
if (s != NULL)
{
s++;
strcpy (company, s);
}
/** Strip any trailing spaces **/
for (i = strlen (company) - 1; i >= 0; i--)
if (company[i] == 32) company[i] = 0;
if (strlen (company) == 0) return MAXCOMPANY - 1;
for (i = 0; i < MAXCOMPANY - 1; i++)
{
if (!(strncmp (company, companyinfo[i].companyid, strlen (company)))) return i;
}
return MAXCOMPANY - 1;
}

View File

@ -62,9 +62,12 @@ extern ROMINFO rominfo;
extern COMPANYINFO companyinfo[MAXCOMPANY];
extern PERIPHERALINFO peripheralinfo[14];
extern uint16 realchecksum;
extern uint16 peripherals;
/* Function prototypes */
extern int load_rom(char *filename);
extern int getcompany();
extern void set_region();
#endif /* _LOADROM_H_ */

View File

@ -34,10 +34,10 @@
#include <fat.h>
int Shutdown = 0;
#ifdef HW_RVL
/* Power Button callback */
u8 Shutdown = 0;
void Power_Off(void)
{
Shutdown = 1;
@ -119,8 +119,8 @@ void reloadrom ()
* M A I N
*
***************************************************************************/
int frameticker = 0;
bool fat_enabled = 0;
u8 fat_enabled = 0;
u32 frameticker = 0;
int main (int argc, char *argv[])
{
@ -130,9 +130,9 @@ int main (int argc, char *argv[])
DI_Init();
#endif
uint32 RenderedFrames;
uint32 TotalFrames;
uint32 FramesPerSecond;
uint32 RenderedFrames = 0;
uint32 TotalFrames = 0;
uint32 FramesPerSecond = 0;
/* initialize OGC subsystems */
ogc_video__init();
@ -151,7 +151,7 @@ int main (int argc, char *argv[])
#endif
/* initialize FAT Interface */
if (fatInitDefault() == true)
if (fatInitDefault())
{
fat_enabled = 1;
#ifdef HW_RVL
@ -163,16 +163,16 @@ int main (int argc, char *argv[])
#endif
}
/* default Config */
/* default config */
legal();
set_config_defaults();
config_load();
/* restore recent Files list */
/* restore recent files list */
set_history_defaults();
history_load();
/* Initialize Virtual Machine */
/* initialize Virtual Machine */
init_machine ();
/* load any injected rom */
@ -182,16 +182,16 @@ int main (int argc, char *argv[])
reloadrom ();
}
/* Show Menu first */
/* show menu first */
ConfigRequested = 1;
/* Emulation Loop */
/* main emulation loop */
while (1)
{
/* Check for Menu request */
/* check for menu request */
if (ConfigRequested)
{
/* stop Audio & Video */
/* stop audio & video */
ogc_audio__stop();
ogc_video__stop();
@ -201,18 +201,20 @@ int main (int argc, char *argv[])
/* reset framesync */
frameticker = 0;
/* reset framecounts */
RenderedFrames = 0;
TotalFrames = 0;
FramesPerSecond = vdp_rate;
/* start Audio & Video */
/* start audio & video */
ogc_audio__start();
ogc_video__start();
}
if (frameticker > 1)
{
/* frameskipping */
/* skip frame */
frameticker--;
system_frame (1);
@ -222,9 +224,9 @@ int main (int argc, char *argv[])
else
{
/* framesync */
while (!frameticker) usleep(1);
while (frameticker < 1) usleep(1);
/* frame rendering */
/* render frame */
system_frame (0);
/* update video & audio */
@ -233,8 +235,10 @@ int main (int argc, char *argv[])
RenderedFrames++;
}
/* update framesync */
frameticker--;
/* update framecounts */
TotalFrames++;
if (TotalFrames == vdp_rate)
{

View File

@ -33,14 +33,14 @@
u8 soundbuffer[2][3840] ATTRIBUTE_ALIGN(32);
/* Current work soundbuffer */
int mixbuffer;
u8 mixbuffer;
/* Current DMA length (required to be a factor of 32-bytes)
length is calculated regarding current emulation timings:
PAL timings : 50 frames/sec, 48000 samples/sec = 960 samples per frame = 3840 bytes (16 bits stereo samples)
NTSC timings: 60 frames/sec, 48000 samples/sec = 800 samples per frame = 3200 bytes (16 bits stereo samples)
*/
static int dma_len = 3200;
static u32 dma_len = 3200;
/***
AudioDmaCallback

View File

@ -25,7 +25,7 @@
#define _GC_AUDIO_H_
extern u8 soundbuffer[2][3840];
extern int mixbuffer;
extern u8 mixbuffer;
extern void ogc_audio__init(void);
extern void ogc_audio__start(void);

View File

@ -39,7 +39,7 @@
#define KEY_BUTTONY 6 // 6-buttons only
#define KEY_BUTTONZ 7 // 6-buttons only
int ConfigRequested = 1;
u8 ConfigRequested = 1;
static const char *keys_name[MAX_KEYS] =
{
@ -744,6 +744,7 @@ u16 ogc_input__getMenuButtons(void)
{
#ifdef HW_RVL
extern u8 Shutdown;
if (Shutdown)
{
/* autosave SRAM/State */

View File

@ -35,14 +35,15 @@
/* number of configurable keys */
#define MAX_KEYS 8
#define update_input() ogc_input__update()
typedef struct
{
s8 device;
u8 port;
} t_input_config;
extern int ConfigRequested;
extern u8 ConfigRequested;
extern void ogc_input__init(void);
extern void ogc_input__set_defaults(void);

View File

@ -21,29 +21,12 @@
*
***************************************************************************/
#include "shared.h"
#include "font.h"
#include "gcaram.h"
#include "md_ntsc.h"
#include "sms_ntsc.h"
/*** NTSC Filters ***/
md_ntsc_setup_t md_setup;
md_ntsc_t md_ntsc;
sms_ntsc_setup_t sms_setup;
sms_ntsc_t sms_ntsc;
/*** PAL 50hz flag ***/
int gc_pal = 0;
/*** VI ***/
unsigned int *xfb[2]; /*** Double buffered ***/
int whichfb = 0; /*** External framebuffer index ***/
GXRModeObj *vmode; /*** Menu video mode ***/
u8 *texturemem; /*** Texture Data ***/
/*** GX ***/
#define TEX_WIDTH 720
#define TEX_HEIGHT 576
#define TEX_SIZE (TEX_WIDTH * TEX_HEIGHT * 2)
@ -51,15 +34,26 @@ u8 *texturemem; /*** Texture Data ***/
#define HASPECT 320
#define VASPECT 240
/*** VI ***/
unsigned int *xfb[2]; /* External Framebuffers */
int whichfb = 0; /* Current Framebuffer */
GXRModeObj *vmode; /* Default Video Mode */
u8 *texturemem; /* Texture Data */
/*** NTSC Filters ***/
sms_ntsc_t sms_ntsc;
md_ntsc_t md_ntsc;
static sms_ntsc_setup_t sms_setup;
static md_ntsc_setup_t md_setup;
/*** GX FIFO ***/
static u8 gp_fifo[DEFAULT_FIFO_SIZE] ATTRIBUTE_ALIGN (32);
static GXTexObj texobj;
static Mtx view;
static u32 vwidth, vheight;
/*** custom Video modes ***/
static GXRModeObj *rmode;
/* 288 lines progressive (PAL 50Hz) */
GXRModeObj TV50hz_288p =
static GXRModeObj TV50hz_288p =
{
VI_TVMODE_PAL_DS, // viDisplayMode
640, // fbWidth
@ -94,7 +88,7 @@ GXRModeObj TV50hz_288p =
};
/* 288 lines interlaced (PAL 50Hz) */
GXRModeObj TV50hz_288i =
static GXRModeObj TV50hz_288i =
{
VI_TVMODE_PAL_INT, // viDisplayMode
640, // fbWidth
@ -129,7 +123,7 @@ GXRModeObj TV50hz_288i =
};
/* 576 lines interlaced (PAL 50Hz, scaled) */
GXRModeObj TV50hz_576i =
static GXRModeObj TV50hz_576i =
{
VI_TVMODE_PAL_INT, // viDisplayMode
640, // fbWidth
@ -164,7 +158,7 @@ GXRModeObj TV50hz_576i =
};
/* 240 lines progressive (NTSC or PAL 60Hz) */
GXRModeObj TV60hz_240p =
static GXRModeObj TV60hz_240p =
{
VI_TVMODE_EURGB60_DS, // viDisplayMode
640, // fbWidth
@ -199,7 +193,7 @@ GXRModeObj TV60hz_240p =
};
/* 240 lines interlaced (NTSC or PAL 60Hz) */
GXRModeObj TV60hz_240i =
static GXRModeObj TV60hz_240i =
{
VI_TVMODE_EURGB60_INT, // viDisplayMode
640, // fbWidth
@ -234,7 +228,7 @@ GXRModeObj TV60hz_240i =
};
/* 480 lines interlaced (NTSC or PAL 60Hz) */
GXRModeObj TV60hz_480i =
static GXRModeObj TV60hz_480i =
{
VI_TVMODE_EURGB60_INT,// viDisplayMode
640, // fbWidth
@ -268,12 +262,23 @@ GXRModeObj TV60hz_480i =
}
};
/* TV Modes table */
GXRModeObj *tvmodes[6] = {
&TV60hz_240p, &TV60hz_240i, &TV60hz_480i, /* 60hz modes */
&TV50hz_288p, &TV50hz_288i, &TV50hz_576i /* 50Hz modes */
/* TV modes pointer table */
static GXRModeObj *tvmodes[6] =
{
/* 60hz modes */
&TV60hz_240p,
&TV60hz_240i,
&TV60hz_480i,
/* 50Hz modes */
&TV50hz_288p,
&TV50hz_288i,
&TV50hz_576i
};
/* 50/60hz flag */
static u8 gc_pal = 0;
typedef struct tagcamera
{
Vector pos;
@ -303,13 +308,6 @@ static camera cam = {
{0.0F, 0.0F, 0.0F}
};
void xfb_swap(u32 cnt)
{
VIDEO_SetNextFramebuffer (xfb[whichfb]);
VIDEO_Flush ();
whichfb ^= 1;
}
/* Rendering Initialization */
static void draw_init(void)
{
@ -330,6 +328,7 @@ static void draw_init(void)
GX_SetNumChans(0);
/* Set Modelview */
Mtx view;
memset (&view, 0, sizeof (Mtx));
guLookAt(view, &cam.pos, &cam.up, &cam.view);
GX_LoadPosMtxImm(view, GX_PNMTX0);
@ -395,7 +394,7 @@ static void gxStart(void)
}
/* Reset GX/VI scaler */
static void gxScale(GXRModeObj *rmode)
static void gxScale(u32 width, u32 height)
{
int temp = 0;
int xscale, yscale, xshift, yshift;
@ -460,7 +459,6 @@ static void gxScale(GXRModeObj *rmode)
{
/* filtering (soft or hard) is disabled, let VI handles horizontal scaling */
/* if possible, let GX simply doubles the width, otherwise disable GX stretching completely */
int width = vwidth * 4;
if ((width * 2) <= 640) rmode->fbWidth = width * 2;
else if (width <= 640) rmode->fbWidth = width;
}
@ -495,65 +493,16 @@ static void gxScale(GXRModeObj *rmode)
square[0] = square[9] = -xscale + xshift;
square[4] = square[1] = yscale + yshift;
square[7] = square[10] = -yscale + yshift;
DCFlushRange(square, 32);
GX_InvVtxCache();
}
/* Reset Video Mode */
static void gxReset(void)
{
Mtx p;
GXRModeObj *rmode;
/* select TV mode */
if (config.render) rmode = tvmodes[gc_pal*3 + 2];
else rmode = tvmodes[gc_pal*3 + interlaced];
/* reset aspect ratio */
gxScale(rmode);
/* configure GX */
GX_SetViewport (0.0F, 0.0F, rmode->fbWidth, rmode->efbHeight, 0.0F, 1.0F);
GX_SetScissor (0, 0, rmode->fbWidth, rmode->efbHeight);
f32 yScale = GX_GetYScaleFactor(rmode->efbHeight, rmode->xfbHeight);
u16 xfbHeight = GX_SetDispCopyYScale (yScale);
GX_SetDispCopySrc (0, 0, rmode->fbWidth, rmode->efbHeight);
GX_SetDispCopyDst (rmode->fbWidth, xfbHeight);
GX_SetCopyFilter (rmode->aa, rmode->sample_pattern, config.render ? GX_TRUE : GX_FALSE, rmode->vfilter);
GX_SetFieldMode (rmode->field_rendering, ((rmode->viHeight == 2 * rmode->xfbHeight) ? GX_ENABLE : GX_DISABLE));
GX_SetPixelFmt (rmode->aa ? GX_PF_RGB565_Z16 : GX_PF_RGB8_Z24, GX_ZC_LINEAR);
guOrtho(p, rmode->efbHeight/2, -(rmode->efbHeight/2), -(rmode->fbWidth/2), rmode->fbWidth/2, 100, 1000);
GX_LoadProjectionMtx (p, GX_ORTHOGRAPHIC);
GX_Flush ();
/* configure VI */
VIDEO_Configure (rmode);
VIDEO_Flush();
VIDEO_WaitVSync();
if (rmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync();
else while (VIDEO_GetNextField() != odd_frame) VIDEO_WaitVSync();
/* resynchronize interlaced field */
if (interlaced && !config.render)
{
whichfb = odd_frame;
VIDEO_SetPreRetraceCallback(xfb_swap);
VIDEO_Flush();
VIDEO_WaitVSync();
}
}
/* Set Menu Video mode */
/* Restore Menu Video mode */
void ogc_video__stop(void)
{
/* clear screen */
VIDEO_Configure(vmode);
VIDEO_ClearFrameBuffer(vmode, xfb[0], COLOR_BLACK);
VIDEO_ClearFrameBuffer(vmode, xfb[1], COLOR_BLACK);
/* disable VSYNC handler */
VIDEO_SetPreRetraceCallback(NULL);
VIDEO_Flush();
VIDEO_WaitVSync();
VIDEO_WaitVSync();
@ -614,37 +563,66 @@ void ogc_video__start()
/* GX render update */
void ogc_video__update()
{
/* check if viewport has changed */
/* check if display has changed */
if (bitmap.viewport.changed)
{
bitmap.viewport.changed = 0;
/* update texture size */
vwidth = bitmap.viewport.w + 2 * bitmap.viewport.x;
vheight = bitmap.viewport.h + 2 * bitmap.viewport.y;
u32 vwidth = bitmap.viewport.w + 2 * bitmap.viewport.x;
u32 vheight = bitmap.viewport.h + 2 * bitmap.viewport.y;
/* special cases */
if (config.render && interlaced) vheight *= 2;
if (config.ntsc) vwidth = (reg[12]&1) ? MD_NTSC_OUT_WIDTH(vwidth) : SMS_NTSC_OUT_WIDTH(vwidth);
/* texels size must be multiple of 4 */
vwidth = vwidth / 4;
vheight = vheight / 4;
vwidth = (vwidth / 4) * 4;
vheight = (vheight / 4) * 4;
/* reset Video mode */
gxReset();
/* initialize texture object */
GXTexObj texobj;
GX_InitTexObj(&texobj, texturemem, vwidth, vheight, GX_TF_RGB565, GX_CLAMP, GX_CLAMP, GX_FALSE);
/* reinitialize texture */
GX_InitTexObj (&texobj, texturemem, vwidth * 4, vheight * 4, GX_TF_RGB565, GX_CLAMP, GX_CLAMP, GX_FALSE);
/* enable/disable bilinear filtering */
/* configure texture filtering */
if (!config.bilinear)
{
GX_InitTexObjLOD(&texobj,GX_NEAR,GX_NEAR_MIP_NEAR,2.5,9.0,0.0,GX_FALSE,GX_FALSE,GX_ANISO_1);
}
/* load texture */
/* load texture object */
GX_LoadTexObj(&texobj, GX_TEXMAP0);
/* select TV mode */
if (config.render) rmode = tvmodes[gc_pal*3 + 2];
else rmode = tvmodes[gc_pal*3 + interlaced];
/* reset aspect ratio */
gxScale(vwidth,vheight);
/* configure GX */
GX_SetViewport(0.0F, 0.0F, rmode->fbWidth, rmode->efbHeight, 0.0F, 1.0F);
GX_SetScissor(0, 0, rmode->fbWidth, rmode->efbHeight);
f32 yScale = GX_GetYScaleFactor(rmode->efbHeight, rmode->xfbHeight);
u16 xfbHeight = GX_SetDispCopyYScale(yScale);
GX_SetDispCopySrc(0, 0, rmode->fbWidth, rmode->efbHeight);
GX_SetDispCopyDst(rmode->fbWidth, xfbHeight);
GX_SetCopyFilter(rmode->aa, rmode->sample_pattern, config.render ? GX_TRUE : GX_FALSE, rmode->vfilter);
GX_SetFieldMode(rmode->field_rendering, ((rmode->viHeight == 2 * rmode->xfbHeight) ? GX_ENABLE : GX_DISABLE));
GX_SetPixelFmt(rmode->aa ? GX_PF_RGB565_Z16 : GX_PF_RGB8_Z24, GX_ZC_LINEAR);
Mtx p;
guOrtho(p, rmode->efbHeight/2, -(rmode->efbHeight/2), -(rmode->fbWidth/2), rmode->fbWidth/2, 100, 1000);
GX_LoadProjectionMtx(p, GX_ORTHOGRAPHIC);
GX_Flush();
/* configure VI */
whichfb = odd_frame;
VIDEO_Configure(rmode);
VIDEO_SetNextFramebuffer(xfb[whichfb]);
VIDEO_Flush();
VIDEO_WaitVSync();
if (rmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync();
else while (VIDEO_GetNextField() != odd_frame) VIDEO_WaitVSync();
}
/* texture is now directly mapped by the line renderer */
@ -657,34 +635,18 @@ void ogc_video__update()
draw_square();
GX_DrawDone();
/* single-field interlaced display requires proper sync*/
if (interlaced && !config.render)
{
/* desync */
if (odd_frame == whichfb)
{
/* force field resync */
odd_frame = whichfb ^ 1;
}
else
{
/* copy EFB to proper XFB */
GX_CopyDisp (xfb[whichfb], GX_TRUE);
GX_Flush ();
}
}
else
{
/* force fields resync in SF interlaced modes*/
if (rmode->field_rendering) odd_frame = whichfb;
/* swap XFB */
whichfb ^= 1;
VIDEO_SetNextFramebuffer(xfb[whichfb]);
VIDEO_Flush();
/* copy EFB to current XFB */
/* copy EFB to XFB */
GX_CopyDisp(xfb[whichfb], GX_TRUE);
GX_Flush();
}
}
/* Initialize VIDEO subsystem */
void ogc_video__init(void)
@ -753,7 +715,7 @@ void ogc_video__init(void)
}
#ifdef HW_RVL
/* Widescreen fix */
/* widescreen menu fix */
if (CONF_GetAspectRatio())
{
vmode->viWidth = 678;

View File

@ -26,8 +26,6 @@
extern unsigned int *xfb[2];
extern int whichfb;
extern int gc_pal;
extern GXRModeObj *tvmodes[6];
extern GXRModeObj *vmode;
extern u8 *texturemem;

View File

@ -17,29 +17,21 @@
#include "ogc_video.h"
#include "config.h"
#define update_input() ogc_input__update()
#define DEFAULT_PATH "/genplus"
/* globals */
extern u32 diff_usec(long long start,long long end);
extern long long gettime();
extern void error(char *format, ...);
extern int getcompany();
extern void reloadrom();
extern void ClearGGCodes();
extern void GetGGEntries();
extern void reloadrom();
extern void legal();
extern void MainMenu(u32 fps);
extern void set_region();
extern int ManageSRAM(u8 direction, u8 device);
extern int ManageState(u8 direction, u8 device);
extern void memfile_autosave();
extern void memfile_autoload();
extern int peripherals;
extern int frameticker;
extern int Shutdown;
extern bool fat_enabled;
extern u8 fat_enabled;
extern u32 frameticker;
#endif /* _OSD_H_ */