platform.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* MegaZeux
  2. *
  3. * Copyright (C) 2008 Alan Williams <mralert@gmail.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #ifndef __PLATFORM_H
  20. #define __PLATFORM_H
  21. #include "compat.h"
  22. __M_BEGIN_DECLS
  23. #include "platform_endian.h"
  24. #ifdef CONFIG_SDL
  25. #include "SDL_stdinc.h"
  26. #else // !CONFIG_SDL
  27. #include <inttypes.h>
  28. typedef uint8_t Uint8;
  29. typedef int8_t Sint8;
  30. typedef uint16_t Uint16;
  31. typedef int16_t Sint16;
  32. typedef uint32_t Uint32;
  33. typedef int32_t Sint32;
  34. typedef uint64_t Uint64;
  35. typedef int64_t Sint64;
  36. #if defined(CONFIG_WII) || defined(CONFIG_NDS) || defined(CONFIG_3DS)
  37. int real_main(int argc, char *argv[]);
  38. #define main real_main
  39. #endif // CONFIG_WII || CONFIG_NDS || CONFIG_3DS
  40. #endif // CONFIG_SDL
  41. // Need threads and mutexes for DNS lookups.
  42. // Otherwise only need mutexes for audio, but the Wii port
  43. // uses them for events too
  44. #if defined(CONFIG_AUDIO) || defined(CONFIG_NETWORK) || defined(CONFIG_WII)
  45. #ifdef CONFIG_PTHREAD
  46. #include "thread_pthread.h"
  47. #elif defined(CONFIG_WII)
  48. #include "../arch/wii/thread.h"
  49. #elif defined(CONFIG_3DS)
  50. #include "../arch/3ds/thread.h"
  51. #elif defined(CONFIG_SDL)
  52. #include "thread_sdl.h"
  53. #else
  54. #error Provide a valid thread/mutex implementation for this platform!
  55. #endif
  56. #endif // defined(CONFIG_AUDIO) || defined(CONFIG_NETWORK) || defined(CONFIG_WII)
  57. CORE_LIBSPEC void delay(Uint32 ms);
  58. CORE_LIBSPEC Uint32 get_ticks(void);
  59. CORE_LIBSPEC boolean platform_init(void);
  60. CORE_LIBSPEC void platform_quit(void);
  61. __M_END_DECLS
  62. #endif // __PLATFORM_H