2014-12-12 09:41:37 +00:00
|
|
|
#include <assert.h>
|
2014-11-25 06:11:18 +00:00
|
|
|
#include <memory.h>
|
2015-05-04 14:11:21 +00:00
|
|
|
#include <cstring>
|
2013-04-05 06:13:26 +00:00
|
|
|
#include "N64.h"
|
|
|
|
#include "RSP.h"
|
2014-10-07 10:59:54 +00:00
|
|
|
#include "RDP.h"
|
2013-04-05 06:13:26 +00:00
|
|
|
#include "GBI.h"
|
|
|
|
#include "gDP.h"
|
2014-11-22 13:39:10 +00:00
|
|
|
#include "gSP.h"
|
2016-09-22 15:11:01 +00:00
|
|
|
#include "Config.h"
|
2017-05-25 08:54:30 +00:00
|
|
|
#include "DebugDump.h"
|
2017-01-15 07:57:25 +00:00
|
|
|
#include "DisplayWindow.h"
|
2013-04-05 06:13:26 +00:00
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
#ifdef NATIVE
|
|
|
|
#define RDRAM ((u8*)0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define SIGN_MASK(n) (1 << (12 - 1))
|
|
|
|
|
|
|
|
#define SIGN12(a) \
|
|
|
|
(a & SIGN_MASK(12) ? \
|
|
|
|
(((1 << 12) / 2 - (a & (SIGN_MASK(12) - 1))) * -1) \
|
|
|
|
: (a))
|
|
|
|
|
|
|
|
void RDP_Unknown( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2017-05-25 08:54:30 +00:00
|
|
|
DebugMsg(DEBUG_NORMAL, "RDP_Unknown\r\n");
|
2022-01-16 17:27:17 +00:00
|
|
|
DebugMsg(DEBUG_NORMAL, "\tUnknown RDP opcode %02X\r\n", _SHIFTR(words.w0, 24, 8));
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_NoOp( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPNoOp(words);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RDP_MarkSegment(const Gwords words) {
|
|
|
|
RSP.translateSegment = true;
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_SetCImg( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPSetColorImage( _SHIFTR( words.w0, 21, 3 ), // fmt
|
|
|
|
_SHIFTR( words.w0, 19, 2 ), // siz
|
|
|
|
_SHIFTR( words.w0, 0, 12 ) + 1, // width
|
|
|
|
words.w1 ); // img
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_SetZImg( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPSetDepthImage( words.w1 ); // img
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_SetTImg( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPSetTextureImage( _SHIFTR( words.w0, 21, 3), // fmt
|
|
|
|
_SHIFTR( words.w0, 19, 2 ), // siz
|
|
|
|
_SHIFTR( words.w0, 0, 12 ) + 1, // width
|
|
|
|
words.w1 ); // img
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_SetCombine( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPSetCombine( _SHIFTR( words.w0, 0, 24 ), // muxs0
|
|
|
|
words.w1 ); // muxs1
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_SetEnvColor( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPSetEnvColor( _SHIFTR( words.w1, 24, 8 ), // r
|
|
|
|
_SHIFTR( words.w1, 16, 8 ), // g
|
|
|
|
_SHIFTR( words.w1, 8, 8 ), // b
|
|
|
|
_SHIFTR( words.w1, 0, 8 ) ); // a
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_SetPrimColor( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPSetPrimColor( _SHIFTR( words.w0, 8, 5 ), // m
|
|
|
|
_SHIFTR( words.w0, 0, 8 ), // l
|
|
|
|
_SHIFTR( words.w1, 24, 8 ), // r
|
|
|
|
_SHIFTR( words.w1, 16, 8 ), // g
|
|
|
|
_SHIFTR( words.w1, 8, 8 ), // b
|
|
|
|
_SHIFTR( words.w1, 0, 8 ) ); // a
|
2013-04-05 06:13:26 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_SetBlendColor( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPSetBlendColor( _SHIFTR( words.w1, 24, 8 ), // r
|
|
|
|
_SHIFTR( words.w1, 16, 8 ), // g
|
|
|
|
_SHIFTR( words.w1, 8, 8 ), // b
|
|
|
|
_SHIFTR( words.w1, 0, 8 ) ); // a
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_SetFogColor( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPSetFogColor( _SHIFTR( words.w1, 24, 8 ), // r
|
|
|
|
_SHIFTR( words.w1, 16, 8 ), // g
|
|
|
|
_SHIFTR( words.w1, 8, 8 ), // b
|
|
|
|
_SHIFTR( words.w1, 0, 8 ) ); // a
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_SetFillColor( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPSetFillColor( words.w1 );
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_FillRect( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
const u32 ulx = _SHIFTR(words.w1, 14, 10);
|
|
|
|
const u32 uly = _SHIFTR(words.w1, 2, 10);
|
|
|
|
const u32 lrx = _SHIFTR(words.w0, 14, 10);
|
|
|
|
const u32 lry = _SHIFTR(words.w0, 2, 10);
|
2014-12-23 13:42:30 +00:00
|
|
|
if (lrx < ulx || lry < uly)
|
|
|
|
return;
|
|
|
|
gDPFillRectangle(ulx, uly, lrx, lry);
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_SetTile( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPSetTile( _SHIFTR( words.w0, 21, 3 ), // fmt
|
|
|
|
_SHIFTR( words.w0, 19, 2 ), // siz
|
|
|
|
_SHIFTR( words.w0, 9, 9 ), // line
|
|
|
|
_SHIFTR( words.w0, 0, 9 ), // tmem
|
|
|
|
_SHIFTR( words.w1, 24, 3 ), // tile
|
|
|
|
_SHIFTR( words.w1, 20, 4 ), // palette
|
|
|
|
_SHIFTR( words.w1, 18, 2 ), // cmt
|
|
|
|
_SHIFTR( words.w1, 8, 2 ), // cms
|
|
|
|
_SHIFTR( words.w1, 14, 4 ), // maskt
|
|
|
|
_SHIFTR( words.w1, 4, 4 ), // masks
|
|
|
|
_SHIFTR( words.w1, 10, 4 ), // shiftt
|
|
|
|
_SHIFTR( words.w1, 0, 4 ) ); // shifts
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-03-29 21:42:02 +00:00
|
|
|
#define LRS_UPPER_VALUE (_SHIFTR(words.w1, 27, 5) << 12)
|
|
|
|
#define TILE_VALUE _SHIFTR(words.w1, 24, 3)
|
|
|
|
#define LRS_VALUE _SHIFTR(words.w1, 12, 12)
|
|
|
|
#define LRT_VALUE _SHIFTR(words.w1, 0, 12)
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_LoadTile( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-03-29 21:42:02 +00:00
|
|
|
gDPLoadTile( TILE_VALUE, // tile
|
2022-01-16 17:27:17 +00:00
|
|
|
_SHIFTR( words.w0, 12, 12 ), // uls
|
|
|
|
_SHIFTR( words.w0, 0, 12 ), // ult
|
2022-03-29 21:42:02 +00:00
|
|
|
LRS_VALUE | LRS_UPPER_VALUE, // lrs
|
|
|
|
LRT_VALUE ); // lrt
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2014-10-18 15:35:02 +00:00
|
|
|
static u32 lbw0, lbw1;
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_LoadBlock( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
lbw0 = words.w0;
|
|
|
|
lbw1 = words.w1;
|
2022-03-29 21:42:02 +00:00
|
|
|
gDPLoadBlock( TILE_VALUE, // tile
|
2022-01-16 17:27:17 +00:00
|
|
|
_SHIFTR( words.w0, 12, 12 ), // uls
|
|
|
|
_SHIFTR( words.w0, 0, 12 ), // ult
|
2022-03-29 21:42:02 +00:00
|
|
|
LRS_VALUE | LRS_UPPER_VALUE, // lrs
|
|
|
|
LRT_VALUE ); // dxt
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2015-06-14 16:57:53 +00:00
|
|
|
void RDP_RepeatLastLoadBlock()
|
2014-10-18 15:35:02 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
RDP_LoadBlock(Gwords(lbw0, lbw1));
|
2014-10-18 15:35:02 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_SetTileSize( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-03-29 21:42:02 +00:00
|
|
|
gDPSetTileSize( TILE_VALUE, // tile
|
2022-01-16 17:27:17 +00:00
|
|
|
_SHIFTR( words.w0, 12, 12 ), // uls
|
|
|
|
_SHIFTR( words.w0, 0, 12 ), // ult
|
2022-03-29 21:42:02 +00:00
|
|
|
LRS_VALUE | LRS_UPPER_VALUE, // lrs
|
|
|
|
LRT_VALUE ); // lrt
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_LoadTLUT( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-03-29 21:42:02 +00:00
|
|
|
gDPLoadTLUT( TILE_VALUE, // tile
|
2022-01-16 17:27:17 +00:00
|
|
|
_SHIFTR( words.w0, 12, 12 ), // uls
|
|
|
|
_SHIFTR( words.w0, 0, 12 ), // ult
|
2022-03-29 21:42:02 +00:00
|
|
|
LRS_VALUE | LRS_UPPER_VALUE, // lrs
|
|
|
|
LRT_VALUE ); // lrt
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_SetOtherMode( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPSetOtherMode( _SHIFTR( words.w0, 0, 24 ), // mode0
|
|
|
|
words.w1 ); // mode1
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_SetPrimDepth( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPSetPrimDepth( _SHIFTR( words.w1, 16, 16 ), // z
|
|
|
|
_SHIFTR( words.w1, 0, 16 ) ); // dz
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_SetScissor( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPSetScissor( _SHIFTR( words.w1, 24, 2 ), // mode
|
|
|
|
_SHIFTR( words.w0, 12, 12 ), // ulx
|
|
|
|
_SHIFTR( words.w0, 0, 12 ), // uly
|
|
|
|
_SHIFTR( words.w1, 12, 12 ), // lrx
|
|
|
|
_SHIFTR( words.w1, 0, 12 ) ); // lry
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_SetConvert( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPSetConvert( _SHIFTR( words.w0, 13, 9 ), // k0
|
|
|
|
_SHIFTR( words.w0, 4, 9 ), // k1
|
|
|
|
_SHIFTL( words.w0, 5, 4 ) | _SHIFTR( words.w1, 27, 5 ), // k2
|
|
|
|
_SHIFTR( words.w1, 18, 9 ), // k3
|
|
|
|
_SHIFTR( words.w1, 9, 9 ), // k4
|
|
|
|
_SHIFTR( words.w1, 0, 9 ) ); // k5
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_SetKeyR( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPSetKeyR( _SHIFTR( words.w1, 8, 8 ), // cR
|
|
|
|
_SHIFTR( words.w1, 0, 8 ), // sR
|
|
|
|
_SHIFTR( words.w1, 16, 12 ) ); // wR
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_SetKeyGB( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPSetKeyGB( _SHIFTR( words.w1, 24, 8 ), // cG
|
|
|
|
_SHIFTR( words.w1, 16, 8 ), // sG
|
|
|
|
_SHIFTR( words.w0, 12, 12 ), // wG
|
|
|
|
_SHIFTR( words.w1, 8, 8 ), // cB
|
|
|
|
_SHIFTR( words.w1, 0, 8 ), // SB
|
|
|
|
_SHIFTR( words.w0, 0, 12 ) ); // wB
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_FullSync( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
|
|
|
gDPFullSync();
|
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_TileSync( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
|
|
|
gDPTileSync();
|
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_PipeSync( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPPipeSync(words);
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_LoadSync( const Gwords words )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
|
|
|
gDPLoadSync();
|
|
|
|
}
|
|
|
|
|
2014-12-12 09:41:37 +00:00
|
|
|
static
|
2022-01-16 17:27:17 +00:00
|
|
|
bool _getTexRectParams(word & w2, word & w3)
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2017-10-24 06:34:22 +00:00
|
|
|
if (RSP.LLE) {
|
2014-10-07 10:59:54 +00:00
|
|
|
w2 = RDP.w2;
|
|
|
|
w3 = RDP.w3;
|
2016-09-28 10:31:35 +00:00
|
|
|
return true;
|
2014-12-12 09:41:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
enum {
|
|
|
|
gspTexRect,
|
|
|
|
gdpTexRect,
|
|
|
|
halfTexRect
|
|
|
|
} texRectMode = gdpTexRect;
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
const word cmd1 = (*(word*)&RDRAM[RSP.PC[RSP.PCi] + 0]) >> 24;
|
|
|
|
const word cmd2 = (*(word*)&RDRAM[RSP.PC[RSP.PCi] + sizeof(Gwords)]) >> 24;
|
2014-12-12 09:41:37 +00:00
|
|
|
if (cmd1 == G_RDPHALF_1) {
|
|
|
|
if (cmd2 == G_RDPHALF_2)
|
|
|
|
texRectMode = gspTexRect;
|
|
|
|
} else if (cmd1 == 0xB3) {
|
2018-08-31 04:37:55 +00:00
|
|
|
texRectMode = halfTexRect;
|
2014-12-21 05:42:52 +00:00
|
|
|
} else if (cmd1 == 0xF1)
|
|
|
|
texRectMode = halfTexRect;
|
2014-12-12 09:41:37 +00:00
|
|
|
|
|
|
|
switch (texRectMode) {
|
|
|
|
case gspTexRect:
|
2022-01-16 17:27:17 +00:00
|
|
|
w2 = *(word*)&RDRAM[RSP.PC[RSP.PCi] + 4];
|
|
|
|
RSP.PC[RSP.PCi] += sizeof(Gwords);
|
2014-10-07 10:59:54 +00:00
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
w3 = *(word*)&RDRAM[RSP.PC[RSP.PCi] + 4];
|
|
|
|
RSP.PC[RSP.PCi] += sizeof(Gwords);
|
2014-12-12 09:41:37 +00:00
|
|
|
break;
|
|
|
|
case gdpTexRect:
|
2016-09-28 10:31:35 +00:00
|
|
|
if ((config.generalEmulation.hacks & hack_WinBack) != 0) {
|
2022-01-16 17:27:17 +00:00
|
|
|
RSP.PC[RSP.PCi] += sizeof(Gwords);
|
2016-09-28 10:31:35 +00:00
|
|
|
return false;
|
|
|
|
}
|
2018-05-24 14:53:00 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
const word ucode = GBI.getMicrocodeType();
|
2018-05-24 14:53:00 +00:00
|
|
|
if (ucode == F5Rogue || ucode == F5Indi_Naboo) {
|
2022-01-16 17:27:17 +00:00
|
|
|
w2 = *(word*)&RDRAM[RSP.PC[RSP.PCi] + 8];
|
|
|
|
w3 = *(word*)&RDRAM[RSP.PC[RSP.PCi] + 12];
|
|
|
|
RSP.PC[RSP.PCi] += sizeof(Gwords);
|
2018-05-24 14:53:00 +00:00
|
|
|
return true;
|
|
|
|
}
|
2017-07-18 10:33:05 +00:00
|
|
|
}
|
2022-01-16 17:27:17 +00:00
|
|
|
w2 = *(word*)&RDRAM[RSP.PC[RSP.PCi] + 0];
|
|
|
|
w3 = *(word*)&RDRAM[RSP.PC[RSP.PCi] + 4];
|
|
|
|
RSP.PC[RSP.PCi] += sizeof(Gwords);
|
2014-12-12 09:41:37 +00:00
|
|
|
break;
|
|
|
|
case halfTexRect:
|
|
|
|
w2 = 0;
|
2022-01-16 17:27:17 +00:00
|
|
|
w3 = *(word*)&RDRAM[RSP.PC[RSP.PCi] + 4];
|
|
|
|
RSP.PC[RSP.PCi] += sizeof(Gwords);
|
2014-12-12 09:41:37 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
assert(false && "Unknown texrect mode");
|
2014-10-07 10:59:54 +00:00
|
|
|
}
|
2016-09-28 10:31:35 +00:00
|
|
|
return true;
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2016-04-14 07:05:19 +00:00
|
|
|
static
|
2022-01-16 17:27:17 +00:00
|
|
|
void _TexRect( const Gwords words, bool flip )
|
2013-04-05 06:13:26 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
word w2, w3;
|
2016-09-28 10:31:35 +00:00
|
|
|
if (!_getTexRectParams(w2, w3))
|
2016-09-22 15:11:01 +00:00
|
|
|
return;
|
2022-01-16 17:27:17 +00:00
|
|
|
RDP.w0 = words.w0;
|
|
|
|
RDP.w1 = words.w1;
|
2022-03-02 07:30:06 +00:00
|
|
|
const u32 rawScalerValue = _SHIFTR(words.w1, 27, 5);
|
|
|
|
const s32 ulx = SIGN12(_SHIFTR(words.w1, 12, 12)) << rawScalerValue;
|
2022-01-16 17:27:17 +00:00
|
|
|
const s32 uly = _SHIFTR(words.w1, 0, 12);
|
2022-03-02 07:30:06 +00:00
|
|
|
const s32 lrx = SIGN12(_SHIFTR(words.w0, 12, 12)) << rawScalerValue;
|
2022-01-16 17:27:17 +00:00
|
|
|
const s32 lry = _SHIFTR(words.w0, 0, 12);
|
2018-11-01 06:23:18 +00:00
|
|
|
if (lrx < ulx || lry < uly)
|
2014-12-23 13:42:30 +00:00
|
|
|
return;
|
2018-11-01 06:23:18 +00:00
|
|
|
if (gDP.otherMode.cycleType == G_CYC_COPY)
|
|
|
|
gDPTextureRectangle(
|
|
|
|
f32(ulx >> 2),
|
|
|
|
f32(uly >> 2),
|
|
|
|
f32(lrx >> 2),
|
|
|
|
f32(lry >> 2),
|
2022-01-16 17:27:17 +00:00
|
|
|
_SHIFTR(words.w1, 24, 3), // tile
|
2018-11-01 06:23:18 +00:00
|
|
|
(s16)_SHIFTR(w2, 16, 16), // s
|
|
|
|
(s16)_SHIFTR(w2, 0, 16), // t
|
|
|
|
_FIXED2FLOAT((s16)_SHIFTR(w3, 16, 16), 10), // dsdx
|
|
|
|
_FIXED2FLOAT((s16)_SHIFTR(w3, 0, 16), 10), // dsdy
|
|
|
|
flip);
|
|
|
|
else
|
|
|
|
gDPTextureRectangle(
|
|
|
|
_FIXED2FLOAT(ulx, 2),
|
|
|
|
_FIXED2FLOAT(uly, 2),
|
|
|
|
_FIXED2FLOAT(lrx, 2),
|
|
|
|
_FIXED2FLOAT(lry, 2),
|
2022-01-16 17:27:17 +00:00
|
|
|
_SHIFTR(words.w1, 24, 3), // tile
|
2018-11-01 06:23:18 +00:00
|
|
|
(s16)_SHIFTR(w2, 16, 16), // s
|
|
|
|
(s16)_SHIFTR(w2, 0, 16), // t
|
|
|
|
_FIXED2FLOAT((s16)_SHIFTR(w3, 16, 16), 10), // dsdx
|
|
|
|
_FIXED2FLOAT((s16)_SHIFTR(w3, 0, 16), 10), // dsdy
|
|
|
|
flip);
|
2016-04-14 07:05:19 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_TexRectFlip( const Gwords words )
|
2016-04-14 07:05:19 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
_TexRect(words, true);
|
2014-12-12 09:41:37 +00:00
|
|
|
}
|
2014-10-07 10:59:54 +00:00
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_TexRect( const Gwords words )
|
2014-12-12 09:41:37 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
_TexRect(words, false);
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_TriFill(const Gwords words)
|
2014-10-07 10:59:54 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPTriFill(words.w0, words.w1);
|
2014-10-07 10:59:54 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_TriShade(const Gwords words)
|
2014-10-07 10:59:54 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPTriShade(words.w0, words.w1);
|
2014-10-07 10:59:54 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_TriTxtr(const Gwords words)
|
2014-10-07 10:59:54 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPTriTxtr(words.w0, words.w1);
|
2014-10-07 10:59:54 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_TriShadeTxtr(const Gwords words)
|
2014-10-07 10:59:54 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPTriShadeTxtr(words.w0, words.w1);
|
2014-10-07 10:59:54 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_TriFillZ(const Gwords words)
|
2014-10-07 10:59:54 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPTriFillZ(words.w0, words.w1);
|
2014-10-07 10:59:54 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_TriShadeZ(const Gwords words)
|
2014-10-07 10:59:54 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPTriShadeZ(words.w0, words.w1);
|
2014-10-07 10:59:54 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_TriTxtrZ(const Gwords words)
|
2014-10-07 10:59:54 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPTriTxtrZ(words.w0, words.w1);
|
2014-10-07 10:59:54 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
void RDP_TriShadeTxtrZ(const Gwords words)
|
2014-10-07 10:59:54 +00:00
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
gDPTriShadeTxtrZ(words.w0, words.w1);
|
2014-10-07 10:59:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RDPInfo RDP;
|
|
|
|
|
2013-04-05 06:13:26 +00:00
|
|
|
void RDP_Init()
|
|
|
|
{
|
|
|
|
// Initialize RDP commands to RDP_UNKNOWN
|
|
|
|
for (int i = 0xC8; i <= 0xCF; i++)
|
|
|
|
GBI.cmd[i] = RDP_Unknown;
|
|
|
|
|
|
|
|
// Initialize RDP commands to RDP_UNKNOWN
|
|
|
|
for (int i = 0xE4; i <= 0xFF; i++)
|
|
|
|
GBI.cmd[i] = RDP_Unknown;
|
|
|
|
|
|
|
|
// Set known GBI commands
|
|
|
|
GBI.cmd[G_NOOP] = RDP_NoOp;
|
|
|
|
GBI.cmd[G_SETCIMG] = RDP_SetCImg;
|
|
|
|
GBI.cmd[G_SETZIMG] = RDP_SetZImg;
|
|
|
|
GBI.cmd[G_SETTIMG] = RDP_SetTImg;
|
|
|
|
GBI.cmd[G_SETCOMBINE] = RDP_SetCombine;
|
|
|
|
GBI.cmd[G_SETENVCOLOR] = RDP_SetEnvColor;
|
|
|
|
GBI.cmd[G_SETPRIMCOLOR] = RDP_SetPrimColor;
|
|
|
|
GBI.cmd[G_SETBLENDCOLOR] = RDP_SetBlendColor;
|
|
|
|
GBI.cmd[G_SETFOGCOLOR] = RDP_SetFogColor;
|
|
|
|
GBI.cmd[G_SETFILLCOLOR] = RDP_SetFillColor;
|
|
|
|
GBI.cmd[G_FILLRECT] = RDP_FillRect;
|
|
|
|
GBI.cmd[G_SETTILE] = RDP_SetTile;
|
|
|
|
GBI.cmd[G_LOADTILE] = RDP_LoadTile;
|
|
|
|
GBI.cmd[G_LOADBLOCK] = RDP_LoadBlock;
|
|
|
|
GBI.cmd[G_SETTILESIZE] = RDP_SetTileSize;
|
|
|
|
GBI.cmd[G_LOADTLUT] = RDP_LoadTLUT;
|
|
|
|
GBI.cmd[G_RDPSETOTHERMODE] = RDP_SetOtherMode;
|
|
|
|
GBI.cmd[G_SETPRIMDEPTH] = RDP_SetPrimDepth;
|
|
|
|
GBI.cmd[G_SETSCISSOR] = RDP_SetScissor;
|
|
|
|
GBI.cmd[G_SETCONVERT] = RDP_SetConvert;
|
|
|
|
GBI.cmd[G_SETKEYR] = RDP_SetKeyR;
|
|
|
|
GBI.cmd[G_SETKEYGB] = RDP_SetKeyGB;
|
|
|
|
GBI.cmd[G_RDPFULLSYNC] = RDP_FullSync;
|
|
|
|
GBI.cmd[G_RDPTILESYNC] = RDP_TileSync;
|
|
|
|
GBI.cmd[G_RDPPIPESYNC] = RDP_PipeSync;
|
|
|
|
GBI.cmd[G_RDPLOADSYNC] = RDP_LoadSync;
|
|
|
|
GBI.cmd[G_TEXRECTFLIP] = RDP_TexRectFlip;
|
|
|
|
GBI.cmd[G_TEXRECT] = RDP_TexRect;
|
2018-07-22 16:02:27 +00:00
|
|
|
GBI.cmd[G_RDPNOOP] = RDP_NoOp;
|
2022-01-16 17:27:17 +00:00
|
|
|
#ifdef NATIVE
|
|
|
|
GBI.cmd[G_MARK_SEGMENT] = RDP_MarkSegment;
|
|
|
|
#endif
|
2014-10-07 10:59:54 +00:00
|
|
|
|
2018-09-04 09:42:06 +00:00
|
|
|
RDP.w0 = RDP.w1 = RDP.w2 = RDP.w3 = 0;
|
2014-10-07 10:59:54 +00:00
|
|
|
RDP.cmd_ptr = RDP.cmd_cur = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static
|
|
|
|
GBIFunc LLEcmd[64] = {
|
|
|
|
/* 0x00 */
|
|
|
|
RDP_NoOp, RDP_Unknown, RDP_Unknown, RDP_Unknown,
|
|
|
|
RDP_Unknown, RDP_Unknown, RDP_Unknown, RDP_Unknown,
|
|
|
|
RDP_TriFill, RDP_TriFillZ, RDP_TriTxtr, RDP_TriTxtrZ,
|
|
|
|
RDP_TriShade, RDP_TriShadeZ, RDP_TriShadeTxtr, RDP_TriShadeTxtrZ,
|
|
|
|
/* 0x10 */
|
|
|
|
RDP_Unknown, RDP_Unknown, RDP_Unknown, RDP_Unknown,
|
|
|
|
RDP_Unknown, RDP_Unknown, RDP_Unknown, RDP_Unknown,
|
|
|
|
RDP_Unknown, RDP_Unknown, RDP_Unknown, RDP_Unknown,
|
|
|
|
RDP_Unknown, RDP_Unknown, RDP_Unknown, RDP_Unknown,
|
|
|
|
/* 0x20 */
|
|
|
|
RDP_Unknown, RDP_Unknown, RDP_Unknown, RDP_Unknown,
|
|
|
|
RDP_TexRect, RDP_TexRectFlip, RDP_LoadSync, RDP_PipeSync,
|
|
|
|
RDP_TileSync, RDP_FullSync, RDP_SetKeyGB, RDP_SetKeyR,
|
|
|
|
RDP_SetConvert, RDP_SetScissor, RDP_SetPrimDepth, RDP_SetOtherMode,
|
|
|
|
/* 0x30 */
|
|
|
|
RDP_LoadTLUT, RDP_Unknown, RDP_SetTileSize, RDP_LoadBlock,
|
|
|
|
RDP_LoadTile, RDP_SetTile, RDP_FillRect, RDP_SetFillColor,
|
|
|
|
RDP_SetFogColor, RDP_SetBlendColor, RDP_SetPrimColor, RDP_SetEnvColor,
|
|
|
|
RDP_SetCombine, RDP_SetTImg, RDP_SetZImg, RDP_SetCImg
|
|
|
|
};
|
|
|
|
|
|
|
|
static
|
|
|
|
const u32 CmdLength[64] =
|
|
|
|
{
|
|
|
|
8, // 0x00, No Op
|
|
|
|
8, // 0x01, ???
|
|
|
|
8, // 0x02, ???
|
|
|
|
8, // 0x03, ???
|
|
|
|
8, // 0x04, ???
|
|
|
|
8, // 0x05, ???
|
|
|
|
8, // 0x06, ???
|
|
|
|
8, // 0x07, ???
|
|
|
|
32, // 0x08, Non-Shaded Triangle
|
|
|
|
32+16, // 0x09, Non-Shaded, Z-Buffered Triangle
|
|
|
|
32+64, // 0x0a, Textured Triangle
|
|
|
|
32+64+16, // 0x0b, Textured, Z-Buffered Triangle
|
|
|
|
32+64, // 0x0c, Shaded Triangle
|
|
|
|
32+64+16, // 0x0d, Shaded, Z-Buffered Triangle
|
|
|
|
32+64+64, // 0x0e, Shaded+Textured Triangle
|
|
|
|
32+64+64+16,// 0x0f, Shaded+Textured, Z-Buffered Triangle
|
|
|
|
8, // 0x10, ???
|
|
|
|
8, // 0x11, ???
|
|
|
|
8, // 0x12, ???
|
|
|
|
8, // 0x13, ???
|
|
|
|
8, // 0x14, ???
|
|
|
|
8, // 0x15, ???
|
|
|
|
8, // 0x16, ???
|
|
|
|
8, // 0x17, ???
|
|
|
|
8, // 0x18, ???
|
|
|
|
8, // 0x19, ???
|
|
|
|
8, // 0x1a, ???
|
|
|
|
8, // 0x1b, ???
|
|
|
|
8, // 0x1c, ???
|
|
|
|
8, // 0x1d, ???
|
|
|
|
8, // 0x1e, ???
|
|
|
|
8, // 0x1f, ???
|
|
|
|
8, // 0x20, ???
|
|
|
|
8, // 0x21, ???
|
|
|
|
8, // 0x22, ???
|
|
|
|
8, // 0x23, ???
|
|
|
|
16, // 0x24, Texture_Rectangle
|
|
|
|
16, // 0x25, Texture_Rectangle_Flip
|
|
|
|
8, // 0x26, Sync_Load
|
|
|
|
8, // 0x27, Sync_Pipe
|
|
|
|
8, // 0x28, Sync_Tile
|
|
|
|
8, // 0x29, Sync_Full
|
|
|
|
8, // 0x2a, Set_Key_GB
|
|
|
|
8, // 0x2b, Set_Key_R
|
|
|
|
8, // 0x2c, Set_Convert
|
|
|
|
8, // 0x2d, Set_Scissor
|
|
|
|
8, // 0x2e, Set_Prim_Depth
|
|
|
|
8, // 0x2f, Set_Other_Modes
|
|
|
|
8, // 0x30, Load_TLUT
|
|
|
|
8, // 0x31, ???
|
|
|
|
8, // 0x32, Set_Tile_Size
|
|
|
|
8, // 0x33, Load_Block
|
|
|
|
8, // 0x34, Load_Tile
|
|
|
|
8, // 0x35, Set_Tile
|
|
|
|
8, // 0x36, Fill_Rectangle
|
|
|
|
8, // 0x37, Set_Fill_Color
|
|
|
|
8, // 0x38, Set_Fog_Color
|
|
|
|
8, // 0x39, Set_Blend_Color
|
|
|
|
8, // 0x3a, Set_Prim_Color
|
|
|
|
8, // 0x3b, Set_Env_Color
|
|
|
|
8, // 0x3c, Set_Combine
|
|
|
|
8, // 0x3d, Set_Texture_Image
|
|
|
|
8, // 0x3e, Set_Mask_Image
|
|
|
|
8 // 0x3f, Set_Color_Image
|
|
|
|
};
|
|
|
|
|
|
|
|
void RDP_Half_1( u32 _c )
|
|
|
|
{
|
2022-01-16 17:27:17 +00:00
|
|
|
word w0 = 0, w1 = _c;
|
|
|
|
word cmd = _SHIFTR( _c, 24, 8 );
|
2014-10-07 10:59:54 +00:00
|
|
|
if (cmd >= 0xc8 && cmd <=0xcf) {//triangle command
|
2017-05-25 08:54:30 +00:00
|
|
|
DebugMsg(DEBUG_NORMAL, "gDPHalf_1 LLE Triangle\n");
|
2014-10-07 10:59:54 +00:00
|
|
|
RDP.cmd_ptr = 0;
|
|
|
|
RDP.cmd_cur = 0;
|
|
|
|
do {
|
|
|
|
RDP.cmd_data[RDP.cmd_ptr++] = w1;
|
|
|
|
RSP_CheckDLCounter();
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
w0 = *(word*)&RDRAM[RSP.PC[RSP.PCi]];
|
|
|
|
w1 = *(word*)&RDRAM[RSP.PC[RSP.PCi] + 4];
|
2014-10-07 10:59:54 +00:00
|
|
|
RSP.cmd = _SHIFTR( w0, 24, 8 );
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
DebugMsg(DEBUG_NORMAL, "0x%08lX: CMD=0x%02lX w0=0x%08lX w1=0x%08lX\n", RSP.PC[RSP.PCi], _SHIFTR(w0, 24, 8), w0, w1);
|
2014-10-07 10:59:54 +00:00
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
RSP.PC[RSP.PCi] += sizeof(Gwords);
|
2014-10-07 10:59:54 +00:00
|
|
|
// RSP.nextCmd = _SHIFTR( *(u32*)&RDRAM[RSP.PC[RSP.PCi]], 24, 8 );
|
|
|
|
} while (RSP.cmd != 0xb3);
|
|
|
|
RDP.cmd_data[RDP.cmd_ptr++] = w1;
|
|
|
|
RSP.cmd = (RDP.cmd_data[RDP.cmd_cur] >> 24) & 0x3f;
|
|
|
|
w0 = RDP.cmd_data[RDP.cmd_cur+0];
|
|
|
|
w1 = RDP.cmd_data[RDP.cmd_cur+1];
|
2022-01-16 17:27:17 +00:00
|
|
|
LLEcmd[RSP.cmd](Gwords(w0, w1));
|
2020-02-02 12:50:00 +00:00
|
|
|
LLETriangle::get().flush(cmd);
|
2014-10-07 10:59:54 +00:00
|
|
|
} else {
|
2017-05-25 08:54:30 +00:00
|
|
|
DebugMsg(DEBUG_NORMAL | DEBUG_IGNORED, "gDPHalf_1()\n");
|
2014-10-07 10:59:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
#ifdef NATIVE
|
|
|
|
#define rdram ((u32*)0)
|
|
|
|
#define rsp_dmem ((u32*)0)
|
|
|
|
#else
|
2014-10-07 10:59:54 +00:00
|
|
|
#define rdram ((u32*)RDRAM)
|
|
|
|
#define rsp_dmem ((u32*)DMEM)
|
2022-01-16 17:27:17 +00:00
|
|
|
#endif
|
2014-10-07 10:59:54 +00:00
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
#define dp_start (*(word*)REG.DPC_START)
|
|
|
|
#define dp_end (*(word*)REG.DPC_END)
|
|
|
|
#define dp_current (*(word*)REG.DPC_CURRENT)
|
|
|
|
#define dp_status (*(word*)REG.DPC_STATUS)
|
2014-10-07 10:59:54 +00:00
|
|
|
|
2022-01-16 17:27:17 +00:00
|
|
|
#ifdef NATIVE
|
|
|
|
inline u32 READ_RDP_DATA(word address) {
|
|
|
|
return rsp_dmem[(address & 0xfff) >> 2];
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
inline u32 READ_RDP_DATA(word address)
|
2014-10-07 10:59:54 +00:00
|
|
|
{
|
|
|
|
if (dp_status & 0x1) // XBUS_DMEM_DMA enabled
|
|
|
|
return rsp_dmem[(address & 0xfff)>>2];
|
|
|
|
else
|
2020-03-29 01:48:37 +00:00
|
|
|
return rdram[(address & 0xffffff)>>2];
|
2013-04-05 06:13:26 +00:00
|
|
|
}
|
2022-01-16 17:27:17 +00:00
|
|
|
#endif
|
2013-04-05 06:13:26 +00:00
|
|
|
|
2014-10-07 10:59:54 +00:00
|
|
|
void RDP_ProcessRDPList()
|
|
|
|
{
|
2017-01-15 07:57:25 +00:00
|
|
|
if (ConfigOpen || dwnd().isResizeWindow()) {
|
2015-07-23 15:55:30 +00:00
|
|
|
dp_start = dp_current = dp_end;
|
|
|
|
gDPFullSync();
|
|
|
|
return;
|
|
|
|
}
|
2014-10-07 10:59:54 +00:00
|
|
|
|
2014-11-22 13:39:10 +00:00
|
|
|
const u32 length = dp_end - dp_current;
|
|
|
|
|
2014-10-07 10:59:54 +00:00
|
|
|
if (dp_end <= dp_current) return;
|
2014-11-22 13:39:10 +00:00
|
|
|
|
2017-10-24 06:34:22 +00:00
|
|
|
RSP.LLE = true;
|
2014-10-07 10:59:54 +00:00
|
|
|
|
|
|
|
// load command data
|
2014-11-22 13:39:10 +00:00
|
|
|
for (u32 i = 0; i < length; i += 4) {
|
|
|
|
RDP.cmd_data[RDP.cmd_ptr] = READ_RDP_DATA(dp_current + i);
|
|
|
|
RDP.cmd_ptr = (RDP.cmd_ptr + 1) & maxCMDMask;
|
2014-10-07 10:59:54 +00:00
|
|
|
}
|
|
|
|
|
2014-11-22 13:39:10 +00:00
|
|
|
bool setZero = true;
|
|
|
|
while (RDP.cmd_cur != RDP.cmd_ptr) {
|
2022-01-16 17:27:17 +00:00
|
|
|
word cmd = (RDP.cmd_data[RDP.cmd_cur] >> 24) & 0x3f;
|
2014-10-07 10:59:54 +00:00
|
|
|
|
2014-11-22 13:39:10 +00:00
|
|
|
if ((((RDP.cmd_ptr - RDP.cmd_cur)&maxCMDMask) * 4) < CmdLength[cmd]) {
|
|
|
|
setZero = false;
|
|
|
|
break;
|
|
|
|
}
|
2014-10-07 10:59:54 +00:00
|
|
|
|
2014-11-22 13:39:10 +00:00
|
|
|
if (RDP.cmd_cur + CmdLength[cmd] / 4 > MAXCMD)
|
2015-05-04 14:11:21 +00:00
|
|
|
::memcpy(RDP.cmd_data + MAXCMD, RDP.cmd_data, CmdLength[cmd] - (MAXCMD - RDP.cmd_cur) * 4);
|
2014-10-07 10:59:54 +00:00
|
|
|
|
|
|
|
// execute the command
|
2018-09-04 09:42:06 +00:00
|
|
|
RDP.w0 = RDP.cmd_data[RDP.cmd_cur + 0];
|
|
|
|
RDP.w1 = RDP.cmd_data[RDP.cmd_cur + 1];
|
|
|
|
RDP.w2 = RDP.cmd_data[RDP.cmd_cur + 2];
|
2014-11-22 13:39:10 +00:00
|
|
|
RDP.w3 = RDP.cmd_data[RDP.cmd_cur + 3];
|
2014-11-29 13:41:13 +00:00
|
|
|
RSP.cmd = cmd;
|
2020-06-28 04:06:37 +00:00
|
|
|
#ifdef DEBUG_DUMP
|
2022-01-16 17:27:17 +00:00
|
|
|
DebugMsg(DEBUG_LOW, "CMD=0x%02lX words.w0=0x%08lX words.w1=0x%08lX\n", cmd, RDP.w0, RDP.w1);
|
2020-06-28 04:06:37 +00:00
|
|
|
#endif
|
2020-02-02 12:50:00 +00:00
|
|
|
LLETriangle::get().flush(cmd);
|
2022-01-16 17:27:17 +00:00
|
|
|
LLEcmd[cmd](Gwords(RDP.w0, RDP.w1));
|
2014-10-07 10:59:54 +00:00
|
|
|
|
2014-11-22 13:39:10 +00:00
|
|
|
RDP.cmd_cur = (RDP.cmd_cur + CmdLength[cmd] / 4) & maxCMDMask;
|
|
|
|
}
|
2014-10-07 10:59:54 +00:00
|
|
|
|
2014-11-22 13:39:10 +00:00
|
|
|
if (setZero) {
|
|
|
|
RDP.cmd_ptr = 0;
|
|
|
|
RDP.cmd_cur = 0;
|
|
|
|
}
|
2014-10-07 10:59:54 +00:00
|
|
|
|
2015-05-18 06:35:48 +00:00
|
|
|
gDP.changed |= CHANGED_COLORBUFFER;
|
2015-05-18 06:31:27 +00:00
|
|
|
gDP.changed &= ~CHANGED_CPU_FB_WRITE;
|
2014-11-22 13:39:10 +00:00
|
|
|
|
|
|
|
dp_start = dp_current = dp_end;
|
2014-10-07 10:59:54 +00:00
|
|
|
}
|