From d4645c694c6fa070381417bde1c15bcda8a14825 Mon Sep 17 00:00:00 2001 From: tdixon Date: Sun, 9 Jul 2017 14:39:29 -0300 Subject: [PATCH 1/8] basic integration of chroma sdk --- binding-mri/chroma-binding.cpp | 55 +++ chromasdk/ChromaSDKImpl.cpp | 351 ++++++++++++++ chromasdk/ChromaSDKImpl.h | 56 +++ chromasdk/FrameController.cpp | 54 +++ chromasdk/FrameController.h | 23 + chromasdk/RzChromaSDKDefines.h | 172 +++++++ chromasdk/RzChromaSDKTypes.h | 813 +++++++++++++++++++++++++++++++++ chromasdk/RzErrors.h | 46 ++ mkxp.pro | 12 +- 9 files changed, 1580 insertions(+), 2 deletions(-) create mode 100644 binding-mri/chroma-binding.cpp create mode 100644 chromasdk/ChromaSDKImpl.cpp create mode 100644 chromasdk/ChromaSDKImpl.h create mode 100644 chromasdk/FrameController.cpp create mode 100644 chromasdk/FrameController.h create mode 100644 chromasdk/RzChromaSDKDefines.h create mode 100644 chromasdk/RzChromaSDKTypes.h create mode 100644 chromasdk/RzErrors.h diff --git a/binding-mri/chroma-binding.cpp b/binding-mri/chroma-binding.cpp new file mode 100644 index 0000000..ee06a30 --- /dev/null +++ b/binding-mri/chroma-binding.cpp @@ -0,0 +1,55 @@ +#include "binding-util.h" +#include "binding-types.h" +#include "debugwriter.h" + +#include "chromasdk/ChromaSDKImpl.h" + +bool INIT_SUCCESS = false; + +CChromaSDKImpl* chromaImpl = NULL; + +void _attemptLinkSdk() { + #if !defined(_WIN32) && !defined(_WIN64) + // currently razr chroma is windows-only. + // so, if we are not building for windows platform + // then don't bother with chroma stuff + return; + #endif + + chromaImpl = new CChromaSDKImpl(); + chromaImpl->Initialize(); + INIT_SUCCESS = true; +} + +RB_METHOD(chromaSetBase) { + RB_UNUSED_PARAM; + if (INIT_SUCCESS) { + ChromaSDK::Keyboard::CUSTOM_EFFECT_TYPE effect = {}; + for (unsigned int y = 0; y < ChromaSDK::Keyboard::MAX_ROW; y++) { + for (unsigned int x = 0; x < ChromaSDK::Keyboard::MAX_COLUMN; x++) { + effect.Color[y][x] = RGB(0xFF, 0, 0xFF); + } + } + chromaImpl->CreateKeyboardEffectImpl( + ChromaSDK::Keyboard::CHROMA_CUSTOM, + &effect, + NULL); + } + return Qnil; +} + +void chromaBindingInit() { + _attemptLinkSdk(); + + VALUE module = rb_define_module("Chroma"); + _rb_define_module_function(module, "setBase", chromaSetBase); +} + +void chromaBindingRelease() { + if (chromaImpl) { + chromaImpl->UnInitialize(); + delete chromaImpl; + chromaImpl = NULL; + INIT_SUCCESS = false; + } +} diff --git a/chromasdk/ChromaSDKImpl.cpp b/chromasdk/ChromaSDKImpl.cpp new file mode 100644 index 0000000..12304de --- /dev/null +++ b/chromasdk/ChromaSDKImpl.cpp @@ -0,0 +1,351 @@ +//! \example ChromaSDKImpl.cpp + +#include +#include +#include +#include "ChromaSDKImpl.h" +#include "FrameController.h" + +CChromaSDKImpl g_ChromaSDKImpl; + +#ifdef _WIN64 +#define CHROMASDKDLL L"RzChromaSDK64.dll" +#else +#define CHROMASDKDLL L"RzChromaSDK.dll" +#endif + +using namespace std; +using namespace ChromaSDK; +using namespace ChromaSDK::Keyboard; +using namespace ChromaSDK::Keypad; +using namespace ChromaSDK::Mouse; +using namespace ChromaSDK::Mousepad; +using namespace ChromaSDK::Headset; + +typedef RZRESULT (*INIT)(void); +typedef RZRESULT (*UNINIT)(void); +typedef RZRESULT (*CREATEEFFECT)(RZDEVICEID DeviceId, ChromaSDK::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId); +typedef RZRESULT (*CREATEKEYBOARDEFFECT)(ChromaSDK::Keyboard::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId); +typedef RZRESULT (*CREATEHEADSETEFFECT)(ChromaSDK::Headset::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId); +typedef RZRESULT (*CREATEMOUSEPADEFFECT)(ChromaSDK::Mousepad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId); +typedef RZRESULT (*CREATEMOUSEEFFECT)(ChromaSDK::Mouse::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId); +typedef RZRESULT (*CREATEKEYPADEFFECT)(ChromaSDK::Keypad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId); +typedef RZRESULT (*CREATECHROMALINKEFFECT)(ChromaSDK::ChromaLink::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId); +typedef RZRESULT (*SETEFFECT)(RZEFFECTID EffectId); +typedef RZRESULT (*DELETEEFFECT)(RZEFFECTID EffectId); +typedef RZRESULT (*REGISTEREVENTNOTIFICATION)(HWND hWnd); +typedef RZRESULT (*UNREGISTEREVENTNOTIFICATION)(void); +typedef RZRESULT (*QUERYDEVICE)(RZDEVICEID DeviceId, ChromaSDK::DEVICE_INFO_TYPE &DeviceInfo); + +INIT Init = NULL; +UNINIT UnInit = NULL; +CREATEEFFECT CreateEffect = NULL; +CREATEKEYBOARDEFFECT CreateKeyboardEffect = NULL; +CREATEMOUSEEFFECT CreateMouseEffect = NULL; +CREATEHEADSETEFFECT CreateHeadsetEffect = NULL; +CREATEMOUSEPADEFFECT CreateMousematEffect = NULL; +CREATEKEYPADEFFECT CreateKeypadEffect = NULL; +CREATECHROMALINKEFFECT CreateChromaLinkEffect = NULL; +SETEFFECT SetEffect = NULL; +DELETEEFFECT DeleteEffect = NULL; +QUERYDEVICE QueryDevice = NULL; + +#define EVENT_NAME L"{4784D90A-1179-4F7D-8558-52511D809190}" + +#define MAX_EFFECTS 100 + +typedef struct _EFFECTDATATYPE +{ + long numEffects; + BOOL repeat; + HANDLE thread; + struct _EFFECT + { + RZEFFECTID id; + long delay; + } Effect[MAX_EFFECTS]; +} EFFECTDATATYPE; + +struct GUIDCompare +{ + BOOL operator()(const GUID & Left, const GUID & Right) const + { + return memcmp(&Left , &Right,sizeof(Right)) < 0; + } +}; + +std::map g_Effects; + +DWORD WINAPI Thread_RenderEffects(LPVOID lpParameter) +{ + RZEFFECTID *pEffectId = (RZEFFECTID*)lpParameter; + + auto iterator = g_Effects.find(*pEffectId); + if(iterator != g_Effects.end()) + { + EFFECTDATATYPE *pEffectData = &iterator->second; + + CFrameController FrameControl(30); + + if(pEffectData->repeat == FALSE) + { + for(int i=0; inumEffects; i++) + { + FrameControl.Begin(); + + SetEffect(pEffectData->Effect[i].id); + + Sleep(pEffectData->Effect[i].delay); + + FrameControl.End(); + } + } + else + { + while(pEffectData->repeat) + { + for(int i=0; inumEffects; i++) + { + FrameControl.Begin(); + + SetEffect(pEffectData->Effect[i].id); + + Sleep(pEffectData->Effect[i].delay); + + FrameControl.End(); + } + }; + } + } + + return 0; +} + +// CChromaSDKImpl + +CChromaSDKImpl::CChromaSDKImpl(): + m_hModule(NULL), + m_hEvent(NULL) +{ +} + +CChromaSDKImpl::~CChromaSDKImpl() +{ +} + +void CChromaSDKImpl::Initialize() +{ + if(m_hModule == NULL) + { + m_hModule =::LoadLibrary(CHROMASDKDLL); + if(m_hModule != NULL) + { + INIT Init = (INIT)::GetProcAddress(m_hModule, "Init"); + if(Init != NULL) + { + RZRESULT rzResult = Init(); + if(rzResult == RZRESULT_SUCCESS) + { + CreateEffect = (CREATEEFFECT)::GetProcAddress(m_hModule, "CreateEffect"); + CreateKeyboardEffect = (CREATEKEYBOARDEFFECT)::GetProcAddress(m_hModule, "CreateKeyboardEffect"); + CreateMouseEffect = (CREATEMOUSEEFFECT)::GetProcAddress(m_hModule, "CreateMouseEffect"); + CreateMousematEffect = (CREATEMOUSEPADEFFECT)::GetProcAddress(m_hModule, "CreateMousepadEffect"); + CreateKeypadEffect = (CREATEKEYPADEFFECT)::GetProcAddress(m_hModule, "CreateKeypadEffect"); + CreateHeadsetEffect = (CREATEHEADSETEFFECT)::GetProcAddress(m_hModule, "CreateHeadsetEffect"); + CreateChromaLinkEffect = (CREATECHROMALINKEFFECT)::GetProcAddress(m_hModule, "CreateChromaLinkEffect"); + SetEffect = (SETEFFECT)GetProcAddress(m_hModule, "SetEffect"); + DeleteEffect = (DELETEEFFECT)GetProcAddress(m_hModule, "DeleteEffect"); + } + } + } + } + + if(m_hEvent == NULL) + { + m_hEvent = ::CreateEvent(NULL, TRUE, FALSE, EVENT_NAME); + } +} + +void CChromaSDKImpl::UnInitialize() +{ + // Free memeory + while(!g_Effects.empty()) + { + auto iterator = g_Effects.begin(); + for(int i=0; isecond.numEffects; i++) + { + DeleteEffect(iterator->second.Effect[i].id); + } + + g_Effects.erase(iterator); + }; + + if(m_hEvent != NULL) + { + ::CloseHandle(m_hEvent); + m_hEvent = NULL; + } + + if(m_hModule != NULL) + { + UNINIT UnInit = (UNINIT)::GetProcAddress(m_hModule, "UnInit"); + if(UnInit != NULL) + { + RZRESULT rzResult = UnInit(); + if(rzResult != RZRESULT_SUCCESS) + { + // Some error here + } + } + + ::FreeLibrary(m_hModule); + m_hModule = NULL; + } +} + +void CChromaSDKImpl::CreateEffectImpl(RZDEVICEID DeviceId, ChromaSDK::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId) +{ + if(CreateEffect == NULL) return; + + CreateEffect(DeviceId, Effect, pParam, pEffectId); +} + +void CChromaSDKImpl::CreateKeyboardEffectImpl(ChromaSDK::Keyboard::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId) +{ + if(CreateKeyboardEffect == NULL) return; + + CreateKeyboardEffect(Effect, pParam, pEffectId); +} + +void CChromaSDKImpl::CreateMouseEffectImpl(ChromaSDK::Mouse::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId) +{ + if(CreateMouseEffect == NULL) return; + + CreateMouseEffect(Effect, pParam, pEffectId); +} + +void CChromaSDKImpl::CreateMousematEffectImpl(ChromaSDK::Mousepad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId) +{ + if(CreateMousematEffect == NULL) return; + + CreateMousematEffect(Effect, pParam, pEffectId); +} + +void CChromaSDKImpl::CreateKeypadEffectImpl(ChromaSDK::Keypad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId) +{ + if(CreateKeypadEffect == NULL) return; + + CreateKeypadEffect(Effect, pParam, pEffectId); +} + +void CChromaSDKImpl::CreateHeadsetEffectImpl(ChromaSDK::Headset::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId) +{ + if(CreateHeadsetEffect == NULL) return; + + CreateHeadsetEffect(Effect, pParam, pEffectId); +} + +void CChromaSDKImpl::CreateChromaLinkEffectImpl(ChromaSDK::ChromaLink::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId) +{ + if(CreateChromaLinkEffect == NULL) return; + + CreateChromaLinkEffect(Effect, pParam, pEffectId); +} + +void CChromaSDKImpl::SetEffectImpl(RZEFFECTID EffectId) +{ + auto iterator = g_Effects.find(EffectId); + if(iterator != g_Effects.end()) + { + if(iterator->second.repeat == FALSE) + { + HANDLE hThread = CreateThread(NULL, 0, Thread_RenderEffects, (LPVOID)&iterator->first, 0, NULL); + if(hThread != NULL) + { + CloseHandle(hThread); + } + } + else + { + HANDLE hThread = CreateThread(NULL, 0, Thread_RenderEffects, (LPVOID)&iterator->first, 0, NULL); + if(hThread != NULL) + { + iterator->second.thread = hThread; + } + } + } + else + { + if(SetEffect == NULL) return; + + SetEffect(EffectId); + } +} + +void CChromaSDKImpl::DeleteEffectImpl(RZEFFECTID EffectId) +{ + auto iterator = g_Effects.find(EffectId); + if(iterator != g_Effects.end()) + { + EFFECTDATATYPE EffectData = iterator->second; + for(int i=0; isecond.repeat == TRUE) && + (iterator->second.thread != NULL)) + { + iterator->second.repeat = FALSE; + + CloseHandle(iterator->second.thread); + + iterator->second.thread = NULL; + } + } +} + +void CChromaSDKImpl::CreateEffectGroup(RZEFFECTID *pGroupEffectId, BOOL Repeat) +{ + RZEFFECTID EffectId = GUID_NULL; + if(SUCCEEDED(::CoCreateGuid(&EffectId))) + { + EFFECTDATATYPE EffectData = {}; + + EffectData.numEffects = 0; + EffectData.repeat = Repeat; + + g_Effects.insert(make_pair(EffectId, EffectData)); + + *pGroupEffectId = EffectId; + } +} + +void CChromaSDKImpl::AddToGroup(RZEFFECTID GroupEffectId, RZEFFECTID EffectId, long DelayMS) +{ + auto iterator = g_Effects.find(GroupEffectId); + if(iterator != g_Effects.end()) + { + long lIndex = iterator->second.numEffects; + + iterator->second.Effect[lIndex].id = EffectId; + iterator->second.Effect[lIndex].delay = DelayMS; + + iterator->second.numEffects++; + } +} diff --git a/chromasdk/ChromaSDKImpl.h b/chromasdk/ChromaSDKImpl.h new file mode 100644 index 0000000..91a09b0 --- /dev/null +++ b/chromasdk/ChromaSDKImpl.h @@ -0,0 +1,56 @@ + +#ifndef _CHROMASDKIMPL2_H_ +#define _CHROMASDKIMPL2_H_ + +#pragma once + +#include "RzChromaSDKDefines.h" +#include "RzChromaSDKTypes.h" +#include "RzErrors.h" + +const COLORREF BLACK = RGB(0,0,0); +const COLORREF WHITE = RGB(255,255,255); +const COLORREF RED = RGB(255,0,0); +const COLORREF GREEN = RGB(0,255,0); +const COLORREF BLUE = RGB(0,0,255); +const COLORREF YELLOW = RGB(255,255,0); +const COLORREF PURPLE = RGB(128,0,128); +const COLORREF CYAN = RGB(00,255,255); +const COLORREF ORANGE = RGB(255,165,00); +const COLORREF PINK = RGB(255,192,203); +const COLORREF GREY = RGB(125, 125, 125); + +class CChromaSDKImpl +{ +public: + CChromaSDKImpl(); + ~CChromaSDKImpl(); + +public: + void Initialize(); + void UnInitialize(); + + void CreateEffectImpl(RZDEVICEID DeviceId, ChromaSDK::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId=NULL); + void CreateKeyboardEffectImpl(ChromaSDK::Keyboard::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId=NULL); + void CreateMouseEffectImpl(ChromaSDK::Mouse::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId=NULL); + void CreateMousematEffectImpl(ChromaSDK::Mousepad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId=NULL); + void CreateKeypadEffectImpl(ChromaSDK::Keypad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId=NULL); + void CreateHeadsetEffectImpl(ChromaSDK::Headset::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId=NULL); + void CreateChromaLinkEffectImpl(ChromaSDK::ChromaLink::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId=NULL); + void SetEffectImpl(RZEFFECTID EffectId); + void DeleteEffectImpl(RZEFFECTID EffectId); + void StopEffectImpl(RZEFFECTID EffectId); + + void CreateEffectGroup(RZEFFECTID *pGroupEffectId, BOOL Repeat=FALSE); + void AddToGroup(RZEFFECTID GroupEffectId, RZEFFECTID EffectId, LONG DelayMS=100); + +private: + HMODULE m_hModule; + HANDLE m_hEvent; +}; + +extern CChromaSDKImpl g_ChromaSDKImpl; + +#endif + + diff --git a/chromasdk/FrameController.cpp b/chromasdk/FrameController.cpp new file mode 100644 index 0000000..ceef488 --- /dev/null +++ b/chromasdk/FrameController.cpp @@ -0,0 +1,54 @@ + +#include "FrameController.h" +#include + +int g_dwCurrentTickCount = 0; + +// CFrameController +CFrameController::CFrameController(): + m_FramesPerSec(-1), + m_OneFrame(0) +{ + +} + +CFrameController::CFrameController(long FramePerSec): + m_FramesPerSec(FramePerSec), + m_OneFrame(1000.0/m_FramesPerSec) +{ +} + +CFrameController::~CFrameController() +{ + +} + +void CFrameController::Begin() +{ + g_dwCurrentTickCount = GetTickCount(); +} + +void CFrameController::End() +{ + static int dwSleep = 0; + static int dwDiff = 0; + + dwDiff = GetTickCount() - g_dwCurrentTickCount; + dwSleep = (int)(m_OneFrame - (double)dwDiff); + + if (dwDiff < m_OneFrame) + { + Sleep(dwSleep); + } +} + +void CFrameController::SetRate(long FramePerSec) +{ + m_FramesPerSec = FramePerSec; + m_OneFrame = 1000.0 / m_FramesPerSec; +} + +long CFrameController::GetRate(void) +{ + return m_FramesPerSec; +} diff --git a/chromasdk/FrameController.h b/chromasdk/FrameController.h new file mode 100644 index 0000000..7216ef9 --- /dev/null +++ b/chromasdk/FrameController.h @@ -0,0 +1,23 @@ +#ifndef _FRAMECONTROLLER_H_ +#define _FRAMECONTROLLER_H_ + +#pragma once + +class CFrameController +{ +public: + CFrameController(); + CFrameController(long FramePerSec); + ~CFrameController(); + + void Begin(); + void End(); + void SetRate(long FramePerSec); + long GetRate(); + +private: + long m_FramesPerSec; + double m_OneFrame; +}; + +#endif diff --git a/chromasdk/RzChromaSDKDefines.h b/chromasdk/RzChromaSDKDefines.h new file mode 100644 index 0000000..0538ae1 --- /dev/null +++ b/chromasdk/RzChromaSDKDefines.h @@ -0,0 +1,172 @@ +//! \file RzChromaSDKDefines.h +//! \brief Definitions of global and static variables. + +#ifndef _RZSCHROMADKDEFINES_H_ +#define _RZSCHROMADKDEFINES_H_ + +#pragma once + +#ifndef GUID_DEFINED +#include +#endif + +namespace ChromaSDK +{ + // Keyboards + //! Razer Blackwidow Chroma device. + // {2EA1BB63-CA28-428D-9F06-196B88330BBB} + static const GUID BLACKWIDOW_CHROMA = + { 0x2ea1bb63, 0xca28, 0x428d, { 0x9f, 0x06, 0x19, 0x6b, 0x88, 0x33, 0x0b, 0xbb } }; + + //! Razer Blackwidow Chroma Tournament Edition device. + // {ED1C1B82-BFBE-418F-B49D-D03F05B149DF} + static const GUID BLACKWIDOW_CHROMA_TE = + { 0xed1c1b82, 0xbfbe, 0x418f, { 0xb4, 0x9d, 0xd0, 0x3f, 0x5, 0xb1, 0x49, 0xdf } }; + + //! Razer Deathstalker device. + // {18C5AD9B-4326-4828-92C4-2669A66D2283} + static const GUID DEATHSTALKER_CHROMA = + { 0x18c5ad9b, 0x4326, 0x4828, { 0x92, 0xc4, 0x26, 0x69, 0xa6, 0x6d, 0x22, 0x83 } }; + + //! Overwatch Keyboard. + // {872AB2A9-7959-4478-9FED-15F6186E72E4} + static const GUID OVERWATCH_KEYBOARD = + { 0x872ab2a9, 0x7959, 0x4478, { 0x9f, 0xed, 0x15, 0xf6, 0x18, 0x6e, 0x72, 0xe4 } }; + + //! Razer Blackwidow X Chroma device. + // {5AF60076-ADE9-43D4-B574-52599293B554} + static const GUID BLACKWIDOW_X_CHROMA = + { 0x5af60076, 0xade9, 0x43d4, { 0xb5, 0x74, 0x52, 0x59, 0x92, 0x93, 0xb5, 0x54 } }; + + //! Razer Blackwidow X TE Chroma device. + // {2D84DD51-3290-4AAC-9A89-D8AFDE38B57C} + static const GUID BLACKWIDOW_X_TE_CHROMA = + { 0x2d84dd51, 0x3290, 0x4aac, { 0x9a, 0x89, 0xd8, 0xaf, 0xde, 0x38, 0xb5, 0x7c } }; + + //! Razer Omata Chroma + // {803378C1-CC48-4970-8539-D828CC1D420A} + static const GUID OMATA_CHROMA = + { 0x803378c1, 0xcc48, 0x4970,{ 0x85, 0x39, 0xd8, 0x28, 0xcc, 0x1d, 0x42, 0xa } }; + + //! Razer Blade Stealth. + // {C83BDFE8-E7FC-40E0-99DB-872E23F19891} + static const GUID BLADE_STEALTH = + { 0xc83bdfe8, 0xe7fc, 0x40e0, { 0x99, 0xdb, 0x87, 0x2e, 0x23, 0xf1, 0x98, 0x91 } }; + + //! Razer Blade + // {F2BEDFAF-A0FE-4651-9D41-B6CE603A3DDD} + static const GUID BLADE = + { 0xf2bedfaf, 0xa0fe, 0x4651, { 0x9d, 0x41, 0xb6, 0xce, 0x60, 0x3a, 0x3d, 0xdd } }; + + //! Razer Blade Pro + // {A73AC338-F0E5-4BF7-91AE-DD1F7E1737A5} + static const GUID BLADE_PRO = + { 0xa73ac338, 0xf0e5, 0x4bf7,{ 0x91, 0xae, 0xdd, 0x1f, 0x7e, 0x17, 0x37, 0xa5 } }; + + //! Razer Blackwidow Chroma v2 + // {608E743F-B402-44BD-A7A6-7AA9F574ECF4} + static const GUID BLACKWIDOW_CHROMA2 = + { 0x608e743f, 0xb402, 0x44bd,{ 0xa7, 0xa6, 0x7a, 0xa9, 0xf5, 0x74, 0xec, 0xf4 } }; + + + + // Mice + //! Razer Deathadder Chroma device. + // {AEC50D91-B1F1-452F-8E16-7B73F376FDF3} + static const GUID DEATHADDER_CHROMA = + { 0xaec50d91, 0xb1f1, 0x452f, { 0x8e, 0x16, 0x7b, 0x73, 0xf3, 0x76, 0xfd, 0xf3 } }; + + //! Razer Mamba Chroma Tournament Edition device. + // {7EC00450-E0EE-4289-89D5-0D879C19061A} + static const GUID MAMBA_CHROMA_TE = + { 0x7ec00450, 0xe0ee, 0x4289, { 0x89, 0xd5, 0xd, 0x87, 0x9c, 0x19, 0x6, 0x1a } }; + + //! Razer Diamondback device. + // {FF8A5929-4512-4257-8D59-C647BF9935D0} + static const GUID DIAMONDBACK_CHROMA = + { 0xff8a5929, 0x4512, 0x4257, { 0x8d, 0x59, 0xc6, 0x47, 0xbf, 0x99, 0x35, 0xd0 } }; + + //! Razer Mamba device. + // {D527CBDC-EB0A-483A-9E89-66D50463EC6C} + static const GUID MAMBA_CHROMA = + { 0xd527cbdc, 0xeb0a, 0x483a, { 0x9e, 0x89, 0x66, 0xd5, 0x4, 0x63, 0xec, 0x6c } }; + + //! Razer Naga Epic device. + // {D714C50B-7158-4368-B99C-601ACB985E98} + static const GUID NAGA_EPIC_CHROMA = + { 0xd714c50b, 0x7158, 0x4368, { 0xb9, 0x9c, 0x60, 0x1a, 0xcb, 0x98, 0x5e, 0x98 } }; + + //! Razer Naga device. + // {F1876328-6CA4-46AE-BE04-BE812B414433} + static const GUID NAGA_CHROMA = + { 0xf1876328, 0x6ca4, 0x46ae, { 0xbe, 0x4, 0xbe, 0x81, 0x2b, 0x41, 0x44, 0x33 } }; + + //! Razer Orochi Chroma device. + // {52C15681-4ECE-4DD9-8A52-A1418459EB34} + static const GUID OROCHI_CHROMA = + { 0x52c15681, 0x4ece, 0x4dd9, { 0x8a, 0x52, 0xa1, 0x41, 0x84, 0x59, 0xeb, 0x34 } }; + + //! Razer Naga Hex Chroma device. + // {195D70F5-F285-4CFF-99F2-B8C0E9658DB4} + static const GUID NAGA_HEX_CHROMA = + { 0x195d70f5, 0xf285, 0x4cff, { 0x99, 0xf2, 0xb8, 0xc0, 0xe9, 0x65, 0x8d, 0xb4 } }; + + //! Razer DeathAdder Elite Chroma device. + // {77834867-3237-4A9F-AD77-4A46C4183003} + static const GUID DEATHADDER_ELITE_CHROMA = + { 0x77834867, 0x3237, 0x4a9f,{ 0xad, 0x77, 0x4a, 0x46, 0xc4, 0x18, 0x30, 0x3 } }; + + + // Headsets + //! Razer Kraken 7.1 Chroma device. + // {CD1E09A5-D5E6-4A6C-A93B-E6D9BF1D2092} + static const GUID KRAKEN71_CHROMA = + { 0xcd1e09a5, 0xd5e6, 0x4a6c, { 0xa9, 0x3b, 0xe6, 0xd9, 0xbf, 0x1d, 0x20, 0x92 } }; + + //! Razer ManO'War device. + // {DF3164D7-5408-4A0E-8A7F-A7412F26BEBF} + static const GUID MANOWAR_CHROMA = + { 0xdf3164d7, 0x5408, 0x4a0e, { 0x8a, 0x7f, 0xa7, 0x41, 0x2f, 0x26, 0xbe, 0xbf } }; + + //! Razer Kraken 7.1 Chroma Refresh headset. + // {7FB8A36E-9E74-4BB3-8C86-CAC7F7891EBD} + static const GUID KRAKEN71_REFRESH_CHROMA = + { 0x7fb8a36e, 0x9e74, 0x4bb3,{ 0x8c, 0x86, 0xca, 0xc7, 0xf7, 0x89, 0x1e, 0xbd } }; + + + // Mouse mat + //! Razer Firefly device. + // {80F95A94-73D2-48CA-AE9A-0986789A9AF2} + static const GUID FIREFLY_CHROMA = + { 0x80f95a94, 0x73d2, 0x48ca, { 0xae, 0x9a, 0x9, 0x86, 0x78, 0x9a, 0x9a, 0xf2 } }; + + + // Keypads + //! Razer Tartarus device. + // {00F0545C-E180-4AD1-8E8A-419061CE505E} + static const GUID TARTARUS_CHROMA = + { 0xf0545c, 0xe180, 0x4ad1, { 0x8e, 0x8a, 0x41, 0x90, 0x61, 0xce, 0x50, 0x5e } }; + + //! Razer Orbweaver device. + // {9D24B0AB-0162-466C-9640-7A924AA4D9FD} + static const GUID ORBWEAVER_CHROMA = + { 0x9d24b0ab, 0x162, 0x466c, { 0x96, 0x40, 0x7a, 0x92, 0x4a, 0xa4, 0xd9, 0xfd } }; + + + // Chroma Linked devices + // {35F6F18D-1AE5-436C-A575-AB44A127903A} + static const GUID LENOVO_Y900 = + { 0x35f6f18d, 0x1ae5, 0x436c, { 0xa5, 0x75, 0xab, 0x44, 0xa1, 0x27, 0x90, 0x3a } }; + + // {47DB1FA7-6B9B-4EE6-B6F4-4071A3B2053B} + static const GUID LENOVO_Y27 = + { 0x47db1fa7, 0x6b9b, 0x4ee6, { 0xb6, 0xf4, 0x40, 0x71, 0xa3, 0xb2, 0x5, 0x3b } }; + + // {0201203B-62F3-4C50-83DD-598BABD208E0} + static const GUID CORE_CHROMA = + { 0x201203b, 0x62f3, 0x4c50, { 0x83, 0xdd, 0x59, 0x8b, 0xab, 0xd2, 0x8, 0xe0 } }; + + +} + +#endif diff --git a/chromasdk/RzChromaSDKTypes.h b/chromasdk/RzChromaSDKTypes.h new file mode 100644 index 0000000..27f7bca --- /dev/null +++ b/chromasdk/RzChromaSDKTypes.h @@ -0,0 +1,813 @@ +//! \file RzChromaSDKTypes.h +//! \brief Data types. + +#ifndef _RZCHROMASDKTYPES_H_ +#define _RZCHROMASDKTYPES_H_ + +#pragma once + +typedef LONG RZRESULT; //!< Return result. +typedef GUID RZEFFECTID; //!< Effect Id. +typedef GUID RZDEVICEID; //!< Device Id. +typedef unsigned int RZDURATION; //!< Milliseconds. +typedef size_t RZSIZE; //!< Size. +typedef void* PRZPARAM; //!< Context sensitive pointer. +typedef DWORD RZID; //!< Generic data type for Identifier. +typedef DWORD RZCOLOR; //!< Color data. 1st byte = Red; 2nd byte = Green; 3rd byte = Blue; 4th byte = Alpha (if applicable) + +namespace ChromaSDK +{ + //! Event notification Window message + const UINT WM_CHROMA_EVENT = WM_APP+0x2000; + + //! Chroma generic effects. Note: Not all devices supported the listed effects. + typedef enum EFFECT_TYPE + { + CHROMA_NONE = 0, //!< No effect. + CHROMA_WAVE, //!< Wave effect (This effect type has deprecated and should not be used). + CHROMA_SPECTRUMCYCLING, //!< Spectrum cycling effect (This effect type has deprecated and should not be used). + CHROMA_BREATHING, //!< Breathing effect (This effect type has deprecated and should not be used). + CHROMA_BLINKING, //!< Blinking effect (This effect type has deprecated and should not be used). + CHROMA_REACTIVE, //!< Reactive effect (This effect type has deprecated and should not be used). + CHROMA_STATIC, //!< Static effect. + CHROMA_CUSTOM, //!< Custom effect. For mice, please see Mouse::CHROMA_CUSTOM2. + CHROMA_RESERVED, //!< Reserved + CHROMA_INVALID //!< Invalid effect. + } EFFECT_TYPE; + + //! Device info. + typedef struct DEVICE_INFO_TYPE + { + //! Device types. + enum DeviceType + { + DEVICE_KEYBOARD = 1, //!< Keyboard device. + DEVICE_MOUSE = 2, //!< Mouse device. + DEVICE_HEADSET = 3, //!< Headset device. + DEVICE_MOUSEPAD = 4, //!< Mousepad device. + DEVICE_KEYPAD = 5, //!< Keypad device. + DEVICE_SYSTEM = 6, //!< System device. + DEVICE_INVALID //!< Invalid device. + } DeviceType; + + DWORD Connected; //!< Number of devices connected. + } DEVICE_INFO_TYPE; + + const RZSIZE MAX_ROW = 30; //!< Maximum rows for custom effects. + const RZSIZE MAX_COLUMN = 30; //!< Maximum columns for custom effects. + + //! Blinking effect (This effect type has deprecated and should not be used). + typedef struct BLINKING_EFFECT_TYPE + { + RZSIZE Size; //!< Size of the structure. Size = sizeof(BLINKING_EFFECT_TYPE) + DWORD Param; //!< Extra parameters. + + COLORREF Color; //!< Blinking color + } BLINKING_EFFECT_TYPE; + + //! Breathing effect (This effect type has deprecated and should not be used). + typedef struct BREATHING_EFFECT_TYPE + { + RZSIZE Size; //!< Size of ths structure. Size = sizeof(BREATHING_EFFECT_TYPE) + DWORD Param; //!< Extra parameters. + + //! Breathing effect types. + enum _Type + { + ONE_COLOR = 1, //!< 1 color (Only fill Color1). + TWO_COLORS, //!< 2 colors. + RANDOM_COLORS //!< Random colors + } Type; + + COLORREF Color1; //!< First color. + COLORREF Color2; //!< Second color. + } BREATHING_EFFECT_TYPE; + + //! Custom effect (This effect type has deprecated and should not be used). + typedef struct CUSTOM_EFFECT_TYPE + { + RZSIZE Size; //!< Size of the structure. Size = sizeof(CUSTOM_EFFECT_TYPE) + DWORD Param; //!< Extra parameters. + + RZCOLOR Color[MAX_ROW][MAX_COLUMN]; + } CUSTOM_EFFECT_TYPE; + + //! No effect. + typedef struct NO_EFFECT_TYPE + { + RZSIZE Size; //!< Size of the structure. Size = sizeof(NO_EFFECT_TYPE) + DWORD Param; //!< Extra parameters. + } NO_EFFECT_TYPE; + + //! Reactive effect (This effect type has deprecated and should not be used). + typedef struct REACTIVE_EFFECT_TYPE + { + RZSIZE Size; //!< Size of the structure. Size = sizeof(REACTIVE_EFFECT_TYPE) + DWORD Param; //!< Extra parameters. + + //! Duration of the effect. + enum _Duration + { + DURATION_SHORT = 1, //!< Short duration. + DURATION_MEDIUM, //!< Medium duration. + DURATION_LONG //!< Long duration. + } Duration; //!< The time taken for the effect to fade away. + + COLORREF Color; //!< Color of the effect. + } REACTIVE_EFFECT_TYPE; + + //! Spectrum cycling effect (This effect type has deprecated and should not be used). + typedef struct SPECTRUMCYCLING_EFFECT_TYPE + { + RZSIZE Size; //!< Size of the structure. Size = sizeof(SPECTRUMCYCLING_EFFECT_TYPE) + DWORD Param; //!< Extra parameters. + } SPECTRUMCYCLING_EFFECT_TYPE; + + //! Starlight effect (This effect type has deprecated and should not be used). + typedef struct STARLIGHT_EFFECT_TYPE + { + RZSIZE Size; //!< Size of the structure. Size = sizeof(SPECTRUMCYCLING_EFFECT_TYPE) + DWORD Param; //!< Extra parameters. + + //! Starlight effect types. + enum _Type + { + TWO_COLORS = 1, //!< 2 colors. + RANDOM_COLORS //!< Random colors + } Type; + + COLORREF Color1; //!< First color. + COLORREF Color2; //!< Second color. + + //! Duration of the effect. + enum _Duration + { + DURATION_SHORT = 1, //!< Short duration. + DURATION_MEDIUM, //!< Medium duration. + DURATION_LONG //!< Long duration. + } Duration; //!< The time taken for the effect to fade away. + + } STARLIGHT_EFFECT_TYPE; + + //! Static effect (This effect type has deprecated and should not be used). + typedef struct STATIC_EFFECT_TYPE + { + RZSIZE Size; //!< Size of the structure. Size = sizeof(STATIC_EFFECT_TYPE) + DWORD Param; //!< Extra parameters. + + COLORREF Color; //!< Color of the effect. + } STATIC_EFFECT_TYPE; + + //! Wave effect (This effect type has deprecated and should not be used). + typedef struct WAVE_EFFECT_TYPE + { + RZSIZE Size; //!< Size of the structure. Size = sizeof(WAVE_EFFECT_TYPE) + DWORD Param; //!< Extra parameters. + + //! Direction of effect. + enum _Direction + { + DIRECTION_LEFT_TO_RIGHT = 1, //!< Left to right. + DIRECTION_RIGHT_TO_LEFT, //!< Right to left. + DIRECTION_FRONT_TO_BACK, //!< Front to back + DIRECTION_BACK_TO_FRONT //!< Back top front + } Direction; + } WAVE_EFFECT_TYPE; + + //! Keyboards + namespace Keyboard + { + //! Definitions of keys. + typedef enum RZKEY + { + RZKEY_ESC = 0x0001, /*!< Esc (VK_ESCAPE) */ + RZKEY_F1 = 0x0003, /*!< F1 (VK_F1) */ + RZKEY_F2 = 0x0004, /*!< F2 (VK_F2) */ + RZKEY_F3 = 0x0005, /*!< F3 (VK_F3) */ + RZKEY_F4 = 0x0006, /*!< F4 (VK_F4) */ + RZKEY_F5 = 0x0007, /*!< F5 (VK_F5) */ + RZKEY_F6 = 0x0008, /*!< F6 (VK_F6) */ + RZKEY_F7 = 0x0009, /*!< F7 (VK_F7) */ + RZKEY_F8 = 0x000A, /*!< F8 (VK_F8) */ + RZKEY_F9 = 0x000B, /*!< F9 (VK_F9) */ + RZKEY_F10 = 0x000C, /*!< F10 (VK_F10) */ + RZKEY_F11 = 0x000D, /*!< F11 (VK_F11) */ + RZKEY_F12 = 0x000E, /*!< F12 (VK_F12) */ + RZKEY_1 = 0x0102, /*!< 1 (VK_1) */ + RZKEY_2 = 0x0103, /*!< 2 (VK_2) */ + RZKEY_3 = 0x0104, /*!< 3 (VK_3) */ + RZKEY_4 = 0x0105, /*!< 4 (VK_4) */ + RZKEY_5 = 0x0106, /*!< 5 (VK_5) */ + RZKEY_6 = 0x0107, /*!< 6 (VK_6) */ + RZKEY_7 = 0x0108, /*!< 7 (VK_7) */ + RZKEY_8 = 0x0109, /*!< 8 (VK_8) */ + RZKEY_9 = 0x010A, /*!< 9 (VK_9) */ + RZKEY_0 = 0x010B, /*!< 0 (VK_0) */ + RZKEY_A = 0x0302, /*!< A (VK_A) */ + RZKEY_B = 0x0407, /*!< B (VK_B) */ + RZKEY_C = 0x0405, /*!< C (VK_C) */ + RZKEY_D = 0x0304, /*!< D (VK_D) */ + RZKEY_E = 0x0204, /*!< E (VK_E) */ + RZKEY_F = 0x0305, /*!< F (VK_F) */ + RZKEY_G = 0x0306, /*!< G (VK_G) */ + RZKEY_H = 0x0307, /*!< H (VK_H) */ + RZKEY_I = 0x0209, /*!< I (VK_I) */ + RZKEY_J = 0x0308, /*!< J (VK_J) */ + RZKEY_K = 0x0309, /*!< K (VK_K) */ + RZKEY_L = 0x030A, /*!< L (VK_L) */ + RZKEY_M = 0x0409, /*!< M (VK_M) */ + RZKEY_N = 0x0408, /*!< N (VK_N) */ + RZKEY_O = 0x020A, /*!< O (VK_O) */ + RZKEY_P = 0x020B, /*!< P (VK_P) */ + RZKEY_Q = 0x0202, /*!< Q (VK_Q) */ + RZKEY_R = 0x0205, /*!< R (VK_R) */ + RZKEY_S = 0x0303, /*!< S (VK_S) */ + RZKEY_T = 0x0206, /*!< T (VK_T) */ + RZKEY_U = 0x0208, /*!< U (VK_U) */ + RZKEY_V = 0x0406, /*!< V (VK_V) */ + RZKEY_W = 0x0203, /*!< W (VK_W) */ + RZKEY_X = 0x0404, /*!< X (VK_X) */ + RZKEY_Y = 0x0207, /*!< Y (VK_Y) */ + RZKEY_Z = 0x0403, /*!< Z (VK_Z) */ + RZKEY_NUMLOCK = 0x0112, /*!< Numlock (VK_NUMLOCK) */ + RZKEY_NUMPAD0 = 0x0513, /*!< Numpad 0 (VK_NUMPAD0) */ + RZKEY_NUMPAD1 = 0x0412, /*!< Numpad 1 (VK_NUMPAD1) */ + RZKEY_NUMPAD2 = 0x0413, /*!< Numpad 2 (VK_NUMPAD2) */ + RZKEY_NUMPAD3 = 0x0414, /*!< Numpad 3 (VK_NUMPAD3) */ + RZKEY_NUMPAD4 = 0x0312, /*!< Numpad 4 (VK_NUMPAD4) */ + RZKEY_NUMPAD5 = 0x0313, /*!< Numpad 5 (VK_NUMPAD5) */ + RZKEY_NUMPAD6 = 0x0314, /*!< Numpad 6 (VK_NUMPAD6) */ + RZKEY_NUMPAD7 = 0x0212, /*!< Numpad 7 (VK_NUMPAD7) */ + RZKEY_NUMPAD8 = 0x0213, /*!< Numpad 8 (VK_NUMPAD8) */ + RZKEY_NUMPAD9 = 0x0214, /*!< Numpad 9 (VK_ NUMPAD9*/ + RZKEY_NUMPAD_DIVIDE = 0x0113, /*!< Divide (VK_DIVIDE) */ + RZKEY_NUMPAD_MULTIPLY = 0x0114, /*!< Multiply (VK_MULTIPLY) */ + RZKEY_NUMPAD_SUBTRACT = 0x0115, /*!< Subtract (VK_SUBTRACT) */ + RZKEY_NUMPAD_ADD = 0x0215, /*!< Add (VK_ADD) */ + RZKEY_NUMPAD_ENTER = 0x0415, /*!< Enter (VK_RETURN - Extended) */ + RZKEY_NUMPAD_DECIMAL = 0x0514, /*!< Decimal (VK_DECIMAL) */ + RZKEY_PRINTSCREEN = 0x000F, /*!< Print Screen (VK_PRINT) */ + RZKEY_SCROLL = 0x0010, /*!< Scroll Lock (VK_SCROLL) */ + RZKEY_PAUSE = 0x0011, /*!< Pause (VK_PAUSE) */ + RZKEY_INSERT = 0x010F, /*!< Insert (VK_INSERT) */ + RZKEY_HOME = 0x0110, /*!< Home (VK_HOME) */ + RZKEY_PAGEUP = 0x0111, /*!< Page Up (VK_PRIOR) */ + RZKEY_DELETE = 0x020f, /*!< Delete (VK_DELETE) */ + RZKEY_END = 0x0210, /*!< End (VK_END) */ + RZKEY_PAGEDOWN = 0x0211, /*!< Page Down (VK_NEXT) */ + RZKEY_UP = 0x0410, /*!< Up (VK_UP) */ + RZKEY_LEFT = 0x050F, /*!< Left (VK_LEFT) */ + RZKEY_DOWN = 0x0510, /*!< Down (VK_DOWN) */ + RZKEY_RIGHT = 0x0511, /*!< Right (VK_RIGHT) */ + RZKEY_TAB = 0x0201, /*!< Tab (VK_TAB) */ + RZKEY_CAPSLOCK = 0x0301, /*!< Caps Lock(VK_CAPITAL) */ + RZKEY_BACKSPACE = 0x010E, /*!< Backspace (VK_BACK) */ + RZKEY_ENTER = 0x030E, /*!< Enter (VK_RETURN) */ + RZKEY_LCTRL = 0x0501, /*!< Left Control(VK_LCONTROL) */ + RZKEY_LWIN = 0x0502, /*!< Left Window (VK_LWIN) */ + RZKEY_LALT = 0x0503, /*!< Left Alt (VK_LMENU) */ + RZKEY_SPACE = 0x0507, /*!< Spacebar (VK_SPACE) */ + RZKEY_RALT = 0x050B, /*!< Right Alt (VK_RMENU) */ + RZKEY_FN = 0x050C, /*!< Function key. */ + RZKEY_RMENU = 0x050D, /*!< Right Menu (VK_APPS) */ + RZKEY_RCTRL = 0x050E, /*!< Right Control (VK_RCONTROL) */ + RZKEY_LSHIFT = 0x0401, /*!< Left Shift (VK_LSHIFT) */ + RZKEY_RSHIFT = 0x040E, /*!< Right Shift (VK_RSHIFT) */ + RZKEY_MACRO1 = 0x0100, /*!< Macro Key 1 */ + RZKEY_MACRO2 = 0x0200, /*!< Macro Key 2 */ + RZKEY_MACRO3 = 0x0300, /*!< Macro Key 3 */ + RZKEY_MACRO4 = 0x0400, /*!< Macro Key 4 */ + RZKEY_MACRO5 = 0x0500, /*!< Macro Key 5 */ + RZKEY_OEM_1 = 0x0101, /*!< ~ (tilde/半角/全角) (VK_OEM_3) */ + RZKEY_OEM_2 = 0x010C, /*!< -- (minus) (VK_OEM_MINUS) */ + RZKEY_OEM_3 = 0x010D, /*!< = (equal) (VK_OEM_PLUS) */ + RZKEY_OEM_4 = 0x020C, /*!< [ (left sqaure bracket) (VK_OEM_4) */ + RZKEY_OEM_5 = 0x020D, /*!< ] (right square bracket) (VK_OEM_6) */ + RZKEY_OEM_6 = 0x020E, /*!< \ (backslash) (VK_OEM_5) */ + RZKEY_OEM_7 = 0x030B, /*!< ; (semi-colon) (VK_OEM_1) */ + RZKEY_OEM_8 = 0x030C, /*!< ' (apostrophe) (VK_OEM_7) */ + RZKEY_OEM_9 = 0x040A, /*!< , (comma) (VK_OEM_COMMA) */ + RZKEY_OEM_10 = 0x040B, /*!< . (period) (VK_OEM_PERIOD) */ + RZKEY_OEM_11 = 0x040C, /*!< / (forward slash) (VK_OEM_2) */ + RZKEY_EUR_1 = 0x030D, /*!< "#" (VK_OEM_5) */ + RZKEY_EUR_2 = 0x0402, /*!< \ (VK_OEM_102) */ + RZKEY_JPN_1 = 0x0015, /*!< ¥ (0xFF) */ + RZKEY_JPN_2 = 0x040D, /*!< \ (0xC1) */ + RZKEY_JPN_3 = 0x0504, /*!< 無変換 (VK_OEM_PA1) */ + RZKEY_JPN_4 = 0x0509, /*!< 変換 (0xFF) */ + RZKEY_JPN_5 = 0x050A, /*!< ひらがな/カタカナ (0xFF) */ + RZKEY_KOR_1 = 0x0015, /*!< | (0xFF) */ + RZKEY_KOR_2 = 0x030D, /*!< (VK_OEM_5) */ + RZKEY_KOR_3 = 0x0402, /*!< (VK_OEM_102) */ + RZKEY_KOR_4 = 0x040D, /*!< (0xC1) */ + RZKEY_KOR_5 = 0x0504, /*!< (VK_OEM_PA1) */ + RZKEY_KOR_6 = 0x0509, /*!< 한/영 (0xFF) */ + RZKEY_KOR_7 = 0x050A, /*!< (0xFF) */ + RZKEY_INVALID = 0xFFFF /*!< Invalid keys. */ + } RZKEY; + + //! Definition of LEDs. + typedef enum RZLED + { + RZLED_LOGO = 0x0014 /*!< Razer logo */ + } RZLED; + + //! Maximum number of rows in a keyboard. + const RZSIZE MAX_ROW = 6; + + //! Maximum number of columns in a keyboard. + const RZSIZE MAX_COLUMN = 22; + + //! Maximum number of keys. + const RZSIZE MAX_KEYS = MAX_ROW * MAX_COLUMN; + + //! Maximum number of custom effects. + const RZSIZE MAX_CUSTOM_EFFECTS = MAX_KEYS; + + //! Keyboard LED layout. + const COLORREF RZKEY_LAYOUT[MAX_ROW][MAX_COLUMN] = {}; + + //! Chroma keyboard effect types + typedef enum EFFECT_TYPE + { + CHROMA_NONE = 0, //!< No effect. + CHROMA_BREATHING, //!< Breathing effect (This effect has deprecated and should not be used). + CHROMA_CUSTOM, //!< Custom effect. + CHROMA_REACTIVE, //!< Reactive effect (This effect has deprecated and should not be used). + CHROMA_STATIC, //!< Static effect. + CHROMA_SPECTRUMCYCLING, //!< Spectrum cycling effect (This effect has deprecated and should not be used). + CHROMA_WAVE, //!< Wave effect (This effect has deprecated and should not be used). + CHROMA_RESERVED, //!< Reserved. + CHROMA_CUSTOM_KEY, //!< Custom effects with keys. + CHROMA_INVALID //!< Invalid effect. + } EFFECT_TYPE; + + // Chroma keyboard effects + //! Breathing effect type (This effect has deprecated and should not be used). + typedef struct BREATHING_EFFECT_TYPE + { + //! Breathing effects. + enum Type + { + TWO_COLORS = 1, //!< 2 colors + RANDOM_COLORS, //!< Random colors + INVALID //!< Invalid type + } Type; + COLORREF Color1; //!< First color. + COLORREF Color2; //!< Second color. + } BREATHING_EFFECT_TYPE; + + //! Custom effect using a matrix type. + typedef struct CUSTOM_EFFECT_TYPE + { + COLORREF Color[MAX_ROW][MAX_COLUMN]; //!< Grid layout. 6 rows by 22 columns. + } CUSTOM_EFFECT_TYPE; + + //! Custom effect with keys. + typedef struct CUSTOM_KEY_EFFECT_TYPE + { + COLORREF Color[MAX_ROW][MAX_COLUMN]; //!< Grid layout. 6 rows by 22 columns. + COLORREF Key[MAX_ROW][MAX_COLUMN]; //!< Keys information. 6 rows by 22 columns. To indidate there is a key effect, OR with 0x01000000. i.e. Key[0][1] = 0x01000000 | Color; + } CUSTOM_KEY_EFFECT_TYPE; + + //! Reactive effect type (This effect has deprecated and should not be used). + typedef struct REACTIVE_EFFECT_TYPE + { + //! Duration of the effect. + enum Duration + { + DURATION_NONE=0, //!< No duration. + DURATION_SHORT, //!< Short duration. + DURATION_MEDIUM, //!< Medium duration. + DURATION_LONG, //!< Long duration. + DURATION_INVALID //!< Invalid duration. + } Duration; //!< The time taken for the effect to fade away. + + COLORREF Color; //!< Color of the effect + } REACTIVE_EFFECT_TYPE; + + //! Starlight effect (This effect has deprecated and should not be used). + typedef struct STARLIGHT_EFFECT_TYPE + { + //! Starlight effect types. + enum _Type + { + TWO_COLORS = 1, //!< 2 colors. + RANDOM_COLORS //!< Random colors + } Type; + + COLORREF Color1; //!< First color. + COLORREF Color2; //!< Second color. + + //! Duration of the effect. + enum _Duration + { + DURATION_SHORT = 1, //!< Short duration. + DURATION_MEDIUM, //!< Medium duration. + DURATION_LONG //!< Long duration. + } Duration; //!< The time taken for the effect to fade away. + + } STARLIGHT_EFFECT_TYPE; + + //! Static effect type + typedef struct STATIC_EFFECT_TYPE + { + COLORREF Color; //!< Color of the effect + } STATIC_EFFECT_TYPE; + + //! Wave effect type (This effect has deprecated and should not be used). + typedef struct WAVE_EFFECT_TYPE + { + //! Direction of the wave effect. + enum Direction + { + DIRECTION_NONE=0, //!< No direction. + DIRECTION_LEFT_TO_RIGHT, //!< Left to right. + DIRECTION_RIGHT_TO_LEFT, //!< Right to left. + DIRECTION_INVALID //!< Invalid direction. + } Direction; //!< Direction of the wave. + } WAVE_EFFECT_TYPE; + } + + //! Mice + namespace Mouse + { + //! Maximum number of custom LEDs (old definition to maintain backward compatibility). + const RZSIZE MAX_LEDS = 30; + + //! Mice LED layout (old definition to maintain backward compatibility). + const RZCOLOR RZLED_LAYOUT[MAX_LEDS] = {}; + + //! Maximum number of rows of the virtual grid. + const RZSIZE MAX_ROW = 9; + + //! Maximum number of columns of the virtual grid. + const RZSIZE MAX_COLUMN = 7; + + //! Maximum number of LEDs of the virtual grid. + const RZSIZE MAX_LEDS2 = MAX_ROW * MAX_COLUMN; + + //! Mice LED virtual grid layout. + const RZCOLOR RZLED_LAYOUT2[MAX_ROW][MAX_COLUMN] = {}; + + //! Mouse LED Id defintion (This effect type has deprecated and should not be used). + typedef enum RZLED + { + RZLED_NONE = 0, //!< No LED. + RZLED_SCROLLWHEEL = 1, //!< Scroll Wheel LED. + RZLED_LOGO = 2, //!< Logo LED. + RZLED_BACKLIGHT = 3, //!< Backlight or numpad. + RZLED_SIDE_STRIP1 = 4, //!< Side strip LED 1. (For Mamba TE, starts from top left hand) + RZLED_SIDE_STRIP2 = 5, //!< Side strip LED 2. (For Mamba TE) + RZLED_SIDE_STRIP3 = 6, //!< Side strip LED 3. (For Mamba TE) + RZLED_SIDE_STRIP4 = 7, //!< Side strip LED 4. (For Mamba TE) + RZLED_SIDE_STRIP5 = 8, //!< Side strip LED 5. (For Mamba TE) + RZLED_SIDE_STRIP6 = 9, //!< Side strip LED 6. (For Mamba TE) + RZLED_SIDE_STRIP7 = 10, //!< Side strip LED 7. (For Mamba TE) + RZLED_SIDE_STRIP8 = 11, //!< Side strip LED 8. (For Mamba TE) + RZLED_SIDE_STRIP9 = 12, //!< Side strip LED 9. (For Mamba TE) + RZLED_SIDE_STRIP10 = 13, //!< Side strip LED 10. (For Mamba TE) + RZLED_SIDE_STRIP11 = 14, //!< Side strip LED 11. (For Mamba TE) + RZLED_SIDE_STRIP12 = 15, //!< Side strip LED 12. (For Mamba TE) + RZLED_SIDE_STRIP13 = 16, //!< Side strip LED 13. (For Mamba TE) + RZLED_SIDE_STRIP14 = 17, //!< Side strip LED 14. (For Mamba TE) + RZLED_ALL = 0xFFFF + } RZLED; + + //! Mouse LED Id defintion for the virtual grid. + typedef enum RZLED2 + { + RZLED2_SCROLLWHEEL = 0x0203, //!< Scroll Wheel LED. + RZLED2_LOGO = 0x0703, //!< Logo LED. + RZLED2_BACKLIGHT = 0x0403, //!< Backlight LED. + RZLED2_LEFT_SIDE1 = 0x0100, //!< Left LED 1. + RZLED2_LEFT_SIDE2 = 0x0200, //!< Left LED 2. + RZLED2_LEFT_SIDE3 = 0x0300, //!< Left LED 3. + RZLED2_LEFT_SIDE4 = 0x0400, //!< Left LED 4. + RZLED2_LEFT_SIDE5 = 0x0500, //!< Left LED 5. + RZLED2_LEFT_SIDE6 = 0x0600, //!< Left LED 6. + RZLED2_LEFT_SIDE7 = 0x0700, //!< Left LED 7. + RZLED2_BOTTOM1 = 0x0801, //!< Bottom LED 1. + RZLED2_BOTTOM2 = 0x0802, //!< Bottom LED 2. + RZLED2_BOTTOM3 = 0x0803, //!< Bottom LED 3. + RZLED2_BOTTOM4 = 0x0804, //!< Bottom LED 4. + RZLED2_BOTTOM5 = 0x0805, //!< Bottom LED 5. + RZLED2_RIGHT_SIDE1 = 0x0106, //!< Right LED 1. + RZLED2_RIGHT_SIDE2 = 0x0206, //!< Right LED 2. + RZLED2_RIGHT_SIDE3 = 0x0306, //!< Right LED 3. + RZLED2_RIGHT_SIDE4 = 0x0406, //!< Right LED 4. + RZLED2_RIGHT_SIDE5 = 0x0506, //!< Right LED 5. + RZLED2_RIGHT_SIDE6 = 0x0606, //!< Right LED 6. + RZLED2_RIGHT_SIDE7 = 0x0706 //!< Right LED 7. + } RZLED2; + + //! Chroma mouse effect types + typedef enum EFFECT_TYPE + { + CHROMA_NONE = 0, //!< No effect. + CHROMA_BLINKING, //!< Blinking effect (This effect has deprecated and should not be used). + CHROMA_BREATHING, //!< Breathing effect (This effect has deprecated and should not be used). + CHROMA_CUSTOM, //!< Custom effect (old definition to maintain backward compatibility). + CHROMA_REACTIVE, //!< Reactive effect (This effect has deprecated and should not be used). + CHROMA_SPECTRUMCYCLING, //!< Spectrum cycling effect (This effect has deprecated and should not be used). + CHROMA_STATIC, //!< Static effect. + CHROMA_WAVE, //!< Wave effect (This effect has deprecated and should not be used). + CHROMA_CUSTOM2, //!< Custom effects using a virtual grid. + CHROMA_INVALID //!< Invalid effect. + } EFFECT_TYPE; + + //! Static effect type + typedef struct STATIC_EFFECT_TYPE + { + RZLED LEDId; //!< LED Id + COLORREF Color; //!< Color of the effect. + } STATIC_EFFECT_TYPE; + + //! Blinking effect type (This effect has deprecated and should not be used). + typedef struct BLINKING_EFFECT_TYPE + { + RZLED LEDId; //!< LED Id + COLORREF Color; //!< Color. + } BLINKING_EFFECT_TYPE; + + //! Breathing effect (This effect has deprecated and should not be used). + typedef struct BREATHING_EFFECT_TYPE + { + RZLED LEDId; //!< LED Id + + //! Breathing type. + enum Type + { + ONE_COLOR = 1, //!< 1 color (Only fill Color1). + TWO_COLORS, //!< 2 colors. + RANDOM_COLORS, //!< Random colors + INVALID //!< Invalid type + } Type; + + COLORREF Color1; //!< First color. + COLORREF Color2; //!< Second color. + } BREATHING_EFFECT_TYPE; + + //! Custom effect (This effect type has deprecated and should not be used). + typedef struct CUSTOM_EFFECT_TYPE + { + RZCOLOR Color[MAX_LEDS]; //!< Array of colors. + } CUSTOM_EFFECT_TYPE; + + //! Custom effect using virtual grid. + //! Indexes of the LED are defined in RZLED2.i.e. Row = HIBYTE(RZLED2_SCROLLWHEEL), Column = LOBYTE(RZLED2_SCROLLWHEEL) + typedef struct CUSTOM_EFFECT_TYPE2 + { + RZCOLOR Color[MAX_ROW][MAX_COLUMN]; //!< Array of colors. + } CUSTOM_EFFECT_TYPE2; + + //! Reactive effect (This effect has deprecated and should not be used). + typedef struct REACTIVE_EFFECT_TYPE + { + RZLED LEDId; //!< LED Id + + //! Duration of the effect. + enum Duration + { + DURATION_NONE=0, //!< No duration. + DURATION_SHORT, //!< Short duration. + DURATION_MEDIUM, //!< Medium duration. + DURATION_LONG //!< Long duration. + } Duration; + + RZCOLOR Color; //!< Color of the effect. + } REACTIVE_EFFECT_TYPE; + + //! No effect (This effect has deprecated and should not be used). + typedef struct NO_EFFECT_TYPE + { + RZLED LEDId; //!< LED Id + } NO_EFFECT_TYPE; + + //! Spectrum cycling (This effect has deprecated and should not be used). + typedef struct SPECTRUMCYCLING_EFFECT_TYPE + { + RZLED LEDId; //!< LED id. + } SPECTRUMCYCLING_EFFECT_TYPE; + + //! Wave effect (This effect has deprecated and should not be used). + typedef struct WAVE_EFFECT_TYPE + { + //! Direction of the wave effect. + enum Direction + { + FRONT_TO_BACK, //!< Front to back + BACK_TO_FRONT //!< Back to front + } Direction; + } WAVE_EFFECT_TYPE; + } + + //! Headsets + namespace Headset + { + //! Maximum number of LEDs + const RZSIZE MAX_LEDS = 5; + + //! Chroma headset effect types + typedef enum EFFECT_TYPE + { + CHROMA_NONE = 0, //!< No effect. + CHROMA_STATIC, //!< Static effect. + CHROMA_BREATHING, //!< Breathing effect (This effect has deprecated and should not be used). + CHROMA_SPECTRUMCYCLING, //!< Spectrum cycling effect (This effect has deprecated and should not be used). + CHROMA_CUSTOM, //!< Custom effects. + CHROMA_INVALID //!< Invalid effect. + } EFFECT_TYPE; + + //! Static effect type + typedef struct STATIC_EFFECT_TYPE + { + COLORREF Color; //!< Color of the effect. + } STATIC_EFFECT_TYPE; + + //! Breathing effect type (This effect has deprecated and should not be used). + typedef struct BREATHING_EFFECT_TYPE + { + COLORREF Color; //!< Color. + } BREATHING_EFFECT_TYPE; + + //! Custom effect type. + typedef struct CUSTOM_EFFECT_TYPE + { + RZCOLOR Color[MAX_LEDS]; //!< Array of colors. + } CUSTOM_EFFECT_TYPE; + } + + //! Mousepads + namespace Mousepad + { + //! Maximum number of LEDs + const RZSIZE MAX_LEDS = 15; + + //! Chroma mousepad effect types + typedef enum EFFECT_TYPE + { + CHROMA_NONE = 0, //!< No effect. + CHROMA_BREATHING, //!< Breathing effect (This effect has deprecated and should not be used). + CHROMA_CUSTOM, //!< Custom effect. + CHROMA_SPECTRUMCYCLING, //!< Spectrum cycling effect (This effect has deprecated and should not be used). + CHROMA_STATIC, //!< Static effect. + CHROMA_WAVE, //!< Wave effect (This effect has deprecated and should not be used). + CHROMA_INVALID //!< Invalid effect. + } EFFECT_TYPE; + + // Chroma mousepad effects + //! Breathing effect type (This effect has deprecated and should not be used). + typedef struct BREATHING_EFFECT_TYPE + { + //! Breathing effects. + enum Type + { + TWO_COLORS = 1, //!< 2 colors + RANDOM_COLORS, //!< Random colors + INVALID + } Type; + COLORREF Color1; //!< First color. + COLORREF Color2; //!< Second color. + } BREATHING_EFFECT_TYPE; + + //! Custom effect type. + typedef struct CUSTOM_EFFECT_TYPE + { + RZCOLOR Color[MAX_LEDS]; //!< An array of colors for all the sides of the mousepad. First LED starts from top-right corner. + //!< LED 0-4 right side, 5-9 bottom side, 10-14 left side. + } CUSTOM_EFFECT_TYPE; + + //! Static effect type + typedef struct STATIC_EFFECT_TYPE + { + COLORREF Color; //!< Color of the effect + } STATIC_EFFECT_TYPE; + + //! Wave effect type + typedef struct WAVE_EFFECT_TYPE + { + //! Direction of the wave effect. + enum Direction + { + DIRECTION_NONE=0, //!< No direction. + DIRECTION_LEFT_TO_RIGHT, //!< Left to right. + DIRECTION_RIGHT_TO_LEFT, //!< Right to left. + DIRECTION_INVALID //!< Invalid direction. + } Direction; //!< Direction of the wave. + } WAVE_EFFECT_TYPE; + } + + //! Keypads + namespace Keypad + { + //! Maximum number of rows. + const RZSIZE MAX_ROW = 4; + + //! Maximum number of columns. + const RZSIZE MAX_COLUMN = 5; + + //! Total number of keys. + const RZSIZE MAX_KEYS = MAX_ROW * MAX_COLUMN; + + //! Chroma keypad effect types + typedef enum EFFECT_TYPE + { + CHROMA_NONE = 0, //!< No effect. + CHROMA_BREATHING, //!< Breathing effect (This effect has deprecated and should not be used). + CHROMA_CUSTOM, //!< Custom effect. + CHROMA_REACTIVE, //!< Reactive effect (This effect has deprecated and should not be used). + CHROMA_SPECTRUMCYCLING, //!< Spectrum cycling effect (This effect has deprecated and should not be used). + CHROMA_STATIC, //!< Static effect. + CHROMA_WAVE, //!< Wave effect (This effect has deprecated and should not be used). + CHROMA_INVALID //!< Invalid effect. + } EFFECT_TYPE; + + // Chroma keypad effects + //! Breathing effect type (This effect has deprecated and should not be used). + typedef struct BREATHING_EFFECT_TYPE + { + //! Breathing effects. + enum Type + { + TWO_COLORS = 1, //!< 2 colors + RANDOM_COLORS, //!< Random colors + INVALID //!< Invalid type + } Type; + COLORREF Color1; //!< First color. + COLORREF Color2; //!< Second color. + } BREATHING_EFFECT_TYPE; + + //! Custom effect type + typedef struct CUSTOM_EFFECT_TYPE + { + RZCOLOR Color[MAX_ROW][MAX_COLUMN]; //!< Custom effect. + //!< For Razer Tartarus Chroma only Color[0] is valid. Use index '0' to change the keypad color. + } CUSTOM_EFFECT_TYPE; + + //! Reactive effect type (This effect has deprecated and should not be used). + typedef struct REACTIVE_EFFECT_TYPE + { + //! Duration of the effect. + enum Duration + { + DURATION_NONE=0, //!< No duration. + DURATION_SHORT, //!< Short duration. + DURATION_MEDIUM, //!< Medium duration. + DURATION_LONG, //!< Long duration. + DURATION_INVALID //!< Invalid duration. + } Duration; //!< The time taken for the effect to fade away. + + COLORREF Color; //!< Color of the effect + } REACTIVE_EFFECT_TYPE; + + //! Static effect type + typedef struct STATIC_EFFECT_TYPE + { + RZCOLOR Color; //!< Color of the effect. + } STATIC_EFFECT_TYPE; + + //! Wave effect type (This effect has deprecated and should not be used). + typedef struct WAVE_EFFECT_TYPE + { + //! Direction of the wave effect. + enum Direction + { + DIRECTION_NONE=0, //!< No direction. + DIRECTION_LEFT_TO_RIGHT, //!< Left to right. + DIRECTION_RIGHT_TO_LEFT, //!< Right to left. + DIRECTION_INVALID //!< Invalid direction. + } Direction; //!< Direction of the wave. + } WAVE_EFFECT_TYPE; + } + + //! Chroma Link + namespace ChromaLink + { + //! Maximum number of elements/LEDs + const RZSIZE MAX_LEDS = 5; + + //! Chroma Link effect types + typedef enum EFFECT_TYPE + { + CHROMA_NONE = 0, //!< No effect. + CHROMA_CUSTOM, //!< Custom effect. + CHROMA_STATIC, //!< Static effect. + CHROMA_INVALID //!< Invalid effect. + } EFFECT_TYPE; + + //! Custom effect type + typedef struct CUSTOM_EFFECT_TYPE + { + RZCOLOR Color[MAX_LEDS]; //!< Array of colors. + } CUSTOM_EFFECT_TYPE; + + //! Static effect type + typedef struct STATIC_EFFECT_TYPE + { + RZCOLOR Color; //!< Color of the effect. + } STATIC_EFFECT_TYPE; + } +} + +#endif diff --git a/chromasdk/RzErrors.h b/chromasdk/RzErrors.h new file mode 100644 index 0000000..2308d36 --- /dev/null +++ b/chromasdk/RzErrors.h @@ -0,0 +1,46 @@ + +//! \file RzErrors.h +//! \brief Error codes for Chroma SDK. If the error is not defined here, refer to WinError.h from the Windows SDK. + +#ifndef _RZERRORS_H_ +#define _RZERRORS_H_ + +#pragma once + +// Error codes +//! Invalid +#define RZRESULT_INVALID -1L +//! Success +#define RZRESULT_SUCCESS 0L +//! Access denied +#define RZRESULT_ACCESS_DENIED 5L +//! Invalid handle +#define RZRESULT_INVALID_HANDLE 6L +//! Not supported +#define RZRESULT_NOT_SUPPORTED 50L +//! Invalid parameter. +#define RZRESULT_INVALID_PARAMETER 87L +//! The service has not been started +#define RZRESULT_SERVICE_NOT_ACTIVE 1062L +//! Cannot start more than one instance of the specified program. +#define RZRESULT_SINGLE_INSTANCE_APP 1152L +//! Device not connected +#define RZRESULT_DEVICE_NOT_CONNECTED 1167L +//! Element not found. +#define RZRESULT_NOT_FOUND 1168L +//! Request aborted. +#define RZRESULT_REQUEST_ABORTED 1235L +//! An attempt was made to perform an initialization operation when initialization has already been completed. +#define RZRESULT_ALREADY_INITIALIZED 1247L +//! Resource not available or disabled +#define RZRESULT_RESOURCE_DISABLED 4309L +//! Device not available or supported +#define RZRESULT_DEVICE_NOT_AVAILABLE 4319L +//! The group or resource is not in the correct state to perform the requested operation. +#define RZRESULT_NOT_VALID_STATE 5023L +//! No more items +#define RZRESULT_NO_MORE_ITEMS 259L +//! General failure. +#define RZRESULT_FAILED 2147500037L + +#endif diff --git a/mkxp.pro b/mkxp.pro index 9589698..b180e29 100644 --- a/mkxp.pro +++ b/mkxp.pro @@ -156,7 +156,12 @@ HEADERS += \ src/rgssad.h \ src/sdl-util.h \ src/oneshot.h \ - src/pipe.h + src/pipe.h \ + chromasdk/FrameController.h \ + chromasdk/ChromaSDKImpl.h \ + chromasdk/RzChromaSDKDefines.h \ + chromasdk/RzChromaSDKTypes.h \ + chromasdk/RzErrors.h SOURCES += \ src/main.cpp \ @@ -197,7 +202,10 @@ SOURCES += \ src/vorbissource.cpp \ src/oneshot.cpp \ src/screen.cpp \ - binding-mri/journal-binding.cpp + binding-mri/journal-binding.cpp \ + chromasdk/FrameController.cpp \ + chromasdk/ChromaSdkImpl.cpp \ + binding-mri/chroma-binding.cpp STEAM { HEADERS += src/steam.h steamshim/steamshim_child.h From aacbdb359a510608e0c79a1133007b9c84297547 Mon Sep 17 00:00:00 2001 From: tdixon Date: Thu, 12 Oct 2017 02:32:30 -0300 Subject: [PATCH 2/8] Simple chroma effect --- binding-mri/binding-mri.cpp | 2 ++ binding-mri/chroma-binding.cpp | 5 +++++ scripts/Main.rb | 1 + 3 files changed, 8 insertions(+) diff --git a/binding-mri/binding-mri.cpp b/binding-mri/binding-mri.cpp index 5883a4c..d50e7e3 100644 --- a/binding-mri/binding-mri.cpp +++ b/binding-mri/binding-mri.cpp @@ -78,6 +78,7 @@ void wallpaperBindingInit(); void nikoBindingInit(); void oneshotBindingInit(); void steamBindingInit(); +void chromaBindingInit(); RB_METHOD(mriPrint); RB_METHOD(mriP); @@ -112,6 +113,7 @@ static void mriBindingInit() nikoBindingInit(); oneshotBindingInit(); steamBindingInit(); + chromaBindingInit(); if (rgssVer >= 3) { diff --git a/binding-mri/chroma-binding.cpp b/binding-mri/chroma-binding.cpp index ee06a30..e7e4863 100644 --- a/binding-mri/chroma-binding.cpp +++ b/binding-mri/chroma-binding.cpp @@ -9,19 +9,23 @@ bool INIT_SUCCESS = false; CChromaSDKImpl* chromaImpl = NULL; void _attemptLinkSdk() { + Debug() << "Attempting to bind Chroma SDK"; #if !defined(_WIN32) && !defined(_WIN64) // currently razr chroma is windows-only. // so, if we are not building for windows platform // then don't bother with chroma stuff + Debug() << "Chroma: Unsupported Platform"; return; #endif chromaImpl = new CChromaSDKImpl(); + Debug() << "Chroma Impl @" << chromaImpl; chromaImpl->Initialize(); INIT_SUCCESS = true; } RB_METHOD(chromaSetBase) { + Debug() << "Chroma: Attempting to set base colour"; RB_UNUSED_PARAM; if (INIT_SUCCESS) { ChromaSDK::Keyboard::CUSTOM_EFFECT_TYPE effect = {}; @@ -34,6 +38,7 @@ RB_METHOD(chromaSetBase) { ChromaSDK::Keyboard::CHROMA_CUSTOM, &effect, NULL); + Debug() << "Chroma: Set base colour effect"; } return Qnil; } diff --git a/scripts/Main.rb b/scripts/Main.rb index 8555851..8adc036 100644 --- a/scripts/Main.rb +++ b/scripts/Main.rb @@ -16,6 +16,7 @@ begin # Load persistent data Persistent.load + Chroma.setBase # Prepare for transition Graphics.freeze From 12581656858e1b057d78c463246d0860e16e4a36 Mon Sep 17 00:00:00 2001 From: tdixon Date: Thu, 12 Oct 2017 02:53:32 -0300 Subject: [PATCH 3/8] Add pot version to settings screen --- scripts/Window_Settings.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/Window_Settings.rb b/scripts/Window_Settings.rb index b417568..5023b1f 100644 --- a/scripts/Window_Settings.rb +++ b/scripts/Window_Settings.rb @@ -77,7 +77,12 @@ class Window_Settings @title.bitmap.font.size = 40 @title.y = TITLE_TOP_MARGIN @title.x = MARGIN + @version = Sprite.new(@viewport) + @version.bitmap = Bitmap.new(60, 20) + @version.x = 10 + @version.y = 450 Language.register_text_sprite(self.class.name + "_title", @title) + Language.register_text_sprite(self.class.name + "_ver", @version) @data_sprites = [] @viewport.z = 9998 @@ -96,6 +101,7 @@ class Window_Settings def dispose @bg.dispose @title.dispose + @version.dispose @data_sprites.each do |spr| spr.dispose end @@ -128,6 +134,10 @@ class Window_Settings @title.bitmap.clear @title.bitmap.draw_text(0, 0, @title.bitmap.width, @title.bitmap.height, tr("Settings")) + # Create version string + @version.bitmap.clear + @version.bitmap.draw_text(0, 0, @version.bitmap.width, @version.bitmap.height, tr("POT_VERSION")) + # Create menu options @data.each_with_index do |item, i| spr = Sprite.new(@viewport) @@ -199,6 +209,8 @@ class Window_Settings def redraw_all_settings @title.bitmap.clear @title.bitmap.draw_text(0, 0, @title.bitmap.width, @title.bitmap.height, tr("Settings")) + @version.bitmap.clear + @version.bitmap.draw_text(0, 0, @version.bitmap.width, @version.bitmap.height, tr("POT_VERSION")) for i in 0..7 redraw_setting_index(i) end @@ -418,6 +430,7 @@ class Window_Settings def opacity=(val) @bg.opacity = val @title.opacity = val + @version.opacity = val end def opacity @bg.opacity From 54a35e7740b345720df7daefe2eec597b14f6ea9 Mon Sep 17 00:00:00 2001 From: mshirt Date: Thu, 12 Oct 2017 23:10:55 -0700 Subject: [PATCH 4/8] Made version string less ugly It shouldn't be at full opacity --- scripts/Window_Settings.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/Window_Settings.rb b/scripts/Window_Settings.rb index 5023b1f..51c6940 100644 --- a/scripts/Window_Settings.rb +++ b/scripts/Window_Settings.rb @@ -81,6 +81,7 @@ class Window_Settings @version.bitmap = Bitmap.new(60, 20) @version.x = 10 @version.y = 450 + @version.opacity = 128 Language.register_text_sprite(self.class.name + "_title", @title) Language.register_text_sprite(self.class.name + "_ver", @version) @data_sprites = [] @@ -218,6 +219,9 @@ class Window_Settings def update + + @version.opacity = 128 + if @fade_in self.opacity += 20 active_spr = nil @@ -232,6 +236,7 @@ class Window_Settings elsif self.opacity == 255 @fade_in = false end + @version.opacity = 128 return end From 0c9665ae4d09b6151d2ac6c7ee7d0dd40edc5a2b Mon Sep 17 00:00:00 2001 From: mshirt Date: Fri, 29 Dec 2017 15:15:01 -0800 Subject: [PATCH 5/8] bugfix rare bug where closing the game when spawning a footprint or footsplash would crash the game, both on exiting and then reloading. --- scripts/Scene_Map.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/Scene_Map.rb b/scripts/Scene_Map.rb index aaf4078..99dbf76 100644 --- a/scripts/Scene_Map.rb +++ b/scripts/Scene_Map.rb @@ -502,16 +502,24 @@ class Scene_Map # * Misc operations #-------------------------------------------------------------------------- def new_footprint(direction, x, y) - @spriteset.new_footprint(direction, x, y) + if @spriteset != nil + @spriteset.new_footprint(direction, x, y) + end end def new_footsplash(direction, x, y) - @spriteset.new_footsplash(direction, x, y) + if @spriteset != nil + @spriteset.new_footsplash(direction, x, y) + end end def new_maptext(text, x, y) - @spriteset.new_maptext(text, x, y) + if @spriteset != nil + @spriteset.new_maptext(text, x, y) + end end def fix_footsplashes(xDelt, yDelt) - @spriteset.fix_footsplashes(xDelt, yDelt) + if @spriteset != nil + @spriteset.fix_footsplashes(xDelt, yDelt) + end end def menu_open? @menu.visible || @item_menu.visible From 44dd5d6d9c9e1a736c52edf51a13244bb7e34d70 Mon Sep 17 00:00:00 2001 From: mshirt Date: Fri, 29 Dec 2017 15:15:13 -0800 Subject: [PATCH 6/8] changes to the safe text in korean --- scripts/Puzzle_Safe.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/Puzzle_Safe.rb b/scripts/Puzzle_Safe.rb index d6a9e84..f2d38d2 100644 --- a/scripts/Puzzle_Safe.rb +++ b/scripts/Puzzle_Safe.rb @@ -78,19 +78,19 @@ DOCUMENT_TEXT_JA = \ DOCUMENT_POSTGAME_TEXT_JA = "必要なコードは次の通りだ: " DOCUMENT_TEXT_KO = \ -"안녕하십̴̵̢͟҉니̵́̕͢͞까̡́͡ ̷̡̠͇̼͉̻̦͓́͜͡ ̶̤̦̯͖͚͓̮͓̣̤̰͇́̕ ̴͜͏͈̭̦͙̦̯̟̗̜̼̠̦͘ ̶̶̡̢̲̱̜̹̰̻̘̪̳̫͕̙̕ ̡҉͎̦̙̰̻͉̜̝̺͚̻͇̞̺̦͓́ ̨̘̤̜̞͍̩̠̱̦̫͔̹̩͍͇̜͈́̕͞ͅͅ ̴̴̧̣͍̘̰̗̮̜̰̲̣̙̲̝͚̩̦̭̀͡ ̧̗͚̱͓̥̖͍͕̀ ̫̪͇̗̲̭̤͖̫̣͇͔͘ ͕͚͎̦͓̺̤̳̙̝͟ͅ ̸͉̫̘̩͙͖̼̣̞̞̰̼̞͕̀ ̶̗͓͎͓̦̙̭̳̻̫̥̯̱͚̦͔͍͙͟ ̶͜҉͏̞̺̙̥̦̪͇̯̳͍̬̱̰̘̺̠̀ ̴̼̘͇͎͙̘̜̀̀͞ ̴̢̹̥͚͎́̀\n\n\n"\ +"안̛ͥ̍ͅ녕̣͖̣̱͍̗하̖̲̀십̤̥̱͂̆̊ͩͫ니̱͇͔̣̱͘까̷̑͂̉̈́̽,̵̜̩̮̤̣̣ ̷̡̠͇̼͉̻̦͓́͜͡ ̶̤̦̯͖͚͓̮͓̣̤̰͇́̕ ̴͜͏͈̭̦͙̦̯̟̗̜̼̠̦͘ ̶̶̡̢̲̱̜̹̰̻̘̪̳̫͕̙̕ ̡҉͎̦̙̰̻͉̜̝̺͚̻͇̞̺̦͓́ ̨̘̤̜̞͍̩̠̱̦̫͔̹̩͍͇̜͈́̕͞ͅͅ ̴̴̧̣͍̘̰̗̮̜̰̲̣̙̲̝͚̩̦̭̀͡ ̧̗͚̱͓̥̖͍͕̀ ̫̪͇̗̲̭̤͖̫̣͇͔͘ ͕͚͎̦͓̺̤̳̙̝͟ͅ ̸͉̫̘̩͙͖̼̣̞̞̰̼̞͕̀ ̶̗͓͎͓̦̙̭̳̻̫̥̯̱͚̦͔͍͙͟ ̶͜҉͏̞̺̙̥̦̪͇̯̳͍̬̱̰̘̺̠̀ ̴̼̘͇͎͙̘̜̀̀͞ ̴̢̹̥͚͎́̀\n\n\n"\ \ \ -"처̷̨̀́͞음̸̵̵̧҉h̡͜͠҉ ̷̛i̵̶̷͝ ̵̀͢͢s͜ ͟͏̷̵̡ ̨͟͡ ͏ ̷i҉̷̧̀ ̴̡̕s͠ ͟҉̞̭̼̞̯̰͈̘̟̣̜̰͖͙̼͙̙ ̨̳͚͍̤̦̪͔̲̬̻̯͍͉̥̦̱́ͅ ̫̪͇̗̲̭̤͖̫̣͇͔͘ ͕͚͎̦͓̺̤̳̙̝͟ͅ ̸͉̫̘̩͙͖̼̣̞̞̰̼̞͕̀T ̶̗͓͎͓̦̙̭̳̻̫̥̯̱͚̦͔͍͙͟ ̶͜҉͏̞̺̙̥̦̪͇̯̳͍̬̱̰̘̺̠̀ ̴̼̘͇͎͙̘̜̀̀͞ ̴̢̹̥͚͎̮͍̥̲̟͓̹̞̤̠͉̳̝̫́̀ͅ ̛̫͎̤̥̰̩̹̬͞ ͟҉̞̭̼̞̯̰͈̘̟̣̜̰͖͙̼͙̙A ̨̳͚͍̤̦̪͔̲̬̻̯͍͉̥́ͅu̦̱ ̵̸̹̼̞͚̹̟̺͎̜̖̦͠ ̴̢̳͔̻͕̮͇̱̀͡ͅͅ ̘̟̺̫̪̺͙̦̳̻͙̣̳́́͝͝ ̤͍͍̭͙̦̤͖͕̯͍̜́͜ͅr ̷̶̥̠͍͚͜͞.̴͜/͞m̵̧.̧̨̧́͘.̶͘͝͡-̡̢͟-̷̧͠͝͝-̴̨͜͢y͡҉̧/̀͏͏͘.͜͞.҉̡̀͢-̡̧̕͜-̸͘͜f̷̧͘͜.̨́͜.͞͞.̴̶͞ 간̨҉̶̡҉략̢̧하̸̷̡͠게҉̛͢͞ 써야 한다는 걱정이 앞서는군요.\n"\ -"당신께 일지를 남겨두었습니다. 일̷̡̕͠지͢͜의҉̀͘͠ y̴̴͝/͟͝͝/̧͝͡-҉̵̸͡-͏͡o͏͜͝/̶̡̡/͡/͏̵̵̵̀/͏́́ų̨̕͘ ͟҉̴ ̧͠͏͝ ͘̕͟͠͞w̛͘͟͡͠/̵̢͠/̷́͞͞/҉̸̛̀͡ļ̴̕͢͡l̢̛̕͘͜ ̵̀͝͠n͝o̵͢͠=̵̷̨̡͡.̷̴̷̡̡.̷̵͘͟t̶̶̸̡ ̷́͜u͏̴́/̀/̵̧͢͞͡ǹd̀͟͠è͢҉̢̢-͠҉-̧҉̢-̶̧-̷̶͘s̵̶̷̢͠t̡̛a̧ ̶̴̧͝ ̷̸̡ ̸́͞ ͢ ̶̸̡̛͞n̢͠d̸̵ ҉̢͠͠a̴͡͠t̛͏̀͟͠ ̨̢͢͝f̷̵/̵̢̡̢/̧̢҉̵/̨͟͝r͏-̕͟͟͠=̢̕͘͟s̵͟͏t͞͞͡\n"\ -"H҉.̧̕.̸̵.̸̨̛̕͠-͘͜/̵͏҉/̸͘̕w̴͏͟e̷̢͜v̵͟͜͟(̢̕҉͟ę̸̀͜͞r̶̷͠͠҉ ̵̡͡ ̵̕͡͠ ҉̷ ̴̵̛͢,̧́҉ ͘͠͞ ͞͠ǫ̷̵̛̀n҉̡͡/̶̢/̵̸҉/̴̸̢́/̡͞/̀͘̕͢/̨͟c̵̷ ̨̛͘͡͞ ̨͏̛ ̷̶̡̧͜ ̵̨̀͜e̸̢͢͟ ̴͝y҉̸̛́/̵̵̶̨/̢͘/̴͟/͡=͢͏=̡͘=̷̢=҉̴̢/̸̧̧͞/̛̕/̶̨́͠/̶̨̧̕͜.̵.̴͝.̷̶͡u̧͝ ͘͘͜҉.̢̨̕͝͏ ̸̶̵̶̢ ̶̡ ̧̀c̀͢͞͞.͡.̴̶́͟͠.͞͏͘.̨̧͘͞.̴҉͞.̶ą̶͟͞n̕ 읽́͟어͢͡҉보̕͢͞͞시̧̕͢면̷̡͠ 무엇을 해야 할지 알게 될 것입니다.\n"\ -"그리고 마̴̴̨̡스̧͘̕̕͝크̡͝͠͝도͏̶̡̡́ ̶̷͘͟͞두҉̴͘었͞͠҉͠습̧̧̨̕͢니̸̧̀͢다̨͘͟,̵̷ b̷̢͘͞ ̛̀͘͢͝c̡͜҉ ̀͟͠ ̶̡͘͜ ͞҉͜͏ ̷͜͏ ̡́́͠ ̢ ̀͏ ̕͜ ̵̷͘ ̶̴̴̵ę̷̷͜ ̴̸҉̀Í͡ ̸͘͞ ̨͢͜͡͡ ́͢͏͢ ̢̡́́͞ ̷̶̸̀͝ ̸͠ ̶̷̧̀̀ ̵̵̵̢́ ̷̵̛͡ ̕͝ ̷̕͠҉̡ ̸k͟͞͝ǹ͠͏͡ ̶̸̶͢͠ ̨͟͞͡ ҉̶ ͟͏̸ ̢̕ ̴͡͠ ̴̕͡҉͢ ̴͟͟ ̶͞͠w҉͝ ̢̨͟ ̵̕ ̧̢͜͢ ̴̀̕͞ ̀͟͟͠ ̛͢͏ ̡̧̀̀ ̨̢͘ ̕͜y̢̨̛͘͟ǫ͡u҉͢͟͏͟ ̷̛̀ ̴̕͞ ̢͡ẃ̴̡͡͝ ͘͜͝͏ ̧̀͜͡ ̶͢ ̵̶̸̨ ̵ļ́͡͡҉ ̶̧ ̸͡͠͠ ̷͏̸̵͟ ̸̴̀̕͝ ̸͏̧̀͝ ́͢͠ ͏̧̡͟͝ ̡̕͢͟n̕̕̕ ̷̴͟͝͏ ̡̡͝ ́́ ͏͝͏͟ ͜͡͏̴̛e̷̸͏d̸̡͜ ̷́͜͝i̵̶̢̢̧t̴́.͜͢\n\n"\ +"처̡̜͕̺̘̳ͫ͗̃ͩ͂̿͊ͫ͒ͣ̂̽̔̌͐͢͝음̧͎̼͎͖̻͈̇̂ͪ͑́ͥ̉͛̓̔ͨͩ͋ͤ̿̏͊̈́͑͢으̷̧͑̆̔̍̍̆̾̂̊̕͏̩̟̰̠̺̪̪͍̲̰ͅ로̙̟͉͎̒̊͊͋ͮ͝ ̪̙̹͉̿̽̓̏ͫ͐̈́͊̋͌̿͗̃̈͌̐͐͢͠메̶̯̳͉̱̮͇̻̮̩̩̥̦̼̥̹̪̻͓͓̽ͫ͊ͦ̅ͩ̈́ͤ́͘시͎͔͓̻̜̼͆̂̾ͤͣͣ̀지̸̷̣̬̹̫͖̭͓̙̻̜͉̞̗̙͎͕̓̃̉̓ͅ를ͩ͌ͧ̏ͬ͏̷͍̝̭͙̳̟̱͔̣̟̼̹͇̬̕ ̡̭̩̤͉̲̪̟̫̙̈͊͑ͬ̅̓́̑ͩ͌͊̔͆ͭͦͨ̚͢͟보̫̝̥͎̩͉͖͖̥͈̩̞͉̤̗͍͔̔ͪͦ́̄̅͌̀͐ͩ͆͂ͪͫͣ̅̀́̚͝냅̷̷̺̳̟̙̺̖̹̰́̅ͧ́ͩͯͮͫͬͬ̏̃̀͞니̆ͥ̏̍͒͆ͧ̔̂ͧ̍̒̀ͬͭ̚͘͢͏̞̺̲͙̘͢ͅ다̔̇́̆ͥͤ̂͊̿̃͊̇͏̧͇̲̟̟̳̳͕͢.̈́̅̓͏̶̢̧͈̮͎̩͔̩̞͈̥̳̜͞ ͬ̾̌͑̂͌̚͏̴̴̣̤͎̭͖̻͓̝̯͘간̗̩͕̤̹̮̱̗͙͇̋ͮ̌ͣ͘͞ͅ략̢̬̭̮̮̳̤̜̩̰̻͈̺̣͓̩̥̤̖̻̅ͩ̒ͦ̈́̄͊ͥ͟͡͝͠하̋̆̿̊ͦ̊͒ͩ̏ͥͭ̑ͪ͋̌ͥ̋̆͛҉̜͙̗̫͜게̴̙̯̺̤̗͚̪͚̯̙̱͍̃̐͋̈́̍̀̚͘͝ ̸̸̘̤̘̥͍̮̝͉͉̬̳̭͍͕̥̣̄̐ͨ͗̾̓ͪ̎̓͆͆̚͜͢͠써͆̆̏̌̈͌̅ͫ̇́͝҉̹̦͎̻̜̖͘͠야̷̴̢̡̰̱̦͎͈̯͙͈͕ͫ͊̍ͮͨͧ̍̇̚ ̸̱͉̦̲͙̘̰̹̙̌́́̔̉ͪͯ̌͒̂̈̆ͣ̕͘한̗̟̩̟̹͎̳͙̗̣̻̱̦͈̹̙̟̣̆̇͐ͣ̉͆̾͌̋ͭ͐̂͟͝다̡̞̭̱̠̺͙̤̞̰͋̉̓ͥ̀는̴̥̥͔̠̳͇̗̬̩̱̹̩̥͓ͨ̂̿͒͂ͬ̈́͗͌̈̈͌̕͘͟͞ͅͅ ̸̷̧͉̮̻̳̪̮͕̩͉̲̳̘̔̿̿̂͗̅̿̓͛̾̐̈́̀̚걱̠͖̞̙̺̺͈̠̞̬͔̥̪͕͓̳͈̪̎̊̅͆̃̓ͣ̒͊͟͞정̶̭̘̭͔̱̜̥͍̝̺̱̖̹̥͛̂̇ͫͣ́̚͜͜이̆̀̅ͩ̿̎̉̎͗ͧ͌͋̓͆͘͝҉̮̼̝̺̤͎͓̳̙̪̪̲̪̮̝̮͔̹ ̶͖̠̞̣͉͎̤̦̠̹̘͔̮̤̎ͫ̏ͩͩ̔́ͩ̈́͌̍̀ͫ͢͜앞̨̢̾̑ͮ͑ͩ̽̍ͥͮ̀͗͗̽̇́͂ͪ̌҉̜͙̥͇͍͎́ͅ서̷̸̢̮͉͍̘̱̪̠̤͚̰͚̜̝̫̬̩͉ͯ̓͒́는̢̗͖̮̭̰̹̮̟͍̪͚͓̝̟̣̊̃̈́̀̂ͩ̊̋ͩ̑ͬ̔͑̈́ͣ͒̚͜군̸̴̪̱̞̘̠̭͕̖̠̹͌̈́̏̒͆ͣͩͯ͗̈́͘͜͟요̍̾̽̒̑ͦ̑̾̄ͤ̋ͤ̑̒͗͋̓̏ͭ̕͏̲͔̥̪͙͍̲̞͚̺͍̺̞͉̥͟͡.̶̵̷̗̭͙͇̳̌͛͌ͩ͑̍͆́̽́ͭ̈ͬ͝\n"\ +"당̇ͭ̐͂ͬ̿̎͒̽͋͐̋ͧ͗̈́҉͟͢҉̼͍̘͔̠̬͔̞̲̠̝̠͇̖̬̗̞̺̖͞신̴̹̭͈̤̥͚͉̙̺͎͈̦̣̭̫̣͖̓́̔̉͘͞께̷̛̙̞͓̰͔͉̤̻̼̭̳̭̟̤̭̙͚̖̱̊̑͗̾͟͠ ̷̵̴̱̻̗͕̖̺͈̫͇̬͎̤̹̦͔͓̗̾ͪͨ̅̄̊́͞일̸͕̱̖̺̹̬̜̱̗̗͎̬̬̗̳͈̎̈͛͊̍̊̔̆̾̅ͣͬ̊̅͌ͮ͢͞지̡̊̂̌̈ͥ̍̕͜͡͏̼͙͓를̶̨̼̗̰̮̤̰͇̜̫̦̣̦̟̘̭͓̫̝͊̀͑́̄̿ͣ̊̀͋ͪ̓ͧ̈́̉͒͢ ̧̻̗͐̌̓̃͂̊̐͊ͩ̈̕͘ͅ남̴̛͚͍̝̩̤͇͈̞̙͕̮͈̲͎͙͙̊ͤ̅ͪ͌ͪ겨̷̶̧̛̞̼͚̯̥͔̟̲͇͕̠̹̦̺̺̏ͮ̾̄̃̑ͨͦ͑̽͠ ̸̢̛͎̯̝̭̗̋̅ͩ̓̌̅͐̓̍ͩ̓͢͠ͅͅ두̷̴̛̛̩͉̜̱̝̖̄̆͑̓̽̆͐̔̅͒̏̐̍ͮ̐̓͗̚̚었͔̱̠̳͖͓͕͓̮͇̘ͯ͌́ͥ̀͘͞습̸̵̧̤̳̣͖̝̮̱͖̝̹͈̟̟̻̩̭̞͔̥ͦͧ͑́́ͩ̓͐ͦͩ̉͡니̸̧̼̺̜̙̝̹͎̩̗̬̽͌̈́ͪͮ̌̀̓̓̒ͅ다̵̹̻͓͈̹̪̝͈͈̳͉̳̗̝͐̿̐͊̇̾͆͋̂̐ͩ̓̽̀͘ͅ.̵̜̝̫̝̗̱͚̱̳͎̜̬̖͎̭͚̪̝̻̆ͪͫ͊̓̈́ͪ̑̾ͯ̈́̉̀̇̿̀̚ ̙̘̠̖̮͓̫̳͇̳̩̙̭̻͈̏̄ͤ̔͛ͣ͊̒̊̈́͆ͪ̓̄̋͛͠일̬̗̟̫̤̭͈̝̺͎͙̯ͣ͒̏ͭͭͩ̋́̕͞ͅ지̛̮̠͈̠̜͙͌̅̽͑͒́́́͑̃ͣ̾͒̔의̷͔̯̣̪͈̣̤̙̫̤̠̜̠̞̘͍͐̏ͨ̃̽̑͆͆̾̎ͣ̏̆̚̚͢ͅ ͯ̊ͯ̌ͣͭ̿͌̚͏̢̙̭͚̪̹̩͚̫͓͉͔일̃ͧ̾̐̅̓ͣͧ̍̓ͮͦ̊͒̋҉͏҉̢̘͕̹̹̱̼̜̥̬ͅ부ͫ̓̌ͧ̇̽́̉͒ͦ̌̀͏̨̭͚̥̭͇͍̫͔̘는̎͑͊́̌ͥ̈̚҉͓̫̭̳̞́͢͡ ͌̒ͪ̑ͩ͐ͫ̄͒̚͏̸̨̲̹͇͎̫̳̙̦̠̦̗̀당̡̖̰͓͚̥̘͉͉͎̬̞̩̮̣̫͔̌̓̍̂͒ͨ͗̎̈́̈̂̿ͤͥ͢͜͝ͅͅ신̷̔͊̑̉̏̅ͪ̓͐͌͏̯̜̟̜̖이̇̏̏͗̿ͬͨ̃̋̔̀̀̚͢͏̴̣͙̬͇̗̯̹͙̺̯̝͉̼̲̟̜ ̧̄̉̂̄ͥͩ̐̎͐̋̈̽ͩ͐̔̆͞͏͙͇̞̻̠̝͔̩͎̖̖̱읽̧̈́̓͑̊̐͒̑͑̕͏̗̹͎̠̰͍͉̲̻̪̹̩͢͡을̸̲͕̦̼͙͓̝̟̪̲͍͎̮̘͙ͩ͐̿ͦ͌̅ͧͨͭ͂̚͢͢ ̶̘̦͈͚͈̤̖̮̺̳̜̰̲̪̭̼̞̹̯ͬ̒͛̐̐̿ͣ̀ͦ̓͌ͭͬ̄̂̍ͦ̓̀͘͟͠수̵̢̢̘̱̖͙͑̋̊̏́͢ ̴̵̸̵̤͍̳͇̝̣͙̻̠̳̜̱̥ͩͯ̂̑̂̿̋ͥ͆͐̕ͅ없̬̩̩̻͖̪̈͆ͯ̄̉ͧͨ͊͒̚͘͘͡͞는̷̧̢̖̺̻̠̞̭͉̥̹̩̥̞̦̝̯ͭ̽̄̉̾͐̀ͦ͊͑̎̂̑͢ ̵̧̞̟̬͔̝̺͔͙̝̖̖̲̩̂͛ͩ̎̈ͧͥ̿̆͗̅̿̍̀̚ͅͅ언ͤͦ̓̅̋ͨ̋ͩ̉̅̔̅̏҉̦̘̜̼̻̲̠͓͎̩어̢̼̞͍̝̬̭̫̇ͫ̃ͭ̚͘͝͠ͅ로̴̨̢͖̫̺̠̲̱̐ͬ͒̔̿ͫ̍͒͛̉̒̎̃ͥ̄͑̆̓͜ͅ ̴̨͇̘̮͎̩̠͖͚̗̖̾̌̄ͫ̃ͩ͂ͪ͂̆̊ͭͣ͟작ͭ̓̓̌̒͏̨͇̭̻̮̪͔̙̼̗̮̣͉̘͙͕̭̳͟ͅ성͔͔̼͎̘ͯ̋́͗͛̆̎̿̿̋͆̏̃ͮͮ̐̏̚͢͝되̶̴͎̣̱̤͍̙͍̻̼̥̫̗̼͑̂̐͡ͅ어̴̜͖͇̮̻̞̫̪͈͍ͭ̆ͬͨ̎̍͌ͥ́͘ ́̔ͩ̂͆͑ͯͨ̆͆ͬ̕͏̢͇̦͉̗͇̜͎͉͈있͗ͫ̏ͤͥ́҉҉̧͝҉̗͇͎͖͍̗습̸ͩ̀̈́ͪ̓͋̂ͨͫ҉̧҉̪̞ͅ니̷̧̰̩͍̳̥̹͉̣̣̟̘̘͍̾ͭͣ̌̋͘다͋ͭ̎̿ͬ̑̓̽ͫ҉̷̨̧͎̤̪̼͈͙̱̮.ͬͣͥ̇ͪͧ̋ͭ͜͏̴̩͔̱͇͔̲̪̥\n"\ +"̵̸̛͖͉͈͍̦̟̜͚̤̞̦̭̺̞̹̫̥̮͋̓ͭ̏̇̏͆͑̽̓͋̆̏͊́하̵̶̶̢̿ͤͣ̀̒͋ͣ͐ͩ͗͏̣̺͍͔͎̻̻̫̪지̶͖̼͔͙̮̘͚̩͈̙̲̮̖̦̲͇̬ͯ̿̍̀̚͢만̨ͦ͑͊̓͋̒̇̎̒̎̋҉̡̜͚̳͕͚̱̲̞̥͎̥̝̖͞͞ ̍͋͐̔͌ͨ̏ͤ͌͋ͦͣͮ̿͏̡͇͖̻̺̙̰̳̘̮̗̲̦͔͈̰̖̖진̥̲̱͎̘̦ͭ͐̓̉ͤͦ̐ͧ̾̃̂̾̓̆ͥͩͥ̑̀̀̚͝ͅ행͆̎͑͏̛͍̗͇̟̮̝̗을̢̖͕̙͉̙͉͉̼̫̫̩̫̑͌ͤ͛̉̀ ̶̙͕͉̥͙͕̙̳̖̖̠͉͕̝̬̭͋̓ͨ̏ͯ̿͢͠͡위̴̙̞̯͕̮̱͈̣̤̫̭̪̏ͧ͌͂̉͘해̢͊̔̔̚͏̡̢̥̜̲͖͔̫͎͓̲͕̥̱͝ ͨͮ̌͆͊͒͒̉ͤ̈ͩ͆̀́͢͏̰̟̭̳̠̦͚̯̱̫̰̭͎̳̙̗̜̖̗일̴̸̡͈͇̦̺̲͔̼́ͪͯͫ̆͐͗ͅ지̸̫̤̪͇͖͍̦̣̰̺̲̊ͨ͛ͭ̆͛ͧͦ̄̄̍를̧̢̭͓̞͖̖̝͓̞͎̖͎̮͖̦ͮͪ̈̊̆̋̾̂ͮ̍̄͗͑ͣͣ́͘͘ ̵́̀ͬ͌ͫ̃̔̃ͮ̃̑͛ͤ͜҉̞̠̙̹͖̱̻͔͎̠̯͇͔͟번̴̹̬͕̫̘ͨ͐͐ͮ͐ͥͫ͢͟역̵̨̪̠͔̰͎̘̝͒̆ͥ̀ͯ̄ͩͪ̚할̵̢̢͍̹̺͓̩͔̰̣̣͕̙̊ͩͥ̇͆̆ͯͫͦͫͯ̑ͬͫ͆̉̾͟ ̧͙̖͈̪͎̖̥̀ͧ̈́ͫ̽͆̅ͣ̒͆̈ͧ̾ͨ̾̌͋͑͜기̳̳̟̣̟̟̼͚ͪͬͪ̄͜͢ͅ회̴̶͖͍̥͚͉̰̘̝͉̠̺ͫͦ̀̐ͣͩͨͫ͒ͧ̅̇ͯ͒͊̚͜͞ͅͅͅ가͐ͧ͊̉̊҉͕̱͍̠̹͍̠̟̱́ ̵̧̣͈̣̞̩̖̯̓̀ͩͪ̃̔ͧ̄ͭͬͣ̓͂올̨̨̹̪̬̤̗̜̼̜ͩ̆̓ͨ̉̃̐̌ͫ͆̒̕ ̔ͥ͊̿̃̓̊̌͐̂ͧ͒ͧͫͣͪ͟҉̘͚̼̻̤̱̣̳͢ͅ것͋̈̽̔̐̓̐̌̿̾̽̅ͮ̓̑͆͑͋͏̙̪̼̝̼̟̘͓͕͚͚̟͎ͅ입ͩ͂̒̈́̈̉͂̾҉̧͔̪̰̠̹́니̷̡̜͉̝̼̱̤̤̽ͪ̍ͩ̊ͩ̀ͨ̀́͢다̷̷̧̺̩͈̮̤͇̼̿̾͐̾͘.̸̈͋͋ͥ̐͒҉̻̳͖͎̱̱̠̳̫̹̹ͅ.̧̧̝̥̹̫̭͚͓̤̻͖͈̻̲̔̑̍͋̈́͌̌̒̃̔̇͑.͗ͩ̀̆ͫ͑́̉ͧͣ͏̛̫̠͎̭̖͠͞ ̵̨̘̙̠̹̗̫̠͍͇͔̙̝̬̗̜ͭ̿̏̊͑͐̓͛̍̾̇읽̨͉̞̥̬͎͈͈̼̦̼̯̬͍ͩͩ̾̑̓̾͛̀ͨͬͫ́̚͠͡어̡̰̪̹̲̒͐̄̋͡͡ͅ ̨̡͇̰̼͍̪͚͈̗̪͉̩̳̝̹ͯ̊̈ͭͫ̏̿͆̃̃̀̕͜보̹̘̠̣̙̘̠̘̫͉̈́̍̀̓̾̊̓ͫ͗ͭ̄̉̀ͭ́ͫͣ̒̀̚͠͞͡시̡̬͖̣͚͔̭̝ͮ̉̓̋̉ͦͥ̍ͧͫ͊̓̅͌̃͘면̿̂ͥ͒͌̑̌ͤͥͮ̑̾̚҉̷̢̛͙͎͕̯̮̮̻͖̝̻͠ ̸̮̲̯̯̫̳̙͚͔̩̺̤͍̭̟̜͈̟̯ͭͪ̆̄ͭ͌̚무̶̬̻̻̘̳͈͈̦̩͙̗͉̹̦͇̂̍̈̽̈̆̓̅̅̊͛ͨ̒͛̔ͪ̾̀̀͜엇̸̨͙̮̣̫͎̳̤̮͍̼̰̜͓̲ͥ̇̊̉ͧ̾ͯ̏͌̂ͪ͘을̴̬̘̲͇̯͓̉͒̈́̅̈́̇͌̈́̊̏ͨ͗͆̊ͧ̄̈͘͟͝ ̻̹̜̻̼̬̪͎ͥ̿͐̈ͨ̄̿́̓̒̍̍ͩ̍̋ͩ̈́́̚͝해̟͇̩͔̟̜͉̹͕̭̰̭̠̾͆͂ͮͭ͛̑ͯ͑̈́ͫͮ͆ͮ̄̔ͬ͟͜͝ͅ야̡̽̈́̂ͬͧͩ̾͛͂̌ͭ̍̿ͪ̽̃̐̚͏̸҉̩̰̥͓̗ ͭ͑̒̋ͭ̍̈͗̿ͫ͂͂̊͗ͤ́̚҉̶̸̴̺̝̠̘̼̺͎͇͕̗̟͎ͅ할̸̧̦͓̦̮̯̟̘͈̲̺̟̲͎̬̙̟̗̾̒ͥ͒͐ͬ̑̄̂ͧ̾ͬ͊̑̓̚͜͡ͅ지̵̸̡̧̩̯͇͉̥̮̺͔̤̘̪̥̜̬͚̞͔̳̾̇̓͛ͮ͘ ̴̨̨̛̦̟̰̞͙̥͉͕̳̮̞ͯ̃ͯ͋ͯͧͬͨ̽͂̔̾̕알̶̨̺͕̱͎͖͂ͯ̍̾͜게̷̨͕̙̦͈͈̼͕̺͉͍͕͑̓̆̒͒̇̈͆͋̅̌ͯ̿͗̃ ̵̵̸̤͍̟̳̯̫͙̞͕ͨͭ͊̍̓͗̉̆̿̊͆̓̎ͯ̓̋ͥ̀ͅ될̵̺̙̫̩͔́͌͌̅̊̅͌͂̆̐ͯͣ̓̚̕ ̧̞̗͔̬̱̭̓ͫ̾̃̐̀̀́͡͠것̍͆̽ͤͭ͛ͮͯ̽̄̊̚͏̷̢̪̳͖͕̼̯̰̮̜̥̯̤̤̙̟̹͙̭̀͞입̷̷̖̠̹̻̥͈ͩͩ̔̄̋ͨ̏̍͊̇̋̅̾ͬ̈̑̑ͤ̅̀͘ͅͅ니̋͒̂̈̽͌ͭ̾͂ͥ͑͑͞҉̢̧̭͖͔̩̦̟̦͙̳̩ͅ다̷́ͯͫͥ͊̑ͣ̒ͧͭ͛̏͛̀̃ͪ̇͏̮̬̲̣̦̀͝ͅ.̵̸̪̪̘̰̫̬̙ͧ̆̓́̚̕\n"\ +"̢͈̗̬̳̠̩̳̃ͩ̈̽̐ͫ̈́͊ͧ͗̓̈́̿̒̚͟͡͡마̴̙̪̦̩̫̹͉̯̤̗̅ͣ͗͋̅̍̊̿ͭͥͣ̃ͯ̓̔̉ͥ̌ͫ͠스̴̡̛͉̻̖̹̺̭͚̓̌͒̍ͦͩͤ͛̾͂͋̾͒ͦ̚크̧̨̯͇̼̙̹̂̇ͧ͐̂̂̃̊ͬ̀̍̍͊̈̓ͬ도̸̨̛̱̭̠̙̱̩̯̯͕̯͉̝͇͈̯̭̈́̾ͮ͊͗̌ͧ͒͂ͦ̊͛́̚͝ ̨͈͈̳̰̹͋ͯ͆̌̓̑͛̚̕준̷̡̧̤̘͎͕̲̺̭̰̣̏ͦ̈́ͥ̚͢͝ͅ비̃̉̊̔ͭͬ̃͑̈́ͦ̂̅͛̏͒ͤ͌͜҉͜҉̟̤͔̬͈̰͙̰̭̦̭해̢͚̟̹͇͋̒ͤ́̀ͧ́ͭ́̈ͪ̏͐͟ 두͌͏̖었̴̬̳̗͚̄ͬ̑͐̾͋̚습̢ͥͭ̌̽͛̌ͥ니̮͕̳͈̟̙͔다͚̥̬̤̋͒ͦ̒.̩̞̏ͣ͛̑͑̐ ̴̡͙͓͙̟̖̟̥̙̭̻̬̻͖̪͙̰̘̳͇͖͆̊̊̄̂̓͊̃̿̏̆̿̌̒̕͠ͅ구̪̤̱̲̜͍̬̳͙̿̆ͭ̈́̈̒̑ͪ̊̒̒̇̋́͐ͥ͞원̸̧̨͙̺̞̞͚̟̼̜͚͚̩̦̞̲̹̻͙̂ͪ̔̾̓ͪͬ͋̉̂̓̐̌̍ͧ̆̚자̡͎̭̣̺̫͗̃̆ͣ̀͑ͤͧ͊̅́̃에̵̡̗̜͉͔̹̦̼͖̟̬̟̭̹̺͙̗͌͑͋ͦ̂̀̌ͨͫ̍̃̈ͪ̇ͫ̅͒ͬͤ͜ͅ게̸̨̬͚̰̗̠ͭ̔̿̂͘͞ ̶̡̢̹̫̬͓̞̥̜̣͇̦̼͇̥̹̿̓͐ͥ̑̊͋͂ͪ̚필̢͗ͣ̓ͬ͗͐̄͆ͣ̚͠͏̖̰͇͚͎̭̪̠̙̠̱ͅ요̛ͧ̇̾̔̒̈́̀̏͏̧̕͏̦̲̦͇̫ͅ할͎̝̻͙͍̝͉͔̘̰͔̣̲̣̐̅̍̎ͥ̓͂͗̀͜ ̶̨̨̟͖̲̫̞̩̗̭͍̬̣̟̪̱̥͛̋̅̆͑̆͜͝ͅ것̷̯̺͔̰̠̱͍̦͓͌ͧ͐͒͌ͭͣͤ̀͢͞입̙͖͇̘̲̣̹̳̹̫̣̜͉̪͎̹̱͚̟ͫ̓̌͑ͧ̐̽̒̓̀͘͝니̋̑ͧ̎ͤͫ̅͏̷̭̯̬͓͓̮̫̮̞̳̱̫̫̮̠̖̯͈͟다̝̞̪̰͈̰̦̝̗̝̤͚̿̿̊̓ͨ̓̓̽̃͐͆̓̓̀͠.̸̛̦̤̞̜̫̫͗̇ͦͧ̂̉͘̕͢\n\n"\ \ -"바̶다̧와̧ ͡초소͟ ́지́역͞ ͜사이́ 동͝쪽 ̴채͞석장에̸서͠ 금̡속 금̵고를̡ ̢찾아보십시오͟.̡\n\n"\ +"바̺͙̹̻̙̮͐ͥ̋͂̕다̛̻̹͉̐͑와̟̗͇̲̬͐͌͊̉͌ ̨̫̪̯̔̄ͧͫ͒초̪̍소̜͍͓̰͚̠̾ͅ ͒͂̇지̛̱̤͔ͦ̓̇역̲͚̲̇̇̃͡ ̪̗͉ͬ̍̚사͚͚̼̹̪̯이̥̘̻̺̙ͥ͌ͬ̃̚의͒̂̾̓̑̐ ̢̣ͧ͌̈́̽동͚͙̪̱͚͇͓͗쪽̨̼̳̗̒̎̉̃̊̽͐ ̯̙̩̠̱́ͮͮ͑ͪ͢채͈̳͙͎̪̦̓ͪ̓ͅ석̙͉̳̰̘̠͋ͥ̄̈́ͭ장̱͛͗에̸̆͗̾서̆ͤ̒̓ͫ̌͏̫̲͍̭̘̜ ̘͚̩̑͆̈ͯ̿̓금̦̣͈̘̝͂̅̇̽̂͗속͕̳͎̪͗͌͐̌́̔ ̧͙͖̥͍́͋̈́금̳̲͉̟͔̂̿͒ͤ̑̾ͥ̀ͅ고̯̎͟를̩̗̦͚̳ ͕ͥ͜찾̯͉̎̂̅͂͐ͫ̾아̻̲̻̇̐ͣ보̬̭̙̖͔̈́십̗͈̱̊̑̈͗ͭ͆̀́시̤͉̣̣͊̒̂̓̍오̬̜̘̰͍̭͎͛.̢ͥ̿ͩ͗ͩ̌̒\n\n"\ \ -"필요한 코드는 다음과 같습니다. " +"코드는 다음과 같습니다. " -DOCUMENT_POSTGAME_TEXT_KO = "필요한 코드는 다음과 같습니다. " +DOCUMENT_POSTGAME_TEXT_KO = "코드는 다음과 같습니다. " DOCUMENT_TEXT_ZH_CN = \ "亲爱̷̷͟͝͡的̸̀̀ ̷̡̠͇̼͉̻̦͓́͜͡ ̶̤̦̯͖͚͓̮͓̣̤̰͇́̕ ̴͜͏͈̭̦͙̦̯̟̗̜̼̠̦͘ ̶̶̡̢̲̱̜̹̰̻̘̪̳̫͕̙̕ ̡҉͎̦̙̰̻͉̜̝̺͚̻͇̞̺̦͓́ ̨̘̤̜̞͍̩̠̱̦̫͔̹̩͍͇̜͈́̕͞ͅͅ ̴̴̧̣͍̘̰̗̮̜̰̲̣̙̲̝͚̩̦̭̀͡ ̧̗͚̱͓̥̖͍͕̀ ̫̪͇̗̲̭̤͖̫̣͇͔͘ ͕͚͎̦͓̺̤̳̙̝͟ͅ ̸͉̫̘̩͙͖̼̣̞̞̰̼̞͕̀ ̶̗͓͎͓̦̙̭̳̻̫̥̯̱͚̦͔͍͙͟ ̶͜҉͏̞̺̙̥̦̪͇̯̳͍̬̱̰̘̺̠̀ ̴̼̘͇͎͙̘̜̀̀͞ ̴̢̹̥͚͎́̀\n\n\n"\ From 11f3c25eded969ae62c1df72f2b7de288153c2f4 Mon Sep 17 00:00:00 2001 From: tdixon Date: Fri, 19 Jan 2018 00:13:05 -0400 Subject: [PATCH 7/8] use the new API dll --- binding-mri/chroma-binding.cpp | 88 +++++++++++------ chromasdk/ChromaApi.h | 175 +++++++++++++++++++++++++++++++++ scripts/Main.rb | 1 - scripts/Scene_Map.rb | 23 ++++- 4 files changed, 253 insertions(+), 34 deletions(-) create mode 100644 chromasdk/ChromaApi.h diff --git a/binding-mri/chroma-binding.cpp b/binding-mri/chroma-binding.cpp index e7e4863..4996b5b 100644 --- a/binding-mri/chroma-binding.cpp +++ b/binding-mri/chroma-binding.cpp @@ -2,11 +2,21 @@ #include "binding-types.h" #include "debugwriter.h" -#include "chromasdk/ChromaSDKImpl.h" +#include "chromasdk/ChromaApi.h" bool INIT_SUCCESS = false; -CChromaSDKImpl* chromaImpl = NULL; +HINSTANCE hLib = NULL; + +//dynamic-loaded proc pointers +PluginPlayAnimation _playAnimation = NULL; +PluginOpenAnimation _openAnimation = NULL; +PluginIsInitialized _pluginIsInitialized = NULL; +PluginInit _pluginInit = NULL; +PluginUninit _pluginUninit = NULL; + +int lastAnimId = -1; + void _attemptLinkSdk() { Debug() << "Attempting to bind Chroma SDK"; @@ -18,43 +28,65 @@ void _attemptLinkSdk() { return; #endif - chromaImpl = new CChromaSDKImpl(); - Debug() << "Chroma Impl @" << chromaImpl; - chromaImpl->Initialize(); - INIT_SUCCESS = true; + hLib = LoadLibrary(L"ChromaApi.dll"); + if (hLib != NULL) { + Debug() << "Chroma Impl @" << hLib; + INIT_SUCCESS = true; + + _playAnimation = (PluginPlayAnimation) GetProcAddress(hLib, "PluginPlayAnimation"); + INIT_SUCCESS &= _playAnimation != NULL; + Debug() << "Plugin method @" << (long)_playAnimation; + + _openAnimation = (PluginOpenAnimation) GetProcAddress(hLib, "PluginOpenAnimation"); + INIT_SUCCESS &= _openAnimation != NULL; + + _pluginInit = (PluginInit) GetProcAddress(hLib, "PluginInit"); + INIT_SUCCESS &= _pluginInit != NULL; + + _pluginIsInitialized = (PluginIsInitialized) GetProcAddress(hLib, "PluginIsInitialized"); + INIT_SUCCESS &= _pluginInit != NULL; + if (INIT_SUCCESS && !_pluginIsInitialized()) { + Debug() << "Initializing chroma plugin"; + _pluginInit(); + } + _pluginUninit = (PluginUninit) GetProcAddress(hLib, "PluginUninit"); + INIT_SUCCESS &= _pluginUninit != NULL; + Debug() << "Plugin init success:" << INIT_SUCCESS; + } } -RB_METHOD(chromaSetBase) { - Debug() << "Chroma: Attempting to set base colour"; - RB_UNUSED_PARAM; - if (INIT_SUCCESS) { - ChromaSDK::Keyboard::CUSTOM_EFFECT_TYPE effect = {}; - for (unsigned int y = 0; y < ChromaSDK::Keyboard::MAX_ROW; y++) { - for (unsigned int x = 0; x < ChromaSDK::Keyboard::MAX_COLUMN; x++) { - effect.Color[y][x] = RGB(0xFF, 0, 0xFF); - } - } - chromaImpl->CreateKeyboardEffectImpl( - ChromaSDK::Keyboard::CHROMA_CUSTOM, - &effect, - NULL); - Debug() << "Chroma: Set base colour effect"; - } - return Qnil; + +RB_METHOD(chromaPlayAnimation) { + RB_UNUSED_PARAM; + + Debug() << "Chroma: Attempting to play animation."; + const char* animfile; + bool loop; + + rb_get_args(argc, argv, "zb", &animfile, &loop RB_ARG_END); + + if (INIT_SUCCESS) { + Debug() << "Opening animation:" << animfile; + lastAnimId = _openAnimation(animfile); + Debug() << "ID:" << lastAnimId; + _playAnimation(lastAnimId); + } + + return Qnil; } void chromaBindingInit() { _attemptLinkSdk(); VALUE module = rb_define_module("Chroma"); - _rb_define_module_function(module, "setBase", chromaSetBase); + _rb_define_module_function(module, "playAnim", chromaPlayAnimation); } void chromaBindingRelease() { - if (chromaImpl) { - chromaImpl->UnInitialize(); - delete chromaImpl; - chromaImpl = NULL; + if (hLib != NULL) { + _pluginUninit(); + FreeLibrary(hLib); + hLib = NULL; INIT_SUCCESS = false; } } diff --git a/chromasdk/ChromaApi.h b/chromasdk/ChromaApi.h new file mode 100644 index 0000000..7aacf25 --- /dev/null +++ b/chromasdk/ChromaApi.h @@ -0,0 +1,175 @@ + +typedef int (*PluginInit)(); +typedef double (*PluginInitD)(); + +typedef bool (*PluginIsPlatformSupported)(); +typedef double (*PluginIsPlatformSupportedD)(); + +typedef bool (*PluginIsInitialized)(); +typedef double (*PluginIsInitializedD)(); + +typedef bool (*PluginIsDialogOpen)(); +typedef double (*PluginIsDialogOpenD)(); + +typedef int (*PluginOpenEditorDialog)(const char* path); +typedef double (*PluginOpenEditorDialogD)(const char* path); + +typedef int (*PluginOpenEditorDialogAndPlay)(const char* path); +typedef double (*PluginOpenEditorDialogAndPlayD)(const char* path); + +typedef int (*PluginOpenAnimation)(const char* path); +typedef double (*PluginOpenAnimationD)(const char* path); + +typedef int (*PluginLoadAnimation)(int animationId); +typedef double (*PluginLoadAnimationD)(double animationId); + +typedef int (*PluginUnloadAnimation)(int animationId); +typedef double (*PluginUnloadAnimationD)(double animationId); + +typedef int (*PluginPlayAnimation)(int animationId); +typedef double (*PluginPlayAnimationD)(double animationId); + +typedef bool (*PluginIsPlaying)(int animationId); +typedef double (*PluginIsPlayingD)(double animationId); + +typedef int (*PluginStopAnimation)(int animationId); +typedef double (*PluginStopAnimationD)(double animationId); + +typedef int (*PluginCloseAnimation)(int animationId); +typedef double (*PluginCloseAnimationD)(double animationId); + +typedef int (*PluginUninit)(); +typedef double (*PluginUninitD)(); + +typedef int (*PluginCreateAnimationInMemory)(int deviceType, int device); +typedef int (*PluginCreateAnimation)(const char* path, int deviceType, int device); +typedef int (*PluginSaveAnimation)(int animationId, const char* path); +typedef int (*PluginResetAnimation)(int animationId); + +typedef int (*PluginGetDeviceType)(int animationId); +typedef int (*PluginGetDeviceTypeName)(const char* path); +typedef double (*PluginGetDeviceTypeNameD)(const char* path); + +typedef int (*PluginGetDevice)(int animationId); +typedef int (*PluginGetDeviceName)(const char* path); +typedef double (*PluginGetDeviceNameD)(const char* path); + +typedef int (*PluginSetDevice)(int animationId, int deviceType, int device); + +typedef int (*PluginGetMaxLeds)(int device); +typedef double (*PluginGetMaxLedsD)(double device); + +typedef int (*PluginGetMaxRow)(int device); +typedef double (*PluginGetMaxRowD)(double device); + +typedef int (*PluginGetMaxColumn)(int device); +typedef double (*PluginGetMaxColumnD)(double device); + +typedef int (*PluginAddFrame)(int animationId, float duration, int* colors, int length); +typedef int (*PluginUpdateFrame)(int animationId, int frameIndex, float duration, int* colors, int length); +typedef int (*PluginGetFrame)(int animationId, int frameIndex, float* duration, int* colors, int length); + +typedef int (*PluginPreviewFrame)(int animationId, int frameIndex); +typedef double (*PluginPreviewFrameD)(double animationId, double frameIndex); + +typedef int (*PluginOverrideFrameDuration)(int animationId, float duration); +typedef double (*PluginOverrideFrameDurationD)(double animationId, double duration); + +typedef int (*PluginReverse)(int animationId); +typedef int (*PluginMirrorHorizontally)(int animationId); +typedef int (*PluginMirrorVertically)(int animationId); + +typedef int (*PluginGetAnimation)(const char* name); +typedef double (*PluginGetAnimationD)(const char* name); + +typedef void (*PluginCloseAnimationName)(const char* path); +typedef double (*PluginCloseAnimationNameD)(const char* path); + +typedef void (*PluginPlayAnimationLoop)(int animationId, bool loop); +typedef void (*PluginPlayAnimationName)(const char* path, bool loop); +typedef double (*PluginPlayAnimationNameD)(const char* path, double loop); + +typedef void (*PluginPlayAnimationFrame)(int animationId, int frameId, bool loop); +typedef void (*PluginPlayAnimationFrameName)(const char* path, int frameId, bool loop); +typedef double (*PluginPlayAnimationFrameNameD)(const char* path, double frameId, double loop); + +typedef void (*PluginStopAnimationName)(const char* path); +typedef double (*PluginStopAnimationNameD)(const char* path); + +typedef void (*PluginStopAnimationType)(int deviceType, int device); +typedef double (*PluginStopAnimationTypeD)(double deviceType, double device); + +typedef bool (*PluginIsPlayingName)(const char* path); +typedef double (*PluginIsPlayingNameD)(const char* path); + +typedef bool (*PluginIsPlayingType)(int deviceType, int device); +typedef double (*PluginIsPlayingTypeD)(double deviceType, double device); + +typedef void (*PluginPlayComposite)(const char* name, bool loop); +typedef double (*PluginPlayCompositeD)(const char* name, double loop); + +typedef void (*PluginStopComposite)(const char* name); +typedef double (*PluginStopCompositeD)(const char* name); + +typedef void (*PluginCloseComposite)(const char* name); +typedef double (*PluginCloseCompositeD)(const char* name); + +typedef int (*PluginGetKeyColor)(int animationId, int frameId, int rzkey); +typedef int (*PluginGetKeyColorName)(const char* path, int frameId, int rzkey); +typedef double (*PluginGetKeyColorD)(const char* path, double frameId, double rzkey); + +typedef int (*PluginGet1DColor)(int animationId, int frameId, int led); +typedef int (*PluginGet1DColorName)(const char* path, int frameId, int led); +typedef double (*PluginGet1DColorNameD)(const char* path, double frameId, double led); + +typedef int (*PluginGet2DColor)(int animationId, int frameId, int row, int column); +typedef int (*PluginGet2DColorName)(const char* path, int frameId, int row, int column); +typedef double (*PluginGet2DColorNameD)(const char* path, double frameId, double row, double column); + +typedef void (*PluginSetKeyColor)(int animationId, int frameId, int rzkey, int color); +typedef void (*PluginSetKeyColorName)(const char* path, int frameId, int rzkey, int color); +typedef double (*PluginSetKeyColorNameD)(const char* path, double frameId, double rzkey, double color); + +typedef void (*PluginSet1DColor)(int animationId, int frameId, int led, int color); +typedef void (*PluginSet1DColorName)(const char* path, int frameId, int led, int color); +typedef double (*PluginSet1DColorNameD)(const char* path, double frameId, double led, double color); + +typedef void (*PluginSet2DColor)(int animationId, int frameId, int row, int column, int color); +typedef void (*PluginSet2DColorName)(const char* path, int frameId, int row, int column, int color); +typedef double (*PluginSet2DColorNameD)(const char* path, double frameId, double rowColumnIndex, double color); + +typedef void (*PluginCopyKeyColor)(int sourceAnimationId, int targetAnimationId, int frameId, int rzkey); +typedef void (*PluginCopyKeyColorName)(const char* sourceAnimation, const char* targetAnimation, int frameId, int rzkey); +typedef double (*PluginCopyKeyColorNameD)(const char* sourceAnimation, const char* targetAnimation, double frameId, double rzkey); + +typedef void (*PluginCopyNonZeroKeyColor)(int sourceAnimationId, int targetAnimationId, int frameId, int rzkey); +typedef void (*PluginCopyNonZeroKeyColorName)(const char* sourceAnimation, const char* targetAnimation, int frameId, int rzkey); +typedef double (*PluginCopyNonZeroKeyColorNameD)(const char* sourceAnimation, const char* targetAnimation, double frameId, double rzkey); + +typedef int (*PluginGetFrameCount)(int animationId); +typedef int (*PluginGetFrameCountName)(const char* path); +typedef double (*PluginGetFrameCountNameD)(const char* path); + +typedef int (*PluginGetCurrentFrame)(int animationId); +typedef int (*PluginGetCurrentFrameName)(const char* path); +typedef double (*PluginGetCurrentFrameNameD)(const char* path); + +typedef void (*PluginSetCurrentFrame)(int animationId, int frameId); +typedef void (*PluginSetCurrentFrameName)(const char* path, int frameId); +typedef double (*PluginSetCurrentFrameNameD)(const char* path, double frameId); + +typedef void (*PluginPauseAnimation)(int animationId); +typedef void (*PluginPauseAnimationName)(const char* path); +typedef double (*PluginPauseAnimationNameD)(const char* path); + +typedef bool (*PluginIsAnimationPaused)(int animationId); +typedef bool (*PluginIsAnimationPausedName)(const char* path); +typedef double (*PluginIsAnimationPausedNameD)(const char* path); + +typedef bool (*PluginHasAnimationLoop)(int animationId); +typedef bool (*PluginHasAnimationLoopName)(const char* path); +typedef double (*PluginHasAnimationLoopNameD)(const char* path); + +typedef void (*PluginResumeAnimation)(int animationId, bool loop); +typedef void (*PluginResumeAnimationName)(const char* path, bool loop); +typedef double (*PluginResumeAnimationNameD)(const char* path, double loop); diff --git a/scripts/Main.rb b/scripts/Main.rb index 8adc036..8555851 100644 --- a/scripts/Main.rb +++ b/scripts/Main.rb @@ -16,7 +16,6 @@ begin # Load persistent data Persistent.load - Chroma.setBase # Prepare for transition Graphics.freeze diff --git a/scripts/Scene_Map.rb b/scripts/Scene_Map.rb index aaf4078..9454865 100644 --- a/scripts/Scene_Map.rb +++ b/scripts/Scene_Map.rb @@ -236,7 +236,7 @@ class Scene_Map # Update fast travel @fast_travel.update @window_settings.update - + if Input.trigger?(Input::F8) && !$game_switches[123] if Graphics.fullscreen == true Graphics.fullscreen = false @@ -276,11 +276,24 @@ class Scene_Map $game_temp.player_new_x = $data_system.start_x $game_temp.player_new_y = $data_system.start_y end - # If debug mode is ON and F9 key was pressed - if $debug and Input.press?(Input::F9) - # Set debug calling flag - $game_temp.debug_calling = true + # debug && F6 + if $debug and Input.press?(Input::F6) and $lastpress != 6 + $lastpress = 6 + Chroma.playAnim("chroma/blank_keyboard.chroma", false); end + if $debug and Input.press?(Input::F7) and $lastpress != 7 + $lastpress = 7 + Chroma.playAnim("chroma/Fire_Keyboard.chroma", true); + end + if $debug and Input.press?(Input::F9) and $lastpress != 9 + $lastpress = 9 + Chroma.playAnim("chroma/Random_Keyboard.chroma", false); + end + # If debug mode is ON and F9 key was pressed + # if $debug and Input.press?(Input::F9) + # # Set debug calling flag + # $game_temp.debug_calling = true + # end # If player is not moving unless $game_player.moving? # Run calling of each screen From 50e7468d35ce9782424b0aa39bfbbb67006c6f2e Mon Sep 17 00:00:00 2001 From: tdixon Date: Fri, 19 Jan 2018 00:36:17 -0400 Subject: [PATCH 8/8] remove some unnecessary stuff --- chromasdk/ChromaSDKImpl.cpp | 351 ---------------------------------- chromasdk/ChromaSDKImpl.h | 56 ------ chromasdk/FrameController.cpp | 54 ------ chromasdk/FrameController.h | 23 --- mkxp.pro | 9 +- 5 files changed, 3 insertions(+), 490 deletions(-) delete mode 100644 chromasdk/ChromaSDKImpl.cpp delete mode 100644 chromasdk/ChromaSDKImpl.h delete mode 100644 chromasdk/FrameController.cpp delete mode 100644 chromasdk/FrameController.h diff --git a/chromasdk/ChromaSDKImpl.cpp b/chromasdk/ChromaSDKImpl.cpp deleted file mode 100644 index 12304de..0000000 --- a/chromasdk/ChromaSDKImpl.cpp +++ /dev/null @@ -1,351 +0,0 @@ -//! \example ChromaSDKImpl.cpp - -#include -#include -#include -#include "ChromaSDKImpl.h" -#include "FrameController.h" - -CChromaSDKImpl g_ChromaSDKImpl; - -#ifdef _WIN64 -#define CHROMASDKDLL L"RzChromaSDK64.dll" -#else -#define CHROMASDKDLL L"RzChromaSDK.dll" -#endif - -using namespace std; -using namespace ChromaSDK; -using namespace ChromaSDK::Keyboard; -using namespace ChromaSDK::Keypad; -using namespace ChromaSDK::Mouse; -using namespace ChromaSDK::Mousepad; -using namespace ChromaSDK::Headset; - -typedef RZRESULT (*INIT)(void); -typedef RZRESULT (*UNINIT)(void); -typedef RZRESULT (*CREATEEFFECT)(RZDEVICEID DeviceId, ChromaSDK::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId); -typedef RZRESULT (*CREATEKEYBOARDEFFECT)(ChromaSDK::Keyboard::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId); -typedef RZRESULT (*CREATEHEADSETEFFECT)(ChromaSDK::Headset::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId); -typedef RZRESULT (*CREATEMOUSEPADEFFECT)(ChromaSDK::Mousepad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId); -typedef RZRESULT (*CREATEMOUSEEFFECT)(ChromaSDK::Mouse::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId); -typedef RZRESULT (*CREATEKEYPADEFFECT)(ChromaSDK::Keypad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId); -typedef RZRESULT (*CREATECHROMALINKEFFECT)(ChromaSDK::ChromaLink::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId); -typedef RZRESULT (*SETEFFECT)(RZEFFECTID EffectId); -typedef RZRESULT (*DELETEEFFECT)(RZEFFECTID EffectId); -typedef RZRESULT (*REGISTEREVENTNOTIFICATION)(HWND hWnd); -typedef RZRESULT (*UNREGISTEREVENTNOTIFICATION)(void); -typedef RZRESULT (*QUERYDEVICE)(RZDEVICEID DeviceId, ChromaSDK::DEVICE_INFO_TYPE &DeviceInfo); - -INIT Init = NULL; -UNINIT UnInit = NULL; -CREATEEFFECT CreateEffect = NULL; -CREATEKEYBOARDEFFECT CreateKeyboardEffect = NULL; -CREATEMOUSEEFFECT CreateMouseEffect = NULL; -CREATEHEADSETEFFECT CreateHeadsetEffect = NULL; -CREATEMOUSEPADEFFECT CreateMousematEffect = NULL; -CREATEKEYPADEFFECT CreateKeypadEffect = NULL; -CREATECHROMALINKEFFECT CreateChromaLinkEffect = NULL; -SETEFFECT SetEffect = NULL; -DELETEEFFECT DeleteEffect = NULL; -QUERYDEVICE QueryDevice = NULL; - -#define EVENT_NAME L"{4784D90A-1179-4F7D-8558-52511D809190}" - -#define MAX_EFFECTS 100 - -typedef struct _EFFECTDATATYPE -{ - long numEffects; - BOOL repeat; - HANDLE thread; - struct _EFFECT - { - RZEFFECTID id; - long delay; - } Effect[MAX_EFFECTS]; -} EFFECTDATATYPE; - -struct GUIDCompare -{ - BOOL operator()(const GUID & Left, const GUID & Right) const - { - return memcmp(&Left , &Right,sizeof(Right)) < 0; - } -}; - -std::map g_Effects; - -DWORD WINAPI Thread_RenderEffects(LPVOID lpParameter) -{ - RZEFFECTID *pEffectId = (RZEFFECTID*)lpParameter; - - auto iterator = g_Effects.find(*pEffectId); - if(iterator != g_Effects.end()) - { - EFFECTDATATYPE *pEffectData = &iterator->second; - - CFrameController FrameControl(30); - - if(pEffectData->repeat == FALSE) - { - for(int i=0; inumEffects; i++) - { - FrameControl.Begin(); - - SetEffect(pEffectData->Effect[i].id); - - Sleep(pEffectData->Effect[i].delay); - - FrameControl.End(); - } - } - else - { - while(pEffectData->repeat) - { - for(int i=0; inumEffects; i++) - { - FrameControl.Begin(); - - SetEffect(pEffectData->Effect[i].id); - - Sleep(pEffectData->Effect[i].delay); - - FrameControl.End(); - } - }; - } - } - - return 0; -} - -// CChromaSDKImpl - -CChromaSDKImpl::CChromaSDKImpl(): - m_hModule(NULL), - m_hEvent(NULL) -{ -} - -CChromaSDKImpl::~CChromaSDKImpl() -{ -} - -void CChromaSDKImpl::Initialize() -{ - if(m_hModule == NULL) - { - m_hModule =::LoadLibrary(CHROMASDKDLL); - if(m_hModule != NULL) - { - INIT Init = (INIT)::GetProcAddress(m_hModule, "Init"); - if(Init != NULL) - { - RZRESULT rzResult = Init(); - if(rzResult == RZRESULT_SUCCESS) - { - CreateEffect = (CREATEEFFECT)::GetProcAddress(m_hModule, "CreateEffect"); - CreateKeyboardEffect = (CREATEKEYBOARDEFFECT)::GetProcAddress(m_hModule, "CreateKeyboardEffect"); - CreateMouseEffect = (CREATEMOUSEEFFECT)::GetProcAddress(m_hModule, "CreateMouseEffect"); - CreateMousematEffect = (CREATEMOUSEPADEFFECT)::GetProcAddress(m_hModule, "CreateMousepadEffect"); - CreateKeypadEffect = (CREATEKEYPADEFFECT)::GetProcAddress(m_hModule, "CreateKeypadEffect"); - CreateHeadsetEffect = (CREATEHEADSETEFFECT)::GetProcAddress(m_hModule, "CreateHeadsetEffect"); - CreateChromaLinkEffect = (CREATECHROMALINKEFFECT)::GetProcAddress(m_hModule, "CreateChromaLinkEffect"); - SetEffect = (SETEFFECT)GetProcAddress(m_hModule, "SetEffect"); - DeleteEffect = (DELETEEFFECT)GetProcAddress(m_hModule, "DeleteEffect"); - } - } - } - } - - if(m_hEvent == NULL) - { - m_hEvent = ::CreateEvent(NULL, TRUE, FALSE, EVENT_NAME); - } -} - -void CChromaSDKImpl::UnInitialize() -{ - // Free memeory - while(!g_Effects.empty()) - { - auto iterator = g_Effects.begin(); - for(int i=0; isecond.numEffects; i++) - { - DeleteEffect(iterator->second.Effect[i].id); - } - - g_Effects.erase(iterator); - }; - - if(m_hEvent != NULL) - { - ::CloseHandle(m_hEvent); - m_hEvent = NULL; - } - - if(m_hModule != NULL) - { - UNINIT UnInit = (UNINIT)::GetProcAddress(m_hModule, "UnInit"); - if(UnInit != NULL) - { - RZRESULT rzResult = UnInit(); - if(rzResult != RZRESULT_SUCCESS) - { - // Some error here - } - } - - ::FreeLibrary(m_hModule); - m_hModule = NULL; - } -} - -void CChromaSDKImpl::CreateEffectImpl(RZDEVICEID DeviceId, ChromaSDK::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId) -{ - if(CreateEffect == NULL) return; - - CreateEffect(DeviceId, Effect, pParam, pEffectId); -} - -void CChromaSDKImpl::CreateKeyboardEffectImpl(ChromaSDK::Keyboard::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId) -{ - if(CreateKeyboardEffect == NULL) return; - - CreateKeyboardEffect(Effect, pParam, pEffectId); -} - -void CChromaSDKImpl::CreateMouseEffectImpl(ChromaSDK::Mouse::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId) -{ - if(CreateMouseEffect == NULL) return; - - CreateMouseEffect(Effect, pParam, pEffectId); -} - -void CChromaSDKImpl::CreateMousematEffectImpl(ChromaSDK::Mousepad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId) -{ - if(CreateMousematEffect == NULL) return; - - CreateMousematEffect(Effect, pParam, pEffectId); -} - -void CChromaSDKImpl::CreateKeypadEffectImpl(ChromaSDK::Keypad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId) -{ - if(CreateKeypadEffect == NULL) return; - - CreateKeypadEffect(Effect, pParam, pEffectId); -} - -void CChromaSDKImpl::CreateHeadsetEffectImpl(ChromaSDK::Headset::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId) -{ - if(CreateHeadsetEffect == NULL) return; - - CreateHeadsetEffect(Effect, pParam, pEffectId); -} - -void CChromaSDKImpl::CreateChromaLinkEffectImpl(ChromaSDK::ChromaLink::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId) -{ - if(CreateChromaLinkEffect == NULL) return; - - CreateChromaLinkEffect(Effect, pParam, pEffectId); -} - -void CChromaSDKImpl::SetEffectImpl(RZEFFECTID EffectId) -{ - auto iterator = g_Effects.find(EffectId); - if(iterator != g_Effects.end()) - { - if(iterator->second.repeat == FALSE) - { - HANDLE hThread = CreateThread(NULL, 0, Thread_RenderEffects, (LPVOID)&iterator->first, 0, NULL); - if(hThread != NULL) - { - CloseHandle(hThread); - } - } - else - { - HANDLE hThread = CreateThread(NULL, 0, Thread_RenderEffects, (LPVOID)&iterator->first, 0, NULL); - if(hThread != NULL) - { - iterator->second.thread = hThread; - } - } - } - else - { - if(SetEffect == NULL) return; - - SetEffect(EffectId); - } -} - -void CChromaSDKImpl::DeleteEffectImpl(RZEFFECTID EffectId) -{ - auto iterator = g_Effects.find(EffectId); - if(iterator != g_Effects.end()) - { - EFFECTDATATYPE EffectData = iterator->second; - for(int i=0; isecond.repeat == TRUE) && - (iterator->second.thread != NULL)) - { - iterator->second.repeat = FALSE; - - CloseHandle(iterator->second.thread); - - iterator->second.thread = NULL; - } - } -} - -void CChromaSDKImpl::CreateEffectGroup(RZEFFECTID *pGroupEffectId, BOOL Repeat) -{ - RZEFFECTID EffectId = GUID_NULL; - if(SUCCEEDED(::CoCreateGuid(&EffectId))) - { - EFFECTDATATYPE EffectData = {}; - - EffectData.numEffects = 0; - EffectData.repeat = Repeat; - - g_Effects.insert(make_pair(EffectId, EffectData)); - - *pGroupEffectId = EffectId; - } -} - -void CChromaSDKImpl::AddToGroup(RZEFFECTID GroupEffectId, RZEFFECTID EffectId, long DelayMS) -{ - auto iterator = g_Effects.find(GroupEffectId); - if(iterator != g_Effects.end()) - { - long lIndex = iterator->second.numEffects; - - iterator->second.Effect[lIndex].id = EffectId; - iterator->second.Effect[lIndex].delay = DelayMS; - - iterator->second.numEffects++; - } -} diff --git a/chromasdk/ChromaSDKImpl.h b/chromasdk/ChromaSDKImpl.h deleted file mode 100644 index 91a09b0..0000000 --- a/chromasdk/ChromaSDKImpl.h +++ /dev/null @@ -1,56 +0,0 @@ - -#ifndef _CHROMASDKIMPL2_H_ -#define _CHROMASDKIMPL2_H_ - -#pragma once - -#include "RzChromaSDKDefines.h" -#include "RzChromaSDKTypes.h" -#include "RzErrors.h" - -const COLORREF BLACK = RGB(0,0,0); -const COLORREF WHITE = RGB(255,255,255); -const COLORREF RED = RGB(255,0,0); -const COLORREF GREEN = RGB(0,255,0); -const COLORREF BLUE = RGB(0,0,255); -const COLORREF YELLOW = RGB(255,255,0); -const COLORREF PURPLE = RGB(128,0,128); -const COLORREF CYAN = RGB(00,255,255); -const COLORREF ORANGE = RGB(255,165,00); -const COLORREF PINK = RGB(255,192,203); -const COLORREF GREY = RGB(125, 125, 125); - -class CChromaSDKImpl -{ -public: - CChromaSDKImpl(); - ~CChromaSDKImpl(); - -public: - void Initialize(); - void UnInitialize(); - - void CreateEffectImpl(RZDEVICEID DeviceId, ChromaSDK::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId=NULL); - void CreateKeyboardEffectImpl(ChromaSDK::Keyboard::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId=NULL); - void CreateMouseEffectImpl(ChromaSDK::Mouse::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId=NULL); - void CreateMousematEffectImpl(ChromaSDK::Mousepad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId=NULL); - void CreateKeypadEffectImpl(ChromaSDK::Keypad::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId=NULL); - void CreateHeadsetEffectImpl(ChromaSDK::Headset::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId=NULL); - void CreateChromaLinkEffectImpl(ChromaSDK::ChromaLink::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId=NULL); - void SetEffectImpl(RZEFFECTID EffectId); - void DeleteEffectImpl(RZEFFECTID EffectId); - void StopEffectImpl(RZEFFECTID EffectId); - - void CreateEffectGroup(RZEFFECTID *pGroupEffectId, BOOL Repeat=FALSE); - void AddToGroup(RZEFFECTID GroupEffectId, RZEFFECTID EffectId, LONG DelayMS=100); - -private: - HMODULE m_hModule; - HANDLE m_hEvent; -}; - -extern CChromaSDKImpl g_ChromaSDKImpl; - -#endif - - diff --git a/chromasdk/FrameController.cpp b/chromasdk/FrameController.cpp deleted file mode 100644 index ceef488..0000000 --- a/chromasdk/FrameController.cpp +++ /dev/null @@ -1,54 +0,0 @@ - -#include "FrameController.h" -#include - -int g_dwCurrentTickCount = 0; - -// CFrameController -CFrameController::CFrameController(): - m_FramesPerSec(-1), - m_OneFrame(0) -{ - -} - -CFrameController::CFrameController(long FramePerSec): - m_FramesPerSec(FramePerSec), - m_OneFrame(1000.0/m_FramesPerSec) -{ -} - -CFrameController::~CFrameController() -{ - -} - -void CFrameController::Begin() -{ - g_dwCurrentTickCount = GetTickCount(); -} - -void CFrameController::End() -{ - static int dwSleep = 0; - static int dwDiff = 0; - - dwDiff = GetTickCount() - g_dwCurrentTickCount; - dwSleep = (int)(m_OneFrame - (double)dwDiff); - - if (dwDiff < m_OneFrame) - { - Sleep(dwSleep); - } -} - -void CFrameController::SetRate(long FramePerSec) -{ - m_FramesPerSec = FramePerSec; - m_OneFrame = 1000.0 / m_FramesPerSec; -} - -long CFrameController::GetRate(void) -{ - return m_FramesPerSec; -} diff --git a/chromasdk/FrameController.h b/chromasdk/FrameController.h deleted file mode 100644 index 7216ef9..0000000 --- a/chromasdk/FrameController.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef _FRAMECONTROLLER_H_ -#define _FRAMECONTROLLER_H_ - -#pragma once - -class CFrameController -{ -public: - CFrameController(); - CFrameController(long FramePerSec); - ~CFrameController(); - - void Begin(); - void End(); - void SetRate(long FramePerSec); - long GetRate(); - -private: - long m_FramesPerSec; - double m_OneFrame; -}; - -#endif diff --git a/mkxp.pro b/mkxp.pro index 1a75d33..7541c4e 100644 --- a/mkxp.pro +++ b/mkxp.pro @@ -157,11 +157,10 @@ HEADERS += \ src/sdl-util.h \ src/oneshot.h \ src/pipe.h \ - chromasdk/FrameController.h \ - chromasdk/ChromaSDKImpl.h \ chromasdk/RzChromaSDKDefines.h \ chromasdk/RzChromaSDKTypes.h \ chromasdk/RzErrors.h \ + chromasdk/ChromaApi.h \ src/i18n.h SOURCES += \ @@ -203,10 +202,6 @@ SOURCES += \ src/vorbissource.cpp \ src/oneshot.cpp \ src/screen.cpp \ - binding-mri/journal-binding.cpp \ - chromasdk/FrameController.cpp \ - chromasdk/ChromaSdkImpl.cpp \ - binding-mri/chroma-binding.cpp \ src/i18n.cpp STEAM { @@ -305,6 +300,8 @@ BINDING_MRI { binding-mri/oneshot-binding.cpp \ binding-mri/steam-binding.cpp \ binding-mri/wallpaper-binding.cpp \ + binding-mri/journal-binding.cpp \ + binding-mri/chroma-binding.cpp \ binding-mri/niko-binding.cpp }