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 f52ebbfd45f4417da3a40accbb6425c69d8f91fe Author: Sven Eckelmann <[email protected]> Date: Sat Feb 13 01:41:51 2010 +0100 Imported Upstream version 1.99.2 --- .hg_archival.txt | 2 +- .hgtags | 1 + RELEASE | 8 + projects/msvc8/mupen64plus-ui-console.sln | 49 +++++ projects/msvc8/mupen64plus-ui-console.vcproj | 261 +++++++++++++++++++++++++++ projects/unix/Makefile | 49 +++-- src/cheat.c | 3 +- src/compare_core.c | 17 +- src/core_interface.c | 2 +- src/main.c | 3 +- src/osal_dynamiclib_win32.c | 74 ++++++++ src/osal_files_win32.c | 75 ++++++++ src/plugin.c | 7 +- src/version.h | 2 +- 14 files changed, 520 insertions(+), 33 deletions(-) diff --git a/.hg_archival.txt b/.hg_archival.txt index 573850d..66b0e31 100644 --- a/.hg_archival.txt +++ b/.hg_archival.txt @@ -1,2 +1,2 @@ repo: 55709704bf013181159184b83e0ab909c7d458be -node: 9c6059a764e244625ac7c8196616d8c6cd8347bf +node: 8cf91241c3d4eff6b5fa8fa8f13fcc5e5cc4a89f diff --git a/.hgtags b/.hgtags new file mode 100644 index 0000000..0d88bdb --- /dev/null +++ b/.hgtags @@ -0,0 +1 @@ +9c6059a764e244625ac7c8196616d8c6cd8347bf 1.99.1 diff --git a/RELEASE b/RELEASE index 478203b..5274d0b 100644 --- a/RELEASE +++ b/RELEASE @@ -1,6 +1,14 @@ Mupen64Plus-UI-Console RELEASE ------------------------------ +Mupen64Plus-UI-Console Front-End v1.99.2 - January 6, 2010 +------------------------------------------------------------ + - new feature: added MSVC8 project/solution files, minor refactoring for VC compatibility + - Makefile improvements: + - throw error if OS/CPU not supported + - use DESTDIR in install/uninstall paths + - Allow user-specified CC/CXX/LD paths + Mupen64Plus-UI-Console Front-End v1.99.1 - December 14, 2009 ------------------------------------------------------------ - Brand new Console-based front-end for Mupen64Plus 2.0 diff --git a/projects/msvc8/mupen64plus-ui-console.sln b/projects/msvc8/mupen64plus-ui-console.sln new file mode 100644 index 0000000..1b39d4e --- /dev/null +++ b/projects/msvc8/mupen64plus-ui-console.sln @@ -0,0 +1,49 @@ +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-ui-console", "mupen64plus-ui-console.vcproj", "{0E29D9F8-C675-4D21-AF16-AA80EDDB264E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-core", "..\..\..\mupen64plus-core\projects\msvc8\mupen64plus-core.vcproj", "{92D3FEB9-2129-41C5-8577-BCD7D961EF41}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-video-rice", "..\..\..\mupen64plus-video-rice\projects\msvc8\mupen64plus-video-rice.vcproj", "{7D4AFF6A-B7D9-4C25-975A-038B8079098E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-rsp-hle", "..\..\..\mupen64plus-rsp-hle\projects\msvc8\mupen64plus-rsp-hle.vcproj", "{2EC7CEE3-C7A7-4F2E-B2C8-4DF6AFEC3E9A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-input-sdl", "..\..\..\mupen64plus-input-sdl\projects\msvc8\mupen64plus-input-sdl.vcproj", "{7F3178D0-0E2E-471B-9160-69F0354F9DE9}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-audio-sdl", "..\..\..\mupen64plus-audio-sdl\projects\msvc8\mupen64plus-audio-sdl.vcproj", "{96969748-EA54-43FC-8103-A346E9AD98E7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0E29D9F8-C675-4D21-AF16-AA80EDDB264E}.Debug|Win32.ActiveCfg = Debug|Win32 + {0E29D9F8-C675-4D21-AF16-AA80EDDB264E}.Debug|Win32.Build.0 = Debug|Win32 + {0E29D9F8-C675-4D21-AF16-AA80EDDB264E}.Release|Win32.ActiveCfg = Release|Win32 + {0E29D9F8-C675-4D21-AF16-AA80EDDB264E}.Release|Win32.Build.0 = Release|Win32 + {92D3FEB9-2129-41C5-8577-BCD7D961EF41}.Debug|Win32.ActiveCfg = Debug|Win32 + {92D3FEB9-2129-41C5-8577-BCD7D961EF41}.Debug|Win32.Build.0 = Debug|Win32 + {92D3FEB9-2129-41C5-8577-BCD7D961EF41}.Release|Win32.ActiveCfg = Release|Win32 + {92D3FEB9-2129-41C5-8577-BCD7D961EF41}.Release|Win32.Build.0 = Release|Win32 + {7D4AFF6A-B7D9-4C25-975A-038B8079098E}.Debug|Win32.ActiveCfg = Debug|Win32 + {7D4AFF6A-B7D9-4C25-975A-038B8079098E}.Debug|Win32.Build.0 = Debug|Win32 + {7D4AFF6A-B7D9-4C25-975A-038B8079098E}.Release|Win32.ActiveCfg = Release|Win32 + {7D4AFF6A-B7D9-4C25-975A-038B8079098E}.Release|Win32.Build.0 = Release|Win32 + {2EC7CEE3-C7A7-4F2E-B2C8-4DF6AFEC3E9A}.Debug|Win32.ActiveCfg = Debug|Win32 + {2EC7CEE3-C7A7-4F2E-B2C8-4DF6AFEC3E9A}.Debug|Win32.Build.0 = Debug|Win32 + {2EC7CEE3-C7A7-4F2E-B2C8-4DF6AFEC3E9A}.Release|Win32.ActiveCfg = Release|Win32 + {2EC7CEE3-C7A7-4F2E-B2C8-4DF6AFEC3E9A}.Release|Win32.Build.0 = Release|Win32 + {7F3178D0-0E2E-471B-9160-69F0354F9DE9}.Debug|Win32.ActiveCfg = Debug|Win32 + {7F3178D0-0E2E-471B-9160-69F0354F9DE9}.Debug|Win32.Build.0 = Debug|Win32 + {7F3178D0-0E2E-471B-9160-69F0354F9DE9}.Release|Win32.ActiveCfg = Release|Win32 + {7F3178D0-0E2E-471B-9160-69F0354F9DE9}.Release|Win32.Build.0 = Release|Win32 + {96969748-EA54-43FC-8103-A346E9AD98E7}.Debug|Win32.ActiveCfg = Debug|Win32 + {96969748-EA54-43FC-8103-A346E9AD98E7}.Debug|Win32.Build.0 = Debug|Win32 + {96969748-EA54-43FC-8103-A346E9AD98E7}.Release|Win32.ActiveCfg = Release|Win32 + {96969748-EA54-43FC-8103-A346E9AD98E7}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/projects/msvc8/mupen64plus-ui-console.vcproj b/projects/msvc8/mupen64plus-ui-console.vcproj new file mode 100644 index 0000000..0702fa9 --- /dev/null +++ b/projects/msvc8/mupen64plus-ui-console.vcproj @@ -0,0 +1,261 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="mupen64plus-ui-console" + ProjectGUID="{0E29D9F8-C675-4D21-AF16-AA80EDDB264E}" + RootNamespace="mupen64plusuiconsole" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="..\..\..\mupen64plus-core\src\api" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + CompileAs="2" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="..\..\..\mupen64plus-win32-deps\SDL-1.2.14\lib\SDLmain.lib" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Copying shared data and libraries to build directory..." + CommandLine="copy ..\..\..\mupen64plus-core\data\* "$(OutDir)"
copy ..\..\..\mupen64plus-video-rice\data\* "$(OutDir)"
copy ..\..\..\mupen64plus-win32-deps\freetype-2.3.5-1\bin\*.dll "$(OutDir)"
copy ..\..\..\mupen64plus-win32-deps\libpng-1.2.37\bin\*.dll "$(OutDir)"
copy ..\..\..\mupen64plus-win32-deps\SDL-1.2.14\lib\*.dll "$(OutDir)"
copy ..\..\..\mupen64plus-win32-deps\zlib-1.2 [...] + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="..\..\..\mupen64plus-core\src\api" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + CompileAs="2" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="..\..\..\mupen64plus-win32-deps\SDL-1.2.14\lib\SDLmain.lib" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + Description="Copying shared data and libraries to build directory..." + CommandLine="copy ..\..\..\mupen64plus-core\data\* "$(OutDir)"
copy ..\..\..\mupen64plus-video-rice\data\* "$(OutDir)"
copy ..\..\..\mupen64plus-win32-deps\freetype-2.3.5-1\bin\*.dll "$(OutDir)"
copy ..\..\..\mupen64plus-win32-deps\libpng-1.2.37\bin\*.dll "$(OutDir)"
copy ..\..\..\mupen64plus-win32-deps\SDL-1.2.14\lib\*.dll "$(OutDir)"
copy ..\..\..\mupen64plus-win32-deps\zlib-1.2 [...] + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\..\src\cheat.c" + > + </File> + <File + RelativePath="..\..\src\compare_core.c" + > + </File> + <File + RelativePath="..\..\src\core_interface.c" + > + </File> + <File + RelativePath="..\..\src\main.c" + > + </File> + <File + RelativePath="..\..\src\osal_dynamiclib_win32.c" + > + </File> + <File + RelativePath="..\..\src\osal_files_win32.c" + > + </File> + <File + RelativePath="..\..\src\plugin.c" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath="..\..\src\cheat.h" + > + </File> + <File + RelativePath="..\..\src\compare_core.h" + > + </File> + <File + RelativePath="..\..\src\core_interface.h" + > + </File> + <File + RelativePath="..\..\src\main.h" + > + </File> + <File + RelativePath="..\..\src\osal_dynamiclib.h" + > + </File> + <File + RelativePath="..\..\src\osal_files.h" + > + </File> + <File + RelativePath="..\..\src\osal_preproc.h" + > + </File> + <File + RelativePath="..\..\src\plugin.h" + > + </File> + <File + RelativePath="..\..\src\version.h" + > + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/projects/unix/Makefile b/projects/unix/Makefile index 936d8b3..e5b2669 100644 --- a/projects/unix/Makefile +++ b/projects/unix/Makefile @@ -22,6 +22,7 @@ # detect operation system UNAME = $(shell uname -s) +OS := NONE ifeq ("$(UNAME)","Linux") OS = LINUX endif @@ -34,10 +35,14 @@ endif ifeq ("$(UNAME)","FreeBSD") OS = FREEBSD endif +ifeq ("$(OS)","NONE") + $(error OS type "$(UNAME)" not supported. Please file bug report at 'http://code.google.com/p/mupen64plus/issues') +endif # detect system architecture HOST_CPU ?= $(shell uname -m) NO_ASM ?= 1 +CPU := NONE ifneq ("$(filter x86_64 amd64,$(HOST_CPU))","") CPU := X86 ifeq ("$(BITS)", "32") @@ -50,13 +55,17 @@ ifneq ("$(filter pentium i%86,$(HOST_CPU))","") CPU := X86 ARCH_DETECTED := 32BITS endif -ifneq ("$(filter ppc powerpc,$(HOST_CPU))","") - CPU := PPC - ARCH_DETECTED := 32BITS -endif -ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","") - CPU := PPC - ARCH_DETECTED := 64BITS +# 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 +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 @@ -122,15 +131,14 @@ else endif # set shell function names -CC = gcc -CXX = g++ -LD = g++ -INSTALL = install -ifeq ($(OS),LINUX) - STRIP = strip -s -endif +CC ?= gcc +CXX ?= g++ +LD ?= g++ +INSTALL ?= install ifeq ($(OS),OSX) - STRIP = strip -x + STRIP ?= strip -x +else + STRIP ?= strip -s endif # set special flags for given Makefile parameters @@ -197,6 +205,7 @@ targets: @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 " DESTDIR=path == path to prepend to all installation paths (only for packagers)" @echo " Debugging Options:" @echo " DEBUG=1 == add debugging symbols to application binary" @@ -208,13 +217,13 @@ clean: rebuild: clean all install: $(TARGET) - $(INSTALL) -d -v "$(BINDIR)" - $(INSTALL) -m 0755 $(TARGET) "$(BINDIR)" - $(INSTALL) -d -v "$(MANDIR)" - $(INSTALL) -m 0644 ../../doc/mupen64plus.6.gz "$(MANDIR)" + $(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)" uninstall: - rm -f "$(BINDIR)/$(TARGET)" "$(MANDIR)/mupen64plus.6.gz" + rm -f "$(DESTDIR)$(BINDIR)/$(TARGET)" "$(DESTDIR)$(MANDIR)/mupen64plus.6.gz" # build rules $(TARGET): $(OBJECTS) diff --git a/src/cheat.c b/src/cheat.c index 08f3b6f..43ec454 100644 --- a/src/cheat.c +++ b/src/cheat.c @@ -116,7 +116,7 @@ void CheatParseIni(const char *RomSection) fseek(fPtr, 0L, SEEK_END); long IniLength = ftell(fPtr); fseek(fPtr, 0L, SEEK_SET); - l_IniText = malloc(IniLength + 1); + l_IniText = (char *) malloc(IniLength + 1); if (l_IniText == NULL) { printf("UI-Console: Couldn't allocate %li bytes of memory to read cheat ini file.\n", IniLength); @@ -213,7 +213,6 @@ void CheatParseIni(const char *RomSection) continue; } /* Handle options for cheat codes */ - char *CheatOptions; if (sscanf(curline, "Cheat%i_O =%32s", &CheatNum, lineextra) == 2) { /* just skip it, options are too complicated for command-line UI */ diff --git a/src/compare_core.c b/src/compare_core.c index 946b1bd..b869001 100644 --- a/src/compare_core.c +++ b/src/compare_core.c @@ -24,6 +24,7 @@ #include <sys/stat.h> #include "m64p_types.h" +#include "main.h" #include "compare_core.h" #include "core_interface.h" @@ -48,8 +49,10 @@ static void stop_it(void) (*CoreDoCommand)(M64CMD_STOP, 0, NULL); errors++; +#if !defined(WIN32) if (errors > 7) asm("int $3;"); +#endif } static void display_error(char *txt) @@ -119,7 +122,7 @@ static void compare_core_check(unsigned int cur_opcode) sprintf(errHead, "Compare #%i old_op: %x op: %x\n", comparecnt++, old_op, cur_opcode); /* get pointer to current R4300 Program Counter address */ - ptr_PC = DebugGetCPUDataPtr(M64P_CPU_PC); /* this changes for every instruction */ + ptr_PC = (int *) DebugGetCPUDataPtr(M64P_CPU_PC); /* this changes for every instruction */ if (l_CoreCompareMode == CORE_COMPARE_RECV) { @@ -190,6 +193,11 @@ static void compare_core_check(unsigned int cur_opcode) /* global functions */ void compare_core_init(int mode) { +#if defined(WIN32) + if (g_Verbose) + printf("UI-console: core comparison feature not supported on Windows platform.\n"); + return; +#else /* set mode */ l_CoreCompareMode = mode; /* set callback functions in core */ @@ -200,9 +208,9 @@ void compare_core_init(int mode) return; } /* get pointers to emulated R4300 CPU registers */ - ptr_reg = DebugGetCPUDataPtr(M64P_CPU_REG_REG); - ptr_cop0 = DebugGetCPUDataPtr(M64P_CPU_REG_COP0); - ptr_fgr = DebugGetCPUDataPtr(M64P_CPU_REG_COP1_FGR_64); + ptr_reg = (long long *) DebugGetCPUDataPtr(M64P_CPU_REG_REG); + ptr_cop0 = (int *) DebugGetCPUDataPtr(M64P_CPU_REG_COP0); + ptr_fgr = (long long *) DebugGetCPUDataPtr(M64P_CPU_REG_COP1_FGR_64); /* open file handle to FIFO pipe */ if (l_CoreCompareMode == CORE_COMPARE_RECV) { @@ -215,5 +223,6 @@ void compare_core_init(int mode) printf("UI-console: Core Comparison Waiting to write pipe.\n"); fPipe = fopen("compare_pipe", "w"); } +#endif } diff --git a/src/core_interface.c b/src/core_interface.c index 6d73d64..1cc28ce 100644 --- a/src/core_interface.c +++ b/src/core_interface.c @@ -151,7 +151,7 @@ m64p_error AttachCoreLib(const char *CoreLibFilepath) CoreHandle = NULL; return M64ERR_INPUT_INVALID; } - m64p_plugin_type PluginType = 0; + m64p_plugin_type PluginType = (m64p_plugin_type) 0; int Compatible = 0; int CoreVersion = 0, APIVersion = 0; const char *CoreName = NULL; diff --git a/src/main.c b/src/main.c index 63902f5..2f3f62e 100644 --- a/src/main.c +++ b/src/main.c @@ -39,6 +39,7 @@ #include "plugin.h" #include "version.h" #include "core_interface.h" +#include "compare_core.h" #include "osal_preproc.h" /** global variables **/ @@ -225,7 +226,7 @@ static int *ParseNumberList(const char *InputString, int *ValuesFound) } /* create a list and populate it with the frame counter values at which to take screenshots */ - if ((OutputList = malloc(sizeof(int) * (values + 1))) != NULL) + if ((OutputList = (int *) malloc(sizeof(int) * (values + 1))) != NULL) { int idx = 0; str = InputString; diff --git a/src/osal_dynamiclib_win32.c b/src/osal_dynamiclib_win32.c new file mode 100644 index 0000000..4455cee --- /dev/null +++ b/src/osal_dynamiclib_win32.c @@ -0,0 +1,74 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Mupen64plus-ui-console - osal_dynamiclib_win32.c * + * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * + * Copyright (C) 2009 Richard Goedeken * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include <windows.h> +#include <stdlib.h> +#include <stdio.h> + +#include "m64p_types.h" +#include "osal_dynamiclib.h" + +m64p_error osal_dynlib_open(m64p_dynlib_handle *pLibHandle, const char *pccLibraryPath) +{ + if (pLibHandle == NULL || pccLibraryPath == NULL) + return M64ERR_INPUT_ASSERT; + + *pLibHandle = LoadLibrary(pccLibraryPath); + + if (*pLibHandle == NULL) + { + char *pchErrMsg; + DWORD dwErr = GetLastError(); + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErr, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pchErrMsg, 0, NULL); + fprintf(stderr, "LoadLibrary('%s') error: %s\n", pccLibraryPath, pchErrMsg); + LocalFree(pchErrMsg); + return M64ERR_INPUT_NOT_FOUND; + } + + return M64ERR_SUCCESS; +} + +void * osal_dynlib_getproc(m64p_dynlib_handle LibHandle, const char *pccProcedureName) +{ + if (pccProcedureName == NULL) + return NULL; + + return GetProcAddress(LibHandle, pccProcedureName); +} + +m64p_error osal_dynlib_close(m64p_dynlib_handle LibHandle) +{ + int rval = FreeLibrary(LibHandle); + + if (rval == 0) + { + char *pchErrMsg; + DWORD dwErr = GetLastError(); + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErr, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pchErrMsg, 0, NULL); + fprintf(stderr, "FreeLibrary() error: %s\n", pchErrMsg); + LocalFree(pchErrMsg); + return M64ERR_INTERNAL; + } + + return M64ERR_SUCCESS; +} diff --git a/src/osal_files_win32.c b/src/osal_files_win32.c index 810ae38..92da3a9 100644 --- a/src/osal_files_win32.c +++ b/src/osal_files_win32.c @@ -23,8 +23,83 @@ * */ +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <windows.h> + +#include "m64p_types.h" +#include "osal_preproc.h" +#include "osal_files.h" /* definitions for system directories to search when looking for mupen64plus plugins */ const int osal_libsearchdirs = 1; const char *osal_libsearchpath[1] = { ".\\" }; +osal_lib_search *osal_library_search(const char *searchpath) +{ + osal_lib_search *head = NULL, *curr = NULL; + WIN32_FIND_DATA entry; + HANDLE hDir; + + char *pchSearchPath = (char *) malloc(strlen(searchpath) + 16); + if (pchSearchPath == NULL) + { + fprintf(stderr, "Couldn't allocate memory for file search path in osal_library_search()!\n"); + return NULL; + } + sprintf(pchSearchPath, "%s\\*.dll", searchpath); + hDir = FindFirstFile(pchSearchPath, &entry); + free(pchSearchPath); + if (hDir == INVALID_HANDLE_VALUE) + return NULL; + + /* look for any shared libraries in this folder */ + do + { + osal_lib_search *newlib = NULL; + /* this is a .dll file, so add it to the list */ + newlib = (osal_lib_search *) malloc(sizeof(osal_lib_search)); + if (newlib == NULL) + { + fprintf(stderr, "Memory allocation error in osal_library_search()!\n"); + osal_free_lib_list(head); + FindClose(hDir); + return NULL; + } + if (head == NULL) + { + head = curr = newlib; + } + else + { + curr->next = newlib; + curr = newlib; + } + /* set up the filepath and filename members */ + strncpy(curr->filepath, searchpath, PATH_MAX-2); + curr->filepath[PATH_MAX-2] = 0; + if (curr->filepath[strlen(curr->filepath)-1] != '\\') + strcat(curr->filepath, "\\"); + int pathlen = (int) strlen(curr->filepath); + curr->filename = curr->filepath + pathlen; + strncat(curr->filepath, entry.cFileName, PATH_MAX - pathlen - 1); + curr->filepath[PATH_MAX-1] = 0; + /* set plugin_type and next pointer */ + curr->plugin_type = (m64p_plugin_type) 0; + curr->next = NULL; + } while (FindNextFile(hDir, &entry)); + + FindClose(hDir); + return head; +} + +void osal_free_lib_list(osal_lib_search *head) +{ + while (head != NULL) + { + osal_lib_search *next = head->next; + free(head); + head = next; + } +} diff --git a/src/plugin.c b/src/plugin.c index b1d63b8..671a5e6 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -57,11 +57,12 @@ static m64p_error PluginLoadTry(const char *filepath, int MapIndex) ptr_PluginGetVersion PluginGetVersion = (ptr_PluginGetVersion) osal_dynlib_getproc(handle, "PluginGetVersion"); if (PluginGetVersion == NULL) { - fprintf(stderr, "Error: library '%s' is not a Mupen64Plus library.\n", filepath); + if (g_Verbose) + fprintf(stderr, "Error: library '%s' is not a Mupen64Plus library.\n", filepath); osal_dynlib_close(handle); return M64ERR_INCOMPATIBLE; } - m64p_plugin_type PluginType = 0; + m64p_plugin_type PluginType = (m64p_plugin_type) 0; int PluginVersion = 0; const char *PluginName = NULL; (*PluginGetVersion)(&PluginType, &PluginVersion, NULL, &PluginName, NULL); @@ -74,7 +75,7 @@ static m64p_error PluginLoadTry(const char *filepath, int MapIndex) /* the front-end doesn't talk to the plugins, so we don't care about the plugin version or api version */ /* call the plugin's initialization function and make sure it starts okay */ - ptr_PluginStartup PluginStartup = osal_dynlib_getproc(handle, "PluginStartup"); + ptr_PluginStartup PluginStartup = (ptr_PluginStartup) osal_dynlib_getproc(handle, "PluginStartup"); if (PluginStartup == NULL) { fprintf(stderr, "Error: library '%s' broken. No PluginStartup() function found.\n", filepath); diff --git a/src/version.h b/src/version.h index e02cc7c..1d927bc 100644 --- a/src/version.h +++ b/src/version.h @@ -26,7 +26,7 @@ #if !defined(VERSION_H) #define VERSION_H -#define CONSOLE_UI_VERSION 0x016301 +#define CONSOLE_UI_VERSION 0x016302 #define CONSOLE_API_VERSION 0x10000 #define CONSOLE_UI_NAME "Mupen64Plus Console User-Interface" -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/mupen64plus-ui-console.git _______________________________________________ Pkg-games-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

