Lime-3DS-Emulator icon indicating copy to clipboard operation
Lime-3DS-Emulator copied to clipboard

SendKey & SendSignal over rpc server

Open ProH4Ck opened this issue 1 year ago • 5 comments

Hi, I added two methods to rpc server:

  • SendKey: emulate a key press
  • SendSignal: call system.SendSignal to control system state. This is needed to reset the game.

I developed these features for a bot I'm building. Sorry for the bad c++ but I works mainly with C# 😊

ProH4Ck avatar Aug 19 '24 18:08 ProH4Ck

Could you please describe what this does and how it can be tested? I am unfamiliar with the RPC side of Citra.

OpenSauce04 avatar Aug 21 '24 20:08 OpenSauce04

RPC server is a simple UDP socket opened by emulator which allows external applications to interact with games. Before this PR only 2 methods were implemented: ReadMemory and WriteMemory. These functions allows to read/write memory in real-time; this limits the scripting behaviour to actions where memory is involved. I added 2 methods that cover all other cases:

  • SendKey to emulate a key press event. Maybe this can be reworked to send directly the 3DS button instead of a keyboard key.
  • SendSignal to allow emulation control. Example usage: reset game for shiny hunting in pokemon games

ProH4Ck avatar Aug 21 '24 20:08 ProH4Ck

FYI, adding input_common as one of the target_link_libraries in src/tests/CMakeLists.txt will fix the undefined symbol errors in the failing builds, although I don't know if there's a better way to link in the missing library into the tests executable.

Edit: Or maybe not. It's certainly still failing on Android because input_common relies in part on SDL and SDL isn't used for the Android build. Guard rails may be needed to detect the type of build and whether or not to include the new code (ex. #ifndef _ANDROID_).

Edit 2: I'm also getting undefined errors on Linux using Clang 18 and no precompiled headers (i.e. the Fresh build) even after linking in input_common. Weird thing is that it doesn't happen on Linux with GCC 14 and no pch; all the builds that use pch finish successfully. I don't know how to fix this. 🤷‍♂️

rtiangha avatar Sep 06 '24 04:09 rtiangha

@ProH4Ck I figured it out. Rather than linking input_common into tests, it needs to be linked into lime_core instead.

I've submitted a PR against your dev branch with the fixes. Once you merge it in, this PR will pass the build checks and it'll be ready for final review.

rtiangha avatar Sep 07 '24 20:09 rtiangha

Marking as a draft until the issues are addressed.

OpenSauce04 avatar Oct 10 '24 12:10 OpenSauce04

Rebased for Azahar in #601

OpenSauce04 avatar Mar 01 '25 20:03 OpenSauce04