Subversion Repositories eduke32

Compare Revisions

Ignore whitespace Rev 7137 → Rev 7138

/source/libxmp-lite/include/libxmp-lite/xmp.h
322,8 → 322,10
 
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);
346,7 → 348,9
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);
354,7 → 358,9
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/tempfile.h
File deleted
/source/libxmp-lite/src/common.h
415,6 → 415,7
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);
431,6 → 432,7
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,6 → 34,7
} while (0)
 
 
#ifdef EDUKE32_DISABLED
uint8 read8(FILE *f, int *err)
{
int a;
155,6 → 156,7
set_error(ferror(f) ? errno : EOF);
return 0xffffffff;
}
#endif
 
uint16 readmem16l(const uint8 *m)
{
/source/libxmp-lite/src/hio.c
28,6 → 28,7
#include "hio.h"
#include "mdataio.h"
 
#ifdef EDUKE32_DISABLED
static long get_size(FILE *f)
{
long size, pos;
46,13 → 47,17
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) {
59,6 → 64,7
h->error = err;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mread8s(h->handle.mem);
break;
69,10 → 75,13
 
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) {
79,6 → 88,7
h->error = err;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mread8(h->handle.mem);
break;
89,10 → 99,13
 
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) {
99,6 → 112,7
h->error = err;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mread16l(h->handle.mem);
break;
109,10 → 123,13
 
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) {
119,6 → 136,7
h->error = err;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mread16b(h->handle.mem);
break;
129,10 → 147,13
 
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) {
139,6 → 160,7
h->error = err;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mread24l(h->handle.mem);
break;
149,10 → 171,13
 
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) {
159,6 → 184,7
h->error = err;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mread24b(h->handle.mem);
break;
169,10 → 195,13
 
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) {
179,6 → 208,7
h->error = err;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mread32l(h->handle.mem);
break;
189,10 → 219,13
 
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) {
199,6 → 232,7
h->error = err;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mread32b(h->handle.mem);
}
211,6 → 245,7
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) {
221,6 → 256,7
}
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mread(buf, size, num, h->handle.mem);
if (ret != num) {
237,6 → 273,7
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) {
243,6 → 280,7
h->error = errno;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mseek(h->handle.mem, offset, whence);
if (ret < 0) {
259,6 → 297,7
long ret = -1;
 
switch (HIO_HANDLE_TYPE(h)) {
#ifdef EDUKE32_DISABLED
case HIO_HANDLE_TYPE_FILE:
ret = ftell(h->handle.file);
if (ret < 0) {
265,6 → 304,7
h->error = errno;
}
break;
#endif
case HIO_HANDLE_TYPE_MEMORY:
ret = mtell(h->handle.mem);
if (ret < 0) {
279,8 → 319,10
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:
295,6 → 337,7
return error;
}
 
#ifdef EDUKE32_DISABLED
HIO_HANDLE *hio_open(const void *path, const char *mode)
{
HIO_HANDLE *h;
322,6 → 365,7
err:
return NULL;
}
#endif
 
HIO_HANDLE *hio_open_mem(const void *ptr, long size)
{
339,6 → 383,7
return h;
}
 
#ifdef EDUKE32_DISABLED
HIO_HANDLE *hio_open_file(FILE *f)
{
HIO_HANDLE *h;
354,6 → 399,7
 
return h;
}
#endif
 
int hio_close(HIO_HANDLE *h)
{
360,9 → 406,11
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,8 → 1,10
#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"
 
9,12 → 11,16
#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;
33,9 → 39,13
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,7 → 34,9
#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)
282,6 → 284,7
}
#endif /* LIBXMP_CORE_PLAYER */
 
#ifdef EDUKE32_DISABLED
int xmp_test_module(char *path, struct xmp_test_info *info)
{
HIO_HANDLE *h;
361,6 → 364,7
#endif
return ret;
}
#endif
 
static int load_module(xmp_context opaque, HIO_HANDLE *h)
{
464,6 → 468,7
return -XMP_ERROR_LOAD;
}
 
#ifdef EDUKE32_DISABLED
int xmp_load_module(xmp_context opaque, char *path)
{
struct context_data *ctx = (struct context_data *)opaque;
543,6 → 548,7
return ret;
#endif
}
#endif
 
int xmp_load_module_from_memory(xmp_context opaque, void *mem, long size)
{
573,6 → 579,7
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;
598,6 → 605,7
 
return ret;
}
#endif
 
void xmp_release_module(xmp_context opaque)
{
/source/libxmp-lite/src/smix.c
172,6 → 172,7
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;
288,6 → 289,7
err:
return retval;
}
#endif
 
int xmp_smix_release_sample(xmp_context opaque, int num)
{