forked from lantus/Cannonball-C
-
Notifications
You must be signed in to change notification settings - Fork 3
/
utils.c
53 lines (43 loc) · 1.16 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
/***************************************************************************
General C++ Helper Functions
Copyright Chris White.
See license.txt for more details.
***************************************************************************/
#include "utils.h"
#include <stdio.h>
#include "setup.h"
#include "engine/outrun.h"
char stringConvert[128];
// Convert value to string
const char* Utils_int_to_string(int i)
{
sprintf(stringConvert, "%d", i);
return stringConvert;
}
// Convert value to string
const char* Utils_char_to_string(char c)
{
sprintf(stringConvert, "%c", c);
return stringConvert;
}
// Convert value to hex string
const char* Utils_int_to_hex_string(int i)
{
sprintf(stringConvert, "%x", i);
return stringConvert;
}
// Convert hex string to unsigned int
uint32_t Utils_from_hex_string(const char* string)
{
uint32_t x;
sscanf(string, "%x", &x);
return x;
}
const char* getScoresFilename()
{
if (Outrun_cannonball_mode == OUTRUN_MODE_ORIGINAL)
{
return !Config_engine.jap ? FILENAME_SCORES : FILENAME_SCORES_JAPAN;
}
return !Config_engine.jap ? FILENAME_CONT : FILENAME_CONT_JAPAN;
}