diff --git a/Common/Swap.h b/Common/Swap.h index a94c41cbc..021406e86 100644 --- a/Common/Swap.h +++ b/Common/Swap.h @@ -76,7 +76,7 @@ public: return swap(value); } - swap_struct_t() :value(0) {} + swap_struct_t() : value((T)0) {} swap_struct_t(const T &v): value(swap(v)) {} template diff --git a/Core/Dialog/PSPDialog.h b/Core/Dialog/PSPDialog.h index c24975009..e96eac226 100644 --- a/Core/Dialog/PSPDialog.h +++ b/Core/Dialog/PSPDialog.h @@ -17,8 +17,9 @@ #pragma once -#include "../Globals.h" -#include "../Config.h" +#include "Globals.h" +#include "Common/Common.h" +#include "Core/Config.h" class PointerWrap; diff --git a/Core/Dialog/PSPMsgDialog.cpp b/Core/Dialog/PSPMsgDialog.cpp index fe6793219..4e66d1719 100755 --- a/Core/Dialog/PSPMsgDialog.cpp +++ b/Core/Dialog/PSPMsgDialog.cpp @@ -73,7 +73,7 @@ int PSPMsgDialog::Init(unsigned int paramAddr) unsigned int validOp = SCE_UTILITY_MSGDIALOG_OPTION_TEXT | SCE_UTILITY_MSGDIALOG_OPTION_YESNO | SCE_UTILITY_MSGDIALOG_OPTION_DEFAULT_NO; - if((messageDialog.options | validOp) ^ validOp) + if (((messageDialog.options | validOp) ^ validOp) != 0) { flag |= DS_ERROR; messageDialog.result = SCE_UTILITY_MSGDIALOG_ERROR_BADOPTION; diff --git a/Core/Dialog/PSPOskDialog.h b/Core/Dialog/PSPOskDialog.h index 29d428dd2..a12f54653 100644 --- a/Core/Dialog/PSPOskDialog.h +++ b/Core/Dialog/PSPOskDialog.h @@ -96,7 +96,9 @@ typedef SceUtilityOskState SceUtilityOskState_le; typedef SceUtilityOskInputLanguage SceUtilityOskInputLanguage_le; typedef SceUtilityOskResult SceUtilityOskResult_le; #else -#error FIX ME +typedef swap_struct_t > SceUtilityOskState_le; +typedef swap_struct_t > SceUtilityOskInputLanguage_le; +typedef swap_struct_t > SceUtilityOskResult_le; #endif /** diff --git a/Core/Dialog/PSPSaveDialog.cpp b/Core/Dialog/PSPSaveDialog.cpp index 613e7080e..d47d68a99 100755 --- a/Core/Dialog/PSPSaveDialog.cpp +++ b/Core/Dialog/PSPSaveDialog.cpp @@ -56,10 +56,10 @@ int PSPSaveDialog::Init(int paramAddr) u32 retval = param.SetPspParam(&request); INFO_LOG(HLE,"sceUtilitySavedataInitStart(%08x)", paramAddr); - INFO_LOG(HLE,"Mode: %i", (SceUtilitySavedataType)param.GetPspParam()->mode); + INFO_LOG(HLE,"Mode: %i", (SceUtilitySavedataType)(u32)param.GetPspParam()->mode); yesnoChoice = 1; - switch (param.GetPspParam()->focus) + switch ((SceUtilitySavedataFocus)(u32)param.GetPspParam()->focus) { case SCE_UTILITY_SAVEDATA_FOCUS_NAME: // TODO: This should probably force not using the list? @@ -95,7 +95,7 @@ int PSPSaveDialog::Init(int paramAddr) break; } - switch (param.GetPspParam()->mode) + switch ((SceUtilitySavedataType)(u32)param.GetPspParam()->mode) { case SCE_UTILITY_SAVEDATA_TYPE_LOAD: DEBUG_LOG(HLE, "Loading. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetSaveName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); @@ -164,7 +164,7 @@ int PSPSaveDialog::Init(int paramAddr) break; default: { - ERROR_LOG_REPORT(HLE, "Load/Save function %d not coded. Title: %s Save: %s File: %s", (SceUtilitySavedataType)param.GetPspParam()->mode, param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); + ERROR_LOG_REPORT(HLE, "Load/Save function %d not coded. Title: %s Save: %s File: %s", (SceUtilitySavedataType)(u32)param.GetPspParam()->mode, param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); param.GetPspParam()->common.result = 0; status = SCE_UTILITY_STATUS_INITIALIZE; display = DS_NONE; @@ -214,7 +214,7 @@ int PSPSaveDialog::Init(int paramAddr) const std::string PSPSaveDialog::GetSelectedSaveDirName() { - switch (param.GetPspParam()->mode) + switch ((SceUtilitySavedataType)(u32)param.GetPspParam()->mode) { case SCE_UTILITY_SAVEDATA_TYPE_LOAD: case SCE_UTILITY_SAVEDATA_TYPE_AUTOLOAD: @@ -879,7 +879,7 @@ int PSPSaveDialog::Update() case DS_NONE: // For action which display nothing { - switch (param.GetPspParam()->mode) + switch ((SceUtilitySavedataType)(u32)param.GetPspParam()->mode) { case SCE_UTILITY_SAVEDATA_TYPE_LOAD: // Only load and exit case SCE_UTILITY_SAVEDATA_TYPE_AUTOLOAD: diff --git a/Core/Dialog/SavedataParam.h b/Core/Dialog/SavedataParam.h index 2a7431499..07c579831 100644 --- a/Core/Dialog/SavedataParam.h +++ b/Core/Dialog/SavedataParam.h @@ -71,7 +71,8 @@ enum SceUtilitySavedataFocus typedef SceUtilitySavedataType SceUtilitySavedataType_le; typedef SceUtilitySavedataFocus SceUtilitySavedataFocus_le; #else -#error FIX ME +typedef swap_struct_t > SceUtilitySavedataType_le; +typedef swap_struct_t > SceUtilitySavedataFocus_le; #endif typedef char SceUtilitySavedataSaveName[20]; diff --git a/Core/ELF/ElfReader.h b/Core/ELF/ElfReader.h index 60fc87bc8..1064c84d1 100644 --- a/Core/ELF/ElfReader.h +++ b/Core/ELF/ElfReader.h @@ -73,8 +73,8 @@ public: } // Quick accessors - ElfType GetType() { return (ElfType)(header->e_type); } - ElfMachine GetMachine() { return (ElfMachine)(header->e_machine); } + ElfType GetType() { return (ElfType)(u16)(header->e_type); } + ElfMachine GetMachine() { return (ElfMachine)(u16)(header->e_machine); } u32 GetEntryPoint() { return entryPoint; } u32 GetFlags() { return (u32)(header->e_flags); } diff --git a/Core/ELF/ElfTypes.h b/Core/ELF/ElfTypes.h index f2c7b665e..afedcd925 100644 --- a/Core/ELF/ElfTypes.h +++ b/Core/ELF/ElfTypes.h @@ -15,7 +15,9 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#pragma once +#pragma once + +#include "Common/Common.h" /////////////////////// // ELF Header Constants @@ -283,7 +285,7 @@ struct Elf32_Rela #define ELF32_R_TYPE(i) ((unsigned char)(i)) #define ELF32_R_INFO(s,t) (((s)<<8 )+(unsigned char)(t)) - +/* struct Elf32_Dyn { Elf32_Sword d_tag; @@ -293,3 +295,4 @@ struct Elf32_Dyn Elf32_Addr d_ptr; } d_un; }; +*/ diff --git a/Core/ELF/PBPReader.h b/Core/ELF/PBPReader.h index 426f7adb8..e415c851c 100644 --- a/Core/ELF/PBPReader.h +++ b/Core/ELF/PBPReader.h @@ -18,7 +18,7 @@ #pragma once -#include "Common/CommonTypes.h" +#include "Common/Common.h" enum PBPSubFile { PBP_PARAM_SFO, diff --git a/Core/Font/PGF.cpp b/Core/Font/PGF.cpp index 44b20f383..dbfd8d611 100644 --- a/Core/Font/PGF.cpp +++ b/Core/Font/PGF.cpp @@ -280,16 +280,16 @@ void PGF::GetFontInfo(PGFFontInfo *fi) { fi->maxGlyphTopYI = header.maxTopYAdjust; fi->maxGlyphAdvanceXI = header.maxAdvance[0]; fi->maxGlyphAdvanceYI = header.maxAdvance[1]; - fi->maxGlyphWidthF = header.maxSize[0] / 64.0f; - fi->maxGlyphHeightF = header.maxSize[1] / 64.0f; - fi->maxGlyphAscenderF = header.maxAscender / 64.0f; - fi->maxGlyphDescenderF = header.maxDescender / 64.0f; - fi->maxGlyphLeftXF = header.maxLeftXAdjust / 64.0f; - fi->maxGlyphBaseYF = header.maxBaseYAdjust / 64.0f; - fi->minGlyphCenterXF = header.minCenterXAdjust / 64.0f; - fi->maxGlyphTopYF = header.maxTopYAdjust / 64.0f; - fi->maxGlyphAdvanceXF = header.maxAdvance[0] / 64.0f; - fi->maxGlyphAdvanceYF = header.maxAdvance[1] / 64.0f; + fi->maxGlyphWidthF = (float)header.maxSize[0] / 64.0f; + fi->maxGlyphHeightF = (float)header.maxSize[1] / 64.0f; + fi->maxGlyphAscenderF = (float)header.maxAscender / 64.0f; + fi->maxGlyphDescenderF = (float)header.maxDescender / 64.0f; + fi->maxGlyphLeftXF = (float)header.maxLeftXAdjust / 64.0f; + fi->maxGlyphBaseYF = (float)header.maxBaseYAdjust / 64.0f; + fi->minGlyphCenterXF = (float)header.minCenterXAdjust / 64.0f; + fi->maxGlyphTopYF = (float)header.maxTopYAdjust / 64.0f; + fi->maxGlyphAdvanceXF = (float)header.maxAdvance[0] / 64.0f; + fi->maxGlyphAdvanceYF = (float)header.maxAdvance[1] / 64.0f; fi->maxGlyphWidth = header.maxGlyphWidth; fi->maxGlyphHeight = header.maxGlyphHeight; @@ -474,7 +474,7 @@ void PGF::DrawCharacter(const GlyphImage *image, int clipX, int clipY, int clipW if (pixelX >= clipX && pixelX < clipX + clipWidth && pixelY >= clipY && pixelY < clipY + clipHeight) { // 4-bit color value int pixelColor = value; - switch (image->pixelFormat) { + switch ((FontPixelFormat)(u32)image->pixelFormat) { case PSP_FONT_PIXELFORMAT_8: // 8-bit color value pixelColor |= pixelColor << 4; @@ -495,7 +495,7 @@ void PGF::DrawCharacter(const GlyphImage *image, int clipX, int clipY, int clipW case PSP_FONT_PIXELFORMAT_4_REV: break; default: - ERROR_LOG_REPORT(HLE, "Unhandled font pixel format: %d", image->pixelFormat); + ERROR_LOG_REPORT(HLE, "Unhandled font pixel format: %d", (u32)image->pixelFormat); break; } diff --git a/Core/Font/PGF.h b/Core/Font/PGF.h index b9c18972e..2e5706c65 100644 --- a/Core/Font/PGF.h +++ b/Core/Font/PGF.h @@ -112,7 +112,7 @@ struct Glyph { #if COMMON_LITTLE_ENDIAN typedef FontPixelFormat FontPixelFormat_le; #else -#error FIX ME +typedef swap_struct_t > FontPixelFormat_le; #endif struct GlyphImage { diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index d1fc3b386..251933308 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -130,10 +130,10 @@ public: Font(const u8 *data, size_t dataSize) { pgf_.ReadPtr(data, dataSize); - style_.fontH = pgf_.header.hSize / 64.0f; - style_.fontV = pgf_.header.vSize / 64.0f; - style_.fontHRes = pgf_.header.hResolution / 64.0f; - style_.fontVRes = pgf_.header.vResolution / 64.0f; + style_.fontH = (float)pgf_.header.hSize / 64.0f; + style_.fontV = (float)pgf_.header.vSize / 64.0f; + style_.fontHRes = (float)pgf_.header.hResolution / 64.0f; + style_.fontVRes = (float)pgf_.header.vResolution / 64.0f; } Font(const u8 *data, size_t dataSize, const FontRegistryEntry &entry) { diff --git a/Core/HLE/sceKernelEventFlag.cpp b/Core/HLE/sceKernelEventFlag.cpp index 09f2f4bfc..9c91ef815 100644 --- a/Core/HLE/sceKernelEventFlag.cpp +++ b/Core/HLE/sceKernelEventFlag.cpp @@ -129,7 +129,7 @@ KernelObject *__KernelEventFlagObject() return new EventFlag; } -bool __KernelEventFlagMatches(u32 *pattern, u32 bits, u8 wait, u32 outAddr) +bool __KernelEventFlagMatches(u32_le *pattern, u32 bits, u8 wait, u32 outAddr) { if ((wait & PSP_EVENT_WAITOR) ? (bits & *pattern) /* one or more bits of the mask */ diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 43927638c..08109bc0d 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -153,7 +153,7 @@ public: #if COMMON_LITTLE_ENDIAN typedef WaitType WaitType_le; #else -#error FIX ME +typedef swap_struct_t > WaitType_le; #endif // Real PSP struct, don't change the fields @@ -1865,7 +1865,9 @@ Thread *__KernelCreateThread(SceUID &id, SceUID moduleId, const char *name, u32 strncpy(t->nt.name, name, KERNELOBJECT_MAX_NAME_LENGTH); t->nt.name[KERNELOBJECT_MAX_NAME_LENGTH] = '\0'; - t->AllocateStack(t->nt.stackSize); // can change the stacksize! + u32 stackSize = t->nt.stackSize; + t->AllocateStack(stackSize); // can change the stacksize! + t->nt.stackSize = stackSize; return t; } diff --git a/Core/HLE/sceKernelVTimer.cpp b/Core/HLE/sceKernelVTimer.cpp index e58376eb1..d30cea77a 100644 --- a/Core/HLE/sceKernelVTimer.cpp +++ b/Core/HLE/sceKernelVTimer.cpp @@ -60,7 +60,7 @@ KernelObject *__KernelVTimerObject() { } u64 __getVTimerRunningTime(VTimer *vt) { - if (!vt->nvt.active) + if (vt->nvt.active == 0) return 0; return cyclesToUs(CoreTiming::GetTicks()) - vt->nvt.base; @@ -89,7 +89,7 @@ void __KernelScheduleVTimer(VTimer *vt, u64 schedule) { vt->nvt.schedule = schedule; if (vt->nvt.active == 1 && vt->nvt.handlerAddr != 0) - CoreTiming::ScheduleEvent(usToCycles(vt->nvt.schedule), vtimerTimer, vt->GetUID()); + CoreTiming::ScheduleEvent(usToCycles((u64)vt->nvt.schedule), vtimerTimer, vt->GetUID()); } void __rescheduleVTimer(SceUID id, int delay) { @@ -345,7 +345,7 @@ u32 sceKernelStartVTimer(u32 uid) { VTimer *vt = kernelObjects.Get(uid, error); if (vt) { - if (vt->nvt.active) + if (vt->nvt.active != 0) return 1; __startVTimer(vt); diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index 3935e02c1..7d5670114 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -85,7 +85,7 @@ static const int TPSM_PIXEL_STORAGE_MODE_16BIT_BGR5650 = 0X00; static const int TPSM_PIXEL_STORAGE_MODE_32BIT_ABGR8888 = 0X03; int getMaxAheadTimestamp(const SceMpegRingBuffer &ringbuf) { - return std::max(40000, ringbuf.packets * 700); // empiric value from JPCSP, thanks! + return std::max(40000, 700 * ringbuf.packets); // empiric value from JPCSP, thanks! } const u8 defaultMpegheader[2048] = {0x50,0x53,0x4d,0x46,0x30,0x30,0x31,0x35,0x00,0x00,0x08,0x00,0x00, @@ -947,7 +947,7 @@ u32 sceMpegRingbufferPut(u32 ringbufferAddr, u32 numPackets, u32 available) } // Execute callback function as a direct MipsCall, no blocking here so no messing around with wait states etc - if (ringbuffer.callback_addr) { + if (ringbuffer.callback_addr != 0) { PostPutAction *action = (PostPutAction *)__KernelCreateAction(actionPostPut); action->setRingAddr(ringbufferAddr); // TODO: Should call this multiple times until we get numPackets. diff --git a/Core/HLE/sceRtc.cpp b/Core/HLE/sceRtc.cpp index 29d0bc1e0..745dd660f 100644 --- a/Core/HLE/sceRtc.cpp +++ b/Core/HLE/sceRtc.cpp @@ -478,7 +478,7 @@ int sceRtcCheckValid(u32 datePtr) { return PSP_TIME_INVALID_SECONDS; } - else if (pt.microsecond >= 1000000) + else if (pt.microsecond >= 1000000UL) { return PSP_TIME_INVALID_MICROSECONDS; }