Made game ID text into a button to change the ID for custom games based off a retail disc (Guitar Hero baby!).

*NOTE*
it is possible to change any game ID to more or less than 6 characters, but since most of the functions use header->id[0] through [5], more will be useless and less may result in code dumps.

it is not advised to change the ID for games that are not custom, as the cover and wiitdb data will not be available for made up ID

it is possible to have multiple games with the same ID on the wbfs partition, but when any of them are clicked, the wii will perform the selected action (play, delete, etc) on the first one it finds.
This commit is contained in:
giantpune 2009-09-02 08:03:51 +00:00
parent bbbbde4b36
commit 1fe96748b7
26 changed files with 305 additions and 178 deletions

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 17:05+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: David Jelinek (djelinek@hotmail.com) \n"
"Language-Team: r713 - last version on http://djelinek.sweb.cz/czech.lang \n"
@ -205,6 +205,9 @@ msgstr "Zjištuji dostupné aktualiazce"
msgid "Click to Download Covers"
msgstr "Kliknete pro stažení obalu"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "Hodiny"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 17:05+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -205,6 +205,9 @@ msgstr "Leder efter opdateringer"
msgid "Click to Download Covers"
msgstr "Klik for at downloade covers"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "Ur"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 17:05+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: tj_cool\n"
"Language-Team: \n"
@ -205,6 +205,9 @@ msgstr "Controleren op updates"
msgid "Click to Download Covers"
msgstr "Klik om hoesjes te downloaden"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "Klok"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 04:07+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -205,6 +205,9 @@ msgstr ""
msgid "Click to Download Covers"
msgstr ""
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr ""

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 04:07+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -205,6 +205,9 @@ msgstr ""
msgid "Click to Download Covers"
msgstr "Klikkaa ladataksesi kansia"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "Kello"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 04:07+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: Kin8\n"
"Language-Team: Badablek, Amour, ikya, OuahOuah, dj_skual & Kin8\n"
@ -205,6 +205,9 @@ msgstr "Recherche de Mise à Jour"
msgid "Click to Download Covers"
msgstr "Téléchargement des jaquettes"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "Horloge"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 04:07+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -205,6 +205,9 @@ msgstr "Suche nach Aktualisierung"
msgid "Click to Download Covers"
msgstr "Klicken zum Coverdownloaden"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "Uhr"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 04:07+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: Tusk\n"
"Language-Team: \n"
@ -205,6 +205,9 @@ msgstr "Frissitések Keresése"
msgid "Click to Download Covers"
msgstr "Kattints, hogy letöltsd a borítókat"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "Óra"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 04:07+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-08-05 10:00+0200\n"
"Last-Translator: Cambo \n"
"Language-Team: FoxeJoe & Cambo\n"
@ -205,6 +205,9 @@ msgstr "Verifica Aggiornamenti"
msgid "Click to Download Covers"
msgstr "Premi per scaricare le Copertine"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "Orologio"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 04:07+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -205,6 +205,9 @@ msgstr "最新版を確認中"
msgid "Click to Download Covers"
msgstr "クリックでカバーをダウンロード"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "時計"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 04:07+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -205,6 +205,9 @@ msgstr ""
msgid "Click to Download Covers"
msgstr "표지를 다운하려면 클릭하세요"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "시계"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 17:05+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -205,6 +205,9 @@ msgstr "Søker etter oppdateringer"
msgid "Click to Download Covers"
msgstr "Klikk for å laste ned cover"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "Klokke"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 04:07+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: ziom666 (zadania_prog@vp.pl)\n"
"Language-Team: \n"
@ -205,6 +205,9 @@ msgstr "Sprawdzanie aktualizacji"
msgid "Click to Download Covers"
msgstr "Kliknij aby pobrac okladki"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "Zegar"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 17:05+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-08-11 19:45\n"
"Last-Translator: boto12\n"
"Language-Team: \n"
@ -205,6 +205,9 @@ msgstr "Procurando Atualizações"
msgid "Click to Download Covers"
msgstr "Aperte para baixar capas"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "Relógio"
@ -1169,4 +1172,3 @@ msgstr "de"
msgid "seconds left"
msgstr "segundos restantes"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 17:05+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-08-11 12:25\n"
"Last-Translator: Sky8000\n"
"Language-Team: \n"
@ -205,6 +205,9 @@ msgstr "Procurando Actualizações"
msgid "Click to Download Covers"
msgstr "Carregue para descarregar capas"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "Relógio"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 17:05+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: Kir\n"
"Language-Team: Kir\n"
@ -205,6 +205,9 @@ msgstr "Проверяю обновления"
msgid "Click to Download Covers"
msgstr "Нажми, чтобы скачать обложки"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "Часы"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 04:07+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -205,6 +205,9 @@ msgstr ""
msgid "Click to Download Covers"
msgstr "点击下载封面"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "时钟"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 17:05+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -205,6 +205,9 @@ msgstr "Verificando Actualizaciones"
msgid "Click to Download Covers"
msgstr "Click para bajar Carátulas"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "Reloj"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 17:05+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-08-02 12:20+0200\n"
"Last-Translator: Katsurou\n"
"Language-Team: Katsurou, pirateX\n"
@ -205,6 +205,9 @@ msgstr "Letar efter uppdateringar"
msgid "Click to Download Covers"
msgstr "Klicka för att ladda ner omslag"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "Klocka"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 17:05+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -205,6 +205,9 @@ msgstr "正在檢查更新"
msgid "Click to Download Covers"
msgstr "點擊進行封面下載"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "時鐘"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-08-21 04:07+0200\n"
"POT-Creation-Date: 2009-09-02 02:36-0400\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -205,6 +205,9 @@ msgstr ""
msgid "Click to Download Covers"
msgstr "Kapaklari Indirmek için Tiklayin"
msgid "Click to change game ID"
msgstr ""
msgid "Clock"
msgstr "Saat"

File diff suppressed because one or more lines are too long

View File

@ -394,96 +394,96 @@ static void free_block(wbfs_t *p,int bl)
u32 v = wbfs_ntohl(p->freeblks[i]);
p->freeblks[i] = wbfs_htonl(v | 1<<j);
}
u32 wbfs_add_disc(wbfs_t*p,read_wiidisc_callback_t read_src_wii_disc,
void *callback_data,progress_callback_t spinner,partition_selector_t sel,int copy_1_1)
{
int i,discn;
u32 tot,cur;
u32 wii_sec_per_wbfs_sect = 1<<(p->wbfs_sec_sz_s-p->wii_sec_sz_s);
wiidisc_t *d = 0;
u8 *used = 0;
wbfs_disc_info_t *info = 0;
u8* copy_buffer = 0;
used = wbfs_malloc(p->n_wii_sec_per_disc);
if(!used)
ERROR("unable to alloc memory");
if(!copy_1_1)
{
d = wd_open_disc(read_src_wii_disc,callback_data);
if(!d)
ERROR("unable to open wii disc");
wd_build_disc_usage(d,sel,used);
wd_close_disc(d);
d = 0;
}
for(i=0;i<p->max_disc;i++)// find a free slot.
if(p->head->disc_table[i]==0)
break;
if(i==p->max_disc)
ERROR("no space left on device (table full)");
p->head->disc_table[i] = 1;
discn = i;
load_freeblocks(p);
// build disc info
info = wbfs_ioalloc(p->disc_info_sz);
read_src_wii_disc(callback_data,0,0x100,info->disc_header_copy);
copy_buffer = wbfs_ioalloc(p->wii_sec_sz);
if(!copy_buffer)
ERROR("alloc memory");
tot=0;
cur=0;
if(spinner){
// count total number to write for spinner
for(i=0; i<p->n_wbfs_sec_per_disc;i++)
if(copy_1_1 || block_used(used,i,wii_sec_per_wbfs_sect)) tot += wii_sec_per_wbfs_sect;
spinner(0,tot);
}
for(i=0; i<p->n_wbfs_sec_per_disc;i++){
u16 bl = 0;
if(copy_1_1 || block_used(used,i,wii_sec_per_wbfs_sect)) {
u16 j;
bl = alloc_block(p);
if (bl==0xffff)
ERROR("no space left on device (disc full)");
for(j=0; j<wii_sec_per_wbfs_sect;j++) {
u32 offset = (i*(p->wbfs_sec_sz>>2)) + (j*(p->wii_sec_sz>>2));
read_src_wii_disc(callback_data,offset,p->wii_sec_sz,copy_buffer);
//fix the partition table
if(offset == (0x40000>>2))
wd_fix_partition_table(d, sel, copy_buffer);
p->write_hdsector(p->callback_data,p->part_lba+bl*(p->wbfs_sec_sz/p->hd_sec_sz)+j*(p->wii_sec_sz/p->hd_sec_sz),
p->wii_sec_sz/p->hd_sec_sz,copy_buffer);
cur++;
if(spinner)
spinner(cur,tot);
}
}
info->wlba_table[i] = wbfs_htons(bl);
}
// write disc info
int disc_info_sz_lba = p->disc_info_sz>>p->hd_sec_sz_s;
p->write_hdsector(p->callback_data,p->part_lba+1+discn*disc_info_sz_lba,disc_info_sz_lba,info);
wbfs_sync(p);
error:
if(d)
wd_close_disc(d);
if(used)
wbfs_free(used);
if(info)
wbfs_iofree(info);
if(copy_buffer)
wbfs_iofree(copy_buffer);
// init with all free blocks
return 0;
}
u32 wbfs_add_disc(wbfs_t*p,read_wiidisc_callback_t read_src_wii_disc,
void *callback_data,progress_callback_t spinner,partition_selector_t sel,int copy_1_1)
{
int i,discn;
u32 tot,cur;
u32 wii_sec_per_wbfs_sect = 1<<(p->wbfs_sec_sz_s-p->wii_sec_sz_s);
wiidisc_t *d = 0;
u8 *used = 0;
wbfs_disc_info_t *info = 0;
u8* copy_buffer = 0;
used = wbfs_malloc(p->n_wii_sec_per_disc);
if(!used)
ERROR("unable to alloc memory");
if(!copy_1_1)
{
d = wd_open_disc(read_src_wii_disc,callback_data);
if(!d)
ERROR("unable to open wii disc");
wd_build_disc_usage(d,sel,used);
wd_close_disc(d);
d = 0;
}
for(i=0;i<p->max_disc;i++)// find a free slot.
if(p->head->disc_table[i]==0)
break;
if(i==p->max_disc)
ERROR("no space left on device (table full)");
p->head->disc_table[i] = 1;
discn = i;
load_freeblocks(p);
// build disc info
info = wbfs_ioalloc(p->disc_info_sz);
read_src_wii_disc(callback_data,0,0x100,info->disc_header_copy);
copy_buffer = wbfs_ioalloc(p->wii_sec_sz);
if(!copy_buffer)
ERROR("alloc memory");
tot=0;
cur=0;
if(spinner){
// count total number to write for spinner
for(i=0; i<p->n_wbfs_sec_per_disc;i++)
if(copy_1_1 || block_used(used,i,wii_sec_per_wbfs_sect)) tot += wii_sec_per_wbfs_sect;
spinner(0,tot);
}
for(i=0; i<p->n_wbfs_sec_per_disc;i++){
u16 bl = 0;
if(copy_1_1 || block_used(used,i,wii_sec_per_wbfs_sect)) {
u16 j;
bl = alloc_block(p);
if (bl==0xffff)
ERROR("no space left on device (disc full)");
for(j=0; j<wii_sec_per_wbfs_sect;j++) {
u32 offset = (i*(p->wbfs_sec_sz>>2)) + (j*(p->wii_sec_sz>>2));
read_src_wii_disc(callback_data,offset,p->wii_sec_sz,copy_buffer);
//fix the partition table
if(offset == (0x40000>>2))
wd_fix_partition_table(d, sel, copy_buffer);
p->write_hdsector(p->callback_data,p->part_lba+bl*(p->wbfs_sec_sz/p->hd_sec_sz)+j*(p->wii_sec_sz/p->hd_sec_sz),
p->wii_sec_sz/p->hd_sec_sz,copy_buffer);
cur++;
if(spinner)
spinner(cur,tot);
}
}
info->wlba_table[i] = wbfs_htons(bl);
}
// write disc info
int disc_info_sz_lba = p->disc_info_sz>>p->hd_sec_sz_s;
p->write_hdsector(p->callback_data,p->part_lba+1+discn*disc_info_sz_lba,disc_info_sz_lba,info);
wbfs_sync(p);
error:
if(d)
wd_close_disc(d);
if(used)
wbfs_free(used);
if(info)
wbfs_iofree(info);
if(copy_buffer)
wbfs_iofree(copy_buffer);
// init with all free blocks
return 0;
}
u32 wbfs_rm_disc(wbfs_t*p, u8* discid)
{
@ -525,6 +525,22 @@ u32 wbfs_ren_disc(wbfs_t*p, u8* discid, u8* newname)
return 0;
}
u32 wbfs_rID_disc(wbfs_t*p, u8* discid, u8* newID)
{
wbfs_disc_t *d = wbfs_open_disc(p,discid);
int disc_info_sz_lba = p->disc_info_sz>>p->hd_sec_sz_s;
if(!d)
return 1;
memset(d->header->disc_header_copy, 0, 0x10);
strncpy((char *) d->header->disc_header_copy, (char *) newID, 0x9);
p->write_hdsector(p->callback_data,p->part_lba+1+d->i*disc_info_sz_lba,disc_info_sz_lba,d->header);
wbfs_close_disc(d);
return 0;
}
// trim the file-system to its minimum size
u32 wbfs_trim(wbfs_t*p);
@ -557,64 +573,64 @@ u32 wbfs_extract_disc(wbfs_disc_t*d, rw_sector_callback_t write_dst_wii_sector,v
error:
return 1;
}
u32 wbfs_extract_file(wbfs_disc_t*d, char *path);
float wbfs_estimate_disc
(
wbfs_t *p, read_wiidisc_callback_t read_src_wii_disc,
void *callback_data,
partition_selector_t sel)
{
u8 *b;
int i;
u32 tot;
u32 wii_sec_per_wbfs_sect = 1 << (p->wbfs_sec_sz_s-p->wii_sec_sz_s);
wiidisc_t *d = 0;
u8 *used = 0;
wbfs_disc_info_t *info = 0;
tot = 0;
used = wbfs_malloc(p->n_wii_sec_per_disc);
if (!used)
{
ERROR("unable to alloc memory");
}
d = wd_open_disc(read_src_wii_disc, callback_data);
if (!d)
{
ERROR("unable to open wii disc");
}
wd_build_disc_usage(d,sel,used);
wd_close_disc(d);
d = 0;
info = wbfs_ioalloc(p->disc_info_sz);
b = (u8 *)info;
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);
for (i = 0; i < p->n_wbfs_sec_per_disc; i++)
{
if (block_used(used, i, wii_sec_per_wbfs_sect))
{
tot++;
}
}
//memcpy(header, b,0x100);
error:
if (d)
wd_close_disc(d);
if (used)
wbfs_free(used);
if (info)
wbfs_iofree(info);
return tot * (((p->wbfs_sec_sz*1.0) / p->hd_sec_sz) * 512);
u32 wbfs_extract_file(wbfs_disc_t*d, char *path);
float wbfs_estimate_disc
(
wbfs_t *p, read_wiidisc_callback_t read_src_wii_disc,
void *callback_data,
partition_selector_t sel)
{
u8 *b;
int i;
u32 tot;
u32 wii_sec_per_wbfs_sect = 1 << (p->wbfs_sec_sz_s-p->wii_sec_sz_s);
wiidisc_t *d = 0;
u8 *used = 0;
wbfs_disc_info_t *info = 0;
tot = 0;
used = wbfs_malloc(p->n_wii_sec_per_disc);
if (!used)
{
ERROR("unable to alloc memory");
}
d = wd_open_disc(read_src_wii_disc, callback_data);
if (!d)
{
ERROR("unable to open wii disc");
}
wd_build_disc_usage(d,sel,used);
wd_close_disc(d);
d = 0;
info = wbfs_ioalloc(p->disc_info_sz);
b = (u8 *)info;
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);
for (i = 0; i < p->n_wbfs_sec_per_disc; i++)
{
if (block_used(used, i, wii_sec_per_wbfs_sect))
{
tot++;
}
}
//memcpy(header, b,0x100);
error:
if (d)
wd_close_disc(d);
if (used)
wbfs_free(used);
if (info)
wbfs_iofree(info);
return tot * (((p->wbfs_sec_sz*1.0) / p->hd_sec_sz) * 512);
}

View File

@ -593,13 +593,30 @@ int MenuDiscList() {
DownloadBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
DownloadBtn.SetPosition(THEME.cover_x,THEME.cover_y);
GuiTooltip IDBtnTT(tr("Click to change game ID"));
if (Settings.wsprompt == yes)
IDBtnTT.SetWidescreen(CFG.widescreen);
IDBtnTT.SetAlpha(THEME.tooltipAlpha);
GuiButton idBtn(0,0);
idBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
idBtn.SetPosition(THEME.id_x,THEME.id_y);
if (Settings.godmode == 1) {//only make the button have trigger & tooltip if in godmode
DownloadBtn.SetSoundOver(&btnSoundOver);
DownloadBtn.SetTrigger(&trigA);
DownloadBtn.SetTrigger(&trig1);
DownloadBtn.SetToolTip(&DownloadBtnTT,205,-30);
idBtn.SetSoundOver(&btnSoundOver);
idBtn.SetTrigger(&trigA);
idBtn.SetToolTip(&IDBtnTT,205,-30);
} else
{
DownloadBtn.SetRumble(false);
idBtn.SetRumble(false);
}
GuiGameBrowser * gameBrowser = NULL;
GuiGameGrid * gameGrid = NULL;
@ -645,6 +662,7 @@ int MenuDiscList() {
w.Append(&homeBtn);
w.Append(&settingsBtn);
w.Append(&DownloadBtn);
w.Append(&idBtn);
w.Append(&favoriteBtn);
w.Append(&abcBtn);
w.Append(&countBtn);
@ -1014,7 +1032,6 @@ int MenuDiscList() {
if (choice==2)
homeBtn.SetState(STATE_CLICKED);
}
if (Settings.gameDisplay==grid) {
int selectimg;
DownloadBtn.SetSize(0,0);
@ -1034,6 +1051,7 @@ int MenuDiscList() {
//Get selected game under cursor
int selectimg;
DownloadBtn.SetSize(160,224);
idBtn.SetSize(100,40);
selectimg = gameBrowser->GetSelectedOption();
gameSelected = gameBrowser->GetClickedOption();
@ -1051,7 +1069,7 @@ int MenuDiscList() {
w.Remove(&DownloadBtn);
if (GameIDTxt) {
w.Remove(GameIDTxt);
w.Remove(&idBtn);
delete GameIDTxt;
GameIDTxt = NULL;
}
@ -1120,9 +1138,10 @@ int MenuDiscList() {
if ((Settings.sinfo == GameID) || (Settings.sinfo == Both)) {
GameIDTxt = new GuiText(IDfull, 22, (GXColor) {THEME.info_r, THEME.info_g, THEME.info_b, 255});
GameIDTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
GameIDTxt->SetPosition(THEME.id_x,THEME.id_y);
GameIDTxt->SetEffect(EFFECT_FADE, 20);
w.Append(GameIDTxt);
//GameIDTxt->SetPosition(THEME.id_x,THEME.id_y);
idBtn.SetEffect(EFFECT_FADE, 20);
idBtn.SetLabel(GameIDTxt);
w.Append(&idBtn);
}
if ((Settings.sinfo == GameRegion) || (Settings.sinfo == Both)) {
@ -1134,6 +1153,22 @@ int MenuDiscList() {
}
}
}
if (idBtn.GetState() == STATE_CLICKED) {
struct discHdr * header = &gameList[gameBrowser->GetSelectedOption()];
//enter new game ID
char entered[10];
snprintf(entered, sizeof(entered), "%s", IDfull);
//entered[9] = '\0';
int result = OnScreenKeyboard(entered, 7,0);
if (result == 1) {
WBFS_ReIDGame(header->id, entered);
//__Menu_GetEntries();
menu = MENU_DISCLIST;
}
idBtn.ResetState();
}
}
if ((gameSelected >= 0) && (gameSelected < (s32)gameCnt)) {

View File

@ -476,6 +476,19 @@ s32 WBFS_RenameGame(u8 *discid, const void *newname) {
return 0;
}
s32 WBFS_ReIDGame(u8 *discid, const void *newID) {
s32 ret;
/* No USB device open */
if (!hdd)
return -1;
ret = wbfs_rID_disc(hdd, discid,(u8*)newID);
if (ret < 0)
return ret;
return 0;
}
f32 WBFS_EstimeGameSize(void) {
return wbfs_estimate_disc(hdd, __WBFS_ReadDVD, NULL, ONLY_GAME_PARTITION);

View File

@ -32,6 +32,7 @@ extern "C" {
s32 WBFS_GameSize(u8 *, f32 *);
s32 WBFS_DiskSpace(f32 *, f32 *);
s32 WBFS_RenameGame(u8 *, const void *);
s32 WBFS_ReIDGame(u8 *discid, const void *newID);
f32 WBFS_EstimeGameSize(void);
s32 __WBFS_ReadUSB(void *fp, u32 lba, u32 count, void *iobuf);