mirror of
https://gitlab.com/Nanolx/homebrewfilter.git
synced 2024-12-26 17:41:48 +01:00
more work on DVD-support
--> HBF mounts the DVD but does not (yet) list any apps from it
This commit is contained in:
parent
5db3c9fa13
commit
585b596e22
2
Makefile
2
Makefile
@ -45,7 +45,7 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--section-start,.init=0x8
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -ldi -lpng -lz -lfat -lntfs -lwiiuse -lbte -lasnd -logc -lvorbisidec -lfreetype -lmxml -lext2fs -liso9660
|
||||
LIBS := -ldi -lpng -lz -lfat -lntfs -lwiiuse -lbte -lasnd -logc -lvorbisidec -lfreetype -lmxml -lext2fs
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
|
BIN
data/images/design/all_active.png
Normal file
BIN
data/images/design/all_active.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
data/images/design/all_inactive.png
Normal file
BIN
data/images/design/all_inactive.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
BIN
data/images/design/dvd_active.png
Normal file
BIN
data/images/design/dvd_active.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
data/images/design/dvd_inactive.png
Normal file
BIN
data/images/design/dvd_inactive.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
@ -81,7 +81,7 @@ int MenuMain()
|
||||
apps_row = 1;
|
||||
}
|
||||
|
||||
// sd / usb ansicht
|
||||
// sd / usb / dvd Ansicht
|
||||
if(Settings.device == "sd1")
|
||||
{
|
||||
temp_sd_usb_active = Theme.sd_active;
|
||||
@ -97,6 +97,16 @@ int MenuMain()
|
||||
temp_sd_usb_active = Theme.sd_usb_active;
|
||||
temp_sd_usb_inactive = Theme.sd_usb_inactive;
|
||||
}
|
||||
else if(Settings.device == "dvd")
|
||||
{
|
||||
temp_sd_usb_active = Theme.dvd_active;
|
||||
temp_sd_usb_inactive = Theme.dvd_inactive;
|
||||
}
|
||||
else if(Settings.device == "all")
|
||||
{
|
||||
temp_sd_usb_active = Theme.all_active;
|
||||
temp_sd_usb_inactive = Theme.all_inactive;
|
||||
}
|
||||
|
||||
// wii / gc ansicht
|
||||
if(Settings.system == 1)
|
||||
@ -358,7 +368,8 @@ int MenuMain()
|
||||
// device symbol anzeigen
|
||||
GuiImage * viewdevice = NULL;
|
||||
|
||||
if((Options.device_icon == 1 || Options.device_icon == 3) && Settings.device == "sd_usb")
|
||||
if((Options.device_icon == 1 || Options.device_icon == 3 || Options.device_icon == 5)
|
||||
&& (Settings.device == "sd_usb" || Settings.device == "all"))
|
||||
{
|
||||
bool icon = false;
|
||||
if(strncmp(vechomebrew_list_choice[i].foldername.c_str(), "sd", 2) == 0)
|
||||
@ -371,6 +382,11 @@ int MenuMain()
|
||||
viewdevice = new GuiImage(new GuiImageData(Theme.usb_inactive));
|
||||
icon = true;
|
||||
}
|
||||
else if(strncmp(vechomebrew_list_choice[i].foldername.c_str(), "dvd", 3) == 0)
|
||||
{
|
||||
viewdevice = new GuiImage (new GuiImageData(Theme.dvd_inactive));
|
||||
icon = true;
|
||||
}
|
||||
|
||||
if(icon)
|
||||
{
|
||||
@ -652,7 +668,9 @@ int MenuMain()
|
||||
}
|
||||
|
||||
// SD, USB
|
||||
else if(sd_usb_Btn.GetState() == STATE_CLICKED || Settings.sd_insert == -1 || Settings.sd_insert == 2 || Settings.usb_insert == -1 || Settings.usb_insert == 2)
|
||||
else if(sd_usb_Btn.GetState() == STATE_CLICKED || Settings.sd_insert == -1 || Settings.sd_insert == 2
|
||||
|| Settings.usb_insert == -1 || Settings.usb_insert == 2
|
||||
|| Settings.dvd_insert == -1 || Settings.dvd_insert == 2)
|
||||
{
|
||||
int device = -1;
|
||||
if(sd_usb_Btn.GetState() == STATE_CLICKED)
|
||||
@ -664,8 +682,14 @@ int MenuMain()
|
||||
Settings.device = "usb1";
|
||||
else if(device == 3)
|
||||
Settings.device = "sd_usb";
|
||||
else if(device == 4)
|
||||
Settings.device = "dvd";
|
||||
else if(device == 5)
|
||||
Settings.device = "all";
|
||||
|
||||
if(device != -1 || Settings.sd_insert == -1 || Settings.sd_insert == 2 || Settings.usb_insert == -1 || Settings.usb_insert == 2)
|
||||
if(device != -1 || Settings.sd_insert == -1 || Settings.sd_insert == 2
|
||||
|| Settings.usb_insert == -1 || Settings.usb_insert == 2
|
||||
|| Settings.dvd_insert == -1 || Settings.dvd_insert == 2)
|
||||
{
|
||||
check_device();
|
||||
Settings.current_page = 1;
|
||||
|
@ -22,7 +22,7 @@ int devicePrompt()
|
||||
bool stop = false;
|
||||
int device = -1;
|
||||
|
||||
GuiWindow promptWindow(144,64);
|
||||
GuiWindow promptWindow(232,64);
|
||||
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
promptWindow.SetPosition(-135, 280);
|
||||
GuiTrigger trigA;
|
||||
@ -41,38 +41,60 @@ int devicePrompt()
|
||||
GuiImageData usb_BtnImgDataOver(Theme.usb_active);
|
||||
GuiImageData sd_usb_BtnImgData(Theme.sd_usb_inactive);
|
||||
GuiImageData sd_usb_BtnImgDataOver(Theme.sd_usb_active);
|
||||
GuiImageData dvd_BtnImgData(Theme.dvd_inactive);
|
||||
GuiImageData dvd_BtnImgDataOver(Theme.dvd_active);
|
||||
GuiImageData all_BtnImgData(Theme.all_inactive);
|
||||
GuiImageData all_BtnImgDataOver(Theme.all_active);
|
||||
|
||||
// button
|
||||
GuiImage sd_BtnImg(&sd_BtnImgData);
|
||||
GuiImage usb_BtnImg(&usb_BtnImgData);
|
||||
GuiImage sd_usb_BtnImg(&sd_usb_BtnImgData);
|
||||
GuiImage dvd_BtnImg(&dvd_BtnImgData);
|
||||
GuiImage all_BtnImg(&all_BtnImgData);
|
||||
|
||||
// button over
|
||||
GuiImage sd_BtnImgOver(&sd_BtnImgDataOver);
|
||||
GuiImage usb_BtnImgOver(&usb_BtnImgDataOver);
|
||||
GuiImage sd_usb_BtnImgOver(&sd_usb_BtnImgDataOver);
|
||||
|
||||
GuiImage dvd_BtnImgOver(&dvd_BtnImgDataOver);
|
||||
GuiImage all_BtnImgOver(&all_BtnImgDataOver);
|
||||
|
||||
GuiButton sd_Btn(sd_BtnImgData.GetWidth(), sd_BtnImgData.GetHeight());
|
||||
sd_Btn.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
sd_Btn.SetPosition(8, 0);
|
||||
sd_Btn.SetImage(&sd_BtnImg);
|
||||
sd_Btn.SetImageOver(&sd_BtnImgOver);
|
||||
sd_Btn.SetTrigger(&trigA);
|
||||
|
||||
|
||||
GuiButton usb_Btn(usb_BtnImgData.GetWidth(), usb_BtnImgData.GetHeight());
|
||||
usb_Btn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
usb_Btn.SetPosition(0, 0);
|
||||
usb_Btn.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
usb_Btn.SetPosition(52, 0);
|
||||
usb_Btn.SetImage(&usb_BtnImg);
|
||||
usb_Btn.SetImageOver(&usb_BtnImgOver);
|
||||
usb_Btn.SetTrigger(&trigA);
|
||||
|
||||
|
||||
GuiButton sd_usb_Btn(sd_usb_BtnImgData.GetWidth(), sd_usb_BtnImgData.GetHeight());
|
||||
sd_usb_Btn.SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
|
||||
sd_usb_Btn.SetPosition(-8, 0);
|
||||
sd_usb_Btn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
sd_usb_Btn.SetPosition(0, 0);
|
||||
sd_usb_Btn.SetImage(&sd_usb_BtnImg);
|
||||
sd_usb_Btn.SetImageOver(&sd_usb_BtnImgOver);
|
||||
sd_usb_Btn.SetTrigger(&trigA);
|
||||
|
||||
GuiButton dvd_Btn(dvd_BtnImgData.GetWidth(), dvd_BtnImgData.GetHeight());
|
||||
dvd_Btn.SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
|
||||
dvd_Btn.SetPosition(-52, 0);
|
||||
dvd_Btn.SetImage(&dvd_BtnImg);
|
||||
dvd_Btn.SetImageOver(&dvd_BtnImgOver);
|
||||
dvd_Btn.SetTrigger(&trigA);
|
||||
|
||||
GuiButton all_Btn(all_BtnImgData.GetWidth(), all_BtnImgData.GetHeight());
|
||||
all_Btn.SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
|
||||
all_Btn.SetPosition(-8, 0);
|
||||
all_Btn.SetImage(&all_BtnImg);
|
||||
all_Btn.SetImageOver(&all_BtnImgOver);
|
||||
all_Btn.SetTrigger(&trigA);
|
||||
|
||||
GuiButton back(0, 0);
|
||||
back.SetTrigger(&trigB);
|
||||
|
||||
@ -80,6 +102,8 @@ int devicePrompt()
|
||||
promptWindow.Append(&sd_Btn);
|
||||
promptWindow.Append(&usb_Btn);
|
||||
promptWindow.Append(&sd_usb_Btn);
|
||||
promptWindow.Append(&dvd_Btn);
|
||||
promptWindow.Append(&all_Btn);
|
||||
promptWindow.Append(&back);
|
||||
|
||||
HaltGui();
|
||||
@ -97,19 +121,31 @@ int devicePrompt()
|
||||
device = 1;
|
||||
stop = true;
|
||||
}
|
||||
|
||||
|
||||
if(usb_Btn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
device = 2;
|
||||
stop = true;
|
||||
}
|
||||
|
||||
|
||||
if(sd_usb_Btn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
device = 3;
|
||||
stop = true;
|
||||
}
|
||||
|
||||
|
||||
if(dvd_Btn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
device = 4;
|
||||
stop = true;
|
||||
}
|
||||
|
||||
if(all_Btn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
device = 5;
|
||||
stop = true;
|
||||
}
|
||||
|
||||
if(back.GetState() == STATE_CLICKED)
|
||||
stop = true;
|
||||
}
|
||||
@ -118,7 +154,7 @@ int devicePrompt()
|
||||
mainWindow->Remove(&promptWindow);
|
||||
mainWindow->SetState(STATE_DEFAULT);
|
||||
ResumeGui();
|
||||
|
||||
|
||||
return device;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
#include "libwiigui/gui.h"
|
||||
|
||||
|
||||
#include "Prompts/prompts.h"
|
||||
/*** Extern variables ***/
|
||||
extern GuiWindow * mainWindow;
|
||||
@ -41,35 +40,35 @@ void add(string device, string apps_path)
|
||||
{
|
||||
sprintf(pathnameelf, (device + ":/" + apps_path + "%s/boot.elf").c_str() ,dirname);
|
||||
sprintf(pathname, (device + ":/" + apps_path + "%s/boot.dol").c_str() ,dirname);
|
||||
|
||||
|
||||
if(fopen(pathnameelf, "rb") != NULL) pathboot = pathnameelf;
|
||||
if(fopen(pathname, "rb") != NULL) pathboot = pathname;
|
||||
|
||||
|
||||
if((fopen(pathname, "rb") || fopen(pathnameelf, "rb")) && strstr(pathname, (apps_path + "./").c_str()) == 0 && strstr(pathname, (apps_path + "../").c_str()) == 0 )
|
||||
{
|
||||
sprintf(pFilename, (device + ":/" + apps_path + "%s/meta.xml").c_str() ,dirname);
|
||||
|
||||
|
||||
string line, quelltext, name, info, foldername, iconpath, arg;
|
||||
ifstream in(pFilename);
|
||||
while(getline(in, line))
|
||||
quelltext = quelltext + line + "\n";
|
||||
|
||||
|
||||
name = parser(quelltext, "<name>", "</name>");
|
||||
if(name == "\0") name = dirname;
|
||||
|
||||
|
||||
info = parser(quelltext, "<short_description>", "</short_description>");
|
||||
if(info == "\0") info = tr("<no description>");
|
||||
|
||||
|
||||
foldername = device + ":/" + apps_path + dirname + "/";
|
||||
transform(foldername.begin(), foldername.end(), foldername.begin(),::tolower); // in kleinebuchstaben umwandeln
|
||||
|
||||
|
||||
u8 *tempicon;
|
||||
u8 *icon = NULL;
|
||||
|
||||
|
||||
iconpath = foldername + "icon.png";
|
||||
|
||||
|
||||
arg = parser(quelltext, "<arguments>", "</arguments>");
|
||||
|
||||
|
||||
size_t amount_read;
|
||||
FILE *fp = fopen(iconpath.c_str(),"r"); //open the png file
|
||||
if(fp) //make sure the file exists
|
||||
@ -78,7 +77,7 @@ void add(string device, string apps_path)
|
||||
fseek (fp , 0 , SEEK_END);
|
||||
filesize = ftell(fp); //find the file size
|
||||
rewind(fp);
|
||||
|
||||
|
||||
tempicon = new u8 [filesize]; //allocate memory for your image buffer
|
||||
if(tempicon) //make sure memory allocated
|
||||
{
|
||||
@ -87,13 +86,13 @@ void add(string device, string apps_path)
|
||||
}
|
||||
}
|
||||
fclose(fp); //close file
|
||||
|
||||
|
||||
vechomebrew_list_category[0].push_back(homebrew_list(name, info, foldername, icon, pathboot, arg));
|
||||
}
|
||||
}
|
||||
dirclose( dir );
|
||||
}*/
|
||||
|
||||
|
||||
DIR *pdir;
|
||||
struct dirent *pent;
|
||||
// struct stat statbuf;
|
||||
@ -111,35 +110,35 @@ void add(string device, string apps_path)
|
||||
{
|
||||
sprintf(pathnameelf, (device + ":/" + apps_path + "%s/boot.elf").c_str() ,pent->d_name);
|
||||
sprintf(pathname, (device + ":/" + apps_path + "%s/boot.dol").c_str() ,pent->d_name);
|
||||
|
||||
|
||||
if(fopen(pathnameelf, "rb") != NULL) pathboot = pathnameelf;
|
||||
if(fopen(pathname, "rb") != NULL) pathboot = pathname;
|
||||
|
||||
|
||||
if((fopen(pathname, "rb") || fopen(pathnameelf, "rb")) && strstr(pathname, (apps_path + "./").c_str()) == 0 && strstr(pathname, (apps_path + "../").c_str()) == 0 )
|
||||
{
|
||||
sprintf(pathmeta, (device + ":/" + apps_path + "%s/meta.xml").c_str() ,pent->d_name);
|
||||
|
||||
|
||||
string line, quelltext, name, info, foldername, iconpath, arg;
|
||||
ifstream in(pathmeta);
|
||||
while(getline(in, line))
|
||||
quelltext = quelltext + line + "\n";
|
||||
|
||||
|
||||
name = parser(quelltext, "<name>", "</name>");
|
||||
if(name == "\0") name = pent->d_name;
|
||||
|
||||
|
||||
info = parser(quelltext, "<short_description>", "</short_description>");
|
||||
if(info == "\0") info = tr("<no description>");
|
||||
|
||||
|
||||
foldername = device + ":/" + apps_path + pent->d_name + "/";
|
||||
transform(foldername.begin(), foldername.end(), foldername.begin(),::tolower); // in kleinebuchstaben umwandeln
|
||||
|
||||
|
||||
u8 *tempicon;
|
||||
u8 *icon = NULL;
|
||||
|
||||
|
||||
iconpath = foldername + "icon.png";
|
||||
|
||||
|
||||
arg = parser(quelltext, "<arguments>", "</arguments>");
|
||||
|
||||
|
||||
size_t amount_read;
|
||||
FILE *fp = fopen(iconpath.c_str(),"r"); //open the png file
|
||||
if(fp) //make sure the file exists
|
||||
@ -148,7 +147,7 @@ void add(string device, string apps_path)
|
||||
fseek (fp , 0 , SEEK_END);
|
||||
filesize = ftell(fp); //find the file size
|
||||
rewind(fp);
|
||||
|
||||
|
||||
tempicon = new u8 [filesize]; //allocate memory for your image buffer
|
||||
if(tempicon) //make sure memory allocated
|
||||
{
|
||||
@ -157,7 +156,7 @@ void add(string device, string apps_path)
|
||||
}
|
||||
}
|
||||
fclose(fp); //close file
|
||||
|
||||
|
||||
vechomebrew_list_category[0].push_back(homebrew_list(name, info, foldername, icon, pathboot, arg));
|
||||
}
|
||||
}
|
||||
@ -168,8 +167,8 @@ void add(string device, string apps_path)
|
||||
void app_list()
|
||||
{
|
||||
vechomebrew_list_category[0].clear();
|
||||
|
||||
if(Settings.device == "sd1" || Settings.device == "usb1")
|
||||
|
||||
if(Settings.device == "sd1" || Settings.device == "usb1" || Settings.device == "dvd")
|
||||
{
|
||||
if(Settings.system == 1)
|
||||
add(Settings.device, "apps/");
|
||||
@ -201,7 +200,31 @@ void app_list()
|
||||
add("usb1", "gc_apps/");
|
||||
}
|
||||
}
|
||||
|
||||
else if(Settings.device == "all")
|
||||
{
|
||||
if(Settings.system == 1)
|
||||
{
|
||||
add("sd1", "apps/");
|
||||
add("usb1", "apps/");
|
||||
add("dvd", "apps/");
|
||||
}
|
||||
else if(Settings.system == 0)
|
||||
{
|
||||
add("sd1", "gc_apps/");
|
||||
add("usb1", "gc_apps/");
|
||||
add("dvd", "gc_apps/");
|
||||
}
|
||||
else if(Settings.system == 2)
|
||||
{
|
||||
add("sd1", "apps/");
|
||||
add("sd1", "gc_apps/");
|
||||
add("usb1", "apps/");
|
||||
add("usb1", "gc_apps/");
|
||||
add("dvd", "apps/");
|
||||
add("dvd", "gc_apps/");
|
||||
}
|
||||
}
|
||||
|
||||
// sortieren
|
||||
std::sort(vechomebrew_list_category[0].begin(),vechomebrew_list_category[0].end(), sort_name_a_z);
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <ntfs.h>
|
||||
#include <fat.h>
|
||||
#include <ext2.h>
|
||||
#include <iso9660.h>
|
||||
#include <sdcard/wiisd_io.h>
|
||||
#include <ogc/usbstorage.h>
|
||||
#include <dirent.h>
|
||||
@ -25,6 +24,8 @@
|
||||
#include "Tools/app_list.h"
|
||||
#include "Tools/copy_app_in_category.h"
|
||||
#include "Tools/throbber.h"
|
||||
#include "DiskOperations/iso.h"
|
||||
#include "DiskOperations/di2.h"
|
||||
|
||||
static const DISC_INTERFACE* sd = &__io_wiisd;
|
||||
static const DISC_INTERFACE* usb = &__io_usbstorage;
|
||||
@ -37,7 +38,7 @@ enum
|
||||
DEVICE_DVD
|
||||
};
|
||||
|
||||
static char prefix[3][7] = { "sd", "usb", "dvd" };
|
||||
static char prefix[2][4] = { "sd", "usb" };
|
||||
|
||||
/****************************************************************************
|
||||
* FindPartitions
|
||||
@ -74,7 +75,6 @@ static char prefix[3][7] = { "sd", "usb", "dvd" };
|
||||
#define T_EXT2 3
|
||||
#define T_ISO9660 4
|
||||
|
||||
|
||||
static const char FAT_SIG[3] = {'F', 'A', 'T'};
|
||||
|
||||
/**
|
||||
@ -214,15 +214,10 @@ static void AddPartition(sec_t sector, int device, int type, int *devnum)
|
||||
else if (type == T_ISO9660)
|
||||
{
|
||||
|
||||
if (!ISO9660_Mount(mount, disc))
|
||||
if (!MountDVD())
|
||||
return;
|
||||
|
||||
const char *name = ISO9660_GetVolumeLabel(mount);
|
||||
|
||||
if(name)
|
||||
strcpy(part[device][*devnum].name, name);
|
||||
else
|
||||
strcpy(part[device][*devnum].name, "DVD");
|
||||
strcpy(part[device][*devnum].name, "DVD");
|
||||
|
||||
}
|
||||
|
||||
@ -509,7 +504,7 @@ static void UnmountPartitions(int device)
|
||||
else if(part[device][i].type == T_ISO9660)
|
||||
{
|
||||
sprintf(mount, "ISO9660: %s:", part[device][i].mount);
|
||||
ISO9660_Unmount(part[device][i].mount);
|
||||
UnMountDVD();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -568,14 +563,69 @@ void MountAllDevices()
|
||||
usleep(250000); // 1/4 sec
|
||||
|
||||
if(dvd->startup() && dvd->isInserted())
|
||||
MountPartitions(DEVICE_DVD);
|
||||
MountDVD();
|
||||
}
|
||||
|
||||
bool MountDVDFS()
|
||||
{
|
||||
bool devicemounted = ISO9660_Mount();
|
||||
|
||||
/*if(!devicemounted)
|
||||
devicemounted = FST_Mount();
|
||||
if(!devicemounted)
|
||||
devicemounted = GCFST_Mount();*/
|
||||
|
||||
return devicemounted;
|
||||
}
|
||||
|
||||
void UnMountDVD()
|
||||
{
|
||||
|
||||
ISO9660_Unmount();
|
||||
}
|
||||
|
||||
bool MountDVD()
|
||||
{
|
||||
if(!DVD_Inserted())
|
||||
return false;
|
||||
|
||||
char read_buffer[2048];
|
||||
if(DI2_ReadDVD(read_buffer, 1, 0) == 0)
|
||||
return true;
|
||||
|
||||
UnMountDVD();
|
||||
DI2_Mount();
|
||||
|
||||
time_t timer1, timer2;
|
||||
timer1 = time(0);
|
||||
|
||||
while(DI2_GetStatus() & DVD_INIT)
|
||||
{
|
||||
timer2 = time(0);
|
||||
if(timer2-timer1 > 15)
|
||||
return false;
|
||||
|
||||
usleep(5000);
|
||||
}
|
||||
|
||||
return MountDVDFS();
|
||||
}
|
||||
|
||||
bool DVD_Inserted()
|
||||
{
|
||||
uint32_t cover = 0;
|
||||
DI2_GetCoverRegister(&cover);
|
||||
|
||||
if(cover & DVD_COVER_DISC_INSERTED)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void UnmountAllDevices()
|
||||
{
|
||||
UnmountPartitions(DEVICE_SD);
|
||||
UnmountPartitions(DEVICE_USB);
|
||||
UnmountPartitions(DEVICE_DVD);
|
||||
}
|
||||
|
||||
bool SDCard_Inserted()
|
||||
@ -596,7 +646,7 @@ void check_sd()
|
||||
}
|
||||
else if(Settings.sd_insert == 1)
|
||||
{
|
||||
if(!SDCard_Inserted()) // wenn sd karte nicht gefunden, beenden
|
||||
if(!SDCard_Inserted()) // wenn sd karte nicht gefunden, beenden
|
||||
{
|
||||
UnmountPartitions(DEVICE_SD);
|
||||
Settings.sd_insert = -1;
|
||||
@ -613,7 +663,7 @@ void check_usb()
|
||||
{
|
||||
if(Settings.usb_insert <= 0)
|
||||
{
|
||||
if(usb->startup() && usb->isInserted()) // wenn usb gerät gefunden, neu einlesen
|
||||
if(usb->startup() && usb->isInserted()) // wenn usb gerät gefunden, neu einlesen
|
||||
{
|
||||
MountPartitions(DEVICE_USB);
|
||||
Settings.usb_insert = 2;
|
||||
@ -621,7 +671,7 @@ void check_usb()
|
||||
}
|
||||
else if(Settings.usb_insert == 1)
|
||||
{
|
||||
if(!USBDevice_Inserted()) // wenn usb gerät nicht mehr gefunden, beenden
|
||||
if(!USBDevice_Inserted()) // wenn usb gerät nicht mehr gefunden, beenden
|
||||
{
|
||||
UnmountPartitions(DEVICE_USB);
|
||||
Settings.usb_insert = -1;
|
||||
@ -629,27 +679,22 @@ void check_usb()
|
||||
}
|
||||
}
|
||||
|
||||
bool DVD_Inserted()
|
||||
{
|
||||
return dvd->isInserted();
|
||||
}
|
||||
|
||||
void check_dvd()
|
||||
{
|
||||
if(Settings.dvd_insert <= 0)
|
||||
{
|
||||
|
||||
if(dvd->startup() && dvd->isInserted()) // wenn dvd gefunden, neu einlesen
|
||||
if(dvd->startup() && DVD_Inserted()) // wenn dvd gefunden, neu einlesen
|
||||
{
|
||||
MountPartitions(DEVICE_DVD);
|
||||
MountDVD();
|
||||
Settings.dvd_insert = 2;
|
||||
}
|
||||
}
|
||||
else if(Settings.dvd_insert == 1)
|
||||
{
|
||||
if(!DVD_Inserted()) // wenn dvd nicht gefunden, beenden
|
||||
if(!DVD_Inserted()) // wenn dvd nicht gefunden, beenden
|
||||
{
|
||||
UnmountPartitions(DEVICE_DVD);
|
||||
UnMountDVD();
|
||||
Settings.dvd_insert = -1;
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,9 @@ extern DEVICE_STRUCT part[2][MAX_DEVICES];
|
||||
void MountAllDevices();
|
||||
void UnmountAllDevices();
|
||||
|
||||
bool MountDVD();
|
||||
bool MountDVDFS();
|
||||
void UnMountDVD();
|
||||
bool DVD_Inserted();
|
||||
void check_dvd();
|
||||
|
||||
|
@ -42,7 +42,11 @@ DefaultTheme()
|
||||
Theme.usb_active = usb_active_png;
|
||||
Theme.usb_inactive = usb_inactive_png;
|
||||
Theme.sd_usb_active = sd_usb_active_png;
|
||||
Theme.sd_usb_inactive = sd_usb_inactive_png;
|
||||
Theme.sd_usb_inactive = sd_usb_inactive_png;
|
||||
Theme.dvd_active = dvd_active_png;
|
||||
Theme.dvd_inactive = dvd_inactive_png;
|
||||
Theme.all_active = all_active_png;
|
||||
Theme.all_inactive = all_inactive_png;
|
||||
Theme.wii_active = wii_active_png;
|
||||
Theme.wii_inactive = wii_inactive_png;
|
||||
Theme.gc_active = gc_active_png;
|
||||
@ -74,7 +78,7 @@ DefaultTheme()
|
||||
Theme.scrollbar_arrowdown_over = scrollbar_arrowdown_over_png;
|
||||
Theme.scrollbar_arrowup = scrollbar_arrowup_png;
|
||||
Theme.scrollbar_arrowup_over = scrollbar_arrowup_over_png;
|
||||
|
||||
|
||||
// color
|
||||
Theme.category_1 = 0;
|
||||
Theme.category_2 = 0;
|
||||
@ -111,7 +115,7 @@ DefaultTheme()
|
||||
const u8* load_data(const u8* image, string path)
|
||||
{
|
||||
u8 *tempicon;
|
||||
|
||||
|
||||
size_t amount_read;
|
||||
FILE *fp = fopen(path.c_str(),"r"); //open the png file
|
||||
if(fp) { //make sure the file exists
|
||||
@ -138,19 +142,19 @@ int split(string to_share, int share)
|
||||
{
|
||||
int number = 0;
|
||||
string temp;
|
||||
|
||||
|
||||
for(int i=0; i < share; i++)
|
||||
{
|
||||
temp = to_share.substr(0, to_share.find(","));
|
||||
to_share.erase(0, to_share.find(",") +1);
|
||||
|
||||
|
||||
if(i == share -1)
|
||||
{
|
||||
number = atoi(temp.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return number;
|
||||
}
|
||||
|
||||
@ -187,6 +191,10 @@ void theme(string path)
|
||||
Theme.usb_inactive = load_data(Theme.usb_inactive , path + "usb_inactive.png");
|
||||
Theme.sd_usb_active = load_data(Theme.sd_usb_active , path + "sd_usb_active.png");
|
||||
Theme.sd_usb_inactive = load_data(Theme.sd_usb_inactive , path + "sd_usb_inactive.png");
|
||||
Theme.dvd_active = load_data(Theme.dvd_active , path + "dvd_active.png");
|
||||
Theme.dvd_inactive = load_data(Theme.dvd_inactive , path + "dvd_inactive.png");
|
||||
Theme.all_active = load_data(Theme.all_active , path + "all_active.png");
|
||||
Theme.all_inactive = load_data(Theme.all_inactive , path + "all_inactive.png");
|
||||
Theme.wii_active = load_data(Theme.wii_active , path + "wii_active.png");
|
||||
Theme.wii_inactive = load_data(Theme.wii_inactive , path + "wii_inactive.png");
|
||||
Theme.gc_active = load_data(Theme.gc_active , path + "gc_active.png");
|
||||
@ -233,80 +241,80 @@ void theme(string path)
|
||||
fseek (fp , 0, SEEK_END);
|
||||
long settings_size = ftell (fp);
|
||||
rewind (fp);
|
||||
|
||||
|
||||
if (settings_size > 0)
|
||||
{
|
||||
tree = mxmlLoadFile(NULL, fp, MXML_NO_CALLBACK);
|
||||
fclose(fp);
|
||||
|
||||
|
||||
data = mxmlFindElement(tree, tree, "#color#", NULL, NULL, MXML_DESCEND);
|
||||
|
||||
|
||||
if (mxmlElementGetAttr(data,"category")) {
|
||||
Theme.category_1 = split(mxmlElementGetAttr(data,"category"), 1);
|
||||
Theme.category_2 = split(mxmlElementGetAttr(data,"category"), 2);
|
||||
Theme.category_3 = split(mxmlElementGetAttr(data,"category"), 3);
|
||||
}
|
||||
|
||||
|
||||
if (mxmlElementGetAttr(data,"page")) {
|
||||
Theme.page_1 = split(mxmlElementGetAttr(data,"page"), 1);
|
||||
Theme.page_2 = split(mxmlElementGetAttr(data,"page"), 2);
|
||||
Theme.page_3 = split(mxmlElementGetAttr(data,"page"), 3);
|
||||
}
|
||||
|
||||
|
||||
if (mxmlElementGetAttr(data,"owner")) {
|
||||
Theme.owner_1 = split(mxmlElementGetAttr(data,"owner"), 1);
|
||||
Theme.owner_2 = split(mxmlElementGetAttr(data,"owner"), 2);
|
||||
Theme.owner_3 = split(mxmlElementGetAttr(data,"owner"), 3);
|
||||
}
|
||||
|
||||
|
||||
if (mxmlElementGetAttr(data,"title")) {
|
||||
Theme.title_1 = split(mxmlElementGetAttr(data,"title"), 1);
|
||||
Theme.title_2 = split(mxmlElementGetAttr(data,"title"), 2);
|
||||
Theme.title_3 = split(mxmlElementGetAttr(data,"title"), 3);
|
||||
}
|
||||
|
||||
|
||||
if (mxmlElementGetAttr(data,"program_name")) {
|
||||
Theme.program_name_1 = split(mxmlElementGetAttr(data,"program_name"), 1);
|
||||
Theme.program_name_2 = split(mxmlElementGetAttr(data,"program_name"), 2);
|
||||
Theme.program_name_3 = split(mxmlElementGetAttr(data,"program_name"), 3);
|
||||
}
|
||||
|
||||
|
||||
if (mxmlElementGetAttr(data,"apps")) {
|
||||
Theme.apps_1 = split(mxmlElementGetAttr(data,"apps"), 1);
|
||||
Theme.apps_2 = split(mxmlElementGetAttr(data,"apps"), 2);
|
||||
Theme.apps_3 = split(mxmlElementGetAttr(data,"apps"), 3);
|
||||
}
|
||||
|
||||
|
||||
if (mxmlElementGetAttr(data,"text")) {
|
||||
Theme.text_1 = split(mxmlElementGetAttr(data,"text"), 1);
|
||||
Theme.text_2 = split(mxmlElementGetAttr(data,"text"), 2);
|
||||
Theme.text_3 = split(mxmlElementGetAttr(data,"text"), 3);
|
||||
}
|
||||
|
||||
|
||||
if (mxmlElementGetAttr(data,"button_small_text")) {
|
||||
Theme.button_small_text_1 = split(mxmlElementGetAttr(data,"button_small_text"), 1);
|
||||
Theme.button_small_text_2 = split(mxmlElementGetAttr(data,"button_small_text"), 2);
|
||||
Theme.button_small_text_3 = split(mxmlElementGetAttr(data,"button_small_text"), 3);
|
||||
}
|
||||
|
||||
|
||||
if (mxmlElementGetAttr(data,"button_tiny_text")) {
|
||||
Theme.button_tiny_text_1 = split(mxmlElementGetAttr(data,"button_tiny_text"), 1);
|
||||
Theme.button_tiny_text_2 = split(mxmlElementGetAttr(data,"button_tiny_text"), 2);
|
||||
Theme.button_tiny_text_3 = split(mxmlElementGetAttr(data,"button_tiny_text"), 3);
|
||||
}
|
||||
|
||||
|
||||
if (mxmlElementGetAttr(data,"progressbar_color1")) {
|
||||
Theme.progressbar_color1_1 = split(mxmlElementGetAttr(data,"progressbar_color1"), 1);
|
||||
Theme.progressbar_color1_2 = split(mxmlElementGetAttr(data,"progressbar_color1"), 2);
|
||||
Theme.progressbar_color1_3 = split(mxmlElementGetAttr(data,"progressbar_color1"), 3);
|
||||
}
|
||||
|
||||
|
||||
if (mxmlElementGetAttr(data,"progressbar_color2")) {
|
||||
Theme.progressbar_color2_1 = split(mxmlElementGetAttr(data,"progressbar_color2"), 1);
|
||||
Theme.progressbar_color2_2 = split(mxmlElementGetAttr(data,"progressbar_color2"), 2);
|
||||
Theme.progressbar_color2_3 = split(mxmlElementGetAttr(data,"progressbar_color2"), 3);
|
||||
}
|
||||
|
||||
|
||||
mxmlDelete(data);
|
||||
mxmlDelete(tree);
|
||||
}
|
||||
@ -356,4 +364,4 @@ bool theme_folder_exists(string theme)
|
||||
}
|
||||
closedir (pDir);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,10 @@ struct STheme
|
||||
const u8* usb_inactive;
|
||||
const u8* sd_usb_active;
|
||||
const u8* sd_usb_inactive;
|
||||
const u8* dvd_active;
|
||||
const u8* dvd_inactive;
|
||||
const u8* all_active;
|
||||
const u8* all_inactive;
|
||||
const u8* wii_active;
|
||||
const u8* wii_inactive;
|
||||
const u8* gc_active;
|
||||
|
@ -194,6 +194,12 @@ extern const u32 dvd_active_png_size;
|
||||
extern const u8 all_active_png[];
|
||||
extern const u32 all_active_png_size;
|
||||
|
||||
extern const u8 dvd_inactive_png[];
|
||||
extern const u32 dvd_inactive_png_size;
|
||||
|
||||
extern const u8 all_inactive_png[];
|
||||
extern const u32 all_inactive_png_size;
|
||||
|
||||
extern const u8 wii_active_png[];
|
||||
extern const u32 wii_active_png_size;
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "Network/tcp.h"
|
||||
#include "BootHomebrew/BootHomebrew.h"
|
||||
#include "BootHomebrew/dolloader.h"
|
||||
#include "DiskOperations/di2.h"
|
||||
|
||||
#define HAVE_AHBPROT ((*(vu32*)0xcd800064 == 0xFFFFFFFF) ? 1 : 0)
|
||||
|
||||
@ -166,6 +167,7 @@ main(int argc, char *argv[])
|
||||
SetupPads(); // Initialize input
|
||||
// InitAudio(); // Initialize audio
|
||||
InitGUIThreads(); // Initialize GUI
|
||||
DI2_Init(); // Initialize DVD
|
||||
MountAllDevices();
|
||||
InitNetworkThread(); // Initialize Network
|
||||
InitTcpThread();
|
||||
|
@ -161,6 +161,16 @@ UpdateGUI (void *arg)
|
||||
check_sd();
|
||||
check_usb();
|
||||
}
|
||||
|
||||
else if(Settings.device == "dvd")
|
||||
check_dvd();
|
||||
|
||||
else if(Settings.device == "all")
|
||||
{
|
||||
check_sd();
|
||||
check_usb();
|
||||
check_dvd();
|
||||
}
|
||||
|
||||
// screenshoot
|
||||
if(WPAD_ButtonsDown(0) & WPAD_BUTTON_1 && WPAD_ButtonsDown(0) & WPAD_BUTTON_2)
|
||||
|
Loading…
Reference in New Issue
Block a user