Add Pro controllers colors change

Unfortunatelly, no hw no test. So I took users testing for granted..

Had to change my Joy-Con to be recognisable as a Pro Controller to test that the buttons color work on Pro controller on Switch and that the default white is actually to distinguish them from the black body.

Note: Now Pro buttons WHITE color will be previewed as Grey.
This commit is contained in:
Kostas Missos committed 2017-09-15 05:11:41 +03:00
1 parent f42fa57835
commit 9231d263ba
3 files changed
+32 -23

No files matched your search

+17 -8
View File
@@ -37,7 +37,6 @@ namespace CppWinFormJoy {
else {
this->textBoxSN->Text = L"No S/N";
this->textBox_chg_sn->Text = this->textBoxSN->Text;
this->btnClrDlg2->Visible = false;
}
unsigned char device_info[10];
memset(device_info, 0, sizeof(device_info));
@@ -2010,7 +2009,7 @@ namespace CppWinFormJoy {
return;
}
set_led_busy();
if (MessageBox::Show(L"Don't forget to make a backup first!\nYou can also find retail colors at the bottom of the colors dialog for each type.\n\nNote: Pro controller buttons cannot be changed.\n\nAre you sure you want to continue?", L"Warning!", MessageBoxButtons::YesNo, MessageBoxIcon::Warning) == System::Windows::Forms::DialogResult::Yes)
if (MessageBox::Show(L"Don't forget to make a backup first!\nYou can also find retail colors at the bottom of the colors dialog for each type.\n\nAre you sure you want to continue?", L"Warning!", MessageBoxButtons::YesNo, MessageBoxIcon::Warning) == System::Windows::Forms::DialogResult::Yes)
{
this->btnWriteBody->Enabled = false;
@@ -2028,8 +2027,7 @@ namespace CppWinFormJoy {
button_color[2] = (u8)colorDialog2->Color.B;
write_spi_data(0x6050, 0x3, body_color);
if (handle_ok != 3)
write_spi_data(0x6053, 0x3, button_color);
write_spi_data(0x6053, 0x3, button_color);
send_rumble();
MessageBox::Show(L"The colors were writen to the device!", L"Done!", MessageBoxButtons::OK, MessageBoxIcon::Asterisk);
@@ -2042,7 +2040,7 @@ namespace CppWinFormJoy {
}
private: System::Void btnClrDlg1_Click(System::Object^ sender, System::EventArgs^ e) {
if(handle_ok !=3 )
if(handle_ok != 3 )
this->colorDialog1->CustomColors = getCustomColorFromConfig("bodycolors");
else
this->colorDialog1->CustomColors = getCustomColorFromConfig("bodycolors_pro");
@@ -2158,13 +2156,25 @@ namespace CppWinFormJoy {
if (gotColor.R <= 255 && gotColor.R > 100){
gotColor = Color::FromArgb(gotColor.A, CLAMP(r*color_coeff, 0.0f, 255.0f), CLAMP(g*color_coeff, 0.0f, 255.0f), CLAMP(b*color_coeff, 0.0f, 255.0f));
}
else if (gotColor.R <= 100 && gotColor.R != 78 && gotColor.R > 30 && handle_ok !=3) {
else if (handle_ok != 3 && gotColor.R <= 100 && gotColor.R != 78 && gotColor.R > 30) {
if (gotColor.R == 100)
gotColor = Color::FromArgb(gotColor.A, rb, gb, bb);
else {
gotColor = Color::FromArgb(gotColor.A, CLAMP(rb*color_coeff, 0.0f, 255.0f), CLAMP(gb*color_coeff, 0.0f, 255.0f), CLAMP(bb*color_coeff, 0.0f, 255.0f));
}
}
else if (handle_ok == 3 && gotColor.R <= 100 && gotColor.R != 78 && gotColor.R > 30) {
if (rb == 255 && gb == 255 && bb == 255) {
//Do nothing
}
else {
if (gotColor.R == 100)
gotColor = Color::FromArgb(gotColor.A, rb, gb, bb);
else {
gotColor = Color::FromArgb(gotColor.A, CLAMP(rb*color_coeff, 0.0f, 255.0f), CLAMP(gb*color_coeff, 0.0f, 255.0f), CLAMP(bb*color_coeff, 0.0f, 255.0f));
}
}
}
MyImage->SetPixel(x, y, gotColor);
}
@@ -2191,8 +2201,7 @@ namespace CppWinFormJoy {
memset(button_color, 0, 0x3);
get_spi_data(0x6050, 0x3, body_color);
if (handle_ok != 3)
get_spi_data(0x6053, 0x3, button_color);
get_spi_data(0x6053, 0x3, button_color);
update_joycon_color((u8)body_color[0], (u8)body_color[1], (u8)body_color[2], (u8)button_color[0], (u8)button_color[1], (u8)button_color[2]);
+11 -11
View File
@@ -132,6 +132,17 @@
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>37</value>
</metadata>
<data name="label_sn_change_warning.Text" xml:space="preserve">
<value>Make a backup first!
If you lose your serial number, bad things will happen!
If you currently have the stock S/N, this will also create a backup of it inside the SPI.
Restore it either here from the SPI backed up S/N or through Restore option from your SPI backup.
Maximum 15 ASCII characters.</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
@@ -212,17 +223,6 @@
<metadata name="errorProvider2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>504, 17</value>
</metadata>
<data name="label_sn_change_warning.Text" xml:space="preserve">
<value>Make a backup first!
If you lose your serial number, bad things will happen!
If you currently have the stock S/N, this will also create a backup of it inside the SPI.
Restore it either here from the SPI backed up S/N or through Restore option from your SPI backup.
Maximum 15 ASCII characters.</value>
</data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>634, 17</value>
</metadata>
+4 -4
View File
@@ -66,8 +66,8 @@ int set_led_busy() {
//Set breathing HOME Led
if (handle_ok != 1) {
memset(buf, 0, sizeof(buf));
auto hdr = (brcm_hdr *)buf;
auto pkt = (brcm_cmd_01 *)(hdr + 1);
hdr = (brcm_hdr *)buf;
pkt = (brcm_cmd_01 *)(hdr + 1);
hdr->cmd = 0x01;
hdr->rumble[0] = timming_byte;
timming_byte++;
@@ -408,8 +408,8 @@ int send_rumble() {
//Heartbeat HOME Led
if (handle_ok != 1) {
memset(buf, 0, sizeof(buf));
auto hdr = (brcm_hdr *)buf;
auto pkt = (brcm_cmd_01 *)(hdr + 1);
hdr = (brcm_hdr *)buf;
pkt = (brcm_cmd_01 *)(hdr + 1);
hdr->cmd = 0x01;
hdr->rumble[0] = timming_byte;
timming_byte++;