gambatte: some stuff for 64 bit builds, both msvc and mingw
This commit is contained in:
parent
eb2ec58b1b
commit
970fb54ca5
|
@ -140,7 +140,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
/// combination of button flags used by the input callback
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum Buttons
|
||||
public enum Buttons: uint
|
||||
{
|
||||
A = 0x01,
|
||||
B = 0x02,
|
||||
|
@ -333,12 +333,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
[DllImport("libgambatte.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern bool gambatte_newstateload(IntPtr core, byte[] data, int len);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void DataFunction(IntPtr data, int length, string name);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void SectionFunction(string name);
|
||||
|
||||
[DllImport("libgambatte.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void gambatte_newstatesave_ex(IntPtr core, ref TextStateFPtrs ff);
|
||||
|
||||
|
|
|
@ -1,11 +1,25 @@
|
|||
CXX = g++
|
||||
#CXXFLAGS = -Wall -I -Wno-multichar -O3
|
||||
CXXFLAGS = -Wall -Iinclude -Isrc -O3 -std=c++11 -fomit-frame-pointer -fno-exceptions
|
||||
TARGET = libgambatte.dll
|
||||
LDFLAGS = -shared -static-libgcc -static-libstdc++ $(CXXFLAGS)
|
||||
RM = rm
|
||||
CP = cp
|
||||
|
||||
MACHINE = $(shell $(CXX) -dumpmachine)
|
||||
ifneq (,$(findstring i686,$(MACHINE)))
|
||||
ARCH = 32
|
||||
else ifneq (,$(findstring x86_64,$(MACHINE)))
|
||||
ARCH = 64
|
||||
else
|
||||
$(error Unknown arch)
|
||||
endif
|
||||
|
||||
CXXFLAGS = -Wall -Iinclude -Isrc -O3 -std=c++11 -fno-exceptions -flto
|
||||
TARGET = libgambatte.dll
|
||||
LDFLAGS_32 = -static -static-libgcc -static-libstdc++
|
||||
LDFLAGS_64 =
|
||||
LDFLAGS = -shared $(LDFLAGS_$(ARCH)) $(CXXFLAGS)
|
||||
|
||||
DEST_32 = ../output/dll
|
||||
DEST_64 = ../output64/dll
|
||||
|
||||
SRCS = \
|
||||
src/cinterface.cpp \
|
||||
src/cpu.cpp \
|
||||
|
@ -49,4 +63,4 @@ clean:
|
|||
$(RM) $(TARGET)
|
||||
|
||||
install:
|
||||
$(CP) $(TARGET) ../output/dll
|
||||
$(CP) $(TARGET) $(DEST_$(ARCH))
|
||||
|
|
|
@ -6,13 +6,19 @@ EndProject
|
|||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{5D630682-7BDA-474D-B387-0EB420DDC199}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{5D630682-7BDA-474D-B387-0EB420DDC199}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{5D630682-7BDA-474D-B387-0EB420DDC199}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{5D630682-7BDA-474D-B387-0EB420DDC199}.Debug|x64.Build.0 = Debug|x64
|
||||
{5D630682-7BDA-474D-B387-0EB420DDC199}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{5D630682-7BDA-474D-B387-0EB420DDC199}.Release|Win32.Build.0 = Release|Win32
|
||||
{5D630682-7BDA-474D-B387-0EB420DDC199}.Release|x64.ActiveCfg = Release|x64
|
||||
{5D630682-7BDA-474D-B387-0EB420DDC199}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -5,10 +5,18 @@
|
|||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{5D630682-7BDA-474D-B387-0EB420DDC199}</ProjectGuid>
|
||||
|
@ -21,28 +29,51 @@
|
|||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" 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 Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
|
@ -61,6 +92,24 @@
|
|||
<Command>copy /y $(TargetDir)$(TargetFileName) $(ProjectDir)..\output\dll\$(TargetFileName)</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGAMBATTE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>include;src;src\common</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4244;4373;4800;4804</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy /y $(TargetDir)$(TargetFileName) $(ProjectDir)..\output64\dll\$(TargetFileName)</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
|
@ -83,6 +132,28 @@
|
|||
<Command>copy /y $(TargetDir)$(TargetFileName) $(ProjectDir)..\output\dll\$(TargetFileName)</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGAMBATTE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>include;src;src\common</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4244;4373;4800;4804</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy /y $(TargetDir)$(TargetFileName) $(ProjectDir)..\output64\dll\$(TargetFileName)</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\gambatte.h" />
|
||||
<ClInclude Include="include\gbint.h" />
|
||||
|
|
|
@ -35,15 +35,15 @@ GBEXPORT int gambatte_load(GB *g, const char *romfiledata, unsigned romfilelengt
|
|||
return ret;
|
||||
}
|
||||
|
||||
GBEXPORT long gambatte_runfor(GB *g, short *soundbuf, unsigned *samples)
|
||||
GBEXPORT int gambatte_runfor(GB *g, short *soundbuf, unsigned *samples)
|
||||
{
|
||||
unsigned sampv = *samples;
|
||||
long ret = g->runFor((unsigned int *) soundbuf, sampv);
|
||||
int ret = g->runFor((unsigned int *) soundbuf, sampv);
|
||||
*samples = sampv;
|
||||
return ret;
|
||||
}
|
||||
|
||||
GBEXPORT void gambatte_blitto(GB *g, unsigned long *videobuf, int pitch)
|
||||
GBEXPORT void gambatte_blitto(GB *g, unsigned int *videobuf, int pitch)
|
||||
{
|
||||
g->blitTo((unsigned int *)videobuf, pitch);
|
||||
}
|
||||
|
@ -134,21 +134,21 @@ GBEXPORT int gambatte_savesavedatalength(GB *g)
|
|||
return g->saveSavedataLength();
|
||||
}
|
||||
|
||||
GBEXPORT long gambatte_newstatelen(GB *g)
|
||||
GBEXPORT int gambatte_newstatelen(GB *g)
|
||||
{
|
||||
NewStateDummy dummy;
|
||||
g->SyncState<false>(&dummy);
|
||||
return dummy.GetLength();
|
||||
}
|
||||
|
||||
GBEXPORT int gambatte_newstatesave(GB *g, char *data, long len)
|
||||
GBEXPORT int gambatte_newstatesave(GB *g, char *data, int len)
|
||||
{
|
||||
NewStateExternalBuffer saver(data, len);
|
||||
g->SyncState<false>(&saver);
|
||||
return !saver.Overflow() && saver.GetLength() == len;
|
||||
}
|
||||
|
||||
GBEXPORT int gambatte_newstateload(GB *g, const char *data, long len)
|
||||
GBEXPORT int gambatte_newstateload(GB *g, const char *data, int len)
|
||||
{
|
||||
NewStateExternalBuffer loader((char *)data, len);
|
||||
g->SyncState<true>(&loader);
|
||||
|
|
Loading…
Reference in New Issue