samp.directory
← Скрипты и библиотеки

SorayutSirisakhon/samp-android-stable-fps-unlock

Stable FPS unlock for SA-MP Android 2.10 / GTA SA Android with real refresh-rate clamp and frame pacing fixes.

Инструмент★ 3обновлён июнь 2026 г.Без лицензииC++
Открыть на GitHub

В этом репозитории нет файла лицензии. Код открыт для чтения, но само по себе это не даёт права использовать его.

README.md

SA-MP Android Stable FPS Unlock

Small FPS unlock snippets for SA-MP Android / GTA SA Android ports, including SA-MP Android 2.10 style projects.

This package only includes the FPS unlock and frame-pacing related lines. It does not include full project files, game assets, private launcher code, or any proprietary source.

What It Does

  • Disables GTA SA Android's original 20/30 FPS cap writes.
  • Applies a custom FPS cap from your client setting.
  • Clamps the cap to the device display refresh rate to avoid uneven pacing.
  • Keeps the cap in a safe 30-120 FPS range by default.
  • Includes an optional stutter fix for projects that repeatedly call sched_setaffinity.

Files

  • snippets/01-patches-cpp-stable-fps.cpp
    • Add this to the native patch file that owns ApplyFPSPatch().
  • snippets/02-main-cpp-jni-bridge.cpp
    • Add this to the native JNI registration file.
  • snippets/03-samp-java-refresh-rate.java
    • Add this to your Android activity before native initialization.
  • snippets/04-settings-cpp-fps-clamp.cpp
    • Use this if your settings currently force FPS back to 120 every load/save.
  • snippets/05-optional-affinity-stutter-fix.cpp
    • Optional. Use only if your project has a worker that reapplies thread affinity every second.

Install

  1. Add the C++ includes and helper functions from 01-patches-cpp-stable-fps.cpp.
  2. Replace your old ApplyFPSPatch() FPS value with ResolveFPSLimit().
  3. Add the JNI bridge from 02-main-cpp-jni-bridge.cpp.
  4. Add the Java refresh-rate detection and native call from 03-samp-java-refresh-rate.java.
  5. Keep your user FPS setting within 30..120, or apply 04-settings-cpp-fps-clamp.cpp.

Notes

  • Offsets are build-specific. Verify the offsets against your libGTASA.so.
  • Built around SA-MP Android 2.10 style code paths, but the idea can be adapted to other GTA SA Android builds.
  • On 60 Hz phones, the cap resolves to 60 even if the setting is 120.
  • On 90 Hz phones, the cap resolves to 90.
  • On 120 Hz phones, the cap resolves to 120.
  • This avoids asking EGL/vsync to pace frames above the actual display refresh rate, which is a common cause of unstable unlocked FPS.

Suggested GitHub Topics

sa-mp, samp, samp-android, samp-mobile, samp-android-2-10, gta-sa, gtasa-android, android, fps-unlock, fps-unlocker, frame-pacing, refresh-rate, renderware, libgtasa

Optional Stutter Fix

If your project has a thread that calls sched_setaffinity every 1000 ms, remove that loop or change it to apply affinity once per new thread. Reapplying affinity periodically can cause short scheduler interruptions that look like regular stutter.

androidfps-unlockfps-unlock-androidfps-unlockerframe-pacinggta-sagta-sa-androidgtasa-androidlibgtasarefresh-raterenderwaresa-mpsampsamp-2-10samp-210samp-androidsamp-android-2-10samp-mobile

Страница собрана из того, что GitHub публикует о репозитории. samp.directory не хранит этот код. Сообщить о проблеме с этой записью