Please try to look into getting MAME 2010/2013 to compile on OSX. We can’t figure this one out.
Thanks.
Please try to look into getting MAME 2010/2013 to compile on OSX. We can’t figure this one out.
Thanks.
The only issue I found with .150 is that the -dynamiclib argument never makes it to the linker. It’s assigned to a SHARED variable, but the OSX stanza never adds SHARED to the LDFLAGS list.
I’m short on time and MAME takes forever to compile so I haven’t tested the other versions but it looks like the same issue exists in the Makefile for MAME 2010 too.
Fixed now, thanks for the hint.
Try to see if you have some luck compiling for iOS - I got stuck at compare_exchange32 compiling for iOS, threw an error over “cast from pointer to smaller type INT32 (aka int) loses information”- so I replaced INT32 in the function signature to intptr_t.
Then the next problem is that it should ignore all the x86 defines since we are crosscompiling for iOS/ARM - MAME vanilla has not been set up for this yet it seems (or perhaps we are missing a define).
for the IOS maybe you can try like for android (see mame2010 as not implemented in 2013)
fallback to FORCE_DRC_C_BACKEND = 1 and do 2 pass for building , one for buildtools (with NATIVE=1) and then one for emulator. that what i do :
make -f Makefile.libretro "VRENDER=soft" "NATIVE=1" "PTR64=1" buildtools
make -f Makefile.libretro "VRENDER=soft" "platform=android" emulator -j4
the corresponding section in makefile.libretro :
#Store the buildtools OBJ/build in prec-build dir
ifeq ($(NATIVE),1)
mkdir prec-build
cp -R $(OBJ)/build/* prec-build/
$(RM) -r $(OBJ)/osd
$(RM) -r $(OBJ)/lib/util
$(RM) -r $(OBJ)/libutil.a
$(RM) -r $(OBJ)/libocore.a
endif
...
#Restore host buildtools from prec-build to OBJ/build
ifeq ($(platform), android)
ifeq ($(NATIVE),0)
$(OBJ)/build/file2str:
mkdir -p $(OBJ)/build
cp -R prec-build/file2str $(OBJ)/build
$(OBJ)/build/m68kmake:
cp -R prec-build/m68kmake $(OBJ)/build
$(OBJ)/build/png2bdc:
cp -R prec-build/png2bdc $(OBJ)/build
$(OBJ)/build/makedep:
cp -R prec-build/makelist $(OBJ)/build
$(OBJ)/build/makelist:
cp -R prec-build/makelist $(OBJ)/build
$(OBJ)/build/verinfo:
cp -R prec-build/verinfo $(OBJ)/build
endif
endif
with this, mame2010 ,compiling & wroks fine in android
BTW iv’e done the same for 2013 compiling fine , but hang after at exec (segfault related to ressource pool fct )
@Meancoot
if you have time , could you look in sdl osd port , there are some specifics func for osx. like int osd_get_num_processors(void) , i dont own mac so don’t know if sysonfig works for it or if we have to use host_info instead. same for thread does pthread works ?
I got over this segfault on mame0148 on a cubox (armv7) with that: (but it’s quite compiler dependent…http://www.codeproject.com/Articles/7150/Member-Function-Pointers-and-the-Fastest-Possible )
diff -rupN -x '.git*' -x 'obj*' mame0148/src/emu/delegate.c mame0148dfb/src/emu/delegate.c
--- mame0148/src/emu/delegate.c 2012-10-16 21:33:44.000000000 +0900
+++ mame0148dfb/src/emu/delegate.c 2013-01-15 11:14:16.291873152 +0900
@@ -67,6 +67,15 @@ delegate_mfp::raw_mfp_data delegate_mfp:
delegate_generic_function delegate_mfp::convert_to_generic(delegate_generic_class *&object) const
{
+#ifdef USE_ARM
+ object = reinterpret_cast<delegate_generic_class *>(reinterpret_cast<UINT8 *>(object));
+
+ if (!(m_is_virtual))
+ return reinterpret_cast<delegate_generic_function>(m_function);
+
+ UINT8 *vtable_base = *reinterpret_cast<UINT8 **>(object);
+ return *reinterpret_cast<delegate_generic_function *>(vtable_base + m_function);
+#else
// apply the "this" delta to the object first
object = reinterpret_cast<delegate_generic_class *>(reinterpret_cast<UINT8 *>(object) + m_this_delta);
@@ -77,6 +86,7 @@ delegate_generic_function delegate_mfp::
// otherwise, it is the byte index into the vtable where the actual function lives
UINT8 *vtable_base = *reinterpret_cast<UINT8 **>(object);
return *reinterpret_cast<delegate_generic_function *>(vtable_base + m_function - 1);
+#endif
}
#endif
diff -rupN -x '.git*' -x 'obj*' mame0148/src/emu/delegate.h mame0148dfb/src/emu/delegate.h
--- mame0148/src/emu/delegate.h 2013-01-11 08:32:48.000000000 +0900
+++ mame0148dfb/src/emu/delegate.h 2013-01-15 11:20:33.051947801 +0900
@@ -379,12 +379,20 @@ public:
// default constructor
delegate_mfp()
: m_function(0),
- m_this_delta(0) { }
+#ifdef USE_ARM
+ m_is_virtual(0) { }
+#else
+ m_this_delta(0) { }
+#endif
// copy constructor
delegate_mfp(const delegate_mfp &src)
: m_function(src.m_function),
- m_this_delta(src.m_this_delta) { }
+#ifdef USE_ARM
+ m_is_virtual(src.m_is_virtual) {}
+#else
+ m_this_delta(src.m_this_delta) { }
+#endif
// construct from any member function pointer
template<typename _MemberFunctionType, class _MemberFunctionClass, typename _ReturnType, typename _StaticFunctionType>
@@ -395,7 +403,11 @@ public:
}
// comparison helpers
+#ifdef USE_ARM
+ bool operator==(const delegate_mfp &rhs) const { return (m_function == rhs.m_function && m_is_virtual == rhs.m_is_virtual); }
+#else
bool operator==(const delegate_mfp &rhs) const { return (m_function == rhs.m_function && m_this_delta == rhs.m_this_delta); }
+#endif
bool isnull() const { return (m_function == 0); }
// getters
@@ -416,7 +428,11 @@ private:
FPTR m_function; // first item can be one of two things:
// if even, it's a pointer to the function
// if odd, it's the byte offset into the vtable
+#ifdef USE_ARM
+ int m_is_virtual;
+#else
int m_this_delta; // delta to apply to the 'this' pointer
+#endif
};
#endif
diff -rupN -x '.git*' -x 'obj*' mame0148/src/emu/emualloc.c mame0148dfb/src/emu/emualloc.c
--- mame0148/src/emu/emualloc.c 2013-01-11 08:32:48.000000000 +0900
+++ mame0148dfb/src/emu/emualloc.c 2013-01-15 11:21:42.511961561 +0900
@@ -296,7 +296,11 @@ void resource_pool::add(resource_pool_it
// before, so if we don't find it, check 4 bytes ahead
memory_entry *entry = memory_entry::find(item.m_ptr);
if (entry == NULL)
+#ifdef USE_ARM
+ entry = memory_entry::find(reinterpret_cast<UINT8 *>(item.m_ptr) - 8);
+#else
entry = memory_entry::find(reinterpret_cast<UINT8 *>(item.m_ptr) - sizeof(size_t));
+#endif
assert(entry != NULL);
item.m_id = entry->m_id;
if (LOG_ALLOCS)
diff -rupN -x '.git*' -x 'obj*' mame0148/src/osd/osdcomm.h mame0148dfb/src/osd/osdcomm.h
--- mame0148/src/osd/osdcomm.h 2013-01-11 08:32:48.000000000 +0900
+++ mame0148dfb/src/osd/osdcomm.h 2013-01-15 11:22:49.221974769 +0900
@@ -79,7 +79,11 @@
#define UNEXPECTED(exp) __builtin_expect(!!(exp), 0)
#define EXPECTED(exp) __builtin_expect(!!(exp), 1)
#define RESTRICT __restrict__
+#ifdef USE_ARM
+#define SETJMP_GNUC_PROTECT() (void)__builtin_return_address(0)
+#else
#define SETJMP_GNUC_PROTECT() (void)__builtin_return_address(1)
+#endif
#else
#define ATTR_UNUSED
#define ATTR_NORETURN
@Leny Thanks for the info !!
I ve just tested and things seems to be better . Now no more crash , i can go to the nag screen and only after retroarch just stop to respond to the input but no segfault .
thanks again!
I’ve tested with my old tablet cortexA8 seems to works but not responding after game started. (where 0.139 run fine but slow) . big load so maybe another pb elsewhere , but your patch fix my prior segfault.
E/ActivityManager( 170): ANR in org.retroarch (org.retroarch/android.app.NativeActivity)
E/ActivityManager( 170): Reason: keyDispatchingTimedOut
E/ActivityManager( 170): Load: 3.52 / 2.98 / 1.97
E/ActivityManager( 170): CPU usage from 23266ms to 1170ms ago:
E/ActivityManager( 170): 99% 834/org.retroarch: 99% user + 0% kernel
E/ActivityManager( 170): 0% 170/system_server: 0% user + 0% kernel / faults: 13 minor
Are you able to see the startup screens and continue (typing ‘OK’ or whatever) ?
Yes it’s stop to responding after startupscreen (after type ok)
@Lenny
just little feedback , your patch was fine and solve nicely the 0.150 android port, the ANR i was getting after typing OK was due to a very bad macro ( witch took me lot of time before find it) in osdinline.h , who ( in android) return a negative number in timeslice() for the ran cpu time , so loop indefinitely and cause ANR.
#define divu_64x32(a, b) (a / (UINT64)b)
BTW, i’ve to commit your patch in git as now mame2013 seem playable (but slow) on my old phone .
Well done, glad to hear that 0.150 will be playable on android.