mirror of
https://github.com/dborth/fceugx.git
synced 2024-10-31 22:45:05 +01:00
-Fixes to get compile in GC & Wii
-Rearrange of some functions
This commit is contained in:
parent
6f1dea5b2d
commit
8cdf9df10c
@ -19,7 +19,6 @@ static int whichab = 0; /*** Which Audio Buffer is in use ***/
|
||||
static int isPlaying; /*** Is Playing ***/
|
||||
static void AudioSwitchBuffers()
|
||||
{
|
||||
|
||||
if ( buffSize[whichab] ) {
|
||||
AUDIO_StopDMA();
|
||||
AUDIO_InitDMA((u32)audiobuffer[whichab], buffSize[whichab]);
|
||||
@ -34,13 +33,8 @@ static void AudioSwitchBuffers()
|
||||
|
||||
void InitialiseSound()
|
||||
{
|
||||
|
||||
AUDIO_Init(NULL); /*** Start audio subsystem ***/
|
||||
|
||||
/*** Set default samplerate to 48khz ***/
|
||||
AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ);
|
||||
|
||||
/*** and the DMA Callback ***/
|
||||
AUDIO_RegisterDMACallback( AudioSwitchBuffers );
|
||||
|
||||
buffSize[0] = buffSize[1] = 0;
|
||||
|
@ -12,19 +12,27 @@
|
||||
#include <string.h>
|
||||
#include <gctypes.h>
|
||||
#include <sys/dir.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "gcdvd.h"
|
||||
#include "iplfont.h"
|
||||
|
||||
#ifdef __gamecube__
|
||||
#include "sz.h"
|
||||
#endif
|
||||
|
||||
FILE *filehandle = NULL;
|
||||
|
||||
#define MAXFILES 1000
|
||||
// From libfat MAX_FILENAME_LENGTH
|
||||
#define MAX_PATH_LEN 768
|
||||
typedef struct {
|
||||
/*typedef struct {
|
||||
char filename[MAX_PATH_LEN+1];
|
||||
u64 offset;
|
||||
unsigned int length;
|
||||
char flags;
|
||||
}FILEENTRIES;
|
||||
}FILEENTRIES;*/
|
||||
|
||||
/*** Simplified Directory Entry Record
|
||||
I only care about a couple of values ***/
|
||||
@ -52,10 +60,13 @@ volatile long *dvd=(volatile long *)0xCC006000;
|
||||
extern void SendDriveCode( int model );
|
||||
extern int font_height;
|
||||
extern bool isZipFile();
|
||||
extern void writex(int x, int y, int sx, int sy, char *string, unsigned int selected);
|
||||
extern int unzipDVDFile(unsigned char *outbuffer, unsigned int discoffset, unsigned int length);
|
||||
//extern void writex(int x, int y, int sx, int sy, char *string, unsigned int selected);
|
||||
extern unsigned char *nesromptr;
|
||||
extern int IsXenoGCImage( char *buffer );
|
||||
|
||||
int LoadDVDFile( unsigned char *buffer );
|
||||
|
||||
void GetSDInfo ();
|
||||
extern u8 ChosenSlot;
|
||||
|
||||
@ -66,9 +77,7 @@ u8 UseSDCARD = 0;
|
||||
u8 UseWiiSDCARD = 0;
|
||||
|
||||
char rootSDdir[MAX_PATH_LEN];
|
||||
char rootWiiSDdir[MAX_PATH_LEN];
|
||||
int haveSDdir = 0;
|
||||
int haveWiiSDdir = 0;
|
||||
int sdslot = 0;
|
||||
|
||||
/****************************************************************************
|
||||
@ -426,6 +435,33 @@ int parsedir() {
|
||||
}
|
||||
#endif
|
||||
|
||||
/***************************************************************************
|
||||
* FileSortCallback
|
||||
*
|
||||
* Quick sort callback to sort file entries with the following order:
|
||||
* .
|
||||
* ..
|
||||
* <dirs>
|
||||
* <files>
|
||||
***************************************************************************/
|
||||
static int FileSortCallback(const void *f1, const void *f2)
|
||||
{
|
||||
/* Special case for implicit directories */
|
||||
if(((FILEENTRIES *)f1)->filename[0] == '.' || ((FILEENTRIES *)f2)->filename[0] == '.')
|
||||
{
|
||||
if(strcmp(((FILEENTRIES *)f1)->filename, ".") == 0) { return -1; }
|
||||
if(strcmp(((FILEENTRIES *)f2)->filename, ".") == 0) { return 1; }
|
||||
if(strcmp(((FILEENTRIES *)f1)->filename, "..") == 0) { return -1; }
|
||||
if(strcmp(((FILEENTRIES *)f2)->filename, "..") == 0) { return 1; }
|
||||
}
|
||||
|
||||
/* If one is a file and one is a directory the directory is first. */
|
||||
if(((FILEENTRIES *)f1)->flags == 1 && ((FILEENTRIES *)f2)->flags == 0) return -1;
|
||||
if(((FILEENTRIES *)f1)->flags == 0 && ((FILEENTRIES *)f2)->flags == 1) return 1;
|
||||
|
||||
return stricmp(((FILEENTRIES *)f1)->filename, ((FILEENTRIES *)f2)->filename);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Update SDCARD curent directory name
|
||||
***************************************************************************/
|
||||
@ -467,7 +503,7 @@ int updateSDdirname() {
|
||||
sprintf(rootSDdir,"fat:/");
|
||||
|
||||
/* update current directory name */
|
||||
sprintf(rootSDdir, "%s\\%s",rootSDdir, filelist[selection].filename);
|
||||
sprintf(rootSDdir, "%s/%s",rootSDdir, filelist[selection].filename);
|
||||
return 1;
|
||||
} else {
|
||||
WaitPrompt ("Dirname is too long !");
|
||||
@ -494,7 +530,6 @@ int parseSDdirectory() {
|
||||
if (sddir == NULL) {
|
||||
strcpy(rootSDdir, "fat:/");
|
||||
sddir = diropen(rootSDdir);
|
||||
WaitPrompt(msg);
|
||||
if (sddir == NULL) {
|
||||
sprintf(msg, "Error opening %s", rootSDdir);
|
||||
WaitPrompt(msg);
|
||||
@ -508,16 +543,15 @@ int parseSDdirectory() {
|
||||
strncpy(filelist[numstored].filename, filename, MAX_PATH_LEN);
|
||||
filelist[numstored].length = filestat.st_size;
|
||||
filelist[numstored].flags = (filestat.st_mode & S_IFDIR) ? 1 : 0;
|
||||
sprintf(msg, "Found #%d: %s", numstored, filename);
|
||||
ShowAction(msg);
|
||||
numstored++;
|
||||
}
|
||||
}
|
||||
|
||||
dirclose(sddir);
|
||||
sprintf(msg, "Found %d items.", numstored);
|
||||
WaitPrompt(msg);
|
||||
_break();
|
||||
|
||||
/* Sort the file list */
|
||||
qsort(filelist, numstored, sizeof(FILEENTRIES), FileSortCallback);
|
||||
|
||||
return numstored;
|
||||
}
|
||||
|
||||
@ -545,8 +579,6 @@ void ShowFiles( int offset, int selection ) {
|
||||
char dir[1024];
|
||||
if (UseSDCARD)
|
||||
strcpy(dir, rootSDdir);
|
||||
else if (UseWiiSDCARD)
|
||||
strcpy(dir, rootWiiSDdir);
|
||||
else
|
||||
dir[0] = 0;
|
||||
|
||||
@ -623,16 +655,15 @@ void FileSelector() {
|
||||
}
|
||||
|
||||
if ( p & PAD_BUTTON_A ) {
|
||||
_break();
|
||||
|
||||
if ( filelist[selection].flags ) { /*** This is directory ***/
|
||||
if (UseSDCARD) {
|
||||
//if ( filelist[selection].filename[0] == 0x2e) {
|
||||
/* update current directory and set new entry list if directory has changed */
|
||||
int status = updateSDdirname();
|
||||
if (status == 1) {
|
||||
maxfiles = parseSDdirectory();
|
||||
if (!maxfiles) {
|
||||
WaitPrompt ("Error reading directory !");
|
||||
WaitPrompt ((char*)"Error reading directory !");
|
||||
haverom = 1; // quit SD menu
|
||||
haveSDdir = 0; // reset everything at next access
|
||||
}
|
||||
@ -640,23 +671,27 @@ _break();
|
||||
haverom = 1; // quit SD menu
|
||||
haveSDdir = 0; // reset everything at next access
|
||||
}
|
||||
|
||||
}
|
||||
#ifdef __gamecube__
|
||||
} else { // DVD
|
||||
else { // DVD
|
||||
rootdir = filelist[selection].offset;
|
||||
rootdirlength = filelist[selection].length;
|
||||
offset = selection = 0;
|
||||
maxfiles = parsedir();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifdef __gamecube__
|
||||
} else if (selection == 0 && inSz == true) {
|
||||
else if (selection == 0 && inSz == true) {
|
||||
rootdir = filelist[1].offset;
|
||||
rootdirlength = filelist[1].length;
|
||||
offset = 0;
|
||||
maxfiles = parsedir();
|
||||
inSz = false;
|
||||
SzClose();
|
||||
} else if (inSz == false && SzDvdIsArchive(filelist[selection].offset) == SZ_OK) {
|
||||
}
|
||||
else if (inSz == false && SzDvdIsArchive(filelist[selection].offset) == SZ_OK) {
|
||||
// parse the 7zip file
|
||||
ShowAction("Found 7z");
|
||||
SzParse();
|
||||
@ -666,7 +701,8 @@ _break();
|
||||
} else {
|
||||
SzDisplayError(SzRes);
|
||||
}
|
||||
} else if (inSz == true) {
|
||||
}
|
||||
else if (inSz == true) {
|
||||
// extract the selected ROM from the 7zip file to the buffer
|
||||
if(SzExtractROM(filelist[selection].offset, nesromptr) == true) {
|
||||
haverom = 1;
|
||||
@ -678,8 +714,9 @@ _break();
|
||||
offset = selection = 0;
|
||||
maxfiles = parsedir();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
else {
|
||||
rootdir = filelist[selection].offset;
|
||||
rootdirlength = filelist[selection].length;
|
||||
// Now load the DVD file to it's offset
|
||||
@ -699,39 +736,25 @@ int LoadDVDFile( unsigned char *buffer ) {
|
||||
int blocks;
|
||||
int i;
|
||||
u64 discoffset;
|
||||
char fname[MAX_PATH_LEN];
|
||||
|
||||
/*** SDCard Addition ***/
|
||||
if (UseSDCARD) GetSDInfo();
|
||||
if (rootdirlength == 0) return 0;
|
||||
|
||||
/* Check filename length */
|
||||
if ((strlen(rootSDdir)+1+strlen(filelist[selection].filename)) < MAX_PATH_LEN)
|
||||
sprintf(fname, "%s/%s",rootSDdir,filelist[selection].filename);
|
||||
else {
|
||||
WaitPrompt ("Maximum Filename Length reached !");
|
||||
haveSDdir = 0; // reset everything before next access
|
||||
}
|
||||
|
||||
filehandle = fopen(fname, "rb");
|
||||
if (filehandle == NULL) {
|
||||
WaitPrompt ("Unable to open file!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*** How many 2k blocks to read ***/
|
||||
blocks = rootdirlength / 2048;
|
||||
offset = 0;
|
||||
discoffset = rootdir;
|
||||
|
||||
ShowAction("Loading ... Wait");
|
||||
if (UseSDCARD) fread(&readbuffer, 2048, 1, filehandle);
|
||||
if (UseSDCARD) fread(&readbuffer, 1, 2048, filehandle);
|
||||
else dvd_read(&readbuffer, 2048, discoffset);
|
||||
|
||||
if (isZipFile() == false) {
|
||||
if (UseSDCARD) fseek(filehandle, 0, SEEK_SET);
|
||||
|
||||
for ( i = 0; i < blocks; i++ ) {
|
||||
if (UseSDCARD) fread(&readbuffer, 2048, 1, filehandle);
|
||||
if (UseSDCARD) fread(&readbuffer, 1, 2048, filehandle);
|
||||
else dvd_read(&readbuffer, 2048, discoffset);
|
||||
memcpy(&buffer[offset], &readbuffer, 2048);
|
||||
offset += 2048;
|
||||
@ -741,7 +764,7 @@ int LoadDVDFile( unsigned char *buffer ) {
|
||||
/*** And final cleanup ***/
|
||||
if( rootdirlength % 2048 ) {
|
||||
i = rootdirlength % 2048;
|
||||
if (UseSDCARD) fread(&readbuffer, i, 1, filehandle);
|
||||
if (UseSDCARD) fread(&readbuffer, 1, i, filehandle);
|
||||
else dvd_read(&readbuffer, 2048, discoffset);
|
||||
memcpy(&buffer[offset], &readbuffer, i);
|
||||
}
|
||||
@ -769,12 +792,12 @@ int OpenDVD() {
|
||||
|
||||
// Mount the DVD if necessary
|
||||
if (!IsPVD()) {
|
||||
ShowAction("Mounting DVD");
|
||||
ShowAction((char*)"Mounting DVD");
|
||||
DVD_Mount();
|
||||
ShowAction("Done Mounting");
|
||||
ShowAction((char*)"Done Mounting");
|
||||
haveDVDdir = 0;
|
||||
if (!IsPVD()) {
|
||||
WaitPrompt("No vallid ISO9660 DVD");
|
||||
WaitPrompt((char*)"No vallid ISO9660 DVD");
|
||||
return 0; // No correct ISO9660 DVD
|
||||
}
|
||||
}
|
||||
@ -813,11 +836,11 @@ int OpenSD() {
|
||||
sprintf(rootSDdir,"/%s/%s", FCEUDIR, ROMSDIR);
|
||||
/* Parse initial root directory and get entries list */
|
||||
ShowAction("Reading Directory ...");
|
||||
//_break();
|
||||
|
||||
maxfiles = parseSDdirectory();
|
||||
if (maxfiles) {
|
||||
sprintf (msg, "Found %d entries", maxfiles);
|
||||
WaitPrompt(msg);
|
||||
//sprintf (msg, "Found %d entries", maxfiles);
|
||||
//WaitPrompt(msg);
|
||||
/* Select an entry */
|
||||
FileSelector();
|
||||
|
||||
@ -840,17 +863,26 @@ int OpenSD() {
|
||||
* SDCard Get Info
|
||||
****************************************************************************/
|
||||
void GetSDInfo () {
|
||||
char fname[MAX_PATH_LEN];
|
||||
struct stat fstat;
|
||||
DIR_ITER *dir;
|
||||
|
||||
char fname[MAXPATHLEN];
|
||||
rootdirlength = 0;
|
||||
dir = diropen(rootSDdir);
|
||||
if (dir != NULL) {
|
||||
while(dirnext(dir, fname, &fstat) == 0) {
|
||||
if (strcmp(fname, filelist[selection].filename) == 0)
|
||||
rootdirlength = fstat.st_size;
|
||||
}
|
||||
dirclose(dir);
|
||||
|
||||
/* Check filename length */
|
||||
if ((strlen(rootSDdir)+1+strlen(filelist[selection].filename)) < MAXPATHLEN)
|
||||
sprintf(fname, "%s/%s",rootSDdir,filelist[selection].filename);
|
||||
|
||||
else
|
||||
{
|
||||
WaitPrompt ((char*)"Maximum Filename Length reached !");
|
||||
haveSDdir = 0; // reset everything before next access
|
||||
}
|
||||
|
||||
filehandle = fopen(fname, "rb");
|
||||
if (filehandle == NULL)
|
||||
{
|
||||
WaitPrompt ((char*)"Unable to open file!");
|
||||
return;
|
||||
}
|
||||
fseek(filehandle, 0, SEEK_END);
|
||||
rootdirlength = ftell(filehandle);
|
||||
fseek(filehandle, 0, SEEK_SET);
|
||||
}
|
||||
|
13
source/drivers/gamecube/gcdvd.h
Normal file
13
source/drivers/gamecube/gcdvd.h
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
#define MAXJOLIET 256
|
||||
#define MAXFILES 1000
|
||||
|
||||
typedef struct {
|
||||
char filename[MAXJOLIET];
|
||||
char sdcardpath[256];
|
||||
u64 offset;
|
||||
unsigned int length;
|
||||
char flags;
|
||||
}FILEENTRIES;
|
||||
|
||||
extern FILEENTRIES filelist[MAXFILES];
|
@ -6,8 +6,10 @@
|
||||
|
||||
#include <gccore.h>
|
||||
#include <ogcsys.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "../../iplfont/iplfont.h"
|
||||
#include "iplfont.h"
|
||||
#include "nesback.h"
|
||||
#include "intl.h"
|
||||
|
||||
@ -43,79 +45,6 @@ int whichfb = 0;
|
||||
extern int font_height;
|
||||
int copynow = GX_FALSE;
|
||||
|
||||
extern int font_width;
|
||||
|
||||
int GetTextWidth(char *text) {
|
||||
unsigned int i, w = 0;
|
||||
|
||||
for (i = 0; i < strlen(text); i++)
|
||||
w += font_width;
|
||||
return w;
|
||||
}
|
||||
|
||||
int CentreTextPosition(char *text) {
|
||||
return ((640 - GetTextWidth(text)) >> 1);
|
||||
}
|
||||
|
||||
void WriteCentre(int y, char *text) {
|
||||
write_font(CentreTextPosition(text), y, text);
|
||||
}
|
||||
|
||||
void WaitPrompt(char *msg) {
|
||||
int quit = 0;
|
||||
|
||||
while (PAD_ButtonsDown(0) & PAD_BUTTON_A) {} ;
|
||||
while(!(PAD_ButtonsDown(0) & PAD_BUTTON_A) && (quit == 0)) {
|
||||
ClearScreen();
|
||||
WriteCentre(220, msg);
|
||||
WriteCentre(220 + font_height, MENU_PRESS_A);
|
||||
|
||||
if (PAD_ButtonsDown(0) & PAD_BUTTON_A)
|
||||
quit = 1;
|
||||
|
||||
SetScreen();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for user to press A or B. Returns 0 = B; 1 = A
|
||||
*/
|
||||
int WaitButtonAB() {
|
||||
int btns;
|
||||
|
||||
while ((PAD_ButtonsDown (0) & (PAD_BUTTON_A | PAD_BUTTON_B)));
|
||||
while (1) {
|
||||
btns = PAD_ButtonsDown (0);
|
||||
if (btns & PAD_BUTTON_A)
|
||||
return 1;
|
||||
else if (btns & PAD_BUTTON_B)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a prompt with choice of two options. Returns 1 if A button was pressed
|
||||
and 0 if B button was pressed.
|
||||
*/
|
||||
int WaitPromptChoice(char *msg, char *bmsg, char *amsg) {
|
||||
char choiceOption[80];
|
||||
sprintf (choiceOption, "B = %s : A = %s", bmsg, amsg);
|
||||
|
||||
ClearScreen ();
|
||||
WriteCentre(220, msg);
|
||||
WriteCentre(220 + font_height, choiceOption);
|
||||
SetScreen ();
|
||||
|
||||
return WaitButtonAB ();
|
||||
}
|
||||
|
||||
void ShowAction(char *msg) {
|
||||
memcpy (xfb[whichfb], &backdrop, 1280 * 480);
|
||||
/*ClearScreen();*/
|
||||
WriteCentre(220 + (font_height >> 1), msg);
|
||||
SetScreen();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* GX Chip Copy to XFB
|
||||
****************************************************************************/
|
||||
|
@ -88,8 +88,7 @@ bool isZipFile() {
|
||||
*
|
||||
* Unzip terminates on Z_END_STREAM.
|
||||
***************************************************************************/
|
||||
int unzipDVDFile(unsigned char *outbuffer,
|
||||
unsigned int discoffset, unsigned int length) {
|
||||
int unzipDVDFile(unsigned char *outbuffer, unsigned int discoffset, unsigned int length) {
|
||||
PKZIPHEADER pkzip;
|
||||
int zipoffset = 0;
|
||||
int zipchunk = 0;
|
||||
|
@ -8,13 +8,13 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "iplfont/iplfont.h"
|
||||
#include "iplfont.h"
|
||||
#include "intl.h"
|
||||
|
||||
#define MARGIN 0
|
||||
|
||||
#define JOY_UP 0x10
|
||||
#define JOY_DOWN 0x20
|
||||
#define JOY_UP 0x10
|
||||
#define JOY_DOWN 0x20
|
||||
|
||||
u8 currpal = 0;
|
||||
u8 timing = 0;
|
||||
@ -30,9 +30,18 @@ extern void ManageSettings(int mode, int slot, int device, int quiet);
|
||||
extern void StartGX();
|
||||
extern void scroller(int y, unsigned char text[][512], int nlines);
|
||||
extern void FCEUI_DisableFourScore(int a);
|
||||
extern void FCEUI_SetVidSystem(int a);
|
||||
extern unsigned char DecodeJoy( unsigned short pp );
|
||||
extern unsigned char GetAnalog(int Joy);
|
||||
|
||||
extern void dvd_motor_off();
|
||||
extern void uselessinquiry();
|
||||
extern int OpenDVD();
|
||||
extern int OpenSD();
|
||||
|
||||
extern void ResetNES(void);
|
||||
extern int GCMemROM();
|
||||
|
||||
extern signed int CARDSLOT;
|
||||
extern u8 PADCAL;
|
||||
extern u8 PADTUR;
|
||||
@ -289,21 +298,6 @@ extern int font_size[256];
|
||||
extern int font_height;
|
||||
extern u8 screenscaler;
|
||||
|
||||
/****************************************************************************
|
||||
* SetScreen
|
||||
****************************************************************************/
|
||||
void SetScreen() {
|
||||
VIDEO_SetNextFramebuffer( xfb[whichfb] );
|
||||
VIDEO_Flush();
|
||||
VIDEO_WaitVSync();
|
||||
}
|
||||
|
||||
void ClearScreen() {
|
||||
whichfb ^= 1;
|
||||
/*VIDEO_ClearFrameBuffer(vmode, xfb[whichfb], 0x258e2573);*/
|
||||
memcpy (xfb[whichfb], &backdrop, 1280 * 480);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Configuration Menu
|
||||
*
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <gctypes.h>
|
||||
#include <ogc/system.h>
|
||||
#include <fat.h>
|
||||
#include "../../types.h"
|
||||
#include "common.h"
|
||||
|
||||
@ -75,7 +76,6 @@ int main(int argc, char *argv[]) {
|
||||
DVD_Init();
|
||||
dvd_inquiry();
|
||||
#endif
|
||||
DEBUG_Init(0, 1);
|
||||
|
||||
/*** Minimal Emulation Loop ***/
|
||||
if ( !FCEUI_Initialize() ) {
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "../../types.h"
|
||||
#include "../../state.h"
|
||||
#include "saveicon.h"
|
||||
#include "iplfont.h"
|
||||
#include "intl.h"
|
||||
|
||||
#define FCEUDIR "fceu"
|
||||
@ -403,7 +404,7 @@ void MC_ManageState(int mode, int slot) {
|
||||
|
||||
CardError = CARD_Close(&CardFile);
|
||||
sprintf(debug, "Saved %d bytes successfully!", savedBytes);
|
||||
ShowAction(debug);
|
||||
WaitPrompt(debug);
|
||||
} else {
|
||||
WaitPrompt("Save Failed");
|
||||
}
|
||||
@ -451,7 +452,7 @@ void MC_ManageState(int mode, int slot) {
|
||||
|
||||
CARD_Unmount(CARDSLOT);
|
||||
sprintf(debug, "Loaded %d bytes successfully!", savedBytes);
|
||||
ShowAction(debug);
|
||||
WaitPrompt(debug);
|
||||
}
|
||||
break; /*** End load ***/
|
||||
|
||||
@ -488,11 +489,11 @@ void SD_ManageState(int mode, int slot) {
|
||||
len = fwrite(statebuffer, filesize, 1, handle);
|
||||
fclose(handle);
|
||||
|
||||
if (len != filesize){
|
||||
/*if (len != filesize){
|
||||
sprintf (msg, "Error writing %s", path);
|
||||
WaitPrompt (msg);
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
sprintf (msg, "Saved %d bytes successfully", filesize);
|
||||
WaitPrompt (msg);
|
||||
@ -503,7 +504,7 @@ void SD_ManageState(int mode, int slot) {
|
||||
fclose(handle);
|
||||
|
||||
sprintf (msg, "Loaded %d bytes successfully", offset);
|
||||
ShowAction(msg);
|
||||
WaitPrompt(msg);
|
||||
|
||||
GCFCEUSS_Load();
|
||||
return;
|
||||
|
@ -7,20 +7,24 @@
|
||||
****************************************************************************/
|
||||
#ifdef HW_DOL // only do 7zip in Gamecube mode for now...
|
||||
|
||||
#include "iplfont.h"
|
||||
#include "sz.h"
|
||||
#include "gcdvd.h"
|
||||
|
||||
extern u8 UseSDCARD;
|
||||
extern u8 UseWiiSDCARD;
|
||||
extern sd_file *filehandle;
|
||||
extern FILE *filehandle;
|
||||
extern void GetSDInfo();
|
||||
|
||||
// 7zip error list
|
||||
char szerrormsg[][30] = {"7z: Data error",
|
||||
char szerrormsg[][30] = {
|
||||
"7z: Data error",
|
||||
"7z: Out of memory",
|
||||
"7z: CRC Error",
|
||||
"7z: Not implemented",
|
||||
"7z: Fail",
|
||||
"7z: Archive error"};
|
||||
|
||||
"7z: Archive error"
|
||||
};
|
||||
|
||||
SZ_RESULT SzRes;
|
||||
|
||||
@ -36,7 +40,7 @@ CFileItem *SzF;
|
||||
char sz_buffer[2048];
|
||||
|
||||
// needed because there are no header files -.-
|
||||
#include <sdcard.h>
|
||||
//#include <sdcard.h>
|
||||
#define MAXFILES 1000
|
||||
#define MAXJOLIET 256
|
||||
|
||||
@ -68,8 +72,9 @@ int dvd_buffered_read(void *dst, u32 len, u64 offset) {
|
||||
if (UseSDCARD) {
|
||||
if (filehandle == NULL)
|
||||
GetSDInfo();
|
||||
SDCARD_SeekFile(filehandle, offset, SDCARD_SEEK_SET);
|
||||
SDCARD_ReadFile(filehandle, &dvdsf_buffer, len);
|
||||
|
||||
fseek(filehandle, offset, SEEK_SET);
|
||||
fread(&dvdsf_buffer, len, 1, filehandle);
|
||||
} else if (!UseWiiSDCARD)
|
||||
ret = dvd_read(&dvdsf_buffer, len, offset);
|
||||
dvdsf_last_offset = offset;
|
||||
@ -218,14 +223,14 @@ SZ_RESULT SzDvdIsArchive(u64 dvd_offset) {
|
||||
// read the data from the DVD
|
||||
int res = dvd_safe_read (&Candidate, 6, dvd_offset);
|
||||
char msg[1024];
|
||||
sprintf(msg, "7zSig: %02X %02X %02X %02X %02X %02X",
|
||||
/*sprintf(msg, "7zSig: %02X %02X %02X %02X %02X %02X",
|
||||
Candidate[0],
|
||||
Candidate[1],
|
||||
Candidate[2],
|
||||
Candidate[3],
|
||||
Candidate[4],
|
||||
Candidate[5]);
|
||||
WaitPrompt(msg);
|
||||
WaitPrompt(msg);*/
|
||||
|
||||
size_t i;
|
||||
for(i = 0; i < 6; i++) {
|
||||
@ -336,7 +341,7 @@ bool SzExtractROM(int i, unsigned char *buffer)
|
||||
SzOffset = 0;
|
||||
|
||||
// Unzip the file
|
||||
ShowAction("Un7zipping file. Please wait...");
|
||||
//ShowAction("Un7zipping file. Please wait...");
|
||||
WaitPrompt("Un7zipping file. Please wait...");
|
||||
SzRes = SzExtract2(
|
||||
&SzArchiveStream.InStream,
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <gccore.h>
|
||||
#include <string.h>
|
||||
#include "sfont.h"
|
||||
|
||||
#include "intl.h"
|
||||
|
||||
#define MARGIN 0 //42
|
||||
|
||||
@ -88,7 +88,7 @@ int scrollerx = 320 - MARGIN;
|
||||
void scroller(int y, unsigned char text[][512], int nlines)
|
||||
{
|
||||
int a;
|
||||
int b;
|
||||
int b=0;
|
||||
int f;
|
||||
int l;
|
||||
int s = 0;
|
||||
@ -144,5 +144,58 @@ memcpy (&xfb[whichfb][y*320], &backdrop[y*1280], 1280 * SFONTHEIGHT);
|
||||
line++;
|
||||
if (line >= nlines) line = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* SetScreen
|
||||
****************************************************************************/
|
||||
void SetScreen() {
|
||||
VIDEO_SetNextFramebuffer( xfb[whichfb] );
|
||||
VIDEO_Flush();
|
||||
VIDEO_WaitVSync();
|
||||
}
|
||||
|
||||
void ClearScreen() {
|
||||
whichfb ^= 1;
|
||||
/*VIDEO_ClearFrameBuffer(vmode, xfb[whichfb], 0x258e2573);*/
|
||||
memcpy (xfb[whichfb], &backdrop, 1280 * 480);
|
||||
}
|
||||
|
||||
int GetTextWidth(char *text) {
|
||||
unsigned int i, w = 0;
|
||||
|
||||
for (i = 0; i < strlen(text); i++)
|
||||
w += font_width;
|
||||
return w;
|
||||
}
|
||||
|
||||
int CentreTextPosition(char *text) {
|
||||
return ((640 - GetTextWidth(text)) >> 1);
|
||||
}
|
||||
|
||||
void WriteCentre(int y, char *text) {
|
||||
write_font(CentreTextPosition(text), y, text);
|
||||
}
|
||||
|
||||
void WaitPrompt(char *msg) {
|
||||
int quit = 0;
|
||||
|
||||
while (PAD_ButtonsDown(0) & PAD_BUTTON_A) {} ;
|
||||
while(!(PAD_ButtonsDown(0) & PAD_BUTTON_A) && (quit == 0)) {
|
||||
ClearScreen();
|
||||
WriteCentre(220, msg);
|
||||
WriteCentre(220 + font_height, MENU_PRESS_A);
|
||||
|
||||
if (PAD_ButtonsDown(0) & PAD_BUTTON_A)
|
||||
quit = 1;
|
||||
|
||||
SetScreen();
|
||||
}
|
||||
}
|
||||
|
||||
void ShowAction(char *msg) {
|
||||
memcpy (xfb[whichfb], &backdrop, 1280 * 480);
|
||||
/*ClearScreen();*/
|
||||
WriteCentre(220 + (font_height >> 1), msg);
|
||||
SetScreen();
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* IPL_FONT HEADER
|
||||
****************************************************************************/
|
||||
|
||||
#define MARGIN 42
|
||||
//#define MARGIN 42
|
||||
|
||||
void init_font(void);
|
||||
void write_font(int x, int y, const char *string);
|
||||
@ -10,3 +10,11 @@ void writex(int x, int y, int sx, int sy, const unsigned char *string, int looku
|
||||
void scroller(int y, unsigned char text[][512], int nlines);
|
||||
|
||||
int scrollerx;
|
||||
|
||||
void SetScreen();
|
||||
void ClearScreen();
|
||||
int GetTextWidth(char *text);
|
||||
int CentreTextPosition(char *text);
|
||||
void WriteCentre(int y, char *text);
|
||||
void WaitPrompt(char *msg);
|
||||
void ShowAction(char *msg);
|
||||
|
Loading…
Reference in New Issue
Block a user