Fix switch PS5 discovery & wakeup PORT

This commit is contained in:
h0neybadger 2020-12-25 20:06:21 +01:00 committed by Florian Märkl
commit ad9b0f3d19
No known key found for this signature in database
GPG key ID: 125BC8A5A6A1E857
6 changed files with 132 additions and 134 deletions

View file

@ -6,25 +6,26 @@
#include <map>
#include <string>
#include <chiaki/log.h>
#include <chiaki/discoveryservice.h>
#include <chiaki/log.h>
#include "host.h"
#include "settings.h"
static void Discovery(ChiakiDiscoveryHost*, void*);
static void Discovery(ChiakiDiscoveryHost *, void *);
class DiscoveryManager
{
private:
Settings * settings;
ChiakiLog * log;
Settings * settings = nullptr;
ChiakiLog * log = nullptr;
ChiakiDiscoveryService service;
ChiakiDiscovery discovery;
struct sockaddr * host_addr;
size_t host_addr_len;
struct sockaddr * host_addr = nullptr;
size_t host_addr_len = 0;
uint32_t GetIPv4BroadcastAddr();
bool service_enable;
public:
typedef enum hoststate
{
@ -34,13 +35,13 @@ class DiscoveryManager
SHUTDOWN,
} HostState;
DiscoveryManager(Settings *settings);
DiscoveryManager();
~DiscoveryManager();
void SetService(bool);
int Send();
int Send(struct sockaddr *host_addr, size_t host_addr_len);
int Send(struct sockaddr * host_addr, size_t host_addr_len);
int Send(const char *);
void DiscoveryCB(ChiakiDiscoveryHost*);
void DiscoveryCB(ChiakiDiscoveryHost *);
};
#endif //CHIAKI_DISCOVERYMANAGER_H

View file

@ -3,22 +3,22 @@
#ifndef CHIAKI_HOST_H
#define CHIAKI_HOST_H
#include <string>
#include <map>
#include <netinet/in.h>
#include <map>
#include <string>
#include <chiaki/log.h>
#include <chiaki/regist.h>
#include <chiaki/discovery.h>
#include <chiaki/opusdecoder.h>
#include <chiaki/controller.h>
#include <chiaki/discovery.h>
#include <chiaki/log.h>
#include <chiaki/opusdecoder.h>
#include <chiaki/regist.h>
#include "exception.h"
#include "io.h"
#include "settings.h"
class DiscoveryManager;
static void Discovery(ChiakiDiscoveryHost*, void *);
static void Discovery(ChiakiDiscoveryHost *, void *);
static void InitAudioCB(unsigned int channels, unsigned int rate, void * user);
static bool VideoCB(uint8_t * buf, size_t buf_size, void * user);
static void AudioCB(int16_t * buf, size_t samples_count, void * user);
@ -82,10 +82,11 @@ class Host
ChiakiOpusDecoder opus_decoder;
ChiakiConnectVideoProfile video_profile;
ChiakiControllerState keyboard_state;
friend class DiscoveryManager;
friend class Settings;
friend class DiscoveryManager;
public:
Host(ChiakiLog * log, Settings * settings, std::string host_name);
Host(std::string host_name);
~Host();
int Register(std::string pin);
int Wakeup();
@ -93,7 +94,7 @@ class Host
int FiniSession();
void StopSession();
void StartSession();
void SendFeedbackState(ChiakiControllerState*);
void SendFeedbackState(ChiakiControllerState *);
void RegistCB(ChiakiRegistEvent *);
bool GetVideoResolution(int * ret_width, int * ret_height);
std::string GetHostName();
@ -108,6 +109,7 @@ class Host
bool IsDiscovered();
bool IsReady();
bool HasRPkey();
bool IsPS5();
};
#endif