This commit is contained in:
Niellune
2026-03-21 03:44:28 +02:00
parent a06e58133f
commit 809ca465f3
9 changed files with 4 additions and 24 deletions
-1
View File
@@ -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
-1
View File
@@ -1,7 +1,6 @@
#ifndef SRC_APPLICATION
#define SRC_APPLICATION
#include <unistd.h>
#include <SDL2/SDL.h>
#include "helper/protocol_const.h"
-13
View File
@@ -3,7 +3,6 @@
#include <stdexcept>
#include <iostream>
#include <iomanip>
#include <condition_variable>
#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;
-2
View File
@@ -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;
-1
View File
@@ -4,7 +4,6 @@
#include "resource/colours.h"
#include "settings.h"
#include "helper/protocol_const.h"
#include <iostream>
Interface::Interface(SDL_Renderer *renderer)
: Renderer(renderer), _state(0),
+1
View File
@@ -3,6 +3,7 @@
#include <SDL2/SDL.h>
#include <cerrno>
#include <cstring>
#include <fcntl.h>
#include <iostream>
#include <sys/stat.h>
+2 -3
View File
@@ -2,10 +2,9 @@
#define SRC_PIPE_LISTENER
#include <thread>
#include <atomic>
#include "protocol.h"
class PipeListener {
class PipeListener
{
public:
PipeListener(const char *path);
~PipeListener();
+1 -2
View File
@@ -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;
-1
View File
@@ -42,7 +42,6 @@ public:
private:
SDL_Surface *_surface = nullptr;
SDL_Texture *_texture = nullptr;
float _aspect;
};
class Renderer