From 0711efacd60d1b3679cfb5e48d1c6b5f0ecb5225 Mon Sep 17 00:00:00 2001 From: T-Troll Date: Sun, 15 Sep 2024 11:48:33 +0300 Subject: [PATCH] v2,v3,v8 fixes, 4800 and 3200 fixes, timeout --- AlienFX-SDK/AlienFX_SDK/AlienFX_SDK.cpp | 26 +++++++++----------- AlienFX-SDK/AlienFX_SDK/AlienFX_SDK.h | 2 +- Install/Install.vdproj | 14 +++++------ LightFX/LightFX.rc | 8 +++--- alienfan-tools/alienfan-gui/alienfan-gui.rc | Bin 15382 -> 15382 bytes alienfan-tools/alienfan-mon/MonHelper.cpp | 3 ++- alienfx-cli/alienfx-cli.cpp | 21 +++++++++------- alienfx-gui/alienfx-gui.rc | Bin 74064 -> 74064 bytes alienfx-mon/alienfx-mon.rc | Bin 15630 -> 15630 bytes 9 files changed, 38 insertions(+), 36 deletions(-) diff --git a/AlienFX-SDK/AlienFX_SDK/AlienFX_SDK.cpp b/AlienFX-SDK/AlienFX_SDK/AlienFX_SDK.cpp index 892a83c..4c1650c 100644 --- a/AlienFX-SDK/AlienFX_SDK/AlienFX_SDK.cpp +++ b/AlienFX-SDK/AlienFX_SDK/AlienFX_SDK.cpp @@ -107,7 +107,7 @@ namespace AlienFX_SDK { case API_V8: if (needV8Feature) { res = HidD_SetFeature(devHandle, buffer, length); - Sleep(7); + Sleep(8); } else { @@ -117,7 +117,7 @@ namespace AlienFX_SDK { return res; } - bool Functions::SavePowerBlock(byte blID, Afx_lightblock* act, bool needSave, bool needInverse) { + void Functions::SavePowerBlock(byte blID, Afx_lightblock* act, bool needSave, bool needInverse) { vector mods; PrepareAndSend(COMMV1_saveGroup, { {2, {blID}} }); if (act->act.size() < 2) @@ -133,7 +133,7 @@ namespace AlienFX_SDK { PrepareAndSend(COMMV1_color, SetMaskAndColor(&mods, ~((1 << act->index)), act->act.front(), act->act.back())); PrepareAndSend(COMMV1_saveGroup, { {2, {blID}} }); PrepareAndSend(COMMV1_loop); -chain++; + chain++; } if (needSave) { @@ -141,11 +141,12 @@ chain++; Reset(); } - return true; + //return true; } bool Functions::AlienFXProbeDevice(void* hDevInfo, void* devData, WORD vidd, WORD pidd) { DWORD dwRequiredSize = 0; + COMMTIMEOUTS timeouts = {100,0,0,10,0}; version = API_UNKNOWN; SetupDiGetDeviceInterfaceDetail(hDevInfo, (PSP_DEVICE_INTERFACE_DATA)devData, NULL, 0, &dwRequiredSize, NULL); SP_DEVICE_INTERFACE_DETAIL_DATA* deviceInterfaceDetailData = (SP_DEVICE_INTERFACE_DETAIL_DATA*)new byte[dwRequiredSize]; @@ -217,6 +218,7 @@ chain++; if (HidD_GetProductString(devHandle, descbuf, 255)) for (int i = 0; i < wcslen(descbuf); i++) description += descbuf[i]; + SetCommTimeouts(devHandle, &timeouts); } //DebugPrint("Probe done, type " + to_string(version) + "\n"); } @@ -333,7 +335,7 @@ chain++; mods->push_back( {bPos, {act->index,v8OpCodes[act->act.front().type], act->act.front().tempo, 0xa5, act->act.front().time, 0xa, act->act.front().r, act->act.front().g,act->act.front().b, act->act.back().r,act->act.back().g,act->act.back().b, - (byte)(act->act.size() > 1 ? 2 : 1)} } ); + /*(byte)(act->act.size() > 1 ?*/ 2 /*: 1)*/} } ); } void Functions::AddV5DataBlock(byte bPos, vector* mods, byte index, Afx_action* c) { @@ -623,15 +625,13 @@ chain++; else pwr = &(*ca); if (pwr) { + if (act->size() > 1) + PrepareAndSend(COMMV1_save); chain = 1; if (save) { // 08 02 - AC standby Afx_lightblock tact{ pwr->index, {{AlienFX_A_Morph, 0 , 0, pwr->act.front().r, pwr->act.front().g, pwr->act.front().b}, {2}} }; - /*SavePowerBlock(2, tact, false);*/ - //tact = {pwr->index, - // {{AlienFX_A_Morph, 0 , 0, 0, 0, 0}, - // {2,0,0,pwr->act.back().r, pwr->act.back().g, pwr->act.back().b}}}; SavePowerBlock(2, &tact, true, true); // 08 05 - AC power tact = { pwr->index, @@ -657,13 +657,11 @@ chain++; tact.act.front().type = AlienFX_A_Pulse; SavePowerBlock(9, &tact, true); } - //int pind = powerMode ? 0 : 1; - //SetColor(pwr->index, { pwr->act[pind].b, pwr->act[pind].g, pwr->act[pind].r }); - } - if (act->size()) PrepareAndSend(COMMV1_save); - if (pwr) SetAction(pwr); + } else + if (act->size()) + PrepareAndSend(COMMV1_save); } break; } return true; diff --git a/AlienFX-SDK/AlienFX_SDK/AlienFX_SDK.h b/AlienFX-SDK/AlienFX_SDK/AlienFX_SDK.h index cf37ba3..199cb1b 100644 --- a/AlienFX-SDK/AlienFX_SDK/AlienFX_SDK.h +++ b/AlienFX-SDK/AlienFX_SDK/AlienFX_SDK.h @@ -141,7 +141,7 @@ namespace AlienFX_SDK { inline void AddV5DataBlock(byte bPos, vector* mods, byte index, Afx_action* act); // Support function to send whole power block for v1-v3 - bool SavePowerBlock(byte blID, Afx_lightblock* act, bool needSave, bool needInverse = false); + void SavePowerBlock(byte blID, Afx_lightblock* act, bool needSave, bool needInverse = false); // Support function for APIv4 action set bool SetV4Action(Afx_lightblock* act); diff --git a/Install/Install.vdproj b/Install/Install.vdproj index 789bce8..7bbe2cd 100644 --- a/Install/Install.vdproj +++ b/Install/Install.vdproj @@ -557,15 +557,15 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:AlienFX Tools" - "ProductCode" = "8:{D02D3A00-BCAE-4B1E-9D8F-96B81AD344D7}" - "PackageCode" = "8:{532592B2-AAA4-43D5-A1AF-3E7403B38BF4}" + "ProductCode" = "8:{47BFA81E-BBBD-4D16-ACE4-0CCEAF04689B}" + "PackageCode" = "8:{49A55259-EE42-4904-8BDD-8A2218349007}" "UpgradeCode" = "8:{EFC2D182-AE5E-4585-92D3-0759F77F59AA}" "AspNetVersion" = "8:4.0.30319.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:TRUE" "DetectNewerInstalledVersion" = "11:FALSE" "InstallAllUsers" = "11:FALSE" - "ProductVersion" = "8:9.0.1" + "ProductVersion" = "8:9.0.2" "Manufacturer" = "8:T-Troll" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:https://github.com/T-Troll/alienfx-tools/discussions" @@ -925,7 +925,7 @@ { "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_1924518F6EA84AD696BCCE8E589E25C7" { - "SourcePath" = "8:..\\x64\\Release_V1\\alienfx-gui.exe" + "SourcePath" = "8:..\\x64\\Release\\alienfx-gui.exe" "TargetName" = "8:" "Tag" = "8:" "Folder" = "8:_77CCC7F3944A4B009D9231F8B41DFD6D" @@ -953,7 +953,7 @@ } "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_4B7975803E6C492C8F7D8B599766674C" { - "SourcePath" = "8:..\\x64\\Release_V1\\alienfan-gui.exe" + "SourcePath" = "8:..\\x64\\Release\\alienfan-gui.exe" "TargetName" = "8:" "Tag" = "8:" "Folder" = "8:_77CCC7F3944A4B009D9231F8B41DFD6D" @@ -1009,7 +1009,7 @@ } "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_B829425435A04EFB81D071102204D8B4" { - "SourcePath" = "8:..\\x64\\Release_V1\\alienfan-cli.exe" + "SourcePath" = "8:..\\x64\\Release\\alienfan-cli.exe" "TargetName" = "8:" "Tag" = "8:" "Folder" = "8:_77CCC7F3944A4B009D9231F8B41DFD6D" @@ -1093,7 +1093,7 @@ } "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_FA7989C51ECD437AB3316446FB849F60" { - "SourcePath" = "8:..\\x64\\Release_V1\\alienfx-mon.exe" + "SourcePath" = "8:..\\x64\\Release\\alienfx-mon.exe" "TargetName" = "8:" "Tag" = "8:" "Folder" = "8:_77CCC7F3944A4B009D9231F8B41DFD6D" diff --git a/LightFX/LightFX.rc b/LightFX/LightFX.rc index 504f0ba..58ea7bd 100644 --- a/LightFX/LightFX.rc +++ b/LightFX/LightFX.rc @@ -61,8 +61,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 9,0,0,1 - PRODUCTVERSION 9,0,0,1 + FILEVERSION 9,0,0,2 + PRODUCTVERSION 9,0,0,2 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -78,12 +78,12 @@ BEGIN BLOCK "040004b0" BEGIN VALUE "FileDescription", "LightFX emulator" - VALUE "FileVersion", "9.0.0.1" + VALUE "FileVersion", "9.0.0.2" VALUE "InternalName", "LightFX.dll" VALUE "LegalCopyright", "Copyright (C) 2021" VALUE "OriginalFilename", "LightFX.dll" VALUE "ProductName", "AlienFX Tools" - VALUE "ProductVersion", "9.0.0.1" + VALUE "ProductVersion", "9.0.0.2" END END BLOCK "VarFileInfo" diff --git a/alienfan-tools/alienfan-gui/alienfan-gui.rc b/alienfan-tools/alienfan-gui/alienfan-gui.rc index af985a3ba33d206b7915807111d3c34de97133e5..3934f8b1247e6e0d2881736703fbcd94f4fa3f05 100644 GIT binary patch delta 56 zcmbPMF|A_5HX}x($=i(#8I3l-GlastProf->gmodeStage ? powerSize : fan_conf->lastProf->powerStage; //int cmode = GetPowerMode(); if (newMode != powerMode) { + acpi->SetPower(0xa0); if (newMode < powerSize) { if (powerMode == powerSize) { acpi->SetGMode(0); @@ -86,7 +87,7 @@ void MonHelper::SetCurrentMode(int newMode) { DebugPrint("Mon: Power mode switch from " + (powerMode == powerSize ? "G-mode" : to_string(powerMode)) + " to " + to_string(newMode) + "\n"); } else { - acpi->SetPower(0xa0); + //acpi->SetPower(0xa0); acpi->SetGMode(1); DebugPrint("Mon: Power mode switch from " + to_string(powerMode) + " to G-mode\n"); } diff --git a/alienfx-cli/alienfx-cli.cpp b/alienfx-cli/alienfx-cli.cpp index 6070751..74dfa83 100644 --- a/alienfx-cli/alienfx-cli.cpp +++ b/alienfx-cli/alienfx-cli.cpp @@ -76,7 +76,7 @@ AlienFX_SDK::Afx_colorcode Act2Code(AlienFX_SDK::Afx_action* act) { } LFX_COLOR Act2Lfx(AlienFX_SDK::Afx_action* act) { - return { act->r,act->g,act->b, 255 }; + return { act->r,act->g,act->b, globalBright }; } vector ParseActions(vector* args, int startPos) { @@ -92,11 +92,14 @@ vector ParseActions(vector* args, int startPos) { argPos++; } actions.push_back({ acttype, sleepy, longer, - (byte)args->at(argPos).num, (byte)args->at(argPos + 1).num, (byte)args->at(argPos + 2).num }); - AlienFX_SDK::Afx_action* color = &actions.back(); - color->r = ((unsigned)color->r * globalBright) / 255;// >> 8; - color->g = ((unsigned)color->g * globalBright) / 255;// >> 8; - color->b = ((unsigned)color->b * globalBright) / 255;// >> 8; + (byte)((args->at(argPos).num * globalBright) / 255), //r + (byte)((args->at(argPos + 1).num * globalBright) / 255), //g + (byte)((args->at(argPos + 2).num * globalBright) / 255) //b + }); + //AlienFX_SDK::Afx_action* color = &actions.back(); + //color->r = ((unsigned)color->r * globalBright) / 255;// >> 8; + //color->g = ((unsigned)color->g * globalBright) / 255;// >> 8; + //color->b = ((unsigned)color->b * globalBright) / 255;// >> 8; } if (actions.size() < 2 && actions.front().type != (devType ? AlienFX_SDK::Action::AlienFX_A_Color : LFX_ACTION_COLOR)) actions.push_back({ actions.front().type, (BYTE)sleepy, longer, 0, 0, 0 }); @@ -105,7 +108,7 @@ vector ParseActions(vector* args, int startPos) { int main(int argc, char* argv[]) { - printf("alienfx-cli v8.6.1.1\n"); + printf("alienfx-cli v9.0.0.2\n"); if (argc < 2) { printUsage(); @@ -268,7 +271,7 @@ int main(int argc, char* argv[]) // low-level if (afx_map.fxdevs.size()) { devType = 1; - printf("Device access selected\n"); + printf("USB Device selected\n"); } break; case COMMANDS::highlevel: @@ -387,7 +390,7 @@ int main(int argc, char* argv[]) } printf("Done."); } else - printf("Both low-level and high-level devices not found, exiting!\n"); + printf("Light devices not found, exiting!\n"); if (have_high) lfxUtil.Release(); diff --git a/alienfx-gui/alienfx-gui.rc b/alienfx-gui/alienfx-gui.rc index 3cffa58d5828e96922edf3f06cfba1702c72d004..1b7a3b4d922e934f4c3dee1d82c5dba28b64f782 100644 GIT binary patch delta 56 zcmca`h~>f|mJQRm7>y=R=Q3n8+I*7hArrF^gVN-U??op!@QZD}!TXL8CeVD3fBQXt H#v(xgYR45u delta 44 zcmca`h~>f|mJQRm7!4;+=Q3n8+Z{sNV902+xzO+@3!~9wMicSLQ_O@W+nIB1o@Z9T1_09H3wHnj delta 33 pcmeCH>Z{sNV902=xzO+@3!~v=MicSLQ_O@W+nIB1o@Z9T1_08x3v~bh