mirror of
https://github.com/joel16/VitaShell.git
synced 2025-03-03 17:47:11 +00:00
Added text file icon
This commit is contained in:
parent
db86470e93
commit
d33fc9097b
2
Makefile
2
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
|
||||
|
15
file.c
15
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) {
|
||||
|
1
file.h
1
file.h
@ -38,6 +38,7 @@ enum FileTypes {
|
||||
FILE_TYPE_SFO,
|
||||
FILE_TYPE_VPK,
|
||||
FILE_TYPE_ZIP,
|
||||
FILE_TYPE_TXT,
|
||||
};
|
||||
|
||||
enum SortFlags {
|
||||
|
3
init.c
3
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 },
|
||||
|
4
main.c
4
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);
|
||||
}
|
||||
|
BIN
resources/text_icon.png
Normal file
BIN
resources/text_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 811 B |
9
theme.c
9
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);
|
||||
|
||||
|
2
theme.h
2
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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user