RetroArch
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include "definitions.h"
#include "wiiuse_internal.h"
#include "ir.h"
Macros | |
#define | HEIGHT (384.0f / 512.0f) |
#define | MAX_SB_SLOPE 0.7f |
#define | MIN_SB_WIDTH 0.1f |
#define | SB_MIDDOT_REJECT 0.05f |
#define | SB_WIDTH 19.5f |
#define | SB_DOT_WIDTH 2.25f |
#define | SB_DOT_HEIGHT 1.0f |
#define | SB_DOT_WIDTH_RATIO (SB_DOT_WIDTH / SB_WIDTH) |
#define | SB_DOT_HEIGHT_RATIO (SB_DOT_HEIGHT / SB_WIDTH) |
#define | SB_OFF_SCREEN_X 0.0f |
#define | SB_OFF_SCREEN_Y 0.0f |
#define | SB_SINGLE_NOGUESS_DISTANCE (100.0 * 100.0) |
#define | SB_Z_COEFFICIENT 256.0f |
#define | WIIMOTE_FOV_COEFFICIENT 0.39f |
#define | SQUARED(x) ((x)*(x)) |
#define | WMAX(x, y) ((x>y)?(x):(y)) |
#define | WMIN(x, y) ((x<y)?(x):(y)) |
#define | SMOOTH_IR_RADIUS 8.0f |
#define | SMOOTH_IR_SPEED 0.25f |
#define | SMOOTH_IR_DEADZONE 2.5f |
#define | ERROR_MAX_COUNT 8 |
#define | GLITCH_MAX_COUNT 5 |
#define | GLITCH_DIST (150.0f * 150.0f) |
Enumerations | |
enum | { IR_STATE_DEAD = 0, IR_STATE_GOOD, IR_STATE_SINGLE, IR_STATE_LOST } |
Functions | |
static int | ir_correct_for_bounds (float *x, float *y, enum aspect_t aspect, int offset_x, int offset_y) |
Correct for the IR bounding box. More... | |
static void | ir_convert_to_vres (float *x, float *y, enum aspect_t aspect, unsigned int vx, unsigned int vy) |
Interpolate the point to the user defined virtual screen resolution. More... | |
static int | get_ir_sens (struct wiimote_t *wm, char **block1, char **block2) |
Get the IR sensitivity settings. More... | |
static void | rotate_dots (struct fdot_t *in, struct fdot_t *out, int count, float ang) |
void | wiiuse_set_ir_mode (struct wiimote_t *wm) |
void | wiiuse_set_ir (struct wiimote_t *wm, int status) |
void | wiiuse_set_ir_vres (struct wiimote_t *wm, unsigned int x, unsigned int y) |
Set the virtual screen resolution for IR tracking. More... | |
void | wiiuse_set_ir_position (struct wiimote_t *wm, enum ir_position_t pos) |
Set the XY position for the IR cursor. More... | |
void | wiiuse_set_aspect_ratio (struct wiimote_t *wm, enum aspect_t aspect) |
Set the aspect ratio of the TV/monitor. More... | |
void | wiiuse_set_ir_sensitivity (struct wiimote_t *wm, int level) |
Set the IR sensitivity. More... | |
void | calculate_basic_ir (struct wiimote_t *wm, ubyte *data) |
Calculate the data from the IR spots. Basic IR mode. More... | |
void | calculate_extended_ir (struct wiimote_t *wm, ubyte *data) |
Calculate the data from the IR spots. Extended IR mode. More... | |
void | find_sensorbar (struct ir_t *ir, struct orient_t *orient) |
Interpret IR data into more user friendly variables. More... | |
void | apply_ir_smoothing (struct ir_t *ir) |
Smooth the IR pointer position. More... | |
void | interpret_ir_data (struct ir_t *ir, struct orient_t *orient) |
Interpret IR data into more user friendly variables. More... | |
float | calc_yaw (struct ir_t *ir) |
Calculate yaw given the IR data. More... | |
#define ERROR_MAX_COUNT 8 |
#define GLITCH_DIST (150.0f * 150.0f) |
#define GLITCH_MAX_COUNT 5 |
#define HEIGHT (384.0f / 512.0f) |
#define MAX_SB_SLOPE 0.7f |
#define MIN_SB_WIDTH 0.1f |
#define SB_DOT_HEIGHT 1.0f |
#define SB_DOT_HEIGHT_RATIO (SB_DOT_HEIGHT / SB_WIDTH) |
#define SB_DOT_WIDTH 2.25f |
#define SB_DOT_WIDTH_RATIO (SB_DOT_WIDTH / SB_WIDTH) |
#define SB_MIDDOT_REJECT 0.05f |
#define SB_OFF_SCREEN_X 0.0f |
#define SB_OFF_SCREEN_Y 0.0f |
#define SB_SINGLE_NOGUESS_DISTANCE (100.0 * 100.0) |
#define SB_WIDTH 19.5f |
#define SB_Z_COEFFICIENT 256.0f |
#define SMOOTH_IR_DEADZONE 2.5f |
#define SMOOTH_IR_RADIUS 8.0f |
#define SMOOTH_IR_SPEED 0.25f |
#define WIIMOTE_FOV_COEFFICIENT 0.39f |
Smooth the IR pointer position.
ir | Pointer to an ir_t structure. |
float calc_yaw | ( | struct ir_t * | ir | ) |
Calculate yaw given the IR data.
ir | IR data structure. |
Calculate the data from the IR spots. Basic IR mode.
wm | Pointer to a wiimote_t structure. |
data | Data returned by the wiimote for the IR spots. |
Calculate the data from the IR spots. Extended IR mode.
wm | Pointer to a wiimote_t structure. |
data | Data returned by the wiimote for the IR spots. |
Interpret IR data into more user friendly variables.
wm | Pointer to a wiimote_t structure. |
|
static |
Get the IR sensitivity settings.
wm | Pointer to a wiimote_t structure. |
block1 | [out] Pointer to where block1 will be set. |
block2 | [out] Pointer to where block2 will be set. |
|
static |
Interpolate the point to the user defined virtual screen resolution.
|
static |
Correct for the IR bounding box.
x | [out] The current X, it will be updated if valid. |
y | [out] The current Y, it will be updated if valid. |
aspect | Aspect ratio of the screen. |
offset_x | The X offset of the bounding box. |
offset_y | The Y offset of the bounding box. |
Nintendo was smart with this bit. They sacrifice a little precision for a big increase in usability.
Set the aspect ratio of the TV/monitor.
wm | Pointer to a wiimote_t structure. |
aspect | Either WIIUSE_ASPECT_16_9 or WIIUSE_ASPECT_4_3 |
void wiiuse_set_ir_position | ( | struct wiimote_t * | wm, |
enum ir_position_t | pos | ||
) |
Set the XY position for the IR cursor.
wm | Pointer to a wiimote_t structure. |
Set the IR sensitivity.
wm | Pointer to a wiimote_t structure. |
level | 1-5, same as Wii system sensitivity setting. |
If the level is < 1, then level will be set to 1. If the level is > 5, then level will be set to 5.