Update man-pages some more. Add man-page for ssnes-joyconfig.

This commit is contained in:
Themaister 2011-01-15 16:50:26 +01:00
parent 4119eaadf4
commit 92377b0426
3 changed files with 56 additions and 9 deletions

44
docs/ssnes-joyconfig.1 Normal file
View File

@ -0,0 +1,44 @@
.\" ssnes-joyconfig.1:
.TH "SSNES-JOYCONFIG" "1" "January 2011" "SSNES-JOYCONFIG" "System Manager's Manual: ssnes-joyconfig"
.SH NAME
ssnes-joyconfig \- Tool to configure joypad bindings for \fBssnes\fR.
.SH SYNOPSIS
\fBssnes-joyconfig\fR [OPTIONS]...
.SH "DESCRIPTION"
\fBssnes-joyconfig is a simple tool that allows updating or creating a configuration file for \fBssnes\fR.
It reads in necessary joypad bindings for a certain player and joypad.
.SH "GENERAL OPTIONS"
.TP
\fB--player PLAYER, -p PLAYER\fR
Configuration will be done for the SNES player PLAYER. This can be from 1 up to and including 5 (multitap).
Default is configuration for player 1.
.TP
\fB--joypad PAD, -j PAD\fR
Which joypad to use when configuring. Use a numeric indexing. Default here is 0 (first joypad).
.TP
\fB--input PATH, -i PATH\fR
Use config file found in PATH as a base. Old configuration values can be overwritten by new values when configuring binds. If not used, an empty config file will be used as a base. Using this option only does \fBnot\fR update the file found in PATH.
.TP
\fB--output PATH, -o PATH\fR
Writes the final config to a file, rather than \fBstdout\fR. If -i and -o point to the same file, the file found in PATH will simply be updated with the new configs.
.TP
\fB--help, -h\fR
Prints help message.
.SH "SEE ALSO"
\fBssnes\fR(1)
.\"

View File

@ -103,3 +103,6 @@ Activates video recording of gameplay into PATH. Video recording options can be
.TP
\fB--verbose, -v\fR
Activates verbose logging.
.SH "SEE ALSO"
\fBssnes-joyconfig\fR(1)

View File

@ -40,10 +40,10 @@ static void print_help(void)
puts("==================");
puts("ssnes-joyconfig");
puts("==================");
puts("Usage: ssnes-joyconfig [ -p/--player <1|2> | -j/--joypad <num> | -i/--input <file> | -o/--output <file> | -h/--help ]");
puts("Usage: ssnes-joyconfig [ -p/--player <1-5> | -j/--joypad <num> | -i/--input <file> | -o/--output <file> | -h/--help ]");
puts("");
puts("-p/--player: Which player to configure for (1 or 2).");
puts("-j/--joypad: Which joypad to use when configuring (first joypad is 1).");
puts("-p/--player: Which player to configure for (1 up to and including 5).");
puts("-j/--joypad: Which joypad to use when configuring (first joypad is 0).");
puts("-i/--input: Input file to configure with. Binds will be added on or overwritten.");
puts("\tIf not selected, an empty config will be used as a base.");
puts("-o/--output: Output file to write to. If not selected, config file will be dumped to stdout.");
@ -84,7 +84,7 @@ void get_binds(config_file_t *conf, int player, int joypad)
int num = SDL_NumJoysticks();
if (joypad >= num)
{
fprintf(stderr, "Cannot find joystick number %d, only have %d joysticks available ...\n", joypad + 1, num);
fprintf(stderr, "Cannot find joystick at index #%d, only have %d joystick(s) available ...\n", joypad + 1, num);
exit(1);
}
@ -104,7 +104,7 @@ void get_binds(config_file_t *conf, int player, int joypad)
initial_axes[i] = SDL_JoystickGetAxis(joystick, i);
fprintf(stderr, "Configuring binds for player #%d on joypad #%d (%s)\n", player + 1, joypad + 1, SDL_JoystickName(joypad));
fprintf(stderr, "Configuring binds for player #%d on joypad #%d (%s)\n", player + 1, joypad, SDL_JoystickName(joypad));
fprintf(stderr, "Press Ctrl-C to exit early.\n");
fprintf(stderr, "\n");
@ -213,9 +213,9 @@ static void parse_input(int argc, char *argv[])
case 'j':
g_joypad = strtol(optarg, NULL, 0);
if (g_joypad < 1)
if (g_joypad < 0)
{
fprintf(stderr, "Joypad number can't be less than 1!\n");
fprintf(stderr, "Joypad number can't be negative!\n");
exit(1);
}
break;
@ -271,9 +271,9 @@ int main(int argc, char *argv[])
"input_player5_joypad_index"
};
config_set_int(conf, index_list[g_player - 1], g_joypad - 1);
config_set_int(conf, index_list[g_player - 1], g_joypad);
get_binds(conf, g_player - 1, g_joypad - 1);
get_binds(conf, g_player - 1, g_joypad);
config_file_write(conf, g_out_path);
config_file_free(conf);
if (g_in_path)