[mupen64plus-ui-console] 65/172: Imported Upstream version 1.99.5~hg20110828

Sven Eckelmann ecsv-guest at moszumanska.debian.org
Thu Nov 26 06:07:31 UTC 2015


This is an automated email from the git hooks/post-receive script.

ecsv-guest pushed a commit to branch armhf_test
in repository mupen64plus-ui-console.

commit 00e719215922ac87263a4033d691a5009f7c5a54
Author: Sven Eckelmann <sven at narfation.org>
Date:   Sun Aug 28 18:47:41 2011 +0200

    Imported Upstream version 1.99.5~hg20110828
---
 projects/unix/Makefile | 122 ++++++++++++++++++++++++++-----------------------
 src/cheat.c            |   3 +-
 src/cheat.h            |   2 +-
 src/compare_core.c     |   6 ++-
 src/core_interface.c   |  37 ++++++++++++---
 src/core_interface.h   |   1 +
 src/main.c             |  14 +++++-
 src/version.h          |   8 ++--
 8 files changed, 120 insertions(+), 73 deletions(-)

diff --git a/projects/unix/Makefile b/projects/unix/Makefile
index 0d4e5f6..2c969b5 100644
--- a/projects/unix/Makefile
+++ b/projects/unix/Makefile
@@ -38,6 +38,10 @@ endif
 ifeq ("$(UNAME)","FreeBSD")
   OS = FREEBSD
 endif
+ifeq ("$(UNAME)","OpenBSD")
+  OS = FREEBSD
+  $(warning OS type "$(UNAME)" not officially supported.')
+endif
 ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
   OS = LINUX
 endif
@@ -61,38 +65,39 @@ ifneq ("$(filter pentium i%86,$(HOST_CPU))","")
   CPU := X86
   ARCH_DETECTED := 32BITS
 endif
-# PPC doesn't work yet
-#ifneq ("$(filter ppc powerpc,$(HOST_CPU))","")
-#  CPU := PPC
-#  ARCH_DETECTED := 32BITS
-#endif
-#ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","")
-#  CPU := PPC
-#  ARCH_DETECTED := 64BITS
-#endif
+ifneq ("$(filter ppc powerpc,$(HOST_CPU))","")
+  CPU := PPC
+  ARCH_DETECTED := 32BITS
+  BIG_ENDIAN := 1
+  $(warning Architecture "$(HOST_CPU)" not officially supported.')
+endif
+ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","")
+  CPU := PPC
+  ARCH_DETECTED := 64BITS
+  BIG_ENDIAN := 1
+  $(warning Architecture "$(HOST_CPU)" not officially supported.')
+endif
 ifeq ("$(CPU)","NONE")
   $(error CPU type "$(HOST_CPU)" not supported.  Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
 endif
 
-# base CFLAGS, LIBS, and LDFLAGS
-CFLAGS += -ffast-math -funroll-loops -fexpensive-optimizations -fno-strict-aliasing -I../../src
-LDFLAGS += -lpthread
+# base CFLAGS, LDLIBS, and LDFLAGS
+OPTFLAGS ?= -O3
+CFLAGS += $(OPTFLAGS) -ffast-math -fno-strict-aliasing -pthread -I../../src
+LDLIBS += -pthread
+
+ifeq ($(PIE), 1)
+  CFLAGS += -fPIE
+  LDFLAGS += -fPIE -pie
+endif
 
 # set special flags per-system
 ifeq ($(OS), LINUX)
-  ifeq ($(CPU), X86)
-    ifeq ($(ARCH_DETECTED), 64BITS)
-      CFLAGS += -pipe -O3 -march=athlon64
-      LDFLAGS += -ldl
-    else
-      CFLAGS += -pipe -O3 -mmmx -msse -march=i686 -mtune=pentium-m -fomit-frame-pointer
-      LDFLAGS += -ldl
-    endif
-  endif
+  LDLIBS += -ldl
 endif
 ifeq ($(OS), OSX)
   # The mac version of SDL requires inclusion of SDL_main in the executable
-  LDFLAGS += -ldl $(shell sdl-config --libs)
+  LDLIBS += -ldl $(shell sdl-config --libs)
   ifeq ($(CPU), X86)
     ifeq ($(ARCH_DETECTED), 64BITS)
       CFLAGS += -pipe -O3 -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
@@ -103,8 +108,9 @@ ifeq ($(OS), OSX)
     endif
   endif
 endif
-ifeq ($(CPU), PPC)
-  CFLAGS += -mcpu=powerpc
+
+ifeq ($(BIG_ENDIAN), 1)
+  CFLAGS += -DM64P_BIG_ENDIAN
 endif
 
 # tweak flags for 32-bit build on 64-bit system
@@ -113,7 +119,7 @@ ifeq ($(ARCH_DETECTED), 64BITS_32)
     $(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
   endif
   CFLAGS += -m32
-  LDFLAGS += -m32 -m elf_i386
+  LDFLAGS += -m32 -Wl,-m,elf_i386
 endif
 
 # set mupen64plus core API header path
@@ -138,16 +144,23 @@ else
   endif
 endif
 
-# set shell function names
-CC      ?= gcc
-CXX     ?= g++
-INSTALL ?= install
-ifeq ($(OS),OSX)
-  STRIP	?= strip -x 
-else
-  STRIP	?= strip -s
+# reduced compile output when running make without V=1
+ifneq ($(findstring $(MAKEFLAGS),s),s)
+ifndef V
+	Q_CC  = @echo '    CC  '$@;
+	Q_LD  = @echo '    LD  '$@;
+endif
 endif
 
+# set base program pointers and flags
+CC       ?= gcc
+CXX      ?= g++
+RM       ?= rm -f
+INSTALL  ?= install
+MKDIR ?= mkdir -p
+COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
+LINK.o = $(Q_LD)$(CC) $(LDFLAGS) $(TARGET_ARCH)
+
 # set special flags for given Makefile parameters
 # note: COREDIR _must_ end in a slash if you want it to work; not necessary for the others
 ifneq ($(PLUGINDIR),)
@@ -161,7 +174,9 @@ ifneq ($(SHAREDIR),)
 endif
 ifeq ($(DEBUG),1)
   CFLAGS += -g
-  STRIP = true # disable binary strip
+  INSTALL_STRIP_FLAG ?= 
+else
+  INSTALL_STRIP_FLAG ?= -s
 endif
 
 # set installation options
@@ -172,7 +187,7 @@ ifeq ($(BINDIR),)
   BINDIR := $(PREFIX)/bin
 endif
 ifeq ($(MANDIR),)
-  MANDIR := $(PREFIX)/man/man6
+  MANDIR := $(PREFIX)/share/man
 endif
 
 SRCDIR = ../../src
@@ -191,7 +206,7 @@ SOURCE = \
 # generate a list of object files build, make a temporary directory for them
 OBJECTS := $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(filter %.c, $(SOURCE)))
 OBJDIRS = $(dir $(OBJECTS))
-$(shell mkdir -p $(OBJDIRS))
+$(shell $(MKDIR) $(OBJDIRS))
 
 # build targets
 TARGET = mupen64plus
@@ -209,47 +224,42 @@ targets:
 	@echo "    PLUGINDIR=path == default path to search for plugins"
 	@echo "    SHAREDIR=path  == default path to search for shared data files"
 	@echo "    APIDIR=path    == path to find Mupen64Plus Core headers"
+	@echo "    OPTFLAGS=flags == compiler optimization (default: -O3)"
+	@echo "    PIE=(1|0)      == Force enable/disable of position independent executables"
 	@echo "  Install Options:"
 	@echo "    PREFIX=path    == install/uninstall prefix (default: /usr/local/)"
 	@echo "    BINDIR=path    == path to install mupen64plus binary (default: PREFIX/bin/)"
-	@echo "    MANDIR=path    == path to install mupen64plus manual page (default: PREFIX/man/man6/)"
+	@echo "    MANDIR=path    == path to install mupen64plus manual page (default: PREFIX/share/man)"
 	@echo "    DESTDIR=path   == path to prepend to all installation paths (only for packagers)"
 	@echo "  Debugging Options:"
 	@echo "    DEBUG=1        == add debugging symbols to application binary"
+	@echo "    V=1            == show verbose compiler output"
 
 all: $(TARGET)
 
 clean:
-	rm -rf ./_obj/* $(TARGET)
-	rmdir ./_obj
+	$(RM) -r ./_obj $(TARGET)
 
 rebuild: clean all
 
 install: $(TARGET)
-	$(INSTALL) -d -v "$(DESTDIR)$(BINDIR)"
-	$(INSTALL) -m 0755 $(TARGET) "$(DESTDIR)$(BINDIR)"
-	$(INSTALL) -d -v "$(DESTDIR)$(MANDIR)"
-	$(INSTALL) -m 0644 ../../doc/mupen64plus.6.gz "$(DESTDIR)$(MANDIR)"
+	$(INSTALL) -d "$(DESTDIR)$(BINDIR)"
+	$(INSTALL) -m 0755 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(BINDIR)"
+	$(INSTALL) -d "$(DESTDIR)$(MANDIR)/man6"
+	$(INSTALL) -m 0644 ../../doc/mupen64plus.6.gz "$(DESTDIR)$(MANDIR)/man6"
 
 uninstall:
-	rm -f "$(DESTDIR)$(BINDIR)/$(TARGET)" "$(DESTDIR)$(MANDIR)/mupen64plus.6.gz"
+	$(RM) "$(DESTDIR)$(BINDIR)/$(TARGET)" "$(DESTDIR)$(MANDIR)/man6/mupen64plus.6.gz"
 
 # build dependency files
 CFLAGS += -MD
 -include $(OBJECTS:.o=.d)
 
-# reduced compile output when running make without V=1
-ifneq ($(findstring $(MAKEFLAGS),s),s)
-ifndef V
-	Q_CC  = @echo '    CC  '$@;
-	Q_LD  = @echo '    LD  '$@;
-endif
-endif
+# standard build rules
+$(OBJDIR)/%.o: $(SRCDIR)/%.c
+	$(COMPILE.c) -o $@ $<
 
-# build rules
 $(TARGET): $(OBJECTS)
-	$(Q_LD)$(CC) $^ $(LDFLAGS) $(SRC_LIBS) -o $@
-	$(STRIP) $@
+	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
 
-$(OBJDIR)/%.o: $(SRCDIR)/%.c
-	$(Q_CC)$(CC) -o $@ $(CFLAGS) -c $<
+.PHONY: all clean install uninstall targets
diff --git a/src/cheat.c b/src/cheat.c
index afc971c..952cdb6 100644
--- a/src/cheat.c
+++ b/src/cheat.c
@@ -198,7 +198,7 @@ static void CheatAddVariables(cheat_code * Code, char *varlist)
 * global functions
 */
 
-void ReadCheats(char *RomSection)
+static void ReadCheats(char *RomSection)
 {
     sCheatInfo *curr_code;
     const char *romdbpath = ConfigGetSharedDataFilepath(CHEAT_FILE);
@@ -240,7 +240,6 @@ void ReadCheats(char *RomSection)
     /* parse lines from cheat database */
     char *curline = NULL;
     char *nextline = l_IniText;
-    int NumCheats = 0;
 
     while(nextline != NULL && *nextline != 0)
     {
diff --git a/src/cheat.h b/src/cheat.h
index 611121a..e44ac05 100644
--- a/src/cheat.h
+++ b/src/cheat.h
@@ -22,7 +22,7 @@
 #ifndef CHEAT_H
 #define CHEAT_H
 
-#ifdef _BIG_ENDIAN
+#ifdef M64P_BIG_ENDIAN
   #define sl(mot) mot
 #else
   #define sl(mot) (((mot & 0xFF) << 24) | ((mot & 0xFF00) <<  8) | ((mot & 0xFF0000) >>  8) | ((mot & 0xFF000000) >> 24))
diff --git a/src/compare_core.c b/src/compare_core.c
index b525e61..6b214c3 100644
--- a/src/compare_core.c
+++ b/src/compare_core.c
@@ -51,8 +51,10 @@ static void stop_it(void)
 
     errors++;
 #if !defined(WIN32)
-    if (errors > 7)
-        asm("int $3;");
+    #if defined(__i386__) || defined(__x86_64__)
+        if (errors > 7)
+            asm("int $3;");
+    #endif
 #endif
 }
 
diff --git a/src/core_interface.c b/src/core_interface.c
index 5726399..05bc9fe 100644
--- a/src/core_interface.c
+++ b/src/core_interface.c
@@ -35,9 +35,11 @@
 #include "osal_dynamiclib.h"
 
 #include "version.h"
+#include "core_interface.h"
 
 /* global data definitions */
 int g_CoreCapabilities;
+int g_CoreAPIVersion;
 
 /* definitions of pointers to Core common functions */
 ptr_CoreErrorMessage    CoreErrorMessage = NULL;
@@ -154,17 +156,17 @@ m64p_error AttachCoreLib(const char *CoreLibFilepath)
     }
     m64p_plugin_type PluginType = (m64p_plugin_type) 0;
     int Compatible = 0;
-    int CoreVersion = 0, APIVersion = 0;
+    int CoreVersion = 0;
     const char *CoreName = NULL;
-    (*CoreVersionFunc)(&PluginType, &CoreVersion, &APIVersion, &CoreName, &g_CoreCapabilities);
+    (*CoreVersionFunc)(&PluginType, &CoreVersion, &g_CoreAPIVersion, &CoreName, &g_CoreCapabilities);
     if (PluginType != M64PLUGIN_CORE)
-        fprintf(stderr, "AttachCoreLib() Error: Shared library '%s' invalid; wrong plugin type %i.\n", CoreLibFilepath, (int) PluginType);
+        fprintf(stderr, "AttachCoreLib() Error: Shared library '%s' invalid; this is not the emulator core.\n", CoreLibFilepath);
     else if (CoreVersion < MINIMUM_CORE_VERSION)
-        fprintf(stderr, "AttachCoreLib() Error: Shared library '%s' invalid; core version %i.%i.%i is below minimum supported %i.%i.%i\n",
+        fprintf(stderr, "AttachCoreLib() Error: Shared library '%s' incompatible; core version %i.%i.%i is below minimum supported %i.%i.%i\n",
                 CoreLibFilepath, VERSION_PRINTF_SPLIT(CoreVersion), VERSION_PRINTF_SPLIT(MINIMUM_CORE_VERSION));
-    else if (APIVersion < MINIMUM_API_VERSION)
-        fprintf(stderr, "AttachCoreLib() Error: Shared library '%s' invalid; core API version %i.%i.%i is below minimum supported %i.%i.%i\n",
-                CoreLibFilepath, VERSION_PRINTF_SPLIT(APIVersion), VERSION_PRINTF_SPLIT(MINIMUM_API_VERSION));
+    else if ((g_CoreAPIVersion & 0xffff0000) != (CORE_API_VERSION & 0xffff0000))
+        fprintf(stderr, "AttachCoreLib() Error: Shared library '%s' incompatible; core API major version %i.%i.%i doesn't match with this application (%i.%i.%i)\n",
+                CoreLibFilepath, VERSION_PRINTF_SPLIT(g_CoreAPIVersion), VERSION_PRINTF_SPLIT(CORE_API_VERSION));
     else
         Compatible = 1;
     /* exit if not compatible */
@@ -172,8 +174,29 @@ m64p_error AttachCoreLib(const char *CoreLibFilepath)
     {
         osal_dynlib_close(CoreHandle);
         CoreHandle = NULL;
+        return M64ERR_INCOMPATIBLE;
+    }
+
+    /* attach and call the CoreGetAPIVersion function, check Config API version for compatibility */
+    ptr_CoreGetAPIVersions CoreAPIVersionFunc;
+    CoreAPIVersionFunc = (ptr_CoreGetAPIVersions) osal_dynlib_getproc(CoreHandle, "CoreGetAPIVersions");
+    if (CoreAPIVersionFunc == NULL)
+    {
+        fprintf(stderr, "AttachCoreLib() Error: Library '%s' broken; no CoreAPIVersionFunc() function found.\n", CoreLibFilepath);
+        osal_dynlib_close(CoreHandle);
+        CoreHandle = NULL;
         return M64ERR_INPUT_INVALID;
     }
+    int ConfigAPIVersion, DebugAPIVersion, VidextAPIVersion;
+    (*CoreAPIVersionFunc)(&ConfigAPIVersion, &DebugAPIVersion, &VidextAPIVersion, NULL);
+    if ((ConfigAPIVersion & 0xffff0000) != (CONFIG_API_VERSION & 0xffff0000))
+    {
+        fprintf(stderr, "AttachCoreLib() Error: Emulator core '%s' incompatible; Config API major version %i.%i.%i doesn't match application: %i.%i.%i\n",
+                CoreLibFilepath, VERSION_PRINTF_SPLIT(ConfigAPIVersion), VERSION_PRINTF_SPLIT(CONFIG_API_VERSION));
+        osal_dynlib_close(CoreHandle);
+        CoreHandle = NULL;
+        return M64ERR_INCOMPATIBLE;
+    }
 
     /* print some information about the core library */
     printf("UI-console: attached to core library '%s' version %i.%i.%i\n", CoreName, VERSION_PRINTF_SPLIT(CoreVersion));
diff --git a/src/core_interface.h b/src/core_interface.h
index ba809fb..3f60ae3 100644
--- a/src/core_interface.h
+++ b/src/core_interface.h
@@ -34,6 +34,7 @@ extern m64p_error DetachCoreLib(void);
 
 /* global variables from core_interface.c */
 extern int g_CoreCapabilities;
+extern int g_CoreAPIVersion;
 
 /* declarations of Core library handle and pointers to common functions */
 extern m64p_dynlib_handle      CoreHandle;
diff --git a/src/main.c b/src/main.c
index e87276f..f82bfcb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -180,6 +180,7 @@ static void printUsage(const char *progname)
            "    --fullscreen          : use fullscreen display mode\n"
            "    --windowed            : use windowed display mode\n"
            "    --resolution (res)    : display resolution (640x480, 800x600, 1024x768, etc)\n"
+           "    --nospeedlimit        : disable core speed limiter (should be used with dummy audio plugin)\n"
            "    --cheats (cheat-spec) : enable or list cheat codes for the given rom file\n"
            "    --corelib (filepath)  : use core library (filepath) (can be only filename or full path)\n"
            "    --configdir (dir)     : force configation directory to (dir); should contain mupen64plus.conf\n"
@@ -391,6 +392,17 @@ static m64p_error ParseCommandLineFinal(int argc, const char **argv)
             int Fullscreen = 0;
             (*ConfigSetParameter)(l_ConfigVideo, "Fullscreen", M64TYPE_BOOL, &Fullscreen);
         }
+        else if (strcmp(argv[i], "--nospeedlimit") == 0)
+        {
+            int EnableSpeedLimit = 0;
+            if (g_CoreAPIVersion < 0x020001)
+                fprintf(stderr, "Warning: core library doesn't support --nospeedlimit\n");
+            else
+            {
+                if ((*CoreDoCommand)(M64CMD_CORE_STATE_SET, M64CORE_SPEED_LIMITER, &EnableSpeedLimit) != M64ERR_SUCCESS)
+                    fprintf(stderr, "Error: core gave error while setting --nospeedlimit option\n");
+            }
+        }
         else if ((strcmp(argv[i], "--corelib") == 0 || strcmp(argv[i], "--configdir") == 0 ||
                   strcmp(argv[i], "--datadir") == 0) && ArgsLeft >= 1)
         {   /* these are handled in ParseCommandLineInitial */
@@ -537,7 +549,7 @@ int main(int argc, char *argv[])
         return 2;
 
     /* start the Mupen64Plus core library, load the configuration file */
-    m64p_error rval = (*CoreStartup)(CONSOLE_API_VERSION, l_ConfigDirPath, l_DataDirPath, "Core", DebugCallback, NULL, NULL);
+    m64p_error rval = (*CoreStartup)(CORE_API_VERSION, l_ConfigDirPath, l_DataDirPath, "Core", DebugCallback, NULL, NULL);
     if (rval != M64ERR_SUCCESS)
     {
         printf("UI-console: error starting Mupen64Plus core library.\n");
diff --git a/src/version.h b/src/version.h
index d3391e3..47bfc6d 100644
--- a/src/version.h
+++ b/src/version.h
@@ -26,12 +26,12 @@
 #if !defined(VERSION_H)
 #define VERSION_H
 
-#define CONSOLE_UI_VERSION 0x016304
-#define CONSOLE_API_VERSION 0x10000
 #define CONSOLE_UI_NAME    "Mupen64Plus Console User-Interface"
+#define CONSOLE_UI_VERSION 0x016304
+#define CORE_API_VERSION   0x20001
+#define CONFIG_API_VERSION 0x20000
 
-#define MINIMUM_CORE_VERSION 0x016300
-#define MINIMUM_API_VERSION 0x10000
+#define MINIMUM_CORE_VERSION   0x016300
 
 #define VERSION_PRINTF_SPLIT(x) (((x) >> 16) & 0xffff), (((x) >> 8) & 0xff), ((x) & 0xff)
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/mupen64plus-ui-console.git



More information about the Pkg-games-commits mailing list