mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-14 10:46:51 -07:00
Fix switch GUI multiple hosts SetEventConnectedCallback
This commit is contained in:
parent
6fec401252
commit
a1b081bfce
6 changed files with 19 additions and 13 deletions
|
@ -81,7 +81,6 @@ class Host
|
|||
ChiakiSession session;
|
||||
ChiakiOpusDecoder opus_decoder;
|
||||
ChiakiConnectVideoProfile video_profile;
|
||||
ChiakiControllerState keyboard_state;
|
||||
friend class Settings;
|
||||
friend class DiscoveryManager;
|
||||
|
||||
|
|
|
@ -37,10 +37,6 @@ HostInterface::HostInterface(IO * io, Host * host, Settings * settings)
|
|||
"Host configuration", true);
|
||||
this->addView(info);
|
||||
|
||||
// push opengl chiaki stream
|
||||
// when the host is connected
|
||||
this->io->SetEventConnectedCallback(std::bind(&HostInterface::Stream, this));
|
||||
this->io->SetEventQuitCallback(std::bind(&HostInterface::CloseStream, this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
HostInterface::~HostInterface()
|
||||
|
@ -173,7 +169,7 @@ void HostInterface::Connect(brls::View * view)
|
|||
}
|
||||
|
||||
// ignore state for remote hosts
|
||||
if(this->host->IsDiscovered() && this->host->IsReady())
|
||||
if(this->host->IsDiscovered() && !this->host->IsReady())
|
||||
{
|
||||
// host in standby mode
|
||||
DIALOG(ptoyp, "Please turn on your PlayStation");
|
||||
|
@ -198,6 +194,11 @@ void HostInterface::ConnectSession()
|
|||
// user inputs are restored with the CloseStream
|
||||
brls::Application::blockInputs();
|
||||
|
||||
// push opengl chiaki stream
|
||||
// when the host is connected
|
||||
this->io->SetEventConnectedCallback(std::bind(&HostInterface::Stream, this));
|
||||
this->io->SetEventQuitCallback(std::bind(&HostInterface::CloseStream, this, std::placeholders::_1));
|
||||
|
||||
// connect host sesssion
|
||||
this->host->InitSession(this->io);
|
||||
this->host->StartSession();
|
||||
|
@ -596,7 +597,7 @@ PSRemotePlay::PSRemotePlay(IO * io, Host * host)
|
|||
void PSRemotePlay::draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx)
|
||||
{
|
||||
this->io->MainLoop(&this->state);
|
||||
this->host->SendFeedbackState(&state);
|
||||
this->host->SendFeedbackState(&this->state);
|
||||
|
||||
// FPS calculation
|
||||
// this->frame_counter += 1;
|
||||
|
|
|
@ -148,8 +148,6 @@ int Host::InitSession(IO * user)
|
|||
|
||||
memcpy(chiaki_connect_info.regist_key, this->rp_regist_key, sizeof(chiaki_connect_info.regist_key));
|
||||
memcpy(chiaki_connect_info.morning, this->rp_key, sizeof(chiaki_connect_info.morning));
|
||||
// set keybord state to 0
|
||||
memset(&(this->keyboard_state), 0, sizeof(keyboard_state));
|
||||
|
||||
ChiakiErrorCode err = chiaki_session_init(&(this->session), &chiaki_connect_info, this->log);
|
||||
if(err != CHIAKI_ERR_SUCCESS)
|
||||
|
|
|
@ -439,6 +439,8 @@ bool IO::ReadGameKeys(SDL_Event *event, ChiakiControllerState *state)
|
|||
switch(event->type)
|
||||
{
|
||||
case SDL_JOYAXISMOTION:
|
||||
// printf("SDL_JOYAXISMOTION jaxis %d axis %d value %d\n",
|
||||
// event->jaxis.which, event->jaxis.axis, event->jaxis.value);
|
||||
if(event->jaxis.which == 0)
|
||||
{
|
||||
// left joystick
|
||||
|
@ -474,7 +476,7 @@ bool IO::ReadGameKeys(SDL_Event *event, ChiakiControllerState *state)
|
|||
break;
|
||||
case SDL_JOYBUTTONDOWN:
|
||||
// printf("Joystick %d button %d DOWN\n",
|
||||
// event->jbutton.which, event->jbutton.button);
|
||||
// event->jbutton.which, event->jbutton.button);
|
||||
switch(event->jbutton.button)
|
||||
{
|
||||
case 0: state->buttons |= CHIAKI_CONTROLLER_BUTTON_MOON; break; // KEY_A
|
||||
|
@ -501,7 +503,7 @@ bool IO::ReadGameKeys(SDL_Event *event, ChiakiControllerState *state)
|
|||
break;
|
||||
case SDL_JOYBUTTONUP:
|
||||
// printf("Joystick %d button %d UP\n",
|
||||
// event->jbutton.which, event->jbutton.button);
|
||||
// event->jbutton.which, event->jbutton.button);
|
||||
switch(event->jbutton.button)
|
||||
{
|
||||
case 0: state->buttons ^= CHIAKI_CONTROLLER_BUTTON_MOON; break; // KEY_A
|
||||
|
|
|
@ -56,7 +56,7 @@ static void initNxLink()
|
|||
|
||||
s_nxlinkSock = nxlinkStdio();
|
||||
if(s_nxlinkSock >= 0)
|
||||
printf("initNxLink");
|
||||
printf("initNxLink\n");
|
||||
else
|
||||
socketExit();
|
||||
}
|
||||
|
@ -83,6 +83,12 @@ extern "C" void userAppInit()
|
|||
// load socket custom config
|
||||
socketInitialize(&g_chiakiSocketInitConfig);
|
||||
setsysInitialize();
|
||||
|
||||
// padConfigureInput(1, HidNpadStyleSet_NpadStandard);
|
||||
// PadState pad;
|
||||
// padInitializeDefault(&pad);
|
||||
|
||||
//hidInitializeTouchScreen();
|
||||
}
|
||||
|
||||
extern "C" void userAppExit()
|
||||
|
|
|
@ -8,7 +8,7 @@ Settings::Settings()
|
|||
{
|
||||
#if defined(__SWITCH__) && !defined(CHIAKI_ENABLE_SWITCH_NXLINK)
|
||||
// null log for switch version
|
||||
chiaki_log_init(&this->log, 0, chiaki_log_cb_print, NULL);
|
||||
chiaki_log_init(&this->log, CHIAKI_LOG_ALL ^ CHIAKI_LOG_VERBOSE, chiaki_log_cb_print, NULL);
|
||||
#else
|
||||
chiaki_log_init(&this->log, CHIAKI_LOG_ALL ^ CHIAKI_LOG_VERBOSE, chiaki_log_cb_print, NULL);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue