All hail Horst! God of the trash can!
This commit is contained in:
parent
9fd64cf0de
commit
7d73f700bc
|
@ -96,7 +96,7 @@
|
|||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /y $(OutDir)$(TargetName)$(TargetExt) $(TargetDir)..\..\..\..\..\output\dll\</Command>
|
||||
<Command>xcopy /y "$(OutDir)$(TargetName)$(TargetExt)" "$(TargetDir)..\..\..\..\..\output\dll\"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
Mupen64Plus-UI-Console INSTALL
|
||||
------------------------------
|
||||
|
||||
This text file was written to explain the installation process of the
|
||||
Mupen64Plus-UI-Console front-end module.
|
||||
|
||||
If this module is part of a Mupen64Plus source code bundle, the user should run
|
||||
the "m64p_install.sh" script in the root of the unzipped bundle to install all
|
||||
of the included modules in the bundle.
|
||||
|
||||
If this module is a standalone source code release, you should build the program
|
||||
from source code and install it via the makefile, like this:
|
||||
|
||||
$ cd projects/unix
|
||||
$ make all
|
||||
$ sudo make install
|
||||
|
||||
If you want to build the Mupen64Plus-UI-Console for installation in a home
|
||||
folder for a single user, you may build it like this (replacing <my-folder>
|
||||
with your desired local installation path):
|
||||
|
||||
$ cd projects/unix
|
||||
$ make all COREDIR=<my-folder> PLUGINDIR=<my-folder>
|
||||
$ make install BINDIR=<my-folder> MANDIR=<my-folder>
|
||||
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
Mupen64Plus-UI-Console README
|
||||
-----------------------------
|
||||
|
||||
README Sections
|
||||
1. Command-line options
|
||||
|
||||
1. Command-line options
|
||||
------------------------
|
||||
|
||||
Run 'mupen64plus --help' for a complete list of command-line options:
|
||||
|
||||
$ mupen64plus --help
|
||||
Usage: mupen64plus [parameter(s)] [romfile]
|
||||
|
||||
Parameters:
|
||||
--noosd : disable onscreen display
|
||||
--osd : enable onscreen display
|
||||
--fullscreen : use fullscreen display mode
|
||||
--windowed : use windowed display mode
|
||||
--resolution (res) : display resolution (640x480, 800x600, 1024x768, etc)
|
||||
--nospeedlimit : disable core speed limiter (should be used with dummy audio plugin)
|
||||
--cheats (cheat-spec) : enable or list cheat codes for the given rom file
|
||||
--corelib (filepath) : use core library (filepath) (can be only filename or full path)
|
||||
--configdir (dir) : force configation directory to (dir); should contain mupen64plus.conf
|
||||
--datadir (dir) : search for shared data files (.ini files, languages, etc) in (dir)
|
||||
--plugindir (dir) : search for plugins in (dir)
|
||||
--sshotdir (dir) : set screenshot directory to (dir)
|
||||
--gfx (plugin-spec) : use gfx plugin given by (plugin-spec)
|
||||
--audio (plugin-spec) : use audio plugin given by (plugin-spec)
|
||||
--input (plugin-spec) : use input plugin given by (plugin-spec)
|
||||
--rsp (plugin-spec) : use rsp plugin given by (plugin-spec)
|
||||
--emumode (mode) : set emu mode to: 0=Pure Interpreter 1=Interpreter 2=DynaRec
|
||||
--testshots (list) : take screenshots at frames given in comma-separated (list), then quit
|
||||
--set (param-spec) : set a configuration variable, format: ParamSection[ParamName]=Value
|
||||
--core-compare-send : use the Core Comparison debugging feature, in data sending mode
|
||||
--core-compare-recv : use the Core Comparison debugging feature, in data receiving mode
|
||||
--nosaveoptions : do not save the given command-line options in configuration file
|
||||
--verbose : print lots of information
|
||||
--help : see this help message
|
||||
|
||||
(plugin-spec):
|
||||
(pluginname) : filename (without path) of plugin to find in plugin directory
|
||||
(pluginpath) : full path and filename of plugin
|
||||
'dummy' : use dummy plugin
|
||||
|
||||
(cheat-spec):
|
||||
'list' : show all of the available cheat codes
|
||||
'all' : enable all of the available cheat codes
|
||||
(codelist) : a comma-separated list of cheat code numbers to enable,
|
||||
with dashes to use code variables (ex 1-2 to use cheat 1 option 2)
|
||||
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
Mupen64Plus-UI-Console RELEASE
|
||||
------------------------------
|
||||
|
||||
Mupen64Plus-UI-Console Front-End v1.99.5 - March 10, 2012
|
||||
---------------------------------------------------------
|
||||
- New option to disable internal core speed limiter (for benchmarking)
|
||||
- Updated Console-UI front-end for new Mupen64plus 2.0 API versioning
|
||||
- Added config version number for UI-Console section
|
||||
- makefile fixes and improvements
|
||||
|
||||
Mupen64Plus-UI-Console Front-End v1.99.4 - November 22, 2010
|
||||
------------------------------------------------------------
|
||||
- add some parameter checking for --emumode option
|
||||
- new cheat file format from spinout182
|
||||
- makefile fixes and improvements
|
||||
|
||||
Mupen64Plus-UI-Console Front-End v1.99.3 - February 13, 2010
|
||||
------------------------------------------------------------
|
||||
- New feature: command-line option --set for setting arbitrary configuration variables
|
||||
- updated MAN pgae for all the changes made in the 2.0 re-architecture
|
||||
- Makefile improvements:
|
||||
- added OS type GNU/kFreeBSD
|
||||
- add -lpthread to LIBS so that GDB will run the emulator without throwing a warning right after starting
|
||||
|
||||
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
|
||||
- New feature: R4300 Core Comparison for debugging
|
||||
- New feature: Cheat code support from command-line
|
||||
|
||||
|
|
@ -1,188 +0,0 @@
|
|||
.TH "mupen64plus" 6
|
||||
.SH NAME
|
||||
mupen64plus \- Console front\(hyend for the Mupen64Plus N64 emulator
|
||||
.SH SYNOPSIS
|
||||
.B mupen64plus
|
||||
[parameters(s)] [romfile]
|
||||
.SH DESCRIPTION
|
||||
Mupen64Plus is a plugin\(hybased N64 emulator for Linux/Unix, OSX, and Windows which is capable of accurately playing many games.
|
||||
Included are four MIPS R4300 CPU emulators, with dynamic recompilers for 32\(hybit x86 and 64\(hybit amd64 systems, and necessary plugins for audio, graphical rendering (RDP), signal co\(hyprocessor (RSP), and input.
|
||||
There are currently two OpenGL video plugins available: the included Rice Video, and Arachnoid (at http://bitbucket.org/wahrhaft/mupen64plus\-video\-arachnoid/).
|
||||
|
||||
The most current documentation can be found at the project's homepage:
|
||||
|
||||
http://code.google.com/p/mupen64plus
|
||||
.TP
|
||||
.B \-h, \-\-help
|
||||
Print help message.
|
||||
.TP
|
||||
.B \-\-noosd
|
||||
Disable onscreen display.
|
||||
.TP
|
||||
.B \-\-osd
|
||||
Enable onscreen display.
|
||||
.TP
|
||||
.B \-\-fullscreen
|
||||
Run emulator in fullscreen display mode.
|
||||
.TP
|
||||
.B \-\-windowed
|
||||
Run emulator in windowed display mode.
|
||||
.TP
|
||||
.B \-\-resolution \fRres
|
||||
Display resolution (640\(mu480, 800\(mu600, 1024\(mu768, etc)
|
||||
.TP
|
||||
.B \-\-cheats \fRcheat\(hyspec
|
||||
Enable or list cheat codes for the given rom file.
|
||||
.TP
|
||||
.B \-\-corelib \fRfilepath
|
||||
Specifies a filename (optionally with a preceding directory path) to load a specific Mupen64Plus core library.
|
||||
.TP
|
||||
.B \-\-configdir \fRdirectory
|
||||
Specifies a directory to look for the mupen64plus.cfg file.
|
||||
Default is \fI~/.config/mupen64plus/\fR.
|
||||
.TP
|
||||
.B \-\-datadir \fRdirectory
|
||||
Specifies a directory to search for shared data files (fonts, cheat codes, .ini files).
|
||||
Default is \fIPREFIX/share/mupen64plus/\fR.
|
||||
.TP
|
||||
.B \-\-plugindir \fRdirectory
|
||||
Specifies a directory to search for plugin files.
|
||||
Default is \fIPREFIX/lib/mupen64plus/\fR.
|
||||
.TP
|
||||
.B \-\-sshotdir \fRdirectory
|
||||
Specifies a directory to save screenshots captured during gameplay.
|
||||
Default is \fI~/.local/share/mupen64plus/screenshot/\fR.
|
||||
.TP
|
||||
.B \-\-gfx \fRplugin\(hyspec
|
||||
Specifies a \fIplugin\(hyspec\fR to select a graphics plugin for use during emulation.
|
||||
.TP
|
||||
.B \-\-audio \fRplugin\(hyspec
|
||||
Specifies a \fIplugin\(hyspec\fR to select an audio plugin for use during emulation.
|
||||
.TP
|
||||
.B \-\-input \fRplugin\(hyspec
|
||||
Specifies a \fIplugin\(hyspec\fR to select an input plugin for use during emulation.
|
||||
.TP
|
||||
.B \-\-rsp \fRplugin\(hyspec
|
||||
Specifies a \fIplugin\(hyspec\fR to select an RSP plugin for use during emulation.
|
||||
.TP
|
||||
.B \-\-emumode \fRmode
|
||||
Specifies which mode the emulator core should run in.
|
||||
\fImode\fR should be set to one of the following numbers: 0=Pure Interpreter, 1=Cached Interpreter, 2=Dynamic Recompiler (DynaRec).
|
||||
.TP
|
||||
.B \-\-testshots \fRlist
|
||||
Take screenshots at frames given in the comma\(hyseparated \fIlist\fR, then quit.
|
||||
.TP
|
||||
.B \-\-core\-compare\-send
|
||||
Use the core comparison debugging feature, in data sending mode.
|
||||
If the core was not compiled with support for the Core Comparison feature, then the emulator will exit with an error.
|
||||
.TP
|
||||
.B \-\-core\-compare\-recv
|
||||
Use the core comparison debugging feature, in data receiving mode.
|
||||
If the core was not compiled with support for the Core Comparison feature, then the emulator will exit with an error.
|
||||
.TP
|
||||
.B \-\-set \fRparam\(hyspec
|
||||
Set the value of a Mupen64Plus configuration parameter.
|
||||
This option may be used multiple times.
|
||||
The format of \fIparam\(hyspec\fR is Section\(hyName[Param\(hyName]=Value
|
||||
.TP
|
||||
.B \-\-saveoptions
|
||||
Save the given command\(hyline options into the mupen64plus configuration file to use as defaults in the future.
|
||||
Since the console front\(hyend needs to load the core library before reading the configuration file, the \-\-corelib option cannot be saved.
|
||||
.TP
|
||||
.B \-\-verbose
|
||||
Print lots of information.
|
||||
Useful for debugging but unnecessary for normal use.
|
||||
.SH plugin\(hyspec
|
||||
.TP
|
||||
.B (plugin\-name)
|
||||
Filename (without path) of plugin to use.
|
||||
Application will search through several directories to look for a matching plugin name.
|
||||
.TP
|
||||
.B (plugin\-path)
|
||||
Full directory path and filename of plugin.
|
||||
.TP
|
||||
.B 'dummy'
|
||||
Use the dummy plugin.
|
||||
.SH cheat\(hyspec
|
||||
.TP
|
||||
.B 'list'
|
||||
Show all of the available cheat codes.
|
||||
.TP
|
||||
.B 'all'
|
||||
Enable all of the available cheat codes.
|
||||
.TP
|
||||
.B (codelist)
|
||||
A comma separated list of cheat code numbers to enable.
|
||||
.SH KEY COMMANDS
|
||||
The following shortcut keys can be used during emulation.
|
||||
These are the default key values; nearly all of them may be set to different keys by editing the mupen64plus configuration file.
|
||||
.TP
|
||||
.B Escape
|
||||
Quit the emulator.
|
||||
.TP
|
||||
.B 0\-9
|
||||
Select virtual 'slot' for save/load state.
|
||||
.TP
|
||||
.B F5
|
||||
Save emulator state to current slot.
|
||||
.TP
|
||||
.B F7
|
||||
Load emulator state from current slot.
|
||||
.TP
|
||||
.B F9
|
||||
Reset emulator.
|
||||
.TP
|
||||
.B F10
|
||||
Slow down emulator speed by 5 percent.
|
||||
.TP
|
||||
.B F11
|
||||
Speed up emulator speed by 5 percent.
|
||||
.TP
|
||||
.B F12
|
||||
Take screenshot.
|
||||
.TP
|
||||
.B Alt\(hyEnter
|
||||
Toggle fullscreen mode.
|
||||
This is not supported on Windows.
|
||||
.TP
|
||||
.B p or P
|
||||
Pause/continue emulation.
|
||||
.TP
|
||||
.B m or M
|
||||
Mute/unmute sound.
|
||||
.TP
|
||||
.B f or F
|
||||
Fast Forward (playback at 250% normal speed as long as key is pressed).
|
||||
.TP
|
||||
.B g or G
|
||||
Press GameShark button (if cheats are enabled).
|
||||
.TP
|
||||
.B / or ?
|
||||
Advance one frame if paused.
|
||||
.TP
|
||||
.B [
|
||||
Decrease volume.
|
||||
.TP
|
||||
.B ]
|
||||
Increase volume.
|
||||
.SH FILES
|
||||
The default location for the Mupen64plus configuration file is \fI~/.config/mupen64plus/\fR.
|
||||
The default location of the saved screenshots is \fI~/.local/share/mupen64plus/screenshot/\fR.
|
||||
The default location of the save states is \fI~/.local/share/mupen64plus/save/\fR.
|
||||
.SH BUGS
|
||||
To report bugs or make feature requests, use the issue tracker on the Mupen64Plus project site:
|
||||
|
||||
http://code.google.com/p/mupen64plus/issues/list
|
||||
.SH AUTHORS
|
||||
Mupen64Plus was originally started by Richard42 and nmn, and is based on Mupen64 (originally written by Hacktarux).
|
||||
|
||||
This man page was written by ebenblues, and updated by Richard42.
|
||||
|
||||
.SH COPYRIGHT
|
||||
Mupen64Plus is \(co 2008\-2010 The Mupen64Plus Team
|
||||
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
||||
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-ui-console", "mupen64plus-ui-console.vcxproj", "{0E29D9F8-C675-4D21-AF16-AA80EDDB264E}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-core", "..\..\..\mupen64plus-core\projects\msvc11\mupen64plus-core.vcxproj", "{92D3FEB9-2129-41C5-8577-BCD7D961EF41}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-rsp-hle", "..\..\..\mupen64plus-rsp-hle\projects\msvc11\mupen64plus-rsp-hle.vcxproj", "{2EC7CEE3-C7A7-4F2E-B2C8-4DF6AFEC3E9A}"
|
||||
|
@ -20,10 +18,6 @@ Global
|
|||
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
|
||||
|
|
|
@ -1,141 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{0E29D9F8-C675-4D21-AF16-AA80EDDB264E}</ProjectGuid>
|
||||
<RootNamespace>mupen64plusuiconsole</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\mupen64plus-core\src\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>..\..\..\mupen64plus-win32-deps\SDL-1.2.14\lib\SDLmain.lib;%(AdditionalDependencies) </AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>Copying shared data and libraries to build directory...</Message>
|
||||
<Command>copy ..\..\..\mupen64plus-core\data\* "$(OutDir)"
|
||||
copy ..\..\..\mupen64plus-video-rice\data\* "$(OutDir)"
|
||||
copy ..\..\..\mupen64plus-input-sdl\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.3\bin\*.dll "$(OutDir)"
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\..\mupen64plus-core\src\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>..\..\..\mupen64plus-win32-deps\SDL-1.2.14\lib\SDLmain.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>Copying shared data and libraries to build directory...</Message>
|
||||
<Command>copy ..\..\..\mupen64plus-core\data\* "$(OutDir)"
|
||||
copy ..\..\..\mupen64plus-video-rice\data\* "$(OutDir)"
|
||||
copy ..\..\..\mupen64plus-input-sdl\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.3\bin\*.dll "$(OutDir)"
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\cheat.c" />
|
||||
<ClCompile Include="..\..\src\compare_core.c" />
|
||||
<ClCompile Include="..\..\src\core_interface.c" />
|
||||
<ClCompile Include="..\..\src\main.c" />
|
||||
<ClCompile Include="..\..\src\osal_dynamiclib_win32.c" />
|
||||
<ClCompile Include="..\..\src\osal_files_win32.c" />
|
||||
<ClCompile Include="..\..\src\plugin.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\cheat.h" />
|
||||
<ClInclude Include="..\..\src\compare_core.h" />
|
||||
<ClInclude Include="..\..\src\core_interface.h" />
|
||||
<ClInclude Include="..\..\src\main.h" />
|
||||
<ClInclude Include="..\..\src\osal_dynamiclib.h" />
|
||||
<ClInclude Include="..\..\src\osal_files.h" />
|
||||
<ClInclude Include="..\..\src\osal_preproc.h" />
|
||||
<ClInclude Include="..\..\src\plugin.h" />
|
||||
<ClInclude Include="..\..\src\version.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,56 +0,0 @@
|
|||
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}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{96969748-EA54-43FC-8103-A346E9AD98E7} = {96969748-EA54-43FC-8103-A346E9AD98E7}
|
||||
{7D4AFF6A-B7D9-4C25-975A-038B8079098E} = {7D4AFF6A-B7D9-4C25-975A-038B8079098E}
|
||||
{92D3FEB9-2129-41C5-8577-BCD7D961EF41} = {92D3FEB9-2129-41C5-8577-BCD7D961EF41}
|
||||
{7F3178D0-0E2E-471B-9160-69F0354F9DE9} = {7F3178D0-0E2E-471B-9160-69F0354F9DE9}
|
||||
{2EC7CEE3-C7A7-4F2E-B2C8-4DF6AFEC3E9A} = {2EC7CEE3-C7A7-4F2E-B2C8-4DF6AFEC3E9A}
|
||||
EndProjectSection
|
||||
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
|
|
@ -1,261 +0,0 @@
|
|||
<?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-input-sdl\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.3\bin\*.dll "$(OutDir)"
"
|
||||
/>
|
||||
</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-input-sdl\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.3\bin\*.dll "$(OutDir)"
"
|
||||
/>
|
||||
</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>
|
|
@ -1,331 +0,0 @@
|
|||
#/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
# * Mupen64plus - Makefile *
|
||||
# * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
|
||||
# * Copyright (C) 2009 Richard42 *
|
||||
# * *
|
||||
# * 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. *
|
||||
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
# Makefile for Mupen64plus-ui-console
|
||||
|
||||
# detect operation system
|
||||
UNAME ?= $(shell uname -s)
|
||||
OS := NONE
|
||||
ifeq ("$(UNAME)","Linux")
|
||||
OS = LINUX
|
||||
endif
|
||||
ifeq ("$(UNAME)","linux")
|
||||
OS = LINUX
|
||||
endif
|
||||
ifneq ("$(filter GNU hurd,$(UNAME))","")
|
||||
OS = LINUX
|
||||
endif
|
||||
ifeq ("$(UNAME)","Darwin")
|
||||
OS = OSX
|
||||
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
|
||||
ifeq ("$(patsubst MINGW%,MINGW,$(UNAME))","MINGW")
|
||||
OS = MINGW
|
||||
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")
|
||||
ARCH_DETECTED := 64BITS_32
|
||||
else
|
||||
ARCH_DETECTED := 64BITS
|
||||
endif
|
||||
endif
|
||||
ifneq ("$(filter pentium i%86,$(HOST_CPU))","")
|
||||
CPU := X86
|
||||
ARCH_DETECTED := 32BITS
|
||||
endif
|
||||
ifneq ("$(filter ppc macppc socppc 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
|
||||
ifneq ("$(filter arm%,$(HOST_CPU))","")
|
||||
ifeq ("$(filter arm%b,$(HOST_CPU))","")
|
||||
CPU := ARM
|
||||
ARCH_DETECTED := 32BITS
|
||||
$(warning Architecture "$(HOST_CPU)" not officially supported.')
|
||||
endif
|
||||
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, LDLIBS, and LDFLAGS
|
||||
OPTFLAGS ?= -O3
|
||||
WARNFLAGS ?= -Wall
|
||||
|
||||
# default configuration programs
|
||||
SDL_CONFIG = $(CROSS_COMPILE)sdl-config
|
||||
|
||||
CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -I../../src
|
||||
ifeq ($(OS), MINGW)
|
||||
CFLAGS += -lpthread
|
||||
LDLIBS += -lpthread
|
||||
else
|
||||
CFLAGS += -pthread
|
||||
LDLIBS += -pthread
|
||||
endif
|
||||
|
||||
ifeq ($(PIE), 1)
|
||||
CFLAGS += -fPIE
|
||||
LDFLAGS += -fPIE -pie
|
||||
else
|
||||
CFLAGS += -fno-PIE
|
||||
LDFLAGS += -fno-PIE
|
||||
endif
|
||||
|
||||
# set special flags per-system
|
||||
ifeq ($(OS), LINUX)
|
||||
LDLIBS += -ldl
|
||||
endif
|
||||
ifeq ($(OS), OSX)
|
||||
# Select the proper SDK
|
||||
# Also, SDKs are stored in a different location since XCode 4.3
|
||||
OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .)
|
||||
OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .)
|
||||
OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .)
|
||||
OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`")
|
||||
ifeq ($(OSX_XCODEGE43), 11)
|
||||
OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
|
||||
else
|
||||
OSX_SYSROOT := /Developer/SDKs
|
||||
endif
|
||||
|
||||
# The mac version of SDL requires inclusion of SDL_main in the executable
|
||||
CFLAGS += $(shell $(SDL_CONFIG) --cflags)
|
||||
LDLIBS += -ldl $(shell $(SDL_CONFIG) --libs)
|
||||
ifeq ($(CPU), X86)
|
||||
ifeq ($(ARCH_DETECTED), 64BITS)
|
||||
CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk
|
||||
LDFLAGS += -arch x86_64
|
||||
else
|
||||
CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk
|
||||
LDFLAGS += -arch i686
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS), MINGW)
|
||||
# Do NOT include SDL_main for Windows; we are building a console app!
|
||||
# NO -mwindows either! (it will still be a valid 32-bit Windows program)
|
||||
CFLAGS += -I/usr/local/include/SDL -D_GNU_SOURCE=1
|
||||
LDLIBS += -L/usr/local/lib -lmingw32 -lSDL
|
||||
endif
|
||||
|
||||
ifeq ($(BIG_ENDIAN), 1)
|
||||
CFLAGS += -DM64P_BIG_ENDIAN
|
||||
endif
|
||||
|
||||
# tweak flags for 32-bit build on 64-bit system
|
||||
ifeq ($(ARCH_DETECTED), 64BITS_32)
|
||||
ifeq ($(OS), FREEBSD)
|
||||
$(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
|
||||
endif
|
||||
CFLAGS += -m32
|
||||
LDFLAGS += -m32 -Wl,-m,elf_i386
|
||||
endif
|
||||
|
||||
# set mupen64plus core API header path
|
||||
ifneq ("$(APIDIR)","")
|
||||
CFLAGS += "-I$(APIDIR)"
|
||||
else
|
||||
TRYDIR = ../../../mupen64plus-core/src/api
|
||||
ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","")
|
||||
CFLAGS += -I$(TRYDIR)
|
||||
else
|
||||
TRYDIR = /usr/local/include/mupen64plus
|
||||
ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","")
|
||||
CFLAGS += -I$(TRYDIR)
|
||||
else
|
||||
TRYDIR = /usr/include/mupen64plus
|
||||
ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","")
|
||||
CFLAGS += -I$(TRYDIR)
|
||||
else
|
||||
$(error Mupen64Plus API header files not found! Use makefile parameter APIDIR to force a location.)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# 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 = $(CROSS_COMPILE)gcc
|
||||
CXX = $(CROSS_COMPILE)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),)
|
||||
CFLAGS += '-DPLUGINDIR="$(PLUGINDIR)"'
|
||||
endif
|
||||
ifneq ($(COREDIR),)
|
||||
CFLAGS += '-DCOREDIR="$(COREDIR)"'
|
||||
endif
|
||||
ifneq ($(SHAREDIR),)
|
||||
CFLAGS += '-DSHAREDIR="$(SHAREDIR)"'
|
||||
endif
|
||||
ifeq ($(DEBUG),1)
|
||||
CFLAGS += -g
|
||||
INSTALL_STRIP_FLAG ?=
|
||||
else
|
||||
INSTALL_STRIP_FLAG ?= -s
|
||||
endif
|
||||
|
||||
# set installation options
|
||||
ifeq ($(PREFIX),)
|
||||
PREFIX := /usr/local
|
||||
endif
|
||||
ifeq ($(BINDIR),)
|
||||
BINDIR := $(PREFIX)/bin
|
||||
endif
|
||||
ifeq ($(MANDIR),)
|
||||
MANDIR := $(PREFIX)/share/man
|
||||
endif
|
||||
|
||||
SRCDIR = ../../src
|
||||
OBJDIR = _obj$(POSTFIX)
|
||||
|
||||
ifeq ("$(OS)","MINGW")
|
||||
EXEEXT = .exe
|
||||
else
|
||||
EXEEXT =
|
||||
endif
|
||||
|
||||
# list of source files to compile
|
||||
SOURCE = \
|
||||
$(SRCDIR)/cheat.c \
|
||||
$(SRCDIR)/compare_core.c \
|
||||
$(SRCDIR)/core_interface.c \
|
||||
$(SRCDIR)/main.c \
|
||||
$(SRCDIR)/plugin.c
|
||||
|
||||
ifeq ($(OS), MINGW)
|
||||
SOURCE += \
|
||||
$(SRCDIR)/osal_dynamiclib_win32.c \
|
||||
$(SRCDIR)/osal_files_win32.c
|
||||
else
|
||||
SOURCE += \
|
||||
$(SRCDIR)/osal_dynamiclib_unix.c \
|
||||
$(SRCDIR)/osal_files_unix.c
|
||||
endif
|
||||
|
||||
# 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) $(OBJDIRS))
|
||||
|
||||
# build targets
|
||||
TARGET = mupen64plus$(POSTFIX)$(EXEEXT)
|
||||
|
||||
targets:
|
||||
@echo "Mupen64Plus-ui-console makefile."
|
||||
@echo " Targets:"
|
||||
@echo " all == Build Mupen64Plus console front-end application"
|
||||
@echo " clean == remove object files and build products"
|
||||
@echo " rebuild == clean and re-build all"
|
||||
@echo " install == Install Mupen64Plus console front-end application"
|
||||
@echo " uninstall == Uninstall Mupen64Plus console front-end application"
|
||||
@echo " Options:"
|
||||
@echo " COREDIR=path == default path to search for Mupen64Plus Core (must end with slash)"
|
||||
@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 " WARNFLAGS=flag == compiler warning levels (default: -Wall)"
|
||||
@echo " PIE=(1|0) == Force enable/disable of position independent executables"
|
||||
@echo " POSTFIX=name == String added to the name of the the build (default: '')"
|
||||
@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/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 " LTO=1 == enable experimental build with link-time optimization"
|
||||
@echo " V=1 == show verbose compiler output"
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
clean:
|
||||
$(RM) -r $(OBJDIR) $(TARGET)
|
||||
|
||||
rebuild: clean all
|
||||
|
||||
install: $(TARGET)
|
||||
$(INSTALL) -d "$(DESTDIR)$(BINDIR)"
|
||||
$(INSTALL) -m 0755 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(BINDIR)"
|
||||
$(INSTALL) -d "$(DESTDIR)$(MANDIR)/man6"
|
||||
$(INSTALL) -m 0644 ../../doc/mupen64plus.6 "$(DESTDIR)$(MANDIR)/man6"
|
||||
|
||||
uninstall:
|
||||
$(RM) "$(DESTDIR)$(BINDIR)/$(TARGET)" "$(DESTDIR)$(MANDIR)/man6/mupen64plus.6"
|
||||
|
||||
# build dependency files
|
||||
CFLAGS += -MD
|
||||
-include $(OBJECTS:.o=.d)
|
||||
|
||||
ifeq ($(LTO), 1)
|
||||
CFLAGS += -flto
|
||||
LDFLAGS += -fuse-linker-plugin -fwhole-program $(CFLAGS)
|
||||
endif
|
||||
|
||||
# standard build rules
|
||||
$(OBJDIR)/%.o: $(SRCDIR)/%.c
|
||||
$(COMPILE.c) -o $@ $<
|
||||
|
||||
$(TARGET): $(OBJECTS)
|
||||
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
|
||||
|
||||
.PHONY: all clean install uninstall targets
|
|
@ -1,458 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus - cheat.c *
|
||||
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
|
||||
* Copyright (C) 2009-2010 Richard Goedeken *
|
||||
* Copyright (C) 2010 Rhett Osborne (spinout) *
|
||||
* *
|
||||
* 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 <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "m64p_types.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "cheat.h"
|
||||
#include "core_interface.h"
|
||||
|
||||
/* local definitions */
|
||||
#define CHEAT_FILE "mupencheat.txt"
|
||||
|
||||
typedef struct {
|
||||
int address;
|
||||
int *variables;
|
||||
char **variable_names;
|
||||
int var_to_use;
|
||||
int var_count;
|
||||
} cheat_code;
|
||||
|
||||
typedef struct _sCheatInfo {
|
||||
int Number;
|
||||
int Count;
|
||||
int VariableLine;
|
||||
const char *Name;
|
||||
const char *Description;
|
||||
cheat_code *Codes;
|
||||
struct _sCheatInfo *Next;
|
||||
} sCheatInfo;
|
||||
|
||||
/* local variables */
|
||||
static m64p_rom_header l_RomHeader;
|
||||
static char *l_IniText = NULL;
|
||||
static char *l_CheatGameName = NULL;
|
||||
static sCheatInfo *l_CheatList = NULL;
|
||||
static int l_CheatCodesFound = 0;
|
||||
static int l_RomFound = 0;
|
||||
|
||||
/*********************************************************************************************************
|
||||
* Static (Local) functions
|
||||
*/
|
||||
|
||||
static int isSpace(char ch)
|
||||
{
|
||||
return (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n');
|
||||
}
|
||||
|
||||
/* Find cheat code */
|
||||
static sCheatInfo *CheatFindCode(int Number)
|
||||
{
|
||||
sCheatInfo *pCur = l_CheatList;
|
||||
while (pCur != NULL)
|
||||
{
|
||||
if (pCur->Number == Number) break;
|
||||
pCur = pCur->Next;
|
||||
}
|
||||
return pCur;
|
||||
}
|
||||
|
||||
|
||||
/* Activate a code */
|
||||
static void CheatActivate(sCheatInfo *pCheat)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Get a m64p_cheat_code object */
|
||||
m64p_cheat_code * code = (m64p_cheat_code*) calloc(pCheat->Count, sizeof(m64p_cheat_code));
|
||||
if (code == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_WARNING, "could not allocate memory for code '%s'", pCheat->Name);
|
||||
return;
|
||||
}
|
||||
/* Fill in members */
|
||||
for (i = 0; i < pCheat->Count; i++)
|
||||
{
|
||||
code[i].address = pCheat->Codes[i].address;
|
||||
code[i].value = pCheat->Codes[i].variables[pCheat->Codes[i].var_to_use];
|
||||
}
|
||||
/* Enable cheat */
|
||||
if (CoreAddCheat(pCheat->Name, code, pCheat->Count) != M64ERR_SUCCESS)
|
||||
{
|
||||
DebugMessage(M64MSG_WARNING, "CoreAddCheat() failed for cheat code %i (%s)", pCheat->Number, pCheat->Name);
|
||||
free(code);
|
||||
return;
|
||||
}
|
||||
|
||||
free(code);
|
||||
DebugMessage(M64MSG_STATUS, "activated cheat code %i: %s", pCheat->Number, pCheat->Name);
|
||||
}
|
||||
|
||||
static void CheatFreeAll(void)
|
||||
{
|
||||
if (l_IniText != NULL)
|
||||
free(l_IniText);
|
||||
l_IniText = NULL;
|
||||
|
||||
sCheatInfo *pCur = l_CheatList;
|
||||
while (pCur != NULL)
|
||||
{
|
||||
sCheatInfo *pNext = pCur->Next;
|
||||
if (pCur->Codes != NULL)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < pCur->Count; i++)
|
||||
{
|
||||
if (pCur->Codes[i].variables != NULL)
|
||||
free(pCur->Codes[i].variables);
|
||||
if (pCur->Codes[i].variable_names != NULL)
|
||||
free(pCur->Codes[i].variable_names);
|
||||
}
|
||||
free(pCur->Codes);
|
||||
}
|
||||
free(pCur);
|
||||
pCur = pNext;
|
||||
}
|
||||
|
||||
l_CheatList = NULL;
|
||||
}
|
||||
|
||||
/* Append new code */
|
||||
static sCheatInfo * NewCode(char *CheatName, int CheatNum)
|
||||
{
|
||||
/* allocate memory for a new sCheatInfo struct */
|
||||
sCheatInfo *pNew = (sCheatInfo *) malloc(sizeof(sCheatInfo));
|
||||
if (pNew == NULL) return NULL;
|
||||
|
||||
/* fill in the data members */
|
||||
pNew->Number = CheatNum;
|
||||
pNew->Count = 0;
|
||||
pNew->VariableLine = -1;
|
||||
pNew->Name = CheatName;
|
||||
pNew->Description = NULL;
|
||||
pNew->Codes = NULL;
|
||||
pNew->Next = NULL;
|
||||
|
||||
l_CheatCodesFound++;
|
||||
|
||||
/* stick it at the end of the list */
|
||||
if (l_CheatList == NULL)
|
||||
{
|
||||
l_CheatList = pNew;
|
||||
return pNew;
|
||||
}
|
||||
sCheatInfo *pLast = l_CheatList;
|
||||
while (pLast->Next != NULL) pLast = pLast->Next;
|
||||
pLast->Next = pNew;
|
||||
return pNew;
|
||||
}
|
||||
|
||||
static void CheatAddVariables(cheat_code * Code, char *varlist)
|
||||
{
|
||||
/* needs to be more verbose? */
|
||||
Code->variables = NULL;
|
||||
Code->variable_names = NULL;
|
||||
Code->var_count = 0;
|
||||
while (*varlist != 0)
|
||||
{
|
||||
if ((Code->variables = (int*) realloc(Code->variables, sizeof(int) * (Code->var_count + 1))) == NULL)
|
||||
return;
|
||||
if ((Code->variable_names = (char**) realloc(Code->variable_names, sizeof(char*) * (Code->var_count + 1))) == NULL)
|
||||
return;
|
||||
if (sscanf(varlist, "%04X", &Code->variables[Code->var_count]) != 1)
|
||||
Code->variables[Code->var_count] = 0;
|
||||
if (strchr(varlist, '"') == NULL)
|
||||
return;
|
||||
Code->variable_names[Code->var_count] = strchr(varlist, '"') + 1;
|
||||
if ((varlist = strchr(Code->variable_names[Code->var_count], '"')) == NULL)
|
||||
return;
|
||||
*varlist++ = 0;
|
||||
if (*varlist == ',')
|
||||
varlist++;
|
||||
Code->var_count++;
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************************************************
|
||||
* global functions
|
||||
*/
|
||||
|
||||
static void ReadCheats(char *RomSection)
|
||||
{
|
||||
sCheatInfo *curr_code = NULL;
|
||||
const char *romdbpath = ConfigGetSharedDataFilepath(CHEAT_FILE);
|
||||
if (romdbpath == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_WARNING, "cheat code database file '%s' not found.", CHEAT_FILE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* read the INI file into a new buffer */
|
||||
FILE *fPtr = NULL;
|
||||
fPtr = fopen(romdbpath, "rb");
|
||||
if (fPtr == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_WARNING, "Couldn't open cheat code database file '%s'.", romdbpath);
|
||||
return;
|
||||
}
|
||||
fseek(fPtr, 0L, SEEK_END);
|
||||
long IniLength = ftell(fPtr);
|
||||
fseek(fPtr, 0L, SEEK_SET);
|
||||
l_IniText = (char *) malloc(IniLength + 1);
|
||||
if (l_IniText == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_WARNING, "Couldn't allocate %li bytes of memory to read cheat file.", IniLength);
|
||||
fclose(fPtr);
|
||||
return;
|
||||
}
|
||||
if (fread(l_IniText, 1, IniLength, fPtr) != IniLength)
|
||||
{
|
||||
DebugMessage(M64MSG_WARNING, "Couldn't read %li bytes from cheat file.", IniLength);
|
||||
free(l_IniText);
|
||||
l_IniText = NULL;
|
||||
fclose(fPtr);
|
||||
return;
|
||||
}
|
||||
fclose(fPtr);
|
||||
l_IniText[IniLength] = 0; /* null-terminate the text data */
|
||||
|
||||
/* parse lines from cheat database */
|
||||
char *curline = NULL;
|
||||
char *nextline = l_IniText;
|
||||
|
||||
while(nextline != NULL && *nextline != 0)
|
||||
{
|
||||
curline = nextline;
|
||||
/* get pointer to next line and NULL-terminate the current line */
|
||||
nextline = strchr(curline, '\n');
|
||||
if (nextline != NULL)
|
||||
{
|
||||
*nextline = 0;
|
||||
nextline++;
|
||||
}
|
||||
|
||||
/* remove leading and trailing white space */
|
||||
while(isSpace(*curline)) curline++;
|
||||
char *endptr = curline + strlen(curline) - 1;
|
||||
while(isSpace(*endptr)) *endptr-- = 0;
|
||||
|
||||
/* ignore line if comment or empty */
|
||||
if (*curline == '#' || strncmp(curline, "//", 2) == 0 || *curline == 0)
|
||||
continue;
|
||||
|
||||
/* handle beginning of new rom section */
|
||||
if (strncmp(curline, "crc ", 4) == 0)
|
||||
{
|
||||
/* if we have already found cheats for the given ROM file, then exit upon encountering a new ROM section */
|
||||
if (l_RomFound && (l_CheatGameName != NULL || l_CheatList != NULL))
|
||||
return;
|
||||
/* else see if this Rom Section matches */
|
||||
if (strcmp(curline+4, RomSection) == 0)
|
||||
l_RomFound = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* if we haven't found the specified ROM section, then continue looking */
|
||||
if (!l_RomFound)
|
||||
continue;
|
||||
|
||||
/* Game name */
|
||||
if (strncmp(curline, "gn ", 3) == 0)
|
||||
{
|
||||
l_CheatGameName = curline+3;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* code name */
|
||||
if (strncmp(curline, "cn ", 3) == 0)
|
||||
{
|
||||
curr_code = NewCode(curline + 3, l_CheatCodesFound);
|
||||
if (curr_code == NULL)
|
||||
DebugMessage(M64MSG_WARNING, "error getting new code (%s)", curline+3);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* if curr_code is NULL, don't do these checks */
|
||||
if (curr_code == NULL)
|
||||
continue;
|
||||
|
||||
/* code description */
|
||||
if (strncmp(curline, "cd ", 3) == 0)
|
||||
{
|
||||
curr_code->Description = curline+3;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* code line */
|
||||
int address;
|
||||
if (sscanf(curline, "%8X %*s", &address) == 1)
|
||||
{
|
||||
curr_code->Codes = (cheat_code*) realloc(curr_code->Codes, sizeof(cheat_code) * (curr_code->Count + 1));
|
||||
if (strncmp(curline+9, "????", 4) == 0)
|
||||
{
|
||||
curr_code->Codes[curr_code->Count].var_count = 0;
|
||||
CheatAddVariables(&curr_code->Codes[curr_code->Count], curline+14);
|
||||
curr_code->VariableLine = curr_code->Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
int var;
|
||||
curr_code->Codes[curr_code->Count].var_count = 1;
|
||||
curr_code->Codes[curr_code->Count].variables = (int*) malloc(sizeof(int));
|
||||
if(curr_code->Codes[curr_code->Count].variables == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_WARNING, "couldn't allocate memory; ignoring line: '%s'", curline);
|
||||
continue;
|
||||
}
|
||||
if (sscanf(curline+9, "%04X", &var) != 1)
|
||||
var = 0;
|
||||
curr_code->Codes[curr_code->Count].variables[0] = var;
|
||||
curr_code->Codes[curr_code->Count].variable_names = NULL;
|
||||
}
|
||||
curr_code->Codes[curr_code->Count].var_to_use = 0;
|
||||
curr_code->Codes[curr_code->Count].address = address;
|
||||
curr_code->Count++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* otherwise we don't know what this line is */
|
||||
DebugMessage(M64MSG_WARNING, "unrecognized line in cheat file: '%s'", curline);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CheatStart(eCheatMode CheatMode, char *CheatNumList)
|
||||
{
|
||||
/* if cheat codes are disabled, then we don't have to do anything */
|
||||
if (CheatMode == CHEAT_DISABLE || (CheatMode == CHEAT_LIST && strlen(CheatNumList) == 0))
|
||||
{
|
||||
DebugMessage(M64MSG_STATUS, "Cheat codes disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
/* get the ROM header for the currently loaded ROM image from the core */
|
||||
if ((*CoreDoCommand)(M64CMD_ROM_GET_HEADER, sizeof(l_RomHeader), &l_RomHeader) != M64ERR_SUCCESS)
|
||||
{
|
||||
DebugMessage(M64MSG_WARNING, "couldn't get ROM header information from core library");
|
||||
return;
|
||||
}
|
||||
|
||||
/* generate section name from ROM's CRC and country code */
|
||||
char RomSection[24];
|
||||
sprintf(RomSection, "%08X-%08X-C:%X", sl(l_RomHeader.CRC1), sl(l_RomHeader.CRC2), l_RomHeader.Country_code & 0xff);
|
||||
|
||||
/* parse through the cheat INI file and load up any cheat codes found for this ROM */
|
||||
ReadCheats(RomSection);
|
||||
if (!l_RomFound || l_CheatCodesFound == 0)
|
||||
{
|
||||
DebugMessage(M64MSG_WARNING, "no cheat codes found for ROM image '%.20s'", l_RomHeader.Name);
|
||||
CheatFreeAll();
|
||||
return;
|
||||
}
|
||||
|
||||
/* handle the list command */
|
||||
if (CheatMode == CHEAT_SHOW_LIST)
|
||||
{
|
||||
DebugMessage(M64MSG_INFO, "%i cheat code(s) found for ROM '%s'", l_CheatCodesFound, l_CheatGameName);
|
||||
sCheatInfo *pCur = l_CheatList;
|
||||
while (pCur != NULL)
|
||||
{
|
||||
if (pCur->Description == NULL)
|
||||
DebugMessage(M64MSG_INFO, " %i: %s", pCur->Number, pCur->Name);
|
||||
else
|
||||
DebugMessage(M64MSG_INFO, " %i: %s (%s)", pCur->Number, pCur->Name, pCur->Description);
|
||||
if(pCur->VariableLine != -1)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < pCur->Codes[pCur->VariableLine].var_count; i++)
|
||||
DebugMessage(M64MSG_INFO, " %i: %s", i, pCur->Codes[pCur->VariableLine].variable_names[i]);
|
||||
}
|
||||
pCur = pCur->Next;
|
||||
}
|
||||
CheatFreeAll();
|
||||
return;
|
||||
}
|
||||
|
||||
/* handle all cheats enabled mode */
|
||||
if (CheatMode == CHEAT_ALL)
|
||||
{
|
||||
sCheatInfo *pCur = l_CheatList;
|
||||
while (pCur != NULL)
|
||||
{
|
||||
CheatActivate(pCur);
|
||||
pCur = pCur->Next;
|
||||
}
|
||||
CheatFreeAll();
|
||||
return;
|
||||
}
|
||||
|
||||
/* handle list of cheats enabled mode */
|
||||
if (CheatMode == CHEAT_LIST)
|
||||
{
|
||||
int option, number;
|
||||
char *cheat_next;
|
||||
sCheatInfo *pCheat;
|
||||
while(CheatNumList != NULL && *CheatNumList)
|
||||
{
|
||||
if ((cheat_next = strchr(CheatNumList, ',')) != NULL)
|
||||
{
|
||||
*cheat_next = 0;
|
||||
cheat_next ++;
|
||||
}
|
||||
|
||||
if (strchr(CheatNumList, '-') != NULL)
|
||||
{
|
||||
sscanf(CheatNumList, "%i-%i", &number, &option); /* option */
|
||||
}
|
||||
else
|
||||
{
|
||||
option=0;
|
||||
sscanf(CheatNumList, "%i", &number);
|
||||
}
|
||||
|
||||
pCheat = CheatFindCode(number);
|
||||
if (pCheat == NULL)
|
||||
DebugMessage(M64MSG_WARNING, "invalid cheat code number %i", number);
|
||||
else
|
||||
{
|
||||
if (pCheat->VariableLine != -1 && pCheat->Count > pCheat->VariableLine && option < pCheat->Codes[pCheat->VariableLine].var_count)
|
||||
pCheat->Codes[pCheat->VariableLine].var_to_use = option;
|
||||
CheatActivate(pCheat);
|
||||
}
|
||||
|
||||
CheatNumList = cheat_next;
|
||||
}
|
||||
CheatFreeAll();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* otherwise the mode is invalid */
|
||||
DebugMessage(M64MSG_WARNING, "internal error; invalid CheatMode in CheatStart()");
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus - cheat.h *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef CHEAT_H
|
||||
#define CHEAT_H
|
||||
|
||||
#ifdef M64P_BIG_ENDIAN
|
||||
#define sl(mot) mot
|
||||
#else
|
||||
#define sl(mot) (((mot & 0xFF) << 24) | ((mot & 0xFF00) << 8) | ((mot & 0xFF0000) >> 8) | ((mot & 0xFF000000) >> 24))
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
CHEAT_DISABLE,
|
||||
CHEAT_LIST,
|
||||
CHEAT_ALL,
|
||||
CHEAT_SHOW_LIST
|
||||
} eCheatMode;
|
||||
|
||||
void CheatStart(eCheatMode CheatMode, char *CheatNumList);
|
||||
|
||||
#endif // #define CHEAT_H
|
||||
|
|
@ -1,230 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus - compare_core.h *
|
||||
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
|
||||
* Copyright (C) 2009 Richard Goedeken *
|
||||
* Copyright (C) 2002 Hacktarux *
|
||||
* *
|
||||
* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "m64p_types.h"
|
||||
#include "main.h"
|
||||
#include "compare_core.h"
|
||||
#include "core_interface.h"
|
||||
|
||||
/* local variables */
|
||||
|
||||
static FILE *fPipe = NULL;
|
||||
static int comp_reg_32[32];
|
||||
static long long comp_reg_64[32];
|
||||
static unsigned int old_op = 0;
|
||||
static int l_CoreCompareMode = CORE_COMPARE_DISABLE;
|
||||
|
||||
static long long *ptr_reg = NULL; /* pointer to the 64-bit general purpose registers in the core */
|
||||
static int *ptr_cop0 = NULL; /* pointer to the 32-bit Co-processor 0 registers in the core */
|
||||
static long long *ptr_fgr = NULL; /* pointer to the 64-bit floating-point registers in the core */
|
||||
static int *ptr_PC = NULL; /* pointer to 32-bit R4300 Program Counter */
|
||||
|
||||
/* local functions */
|
||||
static void stop_it(void)
|
||||
{
|
||||
static int errors = 0;
|
||||
|
||||
(*CoreDoCommand)(M64CMD_STOP, 0, NULL);
|
||||
|
||||
errors++;
|
||||
#if !defined(WIN32)
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
if (errors > 7)
|
||||
asm("int $3;");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void display_error(char *txt)
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("err: %6s addr:%x\t ", txt, *ptr_PC);
|
||||
|
||||
if (!strcmp(txt, "PC"))
|
||||
{
|
||||
printf("My PC: %x Ref PC: %x\t ", *ptr_PC, *comp_reg_32);
|
||||
}
|
||||
else if (!strcmp(txt, "gpr"))
|
||||
{
|
||||
for (i=0; i<32; i++)
|
||||
{
|
||||
if (ptr_reg[i] != comp_reg_64[i])
|
||||
printf("My: reg[%d]=%llx\t Ref: reg[%d]=%llx\t ", i, ptr_reg[i], i, comp_reg_64[i]);
|
||||
}
|
||||
}
|
||||
else if (!strcmp(txt, "cop0"))
|
||||
{
|
||||
for (i=0; i<32; i++)
|
||||
{
|
||||
if (ptr_cop0[i] != comp_reg_32[i])
|
||||
printf("My: reg_cop0[%d]=%x\t Ref: reg_cop0[%d]=%x\t ", i, (unsigned int)ptr_cop0[i], i, (unsigned int)comp_reg_32[i]);
|
||||
}
|
||||
}
|
||||
else if (!strcmp(txt, "cop1"))
|
||||
{
|
||||
for (i=0; i<32; i++)
|
||||
{
|
||||
if (ptr_fgr[i] != comp_reg_64[i])
|
||||
printf("My: reg[%d]=%llx\t Ref: reg[%d]=%llx\t ", i, ptr_fgr[i], i, comp_reg_64[i]);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
/*for (i=0; i<32; i++)
|
||||
{
|
||||
if (reg_cop0[i] != comp_reg[i])
|
||||
printf("reg_cop0[%d]=%llx != reg[%d]=%llx\n",
|
||||
i, reg_cop0[i], i, comp_reg[i]);
|
||||
}*/
|
||||
|
||||
stop_it();
|
||||
}
|
||||
|
||||
static void compare_core_sync_data(int length, void *value)
|
||||
{
|
||||
if (l_CoreCompareMode == CORE_COMPARE_RECV)
|
||||
{
|
||||
if (fread(value, 1, length, fPipe) != length)
|
||||
stop_it();
|
||||
}
|
||||
else if (l_CoreCompareMode == CORE_COMPARE_SEND)
|
||||
{
|
||||
if (fwrite(value, 1, length, fPipe) != length)
|
||||
stop_it();
|
||||
}
|
||||
}
|
||||
|
||||
static void compare_core_check(unsigned int cur_opcode)
|
||||
{
|
||||
static int comparecnt = 0;
|
||||
int iFirst = 1;
|
||||
char errHead[128];
|
||||
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 = (int *) DebugGetCPUDataPtr(M64P_CPU_PC); /* this changes for every instruction */
|
||||
|
||||
if (l_CoreCompareMode == CORE_COMPARE_RECV)
|
||||
{
|
||||
if (fread(comp_reg_32, sizeof(int), 4, fPipe) != 4)
|
||||
printf("compare_core_check: fread() failed");
|
||||
if (*ptr_PC != *comp_reg_32)
|
||||
{
|
||||
if (iFirst)
|
||||
{
|
||||
printf("%s", errHead);
|
||||
iFirst = 0;
|
||||
}
|
||||
display_error("PC");
|
||||
}
|
||||
if (fread (comp_reg_64, sizeof(long long int), 32, fPipe) != 32)
|
||||
printf("compare_core_check: fread() failed");
|
||||
if (memcmp(ptr_reg, comp_reg_64, 32*sizeof(long long int)) != 0)
|
||||
{
|
||||
if (iFirst)
|
||||
{
|
||||
printf("%s", errHead);
|
||||
iFirst = 0;
|
||||
}
|
||||
display_error("gpr");
|
||||
}
|
||||
if (fread(comp_reg_32, sizeof(int), 32, fPipe) != 32)
|
||||
printf("compare_core_check: fread() failed");
|
||||
if (memcmp(ptr_cop0, comp_reg_32, 32*sizeof(int)) != 0)
|
||||
{
|
||||
if (iFirst)
|
||||
{
|
||||
printf("%s", errHead);
|
||||
iFirst = 0;
|
||||
}
|
||||
display_error("cop0");
|
||||
}
|
||||
if (fread(comp_reg_64, sizeof(long long int), 32, fPipe) != 32)
|
||||
printf("compare_core_check: fread() failed");
|
||||
if (memcmp(ptr_fgr, comp_reg_64, 32*sizeof(long long int)))
|
||||
{
|
||||
if (iFirst)
|
||||
{
|
||||
printf("%s", errHead);
|
||||
iFirst = 0;
|
||||
}
|
||||
display_error("cop1");
|
||||
}
|
||||
/*fread(comp_reg, 1, sizeof(int), f);
|
||||
if (memcmp(&rdram[0x31280/4], comp_reg, sizeof(int)))
|
||||
display_error("mem");*/
|
||||
/*fread (comp_reg, 4, 1, f);
|
||||
if (memcmp(&FCR31, comp_reg, 4))
|
||||
display_error();*/
|
||||
old_op = cur_opcode;
|
||||
}
|
||||
else if (l_CoreCompareMode == CORE_COMPARE_SEND)
|
||||
{
|
||||
if (fwrite(ptr_PC, sizeof(int), 4, fPipe) != 4 ||
|
||||
fwrite(ptr_reg, sizeof(long long int), 32, fPipe) != 32 ||
|
||||
fwrite(ptr_cop0, sizeof(int), 32, fPipe) != 32 ||
|
||||
fwrite(ptr_fgr, sizeof(long long int), 32, fPipe) != 32)
|
||||
printf("compare_core_check: fwrite() failed");
|
||||
/*fwrite(&rdram[0x31280/4], 1, sizeof(int), f);
|
||||
fwrite(&FCR31, 4, 1, f);*/
|
||||
}
|
||||
}
|
||||
|
||||
/* global functions */
|
||||
void compare_core_init(int mode)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
DebugMessage(M64MSG_VERBOSE, "core comparison feature not supported on Windows platform.");
|
||||
return;
|
||||
#else
|
||||
/* set mode */
|
||||
l_CoreCompareMode = mode;
|
||||
/* set callback functions in core */
|
||||
if (DebugSetCoreCompare(compare_core_check, compare_core_sync_data) != M64ERR_SUCCESS)
|
||||
{
|
||||
l_CoreCompareMode = CORE_COMPARE_DISABLE;
|
||||
DebugMessage(M64MSG_WARNING, "DebugSetCoreCompare() failed, core comparison disabled.");
|
||||
return;
|
||||
}
|
||||
/* get pointers to emulated R4300 CPU registers */
|
||||
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)
|
||||
{
|
||||
mkfifo("compare_pipe", 0600);
|
||||
DebugMessage(M64MSG_INFO, "Core Comparison Waiting to read pipe.");
|
||||
fPipe = fopen("compare_pipe", "r");
|
||||
}
|
||||
else if (l_CoreCompareMode == CORE_COMPARE_SEND)
|
||||
{
|
||||
DebugMessage(M64MSG_INFO, "Core Comparison Waiting to write pipe.");
|
||||
fPipe = fopen("compare_pipe", "w");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus - compare_core.h *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#if !defined(COMPARE_CORE_H)
|
||||
#define COMPARE_CORE_H
|
||||
|
||||
typedef enum {
|
||||
CORE_COMPARE_DISABLE = 0,
|
||||
CORE_COMPARE_SEND = 1,
|
||||
CORE_COMPARE_RECV = 2
|
||||
} CoreCompareMode;
|
||||
|
||||
void compare_core_init(int mode);
|
||||
|
||||
#endif /* COMPARE_CORE_H */
|
||||
|
|
@ -1,344 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus-ui-console - core_interface.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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* This file contains the routines for attaching to the Mupen64Plus core
|
||||
* library and pointers to the core functions
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "m64p_types.h"
|
||||
#include "m64p_common.h"
|
||||
#include "m64p_frontend.h"
|
||||
#include "m64p_config.h"
|
||||
#include "m64p_debugger.h"
|
||||
|
||||
#include "osal_preproc.h"
|
||||
#include "osal_dynamiclib.h"
|
||||
|
||||
#include "main.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;
|
||||
|
||||
/* definitions of pointers to Core front-end functions */
|
||||
ptr_CoreStartup CoreStartup = NULL;
|
||||
ptr_CoreShutdown CoreShutdown = NULL;
|
||||
ptr_CoreAttachPlugin CoreAttachPlugin = NULL;
|
||||
ptr_CoreDetachPlugin CoreDetachPlugin = NULL;
|
||||
ptr_CoreDoCommand CoreDoCommand = NULL;
|
||||
ptr_CoreOverrideVidExt CoreOverrideVidExt = NULL;
|
||||
ptr_CoreAddCheat CoreAddCheat = NULL;
|
||||
ptr_CoreCheatEnabled CoreCheatEnabled = NULL;
|
||||
|
||||
/* definitions of pointers to Core config functions */
|
||||
ptr_ConfigListSections ConfigListSections = NULL;
|
||||
ptr_ConfigOpenSection ConfigOpenSection = NULL;
|
||||
ptr_ConfigDeleteSection ConfigDeleteSection = NULL;
|
||||
ptr_ConfigSaveSection ConfigSaveSection = NULL;
|
||||
ptr_ConfigListParameters ConfigListParameters = NULL;
|
||||
ptr_ConfigSaveFile ConfigSaveFile = NULL;
|
||||
ptr_ConfigSetParameter ConfigSetParameter = NULL;
|
||||
ptr_ConfigGetParameter ConfigGetParameter = NULL;
|
||||
ptr_ConfigGetParameterType ConfigGetParameterType = NULL;
|
||||
ptr_ConfigGetParameterHelp ConfigGetParameterHelp = NULL;
|
||||
ptr_ConfigSetDefaultInt ConfigSetDefaultInt = NULL;
|
||||
ptr_ConfigSetDefaultFloat ConfigSetDefaultFloat = NULL;
|
||||
ptr_ConfigSetDefaultBool ConfigSetDefaultBool = NULL;
|
||||
ptr_ConfigSetDefaultString ConfigSetDefaultString = NULL;
|
||||
ptr_ConfigGetParamInt ConfigGetParamInt = NULL;
|
||||
ptr_ConfigGetParamFloat ConfigGetParamFloat = NULL;
|
||||
ptr_ConfigGetParamBool ConfigGetParamBool = NULL;
|
||||
ptr_ConfigGetParamString ConfigGetParamString = NULL;
|
||||
|
||||
ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath = NULL;
|
||||
ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath = NULL;
|
||||
ptr_ConfigGetUserDataPath ConfigGetUserDataPath = NULL;
|
||||
ptr_ConfigGetUserCachePath ConfigGetUserCachePath = NULL;
|
||||
|
||||
/* definitions of pointers to Core debugger functions */
|
||||
ptr_DebugSetCallbacks DebugSetCallbacks = NULL;
|
||||
ptr_DebugSetCoreCompare DebugSetCoreCompare = NULL;
|
||||
ptr_DebugSetRunState DebugSetRunState = NULL;
|
||||
ptr_DebugGetState DebugGetState = NULL;
|
||||
ptr_DebugStep DebugStep = NULL;
|
||||
ptr_DebugDecodeOp DebugDecodeOp = NULL;
|
||||
ptr_DebugMemGetRecompInfo DebugMemGetRecompInfo = NULL;
|
||||
ptr_DebugMemGetMemInfo DebugMemGetMemInfo = NULL;
|
||||
ptr_DebugMemGetPointer DebugMemGetPointer = NULL;
|
||||
|
||||
ptr_DebugMemRead64 DebugMemRead64 = NULL;
|
||||
ptr_DebugMemRead32 DebugMemRead32 = NULL;
|
||||
ptr_DebugMemRead16 DebugMemRead16 = NULL;
|
||||
ptr_DebugMemRead8 DebugMemRead8 = NULL;
|
||||
|
||||
ptr_DebugMemWrite64 DebugMemWrite64 = NULL;
|
||||
ptr_DebugMemWrite32 DebugMemWrite32 = NULL;
|
||||
ptr_DebugMemWrite16 DebugMemWrite16 = NULL;
|
||||
ptr_DebugMemWrite8 DebugMemWrite8 = NULL;
|
||||
|
||||
ptr_DebugGetCPUDataPtr DebugGetCPUDataPtr = NULL;
|
||||
ptr_DebugBreakpointLookup DebugBreakpointLookup = NULL;
|
||||
ptr_DebugBreakpointCommand DebugBreakpointCommand = NULL;
|
||||
|
||||
/* global variables */
|
||||
m64p_dynlib_handle CoreHandle = NULL;
|
||||
|
||||
/* functions */
|
||||
m64p_error AttachCoreLib(const char *CoreLibFilepath)
|
||||
{
|
||||
/* check if Core DLL is already attached */
|
||||
if (CoreHandle != NULL)
|
||||
return M64ERR_INVALID_STATE;
|
||||
|
||||
/* load the DLL */
|
||||
m64p_error rval = M64ERR_INTERNAL;
|
||||
/* first, try a library path+name that was given on the command-line */
|
||||
if (CoreLibFilepath != NULL)
|
||||
{
|
||||
rval = osal_dynlib_open(&CoreHandle, CoreLibFilepath);
|
||||
}
|
||||
/* then try a library path that was given at compile time */
|
||||
#if defined(COREDIR)
|
||||
if (rval != M64ERR_SUCCESS || CoreHandle == NULL)
|
||||
{
|
||||
rval = osal_dynlib_open(&CoreHandle, COREDIR OSAL_DEFAULT_DYNLIB_FILENAME);
|
||||
}
|
||||
#endif
|
||||
/* then try just the filename of the shared library, to let dlopen() look through the system lib dirs */
|
||||
if (rval != M64ERR_SUCCESS || CoreHandle == NULL)
|
||||
{
|
||||
rval = osal_dynlib_open(&CoreHandle, OSAL_DEFAULT_DYNLIB_FILENAME);
|
||||
}
|
||||
/* as a last-ditch effort, try loading library in current directory */
|
||||
if (rval != M64ERR_SUCCESS || CoreHandle == NULL)
|
||||
{
|
||||
rval = osal_dynlib_open(&CoreHandle, OSAL_CURRENT_DIR OSAL_DEFAULT_DYNLIB_FILENAME);
|
||||
}
|
||||
/* if we haven't found a good core library by now, then we're screwed */
|
||||
if (rval != M64ERR_SUCCESS || CoreHandle == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "AttachCoreLib() Error: failed to find Mupen64Plus Core library");
|
||||
CoreHandle = NULL;
|
||||
return M64ERR_INPUT_NOT_FOUND;
|
||||
}
|
||||
|
||||
/* attach and call the PluginGetVersion function, check the Core and API versions for compatibility with this front-end */
|
||||
ptr_PluginGetVersion CoreVersionFunc;
|
||||
CoreVersionFunc = (ptr_PluginGetVersion) osal_dynlib_getproc(CoreHandle, "PluginGetVersion");
|
||||
if (CoreVersionFunc == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "AttachCoreLib() Error: Shared library '%s' invalid; no PluginGetVersion() function found.", CoreLibFilepath);
|
||||
osal_dynlib_close(CoreHandle);
|
||||
CoreHandle = NULL;
|
||||
return M64ERR_INPUT_INVALID;
|
||||
}
|
||||
m64p_plugin_type PluginType = (m64p_plugin_type) 0;
|
||||
int Compatible = 0;
|
||||
int CoreVersion = 0;
|
||||
const char *CoreName = NULL;
|
||||
(*CoreVersionFunc)(&PluginType, &CoreVersion, &g_CoreAPIVersion, &CoreName, &g_CoreCapabilities);
|
||||
if (PluginType != M64PLUGIN_CORE)
|
||||
DebugMessage(M64MSG_ERROR, "AttachCoreLib() Error: Shared library '%s' invalid; this is not the emulator core.", CoreLibFilepath);
|
||||
else if (CoreVersion < MINIMUM_CORE_VERSION)
|
||||
DebugMessage(M64MSG_ERROR, "AttachCoreLib() Error: Shared library '%s' incompatible; core version %i.%i.%i is below minimum supported %i.%i.%i",
|
||||
CoreLibFilepath, VERSION_PRINTF_SPLIT(CoreVersion), VERSION_PRINTF_SPLIT(MINIMUM_CORE_VERSION));
|
||||
else if ((g_CoreAPIVersion & 0xffff0000) != (CORE_API_VERSION & 0xffff0000))
|
||||
DebugMessage(M64MSG_ERROR, "AttachCoreLib() Error: Shared library '%s' incompatible; core API major version %i.%i.%i doesn't match with this application (%i.%i.%i)",
|
||||
CoreLibFilepath, VERSION_PRINTF_SPLIT(g_CoreAPIVersion), VERSION_PRINTF_SPLIT(CORE_API_VERSION));
|
||||
else
|
||||
Compatible = 1;
|
||||
/* exit if not compatible */
|
||||
if (Compatible == 0)
|
||||
{
|
||||
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)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "AttachCoreLib() Error: Library '%s' broken; no CoreAPIVersionFunc() function found.", 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))
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "AttachCoreLib() Error: Emulator core '%s' incompatible; Config API major version %i.%i.%i doesn't match application: %i.%i.%i",
|
||||
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 */
|
||||
DebugMessage(M64MSG_INFO, "attached to core library '%s' version %i.%i.%i", CoreName, VERSION_PRINTF_SPLIT(CoreVersion));
|
||||
if (g_CoreCapabilities & M64CAPS_DYNAREC)
|
||||
DebugMessage(M64MSG_INFO, " Includes support for Dynamic Recompiler.");
|
||||
if (g_CoreCapabilities & M64CAPS_DEBUGGER)
|
||||
DebugMessage(M64MSG_INFO, " Includes support for MIPS r4300 Debugger.");
|
||||
if (g_CoreCapabilities & M64CAPS_CORE_COMPARE)
|
||||
DebugMessage(M64MSG_INFO, " Includes support for r4300 Core Comparison.");
|
||||
|
||||
/* get function pointers to the common and front-end functions */
|
||||
CoreErrorMessage = (ptr_CoreErrorMessage) osal_dynlib_getproc(CoreHandle, "CoreErrorMessage");
|
||||
CoreStartup = (ptr_CoreStartup) osal_dynlib_getproc(CoreHandle, "CoreStartup");
|
||||
CoreShutdown = (ptr_CoreShutdown) osal_dynlib_getproc(CoreHandle, "CoreShutdown");
|
||||
CoreAttachPlugin = (ptr_CoreAttachPlugin) osal_dynlib_getproc(CoreHandle, "CoreAttachPlugin");
|
||||
CoreDetachPlugin = (ptr_CoreDetachPlugin) osal_dynlib_getproc(CoreHandle, "CoreDetachPlugin");
|
||||
CoreDoCommand = (ptr_CoreDoCommand) osal_dynlib_getproc(CoreHandle, "CoreDoCommand");
|
||||
CoreOverrideVidExt = (ptr_CoreOverrideVidExt) osal_dynlib_getproc(CoreHandle, "CoreOverrideVidExt");
|
||||
CoreAddCheat = (ptr_CoreAddCheat) osal_dynlib_getproc(CoreHandle, "CoreAddCheat");
|
||||
CoreCheatEnabled = (ptr_CoreCheatEnabled) osal_dynlib_getproc(CoreHandle, "CoreCheatEnabled");
|
||||
|
||||
/* get function pointers to the configuration functions */
|
||||
ConfigListSections = (ptr_ConfigListSections) osal_dynlib_getproc(CoreHandle, "ConfigListSections");
|
||||
ConfigOpenSection = (ptr_ConfigOpenSection) osal_dynlib_getproc(CoreHandle, "ConfigOpenSection");
|
||||
ConfigDeleteSection = (ptr_ConfigDeleteSection) osal_dynlib_getproc(CoreHandle, "ConfigDeleteSection");
|
||||
ConfigSaveSection = (ptr_ConfigSaveSection) osal_dynlib_getproc(CoreHandle, "ConfigSaveSection");
|
||||
ConfigListParameters = (ptr_ConfigListParameters) osal_dynlib_getproc(CoreHandle, "ConfigListParameters");
|
||||
ConfigSaveFile = (ptr_ConfigSaveFile) osal_dynlib_getproc(CoreHandle, "ConfigSaveFile");
|
||||
ConfigSetParameter = (ptr_ConfigSetParameter) osal_dynlib_getproc(CoreHandle, "ConfigSetParameter");
|
||||
ConfigGetParameter = (ptr_ConfigGetParameter) osal_dynlib_getproc(CoreHandle, "ConfigGetParameter");
|
||||
ConfigGetParameterType = (ptr_ConfigGetParameterType) osal_dynlib_getproc(CoreHandle, "ConfigGetParameterType");
|
||||
ConfigGetParameterHelp = (ptr_ConfigGetParameterHelp) osal_dynlib_getproc(CoreHandle, "ConfigGetParameterHelp");
|
||||
ConfigSetDefaultInt = (ptr_ConfigSetDefaultInt) osal_dynlib_getproc(CoreHandle, "ConfigSetDefaultInt");
|
||||
ConfigSetDefaultFloat = (ptr_ConfigSetDefaultFloat) osal_dynlib_getproc(CoreHandle, "ConfigSetDefaultFloat");
|
||||
ConfigSetDefaultBool = (ptr_ConfigSetDefaultBool) osal_dynlib_getproc(CoreHandle, "ConfigSetDefaultBool");
|
||||
ConfigSetDefaultString = (ptr_ConfigSetDefaultString) osal_dynlib_getproc(CoreHandle, "ConfigSetDefaultString");
|
||||
ConfigGetParamInt = (ptr_ConfigGetParamInt) osal_dynlib_getproc(CoreHandle, "ConfigGetParamInt");
|
||||
ConfigGetParamFloat = (ptr_ConfigGetParamFloat) osal_dynlib_getproc(CoreHandle, "ConfigGetParamFloat");
|
||||
ConfigGetParamBool = (ptr_ConfigGetParamBool) osal_dynlib_getproc(CoreHandle, "ConfigGetParamBool");
|
||||
ConfigGetParamString = (ptr_ConfigGetParamString) osal_dynlib_getproc(CoreHandle, "ConfigGetParamString");
|
||||
|
||||
ConfigGetSharedDataFilepath = (ptr_ConfigGetSharedDataFilepath) osal_dynlib_getproc(CoreHandle, "ConfigGetSharedDataFilepath");
|
||||
ConfigGetUserConfigPath = (ptr_ConfigGetUserConfigPath) osal_dynlib_getproc(CoreHandle, "ConfigGetUserConfigPath");
|
||||
ConfigGetUserDataPath = (ptr_ConfigGetUserDataPath) osal_dynlib_getproc(CoreHandle, "ConfigGetUserDataPath");
|
||||
ConfigGetUserCachePath = (ptr_ConfigGetUserCachePath) osal_dynlib_getproc(CoreHandle, "ConfigGetUserCachePath");
|
||||
|
||||
/* get function pointers to the debugger functions */
|
||||
DebugSetCallbacks = (ptr_DebugSetCallbacks) osal_dynlib_getproc(CoreHandle, "DebugSetCallbacks");
|
||||
DebugSetCoreCompare = (ptr_DebugSetCoreCompare) osal_dynlib_getproc(CoreHandle, "DebugSetCoreCompare");
|
||||
DebugSetRunState = (ptr_DebugSetRunState) osal_dynlib_getproc(CoreHandle, "DebugSetRunState");
|
||||
DebugGetState = (ptr_DebugGetState) osal_dynlib_getproc(CoreHandle, "DebugGetState");
|
||||
DebugStep = (ptr_DebugStep) osal_dynlib_getproc(CoreHandle, "DebugStep");
|
||||
DebugDecodeOp = (ptr_DebugDecodeOp) osal_dynlib_getproc(CoreHandle, "DebugDecodeOp");
|
||||
DebugMemGetRecompInfo = (ptr_DebugMemGetRecompInfo) osal_dynlib_getproc(CoreHandle, "DebugMemGetRecompInfo");
|
||||
DebugMemGetMemInfo = (ptr_DebugMemGetMemInfo) osal_dynlib_getproc(CoreHandle, "DebugMemGetMemInfo");
|
||||
DebugMemGetPointer = (ptr_DebugMemGetPointer) osal_dynlib_getproc(CoreHandle, "DebugMemGetPointer");
|
||||
|
||||
DebugMemRead64 = (ptr_DebugMemRead64) osal_dynlib_getproc(CoreHandle, "DebugMemRead64");
|
||||
DebugMemRead32 = (ptr_DebugMemRead32) osal_dynlib_getproc(CoreHandle, "DebugMemRead32");
|
||||
DebugMemRead16 = (ptr_DebugMemRead16) osal_dynlib_getproc(CoreHandle, "DebugMemRead16");
|
||||
DebugMemRead8 = (ptr_DebugMemRead8) osal_dynlib_getproc(CoreHandle, "DebugMemRead8");
|
||||
|
||||
DebugMemWrite64 = (ptr_DebugMemWrite64) osal_dynlib_getproc(CoreHandle, "DebugMemRead64");
|
||||
DebugMemWrite32 = (ptr_DebugMemWrite32) osal_dynlib_getproc(CoreHandle, "DebugMemRead32");
|
||||
DebugMemWrite16 = (ptr_DebugMemWrite16) osal_dynlib_getproc(CoreHandle, "DebugMemRead16");
|
||||
DebugMemWrite8 = (ptr_DebugMemWrite8) osal_dynlib_getproc(CoreHandle, "DebugMemRead8");
|
||||
|
||||
DebugGetCPUDataPtr = (ptr_DebugGetCPUDataPtr) osal_dynlib_getproc(CoreHandle, "DebugGetCPUDataPtr");
|
||||
DebugBreakpointLookup = (ptr_DebugBreakpointLookup) osal_dynlib_getproc(CoreHandle, "DebugBreakpointLookup");
|
||||
DebugBreakpointCommand = (ptr_DebugBreakpointCommand) osal_dynlib_getproc(CoreHandle, "DebugBreakpointCommand");
|
||||
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
m64p_error DetachCoreLib(void)
|
||||
{
|
||||
if (CoreHandle == NULL)
|
||||
return M64ERR_INVALID_STATE;
|
||||
|
||||
/* set the core function pointers to NULL */
|
||||
CoreErrorMessage = NULL;
|
||||
CoreStartup = NULL;
|
||||
CoreShutdown = NULL;
|
||||
CoreAttachPlugin = NULL;
|
||||
CoreDetachPlugin = NULL;
|
||||
CoreDoCommand = NULL;
|
||||
CoreOverrideVidExt = NULL;
|
||||
CoreAddCheat = NULL;
|
||||
CoreCheatEnabled = NULL;
|
||||
|
||||
ConfigListSections = NULL;
|
||||
ConfigOpenSection = NULL;
|
||||
ConfigDeleteSection = NULL;
|
||||
ConfigSaveSection = NULL;
|
||||
ConfigListParameters = NULL;
|
||||
ConfigSetParameter = NULL;
|
||||
ConfigGetParameter = NULL;
|
||||
ConfigGetParameterType = NULL;
|
||||
ConfigGetParameterHelp = NULL;
|
||||
ConfigSetDefaultInt = NULL;
|
||||
ConfigSetDefaultBool = NULL;
|
||||
ConfigSetDefaultString = NULL;
|
||||
ConfigGetParamInt = NULL;
|
||||
ConfigGetParamBool = NULL;
|
||||
ConfigGetParamString = NULL;
|
||||
|
||||
ConfigGetSharedDataFilepath = NULL;
|
||||
ConfigGetUserDataPath = NULL;
|
||||
ConfigGetUserCachePath = NULL;
|
||||
|
||||
DebugSetCallbacks = NULL;
|
||||
DebugSetCoreCompare = NULL;
|
||||
DebugSetRunState = NULL;
|
||||
DebugGetState = NULL;
|
||||
DebugStep = NULL;
|
||||
DebugDecodeOp = NULL;
|
||||
DebugMemGetRecompInfo = NULL;
|
||||
DebugMemGetMemInfo = NULL;
|
||||
DebugMemGetPointer = NULL;
|
||||
|
||||
DebugMemRead64 = NULL;
|
||||
DebugMemRead32 = NULL;
|
||||
DebugMemRead16 = NULL;
|
||||
DebugMemRead8 = NULL;
|
||||
|
||||
DebugMemWrite64 = NULL;
|
||||
DebugMemWrite32 = NULL;
|
||||
DebugMemWrite16 = NULL;
|
||||
DebugMemWrite8 = NULL;
|
||||
|
||||
DebugGetCPUDataPtr = NULL;
|
||||
DebugBreakpointLookup = NULL;
|
||||
DebugBreakpointCommand = NULL;
|
||||
|
||||
/* detach the shared library */
|
||||
osal_dynlib_close(CoreHandle);
|
||||
CoreHandle = NULL;
|
||||
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus-ui-console - core_interface.h *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#if !defined(CORE_INTERFACE_H)
|
||||
#define CORE_INTERFACE_H
|
||||
|
||||
#include "m64p_types.h"
|
||||
#include "m64p_common.h"
|
||||
#include "m64p_frontend.h"
|
||||
#include "m64p_config.h"
|
||||
#include "m64p_debugger.h"
|
||||
|
||||
/* function declarations */
|
||||
extern m64p_error AttachCoreLib(const char *CoreLibFilepath);
|
||||
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;
|
||||
extern ptr_CoreErrorMessage CoreErrorMessage;
|
||||
|
||||
/* declarations of pointers to Core front-end functions */
|
||||
extern ptr_CoreStartup CoreStartup;
|
||||
extern ptr_CoreShutdown CoreShutdown;
|
||||
extern ptr_CoreAttachPlugin CoreAttachPlugin;
|
||||
extern ptr_CoreDetachPlugin CoreDetachPlugin;
|
||||
extern ptr_CoreDoCommand CoreDoCommand;
|
||||
extern ptr_CoreOverrideVidExt CoreOverrideVidExt;
|
||||
extern ptr_CoreAddCheat CoreAddCheat;
|
||||
extern ptr_CoreCheatEnabled CoreCheatEnabled;
|
||||
|
||||
/* declarations of pointers to Core config functions */
|
||||
extern ptr_ConfigListSections ConfigListSections;
|
||||
extern ptr_ConfigOpenSection ConfigOpenSection;
|
||||
extern ptr_ConfigDeleteSection ConfigDeleteSection;
|
||||
extern ptr_ConfigSaveSection ConfigSaveSection;
|
||||
extern ptr_ConfigListParameters ConfigListParameters;
|
||||
extern ptr_ConfigSaveFile ConfigSaveFile;
|
||||
extern ptr_ConfigSetParameter ConfigSetParameter;
|
||||
extern ptr_ConfigGetParameter ConfigGetParameter;
|
||||
extern ptr_ConfigGetParameterType ConfigGetParameterType;
|
||||
extern ptr_ConfigGetParameterHelp ConfigGetParameterHelp;
|
||||
extern ptr_ConfigSetDefaultInt ConfigSetDefaultInt;
|
||||
extern ptr_ConfigSetDefaultFloat ConfigSetDefaultFloat;
|
||||
extern ptr_ConfigSetDefaultBool ConfigSetDefaultBool;
|
||||
extern ptr_ConfigSetDefaultString ConfigSetDefaultString;
|
||||
extern ptr_ConfigGetParamInt ConfigGetParamInt;
|
||||
extern ptr_ConfigGetParamFloat ConfigGetParamFloat;
|
||||
extern ptr_ConfigGetParamBool ConfigGetParamBool;
|
||||
extern ptr_ConfigGetParamString ConfigGetParamString;
|
||||
|
||||
extern ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath;
|
||||
extern ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath;
|
||||
extern ptr_ConfigGetUserDataPath ConfigGetUserDataPath;
|
||||
extern ptr_ConfigGetUserCachePath ConfigGetUserCachePath;
|
||||
|
||||
/* declarations of pointers to Core debugger functions */
|
||||
extern ptr_DebugSetCallbacks DebugSetCallbacks;
|
||||
extern ptr_DebugSetCoreCompare DebugSetCoreCompare;
|
||||
extern ptr_DebugSetRunState DebugSetRunState;
|
||||
extern ptr_DebugGetState DebugGetState;
|
||||
extern ptr_DebugStep DebugStep;
|
||||
extern ptr_DebugDecodeOp DebugDecodeOp;
|
||||
extern ptr_DebugMemGetRecompInfo DebugMemGetRecompInfo;
|
||||
extern ptr_DebugMemGetMemInfo DebugMemGetMemInfo;
|
||||
extern ptr_DebugMemGetPointer DebugMemGetPointer;
|
||||
|
||||
extern ptr_DebugMemRead64 DebugMemRead64;
|
||||
extern ptr_DebugMemRead32 DebugMemRead32;
|
||||
extern ptr_DebugMemRead16 DebugMemRead16;
|
||||
extern ptr_DebugMemRead8 DebugMemRead8;
|
||||
|
||||
extern ptr_DebugMemWrite64 DebugMemWrite64;
|
||||
extern ptr_DebugMemWrite32 DebugMemWrite32;
|
||||
extern ptr_DebugMemWrite16 DebugMemWrite16;
|
||||
extern ptr_DebugMemWrite8 DebugMemWrite8;
|
||||
|
||||
extern ptr_DebugGetCPUDataPtr DebugGetCPUDataPtr;
|
||||
extern ptr_DebugBreakpointLookup DebugBreakpointLookup;
|
||||
extern ptr_DebugBreakpointCommand DebugBreakpointCommand;
|
||||
|
||||
#endif /* #define CORE_INTERFACE_H */
|
||||
|
|
@ -1,756 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus-ui-console - main.c *
|
||||
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
|
||||
* Copyright (C) 2007-2010 Richard42 *
|
||||
* Copyright (C) 2008 Ebenblues Nmn Okaygo Tillin9 *
|
||||
* Copyright (C) 2002 Hacktarux *
|
||||
* *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* This is the main application entry point for the console-only front-end
|
||||
* for Mupen64Plus v2.0.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
// The mac version of SDL requires inclusion of SDL_main in the executable
|
||||
#ifdef __APPLE__
|
||||
#include <SDL_main.h>
|
||||
#endif
|
||||
|
||||
#include "cheat.h"
|
||||
#include "main.h"
|
||||
#include "plugin.h"
|
||||
#include "version.h"
|
||||
#include "core_interface.h"
|
||||
#include "compare_core.h"
|
||||
#include "osal_preproc.h"
|
||||
|
||||
/* Version number for UI-Console config section parameters */
|
||||
#define CONFIG_PARAM_VERSION 1.00
|
||||
|
||||
/** global variables **/
|
||||
int g_Verbose = 0;
|
||||
|
||||
/** static (local) variables **/
|
||||
static m64p_handle l_ConfigCore = NULL;
|
||||
static m64p_handle l_ConfigVideo = NULL;
|
||||
static m64p_handle l_ConfigUI = NULL;
|
||||
|
||||
static const char *l_CoreLibPath = NULL;
|
||||
static const char *l_ConfigDirPath = NULL;
|
||||
static const char *l_ROMFilepath = NULL; // filepath of ROM to load & run at startup
|
||||
|
||||
#if defined(SHAREDIR)
|
||||
static const char *l_DataDirPath = SHAREDIR;
|
||||
#else
|
||||
static const char *l_DataDirPath = NULL;
|
||||
#endif
|
||||
|
||||
static int *l_TestShotList = NULL; // list of screenshots to take for regression test support
|
||||
static int l_TestShotIdx = 0; // index of next screenshot frame in list
|
||||
static int l_SaveOptions = 1; // save command-line options in configuration file (enabled by default)
|
||||
static int l_CoreCompareMode = 0; // 0 = disable, 1 = send, 2 = receive
|
||||
|
||||
static eCheatMode l_CheatMode = CHEAT_DISABLE;
|
||||
static char *l_CheatNumList = NULL;
|
||||
|
||||
/*********************************************************************************************************
|
||||
* Callback functions from the core
|
||||
*/
|
||||
|
||||
void DebugMessage(int level, const char *message, ...)
|
||||
{
|
||||
char msgbuf[1024];
|
||||
va_list args;
|
||||
|
||||
va_start(args, message);
|
||||
vsnprintf(msgbuf, 1024, message, args);
|
||||
|
||||
DebugCallback("UI-Console", level, msgbuf);
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void DebugCallback(void *Context, int level, const char *message)
|
||||
{
|
||||
if (level == M64MSG_ERROR)
|
||||
printf("%s Error: %s\n", (const char *) Context, message);
|
||||
else if (level == M64MSG_WARNING)
|
||||
printf("%s Warning: %s\n", (const char *) Context, message);
|
||||
else if (level == M64MSG_INFO)
|
||||
printf("%s: %s\n", (const char *) Context, message);
|
||||
else if (level == M64MSG_STATUS)
|
||||
printf("%s Status: %s\n", (const char *) Context, message);
|
||||
else if (level == M64MSG_VERBOSE)
|
||||
{
|
||||
if (g_Verbose)
|
||||
printf("%s: %s\n", (const char *) Context, message);
|
||||
}
|
||||
else
|
||||
printf("%s Unknown: %s\n", (const char *) Context, message);
|
||||
}
|
||||
|
||||
static void FrameCallback(unsigned int FrameIndex)
|
||||
{
|
||||
// take a screenshot if we need to
|
||||
if (l_TestShotList != NULL)
|
||||
{
|
||||
int nextshot = l_TestShotList[l_TestShotIdx];
|
||||
if (nextshot == FrameIndex)
|
||||
{
|
||||
(*CoreDoCommand)(M64CMD_TAKE_NEXT_SCREENSHOT, 0, NULL); /* tell the core take a screenshot */
|
||||
// advance list index to next screenshot frame number. If it's 0, then quit
|
||||
l_TestShotIdx++;
|
||||
}
|
||||
else if (nextshot == 0)
|
||||
{
|
||||
(*CoreDoCommand)(M64CMD_STOP, 0, NULL); /* tell the core to shut down ASAP */
|
||||
free(l_TestShotList);
|
||||
l_TestShotList = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*********************************************************************************************************
|
||||
* Configuration handling
|
||||
*/
|
||||
|
||||
static m64p_error OpenConfigurationHandles(void)
|
||||
{
|
||||
float fConfigParamsVersion;
|
||||
int bSaveConfig = 0;
|
||||
m64p_error rval;
|
||||
|
||||
/* Open Configuration sections for core library and console User Interface */
|
||||
rval = (*ConfigOpenSection)("Core", &l_ConfigCore);
|
||||
if (rval != M64ERR_SUCCESS)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "failed to open 'Core' configuration section");
|
||||
return rval;
|
||||
}
|
||||
|
||||
rval = (*ConfigOpenSection)("Video-General", &l_ConfigVideo);
|
||||
if (rval != M64ERR_SUCCESS)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "failed to open 'Video-General' configuration section");
|
||||
return rval;
|
||||
}
|
||||
|
||||
rval = (*ConfigOpenSection)("UI-Console", &l_ConfigUI);
|
||||
if (rval != M64ERR_SUCCESS)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "failed to open 'UI-Console' configuration section");
|
||||
return rval;
|
||||
}
|
||||
|
||||
if ((*ConfigGetParameter)(l_ConfigUI, "Version", M64TYPE_FLOAT, &fConfigParamsVersion, sizeof(float)) != M64ERR_SUCCESS)
|
||||
{
|
||||
DebugMessage(M64MSG_WARNING, "No version number in 'UI-Console' config section. Setting defaults.");
|
||||
(*ConfigDeleteSection)("UI-Console");
|
||||
(*ConfigOpenSection)("UI-Console", &l_ConfigUI);
|
||||
bSaveConfig = 1;
|
||||
}
|
||||
else if (((int) fConfigParamsVersion) != ((int) CONFIG_PARAM_VERSION))
|
||||
{
|
||||
DebugMessage(M64MSG_WARNING, "Incompatible version %.2f in 'UI-Console' config section: current is %.2f. Setting defaults.", fConfigParamsVersion, (float) CONFIG_PARAM_VERSION);
|
||||
(*ConfigDeleteSection)("UI-Console");
|
||||
(*ConfigOpenSection)("UI-Console", &l_ConfigUI);
|
||||
bSaveConfig = 1;
|
||||
}
|
||||
else if ((CONFIG_PARAM_VERSION - fConfigParamsVersion) >= 0.0001f)
|
||||
{
|
||||
/* handle upgrades */
|
||||
float fVersion = CONFIG_PARAM_VERSION;
|
||||
ConfigSetParameter(l_ConfigUI, "Version", M64TYPE_FLOAT, &fVersion);
|
||||
DebugMessage(M64MSG_INFO, "Updating parameter set version in 'UI-Console' config section to %.2f", fVersion);
|
||||
bSaveConfig = 1;
|
||||
}
|
||||
|
||||
/* Set default values for my Config parameters */
|
||||
(*ConfigSetDefaultFloat)(l_ConfigUI, "Version", CONFIG_PARAM_VERSION, "Mupen64Plus UI-Console config parameter set version number. Please don't change this version number.");
|
||||
(*ConfigSetDefaultString)(l_ConfigUI, "PluginDir", OSAL_CURRENT_DIR, "Directory in which to search for plugins");
|
||||
(*ConfigSetDefaultString)(l_ConfigUI, "VideoPlugin", "mupen64plus-video-rice" OSAL_DLL_EXTENSION, "Filename of video plugin");
|
||||
(*ConfigSetDefaultString)(l_ConfigUI, "AudioPlugin", "mupen64plus-audio-sdl" OSAL_DLL_EXTENSION, "Filename of audio plugin");
|
||||
(*ConfigSetDefaultString)(l_ConfigUI, "InputPlugin", "mupen64plus-input-sdl" OSAL_DLL_EXTENSION, "Filename of input plugin");
|
||||
(*ConfigSetDefaultString)(l_ConfigUI, "RspPlugin", "mupen64plus-rsp-hle" OSAL_DLL_EXTENSION, "Filename of RSP plugin");
|
||||
|
||||
if (bSaveConfig && ConfigSaveSection != NULL) /* ConfigSaveSection was added in Config API v2.1.0 */
|
||||
(*ConfigSaveSection)("UI-Console");
|
||||
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
static m64p_error SaveConfigurationOptions(void)
|
||||
{
|
||||
/* if shared data directory was given on the command line, write it into the config file */
|
||||
if (l_DataDirPath != NULL)
|
||||
(*ConfigSetParameter)(l_ConfigCore, "SharedDataPath", M64TYPE_STRING, l_DataDirPath);
|
||||
|
||||
/* if any plugin filepaths were given on the command line, write them into the config file */
|
||||
if (g_PluginDir != NULL)
|
||||
(*ConfigSetParameter)(l_ConfigUI, "PluginDir", M64TYPE_STRING, g_PluginDir);
|
||||
if (g_GfxPlugin != NULL)
|
||||
(*ConfigSetParameter)(l_ConfigUI, "VideoPlugin", M64TYPE_STRING, g_GfxPlugin);
|
||||
if (g_AudioPlugin != NULL)
|
||||
(*ConfigSetParameter)(l_ConfigUI, "AudioPlugin", M64TYPE_STRING, g_AudioPlugin);
|
||||
if (g_InputPlugin != NULL)
|
||||
(*ConfigSetParameter)(l_ConfigUI, "InputPlugin", M64TYPE_STRING, g_InputPlugin);
|
||||
if (g_RspPlugin != NULL)
|
||||
(*ConfigSetParameter)(l_ConfigUI, "RspPlugin", M64TYPE_STRING, g_RspPlugin);
|
||||
|
||||
return (*ConfigSaveFile)();
|
||||
}
|
||||
|
||||
/*********************************************************************************************************
|
||||
* Command-line parsing
|
||||
*/
|
||||
|
||||
static void printUsage(const char *progname)
|
||||
{
|
||||
printf("Usage: %s [parameters] [romfile]\n"
|
||||
"\n"
|
||||
"Parameters:\n"
|
||||
" --noosd : disable onscreen display\n"
|
||||
" --osd : enable onscreen display\n"
|
||||
" --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"
|
||||
" --datadir (dir) : search for shared data files (.ini files, languages, etc) in (dir)\n"
|
||||
" --plugindir (dir) : search for plugins in (dir)\n"
|
||||
" --sshotdir (dir) : set screenshot directory to (dir)\n"
|
||||
" --gfx (plugin-spec) : use gfx plugin given by (plugin-spec)\n"
|
||||
" --audio (plugin-spec) : use audio plugin given by (plugin-spec)\n"
|
||||
" --input (plugin-spec) : use input plugin given by (plugin-spec)\n"
|
||||
" --rsp (plugin-spec) : use rsp plugin given by (plugin-spec)\n"
|
||||
" --emumode (mode) : set emu mode to: 0=Pure Interpreter 1=Interpreter 2=DynaRec\n"
|
||||
" --testshots (list) : take screenshots at frames given in comma-separated (list), then quit\n"
|
||||
" --set (param-spec) : set a configuration variable, format: ParamSection[ParamName]=Value\n"
|
||||
" --core-compare-send : use the Core Comparison debugging feature, in data sending mode\n"
|
||||
" --core-compare-recv : use the Core Comparison debugging feature, in data receiving mode\n"
|
||||
" --nosaveoptions : do not save the given command-line options in configuration file\n"
|
||||
" --verbose : print lots of information\n"
|
||||
" --help : see this help message\n\n"
|
||||
"(plugin-spec):\n"
|
||||
" (pluginname) : filename (without path) of plugin to find in plugin directory\n"
|
||||
" (pluginpath) : full path and filename of plugin\n"
|
||||
" 'dummy' : use dummy plugin\n\n"
|
||||
"(cheat-spec):\n"
|
||||
" 'list' : show all of the available cheat codes\n"
|
||||
" 'all' : enable all of the available cheat codes\n"
|
||||
" (codelist) : a comma-separated list of cheat code numbers to enable,\n"
|
||||
" with dashes to use code variables (ex 1-2 to use cheat 1 option 2)\n"
|
||||
"\n", progname);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static int SetConfigParameter(const char *ParamSpec)
|
||||
{
|
||||
char *ParsedString, *VarName, *VarValue=NULL;
|
||||
m64p_handle ConfigSection;
|
||||
m64p_type VarType;
|
||||
m64p_error rval;
|
||||
|
||||
if (ParamSpec == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "ParamSpec is NULL in SetConfigParameter()");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* make a copy of the input string */
|
||||
ParsedString = (char *) malloc(strlen(ParamSpec) + 1);
|
||||
if (ParsedString == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SetConfigParameter() couldn't allocate memory for temporary string.");
|
||||
return 2;
|
||||
}
|
||||
strcpy(ParsedString, ParamSpec);
|
||||
|
||||
/* parse it for the simple section[name]=value format */
|
||||
VarName = strchr(ParsedString, '[');
|
||||
if (VarName != NULL)
|
||||
{
|
||||
*VarName++ = 0;
|
||||
VarValue = strchr(VarName, ']');
|
||||
if (VarValue != NULL)
|
||||
{
|
||||
*VarValue++ = 0;
|
||||
}
|
||||
}
|
||||
if (VarName == NULL || VarValue == NULL || *VarValue != '=')
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "invalid (param-spec) '%s'", ParamSpec);
|
||||
free(ParsedString);
|
||||
return 3;
|
||||
}
|
||||
VarValue++;
|
||||
|
||||
/* then set the value */
|
||||
rval = (*ConfigOpenSection)(ParsedString, &ConfigSection);
|
||||
if (rval != M64ERR_SUCCESS)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "SetConfigParameter failed to open config section '%s'", ParsedString);
|
||||
free(ParsedString);
|
||||
return 4;
|
||||
}
|
||||
if ((*ConfigGetParameterType)(ConfigSection, VarName, &VarType) == M64ERR_SUCCESS)
|
||||
{
|
||||
switch(VarType)
|
||||
{
|
||||
int ValueInt;
|
||||
float ValueFloat;
|
||||
case M64TYPE_INT:
|
||||
ValueInt = atoi(VarValue);
|
||||
ConfigSetParameter(ConfigSection, VarName, M64TYPE_INT, &ValueInt);
|
||||
break;
|
||||
case M64TYPE_FLOAT:
|
||||
ValueFloat = (float) atof(VarValue);
|
||||
ConfigSetParameter(ConfigSection, VarName, M64TYPE_FLOAT, &ValueFloat);
|
||||
break;
|
||||
case M64TYPE_BOOL:
|
||||
ValueInt = (int) (osal_insensitive_strcmp(VarValue, "true") == 0);
|
||||
ConfigSetParameter(ConfigSection, VarName, M64TYPE_BOOL, &ValueInt);
|
||||
break;
|
||||
case M64TYPE_STRING:
|
||||
ConfigSetParameter(ConfigSection, VarName, M64TYPE_STRING, VarValue);
|
||||
break;
|
||||
default:
|
||||
DebugMessage(M64MSG_ERROR, "invalid VarType in SetConfigParameter()");
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ConfigSetParameter(ConfigSection, VarName, M64TYPE_STRING, VarValue);
|
||||
}
|
||||
|
||||
free(ParsedString);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int *ParseNumberList(const char *InputString, int *ValuesFound)
|
||||
{
|
||||
const char *str;
|
||||
int *OutputList;
|
||||
|
||||
/* count the number of integers in the list */
|
||||
int values = 1;
|
||||
str = InputString;
|
||||
while ((str = strchr(str, ',')) != NULL)
|
||||
{
|
||||
str++;
|
||||
values++;
|
||||
}
|
||||
|
||||
/* create a list and populate it with the frame counter values at which to take screenshots */
|
||||
if ((OutputList = (int *) malloc(sizeof(int) * (values + 1))) != NULL)
|
||||
{
|
||||
int idx = 0;
|
||||
str = InputString;
|
||||
while (str != NULL)
|
||||
{
|
||||
OutputList[idx++] = atoi(str);
|
||||
str = strchr(str, ',');
|
||||
if (str != NULL) str++;
|
||||
}
|
||||
OutputList[idx] = 0;
|
||||
}
|
||||
|
||||
if (ValuesFound != NULL)
|
||||
*ValuesFound = values;
|
||||
return OutputList;
|
||||
}
|
||||
|
||||
static int ParseCommandLineInitial(int argc, const char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* look through commandline options */
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
int ArgsLeft = argc - i - 1;
|
||||
|
||||
if (strcmp(argv[i], "--corelib") == 0 && ArgsLeft >= 1)
|
||||
{
|
||||
l_CoreLibPath = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "--configdir") == 0 && ArgsLeft >= 1)
|
||||
{
|
||||
l_ConfigDirPath = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "--datadir") == 0 && ArgsLeft >= 1)
|
||||
{
|
||||
l_DataDirPath = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0)
|
||||
{
|
||||
printUsage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static m64p_error ParseCommandLineFinal(int argc, const char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* parse commandline options */
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
int ArgsLeft = argc - i - 1;
|
||||
if (strcmp(argv[i], "--noosd") == 0)
|
||||
{
|
||||
int Osd = 0;
|
||||
(*ConfigSetParameter)(l_ConfigCore, "OnScreenDisplay", M64TYPE_BOOL, &Osd);
|
||||
}
|
||||
else if (strcmp(argv[i], "--osd") == 0)
|
||||
{
|
||||
int Osd = 1;
|
||||
(*ConfigSetParameter)(l_ConfigCore, "OnScreenDisplay", M64TYPE_BOOL, &Osd);
|
||||
}
|
||||
else if (strcmp(argv[i], "--fullscreen") == 0)
|
||||
{
|
||||
int Fullscreen = 1;
|
||||
(*ConfigSetParameter)(l_ConfigVideo, "Fullscreen", M64TYPE_BOOL, &Fullscreen);
|
||||
}
|
||||
else if (strcmp(argv[i], "--windowed") == 0)
|
||||
{
|
||||
int Fullscreen = 0;
|
||||
(*ConfigSetParameter)(l_ConfigVideo, "Fullscreen", M64TYPE_BOOL, &Fullscreen);
|
||||
}
|
||||
else if (strcmp(argv[i], "--nospeedlimit") == 0)
|
||||
{
|
||||
int EnableSpeedLimit = 0;
|
||||
if (g_CoreAPIVersion < 0x020001)
|
||||
DebugMessage(M64MSG_WARNING, "core library doesn't support --nospeedlimit");
|
||||
else
|
||||
{
|
||||
if ((*CoreDoCommand)(M64CMD_CORE_STATE_SET, M64CORE_SPEED_LIMITER, &EnableSpeedLimit) != M64ERR_SUCCESS)
|
||||
DebugMessage(M64MSG_ERROR, "core gave error while setting --nospeedlimit option");
|
||||
}
|
||||
}
|
||||
else if ((strcmp(argv[i], "--corelib") == 0 || strcmp(argv[i], "--configdir") == 0 ||
|
||||
strcmp(argv[i], "--datadir") == 0) && ArgsLeft >= 1)
|
||||
{ /* these are handled in ParseCommandLineInitial */
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "--resolution") == 0 && ArgsLeft >= 1)
|
||||
{
|
||||
const char *res = argv[i+1];
|
||||
int xres, yres;
|
||||
i++;
|
||||
if (sscanf(res, "%ix%i", &xres, &yres) != 2)
|
||||
DebugMessage(M64MSG_WARNING, "couldn't parse resolution '%s'", res);
|
||||
else
|
||||
{
|
||||
(*ConfigSetParameter)(l_ConfigVideo, "ScreenWidth", M64TYPE_INT, &xres);
|
||||
(*ConfigSetParameter)(l_ConfigVideo, "ScreenHeight", M64TYPE_INT, &yres);
|
||||
}
|
||||
}
|
||||
else if (strcmp(argv[i], "--cheats") == 0 && ArgsLeft >= 1)
|
||||
{
|
||||
if (strcmp(argv[i+1], "all") == 0)
|
||||
l_CheatMode = CHEAT_ALL;
|
||||
else if (strcmp(argv[i+1], "list") == 0)
|
||||
l_CheatMode = CHEAT_SHOW_LIST;
|
||||
else
|
||||
{
|
||||
l_CheatMode = CHEAT_LIST;
|
||||
l_CheatNumList = (char*) argv[i+1];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "--plugindir") == 0 && ArgsLeft >= 1)
|
||||
{
|
||||
g_PluginDir = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "--sshotdir") == 0 && ArgsLeft >= 1)
|
||||
{
|
||||
(*ConfigSetParameter)(l_ConfigCore, "ScreenshotPath", M64TYPE_STRING, argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "--gfx") == 0 && ArgsLeft >= 1)
|
||||
{
|
||||
g_GfxPlugin = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "--audio") == 0 && ArgsLeft >= 1)
|
||||
{
|
||||
g_AudioPlugin = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "--input") == 0 && ArgsLeft >= 1)
|
||||
{
|
||||
g_InputPlugin = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "--rsp") == 0 && ArgsLeft >= 1)
|
||||
{
|
||||
g_RspPlugin = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "--emumode") == 0 && ArgsLeft >= 1)
|
||||
{
|
||||
int emumode = atoi(argv[i+1]);
|
||||
i++;
|
||||
if (emumode < 0 || emumode > 2)
|
||||
{
|
||||
DebugMessage(M64MSG_WARNING, "invalid --emumode value '%i'", emumode);
|
||||
continue;
|
||||
}
|
||||
if (emumode == 2 && !(g_CoreCapabilities & M64CAPS_DYNAREC))
|
||||
{
|
||||
DebugMessage(M64MSG_WARNING, "Emulator core doesn't support Dynamic Recompiler.");
|
||||
emumode = 1;
|
||||
}
|
||||
(*ConfigSetParameter)(l_ConfigCore, "R4300Emulator", M64TYPE_INT, &emumode);
|
||||
}
|
||||
else if (strcmp(argv[i], "--testshots") == 0 && ArgsLeft >= 1)
|
||||
{
|
||||
l_TestShotList = ParseNumberList(argv[i+1], NULL);
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "--set") == 0 && ArgsLeft >= 1)
|
||||
{
|
||||
if (SetConfigParameter(argv[i+1]) != 0)
|
||||
return M64ERR_INPUT_INVALID;
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "--core-compare-send") == 0)
|
||||
{
|
||||
l_CoreCompareMode = 1;
|
||||
}
|
||||
else if (strcmp(argv[i], "--core-compare-recv") == 0)
|
||||
{
|
||||
l_CoreCompareMode = 2;
|
||||
}
|
||||
else if (strcmp(argv[i], "--nosaveoptions") == 0)
|
||||
{
|
||||
l_SaveOptions = 0;
|
||||
}
|
||||
else if (ArgsLeft == 0)
|
||||
{
|
||||
/* this is the last arg, it should be a ROM filename */
|
||||
l_ROMFilepath = argv[i];
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
else if (strcmp(argv[i], "--verbose") == 0)
|
||||
{
|
||||
g_Verbose = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugMessage(M64MSG_WARNING, "unrecognized command-line parameter '%s'", argv[i]);
|
||||
}
|
||||
/* continue argv loop */
|
||||
}
|
||||
|
||||
/* missing ROM filepath */
|
||||
DebugMessage(M64MSG_ERROR, "no ROM filepath given");
|
||||
return M64ERR_INPUT_INVALID;
|
||||
}
|
||||
|
||||
/*********************************************************************************************************
|
||||
* main function
|
||||
*/
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
printf(" __ __ __ _ _ ____ _ \n");
|
||||
printf("| \\/ |_ _ _ __ ___ _ __ / /_ | || | | _ \\| |_ _ ___ \n");
|
||||
printf("| |\\/| | | | | '_ \\ / _ \\ '_ \\| '_ \\| || |_| |_) | | | | / __| \n");
|
||||
printf("| | | | |_| | |_) | __/ | | | (_) |__ _| __/| | |_| \\__ \\ \n");
|
||||
printf("|_| |_|\\__,_| .__/ \\___|_| |_|\\___/ |_| |_| |_|\\__,_|___/ \n");
|
||||
printf(" |_| http://code.google.com/p/mupen64plus/ \n");
|
||||
printf("%s Version %i.%i.%i\n\n", CONSOLE_UI_NAME, VERSION_PRINTF_SPLIT(CONSOLE_UI_VERSION));
|
||||
|
||||
/* bootstrap some special parameters from the command line */
|
||||
if (ParseCommandLineInitial(argc, (const char **) argv) != 0)
|
||||
return 1;
|
||||
|
||||
/* load the Mupen64Plus core library */
|
||||
if (AttachCoreLib(l_CoreLibPath) != M64ERR_SUCCESS)
|
||||
return 2;
|
||||
|
||||
/* start the Mupen64Plus core library, load the configuration file */
|
||||
m64p_error rval = (*CoreStartup)(CORE_API_VERSION, l_ConfigDirPath, l_DataDirPath, "Core", DebugCallback, NULL, NULL);
|
||||
if (rval != M64ERR_SUCCESS)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "couldn't start Mupen64Plus core library.");
|
||||
DetachCoreLib();
|
||||
return 3;
|
||||
}
|
||||
|
||||
/* Open configuration sections */
|
||||
rval = OpenConfigurationHandles();
|
||||
if (rval != M64ERR_SUCCESS)
|
||||
{
|
||||
(*CoreShutdown)();
|
||||
DetachCoreLib();
|
||||
return 4;
|
||||
}
|
||||
|
||||
/* parse command-line options */
|
||||
rval = ParseCommandLineFinal(argc, (const char **) argv);
|
||||
if (rval != M64ERR_SUCCESS)
|
||||
{
|
||||
(*CoreShutdown)();
|
||||
DetachCoreLib();
|
||||
return 5;
|
||||
}
|
||||
|
||||
/* Handle the core comparison feature */
|
||||
if (l_CoreCompareMode != 0 && !(g_CoreCapabilities & M64CAPS_CORE_COMPARE))
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "can't use --core-compare feature with this Mupen64Plus core library.");
|
||||
DetachCoreLib();
|
||||
return 6;
|
||||
}
|
||||
compare_core_init(l_CoreCompareMode);
|
||||
|
||||
/* save the given command-line options in configuration file if requested */
|
||||
if (l_SaveOptions)
|
||||
SaveConfigurationOptions();
|
||||
|
||||
/* load ROM image */
|
||||
FILE *fPtr = fopen(l_ROMFilepath, "rb");
|
||||
if (fPtr == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "couldn't open ROM file '%s' for reading.", l_ROMFilepath);
|
||||
(*CoreShutdown)();
|
||||
DetachCoreLib();
|
||||
return 7;
|
||||
}
|
||||
|
||||
/* get the length of the ROM, allocate memory buffer, load it from disk */
|
||||
long romlength = 0;
|
||||
fseek(fPtr, 0L, SEEK_END);
|
||||
romlength = ftell(fPtr);
|
||||
fseek(fPtr, 0L, SEEK_SET);
|
||||
unsigned char *ROM_buffer = (unsigned char *) malloc(romlength);
|
||||
if (ROM_buffer == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "couldn't allocate %li-byte buffer for ROM image file '%s'.", romlength, l_ROMFilepath);
|
||||
fclose(fPtr);
|
||||
(*CoreShutdown)();
|
||||
DetachCoreLib();
|
||||
return 8;
|
||||
}
|
||||
else if (fread(ROM_buffer, 1, romlength, fPtr) != romlength)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "couldn't read %li bytes from ROM image file '%s'.", romlength, l_ROMFilepath);
|
||||
free(ROM_buffer);
|
||||
fclose(fPtr);
|
||||
(*CoreShutdown)();
|
||||
DetachCoreLib();
|
||||
return 9;
|
||||
}
|
||||
fclose(fPtr);
|
||||
|
||||
/* Try to load the ROM image into the core */
|
||||
if ((*CoreDoCommand)(M64CMD_ROM_OPEN, (int) romlength, ROM_buffer) != M64ERR_SUCCESS)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "core failed to open ROM image file '%s'.", l_ROMFilepath);
|
||||
free(ROM_buffer);
|
||||
(*CoreShutdown)();
|
||||
DetachCoreLib();
|
||||
return 10;
|
||||
}
|
||||
free(ROM_buffer); /* the core copies the ROM image, so we can release this buffer immediately */
|
||||
|
||||
/* handle the cheat codes */
|
||||
CheatStart(l_CheatMode, l_CheatNumList);
|
||||
if (l_CheatMode == CHEAT_SHOW_LIST)
|
||||
{
|
||||
(*CoreDoCommand)(M64CMD_ROM_CLOSE, 0, NULL);
|
||||
(*CoreShutdown)();
|
||||
DetachCoreLib();
|
||||
return 11;
|
||||
}
|
||||
|
||||
/* search for and load plugins */
|
||||
rval = PluginSearchLoad(l_ConfigUI);
|
||||
if (rval != M64ERR_SUCCESS)
|
||||
{
|
||||
(*CoreDoCommand)(M64CMD_ROM_CLOSE, 0, NULL);
|
||||
(*CoreShutdown)();
|
||||
DetachCoreLib();
|
||||
return 12;
|
||||
}
|
||||
|
||||
/* attach plugins to core */
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if ((*CoreAttachPlugin)(g_PluginMap[i].type, g_PluginMap[i].handle) != M64ERR_SUCCESS)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "core error while attaching %s plugin.", g_PluginMap[i].name);
|
||||
(*CoreDoCommand)(M64CMD_ROM_CLOSE, 0, NULL);
|
||||
(*CoreShutdown)();
|
||||
DetachCoreLib();
|
||||
return 13;
|
||||
}
|
||||
}
|
||||
|
||||
/* set up Frame Callback if --testshots is enabled */
|
||||
if (l_TestShotList != NULL)
|
||||
{
|
||||
if ((*CoreDoCommand)(M64CMD_SET_FRAME_CALLBACK, 0, FrameCallback) != M64ERR_SUCCESS)
|
||||
{
|
||||
DebugMessage(M64MSG_WARNING, "couldn't set frame callback, so --testshots won't work.");
|
||||
}
|
||||
}
|
||||
|
||||
/* run the game */
|
||||
(*CoreDoCommand)(M64CMD_EXECUTE, 0, NULL);
|
||||
|
||||
/* detach plugins from core and unload them */
|
||||
for (i = 0; i < 4; i++)
|
||||
(*CoreDetachPlugin)(g_PluginMap[i].type);
|
||||
PluginUnload();
|
||||
|
||||
/* close the ROM image */
|
||||
(*CoreDoCommand)(M64CMD_ROM_CLOSE, 0, NULL);
|
||||
|
||||
/* save the configuration file again if --nosaveoptions was not specified, to keep any updated parameters from the core/plugins */
|
||||
if (l_SaveOptions)
|
||||
SaveConfigurationOptions();
|
||||
|
||||
/* Shut down and release the Core library */
|
||||
(*CoreShutdown)();
|
||||
DetachCoreLib();
|
||||
|
||||
/* free allocated memory */
|
||||
if (l_TestShotList != NULL)
|
||||
free(l_TestShotList);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus - main.h *
|
||||
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
|
||||
* Copyright (C) 2009 Richard42 *
|
||||
* *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef __MAIN_H__
|
||||
#define __MAIN_H__
|
||||
|
||||
extern void DebugMessage(int level, const char *message, ...);
|
||||
extern void DebugCallback(void *Context, int level, const char *message);
|
||||
|
||||
extern int g_Verbose;
|
||||
|
||||
#endif /* __MAIN_H__ */
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus-ui-console - osal_dynamiclib.h *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#if !defined(OSAL_DYNAMICLIB_H)
|
||||
#define OSAL_DYNAMICLIB_H
|
||||
|
||||
#include "m64p_types.h"
|
||||
|
||||
m64p_error osal_dynlib_open(m64p_dynlib_handle *pLibHandle, const char *pccLibraryPath);
|
||||
|
||||
void * osal_dynlib_getproc(m64p_dynlib_handle LibHandle, const char *pccProcedureName);
|
||||
|
||||
m64p_error osal_dynlib_close(m64p_dynlib_handle LibHandle);
|
||||
|
||||
#endif /* #define OSAL_DYNAMICLIB_H */
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus-ui-console - osal_dynamiclib_unix.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 <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "main.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 = dlopen(pccLibraryPath, RTLD_NOW);
|
||||
|
||||
if (*pLibHandle == NULL)
|
||||
{
|
||||
/* only print an error message if there is a directory separator (/) in the pathname */
|
||||
/* this prevents us from throwing an error for the use case where Mupen64Plus is not installed */
|
||||
if (strchr(pccLibraryPath, '/') != NULL)
|
||||
DebugMessage(M64MSG_ERROR, "dlopen('%s') failed: %s", pccLibraryPath, dlerror());
|
||||
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 dlsym(LibHandle, pccProcedureName);
|
||||
}
|
||||
|
||||
m64p_error osal_dynlib_close(m64p_dynlib_handle LibHandle)
|
||||
{
|
||||
int rval = dlclose(LibHandle);
|
||||
|
||||
if (rval != 0)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "dlclose() failed: %s", dlerror());
|
||||
return M64ERR_INTERNAL;
|
||||
}
|
||||
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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 "main.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);
|
||||
DebugMessage(M64MSG_ERROR, "LoadLibrary('%s') error: %s", 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);
|
||||
DebugMessage(M64MSG_ERROR, "FreeLibrary() error: %s", pchErrMsg);
|
||||
LocalFree(pchErrMsg);
|
||||
return M64ERR_INTERNAL;
|
||||
}
|
||||
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus-ui-console - osal_files.h *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* This header file is for all kinds of system-dependent file handling
|
||||
*
|
||||
*/
|
||||
|
||||
#if !defined(OSAL_FILES_H)
|
||||
#define OSAL_FILES_H
|
||||
|
||||
#include "m64p_types.h"
|
||||
#include "osal_preproc.h"
|
||||
|
||||
/* data structure for linked list of shared libraries found in a directory */
|
||||
typedef struct _osal_lib_search {
|
||||
char filepath[PATH_MAX];
|
||||
char *filename;
|
||||
m64p_plugin_type plugin_type;
|
||||
struct _osal_lib_search *next;
|
||||
} osal_lib_search;
|
||||
|
||||
/* const definitions for system directories to search when looking for mupen64plus plugins */
|
||||
extern const int osal_libsearchdirs;
|
||||
extern const char *osal_libsearchpath[];
|
||||
|
||||
/* functions for searching for shared libraries in a given directory */
|
||||
extern osal_lib_search *osal_library_search(const char *searchpath);
|
||||
extern void osal_free_lib_list(osal_lib_search *head);
|
||||
|
||||
#endif /* #define OSAL_FILES_H */
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus-ui-console - osal_files_unix.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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* This implements all kinds of system-dependent file handling
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h> // for opendir(), readdir(), closedir()
|
||||
|
||||
#include "main.h"
|
||||
#include "m64p_types.h"
|
||||
#include "osal_preproc.h"
|
||||
#include "osal_files.h"
|
||||
|
||||
/* definitions for system directories to search when looking for mupen64plus plugins */
|
||||
#if defined(PLUGINDIR)
|
||||
const int osal_libsearchdirs = 4;
|
||||
const char *osal_libsearchpath[4] = { PLUGINDIR, "/usr/local/lib/mupen64plus", "/usr/lib/mupen64plus", "./" };
|
||||
#else
|
||||
const int osal_libsearchdirs = 3;
|
||||
const char *osal_libsearchpath[3] = { "/usr/local/lib/mupen64plus", "/usr/lib/mupen64plus", "./" };
|
||||
#endif
|
||||
|
||||
osal_lib_search *osal_library_search(const char *searchpath)
|
||||
{
|
||||
osal_lib_search *head = NULL, *curr = NULL;
|
||||
DIR *dir;
|
||||
struct dirent *entry;
|
||||
|
||||
#ifdef __APPLE__
|
||||
const char* suffix = ".dylib";
|
||||
#else
|
||||
const char* suffix = ".so";
|
||||
#endif
|
||||
|
||||
dir = opendir(searchpath);
|
||||
if (dir == NULL)
|
||||
return NULL;
|
||||
|
||||
/* look for any shared libraries in this folder */
|
||||
while ((entry = readdir(dir)) != NULL)
|
||||
{
|
||||
osal_lib_search *newlib = NULL;
|
||||
if (strcmp(entry->d_name + strlen(entry->d_name) - strlen(suffix), suffix) != 0)
|
||||
continue;
|
||||
/* this is a .so file, so add it to the list */
|
||||
newlib = malloc(sizeof(osal_lib_search));
|
||||
if (newlib == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "Memory allocation error in osal_library_search()!");
|
||||
osal_free_lib_list(head);
|
||||
closedir(dir);
|
||||
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 = strlen(curr->filepath);
|
||||
curr->filename = curr->filepath + pathlen;
|
||||
strncat(curr->filepath, entry->d_name, PATH_MAX - pathlen - 1);
|
||||
curr->filepath[PATH_MAX-1] = 0;
|
||||
/* set plugin_type and next pointer */
|
||||
curr->plugin_type = 0;
|
||||
curr->next = NULL;
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
return head;
|
||||
}
|
||||
|
||||
void osal_free_lib_list(osal_lib_search *head)
|
||||
{
|
||||
while (head != NULL)
|
||||
{
|
||||
osal_lib_search *next = head->next;
|
||||
free(head);
|
||||
head = next;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus-ui-console - osal_files_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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* This implements all kinds of system-dependent file handling
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "main.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)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "Couldn't allocate memory for file search path in osal_library_search()!");
|
||||
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)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "Memory allocation error in osal_library_search()!");
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus-ui-console - osal_preproc.h *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* This header file is for OS-specific #includes and #defines
|
||||
*
|
||||
*/
|
||||
|
||||
#if !defined(OSAL_PREPROC_H)
|
||||
#define OSAL_PREPROC_H
|
||||
|
||||
#if defined(WIN32)
|
||||
|
||||
#include <windows.h>
|
||||
#define PATH_MAX 2048
|
||||
#define OSAL_DEFAULT_DYNLIB_FILENAME "mupen64plus.dll"
|
||||
#define OSAL_DIR_SEPARATOR '\\'
|
||||
#define OSAL_CURRENT_DIR ".\\"
|
||||
#define OSAL_DLL_EXTENSION ".dll"
|
||||
#define osal_insensitive_strcmp(x, y) _stricmp(x, y)
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
#include <limits.h> // for PATH_MAX
|
||||
#define OSAL_DEFAULT_DYNLIB_FILENAME "libmupen64plus.dylib"
|
||||
#define OSAL_DIR_SEPARATOR '/'
|
||||
#define OSAL_CURRENT_DIR "./"
|
||||
#define OSAL_DLL_EXTENSION ".dylib"
|
||||
#define osal_insensitive_strcmp(x, y) strcasecmp(x, y)
|
||||
|
||||
#else /* Linux-like UNIX */
|
||||
|
||||
#include <limits.h> // for PATH_MAX
|
||||
#define OSAL_DEFAULT_DYNLIB_FILENAME "libmupen64plus.so.2"
|
||||
#define OSAL_DIR_SEPARATOR '/'
|
||||
#define OSAL_CURRENT_DIR "./"
|
||||
#define OSAL_DLL_EXTENSION ".so"
|
||||
#define osal_insensitive_strcmp(x, y) strcasecmp(x, y)
|
||||
|
||||
/* PATH_MAX only may be defined by limits.h */
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* #define OSAL_PREPROC_H */
|
||||
|
|
@ -1,261 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus-ui-console - plugin.c *
|
||||
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
|
||||
* Copyright (C) 2009 Richard42 *
|
||||
* *
|
||||
* 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 <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "m64p_types.h"
|
||||
#include "m64p_common.h"
|
||||
#include "core_interface.h"
|
||||
#include "osal_dynamiclib.h"
|
||||
#include "osal_files.h"
|
||||
#include "plugin.h"
|
||||
#include "main.h" /* for the debug callback function */
|
||||
#include "version.h"
|
||||
|
||||
/* global variables */
|
||||
const char *g_PluginDir = NULL;
|
||||
const char *g_GfxPlugin = NULL; // pointer to graphics plugin specified at commandline (if any)
|
||||
const char *g_AudioPlugin = NULL; // pointer to audio plugin specified at commandline (if any)
|
||||
const char *g_InputPlugin = NULL; // pointer to input plugin specified at commandline (if any)
|
||||
const char *g_RspPlugin = NULL; // pointer to rsp plugin specified at commandline (if any)
|
||||
|
||||
plugin_map_node g_PluginMap[] = {{M64PLUGIN_GFX, "Video", NULL, "", NULL, 0 },
|
||||
{M64PLUGIN_AUDIO, "Audio", NULL, "", NULL, 0 },
|
||||
{M64PLUGIN_INPUT, "Input", NULL, "", NULL, 0 },
|
||||
{M64PLUGIN_RSP, "RSP", NULL, "", NULL, 0 } };
|
||||
|
||||
/* local functions */
|
||||
static m64p_error PluginLoadTry(const char *filepath, int MapIndex)
|
||||
{
|
||||
/* try to open a shared library at the given filepath */
|
||||
m64p_dynlib_handle handle;
|
||||
m64p_error rval = osal_dynlib_open(&handle, filepath);
|
||||
if (rval != M64ERR_SUCCESS)
|
||||
return rval;
|
||||
|
||||
/* call the GetVersion function for the plugin and check compatibility */
|
||||
ptr_PluginGetVersion PluginGetVersion = (ptr_PluginGetVersion) osal_dynlib_getproc(handle, "PluginGetVersion");
|
||||
if (PluginGetVersion == NULL)
|
||||
{
|
||||
if (g_Verbose)
|
||||
DebugMessage(M64MSG_ERROR, "library '%s' is not a Mupen64Plus library.", filepath);
|
||||
osal_dynlib_close(handle);
|
||||
return M64ERR_INCOMPATIBLE;
|
||||
}
|
||||
m64p_plugin_type PluginType = (m64p_plugin_type) 0;
|
||||
int PluginVersion = 0;
|
||||
const char *PluginName = NULL;
|
||||
(*PluginGetVersion)(&PluginType, &PluginVersion, NULL, &PluginName, NULL);
|
||||
if (PluginType != g_PluginMap[MapIndex].type)
|
||||
{
|
||||
/* the type of this plugin doesn't match with the type that was requested by the caller */
|
||||
osal_dynlib_close(handle);
|
||||
return M64ERR_INCOMPATIBLE;
|
||||
}
|
||||
/* 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 = (ptr_PluginStartup) osal_dynlib_getproc(handle, "PluginStartup");
|
||||
if (PluginStartup == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "library '%s' broken. No PluginStartup() function found.", filepath);
|
||||
osal_dynlib_close(handle);
|
||||
return M64ERR_INCOMPATIBLE;
|
||||
}
|
||||
rval = (*PluginStartup)(CoreHandle, g_PluginMap[MapIndex].name, DebugCallback); /* DebugCallback is in main.c */
|
||||
if (rval != M64ERR_SUCCESS)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "Error: %s plugin library '%s' failed to start.", g_PluginMap[MapIndex].name, filepath);
|
||||
osal_dynlib_close(handle);
|
||||
return rval;
|
||||
}
|
||||
|
||||
/* plugin loaded successfully, so set the plugin map's members */
|
||||
g_PluginMap[MapIndex].handle = handle;
|
||||
strcpy(g_PluginMap[MapIndex].filename, filepath);
|
||||
g_PluginMap[MapIndex].libname = PluginName;
|
||||
g_PluginMap[MapIndex].libversion = PluginVersion;
|
||||
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
/* global functions */
|
||||
m64p_error PluginSearchLoad(m64p_handle ConfigUI)
|
||||
{
|
||||
osal_lib_search *lib_filelist = NULL;
|
||||
int i;
|
||||
|
||||
/* start by checking the directory given on the command line */
|
||||
if (g_PluginDir != NULL)
|
||||
{
|
||||
lib_filelist = osal_library_search(g_PluginDir);
|
||||
if (lib_filelist == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "No plugins found in --plugindir path: %s", g_PluginDir);
|
||||
return M64ERR_INPUT_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
/* if no plugins found, search the PluginDir in the UI-console section of the config file */
|
||||
if (lib_filelist == NULL)
|
||||
{
|
||||
const char *plugindir = (*ConfigGetParamString)(ConfigUI, "PluginDir");
|
||||
lib_filelist = osal_library_search(plugindir);
|
||||
}
|
||||
|
||||
/* if still no plugins found, search some common system folders */
|
||||
if (lib_filelist == NULL)
|
||||
{
|
||||
for (i = 0; i < osal_libsearchdirs; i++)
|
||||
{
|
||||
lib_filelist = osal_library_search(osal_libsearchpath[i]);
|
||||
if (lib_filelist != NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* try to load one of each type of plugin */
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
m64p_plugin_type type = g_PluginMap[i].type;
|
||||
const char *cmdline_path = NULL;
|
||||
const char *config_var = NULL;
|
||||
int use_dummy = 0;
|
||||
switch (type)
|
||||
{
|
||||
case M64PLUGIN_RSP: cmdline_path = g_RspPlugin; config_var = "RspPlugin"; break;
|
||||
case M64PLUGIN_GFX: cmdline_path = g_GfxPlugin; config_var = "VideoPlugin"; break;
|
||||
case M64PLUGIN_AUDIO: cmdline_path = g_AudioPlugin; config_var = "AudioPlugin"; break;
|
||||
case M64PLUGIN_INPUT: cmdline_path = g_InputPlugin; config_var = "InputPlugin"; break;
|
||||
default: cmdline_path = NULL; config_var = "";
|
||||
}
|
||||
/* first search for a plugin matching what was given on the command line */
|
||||
if (cmdline_path != NULL)
|
||||
{
|
||||
/* if full path was given, try loading exactly this file */
|
||||
if (strchr(cmdline_path, OSAL_DIR_SEPARATOR) != NULL)
|
||||
{
|
||||
PluginLoadTry(cmdline_path, i);
|
||||
}
|
||||
else if (strcmp(cmdline_path, "dummy") == 0)
|
||||
{
|
||||
use_dummy = 1;
|
||||
}
|
||||
else /* otherwise search through the plugin directory to find a match with this name */
|
||||
{
|
||||
osal_lib_search *curr = lib_filelist;
|
||||
while (curr != NULL && g_PluginMap[i].handle == NULL)
|
||||
{
|
||||
if (strncmp(curr->filename, cmdline_path, strlen(cmdline_path)) == 0)
|
||||
PluginLoadTry(curr->filepath, i);
|
||||
curr = curr->next;
|
||||
}
|
||||
}
|
||||
/* exit with error if we couldn't find the specified plugin */
|
||||
if (!use_dummy && g_PluginMap[i].handle == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "Specified %s plugin not found: %s", g_PluginMap[i].name, cmdline_path);
|
||||
osal_free_lib_list(lib_filelist);
|
||||
return M64ERR_INPUT_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
else /* otherwise search for a plugin specified in the config file */
|
||||
{
|
||||
const char *config_path = (*ConfigGetParamString)(ConfigUI, config_var);
|
||||
if (config_path != NULL && strlen(config_path) > 0)
|
||||
{
|
||||
/* if full path was given, try loading exactly this file */
|
||||
if (strchr(config_path, OSAL_DIR_SEPARATOR) != NULL)
|
||||
{
|
||||
PluginLoadTry(config_path, i);
|
||||
}
|
||||
else if (strcmp(config_path, "dummy") == 0)
|
||||
{
|
||||
use_dummy = 1;
|
||||
}
|
||||
else /* otherwise search through the plugin directory to find a match with this name */
|
||||
{
|
||||
osal_lib_search *curr = lib_filelist;
|
||||
while (curr != NULL && g_PluginMap[i].handle == NULL)
|
||||
{
|
||||
if (strncmp(curr->filename, config_path, strlen(config_path)) == 0)
|
||||
PluginLoadTry(curr->filepath, i);
|
||||
curr = curr->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* As a last resort, search for any appropriate plugin in search directory */
|
||||
if (!use_dummy && g_PluginMap[i].handle == NULL)
|
||||
{
|
||||
osal_lib_search *curr = lib_filelist;
|
||||
while (curr != NULL && g_PluginMap[i].handle == NULL)
|
||||
{
|
||||
PluginLoadTry(curr->filepath, i);
|
||||
curr = curr->next;
|
||||
}
|
||||
}
|
||||
/* print out the particular plugin used */
|
||||
if (g_PluginMap[i].handle == NULL)
|
||||
{
|
||||
DebugMessage(M64MSG_INFO, "using %s plugin: <dummy>", g_PluginMap[i].name);
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugMessage(M64MSG_INFO, "using %s plugin: '%s' v%i.%i.%i", g_PluginMap[i].name,
|
||||
g_PluginMap[i].libname, VERSION_PRINTF_SPLIT(g_PluginMap[i].libversion));
|
||||
DebugMessage(M64MSG_VERBOSE, "%s plugin library: %s", g_PluginMap[i].name, g_PluginMap[i].filename);
|
||||
}
|
||||
}
|
||||
|
||||
/* free up the list of library files in the plugin search directory */
|
||||
osal_free_lib_list(lib_filelist);
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
m64p_error PluginUnload(void)
|
||||
{
|
||||
typedef m64p_error (*ptr_PluginShutdown)(void);
|
||||
ptr_PluginShutdown PluginShutdown;
|
||||
int i;
|
||||
|
||||
/* shutdown each type of plugin */
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (g_PluginMap[i].handle == NULL)
|
||||
continue;
|
||||
/* call the destructor function for the plugin and release the library */
|
||||
PluginShutdown = (ptr_PluginShutdown) osal_dynlib_getproc(g_PluginMap[i].handle, "PluginShutdown");
|
||||
if (PluginShutdown != NULL)
|
||||
(*PluginShutdown)();
|
||||
osal_dynlib_close(g_PluginMap[i].handle);
|
||||
/* clear out the plugin map's members */
|
||||
g_PluginMap[i].handle = NULL;
|
||||
g_PluginMap[i].filename[0] = 0;
|
||||
g_PluginMap[i].libname = NULL;
|
||||
g_PluginMap[i].libversion = 0;
|
||||
}
|
||||
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus-ui-console - plugin.h *
|
||||
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
|
||||
* Copyright (C) 2009 Richard42 *
|
||||
* *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#if !defined(PLUGIN_H)
|
||||
#define PLUGIN_H
|
||||
|
||||
#include "m64p_types.h"
|
||||
#include "osal_preproc.h"
|
||||
|
||||
extern m64p_error PluginSearchLoad(m64p_handle ConfigUI);
|
||||
extern m64p_error PluginUnload(void);
|
||||
|
||||
extern const char *g_PluginDir; // directory to search for plugins
|
||||
extern const char *g_GfxPlugin; // graphics plugin specified at commandline (if any)
|
||||
extern const char *g_AudioPlugin; // audio plugin specified at commandline (if any)
|
||||
extern const char *g_InputPlugin; // input plugin specified at commandline (if any)
|
||||
extern const char *g_RspPlugin; // rsp plugin specified at commandline (if any)
|
||||
|
||||
typedef struct {
|
||||
m64p_plugin_type type;
|
||||
char name[8];
|
||||
m64p_dynlib_handle handle;
|
||||
char filename[PATH_MAX];
|
||||
const char *libname;
|
||||
int libversion;
|
||||
} plugin_map_node;
|
||||
|
||||
extern plugin_map_node g_PluginMap[4];
|
||||
|
||||
#endif /* #define PLUGIN_H */
|
||||
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus-ui-console - version.h *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* This header file is for versioning information
|
||||
*
|
||||
*/
|
||||
|
||||
#if !defined(VERSION_H)
|
||||
#define VERSION_H
|
||||
|
||||
#define CONSOLE_UI_NAME "Mupen64Plus Console User-Interface"
|
||||
#define CONSOLE_UI_VERSION 0x016305
|
||||
#define CORE_API_VERSION 0x20001
|
||||
#define CONFIG_API_VERSION 0x20000
|
||||
|
||||
#define MINIMUM_CORE_VERSION 0x016300
|
||||
|
||||
#define VERSION_PRINTF_SPLIT(x) (((x) >> 16) & 0xffff), (((x) >> 8) & 0xff), ((x) & 0xff)
|
||||
|
||||
#endif /* #define VERSION_H */
|
||||
|
|
@ -157,7 +157,7 @@
|
|||
</MASM>
|
||||
<PostBuildEvent>
|
||||
<Message>Copying shared data and libraries to build directory...</Message>
|
||||
<Command>xcopy /y $(OutDir)$(TargetName)$(TargetExt) $(TargetDir)..\..\..\..\..\output\dll\</Command>
|
||||
<Command>xcopy /y "$(OutDir)$(TargetName)$(TargetExt)" "$(TargetDir)..\..\..\..\..\output\dll\"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /y $(OutDir)$(TargetName)$(TargetExt) $(TargetDir)..\..\..\..\..\output\dll\</Command>
|
||||
<Command>xcopy /y "$(OutDir)$(TargetName)$(TargetExt)" "$(TargetDir)..\..\..\..\..\output\dll\"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
|
Loading…
Reference in New Issue