mirror of
https://github.com/dborth/fceugx.git
synced 2024-12-04 14:24:16 +01:00
merge changes from cebolleto
This commit is contained in:
parent
b68a302c9f
commit
2037f6cfa1
@ -63,7 +63,7 @@ int ShutdownRequested = 0;
|
||||
int ResetRequested = 0;
|
||||
int ExitRequested = 0;
|
||||
char appPath[1024] = { 0 };
|
||||
char loadedFile[1024] = { 0 };
|
||||
|
||||
int frameskip = 0;
|
||||
int turbomode = 0;
|
||||
unsigned char * nesrom = NULL;
|
||||
|
@ -76,13 +76,15 @@ enum {
|
||||
|
||||
struct SGCSettings{
|
||||
int AutoLoad;
|
||||
int AutoSave;
|
||||
int LoadMethod; // For ROMS: Auto, SD, DVD, USB, Network (SMB)
|
||||
int AutoSave;
|
||||
int LoadMethod; // For ROMS: Auto, SD, DVD, USB, Network (SMB)
|
||||
int SaveMethod; // For SRAM, Freeze, Prefs: Auto, SD, USB, SMB
|
||||
char LoadFolder[MAXPATHLEN]; // Path to game files
|
||||
char LastFileLoaded[MAXPATHLEN]; //Last file loaded filename
|
||||
char SaveFolder[MAXPATHLEN]; // Path to save files
|
||||
char CheatFolder[MAXPATHLEN]; // Path to cheat files
|
||||
|
||||
char ScreenshotsFolder[MAXPATHLEN]; //Path to screenshots files
|
||||
|
||||
char smbip[80];
|
||||
char smbuser[20];
|
||||
char smbpwd[20];
|
||||
@ -120,7 +122,6 @@ extern int ConfigRequested;
|
||||
extern int ShutdownRequested;
|
||||
extern int ExitRequested;
|
||||
extern char appPath[];
|
||||
extern char loadedFile[];
|
||||
extern int frameskip;
|
||||
extern int fskip;
|
||||
extern int fskipc;
|
||||
|
@ -36,7 +36,8 @@ BROWSERINFO browser;
|
||||
BROWSERENTRY * browserList = NULL; // list of files/folders in browser
|
||||
|
||||
static char szpath[MAXPATHLEN];
|
||||
static bool inSz = false;
|
||||
char szname[MAXPATHLEN];
|
||||
bool inSz = false;
|
||||
|
||||
char romFilename[256];
|
||||
bool loadingFile = false;
|
||||
@ -211,6 +212,8 @@ int UpdateDirName()
|
||||
|
||||
/* remove last subdirectory name */
|
||||
size = strlen(browser.dir) - size - 1;
|
||||
strncpy(GCSettings.LastFileLoaded, &browser.dir[size], strlen(browser.dir) - size - 1); //set as loaded file the previous dir
|
||||
GCSettings.LastFileLoaded[strlen(browser.dir) - size - 1] = 0;
|
||||
browser.dir[size] = 0;
|
||||
}
|
||||
|
||||
@ -429,12 +432,11 @@ void StripExt(char* returnstring, char * inputstring)
|
||||
***************************************************************************/
|
||||
int BrowserLoadSz()
|
||||
{
|
||||
char filepath[MAXPATHLEN];
|
||||
memset(filepath, 0, MAXPATHLEN);
|
||||
|
||||
// we'll store the 7z filepath for extraction later
|
||||
if(!MakeFilePath(szpath, FILE_ROM))
|
||||
return 0;
|
||||
memset(szpath, 0, MAXPATHLEN);
|
||||
strncpy(szpath, browser.dir, strlen(browser.dir) - 1);
|
||||
|
||||
strncpy(szname, strrchr(szpath, '/') + 1, strrchr(szpath, '.') - strrchr(szpath, '/'));
|
||||
*strrchr(szname, '.') = '\0';
|
||||
|
||||
int szfiles = SzParse(szpath);
|
||||
if(szfiles)
|
||||
@ -500,7 +502,7 @@ int BrowserLoadFile()
|
||||
{
|
||||
// store the filename (w/o ext) - used for ram/state naming
|
||||
StripExt(romFilename, browserList[browser.selIndex].filename);
|
||||
strcpy(loadedFile, browserList[browser.selIndex].filename);
|
||||
snprintf(GCSettings.LastFileLoaded, MAXPATHLEN, "%s", browserList[browser.selIndex].filename);
|
||||
|
||||
// load UPS/IPS/PPF patch
|
||||
filesize = LoadPatch(filesize);
|
||||
@ -540,21 +542,31 @@ int BrowserChangeFolder()
|
||||
SzClose();
|
||||
}
|
||||
|
||||
if(!UpdateDirName())
|
||||
if(!UpdateDirName())
|
||||
return -1;
|
||||
|
||||
HaltParseThread(); // halt parsing
|
||||
HaltParseThread();
|
||||
CleanupPath(browser.dir);
|
||||
ResetBrowser(); // reset browser
|
||||
ResetBrowser();
|
||||
|
||||
if(browser.dir[0] != 0)
|
||||
ParseDirectory();
|
||||
{
|
||||
if(strstr(browser.dir, ".7z"))
|
||||
{
|
||||
BrowserLoadSz();
|
||||
}
|
||||
else
|
||||
{
|
||||
ParseDirectory(true, true);
|
||||
}
|
||||
FindAndSelectLastLoadedFile();
|
||||
}
|
||||
|
||||
if(browser.numEntries == 0)
|
||||
{
|
||||
browser.dir[0] = 0;
|
||||
int i=0;
|
||||
|
||||
|
||||
#ifdef HW_RVL
|
||||
AddBrowserEntry();
|
||||
sprintf(browserList[i].filename, "sd:/");
|
||||
|
@ -55,6 +55,8 @@ enum
|
||||
|
||||
extern char romFilename[];
|
||||
extern bool loadingFile;
|
||||
extern char szname[MAXPATHLEN];
|
||||
extern bool inSz;
|
||||
|
||||
bool MakeFilePath(char filepath[], int type, char * filename = NULL, int filenum = -2);
|
||||
int UpdateDirName();
|
||||
|
@ -55,7 +55,7 @@ bool isMounted[7] = { false, false, false, false, false, false, false };
|
||||
|
||||
// folder parsing thread
|
||||
static lwp_t parsethread = LWP_THREAD_NULL;
|
||||
static DIR * dir = NULL;
|
||||
static DIR *dir = NULL;
|
||||
static bool parseHalt = true;
|
||||
static bool parseFilter = true;
|
||||
static bool ParseDirEntries();
|
||||
@ -480,7 +480,7 @@ bool GetFileSize(int i)
|
||||
{
|
||||
if(browserList[i].length > 0)
|
||||
return true;
|
||||
|
||||
|
||||
struct stat filestat;
|
||||
char path[MAXPATHLEN+1];
|
||||
snprintf(path, MAXPATHLEN, "%s%s", browser.dir, browserList[i].filename);
|
||||
@ -492,6 +492,40 @@ bool GetFileSize(int i)
|
||||
return true;
|
||||
}
|
||||
|
||||
void FindAndSelectLastLoadedFile ()
|
||||
{
|
||||
int indexFound = -1;
|
||||
|
||||
for(int j=1; j < browser.numEntries; j++)
|
||||
{
|
||||
if(strcmp(browserList[j].filename, GCSettings.LastFileLoaded) == 0)
|
||||
{
|
||||
indexFound = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// move to this file
|
||||
if(indexFound > 0)
|
||||
{
|
||||
if(indexFound >= FILE_PAGESIZE)
|
||||
{
|
||||
int newIndex = (floor(indexFound/(float)FILE_PAGESIZE)) * FILE_PAGESIZE;
|
||||
|
||||
if(newIndex + FILE_PAGESIZE > browser.numEntries)
|
||||
newIndex = browser.numEntries - FILE_PAGESIZE;
|
||||
|
||||
if(newIndex < 0)
|
||||
newIndex = 0;
|
||||
|
||||
browser.pageIndex = newIndex;
|
||||
}
|
||||
browser.selIndex = indexFound;
|
||||
}
|
||||
|
||||
selectLoadedFile = 2; // selecting done
|
||||
}
|
||||
|
||||
static bool ParseDirEntries()
|
||||
{
|
||||
if(!dir)
|
||||
@ -528,7 +562,7 @@ static bool ParseDirEntries()
|
||||
if(parseFilter && !isdir)
|
||||
{
|
||||
ext = GetExt(entry->d_name);
|
||||
|
||||
|
||||
if(ext == NULL)
|
||||
continue;
|
||||
|
||||
@ -577,40 +611,7 @@ static bool ParseDirEntries()
|
||||
{
|
||||
closedir(dir); // close directory
|
||||
dir = NULL;
|
||||
|
||||
// try to find and select the last loaded file
|
||||
if(selectLoadedFile == 1 && !parseHalt && loadedFile[0] != 0 && browser.dir[0] != 0)
|
||||
{
|
||||
int indexFound = -1;
|
||||
|
||||
for(int j=1; j < browser.numEntries; j++)
|
||||
{
|
||||
if(strcmp(browserList[j].filename, loadedFile) == 0)
|
||||
{
|
||||
indexFound = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// move to this file
|
||||
if(indexFound > 0)
|
||||
{
|
||||
if(indexFound >= FILE_PAGESIZE)
|
||||
{
|
||||
int newIndex = (floor(indexFound/(float)FILE_PAGESIZE)) * FILE_PAGESIZE;
|
||||
|
||||
if(newIndex + FILE_PAGESIZE > browser.numEntries)
|
||||
newIndex = browser.numEntries - FILE_PAGESIZE;
|
||||
|
||||
if(newIndex < 0)
|
||||
newIndex = 0;
|
||||
|
||||
browser.pageIndex = newIndex;
|
||||
}
|
||||
browser.selIndex = indexFound;
|
||||
}
|
||||
selectLoadedFile = 2; // selecting done
|
||||
}
|
||||
|
||||
return false; // no more entries
|
||||
}
|
||||
return true; // more entries
|
||||
|
@ -30,6 +30,7 @@ bool ChangeInterface(int device, bool silent);
|
||||
bool ChangeInterface(char * filepath, bool silent);
|
||||
void CreateAppPath(char * origpath);
|
||||
bool GetFileSize(int i);
|
||||
void FindAndSelectLastLoadedFile();
|
||||
int ParseDirectory(bool waitParse = false, bool filter = true);
|
||||
void AllocSaveBuffer();
|
||||
void FreeSaveBuffer();
|
||||
|
@ -368,14 +368,15 @@ int SzParse(char * filepath)
|
||||
|
||||
int device;
|
||||
|
||||
if(!FindDevice(browser.dir, &device) || !GetFileSize(browser.selIndex))
|
||||
struct stat filestat;
|
||||
if(stat(filepath, &filestat) < 0)
|
||||
return 0;
|
||||
unsigned int filelen = filestat.st_size;
|
||||
|
||||
if(!FindDevice(filepath, &device) || !filelen)
|
||||
return 0;
|
||||
|
||||
int nbfiles = 0;
|
||||
|
||||
// save the length/offset of this file
|
||||
unsigned int filelen = browserList[browser.selIndex].length;
|
||||
|
||||
// setup archive stream
|
||||
SzArchiveStream.offset = 0;
|
||||
SzArchiveStream.len = filelen;
|
||||
@ -424,7 +425,7 @@ int SzParse(char * filepath)
|
||||
|
||||
// add '..' folder in case the user wants exit the 7z
|
||||
AddBrowserEntry();
|
||||
|
||||
sprintf(browserList[0].filename, "..");
|
||||
sprintf(browserList[0].displayname, "Up One Level");
|
||||
browserList[0].isdir = 1;
|
||||
browserList[0].length = filelen;
|
||||
@ -453,6 +454,12 @@ int SzParse(char * filepath)
|
||||
// parse information about this file to the file list structure
|
||||
snprintf(browserList[SzJ].filename, MAXJOLIET, "%s", SzF->Name);
|
||||
StripExt(browserList[SzJ].displayname, browserList[SzJ].filename);
|
||||
char* strPos = strstr(browserList[SzJ].displayname, szname);
|
||||
if(strPos)
|
||||
{
|
||||
snprintf(browserList[SzJ].displayname, MAXJOLIET, "%s", strPos + strlen(szname));
|
||||
}
|
||||
|
||||
browserList[SzJ].length = SzF->Size; // filesize
|
||||
browserList[SzJ].isdir = 0; // only files will be displayed (-> no flags)
|
||||
browserList[SzJ].filenum = SzI; // the extraction function identifies the file with this number
|
||||
|
@ -240,7 +240,7 @@ class GuiElement
|
||||
//!Constructor
|
||||
GuiElement();
|
||||
//!Destructor
|
||||
~GuiElement();
|
||||
virtual ~GuiElement();
|
||||
//!Set the element's parent
|
||||
//!\param e Pointer to parent element
|
||||
void SetParent(GuiElement * e);
|
||||
|
8018
source/menu.cpp
8018
source/menu.cpp
File diff suppressed because it is too large
Load Diff
@ -124,9 +124,11 @@ preparePrefsData ()
|
||||
createXMLSetting("LoadMethod", "Load Method", toStr(GCSettings.LoadMethod));
|
||||
createXMLSetting("SaveMethod", "Save Method", toStr(GCSettings.SaveMethod));
|
||||
createXMLSetting("LoadFolder", "Load Folder", GCSettings.LoadFolder);
|
||||
createXMLSetting("LastFileLoaded", "Last File Loaded", GCSettings.LastFileLoaded);
|
||||
createXMLSetting("SaveFolder", "Save Folder", GCSettings.SaveFolder);
|
||||
createXMLSetting("CheatFolder", "Cheats Folder", GCSettings.CheatFolder);
|
||||
createXMLSetting("gamegenie", "Game Genie", toStr(GCSettings.gamegenie));
|
||||
createXMLSetting("ScreenshotsFolder", "Screenshots Folder", GCSettings.ScreenshotsFolder);
|
||||
|
||||
createXMLSection("Network", "Network Settings");
|
||||
|
||||
@ -296,9 +298,11 @@ decodePrefsData ()
|
||||
loadXMLSetting(&GCSettings.LoadMethod, "LoadMethod");
|
||||
loadXMLSetting(&GCSettings.SaveMethod, "SaveMethod");
|
||||
loadXMLSetting(GCSettings.LoadFolder, "LoadFolder", sizeof(GCSettings.LoadFolder));
|
||||
loadXMLSetting(GCSettings.LastFileLoaded, "LastFileLoaded", sizeof(GCSettings.LastFileLoaded));
|
||||
loadXMLSetting(GCSettings.SaveFolder, "SaveFolder", sizeof(GCSettings.SaveFolder));
|
||||
loadXMLSetting(GCSettings.CheatFolder, "CheatFolder", sizeof(GCSettings.CheatFolder));
|
||||
loadXMLSetting(&GCSettings.gamegenie, "gamegenie");
|
||||
loadXMLSetting(GCSettings.ScreenshotsFolder, "ScreenshotsFolder", sizeof(GCSettings.ScreenshotsFolder));
|
||||
|
||||
// Network Settings
|
||||
|
||||
@ -433,6 +437,7 @@ DefaultSettings ()
|
||||
sprintf (GCSettings.LoadFolder, "%s/roms", APPFOLDER); // Path to game files
|
||||
sprintf (GCSettings.SaveFolder, "%s/saves", APPFOLDER); // Path to save files
|
||||
sprintf (GCSettings.CheatFolder, "%s/cheats", APPFOLDER); // Path to cheat files
|
||||
sprintf (GCSettings.CheatFolder, "%s/screenshots", APPFOLDER); // Path to cheat files
|
||||
GCSettings.AutoLoad = 1; // Auto Load RAM
|
||||
GCSettings.AutoSave = 1; // Auto Save RAM
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ static int pngu_decode (IMGCTX ctx, u32 width, u32 height, u32 stripAlpha)
|
||||
return PNGU_INVALID_WIDTH_OR_HEIGHT;
|
||||
|
||||
// Check if color type is supported by PNGU
|
||||
if ( (ctx->prop.imgColorType == PNGU_COLOR_TYPE_PALETTE) || (ctx->prop.imgColorType == PNGU_COLOR_TYPE_UNKNOWN) )
|
||||
if (ctx->prop.imgColorType == PNGU_COLOR_TYPE_UNKNOWN)
|
||||
return PNGU_UNSUPPORTED_COLOR_TYPE;
|
||||
|
||||
// Scale 16 bit samples to 8 bit
|
||||
@ -329,6 +329,10 @@ static int pngu_decode (IMGCTX ctx, u32 width, u32 height, u32 stripAlpha)
|
||||
// Transform grayscale images to RGB
|
||||
if ( (ctx->prop.imgColorType == PNGU_COLOR_TYPE_GRAY) || (ctx->prop.imgColorType == PNGU_COLOR_TYPE_GRAY_ALPHA) )
|
||||
png_set_gray_to_rgb (ctx->png_ptr);
|
||||
|
||||
// Transform palette images to RGB
|
||||
if (ctx->prop.imgColorType == PNGU_COLOR_TYPE_PALETTE)
|
||||
png_set_palette_to_rgb(ctx->png_ptr);
|
||||
|
||||
// Flush transformations
|
||||
png_read_update_info (ctx->png_ptr, ctx->info_ptr);
|
||||
|
Loading…
Reference in New Issue
Block a user