mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-12-18 16:01:58 +01:00
*Fixed gamebrowser wrong DPAD behaviour after switching from Carousell
*Fixed browsers not getting darker when going into HOME Menu *Removed MP3 Menu *Added Patch Country Strings (thanks to WiiPower and SoftChip Team) Note: "This is an option for import games only. If you have problems with that try this option. Mostly japanese users need that. *some other small fixes **Note 2: Right now the loader is having some issue with IOS Reload. If you initialized network and try to run a game and its not working its due to that bug. I am trying to find why it isnt working right now. FreetypGX is making codedumps on there sometimes (ardi look into it you missed something). ** Also there is a new libogc in our download in which there are new libfat and libogc files. If you had issues with SD they might now be fixed, so try it out.
This commit is contained in:
parent
95c7c51355
commit
e8de174866
File diff suppressed because one or more lines are too long
@ -217,7 +217,7 @@ bool Search_and_patch_Video_Modes(void *Address, u32 Size, GXRModeObj* Table[])
|
||||
return found;
|
||||
}
|
||||
|
||||
s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch)
|
||||
s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8 patchcountrystring)
|
||||
{
|
||||
app_entry appldr_entry;
|
||||
app_init appldr_init;
|
||||
@ -315,6 +315,10 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch)
|
||||
/*LANGUAGE PATCH - FISHEARS*/
|
||||
langpatcher(dst,len);
|
||||
|
||||
/*Thanks to WiiPower*/
|
||||
if(patchcountrystring == 1)
|
||||
PatchCountryStrings(dst, len);
|
||||
|
||||
DCFlushRange(dst, len);
|
||||
}
|
||||
/* Set entry point from apploader */
|
||||
|
@ -5,6 +5,6 @@
|
||||
typedef void (*entry_point)(void);
|
||||
|
||||
/* Prototypes */
|
||||
s32 Apploader_Run(entry_point *, u8, u8, u8);
|
||||
s32 Apploader_Run(entry_point *, u8, u8, u8, u8);
|
||||
|
||||
#endif
|
||||
|
33
source/cfg.c
33
source/cfg.c
@ -935,6 +935,13 @@ void global_cfg_set(char *name, char *val)
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "patchcountrystrings") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
Settings.patchcountrystrings = i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (strcmp(name, "gameDisplay") == 0) {
|
||||
int i;
|
||||
if (sscanf(val, "%d", &i) == 1) {
|
||||
@ -1001,12 +1008,11 @@ bool cfg_parsefile(char *fname, void (*set_func)(char*, char*))
|
||||
char line[200];
|
||||
|
||||
//printf("opening(%s)\n", fname);
|
||||
f = fopen(fname, "rt");
|
||||
f = fopen(fname, "r");
|
||||
if (!f) {
|
||||
//printf("error opening(%s)\n", fname);
|
||||
return false;
|
||||
}
|
||||
|
||||
while (fgets(line, sizeof(line), f)) {
|
||||
// lines starting with # are comments
|
||||
if (line[0] == '#') continue;
|
||||
@ -1022,7 +1028,7 @@ bool cfg_parsetitlefile(char *fname, void (*set_func)(char*, char*, u8))
|
||||
char line[200];
|
||||
|
||||
//printf("opening(%s)\n", fname);
|
||||
f = fopen(fname, "rt");
|
||||
f = fopen(fname, "r");
|
||||
if (!f) {
|
||||
//printf("error opening(%s)\n", fname);
|
||||
return false;
|
||||
@ -1110,7 +1116,7 @@ bool cfg_save_global()// save global settings
|
||||
mkdir("SD:/config", 0777);
|
||||
}
|
||||
FILE *f;
|
||||
f = fopen("SD:/config/GXGlobal.cfg", "wt");
|
||||
f = fopen("SD:/config/GXGlobal.cfg", "w");
|
||||
if (!f) {
|
||||
printf("Error saving %s\n", "GXGlobal.cfg");
|
||||
sleep(1);
|
||||
@ -1120,7 +1126,7 @@ bool cfg_save_global()// save global settings
|
||||
fprintf(f, "# Note: This file is automatically generated\n");
|
||||
fclose(f);
|
||||
/* Closing and reopening because of a write issue we are having right now */
|
||||
f = fopen("SD:/config/GXGlobal.cfg", "wt");
|
||||
f = fopen("SD:/config/GXGlobal.cfg", "w");
|
||||
fprintf(f, "# USB Loader global settings file\n");
|
||||
fprintf(f, "# Note: This file is automatically generated\n");
|
||||
fprintf(f, "video = %d\n ", Settings.video);
|
||||
@ -1161,6 +1167,7 @@ bool cfg_save_global()// save global settings
|
||||
fprintf(f, "wiilight = %d\n ", Settings.wiilight);
|
||||
fprintf(f, "gameDisplay = %d\n ", Settings.gameDisplay);
|
||||
fprintf(f, "update_path = %s\n ", CFG.update_path);
|
||||
fprintf(f, "patchcountrystrings = %d\n ", Settings.patchcountrystrings);
|
||||
fclose(f);
|
||||
return true;
|
||||
}
|
||||
@ -1280,17 +1287,22 @@ bool cfg_load_game_num()
|
||||
return cfg_parsefile("SD:/config/GXGameFavorites.cfg", &game_set_num);
|
||||
}
|
||||
|
||||
bool cfg_save_games()// save per game setings
|
||||
bool cfg_save_games()
|
||||
{
|
||||
FILE *f;
|
||||
int i;
|
||||
mkdir("SD:/config/", 0777);
|
||||
f = fopen("SD:/config/GXGameSettings.cfg", "wt");
|
||||
f = fopen("SD:/config/GXGameSettings.cfg", "w");
|
||||
if (!f) {
|
||||
printf("Error saving %s\n", "GXGameSettings.cfg");
|
||||
sleep(1);
|
||||
return false;
|
||||
}
|
||||
fprintf(f, "# USB Loader settings file\n");
|
||||
fprintf(f, "# note: this file is automatically generated\n");
|
||||
fclose(f);
|
||||
/* Closing and reopening because of a write issue we are having right now */
|
||||
f = fopen("SD:/config/GXGameSettings.cfg", "w");
|
||||
fprintf(f, "# USB Loader settings file\n");
|
||||
fprintf(f, "# note: this file is automatically generated\n");
|
||||
fprintf(f, "# Num Games: %d\n", num_saved_games);
|
||||
@ -1316,12 +1328,17 @@ bool cfg_save_game_num()
|
||||
FILE *f;
|
||||
int i;
|
||||
mkdir("SD:/config/", 0777);
|
||||
f = fopen("SD:/config/GXGameFavorites.cfg", "wt");
|
||||
f = fopen("SD:/config/GXGameFavorites.cfg", "w");
|
||||
if (!f) {
|
||||
printf("Error saving %s\n", "GXGameFavorites.cfg");
|
||||
sleep(1);
|
||||
return false;
|
||||
}
|
||||
fprintf(f, "# USB Loader settings file\n");
|
||||
fprintf(f, "# note: this file is automatically generated\n");
|
||||
fclose(f);
|
||||
/* Closing and reopening because of a write issue we are having right now */
|
||||
f = fopen("SD:/config/GXGameFavorites.cfg", "w");
|
||||
fprintf(f, "# USB Loader settings file\n");
|
||||
fprintf(f, "# note: this file is automatically generated\n");
|
||||
fprintf(f, "# Num Games: %d\n", num_saved_game_num);
|
||||
|
@ -340,6 +340,7 @@ struct SSettings {
|
||||
int fave;
|
||||
int wiilight;
|
||||
int gameDisplay;
|
||||
int patchcountrystrings;
|
||||
};
|
||||
|
||||
void CFG_LoadGlobal(void);
|
||||
|
@ -248,7 +248,7 @@ s32 Disc_IsWii(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 Disc_BootPartition(u64 offset, u8 videoselected, u8 cheat, u8 vipatch)
|
||||
s32 Disc_BootPartition(u64 offset, u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring)
|
||||
{
|
||||
entry_point p_entry;
|
||||
|
||||
@ -260,7 +260,7 @@ s32 Disc_BootPartition(u64 offset, u8 videoselected, u8 cheat, u8 vipatch)
|
||||
return ret;
|
||||
|
||||
/* Run apploader */
|
||||
ret = Apploader_Run(&p_entry, cheat, videoselected, vipatch);
|
||||
ret = Apploader_Run(&p_entry, cheat, videoselected, vipatch, patchcountrystring);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -295,7 +295,7 @@ s32 Disc_BootPartition(u64 offset, u8 videoselected, u8 cheat, u8 vipatch)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 Disc_WiiBoot(u8 videoselected, u8 cheat, u8 vipatch)
|
||||
s32 Disc_WiiBoot(u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring)
|
||||
{
|
||||
u64 offset;
|
||||
s32 ret;
|
||||
@ -306,5 +306,85 @@ s32 Disc_WiiBoot(u8 videoselected, u8 cheat, u8 vipatch)
|
||||
return ret;
|
||||
|
||||
/* Boot partition */
|
||||
return Disc_BootPartition(offset, videoselected, cheat, vipatch);
|
||||
return Disc_BootPartition(offset, videoselected, cheat, vipatch, patchcountrystring);
|
||||
}
|
||||
|
||||
void PatchCountryStrings(void *Address, int Size)
|
||||
{
|
||||
u8 SearchPattern[4] = { 0x00, 0x00, 0x00, 0x00 };
|
||||
u8 PatchData[4] = { 0x00, 0x00, 0x00, 0x00 };
|
||||
u8 *Addr = (u8*)Address;
|
||||
|
||||
int wiiregion = CONF_GetRegion();
|
||||
|
||||
switch (wiiregion)
|
||||
{
|
||||
case CONF_REGION_JP:
|
||||
SearchPattern[0] = 0x00;
|
||||
SearchPattern[1] = 0x4A; // J
|
||||
SearchPattern[2] = 0x50; // P
|
||||
break;
|
||||
case CONF_REGION_EU:
|
||||
SearchPattern[0] = 0x02;
|
||||
SearchPattern[1] = 0x45; // E
|
||||
SearchPattern[2] = 0x55; // U
|
||||
break;
|
||||
case CONF_REGION_KR:
|
||||
SearchPattern[0] = 0x04;
|
||||
SearchPattern[1] = 0x4B; // K
|
||||
SearchPattern[2] = 0x52; // R
|
||||
break;
|
||||
case CONF_REGION_CN:
|
||||
SearchPattern[0] = 0x05;
|
||||
SearchPattern[1] = 0x43; // C
|
||||
SearchPattern[2] = 0x4E; // N
|
||||
break;
|
||||
case CONF_REGION_US:
|
||||
default:
|
||||
SearchPattern[0] = 0x01;
|
||||
SearchPattern[1] = 0x55; // U
|
||||
SearchPattern[2] = 0x53; // S
|
||||
}
|
||||
|
||||
switch (diskid[3])
|
||||
{
|
||||
case 'J':
|
||||
PatchData[1] = 0x4A; // J
|
||||
PatchData[2] = 0x50; // P
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
case 'F':
|
||||
case 'P':
|
||||
case 'X':
|
||||
case 'Y':
|
||||
PatchData[1] = 0x45; // E
|
||||
PatchData[2] = 0x55; // U
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
default:
|
||||
PatchData[1] = 0x55; // U
|
||||
PatchData[2] = 0x53; // S
|
||||
}
|
||||
|
||||
while (Size >= 4)
|
||||
{
|
||||
if (Addr[0] == SearchPattern[0] && Addr[1] == SearchPattern[1] && Addr[2] == SearchPattern[2] && Addr[3] == SearchPattern[3])
|
||||
{
|
||||
//*Addr = PatchData[0];
|
||||
Addr += 1;
|
||||
*Addr = PatchData[1];
|
||||
Addr += 1;
|
||||
*Addr = PatchData[2];
|
||||
Addr += 1;
|
||||
//*Addr = PatchData[3];
|
||||
Addr += 1;
|
||||
Size -= 4;
|
||||
} else
|
||||
{
|
||||
Addr += 4;
|
||||
Size -= 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,8 +46,9 @@ void __Disc_SetLowMem(void);
|
||||
s32 Disc_SetUSB(u8 *, int ios222);
|
||||
s32 Disc_ReadHeader(void *);
|
||||
s32 Disc_IsWii(void);
|
||||
s32 Disc_BootPartition(u64, u8, u8, u8);
|
||||
s32 Disc_WiiBoot(u8, u8, u8);
|
||||
s32 Disc_BootPartition(u64, u8, u8, u8, u8);
|
||||
s32 Disc_WiiBoot(u8, u8, u8, u8);
|
||||
void PatchCountryStrings(void *Address, int Size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ snprintf(LANGUAGE.Loadingstandardlanguage, sizeof(LANGUAGE.Loadingstandardlangua
|
||||
snprintf(LANGUAGE.Loadingstandardmusic, sizeof(LANGUAGE.Loadingstandardmusic), "Loading standard music.");
|
||||
snprintf(LANGUAGE.Lock, sizeof(LANGUAGE.Lock), "Lock");
|
||||
snprintf(LANGUAGE.LockConsole, sizeof(LANGUAGE.LockConsole), "Lock Console");
|
||||
snprintf(LANGUAGE.MP3Menu, sizeof(LANGUAGE.MP3Menu), "MP3 Menu");
|
||||
snprintf(LANGUAGE.Patchcountrystrings, sizeof(LANGUAGE.Patchcountrystrings), "Patch Country Strings");
|
||||
snprintf(LANGUAGE.Missingfiles, sizeof(LANGUAGE.Missingfiles), "Missing files");
|
||||
snprintf(LANGUAGE.Networkiniterror, sizeof(LANGUAGE.Networkiniterror), "Network init error");
|
||||
snprintf(LANGUAGE.Neither, sizeof(LANGUAGE.Neither), "Neither");
|
||||
@ -664,8 +664,8 @@ void language_set(char *name, char *val)
|
||||
strcopy(LANGUAGE.LockConsole, val, sizeof(LANGUAGE.LockConsole));
|
||||
return;
|
||||
}
|
||||
if (strcmp(name, "MP3Menu") == 0) {
|
||||
strcopy(LANGUAGE.MP3Menu, val, sizeof(LANGUAGE.MP3Menu));
|
||||
if (strcmp(name, "Patchcountrystrings") == 0) {
|
||||
strcopy(LANGUAGE.Patchcountrystrings, val, sizeof(LANGUAGE.Patchcountrystrings));
|
||||
return;
|
||||
}
|
||||
if (strcmp(name, "Missingfiles") == 0) {
|
||||
|
@ -116,7 +116,7 @@ struct LANGUAGE
|
||||
char Loadingstandardmusic[80];
|
||||
char Lock[30];
|
||||
char LockConsole[50];
|
||||
char MP3Menu[40];
|
||||
char Patchcountrystrings[80];
|
||||
char Missingfiles[50];
|
||||
char Networkiniterror[50];
|
||||
char Neither[40];
|
||||
|
@ -642,6 +642,7 @@ void GuiGameBrowser::Reload(struct discHdr * l, int count)
|
||||
scrollbaron = (gameCnt > pagesize) ? 1 : 0;
|
||||
selectedItem = 0;
|
||||
listOffset = 0;
|
||||
focus = 1;
|
||||
UpdateListEntries();
|
||||
|
||||
for(int i=0; i<pagesize; i++)
|
||||
|
50
source/listfiles.c
Normal file
50
source/listfiles.c
Normal file
@ -0,0 +1,50 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <gccore.h>
|
||||
#include <fat.h>
|
||||
#include <sys/dir.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "listfiles.h"
|
||||
|
||||
|
||||
char filename[80];
|
||||
|
||||
|
||||
s32 filenamescmp(const void *a, const void *b)
|
||||
{
|
||||
/* Compare strings */
|
||||
return stricmp((char *)a, (char *)b);
|
||||
}
|
||||
|
||||
int GetFiles(char * filespath)
|
||||
{
|
||||
|
||||
int countfiles = 0;
|
||||
|
||||
struct stat st;
|
||||
DIR_ITER* dir;
|
||||
dir = diropen (filespath);
|
||||
|
||||
if (dir == NULL) //If empty
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (dirnext(dir,filename,&st) == 0)
|
||||
{
|
||||
if ((st.st_mode & S_IFDIR) == 0)
|
||||
{
|
||||
// st.st_mode & S_IFDIR indicates a directory
|
||||
snprintf(alldirfiles[countfiles], 70, "%s", filename);
|
||||
countfiles++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
qsort(alldirfiles, countfiles, sizeof(char[70]), filenamescmp);
|
||||
|
||||
return countfiles;
|
||||
}
|
18
source/listfiles.h
Normal file
18
source/listfiles.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef _LISTFILES_H_
|
||||
#define _LISTFILES_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
char alldirfiles[300][70];
|
||||
|
||||
int GetFiles(char * filespath);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -101,6 +101,7 @@ DefaultSettings()
|
||||
Settings.qboot = no;
|
||||
Settings.unicodefix = 0;
|
||||
Settings.wiilight = 1;
|
||||
Settings.patchcountrystrings = 0;
|
||||
|
||||
CFG_LoadGlobal();
|
||||
}
|
||||
@ -137,8 +138,6 @@ main(int argc, char *argv[])
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
}
|
||||
|
||||
fatInit(1, true);
|
||||
|
||||
SDCard_Init();
|
||||
|
||||
Sys_Init();
|
||||
|
300
source/menu.cpp
300
source/menu.cpp
@ -40,7 +40,7 @@
|
||||
#include "libwiigui/gui_customoptionbrowser.h"
|
||||
#include "libwiigui/gui_gamebrowser.h"
|
||||
#include "libwiigui/gui_diskcover.h"
|
||||
#include "mp3s.h"
|
||||
#include "listfiles.h"
|
||||
#include "fatmounter.h"
|
||||
#include "updater.h"
|
||||
|
||||
@ -3609,9 +3609,13 @@ static int MenuDiscList()
|
||||
carouselBtn.SetImage(&carouselBtnImg_g);
|
||||
carouselBtn.SetAlpha(180);
|
||||
}
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
Settings.gameDisplay=list;
|
||||
gameBrowser.Reload(gameList, gameCnt); // initialize before append
|
||||
mainWindow->Append(&gameBrowser);
|
||||
mainWindow->Append(&w);
|
||||
ResumeGui();
|
||||
listBtn.SetImage(&listBtnImg);
|
||||
listBtn.SetAlpha(255);
|
||||
if(CFG.widescreen)
|
||||
@ -3665,9 +3669,13 @@ static int MenuDiscList()
|
||||
carouselBtn.SetImage(&carouselBtnImg_g);
|
||||
carouselBtn.SetAlpha(180);
|
||||
}
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
Settings.gameDisplay=grid;
|
||||
gameGrid.Reload(gameList, gameCnt); // initialize before append
|
||||
mainWindow->Append(&gameGrid);
|
||||
mainWindow->Append(&w);
|
||||
ResumeGui();
|
||||
gridBtn.SetImage(&gridBtnImg);
|
||||
gridBtn.SetAlpha(255);
|
||||
if(CFG.widescreen)
|
||||
@ -3718,9 +3726,13 @@ static int MenuDiscList()
|
||||
mainWindow->Remove(&gameGrid);
|
||||
gridBtn.SetImage(&gridBtnImg_g);
|
||||
gridBtn.SetAlpha(180);
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
Settings.gameDisplay=carousel;
|
||||
gameCarousel.Reload(gameList, gameCnt); // initialize before append
|
||||
mainWindow->Append(&gameCarousel);
|
||||
mainWindow->Append(&w);
|
||||
ResumeGui();
|
||||
carouselBtn.SetImage(&carouselBtnImg);
|
||||
carouselBtn.SetAlpha(255);
|
||||
if(CFG.widescreen)
|
||||
@ -4088,6 +4100,7 @@ static int MenuDiscList()
|
||||
LANGUAGE.Failedtoboot,
|
||||
text,
|
||||
LANGUAGE.ok,0,0,0);
|
||||
|
||||
}
|
||||
else {
|
||||
menu = MENU_EXIT;
|
||||
@ -4615,7 +4628,7 @@ static int MenuSettings()
|
||||
options2.SetName(4, "%s",LANGUAGE.Backgroundmusic);
|
||||
options2.SetName(5, "%s",LANGUAGE.Wiilight);
|
||||
options2.SetName(6, "%s",LANGUAGE.Updatepath);
|
||||
options2.SetName(7, "%s",LANGUAGE.MP3Menu);
|
||||
options2.SetName(7, "%s",LANGUAGE.Patchcountrystrings);
|
||||
options2.SetName(8, "%s",LANGUAGE.Defaultsettings);
|
||||
|
||||
}
|
||||
@ -5000,6 +5013,8 @@ static int MenuSettings()
|
||||
Settings.unicodefix = 0;
|
||||
if ( Settings.wiilight > 2 )
|
||||
Settings.wiilight = 0;
|
||||
if ( Settings.patchcountrystrings > 1)
|
||||
Settings.patchcountrystrings = 0;
|
||||
|
||||
options2.SetValue(0, "%s", CFG.titlestxt_path);
|
||||
|
||||
@ -5024,7 +5039,10 @@ static int MenuSettings()
|
||||
else if (Settings.wiilight == 2) options2.SetValue(5,"%s",LANGUAGE.OnlyInstall);
|
||||
|
||||
options2.SetValue(6, "%s", CFG.update_path);
|
||||
options2.SetValue(7, "not working!");
|
||||
|
||||
if (Settings.patchcountrystrings == 0) options2.SetValue(7,"%s",LANGUAGE.OFF);
|
||||
else if (Settings.patchcountrystrings == 1) options2.SetValue(7,"%s",LANGUAGE.ON);
|
||||
|
||||
options2.SetValue(8, " ");
|
||||
|
||||
ret = optionBrowser2.GetClickedOption();
|
||||
@ -5135,12 +5153,7 @@ static int MenuSettings()
|
||||
Settings.wiilight++;
|
||||
break;
|
||||
case 7:
|
||||
if(isSdInserted())
|
||||
{
|
||||
menu = MENU_MP3;
|
||||
pageToDisplay = 0;
|
||||
} else
|
||||
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtousethatoption, LANGUAGE.ok, 0,0,0);
|
||||
Settings.patchcountrystrings++;
|
||||
break;
|
||||
case 6:
|
||||
if ( CFG.godmode == 1)
|
||||
@ -5819,7 +5832,7 @@ int MenuOGG()
|
||||
|
||||
char fullpath[150];
|
||||
char shortpath[35];
|
||||
int countmp3 = GetFiles(CFG.oggload_path);
|
||||
int countoggs = GetFiles(CFG.oggload_path);
|
||||
|
||||
if(!strcmp("", CFG.oggload_path)) {
|
||||
sprintf(shortpath, "%s", LANGUAGE.Standard);
|
||||
@ -5848,12 +5861,13 @@ int MenuOGG()
|
||||
oggmenubackground.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
oggmenubackground.SetPosition(0, 0);
|
||||
|
||||
GuiText backBtnTxt(LANGUAGE.Back , 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
||||
GuiText backBtnTxt(LANGUAGE.Back , 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage backBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes){
|
||||
backBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
backBtnImg.SetWidescreen(CFG.widescreen);}//////
|
||||
backBtnImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
||||
backBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
backBtn.SetPosition(-180, 400);
|
||||
@ -5865,11 +5879,11 @@ int MenuOGG()
|
||||
backBtn.SetTrigger(&trigB);
|
||||
backBtn.SetEffectGrow();
|
||||
|
||||
customOptionList options2(countmp3);
|
||||
customOptionList options2(countoggs);
|
||||
|
||||
for (cnt = 0; cnt < countmp3; cnt++) {
|
||||
for (cnt = 0; cnt < countoggs; cnt++) {
|
||||
char tmp[30];
|
||||
snprintf(tmp , 30, "%s", mp3files[cnt]);
|
||||
snprintf(tmp , 30, "%s", alldirfiles[cnt]);
|
||||
options2.SetValue(cnt, "%s", tmp);
|
||||
options2.SetName(cnt,"%i.", cnt+1);
|
||||
}
|
||||
@ -5961,7 +5975,7 @@ int MenuOGG()
|
||||
{
|
||||
|
||||
if (backBtn.GetState() == STATE_CLICKED) {
|
||||
if(nothingchanged == 1 && countmp3 > 0) {
|
||||
if(nothingchanged == 1 && countoggs > 0) {
|
||||
if(!strcmp("", CFG.oggload_path) || !strcmp("notset", CFG.ogg_path)) {
|
||||
bgMusic->Play();
|
||||
} else {
|
||||
@ -6008,7 +6022,7 @@ int MenuOGG()
|
||||
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0);
|
||||
}
|
||||
}
|
||||
if(countmp3 > 0) {
|
||||
if(countoggs > 0) {
|
||||
optionBrowser4.SetFocus(1);
|
||||
}
|
||||
pathBtn.ResetState();
|
||||
@ -6017,9 +6031,9 @@ int MenuOGG()
|
||||
ret = optionBrowser4.GetClickedOption();
|
||||
|
||||
if(ret>=0) {
|
||||
choice = WindowPrompt(LANGUAGE.Setasbackgroundmusic,mp3files[ret],LANGUAGE.Yes,LANGUAGE.No,0,0);
|
||||
choice = WindowPrompt(LANGUAGE.Setasbackgroundmusic,alldirfiles[ret],LANGUAGE.Yes,LANGUAGE.No,0,0);
|
||||
if(choice == 1) {
|
||||
snprintf(fullpath,150,"%s%s",CFG.oggload_path,mp3files[ret]);
|
||||
snprintf(fullpath,150,"%s%s",CFG.oggload_path,alldirfiles[ret]);
|
||||
choice = bgMusic->PlayOggFile(fullpath);
|
||||
if(choice < 0) {
|
||||
WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0);
|
||||
@ -6036,11 +6050,11 @@ int MenuOGG()
|
||||
optionBrowser4.SetFocus(1);
|
||||
}
|
||||
|
||||
if (playBtn.GetState() == STATE_CLICKED && countmp3 > 0) {
|
||||
if(countmp3 > 0) {
|
||||
if (playBtn.GetState() == STATE_CLICKED && countoggs > 0) {
|
||||
if(countoggs > 0) {
|
||||
ret = optionBrowser4.GetSelectedOption();
|
||||
songPlaying=ret;
|
||||
snprintf(fullpath, 150,"%s%s", CFG.oggload_path,mp3files[ret]);
|
||||
snprintf(fullpath, 150,"%s%s", CFG.oggload_path,alldirfiles[ret]);
|
||||
choice = bgMusic->PlayOggFile(fullpath);
|
||||
if(choice < 0) {
|
||||
WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0);
|
||||
@ -6059,10 +6073,10 @@ int MenuOGG()
|
||||
}
|
||||
|
||||
if(nextBtn.GetState() == STATE_CLICKED){
|
||||
if(countmp3 > 0) {
|
||||
if(countoggs > 0) {
|
||||
songPlaying++;
|
||||
if (songPlaying>(countmp3 - 1)){songPlaying=0;}
|
||||
snprintf(fullpath,150,"%s%s", CFG.oggload_path,mp3files[songPlaying]);
|
||||
if (songPlaying>(countoggs - 1)){songPlaying=0;}
|
||||
snprintf(fullpath,150,"%s%s", CFG.oggload_path,alldirfiles[songPlaying]);
|
||||
choice = bgMusic->PlayOggFile(fullpath);
|
||||
if(choice < 0) {
|
||||
WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0);
|
||||
@ -6079,10 +6093,10 @@ int MenuOGG()
|
||||
nextBtn.ResetState();
|
||||
}
|
||||
if(prevBtn.GetState() == STATE_CLICKED) {
|
||||
if(countmp3 > 0) {
|
||||
if(countoggs > 0) {
|
||||
songPlaying--;
|
||||
if (songPlaying<0){songPlaying=(countmp3 - 1);}
|
||||
snprintf(fullpath,150,"%s%s", CFG.oggload_path,mp3files[songPlaying]);
|
||||
if (songPlaying<0){songPlaying=(countoggs - 1);}
|
||||
snprintf(fullpath,150,"%s%s", CFG.oggload_path,alldirfiles[songPlaying]);
|
||||
choice = bgMusic->PlayOggFile(fullpath);
|
||||
if(choice < 0) {
|
||||
WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0);
|
||||
@ -6099,7 +6113,7 @@ int MenuOGG()
|
||||
prevBtn.ResetState();
|
||||
}
|
||||
if(stopBtn.GetState() == STATE_CLICKED) {
|
||||
if(countmp3 > 0) {
|
||||
if(countoggs > 0) {
|
||||
StopOgg();
|
||||
nothingchanged = 1;
|
||||
optionBrowser4.SetFocus(1);
|
||||
@ -6116,221 +6130,6 @@ int MenuOGG()
|
||||
return menu;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* MenuMp3
|
||||
***************************************************************************/
|
||||
int MenuMp3()
|
||||
{
|
||||
int menu = MENU_NONE, cnt = 0;
|
||||
int ret = 0;
|
||||
int scrollon, i = 0;
|
||||
char imgPath[100];
|
||||
|
||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol);
|
||||
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, vol);
|
||||
|
||||
GuiTrigger trigA;
|
||||
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
|
||||
char mp3path[30] = "SD:/mp3/";
|
||||
char fullpath[110];
|
||||
int countmp3 = GetFiles(mp3path);
|
||||
|
||||
customOptionList options2(countmp3);
|
||||
|
||||
for (cnt = 0; cnt < countmp3; cnt++) {
|
||||
char tmp[30];
|
||||
snprintf(tmp , 30, "%s", mp3files[cnt]);
|
||||
options2.SetValue(cnt, "%s", tmp);
|
||||
options2.SetName(cnt,"%i.", cnt+1);
|
||||
}
|
||||
// options2.length = cnt;
|
||||
|
||||
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
||||
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
||||
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, 85);
|
||||
optionBrowser4.SetPosition(0, 90);
|
||||
optionBrowser4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
|
||||
GuiText cancelBtnTxt(LANGUAGE.Back, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255});
|
||||
cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage cancelBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes){
|
||||
cancelBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
cancelBtnImg.SetWidescreen(CFG.widescreen);}
|
||||
GuiButton cancelBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
||||
cancelBtn.SetScale(0.9);
|
||||
cancelBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
cancelBtn.SetPosition(210, 400);
|
||||
cancelBtn.SetLabel(&cancelBtnTxt);
|
||||
cancelBtn.SetImage(&cancelBtnImg);
|
||||
cancelBtn.SetSoundOver(&btnSoundOver);
|
||||
cancelBtn.SetTrigger(&trigA);
|
||||
cancelBtn.SetEffectGrow();
|
||||
|
||||
int songPlaying=0;
|
||||
|
||||
GuiTrigger trigHome;
|
||||
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
|
||||
GuiTrigger trigL;
|
||||
trigL.SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT);
|
||||
GuiTrigger trigR;
|
||||
trigR.SetButtonOnlyTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT);
|
||||
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);
|
||||
|
||||
snprintf(imgPath, sizeof(imgPath), "%sarrow_next.png", CFG.theme_path);
|
||||
GuiImageData next(imgPath, arrow_next_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%sarrow_previous.png", CFG.theme_path);
|
||||
GuiImageData prev(imgPath, arrow_previous_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%smp3_stop.png", CFG.theme_path);
|
||||
GuiImageData stop(imgPath, mp3_stop_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%smp3_pause.png", CFG.theme_path);
|
||||
GuiImageData pause(imgPath, mp3_pause_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_right.png", CFG.theme_path);
|
||||
GuiImageData play(imgPath, startgame_arrow_right_png);
|
||||
|
||||
GuiImage nextBtnImg(&next);
|
||||
GuiButton nextBtn(next.GetWidth(), next.GetHeight());
|
||||
nextBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
nextBtn.SetPosition(100, 400);
|
||||
nextBtn.SetImage(&nextBtnImg);
|
||||
nextBtn.SetSoundOver(&btnSoundOver);
|
||||
nextBtn.SetSoundClick(&btnClick);
|
||||
nextBtn.SetTrigger(&trigA);
|
||||
nextBtn.SetTrigger(&trigR);
|
||||
nextBtn.SetEffectGrow();
|
||||
|
||||
GuiImage prevBtnImg(&prev);
|
||||
prevBtnImg.SetWidescreen(CFG.widescreen);
|
||||
GuiButton prevBtn(prev.GetWidth(), prev.GetHeight());
|
||||
prevBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
prevBtn.SetPosition(-100, 400);
|
||||
prevBtn.SetImage(&prevBtnImg);
|
||||
prevBtn.SetSoundOver(&btnSoundOver);
|
||||
prevBtn.SetSoundClick(&btnClick);
|
||||
prevBtn.SetTrigger(&trigA);
|
||||
prevBtn.SetTrigger(&trigL);
|
||||
prevBtn.SetEffectGrow();
|
||||
|
||||
GuiImage playBtnImg(&play);
|
||||
playBtnImg.SetWidescreen(CFG.widescreen);
|
||||
GuiButton playBtn(play.GetWidth(), play.GetHeight());
|
||||
playBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
playBtn.SetPosition(42, 400);
|
||||
playBtn.SetImage(&playBtnImg);
|
||||
playBtn.SetSoundOver(&btnSoundOver);
|
||||
playBtn.SetSoundClick(&btnClick);
|
||||
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(-27, 400);
|
||||
stopBtn.SetImage(&stopBtnImg);
|
||||
stopBtn.SetSoundOver(&btnSoundOver);
|
||||
stopBtn.SetSoundClick(&btnClick);
|
||||
stopBtn.SetTrigger(&trigA);
|
||||
stopBtn.SetTrigger(&trigMinus);
|
||||
stopBtn.SetEffectGrow();
|
||||
|
||||
GuiImage pauseBtnImg(&pause);
|
||||
pauseBtnImg.SetWidescreen(CFG.widescreen);
|
||||
|
||||
HaltGui();
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
w.Append(&cancelBtn);
|
||||
w.Append(&playBtn);
|
||||
w.Append(&playBtn);
|
||||
w.Append(&nextBtn);
|
||||
w.Append(&prevBtn);
|
||||
w.Append(&stopBtn);
|
||||
mainWindow->Append(&optionBrowser4);
|
||||
mainWindow->Append(&w);
|
||||
|
||||
ResumeGui();
|
||||
|
||||
while(menu == MENU_NONE)
|
||||
{
|
||||
if (cancelBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
menu = MENU_DISCLIST;
|
||||
CloseMp3();
|
||||
bgMusic->Play();
|
||||
break;
|
||||
}
|
||||
|
||||
ret = optionBrowser4.GetClickedOption();
|
||||
|
||||
for(i = 0; i < countmp3; i++) {
|
||||
if(i == ret) {
|
||||
sprintf(fullpath,"%s%s", mp3path,mp3files[ret]);
|
||||
PlayMp3(fullpath);
|
||||
songPlaying=ret;
|
||||
SetMp3Volume(127);
|
||||
}
|
||||
}
|
||||
|
||||
if (playBtn.GetState() == STATE_CLICKED) {
|
||||
StopMp3();
|
||||
ret = optionBrowser4.GetSelectedOption();
|
||||
songPlaying=ret;
|
||||
sprintf(fullpath,"%s%s", mp3path,mp3files[ret]);
|
||||
PlayMp3(fullpath);
|
||||
SetMp3Volume(127);
|
||||
playBtn.ResetState();
|
||||
|
||||
}
|
||||
|
||||
if(nextBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
StopMp3();
|
||||
songPlaying++;
|
||||
if (songPlaying>(countmp3 - 1)){songPlaying=0;}
|
||||
sprintf(fullpath,"%s%s", mp3path,mp3files[songPlaying]);
|
||||
PlayMp3(fullpath);
|
||||
SetMp3Volume(127);
|
||||
nextBtn.ResetState();
|
||||
}
|
||||
if(prevBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
StopMp3();
|
||||
songPlaying--;
|
||||
if (songPlaying<0){songPlaying=(countmp3 - 1);}
|
||||
sprintf(fullpath,"%s%s", mp3path,mp3files[songPlaying]);
|
||||
PlayMp3(fullpath);
|
||||
SetMp3Volume(127);
|
||||
prevBtn.ResetState();
|
||||
}
|
||||
if(stopBtn.GetState() == STATE_CLICKED)
|
||||
{ StopMp3();
|
||||
stopBtn.ResetState();
|
||||
playBtn.SetImage(&playBtnImg);
|
||||
//break;
|
||||
}
|
||||
}
|
||||
|
||||
HaltGui();
|
||||
w.Remove(&playBtn);
|
||||
w.Remove(&nextBtn);
|
||||
w.Remove(&prevBtn);
|
||||
w.Remove(&stopBtn);
|
||||
mainWindow->Remove(&optionBrowser4);
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
|
||||
return menu;
|
||||
}
|
||||
/****************************************************************************
|
||||
* MainMenu
|
||||
***************************************************************************/
|
||||
@ -6399,9 +6198,6 @@ int MainMenu(int menu)
|
||||
case MENU_DISCLIST:
|
||||
currentMenu = MenuDiscList();
|
||||
break;
|
||||
case MENU_MP3:
|
||||
currentMenu = MenuMp3();
|
||||
break;
|
||||
case MENU_OGG:
|
||||
currentMenu = MenuOGG();
|
||||
break;
|
||||
@ -6539,7 +6335,7 @@ int MainMenu(int menu)
|
||||
break;
|
||||
}
|
||||
|
||||
u32 videoselected = 0;
|
||||
u8 videoselected = 0;
|
||||
|
||||
switch(videoChoice)
|
||||
{
|
||||
@ -6557,17 +6353,20 @@ int MainMenu(int menu)
|
||||
|
||||
case ntsc:
|
||||
videoselected = 3;
|
||||
break;
|
||||
|
||||
case systemdefault:
|
||||
|
||||
videoselected = 4;
|
||||
break;
|
||||
|
||||
case patch:
|
||||
|
||||
videoselected = 5;
|
||||
break;
|
||||
|
||||
default:
|
||||
videoselected = 3;
|
||||
videoselected = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -6604,9 +6403,8 @@ int MainMenu(int menu)
|
||||
}
|
||||
|
||||
int ret = 0;
|
||||
ret = Disc_WiiBoot(videoselected, cheat, vipatch);
|
||||
ret = Disc_WiiBoot(videoselected, cheat, vipatch, Settings.patchcountrystrings);
|
||||
if (ret < 0) {
|
||||
printf("%s (ret = %d)\n",LANGUAGE.Error, ret);
|
||||
ExitApp();
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
}
|
||||
|
@ -25,8 +25,7 @@ enum
|
||||
MENU_INSTALL,
|
||||
MENU_CHECK,
|
||||
MENU_GAME_SETTINGS,
|
||||
MENU_OGG,
|
||||
MENU_MP3
|
||||
MENU_OGG
|
||||
};
|
||||
|
||||
#endif
|
||||
|
140
source/mp3s.c
140
source/mp3s.c
@ -1,140 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <math.h>
|
||||
#include <gccore.h>
|
||||
#include <wiiuse/wpad.h>
|
||||
#include <fat.h>
|
||||
#include <sys/dir.h>
|
||||
#include <unistd.h>
|
||||
#include <mp3player.h>
|
||||
|
||||
#include "mp3s.h"
|
||||
|
||||
char filename[80];
|
||||
|
||||
//Files
|
||||
FILE* pFile;
|
||||
|
||||
|
||||
s32 my_reader(void *fp,void *dat, s32 size)
|
||||
{
|
||||
return fread(dat, 1, size, fp);
|
||||
}
|
||||
|
||||
|
||||
void StopMp3()
|
||||
{
|
||||
if(MP3Player_IsPlaying()) {
|
||||
MP3Player_Stop();
|
||||
}
|
||||
}
|
||||
|
||||
void CloseMp3() {
|
||||
|
||||
if(MP3Player_IsPlaying()) {
|
||||
MP3Player_Stop();
|
||||
}
|
||||
fclose(pFile);
|
||||
}
|
||||
|
||||
void SetMp3Volume(u32 vol)
|
||||
{
|
||||
MP3Player_Volume(vol);
|
||||
}
|
||||
|
||||
int PlayMp3(char * path) {
|
||||
|
||||
if(!MP3Player_IsPlaying()) {
|
||||
MP3Player_Init();
|
||||
} else {
|
||||
StopMp3();
|
||||
}
|
||||
|
||||
pFile = fopen (path, "r");
|
||||
MP3Player_PlayFile(pFile, my_reader, NULL);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
int PlayMp3(char * path)
|
||||
{
|
||||
|
||||
|
||||
if(!MP3Player_IsPlaying()) {
|
||||
MP3Player_Init();
|
||||
} else {
|
||||
MP3Player_Stop();
|
||||
}
|
||||
long lSize = 0;
|
||||
char * buffermp3 = NULL;
|
||||
size_t resultmp3;
|
||||
|
||||
pFile = fopen (path, "r");
|
||||
|
||||
//Check that pFile exist
|
||||
if (pFile!=NULL)
|
||||
{
|
||||
// obtain file size:
|
||||
fseek (pFile , 0 , SEEK_END);
|
||||
lSize = ftell (pFile);
|
||||
rewind (pFile);
|
||||
|
||||
// allocate memory to contain the whole file:
|
||||
buffermp3 = (char*) malloc (sizeof(char)*lSize);
|
||||
if (buffermp3 == NULL) {fputs (" Memory error",stderr); exit (2);}
|
||||
|
||||
// copy the file into the buffer:
|
||||
resultmp3 = fread (buffermp3,1,lSize,pFile);
|
||||
if (resultmp3 != lSize) {fputs (" Reading error",stderr); exit (3);}
|
||||
|
||||
|
||||
fclose (pFile);
|
||||
}
|
||||
|
||||
if (buffermp3 != NULL)
|
||||
{
|
||||
MP3Player_PlayBuffer(buffermp3,lSize,NULL);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
s32 filenamescmp(const void *a, const void *b)
|
||||
{
|
||||
/* Compare strings */
|
||||
return stricmp((char *)a, (char *)b);
|
||||
}
|
||||
|
||||
int GetFiles(char * mp3path)
|
||||
{
|
||||
int countmp3 = 0;
|
||||
|
||||
struct stat st;
|
||||
DIR_ITER* dir;
|
||||
dir = diropen (mp3path);
|
||||
|
||||
if (dir == NULL) //If empty
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (dirnext(dir,filename,&st) == 0)
|
||||
{
|
||||
if ((st.st_mode & S_IFDIR) == 0)
|
||||
{
|
||||
// st.st_mode & S_IFDIR indicates a directory
|
||||
sprintf(mp3files[countmp3], "%s", filename);
|
||||
countmp3++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
qsort(mp3files, countmp3, sizeof(char[70]), filenamescmp);
|
||||
|
||||
return countmp3;
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
#ifndef _MP3S_H_
|
||||
#define _MP3S_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
char mp3files[300][70];
|
||||
|
||||
void StopMp3();
|
||||
void SetMp3Volume(u32 vol);
|
||||
int PlayMp3(char * path);
|
||||
int OpenMp3(char * path);
|
||||
void CloseMp3();
|
||||
int GetFiles(char * mp3path);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -25,7 +25,6 @@
|
||||
*/
|
||||
|
||||
#include "oggplayer.h"
|
||||
#include "mp3s.h"
|
||||
#include <gccore.h>
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -62,6 +62,8 @@ int Sys_IosReload(int IOS)
|
||||
|
||||
USBStorage_Deinit();
|
||||
|
||||
__IOS_ShutdownSubsystems();
|
||||
|
||||
ret = IOS_ReloadIOS(IOS);
|
||||
|
||||
if(ret < 0) {
|
||||
@ -73,7 +75,7 @@ int Sys_IosReload(int IOS)
|
||||
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
||||
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
||||
|
||||
if(IOS == 249 || IOS == 222 || IOS == 223) {
|
||||
if(IOS == 249 || IOS == 222) {
|
||||
ret = WBFS_Init(WBFS_DEVICE_USB);
|
||||
ret = Disc_Init();
|
||||
ret = WBFS_Open();
|
||||
|
Loading…
Reference in New Issue
Block a user