[mupen64plus-core] 70/310: Imported Upstream version 1.99.4+20110413

Sven Eckelmann ecsv-guest at moszumanska.debian.org
Thu Nov 26 05:57:18 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-core.

commit 4639fc3f53e05dd3615bc424049c0856da4ac270
Author: Sven Eckelmann <sven at narfation.org>
Date:   Sun May 1 19:50:47 2011 +0200

    Imported Upstream version 1.99.4+20110413
---
 .hgtags                                            |  5 ++
 .../Mupen64Plus_v2.0_Core_API_v1.0.txt             | 10 ++--
 .../Mupen64Plus_v2.0_Core_Video_Extension.txt      | 15 ++++++
 .../Mupen64Plus_v2.0_Design_Proposal_3.txt         |  2 +-
 doc/emuwiki-api-doc/Mupen64Plus_v2.0_headers.txt   | 29 ++++++++++--
 projects/unix/Makefile                             |  2 +-
 src/api/api_export.ver                             |  1 +
 src/api/callbacks.h                                |  5 +-
 src/api/config.c                                   |  2 +-
 src/api/m64p_frontend.h                            |  7 ++-
 src/api/m64p_types.h                               |  1 +
 src/api/m64p_vidext.h                              |  7 +++
 src/api/vidext.c                                   | 53 ++++++++++++++++------
 src/api/vidext.h                                   |  4 +-
 src/main/main.c                                    |  6 +--
 src/main/rom.c                                     |  2 +-
 src/main/savestates.c                              | 11 ++++-
 src/memory/dma.c                                   |  6 +--
 src/memory/pif.c                                   | 49 ++++++++++++++++++++
 src/r4300/interupt.c                               |  3 +-
 tools/build_bundle_bin.sh                          |  0
 tools/build_bundle_src.sh                          |  0
 tools/build_modules_src.sh                         |  0
 tools/cheat_code_convert.py                        |  0
 tools/install_binary_bundle.sh                     |  0
 tools/regtests/regression-video.py                 |  0
 tools/uninstall_binary_bundle.sh                   |  0
 27 files changed, 179 insertions(+), 41 deletions(-)

diff --git a/.hgtags b/.hgtags
new file mode 100644
index 0000000..5f036dd
--- /dev/null
+++ b/.hgtags
@@ -0,0 +1,5 @@
+43cf6e403681f9311ff766c815ff7ab2db83d166 v1.999-milestone-1
+98d5a1dba99aa8d5343666f602775d014858ca37 1.99.1
+36c711f611a4ad85f369588ea7b5f42a5ad6be23 1.99.2
+2a082af3d846e67915f70a4e79e836e35018bf89 1.99.3
+80adf3d6e000c35f34060122962ca199dac3bc38 1.99.4
diff --git a/doc/emuwiki-api-doc/Mupen64Plus_v2.0_Core_API_v1.0.txt b/doc/emuwiki-api-doc/Mupen64Plus_v2.0_Core_API_v1.0.txt
index 68741d8..3ca5872 100644
--- a/doc/emuwiki-api-doc/Mupen64Plus_v2.0_Core_API_v1.0.txt
+++ b/doc/emuwiki-api-doc/Mupen64Plus_v2.0_Core_API_v1.0.txt
@@ -1,7 +1,9 @@
-[http://mupen64plus.emuwiki.com Project page]
+[http://mupen64plus.retrouprising.com Project page]
 
-Please note: as of October 2009, this API is a work in progress.<br />
-The first draft of this API is complete, and development work on the Mupen64Plus software is ongoing.
+Please note: as of January 2011, this API is a work in progress.<br />
+The core Mupen64Plus v2.0 modules are complete, but work on GUI front-end applications is ongoing.
+
+To view the design proposal which preceded this API definition, go to [[Mupen64Plus v2.0 Design Proposal 3|Design Proposal 3]].
 
 == New Architecture ==
 
@@ -31,7 +33,7 @@ The expected sequence of operations which will be taken by the front-end applica
 == Core API ==
 === [[Mupen64Plus v2.0 Core Basic|Basic Core Functions]] ===
 
-These two functions (<tt>CoreGetVersion</tt> and <tt>CoreErrorMessage</tt>) are utility functions and may be called at any time (even before core startup).  These functions are used by both the front-end and the plugins.
+These two functions (<tt>PluginGetVersion</tt> and <tt>CoreErrorMessage</tt>) are utility functions and may be called at any time (even before core startup).  These functions are used by both the front-end and the plugins.
 
 === [[Mupen64Plus v2.0 Core Front-End|Front-End Functions]] ===
 
diff --git a/doc/emuwiki-api-doc/Mupen64Plus_v2.0_Core_Video_Extension.txt b/doc/emuwiki-api-doc/Mupen64Plus_v2.0_Core_Video_Extension.txt
index ab1c96f..b2247e6 100644
--- a/doc/emuwiki-api-doc/Mupen64Plus_v2.0_Core_Video_Extension.txt
+++ b/doc/emuwiki-api-doc/Mupen64Plus_v2.0_Core_Video_Extension.txt
@@ -127,6 +127,21 @@ All of these functions should only be called from within the video plugin; they
 <br />
 {| border="1"
 |Prototype
+|'''<tt>m64p_error VidExt_GL_GetAttribute(m64p_GLattr Attr, int *pValue)</tt>'''
+|-
+|Input Parameters
+|'''<tt>Attr</tt>''' Enumerated type (defined in [[Mupen64Plus v2.0 headers#vidext.h|vidext.h]]) specifying OpenGL attribute of which to get value<br />
+'''<tt>pValue</tt>''' Pointer to integer Value which will be set to attribute's value
+|-
+|Requirements
+|The video extension must be initialized before calling this function.
+|-
+|Usage
+|This function may be used to check that OpenGL attributes where successfully set to the rendering window after the '''<tt>VidExt_SetVideoMode</tt>''' function call.
+|}
+<br />
+{| border="1"
+|Prototype
 |'''<tt>m64p_error VidExt_GL_SwapBuffers(void)</tt>'''
 |-
 |Input Parameters
diff --git a/doc/emuwiki-api-doc/Mupen64Plus_v2.0_Design_Proposal_3.txt b/doc/emuwiki-api-doc/Mupen64Plus_v2.0_Design_Proposal_3.txt
index 386e2f1..fdee505 100644
--- a/doc/emuwiki-api-doc/Mupen64Plus_v2.0_Design_Proposal_3.txt
+++ b/doc/emuwiki-api-doc/Mupen64Plus_v2.0_Design_Proposal_3.txt
@@ -1,4 +1,4 @@
-[http://mupen64plus.emuwiki.com Project page]
+[http://mupen64plus.retrouprising.com Project page]
 
 == Primary Goal ==
 
diff --git a/doc/emuwiki-api-doc/Mupen64Plus_v2.0_headers.txt b/doc/emuwiki-api-doc/Mupen64Plus_v2.0_headers.txt
index 3536af2..6b3890b 100644
--- a/doc/emuwiki-api-doc/Mupen64Plus_v2.0_headers.txt
+++ b/doc/emuwiki-api-doc/Mupen64Plus_v2.0_headers.txt
@@ -1,4 +1,4 @@
-[http://mupen64plus.emuwiki.com Project page]
+[http://mupen64plus.retrouprising.com Project page]
 
 == core.h ==
  
@@ -20,6 +20,14 @@
  } m64p_type;
  
  typedef enum {
+   M64MSG_ERROR = 1,
+   M64MSG_WARNING,
+   M64MSG_INFO,
+   M64MSG_STATUS,
+   M64MSG_VERBOSE
+ } m64p_msg_level;
+ 
+ typedef enum {
    M64ERR_SUCCESS = 0,
    M64ERR_NOT_INIT,        /* Function is disallowed before InitMupen64Plus() is called */
    M64ERR_ALREADY_INIT,    /* InitMupen64Plus() was called twice */
@@ -28,6 +36,13 @@
    M64ERR_INPUT_INVALID,   /* Invalid input data, such as ParamValue="maybe" for SetCoreParameter() to set a BOOL-type value */
    M64ERR_INPUT_NOT_FOUND, /* The input parameter(s) specified a particular item which was not found */
    M64ERR_NO_MEMORY        /* Memory allocation failed */
+   M64ERR_FILES,           /* Error opening, creating, reading, or writing to a file */
+   M64ERR_INTERNAL,        /* Internal error (bug) */
+   M64ERR_INVALID_STATE,   /* Current program state does not allow operation */
+   M64ERR_PLUGIN_FAIL,     /* A plugin function returned a fatal error */
+   M64ERR_SYSTEM_FAIL,     /* A system function call, such as an SDL or file operation, failed */
+   M64ERR_UNSUPPORTED,     /* Function call is not supported (ie, core not built with debugger) */
+   M64ERR_WRONG_TYPE       /* A given input type parameter cannot be used for desired operation */
  } m64p_error;
  
  typedef enum {
@@ -37,6 +52,7 @@
  } m64p_core_caps;
  
  typedef enum {
+   M64PLUGIN_NULL = 0,
    M64PLUGIN_RSP = 1,
    M64PLUGIN_GFX,
    M64PLUGIN_AUDIO,
@@ -76,7 +92,8 @@
    M64CMD_CORE_STATE_QUERY,
    M64CMD_SEND_SDL_KEYDOWN,
    M64CMD_SEND_SDL_KEYUP,
-   M64CMD_SET_FRAME_CALLBACK
+   M64CMD_SET_FRAME_CALLBACK,
+   M64CMD_TAKE_NEXT_SCREENSHOT
  } m64p_command;
  
  typedef struct {
@@ -110,9 +127,12 @@
  typedef struct
  {
     char goodname[256];
-    int eeprom_16kb;
     char MD5[33];
- } rom_settings;
+    unsigned char savetype;
+    unsigned char status;  /* Rom status on a scale from 0-5. */
+    unsigned char players; /* Local players 0-4, 2/3/4 way Netplay indicated by 5/6/7. */
+    unsigned char rumble;  /* 0 - No, 1 - Yes boolean for rumble support. */
+ } m64p_rom_settings;
 
 == vidext.h ==
  
@@ -146,6 +166,7 @@
    m64p_error (*VidExtFuncSetMode)(int, int, int, int),
    void *     (*VidExtFuncGLGetProc)(const char*),
    m64p_error (*VidExtFuncGLSetAttr)(m64p_GLattr, int),
+   m64p_error (*VidExtFuncGLGetAttr)(m64p_GLattr, int),
    m64p_error (*VidExtFuncGLSwapBuf)(void),
    m64p_error (*VidExtFuncSetCaption)(const char *),
    m64p_error (*VidExtFuncToggleFS)(void)
diff --git a/projects/unix/Makefile b/projects/unix/Makefile
index cf8e6ae..43d3f87 100644
--- a/projects/unix/Makefile
+++ b/projects/unix/Makefile
@@ -368,7 +368,7 @@ install: $(TARGET)
 	$(INSTALL) -m 0644 ../../data/* "$(DESTDIR)$(SHAREDIR)"
 	$(INSTALL) -d -v "$(DESTDIR)$(INCDIR)"
 	$(INSTALL) -m 0644 ../../src/api/m64p_*.h "$(DESTDIR)$(INCDIR)"
-	if [ `id -u` -eq 0 ]; then $(LDCONFIG); fi
+	-$(LDCONFIG)
 
 uninstall:
 	$(RM) -f "$(DESTDIR)$(LIBDIR)/$(TARGET)"
diff --git a/src/api/api_export.ver b/src/api/api_export.ver
index 652c4ef..35daae0 100644
--- a/src/api/api_export.ver
+++ b/src/api/api_export.ver
@@ -53,6 +53,7 @@ DebugStep;
 PluginGetVersion;
 VidExt_GL_GetProcAddress;
 VidExt_GL_SetAttribute;
+VidExt_GL_GetAttribute;
 VidExt_GL_SwapBuffers;
 VidExt_Init;
 VidExt_ListFullscreenModes;
diff --git a/src/api/callbacks.h b/src/api/callbacks.h
index 4d4a490..50b67a6 100644
--- a/src/api/callbacks.h
+++ b/src/api/callbacks.h
@@ -27,10 +27,7 @@
 #define API_CALLBACKS_H
 
 #include "m64p_types.h"
-
-/* pointer types to the callback functions in the front-end application */
-typedef void (*ptr_DebugCallback)(void *Context, int level, const char *message);
-typedef void (*ptr_StateCallback)(void *Context, m64p_core_param param_type, int new_value);
+#include "m64p_frontend.h"
 
 /* Functions for use by the Core, to send information back to the front-end app */
 extern m64p_error SetDebugCallback(ptr_DebugCallback pFunc, void *Context);
diff --git a/src/api/config.c b/src/api/config.c
index a661298..860e9cc 100644
--- a/src/api/config.c
+++ b/src/api/config.c
@@ -200,7 +200,7 @@ m64p_error ConfigInit(const char *ConfigDirOverride, const char *DataDirOverride
     fPtr = fopen(filepath, "rb");
     if (fPtr == NULL)
     {
-        DebugMessage(M64MSG_WARNING, "Couldn't open configuration file '%s'.  Using defaults.", filepath);
+        DebugMessage(M64MSG_INFO, "Couldn't open configuration file '%s'.  Using defaults.", filepath);
         free(filepath);
         l_SaveConfigOnExit = 1; /* auto-save the config file so that the defaults will be saved to disk */
         return M64ERR_SUCCESS;
diff --git a/src/api/m64p_frontend.h b/src/api/m64p_frontend.h
index 8aaae6d..14d9188 100644
--- a/src/api/m64p_frontend.h
+++ b/src/api/m64p_frontend.h
@@ -28,12 +28,17 @@
 
 #include "m64p_types.h"
 
+
+/* pointer types to the callback functions in the front-end application */
+typedef void (*ptr_DebugCallback)(void *Context, int level, const char *message);
+typedef void (*ptr_StateCallback)(void *Context, m64p_core_param param_type, int new_value);
+
 /* CoreStartup()
  *
  * This function initializes libmupen64plus for use by allocating memory,
  * creating data structures, and loading the configuration file.
  */
-typedef m64p_error (*ptr_CoreStartup)(int, const char *, const char *, void *, void (*)(void *, int, const char *), void *, void (*)(void *, m64p_core_param, int));
+typedef m64p_error (*ptr_CoreStartup)(int, const char *, const char *, void *, ptr_DebugCallback, void *, ptr_StateCallback);
 
 /* CoreShutdown()
  *
diff --git a/src/api/m64p_types.h b/src/api/m64p_types.h
index 6c9fce3..a64735f 100644
--- a/src/api/m64p_types.h
+++ b/src/api/m64p_types.h
@@ -261,6 +261,7 @@ typedef struct {
   m64p_error (*VidExtFuncSetMode)(int, int, int, int);
   void *     (*VidExtFuncGLGetProc)(const char*);
   m64p_error (*VidExtFuncGLSetAttr)(m64p_GLattr, int);
+  m64p_error (*VidExtFuncGLGetAttr)(m64p_GLattr, int *);
   m64p_error (*VidExtFuncGLSwapBuf)(void);
   m64p_error (*VidExtFuncSetCaption)(const char *);
   m64p_error (*VidExtFuncToggleFS)(void);
diff --git a/src/api/m64p_vidext.h b/src/api/m64p_vidext.h
index e4d6c77..6c14f84 100644
--- a/src/api/m64p_vidext.h
+++ b/src/api/m64p_vidext.h
@@ -89,6 +89,13 @@ typedef void * (*ptr_VidExt_GL_GetProcAddress)(const char *);
  */
 typedef m64p_error (*ptr_VidExt_GL_SetAttribute)(m64p_GLattr, int);
 
+/* VidExt_GL_GetAttribute()
+ *
+ * This function is used to get the value of OpenGL attributes.  These values may 
+ * be changed when calling VidExt_SetVideoMode.
+ */
+typedef m64p_error (*ptr_VidExt_GL_GetAttribute)(m64p_GLattr, int *);
+
 /* VidExt_GL_SwapBuffers()
  *
  * This function is used to swap the front/back buffers after rendering an
diff --git a/src/api/vidext.c b/src/api/vidext.c
index 8edb19e..334bbde 100644
--- a/src/api/vidext.c
+++ b/src/api/vidext.c
@@ -31,7 +31,7 @@
 #include "callbacks.h"
 
 /* local variables */
-static m64p_video_extension_functions l_ExternalVideoFuncTable = {9, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
+static m64p_video_extension_functions l_ExternalVideoFuncTable = {10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
 static int l_VideoExtensionActive = 0;
 static int l_VideoOutputActive = 0;
 static int l_Fullscreen = 0;
@@ -43,7 +43,7 @@ m64p_error OverrideVideoFunctions(m64p_video_extension_functions *VideoFunctionS
     /* check input data */
     if (VideoFunctionStruct == NULL)
         return M64ERR_INPUT_ASSERT;
-    if (VideoFunctionStruct->Functions < 9)
+    if (VideoFunctionStruct->Functions < 10)
         return M64ERR_INPUT_INVALID;
 
     /* disable video extension if any of the function pointers are NULL */
@@ -53,12 +53,13 @@ m64p_error OverrideVideoFunctions(m64p_video_extension_functions *VideoFunctionS
         VideoFunctionStruct->VidExtFuncSetMode == NULL ||
         VideoFunctionStruct->VidExtFuncGLGetProc == NULL ||
         VideoFunctionStruct->VidExtFuncGLSetAttr == NULL ||
+        VideoFunctionStruct->VidExtFuncGLGetAttr == NULL ||
         VideoFunctionStruct->VidExtFuncGLSwapBuf == NULL ||
         VideoFunctionStruct->VidExtFuncSetCaption == NULL ||
         VideoFunctionStruct->VidExtFuncToggleFS == NULL)
     {
-        l_ExternalVideoFuncTable.Functions = 9;
-        memset(&l_ExternalVideoFuncTable.VidExtFuncInit, 0, 9 * sizeof(void *));
+        l_ExternalVideoFuncTable.Functions = 10;
+        memset(&l_ExternalVideoFuncTable.VidExtFuncInit, 0, 10 * sizeof(void *));
         l_VideoExtensionActive = 0;
         return M64ERR_SUCCESS;
     }
@@ -272,13 +273,13 @@ EXPORT m64p_error CALL VidExt_ToggleFullScreen(void)
 
 EXPORT void * CALL VidExt_GL_GetProcAddress(const char* Proc)
 {
-    if (!SDL_WasInit(SDL_INIT_VIDEO))
-        return NULL;
-
     /* call video extension override if necessary */
     if (l_VideoExtensionActive)
         return (*l_ExternalVideoFuncTable.VidExtFuncGLGetProc)(Proc);
 
+    if (!SDL_WasInit(SDL_INIT_VIDEO))
+        return NULL;
+
     return SDL_GL_GetProcAddress(Proc);
 }
 
@@ -287,9 +288,7 @@ typedef struct {
     SDL_GLattr sdlAttr;
 } GLAttrMapNode;
 
-EXPORT m64p_error CALL VidExt_GL_SetAttribute(m64p_GLattr Attr, int Value)
-{
-    GLAttrMapNode GLAttrMap[] = {
+static const GLAttrMapNode GLAttrMap[] = {
         { M64P_GL_DOUBLEBUFFER, SDL_GL_DOUBLEBUFFER },
         { M64P_GL_BUFFER_SIZE,  SDL_GL_BUFFER_SIZE },
         { M64P_GL_DEPTH_SIZE,   SDL_GL_DEPTH_SIZE },
@@ -300,7 +299,10 @@ EXPORT m64p_error CALL VidExt_GL_SetAttribute(m64p_GLattr Attr, int Value)
         { M64P_GL_SWAP_CONTROL, SDL_GL_SWAP_CONTROL },
         { M64P_GL_MULTISAMPLEBUFFERS, SDL_GL_MULTISAMPLEBUFFERS },
         { M64P_GL_MULTISAMPLESAMPLES, SDL_GL_MULTISAMPLESAMPLES }};
-    const int mapSize = sizeof(GLAttrMap) / sizeof(GLAttrMapNode);
+const int mapSize = sizeof(GLAttrMap) / sizeof(GLAttrMapNode);
+
+EXPORT m64p_error CALL VidExt_GL_SetAttribute(m64p_GLattr Attr, int Value)
+{
     int i;
 
     /* call video extension override if necessary */
@@ -316,8 +318,33 @@ EXPORT m64p_error CALL VidExt_GL_SetAttribute(m64p_GLattr Attr, int Value)
         {
             if (SDL_GL_SetAttribute(GLAttrMap[i].sdlAttr, Value) != 0)
                 return M64ERR_SYSTEM_FAIL;
-            else
-                return M64ERR_SUCCESS;
+            return M64ERR_SUCCESS;
+        }
+    }
+
+    return M64ERR_INPUT_INVALID;
+}
+
+EXPORT m64p_error CALL VidExt_GL_GetAttribute(m64p_GLattr Attr, int *pValue)
+{
+    int i;
+
+    /* call video extension override if necessary */
+    if (l_VideoExtensionActive)
+        return (*l_ExternalVideoFuncTable.VidExtFuncGLGetAttr)(Attr, pValue);
+
+    if (!SDL_WasInit(SDL_INIT_VIDEO))
+        return M64ERR_NOT_INIT;
+
+    for (i = 0; i < mapSize; i++)
+    {
+        if (GLAttrMap[i].m64Attr == Attr)
+        {
+            int NewValue = 0;
+            if (SDL_GL_GetAttribute(GLAttrMap[i].sdlAttr, &NewValue) != 0)
+                return M64ERR_SYSTEM_FAIL;
+            *pValue = NewValue;
+            return M64ERR_SUCCESS;
         }
     }
 
diff --git a/src/api/vidext.h b/src/api/vidext.h
index 845ad4c..251e282 100644
--- a/src/api/vidext.h
+++ b/src/api/vidext.h
@@ -31,10 +31,12 @@
 /* global function for use by frontend.c */
 extern m64p_error OverrideVideoFunctions(m64p_video_extension_functions *VideoFunctionStruct);
 
+/* these functions are only used by the core */
 extern int VidExt_InFullscreenMode(void);
 extern int VidExt_VideoRunning(void);
 
 /* these functions are exported outside of the Core as well as used within it */
-EXPORT void * CALL VidExt_GL_GetProcAddress(const char* Proc);
+EXPORT void *     CALL VidExt_GL_GetProcAddress(const char* Proc);
+EXPORT m64p_error CALL VidExt_GL_SwapBuffers(void);
 
 #endif /* API_VIDEXT_H */
diff --git a/src/main/main.c b/src/main/main.c
index c2bef93..d6af47d 100644
--- a/src/main/main.c
+++ b/src/main/main.c
@@ -88,9 +88,8 @@ char *get_savespath()
     snprintf(path, 1024, "%ssave%c", ConfigGetUserDataPath(), OSAL_DIR_SEPARATOR);
     path[1023] = 0;
 
-    /* make sure the directory exists */
-    if (osal_mkdirp(path, 0700) != 0)
-        return NULL;
+    /* create directory if it doesn't exist */
+    osal_mkdirp(path, 0700);
 
     return path;
 }
@@ -454,6 +453,7 @@ void new_vi(void)
         time = (int)(CalculatedTime - CurrentFPSTime);
         if (time > 0)
         {
+            DebugMessage(M64MSG_VERBOSE, "    new_vi(): Waiting %ims", time);
             SDL_Delay(time);
         }
         CurrentFPSTime = CurrentFPSTime + time;
diff --git a/src/main/rom.c b/src/main/rom.c
index bd5d05e..07df3f1 100644
--- a/src/main/rom.c
+++ b/src/main/rom.c
@@ -95,7 +95,7 @@ static void swap_rom(unsigned char* localrom, unsigned char* imagetype, int load
         for (i = 0; i < loadlength; i+=4)
             {
             temp=localrom[i];
-            localrom[i]=localrom[1+3];
+            localrom[i]=localrom[i+3];
             localrom[i+3]=temp;
             temp=localrom[i+1];
             localrom[i+1]=localrom[i+2];
diff --git a/src/main/savestates.c b/src/main/savestates.c
index edc80e2..d9a35fd 100644
--- a/src/main/savestates.c
+++ b/src/main/savestates.c
@@ -155,6 +155,13 @@ void savestates_save()
     f = gzopen(file, "wb");
     free(file);
 
+    if (f==NULL)
+    {
+        main_message(M64MSG_STATUS, OSD_BOTTOM_LEFT, "Could not open state file: %s", filename);
+        free(filename);
+        return;
+    }
+
     /* Write magic number. */
     gzwrite(f, savestate_magic, 8);
 
@@ -256,11 +263,11 @@ void savestates_load()
     free(file);
 
     if(f==NULL)
-        {
+    {
         main_message(M64MSG_STATUS, OSD_BOTTOM_LEFT, "Could not open state file: %s", filename);
         free(filename);
         return;
-        }
+    }
 
     /* Read and check Mupen64Plus magic number. */
     gzread(f, buffer, 8);
diff --git a/src/memory/dma.c b/src/memory/dma.c
index 35a19f4..9c9aee5 100644
--- a/src/memory/dma.c
+++ b/src/memory/dma.c
@@ -53,8 +53,7 @@ void dma_pi_read(void)
         {
             char *filename;
             FILE *f;
-            filename = (char *) malloc(strlen(get_savespath())+
-            strlen(ROM_SETTINGS.goodname)+4+1);
+            filename = (char *) malloc(strlen(get_savespath()) + strlen(ROM_SETTINGS.goodname) + 4 + 1);
             strcpy(filename, get_savespath());
             strcat(filename, ROM_SETTINGS.goodname);
             strcat(filename, ".sra");
@@ -123,8 +122,7 @@ void dma_pi_write(void)
                 FILE *f;
                 int i;
                 
-                filename = (char *) malloc(strlen(get_savespath())+
-                strlen(ROM_SETTINGS.goodname)+4+1);
+                filename = (char *) malloc(strlen(get_savespath()) + strlen(ROM_SETTINGS.goodname) + 4 + 1);
                 strcpy(filename, get_savespath());
                 strcat(filename, ROM_SETTINGS.goodname);
                 strcat(filename, ".sra");
diff --git a/src/memory/pif.c b/src/memory/pif.c
index 49f9019..211e388 100644
--- a/src/memory/pif.c
+++ b/src/memory/pif.c
@@ -22,6 +22,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <time.h>
 
 #include "memory.h"
 #include "pif.h"
@@ -53,9 +54,17 @@ void print_pif(void)
 }
 #endif
 
+static unsigned char byte2bcd(int n)
+{
+	n %= 100;
+	return ((n / 10) << 4) | (n % 10);
+}
+
 static void EepromCommand(unsigned char *Command)
 {
     static int EepromFileWarningSent = 0;
+    time_t curtime_time;
+    struct tm curtime;
 
    switch (Command[2])
      {
@@ -140,6 +149,46 @@ static void EepromCommand(unsigned char *Command)
          free(filename);
       }
     break;
+      case 6:
+	      // RTCstatus query
+	      Command[3] = 0x00;
+	      Command[4] = 0x10;
+	      Command[5] = 0x00;
+	      break;
+      case 7:
+	      // read RTC block
+	      switch (Command[3]) {	// block number
+		      case 0:
+			      Command[4] = 0x00;
+			      Command[5] = 0x02;
+			      Command[12] = 0x00;
+			      break;
+		      case 1:
+			      DebugMessage(M64MSG_ERROR, "RTC command in EepromCommand(): read block %d", Command[2]);
+			      break;
+		      case 2:
+			      time(&curtime_time);
+#if defined(WIN32)
+			      localtime_s(&curtime, &curtime_time);
+#else
+			      localtime_r(&curtime_time, &curtime);
+#endif
+			      Command[4] = byte2bcd(curtime.tm_sec);
+			      Command[5] = byte2bcd(curtime.tm_min);
+			      Command[6] = 0x80 + byte2bcd(curtime.tm_hour);
+			      Command[7] = byte2bcd(curtime.tm_mday);
+			      Command[8] = byte2bcd(curtime.tm_wday);
+			      Command[9] = byte2bcd(curtime.tm_mon + 1);
+			      Command[10] = byte2bcd(curtime.tm_year);
+			      Command[11] = byte2bcd(curtime.tm_year / 100);
+			      Command[12] = 0x00;	// status
+			      break;
+	      }
+	      break;
+      case 8:
+	      // write RTC block
+	      DebugMessage(M64MSG_ERROR, "RTC write in EepromCommand(): %d not yet implemented", Command[2]);
+    break;
       default:
     DebugMessage(M64MSG_ERROR, "unknown command in EepromCommand(): %x", Command[2]);
      }
diff --git a/src/r4300/interupt.c b/src/r4300/interupt.c
index ac0f620..bad354c 100644
--- a/src/r4300/interupt.c
+++ b/src/r4300/interupt.c
@@ -25,6 +25,7 @@
 
 #include "api/m64p_types.h"
 #include "api/callbacks.h"
+#include "api/vidext.h"
 #include "memory/memory.h"
 #include "main/rom.h"
 #include "main/main.h"
@@ -380,7 +381,7 @@ void gen_interupt()
             if(rompause)
             {
                 osd_render();  // draw Paused message in case updateScreen didn't do it
-                SDL_GL_SwapBuffers();
+                VidExt_GL_SwapBuffers();
                 while(rompause)
                 {
                     SDL_Delay(10);
diff --git a/tools/build_bundle_bin.sh b/tools/build_bundle_bin.sh
old mode 100755
new mode 100644
diff --git a/tools/build_bundle_src.sh b/tools/build_bundle_src.sh
old mode 100755
new mode 100644
diff --git a/tools/build_modules_src.sh b/tools/build_modules_src.sh
old mode 100755
new mode 100644
diff --git a/tools/cheat_code_convert.py b/tools/cheat_code_convert.py
old mode 100755
new mode 100644
diff --git a/tools/install_binary_bundle.sh b/tools/install_binary_bundle.sh
old mode 100755
new mode 100644
diff --git a/tools/regtests/regression-video.py b/tools/regtests/regression-video.py
old mode 100755
new mode 100644
diff --git a/tools/uninstall_binary_bundle.sh b/tools/uninstall_binary_bundle.sh
old mode 100755
new mode 100644

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



More information about the Pkg-games-commits mailing list