Thread: Xinput?

  1. #1
    Registered User
    Join Date
    Jun 2017
    Posts
    4

    Xinput?

    I have the following code and get errors and I dont know why:

    Code:
    dword_result_t XamInputGetCapabilities(dword_t user_index, dword_t flags, pointer_t<X_INPUT_CAPABILITIES> caps_ptr) { 
      if (!caps_ptr) {
        return X_ERROR_BAD_ARGUMENTS;
        return;
      }
      if ((flags & 0xFF) && (flags & XINPUT_FLAG_GAMEPAD) == 0) {
        // Ignore any query for other types of devices.
        return X_ERROR_DEVICE_NOT_CONNECTED;
        return;
      }
      if ((user_index & 0xFF) == 0xFF || (flags & XINPUT_FLAG_ANY_USER)) {
        // Always pin user to 0.
        user_index = 0;
      }
    
    
      auto input_system = kernel_state()->emulator()->input_system();
      
      X_RESULT result = input_system->GetCapabilities(user_index, flags, caps_ptr);
      return result;
    }
    The following errors:

    error C2561: 'xe::kernel::xam::XamInputGetCapabilities': func
    tion must return a value

    error C2678: binary '=': no operator found which takes a left
    -hand operand of type 'const xe::kernel::shim::ParamBase<uint32_t>

    Now the parameters at this link and I am changing the code from a shim call to dword_result_t

    shim_utils.h Source View - Source code download - xenia dword_t I am guessing is wrong for user_index unless I have to do something like user_index.value() = 0;

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    35,802
    I would simply delete lines 4 and 9, those empty (and unreachable) return statements without a value.
    You return values on the return statements on the preceding lines.

    Also, why do this?
    X_RESULT result = input_system->GetCapabilities(user_index, flags, caps_ptr);
    return result;

    When you can do this
    return input_system->GetCapabilities(user_index, flags, caps_ptr);
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jun 2017
    Posts
    4
    I have most of it working thanks Salem. However, I still get this error:


    c:\users\tom\xenia\src\xenia\kernel\xam\xam_input. cc(67): error C2678: binary '=': no operator found which takes a left
    -hand operand of type 'const xe::kernel::shim::ParamBase<uint32_t>' (or there is no acceptable conversion)

    This is the defined list and I am guessing I have to do something with user_index.


    1. using int_t = const shim::ParamBase<int32_t>&;
    2. using word_t = const shim::ParamBase<uint16_t>&;
    3. using dword_t = const shim::ParamBase<uint32_t>&;
    4. using qword_t = const shim::ParamBase<uint64_t>&;
    5. using float_t = const shim::ParamBase<float>&;
    6. using double_t = const shim::ParamBase<double>&;
    7. using lpvoid_t = const shim::PointerParam&;
    8. using lpword_t = const shim::PrimitivePointerParam<uint16_t>&;
    9. using lpdword_t = const shim::PrimitivePointerParam<uint32_t>&;
    10. using lpqword_t = const shim::PrimitivePointerParam<uint64_t>&;
    11. using lpfloat_t = const shim::PrimitivePointerParam<float>&;
    12. using lpdouble_t = const shim::PrimitivePointerParam<double>&;
    13. using lpstring_t = const shim::StringPointerParam<char, std::string>&;
    14. using lpwstring_t = const shim::StringPointerParam<wchar_t, std::wstring>&;
    15. using function_t = const shim::ParamBase<uint32_t>&;
    16. using unknown_t = const shim::ParamBase<uint32_t>&;
    17. using lpunknown_t = const shim::PointerParam&;
    18. template <typename T>
    19. using pointer_t = const shim::TypedPointerParam<T>&;

    20. using int_result_t = shim::Result<int32_t>;
    21. using dword_result_t = shim::Result<uint32_t>;
    22. using pointer_result_t = shim::Result<uint32_t>;

  4. #4
    Registered User
    Join Date
    Jun 2017
    Posts
    4
    I am still getting this error and I think need to do something with user_index.

    error C2678: binary '=': no operator found which takes a left
    -hand operand of type 'const xe::kernel::shim::ParamBase<uint32_t>'

    c:\users\tom\xenia\src\xenia\kernel\util\shim_util s.h(145): note: or 'xe::kernel::shim::ParamBase<uint32_t> &xe
    ::kernel::shim::ParamBase<uint32_t>:perator =(const T &)'
    with
    [
    T=uint32_t
    ]
    c:\users\tom\xenia\src\xenia\kernel\xam\xam_input. cc(67): note: while trying to match the argument list '(const xe::k
    ernel::shim::ParamBase<uint32_t>, int)'

    Here is the types list I think:

    1. using int_t = const shim::ParamBase<int32_t>&;
    2. using word_t = const shim::ParamBase<uint16_t>&;
    3. using dword_t = const shim::ParamBase<uint32_t>&;
    4. using qword_t = const shim::ParamBase<uint64_t>&;
    5. using float_t = const shim::ParamBase<float>&;
    6. using double_t = const shim::ParamBase<double>&;
    7. using lpvoid_t = const shim::PointerParam&;
    8. using lpword_t = const shim::PrimitivePointerParam<uint16_t>&;
    9. using lpdword_t = const shim::PrimitivePointerParam<uint32_t>&;
    10. using lpqword_t = const shim::PrimitivePointerParam<uint64_t>&;
    11. using lpfloat_t = const shim::PrimitivePointerParam<float>&;
    12. using lpdouble_t = const shim::PrimitivePointerParam<double>&;
    13. using lpstring_t = const shim::StringPointerParam<char, std::string>&;
    14. using lpwstring_t = const shim::StringPointerParam<wchar_t, std::wstring>&;
    15. using function_t = const shim::ParamBase<uint32_t>&;
    16. using unknown_t = const shim::ParamBase<uint32_t>&;
    17. using lpunknown_t = const shim::PointerParam&;
    18. template <typename T>
    19. using pointer_t = const shim::TypedPointerParam<T>&;

    20. using int_result_t = shim::Result<int32_t>;
    21. using dword_result_t = shim::Result<uint32_t>;
    22. using pointer_result_t = shim::Result<uint32_t>;

  5. #5
    Registered User
    Join Date
    Jun 2017
    Posts
    4
    I figured it out. Now I have to figure out the keyboard one.

Popular pages Recent additions subscribe to a feed

Tags for this Thread