mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-25 12:06:53 +01:00
SMB/DVD/ZIP now mostly functional
This commit is contained in:
parent
9edc1f9b4b
commit
2522d87963
@ -23,6 +23,7 @@
|
||||
#include "menudraw.h"
|
||||
#include "filesel.h"
|
||||
#include "preferences.h"
|
||||
#include "sdfileio.h"
|
||||
|
||||
// temporary
|
||||
#include "vmmem.h"
|
||||
|
@ -321,7 +321,7 @@ int FileSelector (int method)
|
||||
dvddirlength = filelist[selection].length;
|
||||
}
|
||||
|
||||
ROMSize = loadVBAROM(method);
|
||||
ROMSize = LoadVBAROM(method);
|
||||
|
||||
if (ROMSize > 0)
|
||||
{
|
||||
|
@ -65,7 +65,6 @@ int main()
|
||||
int selectedMenu = -1;
|
||||
|
||||
InitialiseVideo();
|
||||
GX_Start();
|
||||
|
||||
// Initialise freetype font system
|
||||
if (FT_Init ())
|
||||
@ -78,7 +77,7 @@ int main()
|
||||
fatInitDefault();
|
||||
|
||||
// Initialize DVD subsystem (GameCube only)
|
||||
#ifndef HW_RVL
|
||||
#ifdef HW_DOL
|
||||
DVD_Init ();
|
||||
#endif
|
||||
|
||||
|
@ -342,7 +342,34 @@ void systemDrawScreen()
|
||||
#endif
|
||||
}
|
||||
|
||||
int loadVBAROM(int method)
|
||||
extern bool gbUpdateSizes();
|
||||
bool LoadGBROM()
|
||||
{
|
||||
char filepath[1024];
|
||||
sprintf(filepath, "%s/%s",currentdir,filelist[selection].filename);
|
||||
|
||||
int size = 0;
|
||||
|
||||
if(gbRom != NULL)
|
||||
{
|
||||
gbCleanUp();
|
||||
}
|
||||
|
||||
systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
|
||||
|
||||
gbRom = utilLoad(filepath,
|
||||
utilIsGBImage,
|
||||
NULL,
|
||||
size);
|
||||
if(!gbRom)
|
||||
return false;
|
||||
|
||||
gbRomSize = size;
|
||||
|
||||
return gbUpdateSizes();
|
||||
}
|
||||
|
||||
int LoadVBAROM(int method)
|
||||
{
|
||||
int type = 2;
|
||||
|
||||
@ -383,7 +410,7 @@ int loadVBAROM(int method)
|
||||
emulator = GBSystem;
|
||||
srcWidth = 160;
|
||||
srcHeight = 144;
|
||||
//gbLoadRom(filepath);
|
||||
LoadGBROM();
|
||||
// Actual physical aspect is 1.0
|
||||
hAspect = 60;
|
||||
vAspect = 46;
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
extern struct EmulatedSystem emulator;
|
||||
extern u32 loadtimeradjust;
|
||||
int loadVBAROM(int method);
|
||||
int LoadVBAROM(int method);
|
||||
void InitialisePalette();
|
||||
bool LoadBattery(int method, bool silent);
|
||||
bool SaveBattery(int method, bool silent);
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include "images/bg.h"
|
||||
#include "pal60.h"
|
||||
|
||||
extern unsigned int SMBTimer; // timer to reset SMB connection
|
||||
|
||||
/*** External 2D Video ***/
|
||||
/*** 2D Video Globals ***/
|
||||
GXRModeObj *vmode = NULL; // Graphics Mode Object
|
||||
@ -29,7 +31,7 @@ int screenheight;
|
||||
|
||||
/*** 3D GX ***/
|
||||
#define DEFAULT_FIFO_SIZE ( 256 * 1024 )
|
||||
static u8 *gp_fifo;
|
||||
static u8 gp_fifo[DEFAULT_FIFO_SIZE] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
/*** Texture memory ***/
|
||||
static u8 *texturemem = NULL;
|
||||
@ -71,43 +73,6 @@ static camera cam = { {0.0F, 0.0F, 0.0F},
|
||||
{0.0F, 0.0F, -0.5F}
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Initialise Video
|
||||
*
|
||||
* Before doing anything in libogc, it's recommended to configure a video
|
||||
* output.
|
||||
****************************************************************************/
|
||||
void InitialiseVideo ()
|
||||
{
|
||||
// Start VIDEO Subsystem
|
||||
VIDEO_Init();
|
||||
|
||||
vmode = VIDEO_GetPreferredMode(NULL);
|
||||
VIDEO_Configure(vmode);
|
||||
|
||||
screenheight = vmode->xfbHeight;
|
||||
|
||||
xfb[0] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
||||
xfb[1] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
||||
|
||||
VIDEO_SetNextFramebuffer(xfb[0]);
|
||||
VIDEO_SetBlack(FALSE);
|
||||
|
||||
// set timings in VI to PAL60
|
||||
/*u32 *vreg = (u32 *)0xCC002000;
|
||||
for (int i = 0; i < 64; i++ )
|
||||
vreg[i] = vpal60[i];*/
|
||||
|
||||
VIDEO_Flush();
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
if(vmode->viTVMode & VI_NON_INTERLACE)
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
VIDEO_SetPostRetraceCallback((VIRetraceCallback)UpdatePadsCB);
|
||||
VIDEO_SetNextFramebuffer(xfb[0]);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* StartGX
|
||||
****************************************************************************/
|
||||
@ -121,7 +86,7 @@ void GX_Start()
|
||||
memset(&gp_fifo, 0, DEFAULT_FIFO_SIZE);
|
||||
|
||||
/*** Initialise GX ***/
|
||||
GX_Init(gp_fifo, DEFAULT_FIFO_SIZE);
|
||||
GX_Init(&gp_fifo, DEFAULT_FIFO_SIZE);
|
||||
GX_SetCopyClear(gxbackground, 0x00ffffff);
|
||||
|
||||
GX_SetViewport(0, 0, vmode->fbWidth, vmode->efbHeight, 0, 1);
|
||||
@ -156,6 +121,44 @@ UpdatePadsCB ()
|
||||
PAD_ScanPads();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Initialise Video
|
||||
*
|
||||
* Before doing anything in libogc, it's recommended to configure a video
|
||||
* output.
|
||||
****************************************************************************/
|
||||
void InitialiseVideo ()
|
||||
{
|
||||
/*** Start VIDEO Subsystem ***/
|
||||
VIDEO_Init();
|
||||
|
||||
vmode = VIDEO_GetPreferredMode(NULL);
|
||||
VIDEO_Configure(vmode);
|
||||
|
||||
screenheight = vmode->xfbHeight;
|
||||
|
||||
xfb[0] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
||||
xfb[1] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
||||
|
||||
VIDEO_SetNextFramebuffer(xfb[0]);
|
||||
VIDEO_SetBlack(FALSE);
|
||||
|
||||
// set timings in VI to PAL60
|
||||
/*u32 *vreg = (u32 *)0xCC002000;
|
||||
for (int i = 0; i < 64; i++ )
|
||||
vreg[i] = vpal60[i];*/
|
||||
|
||||
VIDEO_Flush();
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
if(vmode->viTVMode&VI_NON_INTERLACE)
|
||||
VIDEO_WaitVSync();
|
||||
VIDEO_SetPostRetraceCallback((VIRetraceCallback)UpdatePadsCB);
|
||||
VIDEO_SetNextFramebuffer(xfb[0]);
|
||||
|
||||
GX_Start();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Scaler Support Functions
|
||||
****************************************************************************/
|
||||
@ -216,11 +219,12 @@ void GX_Render_Init(int width, int height, int haspect, int vaspect)
|
||||
|
||||
/*** Allocate 32byte aligned texture memory ***/
|
||||
texturesize = (width * height) * 2;
|
||||
|
||||
|
||||
if (texturemem)
|
||||
free(texturemem);
|
||||
|
||||
|
||||
texturemem = (u8 *) memalign(32, texturesize);
|
||||
|
||||
memset(texturemem, 0, texturesize);
|
||||
|
||||
/*** Setup for first call to scaler ***/
|
||||
@ -308,6 +312,8 @@ void GX_Render(int width, int height, u8 * buffer, int pitch)
|
||||
|
||||
VIDEO_SetNextFramebuffer(xfb[whichfb]);
|
||||
VIDEO_Flush();
|
||||
|
||||
SMBTimer++;
|
||||
}
|
||||
|
||||
|
||||
@ -327,8 +333,8 @@ clearscreen (int c)
|
||||
void
|
||||
showscreen ()
|
||||
{
|
||||
copynow = GX_FALSE;
|
||||
VIDEO_SetNextFramebuffer (xfb[whichfb]);
|
||||
VIDEO_Flush ();
|
||||
VIDEO_WaitVSync ();
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "fileop.h"
|
||||
#include "dvd.h"
|
||||
#include "menudraw.h"
|
||||
#include "filesel.h"
|
||||
|
||||
extern "C" {
|
||||
#include "tbtime.h"
|
||||
@ -39,9 +40,7 @@ extern "C" {
|
||||
unsigned int MEM2Storage = 0x91000000;
|
||||
|
||||
static char *gbabase = NULL;
|
||||
static FILE *romfile = NULL;
|
||||
static u32 GBAROMSize = 0;
|
||||
//static char romfilename[1024];
|
||||
|
||||
/**
|
||||
* GBA Memory
|
||||
@ -92,12 +91,7 @@ static void VMClose( void )
|
||||
if ( gbabase != NULL )
|
||||
free(gbabase);
|
||||
|
||||
if ( romfile != NULL )
|
||||
gen_fclose(romfile);
|
||||
|
||||
gbabase = NULL;
|
||||
romfile = NULL;
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -108,10 +102,8 @@ static void VMClose( void )
|
||||
|
||||
int VMCPULoadROM(int method)
|
||||
{
|
||||
int res=0;
|
||||
VMClose();
|
||||
VMAllocGBA();
|
||||
|
||||
GBAROMSize = 0;
|
||||
rom = (u8 *)MEM2Storage;
|
||||
|
||||
@ -122,24 +114,24 @@ int VMCPULoadROM(int method)
|
||||
{
|
||||
case METHOD_SD:
|
||||
case METHOD_USB:
|
||||
res = LoadFATFile ((char *)rom);
|
||||
GBAROMSize = LoadFATFile ((char *)rom);
|
||||
break;
|
||||
|
||||
case METHOD_DVD:
|
||||
res = LoadDVDFile ((unsigned char *)rom);
|
||||
GBAROMSize = LoadDVDFile ((unsigned char *)rom);
|
||||
break;
|
||||
|
||||
case METHOD_SMB:
|
||||
res = LoadSMBFile ((char *)rom);
|
||||
GBAROMSize = LoadSMBFile ((char *)rom);
|
||||
break;
|
||||
}
|
||||
|
||||
if(res)
|
||||
if(GBAROMSize)
|
||||
CPUUpdateRenderBuffers( true );
|
||||
else
|
||||
VMClose();
|
||||
|
||||
return res;
|
||||
return GBAROMSize;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user