mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-20 05:23:12 -07:00
Refactor IO class as singleton
This commit is contained in:
parent
a1b081bfce
commit
d31fb46ae8
8 changed files with 462 additions and 379 deletions
|
@ -11,55 +11,55 @@
|
|||
|
||||
#include <borealis.hpp>
|
||||
|
||||
#include <thread>
|
||||
#include <map>
|
||||
#include <thread>
|
||||
|
||||
#include "host.h"
|
||||
#include "settings.h"
|
||||
#include "discoverymanager.h"
|
||||
#include "host.h"
|
||||
#include "io.h"
|
||||
#include "settings.h"
|
||||
|
||||
class HostInterface : public brls::List
|
||||
{
|
||||
private:
|
||||
IO * io;
|
||||
Host * host;
|
||||
Settings * settings;
|
||||
IO *io;
|
||||
Host *host;
|
||||
Settings *settings;
|
||||
bool connected = false;
|
||||
|
||||
public:
|
||||
HostInterface(IO * io, Host * host, Settings * settings);
|
||||
HostInterface(Host *host);
|
||||
~HostInterface();
|
||||
|
||||
static void Register(IO * io, Host * host,
|
||||
Settings * settings, std::function<void()> success_cb = nullptr);
|
||||
static void Register(Host *host, std::function<void()> success_cb = nullptr);
|
||||
void Register();
|
||||
void Wakeup(brls::View * view);
|
||||
void Connect(brls::View * view);
|
||||
void Wakeup(brls::View *view);
|
||||
void Connect(brls::View *view);
|
||||
void ConnectSession();
|
||||
void Disconnect();
|
||||
bool Stream();
|
||||
bool CloseStream(ChiakiQuitEvent * quit);
|
||||
void Stream();
|
||||
void CloseStream(ChiakiQuitEvent *quit);
|
||||
};
|
||||
|
||||
class MainApplication
|
||||
{
|
||||
private:
|
||||
Settings * settings;
|
||||
ChiakiLog * log;
|
||||
DiscoveryManager * discoverymanager;
|
||||
IO * io;
|
||||
brls::TabFrame * rootFrame;
|
||||
Settings *settings;
|
||||
ChiakiLog *log;
|
||||
DiscoveryManager *discoverymanager;
|
||||
IO *io;
|
||||
brls::TabFrame *rootFrame;
|
||||
std::map<Host *, HostInterface *> host_menuitems;
|
||||
// add_host local settings
|
||||
std::string remote_display_name = "";
|
||||
std::string remote_addr = "";
|
||||
ChiakiTarget remote_ps_version = CHIAKI_TARGET_PS5_1;
|
||||
|
||||
bool BuildConfigurationMenu(brls::List *, Host * host = nullptr);
|
||||
bool BuildConfigurationMenu(brls::List *, Host *host = nullptr);
|
||||
void BuildAddHostConfigurationMenu(brls::List *);
|
||||
public:
|
||||
MainApplication(DiscoveryManager * discoverymanager, IO * io);
|
||||
|
||||
public:
|
||||
MainApplication(DiscoveryManager *discoverymanager);
|
||||
~MainApplication();
|
||||
bool Load();
|
||||
};
|
||||
|
@ -67,24 +67,23 @@ class MainApplication
|
|||
class PSRemotePlay : public brls::View
|
||||
{
|
||||
private:
|
||||
brls::AppletFrame * frame;
|
||||
brls::AppletFrame *frame;
|
||||
// to display stream on screen
|
||||
IO * io;
|
||||
IO *io;
|
||||
// to send gamepad inputs
|
||||
Host * host;
|
||||
brls::Label * label;
|
||||
ChiakiControllerState state = { 0 };
|
||||
Host *host;
|
||||
brls::Label *label;
|
||||
ChiakiControllerState state = {0};
|
||||
// FPS calculation
|
||||
// double base_time;
|
||||
// int frame_counter = 0;
|
||||
// int fps = 0;
|
||||
|
||||
public:
|
||||
PSRemotePlay(IO * io, Host * host);
|
||||
PSRemotePlay(Host *host);
|
||||
~PSRemotePlay();
|
||||
|
||||
void draw(NVGcontext * vg, int x, int y, unsigned width, unsigned height, brls::Style * style, brls::FrameContext * ctx) override;
|
||||
void draw(NVGcontext *vg, int x, int y, unsigned width, unsigned height, brls::Style *style, brls::FrameContext *ctx) override;
|
||||
};
|
||||
|
||||
#endif // CHIAKI_GUI_H
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue