*Changed DeviceThreadPriority for startup. Now it detects the HDD faster and when it is detected it goes into idle mode again.

*Fixed filebrowser to cancel without applying the path
*Added A BGM Class
*Removed the BGM menu now.

You can now choose a file with the filebrowser which you want to play. This file will be played and all .mp3 .ogg and .wav in the same directory enlisted as a Playlist.
If you choose Loop Directory mode than the files are played one after another. You can also choose a play random music from directory mode.
This commit is contained in:
dimok321 2010-01-08 09:03:40 +00:00
parent 062ce1f24d
commit 1d9b8576e3
16 changed files with 421 additions and 312 deletions

View File

@ -2,8 +2,8 @@
<app version="1">
<name> USB Loader GX</name>
<coder>USB Loader GX Team</coder>
<version>1.0 r890</version>
<release_date>201001071534</release_date>
<version>1.0 r891</version>
<release_date>201001072053</release_date>
<short_description>Loads games from USB-devices</short_description>
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.

File diff suppressed because one or more lines are too long

View File

@ -19,6 +19,7 @@
#include "homebrewboot/BootHomebrew.h"
#include "network/networkops.h"
#include "menu.h"
#include "menu/menus.h"
#include "filelist.h"
#include "sys.h"
#include "network/http.h"
@ -31,8 +32,6 @@
#include "../menu/menus.h"
/*** Extern variables ***/
extern GuiWindow * mainWindow;
extern GuiSound * bgMusic;
extern GuiImage * bgImg;
extern u32 infilesize;
extern u32 uncfilesize;

250
source/libwiigui/GuiBGM.cpp Normal file
View File

@ -0,0 +1,250 @@
/****************************************************************************
* SettingsPrompts
* USB Loader GX 2009
*
* Backgroundmusic
***************************************************************************/
#include <sys/dir.h>
#include "GuiBGM.h"
#include "menu.h"
GuiBGM::GuiBGM(const u8 *s, int l, int v)
:GuiSound(s, l, v)
{
loop = 0;
loopMode = ONCE;
currentPath = NULL;
currentPlaying = 0;
//shouldn't be needed but
//fixes some kind of weird bug in ogg system
GuiSound::Load(bg_music_ogg, bg_music_ogg_size, true);
}
GuiBGM::~GuiBGM()
{
if(currentPath)
delete [] currentPath;
ClearList();
};
void GuiBGM::SetLoop(bool l)
{
}
void GuiBGM::SetLoop(int l)
{
loop = false;
loopMode = ONCE;
if(l == LOOP)
{
loop = true;
}
else
loopMode = l;
}
bool GuiBGM::Load(const char *path)
{
if(!path)
{
LoadStandard();
return false;
}
if(strcmp(path, "") == 0)
{
LoadStandard();
return false;
}
if(!GuiSound::Load(path))
{
LoadStandard();
return false;
}
return ParsePath(path);
}
bool GuiBGM::LoadStandard()
{
ClearList();
if(currentPath)
{
delete [] currentPath;
currentPath = NULL;
}
strcpy(Settings.ogg_path, "");
bool ret = GuiSound::Load(bg_music_ogg, bg_music_ogg_size, true);
if(ret)
Play();
return ret;
}
bool GuiBGM::ParsePath(const char * folderpath)
{
ClearList();
if(currentPath)
delete [] currentPath;
currentPath = new char[strlen(folderpath)+1];
sprintf(currentPath, "%s", folderpath);
char * isdirpath = strrchr(folderpath, '.');
if(isdirpath)
{
char * pathptr = strrchr(currentPath, '/');
if(pathptr)
{
pathptr++;
pathptr[0] = 0;
}
}
char * LoadedFilename = strrchr(folderpath, '/')+1;
char filename[1024];
struct stat st;
DIR_ITER * dir = diropen(currentPath);
if (dir == NULL)
{
LoadStandard();
return false;
}
u32 counter = 0;
while (dirnext(dir,filename,&st) == 0)
{
char * fileext = strrchr(filename, '.');
if(fileext)
{
if(strcasecmp(fileext, ".mp3") == 0 || strcasecmp(fileext, ".ogg") == 0
|| strcasecmp(fileext, ".wav") == 0)
{
AddEntrie(filename);
if(strcmp(LoadedFilename, filename) == 0)
currentPlaying = counter;
counter++;
}
}
}
dirclose(dir);
snprintf(Settings.ogg_path, sizeof(Settings.ogg_path), "%s", folderpath);
return true;
}
void GuiBGM::AddEntrie(const char * filename)
{
if(!filename)
return;
char * NewEntrie = new char[strlen(filename)+1];
sprintf(NewEntrie, "%s", filename);
PlayList.push_back(NewEntrie);
}
void GuiBGM::ClearList()
{
for(u32 i = 0; i < PlayList.size(); i++)
{
if(PlayList.at(i) != NULL)
{
delete [] PlayList.at(i);
PlayList.at(i) = NULL;
}
}
PlayList.clear();
}
bool GuiBGM::PlayNext()
{
if(!currentPath)
return false;
currentPlaying++;
if(currentPlaying >= (int) PlayList.size())
currentPlaying = 0;
snprintf(Settings.ogg_path, sizeof(Settings.ogg_path), "%s%s", currentPath, PlayList.at(currentPlaying));
if(!GuiSound::Load(Settings.ogg_path))
return false;
Play();
return true;
}
bool GuiBGM::PlayPrevious()
{
if(!currentPath)
return false;
currentPlaying--;
if(currentPlaying < 0)
currentPlaying = PlayList.size()-1;
snprintf(Settings.ogg_path, sizeof(Settings.ogg_path), "%s%s", currentPath, PlayList.at(currentPlaying));
if(!GuiSound::Load(Settings.ogg_path))
return false;
Play();
return true;
}
bool GuiBGM::PlayRandom()
{
if(!currentPath)
return false;
srand (time(NULL));
currentPlaying = rand() % PlayList.size();
//just in case
if(currentPlaying < 0)
currentPlaying = PlayList.size()-1;
else if(currentPlaying >= (int) PlayList.size())
currentPlaying = 0;
snprintf(Settings.ogg_path, sizeof(Settings.ogg_path), "%s%s", currentPath, PlayList.at(currentPlaying));
if(!GuiSound::Load(Settings.ogg_path))
return false;
Play();
return true;
}
void GuiBGM::UpdateState()
{
if(!IsPlaying())
{
if(loopMode == DIR_LOOP)
{
PlayNext();
}
else if(loopMode == RANDOM_BGM)
{
PlayRandom();
}
}
}

45
source/libwiigui/GuiBGM.h Normal file
View File

@ -0,0 +1,45 @@
/****************************************************************************
* SettingsPrompts
* USB Loader GX 2009
*
* Backgroundmusic
***************************************************************************/
#ifndef _BGM_H_
#define _BGM_H_
#include "libwiigui/gui.h"
enum
{
ONCE = 0,
LOOP,
RANDOM_BGM,
DIR_LOOP
};
class GuiBGM : public GuiSound
{
public:
GuiBGM(const u8 *s, int l, int v);
~GuiBGM();
bool Load(const char *path);
bool LoadStandard();
bool ParsePath(const char * folderpath);
bool PlayNext();
bool PlayPrevious();
bool PlayRandom();
void SetLoop(bool l);
void SetLoop(int l);
void UpdateState();
protected:
void AddEntrie(const char * filename);
void ClearList();
int currentPlaying;
int loopMode;
char * currentPath;
std::vector<char *> PlayList;
};
#endif

View File

@ -41,7 +41,7 @@ GuiWindow * mainWindow = NULL;
GuiImageData * pointer[4];
GuiImage * bgImg = NULL;
GuiImageData * background = NULL;
GuiSound * bgMusic = NULL;
GuiBGM * bgMusic = NULL;
GuiSound *btnClick2 = NULL;
struct discHdr *dvdheader = NULL;
@ -135,6 +135,8 @@ static void * UpdateGUI (void *arg) {
for (int i=0; i < 4; i++)
mainWindow->Update(&userInput[i]);
if(bgMusic)
bgMusic->UpdateState();
} else {
for (int a = 5; a < 255; a += 10) {
@ -284,12 +286,9 @@ int MainMenu(int menu) {
ResumeGui();
bgMusic = new GuiSound(bg_music_ogg, bg_music_ogg_size, Settings.volume);
bgMusic->SetLoop(1); //loop music
// startup music
if (strcmp("", Settings.oggload_path) && strcmp("notset", Settings.ogg_path)) {
bgMusic->Load(Settings.ogg_path);
}
bgMusic = new GuiBGM(bg_music_ogg, bg_music_ogg_size, Settings.volume);
bgMusic->SetLoop(Settings.musicloopmode); //loop music
bgMusic->Load(Settings.ogg_path);
bgMusic->Play();
while (currentMenu != MENU_EXIT) {

View File

@ -162,6 +162,8 @@ static void * CheckDevices (void *arg)
OpenXMLDatabase(Settings.titlestxt_path,Settings.db_language, Settings.db_JPtoEN, true, Settings.titlesOverride == 1 ? true: false, true);
checkthreadState = 1;
LWP_SetThreadPriority(LWP_GetSelf(), 0);
}
}
@ -189,7 +191,7 @@ static void * CheckDevices (void *arg)
void InitCheckThread()
{
LWP_CreateThread(&checkthread, CheckDevices, NULL, NULL, 0, 0);
LWP_CreateThread(&checkthread, CheckDevices, NULL, NULL, 0, 30);
}
void ExitCheckThread()

View File

@ -4,6 +4,7 @@
#include <unistd.h>
#include "libwiigui/gui.h"
#include "libwiigui/GuiBGM.h"
#include "language/gettext.h"
#include "prompts/PromptWindows.h"
#include "menu.h"
@ -12,7 +13,7 @@
#include "sys.h"
extern GuiWindow * mainWindow;
extern GuiSound * bgMusic;
extern GuiBGM * bgMusic;
extern u8 checkthreadState;
extern u8 needToReloadGamelist;
extern u8 hddOK;

View File

@ -441,6 +441,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=
}
if (ExitBtn.GetState() == STATE_CLICKED) {
result = 0;
break;
}
else if (okBtn.GetState() == STATE_CLICKED) {

View File

@ -24,8 +24,6 @@
/*** Extern variables ***/
extern GuiWindow * mainWindow;
extern GuiSound * bgMusic;
extern struct gameXMLinfo gameinfo;
extern struct gameXMLinfo gameinfo_reset;
extern u32 gameCnt;

View File

@ -28,7 +28,7 @@ extern void titles_default();
/*** Extern variables ***/
extern GuiWindow * mainWindow;
extern GuiSound * bgMusic;
extern GuiBGM * bgMusic;
extern GuiImage * bgImg;
extern GuiImageData * pointer[4];
extern GuiImageData * background;
@ -1262,9 +1262,6 @@ int MenuSettings()
optionBrowser2.SetEffect(EFFECT_FADE, 20);
while (optionBrowser2.GetEffect() > 0) usleep(50);
char * oggfile;
bool firstRun = true;
while (!exit)
{
@ -1310,8 +1307,7 @@ int MenuSettings()
w.SetEffect(EFFECT_FADE, -20);
while (w.GetEffect()>0) usleep(50);
mainWindow->Remove(&w);
while (returnhere)
returnhere = MenuOGG();
returnhere = MenuBackgroundMusic();
HaltGui();
mainWindow->Append(&w);
w.SetEffect(EFFECT_FADE, 20);
@ -1320,13 +1316,14 @@ int MenuSettings()
} else
WindowPrompt(tr("No SD-Card inserted!"),tr("Insert an SD-Card to use this option."),tr("OK"));
}
if (!strcmp("notset", Settings.ogg_path))
options2.SetValue(Idx, "%s", tr("Standard"));
else
char * filename = strrchr(Settings.ogg_path, '/');
if(filename)
{
oggfile = strrchr(Settings.ogg_path, '/')+1;
options2.SetValue(Idx, "%s", oggfile);
filename += 1;
options2.SetValue(Idx, "%s", filename);
}
else
options2.SetValue(Idx, "%s", tr("Standard"));
}
if(ret == ++Idx || firstRun)
@ -1397,6 +1394,45 @@ int MenuSettings()
options2.SetValue(Idx,"%s", tr("OFF"));
}
if(ret == ++Idx || firstRun)
{
if(firstRun) options2.SetName(Idx, "%s",tr("Music Loop Mode"));
if(ret == Idx)
{
Settings.musicloopmode++;
if (Settings.musicloopmode > 3)
Settings.musicloopmode = 0;
bgMusic->SetLoop(Settings.musicloopmode);
}
if (Settings.musicloopmode == ONCE)
options2.SetValue(Idx,"Play Once");
else if(Settings.musicloopmode == LOOP)
options2.SetValue(Idx,"Loop Music");
else if(Settings.musicloopmode == DIR_LOOP)
options2.SetValue(Idx,"Loop Directory");
else if(Settings.musicloopmode == RANDOM_BGM)
options2.SetValue(Idx,"Random Directory Music");
}
if(ret == ++Idx || firstRun)
{
if(firstRun) options2.SetName(Idx, "%s",tr("Reset BG Music"));
if(ret == Idx)
{
int result = WindowPrompt(tr("Reset to standard BGM?"), 0, tr("Yes"), tr("No"));
if(result)
{
bgMusic->LoadStandard();
bgMusic->Play();
options2.SetValue(Idx, "%s", tr("Standard"));
}
}
options2.SetValue(Idx,tr(" "));
}
firstRun = false;
}
}

View File

@ -14,290 +14,66 @@
#include "main.h"
#include "fatmounter.h"
#include "filelist.h"
#include "prompts/filebrowser.h"
#include "sys.h"
#include "menu.h"
#include "menu/menus.h"
/*** Extern variables ***/
extern GuiWindow * mainWindow;
extern GuiSound * bgMusic;
/****************************************************************************
* MenuOGG
***************************************************************************/
bool MenuOGG() {
int cnt = 0;
int ret = 0, choice = 0;
int scrollon, nothingchanged = 0;
bool returnhere = false;
bool MenuBackgroundMusic()
{
bool ret = false;
char entered[1024];
int result = -1;
snprintf(entered, sizeof(entered), "%s", Settings.ogg_path);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
// because destroy GuiSound must wait while sound playing is finished, we use a global sound
if(!btnClick2) btnClick2=new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100];
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%ssettings_background.png", CFG.theme_path);
GuiImageData settingsbg(imgPath, settings_background_png);
GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
GuiTrigger trigB;
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
GuiTrigger trigMinus;
trigMinus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, 0);
GuiTrigger trigPlus;
trigPlus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, 0);
char fullpath[150];
char shortpath[35];
int countoggs = GetAllDirFiles(Settings.oggload_path);
if (!strcmp("", Settings.oggload_path)) {
sprintf(shortpath, "%s", tr("Standard"));
} else {
sprintf(shortpath, "%s", Settings.oggload_path);
if(strcmp(entered, "") == 0)
{
sprintf(entered, "%s", bootDevice);
}
else
{
char * pathptr = strrchr(entered, '/');
if(pathptr)
{
pathptr++;
int choice = WindowPrompt(tr("Playing Music:"), pathptr, tr("Play Previous"), tr("Play Next"), tr("Change Playpath"), tr("Cancel"));
if(choice == 1)
{
return bgMusic->PlayPrevious();
}
else if(choice == 2)
{
return bgMusic->PlayNext();
}
else if(choice == 3)
{
pathptr[0] = 0;
}
else
return true;
}
else
sprintf(entered, "%s", bootDevice);
}
GuiText titleTxt(shortpath, 24, (GXColor) {0, 0, 0, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
titleTxt.SetPosition(0,0);
GuiButton pathBtn(300, 50);
pathBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
pathBtn.SetPosition(0,28);
pathBtn.SetLabel(&titleTxt);
pathBtn.SetSoundOver(&btnSoundOver);
pathBtn.SetSoundClick(btnClick2);
pathBtn.SetTrigger(&trigA);
pathBtn.SetEffectGrow();
result = BrowseDevice(entered, sizeof(entered), FB_DEFAULT);
GuiImage oggmenubackground(&settingsbg);
oggmenubackground.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
oggmenubackground.SetPosition(0, 0);
GuiText backBtnTxt(tr("Back") , 22, THEME.prompttext);
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage backBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
backBtnTxt.SetWidescreen(CFG.widescreen);
backBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
backBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
backBtn.SetPosition(-180, 400);
backBtn.SetLabel(&backBtnTxt);
backBtn.SetImage(&backBtnImg);
backBtn.SetSoundOver(&btnSoundOver);
backBtn.SetSoundClick(btnClick2);
backBtn.SetTrigger(&trigA);
backBtn.SetTrigger(&trigB);
backBtn.SetEffectGrow();
GuiText defaultBtnTxt(tr("Default") , 22, THEME.prompttext);
defaultBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage defaultBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
defaultBtnTxt.SetWidescreen(CFG.widescreen);
defaultBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton defaultBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
defaultBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
defaultBtn.SetPosition(180, 400);
defaultBtn.SetLabel(&defaultBtnTxt);
defaultBtn.SetImage(&defaultBtnImg);
defaultBtn.SetSoundOver(&btnSoundOver);
defaultBtn.SetSoundClick(btnClick2);
defaultBtn.SetTrigger(&trigA);
defaultBtn.SetEffectGrow();
customOptionList options2(countoggs);
for (cnt = 0; cnt < countoggs; cnt++) {
options2.SetValue(cnt, "%s", GetFileName(cnt));
options2.SetName(cnt,"%i.", cnt+1);
if(result)
{
if (!bgMusic->Load(entered))
{
WindowPrompt(tr("Not supported format!"), tr("Loading standard music."), tr("OK"));
}
else
ret = true;
bgMusic->Play();
bgMusic->SetVolume(Settings.volume);
}
if (cnt < 9) {
scrollon = 0;
} else {
scrollon = 1;
}
GuiCustomOptionBrowser optionBrowser4(396, 280, &options2, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, scrollon, 10);
optionBrowser4.SetPosition(0, 90);
optionBrowser4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
snprintf(imgPath, sizeof(imgPath), "%smp3_stop.png", CFG.theme_path);
GuiImageData stop(imgPath, mp3_stop_png);
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_right.png", CFG.theme_path);
GuiImageData play(imgPath, startgame_arrow_right_png);
GuiImage playBtnImg(&play);
playBtnImg.SetWidescreen(CFG.widescreen);
GuiButton playBtn(play.GetWidth(), play.GetHeight());
playBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
playBtn.SetPosition(50, 400);
playBtn.SetImage(&playBtnImg);
playBtn.SetSoundOver(&btnSoundOver);
playBtn.SetSoundClick(btnClick2);
playBtn.SetTrigger(&trigA);
playBtn.SetTrigger(&trigPlus);
playBtn.SetEffectGrow();
GuiImage stopBtnImg(&stop);
stopBtnImg.SetWidescreen(CFG.widescreen);
GuiButton stopBtn(stop.GetWidth(), stop.GetHeight());
stopBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
stopBtn.SetPosition(-15, 400);
stopBtn.SetImage(&stopBtnImg);
stopBtn.SetSoundOver(&btnSoundOver);
stopBtn.SetSoundClick(btnClick2);
stopBtn.SetTrigger(&trigA);
stopBtn.SetTrigger(&trigMinus);
stopBtn.SetEffectGrow();
HaltGui();
GuiWindow w(screenwidth, screenheight);
w.Append(&oggmenubackground);
w.Append(&pathBtn);
w.Append(&backBtn);
w.Append(&playBtn);
w.Append(&stopBtn);
w.Append(&defaultBtn);
w.Append(&optionBrowser4);
mainWindow->Append(&w);
w.SetEffect(EFFECT_FADE, 20);
ResumeGui();
while (w.GetEffect()>0) usleep(50);
while (!returnhere) {
if (backBtn.GetState() == STATE_CLICKED) {
if (nothingchanged == 1 && countoggs > 0) {
if (strcmp("", Settings.oggload_path) && strcmp("notset", Settings.ogg_path)) {
bgMusic->Load(Settings.ogg_path);
} else {
bgMusic->Load(bg_music_ogg, bg_music_ogg_size, true);
}
bgMusic->Play();
}
backBtn.ResetState();
break;
}
if (defaultBtn.GetState() == STATE_CLICKED) {
choice = WindowPrompt(tr("Loading standard music."),0,tr("OK"), tr("Cancel"));
if (choice == 1) {
sprintf(Settings.ogg_path, "notset");
bgMusic->Load(bg_music_ogg, bg_music_ogg_size, true);
bgMusic->Play();
bgMusic->SetVolume(Settings.volume);
cfg_save_global();
}
defaultBtn.ResetState();
if (countoggs > 0)
optionBrowser4.SetFocus(1);
}
if (pathBtn.GetState() == STATE_CLICKED) {
w.Remove(&optionBrowser4);
w.Remove(&backBtn);
w.Remove(&pathBtn);
w.Remove(&playBtn);
w.Remove(&stopBtn);
w.Remove(&defaultBtn);
char entered[43] = "";
strlcpy(entered, Settings.oggload_path, sizeof(entered));
int result = OnScreenKeyboard(entered,43,0);
w.Append(&optionBrowser4);
w.Append(&pathBtn);
w.Append(&backBtn);
w.Append(&playBtn);
w.Append(&stopBtn);
w.Append(&defaultBtn);
if ( result == 1 ) {
int len = (strlen(entered)-1);
if (entered[len] !='/')
strncat (entered, "/", 1);
strlcpy(Settings.oggload_path, entered, sizeof(Settings.oggload_path));
WindowPrompt(tr("Backgroundmusic Path changed."),0,tr("OK"));
if (isInserted(bootDevice)) {
if (!strcmp("", Settings.oggload_path)) {
sprintf(Settings.ogg_path, "notset");
bgMusic->Play();
}
cfg_save_global();
returnhere = true;
break;
} else {
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"));
}
}
if (countoggs > 0) {
optionBrowser4.SetFocus(1);
}
pathBtn.ResetState();
}
ret = optionBrowser4.GetClickedOption();
if (ret>=0) {
choice = WindowPrompt(tr("Set as backgroundmusic?"),GetFileName(ret),tr("Yes"),tr("No"));
if (choice == 1) {
snprintf(fullpath,150,"%s%s",Settings.oggload_path,GetFileName(ret));
if (!bgMusic->Load(fullpath)) {
WindowPrompt(tr("Not supported format!"), tr("Loading standard music."), tr("OK"));
sprintf(Settings.ogg_path, "notset");
} else {
snprintf(Settings.ogg_path, sizeof(Settings.ogg_path), "%s", fullpath);
cfg_save_global();
bgMusic->SetVolume(Settings.volume);
nothingchanged = 0;
}
bgMusic->Play();
bgMusic->SetVolume(Settings.volume);
}
optionBrowser4.SetFocus(1);
}
if (playBtn.GetState() == STATE_CLICKED && countoggs > 0) {
if (countoggs > 0) {
ret = optionBrowser4.GetSelectedOption();
snprintf(fullpath, 150,"%s%s", Settings.oggload_path,GetFileName(ret));
if (!bgMusic->Load(fullpath)) {
WindowPrompt(tr("Not supported format!"), tr("Loading standard music."), tr("OK"));
}
bgMusic->Play();
bgMusic->SetVolume(Settings.volume);
nothingchanged = 1;
optionBrowser4.SetFocus(1);
}
playBtn.ResetState();
}
if (stopBtn.GetState() == STATE_CLICKED) {
if (countoggs > 0) {
bgMusic->Stop();
nothingchanged = 1;
optionBrowser4.SetFocus(1);
}
stopBtn.ResetState();
}
}
w.SetEffect(EFFECT_FADE, -20);
while (w.GetEffect()>0) usleep(50);
HaltGui();
mainWindow->Remove(&w);
ResumeGui();
return returnhere;
return ret;
}
/****************************************************************************

View File

@ -8,7 +8,7 @@
#ifndef _SETTINGSPROMPTS_H_
#define _SETTINGSPROMPTS_H_
bool MenuOGG();
bool MenuBackgroundMusic();
int MenuLanguageSelect();
#endif

View File

@ -195,7 +195,6 @@ void CFG_Default(int widescreen) { // -1 = non forced Mode
snprintf(Settings.unlockCode, sizeof(Settings.unlockCode), empty); // default password
snprintf(Settings.language_path, sizeof(Settings.language_path), "notset");
snprintf(Settings.languagefiles_path, sizeof(Settings.languagefiles_path), "%s/config/language/", bootDevice);
snprintf(Settings.oggload_path, sizeof(Settings.oggload_path), "%s/config/backgroundmusic/", bootDevice);
snprintf(Settings.update_path, sizeof(Settings.update_path), "%s/apps/usbloader_gx/", bootDevice);
snprintf(Settings.theme_downloadpath, sizeof(Settings.theme_downloadpath), "%s/config/themes/", bootDevice);
snprintf(Settings.homebrewapps_path, sizeof(Settings.homebrewapps_path), "%s/apps/", bootDevice);
@ -204,7 +203,7 @@ void CFG_Default(int widescreen) { // -1 = non forced Mode
snprintf(Settings.BcaCodepath, sizeof(Settings.BcaCodepath), "%s/bca/", bootDevice);
snprintf(Settings.WipCodepath, sizeof(Settings.WipCodepath), "%s/wip/", bootDevice);
snprintf(Settings.dolpath, sizeof(Settings.dolpath), "%s/", bootDevice);
sprintf(Settings.ogg_path, "notset");
strcpy(Settings.ogg_path, "");
}
//always set Theme defaults
//all alignments are left top here
@ -360,6 +359,7 @@ void Global_Default(void) {
snprintf(Settings.db_language, sizeof(Settings.db_language), empty);
Settings.db_JPtoEN = 0;
Settings.screensaver = 3;
Settings.musicloopmode = 1;
Settings.partition = -1;
Settings.marknewtitles = 1;
Settings.FatInstallToDir = 0;
@ -564,10 +564,6 @@ void path_set(char *name, char *val) {
strlcpy(Settings.TxtCheatcodespath, val, sizeof(Settings.TxtCheatcodespath));
return;
}
if (strcmp(name, "oggload_path") == 0) {
strlcpy(Settings.oggload_path, val, sizeof(Settings.oggload_path));
return;
}
if (strcmp(name, "dolpath") == 0) {
strlcpy(Settings.dolpath, val, sizeof(Settings.dolpath));
return;
@ -1100,6 +1096,12 @@ void global_cfg_set(char *name, char *val) {
Settings.screensaver = i;
}
return;
} else if (strcmp(name, "musicloopmode") == 0) {
int i;
if (sscanf(val, "%d", &i) == 1) {
Settings.musicloopmode = i;
}
return;
} else if (strcmp(name, "partition") == 0) {
int i;
if (sscanf(val, "%d", &i) == 1) {
@ -1349,7 +1351,6 @@ bool cfg_save_global() { // save global settings
fprintf(f, "disc_path = %s\n ", Settings.disc_path);
fprintf(f, "language_path = %s\n ", Settings.language_path);
fprintf(f, "languagefiles_path = %s\n ", Settings.languagefiles_path);
fprintf(f, "oggload_path = %s\n ", Settings.oggload_path);
fprintf(f, "TxtCheatcodespath = %s\n ", Settings.TxtCheatcodespath);
fprintf(f, "titlestxt_path = %s\n ", Settings.titlestxt_path);
fprintf(f, "gamesound = %d\n ", Settings.gamesound);
@ -1369,6 +1370,7 @@ bool cfg_save_global() { // save global settings
//fprintf(f, "db_language = %d\n ", Settings.language);
fprintf(f, "patchcountrystrings = %d\n ", Settings.patchcountrystrings);
fprintf(f, "screensaver = %d\n ", Settings.screensaver);
fprintf(f, "musicloopmode = %d\n ", Settings.musicloopmode);
fprintf(f, "error002 = %d\n ", Settings.error002);
fprintf(f, "autonetwork = %d\n ", Settings.autonetwork);
fprintf(f, "discart = %d\n ", Settings.discart);

View File

@ -414,6 +414,7 @@ extern "C" {
u8 patchcountrystrings;
u8 screensaver;
s8 partition;
s8 musicloopmode;
short godmode;
char covers_path[100];
char covers2d_path[100];
@ -424,8 +425,7 @@ extern "C" {
char titlestxt_path[100];
char language_path[100];
char languagefiles_path[100];
char oggload_path[100];
char ogg_path[150];
char ogg_path[250];
char dolpath[150];
char update_path[150];
char homebrewapps_path[150];