VitaShell/utils.h

108 lines
2.7 KiB
C
Raw Normal View History

2016-08-06 06:59:41 +00:00
/*
2017-10-13 10:42:36 +00:00
VitaShell
2017-12-30 10:43:37 +00:00
Copyright (C) 2015-2018, TheFloW
2016-08-06 06:59:41 +00:00
2017-10-13 10:42:36 +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.
2016-08-06 06:59:41 +00:00
2017-10-13 10:42:36 +00:00
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.
2016-08-06 06:59:41 +00:00
2017-10-13 10:42:36 +00:00
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
2016-08-06 06:59:41 +00:00
*/
#ifndef __UTILS_H__
#define __UTILS_H__
#include "main.h"
2018-01-25 21:22:07 +00:00
#define ALIGN_CENTER(a, b) (((a) - (b)) / 2)
#define ALIGN_RIGHT(x, w) ((x) - (w))
2016-08-06 06:59:41 +00:00
#define ANALOG_CENTER 128
#define ANALOG_THRESHOLD 64
#define ANALOG_SENSITIVITY 16
2018-01-25 21:22:07 +00:00
enum PadButtons {
PAD_UP,
PAD_DOWN,
PAD_LEFT,
PAD_RIGHT,
PAD_LTRIGGER,
PAD_RTRIGGER,
PAD_TRIANGLE,
PAD_CIRCLE,
PAD_CROSS,
PAD_SQUARE,
PAD_START,
PAD_SELECT,
PAD_ENTER,
PAD_CANCEL,
PAD_LEFT_ANALOG_UP,
PAD_LEFT_ANALOG_DOWN,
PAD_LEFT_ANALOG_LEFT,
PAD_LEFT_ANALOG_RIGHT,
PAD_RIGHT_ANALOG_UP,
PAD_RIGHT_ANALOG_DOWN,
PAD_RIGHT_ANALOG_LEFT,
PAD_RIGHT_ANALOG_RIGHT,
PAD_N_BUTTONS
2016-08-06 06:59:41 +00:00
};
2018-01-25 21:22:07 +00:00
typedef uint8_t Pad[PAD_N_BUTTONS];
2016-08-06 06:59:41 +00:00
extern SceCtrlData pad;
2018-01-25 21:22:07 +00:00
extern Pad old_pad, current_pad, pressed_pad, released_pad, hold_pad, hold2_pad;
2018-01-26 10:36:14 +00:00
extern Pad hold_count, hold2_count;
2016-08-06 06:59:41 +00:00
2017-02-12 17:53:00 +00:00
float easeOut(float x0, float x1, float a, float b);
2016-09-03 20:14:07 +00:00
void startDrawing(vita2d_texture *bg);
2016-08-28 14:36:27 +00:00
void endDrawing();
2016-09-12 20:34:03 +00:00
void closeWaitDialog();
2016-08-06 06:59:41 +00:00
void errorDialog(int error);
2017-02-12 15:27:43 +00:00
void infoDialog(const char *msg, ...);
2016-08-06 06:59:41 +00:00
2017-03-18 09:56:46 +00:00
int checkMemoryCardFreeSpace(const char *path, uint64_t size);
2016-09-12 20:34:03 +00:00
void initPowerTickThread();
void powerLock();
void powerUnlock();
2016-08-06 06:59:41 +00:00
2018-01-25 21:22:07 +00:00
void setEnterButton(int circle);
2016-08-06 06:59:41 +00:00
void readPad();
int holdButtons(SceCtrlData *pad, uint32_t buttons, uint64_t time);
2017-02-12 15:27:43 +00:00
int hasEndSlash(const char *path);
2016-08-06 06:59:41 +00:00
int removeEndSlash(char *path);
int addEndSlash(char *path);
2017-02-25 09:27:52 +00:00
void getSizeString(char string[16], uint64_t size);
2016-11-01 08:53:35 +00:00
void convertUtcToLocalTime(SceDateTime *time_local, SceDateTime *time_utc);
void convertLocalTimeToUtc(SceDateTime *time_utc, SceDateTime *time_local);
2017-02-25 09:27:52 +00:00
void getDateString(char string[24], int date_format, SceDateTime *time);
void getTimeString(char string[16], int time_format, SceDateTime *time);
2016-08-06 06:59:41 +00:00
2017-02-12 15:27:43 +00:00
int debugPrintf(const char *text, ...);
2016-08-28 14:36:27 +00:00
2017-02-12 15:27:43 +00:00
int launchAppByUriExit(const char *titleid);
2016-09-04 10:55:15 +00:00
char *strcasestr(const char *haystack, const char *needle);
2017-02-13 10:06:23 +00:00
int vshIoUmount(int id, int a2, int a3, int a4);
int _vshIoMount(int id, const char *path, int permission, void *buf);
int vshIoMount(int id, const char *path, int permission, int a4, int a5, int a6);
2017-02-26 21:02:29 +00:00
2017-02-24 17:42:34 +00:00
void remount(int id);
2017-01-12 16:45:52 +00:00
#endif