2009-05-15 01:06:59 +00:00
|
|
|
/* GSnull
|
2010-05-03 14:08:02 +00:00
|
|
|
* Copyright (C) 2002-2010 PCSX2 Dev Team
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-11-01 06:47:32 +00:00
|
|
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
2009-05-15 01:06:59 +00:00
|
|
|
*
|
2009-11-01 06:47:32 +00:00
|
|
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
2009-05-15 01:06:59 +00:00
|
|
|
*
|
2009-11-01 06:47:32 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
2009-05-15 01:06:59 +00:00
|
|
|
*/
|
2009-09-07 04:56:31 +00:00
|
|
|
|
2010-08-06 09:30:36 +00:00
|
|
|
#ifndef __GIF_TRANSFER_H__
|
|
|
|
#define __GIF_TRANSFER_H__
|
2009-09-07 04:56:31 +00:00
|
|
|
|
2009-05-15 01:06:59 +00:00
|
|
|
#include <assert.h>
|
|
|
|
#include <algorithm>
|
2010-08-06 09:30:36 +00:00
|
|
|
#include "Registers.h"
|
2009-05-15 01:06:59 +00:00
|
|
|
|
2016-08-24 21:17:32 +00:00
|
|
|
enum GIF_FLG {
|
|
|
|
GIF_FLG_PACKED = 0,
|
|
|
|
GIF_FLG_REGLIST = 1,
|
|
|
|
GIF_FLG_IMAGE = 2,
|
|
|
|
GIF_FLG_IMAGE2 = 3
|
2009-05-15 01:06:59 +00:00
|
|
|
};
|
|
|
|
|
2010-08-06 09:30:36 +00:00
|
|
|
//
|
|
|
|
// GIFTag
|
|
|
|
union GIFTag
|
2009-05-15 01:06:59 +00:00
|
|
|
{
|
2016-08-24 21:17:32 +00:00
|
|
|
u64 ai64[2];
|
|
|
|
u32 ai32[4];
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
u32 NLOOP : 15;
|
|
|
|
u32 EOP : 1;
|
|
|
|
u32 _PAD1 : 16;
|
|
|
|
u32 _PAD2 : 14;
|
|
|
|
u32 PRE : 1;
|
|
|
|
u32 PRIM : 11;
|
2016-10-16 19:39:56 +00:00
|
|
|
u32 FLG : 2; // enum GIF_FLG
|
2016-08-24 21:17:32 +00:00
|
|
|
u32 NREG : 4;
|
|
|
|
u64 REGS : 64;
|
|
|
|
};
|
|
|
|
|
2016-08-28 16:14:07 +00:00
|
|
|
void set(const u32 *data)
|
2016-08-24 21:17:32 +00:00
|
|
|
{
|
|
|
|
for (int i = 0; i <= 3; i++) {
|
|
|
|
ai32[i] = data[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-28 16:14:07 +00:00
|
|
|
GIFTag(u32 *data)
|
2016-08-24 21:17:32 +00:00
|
|
|
{
|
|
|
|
set(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
GIFTag()
|
|
|
|
{
|
|
|
|
ai64[0] = 0;
|
|
|
|
ai64[1] = 0;
|
|
|
|
}
|
2009-05-15 01:06:59 +00:00
|
|
|
};
|
|
|
|
|
2010-08-06 09:30:36 +00:00
|
|
|
// EE part. Data transfer packet description
|
|
|
|
|
|
|
|
typedef struct
|
2009-05-15 01:06:59 +00:00
|
|
|
{
|
2016-08-24 21:17:32 +00:00
|
|
|
u32 mode;
|
|
|
|
int reg;
|
|
|
|
u64 regs;
|
|
|
|
u32 nloop;
|
|
|
|
int eop;
|
|
|
|
int nreg;
|
|
|
|
u32 adonly;
|
|
|
|
GIFTag tag;
|
|
|
|
|
2016-08-28 16:14:07 +00:00
|
|
|
void setTag(const u32 *data)
|
2016-08-24 21:17:32 +00:00
|
|
|
{
|
|
|
|
tag.set(data);
|
|
|
|
|
|
|
|
nloop = tag.NLOOP;
|
|
|
|
eop = tag.EOP;
|
|
|
|
mode = tag.FLG;
|
|
|
|
//adonly = false;
|
|
|
|
|
|
|
|
// Hmm....
|
|
|
|
nreg = tag.NREG << 2;
|
|
|
|
if (nreg == 0)
|
|
|
|
nreg = 64;
|
|
|
|
regs = tag.REGS;
|
|
|
|
reg = 0;
|
|
|
|
//if ((nreg == 4) && (regs == GIF_REG_A_D)) adonly = true;
|
|
|
|
|
|
|
|
// GSLog::Writeln"GIFtag: %8.8lx_%8.8lx_%8.8lx_%8.8lx: EOP=%d, NLOOP=%x, FLG=%x, NREG=%d, PRE=%d",
|
|
|
|
// data[3], data[2], data[1], data[0],
|
|
|
|
// path->eop, path->nloop, mode, path->nreg, tag.PRE);
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 GetReg()
|
|
|
|
{
|
|
|
|
return (regs >> reg) & 0xf;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool StepReg()
|
|
|
|
{
|
|
|
|
reg += 4;
|
|
|
|
|
|
|
|
if (reg == nreg) {
|
|
|
|
reg = 0;
|
|
|
|
nloop--;
|
|
|
|
|
|
|
|
if (nloop == 0)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2009-05-15 01:57:00 +00:00
|
|
|
|
2010-08-06 09:30:36 +00:00
|
|
|
} pathInfo;
|
2009-05-15 01:57:00 +00:00
|
|
|
|
2016-08-28 16:14:07 +00:00
|
|
|
extern void _GSgifPacket(pathInfo *path, const u32 *pMem);
|
|
|
|
extern void _GSgifRegList(pathInfo *path, const u32 *pMem);
|
2016-08-24 21:17:32 +00:00
|
|
|
template <int index>
|
2016-08-28 16:14:07 +00:00
|
|
|
extern void _GSgifTransfer(const u32 *pMem, u32 size);
|
2010-08-07 05:46:25 +00:00
|
|
|
extern GIFRegHandler GIFPackedRegHandlers[];
|
|
|
|
extern GIFRegHandler GIFRegHandlers[];
|
2016-10-16 19:39:56 +00:00
|
|
|
#endif // GIFTRANSFER_H_INCLUDED
|