mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #5231 from unknownbrackets/swap
Merge just some endian / swap related fixes
This commit is contained in:
commit
cc4882267a
12 changed files with 83 additions and 68 deletions
|
@ -438,6 +438,13 @@ public:
|
|||
|
||||
void Do(tm &t);
|
||||
|
||||
template<typename T, typename F>
|
||||
void Do(swap_struct_t<T, F> &x) {
|
||||
T v = x.swap();
|
||||
Do(v);
|
||||
x = v;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void DoClass(T &x) {
|
||||
x.DoState(*this);
|
||||
|
|
|
@ -245,6 +245,14 @@ public:
|
|||
return !swap();
|
||||
}
|
||||
|
||||
bool operator ||(const swapped_t & b) const {
|
||||
return swap() || b.swap();
|
||||
}
|
||||
template <typename S>
|
||||
bool operator ||(const S & b) const {
|
||||
return swap() || b;
|
||||
}
|
||||
|
||||
// bitmath
|
||||
swapped_t operator ~() const {
|
||||
return ~swap();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
struct SceUtilityGamedataInstallParam {
|
||||
pspUtilityDialogCommon common;
|
||||
u32 unknown1;
|
||||
u32_le unknown1;
|
||||
char gameName[13];
|
||||
char ignore1[3];
|
||||
char dataName[20];
|
||||
|
@ -32,8 +32,8 @@ struct SceUtilityGamedataInstallParam {
|
|||
u8 unknown2;
|
||||
char ignore2[3];
|
||||
char progress[4]; // This is progress value,should be updated.
|
||||
u32 unknownResult1;
|
||||
u32 unknownResult2;
|
||||
u32_le unknownResult1;
|
||||
u32_le unknownResult2;
|
||||
char ignore3[48];
|
||||
};
|
||||
|
||||
|
|
|
@ -331,7 +331,7 @@ bool PGF::GetCharInfo(int charCode, PGFCharInfo *charInfo, int altCharCode) {
|
|||
charInfo->sfp26Height = glyph.dimensionHeight;
|
||||
charInfo->sfp26Ascender = glyph.yAdjustH;
|
||||
// Font y goes upwards. If top is 10 and height is 11, the descender is approx. -1 (below 0.)
|
||||
charInfo->sfp26Descender = charInfo->sfp26Ascender - charInfo->sfp26Height;
|
||||
charInfo->sfp26Descender = charInfo->sfp26Ascender - (s32_le)charInfo->sfp26Height;
|
||||
charInfo->sfp26BearingHX = glyph.xAdjustH;
|
||||
charInfo->sfp26BearingHY = glyph.yAdjustH;
|
||||
charInfo->sfp26BearingVX = glyph.xAdjustV;
|
||||
|
|
|
@ -28,30 +28,30 @@ void __AtracShutdown();
|
|||
|
||||
typedef struct
|
||||
{
|
||||
u32 decodePos; // 0
|
||||
u32 endSample; // 4
|
||||
u32 loopStart; // 8
|
||||
u32 loopEnd; // 12
|
||||
int samplesPerChan; // 16
|
||||
u32_le decodePos; // 0
|
||||
u32_le endSample; // 4
|
||||
u32_le loopStart; // 8
|
||||
u32_le loopEnd; // 12
|
||||
s32_le samplesPerChan; // 16
|
||||
char numFrame; // 20
|
||||
// 2: all the stream data on the buffer
|
||||
// 6: looping -> second buffer needed
|
||||
char state; // 21
|
||||
char unk22;
|
||||
char numChan; // 23
|
||||
u16 sampleSize; // 24
|
||||
u16 codec; // 26
|
||||
u32 dataOff; // 28
|
||||
u32 curOff; // 32
|
||||
u32 dataEnd; // 36
|
||||
int loopNum; // 40
|
||||
u32 streamDataByte; // 44
|
||||
u32 unk48;
|
||||
u32 unk52;
|
||||
u32 buffer; // 56
|
||||
u32 secondBuffer; // 60
|
||||
u32 bufferByte; // 64
|
||||
u32 secondBufferByte; // 68
|
||||
u16_le sampleSize; // 24
|
||||
u16_le codec; // 26
|
||||
u32_le dataOff; // 28
|
||||
u32_le curOff; // 32
|
||||
u32_le dataEnd; // 36
|
||||
s32_le loopNum; // 40
|
||||
u32_le streamDataByte; // 44
|
||||
u32_le unk48;
|
||||
u32_le unk52;
|
||||
u32_le buffer; // 56
|
||||
u32_le secondBuffer; // 60
|
||||
u32_le bufferByte; // 64
|
||||
u32_le secondBufferByte; // 68
|
||||
// make sure the size is 128
|
||||
u8 unk[56];
|
||||
} SceAtracIdInfo;
|
||||
|
|
|
@ -19,16 +19,16 @@
|
|||
|
||||
typedef struct
|
||||
{
|
||||
s32 unk0;
|
||||
s32 unk4;
|
||||
s32 err; // 8
|
||||
s32 edramAddr; // 12
|
||||
s32 neededMem; // 16
|
||||
s32 unk20;
|
||||
u32 inBuf; // 24
|
||||
s32 unk28;
|
||||
u32 outBuf; // 32
|
||||
s32 unk36;
|
||||
s32_le unk0;
|
||||
s32_le unk4;
|
||||
s32_le err; // 8
|
||||
s32_le edramAddr; // 12
|
||||
s32_le neededMem; // 16
|
||||
s32_le unk20;
|
||||
u32_le inBuf; // 24
|
||||
s32_le unk28;
|
||||
u32_le outBuf; // 32
|
||||
s32_le unk36;
|
||||
s8 unk40;
|
||||
s8 unk41;
|
||||
s8 unk42;
|
||||
|
@ -37,21 +37,21 @@ typedef struct
|
|||
s8 unk45;
|
||||
s8 unk46;
|
||||
s8 unk47;
|
||||
s32 unk48;
|
||||
s32 unk52;
|
||||
s32 unk56;
|
||||
s32 unk60;
|
||||
s32 unk64;
|
||||
s32 unk68;
|
||||
s32 unk72;
|
||||
s32 unk76;
|
||||
s32 unk80;
|
||||
s32 unk84;
|
||||
s32 unk88;
|
||||
s32 unk92;
|
||||
s32 unk96;
|
||||
s32 unk100;
|
||||
u32 allocMem; // 104
|
||||
s32_le unk48;
|
||||
s32_le unk52;
|
||||
s32_le unk56;
|
||||
s32_le unk60;
|
||||
s32_le unk64;
|
||||
s32_le unk68;
|
||||
s32_le unk72;
|
||||
s32_le unk76;
|
||||
s32_le unk80;
|
||||
s32_le unk84;
|
||||
s32_le unk88;
|
||||
s32_le unk92;
|
||||
s32_le unk96;
|
||||
s32_le unk100;
|
||||
u32_le allocMem; // 104
|
||||
// make sure the size is 128
|
||||
u8 unk[20];
|
||||
} SceAudiocodecCodec;
|
||||
|
|
|
@ -2189,7 +2189,7 @@ u32 sceIoIoctlAsync(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u
|
|||
u32 sceIoGetFdList(u32 outAddr, int outSize, u32 fdNumAddr) {
|
||||
WARN_LOG(SCEIO, "sceIoGetFdList(%08x, %i, %08x)", outAddr, outSize, fdNumAddr);
|
||||
|
||||
auto out = PSPPointer<SceUID>::Create(outAddr);
|
||||
auto out = PSPPointer<SceUID_le>::Create(outAddr);
|
||||
int count = 0;
|
||||
|
||||
// Always have the first three.
|
||||
|
|
|
@ -613,13 +613,13 @@ KernelObject *KernelObjectPool::CreateByIDType(int type)
|
|||
}
|
||||
|
||||
struct SystemStatus {
|
||||
SceSize size;
|
||||
SceUInt status;
|
||||
SceUInt clockPart1;
|
||||
SceUInt clockPart2;
|
||||
SceUInt perfcounter1;
|
||||
SceUInt perfcounter2;
|
||||
SceUInt perfcounter3;
|
||||
SceSize_le size;
|
||||
SceUInt_le status;
|
||||
SceUInt_le clockPart1;
|
||||
SceUInt_le clockPart2;
|
||||
SceUInt_le perfcounter1;
|
||||
SceUInt_le perfcounter2;
|
||||
SceUInt_le perfcounter3;
|
||||
};
|
||||
|
||||
int sceKernelReferSystemStatus(u32 statusPtr) {
|
||||
|
|
|
@ -1056,7 +1056,7 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
|||
continue;
|
||||
}
|
||||
|
||||
u32_le variableCount = ent->size <= 4 ? ent->vcount : std::max((u32)ent->vcount , (u32)ent->vcountNew);
|
||||
u32 variableCount = ent->size <= 4 ? ent->vcount : std::max((u32)ent->vcount , (u32)ent->vcountNew);
|
||||
const char *name;
|
||||
if (Memory::IsValidAddress(ent->name)) {
|
||||
name = Memory::GetCharPointer(ent->name);
|
||||
|
|
|
@ -1083,7 +1083,8 @@ bool __KernelCheckResumeThreadEnd(Thread *t, SceUID waitingThreadID, u32 &error,
|
|||
s64 cyclesLeft = CoreTiming::UnscheduleEvent(eventThreadEndTimeout, waitingThreadID);
|
||||
if (timeoutPtr != 0)
|
||||
Memory::Write_U32((u32) cyclesToUs(cyclesLeft), timeoutPtr);
|
||||
__KernelResumeThreadFromWait(waitingThreadID, t->nt.exitStatus);
|
||||
s32 exitStatus = t->nt.exitStatus;
|
||||
__KernelResumeThreadFromWait(waitingThreadID, exitStatus);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3325,7 +3326,7 @@ void __KernelCallAddress(Thread *thread, u32 entryPoint, Action *afterAction, co
|
|||
after->chainedAction = afterAction;
|
||||
after->threadID = thread->GetUID();
|
||||
after->status = thread->nt.status;
|
||||
after->waitType = thread->nt.waitType;
|
||||
after->waitType = (WaitType)(u32)thread->nt.waitType;
|
||||
after->waitID = thread->nt.waitID;
|
||||
after->waitInfo = thread->waitInfo;
|
||||
after->isProcessingCallbacks = thread->isProcessingCallbacks;
|
||||
|
@ -3702,7 +3703,7 @@ std::vector<DebugThreadInfo> GetThreadsInfo()
|
|||
info.initialStack = t->nt.initialStack;
|
||||
info.stackSize = (u32)t->nt.stackSize;
|
||||
info.priority = t->nt.currentPriority;
|
||||
info.waitType = t->nt.waitType;
|
||||
info.waitType = (WaitType)(u32)t->nt.waitType;
|
||||
if(*iter == currentThread)
|
||||
info.curPC = currentMIPS->pc;
|
||||
else
|
||||
|
|
|
@ -337,7 +337,7 @@ int MediaEngine::addStreamData(u8* buffer, int addSize) {
|
|||
#ifdef USE_FFMPEG
|
||||
if (!m_pFormatCtx && m_pdata->getQueueSize() >= 2048) {
|
||||
m_pdata->get_front(m_mpegheader, sizeof(m_mpegheader));
|
||||
int mpegoffset = bswap32(*(int*)(m_mpegheader + 8));
|
||||
int mpegoffset = (int)(*(s32_be*)(m_mpegheader + 8));
|
||||
m_pdata->pop_front(0, mpegoffset);
|
||||
openContext();
|
||||
}
|
||||
|
@ -504,11 +504,10 @@ bool MediaEngine::stepVideo(int videoPixelMode) {
|
|||
|
||||
// Helpers that null out alpha (which seems to be the case on the PSP.)
|
||||
// Some games depend on this, for example Sword Art Online (doesn't clear A's from buffer.)
|
||||
|
||||
inline void writeVideoLineRGBA(void *destp, const void *srcp, int width) {
|
||||
// TODO: Use SSE/NEON, investigate why AV_PIX_FMT_RGB0 does not work.
|
||||
u32 *dest = (u32 *)destp;
|
||||
const u32 *src = (u32 *)srcp;
|
||||
u32_le *dest = (u32_le *)destp;
|
||||
const u32_le *src = (u32_le *)srcp;
|
||||
|
||||
u32 mask = 0x00FFFFFF;
|
||||
for (int i = 0; i < width; ++i) {
|
||||
|
@ -522,8 +521,8 @@ inline void writeVideoLineABGR5650(void *destp, const void *srcp, int width) {
|
|||
|
||||
inline void writeVideoLineABGR5551(void *destp, const void *srcp, int width) {
|
||||
// TODO: Use SSE/NEON.
|
||||
u16 *dest = (u16 *)destp;
|
||||
const u16 *src = (u16 *)srcp;
|
||||
u16_le *dest = (u16_le *)destp;
|
||||
const u16_le *src = (u16_le *)srcp;
|
||||
|
||||
u16 mask = 0x7FFF;
|
||||
for (int i = 0; i < width; ++i) {
|
||||
|
@ -533,8 +532,8 @@ inline void writeVideoLineABGR5551(void *destp, const void *srcp, int width) {
|
|||
|
||||
inline void writeVideoLineABGR4444(void *destp, const void *srcp, int width) {
|
||||
// TODO: Use SSE/NEON.
|
||||
u16 *dest = (u16 *)destp;
|
||||
const u16 *src = (u16 *)srcp;
|
||||
u16_le *dest = (u16_le *)destp;
|
||||
const u16_le *src = (u16_le *)srcp;
|
||||
|
||||
u16 mask = 0x0FFF;
|
||||
for (int i = 0; i < width; ++i) {
|
||||
|
|
|
@ -186,7 +186,7 @@ void GPUgstate::Save(u32_le *ptr) {
|
|||
}
|
||||
|
||||
void GPUgstate::FastLoadBoneMatrix(u32 addr) {
|
||||
const u32 *src = (const u32 *)Memory::GetPointerUnchecked(addr);
|
||||
const u32_le *src = (const u32_le *)Memory::GetPointerUnchecked(addr);
|
||||
u32 num = boneMatrixNumber;
|
||||
u32 *dst = (u32 *)(boneMatrix + (num & 0x7F));
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue