*Fixed Estimation GameSize before Install BUG

*Some small fixes and MP3 Crash fix (STILL BUGGY WHILE PLAYING, DON'T USE IT)
This commit is contained in:
dimok321 2009-05-13 20:55:33 +00:00
parent e843d9a3be
commit a97cfd3431
15 changed files with 46 additions and 49 deletions

View File

@ -1,7 +1,5 @@
#ifndef _DISC_H_ #ifndef _DISC_H_
#define _DISC_H_ #define _DISC_H_
#include <asndlib.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"

View File

@ -22,7 +22,17 @@
#ifndef __FST_H__ #ifndef __FST_H__
#define __FST_H__ #define __FST_H__
#ifdef __cplusplus
extern "C"
{
#endif
//u32 do_fst(u32 fstlocation); //u32 do_fst(u32 fstlocation);
u32 do_sd_code(char *filename); u32 do_sd_code(char *filename);
#ifdef __cplusplus
}
#endif #endif
#endif

View File

@ -553,7 +553,8 @@ error:
} }
u32 wbfs_extract_file(wbfs_disc_t*d, char *path); u32 wbfs_extract_file(wbfs_disc_t*d, char *path);
u32 wbfs_estimate_disc( float wbfs_estimate_disc
(
wbfs_t *p, read_wiidisc_callback_t read_src_wii_disc, wbfs_t *p, read_wiidisc_callback_t read_src_wii_disc,
void *callback_data, void *callback_data,
partition_selector_t sel) partition_selector_t sel)
@ -588,7 +589,7 @@ u32 wbfs_estimate_disc(
b = (u8 *)info; b = (u8 *)info;
read_src_wii_disc(callback_data, 0, 0x100, info->disc_header_copy); read_src_wii_disc(callback_data, 0, 0x100, info->disc_header_copy);
fprintf(stderr, "estimating %c%c%c%c%c%c %s...\n",b[0], b[1], b[2], b[3], b[4], b[5], b + 0x20); //fprintf(stderr, "estimating %c%c%c%c%c%c %s...\n",b[0], b[1], b[2], b[3], b[4], b[5], b + 0x20);
for (i = 0; i < p->n_wbfs_sec_per_disc; i++) for (i = 0; i < p->n_wbfs_sec_per_disc; i++)
{ {
@ -597,6 +598,7 @@ u32 wbfs_estimate_disc(
tot++; tot++;
} }
} }
//memcpy(header, b,0x100);
error: error:
if (d) if (d)
@ -608,5 +610,5 @@ error:
if (info) if (info)
wbfs_iofree(info); wbfs_iofree(info);
return tot * ((p->wbfs_sec_sz / p->hd_sec_sz) * 512); return tot * (((p->wbfs_sec_sz*1.0) / p->hd_sec_sz) * 512);
} }

View File

@ -211,7 +211,7 @@ u32 wbfs_extract_file(wbfs_disc_t*d, char *path);
// remove some sanity checks // remove some sanity checks
void wbfs_set_force_mode(int force); void wbfs_set_force_mode(int force);
u32 wbfs_estimate_disc( float wbfs_estimate_disc(
wbfs_t *p, read_wiidisc_callback_t read_src_wii_disc, wbfs_t *p, read_wiidisc_callback_t read_src_wii_disc,
void *callback_data, void *callback_data,
partition_selector_t sel); partition_selector_t sel);

View File

@ -846,12 +846,12 @@ int GameWindowPrompt()
sizeTxt.SetText(sizeText); sizeTxt.SetText(sizeText);
msgTxt.SetText(gameName); msgTxt.SetText(gameName);
char* pch; char* pch;
pch=strrchr((gameName),'_'); pch=strrchr((gameName),'_');
if (pch!=NULL){msgTxt.SetPosition(0, 16);} if (pch!=NULL){msgTxt.SetPosition(0, 16);}
else {msgTxt.SetPosition(0, 1);} else {msgTxt.SetPosition(0, 1);}
HaltGui(); HaltGui();
mainWindow->SetState(STATE_DISABLED); mainWindow->SetState(STATE_DISABLED);
@ -2145,8 +2145,8 @@ static int MenuInstall()
f32 freespace, used; f32 freespace, used;
WBFS_DiskSpace(&used, &freespace); WBFS_DiskSpace(&used, &freespace);
u32 estimation = wbfs_estimate_disc(hdd, __WBFS_ReadDVD, NULL, ONLY_GAME_PARTITION); float estimation = wbfs_estimate_disc(hdd, __WBFS_ReadDVD, NULL, ONLY_GAME_PARTITION);
gamesize = ((f32) estimation)/1073741824; gamesize = estimation/1073741824;
char gametxt[50]; char gametxt[50];
sprintf(gametxt, "%s : %.2fGB", name, gamesize); sprintf(gametxt, "%s : %.2fGB", name, gamesize);
@ -4528,7 +4528,7 @@ int MenuMp3()
customOptionList options2(500); customOptionList options2(500);
char mp3path[30] = "SD:/mp3/"; char mp3path[30] = "SD:/mp3/";
char fullpath[100]; char fullpath[110];
int countmp3 = GetFiles(mp3path); int countmp3 = GetFiles(mp3path);
for (cnt = 0; cnt < countmp3; cnt++) { for (cnt = 0; cnt < countmp3; cnt++) {
@ -4588,9 +4588,9 @@ int MenuMp3()
GuiImageData pause(imgPath, mp3_pause_png); GuiImageData pause(imgPath, mp3_pause_png);
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_right.png", CFG.theme_path); snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_right.png", CFG.theme_path);
GuiImageData play(imgPath, startgame_arrow_right_png); GuiImageData play(imgPath, startgame_arrow_right_png);
GuiImage nextBtnImg(&next); GuiImage nextBtnImg(&next);
GuiButton nextBtn(next.GetWidth(), next.GetHeight()); GuiButton nextBtn(next.GetWidth(), next.GetHeight());
nextBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); nextBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
@ -4601,7 +4601,7 @@ int MenuMp3()
nextBtn.SetTrigger(&trigA); nextBtn.SetTrigger(&trigA);
nextBtn.SetTrigger(&trigR); nextBtn.SetTrigger(&trigR);
nextBtn.SetEffectGrow(); nextBtn.SetEffectGrow();
GuiImage prevBtnImg(&prev); GuiImage prevBtnImg(&prev);
prevBtnImg.SetWidescreen(CFG.widescreen); prevBtnImg.SetWidescreen(CFG.widescreen);
GuiButton prevBtn(prev.GetWidth(), prev.GetHeight()); GuiButton prevBtn(prev.GetWidth(), prev.GetHeight());
@ -4613,7 +4613,7 @@ int MenuMp3()
prevBtn.SetTrigger(&trigA); prevBtn.SetTrigger(&trigA);
prevBtn.SetTrigger(&trigL); prevBtn.SetTrigger(&trigL);
prevBtn.SetEffectGrow(); prevBtn.SetEffectGrow();
GuiImage playBtnImg(&play); GuiImage playBtnImg(&play);
playBtnImg.SetWidescreen(CFG.widescreen); playBtnImg.SetWidescreen(CFG.widescreen);
GuiButton playBtn(play.GetWidth(), play.GetHeight()); GuiButton playBtn(play.GetWidth(), play.GetHeight());
@ -4625,7 +4625,7 @@ int MenuMp3()
playBtn.SetTrigger(&trigA); playBtn.SetTrigger(&trigA);
playBtn.SetTrigger(&trigPlus); playBtn.SetTrigger(&trigPlus);
playBtn.SetEffectGrow(); playBtn.SetEffectGrow();
GuiImage stopBtnImg(&stop); GuiImage stopBtnImg(&stop);
stopBtnImg.SetWidescreen(CFG.widescreen); stopBtnImg.SetWidescreen(CFG.widescreen);
GuiButton stopBtn(stop.GetWidth(), stop.GetHeight()); GuiButton stopBtn(stop.GetWidth(), stop.GetHeight());
@ -4637,7 +4637,7 @@ int MenuMp3()
stopBtn.SetTrigger(&trigA); stopBtn.SetTrigger(&trigA);
stopBtn.SetTrigger(&trigMinus); stopBtn.SetTrigger(&trigMinus);
stopBtn.SetEffectGrow(); stopBtn.SetEffectGrow();
GuiImage pauseBtnImg(&pause); GuiImage pauseBtnImg(&pause);
pauseBtnImg.SetWidescreen(CFG.widescreen); pauseBtnImg.SetWidescreen(CFG.widescreen);
@ -4685,11 +4685,11 @@ int MenuMp3()
//playBtn.SetImage(&playBtnImg);isplaying=true; //playBtn.SetImage(&playBtnImg);isplaying=true;
//if (isplaying==true){playBtn.SetImage(&pauseBtnImg);isplaying=false;} //if (isplaying==true){playBtn.SetImage(&pauseBtnImg);isplaying=false;}
playBtn.ResetState(); playBtn.ResetState();
} }
if(nextBtn.GetState() == STATE_CLICKED) if(nextBtn.GetState() == STATE_CLICKED)
{ {
StopMp3(); StopMp3();
songPlaying++; songPlaying++;
if (songPlaying>(countmp3 - 1)){songPlaying=0;} if (songPlaying>(countmp3 - 1)){songPlaying=0;}
@ -4701,7 +4701,7 @@ int MenuMp3()
//break; //break;
} }
if(prevBtn.GetState() == STATE_CLICKED) if(prevBtn.GetState() == STATE_CLICKED)
{ {
StopMp3(); StopMp3();
songPlaying--; songPlaying--;
if (songPlaying<0){songPlaying=(countmp3 - 1);} if (songPlaying<0){songPlaying=(countmp3 - 1);}

View File

@ -134,7 +134,7 @@ if (dir == NULL) //If empty
} }
} }
qsort(mp3files, countmp3, sizeof(char[30]), filenamescmp); qsort(mp3files, countmp3, sizeof(char[80]), filenamescmp);
return countmp3; return countmp3;
} }

View File

@ -6,7 +6,7 @@ extern "C"
{ {
#endif #endif
char mp3files[500][30]; char mp3files[500][80];
void StopMp3(); void StopMp3();
void SetMp3Volume(u32 vol); void SetMp3Volume(u32 vol);

View File

@ -1,8 +1,6 @@
#ifndef _PARTITION_H_ #ifndef _PARTITION_H_
#define _PARTITION_H_ #define _PARTITION_H_
#include <asndlib.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {

View File

@ -1,6 +1,5 @@
#ifndef _SYS_H_ #ifndef _SYS_H_
#define _SYS_H_ #define _SYS_H_
#include <asndlib.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"

View File

@ -1,8 +1,6 @@
#ifndef _USBSTORAGE_H_ #ifndef _USBSTORAGE_H_
#define _USBSTORAGE_H_ #define _USBSTORAGE_H_
#include <asndlib.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {

View File

@ -1,8 +1,6 @@
#ifndef _VIDEO2_H_ #ifndef _VIDEO2_H_
#define _VIDEO2_H_ #define _VIDEO2_H_
#include <asndlib.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {

View File

@ -24,7 +24,7 @@ static rw_sector_callback_t readCallback = NULL;
static rw_sector_callback_t writeCallback = NULL; static rw_sector_callback_t writeCallback = NULL;
/* Variables */ /* Variables */
static u32 nb_sectors, sector_size; static u32 nb_sectors, sector_size;
void __WBFS_Spinner(s32 x, s32 max) void __WBFS_Spinner(s32 x, s32 max)
{ {
@ -247,7 +247,7 @@ s32 WBFS_Init(u32 device)
if (!nb_sectors) if (!nb_sectors)
return -1; return -1;
} }
else else
return ret; return ret;
break; break;
case WBFS_DEVICE_SDHC: case WBFS_DEVICE_SDHC:
@ -262,12 +262,12 @@ s32 WBFS_Init(u32 device)
/* Device info */ /* Device info */
nb_sectors = 0; nb_sectors = 0;
sector_size = SDHC_SECTOR_SIZE; sector_size = SDHC_SECTOR_SIZE;
} }
else else
return -1; return -1;
break; break;
} }
return 0; return 0;
} }
//s32 WBFS_Init(void) //s32 WBFS_Init(void)
@ -293,15 +293,15 @@ s32 WBFS_Init(u32 device, u32 timeout)
u32 cnt; u32 cnt;
s32 ret; s32 ret;
// Wrong timeout // Wrong timeout
if (!timeout) if (!timeout)
return -1; return -1;
// Try to mount device // Try to mount device
for (cnt = 0; cnt < timeout; cnt++) { for (cnt = 0; cnt < timeout; cnt++) {
switch (device) { switch (device) {
case WBFS_DEVICE_USB: { case WBFS_DEVICE_USB: {
// Initialize USB storage // Initialize USB storage
ret = USBStorage_Init(); ret = USBStorage_Init();
if (ret >= 0) { if (ret >= 0) {
@ -317,11 +317,11 @@ s32 WBFS_Init(u32 device, u32 timeout)
} }
case WBFS_DEVICE_SDHC: { case WBFS_DEVICE_SDHC: {
// Initialize SDHC // Initialize SDHC
ret = SDHC_Init(); ret = SDHC_Init();
if (ret) { if (ret) {
// Setup callbacks // Setup callbacks
readCallback = __WBFS_ReadSDHC; readCallback = __WBFS_ReadSDHC;
writeCallback = __WBFS_WriteSDHC; writeCallback = __WBFS_WriteSDHC;
@ -338,7 +338,7 @@ s32 WBFS_Init(u32 device, u32 timeout)
return -1; return -1;
} }
// Sleep 1 second // Sleep 1 second
sleep(1); sleep(1);
} }

View File

@ -1,8 +1,6 @@
#ifndef _WBFS_H_ #ifndef _WBFS_H_
#define _WBFS_H_ #define _WBFS_H_
#include <asndlib.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {

View File

@ -1,8 +1,6 @@
#ifndef _WDVD_H_ #ifndef _WDVD_H_
#define _WDVD_H_ #define _WDVD_H_
#include <asndlib.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {

View File

@ -3,8 +3,6 @@
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
#include <asndlib.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {