Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VideoCommon: fix projection graphics mod affecting more than intended #10796

Merged

Conversation

iwubcode
Copy link
Contributor

Graphics mods have the ability to move objects by modifying the projection matrix (similar to how FreeLook works), however previous mods were impacting more draw calls than expected. This is because we wouldn't revert the graphics mod projection until the emulated hardware received a new projection change. This change will make the projection "dirty" triggering it on the subsequent draw, ensuring that the projection is properly reset.

Here's an unmodded example:

SO3EE9_2022-06-29_20-00-55

Here's a mod that moves the minimap (and removes the "quick menu") in master. You can see it moves more than just the minimap:

SO3EE9_2022-06-29_20-00-37

Here it is in this PR, only the minimap is moved:

SO3EE9_2022-06-29_20-02-01

@iwubcode
Copy link
Contributor Author

Here's the mod for those interested:

{
	"meta":
	{
		"title": "HUD mod example",
		"author": "iwubcode"
	},
	"groups":
	[
		{
			"name": "Minimap",
			"targets": [
				{
					"type": "projection",
					"value": "2d",
					"texture_filename": "tex1_32x48_9b0e36a2dc0375bd_9b854bc1a716cd1e_9"
				},
				{
					"type": "projection",
					"value": "2d",
					"texture_filename": "tex1_56x56_3a99ea0dcf04b4fb_25a457f8dde3b22b_8"
				},
				{
					"type": "projection",
					"value": "2d",
					"texture_filename": "tex1_16x16_917fadce804546c5_c3e633ee0fc6c693_8"
				},
				{
					"type": "projection",
					"value": "2d",
					"texture_filename": "tex1_48x48_fb0d210d9311a1d0_71c8ad69000b7eba_8"
				}
			]

		},
		{
			"name": "Minimap Cursor",
			"targets": [
				{
					"type": "projection",
					"value": "2d",
					"texture_filename": "tex1_16x16_917fadce804546c5_c3e633ee0fc6c693_8"
				}
			]

		},
		{
			"name": "Quick Menu",
			"targets": [
				{
					"type": "draw_started",
					"texture_filename": "tex1_16x16_3498b260a01220db_c2e3860e283210e3_8"
				},
				{
					"type": "draw_started",
					"texture_filename": "tex1_16x16_80d9a760113b9978_ec2587811437efb4_8"
				},
				{
					"type": "draw_started",
					"texture_filename": "tex1_16x16_46be8d85a9a99192_7b5d64bb4b2c4f56_8"
				},
				{
					"type": "draw_started",
					"texture_filename": "tex1_80x16_7ee5eaa49534a9b9_cedab95029a913cf_8"
				},
				{
					"type": "draw_started",
					"texture_filename": "tex1_80x16_5913fe990a8192e0_b92d00c8ea9ec215_8"
				},
				{
					"type": "draw_started",
					"texture_filename": "tex1_80x16_d2f8d4f2df8c5b67_c2ece845670d1820_8"
				},
				{
					"type": "draw_started",
					"texture_filename": "tex1_16x24_09fe47a941ee05e6_65b2af93c21e16be_8"
				},
				{
					"type": "draw_started",
					"texture_filename": "tex1_8x24_203e7f2cd6d97080_956bf7b4a08720c7_8"
				}
			]

		}
	],
	"features":
	[
		{
			"group": "Minimap",
			"action": "move",
			"action_data": {
				"X": -0.15,
				"Y": 0.10,
				"Z": 0
			}
		},
		{
			"group": "Minimap Cursor",
			"action": "move",
			"action_data": {
				"X": -48.0,
				"Y": 25.0,
				"Z": 0
			}
		},
		{
			"group": "Quick Menu",
			"action": "skip"
		}
	]
}

@JMC47
Copy link
Contributor

JMC47 commented Jun 30, 2022

Tested and the code looks super simple. Should be fine to merge.

@JMC47 JMC47 merged commit a12b9ba into dolphin-emu:master Jun 30, 2022
@chrisleigh-stack
Copy link

Is this available on android, the graphics mod?

@iwubcode iwubcode deleted the graphics_mod_overeager_projection_change branch July 2, 2022 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants