2010-04-25 00:31:27 +00:00
|
|
|
/*
|
2009-02-09 21:15:56 +00:00
|
|
|
* Copyright (C) 2007-2009 Gabest
|
|
|
|
* http://www.gabest.org
|
|
|
|
*
|
|
|
|
* This Program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-02-09 21:15:56 +00:00
|
|
|
* This Program 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.
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-02-09 21:15:56 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with GNU Make; see the file COPYING. If not, write to
|
2012-09-09 18:16:11 +00:00
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
|
2009-02-09 21:15:56 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "GS.h"
|
|
|
|
|
2016-05-11 23:24:37 +00:00
|
|
|
class alignas(32) GSDrawingEnvironment
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
|
|
|
public:
|
2021-04-12 09:31:30 +00:00
|
|
|
GIFRegPRIM PRIM;
|
|
|
|
GIFRegPRMODE PRMODE;
|
|
|
|
GIFRegPRMODECONT PRMODECONT;
|
|
|
|
GIFRegTEXCLUT TEXCLUT;
|
|
|
|
GIFRegSCANMSK SCANMSK;
|
|
|
|
GIFRegTEXA TEXA;
|
|
|
|
GIFRegFOGCOL FOGCOL;
|
|
|
|
GIFRegDIMX DIMX;
|
|
|
|
GIFRegDTHE DTHE;
|
|
|
|
GIFRegCOLCLAMP COLCLAMP;
|
|
|
|
GIFRegPABE PABE;
|
|
|
|
GIFRegBITBLTBUF BITBLTBUF;
|
|
|
|
GIFRegTRXDIR TRXDIR;
|
|
|
|
GIFRegTRXPOS TRXPOS;
|
|
|
|
GIFRegTRXREG TRXREG;
|
|
|
|
GSDrawingContext CTXT[2];
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2010-04-25 00:31:27 +00:00
|
|
|
GSDrawingEnvironment()
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Reset()
|
|
|
|
{
|
|
|
|
memset(&PRIM, 0, sizeof(PRIM));
|
|
|
|
memset(&PRMODE, 0, sizeof(PRMODE));
|
|
|
|
memset(&PRMODECONT, 0, sizeof(PRMODECONT));
|
|
|
|
memset(&TEXCLUT, 0, sizeof(TEXCLUT));
|
|
|
|
memset(&SCANMSK, 0, sizeof(SCANMSK));
|
|
|
|
memset(&TEXA, 0, sizeof(TEXA));
|
|
|
|
memset(&FOGCOL, 0, sizeof(FOGCOL));
|
|
|
|
memset(&DIMX, 0, sizeof(DIMX));
|
|
|
|
memset(&DTHE, 0, sizeof(DTHE));
|
|
|
|
memset(&COLCLAMP, 0, sizeof(COLCLAMP));
|
|
|
|
memset(&PABE, 0, sizeof(PABE));
|
|
|
|
memset(&BITBLTBUF, 0, sizeof(BITBLTBUF));
|
|
|
|
memset(&TRXDIR, 0, sizeof(TRXDIR));
|
|
|
|
memset(&TRXPOS, 0, sizeof(TRXPOS));
|
|
|
|
memset(&TRXREG, 0, sizeof(TRXREG));
|
|
|
|
|
|
|
|
CTXT[0].Reset();
|
|
|
|
CTXT[1].Reset();
|
2009-02-11 07:05:44 +00:00
|
|
|
|
|
|
|
memset(dimx, 0, sizeof(dimx));
|
|
|
|
}
|
|
|
|
|
|
|
|
GSVector4i dimx[8];
|
|
|
|
|
|
|
|
void UpdateDIMX()
|
|
|
|
{
|
|
|
|
dimx[1] = GSVector4i(DIMX.DM00, 0, DIMX.DM01, 0, DIMX.DM02, 0, DIMX.DM03, 0);
|
|
|
|
dimx[0] = dimx[1].xxzzlh();
|
|
|
|
dimx[3] = GSVector4i(DIMX.DM10, 0, DIMX.DM11, 0, DIMX.DM12, 0, DIMX.DM13, 0),
|
2009-02-13 09:28:51 +00:00
|
|
|
dimx[2] = dimx[3].xxzzlh();
|
2009-02-11 07:05:44 +00:00
|
|
|
dimx[5] = GSVector4i(DIMX.DM20, 0, DIMX.DM21, 0, DIMX.DM22, 0, DIMX.DM23, 0),
|
2009-02-13 09:28:51 +00:00
|
|
|
dimx[4] = dimx[5].xxzzlh();
|
2009-02-11 07:05:44 +00:00
|
|
|
dimx[7] = GSVector4i(DIMX.DM30, 0, DIMX.DM31, 0, DIMX.DM32, 0, DIMX.DM33, 0),
|
|
|
|
dimx[6] = dimx[7].xxzzlh();
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|
2015-05-05 15:48:11 +00:00
|
|
|
|
|
|
|
void Dump(const std::string& filename)
|
|
|
|
{
|
|
|
|
FILE* fp = fopen(filename.c_str(), "wt");
|
2021-04-12 09:31:30 +00:00
|
|
|
if (!fp)
|
|
|
|
return;
|
2015-05-05 15:48:11 +00:00
|
|
|
|
|
|
|
fprintf(fp, "PRIM\n"
|
2021-04-12 09:31:30 +00:00
|
|
|
"\tPRIM:%u\n"
|
|
|
|
"\tIIP:%u\n"
|
|
|
|
"\tTME:%u\n"
|
|
|
|
"\tFGE:%u\n"
|
|
|
|
"\tABE:%u\n"
|
|
|
|
"\tAA1:%u\n"
|
|
|
|
"\tFST:%u\n"
|
|
|
|
"\tCTXT:%u\n"
|
|
|
|
"\tFIX:%u\n\n"
|
|
|
|
, PRIM.PRIM, PRIM.IIP, PRIM.TME, PRIM.FGE, PRIM.ABE, PRIM.AA1, PRIM.FST, PRIM.CTXT, PRIM.FIX);
|
2015-05-05 15:48:11 +00:00
|
|
|
|
|
|
|
fprintf(fp, "PRMODE (when AC=0)\n"
|
2021-04-12 09:31:30 +00:00
|
|
|
"\t_PRIM:%u\n"
|
|
|
|
"\tIIP:%u\n"
|
|
|
|
"\tTME:%u\n"
|
|
|
|
"\tFGE:%u\n"
|
|
|
|
"\tABE:%u\n"
|
|
|
|
"\tAA1:%u\n"
|
|
|
|
"\tFST:%u\n"
|
|
|
|
"\tCTXT:%u\n"
|
|
|
|
"\tFIX:%u\n\n"
|
|
|
|
, PRMODE._PRIM, PRMODE.IIP, PRMODE.TME, PRMODE.FGE, PRMODE.ABE, PRMODE.AA1, PRMODE.FST, PRMODE.CTXT, PRMODE.FIX);
|
2015-05-05 15:48:11 +00:00
|
|
|
|
|
|
|
fprintf(fp, "PRMODECONT\n"
|
2021-04-12 09:31:30 +00:00
|
|
|
"\tAC:%u\n\n"
|
|
|
|
, PRMODECONT.AC);
|
2015-05-05 15:48:11 +00:00
|
|
|
|
2015-05-16 09:07:42 +00:00
|
|
|
fprintf(fp, "TEXCLUT\n"
|
2021-04-12 09:31:30 +00:00
|
|
|
"\tCOU:%u\n"
|
|
|
|
"\tCBW:%u\n"
|
|
|
|
"\tCOV:%u\n\n"
|
|
|
|
, TEXCLUT.COU, TEXCLUT.CBW, TEXCLUT.COV);
|
2015-05-16 09:07:42 +00:00
|
|
|
|
|
|
|
fprintf(fp, "SCANMSK\n"
|
2021-04-12 09:31:30 +00:00
|
|
|
"\tMSK:%u\n\n"
|
|
|
|
"\n"
|
|
|
|
, SCANMSK.MSK);
|
2015-05-16 09:07:42 +00:00
|
|
|
|
|
|
|
fprintf(fp, "TEXA\n"
|
2021-04-12 09:31:30 +00:00
|
|
|
"\tAEM:%u\n"
|
|
|
|
"\tTA0:%u\n"
|
|
|
|
"\tTA1:%u\n\n"
|
|
|
|
, TEXA.AEM, TEXA.TA0, TEXA.TA1);
|
2015-05-16 09:07:42 +00:00
|
|
|
|
|
|
|
fprintf(fp, "FOGCOL\n"
|
2021-04-12 09:31:30 +00:00
|
|
|
"\tFCG:%u\n"
|
|
|
|
"\tFCB:%u\n"
|
|
|
|
"\tFCR:%u\n\n"
|
|
|
|
, FOGCOL.FCG, FOGCOL.FCB, FOGCOL.FCR);
|
2015-05-16 09:07:42 +00:00
|
|
|
|
|
|
|
fprintf(fp, "DIMX\n"
|
2021-04-12 09:31:30 +00:00
|
|
|
"\tDM22:%d\n"
|
|
|
|
"\tDM23:%d\n"
|
|
|
|
"\tDM31:%d\n"
|
|
|
|
"\tDM02:%d\n"
|
|
|
|
"\tDM21:%d\n"
|
|
|
|
"\tDM12:%d\n"
|
|
|
|
"\tDM03:%d\n"
|
|
|
|
"\tDM01:%d\n"
|
|
|
|
"\tDM33:%d\n"
|
|
|
|
"\tDM30:%d\n"
|
|
|
|
"\tDM11:%d\n"
|
|
|
|
"\tDM10:%d\n"
|
|
|
|
"\tDM20:%d\n"
|
|
|
|
"\tDM32:%d\n"
|
|
|
|
"\tDM00:%d\n"
|
|
|
|
"\tDM13:%d\n\n"
|
|
|
|
, DIMX.DM22, DIMX.DM23, DIMX.DM31, DIMX.DM02, DIMX.DM21, DIMX.DM12, DIMX.DM03, DIMX.DM01, DIMX.DM33, DIMX.DM30, DIMX.DM11, DIMX.DM10, DIMX.DM20, DIMX.DM32, DIMX.DM00, DIMX.DM13);
|
2015-05-16 09:07:42 +00:00
|
|
|
|
|
|
|
fprintf(fp, "DTHE\n"
|
2021-04-12 09:31:30 +00:00
|
|
|
"\tDTHE:%u\n\n"
|
|
|
|
, DTHE.DTHE);
|
2015-05-16 09:07:42 +00:00
|
|
|
|
|
|
|
fprintf(fp, "COLCLAMP\n"
|
2021-04-12 09:31:30 +00:00
|
|
|
"\tCLAMP:%u\n\n"
|
|
|
|
, COLCLAMP.CLAMP);
|
2015-05-16 09:07:42 +00:00
|
|
|
|
|
|
|
fprintf(fp, "PABE\n"
|
2021-04-12 09:31:30 +00:00
|
|
|
"\tPABE:%u\n\n"
|
|
|
|
, PABE.PABE);
|
2015-05-16 09:07:42 +00:00
|
|
|
|
|
|
|
fprintf(fp, "BITBLTBUF\n"
|
2021-04-12 09:31:30 +00:00
|
|
|
"\tSBW:%u\n"
|
|
|
|
"\tSBP:0x%x\n"
|
|
|
|
"\tSPSM:%u\n"
|
|
|
|
"\tDBW:%u\n"
|
|
|
|
"\tDPSM:%u\n"
|
|
|
|
"\tDBP:0x%x\n\n"
|
|
|
|
, BITBLTBUF.SBW, BITBLTBUF.SBP, BITBLTBUF.SPSM, BITBLTBUF.DBW, BITBLTBUF.DPSM, BITBLTBUF.DBP);
|
2015-05-16 09:07:42 +00:00
|
|
|
|
|
|
|
fprintf(fp, "TRXDIR\n"
|
2021-04-12 09:31:30 +00:00
|
|
|
"\tXDIR:%u\n\n",
|
|
|
|
TRXDIR.XDIR);
|
2015-05-16 09:07:42 +00:00
|
|
|
|
|
|
|
fprintf(fp, "TRXPOS\n"
|
2021-04-12 09:31:30 +00:00
|
|
|
"\tDIRY:%u\n"
|
|
|
|
"\tSSAY:%u\n"
|
|
|
|
"\tSSAX:%u\n"
|
|
|
|
"\tDIRX:%u\n"
|
|
|
|
"\tDSAX:%u\n"
|
|
|
|
"\tDSAY:%u\n\n"
|
|
|
|
, TRXPOS.DIRY, TRXPOS.SSAY, TRXPOS.SSAX, TRXPOS.DIRX, TRXPOS.DSAX, TRXPOS.DSAY);
|
2015-05-16 09:07:42 +00:00
|
|
|
|
|
|
|
fprintf(fp, "TRXREG\n"
|
2021-04-12 09:31:30 +00:00
|
|
|
"\tRRH:%u\n"
|
|
|
|
"\tRRW:%u\n\n"
|
|
|
|
, TRXREG.RRH, TRXREG.RRW);
|
2015-05-05 15:48:11 +00:00
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
}
|
2009-02-09 21:15:56 +00:00
|
|
|
};
|