Misc cleanup

This commit is contained in:
raven02 2014-08-09 16:27:59 +08:00
parent ae96537b8d
commit 1521eea324
4 changed files with 119 additions and 124 deletions

View File

@ -512,8 +512,8 @@ bool adecCheckType(AudioCodecType type)
{
switch (type)
{
case CELL_ADEC_TYPE_ATRACX: LOG_NOTICE(HLE, "*** (?) type: ATRAC3plus"); break;
case CELL_ADEC_TYPE_ATRACX_2CH: LOG_NOTICE(HLE, "*** type: ATRAC3plus 2ch"); break;
case CELL_ADEC_TYPE_ATRACX: LOG_NOTICE(HLE, "adecCheckType: ATRAC3plus"); break;
case CELL_ADEC_TYPE_ATRACX_2CH: LOG_NOTICE(HLE, "adecCheckType: ATRAC3plus 2ch"); break;
case CELL_ADEC_TYPE_ATRACX_6CH:
case CELL_ADEC_TYPE_ATRACX_8CH:

View File

@ -5,11 +5,8 @@
#include "Emu/SysCalls/Modules.h"
#include "cellPamf.h"
//void cellPamf_init();
//Module cellPamf(0x0012, cellPamf_init);
Module *cellPamf = nullptr;
int pamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t<CellCodecEsFilterId> pEsFilterId)
{
//TODO: convert type and ch to EsFilterId
@ -42,7 +39,7 @@ int pamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t<CellCodecEsFilterId> pE
pEsFilterId->supplementalInfo2 = 0;
}
else
cellPamf->Error("*** TODO: pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_ATRAC3PLUS (ch=%d)", ch);
cellPamf->Todo("pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_ATRAC3PLUS (ch=%d)", ch);
break;
case CELL_PAMF_STREAM_TYPE_PAMF_LPCM:
if (ch == 0)
@ -53,7 +50,7 @@ int pamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t<CellCodecEsFilterId> pE
pEsFilterId->supplementalInfo2 = 0;
}
else
cellPamf->Error("*** TODO: pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_LPCM (ch=%d)", ch);
cellPamf->Todo("pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_LPCM (ch=%d)", ch);
break;
case CELL_PAMF_STREAM_TYPE_USER_DATA:
if (ch == 0)
@ -64,13 +61,13 @@ int pamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t<CellCodecEsFilterId> pE
pEsFilterId->supplementalInfo2 = 0;
}
else
cellPamf->Error("*** TODO: pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_USER_DATA (ch=%d)", ch);
cellPamf->Todo("pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_USER_DATA (ch=%d)", ch);
break;
case CELL_PAMF_STREAM_TYPE_AC3:
cellPamf->Error("*** TODO: pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_AC3 (ch=%d)", ch);
cellPamf->Todo("pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_AC3 (ch=%d)", ch);
break;
case CELL_PAMF_STREAM_TYPE_M2V:
cellPamf->Error("*** TODO: pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_M2V (ch=%d)", ch);
cellPamf->Todo("pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_M2V (ch=%d)", ch);
break;
default:
return CELL_PAMF_ERROR_INVALID_ARG;
@ -90,7 +87,7 @@ u8 pamfGetStreamType(mem_ptr_t<CellPamfReader> pSelf, u8 stream)
case 0x80: return CELL_PAMF_STREAM_TYPE_PAMF_LPCM;
case 0xdd: return CELL_PAMF_STREAM_TYPE_USER_DATA;
default:
cellPamf->Error("*** TODO: pamfGetStreamType: unsupported stream type found(0x%x)", pAddr->stream_headers[stream].type);
cellPamf->Todo("pamfGetStreamType: unsupported stream type found(0x%x)", pAddr->stream_headers[stream].type);
return 0;
}
}
@ -113,16 +110,16 @@ u8 pamfGetStreamChannel(mem_ptr_t<CellPamfReader> pSelf, u8 stream)
return 0;
}
case 0xdc:
cellPamf->Error("*** TODO: pamfGetStreamChannel: CELL_PAMF_STREAM_TYPE_ATRAC3PLUS");
cellPamf->Todo("pamfGetStreamChannel: CELL_PAMF_STREAM_TYPE_ATRAC3PLUS");
return 0;
case 0x80:
cellPamf->Error("*** TODO: pamfGetStreamChannel: CELL_PAMF_STREAM_TYPE_PAMF_LPCM");
cellPamf->Todo("pamfGetStreamChannel: CELL_PAMF_STREAM_TYPE_PAMF_LPCM");
return 0;
case 0xdd:
cellPamf->Error("*** TODO: pamfGetStreamChannel: CELL_PAMF_STREAM_TYPE_USER_DATA");
cellPamf->Todo("pamfGetStreamChannel: CELL_PAMF_STREAM_TYPE_USER_DATA");
return 0;
default:
cellPamf->Error("*** TODO: pamfGetStreamType: unsupported stream type found(0x%x)", pAddr->stream_headers[stream].type);
cellPamf->Todo("pamfGetStreamType: unsupported stream type found(0x%x)", pAddr->stream_headers[stream].type);
return 0;
}

View File

@ -6,117 +6,13 @@
#include "cellSysutil.h"
#include "cellResc.h"
//void cellResc_init();
//void cellResc_load();
//void cellResc_unload();
//Module cellResc(0x001f, cellResc_init, cellResc_load, cellResc_unload);
Module *cellResc = nullptr;
// Error Codes
enum
{
CELL_RESC_ERROR_NOT_INITIALIZED = 0x80210301,
CELL_RESC_ERROR_REINITIALIZED = 0x80210302,
CELL_RESC_ERROR_BAD_ALIGNMENT = 0x80210303,
CELL_RESC_ERROR_BAD_ARGUMENT = 0x80210304,
CELL_RESC_ERROR_LESS_MEMORY = 0x80210305,
CELL_RESC_ERROR_GCM_FLIP_QUE_FULL = 0x80210306,
CELL_RESC_ERROR_BAD_COMBINATION = 0x80210307,
};
enum
{
COLOR_BUFFER_ALIGNMENT = 128,
VERTEX_BUFFER_ALIGNMENT = 4,
FRAGMENT_SHADER_ALIGNMENT = 64,
VERTEX_NUMBER_NORMAL = 4,
SRC_BUFFER_NUM = 8,
MAX_DST_BUFFER_NUM = 6,
RESC_PARAM_NUM
};
static const float
PICTURE_SIZE = (1.0f),
UV_DELTA_PS = (1.f / 8.f),
UV_DELTA_LB = (1.f / 6.f),
XY_DELTA_LB = (1.f / 8.f);
struct RescVertex_t
{
be_t<float> Px, Py;
be_t<float> u, v;
be_t<float> u2, v2;
};
// Defines
#define roundup(x,a) (((x)+(a)-1)&(~((a)-1)))
#define SEVIRITY 80.f
struct CCellRescInternal
{
CellRescInitConfig m_initConfig;
CellRescSrc m_rescSrc[SRC_BUFFER_NUM];
u32 m_dstMode;
CellRescDsts m_rescDsts[4], *m_pRescDsts;
CellRescTableElement m_interlaceElement;
u32 m_colorBuffersEA, m_vertexArrayEA, m_fragmentUcodeEA;
u32 m_bufIdFront;
s32 m_dstWidth, m_dstHeight, m_dstPitch;
u16 m_srcWidthInterlace, m_srcHeightInterlace;
u32 m_dstBufInterval, m_dstOffsets[MAX_DST_BUFFER_NUM];
s32 m_nVertex;
u32 m_bufIdFrontPrevDrop, m_bufIdPalMidPrev, m_bufIdPalMidNow;
u32 m_interlaceTableEA;
int m_interlaceTableLength;
float m_ratioAdjX, m_ratioAdjY, m_flexRatio;
bool m_bInitialized, m_bNewlyAdjustRatio;
bool m_isDummyFlipped;
u8 m_cgParamIndex[RESC_PARAM_NUM];
u64 m_commandIdxCaF, m_rcvdCmdIdx;
u32 s_applicationFlipHandler;
u32 s_applicationVBlankHandler;
CCellRescInternal()
: m_bInitialized(false)
{
}
};
CCellRescInternal* s_rescInternalInstance = nullptr;
// Extern Functions
extern int cellGcmSetFlipMode(u32 mode);
extern void cellGcmSetFlipHandler(u32 handler_addr);
extern void cellGcmSetVBlankHandler(u32 handler_addr);
extern int cellGcmAddressToOffset(u64 address, mem32_t offset);
extern int cellGcmSetDisplayBuffer(u32 id, u32 offset, u32 pitch, u32 width, u32 height);
extern int cellGcmSetPrepareFlip(mem_ptr_t<CellGcmContextData> ctx, u32 id);
extern int cellGcmSetSecondVFrequency(u32 freq);
extern u32 cellGcmGetLabelAddress(u8 index);
extern u32 cellGcmGetTiledPitchSize(u32 size);
// Local Functions
int cellRescGetNumColorBuffers(u32 dstMode, u32 palTemporalMode, u32 reserved);
// Help Functions
inline bool IsPal() { return s_rescInternalInstance->m_dstMode == CELL_RESC_720x576; }
inline bool IsPal60Hsync() { return (IsPal() && s_rescInternalInstance->m_initConfig.palTemporalMode == CELL_RESC_PAL_60_FOR_HSYNC); }
inline bool IsPalDrop() { return (IsPal() && s_rescInternalInstance->m_initConfig.palTemporalMode == CELL_RESC_PAL_60_DROP); }
inline bool IsPalInterpolate() { return (IsPal() && ((s_rescInternalInstance->m_initConfig.palTemporalMode == CELL_RESC_PAL_60_INTERPOLATE)
|| (s_rescInternalInstance->m_initConfig.palTemporalMode == CELL_RESC_PAL_60_INTERPOLATE_30_DROP)
|| (s_rescInternalInstance->m_initConfig.palTemporalMode == CELL_RESC_PAL_60_INTERPOLATE_DROP_FLEXIBLE))); }
inline bool IsNotPalInterpolate() { return !IsPalInterpolate(); }
inline bool IsPalTemporal() { return (IsPal() && s_rescInternalInstance->m_initConfig.palTemporalMode != CELL_RESC_PAL_50); }
inline bool IsNotPalTemporal() { return !IsPalTemporal(); }
inline bool IsNotPal() { return !IsPal(); }
inline bool IsGcmFlip() { return (IsNotPal() || (IsPal() && (s_rescInternalInstance->m_initConfig.palTemporalMode == CELL_RESC_PAL_50
|| s_rescInternalInstance->m_initConfig.palTemporalMode == CELL_RESC_PAL_60_FOR_HSYNC)));}
inline int GetNumColorBuffers(){ return IsPalInterpolate() ? 6 : (IsPalDrop() ? 3 : 2); }
inline bool IsInterlace() { return s_rescInternalInstance->m_initConfig.interlaceMode == CELL_RESC_INTERLACE_FILTER; }
inline bool IsTextureNR() { return !IsInterlace(); }
PICTURE_SIZE = (1.0f),
UV_DELTA_PS = (1.f / 8.f),
UV_DELTA_LB = (1.f / 6.f),
XY_DELTA_LB = (1.f / 8.f);
void BuildupVertexBufferNR()
{

View File

@ -1,5 +1,31 @@
#pragma once
#define roundup(x,a) (((x)+(a)-1)&(~((a)-1)))
#define SEVIRITY 80.f
enum
{
CELL_RESC_ERROR_NOT_INITIALIZED = 0x80210301,
CELL_RESC_ERROR_REINITIALIZED = 0x80210302,
CELL_RESC_ERROR_BAD_ALIGNMENT = 0x80210303,
CELL_RESC_ERROR_BAD_ARGUMENT = 0x80210304,
CELL_RESC_ERROR_LESS_MEMORY = 0x80210305,
CELL_RESC_ERROR_GCM_FLIP_QUE_FULL = 0x80210306,
CELL_RESC_ERROR_BAD_COMBINATION = 0x80210307,
};
enum
{
COLOR_BUFFER_ALIGNMENT = 128,
VERTEX_BUFFER_ALIGNMENT = 4,
FRAGMENT_SHADER_ALIGNMENT = 64,
VERTEX_NUMBER_NORMAL = 4,
SRC_BUFFER_NUM = 8,
MAX_DST_BUFFER_NUM = 6,
RESC_PARAM_NUM
};
enum CellRescBufferMode
{
CELL_RESC_720x480 = 0x1,
@ -78,4 +104,80 @@ struct CellRescSrc
be_t<u16> width;
be_t<u16> height;
be_t<u32> offset;
};
};
struct RescVertex_t
{
be_t<float> Px, Py;
be_t<float> u, v;
be_t<float> u2, v2;
};
struct CCellRescInternal
{
CellRescInitConfig m_initConfig;
CellRescSrc m_rescSrc[SRC_BUFFER_NUM];
u32 m_dstMode;
CellRescDsts m_rescDsts[4], *m_pRescDsts;
CellRescTableElement m_interlaceElement;
u32 m_colorBuffersEA, m_vertexArrayEA, m_fragmentUcodeEA;
u32 m_bufIdFront;
s32 m_dstWidth, m_dstHeight, m_dstPitch;
u16 m_srcWidthInterlace, m_srcHeightInterlace;
u32 m_dstBufInterval, m_dstOffsets[MAX_DST_BUFFER_NUM];
s32 m_nVertex;
u32 m_bufIdFrontPrevDrop, m_bufIdPalMidPrev, m_bufIdPalMidNow;
u32 m_interlaceTableEA;
int m_interlaceTableLength;
float m_ratioAdjX, m_ratioAdjY, m_flexRatio;
bool m_bInitialized, m_bNewlyAdjustRatio;
bool m_isDummyFlipped;
u8 m_cgParamIndex[RESC_PARAM_NUM];
u64 m_commandIdxCaF, m_rcvdCmdIdx;
u32 s_applicationFlipHandler;
u32 s_applicationVBlankHandler;
CCellRescInternal()
: m_bInitialized(false)
{
}
};
CCellRescInternal* s_rescInternalInstance = nullptr;
// Extern Functions
extern int cellGcmSetFlipMode(u32 mode);
extern void cellGcmSetFlipHandler(u32 handler_addr);
extern void cellGcmSetVBlankHandler(u32 handler_addr);
extern int cellGcmAddressToOffset(u64 address, mem32_t offset);
extern int cellGcmSetDisplayBuffer(u32 id, u32 offset, u32 pitch, u32 width, u32 height);
extern int cellGcmSetPrepareFlip(mem_ptr_t<CellGcmContextData> ctx, u32 id);
extern int cellGcmSetSecondVFrequency(u32 freq);
extern u32 cellGcmGetLabelAddress(u8 index);
extern u32 cellGcmGetTiledPitchSize(u32 size);
// Local Functions
int cellRescGetNumColorBuffers(u32 dstMode, u32 palTemporalMode, u32 reserved);
// Help Functions
inline bool IsPal() { return s_rescInternalInstance->m_dstMode == CELL_RESC_720x576; }
inline bool IsPal60Hsync() { return (IsPal() && s_rescInternalInstance->m_initConfig.palTemporalMode == CELL_RESC_PAL_60_FOR_HSYNC); }
inline bool IsPalDrop() { return (IsPal() && s_rescInternalInstance->m_initConfig.palTemporalMode == CELL_RESC_PAL_60_DROP); }
inline bool IsPalInterpolate() {
return (IsPal() && ((s_rescInternalInstance->m_initConfig.palTemporalMode == CELL_RESC_PAL_60_INTERPOLATE)
|| (s_rescInternalInstance->m_initConfig.palTemporalMode == CELL_RESC_PAL_60_INTERPOLATE_30_DROP)
|| (s_rescInternalInstance->m_initConfig.palTemporalMode == CELL_RESC_PAL_60_INTERPOLATE_DROP_FLEXIBLE)));
}
inline bool IsNotPalInterpolate() { return !IsPalInterpolate(); }
inline bool IsPalTemporal() { return (IsPal() && s_rescInternalInstance->m_initConfig.palTemporalMode != CELL_RESC_PAL_50); }
inline bool IsNotPalTemporal() { return !IsPalTemporal(); }
inline bool IsNotPal() { return !IsPal(); }
inline bool IsGcmFlip() {
return (IsNotPal() || (IsPal() && (s_rescInternalInstance->m_initConfig.palTemporalMode == CELL_RESC_PAL_50
|| s_rescInternalInstance->m_initConfig.palTemporalMode == CELL_RESC_PAL_60_FOR_HSYNC)));
}
inline int GetNumColorBuffers(){ return IsPalInterpolate() ? 6 : (IsPalDrop() ? 3 : 2); }
inline bool IsInterlace() { return s_rescInternalInstance->m_initConfig.interlaceMode == CELL_RESC_INTERLACE_FILTER; }
inline bool IsTextureNR() { return !IsInterlace(); }