mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 05:34:15 +01:00
-fixed wii game installer
This commit is contained in:
parent
85ff18bd8d
commit
088ae57074
@ -622,7 +622,7 @@ u32 wbfs_size_disc(wbfs_t *p,read_wiidisc_callback_t read_src_wii_disc,
|
||||
u32 wii_sec_per_wbfs_sect = 1 << (p->wbfs_sec_sz_s - p->wii_sec_sz_s);
|
||||
wiidisc_t *d = 0;
|
||||
|
||||
u8 *used = wbfs_malloc(p->n_wii_sec_per_disc);
|
||||
u8 *used = wbfs_ioalloc(p->n_wii_sec_per_disc);
|
||||
if(!used)
|
||||
ERROR("unable to alloc memory\n");
|
||||
|
||||
|
@ -304,7 +304,7 @@ wiidisc_t *wd_open_disc(read_wiidisc_callback_t read, void *fp)
|
||||
d->fp = fp;
|
||||
d->part_sel = ALL_PARTITIONS;
|
||||
d->tmp_buffer = wbfs_ioalloc(0x8000);
|
||||
d->tmp_buffer2 = wbfs_malloc(0x8000);
|
||||
d->tmp_buffer2 = wbfs_ioalloc(0x8000);
|
||||
return d;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ s32 Disc_Open(bool boot_disc)
|
||||
|
||||
/* Directly set Audio Streaming for GC*/
|
||||
if(boot_disc)
|
||||
gprintf("Setting Audio Streaming for GC Games: 0x%08x\n", WDVD_SetStreaming());
|
||||
gprintf("Setting Audio Streaming for GC Games %s\n", WDVD_SetStreaming() == 0 ? "succeed" : "failed");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ s32 __WBFS_ReadDVD(void *fp, u32 lba, u32 len, void *iobuf)
|
||||
if (mod)
|
||||
{
|
||||
/* Allocate memory */
|
||||
fp = malloc(0x20);
|
||||
fp = memalign(0x20, 0x20);
|
||||
if (!fp)
|
||||
return -1;
|
||||
|
||||
@ -269,10 +269,7 @@ s32 WBFS_AddGame(progress_callback_t spinner, void *spinner_data)
|
||||
if (!hdd) return -1;
|
||||
|
||||
/* Add game to device */
|
||||
partition_selector_t part_sel = ONLY_GAME_PARTITION;
|
||||
int copy_1_1 = 0;
|
||||
|
||||
s32 ret = wbfs_add_disc(hdd, __WBFS_ReadDVD, NULL, spinner, spinner_data, part_sel, copy_1_1);
|
||||
s32 ret = wbfs_add_disc(hdd, __WBFS_ReadDVD, NULL, spinner, spinner_data, REMOVE_UPDATE_PARTITION, 0);
|
||||
|
||||
return ret < 0 ? ret : 0;
|
||||
}
|
||||
@ -310,7 +307,7 @@ s32 WBFS_GameSize(u8 *discid, char *path, f32 *size)
|
||||
|
||||
s32 WBFS_DVD_Size(u64 *comp_size, u64 *real_size)
|
||||
{
|
||||
if (wbfs_part_fs) return WBFS_Ext_DVD_Size(comp_size, real_size, (currentPartition == 0));
|
||||
if (wbfs_part_fs) return WBFS_Ext_DVD_Size(comp_size, real_size);
|
||||
|
||||
u32 comp_sec = 0, last_sec = 0;
|
||||
|
||||
@ -318,9 +315,7 @@ s32 WBFS_DVD_Size(u64 *comp_size, u64 *real_size)
|
||||
if (!hdd) return -1;
|
||||
|
||||
/* Add game to device */
|
||||
partition_selector_t part_sel = ONLY_GAME_PARTITION;
|
||||
|
||||
s32 ret = wbfs_size_disc(hdd, __WBFS_ReadDVD, NULL, part_sel, &comp_sec, &last_sec);
|
||||
s32 ret = wbfs_size_disc(hdd, __WBFS_ReadDVD, NULL, REMOVE_UPDATE_PARTITION, &comp_sec, &last_sec);
|
||||
if (ret < 0) return ret;
|
||||
|
||||
*comp_size = ((u64)hdd->wii_sec_sz) * comp_sec;
|
||||
|
@ -183,13 +183,15 @@ s32 WBFS_Ext_AddGame(progress_callback_t spinner, void *spinner_data)
|
||||
|
||||
Disc_ReadHeader(&header);
|
||||
asprintf(&cleantitle, header.title);
|
||||
for (cp = strpbrk(cleantitle, illegal); cp; cp = strpbrk(cp, illegal))
|
||||
for(cp = strpbrk(cleantitle, illegal); cp; cp = strpbrk(cp, illegal))
|
||||
*cp = '_';
|
||||
snprintf(folder, sizeof(folder), "%s%s", wbfs_fs_drive, wbfs_ext_dir);
|
||||
fsop_MakeFolder(folder);
|
||||
snprintf(folder, sizeof(folder), "%s%s/%s [%s]", wbfs_fs_drive, wbfs_ext_dir, cleantitle, header.id);
|
||||
fsop_MakeFolder(folder);
|
||||
free(cleantitle);
|
||||
fsop_MakeFolder((char *)folder);
|
||||
snprintf(gamepath, sizeof(gamepath), "%s/%s.wbfs", folder, header.id);
|
||||
|
||||
snprintf(gamepath, sizeof(gamepath), "%s/%s.wbfs", folder, header.id);
|
||||
u64 size = (u64)143432*2*0x8000ULL;
|
||||
u32 n_sector = size / 512;
|
||||
|
||||
@ -214,7 +216,7 @@ s32 WBFS_Ext_AddGame(progress_callback_t spinner, void *spinner_data)
|
||||
extern wbfs_t *hdd;
|
||||
wbfs_t *old_hdd = hdd;
|
||||
hdd = part; // used by spinner
|
||||
s32 ret = wbfs_add_disc(part, __WBFS_ReadDVD, NULL, spinner, spinner_data, ONLY_GAME_PARTITION, 0);
|
||||
s32 ret = wbfs_add_disc(part, __WBFS_ReadDVD, NULL, spinner, spinner_data, REMOVE_UPDATE_PARTITION, 0);
|
||||
hdd = old_hdd;
|
||||
|
||||
if(ret == 0) wbfs_trim(part);
|
||||
@ -226,24 +228,31 @@ s32 WBFS_Ext_AddGame(progress_callback_t spinner, void *spinner_data)
|
||||
return ret < 0 ? ret : 0;
|
||||
}
|
||||
|
||||
s32 WBFS_Ext_DVD_Size(u64 *comp_size, u64 *real_size, bool sd)
|
||||
s32 WBFS_Ext_DVD_Size(u64 *comp_size, u64 *real_size)
|
||||
{
|
||||
s32 ret;
|
||||
u32 comp_sec = 0, last_sec = 0;
|
||||
|
||||
wbfs_t *part = NULL;
|
||||
u64 size = (u64)143432*2*0x8000ULL;
|
||||
u32 n_sector = size / 512;
|
||||
u32 wii_sec_sz;
|
||||
|
||||
// init a temporary dummy part
|
||||
// as a placeholder for wbfs_size_disc
|
||||
wbfs_t *part = wbfs_open_partition(0, 0, NULL, sd ? 512 : USBStorage2_GetSectorSize(), n_sector, 0, 1);
|
||||
if (!part)
|
||||
part = wbfs_open_partition(0, 0, NULL, 512, n_sector, 0, 1);
|
||||
if(!part)
|
||||
return -1;
|
||||
wii_sec_sz = part->wii_sec_sz;
|
||||
|
||||
u32 comp_sec = 0, last_sec = 0;
|
||||
s32 ret = wbfs_size_disc(part, __WBFS_ReadDVD, NULL, ONLY_GAME_PARTITION, &comp_sec, &last_sec);
|
||||
/* Add game to device */
|
||||
ret = wbfs_size_disc(part, __WBFS_ReadDVD, NULL, REMOVE_UPDATE_PARTITION, &comp_sec, &last_sec);
|
||||
wbfs_close(part);
|
||||
if (ret < 0) return ret;
|
||||
if(ret < 0)
|
||||
return ret;
|
||||
|
||||
*comp_size = (u64)(part->wii_sec_sz) * comp_sec;
|
||||
*real_size = (u64)(part->wii_sec_sz) * last_sec;
|
||||
*comp_size = (u64)wii_sec_sz * comp_sec;
|
||||
*real_size = (u64)wii_sec_sz * last_sec;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ void WBFS_Ext_CloseDisc(wbfs_disc_t* disc);
|
||||
s32 WBFS_Ext_DiskSpace(f32 *used, f32 *free);
|
||||
s32 WBFS_Ext_RemoveGame(u8 *discid, char *path);
|
||||
s32 WBFS_Ext_AddGame(progress_callback_t spinner, void *spinner_data);
|
||||
s32 WBFS_Ext_DVD_Size(u64 *comp_size, u64 *real_size, bool sd);
|
||||
s32 WBFS_Ext_DVD_Size(u64 *comp_size, u64 *real_size);
|
||||
int WBFS_Ext_find_fname(u8 *id, char *path, char *fname, int len);
|
||||
|
||||
char* strcopy(char *dest, const char *src, int size);
|
||||
|
@ -2151,7 +2151,6 @@ bool CMenu::_loadHomebrewList()
|
||||
|
||||
Config tmpcfg;
|
||||
gprintf("%s\n", DeviceName[currentPartition]);
|
||||
DeviceHandler::Instance()->Open_WBFS(currentPartition);
|
||||
m_gameList.Load(sfmt(HOMEBREW_DIR, DeviceName[currentPartition]), ".dol|.elf", m_cfg.getString("HOMEBREW", "lastlanguage", "EN").c_str(), tmpcfg);
|
||||
m_cfg.setString("HOMEBREW", "lastlanguage", m_loc.getString(m_curLanguage, "gametdb_code", "EN"));
|
||||
m_cfg.save();
|
||||
@ -2166,7 +2165,6 @@ bool CMenu::_loadDmlList()
|
||||
|
||||
Config tmpcfg;
|
||||
gprintf("%s\n", DeviceName[currentPartition]);
|
||||
DeviceHandler::Instance()->Open_WBFS(currentPartition);
|
||||
if(currentPartition != SD)
|
||||
m_gameList.Load(sfmt(m_DMLgameDir.c_str(), DeviceName[currentPartition]), "boot.bin|.iso", m_cfg.getString("DML", "lastlanguage", "EN").c_str(), tmpcfg);
|
||||
else
|
||||
@ -2183,8 +2181,6 @@ bool CMenu::_loadEmuList()
|
||||
return false;
|
||||
|
||||
gprintf("%s\n", DeviceName[currentPartition]);
|
||||
DeviceHandler::Instance()->Open_WBFS(currentPartition);
|
||||
|
||||
DIR *pdir;
|
||||
struct dirent *pent;
|
||||
|
||||
|
@ -320,7 +320,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
||||
out = true;
|
||||
break;
|
||||
}
|
||||
if (Disc_Open(true) < 0)
|
||||
if (Disc_Open(false) < 0)
|
||||
{
|
||||
error(_t("wbfsoperr2", L"Disc_Open failed"));
|
||||
out = true;
|
||||
@ -329,7 +329,6 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
|
||||
if (Disc_IsWii() == 0)
|
||||
{
|
||||
Disc_ReadHeader(&header);
|
||||
|
||||
if(_searchGamesByID((const char *) header.id).size() != 0)
|
||||
{
|
||||
error(_t("wbfsoperr4", L"Game already installed"));
|
||||
|
Loading…
Reference in New Issue
Block a user