From db86470e93460677a91baf6b15e184b44734c9f1 Mon Sep 17 00:00:00 2001 From: littlebalup Date: Sat, 3 Sep 2016 23:35:34 +0200 Subject: [PATCH 1/2] Added audio (mp3) and SFO file icons --- Makefile | 9 +++++---- init.c | 6 ++++++ main.c | 8 +++++++- resources/audio_icon.png | Bin 0 -> 662 bytes resources/sfo_icon.png | Bin 0 -> 886 bytes theme.c | 21 ++++++++++++++++++--- theme.h | 6 +++--- 7 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 resources/audio_icon.png create mode 100644 resources/sfo_icon.png diff --git a/Makefile b/Makefile index 152351b7..248103f7 100644 --- a/Makefile +++ b/Makefile @@ -4,10 +4,11 @@ OBJS = main.o init.o io_process.o package_installer.o archive.o photo.o file uncommon_dialog.o message_dialog.o ime_dialog.o config.o theme.o language.o utils.o sha1.o \ audioplayer.o minizip/unzip.o minizip/ioapi.o -RESOURCES_PNG = resources/folder_icon.png resources/file_icon.png resources/archive_icon.png resources/image_icon.png resources/ftp.png \ - resources/battery.png resources/battery_bar_green.png resources/battery_bar_red.png resources/battery_bar_charge.png \ - resources/headphone.png resources/audio_previous.png resources/audio_pause.png resources/audio_play.png \ - resources/audio_next.png +RESOURCES_PNG = resources/folder_icon.png resources/file_icon.png resources/archive_icon.png resources/image_icon.png \ + resources/audio_icon.png resources/sfo_icon.png \ + resources/ftp.png resources/battery.png resources/battery_bar_green.png resources/battery_bar_red.png \ + resources/battery_bar_charge.png resources/headphone.png resources/audio_previous.png resources/audio_pause.png \ + resources/audio_play.png resources/audio_next.png RESOURCES_TXT = resources/theme.txt resources/colors.txt resources/english_us.txt OBJS += $(RESOURCES_PNG:.png=.o) $(RESOURCES_TXT:.txt=.o) diff --git a/init.c b/init.c index e329fd95..90177ce3 100644 --- a/init.c +++ b/init.c @@ -29,6 +29,10 @@ extern unsigned char _binary_resources_archive_icon_png_start; extern unsigned char _binary_resources_archive_icon_png_size; extern unsigned char _binary_resources_image_icon_png_start; extern unsigned char _binary_resources_image_icon_png_size; +extern unsigned char _binary_resources_audio_icon_png_start; +extern unsigned char _binary_resources_audio_icon_png_size; +extern unsigned char _binary_resources_sfo_icon_png_start; +extern unsigned char _binary_resources_sfo_icon_png_size; extern unsigned char _binary_resources_ftp_png_start; extern unsigned char _binary_resources_ftp_png_size; extern unsigned char _binary_resources_battery_png_start; @@ -63,6 +67,8 @@ static DefaultFile default_files[] = { { "ux0:VitaShell/theme/Default/file_icon.png", (void *)&_binary_resources_file_icon_png_start, (int)&_binary_resources_file_icon_png_size }, { "ux0:VitaShell/theme/Default/archive_icon.png", (void *)&_binary_resources_archive_icon_png_start, (int)&_binary_resources_archive_icon_png_size }, { "ux0:VitaShell/theme/Default/image_icon.png", (void *)&_binary_resources_image_icon_png_start, (int)&_binary_resources_image_icon_png_size }, + { "ux0:VitaShell/theme/Default/audio_icon.png", (void *)&_binary_resources_audio_icon_png_start, (int)&_binary_resources_audio_icon_png_size }, + { "ux0:VitaShell/theme/Default/sfo_icon.png", (void *)&_binary_resources_sfo_icon_png_start, (int)&_binary_resources_sfo_icon_png_size }, { "ux0:VitaShell/theme/Default/ftp.png", (void *)&_binary_resources_ftp_png_start, (int)&_binary_resources_ftp_png_size }, { "ux0:VitaShell/theme/Default/battery.png", (void *)&_binary_resources_battery_png_start, (int)&_binary_resources_battery_png_size }, { "ux0:VitaShell/theme/Default/battery_bar_red.png", (void *)&_binary_resources_battery_bar_red_png_start, (int)&_binary_resources_battery_bar_red_png_size }, diff --git a/main.c b/main.c index 53273ce5..a949ee23 100644 --- a/main.c +++ b/main.c @@ -1138,12 +1138,18 @@ int shellMain() { color = FOLDER_COLOR; vita2d_draw_texture(folder_icon, SHELL_MARGIN_X, y + 3.0f); } else { - if (file_entry->type == FILE_TYPE_BMP || file_entry->type == FILE_TYPE_PNG || file_entry->type == FILE_TYPE_JPEG || file_entry->type == FILE_TYPE_MP3) { // Images + if (file_entry->type == FILE_TYPE_BMP || file_entry->type == FILE_TYPE_PNG || file_entry->type == FILE_TYPE_JPEG) { // Images color = IMAGE_COLOR; vita2d_draw_texture(image_icon, SHELL_MARGIN_X, y + 3.0f); } else if (file_entry->type == FILE_TYPE_VPK || file_entry->type == FILE_TYPE_ZIP) { // Archive color = ARCHIVE_COLOR; vita2d_draw_texture(archive_icon, SHELL_MARGIN_X, y + 3.0f); + } else if (file_entry->type == FILE_TYPE_MP3) { // Audio + color = IMAGE_COLOR; + vita2d_draw_texture(audio_icon, SHELL_MARGIN_X, y + 3.0f); + } else if (file_entry->type == FILE_TYPE_SFO) { // SFO + // note: specific color to be determined + vita2d_draw_texture(sfo_icon, SHELL_MARGIN_X, y + 3.0f); } else { // Other files vita2d_draw_texture(file_icon, SHELL_MARGIN_X, y + 3.0f); } diff --git a/resources/audio_icon.png b/resources/audio_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..7efdd10b366a4a2c79a9174588f3d0b5fafc8f8d GIT binary patch literal 662 zcmV;H0%`q;P)Y=6G0rtzuj%pMA~FY^N^$^NlQv?!9$Va>riP?YKe%57x5&X1TWG;dl6Av z2p$DR(SvvqZ;B04J$mq>tt1z1+Qdg6d35vIO?Edk>tzeo^s%Y^!<^>h$8Wxw;b3rF zgSYxv&#^Ye)?Y>TlM)C=kpDJYmuoT#96WJ2*4x{u#^VWj*6rv@z8Oz%m1B(pWtAYg zS~9f<{Vl`C`{vPd!O}4j`46B{gD6$8k}1O5;XQct;^|XAqvP<0@9gc!HI-m#A+>C4 zwQ?GDd#nenPXM%=iG6Q|YK~7p2gQ=uYN2njwTYR+d{T*H5Hv4+AuUc zC$Bxzy3R%3?Url6kTH}p-l0bK7f1*NwEYAc6RZaYMyIv`QX_)(KPCBg5;%0-&pY^` zW;5s1G-T6r^Dl`(#lL`|@Lh+`=Zyvfz5z#@9c4*DHdn&$Q0G%crGQpsHeI>46HpH} zJ>p%Sft*CKE(wqo6{1)LVNBr6041s!fL+g50La^QXadk$6;dw>xg08G5$i$`g@Oo0 zB>*&3$|XpvvBx^F8Gso8x6^C20I;w&Kkq$q`6lmlonctcCCf@y%4goMeSZExEvyuE wtEz6O?(+N@2GE#)_BR#_fB>L+e_M9=2bD?Mn1qR7iU0rr07*qoM6N<$f*;`0cp9fmpLxx-uGT6QEUAN&e*<|5jVvq0qok(tlz~d^<SUoI&B6khfS4d6b!fwI z8c}R1GLO)Jv*Y7@_4PNTY08!@eN?);=y|i3a#xw@>1jUQ{|O)L{fLg$9o)EnouQ$9 zbar-PjofnytJM(>9y&;|*n$~|z|EU~^ZgIs0kFG&kZs$y($n)6Ns_Q`m7_v&Yf?wdGi~zwJm1FODh3rZ*S-4UoIdboI3R- zP907i>J&i`Lf7XLVyHS^Sh9pdA>_$tRYgTv{^D{bCN87uxO8!XrOTF~DwwzVgqX4G z{eDJAM*%o+;ImLa=TLPBFfcGkrK>`%R>L{R>9NzOD4qob&5V&_Uoian5mW>b1&lxc zx)N%I^75M1+_`%@xC$_DhzjOexXY3`qHeg1Oi)Cm9)^XwX@18SsA1-_xQYwYTy z*`hhAHM)`$%D;~uwM6kEy!p^Q&DbR4RzWQHVX&fkBaULGrluBWT4^q*M~9D&#c{kl ziee{uQfcz#)5`!Qwc6~HLx&Ha&jqFFJ&b|qsW Date: Sun, 4 Sep 2016 00:08:22 +0200 Subject: [PATCH 2/2] Added text file icon --- Makefile | 2 +- file.c | 15 ++++++++------- file.h | 1 + init.c | 3 +++ main.c | 4 ++++ resources/text_icon.png | Bin 0 -> 811 bytes theme.c | 9 ++++++++- theme.h | 2 +- 8 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 resources/text_icon.png diff --git a/Makefile b/Makefile index 248103f7..42cb96d2 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ OBJS = main.o init.o io_process.o package_installer.o archive.o photo.o file audioplayer.o minizip/unzip.o minizip/ioapi.o RESOURCES_PNG = resources/folder_icon.png resources/file_icon.png resources/archive_icon.png resources/image_icon.png \ - resources/audio_icon.png resources/sfo_icon.png \ + resources/audio_icon.png resources/sfo_icon.png resources/text_icon.png\ resources/ftp.png resources/battery.png resources/battery_bar_green.png resources/battery_bar_red.png \ resources/battery_bar_charge.png resources/headphone.png resources/audio_previous.png resources/audio_pause.png \ resources/audio_play.png resources/audio_next.png diff --git a/file.c b/file.c index fab36db1..6d55625e 100644 --- a/file.c +++ b/file.c @@ -61,16 +61,16 @@ int WriteFile(char *file, void *buf, int size) { return written; } -int getFileSize(char *pInputFileName) -{ - SceUID fd = sceIoOpen(pInputFileName, SCE_O_RDONLY, 0); +int getFileSize(char *pInputFileName) +{ + SceUID fd = sceIoOpen(pInputFileName, SCE_O_RDONLY, 0); if (fd < 0) return fd; - - int fileSize = sceIoLseek(fd, 0, SCE_SEEK_END); + + int fileSize = sceIoLseek(fd, 0, SCE_SEEK_END); - sceIoClose(fd); - return fileSize; + sceIoClose(fd); + return fileSize; } int getPathInfo(char *path, uint64_t *size, uint32_t *folders, uint32_t *files) { @@ -363,6 +363,7 @@ static ExtensionType extension_types[] = { { ".SFO", FILE_TYPE_SFO }, { ".VPK", FILE_TYPE_VPK }, { ".ZIP", FILE_TYPE_ZIP }, + { ".TXT", FILE_TYPE_TXT }, }; int getFileType(char *file) { diff --git a/file.h b/file.h index 6bbd4793..8e649308 100644 --- a/file.h +++ b/file.h @@ -38,6 +38,7 @@ enum FileTypes { FILE_TYPE_SFO, FILE_TYPE_VPK, FILE_TYPE_ZIP, + FILE_TYPE_TXT, }; enum SortFlags { diff --git a/init.c b/init.c index 90177ce3..db18d633 100644 --- a/init.c +++ b/init.c @@ -33,6 +33,8 @@ extern unsigned char _binary_resources_audio_icon_png_start; extern unsigned char _binary_resources_audio_icon_png_size; extern unsigned char _binary_resources_sfo_icon_png_start; extern unsigned char _binary_resources_sfo_icon_png_size; +extern unsigned char _binary_resources_text_icon_png_start; +extern unsigned char _binary_resources_text_icon_png_size; extern unsigned char _binary_resources_ftp_png_start; extern unsigned char _binary_resources_ftp_png_size; extern unsigned char _binary_resources_battery_png_start; @@ -69,6 +71,7 @@ static DefaultFile default_files[] = { { "ux0:VitaShell/theme/Default/image_icon.png", (void *)&_binary_resources_image_icon_png_start, (int)&_binary_resources_image_icon_png_size }, { "ux0:VitaShell/theme/Default/audio_icon.png", (void *)&_binary_resources_audio_icon_png_start, (int)&_binary_resources_audio_icon_png_size }, { "ux0:VitaShell/theme/Default/sfo_icon.png", (void *)&_binary_resources_sfo_icon_png_start, (int)&_binary_resources_sfo_icon_png_size }, + { "ux0:VitaShell/theme/Default/text_icon.png", (void *)&_binary_resources_text_icon_png_start, (int)&_binary_resources_text_icon_png_size }, { "ux0:VitaShell/theme/Default/ftp.png", (void *)&_binary_resources_ftp_png_start, (int)&_binary_resources_ftp_png_size }, { "ux0:VitaShell/theme/Default/battery.png", (void *)&_binary_resources_battery_png_start, (int)&_binary_resources_battery_png_size }, { "ux0:VitaShell/theme/Default/battery_bar_red.png", (void *)&_binary_resources_battery_bar_red_png_start, (int)&_binary_resources_battery_bar_red_png_size }, diff --git a/main.c b/main.c index a949ee23..78b9ab8b 100644 --- a/main.c +++ b/main.c @@ -258,6 +258,7 @@ int handleFile(char *file, FileListEntry *entry) { } switch (type) { + case FILE_TYPE_TXT: case FILE_TYPE_UNKNOWN: res = textViewer(file); break; @@ -1150,6 +1151,9 @@ int shellMain() { } else if (file_entry->type == FILE_TYPE_SFO) { // SFO // note: specific color to be determined vita2d_draw_texture(sfo_icon, SHELL_MARGIN_X, y + 3.0f); + } else if (file_entry->type == FILE_TYPE_TXT) { // TXT + // note: specific color to be determined + vita2d_draw_texture(text_icon, SHELL_MARGIN_X, y + 3.0f); } else { // Other files vita2d_draw_texture(file_icon, SHELL_MARGIN_X, y + 3.0f); } diff --git a/resources/text_icon.png b/resources/text_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..5b38aa09ac4437347b8bf5360b53eb4a524a15c6 GIT binary patch literal 811 zcmV+`1JwM9P)ax||q!!kgJT*Bz`*h~k)Rmh&o}C#!vb7e)(r&kDHk;Y5qMAR`x#xTMeuv4E zr|I>2cV_1veYke@`r9EOfLdj2tU{yFKvnxdid99eMNvAP4sYKrQmt00AE_^1xOBd> zF#oDILLvO@c3EkyV2nwD78ETM19+a#p@RoeRrWR-oI88&;==r^7rPazf-0`#5Cj2I zyq=GeIt{5}tAw?X1N#p!F+Op8*h5tm#c^CJl?o#H>-jj`Jl8|SP%4*Y2&k$ELL5i5 zS}Pclj5Hdjs?_Us_U|)Tt0Stc7BPk(2&t6E5RqtwkuBv?2}Jr*FzBHeT-QyjERw;b zfJ(nY6yGml#Gv+XKp=`EmX?+=W(Ne4`joFVRX9FAK^TUkkDPA?djgIhJq98eF^CAp z7=j=mwNr}Qlh~v$uYRK|5EdoCbZbkgUq-@kSWq^SVS+|$0?#WUFqlJ$mBE4QOdGK)h pb@nSvWZ?MbA2;o9O@Soq`~mf8U-D=ch5i5l002ovPDHLkV1lA|dFlWF literal 0 HcmV?d00001 diff --git a/theme.c b/theme.c index 11993e47..e8e83564 100644 --- a/theme.c +++ b/theme.c @@ -28,6 +28,7 @@ extern unsigned char _binary_resources_archive_icon_png_start; extern unsigned char _binary_resources_image_icon_png_start; extern unsigned char _binary_resources_audio_icon_png_start; extern unsigned char _binary_resources_sfo_icon_png_start; +extern unsigned char _binary_resources_text_icon_png_start; extern unsigned char _binary_resources_ftp_png_start; extern unsigned char _binary_resources_battery_png_start; extern unsigned char _binary_resources_battery_bar_red_png_start; @@ -57,7 +58,7 @@ int PROGRESS_BAR_BG_COLOR; int HEX_OFFSET_COLOR; int HEX_NIBBLE_COLOR; -vita2d_texture *folder_icon = NULL, *file_icon = NULL, *archive_icon = NULL, *image_icon = NULL, *audio_icon = NULL, *sfo_icon = NULL, +vita2d_texture *folder_icon = NULL, *file_icon = NULL, *archive_icon = NULL, *image_icon = NULL, *audio_icon = NULL, *sfo_icon = NULL, *text_icon = NULL, *ftp_image = NULL, *dialog_image = NULL, *context_image = NULL, *battery_image = NULL, *battery_bar_red_image = NULL, *battery_bar_green_image = NULL, *battery_bar_charge_image = NULL, *bg_browser_image = NULL, *bg_hex_image = NULL, *bg_text_image = NULL, *bg_photo_image = NULL; @@ -131,6 +132,9 @@ void loadTheme() { snprintf(path, MAX_PATH_LENGTH, "ux0:VitaShell/theme/%s/sfo_icon.png", theme_name); sfo_icon = vita2d_load_PNG_file(path); + snprintf(path, MAX_PATH_LENGTH, "ux0:VitaShell/theme/%s/text_icon.png", theme_name); + text_icon = vita2d_load_PNG_file(path); + snprintf(path, MAX_PATH_LENGTH, "ux0:VitaShell/theme/%s/ftp.png", theme_name); ftp_image = vita2d_load_PNG_file(path); @@ -205,6 +209,9 @@ void loadTheme() { if (!sfo_icon) sfo_icon = vita2d_load_PNG_buffer(&_binary_resources_sfo_icon_png_start); + if (!text_icon) + text_icon = vita2d_load_PNG_buffer(&_binary_resources_text_icon_png_start); + if (!ftp_image) ftp_image = vita2d_load_PNG_buffer(&_binary_resources_ftp_png_start); diff --git a/theme.h b/theme.h index 4612399c..de07e40b 100644 --- a/theme.h +++ b/theme.h @@ -41,7 +41,7 @@ extern int PROGRESS_BAR_BG_COLOR; extern int HEX_OFFSET_COLOR; extern int HEX_NIBBLE_COLOR; -extern vita2d_texture *folder_icon, *file_icon, *archive_icon, *image_icon, *audio_icon, *sfo_icon, +extern vita2d_texture *folder_icon, *file_icon, *archive_icon, *image_icon, *audio_icon, *sfo_icon, *text_icon, *ftp_image, *dialog_image, *context_image, *battery_image, *battery_bar_red_image, *battery_bar_green_image, *battery_bar_charge_image, *bg_browser_image, *bg_hex_image, *bg_text_image, *bg_photo_image;