finalize 3.3.1

This commit is contained in:
dborth 2012-07-07 17:45:30 +00:00
parent 9bf59c54dd
commit bbd3eebfb2
8 changed files with 190 additions and 178 deletions

View File

@ -2,8 +2,8 @@
<app version="1">
<name>FCE Ultra GX</name>
<coder>Tantric</coder>
<version>3.3.0</version>
<release_date>20120706</release_date>
<version>3.3.1</version>
<release_date>20120707</release_date>
<short_description>Nintendo Emulator</short_description>
<long_description>A port of FCE Ultra to the Wii.</long_description>
<ahb_access />

View File

@ -33,6 +33,10 @@ Wii/GameCube.
|0O×øo· UPDATE HISTORY ·oø×O0|
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
[3.3.1 - July 7, 2012]
* Fixed PAL support
[3.3.0 - July 6, 2012]
* Support for newer Wiimotes

View File

@ -52,8 +52,8 @@ extern "C" {
extern void __exception_setreload(int t);
}
static int fskipc = 0;
static int fskip = 0;
int fskipc = 0;
int fskip = 0;
static uint8 *gfx=0;
static int32 *sound=0;
static int32 ssize=0;
@ -267,11 +267,13 @@ static mutex_t gecko_mutex = 0;
static ssize_t __out_write(struct _reent *r, int fd, const char *ptr, size_t len)
{
u32 level;
if (!ptr || len <= 0 || !gecko)
if (!gecko || len == 0)
return len;
if(!ptr || len < 0)
return -1;
u32 level;
LWP_MutexLock(gecko_mutex);
level = IRQ_Disable();
usb_sendbuffer(1, ptr, len);
@ -303,148 +305,18 @@ const devoptab_t gecko_out = {
NULL // device statvfs_r
};
void USBGeckoOutput()
static void USBGeckoOutput()
{
LWP_MutexInit(&gecko_mutex, false);
gecko = usb_isgeckoalive(1);
LWP_MutexInit(&gecko_mutex, false);
devoptab_list[STD_OUT] = &gecko_out;
devoptab_list[STD_ERR] = &gecko_out;
}
//CAK: We need to know the OUT1 pin of the expansion port for Famicom 3D System glasses
extern uint8 shutter_3d;
//CAK: We need to know the palette in RAM for red/cyan anaglyph 3D games (3D World Runner and Rad Racer)
extern uint8 PALRAM[0x20];
bool shutter_3d_mode, anaglyph_3d_mode, eye_3d;
bool old_shutter_3d_mode = 0, old_anaglyph_3d_mode = 0;
uint8 prev_shutter_3d = 0, prev_prev_shutter_3d = 0;
uint8 pal_3d = 0, prev_pal_3d = 0, prev_prev_pal_3d = 0;
bool CheckForAnaglyphPalette()
{
//CAK: It can also have none of these when all blacks
bool hasRed = false, hasCyan = false, hasOther = false;
pal_3d = 0;
//CAK: first 12 background colours are used for anaglyph (last 4 are for status bar)
for (int i = 0; i < 12; i++)
{
switch (PALRAM[i] & 63)
{
case 0x00:
case 0x0F: //CAK: blacks
break;
case 0x01:
case 0x11:
case 0x0A:
case 0x1A:
case 0x0C:
case 0x1C:
case 0x2C: //CAK: cyan
hasCyan = true;
break;
case 0x05:
case 0x15:
case 0x06:
case 0x16: //CAK: reds
hasRed = true;
break;
default:
hasOther = true;
}
}
if (hasOther || (hasRed && hasCyan))
return false;
//CAK: last 8 sprite colours are used for anaglyph (first 8 are for screen-level sprites)
for (int i = 24; i < 32; i++)
{
switch (PALRAM[i] & 63)
{
case 0x00:
case 0x0F: //CAK: blacks
break;
case 0x01:
case 0x11:
case 0x0A:
case 0x1A:
case 0x0C:
case 0x1C:
case 0x2c: //CAK: cyan
hasCyan = true;
break;
case 0x05:
case 0x15:
case 0x06:
case 0x16: //CAK: reds
hasRed = true;
break;
default:
hasOther = true;
}
}
if (hasOther || (hasRed && hasCyan) || (!hasRed && !hasCyan))
return false;
eye_3d = hasCyan;
if (hasCyan)
pal_3d = 2;
else
pal_3d = 1;
return true;
}
//CAK: Handles automatically entering and exiting stereoscopic 3D mode, and detecting which eye to draw
void Check3D()
{
//CAK: Stereoscopic 3D game mode detection
shutter_3d_mode = (shutter_3d != prev_shutter_3d && shutter_3d == prev_prev_shutter_3d);
prev_prev_shutter_3d = prev_shutter_3d;
prev_shutter_3d = shutter_3d;
if (shutter_3d_mode)
{
fskip = 0;
eye_3d = !shutter_3d;
}
else if (old_shutter_3d_mode)
{
//CAK: exited stereoscopic 3d mode, reset frameskip to 0
fskip = 0;
fskipc = 0;
frameskip = 0;
}
else
{
//CAK: Only check anaglyph when it's not a Famicom 3D System game
//Games are detected as anaglyph, only when they alternate between a very limited red palette
//and a very limited blue/green palette. It's very unlikely other games will do that, but
//not impossible.
anaglyph_3d_mode = CheckForAnaglyphPalette() && pal_3d != prev_pal_3d && pal_3d == prev_prev_pal_3d && prev_pal_3d != 0;
prev_prev_pal_3d = prev_pal_3d;
prev_pal_3d = pal_3d;
if (anaglyph_3d_mode)
{
fskip = 0;
}
else if (old_anaglyph_3d_mode)
{
//CAK: exited stereoscopic 3d mode, reset frameskip to 0
fskip = 0;
fskipc = 0;
frameskip = 0;
}
//CAK: TODO: make a backup of palette whenever not in anaglyph mode,
//and use it to override anaglyph's horible palette for full colour 3D
//note the difficulty will be that palette entries get rearranged to
//animate the road and will still need to be rearranged in our backup palette
}
old_shutter_3d_mode = shutter_3d_mode;
old_anaglyph_3d_mode = anaglyph_3d_mode;
extern "C" {
s32 __STM_Close();
s32 __STM_Init();
}
/****************************************************************************
@ -454,7 +326,7 @@ void Check3D()
int main(int argc, char *argv[])
{
#ifdef HW_RVL
#ifdef HW_RVL
L2Enhance();
u32 ios = IOS_GetVersion();
@ -466,43 +338,43 @@ int main(int argc, char *argv[])
if(SupportedIOS(preferred))
IOS_ReloadIOS(preferred);
}
#endif
//USBGeckoOutput(); // uncomment to enable USB gecko output
__exception_setreload(8);
#ifdef HW_DOL
#else
ipl_set_config(6); // disable Qoob modchip
#endif
#ifdef HW_RVL
StartNetworkThread();
DI_Init();
#endif
USBGeckoOutput(); // uncomment to enable USB gecko output
__exception_setreload(8);
InitDeviceThread();
InitGCVideo (); // Initialize video
SetupPads();
ResetVideo_Menu (); // change to menu video mode
MountAllFAT(); // Initialize libFAT for SD and USB
#ifdef HW_RVL
// Wii Power/Reset buttons
WPAD_SetPowerButtonCallback((WPADShutdownCallback)ShutdownCB);
__STM_Close();
__STM_Init();
__STM_Close();
__STM_Init();
SYS_SetPowerCallback(ShutdownCB);
SYS_SetResetCallback(ResetCB);
WPAD_Init();
WPAD_SetPowerButtonCallback((WPADShutdownCallback)ShutdownCB);
DI_Init();
USBStorage_Initialize();
StartNetworkThread();
#else
DVD_Init (); // Initialize DVD subsystem (GameCube only)
#endif
// Initialize DVD subsystem (GameCube only)
#ifdef HW_DOL
DVD_Init ();
#endif
SetupPads();
InitDeviceThread();
MountAllFAT(); // Initialize libFAT for SD and USB
#ifdef HW_RVL
// store path app was loaded from
#ifdef HW_RVL
if(argc > 0 && argv[0] != NULL)
CreateAppPath(argv[0]);
#endif
#endif
DefaultSettings(); // Set defaults
InitialiseAudio();

View File

@ -17,7 +17,7 @@
#include "fceultra/driver.h"
#define APPNAME "FCE Ultra GX"
#define APPVERSION "3.3.0"
#define APPVERSION "3.3.1"
#define APPFOLDER "fceugx"
#define PREF_FILE_NAME "settings.xml"
@ -122,6 +122,8 @@ extern int ExitRequested;
extern char appPath[];
extern char loadedFile[];
extern int frameskip;
extern int fskip;
extern int fskipc;
extern int turbomode;
extern bool romLoaded;

View File

@ -72,6 +72,7 @@ struct pcpal {
static unsigned int gcpalette[256]; // Much simpler GC palette
static unsigned short rgb565[256]; // Texture map palette
bool shutter_3d_mode, anaglyph_3d_mode, eye_3d;
bool AnaglyphPaletteValid = false; //CAK: Has the anaglyph palette below been generated yet?
static unsigned short anaglyph565[64][64]; //CAK: Texture map left right combination anaglyph palette
static void GenerateAnaglyphPalette(); //CAK: function prototype for generating the anaglyph palette
@ -79,8 +80,6 @@ static void GenerateAnaglyphPalette(); //CAK: function prototype for generating
static long long prev;
static long long now;
extern bool shutter_3d_mode, anaglyph_3d_mode; //CAK: only used for the SyncSpeed function because 3D is 30Hz
/* New texture based scaler */
typedef struct tagcamera
{
@ -585,10 +584,10 @@ InitGCVideo ()
VIDEO_Init();
// Allocate the video buffers
xfb[0] = (u32 *) memalign(32, 640*574*2);
xfb[1] = (u32 *) memalign(32, 640*574*2);
DCInvalidateRange(xfb[0], 640*574*2);
DCInvalidateRange(xfb[1], 640*574*2);
xfb[0] = (u32 *) memalign(32, 640*576*2);
xfb[1] = (u32 *) memalign(32, 640*576*2);
DCInvalidateRange(xfb[0], 640*576*2);
DCInvalidateRange(xfb[1], 640*576*2);
xfb[0] = (u32 *) MEM_K0_TO_K1 (xfb[0]);
xfb[1] = (u32 *) MEM_K0_TO_K1 (xfb[1]);
@ -1534,3 +1533,136 @@ struct st_palettes palettes[] = {
}
};
//CAK: We need to know the OUT1 pin of the expansion port for Famicom 3D System glasses
extern uint8 shutter_3d;
//CAK: We need to know the palette in RAM for red/cyan anaglyph 3D games (3D World Runner and Rad Racer)
extern uint8 PALRAM[0x20];
bool old_shutter_3d_mode = 0, old_anaglyph_3d_mode = 0;
uint8 prev_shutter_3d = 0, prev_prev_shutter_3d = 0;
uint8 pal_3d = 0, prev_pal_3d = 0, prev_prev_pal_3d = 0;
bool CheckForAnaglyphPalette()
{
//CAK: It can also have none of these when all blacks
bool hasRed = false, hasCyan = false, hasOther = false;
pal_3d = 0;
//CAK: first 12 background colours are used for anaglyph (last 4 are for status bar)
for (int i = 0; i < 12; i++)
{
switch (PALRAM[i] & 63)
{
case 0x00:
case 0x0F: //CAK: blacks
break;
case 0x01:
case 0x11:
case 0x0A:
case 0x1A:
case 0x0C:
case 0x1C:
case 0x2C: //CAK: cyan
hasCyan = true;
break;
case 0x05:
case 0x15:
case 0x06:
case 0x16: //CAK: reds
hasRed = true;
break;
default:
hasOther = true;
}
}
if (hasOther || (hasRed && hasCyan))
return false;
//CAK: last 8 sprite colours are used for anaglyph (first 8 are for screen-level sprites)
for (int i = 24; i < 32; i++)
{
switch (PALRAM[i] & 63)
{
case 0x00:
case 0x0F: //CAK: blacks
break;
case 0x01:
case 0x11:
case 0x0A:
case 0x1A:
case 0x0C:
case 0x1C:
case 0x2c: //CAK: cyan
hasCyan = true;
break;
case 0x05:
case 0x15:
case 0x06:
case 0x16: //CAK: reds
hasRed = true;
break;
default:
hasOther = true;
}
}
if (hasOther || (hasRed && hasCyan) || (!hasRed && !hasCyan))
return false;
eye_3d = hasCyan;
if (hasCyan)
pal_3d = 2;
else
pal_3d = 1;
return true;
}
//CAK: Handles automatically entering and exiting stereoscopic 3D mode, and detecting which eye to draw
void Check3D()
{
//CAK: Stereoscopic 3D game mode detection
shutter_3d_mode = (shutter_3d != prev_shutter_3d && shutter_3d == prev_prev_shutter_3d);
prev_prev_shutter_3d = prev_shutter_3d;
prev_shutter_3d = shutter_3d;
if (shutter_3d_mode)
{
fskip = 0;
eye_3d = !shutter_3d;
}
else if (old_shutter_3d_mode)
{
//CAK: exited stereoscopic 3d mode, reset frameskip to 0
fskip = 0;
fskipc = 0;
frameskip = 0;
}
else
{
//CAK: Only check anaglyph when it's not a Famicom 3D System game
//Games are detected as anaglyph, only when they alternate between a very limited red palette
//and a very limited blue/green palette. It's very unlikely other games will do that, but
//not impossible.
anaglyph_3d_mode = CheckForAnaglyphPalette() && pal_3d != prev_pal_3d && pal_3d == prev_prev_pal_3d && prev_pal_3d != 0;
prev_prev_pal_3d = prev_pal_3d;
prev_pal_3d = pal_3d;
if (anaglyph_3d_mode)
{
fskip = 0;
}
else if (old_anaglyph_3d_mode)
{
//CAK: exited stereoscopic 3d mode, reset frameskip to 0
fskip = 0;
fskipc = 0;
frameskip = 0;
}
//CAK: TODO: make a backup of palette whenever not in anaglyph mode,
//and use it to override anaglyph's horible palette for full colour 3D
//note the difficulty will be that palette entries get rearranged to
//animate the road and will still need to be rearranged in our backup palette
}
old_shutter_3d_mode = shutter_3d_mode;
old_anaglyph_3d_mode = anaglyph_3d_mode;
}

View File

@ -33,6 +33,7 @@ void TakeScreenshot();
void Menu_Render ();
void Menu_DrawImg(f32 xpos, f32 ypos, u16 width, u16 height, u8 data[], f32 degrees, f32 scaleX, f32 scaleY, u8 alphaF );
void Menu_DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 filled);
void Check3D();
extern GXRModeObj *vmode;
extern int screenheight;
@ -44,5 +45,8 @@ extern struct st_palettes palettes[];
extern int FDSSwitchRequested;
extern bool progressive;
extern u32 FrameTimer;
extern bool shutter_3d_mode;
extern bool anaglyph_3d_mode;
extern bool eye_3d;
#endif

View File

@ -233,8 +233,6 @@ SetupPads()
PAD_Init();
#ifdef HW_RVL
WPAD_Init();
// read wiimote accelerometer and IR data
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<app version="3.3.0">
<file url="http://fceugc.googlecode.com/files/FCE%20Ultra%20GX%203.3.0.zip"></file>
<app version="3.3.1">
<file url="http://fceugc.googlecode.com/files/FCE%20Ultra%20GX%203.3.1.zip"></file>
</app>