Skip to content

Commit

Permalink
DOS/DJGPP buildfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Brad Parker committed Jan 20, 2017
1 parent e6c4327 commit 1d3e1a6
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 8 deletions.
6 changes: 4 additions & 2 deletions command.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@
#endif

#ifdef HAVE_COMMAND
#include <net/net_compat.h>
#include <net/net_socket.h>
#ifdef HAVE_NETWORKING
#include <net/net_compat.h>
#include <net/net_socket.h>
#endif
#include <string/stdstring.h>
#endif

Expand Down
4 changes: 2 additions & 2 deletions input/connect/joypad_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ joypad_connection_t *pad_connection_init(unsigned pads);
void pad_connection_destroy(joypad_connection_t *joyconn);

void pad_connection_pad_deinit(joypad_connection_t *joyconn,
unsigned idx);
uint32_t idx);

void pad_connection_packet(joypad_connection_t *joyconn,
unsigned idx, uint8_t* data, uint32_t length);
uint32_t idx, uint8_t* data, uint32_t length);

uint64_t pad_connection_get_buttons(joypad_connection_t *joyconn,
unsigned idx);
Expand Down
4 changes: 2 additions & 2 deletions libretro-common/features/features_cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#endif
#elif defined(_XBOX360)
#include <PPCIntrinsics.h>
#elif defined(_POSIX_MONOTONIC_CLOCK) || defined(ANDROID) || defined(__QNX__)
#elif defined(_POSIX_MONOTONIC_CLOCK) || defined(ANDROID) || defined(__QNX__) || defined(DJGPP)
/* POSIX_MONOTONIC_CLOCK is not being defined in Android headers despite support being present. */
#include <time.h>
#endif
Expand Down Expand Up @@ -215,7 +215,7 @@ retro_time_t cpu_features_get_time_usec(void)
return tv.tv_sec * INT64_C(1000000) + (tv.tv_nsec + 500) / 1000;
#elif defined(EMSCRIPTEN)
return emscripten_get_now() * 1000;
#elif defined(__mips__)
#elif defined(__mips__) || defined(DJGPP)
struct timeval tv;
gettimeofday(&tv,NULL);
return (1000000 * tv.tv_sec + tv.tv_usec);
Expand Down
4 changes: 2 additions & 2 deletions libretro-common/include/math/float_minmax.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static INLINE float float_min(float a, float b)
#ifdef __SSE2__
_mm_store_ss( &a, _mm_min_ss(_mm_set_ss(a),_mm_set_ss(b)) );
return a;
#elif defined(__STDC_C99__) || defined(__STDC_C11__)
#elif !defined(DJGPP) && (defined(__STDC_C99__) || defined(__STDC_C11__))
return fminf(a, b);
#else
return MIN(a, b);
Expand All @@ -51,7 +51,7 @@ static INLINE float float_max(float a, float b)
#ifdef __SSE2__
_mm_store_ss( &a, _mm_max_ss(_mm_set_ss(a),_mm_set_ss(b)) );
return a;
#elif defined(__STDC_C99__) || defined(__STDC_C11__)
#elif !defined(DJGPP) && (defined(__STDC_C99__) || defined(__STDC_C11__))
return fmaxf(a, b);
#else
return MAX(a, b);
Expand Down
20 changes: 20 additions & 0 deletions libretro-common/include/retro_miscellaneous.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,26 @@
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#define RARCH_SCALE_BASE 256

#ifdef DJGPP
#define timespec timeval
#define tv_nsec tv_usec
#include <unistd.h>

extern int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);

static int nanosleepDOS(const struct timespec *rqtp, struct timespec *rmtp)
{
usleep(1000000 * rqtp->tv_sec + rqtp->tv_nsec / 1000);

if (rmtp)
rmtp->tv_sec = rmtp->tv_nsec=0;

return 0;
}

#define nanosleep nanosleepDOS
#endif

/**
* retro_sleep:
* @msec : amount in milliseconds to sleep
Expand Down
5 changes: 5 additions & 0 deletions qb/config.libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ else
add_define_make MAN_DIR "${PREFIX}/share/man"
fi

if [ "$OS" = 'DOS' ]; then
HAVE_SHADERPIPELINE=no
HAVE_LANGEXTRA=no
fi

if [ "$OS" = 'Win32' ]; then
HAVE_THREADS=yes
HAVE_THREAD_STORAGE=yes
Expand Down
1 change: 1 addition & 0 deletions qb/qb.system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
if [ -n "$CROSS_COMPILE" ]; then
case "$CROSS_COMPILE" in
*'-mingw32'*) OS='Win32';;
*'-msdosdjgpp'*) OS='DOS';;
*);;
esac
fi
Expand Down

0 comments on commit 1d3e1a6

Please sign in to comment.