mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-26 04:24:16 +01:00
battery and saves work now, many many other improvements
This commit is contained in:
parent
10ef70fcdd
commit
eff1bf8705
@ -43,13 +43,12 @@ void MIXER_AddSamples( u8 *sampledata, int len )
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
/* Do simple linear interpolate */
|
// Do simple linear interpolate
|
||||||
dst[head++] = src[fixofs >> 16];
|
dst[head++] = src[fixofs >> 16];
|
||||||
head &= MIXERMASK;
|
head &= MIXERMASK;
|
||||||
fixofs += fixinc;
|
fixofs += fixinc;
|
||||||
}
|
}
|
||||||
while( --intlen );
|
while( --intlen );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -17,12 +17,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef WII_DVD
|
#ifdef WII_DVD
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <di/di.h>
|
#include <di/di.h>
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "menudraw.h"
|
#include "menudraw.h"
|
||||||
#include "gcunzip.h"
|
#include "gcunzip.h"
|
||||||
|
@ -174,12 +174,12 @@ ParseFATdirectory(int method)
|
|||||||
int
|
int
|
||||||
LoadFATFile (char *filename, int length)
|
LoadFATFile (char *filename, int length)
|
||||||
{
|
{
|
||||||
char zipbuffer[2048];
|
/* char zipbuffer[2048];
|
||||||
char filepath[MAXPATHLEN];
|
char filepath[MAXPATHLEN];
|
||||||
FILE *handle;
|
FILE *handle;
|
||||||
unsigned char *rbuffer;
|
unsigned char *rbuffer;
|
||||||
u32 size;
|
u32 size;
|
||||||
|
*/
|
||||||
/* Check filename length */
|
/* Check filename length */
|
||||||
if ((strlen(currentdir)+1+strlen(filelist[selection].filename)) < MAXPATHLEN)
|
if ((strlen(currentdir)+1+strlen(filelist[selection].filename)) < MAXPATHLEN)
|
||||||
sprintf(filepath, "%s/%s",currentdir,filelist[selection].filename);
|
sprintf(filepath, "%s/%s",currentdir,filelist[selection].filename);
|
||||||
|
@ -19,19 +19,16 @@
|
|||||||
#include <sys/dir.h>
|
#include <sys/dir.h>
|
||||||
|
|
||||||
#ifdef WII_DVD
|
#ifdef WII_DVD
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <di/di.h>
|
#include <di/di.h>
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "vba.h"
|
#include "vba.h"
|
||||||
#include "vbasupport.h"
|
#include "vbasupport.h"
|
||||||
#include "vmmem.h"
|
#include "vmmem.h"
|
||||||
#include "menudraw.h"
|
#include "menudraw.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "filesel.h"
|
|
||||||
#include "fileop.h"
|
#include "fileop.h"
|
||||||
#include "memcardop.h"
|
#include "memcardop.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
@ -28,6 +28,7 @@ typedef struct
|
|||||||
|
|
||||||
#define MAXFILES 2000 // Restrict to 2000 files per dir
|
#define MAXFILES 2000 // Restrict to 2000 files per dir
|
||||||
extern FILEENTRIES filelist[MAXFILES];
|
extern FILEENTRIES filelist[MAXFILES];
|
||||||
|
extern char ROMFilename[512];
|
||||||
|
|
||||||
void ClearSaveBuffer ();
|
void ClearSaveBuffer ();
|
||||||
int OpenROM (int method);
|
int OpenROM (int method);
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wiiuse/wpad.h>
|
#include <wiiuse/wpad.h>
|
||||||
|
|
||||||
|
#include "vba.h"
|
||||||
|
#include "vbasupport.h"
|
||||||
#include "button_mapping.h"
|
#include "button_mapping.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
@ -44,7 +46,7 @@
|
|||||||
// VBA controller buttons
|
// VBA controller buttons
|
||||||
// All other pads are mapped to this
|
// All other pads are mapped to this
|
||||||
unsigned int vbapadmap[] = {
|
unsigned int vbapadmap[] = {
|
||||||
VBA_BUTTON_A, VBA_BUTTON_B,
|
VBA_BUTTON_B, VBA_BUTTON_A,
|
||||||
VBA_BUTTON_SELECT, VBA_BUTTON_START,
|
VBA_BUTTON_SELECT, VBA_BUTTON_START,
|
||||||
VBA_UP, VBA_DOWN,
|
VBA_UP, VBA_DOWN,
|
||||||
VBA_LEFT, VBA_RIGHT,
|
VBA_LEFT, VBA_RIGHT,
|
||||||
@ -53,7 +55,7 @@ unsigned int vbapadmap[] = {
|
|||||||
|
|
||||||
/*** Gamecube controller Padmap ***/
|
/*** Gamecube controller Padmap ***/
|
||||||
unsigned int gcpadmap[] = {
|
unsigned int gcpadmap[] = {
|
||||||
PAD_BUTTON_A, PAD_BUTTON_B,
|
PAD_BUTTON_B, PAD_BUTTON_A,
|
||||||
PAD_TRIGGER_Z, PAD_BUTTON_START,
|
PAD_TRIGGER_Z, PAD_BUTTON_START,
|
||||||
PAD_BUTTON_UP, PAD_BUTTON_DOWN,
|
PAD_BUTTON_UP, PAD_BUTTON_DOWN,
|
||||||
PAD_BUTTON_LEFT, PAD_BUTTON_RIGHT,
|
PAD_BUTTON_LEFT, PAD_BUTTON_RIGHT,
|
||||||
@ -65,23 +67,23 @@ unsigned int wmpadmap[] = {
|
|||||||
WPAD_BUTTON_MINUS, WPAD_BUTTON_PLUS,
|
WPAD_BUTTON_MINUS, WPAD_BUTTON_PLUS,
|
||||||
WPAD_BUTTON_RIGHT, WPAD_BUTTON_LEFT,
|
WPAD_BUTTON_RIGHT, WPAD_BUTTON_LEFT,
|
||||||
WPAD_BUTTON_UP, WPAD_BUTTON_DOWN,
|
WPAD_BUTTON_UP, WPAD_BUTTON_DOWN,
|
||||||
0x0000, 0x0000
|
WPAD_BUTTON_B, WPAD_BUTTON_A
|
||||||
};
|
};
|
||||||
/*** Classic Controller Padmap ***/
|
/*** Classic Controller Padmap ***/
|
||||||
unsigned int ccpadmap[] = {
|
unsigned int ccpadmap[] = {
|
||||||
WPAD_CLASSIC_BUTTON_A, WPAD_CLASSIC_BUTTON_B,
|
WPAD_CLASSIC_BUTTON_Y, WPAD_CLASSIC_BUTTON_B,
|
||||||
WPAD_CLASSIC_BUTTON_MINUS, WPAD_CLASSIC_BUTTON_PLUS,
|
WPAD_CLASSIC_BUTTON_MINUS, WPAD_CLASSIC_BUTTON_PLUS,
|
||||||
WPAD_CLASSIC_BUTTON_UP, WPAD_CLASSIC_BUTTON_DOWN,
|
WPAD_CLASSIC_BUTTON_UP, WPAD_CLASSIC_BUTTON_DOWN,
|
||||||
WPAD_CLASSIC_BUTTON_LEFT, WPAD_CLASSIC_BUTTON_RIGHT,
|
WPAD_CLASSIC_BUTTON_LEFT, WPAD_CLASSIC_BUTTON_RIGHT,
|
||||||
WPAD_CLASSIC_BUTTON_FULL_L, WPAD_CLASSIC_BUTTON_FULL_R
|
WPAD_CLASSIC_BUTTON_FULL_L, WPAD_CLASSIC_BUTTON_FULL_R
|
||||||
};
|
};
|
||||||
/*** Nunchuk + wiimote Padmap ***/
|
/*** Nunchuk + wiimote Padmap ***/
|
||||||
unsigned int ncpadmap[] = { WPAD_BUTTON_A, WPAD_BUTTON_B,
|
unsigned int ncpadmap[] = {
|
||||||
WPAD_NUNCHUK_BUTTON_C, WPAD_NUNCHUK_BUTTON_Z,
|
WPAD_NUNCHUK_BUTTON_C, WPAD_NUNCHUK_BUTTON_Z,
|
||||||
WPAD_BUTTON_MINUS, WPAD_BUTTON_PLUS,
|
WPAD_BUTTON_MINUS, WPAD_BUTTON_PLUS,
|
||||||
WPAD_BUTTON_2, WPAD_BUTTON_1,
|
|
||||||
WPAD_BUTTON_UP, WPAD_BUTTON_DOWN,
|
WPAD_BUTTON_UP, WPAD_BUTTON_DOWN,
|
||||||
WPAD_BUTTON_LEFT, WPAD_BUTTON_RIGHT
|
WPAD_BUTTON_LEFT, WPAD_BUTTON_RIGHT,
|
||||||
|
WPAD_BUTTON_2, WPAD_BUTTON_1
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
@ -302,12 +304,10 @@ u32 DecodeJoy(unsigned short pad)
|
|||||||
}
|
}
|
||||||
u32 GetJoy()
|
u32 GetJoy()
|
||||||
{
|
{
|
||||||
short i;
|
|
||||||
int pad = 0;
|
int pad = 0;
|
||||||
u32 res = 0;
|
u32 res = 0;
|
||||||
|
|
||||||
s8 gc_px = PAD_SubStickX (0);
|
s8 gc_px = PAD_SubStickX (0);
|
||||||
u32 jp = PAD_ButtonsHeld (0); // gamecube controller button info
|
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
s8 wm_sx = WPAD_StickX (0,1);
|
s8 wm_sx = WPAD_StickX (0,1);
|
||||||
@ -315,7 +315,7 @@ u32 GetJoy()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// request to go back to menu
|
// request to go back to menu
|
||||||
if ((gc_px < -70) || (jp & PAD_BUTTON_START)
|
if ((gc_px < -70)
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
|| (wm_pb & WPAD_BUTTON_HOME)
|
|| (wm_pb & WPAD_BUTTON_HOME)
|
||||||
|| (wm_pb & WPAD_CLASSIC_BUTTON_HOME)
|
|| (wm_pb & WPAD_CLASSIC_BUTTON_HOME)
|
||||||
@ -323,10 +323,9 @@ u32 GetJoy()
|
|||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (GCSettings.AutoSave == 1)
|
if (GCSettings.AutoSave == 1)
|
||||||
{
|
{
|
||||||
SaveRAM(GCSettings.SaveMethod, SILENT);
|
SaveBattery(GCSettings.SaveMethod, SILENT);
|
||||||
}
|
}
|
||||||
else if (GCSettings.AutoSave == 2)
|
else if (GCSettings.AutoSave == 2)
|
||||||
{
|
{
|
||||||
@ -334,11 +333,10 @@ u32 GetJoy()
|
|||||||
}
|
}
|
||||||
else if(GCSettings.AutoSave == 3)
|
else if(GCSettings.AutoSave == 3)
|
||||||
{
|
{
|
||||||
SaveRAM(GCSettings.SaveMethod, SILENT);
|
SaveBattery(GCSettings.SaveMethod, SILENT);
|
||||||
SaveState(GCSettings.SaveMethod, SILENT);
|
SaveState(GCSettings.SaveMethod, SILENT);
|
||||||
}
|
}
|
||||||
*/
|
MainMenu(3);
|
||||||
mainmenu(3);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||||
*
|
*
|
||||||
* softdev July 2006
|
* Tantric September 2008
|
||||||
* crunchy2 May-June 2007
|
|
||||||
* Tantric August 2008
|
|
||||||
*
|
*
|
||||||
* menu.cpp
|
* menu.cpp
|
||||||
*
|
*
|
||||||
@ -80,17 +78,14 @@ LoadManager ()
|
|||||||
int loadROM = OpenROM(GCSettings.LoadMethod);
|
int loadROM = OpenROM(GCSettings.LoadMethod);
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* check for autoloadsram / freeze
|
* check for autoload battery / state
|
||||||
***/
|
***/
|
||||||
if ( loadROM == 1 ) // if ROM was loaded, load the SRAM & settings
|
if ( loadROM == 1 ) // if ROM was loaded, load the battery / state
|
||||||
{
|
{
|
||||||
//if ( GCSettings.AutoLoad == 1 )
|
if (GCSettings.AutoLoad == 1)
|
||||||
// LoadSRAM(GCSettings.SaveMethod, SILENT);
|
LoadBattery(GCSettings.SaveMethod, SILENT);
|
||||||
//else if ( GCSettings.AutoLoad == 2 )
|
else if (GCSettings.AutoLoad == 2)
|
||||||
// NGCUnfreezeGame (GCSettings.SaveMethod, SILENT);
|
LoadState(GCSettings.SaveMethod, SILENT);
|
||||||
|
|
||||||
// setup cheats
|
|
||||||
//SetupCheats();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return loadROM;
|
return loadROM;
|
||||||
@ -125,7 +120,20 @@ PreferencesMenu ()
|
|||||||
while (quit == 0)
|
while (quit == 0)
|
||||||
{
|
{
|
||||||
// some load/save methods are not implemented - here's where we skip them
|
// some load/save methods are not implemented - here's where we skip them
|
||||||
// they need to be skipped in the order they were enumerated in snes9xGX.h
|
// they need to be skipped in the order they were enumerated in vba.h
|
||||||
|
|
||||||
|
// skip
|
||||||
|
if(GCSettings.LoadMethod == METHOD_DVD)
|
||||||
|
GCSettings.LoadMethod++;
|
||||||
|
if(GCSettings.LoadMethod == METHOD_SMB)
|
||||||
|
GCSettings.LoadMethod++;
|
||||||
|
if(GCSettings.SaveMethod == METHOD_SMB)
|
||||||
|
GCSettings.SaveMethod++;
|
||||||
|
if(GCSettings.SaveMethod == METHOD_MC_SLOTA)
|
||||||
|
GCSettings.SaveMethod++;
|
||||||
|
if(GCSettings.SaveMethod == METHOD_MC_SLOTB)
|
||||||
|
GCSettings.SaveMethod++;
|
||||||
|
|
||||||
|
|
||||||
// no USB ports on GameCube
|
// no USB ports on GameCube
|
||||||
#ifndef HW_RVL
|
#ifndef HW_RVL
|
||||||
@ -200,7 +208,6 @@ PreferencesMenu ()
|
|||||||
sprintf (prefmenu[6], "Verify MC Saves %s",
|
sprintf (prefmenu[6], "Verify MC Saves %s",
|
||||||
GCSettings.VerifySaves == true ? " ON" : "OFF");
|
GCSettings.VerifySaves == true ? " ON" : "OFF");
|
||||||
|
|
||||||
|
|
||||||
ret = RunMenu (prefmenu, prefmenuCount, (char*)"Preferences", 16);
|
ret = RunMenu (prefmenu, prefmenuCount, (char*)"Preferences", 16);
|
||||||
|
|
||||||
switch (ret)
|
switch (ret)
|
||||||
@ -302,21 +309,20 @@ GameMenu ()
|
|||||||
quit = retval = 1;
|
quit = retval = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // Load SRAM
|
case 2: // Load Battery
|
||||||
//quit = retval = LoadSRAM(GCSettings.SaveMethod, NOTSILENT);
|
quit = retval = LoadBattery(GCSettings.SaveMethod, NOTSILENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: // Save SRAM
|
case 3: // Save Battery
|
||||||
//SaveSRAM(GCSettings.SaveMethod, NOTSILENT);
|
SaveBattery(GCSettings.SaveMethod, NOTSILENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: // Load Freeze
|
case 4: // Load State
|
||||||
//quit = retval = NGCUnfreezeGame (GCSettings.SaveMethod, NOTSILENT);
|
quit = retval = LoadState(GCSettings.SaveMethod, NOTSILENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5: // Save Freeze
|
case 5: // Save State
|
||||||
//NGCFreezeGame (GCSettings.SaveMethod, NOTSILENT);
|
SaveState(GCSettings.SaveMethod, NOTSILENT);
|
||||||
//emulator.emuWriteState(statename);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -1: // Button B
|
case -1: // Button B
|
||||||
@ -334,10 +340,6 @@ GameMenu ()
|
|||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Controller Configuration
|
* Controller Configuration
|
||||||
*
|
|
||||||
* Snes9x 1.51 uses a cmd system to work out which button has been pressed.
|
|
||||||
* Here, I simply move the designated value to the gcpadmaps array, which
|
|
||||||
* saves on updating the cmd sequences.
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
u32
|
u32
|
||||||
GetInput (u16 ctrlr_type)
|
GetInput (u16 ctrlr_type)
|
||||||
@ -365,13 +367,7 @@ GetInput (u16 ctrlr_type)
|
|||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if ( WPAD_Probe( 0, &exp_type) == 0) // check wiimote and expansion status (first if wiimote is connected & no errors)
|
|
||||||
// {
|
|
||||||
pressed = WPAD_ButtonsHeld (0);
|
pressed = WPAD_ButtonsHeld (0);
|
||||||
|
|
||||||
// if (ctrlr_type != CTRLR_WIIMOTE && exp_type != ctrlr_type+1) // if we need input from an expansion, and its not connected...
|
|
||||||
// pressed = 0;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/*** check for exit sequence (c-stick left OR home button) ***/
|
/*** check for exit sequence (c-stick left OR home button) ***/
|
||||||
@ -429,27 +425,22 @@ GetButtonMap(u16 ctrlr_type, char* btn_name)
|
|||||||
|
|
||||||
DrawMenu(&cfg_text[0], NULL, cfg_text_count, 1); // display text
|
DrawMenu(&cfg_text[0], NULL, cfg_text_count, 1); // display text
|
||||||
|
|
||||||
// while (previous != pressed && pressed == 0); // get two consecutive button presses (which are the same)
|
|
||||||
// {
|
|
||||||
// previous = pressed;
|
|
||||||
// VIDEO_WaitVSync(); // slow things down a bit so we don't overread the pads
|
|
||||||
pressed = GetInput(ctrlr_type);
|
pressed = GetInput(ctrlr_type);
|
||||||
// }
|
|
||||||
return pressed;
|
return pressed;
|
||||||
} // end getButtonMap()
|
} // end getButtonMap()
|
||||||
|
|
||||||
int cfg_btns_count = 11;
|
int cfg_btns_count = 11;
|
||||||
char cfg_btns_menu[][50] = {
|
char cfg_btns_menu[][50] = {
|
||||||
"A - ",
|
|
||||||
"B - ",
|
"B - ",
|
||||||
"L TRIG - ",
|
"A - ",
|
||||||
"R TRIG - ",
|
|
||||||
"SELECT - ",
|
"SELECT - ",
|
||||||
"START - ",
|
"START - ",
|
||||||
"UP - ",
|
"UP - ",
|
||||||
"DOWN - ",
|
"DOWN - ",
|
||||||
"LEFT - ",
|
"LEFT - ",
|
||||||
"RIGHT - ",
|
"RIGHT - ",
|
||||||
|
"L TRIG - ",
|
||||||
|
"R TRIG - ",
|
||||||
"Return to previous"
|
"Return to previous"
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -531,8 +522,6 @@ ConfigureButtons (u16 ctrlr_type)
|
|||||||
case 7:
|
case 7:
|
||||||
case 8:
|
case 8:
|
||||||
case 9:
|
case 9:
|
||||||
case 10:
|
|
||||||
case 11:
|
|
||||||
/*** Change button map ***/
|
/*** Change button map ***/
|
||||||
// wait for input
|
// wait for input
|
||||||
memset (temp, 0, sizeof(temp));
|
memset (temp, 0, sizeof(temp));
|
||||||
@ -544,7 +533,7 @@ ConfigureButtons (u16 ctrlr_type)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case -1: /*** Button B ***/
|
case -1: /*** Button B ***/
|
||||||
case 12:
|
case 10:
|
||||||
/*** Return ***/
|
/*** Return ***/
|
||||||
quit = 1;
|
quit = 1;
|
||||||
break;
|
break;
|
||||||
@ -634,7 +623,7 @@ char menuitems[][50] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
mainmenu (int selectedMenu)
|
MainMenu (int selectedMenu)
|
||||||
{
|
{
|
||||||
tb_t start,end;
|
tb_t start,end;
|
||||||
mftb(&start);
|
mftb(&start);
|
||||||
|
@ -14,6 +14,6 @@
|
|||||||
|
|
||||||
#define _NGCMENU_
|
#define _NGCMENU_
|
||||||
|
|
||||||
void mainmenu (int selectedMenu);
|
void MainMenu (int selectedMenu);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -48,12 +48,6 @@ extern int screenheight;
|
|||||||
extern unsigned int *xfb[2];
|
extern unsigned int *xfb[2];
|
||||||
extern int whichfb;
|
extern int whichfb;
|
||||||
|
|
||||||
/*** Permanent backdrop ***/
|
|
||||||
#ifdef HW_RVL
|
|
||||||
u32 *backdrop;
|
|
||||||
#else
|
|
||||||
static u32 *backdrop;
|
|
||||||
#endif
|
|
||||||
unsigned int getcolour (u8 r1, u8 g1, u8 b1);
|
unsigned int getcolour (u8 r1, u8 g1, u8 b1);
|
||||||
void DrawLineFast( int startx, int endx, int y, u8 r, u8 g, u8 b );
|
void DrawLineFast( int startx, int endx, int y, u8 r, u8 g, u8 b );
|
||||||
u32 getrgb( u32 ycbr, u32 low );
|
u32 getrgb( u32 ycbr, u32 low );
|
||||||
@ -235,33 +229,23 @@ Credits ()
|
|||||||
else
|
else
|
||||||
ypos += 32;
|
ypos += 32;
|
||||||
|
|
||||||
setfontsize (18);
|
DrawText (125, ypos += 22, (char*)"VBA GX GameCube/Wii Port");
|
||||||
DrawText (-1, ypos += 30, (char*)"Technical");
|
DrawText (350, ypos, (char*)"Tantric");
|
||||||
|
DrawText (125, ypos += 18, (char*)"VBA GameCube Port Improvements");
|
||||||
|
DrawText (350, ypos, (char*)"emukidid");
|
||||||
|
DrawText (125, ypos += 18, (char*)"Original VBA GameCube Port");
|
||||||
|
DrawText (350, ypos, (char*)"SoftDev");
|
||||||
|
DrawText (125, ypos += 18, (char*)"Visual Boy Advance 1.7.2");
|
||||||
|
DrawText (350, ypos, (char*)"Forgotten");
|
||||||
|
DrawText (125, ypos += 18, (char*)"libogc");
|
||||||
|
DrawText (350, ypos, (char*)"Shagkur & wintermute");
|
||||||
|
DrawText (125, ypos += 18, (char*)"Testing");
|
||||||
|
DrawText (350, ypos, (char*)"tehskeen users");
|
||||||
|
|
||||||
setfontsize (14);
|
DrawText (-1, ypos += 36, (char*)"And many others who have contributed over the years!");
|
||||||
DrawText (-1, ypos += 22, (char*)"Snes9x v1.5.1 - Snes9x Team");
|
|
||||||
DrawText (-1, ypos += 18, (char*)"GameCube Port 2.0 WIP6 and earlier - SoftDev");
|
|
||||||
DrawText (-1, ypos += 18, (char*)"Additional improvements to 2.0 WIP6 - eke-eke");
|
|
||||||
DrawText (-1, ypos += 18, (char*)"GameCube 2.0.1bx enhancements - crunchy2");
|
|
||||||
DrawText (-1, ypos += 18, (char*)"v00x updates - michniewski & Tantric");
|
|
||||||
DrawText (-1, ypos += 18, (char*)"GX - http://www.gc-linux.org");
|
|
||||||
DrawText (-1, ypos += 18, (char*)"libogc - Shagkur & wintermute");
|
|
||||||
|
|
||||||
setfontsize (18);
|
|
||||||
DrawText (-1, ypos += 30, (char*)"Testing");
|
|
||||||
|
|
||||||
setfontsize (14);
|
|
||||||
DrawText (-1, ypos += 22, (char*)"crunchy2 / tehskeen users / others");
|
|
||||||
|
|
||||||
setfontsize (18);
|
|
||||||
DrawText (-1, ypos += 30, (char*)"Documentation");
|
|
||||||
|
|
||||||
setfontsize (14);
|
|
||||||
DrawText (-1, ypos += 22, (char*)"brakken, crunchy2, michniewski");
|
|
||||||
|
|
||||||
setfontsize (12);
|
setfontsize (12);
|
||||||
DrawText (-1, ypos += 50, (char*)"Snes9x - Copyright (c) Snes9x Team 1996 - 2006");
|
DrawText (-1, ypos += 50, (char*)"This software is open source and may be copied, distributed, or modified");
|
||||||
DrawText (-1, ypos += 15, (char*)"This software is open source and may be copied, distributed, or modified");
|
|
||||||
DrawText (-1, ypos += 15, (char*)"under the terms of the GNU General Public License (GPL) Version 2.");
|
DrawText (-1, ypos += 15, (char*)"under the terms of the GNU General Public License (GPL) Version 2.");
|
||||||
|
|
||||||
showscreen ();
|
showscreen ();
|
||||||
@ -447,7 +431,7 @@ DrawMenu (char items[][50], char *title, int maxitems, int selected, int fontsiz
|
|||||||
}
|
}
|
||||||
|
|
||||||
setfontsize (12);
|
setfontsize (12);
|
||||||
DrawText (510, screenheight - 20, VERSIONSTR);
|
DrawText (510, screenheight - 20, (char *)VERSIONSTR);
|
||||||
|
|
||||||
// Draw menu items
|
// Draw menu items
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ extern unsigned int wmpadmap[];
|
|||||||
extern unsigned int ccpadmap[];
|
extern unsigned int ccpadmap[];
|
||||||
extern unsigned int ncpadmap[];
|
extern unsigned int ncpadmap[];
|
||||||
|
|
||||||
#define PREFS_FILE_NAME "SNES9xGX.xml"
|
#define PREFS_FILE_NAME "VBAGX.xml"
|
||||||
|
|
||||||
char prefscomment[2][32];
|
char prefscomment[2][32];
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ preparePrefsData (int method)
|
|||||||
createXMLSetting("SaveMethod", "Save Method", toStr(GCSettings.SaveMethod));
|
createXMLSetting("SaveMethod", "Save Method", toStr(GCSettings.SaveMethod));
|
||||||
createXMLSetting("LoadFolder", "Load Folder", GCSettings.LoadFolder);
|
createXMLSetting("LoadFolder", "Load Folder", GCSettings.LoadFolder);
|
||||||
createXMLSetting("SaveFolder", "Save Folder", GCSettings.SaveFolder);
|
createXMLSetting("SaveFolder", "Save Folder", GCSettings.SaveFolder);
|
||||||
createXMLSetting("CheatFolder", "Cheats Folder", GCSettings.CheatFolder);
|
//createXMLSetting("CheatFolder", "Cheats Folder", GCSettings.CheatFolder);
|
||||||
createXMLSetting("VerifySaves", "Verify Memory Card Saves", toStr(GCSettings.VerifySaves));
|
createXMLSetting("VerifySaves", "Verify Memory Card Saves", toStr(GCSettings.VerifySaves));
|
||||||
|
|
||||||
createXMLSection("Network", "Network Settings");
|
createXMLSection("Network", "Network Settings");
|
||||||
@ -157,7 +157,7 @@ preparePrefsData (int method)
|
|||||||
createXMLSetting("smbuser", "Share Username", GCSettings.smbuser);
|
createXMLSetting("smbuser", "Share Username", GCSettings.smbuser);
|
||||||
createXMLSetting("smbpwd", "Share Password", GCSettings.smbpwd);
|
createXMLSetting("smbpwd", "Share Password", GCSettings.smbpwd);
|
||||||
|
|
||||||
createXMLSection("Emulation", "Emulation Settings");
|
//createXMLSection("Emulation", "Emulation Settings");
|
||||||
|
|
||||||
createXMLSection("Controller", "Controller Settings");
|
createXMLSection("Controller", "Controller Settings");
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "vbasupport.h"
|
#include "vbasupport.h"
|
||||||
|
#include "preferences.h"
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "dvd.h"
|
#include "dvd.h"
|
||||||
#include "smbop.h"
|
#include "smbop.h"
|
||||||
@ -48,15 +49,16 @@ int main()
|
|||||||
DI_Init(); // first
|
DI_Init(); // first
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int selectedMenu = -1;
|
// Initialise controllers
|
||||||
|
|
||||||
PAD_Init (); /*** Initialise pads for input ***/
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
WPAD_Init();
|
WPAD_Init();
|
||||||
// read wiimote accelerometer and IR data
|
// read wiimote accelerometer and IR data
|
||||||
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
||||||
WPAD_SetVRes(WPAD_CHAN_ALL,640,480);
|
WPAD_SetVRes(WPAD_CHAN_ALL,640,480);
|
||||||
#endif
|
#endif
|
||||||
|
PAD_Init ();
|
||||||
|
|
||||||
|
int selectedMenu = -1;
|
||||||
|
|
||||||
InitialiseVideo();
|
InitialiseVideo();
|
||||||
|
|
||||||
@ -85,9 +87,16 @@ int main()
|
|||||||
// Set defaults
|
// Set defaults
|
||||||
DefaultSettings ();
|
DefaultSettings ();
|
||||||
|
|
||||||
|
// Load preferences
|
||||||
|
if(!LoadPrefs())
|
||||||
|
{
|
||||||
|
WaitPrompt((char*) "Preferences reset - check settings!");
|
||||||
|
selectedMenu = 2; // change to preferences menu
|
||||||
|
}
|
||||||
|
|
||||||
while (ROMSize == 0)
|
while (ROMSize == 0)
|
||||||
{
|
{
|
||||||
mainmenu (selectedMenu);
|
MainMenu (selectedMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Main loop
|
//Main loop
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include <gccore.h>
|
#include <gccore.h>
|
||||||
|
|
||||||
#define VERSIONNUM "1.0.0"
|
#define VERSIONNUM "1.0.0"
|
||||||
#define VERSIONSTR "VBA 1.0.0"
|
#define VERSIONSTR "VBA GX 1.0.0"
|
||||||
|
|
||||||
#define NOTSILENT 0
|
#define NOTSILENT 0
|
||||||
#define SILENT 1
|
#define SILENT 1
|
||||||
|
@ -1,11 +1,18 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Visual Boy Advance 1.7.2 Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* Tantric September 2008
|
||||||
|
*
|
||||||
|
* vbasupport.cpp
|
||||||
|
*
|
||||||
|
* VBA support code
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
#include <gccore.h>
|
#include <gccore.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
#include "GBA.h"
|
#include "GBA.h"
|
||||||
#include "agbprint.h"
|
#include "agbprint.h"
|
||||||
#include "Flash.h"
|
#include "Flash.h"
|
||||||
@ -18,7 +25,8 @@
|
|||||||
#include "gb/GB.h"
|
#include "gb/GB.h"
|
||||||
#include "gb/gbGlobals.h"
|
#include "gb/gbGlobals.h"
|
||||||
|
|
||||||
|
#include "vba.h"
|
||||||
|
#include "fileop.h"
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "vmmem.h"
|
#include "vmmem.h"
|
||||||
#include "pal60.h"
|
#include "pal60.h"
|
||||||
@ -32,9 +40,22 @@ extern "C"
|
|||||||
#include "sdfileio.h"
|
#include "sdfileio.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static tb_t start, now;
|
||||||
* Globals
|
|
||||||
*/
|
u32 loadtimeradjust;
|
||||||
|
|
||||||
|
int throttle = 100;
|
||||||
|
u32 throttleLastTime = 0;
|
||||||
|
|
||||||
|
static u32 autoFrameSkipLastTime = 0;
|
||||||
|
static int frameskipadjust = 0;
|
||||||
|
|
||||||
|
int vAspect = 0;
|
||||||
|
int hAspect = 0;
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* VBA Globals
|
||||||
|
***************************************************************************/
|
||||||
int RGB_LOW_BITS_MASK=0x821;
|
int RGB_LOW_BITS_MASK=0x821;
|
||||||
int systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
|
int systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
|
||||||
|
|
||||||
@ -54,7 +75,6 @@ int destWidth = 0;
|
|||||||
int destHeight = 0;
|
int destHeight = 0;
|
||||||
int srcPitch = 0;
|
int srcPitch = 0;
|
||||||
int saveExists = 0;
|
int saveExists = 0;
|
||||||
|
|
||||||
int systemRedShift = 0;
|
int systemRedShift = 0;
|
||||||
int systemBlueShift = 0;
|
int systemBlueShift = 0;
|
||||||
int systemGreenShift = 0;
|
int systemGreenShift = 0;
|
||||||
@ -64,11 +84,6 @@ u16 systemColorMap16[0x10000];
|
|||||||
//u32 systemColorMap32[0x10000];
|
//u32 systemColorMap32[0x10000];
|
||||||
u32 *systemColorMap32 = (u32 *)&systemColorMap16;
|
u32 *systemColorMap32 = (u32 *)&systemColorMap16;
|
||||||
|
|
||||||
/*** 2D Video Globals ***/
|
|
||||||
extern u32 whichfb;
|
|
||||||
extern u32 *xfb[2];
|
|
||||||
extern GXRModeObj *vmode;
|
|
||||||
|
|
||||||
struct EmulatedSystem emulator =
|
struct EmulatedSystem emulator =
|
||||||
{
|
{
|
||||||
NULL,
|
NULL,
|
||||||
@ -87,28 +102,25 @@ struct EmulatedSystem emulator =
|
|||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
static tb_t start, now;
|
/****************************************************************************
|
||||||
|
* systemGetClock
|
||||||
u32 loadtimeradjust;
|
*
|
||||||
|
* Returns number of milliseconds since program start
|
||||||
int throttle = 100;
|
****************************************************************************/
|
||||||
u32 throttleLastTime = 0;
|
u32 systemGetClock( void )
|
||||||
|
|
||||||
int vAspect = 0;
|
|
||||||
int hAspect = 0;
|
|
||||||
|
|
||||||
//char filename[1024]; //rom file name
|
|
||||||
//char batfilename[1024]; //battery save file name
|
|
||||||
//char statename[1024]; //savestate file name
|
|
||||||
|
|
||||||
void debuggerOutput(char *, u32)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void (*dbgOutput)(char *, u32) = debuggerOutput;
|
|
||||||
|
|
||||||
void systemMessage(int num, const char *msg, ...)
|
|
||||||
{
|
{
|
||||||
/*** For now ... do nothing ***/
|
mftb(&now);
|
||||||
|
return tb_diff_msec(&now, &start) - loadtimeradjust;
|
||||||
|
}
|
||||||
|
|
||||||
|
void systemFrame() {}
|
||||||
|
void systemScreenCapture(int a) {}
|
||||||
|
void systemShowSpeed(int speed) {}
|
||||||
|
void systemGbBorderOn() {}
|
||||||
|
|
||||||
|
bool systemPauseOnFrame()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GC_Sleep(u32 dwMiliseconds)
|
void GC_Sleep(u32 dwMiliseconds)
|
||||||
@ -120,22 +132,6 @@ void GC_Sleep(u32 dwMiliseconds)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void systemFrame()
|
|
||||||
{}
|
|
||||||
|
|
||||||
void systemScreenCapture(int a)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void systemShowSpeed(int speed)
|
|
||||||
{}
|
|
||||||
static u32 autoFrameSkipLastTime = 0;
|
|
||||||
static int frameskipadjust = 0;
|
|
||||||
|
|
||||||
void write_save()
|
|
||||||
{
|
|
||||||
//emulator.emuWriteBattery(batfilename);
|
|
||||||
}
|
|
||||||
|
|
||||||
void system10Frames(int rate)
|
void system10Frames(int rate)
|
||||||
{
|
{
|
||||||
if ( cartridgeType == 1 )
|
if ( cartridgeType == 1 )
|
||||||
@ -177,81 +173,138 @@ void system10Frames(int rate)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( cartridgeType == 1 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
if(systemSaveUpdateCounter) {
|
|
||||||
char temp[512];
|
|
||||||
sprintf(temp,"Writing Save To Disk");
|
|
||||||
MENU_DrawString( -1, 450,temp , 1 );
|
|
||||||
} */
|
|
||||||
|
|
||||||
if(systemSaveUpdateCounter) {
|
|
||||||
if(--systemSaveUpdateCounter <= SYSTEM_SAVE_NOT_UPDATED) {
|
|
||||||
write_save();
|
|
||||||
systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
autoFrameSkipLastTime = time;
|
autoFrameSkipLastTime = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* System
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void systemGbPrint(u8 *data,int pages,int feed,int palette, int contrast) {}
|
||||||
|
void debuggerOutput(char *, u32) {}
|
||||||
|
void (*dbgOutput)(char *, u32) = debuggerOutput;
|
||||||
|
void systemMessage(int num, const char *msg, ...) {}
|
||||||
|
|
||||||
void systemUpdateMotionSensor()
|
/****************************************************************************
|
||||||
{}
|
* Saves
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
void systemGbBorderOn()
|
bool LoadBattery(int method, bool silent)
|
||||||
{}
|
{
|
||||||
|
char filepath[1024];
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
ShowAction ((char*) "Loading...");
|
||||||
|
|
||||||
|
if(method == METHOD_AUTO)
|
||||||
|
method = autoSaveMethod(); // we use 'Save' because we need R/W
|
||||||
|
|
||||||
|
if(method == METHOD_SD || method == METHOD_USB)
|
||||||
|
{
|
||||||
|
ChangeFATInterface(method, NOTSILENT);
|
||||||
|
sprintf (filepath, "%s/%s/%s.sav", ROOTFATDIR, GCSettings.SaveFolder, ROMFilename);
|
||||||
|
result = emulator.emuReadBattery(filepath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!result && !silent)
|
||||||
|
WaitPrompt ((char*) "Save file not found");
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SaveBattery(int method, bool silent)
|
||||||
|
{
|
||||||
|
char filepath[1024];
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
ShowAction ((char*) "Saving...");
|
||||||
|
|
||||||
|
if(method == METHOD_AUTO)
|
||||||
|
method = autoSaveMethod(); // we use 'Save' because we need R/W
|
||||||
|
|
||||||
|
if(method == METHOD_SD || method == METHOD_USB)
|
||||||
|
{
|
||||||
|
ChangeFATInterface(method, NOTSILENT);
|
||||||
|
sprintf (filepath, "%s/%s/%s.sav", ROOTFATDIR, GCSettings.SaveFolder, ROMFilename);
|
||||||
|
result = emulator.emuWriteBattery(filepath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!result && !silent)
|
||||||
|
WaitPrompt ((char*) "Save failed");
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LoadState(int method, bool silent)
|
||||||
|
{
|
||||||
|
char filepath[1024];
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
ShowAction ((char*) "Loading...");
|
||||||
|
|
||||||
|
if(method == METHOD_AUTO)
|
||||||
|
method = autoSaveMethod(); // we use 'Save' because we need R/W
|
||||||
|
|
||||||
|
if(method == METHOD_SD || method == METHOD_USB)
|
||||||
|
{
|
||||||
|
ChangeFATInterface(method, NOTSILENT);
|
||||||
|
sprintf (filepath, "%s/%s/%s.sgm", ROOTFATDIR, GCSettings.SaveFolder, ROMFilename);
|
||||||
|
result = emulator.emuReadState(filepath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!result && !silent)
|
||||||
|
WaitPrompt ((char*) "State file not found");
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SaveState(int method, bool silent)
|
||||||
|
{
|
||||||
|
char filepath[1024];
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
ShowAction ((char*) "Saving...");
|
||||||
|
|
||||||
|
if(method == METHOD_AUTO)
|
||||||
|
method = autoSaveMethod(); // we use 'Save' because we need R/W
|
||||||
|
|
||||||
|
if(method == METHOD_SD || method == METHOD_USB)
|
||||||
|
{
|
||||||
|
ChangeFATInterface(method, NOTSILENT);
|
||||||
|
sprintf (filepath, "%s/%s/%s.sgm", ROOTFATDIR, GCSettings.SaveFolder, ROMFilename);
|
||||||
|
result = emulator.emuWriteState(filepath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!result && !silent)
|
||||||
|
WaitPrompt ((char*) "Save failed");
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Sound
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
void systemWriteDataToSoundBuffer()
|
void systemWriteDataToSoundBuffer()
|
||||||
{
|
{
|
||||||
MIXER_AddSamples((u8 *)soundFinalWave, (cartridgeType == 1));
|
MIXER_AddSamples((u8 *)soundFinalWave, (cartridgeType == 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void systemSoundPause()
|
|
||||||
{}
|
|
||||||
|
|
||||||
void systemSoundResume()
|
|
||||||
{}
|
|
||||||
|
|
||||||
void systemSoundReset()
|
|
||||||
{}
|
|
||||||
|
|
||||||
void systemGbPrint(u8 *data,int pages,int feed,int palette, int contrast)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void systemSoundShutdown()
|
|
||||||
{}
|
|
||||||
|
|
||||||
bool systemSoundInit()
|
bool systemSoundInit()
|
||||||
{
|
{
|
||||||
//memset(soundbuffer, 0, 3200);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool systemPauseOnFrame()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int systemGetSensorX()
|
|
||||||
{
|
|
||||||
return sensorX;
|
|
||||||
}
|
|
||||||
|
|
||||||
int systemGetSensorY()
|
|
||||||
{
|
|
||||||
return sensorY;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool systemCanChangeSoundQuality()
|
bool systemCanChangeSoundQuality()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void systemSoundPause() {}
|
||||||
|
void systemSoundResume() {}
|
||||||
|
void systemSoundReset() {}
|
||||||
|
void systemSoundShutdown() {}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* systemReadJoypads
|
* systemReadJoypads
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -265,23 +318,12 @@ u32 systemReadJoypad(int which)
|
|||||||
return GetJoy();
|
return GetJoy();
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* systemGetClock
|
|
||||||
*
|
|
||||||
* Returns number of milliseconds since program start
|
|
||||||
****************************************************************************/
|
|
||||||
u32 systemGetClock( void )
|
|
||||||
{
|
|
||||||
mftb(&now);
|
|
||||||
return tb_diff_msec(&now, &start) - loadtimeradjust;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* systemDrawScreen
|
* systemDrawScreen
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void systemDrawScreen()
|
void systemDrawScreen()
|
||||||
{
|
{
|
||||||
/** GB / GBC Have oodles of time - so sync on VSync **/
|
// GB / GBC Have oodles of time - so sync on VSync
|
||||||
GX_Render( srcWidth, srcHeight, pix, srcPitch );
|
GX_Render( srcWidth, srcHeight, pix, srcPitch );
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
@ -294,67 +336,6 @@ void systemDrawScreen()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Checks to see if a previous SRAM/Flash save exists
|
|
||||||
If it does, it prompts the user to load it or not
|
|
||||||
*/
|
|
||||||
void checkSave() {
|
|
||||||
/* FILE* f = gen_fopen(statename, "rb");
|
|
||||||
if (f != NULL) {
|
|
||||||
gen_fclose(f);
|
|
||||||
whichfb^=1;
|
|
||||||
VIDEO_ClearFrameBuffer (vmode, xfb[whichfb], COLOR_BLACK);
|
|
||||||
//MENU_DrawString( 140, 50,"Quick Save State Exists" , 1 );
|
|
||||||
//MENU_DrawString( 140, 80,"Do you wish to load it?" , 1 );
|
|
||||||
//MENU_DrawString( -1, 170,"(L) or (+) YES" , 1 );
|
|
||||||
//MENU_DrawString( -1, 200,"(R) or (-) NO" , 1 );
|
|
||||||
VIDEO_WaitVSync ();
|
|
||||||
VIDEO_SetNextFramebuffer(xfb[whichfb]);
|
|
||||||
VIDEO_Flush();
|
|
||||||
VIDEO_WaitVSync();
|
|
||||||
while(1) {
|
|
||||||
WPADData *wpad;
|
|
||||||
WPAD_ScanPads();
|
|
||||||
wpad = WPAD_Data(0);
|
|
||||||
if (isWiimoteAvailable) {
|
|
||||||
unsigned short b = wpad->btns_h;
|
|
||||||
if(b & WPAD_BUTTON_PLUS) {
|
|
||||||
saveExists = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(b & WPAD_BUTTON_MINUS) break;
|
|
||||||
}
|
|
||||||
if (isClassicAvailable) {
|
|
||||||
unsigned short b = wpad->exp.classic.btns;
|
|
||||||
if(b & CLASSIC_CTRL_BUTTON_PLUS) {
|
|
||||||
saveExists = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(b & CLASSIC_CTRL_BUTTON_MINUS) break;
|
|
||||||
}
|
|
||||||
u16 buttons = PAD_ButtonsHeld(0);
|
|
||||||
if(buttons & PAD_TRIGGER_R){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(buttons & PAD_TRIGGER_L){
|
|
||||||
saveExists = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
VIDEO_ClearFrameBuffer (vmode, xfb[whichfb], COLOR_BLACK);
|
|
||||||
VIDEO_WaitVSync ();
|
|
||||||
VIDEO_SetNextFramebuffer(xfb[whichfb]);
|
|
||||||
VIDEO_Flush();
|
|
||||||
VIDEO_WaitVSync();
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void askSound() {
|
|
||||||
soundOffFlag = false;
|
|
||||||
soundLowPass = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int loadVBAROM(char filename[])
|
int loadVBAROM(char filename[])
|
||||||
{
|
{
|
||||||
cartridgeType = 0;
|
cartridgeType = 0;
|
||||||
@ -375,7 +356,7 @@ int loadVBAROM(char filename[])
|
|||||||
srcWidth = 240;
|
srcWidth = 240;
|
||||||
srcHeight = 160;
|
srcHeight = 160;
|
||||||
VMCPULoadROM(filename);
|
VMCPULoadROM(filename);
|
||||||
/* Actual Visual Aspect is 1.57 */
|
// Actual Visual Aspect is 1.57
|
||||||
hAspect = 70;
|
hAspect = 70;
|
||||||
vAspect = 46;
|
vAspect = 46;
|
||||||
srcPitch = 484;
|
srcPitch = 484;
|
||||||
@ -391,7 +372,7 @@ int loadVBAROM(char filename[])
|
|||||||
srcWidth = 160;
|
srcWidth = 160;
|
||||||
srcHeight = 144;
|
srcHeight = 144;
|
||||||
gbLoadRom(filename);
|
gbLoadRom(filename);
|
||||||
/* Actual physical aspect is 1.0 */
|
// Actual physical aspect is 1.0
|
||||||
hAspect = 60;
|
hAspect = 60;
|
||||||
vAspect = 46;
|
vAspect = 46;
|
||||||
srcPitch = 324;
|
srcPitch = 324;
|
||||||
@ -405,13 +386,14 @@ int loadVBAROM(char filename[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set defaults **/
|
// Set defaults
|
||||||
flashSetSize(0x10000);
|
flashSetSize(0x10000);
|
||||||
rtcEnable(true);
|
rtcEnable(true);
|
||||||
agbPrintEnable(false);
|
agbPrintEnable(false);
|
||||||
askSound();
|
soundOffFlag = false;
|
||||||
|
soundLowPass = true;
|
||||||
|
|
||||||
/** Setup GX **/
|
// Setup GX
|
||||||
GX_Render_Init( srcWidth, srcHeight, hAspect, vAspect );
|
GX_Render_Init( srcWidth, srcHeight, hAspect, vAspect );
|
||||||
|
|
||||||
if ( cartridgeType == 1 )
|
if ( cartridgeType == 1 )
|
||||||
@ -426,32 +408,42 @@ int loadVBAROM(char filename[])
|
|||||||
CPUReset();
|
CPUReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
// emulator.emuReadBattery(batfilename);
|
|
||||||
if (saveExists)
|
|
||||||
{
|
|
||||||
//emulator.emuReadState(statename);
|
|
||||||
saveExists = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
soundVolume = 0;
|
soundVolume = 0;
|
||||||
systemSoundOn = true;
|
systemSoundOn = true;
|
||||||
|
|
||||||
soundInit();
|
soundInit();
|
||||||
//AudioPlayer();
|
|
||||||
|
|
||||||
emulating = 1;
|
emulating = 1;
|
||||||
|
|
||||||
/** Start system clock **/
|
// Start system clock
|
||||||
mftb(&start);
|
mftb(&start);
|
||||||
|
|
||||||
//emulator.emuReset();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* EEPROM
|
||||||
|
****************************************************************************/
|
||||||
|
int systemGetSensorX()
|
||||||
|
{
|
||||||
|
return sensorX;
|
||||||
|
}
|
||||||
|
|
||||||
|
int systemGetSensorY()
|
||||||
|
{
|
||||||
|
return sensorY;
|
||||||
|
}
|
||||||
|
|
||||||
|
void systemUpdateMotionSensor() {}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Palette
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
void InitialisePalette()
|
void InitialisePalette()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
/** Build GBPalette **/
|
// Build GBPalette
|
||||||
for( i = 0; i < 24; )
|
for( i = 0; i < 24; )
|
||||||
{
|
{
|
||||||
systemGbPalette[i++] = (0x1f) | (0x1f << 5) | (0x1f << 10);
|
systemGbPalette[i++] = (0x1f) | (0x1f << 5) | (0x1f << 10);
|
||||||
@ -459,7 +451,7 @@ void InitialisePalette()
|
|||||||
systemGbPalette[i++] = (0x0c) | (0x0c << 5) | (0x0c << 10);
|
systemGbPalette[i++] = (0x0c) | (0x0c << 5) | (0x0c << 10);
|
||||||
systemGbPalette[i++] = 0;
|
systemGbPalette[i++] = 0;
|
||||||
}
|
}
|
||||||
/** Set palette etc - Fixed to RGB565 **/
|
// Set palette etc - Fixed to RGB565
|
||||||
systemColorDepth = 16;
|
systemColorDepth = 16;
|
||||||
systemRedShift = 11;
|
systemRedShift = 11;
|
||||||
systemGreenShift = 6;
|
systemGreenShift = 6;
|
||||||
|
@ -1,6 +1,20 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Visual Boy Advance 1.7.2 Nintendo Wii/Gamecube Port
|
||||||
|
*
|
||||||
|
* Tantric September 2008
|
||||||
|
*
|
||||||
|
* vbasupport.h
|
||||||
|
*
|
||||||
|
* VBA support code
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
#include "System.h"
|
#include "System.h"
|
||||||
|
|
||||||
extern struct EmulatedSystem emulator;
|
extern struct EmulatedSystem emulator;
|
||||||
extern u32 loadtimeradjust;
|
extern u32 loadtimeradjust;
|
||||||
int loadVBAROM(char filename[]);
|
int loadVBAROM(char filename[]);
|
||||||
void InitialisePalette();
|
void InitialisePalette();
|
||||||
|
bool LoadBattery(int method, bool silent);
|
||||||
|
bool SaveBattery(int method, bool silent);
|
||||||
|
bool LoadState(int method, bool silent);
|
||||||
|
bool SaveState(int method, bool silent);
|
||||||
|
Loading…
Reference in New Issue
Block a user