mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-05 22:47:03 +00:00
Add a message overlay
This commit is contained in:
parent
3dc9a8b980
commit
e68ffdbc81
11 changed files with 259 additions and 27 deletions
|
|
@ -13,6 +13,7 @@
|
|||
#include "Emu/NP/rpcn_config.h"
|
||||
#include "Emu/NP/np_contexts.h"
|
||||
#include "Emu/NP/np_helpers.h"
|
||||
#include "Emu/RSX/Overlays/overlay_message.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
|
|
@ -591,6 +592,7 @@ namespace np
|
|||
|
||||
if (auto state = rpcn->wait_for_connection(); state != rpcn::rpcn_state::failure_no_failure)
|
||||
{
|
||||
rsx::overlays::queue_message(rpcn::rpcn_state_to_localized_string_id(state));
|
||||
rpcn_log.error("Connection to RPCN Failed!");
|
||||
is_psn_active = false;
|
||||
return;
|
||||
|
|
@ -598,11 +600,14 @@ namespace np
|
|||
|
||||
if (auto state = rpcn->wait_for_authentified(); state != rpcn::rpcn_state::failure_no_failure)
|
||||
{
|
||||
rsx::overlays::queue_message(rpcn::rpcn_state_to_localized_string_id(state));
|
||||
rpcn_log.error("RPCN login attempt failed!");
|
||||
is_psn_active = false;
|
||||
return;
|
||||
}
|
||||
|
||||
rsx::overlays::queue_message(localized_string_id::RPCN_SUCCESS_LOGGED_ON);
|
||||
|
||||
string_to_online_name(rpcn->get_online_name(), &online_name);
|
||||
string_to_avatar_url(rpcn->get_avatar_url(), &avatar_url);
|
||||
public_ip_addr = rpcn->get_addr_sig();
|
||||
|
|
|
|||
|
|
@ -49,6 +49,31 @@ std::vector<std::vector<u8>> get_rpcn_msgs();
|
|||
|
||||
namespace rpcn
|
||||
{
|
||||
localized_string_id rpcn_state_to_localized_string_id(rpcn::rpcn_state state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case rpcn::rpcn_state::failure_no_failure: return localized_string_id::RPCN_NO_ERROR;
|
||||
case rpcn::rpcn_state::failure_input: return localized_string_id::RPCN_ERROR_INVALID_INPUT;
|
||||
case rpcn::rpcn_state::failure_wolfssl: return localized_string_id::RPCN_ERROR_WOLFSSL;
|
||||
case rpcn::rpcn_state::failure_resolve: return localized_string_id::RPCN_ERROR_RESOLVE;
|
||||
case rpcn::rpcn_state::failure_connect: return localized_string_id::RPCN_ERROR_CONNECT;
|
||||
case rpcn::rpcn_state::failure_id: return localized_string_id::RPCN_ERROR_LOGIN_ERROR;
|
||||
case rpcn::rpcn_state::failure_id_already_logged_in: return localized_string_id::RPCN_ERROR_ALREADY_LOGGED;
|
||||
case rpcn::rpcn_state::failure_id_username: return localized_string_id::RPCN_ERROR_INVALID_LOGIN;
|
||||
case rpcn::rpcn_state::failure_id_password: return localized_string_id::RPCN_ERROR_INVALID_PASSWORD;
|
||||
case rpcn::rpcn_state::failure_id_token: return localized_string_id::RPCN_ERROR_INVALID_TOKEN;
|
||||
case rpcn::rpcn_state::failure_protocol: return localized_string_id::RPCN_ERROR_INVALID_PROTOCOL_VERSION;
|
||||
case rpcn::rpcn_state::failure_other: return localized_string_id::RPCN_ERROR_UNKNOWN;
|
||||
default: return localized_string_id::INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
std::string rpcn_state_to_string(rpcn::rpcn_state state)
|
||||
{
|
||||
return get_localized_string(rpcn_state_to_localized_string_id(state));
|
||||
}
|
||||
|
||||
constexpr u32 RPCN_PROTOCOL_VERSION = 15;
|
||||
constexpr usz RPCN_HEADER_SIZE = 13;
|
||||
constexpr usz COMMUNICATION_ID_SIZE = 9;
|
||||
|
|
@ -1592,7 +1617,7 @@ namespace rpcn
|
|||
std::copy(service_id.begin(), service_id.end(), std::back_inserter(data));
|
||||
data.push_back(0);
|
||||
const le_t<u32> size = cookie.size();
|
||||
std::copy(reinterpret_cast<const u8 *>(&size), reinterpret_cast<const u8 *>(&size) + sizeof(le_t<u32>), std::back_inserter(data));
|
||||
std::copy(reinterpret_cast<const u8*>(&size), reinterpret_cast<const u8*>(&size) + sizeof(le_t<u32>), std::back_inserter(data));
|
||||
std::copy(cookie.begin(), cookie.end(), std::back_inserter(data));
|
||||
|
||||
if (!forge_send(CommandType::RequestTicket, req_id, data))
|
||||
|
|
@ -1620,7 +1645,7 @@ namespace rpcn
|
|||
}
|
||||
auto npids_vector = builder.CreateVector(davec);
|
||||
|
||||
//auto npids = builder.Create
|
||||
// auto npids = builder.Create
|
||||
auto fb_sendmessage = CreateSendMessageRequest(builder, nested_flatbuffer_vector, npids_vector);
|
||||
|
||||
builder.Finish(fb_sendmessage);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include <thread>
|
||||
#include <semaphore>
|
||||
#include "Utilities/mutex.h"
|
||||
#include "Emu/localized_string.h"
|
||||
|
||||
#include "util/asm.hpp"
|
||||
|
||||
|
|
@ -218,6 +219,9 @@ namespace rpcn
|
|||
std::set<std::string> blocked;
|
||||
};
|
||||
|
||||
localized_string_id rpcn_state_to_localized_string_id(rpcn::rpcn_state state);
|
||||
std::string rpcn_state_to_string(rpcn::rpcn_state state);
|
||||
|
||||
class rpcn_client
|
||||
{
|
||||
private:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue