mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 02:32:36 +01:00
Fix warnings in emucore
This commit is contained in:
parent
f2f3321952
commit
250736ece5
@ -923,7 +923,7 @@ public:
|
||||
name.append(".gz");
|
||||
|
||||
z_stream zs{};
|
||||
uLong zsz = compressBound(obj.getBufferSize()) + 256;
|
||||
uLong zsz = compressBound(::narrow<u32>(obj.getBufferSize(), HERE)) + 256;
|
||||
auto zbuf = std::make_unique<uchar[]>(zsz);
|
||||
#ifndef _MSC_VER
|
||||
#pragma GCC diagnostic push
|
||||
|
@ -7,22 +7,13 @@
|
||||
#include <functional>
|
||||
#include <string_view>
|
||||
|
||||
// Copy null-terminated string from std::string to char array with truncation
|
||||
template <std::size_t N>
|
||||
inline void strcpy_trunc(char (&dst)[N], const std::string& src)
|
||||
// Copy null-terminated string from a std::string or a char array to a char array with truncation
|
||||
template <typename D, typename T>
|
||||
inline void strcpy_trunc(D& dst, const T& src)
|
||||
{
|
||||
const std::size_t count = src.size() >= N ? N - 1 : src.size();
|
||||
std::memcpy(dst, src.c_str(), count);
|
||||
std::memset(dst + count, 0, N - count);
|
||||
}
|
||||
|
||||
// Copy null-terminated string from char array to another char array with truncation
|
||||
template <std::size_t N, std::size_t N2>
|
||||
inline void strcpy_trunc(char (&dst)[N], const char (&src)[N2])
|
||||
{
|
||||
const std::size_t count = N2 >= N ? N - 1 : N2;
|
||||
std::memcpy(dst, src, count);
|
||||
std::memset(dst + count, 0, N - count);
|
||||
const std::size_t count = std::size(src) >= std::size(dst) ? std::size(dst) - 1 : std::size(src);
|
||||
std::memcpy(std::data(dst), std::data(src), count);
|
||||
std::memset(std::data(dst) + count, 0, std::size(dst) - count);
|
||||
}
|
||||
|
||||
namespace fmt
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "cond.h"
|
||||
#include "cond.h"
|
||||
#include "sync.h"
|
||||
#include "lockless.h"
|
||||
|
||||
@ -38,7 +38,7 @@ void cond_variable::imp_wake(u32 _count) noexcept
|
||||
}
|
||||
|
||||
// Add signal
|
||||
value += c_signal_mask & -c_signal_mask;
|
||||
value += c_signal_mask & (0 - c_signal_mask);
|
||||
return true;
|
||||
});
|
||||
|
||||
@ -47,7 +47,7 @@ void cond_variable::imp_wake(u32 _count) noexcept
|
||||
return;
|
||||
}
|
||||
|
||||
if (_count > 1 || ((_old + (c_signal_mask & -c_signal_mask)) & c_signal_mask) == c_signal_mask)
|
||||
if (_count > 1 || ((_old + (c_signal_mask & (0 - c_signal_mask))) & c_signal_mask) == c_signal_mask)
|
||||
{
|
||||
// Resort to notify_all if signal count reached max
|
||||
m_value.notify_all();
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "stdafx.h"
|
||||
#include "stdafx.h"
|
||||
#include "key_vault.h"
|
||||
#include "unedat.h"
|
||||
|
||||
@ -578,7 +578,7 @@ int validate_npd_hashes(const char* file_name, const u8* klicensee, NPD_HEADER *
|
||||
int title_hash_result = 0;
|
||||
int dev_hash_result = 0;
|
||||
|
||||
const auto file_name_length = std::strlen(file_name);
|
||||
const s32 file_name_length = ::narrow<s32>(std::strlen(file_name), HERE);
|
||||
std::unique_ptr<u8[]> buf(new u8[0x30 + file_name_length]);
|
||||
|
||||
// Build the title buffer (content_id + file_name).
|
||||
|
@ -744,7 +744,7 @@ bool SCEDecrypter::DecryptData()
|
||||
// Calculate the total data size.
|
||||
for (unsigned int i = 0; i < meta_hdr.section_count; i++)
|
||||
{
|
||||
data_buf_length += meta_shdr[i].data_size;
|
||||
data_buf_length += ::narrow<u32>(meta_shdr[i].data_size, HERE);
|
||||
}
|
||||
|
||||
// Allocate a buffer to store decrypted data.
|
||||
@ -798,7 +798,7 @@ bool SCEDecrypter::DecryptData()
|
||||
}
|
||||
|
||||
// Advance the buffer's offset.
|
||||
data_buf_offset += meta_shdr[i].data_size;
|
||||
data_buf_offset += ::narrow<u32>(meta_shdr[i].data_size, HERE);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -828,7 +828,7 @@ std::vector<fs::file> SCEDecrypter::MakeFile()
|
||||
strm.zalloc = Z_NULL;
|
||||
strm.zfree = Z_NULL;
|
||||
strm.opaque = Z_NULL;
|
||||
strm.avail_in = meta_shdr[i].data_size;
|
||||
strm.avail_in = ::narrow<uInt>(meta_shdr[i].data_size, HERE);
|
||||
strm.avail_out = BUFSIZE;
|
||||
strm.next_in = data_buf.get()+data_buf_offset;
|
||||
strm.next_out = tempbuf;
|
||||
@ -873,7 +873,7 @@ std::vector<fs::file> SCEDecrypter::MakeFile()
|
||||
}
|
||||
|
||||
// Advance the data buffer offset by data size.
|
||||
data_buf_offset += meta_shdr[i].data_size;
|
||||
data_buf_offset += ::narrow<u32>(meta_shdr[i].data_size, HERE);
|
||||
|
||||
if (out_f.pos() != out_f.size())
|
||||
fmt::throw_exception("MakeELF written bytes (%llu) does not equal buffer size (%llu).", out_f.pos(), out_f.size());
|
||||
@ -1238,7 +1238,7 @@ bool SELFDecrypter::DecryptData()
|
||||
if (meta_shdr[i].encrypted == 3)
|
||||
{
|
||||
if ((meta_shdr[i].key_idx <= meta_hdr.key_count - 1) && (meta_shdr[i].iv_idx <= meta_hdr.key_count))
|
||||
data_buf_length += meta_shdr[i].data_size;
|
||||
data_buf_length += ::narrow<u32>(meta_shdr[i].data_size, HERE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1284,7 +1284,7 @@ bool SELFDecrypter::DecryptData()
|
||||
memcpy(data_buf.get() + data_buf_offset, buf.get(), meta_shdr[i].data_size);
|
||||
|
||||
// Advance the buffer's offset.
|
||||
data_buf_offset += meta_shdr[i].data_size;
|
||||
data_buf_offset += ::narrow<u32>(meta_shdr[i].data_size, HERE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "key_vault.h"
|
||||
#include "zlib.h"
|
||||
@ -489,7 +489,7 @@ private:
|
||||
}
|
||||
|
||||
// Advance the data buffer offset by data size.
|
||||
data_buf_offset += meta_shdr[i].data_size;
|
||||
data_buf_offset += ::narrow<u32>(meta_shdr[i].data_size, HERE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,12 @@
|
||||
#include <cstring>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include "Utilities/StrUtil.h"
|
||||
#include "Utilities/span.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
// Auxiliary functions (endian swap, xor).
|
||||
|
||||
@ -142,11 +146,9 @@ void cmac_hash_forge(unsigned char *key, int key_len, unsigned char *in, int in_
|
||||
|
||||
char* extract_file_name(const char* file_path, char real_file_name[MAX_PATH])
|
||||
{
|
||||
size_t file_path_len = strlen(file_path);
|
||||
const char* p = strrchr(file_path, '/');
|
||||
if (!p) p = strrchr(file_path, '\\');
|
||||
if (p) file_path_len = file_path + file_path_len - p - 1;
|
||||
strncpy(real_file_name, p ? (p + 1) : file_path, file_path_len + 1);
|
||||
|
||||
std::string_view v(file_path);
|
||||
v = v.substr(0, v.find_last_of("/\\"));
|
||||
gsl::span r(real_file_name, MAX_PATH);
|
||||
strcpy_trunc(r, v);
|
||||
return real_file_name;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifdef LLVM_AVAILABLE
|
||||
#ifdef LLVM_AVAILABLE
|
||||
|
||||
#include "CPUTranslator.h"
|
||||
|
||||
@ -117,21 +117,21 @@ v128 cpu_translator::get_const_vector<v128>(llvm::Constant* c, u32 a, u32 b)
|
||||
{
|
||||
for (u32 i = 0; i < 16; i++)
|
||||
{
|
||||
result._u8[i] = cv->getElementAsInteger(i);
|
||||
result._u8[i] = static_cast<u8>(cv->getElementAsInteger(i));
|
||||
}
|
||||
}
|
||||
else if (sct->isIntegerTy(16))
|
||||
{
|
||||
for (u32 i = 0; i < 8; i++)
|
||||
{
|
||||
result._u16[i] = cv->getElementAsInteger(i);
|
||||
result._u16[i] = static_cast<u16>(cv->getElementAsInteger(i));
|
||||
}
|
||||
}
|
||||
else if (sct->isIntegerTy(32))
|
||||
{
|
||||
for (u32 i = 0; i < 4; i++)
|
||||
{
|
||||
result._u32[i] = cv->getElementAsInteger(i);
|
||||
result._u32[i] = static_cast<u32>(cv->getElementAsInteger(i));
|
||||
}
|
||||
}
|
||||
else if (sct->isIntegerTy(64))
|
||||
|
@ -80,7 +80,7 @@ bool statichle_handler::load_patterns()
|
||||
for (u32 j = 0; j < 32; j++)
|
||||
dapat.start_pattern[j] = char_to_u8(pattern[0][j * 2], pattern[0][(j * 2) + 1]);
|
||||
|
||||
dapat.crc16_length = char_to_u8(pattern[1][0], pattern[1][1]);
|
||||
dapat.crc16_length = ::narrow<u8>(char_to_u8(pattern[1][0], pattern[1][1]), HERE);
|
||||
dapat.crc16 = (char_to_u8(pattern[2][0], pattern[2][1]) << 8) | char_to_u8(pattern[2][2], pattern[2][3]);
|
||||
dapat.total_length = (char_to_u8(pattern[3][0], pattern[3][1]) << 8) | char_to_u8(pattern[3][2], pattern[3][3]);
|
||||
dapat.module = pattern[4];
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "Loader/PSF.h"
|
||||
#include "Utilities/StrUtil.h"
|
||||
#include "Utilities/span.h"
|
||||
#include "util/init_mutex.hpp"
|
||||
|
||||
#include <thread>
|
||||
@ -874,7 +875,6 @@ error_code cellGameGetParamString(s32 id, vm::ptr<char> buf, u32 bufsize)
|
||||
}
|
||||
|
||||
const std::string value = psf::get_string(prm->sfo, std::string(key.name));
|
||||
const auto value_size = value.size() + 1;
|
||||
|
||||
if (value.empty() && !prm->sfo.count(std::string(key.name)))
|
||||
{
|
||||
@ -882,15 +882,8 @@ error_code cellGameGetParamString(s32 id, vm::ptr<char> buf, u32 bufsize)
|
||||
cellGame.warning("cellGameGetParamString(): id=%d was not found", id);
|
||||
}
|
||||
|
||||
const auto pbuf = buf.get_ptr();
|
||||
const bool to_pad = bufsize > value_size;
|
||||
std::memcpy(pbuf, value.c_str(), to_pad ? value_size : bufsize);
|
||||
|
||||
if (to_pad)
|
||||
{
|
||||
std::memset(pbuf + value_size, 0, bufsize - value_size);
|
||||
}
|
||||
|
||||
gsl::span dst(buf.get_ptr(), bufsize);
|
||||
strcpy_trunc(dst, value);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ bool ime_jp_manager::addString(vm::cptr<u16> str)
|
||||
if (!str)
|
||||
return false;
|
||||
|
||||
for (size_t i = 0; i < CELL_IMEJP_STRING_MAXLENGTH; i++)
|
||||
for (u32 i = 0; i < CELL_IMEJP_STRING_MAXLENGTH; i++)
|
||||
{
|
||||
if (!addChar(str[i]))
|
||||
return false;
|
||||
@ -111,7 +111,7 @@ void ime_jp_manager::moveCursorEnd(s8 amount)
|
||||
{
|
||||
if (amount > 0)
|
||||
{
|
||||
cursor_end = std::max(static_cast<s32>(cursor), std::min<s32>(cursor_end + amount, input_string.length() - 1));
|
||||
cursor_end = std::max(static_cast<s32>(cursor), std::min<s32>(static_cast<s32>(cursor_end) + amount, ::narrow<s32>(input_string.length()) - 1));
|
||||
}
|
||||
else if (amount < 0)
|
||||
{
|
||||
@ -199,7 +199,7 @@ error_code cellImeJpOpen3(sys_memory_container_t container_id, vm::ptr<CellImeJp
|
||||
|
||||
if (addDicPath)
|
||||
{
|
||||
for (size_t i = 0; i < 4; i++)
|
||||
for (u32 i = 0; i < 4; i++)
|
||||
{
|
||||
if (addDicPath[i] && addDicPath[i]->path[0])
|
||||
{
|
||||
@ -798,10 +798,10 @@ error_code cellImeJpMoveFocusClause(CellImeJpHandle hImeJpHandle, s16 moveType)
|
||||
manager->moveCursor(-1);
|
||||
break;
|
||||
case CELL_IMEJP_FOCUS_TOP:
|
||||
manager->moveCursor((-1) * manager->input_string.length());
|
||||
manager->moveCursor(-1 * ::narrow<s8>(manager->input_string.length(), HERE));
|
||||
break;
|
||||
case CELL_IMEJP_FOCUS_END:
|
||||
manager->moveCursor(manager->input_string.length());
|
||||
manager->moveCursor(::narrow<s8>(manager->input_string.length(), HERE));
|
||||
manager->moveCursor(-1);
|
||||
break;
|
||||
default:
|
||||
@ -830,7 +830,7 @@ error_code cellImeJpGetFocusTop(CellImeJpHandle hImeJpHandle, vm::ptr<s16> pFocu
|
||||
return CELL_IMEJP_ERROR_CONTEXT;
|
||||
}
|
||||
|
||||
*pFocusTop = manager->cursor * 2; // offset in bytes
|
||||
*pFocusTop = static_cast<u16>(manager->cursor * 2); // offset in bytes
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -858,7 +858,7 @@ error_code cellImeJpGetFocusLength(CellImeJpHandle hImeJpHandle, vm::ptr<s16> pF
|
||||
}
|
||||
else
|
||||
{
|
||||
*pFocusLength = (manager->cursor_end - manager->cursor + 1) * 2; // offset in bytes
|
||||
*pFocusLength = static_cast<u16>((manager->cursor_end - manager->cursor + 1) * 2); // offset in bytes
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
@ -881,14 +881,14 @@ error_code cellImeJpGetConfirmYomiString(CellImeJpHandle hImeJpHandle, vm::ptr<u
|
||||
return CELL_IMEJP_ERROR_CONTEXT;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < CELL_IMEJP_STRING_MAXLENGTH; i++)
|
||||
for (u32 i = 0; i < CELL_IMEJP_STRING_MAXLENGTH; i++)
|
||||
{
|
||||
pYomiString[i] = 0;
|
||||
}
|
||||
|
||||
const size_t max_len = std::min<size_t>(CELL_IMEJP_STRING_MAXLENGTH - 1, manager->confirmed_string.length());
|
||||
|
||||
for (size_t i = 0; i < max_len; i++)
|
||||
for (u32 i = 0; i < max_len; i++)
|
||||
{
|
||||
pYomiString[i] = manager->confirmed_string[i];
|
||||
}
|
||||
@ -913,14 +913,14 @@ error_code cellImeJpGetConfirmString(CellImeJpHandle hImeJpHandle, vm::ptr<u16>
|
||||
return CELL_IMEJP_ERROR_CONTEXT;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < CELL_IMEJP_STRING_MAXLENGTH; i++)
|
||||
for (u32 i = 0; i < CELL_IMEJP_STRING_MAXLENGTH; i++)
|
||||
{
|
||||
pConfirmString[i] = 0;
|
||||
}
|
||||
|
||||
const size_t max_len = std::min<size_t>(CELL_IMEJP_STRING_MAXLENGTH - 1, manager->confirmed_string.length());
|
||||
|
||||
for (size_t i = 0; i < max_len; i++)
|
||||
for (u32 i = 0; i < max_len; i++)
|
||||
{
|
||||
pConfirmString[i] = manager->confirmed_string[i];
|
||||
}
|
||||
@ -945,14 +945,14 @@ error_code cellImeJpGetConvertYomiString(CellImeJpHandle hImeJpHandle, vm::ptr<u
|
||||
return CELL_IMEJP_ERROR_CONTEXT;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < CELL_IMEJP_STRING_MAXLENGTH; i++)
|
||||
for (u32 i = 0; i < CELL_IMEJP_STRING_MAXLENGTH; i++)
|
||||
{
|
||||
pYomiString[i] = 0;
|
||||
}
|
||||
|
||||
const size_t max_len = std::min<size_t>(CELL_IMEJP_STRING_MAXLENGTH - 1, manager->input_string.length());
|
||||
|
||||
for (size_t i = 0; i < max_len; i++)
|
||||
for (u32 i = 0; i < max_len; i++)
|
||||
{
|
||||
pYomiString[i] = manager->input_string[i];
|
||||
}
|
||||
@ -977,14 +977,14 @@ error_code cellImeJpGetConvertString(CellImeJpHandle hImeJpHandle, vm::ptr<u16>
|
||||
return CELL_IMEJP_ERROR_CONTEXT;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < CELL_IMEJP_STRING_MAXLENGTH; i++)
|
||||
for (u32 i = 0; i < CELL_IMEJP_STRING_MAXLENGTH; i++)
|
||||
{
|
||||
pConvertString[i] = 0;
|
||||
}
|
||||
|
||||
const size_t max_len = std::min<size_t>(CELL_IMEJP_STRING_MAXLENGTH - 1, manager->input_string.length());
|
||||
|
||||
for (size_t i = 0; i < max_len; i++)
|
||||
for (u32 i = 0; i < max_len; i++)
|
||||
{
|
||||
pConvertString[i] = manager->input_string[i];
|
||||
}
|
||||
|
@ -703,9 +703,9 @@ s32 cellSailPlayerSetParameter(vm::ptr<CellSailPlayer> pSelf, s32 parameterType,
|
||||
|
||||
switch (parameterType)
|
||||
{
|
||||
case CELL_SAIL_PARAMETER_GRAPHICS_ADAPTER_BUFFER_RELEASE_DELAY: pSelf->graphics_adapter_buffer_release_delay = param1; break; // TODO: Stream index
|
||||
case CELL_SAIL_PARAMETER_CONTROL_PPU_THREAD_STACK_SIZE: pSelf->control_ppu_thread_stack_size = param0; break;
|
||||
case CELL_SAIL_PARAMETER_ENABLE_APOST_SRC: pSelf->enable_apost_src = param1; break; // TODO: Stream index
|
||||
case CELL_SAIL_PARAMETER_GRAPHICS_ADAPTER_BUFFER_RELEASE_DELAY: pSelf->graphics_adapter_buffer_release_delay = static_cast<u32>(param1); break; // TODO: Stream index
|
||||
case CELL_SAIL_PARAMETER_CONTROL_PPU_THREAD_STACK_SIZE: pSelf->control_ppu_thread_stack_size = static_cast<u32>(param0); break;
|
||||
case CELL_SAIL_PARAMETER_ENABLE_APOST_SRC: pSelf->enable_apost_src = static_cast<u32>(param1); break; // TODO: Stream index
|
||||
default: cellSail.todo("cellSailPlayerSetParameter(): unimplemented parameter %s", ParameterCodeToName(parameterType));
|
||||
}
|
||||
|
||||
@ -718,6 +718,7 @@ s32 cellSailPlayerGetParameter(vm::ptr<CellSailPlayer> pSelf, s32 parameterType,
|
||||
|
||||
switch (parameterType)
|
||||
{
|
||||
case 0:
|
||||
default: cellSail.error("cellSailPlayerGetParameter(): unimplemented parameter %s", ParameterCodeToName(parameterType));
|
||||
}
|
||||
|
||||
@ -806,7 +807,7 @@ s32 cellSailPlayerCreateDescriptor(vm::ptr<CellSailPlayer> pSelf, s32 streamType
|
||||
{
|
||||
if (fs::file f{ vfs::get(uri.substr(12)) })
|
||||
{
|
||||
u64 size = f.size();
|
||||
u32 size = ::size32(f);
|
||||
u32 buffer = vm::alloc(size, vm::main);
|
||||
auto bufPtr = vm::cptr<PamfHeader>::make(buffer);
|
||||
PamfHeader *buf = const_cast<PamfHeader*>(bufPtr.get_ptr());
|
||||
|
@ -1767,7 +1767,7 @@ static NEVER_INLINE error_code savedata_get_list_item(vm::cptr<char> dirName, vm
|
||||
}
|
||||
|
||||
// get file stats, namely directory
|
||||
strcpy_trunc(dir->dirName, dirName.get_ptr());
|
||||
strcpy_trunc(dir->dirName, std::string_view(dirName.get_ptr()));
|
||||
dir->atime = dir_info.atime;
|
||||
dir->ctime = dir_info.ctime;
|
||||
dir->mtime = dir_info.mtime;
|
||||
|
@ -1047,8 +1047,7 @@ s32 _spurs::initialize(ppu_thread& ppu, vm::ptr<CellSpurs> spurs, u32 revision,
|
||||
|
||||
// Create a thread group for this SPURS context
|
||||
std::memcpy(spuTgName.get_ptr(), spurs->prefix, spurs->prefixSize);
|
||||
spuTgName[spurs->prefixSize] = '\0';
|
||||
std::strcat(spuTgName.get_ptr(), "CellSpursKernelGroup");
|
||||
std::memcpy(spuTgName.get_ptr() + spurs->prefixSize, "CellSpursKernelGroup", 21);
|
||||
|
||||
spuTgAttr->name = spuTgName;
|
||||
spuTgAttr->nsize = static_cast<u32>(std::strlen(spuTgAttr->name.get_ptr())) + 1;
|
||||
@ -1086,8 +1085,7 @@ s32 _spurs::initialize(ppu_thread& ppu, vm::ptr<CellSpurs> spurs, u32 revision,
|
||||
|
||||
// Initialise all SPUs in the SPU thread group
|
||||
std::memcpy(spuThName.get_ptr(), spurs->prefix, spurs->prefixSize);
|
||||
spuThName[spurs->prefixSize] = '\0';
|
||||
std::strcat(spuThName.get_ptr(), "CellSpursKernel");
|
||||
std::memcpy(spuThName.get_ptr() + spurs->prefixSize, "CellSpursKernel", 16);
|
||||
|
||||
spuThAttr->name = spuThName;
|
||||
spuThAttr->name_len = static_cast<u32>(std::strlen(spuThName.get_ptr())) + 2;
|
||||
|
@ -1207,7 +1207,7 @@ void spursSysServiceTraceUpdate(spu_thread& spu, SpursKernelContext* ctxt, u32 a
|
||||
}
|
||||
else
|
||||
{
|
||||
std::memcpy(vm::base(spu.offset + 0x2C00), vm::base(spurs->traceBuffer.addr() & -0x4), 0x80);
|
||||
std::memcpy(vm::base(spu.offset + 0x2C00), vm::base(vm::cast(spurs->traceBuffer.addr(), HERE) & -0x4), 0x80);
|
||||
auto traceBuffer = vm::_ptr<CellSpursTraceInfo>(spu.offset + 0x2C00);
|
||||
ctxt->traceMsgCount = traceBuffer->count[ctxt->spuNum];
|
||||
}
|
||||
@ -1670,7 +1670,7 @@ s32 spursTasketSaveTaskContext(spu_thread& spu)
|
||||
return CELL_SPURS_TASK_ERROR_STAT;
|
||||
}
|
||||
|
||||
u32 allocLsBlocks = taskInfo->context_save_storage_and_alloc_ls_blocks & 0x7F;
|
||||
u32 allocLsBlocks = static_cast<u32>(taskInfo->context_save_storage_and_alloc_ls_blocks & 0x7F);
|
||||
u32 lsBlocks = 0;
|
||||
v128 ls_pattern = v128::from64r(taskInfo->ls_pattern._u64[0], taskInfo->ls_pattern._u64[1]);
|
||||
for (auto i = 0; i < 128; i++)
|
||||
|
@ -1091,7 +1091,7 @@ error_code _cellSyncLFQueueCompletePushPointer(ppu_thread& ppu, vm::ptr<CellSync
|
||||
{
|
||||
verify(HERE), (queue->push3.compare_and_swap_test(old2, push3));
|
||||
verify(HERE), (fpSendSignal);
|
||||
return not_an_error(fpSendSignal(ppu, queue->m_eaSignal.addr(), var6));
|
||||
return not_an_error(fpSendSignal(ppu, vm::cast(queue->m_eaSignal.addr(), HERE), var6));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1390,7 +1390,7 @@ error_code _cellSyncLFQueueCompletePopPointer(ppu_thread& ppu, vm::ptr<CellSyncL
|
||||
{
|
||||
verify(HERE), (queue->pop3.compare_and_swap_test(old2, pop3));
|
||||
verify(HERE), (fpSendSignal);
|
||||
return not_an_error(fpSendSignal(ppu, queue->m_eaSignal.addr(), var6));
|
||||
return not_an_error(fpSendSignal(ppu, vm::cast(queue->m_eaSignal.addr(), HERE), var6));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "Utilities/StrUtil.h"
|
||||
#include "Utilities/lockless.h"
|
||||
#include "Utilities/span.h"
|
||||
|
||||
LOG_CHANNEL(cellSysutil);
|
||||
|
||||
@ -348,8 +349,8 @@ error_code cellSysutilGetSystemParamString(CellSysutilParamId id, vm::ptr<char>
|
||||
cellSysutil.error("cellSysutilGetSystemParamString: Unknown ParamId 0x%x", id);
|
||||
}
|
||||
|
||||
std::strncpy(buf.get_ptr(), param_str.c_str(), copy_size - 1);
|
||||
buf[copy_size - 1] = '\0';
|
||||
gsl::span dst(buf.get_ptr(), copy_size);
|
||||
strcpy_trunc(dst, param_str);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,6 @@
|
||||
|
||||
#include <atomic>
|
||||
|
||||
extern logs::channel sceNp2;
|
||||
|
||||
// Error codes
|
||||
enum SceNpMatching2Error : u32
|
||||
{
|
||||
|
@ -861,7 +861,7 @@ error_code sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::pt
|
||||
const std::string& config_path = vfs::get("/dev_hdd0/home/" + Emu.GetUsr() + "/trophy/" + ctxt->trp_name + "/TROPCONF.SFM");
|
||||
const u32 unlocked_platinum_id = ctxt->tropusr->GetUnlockedPlatinumID(trophyId, config_path);
|
||||
|
||||
if (unlocked_platinum_id != 0u + SCE_NP_TROPHY_INVALID_TROPHY_ID)
|
||||
if (unlocked_platinum_id != SCE_NP_TROPHY_INVALID_TROPHY_ID)
|
||||
{
|
||||
sceNpTrophy.warning("sceNpTrophyUnlockTrophy: All requirements for unlocking the platinum trophy (ID = %d) were met.)", unlocked_platinum_id);
|
||||
|
||||
@ -885,7 +885,7 @@ error_code sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::pt
|
||||
// Enqueue popup for the regular trophy
|
||||
show_trophy_notification(ctxt, trophyId);
|
||||
|
||||
if (unlocked_platinum_id != 0u + SCE_NP_TROPHY_INVALID_TROPHY_ID)
|
||||
if (unlocked_platinum_id != SCE_NP_TROPHY_INVALID_TROPHY_ID)
|
||||
{
|
||||
// Enqueue popup for the holy platinum trophy
|
||||
show_trophy_notification(ctxt, unlocked_platinum_id);
|
||||
|
@ -65,7 +65,11 @@ enum
|
||||
|
||||
SCE_NP_TROPHY_INVALID_CONTEXT = 0,
|
||||
SCE_NP_TROPHY_INVALID_HANDLE = 0,
|
||||
SCE_NP_TROPHY_INVALID_TROPHY_ID = -1,
|
||||
};
|
||||
|
||||
enum : u32
|
||||
{
|
||||
SCE_NP_TROPHY_INVALID_TROPHY_ID = 0xffffffff,
|
||||
};
|
||||
|
||||
enum SceNpTrophyGrade
|
||||
|
@ -71,7 +71,7 @@ s32 sys_mempool_create(ppu_thread& ppu, vm::ptr<sys_mempool_t> mempool, vm::ptr<
|
||||
memory_pool->free_blocks.resize(num_blocks);
|
||||
for (u32 i = 0; i < num_blocks; ++i)
|
||||
{
|
||||
memory_pool->free_blocks[i] = vm::ptr<void>::make(chunk.addr() + i * block_size);
|
||||
memory_pool->free_blocks[i] = vm::ptr<void>::make(chunk.addr() + i * static_cast<u32>(block_size));
|
||||
}
|
||||
|
||||
// Create synchronization variables
|
||||
|
@ -1210,7 +1210,7 @@ bool ppu_interpreter_fast::VMSUMSHS(ppu_thread& ppu, ppu_opcode_t op)
|
||||
{
|
||||
saturated = 0x7fffffff;
|
||||
}
|
||||
else if (result < -0x80000000)
|
||||
else if (result < INT32_MIN)
|
||||
{
|
||||
saturated = 0x80000000;
|
||||
}
|
||||
@ -1246,7 +1246,7 @@ bool ppu_interpreter_precise::VMSUMSHS(ppu_thread& ppu, ppu_opcode_t op)
|
||||
saturated = 0x7fffffff;
|
||||
ppu.sat = true;
|
||||
}
|
||||
else if (result < -0x80000000)
|
||||
else if (result < INT32_MIN)
|
||||
{
|
||||
saturated = 0x80000000;
|
||||
ppu.sat = true;
|
||||
@ -2929,7 +2929,7 @@ bool ppu_interpreter::BC(ppu_thread& ppu, ppu_opcode_t op)
|
||||
if (op.lk) ppu.lr = ppu.cia + 4;
|
||||
|
||||
const bool ctr_ok = bo2 | ((ppu.ctr != 0) ^ bo3);
|
||||
const bool cond_ok = bo0 | (ppu.cr[op.bi] ^ (bo1 ^ true));
|
||||
const bool cond_ok = bo0 | (!!(ppu.cr[op.bi]) ^ (bo1 ^ true));
|
||||
|
||||
if (ctr_ok && cond_ok)
|
||||
{
|
||||
@ -2978,7 +2978,7 @@ bool ppu_interpreter::BCLR(ppu_thread& ppu, ppu_opcode_t op)
|
||||
ppu.ctr -= (bo2 ^ true);
|
||||
|
||||
const bool ctr_ok = bo2 | ((ppu.ctr != 0) ^ bo3);
|
||||
const bool cond_ok = bo0 | (ppu.cr[op.bi] ^ (bo1 ^ true));
|
||||
const bool cond_ok = bo0 | (!!(ppu.cr[op.bi]) ^ (bo1 ^ true));
|
||||
|
||||
const u32 target = static_cast<u32>(ppu.lr) & ~3;
|
||||
if (op.lk) ppu.lr = ppu.cia + 4;
|
||||
@ -4368,7 +4368,7 @@ bool ppu_interpreter::EXTSB(ppu_thread& ppu, ppu_opcode_t op)
|
||||
bool ppu_interpreter::STFIWX(ppu_thread& ppu, ppu_opcode_t op)
|
||||
{
|
||||
const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb];
|
||||
vm::write32(vm::cast(addr, HERE), std::bit_cast<u64>(ppu.fpr[op.frs]));
|
||||
vm::write32(vm::cast(addr, HERE), static_cast<u32>(std::bit_cast<u64>(ppu.fpr[op.frs])));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -4431,7 +4431,7 @@ bool ppu_interpreter::STW(ppu_thread& ppu, ppu_opcode_t op)
|
||||
//Insomniac engine v3 & v4 (newer R&C, Fuse, Resitance 3)
|
||||
if (value == 0xAAAAAAAA) [[unlikely]]
|
||||
{
|
||||
vm::reservation_update(addr, 128);
|
||||
vm::reservation_update(vm::cast(addr, HERE), 128);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -811,7 +811,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
|
||||
_sec.addr = addr - saddr + prx->segs[i].addr;
|
||||
_sec.size = size;
|
||||
_sec.type = s.sh_type;
|
||||
_sec.flags = s.sh_flags & 7;
|
||||
_sec.flags = static_cast<u32>(s.sh_flags & 7);
|
||||
_sec.filesz = 0;
|
||||
prx->secs.emplace_back(_sec);
|
||||
break;
|
||||
@ -1121,7 +1121,7 @@ void ppu_load_exec(const ppu_exec_object& elf)
|
||||
const u32 addr = _sec.addr = vm::cast(s.sh_addr);
|
||||
const u32 size = _sec.size = vm::cast(s.sh_size);
|
||||
const u32 type = _sec.type = s.sh_type;
|
||||
const u32 flag = _sec.flags = s.sh_flags & 7;
|
||||
const u32 flag = _sec.flags = static_cast<u32>(s.sh_flags & 7);
|
||||
_sec.filesz = 0;
|
||||
|
||||
if (s.sh_type == 1u && addr && size)
|
||||
@ -1691,7 +1691,7 @@ std::shared_ptr<lv2_overlay> ppu_load_overlay(const ppu_exec_object& elf, const
|
||||
const u32 addr = _sec.addr = vm::cast(s.sh_addr);
|
||||
const u32 size = _sec.size = vm::cast(s.sh_size);
|
||||
const u32 type = _sec.type = s.sh_type;
|
||||
const u32 flag = _sec.flags = s.sh_flags & 7;
|
||||
const u32 flag = _sec.flags = static_cast<u32>(s.sh_flags & 7);
|
||||
_sec.filesz = 0;
|
||||
|
||||
if (s.sh_type == 1u && addr && size)
|
||||
|
@ -910,7 +910,7 @@ void ppu_thread::stack_pop_verbose(u32 addr, u32 size) noexcept
|
||||
return;
|
||||
}
|
||||
|
||||
context.gpr[1] = vm::_ref<nse_t<u32>>(context.gpr[1] + size);
|
||||
context.gpr[1] = vm::_ref<nse_t<u32>>(static_cast<u32>(context.gpr[1]) + size);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ Type* PPUTranslator::ScaleType(Type* type, s32 pow2)
|
||||
{
|
||||
verify(HERE), (type->getScalarType()->isIntegerTy());
|
||||
|
||||
const auto new_type = m_ir->getIntNTy(type->getScalarSizeInBits() * std::pow(2, pow2));
|
||||
const auto new_type = m_ir->getIntNTy(type->getScalarSizeInBits() * (1 << pow2));
|
||||
return type->isVectorTy() ? VectorType::get(new_type, type->getVectorNumElements()) : cast<Type>(new_type);
|
||||
}
|
||||
|
||||
@ -270,7 +270,7 @@ void PPUTranslator::CallFunction(u64 target, Value* indirect)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ir->CreateStore(Trunc(indirect, GetType<u32>()), m_ir->CreateStructGEP(nullptr, m_thread, &m_cia - m_locals), true);
|
||||
m_ir->CreateStore(Trunc(indirect, GetType<u32>()), m_ir->CreateStructGEP(nullptr, m_thread, static_cast<uint>(&m_cia - m_locals)), true);
|
||||
|
||||
// Try to optimize
|
||||
if (auto inst = dyn_cast_or_null<Instruction>(indirect))
|
||||
@ -357,7 +357,7 @@ void PPUTranslator::FlushRegisters()
|
||||
|
||||
Value* PPUTranslator::Solid(Value* value)
|
||||
{
|
||||
const u32 size = value->getType()->getPrimitiveSizeInBits();
|
||||
const u32 size = ::narrow<u32>(+value->getType()->getPrimitiveSizeInBits(), HERE);
|
||||
|
||||
/* Workarounds (casting bool vectors directly may produce invalid code) */
|
||||
|
||||
@ -531,7 +531,7 @@ llvm::Value* PPUTranslator::GetMemory(llvm::Value* addr, llvm::Type* type)
|
||||
|
||||
Value* PPUTranslator::ReadMemory(Value* addr, Type* type, bool is_be, u32 align)
|
||||
{
|
||||
const auto size = type->getPrimitiveSizeInBits();
|
||||
const u32 size = ::narrow<u32>(+type->getPrimitiveSizeInBits(), HERE);
|
||||
|
||||
if (is_be ^ m_is_be && size > 8)
|
||||
{
|
||||
@ -548,7 +548,7 @@ Value* PPUTranslator::ReadMemory(Value* addr, Type* type, bool is_be, u32 align)
|
||||
void PPUTranslator::WriteMemory(Value* addr, Value* value, bool is_be, u32 align)
|
||||
{
|
||||
const auto type = value->getType();
|
||||
const auto size = type->getPrimitiveSizeInBits();
|
||||
const u32 size = ::narrow<u32>(+type->getPrimitiveSizeInBits(), HERE);
|
||||
|
||||
if (is_be ^ m_is_be && size > 8)
|
||||
{
|
||||
@ -1758,7 +1758,7 @@ void PPUTranslator::BC(ppu_opcode_t op)
|
||||
|
||||
if (op.lk)
|
||||
{
|
||||
m_ir->CreateStore(GetAddr(+4), m_ir->CreateStructGEP(nullptr, m_thread, &m_lr - m_locals));
|
||||
m_ir->CreateStore(GetAddr(+4), m_ir->CreateStructGEP(nullptr, m_thread, static_cast<uint>(&m_lr - m_locals)));
|
||||
}
|
||||
|
||||
UseCondition(CheckBranchProbability(op.bo), CheckBranchCondition(op.bo, op.bi));
|
||||
@ -1828,7 +1828,7 @@ void PPUTranslator::BCLR(ppu_opcode_t op)
|
||||
|
||||
if (op.lk)
|
||||
{
|
||||
m_ir->CreateStore(GetAddr(+4), m_ir->CreateStructGEP(nullptr, m_thread, &m_lr - m_locals));
|
||||
m_ir->CreateStore(GetAddr(+4), m_ir->CreateStructGEP(nullptr, m_thread, static_cast<uint>(&m_lr - m_locals)));
|
||||
}
|
||||
|
||||
UseCondition(CheckBranchProbability(op.bo), CheckBranchCondition(op.bo, op.bi));
|
||||
@ -1891,7 +1891,7 @@ void PPUTranslator::BCCTR(ppu_opcode_t op)
|
||||
|
||||
if (op.lk)
|
||||
{
|
||||
m_ir->CreateStore(GetAddr(+4), m_ir->CreateStructGEP(nullptr, m_thread, &m_lr - m_locals));
|
||||
m_ir->CreateStore(GetAddr(+4), m_ir->CreateStructGEP(nullptr, m_thread, static_cast<uint>(&m_lr - m_locals)));
|
||||
}
|
||||
|
||||
UseCondition(CheckBranchProbability(op.bo | 0x4), CheckBranchCondition(op.bo | 0x4, op.bi));
|
||||
@ -2613,7 +2613,7 @@ void PPUTranslator::MTOCRF(ppu_opcode_t op)
|
||||
|
||||
const auto index = m_ir->CreateAnd(m_ir->CreateLShr(value, 28 - i * 4), 15);
|
||||
const auto src = m_ir->CreateGEP(m_mtocr_table, {m_ir->getInt32(0), m_ir->CreateShl(index, 2)});
|
||||
const auto dst = m_ir->CreateBitCast(m_ir->CreateStructGEP(nullptr, m_thread, m_cr - m_locals + i * 4), GetType<u8*>());
|
||||
const auto dst = m_ir->CreateBitCast(m_ir->CreateStructGEP(nullptr, m_thread, static_cast<uint>(m_cr - m_locals) + i * 4), GetType<u8*>());
|
||||
Call(GetType<void>(), "llvm.memcpy.p0i8.p0i8.i32", dst, src, m_ir->getInt32(4), m_ir->getFalse());
|
||||
}
|
||||
}
|
||||
|
@ -3844,7 +3844,7 @@ void spu_recompiler::CGX(spu_opcode_t op) //nf
|
||||
c->paddd(res, vb);
|
||||
}
|
||||
|
||||
c->movdqa(sign, XmmConst(_mm_set1_epi32(-0x80000000)));
|
||||
c->movdqa(sign, XmmConst(_mm_set1_epi32(INT32_MIN)));
|
||||
c->pxor(va, sign);
|
||||
c->pxor(res, sign);
|
||||
c->pcmpgtd(va, res);
|
||||
@ -3877,7 +3877,7 @@ void spu_recompiler::BGX(spu_opcode_t op) //nf
|
||||
}
|
||||
|
||||
c->pand(vt, temp);
|
||||
c->movdqa(sign, XmmConst(_mm_set1_epi32(-0x80000000)));
|
||||
c->movdqa(sign, XmmConst(_mm_set1_epi32(INT32_MIN)));
|
||||
c->pxor(va, sign);
|
||||
c->pxor(vb, sign);
|
||||
c->pcmpgtd(vb, va);
|
||||
@ -4779,11 +4779,11 @@ void spu_recompiler::SHUFB(spu_opcode_t op)
|
||||
const XmmLink& vt = XmmAlloc();
|
||||
const XmmLink& vm = XmmAlloc();
|
||||
const XmmLink& v5 = XmmAlloc();
|
||||
c->movdqa(vm, XmmConst(_mm_set1_epi8(0xc0)));
|
||||
c->movdqa(vm, XmmConst(_mm_set1_epi8(static_cast<s8>(0xc0))));
|
||||
|
||||
if (utils::has_avx())
|
||||
{
|
||||
c->vpand(v5, vc, XmmConst(_mm_set1_epi8(0xe0)));
|
||||
c->vpand(v5, vc, XmmConst(_mm_set1_epi8(static_cast<s8>(0xe0))));
|
||||
c->vpxor(vc, vc, XmmConst(_mm_set1_epi8(0xf)));
|
||||
c->vpshufb(va, va, vc);
|
||||
c->vpslld(vt, vc, 3);
|
||||
@ -4798,7 +4798,7 @@ void spu_recompiler::SHUFB(spu_opcode_t op)
|
||||
else
|
||||
{
|
||||
c->movdqa(v5, vc);
|
||||
c->pand(v5, XmmConst(_mm_set1_epi8(0xe0)));
|
||||
c->pand(v5, XmmConst(_mm_set1_epi8(static_cast<s8>(0xe0))));
|
||||
c->movdqa(vt, vc);
|
||||
c->pand(vt, vm);
|
||||
c->pxor(vc, XmmConst(_mm_set1_epi8(0xf)));
|
||||
|
@ -1705,8 +1705,8 @@ static bool SHUFB_(spu_thread& spu, spu_opcode_t op)
|
||||
}
|
||||
|
||||
// Select special values
|
||||
const auto xc0 = _mm_set1_epi8(0xc0);
|
||||
const auto xe0 = _mm_set1_epi8(0xe0);
|
||||
const auto xc0 = _mm_set1_epi8(static_cast<s8>(0xc0));
|
||||
const auto xe0 = _mm_set1_epi8(static_cast<s8>(0xe0));
|
||||
const auto cmp0 = _mm_cmpgt_epi8(_mm_setzero_si128(), c.vi);
|
||||
const auto cmp1 = _mm_cmpeq_epi8(_mm_and_si128(c.vi, xc0), xc0);
|
||||
const auto cmp2 = _mm_cmpeq_epi8(_mm_and_si128(c.vi, xe0), xc0);
|
||||
|
@ -425,7 +425,7 @@ void spu_cache::initialize()
|
||||
}
|
||||
|
||||
g_progr = "Building SPU cache...";
|
||||
g_progr_ptotal += func_list.size();
|
||||
g_progr_ptotal += ::size32(func_list);
|
||||
}
|
||||
|
||||
named_thread_group workers("SPU Worker ", Emu.GetMaxThreads(), [&]() -> uint
|
||||
@ -1498,7 +1498,7 @@ spu_program spu_recompiler_base::analyse(const be_t<u32>* ls, u32 entry_point)
|
||||
|
||||
if (jt_abs.size() >= jt_rel.size())
|
||||
{
|
||||
const u32 new_size = (start - lsa) / 4 + jt_abs.size();
|
||||
const u32 new_size = (start - lsa) / 4 + ::size32(jt_abs);
|
||||
|
||||
if (result.data.size() < new_size)
|
||||
{
|
||||
@ -1517,7 +1517,7 @@ spu_program spu_recompiler_base::analyse(const be_t<u32>* ls, u32 entry_point)
|
||||
|
||||
if (jt_rel.size() >= jt_abs.size())
|
||||
{
|
||||
const u32 new_size = (start - lsa) / 4 + jt_rel.size();
|
||||
const u32 new_size = (start - lsa) / 4 + ::size32(jt_rel);
|
||||
|
||||
if (result.data.size() < new_size)
|
||||
{
|
||||
@ -1869,7 +1869,7 @@ spu_program spu_recompiler_base::analyse(const be_t<u32>* ls, u32 entry_point)
|
||||
{
|
||||
m_regmod[pos / 4] = op.rt;
|
||||
|
||||
if (-op.i7 & 0x20)
|
||||
if ((0 - op.i7) & 0x20)
|
||||
{
|
||||
vflags[op.rt] = +vf::is_const;
|
||||
values[op.rt] = 0;
|
||||
@ -1877,7 +1877,7 @@ spu_program spu_recompiler_base::analyse(const be_t<u32>* ls, u32 entry_point)
|
||||
}
|
||||
|
||||
vflags[op.rt] = vflags[op.ra] & vf::is_const;
|
||||
values[op.rt] = values[op.ra] >> (-op.i7 & 0x1f);
|
||||
values[op.rt] = values[op.ra] >> ((0 - op.i7) & 0x1f);
|
||||
break;
|
||||
}
|
||||
case spu_itype::SHLI:
|
||||
@ -1930,7 +1930,7 @@ spu_program spu_recompiler_base::analyse(const be_t<u32>* ls, u32 entry_point)
|
||||
|
||||
while (lsa > 0 || limit < 0x40000)
|
||||
{
|
||||
const u32 initial_size = result.data.size();
|
||||
const u32 initial_size = ::size32(result.data);
|
||||
|
||||
// Check unreachable blocks
|
||||
limit = std::min<u32>(limit, lsa + initial_size * 4);
|
||||
|
@ -12,8 +12,8 @@ LOG_CHANNEL(sys_fs);
|
||||
|
||||
struct lv2_fs_mount_point
|
||||
{
|
||||
const u64 sector_size = 512;
|
||||
const u64 block_size = 4096;
|
||||
const u32 sector_size = 512;
|
||||
const u32 block_size = 4096;
|
||||
const bs_t<lv2_mp_flag> flags{};
|
||||
|
||||
shared_mutex mutex;
|
||||
|
@ -80,6 +80,14 @@ void fmt_class_string<sys_net_error>::format(std::string& out, u64 arg)
|
||||
});
|
||||
}
|
||||
|
||||
template <>
|
||||
void fmt_class_string<struct in_addr>::format(std::string& out, u64 arg)
|
||||
{
|
||||
const uchar* data = reinterpret_cast<const uchar*>(&get_object(arg));
|
||||
|
||||
fmt::append(out, "%u.%u.%u.%u", data[0], data[1], data[2], data[3]);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
// Workaround function for WSAPoll not reporting failed connections
|
||||
void windows_poll(pollfd* fds, unsigned long nfds, int timeout, bool* connecting)
|
||||
@ -244,7 +252,7 @@ struct network_thread
|
||||
{
|
||||
// Wait with 1ms timeout
|
||||
#ifdef _WIN32
|
||||
windows_poll(fds, socklist.size(), 1, connecting);
|
||||
windows_poll(fds, ::size32(socklist), 1, connecting);
|
||||
#else
|
||||
::poll(fds, socklist.size(), 1);
|
||||
#endif
|
||||
@ -515,12 +523,12 @@ error_code sys_net_bnet_bind(ppu_thread& ppu, s32 s, vm::cptr<sys_net_sockaddr>
|
||||
{
|
||||
const u16 daport = reinterpret_cast<const sys_net_sockaddr_in*>(addr.get_ptr())->sin_port;
|
||||
const u16 davport = reinterpret_cast<const sys_net_sockaddr_in_p2p*>(addr.get_ptr())->sin_vport;
|
||||
sys_net.warning("Trying to bind %s:%d:%d", inet_ntoa(name.sin_addr), daport, davport);
|
||||
sys_net.warning("Trying to bind %s:%d:%d", name.sin_addr, daport, davport);
|
||||
name.sin_port = std::bit_cast<u16, be_t<u16>>(daport + davport); // htons(daport + davport)
|
||||
}
|
||||
else
|
||||
{
|
||||
sys_net.warning("Trying to bind %s:%d", inet_ntoa(name.sin_addr), std::bit_cast<be_t<u16>, u16>(name.sin_port)); // ntohs(name.sin_port)
|
||||
sys_net.warning("Trying to bind %s:%d", name.sin_addr, std::bit_cast<be_t<u16>, u16>(name.sin_port)); // ntohs(name.sin_port)
|
||||
}
|
||||
|
||||
std::lock_guard lock(sock.mutex);
|
||||
@ -561,7 +569,7 @@ error_code sys_net_bnet_connect(ppu_thread& ppu, s32 s, vm::ptr<sys_net_sockaddr
|
||||
name.sin_addr.s_addr = std::bit_cast<u32>(psa_in->sin_addr);
|
||||
::socklen_t namelen = sizeof(name);
|
||||
|
||||
sys_net.warning("Attempting to connect on %s:%d", inet_ntoa(name.sin_addr), std::bit_cast<be_t<u16>, u16>(name.sin_port)); // ntohs(name.sin_port)
|
||||
sys_net.warning("Attempting to connect on %s:%d", name.sin_addr, std::bit_cast<be_t<u16>, u16>(name.sin_port)); // ntohs(name.sin_port)
|
||||
|
||||
const auto sock = idm::check<lv2_socket>(s, [&](lv2_socket& sock)
|
||||
{
|
||||
@ -745,9 +753,9 @@ error_code sys_net_bnet_getpeername(ppu_thread& ppu, s32 s, vm::ptr<sys_net_sock
|
||||
vm::ptr<sys_net_sockaddr_in_p2p> paddr_p2p = vm::cast(addr.addr());
|
||||
paddr_p2p->sin_vport = paddr_p2p->sin_port - 3658;
|
||||
paddr_p2p->sin_port = 3658;
|
||||
in_addr rep;
|
||||
struct in_addr rep;
|
||||
rep.s_addr = htonl(paddr->sin_addr);
|
||||
sys_net.error("Reporting P2P socket address as %s:%d:%d", inet_ntoa(rep), paddr_p2p->sin_port, paddr_p2p->sin_vport);
|
||||
sys_net.error("Reporting P2P socket address as %s:%d:%d", rep, paddr_p2p->sin_port, paddr_p2p->sin_vport);
|
||||
}
|
||||
|
||||
return {};
|
||||
@ -1230,14 +1238,14 @@ error_code sys_net_bnet_recvfrom(ppu_thread& ppu, s32 s, vm::ptr<void> buf, u32
|
||||
|
||||
const u16 daport = reinterpret_cast<sys_net_sockaddr_in*>(addr.get_ptr())->sin_port;
|
||||
const u16 davport = reinterpret_cast<sys_net_sockaddr_in_p2p*>(addr.get_ptr())->sin_vport;
|
||||
sys_net.error("Received a P2P packet from %s:%d:%d", inet_ntoa(reinterpret_cast<::sockaddr_in*>(&native_addr)->sin_addr), daport, davport);
|
||||
sys_net.error("Received a P2P packet from %s:%d:%d", reinterpret_cast<::sockaddr_in*>(&native_addr)->sin_addr, daport, davport);
|
||||
}
|
||||
}
|
||||
|
||||
// Length
|
||||
if (type == SYS_NET_SOCK_DGRAM_P2P)
|
||||
sys_net.error("Ok recvfrom: %d", native_result);
|
||||
|
||||
|
||||
return not_an_error(native_result);
|
||||
}
|
||||
|
||||
@ -1309,7 +1317,7 @@ error_code sys_net_bnet_sendto(ppu_thread& ppu, s32 s, vm::cptr<void> buf, u32 l
|
||||
{
|
||||
const u16 daport = reinterpret_cast<const sys_net_sockaddr_in*>(addr.get_ptr())->sin_port;
|
||||
const u16 davport = reinterpret_cast<const sys_net_sockaddr_in_p2p*>(addr.get_ptr())->sin_vport;
|
||||
sys_net.error("Sending a P2P packet to %s:%d:%d", inet_ntoa(name.sin_addr), daport, davport);
|
||||
sys_net.error("Sending a P2P packet to %s:%d:%d", name.sin_addr, daport, davport);
|
||||
name.sin_port = std::bit_cast<u16, be_t<u16>>(daport + davport); // htons(daport + davport)
|
||||
}
|
||||
|
||||
@ -1416,7 +1424,7 @@ error_code sys_net_bnet_sendto(ppu_thread& ppu, s32 s, vm::cptr<void> buf, u32 l
|
||||
// Length
|
||||
if (type == SYS_NET_SOCK_DGRAM_P2P)
|
||||
sys_net.error("Ok sendto: %d", native_result);
|
||||
|
||||
|
||||
return not_an_error(native_result);
|
||||
}
|
||||
|
||||
|
@ -8,11 +8,11 @@
|
||||
|
||||
#include "Emu/Cell/ErrorCodes.h"
|
||||
#include "Crypto/unedat.h"
|
||||
#include "Utilities/StrUtil.h"
|
||||
#include "Utilities/span.h"
|
||||
#include "sys_fs.h"
|
||||
#include "sys_process.h"
|
||||
|
||||
|
||||
|
||||
extern std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object&, const std::string&);
|
||||
extern void ppu_unload_prx(const lv2_prx& prx);
|
||||
extern void ppu_initialize(const ppu_module&);
|
||||
@ -395,7 +395,8 @@ error_code _sys_prx_get_module_info(u32 id, u64 flags, vm::ptr<sys_prx_module_in
|
||||
pOpt->info->all_segments_num = ::size32(prx->segs);
|
||||
if (pOpt->info->filename)
|
||||
{
|
||||
std::strncpy(pOpt->info->filename.get_ptr(), prx->name.c_str(), pOpt->info->filename_size);
|
||||
gsl::span dst(pOpt->info->filename.get_ptr(), pOpt->info->filename_size);
|
||||
strcpy_trunc(dst, prx->name);
|
||||
pOpt->info->filename[pOpt->info->filename_size - 1] = 0;
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ error_code sys_rsx_context_allocate(vm::ptr<u32> context_id, vm::ptr<u64> lpar_d
|
||||
*lpar_driver_info = context_base + 0x100000;
|
||||
*lpar_reports = context_base + 0x200000;
|
||||
|
||||
auto &reports = vm::_ref<RsxReports>(*lpar_reports);
|
||||
auto &reports = vm::_ref<RsxReports>(vm::cast(*lpar_reports, HERE));
|
||||
std::memset(&reports, 0, sizeof(RsxReports));
|
||||
|
||||
for (int i = 0; i < 64; ++i)
|
||||
@ -164,7 +164,7 @@ error_code sys_rsx_context_allocate(vm::ptr<u32> context_id, vm::ptr<u64> lpar_d
|
||||
reports.report[i].pad = -1;
|
||||
}
|
||||
|
||||
auto &driverInfo = vm::_ref<RsxDriverInfo>(*lpar_driver_info);
|
||||
auto &driverInfo = vm::_ref<RsxDriverInfo>(vm::cast(*lpar_driver_info, HERE));
|
||||
|
||||
std::memset(&driverInfo, 0, sizeof(RsxDriverInfo));
|
||||
|
||||
@ -176,12 +176,12 @@ error_code sys_rsx_context_allocate(vm::ptr<u32> context_id, vm::ptr<u64> lpar_d
|
||||
driverInfo.reportsNotifyOffset = 0x1000;
|
||||
driverInfo.reportsOffset = 0;
|
||||
driverInfo.reportsReportOffset = 0x1400;
|
||||
driverInfo.systemModeFlags = system_mode;
|
||||
driverInfo.systemModeFlags = static_cast<u32>(system_mode);
|
||||
driverInfo.hardware_channel = 1; // * i think* this 1 for games, 0 for vsh
|
||||
|
||||
rsx_cfg->driver_info = *lpar_driver_info;
|
||||
rsx_cfg->driver_info = vm::cast(*lpar_driver_info, HERE);
|
||||
|
||||
auto &dmaControl = vm::_ref<RsxDmaControl>(*lpar_dma_control);
|
||||
auto &dmaControl = vm::_ref<RsxDmaControl>(vm::cast(*lpar_dma_control, HERE));
|
||||
dmaControl.get = 0;
|
||||
dmaControl.put = 0;
|
||||
dmaControl.ref = 0; // Set later to -1 by cellGcmSys
|
||||
@ -204,10 +204,10 @@ error_code sys_rsx_context_allocate(vm::ptr<u32> context_id, vm::ptr<u64> lpar_d
|
||||
const auto render = rsx::get_current_renderer();
|
||||
render->display_buffers_count = 0;
|
||||
render->current_display_buffer = 0;
|
||||
render->label_addr = *lpar_reports;
|
||||
render->label_addr = vm::cast(*lpar_reports, HERE);
|
||||
render->device_addr = rsx_cfg->device_addr;
|
||||
render->local_mem_size = rsx_cfg->memory_size;
|
||||
render->init(*lpar_dma_control);
|
||||
render->init(vm::cast(*lpar_dma_control, HERE));
|
||||
|
||||
rsx_cfg->context_base = context_base;
|
||||
*context_id = 0x55555555;
|
||||
@ -350,9 +350,9 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64
|
||||
{
|
||||
case 0x001: // FIFO
|
||||
render->pause();
|
||||
render->ctrl->get = a3;
|
||||
render->ctrl->put = a4;
|
||||
render->restore_point = a3;
|
||||
render->ctrl->get = static_cast<u32>(a3);
|
||||
render->ctrl->put = static_cast<u32>(a4);
|
||||
render->restore_point = static_cast<u32>(a3);
|
||||
render->unpause();
|
||||
break;
|
||||
|
||||
@ -408,7 +408,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64
|
||||
|
||||
case 0x103: // Display Queue
|
||||
{
|
||||
driverInfo.head[a3].lastQueuedBufferId = a4;
|
||||
driverInfo.head[a3].lastQueuedBufferId = static_cast<u32>(a4);
|
||||
driverInfo.head[a3].flipFlags |= 0x40000000 | (1 << a4);
|
||||
|
||||
// NOTE: There currently seem to only be 2 active heads on PS3
|
||||
@ -417,7 +417,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64
|
||||
const u64 shift_offset = (a3 + 5);
|
||||
sys_event_port_send(rsx_cfg->rsx_event_port, 0, (1ull << shift_offset), 0);
|
||||
|
||||
render->on_frame_end(a4);
|
||||
render->on_frame_end(static_cast<u32>(a4));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -465,7 +465,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64
|
||||
}
|
||||
|
||||
u32 flipStatus = driverInfo.head[a3].flipFlags;
|
||||
flipStatus = (flipStatus & a4) | a5;
|
||||
flipStatus = (flipStatus & static_cast<u32>(a4)) | static_cast<u32>(a5);
|
||||
driverInfo.head[a3].flipFlags = flipStatus;
|
||||
}
|
||||
break;
|
||||
@ -485,7 +485,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64
|
||||
// When tile is going to be unbinded, we can use it as a hint that the address will no longer be used as a surface and can be removed/invalidated
|
||||
// Todo: There may be more checks such as format/size/width can could be done
|
||||
if (tile.binded && a5 == 0)
|
||||
render->notify_tile_unbound(a3);
|
||||
render->notify_tile_unbound(static_cast<u32>(a3));
|
||||
|
||||
tile.location = ((a4 >> 32) & 0xF) - 1;
|
||||
tile.offset = ((((a4 >> 32) & 0x7FFFFFFF) >> 16) * 0x10000);
|
||||
@ -569,7 +569,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64
|
||||
// 'custom' invalid package id for now
|
||||
// as i think we need custom lv1 interrupts to handle this accurately
|
||||
// this also should probly be set by rsxthread
|
||||
driverInfo.userCmdParam = a4;
|
||||
driverInfo.userCmdParam = static_cast<u32>(a4);
|
||||
sys_event_port_send(rsx_cfg->rsx_event_port, 0, (1 << 7), 0);
|
||||
break;
|
||||
|
||||
@ -610,7 +610,8 @@ error_code sys_rsx_device_map(vm::ptr<u64> dev_addr, vm::ptr<u64> a2, u32 dev_id
|
||||
return CELL_ENOMEM;
|
||||
}
|
||||
|
||||
rsx_cfg->device_addr = *dev_addr = addr;
|
||||
*dev_addr = addr;
|
||||
rsx_cfg->device_addr = addr;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "stdafx.h"
|
||||
#include "stdafx.h"
|
||||
#include "sys_ss.h"
|
||||
|
||||
#include "sys_process.h"
|
||||
@ -59,7 +59,7 @@ error_code sys_ss_random_number_generator(u64 pkg_id, vm::ptr<void> buf, u64 siz
|
||||
std::unique_ptr<u8[]> temp(new u8[size]);
|
||||
|
||||
#ifdef _WIN32
|
||||
if (auto ret = BCryptGenRandom(nullptr, temp.get(), size, BCRYPT_USE_SYSTEM_PREFERRED_RNG))
|
||||
if (auto ret = BCryptGenRandom(nullptr, temp.get(), static_cast<ULONG>(size), BCRYPT_USE_SYSTEM_PREFERRED_RNG))
|
||||
{
|
||||
fmt::throw_exception("sys_ss_random_number_generator(): BCryptGenRandom failed (0x%08x)" HERE, ret);
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ void gdb_thread::start_server()
|
||||
|
||||
if (getaddrinfo(bind_addr.c_str(), bind_port.c_str(), &hints, &info) == 0)
|
||||
{
|
||||
server_socket = socket(info->ai_family, info->ai_socktype, info->ai_protocol);
|
||||
server_socket = static_cast<int>(socket(info->ai_family, info->ai_socktype, info->ai_protocol));
|
||||
|
||||
if (server_socket == -1)
|
||||
{
|
||||
@ -173,7 +173,7 @@ void gdb_thread::start_server()
|
||||
}
|
||||
|
||||
// Fallback to UNIX socket
|
||||
server_socket = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
server_socket = static_cast<int>(socket(AF_UNIX, SOCK_STREAM, 0));
|
||||
|
||||
if (server_socket == -1)
|
||||
{
|
||||
@ -848,7 +848,7 @@ void gdb_thread::operator()()
|
||||
{
|
||||
sockaddr_in client;
|
||||
socklen_t client_len = sizeof(client);
|
||||
client_socket = accept(server_socket, reinterpret_cast<struct sockaddr*>(&client), &client_len);
|
||||
client_socket = static_cast<int>(accept(server_socket, reinterpret_cast<struct sockaddr*>(&client), &client_len));
|
||||
|
||||
if (client_socket == -1)
|
||||
{
|
||||
|
@ -199,7 +199,7 @@ void usb_device_ghltar::interrupt_transfer(u32 buf_size, u8* buf, u32 endpoint,
|
||||
pad->m_analog_right_x = stick.m_value;
|
||||
break;
|
||||
case CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_X:
|
||||
buf[19] = stick.m_value; // Tilt
|
||||
buf[19] = static_cast<u8>(stick.m_value); // Tilt
|
||||
if (buf[19] >= 0xF0)
|
||||
buf[5] = 0xFF;
|
||||
if (buf[19] <= 0x10)
|
||||
|
@ -20,9 +20,9 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
extern logs::channel sys_net;
|
||||
extern logs::channel sceNp2;
|
||||
extern logs::channel sceNp;
|
||||
LOG_CHANNEL(sys_net);
|
||||
LOG_CHANNEL(sceNp2);
|
||||
LOG_CHANNEL(sceNp);
|
||||
|
||||
np_handler::np_handler()
|
||||
{
|
||||
@ -35,17 +35,16 @@ np_handler::np_handler()
|
||||
// cur_ip = g_cfg.net.ip_address;
|
||||
|
||||
// Attempt to get actual IP address
|
||||
const char* google_dns_server = "8.8.8.8";
|
||||
const int dns_port = 53;
|
||||
|
||||
struct sockaddr_in serv;
|
||||
const int sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
const int sock = static_cast<int>(socket(AF_INET, SOCK_DGRAM, 0));
|
||||
|
||||
ASSERT(sock >= 0);
|
||||
|
||||
memset(&serv, 0, sizeof(serv));
|
||||
serv.sin_family = AF_INET;
|
||||
serv.sin_addr.s_addr = inet_addr(google_dns_server);
|
||||
serv.sin_addr.s_addr = 0x08'08'08'08; // 8.8.8.8 google_dns_server
|
||||
serv.sin_port = std::bit_cast<u16, be_t<u16>>(dns_port); // htons(dns_port)
|
||||
|
||||
int err = connect(sock, reinterpret_cast<const struct sockaddr*>(&serv), sizeof(serv));
|
||||
@ -137,7 +136,7 @@ void np_handler::init_NP(u32 poolsize, vm::ptr<void> poolptr)
|
||||
std::string s_npid = g_cfg.net.psn_npid;
|
||||
ASSERT(s_npid != ""); // It should be generated in settings window if empty
|
||||
|
||||
strncpy(npid.handle.data, s_npid.c_str(), sizeof(npid.handle.data));
|
||||
strcpy_trunc(npid.handle.data, s_npid);
|
||||
}
|
||||
|
||||
switch (g_cfg.net.psn_status)
|
||||
@ -146,8 +145,8 @@ void np_handler::init_NP(u32 poolsize, vm::ptr<void> poolptr)
|
||||
break;
|
||||
case np_psn_status::fake:
|
||||
{
|
||||
strncpy(online_name.data, "RPCS3's user", sizeof(online_name.data));
|
||||
strncpy(avatar_url.data, "https://i.imgur.com/AfWIyQP.jpg", sizeof(avatar_url.data));
|
||||
strcpy_trunc(online_name.data, "RPCS3's user");
|
||||
strcpy_trunc(avatar_url.data, "https://i.imgur.com/AfWIyQP.jpg");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -604,7 +604,7 @@ namespace
|
||||
auto src_stream = static_cast<const __m128i*>(src);
|
||||
auto dst_stream = static_cast<__m128i*>(dst);
|
||||
|
||||
__m128i min = _mm_set1_epi16(0xFFFF);
|
||||
__m128i min = _mm_set1_epi16(-1);
|
||||
__m128i max = _mm_set1_epi16(0);
|
||||
|
||||
const auto iterations = count / 8;
|
||||
@ -671,7 +671,7 @@ namespace
|
||||
{
|
||||
T min_index, max_index;
|
||||
u32 written;
|
||||
u32 remaining = src.size();
|
||||
u32 remaining = ::size32(src, HERE);
|
||||
|
||||
if (s_use_sse4_1 && remaining >= 32)
|
||||
{
|
||||
@ -729,7 +729,7 @@ namespace
|
||||
auto dst_stream = static_cast<__m256i*>(dst);
|
||||
|
||||
__m256i restart = _mm256_set1_epi16(restart_index);
|
||||
__m256i min = _mm256_set1_epi16(0xffff);
|
||||
__m256i min = _mm256_set1_epi16(-1);
|
||||
__m256i max = _mm256_set1_epi16(0);
|
||||
|
||||
for (unsigned n = 0; n < iterations; ++n)
|
||||
@ -772,7 +772,7 @@ namespace
|
||||
auto dst_stream = static_cast<__m128i*>(dst);
|
||||
|
||||
__m128i restart = _mm_set1_epi16(restart_index);
|
||||
__m128i min = _mm_set1_epi16(0xffff);
|
||||
__m128i min = _mm_set1_epi16(-1);
|
||||
__m128i max = _mm_set1_epi16(0);
|
||||
|
||||
for (unsigned n = 0; n < iterations; ++n)
|
||||
@ -845,7 +845,7 @@ namespace
|
||||
T min_index = index_limit<T>();
|
||||
T max_index = 0;
|
||||
u32 written = 0;
|
||||
u32 length = src.size();
|
||||
u32 length = ::size32(src, HERE);
|
||||
|
||||
if (length >= 32 && !skip_restart)
|
||||
{
|
||||
|
@ -424,7 +424,7 @@ size_t fragment_program_storage_hash::operator()(const RSXFragmentProgram& progr
|
||||
hash ^= program.ctrl;
|
||||
hash ^= program.texture_dimensions;
|
||||
hash ^= program.unnormalized_coords;
|
||||
hash ^= program.two_sided_lighting;
|
||||
hash ^= +program.two_sided_lighting;
|
||||
hash ^= program.shadow_textures;
|
||||
hash ^= program.redirected_textures;
|
||||
|
||||
|
@ -31,10 +31,10 @@ namespace rsx
|
||||
t = t * t;
|
||||
break;
|
||||
case animation_type::ease_out_quad:
|
||||
t = t * (2.0 - t);
|
||||
t = t * (2.0f - t);
|
||||
break;
|
||||
case animation_type::ease_in_out_cubic:
|
||||
t = t > 0.5 ? 4.0 * std::pow((t - 1.0), 3.0) + 1.0 : 4.0 * std::pow(t, 3.0);
|
||||
t = t > 0.5f ? 4.0f * std::pow((t - 1.0f), 3.0f) + 1.0f : 4.0f * std::pow(t, 3.0f);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -7,9 +7,8 @@ namespace rsx
|
||||
{
|
||||
namespace overlays
|
||||
{
|
||||
struct message_dialog : public user_interface
|
||||
class message_dialog : public user_interface
|
||||
{
|
||||
private:
|
||||
label text_display;
|
||||
image_button btn_ok;
|
||||
image_button btn_cancel;
|
||||
|
@ -494,7 +494,7 @@ namespace rsx
|
||||
|
||||
void osk_dialog::on_mode(const std::u32string&)
|
||||
{
|
||||
const u32 num_modes = std::clamp<u32>(num_layers.size(), 1, layer_mode::mode_count);
|
||||
const u32 num_modes = std::clamp<u32>(::size32(num_layers), 1, layer_mode::mode_count);
|
||||
m_selected_mode = static_cast<layer_mode>((m_selected_mode + 1u) % num_modes);
|
||||
m_update = true;
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ namespace rsx
|
||||
if (enabled)
|
||||
{
|
||||
m_fps_graph.set_title(" Framerate");
|
||||
m_fps_graph.set_font_size(m_font_size * 0.8);
|
||||
m_fps_graph.set_font_size(static_cast<u16>(m_font_size * 0.8));
|
||||
m_fps_graph.set_count(50);
|
||||
m_fps_graph.set_color(convert_color_code(m_color_body, m_opacity));
|
||||
m_fps_graph.set_guide_interval(10);
|
||||
@ -237,7 +237,7 @@ namespace rsx
|
||||
if (enabled)
|
||||
{
|
||||
m_frametime_graph.set_title(" Frametime");
|
||||
m_frametime_graph.set_font_size(m_font_size * 0.8);
|
||||
m_frametime_graph.set_font_size(static_cast<u16>(m_font_size * 0.8));
|
||||
m_frametime_graph.set_count(170);
|
||||
m_frametime_graph.set_color(convert_color_code(m_color_body, m_opacity));
|
||||
m_frametime_graph.set_guide_interval(8);
|
||||
@ -351,7 +351,7 @@ namespace rsx
|
||||
if (m_frametime_graph_enabled)
|
||||
{
|
||||
const auto elapsed_frame = m_frametime_timer.GetElapsedTimeInMilliSec();
|
||||
m_frametime_graph.record_datapoint(elapsed_frame);
|
||||
m_frametime_graph.record_datapoint(static_cast<float>(elapsed_frame));
|
||||
}
|
||||
|
||||
if (m_force_repaint)
|
||||
@ -400,7 +400,7 @@ namespace rsx
|
||||
{
|
||||
case detail_level::high:
|
||||
{
|
||||
frametime = m_force_update ? 0 : std::max(0.0, elapsed_update / m_frames);
|
||||
frametime = m_force_update ? 0.f : std::max(0.f, static_cast<float>(elapsed_update / m_frames));
|
||||
|
||||
rsx_load = rsx_thread->get_load();
|
||||
|
||||
@ -423,7 +423,7 @@ namespace rsx
|
||||
rsx_cycles += rsx_thread->get_cycles();
|
||||
|
||||
total_cycles = std::max<u64>(1, ppu_cycles + spu_cycles + rsx_cycles);
|
||||
cpu_usage = m_cpu_stats.get_usage();
|
||||
cpu_usage = static_cast<f32>(m_cpu_stats.get_usage());
|
||||
|
||||
ppu_usage = std::clamp(cpu_usage * ppu_cycles / total_cycles, 0.f, 100.f);
|
||||
spu_usage = std::clamp(cpu_usage * spu_cycles / total_cycles, 0.f, 100.f);
|
||||
@ -434,13 +434,13 @@ namespace rsx
|
||||
case detail_level::low:
|
||||
{
|
||||
if (cpu_usage < 0.)
|
||||
cpu_usage = m_cpu_stats.get_usage();
|
||||
cpu_usage = static_cast<f32>(m_cpu_stats.get_usage());
|
||||
|
||||
// fallthrough
|
||||
}
|
||||
case detail_level::minimal:
|
||||
{
|
||||
fps = m_force_update ? 0 : std::max(0.0, static_cast<f32>(m_frames) / (elapsed_update / 1000));
|
||||
fps = m_force_update ? 0.f : std::max(0.f, static_cast<f32>(m_frames / (elapsed_update / 1000)));
|
||||
if (m_is_initialised && m_framerate_graph_enabled)
|
||||
m_fps_graph.record_datapoint(fps);
|
||||
}
|
||||
@ -655,7 +655,7 @@ namespace rsx
|
||||
{
|
||||
const f32 guide_y = y + y_off * normalize_factor;
|
||||
verts_guides.emplace_back(x, guide_y);
|
||||
verts_guides.emplace_back(x + w, guide_y);
|
||||
verts_guides.emplace_back(static_cast<float>(x + w), guide_y);
|
||||
}
|
||||
}
|
||||
|
||||
@ -667,10 +667,10 @@ namespace rsx
|
||||
|
||||
auto& verts_graph = compiled_resources.draw_commands.back().verts;
|
||||
|
||||
const f32 x_stride = f32(w) / m_datapoint_count;
|
||||
const u32 tail_index_offset = m_datapoints.size() - m_datapoint_count;
|
||||
const f32 x_stride = w * 1.f / m_datapoint_count;
|
||||
const u32 tail_index_offset = ::size32(m_datapoints, HERE) - m_datapoint_count;
|
||||
|
||||
for (size_t i = 0; i < m_datapoint_count; ++i)
|
||||
for (u32 i = 0; i < m_datapoint_count; ++i)
|
||||
{
|
||||
const f32 x_line = x + i * x_stride;
|
||||
const f32 y_line = y + h - (m_datapoints[tail_index_offset + i] * normalize_factor);
|
||||
|
@ -1130,7 +1130,7 @@ namespace rsx
|
||||
convert_w != out_w || convert_h != out_h;
|
||||
|
||||
const bool need_convert = out_format != in_format || !rsx::fcmp(fabsf(scale_x), 1.f) || !rsx::fcmp(fabsf(scale_y), 1.f);
|
||||
const u32 slice_h = std::ceil(f32(clip_h + clip_y) / scale_y);
|
||||
const u32 slice_h = static_cast<u32>(std::ceil(static_cast<f32>(clip_h + clip_y) / scale_y));
|
||||
|
||||
if (method_registers.blit_engine_context_surface() != blit_engine::context_surface::swizzle2d)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "stdafx.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "TAR.h"
|
||||
|
||||
@ -30,7 +30,7 @@ int octalToDecimal(int octalNumber)
|
||||
{
|
||||
rem = octalNumber % 10;
|
||||
octalNumber /= 10;
|
||||
decimalNumber += rem * pow(8, i);
|
||||
decimalNumber += rem * (1 << (i * 3));
|
||||
++i;
|
||||
}
|
||||
return decimalNumber;
|
||||
|
@ -148,7 +148,7 @@ void TRPLoader::RenameEntry(const char *oldname, const char *newname)
|
||||
{
|
||||
if (!strcmp(entry.name, oldname))
|
||||
{
|
||||
strcpy_trunc(entry.name, newname);
|
||||
strcpy_trunc(entry.name, std::string_view(newname));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ void memory_string_searcher::OnSearch()
|
||||
{
|
||||
const std::string wstr = m_addr_line->text().toStdString();
|
||||
const char *str = wstr.c_str();
|
||||
const u32 len = wstr.length();
|
||||
const u32 len = ::size32(wstr);
|
||||
|
||||
gui_log.notice("Searching for string %s", str);
|
||||
|
||||
|
@ -269,7 +269,7 @@ static u32 sema_alloc()
|
||||
if (ok)
|
||||
{
|
||||
// Find lowest clear bit
|
||||
const u32 id = group * 64 + utils::cnttz64(~bits, false);
|
||||
const u32 id = group * 64 + static_cast<u32>(utils::cnttz64(~bits, false));
|
||||
|
||||
#ifdef USE_POSIX
|
||||
// Initialize semaphore (should be very fast)
|
||||
|
@ -244,7 +244,7 @@ static constexpr u64 s_ref_one = s_state_mask + 1;
|
||||
|
||||
static u64 rec_alloc()
|
||||
{
|
||||
const u32 start = __rdtsc();
|
||||
const u32 start = static_cast<u32>(__rdtsc());
|
||||
|
||||
for (u32 i = 0;; i++)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user