Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ if(EXISTS "${GAMESWF_ROOT}/base/utility.h")
UTILITY_H_CONTENT "${UTILITY_H_CONTENT}")
file(WRITE "${GAMESWF_ROOT}/base/utility.h" "${UTILITY_H_CONTENT}")
endif()
if(UTILITY_H_CONTENT MATCHES "switch\\(0\\)\\{case 0: case x:;\\}")
string(REPLACE
"#define compiler_assert(x)\tswitch(0){case 0: case x:;}"
"#define compiler_assert(x)\tstatic_assert((x), \"compiler_assert failed\")"
UTILITY_H_CONTENT "${UTILITY_H_CONTENT}")
file(WRITE "${GAMESWF_ROOT}/base/utility.h" "${UTILITY_H_CONTENT}")
endif()
endif()

if(EXISTS "${GAMESWF_ROOT}/gameswf/gameswf_environment.h")
Expand Down Expand Up @@ -214,6 +221,11 @@ target_compile_definitions(gameswf_core PUBLIC

if(MSVC)
target_compile_options(gameswf_core PRIVATE /W3 /O2 /GR-)
target_compile_definitions(gameswf_core PRIVATE
_CRT_SECURE_NO_WARNINGS
_CRT_NONSTDC_NO_WARNINGS
_TIME_T
)
else()
target_compile_options(gameswf_core PRIVATE -fPIC -w -O3 -fno-rtti)
endif()
Expand Down Expand Up @@ -286,6 +298,10 @@ else()
target_compile_options(libretro_flash PRIVATE -fPIC -Wall -Wextra -O3 -fno-exceptions -fno-rtti)
endif()

if(APPLE)
target_link_options(libretro_flash PRIVATE "-Wl,-undefined,dynamic_lookup")
endif()

# Unit Test Executable - Input Subsystem
add_executable(test_input tests/test_input.cpp src/input_manager.cpp)
target_include_directories(test_input PRIVATE include)
Expand Down
211 changes: 109 additions & 102 deletions third_party/gameswf/base/tu_types.h
Original file line number Diff line number Diff line change
@@ -1,102 +1,109 @@
// tu_types.h -- Ignacio CastaÒo, Thatcher Ulrich 2003

// This source code has been donated to the Public Domain. Do
// whatever you want with it.

// Minimal typedefs. Follows SDL conventions; falls back on SDL.h if
// platform isn't obvious.


#ifndef TU_TYPES_H
#define TU_TYPES_H


#include "base/tu_config.h"
#include <stdio.h>


#if defined(__i386__) || defined(_WIN32) || defined(__GNUC__)

// On known little-endian platforms, define this stuff.
#define _TU_LITTLE_ENDIAN_ 1

#ifdef TU_USE_SDL
# ifndef _SDL_stdinc_h
typedef unsigned char Uint8;
typedef signed char Sint8;
typedef unsigned short Uint16;
typedef short Sint16;
typedef unsigned int Uint32;
typedef int Sint32;
# endif
#else
# ifndef Uint8
typedef unsigned char Uint8;
typedef signed char Sint8;
typedef unsigned short Uint16;
typedef short Sint16;
typedef unsigned int Uint32;
typedef int Sint32;
# endif
#endif

#ifndef _MSC_VER
// Probably gcc or something compatible
typedef unsigned long long Uint64;
typedef long long Sint64;
#else // _MSC_VER
typedef unsigned __int64 Uint64;
typedef __int64 Sint64;
#endif // _MSC_VER

#else // not __I386__ and not _WIN32

// On unknown platforms, rely on SDL
#include <SDL.h>

#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define _TU_LITTLE_ENDIAN_ 1
#else
#undef _TU_LITTLE_ENDIAN_
#endif // SDL_BYTEORDER == SDL_LIL_ENDIAN

#endif // not __I366__ and not _WIN32


typedef Uint8 uint8;
typedef Sint8 sint8;
typedef Sint8 int8;
typedef Uint16 uint16;
typedef Sint16 sint16;
typedef Sint16 int16;
typedef Uint32 uint32;
typedef Sint32 sint32;
typedef Sint32 int32;
typedef Uint64 uint64;
typedef Sint64 sint64;
typedef Sint64 int64;

#if TU_USES_FLOAT_AS_COORDINATE_COMPONENT
typedef float coord_component;
#else
typedef Sint16 coord_component;
#endif


// A function to run some validation checks.
#ifdef _WIN32
__declspec(dllexport) bool tu_types_validate();
#else // _WIN32
bool tu_types_validate();
#endif


#endif // TU_TYPES_H


// Local Variables:
// mode: C++
// c-basic-offset: 8
// tab-width: 8
// indent-tabs-mode: t
// End:
// tu_types.h -- Ignacio CastaÒo, Thatcher Ulrich 2003

// This source code has been donated to the Public Domain. Do
// whatever you want with it.

// Minimal typedefs. Follows SDL conventions; falls back on SDL.h if
// platform isn't obvious.


#ifndef TU_TYPES_H
#define TU_TYPES_H


#include "base/tu_config.h"
#include <stdio.h>
#include <time.h>

#if !defined(_MSC_VER) && !defined(_TIME_T_DEFINED) && !defined(__time_t_defined) && !defined(_TIME_T) && !defined(_TIME_T_DECLARED) && !defined(__DEFINED_time_t)
typedef long time_t;
#define _TIME_T_DEFINED
#define _TIME_T
#endif


#if defined(__i386__) || defined(_WIN32) || defined(__GNUC__)

// On known little-endian platforms, define this stuff.
#define _TU_LITTLE_ENDIAN_ 1

#ifdef TU_USE_SDL
# ifndef _SDL_stdinc_h
typedef unsigned char Uint8;
typedef signed char Sint8;
typedef unsigned short Uint16;
typedef short Sint16;
typedef unsigned int Uint32;
typedef int Sint32;
# endif
#else
# ifndef Uint8
typedef unsigned char Uint8;
typedef signed char Sint8;
typedef unsigned short Uint16;
typedef short Sint16;
typedef unsigned int Uint32;
typedef int Sint32;
# endif
#endif

#ifndef _MSC_VER
// Probably gcc or something compatible
typedef unsigned long long Uint64;
typedef long long Sint64;
#else // _MSC_VER
typedef unsigned __int64 Uint64;
typedef __int64 Sint64;
#endif // _MSC_VER

#else // not __I386__ and not _WIN32

// On unknown platforms, rely on SDL
#include <SDL.h>

#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define _TU_LITTLE_ENDIAN_ 1
#else
#undef _TU_LITTLE_ENDIAN_
#endif // SDL_BYTEORDER == SDL_LIL_ENDIAN

#endif // not __I366__ and not _WIN32


typedef Uint8 uint8;
typedef Sint8 sint8;
typedef Sint8 int8;
typedef Uint16 uint16;
typedef Sint16 sint16;
typedef Sint16 int16;
typedef Uint32 uint32;
typedef Sint32 sint32;
typedef Sint32 int32;
typedef Uint64 uint64;
typedef Sint64 sint64;
typedef Sint64 int64;

#if TU_USES_FLOAT_AS_COORDINATE_COMPONENT
typedef float coord_component;
#else
typedef Sint16 coord_component;
#endif


// A function to run some validation checks.
#ifdef _WIN32
__declspec(dllexport) bool tu_types_validate();
#else // _WIN32
bool tu_types_validate();
#endif


#endif // TU_TYPES_H


// Local Variables:
// mode: C++
// c-basic-offset: 8
// tab-width: 8
// indent-tabs-mode: t
// End:
2 changes: 1 addition & 1 deletion third_party/gameswf/base/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

// Compile-time assert. Thanks to Jon Jagger
// (http://www.jaggersoft.com) for this trick.
#define compiler_assert(x) switch(0){case 0: case x:;}
#define compiler_assert(x) static_assert((x), "compiler_assert failed")


//
Expand Down
Loading