GPU:
- Do heavy code cleanup. - Encapsulate GPU-related functions into the new GPUEngineBase class.
This commit is contained in:
parent
5a6590ff49
commit
d5280f82b0
|
@ -301,7 +301,7 @@ void GFX_FIFOcnt(u32 val)
|
|||
}
|
||||
|
||||
// ========================================================= DISP FIFO
|
||||
DISP_FIFO disp_fifo;
|
||||
DISP_FIFO disp_fifo;
|
||||
|
||||
void DISP_FIFOinit()
|
||||
{
|
||||
|
@ -326,3 +326,9 @@ u32 DISP_FIFOrecv()
|
|||
disp_fifo.head = 0;
|
||||
return (val);
|
||||
}
|
||||
|
||||
void DISP_FIFOreset()
|
||||
{
|
||||
disp_fifo.head = 0;
|
||||
disp_fifo.tail = 0;
|
||||
}
|
||||
|
|
|
@ -69,11 +69,11 @@ typedef struct
|
|||
|
||||
extern GFX_PIPE gxPIPE;
|
||||
extern GFX_FIFO gxFIFO;
|
||||
extern void GFX_PIPEclear();
|
||||
extern void GFX_FIFOclear();
|
||||
extern void GFX_FIFOsend(u8 cmd, u32 param);
|
||||
extern BOOL GFX_PIPErecv(u8 *cmd, u32 *param);
|
||||
extern void GFX_FIFOcnt(u32 val);
|
||||
void GFX_PIPEclear();
|
||||
void GFX_FIFOclear();
|
||||
void GFX_FIFOsend(u8 cmd, u32 param);
|
||||
BOOL GFX_PIPErecv(u8 *cmd, u32 *param);
|
||||
void GFX_FIFOcnt(u32 val);
|
||||
|
||||
//=================================================== Display memory FIFO
|
||||
typedef struct
|
||||
|
@ -84,8 +84,9 @@ typedef struct
|
|||
} DISP_FIFO;
|
||||
|
||||
extern DISP_FIFO disp_fifo;
|
||||
extern void DISP_FIFOinit();
|
||||
extern void DISP_FIFOsend(u32 val);
|
||||
extern u32 DISP_FIFOrecv();
|
||||
void DISP_FIFOinit();
|
||||
void DISP_FIFOsend(u32 val);
|
||||
u32 DISP_FIFOrecv();
|
||||
void DISP_FIFOreset();
|
||||
|
||||
#endif
|
||||
|
|
1730
desmume/src/GPU.cpp
1730
desmume/src/GPU.cpp
File diff suppressed because it is too large
Load Diff
|
@ -577,12 +577,19 @@ typedef union
|
|||
|
||||
} OAMAttributes;
|
||||
|
||||
enum SpriteRenderMode
|
||||
{
|
||||
SpriteRenderMode_Sprite1D = 0,
|
||||
SpriteRenderMode_Sprite2D = 1
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
s16 x;
|
||||
s16 y;
|
||||
} SpriteSize;
|
||||
|
||||
typedef u8 TBlendTable[32][32];
|
||||
|
||||
#define NB_PRIORITIES 4
|
||||
#define NB_BG 4
|
||||
|
@ -677,137 +684,201 @@ typedef struct
|
|||
|
||||
#define VRAM_NO_3D_USAGE 0xFF
|
||||
|
||||
struct GPU
|
||||
class GPUEngineBase
|
||||
{
|
||||
GPU()
|
||||
: debug(false)
|
||||
{}
|
||||
|
||||
// some structs are becoming redundant
|
||||
// some functions too (no need to recopy some vars as it is done by MMU)
|
||||
REG_DISPx * dispx_st;
|
||||
|
||||
//this indicates whether this gpu is handling debug tools
|
||||
bool debug;
|
||||
|
||||
CACHE_ALIGN u16 sprColor[GPU_FRAMEBUFFER_NATIVE_WIDTH];
|
||||
CACHE_ALIGN u8 sprAlpha[GPU_FRAMEBUFFER_NATIVE_WIDTH];
|
||||
CACHE_ALIGN u8 sprType[GPU_FRAMEBUFFER_NATIVE_WIDTH];
|
||||
CACHE_ALIGN u8 sprPrio[GPU_FRAMEBUFFER_NATIVE_WIDTH];
|
||||
private:
|
||||
CACHE_ALIGN u16 _sprColor[GPU_FRAMEBUFFER_NATIVE_WIDTH];
|
||||
CACHE_ALIGN u8 _sprAlpha[GPU_FRAMEBUFFER_NATIVE_WIDTH];
|
||||
CACHE_ALIGN u8 _sprType[GPU_FRAMEBUFFER_NATIVE_WIDTH];
|
||||
CACHE_ALIGN u8 _sprPrio[GPU_FRAMEBUFFER_NATIVE_WIDTH];
|
||||
|
||||
bool _enableLayer[5];
|
||||
itemsForPriority_t _itemsForPriority[NB_PRIORITIES];
|
||||
|
||||
_BGxCNT & bgcnt(int num) { return (dispx_st)->dispx_BGxCNT[num].bits; }
|
||||
const _DISPCNT& dispCnt() const { return dispx_st->dispx_DISPCNT.bits; }
|
||||
template<bool MOSAIC> void modeRender(const size_t layer);
|
||||
|
||||
DISPCAPCNT dispCapCnt;
|
||||
BOOL LayersEnable[5];
|
||||
itemsForPriority_t itemsForPriority[NB_PRIORITIES];
|
||||
|
||||
#define BGBmpBB BG_bmp_ram
|
||||
#define BGChBB BG_tile_ram
|
||||
|
||||
u32 BG_bmp_large_ram[4];
|
||||
u32 BG_bmp_ram[4];
|
||||
u32 BG_tile_ram[4];
|
||||
u32 BG_map_ram[4];
|
||||
|
||||
u8 BGExtPalSlot[4];
|
||||
u16 BGSize[4][2];
|
||||
BGType BGTypes[4];
|
||||
|
||||
struct MosaicColor {
|
||||
u16 bg[4][256];
|
||||
struct Obj {
|
||||
u16 color;
|
||||
u8 alpha, opaque;
|
||||
u8 alpha;
|
||||
u8 opaque;
|
||||
} obj[256];
|
||||
} mosaicColors;
|
||||
} _mosaicColors;
|
||||
|
||||
u8 _bgPrio[5];
|
||||
bool _bg0HasHighestPrio;
|
||||
|
||||
OAMAttributes *_oamList;
|
||||
u32 _sprMem;
|
||||
u8 _sprBoundary;
|
||||
u8 _sprBMPBoundary;
|
||||
u8 _sprBMPMode;
|
||||
u32 _sprEnable;
|
||||
|
||||
u16 *_currentFadeInColors;
|
||||
u16 *_currentFadeOutColors;
|
||||
|
||||
bool _blend1;
|
||||
bool _blend2[8];
|
||||
|
||||
TBlendTable *_blendTable;
|
||||
|
||||
u32 _BG_bmp_large_ram[4];
|
||||
u32 _BG_bmp_ram[4];
|
||||
u32 _BG_tile_ram[4];
|
||||
u32 _BG_map_ram[4];
|
||||
|
||||
BGType _BGTypes[4];
|
||||
|
||||
u8 _sprNum[256];
|
||||
CACHE_ALIGN u8 _h_win[2][GPU_FRAMEBUFFER_NATIVE_WIDTH];
|
||||
const u8 *_curr_win[2];
|
||||
|
||||
NDSDisplayID _targetDisplayID;
|
||||
u16 *_VRAMaddrNative;
|
||||
u16 *_VRAMaddrCustom;
|
||||
|
||||
bool _curr_mosaic_enabled;
|
||||
|
||||
int _finalColorBckFuncID;
|
||||
int _finalColor3DFuncID;
|
||||
int _finalColorSpriteFuncID;
|
||||
|
||||
SpriteRenderMode _spriteRenderMode;
|
||||
|
||||
u8 *_bgPixels;
|
||||
|
||||
u8 _WIN0H0;
|
||||
u8 _WIN0H1;
|
||||
u8 _WIN0V0;
|
||||
u8 _WIN0V1;
|
||||
|
||||
u8 _WIN1H0;
|
||||
u8 _WIN1H1;
|
||||
u8 _WIN1V0;
|
||||
u8 _WIN1V1;
|
||||
|
||||
u8 _WININ0;
|
||||
bool _WININ0_SPECIAL;
|
||||
u8 _WININ1;
|
||||
bool _WININ1_SPECIAL;
|
||||
|
||||
u8 _WINOUT;
|
||||
bool _WINOUT_SPECIAL;
|
||||
u8 _WINOBJ;
|
||||
bool _WINOBJ_SPECIAL;
|
||||
|
||||
u8 _WIN0_ENABLED;
|
||||
u8 _WIN1_ENABLED;
|
||||
u8 _WINOBJ_ENABLED;
|
||||
|
||||
u16 _BLDCNT;
|
||||
u8 _BLDALPHA_EVA;
|
||||
u8 _BLDALPHA_EVB;
|
||||
u8 _BLDY_EVY;
|
||||
|
||||
void _MosaicSpriteLinePixel(const size_t x, u16 l, u16 *dst, u8 *dst_alpha, u8 *typeTab, u8 *prioTab);
|
||||
void _MosaicSpriteLine(u16 l, u16 *dst, u8 *dst_alpha, u8 *typeTab, u8 *prioTab);
|
||||
|
||||
template<bool MOSAIC> void _LineLarge8bpp();
|
||||
template<bool MOSAIC> void _RenderLine_TextBG(u16 XBG, u16 YBG, u16 LG);
|
||||
|
||||
template<bool MOSAIC> void _RotBG2(const BGxPARMS ¶m, const u16 LG);
|
||||
template<bool MOSAIC> void _ExtRotBG2(const BGxPARMS ¶m, const u16 LG);
|
||||
|
||||
template<bool MOSAIC> void _LineText();
|
||||
template<bool MOSAIC> void _LineRot();
|
||||
template<bool MOSAIC> void _LineExtRot();
|
||||
|
||||
// check whether (x,y) is within the rectangle (including wraparounds)
|
||||
template<int WIN_NUM> u8 _WithinRect(const size_t x) const;
|
||||
void _RenderLine_CheckWindows(const size_t srcX, bool &draw, bool &effect) const;
|
||||
|
||||
template<bool BACKDROP, BlendFunc FUNC, bool WINDOW>
|
||||
FORCEINLINE FASTCALL bool _master_setFinalBGColor(const size_t srcX, const size_t dstX, const u16 *dstLine, const u8 *bgPixelsLine, u16 &outColor);
|
||||
|
||||
template<BlendFunc FUNC, bool WINDOW>
|
||||
FORCEINLINE FASTCALL void _master_setFinal3dColor(const size_t srcX, const size_t dstX, u16 *dstLine, u8 *bgPixelsLine, const FragmentColor src);
|
||||
|
||||
template<BlendFunc FUNC, bool WINDOW>
|
||||
FORCEINLINE FASTCALL void _master_setFinalOBJColor(const size_t srcX, const size_t dstX, u16 *dstLine, u8 *bgPixelsLine, const u16 src, const u8 alpha, const u8 type);
|
||||
|
||||
template<bool BACKDROP, int FUNCNUM> void _SetFinalColorBG(const size_t srcX, const size_t dstX, u16 *dstLine, u8 *bgPixelsLine, u16 src);
|
||||
void _SetFinalColor3D(const size_t srcX, const size_t dstX, u16 *dstLine, u8 *bgPixelsLine, const FragmentColor src);
|
||||
void _SetFinalColorSprite(const size_t srcX, const size_t dstX, u16 *dstLine, u8 *bgPixelsLine, const u16 src, const u8 alpha, const u8 type);
|
||||
|
||||
u16 _FinalColorBlend(const u16 colA, const u16 colB);
|
||||
FORCEINLINE u16 _FinalColorBlendFunc(const u16 colA, const u16 colB, const TBlendTable *blendTable);
|
||||
|
||||
void _RenderSpriteBMP(const u8 spriteNum, const u16 l, u16 *dst, const u32 srcadr, u8 *dst_alpha, u8 *typeTab, u8 *prioTab, const u8 prio, const size_t lg, size_t sprX, size_t x, const s32 xdir, const u8 alpha);
|
||||
void _RenderSprite256(const u8 spriteNum, const u16 l, u16 *dst, const u32 srcadr, const u16 *pal, u8 *dst_alpha, u8 *typeTab, u8 *prioTab, const u8 prio, const size_t lg, size_t sprX, size_t x, const s32 xdir, const u8 alpha);
|
||||
void _RenderSprite16(const u16 l, u16 *dst, const u32 srcadr, const u16 *pal, u8 *dst_alpha, u8 *typeTab, u8 *prioTab, const u8 prio, const size_t lg, size_t sprX, size_t x, const s32 xdir, const u8 alpha);
|
||||
void _RenderSpriteWin(const u8 *src, const bool col256, const size_t lg, size_t sprX, size_t x, const s32 xdir);
|
||||
bool _ComputeSpriteVars(const OAMAttributes &spriteInfo, const u16 l, SpriteSize &sprSize, s32 &sprX, s32 &sprY, s32 &x, s32 &y, s32 &lg, s32 &xdir);
|
||||
|
||||
u32 _SpriteAddressBMP(const OAMAttributes &spriteInfo, const SpriteSize sprSize, const s32 y);
|
||||
|
||||
template<SpriteRenderMode MODE> void _SpriteRenderPerform(u16 *dst, u8 *dst_alpha, u8 *typeTab, u8 *prioTab);
|
||||
|
||||
public:
|
||||
GPUEngineBase();
|
||||
GPUEngineBase(const GPUCoreID coreID);
|
||||
~GPUEngineBase();
|
||||
|
||||
void Reset();
|
||||
void ResortBGLayers();
|
||||
void SetMasterBrightness(const u16 val);
|
||||
void SetupFinalPixelBlitter();
|
||||
|
||||
void SetVideoProp(const u32 ctrlBits);
|
||||
void SetBGProp(const size_t num, const u16 ctrlBits);
|
||||
|
||||
void RenderLine(const u16 l, u16 *dstLine, const size_t dstLineWidth, const size_t dstLineCount);
|
||||
|
||||
// some structs are becoming redundant
|
||||
// some functions too (no need to recopy some vars as it is done by MMU)
|
||||
REG_DISPx *dispx_st;
|
||||
|
||||
u8 sprNum[256];
|
||||
CACHE_ALIGN u8 h_win[2][GPU_FRAMEBUFFER_NATIVE_WIDTH];
|
||||
const u8 *curr_win[2];
|
||||
bool need_update_winh[2];
|
||||
//this indicates whether this gpu is handling debug tools
|
||||
bool debug;
|
||||
|
||||
_BGxCNT & bgcnt(int num) { return (dispx_st)->dispx_BGxCNT[num].bits; }
|
||||
const _DISPCNT& dispCnt() const { return dispx_st->dispx_DISPCNT.bits; }
|
||||
|
||||
DISPCAPCNT dispCapCnt;
|
||||
|
||||
u16 BGSize[4][2];
|
||||
u8 BGExtPalSlot[4];
|
||||
|
||||
template<size_t WIN_NUM> void update_winh();
|
||||
template<size_t WIN_NUM> void setup_windows();
|
||||
|
||||
template<bool MOSAIC> void ModeRender(const size_t layer);
|
||||
|
||||
GPUCoreID core;
|
||||
NDSDisplayID targetDisplayID;
|
||||
GPUDisplayMode dispMode;
|
||||
u8 vramBlock;
|
||||
u16 *VRAMaddrNative;
|
||||
u16 *VRAMaddrCustom;
|
||||
|
||||
bool isCustomRenderingNeeded;
|
||||
bool is3DEnabled;
|
||||
u8 vramBlockBGIndex;
|
||||
u8 vramBGLayer;
|
||||
u8 vramBlockBGIndex;
|
||||
u8 vramBlockOBJIndex;
|
||||
|
||||
u16 *customBuffer;
|
||||
u16 *nativeBuffer;
|
||||
u16 *nativeBuffer;
|
||||
size_t renderedWidth;
|
||||
size_t renderedHeight;
|
||||
u16 *renderedBuffer;
|
||||
|
||||
//FIFO fifo;
|
||||
|
||||
u8 bgPrio[5];
|
||||
|
||||
bool bg0HasHighestPrio;
|
||||
|
||||
OAMAttributes *oamList;
|
||||
u32 sprMem;
|
||||
u8 sprBoundary;
|
||||
u8 sprBMPBoundary;
|
||||
u8 sprBMPMode;
|
||||
u32 sprEnable;
|
||||
|
||||
u8 WIN0H0;
|
||||
u8 WIN0H1;
|
||||
u8 WIN0V0;
|
||||
u8 WIN0V1;
|
||||
|
||||
u8 WIN1H0;
|
||||
u8 WIN1H1;
|
||||
u8 WIN1V0;
|
||||
u8 WIN1V1;
|
||||
|
||||
u8 WININ0;
|
||||
bool WININ0_SPECIAL;
|
||||
u8 WININ1;
|
||||
bool WININ1_SPECIAL;
|
||||
|
||||
u8 WINOUT;
|
||||
bool WINOUT_SPECIAL;
|
||||
u8 WINOBJ;
|
||||
bool WINOBJ_SPECIAL;
|
||||
|
||||
u8 WIN0_ENABLED;
|
||||
u8 WIN1_ENABLED;
|
||||
u8 WINOBJ_ENABLED;
|
||||
|
||||
u16 BLDCNT;
|
||||
u8 BLDALPHA_EVA;
|
||||
u8 BLDALPHA_EVB;
|
||||
u8 BLDY_EVY;
|
||||
u16 *currentFadeInColors, *currentFadeOutColors;
|
||||
bool blend2[8];
|
||||
|
||||
typedef u8 TBlendTable[32][32];
|
||||
TBlendTable *blendTable;
|
||||
|
||||
u16 *workingScanline;
|
||||
GPUMasterBrightMode MasterBrightMode;
|
||||
GPUMasterBrightMode MasterBrightMode;
|
||||
u32 MasterBrightFactor;
|
||||
|
||||
u8 *bgPixels;
|
||||
|
||||
|
||||
u32 currLine;
|
||||
u8 currBgNum;
|
||||
bool blend1;
|
||||
u16 *currDst;
|
||||
|
||||
bool need_update_winh[2];
|
||||
|
||||
static struct MosaicLookup {
|
||||
|
||||
struct TableEntry {
|
||||
|
@ -828,44 +899,14 @@ struct GPU
|
|||
int widthValue, heightValue;
|
||||
|
||||
} mosaicLookup;
|
||||
bool curr_mosaic_enabled;
|
||||
|
||||
u16 blend(const u16 colA, const u16 colB);
|
||||
|
||||
template<bool BACKDROP, BlendFunc FUNC, bool WINDOW>
|
||||
FORCEINLINE FASTCALL bool _master_setFinalBGColor(const size_t srcX, const size_t dstX, const u16 *dstLine, const u8 *bgPixelsLine, u16 &outColor);
|
||||
|
||||
template<BlendFunc FUNC, bool WINDOW>
|
||||
FORCEINLINE FASTCALL void _master_setFinal3dColor(const size_t srcX, const size_t dstX, u16 *dstLine, u8 *bgPixelsLine, const FragmentColor src);
|
||||
|
||||
template<BlendFunc FUNC, bool WINDOW>
|
||||
FORCEINLINE FASTCALL void _master_setFinalOBJColor(const size_t srcX, const size_t dstX, u16 *dstLine, u8 *bgPixelsLine, const u16 src, const u8 alpha, const u8 type);
|
||||
struct AffineInfo {
|
||||
AffineInfo() : x(0), y(0) {}
|
||||
u32 x, y;
|
||||
} affineInfo[2];
|
||||
|
||||
int setFinalColorBck_funcNum;
|
||||
int bgFunc;
|
||||
int setFinalColor3d_funcNum;
|
||||
int setFinalColorSpr_funcNum;
|
||||
//Final3DColFunct setFinalColor3D;
|
||||
enum SpriteRenderMode {
|
||||
SPRITE_1D, SPRITE_2D
|
||||
} spriteRenderMode;
|
||||
|
||||
template<GPU::SpriteRenderMode MODE>
|
||||
void _spriteRender(u16 *dst, u8 *dst_alpha, u8 *typeTab, u8 *prioTab);
|
||||
void SetLayerState(const size_t layerIndex, bool theState);
|
||||
|
||||
inline void spriteRender(u16 *dst, u8 *dst_alpha, u8 *typeTab, u8 *prioTab)
|
||||
{
|
||||
if (spriteRenderMode == SPRITE_1D)
|
||||
_spriteRender<SPRITE_1D>(dst, dst_alpha, typeTab, prioTab);
|
||||
else
|
||||
_spriteRender<SPRITE_2D>(dst, dst_alpha, typeTab, prioTab);
|
||||
}
|
||||
|
||||
|
||||
void setFinalColor3d(const size_t srcX, const size_t dstX, u16 *dstLine, u8 *bgPixelsLine, const FragmentColor src);
|
||||
void setFinalColorSpr(const size_t srcX, const size_t dstX, u16 *dstLine, u8 *bgPixelsLine, const u16 src, const u8 alpha, const u8 type);
|
||||
|
||||
template<bool BACKDROP, int FUNCNUM> void setFinalColorBG(const size_t srcX, const size_t dstX, u16 *dstLine, u8 *bgPixelsLine, u16 src);
|
||||
template<bool BACKDROP, bool USECUSTOMVRAM, int FUNCNUM> FORCEINLINE void ____setFinalColorBck(const u16 color, const size_t srcX);
|
||||
template<bool MOSAIC, bool BACKDROP> FORCEINLINE void __setFinalColorBck(u16 color, const size_t srcX, const bool opaque);
|
||||
template<bool MOSAIC, bool BACKDROP, bool USECUSTOMVRAM, int FUNCNUM> FORCEINLINE void ___setFinalColorBck(u16 color, const size_t srcX, const bool opaque);
|
||||
|
@ -877,54 +918,66 @@ struct GPU
|
|||
void setAffineStartWord(const size_t layer, int xy, u16 val, int word);
|
||||
u32 getAffineStart(const size_t layer, int xy);
|
||||
void refreshAffineStartRegs(const int num, const int xy);
|
||||
|
||||
struct AffineInfo {
|
||||
AffineInfo() : x(0), y(0) {}
|
||||
u32 x, y;
|
||||
} affineInfo[2];
|
||||
|
||||
void renderline_checkWindows(const size_t srcX, bool &draw, bool &effect) const;
|
||||
|
||||
// check whether (x,y) is within the rectangle (including wraparounds)
|
||||
template<int WIN_NUM> u8 withinRect(const size_t x) const;
|
||||
|
||||
u32 getHOFS(const size_t bg);
|
||||
u32 getVOFS(const size_t bg);
|
||||
|
||||
void updateBLDALPHA();
|
||||
void setBLDALPHA(const u16 val);
|
||||
void setBLDALPHA_EVA(const u8 val);
|
||||
void setBLDALPHA_EVB(const u8 val);
|
||||
void SpriteRender(u16 *dst, u8 *dst_alpha, u8 *typeTab, u8 *prioTab);
|
||||
|
||||
void HandleDisplayModeOff(u16 *dstLine, const size_t l, const size_t dstLineWidth, const size_t dstLineCount);
|
||||
void HandleDisplayModeNormal(u16 *dstLine, const size_t l, const size_t dstLineWidth, const size_t dstLineCount);
|
||||
void HandleDisplayModeVRAM(u16 *dstLine, const size_t l, const size_t dstLineWidth, const size_t dstLineCount);
|
||||
void HandleDisplayModeMainMemory(u16 *dstLine, const size_t l, const size_t dstLineWidth, const size_t dstLineCount);
|
||||
|
||||
u32 GetHOFS(const size_t bg);
|
||||
u32 GetVOFS(const size_t bg);
|
||||
|
||||
void UpdateBLDALPHA();
|
||||
void SetBLDALPHA(const u16 val);
|
||||
void SetBLDALPHA_EVA(const u8 val);
|
||||
void SetBLDALPHA_EVB(const u8 val);
|
||||
|
||||
// Blending
|
||||
void SetBLDCNT_LOW(const u8 val);
|
||||
void SetBLDCNT_HIGH(const u8 val);
|
||||
void SetBLDCNT(const u16 val);
|
||||
void SetBLDY_EVY(const u8 val);
|
||||
|
||||
void SetWIN0_H(const u16 val);
|
||||
void SetWIN0_H0(const u8 val);
|
||||
void SetWIN0_H1(const u8 val);
|
||||
|
||||
void SetWIN0_V(const u16 val);
|
||||
void SetWIN0_V0(const u8 val);
|
||||
void SetWIN0_V1(const u8 val);
|
||||
|
||||
void SetWIN1_H(const u16 val);
|
||||
void SetWIN1_H0(const u8 val);
|
||||
void SetWIN1_H1(const u8 val);
|
||||
|
||||
void SetWIN1_V(const u16 val);
|
||||
void SetWIN1_V0(const u8 val);
|
||||
void SetWIN1_V1(const u8 val);
|
||||
|
||||
void SetWININ(const u16 val);
|
||||
void SetWININ0(const u8 val);
|
||||
void SetWININ1(const u8 val);
|
||||
|
||||
void SetWINOUT16(const u16 val);
|
||||
void SetWINOUT(const u8 val);
|
||||
void SetWINOBJ(const u8 val);
|
||||
|
||||
int GetFinalColorBckFuncID();
|
||||
void SetFinalColorBckFuncID(int funcID);
|
||||
|
||||
NDSDisplayID GetDisplayByID();
|
||||
void SetDisplayByID(const NDSDisplayID theDisplayID);
|
||||
|
||||
void SetCustomFramebufferSize(size_t w, size_t h);
|
||||
void BlitNativeToCustomFramebuffer();
|
||||
|
||||
void REG_DISPx_pack_test();
|
||||
};
|
||||
#if 0
|
||||
// normally should have same addresses
|
||||
static void REG_DISPx_pack_test(GPU * gpu)
|
||||
{
|
||||
REG_DISPx * r = gpu->dispx_st;
|
||||
printf ("%08x %02x\n", (u32)r, (u32)(&r->dispx_DISPCNT) - (u32)r);
|
||||
printf ("\t%02x\n", (u32)(&r->dispA_DISPSTAT) - (u32)r);
|
||||
printf ("\t%02x\n", (u32)(&r->dispx_VCOUNT) - (u32)r);
|
||||
printf ("\t%02x\n", (u32)(&r->dispx_BGxCNT[0]) - (u32)r);
|
||||
printf ("\t%02x\n", (u32)(&r->dispx_BGxOFS[0]) - (u32)r);
|
||||
printf ("\t%02x\n", (u32)(&r->dispx_BG2PARMS) - (u32)r);
|
||||
printf ("\t%02x\n", (u32)(&r->dispx_BG3PARMS) - (u32)r);
|
||||
// printf ("\t%02x\n", (u32)(&r->dispx_WINCNT) - (u32)r);
|
||||
printf ("\t%02x\n", (u32)(&r->dispx_MISC) - (u32)r);
|
||||
printf ("\t%02x\n", (u32)(&r->dispA_DISP3DCNT) - (u32)r);
|
||||
printf ("\t%02x\n", (u32)(&r->dispA_DISPCAPCNT) - (u32)r);
|
||||
printf ("\t%02x\n", (u32)(&r->dispA_DISPMMEMFIFO) - (u32)r);
|
||||
}
|
||||
#endif
|
||||
|
||||
extern u16 *GPU_screen; // TODO: Old pointer - need to eliminate direct reference in frontends
|
||||
|
||||
GPU* GPU_Init(const GPUCoreID coreID);
|
||||
void GPU_Reset(GPU *gpu);
|
||||
void GPU_DeInit(GPU *gpu);
|
||||
|
||||
size_t GPU_GetFramebufferWidth();
|
||||
size_t GPU_GetFramebufferHeight();
|
||||
void GPU_SetFramebufferSize(size_t w, size_t h);
|
||||
|
@ -948,35 +1001,25 @@ void GPU_UpdateVRAM3DUsageProperties(VRAM3DUsageProperties &outProperty);
|
|||
|
||||
const NDSDisplayInfo& NDS_GetDisplayInfo(); // Frontends need to call this whenever they need to read the video buffers from the emulator core
|
||||
|
||||
//these are functions used by debug tools which want to render layers etc outside the context of the emulation
|
||||
namespace GPU_EXT
|
||||
{
|
||||
void textBG(GPU *gpu, u8 num, u8 *DST); //Draw text based background
|
||||
void rotBG(GPU *gpu, u8 num, u8 *DST);
|
||||
void extRotBG(GPU *gpu, u8 num, u8 *DST);
|
||||
};
|
||||
void sprite1D(GPU *gpu, u16 l, u8 *dst, u8 *dst_alpha, u8 *typeTab, u8 *prioTab);
|
||||
void sprite2D(GPU *gpu, u16 l, u8 *dst, u8 *dst_alpha, u8 *typeTab, u8 *prioTab);
|
||||
|
||||
class NDSDisplay
|
||||
{
|
||||
private:
|
||||
NDSDisplayID _ID;
|
||||
GPU *_gpu;
|
||||
GPUEngineBase *_gpu;
|
||||
|
||||
public:
|
||||
NDSDisplay();
|
||||
NDSDisplay(const NDSDisplayID displayID);
|
||||
NDSDisplay(const NDSDisplayID displayID, const GPUCoreID coreID);
|
||||
|
||||
GPU* GetEngine();
|
||||
GPUEngineBase* GetEngine();
|
||||
GPUCoreID GetEngineID();
|
||||
void SetEngineByID(const GPUCoreID theID);
|
||||
};
|
||||
|
||||
struct NDS_Screen
|
||||
{
|
||||
GPU *gpu;
|
||||
GPUEngineBase *gpu;
|
||||
};
|
||||
|
||||
extern NDS_Screen MainScreen;
|
||||
|
@ -990,68 +1033,8 @@ void Screen_DeInit(void);
|
|||
|
||||
extern MMU_struct MMU;
|
||||
|
||||
void GPU_setVideoProp(GPU *gpu, const u32 ctrlBits);
|
||||
void GPU_setBGProp(GPU *gpu, const size_t num, const u16 ctrlBits);
|
||||
|
||||
void GPU_setBLDCNT(GPU *gpu, u16 v);
|
||||
void GPU_setBLDY(GPU *gpu, u16 v);
|
||||
void GPU_setMOSAIC(GPU *gpu, u16 v);
|
||||
|
||||
|
||||
void GPU_remove(GPU *gpu, const size_t num);
|
||||
void GPU_addBack(GPU *gpu, const size_t num);
|
||||
|
||||
int GPU_ChangeGraphicsCore(int coreid);
|
||||
|
||||
void GPU_set_DISPCAPCNT(u32 val);
|
||||
void GPU_RenderLine(NDS_Screen *screen, const u16 l, bool skip = false);
|
||||
void GPU_setMasterBrightness(GPU *gpu, const u16 val);
|
||||
|
||||
inline void GPU_setWIN0_H(GPU *gpu, u16 val) { gpu->WIN0H0 = val >> 8; gpu->WIN0H1 = val&0xFF; gpu->need_update_winh[0] = true; }
|
||||
inline void GPU_setWIN0_H0(GPU *gpu, u8 val) { gpu->WIN0H0 = val; gpu->need_update_winh[0] = true; }
|
||||
inline void GPU_setWIN0_H1(GPU *gpu, u8 val) { gpu->WIN0H1 = val; gpu->need_update_winh[0] = true; }
|
||||
|
||||
inline void GPU_setWIN0_V(GPU *gpu, u16 val) { gpu->WIN0V0 = val >> 8; gpu->WIN0V1 = val&0xFF;}
|
||||
inline void GPU_setWIN0_V0(GPU *gpu, u8 val) { gpu->WIN0V0 = val; }
|
||||
inline void GPU_setWIN0_V1(GPU *gpu, u8 val) { gpu->WIN0V1 = val; }
|
||||
|
||||
inline void GPU_setWIN1_H(GPU *gpu, u16 val) { gpu->WIN1H0 = val >> 8; gpu->WIN1H1 = val&0xFF; gpu->need_update_winh[1] = true; }
|
||||
inline void GPU_setWIN1_H0(GPU *gpu, u8 val) { gpu->WIN1H0 = val; gpu->need_update_winh[1] = true; }
|
||||
inline void GPU_setWIN1_H1(GPU *gpu, u8 val) { gpu->WIN1H1 = val; gpu->need_update_winh[1] = true; }
|
||||
|
||||
inline void GPU_setWIN1_V(GPU *gpu, u16 val) { gpu->WIN1V0 = val >> 8; gpu->WIN1V1 = val&0xFF; }
|
||||
inline void GPU_setWIN1_V0(GPU *gpu, u8 val) { gpu->WIN1V0 = val; }
|
||||
inline void GPU_setWIN1_V1(GPU *gpu, u8 val) { gpu->WIN1V1 = val; }
|
||||
|
||||
inline void GPU_setWININ(GPU* gpu, u16 val) {
|
||||
gpu->WININ0=val&0x1F;
|
||||
gpu->WININ0_SPECIAL=((val>>5)&1)!=0;
|
||||
gpu->WININ1=(val>>8)&0x1F;
|
||||
gpu->WININ1_SPECIAL=((val>>13)&1)!=0;
|
||||
}
|
||||
|
||||
inline void GPU_setWININ0(GPU* gpu, u8 val) { gpu->WININ0 = val&0x1F; gpu->WININ0_SPECIAL = (val>>5)&1; }
|
||||
inline void GPU_setWININ1(GPU* gpu, u8 val) { gpu->WININ1 = val&0x1F; gpu->WININ1_SPECIAL = (val>>5)&1; }
|
||||
|
||||
inline void GPU_setWINOUT16(GPU* gpu, u16 val) {
|
||||
gpu->WINOUT=val&0x1F;
|
||||
gpu->WINOUT_SPECIAL=((val>>5)&1)!=0;
|
||||
gpu->WINOBJ=(val>>8)&0x1F;
|
||||
gpu->WINOBJ_SPECIAL=((val>>13)&1)!=0;
|
||||
}
|
||||
inline void GPU_setWINOUT(GPU* gpu, u8 val) { gpu->WINOUT = val&0x1F; gpu->WINOUT_SPECIAL = (val>>5)&1; }
|
||||
inline void GPU_setWINOBJ(GPU* gpu, u8 val) { gpu->WINOBJ = val&0x1F; gpu->WINOBJ_SPECIAL = (val>>5)&1; }
|
||||
|
||||
// Blending
|
||||
void SetupFinalPixelBlitter (GPU *gpu);
|
||||
#define GPU_setBLDCNT_LOW(gpu, val) {gpu->BLDCNT = (gpu->BLDCNT&0xFF00) | (val); SetupFinalPixelBlitter (gpu);}
|
||||
#define GPU_setBLDCNT_HIGH(gpu, val) {gpu->BLDCNT = (gpu->BLDCNT&0xFF) | (val<<8); SetupFinalPixelBlitter (gpu);}
|
||||
#define GPU_setBLDCNT(gpu, val) {gpu->BLDCNT = (val); SetupFinalPixelBlitter (gpu);}
|
||||
#define GPU_setBLDY_EVY(gpu, val) {gpu->BLDY_EVY = ((val)&0x1f) > 16 ? 16 : ((val)&0x1f);}
|
||||
|
||||
//these arent needed right now since the values get poked into memory via default mmu handling and dispx_st
|
||||
//#define GPU_setBGxHOFS(bg, gpu, val) gpu->dispx_st->dispx_BGxOFS[bg].BGxHOFS = ((val) & 0x1FF)
|
||||
//#define GPU_setBGxVOFS(bg, gpu, val) gpu->dispx_st->dispx_BGxOFS[bg].BGxVOFS = ((val) & 0x1FF)
|
||||
|
||||
inline FragmentColor MakeFragmentColor(const u8 r, const u8 g, const u8 b, const u8 a)
|
||||
{
|
||||
|
|
|
@ -3326,116 +3326,116 @@ void FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
|
|||
break;
|
||||
|
||||
case REG_DISPA_WIN0H:
|
||||
GPU_setWIN0_H1(MainScreen.gpu, val);
|
||||
MainScreen.gpu->SetWIN0_H1(val);
|
||||
break ;
|
||||
case REG_DISPA_WIN0H+1:
|
||||
GPU_setWIN0_H0 (MainScreen.gpu, val);
|
||||
MainScreen.gpu->SetWIN0_H0(val);
|
||||
break ;
|
||||
case REG_DISPA_WIN1H:
|
||||
GPU_setWIN1_H1 (MainScreen.gpu,val);
|
||||
MainScreen.gpu->SetWIN1_H1(val);
|
||||
break ;
|
||||
case REG_DISPA_WIN1H+1:
|
||||
GPU_setWIN1_H0 (MainScreen.gpu,val);
|
||||
MainScreen.gpu->SetWIN1_H0(val);
|
||||
break ;
|
||||
|
||||
case REG_DISPB_WIN0H:
|
||||
GPU_setWIN0_H1(SubScreen.gpu,val);
|
||||
SubScreen.gpu->SetWIN0_H1(val);
|
||||
break ;
|
||||
case REG_DISPB_WIN0H+1:
|
||||
GPU_setWIN0_H0(SubScreen.gpu,val);
|
||||
SubScreen.gpu->SetWIN0_H0(val);
|
||||
break ;
|
||||
case REG_DISPB_WIN1H:
|
||||
GPU_setWIN1_H1(SubScreen.gpu,val);
|
||||
SubScreen.gpu->SetWIN1_H1(val);
|
||||
break ;
|
||||
case REG_DISPB_WIN1H+1:
|
||||
GPU_setWIN1_H0(SubScreen.gpu,val);
|
||||
SubScreen.gpu->SetWIN1_H0(val);
|
||||
break ;
|
||||
|
||||
case REG_DISPA_WIN0V:
|
||||
GPU_setWIN0_V1(MainScreen.gpu,val) ;
|
||||
MainScreen.gpu->SetWIN0_V1(val) ;
|
||||
break ;
|
||||
case REG_DISPA_WIN0V+1:
|
||||
GPU_setWIN0_V0(MainScreen.gpu,val) ;
|
||||
MainScreen.gpu->SetWIN0_V0(val) ;
|
||||
break ;
|
||||
case REG_DISPA_WIN1V:
|
||||
GPU_setWIN1_V1(MainScreen.gpu,val) ;
|
||||
MainScreen.gpu->SetWIN1_V1(val) ;
|
||||
break ;
|
||||
case REG_DISPA_WIN1V+1:
|
||||
GPU_setWIN1_V0(MainScreen.gpu,val) ;
|
||||
MainScreen.gpu->SetWIN1_V0(val) ;
|
||||
break ;
|
||||
|
||||
case REG_DISPB_WIN0V:
|
||||
GPU_setWIN0_V1(SubScreen.gpu,val) ;
|
||||
SubScreen.gpu->SetWIN0_V1(val);
|
||||
break ;
|
||||
case REG_DISPB_WIN0V+1:
|
||||
GPU_setWIN0_V0(SubScreen.gpu,val) ;
|
||||
SubScreen.gpu->SetWIN0_V0(val);
|
||||
break ;
|
||||
case REG_DISPB_WIN1V:
|
||||
GPU_setWIN1_V1(SubScreen.gpu,val) ;
|
||||
SubScreen.gpu->SetWIN1_V1(val);
|
||||
break ;
|
||||
case REG_DISPB_WIN1V+1:
|
||||
GPU_setWIN1_V0(SubScreen.gpu,val) ;
|
||||
SubScreen.gpu->SetWIN1_V0(val);
|
||||
break ;
|
||||
|
||||
case REG_DISPA_WININ:
|
||||
GPU_setWININ0(MainScreen.gpu,val) ;
|
||||
MainScreen.gpu->SetWININ0(val);
|
||||
break ;
|
||||
case REG_DISPA_WININ+1:
|
||||
GPU_setWININ1(MainScreen.gpu,val) ;
|
||||
MainScreen.gpu->SetWININ1(val);
|
||||
break ;
|
||||
case REG_DISPA_WINOUT:
|
||||
GPU_setWINOUT(MainScreen.gpu,val) ;
|
||||
MainScreen.gpu->SetWINOUT(val);
|
||||
break ;
|
||||
case REG_DISPA_WINOUT+1:
|
||||
GPU_setWINOBJ(MainScreen.gpu,val);
|
||||
MainScreen.gpu->SetWINOBJ(val);
|
||||
break ;
|
||||
|
||||
case REG_DISPB_WININ:
|
||||
GPU_setWININ0(SubScreen.gpu,val) ;
|
||||
SubScreen.gpu->SetWININ0(val);
|
||||
break ;
|
||||
case REG_DISPB_WININ+1:
|
||||
GPU_setWININ1(SubScreen.gpu,val) ;
|
||||
SubScreen.gpu->SetWININ1(val);
|
||||
break ;
|
||||
case REG_DISPB_WINOUT:
|
||||
GPU_setWINOUT(SubScreen.gpu,val) ;
|
||||
SubScreen.gpu->SetWINOUT(val);
|
||||
break ;
|
||||
case REG_DISPB_WINOUT+1:
|
||||
GPU_setWINOBJ(SubScreen.gpu,val) ;
|
||||
SubScreen.gpu->SetWINOBJ(val);
|
||||
break ;
|
||||
|
||||
case REG_DISPA_BLDCNT:
|
||||
GPU_setBLDCNT_HIGH(MainScreen.gpu,val);
|
||||
MainScreen.gpu->SetBLDCNT_HIGH(val);
|
||||
break;
|
||||
case REG_DISPA_BLDCNT+1:
|
||||
GPU_setBLDCNT_LOW (MainScreen.gpu,val);
|
||||
MainScreen.gpu->SetBLDCNT_LOW(val);
|
||||
break;
|
||||
|
||||
case REG_DISPB_BLDCNT:
|
||||
GPU_setBLDCNT_HIGH (SubScreen.gpu,val);
|
||||
SubScreen.gpu->SetBLDCNT_HIGH(val);
|
||||
break;
|
||||
case REG_DISPB_BLDCNT+1:
|
||||
GPU_setBLDCNT_LOW (SubScreen.gpu,val);
|
||||
SubScreen.gpu->SetBLDCNT_LOW(val);
|
||||
break;
|
||||
|
||||
case REG_DISPA_BLDALPHA:
|
||||
MainScreen.gpu->setBLDALPHA_EVA(val);
|
||||
MainScreen.gpu->SetBLDALPHA_EVA(val);
|
||||
break;
|
||||
case REG_DISPA_BLDALPHA+1:
|
||||
MainScreen.gpu->setBLDALPHA_EVB(val);
|
||||
MainScreen.gpu->SetBLDALPHA_EVB(val);
|
||||
break;
|
||||
|
||||
case REG_DISPB_BLDALPHA:
|
||||
SubScreen.gpu->setBLDALPHA_EVA(val);
|
||||
SubScreen.gpu->SetBLDALPHA_EVA(val);
|
||||
break;
|
||||
case REG_DISPB_BLDALPHA+1:
|
||||
SubScreen.gpu->setBLDALPHA_EVB(val);
|
||||
SubScreen.gpu->SetBLDALPHA_EVB(val);
|
||||
break;
|
||||
|
||||
case REG_DISPA_BLDY:
|
||||
GPU_setBLDY_EVY(MainScreen.gpu,val) ;
|
||||
MainScreen.gpu->SetBLDY_EVY(val);
|
||||
break ;
|
||||
case REG_DISPB_BLDY:
|
||||
GPU_setBLDY_EVY(SubScreen.gpu,val) ;
|
||||
SubScreen.gpu->SetBLDY_EVY(val);
|
||||
break;
|
||||
|
||||
case REG_AUXSPICNT:
|
||||
|
@ -3661,25 +3661,25 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
|
|||
return;
|
||||
|
||||
case REG_DISPA_BLDCNT:
|
||||
GPU_setBLDCNT(MainScreen.gpu,val) ;
|
||||
MainScreen.gpu->SetBLDCNT(val);
|
||||
break ;
|
||||
case REG_DISPB_BLDCNT:
|
||||
GPU_setBLDCNT(SubScreen.gpu,val) ;
|
||||
SubScreen.gpu->SetBLDCNT(val);
|
||||
break ;
|
||||
case REG_DISPA_BLDALPHA:
|
||||
MainScreen.gpu->setBLDALPHA(val);
|
||||
MainScreen.gpu->SetBLDALPHA(val);
|
||||
break ;
|
||||
case REG_DISPB_BLDALPHA:
|
||||
SubScreen.gpu->setBLDALPHA(val);
|
||||
SubScreen.gpu->SetBLDALPHA(val);
|
||||
break ;
|
||||
case REG_DISPA_BLDY:
|
||||
GPU_setBLDY_EVY(MainScreen.gpu,val) ;
|
||||
MainScreen.gpu->SetBLDY_EVY(val);
|
||||
break ;
|
||||
case REG_DISPB_BLDY:
|
||||
GPU_setBLDY_EVY(SubScreen.gpu,val) ;
|
||||
SubScreen.gpu->SetBLDY_EVY(val);
|
||||
break;
|
||||
case REG_DISPA_MASTERBRIGHT:
|
||||
GPU_setMasterBrightness (MainScreen.gpu, val);
|
||||
MainScreen.gpu->SetMasterBrightness(val);
|
||||
break;
|
||||
/*
|
||||
case REG_DISPA_MOSAIC:
|
||||
|
@ -3715,34 +3715,34 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
|
|||
// break;
|
||||
|
||||
case REG_DISPA_WIN0H:
|
||||
GPU_setWIN0_H (MainScreen.gpu,val) ;
|
||||
MainScreen.gpu->SetWIN0_H(val);
|
||||
break ;
|
||||
case REG_DISPA_WIN1H:
|
||||
GPU_setWIN1_H(MainScreen.gpu,val) ;
|
||||
MainScreen.gpu->SetWIN1_H(val);
|
||||
break ;
|
||||
case REG_DISPB_WIN0H:
|
||||
GPU_setWIN0_H(SubScreen.gpu,val) ;
|
||||
SubScreen.gpu->SetWIN0_H(val);
|
||||
break ;
|
||||
case REG_DISPB_WIN1H:
|
||||
GPU_setWIN1_H(SubScreen.gpu,val) ;
|
||||
SubScreen.gpu->SetWIN1_H(val);
|
||||
break ;
|
||||
case REG_DISPA_WIN0V:
|
||||
GPU_setWIN0_V(MainScreen.gpu,val) ;
|
||||
MainScreen.gpu->SetWIN0_V(val);
|
||||
break ;
|
||||
case REG_DISPA_WIN1V:
|
||||
GPU_setWIN1_V(MainScreen.gpu,val) ;
|
||||
MainScreen.gpu->SetWIN1_V(val);
|
||||
break ;
|
||||
case REG_DISPB_WIN0V:
|
||||
GPU_setWIN0_V(SubScreen.gpu,val) ;
|
||||
SubScreen.gpu->SetWIN0_V(val);
|
||||
break ;
|
||||
case REG_DISPB_WIN1V:
|
||||
GPU_setWIN1_V(SubScreen.gpu,val) ;
|
||||
SubScreen.gpu->SetWIN1_V(val);
|
||||
break ;
|
||||
case REG_DISPA_WININ:
|
||||
GPU_setWININ(MainScreen.gpu, val) ;
|
||||
MainScreen.gpu->SetWININ(val);
|
||||
break ;
|
||||
case REG_DISPA_WINOUT:
|
||||
GPU_setWINOUT16(MainScreen.gpu, val) ;
|
||||
MainScreen.gpu->SetWINOUT16(val);
|
||||
break ;
|
||||
|
||||
/* case REG_DISPB_BG0HOFS:
|
||||
|
@ -3771,14 +3771,14 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
|
|||
break;*/
|
||||
|
||||
case REG_DISPB_WININ:
|
||||
GPU_setWININ(SubScreen.gpu, val) ;
|
||||
SubScreen.gpu->SetWININ(val);
|
||||
break ;
|
||||
case REG_DISPB_WINOUT:
|
||||
GPU_setWINOUT16(SubScreen.gpu, val) ;
|
||||
SubScreen.gpu->SetWINOUT16(val);
|
||||
break ;
|
||||
|
||||
case REG_DISPB_MASTERBRIGHT:
|
||||
GPU_setMasterBrightness (SubScreen.gpu, val);
|
||||
SubScreen.gpu->SetMasterBrightness(val);
|
||||
break;
|
||||
|
||||
case REG_POWCNT1:
|
||||
|
@ -3808,42 +3808,42 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
|
|||
|
||||
case REG_DISPA_BG0CNT :
|
||||
//GPULOG("MAIN BG0 SETPROP 16B %08X\r\n", val);
|
||||
GPU_setBGProp(MainScreen.gpu, 0, val);
|
||||
MainScreen.gpu->SetBGProp(0, val);
|
||||
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x8, val);
|
||||
return;
|
||||
case REG_DISPA_BG1CNT :
|
||||
//GPULOG("MAIN BG1 SETPROP 16B %08X\r\n", val);
|
||||
GPU_setBGProp(MainScreen.gpu, 1, val);
|
||||
MainScreen.gpu->SetBGProp(1, val);
|
||||
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0xA, val);
|
||||
return;
|
||||
case REG_DISPA_BG2CNT :
|
||||
//GPULOG("MAIN BG2 SETPROP 16B %08X\r\n", val);
|
||||
GPU_setBGProp(MainScreen.gpu, 2, val);
|
||||
MainScreen.gpu->SetBGProp(2, val);
|
||||
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0xC, val);
|
||||
return;
|
||||
case REG_DISPA_BG3CNT :
|
||||
//GPULOG("MAIN BG3 SETPROP 16B %08X\r\n", val);
|
||||
GPU_setBGProp(MainScreen.gpu, 3, val);
|
||||
MainScreen.gpu->SetBGProp(3, val);
|
||||
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0xE, val);
|
||||
return;
|
||||
case REG_DISPB_BG0CNT :
|
||||
//GPULOG("SUB BG0 SETPROP 16B %08X\r\n", val);
|
||||
GPU_setBGProp(SubScreen.gpu, 0, val);
|
||||
SubScreen.gpu->SetBGProp(0, val);
|
||||
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x1008, val);
|
||||
return;
|
||||
case REG_DISPB_BG1CNT :
|
||||
//GPULOG("SUB BG1 SETPROP 16B %08X\r\n", val);
|
||||
GPU_setBGProp(SubScreen.gpu, 1, val);
|
||||
SubScreen.gpu->SetBGProp(1, val);
|
||||
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x100A, val);
|
||||
return;
|
||||
case REG_DISPB_BG2CNT :
|
||||
//GPULOG("SUB BG2 SETPROP 16B %08X\r\n", val);
|
||||
GPU_setBGProp(SubScreen.gpu, 2, val);
|
||||
SubScreen.gpu->SetBGProp(2, val);
|
||||
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x100C, val);
|
||||
return;
|
||||
case REG_DISPB_BG3CNT :
|
||||
//GPULOG("SUB BG3 SETPROP 16B %08X\r\n", val);
|
||||
GPU_setBGProp(SubScreen.gpu, 3, val);
|
||||
SubScreen.gpu->SetBGProp(3, val);
|
||||
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x100E, val);
|
||||
return;
|
||||
|
||||
|
@ -3898,14 +3898,14 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
|
|||
case REG_DISPA_DISPCNT :
|
||||
{
|
||||
u32 v = (T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0) & 0xFFFF0000) | val;
|
||||
GPU_setVideoProp(MainScreen.gpu, v);
|
||||
MainScreen.gpu->SetVideoProp(v);
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0, v);
|
||||
return;
|
||||
}
|
||||
case REG_DISPA_DISPCNT+2 :
|
||||
{
|
||||
u32 v = (T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0) & 0xFFFF) | ((u32) val << 16);
|
||||
GPU_setVideoProp(MainScreen.gpu, v);
|
||||
MainScreen.gpu->SetVideoProp(v);
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0, v);
|
||||
}
|
||||
return;
|
||||
|
@ -3927,7 +3927,7 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
|
|||
case REG_DISPB_DISPCNT :
|
||||
{
|
||||
u32 v = (T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x1000) & 0xFFFF0000) | val;
|
||||
GPU_setVideoProp(SubScreen.gpu, v);
|
||||
SubScreen.gpu->SetVideoProp(v);
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x1000, v);
|
||||
return;
|
||||
}
|
||||
|
@ -3935,7 +3935,7 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
|
|||
{
|
||||
//emu_halt();
|
||||
u32 v = (T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x1000) & 0xFFFF) | ((u32) val << 16);
|
||||
GPU_setVideoProp(SubScreen.gpu, v);
|
||||
SubScreen.gpu->SetVideoProp(v);
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x1000, v);
|
||||
return;
|
||||
}
|
||||
|
@ -4187,77 +4187,77 @@ void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
|
|||
|
||||
case REG_DISPA_WININ:
|
||||
{
|
||||
GPU_setWININ(MainScreen.gpu, val & 0xFFFF) ;
|
||||
GPU_setWINOUT16(MainScreen.gpu, (val >> 16) & 0xFFFF) ;
|
||||
MainScreen.gpu->SetWININ(val & 0xFFFF) ;
|
||||
MainScreen.gpu->SetWINOUT16((val >> 16) & 0xFFFF) ;
|
||||
break;
|
||||
}
|
||||
case REG_DISPB_WININ:
|
||||
{
|
||||
GPU_setWININ(SubScreen.gpu, val & 0xFFFF) ;
|
||||
GPU_setWINOUT16(SubScreen.gpu, (val >> 16) & 0xFFFF) ;
|
||||
SubScreen.gpu->SetWININ(val & 0xFFFF) ;
|
||||
SubScreen.gpu->SetWINOUT16((val >> 16) & 0xFFFF) ;
|
||||
break;
|
||||
}
|
||||
|
||||
case REG_DISPA_WIN0H:
|
||||
{
|
||||
GPU_setWIN0_H(MainScreen.gpu, val&0xFFFF);
|
||||
GPU_setWIN1_H(MainScreen.gpu, val>>16);
|
||||
MainScreen.gpu->SetWIN0_H(val & 0xFFFF);
|
||||
MainScreen.gpu->SetWIN1_H(val >> 16);
|
||||
break;
|
||||
}
|
||||
case REG_DISPA_WIN0V:
|
||||
{
|
||||
GPU_setWIN0_V(MainScreen.gpu, val&0xFFFF);
|
||||
GPU_setWIN1_V(MainScreen.gpu, val>>16);
|
||||
MainScreen.gpu->SetWIN0_V(val & 0xFFFF);
|
||||
MainScreen.gpu->SetWIN1_V(val >> 16);
|
||||
break;
|
||||
}
|
||||
case REG_DISPB_WIN0H:
|
||||
{
|
||||
GPU_setWIN0_H(SubScreen.gpu, val&0xFFFF);
|
||||
GPU_setWIN1_H(SubScreen.gpu, val>>16);
|
||||
SubScreen.gpu->SetWIN0_H(val & 0xFFFF);
|
||||
SubScreen.gpu->SetWIN1_H(val >> 16);
|
||||
break;
|
||||
}
|
||||
case REG_DISPB_WIN0V:
|
||||
{
|
||||
GPU_setWIN0_V(SubScreen.gpu, val&0xFFFF);
|
||||
GPU_setWIN1_V(SubScreen.gpu, val>>16);
|
||||
SubScreen.gpu->SetWIN0_V(val & 0xFFFF);
|
||||
SubScreen.gpu->SetWIN1_V(val >> 16);
|
||||
break;
|
||||
}
|
||||
|
||||
case REG_DISPA_MASTERBRIGHT:
|
||||
GPU_setMasterBrightness(MainScreen.gpu, val & 0xFFFF);
|
||||
MainScreen.gpu->SetMasterBrightness(val & 0xFFFF);
|
||||
break;
|
||||
case REG_DISPB_MASTERBRIGHT:
|
||||
GPU_setMasterBrightness(SubScreen.gpu, val & 0xFFFF);
|
||||
SubScreen.gpu->SetMasterBrightness(val & 0xFFFF);
|
||||
break;
|
||||
|
||||
case REG_DISPA_BLDCNT:
|
||||
{
|
||||
GPU_setBLDCNT (MainScreen.gpu,val&0xffff);
|
||||
MainScreen.gpu->setBLDALPHA(val>>16);
|
||||
MainScreen.gpu->SetBLDCNT(val & 0xFFFF);
|
||||
MainScreen.gpu->SetBLDALPHA(val >> 16);
|
||||
break;
|
||||
}
|
||||
case REG_DISPB_BLDCNT:
|
||||
{
|
||||
GPU_setBLDCNT (SubScreen.gpu,val&0xffff);
|
||||
SubScreen.gpu->setBLDALPHA(val>>16);
|
||||
SubScreen.gpu->SetBLDCNT(val & 0xFFFF);
|
||||
SubScreen.gpu->SetBLDALPHA(val >> 16);
|
||||
break;
|
||||
}
|
||||
|
||||
case REG_DISPA_BLDY:
|
||||
GPU_setBLDY_EVY(MainScreen.gpu,val&0xFFFF) ;
|
||||
MainScreen.gpu->SetBLDY_EVY(val & 0xFFFF);
|
||||
break ;
|
||||
case REG_DISPB_BLDY:
|
||||
GPU_setBLDY_EVY(SubScreen.gpu,val&0xFFFF);
|
||||
SubScreen.gpu->SetBLDY_EVY(val & 0xFFFF);
|
||||
break;
|
||||
|
||||
case REG_DISPA_DISPCNT :
|
||||
GPU_setVideoProp(MainScreen.gpu, val);
|
||||
MainScreen.gpu->SetVideoProp(val);
|
||||
//GPULOG("MAIN INIT 32B %08X\r\n", val);
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0, val);
|
||||
return;
|
||||
|
||||
case REG_DISPB_DISPCNT :
|
||||
GPU_setVideoProp(SubScreen.gpu, val);
|
||||
SubScreen.gpu->SetVideoProp(val);
|
||||
//GPULOG("SUB INIT 32B %08X\r\n", val);
|
||||
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x1000, val);
|
||||
return;
|
||||
|
@ -4353,25 +4353,25 @@ void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
|
|||
return;
|
||||
|
||||
case REG_DISPA_BG0CNT :
|
||||
GPU_setBGProp(MainScreen.gpu, 0, (val&0xFFFF));
|
||||
GPU_setBGProp(MainScreen.gpu, 1, (val>>16));
|
||||
MainScreen.gpu->SetBGProp(0, (val & 0xFFFF));
|
||||
MainScreen.gpu->SetBGProp(1, (val >> 16));
|
||||
//if((val>>16)==0x400) emu_halt();
|
||||
T1WriteLong(MMU.ARM9_REG, 8, val);
|
||||
return;
|
||||
case REG_DISPA_BG2CNT :
|
||||
GPU_setBGProp(MainScreen.gpu, 2, (val&0xFFFF));
|
||||
GPU_setBGProp(MainScreen.gpu, 3, (val>>16));
|
||||
T1WriteLong(MMU.ARM9_REG, 0xC, val);
|
||||
MainScreen.gpu->SetBGProp(2, (val & 0xFFFF));
|
||||
MainScreen.gpu->SetBGProp(3, (val >> 16));
|
||||
T1WriteLong(MMU.ARM9_REG, 0xC, val);
|
||||
return;
|
||||
case REG_DISPB_BG0CNT :
|
||||
GPU_setBGProp(SubScreen.gpu, 0, (val&0xFFFF));
|
||||
GPU_setBGProp(SubScreen.gpu, 1, (val>>16));
|
||||
T1WriteLong(MMU.ARM9_REG, 0x1008, val);
|
||||
SubScreen.gpu->SetBGProp(0, (val & 0xFFFF));
|
||||
SubScreen.gpu->SetBGProp(1, (val >> 16));
|
||||
T1WriteLong(MMU.ARM9_REG, 0x1008, val);
|
||||
return;
|
||||
case REG_DISPB_BG2CNT :
|
||||
GPU_setBGProp(SubScreen.gpu, 2, (val&0xFFFF));
|
||||
GPU_setBGProp(SubScreen.gpu, 3, (val>>16));
|
||||
T1WriteLong(MMU.ARM9_REG, 0x100C, val);
|
||||
SubScreen.gpu->SetBGProp(2, (val & 0xFFFF));
|
||||
SubScreen.gpu->SetBGProp(3, (val >> 16));
|
||||
T1WriteLong(MMU.ARM9_REG, 0x100C, val);
|
||||
return;
|
||||
case REG_DISPA_DISPMMEMFIFO:
|
||||
{
|
||||
|
|
|
@ -798,7 +798,7 @@ public:
|
|||
SkipNext2DFrame = false;
|
||||
nextSkip = false;
|
||||
}
|
||||
else if((lastDisplayTarget != MainScreen.gpu->targetDisplayID) && lastSkip && !skipped)
|
||||
else if((lastDisplayTarget != MainScreen.gpu->GetDisplayByID()) && lastSkip && !skipped)
|
||||
{
|
||||
// if we're switching from not skipping to skipping
|
||||
// and the screens are also switching around this frame,
|
||||
|
@ -813,7 +813,7 @@ public:
|
|||
else if(!(consecutiveNonCaptures > 9000)) // arbitrary cap to avoid eventual wrap
|
||||
consecutiveNonCaptures++;
|
||||
|
||||
lastDisplayTarget = MainScreen.gpu->targetDisplayID;
|
||||
lastDisplayTarget = MainScreen.gpu->GetDisplayByID();
|
||||
lastSkip = skipped;
|
||||
skipped = nextSkip;
|
||||
nextSkip = false;
|
||||
|
|
|
@ -728,7 +728,7 @@ GPU3DInterface *core3DList[] = {
|
|||
|
||||
void SetGPULayerState(const GPUType gpuType, const unsigned int i, const bool state)
|
||||
{
|
||||
GPU *theGpu = NULL;
|
||||
GPUEngineBase *theGpu = NULL;
|
||||
|
||||
// Check bounds on the layer index.
|
||||
if (i > 4)
|
||||
|
@ -757,14 +757,7 @@ void SetGPULayerState(const GPUType gpuType, const unsigned int i, const bool st
|
|||
|
||||
if (theGpu != NULL)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
GPU_addBack(theGpu, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
GPU_remove(theGpu, i);
|
||||
}
|
||||
theGpu->SetLayerState(i, state);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -525,11 +525,9 @@ void on_wgt_Exec_toggled (GtkToggleToolButton *toggletoolbutton, gpointer user
|
|||
/* LAYERS ***** ***** ***** ***** */
|
||||
static void change_bgx_layer(int layer, gboolean state, NDS_Screen scr) {
|
||||
//if(!desmume_running()) return;
|
||||
if(state==TRUE) {
|
||||
GPU_addBack(scr.gpu, layer);
|
||||
} else {
|
||||
GPU_remove(scr.gpu, layer);
|
||||
}
|
||||
|
||||
scr.gpu->SetLayerState(layer, (state) ? true : false);
|
||||
|
||||
//fprintf(stderr,"Changed Layer %s to %d\n",layer,state);
|
||||
}
|
||||
void on_wc_1_BGXX_toggled (GtkToggleButton *togglebutton, gpointer user_data) {
|
||||
|
|
|
@ -277,7 +277,7 @@ static void my_gl_ScreenTexApply(int screen) {
|
|||
|
||||
gboolean screen (GtkWidget * widget, int viewportscreen) {
|
||||
int screen;
|
||||
GPU * gpu;
|
||||
GPUEngineBase * gpu;
|
||||
float bright_color = 0.0f; // blend with black
|
||||
float bright_alpha = 0.0f; // don't blend
|
||||
|
||||
|
|
|
@ -2127,22 +2127,14 @@ static void ToggleLayerVisibility(GtkToggleAction* action, gpointer data)
|
|||
case MAIN_BG_2:
|
||||
case MAIN_BG_3:
|
||||
case MAIN_OBJ:
|
||||
if(active == TRUE) {
|
||||
GPU_addBack(MainScreen.gpu, Layer);
|
||||
} else {
|
||||
GPU_remove(MainScreen.gpu, Layer);
|
||||
}
|
||||
MainScreen.gpu->SetLayerState(Layer, (active == TRUE) ? true : false);
|
||||
break;
|
||||
case SUB_BG_0:
|
||||
case SUB_BG_1:
|
||||
case SUB_BG_2:
|
||||
case SUB_BG_3:
|
||||
case SUB_OBJ:
|
||||
if(active == TRUE) {
|
||||
GPU_addBack(SubScreen.gpu, Layer-SUB_BG_0);
|
||||
} else {
|
||||
GPU_remove(SubScreen.gpu, Layer-SUB_BG_0);
|
||||
}
|
||||
SubScreen.gpu->SetLayerState(Layer-SUB_BG_0, (active == TRUE) ? true : false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -4382,18 +4382,11 @@ void SaveWindowPos(HWND hwnd)
|
|||
|
||||
static void TwiddleLayer(UINT ctlid, int core, int layer)
|
||||
{
|
||||
GPU* gpu = core==0?MainScreen.gpu:SubScreen.gpu;
|
||||
if(CommonSettings.dispLayers[core][layer])
|
||||
{
|
||||
GPU_remove(gpu,layer);
|
||||
MainWindow->checkMenu(ctlid, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
GPU_addBack(gpu,layer);
|
||||
MainWindow->checkMenu(ctlid, true);
|
||||
}
|
||||
GPUEngineBase *gpu = ((GPUCoreID)core == GPUCOREID_MAIN) ? MainScreen.gpu : SubScreen.gpu;
|
||||
|
||||
const bool newLayerState = !CommonSettings.dispLayers[core][layer];
|
||||
gpu->SetLayerState(layer, newLayerState);
|
||||
MainWindow->checkMenu(ctlid, newLayerState);
|
||||
}
|
||||
|
||||
//========================================================================================
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "main.h"
|
||||
#include "windriver.h"
|
||||
|
||||
using namespace GPU_EXT;
|
||||
|
||||
struct mapview_struct
|
||||
{
|
||||
|
@ -45,18 +44,18 @@ struct mapview_struct
|
|||
{
|
||||
//we're going to make a copy of the gpu so that we don't wreck affine scroll params
|
||||
//hopefully we won't mess up anything else
|
||||
GPU *realGpu;
|
||||
GPUEngineBase *realGpu;
|
||||
if(lcd) realGpu = SubScreen.gpu;
|
||||
else realGpu = MainScreen.gpu;
|
||||
GPU &gpu = *realGpu;
|
||||
GPUEngineBase &gpu = *realGpu;
|
||||
|
||||
//forgive the gyrations, some of this junk in here is to remind us of gyrations we might have to go
|
||||
//through to avoid breaking the gpu struct
|
||||
|
||||
gpu.currBgNum = map;
|
||||
gpu.debug = true;
|
||||
int temp = gpu.setFinalColorBck_funcNum;
|
||||
gpu.setFinalColorBck_funcNum = 0; //hax... why arent we copying gpu now?? i cant remember
|
||||
int temp = gpu.GetFinalColorBckFuncID();
|
||||
gpu.SetFinalColorBckFuncID(0); //hax... why arent we copying gpu now?? i cant remember
|
||||
|
||||
memset(bitmap,0,sizeof(bitmap));
|
||||
|
||||
|
@ -64,11 +63,11 @@ struct mapview_struct
|
|||
{
|
||||
gpu.currDst = bitmap + i*gpu.BGSize[map][0];
|
||||
gpu.currLine = i;
|
||||
gpu.modeRender<false>(map);
|
||||
gpu.ModeRender<false>(map);
|
||||
}
|
||||
gpu.debug = false;
|
||||
gpu.setFinalColorBck_funcNum = temp;
|
||||
|
||||
gpu.debug = false;
|
||||
gpu.SetFinalColorBckFuncID(temp);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ typedef struct
|
|||
|
||||
s16 num;
|
||||
void*oam;
|
||||
GPU *gpu;
|
||||
GPUEngineBase *gpu;
|
||||
u8 scale;
|
||||
bool border;
|
||||
} oamview_struct;
|
||||
|
@ -220,11 +220,11 @@ LRESULT OamView_OnPaint(HWND hwnd, oamview_struct *win, WPARAM wParam, LPARAM lP
|
|||
SetWindowText(GetDlgItem(hwnd, IDC_PROP1), "");
|
||||
}
|
||||
|
||||
GPU copy = *win->gpu;
|
||||
GPUEngineBase copy = *win->gpu;
|
||||
for(i = 0; i < 192; ++i)
|
||||
{
|
||||
copy.currLine = i;
|
||||
copy.spriteRender((u16*)(bitmap + i*256), bitmap_alpha + i*256, type + i*256, prio + i*256);
|
||||
copy.SpriteRender((u16*)(bitmap + i*256), bitmap_alpha + i*256, type + i*256, prio + i*256);
|
||||
}
|
||||
|
||||
u32 width = dimm_int[(oam->attr1>>14)][(oam->attr0>>14)][0];
|
||||
|
|
Loading…
Reference in New Issue