VitaShell/utils.h

92 lines
2.6 KiB
C
Raw Normal View History

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 __UTILS_H__
#define __UTILS_H__
#include "main.h"
2016-10-30 11:57:36 +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
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;
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
2016-09-12 20:34:03 +00:00
int checkMemoryCardFreeSpace(uint64_t size);
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);
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);
void getSizeString(char *string, 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);
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
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-24 17:42:34 +00:00
void remount(int id);
2017-01-12 16:45:52 +00:00
#endif