mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-21 05:53:12 -07:00
Add More RP-Application-Reason
This commit is contained in:
parent
1f307116c6
commit
947b01250b
4 changed files with 41 additions and 8 deletions
|
@ -58,7 +58,7 @@ RegistDialog::RegistDialog(Settings *settings, const QString &host, QWidget *par
|
|||
broadcast_check_box->setChecked(host.isEmpty());
|
||||
|
||||
psn_id_edit = new QLineEdit(this);
|
||||
form_layout->addRow(tr("PSN ID (username):"), psn_id_edit);
|
||||
form_layout->addRow(tr("PSN ID (username, case-sensitive):"), psn_id_edit);
|
||||
|
||||
pin_edit = new QLineEdit(this);
|
||||
pin_edit->setValidator(new QRegularExpressionValidator(pin_re, pin_edit));
|
||||
|
|
|
@ -38,6 +38,13 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CHIAKI_RP_APPLICATION_REASON_REGIST_FAILED 0x80108b09
|
||||
#define CHIAKI_RP_APPLICATION_REASON_INVALID_PSN_ID 0x80108b02
|
||||
#define CHIAKI_RP_APPLICATION_REASON_IN_USE 0x80108b10
|
||||
#define CHIAKI_RP_APPLICATION_REASON_CRASH 0x80108b15
|
||||
|
||||
const char *chiaki_rp_application_reason_string(uint32_t reason);
|
||||
|
||||
|
||||
#define CHIAKI_RP_DID_SIZE 32
|
||||
#define CHIAKI_SESSION_ID_SIZE_MAX 80
|
||||
|
|
|
@ -453,6 +453,17 @@ static ChiakiErrorCode regist_recv_response(ChiakiRegist *regist, ChiakiRegister
|
|||
if(http_response.code != 200)
|
||||
{
|
||||
CHIAKI_LOGE(regist->log, "Regist received HTTP code %d", http_response.code);
|
||||
|
||||
for(ChiakiHttpHeader *header=http_response.headers; header; header=header->next)
|
||||
{
|
||||
if(strcmp(header->key, "RP-Application-Reason") == 0)
|
||||
{
|
||||
uint32_t reason = strtoul(header->value, NULL, 0x10);
|
||||
CHIAKI_LOGE(regist->log, "Reported Application Reason: %#x (%s)", (unsigned int)reason, chiaki_rp_application_reason_string(reason));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
chiaki_http_response_fini(&http_response);
|
||||
return CHIAKI_ERR_UNKNOWN;
|
||||
}
|
||||
|
|
|
@ -42,11 +42,27 @@
|
|||
|
||||
#define SESSION_PORT 9295
|
||||
|
||||
#define RP_APPLICATION_REASON_IN_USE 0x80108b10
|
||||
#define RP_APPLICATION_REASON_CRASH 0x80108b15
|
||||
|
||||
#define SESSION_EXPECT_TIMEOUT_MS 5000
|
||||
|
||||
|
||||
const char *chiaki_rp_application_reason_string(uint32_t reason)
|
||||
{
|
||||
switch(reason)
|
||||
{
|
||||
case CHIAKI_RP_APPLICATION_REASON_REGIST_FAILED:
|
||||
return "Regist failed, probably invalid PIN";
|
||||
case CHIAKI_RP_APPLICATION_REASON_INVALID_PSN_ID:
|
||||
return "Invalid PSN ID";
|
||||
case CHIAKI_RP_APPLICATION_REASON_IN_USE:
|
||||
return "Remote is already in use";
|
||||
case CHIAKI_RP_APPLICATION_REASON_CRASH:
|
||||
return "Remote Play on Console crashed";
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CHIAKI_EXPORT void chiaki_connect_video_profile_preset(ChiakiConnectVideoProfile *profile, ChiakiVideoResolutionPreset resolution, ChiakiVideoFPSPreset fps)
|
||||
{
|
||||
switch(resolution)
|
||||
|
@ -626,14 +642,13 @@ static bool session_thread_request_session(ChiakiSession *session)
|
|||
}
|
||||
else
|
||||
{
|
||||
CHIAKI_LOGE(session->log, "Reported Application Reason: %#x (%s)", (unsigned int)response.error_code, chiaki_rp_application_reason_string(response.error_code));
|
||||
switch(response.error_code)
|
||||
{
|
||||
case RP_APPLICATION_REASON_IN_USE:
|
||||
CHIAKI_LOGE(session->log, "Remote is already in use");
|
||||
case CHIAKI_RP_APPLICATION_REASON_IN_USE:
|
||||
session->quit_reason = CHIAKI_QUIT_REASON_SESSION_REQUEST_RP_IN_USE;
|
||||
break;
|
||||
case RP_APPLICATION_REASON_CRASH:
|
||||
CHIAKI_LOGE(session->log, "Remote seems to have crashed");
|
||||
case CHIAKI_RP_APPLICATION_REASON_CRASH:
|
||||
session->quit_reason = CHIAKI_QUIT_REASON_SESSION_REQUEST_RP_CRASH;
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue