Halo 2: Flickering/depth issues on Apple M1 Macs
Title
https://xemu.app/titles/4d530064/#Halo-2
Bug Description
Distinct from already known depth issues with Halo 2.
Possibly related to #523
Main menu blue overlay is broken, scene elements flicker:

Chief arm/hand model flickers:

Expected Behavior
xemu Version
v0.6.1-33-gbbcd5763e6
System Information
2020 M1 Mac mini macOS 11.6
Additional Context
No response
I decided to take a look at this over the weekend and was able to implement something that fixed a large chunk of the missing UI overlays on my M1 Mac mini. This does not address the flickering meshes or transparent meshes issues (which I believe to be related to a precision issue). There may be other issues that were addressed by the fix, these were just the things I noticed offhand.
The fix can be applied by replacing these lines in ./hw/xbox/nv2a/vsh.c#L852-L854 with the following:
" if (clipRange.y > clipRange.x)\n"
" oPos.z = (oPos.z - clipRange.x)/(0.5 * (clipRange.y - clipRange.x)) - 1;\n"
" else\n"
" oPos.z = (oPos.z - clipRange.y)/(0.5 * (clipRange.x - clipRange.y)) - 1;\n"/
xemu Version
v0.7.120
System Information
2020 M1 Mac mini macOS 14.1.1
Current Behavior
Missing blue background on mainmenu:
Missing profile icons:
Missing UI elements:
Fixed Behavior
Restored blue background on mainmenu:
Restored profile icons:
Restored UI elements:
@camden-smallwood what an improvement! Does this improve the frame rate at all? You should consider contributing these changes in a PR.
I didn't really notice any frame rate improvements on my machine, same variable level where it can sometimes run fine and sometimes it bogs down. I have no problem submitting a pull request for this change, but it will definitely require further changes to fix other issues (such as flickering and transparent meshes).
@camden-smallwood I apologize for asking a stupid question. I'm new to learning about emulation / XEMU and I'm new to learning about coding.
I've never actually coded in my life so I wasn't 100% sure on how to implement the code that you provided below to fix those pesky UI issues for Halo 2. I was able to find tutorial videos on how to get everything installed on my M3 Macbook Pro, regarding XEMU and for setting up Insignia.
Though, I'm so lost on how to fix the UI issues for Halo 2. Because I don't know anything about coding and sorry for me not knowing what to do.
" if (clipRange.y > clipRange.x)\n" " oPos.z = (oPos.z - clipRange.x)/(0.5 * (clipRange.y - clipRange.x)) - 1;\n" " else\n" " oPos.z = (oPos.z - clipRange.y)/(0.5 * (clipRange.x - clipRange.y)) - 1;\n"/
@MyHEROiSMe I've submitted this fix as a pull request here. You can download a build at the bottom if you would like to test it.
@ryzendew you should also edit your reply.
@camden-smallwood I clicked on the (here) / blue highlighted text and then I scrolled down to the bottom and I saw the builds.
Though how would I actually download the build of my choice?
@MyHEROiSMe I didn't realize the downloads were on a different page. You can find them at the bottom of the artifacts page here: https://github.com/xemu-project/xemu/actions/runs/8438350576?pr=1620
@camden-smallwood I still feel so so confused, regarding what to do (so that I can fix the UI for Halo 2).
Do I have to actually code stuff to fix the issue? Because I know absolutely nothing about coding or what I'm even doing.
Sorry again for being less educated, regarding this topic / coding / & how to fix the UI issue for Halo 2 on XEMU.
@MyHEROiSMe go to the link I shared in my previous message, scroll to the bottom, you will see an "Artifacts" section. Click on the name of the xemu build you want in order to download it. This xemu build will have the code changes applied to fix the UI for Halo 2.
@camden-smallwood Thanks and I appreciate that. I will give it a try later on tonight!
Unfortunately, the artefacts do not seem to be available anymore.
Unfortunately, the artefacts do not seem to be available anymore.
I just checked, they are still available. You can find them at the bottom of the page I linked above. The section looks like this:
for me it just says they are all expired
I've decided to close the pull request for the time being. Hopefully the problem gets fixed.
Why was this PR closed? It seems to fix a lot of halo 2 issues. Is it creating issues in other titles?
@remojansen when the artifacts were tested from #1620 on different platforms (macOS/Steamdeck), the clipRange fix didn't fix all UI issues in other titles. An alternative fix will have to be explored.
@mborgerson i am having the same exact isses on my apple M1 how can i apply this fix to XEMU mac?
@camden-smallwood can you make the download available again
Does this still happen since #2183 was merged in v0.8.65?
If so, is it fixed by the pending #2240 ?