<commit_before>#![allow(dead_code)]
#![allow(unused_variables)]

// Dependencies
mod vjoyinterface;
extern crate std;
extern crate libc;

// Control constants - what magic numbers do we need to play with each virtual device input?
// USB HID joystick constants. We assume our emulator is configured to map virtual joystick to N64 joystick
const HID_JOYSTICK_X: libc::c_uint = 0x30;
const HID_JOYSTICK_Y: libc::c_uint = 0x31;

// Number of digital inputs on a standard N64 controller
pub const NUM_N64_BUTTONS: u8 = 14;

// Enumeration of digital inputs on an N64 controller
#[derive(Debug, Clone, Copy)]
pub enum ButtonName {
    A,
    B,
    Z,
    L,
    R,
    Start,
    Cup,
    Cdown,
    Cleft,
    Cright,
    Dup,
    Ddown,
    Dleft,
    Dright
}

impl ButtonName {
    // Emulator button bindings - what emulator button each virtual joystick button is connected to
    // Note that vJoy button indices are one-based
    fn get_vjoy_button_index(&self) -> libc::c_uchar {
        match *self {
            ButtonName::A => 0x01,
            ButtonName::B => 0x02,
            ButtonName::Z => 0x03,
            ButtonName::L => 0x04,
            ButtonName::R => 0x05,
            ButtonName::Start => 0x06,
            ButtonName::Cup => 0x07,
            ButtonName::Cdown => 0x08,
            ButtonName::Cleft => 0x09,
            ButtonName::Cright => 0x10,
            ButtonName::Dup => 0x11,
            ButtonName::Ddown => 0x12,
            ButtonName::Dleft => 0x13,
            ButtonName::Dright => 0x14
        }
    }
}

// Properties (non-input-state characteristics) about a virtual N64 controller
// Post-initialization, this should all be read-only
#[derive(Default)]
struct Props {
    vjoy_device_number: libc::c_uint,
    
    x_min: libc::c_long,
    x_max: libc::c_long,
    y_min: libc::c_long,
    y_max: libc::c_long,
}

// Comprehensive status of a virtual N64 controller's inputs
#[derive(Default)]
struct State {
    x: libc::c_long,
    y: libc::c_long,
    a: libc::c_int,
    b: libc::c_int,
    z: libc::c_int,
    l: libc::c_int,
    r: libc::c_int,
    start: libc::c_int,
    cup: libc::c_int,
    cdown: libc::c_int,
    cleft: libc::c_int,
    cright: libc::c_int,<commit_msg>Fix Cright and Dpad<commit_after>#![allow(dead_code)]
#![allow(unused_variables)]

// Dependencies
mod vjoyinterface;
extern crate std;
extern crate libc;

// Control constants - what magic numbers do we need to play with each virtual device input?
// USB HID joystick constants. We assume our emulator is configured to map virtual joystick to N64 joystick
const HID_JOYSTICK_X: libc::c_uint = 0x30;
const HID_JOYSTICK_Y: libc::c_uint = 0x31;

// Number of digital inputs on a standard N64 controller
pub const NUM_N64_BUTTONS: u8 = 14;

// Enumeration of digital inputs on an N64 controller
#[derive(Debug, Clone, Copy)]
pub enum ButtonName {
    A,
    B,
    Z,
    L,
    R,
    Start,
    Cup,
    Cdown,
    Cleft,
    Cright,
    Dup,
    Ddown,
    Dleft,
    Dright
}

impl ButtonName {
    // Emulator button bindings - what emulator button each virtual joystick button is connected to
    // Note that vJoy button indices are one-based
    fn get_vjoy_button_index(&self) -> libc::c_uchar {
        match *self {
            ButtonName::A => 0x01,
            ButtonName::B => 0x02,
            ButtonName::Z => 0x03,
            ButtonName::L => 0x04,
            ButtonName::R => 0x05,
            ButtonName::Start => 0x06,
            ButtonName::Cup => 0x07,
            ButtonName::Cdown => 0x08,
            ButtonName::Cleft => 0x09,
            ButtonName::Cright => 0x0a,
            ButtonName::Dup => 0x0b,
            ButtonName::Ddown => 0x0c,
            ButtonName::Dleft => 0x0d,
            ButtonName::Dright => 0x0e
        }
    }
}

// Properties (non-input-state characteristics) about a virtual N64 controller
// Post-initialization, this should all be read-only
#[derive(Default)]
struct Props {
    vjoy_device_number: libc::c_uint,
    
    x_min: libc::c_long,
    x_max: libc::c_long,
    y_min: libc::c_long,
    y_max: libc::c_long,
}

// Comprehensive status of a virtual N64 controller's inputs
#[derive(Default)]
struct State {
    x: libc::c_long,
    y: libc::c_long,
    a: libc::c_int,
    b: libc::c_int,
    z: libc::c_int,
    l: libc::c_int,
    r: libc::c_int,
    start: libc::c_int,
    cup: libc::c_int,
    cdown: libc::c_int,
    cleft: libc::c_int,
    cright: libc::c_int,
{'fraction_non_alphanumeric': 0.11210762331838565, 'fraction_numerical': 0.027130044843049327, 'mean_word_length': 2.615072933549433, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2175849', 'n_tokens_mistral': 1658, 'n_tokens_neox': 1528, 'n_words': 422}