1 // Copyright 2008 Dolphin Emulator Project
2 // Licensed under GPLv2+
3 // Refer to the license.txt file included.
4 
5 #pragma once
6 
7 #include "Common/CommonTypes.h"
8 
9 class DataReader;
10 
11 namespace OpcodeDecoder
12 {
13 // Global flag to signal if FifoRecorder is active.
14 extern bool g_record_fifo_data;
15 
16 enum
17 {
18   GX_NOP = 0x00,
19   GX_UNKNOWN_RESET = 0x01,
20 
21   GX_LOAD_BP_REG = 0x61,
22   GX_LOAD_CP_REG = 0x08,
23   GX_LOAD_XF_REG = 0x10,
24   GX_LOAD_INDX_A = 0x20,
25   GX_LOAD_INDX_B = 0x28,
26   GX_LOAD_INDX_C = 0x30,
27   GX_LOAD_INDX_D = 0x38,
28 
29   GX_CMD_CALL_DL = 0x40,
30   GX_CMD_UNKNOWN_METRICS = 0x44,
31   GX_CMD_INVL_VC = 0x48
32 };
33 
34 enum
35 {
36   GX_PRIMITIVE_MASK = 0x78,
37   GX_PRIMITIVE_SHIFT = 3,
38   GX_VAT_MASK = 0x07
39 };
40 
41 // These values are the values extracted using GX_PRIMITIVE_MASK
42 // and GX_PRIMITIVE_SHIFT.
43 // GX_DRAW_QUADS_2 behaves the same way as GX_DRAW_QUADS.
44 enum
45 {
46   GX_DRAW_QUADS = 0x0,           // 0x80
47   GX_DRAW_QUADS_2 = 0x1,         // 0x88
48   GX_DRAW_TRIANGLES = 0x2,       // 0x90
49   GX_DRAW_TRIANGLE_STRIP = 0x3,  // 0x98
50   GX_DRAW_TRIANGLE_FAN = 0x4,    // 0xA0
51   GX_DRAW_LINES = 0x5,           // 0xA8
52   GX_DRAW_LINE_STRIP = 0x6,      // 0xB0
53   GX_DRAW_POINTS = 0x7           // 0xB8
54 };
55 
56 void Init();
57 
58 template <bool is_preprocess = false>
59 u8* Run(DataReader src, u32* cycles, bool in_display_list);
60 
61 }  // namespace OpcodeDecoder
62