Skip to content

NFSU2 Revived v0.15.25.beta6

Pre-release
Pre-release

Choose a tag to compare

@mininxd mininxd released this 17 Nov 00:47
· 115 commits to main since this release

NFSU2 Revived v0.15.25.beta6

What's New in v0.15.25.beta6

1. Enhanced Contrast Performance & Bleach Bypass Interception

  • 3D Scene Render Interception: Intercepted the 3D scene render pass (0x005caad0) in libnfsu2_roam.so. The engine's legacy bleach bypass flags (0x00870D00 and 0x00870CFC) are dynamically clamped to 0 strictly during 3D scene rendering:
    • Completely skips the slow 3-pass ping-pong resolve (0x005cc8b0) that previously forced full-frame StretchRect copies from the backbuffer.
    • Eliminates the original bleach bypass fullscreen quad blit (0x005c68d0) that burned original unoptimized shader passes into the backbuffer.
    • Slashes GPU memory bandwidth saturation and eliminates mobile TBDR GPU resolve bottlenecks when Enhanced Contrast is enabled.
static void hook_sub_005caad0(void) {
    uint32_t user_contrast = 0;
    if (rh_mem_committed(0x00870D00u, 4)) {
        user_contrast = MR32(0x00870D00u);
        if (s_set_contrast_active) {
            s_set_contrast_active(user_contrast);
        }
        // Force 0 inside 0x005caad0 so SPEED2.EXE skips the 3-pass ping-pong resolve
        // and does not draw the default bleach bypass quad over the backbuffer.
        MR32(0x00870D00u) = 0;
    }
    if (rh_mem_committed(0x00870CFCu, 4)) {
        MR32(0x00870CFCu) = 0;
    }

    if (s_orig_5caad0) {
        s_orig_5caad0();
    }

    // Restore user setting immediately after scene rendering so that the game's
    // Options menu ("Enhanced Contrast: ON / OFF") and save profile remain accurate.
    if (rh_mem_committed(0x00870D00u, 4)) {
        MR32(0x00870D00u) = user_contrast;
    }
}
  • Full In-Game Menu & Profile Consistency:
    • Automatically restores 0x00870D00 immediately following 3D scene rendering so that the in-game display options menu ("Enhanced Contrast: ON / OFF") and career profile saves accurately track and preserve the player's preference without desync.

2. Zero-Overhead Post-Processing Bypass Hooks

  • Fail-Safe Post-Processing Interception: Implemented zero-overhead ARM64 inline hooks on 0x005cc8b0 and 0x005c68d0, immediately returning and neutralizing any legacy calls to the engine's bleach bypass pipeline:
static void hook_sub_005cc8b0(void) {
    // 0x005cc8b0: Bleach Bypass StretchRect resolve pass.
    // Zero-overhead bypass: pop return slot and return immediately without executing StretchRect.
    if (g_p_esp && *g_p_esp) {
        *g_p_esp += 4;
    }
}

static void hook_sub_005c68d0(void) {
    // 0x005c68d0: Bleach Bypass 3-pass ping-pong fullscreen quad blitter.
    // Caller cleans up arguments (cdecl). Set scratch index to -1 and pop return slot.
    if (rh_mem_committed(0x008708F4u, 4)) {
        MR32(0x008708F4u) = 0xFFFFFFFFu;
    }
    if (g_p_esp && *g_p_esp) {
        *g_p_esp += 4;
    }
}

3. Hardware-Accelerated Enhanced Contrast Tone Curve

  • Swapchain Presenter Tone Grading: When Enhanced Contrast is set to ON in game options, the tone mapping curve is evaluated directly during DXVK's swapchain presentation blit with zero intermediate render targets or memory round-trips:
vec4 apply_enhanced_contrast(vec4 color, uint enabled) {
  if (enabled == 0u) return color;
  vec3 c = clamp(color.rgb, 0.0, 1.0);

  // Exposure, S-curve contrast, specular whites and deep shadow recovery
  c = clamp(c * 1.00695555, 0.0, 1.0);
  vec3 s_curve = c * c * (3.0 - 2.0 * c);
  c = mix(c, s_curve, 0.15);

  // Atmospheric clarity & chroma saturation boost
  c = clamp(c - 0.024 * (1.0 - c) * c, 0.0, 1.0);
  float luma = dot(c, vec3(0.2126, 0.7152, 0.0722));
  vec3 vivid = mix(vec3(luma), c, 1.20);
  return vec4(clamp(vivid, 0.0, 1.0), color.a);
}
  • Zero-Cost Dynamic Toggle: When Enhanced Contrast is set to OFF, DXVK swapchain blits 1:1 with zero additional tone processing.

4. Car Audio & 3D Engine Sound Restoration

  • DirectSound 3D Buffer & Listener Support (DSBCAPS_CTRL3D):
    • Removed rejection of DSBCAPS_CTRL3D (0x10) in DirectSound buffer creation, which previously caused error 0x8878001e and muted sound sources on multiple vehicle types.
    • Implemented IDirectSound3DBuffer and IDirectSound3DListener interface query and parameter stubs, successfully restoring 3D positional engine sounds across all non-350Z cars:
// DirectSound 3D Buffer & Listener interface query dispatch
if (kind == 2) {
    if (inputGuidEquals(arg(1), ds3dBufferGuid)) {
        uint32_t ds3d = createSoundObject(3, object.flags);
        soundObjects.at(ds3d).voice = object.voice;
        write32(arg(2), ds3d);
        ret(0, 3);
        return;
    }
}
if (kind == 1) {
    if (inputGuidEquals(arg(1), ds3dListenerGuid)) {
        uint32_t listener = createSoundObject(4, object.flags);
        write32(arg(2), listener);
        ret(0, 3);
        return;
    }
}

5. Stability & Stutter Elimination

  • Eliminated Periodic Micro-Stutters: Gated 120-frame bridge profiling and 5-second socket diagnostics behind debug flags to eliminate periodic frame time spikes during races.
  • Mali & Kirin GPU Fence Timeout Fix: Configured DXVK raw SSBO and tiler mode to Auto with maxFrameLatency = 2 to prevent Mali G76/Kirin fence synchronization timeouts and VK_ERROR_DEVICE_LOST.

Full Changelog: v0.15.25.beta5...v0.15.25.beta6