UI2
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
||||
*.o
|
||||
*.a
|
||||
/eboot.bin
|
||||
.vscode/
|
||||
*.elf
|
||||
*.sfo
|
||||
*.velf
|
||||
|
10
Makefile
@ -1,13 +1,18 @@
|
||||
TITLE_ID = VITASHELL
|
||||
TARGET = VitaShell
|
||||
OBJS = main.o init.o io_process.o package_installer.o network_update.o context_menu.o archive.o photo.o audioplayer.o file.o text.o hex.o sfo.o \
|
||||
uncommon_dialog.o message_dialog.o ime_dialog.o config.o theme.o language.o utils.o sha1.o list_dialog.o \
|
||||
uncommon_dialog.o message_dialog.o ime_dialog.o config.o theme.o language.o utils.o sha1.o list_dialog.o UI2.o touch_shell.o \
|
||||
minizip/unzip.o minizip/ioapi.o bm.o audio/vita_audio.o audio/player.o audio/id3.o audio/oggplayer.o audio/mp3player.o audio/mp3xing.o audio/lrcparse.o\
|
||||
libmad/bit.o libmad/decoder.o libmad/fixed.o libmad/frame.o \
|
||||
libmad/huffman.o libmad/layer12.o libmad/layer3.o \
|
||||
libmad/stream.o libmad/synth.o libmad/timer.o
|
||||
|
||||
RESOURCES = resources
|
||||
RESOURCES = resources \
|
||||
resources/bg_wallpaper.png resources/vita_game_card.png resources/vita_game_card_storage.png \
|
||||
resources/os0.png resources/memory_card.png resources/run_file.png resources/unknown_file.png resources/image_file.png \
|
||||
resources/sa0.png resources/ur0.png resources/vd0.png resources/vs0.png resources/savedata0.png resources/pd0.png resources/app0.png \
|
||||
resources/ud0.png resources/folder.png resources/mark.png resources/music_file.png resources/zip_file.png resources/txt_file.png resources/title_bar_bg.png \
|
||||
resources/updir.png
|
||||
RESOURCES_PNG := $(foreach dir,$(RESOURCES), $(wildcard $(dir)/*.png))
|
||||
RESOURCES_TXT := $(foreach dir,$(RESOURCES), $(wildcard $(dir)/*.txt))
|
||||
RESOURCES_BIN := $(foreach dir,$(RESOURCES), $(wildcard $(dir)/*.bin))
|
||||
@ -44,6 +49,7 @@ all: $(TARGET).vpk
|
||||
vita-mksfoex -d PARENTAL_LEVEL=1 -s APP_VER=01.20 -s TITLE_ID=$(TITLE_ID) "$(TARGET)" param.sfo
|
||||
vita-pack-vpk -s param.sfo -b eboot.bin \
|
||||
--add pkg/sce_sys/icon0.png=sce_sys/icon0.png \
|
||||
--add pkg/sce_sys/pic0.png=sce_sys/pic0.png \
|
||||
--add pkg/sce_sys/livearea/contents/bg.png=sce_sys/livearea/contents/bg.png \
|
||||
--add pkg/sce_sys/livearea/contents/startup.png=sce_sys/livearea/contents/startup.png \
|
||||
--add pkg/sce_sys/livearea/contents/template.xml=sce_sys/livearea/contents/template.xml \
|
||||
|
94
UI2.h
Normal file
@ -0,0 +1,94 @@
|
||||
#ifndef __UI2_H__
|
||||
#define __UI2_H__
|
||||
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <psp2/appmgr.h>
|
||||
#include <psp2/apputil.h>
|
||||
#include <psp2/audioout.h>
|
||||
#include <psp2/audiodec.h>
|
||||
#include <psp2/ctrl.h>
|
||||
#include <psp2/display.h>
|
||||
#include <psp2/libssl.h>
|
||||
#include <psp2/ime_dialog.h>
|
||||
#include <psp2/message_dialog.h>
|
||||
#include <psp2/moduleinfo.h>
|
||||
#include <psp2/musicexport.h>
|
||||
#include <psp2/photoexport.h>
|
||||
#include <psp2/pgf.h>
|
||||
#include <psp2/power.h>
|
||||
#include <psp2/rtc.h>
|
||||
#include <psp2/sysmodule.h>
|
||||
#include <psp2/system_param.h>
|
||||
#include <psp2/touch.h>
|
||||
#include <psp2/types.h>
|
||||
#include <psp2/kernel/modulemgr.h>
|
||||
#include <psp2/kernel/processmgr.h>
|
||||
#include <psp2/io/dirent.h>
|
||||
#include <psp2/io/fcntl.h>
|
||||
#include <psp2/net/http.h>
|
||||
#include <psp2/net/net.h>
|
||||
#include <psp2/net/netctl.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <vita2d.h>
|
||||
#include <ftpvita.h>
|
||||
|
||||
#include "file.h"
|
||||
|
||||
#include "functions.h"
|
||||
|
||||
#define lerp(value, from_max, to_max) ((((value*10) * (to_max*10))/(from_max*10))/10)
|
||||
#define HEIGHT_TITLE_BAR 31.0f
|
||||
#define FONT_Y_SPACE2 28.0f
|
||||
#define SHELL_MARGIN_Y_CUSTOM 2.0f
|
||||
#define SHELL_MARGIN_X_CUSTOM 20.0f
|
||||
|
||||
enum Colors
|
||||
{
|
||||
// Primary colors
|
||||
RED = 0xFF0000FF,
|
||||
GREEN = 0xFF00FF00,
|
||||
BLUE = 0xFFFF0000,
|
||||
// Secondary colors
|
||||
CYAN = 0xFFFFFF00,
|
||||
MAGENTA = 0xFFFF00FF,
|
||||
YELLOW = 0xFF00FFFF,
|
||||
// Tertiary colors
|
||||
AZURE = 0xFFFF7F00,
|
||||
VIOLET = 0xFFFF007F,
|
||||
ROSE = 0xFF7F00FF,
|
||||
ORANGE = 0xFF007FFF,
|
||||
CHARTREUSE = 0xFF00FF7F,
|
||||
SPRING_GREEN = 0xFF7FFF00,
|
||||
// Grayscale
|
||||
WHITE = 0xFFFFFFFF,
|
||||
LITEGRAY = 0xFFBFBFBF,
|
||||
GRAY = 0xFF7F7F7F,
|
||||
DARKGRAY = 0xFF3F3F3F,
|
||||
BLACK = 0xFF000000
|
||||
};
|
||||
|
||||
extern vita2d_texture *headphone_image, *audio_previous_image, *audio_pause_image, *audio_play_image, *audio_next_image;
|
||||
extern vita2d_texture *default_wallpaper, *game_card_storage_image, *game_card_image, *memory_card_image;
|
||||
extern vita2d_texture *run_file_image, *img_file_image, *unknown_file_image, *sa0_image, *ur0_image, *vd0_image, *vs0_image;
|
||||
extern vita2d_texture *savedata0_image, *folder_image, *pd0_image, *app0_image, *ud0_image, *mark_image, *music_image, *os0_image;
|
||||
extern vita2d_texture *zip_file_image, *txt_file_image, *title_bar_bg_image, *updir_image ;
|
||||
|
||||
extern bool Change_UI;
|
||||
|
||||
int UI2();
|
||||
|
||||
|
||||
#endif
|
108
audioplayer.c
@ -23,7 +23,6 @@
|
||||
#include "theme.h"
|
||||
#include "language.h"
|
||||
#include "utils.h"
|
||||
#include "audio/lrcparse.h"
|
||||
|
||||
#include "audio/player.h"
|
||||
|
||||
@ -31,95 +30,6 @@ static char title[128], album[128], artist[128], genre[128], year[12];
|
||||
static struct fileInfo *fileinfo = NULL;
|
||||
static vita2d_texture *tex = NULL;
|
||||
|
||||
|
||||
/**
|
||||
* Calculate the x-axis position if draw text in center
|
||||
* @param[in] sx start x-axis
|
||||
* @param[in] ex end x-axis
|
||||
* @param[in] text
|
||||
* @return x-axis position
|
||||
*/
|
||||
float getCenteroffset(float sx,float ex,char* string){
|
||||
if(!string||(string[0] == '\0'))
|
||||
return sx;
|
||||
|
||||
float drawWidthSpace = ex - sx;
|
||||
uint16_t stringWidth = vita2d_pgf_text_width(font,FONT_SIZE,string);
|
||||
return stringWidth > drawWidthSpace ? sx : sx + (drawWidthSpace - stringWidth) / 2 ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to load lrc file from audio path
|
||||
* @param[in] path audio path
|
||||
* @param[out] totalms set 0
|
||||
* @param[out] lyricsIndex set 0
|
||||
* @return Lyrics pointer , NULL is fail
|
||||
*/
|
||||
Lyrics* loadLyricsFile(char* path,uint64_t* totalms,uint32_t* lyricsIndex){
|
||||
size_t pathlength = strlen(path);
|
||||
*totalms = *lyricsIndex = 0;
|
||||
|
||||
while(pathlength > 0){
|
||||
if(path[pathlength] == '.'){
|
||||
break;
|
||||
}
|
||||
pathlength--;
|
||||
}
|
||||
|
||||
if(pathlength < 0)
|
||||
return NULL;
|
||||
|
||||
char lrcPath[pathlength + 5 * sizeof(char)];
|
||||
memccpy(lrcPath,path,sizeof(char),pathlength);//copy path string except filename extension
|
||||
strcpy(lrcPath+pathlength,".lrc");
|
||||
|
||||
return lrcParseLoadWithFile(lrcPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the lyrics from the designated area
|
||||
* @param[in] lyrics Lyrics pointer
|
||||
* @param[in] cur_time_string Playing time string
|
||||
* @param[out] totalms Playing time (millisecond)
|
||||
* @param[out] lyricsIndex Index of lyrics
|
||||
* @param[in] lrcSpaceX Designated area starting point x
|
||||
* @param[in] lrcSpaceX Designated area starting point y
|
||||
*/
|
||||
void drawLyrics(Lyrics* lyrics,char* cur_time_string,uint64_t* totalms,uint32_t* lyricsIndex,float lrcSpaceX,float lrcSpaceY){
|
||||
if(!lyrics)
|
||||
return;
|
||||
|
||||
char hourString[3];
|
||||
char minuteString[3];
|
||||
char secondString[3];
|
||||
|
||||
strncpy(hourString,cur_time_string,sizeof(hourString));
|
||||
strncpy(minuteString,cur_time_string + 3,sizeof(minuteString));
|
||||
strncpy(secondString,cur_time_string + 6,sizeof(secondString));
|
||||
|
||||
*totalms = (((atoi(hourString) * 60) + atoi(minuteString)) * 60 + atoi(secondString)) * 1000;
|
||||
|
||||
uint32_t m_index = *lyricsIndex >= 1 ? (*lyricsIndex - 1) : *lyricsIndex;
|
||||
float right_max_x = SCREEN_WIDTH - SHELL_MARGIN_X;
|
||||
//draw current lyrics
|
||||
pgf_draw_textf(getCenteroffset(lrcSpaceX,right_max_x,lyrics->lrclines[m_index].word),lrcSpaceY, AUDIO_INFO_ASSIGN, FONT_SIZE, "%s",lyrics->lrclines[m_index].word);
|
||||
|
||||
int i;
|
||||
for(i = 1;i < 7; i++){//draw 6 line lyrics for preview
|
||||
int n_index = m_index + i;
|
||||
if(n_index + 1 > lyrics->lyricscount)
|
||||
break;
|
||||
pgf_draw_textf(getCenteroffset(lrcSpaceX,right_max_x,lyrics->lrclines[n_index].word),lrcSpaceY + FONT_Y_SPACE * i, AUDIO_INFO, FONT_SIZE, "%s",lyrics->lrclines[n_index].word);
|
||||
}
|
||||
|
||||
if( *totalms >= (lyrics->lrclines[*lyricsIndex].totalms) ){
|
||||
*lyricsIndex = *lyricsIndex + 1;
|
||||
}else
|
||||
if (( *lyricsIndex >= 1 ) & ( *totalms < (lyrics->lrclines[*lyricsIndex - 1].totalms ))){
|
||||
*lyricsIndex = *lyricsIndex - 1;
|
||||
}
|
||||
}
|
||||
|
||||
void shortenString(char *out, char *in, int width) {
|
||||
strcpy(out, in);
|
||||
|
||||
@ -225,11 +135,6 @@ int audioPlayer(char *file, int type, FileList *list, FileListEntry *entry, int
|
||||
|
||||
getAudioInfo(file);
|
||||
|
||||
uint64_t totalms = 0;
|
||||
uint32_t lyricsIndex = 0;
|
||||
Lyrics* lyrics = loadLyricsFile(file,&totalms,&lyricsIndex);
|
||||
|
||||
|
||||
while (1) {
|
||||
char cur_time_string[12];
|
||||
getTimeStringFunct(cur_time_string);
|
||||
@ -290,16 +195,12 @@ int audioPlayer(char *file, int type, FileList *list, FileListEntry *entry, int
|
||||
if (getPercentageFunct() == 100.0f || endOfStreamFunct() || pressed_buttons & SCE_CTRL_LTRIGGER || pressed_buttons & SCE_CTRL_RTRIGGER) {
|
||||
int previous = pressed_buttons & SCE_CTRL_LTRIGGER;
|
||||
if (previous && strcmp(cur_time_string, "00:00:00") != 0) {
|
||||
lrcParseClose(lyrics);
|
||||
endFunct();
|
||||
initFunct(0);
|
||||
loadFunct(file);
|
||||
playFunct();
|
||||
|
||||
getAudioInfo(file);
|
||||
|
||||
lyrics = loadLyricsFile(file,&totalms,&lyricsIndex);
|
||||
|
||||
} else {
|
||||
int available = 0;
|
||||
|
||||
@ -343,7 +244,6 @@ int audioPlayer(char *file, int type, FileList *list, FileListEntry *entry, int
|
||||
if (type == FILE_TYPE_MP3 || type == FILE_TYPE_OGG) {
|
||||
file = path;
|
||||
|
||||
lrcParseClose(lyrics);
|
||||
endFunct();
|
||||
|
||||
setAudioFunctions(type);
|
||||
@ -354,8 +254,6 @@ int audioPlayer(char *file, int type, FileList *list, FileListEntry *entry, int
|
||||
|
||||
getAudioInfo(file);
|
||||
|
||||
lyrics = loadLyricsFile(file,&totalms,&lyricsIndex);
|
||||
|
||||
available = 1;
|
||||
break;
|
||||
}
|
||||
@ -374,7 +272,6 @@ int audioPlayer(char *file, int type, FileList *list, FileListEntry *entry, int
|
||||
// Start drawing
|
||||
startDrawing(bg_audio_image);
|
||||
|
||||
|
||||
// Draw shell info
|
||||
drawShellInfo(file);
|
||||
|
||||
@ -406,8 +303,6 @@ int audioPlayer(char *file, int type, FileList *list, FileListEntry *entry, int
|
||||
|
||||
x -= 120.0f;
|
||||
|
||||
drawLyrics(lyrics,cur_time_string,&totalms,&lyricsIndex,x,START_Y + (6 * FONT_Y_SPACE));
|
||||
|
||||
float y = SCREEN_HEIGHT - 6.0f * SHELL_MARGIN_Y;
|
||||
|
||||
// Icon
|
||||
@ -453,7 +348,6 @@ int audioPlayer(char *file, int type, FileList *list, FileListEntry *entry, int
|
||||
tex = NULL;
|
||||
}
|
||||
|
||||
lrcParseClose(lyrics);
|
||||
endFunct();
|
||||
|
||||
powerUnlock();
|
||||
@ -461,4 +355,4 @@ int audioPlayer(char *file, int type, FileList *list, FileListEntry *entry, int
|
||||
sceAppMgrReleaseBgmPort();
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
114
init.c
@ -22,6 +22,40 @@
|
||||
#include "package_installer.h"
|
||||
#include "utils.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
extern unsigned char _binary_resources_vita_game_card_png_start;
|
||||
extern unsigned char _binary_resources_vita_game_card_storage_png_start;
|
||||
extern unsigned char _binary_resources_memory_card_png_start;
|
||||
extern unsigned char _binary_resources_os0_png_start;
|
||||
extern unsigned char _binary_resources_sa0_png_start;
|
||||
extern unsigned char _binary_resources_ur0_png_start;
|
||||
extern unsigned char _binary_resources_vd0_png_start;
|
||||
extern unsigned char _binary_resources_vs0_png_start;
|
||||
extern unsigned char _binary_resources_savedata0_png_start;
|
||||
extern unsigned char _binary_resources_pd0_png_start;
|
||||
extern unsigned char _binary_resources_app0_png_start;
|
||||
extern unsigned char _binary_resources_ud0_png_start;
|
||||
|
||||
extern unsigned char _binary_resources_bg_wallpaper_png_start;
|
||||
extern unsigned char _binary_resources_folder_png_start;
|
||||
extern unsigned char _binary_resources_mark_png_start;
|
||||
extern unsigned char _binary_resources_run_file_png_start;
|
||||
extern unsigned char _binary_resources_image_file_png_start;
|
||||
extern unsigned char _binary_resources_unknown_file_png_start;
|
||||
extern unsigned char _binary_resources_music_file_png_start;
|
||||
extern unsigned char _binary_resources_zip_file_png_start;
|
||||
extern unsigned char _binary_resources_txt_file_png_start;
|
||||
extern unsigned char _binary_resources_music_file_png_start;
|
||||
extern unsigned char _binary_resources_title_bar_bg_png_start;
|
||||
extern unsigned char _binary_resources_updir_png_start;
|
||||
|
||||
vita2d_texture *default_wallpaper = NULL, *game_card_storage_image = NULL, *game_card_image = NULL, *memory_card_image = NULL;
|
||||
vita2d_texture *run_file_image = NULL, *img_file_image = NULL, *unknown_file_image = NULL, *sa0_image = NULL, *ur0_image = NULL, *vd0_image = NULL, *vs0_image = NULL;
|
||||
vita2d_texture *savedata0_image = NULL, *pd0_image = NULL, *folder_image = NULL, *app0_image = NULL, *ud0_image = NULL, *mark_image = NULL, *music_image = NULL, *os0_image = NULL ;
|
||||
vita2d_texture *zip_file_image = NULL, *txt_file_image = NULL, *title_bar_bg_image = NULL, *updir_image = NULL ;
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
INCLUDE_EXTERN_RESOURCE(changeinfo_txt);
|
||||
|
||||
INCLUDE_EXTERN_RESOURCE(folder_icon_png);
|
||||
@ -121,11 +155,91 @@ void finishSceAppUtil() {
|
||||
|
||||
void initVita2dLib() {
|
||||
vita2d_init();
|
||||
|
||||
////////////////////////////////////////////////
|
||||
game_card_image = vita2d_load_PNG_buffer(&_binary_resources_vita_game_card_png_start);
|
||||
game_card_storage_image = vita2d_load_PNG_buffer(&_binary_resources_vita_game_card_storage_png_start);
|
||||
memory_card_image = vita2d_load_PNG_buffer(&_binary_resources_memory_card_png_start);
|
||||
os0_image = vita2d_load_PNG_buffer(&_binary_resources_os0_png_start);
|
||||
sa0_image = vita2d_load_PNG_buffer(&_binary_resources_sa0_png_start);
|
||||
ur0_image = vita2d_load_PNG_buffer(&_binary_resources_ur0_png_start);
|
||||
vd0_image = vita2d_load_PNG_buffer(&_binary_resources_vd0_png_start);
|
||||
vs0_image = vita2d_load_PNG_buffer(&_binary_resources_vs0_png_start);
|
||||
savedata0_image = vita2d_load_PNG_buffer(&_binary_resources_savedata0_png_start);
|
||||
pd0_image = vita2d_load_PNG_buffer(&_binary_resources_pd0_png_start);
|
||||
app0_image = vita2d_load_PNG_buffer(&_binary_resources_app0_png_start);
|
||||
ud0_image = vita2d_load_PNG_buffer(&_binary_resources_ud0_png_start);
|
||||
|
||||
default_wallpaper = vita2d_load_PNG_buffer(&_binary_resources_bg_wallpaper_png_start);
|
||||
folder_image = vita2d_load_PNG_buffer(&_binary_resources_folder_png_start);
|
||||
mark_image = vita2d_load_PNG_buffer(&_binary_resources_mark_png_start);
|
||||
run_file_image = vita2d_load_PNG_buffer(&_binary_resources_run_file_png_start);
|
||||
img_file_image = vita2d_load_PNG_buffer(&_binary_resources_image_file_png_start);
|
||||
unknown_file_image = vita2d_load_PNG_buffer(&_binary_resources_unknown_file_png_start);
|
||||
music_image = vita2d_load_PNG_buffer(&_binary_resources_music_file_png_start);
|
||||
zip_file_image = vita2d_load_PNG_buffer(&_binary_resources_zip_file_png_start);
|
||||
txt_file_image = vita2d_load_PNG_buffer(&_binary_resources_txt_file_png_start);
|
||||
title_bar_bg_image = vita2d_load_PNG_buffer(&_binary_resources_title_bar_bg_png_start);
|
||||
updir_image = vita2d_load_PNG_buffer(&_binary_resources_updir_png_start);
|
||||
////////////////////////////////////////////////
|
||||
}
|
||||
|
||||
void finishVita2dLib() {
|
||||
/////////////////////////////////////////////////////
|
||||
vita2d_free_texture(game_card_image);
|
||||
vita2d_free_texture(game_card_storage_image);
|
||||
vita2d_free_texture(memory_card_image);
|
||||
vita2d_free_texture(os0_image);
|
||||
vita2d_free_texture(sa0_image);
|
||||
vita2d_free_texture(ur0_image);
|
||||
vita2d_free_texture(vd0_image);
|
||||
vita2d_free_texture(vs0_image);
|
||||
vita2d_free_texture(savedata0_image);
|
||||
vita2d_free_texture(pd0_image);
|
||||
vita2d_free_texture(app0_image);
|
||||
vita2d_free_texture(ud0_image);
|
||||
|
||||
vita2d_free_texture(default_wallpaper);
|
||||
vita2d_free_texture(folder_image);
|
||||
vita2d_free_texture(mark_image);
|
||||
vita2d_free_texture(run_file_image);
|
||||
vita2d_free_texture(img_file_image);
|
||||
vita2d_free_texture(unknown_file_image);
|
||||
vita2d_free_texture(music_image);
|
||||
vita2d_free_texture(zip_file_image);
|
||||
vita2d_free_texture(txt_file_image);
|
||||
vita2d_free_texture(music_image);
|
||||
vita2d_free_texture(title_bar_bg_image);
|
||||
vita2d_free_texture(updir_image);
|
||||
/////////////////////////////////////////////////////
|
||||
vita2d_free_pgf(font);
|
||||
vita2d_fini();
|
||||
/////////////////////////////////////////////////////
|
||||
game_card_image = NULL;
|
||||
game_card_storage_image = NULL;
|
||||
memory_card_image = NULL;
|
||||
os0_image = NULL;
|
||||
sa0_image = NULL;
|
||||
ur0_image = NULL;
|
||||
vd0_image = NULL;
|
||||
vs0_image = NULL;
|
||||
savedata0_image = NULL;
|
||||
pd0_image = NULL;
|
||||
app0_image = NULL;
|
||||
ud0_image = NULL;
|
||||
|
||||
default_wallpaper = NULL;
|
||||
folder_image = NULL;
|
||||
mark_image = NULL;
|
||||
run_file_image = NULL;
|
||||
img_file_image = NULL;
|
||||
unknown_file_image = NULL;
|
||||
music_image = NULL;
|
||||
zip_file_image = NULL;
|
||||
txt_file_image = NULL;
|
||||
title_bar_bg_image = NULL;
|
||||
updir_image = NULL;
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
font = NULL;
|
||||
}
|
||||
|
16
main.c
@ -45,6 +45,7 @@
|
||||
#include "utils.h"
|
||||
#include "sfo.h"
|
||||
#include "list_dialog.h"
|
||||
#include "UI2.h"
|
||||
|
||||
#include "audio/vita_audio.h"
|
||||
|
||||
@ -1289,6 +1290,11 @@ void fileBrowserMenuCtrl() {
|
||||
}
|
||||
}
|
||||
|
||||
// Change UI
|
||||
if (pressed_buttons & SCE_CTRL_RTRIGGER) {
|
||||
Change_UI = true;
|
||||
}
|
||||
|
||||
// FTP
|
||||
if (pressed_buttons & SCE_CTRL_SELECT) {
|
||||
// Init FTP
|
||||
@ -1416,6 +1422,7 @@ void fileBrowserMenuCtrl() {
|
||||
}
|
||||
|
||||
int shellMain() {
|
||||
BEGIN_SHELL_UI:
|
||||
// Position
|
||||
memset(base_pos_list, 0, sizeof(base_pos_list));
|
||||
memset(rel_pos_list, 0, sizeof(rel_pos_list));
|
||||
@ -1486,6 +1493,7 @@ int shellMain() {
|
||||
context_menu.menuMoreEnterCallback = contextMenuMoreEnterCallback;
|
||||
|
||||
while (1) {
|
||||
if (!Change_UI) {
|
||||
readPad();
|
||||
|
||||
int refresh = 0;
|
||||
@ -1679,6 +1687,10 @@ int shellMain() {
|
||||
|
||||
// End drawing
|
||||
endDrawing();
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Empty lists
|
||||
@ -1686,6 +1698,10 @@ int shellMain() {
|
||||
fileListEmpty(&mark_list);
|
||||
fileListEmpty(&file_list);
|
||||
|
||||
if (Change_UI) {
|
||||
UI2();
|
||||
goto BEGIN_SHELL_UI;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
1
main.h
@ -208,4 +208,3 @@ void ftpvita_PROM(ftpvita_client_info_t *client);
|
||||
void install_unassisted_sync(char *path);
|
||||
|
||||
#endif
|
||||
|
||||
|
BIN
pkg/sce_sys/pic0.png
Normal file
After Width: | Height: | Size: 116 KiB |
BIN
resources/app0.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
resources/audio_next.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
resources/audio_pause.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
resources/audio_play.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
resources/audio_previous.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
resources/bg_wallpaper.png
Normal file
After Width: | Height: | Size: 214 KiB |
BIN
resources/context.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
resources/dialog.png
Normal file
After Width: | Height: | Size: 10 KiB |
28
resources/english_us_translation.txt
Normal file
@ -0,0 +1,28 @@
|
||||
Error 0x%08X.
|
||||
OK
|
||||
Yes
|
||||
No
|
||||
Cancel
|
||||
Offset
|
||||
Mark all
|
||||
Unmark all
|
||||
Move
|
||||
Copy
|
||||
Paste
|
||||
Delete
|
||||
Rename
|
||||
New folder
|
||||
Folder
|
||||
Copied %d file.
|
||||
Copied %d folder.
|
||||
Copied %d files/folders.
|
||||
Moving...
|
||||
Copying...
|
||||
Deleting...
|
||||
Installing...
|
||||
Are you sure you want to delete this file?
|
||||
Are you sure you want to delete this folder?
|
||||
Are you sure you want to delete these files/folders?
|
||||
Do you want to install this package?
|
||||
You must use Wi-Fi to do this.
|
||||
FTP server is now running at\ftp://%s:%i\\Press 'OK' to keep it in background.\Press 'Cancel' to disconnect.
|
BIN
resources/folder.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
resources/headphone.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
resources/image_file.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
resources/mark.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
resources/memory_card.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
resources/music_file.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
resources/os0.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
resources/pd0.png
Normal file
After Width: | Height: | Size: 7.0 KiB |
BIN
resources/run_file.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
resources/sa0.png
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
resources/savedata0.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
resources/title_bar_bg.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/txt_file.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
resources/ud0.png
Normal file
After Width: | Height: | Size: 8.6 KiB |
BIN
resources/unknown_file.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
resources/updir.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
BIN
resources/ur0.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
resources/vd0.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
BIN
resources/vita_game_card.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
resources/vita_game_card_storage.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
resources/vs0.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
resources/zip_file.png
Normal file
After Width: | Height: | Size: 8.0 KiB |
145
touch_shell.c
Normal file
@ -0,0 +1,145 @@
|
||||
#include "touch_shell.h"
|
||||
|
||||
#define HEIGHT_TITLE_BAR 31.0f
|
||||
|
||||
bool touch_press = false;
|
||||
SceTouchData touch;
|
||||
int countTouch = 0;
|
||||
int pre_touch_y = 0;
|
||||
int pre_touch_x = 0;
|
||||
bool touch_nothing = false;
|
||||
|
||||
// State_Touch is global value to certain function TOUCH_FRONT alway return absolute one value for one time.
|
||||
int State_Touch = -1;
|
||||
float slide_value_hold = 0;
|
||||
float slide_value = 0;
|
||||
|
||||
bool saved_loc = false;
|
||||
bool have_slide = false;
|
||||
bool have_touch_hold = false;
|
||||
bool have_touch = true;
|
||||
int MIN_SLIDE_VERTTICAL = 40.0f;
|
||||
int MIN_SLIDE_HORIZONTAL = 100.0f;
|
||||
int AREA_TOUCH = 40.0f;
|
||||
bool disable_touch = false;
|
||||
|
||||
clock_t time_on_touch_start = 0;
|
||||
|
||||
// Output:
|
||||
// 0 : Touch down select
|
||||
// 1 : Touch up select
|
||||
// 2 : Double touch (temporary disable)
|
||||
// 3 : Hold Touch
|
||||
// 4 : Empty slot
|
||||
// 5 : Empty slot
|
||||
// 6 : Touch slide up
|
||||
// 7 : Touch slide down
|
||||
// 8 : Touch slide left
|
||||
// 9 : Touch slide right
|
||||
// 10 : Two finger slide right
|
||||
// 11 : Empty slot
|
||||
// 12 : Empty slot
|
||||
// 13 : Empty slot
|
||||
// 14 : Three finger slide left
|
||||
// 15 : Three finger slide right
|
||||
int TOUCH_FRONT() {
|
||||
sceTouchPeek(0, &touch, 1);
|
||||
|
||||
if(touch_press & (touch.reportNum == 0) ) {
|
||||
saved_loc = false;
|
||||
time_on_touch_start = 0;
|
||||
|
||||
//Touch up Select Event
|
||||
//prevent event slide
|
||||
if (!have_slide) {
|
||||
State_Touch = 1;
|
||||
|
||||
//Touch Double Event
|
||||
//prevent event slide
|
||||
//if (!have_slide)
|
||||
//if ((touch.report[0].x < pre_touch_x + AREA_TOUCH) & (touch.report[0].x > pre_touch_x - AREA_TOUCH) & (touch.report[0].y < pre_touch_y + AREA_TOUCH) & (touch.report[0].y > pre_touch_y - AREA_TOUCH)) {
|
||||
//countTouch++;
|
||||
//}
|
||||
}
|
||||
else {
|
||||
touch_nothing = false;
|
||||
}
|
||||
|
||||
|
||||
if (countTouch >= 2) {
|
||||
countTouch = 0;
|
||||
//State_Touch = 2;
|
||||
}
|
||||
|
||||
//reset listen event slide
|
||||
have_slide = false;
|
||||
}
|
||||
|
||||
if (touch.reportNum > 0) {
|
||||
touch_press = true;
|
||||
|
||||
if (!saved_loc) {
|
||||
if (touch.report[0].x > pre_touch_x + AREA_TOUCH || touch.report[0].x < pre_touch_x - AREA_TOUCH) {
|
||||
pre_touch_x = touch.report[0].x;
|
||||
countTouch = 0;
|
||||
}
|
||||
if (touch.report[0].y > pre_touch_y + AREA_TOUCH || touch.report[0].y < pre_touch_y - AREA_TOUCH) {
|
||||
pre_touch_y = touch.report[0].y;
|
||||
countTouch = 0;
|
||||
}
|
||||
time_on_touch_start = clock();
|
||||
saved_loc = true;
|
||||
slide_value_hold = slide_value;
|
||||
|
||||
//Touch down Select Event
|
||||
State_Touch = 0;
|
||||
|
||||
}
|
||||
|
||||
//Touch Slide Up Event
|
||||
if (((touch.report[0].y < pre_touch_y - MIN_SLIDE_VERTTICAL) || (pre_touch_y > SCREEN_HEIGHT*2 - HEIGHT_TITLE_BAR)) & (touch.reportNum == 1)) {
|
||||
State_Touch = 6;
|
||||
have_slide = true;
|
||||
return State_Touch;
|
||||
}
|
||||
|
||||
//Touch Slide Down Event
|
||||
if (((touch.report[0].y > pre_touch_y + MIN_SLIDE_VERTTICAL) || (pre_touch_y < HEIGHT_TITLE_BAR)) & (touch.reportNum == 1)) {
|
||||
State_Touch = 7;
|
||||
have_slide = true;
|
||||
return State_Touch;
|
||||
}
|
||||
|
||||
//Touch Slide Left Event
|
||||
if ((touch.report[0].x < pre_touch_x - MIN_SLIDE_HORIZONTAL) & (touch.reportNum == 1)) {
|
||||
State_Touch = 8;
|
||||
have_slide = true;
|
||||
return State_Touch;
|
||||
}
|
||||
|
||||
//Touch Slide Right Event
|
||||
if ((touch.report[0].x > pre_touch_x + MIN_SLIDE_HORIZONTAL) & (touch.reportNum == 1)) {
|
||||
State_Touch = 9;
|
||||
have_slide = true;
|
||||
return State_Touch;
|
||||
} else
|
||||
|
||||
//Two finger slide right
|
||||
if ((touch.report[0].x > pre_touch_x + MIN_SLIDE_HORIZONTAL) & (touch.report[1].x > pre_touch_x + MIN_SLIDE_HORIZONTAL) & (touch.reportNum == 2)) {
|
||||
State_Touch = 10;
|
||||
have_slide = true;
|
||||
return State_Touch;
|
||||
}
|
||||
|
||||
if (!have_slide) {
|
||||
if (((float)(clock() - time_on_touch_start)/CLOCKS_PER_SEC > 0.4f) & (time_on_touch_start > 0)) {
|
||||
if ((touch.report[0].x < pre_touch_x + AREA_TOUCH) & (touch.report[0].x > pre_touch_x - AREA_TOUCH) & (touch.report[0].y < pre_touch_y + AREA_TOUCH) & (touch.report[0].y > pre_touch_y - AREA_TOUCH)) {
|
||||
State_Touch = 3;
|
||||
return State_Touch;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else touch_press = false;
|
||||
return State_Touch;
|
||||
}
|
36
touch_shell.h
Normal file
@ -0,0 +1,36 @@
|
||||
#include "main.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
extern int pre_touch_y;
|
||||
extern int pre_touch_x;
|
||||
extern float slide_value_hold;
|
||||
extern float slide_value;
|
||||
extern SceTouchData touch;
|
||||
extern bool touch_nothing;
|
||||
|
||||
// State_Touch is global value to certain function TOUCH_FRONT alway return absolute one value for one time.
|
||||
extern int State_Touch;
|
||||
|
||||
extern bool have_touch_hold;
|
||||
extern bool have_touch;
|
||||
|
||||
extern bool disable_touch;
|
||||
|
||||
// Output:
|
||||
// 0 : Touch down select
|
||||
// 1 : Touch up select
|
||||
// 2 : Double touch (temporary disable)
|
||||
// 3 : Hold Touch
|
||||
// 4 : Empty slot
|
||||
// 5 : Empty slot
|
||||
// 6 : Touch slide up
|
||||
// 7 : Touch slide down
|
||||
// 8 : Touch slide left
|
||||
// 9 : Touch slide right
|
||||
// 10 : Two finger slide right
|
||||
// 11 : Empty slot
|
||||
// 12 : Empty slot
|
||||
// 13 : Empty slot
|
||||
// 14 : Three finger slide left
|
||||
// 15 : Three finger slide right
|
||||
int TOUCH_FRONT();
|
@ -17,12 +17,19 @@
|
||||
*/
|
||||
|
||||
#include "main.h"
|
||||
#include "UI2.h"
|
||||
#include "touch_shell.h"
|
||||
#include "init.h"
|
||||
#include "theme.h"
|
||||
#include "language.h"
|
||||
#include "utils.h"
|
||||
#include "uncommon_dialog.h"
|
||||
|
||||
int type_touch = 0;
|
||||
float x_d_start = 0;
|
||||
float x_d_end = 0;
|
||||
float y_d = 0;
|
||||
|
||||
typedef struct {
|
||||
int animation_mode;
|
||||
int status;
|
||||
@ -140,12 +147,24 @@ int sceMsgDialogInit(const SceMsgDialogParam *param) {
|
||||
|
||||
SceCommonDialogStatus sceMsgDialogGetStatus(void) {
|
||||
if (uncommon_dialog.status == SCE_COMMON_DIALOG_STATUS_RUNNING) {
|
||||
switch (uncommon_dialog.buttonType) {
|
||||
if (TOUCH_FRONT() == 1) {
|
||||
State_Touch = -1;
|
||||
float t_x = touch.report[0].x;
|
||||
float t_y = touch.report[0].y;
|
||||
if ((t_x < x_d_end) & (t_x > x_d_start) & (t_y < y_d + FONT_Y_SPACE2) & (t_y > y_d - FONT_Y_SPACE2)) {
|
||||
type_touch = 1;
|
||||
}
|
||||
else {
|
||||
type_touch = 2;
|
||||
}
|
||||
}
|
||||
switch (uncommon_dialog.buttonType) {
|
||||
case SCE_MSG_DIALOG_BUTTON_TYPE_OK:
|
||||
{
|
||||
if (pressed_buttons & SCE_CTRL_ENTER) {
|
||||
if ((pressed_buttons & SCE_CTRL_ENTER) || (type_touch == 1)) {
|
||||
uncommon_dialog.animation_mode = UNCOMMON_DIALOG_CLOSING;
|
||||
uncommon_dialog.buttonId = SCE_MSG_DIALOG_BUTTON_ID_OK;
|
||||
type_touch = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
@ -153,14 +172,16 @@ SceCommonDialogStatus sceMsgDialogGetStatus(void) {
|
||||
|
||||
case SCE_MSG_DIALOG_BUTTON_TYPE_YESNO:
|
||||
{
|
||||
if (pressed_buttons & SCE_CTRL_ENTER) {
|
||||
if ((pressed_buttons & SCE_CTRL_ENTER) || (type_touch == 1)) {
|
||||
uncommon_dialog.animation_mode = UNCOMMON_DIALOG_CLOSING;
|
||||
uncommon_dialog.buttonId = SCE_MSG_DIALOG_BUTTON_ID_YES;
|
||||
type_touch = 0;
|
||||
}
|
||||
|
||||
if (pressed_buttons & SCE_CTRL_CANCEL) {
|
||||
if ((pressed_buttons & SCE_CTRL_CANCEL) || (type_touch == 2)) {
|
||||
uncommon_dialog.animation_mode = UNCOMMON_DIALOG_CLOSING;
|
||||
uncommon_dialog.buttonId = SCE_MSG_DIALOG_BUTTON_ID_NO;
|
||||
type_touch = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
@ -168,14 +189,16 @@ SceCommonDialogStatus sceMsgDialogGetStatus(void) {
|
||||
|
||||
case SCE_MSG_DIALOG_BUTTON_TYPE_OK_CANCEL:
|
||||
{
|
||||
if (pressed_buttons & SCE_CTRL_ENTER) {
|
||||
if ((pressed_buttons & SCE_CTRL_ENTER) || (type_touch == 1)) {
|
||||
uncommon_dialog.animation_mode = UNCOMMON_DIALOG_CLOSING;
|
||||
uncommon_dialog.buttonId = SCE_MSG_DIALOG_BUTTON_ID_YES;
|
||||
type_touch = 0;
|
||||
}
|
||||
|
||||
if (pressed_buttons & SCE_CTRL_CANCEL) {
|
||||
if ((pressed_buttons & SCE_CTRL_CANCEL) || (type_touch == 2)) {
|
||||
uncommon_dialog.animation_mode = UNCOMMON_DIALOG_CLOSING;
|
||||
uncommon_dialog.buttonId = SCE_MSG_DIALOG_BUTTON_ID_NO;
|
||||
type_touch = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
@ -183,8 +206,9 @@ SceCommonDialogStatus sceMsgDialogGetStatus(void) {
|
||||
|
||||
case SCE_MSG_DIALOG_BUTTON_TYPE_CANCEL:
|
||||
{
|
||||
if (pressed_buttons & SCE_CTRL_CANCEL) {
|
||||
if ((pressed_buttons & SCE_CTRL_CANCEL) || (type_touch == 2)) {
|
||||
uncommon_dialog.animation_mode = UNCOMMON_DIALOG_CLOSING;
|
||||
type_touch = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
@ -323,6 +347,12 @@ int drawUncommonDialog() {
|
||||
|
||||
string_y += 2.0f * FONT_Y_SPACE;
|
||||
}
|
||||
//////////////////////////////////////////////////////////
|
||||
x_d_start = uncommon_dialog.x + uncommon_dialog.width;
|
||||
x_d_end = uncommon_dialog.x + uncommon_dialog.width + CENTER(SCREEN_WIDTH, vita2d_pgf_text_width(font, FONT_SIZE, string));
|
||||
y_d = uncommon_dialog.y + uncommon_dialog.height + string_y + FONT_Y_SPACE2;
|
||||
//vita2d_draw_rectangle(CENTER(SCREEN_WIDTH, vita2d_pgf_text_width(font, FONT_SIZE, button_string)) - 10, string_y + FONT_Y_SPACE , (x_d_end - x_d_start) / 3 - 15, FONT_Y_SPACE + 5, COLOR_ALPHA(GRAY, 0xC8));
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
switch (uncommon_dialog.buttonType) {
|
||||
case SCE_MSG_DIALOG_BUTTON_TYPE_OK:
|
||||
|