Play Windows games on Apple Silicon Macs. Free, open-source app that installs the official Battle.net, Steam, Epic and GOG launchers and lists your games in one library.
HTML apple-siliconbattle-netcrossover-alternatived3dmetaldiablo-ii-resurrecteddxmtea-appepic-gamesgame-porting-toolkitgogmac-gamingmacosmacos-gamingrockstar-gamessteamubisoft-connectwhisky-alternativewindows-gameswinewine-wrapper
D2R first person on the Mac: mouse look on, view starts level, no ReShade tutorial line (#198)
Mikek92adbd4bcd03
diff --git a/docs/VR.md b/docs/VR.mdindex 2d8a3d4128b..3eef6a3d9c2 100644--- a/docs/VR.md+++ b/docs/VR.md@@ -26,6 +26,9 @@ The mod's flat mode (`[mode] platform = 0` in `d2r_pcvr.ini`, view in `flat_viewRogue Encampment, offline character select with the mouse.On the Mac screen the game keeps your own resolution and window mode (in VR it is fixed at windowed 1920x1080).+In first and third person the mouse turns the view and W A S D walk (the mod's `[input] mouse_look`, which is off in+its own settings), and the view starts level (`[camera] pitch = -85`; -30 in the headset, where the head lifts it).+ReShade's first-run tutorial line is turned off so it does not stay on screen.NVIDIA DLSS works in the copy through Apple's MetalFX bridge, like normal D2R, when the engine has Apple's NGX shim.Two things were in the way and are fixed by Soju (2026-11-25, D2R 3.4.95032, GPTK 3.0, M4 Pro):diff --git a/scripts/d2r-vr.py b/scripts/d2r-vr.pyindex 15171468332..c91be1c087f 100644--- a/scripts/d2r-vr.py+++ b/scripts/d2r-vr.py@@ -545,37 +545,75 @@ def stage_mod_patch(mod, plugin, spec):'Apply the accompanying patch to this base.\n')+FLAT_PITCH, VR_PITCH = '-85', '-30'VIEWS = {'classic': 1, 'third': 2, 'first': 3} # the mod's flat views, F1 - F3-def set_mode(game, flat, view='first'):- """The mod plays to the headset ([mode] platform = 1) or to the Mac screen with mouse look and- W A S D (platform = 0), in the view flat_view names. Mac keyboards send F1 - F3 as brightness keys- unless fn is held, so the view is chosen before the game starts."""- ini = game / 'mods' / 'D2R-PCVR' / 'd2rloader/plugins/d2r_pcvr.ini'+def set_ini(ini, want):+ """Set key = value in [section]s of an ini file the mod or ReShade reads, keeping its line+ endings; a key missing from its section is added at the section's end, a missing section at the end."""try:text = read_raw(ini)except OSError:return- want = {'platform': '0' if flat else '1'}- if flat:- want['flat_view'] = str(VIEWS.get(view, 3))+ end = '\r\n' if '\r\n' in text else '\n'+ left = {sec: dict(keys) for sec, keys in want.items()}out, section = [], ''++ def flush():+ for key, value in left.pop(section, {}).items():+ out.append(key + '=' + value + end if ini.name == 'ReShade.ini' else key + ' = ' + value + end)+for line in text.splitlines(keepends=True):stripped = line.strip()if stripped.startswith('['):+ if out and not out[-1].strip():+ blank = out.pop()+ flush()+ out.append(blank)+ else:+ flush()section = stripped- elif section == '[mode]' and '=' in stripped:+ elif section in left and '=' in stripped:key = stripped.split('=', 1)[0].strip()- if key in want:- end = '\r\n' if line.endswith('\r\n') else '\n'- line = key + ' = ' + want[key] + end+ if key in left[section]:+ value = left[section].pop(key)+ line = (key + '=' + value if ini.name == 'ReShade.ini' else key + ' = ' + value) + endout.append(line)+ flush()+ for sec, keys in left.items():+ if keys:+ if out and out[-1].strip():+ out.append(end)+ out.append(sec + end)+ for key, value in keys.items():+ out.append((key + '=' + value if ini.name == 'ReShade.ini' else key + ' = ' + value) + end)new = ''.join(out)if new != text:write_raw(ini, new)+def set_mode(game, flat, view='first'):+ """The mod plays to the headset ([mode] platform = 1) or to the Mac screen (platform = 0), in+ the view flat_view names. Mac keyboards send F1 - F3 as brightness keys unless fn is held, so+ the view is chosen before the game starts. On the Mac screen in first or third person the mouse+ turns the view and W A S D walk ([input] mouse_look, off in the mod's own settings, where F9+ would turn it on); in the headset and in the game's own camera it stays off."""+ mod = game / 'mods' / 'D2R-PCVR'+ mode = {'platform': '0' if flat else '1'}+ if flat:+ mode['flat_view'] = str(VIEWS.get(view, 3))+ look = '1' if flat and view != 'classic' else '0'+ # [camera] pitch: the view's tilt from the game's own steep camera, more negative looking higher.+ # -30 (the mod's) suits a headset, where the head lifts it further; on the Mac screen it left first+ # person looking down at the hero's shoulders, and -85 looks ahead (checked 2026-11-25).+ pitch = FLAT_PITCH if flat else VR_PITCH+ set_ini(mod / 'd2rloader/plugins/d2r_pcvr.ini',+ {'[mode]': mode, '[input]': {'mouse_look': look}, '[camera]': {'pitch': pitch}})+ # ReShade's first-run line ("Press 'Home' to start the tutorial") otherwise stays on screen.+ set_ini(mod / 'reshade/ReShade.ini', {'[OVERLAY]': {'TutorialProgress': '4'}})++def play_env(flat, dlss=False):env = wine_env(BOTTLE)if dlss:diff --git a/tests/test_d2r_vr.py b/tests/test_d2r_vr.pyindex 33100fd49c0..eb4f60b187b 100644--- a/tests/test_d2r_vr.py+++ b/tests/test_d2r_vr.py@@ -75,19 +75,34 @@ class ManifestTests(unittest.TestCase):for field in ('installed', 'current', 'source_build', 'source_supported'):self.assertIn(field, sheet)- def test_flat_play_sets_the_mods_mode_and_view(self):+ def test_flat_play_sets_the_mods_mode_view_and_mouse_look(self):with tempfile.TemporaryDirectory() as d:game = Path(d)ini = game / 'mods/D2R-PCVR/d2rloader/plugins/d2r_pcvr.ini'+ reshade = game / 'mods/D2R-PCVR/reshade/ReShade.ini'ini.parent.mkdir(parents=True)- ini.write_bytes(b'[stereo]\r\nplatform = 9\r\n[mode]\r\nplatform = 1\r\nflat_view = 3\r\nvr_mode = 4\r\n')+ reshade.parent.mkdir(parents=True)+ ini.write_bytes(b'[camera]\r\npitch = -30\r\n[stereo]\r\nplatform = 9\r\n[mode]\r\nplatform = 1\r\nflat_view = 3\r\nvr_mode = 4\r\n'+ b'\r\n[input]\r\nmouse_look = 0\r\nmouse_speed = 0.15\r\n')+ reshade.write_bytes(b'[GENERAL]\r\nPresetPath=.\\D2R_Frame_ReShade.ini\r\n\r\n[INPUT]\r\nKeyOverlay=36,0,0,0\r\n\r\n')vr.set_mode(game, True, 'third')self.assertEqual(ini.read_bytes(),- b'[stereo]\r\nplatform = 9\r\n[mode]\r\nplatform = 0\r\nflat_view = 2\r\nvr_mode = 4\r\n')- vr.set_mode(game, True, 'classic')+ b'[camera]\r\npitch = -85\r\n[stereo]\r\nplatform = 9\r\n[mode]\r\nplatform = 0\r\nflat_view = 2\r\nvr_mode = 4\r\n'+ b'\r\n[input]\r\nmouse_look = 1\r\nmouse_speed = 0.15\r\n')+ self.assertEqual(reshade.read_bytes(), b'[GENERAL]\r\nPresetPath=.\\D2R_Frame_ReShade.ini\r\n\r\n'+ b'[INPUT]\r\nKeyOverlay=36,0,0,0\r\n\r\n[OVERLAY]\r\nTutorialProgress=4\r\n')+ vr.set_mode(game, True, 'third') # nothing left to change+ self.assertEqual(reshade.read_bytes().count(b'TutorialProgress'), 1)+ vr.set_mode(game, True, 'classic') # the game's own camera: the mouse clicks as usualself.assertIn(b'flat_view = 1\r\n', ini.read_bytes())+ self.assertIn(b'mouse_look = 0\r\n', ini.read_bytes())vr.set_mode(game, False) # VR again: the headset, the flat view kept for next timeself.assertIn(b'[mode]\r\nplatform = 1\r\nflat_view = 1\r\n', ini.read_bytes())+ self.assertIn(b'mouse_look = 0\r\n', ini.read_bytes())+ self.assertIn(b'[camera]\r\npitch = -30\r\n', ini.read_bytes()) # the headset's tilt back+ ini.write_bytes(b'[mode]\nplatform = 1\n') # no [input] yet: added+ vr.set_mode(game, True)+ self.assertEqual(ini.read_bytes(), b'[mode]\nplatform = 0\nflat_view = 3\n\n[input]\nmouse_look = 1\n\n[camera]\npitch = -85\n')vr.set_mode(Path(d) / 'missing', True) # no mod installed: nothing to do, no errordef test_dlss_follows_the_metalfx_bridge(self):