Merge win32 build components back into main tree

This commit is contained in:
rdanbrook
2020-12-05 11:47:00 -05:00
parent 3f2106e65d
commit 204248dbe3
296 changed files with 75368 additions and 0 deletions

BIN
lib/zlibstat.lib Normal file

Binary file not shown.

2678
projects/core.vcproj Normal file

File diff suppressed because it is too large Load Diff

743
projects/core.vcxproj Normal file
View File

@@ -0,0 +1,743 @@
<?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>{CCC3A09C-0F7A-4E12-8594-11F2C60D71DA}</ProjectGuid>
<RootNamespace>Core</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>NotSet</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.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)debugout\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">debug\core\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)releaseout\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">release\core\</IntDir>
<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>
<AdditionalOptions>/vmb /J %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NST_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<SmallerTypeCheck>true</SmallerTypeCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<StructMemberAlignment>Default</StructMemberAlignment>
<FunctionLevelLinking>true</FunctionLevelLinking>
<FloatingPointModel>Precise</FloatingPointModel>
<FloatingPointExceptions>true</FloatingPointExceptions>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CallingConvention>FastCall</CallingConvention>
<ShowIncludes>false</ShowIncludes>
<OmitDefaultLibName>true</OmitDefaultLibName>
</ClCompile>
<Lib>
<UseUnicodeResponseFiles>false</UseUnicodeResponseFiles>
<OutputFile>$(SolutionDir)..\lib\emucoredebug.lib</OutputFile>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalOptions>/vmb /J %(AdditionalOptions)</AdditionalOptions>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<PreprocessorDefinitions>NDEBUG;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FunctionLevelLinking>true</FunctionLevelLinking>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<FloatingPointModel>Precise</FloatingPointModel>
<DisableLanguageExtensions>true</DisableLanguageExtensions>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<AssemblerOutput>AssemblyAndSourceCode</AssemblerOutput>
<AssemblerListingLocation>$(SolutionDir)Release\Core\Asm\</AssemblerListingLocation>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
<CallingConvention>FastCall</CallingConvention>
<OmitDefaultLibName>true</OmitDefaultLibName>
</ClCompile>
<Lib>
<UseUnicodeResponseFiles>false</UseUnicodeResponseFiles>
<OutputFile>$(SolutionDir)..\lib\emucore.lib</OutputFile>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\source\core\api\NstApi.hpp" />
<ClInclude Include="..\source\core\api\NstApiBarcodeReader.hpp" />
<ClInclude Include="..\source\core\api\NstApiCartridge.hpp" />
<ClInclude Include="..\source\core\api\NstApiCheats.hpp" />
<ClInclude Include="..\source\core\api\NstApiConfig.hpp" />
<ClInclude Include="..\source\core\api\NstApiDipSwitches.hpp" />
<ClInclude Include="..\source\core\api\NstApiEmulator.hpp" />
<ClInclude Include="..\source\core\api\NstApiFds.hpp" />
<ClInclude Include="..\source\core\api\NstApiInput.hpp" />
<ClInclude Include="..\source\core\api\NstApiMachine.hpp" />
<ClInclude Include="..\source\core\api\NstApiMovie.hpp" />
<ClInclude Include="..\source\core\api\NstApiNsf.hpp" />
<ClInclude Include="..\source\core\api\NstApiRewinder.hpp" />
<ClInclude Include="..\source\core\api\NstApiSound.hpp" />
<ClInclude Include="..\source\core\api\NstApiTapeRecorder.hpp" />
<ClInclude Include="..\source\core\api\NstApiUser.hpp" />
<ClInclude Include="..\source\core\api\NstApiVideo.hpp" />
<ClInclude Include="..\source\core\board\NstBoardAcclaim.hpp" />
<ClInclude Include="..\source\core\board\NstBoardAcclaimMcAcc.hpp" />
<ClInclude Include="..\source\core\NstVideoFilterxBR.hpp" />
<ClInclude Include="..\source\core\vssystem\NstVsRbiBaseball.hpp" />
<ClInclude Include="..\source\core\vssystem\NstVsSuperXevious.hpp" />
<ClInclude Include="..\source\core\vssystem\NstVsSystem.hpp" />
<ClInclude Include="..\source\core\vssystem\NstVsTkoBoxing.hpp" />
<ClInclude Include="..\source\core\NstVideoFilter2xSaI.hpp" />
<ClInclude Include="..\source\core\NstVideoFilterHqX.hpp" />
<ClInclude Include="..\source\core\NstVideoFilterNone.hpp" />
<ClInclude Include="..\source\core\NstVideoFilterNtsc.hpp" />
<ClInclude Include="..\source\core\NstVideoFilterScaleX.hpp" />
<ClInclude Include="..\source\nes_ntsc\nes_ntsc.h" />
<ClInclude Include="..\source\nes_ntsc\nes_ntsc_config.h" />
<ClInclude Include="..\source\nes_ntsc\nes_ntsc_impl.h" />
<ClInclude Include="..\source\core\input\NstInpAdapter.hpp" />
<ClInclude Include="..\source\core\input\NstInpBandaiHyperShot.hpp" />
<ClInclude Include="..\source\core\input\NstInpBarcodeWorld.hpp" />
<ClInclude Include="..\source\core\input\NstInpCrazyClimber.hpp" />
<ClInclude Include="..\source\core\input\NstInpDevice.hpp" />
<ClInclude Include="..\source\core\input\NstInpDoremikkoKeyboard.hpp" />
<ClInclude Include="..\source\core\input\NstInpExcitingBoxing.hpp" />
<ClInclude Include="..\source\core\input\NstInpFamilyKeyboard.hpp" />
<ClInclude Include="..\source\core\input\NstInpFamilyTrainer.hpp" />
<ClInclude Include="..\source\core\input\NstInpHoriTrack.hpp" />
<ClInclude Include="..\source\core\input\NstInpKonamiHyperShot.hpp" />
<ClInclude Include="..\source\core\input\NstInpMahjong.hpp" />
<ClInclude Include="..\source\core\input\NstInpMouse.hpp" />
<ClInclude Include="..\source\core\input\NstInpOekaKidsTablet.hpp" />
<ClInclude Include="..\source\core\input\NstInpPachinko.hpp" />
<ClInclude Include="..\source\core\input\NstInpPad.hpp" />
<ClInclude Include="..\source\core\input\NstInpPaddle.hpp" />
<ClInclude Include="..\source\core\input\NstInpPartyTap.hpp" />
<ClInclude Include="..\source\core\input\NstInpPokkunMoguraa.hpp" />
<ClInclude Include="..\source\core\input\NstInpPowerGlove.hpp" />
<ClInclude Include="..\source\core\input\NstInpPowerPad.hpp" />
<ClInclude Include="..\source\core\input\NstInpRob.hpp" />
<ClInclude Include="..\source\core\input\NstInpSuborKeyboard.hpp" />
<ClInclude Include="..\source\core\input\NstInpTopRider.hpp" />
<ClInclude Include="..\source\core\input\NstInpTurboFile.hpp" />
<ClInclude Include="..\source\core\input\NstInpZapper.hpp" />
<ClInclude Include="..\source\core\board\NstBoard.hpp" />
<ClInclude Include="..\source\core\board\NstBoardAxRom.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBxRom.hpp" />
<ClInclude Include="..\source\core\board\NstBoardCxRom.hpp" />
<ClInclude Include="..\source\core\board\NstBoardDiscrete.hpp" />
<ClInclude Include="..\source\core\board\NstBoardDxRom.hpp" />
<ClInclude Include="..\source\core\board\NstBoardExRom.hpp" />
<ClInclude Include="..\source\core\board\NstBoardFxRom.hpp" />
<ClInclude Include="..\source\core\board\NstBoardGxRom.hpp" />
<ClInclude Include="..\source\core\board\NstBoardHxRom.hpp" />
<ClInclude Include="..\source\core\board\NstBoardJxRom.hpp" />
<ClInclude Include="..\source\core\board\NstBoardMmc1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardMmc2.hpp" />
<ClInclude Include="..\source\core\board\NstBoardMmc3.hpp" />
<ClInclude Include="..\source\core\board\NstBoardMmc4.hpp" />
<ClInclude Include="..\source\core\board\NstBoardMmc5.hpp" />
<ClInclude Include="..\source\core\board\NstBoardMmc6.hpp" />
<ClInclude Include="..\source\core\board\NstBoardMxRom.hpp" />
<ClInclude Include="..\source\core\board\NstBoardNRom.hpp" />
<ClInclude Include="..\source\core\board\NstBoardNxRom.hpp" />
<ClInclude Include="..\source\core\board\NstBoardPxRom.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSxRom.hpp" />
<ClInclude Include="..\source\core\board\NstBoardTxRom.hpp" />
<ClInclude Include="..\source\core\board\NstBoardUxRom.hpp" />
<ClInclude Include="..\source\core\board\NstBoardEvent.hpp" />
<ClInclude Include="..\source\core\board\NstBoardFb.hpp" />
<ClInclude Include="..\source\core\board\NstBoardFfe.hpp" />
<ClInclude Include="..\source\core\board\NstBoardQj.hpp" />
<ClInclude Include="..\source\core\board\NstBoardRumbleStation.hpp" />
<ClInclude Include="..\source\core\board\NstBoardVsSystem.hpp" />
<ClInclude Include="..\source\core\board\NstBoardZz.hpp" />
<ClInclude Include="..\source\core\board\NstBoardAe.hpp" />
<ClInclude Include="..\source\core\board\NstBoardAgci.hpp" />
<ClInclude Include="..\source\core\board\NstBoardAve.hpp" />
<ClInclude Include="..\source\core\board\NstBoardAveD1012.hpp" />
<ClInclude Include="..\source\core\board\NstBoardAveNina.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBandai.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBandai24c0x.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBandaiAerobicsStudio.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBandaiDatach.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBandaiKaraokeStudio.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBandaiLz93d50.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBandaiLz93d50ex.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBandaiOekaKids.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBenshengBs5.hpp" />
<ClInclude Include="..\source\core\board\NstBoardCaltron.hpp" />
<ClInclude Include="..\source\core\board\NstBoardCamerica.hpp" />
<ClInclude Include="..\source\core\board\NstBoardCne.hpp" />
<ClInclude Include="..\source\core\board\NstBoardCneDecathlon.hpp" />
<ClInclude Include="..\source\core\board\NstBoardCnePsb.hpp" />
<ClInclude Include="..\source\core\board\NstBoardCneShlz.hpp" />
<ClInclude Include="..\source\core\board\NstBoardCony.hpp" />
<ClInclude Include="..\source\core\board\NstBoardDreamtech.hpp" />
<ClInclude Include="..\source\core\board\NstBoardFujiya.hpp" />
<ClInclude Include="..\source\core\board\NstBoardFukutake.hpp" />
<ClInclude Include="..\source\core\board\NstBoardFutureMedia.hpp" />
<ClInclude Include="..\source\core\board\NstBoardGouder.hpp" />
<ClInclude Include="..\source\core\board\NstBoardHenggedianzi.hpp" />
<ClInclude Include="..\source\core\board\NstBoardHes.hpp" />
<ClInclude Include="..\source\core\board\NstBoardHosenkan.hpp" />
<ClInclude Include="..\source\core\board\NstBoardIrem.hpp" />
<ClInclude Include="..\source\core\board\NstBoardIremG101.hpp" />
<ClInclude Include="..\source\core\board\NstBoardIremH3001.hpp" />
<ClInclude Include="..\source\core\board\NstBoardIremHolyDiver.hpp" />
<ClInclude Include="..\source\core\board\NstBoardIremKaiketsu.hpp" />
<ClInclude Include="..\source\core\board\NstBoardIremLrog017.hpp" />
<ClInclude Include="..\source\core\board\NstBoardJaleco.hpp" />
<ClInclude Include="..\source\core\board\NstBoardJalecoJf11.hpp" />
<ClInclude Include="..\source\core\board\NstBoardJalecoJf13.hpp" />
<ClInclude Include="..\source\core\board\NstBoardJalecoJf16.hpp" />
<ClInclude Include="..\source\core\board\NstBoardJalecoJf17.hpp" />
<ClInclude Include="..\source\core\board\NstBoardJalecoJf19.hpp" />
<ClInclude Include="..\source\core\board\NstBoardJalecoSs88006.hpp" />
<ClInclude Include="..\source\core\board\NstBoardJyCompany.hpp" />
<ClInclude Include="..\source\core\board\NstBoardKaiser.hpp" />
<ClInclude Include="..\source\core\board\NstBoardKasing.hpp" />
<ClInclude Include="..\source\core\board\NstBoardKay.hpp" />
<ClInclude Include="..\source\core\board\NstBoardKayH2288.hpp" />
<ClInclude Include="..\source\core\board\NstBoardKayPandaPrince.hpp" />
<ClInclude Include="..\source\core\board\NstBoardKonami.hpp" />
<ClInclude Include="..\source\core\board\NstBoardKonamiVrc1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardKonamiVrc2.hpp" />
<ClInclude Include="..\source\core\board\NstBoardKonamiVrc3.hpp" />
<ClInclude Include="..\source\core\board\NstBoardKonamiVrc4.hpp" />
<ClInclude Include="..\source\core\board\NstBoardKonamiVrc6.hpp" />
<ClInclude Include="..\source\core\board\NstBoardKonamiVrc7.hpp" />
<ClInclude Include="..\source\core\board\NstBoardKonamiVsSystem.hpp" />
<ClInclude Include="..\source\core\board\NstBoardMagicSeries.hpp" />
<ClInclude Include="..\source\core\board\NstBoardNamcot.hpp" />
<ClInclude Include="..\source\core\board\NstBoardNamcot163.hpp" />
<ClInclude Include="..\source\core\board\NstBoardNamcot175.hpp" />
<ClInclude Include="..\source\core\board\NstBoardNamcot34xx.hpp" />
<ClInclude Include="..\source\core\board\NstBoardNanjing.hpp" />
<ClInclude Include="..\source\core\board\NstBoardNihon.hpp" />
<ClInclude Include="..\source\core\board\NstBoardNitra.hpp" />
<ClInclude Include="..\source\core\board\NstBoardNtdec.hpp" />
<ClInclude Include="..\source\core\board\NstBoardOpenCorp.hpp" />
<ClInclude Include="..\source\core\board\NstBoardRcm.hpp" />
<ClInclude Include="..\source\core\board\NstBoardRexSoft.hpp" />
<ClInclude Include="..\source\core\board\NstBoardRexSoftDb5z.hpp" />
<ClInclude Include="..\source\core\board\NstBoardRexSoftSl1632.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSachen.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSachen74x374.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSachenS8259.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSachenSa0036.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSachenSa0037.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSachenSa72007.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSachenSa72008.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSachenStreetHeroes.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSachenTca01.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSachenTcu.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSomeriTeam.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSomeriTeamSl12.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSubor.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSunsoft.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSunsoft1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSunsoft2.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSunsoft3.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSunsoft4.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSunsoft5b.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSunsoftDcs.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSunsoftFme7.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSuperGame.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSuperGameBoogerman.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSuperGameLionKing.hpp" />
<ClInclude Include="..\source\core\board\NstBoardSuperGamePocahontas2.hpp" />
<ClInclude Include="..\source\core\board\NstBoardTaito.hpp" />
<ClInclude Include="..\source\core\board\NstBoardTaitoTc0190fmc.hpp" />
<ClInclude Include="..\source\core\board\NstBoardTaitoTc0190fmcPal16r4.hpp" />
<ClInclude Include="..\source\core\board\NstBoardTaitoX1005.hpp" />
<ClInclude Include="..\source\core\board\NstBoardTaitoX1017.hpp" />
<ClInclude Include="..\source\core\board\NstBoardTengen.hpp" />
<ClInclude Include="..\source\core\board\NstBoardTengenRambo1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardTxc.hpp" />
<ClInclude Include="..\source\core\board\NstBoardTxcMxmdhtwo.hpp" />
<ClInclude Include="..\source\core\board\NstBoardTxcPoliceman.hpp" />
<ClInclude Include="..\source\core\board\NstBoardTxcTw.hpp" />
<ClInclude Include="..\source\core\board\NstBoardWaixing.hpp" />
<ClInclude Include="..\source\core\board\NstBoardWaixingFfv.hpp" />
<ClInclude Include="..\source\core\board\NstBoardWaixingPs2.hpp" />
<ClInclude Include="..\source\core\board\NstBoardWaixingSecurity.hpp" />
<ClInclude Include="..\source\core\board\NstBoardWaixingSgz.hpp" />
<ClInclude Include="..\source\core\board\NstBoardWaixingSgzlz.hpp" />
<ClInclude Include="..\source\core\board\NstBoardWaixingSh2.hpp" />
<ClInclude Include="..\source\core\board\NstBoardWaixingZs.hpp" />
<ClInclude Include="..\source\core\board\NstBoardWhirlwind.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmc110in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmc1200in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmc150in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmc15in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmc20in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmc21in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmc22Games.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmc31in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmc35in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmc36in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmc64in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmc72in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmc76in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmc800in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmc8157.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmc9999999in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcA65as.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcBallgames11in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcCh001.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcCtc65.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcFamily4646B.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcFk23c.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcGamestarA.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcGamestarB.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcGolden190in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcGoldenCard6in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcGoldenGame260in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcHero.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcMarioParty7in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcNovelDiamond.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcPowerjoy84in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcResetBased4in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcSuper22Games.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcSuper24in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcSuper40in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcSuper700in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcSuperBig7in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcSuperGun20in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcSuperHiK300in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcSuperHiK4in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcSuperVision16in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcT262.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcVrc4.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcVt5201.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBmcY2k64in1.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBtl2708.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBtl6035052.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBtlAx5705.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBtlDragonNinja.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBtlGeniusMerioBros.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBtlMarioBaby.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBtlPikachuY2k.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBtlShuiGuanPipe.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBtlSmb2a.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBtlSmb2b.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBtlSmb2c.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBtlSmb3.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBtlSuperBros11.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBtlT230.hpp" />
<ClInclude Include="..\source\core\board\NstBoardBtlTobidaseDaisakusen.hpp" />
<ClInclude Include="..\source\core\board\NstBoardUnlA9746.hpp" />
<ClInclude Include="..\source\core\board\NstBoardUnlCc21.hpp" />
<ClInclude Include="..\source\core\board\NstBoardUnlEdu2000.hpp" />
<ClInclude Include="..\source\core\board\NstBoardUnlKingOfFighters96.hpp" />
<ClInclude Include="..\source\core\board\NstBoardUnlKingOfFighters97.hpp" />
<ClInclude Include="..\source\core\board\NstBoardUnlMortalKombat2.hpp" />
<ClInclude Include="..\source\core\board\NstBoardUnlN625092.hpp" />
<ClInclude Include="..\source\core\board\NstBoardUnlSuperFighter3.hpp" />
<ClInclude Include="..\source\core\board\NstBoardUnlTf1201.hpp" />
<ClInclude Include="..\source\core\board\NstBoardUnlWorldHero.hpp" />
<ClInclude Include="..\source\core\board\NstBoardUnlXzy.hpp" />
<ClInclude Include="..\source\core\NstApu.hpp" />
<ClInclude Include="..\source\core\NstAssert.hpp" />
<ClInclude Include="..\source\core\NstBarcodeReader.hpp" />
<ClInclude Include="..\source\core\NstBase.hpp" />
<ClInclude Include="..\source\core\NstCartridge.hpp" />
<ClInclude Include="..\source\core\NstCartridgeInes.hpp" />
<ClInclude Include="..\source\core\NstCartridgeRomset.hpp" />
<ClInclude Include="..\source\core\NstCartridgeUnif.hpp" />
<ClInclude Include="..\source\core\NstCheats.hpp" />
<ClInclude Include="..\source\core\NstChecksum.hpp" />
<ClInclude Include="..\source\core\NstChips.hpp" />
<ClInclude Include="..\source\core\NstCore.hpp" />
<ClInclude Include="..\source\core\NstCpu.hpp" />
<ClInclude Include="..\source\core\NstCrc32.hpp" />
<ClInclude Include="..\source\core\NstDipSwitches.hpp" />
<ClInclude Include="..\source\core\NstFds.hpp" />
<ClInclude Include="..\source\core\NstFile.hpp" />
<ClInclude Include="..\source\core\NstFpuPrecision.hpp" />
<ClInclude Include="..\source\core\NstHook.hpp" />
<ClInclude Include="..\source\core\NstImage.hpp" />
<ClInclude Include="..\source\core\NstImageDatabase.hpp" />
<ClInclude Include="..\source\core\NstIoAccessor.hpp" />
<ClInclude Include="..\source\core\NstIoLine.hpp" />
<ClInclude Include="..\source\core\NstIoMap.hpp" />
<ClInclude Include="..\source\core\NstIoPort.hpp" />
<ClInclude Include="..\source\core\NstLog.hpp" />
<ClInclude Include="..\source\core\NstMachine.hpp" />
<ClInclude Include="..\source\core\NstMemory.hpp" />
<ClInclude Include="..\source\core\NstNsf.hpp" />
<ClInclude Include="..\source\core\NstPatcher.hpp" />
<ClInclude Include="..\source\core\NstPatcherIps.hpp" />
<ClInclude Include="..\source\core\NstPatcherUps.hpp" />
<ClInclude Include="..\source\core\NstPins.hpp" />
<ClInclude Include="..\source\core\NstPpu.hpp" />
<ClInclude Include="..\source\core\NstProperties.hpp" />
<ClInclude Include="..\source\core\NstRam.hpp" />
<ClInclude Include="..\source\core\NstSha1.hpp" />
<ClInclude Include="..\source\core\NstSoundPcm.hpp" />
<ClInclude Include="..\source\core\NstSoundPlayer.hpp" />
<ClInclude Include="..\source\core\NstSoundRenderer.hpp" />
<ClInclude Include="..\source\core\NstState.hpp" />
<ClInclude Include="..\source\core\NstStream.hpp" />
<ClInclude Include="..\source\core\NstTimer.hpp" />
<ClInclude Include="..\source\core\NstTracker.hpp" />
<ClInclude Include="..\source\core\NstTrackerMovie.hpp" />
<ClInclude Include="..\source\core\NstTrackerRewinder.hpp" />
<ClInclude Include="..\source\core\NstVector.hpp" />
<ClInclude Include="..\source\core\NstVideoRenderer.hpp" />
<ClInclude Include="..\source\core\NstVideoScreen.hpp" />
<ClInclude Include="..\source\core\NstXml.hpp" />
<ClInclude Include="..\source\core\NstZlib.hpp" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\source\core\api\NstApiBarcodeReader.cpp" />
<ClCompile Include="..\source\core\api\NstApiCartridge.cpp" />
<ClCompile Include="..\source\core\api\NstApiCheats.cpp" />
<ClCompile Include="..\source\core\api\NstApiDipSwitches.cpp" />
<ClCompile Include="..\source\core\api\NstApiEmulator.cpp" />
<ClCompile Include="..\source\core\api\NstApiFds.cpp" />
<ClCompile Include="..\source\core\api\NstApiInput.cpp" />
<ClCompile Include="..\source\core\api\NstApiMachine.cpp" />
<ClCompile Include="..\source\core\api\NstApiMovie.cpp" />
<ClCompile Include="..\source\core\api\NstApiNsf.cpp" />
<ClCompile Include="..\source\core\api\NstApiRewinder.cpp" />
<ClCompile Include="..\source\core\api\NstApiSound.cpp" />
<ClCompile Include="..\source\core\api\NstApiTapeRecorder.cpp" />
<ClCompile Include="..\source\core\api\NstApiUser.cpp" />
<ClCompile Include="..\source\core\api\NstApiVideo.cpp" />
<ClCompile Include="..\source\core\board\NstBoardAcclaimMcAcc.cpp" />
<ClCompile Include="..\source\core\NstVideoFilterxBR.cpp" />
<ClCompile Include="..\source\core\vssystem\NstVsRbiBaseball.cpp" />
<ClCompile Include="..\source\core\vssystem\NstVsSuperXevious.cpp" />
<ClCompile Include="..\source\core\vssystem\NstVsSystem.cpp" />
<ClCompile Include="..\source\core\vssystem\NstVsTkoBoxing.cpp" />
<ClCompile Include="..\source\core\NstVideoFilter2xSaI.cpp" />
<ClCompile Include="..\source\core\NstVideoFilterHqX.cpp" />
<ClCompile Include="..\source\core\NstVideoFilterNone.cpp" />
<ClCompile Include="..\source\core\NstVideoFilterNtsc.cpp" />
<ClCompile Include="..\source\core\NstVideoFilterNtscCfg.cpp" />
<ClCompile Include="..\source\core\NstVideoFilterScaleX.cpp" />
<ClCompile Include="..\source\core\input\NstInpAdapter.cpp" />
<ClCompile Include="..\source\core\input\NstInpBandaiHyperShot.cpp" />
<ClCompile Include="..\source\core\input\NstInpBarcodeWorld.cpp" />
<ClCompile Include="..\source\core\input\NstInpCrazyClimber.cpp" />
<ClCompile Include="..\source\core\input\NstInpDoremikkoKeyboard.cpp" />
<ClCompile Include="..\source\core\input\NstInpExcitingBoxing.cpp" />
<ClCompile Include="..\source\core\input\NstInpFamilyKeyboard.cpp" />
<ClCompile Include="..\source\core\input\NstInpFamilyTrainer.cpp" />
<ClCompile Include="..\source\core\input\NstInpHoriTrack.cpp" />
<ClCompile Include="..\source\core\input\NstInpKonamiHyperShot.cpp" />
<ClCompile Include="..\source\core\input\NstInpMahjong.cpp" />
<ClCompile Include="..\source\core\input\NstInpMouse.cpp" />
<ClCompile Include="..\source\core\input\NstInpOekaKidsTablet.cpp" />
<ClCompile Include="..\source\core\input\NstInpPachinko.cpp" />
<ClCompile Include="..\source\core\input\NstInpPad.cpp" />
<ClCompile Include="..\source\core\input\NstInpPaddle.cpp" />
<ClCompile Include="..\source\core\input\NstInpPartyTap.cpp" />
<ClCompile Include="..\source\core\input\NstInpPokkunMoguraa.cpp" />
<ClCompile Include="..\source\core\input\NstInpPowerGlove.cpp" />
<ClCompile Include="..\source\core\input\NstInpPowerPad.cpp" />
<ClCompile Include="..\source\core\input\NstInpRob.cpp" />
<ClCompile Include="..\source\core\input\NstInpSuborKeyboard.cpp" />
<ClCompile Include="..\source\core\input\NstInpTopRider.cpp" />
<ClCompile Include="..\source\core\input\NstInpTurboFile.cpp" />
<ClCompile Include="..\source\core\input\NstInpZapper.cpp" />
<ClCompile Include="..\source\core\board\NstBoard.cpp" />
<ClCompile Include="..\source\core\board\NstBoardAxRom.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBxRom.cpp" />
<ClCompile Include="..\source\core\board\NstBoardCxRom.cpp" />
<ClCompile Include="..\source\core\board\NstBoardDiscrete.cpp" />
<ClCompile Include="..\source\core\board\NstBoardGxRom.cpp" />
<ClCompile Include="..\source\core\board\NstBoardMmc1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardMmc2.cpp" />
<ClCompile Include="..\source\core\board\NstBoardMmc3.cpp" />
<ClCompile Include="..\source\core\board\NstBoardMmc4.cpp" />
<ClCompile Include="..\source\core\board\NstBoardMmc5.cpp" />
<ClCompile Include="..\source\core\board\NstBoardMmc6.cpp" />
<ClCompile Include="..\source\core\board\NstBoardTxRom.cpp" />
<ClCompile Include="..\source\core\board\NstBoardUxRom.cpp" />
<ClCompile Include="..\source\core\board\NstBoardEvent.cpp" />
<ClCompile Include="..\source\core\board\NstBoardFb.cpp" />
<ClCompile Include="..\source\core\board\NstBoardFfe.cpp" />
<ClCompile Include="..\source\core\board\NstBoardQj.cpp" />
<ClCompile Include="..\source\core\board\NstBoardRumbleStation.cpp" />
<ClCompile Include="..\source\core\board\NstBoardVsSystem.cpp" />
<ClCompile Include="..\source\core\board\NstBoardZz.cpp" />
<ClCompile Include="..\source\core\board\NstBoardAe.cpp" />
<ClCompile Include="..\source\core\board\NstBoardAgci.cpp" />
<ClCompile Include="..\source\core\board\NstBoardAveD1012.cpp" />
<ClCompile Include="..\source\core\board\NstBoardAveNina.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBandai24c0x.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBandaiAerobicsStudio.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBandaiDatach.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBandaiKaraokeStudio.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBandaiLz93d50.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBandaiLz93d50ex.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBandaiOekaKids.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBenshengBs5.cpp" />
<ClCompile Include="..\source\core\board\NstBoardCaltron.cpp" />
<ClCompile Include="..\source\core\board\NstBoardCamerica.cpp" />
<ClCompile Include="..\source\core\board\NstBoardCneDecathlon.cpp" />
<ClCompile Include="..\source\core\board\NstBoardCnePsb.cpp" />
<ClCompile Include="..\source\core\board\NstBoardCneShlz.cpp" />
<ClCompile Include="..\source\core\board\NstBoardCony.cpp" />
<ClCompile Include="..\source\core\board\NstBoardDreamtech.cpp" />
<ClCompile Include="..\source\core\board\NstBoardFujiya.cpp" />
<ClCompile Include="..\source\core\board\NstBoardFukutake.cpp" />
<ClCompile Include="..\source\core\board\NstBoardFutureMedia.cpp" />
<ClCompile Include="..\source\core\board\NstBoardGouder.cpp" />
<ClCompile Include="..\source\core\board\NstBoardHenggedianzi.cpp" />
<ClCompile Include="..\source\core\board\NstBoardHes.cpp" />
<ClCompile Include="..\source\core\board\NstBoardHosenkan.cpp" />
<ClCompile Include="..\source\core\board\NstBoardIremG101.cpp" />
<ClCompile Include="..\source\core\board\NstBoardIremH3001.cpp" />
<ClCompile Include="..\source\core\board\NstBoardIremHolyDiver.cpp" />
<ClCompile Include="..\source\core\board\NstBoardIremKaiketsu.cpp" />
<ClCompile Include="..\source\core\board\NstBoardIremLrog017.cpp" />
<ClCompile Include="..\source\core\board\NstBoardJalecoJf11.cpp" />
<ClCompile Include="..\source\core\board\NstBoardJalecoJf13.cpp" />
<ClCompile Include="..\source\core\board\NstBoardJalecoJf16.cpp" />
<ClCompile Include="..\source\core\board\NstBoardJalecoJf17.cpp" />
<ClCompile Include="..\source\core\board\NstBoardJalecoJf19.cpp" />
<ClCompile Include="..\source\core\board\NstBoardJalecoSs88006.cpp" />
<ClCompile Include="..\source\core\board\NstBoardJyCompany.cpp" />
<ClCompile Include="..\source\core\board\NstBoardKaiser.cpp" />
<ClCompile Include="..\source\core\board\NstBoardKasing.cpp" />
<ClCompile Include="..\source\core\board\NstBoardKayH2288.cpp" />
<ClCompile Include="..\source\core\board\NstBoardKayPandaPrince.cpp" />
<ClCompile Include="..\source\core\board\NstBoardKonamiVrc1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardKonamiVrc2.cpp" />
<ClCompile Include="..\source\core\board\NstBoardKonamiVrc3.cpp" />
<ClCompile Include="..\source\core\board\NstBoardKonamiVrc4.cpp" />
<ClCompile Include="..\source\core\board\NstBoardKonamiVrc6.cpp" />
<ClCompile Include="..\source\core\board\NstBoardKonamiVrc7.cpp" />
<ClCompile Include="..\source\core\board\NstBoardKonamiVsSystem.cpp" />
<ClCompile Include="..\source\core\board\NstBoardMagicSeries.cpp" />
<ClCompile Include="..\source\core\board\NstBoardNamcot163.cpp" />
<ClCompile Include="..\source\core\board\NstBoardNamcot175.cpp" />
<ClCompile Include="..\source\core\board\NstBoardNamcot34xx.cpp" />
<ClCompile Include="..\source\core\board\NstBoardNanjing.cpp" />
<ClCompile Include="..\source\core\board\NstBoardNihon.cpp" />
<ClCompile Include="..\source\core\board\NstBoardNitra.cpp" />
<ClCompile Include="..\source\core\board\NstBoardNtdec.cpp" />
<ClCompile Include="..\source\core\board\NstBoardOpenCorp.cpp" />
<ClCompile Include="..\source\core\board\NstBoardRcm.cpp" />
<ClCompile Include="..\source\core\board\NstBoardRexSoftDb5z.cpp" />
<ClCompile Include="..\source\core\board\NstBoardRexSoftSl1632.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSachen74x374.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSachenS8259.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSachenSa0036.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSachenSa0037.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSachenSa72007.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSachenSa72008.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSachenStreetHeroes.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSachenTca01.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSachenTcu.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSomeriTeamSl12.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSubor.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSunsoft1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSunsoft2.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSunsoft3.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSunsoft4.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSunsoft5b.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSunsoftDcs.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSunsoftFme7.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSuperGameBoogerman.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSuperGameLionKing.cpp" />
<ClCompile Include="..\source\core\board\NstBoardSuperGamePocahontas2.cpp" />
<ClCompile Include="..\source\core\board\NstBoardTaitoTc0190fmc.cpp" />
<ClCompile Include="..\source\core\board\NstBoardTaitoTc0190fmcPal16r4.cpp" />
<ClCompile Include="..\source\core\board\NstBoardTaitoX1005.cpp" />
<ClCompile Include="..\source\core\board\NstBoardTaitoX1017.cpp" />
<ClCompile Include="..\source\core\board\NstBoardTengen.cpp" />
<ClCompile Include="..\source\core\board\NstBoardTengenRambo1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardTxc.cpp" />
<ClCompile Include="..\source\core\board\NstBoardTxcMxmdhtwo.cpp" />
<ClCompile Include="..\source\core\board\NstBoardTxcPoliceman.cpp" />
<ClCompile Include="..\source\core\board\NstBoardTxcTw.cpp" />
<ClCompile Include="..\source\core\board\NstBoardWaixing.cpp" />
<ClCompile Include="..\source\core\board\NstBoardWaixingFfv.cpp" />
<ClCompile Include="..\source\core\board\NstBoardWaixingPs2.cpp" />
<ClCompile Include="..\source\core\board\NstBoardWaixingSecurity.cpp" />
<ClCompile Include="..\source\core\board\NstBoardWaixingSgz.cpp" />
<ClCompile Include="..\source\core\board\NstBoardWaixingSgzlz.cpp" />
<ClCompile Include="..\source\core\board\NstBoardWaixingSh2.cpp" />
<ClCompile Include="..\source\core\board\NstBoardWaixingZs.cpp" />
<ClCompile Include="..\source\core\board\NstBoardWhirlwind.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmc110in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmc1200in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmc150in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmc15in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmc20in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmc21in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmc22Games.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmc31in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmc35in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmc36in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmc64in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmc72in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmc76in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmc800in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmc8157.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmc9999999in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcA65as.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcBallgames11in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcCh001.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcCtc65.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcFamily4646B.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcFk23c.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcGamestarA.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcGamestarB.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcGolden190in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcGoldenCard6in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcGoldenGame260in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcHero.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcMarioParty7in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcNovelDiamond.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcPowerjoy84in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcResetBased4in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcSuper22Games.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcSuper24in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcSuper40in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcSuper700in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcSuperBig7in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcSuperGun20in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcSuperHiK300in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcSuperHiK4in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcSuperVision16in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcT262.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcVrc4.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcVt5201.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBmcY2k64in1.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBtl2708.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBtl6035052.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBtlAx5705.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBtlDragonNinja.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBtlGeniusMerioBros.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBtlMarioBaby.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBtlPikachuY2k.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBtlShuiGuanPipe.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBtlSmb2a.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBtlSmb2b.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBtlSmb2c.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBtlSmb3.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBtlSuperBros11.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBtlT230.cpp" />
<ClCompile Include="..\source\core\board\NstBoardBtlTobidaseDaisakusen.cpp" />
<ClCompile Include="..\source\core\board\NstBoardUnlA9746.cpp" />
<ClCompile Include="..\source\core\board\NstBoardUnlCc21.cpp" />
<ClCompile Include="..\source\core\board\NstBoardUnlEdu2000.cpp" />
<ClCompile Include="..\source\core\board\NstBoardUnlKingOfFighters96.cpp" />
<ClCompile Include="..\source\core\board\NstBoardUnlKingOfFighters97.cpp" />
<ClCompile Include="..\source\core\board\NstBoardUnlMortalKombat2.cpp" />
<ClCompile Include="..\source\core\board\NstBoardUnlN625092.cpp" />
<ClCompile Include="..\source\core\board\NstBoardUnlSuperFighter3.cpp" />
<ClCompile Include="..\source\core\board\NstBoardUnlTf1201.cpp" />
<ClCompile Include="..\source\core\board\NstBoardUnlWorldHero.cpp" />
<ClCompile Include="..\source\core\board\NstBoardUnlXzy.cpp" />
<ClCompile Include="..\source\core\NstApu.cpp" />
<ClCompile Include="..\source\core\NstAssert.cpp" />
<ClCompile Include="..\source\core\NstCartridge.cpp" />
<ClCompile Include="..\source\core\NstCartridgeInes.cpp" />
<ClCompile Include="..\source\core\NstCartridgeRomset.cpp" />
<ClCompile Include="..\source\core\NstCartridgeUnif.cpp" />
<ClCompile Include="..\source\core\NstCheats.cpp" />
<ClCompile Include="..\source\core\NstChecksum.cpp" />
<ClCompile Include="..\source\core\NstChips.cpp" />
<ClCompile Include="..\source\core\NstCore.cpp" />
<ClCompile Include="..\source\core\NstCpu.cpp" />
<ClCompile Include="..\source\core\NstCrc32.cpp" />
<ClCompile Include="..\source\core\NstFds.cpp" />
<ClCompile Include="..\source\core\NstFile.cpp" />
<ClCompile Include="..\source\core\NstImage.cpp" />
<ClCompile Include="..\source\core\NstImageDatabase.cpp" />
<ClCompile Include="..\source\core\NstLog.cpp" />
<ClCompile Include="..\source\core\NstMachine.cpp" />
<ClCompile Include="..\source\core\NstMemory.cpp" />
<ClCompile Include="..\source\core\NstNsf.cpp" />
<ClCompile Include="..\source\core\NstPatcher.cpp" />
<ClCompile Include="..\source\core\NstPatcherIps.cpp" />
<ClCompile Include="..\source\core\NstPatcherUps.cpp" />
<ClCompile Include="..\source\core\NstPins.cpp" />
<ClCompile Include="..\source\core\NstPpu.cpp" />
<ClCompile Include="..\source\core\NstProperties.cpp" />
<ClCompile Include="..\source\core\NstRam.cpp" />
<ClCompile Include="..\source\core\NstSha1.cpp" />
<ClCompile Include="..\source\core\NstSoundPcm.cpp" />
<ClCompile Include="..\source\core\NstSoundPlayer.cpp" />
<ClCompile Include="..\source\core\NstSoundRenderer.cpp" />
<ClCompile Include="..\source\core\NstState.cpp" />
<ClCompile Include="..\source\core\NstStream.cpp" />
<ClCompile Include="..\source\core\NstTracker.cpp" />
<ClCompile Include="..\source\core\NstTrackerMovie.cpp" />
<ClCompile Include="..\source\core\NstTrackerRewinder.cpp" />
<ClCompile Include="..\source\core\NstVector.cpp" />
<ClCompile Include="..\source\core\NstVideoRenderer.cpp" />
<ClCompile Include="..\source\core\NstVideoScreen.cpp" />
<ClCompile Include="..\source\core\NstXml.cpp" />
<ClCompile Include="..\source\core\NstZlib.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="..\source\core\NstVideoFilterHq2x.inl" />
<None Include="..\source\core\NstVideoFilterHq3x.inl" />
<None Include="..\source\core\NstVideoFilterHq4x.inl" />
<None Include="..\source\nes_ntsc\nes_ntsc.inl" />
<None Include="..\source\core\NstSoundRenderer.inl" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

File diff suppressed because it is too large Load Diff

205
projects/language.vcproj Normal file
View File

@@ -0,0 +1,205 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="Language"
ProjectGUID="{C456E741-CF7A-455E-884B-B0F9F86E7C86}"
RootNamespace="Language"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)debugout\language\"
IntermediateDirectory="debug\language\"
ConfigurationType="2"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LANGUAGE_EXPORTS"
StringPooling="true"
MinimalRebuild="true"
BasicRuntimeChecks="0"
SmallerTypeCheck="false"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkLibraryDependencies="false"
OutputFile="$(OutDir)english.nlg"
LinkIncremental="2"
IgnoreAllDefaultLibraries="true"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeForWindows98="0"
ResourceOnlyDLL="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)releaseout\language\"
IntermediateDirectory="release\language\"
ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="2"
OmitFramePointers="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LANGUAGE_EXPORTS"
StringPooling="true"
RuntimeLibrary="2"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="true"
DefaultCharIsUnsigned="true"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkLibraryDependencies="false"
OutputFile="$(OutDir)english.nlg"
LinkIncremental="1"
IgnoreAllDefaultLibraries="true"
GenerateDebugInformation="false"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
OptimizeForWindows98="0"
LinkTimeCodeGeneration="0"
ResourceOnlyDLL="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="..\source\win32\language\language.rc"
>
</File>
<File
RelativePath="..\source\win32\language\resource.h"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

136
projects/language.vcxproj Normal file
View File

@@ -0,0 +1,136 @@
<?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>{C456E741-CF7A-455E-884B-B0F9F86E7C86}</ProjectGuid>
<RootNamespace>Language</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</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.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)debugout\language\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">debug\language\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)releaseout\language\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">release\language\</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>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LANGUAGE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<SmallerTypeCheck>false</SmallerTypeCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
<Link>
<OutputFile>$(OutDir)english.nlg</OutputFile>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<NoEntryPoint>true</NoEntryPoint>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LANGUAGE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FunctionLevelLinking>true</FunctionLevelLinking>
<AdditionalOptions> /J</AdditionalOptions>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
<Link>
<OutputFile>$(OutDir)english.nlg</OutputFile>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<LinkTimeCodeGeneration>
</LinkTimeCodeGeneration>
<NoEntryPoint>true</NoEntryPoint>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ResourceCompile Include="..\source\win32\language\language.rc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\source\win32\language\resource.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="core.vcxproj">
<Project>{ccc3a09c-0f7a-4e12-8594-11f2c60d71da}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

35
projects/nestopia.sln Normal file
View File

@@ -0,0 +1,35 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win32", "win32.vcxproj", "{7557C437-7013-4A87-B7C5-EA50699FC7B4}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core", "core.vcxproj", "{CCC3A09C-0F7A-4E12-8594-11F2C60D71DA}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "language", "language.vcxproj", "{C456E741-CF7A-455E-884B-B0F9F86E7C86}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7557C437-7013-4A87-B7C5-EA50699FC7B4}.Debug|Win32.ActiveCfg = Debug|Win32
{7557C437-7013-4A87-B7C5-EA50699FC7B4}.Debug|Win32.Build.0 = Debug|Win32
{7557C437-7013-4A87-B7C5-EA50699FC7B4}.Release|Win32.ActiveCfg = Release|Win32
{7557C437-7013-4A87-B7C5-EA50699FC7B4}.Release|Win32.Build.0 = Release|Win32
{CCC3A09C-0F7A-4E12-8594-11F2C60D71DA}.Debug|Win32.ActiveCfg = Debug|Win32
{CCC3A09C-0F7A-4E12-8594-11F2C60D71DA}.Debug|Win32.Build.0 = Debug|Win32
{CCC3A09C-0F7A-4E12-8594-11F2C60D71DA}.Release|Win32.ActiveCfg = Release|Win32
{CCC3A09C-0F7A-4E12-8594-11F2C60D71DA}.Release|Win32.Build.0 = Release|Win32
{C456E741-CF7A-455E-884B-B0F9F86E7C86}.Debug|Win32.ActiveCfg = Debug|Win32
{C456E741-CF7A-455E-884B-B0F9F86E7C86}.Debug|Win32.Build.0 = Debug|Win32
{C456E741-CF7A-455E-884B-B0F9F86E7C86}.Release|Win32.ActiveCfg = Release|Win32
{C456E741-CF7A-455E-884B-B0F9F86E7C86}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
AMDCaProjectFile =
EndGlobalSection
EndGlobal

1450
projects/win32.vcproj Normal file

File diff suppressed because it is too large Load Diff

477
projects/win32.vcxproj Normal file
View File

@@ -0,0 +1,477 @@
<?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>{7557C437-7013-4A87-B7C5-EA50699FC7B4}</ProjectGuid>
<RootNamespace>Win32</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</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.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)debugout\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">debug\win32\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)releaseout\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">release\win32\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</GenerateManifest>
<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'" />
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(DXSDK_DIR)Include;$(IncludePath)</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(DXSDK_DIR)Lib\x86;$(LibraryPath)</LibraryPath>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Nestopia</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Nestopia</TargetName>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(DXSDK_DIR)Include;$(IncludePath)</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(DXSDK_DIR)Lib\x86;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalOptions>/vmb /J %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NST_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<SmallerTypeCheck>true</SmallerTypeCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<FunctionLevelLinking>true</FunctionLevelLinking>
<FloatingPointModel>Precise</FloatingPointModel>
<FloatingPointExceptions>true</FloatingPointExceptions>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CallingConvention>FastCall</CallingConvention>
<OmitDefaultLibName>false</OmitDefaultLibName>
</ClCompile>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
<Link>
<AdditionalDependencies>libcmtd.lib;unicows.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib</AdditionalDependencies>
<OutputFile>$(OutDir)nestopia.exe</OutputFile>
<AdditionalLibraryDirectories>$(DXSDK_DIR)Lib\x86;$(SolutionDir)..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<IgnoreSpecificDefaultLibraries>libc;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<SupportUnloadOfDelayLoadedDLL>false</SupportUnloadOfDelayLoadedDLL>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<Manifest>
<SuppressStartupBanner>true</SuppressStartupBanner>
<VerboseOutput>false</VerboseOutput>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalOptions>/vmb /J %(AdditionalOptions)</AdditionalOptions>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FunctionLevelLinking>true</FunctionLevelLinking>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<FloatingPointModel>Precise</FloatingPointModel>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<AssemblerOutput>AssemblyAndSourceCode</AssemblerOutput>
<AssemblerListingLocation>$(SolutionDir)release\win32\asm\</AssemblerListingLocation>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
<CallingConvention>FastCall</CallingConvention>
<OmitDefaultLibName>false</OmitDefaultLibName>
</ClCompile>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
<Link>
<AdditionalDependencies>libcmt.lib;unicows.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib</AdditionalDependencies>
<ShowProgress>NotSet</ShowProgress>
<OutputFile>$(OutDir)nestopia.exe</OutputFile>
<AdditionalLibraryDirectories>$(DXSDK_DIR)Lib\x86;$(SolutionDir)..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalManifestDependencies>%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<IgnoreSpecificDefaultLibraries>libc;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<SupportUnloadOfDelayLoadedDLL>false</SupportUnloadOfDelayLoadedDLL>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\source\win32\NstApplicationConfiguration.cpp" />
<ClCompile Include="..\source\win32\NstApplicationException.cpp" />
<ClCompile Include="..\source\win32\NstApplicationInstance.cpp" />
<ClCompile Include="..\source\win32\NstApplicationLanguage.cpp" />
<ClCompile Include="..\source\win32\NstApplicationMain.cpp" />
<ClCompile Include="..\source\win32\NstCollectionVector.cpp" />
<ClCompile Include="..\source\win32\NstWindowCustom.cpp" />
<ClCompile Include="..\source\win32\NstWindowDialog.cpp" />
<ClCompile Include="..\source\win32\NstWindowDropFiles.cpp" />
<ClCompile Include="..\source\win32\NstWindowDynamic.cpp" />
<ClCompile Include="..\source\win32\NstWindowGeneric.cpp" />
<ClCompile Include="..\source\win32\NstWindowMain.cpp" />
<ClCompile Include="..\source\win32\NstWindowMenu.cpp" />
<ClCompile Include="..\source\win32\NstWindowParam.cpp" />
<ClCompile Include="..\source\win32\NstWindowPoint.cpp" />
<ClCompile Include="..\source\win32\NstWindowRect.cpp" />
<ClCompile Include="..\source\win32\NstWindowStatusBar.cpp" />
<ClCompile Include="..\source\win32\NstWindowUser.cpp" />
<ClCompile Include="..\source\win32\NstDialogAbout.cpp" />
<ClCompile Include="..\source\win32\NstDialogAutoSaver.cpp" />
<ClCompile Include="..\source\win32\NstDialogBarcodeReader.cpp" />
<ClCompile Include="..\source\win32\NstDialogBrowse.cpp" />
<ClCompile Include="..\source\win32\NstDialogCheats.cpp" />
<ClCompile Include="..\source\win32\NstDialogDipSwitches.cpp" />
<ClCompile Include="..\source\win32\NstDialogFds.cpp" />
<ClCompile Include="..\source\win32\NstDialogFind.cpp" />
<ClCompile Include="..\source\win32\NstDialogFrameClock.cpp" />
<ClCompile Include="..\source\win32\NstDialogImageDatabase.cpp" />
<ClCompile Include="..\source\win32\NstDialogImageInfo.cpp" />
<ClCompile Include="..\source\win32\NstDialogInesHeader.cpp" />
<ClCompile Include="..\source\win32\NstDialogInput.cpp" />
<ClCompile Include="..\source\win32\NstDialogLanguage.cpp" />
<ClCompile Include="..\source\win32\NstDialogLauncher.cpp" />
<ClCompile Include="..\source\win32\NstDialogLauncherColors.cpp" />
<ClCompile Include="..\source\win32\NstDialogLauncherColumns.cpp" />
<ClCompile Include="..\source\win32\NstDialogLauncherFiles.cpp" />
<ClCompile Include="..\source\win32\NstDialogLauncherFileTable.cpp" />
<ClCompile Include="..\source\win32\NstDialogLauncherList.cpp" />
<ClCompile Include="..\source\win32\NstDialogLauncherPaths.cpp" />
<ClCompile Include="..\source\win32\NstDialogLauncherTree.cpp" />
<ClCompile Include="..\source\win32\NstDialogLicense.cpp" />
<ClCompile Include="..\source\win32\NstDialogLogfile.cpp" />
<ClCompile Include="..\source\win32\NstDialogMovie.cpp" />
<ClCompile Include="..\source\win32\NstDialogNetPlay.cpp" />
<ClCompile Include="..\source\win32\NstDialogNetplayChat.cpp" />
<ClCompile Include="..\source\win32\NstDialogPaletteEditor.cpp" />
<ClCompile Include="..\source\win32\NstDialogPaths.cpp" />
<ClCompile Include="..\source\win32\NstDialogPreferences.cpp" />
<ClCompile Include="..\source\win32\NstDialogSound.cpp" />
<ClCompile Include="..\source\win32\NstDialogTapeRecorder.cpp" />
<ClCompile Include="..\source\win32\NstDialogVideo.cpp" />
<ClCompile Include="..\source\win32\NstDialogVideoDecoder.cpp" />
<ClCompile Include="..\source\win32\NstDialogVideoFilters.cpp" />
<ClCompile Include="..\source\win32\NstCtrlCheckBox.cpp" />
<ClCompile Include="..\source\win32\NstCtrlComboBox.cpp" />
<ClCompile Include="..\source\win32\NstCtrlEdit.cpp" />
<ClCompile Include="..\source\win32\NstCtrlListBox.cpp" />
<ClCompile Include="..\source\win32\NstCtrlListView.cpp" />
<ClCompile Include="..\source\win32\NstCtrlSlider.cpp" />
<ClCompile Include="..\source\win32\NstCtrlStandard.cpp" />
<ClCompile Include="..\source\win32\NstCtrlTreeView.cpp" />
<ClCompile Include="..\source\win32\NstManager.cpp" />
<ClCompile Include="..\source\win32\NstManagerAviConverter.cpp" />
<ClCompile Include="..\source\win32\NstManagerBarcodeReader.cpp" />
<ClCompile Include="..\source\win32\NstManagerCheats.cpp" />
<ClCompile Include="..\source\win32\NstManagerDipSwitches.cpp" />
<ClCompile Include="..\source\win32\NstManagerEmulator.cpp" />
<ClCompile Include="..\source\win32\NstManagerFds.cpp" />
<ClCompile Include="..\source\win32\NstManagerFiles.cpp" />
<ClCompile Include="..\source\win32\NstManagerFrameClock.cpp" />
<ClCompile Include="..\source\win32\NstManagerHelp.cpp" />
<ClCompile Include="..\source\win32\NstManagerImageDatabase.cpp" />
<ClCompile Include="..\source\win32\NstManagerImageInfo.cpp" />
<ClCompile Include="..\source\win32\NstManagerInesHeader.cpp" />
<ClCompile Include="..\source\win32\NstManagerInput.cpp" />
<ClCompile Include="..\source\win32\NstManagerInputClipboard.cpp" />
<ClCompile Include="..\source\win32\NstManagerInputCommands.cpp" />
<ClCompile Include="..\source\win32\NstManagerInputCursor.cpp" />
<ClCompile Include="..\source\win32\NstManagerLanguage.cpp" />
<ClCompile Include="..\source\win32\NstManagerLauncher.cpp" />
<ClCompile Include="..\source\win32\NstManagerLogfile.cpp" />
<ClCompile Include="..\source\win32\NstManagerMachine.cpp" />
<ClCompile Include="..\source\win32\NstManagerMovie.cpp" />
<ClCompile Include="..\source\win32\NstManagerNetplay.cpp" />
<ClCompile Include="..\source\win32\NstManagerNsf.cpp" />
<ClCompile Include="..\source\win32\NstManagerPaths.cpp" />
<ClCompile Include="..\source\win32\NstManagerPathsFilter.cpp" />
<ClCompile Include="..\source\win32\NstManagerPreferences.cpp" />
<ClCompile Include="..\source\win32\NstManagerRecentDirs.cpp" />
<ClCompile Include="..\source\win32\NstManagerRecentFiles.cpp" />
<ClCompile Include="..\source\win32\NstManagerSaveStates.cpp" />
<ClCompile Include="..\source\win32\NstManagerSound.cpp" />
<ClCompile Include="..\source\win32\NstManagerSoundRecorder.cpp" />
<ClCompile Include="..\source\win32\NstManagerTapeRecorder.cpp" />
<ClCompile Include="..\source\win32\NstManagerVideo.cpp" />
<ClCompile Include="..\source\win32\NstIoArchive.cpp" />
<ClCompile Include="..\source\win32\NstIoFile.cpp" />
<ClCompile Include="..\source\win32\NstIoLog.cpp" />
<ClCompile Include="..\source\win32\NstIoScreen.cpp" />
<ClCompile Include="..\source\win32\NstIoStream.cpp" />
<ClCompile Include="..\source\win32\NstIoWave.cpp" />
<ClCompile Include="..\source\win32\NstResourceBitmap.cpp" />
<ClCompile Include="..\source\win32\NstResourceClipboard.cpp" />
<ClCompile Include="..\source\win32\NstResourceCursor.cpp" />
<ClCompile Include="..\source\win32\NstResourceFile.cpp" />
<ClCompile Include="..\source\win32\NstResourceGeneric.cpp" />
<ClCompile Include="..\source\win32\NstResourceIcon.cpp" />
<ClCompile Include="..\source\win32\NstResourceMenu.cpp" />
<ClCompile Include="..\source\win32\NstResourceString.cpp" />
<ClCompile Include="..\source\win32\NstResourceVersion.cpp" />
<ClCompile Include="..\source\win32\NstSystemAccelerator.cpp" />
<ClCompile Include="..\source\win32\NstSystemDll.cpp" />
<ClCompile Include="..\source\win32\NstSystemGuid.cpp" />
<ClCompile Include="..\source\win32\NstSystemInfo.cpp" />
<ClCompile Include="..\source\win32\NstSystemKeyboard.cpp" />
<ClCompile Include="..\source\win32\NstSystemRegistry.cpp" />
<ClCompile Include="..\source\win32\NstSystemThread.cpp" />
<ClCompile Include="..\source\win32\NstSystemTime.cpp" />
<ClCompile Include="..\source\win32\NstSystemTimer.cpp" />
<ClCompile Include="..\source\win32\NstString.cpp" />
<ClCompile Include="..\source\win32\NstDirect2D.cpp" />
<ClCompile Include="..\source\win32\NstDirectInput.cpp" />
<ClCompile Include="..\source\win32\NstDirectSound.cpp" />
<ClCompile Include="..\source\win32\NstMain.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\source\win32\NstApplicationConfiguration.hpp" />
<ClInclude Include="..\source\win32\NstApplicationException.hpp" />
<ClInclude Include="..\source\win32\NstApplicationInstance.hpp" />
<ClInclude Include="..\source\win32\NstApplicationLanguage.hpp" />
<ClInclude Include="..\source\win32\NstApplicationMain.hpp" />
<ClInclude Include="..\source\win32\NstCollectionBitSet.hpp" />
<ClInclude Include="..\source\win32\NstCollectionRouter.hpp" />
<ClInclude Include="..\source\win32\NstCollectionVector.hpp" />
<ClInclude Include="..\source\win32\NstWindowCustom.hpp" />
<ClInclude Include="..\source\win32\NstWindowDialog.hpp" />
<ClInclude Include="..\source\win32\NstWindowDropFiles.hpp" />
<ClInclude Include="..\source\win32\NstWindowDynamic.hpp" />
<ClInclude Include="..\source\win32\NstWindowGeneric.hpp" />
<ClInclude Include="..\source\win32\NstWindowMain.hpp" />
<ClInclude Include="..\source\win32\NstWindowMenu.hpp" />
<ClInclude Include="..\source\win32\NstWindowParam.hpp" />
<ClInclude Include="..\source\win32\NstWindowPoint.hpp" />
<ClInclude Include="..\source\win32\NstWindowRect.hpp" />
<ClInclude Include="..\source\win32\NstWindowStatusBar.hpp" />
<ClInclude Include="..\source\win32\NstWindowUser.hpp" />
<ClInclude Include="..\source\win32\NstDialogAbout.hpp" />
<ClInclude Include="..\source\win32\NstDialogAutoSaver.hpp" />
<ClInclude Include="..\source\win32\NstDialogBarcodeReader.hpp" />
<ClInclude Include="..\source\win32\NstDialogBrowse.hpp" />
<ClInclude Include="..\source\win32\NstDialogCheats.hpp" />
<ClInclude Include="..\source\win32\NstDialogDipSwitches.hpp" />
<ClInclude Include="..\source\win32\NstDialogFds.hpp" />
<ClInclude Include="..\source\win32\NstDialogFind.hpp" />
<ClInclude Include="..\source\win32\NstDialogFrameClock.hpp" />
<ClInclude Include="..\source\win32\NstDialogImageDatabase.hpp" />
<ClInclude Include="..\source\win32\NstDialogImageInfo.hpp" />
<ClInclude Include="..\source\win32\NstDialogInesHeader.hpp" />
<ClInclude Include="..\source\win32\NstDialogInput.hpp" />
<ClInclude Include="..\source\win32\NstDialogLanguage.hpp" />
<ClInclude Include="..\source\win32\NstDialogLauncher.hpp" />
<ClInclude Include="..\source\win32\NstDialogLicense.hpp" />
<ClInclude Include="..\source\win32\NstDialogLogfile.hpp" />
<ClInclude Include="..\source\win32\NstDialogMovie.hpp" />
<ClInclude Include="..\source\win32\NstDialogNetplay.hpp" />
<ClInclude Include="..\source\win32\NstDialogPaletteEditor.hpp" />
<ClInclude Include="..\source\win32\NstDialogPaths.hpp" />
<ClInclude Include="..\source\win32\NstDialogPreferences.hpp" />
<ClInclude Include="..\source\win32\NstDialogSound.hpp" />
<ClInclude Include="..\source\win32\NstDialogTapeRecorder.hpp" />
<ClInclude Include="..\source\win32\NstDialogVideo.hpp" />
<ClInclude Include="..\source\win32\NstDialogVideoDecoder.hpp" />
<ClInclude Include="..\source\win32\NstDialogVideoFilters.hpp" />
<ClInclude Include="..\source\win32\NstCtrlCheckBox.hpp" />
<ClInclude Include="..\source\win32\NstCtrlComboBox.hpp" />
<ClInclude Include="..\source\win32\NstCtrlEdit.hpp" />
<ClInclude Include="..\source\win32\NstCtrlListBox.hpp" />
<ClInclude Include="..\source\win32\NstCtrlListView.hpp" />
<ClInclude Include="..\source\win32\NstCtrlRadioButton.hpp" />
<ClInclude Include="..\source\win32\NstCtrlSlider.hpp" />
<ClInclude Include="..\source\win32\NstCtrlStandard.hpp" />
<ClInclude Include="..\source\win32\NstCtrlTreeView.hpp" />
<ClInclude Include="..\source\win32\NstManager.hpp" />
<ClInclude Include="..\source\win32\NstManagerAviConverter.hpp" />
<ClInclude Include="..\source\win32\NstManagerBarcodeReader.hpp" />
<ClInclude Include="..\source\win32\NstManagerCheats.hpp" />
<ClInclude Include="..\source\win32\NstManagerDipSwitches.hpp" />
<ClInclude Include="..\source\win32\NstManagerEmulator.hpp" />
<ClInclude Include="..\source\win32\NstManagerFds.hpp" />
<ClInclude Include="..\source\win32\NstManagerFiles.hpp" />
<ClInclude Include="..\source\win32\NstManagerFrameClock.hpp" />
<ClInclude Include="..\source\win32\NstManagerHelp.hpp" />
<ClInclude Include="..\source\win32\NstManagerImageDatabase.hpp" />
<ClInclude Include="..\source\win32\NstManagerImageInfo.hpp" />
<ClInclude Include="..\source\win32\NstManagerInesHeader.hpp" />
<ClInclude Include="..\source\win32\NstManagerInput.hpp" />
<ClInclude Include="..\source\win32\NstManagerLanguage.hpp" />
<ClInclude Include="..\source\win32\NstManagerLauncher.hpp" />
<ClInclude Include="..\source\win32\NstManagerLogfile.hpp" />
<ClInclude Include="..\source\win32\NstManagerMachine.hpp" />
<ClInclude Include="..\source\win32\NstManagerMovie.hpp" />
<ClInclude Include="..\source\win32\NstManagerNetplay.hpp" />
<ClInclude Include="..\source\win32\NstManagerNsf.hpp" />
<ClInclude Include="..\source\win32\NstManagerPaths.hpp" />
<ClInclude Include="..\source\win32\NstManagerPathsFilter.hpp" />
<ClInclude Include="..\source\win32\NstManagerPreferences.hpp" />
<ClInclude Include="..\source\win32\NstManagerRecentDirs.hpp" />
<ClInclude Include="..\source\win32\NstManagerRecentFiles.hpp" />
<ClInclude Include="..\source\win32\NstManagerSaveStates.hpp" />
<ClInclude Include="..\source\win32\NstManagerSound.hpp" />
<ClInclude Include="..\source\win32\NstManagerSoundRecorder.hpp" />
<ClInclude Include="..\source\win32\NstManagerTapeRecorder.hpp" />
<ClInclude Include="..\source\win32\NstManagerVideo.hpp" />
<ClInclude Include="..\source\win32\NstIoArchive.hpp" />
<ClInclude Include="..\source\win32\NstIoFile.hpp" />
<ClInclude Include="..\source\win32\NstIoLog.hpp" />
<ClInclude Include="..\source\win32\NstIoScreen.hpp" />
<ClInclude Include="..\source\win32\NstIoStream.hpp" />
<ClInclude Include="..\source\win32\NstIoWave.hpp" />
<ClInclude Include="..\source\win32\NstObjectBackup.hpp" />
<ClInclude Include="..\source\win32\NstObjectDelegate.hpp" />
<ClInclude Include="..\source\win32\NstObjectHeap.hpp" />
<ClInclude Include="..\source\win32\NstObjectPod.hpp" />
<ClInclude Include="..\source\win32\NstResourceBitmap.hpp" />
<ClInclude Include="..\source\win32\NstResourceClipboard.hpp" />
<ClInclude Include="..\source\win32\NstResourceCursor.hpp" />
<ClInclude Include="..\source\win32\NstResourceFile.hpp" />
<ClInclude Include="..\source\win32\NstResourceGeneric.hpp" />
<ClInclude Include="..\source\win32\NstResourceIcon.hpp" />
<ClInclude Include="..\source\win32\NstResourceMenu.hpp" />
<ClInclude Include="..\source\win32\NstResourceString.hpp" />
<ClInclude Include="..\source\win32\NstResourceVersion.hpp" />
<ClInclude Include="..\source\win32\resource\resource.h" />
<ClInclude Include="..\source\win32\NstSystemAccelerator.hpp" />
<ClInclude Include="..\source\win32\NstSystemDll.hpp" />
<ClInclude Include="..\source\win32\NstSystemGuid.hpp" />
<ClInclude Include="..\source\win32\NstSystemInfo.hpp" />
<ClInclude Include="..\source\win32\NstSystemKeyboard.hpp" />
<ClInclude Include="..\source\win32\NstSystemRegistry.hpp" />
<ClInclude Include="..\source\win32\NstSystemThread.hpp" />
<ClInclude Include="..\source\win32\NstSystemTime.hpp" />
<ClInclude Include="..\source\win32\NstSystemTimer.hpp" />
<ClInclude Include="..\source\win32\NstString.hpp" />
<ClInclude Include="..\source\win32\NstDirect2D.hpp" />
<ClInclude Include="..\source\win32\NstDirectInput.hpp" />
<ClInclude Include="..\source\win32\NstDirectSound.hpp" />
<ClInclude Include="..\source\win32\NstDirectX.hpp" />
<ClInclude Include="..\source\win32\NstMain.hpp" />
</ItemGroup>
<ItemGroup>
<None Include="..\source\win32\NstCollectionRouter.inl" />
<None Include="..\source\win32\NstWindowDialog.inl" />
<None Include="..\source\win32\resource\FolderClosed.bmp" />
<None Include="..\source\win32\resource\FolderOpen.bmp" />
<None Include="..\source\win32\resource\application.ico" />
<None Include="..\source\win32\resource\application_j.ico" />
<None Include="..\source\win32\resource\fds.ico" />
<None Include="..\source\win32\resource\nes.ico" />
<None Include="..\source\win32\resource\nes_j.ico" />
<None Include="..\source\win32\resource\nsf.ico" />
<None Include="..\source\win32\resource\nsf_j.ico" />
<None Include="..\source\win32\resource\nsp.ico" />
<None Include="..\source\win32\resource\nsp_j.ico" />
<None Include="..\source\win32\resource\unf.ico" />
<None Include="..\source\win32\resource\unf_j.ico" />
<None Include="..\source\win32\resource\window.ico" />
<None Include="..\source\win32\resource\window_j.ico" />
<CustomBuild Include="..\dll\7zxa.dll">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy /Y "%(FullPath)" "$(OutDir)"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)%(Filename)%(Extension);%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy /Y "%(FullPath)" "$(OutDir)"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)%(Filename)%(Extension);%(Outputs)</Outputs>
</CustomBuild>
<None Include="..\source\win32\resource\copying.zip" />
<None Include="..\source\win32\resource\gun.cur" />
<CustomBuild Include="..\dll\kailleraclient.dll">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy /Y "%(FullPath)" "$(OutDir)"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)%(Filename)%(Extension);%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy /Y "%(FullPath)" "$(OutDir)"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)%(Filename)%(Extension);%(Outputs)</Outputs>
</CustomBuild>
<None Include="..\source\core\database\NstDatabase.zip" />
<CustomBuild Include="..\doc\releasenotes.txt">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy /Y "%(FullPath)" "$(OutDir)"</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)%(Filename)%(Extension);%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy /Y "%(FullPath)" "$(OutDir)"</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)%(Filename)%(Extension);%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="..\dll\unrar.dll">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy /Y "%(FullPath)" "$(OutDir)"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)%(Filename)%(Extension);%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy /Y "%(FullPath)" "$(OutDir)"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)%(Filename)%(Extension);%(Outputs)</Outputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\source\win32\resource\win32.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="core.vcxproj">
<Project>{ccc3a09c-0f7a-4e12-8594-11f2c60d71da}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="language.vcxproj">
<Project>{c456e741-cf7a-455e-884b-b0f9f86e7c86}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,872 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Application">
<UniqueIdentifier>{2d81b45d-7461-4e5c-917e-457b41457ae3}</UniqueIdentifier>
</Filter>
<Filter Include="Collection">
<UniqueIdentifier>{6d4e4558-89e9-453d-9a80-83db682ffde9}</UniqueIdentifier>
</Filter>
<Filter Include="Window">
<UniqueIdentifier>{f393692b-7552-4aa0-a1be-49f0c188cf75}</UniqueIdentifier>
</Filter>
<Filter Include="Window\Dialogs">
<UniqueIdentifier>{334be6f9-507f-47fa-bf02-4318336c3e69}</UniqueIdentifier>
</Filter>
<Filter Include="Window\Controls">
<UniqueIdentifier>{7bf1491a-6084-4487-b589-18392facebab}</UniqueIdentifier>
</Filter>
<Filter Include="Managers">
<UniqueIdentifier>{53193409-c8cc-4e84-b279-0e4da7e4fb1d}</UniqueIdentifier>
</Filter>
<Filter Include="IO">
<UniqueIdentifier>{a786ba23-27ba-408c-bd60-f6c4c1fbfb63}</UniqueIdentifier>
</Filter>
<Filter Include="Object">
<UniqueIdentifier>{a0830cb9-81d7-4a38-8f01-d1375e3b5cdc}</UniqueIdentifier>
</Filter>
<Filter Include="Resource">
<UniqueIdentifier>{a58d41c6-b08c-4654-aa9c-35cc256c2953}</UniqueIdentifier>
</Filter>
<Filter Include="Resource\Bitmaps">
<UniqueIdentifier>{ce05fea4-48d6-4cba-93eb-229da45cdf2f}</UniqueIdentifier>
</Filter>
<Filter Include="Resource\Icons">
<UniqueIdentifier>{e29ff767-efb2-4cb9-9638-26cc59d3cd98}</UniqueIdentifier>
</Filter>
<Filter Include="Resource\Cursors">
<UniqueIdentifier>{1ae99660-58e6-4d49-ba00-417410822ab6}</UniqueIdentifier>
</Filter>
<Filter Include="Resource\Files">
<UniqueIdentifier>{fbbef7c2-71e0-48b1-a79c-edc216199440}</UniqueIdentifier>
</Filter>
<Filter Include="System">
<UniqueIdentifier>{c0f2da02-3927-45ca-a0cc-fc55d2b3db98}</UniqueIdentifier>
</Filter>
<Filter Include="String">
<UniqueIdentifier>{302294f8-7408-4eac-ab06-13c71d2d9986}</UniqueIdentifier>
</Filter>
<Filter Include="DirectX">
<UniqueIdentifier>{53575f00-929e-4e7a-b8cf-5ffb07995a07}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\source\win32\NstApplicationConfiguration.cpp">
<Filter>Application</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstApplicationException.cpp">
<Filter>Application</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstApplicationInstance.cpp">
<Filter>Application</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstApplicationLanguage.cpp">
<Filter>Application</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstApplicationMain.cpp">
<Filter>Application</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstCollectionVector.cpp">
<Filter>Collection</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstWindowCustom.cpp">
<Filter>Window</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstWindowDialog.cpp">
<Filter>Window</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstWindowDropFiles.cpp">
<Filter>Window</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstWindowDynamic.cpp">
<Filter>Window</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstWindowGeneric.cpp">
<Filter>Window</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstWindowMain.cpp">
<Filter>Window</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstWindowMenu.cpp">
<Filter>Window</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstWindowParam.cpp">
<Filter>Window</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstWindowPoint.cpp">
<Filter>Window</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstWindowRect.cpp">
<Filter>Window</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstWindowStatusBar.cpp">
<Filter>Window</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstWindowUser.cpp">
<Filter>Window</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogAbout.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogAutoSaver.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogBarcodeReader.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogBrowse.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogCheats.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogDipSwitches.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogFds.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogFind.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogFrameClock.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogImageDatabase.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogImageInfo.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogInesHeader.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogInput.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogLanguage.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogLauncher.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogLauncherColors.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogLauncherColumns.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogLauncherFiles.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogLauncherFileTable.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogLauncherList.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogLauncherPaths.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogLauncherTree.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogLicense.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogLogfile.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogMovie.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogNetPlay.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogNetplayChat.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogPaletteEditor.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogPaths.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogPreferences.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogSound.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogTapeRecorder.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogVideo.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogVideoDecoder.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDialogVideoFilters.cpp">
<Filter>Window\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstCtrlCheckBox.cpp">
<Filter>Window\Controls</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstCtrlComboBox.cpp">
<Filter>Window\Controls</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstCtrlEdit.cpp">
<Filter>Window\Controls</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstCtrlListBox.cpp">
<Filter>Window\Controls</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstCtrlListView.cpp">
<Filter>Window\Controls</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstCtrlSlider.cpp">
<Filter>Window\Controls</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstCtrlStandard.cpp">
<Filter>Window\Controls</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstCtrlTreeView.cpp">
<Filter>Window\Controls</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManager.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerAviConverter.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerBarcodeReader.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerCheats.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerDipSwitches.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerEmulator.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerFds.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerFiles.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerFrameClock.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerHelp.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerImageDatabase.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerImageInfo.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerInesHeader.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerInput.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerInputClipboard.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerInputCommands.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerInputCursor.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerLanguage.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerLauncher.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerLogfile.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerMachine.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerMovie.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerNetplay.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerNsf.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerPaths.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerPathsFilter.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerPreferences.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerRecentDirs.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerRecentFiles.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerSaveStates.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerSound.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerSoundRecorder.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerTapeRecorder.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstManagerVideo.cpp">
<Filter>Managers</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstIoArchive.cpp">
<Filter>IO</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstIoFile.cpp">
<Filter>IO</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstIoLog.cpp">
<Filter>IO</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstIoScreen.cpp">
<Filter>IO</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstIoStream.cpp">
<Filter>IO</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstIoWave.cpp">
<Filter>IO</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstResourceBitmap.cpp">
<Filter>Resource</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstResourceClipboard.cpp">
<Filter>Resource</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstResourceCursor.cpp">
<Filter>Resource</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstResourceFile.cpp">
<Filter>Resource</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstResourceGeneric.cpp">
<Filter>Resource</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstResourceIcon.cpp">
<Filter>Resource</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstResourceMenu.cpp">
<Filter>Resource</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstResourceString.cpp">
<Filter>Resource</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstResourceVersion.cpp">
<Filter>Resource</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstSystemAccelerator.cpp">
<Filter>System</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstSystemDll.cpp">
<Filter>System</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstSystemGuid.cpp">
<Filter>System</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstSystemInfo.cpp">
<Filter>System</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstSystemKeyboard.cpp">
<Filter>System</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstSystemRegistry.cpp">
<Filter>System</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstSystemThread.cpp">
<Filter>System</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstSystemTime.cpp">
<Filter>System</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstSystemTimer.cpp">
<Filter>System</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstString.cpp">
<Filter>String</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDirect2D.cpp">
<Filter>DirectX</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDirectInput.cpp">
<Filter>DirectX</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstDirectSound.cpp">
<Filter>DirectX</Filter>
</ClCompile>
<ClCompile Include="..\source\win32\NstMain.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\source\win32\NstApplicationConfiguration.hpp">
<Filter>Application</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstApplicationException.hpp">
<Filter>Application</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstApplicationInstance.hpp">
<Filter>Application</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstApplicationLanguage.hpp">
<Filter>Application</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstApplicationMain.hpp">
<Filter>Application</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstCollectionBitSet.hpp">
<Filter>Collection</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstCollectionRouter.hpp">
<Filter>Collection</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstCollectionVector.hpp">
<Filter>Collection</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstWindowCustom.hpp">
<Filter>Window</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstWindowDialog.hpp">
<Filter>Window</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstWindowDropFiles.hpp">
<Filter>Window</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstWindowDynamic.hpp">
<Filter>Window</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstWindowGeneric.hpp">
<Filter>Window</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstWindowMain.hpp">
<Filter>Window</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstWindowMenu.hpp">
<Filter>Window</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstWindowParam.hpp">
<Filter>Window</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstWindowPoint.hpp">
<Filter>Window</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstWindowRect.hpp">
<Filter>Window</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstWindowStatusBar.hpp">
<Filter>Window</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstWindowUser.hpp">
<Filter>Window</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogAbout.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogAutoSaver.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogBarcodeReader.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogBrowse.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogCheats.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogDipSwitches.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogFds.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogFind.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogFrameClock.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogImageDatabase.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogImageInfo.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogInesHeader.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogInput.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogLanguage.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogLauncher.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogLicense.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogLogfile.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogMovie.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogNetplay.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogPaletteEditor.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogPaths.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogPreferences.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogSound.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogTapeRecorder.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogVideo.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogVideoDecoder.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDialogVideoFilters.hpp">
<Filter>Window\Dialogs</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstCtrlCheckBox.hpp">
<Filter>Window\Controls</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstCtrlComboBox.hpp">
<Filter>Window\Controls</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstCtrlEdit.hpp">
<Filter>Window\Controls</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstCtrlListBox.hpp">
<Filter>Window\Controls</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstCtrlListView.hpp">
<Filter>Window\Controls</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstCtrlRadioButton.hpp">
<Filter>Window\Controls</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstCtrlSlider.hpp">
<Filter>Window\Controls</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstCtrlStandard.hpp">
<Filter>Window\Controls</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstCtrlTreeView.hpp">
<Filter>Window\Controls</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManager.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerAviConverter.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerBarcodeReader.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerCheats.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerDipSwitches.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerEmulator.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerFds.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerFiles.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerFrameClock.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerHelp.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerImageDatabase.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerImageInfo.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerInesHeader.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerInput.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerLanguage.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerLauncher.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerLogfile.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerMachine.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerMovie.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerNetplay.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerNsf.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerPaths.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerPathsFilter.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerPreferences.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerRecentDirs.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerRecentFiles.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerSaveStates.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerSound.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerSoundRecorder.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerTapeRecorder.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstManagerVideo.hpp">
<Filter>Managers</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstIoArchive.hpp">
<Filter>IO</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstIoFile.hpp">
<Filter>IO</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstIoLog.hpp">
<Filter>IO</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstIoScreen.hpp">
<Filter>IO</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstIoStream.hpp">
<Filter>IO</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstIoWave.hpp">
<Filter>IO</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstObjectBackup.hpp">
<Filter>Object</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstObjectDelegate.hpp">
<Filter>Object</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstObjectHeap.hpp">
<Filter>Object</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstObjectPod.hpp">
<Filter>Object</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstResourceBitmap.hpp">
<Filter>Resource</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstResourceClipboard.hpp">
<Filter>Resource</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstResourceCursor.hpp">
<Filter>Resource</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstResourceFile.hpp">
<Filter>Resource</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstResourceGeneric.hpp">
<Filter>Resource</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstResourceIcon.hpp">
<Filter>Resource</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstResourceMenu.hpp">
<Filter>Resource</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstResourceString.hpp">
<Filter>Resource</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstResourceVersion.hpp">
<Filter>Resource</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\resource\resource.h">
<Filter>Resource</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstSystemAccelerator.hpp">
<Filter>System</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstSystemDll.hpp">
<Filter>System</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstSystemGuid.hpp">
<Filter>System</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstSystemInfo.hpp">
<Filter>System</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstSystemKeyboard.hpp">
<Filter>System</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstSystemRegistry.hpp">
<Filter>System</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstSystemThread.hpp">
<Filter>System</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstSystemTime.hpp">
<Filter>System</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstSystemTimer.hpp">
<Filter>System</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstString.hpp">
<Filter>String</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDirect2D.hpp">
<Filter>DirectX</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDirectInput.hpp">
<Filter>DirectX</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDirectSound.hpp">
<Filter>DirectX</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstDirectX.hpp">
<Filter>DirectX</Filter>
</ClInclude>
<ClInclude Include="..\source\win32\NstMain.hpp" />
</ItemGroup>
<ItemGroup>
<None Include="..\source\win32\NstCollectionRouter.inl">
<Filter>Collection</Filter>
</None>
<None Include="..\source\win32\NstWindowDialog.inl">
<Filter>Window</Filter>
</None>
<None Include="..\source\win32\resource\FolderClosed.bmp">
<Filter>Resource\Bitmaps</Filter>
</None>
<None Include="..\source\win32\resource\FolderOpen.bmp">
<Filter>Resource\Bitmaps</Filter>
</None>
<None Include="..\source\win32\resource\application.ico">
<Filter>Resource\Icons</Filter>
</None>
<None Include="..\source\win32\resource\application_j.ico">
<Filter>Resource\Icons</Filter>
</None>
<None Include="..\source\win32\resource\fds.ico">
<Filter>Resource\Icons</Filter>
</None>
<None Include="..\source\win32\resource\nes.ico">
<Filter>Resource\Icons</Filter>
</None>
<None Include="..\source\win32\resource\nes_j.ico">
<Filter>Resource\Icons</Filter>
</None>
<None Include="..\source\win32\resource\nsf.ico">
<Filter>Resource\Icons</Filter>
</None>
<None Include="..\source\win32\resource\nsf_j.ico">
<Filter>Resource\Icons</Filter>
</None>
<None Include="..\source\win32\resource\nsp.ico">
<Filter>Resource\Icons</Filter>
</None>
<None Include="..\source\win32\resource\nsp_j.ico">
<Filter>Resource\Icons</Filter>
</None>
<None Include="..\source\win32\resource\unf.ico">
<Filter>Resource\Icons</Filter>
</None>
<None Include="..\source\win32\resource\unf_j.ico">
<Filter>Resource\Icons</Filter>
</None>
<None Include="..\source\win32\resource\window.ico">
<Filter>Resource\Icons</Filter>
</None>
<None Include="..\source\win32\resource\window_j.ico">
<Filter>Resource\Icons</Filter>
</None>
<None Include="..\source\win32\resource\copying.zip">
<Filter>Resource\Files</Filter>
</None>
<None Include="..\source\win32\resource\gun.cur">
<Filter>Resource\Files</Filter>
</None>
<None Include="..\source\core\database\NstDatabase.zip">
<Filter>Resource\Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\source\win32\resource\win32.rc">
<Filter>Resource</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\dll\7zxa.dll">
<Filter>Resource\Files</Filter>
</CustomBuild>
<CustomBuild Include="..\dll\kailleraclient.dll">
<Filter>Resource\Files</Filter>
</CustomBuild>
<CustomBuild Include="..\doc\releasenotes.txt">
<Filter>Resource\Files</Filter>
</CustomBuild>
<CustomBuild Include="..\dll\unrar.dll">
<Filter>Resource\Files</Filter>
</CustomBuild>
</ItemGroup>
</Project>

173
source/7zip/IArchive.h Normal file
View File

@@ -0,0 +1,173 @@
// IArchive.h
#ifndef __IARCHIVE_H
#define __IARCHIVE_H
#include "IStream.h"
#include "IProgress.h"
#include "PropID.h"
// MIDL_INTERFACE("23170F69-40C1-278A-0000-000600xx0000")
#define ARCHIVE_INTERFACE_SUB(i, base, x) \
DEFINE_GUID(IID_ ## i, \
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x06, 0x00, x, 0x00, 0x00); \
struct i: public base
#define ARCHIVE_INTERFACE(i, x) ARCHIVE_INTERFACE_SUB(i, IUnknown, x)
namespace NFileTimeType
{
enum EEnum
{
kWindows,
kUnix,
kDOS
};
}
namespace NArchive
{
enum
{
kName = 0,
kClassID,
kExtension,
kAddExtension,
kUpdate,
kKeepName,
kStartSignature,
kFinishSignature,
kAssociate
};
namespace NExtract
{
namespace NAskMode
{
enum
{
kExtract = 0,
kTest,
kSkip
};
}
namespace NOperationResult
{
enum
{
kOK = 0,
kUnSupportedMethod,
kDataError,
kCRCError
};
}
}
namespace NUpdate
{
namespace NOperationResult
{
enum
{
kOK = 0,
kError
};
}
}
}
ARCHIVE_INTERFACE(IArchiveOpenCallback, 0x10)
{
STDMETHOD(SetTotal)(const UInt64 *files, const UInt64 *bytes) PURE;
STDMETHOD(SetCompleted)(const UInt64 *files, const UInt64 *bytes) PURE;
};
ARCHIVE_INTERFACE_SUB(IArchiveExtractCallback, IProgress, 0x20)
{
STDMETHOD(GetStream)(UInt32 index, ISequentialOutStream **outStream,
Int32 askExtractMode) PURE;
// GetStream OUT: S_OK - OK, S_FALSE - skeep this file
STDMETHOD(PrepareOperation)(Int32 askExtractMode) PURE;
STDMETHOD(SetOperationResult)(Int32 resultEOperationResult) PURE;
};
ARCHIVE_INTERFACE(IArchiveOpenVolumeCallback, 0x30)
{
STDMETHOD(GetProperty)(PROPID propID, PROPVARIANT *value) PURE;
STDMETHOD(GetStream)(const wchar_t *name, IInStream **inStream) PURE;
};
ARCHIVE_INTERFACE(IInArchiveGetStream, 0x40)
{
STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream) PURE;
};
ARCHIVE_INTERFACE(IArchiveOpenSetSubArchiveName, 0x50)
{
STDMETHOD(SetSubArchiveName)(const wchar_t *name) PURE;
};
ARCHIVE_INTERFACE(IInArchive, 0x60)
{
STDMETHOD(Open)(IInStream *stream, const UInt64 *maxCheckStartPosition,
IArchiveOpenCallback *openArchiveCallback) PURE;
STDMETHOD(Close)() PURE;
STDMETHOD(GetNumberOfItems)(UInt32 *numItems) PURE;
STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value) PURE;
STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems,
Int32 testMode, IArchiveExtractCallback *extractCallback) PURE;
// indices must be sorted
// numItems = 0xFFFFFFFF means all files
// testMode != 0 means "test files operation"
STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value) PURE;
STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties) PURE;
STDMETHOD(GetPropertyInfo)(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType) PURE;
STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties) PURE;
STDMETHOD(GetArchivePropertyInfo)(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType) PURE;
};
ARCHIVE_INTERFACE_SUB(IArchiveUpdateCallback, IProgress, 0x80)
{
STDMETHOD(GetUpdateItemInfo)(UInt32 index,
Int32 *newData, // 1 - new data, 0 - old data
Int32 *newProperties, // 1 - new properties, 0 - old properties
UInt32 *indexInArchive // -1 if there is no in archive, or if doesn't matter
) PURE;
STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value) PURE;
STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **inStream) PURE;
STDMETHOD(SetOperationResult)(Int32 operationResult) PURE;
};
ARCHIVE_INTERFACE_SUB(IArchiveUpdateCallback2, IArchiveUpdateCallback, 0x82)
{
STDMETHOD(GetVolumeSize)(UInt32 index, UInt64 *size) PURE;
STDMETHOD(GetVolumeStream)(UInt32 index, ISequentialOutStream **volumeStream) PURE;
};
ARCHIVE_INTERFACE(IOutArchive, 0xA0)
{
STDMETHOD(UpdateItems)(ISequentialOutStream *outStream, UInt32 numItems,
IArchiveUpdateCallback *updateCallback) PURE;
STDMETHOD(GetFileTimeType)(UInt32 *type) PURE;
};
ARCHIVE_INTERFACE(ISetProperties, 0x03)
{
STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties) PURE;
};
#endif

32
source/7zip/IProgress.h Normal file
View File

@@ -0,0 +1,32 @@
// Interface/IProgress.h
#ifndef __IPROGRESS_H
#define __IPROGRESS_H
#include "MyUnknown.h"
#include "Types.h"
// {23170F69-40C1-278A-0000-000000050000}
DEFINE_GUID(IID_IProgress,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000000050000")
IProgress: public IUnknown
{
STDMETHOD(SetTotal)(UInt64 total) PURE;
STDMETHOD(SetCompleted)(const UInt64 *completeValue) PURE;
};
/*
// {23170F69-40C1-278A-0000-000000050002}
DEFINE_GUID(IID_IProgress2,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x02);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000000050002")
IProgress2: public IUnknown
{
public:
STDMETHOD(SetTotal)(const UInt64 *total) PURE;
STDMETHOD(SetCompleted)(const UInt64 *completeValue) PURE;
};
*/
#endif

62
source/7zip/IStream.h Normal file
View File

@@ -0,0 +1,62 @@
// IStream.h
#ifndef __ISTREAM_H
#define __ISTREAM_H
#include "MyUnknown.h"
#include "Types.h"
// "23170F69-40C1-278A-0000-000300xx0000"
#define STREAM_INTERFACE_SUB(i, b, x) \
DEFINE_GUID(IID_ ## i, \
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x03, 0x00, x, 0x00, 0x00); \
struct i: public b
#define STREAM_INTERFACE(i, x) STREAM_INTERFACE_SUB(i, IUnknown, x)
STREAM_INTERFACE(ISequentialInStream, 0x01)
{
STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize) PURE;
/*
Out: if size != 0, return_value = S_OK and (*processedSize == 0),
then there are no more bytes in stream.
if (size > 0) && there are bytes in stream,
this function must read at least 1 byte.
This function is allowed to read less than number of remaining bytes in stream.
You must call Read function in loop, if you need exact amount of data
*/
};
STREAM_INTERFACE(ISequentialOutStream, 0x02)
{
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize) PURE;
/*
if (size > 0) this function must write at least 1 byte.
This function is allowed to write less than "size".
You must call Write function in loop, if you need to write exact amount of data
*/
};
STREAM_INTERFACE_SUB(IInStream, ISequentialInStream, 0x03)
{
STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) PURE;
};
STREAM_INTERFACE_SUB(IOutStream, ISequentialOutStream, 0x04)
{
STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) PURE;
STDMETHOD(SetSize)(Int64 newSize) PURE;
};
STREAM_INTERFACE(IStreamGetSize, 0x06)
{
STDMETHOD(GetSize)(UInt64 *size) PURE;
};
STREAM_INTERFACE(IOutStreamFlush, 0x07)
{
STDMETHOD(Flush)() PURE;
};
#endif

24
source/7zip/MyUnknown.h Normal file
View File

@@ -0,0 +1,24 @@
// MyUnknown.h
#ifndef __MYUNKNOWN_H
#define __MYUNKNOWN_H
#ifdef _WIN32
#ifdef _WIN32_WCE
#if (_WIN32_WCE > 300)
#include <basetyps.h>
#else
#define MIDL_INTERFACE(x) struct
#endif
#else
#include <basetyps.h>
#endif
#include <unknwn.h>
#else
#include "MyWindows.h"
#endif
#endif

50
source/7zip/PropID.h Normal file
View File

@@ -0,0 +1,50 @@
// Interface/PropID.h
#ifndef __INTERFACE_PROPID_H
#define __INTERFACE_PROPID_H
enum
{
kpidNoProperty = 0,
kpidHandlerItemIndex = 2,
kpidPath,
kpidName,
kpidExtension,
kpidIsFolder,
kpidSize,
kpidPackedSize,
kpidAttributes,
kpidCreationTime,
kpidLastAccessTime,
kpidLastWriteTime,
kpidSolid,
kpidCommented,
kpidEncrypted,
kpidSplitBefore,
kpidSplitAfter,
kpidDictionarySize,
kpidCRC,
kpidType,
kpidIsAnti,
kpidMethod,
kpidHostOS,
kpidFileSystem,
kpidUser,
kpidGroup,
kpidBlock,
kpidComment,
kpidPosition,
kpidTotalSize = 0x1100,
kpidFreeSpace,
kpidClusterSize,
kpidVolumeName,
kpidLocalName = 0x1200,
kpidProvider,
kpidUserDefined = 0x10000
};
#endif

19
source/7zip/Types.h Normal file
View File

@@ -0,0 +1,19 @@
// Common/Types.h
#ifndef __COMMON_TYPES_H
#define __COMMON_TYPES_H
typedef unsigned char Byte;
typedef short Int16;
typedef unsigned short UInt16;
typedef int Int32;
typedef unsigned int UInt32;
#ifdef _MSC_VER
typedef __int64 Int64;
typedef unsigned __int64 UInt64;
#else
typedef long long int Int64;
typedef unsigned long long int UInt64;
#endif
#endif

225
source/7zip/readme.txt Normal file
View File

@@ -0,0 +1,225 @@
7-Zip 4.27 Sources
------------------
7-Zip is a file archiver for Windows 95/98/ME/NT/2000/2003/XP.
7-Zip Copyright (C) 1999-2005 Igor Pavlov.
License Info
------------
Most of 7-Zip source code is under GNU LGPL.
Files in folders
7zip/Compress/Rar20
7zip/Compress/Rar29
7zip/Compress/Rar29/Original
are licensed under "unRAR license + GNU LGPL" license.
Source code files in all other folders of this package are under GNU LGPL.
"unRAR license + GNU LGPL" means that you must follow
GNU LGPL in all aspects while it is in agreement
with unRAR license. But you can not break unRAR license rules.
It means that unRAR license is main license in that pair.
You can find unRAR license in file unrarLicense.txt
You can find GNU LGPL license in file copying.txt
GNU LGPL information:
---------------------
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
unRAR license + GNU LGPL Notes
------------------------------
Please check main restriction from unRar license:
2. The unRAR sources may be used in any software to handle RAR
archives without limitations free of charge, but cannot be used
to re-create the RAR compression algorithm, which is proprietary.
Distribution of modified unRAR sources in separate form or as a
part of other software is permitted, provided that it is clearly
stated in the documentation and source comments that the code may
not be used to develop a RAR (WinRAR) compatible archiver.
In brief it means:
1) You can compile and use compiled files under GNU LGPL rules, since
unRAR license almost has no restrictions for compiled files.
You can link these compiled files to LGPL programs.
2) You can fix bugs in source code and use compiled fixed version.
3) You can not use unRAR sources to re-create the RAR compression algorithm.
7zip\Compress\Rar29\Original folder contains files that are modified
versions of original unRAR source code files.
License notes
-------------
You can support development of 7-Zip by registering.
7-Zip is free software distributed under the GNU LGPL.
If you need license with other conditions, write to
http://www.7-zip.org/support.html
---
Also this package contains files from LZMA SDK
you can download LZMA SDK from this page:
http://www.7-zip.org/sdk.html
read about addtional licenses for LZMA SDK in file
DOC/lzma.txt
How to compile
--------------
To compile sources you need Visual C++ 6.0.
For compiling some files you also need
new Platform SDK from Microsoft' Site:
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm
or
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/XPSP2FULLInstall.htm
or
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
If you use MSVC6, specify SDK directories at top of directories lists:
Tools / Options / Directories
- Include files
- Library files
To compile 7-Zip for AMD64 and IA64 you need:
Windows Server 2003 SP1 Platform SDK from microsoft.com
Compiling under Unix/Linux
--------------------------
Check this site for Posix/Linux version:
http://sourceforge.net/projects/p7zip/
Notes:
------
7-Zip consists of COM modules (DLL files).
But 7-Zip doesn't use standard COM interfaces for creating objects.
Look at
7zip\UI\Client7z folder for example of using DLL files of 7-Zip.
Some DLL files can use other DLL files from 7-Zip.
If you don't like it, you must use standalone version of DLL.
To compile standalone version of DLL you must include all used parts
to project and define some defs.
For example, 7zip\Bundles\Format7z is a standalone version of 7z.dll
that works with 7z format. So you can use such DLL in your project
without additional DLL files.
Description of 7-Zip sources package
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DOC Documentation
---
7zFormat.txt - 7z format description
copying.txt - GNU LGPL license
unRarLicense.txt - License for unRAR part of source code
history.txt - Sources history
Methods.txt - Compression method IDs
readme.txt - Readme file
lzma.txt - LZMA SDK description
7zip.nsi - installer script for NSIS
Common Common modules
Windows Win32 wrappers
7zip
-------
Common Common modules for 7-zip
Archive 7-Zip Archive Format Plugins
--------
Common
7z
Arj
BZip2
Cab
Cpio
GZip
Rar
Rpm
Split
Tar
Zip
Bundle Modules that are bundles of other modules
------
Alone 7za.exe: Standalone version of 7z
SFXCon 7zCon.sfx: Console 7z SFX module
SFXWin 7z.sfx: Windows 7z SFX module
SFXSetup 7zS.sfx: Windows 7z SFX module for Installers
Format7z 7za.dll: Standalone version of 7z.dll
UI
--
Agent Intermediary modules for FAR plugin and Explorer plugin
Console 7z.exe Console version
Explorer Explorer plugin
Resource Resources
Far FAR plugin
Client7z Test application for 7za.dll
Compress
--------
BZip2 BZip2 compressor
Original Download BZip2 compression sources from
http://sources.redhat.com/bzip2/index.html
to that folder.
Branch Branch converter
ByteSwap Byte Swap converter
Copy Copy coder
Deflate
Implode
Arj
LZMA
PPMd Dmitry Shkarin's PPMdH with small changes.
LZ Lempel - Ziv
MT Multi Thread Match finder
BinTree Match Finder based on Binary Tree
Patricia Match Finder based on Patricia algoritm
HashChain Match Finder based on Hash Chains
Crypto Crypto modules
------
7zAES Cipher for 7z
AES AES Cipher
Rar20 Cipher for Rar 2.0
RarAES Cipher for Rar 3.0
Zip Cipher for Zip
FileManager File Manager
---
Igor Pavlov
http://www.7-zip.org
---
End of document

View File

@@ -0,0 +1,145 @@
/*
Kaillera client API v0.84
(c) 2001 Christophe Thibault
History:
0.84: added moreInfos callback
0.83: added clientDropped callback
0.8 : added in-game chat function/callback
0.72: added kailleraEndGame() method
added kailleraGetVersion() method
0.7: modified kailleraModifyPlayValues behaviour
*/
//////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia changes:
//
// - added 'int' as return type in DLLEXP macros to suppress compiler warning messages
//
// 2004-07-28 / Martin Freij
//
//////////////////////////////////////////////////////////////////////////////////////
#ifndef KAILLERA_CLIENT_H
#define KAILLERA_CLIENT_H
#ifdef _WIN32
#include <windows.h>
#endif
#define KAILLERA_CLIENT_API_VERSION "0.8"
#ifdef KAILLERA_DLL
#define DLLEXP __declspec(dllexport) int WINAPI
#else
#define DLLEXP __declspec(dllimport) int WINAPI
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
char *appName;
char *gameList;
int (WINAPI *gameCallback)(char *game, int player, int numplayers);
void (WINAPI *chatReceivedCallback)(char *nick, char *text);
void (WINAPI *clientDroppedCallback)(char *nick, int playernb);
void (WINAPI *moreInfosCallback)(char *gamename);
} kailleraInfos;
/*
kailleraGetVersion
Call this method to retrieve kailleraclient.dll's version
- version must point to a char[16] buffer
*/
DLLEXP kailleraGetVersion(char *version);
/*
kailleraInit:
Call this method when your program starts
*/
DLLEXP kailleraInit();
/*
kailleraShutdown:
Call this method when your program ends
*/
DLLEXP kailleraShutdown();
/*
kailleraSetInfos:
Use this method for setting up various infos:
Required:
- appName must be 128 chars max.
- gameList is composed of all the game names separated by a NULL char (\0).
The list ends with 2 NULL chars (\0\0).
Be sure to only put available games there.
- gameCallback will be the function called when a new game starts
game -> name of the selected game
player -> player number (1-8). 0 for spectator.
numplayers -> number of players in the game (1-8)
Optional:
- chatReceivedCallback will be the function called when a chat line text
has been received. Set it to NULL if you don't need/want this callback.
- clientDroppedCallback will be the function called when a client drops
from the current game. Set it to NULL if you don't need/want this callback.
- moreInfosCallback will be the function called when the user selects
"More infos about this game..." in the game list context menu.
Set it to NULL if you don't need/want this feature.
*/
DLLEXP kailleraSetInfos(kailleraInfos *infos);
/*
kailleraSelectServerDialog:
Use this method for launching the Kaillera server dialog
*/
DLLEXP kailleraSelectServerDialog(HWND parent);
/*
kailleraModifyPlayValues:
You must call this method at every frame after you retrieved values from your input devices.
This method will record/bufferize the values you send in and will manage to mix them with
the other players.
Basically, each players sends his values and receive all players values concatened.
e.g:
t - player 1 sends "867F" - player 2 sends "964F"
t+1 - player 1 receives "867F964F" - player 2 receives "867F964F"
you may want to look at the modified MAME source code available on kaillera's home page
to have a working example out of this (look in inptport.c)
Ideally, your input values should be defined like 1 bit for a given key, which has to be
unset when the key is not pressed and set when the key is pressed.
The size of the values you pass to this function is the size for ONE player's values.
Also, it must be the SAME for a given game and should be kept to a minimum (for network
speed and latency issues).
Be sure that the values parameters has enough space for receiving all inputs from all players
(8 players max.)
returns: length received or -1 on network error (player no more in the game)
*/
DLLEXP kailleraModifyPlayValues(void *values, int size);
/*
kailleraChatSend
Use this function to send a line of chat text during a game
*/
DLLEXP kailleraChatSend(char *text);
/*
kailleraEndGame:
Your emulation thread must call this method when the user stops the emulation
*/
DLLEXP kailleraEndGame();
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,7 @@
well, everything should be self explained in kailleraclient.h.
if you need a sample, go look at the Kaillera implementation in the Mame32 source code, available on Kaillera's home page (http://www.kaillera.com/)
if you still have troubles/problems implementing the Kaillera client into your application, go look into the Kaillera SDK forums.
-christophe

18
source/unrar/license.txt Normal file
View File

@@ -0,0 +1,18 @@
The unrar.dll library is freeware. This means:
1. All copyrights to RAR and the unrar.dll are exclusively
owned by the author - Alexander Roshal.
2. The unrar.dll library may be used in any software to handle RAR
archives without limitations free of charge.
3. THE RAR ARCHIVER AND THE UNRAR.DLL LIBRARY ARE DISTRIBUTED "AS IS".
NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED. YOU USE AT
YOUR OWN RISK. THE AUTHOR WILL NOT BE LIABLE FOR DATA LOSS,
DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING
OR MISUSING THIS SOFTWARE.
Thank you for your interest in RAR and unrar.dll.
Alexander L. Roshal

129
source/unrar/unrar.h Normal file
View File

@@ -0,0 +1,129 @@
#ifndef _UNRAR_DLL_
#define _UNRAR_DLL_
#define ERAR_END_ARCHIVE 10
#define ERAR_NO_MEMORY 11
#define ERAR_BAD_DATA 12
#define ERAR_BAD_ARCHIVE 13
#define ERAR_UNKNOWN_FORMAT 14
#define ERAR_EOPEN 15
#define ERAR_ECREATE 16
#define ERAR_ECLOSE 17
#define ERAR_EREAD 18
#define ERAR_EWRITE 19
#define ERAR_SMALL_BUF 20
#define ERAR_UNKNOWN 21
#define RAR_OM_LIST 0
#define RAR_OM_EXTRACT 1
#define RAR_SKIP 0
#define RAR_TEST 1
#define RAR_EXTRACT 2
#define RAR_VOL_ASK 0
#define RAR_VOL_NOTIFY 1
#define RAR_DLL_VERSION 4
struct RARHeaderData
{
char ArcName[260];
char FileName[260];
unsigned int Flags;
unsigned int PackSize;
unsigned int UnpSize;
unsigned int HostOS;
unsigned int FileCRC;
unsigned int FileTime;
unsigned int UnpVer;
unsigned int Method;
unsigned int FileAttr;
char *CmtBuf;
unsigned int CmtBufSize;
unsigned int CmtSize;
unsigned int CmtState;
};
struct RARHeaderDataEx
{
char ArcName[1024];
wchar_t ArcNameW[1024];
char FileName[1024];
wchar_t FileNameW[1024];
unsigned int Flags;
unsigned int PackSize;
unsigned int PackSizeHigh;
unsigned int UnpSize;
unsigned int UnpSizeHigh;
unsigned int HostOS;
unsigned int FileCRC;
unsigned int FileTime;
unsigned int UnpVer;
unsigned int Method;
unsigned int FileAttr;
char *CmtBuf;
unsigned int CmtBufSize;
unsigned int CmtSize;
unsigned int CmtState;
unsigned int Reserved[1024];
};
struct RAROpenArchiveData
{
char *ArcName;
unsigned int OpenMode;
unsigned int OpenResult;
char *CmtBuf;
unsigned int CmtBufSize;
unsigned int CmtSize;
unsigned int CmtState;
};
struct RAROpenArchiveDataEx
{
char *ArcName;
wchar_t *ArcNameW;
unsigned int OpenMode;
unsigned int OpenResult;
char *CmtBuf;
unsigned int CmtBufSize;
unsigned int CmtSize;
unsigned int CmtState;
unsigned int Flags;
unsigned int Reserved[32];
};
enum UNRARCALLBACK_MESSAGES {
UCM_CHANGEVOLUME,UCM_PROCESSDATA,UCM_NEEDPASSWORD
};
typedef int (CALLBACK *UNRARCALLBACK)(UINT msg,LONG UserData,LONG P1,LONG P2);
typedef int (PASCAL *CHANGEVOLPROC)(char *ArcName,int Mode);
typedef int (PASCAL *PROCESSDATAPROC)(unsigned char *Addr,int Size);
#ifdef __cplusplus
extern "C" {
#endif
HANDLE PASCAL RAROpenArchive(struct RAROpenArchiveData *ArchiveData);
HANDLE PASCAL RAROpenArchiveEx(struct RAROpenArchiveDataEx *ArchiveData);
int PASCAL RARCloseArchive(HANDLE hArcData);
int PASCAL RARReadHeader(HANDLE hArcData,struct RARHeaderData *HeaderData);
int PASCAL RARReadHeaderEx(HANDLE hArcData,struct RARHeaderDataEx *HeaderData);
int PASCAL RARProcessFile(HANDLE hArcData,int Operation,char *DestPath,char *DestName);
int PASCAL RARProcessFileW(HANDLE hArcData,int Operation,wchar_t *DestPath,wchar_t *DestName);
void PASCAL RARSetCallback(HANDLE hArcData,UNRARCALLBACK Callback,LONG UserData);
void PASCAL RARSetChangeVolProc(HANDLE hArcData,CHANGEVOLPROC ChangeVolProc);
void PASCAL RARSetProcessDataProc(HANDLE hArcData,PROCESSDATAPROC ProcessDataProc);
void PASCAL RARSetPassword(HANDLE hArcData,char *Password);
int PASCAL RARGetDllVersion();
#ifdef __cplusplus
}
#endif
#endif

584
source/unrar/unrardll.txt Normal file
View File

@@ -0,0 +1,584 @@
unRAR.dll Manual
~~~~~~~~~~~~~~~~
UNRAR.DLL is a 32-bit Windows dynamic-link library which provides
file extraction from RAR archives.
Exported functions
====================================================================
HANDLE PASCAL RAROpenArchive(struct RAROpenArchiveData *ArchiveData)
====================================================================
Description
~~~~~~~~~~~
Open RAR archive and allocate memory structures
Parameters
~~~~~~~~~~
ArchiveData Points to RAROpenArchiveData structure
struct RAROpenArchiveData
{
char *ArcName;
UINT OpenMode;
UINT OpenResult;
char *CmtBuf;
UINT CmtBufSize;
UINT CmtSize;
UINT CmtState;
};
Structure fields:
ArcName
Input parameter which should point to zero terminated string
containing the archive name.
OpenMode
Input parameter.
Possible values
RAR_OM_LIST Open archive for reading file headers only
RAR_OM_EXTRACT Open archive for testing and extracting files
OpenResult
Output parameter.
Possible values
0 Success
ERAR_NO_MEMORY Not enough memory to initialize data structures
ERAR_BAD_DATA Archive header broken
ERAR_BAD_ARCHIVE File is not valid RAR archive
ERAR_UNKNOWN_FORMAT Unknown encryption used for archive headers
ERAR_EOPEN File open error
CmtBuf
Input parameter which should point to the buffer for archive
comments. Maximum comment size is limited to 64Kb. Comment text is
zero terminated. If the comment text is larger than the buffer
size, the comment text will be truncated. If CmtBuf is set to
NULL, comments will not be read.
CmtBufSize
Input parameter which should contain size of buffer for archive
comments.
CmtSize
Output parameter containing size of comments actually read into the
buffer, cannot exceed CmtBufSize.
CmtState
Output parameter.
Possible values
0 comments not present
1 Comments read completely
ERAR_NO_MEMORY Not enough memory to extract comments
ERAR_BAD_DATA Broken comment
ERAR_UNKNOWN_FORMAT Unknown comment format
ERAR_SMALL_BUF Buffer too small, comments not completely read
Return values
~~~~~~~~~~~~~
Archive handle or NULL in case of error
========================================================================
HANDLE PASCAL RAROpenArchiveEx(struct RAROpenArchiveDataEx *ArchiveData)
========================================================================
Description
~~~~~~~~~~~
Similar to RAROpenArchive, but uses RAROpenArchiveDataEx structure
allowing to specify Unicode archive name and returning information
about archive flags.
Parameters
~~~~~~~~~~
ArchiveData Points to RAROpenArchiveDataEx structure
struct RAROpenArchiveDataEx
{
char *ArcName;
wchar_t *ArcNameW;
unsigned int OpenMode;
unsigned int OpenResult;
char *CmtBuf;
unsigned int CmtBufSize;
unsigned int CmtSize;
unsigned int CmtState;
unsigned int Flags;
unsigned int Reserved[32];
};
Structure fields:
ArcNameW
Input parameter which should point to zero terminated Unicode string
containing the archive name or NULL if Unicode name is not specified.
Flags
Output parameter. Combination of bit flags.
Possible values
0x0001 - Volume attribute (archive volume)
0x0002 - Archive comment present
0x0004 - Archive lock attribute
0x0008 - Solid attribute (solid archive)
0x0010 - New volume naming scheme ('volname.partN.rar')
0x0020 - Authenticity information present
0x0040 - Recovery record present
0x0080 - Block headers are encrypted
0x0100 - First volume (set only by RAR 3.0 and later)
Reserved[32]
Reserved for future use. Must be zero.
Information on other structure fields and function return values
is available above, in RAROpenArchive function description.
====================================================================
int PASCAL RARCloseArchive(HANDLE hArcData)
====================================================================
Description
~~~~~~~~~~~
Close RAR archive and release allocated memory. It must be called when
archive processing is finished, even if the archive processing was stopped
due to an error.
Parameters
~~~~~~~~~~
hArcData
This parameter should contain the archive handle obtained from the
RAROpenArchive function call.
Return values
~~~~~~~~~~~~~
0 Success
ERAR_ECLOSE Archive close error
====================================================================
int PASCAL RARReadHeader(HANDLE hArcData,
struct RARHeaderData *HeaderData)
====================================================================
Description
~~~~~~~~~~~
Read header of file in archive.
Parameters
~~~~~~~~~~
hArcData
This parameter should contain the archive handle obtained from the
RAROpenArchive function call.
HeaderData
It should point to RARHeaderData structure:
struct RARHeaderData
{
char ArcName[260];
char FileName[260];
UINT Flags;
UINT PackSize;
UINT UnpSize;
UINT HostOS;
UINT FileCRC;
UINT FileTime;
UINT UnpVer;
UINT Method;
UINT FileAttr;
char *CmtBuf;
UINT CmtBufSize;
UINT CmtSize;
UINT CmtState;
};
Structure fields:
ArcName
Output parameter which contains a zero terminated string of the
current archive name. May be used to determine the current volume
name.
FileName
Output parameter which contains a zero terminated string of the
file name in OEM (DOS) encoding.
Flags
Output parameter which contains file flags:
0x01 - file continued from previous volume
0x02 - file continued on next volume
0x04 - file encrypted with password
0x08 - file comment present
0x10 - compression of previous files is used (solid flag)
bits 7 6 5
0 0 0 - dictionary size 64 Kb
0 0 1 - dictionary size 128 Kb
0 1 0 - dictionary size 256 Kb
0 1 1 - dictionary size 512 Kb
1 0 0 - dictionary size 1024 Kb
1 0 1 - dictionary size 2048 KB
1 1 0 - dictionary size 4096 KB
1 1 1 - file is directory
Other bits are reserved.
PackSize
Output parameter means packed file size or size of the
file part if file was split between volumes.
UnpSize
Output parameter - unpacked file size.
HostOS
Output parameter - operating system used for archiving:
0 - MS DOS;
1 - OS/2.
2 - Win32
3 - Unix
FileCRC
Output parameter which contains unpacked file CRC. It should not be
used for file parts which were split between volumes.
FileTime
Output parameter - contains date and time in standard MS DOS format.
UnpVer
Output parameter - RAR version needed to extract file.
It is encoded as 10 * Major version + minor version.
Method
Output parameter - packing method.
FileAttr
Output parameter - file attributes.
CmtBuf
File comments support is not implemented in the new DLL version yet.
Now CmtState is always 0.
/*
* Input parameter which should point to the buffer for file
* comments. Maximum comment size is limited to 64Kb. Comment text is
* a zero terminated string in OEM encoding. If the comment text is
* larger than the buffer size, the comment text will be truncated.
* If CmtBuf is set to NULL, comments will not be read.
*/
CmtBufSize
Input parameter which should contain size of buffer for archive
comments.
CmtSize
Output parameter containing size of comments actually read into the
buffer, should not exceed CmtBufSize.
CmtState
Output parameter.
Possible values
0 Absent comments
1 Comments read completely
ERAR_NO_MEMORY Not enough memory to extract comments
ERAR_BAD_DATA Broken comment
ERAR_UNKNOWN_FORMAT Unknown comment format
ERAR_SMALL_BUF Buffer too small, comments not completely read
Return values
~~~~~~~~~~~~~
0 Success
ERAR_END_ARCHIVE End of archive
ERAR_BAD_DATA File header broken
====================================================================
int PASCAL RARReadHeaderEx(HANDLE hArcData,
struct RARHeaderDataEx *HeaderData)
====================================================================
Description
~~~~~~~~~~~
Similar to RARReadHeader, but uses RARHeaderDataEx structure,
containing information about Unicode file names and 64 bit file sizes.
struct RARHeaderDataEx
{
char ArcName[1024];
wchar_t ArcNameW[1024];
char FileName[1024];
wchar_t FileNameW[1024];
unsigned int Flags;
unsigned int PackSize;
unsigned int PackSizeHigh;
unsigned int UnpSize;
unsigned int UnpSizeHigh;
unsigned int HostOS;
unsigned int FileCRC;
unsigned int FileTime;
unsigned int UnpVer;
unsigned int Method;
unsigned int FileAttr;
char *CmtBuf;
unsigned int CmtBufSize;
unsigned int CmtSize;
unsigned int CmtState;
unsigned int Reserved[1024];
};
====================================================================
int PASCAL RARProcessFile(HANDLE hArcData,
int Operation,
char *DestPath,
char *DestName)
====================================================================
Description
~~~~~~~~~~~
Performs action and moves the current position in the archive to
the next file. Extract or test the current file from the archive
opened in RAR_OM_EXTRACT mode. If the mode RAR_OM_LIST is set,
then a call to this function will simply skip the archive position
to the next file.
Parameters
~~~~~~~~~~
hArcData
This parameter should contain the archive handle obtained from the
RAROpenArchive function call.
Operation
File operation.
Possible values
RAR_SKIP Move to the next file in the archive. If the
archive is solid and RAR_OM_EXTRACT mode was set
when the archive was opened, the current file will
be processed - the operation will be performed
slower than a simple seek.
RAR_TEST Test the current file and move to the next file in
the archive. If the archive was opened with
RAR_OM_LIST mode, the operation is equal to
RAR_SKIP.
RAR_EXTRACT Extract the current file and move to the next file.
If the archive was opened with RAR_OM_LIST mode,
the operation is equal to RAR_SKIP.
DestPath
This parameter should point to a zero terminated string containing the
destination directory to which to extract files to. If DestPath is equal
to NULL, it means extract to the current directory. This parameter has
meaning only if DestName is NULL.
DestName
This parameter should point to a string containing the full path and name
of the file to be extracted or NULL as default. If DestName is defined
(not NULL) it overrides the original file name saved in the archive and
DestPath setting.
Both DestPath and DestName must be in OEM encoding. If necessary,
use CharToOem to convert text to OEM before passing to this function.
Return values
~~~~~~~~~~~~~
0 Success
ERAR_BAD_DATA File CRC error
ERAR_BAD_ARCHIVE Volume is not valid RAR archive
ERAR_UNKNOWN_FORMAT Unknown archive format
ERAR_EOPEN Volume open error
ERAR_ECREATE File create error
ERAR_ECLOSE File close error
ERAR_EREAD Read error
ERAR_EWRITE Write error
Note: if you wish to cancel extraction, return -1 when processing
UCM_PROCESSDATA callback message.
====================================================================
int PASCAL RARProcessFileW(HANDLE hArcData,
int Operation,
wchar_t *DestPath,
wchar_t *DestName)
====================================================================
Description
~~~~~~~~~~~
Unicode version of RARProcessFile. It uses Unicode DestPath
and DestName parameters, other parameters and return values
are the same as in RARProcessFile.
====================================================================
void PASCAL RARSetCallback(HANDLE hArcData,
int PASCAL (*CallbackProc)(UINT msg,LONG UserData,LONG P1,LONG P2),
LONG UserData);
====================================================================
Description
~~~~~~~~~~~
Set a user-defined callback function to process Unrar events.
Parameters
~~~~~~~~~~
hArcData
This parameter should contain the archive handle obtained from the
RAROpenArchive function call.
CallbackProc
It should point to a user-defined callback function.
The function will be passed four parameters:
msg Type of event. Described below.
UserData User defined value passed to RARSetCallback.
P1 and P2 Event dependent parameters. Described below.
Possible events
UCM_CHANGEVOLUME Process volume change.
P1 Points to the zero terminated name
of the next volume.
P2 The function call mode:
RAR_VOL_ASK Required volume is absent. The function should
prompt user and return a positive value
to retry or return -1 value to terminate
operation. The function may also specify a new
volume name, placing it to the address specified
by P1 parameter.
RAR_VOL_NOTIFY Required volume is successfully opened.
This is a notification call and volume name
modification is not allowed. The function should
return a positive value to continue or -1
to terminate operation.
UCM_PROCESSDATA Process unpacked data. It may be used to read
a file while it is being extracted or tested
without actual extracting file to disk.
Return a positive value to continue process
or -1 to cancel the archive operation
P1 Address pointing to the unpacked data.
Function may refer to the data but must not
change it.
P2 Size of the unpacked data. It is guaranteed
only that the size will not exceed the maximum
dictionary size (4 Mb in RAR 3.0).
UCM_NEEDPASSWORD DLL needs a password to process archive.
This message must be processed if you wish
to be able to handle archives with encrypted
file names. It can be also used as replacement
of RARSetPassword function even for usual
encrypted files with non-encrypted names.
P1 Address pointing to the buffer for a password.
You need to copy a password here.
P2 Size of the password buffer.
UserData
User data passed to callback function.
Other functions of UNRAR.DLL should not be called from the callback
function.
Return values
~~~~~~~~~~~~~
None
====================================================================
void PASCAL RARSetChangeVolProc(HANDLE hArcData,
int PASCAL (*ChangeVolProc)(char *ArcName,int Mode));
====================================================================
Obsoleted, use RARSetCallback instead.
====================================================================
void PASCAL RARSetProcessDataProc(HANDLE hArcData,
int PASCAL (*ProcessDataProc)(unsigned char *Addr,int Size))
====================================================================
Obsoleted, use RARSetCallback instead.
====================================================================
void PASCAL RARSetPassword(HANDLE hArcData,
char *Password);
====================================================================
Description
~~~~~~~~~~~
Set a password to decrypt files.
Parameters
~~~~~~~~~~
hArcData
This parameter should contain the archive handle obtained from the
RAROpenArchive function call.
Password
It should point to a string containing a zero terminated password.
Return values
~~~~~~~~~~~~~
None
====================================================================
void PASCAL RARGetDllVersion();
====================================================================
Description
~~~~~~~~~~~
Returns unrar.dll version.
Parameters
~~~~~~~~~~
None.
Return values
~~~~~~~~~~~~~
Returns an integer value denoting DLL version. The current version value
is defined in unrar.h as RAR_DLL_VERSION
This function is absent in old versions of unrar.dll, so it may be wise
to use LoadLibrary and GetProcAddress to access this function.

View File

@@ -0,0 +1,373 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include <map>
#include "NstIoLog.hpp"
#include "NstIoStream.hpp"
#include "NstWindowUser.hpp"
#include "NstApplicationInstance.hpp"
#include "../core/NstXml.hpp"
namespace Nestopia
{
namespace Application
{
struct Configuration::Node
{
Node();
typedef Nes::Core::Xml Xml;
Node& Get(const HeapString&);
const Node* Find(cstring) const;
void Load(Xml::Node);
void Save(Xml::Node,wcstring=NULL) const;
void CheckReference(wcstring) const;
typedef HeapString Key;
typedef std::multimap<Key,Node> Map;
Map map;
HeapString string;
struct
{
Map* map;
Map::iterator item;
} parent;
mutable bool referenced;
};
Configuration::Configuration()
: root(*new Node), save(false)
{
//const Path path( Instance::GetExePath(L"nestopia.xml") );
const Path path( Instance::GetConfigPath(L"nestopia.xml") ); //bg
if (path.FileExists())
{
try
{
Nes::Core::Xml xml;
{
Io::Stream::In file( path );
xml.Read( file );
}
if (!xml.GetRoot().IsType( L"configuration" ))
throw 1;
if (HeapString(Instance::GetVersion()) != xml.GetRoot().GetAttribute(L"version").GetValue())
Window::User::Warn( L"The configuration file is old and may not work reliably with this version of Nestopia!", L"Configuration file version conflict!" );
root.Load( xml.GetRoot().GetFirstChild() );
}
catch (...)
{
Reset( false );
Window::User::Warn( L"Configuration file load error! Default settings will be used!" );
}
}
if (wcstring ptr = ::GetCommandLine())
{
for (uint quote=0; (*ptr > ' ') || (*ptr && quote); ++ptr)
{
if (*ptr == '\"')
quote ^= 1;
}
while (*ptr && *ptr <= ' ')
++ptr;
if (*ptr)
{
if (*ptr != '-')
{
wcstring const offset = ptr;
for (uint quote=0; (*ptr > ' ') || (*ptr && quote); ++ptr)
{
if (*ptr == '\"')
quote ^= 1;
}
startupFile.Assign( offset, ptr - offset );
startupFile.Remove( '\"' );
startupFile.Trim();
// Win98/ME/2k fix
if (startupFile.Length())
startupFile = Instance::GetLongPath( startupFile.Ptr() );
}
}
}
}
Configuration::~Configuration()
{
if (save)
{
try
{
Nes::Core::Xml xml;
xml.Create( L"configuration" ).AddAttribute( L"version", HeapString(Instance::GetVersion()).Ptr() );
root.Save( xml.GetRoot() );
//Io::Stream::Out file( Instance::GetExePath(L"nestopia.xml") );
Io::Stream::Out file( Instance::GetConfigPath(L"nestopia.xml") );//bg
xml.Write( xml.GetRoot(), file );
}
catch (...)
{
Window::User::Warn( L"Couldn't save the configuration!" );
}
}
delete &root;
}
void Configuration::Reset(bool notify)
{
if (notify)
root.CheckReference( L"" );
root.map.clear();
}
void Configuration::EnableSaving(bool enable)
{
save = enable;
}
const Path& Configuration::GetStartupFile() const
{
return startupFile;
}
Configuration::ConstSection Configuration::operator [] (cstring key) const
{
return root.Find( key );
}
Configuration::Section Configuration::operator [] (cstring key)
{
return &root.Get( key );
}
Configuration::ConstSection Configuration::ConstSection::operator [] (cstring key) const
{
return node ? node->Find( key ) : NULL;
}
Configuration::ConstSection Configuration::ConstSection::operator [] (uint i) const
{
if (node)
{
if (i)
{
Node::Map::iterator it( node->parent.item );
while (++it != node->parent.map->end() && it->first == node->parent.item->first)
{
if (!--i)
{
it->second.referenced = true;
return &it->second;
}
}
}
else
{
return *this;
}
}
return NULL;
}
Configuration::Section Configuration::Section::operator [] (cstring key)
{
return &node->Get( key );
}
Configuration::Section Configuration::Section::operator [] (uint i)
{
if (i)
{
Node::Map::iterator it( node->parent.item );
while (++it != node->parent.map->end() && it->first == node->parent.item->first)
{
if (!--i)
return &it->second;
}
const Node::Map::value_type item( node->parent.item->first,Node() );
do
{
it = node->parent.map->insert( it, item );
it->second.parent.map = node->parent.map;
it->second.parent.item = it;
}
while (--i);
return &it->second;
}
else
{
return *this;
}
}
HeapString& Configuration::Section::Str()
{
return node->string;
}
GenericString Configuration::ConstSection::Str() const
{
return node ? GenericString(node->string) : GenericString();
}
ulong Configuration::ConstSection::Int() const
{
ulong i;
return node && (node->string >> i) ? i : 0;
}
ulong Configuration::ConstSection::Int(ulong d) const
{
ulong i;
return node && (node->string >> i) ? i : d;
}
void Configuration::Section::IntProxy::operator = (ulong i)
{
node.string << i;
}
void Configuration::Section::YesNoProxy::operator = (bool yes)
{
node.string.Assign( yes ? L"yes" : L"no", yes ? 3 : 2 );
}
bool Configuration::ConstSection::Yes() const
{
return node && node->string == L"yes";
}
bool Configuration::ConstSection::No() const
{
return node && node->string == L"no";
}
Configuration::Node::Node()
: referenced(false) {}
Configuration::Node& Configuration::Node::Get(const HeapString& key)
{
Map::iterator it(map.lower_bound( key ));
if (it == map.end() || it->first != key)
{
it = map.insert( it, Map::value_type(key,Node()) );
it->second.parent.map = &map;
it->second.parent.item = it;
}
return it->second;
}
const Configuration::Node* Configuration::Node::Find(cstring key) const
{
Map::const_iterator it(map.find( key ));
if (it != map.end())
{
it->second.referenced = true;
return &it->second;
}
return NULL;
}
void Configuration::Node::Load(Xml::Node xmlNode)
{
do
{
Map::iterator it(map.insert( Map::value_type(xmlNode.GetType(),Node()) ));
it->second.parent.map = &map;
it->second.parent.item = it;
if (const Xml::Node xmlChild=xmlNode.GetFirstChild())
it->second.Load( xmlChild );
else
it->second.string = xmlNode.GetValue();
xmlNode = xmlNode.GetNextSibling();
}
while (xmlNode);
}
void Configuration::Node::Save(Xml::Node node,wcstring const key) const
{
NST_ASSERT( node && (!key || *key) );
if (map.empty())
{
if (key)
node.AddChild( key, string.Ptr() );
}
else
{
if (key)
node = node.AddChild( key );
for (Map::const_iterator it(map.begin()), end(map.end()); it != end; ++it)
it->second.Save( node, it->first.Ptr() );
}
}
void Configuration::Node::CheckReference(wcstring const key) const
{
NST_ASSERT( key );
if (map.empty())
{
if (*key && !referenced)
Io::Log() << "Configuration: warning, unused/invalid parameter: \"" << key << "\"\r\n";
}
else for (Map::const_iterator it(map.begin()), end(map.end()); it != end; ++it)
{
it->second.CheckReference( it->first.Ptr() );
}
}
}
}

View File

@@ -0,0 +1,144 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_APPLICATION_CONFIGURATION_H
#define NST_APPLICATION_CONFIGURATION_H
#pragma once
#include "NstString.hpp"
namespace Nestopia
{
namespace Application
{
class Configuration
{
struct Node;
public:
Configuration();
~Configuration();
void Reset(bool=true);
void EnableSaving(bool=true);
const Path& GetStartupFile() const;
class ConstSection : public ImplicitBool<ConstSection>
{
public:
ConstSection operator [] (cstring) const;
ConstSection operator [] (uint) const;
GenericString Str() const;
ulong Int() const;
ulong Int(ulong) const;
bool Yes() const;
bool No() const;
private:
const Node* node;
public:
ConstSection(const Node* n)
: node(n) {}
bool operator ! () const
{
return !node;
}
};
class Section
{
public:
Section operator [] (cstring);
Section operator [] (uint);
HeapString& Str();
private:
Node* node;
class IntProxy
{
Node& node;
public:
IntProxy(Node& n)
: node(n) {}
void operator = (ulong);
};
class YesNoProxy
{
Node& node;
public:
YesNoProxy(Node& n)
: node(n) {}
void operator = (bool);
};
public:
Section(Node* n)
: node(n) {}
IntProxy Int()
{
return *node;
}
YesNoProxy YesNo()
{
return *node;
}
};
Section operator [] (cstring);
ConstSection operator [] (cstring) const;
private:
Node& root;
bool save;
Path startupFile;
};
}
}
#endif

View File

@@ -0,0 +1,72 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include <cstdlib>
#include "NstString.hpp"
#include "NstResourceString.hpp"
#include "NstWindowUser.hpp"
#include "NstApplicationException.hpp"
namespace Nestopia
{
namespace Application
{
int Exception::Issue() const
{
try
{
if (id)
{
Resource::String string( id );
if (string.Length())
{
if (msg)
string.Invoke( msg );
Window::User::Fail( string.Ptr() );
}
else
{
throw 1;
}
}
else if (msg)
{
Window::User::Fail( msg );
}
else
{
return EXIT_SUCCESS;
}
}
catch (...)
{
Window::User::Fail( L"Unhandled error! Call the Ghostbusters!" );
}
return EXIT_FAILURE;
}
}
}

View File

@@ -0,0 +1,59 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_APPLICATION_EXCEPTION_H
#define NST_APPLICATION_EXCEPTION_H
#pragma once
#include "NstMain.hpp"
namespace Nestopia
{
namespace Application
{
class Exception
{
wcstring const msg;
const uint id;
public:
explicit Exception(wcstring string)
: msg(string), id(0) {}
explicit Exception(uint i=0,wcstring string=NULL)
: msg(string), id(i) {}
wcstring GetMsg() const
{
return msg;
}
int Issue() const;
};
}
}
#endif

View File

@@ -0,0 +1,536 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "language/resource.h"
#include "NstResourceCursor.hpp"
#include "NstResourceVersion.hpp"
#include "NstApplicationException.hpp"
#include "NstApplicationLanguage.hpp"
#include <CommCtrl.h>
#include <ObjBase.h>
#include <Shlobj.h>
#include <Shellapi.h>
#if NST_MSVC
#pragma comment(lib,"comctl32")
#endif
namespace Nestopia
{
namespace Application
{
const wchar_t Instance::appClassName[] = L"Nestopia";
struct Instance::Global
{
Global();
struct Paths
{
explicit Paths(HINSTANCE);
Path exePath;
Path wrkPath;
Path configPath;//bg configuration files path
};
struct Hooks
{
explicit Hooks(HINSTANCE);
~Hooks();
void OnCreate(const CREATESTRUCT&,HWND);
void OnDestroy(HWND);
static LRESULT CALLBACK CBTProc(int,WPARAM,LPARAM);
enum
{
CHILDREN_RESERVE = 8
};
typedef Collection::Vector<HWND> Children;
HHOOK const handle;
HWND window;
Children children;
};
const Paths paths;
const Resource::Version version;
Language language;
Hooks hooks;
IconStyle iconStyle;
};
Instance::Global Instance::global;
Instance::Events::Callbacks Instance::Events::callbacks;
Instance::Global::Paths::Paths(HINSTANCE const hInstance)
{
uint length;
do
{
exePath.Reserve( exePath.Capacity() + 255 );
length = ::GetModuleFileName( hInstance, exePath.Ptr(), exePath.Capacity() );
}
while (length == exePath.Capacity());
exePath.ShrinkTo( length );
exePath.MakePretty( false );
exePath.Defrag();
wrkPath = ".";
wrkPath.MakeAbsolute( true );
wrkPath.Defrag();
configPath.Reserve(configPath.Capacity() + 255);//bg
//bg
bool isLua = false;
//bg check -lua between command line options
int nArgs;
LPWSTR *szArglist = ::CommandLineToArgvW(::GetCommandLineW(), &nArgs);
if( szArglist != NULL) {
for(int i=0; i<nArgs; i++) {
isLua = ::wcscmp(szArglist[i],L"-lua") == 0;
if (isLua) break;
}
::LocalFree(szArglist);
}
//bg END check
//bg set configPath
if(isLua &&
SUCCEEDED(SHGetFolderPath(NULL,
CSIDL_LOCAL_APPDATA|CSIDL_FLAG_CREATE,
NULL,
0,
configPath.Ptr()))) {
configPath.ShrinkTo( std::wcslen(configPath.Ptr()) );
configPath.MakePretty( false );
configPath.Append (L"\\Nestopia",9);
configPath.MakePretty( false );
configPath.Defrag();
::CreateDirectory(configPath.Ptr(), NULL);
}
else {
::GetModuleFileName( hInstance, configPath.Ptr(), configPath.Capacity() );
configPath.ShrinkTo(configPath.FindLastOf('\\',configPath.Capacity()));//bg fix issue #265
};
configPath.Defrag();
}
Instance::Global::Hooks::Hooks(HINSTANCE const hInstance)
: handle(::SetWindowsHookEx( WH_CBT, CBTProc, hInstance, ::GetCurrentThreadId() ))
{
children.Reserve( CHILDREN_RESERVE );
}
Instance::Global::Hooks::~Hooks()
{
if (handle)
::UnhookWindowsHookEx( handle );
}
#ifdef NST_MSVC_OPTIMIZE
#pragma optimize("t", on)
#endif
void Instance::Global::Hooks::OnCreate(const CREATESTRUCT& createStruct,HWND const hWnd)
{
NST_ASSERT( hWnd );
if (window == createStruct.hwndParent || !window)
{
{
static const wchar_t menuClassName[] = L"#32768"; // documented on MSDN
enum
{
MAX_LENGTH = NST_MAX( sizeof(array(appClassName)) - 1,
NST_MAX( sizeof(array(STATUSCLASSNAME)) - 1, sizeof(array(menuClassName)) - 1 ))
};
String::Stack<MAX_LENGTH,wchar_t> name;
name.ShrinkTo( ::GetClassName( hWnd, name.Ptr(), MAX_LENGTH+1 ) );
if (name.Equal( menuClassName ) || name.Equal( STATUSCLASSNAME ) || name.Equal( L"IME" ))
return;
if (window)
{
children.PushBack( hWnd );
Events::Signal( EVENT_SYSTEM_BUSY );
}
else if (name.Equal( appClassName ))
{
window = hWnd;
}
else
{
return;
}
}
const Events::WindowCreateParam param =
{
hWnd,
createStruct.cx > 0 ? createStruct.cx : 0,
createStruct.cy > 0 ? createStruct.cy : 0
};
Events::Signal( EVENT_WINDOW_CREATE, &param );
}
}
void Instance::Global::Hooks::OnDestroy(HWND const hWnd)
{
NST_ASSERT( hWnd );
Children::Iterator const child = children.Find( hWnd );
if (child)
{
Events::Signal( EVENT_SYSTEM_BUSY );
}
else if (window != hWnd)
{
return;
}
{
const Events::WindowDestroyParam param = { hWnd };
Events::Signal( EVENT_WINDOW_DESTROY, &param );
}
if (child)
children.Erase( child );
else
window = NULL;
}
LRESULT CALLBACK Instance::Global::Hooks::CBTProc(const int nCode,const WPARAM wParam,const LPARAM lParam)
{
NST_COMPILE_ASSERT( HCBT_CREATEWND >= 0 && HCBT_DESTROYWND >= 0 );
switch (nCode)
{
case HCBT_CREATEWND:
NST_ASSERT( lParam );
if (const CREATESTRUCT* const createStruct = reinterpret_cast<const CBT_CREATEWND*>(lParam)->lpcs)
{
NST_VERIFY( wParam );
global.hooks.OnCreate( *createStruct, reinterpret_cast<HWND>(wParam) );
}
return 0;
case HCBT_DESTROYWND:
NST_VERIFY( wParam );
if (wParam)
global.hooks.OnDestroy( reinterpret_cast<HWND>(wParam) );
return 0;
}
return nCode < 0 ? ::CallNextHookEx( global.hooks.handle, nCode, wParam, lParam ) : 0;
}
#ifdef NST_MSVC_OPTIMIZE
#pragma optimize("", on)
#endif
Instance::Global::Global()
:
paths ( ::GetModuleHandle(NULL) ),
version ( paths.exePath.Ptr(), Resource::Version::PRODUCT ),
hooks ( ::GetModuleHandle(NULL) ),
iconStyle ( ICONSTYLE_NES )
{
}
Instance::Language& Instance::GetLanguage()
{
return global.language;
}
const String::Heap<char>& Instance::GetVersion()
{
return global.version;
}
const Path& Instance::GetExePath()
{
return global.paths.exePath;
}
const Path Instance::GetExePath(const GenericString file)
{
return Path( global.paths.exePath.Directory(), file );
}
const Path Instance::GetConfigPath(const GenericString file)//bg
{
return Path( global.paths.configPath, file );
}
const Path Instance::GetFullPath(const GenericString relPath)
{
Path curPath( "." );
curPath.MakeAbsolute( true );
const BOOL succeeded = ::SetCurrentDirectory( global.paths.wrkPath.Ptr() );
Path wrkPath( relPath );
wrkPath.MakeAbsolute();
if (succeeded)
::SetCurrentDirectory( curPath.Ptr() );
return wrkPath;
}
const Path Instance::GetLongPath(wcstring const shortPath)
{
Path longPath;
longPath.Reserve( 255 );
uint length = ::GetLongPathName( shortPath, longPath.Ptr(), longPath.Capacity() + 1 );
if (length > longPath.Capacity() + 1)
{
longPath.Reserve( length - 1 );
length = ::GetLongPathName( shortPath, longPath.Ptr(), longPath.Capacity() + 1 );
}
if (!length)
return shortPath;
const wchar_t slashed = GenericString(shortPath).Back();
longPath.ShrinkTo( length );
longPath.MakePretty( slashed == '\\' || slashed == '/' );
return longPath;
}
const Path Instance::GetTmpPath(GenericString file)
{
Path path;
path.Reserve( 255 );
if (uint length = ::GetTempPath( path.Capacity() + 1, path.Ptr() ))
{
if (length > path.Capacity() + 1)
{
path.Reserve( length - 1 );
length = ::GetTempPath( path.Capacity() + 1, path.Ptr() );
}
if (length)
path = GetLongPath( path.Ptr() );
}
if (path.Length())
path.MakePretty( true );
else
path << ".\\";
if (file.Empty())
file = L"nestopia.tmp";
path << file;
return path;
}
Instance::Events::Callbacks::~Callbacks()
{
NST_VERIFY( Empty() );
}
void Instance::Events::Add(const Callback& callback)
{
NST_ASSERT( bool(callback) && !callbacks.Find( callback ) );
callbacks.PushBack( callback );
}
void Instance::Events::Signal(const Event event,const void* param)
{
for (Callbacks::ConstIterator it(callbacks.Begin()), end(callbacks.End()); it != end; ++it)
(*it)( event, param );
}
void Instance::Events::Remove(const void* const instance)
{
for (Callbacks::Iterator it(callbacks.Begin()); it != callbacks.End(); ++it)
{
if (it->VoidPtr() == instance)
{
callbacks.Erase( it );
break;
}
}
}
Window::Generic Instance::GetMainWindow()
{
return global.hooks.window;
}
uint Instance::NumChildWindows()
{
return global.hooks.children.Size();
}
Window::Generic Instance::GetChildWindow(uint i)
{
return global.hooks.children[i];
}
Window::Generic Instance::GetActiveWindow()
{
HWND hWnd = ::GetActiveWindow();
return hWnd ? hWnd : global.hooks.window;
}
Instance::IconStyle Instance::GetIconStyle()
{
return global.iconStyle;
}
void Instance::SetIconStyle(IconStyle style)
{
global.iconStyle = style;
}
void Instance::ShowChildWindows(bool show)
{
const uint state = (show ? SW_SHOWNA : SW_HIDE);
for (Global::Hooks::Children::ConstIterator it(global.hooks.children.Begin()), end(global.hooks.children.End()); it != end; ++it)
::ShowWindow( *it, state );
}
Instance::Waiter::Waiter()
: hCursor(::SetCursor(Resource::Cursor::GetWait())) {}
Instance::Locker::Locker()
: hWnd(GetMainWindow()), enabled(::IsWindowEnabled(hWnd))
{
::EnableWindow( hWnd, false );
::LockWindowUpdate( hWnd );
}
bool Instance::Locker::CheckInput(int vKey) const
{
if (::GetAsyncKeyState( vKey ) & 0x8000U)
{
while (::GetAsyncKeyState( vKey ) & 0x8000U)
::Sleep( 10 );
return true;
}
return false;
}
Instance::Locker::~Locker()
{
::LockWindowUpdate( NULL );
::EnableWindow( hWnd, enabled );
for (MSG msg;::PeekMessage( &msg, NULL, 0, 0, PM_REMOVE|PM_QS_INPUT ););
}
Instance::Instance()
{
if (!static_cast<const Configuration&>(cfg)["preferences"]["application"]["allow-multiple-instances"].Yes())
{
::CreateMutex( NULL, true, L"Nestopia Mutex" );
if (::GetLastError() == ERROR_ALREADY_EXISTS)
{
if (Window::Generic window = Window::Generic::Find( appClassName ))
{
window.Activate();
if (const uint length = cfg.GetStartupFile().Length())
{
COPYDATASTRUCT cds;
cds.dwData = COPYDATA_OPENFILE_ID;
cds.cbData = (length + 1) * sizeof(wchar_t);
cds.lpData = const_cast<wchar_t*>(cfg.GetStartupFile().Ptr());
window.Send( WM_COPYDATA, 0, &cds );
}
}
throw Exception();
}
}
if (global.paths.exePath.Empty())
throw Exception( L"unicows.dll file is missing!" );
global.language.Load( cfg );
if (global.hooks.handle == NULL)
throw Exception( IDS_ERR_FAILED, L"SetWindowsHookEx()" );
if (FAILED(::CoInitializeEx( NULL, COINIT_APARTMENTTHREADED )))
throw Exception( IDS_ERR_FAILED, L"CoInitializeEx()" );
Object::Pod<INITCOMMONCONTROLSEX> initCtrlEx;
initCtrlEx.dwSize = sizeof(initCtrlEx);
initCtrlEx.dwICC = ICC_WIN95_CLASSES;
::InitCommonControlsEx( &initCtrlEx );
}
Instance::~Instance()
{
::CoUninitialize();
}
void Instance::Save()
{
global.language.Save( cfg );
}
}
}

View File

@@ -0,0 +1,183 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_APPLICATION_INSTANCE_H
#define NST_APPLICATION_INSTANCE_H
#pragma once
#include "NstObjectDelegate.hpp"
#include "NstCollectionVector.hpp"
#include "NstApplicationConfiguration.hpp"
#include "NstWindowGeneric.hpp"
namespace Nestopia
{
namespace Application
{
class Instance
{
public:
Instance();
~Instance();
void Save();
static const Path& GetExePath();
static const Path GetExePath(const GenericString);
static const Path GetConfigPath(const GenericString);//bg
static const Path GetLongPath(wcstring);
static const Path GetTmpPath(GenericString=GenericString());
static const Path GetFullPath(const GenericString);
static const String::Heap<char>& GetVersion();
static uint NumChildWindows();
static void ShowChildWindows(bool=true);
static Window::Generic GetChildWindow(uint=0);
static Window::Generic GetMainWindow();
static Window::Generic GetActiveWindow();
class Language;
static Language& GetLanguage();
enum IconStyle
{
ICONSTYLE_NES,
ICONSTYLE_FAMICOM
};
static IconStyle GetIconStyle();
static void SetIconStyle(IconStyle);
enum
{
WM_NST_COMMAND_RESUME = WM_APP + 55,
WM_NST_LAUNCH = WM_APP + 56,
COPYDATA_OPENFILE_ID = 0xDEAF
};
enum Event
{
EVENT_WINDOW_CREATE = 1,
EVENT_WINDOW_DESTROY,
EVENT_SYSTEM_BUSY,
EVENT_FULLSCREEN,
EVENT_DESKTOP
};
class Events
{
public:
struct WindowCreateParam
{
HWND hWnd;
uint x;
uint y;
};
struct WindowDestroyParam
{
HWND hWnd;
};
private:
typedef Object::Delegate<void,Event,const void*> Callback;
struct Callbacks : Collection::Vector<Callback>
{
~Callbacks();
};
static void Add(const Callback&);
static Callbacks callbacks;
public:
static void Remove(const void*);
static void Signal(Event,const void* = NULL);
template<typename Data,typename Code>
static void Add(Data* data,Code code)
{
Add( Callback(data,code) );
}
};
private:
Configuration cfg;
struct Global;
static Global global;
static const wchar_t appClassName[];
public:
Configuration& GetConfiguration2()
{
return cfg;
}
static wcstring GetClassName()
{
return appClassName;
}
class Waiter
{
HCURSOR const hCursor;
public:
Waiter();
~Waiter()
{
::SetCursor( hCursor );
}
};
class Locker
{
HWND const hWnd;
const bool enabled;
public:
Locker();
~Locker();
bool CheckInput(int) const;
};
};
}
}
#endif

View File

@@ -0,0 +1,130 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstApplicationException.hpp"
#include "NstApplicationLanguage.hpp"
namespace Nestopia
{
namespace Application
{
bool Instance::Language::Resource::Load(wcstring const p)
{
if (!Dll::Load( p ))
return false;
path = p;
return true;
}
void Instance::Language::Load(const Configuration& cfg)
{
if (!resource)
Load( cfg["language"]["file"].Str().Ptr() );
}
void Instance::Language::Save(Configuration& cfg) const
{
if (resource.path.Length())
cfg["language"]["file"].Str() = resource.path;
}
void Instance::Language::Load(wcstring const path)
{
if (!path || !*path)
{
Paths paths;
EnumerateResources( paths );
if (paths.empty())
throw Exception( L"language\\english.nlg file not found!" );
Paths::const_iterator it( paths.begin() );
for (Paths::const_iterator end(paths.end()); it != end; ++it)
{
if (it->File() == L"english.nlg")
break;
}
if (it == paths.end())
it = paths.begin();
if (!resource.Load( it->Ptr() ))
throw Exception( L"Failed to load language plugin file!" );
}
else if (!resource.Load( path ))
{
Load( NULL );
}
}
void Instance::Language::UpdateResource(wcstring const update)
{
NST_ASSERT( update );
resource.path = update;
}
void Instance::Language::EnumerateResources(Paths& paths) const
{
for (uint i=0; i < 2 && paths.empty(); ++i)
{
struct FileFinder
{
WIN32_FIND_DATA data;
HANDLE const handle;
FileFinder(wcstring const path)
: handle(::FindFirstFile( path, &data )) {}
~FileFinder()
{
if (handle != INVALID_HANDLE_VALUE)
::FindClose( handle );
}
};
Path path( Instance::GetExePath(i ? L"*.*" : L"language\\*.*") );
FileFinder findFile( path.Ptr() );
if (findFile.handle != INVALID_HANDLE_VALUE)
{
do
{
if (!(findFile.data.dwFileAttributes & (FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_DIRECTORY)))
{
path.File() = findFile.data.cFileName;
if (path.Extension() == L"nlg")
paths.push_back( path );
}
}
while (::FindNextFile( findFile.handle, &findFile.data ));
}
}
}
}
}

View File

@@ -0,0 +1,78 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_APPLICATION_LANGUAGE_H
#define NST_APPLICATION_LANGUAGE_H
#pragma once
#include <vector>
#include "NstSystemDll.hpp"
#include "NstApplicationInstance.hpp"
namespace Nestopia
{
namespace Application
{
class Instance::Language
{
public:
void Load(const Configuration&);
void Save(Configuration&) const;
typedef std::vector<Path> Paths;
void UpdateResource(wcstring);
void EnumerateResources(Paths&) const;
private:
void Load(wcstring);
struct Resource : System::Dll
{
bool Load(wcstring);
Path path;
};
Resource resource;
public:
HMODULE GetResourceHandle() const
{
return resource.GetHandle();
}
const Path& GetResourcePath() const
{
return resource.path;
}
};
}
}
#endif

View File

@@ -0,0 +1,185 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstWindowUser.hpp"
#include "NstWindowParam.hpp"
#include "NstApplicationMain.hpp"
#include "../core/api/NstApiMachine.hpp"
namespace Nestopia
{
namespace Application
{
Main::Main(const int cmdShow)
:
menu ( IDR_MENU ),
preferences ( emulator, instance.GetConfiguration2(), menu ),
logfile ( emulator, menu, preferences ),
language ( emulator, menu ),
paths ( emulator, instance.GetConfiguration2(), menu ),
window ( emulator, instance.GetConfiguration2(), menu, paths, preferences, cmdShow ),
recentFiles ( emulator, instance.GetConfiguration2(), menu ),
recentDirs ( emulator, instance.GetConfiguration2(), menu ),
machine ( emulator, instance.GetConfiguration2(), menu, preferences ),
netplay ( emulator, instance.GetConfiguration2(), menu, paths, window.Get() ),
launcher ( emulator, instance.GetConfiguration2(), menu, paths, window.Get() ),
fds ( emulator, instance.GetConfiguration2(), menu, paths ),
tapeRecorder ( emulator, instance.GetConfiguration2(), menu, paths ),
dipSwitches ( emulator, instance.GetConfiguration2(), menu ),
barcodeReader ( emulator, menu ),
nsf ( emulator, instance.GetConfiguration2(), menu ),
movie ( emulator, menu, paths ),
cheats ( emulator, instance.GetConfiguration2(), menu, paths ),
saveStates ( emulator, menu, paths, window ),
imageDatabase ( emulator, instance.GetConfiguration2(), menu, paths ),
imageInfo ( emulator, menu ),
help ( emulator, menu ),
inesHeader ( emulator, menu, paths ),
files ( emulator, menu, paths, preferences, movie, tapeRecorder, cheats, saveStates, window )
{
static const Window::MsgHandler::Entry<Main> messages[] =
{
{ WM_CLOSE, &Main::OnWinClose },
{ WM_QUERYENDSESSION, &Main::OnWinQueryEndSession }
};
window.Get().Messages().Add( this, messages );
menu.Commands().Add( IDM_FILE_QUIT, this, &Main::OnCmdFileExit );
instance.GetConfiguration2().Reset();
if (instance.GetConfiguration2().GetStartupFile().Length())
window.Get().Send( Instance::WM_NST_LAUNCH, 0, instance.GetConfiguration2().GetStartupFile().Ptr() );
}
Main::~Main()
{
emulator.Unload();
menu.Commands().Remove( this );
window.Get().Messages().Remove( this );
}
void Main::Save()
{
Instance::Waiter waiter;
Configuration& cfg = instance.GetConfiguration2();
preferences.Save ( cfg );
recentFiles.Save ( cfg );
recentDirs.Save ( cfg );
paths.Save ( cfg );
imageDatabase.Save ( cfg );
launcher.Save ( cfg, preferences[Managers::Preferences::SAVE_LAUNCHERSIZE], preferences[Managers::Preferences::SAVE_LAUNCHER] );
netplay.Save ( cfg, preferences[Managers::Preferences::SAVE_NETPLAY_GAMELIST] );
fds.Save ( cfg );
dipSwitches.Save ( cfg );
tapeRecorder.Save ( cfg );
nsf.Save ( cfg );
window.Save ( cfg );
machine.Save ( cfg );
if (preferences[Managers::Preferences::SAVE_CHEATS])
cheats.Save( cfg );
if (preferences[Managers::Preferences::SAVE_SETTINGS])
cfg.EnableSaving();
instance.Save();
}
int Main::Run()
{
int exitCode = window.Run();
emulator.Unload();
if (exitCode == EXIT_SUCCESS)
Save();
return exitCode;
}
bool Main::FirstUnloadOnExit()
{
return
(
preferences[Managers::Preferences::FIRST_UNLOAD_ON_EXIT] &&
emulator.IsImage()
);
}
bool Main::OkToExit() const
{
return
(
!preferences[Managers::Preferences::CONFIRM_EXIT] ||
Window::User::Confirm( IDS_ARE_YOU_SURE, IDS_TITLE_EXIT )
);
}
void Main::Exit()
{
if (netplay.Close())
{
if (FirstUnloadOnExit())
{
window.Get().SendCommand( IDM_FILE_CLOSE );
}
else if (OkToExit())
{
emulator.Unload();
if (menu[IDM_MACHINE_SYSTEM_AUTO].Checked())
Nes::Machine(emulator).SetMode( Nes::Machine::NTSC );
::PostQuitMessage( EXIT_SUCCESS );
}
}
}
ibool Main::OnWinClose(Window::Param&)
{
Exit();
return true;
}
ibool Main::OnWinQueryEndSession(Window::Param& param)
{
netplay.Close();
if (emulator.IsImage())
window.Get().SendCommand( IDM_FILE_CLOSE );
param.lParam = !emulator.IsImage();
return true;
}
void Main::OnCmdFileExit(uint)
{
Exit();
Managers::Manager::Resume();
}
}
}

View File

@@ -0,0 +1,111 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_APPLICATION_MAIN_H
#define NST_APPLICATION_MAIN_H
#pragma once
#include "NstApplicationInstance.hpp"
#include "NstManagerPaths.hpp"
#include "NstManagerLogfile.hpp"
#include "NstManagerPreferences.hpp"
#include "NstManagerLauncher.hpp"
#include "NstManagerMachine.hpp"
#include "NstManagerNetplay.hpp"
#include "NstManagerFds.hpp"
#include "NstManagerTapeRecorder.hpp"
#include "NstManagerDipSwitches.hpp"
#include "NstManagerBarcodeReader.hpp"
#include "NstManagerNsf.hpp"
#include "NstManagerMovie.hpp"
#include "NstManagerSaveStates.hpp"
#include "NstManagerCheats.hpp"
#include "NstManagerRecentFiles.hpp"
#include "NstManagerRecentDirs.hpp"
#include "NstManagerImageInfo.hpp"
#include "NstManagerImageDatabase.hpp"
#include "NstManagerLanguage.hpp"
#include "NstManagerHelp.hpp"
#include "NstManagerFiles.hpp"
#include "NstManagerInesHeader.hpp"
#include "NstWindowMain.hpp"
namespace Nestopia
{
namespace Application
{
class Main
{
public:
explicit Main(int);
~Main();
int Run();
private:
void Save();
void Exit();
bool FirstUnloadOnExit();
bool OkToExit() const;
ibool OnWinClose (Window::Param&);
ibool OnWinQueryEndSession (Window::Param&);
void OnCmdFileExit(uint);
Managers::Emulator emulator;
Instance instance;
Window::Menu menu;
Managers::Preferences preferences;
Managers::Logfile logfile;
Managers::Language language;
Managers::Paths paths;
Window::Main window;
Managers::RecentFiles recentFiles;
Managers::RecentDirs recentDirs;
Managers::Machine machine;
Managers::Netplay netplay;
Managers::Launcher launcher;
Managers::Fds fds;
Managers::TapeRecorder tapeRecorder;
Managers::DipSwitches dipSwitches;
Managers::BarcodeReader barcodeReader;
Managers::Nsf nsf;
Managers::Movie movie;
Managers::Cheats cheats;
Managers::SaveStates saveStates;
Managers::ImageDatabase imageDatabase;
Managers::ImageInfo imageInfo;
Managers::Help help;
Managers::InesHeader inesHeader;
Managers::Files files;
};
}
}
#endif

View File

@@ -0,0 +1,100 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_COLLECTION_BITSET_H
#define NST_COLLECTION_BITSET_H
#pragma once
#include "NstMain.hpp"
namespace Nestopia
{
namespace Collection
{
class BitSet
{
public:
typedef uint Bits;
private:
Bits bits;
public:
class Bit
{
Bits& bits;
const Bits mask;
public:
Bit(Bits& b,Bits m)
: bits(b), mask(m) {}
operator bool () const
{
return bits & mask;
}
void operator = (bool set)
{
bits = set ? (bits | mask) : (bits & ~mask);
}
};
BitSet(Bits b=0)
: bits(b) {}
Bit operator [] (uint index)
{
return Bit( bits, 1U << index );
}
bool operator [] (uint index) const
{
return bits & (1U << index);
}
uint operator () (uint mask) const
{
return bits & mask;
}
Bits& Word()
{
return bits;
}
const Bits& Word() const
{
return bits;
}
};
}
}
#endif

View File

@@ -0,0 +1,269 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_COLLECTION_ROUTER_H
#define NST_COLLECTION_ROUTER_H
#pragma once
#include <new>
#include "NstCollectionVector.hpp"
#include "NstObjectDelegate.hpp"
namespace Nestopia
{
namespace Collection
{
template<typename T> struct ConstParam
{
typedef const T& Type;
};
template<typename T> struct ConstParam<T*>
{
typedef const T* const Type;
};
template<> struct ConstParam< bool > { typedef const bool Type; };
template<> struct ConstParam< char > { typedef const int Type; };
template<> struct ConstParam< schar > { typedef const int Type; };
template<> struct ConstParam< uchar > { typedef const uint Type; };
template<> struct ConstParam< short > { typedef const int Type; };
template<> struct ConstParam< ushort > { typedef const uint Type; };
template<> struct ConstParam< int > { typedef const int Type; };
template<> struct ConstParam< uint > { typedef const uint Type; };
template<> struct ConstParam< long > { typedef const long Type; };
template<> struct ConstParam< ulong > { typedef const ulong Type; };
template<typename Output,typename Input,typename Key=uint>
class Router
{
typedef typename ConstParam<Key>::Type KeyParam;
public:
typedef Object::Delegate<Output,Input> Callback;
template<typename T> struct Entry
{
Key key;
Output (T::*function)(Input);
};
template<typename T> struct HookEntry
{
Key key;
void (T::*function)(Input);
};
struct Item
{
const Key key;
Callback callback;
Item(KeyParam k)
: key(k) {}
};
template<typename Data,typename Code>
Router(KeyParam,Data*,Code);
template<typename Data,typename Array>
Router(Data*,const Array&);
~Router();
NST_NO_INLINE void Remove(const void*);
void RemoveAll(const void*);
void Defrag();
Callback& operator [] (KeyParam);
private:
NST_NO_INLINE void Add(KeyParam,const Callback&);
NST_NO_INLINE void Set(KeyParam,const Callback&);
NST_NO_INLINE void Remove(KeyParam,const Callback&);
template<typename Data>
void Add(Data*,const Entry<Data>*,uint);
template<typename Data>
void Set(Data*,const Entry<Data>*,uint);
class Items : public Collection::Vector<Item>
{
public:
Item& GetSorted(KeyParam,bool&);
Item* FindSorted(KeyParam);
Item& AtSorted(KeyParam);
private:
NST_FORCE_INLINE uint LowerBound(KeyParam key) const
{
uint left = 0, right = Size();
while (left < right)
{
const uint middle = (left + right) / 2;
if (this->At(middle)->key < key)
left = middle + 1;
else
right = middle;
}
return left;
}
public:
const Item* FindSorted(KeyParam key) const
{
return const_cast<Items*>(this)->FindSorted(key);
}
};
private:
struct Hook
{
typedef Object::Delegate<void,Input> Item;
typedef Vector<Item> Items;
Output Invoke(Input);
Items items;
Callback main;
Hook* next;
Hook()
: next(NULL) {}
};
NST_NO_INLINE void AddHook(KeyParam,const typename Hook::Item&);
NST_NO_INLINE uint RemoveHook(Item*,Hook*,typename Hook::Item*);
NST_NO_INLINE void RemoveHook(KeyParam,const typename Hook::Item&);
NST_NO_INLINE void RemoveHooks(const void*);
class HookRouter
{
Router& router;
template<typename Data>
void Add(Data*,const HookEntry<Data>*,uint);
public:
HookRouter(Router& ref)
: router(ref) {}
typedef typename Hook::Item Callback;
template<typename Data,typename Code>
void Add(KeyParam key,Data* data,Code code)
{
router.AddHook( key, Callback(data,code) );
}
template<typename Data,typename Hooks>
void Add(Data* data,const Hooks& hooks)
{
Add( data, hooks, sizeof(array(hooks)) );
}
void Remove(const void* data)
{
router.RemoveHooks( data );
}
};
Items items;
Hook* hooks;
public:
Router()
: hooks(NULL) {}
const Item* operator () (KeyParam key) const
{
return items.FindSorted( key );
}
uint Size() const
{
return items.Size();
}
HookRouter Hooks()
{
return *this;
}
template<typename Data,typename Code>
void Add(KeyParam key,Data* data,Code code)
{
Add( key, Callback(data,code) );
}
template<typename Data,typename Array>
void Add(Data* data,const Array& arr)
{
Add( data, arr, sizeof(array(arr)) );
}
template<typename Data,typename Array,typename HookArray>
void Add(Data* data,const Array& arr,const HookArray& hookArray)
{
Add( data, arr, sizeof(array(arr)) );
Hooks().Add( data, hookArray );
}
template<typename Data,typename Code>
void Set(KeyParam key,Data* data,Code code)
{
Set( key, Callback(data,code) );
}
template<typename Data,typename Array>
void Set(Data* data,const Array& arr)
{
Set( data, arr, sizeof(array(arr)) );
}
template<typename Data,typename Code>
void Remove(KeyParam key,Data* data,Code code)
{
Remove( key, Callback(data,code) );
}
};
}
}
#include "NstCollectionRouter.inl"
#endif

View File

@@ -0,0 +1,350 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
namespace Nestopia
{
namespace Collection
{
template<typename Output,typename Input,typename Key> template<typename Data,typename Code>
Router<Output,Input,Key>::Router(KeyParam key,Data* const data,Code code)
: hooks(NULL)
{
Add( key, Callback(data,code) );
}
template<typename Output,typename Input,typename Key> template<typename Data,typename Array>
Router<Output,Input,Key>::Router(Data* const data,const Array& arr)
: hooks(NULL)
{
Add( data, arr, sizeof(array(arr)) );
}
template<typename Output,typename Input,typename Key>
Router<Output,Input,Key>::~Router()
{
for (Hook* it = hooks; it; )
{
Hook* const him = it;
it = it->next;
delete him;
}
}
template<typename Output,typename Input,typename Key>
Output Router<Output,Input,Key>::Hook::Invoke(Input input)
{
for (uint i=0; i < items.Size(); ++i)
items[i]( input );
return main ? main( input ) : Output(0);
}
template<typename Output,typename Input,typename Key>
void Router<Output,Input,Key>::Add(KeyParam key,const Callback& callback)
{
bool existing;
Callback& item = items.GetSorted( key, existing ).callback;
if (existing)
{
NST_ASSERT
(
hooks &&
item.template CodePtr<Hook>() == &Hook::Invoke &&
!item.template DataPtr<Hook>()->main
);
item.template DataPtr<Hook>()->main = callback;
}
else
{
item = callback;
}
}
template<typename Output,typename Input,typename Key> template<typename Data>
void Router<Output,Input,Key>::Add(Data* const data,const Entry<Data>* list,const uint count)
{
items.Reserve( items.Size() + count );
for (const Entry<Data>* const end = list + count; list != end; ++list)
Add( list->key, Callback(data,list->function) );
}
template<typename Output,typename Input,typename Key> template<typename Data>
void Router<Output,Input,Key>::HookRouter::Add(Data* const data,const HookEntry<Data>* list,const uint count)
{
for (const HookEntry<Data>* const end = list + count; list != end; ++list)
router.AddHook( list->key, Callback(data,list->function) );
}
template<typename Output,typename Input,typename Key>
void Router<Output,Input,Key>::Set(KeyParam key,const Callback& callback)
{
if (Item* const item = items.FindSorted( key ))
{
if (item->callback.template CodePtr<Hook>() == &Hook::Invoke)
item->callback.template DataPtr<Hook>()->main = callback;
else
item->callback = callback;
}
else
{
Add( key, callback );
}
}
template<typename Output,typename Input,typename Key> template<typename Data>
void Router<Output,Input,Key>::Set(Data* const data,const Entry<Data>* list,const uint count)
{
for (const Entry<Data>* const end = list + count; list != end; ++list)
Set( list->key, Callback(data,list->function) );
}
template<typename Output,typename Input,typename Key>
void Router<Output,Input,Key>::Remove(KeyParam key,const Callback& callback)
{
if (Item* const item = items.FindSorted( key ))
{
if (item->callback == callback)
{
items.Erase( item );
}
else if
(
item->callback.template CodePtr<Hook>() == &Hook::Invoke &&
item->callback.template DataPtr<Hook>()->main == callback
)
{
item->callback.template DataPtr<Hook>()->main.Reset();
}
}
}
template<typename Output,typename Input,typename Key>
void Router<Output,Input,Key>::Remove(const void* const data)
{
for (uint i=0; i < items.Size(); )
{
const Callback& callback = items[i].callback;
if (callback.VoidPtr() == data)
{
items.Erase( items.At(i) );
}
else
{
if
(
callback.template CodePtr<Hook>() == &Hook::Invoke &&
callback.template DataPtr<Hook>()->main.VoidPtr() == data
)
callback.template DataPtr<Hook>()->main.Unset();
++i;
}
}
}
template<typename Output,typename Input,typename Key>
void Router<Output,Input,Key>::RemoveAll(const void* const data)
{
RemoveHooks( data );
Remove( data );
}
template<typename Output,typename Input,typename Key>
void Router<Output,Input,Key>::Defrag()
{
items.Defrag();
}
template<typename Output,typename Input,typename Key>
void Router<Output,Input,Key>::AddHook(KeyParam key,const typename Hook::Item& newItem)
{
Hook* hook;
bool existing;
Callback& callback = items.GetSorted( key, existing ).callback;
if (existing && callback.template CodePtr<Hook>() == &Hook::Invoke)
{
hook = callback.template DataPtr<Hook>();
NST_ASSERT( hook && hook->items.Size() );
}
else
{
NST_ASSERT( !existing || callback );
hook = new Hook;
if (Hook* it = hooks)
{
while (it->next)
it = it->next;
it->next = hook;
}
else
{
hooks = hook;
}
if (existing)
hook->main = callback;
callback.Set( hook, &Hook::Invoke );
}
hook->items.PushBack( newItem );
}
template<typename Output,typename Input,typename Key>
uint Router<Output,Input,Key>::RemoveHook(Item* const mainItem,Hook* const hook,typename Hook::Item* const hookItem)
{
NST_ASSERT( mainItem );
hook->items.Erase( hookItem );
if (hook->items.Size())
return 0;
uint result;
if (hook->main)
{
result = 1;
mainItem->callback = hook->main;
}
else
{
result = 2;
items.Erase( mainItem );
}
if (hooks == hook)
{
hooks = hook->next;
}
else
{
Hook* it = hooks;
while (it->next != hook)
it = it->next;
it->next = hook->next;
}
delete hook;
return result;
}
template<typename Output,typename Input,typename Key>
void Router<Output,Input,Key>::RemoveHook(KeyParam key,const typename Hook::Item& item)
{
if (Item* const mainItem = items.FindSorted( key ))
{
NST_ASSERT( mainItem->callback.template CodePtr<Hook>() == &Hook::Invoke );
Hook* const hook = mainItem->callback.template DataPtr<Hook>();
NST_ASSERT( hook );
if (typename Hook::Item* const hookItem = hook->items.FindSorted( item ))
RemoveHook( mainItem, hook, hookItem );
}
}
template<typename Output,typename Input,typename Key>
void Router<Output,Input,Key>::RemoveHooks(const void* const data)
{
for (uint i=0; i < items.Size(); ++i)
{
Item& mainItem = items[i];
if (mainItem.callback.template CodePtr<Hook>() == &Hook::Invoke)
{
Hook* const hook = mainItem.callback.template DataPtr<Hook>();
NST_ASSERT( hook );
for (uint j=0; j < hook->items.Size(); )
{
typename Hook::Item& hookItem = hook->items[j];
if (hookItem.VoidPtr() != data)
{
++j;
}
else if (const uint result = RemoveHook( &mainItem, hook, &hookItem ))
{
i -= (result == 2);
break;
}
}
}
}
}
template<typename Output,typename Input,typename Key>
typename Router<Output,Input,Key>::Callback& Router<Output,Input,Key>::operator [] (KeyParam key)
{
Callback& callback = items.AtSorted( key ).callback;
if (callback.template CodePtr<Hook>() == &Hook::Invoke)
return callback.template DataPtr<Hook>()->main;
return callback;
}
template<typename Output,typename Input,typename Key>
typename Router<Output,Input,Key>::Item& Router<Output,Input,Key>::Items::GetSorted(KeyParam key,bool& existing)
{
const uint pos = this->LowerBound( key );
existing = (pos != this->Size() && this->At(pos)->key == key);
if (!existing)
{
this->Insert( this->At(pos), NULL, 1 );
new (static_cast<void*>(this->At(pos))) Item( key );
}
return *this->At(pos);
}
template<typename Output,typename Input,typename Key>
typename Router<Output,Input,Key>::Item* Router<Output,Input,Key>::Items::FindSorted(KeyParam key)
{
const uint pos = this->LowerBound( key );
return pos != this->Size() && this->At(pos)->key == key ? this->At(pos) : NULL;
}
template<typename Output,typename Input,typename Key>
typename Router<Output,Input,Key>::Item& Router<Output,Input,Key>::Items::AtSorted(KeyParam key)
{
const uint pos = this->LowerBound( key );
NST_ASSERT( pos < this->Size() && this->At(pos)->key == key );
return *this->At(pos);
}
}
}

View File

@@ -0,0 +1,193 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include <cstring>
#include "NstCollectionVector.hpp"
#ifdef NST_MSVC_OPTIMIZE
#pragma optimize("t", on)
#endif
namespace Nestopia
{
namespace Collection
{
Vector<void>::Vector(const uint inSize)
:
data (inSize ? std::malloc( inSize ) : NULL),
capacity (inSize),
size (inSize)
{}
Vector<void>::Vector(const void* const NST_RESTRICT inData,const uint inSize)
:
data (inSize ? std::memcpy( std::malloc( inSize ), inData, inSize ) : NULL),
capacity (inSize),
size (inSize)
{
NST_ASSERT( bool(inData) >= bool(inSize) );
}
Vector<void>::Vector(const Vector<void>& base)
:
data (base.size ? std::memcpy( std::malloc( base.size ), base.data, base.size ) : NULL),
capacity (base.size),
size (base.size)
{
}
bool Vector<void>::Valid(const void* const it) const
{
return it >= bytes && it <= bytes + size;
}
bool Vector<void>::InBound(const void* const it) const
{
return it >= bytes && it < bytes + size;
}
void Vector<void>::Assign(const void* const NST_RESTRICT inData,const uint inSize)
{
size = inSize;
if (capacity < inSize)
data = std::realloc( data, capacity = inSize );
std::memcpy( data, inData, inSize );
}
void Vector<void>::Append(const void* const NST_RESTRICT inData,const uint inSize)
{
size += inSize;
if (capacity < size)
data = std::realloc( data, capacity = size * 2 );
std::memcpy( bytes + (size - inSize), inData, inSize );
}
void Vector<void>::Insert(void* const offset,const void* const NST_RESTRICT inData,const uint inSize)
{
NST_ASSERT( Valid(offset) );
if (inSize)
{
const uint pos = static_cast<uchar*>(offset) - bytes;
const uint end = size - pos;
size += inSize;
if (capacity >= size)
{
std::memmove( static_cast<uchar*>(offset) + inSize, offset, end );
if (inData)
std::memcpy( offset, inData, inSize );
}
else
{
capacity = size * 2;
void* const NST_RESTRICT next = std::malloc( capacity );
std::memcpy( next, data, pos );
if (inData)
std::memcpy( static_cast<uchar*>(next) + pos, inData, inSize );
std::memcpy( static_cast<uchar*>(next) + pos + inSize, offset, end );
void* tmp = data;
data = next;
std::free( tmp );
}
}
}
void Vector<void>::Erase(void* const begin,void* const end)
{
NST_ASSERT( end >= begin && begin >= bytes && end <= bytes + size );
const uint back = (bytes + size) - static_cast<uchar*>(end);
size -= static_cast<uchar*>(end) - static_cast<uchar*>(begin);
std::memmove( begin, end, back );
}
void Vector<void>::Destroy()
{
if (void* tmp = data)
{
data = NULL;
capacity = 0;
size = 0;
std::free( tmp );
}
}
void Vector<void>::operator = (const Vector<void>& base)
{
Assign( base.data, base.size );
}
void Vector<void>::Reserve(const uint inSize)
{
if (capacity < inSize)
data = std::realloc( data, capacity = inSize );
}
void Vector<void>::Resize(const uint inSize)
{
size = inSize;
Reserve( inSize );
}
void Vector<void>::Grow(const uint inSize)
{
Resize( size + inSize );
}
void Vector<void>::Defrag()
{
if (capacity != size)
data = std::realloc( data, capacity = size );
}
void Vector<void>::Import(Vector<void>& base)
{
void* tmp = data;
data = base.data;
base.data = NULL;
size = base.size;
base.size = 0;
capacity = base.capacity;
base.capacity = 0;
std::free( tmp );
}
}
}
#ifdef NST_MSVC_OPTIMIZE
#pragma optimize("", on)
#endif

View File

@@ -0,0 +1,328 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_COLLECTION_VECTOR_H
#define NST_COLLECTION_VECTOR_H
#pragma once
#include <cstdlib>
#include "NstMain.hpp"
namespace Nestopia
{
namespace Collection
{
template<typename T> class Vector;
template<>
class Vector<void>
{
protected:
union
{
void* data;
uchar* bytes;
};
uint capacity;
uint size;
explicit Vector(uint);
Vector(const Vector&);
Vector(const void* NST_RESTRICT,uint);
void operator = (const Vector&);
void Assign(const void* NST_RESTRICT,uint);
void Append(const void* NST_RESTRICT,uint);
void Insert(void*,const void* NST_RESTRICT,uint);
void Erase(void*,void*);
void Reserve(uint);
void Resize(uint);
void Grow(uint);
bool Valid(const void*) const;
bool InBound(const void*) const;
Vector()
: data(NULL), capacity(0), size(0) {}
~Vector()
{
NST_ASSERT
(
capacity >= size &&
bool(data) >= bool(size) &&
bool(data) >= bool(capacity)
);
std::free( data );
}
void Shrink(uint inSize)
{
NST_ASSERT( size >= inSize );
size -= inSize;
}
public:
void Destroy();
void Defrag();
void Import(Vector&);
bool Empty() const
{
return !size;
}
void Clear()
{
size = 0;
}
};
template<typename T> class Vector : public Vector<void>
{
public:
typedef T Type;
typedef T* Iterator;
typedef const T* ConstIterator;
enum
{
ITEM_SIZE = sizeof(Type)
};
Vector() {}
Vector(const Type* items,uint count)
: Vector<void>(items,ITEM_SIZE * count) {}
explicit Vector(uint count)
: Vector<void>(count * ITEM_SIZE) {}
Vector(const Vector<T>& vector)
: Vector<void>(vector) {}
Vector& operator = (const Vector<T>& vector)
{
Vector<void>::operator = (vector);
return *this;
}
void PushBack(const Type& item)
{
Vector<void>::Append( &item, ITEM_SIZE );
}
void PushBack(const Vector<T>& vector)
{
Vector<void>::Append( vector.data, vector.size );
}
void Assign(ConstIterator items,uint count)
{
Vector<void>::Assign( items, ITEM_SIZE * count );
}
void Append(ConstIterator items,uint count)
{
Vector<void>::Append( items, ITEM_SIZE * count );
}
void Insert(Iterator pos,ConstIterator items,uint count)
{
Vector<void>::Insert( pos, items, ITEM_SIZE * count );
}
void Insert(Iterator pos,const Type& item)
{
Vector<void>::Insert( pos, &item, ITEM_SIZE );
}
void Erase(Iterator begin,Iterator end)
{
Vector<void>::Erase( begin, end );
}
void Erase(Iterator offset,uint count=1)
{
Vector<void>::Erase( offset, offset + count );
}
Type& operator [] (uint i)
{
return static_cast<Type*>(data)[i];
}
const Type& operator [] (uint i) const
{
return static_cast<Type*>(data)[i];
}
Type* Ptr()
{
return static_cast<Type*>(data);
}
const Type* Ptr() const
{
return static_cast<const Type*>(data);
}
Iterator Begin()
{
return static_cast<Iterator>(data);
}
ConstIterator Begin() const
{
return static_cast<ConstIterator>(data);
}
Iterator End()
{
return reinterpret_cast<Iterator>(bytes + size);
}
ConstIterator End() const
{
return reinterpret_cast<ConstIterator>(bytes + size);
}
Iterator At(uint pos)
{
return static_cast<Iterator>(data) + pos;
}
ConstIterator At(uint pos) const
{
return static_cast<ConstIterator>(data) + pos;
}
Type& Front()
{
NST_ASSERT( size );
return *static_cast<Iterator>(data);
}
const Type& Front() const
{
NST_ASSERT( size );
return *static_cast<ConstIterator>(data);
}
Type& Back()
{
NST_ASSERT( size );
return *(reinterpret_cast<Iterator>(bytes + size) - 1);
}
const Type& Back() const
{
NST_ASSERT( size );
return *(reinterpret_cast<ConstIterator>(bytes + size) - 1);
}
uint Size() const
{
NST_ASSERT( size % ITEM_SIZE == 0 );
return size / ITEM_SIZE;
}
uint Length() const
{
return Size();
}
uint Capacity() const
{
NST_ASSERT( capacity % ITEM_SIZE == 0 );
return capacity / ITEM_SIZE;
}
void Reserve(uint count)
{
Vector<void>::Reserve( count * ITEM_SIZE );
}
void Resize(uint count)
{
Vector<void>::Resize( count * ITEM_SIZE );
}
void SetTo(uint count)
{
size = count * ITEM_SIZE;
NST_ASSERT( capacity >= size );
}
void Grow(uint count=1)
{
Vector<void>::Grow( count * ITEM_SIZE );
}
void Shrink(uint count=1)
{
Vector<void>::Shrink( count * ITEM_SIZE );
}
bool InBound(ConstIterator it) const
{
return Vector<void>::InBound( it );
}
bool Valid(ConstIterator it) const
{
return Vector<void>::Valid( it );
}
template<typename Value>
ConstIterator Find(const Value&) const;
template<typename Value>
Iterator Find(const Value& value)
{
ConstIterator const it = static_cast<const Vector<T>*>(this)->Find( value );
return reinterpret_cast<Type*>(bytes + (reinterpret_cast<const uchar*>(it) - bytes));
}
};
template<typename T> template<typename Value>
typename Vector<T>::ConstIterator Vector<T>::Find(const Value& value) const
{
for (ConstIterator it(Ptr()), end(End()); it != end; ++it)
if (*it == value)
return it;
return NULL;
}
}
}
#endif

View File

@@ -0,0 +1,45 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstWindowCustom.hpp"
#include "NstCtrlCheckBox.hpp"
namespace Nestopia
{
namespace Window
{
namespace Control
{
void CheckBox::Check(const bool state) const
{
control.Send( BM_SETCHECK, state ? BST_CHECKED : BST_UNCHECKED, 0 );
}
bool CheckBox::Checked() const
{
return control.Send( BM_GETCHECK, 0, 0 ) == BST_CHECKED;
}
}
}
}

View File

@@ -0,0 +1,65 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_CTRL_CHECKBOX_H
#define NST_CTRL_CHECKBOX_H
#pragma once
#include "NstCtrlStandard.hpp"
namespace Nestopia
{
namespace Window
{
namespace Control
{
class CheckBox : public Generic
{
public:
CheckBox(HWND hWnd=NULL)
: Generic( hWnd ) {}
CheckBox(HWND hWnd,uint id)
: Generic( hWnd, id ) {}
void Check(bool=true) const;
bool Checked() const;
void Uncheck() const
{
Check( false );
}
bool Unchecked() const
{
return !Checked();
}
};
}
}
}
#endif

View File

@@ -0,0 +1,85 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstWindowCustom.hpp"
#include "NstCtrlComboBox.hpp"
#include <WindowsX.h>
namespace Nestopia
{
namespace Window
{
namespace Control
{
NST_COMPILE_ASSERT( CB_ERR < 0 && CB_ERRSPACE < 0 );
ComboBox::Item::DataProxy::operator ComboBox::Value () const
{
return ComboBox_GetItemData( item.control, item.index );
}
void ComboBox::Item::DataProxy::operator = (Value data) const
{
ComboBox_SetItemData( item.control, item.index, data );
}
void ComboBox::Item::Select() const
{
ComboBox_SetCurSel( control, index );
}
void ComboBox::Item::Erase() const
{
ComboBox_DeleteString( control, index );
}
ComboBox::Item ComboBox::Add(wcstring name) const
{
NST_ASSERT( name );
return Item( control, ComboBox_AddString( control, name ) );
}
void ComboBox::Reserve(uint items,uint lengths) const
{
control.Send( CB_INITSTORAGE, items, sizeof(wchar_t) * lengths );
}
uint ComboBox::Size() const
{
const int size = ComboBox_GetCount( control );
return NST_MAX(size,0);
}
void ComboBox::Clear() const
{
ComboBox_ResetContent( control );
}
ComboBox::Item ComboBox::Selection() const
{
return Item( control, ComboBox_GetCurSel( control ) );
}
}
}
}

View File

@@ -0,0 +1,123 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_CTRL_COMBOBOX_H
#define NST_CTRL_COMBOBOX_H
#pragma once
#include "NstCtrlStandard.hpp"
namespace Nestopia
{
namespace Window
{
namespace Control
{
class ComboBox : public Generic
{
public:
typedef ULONG_PTR Value;
private:
class Item : public ImplicitBool<Item>
{
class DataProxy
{
const Item& item;
public:
DataProxy(const Item& i)
: item(i) {}
operator Value () const;
void operator = (const Value) const;
};
const Window::Generic control;
const int index;
public:
Item(Window::Generic w,int i)
: control(w), index(i) {}
void Erase() const;
void Select() const;
int GetIndex() const
{
return index;
}
bool operator ! () const
{
return index < 0;
}
DataProxy Data() const
{
return *this;
}
};
public:
ComboBox(HWND hWnd=NULL)
: Generic( hWnd ) {}
ComboBox(HWND hWnd,uint id)
: Generic( hWnd, id ) {}
void Reserve(uint,uint) const;
Item Add(wcstring) const;
void Clear() const;
Item Selection() const;
uint Size() const;
Item operator [] (uint i) const
{
return Item( control, i );
}
Item Back() const
{
return Item( control, Size() - 1 );
}
template<typename T>
void Add(T* list,uint count) const
{
for (uint i=0; i < count; ++i)
Add( list[i] );
}
};
}
}
}
#endif

View File

@@ -0,0 +1,45 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstWindowCustom.hpp"
#include "NstCtrlEdit.hpp"
namespace Nestopia
{
namespace Window
{
namespace Control
{
void Edit::SetNumberOnly(const bool numOnly) const
{
control.Style(ES_NUMBER) = numOnly;
}
void Edit::Limit(const uint length) const
{
control.Send( EM_SETLIMITTEXT, length, 0 );
}
}
}
}

View File

@@ -0,0 +1,100 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_CTRL_EDIT_H
#define NST_CTRL_EDIT_H
#pragma once
#include "NstCtrlStandard.hpp"
namespace Nestopia
{
namespace Window
{
namespace Control
{
class Edit : public Generic
{
class TryText
{
const Edit& edit;
public:
TryText(const Edit& e)
: edit(e) {}
template<typename T>
void operator << (const T* t) const
{
if (*t)
edit.Text() << t;
}
template<typename T>
uint operator >> (T& t) const
{
return (edit.Text() >> t);
}
};
public:
Edit(HWND hWnd=NULL)
: Generic( hWnd ) {}
Edit(HWND hWnd,uint id)
: Generic( hWnd, id ) {}
void Limit(uint) const;
void SetNumberOnly(bool=true) const;
void Clear() const
{
Text().Clear();
}
template<typename T>
void operator << (const T& t) const
{
Text() << t;
}
template<typename T>
uint operator >> (T& t) const
{
return (Text() >> t);
}
TryText Try() const
{
return *this;
}
};
}
}
}
#endif

View File

@@ -0,0 +1,143 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstWindowCustom.hpp"
#include "NstCtrlListBox.hpp"
#include <WindowsX.h>
namespace Nestopia
{
namespace Window
{
namespace Control
{
NST_COMPILE_ASSERT( LB_ERR < 0 && LB_ERRSPACE < 0 );
ListBox::Item::DataProxy::operator ULONG_PTR () const
{
return ListBox_GetItemData( item.control, item.index );
}
void ListBox::Item::DataProxy::operator = (const ULONG_PTR data) const
{
ListBox_SetItemData( item.control, item.index, data );
}
void ListBox::Item::TextProxy::operator << (wcstring const string) const
{
NST_ASSERT( string );
const int selection = ListBox_GetCurSel( item.control );
ListBox_DeleteString( item.control, item.index );
ListBox_InsertString( item.control, item.index, string );
if (selection != LB_ERR)
ListBox_SetCurSel( item.control, selection );
}
void ListBox::Item::Select() const
{
ListBox_SetCurSel( control, index );
}
void ListBox::Item::Remove() const
{
ListBox_DeleteString( control, index );
}
ListBox::Item ListBox::Selection() const
{
return Item( control, ListBox_GetCurSel( control ) );
}
bool ListBox::AnySelection() const
{
return ListBox_GetCurSel( control ) != LB_ERR;
}
ListBox::Item ListBox::Add(wcstring const text) const
{
NST_ASSERT( text );
return Item( control, ListBox_AddString( control, text ) );
}
ListBox::Item ListBox::Insert(const uint index,wcstring const text) const
{
NST_ASSERT( text );
return Item( control, ListBox_InsertString( control, index, text ) );
}
uint ListBox::Size() const
{
const int size = ListBox_GetCount( control );
return NST_MAX(size,0);
}
void ListBox::Reserve(const uint capacity) const
{
if (capacity < Size())
control.Send( LB_INITSTORAGE, capacity, 0 );
}
void ListBox::Clear() const
{
ListBox_ResetContent( control );
}
ListBox::HScrollBar::HScrollBar(HWND h)
: width(0), hWnd(h), hDC(h ? ::GetDC(h) : NULL)
{
NST_VERIFY( hWnd );
}
void ListBox::HScrollBar::Update(wcstring string,uint length)
{
NST_ASSERT( string || !length );
SIZE size;
if (hDC && ::GetTextExtentPoint32( hDC, string, length, &size ) && width < size.cx)
width = size.cx;
}
ListBox::HScrollBar::~HScrollBar()
{
if (hDC)
{
::ReleaseDC( hWnd, hDC );
if (width)
{
RECT rect;
::GetClientRect( hWnd, &rect );
if (width > rect.right)
ListBox_SetHorizontalExtent( hWnd, width );
}
}
}
}
}
}

View File

@@ -0,0 +1,169 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_CTRL_LISTBOX_H
#define NST_CTRL_LISTBOX_H
#pragma once
#include "NstCtrlStandard.hpp"
namespace Nestopia
{
namespace Window
{
namespace Control
{
class ListBox : public Generic
{
class Item : public ImplicitBool<Item>
{
class DataProxy
{
const Item& item;
public:
DataProxy(const Item& i)
: item(i) {}
operator ULONG_PTR () const;
void operator = (ULONG_PTR) const;
};
class TextProxy
{
const Item& item;
public:
TextProxy(const Item& i)
: item(i) {}
void operator << (wcstring) const;
template<typename T>
uint operator >> (T&) const;
};
const Window::Generic control;
const int index;
public:
Item(Window::Generic w,uint i)
: control(w), index(i) {}
void Remove() const;
void Select() const;
int GetIndex() const
{
return index;
}
bool operator ! () const
{
return index < 0;
}
DataProxy Data() const
{
return *this;
}
TextProxy Text() const
{
return *this;
}
};
public:
ListBox(HWND hWnd=NULL)
: Generic( hWnd ) {}
ListBox(HWND hWnd,uint id)
: Generic( hWnd, id ) {}
Item Add(wcstring) const;
Item Insert(uint,wcstring) const;
Item Selection() const;
bool AnySelection() const;
void Reserve(uint) const;
uint Size() const;
void Clear() const;
template<typename T>
void Add(T* list,uint count) const
{
Reserve( count );
for (uint i=0; i < count; ++i)
Add( list[i] );
}
Item operator [] (uint i) const
{
return Item( control, i );
}
class HScrollBar
{
long width;
HWND const hWnd;
HDC const hDC;
public:
HScrollBar(HWND);
~HScrollBar();
void Update(wcstring,uint);
};
};
template<typename T>
uint ListBox::Item::TextProxy::operator >> (T& string) const
{
NST_VERIFY( item.control );
const int size = item.control.Send( LB_GETTEXTLEN, item.index, 0 );
if (size > 0)
{
string.Resize( size );
if (item.control.Send( LB_GETTEXT, item.index, static_cast<wchar_t*>(string.Ptr()) ) > 0)
return string.Validate();
}
string.Clear();
return 0;
}
}
}
}
#endif

View File

@@ -0,0 +1,275 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstWindowCustom.hpp"
#include "NstCtrlListView.hpp"
#include <CommCtrl.h>
namespace Nestopia
{
namespace Window
{
namespace Control
{
void ListView::ColumnsProxy::Insert(const uint index,wcstring const text) const
{
NST_ASSERT( text );
LVCOLUMN lvColumn;
lvColumn.mask = LVCF_FMT|LVCF_TEXT;
lvColumn.fmt = LVCFMT_LEFT;
lvColumn.pszText = const_cast<wchar_t*>( text );
ListView_InsertColumn( control, index, &lvColumn );
}
void ListView::ColumnsProxy::Align() const
{
for (int i=0; ListView_SetColumnWidth( control, i, LVSCW_AUTOSIZE_USEHEADER ); ++i)
{
const int header = ListView_GetColumnWidth( control, i );
ListView_SetColumnWidth( control, i, LVSCW_AUTOSIZE );
const int width = ListView_GetColumnWidth( control, i );
if (width < header)
ListView_SetColumnWidth( control, i, header );
}
}
void ListView::ColumnsProxy::GetOrder(int* const array,const uint count) const
{
ListView_GetColumnOrderArray( control, count, array );
}
uint ListView::ColumnsProxy::GetIndex(const uint index) const
{
LVCOLUMN lvColumn;
lvColumn.mask = LVCF_ORDER;
ListView_GetColumn( control, index, &lvColumn );
return NST_MAX(lvColumn.iOrder,0);
}
void ListView::ColumnsProxy::Clear() const
{
while (ListView_DeleteColumn( control, 0 ));
}
ListView::StyleExProxy::operator uint () const
{
return ListView_GetExtendedListViewStyle( control );
}
void ListView::StyleExProxy::operator = (const uint style) const
{
ListView_SetExtendedListViewStyle( control, style );
}
void ListView::Item::TextProxy::operator << (wcstring const text) const
{
ListView_SetItemText( item.control, item.index, index, const_cast<wchar_t*>(text) );
}
void ListView::Item::TextProxy::GetText(Buffer& buffer) const
{
NST_ASSERT( buffer.Empty() );
LVITEM lvItem;
lvItem.iSubItem = index;
do
{
buffer.Resize( buffer.Length() + BLOCK_SIZE );
lvItem.cchTextMax = buffer.Length() + 1;
lvItem.pszText = buffer.Ptr();
lvItem.cchTextMax = item.control.Send( LVM_GETITEMTEXT, item.index, &lvItem );
}
while (*(buffer.Ptr() + buffer.Length()));
buffer.ShrinkTo( lvItem.cchTextMax );
}
void ListView::Item::DataProxy::operator = (const LPARAM data) const
{
LVITEM lvItem;
lvItem.mask = LVIF_PARAM;
lvItem.iItem = item.index;
lvItem.iSubItem = 0;
lvItem.lParam = data;
ListView_SetItem( item.control, &lvItem );
}
ListView::Item::DataProxy::operator LPARAM () const
{
LVITEM lvItem;
lvItem.mask = LVIF_PARAM;
lvItem.iItem = item.index;
lvItem.iSubItem = 0;
lvItem.lParam = 0;
ListView_GetItem( item.control, &lvItem );
return lvItem.lParam;
}
bool ListView::Item::Delete() const
{
return index != ~0U ? ListView_DeleteItem( control, index ) : false;
}
void ListView::Item::Select(const bool state) const
{
ListView_SetItemState( control, index, state ? LVIS_SELECTED : 0, LVIS_SELECTED );
}
void ListView::Item::Check(const bool state) const
{
ListView_SetCheckState( control, index, state );
}
bool ListView::Item::Checked() const
{
return ListView_GetCheckState( control, index );
}
void ListView::Item::Show() const
{
ListView_EnsureVisible( control, index, false );
}
ListView::Item ListView::Selection() const
{
return Item( control, ListView_GetNextItem( control, -1, LVNI_SELECTED ) );
}
int ListView::Add(GenericString text,const LPARAM data,const bool checked) const
{
HeapString tmp;
LVITEM lvItem;
if (text.Length())
{
if (text.NullTerminated())
{
lvItem.pszText = const_cast<wchar_t*>(text.Ptr());
}
else
{
tmp = text;
lvItem.pszText = tmp.Ptr();
}
}
else
{
lvItem.pszText = LPSTR_TEXTCALLBACK;
}
lvItem.mask = LVIF_TEXT;
if (data)
lvItem.mask |= LVIF_PARAM;
lvItem.iItem = INT_MAX;
lvItem.iSubItem = 0;
lvItem.lParam = data;
const int index = ListView_InsertItem( control, &lvItem );
if (checked)
ListView_SetCheckState( control, index, true );
return index;
}
uint ListView::Size() const
{
const int count = ListView_GetItemCount( control );
return NST_MAX(count,0);
}
void ListView::Clear() const
{
ListView_DeleteAllItems( control );
}
void ListView::Reserve(const uint capacity) const
{
if (capacity > Size())
ListView_SetItemCount( control, capacity );
}
void ListView::SetBkColor(const uint color) const
{
ListView_SetBkColor( control, color );
}
void ListView::SetTextColor(const uint color) const
{
ListView_SetTextColor( control, color );
}
void ListView::SetTextBkColor(const uint color) const
{
ListView_SetTextBkColor( control, color );
}
bool ListView::HitTest(const uint x,const uint y) const
{
LVHITTESTINFO lvHitTestInfo;
lvHitTestInfo.pt.x = x;
lvHitTestInfo.pt.y = y;
::ScreenToClient( control, &lvHitTestInfo.pt );
return ListView_HitTest( control, &lvHitTestInfo ) != -1;
}
void ListView::Sort(const SortFunction& sortFunction) const
{
if (Size() > 1)
ListView_SortItems( control, SortProc, reinterpret_cast<WPARAM>(&sortFunction) );
}
int CALLBACK ListView::SortProc(LPARAM obj1,LPARAM obj2,LPARAM ref)
{
return (*reinterpret_cast<const SortFunction*>(ref))
(
reinterpret_cast<const void*>( obj1 ),
reinterpret_cast<const void*>( obj2 )
);
}
}
}
}

View File

@@ -0,0 +1,219 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_CTRL_LISTVIEW_H
#define NST_CTRL_LISTVIEW_H
#pragma once
#include "NstCtrlStandard.hpp"
#include "NstString.hpp"
namespace Nestopia
{
namespace Window
{
namespace Control
{
class ListView : public Generic
{
class StyleExProxy
{
const Window::Generic control;
public:
StyleExProxy(Window::Generic w)
: control(w) {}
operator uint () const;
void operator = (uint) const;
};
class ColumnsProxy
{
const Window::Generic control;
public:
ColumnsProxy(Window::Generic w)
: control(w) {}
void Insert(uint,wcstring) const;
void GetOrder(int*,uint) const;
uint GetIndex(uint) const;
void Align() const;
void Clear() const;
template<typename T,uint N>
void Set(const T (&list)[N]) const
{
Clear();
for (uint i=0; i < N; ++i)
Insert( i, list[i] );
}
};
class Item
{
class TextProxy
{
typedef HeapString Buffer;
enum
{
BLOCK_SIZE = 255
};
const Item& item;
const uint index;
void GetText(Buffer&) const;
public:
TextProxy(const Item& i,uint s)
: item(i), index(s) {}
void operator << (wcstring) const;
template<typename T>
uint operator >> (T& string) const
{
Buffer buffer;
GetText( buffer );
string = buffer;
return string.Length();
}
};
class DataProxy
{
const Item& item;
public:
DataProxy(const Item& i)
: item(i) {}
void operator = (LPARAM) const;
operator LPARAM () const;
operator void* () const
{
return reinterpret_cast<void*>( operator LPARAM() );
}
void operator = (const void* data) const
{
operator = (reinterpret_cast<LPARAM>(data));
}
};
const Window::Generic control;
const uint index;
public:
Item(Window::Generic w,uint i)
: control(w), index(i) {}
bool Delete() const;
void Select(bool=true) const;
void Show() const;
void Check(bool=true) const;
bool Checked() const;
uint GetIndex() const
{
return index;
}
TextProxy Text(uint i=0) const
{
return TextProxy( *this, i );
}
DataProxy Data() const
{
return *this;
}
};
typedef Object::Delegate<int,const void*,const void*> SortFunction;
void Sort(const SortFunction&) const;
static int CALLBACK SortProc(LPARAM,LPARAM,LPARAM);
public:
uint Size() const;
void Clear() const;
void Reserve(uint) const;
int Add(GenericString = GenericString(),LPARAM=0,bool=false) const;
Item Selection() const;
void SetBkColor(uint) const;
void SetTextColor(uint) const;
void SetTextBkColor(uint) const;
bool HitTest(uint,uint) const;
ListView(HWND hWnd=NULL)
: Generic( hWnd ) {}
ListView(HWND hWnd,uint id)
: Generic( hWnd, id ) {}
ColumnsProxy Columns() const
{
return control;
}
StyleExProxy StyleEx() const
{
return control;
}
Item operator [] (uint index) const
{
return Item( control, index );
}
template<typename Data,typename Code>
void Sort(Data* data,Code code) const
{
Sort( SortFunction(data,code) );
}
int Add(GenericString name,const void* const data,const bool checked=false) const
{
return Add( name, reinterpret_cast<LPARAM>(data), checked );
}
};
}
}
}
#endif

View File

@@ -0,0 +1,52 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_CTRL_RADIOBUTTON_H
#define NST_CTRL_RADIOBUTTON_H
#pragma once
#include "NstCtrlCheckBox.hpp"
namespace Nestopia
{
namespace Window
{
namespace Control
{
class RadioButton : public CheckBox
{
public:
RadioButton(HWND hWnd=NULL)
: CheckBox( hWnd ) {}
RadioButton(HWND hWnd,uint id)
: CheckBox( hWnd, id ) {}
};
}
}
}
#endif

View File

@@ -0,0 +1,51 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstWindowCustom.hpp"
#include "NstCtrlSlider.hpp"
#include <CommCtrl.h>
namespace Nestopia
{
namespace Window
{
namespace Control
{
Slider::PositionProxy::operator int () const
{
return control.Send( TBM_GETPOS, 0, 0 );
}
void Slider::PositionProxy::operator = (const int pos) const
{
control.Send( TBM_SETPOS, true, pos );
}
void Slider::SetRange(const int minimum,const int maximum) const
{
control.Send( TBM_SETRANGE, false, MAKELONG(minimum,maximum) );
}
}
}
}

View File

@@ -0,0 +1,72 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_CTRL_SLIDER_H
#define NST_CTRL_SLIDER_H
#pragma once
#include "NstCtrlStandard.hpp"
namespace Nestopia
{
namespace Window
{
namespace Control
{
class Slider : public Generic
{
class PositionProxy
{
const Window::Generic control;
public:
PositionProxy(Window::Generic w)
: control(w) {}
operator int () const;
void operator = (int) const;
};
public:
Slider(HWND hWnd=NULL)
: Generic( hWnd ) {}
Slider(HWND hWnd,uint id)
: Generic( hWnd, id ) {}
void SetRange(int,int) const;
PositionProxy Position() const
{
return control;
}
};
}
}
}
#endif

View File

@@ -0,0 +1,142 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstWindowCustom.hpp"
#include "NstWindowParam.hpp"
#include "NstCtrlStandard.hpp"
#include "NstString.hpp"
namespace Nestopia
{
namespace Window
{
namespace Control
{
bool Generic::FixedFont() const
{
bool fixed = false;
if (HFONT const hFontNew = reinterpret_cast<HFONT>(control.Send( WM_GETFONT )))
{
if (HDC const hdc = ::GetDC( control ))
{
if (HFONT const hFontOld = reinterpret_cast<HFONT>(::SelectObject( hdc, hFontNew )))
{
TEXTMETRIC tm;
if (::GetTextMetrics( hdc, &tm ) && !(tm.tmPitchAndFamily & TMPF_FIXED_PITCH))
fixed = true;
::SelectObject( hdc, hFontOld );
}
::ReleaseDC( control, hdc );
}
}
return fixed;
}
Point Generic::GetMaxTextSize() const
{
Point size;
if (HFONT const hFontNew = reinterpret_cast<HFONT>(control.Send( WM_GETFONT )))
{
if (HDC const hdc = ::GetDC( control ))
{
if (HFONT const hFontOld = reinterpret_cast<HFONT>(::SelectObject( hdc, hFontNew )))
{
TEXTMETRIC tm;
if (::GetTextMetrics( hdc, &tm ))
{
const uint width = control.Coordinates().Width();
HeapString text;
control.Text() >> text;
for (wcstring s=text.Ptr(), n=s; *s; s=n, ++n)
{
while (*n && *n != '\n')
++n;
SIZE tsize;
if (::GetTextExtentExPoint( hdc, s, n-s, width, NULL, NULL, &tsize ))
size.x = NST_MAX(size.x,tsize.cx);
size.y += tm.tmHeight;
}
if (size.x)
size.x += 4*4;
if (size.y)
size.y += 4*2;
}
::SelectObject( hdc, hFontOld );
}
::ReleaseDC( control, hdc );
}
}
return size;
}
NotificationHandler::NotificationHandler(const uint id,MsgHandler& m)
: control(id), msgHandler(m)
{
Initialize();
}
NotificationHandler::~NotificationHandler()
{
msgHandler.Hooks().Remove( this );
}
void NotificationHandler::Initialize()
{
msgHandler.Hooks().Add( WM_NOTIFY, this, &NotificationHandler::OnNotify );
}
void NotificationHandler::OnNotify(Param& param)
{
NST_ASSERT( param.lParam );
const NMHDR& nmhdr = *reinterpret_cast<const NMHDR*>(param.lParam);
if (control == nmhdr.idFrom)
{
Items::iterator it(items.find( nmhdr.code ));
if (it != items.end())
it->second( nmhdr );
}
}
}
}
}

View File

@@ -0,0 +1,167 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_CTRL_STANDARD_H
#define NST_CTRL_STANDARD_H
#pragma once
#include <map>
#include "NstWindowGeneric.hpp"
namespace Nestopia
{
namespace Window
{
namespace Control
{
class Generic
{
public:
bool FixedFont() const;
Point GetMaxTextSize() const;
protected:
Window::Generic control;
public:
Generic(HWND hWnd=NULL)
: control(hWnd) {}
Generic(HWND hWnd,uint id)
: control( ::GetDlgItem( hWnd, id ) )
{
NST_VERIFY( control );
}
void Enable(bool state=true) const
{
control.Enable( state );
}
void Disable() const
{
Enable( false );
}
bool Enabled() const
{
return control.Enabled();
}
void Redraw() const
{
control.Redraw();
}
Window::Generic GetWindow() const
{
return control;
}
HWND GetHandle() const
{
return control;
}
Window::Generic::Stream Text() const
{
return control;
}
};
class NotificationHandler
{
public:
template<typename T> struct Entry
{
uint msg;
void (T::*function)(const NMHDR&);
};
private:
typedef Object::Delegate<void,const NMHDR&> Callback;
typedef std::map<uint,Callback> Items;
const uint control;
Items items;
MsgHandler& msgHandler;
void Initialize();
void OnNotify(Param&);
template<typename T>
void Add(T*,const Entry<T>*,uint);
Callback& operator () (uint id)
{
return items[id];
}
public:
NotificationHandler(uint,MsgHandler&);
template<typename T,uint N>
NotificationHandler(uint,MsgHandler&,T*,const Entry<T>(&)[N]);
~NotificationHandler();
template<typename T,uint N>
void Add(T* data,const Entry<T>(&entries)[N])
{
Add( data, entries, N );
}
};
template<typename T,uint N>
NotificationHandler::NotificationHandler
(
const uint id,
MsgHandler& m,
T* const data,
const Entry<T>(&entries)[N]
)
: control(id), msgHandler(m)
{
Initialize();
Add( data, entries, N );
}
template<typename T>
void NotificationHandler::Add(T* const object,const Entry<T>* it,const uint count)
{
for (const Entry<T>* const end = it + count; it != end; ++it)
(*this)( it->msg ).Set( object, it->function );
}
}
}
}
#endif

View File

@@ -0,0 +1,144 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "language/resource.h"
#include "NstApplicationException.hpp"
#include "NstResourceBitmap.hpp"
#include "NstWindowCustom.hpp"
#include "NstCtrlTreeView.hpp"
#include <CommCtrl.h>
namespace Nestopia
{
namespace Window
{
namespace Control
{
TreeView::ImageList::ImageList(const uint x,const uint y,const uint selected,const uint unselected)
: handle(ImageList_Create(x,y,ILC_COLOR16|ILC_MASK,0,2))
{
if (handle)
{
try
{
if
(
ImageList_AddMasked( static_cast<HIMAGELIST>(handle), Resource::Bitmap( selected ), 0 ) == -1 ||
ImageList_AddMasked( static_cast<HIMAGELIST>(handle), Resource::Bitmap( unselected ), 0 ) == -1
)
throw Application::Exception( IDS_ERR_FAILED, L"ImageList_Add()" );
}
catch (const Application::Exception& exception)
{
ImageList_Destroy( static_cast<HIMAGELIST>(handle) );
throw exception;
}
}
else
{
throw Application::Exception( IDS_ERR_FAILED, L"ImageList_Create()" );
}
}
TreeView::ImageList::~ImageList()
{
if (handle)
ImageList_Destroy( static_cast<HIMAGELIST>(handle) );
}
void TreeView::Item::Select() const
{
NST_VERIFY( hItem );
TreeView_SelectItem( root, static_cast<HTREEITEM>(hItem) );
}
void TreeView::SetImageList(const ImageList& imageList) const
{
NST_VERIFY( imageList.handle );
TreeView_SetImageList( control, static_cast<HIMAGELIST>(imageList.handle), TVSIL_NORMAL );
}
void TreeView::Add(const GenericString text) const
{
TVINSERTSTRUCT tv;
tv.hParent = TVI_ROOT;
tv.hInsertAfter = TVI_LAST;
tv.item.mask = TVIF_TEXT;
tv.item.pszText = const_cast<wchar_t*>( text.Ptr() );
tv.item.cchTextMax = text.Length();
if (TreeView_GetImageList( control, TVSIL_NORMAL ))
{
tv.item.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
tv.item.iImage = ImageList::UNSELECTED;
tv.item.iSelectedImage = ImageList::SELECTED;
}
TreeView_InsertItem( control, &tv );
}
TreeView::Item TreeView::operator [] (const uint index) const
{
HTREEITEM hItem = TreeView_GetRoot( control );
for (uint i=index; i; --i)
hItem = TreeView_GetNextSibling( control, hItem );
return Item( control, hItem, hItem ? int(index) : -1 );
}
int TreeView::GetIndex(void* const handle) const
{
int index = -1;
if (handle)
{
index = 0;
for (HTREEITEM hItem = TreeView_GetRoot( control ); hItem && hItem != static_cast<HTREEITEM>(handle); ++index)
hItem = TreeView_GetNextSibling( control, hItem );
}
return index;
}
TreeView::Item TreeView::Selection() const
{
HTREEITEM const hSelection = TreeView_GetSelection( control );
return Item( control, hSelection, GetIndex( hSelection ) );
}
void TreeView::SetBackgroundColor(const uint color) const
{
TreeView_SetBkColor( control, color );
}
void TreeView::SetTextColor(const uint color) const
{
TreeView_SetTextColor( control, color );
}
}
}
}

View File

@@ -0,0 +1,95 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_CTRL_TREEVIEW_H
#define NST_CTRL_TREEVIEW_H
#pragma once
#include "NstCtrlStandard.hpp"
#include "NstString.hpp"
namespace Nestopia
{
namespace Window
{
namespace Control
{
class TreeView : public Generic
{
class Item
{
const Window::Generic root;
void* const hItem;
const int index;
public:
Item(Window::Generic w,void* h,int i)
: root(w), hItem(h), index(i) {}
void Select() const;
int GetIndex() const
{
return index;
}
};
public:
TreeView(HWND hWnd=NULL)
: Generic( hWnd ) {}
TreeView(HWND hWnd,uint id)
: Generic( hWnd, id ) {}
class ImageList
{
friend class TreeView;
void* const handle;
enum {SELECTED,UNSELECTED};
public:
ImageList(uint,uint,uint,uint);
~ImageList();
};
void SetImageList(const ImageList&) const;
void Add(GenericString) const;
Item Selection() const;
void SetBackgroundColor(uint) const;
void SetTextColor(uint) const;
int GetIndex(void*) const;
Item operator [] (uint) const;
};
}
}
}
#endif

View File

@@ -0,0 +1,96 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "resource/resource.h"
#include "NstResourceCursor.hpp"
#include "NstWindowParam.hpp"
#include "NstDialogAbout.hpp"
#include "NstApplicationInstance.hpp"
#include <ShellAPI.h>
namespace Nestopia
{
namespace Window
{
struct About::Handlers
{
static const MsgHandler::Entry<About> messages[];
static const MsgHandler::Entry<About> commands[];
};
const MsgHandler::Entry<About> About::Handlers::messages[] =
{
{ WM_INITDIALOG, &About::OnInitDialog },
{ WM_SETCURSOR, &About::OnSetCursor }
};
const MsgHandler::Entry<About> About::Handlers::commands[] =
{
{ IDC_ABOUT_URL, &About::OnCmdClick },
{ IDC_ABOUT_MAIL, &About::OnCmdClick }
};
About::About()
: dialog(IDD_ABOUT,this,Handlers::messages,Handlers::commands) {}
ibool About::OnInitDialog(Param&)
{
dialog.SetItemIcon( IDC_ABOUT_ICON, Application::Instance::GetIconStyle() == Application::Instance::ICONSTYLE_NES ? IDI_APP : IDI_APP_J );
//dialog.Control( IDC_ABOUT_NAMEVERSION ).Text() << (String::Heap<char>() << "Nestopia UE v" << Application::Instance::GetVersion()).Ptr();
dialog.Control( IDC_ABOUT_NAMEVERSION ).Text() << "Nestopia UE vx.xx";
return true;
}
ibool About::OnSetCursor(Param& param)
{
HCURSOR hCursor;
if (param.Cursor().Inside( IDC_ABOUT_URL ) || param.Cursor().Inside( IDC_ABOUT_MAIL ))
hCursor = Resource::Cursor::GetHand();
else
hCursor = Resource::Cursor::GetArrow();
::SetCursor( hCursor );
::SetWindowLongPtr( dialog, DWLP_MSGRESULT, true );
return true;
}
ibool About::OnCmdClick(Param& param)
{
if (param.Button().Clicked())
{
HeapString cmd;
if (dialog.Control( param.Button().GetId() ).Text() >> cmd)
{
cmd.Insert( 0, param.Button().GetId() == IDC_ABOUT_MAIL ? L"mailto:" : L"http://" );
::ShellExecute( NULL, L"open", cmd.Ptr(), NULL, NULL, SW_SHOWNORMAL );
}
}
return true;
}
}
}

View File

@@ -0,0 +1,62 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_DIALOG_ABOUT_H
#define NST_DIALOG_ABOUT_H
#pragma once
#include "NstWindowDialog.hpp"
namespace Nestopia
{
namespace Window
{
class About
{
public:
About();
private:
struct Handlers;
ibool OnInitDialog (Param&);
ibool OnSetCursor (Param&);
ibool OnCmdClick (Param&);
Dialog dialog;
public:
void Open()
{
dialog.Open();
}
};
}
}
#endif

View File

@@ -0,0 +1,111 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstApplicationInstance.hpp"
#include "NstWindowParam.hpp"
#include "NstManagerPaths.hpp"
#include "NstDialogAutoSaver.hpp"
namespace Nestopia
{
namespace Window
{
AutoSaver::Settings::Settings()
: interval(1), notify(true) {}
struct AutoSaver::Handlers
{
static const MsgHandler::Entry<AutoSaver> messages[];
static const MsgHandler::Entry<AutoSaver> commands[];
};
const MsgHandler::Entry<AutoSaver> AutoSaver::Handlers::messages[] =
{
{ WM_INITDIALOG, &AutoSaver::OnInitDialog }
};
const MsgHandler::Entry<AutoSaver> AutoSaver::Handlers::commands[] =
{
{ IDC_AUTOSAVE_CLEAR, &AutoSaver::OnCmdClear },
{ IDC_AUTOSAVE_BROWSE, &AutoSaver::OnCmdBrowse },
{ IDOK, &AutoSaver::OnCmdOk }
};
AutoSaver::AutoSaver(const Managers::Paths& p)
: dialog(IDD_AUTOSAVER,this,Handlers::messages,Handlers::commands), paths(p) {}
AutoSaver::~AutoSaver()
{
}
const Path AutoSaver::GetStateFile() const
{
return Application::Instance::GetFullPath( settings.stateFile );
}
ibool AutoSaver::OnInitDialog(Param&)
{
dialog.Edit(IDC_AUTOSAVE_FILE) << settings.stateFile.Ptr();
dialog.Edit(IDC_AUTOSAVE_TIME).Limit(2);
dialog.Edit(IDC_AUTOSAVE_TIME) << settings.interval;
dialog.CheckBox(IDC_AUTOSAVE_ENABLE_MSG).Check( settings.notify );
return true;
}
ibool AutoSaver::OnCmdClear(Param& param)
{
if (param.Button().Clicked())
dialog.Edit(IDC_AUTOSAVE_FILE).Clear();
return true;
}
ibool AutoSaver::OnCmdBrowse(Param& param)
{
if (param.Button().Clicked())
{
Path tmp;
dialog.Edit(IDC_AUTOSAVE_FILE) >> tmp;
dialog.Edit(IDC_AUTOSAVE_FILE).Try() << paths.BrowseSave( Managers::Paths::File::STATE, Managers::Paths::SUGGEST, Application::Instance::GetFullPath(tmp) ).Ptr();
}
return true;
}
ibool AutoSaver::OnCmdOk(Param& param)
{
if (param.Button().Clicked())
{
dialog.Edit(IDC_AUTOSAVE_FILE) >> settings.stateFile;
dialog.Edit(IDC_AUTOSAVE_TIME) >> settings.interval;
settings.notify = dialog.CheckBox(IDC_AUTOSAVE_ENABLE_MSG).Checked();
paths.FixFile( Managers::Paths::File::STATE, settings.stateFile );
dialog.Close();
}
return true;
}
}
}

View File

@@ -0,0 +1,92 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_DIALOG_AUTOSAVER_H
#define NST_DIALOG_AUTOSAVER_H
#pragma once
#include "NstWindowDialog.hpp"
namespace Nestopia
{
namespace Window
{
class AutoSaver
{
public:
explicit AutoSaver(const Managers::Paths&);
~AutoSaver();
enum
{
DEFAULT_SAVE_SLOT = 0
};
const Path GetStateFile() const;
private:
struct Handlers;
struct Settings
{
Settings();
uint interval;
bool notify;
Path stateFile;
};
ibool OnInitDialog (Param&);
ibool OnCmdBrowse (Param&);
ibool OnCmdClear (Param&);
ibool OnCmdOk (Param&);
Dialog dialog;
const Managers::Paths& paths;
Settings settings;
public:
void Open()
{
dialog.Open();
}
uint GetInterval() const
{
return settings.interval * 60 * 1000;
}
bool ShouldNotify() const
{
return settings.notify;
}
};
}
}
#endif

View File

@@ -0,0 +1,110 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstWindowParam.hpp"
#include "NstManagerEmulator.hpp"
#include "NstDialogBarcodeReader.hpp"
namespace Nestopia
{
namespace Window
{
struct BarcodeReader::Handlers
{
static const MsgHandler::Entry<BarcodeReader> messages[];
static const MsgHandler::Entry<BarcodeReader> commands[];
};
const MsgHandler::Entry<BarcodeReader> BarcodeReader::Handlers::messages[] =
{
{ WM_INITDIALOG, &BarcodeReader::OnInitDialog }
};
const MsgHandler::Entry<BarcodeReader> BarcodeReader::Handlers::commands[] =
{
{ IDC_BARCODE_TRANSFER, &BarcodeReader::OnCmdTransfer },
{ IDC_BARCODE_RANDOM, &BarcodeReader::OnCmdRandom },
{ IDC_BARCODE_DIGITS, &BarcodeReader::OnCmdDigits }
};
BarcodeReader::BarcodeReader(Managers::Emulator& emulator,String::Heap<char>& string)
:
dialog (IDD_BARCODE,this,Handlers::messages,Handlers::commands),
barcodeReader (emulator),
code (string)
{
}
ibool BarcodeReader::OnInitDialog(Param&)
{
Control::Edit edit( dialog.Edit(IDC_BARCODE_DIGITS) );
edit.Limit( Nes::BarcodeReader::MAX_DIGITS );
if (code.Length())
edit << code.Ptr();
if (!barcodeReader.CanTransfer())
{
edit.Disable();
dialog.Control( IDC_BARCODE_RANDOM ).Disable();
dialog.Control( IDC_BARCODE_TRANSFER ).Disable();
}
return true;
}
ibool BarcodeReader::OnCmdDigits(Param& param)
{
if (param.Edit().Changed())
dialog.Edit( IDC_BARCODE_DIGITS ) >> code;
return true;
}
ibool BarcodeReader::OnCmdRandom(Param& param)
{
if (param.Button().Clicked())
{
char string[Nes::BarcodeReader::MAX_DIGITS+1];
if (barcodeReader.Randomize( string ))
dialog.Edit( IDC_BARCODE_DIGITS ) << string;
}
return true;
}
ibool BarcodeReader::OnCmdTransfer(Param& param)
{
if (param.Button().Clicked() && barcodeReader.IsDigitsSupported( code.Length() ))
{
barcodeReader.Transfer( code.Ptr(), code.Length() );
dialog.Close();
}
return true;
}
}
}

View File

@@ -0,0 +1,66 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_DIALOG_BARCODEREADER_H
#define NST_DIALOG_BARCODEREADER_H
#pragma once
#include "NstWindowDialog.hpp"
#include "../core/api/NstApiBarcodeReader.hpp"
namespace Nestopia
{
namespace Window
{
class BarcodeReader
{
public:
BarcodeReader(Managers::Emulator&,String::Heap<char>&);
private:
struct Handlers;
ibool OnInitDialog (Param&);
ibool OnCmdDigits (Param&);
ibool OnCmdRandom (Param&);
ibool OnCmdTransfer (Param&);
Dialog dialog;
Nes::BarcodeReader barcodeReader;
String::Heap<char>& code;
public:
void Open()
{
dialog.Open();
}
};
}
}
#endif

View File

@@ -0,0 +1,150 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstObjectPod.hpp"
#include "NstApplicationInstance.hpp"
#include "NstDialogBrowse.hpp"
#include <CommDlg.h>
#include <ShlObj.h>
namespace Nestopia
{
namespace Window
{
const Path Browser::OpenFile(wchar_t* const filter,const Path dir,const Path ext)
{
for (uint i=0; filter[i]; ++i)
{
if (filter[i] == '\t')
filter[i] = '\0';
}
Path path;
path.Reserve( MAX_PATH*2 );
Object::Pod<OPENFILENAME> ofn;
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = Application::Instance::GetActiveWindow();
ofn.lpstrFile = path.Ptr();
ofn.nMaxFile = path.Capacity();
ofn.lpstrInitialDir = dir.Length() ? dir.Ptr() : L".";
ofn.Flags = OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;
if (filter)
{
ofn.lpstrFilter = filter;
ofn.nFilterIndex = 1;
}
if (ext.Length())
ofn.lpstrDefExt = ext.Ptr();
if (::GetOpenFileName( &ofn ))
path.Validate();
else
path.Clear();
return path;
}
const Path Browser::SaveFile(wchar_t* const filter,Path initial)
{
Path path;
path.Reserve( MAX_PATH*2 );
const Path extension( initial.Extension() );
if (initial.File().Length() && initial.File()[0] != '.')
path = initial.File();
initial.File().Clear();
Object::Pod<OPENFILENAME> ofn;
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = Application::Instance::GetActiveWindow();
ofn.lpstrFile = path.Ptr();
ofn.nMaxFile = path.Capacity();
ofn.lpstrInitialDir = initial.Length() ? initial.Ptr() : L".";
ofn.Flags = OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY;
if (filter)
{
for (uint i=0; filter[i]; ++i)
{
if (filter[i] == '\t')
filter[i] = '\0';
}
ofn.lpstrFilter = filter;
ofn.nFilterIndex = 1;
}
if (extension.Length())
ofn.lpstrDefExt = extension.Ptr();
if (::GetSaveFileName( &ofn ))
path.Validate();
else
path.Clear();
return path;
}
const Path Browser::SelectDirectory()
{
Path path;
path.Reserve( MAX_PATH*2 );
Object::Pod<BROWSEINFO> bi;
bi.hwndOwner = Application::Instance::GetActiveWindow();
bi.pszDisplayName = path.Ptr();
bi.ulFlags = BIF_RETURNONLYFSDIRS;
if (LPITEMIDLIST const idl = ::SHBrowseForFolder( &bi ))
{
if (::SHGetPathFromIDList( idl, path.Ptr() ) && path.Validate())
path.MakePretty( true );
else
path.Clear();
IMalloc* pMalloc;
if (SUCCEEDED(::SHGetMalloc( &pMalloc )))
{
pMalloc->Free( idl );
pMalloc->Release();
}
}
else
{
path.Clear();
}
return path;
}
}
}

View File

@@ -0,0 +1,45 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_DIALOG_BROWSE_H
#define NST_DIALOG_BROWSE_H
#pragma once
#include "NstString.hpp"
namespace Nestopia
{
namespace Window
{
namespace Browser
{
const Path OpenFile(wchar_t*,Path,Path);
const Path SaveFile(wchar_t*,Path=Path());
const Path SelectDirectory();
}
}
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,130 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_DIALOG_CHEATS_H
#define NST_DIALOG_CHEATS_H
#pragma once
#include <set>
#include "NstWindowDialog.hpp"
#include "../core/api/NstApiCheats.hpp"
namespace Nestopia
{
namespace Window
{
class Cheats
{
public:
Cheats(Managers::Emulator&,const Configuration&,const Managers::Paths&);
~Cheats();
enum CodesType
{
PERMANENT_CODES,
TEMPORARY_CODES
};
enum
{
MAX_CODES = 0xFFFF
};
typedef Nes::Cheats::Code NesCode;
struct Code
{
Code();
enum
{
NO_COMPARE = 0xFFFF
};
typedef String::Stack<8,wchar_t> GenieCode;
NesCode ToNesCode() const;
void FromNesCode(const NesCode&);
GenieCode ToGenieCode() const;
bool operator < (const Code&) const;
HeapString description;
uint crc;
ushort address;
ushort compare;
uchar value;
bool enabled;
};
typedef std::set<Code> Codes;
void Open();
void Save(Configuration&) const;
void Flush();
bool Load(const Path&);
bool Save(const Path&) const;
private:
class MainDialog;
struct Searcher
{
Searcher();
enum
{
NO_FILTER = 0xFFFF
};
ushort filter;
uchar a;
uchar b;
uchar ram[Nes::Cheats::RAM_SIZE];
};
static bool Import(Codes&,const Path&);
static bool Export(const Codes&,const Path&);
const Managers::Paths& paths;
Managers::Emulator& emulator;
Codes codes[2];
Searcher searcher;
bool showHexMainDialog;
bool showHexSubDialogs;
public:
const Codes& GetCodes(CodesType type) const
{
return codes[type];
}
};
}
}
#endif

View File

@@ -0,0 +1,164 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstWindowParam.hpp"
#include "NstManagerEmulator.hpp"
#include "NstDialogDipSwitches.hpp"
namespace Nestopia
{
namespace Window
{
NST_COMPILE_ASSERT
(
IDC_DIPSWITCHES_2 == IDC_DIPSWITCHES_1 + 1 &&
IDC_DIPSWITCHES_3 == IDC_DIPSWITCHES_1 + 2 &&
IDC_DIPSWITCHES_4 == IDC_DIPSWITCHES_1 + 3 &&
IDC_DIPSWITCHES_5 == IDC_DIPSWITCHES_1 + 4 &&
IDC_DIPSWITCHES_6 == IDC_DIPSWITCHES_1 + 5 &&
IDC_DIPSWITCHES_7 == IDC_DIPSWITCHES_1 + 6 &&
IDC_DIPSWITCHES_8 == IDC_DIPSWITCHES_1 + 7 &&
IDC_DIPSWITCHES_2_TEXT == IDC_DIPSWITCHES_1_TEXT + 1 &&
IDC_DIPSWITCHES_3_TEXT == IDC_DIPSWITCHES_1_TEXT + 2 &&
IDC_DIPSWITCHES_4_TEXT == IDC_DIPSWITCHES_1_TEXT + 3 &&
IDC_DIPSWITCHES_5_TEXT == IDC_DIPSWITCHES_1_TEXT + 4 &&
IDC_DIPSWITCHES_6_TEXT == IDC_DIPSWITCHES_1_TEXT + 5 &&
IDC_DIPSWITCHES_7_TEXT == IDC_DIPSWITCHES_1_TEXT + 6 &&
IDC_DIPSWITCHES_8_TEXT == IDC_DIPSWITCHES_1_TEXT + 7
);
struct DipSwitches::Handlers
{
static const MsgHandler::Entry<DipSwitches> messages[];
static const MsgHandler::Entry<DipSwitches> commands[];
};
const MsgHandler::Entry<DipSwitches> DipSwitches::Handlers::messages[] =
{
{ WM_INITDIALOG, &DipSwitches::OnInitDialog }
};
const MsgHandler::Entry<DipSwitches> DipSwitches::Handlers::commands[] =
{
{ IDOK, &DipSwitches::OnCmdOk }
};
DipSwitches::DipSwitches(Managers::Emulator& emulator,bool u)
:
dialog (IDD_DIPSWITCHES,this,Handlers::messages,Handlers::commands),
dipSwitches (emulator),
userOpened (u)
{
}
ibool DipSwitches::OnInitDialog(Param&)
{
NST_ASSERT( dipSwitches.NumDips() <= MAX_DIPS );
Point delta;
for (uint i=0, canModify=dipSwitches.CanModify(); i < MAX_DIPS; ++i)
{
Control::ComboBox valueField( dialog.ComboBox(IDC_DIPSWITCHES_1 + i) );
Control::Generic textField( dialog.Control(IDC_DIPSWITCHES_1_TEXT + i) );
if (i < dipSwitches.NumDips())
{
textField.Text() << (HeapString() << dipSwitches.GetDipName(i) << ':').Ptr();
for (uint j=0, n=dipSwitches.NumValues(i); j < n; ++j)
valueField.Add( HeapString(dipSwitches.GetValueName(i,j)).Ptr() );
valueField[dipSwitches.GetValue(i)].Select();
if (!canModify)
{
valueField.Disable();
textField.Disable();
}
}
else
{
if (i == dipSwitches.NumDips())
delta.y = valueField.GetWindow().Coordinates().top;
if (i == MAX_DIPS-1)
delta.y = valueField.GetWindow().Coordinates().bottom - delta.y;
textField.GetWindow().Destroy();
valueField.GetWindow().Destroy();
}
}
for (uint i=IDC_DIPSWITCHES_1_TEXT, n=IDC_DIPSWITCHES_1_TEXT+dipSwitches.NumDips(); i < n; ++i)
{
Control::Generic textField( dialog.Control(i) );
Rect rect( textField.GetWindow().Coordinates() );
rect.right = rect.left + textField.GetMaxTextSize().x;
if (delta.x < rect.right)
delta.x = rect.right;
textField.GetWindow().Size() = rect.Size();
}
delta.x = dialog.ComboBox(IDC_DIPSWITCHES_1).GetWindow().Coordinates().left - delta.x + 12;
for (uint i=IDC_DIPSWITCHES_1, n=IDC_DIPSWITCHES_1+dipSwitches.NumDips(); i < n; ++i)
dialog.Control(i).GetWindow().Position() -= Point(delta.x,0);
dialog.Control(IDC_DIPSWITCHES_GROUP).GetWindow().Size() -= delta;
if (userOpened)
dialog.Control(IDC_DIPSWITCHES_DONTSHOWAGAIN).GetWindow().Destroy();
else
dialog.Control(IDC_DIPSWITCHES_DONTSHOWAGAIN).GetWindow().Position() -= Point(0,delta.y);
dialog.Control(IDOK).GetWindow().Position() -= delta;
dialog.Control(IDCANCEL).GetWindow().Position() -= delta;
dialog.Size() -= delta;
return true;
}
ibool DipSwitches::OnCmdOk(Param& param)
{
if (param.Button().Clicked())
{
if (dipSwitches.CanModify())
{
for (uint i=0, n=dipSwitches.NumDips(); i < n; ++i)
dipSwitches.SetValue( i, dialog.ComboBox( IDC_DIPSWITCHES_1 + i ).Selection().GetIndex() );
}
dialog.Close( userOpened ? 0 : dialog.CheckBox(IDC_DIPSWITCHES_DONTSHOWAGAIN).Checked() );
}
return true;
}
}
}

View File

@@ -0,0 +1,73 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_DIALOG_DIPSWITCHES_H
#define NST_DIALOG_DIPSWITCHES_H
#pragma once
#include "NstWindowDialog.hpp"
#include "../core/api/NstApiDipSwitches.hpp"
namespace Nestopia
{
namespace Window
{
class DipSwitches
{
public:
explicit DipSwitches(Managers::Emulator&,bool);
private:
struct Handlers;
#ifdef IDC_DIPSWITCHES_9
#error Must update dipswitch dialog fields!
#endif
enum
{
MAX_DIPS = IDC_DIPSWITCHES_8+1-IDC_DIPSWITCHES_1
};
ibool OnInitDialog (Param&);
ibool OnCmdOk (Param&);
Dialog dialog;
Nes::DipSwitches dipSwitches;
const bool userOpened;
public:
bool Open()
{
return dipSwitches.NumDips() ? dialog.Open() : false;
}
};
}
}
#endif

View File

@@ -0,0 +1,275 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstApplicationInstance.hpp"
#include "NstWindowUser.hpp"
#include "NstIoStream.hpp"
#include "NstWindowParam.hpp"
#include "NstManagerPaths.hpp"
#include "NstDialogFds.hpp"
#include "../core/api/NstApiFds.hpp"
namespace Nestopia
{
namespace Window
{
struct Fds::Handlers
{
static const MsgHandler::Entry<Fds> messages[];
static const MsgHandler::Entry<Fds> commands[];
};
const MsgHandler::Entry<Fds> Fds::Handlers::messages[] =
{
{ WM_INITDIALOG, &Fds::OnInitDialog }
};
const MsgHandler::Entry<Fds> Fds::Handlers::commands[] =
{
{ IDC_FDS_CLEAR, &Fds::OnCmdClear },
{ IDC_FDS_BROWSE, &Fds::OnCmdBrowse },
{ IDC_FDS_DEFAULT, &Fds::OnCmdDefault },
{ IDOK, &Fds::OnCmdOk }
};
enum
{
BIOS_FILE_TYPES =
(
Managers::Paths::File::ROM |
Managers::Paths::File::INES |
Managers::Paths::File::ARCHIVE
)
};
Fds::Fds(Managers::Emulator& e,const Configuration& cfg,const Managers::Paths& p)
: dialog(IDD_FDS,this,Handlers::messages,Handlers::commands), emulator(e), paths(p)
{
Configuration::ConstSection fds( cfg["paths"]["fds"] );
const GenericString method( fds["save-method"].Str() );
emulator.SetDiskImageSaveMethod
(
( method == L"disabled" ) ? Managers::Emulator::DISKIMAGE_SAVE_DISABLED :
( method == L"image" ) ? Managers::Emulator::DISKIMAGE_SAVE_TO_IMAGE :
Managers::Emulator::DISKIMAGE_SAVE_TO_PATCH
);
const GenericString led( fds["led"].Str() );
settings.led =
(
( led == L"numlock" ) ? LED_NUM_LOCK :
( led == L"capslock" ) ? LED_CAPS_LOCK :
( led == L"scrolllock" ) ? LED_SCROLL_LOCK :
( led == L"disabled" ) ? LED_DISABLED :
LED_SCREEN
);
settings.bios = fds["bios"].Str();
if (settings.bios.Length())
{
settings.bios.MakePretty();
}
else
{
settings.bios = "disksys.rom";
if (!paths.FindFile( settings.bios ))
settings.bios.Clear();
}
if (settings.bios.Length())
SubmitBios();
}
Fds::~Fds()
{
}
void Fds::Save(Configuration& cfg) const
{
Configuration::Section fds( cfg["paths"]["fds"] );
fds["bios"].Str() = settings.bios;
fds["save-method"].Str() =
(
( emulator.GetDiskImageSaveMethod() == Managers::Emulator::DISKIMAGE_SAVE_TO_IMAGE ) ? "image" :
( emulator.GetDiskImageSaveMethod() == Managers::Emulator::DISKIMAGE_SAVE_TO_PATCH ) ? "patch" :
"disabled"
);
fds["led"].Str() =
(
( settings.led == LED_SCREEN ) ? "screen" :
( settings.led == LED_NUM_LOCK ) ? "numlock" :
( settings.led == LED_CAPS_LOCK ) ? "capslock" :
( settings.led == LED_SCROLL_LOCK ) ? "scrolllock" :
"disabled"
);
}
void Fds::QueryBiosFile()
{
if (settings.bios.Empty())
{
settings.bios = paths.BrowseLoad( BIOS_FILE_TYPES );
if (settings.bios.Length())
{
settings.bios.MakePretty();
SubmitBios();
}
}
}
void Fds::SubmitBios()
{
NST_ASSERT( settings.bios.Length() );
Managers::Paths::File file;
if (paths.Load( file, BIOS_FILE_TYPES, Path(Application::Instance::GetFullPath(settings.bios.Directory()),settings.bios.File()), Managers::Paths::QUIETLY ))
{
Io::Stream::In stream( file.data );
if (NES_SUCCEEDED(Nes::Fds(emulator).SetBIOS( &static_cast<std::istream&>(stream) )))
return;
}
settings.bios.Clear();
User::Warn( IDS_FDS_ERR_INVALIDBIOS );
}
ibool Fds::OnInitDialog(Param&)
{
NST_COMPILE_ASSERT
(
Managers::Emulator::DISKIMAGE_SAVE_DISABLED == IDC_FDS_SAVEDISABLE - IDC_FDS_SAVEDISABLE &&
Managers::Emulator::DISKIMAGE_SAVE_TO_IMAGE == IDC_FDS_SAVETOIMAGE - IDC_FDS_SAVEDISABLE &&
Managers::Emulator::DISKIMAGE_SAVE_TO_PATCH == IDC_FDS_SAVETOPATCH - IDC_FDS_SAVEDISABLE
);
if (emulator.IsFdsOn())
{
dialog.Control( IDC_FDS_BIOS ).Disable();
dialog.Control( IDC_FDS_CLEAR ).Disable();
dialog.Control( IDC_FDS_BROWSE ).Disable();
}
dialog.Edit( IDC_FDS_BIOS ) << settings.bios.Ptr();
dialog.RadioButton( IDC_FDS_SAVEDISABLE + emulator.GetDiskImageSaveMethod() ).Check();
const uint id =
(
( settings.led == LED_SCREEN ) ? IDC_FDS_LED_SCREEN :
( settings.led == LED_NUM_LOCK ) ? IDC_FDS_LED_NUMLOCK :
( settings.led == LED_CAPS_LOCK ) ? IDC_FDS_LED_CAPSLOCK :
( settings.led == LED_SCROLL_LOCK ) ? IDC_FDS_LED_SCROLLLOCK :
IDC_FDS_LED_DISABLE
);
dialog.RadioButton( id ).Check();
return true;
}
ibool Fds::OnCmdDefault(Param& param)
{
if (param.Button().Clicked())
{
dialog.RadioButton( IDC_FDS_LED_SCREEN ).Check();
dialog.RadioButton( IDC_FDS_LED_NUMLOCK ).Uncheck();
dialog.RadioButton( IDC_FDS_LED_CAPSLOCK ).Uncheck();
dialog.RadioButton( IDC_FDS_LED_SCROLLLOCK ).Uncheck();
dialog.RadioButton( IDC_FDS_LED_DISABLE ).Uncheck();
dialog.RadioButton( IDC_FDS_SAVETOPATCH ).Check();
dialog.RadioButton( IDC_FDS_SAVETOIMAGE ).Uncheck();
dialog.RadioButton( IDC_FDS_SAVEDISABLE ).Uncheck();
}
return true;
}
ibool Fds::OnCmdClear(Param& param)
{
if (param.Button().Clicked())
dialog.Edit(IDC_FDS_BIOS).Clear();
return true;
}
ibool Fds::OnCmdBrowse(Param& param)
{
if (param.Button().Clicked())
dialog.Edit(IDC_FDS_BIOS).Try() << paths.BrowseLoad( BIOS_FILE_TYPES ).Ptr();
return true;
}
ibool Fds::OnCmdOk(Param& param)
{
if (param.Button().Clicked())
{
emulator.SetDiskImageSaveMethod
(
dialog.RadioButton( IDC_FDS_SAVEDISABLE ).Checked() ? Managers::Emulator::DISKIMAGE_SAVE_DISABLED :
dialog.RadioButton( IDC_FDS_SAVETOPATCH ).Checked() ? Managers::Emulator::DISKIMAGE_SAVE_TO_PATCH :
Managers::Emulator::DISKIMAGE_SAVE_TO_IMAGE
);
settings.led =
(
dialog.RadioButton( IDC_FDS_LED_SCREEN ).Checked() ? LED_SCREEN :
dialog.RadioButton( IDC_FDS_LED_NUMLOCK ).Checked() ? LED_NUM_LOCK :
dialog.RadioButton( IDC_FDS_LED_CAPSLOCK ).Checked() ? LED_CAPS_LOCK :
dialog.RadioButton( IDC_FDS_LED_SCROLLLOCK ).Checked() ? LED_SCROLL_LOCK :
LED_DISABLED
);
Path path;
dialog.Edit( IDC_FDS_BIOS ) >> path;
path.MakePretty();
if (settings.bios != path)
{
settings.bios = path;
if (settings.bios.Empty())
Nes::Fds(emulator).SetBIOS( NULL );
else
SubmitBios();
}
dialog.Close();
}
return true;
}
}
}

View File

@@ -0,0 +1,93 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_DIALOG_FDS_H
#define NST_DIALOG_FDS_H
#pragma once
#include "NstWindowDialog.hpp"
namespace Nestopia
{
namespace Window
{
class Fds
{
public:
Fds(Managers::Emulator&,const Configuration&,const Managers::Paths&);
~Fds();
void Save(Configuration&) const;
void QueryBiosFile();
enum Led
{
LED_DISABLED,
LED_SCREEN,
LED_NUM_LOCK,
LED_CAPS_LOCK,
LED_SCROLL_LOCK
};
private:
struct Handlers;
void SubmitBios();
ibool OnInitDialog (Param&);
ibool OnCmdBrowse (Param&);
ibool OnCmdDefault (Param&);
ibool OnCmdClear (Param&);
ibool OnCmdOk (Param&);
Dialog dialog;
struct
{
Led led;
Path bios;
} settings;
Managers::Emulator& emulator;
const Managers::Paths& paths;
public:
void Open()
{
dialog.Open();
}
Led GetLed() const
{
return settings.led;
}
};
}
}
#endif

View File

@@ -0,0 +1,122 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstWindowDialog.hpp"
#include "NstDialogFind.hpp"
namespace Nestopia
{
namespace Window
{
Finder::Finder(Custom& p)
: parent(p)
{
struct Hook
{
static UINT_PTR CALLBACK FRProc(HWND hWnd,UINT uMsg,WPARAM,LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
{
Generic& window = *reinterpret_cast<Generic*>(reinterpret_cast<FINDREPLACE*>(lParam)->lCustData);
window = hWnd;
::SetWindowLongPtr( hWnd, GWL_USERDATA, reinterpret_cast<LPARAM>(&window) );
Dialog::RegisterModeless( hWnd );
return true;
}
case WM_DESTROY:
*reinterpret_cast<Generic*>(::GetWindowLongPtr( hWnd, GWL_USERDATA )) = NULL;
Dialog::UnregisterModeless( hWnd );
return false;
}
return false;
}
};
if (const uint id = ::RegisterWindowMessage(FINDMSGSTRING))
{
p.Messages().Add( id, this, &Finder::OnMsg );
findReplace.lStructSize = sizeof(findReplace);
findReplace.lpstrFindWhat = NULL;
findReplace.wFindWhatLen = BUFFER_SIZE;
findReplace.lCustData = reinterpret_cast<LPARAM>(&window);
findReplace.lpfnHook = Hook::FRProc;
}
}
void Finder::Close()
{
if (window)
window.Destroy();
}
Finder::~Finder()
{
Close();
delete [] findReplace.lpstrFindWhat;
findReplace.lpstrFindWhat = NULL;
}
void Finder::Open(const Callback& c,const uint flags)
{
NST_VERIFY( findReplace.lStructSize );
if (window == NULL && findReplace.lStructSize)
{
callback = c;
if (findReplace.lpstrFindWhat == NULL)
{
findReplace.lpstrFindWhat = new wchar_t [BUFFER_SIZE+1];
findReplace.lpstrFindWhat[0] = '\0';
}
findReplace.Flags = (flags & (DOWN|WHOLEWORD|MATCHCASE)) | FR_ENABLEHOOK;
findReplace.hwndOwner = parent;
::FindText( &findReplace );
}
}
ibool Finder::OnMsg(Param&)
{
if (findReplace.Flags & FR_DIALOGTERM)
{
Close();
}
else if (findReplace.Flags & FR_FINDNEXT)
{
callback( findReplace.lpstrFindWhat, findReplace.Flags & (FR_WHOLEWORD|FR_MATCHCASE|FR_DOWN) );
}
return true;
}
}
}

View File

@@ -0,0 +1,85 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_DIALOG_FIND_H
#define NST_DIALOG_FIND_H
#pragma once
#include "NstObjectPod.hpp"
#include "NstObjectDelegate.hpp"
#include "NstWindowGeneric.hpp"
#include "NstString.hpp"
#include <CommDlg.h>
namespace Nestopia
{
namespace Window
{
class Custom;
struct Param;
class Finder
{
public:
explicit Finder(Custom&);
~Finder();
enum
{
DOWN = FR_DOWN,
WHOLEWORD = FR_WHOLEWORD,
MATCHCASE = FR_MATCHCASE
};
void Close();
private:
typedef Object::Delegate<void,GenericString,uint> Callback;
void Open(const Callback&,uint);
ibool OnMsg(Param&);
enum {BUFFER_SIZE = 512-1};
Window::Generic window;
const Window::Custom& parent;
Object::Pod<FINDREPLACE> findReplace;
Callback callback;
public:
template<typename Data,typename Code>
void Open(Data* data,Code code,uint dir=DOWN)
{
Open( Callback(data,code), dir );
}
};
}
}
#endif

View File

@@ -0,0 +1,349 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstSystemTimer.hpp"
#include "NstSystemInfo.hpp"
#include "NstWindowParam.hpp"
#include "NstApplicationConfiguration.hpp"
#include "NstDialogFrameClock.hpp"
namespace Nestopia
{
namespace Window
{
struct FrameClock::Handlers
{
static const MsgHandler::Entry<FrameClock> messages[];
static const MsgHandler::Entry<FrameClock> commands[];
};
const MsgHandler::Entry<FrameClock> FrameClock::Handlers::messages[] =
{
{ WM_INITDIALOG, &FrameClock::OnInitDialog },
{ WM_HSCROLL, &FrameClock::OnHScroll }
};
const MsgHandler::Entry<FrameClock> FrameClock::Handlers::commands[] =
{
{ IDC_TIMING_SYNC_REFRESH, &FrameClock::OnCmdRefresh },
{ IDC_TIMING_AUTO_FRAME_SKIP, &FrameClock::OnCmdRefresh },
{ IDC_TIMING_REWINDER, &FrameClock::OnCmdRewinder },
{ IDC_TIMING_DEFAULT_SPEED, &FrameClock::OnCmdDefaultSpeed },
{ IDC_TIMING_REWINDER_DEFAULT_SPEED, &FrameClock::OnCmdRewinder },
{ IDC_TIMING_DEFAULT, &FrameClock::OnCmdDefault },
{ IDOK, &FrameClock::OnCmdOk }
};
FrameClock::FrameClock(const Configuration& cfg,bool mGPU)
: dialog(IDD_TIMING,this,Handlers::messages,Handlers::commands), modernGPU(mGPU)
{
Configuration::ConstSection timing( cfg["timing"] );
{
Configuration::ConstSection autoFrameSkipping( timing["auto-frame-skipping"] );
if (System::Info::GetCpuSpeed() && System::Info::GetCpuSpeed() <= MAX_MHZ_AUTO_FRAME_SKIP_ENABLE)
settings.autoFrameSkip = !autoFrameSkipping["enabled"].No();
else
settings.autoFrameSkip = autoFrameSkipping["enabled"].Yes();
settings.maxFrameSkips = autoFrameSkipping["max-frames"].Int();
settings.maxFrameSkips =
(
settings.maxFrameSkips ? NST_CLAMP(settings.maxFrameSkips,MIN_FRAME_SKIPS,MAX_FRAME_SKIPS) :
DEFAULT_FRAME_SKIPS
);
}
{
Configuration::ConstSection performance( timing["performance"] );
if (!modernGPU || System::Info::GetCpuSpeed() <= MAX_MHZ_TRIPLE_BUFFERING_ENABLE)
settings.tripleBuffering = !performance["triple-buffering"].No();
else
settings.tripleBuffering = performance["triple-buffering"].Yes();
if (!System::Timer::HasPerformanceCounter())
{
settings.pfCounter = false;
}
else if (System::Info::GetCpuCount() == 1)
{
settings.pfCounter = !performance["high-precision-timer"].No();
}
else
{
settings.pfCounter = performance["high-precision-timer"].Yes();
}
settings.vsync = performance["vsync"].Yes();
}
{
Configuration::ConstSection rewinder( timing["rewinder"] );
settings.rewinder = rewinder["enabled"].Yes();
settings.noRewindSound = rewinder["sound"].No();
settings.useDefaultRewindSpeed = !rewinder["use-native-speed"].No();
settings.rewindSpeed = rewinder["speed"].Int();
settings.rewindSpeed =
(
settings.rewindSpeed ? NST_CLAMP(settings.rewindSpeed,MIN_SPEED,MAX_SPEED) :
DEFAULT_REWIND_SPEED
);
}
{
Configuration::ConstSection speed( timing["speed"] );
settings.speed = speed["default-speed"].Int();
settings.speed =
(
settings.speed ? NST_CLAMP(settings.speed,MIN_SPEED,MAX_SPEED) :
DEFAULT_SPEED
);
settings.altSpeed = speed["alt-speed"].Int();
settings.altSpeed =
(
settings.altSpeed ? NST_CLAMP(settings.altSpeed,MIN_SPEED,MAX_SPEED) :
DEFAULT_ALT_SPEED
);
settings.noAltSpeedSound = speed["alt-speed-sound"].No();
settings.useDefaultSpeed = !speed["use-native-speed"].No();
}
}
void FrameClock::Save(Configuration& cfg) const
{
Configuration::Section timing( cfg["timing"] );
{
Configuration::Section rewinder( timing["rewinder"] );
rewinder[ "enabled" ].YesNo() = settings.rewinder;
rewinder[ "use-native-speed" ].YesNo() = settings.useDefaultRewindSpeed;
rewinder[ "speed" ].Int() = settings.rewindSpeed;
rewinder[ "sound" ].YesNo() = !settings.noRewindSound;
}
{
Configuration::Section autoFrameSkipping( timing["auto-frame-skipping"] );
autoFrameSkipping[ "max-frames" ].Int() = settings.maxFrameSkips;
autoFrameSkipping[ "enabled" ].YesNo() = settings.autoFrameSkip;
}
{
Configuration::Section speed( timing["speed"] );
speed[ "default-speed" ].Int() = settings.speed;
speed[ "alt-speed" ].Int() = settings.altSpeed;
speed[ "alt-speed-sound" ].YesNo() = !settings.noAltSpeedSound;
speed[ "use-native-speed" ].YesNo() = settings.useDefaultSpeed;
}
{
Configuration::Section performance( timing["performance"] );
performance[ "vsync" ].YesNo() = settings.vsync;
performance[ "triple-buffering" ].YesNo() = settings.tripleBuffering;
performance[ "high-precision-timer" ].YesNo() = settings.pfCounter;
}
}
void FrameClock::UpdateRewinderEnable() const
{
const bool enabled = dialog.CheckBox( IDC_TIMING_REWINDER ).Checked();
const bool defaultSpeed = dialog.CheckBox( IDC_TIMING_REWINDER_DEFAULT_SPEED ).Checked();
dialog.Control( IDC_TIMING_REWINDER_DEFAULT_SPEED ).Enable( enabled );
dialog.Control( IDC_TIMING_REWINDER_NOSOUND ).Enable( enabled );
dialog.Control( IDC_TIMING_REWINDER_SPEED ).Enable( enabled && !defaultSpeed );
dialog.Control( IDC_TIMING_REWINDER_SPEED_NUM ).Enable( enabled && !defaultSpeed );
}
ibool FrameClock::OnInitDialog(Param&)
{
dialog.Slider ( IDC_TIMING_SPEED ).SetRange ( MIN_SPEED, MAX_SPEED );
dialog.Slider ( IDC_TIMING_SPEED ).Position() = ( settings.speed );
dialog.Slider ( IDC_TIMING_ALT_SPEED ).SetRange ( MIN_SPEED, MAX_SPEED );
dialog.Slider ( IDC_TIMING_ALT_SPEED ).Position() = ( settings.altSpeed );
dialog.Slider ( IDC_TIMING_REWINDER_SPEED ).SetRange ( MIN_SPEED, MAX_SPEED );
dialog.Slider ( IDC_TIMING_REWINDER_SPEED ).Position() = ( settings.rewindSpeed );
dialog.Slider ( IDC_TIMING_FRAME_SKIPS ).SetRange ( MIN_FRAME_SKIPS, MAX_FRAME_SKIPS );
dialog.Slider ( IDC_TIMING_FRAME_SKIPS ).Position() = ( settings.maxFrameSkips );
dialog.RadioButton ( IDC_TIMING_SYNC_REFRESH ).Check ( !settings.autoFrameSkip );
dialog.RadioButton ( IDC_TIMING_AUTO_FRAME_SKIP ).Check ( settings.autoFrameSkip );
dialog.CheckBox ( IDC_TIMING_VSYNC ).Check ( settings.vsync );
dialog.CheckBox ( IDC_TIMING_TRIPLE_BUFFERING ).Check ( settings.tripleBuffering );
dialog.CheckBox ( IDC_TIMING_ALT_SPEED_NOSOUND ).Check ( settings.noAltSpeedSound );
dialog.CheckBox ( IDC_TIMING_REWINDER ).Check ( settings.rewinder );
dialog.CheckBox ( IDC_TIMING_DEFAULT_SPEED ).Check ( settings.useDefaultSpeed );
dialog.CheckBox ( IDC_TIMING_REWINDER_DEFAULT_SPEED ).Check ( settings.useDefaultRewindSpeed );
dialog.CheckBox ( IDC_TIMING_REWINDER_NOSOUND ).Check ( settings.noRewindSound );
dialog.CheckBox ( IDC_TIMING_PFC ).Check ( settings.pfCounter );
dialog.Control ( IDC_TIMING_PFC ).Enable ( System::Timer::HasPerformanceCounter() );
dialog.Control ( IDC_TIMING_FRAME_SKIPS ).Enable ( settings.autoFrameSkip );
dialog.Control ( IDC_TIMING_FRAME_SKIPS_TEXT ).Enable ( settings.autoFrameSkip );
dialog.Control ( IDC_TIMING_FRAME_SKIPS_NUM ).Enable ( settings.autoFrameSkip );
dialog.Control ( IDC_TIMING_SPEED ).Enable ( !settings.useDefaultSpeed );
dialog.Control ( IDC_TIMING_SPEED_NUM ).Enable ( !settings.useDefaultSpeed );
dialog.Edit( IDC_TIMING_SPEED_NUM ) << uint( settings.speed );
dialog.Edit( IDC_TIMING_ALT_SPEED_NUM ) << uint( settings.altSpeed );
dialog.Edit( IDC_TIMING_REWINDER_SPEED_NUM ) << uint( settings.rewindSpeed );
dialog.Edit( IDC_TIMING_FRAME_SKIPS_NUM ) << uint( settings.maxFrameSkips );
UpdateRewinderEnable();
return true;
}
ibool FrameClock::OnHScroll(Param& param)
{
NST_COMPILE_ASSERT
(
IDC_TIMING_SPEED == IDC_TIMING_SPEED_NUM-1 &&
IDC_TIMING_FRAME_SKIPS == IDC_TIMING_FRAME_SKIPS_NUM-1 &&
IDC_TIMING_ALT_SPEED == IDC_TIMING_ALT_SPEED_NUM-1 &&
IDC_TIMING_REWINDER_SPEED == IDC_TIMING_REWINDER_SPEED_NUM-1
);
switch (const uint id = param.Slider().GetId())
{
case IDC_TIMING_SPEED:
case IDC_TIMING_ALT_SPEED:
case IDC_TIMING_REWINDER_SPEED:
case IDC_TIMING_FRAME_SKIPS:
dialog.Edit( id+1 ) << param.Slider().Scroll();
break;
}
return true;
}
ibool FrameClock::OnCmdRefresh(Param& param)
{
if (param.Button().Clicked())
{
const bool autoFrameSkip = (param.Button().GetId() == IDC_TIMING_AUTO_FRAME_SKIP);
dialog.Control( IDC_TIMING_FRAME_SKIPS ).Enable( autoFrameSkip );
dialog.Control( IDC_TIMING_FRAME_SKIPS_TEXT ).Enable( autoFrameSkip );
dialog.Control( IDC_TIMING_FRAME_SKIPS_NUM ).Enable( autoFrameSkip );
}
return true;
}
ibool FrameClock::OnCmdDefaultSpeed(Param& param)
{
if (param.Button().Clicked())
{
const bool speed = dialog.CheckBox( IDC_TIMING_DEFAULT_SPEED ).Unchecked();
dialog.Control( IDC_TIMING_SPEED ).Enable( speed );
dialog.Control( IDC_TIMING_SPEED_NUM ).Enable( speed );
}
return true;
}
ibool FrameClock::OnCmdRewinder(Param& param)
{
if (param.Button().Clicked())
UpdateRewinderEnable();
return true;
}
ibool FrameClock::OnCmdDefault(Param& param)
{
if (param.Button().Clicked())
{
dialog.Slider ( IDC_TIMING_SPEED ).Position() = DEFAULT_SPEED;
dialog.Slider ( IDC_TIMING_ALT_SPEED ).Position() = DEFAULT_ALT_SPEED;
dialog.Slider ( IDC_TIMING_REWINDER_SPEED ).Position() = DEFAULT_REWIND_SPEED;
dialog.Slider ( IDC_TIMING_FRAME_SKIPS ).Position() = DEFAULT_FRAME_SKIPS;
dialog.RadioButton ( IDC_TIMING_SYNC_REFRESH ).Check ( true );
dialog.RadioButton ( IDC_TIMING_AUTO_FRAME_SKIP ).Check ( System::Info::GetCpuSpeed() && System::Info::GetCpuSpeed() <= MAX_MHZ_AUTO_FRAME_SKIP_ENABLE );
dialog.CheckBox ( IDC_TIMING_VSYNC ).Check ( false );
dialog.CheckBox ( IDC_TIMING_TRIPLE_BUFFERING ).Check ( !modernGPU || System::Info::GetCpuSpeed() <= MAX_MHZ_TRIPLE_BUFFERING_ENABLE );
dialog.CheckBox ( IDC_TIMING_DEFAULT_SPEED ).Check ( true );
dialog.CheckBox ( IDC_TIMING_ALT_SPEED_NOSOUND ).Check ( false );
dialog.CheckBox ( IDC_TIMING_REWINDER ).Check ( false );
dialog.CheckBox ( IDC_TIMING_REWINDER_DEFAULT_SPEED ).Check ( true );
dialog.CheckBox ( IDC_TIMING_REWINDER_NOSOUND ).Check ( false );
dialog.CheckBox ( IDC_TIMING_PFC ).Check ( System::Timer::HasPerformanceCounter() && System::Info::GetCpuCount() == 1 );
dialog.Control ( IDC_TIMING_PFC ).Enable ( System::Timer::HasPerformanceCounter() );
dialog.Control ( IDC_TIMING_FRAME_SKIPS ).Enable ( false );
dialog.Control ( IDC_TIMING_FRAME_SKIPS_TEXT ).Enable ( false );
dialog.Control ( IDC_TIMING_FRAME_SKIPS_NUM ).Enable ( false );
dialog.Control ( IDC_TIMING_SPEED ).Enable ( false );
dialog.Control ( IDC_TIMING_SPEED_NUM ).Enable ( false );
dialog.Edit ( IDC_TIMING_SPEED_NUM ) << uint(DEFAULT_SPEED);
dialog.Edit ( IDC_TIMING_ALT_SPEED_NUM ) << uint(DEFAULT_ALT_SPEED);
dialog.Edit ( IDC_TIMING_REWINDER_SPEED_NUM ) << uint(DEFAULT_REWIND_SPEED);
dialog.Edit ( IDC_TIMING_FRAME_SKIPS_NUM ) << uint(DEFAULT_FRAME_SKIPS);
UpdateRewinderEnable();
}
return true;
}
ibool FrameClock::OnCmdOk(Param& param)
{
if (param.Button().Clicked())
{
settings.autoFrameSkip = dialog.RadioButton ( IDC_TIMING_AUTO_FRAME_SKIP ).Checked();
settings.vsync = dialog.CheckBox ( IDC_TIMING_VSYNC ).Checked();
settings.tripleBuffering = dialog.CheckBox ( IDC_TIMING_TRIPLE_BUFFERING ).Checked();
settings.rewinder = dialog.CheckBox ( IDC_TIMING_REWINDER ).Checked();
settings.useDefaultSpeed = dialog.CheckBox ( IDC_TIMING_DEFAULT_SPEED ).Checked();
settings.useDefaultRewindSpeed = dialog.CheckBox ( IDC_TIMING_REWINDER_DEFAULT_SPEED ).Checked();
settings.noAltSpeedSound = dialog.CheckBox ( IDC_TIMING_ALT_SPEED_NOSOUND ).Checked();
settings.noRewindSound = dialog.CheckBox ( IDC_TIMING_REWINDER_NOSOUND ).Checked();
settings.pfCounter = dialog.CheckBox ( IDC_TIMING_PFC ).Checked();
settings.speed = dialog.Slider ( IDC_TIMING_SPEED ).Position();
settings.altSpeed = dialog.Slider ( IDC_TIMING_ALT_SPEED ).Position();
settings.rewindSpeed = dialog.Slider ( IDC_TIMING_REWINDER_SPEED ).Position();
settings.maxFrameSkips = dialog.Slider ( IDC_TIMING_FRAME_SKIPS ).Position();
dialog.Close();
}
return true;
}
}
}

View File

@@ -0,0 +1,169 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_DIALOG_FRAMECLOCK_H
#define NST_DIALOG_FRAMECLOCK_H
#pragma once
#include "NstWindowDialog.hpp"
#include "NstManagerEmulator.hpp"
#include "../core/api/NstApiMachine.hpp"
namespace Nestopia
{
namespace Window
{
class FrameClock
{
public:
FrameClock(const Configuration&,bool);
void Save(Configuration&) const;
private:
struct Handlers;
enum
{
MIN_SPEED = 30,
MAX_SPEED = 240,
MIN_FRAME_SKIPS = 1,
MAX_FRAME_SKIPS = 16,
DEFAULT_SPEED = Nes::Machine::CLK_NTSC_DOT / Nes::Machine::CLK_NTSC_VSYNC,
DEFAULT_ALT_SPEED = DEFAULT_SPEED * 2,
DEFAULT_REWIND_SPEED = DEFAULT_SPEED,
DEFAULT_FRAME_SKIPS = 8,
MAX_MHZ_TRIPLE_BUFFERING_ENABLE = 1350,
MAX_MHZ_AUTO_FRAME_SKIP_ENABLE = 950
};
void UpdateRewinderEnable() const;
ibool OnInitDialog (Param&);
ibool OnHScroll (Param&);
ibool OnCmdRefresh (Param&);
ibool OnCmdDefaultSpeed (Param&);
ibool OnCmdRewinder (Param&);
ibool OnCmdDefault (Param&);
ibool OnCmdOk (Param&);
struct
{
bool autoFrameSkip;
bool vsync;
bool tripleBuffering;
bool rewinder;
bool useDefaultSpeed;
bool useDefaultRewindSpeed;
bool noAltSpeedSound;
bool noRewindSound;
bool pfCounter;
uchar speed;
uchar altSpeed;
uchar rewindSpeed;
uchar maxFrameSkips;
} settings;
Dialog dialog;
const bool modernGPU;
public:
void Open()
{
dialog.Open();
}
uint UsePerformanceCounter() const
{
return settings.pfCounter;
}
bool UseAutoFrameSkip() const
{
return settings.autoFrameSkip;
}
bool UseVSync() const
{
return settings.vsync;
}
bool UseTrippleBuffering() const
{
return settings.tripleBuffering;
}
bool UseRewinder() const
{
return settings.rewinder;
}
bool UseDefaultSpeed() const
{
return settings.useDefaultSpeed;
}
bool UseDefaultRewindSpeed() const
{
return settings.useDefaultRewindSpeed;
}
bool NoRewindSound() const
{
return settings.noRewindSound;
}
bool NoAltSpeedSound() const
{
return settings.noAltSpeedSound;
}
uint GetSpeed() const
{
return settings.speed;
}
uint GetAltSpeed() const
{
return settings.altSpeed;
}
uint GetRewindSpeed() const
{
return settings.rewindSpeed;
}
uint GetMaxFrameSkips() const
{
return settings.maxFrameSkips;
}
};
}
}
#endif

View File

@@ -0,0 +1,226 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "resource/resource.h"
#include "NstWindowParam.hpp"
#include "NstWindowUser.hpp"
#include "NstIoStream.hpp"
#include "NstResourceFile.hpp"
#include "NstManagerPaths.hpp"
#include "NstApplicationInstance.hpp"
#include "NstDialogImageDatabase.hpp"
#include "../core/api/NstApiCartridge.hpp"
namespace Nestopia
{
namespace Window
{
struct ImageDatabase::Handlers
{
static const MsgHandler::Entry<ImageDatabase> messages[];
static const MsgHandler::Entry<ImageDatabase> commands[];
};
const MsgHandler::Entry<ImageDatabase> ImageDatabase::Handlers::messages[] =
{
{ WM_INITDIALOG, &ImageDatabase::OnInitDialog }
};
const MsgHandler::Entry<ImageDatabase> ImageDatabase::Handlers::commands[] =
{
{ IDC_IMAGEDATABASE_EXTERNAL, &ImageDatabase::OnCmdExternal },
{ IDC_IMAGEDATABASE_CLEAR, &ImageDatabase::OnCmdClear },
{ IDC_IMAGEDATABASE_BROWSE, &ImageDatabase::OnCmdBrowse },
{ IDC_IMAGEDATABASE_DEFAULT, &ImageDatabase::OnCmdDefault },
{ IDOK, &ImageDatabase::OnCmdOk }
};
ImageDatabase::ImageDatabase(Managers::Emulator& e,const Configuration& cfg,const Managers::Paths& p)
:
dialog (IDD_IMAGE_DATABASE,this,Handlers::messages,Handlers::commands),
emulator (e),
paths (p)
{
Configuration::ConstSection database( cfg["image-database"] );
settings.internal = !database["internal"].No();
settings.external = database["external"].Yes();
settings.file = database["file"].Str();
Nes::Cartridge(emulator).GetDatabase().Enable();
Update(false);
}
ImageDatabase::~ImageDatabase()
{
}
void ImageDatabase::Save(Configuration& cfg) const
{
Configuration::Section database( cfg["image-database"] );
database["internal"].YesNo() = settings.internal;
database["external"].YesNo() = settings.external;
database["file"].Str() = settings.file;
}
void ImageDatabase::Update(const bool reportError)
{
try
{
Application::Instance::Waiter wait;
Nes::Cartridge(emulator).GetDatabase().Unload();
if (settings.internal || settings.external)
{
Collection::Buffer internal;
if (settings.internal)
Resource::File( IDR_IMAGEDATABASE, L"ImageDatabase" ).Uncompress( internal );
if (settings.external && settings.file.Empty())
settings.external = false;
if (settings.external && internal.Size())
{
Io::Stream::In stream0( Application::Instance::GetFullPath(settings.file) );
Io::Stream::In stream1( internal );
if (NES_FAILED(Nes::Cartridge(emulator).GetDatabase().Load( stream0, stream1 )))
throw 1;
}
else if (settings.external)
{
Io::Stream::In stream( Application::Instance::GetFullPath(settings.file) );
if (NES_FAILED(Nes::Cartridge(emulator).GetDatabase().Load( stream )))
throw 1;
}
else if (internal.Size())
{
Io::Stream::In stream( internal );
if (NES_FAILED(Nes::Cartridge(emulator).GetDatabase().Load( stream )))
throw 1;
}
}
}
catch (...)
{
settings.external = false;
if (reportError)
Window::User::Fail( IDS_EXT_DATABASE_LOAD_FAILED );
else
Window::User::Warn( IDS_EXT_DATABASE_LOAD_FAILED );
}
}
ibool ImageDatabase::OnInitDialog(Param&)
{
dialog.CheckBox( IDC_IMAGEDATABASE_INTERNAL ).Check( settings.internal );
dialog.CheckBox( IDC_IMAGEDATABASE_EXTERNAL ).Check( settings.external );
dialog.Edit( IDC_IMAGEDATABASE_FILE ) << settings.file.Ptr();
UpdateAvailibility();
return true;
}
void ImageDatabase::UpdateAvailibility() const
{
const bool external = dialog.CheckBox( IDC_IMAGEDATABASE_EXTERNAL ).Checked();
dialog.Edit( IDC_IMAGEDATABASE_FILE ).Enable( external );
dialog.Edit( IDC_IMAGEDATABASE_BROWSE ).Enable( external );
dialog.Edit( IDC_IMAGEDATABASE_CLEAR ).Enable( external );
}
ibool ImageDatabase::OnCmdExternal(Param& param)
{
if (param.Button().Clicked())
UpdateAvailibility();
return true;
}
ibool ImageDatabase::OnCmdClear(Param& param)
{
if (param.Button().Clicked())
dialog.Edit( IDC_IMAGEDATABASE_FILE ).Clear();
return true;
}
ibool ImageDatabase::OnCmdBrowse(Param& param)
{
if (param.Button().Clicked())
{
Path tmp;
dialog.Edit( IDC_IMAGEDATABASE_FILE ).Text() >> tmp;
dialog.Edit( IDC_IMAGEDATABASE_FILE ).Try() << paths.BrowseLoad( Managers::Paths::File::XML ).Ptr();
}
return true;
}
ibool ImageDatabase::OnCmdDefault(Param& param)
{
if (param.Button().Clicked())
{
dialog.CheckBox( IDC_IMAGEDATABASE_INTERNAL ).Check( true );
dialog.CheckBox( IDC_IMAGEDATABASE_EXTERNAL ).Check( false );
UpdateAvailibility();
}
return true;
}
ibool ImageDatabase::OnCmdOk(Param& param)
{
if (param.Button().Clicked())
{
const bool oldInternal = settings.internal;
const bool oldExternal = settings.external;
settings.internal = dialog.CheckBox( IDC_IMAGEDATABASE_INTERNAL ).Checked();
settings.external = dialog.CheckBox( IDC_IMAGEDATABASE_EXTERNAL ).Checked();
const Path oldFile(settings.file);
dialog.Edit(IDC_IMAGEDATABASE_FILE) >> settings.file;
if ((settings.internal != oldInternal || settings.external != oldExternal) || (settings.external && settings.file != oldFile))
Update(false);
dialog.Close();
}
return true;
}
}
}

View File

@@ -0,0 +1,80 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_DIALOG_IMAGEDATABASE_H
#define NST_DIALOG_IMAGEDATABASE_H
#pragma once
#include "NstWindowDialog.hpp"
namespace Nestopia
{
namespace Window
{
class ImageDatabase
{
public:
explicit ImageDatabase(Managers::Emulator&,const Configuration&,const Managers::Paths&);
~ImageDatabase();
void Save(Configuration&) const;
private:
struct Handlers;
void Update(bool);
void UpdateAvailibility() const;
ibool OnInitDialog (Param&);
ibool OnCmdExternal (Param&);
ibool OnCmdBrowse (Param&);
ibool OnCmdClear (Param&);
ibool OnCmdDefault (Param&);
ibool OnCmdOk (Param&);
Dialog dialog;
Managers::Emulator& emulator;
const Managers::Paths& paths;
struct
{
Path file;
bool internal;
bool external;
} settings;
public:
void Open()
{
dialog.Open();
}
};
}
}
#endif

View File

@@ -0,0 +1,370 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstWindowParam.hpp"
#include "NstResourceString.hpp"
#include "NstManagerEmulator.hpp"
#include "NstDialogImageInfo.hpp"
#include "../core/api/NstApiCartridge.hpp"
#include "../core/api/NstApiFds.hpp"
#include "../core/api/NstApiNsf.hpp"
namespace Nestopia
{
namespace Window
{
ImageInfo::ImageInfo(Managers::Emulator& e)
:
dialog (IDD_IMAGE_INFO,WM_INITDIALOG,this,&ImageInfo::OnInitDialog),
emulator (e)
{
}
ibool ImageInfo::OnInitDialog(Param&)
{
struct Table
{
static void Tab(HeapString* const strings,const uint count,const bool fixed)
{
if (fixed)
{
uint maxTab = 0;
for (uint i=0; i < count; ++i)
maxTab = NST_MAX(maxTab,strings[i].Length());
maxTab += 2;
for (uint i=0; i < count; ++i)
{
if (uint pos = strings[i].Length())
{
strings[i].Resize( maxTab );
strings[i][pos] = ':';
while (++pos < maxTab)
strings[i][pos] = ' ';
}
}
}
else for (uint i=0; i < count; ++i)
{
if (strings[i].Length())
strings[i] << ": ";
}
}
static void Output(HeapString& output,HeapString* const strings,const uint count)
{
for (uint i=0; i < count; ++i)
{
if (strings[i].Length())
{
output << strings[i];
if (i < count-1)
output << "\r\n";
}
}
}
};
HeapString text;
const bool fixedFont = dialog.Edit(IDC_IMAGE_INFO_EDIT).FixedFont();
if (emulator.IsCart())
{
typedef Nes::Cartridge::Profile Profile;
enum
{
SP_H = Profile::Board::SOLDERPAD_H,
SP_V = Profile::Board::SOLDERPAD_V
};
const Profile& profile = *Nes::Cartridge(emulator).GetProfile();
HeapString types[] =
{
!profile.game.title.empty() ? Resource::String( IDS_TEXT_NAME ) : HeapString(),
!profile.game.altTitle.empty() ? Resource::String( IDS_TEXT_ALTNAME ) : HeapString(),
!profile.game.publisher.empty() ? Resource::String( IDS_TEXT_PUBLISHER ) : HeapString(),
!profile.game.developer.empty() ? Resource::String( IDS_TEXT_DEVELOPER ) : HeapString(),
!profile.game.region.empty() ? Resource::String( IDS_TEXT_REGION ) : HeapString(),
profile.game.players ? Resource::String( IDS_TEXT_PLAYERS ) : HeapString(),
Resource::String( IDS_TEXT_FILE ),
Resource::String( IDS_TEXT_DIRECTORY ),
Resource::String( IDS_TEXT_SOFTPATCHED ),
"CRC",
"SHA-1",
Resource::String( IDS_TEXT_SYSTEM ),
Resource::String( IDS_TEXT_BOARD ),
profile.board.GetPrg() ? "PRG-ROM" : HeapString(),
profile.board.GetChr() ? "CHR-ROM" : HeapString(),
profile.board.GetVram() ? "V-RAM" : HeapString(),
profile.board.GetWram() ? "W-RAM" : HeapString(),
!profile.board.chips.empty() ? Resource::String( IDS_TEXT_CHIPS ) : HeapString(),
profile.board.solderPads & (SP_H|SP_V) ? Resource::String( IDS_TEXT_SOLDERPAD ) : HeapString(),
Resource::String( IDS_TEXT_BATTERY ),
profile.board.HasBattery() ? Resource::String( IDS_TEXT_FILE ) : HeapString(),
profile.board.HasBattery() ? Resource::String( IDS_TEXT_DIRECTORY ) : HeapString(),
Resource::String( IDS_TEXT_DUMP )
};
Table::Tab( types, sizeof(array(types)), fixedFont );
if (!profile.game.title.empty())
types[0] << profile.game.title.c_str();
if (!profile.game.title.empty())
types[1] << profile.game.altTitle.c_str();
if (!profile.game.publisher.empty())
types[2] << profile.game.publisher.c_str();
if (!profile.game.developer.empty())
types[3] << profile.game.developer.c_str();
if (!profile.game.region.empty())
types[4] << profile.game.region.c_str();
if (profile.game.players)
types[5] << profile.game.players;
types[6] << emulator.GetImagePath().File();
types[7] << emulator.GetImagePath().Directory();
types[8] << Resource::String( profile.patched ? IDS_TEXT_YES : IDS_TEXT_NO );;
{
char sha1[41] = {0};
char crc32[9] = {0};
profile.hash.Get( sha1, crc32 );
types[9] << crc32;
types[10] << sha1;
}
types[11] << Resource::String
(
profile.system.type == Profile::System::VS_UNISYSTEM ? IDS_TEXT_VSUNISYSTEM :
profile.system.type == Profile::System::VS_DUALSYSTEM ? IDS_TEXT_VSDUALSYSTEM :
profile.system.type == Profile::System::PLAYCHOICE_10 ? IDS_TEXT_PLAYCHOICE10 :
profile.system.type == Profile::System::NES_PAL ? IDS_TEXT_NES_PAL :
profile.system.type == Profile::System::NES_PAL_A ? IDS_TEXT_NES_PAL_A :
profile.system.type == Profile::System::NES_PAL_B ? IDS_TEXT_NES_PAL_B :
profile.system.type == Profile::System::FAMICOM ? IDS_TEXT_FAMICOM :
profile.system.type == Profile::System::DENDY ? IDS_TEXT_DENDY :
IDS_TEXT_NES_NTSC
);
types[12] << profile.board.type.c_str();
if (profile.board.mapper && profile.board.mapper != Profile::Board::NO_MAPPER)
types[12] << ", " << Resource::String( IDS_TEXT_MAPPER ) << ' ' << profile.board.mapper;
if (const uint prg = profile.board.GetPrg())
types[13] << (prg % 1024 ? prg : prg / 1024) << (prg % 1024 ? " bytes" : "k");
if (const uint chr = profile.board.GetChr())
types[14] << (chr % 1024 ? chr : chr / 1024) << (chr % 1024 ? " bytes" : "k");
if (const uint vram = profile.board.GetVram())
types[15] << (vram % 1024 ? vram : vram / 1024) << (vram % 1024 ? " bytes" : "k");
if (const uint wram = profile.board.GetWram())
types[16] << (wram % 1024 ? wram : wram / 1024) << (wram % 1024 ? " bytes" : "k");
for (uint i=0, n=profile.board.chips.size(); i < n; ++i)
{
if (i)
types[17] << ", ";
types[17] << profile.board.chips[i].type.c_str();
}
if (profile.board.solderPads & (SP_H|SP_V))
{
types[18] << "H:" << ((profile.board.solderPads & SP_H) ? '1' : '0')
<< " V:" << ((profile.board.solderPads & SP_V) ? '1' : '0');
}
types[19] << Resource::String( profile.board.HasBattery() ? IDS_TEXT_YES : IDS_TEXT_NO );
if (profile.board.HasBattery())
{
types[20] << emulator.GetSavePath().File();
types[21] << emulator.GetSavePath().Directory();
}
types[22] << Resource::String
(
profile.dump.state == Profile::Dump::OK ? IDS_TEXT_OK :
profile.dump.state == Profile::Dump::BAD ? IDS_TEXT_BAD :
IDS_TEXT_UNKNOWN
);
Table::Output( text, types, sizeof(array(types)) );
}
else if (emulator.IsFds())
{
const Nes::Fds fds(emulator);
std::vector<HeapString> types( 3 + NST_MAX(fds.GetNumSides()/2,1) );
types[0] = Resource::String( IDS_TEXT_FILE );
types[1] = Resource::String( IDS_TEXT_DIRECTORY );
types[2] = Resource::String( IDS_TEXT_HEADER );
for (uint i=3, n=types.size(); i < n; ++i)
types[i] = Resource::String( IDS_TEXT_DISK ).Invoke( i-3+1 );
Table::Tab( &types.front(), types.size(), fixedFont );
types[0] << emulator.GetImagePath().File();
types[1] << emulator.GetImagePath().Directory();
types[2] << Resource::String( fds.HasHeader() ? IDS_TEXT_YES : IDS_TEXT_NO );
for (uint i=0, n=fds.GetNumSides(); i < n; ++i)
{
Nes::Fds::DiskData data;
fds.GetDiskData( i, data );
uint size = 0;
for (Nes::Fds::DiskData::Files::const_iterator it(data.files.begin()), end(data.files.end()); it != end; ++it)
size += it->data.size();
types[3+i/2] << (i % 2 ? ", B: " : "A: ")
<< (size / 1024)
<< "k "
<< Resource::String( IDS_TEXT_IN_FILES ).Invoke( data.files.size() );
if (!data.raw.empty())
types[3+i/2] << ", " << Resource::String( IDS_TEXT_TRAILING_DATA ).Invoke( data.raw.size() );
}
Table::Output( text, &types.front(), types.size() );
}
else if (emulator.IsNsf())
{
const Nes::Nsf nsf(emulator);
HeapString types[] =
{
Resource::String( IDS_TEXT_FILE ),
Resource::String( IDS_TEXT_DIRECTORY ),
*nsf.GetName() ? Resource::String( IDS_TEXT_NAME ) : HeapString(),
*nsf.GetArtist() ? Resource::String( IDS_TEXT_ARTIST ) : HeapString(),
*nsf.GetCopyright() ? Resource::String( IDS_TEXT_COPYRIGHT ) : HeapString(),
Resource::String( IDS_TEXT_REGION ),
Resource::String( IDS_TEXT_SONGS ),
nsf.GetNumSongs() > 1 ? Resource::String( IDS_TEXT_STARTINGSONG ) : HeapString(),
Resource::String( IDS_TEXT_EXTRACHIPS ),
Resource::String( IDS_TEXT_BANKSWITCHING ),
Resource::String( IDS_TEXT_LOADADDRESS ),
Resource::String( IDS_TEXT_INITADDRESS ),
Resource::String( IDS_TEXT_PLAYADDRESS )
};
Table::Tab( types, sizeof(array(types)), fixedFont );
types[0] << emulator.GetImagePath().File();
types[1] << emulator.GetImagePath().Directory();
if (*nsf.GetName())
types[2].Import( nsf.GetName() );
if (*nsf.GetArtist())
types[3].Import( nsf.GetArtist() );
if (*nsf.GetCopyright())
types[4].Import( nsf.GetCopyright() );
types[5] <<
(
nsf.GetMode() == Nes::Nsf::TUNE_MODE_NTSC ? "NTSC" :
nsf.GetMode() == Nes::Nsf::TUNE_MODE_PAL ? "PAL" :
"NTSC/PAL"
);
types[6] << nsf.GetNumSongs();
if (nsf.GetNumSongs() > 1)
types[7] << (nsf.GetStartingSong() + 1);
if (const uint chips = nsf.GetChips())
{
cstring c = "";
if ( chips & Nes::Nsf::CHIP_MMC5 ) { types[8] << "MMC5"; c = "+"; }
if ( chips & Nes::Nsf::CHIP_VRC6 ) { types[8] << c << "VRC6"; c = "+"; }
if ( chips & Nes::Nsf::CHIP_VRC7 ) { types[8] << c << "VRC7"; c = "+"; }
if ( chips & Nes::Nsf::CHIP_N163 ) { types[8] << c << "N163"; c = "+"; }
if ( chips & Nes::Nsf::CHIP_S5B ) { types[8] << c << "Sunsoft5B"; c = "+"; }
if ( chips & Nes::Nsf::CHIP_FDS ) { types[8] << c << "FDS"; c = "+"; }
}
else
{
types[8] << Resource::String( IDS_TEXT_NO );
}
types[9] << Resource::String( nsf.UsesBankSwitching() ? IDS_TEXT_YES : IDS_TEXT_NO );
types[10] << HexString( 16, nsf.GetLoadAddress() );
types[11] << HexString( 16, nsf.GetInitAddress() );
types[12] << HexString( 16, nsf.GetPlayAddress() );
Table::Output( text, types, sizeof(array(types)) );
}
if (text.Length())
{
dialog.Edit(IDC_IMAGE_INFO_EDIT) << text.Ptr();
Point size( dialog.Edit(IDC_IMAGE_INFO_EDIT).GetMaxTextSize() );
Point delta( dialog.Edit(IDC_IMAGE_INFO_EDIT).GetWindow().Size() );
if (size.x > delta.x)
{
size.x = delta.x;
size.y += ::GetSystemMetrics(SM_CXVSCROLL);
::ShowScrollBar( dialog.Control(IDC_IMAGE_INFO_EDIT).GetWindow(), SB_HORZ, true );
}
if (size != delta)
{
dialog.Edit(IDC_IMAGE_INFO_EDIT).GetWindow().Size() = size;
delta -= size;
dialog.Control(IDOK).GetWindow().Position() -= delta;
dialog.Size() -= delta;
}
}
return true;
}
}
}

View File

@@ -0,0 +1,60 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_DIALOG_IMAGEINFO_H
#define NST_DIALOG_IMAGEINFO_H
#pragma once
#include "NstWindowDialog.hpp"
namespace Nestopia
{
namespace Window
{
class ImageInfo
{
public:
explicit ImageInfo(Managers::Emulator&);
private:
ibool OnInitDialog (Param&);
ibool OnCmdOk (Param&);
Dialog dialog;
Managers::Emulator& emulator;
public:
void Open()
{
dialog.Open();
}
};
}
}
#endif

View File

@@ -0,0 +1,723 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include <new>
#include "NstWindowParam.hpp"
#include "NstWindowUser.hpp"
#include "NstResourceString.hpp"
#include "NstIoFile.hpp"
#include "NstManagerPaths.hpp"
#include "../core/api/NstApiCartridge.hpp"
#include "NstDialogInesHeader.hpp"
namespace Nestopia
{
namespace Window
{
class InesHeader::CustomSize
{
public:
explicit CustomSize(uint&);
private:
struct Handlers;
ibool OnInitDialog (Param&);
ibool OnCmdOk (Param&);
uint& size;
Dialog dialog;
public:
void Open()
{
dialog.Open();
}
};
struct InesHeader::Handlers
{
static const MsgHandler::Entry<InesHeader> messages[];
static const MsgHandler::Entry<InesHeader> commands[];
};
const MsgHandler::Entry<InesHeader> InesHeader::Handlers::messages[] =
{
{ WM_INITDIALOG, &InesHeader::OnInitDialog },
};
const MsgHandler::Entry<InesHeader> InesHeader::Handlers::commands[] =
{
{ IDC_INES_HEADER_TYPE_STD, &InesHeader::OnCmdFileType },
{ IDC_INES_HEADER_TYPE_EXT, &InesHeader::OnCmdFileType },
{ IDC_INES_HEADER_PRGROM_LIST, &InesHeader::OnCmdSizeOther },
{ IDC_INES_HEADER_PRGRAM_LIST, &InesHeader::OnCmdSizeOther },
{ IDC_INES_HEADER_CHRROM_LIST, &InesHeader::OnCmdSizeOther },
{ IDC_INES_HEADER_SYSTEM_HOME, &InesHeader::OnCmdSystem },
{ IDC_INES_HEADER_SYSTEM_VS, &InesHeader::OnCmdSystem },
{ IDC_INES_HEADER_SYSTEM_PC10, &InesHeader::OnCmdSystem },
{ IDC_INES_HEADER_UNDOALL, &InesHeader::OnCmdUndoAll },
{ IDC_INES_HEADER_SAVE, &InesHeader::OnCmdSave }
};
InesHeader::InesHeader(const Managers::Paths& p)
: dialog(IDD_INES_HEADER,this,Handlers::messages,Handlers::commands), paths(p) {}
uint InesHeader::Import(const Path& loadPath,Collection::Buffer& buffer)
{
NST_ASSERT( buffer.Empty() );
try
{
Io::File file( loadPath, Io::File::COLLECT );
if (file.Size() >= HEADER_SIZE && file.Peek32() == HEADER_ID)
{
file.Stream() >> buffer;
return 0;
}
else
{
return IDS_FILE_ERR_INVALID;
}
}
catch (Io::File::Exception ids)
{
return ids;
}
catch (const std::bad_alloc&)
{
return IDS_ERR_OUT_OF_MEMORY;
}
catch (...)
{
return IDS_ERR_GENERIC;
}
}
uint InesHeader::Export(const Path& savePath,const Collection::Buffer& buffer)
{
NST_ASSERT( buffer.Size() >= HEADER_SIZE );
try
{
Io::File file( savePath, Io::File::READ|Io::File::WRITE );
if (file.Size() == 0 || file.Peek32() == HEADER_ID)
{
file.Stream() << buffer;
return 0;
}
else
{
return IDS_FILE_ERR_INVALID;
}
}
catch (Io::File::Exception i)
{
return i;
}
catch (const std::bad_alloc&)
{
return IDS_ERR_OUT_OF_MEMORY;
}
catch (...)
{
return IDS_ERR_GENERIC;
}
}
void InesHeader::Open(const Path& p)
{
if (p.Length())
{
{
Collection::Buffer buffer;
if (const uint result = Import( p, buffer ))
{
User::Fail( result );
return;
}
std::memcpy( header, buffer.Ptr(), HEADER_SIZE );
}
path = &p;
dialog.Open();
}
}
ibool InesHeader::OnInitDialog(Param&)
{
NST_COMPILE_ASSERT
(
Nes::Cartridge::Profile::System::PPU_RP2C02 == 0 &&
Nes::Cartridge::Profile::System::PPU_RP2C03B == 1 &&
Nes::Cartridge::Profile::System::PPU_RP2C03G == 2 &&
Nes::Cartridge::Profile::System::PPU_RP2C04_0001 == 3 &&
Nes::Cartridge::Profile::System::PPU_RP2C04_0002 == 4 &&
Nes::Cartridge::Profile::System::PPU_RP2C04_0003 == 5 &&
Nes::Cartridge::Profile::System::PPU_RP2C04_0004 == 6 &&
Nes::Cartridge::Profile::System::PPU_RC2C03B == 7 &&
Nes::Cartridge::Profile::System::PPU_RC2C03C == 8 &&
Nes::Cartridge::Profile::System::PPU_RC2C05_01 == 9 &&
Nes::Cartridge::Profile::System::PPU_RC2C05_02 == 10 &&
Nes::Cartridge::Profile::System::PPU_RC2C05_03 == 11 &&
Nes::Cartridge::Profile::System::PPU_RC2C05_04 == 12 &&
Nes::Cartridge::Profile::System::PPU_RC2C05_05 == 13 &&
Nes::Cartridge::Profile::System::PPU_RP2C07 == 14
);
static const wcstring vsPPU[] =
{
L"RP2C03B",
L"RP2C03G",
L"PR2C04-0001",
L"RP2C04-0002",
L"RP2C04-0003",
L"RP2C04-0004",
L"RC2C03B",
L"RC2C03C",
L"RC2C05-01",
L"RC2C05-02",
L"RC2C05-03",
L"RC2C05-04",
L"RC2C05-05"
};
Control::ComboBox combo( dialog.ComboBox( IDC_INES_HEADER_VS_PPU_LIST ) );
combo.Add( vsPPU, sizeof(array(vsPPU)) );
combo[0].Select();
static const wcstring vsModes[] =
{
L"Standard",
L"RBI Baseball",
L"TKO Boxing",
L"Super Xevious"
};
combo = dialog.ComboBox( IDC_INES_HEADER_VS_MODE_LIST );
combo.Add( vsModes, sizeof(array(vsModes)) );
combo[0].Select();
dialog.Edit( IDC_INES_HEADER_MAPPER_BASE_VALUE ).Limit( 3 );
dialog.Edit( IDC_INES_HEADER_MAPPER_SUB_VALUE ).Limit( 2 );
Nes::Cartridge::NesHeader setup;
setup.Import( header, HEADER_SIZE );
UpdateHeader( setup );
return true;
}
bool InesHeader::OkToSave(const uint fileSize) const
{
const uint saveSize =
(
HEADER_SIZE +
(dialog.CheckBox( IDC_INES_HEADER_TRAINER ).Checked() ? 512 : 0) +
(dialog.ComboBox( IDC_INES_HEADER_PRGROM_LIST ).Selection().Data()) +
(dialog.ComboBox( IDC_INES_HEADER_CHRROM_LIST ).Selection().Data())
);
return saveSize <= fileSize || User::Confirm( IDS_INES_HEADER_UNSAFE );
}
bool InesHeader::SaveHeader(Header& save) const
{
Nes::Cartridge::NesHeader setup;
setup.version = (dialog.RadioButton( IDC_INES_HEADER_TYPE_EXT ).Checked() ? 2 : 0);
if (dialog.RadioButton( IDC_INES_HEADER_SYSTEM_VS ).Checked())
{
setup.system = Nes::Cartridge::NesHeader::SYSTEM_VS;
}
else if (dialog.RadioButton( IDC_INES_HEADER_SYSTEM_PC10 ).Checked())
{
setup.system = Nes::Cartridge::NesHeader::SYSTEM_PC10;
}
else
{
setup.system = Nes::Cartridge::NesHeader::SYSTEM_CONSOLE;
}
if (dialog.RadioButton( IDC_INES_HEADER_REGION_BOTH ).Checked())
{
setup.region = Nes::Cartridge::NesHeader::REGION_BOTH;
}
else if (dialog.RadioButton( IDC_INES_HEADER_REGION_PAL ).Checked())
{
setup.region = Nes::Cartridge::NesHeader::REGION_PAL;
}
else
{
setup.region = Nes::Cartridge::NesHeader::REGION_NTSC;
}
setup.prgRom = dialog.ComboBox( IDC_INES_HEADER_PRGROM_LIST ).Selection().Data();
setup.prgRam = dialog.ComboBox( IDC_INES_HEADER_PRGRAM_LIST ).Selection().Data();
setup.prgNvRam = dialog.ComboBox( IDC_INES_HEADER_PRGNVRAM_LIST ).Selection().Data();
setup.chrRom = dialog.ComboBox( IDC_INES_HEADER_CHRROM_LIST ).Selection().Data();
setup.chrRam = dialog.ComboBox( IDC_INES_HEADER_CHRRAM_LIST ).Selection().Data();
setup.chrNvRam = dialog.ComboBox( IDC_INES_HEADER_CHRNVRAM_LIST ).Selection().Data();
if (setup.system == Nes::Cartridge::NesHeader::SYSTEM_VS)
{
setup.ppu = static_cast<Nes::Cartridge::NesHeader::Ppu>(dialog.ComboBox( IDC_INES_HEADER_VS_PPU_LIST ).Selection().GetIndex() + 1);
setup.security = dialog.ComboBox( IDC_INES_HEADER_VS_MODE_LIST ).Selection().GetIndex();
}
else
{
setup.ppu = Nes::Cartridge::NesHeader::PPU_RP2C02;
setup.security = 0;
}
if (dialog.RadioButton( IDC_INES_HEADER_FOURSCREEN ).Checked())
{
setup.mirroring = Nes::Cartridge::NesHeader::MIRRORING_FOURSCREEN;
}
else if (dialog.RadioButton( IDC_INES_HEADER_HORIZONTAL ).Checked())
{
setup.mirroring = Nes::Cartridge::NesHeader::MIRRORING_HORIZONTAL;
}
else
{
setup.mirroring = Nes::Cartridge::NesHeader::MIRRORING_VERTICAL;
}
if (!(dialog.Edit( IDC_INES_HEADER_MAPPER_BASE_VALUE ) >> setup.mapper))
return false;
setup.subMapper = 0;
if (setup.version && !(dialog.Edit( IDC_INES_HEADER_MAPPER_SUB_VALUE ) >> setup.subMapper))
return false;
setup.trainer = dialog.CheckBox( IDC_INES_HEADER_TRAINER ).Checked();
if (NES_FAILED(setup.Export( save, HEADER_SIZE )))
return false;
uchar reserved[HEADER_SIZE];
std::memset( reserved, 0, sizeof(reserved) );
if (setup.version)
{
reserved[8] = header[8] & 0x0EU;
reserved[12] = header[12] & 0xFCU;
std::memcpy( reserved+14, header+14, HEADER_SIZE-14 );
}
else
{
reserved[7] = header[7] & 0x02U;
reserved[9] = header[9] & 0xFEU;
std::memcpy( reserved+10, header+10, HEADER_SIZE-10 );
}
for (uint i=4; i < HEADER_SIZE-4; ++i)
{
if (reserved[i])
{
if (!User::Confirm( IDS_INES_HEADER_REMOVE_RESERVED ))
{
for (uint j=4; j < HEADER_SIZE-4; ++j)
save[j] |= reserved[j];
}
break;
}
}
return true;
}
void InesHeader::UpdateHeader(const Nes::Cartridge::NesHeader& setup) const
{
dialog.RadioButton( IDC_INES_HEADER_TYPE_STD ).Check( !setup.version );
dialog.RadioButton( IDC_INES_HEADER_TYPE_EXT ).Check( setup.version );
dialog.Edit( IDC_INES_HEADER_MAPPER_BASE_VALUE ).Text() << uint(setup.mapper);
dialog.Edit( IDC_INES_HEADER_MAPPER_SUB_VALUE ).Text() << uint(setup.subMapper);
dialog.RadioButton( IDC_INES_HEADER_FOURSCREEN ).Check( setup.mirroring == Nes::Cartridge::NesHeader::MIRRORING_FOURSCREEN );
dialog.RadioButton( IDC_INES_HEADER_VERTICAL ).Check( setup.mirroring == Nes::Cartridge::NesHeader::MIRRORING_VERTICAL );
dialog.RadioButton( IDC_INES_HEADER_HORIZONTAL ).Check( setup.mirroring != Nes::Cartridge::NesHeader::MIRRORING_VERTICAL && setup.mirroring != Nes::Cartridge::NesHeader::MIRRORING_FOURSCREEN );
dialog.RadioButton( IDC_INES_HEADER_SYSTEM_VS ).Check( setup.system == Nes::Cartridge::NesHeader::SYSTEM_VS );
dialog.RadioButton( IDC_INES_HEADER_SYSTEM_PC10 ).Check( setup.system == Nes::Cartridge::NesHeader::SYSTEM_PC10 );
dialog.RadioButton( IDC_INES_HEADER_SYSTEM_HOME ).Check( setup.system == Nes::Cartridge::NesHeader::SYSTEM_CONSOLE );
dialog.RadioButton( IDC_INES_HEADER_REGION_BOTH ).Check( setup.region == Nes::Cartridge::NesHeader::REGION_BOTH );
dialog.RadioButton( IDC_INES_HEADER_REGION_PAL ).Check( setup.region == Nes::Cartridge::NesHeader::REGION_PAL );
dialog.RadioButton( IDC_INES_HEADER_REGION_NTSC ).Check( setup.region == Nes::Cartridge::NesHeader::REGION_NTSC );
dialog.CheckBox( IDC_INES_HEADER_TRAINER ).Check( setup.trainer );
dialog.ComboBox( IDC_INES_HEADER_VS_PPU_LIST )[setup.ppu ? setup.ppu-1 : 0].Select();
dialog.ComboBox( IDC_INES_HEADER_VS_MODE_LIST )[setup.security].Select();
UpdateVersion();
UpdateSizes( IDC_INES_HEADER_PRGROM_LIST, SIZETYPE_STD_16K, setup.prgRom );
UpdateSizes( IDC_INES_HEADER_PRGRAM_LIST, setup.version ? SIZETYPE_EXT : SIZETYPE_STD_8K, setup.prgRam );
UpdateSizes( IDC_INES_HEADER_PRGNVRAM_LIST, setup.version ? SIZETYPE_EXT : SIZETYPE_STATE, setup.prgNvRam );
UpdateSizes( IDC_INES_HEADER_CHRROM_LIST, SIZETYPE_STD_8K, setup.chrRom );
UpdateSizes( IDC_INES_HEADER_CHRRAM_LIST, SIZETYPE_EXT, setup.chrRam );
UpdateSizes( IDC_INES_HEADER_CHRNVRAM_LIST, SIZETYPE_EXT, setup.chrNvRam );
}
void InesHeader::UpdateVersion() const
{
const bool v2 = dialog.RadioButton( IDC_INES_HEADER_TYPE_EXT ).Checked();
if (!v2 && dialog.RadioButton( IDC_INES_HEADER_SYSTEM_PC10 ).Checked())
{
dialog.RadioButton( IDC_INES_HEADER_SYSTEM_PC10 ).Uncheck();
dialog.RadioButton( IDC_INES_HEADER_SYSTEM_HOME ).Check();
}
dialog.Control( IDC_INES_HEADER_SYSTEM_PC10 ).Enable( v2 );
if (!v2 && dialog.RadioButton( IDC_INES_HEADER_REGION_BOTH ).Checked())
{
dialog.RadioButton( IDC_INES_HEADER_REGION_BOTH ).Uncheck();
dialog.RadioButton( IDC_INES_HEADER_REGION_NTSC ).Check();
}
dialog.Control( IDC_INES_HEADER_REGION_BOTH ).Enable( v2 );
dialog.Control( IDC_INES_HEADER_MAPPER_SUB_TEXT ).Enable( v2 );
dialog.Control( IDC_INES_HEADER_MAPPER_SUB_VALUE ).Enable( v2 );
dialog.Control( IDC_INES_HEADER_CHRRAM_LIST ).Enable( v2 );
dialog.Control( IDC_INES_HEADER_CHRRAM_TEXT ).Enable( v2 );
dialog.Control( IDC_INES_HEADER_CHRNVRAM_LIST ).Enable( v2 );
dialog.Control( IDC_INES_HEADER_CHRNVRAM_TEXT ).Enable( v2 );
UpdateSystem();
}
void InesHeader::UpdateSystem() const
{
const bool vsExt =
(
dialog.RadioButton( IDC_INES_HEADER_SYSTEM_VS ).Checked() &&
dialog.RadioButton( IDC_INES_HEADER_TYPE_EXT ).Checked()
);
dialog.Control( IDC_INES_HEADER_VS_PPU_LIST ).Enable( vsExt );
dialog.Control( IDC_INES_HEADER_VS_PPU_TEXT ).Enable( vsExt );
dialog.Control( IDC_INES_HEADER_VS_MODE_LIST ).Enable( vsExt );
dialog.Control( IDC_INES_HEADER_VS_MODE_TEXT ).Enable( vsExt );
}
uint InesHeader::GetMaxSize(uint block) const
{
return (dialog.RadioButton(IDC_INES_HEADER_TYPE_EXT).Checked() ? 0xFFF : 0xFF) * block;
}
void InesHeader::UpdateSizes(const uint idc,const SizeType sizeType,uint sizeSelect) const
{
const Control::ComboBox combo( dialog.ComboBox(idc) );
combo.Clear();
if (sizeType == SIZETYPE_STD_8K || sizeType == SIZETYPE_STD_16K)
{
combo.Reserve( 1+8+1, 8 );
combo.Add( Resource::String(IDS_TEXT_NONE).Ptr() ).Data() = 0;
uint selection = 0;
uint match = 0;
for (uint i=0; i < 8; ++i)
{
const uint size = (uint(sizeType) << i) * Nes::Core::SIZE_1K;
if (sizeSelect == size)
{
selection = i+1;
match = size;
}
combo.Add( (String::Stack<7>() << (size / Nes::Core::SIZE_1K) << 'k').Ptr() ).Data() = size;
}
combo.Add( Resource::String(IDS_TEXT_OTHER) ).Data() = OTHER_SIZE | sizeType;
if (sizeSelect != match)
{
const uint block = uint(sizeType) * Nes::Core::SIZE_1K;
sizeSelect = (sizeSelect / block + (sizeSelect % block > 0)) * block;
if (sizeSelect > GetMaxSize( block ))
{
selection = 1+7;
}
else
{
combo.Add( (String::Stack<7>() << (sizeSelect / Nes::Core::SIZE_1K) << 'k').Ptr() ).Data() = sizeSelect;
selection = 1+8+1;
}
}
combo[selection].Select();
}
else if (sizeType == SIZETYPE_EXT)
{
static const struct { wcstring name; uint size; } sizes[14] =
{
{ L"128", 128 },
{ L"256", 256 },
{ L"512", 512 },
{ L"1k", Nes::Core::SIZE_1K },
{ L"2k", Nes::Core::SIZE_2K },
{ L"4k", Nes::Core::SIZE_4K },
{ L"8k", Nes::Core::SIZE_8K },
{ L"16k", Nes::Core::SIZE_16K },
{ L"32k", Nes::Core::SIZE_32K },
{ L"64k", Nes::Core::SIZE_64K },
{ L"128k", Nes::Core::SIZE_128K },
{ L"256k", Nes::Core::SIZE_256K },
{ L"512k", Nes::Core::SIZE_512K },
{ L"1024k", Nes::Core::SIZE_1024K }
};
combo.Reserve( 1+14, 16 );
combo.Add( Resource::String(IDS_TEXT_NONE).Ptr() ).Data() = 0;
uint selection = sizeSelect ? UINT_MAX : 0;
for (uint i=0; i < 14; ++i)
{
if (selection == UINT_MAX && sizeSelect <= sizes[i].size)
selection = 1+i;
combo.Add( sizes[i].name ).Data() = sizes[i].size;
}
combo[selection == UINT_MAX ? 1+14-1 : selection].Select();
}
else
{
NST_ASSERT( sizeType == SIZETYPE_STATE );
combo.Reserve( 2, 16 );
combo.Add( Resource::String(IDS_TEXT_DISABLED) ).Data() = false;
combo.Add( Resource::String(IDS_TEXT_ENABLED) ).Data() = true;
combo[sizeSelect >= Nes::Core::SIZE_1K].Select();
}
}
ibool InesHeader::OnCmdFileType(Param& param)
{
if (param.Button().Clicked())
{
UpdateVersion();
uint size = dialog.ComboBox(IDC_INES_HEADER_PRGROM_LIST).Selection().Data();
UpdateSizes( IDC_INES_HEADER_PRGROM_LIST, SIZETYPE_STD_16K, size );
size = dialog.ComboBox(IDC_INES_HEADER_PRGRAM_LIST).Selection().Data();
uint save = dialog.ComboBox(IDC_INES_HEADER_PRGNVRAM_LIST).Selection().Data();
const bool v2 = dialog.RadioButton( IDC_INES_HEADER_TYPE_EXT ).Checked();
if (dialog.ComboBox(IDC_INES_HEADER_PRGNVRAM_LIST).Size() == 2)
{
if (v2 && save)
{
save = NST_MAX(size,Nes::Core::SIZE_8K);
size = 0;
}
}
else if (!v2)
{
size += save;
if (size < Nes::Core::SIZE_8K)
size = 0;
}
UpdateSizes( IDC_INES_HEADER_PRGRAM_LIST, v2 ? SIZETYPE_EXT : SIZETYPE_STD_8K, size );
UpdateSizes( IDC_INES_HEADER_PRGNVRAM_LIST, v2 ? SIZETYPE_EXT : SIZETYPE_STATE, save );
size = dialog.ComboBox(IDC_INES_HEADER_CHRROM_LIST).Selection().Data();
UpdateSizes( IDC_INES_HEADER_CHRROM_LIST, SIZETYPE_STD_8K, size );
}
return true;
}
ibool InesHeader::OnCmdSystem(Param& param)
{
if (param.Button().Clicked())
UpdateSystem();
return true;
}
ibool InesHeader::OnCmdSizeOther(Param& param)
{
if (param.ComboBox().SelectionChanged())
{
const Control::ComboBox combo( dialog.ComboBox(param.ComboBox().GetId()) );
const uint otherSize = combo.Selection().Data();
if (otherSize & OTHER_SIZE)
{
const uint last = combo.Back().Data();
uint size = last;
if (last & OTHER_SIZE)
size &= OTHER_SIZE_DIV;
else
size /= Nes::Core::SIZE_1K;
CustomSize( size ).Open();
if (size % (otherSize & OTHER_SIZE_DIV) || size > GetMaxSize(otherSize & OTHER_SIZE_DIV))
{
size = (last & OTHER_SIZE) ? (otherSize & OTHER_SIZE_DIV) : (last / Nes::Core::SIZE_1K);
User::Warn( IDS_ERR_INVALID_SIZE, IDS_TITLE_ERROR );
}
if (!(last & OTHER_SIZE))
combo.Back().Erase();
combo.Add( (String::Stack<7>() << size << 'k').Ptr() ).Data() = size * Nes::Core::SIZE_1K;
combo.Back().Select();
}
}
return true;
}
ibool InesHeader::OnCmdUndoAll(Param& param)
{
if (param.Button().Clicked())
{
Nes::Cartridge::NesHeader setup;
setup.Import( header, HEADER_SIZE );
UpdateHeader( setup );
}
return true;
}
ibool InesHeader::OnCmdSave(Param& param)
{
if (param.Button().Clicked())
{
Header header;
if (!SaveHeader( header ))
{
User::Warn( IDS_INES_HEADER_INVALID, IDS_TITLE_ERROR );
return true;
}
const Path savePath( paths.BrowseSave( Managers::Paths::File::INES, Managers::Paths::DONT_SUGGEST, *path ) );
if (savePath.Empty())
return true;
Collection::Buffer buffer;
uint result = Import( *path, buffer );
if (result == 0)
{
NST_ASSERT( buffer.Size() >= HEADER_SIZE );
if (!OkToSave( buffer.Size() ))
return true;
std::memcpy( buffer.Ptr(), header, HEADER_SIZE );
result = Export( savePath, buffer );
if (result == 0)
{
dialog.Close();
return true;
}
}
User::Fail( result );
}
return true;
}
struct InesHeader::CustomSize::Handlers
{
static const MsgHandler::Entry<CustomSize> messages[];
static const MsgHandler::Entry<CustomSize> commands[];
};
const MsgHandler::Entry<InesHeader::CustomSize> InesHeader::CustomSize::Handlers::messages[] =
{
{ WM_INITDIALOG, &CustomSize::OnInitDialog }
};
const MsgHandler::Entry<InesHeader::CustomSize> InesHeader::CustomSize::Handlers::commands[] =
{
{ IDOK, &CustomSize::OnCmdOk }
};
InesHeader::CustomSize::CustomSize(uint& s)
:
size (s),
dialog (IDD_INES_HEADER_CUSTOM,this,Handlers::messages,Handlers::commands)
{
}
ibool InesHeader::CustomSize::OnInitDialog(Param&)
{
const Control::Edit edit( dialog.Edit(IDC_INES_HEADER_CUSTOM_VALUE) );
edit.Limit( 5 );
edit.Text() << size;
return true;
}
ibool InesHeader::CustomSize::OnCmdOk(Param& param)
{
if (param.Button().Clicked())
{
dialog.Edit( IDC_INES_HEADER_CUSTOM_VALUE ) >> size;
dialog.Close();
}
return true;
}
}
}

View File

@@ -0,0 +1,94 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_DIALOG_INESHEADER_H
#define NST_DIALOG_INESHEADER_H
#pragma once
#include "NstWindowDialog.hpp"
namespace Nestopia
{
namespace Window
{
class InesHeader
{
public:
InesHeader(const Managers::Paths&);
void Open(const Path&);
private:
struct Handlers;
class CustomSize;
enum SizeType
{
SIZETYPE_EXT = 0,
SIZETYPE_STD_8K = 8,
SIZETYPE_STD_16K = 16,
SIZETYPE_STATE = 2
};
enum
{
OTHER_SIZE = 0x40000000,
OTHER_SIZE_DIV = SIZETYPE_STD_8K|SIZETYPE_STD_16K,
HEADER_SIZE = 16,
HEADER_ID = FourCC<'N','E','S',0x1A>::V
};
typedef uchar Header[HEADER_SIZE];
static uint Import(const Path&,Collection::Buffer&);
static uint Export(const Path&,const Collection::Buffer&);
void UpdateHeader(const Nes::Cartridge::NesHeader&) const;
void UpdateVersion() const;
void UpdateSystem() const;
void UpdateSizes(uint,SizeType,uint) const;
bool SaveHeader(Header&) const;
uint GetMaxSize(uint) const;
bool OkToSave(uint) const;
ibool OnInitDialog (Param&);
ibool OnCmdFileType (Param&);
ibool OnCmdSystem (Param&);
ibool OnCmdSizeOther (Param&);
ibool OnCmdUndoAll (Param&);
ibool OnCmdSave (Param&);
Dialog dialog;
Header header;
const Path* path;
const Managers::Paths& paths;
};
}
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,483 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_DIALOG_INPUT_H
#define NST_DIALOG_INPUT_H
#pragma once
#include "NstWindowDialog.hpp"
#include "NstDirectInput.hpp"
namespace Nestopia
{
namespace Window
{
class Input
{
public:
Input(DirectX::DirectInput&,Managers::Emulator&,const Configuration&);
void Save(Configuration&) const;
private:
struct Handlers;
class KeyPressWindow;
enum
{
SCAN_ABORT,
SCAN_NEXT
};
void ResetJoysticks();
void ResetKeys();
int ScanKeys();
ibool OnInitDialog (Param&);
ibool OnDestroy (Param&);
ibool OnHScroll (Param&);
ibool OnCmdDblClk (Param&);
ibool OnCmdDevice (Param&);
ibool OnCmdSet (Param&);
ibool OnCmdSetAll (Param&);
ibool OnCmdClear (Param&);
ibool OnCmdClearAll (Param&);
ibool OnCmdJoystickAxis (Param&);
ibool OnCmdDefaultCategory (Param&);
ibool OnCmdAutoFireDefault (Param&);
ibool OnCmdJoysticks (Param&);
ibool OnCmdJoystickEnable (Param&);
ibool OnCmdCalibrate (Param&);
ibool OnCmdJoysticksDefault (Param&);
ibool OnCmdDefault (Param&);
void UpdateKeyMap (uint) const;
void UpdateKeyNames (uint) const;
void UpdateJoysticks (uint) const;
public:
class Settings
{
friend class Input;
public:
enum
{
TYPE_PAD1,
TYPE_PAD2,
TYPE_PAD3,
TYPE_PAD4,
TYPE_POWERPAD,
TYPE_POWERGLOVE,
TYPE_HORITRACK,
TYPE_PACHINKO,
TYPE_CRAZYCLIMBER,
TYPE_MAHJONG,
TYPE_EXCITINGBOXING,
TYPE_POKKUNMOGURAA,
TYPE_PARTYTAP,
TYPE_KARAOKESTUDIO,
TYPE_EMULATION,
TYPE_FILE,
TYPE_MACHINE,
TYPE_NSF,
TYPE_VIEW,
TYPE_HELP,
NUM_TYPES,
TYPE_COMMAND = TYPE_FILE
};
enum
{
PAD_KEYS = 0,
PAD_KEY_A = 0,
PAD_KEY_B,
PAD_KEY_SELECT,
PAD_KEY_START,
PAD_KEY_UP,
PAD_KEY_DOWN,
PAD_KEY_LEFT,
PAD_KEY_RIGHT,
PAD_KEY_AUTOFIRE_A,
PAD_KEY_AUTOFIRE_B,
PAD_KEY_MIC,
PAD_NUM_KEYS,
PAD1_KEYS = PAD_KEYS,
PAD2_KEYS = PAD1_KEYS + PAD_NUM_KEYS,
PAD3_KEYS = PAD2_KEYS + PAD_NUM_KEYS,
PAD4_KEYS = PAD3_KEYS + PAD_NUM_KEYS,
POWERPAD_KEYS = PAD4_KEYS + PAD_NUM_KEYS,
POWERPAD_KEY_SIDE_A_1 = 0,
POWERPAD_KEY_SIDE_A_2,
POWERPAD_KEY_SIDE_A_3,
POWERPAD_KEY_SIDE_A_4,
POWERPAD_KEY_SIDE_A_5,
POWERPAD_KEY_SIDE_A_6,
POWERPAD_KEY_SIDE_A_7,
POWERPAD_KEY_SIDE_A_8,
POWERPAD_KEY_SIDE_A_9,
POWERPAD_KEY_SIDE_A_10,
POWERPAD_KEY_SIDE_A_11,
POWERPAD_KEY_SIDE_A_12,
POWERPAD_KEY_SIDE_B_3,
POWERPAD_KEY_SIDE_B_2,
POWERPAD_KEY_SIDE_B_8,
POWERPAD_KEY_SIDE_B_7,
POWERPAD_KEY_SIDE_B_6,
POWERPAD_KEY_SIDE_B_5,
POWERPAD_KEY_SIDE_B_11,
POWERPAD_KEY_SIDE_B_10,
POWERPAD_NUM_SIDE_A_KEYS = Nes::Input::Controllers::PowerPad::NUM_SIDE_A_BUTTONS,
POWERPAD_NUM_SIDE_B_KEYS = Nes::Input::Controllers::PowerPad::NUM_SIDE_B_BUTTONS,
POWERPAD_NUM_KEYS = POWERPAD_NUM_SIDE_A_KEYS + POWERPAD_NUM_SIDE_B_KEYS,
POWERGLOVE_KEYS = POWERPAD_KEYS + POWERPAD_NUM_KEYS,
POWERGLOVE_KEY_SELECT = 0,
POWERGLOVE_KEY_START,
POWERGLOVE_KEY_MOVE_IN,
POWERGLOVE_KEY_MOVE_OUT,
POWERGLOVE_KEY_ROLL_LEFT,
POWERGLOVE_KEY_ROLL_RIGHT,
POWERGLOVE_NUM_KEYS,
HORITRACK_KEYS = POWERGLOVE_KEYS + POWERGLOVE_NUM_KEYS,
HORITRACK_KEY_A = 0,
HORITRACK_KEY_B,
HORITRACK_KEY_SELECT,
HORITRACK_KEY_START,
HORITRACK_KEY_UP,
HORITRACK_KEY_DOWN,
HORITRACK_KEY_LEFT,
HORITRACK_KEY_RIGHT,
HORITRACK_KEY_SPEED,
HORITRACK_KEY_ORIENTATION,
HORITRACK_NUM_KEYS,
PACHINKO_KEYS = HORITRACK_KEYS + HORITRACK_NUM_KEYS,
PACHINKO_KEY_A = 0,
PACHINKO_KEY_B,
PACHINKO_KEY_SELECT,
PACHINKO_KEY_START,
PACHINKO_KEY_UP,
PACHINKO_KEY_DOWN,
PACHINKO_KEY_LEFT,
PACHINKO_KEY_RIGHT,
PACHINKO_NUM_KEYS,
CRAZYCLIMBER_KEYS = PACHINKO_KEYS + PACHINKO_NUM_KEYS,
CRAZYCLIMBER_KEY_LEFT_UP = 0,
CRAZYCLIMBER_KEY_LEFT_RIGHT,
CRAZYCLIMBER_KEY_LEFT_DOWN,
CRAZYCLIMBER_KEY_LEFT_LEFT,
CRAZYCLIMBER_KEY_RIGHT_UP,
CRAZYCLIMBER_KEY_RIGHT_RIGHT,
CRAZYCLIMBER_KEY_RIGHT_DOWN,
CRAZYCLIMBER_KEY_RIGHT_LEFT,
CRAZYCLIMBER_NUM_KEYS,
MAHJONG_KEYS = CRAZYCLIMBER_KEYS + CRAZYCLIMBER_NUM_KEYS,
MAHJONG_KEY_A = 0,
MAHJONG_KEY_B,
MAHJONG_KEY_C,
MAHJONG_KEY_D,
MAHJONG_KEY_E,
MAHJONG_KEY_F,
MAHJONG_KEY_G,
MAHJONG_KEY_H,
MAHJONG_KEY_I,
MAHJONG_KEY_J,
MAHJONG_KEY_K,
MAHJONG_KEY_L,
MAHJONG_KEY_M,
MAHJONG_KEY_N,
MAHJONG_KEY_START,
MAHJONG_KEY_SELECT,
MAHJONG_KEY_KAN,
MAHJONG_KEY_PON,
MAHJONG_KEY_CHI,
MAHJONG_KEY_REACH,
MAHJONG_KEY_RON,
MAHJONG_NUM_KEYS,
EXCITINGBOXING_KEYS = MAHJONG_KEYS + MAHJONG_NUM_KEYS,
EXCITINGBOXING_KEY_LEFT_HOOK = 0,
EXCITINGBOXING_KEY_RIGHT_HOOK,
EXCITINGBOXING_KEY_LEFT_JAB,
EXCITINGBOXING_KEY_RIGHT_JAB,
EXCITINGBOXING_KEY_STRAIGHT,
EXCITINGBOXING_KEY_BODY,
EXCITINGBOXING_KEY_LEFT_MOVE,
EXCITINGBOXING_KEY_RIGHT_MOVE,
EXCITINGBOXING_NUM_KEYS,
POKKUNMOGURAA_KEYS = EXCITINGBOXING_KEYS + EXCITINGBOXING_NUM_KEYS,
POKKUNMOGURAA_KEY_ROW_1_1 = 0,
POKKUNMOGURAA_KEY_ROW_1_2,
POKKUNMOGURAA_KEY_ROW_1_3,
POKKUNMOGURAA_KEY_ROW_1_4,
POKKUNMOGURAA_KEY_ROW_2_1,
POKKUNMOGURAA_KEY_ROW_2_2,
POKKUNMOGURAA_KEY_ROW_2_3,
POKKUNMOGURAA_KEY_ROW_2_4,
POKKUNMOGURAA_KEY_ROW_3_1,
POKKUNMOGURAA_KEY_ROW_3_2,
POKKUNMOGURAA_KEY_ROW_3_3,
POKKUNMOGURAA_KEY_ROW_3_4,
POKKUNMOGURAA_NUM_KEYS,
PARTYTAP_KEYS = POKKUNMOGURAA_KEYS + POKKUNMOGURAA_NUM_KEYS,
PARTYTAP_UNIT_1 = 0,
PARTYTAP_UNIT_2,
PARTYTAP_UNIT_3,
PARTYTAP_UNIT_4,
PARTYTAP_UNIT_5,
PARTYTAP_UNIT_6,
PARTYTAP_NUM_KEYS,
KARAOKESTUDIO_KEYS = PARTYTAP_KEYS + PARTYTAP_NUM_KEYS,
KARAOKESTUDIO_MIC = 0,
KARAOKESTUDIO_A,
KARAOKESTUDIO_B,
KARAOKESTUDIO_NUM_KEYS,
EMULATION_KEYS = KARAOKESTUDIO_KEYS + KARAOKESTUDIO_NUM_KEYS,
EMULATION_KEY_INSERT_COIN_1 = 0,
EMULATION_KEY_INSERT_COIN_2,
EMULATION_KEY_ALT_SPEED,
EMULATION_KEY_REWIND,
EMULATION_NUM_KEYS,
POLLING_KEYS = EMULATION_KEYS + EMULATION_KEY_ALT_SPEED,
COMMAND_KEYS = EMULATION_KEYS + EMULATION_NUM_KEYS,
FILE_KEYS = COMMAND_KEYS,
FILE_KEY_OPEN = 0,
FILE_KEY_SAVE_STATE,
FILE_KEY_LOAD_STATE,
FILE_KEY_QUICK_LOAD_STATE_1,
FILE_KEY_QUICK_LOAD_STATE_2,
FILE_KEY_QUICK_LOAD_STATE_3,
FILE_KEY_QUICK_LOAD_STATE_4,
FILE_KEY_QUICK_LOAD_STATE_5,
FILE_KEY_QUICK_LOAD_STATE_6,
FILE_KEY_QUICK_LOAD_STATE_7,
FILE_KEY_QUICK_LOAD_STATE_8,
FILE_KEY_QUICK_LOAD_STATE_9,
FILE_KEY_QUICK_LOAD_LAST_STATE,
FILE_KEY_QUICK_SAVE_STATE_1,
FILE_KEY_QUICK_SAVE_STATE_2,
FILE_KEY_QUICK_SAVE_STATE_3,
FILE_KEY_QUICK_SAVE_STATE_4,
FILE_KEY_QUICK_SAVE_STATE_5,
FILE_KEY_QUICK_SAVE_STATE_6,
FILE_KEY_QUICK_SAVE_STATE_7,
FILE_KEY_QUICK_SAVE_STATE_8,
FILE_KEY_QUICK_SAVE_STATE_9,
FILE_KEY_QUICK_SAVE_NEXT_STATE,
FILE_KEY_SAVE_SCREENSHOT,
FILE_KEY_LAUNCHER,
FILE_KEY_EXIT,
FILE_NUM_KEYS,
MACHINE_KEYS = FILE_KEYS + FILE_NUM_KEYS,
MACHINE_KEY_POWER = 0,
MACHINE_KEY_RESET_SOFT,
MACHINE_KEY_RESET_HARD,
MACHINE_KEY_PAUSE,
MACHINE_KEY_UNLIMITED_SPRITES,
MACHINE_KEY_CHANGE_DISK_SIDE,
MACHINE_NUM_KEYS,
NSF_KEYS = MACHINE_KEYS + MACHINE_NUM_KEYS,
NSF_KEY_PLAY = 0,
NSF_KEY_STOP,
NSF_KEY_NEXT,
NSF_KEY_PREV,
NSF_NUM_KEYS,
VIEW_KEYS = NSF_KEYS + NSF_NUM_KEYS,
VIEW_KEY_SCREENSIZE_1X = 0,
VIEW_KEY_SCREENSIZE_2X,
VIEW_KEY_SCREENSIZE_3X,
VIEW_KEY_SCREENSIZE_4X,
VIEW_KEY_SCREENSIZE_5X,
VIEW_KEY_SCREENSIZE_6X,
VIEW_KEY_SCREENSIZE_7X,
VIEW_KEY_SCREENSIZE_8X,
VIEW_KEY_SCREENSIZE_9X,
VIEW_KEY_SCREENSIZE_MAX,
VIEW_KEY_SHOW_MENU,
VIEW_KEY_SHOW_STATUSBAR,
VIEW_KEY_SHOW_ONTOP,
VIEW_KEY_SHOW_FPS,
VIEW_KEY_FULLSCREEN,
VIEW_NUM_KEYS,
HELP_KEYS = VIEW_KEYS + VIEW_NUM_KEYS,
HELP_KEY_HELP = 0,
HELP_NUM_KEYS,
NUM_KEYS = HELP_KEYS + HELP_NUM_KEYS,
NUM_COMMAND_KEYS = NUM_KEYS - COMMAND_KEYS
};
enum
{
AUTOFIRE_MAX_SPEED = 6,
AUTOFIRE_NUM_SPEEDS = 7,
AUTOFIRE_DEFAULT_SPEED = 3
};
typedef DirectX::DirectInput::Key Key;
private:
Settings();
void Reset(const DirectX::DirectInput&);
void Reset(const DirectX::DirectInput&,uint);
void Clear();
void Clear(uint);
#pragma pack(push,1)
struct Type
{
uchar offset;
ushort name;
};
struct Mapping
{
inline uint Code() const;
inline uint Alt() const;
inline uint Shift() const;
inline uint Ctrl() const;
uchar index;
ushort key;
ushort dlgName;
cstring cfgType;
cstring cfgKey;
};
#pragma pack(pop)
enum
{
NO_KEY = 0,
OFFSET_COUNT = NUM_TYPES + 1,
ALT = 0x100,
SHIFT = 0x200,
CTRL = 0x400
};
bool Map(uint,const Key&);
inline void Unmap(uint);
static inline const Mapping& GetMapping(uint,uint);
static inline const Type& GetType(uint);
Key keys[NUM_KEYS];
uint autoFireSpeed;
bool allowSimulAxes;
static const Type types[OFFSET_COUNT];
static const Mapping map[NUM_KEYS];
static uint NumTypeKeys(uint index)
{
NST_ASSERT( index < NUM_TYPES );
return types[index+1].offset - types[index].offset;
}
public:
const Key& GetKey(uint type,uint index) const
{
NST_ASSERT( index < NumTypeKeys(type) );
return keys[types[type].offset + index];
}
const Key& GetKey(uint index) const
{
NST_ASSERT( index < NUM_KEYS );
return keys[index];
}
const Key* GetKeys(uint index=0) const
{
NST_ASSERT( index < NUM_KEYS );
return keys + index;
}
const Key* GetKeys(uint type,uint index) const
{
return &GetKey( type, index );
}
uint AutoFireSpeed() const
{
return autoFireSpeed;
}
bool AllowSimulAxes() const
{
return allowSimulAxes;
}
};
private:
void SelectNextMapKey();
bool MapSelectedKey(const Settings::Key&);
Nes::Input nes;
DirectX::DirectInput& directInput;
Settings settings;
Dialog dialog;
public:
void Open()
{
dialog.Open();
}
const Settings& GetSettings() const
{
return settings;
}
};
}
}
#endif

View File

@@ -0,0 +1,115 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstWindowParam.hpp"
#include "NstDialogLanguage.hpp"
namespace Nestopia
{
namespace Window
{
struct Language::Handlers
{
static const MsgHandler::Entry<Language> messages[];
static const MsgHandler::Entry<Language> commands[];
};
const MsgHandler::Entry<Language> Language::Handlers::messages[] =
{
{ WM_INITDIALOG, &Language::OnInitDialog }
};
const MsgHandler::Entry<Language> Language::Handlers::commands[] =
{
{ IDOK, &Language::OnCmdOk },
{ IDC_LANGUAGE_LIST, &Language::OnDblClk }
};
Language::Language()
: dialog(IDD_LANGUAGE,this,Handlers::messages,Handlers::commands) {}
Language::~Language()
{
}
ibool Language::OnInitDialog(Param&)
{
paths.clear();
Application::Instance::GetLanguage().EnumerateResources( paths );
const Control::ListBox listBox( dialog.ListBox(IDC_LANGUAGE_LIST) );
Path name;
for (Paths::const_iterator it(paths.begin()), end(paths.end()); it != end; ++it)
{
name = it->File();
name.Extension().Clear();
::CharUpperBuff( name.Ptr(), 1 );
const uint index = listBox.Add( name.Ptr() ).GetIndex();
listBox[index].Data() = (it - paths.begin());
if (*it == Application::Instance::GetLanguage().GetResourcePath())
listBox[index].Select();
}
return true;
}
void Language::CloseOk()
{
const Control::ListBox listBox( dialog.ListBox(IDC_LANGUAGE_LIST) );
if (listBox.AnySelection())
{
const uint index = listBox.Selection().Data();
if (paths[index] != Application::Instance::GetLanguage().GetResourcePath())
newPath = paths[index];
}
dialog.Close();
}
ibool Language::OnCmdOk(Param& param)
{
if (param.Button().Clicked())
CloseOk();
return true;
}
ibool Language::OnDblClk(Param& param)
{
if (HIWORD(param.wParam) == LBN_DBLCLK)
{
CloseOk();
return true;
}
return false;
}
}
}

View File

@@ -0,0 +1,71 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_DIALOG_LANGUAGE_H
#define NST_DIALOG_LANGUAGE_H
#pragma once
#include "NstWindowDialog.hpp"
#include "NstApplicationLanguage.hpp"
namespace Nestopia
{
namespace Window
{
class Language
{
public:
Language();
~Language();
private:
struct Handlers;
void CloseOk();
ibool OnInitDialog (Param&);
ibool OnCmdOk (Param&);
ibool OnDblClk (Param&);
typedef Application::Instance::Language::Paths Paths;
Dialog dialog;
Paths paths;
Path newPath;
public:
const Path& Open()
{
dialog.Open();
return newPath;
}
};
}
}
#endif

View File

@@ -0,0 +1,408 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "resource/resource.h"
#include "NstResourceString.hpp"
#include "NstResourceIcon.hpp"
#include "NstWindowParam.hpp"
#include "NstSystemKeyboard.hpp"
#include "NstDialogLauncher.hpp"
#include "NstDialogInesHeader.hpp"
namespace Nestopia
{
namespace Window
{
struct Launcher::Handlers
{
static const MsgHandler::Entry<Launcher> messages[];
static const Menu::CmdHandler::Entry<Launcher> commands[];
static const Control::NotificationHandler::Entry<Launcher> listNotifications[];
static const Control::NotificationHandler::Entry<Launcher> treeNotifications[];
};
const MsgHandler::Entry<Launcher> Launcher::Handlers::messages[] =
{
{ WM_INITDIALOG, &Launcher::OnInitDialog },
{ WM_CLOSE, &Launcher::OnClose },
{ WM_DESTROY, &Launcher::OnDestroy },
{ WM_SIZE, &Launcher::OnSize },
{ WM_DROPFILES, &Launcher::OnDropFiles }
};
const Menu::CmdHandler::Entry<Launcher> Launcher::Handlers::commands[] =
{
{ IDM_LAUNCHER_FILE_RUN, &Launcher::OnCmdFileRun },
{ IDM_LAUNCHER_FILE_EDITHEADER, &Launcher::OnCmdEditHeader },
{ IDM_LAUNCHER_FILE_REFRESH, &Launcher::OnCmdFileRefresh },
{ IDM_LAUNCHER_VIEW_SHOWGRIDS, &Launcher::OnCmdViewShowGrids },
{ IDM_LAUNCHER_VIEW_SHOWDATABASECORRECTED, &Launcher::OnCmdViewShowDatabaseCorrected },
{ IDM_LAUNCHER_VIEW_ONTOP, &Launcher::OnCmdViewShowOnTop },
{ IDM_LAUNCHER_OPTIONS_COLORS, &Launcher::OnCmdOptionsColors },
{ IDM_LAUNCHER_OPTIONS_PATHS, &Launcher::OnCmdOptionsPaths }
};
const Control::NotificationHandler::Entry<Launcher> Launcher::Handlers::listNotifications[] =
{
{ LVN_GETDISPINFO, &Launcher::OnListGetDisplayInfo },
{ LVN_KEYDOWN, &Launcher::OnListKeyDown },
{ LVN_COLUMNCLICK, &Launcher::OnListColumnClick },
{ LVN_ITEMACTIVATE, &Launcher::OnListItemActivate },
{ LVN_ITEMCHANGED, &Launcher::OnListItemChanged },
{ LVN_INSERTITEM, &Launcher::OnListInsertItem },
{ LVN_DELETEALLITEMS, &Launcher::OnListDeleteAllItems },
{ LVN_DELETEITEM, &Launcher::OnListDeleteItem }
};
const Control::NotificationHandler::Entry<Launcher> Launcher::Handlers::treeNotifications[] =
{
{ TVN_SELCHANGING, &Launcher::OnTreeSelectionChanging }
};
Launcher::Launcher(const Nes::Cartridge::Database& database,const Managers::Paths& p,const Configuration& cfg)
:
dialog ( IDD_LAUNCHER, this, Handlers::messages ),
menu ( IDR_MENU_LAUNCHER ),
listNotifications ( IDC_LAUNCHER_LIST, dialog.Messages() ),
treeNotifications ( IDC_LAUNCHER_TREE, dialog.Messages() ),
statusBar ( dialog, STATUSBAR_SECOND_FIELD_WIDTH ),
list ( dialog, menu.Commands(), p, cfg, database ),
colors ( cfg )
{
menu.Commands().Add( this, Handlers::commands );
dialog.Commands().Add( CMD_ENTER, this, &Launcher::OnCmdEnter );
listNotifications.Add( this, Handlers::listNotifications );
treeNotifications.Add( this, Handlers::treeNotifications );
{
Configuration::ConstSection launcher( cfg["launcher"] );
menu[IDM_LAUNCHER_VIEW_ONTOP].Check( launcher["view"]["show"]["on-top"].Yes() );
Configuration::ConstSection size( launcher["window-size"] );
initialSize.x = size["x"].Int();
initialSize.y = size["y"].Int();
if (!initialSize.x || !initialSize.y)
{
initialSize.x = 0;
initialSize.y = 0;
}
}
HeapString name;
for (uint i=0; i < 6; ++i)
{
static const ushort keys[6][2] =
{
{ IDM_LAUNCHER_FILE_RUN, VK_RETURN },
{ IDM_LAUNCHER_FILE_EDITHEADER, VK_F4 },
{ IDM_LAUNCHER_FILE_REFRESH, VK_F5 },
{ IDM_LAUNCHER_EDIT_FIND, VK_F3 },
{ IDM_LAUNCHER_EDIT_INSERT, VK_INSERT },
{ IDM_LAUNCHER_EDIT_REMOVE, VK_DELETE }
};
menu[keys[i][0]].Text() >> name;
menu[keys[i][0]].Text() << (name << '\t' << System::Keyboard::GetName( keys[i][1] ));
}
}
Launcher::~Launcher()
{
Close();
}
void Launcher::Save(Configuration& cfg,bool saveSize,bool saveFiles)
{
Configuration::Section launcher( cfg["launcher"] );
if (saveSize)
{
Configuration::Section size( cfg["window-size"] );
size["x"].Int() = initialSize.x;
size["y"].Int() = initialSize.y;
}
launcher["view"]["show"]["on-top"].YesNo() = menu[IDM_LAUNCHER_VIEW_ONTOP].Checked();
list.Save( cfg, saveFiles );
colors.Save( cfg );
}
void Launcher::Open(bool child)
{
menu[IDM_LAUNCHER_VIEW_ONTOP].Enable( !child );
dialog.Open( child ? Dialog::MODELESS_CHILD : Dialog::MODELESS_FREE );
}
void Launcher::Close()
{
dialog.Close();
}
void Launcher::Synchronize(HWND hWnd) const
{
if (dialog.IsOpen() && menu[IDM_LAUNCHER_VIEW_ONTOP].Enabled() && menu[IDM_LAUNCHER_VIEW_ONTOP].Unchecked())
dialog.Position().BringBehind( hWnd );
}
ibool Launcher::OnInitDialog(Param&)
{
menu.Hook( dialog );
menu.Show();
statusBar.Enable();
if (menu[IDM_LAUNCHER_VIEW_ONTOP].Enabled())
dialog.MakeTopMost( menu[IDM_LAUNCHER_VIEW_ONTOP].Checked() );
list = dialog.ListView( IDC_LAUNCHER_LIST );
tree = dialog.TreeView( IDC_LAUNCHER_TREE );
dialog.Send
(
WM_SETICON,
ICON_SMALL,
static_cast<HICON>(Resource::Icon(Application::Instance::GetIconStyle() == Application::Instance::ICONSTYLE_NES ? IDI_PAD : IDI_PAD_J))
);
margin = dialog.Coordinates().Corner() - list.GetWindow().Coordinates().Corner();
list.SetColors( colors.GetBackgroundColor(), colors.GetForegroundColor() );
tree.SetColors( colors.GetBackgroundColor(), colors.GetForegroundColor() );
menu[ IDM_LAUNCHER_VIEW_SHOWGRIDS ].Check( list.GetStyle() & LVS_EX_GRIDLINES );
menu[ IDM_LAUNCHER_VIEW_SHOWDATABASECORRECTED ].Check( list.DatabaseCorrectionEnabled() );
menu[ IDM_LAUNCHER_FILE_REFRESH ].Enable( list.CanRefresh() );
if (initialSize.x && initialSize.y)
dialog.Size() = initialSize;
else
initialSize = dialog.GetPlacement().Size();
return true;
}
ibool Launcher::OnClose(Param&)
{
Close();
return true;
}
ibool Launcher::OnDestroy(Param&)
{
tree.Close();
list.Close();
initialSize = dialog.GetPlacement().Size();
return true;
}
ibool Launcher::OnSize(Param& param)
{
if (param.wParam != SIZE_MINIMIZED)
{
const Point corner( dialog.Coordinates().Corner() - margin - list.GetWindow().Position() );
list.GetWindow().Size() = corner;
tree.GetWindow().Size() = Point( tree.GetWindow().Coordinates().Width(), corner.y );
}
return true;
}
ibool Launcher::OnCmdEnter(Param&)
{
OnCmdFileRun();
return true;
}
ibool Launcher::OnDropFiles(Param& param)
{
list.Insert( param );
return true;
}
void Launcher::UpdateItemCount(const uint count) const
{
if (count == 0 || count == 1)
{
menu[IDM_LAUNCHER_EDIT_FIND].Enable( count );
menu[IDM_LAUNCHER_EDIT_CLEAR].Enable( count );
}
static HeapString form( HeapString() << ' ' << Resource::String(IDS_TEXT_FILES) << ": " );
const uint length = form.Length();
statusBar.Text(StatusBar::SECOND_FIELD) << (form << count).Ptr();
form.ShrinkTo( length );
}
void Launcher::OnListGetDisplayInfo(const NMHDR& nmhdr)
{
list.OnGetDisplayInfo( reinterpret_cast<LPARAM>(&nmhdr) );
}
void Launcher::OnListKeyDown(const NMHDR& nmhdr)
{
switch (reinterpret_cast<const NMLVKEYDOWN&>(nmhdr).wVKey)
{
case VK_INSERT: if (menu[ IDM_LAUNCHER_EDIT_INSERT ].Enabled()) dialog.PostCommand( IDM_LAUNCHER_EDIT_INSERT ); break;
case VK_DELETE: if (menu[ IDM_LAUNCHER_EDIT_REMOVE ].Enabled()) dialog.PostCommand( IDM_LAUNCHER_EDIT_REMOVE ); break;
case VK_F3: if (menu[ IDM_LAUNCHER_EDIT_FIND ].Enabled()) dialog.PostCommand( IDM_LAUNCHER_EDIT_FIND ); break;
case VK_F4: if (menu[ IDM_LAUNCHER_FILE_EDITHEADER ].Enabled()) dialog.PostCommand( IDM_LAUNCHER_FILE_EDITHEADER ); break;
case VK_F5: if (menu[ IDM_LAUNCHER_FILE_REFRESH ].Enabled()) dialog.PostCommand( IDM_LAUNCHER_FILE_REFRESH ); break;
}
}
void Launcher::OnListColumnClick(const NMHDR& nmhdr)
{
Application::Instance::Waiter wait;
list.Sort( reinterpret_cast<const NMLISTVIEW&>(nmhdr).iSubItem );
}
void Launcher::OnListItemActivate(const NMHDR&)
{
OnCmdFileRun();
}
void Launcher::OnListItemChanged(const NMHDR& nmhdr)
{
const NMLISTVIEW& nmlv = reinterpret_cast<const NMLISTVIEW&>(nmhdr);
if ((nmlv.uOldState ^ nmlv.uNewState) & LVIS_SELECTED)
{
if (nmlv.uNewState & LVIS_SELECTED)
{
if (const List::Files::Entry* const entry = list[nmlv.iItem])
{
{
Path path( entry->GetPath(list.GetStrings()), entry->GetFile(list.GetStrings()) );
if (path.Length() > MAX_PATH)
{
path.ShrinkTo( MAX_PATH-3 );
path << "...";
}
statusBar.Text(StatusBar::FIRST_FIELD) << path.Ptr();
}
menu[IDM_LAUNCHER_FILE_RUN].Enable();
menu[IDM_LAUNCHER_FILE_EDITHEADER].Enable( entry->GetType() == List::Files::Entry::NES );
menu[IDM_LAUNCHER_EDIT_REMOVE].Enable();
}
}
else
{
OnNoSelection();
}
}
}
void Launcher::OnListInsertItem(const NMHDR&)
{
UpdateItemCount( list.Size() );
}
void Launcher::OnListDeleteItem(const NMHDR&)
{
const uint size = list.Size();
UpdateItemCount( size - (size != 0) );
}
void Launcher::OnListDeleteAllItems(const NMHDR&)
{
OnNoSelection();
const uint size = list.Size();
UpdateItemCount( size - (size != 0) );
}
void Launcher::OnTreeSelectionChanging(const NMHDR& nmhdr)
{
Application::Instance::Events::Signal( Application::Instance::EVENT_SYSTEM_BUSY );
list.Draw( tree.GetType(reinterpret_cast<const NMTREEVIEW&>(nmhdr).itemNew.hItem) );
}
void Launcher::OnNoSelection() const
{
statusBar.Text(StatusBar::FIRST_FIELD).Clear();
menu[IDM_LAUNCHER_FILE_RUN].Disable();
menu[IDM_LAUNCHER_FILE_EDITHEADER].Disable();
menu[IDM_LAUNCHER_EDIT_REMOVE].Disable();
}
void Launcher::OnCmdFileRun(uint)
{
if (const List::Files::Entry* const entry = list.GetSelection())
Application::Instance::GetMainWindow().Send( Application::Instance::WM_NST_LAUNCH, 0, Path(entry->GetPath(list.GetStrings()),entry->GetFile(list.GetStrings())).Ptr() );
}
void Launcher::OnCmdFileRefresh(uint)
{
list.Refresh();
}
void Launcher::OnCmdEditHeader(uint)
{
if (const List::Files::Entry* const entry = list.GetSelection())
Window::InesHeader( list.GetPaths() ).Open( Path(entry->GetPath(list.GetStrings()),entry->GetFile(list.GetStrings())) );
}
void Launcher::OnCmdViewShowGrids(uint)
{
menu[IDM_LAUNCHER_VIEW_SHOWGRIDS].Check( list.ToggleGrids() );
}
void Launcher::OnCmdViewShowDatabaseCorrected(uint)
{
menu[IDM_LAUNCHER_VIEW_SHOWDATABASECORRECTED].Check( list.ToggleDatabase() );
}
void Launcher::OnCmdViewShowOnTop(uint)
{
dialog.MakeTopMost( menu[IDM_LAUNCHER_VIEW_ONTOP].ToggleCheck() );
}
void Launcher::OnCmdOptionsPaths(uint)
{
list.OpenPathDialog();
menu[IDM_LAUNCHER_FILE_REFRESH].Enable( list.CanRefresh() );
}
void Launcher::OnCmdOptionsColors(uint)
{
colors.Open();
list.SetColors( colors.GetBackgroundColor(), colors.GetForegroundColor(), List::REPAINT );
tree.SetColors( colors.GetBackgroundColor(), colors.GetForegroundColor(), Tree::REPAINT );
}
}
}

View File

@@ -0,0 +1,811 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_DIALOG_LAUNCHER_H
#define NST_DIALOG_LAUNCHER_H
#pragma once
#include <vector>
#include <map>
#include "NstCollectionBitSet.hpp"
#include "NstWindowMenu.hpp"
#include "NstWindowStatusBar.hpp"
#include "NstWindowDialog.hpp"
#include "NstDialogFind.hpp"
#include "../core/api/NstApiCartridge.hpp"
#include <CommCtrl.h>
namespace Nes
{
using namespace Api;
}
namespace Nestopia
{
namespace Io
{
class File;
}
namespace Managers
{
class Paths;
}
namespace Window
{
class Launcher
{
public:
Launcher(const Nes::Cartridge::Database&,const Managers::Paths&,const Configuration&);
~Launcher();
void Save(Configuration&,bool,bool);
void Open(bool);
void Synchronize(HWND) const;
void Close();
private:
struct Handlers;
enum
{
STATUSBAR_SECOND_FIELD_WIDTH = 14,
CMD_ENTER = 1
};
void UpdateItemCount(uint) const;
void OnNoSelection() const;
ibool OnInitDialog (Param&);
ibool OnDropFiles (Param&);
ibool OnSize (Param&);
ibool OnCmdEnter (Param&);
ibool OnClose (Param&);
ibool OnDestroy (Param&);
void OnCmdFileRun (uint=0);
void OnCmdFileRefresh (uint);
void OnCmdEditHeader (uint);
void OnCmdViewShowGrids (uint);
void OnCmdViewShowDatabaseCorrected (uint);
void OnCmdViewShowOnTop (uint);
void OnCmdOptionsPaths (uint);
void OnCmdOptionsColors (uint);
void OnListGetDisplayInfo (const NMHDR&);
void OnListKeyDown (const NMHDR&);
void OnListColumnClick (const NMHDR&);
void OnListItemActivate (const NMHDR&);
void OnListItemChanged (const NMHDR&);
void OnListInsertItem (const NMHDR&);
void OnListDeleteItem (const NMHDR&);
void OnListDeleteAllItems (const NMHDR&);
void OnTreeSelectionChanging (const NMHDR&);
class List
{
public:
List
(
Dialog&,
Menu::CmdHandler&,
const Managers::Paths&,
const Configuration&,
const Nes::Cartridge::Database&
);
~List();
void operator = (const Control::ListView&);
enum Updater
{
DONT_REPAINT,
REPAINT
};
void Add(wcstring);
void Close();
void Save(Configuration&,bool);
void Sort(uint=0);
bool CanRefresh() const;
void Refresh();
void Insert(const Param&);
void SetColors(uint,uint,Updater=DONT_REPAINT) const;
void OnGetDisplayInfo(LPARAM);
class Paths
{
public:
explicit Paths(const Configuration&);
void Save(Configuration&) const;
struct Settings
{
struct Folder
{
Path path;
bool incSubDir;
};
typedef std::vector<Folder> Folders;
struct Include : Collection::BitSet
{
enum
{
NES,UNF,XML,FDS,NSF,PATCH,ARCHIVE,ANY,UNIQUE
};
enum
{
TYPES = NES|UNF|XML|FDS|NSF|PATCH,
FILES = TYPES|ARCHIVE
};
explicit Include(bool a=false)
: Collection::BitSet( (0xFF^0x40) | uint(a) << 6 ) {}
};
Include include;
Folders folders;
};
private:
struct Handlers;
enum
{
LIMIT = 999
};
ibool OnInitDialog (Param&);
ibool OnCmdAdd (Param&);
ibool OnCmdRemove (Param&);
ibool OnCmdClear (Param&);
ibool OnCmdOk (Param&);
void OnKeyDown (const NMHDR&);
void OnItemChanged (const NMHDR&);
void OnInsertItem (const NMHDR&);
void OnDeleteItem (const NMHDR&);
Settings settings;
Dialog dialog;
const Control::NotificationHandler notifications;
public:
void Open()
{
dialog.Open();
}
const Settings& GetSettings() const
{
return settings;
}
};
class Files
{
class Inserter;
class Searcher;
public:
class Strings
{
HeapString container;
public:
explicit Strings(uint=0);
typedef uint Index;
enum
{
NONE = -1
};
int Find(GenericString) const;
void Clear();
template<typename T>
Index operator << (const T& t)
{
uint pos = container.Length();
container << t << '\0';
return pos;
}
Index Import(cstring t)
{
uint pos = container.Length();
container.Import( t );
container << '\0';
return pos;
}
wcstring operator [] (uint i) const
{
return container.Ptr() + i;
}
uint Size() const
{
return container.Length() * (container.Wide() ? 2 : 1);
}
};
Files();
void Load();
void Save();
void Refresh(const Paths::Settings&,const Nes::Cartridge::Database&);
bool Insert(const Nes::Cartridge::Database&,GenericString);
void Clear();
bool ShouldDefrag() const;
void Defrag();
class Entry
{
friend class Files;
friend class Inserter;
friend class Searcher;
public:
typedef Nes::Cartridge::Database Db;
enum Type
{
NES = 0x01,
UNF = 0x02,
XML = 0x04,
FDS = 0x08,
NSF = 0x10,
PATCH = 0x20,
ARCHIVE = 0x80,
ALL = NES|UNF|XML|FDS|NSF|PATCH
};
enum
{
SYSTEM_UNKNOWN,
SYSTEM_PC10,
SYSTEM_VS,
SYSTEM_PAL,
SYSTEM_NTSC,
SYSTEM_NTSC_PAL
};
uint GetSystem(const Db*) const;
private:
explicit Entry(uint=0);
Db::Entry SearchDb(const Db*) const;
enum
{
ATR_BATTERY = 0x08,
ATR_PC10 = 0x10,
ATR_VS = 0x20,
ATR_PAL = 0x40,
ATR_NTSC = 0x80,
ATR_NTSC_PAL = ATR_PAL|ATR_NTSC,
ATR_DEFAULT_FDS = ATR_NTSC
};
Strings::Index file;
Strings::Index path;
Strings::Index name;
typedef Nes::Cartridge::Profile::Hash Hash;
Hash hash;
ushort pRom;
ushort cRom;
ushort wRam;
ushort vRam;
ushort mapper;
uchar type;
uchar attributes;
public:
uint GetType() const
{
return type;
}
wcstring GetPath(const Strings& strings) const
{
return strings[path];
}
wcstring GetFile(const Strings& strings) const
{
return strings[file];
}
wcstring GetName(const Strings& strings,const Db* db) const
{
if (const Db::Entry entry = SearchDb( db ))
{
wcstring title = entry.GetTitle();
if (*title)
return title;
}
return name ? strings[name] : L"-";
}
uint GetPRom(const Db* db=NULL) const
{
if (const Db::Entry entry = SearchDb( db ))
return entry.GetPrgRom() / Nes::Core::SIZE_1K;
else
return pRom;
}
uint GetCRom(const Db* db=NULL) const
{
if (const Db::Entry entry = SearchDb( db ))
return entry.GetChrRom() / Nes::Core::SIZE_1K;
else
return cRom;
}
uint GetWRam(const Db* db=NULL) const
{
if (const Db::Entry entry = SearchDb( db ))
return entry.GetWram() / Nes::Core::SIZE_1K;
else
return wRam;
}
uint GetVRam(const Db* db=NULL) const
{
if (const Db::Entry entry = SearchDb( db ))
return entry.GetVram() / Nes::Core::SIZE_1K;
else
return vRam;
}
bool GetBattery(const Db* db=NULL) const
{
if (const Db::Entry entry = SearchDb( db ))
return entry.HasBattery();
else
return (attributes & ATR_BATTERY);
}
uint GetMapper(const Db* db=NULL) const
{
if (const Db::Entry entry = SearchDb( db ))
return entry.GetMapper();
else
return mapper;
}
Nes::Cartridge::Profile::Dump::State GetDump(const Db* db=NULL) const
{
if (const Db::Entry entry = SearchDb( db ))
return entry.GetDumpState();
else
return Nes::Cartridge::Profile::Dump::UNKNOWN;
}
};
typedef Collection::Vector<Entry> Entries;
private:
enum Exception
{
ERR_CORRUPT_DATA
};
enum
{
MAX_ENTRIES = 0xFFFFF,
GARBAGE_THRESHOLD = 127
};
ushort dirty;
ushort loaded;
Strings strings;
Entries entries;
public:
uint Count() const
{
return entries.Size();
}
const Entry& operator [] (uint i) const
{
return entries[i];
}
void Disable(Entry* entry)
{
if (entry->type)
{
entry->type = 0;
dirty = true;
}
}
const Strings& GetStrings() const
{
return strings;
}
};
class Columns
{
public:
explicit Columns(const Configuration&);
void Update(const uchar*);
void Save(Configuration&) const;
enum Type
{
TYPE_FILE,
TYPE_SYSTEM,
TYPE_MAPPER,
TYPE_PROM,
TYPE_CROM,
TYPE_WRAM,
TYPE_VRAM,
TYPE_BATTERY,
TYPE_DUMP,
TYPE_NAME,
TYPE_FOLDER,
NUM_TYPES,
NUM_DEFAULT_SELECTED_TYPES = 9,
NUM_DEFAULT_AVAILABLE_TYPES = NUM_TYPES - NUM_DEFAULT_SELECTED_TYPES
};
private:
struct Handlers;
void Reset();
void Add(uint,uint);
void UpdateButtonRemove();
void UpdateButtonAdd();
ibool OnInitDialog (Param&);
ibool OnCmdSelected (Param&);
ibool OnCmdAvailable (Param&);
ibool OnCmdAdd (Param&);
ibool OnCmdRemove (Param&);
ibool OnCmdDefault (Param&);
ibool OnCmdOk (Param&);
typedef Collection::Vector<uchar> Types;
Types available;
Types selected;
Dialog dialog;
static wcstring const cfgStrings[NUM_TYPES];
public:
uint Count() const
{
return selected.Size();
}
Type GetType(uint i) const
{
return Type(selected[i]);
}
uint GetStringId(uint i) const
{
return IDS_LAUNCHER_COLUMN_FILE + selected[i];
}
void Open()
{
dialog.Open();
}
};
private:
class Strings
{
public:
wcstring GetMapper(uint);
wcstring GetSize(uint);
void Flush();
private:
struct ValueString
{
wchar_t string[5];
};
typedef String::Stack<10+1> SizeString;
typedef std::map<uint,SizeString> Sizes;
typedef Collection::Vector<ValueString> Mappers;
Sizes sizes;
Mappers mappers;
};
enum
{
STYLE =
(
LVS_EX_FULLROWSELECT |
LVS_EX_TWOCLICKACTIVATE |
LVS_EX_HEADERDRAGDROP
)
};
void ReloadListColumns() const;
void UpdateColumnOrder();
void UpdateSortColumnOrder(uint);
void Redraw();
int Sorter(const void*,const void*);
void OnFind(GenericString,uint);
bool Optimize();
void OnCmdEditFind (uint);
void OnCmdEditInsert (uint);
void OnCmdEditDelete (uint);
void OnCmdEditClear (uint);
void OnCmdViewAlignColumns (uint);
void OnCmdOptionsColumns (uint);
Control::ListView ctrl;
const Nes::Cartridge::Database imageDatabase;
const Nes::Cartridge::Database* useImageDatabase;
uchar order[Columns::NUM_TYPES];
uint typeFilter;
uint style;
Finder finder;
Paths paths;
Files files;
Columns columns;
Strings strings;
const Managers::Paths& pathManager;
public:
Generic GetWindow() const
{
return ctrl.GetWindow();
}
void OpenPathDialog()
{
paths.Open();
}
void Draw(uint type)
{
typeFilter = type;
Redraw();
}
bool DatabaseCorrectionEnabled() const
{
return useImageDatabase;
}
bool ToggleDatabase()
{
useImageDatabase = (useImageDatabase ? NULL : &imageDatabase);
ctrl.Redraw();
return useImageDatabase;
}
bool ToggleGrids()
{
style ^= LVS_EX_GRIDLINES;
ctrl.StyleEx() = style;
return style & LVS_EX_GRIDLINES;
}
bool HitTest(const Point& point) const
{
return ctrl.HitTest( point.x, point.y );
}
uint GetStyle() const
{
return ctrl.StyleEx();
}
HWND GetHandle() const
{
return ctrl.GetHandle();
}
uint NumPaths() const
{
return paths.GetSettings().folders.size();
}
uint Size() const
{
return ctrl.Size();
}
const Files::Entry* operator [] (uint i) const
{
return static_cast<const Files::Entry*>(static_cast<const void*>( ctrl[i].Data() ));
}
const Files::Entry* GetSelection() const
{
int index = ctrl.Selection().GetIndex();
return index >= 0 ? (*this)[index] : NULL;
}
const Files::Strings& GetStrings() const
{
return files.GetStrings();
}
const Managers::Paths& GetPaths() const
{
return pathManager;
}
};
class Tree
{
public:
Tree();
void operator = (const Control::TreeView&);
enum Updater {DONT_REPAINT,REPAINT};
void SetColors(uint,uint,Updater=DONT_REPAINT) const;
uint GetType(HTREEITEM) const;
void Close();
private:
Control::TreeView ctrl;
uint selection;
const Control::TreeView::ImageList imageList;
public:
Generic GetWindow() const
{
return ctrl.GetWindow();
}
};
class Colors
{
public:
explicit Colors(const Configuration&);
void Save(Configuration&) const;
private:
struct Handlers;
enum
{
DEF_BACKGROUND_COLOR = RGB(0xFF,0xFF,0xFF),
DEF_FOREGROUND_COLOR = RGB(0x00,0x00,0x00)
};
struct Type
{
inline Type(int,int,int,int);
COLORREF color;
const Rect rect;
};
void UpdateColor(const Type&) const;
void UpdateColors() const;
void ChangeColor(COLORREF&);
ibool OnInitDialog (Param&);
ibool OnPaint (Param&);
ibool OnCmdChangeBackground (Param&);
ibool OnCmdChangeForeground (Param&);
ibool OnCmdDefault (Param&);
Type background;
Type foreground;
COLORREF customColors[16];
Dialog dialog;
public:
COLORREF GetBackgroundColor() const
{
return background.color;
}
COLORREF GetForegroundColor() const
{
return foreground.color;
}
void Open()
{
dialog.Open();
}
};
Dialog dialog;
Menu menu;
Control::NotificationHandler listNotifications;
Control::NotificationHandler treeNotifications;
StatusBar statusBar;
Tree tree;
List list;
Point margin;
Colors colors;
Point initialSize;
};
}
}
#endif

View File

@@ -0,0 +1,150 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstDialogLauncher.hpp"
#include <CommDlg.h>
namespace Nestopia
{
namespace Window
{
inline Launcher::Colors::Type::Type(int l,int t,int r,int b)
: rect(l,t,r,b) {}
struct Launcher::Colors::Handlers
{
static const MsgHandler::Entry<Colors> messages[];
static const MsgHandler::Entry<Colors> commands[];
};
const MsgHandler::Entry<Launcher::Colors> Launcher::Colors::Handlers::messages[] =
{
{ WM_INITDIALOG, &Colors::OnInitDialog },
{ WM_PAINT, &Colors::OnPaint }
};
const MsgHandler::Entry<Launcher::Colors> Launcher::Colors::Handlers::commands[] =
{
{ IDC_LAUNCHER_COLORS_BG_CHANGE, &Colors::OnCmdChangeBackground },
{ IDC_LAUNCHER_COLORS_FG_CHANGE, &Colors::OnCmdChangeForeground },
{ IDC_LAUNCHER_COLORS_DEFAULT, &Colors::OnCmdDefault }
};
Launcher::Colors::Colors(const Configuration& cfg)
:
background (20,94,74,114),
foreground (20,33,74,53),
dialog (IDD_LAUNCHER_COLORS,this,Handlers::messages,Handlers::commands)
{
Configuration::ConstSection color( cfg["launcher"]["view"]["colors"] );
background.color = color["background"].Int( DEF_BACKGROUND_COLOR );
foreground.color = color["foreground"].Int( DEF_FOREGROUND_COLOR );
}
void Launcher::Colors::Save(Configuration& cfg) const
{
Configuration::Section color( cfg["launcher"]["view"]["colors"] );
color[ "foreground" ].Str() = HexString( 32, foreground.color );
color[ "background" ].Str() = HexString( 32, background.color );
}
void Launcher::Colors::UpdateColor(const Type& type) const
{
if (HDC const hDC = ::GetDC( dialog ))
{
HPEN const hPen = ::CreatePen( PS_SOLID, 1, RGB(0x00,0x00,0x00) );
HPEN const hPenOld = static_cast<HPEN>(::SelectObject( hDC, hPen ));
HBRUSH const hBrush = ::CreateSolidBrush( type.color );
HBRUSH const hBrushOld = static_cast<HBRUSH>(::SelectObject( hDC, hBrush ));
::Rectangle( hDC, type.rect.left, type.rect.top, type.rect.right, type.rect.bottom );
::SelectObject( hDC, hBrushOld );
::DeleteObject( hBrush );
::SelectObject( hDC, hPenOld );
::DeleteObject( hPen );
::ReleaseDC( dialog, hDC );
}
}
void Launcher::Colors::ChangeColor(COLORREF& color)
{
Object::Pod<CHOOSECOLOR> cc;
cc.lStructSize = sizeof(cc);
cc.hwndOwner = dialog;
cc.lpCustColors = customColors;
cc.rgbResult = color;
cc.Flags = CC_FULLOPEN|CC_RGBINIT;
if (::ChooseColor( &cc ))
color = cc.rgbResult;
}
void Launcher::Colors::UpdateColors() const
{
UpdateColor( background );
UpdateColor( foreground );
}
ibool Launcher::Colors::OnInitDialog(Param&)
{
UpdateColors();
return true;
}
ibool Launcher::Colors::OnPaint(Param&)
{
UpdateColors();
return false;
}
ibool Launcher::Colors::OnCmdChangeBackground(Param&)
{
ChangeColor( background.color );
UpdateColor( background );
return true;
}
ibool Launcher::Colors::OnCmdChangeForeground(Param&)
{
ChangeColor( foreground.color );
UpdateColor( foreground );
return true;
}
ibool Launcher::Colors::OnCmdDefault(Param&)
{
background.color = DEF_BACKGROUND_COLOR;
foreground.color = DEF_FOREGROUND_COLOR;
UpdateColors();
return true;
}
}
}

View File

@@ -0,0 +1,308 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstResourceString.hpp"
#include "NstWindowParam.hpp"
#include "NstDialogLauncher.hpp"
namespace Nestopia
{
namespace Window
{
NST_COMPILE_ASSERT
(
IDS_LAUNCHER_COLUMN_SYSTEM == IDS_LAUNCHER_COLUMN_FILE + 1 &&
IDS_LAUNCHER_COLUMN_MAPPER == IDS_LAUNCHER_COLUMN_FILE + 2 &&
IDS_LAUNCHER_COLUMN_PRG == IDS_LAUNCHER_COLUMN_FILE + 3 &&
IDS_LAUNCHER_COLUMN_CHR == IDS_LAUNCHER_COLUMN_FILE + 4 &&
IDS_LAUNCHER_COLUMN_WRAM == IDS_LAUNCHER_COLUMN_FILE + 5 &&
IDS_LAUNCHER_COLUMN_VRAM == IDS_LAUNCHER_COLUMN_FILE + 6 &&
IDS_LAUNCHER_COLUMN_BATTERY == IDS_LAUNCHER_COLUMN_FILE + 7 &&
IDS_LAUNCHER_COLUMN_DUMP == IDS_LAUNCHER_COLUMN_FILE + 8 &&
IDS_LAUNCHER_COLUMN_NAME == IDS_LAUNCHER_COLUMN_FILE + 9 &&
IDS_LAUNCHER_COLUMN_FOLDER == IDS_LAUNCHER_COLUMN_FILE + 10
);
wcstring const Launcher::List::Columns::cfgStrings[NUM_TYPES] =
{
L"file",
L"system",
L"mapper",
L"prg",
L"chr",
L"wram",
L"vram",
L"battery",
L"dump",
L"name",
L"folder"
};
struct Launcher::List::Columns::Handlers
{
static const MsgHandler::Entry<Columns> messages[];
static const MsgHandler::Entry<Columns> commands[];
};
const MsgHandler::Entry<Launcher::List::Columns> Launcher::List::Columns::Handlers::messages[] =
{
{ WM_INITDIALOG, &Columns::OnInitDialog }
};
const MsgHandler::Entry<Launcher::List::Columns> Launcher::List::Columns::Handlers::commands[] =
{
{ IDC_LAUNCHER_COLUMNSELECT_SELECTED, &Columns::OnCmdSelected },
{ IDC_LAUNCHER_COLUMNSELECT_AVAILABLE, &Columns::OnCmdAvailable },
{ IDC_LAUNCHER_COLUMNSELECT_ADD, &Columns::OnCmdAdd },
{ IDC_LAUNCHER_COLUMNSELECT_REMOVE, &Columns::OnCmdRemove },
{ IDC_LAUNCHER_COLUMNSELECT_DEFAULT, &Columns::OnCmdDefault },
{ IDOK, &Columns::OnCmdOk }
};
Launcher::List::Columns::Columns(const Configuration& cfg)
:
available (NUM_TYPES),
dialog (IDD_LAUNCHER_COLUMNS,this,Handlers::messages,Handlers::commands)
{
Configuration::ConstSection column( cfg["launcher"]["view"]["columns"]["column"] );
for (uint i=0; i < NUM_TYPES; ++i)
available[i] = i;
selected.Reserve( NUM_TYPES );
for (uint i=0; i < NUM_TYPES; ++i)
{
const GenericString string( column[i].Str() );
if (string.Empty())
break;
for (Types::Iterator it(available.Begin()), end(available.End()); it != end; ++it)
{
if (string == cfgStrings[*it])
{
selected.PushBack( *it );
available.Erase( it );
break;
}
}
}
if (selected.Empty())
Reset();
}
void Launcher::List::Columns::Reset()
{
selected.Resize( NUM_DEFAULT_SELECTED_TYPES );
available.Resize( NUM_DEFAULT_AVAILABLE_TYPES );
for (uint i=0; i < NUM_DEFAULT_SELECTED_TYPES; ++i)
selected[i] = i;
for (uint i=0; i < NUM_DEFAULT_AVAILABLE_TYPES; ++i)
available[i] = NUM_DEFAULT_SELECTED_TYPES + i;
}
void Launcher::List::Columns::Update(const uchar* const order)
{
selected.Assign( order, selected.Size() );
}
void Launcher::List::Columns::Save(Configuration& cfg) const
{
if (const uint n=selected.Size())
{
Configuration::Section column( cfg["launcher"]["view"]["columns"]["column"] );
for (uint i=0; i < n; ++i)
column[i].Str() = cfgStrings[selected[i]];
}
}
void Launcher::List::Columns::UpdateButtonRemove()
{
const Control::ListBox list( dialog.ListBox(IDC_LAUNCHER_COLUMNSELECT_SELECTED) );
dialog.Control(IDC_LAUNCHER_COLUMNSELECT_REMOVE).Enable
(
list.Size() > 1 && list.Selection()
);
}
void Launcher::List::Columns::UpdateButtonAdd()
{
dialog.Control(IDC_LAUNCHER_COLUMNSELECT_ADD).Enable
(
dialog.ListBox(IDC_LAUNCHER_COLUMNSELECT_AVAILABLE).Selection()
);
}
ibool Launcher::List::Columns::OnInitDialog(Param&)
{
Control::ListBox list( dialog.ListBox(IDC_LAUNCHER_COLUMNSELECT_SELECTED) );
list.Reserve( selected.Size() );
for (Types::ConstIterator it(selected.Begin()), end(selected.End()); it != end; ++it)
list.Add( Resource::String( IDS_LAUNCHER_COLUMN_FILE + *it ) );
list[0].Select();
list = dialog.ListBox(IDC_LAUNCHER_COLUMNSELECT_AVAILABLE);
list.Reserve( available.Size() );
for (Types::ConstIterator it(available.Begin()), end(available.End()); it != end; ++it)
list.Add( Resource::String( IDS_LAUNCHER_COLUMN_FILE + *it ) );
list[0].Select();
return true;
}
ibool Launcher::List::Columns::OnCmdSelected(Param& param)
{
if (param.ListBox().SelectionChanged())
UpdateButtonRemove();
return true;
}
ibool Launcher::List::Columns::OnCmdAvailable(Param& param)
{
if (param.ListBox().SelectionChanged())
UpdateButtonAdd();
return true;
}
ibool Launcher::List::Columns::OnCmdAdd(Param& param)
{
if (param.Button().Clicked())
Add( IDC_LAUNCHER_COLUMNSELECT_SELECTED, IDC_LAUNCHER_COLUMNSELECT_AVAILABLE );
return true;
}
ibool Launcher::List::Columns::OnCmdRemove(Param& param)
{
if (param.Button().Clicked())
Add( IDC_LAUNCHER_COLUMNSELECT_AVAILABLE, IDC_LAUNCHER_COLUMNSELECT_SELECTED );
return true;
}
ibool Launcher::List::Columns::OnCmdDefault(Param& param)
{
if (param.Button().Clicked())
{
Control::ListBox list( dialog.ListBox(IDC_LAUNCHER_COLUMNSELECT_SELECTED) );
list.Clear();
for (uint i=0; i < NUM_DEFAULT_SELECTED_TYPES; ++i)
list.Add( Resource::String( IDS_LAUNCHER_COLUMN_FILE + i) );
list[0].Select();
list = dialog.ListBox(IDC_LAUNCHER_COLUMNSELECT_AVAILABLE);
list.Clear();
for (uint i=0; i < NUM_DEFAULT_AVAILABLE_TYPES; ++i)
list.Add( Resource::String( IDS_LAUNCHER_COLUMN_FILE + NUM_DEFAULT_SELECTED_TYPES + i) );
list[0].Select();
dialog.Control( IDC_LAUNCHER_COLUMNSELECT_REMOVE ).Enable();
dialog.Control( IDC_LAUNCHER_COLUMNSELECT_ADD ).Enable();
}
return true;
}
ibool Launcher::List::Columns::OnCmdOk(Param& param)
{
if (param.Button().Clicked())
{
HeapString text;
for (uint i=0; i < 2; ++i)
{
Control::ListBox list = dialog.ListBox
(
i ? IDC_LAUNCHER_COLUMNSELECT_SELECTED :
IDC_LAUNCHER_COLUMNSELECT_AVAILABLE
);
Types& types = (i ? selected : available);
types.Resize( list.Size() );
for (uint j=0; j < types.Size(); ++j)
{
list[j].Text() >> text;
for (uint k=0; k < NUM_TYPES; ++k)
{
if (text == Resource::String( IDS_LAUNCHER_COLUMN_FILE + k))
{
types[j] = k;
break;
}
}
}
}
dialog.Close();
}
return true;
}
void Launcher::List::Columns::Add(const uint iDst,const uint iSrc)
{
const Control::ListBox cSrc( dialog.ListBox(iSrc) );
const int sSrc = cSrc.Selection().GetIndex();
if (sSrc >= 0 && (iDst == IDC_LAUNCHER_COLUMNSELECT_SELECTED || cSrc.Size() > 1))
{
HeapString text;
cSrc[sSrc].Text() >> text;
const Control::ListBox cDst( dialog.ListBox(iDst) );
const int sDst = cDst.Selection().GetIndex();
if (sDst >= 0)
cDst.Insert( sDst + 1, text.Ptr() ).Select();
else
cDst.Add( text.Ptr() );
cSrc[sSrc].Remove();
if (cSrc.Size() > sSrc)
cSrc[sSrc].Select();
UpdateButtonRemove();
UpdateButtonAdd();
}
}
}
}

View File

@@ -0,0 +1,64 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstIoFile.hpp"
#include "NstDialogLauncher.hpp"
namespace Nestopia
{
namespace Window
{
Launcher::List::Files::Strings::Strings(const uint reserve)
{
container.Reserve( 2 + reserve );
container.Assign( L"-\0", 2 );
}
int Launcher::List::Files::Strings::Find(const GenericString needle) const
{
wcstring it = container.Ptr();
wcstring const end = it + container.Length();
NST_ASSERT( *(end-1) == '\0' );
do
{
const GenericString string( it );
if (needle == string)
return it - container.Ptr();
it += string.Length() + 1;
}
while (it != end);
return -1;
}
void Launcher::List::Files::Strings::Clear()
{
container.ShrinkTo( 2 );
container.Defrag();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,726 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstWindowUser.hpp"
#include "NstWindowDropFiles.hpp"
#include "NstResourceString.hpp"
#include "NstDialogFind.hpp"
#include "NstManagerPaths.hpp"
#include "NstDialogLauncher.hpp"
#include <Shlwapi.h>
namespace Nestopia
{
namespace Window
{
#ifdef NST_MSVC_OPTIMIZE
#pragma optimize("t", on)
#endif
wcstring Launcher::List::Strings::GetMapper(const uint value)
{
if (value-1 < 4095)
{
uint count = mappers.Size();
if (count <= value)
{
const uint size = NST_MAX(256,count+value+1);
mappers.Resize( size );
do
{
_itow( count, mappers[count].string, 10 );
}
while (++count != size);
}
return mappers[value].string;
}
else
{
return L"-";
}
}
wcstring Launcher::List::Strings::GetSize(uint value)
{
if (value)
{
SizeString& string = sizes[value];
if (string.Empty())
string << value << 'k';
return string.Ptr();
}
return L"-";
}
#ifdef NST_MSVC_OPTIMIZE
#pragma optimize("", on)
#endif
void Launcher::List::Strings::Flush()
{
sizes.clear();
mappers.Destroy();
}
Launcher::List::List
(
Dialog& dialog,
Menu::CmdHandler& cmdHandler,
const Managers::Paths& p,
const Configuration& cfg,
const Nes::Cartridge::Database& database
)
:
imageDatabase ( database ),
useImageDatabase ( NULL ),
typeFilter ( 0 ),
style ( STYLE ),
finder ( dialog ),
paths ( cfg ),
columns ( cfg ),
pathManager ( p )
{
static const Menu::CmdHandler::Entry<Launcher::List> commands[] =
{
{ IDM_LAUNCHER_EDIT_FIND, &List::OnCmdEditFind },
{ IDM_LAUNCHER_EDIT_INSERT, &List::OnCmdEditInsert },
{ IDM_LAUNCHER_EDIT_REMOVE, &List::OnCmdEditDelete },
{ IDM_LAUNCHER_EDIT_CLEAR, &List::OnCmdEditClear },
{ IDM_LAUNCHER_VIEW_ALIGNCOLUMNS, &List::OnCmdViewAlignColumns },
{ IDM_LAUNCHER_OPTIONS_COLUMNS, &List::OnCmdOptionsColumns }
};
cmdHandler.Add( this, commands );
Configuration::ConstSection show( cfg["launcher"]["view"]["show"] );
if (!show["grid-lines"].No())
style |= LVS_EX_GRIDLINES;
if (!show["image-database-adjusted"].No())
useImageDatabase = &imageDatabase;
}
Launcher::List::~List()
{
}
void Launcher::List::operator = (const Control::ListView& listView)
{
files.Load();
typeFilter = 0;
ctrl = listView;
ctrl.StyleEx() = style;
ReloadListColumns();
ctrl.Reserve( files.Count() );
ctrl.Columns().Align();
InvalidateRect( ctrl.GetWindow(), NULL, false );
}
void Launcher::List::Close()
{
finder.Close();
UpdateColumnOrder();
columns.Update( order );
strings.Flush();
}
void Launcher::List::Insert(const Param& param)
{
DropFiles dropFiles( param );
if (dropFiles.Inside( ctrl.GetHandle() ))
{
uint anyInserted = false;
for (uint i=0, n=dropFiles.Size(); i < n; ++i)
anyInserted |= uint(files.Insert( imageDatabase, dropFiles[i] ));
if (anyInserted && !Optimize())
Redraw();
}
}
void Launcher::List::Add(wcstring const fileName)
{
if (files.Insert( imageDatabase, fileName ) && !Optimize())
Redraw();
}
void Launcher::List::Save(Configuration& cfg,bool saveFiles)
{
paths.Save( cfg );
columns.Save( cfg );
if (saveFiles)
files.Save();
Configuration::Section show( cfg["launcher"]["view"]["show"] );
show["grid-lines"].YesNo() = style & LVS_EX_GRIDLINES;
show["image-database-adjusted"].YesNo() = useImageDatabase;
}
void Launcher::List::SetColors(const uint bg,const uint fg,const Updater redraw) const
{
ctrl.SetBkColor( bg );
ctrl.SetTextBkColor( bg );
ctrl.SetTextColor( fg );
if (redraw)
ctrl.Redraw();
}
void Launcher::List::Redraw()
{
Application::Instance::Waiter wait;
Generic::LockDraw lock( ctrl.GetHandle() );
ctrl.Clear();
if (const uint count = files.Count())
{
uint size = 0;
for (uint i=0; i < count; ++i)
size += (files[i].GetType() & typeFilter) != 0;
if (size)
{
ctrl.Reserve( size );
for (uint i=0; i < count; ++i)
{
if (files[i].GetType() & typeFilter)
ctrl.Add( GenericString(), &files[i] );
}
Sort();
ctrl.Columns().Align();
}
}
}
bool Launcher::List::Optimize()
{
if (files.ShouldDefrag())
{
files.Defrag();
Redraw();
return true;
}
return false;
}
bool Launcher::List::CanRefresh() const
{
return
(
(paths.GetSettings().folders.size()) &&
(paths.GetSettings().include.Word() & Paths::Settings::Include::TYPES)
);
}
void Launcher::List::Refresh()
{
if (CanRefresh())
{
{
Application::Instance::Waiter wait;
ctrl.Clear();
}
files.Refresh( paths.GetSettings(), imageDatabase );
ctrl.Reserve( files.Count() );
Redraw();
}
}
#ifdef NST_MSVC_OPTIMIZE
#pragma optimize("t", on)
#endif
void Launcher::List::OnGetDisplayInfo(LPARAM lParam)
{
LVITEM& item = reinterpret_cast<NMLVDISPINFO*>(lParam)->item;
if (item.mask & LVIF_TEXT)
{
const Files::Entry& entry = *reinterpret_cast<const Files::Entry*>( item.lParam );
switch (columns.GetType( item.iSubItem ))
{
case Columns::TYPE_FILE:
item.pszText = const_cast<wchar_t*>( entry.GetFile(files.GetStrings()) );
break;
case Columns::TYPE_SYSTEM:
{
NST_COMPILE_ASSERT
(
Files::Entry::SYSTEM_UNKNOWN == 0 &&
Files::Entry::SYSTEM_PC10 == 1 &&
Files::Entry::SYSTEM_VS == 2 &&
Files::Entry::SYSTEM_PAL == 3 &&
Files::Entry::SYSTEM_NTSC == 4 &&
Files::Entry::SYSTEM_NTSC_PAL == 5
);
static const wchar_t lut[][9] =
{
L"-",
L"pc10",
L"vs",
L"pal",
L"ntsc",
L"ntsc/pal"
};
item.pszText = const_cast<wchar_t*>( lut[entry.GetSystem( useImageDatabase )] );
break;
}
case Columns::TYPE_BATTERY:
item.pszText = const_cast<wchar_t*>
(
(entry.GetType() & (Files::Entry::NES|Files::Entry::UNF)) ?
entry.GetBattery( useImageDatabase ) ? L"yes" : L"no" : L"-"
);
break;
case Columns::TYPE_DUMP:
{
NST_COMPILE_ASSERT
(
Nes::Cartridge::Profile::Dump::OK == 0 &&
Nes::Cartridge::Profile::Dump::BAD == 1 &&
Nes::Cartridge::Profile::Dump::UNKNOWN == 2
);
static const wchar_t lut[][4] =
{
L"ok",
L"bad",
L"-"
};
item.pszText = const_cast<wchar_t*>( lut[entry.GetDump( useImageDatabase )] );
break;
}
case Columns::TYPE_NAME:
item.pszText = const_cast<wchar_t*>( entry.GetName( files.GetStrings(), useImageDatabase ) );
break;
case Columns::TYPE_FOLDER:
item.pszText = const_cast<wchar_t*>( entry.GetPath( files.GetStrings() ) );
break;
case Columns::TYPE_PROM:
item.pszText = const_cast<wchar_t*>( strings.GetSize(entry.GetPRom(useImageDatabase)) );
break;
case Columns::TYPE_CROM:
if (const uint cRom = entry.GetCRom( useImageDatabase ))
item.pszText = const_cast<wchar_t*>( strings.GetSize( cRom ) );
else
item.pszText = const_cast<wchar_t*>( L"-" );
break;
case Columns::TYPE_MAPPER:
item.pszText = const_cast<wchar_t*>( strings.GetMapper(entry.GetMapper( useImageDatabase )) );
break;
case Columns::TYPE_WRAM:
if (const uint wRam = entry.GetWRam( useImageDatabase ))
item.pszText = const_cast<wchar_t*>( strings.GetSize( wRam ) );
else
item.pszText = const_cast<wchar_t*>( L"-" );
break;
case Columns::TYPE_VRAM:
if (const uint vRam = entry.GetVRam( useImageDatabase ))
item.pszText = const_cast<wchar_t*>( strings.GetSize( vRam ) );
else
item.pszText = const_cast<wchar_t*>( L"-" );
break;
}
}
}
#ifdef NST_MSVC_OPTIMIZE
#pragma optimize("", on)
#endif
void Launcher::List::ReloadListColumns() const
{
ctrl.Columns().Clear();
for (uint i=0; i < columns.Count(); ++i)
ctrl.Columns().Insert( i, Resource::String(columns.GetStringId(i)).Ptr() );
}
void Launcher::List::UpdateColumnOrder()
{
int array[Columns::NUM_TYPES];
ctrl.Columns().GetOrder( array, columns.Count() );
for (uint i=0; i < columns.Count(); ++i)
order[i] = columns.GetType( array[i] );
}
void Launcher::List::UpdateSortColumnOrder(const uint firstSortColumn)
{
int array[Columns::NUM_TYPES];
ctrl.Columns().GetOrder( array, columns.Count() );
order[0] = columns.GetType( firstSortColumn );
for (uint i=0, j=1; i < columns.Count(); ++i)
{
if (firstSortColumn != array[i])
order[j++] = columns.GetType( array[i] );
}
}
void Launcher::List::Sort(const uint firstSortColumn)
{
if (ctrl.Size() > 1)
{
UpdateSortColumnOrder( firstSortColumn );
ctrl.Sort( this, &List::Sorter );
}
}
int Launcher::List::Sorter(const void* obj1,const void* obj2)
{
const Files::Entry& a = *static_cast<const Files::Entry*>( obj1 );
const Files::Entry& b = *static_cast<const Files::Entry*>( obj2 );
for (uint i=0, n=columns.Count(); i < n; ++i)
{
switch (order[i])
{
case Columns::TYPE_FILE:
if (const int ret = ::StrCmp( a.GetFile(files.GetStrings()), b.GetFile(files.GetStrings()) ))
return ret;
continue;
case Columns::TYPE_SYSTEM:
{
const uint system[] =
{
a.GetSystem( useImageDatabase ),
b.GetSystem( useImageDatabase )
};
if (system[0] == system[1])
continue;
return system[0] < system[1] ? +1 : -1;
}
case Columns::TYPE_MAPPER:
{
const uint mapper[] =
{
a.GetMapper( useImageDatabase ),
b.GetMapper( useImageDatabase )
};
if (mapper[0] == mapper[1])
continue;
return mapper[0] > mapper[1] ? +1 : -1;
}
case Columns::TYPE_PROM:
{
const uint pRom[] =
{
a.GetPRom( useImageDatabase ),
b.GetPRom( useImageDatabase )
};
if (pRom[0] == pRom[1])
continue;
return pRom[0] > pRom[1] ? +1 : -1;
}
case Columns::TYPE_CROM:
{
const uint cRom[] =
{
a.GetCRom( useImageDatabase ),
b.GetCRom( useImageDatabase )
};
if (cRom[0] == cRom[1])
continue;
return cRom[0] > cRom[1] ? +1 : -1;
}
case Columns::TYPE_WRAM:
{
const uint wRam[] =
{
a.GetWRam( useImageDatabase ),
b.GetWRam( useImageDatabase )
};
if (wRam[0] == wRam[1])
continue;
return wRam[0] > wRam[1] ? +1 : -1;
}
case Columns::TYPE_VRAM:
{
const uint vRam[] =
{
a.GetVRam( useImageDatabase ),
b.GetVRam( useImageDatabase )
};
if (vRam[0] == vRam[1])
continue;
return vRam[0] > vRam[1] ? +1 : -1;
}
case Columns::TYPE_BATTERY:
{
const uint battery[] =
{
a.GetBattery( useImageDatabase ) + bool(a.GetType() & (List::Files::Entry::NES|List::Files::Entry::UNF)),
b.GetBattery( useImageDatabase ) + bool(b.GetType() & (List::Files::Entry::NES|List::Files::Entry::UNF))
};
if (battery[0] == battery[1])
continue;
return battery[0] < battery[1] ? +1 : -1;
}
case Columns::TYPE_DUMP:
{
const uint dump[] =
{
a.GetDump( useImageDatabase ),
b.GetDump( useImageDatabase )
};
if (dump[0] == dump[1])
continue;
return dump[0] > dump[1] ? +1 : -1;
}
case Columns::TYPE_NAME:
{
wcstring const names[] =
{
a.GetName( files.GetStrings(), useImageDatabase ),
b.GetName( files.GetStrings(), useImageDatabase )
};
if (names[0][0] != '-' && names[1][0] == '-') return -1;
if (names[0][0] == '-' && names[1][0] != '-') return +1;
if (const int ret = ::StrCmp( names[0], names[1] ))
return ret;
continue;
}
case Columns::TYPE_FOLDER:
if (const int ret = ::StrCmp( a.GetPath(files.GetStrings()), b.GetPath(files.GetStrings()) ))
return ret;
continue;
}
}
return 0;
}
void Launcher::List::OnFind(GenericString string,const uint flags)
{
const uint count = ctrl.Size();
if (count > 1 && string.Length())
{
const uint column = ctrl.Columns().GetIndex(0);
const int selection = ctrl.Selection().GetIndex();
const uint wrap = selection > 0 ? selection : 0;
uint index = wrap;
bool found;
HeapString item;
do
{
if (flags & Finder::DOWN)
{
if (++index == count)
index = 0;
}
else
{
if (--index == ~0U)
index = count - 1;
}
ctrl[index].Text( column ) >> item;
if (flags & Finder::WHOLEWORD)
{
found = item.Length() == string.Length() && ::StrIsIntlEqual( (flags & Finder::MATCHCASE), item.Ptr(), string.Ptr(), string.Length() );
}
else if (flags & Finder::MATCHCASE)
{
found = ::StrStr( item.Ptr(), string.Ptr() );
}
else
{
found = ::StrStrI( item.Ptr(), string.Ptr() );
}
}
while (!found && index != wrap);
if (found)
{
if (selection >= 0)
ctrl[selection].Select( false );
ctrl[index].Select();
ctrl[index].Show();
}
else
{
User::Inform( IDS_TEXT_SEARCH_NOT_FOUND, IDS_TEXT_FIND );
}
}
}
void Launcher::List::OnCmdEditFind(uint)
{
finder.Open( this, &List::OnFind );
}
void Launcher::List::OnCmdEditInsert(uint)
{
enum
{
FILE_TYPES =
(
Managers::Paths::File::IMAGE |
Managers::Paths::File::PATCH |
Managers::Paths::File::ARCHIVE
)
};
Add( pathManager.BrowseLoad( FILE_TYPES, GenericString(), Managers::Paths::DONT_CHECK_FILE ).Ptr() );
}
void Launcher::List::OnCmdEditDelete(uint)
{
Application::Instance::Waiter wait;
int last = -1;
for (int index = ctrl.Selection().GetIndex(); index != -1; index = ctrl.Selection().GetIndex())
{
last = index;
void* const entry = ctrl[index].Data();
ctrl[index].Delete();
files.Disable( static_cast<Files::Entry*>(entry) );
}
if (ctrl.Size())
{
if (last != -1)
ctrl[last].Select();
}
else if (typeFilter == Files::Entry::ALL)
{
files.Clear();
}
}
void Launcher::List::OnCmdEditClear(uint)
{
Application::Instance::Waiter wait;
ctrl.Clear();
files.Clear();
}
void Launcher::List::OnCmdViewAlignColumns(uint)
{
Application::Instance::Waiter wait;
ctrl.Columns().Align();
}
void Launcher::List::OnCmdOptionsColumns(uint)
{
UpdateColumnOrder();
columns.Update( order );
columns.Open();
Application::Instance::Waiter wait;
Generic::LockDraw lock( ctrl.GetHandle() );
ReloadListColumns();
Sort();
ctrl.Columns().Align();
}
}
}

View File

@@ -0,0 +1,252 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstWindowParam.hpp"
#include "NstDialogBrowse.hpp"
#include "NstDialogLauncher.hpp"
namespace Nestopia
{
namespace Window
{
struct Launcher::List::Paths::Handlers
{
static const MsgHandler::Entry<Paths> messages[];
static const MsgHandler::Entry<Paths> commands[];
static const Control::NotificationHandler::Entry<Paths> notifications[];
};
const MsgHandler::Entry<Launcher::List::Paths> Launcher::List::Paths::Handlers::messages[] =
{
{ WM_INITDIALOG, &Paths::OnInitDialog }
};
const MsgHandler::Entry<Launcher::List::Paths> Launcher::List::Paths::Handlers::commands[] =
{
{ IDC_LAUNCHER_PATHS_ADD, &Paths::OnCmdAdd },
{ IDC_LAUNCHER_PATHS_REMOVE, &Paths::OnCmdRemove },
{ IDC_LAUNCHER_PATHS_CLEAR, &Paths::OnCmdClear },
{ IDOK, &Paths::OnCmdOk }
};
const Control::NotificationHandler::Entry<Launcher::List::Paths> Launcher::List::Paths::Handlers::notifications[] =
{
{ LVN_KEYDOWN, &Paths::OnKeyDown },
{ LVN_ITEMCHANGED, &Paths::OnItemChanged },
{ LVN_INSERTITEM, &Paths::OnInsertItem },
{ LVN_DELETEITEM, &Paths::OnDeleteItem }
};
Launcher::List::Paths::Paths(const Configuration& cfg)
:
dialog ( IDD_LAUNCHER_PATHS, this, Handlers::messages, Handlers::commands ),
notifications ( IDC_LAUNCHER_PATHS_LIST, dialog.Messages(), this, Handlers::notifications )
{
Configuration::ConstSection search( cfg["launcher"]["search"] );
{
Configuration::ConstSection files( search["files"] );
settings.include[ Settings::Include::NES ] = !files[ "nes" ].No();
settings.include[ Settings::Include::UNF ] = !files[ "unf" ].No();
settings.include[ Settings::Include::XML ] = !files[ "xml" ].No();
settings.include[ Settings::Include::FDS ] = !files[ "fds" ].No();
settings.include[ Settings::Include::NSF ] = !files[ "nsf" ].No();
settings.include[ Settings::Include::PATCH ] = !files[ "patch" ].No();
settings.include[ Settings::Include::ARCHIVE ] = !files[ "archive" ].No();
settings.include[ Settings::Include::ANY ] = files[ "any-extension" ].Yes();
settings.include[ Settings::Include::UNIQUE ] = !files[ "duplicates" ].Yes();
}
{
Configuration::ConstSection directories( search["directories"] );
Path dir;
for (uint i=0; i < LIMIT; ++i)
{
Configuration::ConstSection path( directories["path"][i] );
dir = path["directory"].Str();
if (dir.Empty())
break;
dir.MakePretty( true );
settings.folders.resize( settings.folders.size() + 1 );
settings.folders.back().path = dir;
settings.folders.back().incSubDir = path["sub-directories"].Yes();
}
}
}
void Launcher::List::Paths::Save(Configuration& cfg) const
{
Configuration::Section search( cfg["launcher"]["search"] );
{
Configuration::Section files( search["files"] );
files[ "nes" ].YesNo() = settings.include[ Settings::Include::NES ];
files[ "unf" ].YesNo() = settings.include[ Settings::Include::UNF ];
files[ "xml" ].YesNo() = settings.include[ Settings::Include::XML ];
files[ "fds" ].YesNo() = settings.include[ Settings::Include::FDS ];
files[ "nsf" ].YesNo() = settings.include[ Settings::Include::NSF ];
files[ "patch" ].YesNo() = settings.include[ Settings::Include::PATCH ];
files[ "archive" ].YesNo() = settings.include[ Settings::Include::ARCHIVE ];
files[ "any-extension" ].YesNo() = settings.include[ Settings::Include::ANY ];
files[ "duplicates" ].YesNo() = !settings.include[ Settings::Include::UNIQUE ];
}
{
Configuration::Section directories( search["directories"] );
for (uint i=0, n=settings.folders.size(); i < n; ++i)
{
Configuration::Section path( directories["path"][i] );
NST_ASSERT( settings.folders[i].path.Length() );
path["directory"].Str() = settings.folders[i].path;
path["sub-directories"].YesNo() = settings.folders[i].incSubDir;
}
}
}
ibool Launcher::List::Paths::OnInitDialog(Param&)
{
dialog.CheckBox( IDC_LAUNCHER_PATHS_NES ).Check( settings.include[ Settings::Include::NES ] );
dialog.CheckBox( IDC_LAUNCHER_PATHS_UNF ).Check( settings.include[ Settings::Include::UNF ] );
dialog.CheckBox( IDC_LAUNCHER_PATHS_XML ).Check( settings.include[ Settings::Include::XML ] );
dialog.CheckBox( IDC_LAUNCHER_PATHS_FDS ).Check( settings.include[ Settings::Include::FDS ] );
dialog.CheckBox( IDC_LAUNCHER_PATHS_NSF ).Check( settings.include[ Settings::Include::NSF ] );
dialog.CheckBox( IDC_LAUNCHER_PATHS_PATCH ).Check( settings.include[ Settings::Include::PATCH ] );
dialog.CheckBox( IDC_LAUNCHER_PATHS_ARCHIVE ).Check( settings.include[ Settings::Include::ARCHIVE ] );
dialog.CheckBox( IDC_LAUNCHER_PATHS_ALLFILES ).Check( settings.include[ Settings::Include::ANY ] );
dialog.CheckBox( IDC_LAUNCHER_PATHS_UNIQUEFILES ).Check( settings.include[ Settings::Include::UNIQUE ] );
dialog.Control( IDC_LAUNCHER_PATHS_REMOVE ).Enable( false );
dialog.Control( IDC_LAUNCHER_PATHS_CLEAR ).Enable( settings.folders.size() );
const Control::ListView listView( dialog.ListView(IDC_LAUNCHER_PATHS_LIST) );
listView.StyleEx() = LVS_EX_CHECKBOXES;
listView.Reserve( settings.folders.size() );
for (Settings::Folders::const_iterator it(settings.folders.begin()), end(settings.folders.end()); it != end; ++it)
listView.Add( it->path, LPARAM(0), it->incSubDir );
return true;
}
ibool Launcher::List::Paths::OnCmdAdd(Param& param)
{
if (param.Button().Clicked() && dialog.ListView( IDC_LAUNCHER_PATHS_LIST ).Size() < LIMIT)
{
const Path dir( Browser::SelectDirectory() );
if (dir.Length())
dialog.ListView( IDC_LAUNCHER_PATHS_LIST ).Add( dir );
}
return true;
}
ibool Launcher::List::Paths::OnCmdRemove(Param& param)
{
if (param.Button().Clicked())
dialog.ListView( IDC_LAUNCHER_PATHS_LIST ).Selection().Delete();
return true;
}
ibool Launcher::List::Paths::OnCmdClear(Param& param)
{
if (param.Button().Clicked())
dialog.ListView( IDC_LAUNCHER_PATHS_LIST ).Clear();
return true;
}
ibool Launcher::List::Paths::OnCmdOk(Param& param)
{
if (param.Button().Clicked())
{
settings.include[ Settings::Include::NES ] = dialog.CheckBox( IDC_LAUNCHER_PATHS_NES ).Checked();
settings.include[ Settings::Include::UNF ] = dialog.CheckBox( IDC_LAUNCHER_PATHS_UNF ).Checked();
settings.include[ Settings::Include::XML ] = dialog.CheckBox( IDC_LAUNCHER_PATHS_XML ).Checked();
settings.include[ Settings::Include::FDS ] = dialog.CheckBox( IDC_LAUNCHER_PATHS_FDS ).Checked();
settings.include[ Settings::Include::NSF ] = dialog.CheckBox( IDC_LAUNCHER_PATHS_NSF ).Checked();
settings.include[ Settings::Include::PATCH ] = dialog.CheckBox( IDC_LAUNCHER_PATHS_PATCH ).Checked();
settings.include[ Settings::Include::ARCHIVE ] = dialog.CheckBox( IDC_LAUNCHER_PATHS_ARCHIVE ).Checked();
settings.include[ Settings::Include::ANY ] = dialog.CheckBox( IDC_LAUNCHER_PATHS_ALLFILES ).Checked();
settings.include[ Settings::Include::UNIQUE ] = dialog.CheckBox( IDC_LAUNCHER_PATHS_UNIQUEFILES ).Checked();
const Control::ListView listView( dialog.ListView(IDC_LAUNCHER_PATHS_LIST) );
settings.folders.resize( listView.Size() );
for (uint i=0, n=settings.folders.size(); i < n; ++i)
{
listView[i].Text() >> settings.folders[i].path;
settings.folders[i].incSubDir = listView[i].Checked();
}
dialog.Close();
}
return true;
}
void Launcher::List::Paths::OnKeyDown(const NMHDR& nmhdr)
{
switch (reinterpret_cast<const NMLVKEYDOWN&>(nmhdr).wVKey)
{
case VK_INSERT: dialog.PostCommand( IDC_LAUNCHER_PATHS_ADD ); break;
case VK_DELETE: dialog.PostCommand( IDC_LAUNCHER_PATHS_REMOVE ); break;
}
}
void Launcher::List::Paths::OnItemChanged(const NMHDR& nmhdr)
{
const NMLISTVIEW& nm = reinterpret_cast<const NMLISTVIEW&>(nmhdr);
if ((nm.uOldState ^ nm.uNewState) & LVIS_SELECTED)
dialog.Control( IDC_LAUNCHER_PATHS_REMOVE ).Enable( nm.uNewState & LVIS_SELECTED );
}
void Launcher::List::Paths::OnInsertItem(const NMHDR&)
{
dialog.Control( IDC_LAUNCHER_PATHS_CLEAR ).Enable();
}
void Launcher::List::Paths::OnDeleteItem(const NMHDR&)
{
if (dialog.ListView( IDC_LAUNCHER_PATHS_LIST ).Size() <= 1)
{
dialog.Control( IDC_LAUNCHER_PATHS_CLEAR ).Disable();
dialog.Control( IDC_LAUNCHER_PATHS_REMOVE ).Disable();
}
}
}
}

View File

@@ -0,0 +1,87 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "resource/resource.h"
#include "NstResourceString.hpp"
#include "NstDialogLauncher.hpp"
namespace Nestopia
{
namespace Window
{
Launcher::Tree::Tree()
:
selection (0),
imageList (16,16,IDB_LAUNCHERTREE_OPEN,IDB_LAUNCHERTREE_CLOSED)
{}
void Launcher::Tree::operator = (const Control::TreeView& treeCtrl)
{
ctrl = treeCtrl;
ctrl.SetImageList( imageList );
ctrl.Add( Resource::String( IDS_LAUNCHER_SECTION_ALL ) );
ctrl.Add( Resource::String( IDS_LAUNCHER_SECTION_XML ) );
ctrl.Add( Resource::String( IDS_LAUNCHER_SECTION_NES ) );
ctrl.Add( Resource::String( IDS_LAUNCHER_SECTION_UNIF ) );
ctrl.Add( Resource::String( IDS_LAUNCHER_SECTION_FDS ) );
ctrl.Add( Resource::String( IDS_LAUNCHER_SECTION_NSF ) );
ctrl.Add( Resource::String( IDS_LAUNCHER_SECTION_PATCH ) );
ctrl.Add( Resource::String( IDS_LAUNCHER_SECTION_ARCHIVE ) );
ctrl[selection].Select();
}
void Launcher::Tree::Close()
{
selection = ctrl.Selection().GetIndex();
}
void Launcher::Tree::SetColors(const uint bg,const uint fg,const Updater redraw) const
{
ctrl.SetBackgroundColor( bg );
ctrl.SetTextColor( fg );
if (redraw)
ctrl.Redraw();
}
uint Launcher::Tree::GetType(HTREEITEM const hItem) const
{
switch (ctrl.GetIndex( hItem ))
{
case 1: return List::Files::Entry::XML;
case 2: return List::Files::Entry::NES;
case 3: return List::Files::Entry::UNF;
case 4: return List::Files::Entry::FDS;
case 5: return List::Files::Entry::NSF;
case 6: return List::Files::Entry::PATCH;
case 7: return List::Files::Entry::ARCHIVE;
}
return List::Files::Entry::ALL;
}
}
}

View File

@@ -0,0 +1,71 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "resource/resource.h"
#include "NstWindowParam.hpp"
#include "NstResourceFile.hpp"
#include "NstDialogLicense.hpp"
namespace Nestopia
{
namespace Window
{
struct License::Handlers
{
static const MsgHandler::Entry<License> messages[];
};
const MsgHandler::Entry<License> License::Handlers::messages[] =
{
{ WM_INITDIALOG, &License::OnInitDialog },
{ WM_CTLCOLORSTATIC, &License::OnCtlColorStatic }
};
License::License()
: dialog(IDD_LICENSE,this,Handlers::messages) {}
ibool License::OnInitDialog(Param&)
{
Collection::Buffer buffer;
if (Resource::File( IDR_LICENSE, L"License" ).Uncompress( buffer ))
{
buffer.PushBack('\0');
dialog.Control( IDC_LICENSE_EDIT ).Text() << buffer.Ptr();
}
return true;
}
ibool License::OnCtlColorStatic(Param& param)
{
NST_COMPILE_ASSERT( sizeof(ibool) == sizeof(BOOL) );
if (reinterpret_cast<HWND>(param.lParam) == ::GetDlgItem( param.hWnd, IDC_LICENSE_EDIT ))
return reinterpret_cast<ibool>(::GetSysColorBrush( COLOR_WINDOW ));
else
return false;
}
}
}

View File

@@ -0,0 +1,61 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_DIALOG_LICENSE_H
#define NST_DIALOG_LICENSE_H
#pragma once
#include "NstWindowDialog.hpp"
namespace Nestopia
{
namespace Window
{
class License
{
public:
License();
private:
struct Handlers;
ibool OnInitDialog (Param&);
ibool OnCtlColorStatic (Param&);
Dialog dialog;
public:
void Open()
{
dialog.Open();
}
};
}
}
#endif

View File

@@ -0,0 +1,92 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstWindowParam.hpp"
#include "NstDialogLogfile.hpp"
namespace Nestopia
{
namespace Window
{
struct Logfile::Handlers
{
static const MsgHandler::Entry<Logfile> messages[];
static const MsgHandler::Entry<Logfile> commands[];
};
const MsgHandler::Entry<Logfile> Logfile::Handlers::messages[] =
{
{ WM_INITDIALOG, &Logfile::OnInitDialog },
{ WM_CTLCOLORSTATIC, &Logfile::OnCtlColorStatic }
};
const MsgHandler::Entry<Logfile> Logfile::Handlers::commands[] =
{
{ IDC_LOGFILE_CLEAR, &Logfile::OnCmdClear }
};
Logfile::Logfile()
: dialog(IDD_LOGFILE,this,Handlers::messages,Handlers::commands) {}
bool Logfile::Open(wcstring const string)
{
clear = false;
if (*string)
{
text = string;
dialog.Open();
}
return clear;
}
ibool Logfile::OnInitDialog(Param&)
{
dialog.Edit( IDC_LOGFILE_EDIT ) << text;
return true;
}
ibool Logfile::OnCtlColorStatic(Param& param)
{
NST_COMPILE_ASSERT( sizeof(ibool) == sizeof(BOOL) );
if (reinterpret_cast<HWND>(param.lParam) == ::GetDlgItem( param.hWnd, IDC_LOGFILE_EDIT ))
return reinterpret_cast<ibool>(::GetSysColorBrush( COLOR_WINDOW ));
else
return false;
}
ibool Logfile::OnCmdClear(Param& param)
{
if (param.Button().Clicked())
{
dialog.Edit( IDC_LOGFILE_EDIT ).Clear();
clear = true;
}
return true;
}
}
}

View File

@@ -0,0 +1,59 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_DIALOG_LOGFILE_H
#define NST_DIALOG_LOGFILE_H
#pragma once
#include "NstWindowDialog.hpp"
namespace Nestopia
{
namespace Window
{
class Logfile
{
public:
Logfile();
bool Open(wcstring);
private:
struct Handlers;
ibool OnInitDialog (Param&);
ibool OnCtlColorStatic (Param&);
ibool OnCmdClear (Param&);
wcstring text;
bool clear;
Dialog dialog;
};
}
}
#endif

View File

@@ -0,0 +1,109 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstWindowParam.hpp"
#include "NstManagerPaths.hpp"
#include "NstApplicationInstance.hpp"
#include "NstDialogMovie.hpp"
namespace Nestopia
{
namespace Window
{
struct Movie::Handlers
{
static const MsgHandler::Entry<Movie> messages[];
static const MsgHandler::Entry<Movie> commands[];
};
const MsgHandler::Entry<Movie> Movie::Handlers::messages[] =
{
{ WM_INITDIALOG, &Movie::OnInitDialog }
};
const MsgHandler::Entry<Movie> Movie::Handlers::commands[] =
{
{ IDC_MOVIE_CLEAR, &Movie::OnCmdClear },
{ IDC_MOVIE_BROWSE, &Movie::OnCmdBrowse },
{ IDOK, &Movie::OnCmdOk }
};
Movie::Movie(const Managers::Paths& p)
: dialog(IDD_MOVIE,this,Handlers::messages,Handlers::commands), paths(p) {}
Movie::~Movie()
{
}
const Path Movie::GetMovieFile() const
{
return Application::Instance::GetFullPath( movieFile );
}
void Movie::SetMovieFile(const Path& file)
{
movieFile = file;
paths.FixFile( Managers::Paths::File::MOVIE, movieFile );
}
ibool Movie::OnInitDialog(Param&)
{
dialog.Edit(IDC_MOVIE_FILE) << movieFile.Ptr();
return true;
}
ibool Movie::OnCmdClear(Param& param)
{
if (param.Button().Clicked())
dialog.Edit(IDC_MOVIE_FILE).Clear();
return true;
}
ibool Movie::OnCmdBrowse(Param& param)
{
if (param.Button().Clicked())
{
Path tmp;
dialog.Edit(IDC_MOVIE_FILE).Text() >> tmp;
dialog.Edit(IDC_MOVIE_FILE).Try() << paths.BrowseSave( Managers::Paths::File::MOVIE, Managers::Paths::SUGGEST, Application::Instance::GetFullPath(tmp) ).Ptr();
}
return true;
}
ibool Movie::OnCmdOk(Param& param)
{
if (param.Button().Clicked())
{
dialog.Edit(IDC_MOVIE_FILE) >> movieFile;
paths.FixFile( Managers::Paths::File::MOVIE, movieFile );
dialog.Close();
}
return true;
}
}
}

View File

@@ -0,0 +1,74 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_DIALOG_MOVIE_H
#define NST_DIALOG_MOVIE_H
#pragma once
#include "NstWindowDialog.hpp"
namespace Nestopia
{
namespace Window
{
class Movie
{
public:
explicit Movie(const Managers::Paths&);
~Movie();
void SetMovieFile(const Path&);
const Path GetMovieFile() const;
private:
struct Handlers;
ibool OnInitDialog (Param&);
ibool OnCmdBrowse (Param&);
ibool OnCmdClear (Param&);
ibool OnCmdOk (Param&);
Dialog dialog;
const Managers::Paths& paths;
Path movieFile;
public:
void Open()
{
dialog.Open();
}
void ClearMovieFile()
{
movieFile.Clear();
}
};
}
}
#endif

View File

@@ -0,0 +1,326 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstIoLog.hpp"
#include "NstIoStream.hpp"
#include "NstIoFile.hpp"
#include "NstApplicationInstance.hpp"
#include "NstWindowParam.hpp"
#include "NstWindowDropFiles.hpp"
#include "NstManagerPaths.hpp"
#include "NstDialogNetPlay.hpp"
#include "../core/NstXml.hpp"
#include <CommCtrl.h>
namespace Nestopia
{
namespace Window
{
struct Netplay::Handlers
{
static const MsgHandler::Entry<Netplay> messages[];
static const MsgHandler::Entry<Netplay> commands[];
static const Control::NotificationHandler::Entry<Netplay> notifications[];
};
const MsgHandler::Entry<Netplay> Netplay::Handlers::messages[] =
{
{ WM_INITDIALOG, &Netplay::OnInitDialog },
{ WM_DROPFILES, &Netplay::OnDropFiles }
};
const MsgHandler::Entry<Netplay> Netplay::Handlers::commands[] =
{
{ IDC_NETPLAY_ADD, &Netplay::OnAdd },
{ IDC_NETPLAY_REMOVE, &Netplay::OnRemove },
{ IDC_NETPLAY_CLEAR, &Netplay::OnClear },
{ IDC_NETPLAY_DEFAULT, &Netplay::OnDefault },
{ IDC_NETPLAY_LAUNCH, &Netplay::OnLaunch },
{ IDC_NETPLAY_PLAY_FULLSCREEN, &Netplay::OnFullscreen }
};
const Control::NotificationHandler::Entry<Netplay> Netplay::Handlers::notifications[] =
{
{ LVN_KEYDOWN, &Netplay::OnKeyDown },
{ LVN_ITEMCHANGED, &Netplay::OnItemChanged },
{ LVN_INSERTITEM, &Netplay::OnInsertItem },
{ LVN_DELETEITEM, &Netplay::OnDeleteItem }
};
bool Netplay::Games::Less::operator () (const Path& a,const Path& b) const
{
return a.Target().File() < b.Target().File();
}
Netplay::Games::Games()
: state(UNINITIALIZED) {}
Netplay::Netplay(Managers::Emulator& e,const Managers::Paths& p,bool fullscreen)
:
dialog ( IDD_NETPLAY, this, Handlers::messages, Handlers::commands ),
doFullscreen ( fullscreen ),
paths ( p ),
emulator ( e ),
notifications ( IDC_NETPLAY_GAMELIST, dialog.Messages(), this, Handlers::notifications )
{
}
Netplay::~Netplay()
{
}
void Netplay::LoadFile()
{
try
{
//const Path path( Application::Instance::GetExePath(L"netplaylist.xml") );
const Path path( Application::Instance::GetConfigPath(L"netplaylist.xml") );//bg
if (path.FileExists())
{
typedef Nes::Core::Xml Xml;
Xml xml;
{
Io::Stream::In stream( path );
xml.Read( stream );
}
if (!xml.GetRoot().IsType( L"netplaylist" ))
throw 1;
for (Xml::Node node(xml.GetRoot().GetFirstChild()); node; node=node.GetNextSibling())
{
if (!node.IsType( L"file" ))
throw 1;
Add( node.GetValue() );
}
Io::Log() << "Netplay: loaded game list from \"netplaylist.xml\"\r\n";
}
else
{
Io::Log() << "Netplay: game list file \"netplaylist.xml\" not present..\r\n";
}
}
catch (...)
{
games.state = Games::DIRTY;
Io::Log() << "Netplay: warning, couldn't load game list \"netplaylist.xml\"!\r\n";
}
}
void Netplay::SaveFile() const
{
if (games.state == Games::DIRTY)
{
//const Path path( Application::Instance::GetExePath(L"netplaylist.xml") );
const Path path( Application::Instance::GetConfigPath(L"netplaylist.xml") );//bg
if (!games.paths.empty())
{
try
{
typedef Nes::Core::Xml Xml;
Xml xml;
Xml::Node root( xml.Create( L"netplaylist" ) );
root.AddAttribute( L"version", L"1.0" );
for (Games::Paths::const_iterator it(games.paths.begin()), end(games.paths.end()); it != end; ++it)
root.AddChild( L"file", it->Ptr() );
Io::Stream::Out stream( path );
xml.Write( root, stream );
Io::Log() << "Netplay: saved game list to \"netplaylist.xml\"\r\n";
}
catch (...)
{
Io::Log() << "Netplay: warning, couldn't save game list to \"netplaylist.xml\"!\r\n";
}
}
else if (path.FileExists())
{
if (Io::File::Delete( path.Ptr() ))
Io::Log() << "Netplay: game list empty, deleted \"netplaylist.xml\"\r\n";
else
Io::Log() << "Netplay: warning, couldn't delete \"netplaylist.xml\"!\r\n";
}
}
}
wcstring Netplay::GetPath(wcstring const path) const
{
Games::Paths::const_iterator it(games.paths.find( path ));
return it != games.paths.end() ? it->Ptr() : NULL;
}
void Netplay::Add(Path path)
{
enum
{
TYPES = Managers::Paths::File::GAME|Managers::Paths::File::ARCHIVE
};
if (path.Length() && games.paths.size() < Games::LIMIT && paths.CheckFile( path, TYPES ) && games.paths.insert( path ).second)
{
games.state = Games::DIRTY;
if (dialog)
dialog.ListView( IDC_NETPLAY_GAMELIST ).Add( path.Target().File() );
}
}
ibool Netplay::OnInitDialog(Param&)
{
dialog.CheckBox( IDC_NETPLAY_PLAY_FULLSCREEN ).Check( doFullscreen );
dialog.CheckBox( IDC_NETPLAY_REMOVE ).Disable();
if (games.state == Games::UNINITIALIZED)
{
LoadFile();
}
else
{
Control::ListView list( dialog.ListView( IDC_NETPLAY_GAMELIST ) );
list.Reserve( games.paths.size() );
for (Games::Paths::const_iterator it(games.paths.begin()), end(games.paths.end()); it != end; ++it)
list.Add( it->Target().File().Ptr() );
}
dialog.CheckBox( IDC_NETPLAY_CLEAR ).Enable( games.paths.size() );
dialog.CheckBox( IDC_NETPLAY_LAUNCH ).Enable( games.paths.size() );
return true;
}
ibool Netplay::OnAdd(Param& param)
{
if (param.Button().Clicked())
Add( paths.BrowseLoad(Managers::Paths::File::GAME|Managers::Paths::File::ARCHIVE) );
return true;
}
ibool Netplay::OnRemove(Param& param)
{
if (param.Button().Clicked())
dialog.ListView( IDC_NETPLAY_GAMELIST ).Selection().Delete();
return true;
}
ibool Netplay::OnClear(Param& param)
{
if (param.Button().Clicked())
dialog.ListView( IDC_NETPLAY_GAMELIST ).Clear();
return true;
}
ibool Netplay::OnDefault(Param& param)
{
if (param.Button().Clicked())
{
doFullscreen = false;
dialog.CheckBox( IDC_NETPLAY_PLAY_FULLSCREEN ).Check( false );
}
return true;
}
ibool Netplay::OnLaunch(Param& param)
{
if (param.Button().Clicked())
dialog.Close( LAUNCH );
return true;
}
ibool Netplay::OnFullscreen(Param& param)
{
if (param.Button().Clicked())
doFullscreen = dialog.CheckBox( IDC_NETPLAY_PLAY_FULLSCREEN ).Checked();
return true;
}
ibool Netplay::OnDropFiles(Param& param)
{
DropFiles dropFiles( param );
if (dropFiles.Inside( dialog.ListView( IDC_NETPLAY_GAMELIST ).GetWindow() ))
{
for (uint i=0, n=dropFiles.Size(); i < n; ++i)
Add( dropFiles[i] );
}
return true;
}
void Netplay::OnKeyDown(const NMHDR& nmhdr)
{
switch (reinterpret_cast<const NMLVKEYDOWN&>(nmhdr).wVKey)
{
case VK_INSERT: dialog.PostCommand( IDC_NETPLAY_ADD ); break;
case VK_DELETE: dialog.PostCommand( IDC_NETPLAY_REMOVE ); break;
}
}
void Netplay::OnItemChanged(const NMHDR& nmhdr)
{
const NMLISTVIEW& nm = reinterpret_cast<const NMLISTVIEW&>(nmhdr);
if ((nm.uOldState ^ nm.uNewState) & LVIS_SELECTED)
dialog.CheckBox( IDC_NETPLAY_REMOVE ).Enable( nm.uNewState & LVIS_SELECTED );
}
void Netplay::OnInsertItem(const NMHDR&)
{
dialog.CheckBox( IDC_NETPLAY_CLEAR ).Enable();
dialog.CheckBox( IDC_NETPLAY_LAUNCH ).Enable();
}
void Netplay::OnDeleteItem(const NMHDR& nmhdr)
{
Games::Paths::iterator it(games.paths.begin());
for (int i=reinterpret_cast<const NMLISTVIEW&>(nmhdr).iItem; i > 0; --i)
++it;
games.paths.erase( it );
games.state = Games::DIRTY;
if (dialog.ListView( IDC_NETPLAY_GAMELIST ).Size() <= 1)
{
dialog.CheckBox( IDC_NETPLAY_CLEAR ).Disable();
dialog.CheckBox( IDC_NETPLAY_LAUNCH ).Disable();
dialog.CheckBox( IDC_NETPLAY_REMOVE ).Disable();
}
}
}
}

View File

@@ -0,0 +1,163 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef NST_DIALOG_NETPLAY_H
#define NST_DIALOG_NETPLAY_H
#pragma once
#include <set>
#include "NstWindowDialog.hpp"
namespace Nestopia
{
namespace Managers
{
class Paths;
class Emulator;
}
namespace Window
{
class Netplay
{
public:
Netplay(Managers::Emulator&,const Managers::Paths&,bool);
~Netplay();
void SaveFile() const;
wcstring GetPath(wcstring) const;
class Chat
{
public:
typedef int (WINAPI *Callback)(char*);
explicit Chat(Callback);
~Chat();
void Close();
void Open();
private:
struct Handlers;
ibool OnInit (Param&);
ibool OnCommand (Param&);
Dialog dialog;
const Callback callback;
String::Heap<char> text;
};
private:
struct Handlers;
enum
{
LAUNCH = 0xB00B
};
struct Games
{
Games();
struct Less
{
bool operator () (const Path&,const Path&) const;
};
typedef std::set<Path,Less> Paths;
enum
{
LIMIT = 100
};
enum State
{
CLEAN,
DIRTY,
UNINITIALIZED
};
State state;
Paths paths;
};
public:
typedef Games::Paths GamePaths;
private:
void LoadFile();
void Add(Path);
ibool OnInitDialog (Param&);
ibool OnAdd (Param&);
ibool OnRemove (Param&);
ibool OnClear (Param&);
ibool OnDefault (Param&);
ibool OnLaunch (Param&);
ibool OnFullscreen (Param&);
ibool OnDropFiles (Param&);
void OnKeyDown (const NMHDR&);
void OnItemChanged (const NMHDR&);
void OnInsertItem (const NMHDR&);
void OnDeleteItem (const NMHDR&);
Dialog dialog;
bool doFullscreen;
const Managers::Paths& paths;
Managers::Emulator& emulator;
const Control::NotificationHandler notifications;
Games games;
public:
bool Open()
{
return dialog.Open() == LAUNCH;
}
bool ShouldGoFullscreen() const
{
return doFullscreen;
}
const GamePaths& GetGamePaths() const
{
return games.paths;
}
};
}
}
#endif

View File

@@ -0,0 +1,95 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia 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.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstWindowParam.hpp"
#include "NstDialogNetPlay.hpp"
namespace Nestopia
{
namespace Window
{
struct Netplay::Chat::Handlers
{
static const MsgHandler::Entry<Chat> messages[];
};
const MsgHandler::Entry<Netplay::Chat> Netplay::Chat::Handlers::messages[] =
{
{ WM_INITDIALOG, &Chat::OnInit },
{ WM_COMMAND, &Chat::OnCommand }
};
Netplay::Chat::Chat(Callback c)
:
dialog ( IDD_CHAT, this, Handlers::messages ),
callback ( c )
{}
Netplay::Chat::~Chat()
{
}
void Netplay::Chat::Open()
{
dialog.Open( Dialog::MODELESS_CHILD );
}
void Netplay::Chat::Close()
{
dialog.Close();
text.Destroy();
}
ibool Netplay::Chat::OnInit(Param&)
{
dialog.Edit(IDC_CHAT_EDIT).Limit(255);
return true;
}
ibool Netplay::Chat::OnCommand(Param& param)
{
if (param.wParam == 1 && param.lParam == 0)
{
HeapString wtext;
const Control::Edit edit( dialog.Edit(IDC_CHAT_EDIT) );
if (edit.Text() >> wtext)
{
wtext.Trim();
if (wtext.Length())
{
text.Clear();
callback( text.Import(wtext.Ptr()).Ptr() );
}
edit.Text().Clear();
}
}
return false;
}
}
}

Some files were not shown because too many files have changed in this diff Show More