mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Fixed line endings and applied gitignore
This commit is contained in:
@ -1,40 +1,40 @@
|
||||
#include <VerRsrc.h>
|
||||
#include "../../Version.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,2,0,0
|
||||
PRODUCTVERSION PRODUCTVER
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE VFT_UNKNOWN
|
||||
{
|
||||
BLOCK "StringFileInfo"
|
||||
{
|
||||
BLOCK "040904E4"
|
||||
{
|
||||
VALUE "FileVersion", "1.2.0.0"
|
||||
VALUE "LegalCopyright", "<22> 2010 - Rainy"
|
||||
VALUE "ProductName", "Rainmeter"
|
||||
#ifdef _WIN64
|
||||
VALUE "ProductVersion", STRPRODUCTVER " (64-bit)"
|
||||
#else
|
||||
VALUE "ProductVersion", STRPRODUCTVER " (32-bit)"
|
||||
#endif //_WIN64
|
||||
}
|
||||
}
|
||||
BLOCK "VarFileInfo"
|
||||
{
|
||||
VALUE "Translation", 0x409, 1252
|
||||
}
|
||||
}
|
||||
#include <VerRsrc.h>
|
||||
#include "../../Version.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,2,0,0
|
||||
PRODUCTVERSION PRODUCTVER
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE VFT_UNKNOWN
|
||||
{
|
||||
BLOCK "StringFileInfo"
|
||||
{
|
||||
BLOCK "040904E4"
|
||||
{
|
||||
VALUE "FileVersion", "1.2.0.0"
|
||||
VALUE "LegalCopyright", "<22> 2010 - Rainy"
|
||||
VALUE "ProductName", "Rainmeter"
|
||||
#ifdef _WIN64
|
||||
VALUE "ProductVersion", STRPRODUCTVER " (64-bit)"
|
||||
#else
|
||||
VALUE "ProductVersion", STRPRODUCTVER " (32-bit)"
|
||||
#endif //_WIN64
|
||||
}
|
||||
}
|
||||
BLOCK "VarFileInfo"
|
||||
{
|
||||
VALUE "Translation", 0x409, 1252
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(SolutionDir)Build\VS\Rainmeter.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{D10AB316-0F7A-4551-BE4F-385E04CCF1E8}</ProjectGuid>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<TargetName>SpeedFanPlugin</TargetName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(SolutionDir)Build\VS\Rainmeter.Cpp.props" />
|
||||
<Import Project="$(SolutionDir)Build\VS\RainmeterPlugin.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="PluginSpeedFan.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="SpeedFanPlugin.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(SolutionDir)Build\VS\Rainmeter.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{D10AB316-0F7A-4551-BE4F-385E04CCF1E8}</ProjectGuid>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<TargetName>SpeedFanPlugin</TargetName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(SolutionDir)Build\VS\Rainmeter.Cpp.props" />
|
||||
<Import Project="$(SolutionDir)Build\VS\RainmeterPlugin.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="PluginSpeedFan.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="SpeedFanPlugin.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@ -1,195 +1,195 @@
|
||||
/*
|
||||
Copyright (C) 2004 Kimmo Pekkola
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include "../../Library/Export.h" // Rainmeter's exported functions
|
||||
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct SpeedFanData
|
||||
{
|
||||
WORD version;
|
||||
WORD flags;
|
||||
INT MemSize;
|
||||
DWORD handle;
|
||||
WORD NumTemps;
|
||||
WORD NumFans;
|
||||
WORD NumVolts;
|
||||
INT temps[32];
|
||||
INT fans[32];
|
||||
INT volts[32];
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
enum SensorType
|
||||
{
|
||||
TYPE_TEMP,
|
||||
TYPE_FAN,
|
||||
TYPE_VOLT
|
||||
};
|
||||
|
||||
enum ScaleType
|
||||
{
|
||||
SCALE_SOURCE,
|
||||
SCALE_CENTIGRADE,
|
||||
SCALE_FARENHEIT,
|
||||
SCALE_KELVIN
|
||||
};
|
||||
|
||||
struct MeasureData
|
||||
{
|
||||
SensorType type;
|
||||
ScaleType scale;
|
||||
UINT number;
|
||||
|
||||
MeasureData() : type(TYPE_TEMP), scale(SCALE_SOURCE), number() {}
|
||||
};
|
||||
|
||||
void ReadSharedData(SensorType type, ScaleType scale, UINT number, double* value);
|
||||
|
||||
PLUGIN_EXPORT void Initialize(void** data, void* rm)
|
||||
{
|
||||
MeasureData* measure = new MeasureData;
|
||||
*data = measure;
|
||||
}
|
||||
|
||||
PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
|
||||
{
|
||||
MeasureData* measure = (MeasureData*)data;
|
||||
|
||||
LPCWSTR type = RmReadString(rm, L"SpeedFanType", L"TEMPERATURE");
|
||||
if (_wcsicmp(L"TEMPERATURE", type) == 0)
|
||||
{
|
||||
measure->type = TYPE_TEMP;
|
||||
|
||||
LPCWSTR scale = RmReadString(rm, L"SpeedFanScale", L"C");
|
||||
if (_wcsicmp(L"C", scale) == 0)
|
||||
{
|
||||
measure->scale = SCALE_CENTIGRADE;
|
||||
}
|
||||
else if (_wcsicmp(L"F", scale) == 0)
|
||||
{
|
||||
measure->scale = SCALE_FARENHEIT;
|
||||
}
|
||||
else if (_wcsicmp(L"K", scale) == 0)
|
||||
{
|
||||
measure->scale = SCALE_KELVIN;
|
||||
}
|
||||
else
|
||||
{
|
||||
WCHAR buffer[256];
|
||||
_snwprintf_s(buffer, _TRUNCATE, L"SpeedFanPlugin.dll: SpeedFanScale=%s is not valid in [%s]", scale, RmGetMeasureName(rm));
|
||||
RmLog(LOG_ERROR, buffer);
|
||||
}
|
||||
}
|
||||
else if (_wcsicmp(L"FAN", type) == 0)
|
||||
{
|
||||
measure->type = TYPE_FAN;
|
||||
}
|
||||
else if (_wcsicmp(L"VOLTAGE", type) == 0)
|
||||
{
|
||||
measure->type = TYPE_VOLT;
|
||||
}
|
||||
else
|
||||
{
|
||||
WCHAR buffer[256];
|
||||
_snwprintf_s(buffer, _TRUNCATE, L"SpeedFanPlugin.dll: SpeedFanType=%s is not valid in [%s]", type, RmGetMeasureName(rm));
|
||||
RmLog(LOG_ERROR, buffer);
|
||||
}
|
||||
|
||||
measure->number = RmReadInt(rm, L"SpeedFanNumber", 0);
|
||||
}
|
||||
|
||||
PLUGIN_EXPORT double Update(void* data)
|
||||
{
|
||||
MeasureData* measure = (MeasureData*)data;
|
||||
double value = 0.0;
|
||||
|
||||
ReadSharedData(measure->type, measure->scale, measure->number, &value);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
PLUGIN_EXPORT void Finalize(void* data)
|
||||
{
|
||||
MeasureData* measure = (MeasureData*)data;
|
||||
delete measure;
|
||||
}
|
||||
|
||||
/*
|
||||
Get the data from shared memory.
|
||||
*/
|
||||
void ReadSharedData(SensorType type, ScaleType scale, UINT number, double* value)
|
||||
{
|
||||
HANDLE hData = OpenFileMapping(FILE_MAP_READ, FALSE, L"SFSharedMemory_ALM");
|
||||
if (hData == nullptr) return;
|
||||
|
||||
SpeedFanData* ptr = (SpeedFanData*)MapViewOfFile(hData, FILE_MAP_READ, 0, 0, 0);
|
||||
if (ptr == 0)
|
||||
{
|
||||
CloseHandle(hData);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptr->version == 1)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case TYPE_TEMP:
|
||||
if (number < ptr->NumTemps)
|
||||
{
|
||||
*value = ptr->temps[number];
|
||||
*value /= 100.0;
|
||||
|
||||
if (scale == SCALE_FARENHEIT)
|
||||
{
|
||||
*value *= 1.8;
|
||||
*value += 32.0;
|
||||
}
|
||||
else if (scale == SCALE_KELVIN)
|
||||
{
|
||||
*value += 273.15;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_FAN:
|
||||
if (number < ptr->NumTemps)
|
||||
{
|
||||
*value = ptr->fans[number];
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_VOLT:
|
||||
if (number < ptr->NumVolts)
|
||||
{
|
||||
*value = ptr->volts[number];
|
||||
*value /= 100.0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RmLog(LOG_ERROR, L"SpeedFanPlugin.dll: Incorrect shared memory version");
|
||||
}
|
||||
|
||||
UnmapViewOfFile(ptr);
|
||||
CloseHandle(hData);
|
||||
}
|
||||
/*
|
||||
Copyright (C) 2004 Kimmo Pekkola
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include "../../Library/Export.h" // Rainmeter's exported functions
|
||||
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct SpeedFanData
|
||||
{
|
||||
WORD version;
|
||||
WORD flags;
|
||||
INT MemSize;
|
||||
DWORD handle;
|
||||
WORD NumTemps;
|
||||
WORD NumFans;
|
||||
WORD NumVolts;
|
||||
INT temps[32];
|
||||
INT fans[32];
|
||||
INT volts[32];
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
enum SensorType
|
||||
{
|
||||
TYPE_TEMP,
|
||||
TYPE_FAN,
|
||||
TYPE_VOLT
|
||||
};
|
||||
|
||||
enum ScaleType
|
||||
{
|
||||
SCALE_SOURCE,
|
||||
SCALE_CENTIGRADE,
|
||||
SCALE_FARENHEIT,
|
||||
SCALE_KELVIN
|
||||
};
|
||||
|
||||
struct MeasureData
|
||||
{
|
||||
SensorType type;
|
||||
ScaleType scale;
|
||||
UINT number;
|
||||
|
||||
MeasureData() : type(TYPE_TEMP), scale(SCALE_SOURCE), number() {}
|
||||
};
|
||||
|
||||
void ReadSharedData(SensorType type, ScaleType scale, UINT number, double* value);
|
||||
|
||||
PLUGIN_EXPORT void Initialize(void** data, void* rm)
|
||||
{
|
||||
MeasureData* measure = new MeasureData;
|
||||
*data = measure;
|
||||
}
|
||||
|
||||
PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
|
||||
{
|
||||
MeasureData* measure = (MeasureData*)data;
|
||||
|
||||
LPCWSTR type = RmReadString(rm, L"SpeedFanType", L"TEMPERATURE");
|
||||
if (_wcsicmp(L"TEMPERATURE", type) == 0)
|
||||
{
|
||||
measure->type = TYPE_TEMP;
|
||||
|
||||
LPCWSTR scale = RmReadString(rm, L"SpeedFanScale", L"C");
|
||||
if (_wcsicmp(L"C", scale) == 0)
|
||||
{
|
||||
measure->scale = SCALE_CENTIGRADE;
|
||||
}
|
||||
else if (_wcsicmp(L"F", scale) == 0)
|
||||
{
|
||||
measure->scale = SCALE_FARENHEIT;
|
||||
}
|
||||
else if (_wcsicmp(L"K", scale) == 0)
|
||||
{
|
||||
measure->scale = SCALE_KELVIN;
|
||||
}
|
||||
else
|
||||
{
|
||||
WCHAR buffer[256];
|
||||
_snwprintf_s(buffer, _TRUNCATE, L"SpeedFanPlugin.dll: SpeedFanScale=%s is not valid in [%s]", scale, RmGetMeasureName(rm));
|
||||
RmLog(LOG_ERROR, buffer);
|
||||
}
|
||||
}
|
||||
else if (_wcsicmp(L"FAN", type) == 0)
|
||||
{
|
||||
measure->type = TYPE_FAN;
|
||||
}
|
||||
else if (_wcsicmp(L"VOLTAGE", type) == 0)
|
||||
{
|
||||
measure->type = TYPE_VOLT;
|
||||
}
|
||||
else
|
||||
{
|
||||
WCHAR buffer[256];
|
||||
_snwprintf_s(buffer, _TRUNCATE, L"SpeedFanPlugin.dll: SpeedFanType=%s is not valid in [%s]", type, RmGetMeasureName(rm));
|
||||
RmLog(LOG_ERROR, buffer);
|
||||
}
|
||||
|
||||
measure->number = RmReadInt(rm, L"SpeedFanNumber", 0);
|
||||
}
|
||||
|
||||
PLUGIN_EXPORT double Update(void* data)
|
||||
{
|
||||
MeasureData* measure = (MeasureData*)data;
|
||||
double value = 0.0;
|
||||
|
||||
ReadSharedData(measure->type, measure->scale, measure->number, &value);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
PLUGIN_EXPORT void Finalize(void* data)
|
||||
{
|
||||
MeasureData* measure = (MeasureData*)data;
|
||||
delete measure;
|
||||
}
|
||||
|
||||
/*
|
||||
Get the data from shared memory.
|
||||
*/
|
||||
void ReadSharedData(SensorType type, ScaleType scale, UINT number, double* value)
|
||||
{
|
||||
HANDLE hData = OpenFileMapping(FILE_MAP_READ, FALSE, L"SFSharedMemory_ALM");
|
||||
if (hData == nullptr) return;
|
||||
|
||||
SpeedFanData* ptr = (SpeedFanData*)MapViewOfFile(hData, FILE_MAP_READ, 0, 0, 0);
|
||||
if (ptr == 0)
|
||||
{
|
||||
CloseHandle(hData);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptr->version == 1)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case TYPE_TEMP:
|
||||
if (number < ptr->NumTemps)
|
||||
{
|
||||
*value = ptr->temps[number];
|
||||
*value /= 100.0;
|
||||
|
||||
if (scale == SCALE_FARENHEIT)
|
||||
{
|
||||
*value *= 1.8;
|
||||
*value += 32.0;
|
||||
}
|
||||
else if (scale == SCALE_KELVIN)
|
||||
{
|
||||
*value += 273.15;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_FAN:
|
||||
if (number < ptr->NumTemps)
|
||||
{
|
||||
*value = ptr->fans[number];
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_VOLT:
|
||||
if (number < ptr->NumVolts)
|
||||
{
|
||||
*value = ptr->volts[number];
|
||||
*value /= 100.0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RmLog(LOG_ERROR, L"SpeedFanPlugin.dll: Incorrect shared memory version");
|
||||
}
|
||||
|
||||
UnmapViewOfFile(ptr);
|
||||
CloseHandle(hData);
|
||||
}
|
||||
|
Reference in New Issue
Block a user