BB retail hacks

This commit is contained in:
IndecisiveTurtle 2024-08-18 20:07:59 +03:00
parent 09da94b7b2
commit 1b68929d12
6 changed files with 101 additions and 2 deletions

View file

@ -0,0 +1,14 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
constexpr int ORBIS_KERNEL_EVF_ATTR_TH_FIFO = 0x01;
constexpr int ORBIS_KERNEL_EVF_ATTR_TH_PRIO = 0x02;
constexpr int ORBIS_KERNEL_EVF_ATTR_SINGLE = 0x10;
constexpr int ORBIS_KERNEL_EVF_ATTR_MULTI = 0x20;
constexpr int ORBIS_KERNEL_EVF_WAITMODE_AND = 0x01;
constexpr int ORBIS_KERNEL_EVF_WAITMODE_OR = 0x02;
constexpr int ORBIS_KERNEL_EVF_WAITMODE_CLEAR_ALL = 0x10;
constexpr int ORBIS_KERNEL_EVF_WAITMODE_CLEAR_PAT = 0x20;

View file

@ -1065,7 +1065,16 @@ ScePthread PThreadPool::Create() {
}
}
#ifdef _WIN64
auto* ret = new PthreadInternal{};
#else
// TODO: Linux specific hack
static u8* hint_address = reinterpret_cast<u8*>(0x7FFFFC000ULL);
auto* ret = reinterpret_cast<PthreadInternal*>(
mmap(hint_address, sizeof(PthreadInternal), PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0));
hint_address += Common::AlignUp(sizeof(PthreadInternal), 4_KB);
#endif
ret->is_free = false;
ret->is_detached = false;
ret->is_almost_done = false;

View file

@ -218,6 +218,11 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span<const u32> dcb, std::span<c
case PM4ItOpcode::ClearState: {
break;
}
case PM4ItOpcode::SetBase:
case PM4ItOpcode::DispatchIndirect:
case PM4ItOpcode::DrawIndirect: {
break;
}
case PM4ItOpcode::SetConfigReg: {
const auto* set_data = reinterpret_cast<const PM4CmdSetData*>(header);
const auto reg_addr = ConfigRegWordOffset + set_data->reg_offset;

View file

@ -96,6 +96,68 @@ bool ComputePipeline::BindResources(VideoCore::BufferCache& buffer_cache,
Shader::PushData push_data{};
u32 binding{};
if (compute_key == 0x3d5ebf4e) {
const auto& src = info.buffers[0];
const auto src_sharp = src.GetVsharp(info);
const auto& dst = info.buffers[1];
const auto dst_sharp = dst.GetVsharp(info);
if (dst_sharp.base_address == 0x510e0000 || dst_sharp.base_address == 0x1926e0000 || dst_sharp.base_address == 0x1d42e0000) {
VideoCore::ImageViewInfo view_info;
view_info.format = vk::Format::eR8G8B8A8Unorm;
view_info.type = vk::ImageViewType::e2D;
view_info.range.extent.layers = 1;
view_info.range.extent.levels = 1;
AmdGpu::Image src_image;
src_image.base_address = src_sharp.base_address >> 8;
src_image.base_level = 0;
src_image.width = 1920 - 1;
src_image.height = 1080 - 1;
src_image.depth = 1;
src_image.data_format = u64(AmdGpu::DataFormat::Format8_8_8_8);
src_image.num_format = u64(AmdGpu::NumberFormat::Unorm);
src_image.dst_sel_x = 4;
src_image.dst_sel_y = 5;
src_image.dst_sel_z = 6;
src_image.dst_sel_w = 7;
src_image.pitch = 1920 - 1;
src_image.type = u64(AmdGpu::ImageType::Color2D);
src_image.tiling_index = u64(AmdGpu::TilingMode::Display_MacroTiled);
VideoCore::ImageInfo src_info{src_image};
const auto src_id = texture_cache.FindImage(src_info);
auto& src_img = texture_cache.GetImage(src_id);
src_img.Transit(vk::ImageLayout::eTransferSrcOptimal, vk::AccessFlagBits::eTransferRead);
src_image.base_address = dst_sharp.base_address >> 8;
VideoCore::ImageInfo dst_info{src_image};
const auto dst_id = texture_cache.FindImage(dst_info);
auto& dst_img = texture_cache.GetImage(dst_id);
dst_img.Transit(vk::ImageLayout::eTransferDstOptimal, vk::AccessFlagBits::eTransferWrite);
const auto cmdbuf = scheduler.CommandBuffer();
scheduler.EndRendering();
const vk::ImageCopy copy = {
.srcSubresource = {
.aspectMask = vk::ImageAspectFlagBits::eColor,
.mipLevel = 0,
.baseArrayLayer = 0,
.layerCount = 1,
},
.srcOffset = {0, 0, 0},
.dstSubresource = {
.aspectMask = vk::ImageAspectFlagBits::eColor,
.mipLevel = 0,
.baseArrayLayer = 0,
.layerCount = 1,
},
.dstOffset = {0, 0, 0},
.extent = {1920, 1080, 1},
};
cmdbuf.copyImage(src_img.image, vk::ImageLayout::eTransferSrcOptimal, dst_img.image, vk::ImageLayout::eTransferDstOptimal, copy);
return false;
}
}
for (const auto& buffer : info.buffers) {
const auto vsharp = buffer.GetVsharp(info);
const VAddr address = vsharp.base_address;
@ -114,7 +176,7 @@ bool ComputePipeline::BindResources(VideoCore::BufferCache& buffer_cache,
}
}
const u32 size = vsharp.GetSize();
if (buffer.is_written) {
if (buffer.is_written && compute_key != 0xfefebf9f) {
texture_cache.InvalidateMemory(address, size, true);
}
const u32 alignment =

View file

@ -95,7 +95,7 @@ GraphicsPipeline::GraphicsPipeline(const Instance& instance_, Scheduler& schedul
.depthClampEnable = false,
.rasterizerDiscardEnable = false,
.polygonMode = LiverpoolToVK::PolygonMode(key.polygon_mode),
.cullMode = vk::CullModeFlagBits::eNone /*LiverpoolToVK::CullMode(key.cull_mode)*/,
.cullMode = LiverpoolToVK::CullMode(key.cull_mode),
.frontFace = key.front_face == Liverpool::FrontFace::Clockwise
? vk::FrontFace::eClockwise
: vk::FrontFace::eCounterClockwise,

View file

@ -270,6 +270,11 @@ std::unique_ptr<GraphicsPipeline> PipelineCache::CreateGraphicsPipeline() {
DumpShader(code, hash, stage, "bin");
}
if (hash == 0x8ccd4c7 || hash == 3273382176 || hash == 1253917491 || hash == 3568414570 ||
hash == 886182625 || hash == 2876255299 || hash == 2153234908 || hash == 0xc0cbc309) {
return nullptr;
}
block_pool.ReleaseContents();
inst_pool.ReleaseContents();
@ -320,6 +325,10 @@ std::unique_ptr<ComputePipeline> PipelineCache::CreateComputePipeline() {
block_pool.ReleaseContents();
inst_pool.ReleaseContents();
if (compute_key == 0xa509af23 || compute_key == 0x4ca76892 || compute_key == 0xa954e79d) {
return nullptr;
}
// Recompile shader to IR.
try {
LOG_INFO(Render_Vulkan, "Compiling cs shader {:#x}", compute_key);