Skip to content

NFSU2 Revived v1.0.4

Choose a tag to compare

@mininxd mininxd released this 25 Nov 02:44
· 21 commits to main since this release

What's New in v1.0.4

1. Runtime D3D9 Redundant-State Deduplication & CPU Bridge Acceleration

  • GOT-Hooked D3D9 Shadow State Filter (libnfsu2_roam.so):
    • Hooked dispatchGuestD3D9 via .got.plt (with inline prologue fallback and -funwind-tables for safe C++ exception unwinding) to eliminate tens of thousands of redundant Direct3D 9 calls per frame before they cross into the COM bridge and Vulkan command stream.
    • Deduplicates identical SetRenderState, SetSamplerState, SetTextureStageState, SetTexture, SetVertexDeclaration, SetFVF, SetVertexShader, SetPixelShader, SetStreamSource, SetStreamSourceFreq, SetIndices, LightEnable, SetSoftwareVertexProcessing, SetTransform, SetViewport, SetVertexShaderConstantF, and SetPixelShaderConstantF calls with zero syscalls.
    • Preserves 100% visual accuracy with full BeginStateBlock / EndStateBlock / StateBlock::Apply bypass and invalidation, render-target / StretchRect / Reset invalidation, and resource-release handle-recycling epoch checks.
    • Feeds live Present frame timestamps into libgraphics_cache.so telemetry and logs periodic filter hit-rate statistics (NFSU2-D3D9Filter).
  • Mid-Frame Render-Thread Handover Reduction (3 ms → 16 ms):
    • Widened checkGuestProgress's render-thread cooperative slice from 3 ms to 16 ms while keeping worker thread slices (500 µs) and Present yields untouched, eliminating 4–9+ mid-frame scheduling handovers per frame (saving ~2–3+ ms/frame of mutex wait).

2. Native-Aspect Resolution Settings & Removal of 1280x720 Default

  • Removed Hardcoded 1280x720 Slot from In-Game Display Settings:
    • Hooked configureAndroidResolutionModes, nfs_android_resolution, and dxvk::wsi::getDisplayMode via .got.plt so in-game Display Settings exposes only clean native-aspect percentage modes (25%, 50%, 75%, 100%, plus any custom Launcher percentage such as 60% or 80%).
    • Disabled unused resolution slots cleanly so 1280x720 no longer appears in the Resolution list or gets selected on device reset, and starts the game directly on the matching percentage slot.
  • Aspect-Preserving Resolution Scaling & Widescreen Guard:
    • Updated GameOptions.renderSize() and native slot scaling to preserve the device's physical display aspect ratio when clamping low scales (such as 25% on 720p/HD+ screens) to the 320×240 minimum and 8192×8192 maximum bounds.
    • Hooked nfs_widescreen_set_resolution to guard s_aspect, HUD_SCALE_X, and fHudPosX against non-display aspect distortion so changing Display Settings never snaps into a stretched 4:3 / 16:9 ratio.
    • Disabled the legacy roam_resolution_nav menu-arrow hijack that previously overwrote 0x870d1c to slot 4 (1280x720) when pressing Right in Display Settings.

3. Immediate Vulkan Presentation Mode (VSync Off)

  • Zero-Wait Present Mode Preference:
    • Switched MESA_VK_WSI_PRESENT_MODE from mailbox to immediate in dxvk_tuner.rs.
    • Updated native Vulkan swapchain presentation mode priority in native_vk.rs to VK_PRESENT_MODE_IMMEDIATE_KHR → VK_PRESENT_MODE_MAILBOX_KHR → VK_PRESENT_MODE_FIFO_KHR for lowest input latency and uncapped frame delivery.

4. Performance Regression Fixes (Issues #173 & #179)

  • Restored libgraphics_cache.so & libroam_rs.so Packaging & Dynamic Linkage:
    • Fixed unresolved Android NDK linker errors in graphics_cache (vulkan_driver.rs) and roam_rs (msg.rs) by resolving libnfsu2_android.so / libnfsu2_roam.so symbols via runtime dlsym.
    • Removed continue-on-error: true from Rust module compilation in GitHub Actions CI and added explicit library verification checks so missing .so artifacts can never silently ship.
  • Per-Thread CPU Affinity & Hook Installation Safety:
    • Fixed perf_cores / roam_affinity pinning every thread in the process onto only the 2 Prime cores (which starved Vulkan/DXVK/audio worker threads); affinity now binds only the calling render thread (sched_setaffinity(0, ...)) while allowing background threads to scale across all performance cores.
    • Guarded arm64_inline_hook against duplicate installation and added thread-safe locking around roam_android_install_hooks().
  • SELinux-Safe GPU Governor & Telemetry Overhead Removal:
    • Cached SELinux-denied sysfs nodes in gpu_governor.rs, GpuClockGovernor.java, and telemetry.rs so non-root Android 14/15/16 devices no longer spam kernel audit denials every second.
    • Replaced background logcat subprocess polling in DiagnosticOverlay.java with direct native telemetry reads.

5. Version Bump

  • Bumped app versionCode to 104 and versionName to 1.0.4.

Full Changelog: v1.0.3...v1.0.4