DOSBox-X
|
00001 #ifndef DOSBOX_EMU_H 00002 #define DOSBOX_EMU_H 00003 00004 00005 #include "dosbox.h" 00006 #if defined(_MSC_VER) && (_MSC_VER <= 1500) 00007 #include <SDL.h> 00008 #else 00009 #include <stdint.h> 00010 #endif 00011 #include <math.h> 00012 #include <float.h> 00013 #include <stdlib.h> 00014 #include <memory.h> 00015 00016 #if C_DEBUG 00017 #include <stdio.h> 00018 #include <stdarg.h> 00019 #endif 00020 00021 #ifndef M_PI 00022 #define M_PI 3.14159265358979323846 00023 #endif 00024 00025 typedef Bit16s stream_sample_t; 00026 00027 typedef Bit8u u8; 00028 typedef Bit32u u32; 00029 00030 class device_t; 00031 struct machine_config; 00032 00033 #define NAME( _ASDF_ ) 0 00034 #define BIT( _INPUT_, _BIT_ ) ( ( _INPUT_) >> (_BIT_)) & 1 00035 00036 #define ATTR_UNUSED 00037 #define DECLARE_READ8_MEMBER(name) u8 name( int, int) 00038 #define DECLARE_WRITE8_MEMBER(name) void name( int, int, u8 data) 00039 #define READ8_MEMBER(name) u8 name( int, int) 00040 #define WRITE8_MEMBER(name) void name( int offset, int space, u8 data) 00041 00042 #define DECLARE_DEVICE_TYPE(Type, Class) \ 00043 extern const device_type Type; \ 00044 class Class; 00045 00046 #define DEFINE_DEVICE_TYPE(Type, Class, ShortName, FullName) \ 00047 const device_type Type = 0; 00048 00049 00050 class device_sound_interface { 00051 public: 00052 struct sound_stream { 00053 void update() { 00054 } 00055 }; 00056 sound_stream temp; 00057 00058 sound_stream* stream_alloc(int whatever, int channels, int size) { 00059 (void)whatever; 00060 (void)channels; 00061 (void)size; 00062 return &temp; 00063 }; 00064 00065 00066 virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) = 0; 00067 00068 device_sound_interface(const machine_config &mconfig, device_t& _device) { 00069 (void)mconfig; 00070 (void)_device; 00071 } 00072 00073 }; 00074 00075 struct attotime { 00076 int whatever; 00077 00078 static attotime from_hz(int hz) { 00079 (void)hz; 00080 return attotime(); 00081 } 00082 }; 00083 00084 struct machine_config { 00085 }; 00086 00087 typedef int device_type; 00088 00089 class device_t { 00090 u32 clockRate; 00091 public: 00092 struct machine_t { 00093 int describe_context() const { 00094 return 0; 00095 } 00096 }; 00097 00098 machine_t machine() const { 00099 return machine_t(); 00100 } 00101 00102 //int offset, space; 00103 00104 u32 clock() const { 00105 return clockRate; 00106 } 00107 00108 void logerror(const char* format, ...) { 00109 #if C_DEBUG 00110 char buf[512*2]; 00111 va_list msg; 00112 va_start(msg,format); 00113 vsprintf(buf,format,msg); 00114 va_end(msg); 00115 LOG(LOG_MISC,LOG_NORMAL)("%s",buf); 00116 #endif 00117 } 00118 00119 static int tag() { 00120 return 0; 00121 } 00122 00123 virtual void device_start() { 00124 } 00125 00126 void save_item(int wtf, int blah= 0) { 00127 (void)wtf; 00128 (void)blah; 00129 } 00130 00131 device_t(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 _clock) : clockRate( _clock ) { 00132 (void)mconfig; 00133 (void)type; 00134 (void)tag; 00135 (void)owner; 00136 } 00137 00138 void SaveState( std::ostream& stream ) { 00139 WRITE_POD( &clockRate, clockRate ); 00140 } 00141 void LoadState( std::istream& stream ) { 00142 READ_POD( &clockRate, clockRate ); 00143 } 00144 00145 virtual ~device_t() { 00146 } 00147 }; 00148 00149 00150 00151 #define auto_alloc_array_clear(m, t, c) calloc(c, sizeof(t) ) 00152 #define auto_alloc_clear(m, t) static_cast<t*>( calloc(1, sizeof(t) ) ) 00153 00154 00155 00156 00157 #endif