diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 261fdb099a..aef1ced34c 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -189,21 +189,66 @@ u32 RSXThread::OutOfArgsCount(const uint x, const u32 cmd, const u32 count, cons return 0; } -#define case_2(offset, step) \ - case offset: \ - case offset + step: -#define case_4(offset, step) \ - case_2(offset, step) \ - case_2(offset + 2*step, step) -#define case_8(offset, step) \ - case_4(offset, step) \ - case_4(offset + 4*step, step) -#define case_16(offset, step) \ - case_8(offset, step) \ - case_8(offset + 8*step, step) -#define case_32(offset, step) \ - case_16(offset, step) \ - case_16(offset + 16*step, step) +#define case_4(a, m) \ + case a + m: \ + case a + m * 2: \ + case a + m * 3: \ + index = (cmd - a) / m; \ + case a \ + +#define case_16(a, m) \ + case a + m: \ + case a + m * 2: \ + case a + m * 3: \ + case a + m * 4: \ + case a + m * 5: \ + case a + m * 6: \ + case a + m * 7: \ + case a + m * 8: \ + case a + m * 9: \ + case a + m * 10: \ + case a + m * 11: \ + case a + m * 12: \ + case a + m * 13: \ + case a + m * 14: \ + case a + m * 15: \ + index = (cmd - a) / m; \ + case a \ + +#define case_32(a, m) \ + case a + m: \ + case a + m * 2: \ + case a + m * 3: \ + case a + m * 4: \ + case a + m * 5: \ + case a + m * 6: \ + case a + m * 7: \ + case a + m * 8: \ + case a + m * 9: \ + case a + m * 10: \ + case a + m * 11: \ + case a + m * 12: \ + case a + m * 13: \ + case a + m * 14: \ + case a + m * 15: \ + case a + m * 16: \ + case a + m * 17: \ + case a + m * 18: \ + case a + m * 19: \ + case a + m * 20: \ + case a + m * 21: \ + case a + m * 22: \ + case a + m * 23: \ + case a + m * 24: \ + case a + m * 25: \ + case a + m * 26: \ + case a + m * 27: \ + case a + m * 28: \ + case a + m * 29: \ + case a + m * 30: \ + case a + m * 31: \ + index = (cmd - a) / m; \ + case a \ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const u32 count) { @@ -352,26 +397,26 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const break; // Texture - case_16(NV4097_SET_TEXTURE_FORMAT, 0x20) - case_16(NV4097_SET_TEXTURE_OFFSET, 0x20) - case_16(NV4097_SET_TEXTURE_FILTER, 0x20) - case_16(NV4097_SET_TEXTURE_ADDRESS, 0x20) - case_16(NV4097_SET_TEXTURE_IMAGE_RECT, 32) - case_16(NV4097_SET_TEXTURE_BORDER_COLOR, 0x20) - case_16(NV4097_SET_TEXTURE_CONTROL0, 0x20) - case_16(NV4097_SET_TEXTURE_CONTROL1, 0x20) + case_16(NV4097_SET_TEXTURE_FORMAT, 0x20) : + case_16(NV4097_SET_TEXTURE_OFFSET, 0x20) : + case_16(NV4097_SET_TEXTURE_FILTER, 0x20) : + case_16(NV4097_SET_TEXTURE_ADDRESS, 0x20) : + case_16(NV4097_SET_TEXTURE_IMAGE_RECT, 32) : + case_16(NV4097_SET_TEXTURE_BORDER_COLOR, 0x20) : + case_16(NV4097_SET_TEXTURE_CONTROL0, 0x20) : + case_16(NV4097_SET_TEXTURE_CONTROL1, 0x20) : { // Done using methodRegisters in RSXTexture.cpp } break; - case_16(NV4097_SET_TEX_COORD_CONTROL, 4) + case_16(NV4097_SET_TEX_COORD_CONTROL, 4) : { LOG_WARNING(RSX, "NV4097_SET_TEX_COORD_CONTROL"); } break; - case_16(NV4097_SET_TEXTURE_CONTROL3, 4) + case_16(NV4097_SET_TEXTURE_CONTROL3, 4) : { RSXTexture& tex = m_textures[index]; const u32 a0 = ARGS(0); @@ -382,19 +427,19 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const break; // Vertex Texture - case_4(NV4097_SET_VERTEX_TEXTURE_FORMAT, 0x20) - case_4(NV4097_SET_VERTEX_TEXTURE_OFFSET, 0x20) - case_4(NV4097_SET_VERTEX_TEXTURE_FILTER, 0x20) - case_4(NV4097_SET_VERTEX_TEXTURE_ADDRESS, 0x20) - case_4(NV4097_SET_VERTEX_TEXTURE_IMAGE_RECT, 0x20) - case_4(NV4097_SET_VERTEX_TEXTURE_BORDER_COLOR, 0x20) - case_4(NV4097_SET_VERTEX_TEXTURE_CONTROL0, 0x20) + case_4(NV4097_SET_VERTEX_TEXTURE_FORMAT, 0x20) : + case_4(NV4097_SET_VERTEX_TEXTURE_OFFSET, 0x20) : + case_4(NV4097_SET_VERTEX_TEXTURE_FILTER, 0x20) : + case_4(NV4097_SET_VERTEX_TEXTURE_ADDRESS, 0x20) : + case_4(NV4097_SET_VERTEX_TEXTURE_IMAGE_RECT, 0x20) : + case_4(NV4097_SET_VERTEX_TEXTURE_BORDER_COLOR, 0x20) : + case_4(NV4097_SET_VERTEX_TEXTURE_CONTROL0, 0x20) : { // Done using methodRegisters in RSXTexture.cpp } break; - case_4(NV4097_SET_VERTEX_TEXTURE_CONTROL3, 0x20) + case_4(NV4097_SET_VERTEX_TEXTURE_CONTROL3, 0x20) : { RSXVertexTexture& tex = m_vertex_textures[index]; const u32 a0 = ARGS(0); @@ -405,7 +450,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const break; // Vertex data - case_16(NV4097_SET_VERTEX_DATA4UB_M, 4) + case_16(NV4097_SET_VERTEX_DATA4UB_M, 4) : { const u32 a0 = ARGS(0); u8 v0 = a0; @@ -424,7 +469,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const } break; - case_16(NV4097_SET_VERTEX_DATA2F_M, 8) + case_16(NV4097_SET_VERTEX_DATA2F_M, 8) : { const u32 a0 = ARGS(0); const u32 a1 = ARGS(1); @@ -444,7 +489,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const } break; - case_16(NV4097_SET_VERTEX_DATA4F_M, 16) + case_16(NV4097_SET_VERTEX_DATA4F_M, 16) : { const u32 a0 = ARGS(0); const u32 a1 = ARGS(1); @@ -470,7 +515,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const } break; - case_16(NV4097_SET_VERTEX_DATA_ARRAY_OFFSET, 4) + case_16(NV4097_SET_VERTEX_DATA_ARRAY_OFFSET, 4) : { const u32 addr = GetAddress(ARGS(0) & 0x7fffffff, ARGS(0) >> 31); CMD_LOG("num=%d, addr=0x%x", index, addr); @@ -481,7 +526,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const } break; - case_16(NV4097_SET_VERTEX_DATA_ARRAY_FORMAT, 4) + case_16(NV4097_SET_VERTEX_DATA_ARRAY_FORMAT, 4): { const u32 a0 = ARGS(0); u16 frequency = a0 >> 16; @@ -1076,7 +1121,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const { if (ARGS(1)) { - LOG_WARNING(RSX, "NV4097_SET_TRANSFORM_PROGRAM_LOAD: start = %d", ARGS(0)); + LOG_WARNING(RSX, "NV4097_SET_TRANSFORM_PROGRAM_LOAD: start = %d", ARGS(1)); } } } @@ -1091,7 +1136,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const } break; - case_32(NV4097_SET_TRANSFORM_PROGRAM, 4) + case_32(NV4097_SET_TRANSFORM_PROGRAM, 4): { //LOG_WARNING(RSX, "NV4097_SET_TRANSFORM_PROGRAM[%d](%d)", index, count); @@ -1572,7 +1617,9 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const case NV4097_SET_CONTEXT_DMA_COLOR_D: { if (ARGS(0)) + { LOG_WARNING(RSX, "NV4097_SET_CONTEXT_DMA_COLOR_D: 0x%x", ARGS(0)); + } } break; @@ -2366,7 +2413,6 @@ void RSXThread::Task() else { //LOG_WARNING(RSX, "RSX: increment cmd! 0x%x", cmd); - inc++; } if (cmd == 0) //nop