Skip to content

Commit c4437f0

Browse files
Merge branch 'master' into windows-clang
2 parents 1148253 + f61aaf8 commit c4437f0

33 files changed

+250
-119
lines changed

3rdparty/qt6.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ find_package(Qt6 ${QT_MIN_VER} CONFIG COMPONENTS Widgets Concurrent Multimedia M
66
if(WIN32)
77
target_link_libraries(3rdparty_qt6 INTERFACE Qt6::Widgets Qt6::Concurrent Qt6::Multimedia Qt6::MultimediaWidgets Qt6::Svg Qt6::SvgWidgets)
88
else()
9-
find_package(Qt6 ${QT_MIN_VER} COMPONENTS DBus Gui)
9+
set(QT_NO_PRIVATE_MODULE_WARNING ON)
10+
find_package(Qt6 ${QT_MIN_VER} COMPONENTS DBus Gui GuiPrivate)
1011
if(Qt6DBus_FOUND)
1112
target_link_libraries(3rdparty_qt6 INTERFACE Qt6::Widgets Qt6::DBus Qt6::Concurrent Qt6::Multimedia Qt6::MultimediaWidgets Qt6::Svg Qt6::SvgWidgets)
1213
target_compile_definitions(3rdparty_qt6 INTERFACE -DHAVE_QTDBUS)
1314
else()
1415
target_link_libraries(3rdparty_qt6 INTERFACE Qt6::Widgets Qt6::Concurrent Qt6::Multimedia Qt6::MultimediaWidgets Qt6::Svg Qt6::SvgWidgets)
1516
endif()
16-
target_include_directories(3rdparty_qt6 INTERFACE ${Qt6Gui_PRIVATE_INCLUDE_DIRS})
17+
target_link_libraries(3rdparty_qt6 INTERFACE Qt6::GuiPrivate)
1718
endif()
1819

1920
if(Qt6Widgets_FOUND)

rpcs3/Emu/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ if(TARGET 3rdparty_vulkan)
591591
RSX/VK/vkutils/device.cpp
592592
RSX/VK/vkutils/sampler.cpp
593593
RSX/VK/vkutils/shared.cpp
594+
RSX/VK/vkutils/unique_resource.cpp
594595
RSX/VK/VKAsyncScheduler.cpp
595596
RSX/VK/VKCommandStream.cpp
596597
RSX/VK/VKCommonDecompiler.cpp

rpcs3/Emu/Cell/Modules/sceNp.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3198,7 +3198,7 @@ error_code sceNpLookupTerm()
31983198

31993199
error_code sceNpLookupCreateTitleCtx(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpId> selfNpId)
32003200
{
3201-
sceNp.warning("sceNpLookupCreateTitleCtx(communicationId=*0x%x(%s), selfNpId=0x%x)", communicationId, communicationId ? communicationId->data : "", selfNpId);
3201+
sceNp.warning("sceNpLookupCreateTitleCtx(communicationId=*0x%x(%s), selfNpId=0x%x)", communicationId, communicationId ? std::string_view(communicationId->data, 9) : "", selfNpId);
32023202

32033203
auto& nph = g_fxo->get<named_thread<np::np_handler>>();
32043204

@@ -6962,7 +6962,7 @@ error_code sceNpSignalingGetConnectionFromPeerAddress(u32 ctx_id, np_in_addr_t p
69626962
return CELL_OK;
69636963
}
69646964

6965-
error_code sceNpSignalingGetLocalNetInfo(u32 ctx_id, vm::ptr<SceNpSignalingNetInfo> info)
6965+
error_code sceNpSignalingGetLocalNetInfo(u32 ctx_id, vm::ptr<SceNpSignalingNetInfoDeprecated> info)
69666966
{
69676967
sceNp.warning("sceNpSignalingGetLocalNetInfo(ctx_id=%d, info=*0x%x)", ctx_id, info);
69686968

@@ -6973,7 +6973,8 @@ error_code sceNpSignalingGetLocalNetInfo(u32 ctx_id, vm::ptr<SceNpSignalingNetIn
69736973
return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED;
69746974
}
69756975

6976-
if (!info || info->size != sizeof(SceNpSignalingNetInfo))
6976+
// Library has backward support for a version of SceNpSignalingNetInfo without npport
6977+
if (!info || (info->size != sizeof(SceNpSignalingNetInfo) && info->size != sizeof(SceNpSignalingNetInfoDeprecated)))
69776978
{
69786979
return SCE_NP_SIGNALING_ERROR_INVALID_ARGUMENT;
69796980
}
@@ -6985,7 +6986,12 @@ error_code sceNpSignalingGetLocalNetInfo(u32 ctx_id, vm::ptr<SceNpSignalingNetIn
69856986
info->nat_status = SCE_NP_SIGNALING_NETINFO_NAT_STATUS_TYPE2;
69866987
info->upnp_status = nph.get_upnp_status();
69876988
info->npport_status = SCE_NP_SIGNALING_NETINFO_NPPORT_STATUS_OPEN;
6988-
info->npport = SCE_NP_PORT;
6989+
6990+
if (info->size == sizeof(SceNpSignalingNetInfo))
6991+
{
6992+
auto new_info = vm::unsafe_ptr_cast<SceNpSignalingNetInfo>(info);
6993+
new_info->npport = SCE_NP_PORT;
6994+
}
69896995

69906996
return CELL_OK;
69916997
}

rpcs3/Emu/Cell/Modules/sceNp.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,6 +1584,16 @@ struct SceNpSignalingNetInfo
15841584
be_t<u16> npport;
15851585
};
15861586

1587+
struct SceNpSignalingNetInfoDeprecated
1588+
{
1589+
be_t<u32> size;
1590+
be_t<u32> local_addr; // in_addr
1591+
be_t<u32> mapped_addr; // in_addr
1592+
be_t<s32> nat_status;
1593+
be_t<s32> upnp_status;
1594+
be_t<s32> npport_status;
1595+
};
1596+
15871597
struct SceNpCustomMenuAction
15881598
{
15891599
be_t<u32> options;

rpcs3/Emu/Cell/Modules/sceNp2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ error_code sceNpMatching2GrantRoomOwner(
13001300
error_code sceNpMatching2CreateContext(
13011301
vm::cptr<SceNpId> npId, vm::cptr<SceNpCommunicationId> commId, vm::cptr<SceNpCommunicationPassphrase> passPhrase, vm::ptr<SceNpMatching2ContextId> ctxId, s32 option)
13021302
{
1303-
sceNp2.warning("sceNpMatching2CreateContext(npId=*0x%x, commId=*0x%x(%s), passPhrase=*0x%x, ctxId=*0x%x, option=%d)", npId, commId, commId ? commId->data : "", passPhrase, ctxId, option);
1303+
sceNp2.warning("sceNpMatching2CreateContext(npId=*0x%x, commId=*0x%x(%s), passPhrase=*0x%x, ctxId=*0x%x, option=%d)", npId, commId, commId ? std::string_view(commId->data, 9) : "", passPhrase, ctxId, option);
13041304

13051305
auto& nph = g_fxo->get<named_thread<np::np_handler>>();
13061306

rpcs3/Emu/NP/np_contexts.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "Emu/Cell/PPUCallback.h"
55
#include "Emu/IdManager.h"
66
#include "Emu/Cell/Modules/cellSysutil.h"
7+
#include "np_helpers.h"
78

89
LOG_CHANNEL(sceNp2);
910

@@ -53,7 +54,7 @@ void generic_async_transaction_context::set_result_and_wake(error_code err)
5354

5455
tus_ctx::tus_ctx(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase)
5556
{
56-
ensure(!communicationId->data[9] && strlen(communicationId->data) == 9);
57+
ensure(communicationId && np::validate_communication_id(*communicationId), "tus_ctx::tus_ctx: Invalid SceNpCommunicationId");
5758
memcpy(&this->communicationId, communicationId.get_ptr(), sizeof(SceNpCommunicationId));
5859
memcpy(&this->passphrase, passphrase.get_ptr(), sizeof(SceNpCommunicationPassphrase));
5960
}
@@ -96,7 +97,7 @@ bool destroy_tus_transaction_context(s32 ctx_id)
9697

9798
score_ctx::score_ctx(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase)
9899
{
99-
ensure(!communicationId->data[9] && strlen(communicationId->data) == 9);
100+
ensure(communicationId && np::validate_communication_id(*communicationId), "score_ctx::score_ctx: Invalid SceNpCommunicationId");
100101
memcpy(&this->communicationId, communicationId.get_ptr(), sizeof(SceNpCommunicationId));
101102
memcpy(&this->passphrase, passphrase.get_ptr(), sizeof(SceNpCommunicationPassphrase));
102103
}
@@ -140,7 +141,7 @@ bool destroy_score_transaction_context(s32 ctx_id)
140141

141142
match2_ctx::match2_ctx(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase, s32 option)
142143
{
143-
ensure(!communicationId->data[9] && strlen(communicationId->data) == 9);
144+
ensure(communicationId && np::validate_communication_id(*communicationId), "match2_ctx::match2_ctx: Invalid SceNpCommunicationId");
144145
memcpy(&this->communicationId, communicationId.get_ptr(), sizeof(SceNpCommunicationId));
145146
memcpy(&this->passphrase, passphrase.get_ptr(), sizeof(SceNpCommunicationPassphrase));
146147

@@ -149,7 +150,7 @@ match2_ctx::match2_ctx(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<
149150
}
150151
u16 create_match2_context(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase, s32 option)
151152
{
152-
sceNp2.notice("Creating match2 context with communicationId: <%s>", static_cast<const char*>(communicationId->data));
153+
sceNp2.notice("Creating match2 context with communicationId: <%s>", std::string_view(communicationId->data, 9));
153154
return static_cast<u16>(idm::make<match2_ctx>(communicationId, passphrase, option));
154155
}
155156
bool destroy_match2_context(u16 ctx_id)
@@ -167,7 +168,7 @@ shared_ptr<match2_ctx> get_match2_context(u16 ctx_id)
167168

168169
lookup_title_ctx::lookup_title_ctx(vm::cptr<SceNpCommunicationId> communicationId)
169170
{
170-
ensure(!communicationId->data[9] && strlen(communicationId->data) == 9);
171+
ensure(communicationId && np::validate_communication_id(*communicationId), "lookup_title_ctx::lookup_title_ctx: Invalid SceNpCommunicationId");
171172
memcpy(&this->communicationId, communicationId.get_ptr(), sizeof(SceNpCommunicationId));
172173
}
173174
s32 create_lookup_title_context(vm::cptr<SceNpCommunicationId> communicationId)

rpcs3/Emu/NP/np_helpers.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "Emu/Cell/Modules/sceNp.h"
12
#include "stdafx.h"
23
#include "util/types.hpp"
34
#include "Utilities/StrUtil.h"
@@ -22,9 +23,15 @@ namespace np
2223
return fmt::format("%02X:%02X:%02X:%02X:%02X:%02X", ether[0], ether[1], ether[2], ether[3], ether[4], ether[5]);
2324
}
2425

26+
bool validate_communication_id(const SceNpCommunicationId& com_id)
27+
{
28+
return std::all_of(com_id.data, com_id.data + 9, [](char c) { return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z'); }) && com_id.num <= 99;
29+
}
30+
2531
std::string communication_id_to_string(const SceNpCommunicationId& communicationId)
2632
{
27-
return fmt::format("%s_%02d", communicationId.data, communicationId.num);
33+
std::string_view com_id_data(communicationId.data, 9);
34+
return fmt::format("%s_%02d", com_id_data, communicationId.num);
2835
}
2936

3037
void strings_to_userinfo(std::string_view npid, std::string_view online_name, std::string_view avatar_url, SceNpUserInfo& user_info)

rpcs3/Emu/NP/np_helpers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace np
88
{
99
std::string ip_to_string(u32 addr);
1010
std::string ether_to_string(std::array<u8, 6>& ether);
11+
bool validate_communication_id(const SceNpCommunicationId& com_id);
1112
std::string communication_id_to_string(const SceNpCommunicationId& communicationId);
1213

1314
void string_to_npid(std::string_view str, SceNpId& npid);

rpcs3/Emu/NP/rpcn_client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2752,7 +2752,7 @@ namespace rpcn
27522752

27532753
void rpcn_client::write_communication_id(const SceNpCommunicationId& com_id, std::vector<u8>& data)
27542754
{
2755-
ensure(com_id.data[9] == 0 && com_id.num <= 99, "rpcn_client::write_communication_id: Invalid SceNpCommunicationId");
2755+
ensure(np::validate_communication_id(com_id), "rpcn_client::write_communication_id: Invalid SceNpCommunicationId");
27562756
const std::string com_id_str = np::communication_id_to_string(com_id);
27572757
ensure(com_id_str.size() == 12, "rpcn_client::write_communication_id: Error formatting SceNpCommunicationId");
27582758
memcpy(data.data(), com_id_str.data(), COMMUNICATION_ID_SIZE);

rpcs3/Emu/RSX/VK/VKCompute.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ namespace vk
246246
void cs_shuffle_base::bind_resources(const vk::command_buffer& cmd)
247247
{
248248
set_parameters(cmd);
249-
m_program->bind_uniform({ m_data->value, m_data_offset, m_data_length }, 0, 0);
249+
m_program->bind_uniform({ *m_data, m_data_offset, m_data_length }, 0, 0);
250250
}
251251

252252
void cs_shuffle_base::set_parameters(const vk::command_buffer& cmd)
@@ -296,7 +296,7 @@ namespace vk
296296
void cs_interleave_task::bind_resources(const vk::command_buffer& cmd)
297297
{
298298
set_parameters(cmd);
299-
m_program->bind_uniform({ m_data->value, m_data_offset, m_ssbo_length }, 0, 0);
299+
m_program->bind_uniform({ *m_data, m_data_offset, m_ssbo_length }, 0, 0);
300300
}
301301

302302
void cs_interleave_task::run(const vk::command_buffer& cmd, const vk::buffer* data, u32 data_offset, u32 data_length, u32 zeta_offset, u32 stencil_offset)
@@ -355,8 +355,8 @@ namespace vk
355355

356356
void cs_aggregator::bind_resources(const vk::command_buffer& /*cmd*/)
357357
{
358-
m_program->bind_uniform({ src->value, 0, block_length }, 0, 0);
359-
m_program->bind_uniform({ dst->value, 0, 4 }, 0, 1);
358+
m_program->bind_uniform({ *src, 0, block_length }, 0, 0);
359+
m_program->bind_uniform({ *dst, 0, 4 }, 0, 1);
360360
}
361361

362362
void cs_aggregator::run(const vk::command_buffer& cmd, const vk::buffer* dst, const vk::buffer* src, u32 num_words)

0 commit comments

Comments
 (0)