Skip to content

NFSU2 Revived v0.15.18

Choose a tag to compare

@mininxd mininxd released this 08 Nov 22:34
· 76 commits to main since this release

What's Changed in v0.15.18

Audio Switch Stall & Incoming Call Handling (#43, #52, #53)

  • Audio Stream Stall Detector: Added isCallbackStalled() in audio_watchdog.cpp to detect when AAudio callbacks freeze for >250 ms during Bluetooth audio route switching, wired headset disconnections, or incoming phone calls:
    bool isCallbackStalled(uint64_t nowUs) {
        uint64_t last = s_lastCallbackUs.load(std::memory_order_relaxed);
        return (last != 0 && (nowUs - last) > 250000ULL); // >250 ms freeze
    }
  • Dynamic Audio Recovery: Updated guest_audio.inc to trigger seamless stream reconstruction on stalled states without deadlocking DirectSound threads or freezing the main render loop.
  • Audio Focus Management: Added requestGameAudioFocus() and OnAudioFocusChangeListener in GameActivity.java to handle transient audio focus losses smoothly, and set AudioAttributes usage to USAGE_GAME / CONTENT_TYPE_MUSIC.

Snapdragon 8 Gen 2 Performance Regression Fix

  • CPU Cluster Topology Tuning: Fixed EAS (Energy Aware Scheduling) CPU affinity mask detection in performance_tuner.cpp on Snapdragon 8 Gen 2 (SM8550) and heterogeneous 1+4+3 core configurations, preventing thread migration to efficiency cores and eliminating frame pacing jitter:
    // SM8550 (1x Cortex-X3 + 4x Cortex-A715/A710 + 3x Cortex-A510)
    cpu_set_t perf_mask;
    CPU_ZERO(&perf_mask);
    for (int cpu : perf_cores) CPU_SET(cpu, &perf_mask);
    sched_setaffinity(0, sizeof(cpu_set_t), &perf_mask);
    setpriority(PRIO_PROCESS, 0, -10);
  • Priority Thread Scheduling: Ensured primary game loop and worker threads bind to performance and prime cores (Cortex-X3 / Cortex-A715) with elevated priority (-10).

Comprehensive Diagnostic Halt & Crash Logging

  • Multi-Path Halt Dumper: Implemented GameLog.writeHaltFile() and native crash dumpers in guest_runtime.cpp and GameLog.java. Crash and stall diagnostics are automatically captured across /sdcard/NFSU2/halt_log.txt, /sdcard/nfsu2/halt_log.txt, external files, and app-internal storage.
  • Deep Logcat Diagnostics: Diagnostic dumps now capture the last 350 lines across main, system, and crash logcat buffers, including AudioTrack, AAudioStream, and Telecom subsystems.

Win32 & DirectX Library Translation Surface (91.4% Coverage)

  • Official Dedicated LAN Server (server.dll) 100% Resolved: Fully resolved all 115 imports required by EA's server.dll across Winsock (26/26), Kernel32 (87/87), User32 (1/1), and Netapi32 (1/1), enabling standalone LAN race hosting on Android.
  • Core Win32 API Translations:
    • user32.dll!wsprintfA: Implemented __cdecl formatted string generation with variable arguments:
      int __cdecl nfs_wsprintfA(char* buffer, const char* format, ...) {
          va_list args;
          va_start(args, format);
          int ret = vsprintf(buffer, format, args);
          va_end(args);
          return ret;
      }
    • advapi32.dll!RegCreateKeyA: Added registry subkey creation and option persistence.
    • kernel32.dll: Implemented VirtualQuery, IsBadCodePtr, CompareStringA/W, GetStringTypeA, LCMapStringA, GetLocaleInfoA/W, and SEH stubs (UnhandledExceptionFilter, RaiseException, RtlUnwind).
  • Rust-Backed Subsystems: Integrated Rust modules for ddraw.dll (DirectDrawCreate), shell32.dll (ShellExecuteA), and netapi32.dll (Netbios, NetApiBufferFree, NetWkstaGetInfo, NetGetJoinInformation).
  • Interactive SVG Visualizer: Updated library-progress.json and library-progress.svg to track 316 implemented APIs (91.4% weighted coverage).

Phase 1 Rust NEON Vector Math & Network Fixes

  • NEON Vector Math (math_simd.rs): High-performance ARM64 NEON SIMD acceleration for 3D vector transformations:
    #[inline(always)]
    pub unsafe fn transform_vector_neon(m: &[f32; 16], v: &[f32; 4], out: &mut [f32; 4]) {
        let col0 = vld1q_f32(&m[0]);
        let col1 = vld1q_f32(&m[4]);
        let col2 = vld1q_f32(&m[8]);
        let col3 = vld1q_f32(&m[12]);
        let res = vmlaq_n_f32(vmlaq_n_f32(vmlaq_n_f32(vmulq_n_f32(col0, v[0]), col1, v[1]), col2, v[2]), col3, v[3]);
        vst1q_f32(out.as_mut_ptr(), res);
    }
  • Plain TCP Lobby Host Patch: Patched address 0x7FBDBC to strip the legacy '*' wildcard from lobby hostnames for reliable LAN/online TCP connections.

Full Changelog: v0.15.17...v0.15.18