mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-11-11 00:30:30 +01:00
Random, mostly pointless fixes (#4959)
Remove dead code in DecoderImpl, fix weird harmless double-assign in TextEditor, fix FindStreams return check, fix broken memset and clean up a bit of Aio code, fix type for compare check in sceNpCmpNpIdInOrder, slightly de-slopify comments in sceNpCheckPlus, fix OrbisNpState defines based on extracted VSH defines, fix scePlayGoConvertLanguage types, fix scePlayGoGetProgress nullptr dereference, fix (I think?) missing break in HullShaderTransform, and fix (I think?) vk::Format result table definition. Needs review, I think most of this is fine, but I'd like a second opinion. Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
This commit is contained in:
1 parent
b8254edf3b
commit
548789cfa5
11 files changed
+22
-42
No files matched your search
+1
-19
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2024-2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <fmt/format.h>
|
||||
@@ -22,24 +22,6 @@ std::string DecoderImpl::disassembleInst(ZydisDecodedInstruction& inst,
|
||||
return szBuffer;
|
||||
}
|
||||
|
||||
void DecoderImpl::printInstruction(void* code, u64 address) {
|
||||
ZydisDecodedInstruction instruction;
|
||||
ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT_VISIBLE];
|
||||
ZyanStatus status =
|
||||
ZydisDecoderDecodeFull(&m_decoder, code, sizeof(code), &instruction, operands);
|
||||
if (!ZYAN_SUCCESS(status)) {
|
||||
fmt::print("decode instruction failed at {}\n", fmt::ptr(code));
|
||||
} else {
|
||||
printInst(instruction, operands, address);
|
||||
}
|
||||
}
|
||||
|
||||
void DecoderImpl::printInst(ZydisDecodedInstruction& inst, ZydisDecodedOperand* operands,
|
||||
u64 address) {
|
||||
std::string s = disassembleInst(inst, operands, address);
|
||||
fmt::print("instruction: {}\n", s);
|
||||
}
|
||||
|
||||
ZyanStatus DecoderImpl::decodeInstruction(ZydisDecodedInstruction& inst,
|
||||
ZydisDecodedOperand* operands, void* data, u64 size) {
|
||||
return ZydisDecoderDecodeFull(&m_decoder, data, size, &inst, operands);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2024-2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
@@ -16,8 +16,6 @@ public:
|
||||
|
||||
std::string disassembleInst(ZydisDecodedInstruction& inst, ZydisDecodedOperand* operands,
|
||||
u64 address);
|
||||
void printInst(ZydisDecodedInstruction& inst, ZydisDecodedOperand* operands, u64 address);
|
||||
void printInstruction(void* code, u64 address);
|
||||
ZyanStatus decodeInstruction(ZydisDecodedInstruction& inst, ZydisDecodedOperand* operands,
|
||||
void* data, u64 size = 15);
|
||||
|
||||
|
||||
@@ -2113,7 +2113,7 @@ void TextEditor::ColorizeInternal() {
|
||||
commentStartIndex = currentIndex;
|
||||
}
|
||||
|
||||
inComment = inComment =
|
||||
inComment =
|
||||
(commentStartLine < currentLine || (commentStartLine == currentLine &&
|
||||
commentStartIndex <= currentIndex));
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ bool AvPlayerSource::FindStreams() {
|
||||
}
|
||||
}
|
||||
m_duration = DurationMillis();
|
||||
return m_streams.size() >= 0;
|
||||
return m_streams.size() > 0;
|
||||
}
|
||||
|
||||
s32 AvPlayerSource::GetStreamCount() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2024-2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <thread>
|
||||
@@ -14,13 +14,12 @@
|
||||
|
||||
namespace Libraries::Kernel {
|
||||
|
||||
#define MAX_QUEUE 512
|
||||
static constexpr s32 ORBIS_KERNEL_AIO_MAX_QUEUES = 512;
|
||||
|
||||
static s32* id_state;
|
||||
static s32 id_index;
|
||||
|
||||
s32 PS4_SYSV_ABI sceKernelAioInitializeImpl(void* p, s32 size) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -185,7 +184,7 @@ s32 PS4_SYSV_ABI sceKernelAioSubmitReadCommands(OrbisKernelAioRWRequest req[], s
|
||||
|
||||
*id = id_index;
|
||||
|
||||
id_index = (id_index + 1) % MAX_QUEUE;
|
||||
id_index = (id_index + 1) % ORBIS_KERNEL_AIO_MAX_QUEUES;
|
||||
|
||||
if (!id_index)
|
||||
id_index++;
|
||||
@@ -221,7 +220,7 @@ s32 PS4_SYSV_ABI sceKernelAioSubmitReadCommandsMultiple(OrbisKernelAioRWRequest
|
||||
|
||||
id[i] = id_index;
|
||||
|
||||
id_index = (id_index + 1) % MAX_QUEUE;
|
||||
id_index = (id_index + 1) % ORBIS_KERNEL_AIO_MAX_QUEUES;
|
||||
|
||||
if (!id_index)
|
||||
id_index++;
|
||||
@@ -259,7 +258,7 @@ s32 PS4_SYSV_ABI sceKernelAioSubmitWriteCommands(OrbisKernelAioRWRequest req[],
|
||||
|
||||
*id = id_index;
|
||||
|
||||
id_index = (id_index + 1) % MAX_QUEUE;
|
||||
id_index = (id_index + 1) % ORBIS_KERNEL_AIO_MAX_QUEUES;
|
||||
|
||||
// skip id_index equals 0 , because sceKernelAioCancelRequest will submit id
|
||||
// equal to 0
|
||||
@@ -294,7 +293,7 @@ s32 PS4_SYSV_ABI sceKernelAioSubmitWriteCommandsMultiple(OrbisKernelAioRWRequest
|
||||
}
|
||||
|
||||
id[i] = id_index;
|
||||
id_index = (id_index + 1) % MAX_QUEUE;
|
||||
id_index = (id_index + 1) % ORBIS_KERNEL_AIO_MAX_QUEUES;
|
||||
|
||||
if (!id_index)
|
||||
id_index++;
|
||||
@@ -314,8 +313,8 @@ s32 PS4_SYSV_ABI sceKernelAioInitializeParam() {
|
||||
|
||||
void RegisterAio(Core::Loader::SymbolsResolver* sym) {
|
||||
id_index = 1;
|
||||
id_state = (int*)malloc(sizeof(int) * MAX_QUEUE);
|
||||
memset(id_state, 0, sizeof(sizeof(int) * MAX_QUEUE));
|
||||
id_state = reinterpret_cast<s32*>(malloc(sizeof(s32) * ORBIS_KERNEL_AIO_MAX_QUEUES));
|
||||
memset(id_state, 0, sizeof(s32) * ORBIS_KERNEL_AIO_MAX_QUEUES);
|
||||
|
||||
LIB_FUNCTION("fR521KIGgb8", "libkernel", 1, "libkernel", sceKernelAioCancelRequest);
|
||||
LIB_FUNCTION("3Lca1XBrQdY", "libkernel", 1, "libkernel", sceKernelAioCancelRequests);
|
||||
|
||||
@@ -120,7 +120,7 @@ s32 PS4_SYSV_ABI sceNpCmpNpIdInOrder(OrbisNpId* np_id1, OrbisNpId* np_id2, u32*
|
||||
return ORBIS_NP_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
u32 compare =
|
||||
s32 compare =
|
||||
std::strncmp(np_id1->handle.data, np_id2->handle.data, ORBIS_NP_ONLINEID_MAX_LENGTH);
|
||||
if (compare < 0) {
|
||||
*out_result = -1;
|
||||
|
||||
@@ -256,7 +256,7 @@ s32 PS4_SYSV_ABI sceNpCheckPlus(s32 req_id, const OrbisNpCheckPlusParameter* par
|
||||
}
|
||||
if (param->features < 1 || param->features > 3) {
|
||||
// TODO: If compiled SDK version is greater or equal to fw 3.50,
|
||||
// // error if param->features != 1 instead.
|
||||
// error if param->features != 1 instead.
|
||||
return ORBIS_NP_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
// The reserved field must be zero-initialized by the caller.
|
||||
|
||||
@@ -20,7 +20,7 @@ constexpr s32 ORBIS_NP_MANAGER_REQUEST_LIMIT = 0x20;
|
||||
constexpr s32 ORBIS_NP_MANAGER_REQUEST_ID_OFFSET = 0x20000000;
|
||||
|
||||
enum class OrbisNpState : u32 {
|
||||
Unknown = 0,
|
||||
NotSignedUp = 0,
|
||||
SignedOut = 1,
|
||||
SignedIn = 2,
|
||||
};
|
||||
|
||||
@@ -170,8 +170,7 @@ s32 PS4_SYSV_ABI scePlayGoGetLocus(OrbisPlayGoHandle handle, const OrbisPlayGoCh
|
||||
|
||||
s32 PS4_SYSV_ABI scePlayGoGetProgress(OrbisPlayGoHandle handle, const OrbisPlayGoChunkId* chunkIds,
|
||||
uint32_t numberOfEntries, OrbisPlayGoProgress* outProgress) {
|
||||
LOG_DEBUG(Lib_PlayGo, "called handle = {}, chunkIds = {}, numberOfEntries = {}", handle,
|
||||
*chunkIds, numberOfEntries);
|
||||
LOG_DEBUG(Lib_PlayGo, "called handle = {}, numberOfEntries = {}", handle, numberOfEntries);
|
||||
|
||||
if (handle != PlaygoHandle) {
|
||||
return ORBIS_PLAYGO_ERROR_BAD_HANDLE;
|
||||
@@ -228,7 +227,7 @@ s32 PS4_SYSV_ABI scePlayGoGetToDoList(OrbisPlayGoHandle handle, OrbisPlayGoToDo*
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int scePlayGoConvertLanguage(int systemLang) {
|
||||
u64 scePlayGoConvertLanguage(u64 systemLang) {
|
||||
if (systemLang >= 0 && systemLang < 48) {
|
||||
return (1 << (64 - systemLang - 1));
|
||||
} else {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2024-2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <unordered_map>
|
||||
@@ -244,6 +244,7 @@ private:
|
||||
// Stop here
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IR::Opcode::Phi: {
|
||||
auto it = phi_infos.find(use.user);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2024-2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/assert.h"
|
||||
@@ -762,7 +762,8 @@ static size_t GetSurfaceFormatTableIndex(AmdGpu::DataFormat data_format,
|
||||
}
|
||||
|
||||
static auto surface_format_table = []() constexpr {
|
||||
std::array<vk::Format, 1 << amd_gpu_data_format_bit_size * 1 << amd_gpu_number_format_bit_size>
|
||||
std::array<vk::Format,
|
||||
(1 << amd_gpu_data_format_bit_size) * (1 << amd_gpu_number_format_bit_size)>
|
||||
result;
|
||||
for (auto& entry : result) {
|
||||
entry = vk::Format::eUndefined;
|
||||
|
||||
Reference in new issue
Block a user