-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathutils.c
61 lines (52 loc) · 1.08 KB
/
utils.c
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
#include "kuro.h"
double myatof(const char* sptr)
{
double temp = 10;
BOOL ispnum = TRUE;
double ans = 0;
if(*sptr=='-') {
ispnum=FALSE;
sptr++;
}
else if(*sptr=='+') {
sptr++;
}
while(*sptr!='\0') {
if(*sptr=='.') {
sptr++;
break;
}
ans = ans * 10 + (*sptr - '0');
sptr++;
}
while(*sptr!='\0') {
ans = ans + (*sptr - '0') / temp;
temp *= 10;
sptr++;
}
if(ispnum)
return ans;
else
return -ans;
}
char * mystrdup(const char * src) {
char * str = (char*)malloc(strlen(src)+1);
strcpy(str,src);
return str;
}
#ifdef ___NDLESS___
static unsigned int* p_contrast = (unsigned int*) 0x900F0020;
void ContrastInc () {
if( is_cx && (*p_contrast)< 225)
(*p_contrast)++;
else if( (!is_cx) && (*p_contrast) < 0xc0 )
(*p_contrast)++;
}
void ContrastDec ()
{
if( is_cx && (*p_contrast)> 1 )
(*p_contrast)--;
else if( (!is_cx) && (*p_contrast) >50 )
(*p_contrast)--;
}
#endif