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 <frankhwei536@gmail.com>2016-11-24 16:23:09 -0500
commit56c9984511f016eab7e1278ba9e40d88bb59a162 (patch)
tree1bfa6d3aeb3bf2a6ffec71387ac073cd0b8b2a51 /apps/plugins/puzzles/rbcompat.h
parent29648f817677b84c03c2bcfe89eb8cf53653e7db (diff)
downloadrockbox-puzzles.zip
rockbox-puzzles.tar.gz
rockbox-puzzles.tar.bz2
rockbox-puzzles.tar.xz
[WIP] Port of Simon Tatham's Puzzle Collectionpuzzles
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. The following games are at least partially broken for various reasons: Cube: crash with certain settings Galaxies: crash Inertia: crash Keen: input issues Loopy: weird stuff happens Map: crash on input Mines: weird stuff happens on target Palisade: input issues Signpost: crash on input Solo: input issues Towers: input and drawing issues Train Tracks: drawing issues Twiddle: weird animation on target Undead: input and drawing issues Unequal: input and drawing issues Untangle: input issues All in all, about 40% of the games are at least partially broken. Change-Id: I7c69b6860ab115f973c8d76799502e9bb3d52368
Diffstat (limited to 'apps/plugins/puzzles/rbcompat.h')
-rw-r--r--apps/plugins/puzzles/rbcompat.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/apps/plugins/puzzles/rbcompat.h b/apps/plugins/puzzles/rbcompat.h
new file mode 100644
index 0000000..c733659
--- /dev/null
+++ b/apps/plugins/puzzles/rbcompat.h
@@ -0,0 +1,64 @@
+#include "plugin.h"
+#include "rbassert.h"
+
+int sprintf_wrapper(char *str, const char *fmt, ...);
+char *getenv_wrapper(const char *c);
+int puts_wrapper(const char *s);
+double sin_wrapper(double rads);
+double cos_wrapper(double rads);
+int vsprintf_wrapper(char *s, const char *fmt, va_list ap);
+double fabs_wrapper(double n);
+double floor_wrapper(double n);
+
+double atan_wrapper(double x);
+double atan2_wrapper(double y, double x);
+double sqrt_wrapper(double x);
+long strtol_wrapper(const char *nptr, char **endptr, int base);
+int64_t strtoq_wrapper(const char *nptr, char **endptr, int base);
+uint64_t strtouq_wrapper(const char *nptr, char **endptr, int base);
+double pow_wrapper(double x, double y);
+double scalbn_wrapper (double x, int n);
+double ceil_wrapper(double x);
+
+size_t strspn_wrapper(const char *s1, const char *s2);
+size_t strcspn_wrapper(const char *s1, const char *s2);
+int sscanf_wrapper(const char *ibuf, const char *fmt, ...);
+double atof_wrapper(char *s);
+double acos_wrapper(double x);
+
+
+#define acos acos_wrapper
+#define atan atan_wrapper
+#define atan2 atan2_wrapper
+#define atof atof_wrapper
+#define atoi rb->atoi
+#define atol atoi
+#define calloc tlsf_calloc
+#define ceil ceil_wrapper
+#define cos cos_wrapper
+#define fabs fabs_wrapper
+#define floor floor_wrapper
+#define free tlsf_free
+#define getenv getenv_wrapper
+#define malloc tlsf_malloc
+#define memchr rb->memchr
+#define pow pow_wrapper
+#define printf LOGF
+#define puts puts_wrapper
+#define qsort rb->qsort
+#define realloc tlsf_realloc
+#define sin sin_wrapper
+#define sprintf sprintf_wrapper
+#define sqrt sqrt_wrapper
+#define sscanf sscanf_wrapper
+#define strcat rb->strcat
+#define strchr rb->strchr
+#define strcmp rb->strcmp
+#define strcpy rb->strcpy
+#define strcspn strcspn_wrapper
+#define strlen rb->strlen
+#define strspn strspn_wrapper
+#define strtol strtol_wrapper
+#define strtoq strtoq_wrapper
+#define strtouq strtouq_wrapper
+#define vsprintf vsprintf_wrapper