mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Assorted warning fixes and data initialization to please valgrind
This commit is contained in:
@@ -125,11 +125,12 @@ public:
|
||||
size_ += count;
|
||||
}
|
||||
|
||||
// Adds this number of new T to the end, and returns the pointer to them.
|
||||
T *extend_uninitialized(size_t count) {
|
||||
size_t sz = size_;
|
||||
const size_t prevSize = size_;
|
||||
if (size_ + count <= capacity_) {
|
||||
size_ += count;
|
||||
return &data_[sz];
|
||||
return data_ + prevSize;
|
||||
} else {
|
||||
size_t newCapacity = size_ + count * 2; // Leave some extra room when growing in all cases
|
||||
if (newCapacity < capacity_ * 2) {
|
||||
@@ -138,7 +139,7 @@ public:
|
||||
}
|
||||
IncreaseCapacityTo(newCapacity);
|
||||
size_ += count;
|
||||
return &data_[sz];
|
||||
return data_ + prevSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ int LoadZIMPtr(const uint8_t *zim, size_t datasize, int *width, int *height, int
|
||||
memcpy(flags, zim + 12, 4);
|
||||
|
||||
int num_levels = 1;
|
||||
int image_data_size[ZIM_MAX_MIP_LEVELS];
|
||||
int image_data_size[ZIM_MAX_MIP_LEVELS]{};
|
||||
if (*flags & ZIM_HAS_MIPS) {
|
||||
num_levels = log2i(*width < *height ? *width : *height) + 1;
|
||||
}
|
||||
|
||||
@@ -1156,8 +1156,7 @@ const Path GetCurDirectory() {
|
||||
return Path(curDir);
|
||||
#else
|
||||
char temp[4096]{};
|
||||
getcwd(temp, 4096);
|
||||
return Path(temp);
|
||||
return Path(getcwd(temp, 4096));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -451,7 +451,7 @@ public:
|
||||
PendingDescSet &descSet = data.descSets_.push_uninitialized();
|
||||
descSet.offset = (uint32_t)offset;
|
||||
descSet.count = count;
|
||||
// descSet.set = VK_NULL_HANDLE; // to be filled in
|
||||
descSet.set = VK_NULL_HANDLE; // to be filled in
|
||||
*descSetIndex = setIndex;
|
||||
return retval;
|
||||
}
|
||||
|
||||
+16
-12
@@ -23,6 +23,7 @@
|
||||
#include "Common/File/VFS/VFS.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/System/OSD.h"
|
||||
#include "Common/System/System.h"
|
||||
#include "Core/Compatibility.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/System.h"
|
||||
@@ -59,20 +60,23 @@ void Compatibility::Load(const std::string &gameID) {
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
IniFile compat;
|
||||
// This loads from assets.
|
||||
if (compat.LoadFromVFS(g_VFS, "compatvr.ini")) {
|
||||
CheckVRSettings(compat, gameID);
|
||||
const int deviceType = System_GetPropertyInt(SYSPROP_DEVICE_TYPE);
|
||||
if ((deviceType == DEVICE_TYPE_VR) || g_Config.bForceVR) {
|
||||
{
|
||||
IniFile compat;
|
||||
// This loads from assets.
|
||||
if (compat.LoadFromVFS(g_VFS, "compatvr.ini")) {
|
||||
CheckVRSettings(compat, gameID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
IniFile compat2;
|
||||
// This one is user-editable. Need to load it after the system one.
|
||||
Path path = GetSysDirectory(DIRECTORY_SYSTEM) / "compatvr.ini";
|
||||
if (compat2.Load(path)) {
|
||||
CheckVRSettings(compat2, gameID);
|
||||
{
|
||||
IniFile compat2;
|
||||
// This one is user-editable. Need to load it after the system one.
|
||||
Path path = GetSysDirectory(DIRECTORY_SYSTEM) / "compatvr.ini";
|
||||
if (compat2.Load(path)) {
|
||||
CheckVRSettings(compat2, gameID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ float ControlMapper::MapAxisValue(float value, int vkId, const InputMapping &map
|
||||
// If a signed axis is mapped to an unsigned mapping,
|
||||
// convert it. This happens when mapping DirectInput triggers to analog speed,
|
||||
// for example.
|
||||
int direction;
|
||||
int direction = 0;
|
||||
if (IsSignedAxis(mapping.Axis(&direction))) {
|
||||
// The value has been split up into two curInput values, so we need to go fetch the other
|
||||
// and put them back together again. Kind of awkward, but at least makes the regular case simple...
|
||||
|
||||
@@ -61,7 +61,7 @@ private:
|
||||
void WriteSfoFile();
|
||||
|
||||
SceUtilityGamedataInstallParam request{};
|
||||
PSPPointer<SceUtilityGamedataInstallParam> param;
|
||||
PSPPointer<SceUtilityGamedataInstallParam> param{};
|
||||
std::vector<std::string> inFileNames;
|
||||
int numFiles = 0;
|
||||
int readFiles = 0;
|
||||
|
||||
@@ -53,7 +53,7 @@ private:
|
||||
void DrawBanner();
|
||||
void DrawIndicator();
|
||||
|
||||
SceUtilityNetconfParam request = {};
|
||||
SceUtilityNetconfParam request{};
|
||||
u32 requestAddr = 0;
|
||||
int connResult = -1;
|
||||
|
||||
|
||||
@@ -39,6 +39,6 @@ protected:
|
||||
return true;
|
||||
}
|
||||
|
||||
int mode;
|
||||
PSPPointer<SceUtilityScreenshotParams> params_;
|
||||
int mode = 0;
|
||||
PSPPointer<SceUtilityScreenshotParams> params_{};
|
||||
};
|
||||
|
||||
@@ -1350,7 +1350,7 @@ skip:
|
||||
for (auto iter = range.first; iter != range.second; ++iter) {
|
||||
AnalyzedFunction &f = *iter->second;
|
||||
if (f.hash == mf->hash && f.size == mf->size) {
|
||||
strncpy(f.name, mf->name, sizeof(mf->name) - 1);
|
||||
truncate_cpy(f.name, mf->name);
|
||||
|
||||
std::string existingLabel = g_symbolMap->GetLabelString(f.start);
|
||||
char defaultLabel[256];
|
||||
|
||||
@@ -1196,7 +1196,7 @@ void FramebufferManagerCommon::DrawPixels(VirtualFramebuffer *vfb, int dstX, int
|
||||
float u0 = 0.0f, u1 = 1.0f;
|
||||
float v0 = 0.0f, v1 = 1.0f;
|
||||
|
||||
DrawTextureFlags flags;
|
||||
DrawTextureFlags flags = DrawTextureFlags::DRAWTEX_DEFAULT;
|
||||
if (useBufferedRendering_ && vfb) {
|
||||
_dbg_assert_(vfb->fbo);
|
||||
if (vfb->fbo) {
|
||||
@@ -2102,10 +2102,10 @@ bool FramebufferManagerCommon::NotifyFramebufferCopy(u32 src, u32 dst, int size,
|
||||
// For now fill in these old variables from the candidates to reduce the initial diff.
|
||||
VirtualFramebuffer *dstBuffer = nullptr;
|
||||
VirtualFramebuffer *srcBuffer = nullptr;
|
||||
int srcY;
|
||||
int srcH;
|
||||
int dstY;
|
||||
int dstH;
|
||||
int srcY = 0;
|
||||
int srcH = 0;
|
||||
int dstY = 0;
|
||||
int dstH = 0;
|
||||
|
||||
const CopyCandidate *bestSrc = GetBestCopyCandidate(srcCandidates, src, channel);
|
||||
if (bestSrc) {
|
||||
|
||||
@@ -211,13 +211,14 @@ enum BindFramebufferColorFlags {
|
||||
};
|
||||
|
||||
enum DrawTextureFlags {
|
||||
DRAWTEX_DEFAULT = 0,
|
||||
DRAWTEX_NEAREST = 0,
|
||||
DRAWTEX_LINEAR = 1,
|
||||
DRAWTEX_TO_BACKBUFFER = 8,
|
||||
DRAWTEX_DEPTH = 16,
|
||||
};
|
||||
|
||||
inline DrawTextureFlags operator | (const DrawTextureFlags &lhs, const DrawTextureFlags &rhs) {
|
||||
inline DrawTextureFlags operator | (DrawTextureFlags lhs, DrawTextureFlags rhs) {
|
||||
return DrawTextureFlags((u32)lhs | (u32)rhs);
|
||||
}
|
||||
|
||||
|
||||
@@ -389,8 +389,11 @@ void LinkedShader::UpdateUniforms(const ShaderID &vsid, bool useBufferedRenderin
|
||||
dirtyUniforms = 0;
|
||||
|
||||
// Analyze scene
|
||||
bool is2D, flatScreen;
|
||||
if (gstate_c.Use(GPU_USE_VIRTUAL_REALITY)) {
|
||||
bool is2D = false, flatScreen = false;
|
||||
|
||||
const bool useVR = gstate_c.Use(GPU_USE_VIRTUAL_REALITY);
|
||||
|
||||
if (useVR) {
|
||||
is2D = Is2DVRObject(gstate.projMatrix, gstate.isModeThrough());
|
||||
flatScreen = IsFlatVRScene();
|
||||
}
|
||||
@@ -410,7 +413,7 @@ void LinkedShader::UpdateUniforms(const ShaderID &vsid, bool useBufferedRenderin
|
||||
}
|
||||
|
||||
// Set HUD mode
|
||||
if (gstate_c.Use(GPU_USE_VIRTUAL_REALITY)) {
|
||||
if (useVR) {
|
||||
if (GuessVRDrawingHUD(is2D, flatScreen)) {
|
||||
float aspect = 480.0f / 272.0f * (IsImmersiveVRMode() ? 0.5f : 1.0f);
|
||||
render_->SetUniformF1(&u_scaleX, g_Config.fHeadUpDisplayScale * aspect);
|
||||
@@ -423,7 +426,7 @@ void LinkedShader::UpdateUniforms(const ShaderID &vsid, bool useBufferedRenderin
|
||||
|
||||
// Update any dirty uniforms before we draw
|
||||
if (dirty & DIRTY_PROJMATRIX) {
|
||||
if (gstate_c.Use(GPU_USE_VIRTUAL_REALITY)) {
|
||||
if (useVR) {
|
||||
Matrix4x4 vrProjection;
|
||||
if (flatScreen || is2D) {
|
||||
memcpy(&vrProjection, gstate.projMatrix, 16 * sizeof(float));
|
||||
@@ -482,7 +485,7 @@ void LinkedShader::UpdateUniforms(const ShaderID &vsid, bool useBufferedRenderin
|
||||
}
|
||||
if (dirty & DIRTY_FOGCOLOR) {
|
||||
SetColorUniform3(render_, &u_fogcolor, gstate.fogcolor);
|
||||
if (gstate_c.Use(GPU_USE_VIRTUAL_REALITY)) {
|
||||
if (useVR) {
|
||||
SetVRCompat(VR_COMPAT_FOG_COLOR, gstate.fogcolor);
|
||||
}
|
||||
}
|
||||
@@ -567,7 +570,7 @@ void LinkedShader::UpdateUniforms(const ShaderID &vsid, bool useBufferedRenderin
|
||||
SetMatrix4x3(render_, &u_world, gstate.worldMatrix);
|
||||
}
|
||||
if (dirty & DIRTY_VIEWMATRIX) {
|
||||
if (gstate_c.Use(GPU_USE_VIRTUAL_REALITY)) {
|
||||
if (useVR) {
|
||||
float leftEyeView[16];
|
||||
float rightEyeView[16];
|
||||
ConvertMatrix4x3To4x4Transposed(leftEyeView, gstate.viewMatrix);
|
||||
|
||||
+3
-4
@@ -44,9 +44,8 @@ void AES_cbc_encrypt(AES_ctx *ctx, const u8 *src, u8 *dst, int size);
|
||||
void AES_cbc_decrypt(AES_ctx *ctx, const u8 *src, u8 *dst, int size);
|
||||
void AES_CMAC(AES_ctx *ctx, const unsigned char *input, int length, unsigned char *mac);
|
||||
|
||||
int rijndaelKeySetupEnc(unsigned int [], const unsigned char [], int);
|
||||
int rijndaelKeySetupDec(unsigned int [], const unsigned char [], int);
|
||||
void rijndaelEncrypt(const unsigned int [], int, const unsigned char [],
|
||||
unsigned char []);
|
||||
int rijndaelKeySetupEnc(u32 [], const u8 [], int);
|
||||
int rijndaelKeySetupDec(u32 [], const u8 [], int);
|
||||
void rijndaelEncrypt(const u32 [], int, const u8 pt[16], u8 ct[16]);
|
||||
|
||||
#endif /* __RIJNDAEL_H */
|
||||
|
||||
Reference in New Issue
Block a user