Skip to content

Commit

Permalink
Uncommented Sensor Menu Code
Browse files Browse the repository at this point in the history
  • Loading branch information
oshaboy committed Jan 16, 2025
1 parent ec6dc65 commit ed36cb5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 27 deletions.
42 changes: 20 additions & 22 deletions configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -6005,19 +6005,19 @@ bool input_remapping_load_file(void *data, const char *path)
strlcpy(s1 + _len, formatted_number, sizeof(s1) - _len);
CONFIG_GET_INT_BASE(conf, settings, uints.input_remap_ports[i], s1);
{
static const char * sensor_strings[RETRO_SENSOR_MAX] =
static const char * sensor_strings[RETROPAD_RETRO_SENSOR_LAST] =
{
"accel_x","accel_y", "accel_z",
"gyro_x","gyro_y","gyro_z",
"light"
"gyro_x","gyro_y","gyro_z"
/*,"light"*/
};
static const char * sensor_strings_flip[RETRO_SENSOR_MAX] =
static const char * sensor_strings_flip[RETROPAD_RETRO_SENSOR_LAST] =
{
"accel_x_flip","accel_y_flip", "accel_z_flip",
"gyro_x_flip","gyro_y_flip","gyro_z_flip",
"light_flip"
"gyro_x_flip","gyro_y_flip","gyro_z_flip"
/*,"light_flip"*/
};
for (j = 0; j < RETRO_SENSOR_MAX; j++){
for (j = 0; j < RETROPAD_RETRO_SENSOR_LAST; j++){

int sensor_remap = -1;
bool sensor_flip_remap = false;
Expand All @@ -6029,15 +6029,15 @@ bool input_remapping_load_file(void *data, const char *path)
sensor_strings_flip[j], '_', sizeof(sensor_flip_ident));
if(!config_get_int(conf, sensor_ident, &sensor_remap))
sensor_remap=RETROK_UNKNOWN;
/*

configuration_set_uint(settings,
settings->uints.input_sensor_ids[i][j], sensor_remap);
*/

config_get_bool(conf, sensor_flip_ident, &sensor_flip_remap);
/*
configuration_set_bool(settings,
settings->bools.input_sensor_flip_axis[i][j], sensor_flip_remap);
*/

configuration_set_bool(settings,
settings->bools.input_sensor_flip_axis[i][j], sensor_flip_remap);


}
}
Expand Down Expand Up @@ -6075,17 +6075,17 @@ bool input_remapping_save_file(const char *path)
"l_x+", "l_x-", "l_y+", "l_y-",
"r_x+", "r_x-", "r_y+", "r_y-"
};
static const char * sensor_strings[RETRO_SENSOR_MAX] =
static const char * sensor_strings[RETROPAD_RETRO_SENSOR_LAST] =
{
"accel_x","accel_y", "accel_z",
"gyro_x","gyro_y","gyro_z",
"light"
"gyro_x","gyro_y","gyro_z"
/*,"light" */
};
static const char * sensor_strings_flip[RETRO_SENSOR_MAX] =
static const char * sensor_strings_flip[RETROPAD_RETRO_SENSOR_LAST] =
{
"accel_x_flip","accel_y_flip", "accel_z_flip",
"gyro_x_flip","gyro_y_flip","gyro_z_flip",
"light_flip"
"gyro_x_flip","gyro_y_flip","gyro_z_flip"
/*,"light_flip"*/
};
config_file_t *conf = NULL;
runloop_state_t *runloop_st = runloop_state_get_ptr();
Expand Down Expand Up @@ -6228,8 +6228,7 @@ bool input_remapping_save_file(const char *path)
_len = strlcpy(s1, "input_remap_port_p", sizeof(s1));
strlcpy(s1 + _len, formatted_number, sizeof(s1) - _len);
config_set_int(conf, s1, settings->uints.input_remap_ports[i]);
#if 0
for (j = 0; j < RETRO_SENSOR_MAX; j++){
for (j = 0; j < RETROPAD_RETRO_SENSOR_LAST; j++){
char sensor_ident[128];
char sensor_ident_flip[128];
unsigned sensor_remap = settings->uints.input_sensor_ids[i][j];
Expand All @@ -6256,7 +6255,6 @@ bool input_remapping_save_file(const char *path)
);
*/
}
#endif
}

ret = config_file_write(conf, path, true);
Expand Down
4 changes: 2 additions & 2 deletions configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ typedef struct settings
unsigned input_remap_ports[MAX_USERS];
unsigned input_remap_ids[MAX_USERS][RARCH_CUSTOM_BIND_LIST_END];
unsigned input_keymapper_ids[MAX_USERS][RARCH_CUSTOM_BIND_LIST_END];
/*unsigned input_sensor_ids[MAX_USERS][RETRO_SENSOR_MAX];*/
unsigned input_sensor_ids[MAX_USERS][RETROPAD_RETRO_SENSOR_LAST];
unsigned input_remap_port_map[MAX_USERS][MAX_USERS + 1];

unsigned led_map[MAX_LEDS];
Expand Down Expand Up @@ -725,7 +725,7 @@ typedef struct settings
bool input_touch_vmouse_trackball;
bool input_touch_vmouse_gesture;
#endif
/*bool input_sensor_flip_axis[MAX_USERS][RETRO_SENSOR_MAX];*/
bool input_sensor_flip_axis[MAX_USERS][RETROPAD_RETRO_SENSOR_LAST];

/* Frame time counter */
bool frame_time_counter_reset_after_fastforwarding;
Expand Down
10 changes: 10 additions & 0 deletions input/input_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,16 @@ enum input_device_reservation_type
INPUT_DEVICE_RESERVATION_LAST
};

enum retro_sensor_retropad{
RETROPAD_RETRO_SENSOR_ACCELEROMETER_X,
RETROPAD_RETRO_SENSOR_ACCELEROMETER_Y,
RETROPAD_RETRO_SENSOR_ACCELEROMETER_Z,
RETROPAD_RETRO_SENSOR_GYROSCOPE_X,
RETROPAD_RETRO_SENSOR_GYROSCOPE_Y,
RETROPAD_RETRO_SENSOR_GYROSCOPE_Z,
RETROPAD_RETRO_SENSOR_LAST

};
RETRO_END_DECLS

#endif
3 changes: 0 additions & 3 deletions libretro-common/include/libretro.h
Original file line number Diff line number Diff line change
Expand Up @@ -4523,9 +4523,6 @@ enum retro_sensor_selector
*/
RETRO_SENSOR_ILLUMINANCE,


RETRO_SENSOR_MAX,

/** Dummy value to ensure sizeof(enum retro_hw_context_type) == sizeof(int). Do not use. */
RETRO_SENSOR_SELECTOR_DUMMY=INT_MAX
};
Expand Down

0 comments on commit ed36cb5

Please sign in to comment.