Skip to content

Adding a Speed Multiplier (fixes #123, #130) #138

Description

@H3nb

Hi @woesss,

I noticed that people have been asking for a way to adjust game speed (#123, #130). I've been working on a Speed Multiplier feature that allows runtime adjustments.

The Approach:
I implemented a Virtual Clock system using System.nanoTime() as a monotonic base. This keeps the game logic stable even if the system time changes. I then used ASM hooks to redirect MIDlet calls (currentTimeMillis, nanoTime, Thread.sleep) to this virtual clock.

Key Features:

  1. Real-time Scaling: Change speed on the fly via the overlay menu.
    Image
    Image
  2. Sampled Audio Sync: I've added support for setPlaybackParams in AndroidPlayer, so sampled audio (WAV/MP3/etc.) stays in sync with the game speed.
  3. Auto-detect Re-conversion: Added a JL-Mod-Dex-Version flag. The emulator will prompt users to "reinstall" old games once to apply the new ASM hooks.
    Image

Current Limitations:

  1. MIDI Tempo: Currently, MIDI music doesn't scale with the speed multiplier because the underlying synthesizer logic doesn't support it yet. It’s mostly working for sampled SFX at the moment.

APK File: Gdrive Mediafire
Fork: https://github.com/H3nb/JL-Mod

Would you be interested in a PR for this?

Note: This is my first time contributing to an open-source project on GitHub, so I apologize if I've made any mistakes in this proposal or if I missed any protocols. I'm happy to adjust the code based on your feedback!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions