Support for remapping the controls?

Open-source port of PoP that runs natively on Windows, Linux, etc.
Post Reply
David
The Prince of Persia
The Prince of Persia
Posts: 2850
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Support for remapping the controls?

Post by David »

We already have two people asking for a feature to change the keyboard controls:
https://github.com/NagyD/SDLPoP/issues/180
https://github.com/NagyD/SDLPoP/issues/138

Currently the only way to change controls is to edit the source: https://github.com/NagyD/SDLPoP/blob/ma ... 00.c#L1523
The key assignments could be moved to SDLPoP.ini, but then we'd be expecting people to know the codes for each key. Not good.
To avert this, SDLPoP could ask the user to press the key they want to use, but SDLPoP can write only to SDLPoP.cfg, not SDLPoP.ini.
This is better, but SDLPoP.cfg is reset everytime SDLPoP.ini changes.

What do you think?
Falcury
Calif
Calif
Posts: 565
Joined: June 25th, 2009, 10:01 pm

Re: Support for remapping the controls?

Post by Falcury »

Hm, SDLPoP.ini is human-friendly but maybe not so machine-friendly (for writing/editing), while the cfg file is the reverse... To make the configuration written by SDLPoP persistent, saving it in a text format is probably better than binary, so it doesn't break when there is a new version... But then, if we do that, there are two human-readable configuration files, which makes it even more confusing than it is now (which one should you edit?) But then, maybe the explanation texts in SDLPoP.ini are no longer really necessary anyway, because SDLPoP's menu system already gives explanation on what each of the options do, right? So, we might as well end up with a system where there is no SDLPoP.cfg, and SDLPoP instead rewrites SDLPoP.ini from scratch (without comments?) every time a setting gets changed. And key mappings could just be stored as (hex?) numbers.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5749
Joined: April 9th, 2009, 10:58 pm

Re: Support for remapping the controls?

Post by Norbert »

Working with just SDLPoP.ini and rewriting it from scratch (with comments) would be good.

As a general comment on this subject: SDLPoP.ini should be more aesthetically pleasing and easier to read. Sections could be more clearly marked (for instance with horizontal lines), and IMO each section should start with a single block that contains all comment lines, then an empty line, and then the listing of all (<key> = <value>) settings without comments.
David
The Prince of Persia
The Prince of Persia
Posts: 2850
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Support for remapping the controls?

Post by David »

Maybe in the first step it would be enough to add the remapping functionality first, without any way to save it.
Like in the BBC Master version: viewtopic.php?p=22717#p22717

Next question:
Every control is assigned to at least two keys: arrows and numpad, two shift keys, etc.
Should the user-defined keys replace both of these, or only one of them, or should the user-defined keys behave as an additional set while also keeping the original keysets?
(Another option is to have two keyboard modes, one with the original controls, one with the custom ones. But that might be terribly confusing to the users.)

Anyway, here is my attempt in a new branch: https://github.com/NagyD/SDLPoP/commit/ ... 4e7dda7864
Post Reply