Skip to content

Commit

Permalink
macOS fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
emoon committed Feb 3, 2024
1 parent ac5eb84 commit fa91fd2
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 7 deletions.
4 changes: 3 additions & 1 deletion build/Makefile.inc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
CPPFLAGS += -g -DFSUAE -I . -I include -I od-cross -MMD
UNAME_S := $(shell uname -s)

CPPFLAGS += -g -DFSUAE -I . -I include -I od-cross -MMD -std=c++17

OUT=out/$(target)

Expand Down
8 changes: 7 additions & 1 deletion build/Makefile.quaesar
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,13 @@ CPPFLAGS += -DUAE=1
CPPFLAGS += -D_cdecl= -DFILEFLAG_WRITE=1 -DOS_NAME=\"linux\"
CPPFLAGS += -DUSHORT=uint16_t
CPPFLAGS += -DHWND=uint32_t -DHRESULT=uint32_t -DWPARAM=uint16_t -DLPARAM=uint32_t
CPPFLAGS += -DFILEFLAG_DIR=1 -D_ftelli64=ftello64 -D_fseeki64=fseeko64

ifeq ($(UNAME_S),Darwin)
# ftell / fseek are 64-bit on macOS since 10.5
CPPFLAGS += -DFILEFLAG_DIR=1 -D_ftelli64=ftell -D_fseeki64=fseek -D_fseeko64=fseeko -Dfseeko64=fseeko -Dftello64=ftello
else
CPPFLAGS += -DFILEFLAG_DIR=1 -D_ftelli64=ftello64 -D_fseeki64=fseeko64
endif

EXTS = sdl2 libpng
CPPFLAGS += $(foreach ext,$(EXTS), $(shell pkg-config --cflags $(ext)))
Expand Down
8 changes: 5 additions & 3 deletions od-cross/dummy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ struct addrbank;
#include "driveclick.h"
#include "pci_hw.h"
#include "blkdev.h"
#include "uae/time.h"
#include "fsdb.h"

struct PPCD_CB;

Expand Down Expand Up @@ -51,7 +53,7 @@ void vsync_clear() {
UNIMPLEMENTED();
}

int vsync_isdone(long* dt) {
int vsync_isdone(frame_time_t* dt) {
TRACE();
return 1;
}
Expand Down Expand Up @@ -667,7 +669,7 @@ void cpuboard_rethink() {

a_inode* custom_fsdb_lookup_aino_aname(a_inode_struct*, char const*) {
UNIMPLEMENTED();
nullptr;
return nullptr;
}

a_inode* custom_fsdb_lookup_aino_nname(a_inode_struct*, char const*) {
Expand Down Expand Up @@ -1031,7 +1033,7 @@ int my_issamevolume(char const*, char const*, char*) {
return 0;
}

uae_s64 my_lseek(my_openfile_s*, long, int) {
uae_s64 my_lseek(my_openfile_s*, uae_s64, int) {
UNIMPLEMENTED();
return 0;
}
Expand Down
9 changes: 8 additions & 1 deletion od-cross/machdep/maccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,15 @@ STATIC_INLINE void do_put_mem_word(uae_u16 *a, uae_u16 v)

#else

#if defined(__APPLE__)
// Mac OS X / Darwin features
#include <libkern/OSByteOrder.h>
#define bswap_16(x) OSSwapInt16(x)
#define bswap_32(x) OSSwapInt32(x)
#define bswap_64(x) OSSwapInt64(x)
#else
#include <byteswap.h>

#endif

STATIC_INLINE uae_u64 do_get_mem_quad(uae_u64 *a)
{
Expand Down
6 changes: 5 additions & 1 deletion od-cross/sysconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#define DRIVESOUND
//#define GFXFILTER
#if defined(_M_ARM64) || defined(_M_ARM64EC)
#if defined(_M_ARM64) || defined(_M_ARM64EC) || defined(__aarch64__)
#define __arm__
#define MSVC_LONG_DOUBLE
#else
Expand Down Expand Up @@ -590,6 +590,10 @@ typedef long uae_atomic;
#define HAVE_UNISTD_H 1
#endif

#ifdef __APPLE__
#define HAVE_LIBKERN_OSBYTEORDER_H
#endif

/* Define if you have the <utime.h> header file. */
/* #undef HAVE_UTIME_H */

Expand Down
6 changes: 6 additions & 0 deletions od-cross/winuae_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@

#define _tfopen fopen
#define uae_tfopen fopen

#ifdef __APPLE__
#define _ftelli64 ftell
#define _fseeki64 fseek
#else
#define _ftelli64 ftello64
#define _fseeki64 fseeko64
#endif

// convert windows libc names to standard libc function names, and also
// use char functions instead of wchar string functions.
Expand Down

0 comments on commit fa91fd2

Please sign in to comment.