summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/rbcompat.h
diff options
context:
space:
mode:
authorFranklin Wei <frankhwei536@gmail.com>2016-11-20 15:16:41 -0500
committerFranklin Wei <me@fwei.tk>2016-12-18 18:13:22 +0100
commit1a6a8b52f7aa4e2da6f4c34a0c743c760b8cfd99 (patch)
tree8e7f2d6b0cbdb5d15c13457b2c3e1de69f598440 /apps/plugins/puzzles/rbcompat.h
parent3ee79724f6fb033d50e26ef37b33d3f8cedf0c5b (diff)
downloadrockbox-1a6a8b52f7aa4e2da6f4c34a0c743c760b8cfd99.tar.gz
rockbox-1a6a8b52f7aa4e2da6f4c34a0c743c760b8cfd99.zip
Port of Simon Tatham's Puzzle Collection
Original revision: 5123b1bf68777ffa86e651f178046b26a87cf2d9 MIT Licensed. Some games still crash and others are unplayable due to issues with controls. Still need a "real" polygon filling algorithm. Currently builds one plugin per puzzle (about 40 in total, around 100K each on ARM), but can easily be made to build a single monolithic overlay (800K or so on ARM). The following games are at least partially broken for various reasons, and have been disabled on this commit: Cube: failed assertion with "Icosahedron" setting Keen: input issues Mines: weird stuff happens on target Palisade: input issues Solo: input issues, occasional crash on target Towers: input issues Undead: input issues Unequal: input and drawing issues (concave polys) Untangle: input issues Features left to do: - In-game help system - Figure out the weird bugs Change-Id: I7c69b6860ab115f973c8d76799502e9bb3d52368
Diffstat (limited to 'apps/plugins/puzzles/rbcompat.h')
-rw-r--r--apps/plugins/puzzles/rbcompat.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/apps/plugins/puzzles/rbcompat.h b/apps/plugins/puzzles/rbcompat.h
new file mode 100644
index 0000000000..148aaef073
--- /dev/null
+++ b/apps/plugins/puzzles/rbcompat.h
@@ -0,0 +1,62 @@
1#include "plugin.h"
2#include "rbassert.h"
3
4int sprintf_wrapper(char *str, const char *fmt, ...);
5char *getenv_wrapper(const char *c);
6int puts_wrapper(const char *s);
7double sin_wrapper(double rads);
8double cos_wrapper(double rads);
9int vsprintf_wrapper(char *s, const char *fmt, va_list ap);
10float fabs_wrapper(float n);
11float floor_wrapper(float n);
12
13float atan_wrapper(float x);
14float atan2_wrapper(float y, float x);
15float sqrt_wrapper(float x);
16long strtol_wrapper(const char *nptr, char **endptr, int base);
17int64_t strtoq_wrapper(const char *nptr, char **endptr, int base);
18uint64_t strtouq_wrapper(const char *nptr, char **endptr, int base);
19float pow_wrapper(float x, float y);
20float ceil_wrapper(float x);
21
22size_t strspn_wrapper(const char *s1, const char *s2);
23size_t strcspn_wrapper(const char *s1, const char *s2);
24int sscanf_wrapper(const char *ibuf, const char *fmt, ...);
25double atof_wrapper(const char *s);
26double acos_wrapper(double x);
27
28#define acos acos_wrapper
29#define atan atan_wrapper
30#define atan2 atan2_wrapper
31#define atof atof_wrapper
32#define atoi rb->atoi
33#define atol atoi
34#define calloc tlsf_calloc
35#define ceil ceil_wrapper
36#define cos cos_wrapper
37#define fabs fabs_wrapper
38#define floor floor_wrapper
39#define free tlsf_free
40#define getenv getenv_wrapper
41#define malloc tlsf_malloc
42#define memchr rb->memchr
43#define pow pow_wrapper
44#define printf LOGF
45#define puts puts_wrapper
46#define qsort rb->qsort
47#define realloc tlsf_realloc
48#define sin sin_wrapper
49#define sprintf sprintf_wrapper
50#define sqrt sqrt_wrapper
51#define sscanf sscanf_wrapper
52#define strcat rb->strcat
53#define strchr rb->strchr
54#define strcmp rb->strcmp
55#define strcpy rb->strcpy
56#define strcspn strcspn_wrapper
57#define strlen rb->strlen
58#define strspn strspn_wrapper
59#define strtol strtol_wrapper
60#define strtoq strtoq_wrapper
61#define strtouq strtouq_wrapper
62#define vsprintf vsprintf_wrapper