2016-08-06 06:59:41 +00:00
|
|
|
/*
|
|
|
|
VitaShell
|
2017-01-12 16:45:52 +00:00
|
|
|
Copyright (C) 2015-2017, TheFloW
|
2016-08-06 06:59:41 +00:00
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MAIN_H__
|
|
|
|
#define __MAIN_H__
|
|
|
|
|
|
|
|
#include <psp2/appmgr.h>
|
|
|
|
#include <psp2/apputil.h>
|
2016-08-08 21:31:41 +00:00
|
|
|
#include <psp2/audioout.h>
|
|
|
|
#include <psp2/audiodec.h>
|
2016-08-06 06:59:41 +00:00
|
|
|
#include <psp2/ctrl.h>
|
|
|
|
#include <psp2/display.h>
|
2016-09-04 08:44:48 +00:00
|
|
|
#include <psp2/libssl.h>
|
2016-08-06 06:59:41 +00:00
|
|
|
#include <psp2/ime_dialog.h>
|
|
|
|
#include <psp2/message_dialog.h>
|
2017-01-12 16:45:52 +00:00
|
|
|
#include <psp2/mtpif.h>
|
2016-09-14 09:33:52 +00:00
|
|
|
#include <psp2/musicexport.h>
|
2017-06-22 22:09:31 +00:00
|
|
|
#include <psp2/npdrm.h>
|
2016-09-14 09:33:52 +00:00
|
|
|
#include <psp2/photoexport.h>
|
2016-08-06 06:59:41 +00:00
|
|
|
#include <psp2/pgf.h>
|
|
|
|
#include <psp2/power.h>
|
2017-02-27 20:53:38 +00:00
|
|
|
#include <psp2/promoterutil.h>
|
2016-08-06 06:59:41 +00:00
|
|
|
#include <psp2/rtc.h>
|
2017-05-14 20:11:51 +00:00
|
|
|
#include <psp2/registrymgr.h>
|
2016-11-03 15:57:08 +00:00
|
|
|
#include <psp2/shellutil.h>
|
2016-08-06 06:59:41 +00:00
|
|
|
#include <psp2/sysmodule.h>
|
|
|
|
#include <psp2/system_param.h>
|
2016-08-12 19:30:04 +00:00
|
|
|
#include <psp2/touch.h>
|
2016-08-06 06:59:41 +00:00
|
|
|
#include <psp2/types.h>
|
2017-01-12 16:45:52 +00:00
|
|
|
#include <psp2/udcd.h>
|
|
|
|
#include <psp2/usbstorvstor.h>
|
2017-06-22 22:09:31 +00:00
|
|
|
#include <psp2/videoexport.h>
|
2016-09-14 09:33:52 +00:00
|
|
|
#include <psp2/kernel/modulemgr.h>
|
|
|
|
#include <psp2/kernel/processmgr.h>
|
2016-11-05 23:29:27 +00:00
|
|
|
#include <psp2/io/devctl.h>
|
2016-09-14 09:33:52 +00:00
|
|
|
#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>
|
2016-08-06 06:59:41 +00:00
|
|
|
|
|
|
|
#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>
|
|
|
|
|
2017-01-04 19:08:04 +00:00
|
|
|
#include <zlib.h>
|
|
|
|
|
2016-08-06 06:59:41 +00:00
|
|
|
#include <vita2d.h>
|
|
|
|
#include <ftpvita.h>
|
|
|
|
|
2016-12-11 21:30:07 +00:00
|
|
|
#include <taihen.h>
|
|
|
|
|
2017-02-26 21:02:29 +00:00
|
|
|
#include <vitashell_user.h>
|
2017-02-13 10:06:23 +00:00
|
|
|
|
2017-02-13 20:07:09 +00:00
|
|
|
#include "file.h"
|
2016-11-02 18:54:40 +00:00
|
|
|
#include "vitashell_config.h"
|
2016-08-06 06:59:41 +00:00
|
|
|
|
2016-09-12 13:49:51 +00:00
|
|
|
#define INCLUDE_EXTERN_RESOURCE(name) extern unsigned char _binary_resources_##name##_start; extern unsigned char _binary_resources_##name##_size; \
|
|
|
|
|
2016-08-06 06:59:41 +00:00
|
|
|
// VitaShell version major.minor
|
2016-09-12 20:34:03 +00:00
|
|
|
#define VITASHELL_VERSION_MAJOR 0x01
|
2017-09-18 11:13:45 +00:00
|
|
|
#define VITASHELL_VERSION_MINOR 0x74
|
2016-09-04 08:44:48 +00:00
|
|
|
|
|
|
|
#define VITASHELL_VERSION ((VITASHELL_VERSION_MAJOR << 0x18) | (VITASHELL_VERSION_MINOR << 0x10))
|
2016-08-06 06:59:41 +00:00
|
|
|
|
2016-09-10 10:58:22 +00:00
|
|
|
#define VITASHELL_LASTDIR "ux0:VitaShell/internal/lastdir.txt"
|
|
|
|
|
2017-02-25 09:27:52 +00:00
|
|
|
#define ALIGN(x, align) (((x) + ((align)-1)) & ~((align)-1))
|
2016-08-06 06:59:41 +00:00
|
|
|
|
|
|
|
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
|
|
|
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
|
|
|
|
2016-10-31 18:35:25 +00:00
|
|
|
#define IS_DIGIT(i) (i >= '0' && i <= '9')
|
|
|
|
|
2016-08-06 06:59:41 +00:00
|
|
|
#define NOALPHA 0xFF
|
|
|
|
|
|
|
|
#define COLOR_ALPHA(color, alpha) (color & 0x00FFFFFF) | ((alpha & 0xFF) << 24)
|
|
|
|
|
|
|
|
// Font
|
|
|
|
#define FONT_SIZE 1.0f
|
|
|
|
#define FONT_X_SPACE 15.0f
|
|
|
|
#define FONT_Y_SPACE 23.0f
|
|
|
|
|
|
|
|
#define pgf_draw_text(x, y, color, scale, text) \
|
2017-02-24 23:31:47 +00:00
|
|
|
vita2d_pgf_draw_text(font, x, (y)+20, color, scale, text)
|
2016-08-06 06:59:41 +00:00
|
|
|
|
|
|
|
#define pgf_draw_textf(x, y, color, scale, ...) \
|
2017-02-24 23:31:47 +00:00
|
|
|
vita2d_pgf_draw_textf(font, x, (y)+20, color, scale, __VA_ARGS__)
|
2016-08-06 06:59:41 +00:00
|
|
|
|
|
|
|
// Screen
|
|
|
|
#define SCREEN_WIDTH 960
|
|
|
|
#define SCREEN_HEIGHT 544
|
2017-02-24 23:31:47 +00:00
|
|
|
#define SCREEN_HALF_WIDTH (SCREEN_WIDTH/2)
|
|
|
|
#define SCREEN_HALF_HEIGHT (SCREEN_HEIGHT/2)
|
2016-08-06 06:59:41 +00:00
|
|
|
|
|
|
|
// Main
|
|
|
|
#define SHELL_MARGIN_X 20.0f
|
|
|
|
#define SHELL_MARGIN_Y 18.0f
|
|
|
|
|
2017-02-24 23:31:47 +00:00
|
|
|
#define PATH_Y (SHELL_MARGIN_Y + 1.0f*FONT_Y_SPACE)
|
2016-08-06 06:59:41 +00:00
|
|
|
|
2017-02-24 23:31:47 +00:00
|
|
|
#define START_Y (SHELL_MARGIN_Y + 3.0f*FONT_Y_SPACE)
|
2016-08-06 06:59:41 +00:00
|
|
|
|
2017-02-24 23:31:47 +00:00
|
|
|
#define MAX_WIDTH (SCREEN_WIDTH - 2.0f*SHELL_MARGIN_X)
|
2016-08-06 06:59:41 +00:00
|
|
|
|
2017-02-12 15:27:43 +00:00
|
|
|
#define STATUS_BAR_SPACE_X 12.0f
|
|
|
|
|
2016-08-06 06:59:41 +00:00
|
|
|
// Hex
|
|
|
|
#define HEX_OFFSET_X 147.0f
|
|
|
|
#define HEX_CHAR_X (SCREEN_WIDTH - SHELL_MARGIN_X - 0x10 * FONT_X_SPACE)
|
|
|
|
#define HEX_OFFSET_SPACE 34.0f
|
|
|
|
|
2017-01-04 19:08:04 +00:00
|
|
|
// Coredump
|
|
|
|
#define COREDUMP_INFO_X (SHELL_MARGIN_X + 160.0f)
|
|
|
|
#define COREDUMP_REGISTER_NAME_SPACE 45.0f
|
|
|
|
#define COREDUMP_REGISTER_SPACE 165.0f
|
|
|
|
|
2016-08-06 06:59:41 +00:00
|
|
|
// Scroll bar
|
|
|
|
#define SCROLL_BAR_X 0.0f
|
|
|
|
#define SCROLL_BAR_WIDTH 8.0f
|
|
|
|
#define SCROLL_BAR_MIN_HEIGHT 4.0f
|
|
|
|
|
|
|
|
// Context menu
|
|
|
|
#define CONTEXT_MENU_MIN_WIDTH 180.0f
|
|
|
|
#define CONTEXT_MENU_MARGIN 20.0f
|
|
|
|
#define CONTEXT_MENU_VELOCITY 10.0f
|
|
|
|
|
|
|
|
// File browser
|
2017-02-24 21:50:17 +00:00
|
|
|
#define FILE_X (SHELL_MARGIN_X+26.0f)
|
2017-02-24 23:31:47 +00:00
|
|
|
#define MARK_WIDTH (SCREEN_WIDTH - 2.0f*SHELL_MARGIN_X)
|
2016-08-06 06:59:41 +00:00
|
|
|
#define INFORMATION_X 680.0f
|
2016-09-03 19:43:15 +00:00
|
|
|
#define MAX_NAME_WIDTH 500.0f
|
2016-08-06 06:59:41 +00:00
|
|
|
|
|
|
|
// Uncommon dialog
|
2017-09-19 02:37:43 +00:00
|
|
|
#define UNCOMMON_DIALOG_MAX_WIDTH 800
|
2016-08-06 06:59:41 +00:00
|
|
|
#define UNCOMMON_DIALOG_PROGRESS_BAR_BOX_WIDTH 420.0f
|
|
|
|
#define UNCOMMON_DIALOG_PROGRESS_BAR_HEIGHT 8.0f
|
2017-09-16 09:18:56 +00:00
|
|
|
#define MSG_DIALOG_MODE_QR_SCAN 10
|
|
|
|
|
|
|
|
// QR Camera
|
|
|
|
#define CAM_WIDTH 640
|
|
|
|
#define CAM_HEIGHT 360
|
2016-08-06 06:59:41 +00:00
|
|
|
|
|
|
|
// Max entries
|
2017-09-16 09:18:56 +00:00
|
|
|
#define MAX_QR_LENGTH 1024
|
2016-08-06 06:59:41 +00:00
|
|
|
#define MAX_POSITION 16
|
|
|
|
#define MAX_ENTRIES 17
|
2017-09-16 09:18:56 +00:00
|
|
|
#define MAX_URL_LENGTH 128
|
2016-08-06 06:59:41 +00:00
|
|
|
|
|
|
|
#define BIG_BUFFER_SIZE 16 * 1024 * 1024
|
|
|
|
|
2016-10-15 14:49:06 +00:00
|
|
|
enum RefreshModes {
|
|
|
|
REFRESH_MODE_NONE,
|
|
|
|
REFRESH_MODE_NORMAL,
|
|
|
|
REFRESH_MODE_SETFOCUS,
|
|
|
|
};
|
|
|
|
|
2016-08-06 06:59:41 +00:00
|
|
|
enum DialogSteps {
|
|
|
|
DIALOG_STEP_NONE,
|
|
|
|
|
|
|
|
DIALOG_STEP_CANCELLED,
|
|
|
|
|
|
|
|
DIALOG_STEP_ERROR,
|
|
|
|
DIALOG_STEP_INFO,
|
|
|
|
DIALOG_STEP_SYSTEM,
|
|
|
|
|
2017-02-27 20:53:38 +00:00
|
|
|
DIALOG_STEP_REFRESH_LIVEAREA_QUESTION,
|
|
|
|
DIALOG_STEP_REFRESHING,
|
|
|
|
|
2017-02-13 10:06:23 +00:00
|
|
|
DIALOG_STEP_USB_ATTACH_WAIT,
|
|
|
|
|
2016-09-13 21:09:47 +00:00
|
|
|
DIALOG_STEP_FTP_WAIT,
|
2016-08-06 06:59:41 +00:00
|
|
|
DIALOG_STEP_FTP,
|
|
|
|
|
2017-01-12 16:45:52 +00:00
|
|
|
DIALOG_STEP_USB_WAIT,
|
|
|
|
DIALOG_STEP_USB,
|
|
|
|
|
2016-09-07 19:56:40 +00:00
|
|
|
DIALOG_STEP_RENAME,
|
2016-08-06 06:59:41 +00:00
|
|
|
DIALOG_STEP_NEW_FOLDER,
|
|
|
|
|
|
|
|
DIALOG_STEP_COPYING,
|
|
|
|
DIALOG_STEP_COPIED,
|
|
|
|
DIALOG_STEP_MOVED,
|
|
|
|
DIALOG_STEP_PASTE,
|
|
|
|
|
|
|
|
DIALOG_STEP_DELETE_QUESTION,
|
|
|
|
DIALOG_STEP_DELETE_CONFIRMED,
|
|
|
|
DIALOG_STEP_DELETING,
|
|
|
|
DIALOG_STEP_DELETED,
|
|
|
|
|
2016-10-27 16:38:21 +00:00
|
|
|
DIALOG_STEP_COMPRESS_NAME,
|
|
|
|
DIALOG_STEP_COMPRESS_LEVEL,
|
2016-10-15 13:03:26 +00:00
|
|
|
DIALOG_STEP_COMPRESSING,
|
|
|
|
DIALOG_STEP_COMPRESSED,
|
|
|
|
|
2016-09-14 09:33:52 +00:00
|
|
|
DIALOG_STEP_EXPORT_QUESTION,
|
|
|
|
DIALOG_STEP_EXPORT_CONFIRMED,
|
|
|
|
DIALOG_STEP_EXPORTING,
|
|
|
|
|
2016-08-06 06:59:41 +00:00
|
|
|
DIALOG_STEP_INSTALL_QUESTION,
|
|
|
|
DIALOG_STEP_INSTALL_CONFIRMED,
|
2017-09-16 09:18:56 +00:00
|
|
|
DIALOG_STEP_INSTALL_CONFIRMED_QR,
|
2016-08-27 17:16:39 +00:00
|
|
|
DIALOG_STEP_INSTALL_WARNING,
|
|
|
|
DIALOG_STEP_INSTALL_WARNING_AGREED,
|
2016-08-06 06:59:41 +00:00
|
|
|
DIALOG_STEP_INSTALLING,
|
|
|
|
DIALOG_STEP_INSTALLED,
|
|
|
|
|
2016-09-04 09:19:11 +00:00
|
|
|
DIALOG_STEP_UPDATE_QUESTION,
|
2016-09-04 10:55:15 +00:00
|
|
|
DIALOG_STEP_DOWNLOADING,
|
2016-09-04 09:19:11 +00:00
|
|
|
DIALOG_STEP_DOWNLOADED,
|
2016-09-04 10:55:15 +00:00
|
|
|
DIALOG_STEP_EXTRACTING,
|
|
|
|
DIALOG_STEP_EXTRACTED,
|
2016-09-06 23:52:33 +00:00
|
|
|
|
|
|
|
DIALOG_STEP_HASH_QUESTION,
|
|
|
|
DIALOG_STEP_HASH_CONFIRMED,
|
|
|
|
DIALOG_STEP_HASHING,
|
2016-10-31 18:35:25 +00:00
|
|
|
|
2016-11-01 15:34:15 +00:00
|
|
|
DIALOG_STEP_SETTINGS_AGREEMENT,
|
2016-10-31 18:35:25 +00:00
|
|
|
DIALOG_STEP_SETTINGS_STRING,
|
2017-09-16 09:18:56 +00:00
|
|
|
|
|
|
|
DIALOG_STEP_QR,
|
|
|
|
DIALOG_STEP_QR_DONE,
|
2017-09-18 08:30:24 +00:00
|
|
|
DIALOG_STEP_QR_WAITING,
|
2017-09-16 09:18:56 +00:00
|
|
|
DIALOG_STEP_QR_CONFIRM,
|
|
|
|
DIALOG_STEP_QR_DOWNLOADING,
|
|
|
|
DIALOG_STEP_QR_DOWNLOADED,
|
2017-09-18 08:30:24 +00:00
|
|
|
DIALOG_STEP_QR_DOWNLOADED_VPK,
|
2017-09-16 09:18:56 +00:00
|
|
|
DIALOG_STEP_QR_OPEN_WEBSITE,
|
|
|
|
DIALOG_STEP_QR_SHOW_CONTENTS,
|
2016-08-06 06:59:41 +00:00
|
|
|
};
|
|
|
|
|
2017-02-13 20:07:09 +00:00
|
|
|
extern FileList file_list, mark_list, copy_list, install_list;
|
|
|
|
|
|
|
|
extern char cur_file[MAX_PATH_LENGTH];
|
|
|
|
extern char archive_copy_path[MAX_PATH_LENGTH];
|
|
|
|
extern char archive_path[MAX_PATH_LENGTH];
|
|
|
|
|
|
|
|
extern int base_pos, rel_pos;
|
|
|
|
extern int sort_mode, copy_mode, file_type;
|
|
|
|
|
2016-08-06 06:59:41 +00:00
|
|
|
extern vita2d_pgf *font;
|
|
|
|
extern char font_size_cache[256];
|
|
|
|
|
2016-11-02 18:54:40 +00:00
|
|
|
extern VitaShellConfig vitashell_config;
|
|
|
|
|
2016-08-06 06:59:41 +00:00
|
|
|
extern int SCE_CTRL_ENTER, SCE_CTRL_CANCEL;
|
|
|
|
|
2016-08-27 10:49:03 +00:00
|
|
|
extern int use_custom_config;
|
|
|
|
|
2017-09-16 11:40:19 +00:00
|
|
|
void dirLevelUp();
|
|
|
|
|
2017-02-24 17:42:34 +00:00
|
|
|
int getDialogStep();
|
|
|
|
void setDialogStep(int step);
|
|
|
|
|
2016-08-06 06:59:41 +00:00
|
|
|
void drawScrollBar(int pos, int n);
|
2017-02-12 15:27:43 +00:00
|
|
|
void drawShellInfo(const char *path);
|
2016-08-06 06:59:41 +00:00
|
|
|
|
|
|
|
int isInArchive();
|
2017-01-04 14:58:55 +00:00
|
|
|
enum FileTypes getArchiveType();
|
2016-08-06 06:59:41 +00:00
|
|
|
|
2017-02-13 20:07:09 +00:00
|
|
|
int refreshFileList();
|
|
|
|
|
2016-09-04 14:41:00 +00:00
|
|
|
void ftpvita_PROM(ftpvita_client_info_t *client);
|
|
|
|
|
2016-08-08 21:31:41 +00:00
|
|
|
#endif
|