minor bugfixes

This commit is contained in:
dborth 2009-04-09 07:17:06 +00:00
parent 3ae39c8ff0
commit 993a3eb00f
5 changed files with 272 additions and 67 deletions

View File

@ -36,8 +36,6 @@ extern "C" {
#include "gcunzip.h"
#include "wiiusbsupport.h"
void AutoLoad(int method);
BROWSERINFO browser;
BROWSERENTRY * browserList = NULL; // list of files/folders in browser
@ -450,8 +448,10 @@ int BrowserLoadFile(int method)
}
else
{
AutoLoad(method); // Load SRAM (battery backed RAM) or save state
if (GCSettings.AutoLoad == 1)
LoadBatteryOrStateAuto(GCSettings.SaveMethod, FILE_SRAM, SILENT);
else if (GCSettings.AutoLoad == 2)
LoadBatteryOrStateAuto(GCSettings.SaveMethod, FILE_SNAPSHOT, SILENT);
ResetBrowser();
}
CancelAction();

View File

@ -39,6 +39,223 @@ char DebugStr[50] = "";
va_end( args );
}*/
u32 MK1Input(unsigned short pad) {
u32 J = StandardMovement(pad);
u8 Health = gbReadMemory(0xc695);
static u8 OldHealth = 0;
// Rumble when they lose health!
if (Health < OldHealth)
systemGameRumble(5);
OldHealth = Health;
#ifdef HW_RVL
WPADData * wp = WPAD_Data(pad);
// Punch
if (wp->btns_h & WPAD_BUTTON_UP || wp->btns_h & WPAD_BUTTON_LEFT)
J |= VBA_BUTTON_B;
// Kick
if (wp->btns_h & WPAD_BUTTON_DOWN || wp->btns_h & WPAD_BUTTON_RIGHT)
J |= VBA_BUTTON_A;
// Block
if ((wp->exp.type == WPAD_EXP_NUNCHUK) && (wp->btns_h & WPAD_NUNCHUK_BUTTON_Z))
J |= VBA_BUTTON_A | VBA_BUTTON_B; // different from MK2
// Throw
if (wp->btns_h & WPAD_BUTTON_A)
J |= VBA_BUTTON_B | VBA_RIGHT; // CAKTODO check which way we are facing
// Pause
if (wp->btns_h & WPAD_BUTTON_MINUS)
J |= VBA_BUTTON_SELECT;
// Start
if (wp->btns_h & WPAD_BUTTON_PLUS)
J |= VBA_BUTTON_START;
// Special move
if (wp->btns_h & WPAD_BUTTON_B)
{
// CAKTODO
}
#endif
return J;
}
u32 MK4Input(unsigned short pad)
{
u32 J = StandardMovement(pad);
u8 Health = 0;
static u8 OldHealth = 0;
// Rumble when they lose health!
if (Health < OldHealth)
systemGameRumble(20);
OldHealth = Health;
#ifdef HW_RVL
WPADData * wp = WPAD_Data(pad);
// Punch
if (wp->btns_h & WPAD_BUTTON_UP || wp->btns_h & WPAD_BUTTON_LEFT)
J |= VBA_BUTTON_B;
// Kick
if (wp->btns_h & WPAD_BUTTON_DOWN || wp->btns_h & WPAD_BUTTON_RIGHT)
J |= VBA_BUTTON_A;
// Block
if ((wp->exp.type == WPAD_EXP_NUNCHUK) && (wp->btns_h & WPAD_NUNCHUK_BUTTON_Z))
J |= VBA_BUTTON_START;
// Throw
if (wp->btns_h & WPAD_BUTTON_A)
J |= VBA_BUTTON_B | VBA_RIGHT; // CAKTODO check which way we are facing
// Pause
if (wp->btns_h & WPAD_BUTTON_MINUS)
J |= VBA_BUTTON_SELECT;
// Start
if (wp->btns_h & WPAD_BUTTON_PLUS)
J |= VBA_BUTTON_START;
// Special move
if (wp->btns_h & WPAD_BUTTON_B)
{
// CAKTODO
}
#endif
return J;
}
u32 MKAInput(unsigned short pad)
{
u32 J = StandardMovement(pad);
u8 Health = 0;
static u8 OldHealth = 0;
// Rumble when they lose health!
if (Health < OldHealth)
systemGameRumble(20);
OldHealth = Health;
#ifdef HW_RVL
WPADData * wp = WPAD_Data(pad);
// Punch
if (wp->btns_h & WPAD_BUTTON_UP || wp->btns_h & WPAD_BUTTON_LEFT)
J |= VBA_BUTTON_B;
// Kick
if (wp->btns_h & WPAD_BUTTON_DOWN || wp->btns_h & WPAD_BUTTON_RIGHT)
J |= VBA_BUTTON_A;
// Block
if ((wp->exp.type == WPAD_EXP_NUNCHUK) && (wp->btns_h & WPAD_NUNCHUK_BUTTON_Z))
J |= VBA_BUTTON_R;
// Run (supposed to be change styles)
if ((wp->exp.type == WPAD_EXP_NUNCHUK) && (wp->btns_h & WPAD_NUNCHUK_BUTTON_C))
J |= VBA_BUTTON_L;
// Throw
if (wp->btns_h & WPAD_BUTTON_A)
J |= VBA_RIGHT; // CAKTODO check which way we are facing
// Pause
if (wp->btns_h & WPAD_BUTTON_PLUS || wp->btns_h & WPAD_BUTTON_MINUS)
J |= VBA_BUTTON_SELECT;
// Special move
if (wp->btns_h & WPAD_BUTTON_B)
{
// CAKTODO
}
#endif
return J;
}
u32 MKTEInput(unsigned short pad)
{
static u32 prevJ = 0, prevPrevJ = 0;
u32 J = StandardMovement(pad);
#ifdef HW_RVL
WPADData * wp = WPAD_Data(pad);
u8 Health;
u8 Side;
if (RomIdCode & 0xFFFFFF == MKDA)
{
Health = CPUReadByte(0x3000760); // 731 or 760
Side = CPUReadByte(0x3000747);
}
else
{
Health = CPUReadByte(0x3000761); // or 790
Side = CPUReadByte(0x3000777);
}
static u8 OldHealth = 0;
// Rumble when they lose health!
if (Health < OldHealth)
systemGameRumble(20);
OldHealth = Health;
u32 Forwards, Back;
if (Side == 0)
{
Forwards = VBA_RIGHT;
Back = VBA_LEFT;
}
else
{
Forwards = VBA_LEFT;
Back = VBA_RIGHT;
}
// Punch
if (wp->btns_h & WPAD_BUTTON_UP || wp->btns_h & WPAD_BUTTON_LEFT)
J |= VBA_BUTTON_B;
// Kick
if (wp->btns_h & WPAD_BUTTON_DOWN || wp->btns_h & WPAD_BUTTON_RIGHT)
J |= VBA_BUTTON_A;
// Block
if ((wp->exp.type == WPAD_EXP_NUNCHUK) && (wp->btns_h & WPAD_NUNCHUK_BUTTON_Z))
J |= VBA_BUTTON_R;
// Change styles
if ((wp->exp.type == WPAD_EXP_NUNCHUK) && (wp->btns_h & WPAD_NUNCHUK_BUTTON_C))
J |= VBA_BUTTON_L;
// Throw
if (wp->btns_h & WPAD_BUTTON_A)
{
if ((prevJ & Forwards && prevJ & VBA_BUTTON_A && prevJ & VBA_BUTTON_B) || ((prevPrevJ & Forwards) && !(prevJ & Forwards)))
J |= Forwards | VBA_BUTTON_A | VBA_BUTTON_B; // R, R+1+2 = throw
else if (prevJ & Forwards)
{
J &= ~Forwards;
J &= ~VBA_BUTTON_A;
J &= ~VBA_BUTTON_B;
}
else
J |= Forwards;
}
// Pause
if (wp->btns_h & WPAD_BUTTON_MINUS)
J |= VBA_BUTTON_SELECT;
// Start
if (wp->btns_h & WPAD_BUTTON_PLUS)
J |= VBA_BUTTON_START;
// Special move
if (wp->btns_h & WPAD_BUTTON_B) {
// CAKTODO
}
// Speed
if (wp->btns_h & WPAD_BUTTON_1 || wp->btns_h & WPAD_BUTTON_2) {
J |= VBA_SPEED;
}
#endif
if ((J & 48) == 48)
J &= ~16;
if ((J & 192) == 192)
J &= ~128;
prevPrevJ = prevJ;
prevJ = J;
return J;
}
u32 LegoStarWars1Input(unsigned short pad) {
u32 J = StandardMovement(pad) | DecodeGamecube(pad) | DPadWASD(pad);
// Rumble when they lose health!

View File

@ -508,58 +508,6 @@ void InfoPrompt(const char *msg)
WindowPrompt("Information", msg, "OK", NULL);
}
/****************************************************************************
* AutoSave
*
* Automatically saves SRAM/snapshot when returning from in-game to the menu
***************************************************************************/
void AutoSave()
{
if (GCSettings.AutoSave == 1)
{
SaveBatteryOrStateAuto(GCSettings.SaveMethod, FILE_SRAM, SILENT); // save battery
}
else if (GCSettings.AutoSave == 2)
{
if (WindowPrompt("Save", "Save Snapshot?", "Save", "Don't Save") )
SaveBatteryOrStateAuto(GCSettings.SaveMethod, FILE_SNAPSHOT, NOTSILENT); // save state
}
else if (GCSettings.AutoSave == 3)
{
if (WindowPrompt("Save", "Save SRAM and Snapshot?", "Save", "Don't Save") )
{
SaveBatteryOrStateAuto(GCSettings.SaveMethod, FILE_SRAM, NOTSILENT); // save battery
SaveBatteryOrStateAuto(GCSettings.SaveMethod, FILE_SNAPSHOT, NOTSILENT); // save state
}
}
}
/****************************************************************************
* AutoLoad
*
* Automatically loads SRAM/snapshot when choosing a game from the menu
***************************************************************************/
void AutoLoad(int method)
{
if (GCSettings.AutoLoad == 1)
{
LoadBatteryOrStateAuto(method, FILE_SRAM, SILENT); // save battery
}
else if (GCSettings.AutoLoad == 2)
{
if (WindowPrompt("Load", "Load Snapshot?", "Load", "Don't Load") )
LoadBatteryOrStateAuto(method, FILE_SNAPSHOT, NOTSILENT); // save state
}
else if (GCSettings.AutoLoad == 3)
{
if (WindowPrompt("Load", "Load SRAM and Snapshot?", "Load", "Don't Load") )
{
LoadBatteryOrStateAuto(method, FILE_SRAM, NOTSILENT); // save battery
LoadBatteryOrStateAuto(method, FILE_SNAPSHOT, NOTSILENT); // save state
}
}
}
/****************************************************************************
* OnScreenKeyboard
*
@ -1256,7 +1204,23 @@ static int MenuGame()
resetBtn.SetEffect(EFFECT_FADE, 15);
//cheatsBtn.SetEffect(EFFECT_FADE, 15);
AutoSave();
if (GCSettings.AutoSave == 1)
{
SaveBatteryOrStateAuto(GCSettings.SaveMethod, FILE_SRAM, SILENT); // save battery
}
else if (GCSettings.AutoSave == 2)
{
if (WindowPrompt("Save", "Save Snapshot?", "Save", "Don't Save") )
SaveBatteryOrStateAuto(GCSettings.SaveMethod, FILE_SNAPSHOT, NOTSILENT); // save state
}
else if (GCSettings.AutoSave == 3)
{
if (WindowPrompt("Save", "Save SRAM and Snapshot?", "Save", "Don't Save") )
{
SaveBatteryOrStateAuto(GCSettings.SaveMethod, FILE_SRAM, NOTSILENT); // save battery
SaveBatteryOrStateAuto(GCSettings.SaveMethod, FILE_SNAPSHOT, NOTSILENT); // save state
}
}
}
ResumeGui();
@ -2338,8 +2302,8 @@ ButtonMappingWindow()
case CTRLR_CLASSIC:
if(userInput[0].wpad.exp.type != WPAD_EXP_CLASSIC)
pressed = 0; // not a valid input
//else if(pressed <= 0x1000)
// pressed = 0; // not a valid input (says Tantric, I disagree)
else if(pressed <= 0x1000)
pressed = 0;
break;
case CTRLR_NUNCHUK:

View File

@ -315,18 +315,42 @@ bool LoadBatteryOrStateAuto(int method, int action, bool silent)
if(method == METHOD_AUTO)
return false;
char filepath[1024];
char filepath[MAXPATHLEN];
char fullpath[MAXPATHLEN];
char filepath2[MAXPATHLEN];
char fullpath2[MAXPATHLEN];
if(!MakeFilePath(filepath, action, method, ROMFilename, 0))
return false;
if (action==FILE_SRAM) {
if (!LoadBatteryOrState(filepath, method, action, SILENT)) {
if(!MakeFilePath(filepath, action, method, ROMFilename, -1))
if (action==FILE_SRAM)
{
if (!LoadBatteryOrState(filepath, method, action, SILENT))
{
if(!MakeFilePath(filepath2, action, method, ROMFilename, -1))
return false;
return LoadBatteryOrState(filepath, method, action, silent);
} else return true;
} else return LoadBatteryOrState(filepath, method, action, silent);
if(LoadBatteryOrState(filepath2, method, action, silent))
{
// rename this file - append Auto
sprintf(fullpath, "%s%s", rootdir, filepath); // add device to path
sprintf(fullpath2, "%s%s", rootdir, filepath2); // add device to path
rename(fullpath2, fullpath); // rename file (to avoid duplicates)
return true;
}
else
{
return false;
}
}
else
{
return true;
}
}
else
{
return LoadBatteryOrState(filepath, method, action, silent);
}
}
/****************************************************************************

View File

@ -392,7 +392,7 @@ InitializeVideo ()
VIDEO_Configure (vmode);
screenheight = 480; //vmode->xfbHeight;
screenheight = 480;
screenwidth = vmode->fbWidth;
// Allocate the video buffers