rockbox/apps/plugins/mikmod/mikmod_supp.h
Aidan MacDonald 3a57f2f721 Add "rbfs" prefix to native filesystem functions
Most of the churn here occurs because 'filesize' is one of
the redefined filesystem functions, but some of the structs
used by the native FS code also include a 'filesize' member
variable which gets renamed by the macro in some but not all
source files.

It's easier to rename 'filesize()' to 'ffilesize()' rather
than try to clean up the macro mess or renaming the struct
members.

There is weirdness with root_realpath() which now breaks on
native builds because it was assumed to be unprefixed there.
dir_get_info() was unprefixed everywhere but this just seems
inconsistent; make it follow the FS_PREFIX() convention too.

Change-Id: Ic3700c6234ea45f32679c1a8429d70fdb8f4088a
2026-09-17 16:22:31 -04:00

83 lines
1.9 KiB
C

#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 strncpy
#define strncpy(a,b,c) rb->strncpy(a,b,c)
#undef strcasecmp
#define strcasecmp(a,b) rb->strcasecmp(a,b)
#undef strstr
#define strstr(a,b) rb->strstr(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 ffilesize
#define ffilesize(a) rb->ffilesize(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;
#define BUF_SIZE 4096*8
#define NBUF 2
/* LibMikMod defines */
#define HAVE_SNPRINTF 1
#ifndef INT_MAX
#define INT_MAX 2147483647
#endif
#endif