-
Notifications
You must be signed in to change notification settings - Fork 225
/
utils.h
107 lines (80 loc) · 2.74 KB
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
VitaShell
Copyright (C) 2015-2018, TheFloW
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 __UTILS_H__
#define __UTILS_H__
#include "main.h"
#define ALIGN_CENTER(a, b) (((a) - (b)) / 2)
#define ALIGN_RIGHT(x, w) ((x) - (w))
#define ANALOG_CENTER 128
#define ANALOG_THRESHOLD 64
#define ANALOG_SENSITIVITY 16
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
};
typedef uint8_t Pad[PAD_N_BUTTONS];
extern SceCtrlData pad;
extern Pad old_pad, current_pad, pressed_pad, released_pad, hold_pad, hold2_pad;
extern Pad hold_count, hold2_count;
float easeOut(float x0, float x1, float a, float b);
void startDrawing(vita2d_texture *bg);
void endDrawing();
void closeWaitDialog();
void errorDialog(int error);
void infoDialog(const char *msg, ...);
int checkMemoryCardFreeSpace(const char *path, uint64_t size);
void initPowerTickThread();
void powerLock();
void powerUnlock();
void setEnterButton(int circle);
void readPad();
int holdButtons(SceCtrlData *pad, uint32_t buttons, uint64_t time);
int hasEndSlash(const char *path);
int removeEndSlash(char *path);
int addEndSlash(char *path);
void getSizeString(char string[16], uint64_t size);
void convertUtcToLocalTime(SceDateTime *time_local, SceDateTime *time_utc);
void convertLocalTimeToUtc(SceDateTime *time_utc, SceDateTime *time_local);
void getDateString(char string[24], int date_format, SceDateTime *time);
void getTimeString(char string[16], int time_format, SceDateTime *time);
int debugPrintf(const char *text, ...);
int launchAppByUriExit(const char *titleid);
char *strcasestr(const char *haystack, const char *needle);
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);
void remount(int id);
#endif