From 809ca465f30a33509b62dfcfa76b5cd299030b68 Mon Sep 17 00:00:00 2001 From: Niellune Date: Sat, 21 Mar 2026 03:44:28 +0200 Subject: [PATCH] Cleanup --- src/application.cpp | 1 - src/application.h | 1 - src/connector.cpp | 13 ------------- src/connector.h | 2 -- src/interface.cpp | 1 - src/pipe_listener.cpp | 1 + src/pipe_listener.h | 5 ++--- src/renderer.cpp | 3 +-- src/renderer.h | 1 - 9 files changed, 4 insertions(+), 24 deletions(-) diff --git a/src/application.cpp b/src/application.cpp index 9a1e21c..d482a51 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -8,7 +8,6 @@ #include "interface.h" #include "decoder.h" #include "pcm_audio.h" -#include "pipe_listener.h" #define EVT_STATUS_OFFSET 0 #define EVT_PHONE_OFFSET 1 diff --git a/src/application.h b/src/application.h index 946aefe..8127350 100644 --- a/src/application.h +++ b/src/application.h @@ -1,7 +1,6 @@ #ifndef SRC_APPLICATION #define SRC_APPLICATION -#include #include #include "helper/protocol_const.h" diff --git a/src/connector.cpp b/src/connector.cpp index 167b35e..577a500 100644 --- a/src/connector.cpp +++ b/src/connector.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include "helper/protocol_const.h" #include "helper/functions.h" @@ -167,16 +166,6 @@ bool Connector::link() return true; } -void Connector::release() -{ - if (_device) - { - libusb_release_interface(_device, 0); - libusb_close(_device); - _device = nullptr; - } -} - bool Connector::state(u_int8_t state) { if (state == _state) @@ -184,7 +173,6 @@ bool Connector::state(u_int8_t state) if (state == PROTOCOL_STATUS_ERROR && _failCount++ < 10) { - _failCount++; return false; } @@ -212,7 +200,6 @@ bool Connector::linkFail(int status, const char *msg) { if (status == 0) return false; - _lastError = msg; std::cout << "[Connection] " << msg << ": " << libusb_error_name(status) << std::endl; state(PROTOCOL_STATUS_ERROR); return true; diff --git a/src/connector.h b/src/connector.h index 4181143..0fee361 100644 --- a/src/connector.h +++ b/src/connector.h @@ -58,7 +58,6 @@ private: void onDisconnect(); bool connect(uint16_t vendor_id, uint16_t product_id); bool link(); - void release(); bool state(u_int8_t state); bool linkFail(int status, const char *msg); @@ -75,7 +74,6 @@ private: uint8_t _state; uint8_t _failCount; uint8_t _nodeviceCount; - std::string _lastError; std::thread _read_thread; std::thread _write_thread; diff --git a/src/interface.cpp b/src/interface.cpp index c335a8f..4b3223a 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -4,7 +4,6 @@ #include "resource/colours.h" #include "settings.h" #include "helper/protocol_const.h" -#include Interface::Interface(SDL_Renderer *renderer) : Renderer(renderer), _state(0), diff --git a/src/pipe_listener.cpp b/src/pipe_listener.cpp index 90f461f..39ac23c 100644 --- a/src/pipe_listener.cpp +++ b/src/pipe_listener.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include diff --git a/src/pipe_listener.h b/src/pipe_listener.h index 66783d4..b041c9f 100644 --- a/src/pipe_listener.h +++ b/src/pipe_listener.h @@ -2,10 +2,9 @@ #define SRC_PIPE_LISTENER #include -#include -#include "protocol.h" -class PipeListener { +class PipeListener +{ public: PipeListener(const char *path); ~PipeListener(); diff --git a/src/renderer.cpp b/src/renderer.cpp index 4e4b01b..8fdb841 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -93,7 +93,7 @@ SDL_Texture *RendererText::getText(SDL_Renderer *renderer, const char *text, SDL } RendererImage::RendererImage(const void *img_data, int img_size) - : width(0), height(0), _surface(nullptr), _aspect(0) + : width(0), height(0), _surface(nullptr) { SDL_RWops *img_rw = SDL_RWFromConstMem(img_data, img_size); if (!img_rw) @@ -130,7 +130,6 @@ SDL_Rect RendererImage::draw(SDL_Renderer *renderer, int w, int h) if (!_texture) return {0, 0, 0, 0}; SDL_GetRendererOutputSize(renderer, &width, &height); - _aspect = 1.0 * height / width; } float scale = 1.0 * h / height; diff --git a/src/renderer.h b/src/renderer.h index 630c123..d19b85f 100644 --- a/src/renderer.h +++ b/src/renderer.h @@ -42,7 +42,6 @@ public: private: SDL_Surface *_surface = nullptr; SDL_Texture *_texture = nullptr; - float _aspect; }; class Renderer