| 1 |
#ifndef DOSBOX_EMU_H |
| 2 |
#define DOSBOX_EMU_H |
| 3 |
|
| 4 |
|
| 5 |
#include "dosbox.h" |
| 6 |
#if defined(_MSC_VER) && (_MSC_VER <= 1500) |
| 7 |
#include <SDL.h> |
| 8 |
#else |
| 9 |
#include <stdint.h> |
| 10 |
#endif |
| 11 |
#include <math.h> |
| 12 |
#include <float.h> |
| 13 |
#include <stdlib.h> |
| 14 |
#include <memory.h> |
| 15 |
|
| 16 |
#if C_DEBUG |
| 17 |
#include <stdio.h> |
| 18 |
#include <stdarg.h> |
| 19 |
#endif |
| 20 |
|
| 21 |
#ifndef M_PI |
| 22 |
#define M_PI 3.14159265358979323846 |
| 23 |
#endif |
| 24 |
|
| 25 |
typedef Bit16s stream_sample_t; |
| 26 |
|
| 27 |
typedef Bit8u u8; |
| 28 |
typedef Bit32u u32; |
| 29 |
|
| 30 |
class device_t; |
| 31 |
struct machine_config; |
| 32 |
|
| 33 |
#define NAME( _ASDF_ ) 0 |
| 34 |
#define BIT( _INPUT_, _BIT_ ) ( ( _INPUT_) >> (_BIT_)) & 1 |
| 35 |
|
| 36 |
#define ATTR_UNUSED |
| 37 |
#define DECLARE_READ8_MEMBER(name) u8 name( int, int) |
| 38 |
#define DECLARE_WRITE8_MEMBER(name) void name( int, int, u8 data) |
| 39 |
#define READ8_MEMBER(name) u8 name( int, int) |
| 40 |
#define WRITE8_MEMBER(name) void name( int offset, int space, u8 data) |
| 41 |
|
| 42 |
#define DECLARE_DEVICE_TYPE(Type, Class) \ |
| 43 |
extern const device_type Type; \ |
| 44 |
class Class; |
| 45 |
|
| 46 |
#define DEFINE_DEVICE_TYPE(Type, Class, ShortName, FullName) \ |
| 47 |
const device_type Type = 0; |
| 48 |
|
| 49 |
|
| 50 |
class device_sound_interface { |
| 51 |
public: |
| 52 |
struct sound_stream { |
| 53 |
void update() { |
| 54 |
} |
| 55 |
}; |
| 56 |
sound_stream temp; |
| 57 |
|
| 58 |
sound_stream* stream_alloc(int whatever, int channels, int size) { |
| 59 |
return &temp; |
| 60 |
}; |
| 61 |
|
| 62 |
|
| 63 |
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) = 0; |
| 64 |
|
| 65 |
device_sound_interface(const machine_config &mconfig, device_t& _device) { |
| 66 |
} |
| 67 |
|
| 68 |
}; |
| 69 |
|
| 70 |
struct attotime { |
| 71 |
int whatever; |
| 72 |
|
| 73 |
static attotime from_hz(int hz) { |
| 74 |
return attotime(); |
| 75 |
} |
| 76 |
}; |
| 77 |
|
| 78 |
struct machine_config { |
| 79 |
}; |
| 80 |
|
| 81 |
typedef int device_type; |
| 82 |
|
| 83 |
class device_t { |
| 84 |
u32 clockRate; |
| 85 |
public: |
| 86 |
struct machine_t { |
| 87 |
int describe_context() const { |
| 88 |
return 0; |
| 89 |
} |
| 90 |
}; |
| 91 |
|
| 92 |
machine_t machine() const { |
| 93 |
return machine_t(); |
| 94 |
} |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
u32 clock() const { |
| 99 |
return clockRate; |
| 100 |
} |
| 101 |
|
| 102 |
void logerror(const char* msg, ...) { |
| 103 |
} |
| 104 |
|
| 105 |
static int tag() { |
| 106 |
return 0; |
| 107 |
} |
| 108 |
|
| 109 |
virtual void device_start() { |
| 110 |
} |
| 111 |
|
| 112 |
void save_item(int wtf, int blah= 0) { |
| 113 |
} |
| 114 |
|
| 115 |
device_t(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 _clock) : clockRate( _clock ) { |
| 116 |
} |
| 117 |
|
| 118 |
}; |
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
static void auto_free(const device_t::machine_t& machine, void * buffer) { |
| 123 |
free(buffer); |
| 124 |
} |
| 125 |
|
| 126 |
#define auto_alloc_array_clear(m, t, c) calloc(c, sizeof(t) ) |
| 127 |
#define auto_alloc_clear(m, t) static_cast<t*>( calloc(1, sizeof(t) ) ) |
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
#endif |