Skip to content

Commit

Permalink
- Avoid showing dummy banner in file browser.
Browse files Browse the repository at this point in the history
- Add FPKG file icon.
  • Loading branch information
Extrems committed Dec 20, 2024
1 parent dcd2c2d commit e6e2273
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 17 deletions.
26 changes: 16 additions & 10 deletions cube/swiss/source/devices/filemeta.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,19 @@ void populate_meta(file_handle *f) {
if(!f->meta && (f->meta = meta_alloc())) {
// File detection (GCM, DOL, MP3 etc)
if(f->fileType==IS_FILE) {
if(endsWith(f->name,".dol"))
f->meta->fileTypeTexObj = &dolimgTexObj;
else if(endsWith(f->name,".dol+cli"))
f->meta->fileTypeTexObj = &dolcliimgTexObj;
else if(endsWith(f->name,".elf"))
f->meta->fileTypeTexObj = &elfimgTexObj;
else if(endsWith(f->name,".fpkg"))
f->meta->fileTypeTexObj = &fpkgimgTexObj;
else if(endsWith(f->name,".mp3"))
f->meta->fileTypeTexObj = &mp3imgTexObj;
else
f->meta->fileTypeTexObj = &fileimgTexObj;

if(devices[DEVICE_CUR] == &__device_wode && f->status == STATUS_NOT_MAPPED) {
f->meta->bannerSum = 0xFFFF;
f->meta->bannerSize = BNR_PIXELDATA_LEN;
Expand All @@ -228,6 +241,7 @@ void populate_meta(file_handle *f) {
f->meta->regionTexObj = &ntscuTexObj;
else if(region == 'P')
f->meta->regionTexObj = &palTexObj;
f->meta->fileTypeTexObj = &gcmimgTexObj;
f->meta->displayName = strncpy(f->meta->bannerDesc.fullGameName, isoInfo->name, BNR_FULL_TEXT_LEN);
}
else if(devices[DEVICE_CUR] == &__device_card_a || devices[DEVICE_CUR] == &__device_card_b) {
Expand Down Expand Up @@ -293,6 +307,7 @@ void populate_meta(file_handle *f) {
f->meta->regionTexObj = &ntscuTexObj;
else if(region == 'P')
f->meta->regionTexObj = &palTexObj;
f->meta->fileTypeTexObj = &gcmimgTexObj;
memcpy(&f->meta->diskId, diskHeader, sizeof(dvddiskid));
free(diskHeader);
}
Expand All @@ -302,6 +317,7 @@ void populate_meta(file_handle *f) {
devices[DEVICE_CUR]->seekFile(f, 0, DEVICE_HANDLER_SEEK_SET);
if(devices[DEVICE_CUR]->readFile(f, &tgcHeader, sizeof(TGCHeader)) == sizeof(TGCHeader) && tgcHeader.magic == TGC_MAGIC) {
populate_game_meta(f, tgcHeader.bannerStart, tgcHeader.bannerLength);
f->meta->fileTypeTexObj = &tgcimgTexObj;
}
}
else if(endsWith(f->name,"/default.dol")) {
Expand All @@ -319,16 +335,6 @@ void populate_meta(file_handle *f) {
if(devices[DEVICE_CUR] == &__device_flippy || devices[DEVICE_CUR] == &__device_flippyflash) {
devices[DEVICE_CUR]->closeFile(f);
}
if(endsWith(f->name,".dol"))
f->meta->fileTypeTexObj = &dolimgTexObj;
else if(endsWith(f->name,".dol+cli"))
f->meta->fileTypeTexObj = &dolcliimgTexObj;
else if(endsWith(f->name,".elf"))
f->meta->fileTypeTexObj = &elfimgTexObj;
else if(endsWith(f->name,".mp3"))
f->meta->fileTypeTexObj = &mp3imgTexObj;
else
f->meta->fileTypeTexObj = &fileimgTexObj;
}
else if (f->fileType == IS_DIR) {
f->meta->fileTypeTexObj = &dirimgTexObj;
Expand Down
20 changes: 15 additions & 5 deletions cube/swiss/source/gui/FrameBufferMagic.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,15 @@ GXTexObj checkedTexObj;
GXTexObj uncheckedTexObj;
GXTexObj loadingTexObj;
GXTexObj starTexObj;
GXTexObj mp3imgTexObj;
GXTexObj dirimgTexObj;
GXTexObj dolimgTexObj;
GXTexObj dolcliimgTexObj;
GXTexObj elfimgTexObj;
GXTexObj fileimgTexObj;
GXTexObj dirimgTexObj;
GXTexObj fpkgimgTexObj;
GXTexObj gcmimgTexObj;
GXTexObj mp3imgTexObj;
GXTexObj tgcimgTexObj;
GXTexObj gcloaderTexObj;
GXTexObj m2loaderTexObj;
GXTexObj eth2gcTexObj;
Expand Down Expand Up @@ -361,12 +364,15 @@ static void init_textures()
TPL_GetTexture(&buttonsTPL, unchecked_32, &uncheckedTexObj);
TPL_GetTexture(&buttonsTPL, loading_16, &loadingTexObj);
TPL_GetTexture(&buttonsTPL, star_16, &starTexObj);
TPL_GetTexture(&imagesTPL, mp3img, &mp3imgTexObj);
TPL_GetTexture(&imagesTPL, dirimg, &dirimgTexObj);
TPL_GetTexture(&imagesTPL, dolimg, &dolimgTexObj);
TPL_GetTexture(&imagesTPL, dolcliimg, &dolcliimgTexObj);
TPL_GetTexture(&imagesTPL, elfimg, &elfimgTexObj);
TPL_GetTexture(&imagesTPL, fileimg, &fileimgTexObj);
TPL_GetTexture(&imagesTPL, dirimg, &dirimgTexObj);
TPL_GetTexture(&imagesTPL, fpkgimg, &fpkgimgTexObj);
TPL_GetTexture(&imagesTPL, gcmimg, &gcmimgTexObj);
TPL_GetTexture(&imagesTPL, mp3img, &mp3imgTexObj);
TPL_GetTexture(&imagesTPL, tgcimg, &tgcimgTexObj);
TPL_GetTexture(&imagesTPL, gcloaderimg, &gcloaderTexObj);
TPL_GetTexture(&imagesTPL, m2loaderimg, &m2loaderTexObj);
TPL_GetTexture(&imagesTPL, eth2gcimg, &eth2gcTexObj);
Expand Down Expand Up @@ -1305,7 +1311,7 @@ uiDrawObj_t* DrawFileBrowserButton(int x1, int y1, int x2, int y2, const char *m
if(eventData->file->meta) {
eventData->file->meta = calloc(1, sizeof(file_meta));
memcpy(eventData->file->meta, file->meta, sizeof(file_meta));
if(eventData->file->meta->banner) {
if(eventData->file->meta->banner && eventData->file->meta->bannerSum != 0xFFFF) {
// Make a copy cause we want this one to be killed off when the display event is disposed
eventData->file->meta->banner = memalign(32, eventData->file->meta->bannerSize);
memcpy(eventData->file->meta->banner, file->meta->banner, eventData->file->meta->bannerSize);
Expand All @@ -1320,6 +1326,10 @@ uiDrawObj_t* DrawFileBrowserButton(int x1, int y1, int x2, int y2, const char *m
GX_InitTexObjUserData(&eventData->file->meta->bannerTexObj, &eventData->file->meta->bannerTlutObj);
}
}
else {
eventData->file->meta->banner = NULL;
eventData->file->meta->bannerSize = 0;
}
if(eventData->file->meta->displayName == file->meta->bannerDesc.gameName) {
eventData->file->meta->displayName = eventData->file->meta->bannerDesc.gameName;
}
Expand Down
7 changes: 5 additions & 2 deletions cube/swiss/source/gui/FrameBufferMagic.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,15 @@ enum TextureId
extern GXTexObj ntscjTexObj;
extern GXTexObj ntscuTexObj;
extern GXTexObj palTexObj;
extern GXTexObj mp3imgTexObj;
extern GXTexObj dirimgTexObj;
extern GXTexObj dolimgTexObj;
extern GXTexObj dolcliimgTexObj;
extern GXTexObj elfimgTexObj;
extern GXTexObj fileimgTexObj;
extern GXTexObj dirimgTexObj;
extern GXTexObj fpkgimgTexObj;
extern GXTexObj gcmimgTexObj;
extern GXTexObj mp3imgTexObj;
extern GXTexObj tgcimgTexObj;

typedef struct kbBtn_ {
int supportedEntryMode;
Expand Down
Binary file added cube/swiss/source/images/fpkg.tif
Binary file not shown.
Binary file added cube/swiss/source/images/gcm.tif
Binary file not shown.
3 changes: 3 additions & 0 deletions cube/swiss/source/images/images.scf
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
<filepath="eth2gc.tif" id="eth2gcimg" colfmt=0 />
<filepath="file.tif" id="fileimg" colfmt=6 />
<filepath="flippy.tif" id="flippyimg" colfmt=0 />
<filepath="fpkg.tif" id="fpkgimg" colfmt=6 />
<filepath="gcdvdsmall.tif" id="gcdvdsmall" colfmt=3 />
<filepath="gcloader.tif" id="gcloaderimg" colfmt=0 />
<filepath="gcm.tif" id="gcmimg" colfmt=6 />
<filepath="gcnet.tif" id="gcnetimg" colfmt=0 />
<filepath="hdd.tif" id="hddimg" colfmt=9 palfmt=0 />
<filepath="m2loader.tif" id="m2loaderimg" colfmt=0 />
Expand All @@ -23,6 +25,7 @@
<filepath="qoob_ind.png" id="qoobimg_ind" colfmt=1 minfilt=0 magfilt=0 />
<filepath="sdsmall.tif" id="sdsmall" colfmt=9 palfmt=0 />
<filepath="systemimg.tif" id="systemimg" colfmt=3 />
<filepath="tgc.tif" id="tgcimg" colfmt=6 />
<filepath="usbgecko.tif" id="usbgeckoimg" colfmt=9 palfmt=0 />
<filepath="wiikey.tif" id="wiikeyimg" colfmt=0 />
<filepath="wodeimg.tif" id="wodeimg" colfmt=0 />
Binary file added cube/swiss/source/images/tgc.tif
Binary file not shown.

0 comments on commit e6e2273

Please sign in to comment.