Skip to content

Commit

Permalink
Do not change the lightbar color on screen if call failed
Browse files Browse the repository at this point in the history
  • Loading branch information
igor725 committed Mar 23, 2024
1 parent 4e1502a commit dc9bd12
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
22 changes: 12 additions & 10 deletions input/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

Controller::Controller() {
this->currPadColor = 0;
this->padColors[0] = {0xff, 0xff, 0xff};
this->padColors[1] = {0x00, 0xff, 0x00};
this->padColors[2] = {0xff, 0x00, 0x00};
this->padColors[3] = {0x00, 0x00, 0xff};
this->padColors[4] = {0xff, 0xff, 0x00};
this->padColors[5] = {0xff, 0x00, 0xff};
this->padColors[6] = {0x00, 0xff, 0xff};
this->padColors[7] = {0xff, 0xff, 0xff};
this->padColors[0] = {0xff, 0xff, 0xff, 0xff};
this->padColors[1] = {0x00, 0xff, 0x00, 0xff};
this->padColors[2] = {0xff, 0x00, 0x00, 0xff};
this->padColors[3] = {0x00, 0x00, 0xff, 0xff};
this->padColors[4] = {0xff, 0xff, 0x00, 0xff};
this->padColors[5] = {0xff, 0x00, 0xff, 0xff};
this->padColors[6] = {0x00, 0xff, 0xff, 0xff};
this->padColors[7] = {0xff, 0xff, 0xff, 0xff};
}

Controller::~Controller() {}
Expand Down Expand Up @@ -163,8 +163,10 @@ bool Controller::TouchpadPressed() {
}

OrbisPadColor Controller::NextColor() {
scePadSetLightBar(this->pad, &this->padColors[this->currPadColor = (this->currPadColor + 1) % 7]);
return this->padColors[this->currPadColor];
if (scePadSetLightBar(this->pad, &this->padColors[this->currPadColor = (this->currPadColor + 1) % 7]) == 0)
return this->padColors[this->currPadColor];

return {0x00, 0x00, 0x00, 0x00};
}

void Controller::ReadSticks(float *leftx, float *lefty, float *rightx, float *righty) {
Expand Down
2 changes: 2 additions & 0 deletions input/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ std::stringstream debugLogStream;
int frameID = 0;

static void repaintBar(PNG *png, OrbisPadColor newColor) {
if (newColor.a == 0) return;

static uint32_t prevColor = 0xFFFFFFFF;
uint32_t newColorU32 =
((uint32_t)newColor.r << 00) |
Expand Down

0 comments on commit dc9bd12

Please sign in to comment.