From 3199f8ae67e4209edb08f54fee56fe0e4f597291 Mon Sep 17 00:00:00 2001
From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com>
Date: Fri, 30 Jun 2023 14:39:25 +0300
Subject: [PATCH] [Shader JIT] Stub EMIT/SETEMIT

---
 include/PICA/dynapica/shader_rec_emitter_x64.hpp  | 2 ++
 include/PICA/shader.hpp                           | 3 +++
 src/core/PICA/dynapica/shader_rec_emitter_x64.cpp | 5 +++++
 3 files changed, 10 insertions(+)

diff --git a/include/PICA/dynapica/shader_rec_emitter_x64.hpp b/include/PICA/dynapica/shader_rec_emitter_x64.hpp
index 252285c6..ce9d992b 100644
--- a/include/PICA/dynapica/shader_rec_emitter_x64.hpp
+++ b/include/PICA/dynapica/shader_rec_emitter_x64.hpp
@@ -80,6 +80,7 @@ class ShaderEmitter : public Xbyak::CodeGenerator {
 	void recCMP(const PICAShader& shader, u32 instruction);
 	void recDP3(const PICAShader& shader, u32 instruction);
 	void recDP4(const PICAShader& shader, u32 instruction);
+	void recEMIT(const PICAShader& shader, u32 instruction);
 	void recEND(const PICAShader& shader, u32 instruction);
 	void recFLR(const PICAShader& shader, u32 instruction);
 	void recIFC(const PICAShader& shader, u32 instruction);
@@ -95,6 +96,7 @@ class ShaderEmitter : public Xbyak::CodeGenerator {
 	void recMUL(const PICAShader& shader, u32 instruction);
 	void recRCP(const PICAShader& shader, u32 instruction);
 	void recRSQ(const PICAShader& shader, u32 instruction);
+	void recSETEMIT(const PICAShader& shader, u32 instruction);
 	void recSGE(const PICAShader& shader, u32 instruction);
 	void recSGEI(const PICAShader& shader, u32 instruction);
 	void recSLT(const PICAShader& shader, u32 instruction);
diff --git a/include/PICA/shader.hpp b/include/PICA/shader.hpp
index 5822dd83..71f11219 100644
--- a/include/PICA/shader.hpp
+++ b/include/PICA/shader.hpp
@@ -16,6 +16,7 @@ namespace ShaderOpcodes {
 		ADD = 0x00,
 		DP3 = 0x01,
 		DP4 = 0x02,
+		DPH = 0x03,
 		MUL = 0x08,
 		SLT = 0x0A,
 		FLR = 0x0B,
@@ -35,6 +36,8 @@ namespace ShaderOpcodes {
 		IFU = 0x27,
 		IFC = 0x28,
 		LOOP = 0x29,
+		EMIT = 0x2A,
+		SETEMIT = 0x2B,
 		JMPC = 0x2C,
 		JMPU = 0x2D,
 		CMP1 = 0x2E, // Both of these instructions are CMP
diff --git a/src/core/PICA/dynapica/shader_rec_emitter_x64.cpp b/src/core/PICA/dynapica/shader_rec_emitter_x64.cpp
index b2868af5..de801fca 100644
--- a/src/core/PICA/dynapica/shader_rec_emitter_x64.cpp
+++ b/src/core/PICA/dynapica/shader_rec_emitter_x64.cpp
@@ -150,6 +150,11 @@ void ShaderEmitter::compileInstruction(const PICAShader& shaderUnit) {
 		case ShaderOpcodes::RCP: recRCP(shaderUnit, instruction); break;
 		case ShaderOpcodes::RSQ: recRSQ(shaderUnit, instruction); break;
 
+		case ShaderOpcodes::EMIT:
+		case ShaderOpcodes::SETEMIT:
+			emitPrintLog(shaderUnit);
+			break;
+
 		// We consider both MAD and MADI to be the same instruction and decode which one we actually have in recMAD
 		case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37:
 		case 0x38: case 0x39: case 0x3A: case 0x3B: case 0x3C: case 0x3D: case 0x3E: case 0x3F: