Merge pull request #16542 from unknownbrackets/warnings

Cleanup some warnings from static analysis
This commit is contained in:
Henrik Rydgård 2022-12-11 09:36:21 +01:00 committed by GitHub
commit 9317fbdd5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
185 changed files with 598 additions and 673 deletions

View File

@ -253,7 +253,7 @@ public:
private:
ARM64Reg m_destReg;
WidthSpecifier m_width;
ExtendSpecifier m_extend;
ExtendSpecifier m_extend = EXTEND_UXTB;
TypeSpecifier m_type;
ShiftType m_shifttype;
u32 m_shift;

View File

@ -112,32 +112,29 @@ private:
OpType Type;
// IMM types
u8 Rotation; // Only for u8 values
u8 Rotation = 0; // Only for u8 values
// Register types
u8 IndexOrShift;
ShiftType Shift;
u8 IndexOrShift = 0;
ShiftType Shift = ST_LSL;
public:
OpType GetType() const
{
OpType GetType() const {
return Type;
}
Operand2() {}
Operand2(u32 imm, OpType type = TYPE_IMM)
{
Type = type;
Value = imm;
Rotation = 0;
Operand2() {
Type = TYPE_IMM;
Value = 0;
}
Operand2(u32 imm, OpType type = TYPE_IMM) {
Type = type;
Value = imm;
}
Operand2(ARMReg Reg)
{
Operand2(ARMReg Reg) {
Type = TYPE_REG;
Value = Reg;
Rotation = 0;
}
Operand2(u8 imm, u8 rotation)
{
Operand2(u8 imm, u8 rotation) {
Type = TYPE_IMM;
Value = imm;
Rotation = rotation;

View File

@ -67,7 +67,9 @@ int Buffer::TakeLineCRLF(std::string *dest) {
if (after_next_line < 0) {
return after_next_line;
} else {
Take(after_next_line - 2, dest);
_dbg_assert_(after_next_line >= 2);
if (after_next_line != 2)
Take((size_t)after_next_line - 2, dest);
Skip(2); // Skip the CRLF
return after_next_line - 2;
}

View File

@ -321,7 +321,10 @@ void CPUInfo::Detect() {
#if PPSSPP_PLATFORM(WINDOWS)
#if !PPSSPP_PLATFORM(UWP)
typedef BOOL (WINAPI *getLogicalProcessorInformationEx_f)(LOGICAL_PROCESSOR_RELATIONSHIP RelationshipType, PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Buffer, PDWORD ReturnedLength);
auto getLogicalProcessorInformationEx = (getLogicalProcessorInformationEx_f)GetProcAddress(GetModuleHandle(L"kernel32.dll"), "GetLogicalProcessorInformationEx");
getLogicalProcessorInformationEx_f getLogicalProcessorInformationEx = nullptr;
HMODULE kernel32 = GetModuleHandle(L"kernel32.dll");
if (kernel32)
getLogicalProcessorInformationEx = (getLogicalProcessorInformationEx_f)GetProcAddress(kernel32, "GetLogicalProcessorInformationEx");
#else
void *getLogicalProcessorInformationEx = nullptr;
#endif

View File

@ -57,7 +57,10 @@ private:
public:
CodeBlock() {}
virtual ~CodeBlock() { if (region) FreeCodeSpace(); }
~CodeBlock() {
if (region)
FreeCodeSpace();
}
// Call this before you generate any code.
void AllocCodeSpace(int size) {

View File

@ -41,7 +41,7 @@ public:
#if defined(USING_WIN_UI)
COORD GetCoordinates(int BytesRead, int BufferWidth);
#endif
void Log(const LogMessage &message);
void Log(const LogMessage &message) override;
void ClearScreen(bool Cursor = true);
void Show(bool bShow);
@ -66,8 +66,8 @@ private:
static std::atomic<uint32_t> logPendingReadPos;
static std::atomic<uint32_t> logPendingWritePos;
int openWidth_;
int openHeight_;
int openWidth_ = 0;
int openHeight_ = 0;
std::wstring title_;
#endif
bool bHidden;

View File

@ -34,88 +34,6 @@
#endif
#endif
// convert 4444 image to 8888, parallelizable
void convert4444_gl(u16* data, u32* out, int width, int l, int u) {
for (int y = l; y < u; ++y) {
for (int x = 0; x < width; ++x) {
u32 val = data[y*width + x];
u32 r = ((val >> 12) & 0xF) * 17;
u32 g = ((val >> 8) & 0xF) * 17;
u32 b = ((val >> 4) & 0xF) * 17;
u32 a = ((val >> 0) & 0xF) * 17;
out[y*width + x] = (a << 24) | (b << 16) | (g << 8) | r;
}
}
}
// convert 565 image to 8888, parallelizable
void convert565_gl(u16* data, u32* out, int width, int l, int u) {
for (int y = l; y < u; ++y) {
for (int x = 0; x < width; ++x) {
u32 val = data[y*width + x];
u32 r = Convert5To8((val >> 11) & 0x1F);
u32 g = Convert6To8((val >> 5) & 0x3F);
u32 b = Convert5To8((val)& 0x1F);
out[y*width + x] = (0xFF << 24) | (b << 16) | (g << 8) | r;
}
}
}
// convert 5551 image to 8888, parallelizable
void convert5551_gl(u16* data, u32* out, int width, int l, int u) {
for (int y = l; y < u; ++y) {
for (int x = 0; x < width; ++x) {
u32 val = data[y*width + x];
u32 r = Convert5To8((val >> 11) & 0x1F);
u32 g = Convert5To8((val >> 6) & 0x1F);
u32 b = Convert5To8((val >> 1) & 0x1F);
u32 a = (val & 0x1) * 255;
out[y*width + x] = (a << 24) | (b << 16) | (g << 8) | r;
}
}
}
// convert 4444 image to 8888, parallelizable
void convert4444_dx9(u16* data, u32* out, int width, int l, int u) {
for (int y = l; y < u; ++y) {
for (int x = 0; x < width; ++x) {
u32 val = data[y*width + x];
u32 r = ((val >> 0) & 0xF) * 17;
u32 g = ((val >> 4) & 0xF) * 17;
u32 b = ((val >> 8) & 0xF) * 17;
u32 a = ((val >> 12) & 0xF) * 17;
out[y*width + x] = (a << 24) | (b << 16) | (g << 8) | r;
}
}
}
// convert 565 image to 8888, parallelizable
void convert565_dx9(u16* data, u32* out, int width, int l, int u) {
for (int y = l; y < u; ++y) {
for (int x = 0; x < width; ++x) {
u32 val = data[y*width + x];
u32 r = Convert5To8((val)& 0x1F);
u32 g = Convert6To8((val >> 5) & 0x3F);
u32 b = Convert5To8((val >> 11) & 0x1F);
out[y*width + x] = (0xFF << 24) | (b << 16) | (g << 8) | r;
}
}
}
// convert 5551 image to 8888, parallelizable
void convert5551_dx9(u16* data, u32* out, int width, int l, int u) {
for (int y = l; y < u; ++y) {
for (int x = 0; x < width; ++x) {
u32 val = data[y*width + x];
u32 r = Convert5To8((val >> 0) & 0x1F);
u32 g = Convert5To8((val >> 5) & 0x1F);
u32 b = Convert5To8((val >> 10) & 0x1F);
u32 a = ((val >> 15) & 0x1) * 255;
out[y*width + x] = (a << 24) | (b << 16) | (g << 8) | r;
}
}
}
void ConvertBGRA8888ToRGBA8888(u32 *dst, const u32 *src, u32 numPixels) {
#ifdef _M_SSE
const __m128i maskGA = _mm_set1_epi32(0xFF00FF00);

View File

@ -126,15 +126,6 @@ inline u16 RGBA8888ToRGBA444X(u32 value) {
return r | g | b;
}
// convert image to 8888, parallelizable
// TODO: Implement these in terms of the conversion functions below.
void convert4444_gl(u16* data, u32* out, int width, int l, int u);
void convert565_gl(u16* data, u32* out, int width, int l, int u);
void convert5551_gl(u16* data, u32* out, int width, int l, int u);
void convert4444_dx9(u16* data, u32* out, int width, int l, int u);
void convert565_dx9(u16* data, u32* out, int width, int l, int u);
void convert5551_dx9(u16* data, u32* out, int width, int l, int u);
// "Complete" set of color conversion functions between the usual formats.
// TODO: Need to revisit the naming convention of these. Seems totally backwards

View File

@ -112,7 +112,7 @@ int u8_toucs(uint32_t *dest, int sz, const char *src, int srcsz)
the NUL as well.
the destination string will never be bigger than the source string.
*/
int u8_toutf8(char *dest, int sz, uint32_t *src, int srcsz)
int u8_toutf8(char *dest, int sz, const uint32_t *src, int srcsz)
{
uint32_t ch;
int i = 0;

View File

@ -47,9 +47,11 @@ public:
JsonReader(const std::string &filename);
JsonReader(const void *data, size_t size) {
buffer_ = (char *)malloc(size + 1);
memcpy(buffer_, data, size);
buffer_[size] = 0;
parse();
if (buffer_) {
memcpy(buffer_, data, size);
buffer_[size] = 0;
parse();
}
}
JsonReader(const JsonNode *node) {
ok_ = true;

View File

@ -7,6 +7,7 @@ public:
WordWrapper(const char *str, float maxW, int flags)
: str_(str), maxW_(maxW), flags_(flags) {
}
virtual ~WordWrapper() {}
std::string Wrapped();

View File

@ -141,7 +141,7 @@ FILE *OpenCFile(const Path &path, const char *mode) {
return nullptr;
}
FILE *f = fdopen(descriptor, "wb");
if (!strcmp(mode, "at") || !strcmp(mode, "a")) {
if (f && (!strcmp(mode, "at") || !strcmp(mode, "a"))) {
// Append mode.
fseek(f, 0, SEEK_END);
}
@ -250,7 +250,8 @@ static bool ResolvePathVista(const std::wstring &path, wchar_t *buf, DWORD bufSi
#else
if (!getFinalPathNameByHandleW) {
HMODULE kernel32 = GetModuleHandle(L"kernel32.dll");
getFinalPathNameByHandleW = (getFinalPathNameByHandleW_f)GetProcAddress(kernel32, "GetFinalPathNameByHandleW");
if (kernel32)
getFinalPathNameByHandleW = (getFinalPathNameByHandleW_f)GetProcAddress(kernel32, "GetFinalPathNameByHandleW");
}
#endif

View File

@ -47,10 +47,10 @@ class DirectoryAssetReader : public AssetReader {
public:
explicit DirectoryAssetReader(const Path &path);
// use delete[]
virtual uint8_t *ReadAsset(const char *path, size_t *size);
virtual bool GetFileListing(const char *path, std::vector<File::FileInfo> *listing, const char *filter);
virtual bool GetFileInfo(const char *path, File::FileInfo *info);
virtual std::string toString() const {
uint8_t *ReadAsset(const char *path, size_t *size) override;
bool GetFileListing(const char *path, std::vector<File::FileInfo> *listing, const char *filter) override;
bool GetFileInfo(const char *path, File::FileInfo *info) override;
std::string toString() const override {
return path_.ToString();
}

View File

@ -170,7 +170,7 @@ public:
private:
void ApplyCurrentState();
ID3D11DepthStencilState *GetCachedDepthStencilState(D3D11DepthStencilState *state, uint8_t stencilWriteMask, uint8_t stencilCompareMask);
ID3D11DepthStencilState *GetCachedDepthStencilState(const D3D11DepthStencilState *state, uint8_t stencilWriteMask, uint8_t stencilCompareMask);
HWND hWnd_;
ID3D11Device *device_;
@ -550,7 +550,7 @@ public:
float blendFactor[4];
};
ID3D11DepthStencilState *D3D11DrawContext::GetCachedDepthStencilState(D3D11DepthStencilState *state, uint8_t stencilWriteMask, uint8_t stencilCompareMask) {
ID3D11DepthStencilState *D3D11DrawContext::GetCachedDepthStencilState(const D3D11DepthStencilState *state, uint8_t stencilWriteMask, uint8_t stencilCompareMask) {
D3D11DepthStencilKey key;
key.desc = state->desc;
key.writeMask = stencilWriteMask;
@ -1476,6 +1476,7 @@ void D3D11DrawContext::CopyFramebufferImage(Framebuffer *srcfb, int level, int x
dstTex = dst->depthStencilTex;
break;
}
_assert_(srcTex && dstTex);
// TODO: Check for level too!
if (width == src->Width() && width == dst->Width() && height == src->Height() && height == dst->Height() && x == 0 && y == 0 && z == 0 && dstX == 0 && dstY == 0 && dstZ == 0) {
@ -1534,7 +1535,7 @@ bool D3D11DrawContext::CopyFramebufferToMemorySync(Framebuffer *src, int channel
bool useGlobalPacktex = (bx + bw <= 512 && by + bh <= 512) && channelBits == FB_COLOR_BIT;
ID3D11Texture2D *packTex;
ID3D11Texture2D *packTex = nullptr;
if (!useGlobalPacktex) {
D3D11_TEXTURE2D_DESC packDesc{};
packDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
@ -1573,6 +1574,9 @@ bool D3D11DrawContext::CopyFramebufferToMemorySync(Framebuffer *src, int channel
packTex = packTexture_;
}
if (!packTex)
return false;
D3D11_BOX srcBox{ (UINT)bx, (UINT)by, 0, (UINT)(bx + bw), (UINT)(by + bh), 1 };
DataFormat srcFormat = DataFormat::UNDEFINED;
switch (channelBits) {

View File

@ -291,7 +291,7 @@ public:
D3D9Texture(LPDIRECT3DDEVICE9 device, LPDIRECT3DDEVICE9EX deviceEx, const TextureDesc &desc);
~D3D9Texture();
void SetToSampler(LPDIRECT3DDEVICE9 device, int sampler);
LPDIRECT3DBASETEXTURE9 Texture() const {
LPDIRECT3DBASETEXTURE9 TexturePtr() const {
// TODO: Cleanup
if (tex_) {
return tex_;
@ -590,7 +590,7 @@ public:
case NativeObject::DEVICE_EX:
return (uint64_t)(uintptr_t)deviceEx_;
case NativeObject::TEXTURE_VIEW:
return (uint64_t)(((D3D9Texture *)srcObject)->Texture());
return (uint64_t)(((D3D9Texture *)srcObject)->TexturePtr());
default:
return 0;
}
@ -1007,7 +1007,7 @@ public:
device->CreateVertexBuffer((UINT)size, usage, 0, D3DPOOL_DEFAULT, &vbuffer_, NULL);
}
}
virtual ~D3D9Buffer() override {
~D3D9Buffer() {
if (ibuffer_) {
ibuffer_->Release();
}
@ -1072,16 +1072,16 @@ void D3D9Context::UpdateBuffer(Buffer *buffer, const uint8_t *data, size_t offse
return;
}
if (buf->vbuffer_) {
void *ptr;
void *ptr = nullptr;
HRESULT res = buf->vbuffer_->Lock((UINT)offset, (UINT)size, &ptr, (flags & UPDATE_DISCARD) ? D3DLOCK_DISCARD : 0);
if (!FAILED(res)) {
if (!FAILED(res) && ptr) {
memcpy(ptr, data, size);
buf->vbuffer_->Unlock();
}
} else if (buf->ibuffer_) {
void *ptr;
void *ptr = nullptr;
HRESULT res = buf->ibuffer_->Lock((UINT)offset, (UINT)size, &ptr, (flags & UPDATE_DISCARD) ? D3DLOCK_DISCARD : 0);
if (!FAILED(res)) {
if (!FAILED(res) && ptr) {
memcpy(ptr, data, size);
buf->ibuffer_->Unlock();
}
@ -1438,6 +1438,7 @@ bool D3D9Context::CopyFramebufferToMemorySync(Framebuffer *src, int channelBits,
LPDIRECT3DSURFACE9 offscreen = nullptr;
HRESULT hr = E_UNEXPECTED;
_assert_(fb != nullptr);
if (channelBits == FB_COLOR_BIT) {
fb->tex->GetLevelDesc(0, &desc);

View File

@ -481,7 +481,7 @@ public:
return step.create_program.program;
}
GLRInputLayout *CreateInputLayout(std::vector<GLRInputLayout::Entry> &entries) {
GLRInputLayout *CreateInputLayout(const std::vector<GLRInputLayout::Entry> &entries) {
GLRInitStep step{ GLRInitStepType::CREATE_INPUT_LAYOUT };
step.create_input_layout.inputLayout = new GLRInputLayout();
step.create_input_layout.inputLayout->entries = entries;

View File

@ -324,7 +324,7 @@ class OpenGLTexture;
class OpenGLContext : public DrawContext {
public:
OpenGLContext();
virtual ~OpenGLContext();
~OpenGLContext();
void SetTargetSize(int w, int h) override {
DrawContext::SetTargetSize(w, h);
@ -517,7 +517,7 @@ static constexpr int MakeIntelSimpleVer(int v1, int v2, int v3) {
return (v1 << 16) | (v2 << 8) | v3;
}
static bool HasIntelDualSrcBug(int versions[4]) {
static bool HasIntelDualSrcBug(const int versions[4]) {
// Intel uses a confusing set of at least 3 version numbering schemes. This is the one given to OpenGL.
switch (MakeIntelSimpleVer(versions[0], versions[1], versions[2])) {
case MakeIntelSimpleVer(9, 17, 10):
@ -1084,7 +1084,7 @@ public:
buffer_ = render->CreateBuffer(target_, size, usage_);
totalSize_ = size;
}
~OpenGLBuffer() override {
~OpenGLBuffer() {
render_->DeleteBuffer(buffer_);
}

View File

@ -11,7 +11,7 @@ using namespace PPSSPP_VK;
// Debug help: adb logcat -s DEBUG PPSSPPNativeActivity PPSSPP NativeGLView NativeRenderer NativeSurfaceView PowerSaveModeReceiver InputDeviceState
static void MergeRenderAreaRectInto(VkRect2D *dest, VkRect2D &src) {
static void MergeRenderAreaRectInto(VkRect2D *dest, const VkRect2D &src) {
if (dest->offset.x > src.offset.x) {
dest->extent.width += (dest->offset.x - src.offset.x);
dest->offset.x = src.offset.x;
@ -1324,7 +1324,7 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c
{
VKRGraphicsPipeline *graphicsPipeline = c.graphics_pipeline.pipeline;
if (graphicsPipeline != lastGraphicsPipeline) {
VkSampleCountFlagBits fbSampleCount = step.render.framebuffer ? step.render.framebuffer->sampleCount : VK_SAMPLE_COUNT_1_BIT;
VkSampleCountFlagBits fbSampleCount = fb ? fb->sampleCount : VK_SAMPLE_COUNT_1_BIT;
if (RenderPassTypeHasMultisample(rpType) && fbSampleCount != graphicsPipeline->SampleCount()) {
// should have been invalidated.
@ -1421,12 +1421,13 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c
case VKRRenderCommand::SELF_DEPENDENCY_BARRIER:
{
_assert_(step.render.pipelineFlags & PipelineFlags::USES_INPUT_ATTACHMENT);
_assert_(fb);
VulkanBarrier barrier;
if (step.render.framebuffer->sampleCount != VK_SAMPLE_COUNT_1_BIT) {
if (fb->sampleCount != VK_SAMPLE_COUNT_1_BIT) {
// Rendering is happening to the multisample buffer, not the color buffer.
SelfDependencyBarrier(step.render.framebuffer->msaaColor, VK_IMAGE_ASPECT_COLOR_BIT, &barrier);
SelfDependencyBarrier(fb->msaaColor, VK_IMAGE_ASPECT_COLOR_BIT, &barrier);
} else {
SelfDependencyBarrier(step.render.framebuffer->color, VK_IMAGE_ASPECT_COLOR_BIT, &barrier);
SelfDependencyBarrier(fb->color, VK_IMAGE_ASPECT_COLOR_BIT, &barrier);
}
barrier.Flush(cmd);
break;

View File

@ -382,7 +382,7 @@ class VKFramebuffer;
class VKContext : public DrawContext {
public:
VKContext(VulkanContext *vulkan);
virtual ~VKContext();
~VKContext();
void DebugAnnotate(const char *annotation) override;
@ -1184,16 +1184,12 @@ Pipeline *VKContext::CreateGraphicsPipeline(const PipelineDesc &desc, const char
}
}
if (input) {
for (int i = 0; i < (int)input->bindings.size(); i++) {
pipeline->stride[i] = input->bindings[i].stride;
}
} else {
pipeline->stride[0] = 0;
}
_dbg_assert_(input->bindings.size() == 1);
_dbg_assert_(input && input->bindings.size() == 1);
_dbg_assert_((int)input->attributes.size() == (int)input->visc.vertexAttributeDescriptionCount);
for (int i = 0; i < (int)input->bindings.size(); i++) {
pipeline->stride[i] = input->bindings[i].stride;
}
gDesc.ibd = input->bindings[0];
for (size_t i = 0; i < input->attributes.size(); i++) {
gDesc.attrs[i] = input->attributes[i];
@ -1362,7 +1358,7 @@ public:
VKBuffer(size_t size, uint32_t flags) : dataSize_(size) {
data_ = new uint8_t[size];
}
~VKBuffer() override {
~VKBuffer() {
delete[] data_;
}

View File

@ -483,10 +483,7 @@ public:
virtual ShaderStage GetStage() const = 0;
};
class Pipeline : public RefCountedObject {
public:
virtual ~Pipeline() {}
};
class Pipeline : public RefCountedObject { };
class RasterState : public RefCountedObject {};

View File

@ -200,7 +200,7 @@ void LogManager::SaveConfig(Section *section) {
}
}
void LogManager::LoadConfig(Section *section, bool debugDefaults) {
void LogManager::LoadConfig(const Section *section, bool debugDefaults) {
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++) {
bool enabled = false;
int level = 0;

View File

@ -55,7 +55,7 @@ public:
FileLogListener(const char *filename);
~FileLogListener();
void Log(const LogMessage &msg);
void Log(const LogMessage &msg) override;
bool IsValid() { if (!fp_) return false; else return true; }
bool IsEnabled() const { return m_enable; }
@ -71,13 +71,12 @@ private:
class OutputDebugStringLogListener : public LogListener {
public:
void Log(const LogMessage &msg);
void Log(const LogMessage &msg) override;
};
class RingbufferLogListener : public LogListener {
public:
RingbufferLogListener() : curMessage_(0), count_(0), enabled_(false) {}
void Log(const LogMessage &msg);
void Log(const LogMessage &msg) override;
bool IsEnabled() const { return enabled_; }
void SetEnabled(bool enable) { enabled_ = enable; }
@ -89,9 +88,9 @@ public:
private:
enum { MAX_LOGS = 128 };
LogMessage messages_[MAX_LOGS];
int curMessage_;
int count_;
bool enabled_;
int curMessage_ = 0;
int count_ = 0;
bool enabled_ = false;
};
// TODO: A simple buffered log that can be used to display the log in-window
@ -184,5 +183,5 @@ public:
void ChangeFileLog(const char *filename);
void SaveConfig(Section *section);
void LoadConfig(Section *section, bool debugDefaults);
void LoadConfig(const Section *section, bool debugDefaults);
};

View File

@ -406,8 +406,8 @@ bool parsePostfixExpression(PostfixExpression& exp, IExpressionFunctions* funcs,
size_t num = 0;
uint32_t opcode;
std::vector<uint32_t> valueStack;
unsigned int arg[5];
float fArg[5];
unsigned int arg[5]{};
float fArg[5]{};
bool useFloat = false;
while (num < exp.size())

View File

@ -15,6 +15,7 @@ enum ExpressionType
class IExpressionFunctions
{
public:
virtual ~IExpressionFunctions() {}
virtual bool parseReference(char* str, uint32_t& referenceIndex) = 0;
virtual bool parseSymbol(char* str, uint32_t& symbolValue) = 0;
virtual uint32_t getReferenceValue(uint32_t referenceIndex) = 0;

View File

@ -224,7 +224,7 @@ void DeChunk(Buffer *inbuffer, Buffer *outbuffer, int contentLength, float *prog
inbuffer->TakeLineCRLF(&line);
if (!line.size())
return;
unsigned int chunkSize;
unsigned int chunkSize = 0;
sscanf(line.c_str(), "%x", &chunkSize);
if (chunkSize) {
std::string data;

View File

@ -15,6 +15,8 @@
struct UrlEncoder
{
virtual ~UrlEncoder() {}
UrlEncoder() : paramCount(0)
{
data.reserve(256);
@ -129,8 +131,7 @@ struct MultipartFormDataEncoder : UrlEncoder
boundary = temp;
}
virtual void Add(const std::string &key, const std::string &value)
{
void Add(const std::string &key, const std::string &value) override {
Add(key, value, "", "");
}
@ -158,13 +159,11 @@ struct MultipartFormDataEncoder : UrlEncoder
Add(key, std::string((const char *)&value[0], value.size()), filename, mimeType);
}
virtual void Finish()
{
void Finish() override {
data += "--" + boundary + "--";
}
virtual std::string GetMimeType() const
{
std::string GetMimeType() const override {
return "multipart/form-data; boundary=\"" + boundary + "\"";
}

View File

@ -130,7 +130,7 @@ void DrawBuffer::RectOutline(float x, float y, float w, float h, uint32_t color,
vLine(x + w, y, y + h + pixel_in_dps_y, color);
}
void DrawBuffer::MultiVGradient(float x, float y, float w, float h, GradientStop *stops, int numStops) {
void DrawBuffer::MultiVGradient(float x, float y, float w, float h, const GradientStop *stops, int numStops) {
for (int i = 0; i < numStops - 1; i++) {
float t0 = stops[i].t, t1 = stops[i+1].t;
uint32_t c0 = stops[i].color, c1 = stops[i+1].color;

View File

@ -88,7 +88,7 @@ public:
RectVGradient(x, y, w, h, colorTop, darkenColor(colorTop));
}
void MultiVGradient(float x, float y, float w, float h, GradientStop *stops, int numStops);
void MultiVGradient(float x, float y, float w, float h, const GradientStop *stops, int numStops);
void RectCenter(float x, float y, float w, float h, uint32_t color) {
Rect(x - w/2, y - h/2, w, h, color);

View File

@ -69,6 +69,7 @@ TextDrawerWin32::TextDrawerWin32(Draw::DrawContext *draw) : TextDrawer(draw), ct
bmi.bmiHeader.biBitCount = 32;
ctx_->hbmBitmap = CreateDIBSection(ctx_->hDC, &bmi, DIB_RGB_COLORS, (VOID**)&ctx_->pBitmapBits, NULL, 0);
_assert_(ctx_->hbmBitmap != nullptr);
SetMapMode(ctx_->hDC, MM_TEXT);
SelectObject(ctx_->hDC, ctx_->hbmBitmap);

View File

@ -615,7 +615,7 @@ const u8 *RiscVEmitter::AlignCode16() {
const u8 *RiscVEmitter::AlignCodePage() {
int page_size = GetMemoryProtectPageSize();
int c = int((u64)code_ & (page_size - 1));
int c = int((intptr_t)code_ & ((intptr_t)page_size - 1));
if (c)
ReserveCodeSpace(page_size - c);
return code_;
@ -747,7 +747,7 @@ void RiscVEmitter::SetRegToImmediate(RiscVReg rd, uint64_t value, RiscVReg temp)
if (SignReduce64(v, 32) == v || force) {
int32_t lower = (int32_t)SignReduce64(svalue, 12);
int32_t upper = ((v - lower) >> 12) << 12;
_assert_msg_(force || upper + lower == v, "Upper + ADDI immediate math mistake?");
_assert_msg_(force || (int64_t)upper + lower == v, "Upper + ADDI immediate math mistake?");
// Should be fused on some processors.
(this->*upperOp)(rd, upper);

View File

@ -113,7 +113,7 @@ struct FixupBranch {
~FixupBranch();
const u8 *ptr = nullptr;
FixupBranchType type;
FixupBranchType type = FixupBranchType::B;
};
class RiscVEmitter {

View File

@ -43,6 +43,7 @@ extern DrawBuffer ui_draw2d_front; // for things that need to be on top of the r
// Implement this interface to style your lists
class UIListAdapter {
public:
virtual ~UIListAdapter() {}
virtual size_t getCount() const = 0;
virtual void drawItem(int item, int x, int y, int w, int h, bool active) const = 0;
virtual float itemHeight(int itemIndex) const { return 64; }
@ -52,8 +53,8 @@ public:
class StringVectorListAdapter : public UIListAdapter {
public:
StringVectorListAdapter(const std::vector<std::string> *items) : items_(items) {}
virtual size_t getCount() const { return items_->size(); }
virtual void drawItem(int item, int x, int y, int w, int h, bool active) const;
size_t getCount() const override { return items_->size(); }
void drawItem(int item, int x, int y, int w, int h, bool active) const override;
private:
const std::vector<std::string> *items_;

View File

@ -74,12 +74,12 @@ public:
PopupScreen(std::string title, std::string button1 = "", std::string button2 = "");
virtual void CreatePopupContents(UI::ViewGroup *parent) = 0;
virtual void CreateViews() override;
virtual bool isTransparent() const override { return true; }
virtual bool touch(const TouchInput &touch) override;
virtual bool key(const KeyInput &key) override;
void CreateViews() override;
bool isTransparent() const override { return true; }
bool touch(const TouchInput &touch) override;
bool key(const KeyInput &key) override;
virtual void TriggerFinish(DialogResult result) override;
void TriggerFinish(DialogResult result) override;
void SetPopupOrigin(const UI::View *view);
void SetPopupOffset(float y);
@ -95,7 +95,7 @@ protected:
virtual bool HasTitleBar() const { return true; }
const std::string &Title() { return title_; }
virtual void update() override;
void update() override;
private:
UI::ViewGroup *box_;
@ -143,9 +143,9 @@ public:
UI::Event OnChoice;
protected:
virtual bool FillVertical() const override { return false; }
virtual bool ShowButtons() const override { return showButtons_; }
virtual void CreatePopupContents(UI::ViewGroup *parent) override;
bool FillVertical() const override { return false; }
bool ShowButtons() const override { return showButtons_; }
void CreatePopupContents(UI::ViewGroup *parent) override;
UI::StringVectorListAdaptor adaptor_;
UI::ListView *listView_ = nullptr;
@ -164,9 +164,9 @@ public:
UI::Event OnChoice;
protected:
virtual bool FillVertical() const override { return false; }
virtual bool ShowButtons() const override { return true; }
virtual void CreatePopupContents(UI::ViewGroup *parent) override;
bool FillVertical() const override { return false; }
bool ShowButtons() const override { return true; }
void CreatePopupContents(UI::ViewGroup *parent) override;
private:
void OnCompleted(DialogResult result) override;
@ -182,7 +182,7 @@ class SliderPopupScreen : public PopupScreen {
public:
SliderPopupScreen(int *value, int minValue, int maxValue, const std::string &title, int step = 1, const std::string &units = "")
: PopupScreen(title, "OK", "Cancel"), units_(units), value_(value), minValue_(minValue), maxValue_(maxValue), step_(step) {}
virtual void CreatePopupContents(ViewGroup *parent) override;
void CreatePopupContents(ViewGroup *parent) override;
void SetNegativeDisable(const std::string &str) {
negativeLabel_ = str;
@ -198,7 +198,7 @@ private:
EventReturn OnIncrease(EventParams &params);
EventReturn OnTextChange(EventParams &params);
EventReturn OnSliderChange(EventParams &params);
virtual void OnCompleted(DialogResult result) override;
void OnCompleted(DialogResult result) override;
Slider *slider_ = nullptr;
UI::TextEdit *edit_ = nullptr;
std::string units_;
@ -227,7 +227,7 @@ private:
EventReturn OnDecrease(EventParams &params);
EventReturn OnTextChange(EventParams &params);
EventReturn OnSliderChange(EventParams &params);
virtual void OnCompleted(DialogResult result) override;
void OnCompleted(DialogResult result) override;
UI::SliderFloat *slider_;
UI::TextEdit *edit_;
std::string units_;
@ -245,7 +245,7 @@ class TextEditPopupScreen : public PopupScreen {
public:
TextEditPopupScreen(std::string *value, const std::string &placeholder, const std::string &title, int maxLen)
: PopupScreen(title, "OK", "Cancel"), value_(value), placeholder_(placeholder), maxLen_(maxLen) {}
virtual void CreatePopupContents(ViewGroup *parent) override;
void CreatePopupContents(ViewGroup *parent) override;
const char *tag() const override { return "TextEditPopup"; }
@ -378,7 +378,7 @@ public:
}
protected:
void PostChoiceCallback(int num) {
void PostChoiceCallback(int num) override {
*valueStr_ = choices_[num];
}

View File

@ -169,7 +169,7 @@ void View::PersistData(PersistStatus status, std::string anonId, PersistMap &sto
}
}
Point View::GetFocusPosition(FocusDirection dir) {
Point View::GetFocusPosition(FocusDirection dir) const {
// The +2/-2 is some extra fudge factor to cover for views sitting right next to each other.
// Distance zero yields strange results otherwise.
switch (dir) {

View File

@ -468,7 +468,7 @@ public:
virtual bool IsViewGroup() const { return false; }
virtual bool ContainsSubview(const View *view) const { return false; }
Point GetFocusPosition(FocusDirection dir);
Point GetFocusPosition(FocusDirection dir) const;
template <class T>
T *AddTween(T *t) {

View File

@ -294,7 +294,7 @@ static float VerticalOverlap(const Bounds &a, const Bounds &b) {
return std::min(1.0f, overlap / minH);
}
float GetTargetScore(const Point &originPos, int originIndex, View *origin, View *destination, FocusDirection direction) {
float GetTargetScore(const Point &originPos, int originIndex, const View *origin, const View *destination, FocusDirection direction) {
// Skip labels and things like that.
if (!destination->CanBeFocused())
return 0.0f;
@ -394,7 +394,7 @@ float GetTargetScore(const Point &originPos, int originIndex, View *origin, View
}
}
float GetDirectionScore(int originIndex, View *origin, View *destination, FocusDirection direction) {
static float GetDirectionScore(int originIndex, const View *origin, View *destination, FocusDirection direction) {
Point originPos = origin->GetFocusPosition(direction);
return GetTargetScore(originPos, originIndex, origin, destination, direction);
}
@ -963,7 +963,7 @@ bool ScrollView::SubviewFocused(View *view) {
float visibleSize = orientation_ == ORIENT_VERTICAL ? bounds_.h : bounds_.w;
float visibleEnd = scrollPos_ + visibleSize;
float viewStart, viewEnd;
float viewStart = 0.0f, viewEnd = 0.0f;
switch (orientation_) {
case ORIENT_HORIZONTAL:
viewStart = layoutScrollPos_ + vBounds.x - bounds_.x;

View File

@ -24,27 +24,23 @@ struct NeighborResult {
class ViewGroup : public View {
public:
ViewGroup(LayoutParams *layoutParams = 0) : View(layoutParams) {}
virtual ~ViewGroup();
~ViewGroup();
// Pass through external events to children.
virtual bool Key(const KeyInput &input) override;
virtual bool Touch(const TouchInput &input) override;
virtual void Axis(const AxisInput &input) override;
bool Key(const KeyInput &input) override;
bool Touch(const TouchInput &input) override;
void Axis(const AxisInput &input) override;
// By default, a container will layout to its own bounds.
virtual void Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert) override = 0;
virtual void Layout() override = 0;
virtual void Update() override;
virtual void Query(float x, float y, std::vector<View *> &list) override;
void Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert) override = 0;
void Layout() override = 0;
void Update() override;
void Query(float x, float y, std::vector<View *> &list) override;
virtual void DeviceLost() override;
virtual void DeviceRestored(Draw::DrawContext *draw) override;
void DeviceLost() override;
void DeviceRestored(Draw::DrawContext *draw) override;
virtual void Draw(UIContext &dc) override;
// These should be unused.
virtual float GetContentWidth() const { return 0.0f; }
virtual float GetContentHeight() const { return 0.0f; }
void Draw(UIContext &dc) override;
// Takes ownership! DO NOT add a view to multiple parents!
template <class T>
@ -54,8 +50,8 @@ public:
return view;
}
virtual bool SetFocus() override;
virtual bool SubviewFocused(View *view) override;
bool SetFocus() override;
bool SubviewFocused(View *view) override;
virtual void RemoveSubview(View *view);
void SetDefaultFocusView(View *view) { defaultFocusView_ = view; }
@ -406,9 +402,9 @@ public:
class ChoiceListAdaptor : public ListAdaptor {
public:
ChoiceListAdaptor(const char *items[], int numItems) : items_(items), numItems_(numItems) {}
virtual View *CreateItemView(int index);
virtual int GetNumItems() { return numItems_; }
virtual bool AddEventCallback(View *view, std::function<EventReturn(EventParams&)> callback);
View *CreateItemView(int index) override;
int GetNumItems() override { return numItems_; }
bool AddEventCallback(View *view, std::function<EventReturn(EventParams&)> callback) override;
private:
const char **items_;
@ -421,12 +417,12 @@ class StringVectorListAdaptor : public ListAdaptor {
public:
StringVectorListAdaptor() : selected_(-1) {}
StringVectorListAdaptor(const std::vector<std::string> &items, int selected = -1) : items_(items), selected_(selected) {}
virtual View *CreateItemView(int index) override;
virtual int GetNumItems() override { return (int)items_.size(); }
virtual bool AddEventCallback(View *view, std::function<EventReturn(EventParams&)> callback) override;
View *CreateItemView(int index) override;
int GetNumItems() override { return (int)items_.size(); }
bool AddEventCallback(View *view, std::function<EventReturn(EventParams&)> callback) override;
void SetSelected(int sel) override { selected_ = sel; }
virtual std::string GetTitle(int index) const override { return items_[index]; }
virtual int GetSelected() override { return selected_; }
std::string GetTitle(int index) const override { return items_[index]; }
int GetSelected() override { return selected_; }
private:
std::vector<std::string> items_;
@ -440,7 +436,7 @@ public:
ListView(ListAdaptor *a, std::set<int> hidden = std::set<int>(), LayoutParams *layoutParams = 0);
int GetSelected() { return adaptor_->GetSelected(); }
virtual void Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert) override;
void Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert) override;
virtual void SetMaxHeight(float mh) { maxHeight_ = mh; }
Event OnChoice;
std::string DescribeLog() const override { return "ListView: " + View::DescribeLog(); }

View File

@ -257,7 +257,7 @@ struct ConfigSetting {
return type_ != TYPE_TERMINATOR;
}
bool Get(Section *section) {
bool Get(const Section *section) {
switch (type_) {
case TYPE_BOOL:
if (cb_.b) {

View File

@ -31,6 +31,8 @@ enum {
class DebugInterface
{
public:
virtual ~DebugInterface() {}
virtual const char *disasm(unsigned int address, unsigned int align) {return "NODEBUGGER";}
virtual int getInstructionSize(int instruction) {return 1;}

View File

@ -122,7 +122,7 @@ void parseDisasm(const char* disasm, char* opcode, char* arguments, bool insertS
// parse symbol
if (disasm == jumpAddress)
{
u32 branchTarget;
u32 branchTarget = 0;
sscanf(disasm+3,"%08x",&branchTarget);
const std::string addressSymbol = g_symbolMap->GetLabelString(branchTarget);

View File

@ -99,8 +99,7 @@ private:
class DisassemblyOpcode: public DisassemblyEntry
{
public:
DisassemblyOpcode(u32 _address, int _num): address(_address), num(_num) { };
virtual ~DisassemblyOpcode() { };
DisassemblyOpcode(u32 _address, int _num): address(_address), num(_num) { }
void recheck() override { };
int getNumLines() override { return num; };
int getLineNum(u32 address, bool findStart) override { return (address - this->address) / 4; };
@ -118,8 +117,7 @@ private:
class DisassemblyMacro: public DisassemblyEntry
{
public:
DisassemblyMacro(u32 _address): address(_address) { };
virtual ~DisassemblyMacro() { };
DisassemblyMacro(u32 _address): address(_address) { }
void setMacroLi(u32 _immediate, u8 _rt);
void setMacroMemory(std::string _name, u32 _immediate, u8 _rt, int _dataSize);
@ -147,7 +145,6 @@ class DisassemblyData: public DisassemblyEntry
{
public:
DisassemblyData(u32 _address, u32 _size, DataType _type);
virtual ~DisassemblyData() { };
void recheck() override;
int getNumLines() override { return (int)lines.size(); };
@ -179,7 +176,6 @@ class DisassemblyComment: public DisassemblyEntry
{
public:
DisassemblyComment(u32 _address, u32 _size, std::string name, std::string param);
virtual ~DisassemblyComment() { };
void recheck() override { };
int getNumLines() override { return 1; };

View File

@ -127,9 +127,9 @@ bool SymbolMap::LoadSymbolMap(const Path &filename) {
if (!started) continue;
u32 address = -1, size, vaddress = -1;
u32 address = -1, size = 0, vaddress = -1;
int moduleIndex = 0;
int typeInt;
int typeInt = ST_NONE;
SymbolType type;
char name[128] = {0};
@ -145,7 +145,9 @@ bool SymbolMap::LoadSymbolMap(const Path &filename) {
continue;
}
sscanf(line, "%08x %08x %x %i %127c", &address, &size, &vaddress, &typeInt, name);
int matched = sscanf(line, "%08x %08x %x %i %127c", &address, &size, &vaddress, &typeInt, name);
if (matched < 1)
continue;
type = (SymbolType) typeInt;
if (!hasModules) {
if (!Memory::IsValidAddress(vaddress)) {

View File

@ -36,7 +36,7 @@ public:
WebSocketDisasmState() {
disasm_.setCpu(currentDebugMIPS);
}
~WebSocketDisasmState() override {
~WebSocketDisasmState() {
disasm_.clear();
}

View File

@ -23,7 +23,7 @@
#include "GPU/Debugger/Record.h"
struct WebSocketGPURecordState : public DebuggerSubscriber {
~WebSocketGPURecordState() override;
~WebSocketGPURecordState();
void Dump(DebuggerRequest &req);
void Broadcast(net::WebSocketServer *ws) override;

View File

@ -68,7 +68,7 @@ struct DebuggerGPUStatsEvent {
struct WebSocketGPUStatsState : public DebuggerSubscriber {
WebSocketGPUStatsState();
~WebSocketGPUStatsState() override;
~WebSocketGPUStatsState();
void Get(DebuggerRequest &req);
void Feed(DebuggerRequest &req);

View File

@ -27,7 +27,7 @@ class WebSocketMemoryInfoState : public DebuggerSubscriber {
public:
WebSocketMemoryInfoState() {
}
~WebSocketMemoryInfoState() override {
~WebSocketMemoryInfoState() {
UpdateOverride(false);
}

View File

@ -32,7 +32,7 @@ struct WebSocketSteppingState : public DebuggerSubscriber {
WebSocketSteppingState() {
disasm_.setCpu(currentDebugMIPS);
}
~WebSocketSteppingState() override {
~WebSocketSteppingState() {
disasm_.clear();
}

View File

@ -250,7 +250,7 @@ int PSPGamedataInstallDialog::Shutdown(bool force) {
return PSPDialog::Shutdown(force);
}
std::string PSPGamedataInstallDialog::GetGameDataInstallFileName(SceUtilityGamedataInstallParam *param, std::string filename){
std::string PSPGamedataInstallDialog::GetGameDataInstallFileName(const SceUtilityGamedataInstallParam *param, std::string filename) {
if (!param)
return "";
std::string GameDataInstallPath = saveBasePath + param->gameName + param->dataName + "/";

View File

@ -36,15 +36,15 @@ struct SceUtilityGamedataInstallParam {
class PSPGamedataInstallDialog: public PSPDialog {
public:
PSPGamedataInstallDialog(UtilityDialogType type);
virtual ~PSPGamedataInstallDialog();
~PSPGamedataInstallDialog();
virtual int Init(u32 paramAddr);
virtual int Update(int animSpeed) override;
virtual int Shutdown(bool force = false) override;
virtual void DoState(PointerWrap &p) override;
int Init(u32 paramAddr);
int Update(int animSpeed) override;
int Shutdown(bool force = false) override;
void DoState(PointerWrap &p) override;
int Abort();
std::string GetGameDataInstallFileName(SceUtilityGamedataInstallParam *param, std::string filename);
std::string GetGameDataInstallFileName(const SceUtilityGamedataInstallParam *param, std::string filename);
protected:
// TODO: Manage status correctly.

View File

@ -59,18 +59,18 @@ struct pspMessageDialog
class PSPMsgDialog: public PSPDialog {
public:
PSPMsgDialog(UtilityDialogType type);
virtual ~PSPMsgDialog();
~PSPMsgDialog();
virtual int Init(unsigned int paramAddr);
virtual int Update(int animSpeed) override;
virtual int Shutdown(bool force = false) override;
virtual void DoState(PointerWrap &p) override;
virtual pspUtilityDialogCommon *GetCommonParam() override;
int Init(unsigned int paramAddr);
int Update(int animSpeed) override;
int Shutdown(bool force = false) override;
void DoState(PointerWrap &p) override;
pspUtilityDialogCommon *GetCommonParam() override;
int Abort();
protected:
virtual bool UseAutoStatus() override {
bool UseAutoStatus() override {
return false;
}

View File

@ -38,13 +38,13 @@ struct SceUtilityNetconfParam {
class PSPNetconfDialog: public PSPDialog {
public:
PSPNetconfDialog(UtilityDialogType type);
virtual ~PSPNetconfDialog();
~PSPNetconfDialog();
virtual int Init(u32 paramAddr);
virtual int Update(int animSpeed) override;
virtual int Shutdown(bool force = false) override;
virtual void DoState(PointerWrap &p) override;
virtual pspUtilityDialogCommon* GetCommonParam() override;
int Init(u32 paramAddr);
int Update(int animSpeed) override;
int Shutdown(bool force = false) override;
void DoState(PointerWrap &p) override;
pspUtilityDialogCommon* GetCommonParam() override;
protected:
bool UseAutoStatus() override {

View File

@ -34,13 +34,13 @@ struct SceUtilityNpSigninParam {
class PSPNpSigninDialog: public PSPDialog {
public:
PSPNpSigninDialog(UtilityDialogType type);
virtual ~PSPNpSigninDialog();
~PSPNpSigninDialog();
virtual int Init(u32 paramAddr);
virtual int Update(int animSpeed) override;
virtual int Shutdown(bool force = false) override;
virtual void DoState(PointerWrap &p) override;
virtual pspUtilityDialogCommon* GetCommonParam() override;
int Init(u32 paramAddr);
int Update(int animSpeed) override;
int Shutdown(bool force = false) override;
void DoState(PointerWrap &p) override;
pspUtilityDialogCommon* GetCommonParam() override;
protected:
bool UseAutoStatus() override {

View File

@ -213,16 +213,16 @@ enum class PSPOskNativeStatus {
class PSPOskDialog: public PSPDialog {
public:
PSPOskDialog(UtilityDialogType type);
virtual ~PSPOskDialog();
~PSPOskDialog();
virtual int Init(u32 oskPtr);
virtual int Update(int animSpeed) override;
virtual int Shutdown(bool force = false) override;
virtual void DoState(PointerWrap &p) override;
virtual pspUtilityDialogCommon *GetCommonParam() override;
int Init(u32 oskPtr);
int Update(int animSpeed) override;
int Shutdown(bool force = false) override;
void DoState(PointerWrap &p) override;
pspUtilityDialogCommon *GetCommonParam() override;
protected:
virtual bool UseAutoStatus() override {
bool UseAutoStatus() override {
return false;
}

View File

@ -22,9 +22,9 @@
class PSPPlaceholderDialog: public PSPDialog {
public:
PSPPlaceholderDialog(UtilityDialogType type);
virtual ~PSPPlaceholderDialog();
~PSPPlaceholderDialog();
virtual int Init();
virtual int Update(int animSpeed) override;
int Init();
int Update(int animSpeed) override;
};

View File

@ -157,7 +157,7 @@ int PSPSaveDialog::Init(int paramAddr)
break;
}
if(!param.wouldHasMultiSaveName(param.GetPspParam()))
if (!param.WouldHaveMultiSaveName(param.GetPspParam()))
currentSelectedSave = 0;
switch ((SceUtilitySavedataType)(u32)param.GetPspParam()->mode)

View File

@ -72,18 +72,18 @@
class PSPSaveDialog: public PSPDialog {
public:
PSPSaveDialog(UtilityDialogType type);
virtual ~PSPSaveDialog();
~PSPSaveDialog();
virtual int Init(int paramAddr);
virtual int Update(int animSpeed) override;
virtual int Shutdown(bool force = false) override;
virtual void DoState(PointerWrap &p) override;
virtual pspUtilityDialogCommon *GetCommonParam() override;
int Init(int paramAddr);
int Update(int animSpeed) override;
int Shutdown(bool force = false) override;
void DoState(PointerWrap &p) override;
pspUtilityDialogCommon *GetCommonParam() override;
void ExecuteIOAction();
protected:
virtual bool UseAutoStatus() override {
bool UseAutoStatus() override {
return false;
}

View File

@ -25,13 +25,13 @@ struct SceUtilityScreenshotParams;
class PSPScreenshotDialog : public PSPDialog {
public:
PSPScreenshotDialog(UtilityDialogType type);
virtual ~PSPScreenshotDialog();
~PSPScreenshotDialog();
virtual int Init(u32 paramAddr);
virtual int Update(int animSpeed) override;
virtual int ContStart();
virtual void DoState(PointerWrap &p) override;
virtual pspUtilityDialogCommon *GetCommonParam() override;
int Init(u32 paramAddr);
int Update(int animSpeed) override;
int ContStart();
void DoState(PointerWrap &p) override;
pspUtilityDialogCommon *GetCommonParam() override;
protected:
// TODO: Manage status correctly.

View File

@ -86,7 +86,7 @@ namespace
return result != 0;
}
bool WritePSPFile(std::string filename, u8 *data, SceSize dataSize)
bool WritePSPFile(std::string filename, const u8 *data, SceSize dataSize)
{
int handle = pspFileSystem.OpenFile(filename, (FileAccess)(FILEACCESS_WRITE | FILEACCESS_CREATE | FILEACCESS_TRUNCATE));
if (handle < 0)
@ -1516,7 +1516,7 @@ int SavedataParam::SetPspParam(SceUtilitySavedataParam *param)
saveDataListCount++;
}
if (saveDataListCount > 0 && wouldHasMultiSaveName(param)) {
if (saveDataListCount > 0 && WouldHaveMultiSaveName(param)) {
hasMultipleFileName = true;
saveDataList = new SaveFileInfo[saveDataListCount];
@ -1842,8 +1842,7 @@ int SavedataParam::GetLastEmptySave()
return idx;
}
int SavedataParam::GetSaveNameIndex(SceUtilitySavedataParam* param)
{
int SavedataParam::GetSaveNameIndex(const SceUtilitySavedataParam *param) {
std::string saveName = GetSaveName(param);
for (int i = 0; i < saveNameListDataCount; i++)
{
@ -1857,7 +1856,7 @@ int SavedataParam::GetSaveNameIndex(SceUtilitySavedataParam* param)
return 0;
}
bool SavedataParam::wouldHasMultiSaveName(SceUtilitySavedataParam* param) {
bool SavedataParam::WouldHaveMultiSaveName(const SceUtilitySavedataParam *param) {
switch ((SceUtilitySavedataType)(u32)param->mode) {
case SCE_UTILITY_SAVEDATA_TYPE_LOAD:
case SCE_UTILITY_SAVEDATA_TYPE_AUTOLOAD:
@ -1937,7 +1936,7 @@ std::shared_ptr<ParamSFOData> SavedataParam::LoadCachedSFO(const std::string &pa
return sfoCache_.at(path);
}
int SavedataParam::GetSaveCryptMode(SceUtilitySavedataParam *param, const std::string &saveDirName) {
int SavedataParam::GetSaveCryptMode(const SceUtilitySavedataParam *param, const std::string &saveDirName) {
std::string dirPath = GetSaveFilePath(param, GetSaveDir(param, saveDirName));
std::string sfopath = dirPath + "/" + SFO_FILENAME;
std::shared_ptr<ParamSFOData> sfoFile = LoadCachedSFO(sfopath);

View File

@ -317,7 +317,7 @@ public:
bool GetList(SceUtilitySavedataParam* param);
int GetFilesList(SceUtilitySavedataParam* param, u32 requestAddr);
bool GetSize(SceUtilitySavedataParam* param);
int GetSaveCryptMode(SceUtilitySavedataParam* param, const std::string &saveDirName);
int GetSaveCryptMode(const SceUtilitySavedataParam *param, const std::string &saveDirName);
bool IsInSaveDataList(std::string saveName, int count);
std::string GetGameName(const SceUtilitySavedataParam *param) const;
@ -351,9 +351,9 @@ public:
int GetLastDataSave();
int GetFirstEmptySave();
int GetLastEmptySave();
int GetSaveNameIndex(SceUtilitySavedataParam* param);
int GetSaveNameIndex(const SceUtilitySavedataParam *param);
bool wouldHasMultiSaveName(SceUtilitySavedataParam* param);
bool WouldHaveMultiSaveName(const SceUtilitySavedataParam *param);
void ClearCaches();

View File

@ -128,7 +128,7 @@ bool ElfReader::LoadRelocations(const Elf32_Rel *rels, int numRelocs) {
if (log) {
DEBUG_LOG(LOADER, "rel at: %08x info: %08x type: %i", addr, info, type);
}
u32 relocateTo = segmentVAddr[relative];
u32 relocateTo = relative >= (int)ARRAY_SIZE(segmentVAddr) ? 0 : segmentVAddr[relative];
switch (type) {
case R_MIPS_32:
@ -289,9 +289,9 @@ void ElfReader::LoadRelocations2(int rel_seg)
}
}else{
addr_seg = seg;
relocate_to = segmentVAddr[addr_seg];
relocate_to = addr_seg >= (int)ARRAY_SIZE(segmentVAddr) ? 0 : segmentVAddr[addr_seg];
if (!Memory::IsValidAddress(relocate_to)) {
ERROR_LOG(LOADER, "ELF: Bad address to relocate to: %08x", relocate_to);
ERROR_LOG(LOADER, "ELF: Bad address to relocate to: %08x (segment %d)", relocate_to, addr_seg);
continue;
}

View File

@ -27,7 +27,7 @@
class CachingFileLoader : public ProxiedFileLoader {
public:
CachingFileLoader(FileLoader *backend);
~CachingFileLoader() override;
~CachingFileLoader();
bool Exists() override;
bool ExistsFast() override;

View File

@ -480,7 +480,7 @@ bool DiskCachingFileLoaderCache::ReadBlockData(u8 *dest, BlockInfo &info, size_t
return !failed;
}
void DiskCachingFileLoaderCache::WriteBlockData(BlockInfo &info, u8 *src) {
void DiskCachingFileLoaderCache::WriteBlockData(BlockInfo &info, const u8 *src) {
if (!f_) {
return;
}

View File

@ -31,7 +31,7 @@ class DiskCachingFileLoaderCache;
class DiskCachingFileLoader : public ProxiedFileLoader {
public:
DiskCachingFileLoader(FileLoader *backend);
~DiskCachingFileLoader() override;
~DiskCachingFileLoader();
bool Exists() override;
bool ExistsFast() override;
@ -95,7 +95,7 @@ private:
struct BlockInfo;
bool ReadBlockData(u8 *dest, BlockInfo &info, size_t offset, size_t size);
void WriteBlockData(BlockInfo &info, u8 *src);
void WriteBlockData(BlockInfo &info, const u8 *src);
void WriteIndexData(u32 indexPos, BlockInfo &info);
s64 GetBlockOffset(u32 block);

View File

@ -30,21 +30,21 @@
class HTTPFileLoader : public FileLoader {
public:
HTTPFileLoader(const ::Path &filename);
virtual ~HTTPFileLoader() override;
~HTTPFileLoader();
bool IsRemote() override {
return true;
}
virtual bool Exists() override;
virtual bool ExistsFast() override;
virtual bool IsDirectory() override;
virtual s64 FileSize() override;
virtual Path GetPath() const override;
bool Exists() override;
bool ExistsFast() override;
bool IsDirectory() override;
s64 FileSize() override;
Path GetPath() const override;
virtual size_t ReadAt(s64 absolutePos, size_t bytes, size_t count, void *data, Flags flags = Flags::NONE) override {
size_t ReadAt(s64 absolutePos, size_t bytes, size_t count, void *data, Flags flags = Flags::NONE) override {
return ReadAt(absolutePos, bytes * count, data, flags) / bytes;
}
virtual size_t ReadAt(s64 absolutePos, size_t bytes, void *data, Flags flags = Flags::NONE) override;
size_t ReadAt(s64 absolutePos, size_t bytes, void *data, Flags flags = Flags::NONE) override;
void Cancel() override {
cancel_ = true;

View File

@ -30,15 +30,15 @@ typedef void *HANDLE;
class LocalFileLoader : public FileLoader {
public:
LocalFileLoader(const Path &filename);
virtual ~LocalFileLoader();
~LocalFileLoader();
virtual bool Exists() override;
virtual bool IsDirectory() override;
virtual s64 FileSize() override;
virtual Path GetPath() const override {
bool Exists() override;
bool IsDirectory() override;
s64 FileSize() override;
Path GetPath() const override {
return filename_;
}
virtual size_t ReadAt(s64 absolutePos, size_t bytes, size_t count, void *data, Flags flags = Flags::NONE) override;
size_t ReadAt(s64 absolutePos, size_t bytes, size_t count, void *data, Flags flags = Flags::NONE) override;
private:
#ifndef _WIN32

View File

@ -27,7 +27,7 @@
class RamCachingFileLoader : public ProxiedFileLoader {
public:
RamCachingFileLoader(FileLoader *backend);
~RamCachingFileLoader() override;
~RamCachingFileLoader();
bool Exists() override;
bool ExistsFast() override;

View File

@ -712,7 +712,7 @@ PSPFileInfo DirectoryFileSystem::GetFileInfo(std::string filename) {
#ifdef _WIN32
#define FILETIME_FROM_UNIX_EPOCH_US 11644473600000000ULL
static void tmFromFiletime(tm &dest, FILETIME &src) {
static void tmFromFiletime(tm &dest, const FILETIME &src) {
u64 from_1601_us = (((u64) src.dwHighDateTime << 32ULL) + (u64) src.dwLowDateTime) / 10ULL;
u64 from_1970_us = from_1601_us - FILETIME_FROM_UNIX_EPOCH_US;

View File

@ -77,7 +77,7 @@ public:
class SequentialHandleAllocator : public IHandleAllocator {
public:
SequentialHandleAllocator() : handle_(1) {}
virtual u32 GetNewHandle() override {
u32 GetNewHandle() override {
u32 res = handle_++;
if (handle_ < 0) {
// Some code assumes it'll never become 0.
@ -85,7 +85,7 @@ public:
}
return res;
}
virtual void FreeHandle(u32 handle) override {}
void FreeHandle(u32 handle) override {}
private:
int handle_;
};
@ -142,7 +142,7 @@ public:
class EmptyFileSystem : public IFileSystem {
public:
virtual void DoState(PointerWrap &p) override {}
void DoState(PointerWrap &p) override {}
std::vector<PSPFileInfo> GetDirListing(const std::string &path, bool *exists = nullptr) override {
if (exists)
*exists = false;
@ -158,14 +158,14 @@ public:
size_t SeekFile(u32 handle, s32 position, FileMove type) override {return 0;}
PSPFileInfo GetFileInfo(std::string filename) override {PSPFileInfo f; return f;}
bool OwnsHandle(u32 handle) override {return false;}
virtual bool MkDir(const std::string &dirname) override {return false;}
virtual bool RmDir(const std::string &dirname) override {return false;}
virtual int RenameFile(const std::string &from, const std::string &to) override {return -1;}
virtual bool RemoveFile(const std::string &filename) override {return false;}
virtual int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override {return SCE_KERNEL_ERROR_ERRNO_FUNCTION_NOT_SUPPORTED; }
virtual PSPDevType DevType(u32 handle) override { return PSPDevType::INVALID; }
virtual FileSystemFlags Flags() override { return FileSystemFlags::NONE; }
virtual u64 FreeSpace(const std::string &path) override { return 0; }
bool MkDir(const std::string &dirname) override {return false;}
bool RmDir(const std::string &dirname) override {return false;}
int RenameFile(const std::string &from, const std::string &to) override {return -1;}
bool RemoveFile(const std::string &filename) override {return false;}
int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override { return SCE_KERNEL_ERROR_ERRNO_FUNCTION_NOT_SUPPORTED; }
PSPDevType DevType(u32 handle) override { return PSPDevType::INVALID; }
FileSystemFlags Flags() override { return FileSystemFlags::NONE; }
u64 FreeSpace(const std::string &path) override { return 0; }
bool ComputeRecursiveDirSizeIfFast(const std::string &path, int64_t *size) override { return false; }
};

View File

@ -91,7 +91,7 @@ public:
int MapFilePath(const std::string &inpath, std::string &outpath, MountPoint **system);
inline int MapFilePath(const std::string &_inpath, std::string &outpath, IFileSystem **system) {
MountPoint *mountPoint;
MountPoint *mountPoint = nullptr;
int error = MapFilePath(_inpath, outpath, &mountPoint);
if (error == 0) {
*system = mountPoint->system.get();

View File

@ -651,7 +651,7 @@ PSPFileInfo VirtualDiscFileSystem::GetFileInfo(std::string filename) {
#ifdef _WIN32
#define FILETIME_FROM_UNIX_EPOCH_US 11644473600000000ULL
static void tmFromFiletime(tm &dest, FILETIME &src)
static void tmFromFiletime(tm &dest, const FILETIME &src)
{
u64 from_1601_us = (((u64) src.dwHighDateTime << 32ULL) + (u64) src.dwLowDateTime) / 10ULL;
u64 from_1970_us = from_1601_us - FILETIME_FROM_UNIX_EPOCH_US;

View File

@ -180,7 +180,7 @@ std::string ip2str(in_addr in, bool maskPublicIP) {
return std::string(str);
}
std::string mac2str(SceNetEtherAddr* mac) {
std::string mac2str(const SceNetEtherAddr *mac) {
char str[18] = ":::::";
if (mac != NULL) {

View File

@ -1017,7 +1017,7 @@ bool isPTPPortInUse(uint16_t port, bool forListen, SceNetEtherAddr* dstmac = nul
std::string ip2str(in_addr in, bool maskPublicIP = true);
// Convert MAC address to string
std::string mac2str(SceNetEtherAddr* mac);
std::string mac2str(const SceNetEtherAddr *mac);
/*
* Matching Members

View File

@ -271,8 +271,9 @@ public:
if (p.mode == p.MODE_READ) {
pgdInfo = (PGD_DESC*) malloc(sizeof(PGD_DESC));
}
p.DoVoid(pgdInfo, sizeof(PGD_DESC));
if (p.mode == p.MODE_READ) {
if (pgdInfo)
p.DoVoid(pgdInfo, sizeof(PGD_DESC));
if (p.mode == p.MODE_READ && pgdInfo) {
pgdInfo->block_buf = (u8 *)malloc(pgdInfo->block_size * 2);
}
}
@ -796,7 +797,7 @@ void __IoShutdown() {
memStickFatCallbacks.clear();
}
static std::string IODetermineFilename(FileNode *f) {
static std::string IODetermineFilename(const FileNode *f) {
uint64_t offset = pspFileSystem.GetSeekPos(f->handle);
if ((pspFileSystem.DevType(f->handle) & PSPDevType::BLOCK) != 0) {
return StringFromFormat("%s offset 0x%08llx", f->fullpath.c_str(), offset * 2048);

View File

@ -1466,7 +1466,7 @@ void __KernelSaveContext(PSPThreadContext *ctx, bool vfpuEnabled) {
}
// Loads a CPU context
void __KernelLoadContext(PSPThreadContext *ctx, bool vfpuEnabled) {
void __KernelLoadContext(const PSPThreadContext *ctx, bool vfpuEnabled) {
// r and f are immediately next to each other and must be.
memcpy((void *)currentMIPS->r, (void *)ctx->r, sizeof(ctx->r) + sizeof(ctx->f));

View File

@ -177,7 +177,7 @@ bool KernelIsThreadDormant(SceUID threadID);
bool KernelIsThreadWaiting(SceUID threadID);
void __KernelSaveContext(PSPThreadContext *ctx, bool vfpuEnabled);
void __KernelLoadContext(PSPThreadContext *ctx, bool vfpuEnabled);
void __KernelLoadContext(const PSPThreadContext *ctx, bool vfpuEnabled);
u32 __KernelResumeThreadFromWait(SceUID threadID, u32 retval); // can return an error value
u32 __KernelResumeThreadFromWait(SceUID threadID, u64 retval);

View File

@ -71,7 +71,7 @@ KernelObject *__KernelVTimerObject() {
return new VTimer;
}
static u64 __getVTimerRunningTime(VTimer *vt) {
static u64 __getVTimerRunningTime(const VTimer *vt) {
if (vt->nvt.active == 0)
return 0;

View File

@ -314,7 +314,7 @@ static u32 getMpegVersion(u32 mpegRawVersion) {
}
}
static void AnalyzeMpeg(u8 *buffer, u32 validSize, MpegContext *ctx) {
static void AnalyzeMpeg(const u8 *buffer, u32 validSize, MpegContext *ctx) {
ctx->mpegMagic = *(u32_le*)buffer;
ctx->mpegRawVersion = *(u32_le*)(buffer + PSMF_STREAM_VERSION_OFFSET);
ctx->mpegVersion = getMpegVersion(ctx->mpegRawVersion);
@ -883,11 +883,11 @@ public:
}
};
void add(H264Frames *p){
void add(const H264Frames *p) {
add(p->stream, p->size);
};
void add(u8* str, int sz){
void add(const u8 *str, int sz) {
int newsize = size + sz;
u8* newstream = new u8[newsize];
// join two streams

View File

@ -134,7 +134,7 @@ void AsyncIOManager::Read(u32 handle, u8 *buf, size_t bytes, u32 invalidateAddr)
EventResult(handle, AsyncIOResult(result, usec, invalidateAddr));
}
void AsyncIOManager::Write(u32 handle, u8 *buf, size_t bytes) {
void AsyncIOManager::Write(u32 handle, const u8 *buf, size_t bytes) {
int usec = 0;
s64 result = pspFileSystem.WriteFile(handle, buf, bytes, usec);
EventResult(handle, AsyncIOResult(result, usec));

View File

@ -98,7 +98,7 @@ private:
bool PopResult(u32 handle, AsyncIOResult &result);
bool ReadResult(u32 handle, AsyncIOResult &result);
void Read(u32 handle, u8 *buf, size_t bytes, u32 invalidateAddr);
void Write(u32 handle, u8 *buf, size_t bytes);
void Write(u32 handle, const u8 *buf, size_t bytes);
void EventResult(u32 handle, AsyncIOResult result);

View File

@ -60,7 +60,11 @@ void convert_frame(int inw, int inh, unsigned char *inData, AVPixelFormat inForm
void __cameraDummyImage(int width, int height, unsigned char** outData, int* outLen) {
#ifdef USE_FFMPEG
unsigned char* rgbData = (unsigned char*)malloc(3 * width * height);
unsigned char *rgbData = (unsigned char *)malloc(3 * width * height);
if (!rgbData) {
*outData = nullptr;
return;
}
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
rgbData[3 * (y * width + x) + 0] = x*255/width;

View File

@ -288,7 +288,7 @@ bool MpegDemux::demux(int audioChannel)
return looksValid;
}
static bool isHeader(u8* audioStream, int offset)
static bool isHeader(const u8 *audioStream, int offset)
{
const u8 header1 = (u8)0x0F;
const u8 header2 = (u8)0xD0;

View File

@ -120,7 +120,7 @@ bool SimpleAudio::OpenCodec(int block_align) {
#endif // USE_FFMPEG
}
void SimpleAudio::SetExtraData(u8 *data, int size, int wav_bytes_per_packet) {
void SimpleAudio::SetExtraData(const u8 *data, int size, int wav_bytes_per_packet) {
#ifdef USE_FFMPEG
if (codecCtx_) {
codecCtx_->extradata = (uint8_t *)av_mallocz(size);

View File

@ -53,7 +53,7 @@ public:
int GetAudioCodecID(int audioType); // Get audioCodecId from audioType
// Not save stated, only used by UI. Used for ATRAC3 (non+) files.
void SetExtraData(u8 *data, int size, int wav_bytes_per_packet);
void SetExtraData(const u8 *data, int size, int wav_bytes_per_packet);
void SetChannels(int channels);

View File

@ -392,8 +392,8 @@ bool UmdReplace(const Path &filepath, std::string &error) {
FileLoader *loadedFile = ConstructFileLoader(filepath);
if (!loadedFile->Exists()) {
delete loadedFile;
error = loadedFile->GetPath().ToVisualString() + " doesn't exist";
delete loadedFile;
return false;
}
UpdateLoadedFile(loadedFile);

View File

@ -94,7 +94,7 @@ public:
class ProxiedFileLoader : public FileLoader {
public:
ProxiedFileLoader(FileLoader *backend) : backend_(backend) {}
~ProxiedFileLoader() override {
~ProxiedFileLoader() {
// Takes ownership.
delete backend_;
}

View File

@ -92,7 +92,7 @@ namespace MIPSComp {
// Vector regs can overlap in all sorts of swizzled ways.
// This does allow a single overlap in sregs[i].
static bool IsOverlapSafeAllowS(int dreg, int di, int sn, u8 sregs[], int tn = 0, u8 tregs[] = NULL) {
static bool IsOverlapSafeAllowS(int dreg, int di, int sn, const u8 sregs[], int tn = 0, const u8 tregs[] = NULL) {
for (int i = 0; i < sn; ++i) {
if (sregs[i] == dreg && i != di)
return false;
@ -106,7 +106,7 @@ namespace MIPSComp {
return true;
}
static bool IsOverlapSafeAllowS(int dn, u8 dregs[], int sn, u8 sregs[], int tn = 0, u8 tregs[] = nullptr) {
static bool IsOverlapSafeAllowS(int dn, const u8 dregs[], int sn, const u8 sregs[], int tn = 0, const u8 tregs[] = nullptr) {
for (int i = 0; i < dn; ++i) {
if (!IsOverlapSafeAllowS(dregs[i], i, sn, sregs, tn, tregs)) {
return false;
@ -115,11 +115,11 @@ namespace MIPSComp {
return true;
}
static bool IsOverlapSafe(int dreg, int sn, u8 sregs[], int tn = 0, u8 tregs[] = nullptr) {
static bool IsOverlapSafe(int dreg, int sn, const u8 sregs[], int tn = 0, const u8 tregs[] = nullptr) {
return IsOverlapSafeAllowS(dreg, -1, sn, sregs, tn, tregs);
}
static bool IsOverlapSafe(int dn, u8 dregs[], int sn, u8 sregs[], int tn = 0, u8 tregs[] = nullptr) {
static bool IsOverlapSafe(int dn, const u8 dregs[], int sn, const u8 sregs[], int tn = 0, const u8 tregs[] = nullptr) {
for (int i = 0; i < dn; ++i) {
if (!IsOverlapSafe(dregs[i], sn, sregs, tn, tregs)) {
return false;
@ -184,7 +184,7 @@ namespace MIPSComp {
return;
int n = GetNumVectorElements(sz);
u8 origV[4];
u8 origV[4]{};
static const float constantArray[8] = { 0.f, 1.f, 2.f, 0.5f, 3.f, 1.f / 3.f, 0.25f, 1.f / 6.f };
for (int i = 0; i < n; i++)
@ -1697,7 +1697,7 @@ namespace MIPSComp {
GetVectorRegs(tregs, sz, _VT);
GetVectorRegs(dregs, sz, _VD);
u8 tempregs[4];
u8 tempregs[4]{};
for (int i = 0; i < n; ++i) {
if (!IsOverlapSafe(dregs[i], n, sregs, n, tregs)) {
tempregs[i] = IRVTEMP_PFX_T + i; // using IRTEMP0 for other things

View File

@ -136,7 +136,7 @@ private:
class IRJit : public JitInterface {
public:
IRJit(MIPSState *mipsState);
virtual ~IRJit();
~IRJit();
void DoState(PointerWrap &p) override;

View File

@ -304,7 +304,7 @@ bool JitBlockCache::RangeMayHaveEmuHacks(u32 start, u32 end) const {
return false;
}
static int binary_search(JitBlock blocks_[], const u8 *baseoff, int imin, int imax) {
static int binary_search(const JitBlock blocks_[], const u8 *baseoff, int imin, int imax) {
while (imin < imax) {
int imid = (imin + imax) / 2;
if (blocks_[imid].normalEntry < baseoff)

View File

@ -678,7 +678,7 @@ static int32_t get_sign(uint32_t x) {
return x & 0x80000000;
}
float vfpu_dot(float a[4], float b[4]) {
float vfpu_dot(const float a[4], const float b[4]) {
static const int EXTRA_BITS = 2;
float2int result;
float2int src[2];

View File

@ -63,7 +63,7 @@ inline float vfpu_clamp(float v, float min, float max) {
return v >= max ? max : (v <= min ? min : v);
}
float vfpu_dot(float a[4], float b[4]);
float vfpu_dot(const float a[4], const float b[4]);
float vfpu_sqrt(float a);
float vfpu_rsqrt(float a);

View File

@ -220,7 +220,7 @@ void Jit::ApplyPrefixD(const u8 *vregs, VectorSize sz) {
// Vector regs can overlap in all sorts of swizzled ways.
// This does allow a single overlap in sregs[i].
bool IsOverlapSafeAllowS(int dreg, int di, int sn, u8 sregs[], int tn = 0, u8 tregs[] = NULL) {
bool IsOverlapSafeAllowS(int dreg, int di, int sn, const u8 sregs[], int tn = 0, const u8 tregs[] = NULL) {
for (int i = 0; i < sn; ++i) {
if (sregs[i] == dreg && i != di)
return false;
@ -234,7 +234,7 @@ bool IsOverlapSafeAllowS(int dreg, int di, int sn, u8 sregs[], int tn = 0, u8 tr
return true;
}
bool IsOverlapSafe(int dreg, int di, int sn, u8 sregs[], int tn = 0, u8 tregs[] = NULL) {
bool IsOverlapSafe(int dreg, int di, int sn, const u8 sregs[], int tn = 0, const u8 tregs[] = NULL) {
return IsOverlapSafeAllowS(dreg, di, sn, sregs, tn, tregs) && sregs[di] != dreg;
}

View File

@ -14,7 +14,7 @@ public:
class IRToX86 : public IRToNativeInterface {
public:
void SetCodeBlock(Gen::XCodeBlock *code) { code_ = code; }
virtual void ConvertIRToNative(const IRInst *instructions, int count, const u32 *constants) override;
void ConvertIRToNative(const IRInst *instructions, int count, const u32 *constants) override;
private:
Gen::XCodeBlock *code_;

View File

@ -44,7 +44,7 @@ struct RegCacheState {
class Jit : public Gen::XCodeBlock, public JitInterface, public MIPSFrontendInterface {
public:
Jit(MIPSState *mipsState);
virtual ~Jit();
~Jit();
const JitOptions &GetJitOptions() { return jo; }

View File

@ -41,7 +41,7 @@ public:
JPEGFileStream(const Path &filename) {
fp_ = File::OpenCFile(filename, "wb");
}
~JPEGFileStream() override {
~JPEGFileStream() {
if (fp_ ) {
fclose(fp_);
}

View File

@ -28,6 +28,8 @@ template <typename B, typename Event, typename EventType, EventType EVENT_INVALI
struct ThreadEventQueue : public B {
ThreadEventQueue() : threadEnabled_(false), eventsRunning_(false), eventsHaveRun_(false) {
}
virtual ~ThreadEventQueue() {
}
void SetThreadEnabled(bool threadEnabled) {
threadEnabled_ = threadEnabled;

View File

@ -462,6 +462,7 @@ void BlockAllocator::DoState(PointerWrap &p)
}
else
{
_assert_(bottom_ != nullptr);
for (const Block *bp = bottom_; bp != NULL; bp = bp->next)
++count;
Do(p, count);

View File

@ -421,14 +421,14 @@ static void DataProcessingRegister(uint32_t w, uint64_t addr, Instruction *instr
const char *op = opcode2 >= 8 ? "unk" : opname[opcode];
snprintf(instr->text, sizeof(instr->text), "%s %c%d, %c%d", op, r, Rd, r, Rn);
} else if (((w >> 21) & 0x2FF) == 0x0D6) {
const char *opname[32] = {
const char *opname[64] = {
0, 0, "udiv", "sdiv", 0, 0, 0, 0,
"lslv", "lsrv", "asrv", "rorv", 0, 0, 0, 0,
"crc32b", "crc32h", "crc32w", 0, "crc32cb", "crc32ch", "crc32cw", 0,
};
int opcode = (w >> 10) & 0x3F;
// Data processing (2 source)
snprintf(instr->text, sizeof(instr->text), "%s %c%d, %c%d, %c%d", opname[opcode], r, Rd, r, Rn, r, Rm);
snprintf(instr->text, sizeof(instr->text), "%s %c%d, %c%d, %c%d", opname[opcode] ? opname[opcode] : "?", r, Rd, r, Rn, r, Rm);
} else if (((w >> 24) & 0x1f) == 0xA) {
// Logical (shifted register)
int shift = (w >> 22) & 0x3;
@ -929,9 +929,9 @@ static void FPandASIMD2(uint32_t w, uint64_t addr, Instruction *instr) {
snprintf(instr->text, sizeof(instr->text), "(float cond compare %08x)", w);
} else if (((w >> 10) & 3) == 2) {
int opc = (w >> 12) & 0xf;
const char *opnames[9] = { "fmul", "fdiv", "fadd", "fsub", "fmax", "fmin", "fmaxnm", "fminnm", "fnmul" };
const char *opnames[16] = { "fmul", "fdiv", "fadd", "fsub", "fmax", "fmin", "fmaxnm", "fminnm", "fnmul" };
char r = ((w >> 22) & 1) ? 'd' : 's';
snprintf(instr->text, sizeof(instr->text), "%s %c%d, %c%d, %c%d", opnames[opc], r, Rd, r, Rn, r, Rm);
snprintf(instr->text, sizeof(instr->text), "%s %c%d, %c%d, %c%d", opnames[opc] ? opnames[opc] : "?", r, Rd, r, Rn, r, Rm);
} else if (((w >> 10) & 3) == 3) {
char fr = ((w >> 22) & 1) ? 'd' : 's';
int cond = (w >> 12) & 0xf;

View File

@ -127,7 +127,13 @@ bool PortManager::Initialize(const unsigned int timeout) {
m_leaseDuration = "43200"; // 12 hours
m_InitState = UPNP_INITSTATE_BUSY;
urls = (UPNPUrls*)malloc(sizeof(struct UPNPUrls));
if (!urls)
return false;
datas = (IGDdatas*)malloc(sizeof(struct IGDdatas));
if (!datas) {
free(urls);
return false;
}
memset(urls, 0, sizeof(struct UPNPUrls));
memset(datas, 0, sizeof(struct IGDdatas));

View File

@ -303,7 +303,7 @@ void Draw2D::Blit(Draw2DPipeline *pipeline, float srcX1, float srcY1, float srcX
DrawStrip2D(nullptr, vtx, 4, linear, pipeline, srcWidth, srcHeight, scaleFactor);
}
void Draw2D::DrawStrip2D(Draw::Texture *tex, Draw2DVertex *verts, int vertexCount, bool linearFilter, Draw2DPipeline *pipeline, float texW, float texH, int scaleFactor) {
void Draw2D::DrawStrip2D(Draw::Texture *tex, const Draw2DVertex *verts, int vertexCount, bool linearFilter, Draw2DPipeline *pipeline, float texW, float texH, int scaleFactor) {
using namespace Draw;
_dbg_assert_(pipeline);

View File

@ -61,7 +61,7 @@ public:
Draw2DPipeline *Create2DPipeline(std::function<Draw2DPipelineInfo(ShaderWriter &)> generate);
void DrawStrip2D(Draw::Texture *tex, Draw2DVertex *verts, int vertexCount, bool linearFilter, Draw2DPipeline *pipeline, float texW = 0.0f, float texH = 0.0f, int scaleFactor = 0);
void DrawStrip2D(Draw::Texture *tex, const Draw2DVertex *verts, int vertexCount, bool linearFilter, Draw2DPipeline *pipeline, float texW = 0.0f, float texH = 0.0f, int scaleFactor = 0);
void Blit(Draw2DPipeline *pipeline, float srcX1, float srcY1, float srcX2, float srcY2, float dstX1, float dstY1, float dstX2, float dstY2, float srcWidth, float srcHeight, float dstWidth, float dstHeight, bool linear, int scaleFactor);
void Ensure2DResources();

Some files were not shown because too many files have changed in this diff Show More