Version
menu_open
link
Wwise SDK 2022.1.12
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  Copyright (c) 2024 Audiokinetic Inc.
25 *******************************************************************************/
26 
27 /// \file
28 
29 #pragma once
30 
32 #include <pad.h>
33 
34 // Do a bitwise-OR with the deviceID, when adding the output, to utilize the scePad Haptics ("Advanced") functionality
35 // If unset, the device will use scePad Rumble ("Compatible") functionality
36 #define AKMOTION_SCEPAD_HAPTICS_MODE 0x80000000
37 
38 namespace AK
39 {
40  typedef int(*_akmotionPadGetHandle)(int userId, int type, int index);
41  typedef int(*_akmotionPadGetContainerIdInformation)(int handle, void* pInfo);
42  typedef int(*_akmotionPadGetControllerType)(int handle, void* pControllerType);
43  typedef int(*_akmotionPadSetVibrationMode)(int handle, ScePadVibrationMode mode);
44  typedef int(*_akmotionPadSetVibration)(int handle, const void* pParam);
45 }
46 
47 // Helper functions to facilitate "loose" linkage with scePad library.
48 // If AkMotion is statically linked into your program, call AKMOTION_STATIC_LINK_SCEPAD_FUNCTIONS anywhere (even pre-init)
49 // If AkMotion is dynamically linked into your program, call AKMOTION_DYNAMIC_LINK_SCEPAD_FUNCTIONS after Init.bnk has been loaded
50 #define AKMOTIONSINK_STATIC_LINK_SCEPAD_FUNCTIONS \
51  struct _AkMotionInitializeScePadFunctionsHelper \
52  { \
53  _AkMotionInitializeScePadFunctionsHelper() \
54  { \
55  AkMotionInitializeScePadFunctions(\
56  (AK::_akmotionPadGetHandle)scePadGetHandle, \
57  (AK::_akmotionPadGetContainerIdInformation)scePadGetContainerIdInformation, \
58  (AK::_akmotionPadGetControllerType)scePadGetControllerType, \
59  (AK::_akmotionPadSetVibrationMode)scePadSetVibrationMode, \
60  (AK::_akmotionPadSetVibration)scePadSetVibration); \
61  } \
62  } AkMotionInitializeScePadFunctionsHelper;
63 
64 #define AKMOTIONSINK_DYNAMIC_LINK_SCEPAD_FUNCTIONS \
65  { \
66  HMODULE _akmotion_Hmod; \
67  if (GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, "AkMotion", &_akmotion_Hmod)) \
68  { \
69  typedef int(*_akmotionPadInitFunc)( \
70  AK::_akmotionPadGetHandle in_pPadGetHandle, \
71  AK::_akmotionPadGetContainerIdInformation in_pPadGetContainerIdInformation, \
72  AK::_akmotionPadGetControllerType in_pPadGetControllerType, \
73  AK::_akmotionPadSetVibrationMode in_pPadSetVibrationMode, \
74  AK::_akmotionPadSetVibration in_pPadSetVibration); \
75  _akmotionPadInitFunc _akmotion_pInitFn = reinterpret_cast<_akmotionPadInitFunc>( reinterpret_cast<void*>( \
76  GetProcAddress(_akmotion_Hmod, "AkMotionInitializeScePadFunctions") \
77  )); \
78  _akmotion_pInitFn( \
79  (AK::_akmotionPadGetHandle)scePadGetHandle, \
80  (AK::_akmotionPadGetContainerIdInformation)scePadGetContainerIdInformation, \
81  (AK::_akmotionPadGetControllerType)scePadGetControllerType, \
82  (AK::_akmotionPadSetVibrationMode)scePadSetVibrationMode, \
83  (AK::_akmotionPadSetVibration)scePadSetVibration); \
84  } \
85  } \
86 
87 
88 #ifdef __cplusplus
89 extern "C" {
90 #endif
92  AK::_akmotionPadGetHandle in_pPadGetHandle,
93  AK::_akmotionPadGetContainerIdInformation in_pPadGetContainerIdInformation,
94  AK::_akmotionPadGetControllerType in_pPadGetControllerType,
95  AK::_akmotionPadSetVibrationMode in_pPadSetVibrationMode,
96  AK::_akmotionPadSetVibration in_pPadSetVibration);
97 #ifdef __cplusplus
98 }
99 #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)

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise