added support for firmware 3.x.x

This commit is contained in:
Maschell 2016-04-28 21:00:19 +02:00
parent d7afc99b56
commit 9291226f5a
2 changed files with 25 additions and 18 deletions

View File

@ -21,12 +21,12 @@
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#include "common/common.h"
#include "os_functions.h"
#include "ax_functions.h"
unsigned int sound_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(void, AXInitWithParams, u32 * params);
EXPORT_DECL(void, AXInit, void);
EXPORT_DECL(void, AXQuit, void);
EXPORT_DECL(u32, AXGetInputSamplesPerSec, void);
EXPORT_DECL(u32, AXGetInputSamplesPerFrame, void);
@ -47,20 +47,29 @@ EXPORT_DECL(u32, AXGetVoiceLoopCount, void *v);
EXPORT_DECL(void, AXSetVoiceEndOffset, void *v, u32 offset);
EXPORT_DECL(void, AXSetVoiceLoopOffset, void *v, u32 offset);
void InitAcquireAX(void)
{
OSDynLoad_Acquire("sndcore2.rpl", &sound_handle);
}
void InitAXFunctionPointers(void)
{
InitAcquireAX();
unsigned int sound_handle = 0;
unsigned int *funcPointer = 0;
OSDynLoad_Acquire("sndcore2.rpl", &sound_handle);
OS_FIND_EXPORT(sound_handle, AXInitWithParams);
if(OS_FIRMWARE >= 400)
{
AXInit = 0;
OSDynLoad_Acquire("sndcore2.rpl", &sound_handle);
OS_FIND_EXPORT(sound_handle, AXInitWithParams);
OS_FIND_EXPORT(sound_handle, AXGetInputSamplesPerSec);
}
else
{
AXInitWithParams = 0;
AXGetInputSamplesPerSec = 0;
OSDynLoad_Acquire("snd_core.rpl", &sound_handle);
OS_FIND_EXPORT(sound_handle, AXInit);
}
OS_FIND_EXPORT(sound_handle, AXQuit);
OS_FIND_EXPORT(sound_handle, AXGetInputSamplesPerSec);
OS_FIND_EXPORT(sound_handle, AXVoiceBegin);
OS_FIND_EXPORT(sound_handle, AXVoiceEnd);
OS_FIND_EXPORT(sound_handle, AXSetVoiceType);
@ -84,18 +93,18 @@ void ProperlyEndTransitionAudio(void)
bool (* check_os_audio_transition_flag_old)(void);
void (* AXInit_old)(void);
void (* AXQuit_old)(void);
unsigned int *funcPointer = 0;
unsigned int sound_handle;
OSDynLoad_Acquire("snd_core.rpl", &sound_handle);
OS_FIND_EXPORT_EX(sound_handle, check_os_audio_transition_flag, check_os_audio_transition_flag_old);
OS_FIND_EXPORT_EX(sound_handle, AXInit, AXInit_old);
OS_FIND_EXPORT_EX(sound_handle, AXQuit, AXQuit_old);
if (check_os_audio_transition_flag_old())
{
AXInit_old();
AXQuit_old();
}
}
}

View File

@ -30,13 +30,11 @@ extern "C" {
#include <gctypes.h>
extern unsigned int sound_handle;
void InitAXFunctionPointers(void);
void InitAcquireAX(void);
void ProperlyEndTransitionAudio(void);
extern void (* AXInitWithParams)(u32 * params);
extern void (* AXInit)(void);
extern void (* AXQuit)(void);
extern u32 (* AXGetInputSamplesPerSec)(void);
extern s32 (* AXVoiceBegin)(void *v);