2016-08-06 06:59:41 +00:00
|
|
|
/*
|
|
|
|
VitaShell
|
|
|
|
Copyright (C) 2015-2016, 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_LEFT(x, w) (x - w)
|
|
|
|
|
|
|
|
#define ANALOG_CENTER 128
|
|
|
|
#define ANALOG_THRESHOLD 64
|
|
|
|
#define ANALOG_SENSITIVITY 16
|
|
|
|
|
|
|
|
enum {
|
|
|
|
SCE_CTRL_RIGHT_ANALOG_UP = 0x0020000,
|
|
|
|
SCE_CTRL_RIGHT_ANALOG_RIGHT = 0x0040000,
|
|
|
|
SCE_CTRL_RIGHT_ANALOG_DOWN = 0x0080000,
|
|
|
|
SCE_CTRL_RIGHT_ANALOG_LEFT = 0x0100000,
|
|
|
|
|
|
|
|
SCE_CTRL_LEFT_ANALOG_UP = 0x0200000,
|
|
|
|
SCE_CTRL_LEFT_ANALOG_RIGHT = 0x0400000,
|
|
|
|
SCE_CTRL_LEFT_ANALOG_DOWN = 0x0800000,
|
|
|
|
SCE_CTRL_LEFT_ANALOG_LEFT = 0x1000000,
|
|
|
|
/*
|
|
|
|
SCE_CTRL_ENTER = 0x2000000,
|
|
|
|
SCE_CTRL_CANCEL = 0x4000000,
|
|
|
|
*/
|
|
|
|
};
|
|
|
|
|
|
|
|
extern SceCtrlData pad;
|
|
|
|
extern uint32_t old_buttons, current_buttons, pressed_buttons, hold_buttons, hold2_buttons, released_buttons;
|
|
|
|
|
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);
|
|
|
|
void infoDialog(char *msg, ...);
|
|
|
|
|
2016-09-12 20:34:03 +00:00
|
|
|
int checkMemoryCardFreeSpace(uint64_t size);
|
|
|
|
|
2016-08-23 15:38:31 +00:00
|
|
|
void initPowerTickThread();
|
|
|
|
void powerLock();
|
|
|
|
void powerUnlock();
|
2016-08-06 06:59:41 +00:00
|
|
|
|
|
|
|
void readPad();
|
|
|
|
int holdButtons(SceCtrlData *pad, uint32_t buttons, uint64_t time);
|
|
|
|
|
2016-09-06 19:57:04 +00:00
|
|
|
int hasEndSlash(char *path);
|
2016-08-06 06:59:41 +00:00
|
|
|
int removeEndSlash(char *path);
|
|
|
|
int addEndSlash(char *path);
|
|
|
|
|
|
|
|
void getSizeString(char *string, uint64_t size);
|
2016-08-23 12:50:39 +00:00
|
|
|
void getDateString(char *string, int date_format, SceDateTime *time);
|
|
|
|
void getTimeString(char *string, int time_format, SceDateTime *time);
|
2016-08-06 06:59:41 +00:00
|
|
|
|
2016-08-28 14:36:27 +00:00
|
|
|
int randomNumber(int low, int high);
|
|
|
|
|
2016-08-06 06:59:41 +00:00
|
|
|
int debugPrintf(char *text, ...);
|
|
|
|
|
2016-09-04 10:55:15 +00:00
|
|
|
int launchAppByUriExit(char *titleid);
|
|
|
|
|
2016-09-10 11:28:25 +00:00
|
|
|
char *strcasestr(const char *haystack, const char *needle);
|
|
|
|
|
2016-08-06 06:59:41 +00:00
|
|
|
#endif
|