Version
Wwise SDK 2021.1.10
AkMotionSinkScePadHelpers.h
Go to the documentation of this file.
1 /*******************************************************************************
2 The content of this file includes portions of the AUDIOKINETIC Wwise Technology
3 released in source code form as part of the SDK installer package.
4 
5 Commercial License Usage
6 
7 Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
8 may use this file in accordance with the end user license agreement provided
9 with the software or, alternatively, in accordance with the terms contained in a
10 written agreement between you and Audiokinetic Inc.
11 
12 Apache License Usage
13 
14 Alternatively, this file may be used under the Apache License, Version 2.0 (the
15 "Apache License"); you may not use this file except in compliance with the
16 Apache License. You may obtain a copy of the Apache License at
17 http://www.apache.org/licenses/LICENSE-2.0.
18 
19 Unless required by applicable law or agreed to in writing, software distributed
20 under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
21 OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for
22 the specific language governing permissions and limitations under the License.
23 
24  Version: v2021.1.10 Build: 7883
25  Copyright (c) 2006-2022 Audiokinetic Inc.
26 *******************************************************************************/
27 
28 /// \file
29 
30 #pragma once
31 
33 #include <pad.h>
34 
35 // Do a bitwise-OR with the deviceID, when adding the output, to utilize the scePad Haptics ("Advanced") functionality
36 // If unset, the device will use scePad Rumble ("Compatible") functionality
37 #define AKMOTION_SCEPAD_HAPTICS_MODE 0x80000000
38 
39 namespace AK
40 {
41  typedef int(*_akmotionPadGetHandle)(int userId, int type, int index);
42  typedef int(*_akmotionPadGetContainerIdInformation)(int handle, void* pInfo);
43  typedef int(*_akmotionPadGetControllerType)(int handle, void* pControllerType);
44  typedef int(*_akmotionPadSetVibrationMode)(int handle, ScePadVibrationMode mode);
45  typedef int(*_akmotionPadSetVibration)(int handle, const void* pParam);
46 }
47 
48 // Helper functions to facilitate "loose" linkage with scePad library.
49 // If AkMotion is statically linked into your program, call AKMOTION_STATIC_LINK_SCEPAD_FUNCTIONS anywhere (even pre-init)
50 // If AkMotion is dynamically linked into your program, call AKMOTION_DYNAMIC_LINK_SCEPAD_FUNCTIONS after Init.bnk has been loaded
51 #define AKMOTIONSINK_STATIC_LINK_SCEPAD_FUNCTIONS \
52  struct _AkMotionInitializeScePadFunctionsHelper \
53  { \
54  _AkMotionInitializeScePadFunctionsHelper() \
55  { \
56  AkMotionInitializeScePadFunctions(\
57  (AK::_akmotionPadGetHandle)scePadGetHandle, \
58  (AK::_akmotionPadGetContainerIdInformation)scePadGetContainerIdInformation, \
59  (AK::_akmotionPadGetControllerType)scePadGetControllerType, \
60  (AK::_akmotionPadSetVibrationMode)scePadSetVibrationMode, \
61  (AK::_akmotionPadSetVibration)scePadSetVibration); \
62  } \
63  } AkMotionInitializeScePadFunctionsHelper;
64 
65 #define AKMOTIONSINK_DYNAMIC_LINK_SCEPAD_FUNCTIONS \
66  { \
67  HMODULE _akmotion_Hmod; \
68  if (GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, "AkMotion", &_akmotion_Hmod)) \
69  { \
70  typedef int(*_akmotionPadInitFunc)( \
71  AK::_akmotionPadGetHandle in_pPadGetHandle, \
72  AK::_akmotionPadGetContainerIdInformation in_pPadGetContainerIdInformation, \
73  AK::_akmotionPadGetControllerType in_pPadGetControllerType, \
74  AK::_akmotionPadSetVibrationMode in_pPadSetVibrationMode, \
75  AK::_akmotionPadSetVibration in_pPadSetVibration); \
76  _akmotionPadInitFunc _akmotion_pInitFn = reinterpret_cast<_akmotionPadInitFunc>( reinterpret_cast<void*>( \
77  GetProcAddress(_akmotion_Hmod, "AkMotionInitializeScePadFunctions") \
78  )); \
79  _akmotion_pInitFn( \
80  (AK::_akmotionPadGetHandle)scePadGetHandle, \
81  (AK::_akmotionPadGetContainerIdInformation)scePadGetContainerIdInformation, \
82  (AK::_akmotionPadGetControllerType)scePadGetControllerType, \
83  (AK::_akmotionPadSetVibrationMode)scePadSetVibrationMode, \
84  (AK::_akmotionPadSetVibration)scePadSetVibration); \
85  } \
86  } \
87 
88 
89 #ifdef __cplusplus
90 extern "C" {
91 #endif
93  AK::_akmotionPadGetHandle in_pPadGetHandle,
94  AK::_akmotionPadGetContainerIdInformation in_pPadGetContainerIdInformation,
95  AK::_akmotionPadGetControllerType in_pPadGetControllerType,
96  AK::_akmotionPadSetVibrationMode in_pPadSetVibrationMode,
97  AK::_akmotionPadSetVibration in_pPadSetVibration);
98 #ifdef __cplusplus
99 }
100 #endif
Audiokinetic namespace.
AK_DLLEXPORT void AkMotionInitializeScePadFunctions(AK::_akmotionPadGetHandle in_pPadGetHandle, AK::_akmotionPadGetContainerIdInformation in_pPadGetContainerIdInformation, AK::_akmotionPadGetControllerType in_pPadGetControllerType, AK::_akmotionPadSetVibrationMode in_pPadSetVibrationMode, AK::_akmotionPadSetVibration in_pPadSetVibration)
#define AK_DLLEXPORT
int(* _akmotionPadGetHandle)(int userId, int type, int index)
int(* _akmotionPadGetControllerType)(int handle, void *pControllerType)
int(* _akmotionPadGetContainerIdInformation)(int handle, void *pInfo)
int(* _akmotionPadSetVibration)(int handle, const void *pParam)
int(* _akmotionPadSetVibrationMode)(int handle, ScePadVibrationMode mode)