This commit is contained in:
Nekotekina 2014-03-07 16:04:14 +04:00
commit 3a00ec7682
3 changed files with 61 additions and 12 deletions

View File

@ -3731,7 +3731,7 @@ private:
}
void FSEL(u32 frd, u32 fra, u32 frc, u32 frb, bool rc)
{
CPU.FPR[frd] = CPU.FPR[fra] < 0.0 ? CPU.FPR[frc] : CPU.FPR[frb];
CPU.FPR[frd] = CPU.FPR[fra] >= 0.0 ? CPU.FPR[frc] : CPU.FPR[frb];
if(rc) UNK("fsel.");//CPU.UpdateCR1(CPU.FPR[frd]);
}
void FMUL(u32 frd, u32 fra, u32 frc, bool rc)

View File

@ -163,20 +163,58 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
{
case CELL_PNGDEC_RGB:
case CELL_PNGDEC_RGBA:
image_size *= current_outParam.outputColorSpace == CELL_PNGDEC_RGBA ? 4 : 3;
Memory.CopyFromReal(data.GetAddr(), image.get(), image_size);
{
const char nComponents = (CELL_PNGDEC_RGBA ? 4 : 3);
image_size *= nComponents;
if (dataCtrlParam->outputBytesPerLine > width * nComponents) //check if we need padding
{
//TODO: find out if we can't do padding without an extra copy
char *output = (char *) malloc(dataCtrlParam->outputBytesPerLine*height);
for (int i = 0; i < height; i++)
{
memcpy(&output[i*dataCtrlParam->outputBytesPerLine], &image.get()[width*nComponents*i], width*nComponents);
}
Memory.CopyFromReal(data.GetAddr(), output, dataCtrlParam->outputBytesPerLine*height);
free(output);
}
else
{
Memory.CopyFromReal(data.GetAddr(), image.get(), image_size);
}
}
break;
case CELL_PNGDEC_ARGB:
image_size *= 4;
for(uint i = 0; i < image_size; i+=4)
{
const char nComponents = 4;
image_size *= nComponents;
if (dataCtrlParam->outputBytesPerLine > width * nComponents) //check if we need padding
{
data += image.get()[i+3];
data += image.get()[i+0];
data += image.get()[i+1];
data += image.get()[i+2];
//TODO: find out if we can't do padding without an extra copy
char *output = (char *) malloc(dataCtrlParam->outputBytesPerLine*height);
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width * nComponents; j += nComponents){
output[i*dataCtrlParam->outputBytesPerLine + j ] = image.get()[i*width * nComponents + j + 3];
output[i*dataCtrlParam->outputBytesPerLine + j + 1] = image.get()[i*width * nComponents + j + 0];
output[i*dataCtrlParam->outputBytesPerLine + j + 2] = image.get()[i*width * nComponents + j + 1];
output[i*dataCtrlParam->outputBytesPerLine + j + 3] = image.get()[i*width * nComponents + j + 2];
}
}
Memory.CopyFromReal(data.GetAddr(), output, dataCtrlParam->outputBytesPerLine*height);
free(output);
}
else
{
for (uint i = 0; i < image_size; i += nComponents)
{
data += image.get()[i + 3];
data += image.get()[i + 0];
data += image.get()[i + 1];
data += image.get()[i + 2];
}
}
}
break;
case CELL_PNGDEC_GRAYSCALE:

View File

@ -111,10 +111,16 @@ int sceNpTrophyRegisterContext(u32 context, u32 handle, u32 statusCb_addr, u32 a
return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
if (options & (~(u64)1))
SCE_NP_TROPHY_ERROR_NOT_SUPPORTED;
if (context >= s_npTrophyInstance.contexts.size())
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
// TODO: There are other possible errors
int ret;
sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context];
if (!ctxt.trp_stream)
return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST;
int ret;
TRPLoader trp(*(ctxt.trp_stream));
// TODO: Get the path of the current user
@ -150,11 +156,16 @@ int sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, mem64_t reqspace, u
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
if (!reqspace.IsGood())
return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
if (context >= s_npTrophyInstance.contexts.size())
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
// TODO: There are other possible errors
sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context];
reqspace = ctxt.trp_stream->GetSize(); // TODO: This is not accurate. It's just an approximation of the real value
if (!ctxt.trp_stream)
return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST;
reqspace = ctxt.trp_stream->GetSize(); // TODO: This is not accurate. It's just an approximation of the real value
return CELL_OK;
}