summaryrefslogtreecommitdiffstats
path: root/apps/plugins/mikmod/mikmod_supp.h
blob: fdd9d8f24f08a6da5abd3bbdb95651b8fd4869d1 (plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include <string.h>
#include "plugin.h"
#include "inttypes.h"
#include <tlsf.h>

#ifndef MIKMOD_SUPP_H
#define MIKMOD_SUPP_H

#undef WIN32

#define NO_DEPACKERS  // We don't support these
//#define NO_HQMIXER    // We don't have the oomph

#ifndef NO_MMSUPP_DEFINES
#define snprintf(...)		rb->snprintf(__VA_ARGS__)
#define fdprintf(...)		rb->fdprintf(__VA_ARGS__)
#define vsnprintf(...)		rb->vsnprintf(__VA_ARGS__)

#define srand(a)			rb->srand(a)
#define rand()				rb->rand()
#define qsort(a,b,c,d)		rb->qsort(a,b,c,d)
#define atoi(a)				rb->atoi(a)

#undef strlen
#define strlen(a)           rb->strlen(a)
#undef strcpy
#define strcpy(a,b)         rb->strcpy(a,b)
#undef strcat
#define strcat(a,b)         rb->strcat(a,b)
#undef strncmp
#define strncmp(a,b,c)      rb->strncmp(a,b,c)
#undef strcasecmp
#define strcasecmp(a,b)     rb->strcasecmp(a,b)

#undef open
#define open(a,b)		rb->open(a,b)
#undef lseek
#define lseek(a,b,c)	rb->lseek(a,b,c)
#undef close
#define close(a)		rb->close(a)
#undef read
#define read(a,b,c)		rb->read(a,b,c)
#undef write
#define write(a,b,c)	rb->write(a,b,c)
#undef filesize
#define filesize(a)		rb->filesize(a)
#endif

#define malloc(x)		tlsf_malloc(x)
#define free(x)			tlsf_free(x)
#define realloc(x,y)	tlsf_realloc(x,y)
#define calloc(x,y)		tlsf_calloc(x,y)

#undef strncat
#define strncat mmsupp_strncat
#undef printf
#define printf mmsupp_printf
#undef sprintf
#define sprintf mmsupp_sprintf

#define fprintf(...)

char* mmsupp_strncat(char *s1, const char *s2, size_t n);
void mmsupp_printf(const char *fmt, ...);
int mmsupp_sprintf(char *buf, const char *fmt, ... );

extern const struct plugin_api * rb;

#ifdef SIMULATOR

#define SAMPLE_RATE SAMPR_44  /* Required by Simulator */

#elif ((CONFIG_PLATFORM & PLATFORM_HOSTED) || defined(CPU_MIPS))

#define SAMPLE_RATE SAMPR_44 /* All MIPS and hosted targets are fast */

#elif defined(CPU_ARM)

/* Treat ARMv5+ as fast */
#if (ARM_ARCH >= 5)
#define SAMPLE_RATE SAMPR_44
#else
#define SAMPLE_RATE HW_SAMPR_MIN_GE_22
#endif

#else /* !CPU_ARM */

/* Treat everyone else as slow */
#define SAMPLE_RATE HW_SAMPR_MIN_GE_22

#endif /* !SIMULATOR */

#define BUF_SIZE 4096*8
#define NBUF   2

/* LibMikMod defines */
#define HAVE_SNPRINTF 1

#ifndef INT_MAX
#define INT_MAX 2147483647
#endif

#endif