Code: Select all
Index: macros.mac
===================================================================
--- macros.mac (revision 3183)
+++ macros.mac (working copy)
@@ -63,3 +63,6 @@
%macro ALIGN16 0
times ($$-$) & 1Fh nop ; Long word alignment
%endmacro
+
+; Ensure data section precedes bss if any
+section .data
nasm's outmacho seems to care about the order the sections are presented to it, so we need this to ensure a section for data is created before the bss if it exists.
Code: Select all
Index: configure.in
===================================================================
--- configure.in (revision 3183)
+++ configure.in (working copy)
@@ -47,10 +47,10 @@
NFLAGS="$NFLAGS -D__BSDSDL__ -f elf -DELF"
;;
*-*-darwin* )
- CFLAGS="$CFLAGS -D__MACOSX__ -arch i386 -mdynamic-no-pic"
+ CFLAGS="$CFLAGS -D__MACOSX__ -arch i386 -mstackrealign"
NFLAGS="$NFLAGS -D__MACOSX__ -f macho"
MMLIB_FILES="$MMLIB_FILES \$(MMLIBDIR)/osx.o"
- LDFLAGS="$LDFLAGS -framework Carbon -framework IOKit -mdynamic-no-pic"
+ LDFLAGS="$LDFLAGS -framework Carbon -framework IOKit"
;;
*-*-cygwin* | *-*-*ming*)
NFLAGS="$NFLAGS -f win32"
@@ -159,10 +159,10 @@
AC_MSG_CHECKING(if you want crazy optimizations)
AC_MSG_RESULT($release)
if test x$release = xyes; then
- CFLAGS="$CFLAGS -O3 -fomit-frame-pointer -fprefetch-loop-arrays -fforce-addr -s"
+ CFLAGS="$CFLAGS -O3 -fomit-frame-pointer -fprefetch-loop-arrays -fforce-addr"
NFLAGS="$NFLAGS -O99999999"
else
- CFLAGS="$CFLAGS -O3 -fomit-frame-pointer -s"
+ CFLAGS="$CFLAGS -O3 -fomit-frame-pointer"
NFLAGS="$NFLAGS -O1"
fi
mdynamic-no-pic doesn't appear to do anything useful so get rid of it for now. mstackrealign is needed because zsnes uses 4 byte aligned stacks, but Mac OS X requires 16 byte aligned stacks. Remove -s from CFLAGS as g++ under OS X has problems with this. I think a strip at the end of the build would be the replacement for this.
Code: Select all
Index: linux/sdllink.c
===================================================================
--- linux/sdllink.c (revision 3183)
+++ linux/sdllink.c (working copy)
@@ -105,6 +105,7 @@
extern int CurKeyPos;
extern int CurKeyReadPos;
extern int KeyBuffer[16];
+int sdl_keysym_to_pc_scancode(int sym);
/* MOUSE INPUT */
static float MouseMinX = 0;
@@ -168,6 +169,16 @@
extern void gl_clearwin(void);
#endif
+int getchar_help()
+{
+ return getchar();
+}
+
+void putchar_help(int c)
+{
+ putchar(c);
+}
+
static void adjustMouseXScale(void)
{
MouseXScale = (MouseMaxX - MouseMinX) / ((float) WindowWidth);
Under Mac OS X the scancodes are different to the standard PC ordering. Therefore a function is needed to translate from the OS-independent SDL keysyms to PC scancode values. sdl_keysym_to_pc_scancode() does this.
The wrappers for putchar and getchar are needed because for some reason ld complains about external relocation symbols in read-only segments. The symbols it complains about are these two. Anyway, you were the one who introduced a wrapper for malloc for exactly this reason.
Code: Select all
@@ -202,20 +213,18 @@
numlockptr = 1;
else
numlockptr = 0;
- if (event.key.keysym.scancode - 8 >= 0)
- {
- //if (pressed[event.key.keysym.scancode - 8] != 2)
- pressed[event.key.keysym.scancode - 8] = 1;
- ProcessKeyBuf(event.key.keysym.sym);
- }
+ event.key.keysym.scancode = sdl_keysym_to_pc_scancode(event.key.keysym.sym);
+ //if (pressed[event.key.keysym.scancode] != 2)
+ pressed[event.key.keysym.scancode] = 1;
+ ProcessKeyBuf(event.key.keysym.sym);
break;
case SDL_KEYUP:
if (event.key.keysym.sym == SDLK_LSHIFT ||
event.key.keysym.sym == SDLK_RSHIFT)
shiftptr = 0;
- if (event.key.keysym.scancode - 8 >= 0)
- pressed[event.key.keysym.scancode - 8] = 0;
+ event.key.keysym.scancode = sdl_keysym_to_pc_scancode(event.key.keysym.sym);
+ pressed[event.key.keysym.scancode] = 0;
break;
case SDL_MOUSEMOTION:
Make this translation the default. Maybe you don't like this part so much, in which case feel free to make it Mac OS X specific using the __MAC_OS_X__ define.
Code: Select all
Index: uic.c
===================================================================
--- uic.c (revision 3183)
+++ uic.c (working copy)
@@ -131,7 +131,7 @@
}
void *malloc_ptr;
-unsigned int malloc_size;
+unsigned int malloc_size = 0;
void malloc_help()
{
This fixes the gcc error of being unable to resolve the symbol malloc_size. Don't know why, but why resist?
By the way, with SVN as of revision 3218 the gui config file seems to save and restore properly now, but SuperFX2 seems to have broken. For example, Starfox works, but Yoshi's Island doesn't, whereas it worked on revision 3184. Is it also broken on your end, or have we found a Mac-only issue?