mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-04-04 06:11:07 -04:00
Zone and Segment type updates
* Add zone flags to indicate if fields are manually configurable and if they have been manually configured * Add flags field to segment type * Add segment flags for group start and group member * Add color mode support flags to zone (RGB, RBG, GRB, GBR, BRG, BGR) * Add color mode enum to zone * Update zone and segment description functions to support new fields * Rename the effects-only configurable size flag * Remove zone type and matrix map configuration from E1.31 manual configuration, use zone editor instead * Rework DeviceResizeZone to DeviceConfigureZone * Rework most ARGB controllers to allow zone customizations * Rework DRGBController to define devices in DRGBDevices list (similar to RazerDevices) * Rework NollieController to define devices in NollieDevices list (similar to RazerDevices)
This commit is contained in:
@@ -1412,6 +1412,25 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
goto listen_done;
|
||||
}
|
||||
break;
|
||||
|
||||
case NET_PACKET_ID_RGBCONTROLLER_CONFIGUREZONE:
|
||||
/*-----------------------------------------*\
|
||||
| Verify the packet size in the packet data |
|
||||
| (first 4 bytes of data) matches the |
|
||||
| packet size in the header |
|
||||
\*-----------------------------------------*/
|
||||
if((data != NULL)
|
||||
&& (header.pkt_size >= sizeof(unsigned int))
|
||||
&& (header.pkt_size == *((unsigned int*)data)))
|
||||
{
|
||||
ProcessRequest_RGBController_ConfigureZone(header.pkt_dev_id, (unsigned char *)data, client_info->client_protocol_version);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("[%s] ConfigureZone packet has invalid size. Packet size: %d", header.pkt_size, NETWORKSERVER);
|
||||
goto listen_done;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(delete_data)
|
||||
@@ -1727,6 +1746,49 @@ void NetworkServer::ProcessRequest_RGBController_ClearSegments(unsigned int cont
|
||||
profile_manager->SaveSizes();
|
||||
}
|
||||
|
||||
void NetworkServer::ProcessRequest_RGBController_ConfigureZone(unsigned int controller_id, unsigned char * data_ptr, unsigned int protocol_version)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Convert ID to index |
|
||||
\*-----------------------------------------------------*/
|
||||
bool idx_valid;
|
||||
unsigned int controller_idx = index_from_id(controller_id, protocol_version, &idx_valid);
|
||||
int zone_idx;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| If controller ID is invalid, return |
|
||||
\*-----------------------------------------------------*/
|
||||
if(!idx_valid)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Skip data size |
|
||||
\*-----------------------------------------------------*/
|
||||
data_ptr += sizeof(unsigned int);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Copy in zone index |
|
||||
\*-----------------------------------------------------*/
|
||||
memcpy(&zone_idx, data_ptr, sizeof(zone_idx));
|
||||
data_ptr += sizeof(zone_idx);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Configure zone |
|
||||
\*-----------------------------------------------------*/
|
||||
zone new_zone;
|
||||
|
||||
data_ptr = controllers[controller_idx]->SetZoneDescription(data_ptr, &new_zone, protocol_version);
|
||||
|
||||
controllers[controller_idx]->ConfigureZone(zone_idx, new_zone);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Save sizes |
|
||||
\*-----------------------------------------------------*/
|
||||
profile_manager->SaveSizes();
|
||||
}
|
||||
|
||||
void NetworkServer::ProcessRequest_RGBController_ResizeZone(unsigned int controller_id, unsigned char * data_ptr, unsigned int protocol_version)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
|
||||
Reference in New Issue
Block a user