### Set common paths for WineForge Source: https://github.com/alien4042x/wineforge/blob/main/README.md Exports environment variables for Wine, prefix, and runtime directories. Required before running any example. ```sh export WINE=/path/to/wineforge/bin/wine export WINEPREFIX=/path/to/prefix export D3DMETAL_RUNTIME_DIR=/path/to/lib/d3dmetal export DXMT_RUNTIME_DIR=/path/to/lib/dxmt export WFDXCOMPAT_RUNTIME_DIR=/path/to/lib/wfdxcompat ``` -------------------------------- ### Run with D3DMetal using NVIDIA identity Source: https://github.com/alien4042x/wineforge/blob/main/README.md Launches an application with D3DMetal backend, NVIDIA upscaler profile, and MetalFX enabled. Requires matching NVAPI/NVNGX PE files and registry setup from the D3DMetal runtime package. ```sh env GRAPHICS_BACKEND=d3dmetal \ D3DMETAL_UPSCALER_PROFILE=nvidia \ D3DM_VENDOR_ID=4318 \ D3DM_DEVICE_ID=10370 \ D3DM_DEVICE_DESCRIPTION="NVIDIA GeForce RTX 4080" \ D3DM_ENABLE_METALFX=1 \ WINEDLLOVERRIDES='dxgi,d3d10,d3d10core,d3d11,d3d12=n,b;nvapi,nvapi64,nvngx=b' \ "$WINE" /path/to/application.exe ``` -------------------------------- ### Build WineForge with make Source: https://github.com/alien4042x/wineforge/blob/main/README.md Builds Wine normally after configuration. Run in the source directory. ```sh make -j8 ``` ```sh make install ``` -------------------------------- ### Run with D3DMetal using AMD identity Source: https://github.com/alien4042x/wineforge/blob/main/README.md Launches an application with D3DMetal backend, AMD upscaler profile, and specific vendor/device IDs. Requires matching PE DLL and Unix library directories via WINEDLLPATH or equivalent. ```sh env GRAPHICS_BACKEND=d3dmetal \ D3DMETAL_UPSCALER_PROFILE=amd \ D3DM_VENDOR_ID=4098 \ D3DM_DEVICE_ID=29631 \ D3DM_DEVICE_DESCRIPTION="AMD Radeon RX 6800 XT" \ WINEDLLOVERRIDES='atidxx64,amdxc64,amd_fidelityfx_upscaler_dx12,amd_fidelityfx_framegeneration_dx12=n,b;dxgi,d3d10,d3d10core,d3d11,d3d12=n,b' \ "$WINE" /path/to/application.exe ``` -------------------------------- ### WFDXCompat runtime directory layout Source: https://github.com/alien4042x/wineforge/blob/main/README.md Shows the expected directory structure for the external WFDXCompat runtime, which is not bundled with the source. The layout includes the x86_64-windows subdirectory containing the required DLLs: d3d12.dll, d3d12core.dll, wfdxbackend-d3d12.dll, and wfdx-launchers-v1.dll. ```text lib/wfdxcompat/ x86_64-windows/ d3d12.dll d3d12core.dll wfdxbackend-d3d12.dll wfdx-launchers-v1.dll ``` -------------------------------- ### Enable DXMT NVIDIA extension path Source: https://github.com/alien4042x/wineforge/blob/main/README.md Runs a game with DXMT backend and enables NVIDIA extension path via DXMT_ENABLE_NVEXT=1. Use when a game requires NVIDIA extensions. ```sh env GRAPHICS_BACKEND=dxmt \ DXMT_ENABLE_NVEXT=1 \ WINEDLLOVERRIDES='dxgi,d3d10,d3d10core,d3d11,d3d12,winemetal=b' \ "$WINE" /path/to/game.exe ``` -------------------------------- ### Configure WineForge for macOS (x86_64) Source: https://github.com/alien4042x/wineforge/blob/main/README.md Configure command for building WineForge on macOS with Intel Homebrew. Requires Xcode Command Line Tools, Homebrew bison and pkg-config, llvm-mingw, and a separate Apple Game Porting Toolkit / D3DMetal runtime source. The exact prefix and dependency paths are left to the local builder. ```sh arch -x86_64 "$SOURCE/configure" \ --build=x86_64-apple-darwin \ --enable-archs=i386,x86_64 \ --prefix="$INSTALL" \ --disable-tests \ --disable-winedbg \ --disable-winemenubuilder \ --without-alsa \ --without-capi \ --with-coreaudio \ --with-cups \ --without-dbus \ --with-ffmpeg \ --without-fontconfig \ --with-freetype \ --with-gettext \ --without-gettextpo \ --without-gphoto \ --with-gnutls \ --without-gssapi \ --with-gstreamer \ --without-inotify \ --without-krb5 \ --with-mingw \ --without-netapi \ --with-opencl \ --without-opengl \ --without-oss \ --with-pcap \ --without-pcsclite \ --with-pthread \ --without-pulse \ --without-sane \ --with-sdl \ --without-udev \ --without-usb \ --without-v4l2 \ --without-vulkan \ --without-wayland \ --without-x ``` -------------------------------- ### Enable WFUSync with environment variable Source: https://github.com/alien4042x/wineforge/blob/main/README.md Set the WINEWFUSYNC environment variable to 1 to enable the WFUSync backend. This is an opt-in feature; unsupported waits and sensitive synchronization semantics remain on the Wine server fallback path. ```sh WINEWFUSYNC=1 ``` -------------------------------- ### window.onmessage handler for echo and XHR tests Source: https://github.com/alien4042x/wineforge/blob/main/dlls/mshtml/tests/xhr_iframe.html Handles incoming postMessage events. For 'echo', it posts back 'echo'. For 'async_xhr', it creates an asynchronous XMLHttpRequest to 'echo.php?delay_with_signal', sets a custom header, sends 'foo', and posts 'async_xhr' and 'async_xhr(DONE)' messages. For 'sync_xhr', it creates a synchronous XMLHttpRequest to the same URL, sets the header, posts 'sync_xhr(pre-send)' before sending, sends 'bar', and posts 'sync_xhr' and 'sync_xhr(DONE)' messages. ```javascript window.onmessage = function(e) { if(e.data === "echo") parent.postMessage("echo", "*"); else if(e.data === "async_xhr") { var async_xhr = new XMLHttpRequest(); async_xhr.open("POST", "echo.php?delay_with_signal", true); async_xhr.onreadystatechange = function() { if(async_xhr.readyState == 4) parent.postMessage("async_xhr(DONE)", "*"); }; async_xhr.setRequestHeader("X-Test", "True"); async_xhr.send("foo"); parent.postMessage("async_xhr", "*"); } else if(e.data === "sync_xhr") { var sync_xhr = new XMLHttpRequest(); sync_xhr.open("POST", "echo.php?delay_with_signal", false); sync_xhr.onreadystatechange = function() { if(sync_xhr.readyState == 4) parent.postMessage("sync_xhr(DONE)", "*"); }; sync_xhr.setRequestHeader("X-Test", "True"); parent.postMessage("sync_xhr(pre-send)", "*"); sync_xhr.send("bar"); parent.postMessage("sync_xhr", "*"); } } ``` -------------------------------- ### Create image and set onload/onerror handlers Source: https://github.com/alien4042x/wineforge/blob/main/dlls/mshtml/tests/events.html Creates an img element, sets its src to a remote image, and assigns onload and onerror handlers that set a flag and trace the event. ```javascript var img = document.createElement("img"); img.src = "http://test.winehq.org/tests/winehq_snapshot/index_files/winehq_logo_glass.png"; var img_onload_called = false; img.onload = function() { trace("img.onload"); img_onload_called = true; } img.onerror = function() { trace("img.onerror"); img_onload_called = true; } ``` -------------------------------- ### Run D3D10/D3D11 application through DXMT Source: https://github.com/alien4042x/wineforge/blob/main/README.md Runs a D3D10 or D3D11 application entirely through DXMT backend. Uses winemetal override for DXMT. ```sh env GRAPHICS_BACKEND=dxmt \ WINEDLLOVERRIDES='dxgi,d3d10,d3d10core,d3d11,d3d12,winemetal=b' \ "$WINE" /path/to/application.exe ``` -------------------------------- ### Test script element insertion and readystatechange Source: https://github.com/alien4042x/wineforge/blob/main/dlls/mshtml/tests/events.html Creates a script element with src 'externscr.js', appends it to the body, and verifies that the external script runs (extern_cnt becomes 1) and that the readystatechange event fires with the expected readyState sequence. ```javascript function test\_insert\_script() { var e = document.createElement("script"); extern\_cnt = 0; e.src = "externscr.js"; var readystatechange\_log = ""; e.onreadystatechange = function() { ok(window.event.srcElement === e, "srcElement != e"); readystatechange\_log += "," + e.readyState; ok(extern\_cnt === 1, "extern\_cnt = " + extern\_cnt); if(e.readyState === "complete") { ok(readystatechange\_log === "append,complete", "readystatechange\_log = " + readystatechange\_log); reportSuccess(); } } document.body.appendChild(e); ok(extern\_cnt === 1, "extern\_cnt = " + extern\_cnt); readystatechange\_log = "append"; } ``` -------------------------------- ### Run all tests and report success Source: https://github.com/alien4042x/wineforge/blob/main/dlls/mshtml/tests/jstest.html Executes all test functions, checks global variable behavior, and calls external.reportSuccess after a timeout. ```javascript var globalVar = false; function runTests() { obj = new Object(); ok(obj === window.obj, "obj !== window.obj"); ok(typeof(divid) === "object", "typeof(divid) = " + typeof(divid)); test_removeAttribute(document.getElementById("divid")); test_removeAttribute(document.body); test_select_index(); test_clone_node(); test_createDocumentFragment(); test_document_name_as_index(); test_remove_style_attribute(); test_getter_call(); test_funcobj_call(); test_attrs(); test_attribute_collection(); test_arg_conv(); test_override_functions(); test_forin(); test_customtag(); test_whitespace_nodes(); test_language_attribute(); test_text_node(); test_xhr(); var r = window.execScript("globalVar = true;"); ok(r === undefined, "execScript returned " + r); ok(globalVar === true, "globalVar = " + globalVar); /* Call setTimeout without specified time. */ window.setTimeout(function() { external.reportSuccess(); }); } function runTest() { try { runTests(); }catch(e) { ok(false, "got exception " + e.message); } } ``` -------------------------------- ### Script readyState change handlers Source: https://github.com/alien4042x/wineforge/blob/main/dlls/mshtml/tests/events.html Defines variables and functions to track readyState changes for inline and external scripts, including onreadystatechange handlers and a function to check inline script completion. ```javascript var inlscr_complete_called = false, extern_res_script_rs = "", extern_http_script_rs = ""; var extern_cnt = 0; function expect_inlscr_complete() { var elem = document.getElementById("inlscr"); ok(elem.readyState === "complete" || broken(elem.readyState === "loading"), "expect_inlscr_complete: elem.readyState = " + elem.readyState); if(elem.readyState === "complete") inlscr_complete_called = true; } function extern_res_script_readystatechange() { var elem = document.getElementById("extscr"); if(elem.readyState != "loading") extern_res_script_rs += elem.readyState + extern_cnt + ","; else trace("Got loading readyState from external res script."); } function http_script_readystatechange() { var elem = document.getElementById("httpscr"); extern_http_script_rs += elem.readyState + ","; } function on_externscr() { var elem = document.getElementById("extscr"); ok(elem.readyState === "interactive" || broken(elem.readyState === "loading"), "on_externscr: elem.readyState = " + elem.readyState); extern_res_script_rs += "eval,"; } (function() { ok(inlscr_complete_called === false || broken(inlscr_complete_called), "onreadystatechange fired too early"); var elem = document.getElementById("inlscr"); ok(elem.readyState === "interactive", "inlscr: elem.readyState = " + elem.readyState); })(); document.body.appendChild(img); ``` -------------------------------- ### Script execution test functions Source: https://github.com/alien4042x/wineforge/blob/main/dlls/mshtml/tests/exectest.html This snippet contains the main test functions: testWriteScript, testPutSrc, testPutText, and the initial execution block. It tests document.write with a script, setting the src property of an existing script element, and setting the text property of a script element. ```javascript function ok(b, msg) { return external.ok(b, msg); } var executed = false; var extern_cnt = 0; var exec_cnt; function testWriteScript() { var len = document.getElementsByTagName('div').length; ok(len === 3, "init length = " + len); document.write("