1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-31 09:43:46 +00:00

LFX progress

Update .gitignore
This commit is contained in:
SpoinkyNL 2016-12-20 20:20:47 +01:00
parent 1d174a1aa7
commit 4be324dc69
13 changed files with 12438 additions and 192 deletions

3
.gitignore vendored
View File

@ -15,6 +15,7 @@
x64/ x64/
x86/ x86/
build/ build/
debug/
bld/ bld/
[Bb]in/ [Bb]in/
[Oo]bj/ [Oo]bj/
@ -190,4 +191,4 @@ FakesAssemblies/
# Visual Studio 6 workspace options file # Visual Studio 6 workspace options file
*.opt *.opt
*.opendb *.opendb

View File

@ -191,9 +191,6 @@
<HintPath>..\packages\MahApps.Metro.1.3.0\lib\net45\MahApps.Metro.dll</HintPath> <HintPath>..\packages\MahApps.Metro.1.3.0\lib\net45\MahApps.Metro.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Microsoft.QualityTools.Testing.Fakes, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL"> <Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.dll</HintPath> <HintPath>..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.dll</HintPath>
<Private>True</Private> <Private>True</Private>

View File

@ -22,7 +22,6 @@ namespace Artemis.Managers
private readonly EffectManager _effectManager; private readonly EffectManager _effectManager;
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly Timer _loopTimer; private readonly Timer _loopTimer;
private bool _canShowException;
public LoopManager(ILogger logger, EffectManager effectManager, DeviceManager deviceManager, public LoopManager(ILogger logger, EffectManager effectManager, DeviceManager deviceManager,
DebugViewModel debugViewModel) DebugViewModel debugViewModel)
@ -31,7 +30,6 @@ namespace Artemis.Managers
_effectManager = effectManager; _effectManager = effectManager;
_deviceManager = deviceManager; _deviceManager = deviceManager;
_debugViewModel = debugViewModel; _debugViewModel = debugViewModel;
_canShowException = true;
// Setup timers // Setup timers
_loopTimer = new Timer(40); _loopTimer = new Timer(40);

View File

@ -7,12 +7,10 @@ namespace Artemis.Modules.Games.ProjectCars.Data
{ {
public class pCarsAPI_GetData public class pCarsAPI_GetData
{ {
private static pCarsAPIStruct structCurrent = new pCarsAPIStruct();
private static MemoryMappedFile memoryMappedFile; private static MemoryMappedFile memoryMappedFile;
private static GCHandle handle; private static GCHandle handle;
private static int sharedmemorysize; private static int sharedmemorysize;
private static byte[] sharedMemoryReadBuffer; private static byte[] sharedMemoryReadBuffer;
private static bool isSharedMemoryInitialised;
private static bool InitialiseSharedMemory() private static bool InitialiseSharedMemory()
{ {
@ -21,11 +19,10 @@ namespace Artemis.Modules.Games.ProjectCars.Data
memoryMappedFile = MemoryMappedFile.OpenExisting("$pcars$"); memoryMappedFile = MemoryMappedFile.OpenExisting("$pcars$");
sharedmemorysize = Marshal.SizeOf(typeof(pCarsAPIStruct)); sharedmemorysize = Marshal.SizeOf(typeof(pCarsAPIStruct));
sharedMemoryReadBuffer = new byte[sharedmemorysize]; sharedMemoryReadBuffer = new byte[sharedmemorysize];
isSharedMemoryInitialised = true;
return true; return true;
} }
catch (Exception ex) catch (Exception)
{ {
return false; return false;
} }
@ -42,8 +39,8 @@ namespace Artemis.Modules.Games.ProjectCars.Data
using (var sharedMemoryStreamView = memoryMappedFile.CreateViewStream()) using (var sharedMemoryStreamView = memoryMappedFile.CreateViewStream())
{ {
var _SharedMemoryStream = new BinaryReader(sharedMemoryStreamView); var sharedMemoryStream = new BinaryReader(sharedMemoryStreamView);
sharedMemoryReadBuffer = _SharedMemoryStream.ReadBytes(sharedmemorysize); sharedMemoryReadBuffer = sharedMemoryStream.ReadBytes(sharedmemorysize);
handle = GCHandle.Alloc(sharedMemoryReadBuffer, GCHandleType.Pinned); handle = GCHandle.Alloc(sharedMemoryReadBuffer, GCHandleType.Pinned);
_pcarsapistruct = _pcarsapistruct =
(pCarsAPIStruct) Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(pCarsAPIStruct)); (pCarsAPIStruct) Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(pCarsAPIStruct));
@ -52,7 +49,7 @@ namespace Artemis.Modules.Games.ProjectCars.Data
return new Tuple<bool, pCarsAPIStruct>(true, _pcarsapistruct); return new Tuple<bool, pCarsAPIStruct>(true, _pcarsapistruct);
} }
catch (Exception ex) catch (Exception)
{ {
//return false in the tuple as the read failed //return false in the tuple as the read failed
return new Tuple<bool, pCarsAPIStruct>(false, _pcarsapistruct); return new Tuple<bool, pCarsAPIStruct>(false, _pcarsapistruct);

View File

@ -1,166 +1,166 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32"> <ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64"> <ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Release|x64"> <ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{1A349CF5-2008-41E8-AC13-874CBBCDFA0A}</ProjectGuid> <ProjectGuid>{1A349CF5-2008-41E8-AC13-874CBBCDFA0A}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>LightFX2Artemis</RootNamespace> <RootNamespace>LightFX2Artemis</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
</ImportGroup> </ImportGroup>
<ImportGroup Label="Shared"> <ImportGroup Label="Shared">
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(ProjectDir)includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile> <ClCompile>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(ProjectDir)includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="LightFxDevice.cpp" /> <ClCompile Include="LightFxDevice.cpp" />
<ClCompile Include="LightFxLight.cpp" /> <ClCompile Include="LightFxLight.cpp" />
<ClCompile Include="LightFxState.cpp" /> <ClCompile Include="LightFxState.cpp" />
<ClCompile Include="Source.cpp" /> <ClCompile Include="Source.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="LightFxDevice.h" /> <ClInclude Include="LightFxDevice.h" />
<ClInclude Include="LightFxLight.h" /> <ClInclude Include="LightFxLight.h" />
<ClInclude Include="LightFxState.h" /> <ClInclude Include="LightFxState.h" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -1,12 +1,32 @@
#include "LightFxDevice.h" #include "LightFxDevice.h"
using json = nlohmann::json;
LightFxDevice::LightFxDevice() LightFxDevice::LightFxDevice()
{ {
} }
LightFxDevice::~LightFxDevice() LightFxDevice::~LightFxDevice()
{ {
} }
void LightFxDevice::SetLightFromInt(int lightIndex, const unsigned colorVal)
{
Lights[lightIndex].Color->brightness = (colorVal >> 24) & 0xFF;
Lights[lightIndex].Color->red = (colorVal >> 16) & 0xFF;
Lights[lightIndex].Color->green = (colorVal >> 8) & 0xFF;
Lights[lightIndex].Color->blue = colorVal & 0xFF;
}
json LightFxDevice::GetJson()
{
json j;
j["lights"] = {};
for (LightFxLight light : Lights)
{
j["lights"].push_back(light.GetJson());
}
return j;
}

View File

@ -1,11 +1,15 @@
#pragma once #pragma once
#include "LightFxLight.h" #include "LightFxLight.h"
#include <json.hpp>
using json = nlohmann::json;
class LightFxDevice class LightFxDevice
{ {
public: public:
LightFxDevice(); LightFxDevice();
~LightFxDevice(); ~LightFxDevice();
void SetLightFromInt(int lightIndex, const unsigned colorVal);
json GetJson();
LightFxLight Lights[128]; LightFxLight Lights[128];
}; };

View File

@ -1,7 +1,6 @@
#include "LightFxLight.h" #include "LightFxLight.h"
LightFxLight::LightFxLight() LightFxLight::LightFxLight()
{ {
} }
@ -10,3 +9,15 @@ LightFxLight::LightFxLight()
LightFxLight::~LightFxLight() LightFxLight::~LightFxLight()
{ {
} }
json LightFxLight::GetJson()
{
json j;
j["color"] = {
{"red", Color->red},
{"green", Color->green},
{"blue", Color->blue},
{"brightness", Color->brightness}
};
return j;
}

View File

@ -1,11 +1,14 @@
#pragma once #pragma once
#include "includes/LFXDecl.h" #include "includes/LFXDecl.h"
#include "json.hpp"
using json = nlohmann::json;
class LightFxLight class LightFxLight
{ {
public: public:
LightFxLight(); LightFxLight();
~LightFxLight(); ~LightFxLight();
json GetJson();
PLFX_COLOR Color; PLFX_COLOR Color;
}; };

View File

@ -1,6 +1,7 @@
#include "LightFxState.h" #include "LightFxState.h"
#include "json.hpp"
using json = nlohmann::json;
LightFxState::LightFxState(char* game) LightFxState::LightFxState(char* game)
{ {
@ -12,9 +13,16 @@ LightFxState::~LightFxState()
{ {
} }
void LightFxState::Update() const char* LightFxState::Update()
{ {
// Serialize self json j;
j["game"] = Game;
j["devices"] = {};
for (LightFxDevice device : Devices)
{
j["devices"].push_back(device.GetJson());
}
// Transmit through Pipe std::string s = j.dump();
return s.c_str();
} }

View File

@ -3,10 +3,10 @@
class LightFxState class LightFxState
{ {
public: public:
LightFxState(char* game); LightFxState(char* game);
~LightFxState(); ~LightFxState();
void Update(); const char* Update();
char* Game; char* Game;
LightFxDevice Devices[5]; LightFxDevice Devices[5];
}; };

View File

@ -25,7 +25,7 @@ BOOL WINAPI DllMain(HINSTANCE hInst, DWORD fdwReason, LPVOID)
{ {
if (fdwReason == DLL_PROCESS_ATTACH) if (fdwReason == DLL_PROCESS_ATTACH)
{ {
lightFxState = new LightFxState(GetGame()); lightFxState = new LightFxState("Payday2");
FILELog::ReportingLevel() = logDEBUG1; FILELog::ReportingLevel() = logDEBUG1;
FILE* log_fd = fopen("log.txt", "w"); FILE* log_fd = fopen("log.txt", "w");
Output2FILE::Stream() = log_fd; Output2FILE::Stream() = log_fd;
@ -75,7 +75,8 @@ FN_DECLSPEC LFX_RESULT STDCALL LFX_Update()
{ {
FILE_LOG(logDEBUG1) << "Called LFX_Update()"; FILE_LOG(logDEBUG1) << "Called LFX_Update()";
lightFxState->Update(); const char* jsonString = lightFxState->Update();
FILE_LOG(logDEBUG1) << "JSON: " << jsonString;
return LFX_SUCCESS; return LFX_SUCCESS;
} }
@ -147,7 +148,7 @@ FN_DECLSPEC LFX_RESULT STDCALL LFX_GetLightLocation(const unsigned int devIndex,
{ {
FILE_LOG(logDEBUG1) << "Called LFX_GetLightLocation()"; FILE_LOG(logDEBUG1) << "Called LFX_GetLightLocation()";
*lightLoc = LFX_POSITION{ 0,0,0 }; *lightLoc = LFX_POSITION{0,0,0};
return LFX_SUCCESS; return LFX_SUCCESS;
} }
@ -170,6 +171,11 @@ FN_DECLSPEC LFX_RESULT STDCALL LFX_SetLightColor(const unsigned int devIndex, co
FN_DECLSPEC LFX_RESULT STDCALL LFX_Light(const unsigned int locationMask, const unsigned int colorVal) FN_DECLSPEC LFX_RESULT STDCALL LFX_Light(const unsigned int locationMask, const unsigned int colorVal)
{ {
FILE_LOG(logDEBUG1) << "Called LFX_Light()"; FILE_LOG(logDEBUG1) << "Called LFX_Light()";
for (LightFxDevice device : lightFxState->Devices)
{
device.SetLightFromInt(0, colorVal);
}
return LFX_SUCCESS; return LFX_SUCCESS;
} }

File diff suppressed because it is too large Load Diff