Cosmetic changes

This commit is contained in:
TheFloW 2017-02-25 00:31:47 +01:00
parent b7df64efde
commit d8f6fbb336
13 changed files with 112 additions and 114 deletions

View File

@ -3,39 +3,36 @@
VitaShell is an alternative replacement of the PS Vita's LiveArea. It offers you a file manager, package installer, built-in FTP and much more.
This homebrew was an entry of the Revitalize PS Vita homebrew competition and won the first prize. HENkaku's molecularShell is also based on VitaShell.
### Donation ###
https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=total%2ecinderella%40gmail%2ecom&lc=DE&item_name=6%2e61%20Adrenaline&no_note=0&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
### Customization ###
You can customize those files:
- **'colors.txt'**: All colors adjustable
- **'bg_browser.png'**: Background for file browser
- **'bg_hexeditor.png'**: Background for hex editor
- **'bg_texteditor.png'**: Background for text editor
- **'bg_photoviewer.png'**: Background for photo viewer
- **'bg_audioplayer.png'**: Background for audio player
- **'settings.png'**: Background for settings
- **'wallpaper.png'**: Wallpaper
- **'dialog.png'**: Dialog menu image (Can be any size. This image file will be stretched by VitaShell to fit the dialog box. Suggestion: Don't use motives, as it will not look good with wrong proportion).
- **'context.png'**: Context menu image (Can be any size. Suggestion: It will look great if you add alpha channel to your image).
- **'context_more.png'**: Context menu more image (Can be any size. Suggestion: It will look great if you add alpha channel to your image).
- **'battery.png'**: Battery border icon
- **'battery_bar_green.png'**: Green battery bar
- **'battery_bar_red.png'**: Red battery bar
- **'battery_bar_charge.png'**: Charging battery bar
- **'ftp.png'**: Ftp icon
- **'audio_icon.png'**: Audio icon
- **'archive_icon.png'**: Archive icon
- **'file_icon.png'**: File icon
- **'folder_icon.png'**: Folder icon
- **'image_icon.png'**: Image icon
- **'sfo_icon.png'**: SFO icon
- **'text_icon.png'**: Text icon
- **'cover.png'**: Default album cover
- **'play.png'**: Play icon
- **'pause.png'**: Pause icon
- **'fastforward.png'**: Fastforward icon
- **'fastrewind.png'**: Fastrewind icon
- **colors.txt**: All colors adjustable
- **bg_browser.png**: Background for file browser
- **bg_hexeditor.png**: Background for hex editor
- **bg_texteditor.png**: Background for text editor
- **bg_photoviewer.png**: Background for photo viewer
- **bg_audioplayer.png**: Background for audio player
- **settings.png**: Background for settings
- **wallpaper.png**: Wallpaper
- **dialog.png**: Dialog menu image (Can be any size. This image file will be stretched by VitaShell to fit the dialog box. Suggestion: Don't use motives, as it will not look good with wrong proportion).
- **context.png**: Context menu image (Can be any size. Suggestion: It will look great if you add alpha channel to your image).
- **context_more.png**: Context menu more image (Can be any size. Suggestion: It will look great if you add alpha channel to your image).
- **battery.png**: Battery border icon
- **battery_bar_green.png**: Green battery bar
- **battery_bar_red.png**: Red battery bar
- **battery_bar_charge.png**: Charging battery bar
- **ftp.png**: Ftp icon
- **audio_icon.png**: Audio icon
- **archive_icon.png**: Archive icon
- **file_icon.png**: File icon
- **folder_icon.png**: Folder icon
- **image_icon.png**: Image icon
- **sfo_icon.png**: SFO icon
- **text_icon.png**: Text icon
- **cover.png**: Default album cover
- **play.png**: Play icon
- **pause.png**: Pause icon
- **fastforward.png**: Fastforward icon
- **fastrewind.png**: Fastrewind icon
**Theme setting:** VitaShell will load the theme that is set in **'ux0:VitaShell/theme/theme.txt'** (THEME_NAME = "YOUR_THEME_NAME")

View File

@ -127,11 +127,11 @@ static void utf16_to_utf8(uint16_t *src, uint8_t *dst) {
} else if((src[i] & 0xF800) == 0) {
*(dst++) = ((src[i] >> 6) & 0xFF) | 0xC0;
*(dst++) = (src[i] & 0x3F) | 0x80;
} else if((src[i] & 0xFC00) == 0xD800 && (src[i + 1] & 0xFC00) == 0xDC00) {
} else if((src[i] & 0xFC00) == 0xD800 && (src[i+1] & 0xFC00) == 0xDC00) {
*(dst++) = (((src[i] + 64) >> 8) & 0x3) | 0xF0;
*(dst++) = (((src[i] >> 2) + 16) & 0x3F) | 0x80;
*(dst++) = ((src[i] >> 4) & 0x30) | 0x80 | ((src[i + 1] << 2) & 0xF);
*(dst++) = (src[i + 1] & 0x3F) | 0x80;
*(dst++) = ((src[i] >> 4) & 0x30) | 0x80 | ((src[i+1] << 2) & 0xF);
*(dst++) = (src[i+1] & 0x3F) | 0x80;
i += 1;
} else {
*(dst++) = ((src[i] >> 12) & 0xF) | 0xE0;

View File

@ -389,7 +389,7 @@ int audioPlayer(const char *file, int type, FileList *list, FileListEntry *entry
}
// Info
float x = 2.0f * SHELL_MARGIN_X + cover_size;
float x = 2.0f*SHELL_MARGIN_X + cover_size;
pgf_draw_text(x, START_Y + (0 * FONT_Y_SPACE), AUDIO_INFO_ASSIGN, FONT_SIZE, language_container[TITLE]);
pgf_draw_text(x, START_Y + (1 * FONT_Y_SPACE), AUDIO_INFO_ASSIGN, FONT_SIZE, language_container[ALBUM]);

42
hex.c
View File

@ -147,15 +147,15 @@ int hexViewer(const char *file) {
list.head->previous = NULL;
// Read
memcpy(list.head->data, buffer + base_pos, 0x10);
memcpy(list.head->data, buffer+base_pos, 0x10);
}
}
} else if (hold_buttons & SCE_CTRL_DOWN || hold2_buttons & SCE_CTRL_LEFT_ANALOG_DOWN) {
if ((rel_pos + 0x10) < size) {
if ((rel_pos + 0x10) < ((MAX_POSITION - 1) * 0x10)) {
if ((rel_pos+0x10) < size) {
if ((rel_pos+0x10) < ((MAX_POSITION-1) * 0x10)) {
rel_pos += 0x10;
} else {
if ((base_pos + rel_pos + 0x10) < size) {
if ((base_pos+rel_pos+0x10) < size) {
base_pos += 0x10;
// Head to tail
@ -171,7 +171,7 @@ int hexViewer(const char *file) {
list.tail->next = NULL;
// Read
memcpy(list.tail->data, buffer + base_pos + (0x10 - 1) * 0x10, 0x10);
memcpy(list.tail->data, buffer+base_pos + (0x10-1) * 0x10, 0x10);
}
}
}
@ -179,9 +179,9 @@ int hexViewer(const char *file) {
// Page skip
if (hold_buttons & SCE_CTRL_LTRIGGER) {
if ((base_pos + rel_pos) != 0) {
if ((base_pos - 0x10 * 0x10) >= 0) {
base_pos -= 0x10 * 0x10;
if ((base_pos+rel_pos) != 0) {
if ((base_pos-0x10*0x10) >= 0) {
base_pos -= 0x10*0x10;
} else {
base_pos = 0;
rel_pos = 0;
@ -199,8 +199,8 @@ int hexViewer(const char *file) {
if (hold_buttons & SCE_CTRL_RTRIGGER) {
if (size >= 0xF0) {
if ((base_pos + rel_pos + 0x1F0) < size) {
base_pos += 0x10 * 0x10;
if ((base_pos+rel_pos+0x1F0) < size) {
base_pos += 0x10*0x10;
} else {
base_pos = ALIGN(size, 0x10) - 0xF0;
rel_pos = 0xE0;
@ -210,22 +210,22 @@ int hexViewer(const char *file) {
int i;
for (i = 0; i < 0x10; i++) {
memcpy(entry->data, buffer + base_pos + i * 0x10, 0x10);
memcpy(entry->data, buffer + base_pos + i*0x10, 0x10);
entry = entry->next;
}
}
}
uint8_t max_nibble = (2 * 0x10) - 1;
uint8_t max_nibble = (2*0x10) - 1;
// Last line
if ((base_pos + rel_pos + 0x10) >= size) {
if ((base_pos+rel_pos+0x10) >= size) {
uint8_t rest = size % 0x10;
if (rest == 0)
rest = 0x10;
max_nibble = 2 * rest - 1;
max_nibble = 2*rest - 1;
}
if (nibble_pos > max_nibble) {
@ -278,11 +278,11 @@ int hexViewer(const char *file) {
if (low) {
uint8_t byte = (high_nibble << 4) | nibble;
buffer[cur_pos] = byte;
entry->data[nibble_pos / 2] = byte;
entry->data[nibble_pos/2] = byte;
} else {
uint8_t byte = (nibble << 4) | low_nibble;
buffer[cur_pos] = byte;
entry->data[nibble_pos / 2] = byte;
entry->data[nibble_pos/2] = byte;
}
}
} else {
@ -312,7 +312,7 @@ int hexViewer(const char *file) {
drawScrollBar(pos, n_lines);
// Offset/size
pgf_draw_textf(HEX_CHAR_X, START_Y, HEX_OFFSET_COLOR, FONT_SIZE, "%08X/%08X", rel_pos + base_pos, size);
pgf_draw_textf(HEX_CHAR_X, START_Y, HEX_OFFSET_COLOR, FONT_SIZE, "%08X/%08X", rel_pos+base_pos, size);
// Offset x
pgf_draw_text(SHELL_MARGIN_X, START_Y, HEX_OFFSET_COLOR, FONT_SIZE, language_container[OFFSET]);
@ -347,19 +347,19 @@ int hexViewer(const char *file) {
// Character hex
uint8_t high_nibble = (ch >> 4) & 0xF;
uint8_t low_nibble = ch & 0xF;
int w = pgf_draw_textf(HEX_OFFSET_X + (x * HEX_OFFSET_SPACE), START_Y + ((y + 1) * FONT_Y_SPACE), (on_line && nibble_x == nibble_pos) ? HEX_NIBBLE_COLOR : color, FONT_SIZE, "%01X", high_nibble);
pgf_draw_textf(HEX_OFFSET_X + (x * HEX_OFFSET_SPACE) + w, START_Y + ((y + 1) * FONT_Y_SPACE), (on_line && (nibble_x + 1) == nibble_pos) ? HEX_NIBBLE_COLOR : color, FONT_SIZE, "%01X", low_nibble);
int w = pgf_draw_textf(HEX_OFFSET_X + (x * HEX_OFFSET_SPACE), START_Y + ((y+1) * FONT_Y_SPACE), (on_line && nibble_x == nibble_pos) ? HEX_NIBBLE_COLOR : color, FONT_SIZE, "%01X", high_nibble);
pgf_draw_textf(HEX_OFFSET_X + (x * HEX_OFFSET_SPACE) + w, START_Y + ((y+1) * FONT_Y_SPACE), (on_line && (nibble_x+1) == nibble_pos) ? HEX_NIBBLE_COLOR : color, FONT_SIZE, "%01X", low_nibble);
// Character
ch = (ch >= 0x20) ? ch : '.';
int width = font_size_cache[(int)ch];
uint8_t byte_nibble_pos = nibble_pos - (nibble_pos % 2);
pgf_draw_textf(HEX_CHAR_X + (x * FONT_X_SPACE) + (FONT_X_SPACE - width) / 2.0f, START_Y + ((y + 1) * FONT_Y_SPACE), (on_line && nibble_x == byte_nibble_pos) ? HEX_NIBBLE_COLOR : color, FONT_SIZE, "%c", ch);
pgf_draw_textf(HEX_CHAR_X + (x * FONT_X_SPACE) + (FONT_X_SPACE - width) / 2.0f, START_Y + ((y+1) * FONT_Y_SPACE), (on_line && nibble_x == byte_nibble_pos) ? HEX_NIBBLE_COLOR : color, FONT_SIZE, "%c", ch);
}
// Offset y
if (x > 0)
pgf_draw_textf(SHELL_MARGIN_X, START_Y + ((y + 1) * FONT_Y_SPACE), HEX_OFFSET_COLOR, FONT_SIZE, "%08X", base_pos + (y * 0x10));
pgf_draw_textf(SHELL_MARGIN_X, START_Y + ((y+1) * FONT_Y_SPACE), HEX_OFFSET_COLOR, FONT_SIZE, "%08X", base_pos + (y * 0x10));
// It's the end, break
if (x < 0x10)

View File

@ -37,11 +37,11 @@ static void utf16_to_utf8(const uint16_t *src, uint8_t *dst) {
} else if((src[i] & 0xF800) == 0) {
*(dst++) = ((src[i] >> 6) & 0xFF) | 0xC0;
*(dst++) = (src[i] & 0x3F) | 0x80;
} else if((src[i] & 0xFC00) == 0xD800 && (src[i + 1] & 0xFC00) == 0xDC00) {
} else if((src[i] & 0xFC00) == 0xD800 && (src[i+1] & 0xFC00) == 0xDC00) {
*(dst++) = (((src[i] + 64) >> 8) & 0x3) | 0xF0;
*(dst++) = (((src[i] >> 2) + 16) & 0x3F) | 0x80;
*(dst++) = ((src[i] >> 4) & 0x30) | 0x80 | ((src[i + 1] << 2) & 0xF);
*(dst++) = (src[i + 1] & 0x3F) | 0x80;
*(dst++) = ((src[i] >> 4) & 0x30) | 0x80 | ((src[i+1] << 2) & 0xF);
*(dst++) = (src[i+1] & 0x3F) | 0x80;
i += 1;
} else {
*(dst++) = ((src[i] >> 12) & 0xF) | 0xE0;
@ -57,10 +57,10 @@ static void utf8_to_utf16(const uint8_t *src, uint16_t *dst) {
int i;
for (i = 0; src[i];) {
if ((src[i] & 0xE0) == 0xE0) {
*(dst++) = ((src[i] & 0x0F) << 12) | ((src[i + 1] & 0x3F) << 6) | (src[i + 2] & 0x3F);
*(dst++) = ((src[i] & 0x0F) << 12) | ((src[i+1] & 0x3F) << 6) | (src[i+2] & 0x3F);
i += 3;
} else if ((src[i] & 0xC0) == 0xC0) {
*(dst++) = ((src[i] & 0x1F) << 6) | (src[i + 1] & 0x3F);
*(dst++) = ((src[i] & 0x1F) << 6) | (src[i+1] & 0x3F);
i += 2;
} else {
*(dst++) = src[i];

13
main.c
View File

@ -45,6 +45,7 @@
/*
TODO:
- Theme manager
- Show KB/s in progress bar
*/
int _newlib_heap_size_user = 128 * 1024 * 1024;
@ -367,12 +368,12 @@ static int handleFile(const char *file, FileListEntry *entry) {
void drawScrollBar(int pos, int n) {
if (n > MAX_POSITION) {
vita2d_draw_rectangle(SCROLL_BAR_X, START_Y, SCROLL_BAR_WIDTH, MAX_ENTRIES * FONT_Y_SPACE, SCROLL_BAR_BG_COLOR);
vita2d_draw_rectangle(SCROLL_BAR_X, START_Y, SCROLL_BAR_WIDTH, MAX_ENTRIES*FONT_Y_SPACE, SCROLL_BAR_BG_COLOR);
float y = START_Y + ((pos * FONT_Y_SPACE) / (n * FONT_Y_SPACE)) * (MAX_ENTRIES * FONT_Y_SPACE);
float height = ((MAX_POSITION * FONT_Y_SPACE) / (n * FONT_Y_SPACE)) * (MAX_ENTRIES * FONT_Y_SPACE);
float y = START_Y + ((pos * FONT_Y_SPACE) / (n*FONT_Y_SPACE)) * (MAX_ENTRIES*FONT_Y_SPACE);
float height = ((MAX_POSITION * FONT_Y_SPACE) / (n*FONT_Y_SPACE)) * (MAX_ENTRIES*FONT_Y_SPACE);
vita2d_draw_rectangle(SCROLL_BAR_X, MIN(y, (START_Y + MAX_ENTRIES * FONT_Y_SPACE - height)), SCROLL_BAR_WIDTH, MAX(height, SCROLL_BAR_MIN_HEIGHT), SCROLL_BAR_COLOR);
vita2d_draw_rectangle(SCROLL_BAR_X, MIN(y, (START_Y + MAX_ENTRIES*FONT_Y_SPACE - height)), SCROLL_BAR_WIDTH, MAX(height, SCROLL_BAR_MIN_HEIGHT), SCROLL_BAR_COLOR);
}
}
@ -399,10 +400,10 @@ void drawShellInfo(const char *path) {
battery_bar_image = battery_bar_red_image;
}
float percent = scePowerGetBatteryLifePercent() / 100.0f;
float percent = scePowerGetBatteryLifePercent()/100.0f;
float width = vita2d_texture_get_width(battery_bar_image);
vita2d_draw_texture_part(battery_bar_image, battery_x+3.0f + (1.0f - percent) * width, SHELL_MARGIN_Y + 5.0f, (1.0f - percent) * width, 0.0f, percent * width, vita2d_texture_get_height(battery_bar_image));
vita2d_draw_texture_part(battery_bar_image, battery_x+3.0f + (1.0f-percent) * width, SHELL_MARGIN_Y + 5.0f, (1.0f-percent) * width, 0.0f, percent*width, vita2d_texture_get_height(battery_bar_image));
if (scePowerIsBatteryCharging()) {
vita2d_draw_texture(battery_bar_charge_image, battery_x+3.0f, SHELL_MARGIN_Y+5.0f);

16
main.h
View File

@ -101,26 +101,26 @@
#define FONT_Y_SPACE 23.0f
#define pgf_draw_text(x, y, color, scale, text) \
vita2d_pgf_draw_text(font, x, (y) + 20, color, scale, text)
vita2d_pgf_draw_text(font, x, (y)+20, color, scale, text)
#define pgf_draw_textf(x, y, color, scale, ...) \
vita2d_pgf_draw_textf(font, x, (y) + 20, color, scale, __VA_ARGS__)
vita2d_pgf_draw_textf(font, x, (y)+20, color, scale, __VA_ARGS__)
// Screen
#define SCREEN_WIDTH 960
#define SCREEN_HEIGHT 544
#define SCREEN_HALF_WIDTH (SCREEN_WIDTH / 2)
#define SCREEN_HALF_HEIGHT (SCREEN_HEIGHT / 2)
#define SCREEN_HALF_WIDTH (SCREEN_WIDTH/2)
#define SCREEN_HALF_HEIGHT (SCREEN_HEIGHT/2)
// Main
#define SHELL_MARGIN_X 20.0f
#define SHELL_MARGIN_Y 18.0f
#define PATH_Y (SHELL_MARGIN_Y + 1.0f * FONT_Y_SPACE)
#define PATH_Y (SHELL_MARGIN_Y + 1.0f*FONT_Y_SPACE)
#define START_Y (SHELL_MARGIN_Y + 3.0f * FONT_Y_SPACE)
#define START_Y (SHELL_MARGIN_Y + 3.0f*FONT_Y_SPACE)
#define MAX_WIDTH (SCREEN_WIDTH - (2.0f * SHELL_MARGIN_X))
#define MAX_WIDTH (SCREEN_WIDTH - 2.0f*SHELL_MARGIN_X)
#define STATUS_BAR_SPACE_X 12.0f
@ -146,7 +146,7 @@
// File browser
#define FILE_X (SHELL_MARGIN_X+26.0f)
#define MARK_WIDTH (SCREEN_WIDTH - 2.0f * SHELL_MARGIN_X)
#define MARK_WIDTH (SCREEN_WIDTH - 2.0f*SHELL_MARGIN_X)
#define INFORMATION_X 680.0f
#define MAX_NAME_WIDTH 500.0f

View File

@ -151,7 +151,7 @@ void initContextMenuWidth() {
context_menu_home.max_width = MAX(context_menu_home.max_width, vita2d_pgf_text_width(font, FONT_SIZE, language_container[menu_home_entries[i].name]));
}
context_menu_home.max_width += 2.0f * CONTEXT_MENU_MARGIN;
context_menu_home.max_width += 2.0f*CONTEXT_MENU_MARGIN;
context_menu_home.max_width = MAX(context_menu_home.max_width, CONTEXT_MENU_MIN_WIDTH);
// Main
@ -164,7 +164,7 @@ void initContextMenuWidth() {
}
}
context_menu_main.max_width += 2.0f * CONTEXT_MENU_MARGIN;
context_menu_main.max_width += 2.0f*CONTEXT_MENU_MARGIN;
context_menu_main.max_width = MAX(context_menu_main.max_width, CONTEXT_MENU_MIN_WIDTH);
// Sort
@ -172,7 +172,7 @@ void initContextMenuWidth() {
context_menu_sort.max_width = MAX(context_menu_sort.max_width, vita2d_pgf_text_width(font, FONT_SIZE, language_container[menu_sort_entries[i].name]));
}
context_menu_sort.max_width += 2.0f * CONTEXT_MENU_MARGIN;
context_menu_sort.max_width += 2.0f*CONTEXT_MENU_MARGIN;
context_menu_sort.max_width = MAX(context_menu_sort.max_width, CONTEXT_MENU_MIN_WIDTH);
// More
@ -180,7 +180,7 @@ void initContextMenuWidth() {
context_menu_more.max_width = MAX(context_menu_more.max_width, vita2d_pgf_text_width(font, FONT_SIZE, language_container[menu_more_entries[i].name]));
}
context_menu_more.max_width += 2.0f * CONTEXT_MENU_MARGIN;
context_menu_more.max_width += 2.0f*CONTEXT_MENU_MARGIN;
context_menu_more.max_width = MAX(context_menu_more.max_width, CONTEXT_MENU_MIN_WIDTH);
}
@ -234,7 +234,7 @@ void setContextMenuMainVisibilities() {
menu_main_entries[i].visibility = CTX_VISIBLE;
}
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos + rel_pos);
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos+rel_pos);
// Invisble entries when on '..'
if (strcmp(file_entry->name, DIR_UP) == 0) {
@ -340,7 +340,7 @@ void setContextMenuMoreVisibilities() {
menu_more_entries[i].visibility = CTX_VISIBLE;
}
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos + rel_pos);
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos+rel_pos);
// Invisble entries when on '..'
if (strcmp(file_entry->name, DIR_UP) == 0) {
@ -452,7 +452,7 @@ static int contextMenuMainEnterCallback(int sel, void *context) {
int on_marked_entry = 0;
int length = mark_list.length;
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos + rel_pos);
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos+rel_pos);
if (fileListFindEntry(&mark_list, file_entry->name))
on_marked_entry = 1;
@ -493,7 +493,7 @@ static int contextMenuMainEnterCallback(int sel, void *context) {
// Empty copy list at first
fileListEmpty(&copy_list);
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos + rel_pos);
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos+rel_pos);
// Paths
if (fileListFindEntry(&mark_list, file_entry->name)) { // On marked entry
@ -559,7 +559,7 @@ static int contextMenuMainEnterCallback(int sel, void *context) {
{
char *message;
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos + rel_pos);
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos+rel_pos);
// On marked entry
if (mark_list.length > 1 && fileListFindEntry(&mark_list, file_entry->name)) {
@ -575,7 +575,7 @@ static int contextMenuMainEnterCallback(int sel, void *context) {
case MENU_MAIN_ENTRY_RENAME:
{
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos + rel_pos);
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos+rel_pos);
char name[MAX_NAME_LENGTH];
strcpy(name, file_entry->name);
@ -589,7 +589,7 @@ static int contextMenuMainEnterCallback(int sel, void *context) {
case MENU_MAIN_ENTRY_PROPERTIES:
{
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos + rel_pos);
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos+rel_pos);
snprintf(cur_file, MAX_PATH_LENGTH, "%s%s", file_list.path, file_entry->name);
initPropertyDialog(cur_file, file_entry);
@ -667,7 +667,7 @@ static int contextMenuMoreEnterCallback(int sel, void *context) {
{
char path[MAX_NAME_LENGTH];
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos + rel_pos);
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos+rel_pos);
// On marked entry
if (mark_list.length > 1 && fileListFindEntry(&mark_list, file_entry->name)) {
@ -691,9 +691,9 @@ static int contextMenuMoreEnterCallback(int sel, void *context) {
if (!p)
p = strrchr(file_entry->name, '/');
if (!p)
p = file_entry->name + strlen(file_entry->name);
p = file_entry->name+strlen(file_entry->name);
strncpy(path, file_entry->name, p - file_entry->name);
strncpy(path, file_entry->name, p-file_entry->name);
path[p - file_entry->name] = '\0';
}
@ -738,7 +738,7 @@ static int contextMenuMoreEnterCallback(int sel, void *context) {
case MENU_MORE_ENTRY_INSTALL_FOLDER:
{
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos + rel_pos);
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos+rel_pos);
snprintf(cur_file, MAX_PATH_LENGTH, "%s%s", file_list.path, file_entry->name);
initMessageDialog(SCE_MSG_DIALOG_BUTTON_TYPE_YESNO, language_container[INSTALL_FOLDER_QUESTION]);
setDialogStep(DIALOG_STEP_INSTALL_QUESTION);
@ -749,7 +749,7 @@ static int contextMenuMoreEnterCallback(int sel, void *context) {
{
char *message;
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos + rel_pos);
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos+rel_pos);
// On marked entry
if (mark_list.length > 1 && fileListFindEntry(&mark_list, file_entry->name)) {

View File

@ -56,7 +56,7 @@ static int zipAddFile(zipFile zf, const char *path, int filename_start, int leve
// Open new file in zip
char filename[MAX_PATH_LENGTH];
strcpy(filename, path + filename_start);
strcpy(filename, path+filename_start);
res = zipOpenNewFileInZip3_64(zf, filename, &zi,
NULL, 0, NULL, 0, NULL,
@ -150,7 +150,7 @@ static int zipAddFolder(zipFile zf, const char *path, int filename_start, int le
// Open new file in zip
char filename[MAX_PATH_LENGTH];
strcpy(filename, path + filename_start);
strcpy(filename, path+filename_start);
addEndSlash(filename);
res = zipOpenNewFileInZip3_64(zf, filename, &zi,

View File

@ -337,7 +337,7 @@ int photoViewer(const char *file, int type, FileList *list, FileListEntry *entry
float w = horizontal ? SCREEN_HALF_WIDTH : SCREEN_HALF_HEIGHT;
float h = horizontal ? SCREEN_HALF_HEIGHT : SCREEN_HALF_WIDTH;
if ((zoom * width) > 2.0f * w) {
if ((zoom * width) > 2.0f*w) {
if (x < (w / zoom)) {
x = w / zoom;
} else if (x > (width - w / zoom)) {
@ -347,7 +347,7 @@ int photoViewer(const char *file, int type, FileList *list, FileListEntry *entry
x = width / 2.0f;
}
if ((zoom * height) > 2.0f * h) {
if ((zoom * height) > 2.0f*h) {
if (y < (h / zoom)) {
y = h / zoom;
} else if (y > (height - h / zoom)) {

View File

@ -140,8 +140,8 @@ static void resetWidth() {
if (width > max_width)
max_width = width;
if (property_dialog.width < property_dialog.info_x + max_width + 2.0f * SHELL_MARGIN_X) {
property_dialog.width = property_dialog.info_x + max_width + 2.0f * SHELL_MARGIN_X;
if (property_dialog.width < property_dialog.info_x + max_width + 2.0f*SHELL_MARGIN_X) {
property_dialog.width = property_dialog.info_x + max_width + 2.0f*SHELL_MARGIN_X;
property_dialog.x = ALIGN_CENTER(SCREEN_WIDTH, property_dialog.width);
}
}
@ -173,7 +173,7 @@ int initPropertyDialog(char *path, FileListEntry *entry) {
}
// Extend
property_dialog.info_x += 2.0f * SHELL_MARGIN_X;
property_dialog.info_x += 2.0f*SHELL_MARGIN_X;
// Entries
int width = 0, max_width = 0;
@ -350,11 +350,11 @@ int initPropertyDialog(char *path, FileListEntry *entry) {
property_dialog.height = FONT_Y_SPACE * j;
// For buttons
property_dialog.height += 2.0f * FONT_Y_SPACE;
property_dialog.height += 2.0f*FONT_Y_SPACE;
// Margin
property_dialog.width += 2.0f * SHELL_MARGIN_X;
property_dialog.height += 2.0f * SHELL_MARGIN_Y;
property_dialog.width += 2.0f*SHELL_MARGIN_X;
property_dialog.height += 2.0f*SHELL_MARGIN_Y;
// Position
property_dialog.x = ALIGN_CENTER(SCREEN_WIDTH, property_dialog.width);

2
text.c
View File

@ -107,7 +107,7 @@ void initTextContextMenuWidth() {
context_menu_text.max_width = MAX(context_menu_text.max_width, vita2d_pgf_text_width(font, FONT_SIZE, language_container[text_menu_entries[i].name]));
}
context_menu_text.max_width += 2.0f * CONTEXT_MENU_MARGIN;
context_menu_text.max_width += 2.0f*CONTEXT_MENU_MARGIN;
context_menu_text.max_width = MAX(context_menu_text.max_width, CONTEXT_MENU_MIN_WIDTH);
}

View File

@ -73,25 +73,25 @@ static void calculateDialogBoxSize() {
}
// Margin
uncommon_dialog.width += 2.0f * SHELL_MARGIN_X;
uncommon_dialog.height += 2.0f * SHELL_MARGIN_Y;
uncommon_dialog.width += 2.0f*SHELL_MARGIN_X;
uncommon_dialog.height += 2.0f*SHELL_MARGIN_Y;
// Progress bar box width
if (uncommon_dialog.mode == SCE_MSG_DIALOG_MODE_PROGRESS_BAR) {
uncommon_dialog.width = UNCOMMON_DIALOG_PROGRESS_BAR_BOX_WIDTH;
uncommon_dialog.height += 2.0f * FONT_Y_SPACE;
uncommon_dialog.height += 2.0f*FONT_Y_SPACE;
}
// More space for buttons
if (uncommon_dialog.buttonType != SCE_MSG_DIALOG_BUTTON_TYPE_NONE)
uncommon_dialog.height += 2.0f * FONT_Y_SPACE;
uncommon_dialog.height += 2.0f*FONT_Y_SPACE;
// Position
uncommon_dialog.x = ALIGN_CENTER(SCREEN_WIDTH, uncommon_dialog.width);
uncommon_dialog.y = ALIGN_CENTER(SCREEN_HEIGHT, uncommon_dialog.height);
// Align
int y_n = (int)((float)(uncommon_dialog.y - 2.0f) / FONT_Y_SPACE);
int y_n = (int)((float)(uncommon_dialog.y-2.0f) / FONT_Y_SPACE);
uncommon_dialog.y = (float)y_n * FONT_Y_SPACE + 2.0f;
// Scale
@ -237,11 +237,11 @@ int drawUncommonDialog() {
return 0;
// Dialog background
vita2d_draw_texture_scale_rotate_hotspot(dialog_image, uncommon_dialog.x + uncommon_dialog.width / 2.0f,
uncommon_dialog.y + uncommon_dialog.height / 2.0f,
vita2d_draw_texture_scale_rotate_hotspot(dialog_image, uncommon_dialog.x + uncommon_dialog.width/2.0f,
uncommon_dialog.y + uncommon_dialog.height/2.0f,
uncommon_dialog.scale * (uncommon_dialog.width / vita2d_texture_get_width(dialog_image)),
uncommon_dialog.scale * (uncommon_dialog.height / vita2d_texture_get_height(dialog_image)),
0.0f, vita2d_texture_get_width(dialog_image) / 2.0f, vita2d_texture_get_height(dialog_image) / 2.0f);
0.0f, vita2d_texture_get_width(dialog_image)/2.0f, vita2d_texture_get_height(dialog_image)/2.0f);
// Easing out
if (uncommon_dialog.dialog_status == UNCOMMON_DIALOG_CLOSING) {
@ -308,15 +308,15 @@ int drawUncommonDialog() {
// Progress bar
if (uncommon_dialog.mode == SCE_MSG_DIALOG_MODE_PROGRESS_BAR) {
float width = uncommon_dialog.width - 2.0f * SHELL_MARGIN_X;
vita2d_draw_rectangle(uncommon_dialog.x + SHELL_MARGIN_X, string_y + 10.0f, width, UNCOMMON_DIALOG_PROGRESS_BAR_HEIGHT, PROGRESS_BAR_BG_COLOR);
vita2d_draw_rectangle(uncommon_dialog.x + SHELL_MARGIN_X, string_y + 10.0f, uncommon_dialog.progress * width / 100.0f, UNCOMMON_DIALOG_PROGRESS_BAR_HEIGHT, PROGRESS_BAR_COLOR);
float width = uncommon_dialog.width - 2.0f*SHELL_MARGIN_X;
vita2d_draw_rectangle(uncommon_dialog.x + SHELL_MARGIN_X, string_y+10.0f, width, UNCOMMON_DIALOG_PROGRESS_BAR_HEIGHT, PROGRESS_BAR_BG_COLOR);
vita2d_draw_rectangle(uncommon_dialog.x + SHELL_MARGIN_X, string_y+10.0f, uncommon_dialog.progress * width / 100.0f, UNCOMMON_DIALOG_PROGRESS_BAR_HEIGHT, PROGRESS_BAR_COLOR);
char string[8];
sprintf(string, "%d%%", uncommon_dialog.progress);
pgf_draw_text(ALIGN_CENTER(SCREEN_WIDTH, vita2d_pgf_text_width(font, FONT_SIZE, string)), string_y + FONT_Y_SPACE, DIALOG_COLOR, FONT_SIZE, string);
string_y += 2.0f * FONT_Y_SPACE;
string_y += 2.0f*FONT_Y_SPACE;
}
switch (uncommon_dialog.buttonType) {