Skip to content

Commit

Permalink
Merge pull request #354 from magumagu/gx-primitive-mask
Browse files Browse the repository at this point in the history
Opcode decoding: 0xC0 isn't a valid command.
  • Loading branch information
neobrain committed May 16, 2014
2 parents 36720e6 + 369c0c4 commit 25e8dc0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Source/Core/VideoBackends/Software/OpcodeDecoder.cpp
Expand Up @@ -201,7 +201,7 @@ void DecodeStandard(u32 bufferSize)

// draw primitives
default:
if (Cmd & 0x80)
if ((Cmd & 0xC0) == 0x80)
{
u8 vatIndex = Cmd & GX_VAT_MASK;
u8 primitiveType = (Cmd & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT;
Expand Down Expand Up @@ -283,7 +283,7 @@ bool CommandRunnable(u32 iBufferSize)

// draw primitives
default:
if (Cmd & 0x80)
if ((Cmd & 0xC0) == 0x80)
minSize = 3;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VideoBackends/Software/OpcodeDecoder.h
Expand Up @@ -23,7 +23,7 @@ namespace OpcodeDecoder
#define GX_CMD_CALL_DL 0x40
#define GX_CMD_INVL_VC 0x48

#define GX_PRIMITIVE_MASK 0x78
#define GX_PRIMITIVE_MASK 0x38
#define GX_PRIMITIVE_SHIFT 3
#define GX_VAT_MASK 0x07

Expand Down
6 changes: 3 additions & 3 deletions Source/Core/VideoCommon/OpcodeDecoding.cpp
Expand Up @@ -201,7 +201,7 @@ u32 FifoCommandRunnable(u32 &command_size)
break;

default:
if (cmd_byte & 0x80)
if ((cmd_byte & 0xC0) == 0x80)
{
// check if we can read the header
if (buffer_size >= 3)
Expand Down Expand Up @@ -346,7 +346,7 @@ static void Decode()

// draw primitives
default:
if (cmd_byte & 0x80)
if ((cmd_byte & 0xC0) == 0x80)
{
// load vertices (use computed vertex size from FifoCommandRunnable above)
u16 numVertices = DataReadU16();
Expand Down Expand Up @@ -434,7 +434,7 @@ static void DecodeSemiNop()

// draw primitives
default:
if (cmd_byte & 0x80)
if ((cmd_byte & 0xC0) == 0x80)
{
// load vertices (use computed vertex size from FifoCommandRunnable above)
u16 numVertices = DataReadU16();
Expand Down

0 comments on commit 25e8dc0

Please sign in to comment.