Skip to content

Commit

Permalink
Minor work on extras.
Browse files Browse the repository at this point in the history
  • Loading branch information
XerTheSquirrel committed Dec 24, 2023
1 parent 545fb80 commit e7d2f78
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
9 changes: 9 additions & 0 deletions input/input_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@

#endif

/** The number of extra core commands available, used with @c RETRO_ENVIRONMENT_SET_EXTRA_CORE_COMMANDS . */
#define RARCH_EXTRA_CORE_COMMAND_COUNT 128

RETRO_BEGIN_DECLS

/* RetroArch specific bind IDs. */
Expand Down Expand Up @@ -192,6 +195,12 @@ enum
RARCH_OVERLAY_NEXT,
RARCH_OSK,

/** Custom core command start, used with @c RETRO_ENVIRONMENT_SET_EXTRA_CORE_COMMANDS. */
RARCH_EXTRA_CORE_COMMAND_START,

/** Custom core command end, used with @c RETRO_ENVIRONMENT_SET_EXTRA_CORE_COMMANDS. */
RARCH_EXTRA_CORE_COMMAND_END = RARCH_EXTRA_CORE_COMMAND_START + RARCH_EXTRA_CORE_COMMAND_COUNT,

RARCH_BIND_LIST_END,

/* Deprecated */
Expand Down
7 changes: 2 additions & 5 deletions libretro-common/include/libretro.h
Original file line number Diff line number Diff line change
Expand Up @@ -3408,7 +3408,7 @@ struct retro_extra_core_commands_action
* @since 2023/12/23
*/
typedef void (*retro_extra_core_command_callback)(
struct retro_extra_core_commands_action* action,
const struct retro_extra_core_commands_action* action,
unsigned controllerPort);

/** Used with @c RETRO_ENVIRONMENT_SET_EXTRA_CORE_COMMANDS to set extra core commands. */
Expand All @@ -3417,10 +3417,7 @@ struct retro_extra_core_commands
/** The callback to be executed on a command run. */
retro_extra_core_command_callback callback;

/** The number of actions to define. */
unsigned num_actions;

/** The core commands that exist. */
/** The core commands that exist, NULL description ends. */
const struct retro_extra_core_commands_action* actions;
};

Expand Down
17 changes: 16 additions & 1 deletion runloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,22 @@ static void core_performance_counter_stop(struct retro_perf_counter *perf)
}

static void rarch_set_extra_core_commands(rarch_system_info_t *system_info,
struct retro_extra_core_commands *input) {
const struct retro_extra_core_commands *input) {
const struct retro_extra_core_commands_action* action;
unsigned at;

/* Debug. */
RARCH_LOG("[Core]: Initializing extra core commands!\n");

/* Go through the commands and process them. */
for (at = 0; input->actions[at].description != NULL &&
at < RARCH_EXTRA_CORE_COMMAND_COUNT; at++)
{
/* Get base action. */
action = &input->actions[at];


}
}

static void rarch_set_input_descriptors(const void *data, unsigned int p,
Expand Down

0 comments on commit e7d2f78

Please sign in to comment.