mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-18 09:19:17 +01:00
72d8c9dc2e
*Created an own class for the homebrew prompt *Created scrollbar class which is now used on every browser *Created a checkbox browser list class *Changed the category prompts to the new list mode *Improved B-Button scrolling *Fixed horizontal text scrolling *Fixed possible crash on long text display *Many internal gui changes and navigation changes *Fixed booting games by argument (headless id) (Issue 1930) *Fixed SD Reload button to really reload the SD after it was ejected (Issue 1923) *Added booting with arguements from meta.xml for homebrews (Issue 1926) *Added some arguments acception from meta.xml to our app. "-ios=xxx" and "-usbport=x" or "--ios=xxx" and "--usbport=x" can be used. -usbport is for Hermes cIOS to decide which usb port to use on startup. The ios is the boot IOS on startup, it always overrides the compiled boot IOS into the application.
92 lines
2.3 KiB
C++
92 lines
2.3 KiB
C++
#include <malloc.h>
|
|
#include <string.h>
|
|
#include "FileOperations/fileops.h"
|
|
#include "Resources.h"
|
|
#include "filelist.h"
|
|
|
|
void Resources::Clear()
|
|
{
|
|
for(int i = 0; RecourceFiles[i].filename != NULL; ++i)
|
|
{
|
|
if(RecourceFiles[i].CustomFile)
|
|
{
|
|
free(RecourceFiles[i].CustomFile);
|
|
RecourceFiles[i].CustomFile = NULL;
|
|
}
|
|
|
|
if(RecourceFiles[i].CustomFileSize != 0)
|
|
RecourceFiles[i].CustomFileSize = 0;
|
|
}
|
|
}
|
|
|
|
bool Resources::LoadFiles(const char * path)
|
|
{
|
|
if(!path)
|
|
return false;
|
|
|
|
bool result = false;
|
|
Clear();
|
|
|
|
char fullpath[1024];
|
|
|
|
for(int i = 0; RecourceFiles[i].filename != NULL; ++i)
|
|
{
|
|
snprintf(fullpath, sizeof(fullpath), "%s/%s", path, RecourceFiles[i].filename);
|
|
|
|
if(CheckFile(fullpath))
|
|
{
|
|
u8 * buffer = NULL;
|
|
u64 filesize = 0;
|
|
|
|
LoadFileToMem(fullpath, &buffer, &filesize);
|
|
|
|
RecourceFiles[i].CustomFile = buffer;
|
|
RecourceFiles[i].CustomFileSize = (u32) filesize;
|
|
result = true;
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
const u8 * Resources::GetFile(const char * filename)
|
|
{
|
|
for(int i = 0; RecourceFiles[i].filename != NULL; ++i)
|
|
{
|
|
if(strcasecmp(filename, RecourceFiles[i].filename) == 0)
|
|
{
|
|
return (RecourceFiles[i].CustomFile ? RecourceFiles[i].CustomFile : RecourceFiles[i].DefaultFile);
|
|
}
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
u32 Resources::GetFileSize(const char * filename)
|
|
{
|
|
for(int i = 0; RecourceFiles[i].filename != NULL; ++i)
|
|
{
|
|
if(strcasecmp(filename, RecourceFiles[i].filename) == 0)
|
|
{
|
|
return (RecourceFiles[i].CustomFile ? RecourceFiles[i].CustomFileSize : RecourceFiles[i].DefaultFileSize);
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
GuiImageData * Resources::GetImageData(const char * filename)
|
|
{
|
|
for(int i = 0; RecourceFiles[i].filename != NULL; ++i)
|
|
{
|
|
if(strcasecmp(filename, RecourceFiles[i].filename) == 0)
|
|
{
|
|
const u8 * buff = RecourceFiles[i].CustomFile ? RecourceFiles[i].CustomFile : RecourceFiles[i].DefaultFile;
|
|
const u32 size = RecourceFiles[i].CustomFile ? RecourceFiles[i].CustomFileSize : RecourceFiles[i].DefaultFileSize;
|
|
return (new GuiImageData(buff, size));
|
|
}
|
|
}
|
|
|
|
return NULL;
|
|
}
|