mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-18 01:28:36 +00:00
Merge branch 'main' into Cheats_Patches
This commit is contained in:
@@ -114108,7 +114108,7 @@ STUB(
|
||||
_ZN3sce2Np9CppWebApi6Common12IntrusivePtrINS1_7Matches2V124RequestCompetitiveResultEE7add_refEv)
|
||||
STUB("efPahl2FufA",
|
||||
_ZN3sce2Np9CppWebApi30CommunicationRestrictionStatus2V35Error8fromJsonERKNS_4Json5ValueE)
|
||||
STUB("efX3lrPwdKA", sceAppContentAddcontMountByEntitlemetId)
|
||||
STUB("efX3lrPwdKA", sceAppContentAddcontMountByEntitlementId)
|
||||
STUB("efXnxYFN5oE", _ZNSt11range_errorD0Ev)
|
||||
STUB("efcwuDLsAM0", _ZThn120_NK7WebCore16HTMLMediaElement5mutedEv)
|
||||
STUB("efhGArzWdxE", _ZN7bmalloc6IsoTLS15s_didInitializeE)
|
||||
@@ -129493,7 +129493,7 @@ STUB(
|
||||
STUB("kJlYH5uMAWI", sceNetResolverDestroy)
|
||||
STUB("kJmdxo4uM+8",
|
||||
_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE5_InitERKSt8_Locinfo)
|
||||
STUB("kJmjt81mXKQ", sceAppContentAddcontEnqueueDownloadByEntitlemetId)
|
||||
STUB("kJmjt81mXKQ", sceAppContentAddcontEnqueueDownloadByEntitlementId)
|
||||
STUB(
|
||||
"kJoY9lMIFzY",
|
||||
_ZN3sce2Np9CppWebApi6Common8IteratorINS2_12IntrusivePtrINS1_21AdvancedPlayerProfile2V138MatchCompletionRateDisconnectedMetricsEEEEmmEi)
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Core::AeroLib {
|
||||
// on lookup, setting up the nid_entry they are matched with
|
||||
//
|
||||
// If it runs out of stubs with name information, it will return
|
||||
// a default implemetnation without function name details
|
||||
// a default implementation without function name details
|
||||
|
||||
// Up to 512, larger values lead to more resolve stub slots
|
||||
// and to longer compile / CI times
|
||||
|
||||
@@ -51,8 +51,8 @@ CryptoPP::RSA::PrivateKey Crypto::DebugRifKeyset_init() {
|
||||
params.SetPrime2(
|
||||
CryptoPP::Integer(DebugRifKeyset_keyset.Prime2, sizeof(DebugRifKeyset_keyset.Prime2)));
|
||||
|
||||
params.SetPublicExponent(CryptoPP::Integer(DebugRifKeyset_keyset.PrivateExponent,
|
||||
sizeof(DebugRifKeyset_keyset.PrivateExponent)));
|
||||
params.SetPublicExponent(CryptoPP::Integer(DebugRifKeyset_keyset.PublicExponent,
|
||||
sizeof(DebugRifKeyset_keyset.PublicExponent)));
|
||||
params.SetPrivateExponent(CryptoPP::Integer(DebugRifKeyset_keyset.PrivateExponent,
|
||||
sizeof(DebugRifKeyset_keyset.PrivateExponent)));
|
||||
|
||||
|
||||
@@ -279,8 +279,8 @@ bool PKG::Extract(const std::filesystem::path& filepath, const std::filesystem::
|
||||
}
|
||||
}
|
||||
|
||||
// let's deal with the root/uroot enteries here.
|
||||
// Sometimes it's more than 2 enteries (Tomb Raider Remastered)
|
||||
// let's deal with the root/uroot entries here.
|
||||
// Sometimes it's more than 2 entries (Tomb Raider Remastered)
|
||||
const std::string_view flat_path_table(&decompressedData[0x10], 15);
|
||||
if (flat_path_table == "flat_path_table") {
|
||||
uroot_reached = true;
|
||||
|
||||
@@ -48,7 +48,7 @@ std::filesystem::path MntPoints::GetHostPath(std::string_view guest_directory) {
|
||||
pos = mount->mount.size() + 1;
|
||||
const auto rel_path = std::string_view(corrected_path).substr(pos);
|
||||
const auto host_path = mount->host_path / rel_path;
|
||||
if (!NeedsCaseInsensiveSearch) {
|
||||
if (!NeedsCaseInsensitiveSearch) {
|
||||
return host_path;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@ namespace Core::FileSys {
|
||||
|
||||
class MntPoints {
|
||||
#ifdef _WIN64
|
||||
static constexpr bool NeedsCaseInsensiveSearch = false;
|
||||
static constexpr bool NeedsCaseInsensitiveSearch = false;
|
||||
#else
|
||||
static constexpr bool NeedsCaseInsensiveSearch = true;
|
||||
static constexpr bool NeedsCaseInsensitiveSearch = true;
|
||||
#endif
|
||||
public:
|
||||
struct MntPair {
|
||||
|
||||
@@ -221,12 +221,12 @@ int PS4_SYSV_ABI Func_C59A36FF8D7C59DA() {
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceAppContentAddcontEnqueueDownloadByEntitlemetId() {
|
||||
int PS4_SYSV_ABI sceAppContentAddcontEnqueueDownloadByEntitlementId() {
|
||||
LOG_ERROR(Lib_AppContent, "(STUBBED) called");
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceAppContentAddcontMountByEntitlemetId() {
|
||||
int PS4_SYSV_ABI sceAppContentAddcontMountByEntitlementId() {
|
||||
LOG_ERROR(Lib_AppContent, "(STUBBED) called");
|
||||
return ORBIS_OK;
|
||||
}
|
||||
@@ -313,9 +313,9 @@ void RegisterlibSceAppContent(Core::Loader::SymbolsResolver* sym) {
|
||||
LIB_FUNCTION("xZo2-418Wdo", "libSceAppContentBundle", 1, "libSceAppContent", 1, 1,
|
||||
Func_C59A36FF8D7C59DA);
|
||||
LIB_FUNCTION("kJmjt81mXKQ", "libSceAppContentIro", 1, "libSceAppContent", 1, 1,
|
||||
sceAppContentAddcontEnqueueDownloadByEntitlemetId);
|
||||
sceAppContentAddcontEnqueueDownloadByEntitlementId);
|
||||
LIB_FUNCTION("efX3lrPwdKA", "libSceAppContentIro", 1, "libSceAppContent", 1, 1,
|
||||
sceAppContentAddcontMountByEntitlemetId);
|
||||
sceAppContentAddcontMountByEntitlementId);
|
||||
LIB_FUNCTION("z9hgjLd1SGA", "libSceAppContentIro", 1, "libSceAppContent", 1, 1,
|
||||
sceAppContentGetAddcontInfoByEntitlementId);
|
||||
LIB_FUNCTION("3wUaDTGmjcQ", "libSceAppContentIro", 1, "libSceAppContent", 1, 1,
|
||||
|
||||
@@ -92,8 +92,8 @@ int PS4_SYSV_ABI sceAppContentTemporaryDataMount2(OrbisAppContentTemporaryDataOp
|
||||
int PS4_SYSV_ABI sceAppContentTemporaryDataUnmount();
|
||||
int PS4_SYSV_ABI sceAppContentGetPftFlag();
|
||||
int PS4_SYSV_ABI Func_C59A36FF8D7C59DA();
|
||||
int PS4_SYSV_ABI sceAppContentAddcontEnqueueDownloadByEntitlemetId();
|
||||
int PS4_SYSV_ABI sceAppContentAddcontMountByEntitlemetId();
|
||||
int PS4_SYSV_ABI sceAppContentAddcontEnqueueDownloadByEntitlementId();
|
||||
int PS4_SYSV_ABI sceAppContentAddcontMountByEntitlementId();
|
||||
int PS4_SYSV_ABI sceAppContentGetAddcontInfoByEntitlementId();
|
||||
int PS4_SYSV_ABI sceAppContentGetAddcontInfoListByIroTag();
|
||||
int PS4_SYSV_ABI sceAppContentGetDownloadedStoreCountry();
|
||||
|
||||
@@ -40,9 +40,11 @@ int PS4_SYSV_ABI sceAvPlayerChangeStream() {
|
||||
s32 PS4_SYSV_ABI sceAvPlayerClose(SceAvPlayerHandle handle) {
|
||||
LOG_TRACE(Lib_AvPlayer, "called");
|
||||
if (handle == nullptr) {
|
||||
LOG_TRACE(Lib_AvPlayer, "returning ORBIS_AVPLAYER_ERROR_INVALID_PARAMS");
|
||||
return ORBIS_AVPLAYER_ERROR_INVALID_PARAMS;
|
||||
}
|
||||
delete handle;
|
||||
LOG_TRACE(Lib_AvPlayer, "returning ORBIS_OK");
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
@@ -257,6 +259,7 @@ s32 PS4_SYSV_ABI sceAvPlayerStart(SceAvPlayerHandle handle) {
|
||||
s32 PS4_SYSV_ABI sceAvPlayerStop(SceAvPlayerHandle handle) {
|
||||
LOG_TRACE(Lib_AvPlayer, "called");
|
||||
if (handle == nullptr) {
|
||||
LOG_TRACE(Lib_AvPlayer, "returning ORBIS_AVPLAYER_ERROR_INVALID_PARAMS");
|
||||
return ORBIS_AVPLAYER_ERROR_INVALID_PARAMS;
|
||||
}
|
||||
const auto res = handle->Stop();
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "avplayer_file_streamer.h"
|
||||
|
||||
#include "common/alignment.h"
|
||||
#include "common/singleton.h"
|
||||
#include "core/file_sys/fs.h"
|
||||
#include "core/libraries/kernel/time_management.h"
|
||||
@@ -111,8 +112,8 @@ s32 AvPlayerSource::GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info)
|
||||
LOG_INFO(Lib_AvPlayer, "Stream {} is a video stream.", stream_index);
|
||||
info.details.video.aspect_ratio =
|
||||
f32(p_stream->codecpar->width) / p_stream->codecpar->height;
|
||||
info.details.video.width = p_stream->codecpar->width;
|
||||
info.details.video.height = p_stream->codecpar->height;
|
||||
info.details.video.width = Common::AlignUp(u32(p_stream->codecpar->width), 16);
|
||||
info.details.video.height = Common::AlignUp(u32(p_stream->codecpar->height), 16);
|
||||
if (p_lang_node != nullptr) {
|
||||
std::memcpy(info.details.video.language_code, p_lang_node->value,
|
||||
std::min(strlen(p_lang_node->value), size_t(3)));
|
||||
@@ -167,8 +168,9 @@ bool AvPlayerSource::EnableStream(u32 stream_index) {
|
||||
LOG_ERROR(Lib_AvPlayer, "Could not open avcodec for video stream {}.", stream_index);
|
||||
return false;
|
||||
}
|
||||
const auto width = m_video_codec_context->width;
|
||||
const auto size = (width * m_video_codec_context->height * 3) / 2;
|
||||
const auto width = Common::AlignUp(u32(m_video_codec_context->width), 16);
|
||||
const auto height = Common::AlignUp(u32(m_video_codec_context->height), 16);
|
||||
const auto size = (width * height * 3) / 2;
|
||||
for (u64 index = 0; index < m_num_output_video_framebuffers; ++index) {
|
||||
m_video_buffers.Push(FrameBuffer(m_memory_replacement, 0x100, size));
|
||||
}
|
||||
@@ -284,11 +286,6 @@ bool AvPlayerSource::GetVideoData(SceAvPlayerFrameInfo& video_info) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static void CopyNV12Data(u8* dst, const AVFrame& src) {
|
||||
std::memcpy(dst, src.data[0], src.width * src.height);
|
||||
std::memcpy(dst + src.width * src.height, src.data[1], (src.width * src.height) / 2);
|
||||
}
|
||||
|
||||
bool AvPlayerSource::GetVideoData(SceAvPlayerFrameInfoEx& video_info) {
|
||||
if (!IsActive()) {
|
||||
return false;
|
||||
@@ -493,13 +490,17 @@ AvPlayerSource::AVFramePtr AvPlayerSource::ConvertVideoFrame(const AVFrame& fram
|
||||
nv12_frame->width = frame.width;
|
||||
nv12_frame->height = frame.height;
|
||||
nv12_frame->sample_aspect_ratio = frame.sample_aspect_ratio;
|
||||
nv12_frame->crop_top = frame.crop_top;
|
||||
nv12_frame->crop_bottom = frame.crop_bottom;
|
||||
nv12_frame->crop_left = frame.crop_left;
|
||||
nv12_frame->crop_right = frame.crop_right;
|
||||
|
||||
av_frame_get_buffer(nv12_frame.get(), 0);
|
||||
|
||||
if (m_sws_context == nullptr) {
|
||||
m_sws_context =
|
||||
SWSContextPtr(sws_getContext(frame.width, frame.height, AVPixelFormat(frame.format),
|
||||
frame.width, frame.height, AV_PIX_FMT_NV12,
|
||||
nv12_frame->width, nv12_frame->height, AV_PIX_FMT_NV12,
|
||||
SWS_FAST_BILINEAR, nullptr, nullptr, nullptr),
|
||||
&ReleaseSWSContext);
|
||||
}
|
||||
@@ -512,6 +513,26 @@ AvPlayerSource::AVFramePtr AvPlayerSource::ConvertVideoFrame(const AVFrame& fram
|
||||
return nv12_frame;
|
||||
}
|
||||
|
||||
static void CopyNV12Data(u8* dst, const AVFrame& src) {
|
||||
const auto width = Common::AlignUp(u32(src.width), 16);
|
||||
const auto height = Common::AlignUp(u32(src.height), 16);
|
||||
|
||||
if (src.width == width) {
|
||||
std::memcpy(dst, src.data[0], src.width * src.height);
|
||||
std::memcpy(dst + src.width * height, src.data[1], (src.width * src.height) / 2);
|
||||
} else {
|
||||
const auto luma_dst = dst;
|
||||
for (u32 y = 0; y < src.height; ++y) {
|
||||
std::memcpy(luma_dst + y * width, src.data[0] + y * src.width, src.width);
|
||||
}
|
||||
const auto chroma_dst = dst + width * height;
|
||||
for (u32 y = 0; y < src.height / 2; ++y) {
|
||||
std::memcpy(chroma_dst + y * (width / 2), src.data[0] + y * (src.width / 2),
|
||||
src.width / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Frame AvPlayerSource::PrepareVideoFrame(FrameBuffer buffer, const AVFrame& frame) {
|
||||
ASSERT(frame.format == AV_PIX_FMT_NV12);
|
||||
|
||||
@@ -525,6 +546,9 @@ Frame AvPlayerSource::PrepareVideoFrame(FrameBuffer buffer, const AVFrame& frame
|
||||
const auto num = time_base.num;
|
||||
const auto timestamp = (num != 0 && den > 1) ? (pkt_dts * num) / den : pkt_dts;
|
||||
|
||||
const auto width = Common::AlignUp(u32(frame.width), 16);
|
||||
const auto height = Common::AlignUp(u32(frame.height), 16);
|
||||
|
||||
return Frame{
|
||||
.buffer = std::move(buffer),
|
||||
.info =
|
||||
@@ -535,9 +559,14 @@ Frame AvPlayerSource::PrepareVideoFrame(FrameBuffer buffer, const AVFrame& frame
|
||||
{
|
||||
.video =
|
||||
{
|
||||
.width = u32(frame.width),
|
||||
.height = u32(frame.height),
|
||||
.width = u32(width),
|
||||
.height = u32(height),
|
||||
.aspect_ratio = AVRationalToF32(frame.sample_aspect_ratio),
|
||||
.crop_left_offset = u32(frame.crop_left),
|
||||
.crop_right_offset = u32(frame.crop_right + (width - frame.width)),
|
||||
.crop_top_offset = u32(frame.crop_top),
|
||||
.crop_bottom_offset =
|
||||
u32(frame.crop_bottom + (height - frame.height)),
|
||||
.pitch = u32(frame.linesize[0]),
|
||||
.luma_bit_depth = 8,
|
||||
.chroma_bit_depth = 8,
|
||||
|
||||
@@ -222,8 +222,11 @@ bool AvPlayerState::Stop() {
|
||||
if (!SetState(AvState::Stop)) {
|
||||
return false;
|
||||
}
|
||||
if (!m_up_source->Stop()) {
|
||||
return false;
|
||||
}
|
||||
OnPlaybackStateChanged(AvState::Stop);
|
||||
return m_up_source->Stop();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AvPlayerState::GetVideoData(SceAvPlayerFrameInfo& video_info) {
|
||||
|
||||
@@ -55,6 +55,10 @@ static constexpr auto HwInitPacketSize = 0x100u;
|
||||
|
||||
// clang-format off
|
||||
static constexpr std::array InitSequence{
|
||||
// A fake preamble to mimic context reset sent by FW
|
||||
0xc0001200u, 0u, // IT_CLEAR_STATE
|
||||
|
||||
// Actual init state sequence
|
||||
0xc0017600u, 0x216u, 0xffffffffu,
|
||||
0xc0017600u, 0x217u, 0xffffffffu,
|
||||
0xc0017600u, 0x215u, 0u,
|
||||
@@ -94,9 +98,13 @@ static constexpr std::array InitSequence{
|
||||
0xc0036900u, 0x295u, 0x100u, 0x100u, 4u,
|
||||
0xc0017900u, 0x200u, 0xe0000000u,
|
||||
};
|
||||
static_assert(InitSequence.size() == 0x73);
|
||||
static_assert(InitSequence.size() == 0x73 + 2);
|
||||
|
||||
static constexpr std::array InitSequence175{
|
||||
// A fake preamble to mimic context reset sent by FW
|
||||
0xc0001200u, 0u, // IT_CLEAR_STATE
|
||||
|
||||
// Actual init state sequence
|
||||
0xc0017600u, 0x216u, 0xffffffffu,
|
||||
0xc0017600u, 0x217u, 0xffffffffu,
|
||||
0xc0017600u, 0x215u, 0u,
|
||||
@@ -136,9 +144,13 @@ static constexpr std::array InitSequence175{
|
||||
0xc0036900u, 0x295u, 0x100u, 0x100u, 4u,
|
||||
0xc0017900u, 0x200u, 0xe0000000u,
|
||||
};
|
||||
static_assert(InitSequence175.size() == 0x73);
|
||||
static_assert(InitSequence175.size() == 0x73 + 2);
|
||||
|
||||
static constexpr std::array InitSequence200{
|
||||
// A fake preamble to mimic context reset sent by FW
|
||||
0xc0001200u, 0u, // IT_CLEAR_STATE
|
||||
|
||||
// Actual init state sequence
|
||||
0xc0017600u, 0x216u, 0xffffffffu,
|
||||
0xc0017600u, 0x217u, 0xffffffffu,
|
||||
0xc0017600u, 0x215u, 0u,
|
||||
@@ -179,9 +191,13 @@ static constexpr std::array InitSequence200{
|
||||
0xc0036900u, 0x295u, 0x100u, 0x100u, 4u,
|
||||
0xc0017900u, 0x200u, 0xe0000000u,
|
||||
};
|
||||
static_assert(InitSequence200.size() == 0x76);
|
||||
static_assert(InitSequence200.size() == 0x76 + 2);
|
||||
|
||||
static constexpr std::array InitSequence350{
|
||||
// A fake preamble to mimic context reset sent by FW
|
||||
0xc0001200u, 0u, // IT_CLEAR_STATE
|
||||
|
||||
// Actual init state sequence
|
||||
0xc0017600u, 0x216u, 0xffffffffu,
|
||||
0xc0017600u, 0x217u, 0xffffffffu,
|
||||
0xc0017600u, 0x215u, 0u,
|
||||
@@ -224,7 +240,7 @@ static constexpr std::array InitSequence350{
|
||||
0xc0017900u, 0x200u, 0xe0000000u,
|
||||
0xc0016900u, 0x2aau, 0xffu,
|
||||
};
|
||||
static_assert(InitSequence350.size() == 0x7c);
|
||||
static_assert(InitSequence350.size() == 0x7c + 2);
|
||||
|
||||
static constexpr std::array CtxInitSequence{
|
||||
0xc0012800u, 0x80000000u, 0x80000000u,
|
||||
@@ -735,11 +751,11 @@ u32 PS4_SYSV_ABI sceGnmDrawInitDefaultHardwareState(u32* cmdbuf, u32 size) {
|
||||
cmdbuf = ClearContextState(cmdbuf);
|
||||
}
|
||||
|
||||
std::memcpy(cmdbuf, InitSequence.data(), InitSequence.size() * 4);
|
||||
cmdbuf += InitSequence.size();
|
||||
std::memcpy(cmdbuf, &InitSequence[2], (InitSequence.size() - 2) * 4);
|
||||
cmdbuf += InitSequence.size() - 2;
|
||||
|
||||
const auto cmdbuf_left =
|
||||
HwInitPacketSize - InitSequence.size() - (clear_state ? 0xc : 0) - 1;
|
||||
HwInitPacketSize - (InitSequence.size() - 2) - (clear_state ? 0xc : 0) - 1;
|
||||
cmdbuf = WriteHeader<PM4ItOpcode::Nop>(cmdbuf, cmdbuf_left);
|
||||
cmdbuf = WriteBody(cmdbuf, 0u);
|
||||
|
||||
@@ -757,10 +773,10 @@ u32 PS4_SYSV_ABI sceGnmDrawInitDefaultHardwareState175(u32* cmdbuf, u32 size) {
|
||||
}
|
||||
|
||||
cmdbuf = ClearContextState(cmdbuf);
|
||||
std::memcpy(cmdbuf, InitSequence175.data(), InitSequence175.size() * 4);
|
||||
cmdbuf += InitSequence175.size();
|
||||
std::memcpy(cmdbuf, &InitSequence175[2], (InitSequence175.size() - 2) * 4);
|
||||
cmdbuf += InitSequence175.size() - 2;
|
||||
|
||||
constexpr auto cmdbuf_left = HwInitPacketSize - InitSequence175.size() - 0xc - 1;
|
||||
constexpr auto cmdbuf_left = HwInitPacketSize - (InitSequence175.size() - 2) - 0xc - 1;
|
||||
WriteTrailingNop<cmdbuf_left>(cmdbuf);
|
||||
|
||||
return HwInitPacketSize;
|
||||
@@ -778,11 +794,11 @@ u32 PS4_SYSV_ABI sceGnmDrawInitDefaultHardwareState200(u32* cmdbuf, u32 size) {
|
||||
cmdbuf = ClearContextState(cmdbuf);
|
||||
}
|
||||
|
||||
std::memcpy(cmdbuf, InitSequence200.data(), InitSequence200.size() * 4);
|
||||
cmdbuf += InitSequence200.size();
|
||||
std::memcpy(cmdbuf, &InitSequence200[2], (InitSequence200.size() - 2) * 4);
|
||||
cmdbuf += InitSequence200.size() - 2;
|
||||
|
||||
const auto cmdbuf_left =
|
||||
HwInitPacketSize - InitSequence200.size() - (clear_state ? 0xc : 0) - 1;
|
||||
HwInitPacketSize - (InitSequence200.size() - 2) - (clear_state ? 0xc : 0) - 1;
|
||||
cmdbuf = WriteHeader<PM4ItOpcode::Nop>(cmdbuf, cmdbuf_left);
|
||||
cmdbuf = WriteBody(cmdbuf, 0u);
|
||||
|
||||
@@ -804,11 +820,11 @@ u32 PS4_SYSV_ABI sceGnmDrawInitDefaultHardwareState350(u32* cmdbuf, u32 size) {
|
||||
cmdbuf = ClearContextState(cmdbuf);
|
||||
}
|
||||
|
||||
std::memcpy(cmdbuf, InitSequence350.data(), InitSequence350.size() * 4);
|
||||
cmdbuf += InitSequence350.size();
|
||||
std::memcpy(cmdbuf, &InitSequence350[2], (InitSequence350.size() - 2) * 4);
|
||||
cmdbuf += InitSequence350.size() - 2;
|
||||
|
||||
const auto cmdbuf_left =
|
||||
HwInitPacketSize - InitSequence350.size() - (clear_state ? 0xc : 0) - 1;
|
||||
HwInitPacketSize - (InitSequence350.size() - 2) - (clear_state ? 0xc : 0) - 1;
|
||||
cmdbuf = WriteHeader<PM4ItOpcode::Nop>(cmdbuf, cmdbuf_left);
|
||||
cmdbuf = WriteBody(cmdbuf, 0u);
|
||||
|
||||
@@ -1743,7 +1759,7 @@ s32 PS4_SYSV_ABI sceGnmSetVsShader(u32* cmdbuf, u32 size, const u32* vs_regs, u3
|
||||
return -1;
|
||||
}
|
||||
|
||||
const u32 var = shader_modifier == 0 ? vs_regs[2] : (vs_regs[2] & 0xfcfffc3f | shader_modifier);
|
||||
const u32 var = shader_modifier == 0 ? vs_regs[2] : (vs_regs[2] & 0xfcfffc3f) | shader_modifier;
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 0x48u, vs_regs[0], 0u); // SPI_SHADER_PGM_LO_VS
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 0x4au, var, vs_regs[3]); // SPI_SHADER_PGM_RSRC1_VS
|
||||
cmdbuf = PM4CmdSetData::SetContextReg(cmdbuf, 0x207u, vs_regs[6]); // PA_CL_VS_OUT_CNTL
|
||||
|
||||
@@ -538,7 +538,7 @@ void fileSystemSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
|
||||
|
||||
// openOrbis (to check if it is valid out of OpenOrbis
|
||||
LIB_FUNCTION("6c3rCVE-fTU", "libkernel", 1, "libkernel", 1, 1,
|
||||
posix_open); // _open shoudld be equal to open function
|
||||
posix_open); // _open should be equal to open function
|
||||
}
|
||||
|
||||
} // namespace Libraries::Kernel
|
||||
|
||||
@@ -75,19 +75,28 @@ s32 PS4_SYSV_ABI sceKernelAvailableDirectMemorySize(u64 searchStart, u64 searchE
|
||||
LOG_WARNING(Kernel_Vmm, "called searchStart = {:#x}, searchEnd = {:#x}, alignment = {:#x}",
|
||||
searchStart, searchEnd, alignment);
|
||||
|
||||
if (searchEnd <= searchStart) {
|
||||
if (physAddrOut == nullptr || sizeOut == nullptr) {
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (searchEnd > SCE_KERNEL_MAIN_DMEM_SIZE) {
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (searchEnd <= searchStart) {
|
||||
return ORBIS_KERNEL_ERROR_ENOMEM;
|
||||
}
|
||||
|
||||
auto* memory = Core::Memory::Instance();
|
||||
|
||||
PAddr physAddr;
|
||||
s32 result =
|
||||
memory->DirectQueryAvailable(searchStart, searchEnd, alignment, &physAddr, sizeOut);
|
||||
PAddr physAddr{};
|
||||
size_t size{};
|
||||
s32 result = memory->DirectQueryAvailable(searchStart, searchEnd, alignment, &physAddr, &size);
|
||||
|
||||
if (size == 0) {
|
||||
return ORBIS_KERNEL_ERROR_ENOMEM;
|
||||
}
|
||||
|
||||
*physAddrOut = static_cast<u64>(physAddr);
|
||||
*sizeOut = size;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "common/bit_field.h"
|
||||
#include "common/types.h"
|
||||
|
||||
constexpr u64 SCE_KERNEL_MAIN_DMEM_SIZE = 6_GB; // ~ 6GB
|
||||
constexpr u64 SCE_KERNEL_MAIN_DMEM_SIZE = 4608_MB; // ~ 4.5GB
|
||||
|
||||
namespace Libraries::Kernel {
|
||||
|
||||
|
||||
@@ -1123,7 +1123,6 @@ int PS4_SYSV_ABI posix_pthread_join(ScePthread thread, void** res) {
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadDetach(ScePthread thread) {
|
||||
LOG_INFO(Kernel_Pthread, "thread create name = {}", thread->name);
|
||||
thread->is_detached = true;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <thread>
|
||||
#include "common/assert.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/native_clock.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/time_management.h"
|
||||
@@ -30,7 +31,8 @@ u64 PS4_SYSV_ABI sceKernelGetTscFrequency() {
|
||||
}
|
||||
|
||||
u64 PS4_SYSV_ABI sceKernelGetProcessTime() {
|
||||
return clock->GetProcessTimeUS();
|
||||
// TODO: this timer should support suspends, so initial ptc needs to be updated on wake up
|
||||
return clock->GetTimeUS(initial_ptc);
|
||||
}
|
||||
|
||||
u64 PS4_SYSV_ABI sceKernelGetProcessTimeCounter() {
|
||||
|
||||
@@ -516,9 +516,12 @@ s32 saveDataMount(u32 user_id, char* dir_name, u32 mount_mode,
|
||||
mount_result->mount_status = 1;
|
||||
}
|
||||
} break;
|
||||
case ORBIS_SAVE_DATA_MOUNT_MODE_CREATE2:
|
||||
case ORBIS_SAVE_DATA_MOUNT_MODE_CREATE2 | ORBIS_SAVE_DATA_MOUNT_MODE_RDWR:
|
||||
case ORBIS_SAVE_DATA_MOUNT_MODE_CREATE2 | ORBIS_SAVE_DATA_MOUNT_MODE_RDWR |
|
||||
ORBIS_SAVE_DATA_MOUNT_MODE_COPY_ICON: {
|
||||
ORBIS_SAVE_DATA_MOUNT_MODE_COPY_ICON:
|
||||
case ORBIS_SAVE_DATA_MOUNT_MODE_CREATE2 | ORBIS_SAVE_DATA_MOUNT_MODE_RDWR |
|
||||
ORBIS_SAVE_DATA_MOUNT_MODE_DESTRUCT_OFF | ORBIS_SAVE_DATA_MOUNT_MODE_COPY_ICON: {
|
||||
if (!std::filesystem::exists(mount_dir)) {
|
||||
std::filesystem::create_directories(mount_dir);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <pthread.h>
|
||||
@@ -96,7 +96,7 @@ int VideoOutDriver::RegisterBuffers(VideoOutPort* port, s32 startIndex, void* co
|
||||
}
|
||||
|
||||
if (attribute->reserved0 != 0 || attribute->reserved1 != 0) {
|
||||
LOG_ERROR(Lib_VideoOut, "Invalid reserved memebers");
|
||||
LOG_ERROR(Lib_VideoOut, "Invalid reserved members");
|
||||
return ORBIS_VIDEO_OUT_ERROR_INVALID_VALUE;
|
||||
}
|
||||
if (attribute->aspect_ratio != 0) {
|
||||
@@ -252,8 +252,8 @@ void VideoOutDriver::SubmitFlipInternal(VideoOutPort* port, s32 index, s64 flip_
|
||||
requests.push({
|
||||
.frame = frame,
|
||||
.port = port,
|
||||
.index = index,
|
||||
.flip_arg = flip_arg,
|
||||
.index = index,
|
||||
.eop = is_eop,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
@@ -92,8 +92,8 @@ private:
|
||||
struct Request {
|
||||
Vulkan::Frame* frame;
|
||||
VideoOutPort* port;
|
||||
s32 index;
|
||||
s64 flip_arg;
|
||||
s32 index;
|
||||
bool eop;
|
||||
|
||||
operator bool() const noexcept {
|
||||
|
||||
@@ -185,14 +185,16 @@ s32 PS4_SYSV_ABI sceVideoOutGetFlipStatus(s32 handle, FlipStatus* status) {
|
||||
return ORBIS_VIDEO_OUT_ERROR_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
std::unique_lock lock{port->port_mutex};
|
||||
*status = port->flip_status;
|
||||
{
|
||||
std::unique_lock lock{port->port_mutex};
|
||||
*status = port->flip_status;
|
||||
}
|
||||
|
||||
LOG_INFO(Lib_VideoOut,
|
||||
"count = {}, processTime = {}, tsc = {}, submitTsc = {}, flipArg = {}, gcQueueNum = "
|
||||
"{}, flipPendingNum = {}, currentBuffer = {}",
|
||||
status->count, status->processTime, status->tsc, status->submitTsc, status->flipArg,
|
||||
status->gcQueueNum, status->flipPendingNum, status->currentBuffer);
|
||||
LOG_TRACE(Lib_VideoOut,
|
||||
"count = {}, processTime = {}, tsc = {}, submitTsc = {}, flipArg = {}, gcQueueNum = "
|
||||
"{}, flipPendingNum = {}, currentBuffer = {}",
|
||||
status->count, status->processTime, status->tsc, status->submitTsc, status->flipArg,
|
||||
status->gcQueueNum, status->flipPendingNum, status->currentBuffer);
|
||||
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ void Linker::Relocate(Module* module) {
|
||||
auto sym_bind = sym.GetBind();
|
||||
auto sym_type = sym.GetType();
|
||||
auto sym_visibility = sym.GetVisibility();
|
||||
u64 symbol_vitrual_addr = 0;
|
||||
u64 symbol_virtual_addr = 0;
|
||||
Loader::SymbolRecord symrec{};
|
||||
switch (sym_type) {
|
||||
case STT_FUN:
|
||||
@@ -185,12 +185,12 @@ void Linker::Relocate(Module* module) {
|
||||
}
|
||||
|
||||
if (sym_visibility != 0) {
|
||||
LOG_INFO(Core_Linker, "symbol visilibity !=0");
|
||||
LOG_INFO(Core_Linker, "symbol visibility !=0");
|
||||
}
|
||||
|
||||
switch (sym_bind) {
|
||||
case STB_LOCAL:
|
||||
symbol_vitrual_addr = rel_base_virtual_addr + sym.st_value;
|
||||
symbol_virtual_addr = rel_base_virtual_addr + sym.st_value;
|
||||
module->SetRelaBit(bit_idx);
|
||||
break;
|
||||
case STB_GLOBAL:
|
||||
@@ -200,14 +200,14 @@ void Linker::Relocate(Module* module) {
|
||||
// Only set the rela bit if the symbol was actually resolved and not stubbed.
|
||||
module->SetRelaBit(bit_idx);
|
||||
}
|
||||
symbol_vitrual_addr = symrec.virtual_address;
|
||||
symbol_virtual_addr = symrec.virtual_address;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ASSERT_MSG(0, "unknown bind type {}", sym_bind);
|
||||
}
|
||||
rel_is_resolved = (symbol_vitrual_addr != 0);
|
||||
rel_value = (rel_is_resolved ? symbol_vitrual_addr + addend : 0);
|
||||
rel_is_resolved = (symbol_virtual_addr != 0);
|
||||
rel_value = (rel_is_resolved ? symbol_virtual_addr + addend : 0);
|
||||
rel_name = symrec.name;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -328,6 +328,11 @@ int MemoryManager::DirectQueryAvailable(PAddr search_start, PAddr search_end, si
|
||||
PAddr paddr{};
|
||||
size_t max_size{};
|
||||
while (dmem_area != dmem_map.end() && dmem_area->second.GetEnd() <= search_end) {
|
||||
if (!dmem_area->second.is_free) {
|
||||
dmem_area++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dmem_area->second.size > max_size) {
|
||||
paddr = dmem_area->second.base;
|
||||
max_size = dmem_area->second.size;
|
||||
@@ -344,7 +349,7 @@ void MemoryManager::NameVirtualRange(VAddr virtual_addr, size_t size, std::strin
|
||||
auto it = FindVMA(virtual_addr);
|
||||
|
||||
ASSERT_MSG(it->second.Contains(virtual_addr, size),
|
||||
"Range provided is not fully containted in vma");
|
||||
"Range provided is not fully contained in vma");
|
||||
it->second.name = name;
|
||||
}
|
||||
VAddr MemoryManager::SearchFree(VAddr virtual_addr, size_t size, u32 alignment) {
|
||||
|
||||
Reference in New Issue
Block a user