diff --git a/Common/Net/NetBuffer.cpp b/Common/Net/NetBuffer.cpp index 4309f18d05..17a5aae916 100644 --- a/Common/Net/NetBuffer.cpp +++ b/Common/Net/NetBuffer.cpp @@ -37,8 +37,9 @@ bool Buffer::FlushSocket(uintptr_t sock, double timeout, bool *cancelled) { } } int sent = send(sock, &data_[pos], (int)(end - pos), MSG_NOSIGNAL); + // TODO: Do we need some retry logic here, instead of just giving up? if (sent < 0) { - ERROR_LOG(IO, "FlushSocket failed"); + ERROR_LOG(IO, "FlushSocket failed to send: %d", errno); return false; } pos += sent; diff --git a/Common/UI/PopupScreens.cpp b/Common/UI/PopupScreens.cpp index 1c5bed19c4..a15832fc79 100644 --- a/Common/UI/PopupScreens.cpp +++ b/Common/UI/PopupScreens.cpp @@ -343,7 +343,6 @@ void SliderFloatPopupScreen::CreatePopupContents(UI::ViewGroup *parent) { edit_->SetTextColor(dc.theme->itemStyle.fgColor); edit_->SetTextAlign(FLAG_DYNAMIC_ASCII); edit_->OnTextChange.Handle(this, &SliderFloatPopupScreen::OnTextChange); - changing_ = false; lin->Add(edit_); if (!units_.empty()) lin->Add(new TextView(units_, new LinearLayoutParams(10.0f)))->SetTextColor(dc.theme->itemStyle.fgColor); diff --git a/Common/UI/PopupScreens.h b/Common/UI/PopupScreens.h index 403b3955bf..cd25f81104 100644 --- a/Common/UI/PopupScreens.h +++ b/Common/UI/PopupScreens.h @@ -99,7 +99,7 @@ private: class SliderFloatPopupScreen : public PopupScreen { public: SliderFloatPopupScreen(float *value, float minValue, float maxValue, const std::string &title, float step = 1.0f, const std::string &units = "", bool liveUpdate = false) - : PopupScreen(title, "OK", "Cancel"), units_(units), value_(value), originalValue_(*value), minValue_(minValue), maxValue_(maxValue), step_(step), changing_(false), liveUpdate_(liveUpdate) {} + : PopupScreen(title, "OK", "Cancel"), units_(units), value_(value), originalValue_(*value), minValue_(minValue), maxValue_(maxValue), step_(step), liveUpdate_(liveUpdate) {} void CreatePopupContents(UI::ViewGroup *parent) override; const char *tag() const override { return "SliderFloatPopup"; } @@ -115,13 +115,13 @@ private: UI::SliderFloat *slider_ = nullptr; UI::TextEdit *edit_ = nullptr; std::string units_ = nullptr; - float sliderValue_; - float originalValue_; + float sliderValue_ = 0.0f; + float originalValue_ = 0.0f; float *value_; float minValue_; float maxValue_; float step_; - bool changing_; + bool changing_ = false; bool liveUpdate_; }; diff --git a/Common/UI/Screen.cpp b/Common/UI/Screen.cpp index d06a26cd13..59ea6a320b 100644 --- a/Common/UI/Screen.cpp +++ b/Common/UI/Screen.cpp @@ -202,7 +202,9 @@ void ScreenManager::sendMessage(const char *msg, const char *value) { if (!strcmp(msg, "recreateviews")) RecreateAllViews(); if (!strcmp(msg, "lost_focus")) { - TouchInput input; + TouchInput input{}; + input.x = -50000.0f; + input.y = -50000.0f; input.flags = TOUCH_RELEASE_ALL; input.timestamp = time_now_d(); input.id = 0; @@ -238,7 +240,9 @@ void ScreenManager::push(Screen *screen, int layerFlags) { // Release touches and unfocus. UI::SetFocusedView(nullptr); - TouchInput input; + TouchInput input{}; + input.x = -50000.0f; + input.y = -50000.0f; input.flags = TOUCH_RELEASE_ALL; input.timestamp = time_now_d(); input.id = 0; diff --git a/Common/UI/UIScreen.cpp b/Common/UI/UIScreen.cpp index 887e71ff49..643ab6a3c4 100644 --- a/Common/UI/UIScreen.cpp +++ b/Common/UI/UIScreen.cpp @@ -217,14 +217,13 @@ UI::EventReturn UIScreen::OnCancel(UI::EventParams &e) { } PopupScreen::PopupScreen(std::string title, std::string button1, std::string button2) - : box_(0), defaultButton_(nullptr), title_(title) { + : title_(title) { auto di = GetI18NCategory("Dialog"); if (!button1.empty()) button1_ = di->T(button1.c_str()); if (!button2.empty()) button2_ = di->T(button2.c_str()); - - alpha_ = 0.0f; + alpha_ = 0.0f; // inherited } void PopupScreen::touch(const TouchInput &touch) { diff --git a/Common/UI/UIScreen.h b/Common/UI/UIScreen.h index a868485e65..c567488901 100644 --- a/Common/UI/UIScreen.h +++ b/Common/UI/UIScreen.h @@ -98,7 +98,7 @@ protected: private: UI::LinearLayout *box_; - UI::Button *defaultButton_; + UI::Button *defaultButton_ = nullptr; std::string title_; std::string button1_; std::string button2_; @@ -110,7 +110,7 @@ private: int frames_ = 0; int finishFrame_ = -1; - DialogResult finishResult_; + DialogResult finishResult_ = DR_CANCEL; bool hasPopupOrigin_ = false; Point popupOrigin_; float offsetY_ = 0.0f; diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index 376bf89427..211314d016 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -1011,7 +1011,7 @@ int main(int argc, char *argv[]) { case SDL_BUTTON_LEFT: { mouseDown = true; - TouchInput input; + TouchInput input{}; input.x = mx; input.y = my; input.flags = TOUCH_DOWN | TOUCH_MOUSE; @@ -1065,7 +1065,7 @@ int main(int argc, char *argv[]) { } case SDL_MOUSEMOTION: if (mouseDown) { - TouchInput input; + TouchInput input{}; input.x = mx; input.y = my; input.flags = TOUCH_MOVE | TOUCH_MOUSE; @@ -1080,7 +1080,7 @@ int main(int argc, char *argv[]) { case SDL_BUTTON_LEFT: { mouseDown = false; - TouchInput input; + TouchInput input{}; input.x = mx; input.y = my; input.flags = TOUCH_UP | TOUCH_MOUSE; diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index de209af581..fbc6a7bfb3 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -1315,7 +1315,7 @@ static void DrawFPS(UIContext *ctx, const Bounds &bounds) { snprintf(fpsbuf, sizeof(fpsbuf), "%0.0f/%0.0f (%0.1f%%)", actual_fps, fps, vps / (59.94f / 100.0f)); } else { if (g_Config.iShowStatusFlags & (int)ShowStatusFlags::FPS_COUNTER) { - snprintf(fpsbuf, sizeof(fpsbuf), "%s FPS: %0.1f", fpsbuf, actual_fps); + snprintf(fpsbuf, sizeof(fpsbuf), "FPS: %0.1f", actual_fps); } if (g_Config.iShowStatusFlags & (int)ShowStatusFlags::SPEED_COUNTER) { snprintf(fpsbuf, sizeof(fpsbuf), "%s Speed: %0.1f%%", fpsbuf, vps / (59.94f / 100.0f)); @@ -1327,7 +1327,7 @@ static void DrawFPS(UIContext *ctx, const Bounds &bounds) { snprintf(fpsbuf, sizeof(fpsbuf), "%s Battery: %d%%", fpsbuf, getCurrentBatteryCapacity()); } #endif - + ctx->Flush(); ctx->BindFontTexture(); ctx->Draw()->SetFontScale(0.7f, 0.7f);