Skip to content

Lua unable to control DOSBox mouse #4766

Description

@SergioMartin86

I was trying to imitate this PR #4748 using LUA so I can adjust the mouse position according to the game's situation, but encountered a bug.

Summary

This LUA script breaks Bizhawk (DOSBox-x) mouse inputs:

while true do
	input = joypad.get()
	--print(input)
	newInput = {};
    newInput["Mouse Position Y"] = input["Mouse Position Y"] + 100
    joypad.setanalog(newInput)

	emu.frameadvance();
end

The expected behaviour is that it takes the mouse's Y position, and adds 100 to it, so that the in-game pointer is adjusted. Instead it breaks the input, making the Y position get stuck in the default forever.

Repro

  1. Open DOSBox core (any game will do) with mouse activated
  2. Move the mouse around and see the inputs move accordingly
  3. Now activate the LUA script above
  4. Mouse Position Y freezes out (bug)
  5. Deactivate the LUA script
  6. Bug still persists

Output

Image

Mouse position X moves freely, but Y is stuck at default.

Host env.

Bizhawk 2.11.1; Windows 11, Intel/NVIDIA

Metadata

Metadata

Assignees

No one assigned

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions