Subversion Repositories eduke32

Compare Revisions

Ignore whitespace Rev 7138 → Rev 7137

/source/libxmp-lite/include/libxmp-lite/xmp.h
322,10 → 322,8
 
EXPORT xmp_context xmp_create_context (void);
EXPORT void xmp_free_context (xmp_context);
#ifdef EDUKE32_DISABLED
EXPORT int xmp_test_module (char *, struct xmp_test_info *);
EXPORT int xmp_load_module (xmp_context, char *);
#endif
EXPORT void xmp_scan_module (xmp_context);
EXPORT void xmp_release_module (xmp_context);
EXPORT int xmp_start_player (xmp_context, int, int);
348,9 → 346,7
EXPORT int xmp_get_player (xmp_context, int);
EXPORT int xmp_set_instrument_path (xmp_context, char *);
EXPORT int xmp_load_module_from_memory (xmp_context, void *, long);
#ifdef EDUKE32_DISABLED
EXPORT int xmp_load_module_from_file (xmp_context, void *, long);
#endif
 
/* External sample mixer API */
EXPORT int xmp_start_smix (xmp_context, int, int);
358,9 → 354,7
EXPORT int xmp_smix_play_instrument(xmp_context, int, int, int, int);
EXPORT int xmp_smix_play_sample (xmp_context, int, int, int, int);
EXPORT int xmp_smix_channel_pan (xmp_context, int, int);
#ifdef EDUKE32_DISABLED
EXPORT int xmp_smix_load_sample (xmp_context, int, char *);
#endif
EXPORT int xmp_smix_release_sample (xmp_context, int);
 
#ifdef __cplusplus
/source/libxmp-lite/src/common.h
415,7 → 415,6
int libxmp_get_sequence (struct context_data *, int);
int libxmp_set_player_mode (struct context_data *);
 
#ifdef EDUKE32_DISABLED
int8 read8s (FILE *, int *err);
uint8 read8 (FILE *, int *err);
uint16 read16l (FILE *, int *err);
432,7 → 431,6
void write32l (FILE *, uint32);
void write32b (FILE *, uint32);
int move_data (FILE *, FILE *, int);
#endif
 
uint16 readmem16l (const uint8 *);
uint16 readmem16b (const uint8 *);
/source/libxmp-lite/src/dataio.c
34,7 → 34,6
} while (0)
 
 
#ifdef EDUKE32_DISABLED
uint8 read8(FILE *f, int *err)
{
int a;
156,7 → 155,6
set_error(ferror(f) ? errno : EOF);
return 0xffffffff;
}
#endif
 
uint16 readmem16l(const uint8 *m)
{
/source/libxmp-lite/src/hio.c
28,7 → 28,6
#include "hio.h"
#include "mdataio.h"
 
#ifdef EDUKE32_DISABLED
static long get_size(FILE *f)
{
long size, pos;
47,17 → 46,13
return pos;
}
}
#endif
 
int8 hio_read8s(HIO_HANDLE *h)
{
#ifdef EDUKE32_DISABLED
int err;
#endif
int8 ret = 0;
 
switch (HIO_HANDLE_TYPE(h)) {
#ifdef EDUKE32_DISABLED
case HIO_HANDLE_TYPE_FILE:
ret = read8s(h->handle.file, &err);
if (err != 0) {
64,7 → 59,6
h->error = err;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mread8s(h->handle.mem);
break;
75,13 → 69,10
 
uint8 hio_read8(HIO_HANDLE *h)
{
#ifdef EDUKE32_DISABLED
int err;
#endif
uint8 ret = 0;
 
switch (HIO_HANDLE_TYPE(h)) {
#ifdef EDUKE32_DISABLED
case HIO_HANDLE_TYPE_FILE:
ret = read8(h->handle.file, &err);
if (err != 0) {
88,7 → 79,6
h->error = err;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mread8(h->handle.mem);
break;
99,13 → 89,10
 
uint16 hio_read16l(HIO_HANDLE *h)
{
#ifdef EDUKE32_DISABLED
int err;
#endif
uint16 ret = 0;
 
switch (HIO_HANDLE_TYPE(h)) {
#ifdef EDUKE32_DISABLED
case HIO_HANDLE_TYPE_FILE:
ret = read16l(h->handle.file, &err);
if (err != 0) {
112,7 → 99,6
h->error = err;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mread16l(h->handle.mem);
break;
123,13 → 109,10
 
uint16 hio_read16b(HIO_HANDLE *h)
{
#ifdef EDUKE32_DISABLED
int err;
#endif
uint16 ret = 0;
 
switch (HIO_HANDLE_TYPE(h)) {
#ifdef EDUKE32_DISABLED
case HIO_HANDLE_TYPE_FILE:
ret = read16b(h->handle.file, &err);
if (err != 0) {
136,7 → 119,6
h->error = err;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mread16b(h->handle.mem);
break;
147,13 → 129,10
 
uint32 hio_read24l(HIO_HANDLE *h)
{
#ifdef EDUKE32_DISABLED
int err;
#endif
uint32 ret = 0;
 
switch (HIO_HANDLE_TYPE(h)) {
#ifdef EDUKE32_DISABLED
case HIO_HANDLE_TYPE_FILE:
ret = read24l(h->handle.file, &err);
if (err != 0) {
160,7 → 139,6
h->error = err;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mread24l(h->handle.mem);
break;
171,13 → 149,10
 
uint32 hio_read24b(HIO_HANDLE *h)
{
#ifdef EDUKE32_DISABLED
int err;
#endif
uint32 ret = 0;
 
switch (HIO_HANDLE_TYPE(h)) {
#ifdef EDUKE32_DISABLED
case HIO_HANDLE_TYPE_FILE:
ret = read24b(h->handle.file, &err);
if (err != 0) {
184,7 → 159,6
h->error = err;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mread24b(h->handle.mem);
break;
195,13 → 169,10
 
uint32 hio_read32l(HIO_HANDLE *h)
{
#ifdef EDUKE32_DISABLED
int err;
#endif
uint32 ret = 0;
 
switch (HIO_HANDLE_TYPE(h)) {
#ifdef EDUKE32_DISABLED
case HIO_HANDLE_TYPE_FILE:
ret = read32l(h->handle.file, &err);
if (err != 0) {
208,7 → 179,6
h->error = err;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mread32l(h->handle.mem);
break;
219,13 → 189,10
 
uint32 hio_read32b(HIO_HANDLE *h)
{
#ifdef EDUKE32_DISABLED
int err;
#endif
uint32 ret = 0;
 
switch (HIO_HANDLE_TYPE(h)) {
#ifdef EDUKE32_DISABLED
case HIO_HANDLE_TYPE_FILE:
ret = read32b(h->handle.file, &err);
if (err != 0) {
232,7 → 199,6
h->error = err;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mread32b(h->handle.mem);
}
245,7 → 211,6
size_t ret = 0;
 
switch (HIO_HANDLE_TYPE(h)) {
#ifdef EDUKE32_DISABLED
case HIO_HANDLE_TYPE_FILE:
ret = fread(buf, size, num, h->handle.file);
if (ret != num) {
256,7 → 221,6
}
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mread(buf, size, num, h->handle.mem);
if (ret != num) {
273,7 → 237,6
int ret = -1;
 
switch (HIO_HANDLE_TYPE(h)) {
#ifdef EDUKE32_DISABLED
case HIO_HANDLE_TYPE_FILE:
ret = fseek(h->handle.file, offset, whence);
if (ret < 0) {
280,7 → 243,6
h->error = errno;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mseek(h->handle.mem, offset, whence);
if (ret < 0) {
297,7 → 259,6
long ret = -1;
 
switch (HIO_HANDLE_TYPE(h)) {
#ifdef EDUKE32_DISABLED
case HIO_HANDLE_TYPE_FILE:
ret = ftell(h->handle.file);
if (ret < 0) {
304,7 → 265,6
h->error = errno;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mtell(h->handle.mem);
if (ret < 0) {
319,10 → 279,8
int hio_eof(HIO_HANDLE *h)
{
switch (HIO_HANDLE_TYPE(h)) {
#ifdef EDUKE32_DISABLED
case HIO_HANDLE_TYPE_FILE:
return feof(h->handle.file);
#endif
case HIO_HANDLE_TYPE_MEMORY:
return meof(h->handle.mem);
default:
337,7 → 295,6
return error;
}
 
#ifdef EDUKE32_DISABLED
HIO_HANDLE *hio_open(const void *path, const char *mode)
{
HIO_HANDLE *h;
365,7 → 322,6
err:
return NULL;
}
#endif
 
HIO_HANDLE *hio_open_mem(const void *ptr, long size)
{
383,7 → 339,6
return h;
}
 
#ifdef EDUKE32_DISABLED
HIO_HANDLE *hio_open_file(FILE *f)
{
HIO_HANDLE *h;
399,7 → 354,6
 
return h;
}
#endif
 
int hio_close(HIO_HANDLE *h)
{
406,11 → 360,9
int ret;
 
switch (HIO_HANDLE_TYPE(h)) {
#ifdef EDUKE32_DISABLED
case HIO_HANDLE_TYPE_FILE:
ret = fclose(h->handle.file);
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mclose(h->handle.mem);
break;
/source/libxmp-lite/src/hio.h
1,10 → 1,8
#ifndef XMP_HIO_H
#define XMP_HIO_H
 
#ifdef EDUKE32_DISABLED
#include <sys/types.h>
#include <sys/stat.h>
#endif
#include <stddef.h>
#include "memio.h"
 
11,16 → 9,12
#define HIO_HANDLE_TYPE(x) ((x)->type)
 
typedef struct {
#ifdef EDUKE32_DISABLED
#define HIO_HANDLE_TYPE_FILE 0
#endif
#define HIO_HANDLE_TYPE_MEMORY 1
int type;
long size;
union {
#ifdef EDUKE32_DISABLED
FILE *file;
#endif
MFILE *mem;
} handle;
int error;
39,13 → 33,9
long hio_tell (HIO_HANDLE *);
int hio_eof (HIO_HANDLE *);
int hio_error (HIO_HANDLE *);
#ifdef EDUKE32_DISABLED
HIO_HANDLE *hio_open (const void *, const char *);
#endif
HIO_HANDLE *hio_open_mem (const void *, long);
#ifdef EDUKE32_DISABLED
HIO_HANDLE *hio_open_file (FILE *);
#endif
int hio_close (HIO_HANDLE *);
long hio_size (HIO_HANDLE *);
 
/source/libxmp-lite/src/load.c
34,9 → 34,7
#include "format.h"
#include "list.h"
#include "hio.h"
#ifndef LIBXMP_CORE_PLAYER
#include "tempfile.h"
#endif
 
#ifndef LIBXMP_CORE_PLAYER
#if !defined(HAVE_POPEN) && defined(WIN32)
284,7 → 282,6
}
#endif /* LIBXMP_CORE_PLAYER */
 
#ifdef EDUKE32_DISABLED
int xmp_test_module(char *path, struct xmp_test_info *info)
{
HIO_HANDLE *h;
364,7 → 361,6
#endif
return ret;
}
#endif
 
static int load_module(xmp_context opaque, HIO_HANDLE *h)
{
468,7 → 464,6
return -XMP_ERROR_LOAD;
}
 
#ifdef EDUKE32_DISABLED
int xmp_load_module(xmp_context opaque, char *path)
{
struct context_data *ctx = (struct context_data *)opaque;
548,7 → 543,6
return ret;
#endif
}
#endif
 
int xmp_load_module_from_memory(xmp_context opaque, void *mem, long size)
{
579,7 → 573,6
return ret;
}
 
#ifdef EDUKE32_DISABLED
int xmp_load_module_from_file(xmp_context opaque, void *file, long size)
{
struct context_data *ctx = (struct context_data *)opaque;
605,7 → 598,6
 
return ret;
}
#endif
 
void xmp_release_module(xmp_context opaque)
{
/source/libxmp-lite/src/smix.c
172,7 → 172,6
return 0;
}
 
#ifdef EDUKE32_DISABLED
int xmp_smix_load_sample(xmp_context opaque, int num, char *path)
{
struct context_data *ctx = (struct context_data *)opaque;
289,7 → 288,6
err:
return retval;
}
#endif
 
int xmp_smix_release_sample(xmp_context opaque, int num)
{
/source/libxmp-lite/src/tempfile.h
0,0 → 1,7
#ifndef XMP_PLATFORM_H
#define XMP_PLATFORM_H
 
FILE *make_temp_file(char **);
void unlink_temp_file(char *);
 
#endif