When running the emulator in the window, I am not able to interact with it with the "keypad_add_key" and "keypad_rm_key", but the "touch_set_pos" seems to work as intended. When querying the keys (keypad_get()) it seems to be registering the "keypad_add_key" but the game does not seem to progress according to the keys I press. The script seems to work fine if it is headless (without the window it seems to register them) and it registers keys fine when pressing them on the keyboard during gameplay (in the window). Could you help?
from desmume.emulator import DeSmuME
from desmume.controls import keymask, Keys
emu = DeSmuME()
emu.open('D:\\Dropbox\\Speed Run\\DeSmuME 9.11\\Roms\\ROMs\\NA\\0561 - Harvest Moon DS (U)(Legacy).nds')
window = emu.create_sdl_window()
frame = 0
while not window.has_quit():
frame += 1
if frame == 405:
emu.input.touch_set_pos(100, 100)
if frame == 406:
emu.input.touch_release()
if frame == 405+150:
emu.input.touch_set_pos(100, 100)
if frame == 406+150:
emu.input.touch_release()
if frame == 1500:
a_keymask = keymask(Keys.KEY_A)
emu.input.keypad_add_key(a_keymask)
print("Press A")
if frame == 1502:
a_keymask = keymask(Keys.KEY_A)
emu.input.keypad_rm_key(a_keymask)
window.process_input()
emu.cycle()
window.draw()
When running the emulator in the window, I am not able to interact with it with the "keypad_add_key" and "keypad_rm_key", but the "touch_set_pos" seems to work as intended. When querying the keys (keypad_get()) it seems to be registering the "keypad_add_key" but the game does not seem to progress according to the keys I press. The script seems to work fine if it is headless (without the window it seems to register them) and it registers keys fine when pressing them on the keyboard during gameplay (in the window). Could you help?