1 #ifndef EXTRA_DEFINES_H
2 #define EXTRA_DEFINES_H
3 
4 /*
5 #ifdef WINDOWS
6 #include <Windows.h>
7 #undef _WIN32
8 #undef WIN32
9 #undef WCHAR
10 #endif
11 */
12 
13 // #include "tchar.h"
14 // rename init_audio to make init_audio available
15 
16 #define init_audio uae_init_audio
17 
18 #include "uae/log.h"
19 
20 // we are using our own main function, not the one from UAE...
21 
22 #define NO_MAIN_IN_MAIN_C
23 
24 #ifndef WINDOWS
25 #define CAN_PRINTF_LONG_LONG
26 #endif
27 
28 // UAE code must use this instead of RAND_MAX, and use uaerand for all
29 // random number generation
30 #define UAE_RAND_MAX 2147483647
31 
32 /*
33 unsigned int uaerand_impl (void);
34 static inline unsigned int uaerand (void) {
35     printf("   >>>>    uaerand    <<<< %s:%d:%s\n",  __BASE_FILE__, __LINE__,
36             __func__);
37     return uaerand_impl();
38 }
39 */
40 
41 #define DEBUG_SYNC
42 //#define DEBUG_SYNC_MEMORY
43 #ifdef DEBUG_SYNC
44 #include <stdio.h>
45 extern FILE *g_fs_uae_sync_debug_file;
46 #define write_sync_log(format, ...) \
47     if (g_fs_uae_sync_debug_file) { \
48         fprintf(g_fs_uae_sync_debug_file, format, __VA_ARGS__); \
49     }
50 #endif
51 
52 // needed to include functions in include/debug.h, which in turn
53 // is needed by code
54 
55 #define ECS_DENISE
56 //#define ENFORCER
57 #define GFXFILTER
58 
59 #define MMU
60 #define MMUEMU /* Aranym 68040 MMU */
61 //#define MULTIDISPLAY 1
62 #define NATMEM_OFFSET natmem_offset
63 #define FULLMMU /* Aranym 68040 MMU */
64 #define SUPPORT_THREADS
65 #define UAE_FILESYS_THREADS
66 //#define UAE_FILESYS_ASYNCHRONOUS
67 //#define USE_SDL
68 
69 #ifdef LINUX
70 #define WITH_SCSI_IOCTL
71 #endif
72 
73 #define XARCADE
74 #define GNU_SOURCE 1
75 
76 #include "uae/limits.h"
77 
78 // needed by serial.cpp
79 #ifdef WINDOWS
80 // FIXME: DUMMY
81 #define O_NDELAY 0
82 #endif
83 
84 // These should be valid on all supported systems, also Windows
85 #define FSDB_DIR_SEPARATOR '/'
86 #define FSDB_DIR_SEPARATOR_S "/"
87 
88 // FIXME: OK?
89 //#define _stat64 stat
90 
91 #ifndef INVALID_SOCKET
92 #define INVALID_SOCKET -1
93 #endif
94 #ifdef WINDOWS
95 typedef uintptr_t SOCKET;
96 #else
97 typedef int SOCKET;
98 #endif
99 
100 typedef unsigned short USHORT;
101 
102 
103 #ifndef DO_NOT_INCLUDE_WINUAE_COMPAT_H
104 // we do not always want to include these, especially not in uae_host.cpp
105 // were we actually need access to some of the underlying function names
106 #include "winuae_compat.h"
107 #endif
108 
109 // Some WinUAE-derived code which must not be used is guarded by _WIN32
110 // defines. The code is fixed so compiling without _WIN32 defined works
111 // when compiling FS-UAE for Windows. FS-UAE code use the WINDOWS define
112 // instead to avoid collision with WinUAE.
113 
114 //#undef _WIN32
115 //#undef WIN32
116 
117 #include "../include/sysdeps.h"
118 
119 #undef ENUMNAME
120 #undef ENUMDECL
121 
122 #include "uae/enum.h"
123 
124 #include "machdep/machdep.h"
125 
126 // some code needs uae_sem_t but does not include thread.h properly
127 // (include/bsdsocket.h)
128 
129 #include "threaddep/thread.h"
130 
131 // FIXME: IMPLEMENT
132 //void _stprintf(wchar_t* buffer, wchar_t* format, ...);
133 
134 extern TCHAR start_path_data[];
135 extern void picasso_reset (void);
136 extern void picasso_handle_hsync (void);
137 extern void init_hz_p96 (void);
138 int GetDriveType(TCHAR* vol);
139 
140 void sleep_millis(int ms);
141 //void install_driver(int flags);
142 
143 extern int uae_start_thread_fast (void *(*f)(void *), void *arg,
144         uae_thread_id *thread);
145 
146 #ifdef WINDOWS
147 
148 #else
149 #endif
150 
151 #define FILEFLAG_WRITE S_IWUSR
152 #define FILEFLAG_READ S_IRUSR
153 #define FILEFLAG_EXECUTE S_IXUSR
154 #define FILEFLAG_DIR S_IFDIR
155 
156 
157 #define Sleep sleep_millis
158 
159 // needed to compile gencpu.cpp as C code (which is needed because
160 // of int to enum conversions (illegal in C++)
161 #ifndef __cplusplus
162 // FIXME:
163 //typedef int bool
164 #define bool int
165 #define true 1
166 #define false 0
167 #endif
168 
169 
170 // -------------------------- windows temp --------------------------
171 // FIXME: THESE ARE HERE IN ORDER TO COMPILE blkdev.cpp
172 #define UAESCSI_CDEMU 0
173 #define UAESCSI_SPTI 1
174 #define UAESCSI_SPTISCAN 2
175 #define UAESCSI_ASPI_FIRST 3
176 #define UAESCSI_ADAPTECASPI 3
177 #define UAESCSI_NEROASPI 4
178 #define UAESCSI_FROGASPI 5
179 
180 #ifndef WINDOWS
181 // just setting DRIVE_CDROM to something here..
182 #define DRIVE_CDROM 0
183 #endif
184 
185 #include <stddef.h>
186 
187 #define __STDC_FORMAT_MACROS
188 #include <inttypes.h>
189 
190 #include "uae/jitconfig.h"
191 
192 #ifndef NORETURN
193 #ifdef __GNUC__
194 #define NORETURN __attribute__((__noreturn__))
195 #else
196 #define NORETURN
197 #endif
198 #endif
199 
200 #ifdef WINDOWS
201 #ifdef __MINGW64_VERSION_MAJOR
202 #define _argc __argc
203 #define _argv __argv
204 #endif
205 extern int _argc;
206 extern char** _argv;
207 #undef main
208 // prevent later imports of SDL to overwrite main
209 #define _SDL_main_h
210 int _uae_main(int argc, char* argv[]);
211 #define main(a, b) WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { \
212     return _uae_main(_argc, _argv); \
213 } \
214 int _uae_main(int argc, char* argv[])
215 #endif
216 
217 #endif // EXTRA_DEFINES_H
218