mirror of
https://github.com/joel16/VitaShell.git
synced 2024-11-26 21:30:45 +00:00
Improved SFO viewer
This commit is contained in:
parent
c559a8a0fd
commit
344f7bd17c
@ -105,6 +105,7 @@ Changelog
|
||||
### Changelog 1.95
|
||||
|
||||
- Fixed bug in USB connection, where your Memory Card could be corrupted.
|
||||
- Fixed line breaks in SFO files and long names will now scroll.
|
||||
|
||||
### Changelog 1.94
|
||||
|
||||
|
@ -188,7 +188,7 @@ int sendPath(const char *src_path, FileProcessParam *param) {
|
||||
res = sceIoDread(dfd, &dir);
|
||||
if (res > 0) {
|
||||
char *new_src_path = malloc(strlen(src_path) + strlen(dir.d_name) + 2);
|
||||
snprintf(new_src_path, MAX_PATH_LENGTH - 1, "%s%s%s", src_path, hasEndSlash(src_path) ? "" : "/", dir.d_name);
|
||||
snprintf(new_src_path, MAX_PATH_LENGTH, "%s%s%s", src_path, hasEndSlash(src_path) ? "" : "/", dir.d_name);
|
||||
|
||||
int ret = 0;
|
||||
|
||||
@ -252,7 +252,7 @@ int send_thread(SceSize args_size, SendArguments *args) {
|
||||
|
||||
int i;
|
||||
for (i = 0; i < count; i++) {
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s", args->file_list->path, mark_entry->name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s", args->file_list->path, mark_entry->name);
|
||||
getPathInfo(path, &size, &folders, &files, NULL);
|
||||
mark_entry = mark_entry->next;
|
||||
}
|
||||
@ -276,7 +276,7 @@ int send_thread(SceSize args_size, SendArguments *args) {
|
||||
mark_entry = head;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s", args->file_list->path, mark_entry->name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s", args->file_list->path, mark_entry->name);
|
||||
|
||||
FileProcessParam param;
|
||||
param.value = &value;
|
||||
@ -447,7 +447,7 @@ int receive_thread(SceSize args_size, ReceiveArguments *args) {
|
||||
|
||||
// New path
|
||||
char dst_path[MAX_PATH_LENGTH];
|
||||
snprintf(dst_path, MAX_PATH_LENGTH - 1, "%s%s", args->file_list->path, path + server_info.path_len);
|
||||
snprintf(dst_path, MAX_PATH_LENGTH, "%s%s", args->file_list->path, path + server_info.path_len);
|
||||
|
||||
// Folder
|
||||
if (info.type == SHARE_TYPE_FOLDER) {
|
||||
|
12
archive.c
12
archive.c
@ -180,7 +180,7 @@ struct archive *open_archive(const char *filename) {
|
||||
for (part_format = 0; part_format < 4; part_format++) {
|
||||
strcpy(format, "%s%s.part%0Xd.rar");
|
||||
format[11] = '1' + part_format;
|
||||
snprintf(new_path, MAX_PATH_LENGTH - 1, format, path, name, 1);
|
||||
snprintf(new_path, MAX_PATH_LENGTH, format, path, name, 1);
|
||||
if (checkFileExist(new_path)) {
|
||||
type = 1;
|
||||
break;
|
||||
@ -191,7 +191,7 @@ struct archive *open_archive(const char *filename) {
|
||||
|
||||
// Check for .rXX archives
|
||||
if (type == 0) {
|
||||
snprintf(new_path, MAX_PATH_LENGTH - 1, "%s%s.r00", path, name);
|
||||
snprintf(new_path, MAX_PATH_LENGTH, "%s%s.r00", path, name);
|
||||
if (checkFileExist(new_path)) {
|
||||
strcpy(format, "%s%s.r%02d");
|
||||
type = 2;
|
||||
@ -213,7 +213,7 @@ struct archive *open_archive(const char *filename) {
|
||||
|
||||
// Append other parts
|
||||
while (1) {
|
||||
snprintf(new_path, MAX_PATH_LENGTH - 1, format, path, name, num);
|
||||
snprintf(new_path, MAX_PATH_LENGTH, format, path, name, num);
|
||||
if (!checkFileExist(new_path))
|
||||
break;
|
||||
|
||||
@ -581,7 +581,7 @@ int getArchivePathInfo(const char *path, uint64_t *size, uint32_t *folders, uint
|
||||
int i;
|
||||
for (i = 0; i < list.length - 1; i++, entry = entry->next) {
|
||||
char *new_path = malloc(strlen(path) + strlen(entry->name) + 2);
|
||||
snprintf(new_path, MAX_PATH_LENGTH - 1, "%s%s", path, entry->name);
|
||||
snprintf(new_path, MAX_PATH_LENGTH, "%s%s", path, entry->name);
|
||||
|
||||
if (handler && handler(new_path)) {
|
||||
free(new_path);
|
||||
@ -735,10 +735,10 @@ int extractArchivePath(const char *src_path, const char *dst_path, FileProcessPa
|
||||
int i;
|
||||
for (i = 0; i < list.length - 1; i++, entry = entry->next) {
|
||||
char *new_src_path = malloc(strlen(src_path) + strlen(entry->name) + 2);
|
||||
snprintf(new_src_path, MAX_PATH_LENGTH - 1, "%s%s", src_path, entry->name);
|
||||
snprintf(new_src_path, MAX_PATH_LENGTH, "%s%s", src_path, entry->name);
|
||||
|
||||
char *new_dst_path = malloc(strlen(dst_path) + strlen(entry->name) + 2);
|
||||
snprintf(new_dst_path, MAX_PATH_LENGTH - 1, "%s%s", dst_path, entry->name);
|
||||
snprintf(new_dst_path, MAX_PATH_LENGTH, "%s%s", dst_path, entry->name);
|
||||
|
||||
int ret = 0;
|
||||
|
||||
|
@ -137,13 +137,13 @@ vita2d_texture *getAlternativeCoverImage(const char *file) {
|
||||
if (p) {
|
||||
*p = '\0';
|
||||
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s/cover.jpg", file);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s/cover.jpg", file);
|
||||
if (checkFileExist(path)) {
|
||||
*p = '/';
|
||||
return vita2d_load_JPEG_file(path);
|
||||
}
|
||||
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s/folder.jpg", file);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s/folder.jpg", file);
|
||||
if (checkFileExist(path)) {
|
||||
*p = '/';
|
||||
return vita2d_load_JPEG_file(path);
|
||||
@ -327,7 +327,7 @@ int audioPlayer(const char *file, int type, FileList *list, FileListEntry *entry
|
||||
|
||||
if (!entry->is_folder) {
|
||||
char path[MAX_PATH_LENGTH];
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s", list->path, entry->name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s", list->path, entry->name);
|
||||
int type = getFileType(path);
|
||||
if (type == FILE_TYPE_MP3 || type == FILE_TYPE_OGG) {
|
||||
file = path;
|
||||
|
12
file.c
12
file.c
@ -190,7 +190,7 @@ int getPathInfo(const char *path, uint64_t *size, uint32_t *folders, uint32_t *f
|
||||
res = sceIoDread(dfd, &dir);
|
||||
if (res > 0) {
|
||||
char *new_path = malloc(strlen(path) + strlen(dir.d_name) + 2);
|
||||
snprintf(new_path, MAX_PATH_LENGTH - 1, "%s%s%s", path, hasEndSlash(path) ? "" : "/", dir.d_name);
|
||||
snprintf(new_path, MAX_PATH_LENGTH, "%s%s%s", path, hasEndSlash(path) ? "" : "/", dir.d_name);
|
||||
|
||||
if (handler && handler(new_path)) {
|
||||
free(new_path);
|
||||
@ -254,7 +254,7 @@ int removePath(const char *path, FileProcessParam *param) {
|
||||
res = sceIoDread(dfd, &dir);
|
||||
if (res > 0) {
|
||||
char *new_path = malloc(strlen(path) + strlen(dir.d_name) + 2);
|
||||
snprintf(new_path, MAX_PATH_LENGTH - 1, "%s%s%s", path, hasEndSlash(path) ? "" : "/", dir.d_name);
|
||||
snprintf(new_path, MAX_PATH_LENGTH, "%s%s%s", path, hasEndSlash(path) ? "" : "/", dir.d_name);
|
||||
|
||||
if (SCE_S_ISDIR(dir.d_stat.st_mode)) {
|
||||
int ret = removePath(new_path, param);
|
||||
@ -468,10 +468,10 @@ int copyPath(const char *src_path, const char *dst_path, FileProcessParam *param
|
||||
res = sceIoDread(dfd, &dir);
|
||||
if (res > 0) {
|
||||
char *new_src_path = malloc(strlen(src_path) + strlen(dir.d_name) + 2);
|
||||
snprintf(new_src_path, MAX_PATH_LENGTH - 1, "%s%s%s", src_path, hasEndSlash(src_path) ? "" : "/", dir.d_name);
|
||||
snprintf(new_src_path, MAX_PATH_LENGTH, "%s%s%s", src_path, hasEndSlash(src_path) ? "" : "/", dir.d_name);
|
||||
|
||||
char *new_dst_path = malloc(strlen(dst_path) + strlen(dir.d_name) + 2);
|
||||
snprintf(new_dst_path, MAX_PATH_LENGTH - 1, "%s%s%s", dst_path, hasEndSlash(dst_path) ? "" : "/", dir.d_name);
|
||||
snprintf(new_dst_path, MAX_PATH_LENGTH, "%s%s%s", dst_path, hasEndSlash(dst_path) ? "" : "/", dir.d_name);
|
||||
|
||||
int ret = 0;
|
||||
|
||||
@ -562,10 +562,10 @@ int movePath(const char *src_path, const char *dst_path, int flags, FileProcessP
|
||||
res = sceIoDread(dfd, &dir);
|
||||
if (res > 0) {
|
||||
char *new_src_path = malloc(strlen(src_path) + strlen(dir.d_name) + 2);
|
||||
snprintf(new_src_path, MAX_PATH_LENGTH - 1, "%s%s%s", src_path, hasEndSlash(src_path) ? "" : "/", dir.d_name);
|
||||
snprintf(new_src_path, MAX_PATH_LENGTH, "%s%s%s", src_path, hasEndSlash(src_path) ? "" : "/", dir.d_name);
|
||||
|
||||
char *new_dst_path = malloc(strlen(dst_path) + strlen(dir.d_name) + 2);
|
||||
snprintf(new_dst_path, MAX_PATH_LENGTH - 1, "%s%s%s", dst_path, hasEndSlash(dst_path) ? "" : "/", dir.d_name);
|
||||
snprintf(new_dst_path, MAX_PATH_LENGTH, "%s%s%s", dst_path, hasEndSlash(dst_path) ? "" : "/", dir.d_name);
|
||||
|
||||
// Recursive move
|
||||
int ret = movePath(new_src_path, new_dst_path, flags, param);
|
||||
|
20
io_process.c
20
io_process.c
@ -116,7 +116,7 @@ int delete_thread(SceSize args_size, DeleteArguments *args) {
|
||||
|
||||
int i;
|
||||
for (i = 0; i < count; i++) {
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s", args->file_list->path, mark_entry->name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s", args->file_list->path, mark_entry->name);
|
||||
getPathInfo(path, NULL, &folders, &files, NULL);
|
||||
mark_entry = mark_entry->next;
|
||||
}
|
||||
@ -130,7 +130,7 @@ int delete_thread(SceSize args_size, DeleteArguments *args) {
|
||||
mark_entry = head;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s", args->file_list->path, mark_entry->name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s", args->file_list->path, mark_entry->name);
|
||||
|
||||
FileProcessParam param;
|
||||
param.value = &value;
|
||||
@ -191,8 +191,8 @@ int copy_thread(SceSize args_size, CopyArguments *args) {
|
||||
|
||||
int i;
|
||||
for (i = 0; i < args->copy_list->length; i++) {
|
||||
snprintf(src_path, MAX_PATH_LENGTH - 1, "%s%s", args->copy_list->path, copy_entry->name);
|
||||
snprintf(dst_path, MAX_PATH_LENGTH - 1, "%s%s", args->file_list->path, copy_entry->name);
|
||||
snprintf(src_path, MAX_PATH_LENGTH, "%s%s", args->copy_list->path, copy_entry->name);
|
||||
snprintf(dst_path, MAX_PATH_LENGTH, "%s%s", args->file_list->path, copy_entry->name);
|
||||
|
||||
int res = movePath(src_path, dst_path, MOVE_INTEGRATE | MOVE_REPLACE, NULL);
|
||||
if (res < 0) {
|
||||
@ -239,7 +239,7 @@ int copy_thread(SceSize args_size, CopyArguments *args) {
|
||||
|
||||
int i;
|
||||
for (i = 0; i < args->copy_list->length; i++) {
|
||||
snprintf(src_path, MAX_PATH_LENGTH - 1, "%s%s", args->copy_list->path, copy_entry->name);
|
||||
snprintf(src_path, MAX_PATH_LENGTH, "%s%s", args->copy_list->path, copy_entry->name);
|
||||
|
||||
if (args->copy_mode == COPY_MODE_EXTRACT) {
|
||||
getArchivePathInfo(src_path, &size, &folders, &files, NULL);
|
||||
@ -263,8 +263,8 @@ int copy_thread(SceSize args_size, CopyArguments *args) {
|
||||
copy_entry = args->copy_list->head;
|
||||
|
||||
for (i = 0; i < args->copy_list->length; i++) {
|
||||
snprintf(src_path, MAX_PATH_LENGTH - 1, "%s%s", args->copy_list->path, copy_entry->name);
|
||||
snprintf(dst_path, MAX_PATH_LENGTH - 1, "%s%s", args->file_list->path, copy_entry->name);
|
||||
snprintf(src_path, MAX_PATH_LENGTH, "%s%s", args->copy_list->path, copy_entry->name);
|
||||
snprintf(dst_path, MAX_PATH_LENGTH, "%s%s", args->file_list->path, copy_entry->name);
|
||||
|
||||
FileProcessParam param;
|
||||
param.value = &value;
|
||||
@ -447,7 +447,7 @@ int exportPath(char *path, uint32_t *songs, uint32_t *videos, uint32_t *pictures
|
||||
res = sceIoDread(dfd, &dir);
|
||||
if (res > 0) {
|
||||
char *new_path = malloc(strlen(path) + strlen(dir.d_name) + 2);
|
||||
snprintf(new_path, MAX_PATH_LENGTH - 1, "%s%s%s", path, hasEndSlash(path) ? "" : "/", dir.d_name);
|
||||
snprintf(new_path, MAX_PATH_LENGTH, "%s%s%s", path, hasEndSlash(path) ? "" : "/", dir.d_name);
|
||||
|
||||
if (SCE_S_ISDIR(dir.d_stat.st_mode)) {
|
||||
int ret = exportPath(new_path, songs, videos, pictures, param);
|
||||
@ -523,7 +523,7 @@ int export_thread(SceSize args_size, ExportArguments *args) {
|
||||
|
||||
int i;
|
||||
for (i = 0; i < count; i++) {
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s", args->file_list->path, mark_entry->name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s", args->file_list->path, mark_entry->name);
|
||||
getPathInfo(path, &size, NULL, &files, mediaPathHandler);
|
||||
mark_entry = mark_entry->next;
|
||||
}
|
||||
@ -549,7 +549,7 @@ int export_thread(SceSize args_size, ExportArguments *args) {
|
||||
mark_entry = head;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s", args->file_list->path, mark_entry->name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s", args->file_list->path, mark_entry->name);
|
||||
|
||||
FileProcessParam param;
|
||||
param.value = &value;
|
||||
|
@ -284,7 +284,7 @@ void loadLanguage(int id) {
|
||||
if (use_custom_config) {
|
||||
if (id >= 0 && id < (sizeof(lang) / sizeof(char *))) {
|
||||
char path[MAX_PATH_LENGTH];
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "ux0:VitaShell/language/%s.txt", lang[id]);
|
||||
snprintf(path, MAX_PATH_LENGTH, "ux0:VitaShell/language/%s.txt", lang[id]);
|
||||
readConfig(path, language_entries, sizeof(language_entries) / sizeof(ConfigEntry));
|
||||
}
|
||||
}
|
||||
|
42
main.c
42
main.c
@ -233,7 +233,7 @@ static void refreshMarkList() {
|
||||
FileListEntry *next = entry->next;
|
||||
|
||||
char path[MAX_PATH_LENGTH];
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s", file_list.path, entry->name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s", file_list.path, entry->name);
|
||||
|
||||
// Check if the entry still exits. If not, remove it from list
|
||||
SceIoStat stat;
|
||||
@ -260,7 +260,7 @@ static void refreshCopyList() {
|
||||
FileListEntry *next = entry->next;
|
||||
|
||||
char path[MAX_PATH_LENGTH];
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s", copy_list.path, entry->name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s", copy_list.path, entry->name);
|
||||
|
||||
// Check if the entry still exits. If not, remove it from list
|
||||
SceIoStat stat;
|
||||
@ -875,8 +875,8 @@ static int dialogSteps() {
|
||||
char old_path[MAX_PATH_LENGTH];
|
||||
char new_path[MAX_PATH_LENGTH];
|
||||
|
||||
snprintf(old_path, MAX_PATH_LENGTH - 1, "%s%s", file_list.path, old_name);
|
||||
snprintf(new_path, MAX_PATH_LENGTH - 1, "%s%s", file_list.path, name);
|
||||
snprintf(old_path, MAX_PATH_LENGTH, "%s%s", file_list.path, old_name);
|
||||
snprintf(new_path, MAX_PATH_LENGTH, "%s%s", file_list.path, name);
|
||||
|
||||
int res = sceIoRename(old_path, new_path);
|
||||
if (res < 0) {
|
||||
@ -902,7 +902,7 @@ static int dialogSteps() {
|
||||
setDialogStep(DIALOG_STEP_NONE);
|
||||
} else {
|
||||
char path[MAX_PATH_LENGTH];
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s", file_list.path, name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s", file_list.path, name);
|
||||
|
||||
int res = sceIoMkdir(path, 0777);
|
||||
if (res < 0) {
|
||||
@ -931,7 +931,7 @@ static int dialogSteps() {
|
||||
setDialogStep(DIALOG_STEP_NONE);
|
||||
} else {
|
||||
char path[MAX_PATH_LENGTH];
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s", file_list.path, name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s", file_list.path, name);
|
||||
|
||||
SceUID fd = sceIoOpen(path, SCE_O_WRONLY | SCE_O_CREAT, 0777);
|
||||
if (fd < 0) {
|
||||
@ -980,7 +980,7 @@ static int dialogSteps() {
|
||||
if (level[0] == '\0') {
|
||||
setDialogStep(DIALOG_STEP_NONE);
|
||||
} else {
|
||||
snprintf(cur_file, MAX_PATH_LENGTH - 1, "%s%s", file_list.path, compress_name);
|
||||
snprintf(cur_file, MAX_PATH_LENGTH, "%s%s", file_list.path, compress_name);
|
||||
|
||||
CompressArguments args;
|
||||
args.file_list = &file_list;
|
||||
@ -1028,7 +1028,7 @@ static int dialogSteps() {
|
||||
}
|
||||
|
||||
// Place the full file path in cur_file
|
||||
snprintf(cur_file, MAX_PATH_LENGTH - 1, "%s%s", file_list.path, file_entry->name);
|
||||
snprintf(cur_file, MAX_PATH_LENGTH, "%s%s", file_list.path, file_entry->name);
|
||||
|
||||
HashArguments args;
|
||||
args.file_path = cur_file;
|
||||
@ -1063,7 +1063,7 @@ static int dialogSteps() {
|
||||
|
||||
if (install_list.length > 0) {
|
||||
FileListEntry *entry = install_list.head;
|
||||
snprintf(install_path, MAX_PATH_LENGTH - 1, "%s%s", install_list.path, entry->name);
|
||||
snprintf(install_path, MAX_PATH_LENGTH, "%s%s", install_list.path, entry->name);
|
||||
args.file = install_path;
|
||||
|
||||
// Focus
|
||||
@ -1301,7 +1301,7 @@ static int dialogSteps() {
|
||||
is_in_archive = 1;
|
||||
dir_level_archive = dir_level;
|
||||
|
||||
snprintf(archive_path, MAX_PATH_LENGTH - 1, "%s%s", file_list.path, file_entry->name);
|
||||
snprintf(archive_path, MAX_PATH_LENGTH, "%s%s", file_list.path, file_entry->name);
|
||||
|
||||
strcat(file_list.path, file_entry->name);
|
||||
addEndSlash(file_list.path);
|
||||
@ -1635,7 +1635,7 @@ static int fileBrowserMenuCtrl() {
|
||||
if (res < 0)
|
||||
errorDialog(res);
|
||||
} else {
|
||||
snprintf(cur_file, MAX_PATH_LENGTH - 1, "%s%s", file_list.path, file_entry->name);
|
||||
snprintf(cur_file, MAX_PATH_LENGTH, "%s%s", file_list.path, file_entry->name);
|
||||
int type = handleFile(cur_file, file_entry);
|
||||
|
||||
// Archive mode
|
||||
@ -1643,7 +1643,7 @@ static int fileBrowserMenuCtrl() {
|
||||
is_in_archive = 1;
|
||||
dir_level_archive = dir_level;
|
||||
|
||||
snprintf(archive_path, MAX_PATH_LENGTH - 1, "%s%s", file_list.path, file_entry->name);
|
||||
snprintf(archive_path, MAX_PATH_LENGTH, "%s%s", file_list.path, file_entry->name);
|
||||
|
||||
strcat(file_list.path, file_entry->name);
|
||||
addEndSlash(file_list.path);
|
||||
@ -1766,10 +1766,8 @@ static int shellMain() {
|
||||
// Start drawing
|
||||
startDrawing(bg_browser_image);
|
||||
|
||||
// Draw shell info
|
||||
// Draw
|
||||
drawShellInfo(file_list.path);
|
||||
|
||||
// Draw scroll bar
|
||||
drawScrollBar(base_pos, file_list.length);
|
||||
|
||||
// Draw
|
||||
@ -1919,16 +1917,10 @@ static int shellMain() {
|
||||
}
|
||||
}
|
||||
|
||||
// Draw settings menu
|
||||
// Draw
|
||||
drawSettingsMenu();
|
||||
|
||||
// Draw context menu
|
||||
drawContextMenu();
|
||||
|
||||
// Draw adhoc dialog
|
||||
drawAdhocDialog();
|
||||
|
||||
// Draw property dialog
|
||||
drawPropertyDialog();
|
||||
|
||||
// End drawing
|
||||
@ -1967,13 +1959,9 @@ int main(int argc, const char *argv[]) {
|
||||
if (current_pad[PAD_LTRIGGER])
|
||||
use_custom_config = 0;
|
||||
|
||||
// Load settings
|
||||
// Load stuff
|
||||
loadSettingsConfig();
|
||||
|
||||
// Load theme
|
||||
loadTheme();
|
||||
|
||||
// Load language
|
||||
loadLanguage(language);
|
||||
|
||||
// Init context menu width
|
||||
|
@ -234,7 +234,7 @@ int pfsMount(const char *path) {
|
||||
memset(klicensee, 0, sizeof(klicensee));
|
||||
|
||||
/*
|
||||
snprintf(work_path, MAX_PATH_LENGTH - 1, "%ssce_sys/package/work.bin", path);
|
||||
snprintf(work_path, MAX_PATH_LENGTH, "%ssce_sys/package/work.bin", path);
|
||||
if (ReadFile(work_path, license_buf, sizeof(license_buf)) == sizeof(license_buf)) {
|
||||
int res = shellUserGetRifVitaKey(license_buf, klicensee);
|
||||
debugPrintf("read license: 0x%08X\n", res);
|
||||
@ -473,7 +473,7 @@ void setContextMenuMainVisibilities() {
|
||||
menu_main_entries[MENU_MAIN_ENTRY_OPEN_DECRYPTED].visibility = CTX_INVISIBLE;
|
||||
} else {
|
||||
char path[MAX_PATH_LENGTH];
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%ssce_pfs", file_list.path, file_entry->name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%ssce_pfs", file_list.path, file_entry->name);
|
||||
|
||||
if (!checkFolderExist(path))
|
||||
menu_main_entries[MENU_MAIN_ENTRY_OPEN_DECRYPTED].visibility = CTX_INVISIBLE;
|
||||
@ -563,13 +563,13 @@ void setContextMenuMoreVisibilities() {
|
||||
break;
|
||||
}
|
||||
|
||||
snprintf(check_path, MAX_PATH_LENGTH - 1, "%s%s/eboot.bin", file_list.path, file_entry->name);
|
||||
snprintf(check_path, MAX_PATH_LENGTH, "%s%s/eboot.bin", file_list.path, file_entry->name);
|
||||
if (!checkFileExist(check_path)) {
|
||||
menu_more_entries[MENU_MORE_ENTRY_INSTALL_FOLDER].visibility = CTX_INVISIBLE;
|
||||
break;
|
||||
}
|
||||
|
||||
snprintf(check_path, MAX_PATH_LENGTH - 1, "%s%s/sce_sys/param.sfo", file_list.path, file_entry->name);
|
||||
snprintf(check_path, MAX_PATH_LENGTH, "%s%s/sce_sys/param.sfo", file_list.path, file_entry->name);
|
||||
if (!checkFileExist(check_path)) {
|
||||
menu_more_entries[MENU_MORE_ENTRY_INSTALL_FOLDER].visibility = CTX_INVISIBLE;
|
||||
break;
|
||||
@ -797,18 +797,18 @@ static int contextMenuMainEnterCallback(int sel, void *context) {
|
||||
|
||||
pfsUmount();
|
||||
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s", file_list.path, file_entry->name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s", file_list.path, file_entry->name);
|
||||
res = pfsMount(path);
|
||||
|
||||
// In case we're at ux0:patch or grw0:patch we need to apply the mounting at ux0:app or gro0:app
|
||||
if (res < 0) {
|
||||
if (strncasecmp(file_list.path, "ux0:patch", 9) == 0 ||
|
||||
strncasecmp(file_list.path, "grw0:patch", 10) == 0) {
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "ux0:app/%s", file_entry->name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "ux0:app/%s", file_entry->name);
|
||||
res = pfsMount(path);
|
||||
|
||||
if (res < 0) {
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "gro0:app/%s", file_entry->name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "gro0:app/%s", file_entry->name);
|
||||
res = pfsMount(path);
|
||||
}
|
||||
}
|
||||
@ -990,7 +990,7 @@ static int contextMenuMainEnterCallback(int sel, void *context) {
|
||||
{
|
||||
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos + rel_pos);
|
||||
if (file_entry) {
|
||||
snprintf(cur_file, MAX_PATH_LENGTH - 1, "%s%s", file_list.path, file_entry->name);
|
||||
snprintf(cur_file, MAX_PATH_LENGTH, "%s%s", file_list.path, file_entry->name);
|
||||
initPropertyDialog(cur_file, file_entry);
|
||||
}
|
||||
|
||||
@ -1113,7 +1113,7 @@ static int contextMenuMoreEnterCallback(int sel, void *context) {
|
||||
int i;
|
||||
for (i = 0; i < file_list.length - 1; i++) {
|
||||
char path[MAX_PATH_LENGTH];
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s", file_list.path, file_entry->name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s", file_list.path, file_entry->name);
|
||||
|
||||
int type = getFileType(path);
|
||||
if (type == FILE_TYPE_VPK) {
|
||||
@ -1136,7 +1136,7 @@ static int contextMenuMoreEnterCallback(int sel, void *context) {
|
||||
{
|
||||
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos + rel_pos);
|
||||
if (file_entry) {
|
||||
snprintf(cur_file, MAX_PATH_LENGTH - 1, "%s%s", file_list.path, file_entry->name);
|
||||
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);
|
||||
}
|
||||
@ -1183,10 +1183,10 @@ static int contextMenuNewEnterCallback(int sel, void *context) {
|
||||
int count = 1;
|
||||
while (1) {
|
||||
if (count == 1) {
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s", file_list.path,
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s", file_list.path,
|
||||
language_container[NEW_FILE]);
|
||||
} else {
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s (%d)", file_list.path,
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s (%d)", file_list.path,
|
||||
language_container[NEW_FILE], count);
|
||||
}
|
||||
if (!checkFileExist(path))
|
||||
@ -1206,10 +1206,10 @@ static int contextMenuNewEnterCallback(int sel, void *context) {
|
||||
int count = 1;
|
||||
while (1) {
|
||||
if (count == 1) {
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s", file_list.path,
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s", file_list.path,
|
||||
language_container[NEW_FOLDER]);
|
||||
} else {
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s (%d)", file_list.path,
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s (%d)", file_list.path,
|
||||
language_container[NEW_FOLDER], count);
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ static int zipAddPath(zipFile zf, const char *path, int filename_start, int leve
|
||||
res = sceIoDread(dfd, &dir);
|
||||
if (res > 0) {
|
||||
char *new_path = malloc(strlen(path) + strlen(dir.d_name) + 2);
|
||||
snprintf(new_path, MAX_PATH_LENGTH - 1, "%s%s%s", path, hasEndSlash(path) ? "" : "/", dir.d_name);
|
||||
snprintf(new_path, MAX_PATH_LENGTH, "%s%s%s", path, hasEndSlash(path) ? "" : "/", dir.d_name);
|
||||
|
||||
int ret = 0;
|
||||
|
||||
@ -273,7 +273,7 @@ int compress_thread(SceSize args_size, CompressArguments *args) {
|
||||
|
||||
int i;
|
||||
for (i = 0; i < count; i++) {
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s", args->file_list->path, mark_entry->name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s", args->file_list->path, mark_entry->name);
|
||||
getPathInfo(path, &size, &folders, &files, NULL);
|
||||
mark_entry = mark_entry->next;
|
||||
}
|
||||
@ -292,7 +292,7 @@ int compress_thread(SceSize args_size, CompressArguments *args) {
|
||||
mark_entry = head;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s", args->file_list->path, mark_entry->name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s", args->file_list->path, mark_entry->name);
|
||||
|
||||
FileProcessParam param;
|
||||
param.value = &value;
|
||||
|
@ -319,7 +319,7 @@ int install_thread(SceSize args_size, InstallArguments *args) {
|
||||
|
||||
if (SCE_S_ISDIR(stat.st_mode)) {
|
||||
// Check for param.sfo
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s/sce_sys/param.sfo", args->file);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s/sce_sys/param.sfo", args->file);
|
||||
if (sceIoGetstat(path, &stat) < 0 || SCE_S_ISDIR(stat.st_mode)) {
|
||||
closeWaitDialog();
|
||||
errorDialog(-2);
|
||||
@ -327,7 +327,7 @@ int install_thread(SceSize args_size, InstallArguments *args) {
|
||||
}
|
||||
|
||||
// Check permissions
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s/eboot.bin", args->file);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s/eboot.bin", args->file);
|
||||
SceUID fd = sceIoOpen(path, SCE_O_RDONLY, 0);
|
||||
if (fd >= 0) {
|
||||
char buffer[0x88];
|
||||
@ -390,7 +390,7 @@ int install_thread(SceSize args_size, InstallArguments *args) {
|
||||
}
|
||||
|
||||
// Check for param.sfo
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s/sce_sys/param.sfo", args->file);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s/sce_sys/param.sfo", args->file);
|
||||
if (archiveFileGetstat(path, NULL) < 0) {
|
||||
closeWaitDialog();
|
||||
errorDialog(-2);
|
||||
|
2
photo.c
2
photo.c
@ -224,7 +224,7 @@ int photoViewer(const char *file, int type, FileList *list, FileListEntry *entry
|
||||
|
||||
if (!entry->is_folder) {
|
||||
char path[MAX_PATH_LENGTH];
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s%s", list->path, entry->name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s%s", list->path, entry->name);
|
||||
int type = getFileType(path);
|
||||
if (type == FILE_TYPE_BMP || type == FILE_TYPE_JPEG || type == FILE_TYPE_PNG) {
|
||||
vita2d_wait_rendering_done();
|
||||
|
6
psarc.c
6
psarc.c
@ -298,7 +298,7 @@ int getPsarcPathInfo(const char *path, uint64_t *size, uint32_t *folders, uint32
|
||||
char *name = dir.fullPath + dir.offsetToName;
|
||||
|
||||
char *new_path = malloc(strlen(path) + strlen(name) + 2);
|
||||
snprintf(new_path, MAX_PATH_LENGTH - 1, "%s%s%s", path, hasEndSlash(path) ? "" : "/", name);
|
||||
snprintf(new_path, MAX_PATH_LENGTH, "%s%s%s", path, hasEndSlash(path) ? "" : "/", name);
|
||||
|
||||
if (handler && handler(new_path)) {
|
||||
free(new_path);
|
||||
@ -455,10 +455,10 @@ int extractPsarcPath(const char *src_path, const char *dst_path, FileProcessPara
|
||||
char *name = dir.fullPath + dir.offsetToName;
|
||||
|
||||
char *new_src_path = malloc(strlen(src_path) + strlen(name) + 2);
|
||||
snprintf(new_src_path, MAX_PATH_LENGTH - 1, "%s%s%s", src_path, hasEndSlash(src_path) ? "" : "/", name);
|
||||
snprintf(new_src_path, MAX_PATH_LENGTH, "%s%s%s", src_path, hasEndSlash(src_path) ? "" : "/", name);
|
||||
|
||||
char *new_dst_path = malloc(strlen(dst_path) + strlen(name) + 2);
|
||||
snprintf(new_dst_path, MAX_PATH_LENGTH - 1, "%s%s%s", dst_path, hasEndSlash(dst_path) ? "" : "/", name);
|
||||
snprintf(new_dst_path, MAX_PATH_LENGTH, "%s%s%s", dst_path, hasEndSlash(dst_path) ? "" : "/", name);
|
||||
|
||||
int ret = 0;
|
||||
|
||||
|
22
refresh.c
22
refresh.c
@ -57,7 +57,7 @@ int refreshNeeded(const char *app_path)
|
||||
int res, is_app = (app_path[6] == 'p');
|
||||
|
||||
// Read param.sfo
|
||||
snprintf(sfo_path, MAX_PATH_LENGTH - 1, "%s/sce_sys/param.sfo", app_path);
|
||||
snprintf(sfo_path, MAX_PATH_LENGTH, "%s/sce_sys/param.sfo", app_path);
|
||||
void *sfo_buffer = NULL;
|
||||
int sfo_size = allocateReadFile(sfo_path, &sfo_buffer);
|
||||
if (sfo_size < 0) {
|
||||
@ -84,18 +84,18 @@ int refreshNeeded(const char *app_path)
|
||||
// Check if bounded rif file exits
|
||||
_sceNpDrmGetRifName(rif_name, 0, aid);
|
||||
if (is_app)
|
||||
snprintf(sfo_path, MAX_PATH_LENGTH - 1, "ux0:license/app/%s/%s", titleid, rif_name);
|
||||
snprintf(sfo_path, MAX_PATH_LENGTH, "ux0:license/app/%s/%s", titleid, rif_name);
|
||||
else
|
||||
snprintf(sfo_path, MAX_PATH_LENGTH - 1, "ux0:license/addcont/%s/%s/%s", titleid, &contentid[20], rif_name);
|
||||
snprintf(sfo_path, MAX_PATH_LENGTH, "ux0:license/addcont/%s/%s/%s", titleid, &contentid[20], rif_name);
|
||||
if (checkFileExist(sfo_path))
|
||||
return 0;
|
||||
|
||||
// Check if fixed rif file exits
|
||||
_sceNpDrmGetFixedRifName(rif_name, 0, 0);
|
||||
if (is_app)
|
||||
snprintf(sfo_path, MAX_PATH_LENGTH - 1, "ux0:license/app/%s/%s", titleid, rif_name);
|
||||
snprintf(sfo_path, MAX_PATH_LENGTH, "ux0:license/app/%s/%s", titleid, rif_name);
|
||||
else
|
||||
snprintf(sfo_path, MAX_PATH_LENGTH - 1, "ux0:license/addcont/%s/%s/%s", titleid, &contentid[20], rif_name);
|
||||
snprintf(sfo_path, MAX_PATH_LENGTH, "ux0:license/addcont/%s/%s/%s", titleid, &contentid[20], rif_name);
|
||||
if (checkFileExist(sfo_path))
|
||||
return 0;
|
||||
}
|
||||
@ -108,7 +108,7 @@ int refreshApp(const char *app_path)
|
||||
char work_bin_path[MAX_PATH_LENGTH];
|
||||
int res;
|
||||
|
||||
snprintf(work_bin_path, MAX_PATH_LENGTH - 1, "%s/sce_sys/package/work.bin", app_path);
|
||||
snprintf(work_bin_path, MAX_PATH_LENGTH, "%s/sce_sys/package/work.bin", app_path);
|
||||
|
||||
// Remove work.bin for custom homebrews
|
||||
if (isCustomHomebrew(work_bin_path)) {
|
||||
@ -117,7 +117,7 @@ int refreshApp(const char *app_path)
|
||||
// If available, restore work.bin from licenses.db
|
||||
void *sfo_buffer = NULL;
|
||||
char sfo_path[MAX_PATH_LENGTH], contentid[50];
|
||||
snprintf(sfo_path, MAX_PATH_LENGTH - 1, "%s/sce_sys/param.sfo", app_path);
|
||||
snprintf(sfo_path, MAX_PATH_LENGTH, "%s/sce_sys/param.sfo", app_path);
|
||||
int sfo_size = allocateReadFile(sfo_path, &sfo_buffer);
|
||||
if (sfo_size > 0) {
|
||||
getSfoString(sfo_buffer, "CONTENT_ID", contentid, sizeof(contentid));
|
||||
@ -199,7 +199,7 @@ void app_callback(void* data, const char* dir, const char* subdir)
|
||||
return;
|
||||
|
||||
if (refresh_data->refresh_pass) {
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s/%s", dir, subdir);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s/%s", dir, subdir);
|
||||
if (refreshNeeded(path)) {
|
||||
// Move the directory to temp for installation
|
||||
removePath(APP_TEMP, NULL);
|
||||
@ -226,7 +226,7 @@ void dlc_callback_inner(void* data, const char* dir, const char* subdir)
|
||||
return;
|
||||
|
||||
if (dlc_data->refresh_data->refresh_pass) {
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "%s/%s", dir, subdir);
|
||||
snprintf(path, MAX_PATH_LENGTH, "%s/%s", dir, subdir);
|
||||
if (dlc_data->list_size < MAX_DLC_PER_TITLE)
|
||||
dlc_data->list[dlc_data->list_size++] = strdup(path);
|
||||
} else {
|
||||
@ -252,7 +252,7 @@ void dlc_callback_outer(void* data, const char* dir, const char* subdir)
|
||||
// 2. Refresh the moved dlc_data
|
||||
for (int i = 0; i < dlc_data.list_size; i++) {
|
||||
if (refreshNeeded(dlc_data.list[i])) {
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, DLC_TEMP "/%s", &dlc_data.list[i][len + 1]);
|
||||
snprintf(path, MAX_PATH_LENGTH, DLC_TEMP "/%s", &dlc_data.list[i][len + 1]);
|
||||
removePath(path, NULL);
|
||||
sceIoRename(dlc_data.list[i], path);
|
||||
} else {
|
||||
@ -265,7 +265,7 @@ void dlc_callback_outer(void* data, const char* dir, const char* subdir)
|
||||
// Now that the dlc we need are out of addcont/title_id, refresh them
|
||||
for (int i = 0; i < dlc_data.list_size; i++) {
|
||||
if (dlc_data.list[i] != NULL) {
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, DLC_TEMP "/%s", &dlc_data.list[i][len + 1]);
|
||||
snprintf(path, MAX_PATH_LENGTH, DLC_TEMP "/%s", &dlc_data.list[i][len + 1]);
|
||||
if (refreshApp(path) == 1)
|
||||
refresh_data->refreshed++;
|
||||
else
|
||||
|
90
sfo.c
90
sfo.c
@ -109,7 +109,7 @@ int SFOReader(const char *file) {
|
||||
int size = 0;
|
||||
|
||||
if (isInArchive()) {
|
||||
size = ReadArchiveFile(file, buffer, BIG_BUFFER_SIZE);
|
||||
size = ReadArchiveFile(file, buffer, BIG_BUFFER_SIZE);
|
||||
} else {
|
||||
size = ReadFile(file, buffer, BIG_BUFFER_SIZE);
|
||||
}
|
||||
@ -125,20 +125,31 @@ int SFOReader(const char *file) {
|
||||
|
||||
int base_pos = 0, rel_pos = 0;
|
||||
|
||||
int scroll_count = 0;
|
||||
float scroll_x = FILE_X;
|
||||
|
||||
while (1) {
|
||||
readPad();
|
||||
|
||||
if (pressed_pad[PAD_CANCEL]) {
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
if (hold_pad[PAD_UP] || hold2_pad[PAD_LEFT_ANALOG_UP]) {
|
||||
int old_pos = base_pos + rel_pos;
|
||||
|
||||
if (rel_pos > 0) {
|
||||
rel_pos--;
|
||||
} else if (base_pos > 0) {
|
||||
base_pos--;
|
||||
}
|
||||
|
||||
if (old_pos != base_pos + rel_pos) {
|
||||
scroll_count = 0;
|
||||
}
|
||||
} else if (hold_pad[PAD_DOWN] || hold2_pad[PAD_LEFT_ANALOG_DOWN]) {
|
||||
int old_pos = base_pos + rel_pos;
|
||||
|
||||
if ((rel_pos + 1) < sfo_header->count) {
|
||||
if ((rel_pos + 1) < MAX_POSITION) {
|
||||
rel_pos++;
|
||||
@ -146,15 +157,17 @@ int SFOReader(const char *file) {
|
||||
base_pos++;
|
||||
}
|
||||
}
|
||||
|
||||
if (old_pos != base_pos + rel_pos) {
|
||||
scroll_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Start drawing
|
||||
startDrawing(bg_text_image);
|
||||
|
||||
// Draw shell info
|
||||
// Draw
|
||||
drawShellInfo(file);
|
||||
|
||||
// Draw scroll bar
|
||||
drawScrollBar(base_pos, sfo_header->count);
|
||||
|
||||
int i;
|
||||
@ -163,26 +176,79 @@ int SFOReader(const char *file) {
|
||||
|
||||
uint32_t color = (rel_pos == i) ? TEXT_FOCUS_COLOR : TEXT_COLOR;
|
||||
|
||||
char *name = (char *)buffer + sfo_header->keyofs + entries->nameofs;
|
||||
pgf_draw_textf(SHELL_MARGIN_X, START_Y + (FONT_Y_SPACE * i), color, "%s", name);
|
||||
char *name = (char *)(buffer + sfo_header->keyofs + entries->nameofs);
|
||||
float name_x = pgf_draw_text(SHELL_MARGIN_X, START_Y + (FONT_Y_SPACE * i), color, name);
|
||||
|
||||
char string[128];
|
||||
|
||||
void *data = (void *)buffer + sfo_header->valofs + entries->dataofs;
|
||||
void *data = (void *)(buffer + sfo_header->valofs + entries->dataofs);
|
||||
switch (entries->type) {
|
||||
case PSF_TYPE_BIN:
|
||||
{
|
||||
string[0] = '\0';
|
||||
|
||||
int i;
|
||||
for (i = 0; i < entries->valsize; i++) {
|
||||
char ch[4];
|
||||
sprintf(ch, "%02X", ((uint8_t *)data)[i]);
|
||||
strlcat(string, ch, sizeof(string) - 1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
case PSF_TYPE_STR:
|
||||
snprintf(string, sizeof(string), "%s", (char *)data);
|
||||
{
|
||||
strncpy(string, (char *)data, sizeof(string) - 1);
|
||||
int len = strlen(string);
|
||||
int i;
|
||||
for (i = 0; i < len; i++)
|
||||
if (string[i] == '\n')
|
||||
string[i] = ' ';
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
case PSF_TYPE_VAL:
|
||||
{
|
||||
snprintf(string, sizeof(string), "0x%X", *(unsigned int *)data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pgf_draw_textf(ALIGN_RIGHT(INFORMATION_X, pgf_text_width(string)), START_Y + (FONT_Y_SPACE * i), color, string);
|
||||
// Draw
|
||||
float width = pgf_text_width(string);
|
||||
float aligned_x = ALIGN_RIGHT(INFORMATION_X, width);
|
||||
float min_x = aligned_x >= (name_x + 100.0f) ? aligned_x : (name_x + 100.0f);
|
||||
float y = START_Y + (FONT_Y_SPACE * i);
|
||||
|
||||
vita2d_enable_clipping();
|
||||
vita2d_set_clip_rectangle(min_x + 1.0f, y, INFORMATION_X + 1.0f, y + FONT_Y_SPACE);
|
||||
|
||||
float x = min_x;
|
||||
|
||||
if (i == rel_pos) {
|
||||
int width_int = (int)width;
|
||||
if (aligned_x < (name_x + 100.0f)) {
|
||||
if (scroll_count < 60) {
|
||||
scroll_x = x;
|
||||
} else if (scroll_count < width_int + 90) {
|
||||
scroll_x--;
|
||||
} else if (scroll_count < width_int + 120) {
|
||||
color = (color & 0x00FFFFFF) | ((((color >> 24) * (scroll_count - width_int - 90)) / 30) << 24); // fade-in in 0.5s
|
||||
scroll_x = x;
|
||||
} else {
|
||||
scroll_count = 0;
|
||||
}
|
||||
|
||||
scroll_count++;
|
||||
|
||||
x = scroll_x;
|
||||
}
|
||||
}
|
||||
|
||||
pgf_draw_text(x, y, color, string);
|
||||
|
||||
vita2d_disable_clipping();
|
||||
}
|
||||
|
||||
// End drawing
|
||||
|
6
theme.c
6
theme.c
@ -241,16 +241,16 @@ void loadTheme() {
|
||||
|
||||
if (theme_name) {
|
||||
// Load colors config
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "ux0:VitaShell/theme/%s/colors.txt", theme_name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "ux0:VitaShell/theme/%s/colors.txt", theme_name);
|
||||
readConfig(path, colors_entries, sizeof(colors_entries) / sizeof(ConfigEntry));
|
||||
|
||||
// Font
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "ux0:VitaShell/theme/%s/font.pgf", theme_name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "ux0:VitaShell/theme/%s/font.pgf", theme_name);
|
||||
font = vita2d_load_custom_pgf(path);
|
||||
|
||||
// Load theme
|
||||
for (i = 0; i < N_THEME_IMAGES; i++) {
|
||||
snprintf(path, MAX_PATH_LENGTH - 1, "ux0:VitaShell/theme/%s/%s", theme_name, theme_images[i].name);
|
||||
snprintf(path, MAX_PATH_LENGTH, "ux0:VitaShell/theme/%s/%s", theme_name, theme_images[i].name);
|
||||
if (theme_images[i].texture && *(theme_images[i].texture) == NULL)
|
||||
*(theme_images[i].texture) = vita2d_load_PNG_file(path);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user