void RSP_ProcessDList(void)
{
   int i, j;
   u32 uc_start, uc_dstart, uc_dsize;

   __RSP.PC[0] = *(u32*)&gfx_info.DMEM[0x0FF0];
   __RSP.PCi   = 0;
   __RSP.count = -1;

   __RSP.halt  = FALSE;
   __RSP.busy  = TRUE;

   gSP.matrix.stackSize = min( 32, *(u32*)&gfx_info.DMEM[0x0FE4] >> 6 );
   gSP.matrix.modelViewi = 0;
   gSP.changed &= ~CHANGED_CPU_FB_WRITE;
   gSP.changed |= CHANGED_MATRIX;
   gDPSetTexturePersp(G_TP_PERSP);

   for (i = 0; i < 4; i++)
      for (j = 0; j < 4; j++)
         gSP.matrix.modelView[0][i][j] = 0.0f;

   gSP.matrix.modelView[0][0][0] = 1.0f;
   gSP.matrix.modelView[0][1][1] = 1.0f;
   gSP.matrix.modelView[0][2][2] = 1.0f;
   gSP.matrix.modelView[0][3][3] = 1.0f;

   uc_start = *(u32*)&gfx_info.DMEM[0x0FD0];
   uc_dstart = *(u32*)&gfx_info.DMEM[0x0FD8];
   uc_dsize = *(u32*)&gfx_info.DMEM[0x0FDC];

   if ((uc_start != __RSP.uc_start) || (uc_dstart != __RSP.uc_dstart))
      gSPLoadUcodeEx( uc_start, uc_dstart, uc_dsize );

   gDPSetCombineKey(G_CK_NONE);
   gDPSetTextureLUT(G_TT_NONE);
   gDPSetTexturePersp(G_TP_PERSP);
   gDPSetCycleType(G_CYC_1CYCLE);

#ifdef NEW
	depthBufferList().setNotCleared();
#endif

   if (GBI_GetCurrentMicrocodeType() == Turbo3D)
	   RunTurbo3D();
   else
      while (!__RSP.halt)
      {
         u32 w0, w1, pc;
         pc = __RSP.PC[__RSP.PCi];

         if ((pc + 8) > RDRAMSize)
         {
#ifdef DEBUG
            DebugMsg( DEBUG_LOW | DEBUG_ERROR, "ATTEMPTING TO EXECUTE RSP COMMAND AT INVALID RDRAM LOCATION\n" );
#endif
            break;
         }


         w0 = *(u32*)&gfx_info.RDRAM[pc];
         w1 = *(u32*)&gfx_info.RDRAM[pc+4];
         __RSP.cmd = _SHIFTR( w0, 24, 8 );

#ifdef DEBUG
         DebugRSPState( RSP.PCi, RSP.PC[RSP.PCi], _SHIFTR( w0, 24, 8 ), w0, w1 );
         DebugMsg( DEBUG_LOW | DEBUG_HANDLED, "0x%08lX: CMD=0x%02lX W0=0x%08lX W1=0x%08lX\n", RSP.PC[RSP.PCi], _SHIFTR( w0, 24, 8 ), w0, w1 );
#endif

         __RSP.PC[__RSP.PCi] += 8;
         __RSP.nextCmd = _SHIFTR( *(u32*)&gfx_info.RDRAM[pc+8], 24, 8 );

         GBI.cmd[__RSP.cmd]( w0, w1 );
         RSP_CheckDLCounter();
      }

   if (config.frameBufferEmulation.copyToRDRAM)
	   FrameBuffer_CopyToRDRAM( gDP.colorImage.address );
   if (config.frameBufferEmulation.copyDepthToRDRAM)
	   FrameBuffer_CopyDepthBuffer( gDP.colorImage.address );
   __RSP.busy = FALSE;
   gSP.changed |= CHANGED_COLORBUFFER;
}
Example #2
0
void RSP_ProcessDList()
{
    VI_UpdateSize();
    OGL_UpdateScale();

    RSP.PC[0] = *(u32*)&DMEM[0x0FF0];
    RSP.PCi = 0;
    RSP.count = 0;

    RSP.halt = FALSE;
    RSP.busy = TRUE;

    gSP.matrix.stackSize = min( 32, *(u32*)&DMEM[0x0FE4] >> 6 );
    gSP.matrix.modelViewi = 0;
    gSP.changed |= CHANGED_MATRIX;

    for (int i = 0; i < 4; i++)
        for (int j = 0; j < 4; j++)
            gSP.matrix.modelView[0][i][j] = 0.0f;

    gSP.matrix.modelView[0][0][0] = 1.0f;
    gSP.matrix.modelView[0][1][1] = 1.0f;
    gSP.matrix.modelView[0][2][2] = 1.0f;
    gSP.matrix.modelView[0][3][3] = 1.0f;

    u32 uc_start = *(u32*)&DMEM[0x0FD0];
    u32 uc_dstart = *(u32*)&DMEM[0x0FD8];
    u32 uc_dsize = *(u32*)&DMEM[0x0FDC];

    if ((uc_start != RSP.uc_start) || (uc_dstart != RSP.uc_dstart))
        gSPLoadUcodeEx( uc_start, uc_dstart, uc_dsize );

    gDPSetAlphaCompare( G_AC_NONE );
    gDPSetDepthSource( G_ZS_PIXEL );
    gDPSetRenderMode( 0, 0 );
    gDPSetAlphaDither( G_AD_DISABLE );
    gDPSetColorDither( G_CD_DISABLE );
    gDPSetCombineKey( G_CK_NONE );
    gDPSetTextureConvert( G_TC_FILT );
    gDPSetTextureFilter( G_TF_POINT );
    gDPSetTextureLUT( G_TT_NONE );
    gDPSetTextureLOD( G_TL_TILE );
    gDPSetTextureDetail( G_TD_CLAMP );
    gDPSetTexturePersp( G_TP_PERSP );
    gDPSetCycleType( G_CYC_1CYCLE );
    gDPPipelineMode( G_PM_NPRIMITIVE );

    while (!RSP.halt)
    {
        if ((RSP.PC[RSP.PCi] + 8) > RDRAMSize)
        {
#ifdef DEBUG
            DebugMsg( DEBUG_LOW | DEBUG_ERROR, "ATTEMPTING TO EXECUTE RSP COMMAND AT INVALID RDRAM LOCATION\n" );
#endif
            break;
        }

        u32 w0 = *(u32*)&RDRAM[RSP.PC[RSP.PCi]];
        u32 w1 = *(u32*)&RDRAM[RSP.PC[RSP.PCi] + 4];
        RSP.cmd = _SHIFTR( w0, 24, 8 );

        RSP.PC[RSP.PCi] += 8;
        RSP.nextCmd = _SHIFTR( *(u32*)&RDRAM[RSP.PC[RSP.PCi]], 24, 8 );

#ifdef PROFILE_GBI
        GBI_ProfileBegin(RSP.cmd);
#endif

        GBI.cmd[RSP.cmd]( w0, w1 );

#ifdef PROFILE_GBI
        GBI_ProfileEnd(RSP.cmd);
#endif
    }

    RSP.busy = FALSE;
    RSP.DList++;
    gSP.changed |= CHANGED_COLORBUFFER;
}
Example #3
0
void RSP_ProcessDList()
{
    VI_UpdateSize();
    OGL_UpdateScale();

    RSP.PC[0] = *(u32*)&DMEM[0x0FF0];
    RSP.PCi = 0;
    RSP.count = 0;

    RSP.halt = FALSE;
    RSP.busy = TRUE;

    gSP.matrix.stackSize = min( 32, *(u32*)&DMEM[0x0FE4] >> 6 );
    gSP.matrix.modelViewi = 0;
    gSP.changed |= CHANGED_MATRIX;

    for (int i = 0; i < 4; i++)
        for (int j = 0; j < 4; j++)
            gSP.matrix.modelView[0][i][j] = 0.0f;

    gSP.matrix.modelView[0][0][0] = 1.0f;
    gSP.matrix.modelView[0][1][1] = 1.0f;
    gSP.matrix.modelView[0][2][2] = 1.0f;
    gSP.matrix.modelView[0][3][3] = 1.0f;

    u32 uc_start = *(u32*)&DMEM[0x0FD0];
    u32 uc_dstart = *(u32*)&DMEM[0x0FD8];
    u32 uc_dsize = *(u32*)&DMEM[0x0FDC];

    if ((uc_start != RSP.uc_start) || (uc_dstart != RSP.uc_dstart))
        gSPLoadUcodeEx( uc_start, uc_dstart, uc_dsize );

    gDPSetAlphaCompare( G_AC_NONE );
    gDPSetDepthSource( G_ZS_PIXEL );
    gDPSetRenderMode( 0, 0 );
    gDPSetAlphaDither( G_AD_DISABLE );
    gDPSetColorDither( G_CD_DISABLE );
    gDPSetCombineKey( G_CK_NONE );
    gDPSetTextureConvert( G_TC_FILT );
    gDPSetTextureFilter( G_TF_POINT );
    gDPSetTextureLUT( G_TT_NONE );
    gDPSetTextureLOD( G_TL_TILE );
    gDPSetTextureDetail( G_TD_CLAMP );
    gDPSetTexturePersp( G_TP_PERSP );
    gDPSetCycleType( G_CYC_1CYCLE );
    gDPPipelineMode( G_PM_NPRIMITIVE );

    while (!RSP.halt)
    {
        if ((RSP.PC[RSP.PCi] + 8) > RDRAMSize)
        {
#ifdef DEBUG
            switch (Debug.level)
            {
            case DEBUG_LOW:
                DebugMsg( DEBUG_LOW | DEBUG_ERROR, "ATTEMPTING TO EXECUTE RSP COMMAND AT INVALID RDRAM LOCATION\n" );
                break;
            case DEBUG_MEDIUM:
                DebugMsg( DEBUG_MEDIUM | DEBUG_ERROR, "Attempting to execute RSP command at invalid RDRAM location\n" );
                break;
            case DEBUG_HIGH:
                DebugMsg( DEBUG_HIGH | DEBUG_ERROR, "// Attempting to execute RSP command at invalid RDRAM location\n" );
                break;
            }
#endif
            break;
        }

//		printf( "!!!!!! RDRAM = 0x%8.8x\n", RDRAM );//RSP.PC[RSP.PCi] );
        /*		{
        			static u8 *lastRDRAM = 0;
        			if (lastRDRAM == 0)
        				lastRDRAM = RDRAM;
        			if (RDRAM != lastRDRAM)
        			{
        				__asm__( "int $3" );
        			}
        		}*/
        u32 w0 = *(u32*)&RDRAM[RSP.PC[RSP.PCi]];
        u32 w1 = *(u32*)&RDRAM[RSP.PC[RSP.PCi] + 4];
        RSP.cmd = _SHIFTR( w0, 24, 8 );

#ifdef DEBUG
        DebugRSPState( RSP.PCi, RSP.PC[RSP.PCi], _SHIFTR( w0, 24, 8 ), w0, w1 );
        DebugMsg( DEBUG_LOW | DEBUG_HANDLED, "0x%08lX: CMD=0x%02lX W0=0x%08lX W1=0x%08lX\n", RSP.PC[RSP.PCi], _SHIFTR( w0, 24, 8 ), w0, w1 );
#endif

        RSP.PC[RSP.PCi] += 8;
        RSP.nextCmd = _SHIFTR( *(u32*)&RDRAM[RSP.PC[RSP.PCi]], 24, 8 );

        GBI.cmd[RSP.cmd]( w0, w1 );
    }

    /*	if (OGL.frameBufferTextures && gDP.colorImage.changed)
    	{
    		FrameBuffer_SaveBuffer( gDP.colorImage.address, gDP.colorImage.size, gDP.colorImage.width, gDP.colorImage.height );
    		gDP.colorImage.changed = FALSE;
    	}*/

    RSP.busy = FALSE;
    RSP.DList++;
    gSP.changed |= CHANGED_COLORBUFFER;
}
Example #4
0
void RSP_ProcessDList()
{
    VI_UpdateSize();
    OGL_UpdateScale();
    TextureCache_ActivateNoise(2);

    RSP.PC[0] = *(u32*)&DMEM[0x0FF0];
    RSP.PCi = 0;
    RSP.count = 0;

    RSP.halt = FALSE;
    RSP.busy = TRUE;

#ifdef __TRIBUFFER_OPT
    __indexmap_clear();
#endif

    gSP.matrix.stackSize = min( 32, *(u32*)&DMEM[0x0FE4] >> 6 );
    gSP.matrix.modelViewi = 0;
    gSP.changed |= CHANGED_MATRIX;

    for (int i = 0; i < 4; i++)
        for (int j = 0; j < 4; j++)
            gSP.matrix.modelView[0][i][j] = 0.0f;

    gSP.matrix.modelView[0][0][0] = 1.0f;
    gSP.matrix.modelView[0][1][1] = 1.0f;
    gSP.matrix.modelView[0][2][2] = 1.0f;
    gSP.matrix.modelView[0][3][3] = 1.0f;

    u32 uc_start = *(u32*)&DMEM[0x0FD0];
    u32 uc_dstart = *(u32*)&DMEM[0x0FD8];
    u32 uc_dsize = *(u32*)&DMEM[0x0FDC];

    if ((uc_start != RSP.uc_start) || (uc_dstart != RSP.uc_dstart))
        gSPLoadUcodeEx( uc_start, uc_dstart, uc_dsize );

    gDPSetAlphaCompare(G_AC_NONE);
    gDPSetDepthSource(G_ZS_PIXEL);
    gDPSetRenderMode(0, 0);
    gDPSetAlphaDither(G_AD_DISABLE);
    gDPSetColorDither(G_CD_DISABLE);
    gDPSetCombineKey(G_CK_NONE);
    gDPSetTextureConvert(G_TC_FILT);
    gDPSetTextureFilter(G_TF_POINT);
    gDPSetTextureLUT(G_TT_NONE);
    gDPSetTextureLOD(G_TL_TILE);
    gDPSetTextureDetail(G_TD_CLAMP);
    gDPSetTexturePersp(G_TP_PERSP);
    gDPSetCycleType(G_CYC_1CYCLE);
    gDPPipelineMode(G_PM_NPRIMITIVE);

#ifdef PRINT_DISPLAYLIST
    if ((RSP.DList%PRINT_DISPLAYLIST_NUM) == 0) LOG(LOG_VERBOSE, "BEGIN DISPLAY LIST %i \n", RSP.DList);
#endif

    while (!RSP.halt)
    {
        u32 pc = RSP.PC[RSP.PCi];

        if ((pc + 8) > RDRAMSize)
        {
#ifdef DEBUG
            DebugMsg( DEBUG_LOW | DEBUG_ERROR, "ATTEMPTING TO EXECUTE RSP COMMAND AT INVALID RDRAM LOCATION\n" );
#endif
            break;
        }


        u32 w0 = *(u32*)&RDRAM[pc];
        u32 w1 = *(u32*)&RDRAM[pc+4];
        RSP.nextCmd = _SHIFTR( *(u32*)&RDRAM[pc+8], 24, 8 );
        RSP.cmd = _SHIFTR( w0, 24, 8 );
        RSP.PC[RSP.PCi] += 8;

#ifdef PROFILE_GBI
        GBI_ProfileBegin(RSP.cmd);
#endif

#ifdef PRINT_DISPLAYLIST
        if ((RSP.DList%PRINT_DISPLAYLIST_NUM) == 0) LOG(LOG_VERBOSE, "%s: w0=0x%x w1=0x%x\n", GBI_GetFuncName(GBI.current->type, RSP.cmd), w0, w1);
#endif

        GBI.cmd[RSP.cmd]( w0, w1 );

#ifdef PROFILE_GBI
        GBI_ProfileEnd(RSP.cmd);
#endif
    }

#ifdef PRINT_DISPLAYLIST
        if ((RSP.DList%PRINT_DISPLAYLIST_NUM) == 0) LOG(LOG_VERBOSE, "END DISPLAY LIST %i \n", RSP.DList);
#endif

    RSP.busy = FALSE;
    RSP.DList++;
    gSP.changed |= CHANGED_COLORBUFFER;
}