Skip to content

Navigation Menu

Sign in
Sign up

Does reloaded provide keybind in configuration? #379

Answered by Sewer56
asesidaa asked this question in Q&A
Discussion options

Hi, thanks for the great project.
I am trying to migrate my loader for an arcade game to use reloaded. I need to configure the input mapping. I see there is controller configuration for reloaded itself. Is that available for mods?

You must be logged in to vote

Here's some extra info.


As for the actual EXE being launched for config itself, if you're building it with .NET (C#), you should use NativeAOT if it is possible for you. To ensure you get a fully static binary. If you're using another programming language, make a static build if possible.

Alternatively, if that is not possible set <RollForward>Major</RollForward> in the .csproj file of the project that creates the EXE.

This will allow the built program to use a newer .NET version than it was originally created for. For example, using .NET 9 if the program was built for .NET 8 and the user does not have .NET 8 installed. While that technically can break long term, it is relatively rare fo...

Replies: 1 comment 3 replies

Comment options

Are you writing a mod to support extra controllers for a game?
Or do you want to invoke some existing game executable?

Generally the way to go about this is the following:

Override TryRunCustomConfiguration in ConfiguratorMixin like this

public override bool TryRunCustomConfiguration(Configurator configurator)
{
 Process.Start($"{configurator.ModFolder}//your_exe_file_name.exe");
 // We launched a custom EXE to configure, so say we handled the event.
 return true;
}

You can find ConfiguratorMixin at the bottom of Config.cs in mod template.
This allows you to handle configuring a mod through a separate EXE.

Additional notes below.

You must be logged in to vote
3 replies
Comment options

Thanks for the prompt reply.

Basically the game itself does not accept keyboard or controller input. As an arcade game, it receives input from a custom io board via a separate dll.
What I have previously done in my (c++) loader is to hook the functions for getting input and provide corresponding values when keys are pressed. Basically I need to override the input system for the game. Therefore I need a convenient way to assign keys/controller inputs to game input in my config.

Comment options

Here's some extra info.


As for the actual EXE being launched for config itself, if you're building it with .NET (C#), you should use NativeAOT if it is possible for you. To ensure you get a fully static binary. If you're using another programming language, make a static build if possible.

Alternatively, if that is not possible set <RollForward>Major</RollForward> in the .csproj file of the project that creates the EXE.

This will allow the built program to use a newer .NET version than it was originally created for. For example, using .NET 9 if the program was built for .NET 8 and the user does not have .NET 8 installed. While that technically can break long term, it is relatively rare for it to do so.


As for getting the EXE in the output folder of your project, there are two convenient-ish ways to do it (if using C#). [That don't involve custom build script]. Either set the project that produces the EXE as a project dependency to the main mod. Or have both the config EXE and mod in the same binary.

I don't have any example of the former approach currently in production, but an example of the latter can be found here:

In that project, if you launch via the EXE you get public static void Main() executed. Meanwhile if launched via the loader, public void Start(IModLoaderV1 loader) is executed. (This corresponds to Start in Mod.cs, this mod is based on an earlier template with less abstraction).

That way, the UI and mod are in same project.


Edit: That project uses Reloaded.Input.Configurator for the UI and Reloaded.Input for the underlying input collection and remapping. Which are the same as the launcher. That library was something I had to make on my own as there weren't many great input libraries for .NET at the time. These days you can get pretty decent bindings for SDL though.

Answer selected by asesidaa
Comment options

Ah, thanks for the info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /